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