@dialecte/core 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { t as $e, i as Oe } from "./index-C2WRi-6U.js";
2
- import { g as vr, l as ce, o as br, k as pr, s as vo, t as bo, C as gi, m as wo } from "./merge-extensions-DQKNUthU.js";
1
+ import { t as $e, i as we } from "./index-DWV6tSGF.js";
2
+ import { g as vr, l as ce, n as br, k as pr, s as yo, t as vo, C as gi } from "./standardizing-FTZoR5RH.js";
3
3
  function gr(m, r) {
4
4
  if (!m) return {};
5
5
  const s = {};
@@ -13,7 +13,7 @@ function gr(m, r) {
13
13
  }
14
14
  return s;
15
15
  }
16
- function _o(m) {
16
+ function bo(m) {
17
17
  const { stagedOperations: r, tagName: s, id: o } = m;
18
18
  for (let d = r.length - 1; d >= 0; d--) {
19
19
  const f = r[d];
@@ -62,7 +62,7 @@ function _o(m) {
62
62
  }
63
63
  }
64
64
  }
65
- function Eo(m) {
65
+ function wo(m) {
66
66
  const { rawRecords: r, stagedOperations: s, tagName: o } = m, d = new Map(
67
67
  r.map((f) => [f.id, { ...f, status: "unchanged" }])
68
68
  );
@@ -78,7 +78,7 @@ function Eo(m) {
78
78
  async function me(m) {
79
79
  const { context: r, ref: s } = m;
80
80
  if (r.stagedOperations.length > 0) {
81
- const d = _o({
81
+ const d = bo({
82
82
  stagedOperations: r.stagedOperations,
83
83
  tagName: s.tagName,
84
84
  id: s.id
@@ -111,7 +111,7 @@ async function Sn(m) {
111
111
  );
112
112
  for (const d of o)
113
113
  zt(r) && r.recordCache.set(d.id, d);
114
- return Eo({ rawRecords: o, stagedOperations: r.stagedOperations, tagName: s });
114
+ return wo({ rawRecords: o, stagedOperations: r.stagedOperations, tagName: s });
115
115
  }
116
116
  async function yi(m) {
117
117
  const { context: r, ref: s, tagName: o } = m, d = await me({ context: r, ref: s });
@@ -126,14 +126,14 @@ async function yi(m) {
126
126
  for (const D of g) {
127
127
  const I = await me({ context: r, ref: D });
128
128
  if (!I) continue;
129
- const q = I.children.find((M) => M.tagName === o);
129
+ const q = I.children.find((j) => j.tagName === o);
130
130
  if (q) return me({ context: r, ref: q });
131
131
  }
132
132
  }
133
133
  async function vi(m) {
134
134
  const { context: r, ref: s, tagName: o } = m, d = await me({ context: r, ref: s });
135
135
  if (!d) return [];
136
- const f = d.children.filter((M) => M.tagName === o).map((M) => ({ tagName: o, id: M.id }));
136
+ const f = d.children.filter((j) => j.tagName === o).map((j) => ({ tagName: o, id: j.id }));
137
137
  if (f.length)
138
138
  return (await Zt({ context: r, refs: f })).filter(
139
139
  (X) => X !== void 0
@@ -141,12 +141,12 @@ async function vi(m) {
141
141
  const v = r.dialecteConfig.transparentElements;
142
142
  if (!v?.length) return [];
143
143
  const g = d.children.filter(
144
- (M) => v.includes(M.tagName)
144
+ (j) => v.includes(j.tagName)
145
145
  );
146
146
  if (!g.length) return [];
147
- const I = (await Zt({ context: r, refs: g })).filter((M) => M !== void 0).flatMap((M) => M.children.filter((X) => X.tagName === o)).map((M) => ({ tagName: o, id: M.id }));
147
+ const I = (await Zt({ context: r, refs: g })).filter((j) => j !== void 0).flatMap((j) => j.children.filter((X) => X.tagName === o)).map((j) => ({ tagName: o, id: j.id }));
148
148
  return I.length ? (await Zt({ context: r, refs: I })).filter(
149
- (M) => M !== void 0
149
+ (j) => j !== void 0
150
150
  ) : [];
151
151
  }
152
152
  async function bi(m) {
@@ -184,13 +184,13 @@ function xt(m) {
184
184
  return !0;
185
185
  }
186
186
  async function wr(m) {
187
- const { context: r, ref: s, options: o } = m, { collect: d, omit: f } = o, v = xo(f), g = To(d), D = /* @__PURE__ */ new Map();
187
+ const { context: r, ref: s, options: o } = m, { collect: d, omit: f } = o, v = _o(f), g = Eo(d), D = /* @__PURE__ */ new Map();
188
188
  for (const q of g.allTags)
189
189
  D.set(q, /* @__PURE__ */ new Map());
190
190
  const I = await me({ context: r, ref: s });
191
- return I && (g.mode === "flat" ? await Co({ context: r, rootId: I.id, collectSpec: g, omitSpec: v, collected: D }) : await Ei({ context: r, record: I, pathNodes: g.paths, omitSpec: v, collected: D })), ii(D);
191
+ return I && (g.mode === "flat" ? await To({ context: r, rootId: I.id, collectSpec: g, omitSpec: v, collected: D }) : await Ei({ context: r, record: I, pathNodes: g.paths, omitSpec: v, collected: D })), ii(D);
192
192
  }
193
- function xo(m) {
193
+ function _o(m) {
194
194
  const r = /* @__PURE__ */ new Set(), s = [];
195
195
  if (!m) return { unconditional: r, conditional: s };
196
196
  for (const o of m)
@@ -213,7 +213,7 @@ function xr(m) {
213
213
  return !0;
214
214
  return !1;
215
215
  }
216
- function To(m) {
216
+ function Eo(m) {
217
217
  if (typeof m == "string")
218
218
  return { mode: "flat", targets: [{ tagName: m }], allTags: /* @__PURE__ */ new Set([m]) };
219
219
  if (Array.isArray(m)) {
@@ -234,12 +234,12 @@ function wi(m, r) {
234
234
  for (const [o, d] of Object.entries(m)) {
235
235
  if (o === "where") continue;
236
236
  r.add(o);
237
- const f = No({ tagName: o, value: d, allTags: r });
237
+ const f = xo({ tagName: o, value: d, allTags: r });
238
238
  f && s.push(f);
239
239
  }
240
240
  return s;
241
241
  }
242
- function No(m) {
242
+ function xo(m) {
243
243
  const { tagName: r, value: s, allTags: o } = m;
244
244
  if (s === !0)
245
245
  return { tagName: r, where: void 0, children: [], isLeaf: !0 };
@@ -253,7 +253,7 @@ function No(m) {
253
253
  const D = wi(g, o);
254
254
  return { tagName: r, where: f, children: D, isLeaf: !1 };
255
255
  }
256
- async function Co(m) {
256
+ async function To(m) {
257
257
  const { context: r, rootId: s, collectSpec: o, omitSpec: d, collected: f } = m;
258
258
  for (const v of o.targets) {
259
259
  if (d.unconditional.has(v.tagName)) continue;
@@ -262,7 +262,7 @@ async function Co(m) {
262
262
  tagName: v.tagName
263
263
  });
264
264
  for (const D of g)
265
- _i({ record: D, where: v.where }) && (xr({ record: D, omitSpec: d }) || await Oo({ context: r, record: D, rootId: s, omitSpec: d }) && f.get(v.tagName).set(D.id, D));
265
+ _i({ record: D, where: v.where }) && (xr({ record: D, omitSpec: d }) || await No({ context: r, record: D, rootId: s, omitSpec: d }) && f.get(v.tagName).set(D.id, D));
266
266
  }
267
267
  }
268
268
  function _i(m) {
@@ -272,7 +272,7 @@ function _i(m) {
272
272
  attributeFilter: s
273
273
  }) : !0;
274
274
  }
275
- async function Oo(m) {
275
+ async function No(m) {
276
276
  const { context: r, record: s, rootId: o, omitSpec: d } = m;
277
277
  if (s.id === o) return !0;
278
278
  let f = s;
@@ -290,7 +290,7 @@ async function Ei(m) {
290
290
  if (!s.children?.length) return;
291
291
  const v = new Set(o.map((g) => g.tagName));
292
292
  for (const g of o) {
293
- const D = await Ao({
293
+ const D = await Co({
294
294
  context: r,
295
295
  record: s,
296
296
  tagName: g.tagName,
@@ -308,7 +308,7 @@ async function Ei(m) {
308
308
  });
309
309
  }
310
310
  }
311
- async function Ao(m) {
311
+ async function Co(m) {
312
312
  const { context: r, record: s, tagName: o, where: d, omitSpec: f, stopAtTagNames: v } = m, g = [];
313
313
  if (!s.children?.length) return g;
314
314
  const D = [], I = await ri({ context: r, record: s, omitSpec: f });
@@ -319,8 +319,8 @@ async function Ao(m) {
319
319
  continue;
320
320
  }
321
321
  if (!(v.has(q.tagName) && q.tagName !== o) && q.children?.length) {
322
- const M = await ri({ context: r, record: q, omitSpec: f });
323
- D.push(...M);
322
+ const j = await ri({ context: r, record: q, omitSpec: f });
323
+ D.push(...j);
324
324
  }
325
325
  }
326
326
  return g;
@@ -362,20 +362,20 @@ async function Ci(m) {
362
362
  }
363
363
  async function Oi(m) {
364
364
  const { context: r, ref: s, options: o = {}, dialecteConfig: d } = m, { select: f, omit: v, unwrap: g } = o, D = await me({ context: r, ref: s });
365
- Oe(D, {
365
+ we(D, {
366
366
  detail: "No record found for provided ref",
367
367
  key: "ELEMENT_NOT_FOUND"
368
368
  });
369
- const I = Do(v), q = await Ai({
369
+ const I = Oo(v), q = await Ai({
370
370
  context: r,
371
371
  record: D,
372
372
  select: f,
373
373
  compiledOmit: I,
374
374
  dialecteConfig: d
375
375
  });
376
- return q ? g ? qo({ tree: q, unwrapTagNames: g }) : q : br({ record: D });
376
+ return q ? g ? Mo({ tree: q, unwrapTagNames: g }) : q : br({ record: D });
377
377
  }
378
- function Do(m) {
378
+ function Oo(m) {
379
379
  const r = /* @__PURE__ */ new Set(), s = [];
380
380
  if (!m) return { unconditional: r, conditional: s };
381
381
  for (const o of m) {
@@ -398,9 +398,9 @@ function Do(m) {
398
398
  }
399
399
  async function Ai(m) {
400
400
  const { context: r, record: s, select: o, compiledOmit: d, dialecteConfig: f } = m;
401
- if (So({ record: s, compiledOmit: d }))
401
+ if (Ao({ record: s, compiledOmit: d }))
402
402
  return br({ record: s });
403
- const v = await Ro({
403
+ const v = await So({
404
404
  context: r,
405
405
  record: s,
406
406
  select: o,
@@ -415,7 +415,7 @@ async function Ai(m) {
415
415
  );
416
416
  return br({ record: s, tree: D });
417
417
  }
418
- function So(m) {
418
+ function Ao(m) {
419
419
  const { record: r, compiledOmit: s } = m;
420
420
  return s.conditional.some(
421
421
  (o) => o.scope === "children" && o.tagName === r.tagName && xt({
@@ -424,7 +424,7 @@ function So(m) {
424
424
  })
425
425
  );
426
426
  }
427
- function ko(m) {
427
+ function Do(m) {
428
428
  const { record: r, compiledOmit: s } = m;
429
429
  return s.unconditional.has(r.tagName) ? !0 : s.conditional.some(
430
430
  (o) => o.scope === "self" && o.tagName === r.tagName && xt({
@@ -433,42 +433,42 @@ function ko(m) {
433
433
  })
434
434
  );
435
435
  }
436
- async function Ro(m) {
436
+ async function So(m) {
437
437
  const { context: r, record: s, select: o, compiledOmit: d, dialecteConfig: f } = m;
438
438
  if (!s.children?.length) return [];
439
- const v = o ? Fo(o) : void 0;
439
+ const v = o ? Io(o) : void 0;
440
440
  if (v && o && f && o.recursive !== !1) {
441
- const M = s.tagName, X = f.children[M], ie = o[M] !== void 0;
442
- X?.includes(M) && !ie && v.add(M);
441
+ const j = s.tagName, X = f.children[j], oe = o[j] !== void 0;
442
+ X?.includes(j) && !oe && v.add(j);
443
443
  }
444
444
  const g = s.children.filter(
445
- (M) => Io({ tagName: M.tagName, compiledOmit: d, selectKeys: v })
445
+ (j) => ko({ tagName: j.tagName, compiledOmit: d, selectKeys: v })
446
446
  );
447
447
  if (!g.length) return [];
448
448
  const q = (await Promise.all(
449
449
  g.map(
450
- (M) => me({
450
+ (j) => me({
451
451
  context: r,
452
- ref: ce(M)
452
+ ref: ce(j)
453
453
  })
454
454
  )
455
455
  )).filter(
456
- (M) => M !== void 0
457
- ).filter((M) => !ko({ record: M, compiledOmit: d }));
458
- return Bo({ children: q, select: o, record: s, dialecteConfig: f });
456
+ (j) => j !== void 0
457
+ ).filter((j) => !Do({ record: j, compiledOmit: d }));
458
+ return Po({ children: q, select: o, record: s, dialecteConfig: f });
459
459
  }
460
- function Io(m) {
460
+ function ko(m) {
461
461
  const { tagName: r, compiledOmit: s, selectKeys: o } = m;
462
462
  return !(s.unconditional.has(r) || o && !o.has(r));
463
463
  }
464
- const Po = /* @__PURE__ */ new Set(["where", "recursive"]);
465
- function Fo(m) {
464
+ const Ro = /* @__PURE__ */ new Set(["where", "recursive"]);
465
+ function Io(m) {
466
466
  const r = /* @__PURE__ */ new Set();
467
467
  for (const s of Object.keys(m))
468
- Po.has(s) || r.add(s);
468
+ Ro.has(s) || r.add(s);
469
469
  return r;
470
470
  }
471
- function Bo(m) {
471
+ function Po(m) {
472
472
  const { children: r, select: s, record: o, dialecteConfig: d } = m;
473
473
  if (!s)
474
474
  return r.map((v) => ({ record: v, select: void 0 }));
@@ -476,7 +476,7 @@ function Bo(m) {
476
476
  for (const v of r) {
477
477
  const g = s[v.tagName];
478
478
  if (g === void 0 && v.tagName === o.tagName) {
479
- const I = Mo({ child: v, select: s, dialecteConfig: d });
479
+ const I = Fo({ child: v, select: s, dialecteConfig: d });
480
480
  if (I) {
481
481
  f.push(I);
482
482
  continue;
@@ -487,12 +487,12 @@ function Bo(m) {
487
487
  f.push({ record: v, select: void 0 });
488
488
  continue;
489
489
  }
490
- const D = jo({ child: v, entry: g, parentRecord: o });
490
+ const D = Bo({ child: v, entry: g, parentRecord: o });
491
491
  D && f.push(D);
492
492
  }
493
493
  return f;
494
494
  }
495
- function Mo(m) {
495
+ function Fo(m) {
496
496
  const { child: r, select: s, dialecteConfig: o } = m;
497
497
  if (!(!o || s.recursive === !1 || !o.children[r.tagName]?.includes(r.tagName)) && !(s.where && !xt({
498
498
  record: r,
@@ -500,7 +500,7 @@ function Mo(m) {
500
500
  })))
501
501
  return { record: r, select: s };
502
502
  }
503
- function jo(m) {
503
+ function Bo(m) {
504
504
  const { child: r, entry: s, parentRecord: o } = m, d = s;
505
505
  if (!(d.where && !xt({
506
506
  record: r,
@@ -510,14 +510,14 @@ function jo(m) {
510
510
  const f = d.recursive === !0 ? !0 : d.recursive - 1;
511
511
  return f === 0 ? void 0 : { record: r, select: { ...d, recursive: f } };
512
512
  }
513
- return d.recursive ? { record: r, select: Ko(d, r.tagName) } : r.tagName === o.tagName ? { record: r, select: { ...d, recursive: !1 } } : { record: r, select: d };
513
+ return d.recursive ? { record: r, select: jo(d, r.tagName) } : r.tagName === o.tagName ? { record: r, select: { ...d, recursive: !1 } } : { record: r, select: d };
514
514
  }
515
515
  }
516
- function Ko(m, r) {
516
+ function jo(m, r) {
517
517
  const s = m[r];
518
518
  return m;
519
519
  }
520
- function qo(m) {
520
+ function Mo(m) {
521
521
  const { tree: r, unwrapTagNames: s } = m;
522
522
  function o(d) {
523
523
  return d.flatMap((f) => s.includes(f.tagName) ? o(f.tree) : [{ ...f, tree: o(f.tree) }]);
@@ -656,7 +656,7 @@ class Si {
656
656
  context: this.context,
657
657
  ref: { tagName: this.dialecteConfig.rootElementName }
658
658
  });
659
- return Oe(r, {
659
+ return we(r, {
660
660
  key: "ROOT_NOT_FOUND",
661
661
  detail: `Expected tag name: ${this.dialecteConfig.rootElementName}`
662
662
  }), r;
@@ -817,13 +817,13 @@ class Si {
817
817
  function et(m) {
818
818
  const { context: r, status: s, record: o, oldRecord: d, newRecord: f } = m;
819
819
  let v, g, D;
820
- o && (v = pr(o)), d && (g = pr(d)), f && (D = pr(f)), s === "created" ? (Oe(v, {
820
+ o && (v = pr(o)), d && (g = pr(d)), f && (D = pr(f)), s === "created" ? (we(v, {
821
821
  detail: "Record is required for created",
822
822
  key: "ELEMENT_NOT_FOUND"
823
- }), r.stagedOperations.push({ status: s, oldRecord: void 0, newRecord: v })) : s === "updated" ? (Oe(g && D, {
823
+ }), r.stagedOperations.push({ status: s, oldRecord: void 0, newRecord: v })) : s === "updated" ? (we(g && D, {
824
824
  detail: "Old record and new record are required for updated",
825
825
  key: "ELEMENT_NOT_FOUND"
826
- }), r.stagedOperations.push({ status: s, oldRecord: g, newRecord: D })) : s === "deleted" && v && (Oe(v, {
826
+ }), r.stagedOperations.push({ status: s, oldRecord: g, newRecord: D })) : s === "deleted" && v && (we(v, {
827
827
  detail: "Record is required for deleted",
828
828
  key: "ELEMENT_NOT_FOUND"
829
829
  }), r.stagedOperations.push({ status: s, oldRecord: v, newRecord: void 0 }));
@@ -849,13 +849,13 @@ function Tr(m) {
849
849
  }
850
850
  }
851
851
  async function kn(m) {
852
- const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, { id: g, tagName: D, attributes: I, namespace: q, value: M } = v, X = await me({ context: o, ref: f });
853
- Oe(X, {
852
+ const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, { id: g, tagName: D, attributes: I, namespace: q, value: j } = v, X = await me({ context: o, ref: f });
853
+ we(X, {
854
854
  detail: "Parent record not found",
855
855
  key: "ELEMENT_NOT_FOUND",
856
856
  ref: f
857
857
  });
858
- const ie = vo({
858
+ const oe = yo({
859
859
  dialecteConfig: r,
860
860
  hooks: s,
861
861
  record: {
@@ -863,7 +863,7 @@ async function kn(m) {
863
863
  tagName: D,
864
864
  attributes: I,
865
865
  namespace: q,
866
- value: M,
866
+ value: j,
867
867
  parent: { id: X.id, tagName: X.tagName },
868
868
  children: []
869
869
  }
@@ -871,26 +871,26 @@ async function kn(m) {
871
871
  et({
872
872
  context: o,
873
873
  status: "created",
874
- record: ie
874
+ record: oe
875
875
  });
876
- const j = {
876
+ const M = {
877
877
  ...X,
878
- children: [...X.children, { id: ie.id, tagName: ie.tagName }]
878
+ children: [...X.children, { id: oe.id, tagName: oe.tagName }]
879
879
  };
880
880
  if (et({
881
881
  context: o,
882
882
  status: "updated",
883
883
  oldRecord: X,
884
- newRecord: j
884
+ newRecord: M
885
885
  }), s?.afterCreated) {
886
886
  const B = await s.afterCreated({
887
- childRecord: ie,
888
- parentRecord: j,
887
+ childRecord: oe,
888
+ parentRecord: M,
889
889
  query: d
890
890
  });
891
891
  Tr({ context: o, operations: B });
892
892
  }
893
- return ie;
893
+ return oe;
894
894
  }
895
895
  async function ki(m) {
896
896
  const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, record: v, cumulativeCloneMappings: g } = m, D = [], I = await Ri({
@@ -934,9 +934,9 @@ async function Ri(m) {
934
934
  attributes: I.attributes,
935
935
  value: I.value
936
936
  }
937
- }), M = ce(v);
937
+ }), j = ce(v);
938
938
  g.push({
939
- source: Object.assign(M, {
939
+ source: Object.assign(j, {
940
940
  attributes: [...v.attributes]
941
941
  }),
942
942
  target: ce(q)
@@ -955,11 +955,11 @@ async function Ri(m) {
955
955
  }
956
956
  async function Ii(m) {
957
957
  const { hooks: r, context: s, query: o, ref: d } = m, f = await me({ context: s, ref: d });
958
- if (Oe(f, {
958
+ if (we(f, {
959
959
  detail: `Record not found (tagName=${d.tagName}, id=${d.id})`,
960
960
  key: "ELEMENT_NOT_FOUND",
961
961
  ref: d
962
- }), Oe(f.parent, {
962
+ }), we(f.parent, {
963
963
  detail: "Cannot delete root element",
964
964
  key: "PROTECTED_ROOT"
965
965
  }), r?.beforeDelete) {
@@ -968,7 +968,7 @@ async function Ii(m) {
968
968
  }
969
969
  await Pi({ context: s, record: f }), et({ context: s, status: "deleted", record: f });
970
970
  const v = ce(f.parent), g = await me({ context: s, ref: v });
971
- Oe(g, {
971
+ we(g, {
972
972
  detail: `Parent record not found (tagName=${f.parent.tagName}, id=${f.parent.id})`,
973
973
  key: "ELEMENT_NOT_FOUND"
974
974
  });
@@ -986,7 +986,7 @@ async function Pi(m) {
986
986
  }
987
987
  }
988
988
  async function Fi(m) {
989
- const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, g = Lo(v.attributes);
989
+ const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, g = Ko(v.attributes);
990
990
  if (g) {
991
991
  const [D] = await Er({
992
992
  context: o,
@@ -1007,46 +1007,46 @@ async function Fi(m) {
1007
1007
  params: v
1008
1008
  });
1009
1009
  }
1010
- function Lo(m) {
1010
+ function Ko(m) {
1011
1011
  const r = Array.isArray(m) ? Object.fromEntries(m.map((o) => [o.name, o.value])) : m;
1012
1012
  return Object.values(r).some((o) => o !== void 0 && o !== "") ? r : void 0;
1013
1013
  }
1014
1014
  async function Bi(m) {
1015
1015
  const { dialecteConfig: r, hooks: s, context: o, query: d, ref: f, params: v } = m, { attributes: g, value: D } = v, I = await me({ context: o, ref: f });
1016
- Oe(I, {
1016
+ we(I, {
1017
1017
  detail: `Record not found (tagName=${f.tagName}, id=${f.id})`,
1018
1018
  key: "ELEMENT_NOT_FOUND",
1019
1019
  ref: f
1020
1020
  });
1021
1021
  let q = I.attributes;
1022
1022
  if (g) {
1023
- const X = bo({
1023
+ const X = vo({
1024
1024
  dialecteConfig: r,
1025
1025
  tagName: I.tagName,
1026
1026
  attributes: g
1027
1027
  });
1028
1028
  q = [...I.attributes.filter(
1029
- (j) => !X.some((B) => B.name === j.name)
1029
+ (M) => !X.some((B) => B.name === M.name)
1030
1030
  ), ...X].filter(
1031
- (j) => j.value !== void 0 && j.value !== null
1031
+ (M) => M.value !== void 0 && M.value !== null
1032
1032
  );
1033
1033
  }
1034
- const M = {
1034
+ const j = {
1035
1035
  ...I,
1036
1036
  attributes: q,
1037
1037
  value: D !== void 0 ? D : I.value
1038
1038
  };
1039
- if (et({ context: o, status: "updated", oldRecord: I, newRecord: M }), s?.afterUpdated) {
1039
+ if (et({ context: o, status: "updated", oldRecord: I, newRecord: j }), s?.afterUpdated) {
1040
1040
  const X = await s.afterUpdated({
1041
1041
  oldRecord: I,
1042
- newRecord: M,
1042
+ newRecord: j,
1043
1043
  query: d
1044
1044
  });
1045
1045
  Tr({ context: o, operations: X });
1046
1046
  }
1047
- return M;
1047
+ return j;
1048
1048
  }
1049
- class Uo extends Di {
1049
+ class qo extends Di {
1050
1050
  constructor(r, s, o, d) {
1051
1051
  super(r, s), this.hooks = o, this.query = d;
1052
1052
  }
@@ -1115,7 +1115,7 @@ class Uo extends Di {
1115
1115
  });
1116
1116
  }
1117
1117
  }
1118
- function Vo(m) {
1118
+ function Lo(m) {
1119
1119
  const r = /* @__PURE__ */ new Map();
1120
1120
  for (const o of m) {
1121
1121
  const d = (o.status === "deleted" ? o.oldRecord : o.newRecord).id, f = r.get(d);
@@ -1144,8 +1144,8 @@ function Vo(m) {
1144
1144
  deletes: s.filter((o) => o.status === "deleted")
1145
1145
  };
1146
1146
  }
1147
- async function $o(m) {
1148
- const { stagedOperations: r, store: s, documentId: o, documentState: d } = m, { creates: f, updates: v, deletes: g } = Vo(r), D = f.length + v.length + g.length;
1147
+ async function Uo(m) {
1148
+ const { stagedOperations: r, store: s, documentId: o, documentState: d } = m, { creates: f, updates: v, deletes: g } = Lo(r), D = f.length + v.length + g.length;
1149
1149
  d.loading = !0, d.progress = { message: "Committing changes...", current: 0, total: D };
1150
1150
  try {
1151
1151
  await s.commit({
@@ -1162,13 +1162,13 @@ async function $o(m) {
1162
1162
  }
1163
1163
  d.lastUpdate = Date.now();
1164
1164
  }
1165
- class Go extends Si {
1165
+ class Vo extends Si {
1166
1166
  constructor(r, s, o, d, f) {
1167
1167
  super(r, s, o), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.cumulativeCloneMappings = [], this.documentActivity = d, this.hooks = f;
1168
1168
  }
1169
1169
  //== Untyped namespace
1170
1170
  get any() {
1171
- return this._anyTx ??= new Uo(
1171
+ return this._anyTx ??= new qo(
1172
1172
  () => this.context,
1173
1173
  this.dialecteConfig,
1174
1174
  this.hooks,
@@ -1345,7 +1345,7 @@ class Go extends Si {
1345
1345
  * Merges operations by ID to optimize database writes.
1346
1346
  */
1347
1347
  async commit() {
1348
- await $o({
1348
+ await Uo({
1349
1349
  stagedOperations: this.stagedOperations,
1350
1350
  store: this.store,
1351
1351
  documentId: this.documentId,
@@ -1356,7 +1356,7 @@ class Go extends Si {
1356
1356
  function zt(m) {
1357
1357
  return m.recordCache !== void 0;
1358
1358
  }
1359
- class Yo {
1359
+ class $o {
1360
1360
  constructor(r, s, o, d, f, v) {
1361
1361
  this.state = {
1362
1362
  loading: !1,
@@ -1392,7 +1392,7 @@ class Yo {
1392
1392
  * e.g. SclDocument overrides this to return new SclTransaction(...)
1393
1393
  */
1394
1394
  createTransaction() {
1395
- return new Go(this.store, this.config, this.documentId, this.state, this.hooks);
1395
+ return new Vo(this.store, this.config, this.documentId, this.state, this.hooks);
1396
1396
  }
1397
1397
  async transaction(r, s) {
1398
1398
  this.activeTransactions > 0 && $e("CONCURRENT_TRANSACTION", {
@@ -1498,9 +1498,9 @@ class Yo {
1498
1498
  await this.store.destroy();
1499
1499
  }
1500
1500
  }
1501
- const ft = "_documents", Xe = "_changeLog", He = "_meta", Wo = "xel_";
1502
- function Xo(m) {
1503
- return `${Wo}${m}`;
1501
+ const ft = "_documents", Xe = "_changeLog", He = "_meta", Go = "xel_";
1502
+ function Yo(m) {
1503
+ return `${Go}${m}`;
1504
1504
  }
1505
1505
  const oi = {
1506
1506
  primaryKey: "id",
@@ -1519,11 +1519,11 @@ const oi = {
1519
1519
  compoundIndexes: [],
1520
1520
  arrayIndexes: []
1521
1521
  };
1522
- var Ho = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1523
- function Mi(m) {
1522
+ var Wo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1523
+ function ji(m) {
1524
1524
  return m && m.__esModule && Object.prototype.hasOwnProperty.call(m, "default") ? m.default : m;
1525
1525
  }
1526
- function zo(m) {
1526
+ function Xo(m) {
1527
1527
  if (Object.prototype.hasOwnProperty.call(m, "__esModule")) return m;
1528
1528
  var r = m.default;
1529
1529
  if (typeof r == "function") {
@@ -1547,12 +1547,12 @@ function zo(m) {
1547
1547
  });
1548
1548
  }), s;
1549
1549
  }
1550
- var Dn = { exports: {} }, Qo = Dn.exports, ci;
1551
- function Zo() {
1550
+ var Dn = { exports: {} }, Ho = Dn.exports, ci;
1551
+ function zo() {
1552
1552
  return ci || (ci = 1, (function(m, r) {
1553
1553
  (function(s, o) {
1554
1554
  m.exports = o();
1555
- })(Qo, function() {
1555
+ })(Ho, function() {
1556
1556
  var s = function(e, t) {
1557
1557
  return (s = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
1558
1558
  n.__proto__ = i;
@@ -1569,7 +1569,7 @@ function Zo() {
1569
1569
  for (var i, a = 0, u = t.length; a < u; a++) !i && a in t || ((i = i || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
1570
1570
  return e.concat(i || Array.prototype.slice.call(t));
1571
1571
  }
1572
- var f = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ho, v = Object.keys, g = Array.isArray;
1572
+ var f = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Wo, v = Object.keys, g = Array.isArray;
1573
1573
  function D(e, t) {
1574
1574
  return typeof t != "object" || v(t).forEach(function(n) {
1575
1575
  e[n] = t[n];
@@ -1577,26 +1577,26 @@ function Zo() {
1577
1577
  }
1578
1578
  typeof Promise > "u" || f.Promise || (f.Promise = Promise);
1579
1579
  var I = Object.getPrototypeOf, q = {}.hasOwnProperty;
1580
- function M(e, t) {
1580
+ function j(e, t) {
1581
1581
  return q.call(e, t);
1582
1582
  }
1583
1583
  function X(e, t) {
1584
1584
  typeof t == "function" && (t = t(I(e))), (typeof Reflect > "u" ? v : Reflect.ownKeys)(t).forEach(function(n) {
1585
- j(e, n, t[n]);
1585
+ M(e, n, t[n]);
1586
1586
  });
1587
1587
  }
1588
- var ie = Object.defineProperty;
1589
- function j(e, t, n, i) {
1590
- ie(e, t, D(n && M(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, i));
1588
+ var oe = Object.defineProperty;
1589
+ function M(e, t, n, i) {
1590
+ oe(e, t, D(n && j(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, i));
1591
1591
  }
1592
1592
  function B(e) {
1593
1593
  return { from: function(t) {
1594
- return e.prototype = Object.create(t.prototype), j(e.prototype, "constructor", e), { extend: X.bind(null, e.prototype) };
1594
+ return e.prototype = Object.create(t.prototype), M(e.prototype, "constructor", e), { extend: X.bind(null, e.prototype) };
1595
1595
  } };
1596
1596
  }
1597
- var H = Object.getOwnPropertyDescriptor, oe = [].slice;
1597
+ var H = Object.getOwnPropertyDescriptor, ie = [].slice;
1598
1598
  function ye(e, t, n) {
1599
- return oe.call(e, t, n);
1599
+ return ie.call(e, t, n);
1600
1600
  }
1601
1601
  function ne(e, t) {
1602
1602
  return t(e);
@@ -1608,7 +1608,7 @@ function Zo() {
1608
1608
  f.setImmediate ? setImmediate(e) : setTimeout(e, 0);
1609
1609
  }
1610
1610
  function he(e, t) {
1611
- if (typeof t == "string" && M(e, t)) return e[t];
1611
+ if (typeof t == "string" && j(e, t)) return e[t];
1612
1612
  if (!t) return e;
1613
1613
  if (typeof t != "string") {
1614
1614
  for (var n = [], i = 0, a = t.length; i < a; ++i) {
@@ -1629,12 +1629,12 @@ function Zo() {
1629
1629
  for (var i = 0, a = t.length; i < a; ++i) de(e, t[i], n[i]);
1630
1630
  } else {
1631
1631
  var u, h, p = t.indexOf(".");
1632
- p !== -1 ? (u = t.substr(0, p), (h = t.substr(p + 1)) === "" ? n === void 0 ? g(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : de(p = !(p = e[u]) || !M(e, u) ? e[u] = {} : p, h, n)) : n === void 0 ? g(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
1632
+ p !== -1 ? (u = t.substr(0, p), (h = t.substr(p + 1)) === "" ? n === void 0 ? g(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : de(p = !(p = e[u]) || !j(e, u) ? e[u] = {} : p, h, n)) : n === void 0 ? g(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
1633
1633
  }
1634
1634
  }
1635
1635
  function ve(e) {
1636
1636
  var t, n = {};
1637
- for (t in e) M(e, t) && (n[t] = e[t]);
1637
+ for (t in e) j(e, t) && (n[t] = e[t]);
1638
1638
  return n;
1639
1639
  }
1640
1640
  var In = [].concat;
@@ -1661,18 +1661,18 @@ function Zo() {
1661
1661
  } else if (Bt.has(n.constructor)) i = n;
1662
1662
  else {
1663
1663
  var h, p = I(n);
1664
- for (h in i = p === Object.prototype ? {} : Object.create(p), Ue.set(n, i), n) M(n, h) && (i[h] = t(n[h]));
1664
+ for (h in i = p === Object.prototype ? {} : Object.create(p), Ue.set(n, i), n) j(n, h) && (i[h] = t(n[h]));
1665
1665
  }
1666
1666
  return i;
1667
1667
  })(e), Ue = null, e;
1668
1668
  }
1669
1669
  var Jt = {}.toString;
1670
- function Mt(e) {
1670
+ function jt(e) {
1671
1671
  return Jt.call(e).slice(8, -1);
1672
1672
  }
1673
- var jt = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", we = typeof jt == "symbol" ? function(e) {
1673
+ var Mt = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", _e = typeof Mt == "symbol" ? function(e) {
1674
1674
  var t;
1675
- return e != null && (t = e[jt]) && t.apply(e);
1675
+ return e != null && (t = e[Mt]) && t.apply(e);
1676
1676
  } : function() {
1677
1677
  return null;
1678
1678
  };
@@ -1685,7 +1685,7 @@ function Zo() {
1685
1685
  if (arguments.length === 1) {
1686
1686
  if (g(e)) return e.slice();
1687
1687
  if (this === Qe && typeof e == "string") return [e];
1688
- if (a = we(e)) {
1688
+ if (a = _e(e)) {
1689
1689
  for (n = []; !(i = a.next()).done; ) n.push(i.value);
1690
1690
  return n;
1691
1691
  }
@@ -1716,14 +1716,14 @@ function Zo() {
1716
1716
  function nt(e, t, n, i) {
1717
1717
  this.failures = t, this.failedKeys = i, this.successCount = n, this.message = Nt(e, t);
1718
1718
  }
1719
- function je(e, t) {
1719
+ function Me(e, t) {
1720
1720
  this.name = "BulkError", this.failures = Object.keys(t).map(function(n) {
1721
1721
  return t[n];
1722
1722
  }), this.failuresByPos = t, this.message = Nt(e, this.failures);
1723
1723
  }
1724
1724
  B(tt).from(Error).extend({ toString: function() {
1725
1725
  return this.name + ": " + this.message;
1726
- } }), B(nt).from(tt), B(je).from(tt);
1726
+ } }), B(nt).from(tt), B(Me).from(tt);
1727
1727
  var ht = Le.reduce(function(e, t) {
1728
1728
  return e[t] = t + "Error", e;
1729
1729
  }, {}), Pn = tt, Q = Le.reduce(function(e, t) {
@@ -1772,7 +1772,7 @@ function Zo() {
1772
1772
  this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? E(n, this.onsuccess) : n), i && (this.onerror = this.onerror ? E(i, this.onerror) : i);
1773
1773
  };
1774
1774
  }
1775
- function Ee(e, t) {
1775
+ function xe(e, t) {
1776
1776
  return e === l ? t : function(n) {
1777
1777
  var i = e.apply(this, arguments);
1778
1778
  D(n, i);
@@ -1797,10 +1797,10 @@ function Zo() {
1797
1797
  return t.apply(this, arguments);
1798
1798
  };
1799
1799
  }
1800
- Ot.ModifyError = nt, Ot.DexieError = tt, Ot.BulkError = je;
1801
- var Ne = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
1802
- function Ce(e) {
1803
- Ne = e;
1800
+ Ot.ModifyError = nt, Ot.DexieError = tt, Ot.BulkError = Me;
1801
+ var Ce = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
1802
+ function Oe(e) {
1803
+ Ce = e;
1804
1804
  }
1805
1805
  var Be = {}, en = 100, Ve = typeof Promise > "u" ? [] : (function() {
1806
1806
  var e = Promise.resolve();
@@ -1808,8 +1808,8 @@ function Zo() {
1808
1808
  var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
1809
1809
  return [t, I(t), e];
1810
1810
  })(), rt = Ve[0], Le = Ve[1], Ve = Ve[2], Le = Le && Le.then, Ge = rt && rt.constructor, Fn = !!Ve, Kt = function(e, t) {
1811
- qt.push([e, t]), tn && (queueMicrotask(Wi), tn = !1);
1812
- }, Bn = !0, tn = !0, mt = [], nn = [], Mn = c, it = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: l, pgp: !1, env: {}, finalize: l }, z = it, qt = [], pt = 0, rn = [];
1811
+ qt.push([e, t]), tn && (queueMicrotask(Yi), tn = !1);
1812
+ }, Bn = !0, tn = !0, mt = [], nn = [], jn = c, it = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: l, pgp: !1, env: {}, finalize: l }, z = it, qt = [], pt = 0, rn = [];
1813
1813
  function Y(e) {
1814
1814
  if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
1815
1815
  this._listeners = [], this._lib = !1;
@@ -1834,7 +1834,7 @@ function Zo() {
1834
1834
  }
1835
1835
  })(this, e);
1836
1836
  }
1837
- var jn = { get: function() {
1837
+ var Mn = { get: function() {
1838
1838
  var e = z, t = cn;
1839
1839
  function n(i, a) {
1840
1840
  var u = this, h = !e.global && (e !== z || t !== cn), p = h && !at(), b = new Y(function(_, T) {
@@ -1844,16 +1844,16 @@ function Zo() {
1844
1844
  }
1845
1845
  return n.prototype = Be, n;
1846
1846
  }, set: function(e) {
1847
- j(this, "then", e && e.prototype === Be ? jn : { get: function() {
1847
+ M(this, "then", e && e.prototype === Be ? Mn : { get: function() {
1848
1848
  return e;
1849
- }, set: jn.set });
1849
+ }, set: Mn.set });
1850
1850
  } };
1851
1851
  function Nr(e, t, n, i, a) {
1852
1852
  this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = i, this.psd = a;
1853
1853
  }
1854
1854
  function Kn(e, t) {
1855
1855
  var n, i;
1856
- nn.push(t), e._state === null && (n = e._lib && At(), t = Mn(t), e._state = !1, e._value = t, i = e, mt.some(function(a) {
1856
+ nn.push(t), e._state === null && (n = e._lib && At(), t = jn(t), e._state = !1, e._value = t, i = e, mt.some(function(a) {
1857
1857
  return a._value === i._value;
1858
1858
  }) || mt.push(i), Cr(e), n && Dt());
1859
1859
  }
@@ -1870,13 +1870,13 @@ function Zo() {
1870
1870
  if (e._state !== null) {
1871
1871
  var n = e._state ? t.onFulfilled : t.onRejected;
1872
1872
  if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
1873
- ++t.psd.ref, ++pt, Kt(Yi, [n, e, t]);
1873
+ ++t.psd.ref, ++pt, Kt(Gi, [n, e, t]);
1874
1874
  } else e._listeners.push(t);
1875
1875
  }
1876
- function Yi(e, t, n) {
1876
+ function Gi(e, t, n) {
1877
1877
  try {
1878
1878
  var i, a = t._value;
1879
- !t._state && nn.length && (nn = []), i = Ne && t._consoleTask ? t._consoleTask.run(function() {
1879
+ !t._state && nn.length && (nn = []), i = Ce && t._consoleTask ? t._consoleTask.run(function() {
1880
1880
  return e(a);
1881
1881
  }) : e(a), t._state || nn.indexOf(a) !== -1 || (function(u) {
1882
1882
  for (var h = mt.length; h; ) if (mt[--h]._value === u._value) return mt.splice(h, 1);
@@ -1887,7 +1887,7 @@ function Zo() {
1887
1887
  --pt == 0 && Ln(), --n.psd.ref || n.psd.finalize();
1888
1888
  }
1889
1889
  }
1890
- function Wi() {
1890
+ function Yi() {
1891
1891
  gt(it, function() {
1892
1892
  At() && Dt();
1893
1893
  });
@@ -1929,7 +1929,7 @@ function Zo() {
1929
1929
  }
1930
1930
  };
1931
1931
  }
1932
- X(Y.prototype, { then: jn, _then: function(e, t) {
1932
+ X(Y.prototype, { then: Mn, _then: function(e, t) {
1933
1933
  qn(this, new Nr(null, null, e, t, z));
1934
1934
  }, catch: function(e) {
1935
1935
  if (arguments.length === 1) return this.then(null, e);
@@ -1957,7 +1957,7 @@ function Zo() {
1957
1957
  }, e);
1958
1958
  n.then(i, a).finally(clearTimeout.bind(null, u));
1959
1959
  }) : this;
1960
- } }), typeof Symbol < "u" && Symbol.toStringTag && j(Y.prototype, Symbol.toStringTag, "Dexie.Promise"), it.env = Or(), X(Y, { all: function() {
1960
+ } }), typeof Symbol < "u" && Symbol.toStringTag && M(Y.prototype, Symbol.toStringTag, "Dexie.Promise"), it.env = Or(), X(Y, { all: function() {
1961
1961
  var e = ke.apply(null, arguments).map(un);
1962
1962
  return new Y(function(t, n) {
1963
1963
  e.length === 0 && t([]);
@@ -1990,9 +1990,9 @@ function Zo() {
1990
1990
  }, set: function(e) {
1991
1991
  Kt = e;
1992
1992
  } }, rejectionMapper: { get: function() {
1993
- return Mn;
1993
+ return jn;
1994
1994
  }, set: function(e) {
1995
- Mn = e;
1995
+ jn = e;
1996
1996
  } }, follow: function(e, t) {
1997
1997
  return new Y(function(n, i) {
1998
1998
  return ot(function(a, u) {
@@ -2009,7 +2009,7 @@ function Zo() {
2009
2009
  }, h.finalize), e();
2010
2010
  }, t, n, i);
2011
2011
  });
2012
- } }), Ge && (Ge.allSettled && j(Y, "allSettled", function() {
2012
+ } }), Ge && (Ge.allSettled && M(Y, "allSettled", function() {
2013
2013
  var e = ke.apply(null, arguments).map(un);
2014
2014
  return new Y(function(t) {
2015
2015
  e.length === 0 && t([]);
@@ -2024,7 +2024,7 @@ function Zo() {
2024
2024
  });
2025
2025
  });
2026
2026
  });
2027
- }), Ge.any && typeof AggregateError < "u" && j(Y, "any", function() {
2027
+ }), Ge.any && typeof AggregateError < "u" && M(Y, "any", function() {
2028
2028
  var e = ke.apply(null, arguments).map(un);
2029
2029
  return new Y(function(t, n) {
2030
2030
  e.length === 0 && n(new AggregateError([]));
@@ -2038,15 +2038,15 @@ function Zo() {
2038
2038
  });
2039
2039
  });
2040
2040
  }), Ge.withResolvers && (Y.withResolvers = Ge.withResolvers));
2041
- var De = { awaits: 0, echoes: 0, id: 0 }, Xi = 0, an = [], sn = 0, cn = 0, Hi = 0;
2041
+ var De = { awaits: 0, echoes: 0, id: 0 }, Wi = 0, an = [], sn = 0, cn = 0, Xi = 0;
2042
2042
  function ot(e, t, n, i) {
2043
2043
  var a = z, u = Object.create(a);
2044
- return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Hi, it.env, u.env = Fn ? { Promise: Y, PromiseProp: { value: Y, configurable: !0, writable: !0 }, all: Y.all, race: Y.race, allSettled: Y.allSettled, any: Y.any, resolve: Y.resolve, reject: Y.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
2044
+ return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Xi, it.env, u.env = Fn ? { Promise: Y, PromiseProp: { value: Y, configurable: !0, writable: !0 }, all: Y.all, race: Y.race, allSettled: Y.allSettled, any: Y.any, resolve: Y.resolve, reject: Y.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
2045
2045
  --this.parent.ref || this.parent.finalize();
2046
2046
  }, i = gt(u, e, n, i), u.ref === 0 && u.finalize(), i;
2047
2047
  }
2048
2048
  function St() {
2049
- return De.id || (De.id = ++Xi), ++De.awaits, De.echoes += en, De.id;
2049
+ return De.id || (De.id = ++Wi), ++De.awaits, De.echoes += en, De.id;
2050
2050
  }
2051
2051
  function at() {
2052
2052
  return !!De.awaits && (--De.awaits == 0 && (De.id = 0), De.echoes = De.awaits * en, !0);
@@ -2055,10 +2055,10 @@ function Zo() {
2055
2055
  return De.echoes && e && e.constructor === Ge ? (St(), e.then(function(t) {
2056
2056
  return at(), t;
2057
2057
  }, function(t) {
2058
- return at(), xe(t);
2058
+ return at(), Te(t);
2059
2059
  })) : e;
2060
2060
  }
2061
- function zi() {
2061
+ function Hi() {
2062
2062
  var e = an[an.length - 1];
2063
2063
  an.pop(), st(e, !1);
2064
2064
  }
@@ -2066,7 +2066,7 @@ function Zo() {
2066
2066
  var n, i = z;
2067
2067
  (t ? !De.echoes || sn++ && e === z : !sn || --sn && e === z) || queueMicrotask(t ? (function(a) {
2068
2068
  ++cn, De.echoes && --De.echoes != 0 || (De.echoes = De.awaits = De.id = 0), an.push(z), st(a, !0);
2069
- }).bind(null, e) : zi), e !== z && (z = e, i === it && (it.env = Or()), Fn && (n = it.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(f, "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))));
2069
+ }).bind(null, e) : Hi), e !== z && (z = e, i === it && (it.env = Or()), Fn && (n = it.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(f, "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))));
2070
2070
  }
2071
2071
  function Or() {
2072
2072
  var e = f.Promise;
@@ -2095,7 +2095,7 @@ function Zo() {
2095
2095
  Promise === Ge && De.echoes === 0 ? sn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
2096
2096
  }
2097
2097
  ("" + Le).indexOf("[native code]") === -1 && (St = at = l);
2098
- var xe = Y.reject, yt = "￿", Ze = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Dr = "String expected.", kt = [], ln = "__dbnames", Vn = "readonly", $n = "readwrite";
2098
+ var Te = Y.reject, yt = "￿", Ze = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Dr = "String expected.", kt = [], ln = "__dbnames", Vn = "readonly", $n = "readwrite";
2099
2099
  function vt(e, t) {
2100
2100
  return e ? t ? function() {
2101
2101
  return e.apply(this, arguments) && t.apply(this, arguments);
@@ -2141,7 +2141,7 @@ function Zo() {
2141
2141
  }
2142
2142
  function Rr(e) {
2143
2143
  var t = typeof e;
2144
- return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e = Mt(e), e === "ArrayBuffer" ? "binary" : e);
2144
+ return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e = jt(e), e === "ArrayBuffer" ? "binary" : e);
2145
2145
  }
2146
2146
  function Ir(e) {
2147
2147
  return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
@@ -2157,7 +2157,7 @@ function Zo() {
2157
2157
  })) : n;
2158
2158
  }
2159
2159
  var Pr = (pe.prototype._trans = function(e, t, n) {
2160
- var i = this._tx || z.trans, a = this.name, u = Ne && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
2160
+ var i = this._tx || z.trans, a = this.name, u = Ce && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
2161
2161
  function h(_, T, y) {
2162
2162
  if (!y.schema[a]) throw new Q.NotFound("Table " + a + " not part of transaction");
2163
2163
  return t(y.idbtrans, y);
@@ -2174,7 +2174,7 @@ function Zo() {
2174
2174
  } catch (C) {
2175
2175
  return C.name === ht.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
2176
2176
  return _(T, y, O, w);
2177
- })) : xe(C);
2177
+ })) : Te(C);
2178
2178
  }
2179
2179
  return x._promise(y, function(C, N) {
2180
2180
  return ot(function() {
@@ -2190,9 +2190,9 @@ function Zo() {
2190
2190
  });
2191
2191
  });
2192
2192
  }
2193
- if (T._state.openComplete) return xe(new Q.DatabaseClosed(T._state.dbOpenError));
2193
+ if (T._state.openComplete) return Te(new Q.DatabaseClosed(T._state.dbOpenError));
2194
2194
  if (!T._state.isBeingOpened) {
2195
- if (!T._state.autoOpen) return xe(new Q.DatabaseClosed());
2195
+ if (!T._state.autoOpen) return Te(new Q.DatabaseClosed());
2196
2196
  T.open().catch(l);
2197
2197
  }
2198
2198
  return T._state.dbReadyPromise.then(function() {
@@ -2200,14 +2200,14 @@ function Zo() {
2200
2200
  });
2201
2201
  })(this.db, e, [this.name], h);
2202
2202
  return u && (b._consoleTask = u, b = b.catch(function(_) {
2203
- return console.trace(_), xe(_);
2203
+ return console.trace(_), Te(_);
2204
2204
  })), b;
2205
2205
  } finally {
2206
2206
  p && Dt();
2207
2207
  }
2208
2208
  }, pe.prototype.get = function(e, t) {
2209
2209
  var n = this;
2210
- return e && e.constructor === Object ? this.where(e).first(t) : e == null ? xe(new Q.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(i) {
2210
+ return e && e.constructor === Object ? this.where(e).first(t) : e == null ? Te(new Q.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(i) {
2211
2211
  return n.core.get({ trans: i, key: e }).then(function(a) {
2212
2212
  return n.hook.reading.fire(a);
2213
2213
  });
@@ -2234,7 +2234,7 @@ function Zo() {
2234
2234
  return e[b];
2235
2235
  }));
2236
2236
  }
2237
- !n && Ne && console.warn("The query ".concat(JSON.stringify(e), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(t.join("+"), "]"));
2237
+ !n && Ce && console.warn("The query ".concat(JSON.stringify(e), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(t.join("+"), "]"));
2238
2238
  var i = this.schema.idxByName;
2239
2239
  function a(p, b) {
2240
2240
  return ae(p, b) === 0;
@@ -2315,7 +2315,7 @@ function Zo() {
2315
2315
  return p;
2316
2316
  });
2317
2317
  }, pe.prototype.update = function(e, t) {
2318
- return typeof e != "object" || g(e) ? this.where(":id").equals(e).modify(t) : (e = he(e, this.schema.primKey.keyPath), e === void 0 ? xe(new Q.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
2318
+ return typeof e != "object" || g(e) ? this.where(":id").equals(e).modify(t) : (e = he(e, this.schema.primKey.keyPath), e === void 0 ? Te(new Q.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
2319
2319
  }, pe.prototype.put = function(e, t) {
2320
2320
  var n = this, i = this.schema.primKey, a = i.auto, u = i.keyPath, h = e;
2321
2321
  return u && a && (h = fn(u)(e)), this._trans("readwrite", function(p) {
@@ -2366,7 +2366,7 @@ function Zo() {
2366
2366
  return i.core.mutate({ trans: h, type: "add", keys: a, values: _, wantResults: u }).then(function(x) {
2367
2367
  var y = x.numFailures, O = x.results, w = x.lastResult, x = x.failures;
2368
2368
  if (y === 0) return u ? O : w;
2369
- throw new je("".concat(i.name, ".bulkAdd(): ").concat(y, " of ").concat(b, " operations failed"), x);
2369
+ throw new Me("".concat(i.name, ".bulkAdd(): ").concat(y, " of ").concat(b, " operations failed"), x);
2370
2370
  });
2371
2371
  });
2372
2372
  }, pe.prototype.bulkPut = function(e, t, n) {
@@ -2379,7 +2379,7 @@ function Zo() {
2379
2379
  return i.core.mutate({ trans: h, type: "put", keys: a, values: _, wantResults: u }).then(function(x) {
2380
2380
  var y = x.numFailures, O = x.results, w = x.lastResult, x = x.failures;
2381
2381
  if (y === 0) return u ? O : w;
2382
- throw new je("".concat(i.name, ".bulkPut(): ").concat(y, " of ").concat(b, " operations failed"), x);
2382
+ throw new Me("".concat(i.name, ".bulkPut(): ").concat(y, " of ").concat(b, " operations failed"), x);
2383
2383
  });
2384
2384
  });
2385
2385
  }, pe.prototype.bulkUpdate = function(e) {
@@ -2411,7 +2411,7 @@ function Zo() {
2411
2411
  var N, A = C[x], k = u[Number(A)];
2412
2412
  k != null && (N = w[A], delete w[A], w[k] = N);
2413
2413
  }
2414
- throw new je("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(T, " operations failed"), w);
2414
+ throw new Me("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(T, " operations failed"), w);
2415
2415
  });
2416
2416
  });
2417
2417
  });
@@ -2424,7 +2424,7 @@ function Zo() {
2424
2424
  }).then(function(h) {
2425
2425
  var a = h.numFailures, u = h.lastResult, h = h.failures;
2426
2426
  if (a === 0) return u;
2427
- throw new je("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), h);
2427
+ throw new Me("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), h);
2428
2428
  });
2429
2429
  }, pe);
2430
2430
  function pe() {
@@ -2505,7 +2505,7 @@ function Zo() {
2505
2505
  return b.stop(O);
2506
2506
  }, function(O) {
2507
2507
  return b.fail(O);
2508
- }) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)), M(u, y) || (u[y] = !0, t(p, b, _)));
2508
+ }) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)), j(u, y) || (u[y] = !0, t(p, b, _)));
2509
2509
  };
2510
2510
  return Promise.all([e.or._iterate(h, n), Br(Fr(e, i, n), e.algorithm, h, !e.keysOnly && e.valueMapper)]);
2511
2511
  }
@@ -2532,7 +2532,7 @@ function Zo() {
2532
2532
  });
2533
2533
  });
2534
2534
  }
2535
- var Vt = (Mr.prototype.execute = function(e) {
2535
+ var Vt = (jr.prototype.execute = function(e) {
2536
2536
  var t = this["@@propmod"];
2537
2537
  if (t.add !== void 0) {
2538
2538
  var n = t.add;
@@ -2559,16 +2559,16 @@ function Zo() {
2559
2559
  throw new TypeError("Invalid subtrahend ".concat(i));
2560
2560
  }
2561
2561
  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;
2562
- }, Mr);
2563
- function Mr(e) {
2562
+ }, jr);
2563
+ function jr(e) {
2564
2564
  this["@@propmod"] = e;
2565
2565
  }
2566
- var Qi = (ue.prototype._read = function(e, t) {
2566
+ var zi = (ue.prototype._read = function(e, t) {
2567
2567
  var n = this._ctx;
2568
- return n.error ? n.table._trans(null, xe.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
2568
+ return n.error ? n.table._trans(null, Te.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
2569
2569
  }, ue.prototype._write = function(e) {
2570
2570
  var t = this._ctx;
2571
- return t.error ? t.table._trans(null, xe.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
2571
+ return t.error ? t.table._trans(null, Te.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
2572
2572
  }, ue.prototype._addAlgorithm = function(e) {
2573
2573
  var t = this._ctx;
2574
2574
  t.algorithm = vt(t.algorithm, e);
@@ -2721,7 +2721,7 @@ function Zo() {
2721
2721
  if (!e || !e.multi) return this;
2722
2722
  var t = {};
2723
2723
  return Gn(this._ctx, function(a) {
2724
- var i = a.primaryKey.toString(), a = M(t, i);
2724
+ var i = a.primaryKey.toString(), a = j(t, i);
2725
2725
  return t[i] = !0, !a;
2726
2726
  }), this;
2727
2727
  }, ue.prototype.modify = function(e) {
@@ -2745,7 +2745,7 @@ function Zo() {
2745
2745
  w.push(P[L]);
2746
2746
  }
2747
2747
  }
2748
- var w = [], x = 0, C = [], N = e === jr;
2748
+ var w = [], x = 0, C = [], N = e === Mr;
2749
2749
  return t.clone().primaryKeys().then(function(A) {
2750
2750
  function k(F) {
2751
2751
  var K = Math.min(T, A.length - F), V = A.slice(F, F + K);
@@ -2755,18 +2755,18 @@ function Zo() {
2755
2755
  var se = L[re], te = { value: ze(se), primKey: A[F + re] };
2756
2756
  h.call(te, te.value, te) !== !1 && (te.value == null ? W.push(A[F + re]) : b || ae(_(se), _(te.value)) === 0 ? (G.push(te.value), b && $.push(A[F + re])) : (W.push(A[F + re]), U.push(te.value)));
2757
2757
  }
2758
- return Promise.resolve(0 < U.length && p.mutate({ trans: i, type: "add", values: U }).then(function(_e) {
2759
- for (var ee in _e.failures) W.splice(parseInt(ee), 1);
2760
- O(U.length, _e);
2758
+ return Promise.resolve(0 < U.length && p.mutate({ trans: i, type: "add", values: U }).then(function(Ee) {
2759
+ for (var ee in Ee.failures) W.splice(parseInt(ee), 1);
2760
+ O(U.length, Ee);
2761
2761
  })).then(function() {
2762
- return (0 < G.length || P && typeof e == "object") && p.mutate({ trans: i, type: "put", keys: $, values: G, criteria: P, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < F }).then(function(_e) {
2763
- return O(G.length, _e);
2762
+ return (0 < G.length || P && typeof e == "object") && p.mutate({ trans: i, type: "put", keys: $, values: G, criteria: P, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < F }).then(function(Ee) {
2763
+ return O(G.length, Ee);
2764
2764
  });
2765
2765
  }).then(function() {
2766
- return (0 < W.length || P && N) && p.mutate({ trans: i, type: "delete", keys: W, criteria: P, isAdditionalChunk: 0 < F }).then(function(_e) {
2767
- return dn(n.table, W, _e);
2768
- }).then(function(_e) {
2769
- return O(W.length, _e);
2766
+ return (0 < W.length || P && N) && p.mutate({ trans: i, type: "delete", keys: W, criteria: P, isAdditionalChunk: 0 < F }).then(function(Ee) {
2767
+ return dn(n.table, W, Ee);
2768
+ }).then(function(Ee) {
2769
+ return O(W.length, Ee);
2770
2770
  });
2771
2771
  }).then(function() {
2772
2772
  return A.length > F + K && k(F + T);
@@ -2782,7 +2782,7 @@ function Zo() {
2782
2782
  });
2783
2783
  }, ue.prototype.delete = function() {
2784
2784
  var e = this._ctx, t = e.range;
2785
- return !Rt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(jr) : this._write(function(n) {
2785
+ return !Rt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Mr) : this._write(function(n) {
2786
2786
  var i = e.table.core.schema.primaryKey, a = t;
2787
2787
  return e.table.core.count({ trans: n, query: { index: i, range: a } }).then(function(u) {
2788
2788
  return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(b) {
@@ -2797,13 +2797,13 @@ function Zo() {
2797
2797
  }, ue);
2798
2798
  function ue() {
2799
2799
  }
2800
- var jr = function(e, t) {
2800
+ var Mr = function(e, t) {
2801
2801
  return t.value = null;
2802
2802
  };
2803
- function Zi(e, t) {
2803
+ function Qi(e, t) {
2804
2804
  return e < t ? -1 : e === t ? 0 : 1;
2805
2805
  }
2806
- function Ji(e, t) {
2806
+ function Zi(e, t) {
2807
2807
  return t < e ? -1 : e === t ? 0 : 1;
2808
2808
  }
2809
2809
  function qe(e, t, n) {
@@ -2828,7 +2828,7 @@ function Zo() {
2828
2828
  return N.toLowerCase();
2829
2829
  } : function(N) {
2830
2830
  return N.toUpperCase();
2831
- }, h = x === "next" ? Zi : Ji;
2831
+ }, h = x === "next" ? Qi : Zi;
2832
2832
  var C = n.map(function(N) {
2833
2833
  return { lower: u(N), upper: a(N) };
2834
2834
  }).sort(function(N, A) {
@@ -2854,9 +2854,9 @@ function Zo() {
2854
2854
  for (var P = null, F = w; F < y; ++F) {
2855
2855
  var K = (function(V, L, U, G, $, W) {
2856
2856
  for (var re = Math.min(V.length, G.length), se = -1, te = 0; te < re; ++te) {
2857
- var _e = L[te];
2858
- if (_e !== G[te]) return $(V[te], U[te]) < 0 ? V.substr(0, te) + U[te] + U.substr(te + 1) : $(V[te], G[te]) < 0 ? V.substr(0, te) + G[te] + U.substr(te + 1) : 0 <= se ? V.substr(0, se) + L[se] + U.substr(se + 1) : null;
2859
- $(V[te], _e) < 0 && (se = te);
2857
+ var Ee = L[te];
2858
+ if (Ee !== G[te]) return $(V[te], U[te]) < 0 ? V.substr(0, te) + U[te] + U.substr(te + 1) : $(V[te], G[te]) < 0 ? V.substr(0, te) + G[te] + U.substr(te + 1) : 0 <= se ? V.substr(0, se) + L[se] + U.substr(se + 1) : null;
2859
+ $(V[te], Ee) < 0 && (se = te);
2860
2860
  }
2861
2861
  return re < G.length && W === "next" ? V + U.substr(V.length) : re < V.length && W === "prev" ? V.substr(0, U.length) : se < 0 ? null : V.substr(0, se) + G[se] + U.substr(se + 1);
2862
2862
  })(A, k, p[F], b[F], h, _);
@@ -3022,7 +3022,7 @@ function Zo() {
3022
3022
  function $t(e) {
3023
3023
  e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
3024
3024
  }
3025
- var Gt = "storagemutated", Wn = "x-storagemutated-1", ut = Lt(null, Gt), eo = (We.prototype._lock = function() {
3025
+ var Gt = "storagemutated", Wn = "x-storagemutated-1", ut = Lt(null, Gt), Ji = (We.prototype._lock = function() {
3026
3026
  return Z(!z.global), ++this._reculock, this._reculock !== 1 || z.global || (z.lockOwnerFor = this), this;
3027
3027
  }, We.prototype._unlock = function() {
3028
3028
  if (Z(!z.global), --this._reculock == 0) for (z.global || (z.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
@@ -3057,8 +3057,8 @@ function Zo() {
3057
3057
  }), this;
3058
3058
  }, We.prototype._promise = function(e, t, n) {
3059
3059
  var i = this;
3060
- if (e === "readwrite" && this.mode !== "readwrite") return xe(new Q.ReadOnly("Transaction is readonly"));
3061
- if (!this.active) return xe(new Q.TransactionInactive());
3060
+ if (e === "readwrite" && this.mode !== "readwrite") return Te(new Q.ReadOnly("Transaction is readonly"));
3061
+ if (!this.active) return Te(new Q.TransactionInactive());
3062
3062
  if (this._locked()) return new Y(function(u, h) {
3063
3063
  i._blockedFuncs.push([function() {
3064
3064
  i._promise(e, t, n).then(u, h);
@@ -3103,7 +3103,7 @@ function Zo() {
3103
3103
  this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new Q.Abort()));
3104
3104
  }, We.prototype.table = function(e) {
3105
3105
  var t = this._memoizedTables || (this._memoizedTables = {});
3106
- if (M(t, e)) return t[e];
3106
+ if (j(t, e)) return t[e];
3107
3107
  var n = this.schema[e];
3108
3108
  if (!n) throw new Q.NotFound("Table " + e + " not part of transaction");
3109
3109
  return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
@@ -3149,11 +3149,11 @@ function Zo() {
3149
3149
  function Ur(e) {
3150
3150
  return [].slice.call(e);
3151
3151
  }
3152
- var to = 0;
3152
+ var eo = 0;
3153
3153
  function Wt(e) {
3154
3154
  return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
3155
3155
  }
3156
- function no(e, t, b) {
3156
+ function to(e, t, b) {
3157
3157
  function i(N) {
3158
3158
  if (N.type === 3) return null;
3159
3159
  if (N.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
@@ -3171,27 +3171,27 @@ function Zo() {
3171
3171
  var $, W = (k || P || { length: 1 }).length;
3172
3172
  if (k && P && k.length !== P.length) throw new Error("Given keys array must have same length as given values array.");
3173
3173
  if (W === 0) return K({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
3174
- function re(Me) {
3175
- ++_e, $t(Me);
3174
+ function re(je) {
3175
+ ++Ee, $t(je);
3176
3176
  }
3177
- var se = [], te = [], _e = 0;
3177
+ var se = [], te = [], Ee = 0;
3178
3178
  if (A === "deleteRange") {
3179
- if (F.type === 4) return K({ numFailures: _e, failures: te, results: [], lastResult: void 0 });
3179
+ if (F.type === 4) return K({ numFailures: Ee, failures: te, results: [], lastResult: void 0 });
3180
3180
  F.type === 3 ? se.push($ = L.clear()) : se.push($ = L.delete(i(F)));
3181
3181
  } else {
3182
3182
  var U = G ? U ? [P, k] : [P, null] : [k, null], ee = U[0], Pe = U[1];
3183
3183
  if (G) for (var Fe = 0; Fe < W; ++Fe) se.push($ = Pe && Pe[Fe] !== void 0 ? L[A](ee[Fe], Pe[Fe]) : L[A](ee[Fe])), $.onerror = re;
3184
3184
  else for (Fe = 0; Fe < W; ++Fe) se.push($ = L[A](ee[Fe])), $.onerror = re;
3185
3185
  }
3186
- function On(Me) {
3187
- Me = Me.target.result, se.forEach(function(_t, mr) {
3186
+ function On(je) {
3187
+ je = je.target.result, se.forEach(function(_t, mr) {
3188
3188
  return _t.error != null && (te[mr] = _t.error);
3189
- }), K({ numFailures: _e, failures: te, results: A === "delete" ? k : se.map(function(_t) {
3189
+ }), K({ numFailures: Ee, failures: te, results: A === "delete" ? k : se.map(function(_t) {
3190
3190
  return _t.result;
3191
- }), lastResult: Me });
3191
+ }), lastResult: je });
3192
3192
  }
3193
- $.onerror = function(Me) {
3194
- re(Me), On(Me);
3193
+ $.onerror = function(je) {
3194
+ re(je), On(je);
3195
3195
  }, $.onsuccess = On;
3196
3196
  });
3197
3197
  }, getMany: function(C) {
@@ -3230,8 +3230,8 @@ function Zo() {
3230
3230
  K = ge(K);
3231
3231
  var G = k.index, L = k.range, U = N.objectStore(x), U = G.isPrimaryKey ? U : U.index(G.name), G = P ? F ? "prevunique" : "prev" : F ? "nextunique" : "next", $ = !A && "openKeyCursor" in U ? U.openKeyCursor(i(L), G) : U.openCursor(i(L), G);
3232
3232
  $.onerror = Ye(V), $.onsuccess = ge(function(W) {
3233
- var re, se, te, _e, ee = $.result;
3234
- ee ? (ee.___id = ++to, ee.done = !1, re = ee.continue.bind(ee), se = (se = ee.continuePrimaryKey) && se.bind(ee), te = ee.advance.bind(ee), _e = function() {
3233
+ var re, se, te, Ee, ee = $.result;
3234
+ ee ? (ee.___id = ++eo, ee.done = !1, re = ee.continue.bind(ee), se = (se = ee.continuePrimaryKey) && se.bind(ee), te = ee.advance.bind(ee), Ee = function() {
3235
3235
  throw new Error("Cursor not stopped");
3236
3236
  }, ee.trans = N, ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = function() {
3237
3237
  throw new Error("Cursor not started");
@@ -3246,19 +3246,19 @@ function Zo() {
3246
3246
  function Fe() {
3247
3247
  if ($.result) try {
3248
3248
  Pe();
3249
- } catch (Me) {
3250
- ee.fail(Me);
3249
+ } catch (je) {
3250
+ ee.fail(je);
3251
3251
  }
3252
3252
  else ee.done = !0, ee.start = function() {
3253
3253
  throw new Error("Cursor behind last entry");
3254
3254
  }, ee.stop();
3255
3255
  }
3256
- var On = new Promise(function(Me, _t) {
3257
- Me = ge(Me), $.onerror = Ye(_t), ee.fail = _t, ee.stop = function(mr) {
3258
- ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = _e, Me(mr);
3256
+ var On = new Promise(function(je, _t) {
3257
+ je = ge(je), $.onerror = Ye(_t), ee.fail = _t, ee.stop = function(mr) {
3258
+ ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = Ee, je(mr);
3259
3259
  };
3260
3260
  });
3261
- return $.onsuccess = ge(function(Me) {
3261
+ return $.onsuccess = ge(function(je) {
3262
3262
  $.onsuccess = Fe, Fe();
3263
3263
  }), ee.continue = re, ee.continuePrimaryKey = se, ee.advance = te, Fe(), On;
3264
3264
  }, K(ee)) : K(null);
@@ -3294,14 +3294,14 @@ function Zo() {
3294
3294
  return y[O];
3295
3295
  }, MIN_KEY: -1 / 0, MAX_KEY: Yt(t), schema: b };
3296
3296
  }
3297
- function ro(e, t, n, i) {
3297
+ function no(e, t, n, i) {
3298
3298
  var a = n.IDBKeyRange;
3299
- return n.indexedDB, { dbcore: (i = no(t, a, i), e.dbcore.reduce(function(u, h) {
3299
+ return n.indexedDB, { dbcore: (i = to(t, a, i), e.dbcore.reduce(function(u, h) {
3300
3300
  return h = h.create, o(o({}, u), h(u));
3301
3301
  }, i)) };
3302
3302
  }
3303
3303
  function gn(e, i) {
3304
- var n = i.db, i = ro(e._middlewares, n, e._deps, i);
3304
+ var n = i.db, i = no(e._middlewares, n, e._deps, i);
3305
3305
  e.core = i.dbcore, e.tables.forEach(function(a) {
3306
3306
  var u = a.name;
3307
3307
  e.core.schema.tables.some(function(h) {
@@ -3316,10 +3316,10 @@ function Zo() {
3316
3316
  var p = (function b(_, T) {
3317
3317
  return H(_, T) || (_ = I(_)) && b(_, T);
3318
3318
  })(h, a);
3319
- (!p || "value" in p && p.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? j(h, a, { get: function() {
3319
+ (!p || "value" in p && p.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? M(h, a, { get: function() {
3320
3320
  return this.table(a);
3321
3321
  }, set: function(b) {
3322
- ie(this, a, { value: b, writable: !0, configurable: !0, enumerable: !0 });
3322
+ oe(this, a, { value: b, writable: !0, configurable: !0, enumerable: !0 });
3323
3323
  } }) : h[a] = new e.Table(a, u));
3324
3324
  });
3325
3325
  });
@@ -3329,10 +3329,10 @@ function Zo() {
3329
3329
  for (var i in n) n[i] instanceof e.Table && delete n[i];
3330
3330
  });
3331
3331
  }
3332
- function io(e, t) {
3332
+ function ro(e, t) {
3333
3333
  return e._cfg.version - t._cfg.version;
3334
3334
  }
3335
- function oo(e, t, n, i) {
3335
+ function io(e, t, n, i) {
3336
3336
  var a = e._dbSchema;
3337
3337
  n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Hn("$meta", $r("")[0], []), e._storeNames.push("$meta"));
3338
3338
  var u = e._createTransaction("readwrite", e._storeNames, a);
@@ -3401,7 +3401,7 @@ function Zo() {
3401
3401
  var b, _;
3402
3402
  });
3403
3403
  }
3404
- function ao(e, t) {
3404
+ function oo(e, t) {
3405
3405
  Vr(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");
3406
3406
  var n = bn(0, e.idbdb, t);
3407
3407
  wn(e, e._dbSchema, t);
@@ -3410,7 +3410,7 @@ function Zo() {
3410
3410
  if (h.change.length || h.recreate) return console.warn("Unable to patch indexes of table ".concat(h.name, " because it has changes on the type of index or primary key.")), { value: void 0 };
3411
3411
  var p = t.objectStore(h.name);
3412
3412
  h.add.forEach(function(b) {
3413
- Ne && console.debug("Dexie upgrade patch: Creating missing index ".concat(h.name, ".").concat(b.src)), vn(p, b);
3413
+ Ce && console.debug("Dexie upgrade patch: Creating missing index ".concat(h.name, ".").concat(b.src)), vn(p, b);
3414
3414
  });
3415
3415
  })(a[i]);
3416
3416
  if (typeof u == "object") return u.value;
@@ -3445,7 +3445,7 @@ function Zo() {
3445
3445
  }
3446
3446
  function Vr(e, t) {
3447
3447
  v(e).forEach(function(n) {
3448
- t.db.objectStoreNames.contains(n) || (Ne && console.debug("Dexie: Creating missing table", n), Jn(t, n, e[n].primKey, e[n].indexes));
3448
+ t.db.objectStoreNames.contains(n) || (Ce && console.debug("Dexie: Creating missing table", n), Jn(t, n, e[n].primKey, e[n].indexes));
3449
3449
  });
3450
3450
  }
3451
3451
  function vn(e, t) {
@@ -3478,7 +3478,7 @@ function Zo() {
3478
3478
  return Xn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), g(u), n === 0, i);
3479
3479
  });
3480
3480
  }
3481
- var so = (Pt.prototype._createTableSchema = Hn, Pt.prototype._parseIndexSyntax = $r, Pt.prototype._parseStoresSpec = function(e, t) {
3481
+ var ao = (Pt.prototype._createTableSchema = Hn, Pt.prototype._parseIndexSyntax = $r, Pt.prototype._parseStoresSpec = function(e, t) {
3482
3482
  var n = this;
3483
3483
  v(e).forEach(function(i) {
3484
3484
  if (e[i] !== null) {
@@ -3583,7 +3583,7 @@ function Zo() {
3583
3583
  return v(t).forEach(function(n) {
3584
3584
  e[n] ? Ht(e[n], t[n]) : e[n] = (function i(a) {
3585
3585
  var u, h, p = {};
3586
- for (u in a) M(a, u) && (h = a[u], p[u] = !h || typeof h != "object" || Bt.has(h.constructor) ? h : i(h));
3586
+ for (u in a) j(a, u) && (h = a[u], p[u] = !h || typeof h != "object" || Bt.has(h.constructor) ? h : i(h));
3587
3587
  return p;
3588
3588
  })(t[n]);
3589
3589
  }), e;
@@ -3605,7 +3605,7 @@ function Zo() {
3605
3605
  }, hasKey: function(e) {
3606
3606
  var t = _n(this).next(e).value;
3607
3607
  return t && ae(t.from, e) <= 0 && 0 <= ae(t.to, e);
3608
- } })[jt] = function() {
3608
+ } })[Mt] = function() {
3609
3609
  return _n(this);
3610
3610
  }, Le));
3611
3611
  var bt = {}, or = {}, ar = !1;
@@ -3641,10 +3641,10 @@ function Zo() {
3641
3641
  e.queries.query[b] = _;
3642
3642
  }
3643
3643
  }
3644
- function co(e) {
3644
+ function so(e) {
3645
3645
  var t = e._state, n = e._deps.indexedDB;
3646
3646
  if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
3647
- return t.dbOpenError ? xe(t.dbOpenError) : e;
3647
+ return t.dbOpenError ? Te(t.dbOpenError) : e;
3648
3648
  });
3649
3649
  t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
3650
3650
  var i = t.openCanceller, a = Math.round(10 * e.verno), u = !1;
@@ -3660,7 +3660,7 @@ function Zo() {
3660
3660
  var A;
3661
3661
  T = C.transaction, t.autoSchema && !e._options.allowEmptyDB ? (C.onerror = $t, T.abort(), C.result.close(), (A = n.deleteDatabase(x)).onsuccess = A.onerror = ge(function() {
3662
3662
  w(new Q.NoSuchDatabase("Database ".concat(x, " doesnt exist")));
3663
- })) : (T.onerror = Ye(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = C.result, u && ao(e, T), oo(e, N / 10, T, w));
3663
+ })) : (T.onerror = Ye(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = C.result, u && oo(e, T), io(e, N / 10, T, w));
3664
3664
  }, w), C.onsuccess = ge(function() {
3665
3665
  T = null;
3666
3666
  var N, A, k, P, F, K = e.idbdb = C.result, V = ye(K.objectStoreNames);
@@ -3717,7 +3717,7 @@ function Zo() {
3717
3717
  T && T.abort();
3718
3718
  } catch {
3719
3719
  }
3720
- return i === t.openCanceller && e._close(), xe(O);
3720
+ return i === t.openCanceller && e._close(), Te(O);
3721
3721
  }).finally(function() {
3722
3722
  t.openComplete = !0, _();
3723
3723
  }).then(function() {
@@ -3748,7 +3748,7 @@ function Zo() {
3748
3748
  for (var i = g(e) ? e.slice() : [e], a = 0; a < n; ++a) i.push(t);
3749
3749
  return i;
3750
3750
  }
3751
- var uo = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3751
+ var co = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3752
3752
  return o(o({}, e), { table: function(t) {
3753
3753
  var n = e.table(t), i = n.schema, a = {}, u = [];
3754
3754
  function h(y, O, w) {
@@ -3797,15 +3797,15 @@ function Zo() {
3797
3797
  function ur(e, t, n, i) {
3798
3798
  return n = n || {}, i = i || "", v(e).forEach(function(a) {
3799
3799
  var u, h, p;
3800
- M(t, a) ? (u = e[a], h = t[a], typeof u == "object" && typeof h == "object" && u && h ? (p = Mt(u)) !== Mt(h) ? n[i + a] = t[a] : p === "Object" ? ur(u, h, n, i + a + ".") : u !== h && (n[i + a] = t[a]) : u !== h && (n[i + a] = t[a])) : n[i + a] = void 0;
3800
+ j(t, a) ? (u = e[a], h = t[a], typeof u == "object" && typeof h == "object" && u && h ? (p = jt(u)) !== jt(h) ? n[i + a] = t[a] : p === "Object" ? ur(u, h, n, i + a + ".") : u !== h && (n[i + a] = t[a]) : u !== h && (n[i + a] = t[a])) : n[i + a] = void 0;
3801
3801
  }), v(t).forEach(function(a) {
3802
- M(e, a) || (n[i + a] = t[a]);
3802
+ j(e, a) || (n[i + a] = t[a]);
3803
3803
  }), n;
3804
3804
  }
3805
3805
  function lr(e, t) {
3806
3806
  return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
3807
3807
  }
3808
- var lo = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3808
+ var uo = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3809
3809
  return o(o({}, e), { table: function(t) {
3810
3810
  var n = e.table(t), i = n.schema.primaryKey;
3811
3811
  return o(o({}, n), { mutate: function(a) {
@@ -3847,7 +3847,7 @@ function Zo() {
3847
3847
  var k = N.map(function(P, F) {
3848
3848
  var K, V, L, U = A[F], G = { onerror: null, onsuccess: null };
3849
3849
  return y.type === "delete" ? p.fire.call(G, P, U, C) : y.type === "add" || U === void 0 ? (K = b.fire.call(G, P, y.values[F], C), P == null && K != null && (y.keys[F] = P = K, i.outbound || de(y.values[F], i.keyPath, P))) : (K = ur(U, y.values[F]), (V = _.fire.call(G, K, P, U, C)) && (L = y.values[F], Object.keys(V).forEach(function($) {
3850
- M(L, $) ? L[$] = V[$] : de(L, $, V[$]);
3850
+ j(L, $) ? L[$] = V[$] : de(L, $, V[$]);
3851
3851
  }))), G;
3852
3852
  });
3853
3853
  return n.mutate(y).then(function(P) {
@@ -3875,7 +3875,7 @@ function Zo() {
3875
3875
  return null;
3876
3876
  }
3877
3877
  }
3878
- var fo = { stack: "dbcore", level: -1, create: function(e) {
3878
+ var lo = { stack: "dbcore", level: -1, create: function(e) {
3879
3879
  return { table: function(t) {
3880
3880
  var n = e.table(t);
3881
3881
  return o(o({}, n), { getMany: function(i) {
@@ -3903,7 +3903,7 @@ function Zo() {
3903
3903
  return !1;
3904
3904
  }
3905
3905
  }
3906
- var ho = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3906
+ var fo = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3907
3907
  var t = e.schema.name, n = new Ie(e.MIN_KEY, e.MAX_KEY);
3908
3908
  return o(o({}, e), { transaction: function(i, a, u) {
3909
3909
  if (z.subscr && a !== "readonly") throw new Q.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(z.querier));
@@ -3924,8 +3924,8 @@ function Zo() {
3924
3924
  return te != null ? $.extractKey(te) : null;
3925
3925
  }
3926
3926
  function se(te) {
3927
- return $.multiEntry && g(te) ? te.forEach(function(_e) {
3928
- return W.addKey(_e);
3927
+ return $.multiEntry && g(te) ? te.forEach(function(Ee) {
3928
+ return W.addKey(Ee);
3929
3929
  }) : W.addKey(te);
3930
3930
  }
3931
3931
  (N || A).forEach(function(te, Pe) {
@@ -3940,7 +3940,7 @@ function Zo() {
3940
3940
  return W.extractKey(ee);
3941
3941
  }), se = W.keyPath.findIndex(function(ee) {
3942
3942
  return ee === h.keyPath;
3943
- }), te = 0, _e = $.results.length; te < _e; ++te) re[te][se] = $.results[te];
3943
+ }), te = 0, Ee = $.results.length; te < Ee; ++te) re[te][se] = $.results[te];
3944
3944
  x(W.name).addKeys(re);
3945
3945
  })), k.mutatedParts = En(k.mutatedParts || {}, P), $;
3946
3946
  });
@@ -4058,7 +4058,7 @@ function Zo() {
4058
4058
  function ei(e, t) {
4059
4059
  return ae(e.lower, t.lower) === 0 && ae(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
4060
4060
  }
4061
- function mo(e, t) {
4061
+ function ho(e, t) {
4062
4062
  return (function(n, i, a, u) {
4063
4063
  if (n === void 0) return i !== void 0 ? -1 : 0;
4064
4064
  if (i === void 0) return 1;
@@ -4079,7 +4079,7 @@ function Zo() {
4079
4079
  return i;
4080
4080
  })(e.upper, t.upper, e.upperOpen, t.upperOpen);
4081
4081
  }
4082
- function po(e, t, n, i) {
4082
+ function mo(e, t, n, i) {
4083
4083
  e.subscribers.add(n), i.addEventListener("abort", function() {
4084
4084
  var a, u;
4085
4085
  e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, u = t, setTimeout(function() {
@@ -4087,7 +4087,7 @@ function Zo() {
4087
4087
  }, 3e3));
4088
4088
  });
4089
4089
  }
4090
- var go = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
4090
+ var po = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
4091
4091
  var t = e.schema.name;
4092
4092
  return o(o({}, e), { transaction: function(n, i, a) {
4093
4093
  var u, h, p = e.transaction(n, i, a);
@@ -4156,7 +4156,7 @@ function Zo() {
4156
4156
  return K.req.limit === A.limit && K.req.values === A.values && ei(K.req.query.range, A.query.range);
4157
4157
  });
4158
4158
  return F ? [F, !0, k, P] : [P.find(function(K) {
4159
- return ("limit" in K.req ? K.req.limit : 1 / 0) >= A.limit && (!A.values || K.req.values) && mo(K.req.query.range, A.query.range);
4159
+ return ("limit" in K.req ? K.req.limit : 1 / 0) >= A.limit && (!A.values || K.req.values) && ho(K.req.query.range, A.query.range);
4160
4160
  }), !1, k, P];
4161
4161
  case "count":
4162
4162
  return F = P.find(function(K) {
@@ -4173,7 +4173,7 @@ function Zo() {
4173
4173
  return x;
4174
4174
  }).catch(function(x) {
4175
4175
  return w && T && Ke(w, T), Promise.reject(x);
4176
- }), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (O = O || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), po(T, w, p, b), T.promise.then(function(x) {
4176
+ }), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (O = O || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), mo(T, w, p, b), T.promise.then(function(x) {
4177
4177
  return { result: Jr(x.result, u, O?.optimisticOps, i, T, h) };
4178
4178
  });
4179
4179
  } });
@@ -4184,15 +4184,15 @@ function Zo() {
4184
4184
  return i === "db" ? t : Reflect.get(n, i, a);
4185
4185
  } });
4186
4186
  }
4187
- var Je = (Te.prototype.version = function(e) {
4187
+ var Je = (Ne.prototype.version = function(e) {
4188
4188
  if (isNaN(e) || e < 0.1) throw new Q.Type("Given version is not a positive number");
4189
4189
  if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new Q.Schema("Cannot add version when database is open");
4190
4190
  this.verno = Math.max(this.verno, e);
4191
4191
  var t = this._versions, n = t.filter(function(i) {
4192
4192
  return i._cfg.version === e;
4193
4193
  })[0];
4194
- return n || (n = new this.Version(e), t.push(n), t.sort(io), n.stores({}), this._state.autoSchema = !1, n);
4195
- }, Te.prototype._whenReady = function(e) {
4194
+ return n || (n = new this.Version(e), t.push(n), t.sort(ro), n.stores({}), this._state.autoSchema = !1, n);
4195
+ }, Ne.prototype._whenReady = function(e) {
4196
4196
  var t = this;
4197
4197
  return this.idbdb && (this._state.openComplete || z.letThrough || this._vip) ? e() : new Y(function(n, i) {
4198
4198
  if (t._state.openComplete) return i(new Q.DatabaseClosed(t._state.dbOpenError));
@@ -4202,22 +4202,22 @@ function Zo() {
4202
4202
  }
4203
4203
  t._state.dbReadyPromise.then(n, i);
4204
4204
  }).then(e);
4205
- }, Te.prototype.use = function(e) {
4205
+ }, Ne.prototype.use = function(e) {
4206
4206
  var t = e.stack, n = e.create, i = e.level, a = e.name;
4207
4207
  return a && this.unuse({ stack: t, name: a }), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({ stack: t, create: n, level: i ?? 10, name: a }), e.sort(function(u, h) {
4208
4208
  return u.level - h.level;
4209
4209
  }), this;
4210
- }, Te.prototype.unuse = function(e) {
4210
+ }, Ne.prototype.unuse = function(e) {
4211
4211
  var t = e.stack, n = e.name, i = e.create;
4212
4212
  return t && this._middlewares[t] && (this._middlewares[t] = this._middlewares[t].filter(function(a) {
4213
4213
  return i ? a.create !== i : !!n && a.name !== n;
4214
4214
  })), this;
4215
- }, Te.prototype.open = function() {
4215
+ }, Ne.prototype.open = function() {
4216
4216
  var e = this;
4217
4217
  return gt(it, function() {
4218
- return co(e);
4218
+ return so(e);
4219
4219
  });
4220
- }, Te.prototype._close = function() {
4220
+ }, Ne.prototype._close = function() {
4221
4221
  this.on.close.fire(new CustomEvent("close"));
4222
4222
  var e = this._state, t = kt.indexOf(this);
4223
4223
  if (0 <= t && kt.splice(t, 1), this.idbdb) {
@@ -4232,10 +4232,10 @@ function Zo() {
4232
4232
  }), e.openCanceller = new Y(function(n, i) {
4233
4233
  e.cancelOpen = i;
4234
4234
  }));
4235
- }, Te.prototype.close = function(n) {
4235
+ }, Ne.prototype.close = function(n) {
4236
4236
  var t = (n === void 0 ? { disableAutoOpen: !0 } : n).disableAutoOpen, n = this._state;
4237
4237
  t ? (n.isBeingOpened && n.cancelOpen(new Q.DatabaseClosed()), this._close(), n.autoOpen = !1, n.dbOpenError = new Q.DatabaseClosed()) : (this._close(), n.autoOpen = this._options.autoOpen || n.isBeingOpened, n.openComplete = !1, n.dbOpenError = null);
4238
- }, Te.prototype.delete = function(e) {
4238
+ }, Ne.prototype.delete = function(e) {
4239
4239
  var t = this;
4240
4240
  e === void 0 && (e = { disableAutoOpen: !0 });
4241
4241
  var n = 0 < arguments.length && typeof arguments[0] != "object", i = this._state;
@@ -4251,23 +4251,23 @@ function Zo() {
4251
4251
  if (n) throw new Q.InvalidArgument("Invalid closeOptions argument to db.delete()");
4252
4252
  i.isBeingOpened ? i.dbReadyPromise.then(h) : h();
4253
4253
  });
4254
- }, Te.prototype.backendDB = function() {
4254
+ }, Ne.prototype.backendDB = function() {
4255
4255
  return this.idbdb;
4256
- }, Te.prototype.isOpen = function() {
4256
+ }, Ne.prototype.isOpen = function() {
4257
4257
  return this.idbdb !== null;
4258
- }, Te.prototype.hasBeenClosed = function() {
4258
+ }, Ne.prototype.hasBeenClosed = function() {
4259
4259
  var e = this._state.dbOpenError;
4260
4260
  return e && e.name === "DatabaseClosed";
4261
- }, Te.prototype.hasFailed = function() {
4261
+ }, Ne.prototype.hasFailed = function() {
4262
4262
  return this._state.dbOpenError !== null;
4263
- }, Te.prototype.dynamicallyOpened = function() {
4263
+ }, Ne.prototype.dynamicallyOpened = function() {
4264
4264
  return this._state.autoSchema;
4265
- }, Object.defineProperty(Te.prototype, "tables", { get: function() {
4265
+ }, Object.defineProperty(Ne.prototype, "tables", { get: function() {
4266
4266
  var e = this;
4267
4267
  return v(this._allTables).map(function(t) {
4268
4268
  return e._allTables[t];
4269
4269
  });
4270
- }, enumerable: !1, configurable: !0 }), Te.prototype.transaction = function() {
4270
+ }, enumerable: !1, configurable: !0 }), Ne.prototype.transaction = function() {
4271
4271
  var e = (function(t, n, i) {
4272
4272
  var a = arguments.length;
4273
4273
  if (a < 2) throw new Q.InvalidArgument("Too few arguments");
@@ -4275,7 +4275,7 @@ function Zo() {
4275
4275
  return i = u.pop(), [t, S(u), i];
4276
4276
  }).apply(this, arguments);
4277
4277
  return this._transaction.apply(this, e);
4278
- }, Te.prototype._transaction = function(e, t, n) {
4278
+ }, Ne.prototype._transaction = function(e, t, n) {
4279
4279
  var i = this, a = z.trans;
4280
4280
  a && a.db === this && e.indexOf("!") === -1 || (a = null);
4281
4281
  var u, h, p = e.indexOf("?") !== -1;
@@ -4304,7 +4304,7 @@ function Zo() {
4304
4304
  } catch (_) {
4305
4305
  return a ? a._promise(null, function(T, y) {
4306
4306
  y(_);
4307
- }) : xe(_);
4307
+ }) : Te(_);
4308
4308
  }
4309
4309
  var b = (function _(T, y, O, w, x) {
4310
4310
  return Y.resolve().then(function() {
@@ -4315,14 +4315,14 @@ function Zo() {
4315
4315
  } catch (P) {
4316
4316
  return P.name === ht.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
4317
4317
  return _(T, y, O, null, x);
4318
- })) : xe(P);
4318
+ })) : Te(P);
4319
4319
  }
4320
4320
  var A, k = Tt(x);
4321
4321
  return k && St(), C = Y.follow(function() {
4322
4322
  var P;
4323
4323
  (A = x.call(N, N)) && (k ? (P = at.bind(null, null), A.then(P, P)) : typeof A.next == "function" && typeof A.throw == "function" && (A = cr(A)));
4324
4324
  }, C), (A && typeof A.then == "function" ? Y.resolve(A).then(function(P) {
4325
- return N.active ? P : xe(new Q.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
4325
+ return N.active ? P : Te(new Q.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
4326
4326
  }) : C.then(function() {
4327
4327
  return A;
4328
4328
  })).then(function(P) {
@@ -4330,22 +4330,22 @@ function Zo() {
4330
4330
  return P;
4331
4331
  });
4332
4332
  }).catch(function(P) {
4333
- return N._reject(P), xe(P);
4333
+ return N._reject(P), Te(P);
4334
4334
  });
4335
4335
  });
4336
4336
  }).bind(null, this, u, h, a, n);
4337
4337
  return a ? a._promise(u, b, "lock") : z.trans ? gt(z.transless, function() {
4338
4338
  return i._whenReady(b);
4339
4339
  }) : this._whenReady(b);
4340
- }, Te.prototype.table = function(e) {
4341
- if (!M(this._allTables, e)) throw new Q.InvalidTable("Table ".concat(e, " does not exist"));
4340
+ }, Ne.prototype.table = function(e) {
4341
+ if (!j(this._allTables, e)) throw new Q.InvalidTable("Table ".concat(e, " does not exist"));
4342
4342
  return this._allTables[e];
4343
- }, Te);
4344
- function Te(e, t) {
4343
+ }, Ne);
4344
+ function Ne(e, t) {
4345
4345
  var n = this;
4346
4346
  this._middlewares = {}, this.verno = 0;
4347
- var i = Te.dependencies;
4348
- this._options = t = o({ addons: Te.addons, autoOpen: !0, indexedDB: i.indexedDB, IDBKeyRange: i.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, i = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
4347
+ var i = Ne.dependencies;
4348
+ this._options = t = o({ addons: Ne.addons, autoOpen: !0, indexedDB: i.indexedDB, IDBKeyRange: i.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, i = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
4349
4349
  var a, u, h, p, b, _ = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: l, dbReadyPromise: null, cancelOpen: l, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
4350
4350
  _.dbReadyPromise = new Y(function(y) {
4351
4351
  _.dbReadyResolve = y;
@@ -4359,14 +4359,14 @@ function Zo() {
4359
4359
  return n.on(y, w);
4360
4360
  }, this.on.ready.subscribe = ne(this.on.ready.subscribe, function(y) {
4361
4361
  return function(O, w) {
4362
- Te.vip(function() {
4362
+ Ne.vip(function() {
4363
4363
  var x, C = n._state;
4364
4364
  C.openComplete ? (C.dbOpenError || Y.resolve().then(O), w && y(O)) : C.onReadyBeingFired ? (C.onReadyBeingFired.push(O), w && y(O)) : (y(O), x = n, w || y(function N() {
4365
4365
  x.on.ready.unsubscribe(O), x.on.ready.unsubscribe(N);
4366
4366
  }));
4367
4367
  });
4368
4368
  };
4369
- }), this.Collection = (a = this, Ut(Qi.prototype, function(A, N) {
4369
+ }), this.Collection = (a = this, Ut(zi.prototype, function(A, N) {
4370
4370
  this.db = a;
4371
4371
  var w = Sr, x = null;
4372
4372
  if (N) try {
@@ -4377,8 +4377,8 @@ function Zo() {
4377
4377
  var C = A._ctx, N = C.table, A = N.hook.reading.fire;
4378
4378
  this._ctx = { table: N, index: C.index, isPrimKey: !C.index || N.schema.primKey.keyPath && C.index === N.schema.primKey.name, range: w, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: x, or: C.or, valueMapper: A !== c ? A : null };
4379
4379
  })), this.Table = (u = this, Ut(Pr.prototype, function(y, O, w) {
4380
- this.db = u, this._tx = w, this.name = y, this.schema = O, this.hook = u._allTables[y] ? u._allTables[y].hook : Lt(null, { creating: [le, l], reading: [R, c], updating: [Ee, l], deleting: [be, l] });
4381
- })), this.Transaction = (h = this, Ut(eo.prototype, function(y, O, w, x, C) {
4380
+ this.db = u, this._tx = w, this.name = y, this.schema = O, this.hook = u._allTables[y] ? u._allTables[y].hook : Lt(null, { creating: [le, l], reading: [R, c], updating: [xe, l], deleting: [be, l] });
4381
+ })), this.Transaction = (h = this, Ut(Ji.prototype, function(y, O, w, x, C) {
4382
4382
  var N = this;
4383
4383
  y !== "readonly" && O.forEach(function(A) {
4384
4384
  A = (A = w[A]) === null || A === void 0 ? void 0 : A.yProps, A && (O = O.concat(A.map(function(k) {
@@ -4390,9 +4390,9 @@ function Zo() {
4390
4390
  N.active = !1, N.on.complete.fire();
4391
4391
  }, function(A) {
4392
4392
  var k = N.active;
4393
- return N.active = !1, N.on.error.fire(A), N.parent ? N.parent._reject(A) : k && N.idbtrans && N.idbtrans.abort(), xe(A);
4393
+ return N.active = !1, N.on.error.fire(A), N.parent ? N.parent._reject(A) : k && N.idbtrans && N.idbtrans.abort(), Te(A);
4394
4394
  });
4395
- })), this.Version = (p = this, Ut(so.prototype, function(y) {
4395
+ })), this.Version = (p = this, Ut(ao.prototype, function(y) {
4396
4396
  this.db = p, this._cfg = { version: y, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
4397
4397
  })), this.WhereClause = (b = this, Ut(qr.prototype, function(y, O, w) {
4398
4398
  if (this.db = b, this._ctx = { table: y, index: O === ":id" ? null : O, or: w }, this._cmp = this._ascending = ae, this._descending = function(x, C) {
@@ -4414,7 +4414,7 @@ function Zo() {
4414
4414
  }).map(function(O) {
4415
4415
  return O.on("versionchange").fire(y);
4416
4416
  });
4417
- }, this.use(fo), this.use(go), this.use(ho), this.use(uo), this.use(lo);
4417
+ }, this.use(lo), this.use(po), this.use(fo), this.use(co), this.use(uo);
4418
4418
  var T = new Proxy(this, { get: function(y, O, w) {
4419
4419
  if (O === "_vip") return !0;
4420
4420
  if (O === "table") return function(C) {
@@ -4431,7 +4431,7 @@ function Zo() {
4431
4431
  return y(n);
4432
4432
  });
4433
4433
  }
4434
- var Cn, Le = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", yo = (dr.prototype.subscribe = function(e, t, n) {
4434
+ var Cn, Le = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", go = (dr.prototype.subscribe = function(e, t, n) {
4435
4435
  return this._subscribe(e && typeof e != "function" ? e : { next: e, error: t, complete: n });
4436
4436
  }, dr.prototype[Le] = function() {
4437
4437
  return this;
@@ -4445,7 +4445,7 @@ function Zo() {
4445
4445
  Cn = { indexedDB: null, IDBKeyRange: null };
4446
4446
  }
4447
4447
  function ti(e) {
4448
- var t, n = !1, i = new yo(function(a) {
4448
+ var t, n = !1, i = new go(function(a) {
4449
4449
  var u = Tt(e), h, p = !1, b = {}, _ = {}, T = { get closed() {
4450
4450
  return p;
4451
4451
  }, unsubscribe: function() {
@@ -4469,7 +4469,7 @@ function Zo() {
4469
4469
  }
4470
4470
  })(N = { subscr: C, signal: h.signal, requery: O, querier: e, trans: null }), Promise.resolve(A).then(function(k) {
4471
4471
  n = !0, t = k, p || N.signal.aborted || (b = {}, (function(P) {
4472
- for (var F in P) if (M(P, F)) return;
4472
+ for (var F in P) if (j(P, F)) return;
4473
4473
  return 1;
4474
4474
  })(_ = C) || y || (ut(Gt, w), y = !0), Un(function() {
4475
4475
  return !p && a.next && a.next(k);
@@ -4515,7 +4515,7 @@ function Zo() {
4515
4515
  });
4516
4516
  }) : er(n, t).toCollection().primaryKeys()).then(e);
4517
4517
  } catch {
4518
- return xe(new Q.MissingAPI());
4518
+ return Te(new Q.MissingAPI());
4519
4519
  }
4520
4520
  var t, n;
4521
4521
  }, defineClass: function() {
@@ -4530,7 +4530,7 @@ function Zo() {
4530
4530
  var t = cr(e.apply(this, arguments));
4531
4531
  return t && typeof t.then == "function" ? t : Y.resolve(t);
4532
4532
  } catch (n) {
4533
- return xe(n);
4533
+ return Te(n);
4534
4534
  }
4535
4535
  };
4536
4536
  }, spawn: function(e, t, n) {
@@ -4538,16 +4538,16 @@ function Zo() {
4538
4538
  var i = cr(e.apply(n, t || []));
4539
4539
  return i && typeof i.then == "function" ? i : Y.resolve(i);
4540
4540
  } catch (a) {
4541
- return xe(a);
4541
+ return Te(a);
4542
4542
  }
4543
4543
  }, currentTransaction: { get: function() {
4544
4544
  return z.trans || null;
4545
4545
  } }, waitFor: function(e, t) {
4546
4546
  return t = Y.resolve(typeof e == "function" ? wt.ignoreTransaction(e) : e).timeout(t || 6e4), z.trans ? z.trans.waitFor(t) : t;
4547
4547
  }, Promise: Y, debug: { get: function() {
4548
- return Ne;
4548
+ return Ce;
4549
4549
  }, set: function(e) {
4550
- Ce(e);
4550
+ Oe(e);
4551
4551
  } }, derive: B, extend: D, props: X, override: ne, Events: Lt, on: ut, liveQuery: ti, extendObservabilitySet: En, getByKeyPath: he, setByKeyPath: de, delByKeyPath: function(e, t) {
4552
4552
  typeof t == "string" ? de(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
4553
4553
  de(e, n, void 0);
@@ -4571,16 +4571,16 @@ function Zo() {
4571
4571
  lt || Ft.postMessage(e);
4572
4572
  })), typeof addEventListener < "u" && (addEventListener("pagehide", function(e) {
4573
4573
  if (!Je.disableBfCache && e.persisted) {
4574
- Ne && console.debug("Dexie: handling persisted pagehide"), Ft?.close();
4574
+ Ce && console.debug("Dexie: handling persisted pagehide"), Ft?.close();
4575
4575
  for (var t = 0, n = kt; t < n.length; t++) n[t].close({ disableAutoOpen: !1 });
4576
4576
  }
4577
4577
  }), addEventListener("pageshow", function(e) {
4578
- !Je.disableBfCache && e.persisted && (Ne && console.debug("Dexie: handling persisted pageshow"), ni(), hr({ all: new Ie(-1 / 0, [[]]) }));
4578
+ !Je.disableBfCache && e.persisted && (Ce && console.debug("Dexie: handling persisted pageshow"), ni(), hr({ all: new Ie(-1 / 0, [[]]) }));
4579
4579
  })), Y.rejectionMapper = function(e, t) {
4580
- return !e || e instanceof tt || e instanceof TypeError || e instanceof SyntaxError || !e.name || !Ct[e.name] ? e : (t = new Ct[e.name](t || e.message, e), "stack" in e && j(t, "stack", { get: function() {
4580
+ return !e || e instanceof tt || e instanceof TypeError || e instanceof SyntaxError || !e.name || !Ct[e.name] ? e : (t = new Ct[e.name](t || e.message, e), "stack" in e && M(t, "stack", { get: function() {
4581
4581
  return this.inner.stack;
4582
4582
  } }), t);
4583
- }, Ce(Ne), o(Je, Object.freeze({ __proto__: null, Dexie: Je, liveQuery: ti, Entity: kr, cmp: ae, PropModification: Vt, replacePrefix: function(e, t) {
4583
+ }, Oe(Ce), o(Je, Object.freeze({ __proto__: null, Dexie: Je, liveQuery: ti, Entity: kr, cmp: ae, PropModification: Vt, replacePrefix: function(e, t) {
4584
4584
  return new Vt({ replacePrefix: [e, t] });
4585
4585
  }, add: function(e) {
4586
4586
  return new Vt({ add: e });
@@ -4590,22 +4590,22 @@ function Zo() {
4590
4590
  });
4591
4591
  })(Dn)), Dn.exports;
4592
4592
  }
4593
- var Jo = Zo();
4594
- const _r = /* @__PURE__ */ Mi(Jo), ui = /* @__PURE__ */ Symbol.for("Dexie"), dt = globalThis[ui] || (globalThis[ui] = _r);
4593
+ var Qo = zo();
4594
+ const _r = /* @__PURE__ */ ji(Qo), ui = /* @__PURE__ */ Symbol.for("Dexie"), dt = globalThis[ui] || (globalThis[ui] = _r);
4595
4595
  if (_r.semVer !== dt.semVer)
4596
4596
  throw new Error(`Two different versions of Dexie loaded in the same app: ${_r.semVer} and ${dt.semVer}`);
4597
4597
  const {
4598
- liveQuery: Ua,
4599
- mergeRanges: Va,
4600
- rangesOverlap: $a,
4601
- RangeSet: Ga,
4602
- cmp: Ya,
4603
- Entity: Wa,
4604
- PropModification: Xa,
4605
- replacePrefix: Ha,
4606
- add: za,
4607
- remove: Qa,
4608
- DexieYProvider: Za
4598
+ liveQuery: qa,
4599
+ mergeRanges: La,
4600
+ rangesOverlap: Ua,
4601
+ RangeSet: Va,
4602
+ cmp: $a,
4603
+ Entity: Ga,
4604
+ PropModification: Ya,
4605
+ replacePrefix: Wa,
4606
+ add: Xa,
4607
+ remove: Ha,
4608
+ DexieYProvider: za
4609
4609
  } = dt;
4610
4610
  function Et(m) {
4611
4611
  const s = [m.autoIncrement ? `++${m.primaryKey}` : m.primaryKey];
@@ -4617,15 +4617,15 @@ function Et(m) {
4617
4617
  s.push(`*${o}`);
4618
4618
  return s.join(", ");
4619
4619
  }
4620
- const ea = {
4620
+ const Zo = {
4621
4621
  primaryKey: "id",
4622
4622
  indexes: ["tagName"],
4623
4623
  compoundIndexes: [],
4624
4624
  arrayIndexes: []
4625
4625
  };
4626
- class ta {
4626
+ class Jo {
4627
4627
  constructor(r, s) {
4628
- this.schemaVersion = 1, this.knownDocuments = /* @__PURE__ */ new Map(), this.schemaLock = Promise.resolve(), this.name = r, this.dexieRecordSchema = Et(s?.recordSchema ?? ea), this.db = new dt(r);
4628
+ this.schemaVersion = 1, this.knownDocuments = /* @__PURE__ */ new Map(), this.schemaLock = Promise.resolve(), this.name = r, this.dexieRecordSchema = Et(s?.recordSchema ?? Zo), this.db = new dt(r);
4629
4629
  }
4630
4630
  // --- Lifecycle ---
4631
4631
  async open() {
@@ -4701,20 +4701,20 @@ class ta {
4701
4701
  if (!I) continue;
4702
4702
  const q = { ...D };
4703
4703
  if (D.attributes) {
4704
- const M = [...I.attributes];
4704
+ const j = [...I.attributes];
4705
4705
  for (const X of D.attributes) {
4706
- const ie = M.findIndex((j) => j.name === X.name);
4707
- ie >= 0 ? M[ie] = X : M.push(X);
4706
+ const oe = j.findIndex((M) => M.name === X.name);
4707
+ oe >= 0 ? j[oe] = X : j.push(X);
4708
4708
  }
4709
- q.attributes = M;
4709
+ q.attributes = j;
4710
4710
  }
4711
4711
  if (D.children) {
4712
- const M = [...I.children];
4712
+ const j = [...I.children];
4713
4713
  for (const X of D.children) {
4714
- const ie = M.findIndex((j) => j.id === X.id);
4715
- ie >= 0 ? M[ie] = X : M.push(X);
4714
+ const oe = j.findIndex((M) => M.id === X.id);
4715
+ oe >= 0 ? j[oe] = X : j.push(X);
4716
4716
  }
4717
- q.children = M;
4717
+ q.children = j;
4718
4718
  }
4719
4719
  await v.update(g, q);
4720
4720
  }
@@ -4731,7 +4731,7 @@ class ta {
4731
4731
  this.db.table(Xe),
4732
4732
  this.db.table(He),
4733
4733
  async () => {
4734
- const q = d.length > 0 ? await g.bulkGet(d.map((H) => H.id)) : [], M = f.length > 0 ? await g.bulkGet(f) : [];
4734
+ const q = d.length > 0 ? await g.bulkGet(d.map((H) => H.id)) : [], j = f.length > 0 ? await g.bulkGet(f) : [];
4735
4735
  if (o.length > 0)
4736
4736
  try {
4737
4737
  await g.bulkAdd(o), I += o.length, v(I, D);
@@ -4759,22 +4759,22 @@ class ta {
4759
4759
  cause: H instanceof Error ? H : void 0
4760
4760
  });
4761
4761
  }
4762
- const X = await this.getHead(s), ie = await this.db.table(Xe).where({ documentId: s }).filter((H) => H.sequenceNumber > X).toArray();
4763
- ie.length > 0 && await this.db.table(Xe).bulkDelete(ie.map((H) => H.id));
4764
- const j = X + 1, B = {
4762
+ const X = await this.getHead(s), oe = await this.db.table(Xe).where({ documentId: s }).filter((H) => H.sequenceNumber > X).toArray();
4763
+ oe.length > 0 && await this.db.table(Xe).bulkDelete(oe.map((H) => H.id));
4764
+ const M = X + 1, B = {
4765
4765
  documentId: s,
4766
- sequenceNumber: j,
4766
+ sequenceNumber: M,
4767
4767
  timestamp: Date.now(),
4768
4768
  operations: {
4769
4769
  creates: o,
4770
- updates: d.map((H, oe) => ({
4771
- before: q[oe],
4770
+ updates: d.map((H, ie) => ({
4771
+ before: q[ie],
4772
4772
  after: H
4773
4773
  })),
4774
- deletes: M.filter(Boolean)
4774
+ deletes: j.filter(Boolean)
4775
4775
  }
4776
4776
  };
4777
- await this.db.table(Xe).add(B), await this.setHead(s, j);
4777
+ await this.db.table(Xe).add(B), await this.setHead(s, M);
4778
4778
  }
4779
4779
  );
4780
4780
  } catch (q) {
@@ -4847,21 +4847,21 @@ class ta {
4847
4847
  * Resolve the Dexie table name for a documentId.
4848
4848
  */
4849
4849
  resolveTableName(r) {
4850
- return Xo(r);
4850
+ return Yo(r);
4851
4851
  }
4852
4852
  }
4853
4853
  function li() {
4854
4854
  return new Promise((m) => setTimeout(m, 0));
4855
4855
  }
4856
- function na(m, r, s) {
4856
+ function ea(m, r, s) {
4857
4857
  if (r.type === "local") {
4858
4858
  const o = { recordSchema: s.database.recordSchema };
4859
- return new ta(m, o);
4859
+ return new Jo(m, o);
4860
4860
  }
4861
4861
  return r.store;
4862
4862
  }
4863
4863
  var Qt = { exports: {} }, An = { exports: {} }, fi;
4864
- function ra() {
4864
+ function ta() {
4865
4865
  return fi || (fi = 1, (function(m, r) {
4866
4866
  Object.defineProperty(r, "__esModule", { value: !0 }), r.ParsingError = void 0;
4867
4867
  class s extends Error {
@@ -4872,10 +4872,10 @@ function ra() {
4872
4872
  r.ParsingError = s;
4873
4873
  let o;
4874
4874
  function d() {
4875
- return D(!1) || X() || M() || q() || g();
4875
+ return D(!1) || X() || j() || q() || g();
4876
4876
  }
4877
4877
  function f() {
4878
- return B(/\s*/), D(!0) || M() || I() || g();
4878
+ return B(/\s*/), D(!0) || j() || I() || g();
4879
4879
  }
4880
4880
  function v() {
4881
4881
  const ne = g(), Z = [];
@@ -4926,8 +4926,8 @@ function ra() {
4926
4926
  attributes: {},
4927
4927
  children: []
4928
4928
  }, he = ne ? !1 : o.options.filter(J) === !1;
4929
- for (; !(H() || oe(">") || oe("?>") || oe("/>")); ) {
4930
- const ve = ie();
4929
+ for (; !(H() || ie(">") || ie("?>") || ie("/>")); ) {
4930
+ const ve = oe();
4931
4931
  if (ve)
4932
4932
  J.attributes[ve.name] = ve.value;
4933
4933
  else
@@ -4983,7 +4983,7 @@ function ra() {
4983
4983
  }
4984
4984
  }
4985
4985
  }
4986
- function M() {
4986
+ function j() {
4987
4987
  const ne = B(/^<!--[\s\S]*?-->/);
4988
4988
  if (ne) {
4989
4989
  const Z = {
@@ -5009,15 +5009,15 @@ function ra() {
5009
5009
  };
5010
5010
  }
5011
5011
  }
5012
- function ie() {
5012
+ function oe() {
5013
5013
  const ne = B(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);
5014
5014
  if (ne)
5015
5015
  return {
5016
5016
  name: ne[1].trim(),
5017
- value: j(ne[2].trim())
5017
+ value: M(ne[2].trim())
5018
5018
  };
5019
5019
  }
5020
- function j(ne) {
5020
+ function M(ne) {
5021
5021
  return ne.replace(/^['"]|['"]$/g, "");
5022
5022
  }
5023
5023
  function B(ne) {
@@ -5028,7 +5028,7 @@ function ra() {
5028
5028
  function H() {
5029
5029
  return o.xml.length === 0;
5030
5030
  }
5031
- function oe(ne) {
5031
+ function ie(ne) {
5032
5032
  return o.xml.indexOf(ne) === 0;
5033
5033
  }
5034
5034
  function ye(ne, Z = {}) {
@@ -5043,114 +5043,114 @@ function ra() {
5043
5043
  })(An, An.exports)), An.exports;
5044
5044
  }
5045
5045
  var di = Qt.exports, hi;
5046
- function ia() {
5046
+ function na() {
5047
5047
  return hi || (hi = 1, (function(m, r) {
5048
- var s = di && di.__importDefault || function(j) {
5049
- return j && j.__esModule ? j : { default: j };
5048
+ var s = di && di.__importDefault || function(M) {
5049
+ return M && M.__esModule ? M : { default: M };
5050
5050
  };
5051
5051
  Object.defineProperty(r, "__esModule", { value: !0 });
5052
- const o = s(/* @__PURE__ */ ra());
5053
- function d(j) {
5054
- if (!j.options.indentation && !j.options.lineSeparator)
5052
+ const o = s(/* @__PURE__ */ ta());
5053
+ function d(M) {
5054
+ if (!M.options.indentation && !M.options.lineSeparator)
5055
5055
  return;
5056
- j.content += j.options.lineSeparator;
5056
+ M.content += M.options.lineSeparator;
5057
5057
  let B;
5058
- for (B = 0; B < j.level; B++)
5059
- j.content += j.options.indentation;
5058
+ for (B = 0; B < M.level; B++)
5059
+ M.content += M.options.indentation;
5060
5060
  }
5061
- function f(j) {
5062
- j.content = j.content.replace(/ +$/, "");
5061
+ function f(M) {
5062
+ M.content = M.content.replace(/ +$/, "");
5063
5063
  let B;
5064
- for (B = 0; B < j.level; B++)
5065
- j.content += j.options.indentation;
5064
+ for (B = 0; B < M.level; B++)
5065
+ M.content += M.options.indentation;
5066
5066
  }
5067
- function v(j, B) {
5068
- j.content += B;
5067
+ function v(M, B) {
5068
+ M.content += B;
5069
5069
  }
5070
- function g(j, B, H) {
5071
- if (j.type === "Element")
5072
- q(j, B, H);
5073
- else if (j.type === "ProcessingInstruction")
5074
- X(j, B);
5075
- else if (typeof j.content == "string")
5076
- D(j.content, B, H);
5070
+ function g(M, B, H) {
5071
+ if (M.type === "Element")
5072
+ q(M, B, H);
5073
+ else if (M.type === "ProcessingInstruction")
5074
+ X(M, B);
5075
+ else if (typeof M.content == "string")
5076
+ D(M.content, B, H);
5077
5077
  else
5078
- throw new Error("Unknown node type: " + j.type);
5078
+ throw new Error("Unknown node type: " + M.type);
5079
5079
  }
5080
- function D(j, B, H) {
5080
+ function D(M, B, H) {
5081
5081
  if (!H) {
5082
- const oe = j.trim();
5083
- (B.options.lineSeparator || oe.length === 0) && (j = oe);
5082
+ const ie = M.trim();
5083
+ (B.options.lineSeparator || ie.length === 0) && (M = ie);
5084
5084
  }
5085
- j.length > 0 && (!H && B.content.length > 0 && d(B), v(B, j));
5085
+ M.length > 0 && (!H && B.content.length > 0 && d(B), v(B, M));
5086
5086
  }
5087
- function I(j, B) {
5088
- const H = "/" + j.join("/"), oe = j[j.length - 1];
5089
- return B.includes(oe) || B.includes(H);
5087
+ function I(M, B) {
5088
+ const H = "/" + M.join("/"), ie = M[M.length - 1];
5089
+ return B.includes(ie) || B.includes(H);
5090
5090
  }
5091
- function q(j, B, H) {
5092
- if (B.path.push(j.name), !H && B.content.length > 0 && d(B), v(B, "<" + j.name), M(B, j.attributes), j.children === null || B.options.forceSelfClosingEmptyTag && j.children.length === 0) {
5093
- const oe = B.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
5094
- v(B, oe);
5095
- } else if (j.children.length === 0)
5096
- v(B, "></" + j.name + ">");
5091
+ function q(M, B, H) {
5092
+ if (B.path.push(M.name), !H && B.content.length > 0 && d(B), v(B, "<" + M.name), j(B, M.attributes), M.children === null || B.options.forceSelfClosingEmptyTag && M.children.length === 0) {
5093
+ const ie = B.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
5094
+ v(B, ie);
5095
+ } else if (M.children.length === 0)
5096
+ v(B, "></" + M.name + ">");
5097
5097
  else {
5098
- const oe = j.children;
5098
+ const ie = M.children;
5099
5099
  v(B, ">"), B.level++;
5100
- let ye = j.attributes["xml:space"] === "preserve" || H, ne = !1;
5100
+ let ye = M.attributes["xml:space"] === "preserve" || H, ne = !1;
5101
5101
  if (!ye && B.options.ignoredPaths && (ne = I(B.path, B.options.ignoredPaths), ye = ne), !ye && B.options.collapseContent) {
5102
5102
  let Z = !1, J = !1, he = !1;
5103
- oe.forEach(function(de, ve) {
5103
+ ie.forEach(function(de, ve) {
5104
5104
  de.type === "Text" ? (de.content.includes(`
5105
- `) ? (J = !0, de.content = de.content.trim()) : (ve === 0 || ve === oe.length - 1) && !H && de.content.trim().length === 0 && (de.content = ""), (de.content.trim().length > 0 || oe.length === 1) && (Z = !0)) : de.type === "CDATA" ? Z = !0 : he = !0;
5105
+ `) ? (J = !0, de.content = de.content.trim()) : (ve === 0 || ve === ie.length - 1) && !H && de.content.trim().length === 0 && (de.content = ""), (de.content.trim().length > 0 || ie.length === 1) && (Z = !0)) : de.type === "CDATA" ? Z = !0 : he = !0;
5106
5106
  }), Z && (!he || !J) && (ye = !0);
5107
5107
  }
5108
- oe.forEach(function(Z) {
5108
+ ie.forEach(function(Z) {
5109
5109
  g(Z, B, H || ye);
5110
- }), B.level--, !H && !ye && d(B), ne && f(B), v(B, "</" + j.name + ">");
5110
+ }), B.level--, !H && !ye && d(B), ne && f(B), v(B, "</" + M.name + ">");
5111
5111
  }
5112
5112
  B.path.pop();
5113
5113
  }
5114
- function M(j, B) {
5114
+ function j(M, B) {
5115
5115
  Object.keys(B).forEach(function(H) {
5116
- if (j.options.attributeQuotes === "single") {
5117
- const oe = B[H].replace(/'/g, "&apos;");
5118
- v(j, " " + H + "='" + oe + "'");
5116
+ if (M.options.attributeQuotes === "single") {
5117
+ const ie = B[H].replace(/'/g, "&apos;");
5118
+ v(M, " " + H + "='" + ie + "'");
5119
5119
  } else {
5120
- const oe = B[H].replace(/"/g, "&quot;");
5121
- v(j, " " + H + '="' + oe + '"');
5120
+ const ie = B[H].replace(/"/g, "&quot;");
5121
+ v(M, " " + H + '="' + ie + '"');
5122
5122
  }
5123
5123
  });
5124
5124
  }
5125
- function X(j, B) {
5126
- B.content.length > 0 && d(B), v(B, "<?" + j.name), v(B, " " + j.content.trim()), v(B, "?>");
5125
+ function X(M, B) {
5126
+ B.content.length > 0 && d(B), v(B, "<?" + M.name), v(B, " " + M.content.trim()), v(B, "?>");
5127
5127
  }
5128
- function ie(j, B = {}) {
5128
+ function oe(M, B = {}) {
5129
5129
  B.indentation = "indentation" in B ? B.indentation : " ", B.collapseContent = B.collapseContent === !0, B.lineSeparator = "lineSeparator" in B ? B.lineSeparator : `\r
5130
5130
  `, B.whiteSpaceAtEndOfSelfclosingTag = B.whiteSpaceAtEndOfSelfclosingTag === !0, B.throwOnFailure = B.throwOnFailure !== !1, B.attributeQuotes = "attributeQuotes" in B ? B.attributeQuotes : "double";
5131
5131
  try {
5132
- const H = (0, o.default)(j, { filter: B.filter, strictMode: B.strictMode }), oe = { content: "", level: 0, options: B, path: [] };
5133
- return H.declaration && X(H.declaration, oe), H.children.forEach(function(ye) {
5134
- g(ye, oe, !1);
5135
- }), B.lineSeparator ? oe.content.replace(/\r\n/g, `
5136
- `).replace(/\n/g, B.lineSeparator) : oe.content;
5132
+ const H = (0, o.default)(M, { filter: B.filter, strictMode: B.strictMode }), ie = { content: "", level: 0, options: B, path: [] };
5133
+ return H.declaration && X(H.declaration, ie), H.children.forEach(function(ye) {
5134
+ g(ye, ie, !1);
5135
+ }), B.lineSeparator ? ie.content.replace(/\r\n/g, `
5136
+ `).replace(/\n/g, B.lineSeparator) : ie.content;
5137
5137
  } catch (H) {
5138
5138
  if (B.throwOnFailure)
5139
5139
  throw H;
5140
- return j;
5140
+ return M;
5141
5141
  }
5142
5142
  }
5143
- ie.minify = (j, B = {}) => ie(j, Object.assign(Object.assign({}, B), { indentation: "", lineSeparator: "" })), m.exports = ie, r.default = ie;
5143
+ oe.minify = (M, B = {}) => oe(M, Object.assign(Object.assign({}, B), { indentation: "", lineSeparator: "" })), m.exports = oe, r.default = oe;
5144
5144
  })(Qt, Qt.exports)), Qt.exports;
5145
5145
  }
5146
- var oa = /* @__PURE__ */ ia();
5147
- const Ja = /* @__PURE__ */ Mi(oa), ji = "_temp-idb-id";
5148
- function aa(m) {
5146
+ var ra = /* @__PURE__ */ na();
5147
+ const Qa = /* @__PURE__ */ ji(ra), Mi = "_temp-idb-id";
5148
+ function ia(m) {
5149
5149
  const { records: r, config: s, withDatabaseIds: o = !1 } = m, d = /* @__PURE__ */ new Map();
5150
5150
  let f;
5151
5151
  for (const I of r)
5152
5152
  d.set(I.id, I), I.tagName === s.rootElementName && (f = I);
5153
- Oe(f, {
5153
+ we(f, {
5154
5154
  detail: `No ${s.rootElementName} root element found in records`,
5155
5155
  key: "EXPORT_ROOT_NOT_FOUND"
5156
5156
  });
@@ -5162,7 +5162,7 @@ function aa(m) {
5162
5162
  attributes: f.attributes,
5163
5163
  tagName: f.tagName,
5164
5164
  isRoot: !0
5165
- }), Ui({ config: s, rootElement: D, namespace: f.namespace }), f.value && (D.textContent = f.value.trim()), o && D.setAttribute(ji, f.id), g.appendChild(D), Ki({
5165
+ }), Ui({ config: s, rootElement: D, namespace: f.namespace }), f.value && (D.textContent = f.value.trim()), o && D.setAttribute(Mi, f.id), g.appendChild(D), Ki({
5166
5166
  index: d,
5167
5167
  config: s,
5168
5168
  withDatabaseIds: o,
@@ -5177,19 +5177,19 @@ function Ki(m) {
5177
5177
  const g = [];
5178
5178
  for (const I of f.children) {
5179
5179
  const q = r.get(I.id);
5180
- Oe(q, {
5180
+ we(q, {
5181
5181
  detail: `Parent '${f.tagName}' references non-existent child '${I.tagName}' (id: ${I.id})`,
5182
5182
  key: "EXPORT_ORPHAN_CHILD_REF",
5183
5183
  ref: { tagName: f.tagName, id: f.id }
5184
5184
  }), g.push(q);
5185
5185
  }
5186
- const D = ca({
5186
+ const D = aa({
5187
5187
  parentTagName: f.tagName,
5188
5188
  availableChildren: s.children,
5189
5189
  childrenRecords: g
5190
5190
  });
5191
5191
  for (const I of D) {
5192
- const q = sa({
5192
+ const q = oa({
5193
5193
  config: s,
5194
5194
  document: d,
5195
5195
  record: I,
@@ -5206,7 +5206,7 @@ function Ki(m) {
5206
5206
  });
5207
5207
  }
5208
5208
  }
5209
- function sa(m) {
5209
+ function oa(m) {
5210
5210
  const { config: r, document: s, record: o, defaultNamespace: d, withDatabaseIds: f } = m, v = o.namespace.uri === d.uri;
5211
5211
  let g;
5212
5212
  return !v && o.namespace.prefix && o.namespace.prefix !== "xmlns" ? (Li({ config: r, document: s, namespace: o.namespace }), g = s.createElementNS(
@@ -5219,12 +5219,12 @@ function sa(m) {
5219
5219
  attributes: o.attributes,
5220
5220
  tagName: o.tagName,
5221
5221
  isRoot: !1
5222
- }), o.value && (g.textContent = o.value.trim()), f && g.setAttribute(ji, o.id), g;
5222
+ }), o.value && (g.textContent = o.value.trim()), f && g.setAttribute(Mi, o.id), g;
5223
5223
  }
5224
5224
  function qi(m) {
5225
5225
  const { config: r, document: s, element: o, attributes: d, tagName: f, isRoot: v } = m;
5226
5226
  for (const g of d) {
5227
- if (ua(g) || !v && la({ config: r, tagName: f, attribute: g })) continue;
5227
+ if (sa(g) || !v && ca({ config: r, tagName: f, attribute: g })) continue;
5228
5228
  if (!$i(g) || !g.namespace.prefix) {
5229
5229
  o.setAttribute(g.name, String(g.value));
5230
5230
  continue;
@@ -5259,7 +5259,7 @@ function Ui(m) {
5259
5259
  s.setAttribute(D, g.default || "");
5260
5260
  }
5261
5261
  }
5262
- function ca(m) {
5262
+ function aa(m) {
5263
5263
  const { parentTagName: r, availableChildren: s, childrenRecords: o } = m, d = new Set(s[r]);
5264
5264
  if (!d.size) return o;
5265
5265
  const f = /* @__PURE__ */ new Map(), v = [];
@@ -5281,10 +5281,10 @@ function Vi(m) {
5281
5281
  function $i(m) {
5282
5282
  return m !== null && typeof m == "object" && "namespace" in m && !!m.namespace;
5283
5283
  }
5284
- function ua(m) {
5284
+ function sa(m) {
5285
5285
  return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") || $i(m) && m.namespace?.prefix === "xmlns");
5286
5286
  }
5287
- function la(m) {
5287
+ function ca(m) {
5288
5288
  const { config: r, tagName: s, attribute: o } = m;
5289
5289
  if (!r.elements.includes(s)) return !1;
5290
5290
  const d = r.definition[s];
@@ -5292,7 +5292,7 @@ function la(m) {
5292
5292
  const f = d.attributes.details[o.name];
5293
5293
  return !(!f || f.required || f.default === void 0 || String(o.value) !== f.default || d.attributes.identityFields?.includes(o.name));
5294
5294
  }
5295
- class fa {
5295
+ class ua {
5296
5296
  constructor() {
5297
5297
  this.pendingChildren = /* @__PURE__ */ new Map();
5298
5298
  }
@@ -5320,21 +5320,21 @@ class fa {
5320
5320
  return this.pendingChildren.size;
5321
5321
  }
5322
5322
  }
5323
- function da(m) {
5323
+ function la(m) {
5324
5324
  return "prefix" in m && "uri" in m && !!m.prefix && !!m.uri;
5325
5325
  }
5326
5326
  var yr = {};
5327
- const ha = {}, ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5327
+ const fa = {}, da = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5328
5328
  __proto__: null,
5329
- default: ha
5330
- }, Symbol.toStringTag, { value: "Module" })), pa = /* @__PURE__ */ zo(ma);
5329
+ default: fa
5330
+ }, Symbol.toStringTag, { value: "Module" })), ha = /* @__PURE__ */ Xo(da);
5331
5331
  var mi;
5332
- function ga() {
5332
+ function ma() {
5333
5333
  return mi || (mi = 1, (function(m) {
5334
5334
  (function(r) {
5335
5335
  r.parser = function(l, c) {
5336
5336
  return new o(l, c);
5337
- }, r.SAXParser = o, r.SAXStream = M, r.createStream = I, r.MAX_BUFFER_LENGTH = 64 * 1024;
5337
+ }, r.SAXParser = o, r.SAXStream = j, r.createStream = I, r.MAX_BUFFER_LENGTH = 64 * 1024;
5338
5338
  var s = [
5339
5339
  "comment",
5340
5340
  "sgmlDecl",
@@ -5395,25 +5395,25 @@ function ga() {
5395
5395
  Ke(l);
5396
5396
  break;
5397
5397
  case "cdata":
5398
- we(l, "oncdata", l.cdata), l.cdata = "";
5398
+ _e(l, "oncdata", l.cdata), l.cdata = "";
5399
5399
  break;
5400
5400
  case "script":
5401
- we(l, "onscript", l.script), l.script = "";
5401
+ _e(l, "onscript", l.script), l.script = "";
5402
5402
  break;
5403
5403
  default:
5404
5404
  ke(l, "Max buffer length exceeded: " + s[E]);
5405
5405
  }
5406
5406
  R = Math.max(R, be);
5407
5407
  }
5408
- var Ee = r.MAX_BUFFER_LENGTH - R;
5409
- l.bufferCheckPosition = Ee + l.position;
5408
+ var xe = r.MAX_BUFFER_LENGTH - R;
5409
+ l.bufferCheckPosition = xe + l.position;
5410
5410
  }
5411
5411
  function f(l) {
5412
5412
  for (var c = 0, R = s.length; c < R; c++)
5413
5413
  l[s[c]] = "";
5414
5414
  }
5415
5415
  function v(l) {
5416
- Ke(l), l.cdata !== "" && (we(l, "oncdata", l.cdata), l.cdata = ""), l.script !== "" && (we(l, "onscript", l.script), l.script = "");
5416
+ Ke(l), l.cdata !== "" && (_e(l, "oncdata", l.cdata), l.cdata = ""), l.script !== "" && (_e(l, "onscript", l.script), l.script = "");
5417
5417
  }
5418
5418
  o.prototype = {
5419
5419
  end: function() {
@@ -5432,7 +5432,7 @@ function ga() {
5432
5432
  };
5433
5433
  var g;
5434
5434
  try {
5435
- g = pa.Stream;
5435
+ g = ha.Stream;
5436
5436
  } catch {
5437
5437
  g = function() {
5438
5438
  };
@@ -5443,7 +5443,7 @@ function ga() {
5443
5443
  return l !== "error" && l !== "end";
5444
5444
  });
5445
5445
  function I(l, c) {
5446
- return new M(l, c);
5446
+ return new j(l, c);
5447
5447
  }
5448
5448
  function q(l, c) {
5449
5449
  if (l.length >= 2) {
@@ -5454,9 +5454,9 @@ function ga() {
5454
5454
  }
5455
5455
  return l.length >= 3 && l[0] === 239 && l[1] === 187 && l[2] === 191 ? "utf8" : l.length >= 4 ? l[0] === 60 && l[1] === 0 && l[2] === 63 && l[3] === 0 ? "utf-16le" : l[0] === 0 && l[1] === 60 && l[2] === 0 && l[3] === 63 ? "utf-16be" : "utf8" : c ? "utf8" : null;
5456
5456
  }
5457
- function M(l, c) {
5458
- if (!(this instanceof M))
5459
- return new M(l, c);
5457
+ function j(l, c) {
5458
+ if (!(this instanceof j))
5459
+ return new j(l, c);
5460
5460
  g.apply(this), this._parser = new o(l, c), this.writable = !0, this.readable = !0;
5461
5461
  var R = this;
5462
5462
  this._parser.onend = function() {
@@ -5478,11 +5478,11 @@ function ga() {
5478
5478
  });
5479
5479
  });
5480
5480
  }
5481
- M.prototype = Object.create(g.prototype, {
5481
+ j.prototype = Object.create(g.prototype, {
5482
5482
  constructor: {
5483
- value: M
5483
+ value: j
5484
5484
  }
5485
- }), M.prototype._decodeBuffer = function(l, c) {
5485
+ }), j.prototype._decodeBuffer = function(l, c) {
5486
5486
  if (this._decoderBuffer && (l = Buffer.concat([this._decoderBuffer, l]), this._decoderBuffer = null), !this._decoder) {
5487
5487
  var R = q(l, c);
5488
5488
  if (!R)
@@ -5490,7 +5490,7 @@ function ga() {
5490
5490
  this._parser.encoding = R, this._decoder = new TextDecoder(R);
5491
5491
  }
5492
5492
  return this._decoder.decode(l, { stream: !c });
5493
- }, M.prototype.write = function(l) {
5493
+ }, j.prototype.write = function(l) {
5494
5494
  if (typeof Buffer == "function" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(l))
5495
5495
  l = this._decodeBuffer(l, !1);
5496
5496
  else if (this._decoderBuffer) {
@@ -5498,7 +5498,7 @@ function ga() {
5498
5498
  c && (this._parser.write(c), this.emit("data", c));
5499
5499
  }
5500
5500
  return this._parser.write(l.toString()), this.emit("data", l), !0;
5501
- }, M.prototype.end = function(l) {
5501
+ }, j.prototype.end = function(l) {
5502
5502
  if (l && l.length && this.write(l), this._decoderBuffer) {
5503
5503
  var c = this._decodeBuffer(Buffer.alloc(0), !0);
5504
5504
  c && (this._parser.write(c), this.emit("data", c));
@@ -5507,14 +5507,14 @@ function ga() {
5507
5507
  R && (this._parser.write(R), this.emit("data", R));
5508
5508
  }
5509
5509
  return this._parser.end(), !0;
5510
- }, M.prototype.on = function(l, c) {
5510
+ }, j.prototype.on = function(l, c) {
5511
5511
  var R = this;
5512
5512
  return !R._parser["on" + l] && D.indexOf(l) !== -1 && (R._parser["on" + l] = function() {
5513
5513
  var E = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
5514
5514
  E.splice(0, 0, l), R.emit.apply(R, E);
5515
5515
  }), g.prototype.on.call(R, l, c);
5516
5516
  };
5517
- var X = "[CDATA[", ie = "DOCTYPE", j = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", H = { xml: j, xmlns: B }, oe = /[:_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]/, ye = /[:_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-]/, ne = /[#:_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]/, Z = /[#:_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-]/;
5517
+ var X = "[CDATA[", oe = "DOCTYPE", M = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", H = { xml: M, xmlns: B }, ie = /[:_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]/, ye = /[:_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-]/, ne = /[#:_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]/, Z = /[#:_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-]/;
5518
5518
  function J(l) {
5519
5519
  return l === " " || l === `
5520
5520
  ` || l === "\r" || l === " ";
@@ -5882,20 +5882,20 @@ function ga() {
5882
5882
  function Jt(l) {
5883
5883
  return l ? l.toLowerCase().replace(/[^a-z0-9]/g, "") : null;
5884
5884
  }
5885
- function Mt(l, c) {
5885
+ function jt(l, c) {
5886
5886
  const R = Jt(l), E = Jt(c);
5887
5887
  return !R || !E ? !0 : E === "utf16" ? R === "utf16le" || R === "utf16be" : R === E;
5888
5888
  }
5889
- function jt(l, c) {
5889
+ function Mt(l, c) {
5890
5890
  if (!(!l.strict || !l.encoding || !c || c.name !== "xml")) {
5891
5891
  var R = ze(c.body);
5892
- R && !Mt(l.encoding, R) && fe(
5892
+ R && !jt(l.encoding, R) && fe(
5893
5893
  l,
5894
5894
  "XML declaration encoding " + R + " does not match detected stream encoding " + l.encoding.toUpperCase()
5895
5895
  );
5896
5896
  }
5897
5897
  }
5898
- function we(l, c, R) {
5898
+ function _e(l, c, R) {
5899
5899
  l.textNode && Ke(l), Ue(l, c, R);
5900
5900
  }
5901
5901
  function Ke(l) {
@@ -5921,7 +5921,7 @@ Char: ` + l.c), c = new Error(c), l.error = c, Ue(l, "onerror", c), l;
5921
5921
  function tt(l) {
5922
5922
  l.strict || (l.tagName = l.tagName[l.looseCase]());
5923
5923
  var c = l.tags[l.tags.length - 1] || l, R = l.tag = { name: l.tagName, attributes: {} };
5924
- l.opt.xmlns && (R.ns = c.ns), l.attribList.length = 0, we(l, "onopentagstart", R);
5924
+ l.opt.xmlns && (R.ns = c.ns), l.attribList.length = 0, _e(l, "onopentagstart", R);
5925
5925
  }
5926
5926
  function Nt(l, c) {
5927
5927
  var R = l.indexOf(":"), E = R < 0 ? ["", l] : l.split(":"), le = E[0], be = E[1];
@@ -5935,10 +5935,10 @@ Char: ` + l.c), c = new Error(c), l.error = c, Ue(l, "onerror", c), l;
5935
5935
  if (l.opt.xmlns) {
5936
5936
  var c = Nt(l.attribName, !0), R = c.prefix, E = c.local;
5937
5937
  if (R === "xmlns")
5938
- if (E === "xml" && l.attribValue !== j)
5938
+ if (E === "xml" && l.attribValue !== M)
5939
5939
  fe(
5940
5940
  l,
5941
- "xml: prefix must be bound to " + j + `
5941
+ "xml: prefix must be bound to " + M + `
5942
5942
  Actual: ` + l.attribValue
5943
5943
  );
5944
5944
  else if (E === "xmlns" && l.attribValue !== B)
@@ -5953,13 +5953,13 @@ Actual: ` + l.attribValue
5953
5953
  }
5954
5954
  l.attribList.push([l.attribName, l.attribValue]);
5955
5955
  } else
5956
- l.tag.attributes[l.attribName] = l.attribValue, we(l, "onattribute", {
5956
+ l.tag.attributes[l.attribName] = l.attribValue, _e(l, "onattribute", {
5957
5957
  name: l.attribName,
5958
5958
  value: l.attribValue
5959
5959
  });
5960
5960
  l.attribName = l.attribValue = "";
5961
5961
  }
5962
- function je(l, c) {
5962
+ function Me(l, c) {
5963
5963
  if (l.opt.xmlns) {
5964
5964
  var R = l.tag, E = Nt(l.tagName);
5965
5965
  R.prefix = E.prefix, R.local = E.local, R.uri = R.ns[E.prefix] || "", R.prefix && !R.uri && (fe(
@@ -5968,15 +5968,15 @@ Actual: ` + l.attribValue
5968
5968
  ), R.uri = E.prefix);
5969
5969
  var le = l.tags[l.tags.length - 1] || l;
5970
5970
  R.ns && le.ns !== R.ns && Object.keys(R.ns).forEach(function(Ge) {
5971
- we(l, "onopennamespace", {
5971
+ _e(l, "onopennamespace", {
5972
5972
  prefix: Ge,
5973
5973
  uri: R.ns[Ge]
5974
5974
  });
5975
5975
  });
5976
- for (var be = 0, Ee = l.attribList.length; be < Ee; be++) {
5977
- var Re = l.attribList[be], Ae = Re[0], Ne = Re[1], Ce = Nt(Ae, !0), Be = Ce.prefix, en = Ce.local, rt = Be === "" ? "" : R.ns[Be] || "", Ve = {
5976
+ for (var be = 0, xe = l.attribList.length; be < xe; be++) {
5977
+ var Re = l.attribList[be], Ae = Re[0], Ce = Re[1], Oe = Nt(Ae, !0), Be = Oe.prefix, en = Oe.local, rt = Be === "" ? "" : R.ns[Be] || "", Ve = {
5978
5978
  name: Ae,
5979
- value: Ne,
5979
+ value: Ce,
5980
5980
  prefix: Be,
5981
5981
  local: en,
5982
5982
  uri: rt
@@ -5984,11 +5984,11 @@ Actual: ` + l.attribValue
5984
5984
  Be && Be !== "xmlns" && !rt && (fe(
5985
5985
  l,
5986
5986
  "Unbound namespace prefix: " + JSON.stringify(Be)
5987
- ), Ve.uri = Be), l.tag.attributes[Ae] = Ve, we(l, "onattribute", Ve);
5987
+ ), Ve.uri = Be), l.tag.attributes[Ae] = Ve, _e(l, "onattribute", Ve);
5988
5988
  }
5989
5989
  l.attribList.length = 0;
5990
5990
  }
5991
- l.tag.isSelfClosing = !!c, l.sawRoot = !0, l.tags.push(l.tag), we(l, "onopentag", l.tag), c || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = S.SCRIPT : l.state = S.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
5991
+ l.tag.isSelfClosing = !!c, l.sawRoot = !0, l.tags.push(l.tag), _e(l, "onopentag", l.tag), c || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = S.SCRIPT : l.state = S.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
5992
5992
  }
5993
5993
  function ht(l) {
5994
5994
  if (!l.tagName) {
@@ -6000,7 +6000,7 @@ Actual: ` + l.attribValue
6000
6000
  l.script += "</" + l.tagName + ">", l.tagName = "", l.state = S.SCRIPT;
6001
6001
  return;
6002
6002
  }
6003
- we(l, "onscript", l.script), l.script = "";
6003
+ _e(l, "onscript", l.script), l.script = "";
6004
6004
  }
6005
6005
  var c = l.tags.length, R = l.tagName;
6006
6006
  l.strict || (R = R[l.looseCase]());
@@ -6017,15 +6017,15 @@ Actual: ` + l.attribValue
6017
6017
  }
6018
6018
  l.tagName = R;
6019
6019
  for (var be = l.tags.length; be-- > c; ) {
6020
- var Ee = l.tag = l.tags.pop();
6021
- l.tagName = l.tag.name, we(l, "onclosetag", l.tagName);
6020
+ var xe = l.tag = l.tags.pop();
6021
+ l.tagName = l.tag.name, _e(l, "onclosetag", l.tagName);
6022
6022
  var Re = {};
6023
- for (var Ae in Ee.ns)
6024
- Re[Ae] = Ee.ns[Ae];
6025
- var Ne = l.tags[l.tags.length - 1] || l;
6026
- l.opt.xmlns && Ee.ns !== Ne.ns && Object.keys(Ee.ns).forEach(function(Ce) {
6027
- var Be = Ee.ns[Ce];
6028
- we(l, "onclosenamespace", { prefix: Ce, uri: Be });
6023
+ for (var Ae in xe.ns)
6024
+ Re[Ae] = xe.ns[Ae];
6025
+ var Ce = l.tags[l.tags.length - 1] || l;
6026
+ l.opt.xmlns && xe.ns !== Ce.ns && Object.keys(xe.ns).forEach(function(Oe) {
6027
+ var Be = xe.ns[Oe];
6028
+ _e(l, "onclosenamespace", { prefix: Oe, uri: Be });
6029
6029
  });
6030
6030
  }
6031
6031
  c === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = S.TEXT;
@@ -6082,7 +6082,7 @@ Actual: ` + l.attribValue
6082
6082
  case S.OPEN_WAKA:
6083
6083
  if (E === "!")
6084
6084
  c.state = S.SGML_DECL, c.sgmlDecl = "";
6085
- else if (!J(E)) if (ve(oe, E))
6085
+ else if (!J(E)) if (ve(ie, E))
6086
6086
  c.state = S.OPEN_TAG, c.tagName = E;
6087
6087
  else if (E === "/")
6088
6088
  c.state = S.CLOSE_TAG, c.tagName = "";
@@ -6101,16 +6101,16 @@ Actual: ` + l.attribValue
6101
6101
  c.state = S.COMMENT, c.comment = "", c.sgmlDecl = "";
6102
6102
  continue;
6103
6103
  }
6104
- c.doctype && c.doctype !== !0 && c.sgmlDecl ? (c.state = S.DOCTYPE_DTD, c.doctype += "<!" + c.sgmlDecl + E, c.sgmlDecl = "") : (c.sgmlDecl + E).toUpperCase() === X ? (we(c, "onopencdata"), c.state = S.CDATA, c.sgmlDecl = "", c.cdata = "") : (c.sgmlDecl + E).toUpperCase() === ie ? (c.state = S.DOCTYPE, (c.doctype || c.sawRoot) && fe(
6104
+ c.doctype && c.doctype !== !0 && c.sgmlDecl ? (c.state = S.DOCTYPE_DTD, c.doctype += "<!" + c.sgmlDecl + E, c.sgmlDecl = "") : (c.sgmlDecl + E).toUpperCase() === X ? (_e(c, "onopencdata"), c.state = S.CDATA, c.sgmlDecl = "", c.cdata = "") : (c.sgmlDecl + E).toUpperCase() === oe ? (c.state = S.DOCTYPE, (c.doctype || c.sawRoot) && fe(
6105
6105
  c,
6106
6106
  "Inappropriately located doctype declaration"
6107
- ), c.doctype = "", c.sgmlDecl = "") : E === ">" ? (we(c, "onsgmldeclaration", c.sgmlDecl), c.sgmlDecl = "", c.state = S.TEXT) : (he(E) && (c.state = S.SGML_DECL_QUOTED), c.sgmlDecl += E);
6107
+ ), c.doctype = "", c.sgmlDecl = "") : E === ">" ? (_e(c, "onsgmldeclaration", c.sgmlDecl), c.sgmlDecl = "", c.state = S.TEXT) : (he(E) && (c.state = S.SGML_DECL_QUOTED), c.sgmlDecl += E);
6108
6108
  continue;
6109
6109
  case S.SGML_DECL_QUOTED:
6110
6110
  E === c.q && (c.state = S.SGML_DECL, c.q = ""), c.sgmlDecl += E;
6111
6111
  continue;
6112
6112
  case S.DOCTYPE:
6113
- E === ">" ? (c.state = S.TEXT, we(c, "ondoctype", c.doctype), c.doctype = !0) : (c.doctype += E, E === "[" ? c.state = S.DOCTYPE_DTD : he(E) && (c.state = S.DOCTYPE_QUOTED, c.q = E));
6113
+ E === ">" ? (c.state = S.TEXT, _e(c, "ondoctype", c.doctype), c.doctype = !0) : (c.doctype += E, E === "[" ? c.state = S.DOCTYPE_DTD : he(E) && (c.state = S.DOCTYPE_QUOTED, c.q = E));
6114
6114
  continue;
6115
6115
  case S.DOCTYPE_QUOTED:
6116
6116
  c.doctype += E, E === c.q && (c.q = "", c.state = S.DOCTYPE);
@@ -6125,7 +6125,7 @@ Actual: ` + l.attribValue
6125
6125
  E === "-" ? c.state = S.COMMENT_ENDING : c.comment += E;
6126
6126
  continue;
6127
6127
  case S.COMMENT_ENDING:
6128
- E === "-" ? (c.state = S.COMMENT_ENDED, c.comment = Qe(c.opt, c.comment), c.comment && we(c, "oncomment", c.comment), c.comment = "") : (c.comment += "-" + E, c.state = S.COMMENT);
6128
+ E === "-" ? (c.state = S.COMMENT_ENDED, c.comment = Qe(c.opt, c.comment), c.comment && _e(c, "oncomment", c.comment), c.comment = "") : (c.comment += "-" + E, c.state = S.COMMENT);
6129
6129
  continue;
6130
6130
  case S.COMMENT_ENDED:
6131
6131
  E !== ">" ? (fe(c, "Malformed comment"), c.comment += "--" + E, c.state = S.COMMENT) : c.doctype && c.doctype !== !0 ? c.state = S.DOCTYPE_DTD : c.state = S.TEXT;
@@ -6140,7 +6140,7 @@ Actual: ` + l.attribValue
6140
6140
  E === "]" ? c.state = S.CDATA_ENDING_2 : (c.cdata += "]" + E, c.state = S.CDATA);
6141
6141
  continue;
6142
6142
  case S.CDATA_ENDING_2:
6143
- E === ">" ? (c.cdata && we(c, "oncdata", c.cdata), we(c, "onclosecdata"), c.cdata = "", c.state = S.TEXT) : E === "]" ? c.cdata += "]" : (c.cdata += "]]" + E, c.state = S.CDATA);
6143
+ E === ">" ? (c.cdata && _e(c, "oncdata", c.cdata), _e(c, "onclosecdata"), c.cdata = "", c.state = S.TEXT) : E === "]" ? c.cdata += "]" : (c.cdata += "]]" + E, c.state = S.CDATA);
6144
6144
  continue;
6145
6145
  case S.PROC_INST:
6146
6146
  E === "?" ? c.state = S.PROC_INST_ENDING : J(E) ? c.state = S.PROC_INST_BODY : c.procInstName += E;
@@ -6152,19 +6152,19 @@ Actual: ` + l.attribValue
6152
6152
  continue;
6153
6153
  case S.PROC_INST_ENDING:
6154
6154
  if (E === ">") {
6155
- const Ne = {
6155
+ const Ce = {
6156
6156
  name: c.procInstName,
6157
6157
  body: c.procInstBody
6158
6158
  };
6159
- jt(c, Ne), we(c, "onprocessinginstruction", Ne), c.procInstName = c.procInstBody = "", c.state = S.TEXT;
6159
+ Mt(c, Ce), _e(c, "onprocessinginstruction", Ce), c.procInstName = c.procInstBody = "", c.state = S.TEXT;
6160
6160
  } else
6161
6161
  c.procInstBody += "?" + E, c.state = S.PROC_INST_BODY;
6162
6162
  continue;
6163
6163
  case S.OPEN_TAG:
6164
- ve(ye, E) ? c.tagName += E : (tt(c), E === ">" ? je(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : (J(E) || fe(c, "Invalid character in tag name"), c.state = S.ATTRIB));
6164
+ ve(ye, E) ? c.tagName += E : (tt(c), E === ">" ? Me(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : (J(E) || fe(c, "Invalid character in tag name"), c.state = S.ATTRIB));
6165
6165
  continue;
6166
6166
  case S.OPEN_TAG_SLASH:
6167
- E === ">" ? (je(c, !0), ht(c)) : (fe(
6167
+ E === ">" ? (Me(c, !0), ht(c)) : (fe(
6168
6168
  c,
6169
6169
  "Forward-slash in opening tag not followed by >"
6170
6170
  ), c.state = S.ATTRIB);
@@ -6172,10 +6172,10 @@ Actual: ` + l.attribValue
6172
6172
  case S.ATTRIB:
6173
6173
  if (J(E))
6174
6174
  continue;
6175
- E === ">" ? je(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : ve(oe, E) ? (c.attribName = E, c.attribValue = "", c.state = S.ATTRIB_NAME) : fe(c, "Invalid attribute name");
6175
+ E === ">" ? Me(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : ve(ie, E) ? (c.attribName = E, c.attribValue = "", c.state = S.ATTRIB_NAME) : fe(c, "Invalid attribute name");
6176
6176
  continue;
6177
6177
  case S.ATTRIB_NAME:
6178
- E === "=" ? c.state = S.ATTRIB_VALUE : E === ">" ? (fe(c, "Attribute without value"), c.attribValue = c.attribName, nt(c), je(c)) : J(E) ? c.state = S.ATTRIB_NAME_SAW_WHITE : ve(ye, E) ? c.attribName += E : fe(c, "Invalid attribute name");
6178
+ E === "=" ? c.state = S.ATTRIB_VALUE : E === ">" ? (fe(c, "Attribute without value"), c.attribValue = c.attribName, nt(c), Me(c)) : J(E) ? c.state = S.ATTRIB_NAME_SAW_WHITE : ve(ye, E) ? c.attribName += E : fe(c, "Invalid attribute name");
6179
6179
  continue;
6180
6180
  case S.ATTRIB_NAME_SAW_WHITE:
6181
6181
  if (E === "=")
@@ -6183,10 +6183,10 @@ Actual: ` + l.attribValue
6183
6183
  else {
6184
6184
  if (J(E))
6185
6185
  continue;
6186
- fe(c, "Attribute without value"), c.tag.attributes[c.attribName] = "", c.attribValue = "", we(c, "onattribute", {
6186
+ fe(c, "Attribute without value"), c.tag.attributes[c.attribName] = "", c.attribValue = "", _e(c, "onattribute", {
6187
6187
  name: c.attribName,
6188
6188
  value: ""
6189
- }), c.attribName = "", E === ">" ? je(c) : ve(oe, E) ? (c.attribName = E, c.state = S.ATTRIB_NAME) : (fe(c, "Invalid attribute name"), c.state = S.ATTRIB);
6189
+ }), c.attribName = "", E === ">" ? Me(c) : ve(ie, E) ? (c.attribName = E, c.state = S.ATTRIB_NAME) : (fe(c, "Invalid attribute name"), c.state = S.ATTRIB);
6190
6190
  }
6191
6191
  continue;
6192
6192
  case S.ATTRIB_VALUE:
@@ -6202,14 +6202,14 @@ Actual: ` + l.attribValue
6202
6202
  nt(c), c.q = "", c.state = S.ATTRIB_VALUE_CLOSED;
6203
6203
  continue;
6204
6204
  case S.ATTRIB_VALUE_CLOSED:
6205
- J(E) ? c.state = S.ATTRIB : E === ">" ? je(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : ve(oe, E) ? (fe(c, "No whitespace between attributes"), c.attribName = E, c.attribValue = "", c.state = S.ATTRIB_NAME) : fe(c, "Invalid attribute name");
6205
+ J(E) ? c.state = S.ATTRIB : E === ">" ? Me(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : ve(ie, E) ? (fe(c, "No whitespace between attributes"), c.attribName = E, c.attribValue = "", c.state = S.ATTRIB_NAME) : fe(c, "Invalid attribute name");
6206
6206
  continue;
6207
6207
  case S.ATTRIB_VALUE_UNQUOTED:
6208
6208
  if (!de(E)) {
6209
6209
  E === "&" ? c.state = S.ATTRIB_VALUE_ENTITY_U : c.attribValue += E;
6210
6210
  continue;
6211
6211
  }
6212
- nt(c), E === ">" ? je(c) : c.state = S.ATTRIB;
6212
+ nt(c), E === ">" ? Me(c) : c.state = S.ATTRIB;
6213
6213
  continue;
6214
6214
  case S.CLOSE_TAG:
6215
6215
  if (c.tagName)
@@ -6217,7 +6217,7 @@ Actual: ` + l.attribValue
6217
6217
  else {
6218
6218
  if (J(E))
6219
6219
  continue;
6220
- In(oe, E) ? c.script ? (c.script += "</" + E, c.state = S.SCRIPT) : fe(c, "Invalid tagname in closing tag.") : c.tagName = E;
6220
+ In(ie, E) ? c.script ? (c.script += "</" + E, c.state = S.SCRIPT) : fe(c, "Invalid tagname in closing tag.") : c.tagName = E;
6221
6221
  }
6222
6222
  continue;
6223
6223
  case S.CLOSE_TAG_SAW_WHITE:
@@ -6228,16 +6228,16 @@ Actual: ` + l.attribValue
6228
6228
  case S.TEXT_ENTITY:
6229
6229
  case S.ATTRIB_VALUE_ENTITY_Q:
6230
6230
  case S.ATTRIB_VALUE_ENTITY_U:
6231
- var Ee, Re;
6231
+ var xe, Re;
6232
6232
  switch (c.state) {
6233
6233
  case S.TEXT_ENTITY:
6234
- Ee = S.TEXT, Re = "textNode";
6234
+ xe = S.TEXT, Re = "textNode";
6235
6235
  break;
6236
6236
  case S.ATTRIB_VALUE_ENTITY_Q:
6237
- Ee = S.ATTRIB_VALUE_QUOTED, Re = "attribValue";
6237
+ xe = S.ATTRIB_VALUE_QUOTED, Re = "attribValue";
6238
6238
  break;
6239
6239
  case S.ATTRIB_VALUE_ENTITY_U:
6240
- Ee = S.ATTRIB_VALUE_UNQUOTED, Re = "attribValue";
6240
+ xe = S.ATTRIB_VALUE_UNQUOTED, Re = "attribValue";
6241
6241
  break;
6242
6242
  }
6243
6243
  if (E === ";") {
@@ -6248,8 +6248,8 @@ Actual: ` + l.attribValue
6248
6248
  ), (c.entityDepth += 1) > c.opt.maxEntityDepth && ke(
6249
6249
  c,
6250
6250
  "Parsed entity depth exceeds max entity depth"
6251
- ), c.entity = "", c.state = Ee, c.write(Ae), c.entityDepth -= 1) : (c[Re] += Ae, c.entity = "", c.state = Ee);
6252
- } else ve(c.entity.length ? Z : ne, E) ? c.entity += E : (fe(c, "Invalid character in entity name"), c[Re] += "&" + c.entity + E, c.entity = "", c.state = Ee);
6251
+ ), c.entity = "", c.state = xe, c.write(Ae), c.entityDepth -= 1) : (c[Re] += Ae, c.entity = "", c.state = xe);
6252
+ } else ve(c.entity.length ? Z : ne, E) ? c.entity += E : (fe(c, "Invalid character in entity name"), c[Re] += "&" + c.entity + E, c.entity = "", c.state = xe);
6253
6253
  continue;
6254
6254
  default:
6255
6255
  throw new Error(c, "Unknown state: " + c.state);
@@ -6258,19 +6258,19 @@ Actual: ` + l.attribValue
6258
6258
  }
6259
6259
  String.fromCodePoint || (function() {
6260
6260
  var l = String.fromCharCode, c = Math.floor, R = function() {
6261
- var E = 16384, le = [], be, Ee, Re = -1, Ae = arguments.length;
6261
+ var E = 16384, le = [], be, xe, Re = -1, Ae = arguments.length;
6262
6262
  if (!Ae)
6263
6263
  return "";
6264
- for (var Ne = ""; ++Re < Ae; ) {
6265
- var Ce = Number(arguments[Re]);
6266
- if (!isFinite(Ce) || // `NaN`, `+Infinity`, or `-Infinity`
6267
- Ce < 0 || // not a valid Unicode code point
6268
- Ce > 1114111 || // not a valid Unicode code point
6269
- c(Ce) !== Ce)
6270
- throw RangeError("Invalid code point: " + Ce);
6271
- Ce <= 65535 ? le.push(Ce) : (Ce -= 65536, be = (Ce >> 10) + 55296, Ee = Ce % 1024 + 56320, le.push(be, Ee)), (Re + 1 === Ae || le.length > E) && (Ne += l.apply(null, le), le.length = 0);
6264
+ for (var Ce = ""; ++Re < Ae; ) {
6265
+ var Oe = Number(arguments[Re]);
6266
+ if (!isFinite(Oe) || // `NaN`, `+Infinity`, or `-Infinity`
6267
+ Oe < 0 || // not a valid Unicode code point
6268
+ Oe > 1114111 || // not a valid Unicode code point
6269
+ c(Oe) !== Oe)
6270
+ throw RangeError("Invalid code point: " + Oe);
6271
+ Oe <= 65535 ? le.push(Oe) : (Oe -= 65536, be = (Oe >> 10) + 55296, xe = Oe % 1024 + 56320, le.push(be, xe)), (Re + 1 === Ae || le.length > E) && (Ce += l.apply(null, le), le.length = 0);
6272
6272
  }
6273
- return Ne;
6273
+ return Ce;
6274
6274
  };
6275
6275
  Object.defineProperty ? Object.defineProperty(String, "fromCodePoint", {
6276
6276
  value: R,
@@ -6281,15 +6281,15 @@ Actual: ` + l.attribValue
6281
6281
  })(m);
6282
6282
  })(yr)), yr;
6283
6283
  }
6284
- var ya = ga();
6285
- function va(m) {
6284
+ var pa = ma();
6285
+ function ga(m) {
6286
6286
  const { dialecteConfig: r, useCustomRecordsIds: s, session: o } = m, d = r.io.hooks;
6287
6287
  let v = {
6288
6288
  defaultNamespace: null,
6289
6289
  stack: [],
6290
6290
  recordsBatch: []
6291
6291
  };
6292
- const g = ya.parser(
6292
+ const g = pa.parser(
6293
6293
  !0,
6294
6294
  // strict mode
6295
6295
  {
@@ -6305,16 +6305,16 @@ function va(m) {
6305
6305
  // Enable namespace handling
6306
6306
  }
6307
6307
  );
6308
- g.onopentag = (q) => v = ba({
6308
+ g.onopentag = (q) => v = ya({
6309
6309
  node: q,
6310
6310
  state: v,
6311
6311
  dialecteConfig: r,
6312
6312
  useCustomRecordsIds: s
6313
- }), g.ontext = (q) => v = wa({ text: q, state: v }), g.onclosetag = () => ({ updatedState: v } = _a({
6313
+ }), g.ontext = (q) => v = va({ text: q, state: v }), g.onclosetag = () => ({ updatedState: v } = ba({
6314
6314
  state: v,
6315
6315
  ioHooks: d,
6316
6316
  session: o
6317
- })), g.onerror = Ea;
6317
+ })), g.onerror = wa;
6318
6318
  function D() {
6319
6319
  const q = v.recordsBatch;
6320
6320
  return v.recordsBatch = [], q;
@@ -6328,32 +6328,32 @@ function va(m) {
6328
6328
  getSize: I
6329
6329
  };
6330
6330
  }
6331
- function ba(m) {
6332
- const { node: r, state: s, dialecteConfig: o, useCustomRecordsIds: d } = m, f = { ...s }, v = xa(r);
6333
- f.defaultNamespace || (f.defaultNamespace = Ta({
6331
+ function ya(m) {
6332
+ const { node: r, state: s, dialecteConfig: o, useCustomRecordsIds: d } = m, f = { ...s }, v = _a(r);
6333
+ f.defaultNamespace || (f.defaultNamespace = Ea({
6334
6334
  element: r,
6335
6335
  defaultNamespace: o.namespaces.default,
6336
6336
  rootElementName: o.rootElementName
6337
6337
  }));
6338
- const g = Na(r, f.defaultNamespace), D = Aa({ attributes: r.attributes, useCustomRecordsIds: d }), I = Da({
6338
+ const g = xa(r, f.defaultNamespace), D = Ca({ attributes: r.attributes, useCustomRecordsIds: d }), I = Oa({
6339
6339
  attributes: r.attributes,
6340
6340
  useCustomRecordsIds: d
6341
- }), q = Ca(I), M = Oa(s.stack), X = {
6341
+ }), q = Ta(I), j = Na(s.stack), X = {
6342
6342
  id: D,
6343
6343
  tagName: v,
6344
6344
  namespace: g,
6345
6345
  attributes: q,
6346
6346
  value: "",
6347
- parent: M,
6347
+ parent: j,
6348
6348
  children: []
6349
6349
  };
6350
6350
  return f.stack.push(X), f;
6351
6351
  }
6352
- function wa(m) {
6352
+ function va(m) {
6353
6353
  const { text: r, state: s } = m;
6354
6354
  return r && s.stack.length > 0 && (s.stack[s.stack.length - 1].value += r), s;
6355
6355
  }
6356
- function _a(m) {
6356
+ function ba(m) {
6357
6357
  const { state: r, ioHooks: s, session: o } = m, d = r.stack.at(-1);
6358
6358
  let f = r.stack.slice(0, -1);
6359
6359
  const v = [...r.recordsBatch];
@@ -6386,28 +6386,28 @@ function _a(m) {
6386
6386
  }
6387
6387
  };
6388
6388
  }
6389
- function Ea(m) {
6389
+ function wa(m) {
6390
6390
  return new Error(`XML parsing error: ${m}`);
6391
6391
  }
6392
- function xa(m) {
6392
+ function _a(m) {
6393
6393
  return m.local;
6394
6394
  }
6395
- function Ta(m) {
6395
+ function Ea(m) {
6396
6396
  const { element: r, defaultNamespace: s, rootElementName: o } = m;
6397
- return Oe(r.name === o, {
6397
+ return we(r.name === o, {
6398
6398
  detail: `Expected root element <${o}>, got <${r.name}>`
6399
6399
  }), r.attributes?.xmlns?.value ? {
6400
6400
  prefix: "",
6401
6401
  uri: r.attributes.xmlns.value
6402
6402
  } : s;
6403
6403
  }
6404
- function Na(m, r) {
6405
- return da(m) ? {
6404
+ function xa(m, r) {
6405
+ return la(m) ? {
6406
6406
  prefix: m.prefix,
6407
6407
  uri: m.uri
6408
6408
  } : r;
6409
6409
  }
6410
- function Ca(m) {
6410
+ function Ta(m) {
6411
6411
  return m.map((r) => {
6412
6412
  const s = r.prefix && r.uri ? {
6413
6413
  prefix: r.prefix,
@@ -6420,64 +6420,64 @@ function Ca(m) {
6420
6420
  };
6421
6421
  });
6422
6422
  }
6423
- function Oa(m) {
6423
+ function Na(m) {
6424
6424
  if (m.length === 0) return null;
6425
6425
  const r = m[m.length - 1];
6426
6426
  return r ? { id: r.id, tagName: r.tagName } : null;
6427
6427
  }
6428
- function Aa(m) {
6428
+ function Ca(m) {
6429
6429
  const { attributes: r, useCustomRecordsIds: s } = m, o = r[gi];
6430
6430
  return s && o && o.value ? o.value : crypto.randomUUID();
6431
6431
  }
6432
- function Da(m) {
6432
+ function Oa(m) {
6433
6433
  const { attributes: r, useCustomRecordsIds: s } = m;
6434
6434
  return s ? Object.values(r).filter((o) => o.name !== gi) : Object.values(r);
6435
6435
  }
6436
- const Sa = 32 * 1024, ka = 2e3;
6437
- async function Ra(m) {
6436
+ const Aa = 32 * 1024, Da = 2e3;
6437
+ async function Sa(m) {
6438
6438
  const { file: r, documentId: s, store: o, config: d, useCustomRecordsIds: f = !1, chunkOptions: v } = m, { supportedFileExtensions: g } = d.io;
6439
- if (Oe(
6440
- g.some((j) => r.name.toLowerCase().endsWith(j)),
6439
+ if (we(
6440
+ g.some((M) => r.name.toLowerCase().endsWith(M)),
6441
6441
  { key: "ASSERTION_FAILED", detail: `Unsupported file type: ${r.name}` }
6442
6442
  ), r.size === 0)
6443
6443
  return { documentId: s, recordCount: 0 };
6444
- const D = v?.chunkSize ?? Sa, I = v?.batchSize ?? ka, q = new fa(), M = va({ dialecteConfig: d, useCustomRecordsIds: f, session: q }), X = await Ia({
6444
+ const D = v?.chunkSize ?? Aa, I = v?.batchSize ?? Da, q = new ua(), j = ga({ dialecteConfig: d, useCustomRecordsIds: f, session: q }), X = await ka({
6445
6445
  file: r,
6446
- sax: M,
6446
+ sax: j,
6447
6447
  session: q,
6448
6448
  store: o,
6449
6449
  documentId: s,
6450
6450
  chunkSize: D,
6451
6451
  batchSize: I
6452
- }), ie = await Pa({ config: d, store: o, documentId: s });
6453
- return { documentId: s, recordCount: X + ie };
6452
+ }), oe = await Ra({ config: d, store: o, documentId: s });
6453
+ return { documentId: s, recordCount: X + oe };
6454
6454
  }
6455
- async function Ia(m) {
6455
+ async function ka(m) {
6456
6456
  const { file: r, sax: s, session: o, store: d, documentId: f, chunkSize: v, batchSize: g } = m;
6457
6457
  let D = 0;
6458
6458
  const I = r.stream().getReader(), q = new TextDecoder();
6459
- let M = new Uint8Array(0), X = !1;
6459
+ let j = new Uint8Array(0), X = !1;
6460
6460
  for (; !X; ) {
6461
- const ie = await I.read();
6462
- if (X = ie.done, X) {
6463
- M.length > 0 && s.parser.write(q.decode(M)), s.parser.close(), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: 0 });
6461
+ const oe = await I.read();
6462
+ if (X = oe.done, X) {
6463
+ j.length > 0 && s.parser.write(q.decode(j)), s.parser.close(), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: 0 });
6464
6464
  break;
6465
6465
  }
6466
- if (ie.value)
6467
- for (M = Fa(M, ie.value); M.length >= v; ) {
6468
- const j = q.decode(M.slice(0, v), { stream: !0 });
6469
- M = M.slice(v), s.parser.write(j), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: g });
6466
+ if (oe.value)
6467
+ for (j = Ia(j, oe.value); j.length >= v; ) {
6468
+ const M = q.decode(j.slice(0, v), { stream: !0 });
6469
+ j = j.slice(v), s.parser.write(M), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: g });
6470
6470
  }
6471
6471
  }
6472
6472
  return D;
6473
6473
  }
6474
- async function Pa(m) {
6474
+ async function Ra(m) {
6475
6475
  const { config: r, store: s, documentId: o } = m;
6476
6476
  if (!r.io.hooks?.afterImport) return 0;
6477
6477
  const { creates: d, updates: f, deletes: v } = await r.io.hooks.afterImport();
6478
6478
  return d?.length || f?.length || v?.length ? (await s.bulkWrite(o, { creates: d, updates: f, deletes: v }), (d?.length ?? 0) - (v?.length ?? 0)) : 0;
6479
6479
  }
6480
- function Fa(m, r) {
6480
+ function Ia(m, r) {
6481
6481
  const s = new Uint8Array(m.length + r.length);
6482
6482
  return s.set(m), s.set(r, m.length), s;
6483
6483
  }
@@ -6487,18 +6487,18 @@ async function pi(m) {
6487
6487
  const v = r.drainBatch(), g = s.resolveChildrenForBatch(v);
6488
6488
  return await o.bulkWrite(d, { creates: g }), g.length;
6489
6489
  }
6490
- async function Ba(m) {
6490
+ async function Pa(m) {
6491
6491
  const { documentId: r, state: s, configs: o, store: d, projectName: f, options: v } = m, g = s.documents.get(r);
6492
- Oe(g, {
6492
+ we(g, {
6493
6493
  key: "DOCUMENT_NOT_REGISTERED",
6494
6494
  detail: `Document "${r}" not registered in project "${f}"`
6495
6495
  });
6496
- const D = o[g.document.configKey], I = await d.getByDocumentId(r), q = aa({
6496
+ const D = o[g.document.configKey], I = await d.getByDocumentId(r), q = ia({
6497
6497
  records: I,
6498
6498
  config: D,
6499
6499
  withDatabaseIds: v?.withDatabaseIds
6500
- }), M = `${g.document.name}${g.document.extension}`;
6501
- return { xmlDocument: q, filename: M };
6500
+ }), j = `${g.document.name}${g.document.extension}`;
6501
+ return { xmlDocument: q, filename: j };
6502
6502
  }
6503
6503
  function Rn(m) {
6504
6504
  return {
@@ -6512,7 +6512,7 @@ function Rn(m) {
6512
6512
  canRedo: !1
6513
6513
  };
6514
6514
  }
6515
- function Ma(m, r) {
6515
+ function Fa(m, r) {
6516
6516
  const s = new Set(r.map((o) => o.id));
6517
6517
  for (const o of r)
6518
6518
  m.has(o.id) || m.set(o.id, Rn(o));
@@ -6520,13 +6520,13 @@ function Ma(m, r) {
6520
6520
  s.has(o) || m.delete(o);
6521
6521
  return m;
6522
6522
  }
6523
- async function ja(m) {
6523
+ async function Ba(m) {
6524
6524
  const { file: r, store: s, configs: o, defaultConfigKey: d, options: f } = m, v = f?.configKey ?? d, g = o[v];
6525
- Oe(g, {
6525
+ we(g, {
6526
6526
  key: "UNKNOWN_CONFIG_KEY",
6527
6527
  detail: `Unknown configKey: "${v}". Available: ${Object.keys(o).join(", ")}`
6528
6528
  });
6529
- const D = crypto.randomUUID(), I = r.name.includes(".") ? `.${r.name.split(".").pop()}` : g.io.supportedFileExtensions[0], q = r.name.replace(/\.[^.]+$/, "") || "untitled", M = {
6529
+ const D = crypto.randomUUID(), I = r.name.includes(".") ? `.${r.name.split(".").pop()}` : g.io.supportedFileExtensions[0], q = r.name.replace(/\.[^.]+$/, "") || "untitled", j = {
6530
6530
  id: D,
6531
6531
  name: q,
6532
6532
  extension: I,
@@ -6534,8 +6534,8 @@ async function ja(m) {
6534
6534
  createdAt: Date.now(),
6535
6535
  metadata: f?.metadata
6536
6536
  };
6537
- await s.registerDocument(M);
6538
- const { recordCount: X } = await Ra({
6537
+ await s.registerDocument(j);
6538
+ const { recordCount: X } = await Sa({
6539
6539
  file: r,
6540
6540
  documentId: D,
6541
6541
  store: s,
@@ -6545,14 +6545,14 @@ async function ja(m) {
6545
6545
  });
6546
6546
  return {
6547
6547
  documentId: D,
6548
- document: M,
6549
- documentState: Rn(M),
6548
+ document: j,
6549
+ documentState: Rn(j),
6550
6550
  recordCount: X
6551
6551
  };
6552
6552
  }
6553
- async function Ka(m) {
6553
+ async function ja(m) {
6554
6554
  const { store: r, configs: s, defaultConfigKey: o, options: d } = m, f = d?.configKey ?? o, v = s[f];
6555
- Oe(v, {
6555
+ we(v, {
6556
6556
  key: "UNKNOWN_CONFIG_KEY",
6557
6557
  detail: `Unknown configKey: "${f}". Available: ${Object.keys(s).join(", ")}`
6558
6558
  });
@@ -6565,10 +6565,10 @@ async function Ka(m) {
6565
6565
  metadata: d?.metadata
6566
6566
  };
6567
6567
  await r.registerDocument(q);
6568
- const M = v.definition[v.rootElementName], X = (M?.attributes.sequence ?? []).map((j) => ({ name: j, ...M.attributes.details[j] })).filter((j) => j.required && (j.fixed ?? j.default) !== void 0).map(({ name: j, fixed: B, default: H, namespace: oe }) => {
6569
- const ye = { name: j, value: B ?? H };
6570
- return oe && (ye.namespace = oe), ye;
6571
- }), ie = {
6568
+ const j = v.definition[v.rootElementName], X = (j?.attributes.sequence ?? []).map((M) => ({ name: M, ...j.attributes.details[M] })).filter((M) => M.required && (M.fixed ?? M.default) !== void 0).map(({ name: M, fixed: B, default: H, namespace: ie }) => {
6569
+ const ye = { name: M, value: B ?? H };
6570
+ return ie && (ye.namespace = ie), ye;
6571
+ }), oe = {
6572
6572
  id: crypto.randomUUID(),
6573
6573
  tagName: v.rootElementName,
6574
6574
  namespace: v.namespaces.default,
@@ -6577,25 +6577,63 @@ async function Ka(m) {
6577
6577
  parent: null,
6578
6578
  children: []
6579
6579
  };
6580
- return await r.bulkWrite(I, { creates: [ie] }), { documentId: I, document: q, documentState: Rn(q) };
6580
+ return await r.bulkWrite(I, { creates: [oe] }), { documentId: I, document: q, documentState: Rn(q) };
6581
6581
  }
6582
- class Gi {
6583
- constructor(r, s, o, d, f, v) {
6582
+ class Za {
6583
+ constructor(r) {
6584
6584
  this.state = {
6585
6585
  documents: /* @__PURE__ */ new Map(),
6586
6586
  activeTransactions: 0
6587
- }, this.name = r, this.store = s, this.configs = o, this.defaultConfigKey = d, this.extensionsRegistry = f, this.hooks = v, this.channel = new BroadcastChannel(`dialecte::project::${r}`), this.channel.onmessage = (g) => {
6588
- const { type: D } = g.data ?? {};
6589
- (D === "document-created" || D === "document-removed" || D === "document-imported") && this.refreshState();
6590
6587
  };
6588
+ const s = Object.keys(r.configs);
6589
+ this.storage = r.storage, this.configs = r.configs, this.defaultConfigKey = r.defaultConfigKey ?? s[0], this.extensionsRegistry = r.extensionsRegistry, this.hooks = r.hooks;
6590
+ }
6591
+ get name() {
6592
+ return we(this._name !== void 0, {
6593
+ key: "PROJECT_NOT_OPENED",
6594
+ detail: "Call project.open(name) before accessing project properties."
6595
+ }), this._name;
6596
+ }
6597
+ get store() {
6598
+ return we(this._store !== void 0, {
6599
+ key: "PROJECT_NOT_OPENED",
6600
+ detail: "Call project.open(name) before accessing project properties."
6601
+ }), this._store;
6602
+ }
6603
+ get channel() {
6604
+ return we(this._channel !== void 0, {
6605
+ key: "PROJECT_NOT_OPENED",
6606
+ detail: "Call project.open(name) before accessing project properties."
6607
+ }), this._channel;
6591
6608
  }
6592
- static async open(r) {
6593
- const { name: s, configs: o, storage: d, extensions: f, hooks: v, defaultConfigKey: g } = r, D = wo({ base: f?.base, custom: f?.custom }), I = Object.keys(o), q = g ?? I[0], M = na(s, d, o[q]);
6594
- await M.open();
6595
- const X = new Gi(s, M, o, q, D, v), ie = await M.getDocuments();
6596
- for (const j of ie)
6597
- X.state.documents.set(j.id, Rn(j));
6598
- return X;
6609
+ // ── Lifecycle ────────────────────────────────────────────────────────────
6610
+ /**
6611
+ * Open a named project: resolve store, open DB connection, hydrate state.
6612
+ * Must be called before import/export/openDocument.
6613
+ */
6614
+ async open(r) {
6615
+ this._name = r, this._channel = new BroadcastChannel(`dialecte::project::${r}`), this._channel.onmessage = (d) => {
6616
+ const { type: f } = d.data ?? {};
6617
+ (f === "init-empty-document" || f === "document-removed" || f === "document-imported") && this.refreshState();
6618
+ };
6619
+ const s = ea(r, this.storage, this.configs[this.defaultConfigKey]);
6620
+ await s.open(), this._store = s;
6621
+ const o = await s.getDocuments();
6622
+ for (const d of o)
6623
+ this.state.documents.set(d.id, Rn(d));
6624
+ return this;
6625
+ }
6626
+ /**
6627
+ * Close the store and release resources.
6628
+ */
6629
+ close() {
6630
+ this.channel.close(), this.store.close();
6631
+ }
6632
+ /**
6633
+ * Destroy the project - deletes the database entirely.
6634
+ */
6635
+ async destroy() {
6636
+ this.channel.close(), await this.store.destroy(), this.state.documents.clear();
6599
6637
  }
6600
6638
  // ── File management ──────────────────────────────────────────────────────
6601
6639
  /**
@@ -6603,13 +6641,13 @@ class Gi {
6603
6641
  * Returns the new documentId. Records are added later via import or transactions.
6604
6642
  */
6605
6643
  async initEmptyDocument(r) {
6606
- const s = await Ka({
6644
+ const s = await ja({
6607
6645
  store: this.store,
6608
6646
  configs: this.configs,
6609
6647
  defaultConfigKey: this.defaultConfigKey,
6610
6648
  options: r
6611
6649
  });
6612
- return this.state.documents.set(s.documentId, s.documentState), this.channel.postMessage({ type: "document-created", documentId: s.documentId }), s.documentId;
6650
+ return this.state.documents.set(s.documentId, s.documentState), this.channel.postMessage({ type: "init-empty-document", documentId: s.documentId }), s.documentId;
6613
6651
  }
6614
6652
  /**
6615
6653
  * Remove a file and all its records.
@@ -6622,7 +6660,7 @@ class Gi {
6622
6660
  * Import a File into the project: register, parse XML, persist records.
6623
6661
  */
6624
6662
  async import(r, s) {
6625
- const o = await ja({
6663
+ const o = await Ba({
6626
6664
  file: r,
6627
6665
  store: this.store,
6628
6666
  configs: this.configs,
@@ -6635,7 +6673,7 @@ class Gi {
6635
6673
  * Export a document as an XMLDocument built from stored records.
6636
6674
  */
6637
6675
  async export(r, s) {
6638
- return Ba({
6676
+ return Pa({
6639
6677
  documentId: r,
6640
6678
  state: this.state,
6641
6679
  configs: this.configs,
@@ -6657,12 +6695,12 @@ class Gi {
6657
6695
  */
6658
6696
  openDocument(r) {
6659
6697
  const s = this.state.documents.get(r);
6660
- Oe(s, {
6698
+ we(s, {
6661
6699
  key: "DOCUMENT_NOT_REGISTERED",
6662
6700
  detail: `Document "${r}" not registered in project "${this.name}"`
6663
6701
  });
6664
6702
  const o = this.configs[s.document.configKey];
6665
- return new Yo(
6703
+ return new $o(
6666
6704
  this.store,
6667
6705
  o,
6668
6706
  r,
@@ -6682,31 +6720,18 @@ class Gi {
6682
6720
  // ── Undo / Redo ──────────────────────────────────────────────────────────
6683
6721
  async undo(r) {
6684
6722
  const s = this.state.documents.get(r);
6685
- Oe(s, {
6723
+ we(s, {
6686
6724
  key: "DOCUMENT_NOT_REGISTERED",
6687
6725
  detail: `Document "${r}" not registered in project "${this.name}"`
6688
6726
  }), await this.store.undo(r), this.channel.postMessage({ type: "commit", documentId: r, timestamp: Date.now() });
6689
6727
  }
6690
6728
  async redo(r) {
6691
6729
  const s = this.state.documents.get(r);
6692
- Oe(s, {
6730
+ we(s, {
6693
6731
  key: "DOCUMENT_NOT_REGISTERED",
6694
6732
  detail: `Document "${r}" not registered in project "${this.name}"`
6695
6733
  }), await this.store.redo(r), this.channel.postMessage({ type: "commit", documentId: r, timestamp: Date.now() });
6696
6734
  }
6697
- // ── Lifecycle ────────────────────────────────────────────────────────────
6698
- /**
6699
- * Close the store and release resources.
6700
- */
6701
- close() {
6702
- this.channel.close(), this.store.close();
6703
- }
6704
- /**
6705
- * Destroy the project - deletes the database entirely.
6706
- */
6707
- async destroy() {
6708
- this.channel.close(), await this.store.destroy(), this.state.documents.clear();
6709
- }
6710
6735
  // ── Internal ─────────────────────────────────────────────────────────────
6711
6736
  /** Expose the underlying database instance. Return type is inferred from the store (Dexie for local storage). */
6712
6737
  getDatabaseInstance() {
@@ -6714,37 +6739,37 @@ class Gi {
6714
6739
  }
6715
6740
  async refreshState() {
6716
6741
  const r = await this.store.getDocuments();
6717
- Ma(this.state.documents, r);
6742
+ Fa(this.state.documents, r);
6718
6743
  }
6719
6744
  }
6720
6745
  export {
6721
6746
  Di as A,
6722
- ja as B,
6747
+ Ba as B,
6723
6748
  ai as C,
6724
6749
  oi as D,
6725
- Ka as E,
6750
+ ja as E,
6726
6751
  zt as F,
6727
6752
  xt as G,
6728
- Ra as H,
6729
- Ma as I,
6730
- Xo as J,
6731
- na as K,
6753
+ Sa as H,
6754
+ Fa as I,
6755
+ Yo as J,
6756
+ ea as K,
6732
6757
  si as M,
6733
- fa as P,
6758
+ ua as P,
6734
6759
  Si as Q,
6735
6760
  Xe as T,
6736
- Uo as a,
6737
- ta as b,
6738
- Yo as c,
6739
- Gi as d,
6761
+ qo as a,
6762
+ Jo as b,
6763
+ $o as c,
6764
+ Za as d,
6740
6765
  ft as e,
6741
6766
  He as f,
6742
- Wo as g,
6743
- ji as h,
6744
- Go as i,
6767
+ Go as g,
6768
+ Mi as h,
6769
+ Vo as i,
6745
6770
  Rn as j,
6746
- aa as k,
6747
- Ba as l,
6771
+ ia as k,
6772
+ Pa as l,
6748
6773
  bi as m,
6749
6774
  Er as n,
6750
6775
  wr as o,
@@ -6756,7 +6781,7 @@ export {
6756
6781
  vi as u,
6757
6782
  me as v,
6758
6783
  Zt as w,
6759
- Ja as x,
6784
+ Qa as x,
6760
6785
  Sn as y,
6761
6786
  Oi as z
6762
6787
  };