@septkit/ui 0.0.29 → 0.0.31
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/create-document-store.js +32 -13
- package/dist/external/.pnpm/@dialecte_core@0.2.16/node_modules/@dialecte/core/dist/helpers.js +5 -0
- package/dist/external/.pnpm/@dialecte_core@0.2.16/node_modules/@dialecte/core/dist/index.js +2 -0
- package/dist/external/.pnpm/@dialecte_core@0.2.16/node_modules/@dialecte/core/dist/project-BOM3Ipbu.js +4886 -0
- package/dist/external/.pnpm/{@dialecte_core@0.2.12/node_modules/@dialecte/core/dist/index-BgyMtFE-.js → @dialecte_core@0.2.16/node_modules/@dialecte/core/dist/utils-B_-lXlpE.js} +14 -2
- package/dist/index.d.ts +50 -20
- package/package.json +2 -2
|
@@ -0,0 +1,4886 @@
|
|
|
1
|
+
import "./helpers.js";
|
|
2
|
+
//#region node_modules/.pnpm/@dialecte+core@0.2.16/node_modules/@dialecte/core/dist/project-BOM3Ipbu.js
|
|
3
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
|
|
4
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
5
|
+
get: ((e) => i[e]).bind(null, d),
|
|
6
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
7
|
+
});
|
|
8
|
+
return e;
|
|
9
|
+
}, c = (n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, "default", {
|
|
10
|
+
value: n,
|
|
11
|
+
enumerable: !0
|
|
12
|
+
}) : a, n));
|
|
13
|
+
function l(e, t) {
|
|
14
|
+
if (!e) return {};
|
|
15
|
+
let n = {};
|
|
16
|
+
for (let r of Object.keys(e)) {
|
|
17
|
+
let i = e[r], a = {};
|
|
18
|
+
for (let e of Object.keys(i)) {
|
|
19
|
+
let n = i[e];
|
|
20
|
+
a[e] = (...e) => n(t, ...e);
|
|
21
|
+
}
|
|
22
|
+
n[r] = a;
|
|
23
|
+
}
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
var u = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
27
|
+
(function(n, r) {
|
|
28
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).Dexie = r();
|
|
29
|
+
})(e, function() {
|
|
30
|
+
var e = function(t, n) {
|
|
31
|
+
return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
|
|
32
|
+
e.__proto__ = t;
|
|
33
|
+
} || function(e, t) {
|
|
34
|
+
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
35
|
+
})(t, n);
|
|
36
|
+
}, t = function() {
|
|
37
|
+
return (t = Object.assign || function(e) {
|
|
38
|
+
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
39
|
+
return e;
|
|
40
|
+
}).apply(this, arguments);
|
|
41
|
+
};
|
|
42
|
+
function n(e, t, n) {
|
|
43
|
+
if (n || arguments.length === 2) for (var r, i = 0, a = t.length; i < a; i++) !r && i in t || ((r ||= Array.prototype.slice.call(t, 0, i))[i] = t[i]);
|
|
44
|
+
return e.concat(r || Array.prototype.slice.call(t));
|
|
45
|
+
}
|
|
46
|
+
var r = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, i = Object.keys, a = Array.isArray;
|
|
47
|
+
function o(e, t) {
|
|
48
|
+
return typeof t != "object" || i(t).forEach(function(n) {
|
|
49
|
+
e[n] = t[n];
|
|
50
|
+
}), e;
|
|
51
|
+
}
|
|
52
|
+
typeof Promise > "u" || r.Promise || (r.Promise = Promise);
|
|
53
|
+
var s = Object.getPrototypeOf, c = {}.hasOwnProperty;
|
|
54
|
+
function l(e, t) {
|
|
55
|
+
return c.call(e, t);
|
|
56
|
+
}
|
|
57
|
+
function u(e, t) {
|
|
58
|
+
typeof t == "function" && (t = t(s(e))), (typeof Reflect > "u" ? i : Reflect.ownKeys)(t).forEach(function(n) {
|
|
59
|
+
f(e, n, t[n]);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
var d = Object.defineProperty;
|
|
63
|
+
function f(e, t, n, r) {
|
|
64
|
+
d(e, t, o(n && l(n, "get") && typeof n.get == "function" ? {
|
|
65
|
+
get: n.get,
|
|
66
|
+
set: n.set,
|
|
67
|
+
configurable: !0
|
|
68
|
+
} : {
|
|
69
|
+
value: n,
|
|
70
|
+
configurable: !0,
|
|
71
|
+
writable: !0
|
|
72
|
+
}, r));
|
|
73
|
+
}
|
|
74
|
+
function p(e) {
|
|
75
|
+
return { from: function(t) {
|
|
76
|
+
return e.prototype = Object.create(t.prototype), f(e.prototype, "constructor", e), { extend: u.bind(null, e.prototype) };
|
|
77
|
+
} };
|
|
78
|
+
}
|
|
79
|
+
var m = Object.getOwnPropertyDescriptor, h = [].slice;
|
|
80
|
+
function g(e, t, n) {
|
|
81
|
+
return h.call(e, t, n);
|
|
82
|
+
}
|
|
83
|
+
function _(e, t) {
|
|
84
|
+
return t(e);
|
|
85
|
+
}
|
|
86
|
+
function v(e) {
|
|
87
|
+
if (!e) throw Error("Assertion Failed");
|
|
88
|
+
}
|
|
89
|
+
function y(e) {
|
|
90
|
+
r.setImmediate ? setImmediate(e) : setTimeout(e, 0);
|
|
91
|
+
}
|
|
92
|
+
function b(e, t) {
|
|
93
|
+
if (typeof t == "string" && l(e, t)) return e[t];
|
|
94
|
+
if (!t) return e;
|
|
95
|
+
if (typeof t != "string") {
|
|
96
|
+
for (var n = [], r = 0, i = t.length; r < i; ++r) {
|
|
97
|
+
var a = b(e, t[r]);
|
|
98
|
+
n.push(a);
|
|
99
|
+
}
|
|
100
|
+
return n;
|
|
101
|
+
}
|
|
102
|
+
var o = t.indexOf(".");
|
|
103
|
+
if (o !== -1) {
|
|
104
|
+
var s = e[t.substr(0, o)];
|
|
105
|
+
return s == null ? void 0 : b(s, t.substr(o + 1));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function x(e, t, n) {
|
|
109
|
+
if (e && t !== void 0 && !("isFrozen" in Object && Object.isFrozen(e))) if (typeof t != "string" && "length" in t) {
|
|
110
|
+
v(typeof n != "string" && "length" in n);
|
|
111
|
+
for (var r = 0, i = t.length; r < i; ++r) x(e, t[r], n[r]);
|
|
112
|
+
} else {
|
|
113
|
+
var o, s, c = t.indexOf(".");
|
|
114
|
+
c === -1 ? n === void 0 ? a(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n : (o = t.substr(0, c), (s = t.substr(c + 1)) === "" ? n === void 0 ? a(e) && !isNaN(parseInt(o)) ? e.splice(o, 1) : delete e[o] : e[o] = n : x(c = !(c = e[o]) || !l(e, o) ? e[o] = {} : c, s, n));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function S(e) {
|
|
118
|
+
var t, n = {};
|
|
119
|
+
for (t in e) l(e, t) && (n[t] = e[t]);
|
|
120
|
+
return n;
|
|
121
|
+
}
|
|
122
|
+
var C = [].concat;
|
|
123
|
+
function ee(e) {
|
|
124
|
+
return C.apply([], e);
|
|
125
|
+
}
|
|
126
|
+
var te = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(ee([
|
|
127
|
+
8,
|
|
128
|
+
16,
|
|
129
|
+
32,
|
|
130
|
+
64
|
|
131
|
+
].map(function(e) {
|
|
132
|
+
return [
|
|
133
|
+
"Int",
|
|
134
|
+
"Uint",
|
|
135
|
+
"Float"
|
|
136
|
+
].map(function(t) {
|
|
137
|
+
return t + e + "Array";
|
|
138
|
+
});
|
|
139
|
+
}))).filter(function(e) {
|
|
140
|
+
return r[e];
|
|
141
|
+
}), w = new Set(te.map(function(e) {
|
|
142
|
+
return r[e];
|
|
143
|
+
})), ne = null;
|
|
144
|
+
function T(e) {
|
|
145
|
+
return ne = /* @__PURE__ */ new WeakMap(), e = function e(t) {
|
|
146
|
+
if (!t || typeof t != "object") return t;
|
|
147
|
+
var n = ne.get(t);
|
|
148
|
+
if (n) return n;
|
|
149
|
+
if (a(t)) {
|
|
150
|
+
n = [], ne.set(t, n);
|
|
151
|
+
for (var r = 0, i = t.length; r < i; ++r) n.push(e(t[r]));
|
|
152
|
+
} else if (w.has(t.constructor)) n = t;
|
|
153
|
+
else {
|
|
154
|
+
var o, c = s(t);
|
|
155
|
+
for (o in n = c === Object.prototype ? {} : Object.create(c), ne.set(t, n), t) l(t, o) && (n[o] = e(t[o]));
|
|
156
|
+
}
|
|
157
|
+
return n;
|
|
158
|
+
}(e), ne = null, e;
|
|
159
|
+
}
|
|
160
|
+
var re = {}.toString;
|
|
161
|
+
function ie(e) {
|
|
162
|
+
return re.call(e).slice(8, -1);
|
|
163
|
+
}
|
|
164
|
+
var ae = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", oe = typeof ae == "symbol" ? function(e) {
|
|
165
|
+
var t;
|
|
166
|
+
return e != null && (t = e[ae]) && t.apply(e);
|
|
167
|
+
} : function() {
|
|
168
|
+
return null;
|
|
169
|
+
};
|
|
170
|
+
function E(e, t) {
|
|
171
|
+
return t = e.indexOf(t), 0 <= t && e.splice(t, 1), 0 <= t;
|
|
172
|
+
}
|
|
173
|
+
var D = {};
|
|
174
|
+
function O(e) {
|
|
175
|
+
var t, n, r, i;
|
|
176
|
+
if (arguments.length === 1) {
|
|
177
|
+
if (a(e)) return e.slice();
|
|
178
|
+
if (this === D && typeof e == "string") return [e];
|
|
179
|
+
if (i = oe(e)) {
|
|
180
|
+
for (n = []; !(r = i.next()).done;) n.push(r.value);
|
|
181
|
+
return n;
|
|
182
|
+
}
|
|
183
|
+
if (e == null || typeof (t = e.length) != "number") return [e];
|
|
184
|
+
for (n = Array(t); t--;) n[t] = e[t];
|
|
185
|
+
return n;
|
|
186
|
+
}
|
|
187
|
+
for (t = arguments.length, n = Array(t); t--;) n[t] = arguments[t];
|
|
188
|
+
return n;
|
|
189
|
+
}
|
|
190
|
+
var k = typeof Symbol < "u" ? function(e) {
|
|
191
|
+
return e[Symbol.toStringTag] === "AsyncFunction";
|
|
192
|
+
} : function() {
|
|
193
|
+
return !1;
|
|
194
|
+
}, se = [
|
|
195
|
+
"Unknown",
|
|
196
|
+
"Constraint",
|
|
197
|
+
"Data",
|
|
198
|
+
"TransactionInactive",
|
|
199
|
+
"ReadOnly",
|
|
200
|
+
"Version",
|
|
201
|
+
"NotFound",
|
|
202
|
+
"InvalidState",
|
|
203
|
+
"InvalidAccess",
|
|
204
|
+
"Abort",
|
|
205
|
+
"Timeout",
|
|
206
|
+
"QuotaExceeded",
|
|
207
|
+
"Syntax",
|
|
208
|
+
"DataClone"
|
|
209
|
+
], A = [
|
|
210
|
+
"Modify",
|
|
211
|
+
"Bulk",
|
|
212
|
+
"OpenFailed",
|
|
213
|
+
"VersionChange",
|
|
214
|
+
"Schema",
|
|
215
|
+
"Upgrade",
|
|
216
|
+
"InvalidTable",
|
|
217
|
+
"MissingAPI",
|
|
218
|
+
"NoSuchDatabase",
|
|
219
|
+
"InvalidArgument",
|
|
220
|
+
"SubTransaction",
|
|
221
|
+
"Unsupported",
|
|
222
|
+
"Internal",
|
|
223
|
+
"DatabaseClosed",
|
|
224
|
+
"PrematureCommit",
|
|
225
|
+
"ForeignAwait"
|
|
226
|
+
].concat(se), ce = {
|
|
227
|
+
VersionChanged: "Database version changed by other database connection",
|
|
228
|
+
DatabaseClosed: "Database has been closed",
|
|
229
|
+
Abort: "Transaction aborted",
|
|
230
|
+
TransactionInactive: "Transaction has already completed or failed",
|
|
231
|
+
MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"
|
|
232
|
+
};
|
|
233
|
+
function j(e, t) {
|
|
234
|
+
this.name = e, this.message = t;
|
|
235
|
+
}
|
|
236
|
+
function le(e, t) {
|
|
237
|
+
return e + ". Errors: " + Object.keys(t).map(function(e) {
|
|
238
|
+
return t[e].toString();
|
|
239
|
+
}).filter(function(e, t, n) {
|
|
240
|
+
return n.indexOf(e) === t;
|
|
241
|
+
}).join("\n");
|
|
242
|
+
}
|
|
243
|
+
function M(e, t, n, r) {
|
|
244
|
+
this.failures = t, this.failedKeys = r, this.successCount = n, this.message = le(e, t);
|
|
245
|
+
}
|
|
246
|
+
function N(e, t) {
|
|
247
|
+
this.name = "BulkError", this.failures = Object.keys(t).map(function(e) {
|
|
248
|
+
return t[e];
|
|
249
|
+
}), this.failuresByPos = t, this.message = le(e, this.failures);
|
|
250
|
+
}
|
|
251
|
+
p(j).from(Error).extend({ toString: function() {
|
|
252
|
+
return this.name + ": " + this.message;
|
|
253
|
+
} }), p(M).from(j), p(N).from(j);
|
|
254
|
+
var ue = A.reduce(function(e, t) {
|
|
255
|
+
return e[t] = t + "Error", e;
|
|
256
|
+
}, {}), de = j, P = A.reduce(function(e, t) {
|
|
257
|
+
var n = t + "Error";
|
|
258
|
+
function r(e, r) {
|
|
259
|
+
this.name = n, e ? typeof e == "string" ? (this.message = `${e}${r ? "\n " + r : ""}`, this.inner = r || null) : typeof e == "object" && (this.message = `${e.name} ${e.message}`, this.inner = e) : (this.message = ce[t] || n, this.inner = null);
|
|
260
|
+
}
|
|
261
|
+
return p(r).from(de), e[t] = r, e;
|
|
262
|
+
}, {});
|
|
263
|
+
P.Syntax = SyntaxError, P.Type = TypeError, P.Range = RangeError;
|
|
264
|
+
var fe = se.reduce(function(e, t) {
|
|
265
|
+
return e[t + "Error"] = P[t], e;
|
|
266
|
+
}, {}), pe = A.reduce(function(e, t) {
|
|
267
|
+
return [
|
|
268
|
+
"Syntax",
|
|
269
|
+
"Type",
|
|
270
|
+
"Range"
|
|
271
|
+
].indexOf(t) === -1 && (e[t + "Error"] = P[t]), e;
|
|
272
|
+
}, {});
|
|
273
|
+
function F() {}
|
|
274
|
+
function me(e) {
|
|
275
|
+
return e;
|
|
276
|
+
}
|
|
277
|
+
function he(e, t) {
|
|
278
|
+
return e == null || e === me ? t : function(n) {
|
|
279
|
+
return t(e(n));
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function ge(e, t) {
|
|
283
|
+
return function() {
|
|
284
|
+
e.apply(this, arguments), t.apply(this, arguments);
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function _e(e, t) {
|
|
288
|
+
return e === F ? t : function() {
|
|
289
|
+
var n = e.apply(this, arguments);
|
|
290
|
+
n !== void 0 && (arguments[0] = n);
|
|
291
|
+
var r = this.onsuccess, i = this.onerror;
|
|
292
|
+
this.onsuccess = null, this.onerror = null;
|
|
293
|
+
var a = t.apply(this, arguments);
|
|
294
|
+
return r && (this.onsuccess = this.onsuccess ? ge(r, this.onsuccess) : r), i && (this.onerror = this.onerror ? ge(i, this.onerror) : i), a === void 0 ? n : a;
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function ve(e, t) {
|
|
298
|
+
return e === F ? t : function() {
|
|
299
|
+
e.apply(this, arguments);
|
|
300
|
+
var n = this.onsuccess, r = this.onerror;
|
|
301
|
+
this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? ge(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? ge(r, this.onerror) : r);
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function ye(e, t) {
|
|
305
|
+
return e === F ? t : function(n) {
|
|
306
|
+
var r = e.apply(this, arguments);
|
|
307
|
+
o(n, r);
|
|
308
|
+
var i = this.onsuccess, a = this.onerror;
|
|
309
|
+
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), i && (this.onsuccess = this.onsuccess ? ge(i, this.onsuccess) : i), a && (this.onerror = this.onerror ? ge(a, this.onerror) : a), r === void 0 ? n === void 0 ? void 0 : n : o(r, n);
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
function be(e, t) {
|
|
313
|
+
return e === F ? t : function() {
|
|
314
|
+
return !1 !== t.apply(this, arguments) && e.apply(this, arguments);
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function xe(e, t) {
|
|
318
|
+
return e === F ? t : function() {
|
|
319
|
+
var n = e.apply(this, arguments);
|
|
320
|
+
if (n && typeof n.then == "function") {
|
|
321
|
+
for (var r = this, i = arguments.length, a = Array(i); i--;) a[i] = arguments[i];
|
|
322
|
+
return n.then(function() {
|
|
323
|
+
return t.apply(r, a);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
return t.apply(this, arguments);
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
pe.ModifyError = M, pe.DexieError = j, pe.BulkError = N;
|
|
330
|
+
var I = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
331
|
+
function Se(e) {
|
|
332
|
+
I = e;
|
|
333
|
+
}
|
|
334
|
+
var Ce = {}, we = 100, te = typeof Promise > "u" ? [] : function() {
|
|
335
|
+
var e = Promise.resolve();
|
|
336
|
+
if (typeof crypto > "u" || !crypto.subtle) return [
|
|
337
|
+
e,
|
|
338
|
+
s(e),
|
|
339
|
+
e
|
|
340
|
+
];
|
|
341
|
+
var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
342
|
+
return [
|
|
343
|
+
t,
|
|
344
|
+
s(t),
|
|
345
|
+
e
|
|
346
|
+
];
|
|
347
|
+
}(), se = te[0], A = te[1], te = te[2], A = A && A.then, Te = se && se.constructor, Ee = !!te, De = function(e, t) {
|
|
348
|
+
Ne.push([e, t]), ke &&= (queueMicrotask(He), !1);
|
|
349
|
+
}, Oe = !0, ke = !0, Ae = [], je = [], Me = me, L = {
|
|
350
|
+
id: "global",
|
|
351
|
+
global: !0,
|
|
352
|
+
ref: 0,
|
|
353
|
+
unhandleds: [],
|
|
354
|
+
onunhandled: F,
|
|
355
|
+
pgp: !1,
|
|
356
|
+
env: {},
|
|
357
|
+
finalize: F
|
|
358
|
+
}, R = L, Ne = [], Pe = 0, Fe = [];
|
|
359
|
+
function z(e) {
|
|
360
|
+
if (typeof this != "object") throw TypeError("Promises must be constructed via new");
|
|
361
|
+
this._listeners = [], this._lib = !1;
|
|
362
|
+
var t = this._PSD = R;
|
|
363
|
+
if (typeof e != "function") {
|
|
364
|
+
if (e !== Ce) throw TypeError("Not a function");
|
|
365
|
+
this._state = arguments[1], this._value = arguments[2], !1 === this._state && Re(this, this._value);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
this._state = null, this._value = null, ++t.ref, function e(t, n) {
|
|
369
|
+
try {
|
|
370
|
+
n(function(n) {
|
|
371
|
+
if (t._state === null) {
|
|
372
|
+
if (n === t) throw TypeError("A promise cannot be resolved with itself.");
|
|
373
|
+
var r = t._lib && Ue();
|
|
374
|
+
n && typeof n.then == "function" ? e(t, function(e, t) {
|
|
375
|
+
n instanceof z ? n._then(e, t) : n.then(e, t);
|
|
376
|
+
}) : (t._state = !0, t._value = n, ze(t)), r && We();
|
|
377
|
+
}
|
|
378
|
+
}, Re.bind(null, t));
|
|
379
|
+
} catch (e) {
|
|
380
|
+
Re(t, e);
|
|
381
|
+
}
|
|
382
|
+
}(this, e);
|
|
383
|
+
}
|
|
384
|
+
var Ie = {
|
|
385
|
+
get: function() {
|
|
386
|
+
var e = R, t = Xe;
|
|
387
|
+
function n(n, r) {
|
|
388
|
+
var i = this, a = !e.global && (e !== R || t !== Xe), o = a && !et(), s = new z(function(t, s) {
|
|
389
|
+
Be(i, new Le(ot(n, e, a, o), ot(r, e, a, o), t, s, e));
|
|
390
|
+
});
|
|
391
|
+
return this._consoleTask && (s._consoleTask = this._consoleTask), s;
|
|
392
|
+
}
|
|
393
|
+
return n.prototype = Ce, n;
|
|
394
|
+
},
|
|
395
|
+
set: function(e) {
|
|
396
|
+
f(this, "then", e && e.prototype === Ce ? Ie : {
|
|
397
|
+
get: function() {
|
|
398
|
+
return e;
|
|
399
|
+
},
|
|
400
|
+
set: Ie.set
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
function Le(e, t, n, r, i) {
|
|
405
|
+
this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = i;
|
|
406
|
+
}
|
|
407
|
+
function Re(e, t) {
|
|
408
|
+
var n, r;
|
|
409
|
+
je.push(t), e._state === null && (n = e._lib && Ue(), t = Me(t), e._state = !1, e._value = t, r = e, Ae.some(function(e) {
|
|
410
|
+
return e._value === r._value;
|
|
411
|
+
}) || Ae.push(r), ze(e), n && We());
|
|
412
|
+
}
|
|
413
|
+
function ze(e) {
|
|
414
|
+
var t = e._listeners;
|
|
415
|
+
e._listeners = [];
|
|
416
|
+
for (var n = 0, r = t.length; n < r; ++n) Be(e, t[n]);
|
|
417
|
+
var i = e._PSD;
|
|
418
|
+
--i.ref || i.finalize(), Pe === 0 && (++Pe, De(function() {
|
|
419
|
+
--Pe == 0 && Ge();
|
|
420
|
+
}, []));
|
|
421
|
+
}
|
|
422
|
+
function Be(e, t) {
|
|
423
|
+
if (e._state !== null) {
|
|
424
|
+
var n = e._state ? t.onFulfilled : t.onRejected;
|
|
425
|
+
if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
|
|
426
|
+
++t.psd.ref, ++Pe, De(Ve, [
|
|
427
|
+
n,
|
|
428
|
+
e,
|
|
429
|
+
t
|
|
430
|
+
]);
|
|
431
|
+
} else e._listeners.push(t);
|
|
432
|
+
}
|
|
433
|
+
function Ve(e, t, n) {
|
|
434
|
+
try {
|
|
435
|
+
var r, i = t._value;
|
|
436
|
+
!t._state && je.length && (je = []), r = I && t._consoleTask ? t._consoleTask.run(function() {
|
|
437
|
+
return e(i);
|
|
438
|
+
}) : e(i), t._state || je.indexOf(i) !== -1 || function(e) {
|
|
439
|
+
for (var t = Ae.length; t;) if (Ae[--t]._value === e._value) return Ae.splice(t, 1);
|
|
440
|
+
}(t), n.resolve(r);
|
|
441
|
+
} catch (e) {
|
|
442
|
+
n.reject(e);
|
|
443
|
+
} finally {
|
|
444
|
+
--Pe == 0 && Ge(), --n.psd.ref || n.psd.finalize();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function He() {
|
|
448
|
+
at(L, function() {
|
|
449
|
+
Ue() && We();
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
function Ue() {
|
|
453
|
+
var e = Oe;
|
|
454
|
+
return ke = Oe = !1, e;
|
|
455
|
+
}
|
|
456
|
+
function We() {
|
|
457
|
+
var e, t, n;
|
|
458
|
+
do
|
|
459
|
+
for (; 0 < Ne.length;) for (e = Ne, Ne = [], n = e.length, t = 0; t < n; ++t) {
|
|
460
|
+
var r = e[t];
|
|
461
|
+
r[0].apply(null, r[1]);
|
|
462
|
+
}
|
|
463
|
+
while (0 < Ne.length);
|
|
464
|
+
ke = Oe = !0;
|
|
465
|
+
}
|
|
466
|
+
function Ge() {
|
|
467
|
+
var e = Ae;
|
|
468
|
+
Ae = [], e.forEach(function(e) {
|
|
469
|
+
e._PSD.onunhandled.call(null, e._value, e);
|
|
470
|
+
});
|
|
471
|
+
for (var t = Fe.slice(0), n = t.length; n;) t[--n]();
|
|
472
|
+
}
|
|
473
|
+
function Ke(e) {
|
|
474
|
+
return new z(Ce, !1, e);
|
|
475
|
+
}
|
|
476
|
+
function B(e, t) {
|
|
477
|
+
var n = R;
|
|
478
|
+
return function() {
|
|
479
|
+
var r = Ue(), i = R;
|
|
480
|
+
try {
|
|
481
|
+
return rt(n, !0), e.apply(this, arguments);
|
|
482
|
+
} catch (e) {
|
|
483
|
+
t && t(e);
|
|
484
|
+
} finally {
|
|
485
|
+
rt(i, !1), r && We();
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
u(z.prototype, {
|
|
490
|
+
then: Ie,
|
|
491
|
+
_then: function(e, t) {
|
|
492
|
+
Be(this, new Le(null, null, e, t, R));
|
|
493
|
+
},
|
|
494
|
+
catch: function(e) {
|
|
495
|
+
if (arguments.length === 1) return this.then(null, e);
|
|
496
|
+
var t = e, n = arguments[1];
|
|
497
|
+
return typeof t == "function" ? this.then(null, function(e) {
|
|
498
|
+
return (e instanceof t ? n : Ke)(e);
|
|
499
|
+
}) : this.then(null, function(e) {
|
|
500
|
+
return (e && e.name === t ? n : Ke)(e);
|
|
501
|
+
});
|
|
502
|
+
},
|
|
503
|
+
finally: function(e) {
|
|
504
|
+
return this.then(function(t) {
|
|
505
|
+
return z.resolve(e()).then(function() {
|
|
506
|
+
return t;
|
|
507
|
+
});
|
|
508
|
+
}, function(t) {
|
|
509
|
+
return z.resolve(e()).then(function() {
|
|
510
|
+
return Ke(t);
|
|
511
|
+
});
|
|
512
|
+
});
|
|
513
|
+
},
|
|
514
|
+
timeout: function(e, t) {
|
|
515
|
+
var n = this;
|
|
516
|
+
return e < Infinity ? new z(function(r, i) {
|
|
517
|
+
var a = setTimeout(function() {
|
|
518
|
+
return i(new P.Timeout(t));
|
|
519
|
+
}, e);
|
|
520
|
+
n.then(r, i).finally(clearTimeout.bind(null, a));
|
|
521
|
+
}) : this;
|
|
522
|
+
}
|
|
523
|
+
}), typeof Symbol < "u" && Symbol.toStringTag && f(z.prototype, Symbol.toStringTag, "Dexie.Promise"), L.env = it(), u(z, {
|
|
524
|
+
all: function() {
|
|
525
|
+
var e = O.apply(null, arguments).map(tt);
|
|
526
|
+
return new z(function(t, n) {
|
|
527
|
+
e.length === 0 && t([]);
|
|
528
|
+
var r = e.length;
|
|
529
|
+
e.forEach(function(i, a) {
|
|
530
|
+
return z.resolve(i).then(function(n) {
|
|
531
|
+
e[a] = n, --r || t(e);
|
|
532
|
+
}, n);
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
},
|
|
536
|
+
resolve: function(e) {
|
|
537
|
+
return e instanceof z ? e : e && typeof e.then == "function" ? new z(function(t, n) {
|
|
538
|
+
e.then(t, n);
|
|
539
|
+
}) : new z(Ce, !0, e);
|
|
540
|
+
},
|
|
541
|
+
reject: Ke,
|
|
542
|
+
race: function() {
|
|
543
|
+
var e = O.apply(null, arguments).map(tt);
|
|
544
|
+
return new z(function(t, n) {
|
|
545
|
+
e.map(function(e) {
|
|
546
|
+
return z.resolve(e).then(t, n);
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
},
|
|
550
|
+
PSD: {
|
|
551
|
+
get: function() {
|
|
552
|
+
return R;
|
|
553
|
+
},
|
|
554
|
+
set: function(e) {
|
|
555
|
+
return R = e;
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
totalEchoes: { get: function() {
|
|
559
|
+
return Xe;
|
|
560
|
+
} },
|
|
561
|
+
newPSD: Qe,
|
|
562
|
+
usePSD: at,
|
|
563
|
+
scheduler: {
|
|
564
|
+
get: function() {
|
|
565
|
+
return De;
|
|
566
|
+
},
|
|
567
|
+
set: function(e) {
|
|
568
|
+
De = e;
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
rejectionMapper: {
|
|
572
|
+
get: function() {
|
|
573
|
+
return Me;
|
|
574
|
+
},
|
|
575
|
+
set: function(e) {
|
|
576
|
+
Me = e;
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
follow: function(e, t) {
|
|
580
|
+
return new z(function(n, r) {
|
|
581
|
+
return Qe(function(t, n) {
|
|
582
|
+
var r = R;
|
|
583
|
+
r.unhandleds = [], r.onunhandled = n, r.finalize = ge(function() {
|
|
584
|
+
var e, r = this;
|
|
585
|
+
e = function() {
|
|
586
|
+
r.unhandleds.length === 0 ? t() : n(r.unhandleds[0]);
|
|
587
|
+
}, Fe.push(function t() {
|
|
588
|
+
e(), Fe.splice(Fe.indexOf(t), 1);
|
|
589
|
+
}), ++Pe, De(function() {
|
|
590
|
+
--Pe == 0 && Ge();
|
|
591
|
+
}, []);
|
|
592
|
+
}, r.finalize), e();
|
|
593
|
+
}, t, n, r);
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
}), Te && (Te.allSettled && f(z, "allSettled", function() {
|
|
597
|
+
var e = O.apply(null, arguments).map(tt);
|
|
598
|
+
return new z(function(t) {
|
|
599
|
+
e.length === 0 && t([]);
|
|
600
|
+
var n = e.length, r = Array(n);
|
|
601
|
+
e.forEach(function(e, i) {
|
|
602
|
+
return z.resolve(e).then(function(e) {
|
|
603
|
+
return r[i] = {
|
|
604
|
+
status: "fulfilled",
|
|
605
|
+
value: e
|
|
606
|
+
};
|
|
607
|
+
}, function(e) {
|
|
608
|
+
return r[i] = {
|
|
609
|
+
status: "rejected",
|
|
610
|
+
reason: e
|
|
611
|
+
};
|
|
612
|
+
}).then(function() {
|
|
613
|
+
return --n || t(r);
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
}), Te.any && typeof AggregateError < "u" && f(z, "any", function() {
|
|
618
|
+
var e = O.apply(null, arguments).map(tt);
|
|
619
|
+
return new z(function(t, n) {
|
|
620
|
+
e.length === 0 && n(/* @__PURE__ */ AggregateError([]));
|
|
621
|
+
var r = e.length, i = Array(r);
|
|
622
|
+
e.forEach(function(e, a) {
|
|
623
|
+
return z.resolve(e).then(function(e) {
|
|
624
|
+
return t(e);
|
|
625
|
+
}, function(e) {
|
|
626
|
+
i[a] = e, --r || n(AggregateError(i));
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
}), Te.withResolvers && (z.withResolvers = Te.withResolvers));
|
|
631
|
+
var V = {
|
|
632
|
+
awaits: 0,
|
|
633
|
+
echoes: 0,
|
|
634
|
+
id: 0
|
|
635
|
+
}, qe = 0, Je = [], Ye = 0, Xe = 0, Ze = 0;
|
|
636
|
+
function Qe(e, t, n, r) {
|
|
637
|
+
var i = R, a = Object.create(i);
|
|
638
|
+
return a.parent = i, a.ref = 0, a.global = !1, a.id = ++Ze, L.env, a.env = Ee ? {
|
|
639
|
+
Promise: z,
|
|
640
|
+
PromiseProp: {
|
|
641
|
+
value: z,
|
|
642
|
+
configurable: !0,
|
|
643
|
+
writable: !0
|
|
644
|
+
},
|
|
645
|
+
all: z.all,
|
|
646
|
+
race: z.race,
|
|
647
|
+
allSettled: z.allSettled,
|
|
648
|
+
any: z.any,
|
|
649
|
+
resolve: z.resolve,
|
|
650
|
+
reject: z.reject
|
|
651
|
+
} : {}, t && o(a, t), ++i.ref, a.finalize = function() {
|
|
652
|
+
--this.parent.ref || this.parent.finalize();
|
|
653
|
+
}, r = at(a, e, n, r), a.ref === 0 && a.finalize(), r;
|
|
654
|
+
}
|
|
655
|
+
function $e() {
|
|
656
|
+
return V.id ||= ++qe, ++V.awaits, V.echoes += we, V.id;
|
|
657
|
+
}
|
|
658
|
+
function et() {
|
|
659
|
+
return !!V.awaits && (--V.awaits == 0 && (V.id = 0), V.echoes = V.awaits * we, !0);
|
|
660
|
+
}
|
|
661
|
+
function tt(e) {
|
|
662
|
+
return V.echoes && e && e.constructor === Te ? ($e(), e.then(function(e) {
|
|
663
|
+
return et(), e;
|
|
664
|
+
}, function(e) {
|
|
665
|
+
return et(), H(e);
|
|
666
|
+
})) : e;
|
|
667
|
+
}
|
|
668
|
+
function nt() {
|
|
669
|
+
var e = Je[Je.length - 1];
|
|
670
|
+
Je.pop(), rt(e, !1);
|
|
671
|
+
}
|
|
672
|
+
function rt(e, t) {
|
|
673
|
+
var n, i = R;
|
|
674
|
+
(t ? !V.echoes || Ye++ && e === R : !Ye || --Ye && e === R) || queueMicrotask(t ? function(e) {
|
|
675
|
+
++Xe, V.echoes && --V.echoes != 0 || (V.echoes = V.awaits = V.id = 0), Je.push(R), rt(e, !0);
|
|
676
|
+
}.bind(null, e) : nt), e !== R && (R = e, i === L && (L.env = it()), Ee && (n = L.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(r, "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))));
|
|
677
|
+
}
|
|
678
|
+
function it() {
|
|
679
|
+
var e = r.Promise;
|
|
680
|
+
return Ee ? {
|
|
681
|
+
Promise: e,
|
|
682
|
+
PromiseProp: Object.getOwnPropertyDescriptor(r, "Promise"),
|
|
683
|
+
all: e.all,
|
|
684
|
+
race: e.race,
|
|
685
|
+
allSettled: e.allSettled,
|
|
686
|
+
any: e.any,
|
|
687
|
+
resolve: e.resolve,
|
|
688
|
+
reject: e.reject
|
|
689
|
+
} : {};
|
|
690
|
+
}
|
|
691
|
+
function at(e, t, n, r, i) {
|
|
692
|
+
var a = R;
|
|
693
|
+
try {
|
|
694
|
+
return rt(e, !0), t(n, r, i);
|
|
695
|
+
} finally {
|
|
696
|
+
rt(a, !1);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function ot(e, t, n, r) {
|
|
700
|
+
return typeof e == "function" ? function() {
|
|
701
|
+
var i = R;
|
|
702
|
+
n && $e(), rt(t, !0);
|
|
703
|
+
try {
|
|
704
|
+
return e.apply(this, arguments);
|
|
705
|
+
} finally {
|
|
706
|
+
rt(i, !1), r && queueMicrotask(et);
|
|
707
|
+
}
|
|
708
|
+
} : e;
|
|
709
|
+
}
|
|
710
|
+
function st(e) {
|
|
711
|
+
Promise === Te && V.echoes === 0 ? Ye === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
712
|
+
}
|
|
713
|
+
("" + A).indexOf("[native code]") === -1 && ($e = et = F);
|
|
714
|
+
var H = z.reject, ct = "", U = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", lt = "String expected.", ut = [], dt = "__dbnames", ft = "readonly", pt = "readwrite";
|
|
715
|
+
function mt(e, t) {
|
|
716
|
+
return e ? t ? function() {
|
|
717
|
+
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
718
|
+
} : e : t;
|
|
719
|
+
}
|
|
720
|
+
var ht = {
|
|
721
|
+
type: 3,
|
|
722
|
+
lower: -Infinity,
|
|
723
|
+
lowerOpen: !1,
|
|
724
|
+
upper: [[]],
|
|
725
|
+
upperOpen: !1
|
|
726
|
+
};
|
|
727
|
+
function gt(e) {
|
|
728
|
+
return typeof e != "string" || /\./.test(e) ? function(e) {
|
|
729
|
+
return e;
|
|
730
|
+
} : function(t) {
|
|
731
|
+
return t[e] === void 0 && e in t && delete (t = T(t))[e], t;
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
function _t() {
|
|
735
|
+
throw P.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.");
|
|
736
|
+
}
|
|
737
|
+
function W(e, t) {
|
|
738
|
+
try {
|
|
739
|
+
var n = vt(e), r = vt(t);
|
|
740
|
+
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" ? -1 : NaN;
|
|
741
|
+
switch (n) {
|
|
742
|
+
case "number":
|
|
743
|
+
case "Date":
|
|
744
|
+
case "string": return t < e ? 1 : e < t ? -1 : 0;
|
|
745
|
+
case "binary": return function(e, t) {
|
|
746
|
+
for (var n = e.length, r = t.length, i = n < r ? n : r, a = 0; a < i; ++a) if (e[a] !== t[a]) return e[a] < t[a] ? -1 : 1;
|
|
747
|
+
return n === r ? 0 : n < r ? -1 : 1;
|
|
748
|
+
}(yt(e), yt(t));
|
|
749
|
+
case "Array": return function(e, t) {
|
|
750
|
+
for (var n = e.length, r = t.length, i = n < r ? n : r, a = 0; a < i; ++a) {
|
|
751
|
+
var o = W(e[a], t[a]);
|
|
752
|
+
if (o !== 0) return o;
|
|
753
|
+
}
|
|
754
|
+
return n === r ? 0 : n < r ? -1 : 1;
|
|
755
|
+
}(e, t);
|
|
756
|
+
}
|
|
757
|
+
} catch {}
|
|
758
|
+
return NaN;
|
|
759
|
+
}
|
|
760
|
+
function vt(e) {
|
|
761
|
+
var t = typeof e;
|
|
762
|
+
return t == "object" ? ArrayBuffer.isView(e) ? "binary" : (e = ie(e), e === "ArrayBuffer" ? "binary" : e) : t;
|
|
763
|
+
}
|
|
764
|
+
function yt(e) {
|
|
765
|
+
return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
|
|
766
|
+
}
|
|
767
|
+
function bt(e, t, n) {
|
|
768
|
+
var r = e.schema.yProps;
|
|
769
|
+
return r ? (t && 0 < n.numFailures && (t = t.filter(function(e, t) {
|
|
770
|
+
return !n.failures[t];
|
|
771
|
+
})), Promise.all(r.map(function(n) {
|
|
772
|
+
return n = n.updatesTable, t ? e.db.table(n).where("k").anyOf(t).delete() : e.db.table(n).clear();
|
|
773
|
+
})).then(function() {
|
|
774
|
+
return n;
|
|
775
|
+
})) : n;
|
|
776
|
+
}
|
|
777
|
+
var xt = (G.prototype._trans = function(e, t, n) {
|
|
778
|
+
var r = this._tx || R.trans, i = this.name, a = I && typeof console < "u" && console.createTask && console.createTask(`Dexie: ${e === "readonly" ? "read" : "write"} ${this.name}`);
|
|
779
|
+
function o(e, n, r) {
|
|
780
|
+
if (!r.schema[i]) throw new P.NotFound("Table " + i + " not part of transaction");
|
|
781
|
+
return t(r.idbtrans, r);
|
|
782
|
+
}
|
|
783
|
+
var s = Ue();
|
|
784
|
+
try {
|
|
785
|
+
var c = r && r.db._novip === this.db._novip ? r === R.trans ? r._promise(e, o, n) : Qe(function() {
|
|
786
|
+
return r._promise(e, o, n);
|
|
787
|
+
}, {
|
|
788
|
+
trans: r,
|
|
789
|
+
transless: R.transless || R
|
|
790
|
+
}) : function e(t, n, r, i) {
|
|
791
|
+
if (t.idbdb && (t._state.openComplete || R.letThrough || t._vip)) {
|
|
792
|
+
var a = t._createTransaction(n, r, t._dbSchema);
|
|
793
|
+
try {
|
|
794
|
+
a.create(), t._state.PR1398_maxLoop = 3;
|
|
795
|
+
} catch (a) {
|
|
796
|
+
return a.name === ue.InvalidState && t.isOpen() && 0 < --t._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), t.close({ disableAutoOpen: !1 }), t.open().then(function() {
|
|
797
|
+
return e(t, n, r, i);
|
|
798
|
+
})) : H(a);
|
|
799
|
+
}
|
|
800
|
+
return a._promise(n, function(e, t) {
|
|
801
|
+
return Qe(function() {
|
|
802
|
+
return R.trans = a, i(e, t, a);
|
|
803
|
+
});
|
|
804
|
+
}).then(function(e) {
|
|
805
|
+
if (n === "readwrite") try {
|
|
806
|
+
a.idbtrans.commit();
|
|
807
|
+
} catch {}
|
|
808
|
+
return n === "readonly" ? e : a._completion.then(function() {
|
|
809
|
+
return e;
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
if (t._state.openComplete) return H(new P.DatabaseClosed(t._state.dbOpenError));
|
|
814
|
+
if (!t._state.isBeingOpened) {
|
|
815
|
+
if (!t._state.autoOpen) return H(new P.DatabaseClosed());
|
|
816
|
+
t.open().catch(F);
|
|
817
|
+
}
|
|
818
|
+
return t._state.dbReadyPromise.then(function() {
|
|
819
|
+
return e(t, n, r, i);
|
|
820
|
+
});
|
|
821
|
+
}(this.db, e, [this.name], o);
|
|
822
|
+
return a && (c._consoleTask = a, c = c.catch(function(e) {
|
|
823
|
+
return console.trace(e), H(e);
|
|
824
|
+
})), c;
|
|
825
|
+
} finally {
|
|
826
|
+
s && We();
|
|
827
|
+
}
|
|
828
|
+
}, G.prototype.get = function(e, t) {
|
|
829
|
+
var n = this;
|
|
830
|
+
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? H(new P.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(t) {
|
|
831
|
+
return n.core.get({
|
|
832
|
+
trans: t,
|
|
833
|
+
key: e
|
|
834
|
+
}).then(function(e) {
|
|
835
|
+
return n.hook.reading.fire(e);
|
|
836
|
+
});
|
|
837
|
+
}).then(t);
|
|
838
|
+
}, G.prototype.where = function(e) {
|
|
839
|
+
if (typeof e == "string") return new this.db.WhereClause(this, e);
|
|
840
|
+
if (a(e)) return new this.db.WhereClause(this, `[${e.join("+")}]`);
|
|
841
|
+
var t = i(e);
|
|
842
|
+
if (t.length === 1) return this.where(t[0]).equals(e[t[0]]);
|
|
843
|
+
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(e) {
|
|
844
|
+
if (e.compound && t.every(function(t) {
|
|
845
|
+
return 0 <= e.keyPath.indexOf(t);
|
|
846
|
+
})) {
|
|
847
|
+
for (var n = 0; n < t.length; ++n) if (t.indexOf(e.keyPath[n]) === -1) return !1;
|
|
848
|
+
return !0;
|
|
849
|
+
}
|
|
850
|
+
return !1;
|
|
851
|
+
}).sort(function(e, t) {
|
|
852
|
+
return e.keyPath.length - t.keyPath.length;
|
|
853
|
+
})[0];
|
|
854
|
+
if (n && this.db._maxKey !== ct) {
|
|
855
|
+
var r = n.keyPath.slice(0, t.length);
|
|
856
|
+
return this.where(r).equals(r.map(function(t) {
|
|
857
|
+
return e[t];
|
|
858
|
+
}));
|
|
859
|
+
}
|
|
860
|
+
!n && I && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit from a compound index [${t.join("+")}]`);
|
|
861
|
+
var o = this.schema.idxByName;
|
|
862
|
+
function s(e, t) {
|
|
863
|
+
return W(e, t) === 0;
|
|
864
|
+
}
|
|
865
|
+
var c = t.reduce(function(t, n) {
|
|
866
|
+
var r = t[0], i = t[1], t = o[n], c = e[n];
|
|
867
|
+
return [r || t, r || !t ? mt(i, t && t.multi ? function(e) {
|
|
868
|
+
return e = b(e, n), a(e) && e.some(function(e) {
|
|
869
|
+
return s(c, e);
|
|
870
|
+
});
|
|
871
|
+
} : function(e) {
|
|
872
|
+
return s(c, b(e, n));
|
|
873
|
+
}) : i];
|
|
874
|
+
}, [null, null]), r = c[0], c = c[1];
|
|
875
|
+
return r ? this.where(r.name).equals(e[r.keyPath]).filter(c) : n ? this.filter(c) : this.where(t).equals("");
|
|
876
|
+
}, G.prototype.filter = function(e) {
|
|
877
|
+
return this.toCollection().and(e);
|
|
878
|
+
}, G.prototype.count = function(e) {
|
|
879
|
+
return this.toCollection().count(e);
|
|
880
|
+
}, G.prototype.offset = function(e) {
|
|
881
|
+
return this.toCollection().offset(e);
|
|
882
|
+
}, G.prototype.limit = function(e) {
|
|
883
|
+
return this.toCollection().limit(e);
|
|
884
|
+
}, G.prototype.each = function(e) {
|
|
885
|
+
return this.toCollection().each(e);
|
|
886
|
+
}, G.prototype.toArray = function(e) {
|
|
887
|
+
return this.toCollection().toArray(e);
|
|
888
|
+
}, G.prototype.toCollection = function() {
|
|
889
|
+
return new this.db.Collection(new this.db.WhereClause(this));
|
|
890
|
+
}, G.prototype.orderBy = function(e) {
|
|
891
|
+
return new this.db.Collection(new this.db.WhereClause(this, a(e) ? `[${e.join("+")}]` : e));
|
|
892
|
+
}, G.prototype.reverse = function() {
|
|
893
|
+
return this.toCollection().reverse();
|
|
894
|
+
}, G.prototype.mapToClass = function(t) {
|
|
895
|
+
var n, r = this.db, i = this.name;
|
|
896
|
+
function a() {
|
|
897
|
+
return n !== null && n.apply(this, arguments) || this;
|
|
898
|
+
}
|
|
899
|
+
(this.schema.mappedClass = t).prototype instanceof _t && (function(t, n) {
|
|
900
|
+
if (typeof n != "function" && n !== null) throw TypeError("Class extends value " + String(n) + " is not a constructor or null");
|
|
901
|
+
function r() {
|
|
902
|
+
this.constructor = t;
|
|
903
|
+
}
|
|
904
|
+
e(t, n), t.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
|
|
905
|
+
}(a, n = t), Object.defineProperty(a.prototype, "db", {
|
|
906
|
+
get: function() {
|
|
907
|
+
return r;
|
|
908
|
+
},
|
|
909
|
+
enumerable: !1,
|
|
910
|
+
configurable: !0
|
|
911
|
+
}), a.prototype.table = function() {
|
|
912
|
+
return i;
|
|
913
|
+
}, t = a);
|
|
914
|
+
for (var o = /* @__PURE__ */ new Set(), c = t.prototype; c; c = s(c)) Object.getOwnPropertyNames(c).forEach(function(e) {
|
|
915
|
+
return o.add(e);
|
|
916
|
+
});
|
|
917
|
+
function l(e) {
|
|
918
|
+
if (!e) return e;
|
|
919
|
+
var n, r = Object.create(t.prototype);
|
|
920
|
+
for (n in e) if (!o.has(n)) try {
|
|
921
|
+
r[n] = e[n];
|
|
922
|
+
} catch {}
|
|
923
|
+
return r;
|
|
924
|
+
}
|
|
925
|
+
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = l, this.hook("reading", l), t;
|
|
926
|
+
}, G.prototype.defineClass = function() {
|
|
927
|
+
return this.mapToClass(function(e) {
|
|
928
|
+
o(this, e);
|
|
929
|
+
});
|
|
930
|
+
}, G.prototype.add = function(e, t) {
|
|
931
|
+
var n = this, r = this.schema.primKey, i = r.auto, a = r.keyPath, o = e;
|
|
932
|
+
return a && i && (o = gt(a)(e)), this._trans("readwrite", function(e) {
|
|
933
|
+
return n.core.mutate({
|
|
934
|
+
trans: e,
|
|
935
|
+
type: "add",
|
|
936
|
+
keys: t == null ? null : [t],
|
|
937
|
+
values: [o]
|
|
938
|
+
});
|
|
939
|
+
}).then(function(e) {
|
|
940
|
+
return e.numFailures ? z.reject(e.failures[0]) : e.lastResult;
|
|
941
|
+
}).then(function(t) {
|
|
942
|
+
if (a) try {
|
|
943
|
+
x(e, a, t);
|
|
944
|
+
} catch {}
|
|
945
|
+
return t;
|
|
946
|
+
});
|
|
947
|
+
}, G.prototype.update = function(e, t) {
|
|
948
|
+
return typeof e != "object" || a(e) ? this.where(":id").equals(e).modify(t) : (e = b(e, this.schema.primKey.keyPath), e === void 0 ? H(new P.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
949
|
+
}, G.prototype.put = function(e, t) {
|
|
950
|
+
var n = this, r = this.schema.primKey, i = r.auto, a = r.keyPath, o = e;
|
|
951
|
+
return a && i && (o = gt(a)(e)), this._trans("readwrite", function(e) {
|
|
952
|
+
return n.core.mutate({
|
|
953
|
+
trans: e,
|
|
954
|
+
type: "put",
|
|
955
|
+
values: [o],
|
|
956
|
+
keys: t == null ? null : [t]
|
|
957
|
+
});
|
|
958
|
+
}).then(function(e) {
|
|
959
|
+
return e.numFailures ? z.reject(e.failures[0]) : e.lastResult;
|
|
960
|
+
}).then(function(t) {
|
|
961
|
+
if (a) try {
|
|
962
|
+
x(e, a, t);
|
|
963
|
+
} catch {}
|
|
964
|
+
return t;
|
|
965
|
+
});
|
|
966
|
+
}, G.prototype.delete = function(e) {
|
|
967
|
+
var t = this;
|
|
968
|
+
return this._trans("readwrite", function(n) {
|
|
969
|
+
return t.core.mutate({
|
|
970
|
+
trans: n,
|
|
971
|
+
type: "delete",
|
|
972
|
+
keys: [e]
|
|
973
|
+
}).then(function(n) {
|
|
974
|
+
return bt(t, [e], n);
|
|
975
|
+
}).then(function(e) {
|
|
976
|
+
return e.numFailures ? z.reject(e.failures[0]) : void 0;
|
|
977
|
+
});
|
|
978
|
+
});
|
|
979
|
+
}, G.prototype.clear = function() {
|
|
980
|
+
var e = this;
|
|
981
|
+
return this._trans("readwrite", function(t) {
|
|
982
|
+
return e.core.mutate({
|
|
983
|
+
trans: t,
|
|
984
|
+
type: "deleteRange",
|
|
985
|
+
range: ht
|
|
986
|
+
}).then(function(t) {
|
|
987
|
+
return bt(e, null, t);
|
|
988
|
+
});
|
|
989
|
+
}).then(function(e) {
|
|
990
|
+
return e.numFailures ? z.reject(e.failures[0]) : void 0;
|
|
991
|
+
});
|
|
992
|
+
}, G.prototype.bulkGet = function(e) {
|
|
993
|
+
var t = this;
|
|
994
|
+
return this._trans("readonly", function(n) {
|
|
995
|
+
return t.core.getMany({
|
|
996
|
+
keys: e,
|
|
997
|
+
trans: n
|
|
998
|
+
}).then(function(e) {
|
|
999
|
+
return e.map(function(e) {
|
|
1000
|
+
return t.hook.reading.fire(e);
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
});
|
|
1004
|
+
}, G.prototype.bulkAdd = function(e, t, n) {
|
|
1005
|
+
var r = this, i = Array.isArray(t) ? t : void 0, a = (n ||= i ? void 0 : t) ? n.allKeys : void 0;
|
|
1006
|
+
return this._trans("readwrite", function(t) {
|
|
1007
|
+
var n = r.schema.primKey, o = n.auto, n = n.keyPath;
|
|
1008
|
+
if (n && i) throw new P.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
1009
|
+
if (i && i.length !== e.length) throw new P.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1010
|
+
var s = e.length, n = n && o ? e.map(gt(n)) : e;
|
|
1011
|
+
return r.core.mutate({
|
|
1012
|
+
trans: t,
|
|
1013
|
+
type: "add",
|
|
1014
|
+
keys: i,
|
|
1015
|
+
values: n,
|
|
1016
|
+
wantResults: a
|
|
1017
|
+
}).then(function(e) {
|
|
1018
|
+
var t = e.numFailures, n = e.results, i = e.lastResult, e = e.failures;
|
|
1019
|
+
if (t === 0) return a ? n : i;
|
|
1020
|
+
throw new N(`${r.name}.bulkAdd(): ${t} of ${s} operations failed`, e);
|
|
1021
|
+
});
|
|
1022
|
+
});
|
|
1023
|
+
}, G.prototype.bulkPut = function(e, t, n) {
|
|
1024
|
+
var r = this, i = Array.isArray(t) ? t : void 0, a = (n ||= i ? void 0 : t) ? n.allKeys : void 0;
|
|
1025
|
+
return this._trans("readwrite", function(t) {
|
|
1026
|
+
var n = r.schema.primKey, o = n.auto, n = n.keyPath;
|
|
1027
|
+
if (n && i) throw new P.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
1028
|
+
if (i && i.length !== e.length) throw new P.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1029
|
+
var s = e.length, n = n && o ? e.map(gt(n)) : e;
|
|
1030
|
+
return r.core.mutate({
|
|
1031
|
+
trans: t,
|
|
1032
|
+
type: "put",
|
|
1033
|
+
keys: i,
|
|
1034
|
+
values: n,
|
|
1035
|
+
wantResults: a
|
|
1036
|
+
}).then(function(e) {
|
|
1037
|
+
var t = e.numFailures, n = e.results, i = e.lastResult, e = e.failures;
|
|
1038
|
+
if (t === 0) return a ? n : i;
|
|
1039
|
+
throw new N(`${r.name}.bulkPut(): ${t} of ${s} operations failed`, e);
|
|
1040
|
+
});
|
|
1041
|
+
});
|
|
1042
|
+
}, G.prototype.bulkUpdate = function(e) {
|
|
1043
|
+
var t = this, n = this.core, r = e.map(function(e) {
|
|
1044
|
+
return e.key;
|
|
1045
|
+
}), i = e.map(function(e) {
|
|
1046
|
+
return e.changes;
|
|
1047
|
+
}), a = [];
|
|
1048
|
+
return this._trans("readwrite", function(o) {
|
|
1049
|
+
return n.getMany({
|
|
1050
|
+
trans: o,
|
|
1051
|
+
keys: r,
|
|
1052
|
+
cache: "clone"
|
|
1053
|
+
}).then(function(s) {
|
|
1054
|
+
var c = [], l = [];
|
|
1055
|
+
e.forEach(function(e, n) {
|
|
1056
|
+
var r = e.key, i = e.changes, o = s[n];
|
|
1057
|
+
if (o) {
|
|
1058
|
+
for (var u = 0, d = Object.keys(i); u < d.length; u++) {
|
|
1059
|
+
var f = d[u], p = i[f];
|
|
1060
|
+
if (f === t.schema.primKey.keyPath) {
|
|
1061
|
+
if (W(p, r) !== 0) throw new P.Constraint("Cannot update primary key in bulkUpdate()");
|
|
1062
|
+
} else x(o, f, p);
|
|
1063
|
+
}
|
|
1064
|
+
a.push(n), c.push(r), l.push(o);
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
var u = c.length;
|
|
1068
|
+
return n.mutate({
|
|
1069
|
+
trans: o,
|
|
1070
|
+
type: "put",
|
|
1071
|
+
keys: c,
|
|
1072
|
+
values: l,
|
|
1073
|
+
updates: {
|
|
1074
|
+
keys: r,
|
|
1075
|
+
changeSpecs: i
|
|
1076
|
+
}
|
|
1077
|
+
}).then(function(e) {
|
|
1078
|
+
var n = e.numFailures, r = e.failures;
|
|
1079
|
+
if (n === 0) return u;
|
|
1080
|
+
for (var i = 0, o = Object.keys(r); i < o.length; i++) {
|
|
1081
|
+
var s, c = o[i], l = a[Number(c)];
|
|
1082
|
+
l != null && (s = r[c], delete r[c], r[l] = s);
|
|
1083
|
+
}
|
|
1084
|
+
throw new N(`${t.name}.bulkUpdate(): ${n} of ${u} operations failed`, r);
|
|
1085
|
+
});
|
|
1086
|
+
});
|
|
1087
|
+
});
|
|
1088
|
+
}, G.prototype.bulkDelete = function(e) {
|
|
1089
|
+
var t = this, n = e.length;
|
|
1090
|
+
return this._trans("readwrite", function(n) {
|
|
1091
|
+
return t.core.mutate({
|
|
1092
|
+
trans: n,
|
|
1093
|
+
type: "delete",
|
|
1094
|
+
keys: e
|
|
1095
|
+
}).then(function(n) {
|
|
1096
|
+
return bt(t, e, n);
|
|
1097
|
+
});
|
|
1098
|
+
}).then(function(e) {
|
|
1099
|
+
var r = e.numFailures, i = e.lastResult, e = e.failures;
|
|
1100
|
+
if (r === 0) return i;
|
|
1101
|
+
throw new N(`${t.name}.bulkDelete(): ${r} of ${n} operations failed`, e);
|
|
1102
|
+
});
|
|
1103
|
+
}, G);
|
|
1104
|
+
function G() {}
|
|
1105
|
+
function St(e) {
|
|
1106
|
+
function t(t, r) {
|
|
1107
|
+
if (r) {
|
|
1108
|
+
for (var i = arguments.length, a = Array(i - 1); --i;) a[i - 1] = arguments[i];
|
|
1109
|
+
return n[t].subscribe.apply(null, a), e;
|
|
1110
|
+
}
|
|
1111
|
+
if (typeof t == "string") return n[t];
|
|
1112
|
+
}
|
|
1113
|
+
var n = {};
|
|
1114
|
+
t.addEventType = s;
|
|
1115
|
+
for (var r = 1, o = arguments.length; r < o; ++r) s(arguments[r]);
|
|
1116
|
+
return t;
|
|
1117
|
+
function s(e, r, o) {
|
|
1118
|
+
if (typeof e != "object") {
|
|
1119
|
+
var c;
|
|
1120
|
+
r ||= be;
|
|
1121
|
+
var l = {
|
|
1122
|
+
subscribers: [],
|
|
1123
|
+
fire: o ||= F,
|
|
1124
|
+
subscribe: function(e) {
|
|
1125
|
+
l.subscribers.indexOf(e) === -1 && (l.subscribers.push(e), l.fire = r(l.fire, e));
|
|
1126
|
+
},
|
|
1127
|
+
unsubscribe: function(e) {
|
|
1128
|
+
l.subscribers = l.subscribers.filter(function(t) {
|
|
1129
|
+
return t !== e;
|
|
1130
|
+
}), l.fire = l.subscribers.reduce(r, o);
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
return n[e] = t[e] = l;
|
|
1134
|
+
}
|
|
1135
|
+
i(c = e).forEach(function(e) {
|
|
1136
|
+
var t = c[e];
|
|
1137
|
+
if (a(t)) s(e, c[e][0], c[e][1]);
|
|
1138
|
+
else {
|
|
1139
|
+
if (t !== "asap") throw new P.InvalidArgument("Invalid event config");
|
|
1140
|
+
var n = s(e, me, function() {
|
|
1141
|
+
for (var e = arguments.length, t = Array(e); e--;) t[e] = arguments[e];
|
|
1142
|
+
n.subscribers.forEach(function(e) {
|
|
1143
|
+
y(function() {
|
|
1144
|
+
e.apply(null, t);
|
|
1145
|
+
});
|
|
1146
|
+
});
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
function Ct(e, t) {
|
|
1153
|
+
return p(t).from({ prototype: e }), t;
|
|
1154
|
+
}
|
|
1155
|
+
function wt(e, t) {
|
|
1156
|
+
return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter);
|
|
1157
|
+
}
|
|
1158
|
+
function Tt(e, t) {
|
|
1159
|
+
e.filter = mt(e.filter, t);
|
|
1160
|
+
}
|
|
1161
|
+
function Et(e, t, n) {
|
|
1162
|
+
var r = e.replayFilter;
|
|
1163
|
+
e.replayFilter = r ? function() {
|
|
1164
|
+
return mt(r(), t());
|
|
1165
|
+
} : t, e.justLimit = n && !r;
|
|
1166
|
+
}
|
|
1167
|
+
function Dt(e, t) {
|
|
1168
|
+
if (e.isPrimKey) return t.primaryKey;
|
|
1169
|
+
var n = t.getIndexByKeyPath(e.index);
|
|
1170
|
+
if (!n) throw new P.Schema("KeyPath " + e.index + " on object store " + t.name + " is not indexed");
|
|
1171
|
+
return n;
|
|
1172
|
+
}
|
|
1173
|
+
function Ot(e, t, n) {
|
|
1174
|
+
var r = Dt(e, t.schema);
|
|
1175
|
+
return t.openCursor({
|
|
1176
|
+
trans: n,
|
|
1177
|
+
values: !e.keysOnly,
|
|
1178
|
+
reverse: e.dir === "prev",
|
|
1179
|
+
unique: !!e.unique,
|
|
1180
|
+
query: {
|
|
1181
|
+
index: r,
|
|
1182
|
+
range: e.range
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
function kt(e, t, n, r) {
|
|
1187
|
+
var i = e.replayFilter ? mt(e.filter, e.replayFilter()) : e.filter;
|
|
1188
|
+
if (e.or) {
|
|
1189
|
+
var a = {}, o = function(e, n, r) {
|
|
1190
|
+
var o, s;
|
|
1191
|
+
i && !i(n, r, function(e) {
|
|
1192
|
+
return n.stop(e);
|
|
1193
|
+
}, function(e) {
|
|
1194
|
+
return n.fail(e);
|
|
1195
|
+
}) || ((s = "" + (o = n.primaryKey)) == "[object ArrayBuffer]" && (s = "" + new Uint8Array(o)), l(a, s) || (a[s] = !0, t(e, n, r)));
|
|
1196
|
+
};
|
|
1197
|
+
return Promise.all([e.or._iterate(o, n), At(Ot(e, r, n), e.algorithm, o, !e.keysOnly && e.valueMapper)]);
|
|
1198
|
+
}
|
|
1199
|
+
return At(Ot(e, r, n), mt(e.algorithm, i), t, !e.keysOnly && e.valueMapper);
|
|
1200
|
+
}
|
|
1201
|
+
function At(e, t, n, r) {
|
|
1202
|
+
var i = B(r ? function(e, t, i) {
|
|
1203
|
+
return n(r(e), t, i);
|
|
1204
|
+
} : n);
|
|
1205
|
+
return e.then(function(e) {
|
|
1206
|
+
if (e) return e.start(function() {
|
|
1207
|
+
var n = function() {
|
|
1208
|
+
return e.continue();
|
|
1209
|
+
};
|
|
1210
|
+
t && !t(e, function(e) {
|
|
1211
|
+
return n = e;
|
|
1212
|
+
}, function(t) {
|
|
1213
|
+
e.stop(t), n = F;
|
|
1214
|
+
}, function(t) {
|
|
1215
|
+
e.fail(t), n = F;
|
|
1216
|
+
}) || i(e.value, e, function(e) {
|
|
1217
|
+
return n = e;
|
|
1218
|
+
}), n();
|
|
1219
|
+
});
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
var jt = (Mt.prototype.execute = function(e) {
|
|
1223
|
+
var t = this["@@propmod"];
|
|
1224
|
+
if (t.add !== void 0) {
|
|
1225
|
+
var r = t.add;
|
|
1226
|
+
if (a(r)) return n(n([], a(e) ? e : [], !0), r, !0).sort();
|
|
1227
|
+
if (typeof r == "number") return (Number(e) || 0) + r;
|
|
1228
|
+
if (typeof r == "bigint") try {
|
|
1229
|
+
return BigInt(e) + r;
|
|
1230
|
+
} catch {
|
|
1231
|
+
return BigInt(0) + r;
|
|
1232
|
+
}
|
|
1233
|
+
throw TypeError(`Invalid term ${r}`);
|
|
1234
|
+
}
|
|
1235
|
+
if (t.remove !== void 0) {
|
|
1236
|
+
var i = t.remove;
|
|
1237
|
+
if (a(i)) return a(e) ? e.filter(function(e) {
|
|
1238
|
+
return !i.includes(e);
|
|
1239
|
+
}).sort() : [];
|
|
1240
|
+
if (typeof i == "number") return Number(e) - i;
|
|
1241
|
+
if (typeof i == "bigint") try {
|
|
1242
|
+
return BigInt(e) - i;
|
|
1243
|
+
} catch {
|
|
1244
|
+
return BigInt(0) - i;
|
|
1245
|
+
}
|
|
1246
|
+
throw TypeError(`Invalid subtrahend ${i}`);
|
|
1247
|
+
}
|
|
1248
|
+
return r = (r = t.replacePrefix)?.[0], r && typeof e == "string" && e.startsWith(r) ? t.replacePrefix[1] + e.substring(r.length) : e;
|
|
1249
|
+
}, Mt);
|
|
1250
|
+
function Mt(e) {
|
|
1251
|
+
this["@@propmod"] = e;
|
|
1252
|
+
}
|
|
1253
|
+
var Nt = (K.prototype._read = function(e, t) {
|
|
1254
|
+
var n = this._ctx;
|
|
1255
|
+
return n.error ? n.table._trans(null, H.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
|
|
1256
|
+
}, K.prototype._write = function(e) {
|
|
1257
|
+
var t = this._ctx;
|
|
1258
|
+
return t.error ? t.table._trans(null, H.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
|
|
1259
|
+
}, K.prototype._addAlgorithm = function(e) {
|
|
1260
|
+
var t = this._ctx;
|
|
1261
|
+
t.algorithm = mt(t.algorithm, e);
|
|
1262
|
+
}, K.prototype._iterate = function(e, t) {
|
|
1263
|
+
return kt(this._ctx, e, t, this._ctx.table.core);
|
|
1264
|
+
}, K.prototype.clone = function(e) {
|
|
1265
|
+
var t = Object.create(this.constructor.prototype), n = Object.create(this._ctx);
|
|
1266
|
+
return e && o(n, e), t._ctx = n, t;
|
|
1267
|
+
}, K.prototype.raw = function() {
|
|
1268
|
+
return this._ctx.valueMapper = null, this;
|
|
1269
|
+
}, K.prototype.each = function(e) {
|
|
1270
|
+
var t = this._ctx;
|
|
1271
|
+
return this._read(function(n) {
|
|
1272
|
+
return kt(t, e, n, t.table.core);
|
|
1273
|
+
});
|
|
1274
|
+
}, K.prototype.count = function(e) {
|
|
1275
|
+
var t = this;
|
|
1276
|
+
return this._read(function(e) {
|
|
1277
|
+
var n = t._ctx, r = n.table.core;
|
|
1278
|
+
if (wt(n, !0)) return r.count({
|
|
1279
|
+
trans: e,
|
|
1280
|
+
query: {
|
|
1281
|
+
index: Dt(n, r.schema),
|
|
1282
|
+
range: n.range
|
|
1283
|
+
}
|
|
1284
|
+
}).then(function(e) {
|
|
1285
|
+
return Math.min(e, n.limit);
|
|
1286
|
+
});
|
|
1287
|
+
var i = 0;
|
|
1288
|
+
return kt(n, function() {
|
|
1289
|
+
return ++i, !1;
|
|
1290
|
+
}, e, r).then(function() {
|
|
1291
|
+
return i;
|
|
1292
|
+
});
|
|
1293
|
+
}).then(e);
|
|
1294
|
+
}, K.prototype.sortBy = function(e, t) {
|
|
1295
|
+
var n = e.split(".").reverse(), r = n[0], i = n.length - 1;
|
|
1296
|
+
function a(e, t) {
|
|
1297
|
+
return t ? a(e[n[t]], t - 1) : e[r];
|
|
1298
|
+
}
|
|
1299
|
+
var o = this._ctx.dir === "next" ? 1 : -1;
|
|
1300
|
+
function s(e, t) {
|
|
1301
|
+
return W(a(e, i), a(t, i)) * o;
|
|
1302
|
+
}
|
|
1303
|
+
return this.toArray(function(e) {
|
|
1304
|
+
return e.sort(s);
|
|
1305
|
+
}).then(t);
|
|
1306
|
+
}, K.prototype.toArray = function(e) {
|
|
1307
|
+
var t = this;
|
|
1308
|
+
return this._read(function(e) {
|
|
1309
|
+
var n = t._ctx;
|
|
1310
|
+
if (n.dir === "next" && wt(n, !0) && 0 < n.limit) {
|
|
1311
|
+
var r = n.valueMapper, i = Dt(n, n.table.core.schema);
|
|
1312
|
+
return n.table.core.query({
|
|
1313
|
+
trans: e,
|
|
1314
|
+
limit: n.limit,
|
|
1315
|
+
values: !0,
|
|
1316
|
+
query: {
|
|
1317
|
+
index: i,
|
|
1318
|
+
range: n.range
|
|
1319
|
+
}
|
|
1320
|
+
}).then(function(e) {
|
|
1321
|
+
return e = e.result, r ? e.map(r) : e;
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
var a = [];
|
|
1325
|
+
return kt(n, function(e) {
|
|
1326
|
+
return a.push(e);
|
|
1327
|
+
}, e, n.table.core).then(function() {
|
|
1328
|
+
return a;
|
|
1329
|
+
});
|
|
1330
|
+
}, e);
|
|
1331
|
+
}, K.prototype.offset = function(e) {
|
|
1332
|
+
var t = this._ctx;
|
|
1333
|
+
return e <= 0 || (t.offset += e, wt(t) ? Et(t, function() {
|
|
1334
|
+
var t = e;
|
|
1335
|
+
return function(e, n) {
|
|
1336
|
+
return t === 0 || (t === 1 ? --t : n(function() {
|
|
1337
|
+
e.advance(t), t = 0;
|
|
1338
|
+
}), !1);
|
|
1339
|
+
};
|
|
1340
|
+
}) : Et(t, function() {
|
|
1341
|
+
var t = e;
|
|
1342
|
+
return function() {
|
|
1343
|
+
return --t < 0;
|
|
1344
|
+
};
|
|
1345
|
+
})), this;
|
|
1346
|
+
}, K.prototype.limit = function(e) {
|
|
1347
|
+
return this._ctx.limit = Math.min(this._ctx.limit, e), Et(this._ctx, function() {
|
|
1348
|
+
var t = e;
|
|
1349
|
+
return function(e, n, r) {
|
|
1350
|
+
return --t <= 0 && n(r), 0 <= t;
|
|
1351
|
+
};
|
|
1352
|
+
}, !0), this;
|
|
1353
|
+
}, K.prototype.until = function(e, t) {
|
|
1354
|
+
return Tt(this._ctx, function(n, r, i) {
|
|
1355
|
+
return !e(n.value) || (r(i), t);
|
|
1356
|
+
}), this;
|
|
1357
|
+
}, K.prototype.first = function(e) {
|
|
1358
|
+
return this.limit(1).toArray(function(e) {
|
|
1359
|
+
return e[0];
|
|
1360
|
+
}).then(e);
|
|
1361
|
+
}, K.prototype.last = function(e) {
|
|
1362
|
+
return this.reverse().first(e);
|
|
1363
|
+
}, K.prototype.filter = function(e) {
|
|
1364
|
+
var t;
|
|
1365
|
+
return Tt(this._ctx, function(t) {
|
|
1366
|
+
return e(t.value);
|
|
1367
|
+
}), (t = this._ctx).isMatch = mt(t.isMatch, e), this;
|
|
1368
|
+
}, K.prototype.and = function(e) {
|
|
1369
|
+
return this.filter(e);
|
|
1370
|
+
}, K.prototype.or = function(e) {
|
|
1371
|
+
return new this.db.WhereClause(this._ctx.table, e, this);
|
|
1372
|
+
}, K.prototype.reverse = function() {
|
|
1373
|
+
return this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this;
|
|
1374
|
+
}, K.prototype.desc = function() {
|
|
1375
|
+
return this.reverse();
|
|
1376
|
+
}, K.prototype.eachKey = function(e) {
|
|
1377
|
+
var t = this._ctx;
|
|
1378
|
+
return t.keysOnly = !t.isMatch, this.each(function(t, n) {
|
|
1379
|
+
e(n.key, n);
|
|
1380
|
+
});
|
|
1381
|
+
}, K.prototype.eachUniqueKey = function(e) {
|
|
1382
|
+
return this._ctx.unique = "unique", this.eachKey(e);
|
|
1383
|
+
}, K.prototype.eachPrimaryKey = function(e) {
|
|
1384
|
+
var t = this._ctx;
|
|
1385
|
+
return t.keysOnly = !t.isMatch, this.each(function(t, n) {
|
|
1386
|
+
e(n.primaryKey, n);
|
|
1387
|
+
});
|
|
1388
|
+
}, K.prototype.keys = function(e) {
|
|
1389
|
+
var t = this._ctx;
|
|
1390
|
+
t.keysOnly = !t.isMatch;
|
|
1391
|
+
var n = [];
|
|
1392
|
+
return this.each(function(e, t) {
|
|
1393
|
+
n.push(t.key);
|
|
1394
|
+
}).then(function() {
|
|
1395
|
+
return n;
|
|
1396
|
+
}).then(e);
|
|
1397
|
+
}, K.prototype.primaryKeys = function(e) {
|
|
1398
|
+
var t = this._ctx;
|
|
1399
|
+
if (t.dir === "next" && wt(t, !0) && 0 < t.limit) return this._read(function(e) {
|
|
1400
|
+
var n = Dt(t, t.table.core.schema);
|
|
1401
|
+
return t.table.core.query({
|
|
1402
|
+
trans: e,
|
|
1403
|
+
values: !1,
|
|
1404
|
+
limit: t.limit,
|
|
1405
|
+
query: {
|
|
1406
|
+
index: n,
|
|
1407
|
+
range: t.range
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
}).then(function(e) {
|
|
1411
|
+
return e.result;
|
|
1412
|
+
}).then(e);
|
|
1413
|
+
t.keysOnly = !t.isMatch;
|
|
1414
|
+
var n = [];
|
|
1415
|
+
return this.each(function(e, t) {
|
|
1416
|
+
n.push(t.primaryKey);
|
|
1417
|
+
}).then(function() {
|
|
1418
|
+
return n;
|
|
1419
|
+
}).then(e);
|
|
1420
|
+
}, K.prototype.uniqueKeys = function(e) {
|
|
1421
|
+
return this._ctx.unique = "unique", this.keys(e);
|
|
1422
|
+
}, K.prototype.firstKey = function(e) {
|
|
1423
|
+
return this.limit(1).keys(function(e) {
|
|
1424
|
+
return e[0];
|
|
1425
|
+
}).then(e);
|
|
1426
|
+
}, K.prototype.lastKey = function(e) {
|
|
1427
|
+
return this.reverse().firstKey(e);
|
|
1428
|
+
}, K.prototype.distinct = function() {
|
|
1429
|
+
var e = this._ctx, e = e.index && e.table.schema.idxByName[e.index];
|
|
1430
|
+
if (!e || !e.multi) return this;
|
|
1431
|
+
var t = {};
|
|
1432
|
+
return Tt(this._ctx, function(e) {
|
|
1433
|
+
var n = e.primaryKey.toString(), e = l(t, n);
|
|
1434
|
+
return t[n] = !0, !e;
|
|
1435
|
+
}), this;
|
|
1436
|
+
}, K.prototype.modify = function(e) {
|
|
1437
|
+
var t = this, n = this._ctx;
|
|
1438
|
+
return this._write(function(r) {
|
|
1439
|
+
var a, o, s = typeof e == "function" ? e : (a = i(e), o = a.length, function(t) {
|
|
1440
|
+
for (var n = !1, r = 0; r < o; ++r) {
|
|
1441
|
+
var i = a[r], s = e[i], c = b(t, i);
|
|
1442
|
+
s instanceof jt ? (x(t, i, s.execute(c)), n = !0) : c !== s && (x(t, i, s), n = !0);
|
|
1443
|
+
}
|
|
1444
|
+
return n;
|
|
1445
|
+
}), c = n.table.core, l = c.schema.primaryKey, u = l.outbound, d = l.extractKey, f = 200, l = t.db._options.modifyChunkSize;
|
|
1446
|
+
l && (f = typeof l == "object" ? l[c.name] || l["*"] || 200 : l);
|
|
1447
|
+
function p(e, t) {
|
|
1448
|
+
var n = t.failures, t = t.numFailures;
|
|
1449
|
+
h += e - t;
|
|
1450
|
+
for (var r = 0, a = i(n); r < a.length; r++) {
|
|
1451
|
+
var o = a[r];
|
|
1452
|
+
m.push(n[o]);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
var m = [], h = 0, g = [], _ = e === Pt;
|
|
1456
|
+
return t.clone().primaryKeys().then(function(t) {
|
|
1457
|
+
function i(o) {
|
|
1458
|
+
var l = Math.min(f, t.length - o), m = t.slice(o, o + l);
|
|
1459
|
+
return (_ ? Promise.resolve([]) : c.getMany({
|
|
1460
|
+
trans: r,
|
|
1461
|
+
keys: m,
|
|
1462
|
+
cache: "immutable"
|
|
1463
|
+
})).then(function(h) {
|
|
1464
|
+
var g = [], v = [], y = u ? [] : null, b = _ ? m : [];
|
|
1465
|
+
if (!_) for (var x = 0; x < l; ++x) {
|
|
1466
|
+
var S = h[x], C = {
|
|
1467
|
+
value: T(S),
|
|
1468
|
+
primKey: t[o + x]
|
|
1469
|
+
};
|
|
1470
|
+
!1 !== s.call(C, C.value, C) && (C.value == null ? b.push(t[o + x]) : u || W(d(S), d(C.value)) === 0 ? (v.push(C.value), u && y.push(t[o + x])) : (b.push(t[o + x]), g.push(C.value)));
|
|
1471
|
+
}
|
|
1472
|
+
return Promise.resolve(0 < g.length && c.mutate({
|
|
1473
|
+
trans: r,
|
|
1474
|
+
type: "add",
|
|
1475
|
+
values: g
|
|
1476
|
+
}).then(function(e) {
|
|
1477
|
+
for (var t in e.failures) b.splice(parseInt(t), 1);
|
|
1478
|
+
p(g.length, e);
|
|
1479
|
+
})).then(function() {
|
|
1480
|
+
return (0 < v.length || a && typeof e == "object") && c.mutate({
|
|
1481
|
+
trans: r,
|
|
1482
|
+
type: "put",
|
|
1483
|
+
keys: y,
|
|
1484
|
+
values: v,
|
|
1485
|
+
criteria: a,
|
|
1486
|
+
changeSpec: typeof e != "function" && e,
|
|
1487
|
+
isAdditionalChunk: 0 < o
|
|
1488
|
+
}).then(function(e) {
|
|
1489
|
+
return p(v.length, e);
|
|
1490
|
+
});
|
|
1491
|
+
}).then(function() {
|
|
1492
|
+
return (0 < b.length || a && _) && c.mutate({
|
|
1493
|
+
trans: r,
|
|
1494
|
+
type: "delete",
|
|
1495
|
+
keys: b,
|
|
1496
|
+
criteria: a,
|
|
1497
|
+
isAdditionalChunk: 0 < o
|
|
1498
|
+
}).then(function(e) {
|
|
1499
|
+
return bt(n.table, b, e);
|
|
1500
|
+
}).then(function(e) {
|
|
1501
|
+
return p(b.length, e);
|
|
1502
|
+
});
|
|
1503
|
+
}).then(function() {
|
|
1504
|
+
return t.length > o + l && i(o + f);
|
|
1505
|
+
});
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
var a = wt(n) && n.limit === Infinity && (typeof e != "function" || _) && {
|
|
1509
|
+
index: n.index,
|
|
1510
|
+
range: n.range
|
|
1511
|
+
};
|
|
1512
|
+
return i(0).then(function() {
|
|
1513
|
+
if (0 < m.length) throw new M("Error modifying one or more objects", m, h, g);
|
|
1514
|
+
return t.length;
|
|
1515
|
+
});
|
|
1516
|
+
});
|
|
1517
|
+
});
|
|
1518
|
+
}, K.prototype.delete = function() {
|
|
1519
|
+
var e = this._ctx, t = e.range;
|
|
1520
|
+
return !wt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Pt) : this._write(function(n) {
|
|
1521
|
+
var r = e.table.core.schema.primaryKey, i = t;
|
|
1522
|
+
return e.table.core.count({
|
|
1523
|
+
trans: n,
|
|
1524
|
+
query: {
|
|
1525
|
+
index: r,
|
|
1526
|
+
range: i
|
|
1527
|
+
}
|
|
1528
|
+
}).then(function(t) {
|
|
1529
|
+
return e.table.core.mutate({
|
|
1530
|
+
trans: n,
|
|
1531
|
+
type: "deleteRange",
|
|
1532
|
+
range: i
|
|
1533
|
+
}).then(function(e) {
|
|
1534
|
+
var n = e.failures, e = e.numFailures;
|
|
1535
|
+
if (e) throw new M("Could not delete some values", Object.keys(n).map(function(e) {
|
|
1536
|
+
return n[e];
|
|
1537
|
+
}), t - e);
|
|
1538
|
+
return t - e;
|
|
1539
|
+
});
|
|
1540
|
+
});
|
|
1541
|
+
});
|
|
1542
|
+
}, K);
|
|
1543
|
+
function K() {}
|
|
1544
|
+
var Pt = function(e, t) {
|
|
1545
|
+
return t.value = null;
|
|
1546
|
+
};
|
|
1547
|
+
function Ft(e, t) {
|
|
1548
|
+
return e < t ? -1 : e === t ? 0 : 1;
|
|
1549
|
+
}
|
|
1550
|
+
function It(e, t) {
|
|
1551
|
+
return t < e ? -1 : e === t ? 0 : 1;
|
|
1552
|
+
}
|
|
1553
|
+
function q(e, t, n) {
|
|
1554
|
+
return e = e instanceof Vt ? new e.Collection(e) : e, e._ctx.error = new (n || TypeError)(t), e;
|
|
1555
|
+
}
|
|
1556
|
+
function Lt(e) {
|
|
1557
|
+
return new e.Collection(e, function() {
|
|
1558
|
+
return Bt("");
|
|
1559
|
+
}).limit(0);
|
|
1560
|
+
}
|
|
1561
|
+
function Rt(e, t, n, r) {
|
|
1562
|
+
var i, a, o, s, c, l, u, d = n.length;
|
|
1563
|
+
if (!n.every(function(e) {
|
|
1564
|
+
return typeof e == "string";
|
|
1565
|
+
})) return q(e, lt);
|
|
1566
|
+
function f(e) {
|
|
1567
|
+
i = e === "next" ? function(e) {
|
|
1568
|
+
return e.toUpperCase();
|
|
1569
|
+
} : function(e) {
|
|
1570
|
+
return e.toLowerCase();
|
|
1571
|
+
}, a = e === "next" ? function(e) {
|
|
1572
|
+
return e.toLowerCase();
|
|
1573
|
+
} : function(e) {
|
|
1574
|
+
return e.toUpperCase();
|
|
1575
|
+
}, o = e === "next" ? Ft : It;
|
|
1576
|
+
var t = n.map(function(e) {
|
|
1577
|
+
return {
|
|
1578
|
+
lower: a(e),
|
|
1579
|
+
upper: i(e)
|
|
1580
|
+
};
|
|
1581
|
+
}).sort(function(e, t) {
|
|
1582
|
+
return o(e.lower, t.lower);
|
|
1583
|
+
});
|
|
1584
|
+
s = t.map(function(e) {
|
|
1585
|
+
return e.upper;
|
|
1586
|
+
}), c = t.map(function(e) {
|
|
1587
|
+
return e.lower;
|
|
1588
|
+
}), u = (l = e) === "next" ? "" : r;
|
|
1589
|
+
}
|
|
1590
|
+
f("next"), e = new e.Collection(e, function() {
|
|
1591
|
+
return zt(s[0], c[d - 1] + r);
|
|
1592
|
+
}), e._ondirectionchange = function(e) {
|
|
1593
|
+
f(e);
|
|
1594
|
+
};
|
|
1595
|
+
var p = 0;
|
|
1596
|
+
return e._addAlgorithm(function(e, n, r) {
|
|
1597
|
+
var i = e.key;
|
|
1598
|
+
if (typeof i != "string") return !1;
|
|
1599
|
+
var f = a(i);
|
|
1600
|
+
if (t(f, c, p)) return !0;
|
|
1601
|
+
for (var m = null, h = p; h < d; ++h) {
|
|
1602
|
+
var g = function(e, t, n, r, i, a) {
|
|
1603
|
+
for (var o = Math.min(e.length, r.length), s = -1, c = 0; c < o; ++c) {
|
|
1604
|
+
var l = t[c];
|
|
1605
|
+
if (l !== r[c]) return i(e[c], n[c]) < 0 ? e.substr(0, c) + n[c] + n.substr(c + 1) : i(e[c], r[c]) < 0 ? e.substr(0, c) + r[c] + n.substr(c + 1) : 0 <= s ? e.substr(0, s) + t[s] + n.substr(s + 1) : null;
|
|
1606
|
+
i(e[c], l) < 0 && (s = c);
|
|
1607
|
+
}
|
|
1608
|
+
return o < r.length && a === "next" ? e + n.substr(e.length) : o < e.length && a === "prev" ? e.substr(0, n.length) : s < 0 ? null : e.substr(0, s) + r[s] + n.substr(s + 1);
|
|
1609
|
+
}(i, f, s[h], c[h], o, l);
|
|
1610
|
+
g === null && m === null ? p = h + 1 : (m === null || 0 < o(m, g)) && (m = g);
|
|
1611
|
+
}
|
|
1612
|
+
return n(m === null ? r : function() {
|
|
1613
|
+
e.continue(m + u);
|
|
1614
|
+
}), !1;
|
|
1615
|
+
}), e;
|
|
1616
|
+
}
|
|
1617
|
+
function zt(e, t, n, r) {
|
|
1618
|
+
return {
|
|
1619
|
+
type: 2,
|
|
1620
|
+
lower: e,
|
|
1621
|
+
upper: t,
|
|
1622
|
+
lowerOpen: n,
|
|
1623
|
+
upperOpen: r
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
function Bt(e) {
|
|
1627
|
+
return {
|
|
1628
|
+
type: 1,
|
|
1629
|
+
lower: e,
|
|
1630
|
+
upper: e
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1633
|
+
var Vt = (Object.defineProperty(J.prototype, "Collection", {
|
|
1634
|
+
get: function() {
|
|
1635
|
+
return this._ctx.table.db.Collection;
|
|
1636
|
+
},
|
|
1637
|
+
enumerable: !1,
|
|
1638
|
+
configurable: !0
|
|
1639
|
+
}), J.prototype.between = function(e, t, n, r) {
|
|
1640
|
+
n = !1 !== n, r = !0 === r;
|
|
1641
|
+
try {
|
|
1642
|
+
return 0 < this._cmp(e, t) || this._cmp(e, t) === 0 && (n || r) && (!n || !r) ? Lt(this) : new this.Collection(this, function() {
|
|
1643
|
+
return zt(e, t, !n, !r);
|
|
1644
|
+
});
|
|
1645
|
+
} catch {
|
|
1646
|
+
return q(this, U);
|
|
1647
|
+
}
|
|
1648
|
+
}, J.prototype.equals = function(e) {
|
|
1649
|
+
return e == null ? q(this, U) : new this.Collection(this, function() {
|
|
1650
|
+
return Bt(e);
|
|
1651
|
+
});
|
|
1652
|
+
}, J.prototype.above = function(e) {
|
|
1653
|
+
return e == null ? q(this, U) : new this.Collection(this, function() {
|
|
1654
|
+
return zt(e, void 0, !0);
|
|
1655
|
+
});
|
|
1656
|
+
}, J.prototype.aboveOrEqual = function(e) {
|
|
1657
|
+
return e == null ? q(this, U) : new this.Collection(this, function() {
|
|
1658
|
+
return zt(e, void 0, !1);
|
|
1659
|
+
});
|
|
1660
|
+
}, J.prototype.below = function(e) {
|
|
1661
|
+
return e == null ? q(this, U) : new this.Collection(this, function() {
|
|
1662
|
+
return zt(void 0, e, !1, !0);
|
|
1663
|
+
});
|
|
1664
|
+
}, J.prototype.belowOrEqual = function(e) {
|
|
1665
|
+
return e == null ? q(this, U) : new this.Collection(this, function() {
|
|
1666
|
+
return zt(void 0, e);
|
|
1667
|
+
});
|
|
1668
|
+
}, J.prototype.startsWith = function(e) {
|
|
1669
|
+
return typeof e == "string" ? this.between(e, e + ct, !0, !0) : q(this, lt);
|
|
1670
|
+
}, J.prototype.startsWithIgnoreCase = function(e) {
|
|
1671
|
+
return e === "" ? this.startsWith(e) : Rt(this, function(e, t) {
|
|
1672
|
+
return e.indexOf(t[0]) === 0;
|
|
1673
|
+
}, [e], ct);
|
|
1674
|
+
}, J.prototype.equalsIgnoreCase = function(e) {
|
|
1675
|
+
return Rt(this, function(e, t) {
|
|
1676
|
+
return e === t[0];
|
|
1677
|
+
}, [e], "");
|
|
1678
|
+
}, J.prototype.anyOfIgnoreCase = function() {
|
|
1679
|
+
var e = O.apply(D, arguments);
|
|
1680
|
+
return e.length === 0 ? Lt(this) : Rt(this, function(e, t) {
|
|
1681
|
+
return t.indexOf(e) !== -1;
|
|
1682
|
+
}, e, "");
|
|
1683
|
+
}, J.prototype.startsWithAnyOfIgnoreCase = function() {
|
|
1684
|
+
var e = O.apply(D, arguments);
|
|
1685
|
+
return e.length === 0 ? Lt(this) : Rt(this, function(e, t) {
|
|
1686
|
+
return t.some(function(t) {
|
|
1687
|
+
return e.indexOf(t) === 0;
|
|
1688
|
+
});
|
|
1689
|
+
}, e, ct);
|
|
1690
|
+
}, J.prototype.anyOf = function() {
|
|
1691
|
+
var e = this, t = O.apply(D, arguments), n = this._cmp;
|
|
1692
|
+
try {
|
|
1693
|
+
t.sort(n);
|
|
1694
|
+
} catch {
|
|
1695
|
+
return q(this, U);
|
|
1696
|
+
}
|
|
1697
|
+
if (t.length === 0) return Lt(this);
|
|
1698
|
+
var r = new this.Collection(this, function() {
|
|
1699
|
+
return zt(t[0], t[t.length - 1]);
|
|
1700
|
+
});
|
|
1701
|
+
r._ondirectionchange = function(r) {
|
|
1702
|
+
n = r === "next" ? e._ascending : e._descending, t.sort(n);
|
|
1703
|
+
};
|
|
1704
|
+
var i = 0;
|
|
1705
|
+
return r._addAlgorithm(function(e, r, a) {
|
|
1706
|
+
for (var o = e.key; 0 < n(o, t[i]);) if (++i === t.length) return r(a), !1;
|
|
1707
|
+
return n(o, t[i]) === 0 || (r(function() {
|
|
1708
|
+
e.continue(t[i]);
|
|
1709
|
+
}), !1);
|
|
1710
|
+
}), r;
|
|
1711
|
+
}, J.prototype.notEqual = function(e) {
|
|
1712
|
+
return this.inAnyRange([[-Infinity, e], [e, this.db._maxKey]], {
|
|
1713
|
+
includeLowers: !1,
|
|
1714
|
+
includeUppers: !1
|
|
1715
|
+
});
|
|
1716
|
+
}, J.prototype.noneOf = function() {
|
|
1717
|
+
var e = O.apply(D, arguments);
|
|
1718
|
+
if (e.length === 0) return new this.Collection(this);
|
|
1719
|
+
try {
|
|
1720
|
+
e.sort(this._ascending);
|
|
1721
|
+
} catch {
|
|
1722
|
+
return q(this, U);
|
|
1723
|
+
}
|
|
1724
|
+
var t = e.reduce(function(e, t) {
|
|
1725
|
+
return e ? e.concat([[e[e.length - 1][1], t]]) : [[-Infinity, t]];
|
|
1726
|
+
}, null);
|
|
1727
|
+
return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, {
|
|
1728
|
+
includeLowers: !1,
|
|
1729
|
+
includeUppers: !1
|
|
1730
|
+
});
|
|
1731
|
+
}, J.prototype.inAnyRange = function(e, t) {
|
|
1732
|
+
var n = this, r = this._cmp, i = this._ascending, a = this._descending, o = this._min, s = this._max;
|
|
1733
|
+
if (e.length === 0) return Lt(this);
|
|
1734
|
+
if (!e.every(function(e) {
|
|
1735
|
+
return e[0] !== void 0 && e[1] !== void 0 && i(e[0], e[1]) <= 0;
|
|
1736
|
+
})) return q(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", P.InvalidArgument);
|
|
1737
|
+
var c = !t || !1 !== t.includeLowers, l = t && !0 === t.includeUppers, u, d = i;
|
|
1738
|
+
function f(e, t) {
|
|
1739
|
+
return d(e[0], t[0]);
|
|
1740
|
+
}
|
|
1741
|
+
try {
|
|
1742
|
+
(u = e.reduce(function(e, t) {
|
|
1743
|
+
for (var n = 0, i = e.length; n < i; ++n) {
|
|
1744
|
+
var a = e[n];
|
|
1745
|
+
if (r(t[0], a[1]) < 0 && 0 < r(t[1], a[0])) {
|
|
1746
|
+
a[0] = o(a[0], t[0]), a[1] = s(a[1], t[1]);
|
|
1747
|
+
break;
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
return n === i && e.push(t), e;
|
|
1751
|
+
}, [])).sort(f);
|
|
1752
|
+
} catch {
|
|
1753
|
+
return q(this, U);
|
|
1754
|
+
}
|
|
1755
|
+
var p = 0, m = l ? function(e) {
|
|
1756
|
+
return 0 < i(e, u[p][1]);
|
|
1757
|
+
} : function(e) {
|
|
1758
|
+
return 0 <= i(e, u[p][1]);
|
|
1759
|
+
}, h = c ? function(e) {
|
|
1760
|
+
return 0 < a(e, u[p][0]);
|
|
1761
|
+
} : function(e) {
|
|
1762
|
+
return 0 <= a(e, u[p][0]);
|
|
1763
|
+
}, g = m, e = new this.Collection(this, function() {
|
|
1764
|
+
return zt(u[0][0], u[u.length - 1][1], !c, !l);
|
|
1765
|
+
});
|
|
1766
|
+
return e._ondirectionchange = function(e) {
|
|
1767
|
+
d = e === "next" ? (g = m, i) : (g = h, a), u.sort(f);
|
|
1768
|
+
}, e._addAlgorithm(function(e, t, r) {
|
|
1769
|
+
for (var a, o = e.key; g(o);) if (++p === u.length) return t(r), !1;
|
|
1770
|
+
return !m(a = o) && !h(a) || (n._cmp(o, u[p][1]) === 0 || n._cmp(o, u[p][0]) === 0 || t(function() {
|
|
1771
|
+
d === i ? e.continue(u[p][0]) : e.continue(u[p][1]);
|
|
1772
|
+
}), !1);
|
|
1773
|
+
}), e;
|
|
1774
|
+
}, J.prototype.startsWithAnyOf = function() {
|
|
1775
|
+
var e = O.apply(D, arguments);
|
|
1776
|
+
return e.every(function(e) {
|
|
1777
|
+
return typeof e == "string";
|
|
1778
|
+
}) ? e.length === 0 ? Lt(this) : this.inAnyRange(e.map(function(e) {
|
|
1779
|
+
return [e, e + ct];
|
|
1780
|
+
})) : q(this, "startsWithAnyOf() only works with strings");
|
|
1781
|
+
}, J);
|
|
1782
|
+
function J() {}
|
|
1783
|
+
function Y(e) {
|
|
1784
|
+
return B(function(t) {
|
|
1785
|
+
return Ht(t), e(t.target.error), !1;
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
function Ht(e) {
|
|
1789
|
+
e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
|
|
1790
|
+
}
|
|
1791
|
+
var Ut = "storagemutated", Wt = "x-storagemutated-1", Gt = St(null, Ut), Kt = (X.prototype._lock = function() {
|
|
1792
|
+
return v(!R.global), ++this._reculock, this._reculock !== 1 || R.global || (R.lockOwnerFor = this), this;
|
|
1793
|
+
}, X.prototype._unlock = function() {
|
|
1794
|
+
if (v(!R.global), --this._reculock == 0) for (R.global || (R.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked();) {
|
|
1795
|
+
var e = this._blockedFuncs.shift();
|
|
1796
|
+
try {
|
|
1797
|
+
at(e[1], e[0]);
|
|
1798
|
+
} catch {}
|
|
1799
|
+
}
|
|
1800
|
+
return this;
|
|
1801
|
+
}, X.prototype._locked = function() {
|
|
1802
|
+
return this._reculock && R.lockOwnerFor !== this;
|
|
1803
|
+
}, X.prototype.create = function(e) {
|
|
1804
|
+
var t = this;
|
|
1805
|
+
if (!this.mode) return this;
|
|
1806
|
+
var n = this.db.idbdb, r = this.db._state.dbOpenError;
|
|
1807
|
+
if (v(!this.idbtrans), !e && !n) switch (r && r.name) {
|
|
1808
|
+
case "DatabaseClosedError": throw new P.DatabaseClosed(r);
|
|
1809
|
+
case "MissingAPIError": throw new P.MissingAPI(r.message, r);
|
|
1810
|
+
default: throw new P.OpenFailed(r);
|
|
1811
|
+
}
|
|
1812
|
+
if (!this.active) throw new P.TransactionInactive();
|
|
1813
|
+
return v(this._completion._state === null), (e = this.idbtrans = e || (this.db.core || n).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = B(function(n) {
|
|
1814
|
+
Ht(n), t._reject(e.error);
|
|
1815
|
+
}), e.onabort = B(function(n) {
|
|
1816
|
+
Ht(n), t.active && t._reject(new P.Abort(e.error)), t.active = !1, t.on("abort").fire(n);
|
|
1817
|
+
}), e.oncomplete = B(function() {
|
|
1818
|
+
t.active = !1, t._resolve(), "mutatedParts" in e && Gt.storagemutated.fire(e.mutatedParts);
|
|
1819
|
+
}), this;
|
|
1820
|
+
}, X.prototype._promise = function(e, t, n) {
|
|
1821
|
+
var r = this;
|
|
1822
|
+
if (e === "readwrite" && this.mode !== "readwrite") return H(new P.ReadOnly("Transaction is readonly"));
|
|
1823
|
+
if (!this.active) return H(new P.TransactionInactive());
|
|
1824
|
+
if (this._locked()) return new z(function(i, a) {
|
|
1825
|
+
r._blockedFuncs.push([function() {
|
|
1826
|
+
r._promise(e, t, n).then(i, a);
|
|
1827
|
+
}, R]);
|
|
1828
|
+
});
|
|
1829
|
+
if (n) return Qe(function() {
|
|
1830
|
+
var e = new z(function(e, n) {
|
|
1831
|
+
r._lock();
|
|
1832
|
+
var i = t(e, n, r);
|
|
1833
|
+
i && i.then && i.then(e, n);
|
|
1834
|
+
});
|
|
1835
|
+
return e.finally(function() {
|
|
1836
|
+
return r._unlock();
|
|
1837
|
+
}), e._lib = !0, e;
|
|
1838
|
+
});
|
|
1839
|
+
var i = new z(function(e, n) {
|
|
1840
|
+
var i = t(e, n, r);
|
|
1841
|
+
i && i.then && i.then(e, n);
|
|
1842
|
+
});
|
|
1843
|
+
return i._lib = !0, i;
|
|
1844
|
+
}, X.prototype._root = function() {
|
|
1845
|
+
return this.parent ? this.parent._root() : this;
|
|
1846
|
+
}, X.prototype.waitFor = function(e) {
|
|
1847
|
+
var t, n = this._root(), r = z.resolve(e);
|
|
1848
|
+
n._waitingFor ? n._waitingFor = n._waitingFor.then(function() {
|
|
1849
|
+
return r;
|
|
1850
|
+
}) : (n._waitingFor = r, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), function e() {
|
|
1851
|
+
for (++n._spinCount; n._waitingQueue.length;) n._waitingQueue.shift()();
|
|
1852
|
+
n._waitingFor && (t.get(-Infinity).onsuccess = e);
|
|
1853
|
+
}());
|
|
1854
|
+
var i = n._waitingFor;
|
|
1855
|
+
return new z(function(e, t) {
|
|
1856
|
+
r.then(function(t) {
|
|
1857
|
+
return n._waitingQueue.push(B(e.bind(null, t)));
|
|
1858
|
+
}, function(e) {
|
|
1859
|
+
return n._waitingQueue.push(B(t.bind(null, e)));
|
|
1860
|
+
}).finally(function() {
|
|
1861
|
+
n._waitingFor === i && (n._waitingFor = null);
|
|
1862
|
+
});
|
|
1863
|
+
});
|
|
1864
|
+
}, X.prototype.abort = function() {
|
|
1865
|
+
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new P.Abort()));
|
|
1866
|
+
}, X.prototype.table = function(e) {
|
|
1867
|
+
var t = this._memoizedTables ||= {};
|
|
1868
|
+
if (l(t, e)) return t[e];
|
|
1869
|
+
var n = this.schema[e];
|
|
1870
|
+
if (!n) throw new P.NotFound("Table " + e + " not part of transaction");
|
|
1871
|
+
return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
|
|
1872
|
+
}, X);
|
|
1873
|
+
function X() {}
|
|
1874
|
+
function qt(e, t, n, r, i, a, o, s) {
|
|
1875
|
+
return {
|
|
1876
|
+
name: e,
|
|
1877
|
+
keyPath: t,
|
|
1878
|
+
unique: n,
|
|
1879
|
+
multi: r,
|
|
1880
|
+
auto: i,
|
|
1881
|
+
compound: a,
|
|
1882
|
+
src: (n && !o ? "&" : "") + (r ? "*" : "") + (i ? "++" : "") + Jt(t),
|
|
1883
|
+
type: s
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
function Jt(e) {
|
|
1887
|
+
return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
|
|
1888
|
+
}
|
|
1889
|
+
function Yt(e, t, n) {
|
|
1890
|
+
return {
|
|
1891
|
+
name: e,
|
|
1892
|
+
primKey: t,
|
|
1893
|
+
indexes: n,
|
|
1894
|
+
mappedClass: null,
|
|
1895
|
+
idxByName: (r = function(e) {
|
|
1896
|
+
return [e.name, e];
|
|
1897
|
+
}, n.reduce(function(e, t, n) {
|
|
1898
|
+
return n = r(t, n), n && (e[n[0]] = n[1]), e;
|
|
1899
|
+
}, {}))
|
|
1900
|
+
};
|
|
1901
|
+
var r;
|
|
1902
|
+
}
|
|
1903
|
+
var Xt = function(e) {
|
|
1904
|
+
try {
|
|
1905
|
+
return e.only([[]]), Xt = function() {
|
|
1906
|
+
return [[]];
|
|
1907
|
+
}, [[]];
|
|
1908
|
+
} catch {
|
|
1909
|
+
return Xt = function() {
|
|
1910
|
+
return ct;
|
|
1911
|
+
}, ct;
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1914
|
+
function Zt(e) {
|
|
1915
|
+
return e == null ? function() {} : typeof e == "string" ? (t = e).split(".").length === 1 ? function(e) {
|
|
1916
|
+
return e[t];
|
|
1917
|
+
} : function(e) {
|
|
1918
|
+
return b(e, t);
|
|
1919
|
+
} : function(t) {
|
|
1920
|
+
return b(t, e);
|
|
1921
|
+
};
|
|
1922
|
+
var t;
|
|
1923
|
+
}
|
|
1924
|
+
function Qt(e) {
|
|
1925
|
+
return [].slice.call(e);
|
|
1926
|
+
}
|
|
1927
|
+
var $t = 0;
|
|
1928
|
+
function en(e) {
|
|
1929
|
+
return e == null ? ":id" : typeof e == "string" ? e : `[${e.join("+")}]`;
|
|
1930
|
+
}
|
|
1931
|
+
function tn(e, t, n) {
|
|
1932
|
+
function r(e) {
|
|
1933
|
+
if (e.type === 3) return null;
|
|
1934
|
+
if (e.type === 4) throw Error("Cannot convert never type to IDBKeyRange");
|
|
1935
|
+
var n = e.lower, r = e.upper, i = e.lowerOpen, e = e.upperOpen;
|
|
1936
|
+
return n === void 0 ? r === void 0 ? null : t.upperBound(r, !!e) : r === void 0 ? t.lowerBound(n, !!i) : t.bound(n, r, !!i, !!e);
|
|
1937
|
+
}
|
|
1938
|
+
function i(e) {
|
|
1939
|
+
var t, n = e.name;
|
|
1940
|
+
return {
|
|
1941
|
+
name: n,
|
|
1942
|
+
schema: e,
|
|
1943
|
+
mutate: function(e) {
|
|
1944
|
+
var t = e.trans, i = e.type, a = e.keys, o = e.values, s = e.range;
|
|
1945
|
+
return new Promise(function(e, c) {
|
|
1946
|
+
e = B(e);
|
|
1947
|
+
var l = t.objectStore(n), u = l.keyPath == null, d = i === "put" || i === "add";
|
|
1948
|
+
if (!d && i !== "delete" && i !== "deleteRange") throw Error("Invalid operation type: " + i);
|
|
1949
|
+
var f, p = (a || o || { length: 1 }).length;
|
|
1950
|
+
if (a && o && a.length !== o.length) throw Error("Given keys array must have same length as given values array.");
|
|
1951
|
+
if (p === 0) return e({
|
|
1952
|
+
numFailures: 0,
|
|
1953
|
+
failures: {},
|
|
1954
|
+
results: [],
|
|
1955
|
+
lastResult: void 0
|
|
1956
|
+
});
|
|
1957
|
+
function m(e) {
|
|
1958
|
+
++_, Ht(e);
|
|
1959
|
+
}
|
|
1960
|
+
var h = [], g = [], _ = 0;
|
|
1961
|
+
if (i === "deleteRange") {
|
|
1962
|
+
if (s.type === 4) return e({
|
|
1963
|
+
numFailures: _,
|
|
1964
|
+
failures: g,
|
|
1965
|
+
results: [],
|
|
1966
|
+
lastResult: void 0
|
|
1967
|
+
});
|
|
1968
|
+
s.type === 3 ? h.push(f = l.clear()) : h.push(f = l.delete(r(s)));
|
|
1969
|
+
} else {
|
|
1970
|
+
var u = d ? u ? [o, a] : [o, null] : [a, null], v = u[0], y = u[1];
|
|
1971
|
+
if (d) for (var b = 0; b < p; ++b) h.push(f = y && y[b] !== void 0 ? l[i](v[b], y[b]) : l[i](v[b])), f.onerror = m;
|
|
1972
|
+
else for (b = 0; b < p; ++b) h.push(f = l[i](v[b])), f.onerror = m;
|
|
1973
|
+
}
|
|
1974
|
+
function x(t) {
|
|
1975
|
+
t = t.target.result, h.forEach(function(e, t) {
|
|
1976
|
+
return e.error != null && (g[t] = e.error);
|
|
1977
|
+
}), e({
|
|
1978
|
+
numFailures: _,
|
|
1979
|
+
failures: g,
|
|
1980
|
+
results: i === "delete" ? a : h.map(function(e) {
|
|
1981
|
+
return e.result;
|
|
1982
|
+
}),
|
|
1983
|
+
lastResult: t
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1986
|
+
f.onerror = function(e) {
|
|
1987
|
+
m(e), x(e);
|
|
1988
|
+
}, f.onsuccess = x;
|
|
1989
|
+
});
|
|
1990
|
+
},
|
|
1991
|
+
getMany: function(e) {
|
|
1992
|
+
var t = e.trans, r = e.keys;
|
|
1993
|
+
return new Promise(function(e, i) {
|
|
1994
|
+
e = B(e);
|
|
1995
|
+
for (var a, o = t.objectStore(n), s = r.length, c = Array(s), l = 0, u = 0, d = function(t) {
|
|
1996
|
+
t = t.target, c[t._pos] = t.result, ++u === l && e(c);
|
|
1997
|
+
}, f = Y(i), p = 0; p < s; ++p) r[p] != null && ((a = o.get(r[p]))._pos = p, a.onsuccess = d, a.onerror = f, ++l);
|
|
1998
|
+
l === 0 && e(c);
|
|
1999
|
+
});
|
|
2000
|
+
},
|
|
2001
|
+
get: function(e) {
|
|
2002
|
+
var t = e.trans, r = e.key;
|
|
2003
|
+
return new Promise(function(e, i) {
|
|
2004
|
+
e = B(e);
|
|
2005
|
+
var a = t.objectStore(n).get(r);
|
|
2006
|
+
a.onsuccess = function(t) {
|
|
2007
|
+
return e(t.target.result);
|
|
2008
|
+
}, a.onerror = Y(i);
|
|
2009
|
+
});
|
|
2010
|
+
},
|
|
2011
|
+
query: (t = u, function(e) {
|
|
2012
|
+
return new Promise(function(i, a) {
|
|
2013
|
+
i = B(i);
|
|
2014
|
+
var o, s, c, l = e.trans, u = e.values, d = e.limit, f = e.query, p = d === Infinity ? void 0 : d, m = f.index, f = f.range, l = l.objectStore(n), m = m.isPrimaryKey ? l : l.index(m.name), f = r(f);
|
|
2015
|
+
if (d === 0) return i({ result: [] });
|
|
2016
|
+
t ? ((p = u ? m.getAll(f, p) : m.getAllKeys(f, p)).onsuccess = function(e) {
|
|
2017
|
+
return i({ result: e.target.result });
|
|
2018
|
+
}, p.onerror = Y(a)) : (o = 0, s = !u && "openKeyCursor" in m ? m.openKeyCursor(f) : m.openCursor(f), c = [], s.onsuccess = function(e) {
|
|
2019
|
+
var t = s.result;
|
|
2020
|
+
return t ? (c.push(u ? t.value : t.primaryKey), ++o === d ? i({ result: c }) : void t.continue()) : i({ result: c });
|
|
2021
|
+
}, s.onerror = Y(a));
|
|
2022
|
+
});
|
|
2023
|
+
}),
|
|
2024
|
+
openCursor: function(e) {
|
|
2025
|
+
var t = e.trans, i = e.values, a = e.query, o = e.reverse, s = e.unique;
|
|
2026
|
+
return new Promise(function(e, c) {
|
|
2027
|
+
e = B(e);
|
|
2028
|
+
var l = a.index, u = a.range, d = t.objectStore(n), d = l.isPrimaryKey ? d : d.index(l.name), l = o ? s ? "prevunique" : "prev" : s ? "nextunique" : "next", f = !i && "openKeyCursor" in d ? d.openKeyCursor(r(u), l) : d.openCursor(r(u), l);
|
|
2029
|
+
f.onerror = Y(c), f.onsuccess = B(function(n) {
|
|
2030
|
+
var r, i, a, o, s = f.result;
|
|
2031
|
+
s ? (s.___id = ++$t, s.done = !1, r = s.continue.bind(s), i = (i = s.continuePrimaryKey) && i.bind(s), a = s.advance.bind(s), o = function() {
|
|
2032
|
+
throw Error("Cursor not stopped");
|
|
2033
|
+
}, s.trans = t, s.stop = s.continue = s.continuePrimaryKey = s.advance = function() {
|
|
2034
|
+
throw Error("Cursor not started");
|
|
2035
|
+
}, s.fail = B(c), s.next = function() {
|
|
2036
|
+
var e = this, t = 1;
|
|
2037
|
+
return this.start(function() {
|
|
2038
|
+
return t-- ? e.continue() : e.stop();
|
|
2039
|
+
}).then(function() {
|
|
2040
|
+
return e;
|
|
2041
|
+
});
|
|
2042
|
+
}, s.start = function(e) {
|
|
2043
|
+
function t() {
|
|
2044
|
+
if (f.result) try {
|
|
2045
|
+
e();
|
|
2046
|
+
} catch (e) {
|
|
2047
|
+
s.fail(e);
|
|
2048
|
+
}
|
|
2049
|
+
else s.done = !0, s.start = function() {
|
|
2050
|
+
throw Error("Cursor behind last entry");
|
|
2051
|
+
}, s.stop();
|
|
2052
|
+
}
|
|
2053
|
+
var n = new Promise(function(e, t) {
|
|
2054
|
+
e = B(e), f.onerror = Y(t), s.fail = t, s.stop = function(t) {
|
|
2055
|
+
s.stop = s.continue = s.continuePrimaryKey = s.advance = o, e(t);
|
|
2056
|
+
};
|
|
2057
|
+
});
|
|
2058
|
+
return f.onsuccess = B(function(e) {
|
|
2059
|
+
f.onsuccess = t, t();
|
|
2060
|
+
}), s.continue = r, s.continuePrimaryKey = i, s.advance = a, t(), n;
|
|
2061
|
+
}, e(s)) : e(null);
|
|
2062
|
+
}, c);
|
|
2063
|
+
});
|
|
2064
|
+
},
|
|
2065
|
+
count: function(e) {
|
|
2066
|
+
var t = e.query, i = e.trans, a = t.index, o = t.range;
|
|
2067
|
+
return new Promise(function(e, t) {
|
|
2068
|
+
var s = i.objectStore(n), c = a.isPrimaryKey ? s : s.index(a.name), s = r(o), c = s ? c.count(s) : c.count();
|
|
2069
|
+
c.onsuccess = B(function(t) {
|
|
2070
|
+
return e(t.target.result);
|
|
2071
|
+
}), c.onerror = Y(t);
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
var o, s, c, l = (s = n, c = Qt((o = e).objectStoreNames), {
|
|
2077
|
+
schema: {
|
|
2078
|
+
name: o.name,
|
|
2079
|
+
tables: c.map(function(e) {
|
|
2080
|
+
return s.objectStore(e);
|
|
2081
|
+
}).map(function(e) {
|
|
2082
|
+
var t = e.keyPath, n = e.autoIncrement, r = a(t), i = {}, n = {
|
|
2083
|
+
name: e.name,
|
|
2084
|
+
primaryKey: {
|
|
2085
|
+
name: null,
|
|
2086
|
+
isPrimaryKey: !0,
|
|
2087
|
+
outbound: t == null,
|
|
2088
|
+
compound: r,
|
|
2089
|
+
keyPath: t,
|
|
2090
|
+
autoIncrement: n,
|
|
2091
|
+
unique: !0,
|
|
2092
|
+
extractKey: Zt(t)
|
|
2093
|
+
},
|
|
2094
|
+
indexes: Qt(e.indexNames).map(function(t) {
|
|
2095
|
+
return e.index(t);
|
|
2096
|
+
}).map(function(e) {
|
|
2097
|
+
var t = e.name, n = e.unique, r = e.multiEntry, e = e.keyPath, r = {
|
|
2098
|
+
name: t,
|
|
2099
|
+
compound: a(e),
|
|
2100
|
+
keyPath: e,
|
|
2101
|
+
unique: n,
|
|
2102
|
+
multiEntry: r,
|
|
2103
|
+
extractKey: Zt(e)
|
|
2104
|
+
};
|
|
2105
|
+
return i[en(e)] = r;
|
|
2106
|
+
}),
|
|
2107
|
+
getIndexByKeyPath: function(e) {
|
|
2108
|
+
return i[en(e)];
|
|
2109
|
+
}
|
|
2110
|
+
};
|
|
2111
|
+
return i[":id"] = n.primaryKey, t != null && (i[en(t)] = n.primaryKey), n;
|
|
2112
|
+
})
|
|
2113
|
+
},
|
|
2114
|
+
hasGetAll: 0 < c.length && "getAll" in s.objectStore(c[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604)
|
|
2115
|
+
}), n = l.schema, u = l.hasGetAll, l = n.tables.map(i), d = {};
|
|
2116
|
+
return l.forEach(function(e) {
|
|
2117
|
+
return d[e.name] = e;
|
|
2118
|
+
}), {
|
|
2119
|
+
stack: "dbcore",
|
|
2120
|
+
transaction: e.transaction.bind(e),
|
|
2121
|
+
table: function(e) {
|
|
2122
|
+
if (!d[e]) throw Error(`Table '${e}' not found`);
|
|
2123
|
+
return d[e];
|
|
2124
|
+
},
|
|
2125
|
+
MIN_KEY: -Infinity,
|
|
2126
|
+
MAX_KEY: Xt(t),
|
|
2127
|
+
schema: n
|
|
2128
|
+
};
|
|
2129
|
+
}
|
|
2130
|
+
function nn(e, n, r, i) {
|
|
2131
|
+
var a = r.IDBKeyRange;
|
|
2132
|
+
return r.indexedDB, { dbcore: (i = tn(n, a, i), e.dbcore.reduce(function(e, n) {
|
|
2133
|
+
return n = n.create, t(t({}, e), n(e));
|
|
2134
|
+
}, i)) };
|
|
2135
|
+
}
|
|
2136
|
+
function rn(e, t) {
|
|
2137
|
+
var n = t.db, t = nn(e._middlewares, n, e._deps, t);
|
|
2138
|
+
e.core = t.dbcore, e.tables.forEach(function(t) {
|
|
2139
|
+
var n = t.name;
|
|
2140
|
+
e.core.schema.tables.some(function(e) {
|
|
2141
|
+
return e.name === n;
|
|
2142
|
+
}) && (t.core = e.core.table(n), e[n] instanceof e.Table && (e[n].core = t.core));
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
function an(e, t, n, r) {
|
|
2146
|
+
n.forEach(function(n) {
|
|
2147
|
+
var i = r[n];
|
|
2148
|
+
t.forEach(function(t) {
|
|
2149
|
+
var r = function e(t, n) {
|
|
2150
|
+
return m(t, n) || (t = s(t)) && e(t, n);
|
|
2151
|
+
}(t, n);
|
|
2152
|
+
(!r || "value" in r && r.value === void 0) && (t === e.Transaction.prototype || t instanceof e.Transaction ? f(t, n, {
|
|
2153
|
+
get: function() {
|
|
2154
|
+
return this.table(n);
|
|
2155
|
+
},
|
|
2156
|
+
set: function(e) {
|
|
2157
|
+
d(this, n, {
|
|
2158
|
+
value: e,
|
|
2159
|
+
writable: !0,
|
|
2160
|
+
configurable: !0,
|
|
2161
|
+
enumerable: !0
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
}) : t[n] = new e.Table(n, i));
|
|
2165
|
+
});
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
function on(e, t) {
|
|
2169
|
+
t.forEach(function(t) {
|
|
2170
|
+
for (var n in t) t[n] instanceof e.Table && delete t[n];
|
|
2171
|
+
});
|
|
2172
|
+
}
|
|
2173
|
+
function sn(e, t) {
|
|
2174
|
+
return e._cfg.version - t._cfg.version;
|
|
2175
|
+
}
|
|
2176
|
+
function cn(e, t, n, r) {
|
|
2177
|
+
var a = e._dbSchema;
|
|
2178
|
+
n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Yt("$meta", gn("")[0], []), e._storeNames.push("$meta"));
|
|
2179
|
+
var o = e._createTransaction("readwrite", e._storeNames, a);
|
|
2180
|
+
o.create(n), o._completion.catch(r);
|
|
2181
|
+
var s = o._reject.bind(o), c = R.transless || R;
|
|
2182
|
+
Qe(function() {
|
|
2183
|
+
return R.trans = o, R.transless = c, t === 0 ? (i(a).forEach(function(e) {
|
|
2184
|
+
dn(n, e, a[e].primKey, a[e].indexes);
|
|
2185
|
+
}), rn(e, n), void z.follow(function() {
|
|
2186
|
+
return e.on.populate.fire(o);
|
|
2187
|
+
}).catch(s)) : (rn(e, n), l = t, ((r = o).storeNames.includes("$meta") ? r.table("$meta").get("version").then(function(e) {
|
|
2188
|
+
return e ?? l;
|
|
2189
|
+
}) : z.resolve(l)).then(function(t) {
|
|
2190
|
+
return a = t, s = o, c = n, l = [], t = (r = e)._versions, u = r._dbSchema = mn(0, r.idbdb, c), (t = t.filter(function(e) {
|
|
2191
|
+
return e._cfg.version >= a;
|
|
2192
|
+
})).length === 0 ? z.resolve() : (t.forEach(function(e) {
|
|
2193
|
+
l.push(function() {
|
|
2194
|
+
var t = u, n = e._cfg.dbschema;
|
|
2195
|
+
hn(r, t, c), hn(r, n, c), u = r._dbSchema = n;
|
|
2196
|
+
var o = un(t, n);
|
|
2197
|
+
o.add.forEach(function(e) {
|
|
2198
|
+
dn(c, e[0], e[1].primKey, e[1].indexes);
|
|
2199
|
+
}), o.change.forEach(function(e) {
|
|
2200
|
+
if (e.recreate) throw new P.Upgrade("Not yet support for changing primary key");
|
|
2201
|
+
var t = c.objectStore(e.name);
|
|
2202
|
+
e.add.forEach(function(e) {
|
|
2203
|
+
return pn(t, e);
|
|
2204
|
+
}), e.change.forEach(function(e) {
|
|
2205
|
+
t.deleteIndex(e.name), pn(t, e);
|
|
2206
|
+
}), e.del.forEach(function(e) {
|
|
2207
|
+
return t.deleteIndex(e);
|
|
2208
|
+
});
|
|
2209
|
+
});
|
|
2210
|
+
var l = e._cfg.contentUpgrade;
|
|
2211
|
+
if (l && e._cfg.version > a) {
|
|
2212
|
+
rn(r, c), s._memoizedTables = {};
|
|
2213
|
+
var d = S(n);
|
|
2214
|
+
o.del.forEach(function(e) {
|
|
2215
|
+
d[e] = t[e];
|
|
2216
|
+
}), on(r, [r.Transaction.prototype]), an(r, [r.Transaction.prototype], i(d), d), s.schema = d;
|
|
2217
|
+
var f, p = k(l);
|
|
2218
|
+
return p && $e(), o = z.follow(function() {
|
|
2219
|
+
var e;
|
|
2220
|
+
(f = l(s)) && p && (e = et.bind(null, null), f.then(e, e));
|
|
2221
|
+
}), f && typeof f.then == "function" ? z.resolve(f) : o.then(function() {
|
|
2222
|
+
return f;
|
|
2223
|
+
});
|
|
2224
|
+
}
|
|
2225
|
+
}), l.push(function(t) {
|
|
2226
|
+
var n = e._cfg.dbschema, i = t;
|
|
2227
|
+
[].slice.call(i.db.objectStoreNames).forEach(function(e) {
|
|
2228
|
+
return n[e] == null && i.db.deleteObjectStore(e);
|
|
2229
|
+
}), on(r, [r.Transaction.prototype]), an(r, [r.Transaction.prototype], r._storeNames, r._dbSchema), s.schema = r._dbSchema;
|
|
2230
|
+
}), l.push(function(t) {
|
|
2231
|
+
r.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(r.idbdb.version / 10) === e._cfg.version ? (r.idbdb.deleteObjectStore("$meta"), delete r._dbSchema.$meta, r._storeNames = r._storeNames.filter(function(e) {
|
|
2232
|
+
return e !== "$meta";
|
|
2233
|
+
})) : t.objectStore("$meta").put(e._cfg.version, "version"));
|
|
2234
|
+
});
|
|
2235
|
+
}), function e() {
|
|
2236
|
+
return l.length ? z.resolve(l.shift()(s.idbtrans)).then(e) : z.resolve();
|
|
2237
|
+
}().then(function() {
|
|
2238
|
+
fn(u, c);
|
|
2239
|
+
}));
|
|
2240
|
+
var r, a, s, c, l, u;
|
|
2241
|
+
}).catch(s));
|
|
2242
|
+
var r, l;
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2245
|
+
function ln(e, t) {
|
|
2246
|
+
fn(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");
|
|
2247
|
+
var n = mn(0, e.idbdb, t);
|
|
2248
|
+
hn(e, e._dbSchema, t);
|
|
2249
|
+
for (var r = 0, i = un(n, e._dbSchema).change; r < i.length; r++) {
|
|
2250
|
+
var a = function(e) {
|
|
2251
|
+
if (e.change.length || e.recreate) return console.warn(`Unable to patch indexes of table ${e.name} because it has changes on the type of index or primary key.`), { value: void 0 };
|
|
2252
|
+
var n = t.objectStore(e.name);
|
|
2253
|
+
e.add.forEach(function(t) {
|
|
2254
|
+
I && console.debug(`Dexie upgrade patch: Creating missing index ${e.name}.${t.src}`), pn(n, t);
|
|
2255
|
+
});
|
|
2256
|
+
}(i[r]);
|
|
2257
|
+
if (typeof a == "object") return a.value;
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
function un(e, t) {
|
|
2261
|
+
var n, r = {
|
|
2262
|
+
del: [],
|
|
2263
|
+
add: [],
|
|
2264
|
+
change: []
|
|
2265
|
+
};
|
|
2266
|
+
for (n in e) t[n] || r.del.push(n);
|
|
2267
|
+
for (n in t) {
|
|
2268
|
+
var i = e[n], a = t[n];
|
|
2269
|
+
if (i) {
|
|
2270
|
+
var o = {
|
|
2271
|
+
name: n,
|
|
2272
|
+
def: a,
|
|
2273
|
+
recreate: !1,
|
|
2274
|
+
del: [],
|
|
2275
|
+
add: [],
|
|
2276
|
+
change: []
|
|
2277
|
+
};
|
|
2278
|
+
if ("" + (i.primKey.keyPath || "") != "" + (a.primKey.keyPath || "") || i.primKey.auto !== a.primKey.auto) o.recreate = !0, r.change.push(o);
|
|
2279
|
+
else {
|
|
2280
|
+
var s = i.idxByName, c = a.idxByName, l = void 0;
|
|
2281
|
+
for (l in s) c[l] || o.del.push(l);
|
|
2282
|
+
for (l in c) {
|
|
2283
|
+
var u = s[l], d = c[l];
|
|
2284
|
+
u ? u.src !== d.src && o.change.push(d) : o.add.push(d);
|
|
2285
|
+
}
|
|
2286
|
+
(0 < o.del.length || 0 < o.add.length || 0 < o.change.length) && r.change.push(o);
|
|
2287
|
+
}
|
|
2288
|
+
} else r.add.push([n, a]);
|
|
2289
|
+
}
|
|
2290
|
+
return r;
|
|
2291
|
+
}
|
|
2292
|
+
function dn(e, t, n, r) {
|
|
2293
|
+
var i = e.db.createObjectStore(t, n.keyPath ? {
|
|
2294
|
+
keyPath: n.keyPath,
|
|
2295
|
+
autoIncrement: n.auto
|
|
2296
|
+
} : { autoIncrement: n.auto });
|
|
2297
|
+
return r.forEach(function(e) {
|
|
2298
|
+
return pn(i, e);
|
|
2299
|
+
}), i;
|
|
2300
|
+
}
|
|
2301
|
+
function fn(e, t) {
|
|
2302
|
+
i(e).forEach(function(n) {
|
|
2303
|
+
t.db.objectStoreNames.contains(n) || (I && console.debug("Dexie: Creating missing table", n), dn(t, n, e[n].primKey, e[n].indexes));
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
function pn(e, t) {
|
|
2307
|
+
e.createIndex(t.name, t.keyPath, {
|
|
2308
|
+
unique: t.unique,
|
|
2309
|
+
multiEntry: t.multi
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
function mn(e, t, n) {
|
|
2313
|
+
var r = {};
|
|
2314
|
+
return g(t.objectStoreNames, 0).forEach(function(e) {
|
|
2315
|
+
for (var t = n.objectStore(e), i = qt(Jt(c = t.keyPath), c || "", !0, !1, !!t.autoIncrement, c && typeof c != "string", !0), a = [], o = 0; o < t.indexNames.length; ++o) {
|
|
2316
|
+
var s = t.index(t.indexNames[o]), c = s.keyPath, s = qt(s.name, c, !!s.unique, !!s.multiEntry, !1, c && typeof c != "string", !1);
|
|
2317
|
+
a.push(s);
|
|
2318
|
+
}
|
|
2319
|
+
r[e] = Yt(e, i, a);
|
|
2320
|
+
}), r;
|
|
2321
|
+
}
|
|
2322
|
+
function hn(e, t, n) {
|
|
2323
|
+
for (var i = n.db.objectStoreNames, a = 0; a < i.length; ++a) {
|
|
2324
|
+
var o = i[a], s = n.objectStore(o);
|
|
2325
|
+
e._hasGetAll = "getAll" in s;
|
|
2326
|
+
for (var c = 0; c < s.indexNames.length; ++c) {
|
|
2327
|
+
var l = s.indexNames[c], u = s.index(l).keyPath, d = typeof u == "string" ? u : "[" + g(u).join("+") + "]";
|
|
2328
|
+
!t[o] || (u = t[o].idxByName[d]) && (u.name = l, delete t[o].idxByName[d], t[o].idxByName[l] = u);
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && r.WorkerGlobalScope && r instanceof r.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
2332
|
+
}
|
|
2333
|
+
function gn(e) {
|
|
2334
|
+
return e.split(",").map(function(e, t) {
|
|
2335
|
+
var n = e.split(":"), r = (i = n[1])?.trim(), i = (e = n[0].trim()).replace(/([&*]|\+\+)/g, ""), n = /^\[/.test(i) ? i.match(/^\[(.*)\]$/)[1].split("+") : i;
|
|
2336
|
+
return qt(i, n || null, /\&/.test(e), /\*/.test(e), /\+\+/.test(e), a(n), t === 0, r);
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
var _n = (vn.prototype._createTableSchema = Yt, vn.prototype._parseIndexSyntax = gn, vn.prototype._parseStoresSpec = function(e, t) {
|
|
2340
|
+
var n = this;
|
|
2341
|
+
i(e).forEach(function(r) {
|
|
2342
|
+
if (e[r] !== null) {
|
|
2343
|
+
var i = n._parseIndexSyntax(e[r]), a = i.shift();
|
|
2344
|
+
if (!a) throw new P.Schema("Invalid schema for table " + r + ": " + e[r]);
|
|
2345
|
+
if (a.unique = !0, a.multi) throw new P.Schema("Primary key cannot be multiEntry*");
|
|
2346
|
+
i.forEach(function(e) {
|
|
2347
|
+
if (e.auto) throw new P.Schema("Only primary key can be marked as autoIncrement (++)");
|
|
2348
|
+
if (!e.keyPath) throw new P.Schema("Index must have a name and cannot be an empty string");
|
|
2349
|
+
}), i = n._createTableSchema(r, a, i), t[r] = i;
|
|
2350
|
+
}
|
|
2351
|
+
});
|
|
2352
|
+
}, vn.prototype.stores = function(e) {
|
|
2353
|
+
var t = this.db;
|
|
2354
|
+
this._cfg.storesSource = this._cfg.storesSource ? o(this._cfg.storesSource, e) : e;
|
|
2355
|
+
var e = t._versions, n = {}, r = {};
|
|
2356
|
+
return e.forEach(function(e) {
|
|
2357
|
+
o(n, e._cfg.storesSource), r = e._cfg.dbschema = {}, e._parseStoresSpec(n, r);
|
|
2358
|
+
}), t._dbSchema = r, on(t, [
|
|
2359
|
+
t._allTables,
|
|
2360
|
+
t,
|
|
2361
|
+
t.Transaction.prototype
|
|
2362
|
+
]), an(t, [
|
|
2363
|
+
t._allTables,
|
|
2364
|
+
t,
|
|
2365
|
+
t.Transaction.prototype,
|
|
2366
|
+
this._cfg.tables
|
|
2367
|
+
], i(r), r), t._storeNames = i(r), this;
|
|
2368
|
+
}, vn.prototype.upgrade = function(e) {
|
|
2369
|
+
return this._cfg.contentUpgrade = xe(this._cfg.contentUpgrade || F, e), this;
|
|
2370
|
+
}, vn);
|
|
2371
|
+
function vn() {}
|
|
2372
|
+
function yn(e, t) {
|
|
2373
|
+
var n = e._dbNamesDB;
|
|
2374
|
+
return n || (n = e._dbNamesDB = new Q(dt, {
|
|
2375
|
+
addons: [],
|
|
2376
|
+
indexedDB: e,
|
|
2377
|
+
IDBKeyRange: t
|
|
2378
|
+
})).version(1).stores({ dbnames: "name" }), n.table("dbnames");
|
|
2379
|
+
}
|
|
2380
|
+
function bn(e) {
|
|
2381
|
+
return e && typeof e.databases == "function";
|
|
2382
|
+
}
|
|
2383
|
+
function xn(e) {
|
|
2384
|
+
return Qe(function() {
|
|
2385
|
+
return R.letThrough = !0, e();
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
function Sn(e) {
|
|
2389
|
+
return !("from" in e);
|
|
2390
|
+
}
|
|
2391
|
+
var Z = function(e, t) {
|
|
2392
|
+
if (!this) {
|
|
2393
|
+
var n = new Z();
|
|
2394
|
+
return e && "d" in e && o(n, e), n;
|
|
2395
|
+
}
|
|
2396
|
+
o(this, arguments.length ? {
|
|
2397
|
+
d: 1,
|
|
2398
|
+
from: e,
|
|
2399
|
+
to: 1 < arguments.length ? t : e
|
|
2400
|
+
} : { d: 0 });
|
|
2401
|
+
};
|
|
2402
|
+
function Cn(e, t, n) {
|
|
2403
|
+
var r = W(t, n);
|
|
2404
|
+
if (!isNaN(r)) {
|
|
2405
|
+
if (0 < r) throw RangeError();
|
|
2406
|
+
if (Sn(e)) return o(e, {
|
|
2407
|
+
from: t,
|
|
2408
|
+
to: n,
|
|
2409
|
+
d: 1
|
|
2410
|
+
});
|
|
2411
|
+
var i = e.l, r = e.r;
|
|
2412
|
+
if (W(n, e.from) < 0) return i ? Cn(i, t, n) : e.l = {
|
|
2413
|
+
from: t,
|
|
2414
|
+
to: n,
|
|
2415
|
+
d: 1,
|
|
2416
|
+
l: null,
|
|
2417
|
+
r: null
|
|
2418
|
+
}, Dn(e);
|
|
2419
|
+
if (0 < W(t, e.to)) return r ? Cn(r, t, n) : e.r = {
|
|
2420
|
+
from: t,
|
|
2421
|
+
to: n,
|
|
2422
|
+
d: 1,
|
|
2423
|
+
l: null,
|
|
2424
|
+
r: null
|
|
2425
|
+
}, Dn(e);
|
|
2426
|
+
W(t, e.from) < 0 && (e.from = t, e.l = null, e.d = r ? r.d + 1 : 1), 0 < W(n, e.to) && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1), n = !e.r, i && !e.l && wn(e, i), r && n && wn(e, r);
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
function wn(e, t) {
|
|
2430
|
+
Sn(t) || function e(t, n) {
|
|
2431
|
+
var r = n.from, i = n.to, a = n.l, n = n.r;
|
|
2432
|
+
Cn(t, r, i), a && e(t, a), n && e(t, n);
|
|
2433
|
+
}(e, t);
|
|
2434
|
+
}
|
|
2435
|
+
function Tn(e, t) {
|
|
2436
|
+
var n = En(t), r = n.next();
|
|
2437
|
+
if (r.done) return !1;
|
|
2438
|
+
for (var i = r.value, a = En(e), o = a.next(i.from), s = o.value; !r.done && !o.done;) {
|
|
2439
|
+
if (W(s.from, i.to) <= 0 && 0 <= W(s.to, i.from)) return !0;
|
|
2440
|
+
W(i.from, s.from) < 0 ? i = (r = n.next(s.from)).value : s = (o = a.next(i.from)).value;
|
|
2441
|
+
}
|
|
2442
|
+
return !1;
|
|
2443
|
+
}
|
|
2444
|
+
function En(e) {
|
|
2445
|
+
var t = Sn(e) ? null : {
|
|
2446
|
+
s: 0,
|
|
2447
|
+
n: e
|
|
2448
|
+
};
|
|
2449
|
+
return { next: function(e) {
|
|
2450
|
+
for (var n = 0 < arguments.length; t;) switch (t.s) {
|
|
2451
|
+
case 0: if (t.s = 1, n) for (; t.n.l && W(e, t.n.from) < 0;) t = {
|
|
2452
|
+
up: t,
|
|
2453
|
+
n: t.n.l,
|
|
2454
|
+
s: 1
|
|
2455
|
+
};
|
|
2456
|
+
else for (; t.n.l;) t = {
|
|
2457
|
+
up: t,
|
|
2458
|
+
n: t.n.l,
|
|
2459
|
+
s: 1
|
|
2460
|
+
};
|
|
2461
|
+
case 1: if (t.s = 2, !n || W(e, t.n.to) <= 0) return {
|
|
2462
|
+
value: t.n,
|
|
2463
|
+
done: !1
|
|
2464
|
+
};
|
|
2465
|
+
case 2: if (t.n.r) {
|
|
2466
|
+
t.s = 3, t = {
|
|
2467
|
+
up: t,
|
|
2468
|
+
n: t.n.r,
|
|
2469
|
+
s: 0
|
|
2470
|
+
};
|
|
2471
|
+
continue;
|
|
2472
|
+
}
|
|
2473
|
+
case 3: t = t.up;
|
|
2474
|
+
}
|
|
2475
|
+
return { done: !0 };
|
|
2476
|
+
} };
|
|
2477
|
+
}
|
|
2478
|
+
function Dn(e) {
|
|
2479
|
+
var n, r, i = ((n = e.r)?.d || 0) - ((r = e.l)?.d || 0), a = 1 < i ? "r" : i < -1 ? "l" : "";
|
|
2480
|
+
a && (n = a == "r" ? "l" : "r", r = t({}, e), i = e[a], e.from = i.from, e.to = i.to, e[a] = i[a], r[a] = i[n], (e[n] = r).d = On(r)), e.d = On(e);
|
|
2481
|
+
}
|
|
2482
|
+
function On(e) {
|
|
2483
|
+
var t = e.r, e = e.l;
|
|
2484
|
+
return (t ? e ? Math.max(t.d, e.d) : t.d : e ? e.d : 0) + 1;
|
|
2485
|
+
}
|
|
2486
|
+
function kn(e, t) {
|
|
2487
|
+
return i(t).forEach(function(n) {
|
|
2488
|
+
e[n] ? wn(e[n], t[n]) : e[n] = function e(t) {
|
|
2489
|
+
var n, r, i = {};
|
|
2490
|
+
for (n in t) l(t, n) && (r = t[n], i[n] = !r || typeof r != "object" || w.has(r.constructor) ? r : e(r));
|
|
2491
|
+
return i;
|
|
2492
|
+
}(t[n]);
|
|
2493
|
+
}), e;
|
|
2494
|
+
}
|
|
2495
|
+
function An(e, t) {
|
|
2496
|
+
return e.all || t.all || Object.keys(e).some(function(n) {
|
|
2497
|
+
return t[n] && Tn(t[n], e[n]);
|
|
2498
|
+
});
|
|
2499
|
+
}
|
|
2500
|
+
u(Z.prototype, ((A = {
|
|
2501
|
+
add: function(e) {
|
|
2502
|
+
return wn(this, e), this;
|
|
2503
|
+
},
|
|
2504
|
+
addKey: function(e) {
|
|
2505
|
+
return Cn(this, e, e), this;
|
|
2506
|
+
},
|
|
2507
|
+
addKeys: function(e) {
|
|
2508
|
+
var t = this;
|
|
2509
|
+
return e.forEach(function(e) {
|
|
2510
|
+
return Cn(t, e, e);
|
|
2511
|
+
}), this;
|
|
2512
|
+
},
|
|
2513
|
+
hasKey: function(e) {
|
|
2514
|
+
var t = En(this).next(e).value;
|
|
2515
|
+
return t && W(t.from, e) <= 0 && 0 <= W(t.to, e);
|
|
2516
|
+
}
|
|
2517
|
+
})[ae] = function() {
|
|
2518
|
+
return En(this);
|
|
2519
|
+
}, A));
|
|
2520
|
+
var jn = {}, Mn = {}, Nn = !1;
|
|
2521
|
+
function Pn(e) {
|
|
2522
|
+
kn(Mn, e), Nn || (Nn = !0, setTimeout(function() {
|
|
2523
|
+
Nn = !1, Fn(Mn, !(Mn = {}));
|
|
2524
|
+
}, 0));
|
|
2525
|
+
}
|
|
2526
|
+
function Fn(e, t) {
|
|
2527
|
+
t === void 0 && (t = !1);
|
|
2528
|
+
var n = /* @__PURE__ */ new Set();
|
|
2529
|
+
if (e.all) for (var r = 0, i = Object.values(jn); r < i.length; r++) In(o = i[r], e, n, t);
|
|
2530
|
+
else for (var a in e) {
|
|
2531
|
+
var o, s = /^idb\:\/\/(.*)\/(.*)\//.exec(a);
|
|
2532
|
+
s && (a = s[1], s = s[2], (o = jn[`idb://${a}/${s}`]) && In(o, e, n, t));
|
|
2533
|
+
}
|
|
2534
|
+
n.forEach(function(e) {
|
|
2535
|
+
return e();
|
|
2536
|
+
});
|
|
2537
|
+
}
|
|
2538
|
+
function In(e, t, n, r) {
|
|
2539
|
+
for (var i = [], a = 0, o = Object.entries(e.queries.query); a < o.length; a++) {
|
|
2540
|
+
for (var s = o[a], c = s[0], l = [], u = 0, d = s[1]; u < d.length; u++) {
|
|
2541
|
+
var f = d[u];
|
|
2542
|
+
An(t, f.obsSet) ? f.subscribers.forEach(function(e) {
|
|
2543
|
+
return n.add(e);
|
|
2544
|
+
}) : r && l.push(f);
|
|
2545
|
+
}
|
|
2546
|
+
r && i.push([c, l]);
|
|
2547
|
+
}
|
|
2548
|
+
if (r) for (var p = 0, m = i; p < m.length; p++) {
|
|
2549
|
+
var h = m[p], c = h[0], l = h[1];
|
|
2550
|
+
e.queries.query[c] = l;
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
function Ln(e) {
|
|
2554
|
+
var t = e._state, n = e._deps.indexedDB;
|
|
2555
|
+
if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
|
|
2556
|
+
return t.dbOpenError ? H(t.dbOpenError) : e;
|
|
2557
|
+
});
|
|
2558
|
+
t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
|
|
2559
|
+
var r = t.openCanceller, a = Math.round(10 * e.verno), o = !1;
|
|
2560
|
+
function s() {
|
|
2561
|
+
if (t.openCanceller !== r) throw new P.DatabaseClosed("db.open() was cancelled");
|
|
2562
|
+
}
|
|
2563
|
+
function c() {
|
|
2564
|
+
return new z(function(r, l) {
|
|
2565
|
+
if (s(), !n) throw new P.MissingAPI();
|
|
2566
|
+
var u = e.name, p = t.autoSchema || !a ? n.open(u) : n.open(u, a);
|
|
2567
|
+
if (!p) throw new P.MissingAPI();
|
|
2568
|
+
p.onerror = Y(l), p.onblocked = B(e._fireOnBlocked), p.onupgradeneeded = B(function(r) {
|
|
2569
|
+
var i;
|
|
2570
|
+
d = p.transaction, t.autoSchema && !e._options.allowEmptyDB ? (p.onerror = Ht, d.abort(), p.result.close(), (i = n.deleteDatabase(u)).onsuccess = i.onerror = B(function() {
|
|
2571
|
+
l(new P.NoSuchDatabase(`Database ${u} doesnt exist`));
|
|
2572
|
+
})) : (d.onerror = Y(l), r = r.oldVersion > 2 ** 62 ? 0 : r.oldVersion, f = r < 1, e.idbdb = p.result, o && ln(e, d), cn(e, r / 10, d, l));
|
|
2573
|
+
}, l), p.onsuccess = B(function() {
|
|
2574
|
+
d = null;
|
|
2575
|
+
var n, s, l, m, h, _ = e.idbdb = p.result, v = g(_.objectStoreNames);
|
|
2576
|
+
if (0 < v.length) try {
|
|
2577
|
+
var y = _.transaction((m = v).length === 1 ? m[0] : m, "readonly");
|
|
2578
|
+
if (t.autoSchema) s = _, l = y, (n = e).verno = s.version / 10, l = n._dbSchema = mn(0, s, l), n._storeNames = g(s.objectStoreNames, 0), an(n, [n._allTables], i(l), l);
|
|
2579
|
+
else if (hn(e, e._dbSchema, y), ((h = un(mn(0, (h = e).idbdb, y), h._dbSchema)).add.length || h.change.some(function(e) {
|
|
2580
|
+
return e.add.length || e.change.length;
|
|
2581
|
+
})) && !o) 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."), _.close(), a = _.version + 1, o = !0, r(c());
|
|
2582
|
+
rn(e, y);
|
|
2583
|
+
} catch {}
|
|
2584
|
+
ut.push(e), _.onversionchange = B(function(n) {
|
|
2585
|
+
t.vcFired = !0, e.on("versionchange").fire(n);
|
|
2586
|
+
}), _.onclose = B(function(t) {
|
|
2587
|
+
e.on("close").fire(t);
|
|
2588
|
+
}), f && (h = e._deps, y = u, _ = h.indexedDB, h = h.IDBKeyRange, bn(_) || y === dt || yn(_, h).put({ name: y }).catch(F)), r();
|
|
2589
|
+
}, l);
|
|
2590
|
+
}).catch(function(e) {
|
|
2591
|
+
switch (e?.name) {
|
|
2592
|
+
case "UnknownError":
|
|
2593
|
+
if (0 < t.PR1398_maxLoop) return t.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), c();
|
|
2594
|
+
break;
|
|
2595
|
+
case "VersionError": if (0 < a) return a = 0, c();
|
|
2596
|
+
}
|
|
2597
|
+
return z.reject(e);
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
var l, u = t.dbReadyResolve, d = null, f = !1;
|
|
2601
|
+
return z.race([r, (typeof navigator > "u" ? z.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(e) {
|
|
2602
|
+
function t() {
|
|
2603
|
+
return indexedDB.databases().finally(e);
|
|
2604
|
+
}
|
|
2605
|
+
l = setInterval(t, 100), t();
|
|
2606
|
+
}).finally(function() {
|
|
2607
|
+
return clearInterval(l);
|
|
2608
|
+
}) : Promise.resolve()).then(c)]).then(function() {
|
|
2609
|
+
return s(), t.onReadyBeingFired = [], z.resolve(xn(function() {
|
|
2610
|
+
return e.on.ready.fire(e.vip);
|
|
2611
|
+
})).then(function n() {
|
|
2612
|
+
if (0 < t.onReadyBeingFired.length) {
|
|
2613
|
+
var r = t.onReadyBeingFired.reduce(xe, F);
|
|
2614
|
+
return t.onReadyBeingFired = [], z.resolve(xn(function() {
|
|
2615
|
+
return r(e.vip);
|
|
2616
|
+
})).then(n);
|
|
2617
|
+
}
|
|
2618
|
+
});
|
|
2619
|
+
}).finally(function() {
|
|
2620
|
+
t.openCanceller === r && (t.onReadyBeingFired = null, t.isBeingOpened = !1);
|
|
2621
|
+
}).catch(function(n) {
|
|
2622
|
+
t.dbOpenError = n;
|
|
2623
|
+
try {
|
|
2624
|
+
d && d.abort();
|
|
2625
|
+
} catch {}
|
|
2626
|
+
return r === t.openCanceller && e._close(), H(n);
|
|
2627
|
+
}).finally(function() {
|
|
2628
|
+
t.openComplete = !0, u();
|
|
2629
|
+
}).then(function() {
|
|
2630
|
+
var t;
|
|
2631
|
+
return f && (t = {}, e.tables.forEach(function(n) {
|
|
2632
|
+
n.schema.indexes.forEach(function(r) {
|
|
2633
|
+
r.name && (t[`idb://${e.name}/${n.name}/${r.name}`] = new Z(-Infinity, [[[]]]));
|
|
2634
|
+
}), t[`idb://${e.name}/${n.name}/`] = t[`idb://${e.name}/${n.name}/:dels`] = new Z(-Infinity, [[[]]]);
|
|
2635
|
+
}), Gt(Ut).fire(t), Fn(t, !0)), e;
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
function Rn(e) {
|
|
2639
|
+
function t(t) {
|
|
2640
|
+
return e.next(t);
|
|
2641
|
+
}
|
|
2642
|
+
var n = i(t), r = i(function(t) {
|
|
2643
|
+
return e.throw(t);
|
|
2644
|
+
});
|
|
2645
|
+
function i(e) {
|
|
2646
|
+
return function(t) {
|
|
2647
|
+
var i = e(t), t = i.value;
|
|
2648
|
+
return i.done ? t : t && typeof t.then == "function" ? t.then(n, r) : a(t) ? Promise.all(t).then(n, r) : n(t);
|
|
2649
|
+
};
|
|
2650
|
+
}
|
|
2651
|
+
return i(t)();
|
|
2652
|
+
}
|
|
2653
|
+
function zn(e, t, n) {
|
|
2654
|
+
for (var r = a(e) ? e.slice() : [e], i = 0; i < n; ++i) r.push(t);
|
|
2655
|
+
return r;
|
|
2656
|
+
}
|
|
2657
|
+
var Bn = {
|
|
2658
|
+
stack: "dbcore",
|
|
2659
|
+
name: "VirtualIndexMiddleware",
|
|
2660
|
+
level: 1,
|
|
2661
|
+
create: function(e) {
|
|
2662
|
+
return t(t({}, e), { table: function(n) {
|
|
2663
|
+
var r = e.table(n), i = r.schema, a = {}, o = [];
|
|
2664
|
+
function s(e, n, r) {
|
|
2665
|
+
var i = en(e), c = a[i] = a[i] || [], l = e == null ? 0 : typeof e == "string" ? 1 : e.length, u = 0 < n, u = t(t({}, r), {
|
|
2666
|
+
name: u ? `${i}(virtual-from:${r.name})` : r.name,
|
|
2667
|
+
lowLevelIndex: r,
|
|
2668
|
+
isVirtual: u,
|
|
2669
|
+
keyTail: n,
|
|
2670
|
+
keyLength: l,
|
|
2671
|
+
extractKey: Zt(e),
|
|
2672
|
+
unique: !u && r.unique
|
|
2673
|
+
});
|
|
2674
|
+
return c.push(u), u.isPrimaryKey || o.push(u), 1 < l && s(l === 2 ? e[0] : e.slice(0, l - 1), n + 1, r), c.sort(function(e, t) {
|
|
2675
|
+
return e.keyTail - t.keyTail;
|
|
2676
|
+
}), u;
|
|
2677
|
+
}
|
|
2678
|
+
n = s(i.primaryKey.keyPath, 0, i.primaryKey), a[":id"] = [n];
|
|
2679
|
+
for (var c = 0, l = i.indexes; c < l.length; c++) {
|
|
2680
|
+
var u = l[c];
|
|
2681
|
+
s(u.keyPath, 0, u);
|
|
2682
|
+
}
|
|
2683
|
+
function d(n) {
|
|
2684
|
+
var r, i = n.query.index;
|
|
2685
|
+
return i.isVirtual ? t(t({}, n), { query: {
|
|
2686
|
+
index: i.lowLevelIndex,
|
|
2687
|
+
range: (r = n.query.range, i = i.keyTail, {
|
|
2688
|
+
type: r.type === 1 ? 2 : r.type,
|
|
2689
|
+
lower: zn(r.lower, r.lowerOpen ? e.MAX_KEY : e.MIN_KEY, i),
|
|
2690
|
+
lowerOpen: !0,
|
|
2691
|
+
upper: zn(r.upper, r.upperOpen ? e.MIN_KEY : e.MAX_KEY, i),
|
|
2692
|
+
upperOpen: !0
|
|
2693
|
+
})
|
|
2694
|
+
} }) : n;
|
|
2695
|
+
}
|
|
2696
|
+
return t(t({}, r), {
|
|
2697
|
+
schema: t(t({}, i), {
|
|
2698
|
+
primaryKey: n,
|
|
2699
|
+
indexes: o,
|
|
2700
|
+
getIndexByKeyPath: function(e) {
|
|
2701
|
+
return (e = a[en(e)]) && e[0];
|
|
2702
|
+
}
|
|
2703
|
+
}),
|
|
2704
|
+
count: function(e) {
|
|
2705
|
+
return r.count(d(e));
|
|
2706
|
+
},
|
|
2707
|
+
query: function(e) {
|
|
2708
|
+
return r.query(d(e));
|
|
2709
|
+
},
|
|
2710
|
+
openCursor: function(t) {
|
|
2711
|
+
var n = t.query.index, i = n.keyTail, a = n.isVirtual, o = n.keyLength;
|
|
2712
|
+
return a ? r.openCursor(d(t)).then(function(e) {
|
|
2713
|
+
return e && s(e);
|
|
2714
|
+
}) : r.openCursor(t);
|
|
2715
|
+
function s(n) {
|
|
2716
|
+
return Object.create(n, {
|
|
2717
|
+
continue: { value: function(r) {
|
|
2718
|
+
r == null ? t.unique ? n.continue(n.key.slice(0, o).concat(t.reverse ? e.MIN_KEY : e.MAX_KEY, i)) : n.continue() : n.continue(zn(r, t.reverse ? e.MAX_KEY : e.MIN_KEY, i));
|
|
2719
|
+
} },
|
|
2720
|
+
continuePrimaryKey: { value: function(t, r) {
|
|
2721
|
+
n.continuePrimaryKey(zn(t, e.MAX_KEY, i), r);
|
|
2722
|
+
} },
|
|
2723
|
+
primaryKey: { get: function() {
|
|
2724
|
+
return n.primaryKey;
|
|
2725
|
+
} },
|
|
2726
|
+
key: { get: function() {
|
|
2727
|
+
var e = n.key;
|
|
2728
|
+
return o === 1 ? e[0] : e.slice(0, o);
|
|
2729
|
+
} },
|
|
2730
|
+
value: { get: function() {
|
|
2731
|
+
return n.value;
|
|
2732
|
+
} }
|
|
2733
|
+
});
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
});
|
|
2737
|
+
} });
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
function Vn(e, t, n, r) {
|
|
2741
|
+
return n ||= {}, r ||= "", i(e).forEach(function(i) {
|
|
2742
|
+
var a, o, s;
|
|
2743
|
+
l(t, i) ? (a = e[i], o = t[i], typeof a == "object" && typeof o == "object" && a && o ? (s = ie(a)) === ie(o) ? s === "Object" ? Vn(a, o, n, r + i + ".") : a !== o && (n[r + i] = t[i]) : n[r + i] = t[i] : a !== o && (n[r + i] = t[i])) : n[r + i] = void 0;
|
|
2744
|
+
}), i(t).forEach(function(i) {
|
|
2745
|
+
l(e, i) || (n[r + i] = t[i]);
|
|
2746
|
+
}), n;
|
|
2747
|
+
}
|
|
2748
|
+
function Hn(e, t) {
|
|
2749
|
+
return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
|
|
2750
|
+
}
|
|
2751
|
+
var Un = {
|
|
2752
|
+
stack: "dbcore",
|
|
2753
|
+
name: "HooksMiddleware",
|
|
2754
|
+
level: 2,
|
|
2755
|
+
create: function(e) {
|
|
2756
|
+
return t(t({}, e), { table: function(r) {
|
|
2757
|
+
var i = e.table(r), a = i.schema.primaryKey;
|
|
2758
|
+
return t(t({}, i), { mutate: function(e) {
|
|
2759
|
+
var o = R.trans, s = o.table(r).hook, c = s.deleting, u = s.creating, d = s.updating;
|
|
2760
|
+
switch (e.type) {
|
|
2761
|
+
case "add":
|
|
2762
|
+
if (u.fire === F) break;
|
|
2763
|
+
return o._promise("readwrite", function() {
|
|
2764
|
+
return f(e);
|
|
2765
|
+
}, !0);
|
|
2766
|
+
case "put":
|
|
2767
|
+
if (u.fire === F && d.fire === F) break;
|
|
2768
|
+
return o._promise("readwrite", function() {
|
|
2769
|
+
return f(e);
|
|
2770
|
+
}, !0);
|
|
2771
|
+
case "delete":
|
|
2772
|
+
if (c.fire === F) break;
|
|
2773
|
+
return o._promise("readwrite", function() {
|
|
2774
|
+
return f(e);
|
|
2775
|
+
}, !0);
|
|
2776
|
+
case "deleteRange":
|
|
2777
|
+
if (c.fire === F) break;
|
|
2778
|
+
return o._promise("readwrite", function() {
|
|
2779
|
+
return function e(n, r, o) {
|
|
2780
|
+
return i.query({
|
|
2781
|
+
trans: n,
|
|
2782
|
+
values: !1,
|
|
2783
|
+
query: {
|
|
2784
|
+
index: a,
|
|
2785
|
+
range: r
|
|
2786
|
+
},
|
|
2787
|
+
limit: o
|
|
2788
|
+
}).then(function(i) {
|
|
2789
|
+
var a = i.result;
|
|
2790
|
+
return f({
|
|
2791
|
+
type: "delete",
|
|
2792
|
+
keys: a,
|
|
2793
|
+
trans: n
|
|
2794
|
+
}).then(function(i) {
|
|
2795
|
+
return 0 < i.numFailures ? Promise.reject(i.failures[0]) : a.length < o ? {
|
|
2796
|
+
failures: [],
|
|
2797
|
+
numFailures: 0,
|
|
2798
|
+
lastResult: void 0
|
|
2799
|
+
} : e(n, t(t({}, r), {
|
|
2800
|
+
lower: a[a.length - 1],
|
|
2801
|
+
lowerOpen: !0
|
|
2802
|
+
}), o);
|
|
2803
|
+
});
|
|
2804
|
+
});
|
|
2805
|
+
}(e.trans, e.range, 1e4);
|
|
2806
|
+
}, !0);
|
|
2807
|
+
}
|
|
2808
|
+
return i.mutate(e);
|
|
2809
|
+
function f(e) {
|
|
2810
|
+
var r, o, s, f = R.trans, p = e.keys || Hn(a, e);
|
|
2811
|
+
if (!p) throw Error("Keys missing");
|
|
2812
|
+
return (e = e.type === "add" || e.type === "put" ? t(t({}, e), { keys: p }) : t({}, e)).type !== "delete" && (e.values = n([], e.values, !0)), e.keys &&= n([], e.keys, !0), r = i, s = p, ((o = e).type === "add" ? Promise.resolve([]) : r.getMany({
|
|
2813
|
+
trans: o.trans,
|
|
2814
|
+
keys: s,
|
|
2815
|
+
cache: "immutable"
|
|
2816
|
+
})).then(function(t) {
|
|
2817
|
+
var n = p.map(function(n, r) {
|
|
2818
|
+
var i, o, s, p = t[r], m = {
|
|
2819
|
+
onerror: null,
|
|
2820
|
+
onsuccess: null
|
|
2821
|
+
};
|
|
2822
|
+
return e.type === "delete" ? c.fire.call(m, n, p, f) : e.type === "add" || p === void 0 ? (i = u.fire.call(m, n, e.values[r], f), n == null && i != null && (e.keys[r] = n = i, a.outbound || x(e.values[r], a.keyPath, n))) : (i = Vn(p, e.values[r]), (o = d.fire.call(m, i, n, p, f)) && (s = e.values[r], Object.keys(o).forEach(function(e) {
|
|
2823
|
+
l(s, e) ? s[e] = o[e] : x(s, e, o[e]);
|
|
2824
|
+
}))), m;
|
|
2825
|
+
});
|
|
2826
|
+
return i.mutate(e).then(function(r) {
|
|
2827
|
+
for (var i = r.failures, a = r.results, o = r.numFailures, r = r.lastResult, s = 0; s < p.length; ++s) {
|
|
2828
|
+
var c = (a || p)[s], l = n[s];
|
|
2829
|
+
c == null ? l.onerror && l.onerror(i[s]) : l.onsuccess && l.onsuccess(e.type === "put" && t[s] ? e.values[s] : c);
|
|
2830
|
+
}
|
|
2831
|
+
return {
|
|
2832
|
+
failures: i,
|
|
2833
|
+
results: a,
|
|
2834
|
+
numFailures: o,
|
|
2835
|
+
lastResult: r
|
|
2836
|
+
};
|
|
2837
|
+
}).catch(function(e) {
|
|
2838
|
+
return n.forEach(function(t) {
|
|
2839
|
+
return t.onerror && t.onerror(e);
|
|
2840
|
+
}), Promise.reject(e);
|
|
2841
|
+
});
|
|
2842
|
+
});
|
|
2843
|
+
}
|
|
2844
|
+
} });
|
|
2845
|
+
} });
|
|
2846
|
+
}
|
|
2847
|
+
};
|
|
2848
|
+
function Wn(e, t, n) {
|
|
2849
|
+
try {
|
|
2850
|
+
if (!t || t.keys.length < e.length) return null;
|
|
2851
|
+
for (var r = [], i = 0, a = 0; i < t.keys.length && a < e.length; ++i) W(t.keys[i], e[a]) === 0 && (r.push(n ? T(t.values[i]) : t.values[i]), ++a);
|
|
2852
|
+
return r.length === e.length ? r : null;
|
|
2853
|
+
} catch {
|
|
2854
|
+
return null;
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
var Gn = {
|
|
2858
|
+
stack: "dbcore",
|
|
2859
|
+
level: -1,
|
|
2860
|
+
create: function(e) {
|
|
2861
|
+
return { table: function(n) {
|
|
2862
|
+
var r = e.table(n);
|
|
2863
|
+
return t(t({}, r), {
|
|
2864
|
+
getMany: function(e) {
|
|
2865
|
+
if (!e.cache) return r.getMany(e);
|
|
2866
|
+
var t = Wn(e.keys, e.trans._cache, e.cache === "clone");
|
|
2867
|
+
return t ? z.resolve(t) : r.getMany(e).then(function(t) {
|
|
2868
|
+
return e.trans._cache = {
|
|
2869
|
+
keys: e.keys,
|
|
2870
|
+
values: e.cache === "clone" ? T(t) : t
|
|
2871
|
+
}, t;
|
|
2872
|
+
});
|
|
2873
|
+
},
|
|
2874
|
+
mutate: function(e) {
|
|
2875
|
+
return e.type !== "add" && (e.trans._cache = null), r.mutate(e);
|
|
2876
|
+
}
|
|
2877
|
+
});
|
|
2878
|
+
} };
|
|
2879
|
+
}
|
|
2880
|
+
};
|
|
2881
|
+
function Kn(e, t) {
|
|
2882
|
+
return e.trans.mode === "readonly" && !!e.subscr && !e.trans.explicit && e.trans.db._options.cache !== "disabled" && !t.schema.primaryKey.outbound;
|
|
2883
|
+
}
|
|
2884
|
+
function qn(e, t) {
|
|
2885
|
+
switch (e) {
|
|
2886
|
+
case "query": return t.values && !t.unique;
|
|
2887
|
+
case "get":
|
|
2888
|
+
case "getMany":
|
|
2889
|
+
case "count":
|
|
2890
|
+
case "openCursor": return !1;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
var Jn = {
|
|
2894
|
+
stack: "dbcore",
|
|
2895
|
+
level: 0,
|
|
2896
|
+
name: "Observability",
|
|
2897
|
+
create: function(e) {
|
|
2898
|
+
var n = e.schema.name, r = new Z(e.MIN_KEY, e.MAX_KEY);
|
|
2899
|
+
return t(t({}, e), {
|
|
2900
|
+
transaction: function(t, n, r) {
|
|
2901
|
+
if (R.subscr && n !== "readonly") throw new P.ReadOnly(`Readwrite transaction in liveQuery context. Querier source: ${R.querier}`);
|
|
2902
|
+
return e.transaction(t, n, r);
|
|
2903
|
+
},
|
|
2904
|
+
table: function(o) {
|
|
2905
|
+
var s = e.table(o), c = s.schema, l = c.primaryKey, u = c.indexes, d = l.extractKey, f = l.outbound, p = l.autoIncrement && u.filter(function(e) {
|
|
2906
|
+
return e.compound && e.keyPath.includes(l.keyPath);
|
|
2907
|
+
}), m = t(t({}, s), { mutate: function(t) {
|
|
2908
|
+
function i(e) {
|
|
2909
|
+
return e = `idb://${n}/${o}/${e}`, h[e] || (h[e] = new Z());
|
|
2910
|
+
}
|
|
2911
|
+
var u, d, f, m = t.trans, h = t.mutatedParts ||= {}, g = i(""), _ = i(":dels"), v = t.type, y = t.type === "deleteRange" ? [t.range] : t.type === "delete" ? [t.keys] : t.values.length < 50 ? [Hn(l, t).filter(function(e) {
|
|
2912
|
+
return e;
|
|
2913
|
+
}), t.values] : [], b = y[0], x = y[1], y = t.trans._cache;
|
|
2914
|
+
return a(b) ? (g.addKeys(b), (y = v === "delete" || b.length === x.length ? Wn(b, y) : null) || _.addKeys(b), (y || x) && (u = i, d = y, f = x, c.indexes.forEach(function(e) {
|
|
2915
|
+
var t = u(e.name || "");
|
|
2916
|
+
function n(t) {
|
|
2917
|
+
return t == null ? null : e.extractKey(t);
|
|
2918
|
+
}
|
|
2919
|
+
function r(n) {
|
|
2920
|
+
return e.multiEntry && a(n) ? n.forEach(function(e) {
|
|
2921
|
+
return t.addKey(e);
|
|
2922
|
+
}) : t.addKey(n);
|
|
2923
|
+
}
|
|
2924
|
+
(d || f).forEach(function(e, t) {
|
|
2925
|
+
var i = d && n(d[t]), t = f && n(f[t]);
|
|
2926
|
+
W(i, t) !== 0 && (i != null && r(i), t != null && r(t));
|
|
2927
|
+
});
|
|
2928
|
+
}))) : b ? (x = {
|
|
2929
|
+
from: (x = b.lower) ?? e.MIN_KEY,
|
|
2930
|
+
to: (x = b.upper) ?? e.MAX_KEY
|
|
2931
|
+
}, _.add(x), g.add(x)) : (g.add(r), _.add(r), c.indexes.forEach(function(e) {
|
|
2932
|
+
return i(e.name).add(r);
|
|
2933
|
+
})), s.mutate(t).then(function(e) {
|
|
2934
|
+
return !b || t.type !== "add" && t.type !== "put" || (g.addKeys(e.results), p && p.forEach(function(n) {
|
|
2935
|
+
for (var r = t.values.map(function(e) {
|
|
2936
|
+
return n.extractKey(e);
|
|
2937
|
+
}), a = n.keyPath.findIndex(function(e) {
|
|
2938
|
+
return e === l.keyPath;
|
|
2939
|
+
}), o = 0, s = e.results.length; o < s; ++o) r[o][a] = e.results[o];
|
|
2940
|
+
i(n.name).addKeys(r);
|
|
2941
|
+
})), m.mutatedParts = kn(m.mutatedParts || {}, h), e;
|
|
2942
|
+
});
|
|
2943
|
+
} }), u = function(t) {
|
|
2944
|
+
var n = t.query, t = n.index, n = n.range;
|
|
2945
|
+
return [t, new Z((t = n.lower) ?? e.MIN_KEY, (n = n.upper) ?? e.MAX_KEY)];
|
|
2946
|
+
}, h = {
|
|
2947
|
+
get: function(e) {
|
|
2948
|
+
return [l, new Z(e.key)];
|
|
2949
|
+
},
|
|
2950
|
+
getMany: function(e) {
|
|
2951
|
+
return [l, new Z().addKeys(e.keys)];
|
|
2952
|
+
},
|
|
2953
|
+
count: u,
|
|
2954
|
+
query: u,
|
|
2955
|
+
openCursor: u
|
|
2956
|
+
};
|
|
2957
|
+
return i(h).forEach(function(e) {
|
|
2958
|
+
m[e] = function(i) {
|
|
2959
|
+
var a = R.subscr, c = !!a, l = Kn(R, s) && qn(e, i) ? i.obsSet = {} : a;
|
|
2960
|
+
if (c) {
|
|
2961
|
+
var u = function(e) {
|
|
2962
|
+
return e = `idb://${n}/${o}/${e}`, l[e] || (l[e] = new Z());
|
|
2963
|
+
}, p = u(""), m = u(":dels"), a = h[e](i), c = a[0], a = a[1];
|
|
2964
|
+
if ((e === "query" && c.isPrimaryKey && !i.values ? m : u(c.name || "")).add(a), !c.isPrimaryKey) {
|
|
2965
|
+
if (e !== "count") {
|
|
2966
|
+
var g = e === "query" && f && i.values && s.query(t(t({}, i), { values: !1 }));
|
|
2967
|
+
return s[e].apply(this, arguments).then(function(t) {
|
|
2968
|
+
if (e === "query") {
|
|
2969
|
+
if (f && i.values) return g.then(function(e) {
|
|
2970
|
+
return e = e.result, p.addKeys(e), t;
|
|
2971
|
+
});
|
|
2972
|
+
var n = i.values ? t.result.map(d) : t.result;
|
|
2973
|
+
(i.values ? p : m).addKeys(n);
|
|
2974
|
+
} else if (e === "openCursor") {
|
|
2975
|
+
var r = t, a = i.values;
|
|
2976
|
+
return r && Object.create(r, {
|
|
2977
|
+
key: { get: function() {
|
|
2978
|
+
return m.addKey(r.primaryKey), r.key;
|
|
2979
|
+
} },
|
|
2980
|
+
primaryKey: { get: function() {
|
|
2981
|
+
var e = r.primaryKey;
|
|
2982
|
+
return m.addKey(e), e;
|
|
2983
|
+
} },
|
|
2984
|
+
value: { get: function() {
|
|
2985
|
+
return a && p.addKey(r.primaryKey), r.value;
|
|
2986
|
+
} }
|
|
2987
|
+
});
|
|
2988
|
+
}
|
|
2989
|
+
return t;
|
|
2990
|
+
});
|
|
2991
|
+
}
|
|
2992
|
+
m.add(r);
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
return s[e].apply(this, arguments);
|
|
2996
|
+
};
|
|
2997
|
+
}), m;
|
|
2998
|
+
}
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
function Yn(e, n, r) {
|
|
3003
|
+
if (r.numFailures === 0) return n;
|
|
3004
|
+
if (n.type === "deleteRange") return null;
|
|
3005
|
+
var i = n.keys ? n.keys.length : "values" in n && n.values ? n.values.length : 1;
|
|
3006
|
+
return r.numFailures === i ? null : (n = t({}, n), a(n.keys) && (n.keys = n.keys.filter(function(e, t) {
|
|
3007
|
+
return !(t in r.failures);
|
|
3008
|
+
})), "values" in n && a(n.values) && (n.values = n.values.filter(function(e, t) {
|
|
3009
|
+
return !(t in r.failures);
|
|
3010
|
+
})), n);
|
|
3011
|
+
}
|
|
3012
|
+
function Xn(e, t) {
|
|
3013
|
+
return n = e, ((r = t).lower === void 0 || (r.lowerOpen ? 0 < W(n, r.lower) : 0 <= W(n, r.lower))) && (e = e, (t = t).upper === void 0 || (t.upperOpen ? W(e, t.upper) < 0 : W(e, t.upper) <= 0));
|
|
3014
|
+
var n, r;
|
|
3015
|
+
}
|
|
3016
|
+
function Zn(e, t, n, r, i, o) {
|
|
3017
|
+
if (!n || n.length === 0) return e;
|
|
3018
|
+
var s = t.query.index, c = s.multiEntry, l = t.query.range, u = r.schema.primaryKey.extractKey, d = s.extractKey, f = (s.lowLevelIndex || s).extractKey, n = n.reduce(function(e, n) {
|
|
3019
|
+
var r = e, i = [];
|
|
3020
|
+
if (n.type === "add" || n.type === "put") for (var o = new Z(), s = n.values.length - 1; 0 <= s; --s) {
|
|
3021
|
+
var f, p = n.values[s], m = u(p);
|
|
3022
|
+
o.hasKey(m) || (f = d(p), (c && a(f) ? f.some(function(e) {
|
|
3023
|
+
return Xn(e, l);
|
|
3024
|
+
}) : Xn(f, l)) && (o.addKey(m), i.push(p)));
|
|
3025
|
+
}
|
|
3026
|
+
switch (n.type) {
|
|
3027
|
+
case "add":
|
|
3028
|
+
var h = new Z().addKeys(t.values ? e.map(function(e) {
|
|
3029
|
+
return u(e);
|
|
3030
|
+
}) : e), r = e.concat(t.values ? i.filter(function(e) {
|
|
3031
|
+
return e = u(e), !h.hasKey(e) && (h.addKey(e), !0);
|
|
3032
|
+
}) : i.map(function(e) {
|
|
3033
|
+
return u(e);
|
|
3034
|
+
}).filter(function(e) {
|
|
3035
|
+
return !h.hasKey(e) && (h.addKey(e), !0);
|
|
3036
|
+
}));
|
|
3037
|
+
break;
|
|
3038
|
+
case "put":
|
|
3039
|
+
var g = new Z().addKeys(n.values.map(function(e) {
|
|
3040
|
+
return u(e);
|
|
3041
|
+
}));
|
|
3042
|
+
r = e.filter(function(e) {
|
|
3043
|
+
return !g.hasKey(t.values ? u(e) : e);
|
|
3044
|
+
}).concat(t.values ? i : i.map(function(e) {
|
|
3045
|
+
return u(e);
|
|
3046
|
+
}));
|
|
3047
|
+
break;
|
|
3048
|
+
case "delete":
|
|
3049
|
+
var _ = new Z().addKeys(n.keys);
|
|
3050
|
+
r = e.filter(function(e) {
|
|
3051
|
+
return !_.hasKey(t.values ? u(e) : e);
|
|
3052
|
+
});
|
|
3053
|
+
break;
|
|
3054
|
+
case "deleteRange":
|
|
3055
|
+
var v = n.range;
|
|
3056
|
+
r = e.filter(function(e) {
|
|
3057
|
+
return !Xn(u(e), v);
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3060
|
+
return r;
|
|
3061
|
+
}, e);
|
|
3062
|
+
return n === e ? e : (n.sort(function(e, t) {
|
|
3063
|
+
return W(f(e), f(t)) || W(u(e), u(t));
|
|
3064
|
+
}), t.limit && t.limit < Infinity && (n.length > t.limit ? n.length = t.limit : e.length === t.limit && n.length < t.limit && (i.dirty = !0)), o ? Object.freeze(n) : n);
|
|
3065
|
+
}
|
|
3066
|
+
function Qn(e, t) {
|
|
3067
|
+
return W(e.lower, t.lower) === 0 && W(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
|
|
3068
|
+
}
|
|
3069
|
+
function $n(e, t) {
|
|
3070
|
+
return function(e, t, n, r) {
|
|
3071
|
+
if (e === void 0) return t === void 0 ? 0 : -1;
|
|
3072
|
+
if (t === void 0) return 1;
|
|
3073
|
+
if ((t = W(e, t)) === 0) {
|
|
3074
|
+
if (n && r) return 0;
|
|
3075
|
+
if (n) return 1;
|
|
3076
|
+
if (r) return -1;
|
|
3077
|
+
}
|
|
3078
|
+
return t;
|
|
3079
|
+
}(e.lower, t.lower, e.lowerOpen, t.lowerOpen) <= 0 && 0 <= function(e, t, n, r) {
|
|
3080
|
+
if (e === void 0) return t === void 0 ? 0 : 1;
|
|
3081
|
+
if (t === void 0) return -1;
|
|
3082
|
+
if ((t = W(e, t)) === 0) {
|
|
3083
|
+
if (n && r) return 0;
|
|
3084
|
+
if (n) return -1;
|
|
3085
|
+
if (r) return 1;
|
|
3086
|
+
}
|
|
3087
|
+
return t;
|
|
3088
|
+
}(e.upper, t.upper, e.upperOpen, t.upperOpen);
|
|
3089
|
+
}
|
|
3090
|
+
function er(e, t, n, r) {
|
|
3091
|
+
e.subscribers.add(n), r.addEventListener("abort", function() {
|
|
3092
|
+
var r, i;
|
|
3093
|
+
e.subscribers.delete(n), e.subscribers.size === 0 && (r = e, i = t, setTimeout(function() {
|
|
3094
|
+
r.subscribers.size === 0 && E(i, r);
|
|
3095
|
+
}, 3e3));
|
|
3096
|
+
});
|
|
3097
|
+
}
|
|
3098
|
+
var tr = {
|
|
3099
|
+
stack: "dbcore",
|
|
3100
|
+
level: 0,
|
|
3101
|
+
name: "Cache",
|
|
3102
|
+
create: function(e) {
|
|
3103
|
+
var n = e.schema.name;
|
|
3104
|
+
return t(t({}, e), {
|
|
3105
|
+
transaction: function(t, r, i) {
|
|
3106
|
+
var a, o, s = e.transaction(t, r, i);
|
|
3107
|
+
return r === "readwrite" && (o = (a = new AbortController()).signal, i = function(i) {
|
|
3108
|
+
return function() {
|
|
3109
|
+
if (a.abort(), r === "readwrite") {
|
|
3110
|
+
for (var o = /* @__PURE__ */ new Set(), c = 0, l = t; c < l.length; c++) {
|
|
3111
|
+
var u = l[c], d = jn[`idb://${n}/${u}`];
|
|
3112
|
+
if (d) {
|
|
3113
|
+
var f = e.table(u), p = d.optimisticOps.filter(function(e) {
|
|
3114
|
+
return e.trans === s;
|
|
3115
|
+
});
|
|
3116
|
+
if (s._explicit && i && s.mutatedParts) for (var m = 0, h = Object.values(d.queries.query); m < h.length; m++) for (var g = 0, _ = (b = h[m]).slice(); g < _.length; g++) An((x = _[g]).obsSet, s.mutatedParts) && (E(b, x), x.subscribers.forEach(function(e) {
|
|
3117
|
+
return o.add(e);
|
|
3118
|
+
}));
|
|
3119
|
+
else if (0 < p.length) {
|
|
3120
|
+
d.optimisticOps = d.optimisticOps.filter(function(e) {
|
|
3121
|
+
return e.trans !== s;
|
|
3122
|
+
});
|
|
3123
|
+
for (var v = 0, y = Object.values(d.queries.query); v < y.length; v++) for (var b, x, S, C = 0, ee = (b = y[v]).slice(); C < ee.length; C++) (x = ee[C]).res != null && s.mutatedParts && (i && !x.dirty ? (S = Object.isFrozen(x.res), S = Zn(x.res, x.req, p, f, x, S), x.dirty ? (E(b, x), x.subscribers.forEach(function(e) {
|
|
3124
|
+
return o.add(e);
|
|
3125
|
+
})) : S !== x.res && (x.res = S, x.promise = z.resolve({ result: S }))) : (x.dirty && E(b, x), x.subscribers.forEach(function(e) {
|
|
3126
|
+
return o.add(e);
|
|
3127
|
+
})));
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
}
|
|
3131
|
+
o.forEach(function(e) {
|
|
3132
|
+
return e();
|
|
3133
|
+
});
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3136
|
+
}, s.addEventListener("abort", i(!1), { signal: o }), s.addEventListener("error", i(!1), { signal: o }), s.addEventListener("complete", i(!0), { signal: o })), s;
|
|
3137
|
+
},
|
|
3138
|
+
table: function(r) {
|
|
3139
|
+
var i = e.table(r), a = i.schema.primaryKey;
|
|
3140
|
+
return t(t({}, i), {
|
|
3141
|
+
mutate: function(e) {
|
|
3142
|
+
var o = R.trans;
|
|
3143
|
+
if (a.outbound || o.db._options.cache === "disabled" || o.explicit || o.idbtrans.mode !== "readwrite") return i.mutate(e);
|
|
3144
|
+
var s = jn[`idb://${n}/${r}`];
|
|
3145
|
+
return s ? (o = i.mutate(e), e.type !== "add" && e.type !== "put" || !(50 <= e.values.length || Hn(a, e).some(function(e) {
|
|
3146
|
+
return e == null;
|
|
3147
|
+
})) ? (s.optimisticOps.push(e), e.mutatedParts && Pn(e.mutatedParts), o.then(function(t) {
|
|
3148
|
+
0 < t.numFailures && (E(s.optimisticOps, e), (t = Yn(0, e, t)) && s.optimisticOps.push(t), e.mutatedParts && Pn(e.mutatedParts));
|
|
3149
|
+
}), o.catch(function() {
|
|
3150
|
+
E(s.optimisticOps, e), e.mutatedParts && Pn(e.mutatedParts);
|
|
3151
|
+
})) : o.then(function(n) {
|
|
3152
|
+
var r = Yn(0, t(t({}, e), { values: e.values.map(function(e, r) {
|
|
3153
|
+
var i;
|
|
3154
|
+
return n.failures[r] ? e : (e = (i = a.keyPath) != null && i.includes(".") ? T(e) : t({}, e), x(e, a.keyPath, n.results[r]), e);
|
|
3155
|
+
}) }), n);
|
|
3156
|
+
s.optimisticOps.push(r), queueMicrotask(function() {
|
|
3157
|
+
return e.mutatedParts && Pn(e.mutatedParts);
|
|
3158
|
+
});
|
|
3159
|
+
}), o) : i.mutate(e);
|
|
3160
|
+
},
|
|
3161
|
+
query: function(e) {
|
|
3162
|
+
if (!Kn(R, i) || !qn("query", e)) return i.query(e);
|
|
3163
|
+
var t = (c = R.trans)?.db._options.cache === "immutable", a = R, o = a.requery, s = a.signal, c = function(e, t, n, r) {
|
|
3164
|
+
var i = jn[`idb://${e}/${t}`];
|
|
3165
|
+
if (!i) return [];
|
|
3166
|
+
if (!(t = i.queries[n])) return [
|
|
3167
|
+
null,
|
|
3168
|
+
!1,
|
|
3169
|
+
i,
|
|
3170
|
+
null
|
|
3171
|
+
];
|
|
3172
|
+
var a = t[(r.query ? r.query.index.name : null) || ""];
|
|
3173
|
+
if (!a) return [
|
|
3174
|
+
null,
|
|
3175
|
+
!1,
|
|
3176
|
+
i,
|
|
3177
|
+
null
|
|
3178
|
+
];
|
|
3179
|
+
switch (n) {
|
|
3180
|
+
case "query":
|
|
3181
|
+
var o = a.find(function(e) {
|
|
3182
|
+
return e.req.limit === r.limit && e.req.values === r.values && Qn(e.req.query.range, r.query.range);
|
|
3183
|
+
});
|
|
3184
|
+
return o ? [
|
|
3185
|
+
o,
|
|
3186
|
+
!0,
|
|
3187
|
+
i,
|
|
3188
|
+
a
|
|
3189
|
+
] : [
|
|
3190
|
+
a.find(function(e) {
|
|
3191
|
+
return ("limit" in e.req ? e.req.limit : Infinity) >= r.limit && (!r.values || e.req.values) && $n(e.req.query.range, r.query.range);
|
|
3192
|
+
}),
|
|
3193
|
+
!1,
|
|
3194
|
+
i,
|
|
3195
|
+
a
|
|
3196
|
+
];
|
|
3197
|
+
case "count": return o = a.find(function(e) {
|
|
3198
|
+
return Qn(e.req.query.range, r.query.range);
|
|
3199
|
+
}), [
|
|
3200
|
+
o,
|
|
3201
|
+
!!o,
|
|
3202
|
+
i,
|
|
3203
|
+
a
|
|
3204
|
+
];
|
|
3205
|
+
}
|
|
3206
|
+
}(n, r, "query", e), l = c[0], a = c[1], u = c[2], d = c[3];
|
|
3207
|
+
return l && a ? l.obsSet = e.obsSet : (a = i.query(e).then(function(e) {
|
|
3208
|
+
var n = e.result;
|
|
3209
|
+
if (l && (l.res = n), t) {
|
|
3210
|
+
for (var r = 0, i = n.length; r < i; ++r) Object.freeze(n[r]);
|
|
3211
|
+
Object.freeze(n);
|
|
3212
|
+
} else e.result = T(n);
|
|
3213
|
+
return e;
|
|
3214
|
+
}).catch(function(e) {
|
|
3215
|
+
return d && l && E(d, l), Promise.reject(e);
|
|
3216
|
+
}), l = {
|
|
3217
|
+
obsSet: e.obsSet,
|
|
3218
|
+
promise: a,
|
|
3219
|
+
subscribers: /* @__PURE__ */ new Set(),
|
|
3220
|
+
type: "query",
|
|
3221
|
+
req: e,
|
|
3222
|
+
dirty: !1
|
|
3223
|
+
}, d ? d.push(l) : (d = [l], (u ||= jn[`idb://${n}/${r}`] = {
|
|
3224
|
+
queries: {
|
|
3225
|
+
query: {},
|
|
3226
|
+
count: {}
|
|
3227
|
+
},
|
|
3228
|
+
objs: /* @__PURE__ */ new Map(),
|
|
3229
|
+
optimisticOps: [],
|
|
3230
|
+
unsignaledParts: {}
|
|
3231
|
+
}).queries.query[e.query.index.name || ""] = d)), er(l, d, o, s), l.promise.then(function(n) {
|
|
3232
|
+
return { result: Zn(n.result, e, u?.optimisticOps, i, l, t) };
|
|
3233
|
+
});
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3236
|
+
}
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
};
|
|
3240
|
+
function nr(e, t) {
|
|
3241
|
+
return new Proxy(e, { get: function(e, n, r) {
|
|
3242
|
+
return n === "db" ? t : Reflect.get(e, n, r);
|
|
3243
|
+
} });
|
|
3244
|
+
}
|
|
3245
|
+
var Q = ($.prototype.version = function(e) {
|
|
3246
|
+
if (isNaN(e) || e < .1) throw new P.Type("Given version is not a positive number");
|
|
3247
|
+
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new P.Schema("Cannot add version when database is open");
|
|
3248
|
+
this.verno = Math.max(this.verno, e);
|
|
3249
|
+
var t = this._versions, n = t.filter(function(t) {
|
|
3250
|
+
return t._cfg.version === e;
|
|
3251
|
+
})[0];
|
|
3252
|
+
return n || (n = new this.Version(e), t.push(n), t.sort(sn), n.stores({}), this._state.autoSchema = !1, n);
|
|
3253
|
+
}, $.prototype._whenReady = function(e) {
|
|
3254
|
+
var t = this;
|
|
3255
|
+
return this.idbdb && (this._state.openComplete || R.letThrough || this._vip) ? e() : new z(function(e, n) {
|
|
3256
|
+
if (t._state.openComplete) return n(new P.DatabaseClosed(t._state.dbOpenError));
|
|
3257
|
+
if (!t._state.isBeingOpened) {
|
|
3258
|
+
if (!t._state.autoOpen) return void n(new P.DatabaseClosed());
|
|
3259
|
+
t.open().catch(F);
|
|
3260
|
+
}
|
|
3261
|
+
t._state.dbReadyPromise.then(e, n);
|
|
3262
|
+
}).then(e);
|
|
3263
|
+
}, $.prototype.use = function(e) {
|
|
3264
|
+
var t = e.stack, n = e.create, r = e.level, i = e.name;
|
|
3265
|
+
return i && this.unuse({
|
|
3266
|
+
stack: t,
|
|
3267
|
+
name: i
|
|
3268
|
+
}), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({
|
|
3269
|
+
stack: t,
|
|
3270
|
+
create: n,
|
|
3271
|
+
level: r ?? 10,
|
|
3272
|
+
name: i
|
|
3273
|
+
}), e.sort(function(e, t) {
|
|
3274
|
+
return e.level - t.level;
|
|
3275
|
+
}), this;
|
|
3276
|
+
}, $.prototype.unuse = function(e) {
|
|
3277
|
+
var t = e.stack, n = e.name, r = e.create;
|
|
3278
|
+
return t && this._middlewares[t] && (this._middlewares[t] = this._middlewares[t].filter(function(e) {
|
|
3279
|
+
return r ? e.create !== r : !!n && e.name !== n;
|
|
3280
|
+
})), this;
|
|
3281
|
+
}, $.prototype.open = function() {
|
|
3282
|
+
var e = this;
|
|
3283
|
+
return at(L, function() {
|
|
3284
|
+
return Ln(e);
|
|
3285
|
+
});
|
|
3286
|
+
}, $.prototype._close = function() {
|
|
3287
|
+
this.on.close.fire(new CustomEvent("close"));
|
|
3288
|
+
var e = this._state, t = ut.indexOf(this);
|
|
3289
|
+
if (0 <= t && ut.splice(t, 1), this.idbdb) {
|
|
3290
|
+
try {
|
|
3291
|
+
this.idbdb.close();
|
|
3292
|
+
} catch {}
|
|
3293
|
+
this.idbdb = null;
|
|
3294
|
+
}
|
|
3295
|
+
e.isBeingOpened || (e.dbReadyPromise = new z(function(t) {
|
|
3296
|
+
e.dbReadyResolve = t;
|
|
3297
|
+
}), e.openCanceller = new z(function(t, n) {
|
|
3298
|
+
e.cancelOpen = n;
|
|
3299
|
+
}));
|
|
3300
|
+
}, $.prototype.close = function(e) {
|
|
3301
|
+
var t = (e === void 0 ? { disableAutoOpen: !0 } : e).disableAutoOpen, e = this._state;
|
|
3302
|
+
t ? (e.isBeingOpened && e.cancelOpen(new P.DatabaseClosed()), this._close(), e.autoOpen = !1, e.dbOpenError = new P.DatabaseClosed()) : (this._close(), e.autoOpen = this._options.autoOpen || e.isBeingOpened, e.openComplete = !1, e.dbOpenError = null);
|
|
3303
|
+
}, $.prototype.delete = function(e) {
|
|
3304
|
+
var t = this;
|
|
3305
|
+
e === void 0 && (e = { disableAutoOpen: !0 });
|
|
3306
|
+
var n = 0 < arguments.length && typeof arguments[0] != "object", r = this._state;
|
|
3307
|
+
return new z(function(i, a) {
|
|
3308
|
+
function o() {
|
|
3309
|
+
t.close(e);
|
|
3310
|
+
var n = t._deps.indexedDB.deleteDatabase(t.name);
|
|
3311
|
+
n.onsuccess = B(function() {
|
|
3312
|
+
var e = t._deps, n = t.name, r = e.indexedDB;
|
|
3313
|
+
e = e.IDBKeyRange, bn(r) || n === dt || yn(r, e).delete(n).catch(F), i();
|
|
3314
|
+
}), n.onerror = Y(a), n.onblocked = t._fireOnBlocked;
|
|
3315
|
+
}
|
|
3316
|
+
if (n) throw new P.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
3317
|
+
r.isBeingOpened ? r.dbReadyPromise.then(o) : o();
|
|
3318
|
+
});
|
|
3319
|
+
}, $.prototype.backendDB = function() {
|
|
3320
|
+
return this.idbdb;
|
|
3321
|
+
}, $.prototype.isOpen = function() {
|
|
3322
|
+
return this.idbdb !== null;
|
|
3323
|
+
}, $.prototype.hasBeenClosed = function() {
|
|
3324
|
+
var e = this._state.dbOpenError;
|
|
3325
|
+
return e && e.name === "DatabaseClosed";
|
|
3326
|
+
}, $.prototype.hasFailed = function() {
|
|
3327
|
+
return this._state.dbOpenError !== null;
|
|
3328
|
+
}, $.prototype.dynamicallyOpened = function() {
|
|
3329
|
+
return this._state.autoSchema;
|
|
3330
|
+
}, Object.defineProperty($.prototype, "tables", {
|
|
3331
|
+
get: function() {
|
|
3332
|
+
var e = this;
|
|
3333
|
+
return i(this._allTables).map(function(t) {
|
|
3334
|
+
return e._allTables[t];
|
|
3335
|
+
});
|
|
3336
|
+
},
|
|
3337
|
+
enumerable: !1,
|
|
3338
|
+
configurable: !0
|
|
3339
|
+
}), $.prototype.transaction = function() {
|
|
3340
|
+
var e = function(e, t, n) {
|
|
3341
|
+
var r = arguments.length;
|
|
3342
|
+
if (r < 2) throw new P.InvalidArgument("Too few arguments");
|
|
3343
|
+
for (var i = Array(r - 1); --r;) i[r - 1] = arguments[r];
|
|
3344
|
+
return n = i.pop(), [
|
|
3345
|
+
e,
|
|
3346
|
+
ee(i),
|
|
3347
|
+
n
|
|
3348
|
+
];
|
|
3349
|
+
}.apply(this, arguments);
|
|
3350
|
+
return this._transaction.apply(this, e);
|
|
3351
|
+
}, $.prototype._transaction = function(e, t, n) {
|
|
3352
|
+
var r = this, i = R.trans;
|
|
3353
|
+
i && i.db === this && e.indexOf("!") === -1 || (i = null);
|
|
3354
|
+
var a, o, s = e.indexOf("?") !== -1;
|
|
3355
|
+
e = e.replace("!", "").replace("?", "");
|
|
3356
|
+
try {
|
|
3357
|
+
if (o = t.map(function(e) {
|
|
3358
|
+
if (e = e instanceof r.Table ? e.name : e, typeof e != "string") throw TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
3359
|
+
return e;
|
|
3360
|
+
}), e == "r" || e === ft) a = ft;
|
|
3361
|
+
else {
|
|
3362
|
+
if (e != "rw" && e != pt) throw new P.InvalidArgument("Invalid transaction mode: " + e);
|
|
3363
|
+
a = pt;
|
|
3364
|
+
}
|
|
3365
|
+
if (i) {
|
|
3366
|
+
if (i.mode === ft && a === pt) {
|
|
3367
|
+
if (!s) throw new P.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
3368
|
+
i = null;
|
|
3369
|
+
}
|
|
3370
|
+
i && o.forEach(function(e) {
|
|
3371
|
+
if (i && i.storeNames.indexOf(e) === -1) {
|
|
3372
|
+
if (!s) throw new P.SubTransaction("Table " + e + " not included in parent transaction.");
|
|
3373
|
+
i = null;
|
|
3374
|
+
}
|
|
3375
|
+
}), s && i && !i.active && (i = null);
|
|
3376
|
+
}
|
|
3377
|
+
} catch (e) {
|
|
3378
|
+
return i ? i._promise(null, function(t, n) {
|
|
3379
|
+
n(e);
|
|
3380
|
+
}) : H(e);
|
|
3381
|
+
}
|
|
3382
|
+
var c = function e(t, n, r, i, a) {
|
|
3383
|
+
return z.resolve().then(function() {
|
|
3384
|
+
var o = R.transless || R, s = t._createTransaction(n, r, t._dbSchema, i);
|
|
3385
|
+
if (s.explicit = !0, o = {
|
|
3386
|
+
trans: s,
|
|
3387
|
+
transless: o
|
|
3388
|
+
}, i) s.idbtrans = i.idbtrans;
|
|
3389
|
+
else try {
|
|
3390
|
+
s.create(), s.idbtrans._explicit = !0, t._state.PR1398_maxLoop = 3;
|
|
3391
|
+
} catch (i) {
|
|
3392
|
+
return i.name === ue.InvalidState && t.isOpen() && 0 < --t._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), t.close({ disableAutoOpen: !1 }), t.open().then(function() {
|
|
3393
|
+
return e(t, n, r, null, a);
|
|
3394
|
+
})) : H(i);
|
|
3395
|
+
}
|
|
3396
|
+
var c, l = k(a);
|
|
3397
|
+
return l && $e(), o = z.follow(function() {
|
|
3398
|
+
var e;
|
|
3399
|
+
(c = a.call(s, s)) && (l ? (e = et.bind(null, null), c.then(e, e)) : typeof c.next == "function" && typeof c.throw == "function" && (c = Rn(c)));
|
|
3400
|
+
}, o), (c && typeof c.then == "function" ? z.resolve(c).then(function(e) {
|
|
3401
|
+
return s.active ? e : H(new P.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3402
|
+
}) : o.then(function() {
|
|
3403
|
+
return c;
|
|
3404
|
+
})).then(function(e) {
|
|
3405
|
+
return i && s._resolve(), s._completion.then(function() {
|
|
3406
|
+
return e;
|
|
3407
|
+
});
|
|
3408
|
+
}).catch(function(e) {
|
|
3409
|
+
return s._reject(e), H(e);
|
|
3410
|
+
});
|
|
3411
|
+
});
|
|
3412
|
+
}.bind(null, this, a, o, i, n);
|
|
3413
|
+
return i ? i._promise(a, c, "lock") : R.trans ? at(R.transless, function() {
|
|
3414
|
+
return r._whenReady(c);
|
|
3415
|
+
}) : this._whenReady(c);
|
|
3416
|
+
}, $.prototype.table = function(e) {
|
|
3417
|
+
if (!l(this._allTables, e)) throw new P.InvalidTable(`Table ${e} does not exist`);
|
|
3418
|
+
return this._allTables[e];
|
|
3419
|
+
}, $);
|
|
3420
|
+
function $(e, n) {
|
|
3421
|
+
var r = this;
|
|
3422
|
+
this._middlewares = {}, this.verno = 0;
|
|
3423
|
+
var i = $.dependencies;
|
|
3424
|
+
this._options = n = t({
|
|
3425
|
+
addons: $.addons,
|
|
3426
|
+
autoOpen: !0,
|
|
3427
|
+
indexedDB: i.indexedDB,
|
|
3428
|
+
IDBKeyRange: i.IDBKeyRange,
|
|
3429
|
+
cache: "cloned"
|
|
3430
|
+
}, n), this._deps = {
|
|
3431
|
+
indexedDB: n.indexedDB,
|
|
3432
|
+
IDBKeyRange: n.IDBKeyRange
|
|
3433
|
+
}, i = n.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
3434
|
+
var a, o, s, c, l, u = {
|
|
3435
|
+
dbOpenError: null,
|
|
3436
|
+
isBeingOpened: !1,
|
|
3437
|
+
onReadyBeingFired: null,
|
|
3438
|
+
openComplete: !1,
|
|
3439
|
+
dbReadyResolve: F,
|
|
3440
|
+
dbReadyPromise: null,
|
|
3441
|
+
cancelOpen: F,
|
|
3442
|
+
openCanceller: null,
|
|
3443
|
+
autoSchema: !0,
|
|
3444
|
+
PR1398_maxLoop: 3,
|
|
3445
|
+
autoOpen: n.autoOpen
|
|
3446
|
+
};
|
|
3447
|
+
u.dbReadyPromise = new z(function(e) {
|
|
3448
|
+
u.dbReadyResolve = e;
|
|
3449
|
+
}), u.openCanceller = new z(function(e, t) {
|
|
3450
|
+
u.cancelOpen = t;
|
|
3451
|
+
}), this._state = u, this.name = e, this.on = St(this, "populate", "blocked", "versionchange", "close", { ready: [xe, F] }), this.once = function(e, t) {
|
|
3452
|
+
var n = function() {
|
|
3453
|
+
var i = [...arguments];
|
|
3454
|
+
r.on(e).unsubscribe(n), t.apply(r, i);
|
|
3455
|
+
};
|
|
3456
|
+
return r.on(e, n);
|
|
3457
|
+
}, this.on.ready.subscribe = _(this.on.ready.subscribe, function(e) {
|
|
3458
|
+
return function(t, n) {
|
|
3459
|
+
$.vip(function() {
|
|
3460
|
+
var i, a = r._state;
|
|
3461
|
+
a.openComplete ? (a.dbOpenError || z.resolve().then(t), n && e(t)) : a.onReadyBeingFired ? (a.onReadyBeingFired.push(t), n && e(t)) : (e(t), i = r, n || e(function e() {
|
|
3462
|
+
i.on.ready.unsubscribe(t), i.on.ready.unsubscribe(e);
|
|
3463
|
+
}));
|
|
3464
|
+
});
|
|
3465
|
+
};
|
|
3466
|
+
}), this.Collection = (a = this, Ct(Nt.prototype, function(e, t) {
|
|
3467
|
+
this.db = a;
|
|
3468
|
+
var n = ht, r = null;
|
|
3469
|
+
if (t) try {
|
|
3470
|
+
n = t();
|
|
3471
|
+
} catch (e) {
|
|
3472
|
+
r = e;
|
|
3473
|
+
}
|
|
3474
|
+
var i = e._ctx, t = i.table, e = t.hook.reading.fire;
|
|
3475
|
+
this._ctx = {
|
|
3476
|
+
table: t,
|
|
3477
|
+
index: i.index,
|
|
3478
|
+
isPrimKey: !i.index || t.schema.primKey.keyPath && i.index === t.schema.primKey.name,
|
|
3479
|
+
range: n,
|
|
3480
|
+
keysOnly: !1,
|
|
3481
|
+
dir: "next",
|
|
3482
|
+
unique: "",
|
|
3483
|
+
algorithm: null,
|
|
3484
|
+
filter: null,
|
|
3485
|
+
replayFilter: null,
|
|
3486
|
+
justLimit: !0,
|
|
3487
|
+
isMatch: null,
|
|
3488
|
+
offset: 0,
|
|
3489
|
+
limit: Infinity,
|
|
3490
|
+
error: r,
|
|
3491
|
+
or: i.or,
|
|
3492
|
+
valueMapper: e === me ? null : e
|
|
3493
|
+
};
|
|
3494
|
+
})), this.Table = (o = this, Ct(xt.prototype, function(e, t, n) {
|
|
3495
|
+
this.db = o, this._tx = n, this.name = e, this.schema = t, this.hook = o._allTables[e] ? o._allTables[e].hook : St(null, {
|
|
3496
|
+
creating: [_e, F],
|
|
3497
|
+
reading: [he, me],
|
|
3498
|
+
updating: [ye, F],
|
|
3499
|
+
deleting: [ve, F]
|
|
3500
|
+
});
|
|
3501
|
+
})), this.Transaction = (s = this, Ct(Kt.prototype, function(e, t, n, r, i) {
|
|
3502
|
+
var a = this;
|
|
3503
|
+
e !== "readonly" && t.forEach(function(e) {
|
|
3504
|
+
e = (e = n[e])?.yProps, e && (t = t.concat(e.map(function(e) {
|
|
3505
|
+
return e.updatesTable;
|
|
3506
|
+
})));
|
|
3507
|
+
}), this.db = s, this.mode = e, this.storeNames = t, this.schema = n, this.chromeTransactionDurability = r, this.idbtrans = null, this.on = St(this, "complete", "error", "abort"), this.parent = i || 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 z(function(e, t) {
|
|
3508
|
+
a._resolve = e, a._reject = t;
|
|
3509
|
+
}), this._completion.then(function() {
|
|
3510
|
+
a.active = !1, a.on.complete.fire();
|
|
3511
|
+
}, function(e) {
|
|
3512
|
+
var t = a.active;
|
|
3513
|
+
return a.active = !1, a.on.error.fire(e), a.parent ? a.parent._reject(e) : t && a.idbtrans && a.idbtrans.abort(), H(e);
|
|
3514
|
+
});
|
|
3515
|
+
})), this.Version = (c = this, Ct(_n.prototype, function(e) {
|
|
3516
|
+
this.db = c, this._cfg = {
|
|
3517
|
+
version: e,
|
|
3518
|
+
storesSource: null,
|
|
3519
|
+
dbschema: {},
|
|
3520
|
+
tables: {},
|
|
3521
|
+
contentUpgrade: null
|
|
3522
|
+
};
|
|
3523
|
+
})), this.WhereClause = (l = this, Ct(Vt.prototype, function(e, t, n) {
|
|
3524
|
+
if (this.db = l, this._ctx = {
|
|
3525
|
+
table: e,
|
|
3526
|
+
index: t === ":id" ? null : t,
|
|
3527
|
+
or: n
|
|
3528
|
+
}, this._cmp = this._ascending = W, this._descending = function(e, t) {
|
|
3529
|
+
return W(t, e);
|
|
3530
|
+
}, this._max = function(e, t) {
|
|
3531
|
+
return 0 < W(e, t) ? e : t;
|
|
3532
|
+
}, this._min = function(e, t) {
|
|
3533
|
+
return W(e, t) < 0 ? e : t;
|
|
3534
|
+
}, this._IDBKeyRange = l._deps.IDBKeyRange, !this._IDBKeyRange) throw new P.MissingAPI();
|
|
3535
|
+
})), this.on("versionchange", function(e) {
|
|
3536
|
+
0 < e.newVersion ? console.warn(`Another connection wants to upgrade database '${r.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${r.name}'. Closing db now to resume the delete request.`), r.close({ disableAutoOpen: !1 });
|
|
3537
|
+
}), this.on("blocked", function(e) {
|
|
3538
|
+
!e.newVersion || e.newVersion < e.oldVersion ? console.warn(`Dexie.delete('${r.name}') was blocked`) : console.warn(`Upgrade '${r.name}' blocked by other connection holding version ${e.oldVersion / 10}`);
|
|
3539
|
+
}), this._maxKey = Xt(n.IDBKeyRange), this._createTransaction = function(e, t, n, i) {
|
|
3540
|
+
return new r.Transaction(e, t, n, r._options.chromeTransactionDurability, i);
|
|
3541
|
+
}, this._fireOnBlocked = function(e) {
|
|
3542
|
+
r.on("blocked").fire(e), ut.filter(function(e) {
|
|
3543
|
+
return e.name === r.name && e !== r && !e._state.vcFired;
|
|
3544
|
+
}).map(function(t) {
|
|
3545
|
+
return t.on("versionchange").fire(e);
|
|
3546
|
+
});
|
|
3547
|
+
}, this.use(Gn), this.use(tr), this.use(Jn), this.use(Bn), this.use(Un);
|
|
3548
|
+
var d = new Proxy(this, { get: function(e, t, n) {
|
|
3549
|
+
if (t === "_vip") return !0;
|
|
3550
|
+
if (t === "table") return function(e) {
|
|
3551
|
+
return nr(r.table(e), d);
|
|
3552
|
+
};
|
|
3553
|
+
var i = Reflect.get(e, t, n);
|
|
3554
|
+
return i instanceof xt ? nr(i, d) : t === "tables" ? i.map(function(e) {
|
|
3555
|
+
return nr(e, d);
|
|
3556
|
+
}) : t === "_createTransaction" ? function() {
|
|
3557
|
+
return nr(i.apply(this, arguments), d);
|
|
3558
|
+
} : i;
|
|
3559
|
+
} });
|
|
3560
|
+
this.vip = d, i.forEach(function(e) {
|
|
3561
|
+
return e(r);
|
|
3562
|
+
});
|
|
3563
|
+
}
|
|
3564
|
+
var rr, A = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", ir = (ar.prototype.subscribe = function(e, t, n) {
|
|
3565
|
+
return this._subscribe(e && typeof e != "function" ? e : {
|
|
3566
|
+
next: e,
|
|
3567
|
+
error: t,
|
|
3568
|
+
complete: n
|
|
3569
|
+
});
|
|
3570
|
+
}, ar.prototype[A] = function() {
|
|
3571
|
+
return this;
|
|
3572
|
+
}, ar);
|
|
3573
|
+
function ar(e) {
|
|
3574
|
+
this._subscribe = e;
|
|
3575
|
+
}
|
|
3576
|
+
try {
|
|
3577
|
+
rr = {
|
|
3578
|
+
indexedDB: r.indexedDB || r.mozIndexedDB || r.webkitIndexedDB || r.msIndexedDB,
|
|
3579
|
+
IDBKeyRange: r.IDBKeyRange || r.webkitIDBKeyRange
|
|
3580
|
+
};
|
|
3581
|
+
} catch {
|
|
3582
|
+
rr = {
|
|
3583
|
+
indexedDB: null,
|
|
3584
|
+
IDBKeyRange: null
|
|
3585
|
+
};
|
|
3586
|
+
}
|
|
3587
|
+
function or(e) {
|
|
3588
|
+
var t, n = !1, r = new ir(function(r) {
|
|
3589
|
+
var i = k(e), a, o = !1, s = {}, c = {}, u = {
|
|
3590
|
+
get closed() {
|
|
3591
|
+
return o;
|
|
3592
|
+
},
|
|
3593
|
+
unsubscribe: function() {
|
|
3594
|
+
o || (o = !0, a && a.abort(), d && Gt.storagemutated.unsubscribe(p));
|
|
3595
|
+
}
|
|
3596
|
+
};
|
|
3597
|
+
r.start && r.start(u);
|
|
3598
|
+
var d = !1, f = function() {
|
|
3599
|
+
return st(m);
|
|
3600
|
+
}, p = function(e) {
|
|
3601
|
+
kn(s, e), An(c, s) && f();
|
|
3602
|
+
}, m = function() {
|
|
3603
|
+
var u, m, h;
|
|
3604
|
+
!o && rr.indexedDB && (s = {}, u = {}, a && a.abort(), a = new AbortController(), h = function(t) {
|
|
3605
|
+
var n = Ue();
|
|
3606
|
+
try {
|
|
3607
|
+
i && $e();
|
|
3608
|
+
var r = Qe(e, t);
|
|
3609
|
+
return r = i ? r.finally(et) : r;
|
|
3610
|
+
} finally {
|
|
3611
|
+
n && We();
|
|
3612
|
+
}
|
|
3613
|
+
}(m = {
|
|
3614
|
+
subscr: u,
|
|
3615
|
+
signal: a.signal,
|
|
3616
|
+
requery: f,
|
|
3617
|
+
querier: e,
|
|
3618
|
+
trans: null
|
|
3619
|
+
}), Promise.resolve(h).then(function(e) {
|
|
3620
|
+
n = !0, t = e, o || m.signal.aborted || (s = {}, function(e) {
|
|
3621
|
+
for (var t in e) if (l(e, t)) return;
|
|
3622
|
+
return 1;
|
|
3623
|
+
}(c = u) || d || (Gt(Ut, p), d = !0), st(function() {
|
|
3624
|
+
return !o && r.next && r.next(e);
|
|
3625
|
+
}));
|
|
3626
|
+
}, function(e) {
|
|
3627
|
+
n = !1, ["DatabaseClosedError", "AbortError"].includes(e?.name) || o || st(function() {
|
|
3628
|
+
o || r.error && r.error(e);
|
|
3629
|
+
});
|
|
3630
|
+
}));
|
|
3631
|
+
};
|
|
3632
|
+
return setTimeout(f, 0), u;
|
|
3633
|
+
});
|
|
3634
|
+
return r.hasValue = function() {
|
|
3635
|
+
return n;
|
|
3636
|
+
}, r.getValue = function() {
|
|
3637
|
+
return t;
|
|
3638
|
+
}, r;
|
|
3639
|
+
}
|
|
3640
|
+
var sr = Q;
|
|
3641
|
+
function cr(e) {
|
|
3642
|
+
var t = ur;
|
|
3643
|
+
try {
|
|
3644
|
+
ur = !0, Gt.storagemutated.fire(e), Fn(e, !0);
|
|
3645
|
+
} finally {
|
|
3646
|
+
ur = t;
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
u(sr, t(t({}, pe), {
|
|
3650
|
+
delete: function(e) {
|
|
3651
|
+
return new sr(e, { addons: [] }).delete();
|
|
3652
|
+
},
|
|
3653
|
+
exists: function(e) {
|
|
3654
|
+
return new sr(e, { addons: [] }).open().then(function(e) {
|
|
3655
|
+
return e.close(), !0;
|
|
3656
|
+
}).catch("NoSuchDatabaseError", function() {
|
|
3657
|
+
return !1;
|
|
3658
|
+
});
|
|
3659
|
+
},
|
|
3660
|
+
getDatabaseNames: function(e) {
|
|
3661
|
+
try {
|
|
3662
|
+
return t = sr.dependencies, n = t.indexedDB, t = t.IDBKeyRange, (bn(n) ? Promise.resolve(n.databases()).then(function(e) {
|
|
3663
|
+
return e.map(function(e) {
|
|
3664
|
+
return e.name;
|
|
3665
|
+
}).filter(function(e) {
|
|
3666
|
+
return e !== dt;
|
|
3667
|
+
});
|
|
3668
|
+
}) : yn(n, t).toCollection().primaryKeys()).then(e);
|
|
3669
|
+
} catch {
|
|
3670
|
+
return H(new P.MissingAPI());
|
|
3671
|
+
}
|
|
3672
|
+
var t, n;
|
|
3673
|
+
},
|
|
3674
|
+
defineClass: function() {
|
|
3675
|
+
return function(e) {
|
|
3676
|
+
o(this, e);
|
|
3677
|
+
};
|
|
3678
|
+
},
|
|
3679
|
+
ignoreTransaction: function(e) {
|
|
3680
|
+
return R.trans ? at(R.transless, e) : e();
|
|
3681
|
+
},
|
|
3682
|
+
vip: xn,
|
|
3683
|
+
async: function(e) {
|
|
3684
|
+
return function() {
|
|
3685
|
+
try {
|
|
3686
|
+
var t = Rn(e.apply(this, arguments));
|
|
3687
|
+
return t && typeof t.then == "function" ? t : z.resolve(t);
|
|
3688
|
+
} catch (e) {
|
|
3689
|
+
return H(e);
|
|
3690
|
+
}
|
|
3691
|
+
};
|
|
3692
|
+
},
|
|
3693
|
+
spawn: function(e, t, n) {
|
|
3694
|
+
try {
|
|
3695
|
+
var r = Rn(e.apply(n, t || []));
|
|
3696
|
+
return r && typeof r.then == "function" ? r : z.resolve(r);
|
|
3697
|
+
} catch (e) {
|
|
3698
|
+
return H(e);
|
|
3699
|
+
}
|
|
3700
|
+
},
|
|
3701
|
+
currentTransaction: { get: function() {
|
|
3702
|
+
return R.trans || null;
|
|
3703
|
+
} },
|
|
3704
|
+
waitFor: function(e, t) {
|
|
3705
|
+
return t = z.resolve(typeof e == "function" ? sr.ignoreTransaction(e) : e).timeout(t || 6e4), R.trans ? R.trans.waitFor(t) : t;
|
|
3706
|
+
},
|
|
3707
|
+
Promise: z,
|
|
3708
|
+
debug: {
|
|
3709
|
+
get: function() {
|
|
3710
|
+
return I;
|
|
3711
|
+
},
|
|
3712
|
+
set: function(e) {
|
|
3713
|
+
Se(e);
|
|
3714
|
+
}
|
|
3715
|
+
},
|
|
3716
|
+
derive: p,
|
|
3717
|
+
extend: o,
|
|
3718
|
+
props: u,
|
|
3719
|
+
override: _,
|
|
3720
|
+
Events: St,
|
|
3721
|
+
on: Gt,
|
|
3722
|
+
liveQuery: or,
|
|
3723
|
+
extendObservabilitySet: kn,
|
|
3724
|
+
getByKeyPath: b,
|
|
3725
|
+
setByKeyPath: x,
|
|
3726
|
+
delByKeyPath: function(e, t) {
|
|
3727
|
+
typeof t == "string" ? x(e, t, void 0) : "length" in t && [].map.call(t, function(t) {
|
|
3728
|
+
x(e, t, void 0);
|
|
3729
|
+
});
|
|
3730
|
+
},
|
|
3731
|
+
shallowClone: S,
|
|
3732
|
+
deepClone: T,
|
|
3733
|
+
getObjectDiff: Vn,
|
|
3734
|
+
cmp: W,
|
|
3735
|
+
asap: y,
|
|
3736
|
+
minKey: -Infinity,
|
|
3737
|
+
addons: [],
|
|
3738
|
+
connections: ut,
|
|
3739
|
+
errnames: ue,
|
|
3740
|
+
dependencies: rr,
|
|
3741
|
+
cache: jn,
|
|
3742
|
+
semVer: "4.2.0",
|
|
3743
|
+
version: "4.2.0".split(".").map(function(e) {
|
|
3744
|
+
return parseInt(e);
|
|
3745
|
+
}).reduce(function(e, t, n) {
|
|
3746
|
+
return e + t / 10 ** (2 * n);
|
|
3747
|
+
})
|
|
3748
|
+
})), sr.maxKey = Xt(sr.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (Gt(Ut, function(e) {
|
|
3749
|
+
ur ||= (e = new CustomEvent(Wt, { detail: e }), ur = !0, dispatchEvent(e), !1);
|
|
3750
|
+
}), addEventListener(Wt, function(e) {
|
|
3751
|
+
e = e.detail, ur || cr(e);
|
|
3752
|
+
}));
|
|
3753
|
+
var lr, ur = !1, dr = function() {};
|
|
3754
|
+
return typeof BroadcastChannel < "u" && ((dr = function() {
|
|
3755
|
+
(lr = new BroadcastChannel(Wt)).onmessage = function(e) {
|
|
3756
|
+
return e.data && cr(e.data);
|
|
3757
|
+
};
|
|
3758
|
+
})(), typeof lr.unref == "function" && lr.unref(), Gt(Ut, function(e) {
|
|
3759
|
+
ur || lr.postMessage(e);
|
|
3760
|
+
})), typeof addEventListener < "u" && (addEventListener("pagehide", function(e) {
|
|
3761
|
+
if (!Q.disableBfCache && e.persisted) {
|
|
3762
|
+
I && console.debug("Dexie: handling persisted pagehide"), lr?.close();
|
|
3763
|
+
for (var t = 0, n = ut; t < n.length; t++) n[t].close({ disableAutoOpen: !1 });
|
|
3764
|
+
}
|
|
3765
|
+
}), addEventListener("pageshow", function(e) {
|
|
3766
|
+
!Q.disableBfCache && e.persisted && (I && console.debug("Dexie: handling persisted pageshow"), dr(), cr({ all: new Z(-Infinity, [[]]) }));
|
|
3767
|
+
})), z.rejectionMapper = function(e, t) {
|
|
3768
|
+
return !e || e instanceof j || e instanceof TypeError || e instanceof SyntaxError || !e.name || !fe[e.name] ? e : (t = new fe[e.name](t || e.message, e), "stack" in e && f(t, "stack", { get: function() {
|
|
3769
|
+
return this.inner.stack;
|
|
3770
|
+
} }), t);
|
|
3771
|
+
}, Se(I), t(Q, Object.freeze({
|
|
3772
|
+
__proto__: null,
|
|
3773
|
+
Dexie: Q,
|
|
3774
|
+
liveQuery: or,
|
|
3775
|
+
Entity: _t,
|
|
3776
|
+
cmp: W,
|
|
3777
|
+
PropModification: jt,
|
|
3778
|
+
replacePrefix: function(e, t) {
|
|
3779
|
+
return new jt({ replacePrefix: [e, t] });
|
|
3780
|
+
},
|
|
3781
|
+
add: function(e) {
|
|
3782
|
+
return new jt({ add: e });
|
|
3783
|
+
},
|
|
3784
|
+
remove: function(e) {
|
|
3785
|
+
return new jt({ remove: e });
|
|
3786
|
+
},
|
|
3787
|
+
default: Q,
|
|
3788
|
+
RangeSet: Z,
|
|
3789
|
+
mergeRanges: wn,
|
|
3790
|
+
rangesOverlap: Tn
|
|
3791
|
+
}), { default: Q }), Q;
|
|
3792
|
+
});
|
|
3793
|
+
})))(), 1), d = Symbol.for("Dexie"), f = globalThis[d] || (globalThis[d] = u.default);
|
|
3794
|
+
if (u.default.semVer !== f.semVer) throw Error(`Two different versions of Dexie loaded in the same app: ${u.default.semVer} and ${f.semVer}`);
|
|
3795
|
+
var { liveQuery: p, mergeRanges: m, rangesOverlap: h, RangeSet: g, cmp: _, Entity: v, PropModification: y, replacePrefix: b, add: x, remove: S, DexieYProvider: C } = f, ee = /* @__PURE__ */ o(((e, t) => {
|
|
3796
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.ParsingError = void 0;
|
|
3797
|
+
var n = class extends Error {
|
|
3798
|
+
constructor(e, t) {
|
|
3799
|
+
super(e), this.cause = t;
|
|
3800
|
+
}
|
|
3801
|
+
};
|
|
3802
|
+
e.ParsingError = n;
|
|
3803
|
+
var r;
|
|
3804
|
+
function i() {
|
|
3805
|
+
return c(!1) || f() || d() || u() || s();
|
|
3806
|
+
}
|
|
3807
|
+
function a() {
|
|
3808
|
+
return h(/\s*/), c(!0) || d() || l() || s();
|
|
3809
|
+
}
|
|
3810
|
+
function o() {
|
|
3811
|
+
let e = s(), t = [], i, o = a();
|
|
3812
|
+
for (; o;) {
|
|
3813
|
+
if (o.node.type === "Element") {
|
|
3814
|
+
if (i) throw Error("Found multiple root nodes");
|
|
3815
|
+
i = o.node;
|
|
3816
|
+
}
|
|
3817
|
+
o.excluded || t.push(o.node), o = a();
|
|
3818
|
+
}
|
|
3819
|
+
if (!i) throw new n("Failed to parse XML", "Root Element not found");
|
|
3820
|
+
if (r.xml.length !== 0) throw new n("Failed to parse XML", "Not Well-Formed XML");
|
|
3821
|
+
return {
|
|
3822
|
+
declaration: e ? e.node : null,
|
|
3823
|
+
root: i,
|
|
3824
|
+
children: t
|
|
3825
|
+
};
|
|
3826
|
+
}
|
|
3827
|
+
function s() {
|
|
3828
|
+
let e = h(/^<\?([\w-:.]+)\s*/);
|
|
3829
|
+
if (!e) return;
|
|
3830
|
+
let t = {
|
|
3831
|
+
name: e[1],
|
|
3832
|
+
type: "ProcessingInstruction",
|
|
3833
|
+
content: ""
|
|
3834
|
+
}, i = r.xml.indexOf("?>");
|
|
3835
|
+
if (i > -1) t.content = r.xml.substring(0, i).trim(), r.xml = r.xml.slice(i);
|
|
3836
|
+
else throw new n("Failed to parse XML", "ProcessingInstruction closing tag not found");
|
|
3837
|
+
return h(/\?>/), {
|
|
3838
|
+
excluded: r.options.filter(t) === !1,
|
|
3839
|
+
node: t
|
|
3840
|
+
};
|
|
3841
|
+
}
|
|
3842
|
+
function c(e) {
|
|
3843
|
+
let t = h(/^<([^?!</>\s]+)\s*/);
|
|
3844
|
+
if (!t) return;
|
|
3845
|
+
let a = {
|
|
3846
|
+
type: "Element",
|
|
3847
|
+
name: t[1],
|
|
3848
|
+
attributes: {},
|
|
3849
|
+
children: []
|
|
3850
|
+
}, o = e ? !1 : r.options.filter(a) === !1;
|
|
3851
|
+
for (; !(g() || _(">") || _("?>") || _("/>"));) {
|
|
3852
|
+
let e = p();
|
|
3853
|
+
if (e) a.attributes[e.name] = e.value;
|
|
3854
|
+
else return;
|
|
3855
|
+
}
|
|
3856
|
+
if (h(/^\s*\/>/)) return a.children = null, {
|
|
3857
|
+
excluded: o,
|
|
3858
|
+
node: a
|
|
3859
|
+
};
|
|
3860
|
+
h(/\??>/);
|
|
3861
|
+
let s = i();
|
|
3862
|
+
for (; s;) s.excluded || a.children.push(s.node), s = i();
|
|
3863
|
+
if (r.options.strictMode) {
|
|
3864
|
+
let e = `</${a.name}>`;
|
|
3865
|
+
if (r.xml.startsWith(e)) r.xml = r.xml.slice(e.length);
|
|
3866
|
+
else throw new n("Failed to parse XML", `Closing tag not matching "${e}"`);
|
|
3867
|
+
} else h(/^<\/[\p{L}\p{M}\w\-:.]+\s*>/u);
|
|
3868
|
+
return {
|
|
3869
|
+
excluded: o,
|
|
3870
|
+
node: a
|
|
3871
|
+
};
|
|
3872
|
+
}
|
|
3873
|
+
function l() {
|
|
3874
|
+
let e = h(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/) || h(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/) || h(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/) || h(/^<!DOCTYPE\s+\S+\s*>/);
|
|
3875
|
+
if (e) {
|
|
3876
|
+
let t = {
|
|
3877
|
+
type: "DocumentType",
|
|
3878
|
+
content: e[0]
|
|
3879
|
+
};
|
|
3880
|
+
return {
|
|
3881
|
+
excluded: r.options.filter(t) === !1,
|
|
3882
|
+
node: t
|
|
3883
|
+
};
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
function u() {
|
|
3887
|
+
if (r.xml.startsWith("<![CDATA[")) {
|
|
3888
|
+
let e = r.xml.indexOf("]]>");
|
|
3889
|
+
if (e > -1) {
|
|
3890
|
+
let t = e + 3, n = {
|
|
3891
|
+
type: "CDATA",
|
|
3892
|
+
content: r.xml.substring(0, t)
|
|
3893
|
+
};
|
|
3894
|
+
return r.xml = r.xml.slice(t), {
|
|
3895
|
+
excluded: r.options.filter(n) === !1,
|
|
3896
|
+
node: n
|
|
3897
|
+
};
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
function d() {
|
|
3902
|
+
let e = h(/^<!--[\s\S]*?-->/);
|
|
3903
|
+
if (e) {
|
|
3904
|
+
let t = {
|
|
3905
|
+
type: "Comment",
|
|
3906
|
+
content: e[0]
|
|
3907
|
+
};
|
|
3908
|
+
return {
|
|
3909
|
+
excluded: r.options.filter(t) === !1,
|
|
3910
|
+
node: t
|
|
3911
|
+
};
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
function f() {
|
|
3915
|
+
let e = h(/^([^<]+)/);
|
|
3916
|
+
if (e) {
|
|
3917
|
+
let t = {
|
|
3918
|
+
type: "Text",
|
|
3919
|
+
content: e[1]
|
|
3920
|
+
};
|
|
3921
|
+
return {
|
|
3922
|
+
excluded: r.options.filter(t) === !1,
|
|
3923
|
+
node: t
|
|
3924
|
+
};
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
function p() {
|
|
3928
|
+
let e = h(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);
|
|
3929
|
+
if (e) return {
|
|
3930
|
+
name: e[1].trim(),
|
|
3931
|
+
value: m(e[2].trim())
|
|
3932
|
+
};
|
|
3933
|
+
}
|
|
3934
|
+
function m(e) {
|
|
3935
|
+
return e.replace(/^['"]|['"]$/g, "");
|
|
3936
|
+
}
|
|
3937
|
+
function h(e) {
|
|
3938
|
+
let t = r.xml.match(e);
|
|
3939
|
+
if (t) return r.xml = r.xml.slice(t[0].length), t;
|
|
3940
|
+
}
|
|
3941
|
+
function g() {
|
|
3942
|
+
return r.xml.length === 0;
|
|
3943
|
+
}
|
|
3944
|
+
function _(e) {
|
|
3945
|
+
return r.xml.indexOf(e) === 0;
|
|
3946
|
+
}
|
|
3947
|
+
function v(e, t = {}) {
|
|
3948
|
+
e = e.trim();
|
|
3949
|
+
let n = t.filter || (() => !0);
|
|
3950
|
+
return r = {
|
|
3951
|
+
xml: e,
|
|
3952
|
+
options: Object.assign(Object.assign({}, t), {
|
|
3953
|
+
filter: n,
|
|
3954
|
+
strictMode: t.strictMode === !0
|
|
3955
|
+
})
|
|
3956
|
+
}, o();
|
|
3957
|
+
}
|
|
3958
|
+
t !== void 0 && typeof e == "object" && (t.exports = v), e.default = v;
|
|
3959
|
+
}));
|
|
3960
|
+
(/* @__PURE__ */ o(((e, t) => {
|
|
3961
|
+
var n = e && e.__importDefault || function(e) {
|
|
3962
|
+
return e && e.__esModule ? e : { default: e };
|
|
3963
|
+
};
|
|
3964
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3965
|
+
var r = n(ee());
|
|
3966
|
+
function i(e) {
|
|
3967
|
+
if (!e.options.indentation && !e.options.lineSeparator) return;
|
|
3968
|
+
e.content += e.options.lineSeparator;
|
|
3969
|
+
let t;
|
|
3970
|
+
for (t = 0; t < e.level; t++) e.content += e.options.indentation;
|
|
3971
|
+
}
|
|
3972
|
+
function a(e) {
|
|
3973
|
+
e.content = e.content.replace(/ +$/, "");
|
|
3974
|
+
let t;
|
|
3975
|
+
for (t = 0; t < e.level; t++) e.content += e.options.indentation;
|
|
3976
|
+
}
|
|
3977
|
+
function o(e, t) {
|
|
3978
|
+
e.content += t;
|
|
3979
|
+
}
|
|
3980
|
+
function s(e, t, n) {
|
|
3981
|
+
if (e.type === "Element") u(e, t, n);
|
|
3982
|
+
else if (e.type === "ProcessingInstruction") f(e, t);
|
|
3983
|
+
else if (typeof e.content == "string") c(e.content, t, n);
|
|
3984
|
+
else throw Error("Unknown node type: " + e.type);
|
|
3985
|
+
}
|
|
3986
|
+
function c(e, t, n) {
|
|
3987
|
+
if (!n) {
|
|
3988
|
+
let n = e.trim();
|
|
3989
|
+
(t.options.lineSeparator || n.length === 0) && (e = n);
|
|
3990
|
+
}
|
|
3991
|
+
e.length > 0 && (!n && t.content.length > 0 && i(t), o(t, e));
|
|
3992
|
+
}
|
|
3993
|
+
function l(e, t) {
|
|
3994
|
+
let n = "/" + e.join("/"), r = e[e.length - 1];
|
|
3995
|
+
return t.includes(r) || t.includes(n);
|
|
3996
|
+
}
|
|
3997
|
+
function u(e, t, n) {
|
|
3998
|
+
if (t.path.push(e.name), !n && t.content.length > 0 && i(t), o(t, "<" + e.name), d(t, e.attributes), e.children === null || t.options.forceSelfClosingEmptyTag && e.children.length === 0) o(t, t.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>");
|
|
3999
|
+
else if (e.children.length === 0) o(t, "></" + e.name + ">");
|
|
4000
|
+
else {
|
|
4001
|
+
let r = e.children;
|
|
4002
|
+
o(t, ">"), t.level++;
|
|
4003
|
+
let c = e.attributes["xml:space"] === "preserve" || n, u = !1;
|
|
4004
|
+
if (!c && t.options.ignoredPaths && (u = l(t.path, t.options.ignoredPaths), c = u), !c && t.options.collapseContent) {
|
|
4005
|
+
let e = !1, t = !1, i = !1;
|
|
4006
|
+
r.forEach(function(a, o) {
|
|
4007
|
+
a.type === "Text" ? (a.content.includes("\n") ? (t = !0, a.content = a.content.trim()) : (o === 0 || o === r.length - 1) && !n && a.content.trim().length === 0 && (a.content = ""), (a.content.trim().length > 0 || r.length === 1) && (e = !0)) : a.type === "CDATA" ? e = !0 : i = !0;
|
|
4008
|
+
}), e && (!i || !t) && (c = !0);
|
|
4009
|
+
}
|
|
4010
|
+
r.forEach(function(e) {
|
|
4011
|
+
s(e, t, n || c);
|
|
4012
|
+
}), t.level--, !n && !c && i(t), u && a(t), o(t, "</" + e.name + ">");
|
|
4013
|
+
}
|
|
4014
|
+
t.path.pop();
|
|
4015
|
+
}
|
|
4016
|
+
function d(e, t) {
|
|
4017
|
+
Object.keys(t).forEach(function(n) {
|
|
4018
|
+
if (e.options.attributeQuotes === "single") {
|
|
4019
|
+
let r = t[n].replace(/'/g, "'");
|
|
4020
|
+
o(e, " " + n + "='" + r + "'");
|
|
4021
|
+
} else {
|
|
4022
|
+
let r = t[n].replace(/"/g, """);
|
|
4023
|
+
o(e, " " + n + "=\"" + r + "\"");
|
|
4024
|
+
}
|
|
4025
|
+
});
|
|
4026
|
+
}
|
|
4027
|
+
function f(e, t) {
|
|
4028
|
+
t.content.length > 0 && i(t), o(t, "<?" + e.name), o(t, " " + e.content.trim()), o(t, "?>");
|
|
4029
|
+
}
|
|
4030
|
+
function p(e, t = {}) {
|
|
4031
|
+
t.indentation = "indentation" in t ? t.indentation : " ", t.collapseContent = t.collapseContent === !0, t.lineSeparator = "lineSeparator" in t ? t.lineSeparator : "\r\n", t.whiteSpaceAtEndOfSelfclosingTag = t.whiteSpaceAtEndOfSelfclosingTag === !0, t.throwOnFailure = t.throwOnFailure !== !1, t.attributeQuotes = "attributeQuotes" in t ? t.attributeQuotes : "double";
|
|
4032
|
+
try {
|
|
4033
|
+
let n = (0, r.default)(e, {
|
|
4034
|
+
filter: t.filter,
|
|
4035
|
+
strictMode: t.strictMode
|
|
4036
|
+
}), i = {
|
|
4037
|
+
content: "",
|
|
4038
|
+
level: 0,
|
|
4039
|
+
options: t,
|
|
4040
|
+
path: []
|
|
4041
|
+
};
|
|
4042
|
+
return n.declaration && f(n.declaration, i), n.children.forEach(function(e) {
|
|
4043
|
+
s(e, i, !1);
|
|
4044
|
+
}), t.lineSeparator ? i.content.replace(/\r\n/g, "\n").replace(/\n/g, t.lineSeparator) : i.content;
|
|
4045
|
+
} catch (n) {
|
|
4046
|
+
if (t.throwOnFailure) throw n;
|
|
4047
|
+
return e;
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
p.minify = (e, t = {}) => p(e, Object.assign(Object.assign({}, t), {
|
|
4051
|
+
indentation: "",
|
|
4052
|
+
lineSeparator: ""
|
|
4053
|
+
})), t !== void 0 && typeof e == "object" && (t.exports = p), e.default = p;
|
|
4054
|
+
})))();
|
|
4055
|
+
var te = /* @__PURE__ */ o(((e, t) => {
|
|
4056
|
+
t.exports = {};
|
|
4057
|
+
}));
|
|
4058
|
+
(/* @__PURE__ */ o(((e) => {
|
|
4059
|
+
(function(e) {
|
|
4060
|
+
e.parser = function(e, t) {
|
|
4061
|
+
return new n(e, t);
|
|
4062
|
+
}, e.SAXParser = n, e.SAXStream = u, e.createStream = c, e.MAX_BUFFER_LENGTH = 64 * 1024;
|
|
4063
|
+
var t = [
|
|
4064
|
+
"comment",
|
|
4065
|
+
"sgmlDecl",
|
|
4066
|
+
"textNode",
|
|
4067
|
+
"tagName",
|
|
4068
|
+
"doctype",
|
|
4069
|
+
"procInstName",
|
|
4070
|
+
"procInstBody",
|
|
4071
|
+
"entity",
|
|
4072
|
+
"attribName",
|
|
4073
|
+
"attribValue",
|
|
4074
|
+
"cdata",
|
|
4075
|
+
"script"
|
|
4076
|
+
];
|
|
4077
|
+
e.EVENTS = [
|
|
4078
|
+
"text",
|
|
4079
|
+
"processinginstruction",
|
|
4080
|
+
"sgmldeclaration",
|
|
4081
|
+
"doctype",
|
|
4082
|
+
"comment",
|
|
4083
|
+
"opentagstart",
|
|
4084
|
+
"attribute",
|
|
4085
|
+
"opentag",
|
|
4086
|
+
"closetag",
|
|
4087
|
+
"opencdata",
|
|
4088
|
+
"cdata",
|
|
4089
|
+
"closecdata",
|
|
4090
|
+
"error",
|
|
4091
|
+
"end",
|
|
4092
|
+
"ready",
|
|
4093
|
+
"script",
|
|
4094
|
+
"opennamespace",
|
|
4095
|
+
"closenamespace"
|
|
4096
|
+
];
|
|
4097
|
+
function n(t, r) {
|
|
4098
|
+
if (!(this instanceof n)) return new n(t, r);
|
|
4099
|
+
var a = this;
|
|
4100
|
+
i(a), a.q = a.c = "", a.bufferCheckPosition = e.MAX_BUFFER_LENGTH, a.encoding = null, a.opt = r || {}, a.opt.lowercase = a.opt.lowercase || a.opt.lowercasetags, a.looseCase = a.opt.lowercase ? "toLowerCase" : "toUpperCase", a.opt.maxEntityCount = a.opt.maxEntityCount || 512, a.opt.maxEntityDepth = a.opt.maxEntityDepth || 4, a.entityCount = a.entityDepth = 0, a.tags = [], a.closed = a.closedRoot = a.sawRoot = !1, a.tag = a.error = null, a.strict = !!t, a.noscript = !!(t || a.opt.noscript), a.state = w.BEGIN, a.strictEntities = a.opt.strictEntities, a.ENTITIES = a.strictEntities ? Object.create(e.XML_ENTITIES) : Object.create(e.ENTITIES), a.attribList = [], a.opt.xmlns && (a.ns = Object.create(h)), a.opt.unquotedAttributeValues === void 0 && (a.opt.unquotedAttributeValues = !t), a.trackPosition = a.opt.position !== !1, a.trackPosition && (a.position = a.line = a.column = 0), T(a, "onready");
|
|
4101
|
+
}
|
|
4102
|
+
Object.create || (Object.create = function(e) {
|
|
4103
|
+
function t() {}
|
|
4104
|
+
return t.prototype = e, new t();
|
|
4105
|
+
}), Object.keys || (Object.keys = function(e) {
|
|
4106
|
+
var t = [];
|
|
4107
|
+
for (var n in e) e.hasOwnProperty(n) && t.push(n);
|
|
4108
|
+
return t;
|
|
4109
|
+
});
|
|
4110
|
+
function r(n) {
|
|
4111
|
+
for (var r = Math.max(e.MAX_BUFFER_LENGTH, 10), i = 0, a = 0, o = t.length; a < o; a++) {
|
|
4112
|
+
var s = n[t[a]].length;
|
|
4113
|
+
if (s > r) switch (t[a]) {
|
|
4114
|
+
case "textNode":
|
|
4115
|
+
D(n);
|
|
4116
|
+
break;
|
|
4117
|
+
case "cdata":
|
|
4118
|
+
E(n, "oncdata", n.cdata), n.cdata = "";
|
|
4119
|
+
break;
|
|
4120
|
+
case "script":
|
|
4121
|
+
E(n, "onscript", n.script), n.script = "";
|
|
4122
|
+
break;
|
|
4123
|
+
default: k(n, "Max buffer length exceeded: " + t[a]);
|
|
4124
|
+
}
|
|
4125
|
+
i = Math.max(i, s);
|
|
4126
|
+
}
|
|
4127
|
+
n.bufferCheckPosition = e.MAX_BUFFER_LENGTH - i + n.position;
|
|
4128
|
+
}
|
|
4129
|
+
function i(e) {
|
|
4130
|
+
for (var n = 0, r = t.length; n < r; n++) e[t[n]] = "";
|
|
4131
|
+
}
|
|
4132
|
+
function a(e) {
|
|
4133
|
+
D(e), e.cdata !== "" && (E(e, "oncdata", e.cdata), e.cdata = ""), e.script !== "" && (E(e, "onscript", e.script), e.script = "");
|
|
4134
|
+
}
|
|
4135
|
+
n.prototype = {
|
|
4136
|
+
end: function() {
|
|
4137
|
+
se(this);
|
|
4138
|
+
},
|
|
4139
|
+
write: fe,
|
|
4140
|
+
resume: function() {
|
|
4141
|
+
return this.error = null, this;
|
|
4142
|
+
},
|
|
4143
|
+
close: function() {
|
|
4144
|
+
return this.write(null);
|
|
4145
|
+
},
|
|
4146
|
+
flush: function() {
|
|
4147
|
+
a(this);
|
|
4148
|
+
}
|
|
4149
|
+
};
|
|
4150
|
+
var o;
|
|
4151
|
+
try {
|
|
4152
|
+
o = te().Stream;
|
|
4153
|
+
} catch {
|
|
4154
|
+
o = function() {};
|
|
4155
|
+
}
|
|
4156
|
+
o ||= function() {};
|
|
4157
|
+
var s = e.EVENTS.filter(function(e) {
|
|
4158
|
+
return e !== "error" && e !== "end";
|
|
4159
|
+
});
|
|
4160
|
+
function c(e, t) {
|
|
4161
|
+
return new u(e, t);
|
|
4162
|
+
}
|
|
4163
|
+
function l(e, t) {
|
|
4164
|
+
if (e.length >= 2) {
|
|
4165
|
+
if (e[0] === 255 && e[1] === 254) return "utf-16le";
|
|
4166
|
+
if (e[0] === 254 && e[1] === 255) return "utf-16be";
|
|
4167
|
+
}
|
|
4168
|
+
return e.length >= 3 && e[0] === 239 && e[1] === 187 && e[2] === 191 ? "utf8" : e.length >= 4 ? e[0] === 60 && e[1] === 0 && e[2] === 63 && e[3] === 0 ? "utf-16le" : e[0] === 0 && e[1] === 60 && e[2] === 0 && e[3] === 63 ? "utf-16be" : "utf8" : t ? "utf8" : null;
|
|
4169
|
+
}
|
|
4170
|
+
function u(e, t) {
|
|
4171
|
+
if (!(this instanceof u)) return new u(e, t);
|
|
4172
|
+
o.apply(this), this._parser = new n(e, t), this.writable = !0, this.readable = !0;
|
|
4173
|
+
var r = this;
|
|
4174
|
+
this._parser.onend = function() {
|
|
4175
|
+
r.emit("end");
|
|
4176
|
+
}, this._parser.onerror = function(e) {
|
|
4177
|
+
r.emit("error", e), r._parser.error = null;
|
|
4178
|
+
}, this._decoder = null, this._decoderBuffer = null, s.forEach(function(e) {
|
|
4179
|
+
Object.defineProperty(r, "on" + e, {
|
|
4180
|
+
get: function() {
|
|
4181
|
+
return r._parser["on" + e];
|
|
4182
|
+
},
|
|
4183
|
+
set: function(t) {
|
|
4184
|
+
if (!t) return r.removeAllListeners(e), r._parser["on" + e] = t, t;
|
|
4185
|
+
r.on(e, t);
|
|
4186
|
+
},
|
|
4187
|
+
enumerable: !0,
|
|
4188
|
+
configurable: !1
|
|
4189
|
+
});
|
|
4190
|
+
});
|
|
4191
|
+
}
|
|
4192
|
+
u.prototype = Object.create(o.prototype, { constructor: { value: u } }), u.prototype._decodeBuffer = function(e, t) {
|
|
4193
|
+
if (this._decoderBuffer &&= (e = Buffer.concat([this._decoderBuffer, e]), null), !this._decoder) {
|
|
4194
|
+
var n = l(e, t);
|
|
4195
|
+
if (!n) return this._decoderBuffer = e, "";
|
|
4196
|
+
this._parser.encoding = n, this._decoder = new TextDecoder(n);
|
|
4197
|
+
}
|
|
4198
|
+
return this._decoder.decode(e, { stream: !t });
|
|
4199
|
+
}, u.prototype.write = function(e) {
|
|
4200
|
+
if (typeof Buffer == "function" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(e)) e = this._decodeBuffer(e, !1);
|
|
4201
|
+
else if (this._decoderBuffer) {
|
|
4202
|
+
var t = this._decodeBuffer(Buffer.alloc(0), !0);
|
|
4203
|
+
t && (this._parser.write(t), this.emit("data", t));
|
|
4204
|
+
}
|
|
4205
|
+
return this._parser.write(e.toString()), this.emit("data", e), !0;
|
|
4206
|
+
}, u.prototype.end = function(e) {
|
|
4207
|
+
if (e && e.length && this.write(e), this._decoderBuffer) {
|
|
4208
|
+
var t = this._decodeBuffer(Buffer.alloc(0), !0);
|
|
4209
|
+
t && (this._parser.write(t), this.emit("data", t));
|
|
4210
|
+
} else if (this._decoder) {
|
|
4211
|
+
var n = this._decoder.decode();
|
|
4212
|
+
n && (this._parser.write(n), this.emit("data", n));
|
|
4213
|
+
}
|
|
4214
|
+
return this._parser.end(), !0;
|
|
4215
|
+
}, u.prototype.on = function(e, t) {
|
|
4216
|
+
var n = this;
|
|
4217
|
+
return !n._parser["on" + e] && s.indexOf(e) !== -1 && (n._parser["on" + e] = function() {
|
|
4218
|
+
var t = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
|
4219
|
+
t.splice(0, 0, e), n.emit.apply(n, t);
|
|
4220
|
+
}), o.prototype.on.call(n, e, t);
|
|
4221
|
+
};
|
|
4222
|
+
var d = "[CDATA[", f = "DOCTYPE", p = "http://www.w3.org/XML/1998/namespace", m = "http://www.w3.org/2000/xmlns/", h = {
|
|
4223
|
+
xml: p,
|
|
4224
|
+
xmlns: m
|
|
4225
|
+
}, g = /[:_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]/, _ = /[:_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-]/, v = /[#:_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]/, y = /[#:_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-]/;
|
|
4226
|
+
function b(e) {
|
|
4227
|
+
return e === " " || e === "\n" || e === "\r" || e === " ";
|
|
4228
|
+
}
|
|
4229
|
+
function x(e) {
|
|
4230
|
+
return e === "\"" || e === "'";
|
|
4231
|
+
}
|
|
4232
|
+
function S(e) {
|
|
4233
|
+
return e === ">" || b(e);
|
|
4234
|
+
}
|
|
4235
|
+
function C(e, t) {
|
|
4236
|
+
return e.test(t);
|
|
4237
|
+
}
|
|
4238
|
+
function ee(e, t) {
|
|
4239
|
+
return !C(e, t);
|
|
4240
|
+
}
|
|
4241
|
+
var w = 0;
|
|
4242
|
+
for (var ne in e.STATE = {
|
|
4243
|
+
BEGIN: w++,
|
|
4244
|
+
BEGIN_WHITESPACE: w++,
|
|
4245
|
+
TEXT: w++,
|
|
4246
|
+
TEXT_ENTITY: w++,
|
|
4247
|
+
OPEN_WAKA: w++,
|
|
4248
|
+
SGML_DECL: w++,
|
|
4249
|
+
SGML_DECL_QUOTED: w++,
|
|
4250
|
+
DOCTYPE: w++,
|
|
4251
|
+
DOCTYPE_QUOTED: w++,
|
|
4252
|
+
DOCTYPE_DTD: w++,
|
|
4253
|
+
DOCTYPE_DTD_QUOTED: w++,
|
|
4254
|
+
COMMENT_STARTING: w++,
|
|
4255
|
+
COMMENT: w++,
|
|
4256
|
+
COMMENT_ENDING: w++,
|
|
4257
|
+
COMMENT_ENDED: w++,
|
|
4258
|
+
CDATA: w++,
|
|
4259
|
+
CDATA_ENDING: w++,
|
|
4260
|
+
CDATA_ENDING_2: w++,
|
|
4261
|
+
PROC_INST: w++,
|
|
4262
|
+
PROC_INST_BODY: w++,
|
|
4263
|
+
PROC_INST_ENDING: w++,
|
|
4264
|
+
OPEN_TAG: w++,
|
|
4265
|
+
OPEN_TAG_SLASH: w++,
|
|
4266
|
+
ATTRIB: w++,
|
|
4267
|
+
ATTRIB_NAME: w++,
|
|
4268
|
+
ATTRIB_NAME_SAW_WHITE: w++,
|
|
4269
|
+
ATTRIB_VALUE: w++,
|
|
4270
|
+
ATTRIB_VALUE_QUOTED: w++,
|
|
4271
|
+
ATTRIB_VALUE_CLOSED: w++,
|
|
4272
|
+
ATTRIB_VALUE_UNQUOTED: w++,
|
|
4273
|
+
ATTRIB_VALUE_ENTITY_Q: w++,
|
|
4274
|
+
ATTRIB_VALUE_ENTITY_U: w++,
|
|
4275
|
+
CLOSE_TAG: w++,
|
|
4276
|
+
CLOSE_TAG_SAW_WHITE: w++,
|
|
4277
|
+
SCRIPT: w++,
|
|
4278
|
+
SCRIPT_ENDING: w++
|
|
4279
|
+
}, e.XML_ENTITIES = {
|
|
4280
|
+
amp: "&",
|
|
4281
|
+
gt: ">",
|
|
4282
|
+
lt: "<",
|
|
4283
|
+
quot: "\"",
|
|
4284
|
+
apos: "'"
|
|
4285
|
+
}, e.ENTITIES = {
|
|
4286
|
+
amp: "&",
|
|
4287
|
+
gt: ">",
|
|
4288
|
+
lt: "<",
|
|
4289
|
+
quot: "\"",
|
|
4290
|
+
apos: "'",
|
|
4291
|
+
AElig: 198,
|
|
4292
|
+
Aacute: 193,
|
|
4293
|
+
Acirc: 194,
|
|
4294
|
+
Agrave: 192,
|
|
4295
|
+
Aring: 197,
|
|
4296
|
+
Atilde: 195,
|
|
4297
|
+
Auml: 196,
|
|
4298
|
+
Ccedil: 199,
|
|
4299
|
+
ETH: 208,
|
|
4300
|
+
Eacute: 201,
|
|
4301
|
+
Ecirc: 202,
|
|
4302
|
+
Egrave: 200,
|
|
4303
|
+
Euml: 203,
|
|
4304
|
+
Iacute: 205,
|
|
4305
|
+
Icirc: 206,
|
|
4306
|
+
Igrave: 204,
|
|
4307
|
+
Iuml: 207,
|
|
4308
|
+
Ntilde: 209,
|
|
4309
|
+
Oacute: 211,
|
|
4310
|
+
Ocirc: 212,
|
|
4311
|
+
Ograve: 210,
|
|
4312
|
+
Oslash: 216,
|
|
4313
|
+
Otilde: 213,
|
|
4314
|
+
Ouml: 214,
|
|
4315
|
+
THORN: 222,
|
|
4316
|
+
Uacute: 218,
|
|
4317
|
+
Ucirc: 219,
|
|
4318
|
+
Ugrave: 217,
|
|
4319
|
+
Uuml: 220,
|
|
4320
|
+
Yacute: 221,
|
|
4321
|
+
aacute: 225,
|
|
4322
|
+
acirc: 226,
|
|
4323
|
+
aelig: 230,
|
|
4324
|
+
agrave: 224,
|
|
4325
|
+
aring: 229,
|
|
4326
|
+
atilde: 227,
|
|
4327
|
+
auml: 228,
|
|
4328
|
+
ccedil: 231,
|
|
4329
|
+
eacute: 233,
|
|
4330
|
+
ecirc: 234,
|
|
4331
|
+
egrave: 232,
|
|
4332
|
+
eth: 240,
|
|
4333
|
+
euml: 235,
|
|
4334
|
+
iacute: 237,
|
|
4335
|
+
icirc: 238,
|
|
4336
|
+
igrave: 236,
|
|
4337
|
+
iuml: 239,
|
|
4338
|
+
ntilde: 241,
|
|
4339
|
+
oacute: 243,
|
|
4340
|
+
ocirc: 244,
|
|
4341
|
+
ograve: 242,
|
|
4342
|
+
oslash: 248,
|
|
4343
|
+
otilde: 245,
|
|
4344
|
+
ouml: 246,
|
|
4345
|
+
szlig: 223,
|
|
4346
|
+
thorn: 254,
|
|
4347
|
+
uacute: 250,
|
|
4348
|
+
ucirc: 251,
|
|
4349
|
+
ugrave: 249,
|
|
4350
|
+
uuml: 252,
|
|
4351
|
+
yacute: 253,
|
|
4352
|
+
yuml: 255,
|
|
4353
|
+
copy: 169,
|
|
4354
|
+
reg: 174,
|
|
4355
|
+
nbsp: 160,
|
|
4356
|
+
iexcl: 161,
|
|
4357
|
+
cent: 162,
|
|
4358
|
+
pound: 163,
|
|
4359
|
+
curren: 164,
|
|
4360
|
+
yen: 165,
|
|
4361
|
+
brvbar: 166,
|
|
4362
|
+
sect: 167,
|
|
4363
|
+
uml: 168,
|
|
4364
|
+
ordf: 170,
|
|
4365
|
+
laquo: 171,
|
|
4366
|
+
not: 172,
|
|
4367
|
+
shy: 173,
|
|
4368
|
+
macr: 175,
|
|
4369
|
+
deg: 176,
|
|
4370
|
+
plusmn: 177,
|
|
4371
|
+
sup1: 185,
|
|
4372
|
+
sup2: 178,
|
|
4373
|
+
sup3: 179,
|
|
4374
|
+
acute: 180,
|
|
4375
|
+
micro: 181,
|
|
4376
|
+
para: 182,
|
|
4377
|
+
middot: 183,
|
|
4378
|
+
cedil: 184,
|
|
4379
|
+
ordm: 186,
|
|
4380
|
+
raquo: 187,
|
|
4381
|
+
frac14: 188,
|
|
4382
|
+
frac12: 189,
|
|
4383
|
+
frac34: 190,
|
|
4384
|
+
iquest: 191,
|
|
4385
|
+
times: 215,
|
|
4386
|
+
divide: 247,
|
|
4387
|
+
OElig: 338,
|
|
4388
|
+
oelig: 339,
|
|
4389
|
+
Scaron: 352,
|
|
4390
|
+
scaron: 353,
|
|
4391
|
+
Yuml: 376,
|
|
4392
|
+
fnof: 402,
|
|
4393
|
+
circ: 710,
|
|
4394
|
+
tilde: 732,
|
|
4395
|
+
Alpha: 913,
|
|
4396
|
+
Beta: 914,
|
|
4397
|
+
Gamma: 915,
|
|
4398
|
+
Delta: 916,
|
|
4399
|
+
Epsilon: 917,
|
|
4400
|
+
Zeta: 918,
|
|
4401
|
+
Eta: 919,
|
|
4402
|
+
Theta: 920,
|
|
4403
|
+
Iota: 921,
|
|
4404
|
+
Kappa: 922,
|
|
4405
|
+
Lambda: 923,
|
|
4406
|
+
Mu: 924,
|
|
4407
|
+
Nu: 925,
|
|
4408
|
+
Xi: 926,
|
|
4409
|
+
Omicron: 927,
|
|
4410
|
+
Pi: 928,
|
|
4411
|
+
Rho: 929,
|
|
4412
|
+
Sigma: 931,
|
|
4413
|
+
Tau: 932,
|
|
4414
|
+
Upsilon: 933,
|
|
4415
|
+
Phi: 934,
|
|
4416
|
+
Chi: 935,
|
|
4417
|
+
Psi: 936,
|
|
4418
|
+
Omega: 937,
|
|
4419
|
+
alpha: 945,
|
|
4420
|
+
beta: 946,
|
|
4421
|
+
gamma: 947,
|
|
4422
|
+
delta: 948,
|
|
4423
|
+
epsilon: 949,
|
|
4424
|
+
zeta: 950,
|
|
4425
|
+
eta: 951,
|
|
4426
|
+
theta: 952,
|
|
4427
|
+
iota: 953,
|
|
4428
|
+
kappa: 954,
|
|
4429
|
+
lambda: 955,
|
|
4430
|
+
mu: 956,
|
|
4431
|
+
nu: 957,
|
|
4432
|
+
xi: 958,
|
|
4433
|
+
omicron: 959,
|
|
4434
|
+
pi: 960,
|
|
4435
|
+
rho: 961,
|
|
4436
|
+
sigmaf: 962,
|
|
4437
|
+
sigma: 963,
|
|
4438
|
+
tau: 964,
|
|
4439
|
+
upsilon: 965,
|
|
4440
|
+
phi: 966,
|
|
4441
|
+
chi: 967,
|
|
4442
|
+
psi: 968,
|
|
4443
|
+
omega: 969,
|
|
4444
|
+
thetasym: 977,
|
|
4445
|
+
upsih: 978,
|
|
4446
|
+
piv: 982,
|
|
4447
|
+
ensp: 8194,
|
|
4448
|
+
emsp: 8195,
|
|
4449
|
+
thinsp: 8201,
|
|
4450
|
+
zwnj: 8204,
|
|
4451
|
+
zwj: 8205,
|
|
4452
|
+
lrm: 8206,
|
|
4453
|
+
rlm: 8207,
|
|
4454
|
+
ndash: 8211,
|
|
4455
|
+
mdash: 8212,
|
|
4456
|
+
lsquo: 8216,
|
|
4457
|
+
rsquo: 8217,
|
|
4458
|
+
sbquo: 8218,
|
|
4459
|
+
ldquo: 8220,
|
|
4460
|
+
rdquo: 8221,
|
|
4461
|
+
bdquo: 8222,
|
|
4462
|
+
dagger: 8224,
|
|
4463
|
+
Dagger: 8225,
|
|
4464
|
+
bull: 8226,
|
|
4465
|
+
hellip: 8230,
|
|
4466
|
+
permil: 8240,
|
|
4467
|
+
prime: 8242,
|
|
4468
|
+
Prime: 8243,
|
|
4469
|
+
lsaquo: 8249,
|
|
4470
|
+
rsaquo: 8250,
|
|
4471
|
+
oline: 8254,
|
|
4472
|
+
frasl: 8260,
|
|
4473
|
+
euro: 8364,
|
|
4474
|
+
image: 8465,
|
|
4475
|
+
weierp: 8472,
|
|
4476
|
+
real: 8476,
|
|
4477
|
+
trade: 8482,
|
|
4478
|
+
alefsym: 8501,
|
|
4479
|
+
larr: 8592,
|
|
4480
|
+
uarr: 8593,
|
|
4481
|
+
rarr: 8594,
|
|
4482
|
+
darr: 8595,
|
|
4483
|
+
harr: 8596,
|
|
4484
|
+
crarr: 8629,
|
|
4485
|
+
lArr: 8656,
|
|
4486
|
+
uArr: 8657,
|
|
4487
|
+
rArr: 8658,
|
|
4488
|
+
dArr: 8659,
|
|
4489
|
+
hArr: 8660,
|
|
4490
|
+
forall: 8704,
|
|
4491
|
+
part: 8706,
|
|
4492
|
+
exist: 8707,
|
|
4493
|
+
empty: 8709,
|
|
4494
|
+
nabla: 8711,
|
|
4495
|
+
isin: 8712,
|
|
4496
|
+
notin: 8713,
|
|
4497
|
+
ni: 8715,
|
|
4498
|
+
prod: 8719,
|
|
4499
|
+
sum: 8721,
|
|
4500
|
+
minus: 8722,
|
|
4501
|
+
lowast: 8727,
|
|
4502
|
+
radic: 8730,
|
|
4503
|
+
prop: 8733,
|
|
4504
|
+
infin: 8734,
|
|
4505
|
+
ang: 8736,
|
|
4506
|
+
and: 8743,
|
|
4507
|
+
or: 8744,
|
|
4508
|
+
cap: 8745,
|
|
4509
|
+
cup: 8746,
|
|
4510
|
+
int: 8747,
|
|
4511
|
+
there4: 8756,
|
|
4512
|
+
sim: 8764,
|
|
4513
|
+
cong: 8773,
|
|
4514
|
+
asymp: 8776,
|
|
4515
|
+
ne: 8800,
|
|
4516
|
+
equiv: 8801,
|
|
4517
|
+
le: 8804,
|
|
4518
|
+
ge: 8805,
|
|
4519
|
+
sub: 8834,
|
|
4520
|
+
sup: 8835,
|
|
4521
|
+
nsub: 8836,
|
|
4522
|
+
sube: 8838,
|
|
4523
|
+
supe: 8839,
|
|
4524
|
+
oplus: 8853,
|
|
4525
|
+
otimes: 8855,
|
|
4526
|
+
perp: 8869,
|
|
4527
|
+
sdot: 8901,
|
|
4528
|
+
lceil: 8968,
|
|
4529
|
+
rceil: 8969,
|
|
4530
|
+
lfloor: 8970,
|
|
4531
|
+
rfloor: 8971,
|
|
4532
|
+
lang: 9001,
|
|
4533
|
+
rang: 9002,
|
|
4534
|
+
loz: 9674,
|
|
4535
|
+
spades: 9824,
|
|
4536
|
+
clubs: 9827,
|
|
4537
|
+
hearts: 9829,
|
|
4538
|
+
diams: 9830
|
|
4539
|
+
}, Object.keys(e.ENTITIES).forEach(function(t) {
|
|
4540
|
+
var n = e.ENTITIES[t], r = typeof n == "number" ? String.fromCharCode(n) : n;
|
|
4541
|
+
e.ENTITIES[t] = r;
|
|
4542
|
+
}), e.STATE) e.STATE[e.STATE[ne]] = ne;
|
|
4543
|
+
w = e.STATE;
|
|
4544
|
+
function T(e, t, n) {
|
|
4545
|
+
e[t] && e[t](n);
|
|
4546
|
+
}
|
|
4547
|
+
function re(e) {
|
|
4548
|
+
var t = e && e.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);
|
|
4549
|
+
return t ? t[2] : null;
|
|
4550
|
+
}
|
|
4551
|
+
function ie(e) {
|
|
4552
|
+
return e ? e.toLowerCase().replace(/[^a-z0-9]/g, "") : null;
|
|
4553
|
+
}
|
|
4554
|
+
function ae(e, t) {
|
|
4555
|
+
let n = ie(e), r = ie(t);
|
|
4556
|
+
return !n || !r ? !0 : r === "utf16" ? n === "utf16le" || n === "utf16be" : n === r;
|
|
4557
|
+
}
|
|
4558
|
+
function oe(e, t) {
|
|
4559
|
+
if (!(!e.strict || !e.encoding || !t || t.name !== "xml")) {
|
|
4560
|
+
var n = re(t.body);
|
|
4561
|
+
n && !ae(e.encoding, n) && A(e, "XML declaration encoding " + n + " does not match detected stream encoding " + e.encoding.toUpperCase());
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
function E(e, t, n) {
|
|
4565
|
+
e.textNode && D(e), T(e, t, n);
|
|
4566
|
+
}
|
|
4567
|
+
function D(e) {
|
|
4568
|
+
e.textNode = O(e.opt, e.textNode), e.textNode && T(e, "ontext", e.textNode), e.textNode = "";
|
|
4569
|
+
}
|
|
4570
|
+
function O(e, t) {
|
|
4571
|
+
return e.trim && (t = t.trim()), e.normalize && (t = t.replace(/\s+/g, " ")), t;
|
|
4572
|
+
}
|
|
4573
|
+
function k(e, t) {
|
|
4574
|
+
return D(e), e.trackPosition && (t += "\nLine: " + e.line + "\nColumn: " + e.column + "\nChar: " + e.c), t = Error(t), e.error = t, T(e, "onerror", t), e;
|
|
4575
|
+
}
|
|
4576
|
+
function se(e) {
|
|
4577
|
+
return e.sawRoot && !e.closedRoot && A(e, "Unclosed root tag"), e.state !== w.BEGIN && e.state !== w.BEGIN_WHITESPACE && e.state !== w.TEXT && k(e, "Unexpected end"), D(e), e.c = "", e.closed = !0, T(e, "onend"), n.call(e, e.strict, e.opt), e;
|
|
4578
|
+
}
|
|
4579
|
+
function A(e, t) {
|
|
4580
|
+
if (typeof e != "object" || !(e instanceof n)) throw Error("bad call to strictFail");
|
|
4581
|
+
e.strict && k(e, t);
|
|
4582
|
+
}
|
|
4583
|
+
function ce(e) {
|
|
4584
|
+
e.strict || (e.tagName = e.tagName[e.looseCase]());
|
|
4585
|
+
var t = e.tags[e.tags.length - 1] || e, n = e.tag = {
|
|
4586
|
+
name: e.tagName,
|
|
4587
|
+
attributes: {}
|
|
4588
|
+
};
|
|
4589
|
+
e.opt.xmlns && (n.ns = t.ns), e.attribList.length = 0, E(e, "onopentagstart", n);
|
|
4590
|
+
}
|
|
4591
|
+
function j(e, t) {
|
|
4592
|
+
var n = e.indexOf(":") < 0 ? ["", e] : e.split(":"), r = n[0], i = n[1];
|
|
4593
|
+
return t && e === "xmlns" && (r = "xmlns", i = ""), {
|
|
4594
|
+
prefix: r,
|
|
4595
|
+
local: i
|
|
4596
|
+
};
|
|
4597
|
+
}
|
|
4598
|
+
function le(e) {
|
|
4599
|
+
if (e.strict || (e.attribName = e.attribName[e.looseCase]()), e.attribList.indexOf(e.attribName) !== -1 || e.tag.attributes.hasOwnProperty(e.attribName)) {
|
|
4600
|
+
e.attribName = e.attribValue = "";
|
|
4601
|
+
return;
|
|
4602
|
+
}
|
|
4603
|
+
if (e.opt.xmlns) {
|
|
4604
|
+
var t = j(e.attribName, !0), n = t.prefix, r = t.local;
|
|
4605
|
+
if (n === "xmlns") if (r === "xml" && e.attribValue !== p) A(e, "xml: prefix must be bound to " + p + "\nActual: " + e.attribValue);
|
|
4606
|
+
else if (r === "xmlns" && e.attribValue !== m) A(e, "xmlns: prefix must be bound to " + m + "\nActual: " + e.attribValue);
|
|
4607
|
+
else {
|
|
4608
|
+
var i = e.tag, a = e.tags[e.tags.length - 1] || e;
|
|
4609
|
+
i.ns === a.ns && (i.ns = Object.create(a.ns)), i.ns[r] = e.attribValue;
|
|
4610
|
+
}
|
|
4611
|
+
e.attribList.push([e.attribName, e.attribValue]);
|
|
4612
|
+
} else e.tag.attributes[e.attribName] = e.attribValue, E(e, "onattribute", {
|
|
4613
|
+
name: e.attribName,
|
|
4614
|
+
value: e.attribValue
|
|
4615
|
+
});
|
|
4616
|
+
e.attribName = e.attribValue = "";
|
|
4617
|
+
}
|
|
4618
|
+
function M(e, t) {
|
|
4619
|
+
if (e.opt.xmlns) {
|
|
4620
|
+
var n = e.tag, r = j(e.tagName);
|
|
4621
|
+
n.prefix = r.prefix, n.local = r.local, n.uri = n.ns[r.prefix] || "", n.prefix && !n.uri && (A(e, "Unbound namespace prefix: " + JSON.stringify(e.tagName)), n.uri = r.prefix);
|
|
4622
|
+
var i = e.tags[e.tags.length - 1] || e;
|
|
4623
|
+
n.ns && i.ns !== n.ns && Object.keys(n.ns).forEach(function(t) {
|
|
4624
|
+
E(e, "onopennamespace", {
|
|
4625
|
+
prefix: t,
|
|
4626
|
+
uri: n.ns[t]
|
|
4627
|
+
});
|
|
4628
|
+
});
|
|
4629
|
+
for (var a = 0, o = e.attribList.length; a < o; a++) {
|
|
4630
|
+
var s = e.attribList[a], c = s[0], l = s[1], u = j(c, !0), d = u.prefix, f = u.local, p = d === "" ? "" : n.ns[d] || "", m = {
|
|
4631
|
+
name: c,
|
|
4632
|
+
value: l,
|
|
4633
|
+
prefix: d,
|
|
4634
|
+
local: f,
|
|
4635
|
+
uri: p
|
|
4636
|
+
};
|
|
4637
|
+
d && d !== "xmlns" && !p && (A(e, "Unbound namespace prefix: " + JSON.stringify(d)), m.uri = d), e.tag.attributes[c] = m, E(e, "onattribute", m);
|
|
4638
|
+
}
|
|
4639
|
+
e.attribList.length = 0;
|
|
4640
|
+
}
|
|
4641
|
+
e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag), E(e, "onopentag", e.tag), t || (!e.noscript && e.tagName.toLowerCase() === "script" ? e.state = w.SCRIPT : e.state = w.TEXT, e.tag = null, e.tagName = ""), e.attribName = e.attribValue = "", e.attribList.length = 0;
|
|
4642
|
+
}
|
|
4643
|
+
function N(e) {
|
|
4644
|
+
if (!e.tagName) {
|
|
4645
|
+
A(e, "Weird empty close tag."), e.textNode += "</>", e.state = w.TEXT;
|
|
4646
|
+
return;
|
|
4647
|
+
}
|
|
4648
|
+
if (e.script) {
|
|
4649
|
+
if (e.tagName !== "script") {
|
|
4650
|
+
e.script += "</" + e.tagName + ">", e.tagName = "", e.state = w.SCRIPT;
|
|
4651
|
+
return;
|
|
4652
|
+
}
|
|
4653
|
+
E(e, "onscript", e.script), e.script = "";
|
|
4654
|
+
}
|
|
4655
|
+
var t = e.tags.length, n = e.tagName;
|
|
4656
|
+
e.strict || (n = n[e.looseCase]());
|
|
4657
|
+
for (var r = n; t-- && e.tags[t].name !== r;) A(e, "Unexpected close tag");
|
|
4658
|
+
if (t < 0) {
|
|
4659
|
+
A(e, "Unmatched closing tag: " + e.tagName), e.textNode += "</" + e.tagName + ">", e.state = w.TEXT;
|
|
4660
|
+
return;
|
|
4661
|
+
}
|
|
4662
|
+
e.tagName = n;
|
|
4663
|
+
for (var i = e.tags.length; i-- > t;) {
|
|
4664
|
+
var a = e.tag = e.tags.pop();
|
|
4665
|
+
e.tagName = e.tag.name, E(e, "onclosetag", e.tagName);
|
|
4666
|
+
var o = {};
|
|
4667
|
+
for (var s in a.ns) o[s] = a.ns[s];
|
|
4668
|
+
var c = e.tags[e.tags.length - 1] || e;
|
|
4669
|
+
e.opt.xmlns && a.ns !== c.ns && Object.keys(a.ns).forEach(function(t) {
|
|
4670
|
+
var n = a.ns[t];
|
|
4671
|
+
E(e, "onclosenamespace", {
|
|
4672
|
+
prefix: t,
|
|
4673
|
+
uri: n
|
|
4674
|
+
});
|
|
4675
|
+
});
|
|
4676
|
+
}
|
|
4677
|
+
t === 0 && (e.closedRoot = !0), e.tagName = e.attribValue = e.attribName = "", e.attribList.length = 0, e.state = w.TEXT;
|
|
4678
|
+
}
|
|
4679
|
+
function ue(e) {
|
|
4680
|
+
var t = e.entity, n = t.toLowerCase(), r, i = "";
|
|
4681
|
+
return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === "#" && (t.charAt(1) === "x" ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ""), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 ? (A(e, "Invalid character entity"), "&" + e.entity + ";") : String.fromCodePoint(r));
|
|
4682
|
+
}
|
|
4683
|
+
function de(e, t) {
|
|
4684
|
+
t === "<" ? (e.state = w.OPEN_WAKA, e.startTagPosition = e.position) : b(t) || (A(e, "Non-whitespace before first tag."), e.textNode = t, e.state = w.TEXT);
|
|
4685
|
+
}
|
|
4686
|
+
function P(e, t) {
|
|
4687
|
+
var n = "";
|
|
4688
|
+
return t < e.length && (n = e.charAt(t)), n;
|
|
4689
|
+
}
|
|
4690
|
+
function fe(t) {
|
|
4691
|
+
var n = this;
|
|
4692
|
+
if (this.error) throw this.error;
|
|
4693
|
+
if (n.closed) return k(n, "Cannot write after close. Assign an onready handler.");
|
|
4694
|
+
if (t === null) return se(n);
|
|
4695
|
+
typeof t == "object" && (t = t.toString());
|
|
4696
|
+
for (var i = 0, a = ""; a = P(t, i++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++), n.state) {
|
|
4697
|
+
case w.BEGIN:
|
|
4698
|
+
if (n.state = w.BEGIN_WHITESPACE, a === "") continue;
|
|
4699
|
+
de(n, a);
|
|
4700
|
+
continue;
|
|
4701
|
+
case w.BEGIN_WHITESPACE:
|
|
4702
|
+
de(n, a);
|
|
4703
|
+
continue;
|
|
4704
|
+
case w.TEXT:
|
|
4705
|
+
if (n.sawRoot && !n.closedRoot) {
|
|
4706
|
+
for (var o = i - 1; a && a !== "<" && a !== "&";) a = P(t, i++), a && n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++);
|
|
4707
|
+
n.textNode += t.substring(o, i - 1);
|
|
4708
|
+
}
|
|
4709
|
+
a === "<" && !(n.sawRoot && n.closedRoot && !n.strict) ? (n.state = w.OPEN_WAKA, n.startTagPosition = n.position) : (!b(a) && (!n.sawRoot || n.closedRoot) && A(n, "Text data outside of root node."), a === "&" ? n.state = w.TEXT_ENTITY : n.textNode += a);
|
|
4710
|
+
continue;
|
|
4711
|
+
case w.SCRIPT:
|
|
4712
|
+
a === "<" ? n.state = w.SCRIPT_ENDING : n.script += a;
|
|
4713
|
+
continue;
|
|
4714
|
+
case w.SCRIPT_ENDING:
|
|
4715
|
+
a === "/" ? n.state = w.CLOSE_TAG : (n.script += "<" + a, n.state = w.SCRIPT);
|
|
4716
|
+
continue;
|
|
4717
|
+
case w.OPEN_WAKA:
|
|
4718
|
+
if (a === "!") n.state = w.SGML_DECL, n.sgmlDecl = "";
|
|
4719
|
+
else if (!b(a)) if (C(g, a)) n.state = w.OPEN_TAG, n.tagName = a;
|
|
4720
|
+
else if (a === "/") n.state = w.CLOSE_TAG, n.tagName = "";
|
|
4721
|
+
else if (a === "?") n.state = w.PROC_INST, n.procInstName = n.procInstBody = "";
|
|
4722
|
+
else {
|
|
4723
|
+
if (A(n, "Unencoded <"), n.startTagPosition + 1 < n.position) {
|
|
4724
|
+
var s = n.position - n.startTagPosition;
|
|
4725
|
+
a = Array(s).join(" ") + a;
|
|
4726
|
+
}
|
|
4727
|
+
n.textNode += "<" + a, n.state = w.TEXT;
|
|
4728
|
+
}
|
|
4729
|
+
continue;
|
|
4730
|
+
case w.SGML_DECL:
|
|
4731
|
+
if (n.sgmlDecl + a === "--") {
|
|
4732
|
+
n.state = w.COMMENT, n.comment = "", n.sgmlDecl = "";
|
|
4733
|
+
continue;
|
|
4734
|
+
}
|
|
4735
|
+
n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = w.DOCTYPE_DTD, n.doctype += "<!" + n.sgmlDecl + a, n.sgmlDecl = "") : (n.sgmlDecl + a).toUpperCase() === d ? (E(n, "onopencdata"), n.state = w.CDATA, n.sgmlDecl = "", n.cdata = "") : (n.sgmlDecl + a).toUpperCase() === f ? (n.state = w.DOCTYPE, (n.doctype || n.sawRoot) && A(n, "Inappropriately located doctype declaration"), n.doctype = "", n.sgmlDecl = "") : a === ">" ? (E(n, "onsgmldeclaration", n.sgmlDecl), n.sgmlDecl = "", n.state = w.TEXT) : (x(a) && (n.state = w.SGML_DECL_QUOTED), n.sgmlDecl += a);
|
|
4736
|
+
continue;
|
|
4737
|
+
case w.SGML_DECL_QUOTED:
|
|
4738
|
+
a === n.q && (n.state = w.SGML_DECL, n.q = ""), n.sgmlDecl += a;
|
|
4739
|
+
continue;
|
|
4740
|
+
case w.DOCTYPE:
|
|
4741
|
+
a === ">" ? (n.state = w.TEXT, E(n, "ondoctype", n.doctype), n.doctype = !0) : (n.doctype += a, a === "[" ? n.state = w.DOCTYPE_DTD : x(a) && (n.state = w.DOCTYPE_QUOTED, n.q = a));
|
|
4742
|
+
continue;
|
|
4743
|
+
case w.DOCTYPE_QUOTED:
|
|
4744
|
+
n.doctype += a, a === n.q && (n.q = "", n.state = w.DOCTYPE);
|
|
4745
|
+
continue;
|
|
4746
|
+
case w.DOCTYPE_DTD:
|
|
4747
|
+
a === "]" ? (n.doctype += a, n.state = w.DOCTYPE) : a === "<" ? (n.state = w.OPEN_WAKA, n.startTagPosition = n.position) : x(a) ? (n.doctype += a, n.state = w.DOCTYPE_DTD_QUOTED, n.q = a) : n.doctype += a;
|
|
4748
|
+
continue;
|
|
4749
|
+
case w.DOCTYPE_DTD_QUOTED:
|
|
4750
|
+
n.doctype += a, a === n.q && (n.state = w.DOCTYPE_DTD, n.q = "");
|
|
4751
|
+
continue;
|
|
4752
|
+
case w.COMMENT:
|
|
4753
|
+
a === "-" ? n.state = w.COMMENT_ENDING : n.comment += a;
|
|
4754
|
+
continue;
|
|
4755
|
+
case w.COMMENT_ENDING:
|
|
4756
|
+
a === "-" ? (n.state = w.COMMENT_ENDED, n.comment = O(n.opt, n.comment), n.comment && E(n, "oncomment", n.comment), n.comment = "") : (n.comment += "-" + a, n.state = w.COMMENT);
|
|
4757
|
+
continue;
|
|
4758
|
+
case w.COMMENT_ENDED:
|
|
4759
|
+
a === ">" ? n.doctype && n.doctype !== !0 ? n.state = w.DOCTYPE_DTD : n.state = w.TEXT : (A(n, "Malformed comment"), n.comment += "--" + a, n.state = w.COMMENT);
|
|
4760
|
+
continue;
|
|
4761
|
+
case w.CDATA:
|
|
4762
|
+
for (var o = i - 1; a && a !== "]";) a = P(t, i++), a && n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++);
|
|
4763
|
+
n.cdata += t.substring(o, i - 1), a === "]" && (n.state = w.CDATA_ENDING);
|
|
4764
|
+
continue;
|
|
4765
|
+
case w.CDATA_ENDING:
|
|
4766
|
+
a === "]" ? n.state = w.CDATA_ENDING_2 : (n.cdata += "]" + a, n.state = w.CDATA);
|
|
4767
|
+
continue;
|
|
4768
|
+
case w.CDATA_ENDING_2:
|
|
4769
|
+
a === ">" ? (n.cdata && E(n, "oncdata", n.cdata), E(n, "onclosecdata"), n.cdata = "", n.state = w.TEXT) : a === "]" ? n.cdata += "]" : (n.cdata += "]]" + a, n.state = w.CDATA);
|
|
4770
|
+
continue;
|
|
4771
|
+
case w.PROC_INST:
|
|
4772
|
+
a === "?" ? n.state = w.PROC_INST_ENDING : b(a) ? n.state = w.PROC_INST_BODY : n.procInstName += a;
|
|
4773
|
+
continue;
|
|
4774
|
+
case w.PROC_INST_BODY:
|
|
4775
|
+
if (!n.procInstBody && b(a)) continue;
|
|
4776
|
+
a === "?" ? n.state = w.PROC_INST_ENDING : n.procInstBody += a;
|
|
4777
|
+
continue;
|
|
4778
|
+
case w.PROC_INST_ENDING:
|
|
4779
|
+
if (a === ">") {
|
|
4780
|
+
let e = {
|
|
4781
|
+
name: n.procInstName,
|
|
4782
|
+
body: n.procInstBody
|
|
4783
|
+
};
|
|
4784
|
+
oe(n, e), E(n, "onprocessinginstruction", e), n.procInstName = n.procInstBody = "", n.state = w.TEXT;
|
|
4785
|
+
} else n.procInstBody += "?" + a, n.state = w.PROC_INST_BODY;
|
|
4786
|
+
continue;
|
|
4787
|
+
case w.OPEN_TAG:
|
|
4788
|
+
C(_, a) ? n.tagName += a : (ce(n), a === ">" ? M(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : (b(a) || A(n, "Invalid character in tag name"), n.state = w.ATTRIB));
|
|
4789
|
+
continue;
|
|
4790
|
+
case w.OPEN_TAG_SLASH:
|
|
4791
|
+
a === ">" ? (M(n, !0), N(n)) : (A(n, "Forward-slash in opening tag not followed by >"), n.state = w.ATTRIB);
|
|
4792
|
+
continue;
|
|
4793
|
+
case w.ATTRIB:
|
|
4794
|
+
if (b(a)) continue;
|
|
4795
|
+
a === ">" ? M(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : C(g, a) ? (n.attribName = a, n.attribValue = "", n.state = w.ATTRIB_NAME) : A(n, "Invalid attribute name");
|
|
4796
|
+
continue;
|
|
4797
|
+
case w.ATTRIB_NAME:
|
|
4798
|
+
a === "=" ? n.state = w.ATTRIB_VALUE : a === ">" ? (A(n, "Attribute without value"), n.attribValue = n.attribName, le(n), M(n)) : b(a) ? n.state = w.ATTRIB_NAME_SAW_WHITE : C(_, a) ? n.attribName += a : A(n, "Invalid attribute name");
|
|
4799
|
+
continue;
|
|
4800
|
+
case w.ATTRIB_NAME_SAW_WHITE:
|
|
4801
|
+
if (a === "=") n.state = w.ATTRIB_VALUE;
|
|
4802
|
+
else if (b(a)) continue;
|
|
4803
|
+
else A(n, "Attribute without value"), n.tag.attributes[n.attribName] = "", n.attribValue = "", E(n, "onattribute", {
|
|
4804
|
+
name: n.attribName,
|
|
4805
|
+
value: ""
|
|
4806
|
+
}), n.attribName = "", a === ">" ? M(n) : C(g, a) ? (n.attribName = a, n.state = w.ATTRIB_NAME) : (A(n, "Invalid attribute name"), n.state = w.ATTRIB);
|
|
4807
|
+
continue;
|
|
4808
|
+
case w.ATTRIB_VALUE:
|
|
4809
|
+
if (b(a)) continue;
|
|
4810
|
+
x(a) ? (n.q = a, n.state = w.ATTRIB_VALUE_QUOTED) : (n.opt.unquotedAttributeValues || k(n, "Unquoted attribute value"), n.state = w.ATTRIB_VALUE_UNQUOTED, n.attribValue = a);
|
|
4811
|
+
continue;
|
|
4812
|
+
case w.ATTRIB_VALUE_QUOTED:
|
|
4813
|
+
if (a !== n.q) {
|
|
4814
|
+
a === "&" ? n.state = w.ATTRIB_VALUE_ENTITY_Q : n.attribValue += a;
|
|
4815
|
+
continue;
|
|
4816
|
+
}
|
|
4817
|
+
le(n), n.q = "", n.state = w.ATTRIB_VALUE_CLOSED;
|
|
4818
|
+
continue;
|
|
4819
|
+
case w.ATTRIB_VALUE_CLOSED:
|
|
4820
|
+
b(a) ? n.state = w.ATTRIB : a === ">" ? M(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : C(g, a) ? (A(n, "No whitespace between attributes"), n.attribName = a, n.attribValue = "", n.state = w.ATTRIB_NAME) : A(n, "Invalid attribute name");
|
|
4821
|
+
continue;
|
|
4822
|
+
case w.ATTRIB_VALUE_UNQUOTED:
|
|
4823
|
+
if (!S(a)) {
|
|
4824
|
+
a === "&" ? n.state = w.ATTRIB_VALUE_ENTITY_U : n.attribValue += a;
|
|
4825
|
+
continue;
|
|
4826
|
+
}
|
|
4827
|
+
le(n), a === ">" ? M(n) : n.state = w.ATTRIB;
|
|
4828
|
+
continue;
|
|
4829
|
+
case w.CLOSE_TAG:
|
|
4830
|
+
if (n.tagName) a === ">" ? N(n) : C(_, a) ? n.tagName += a : n.script ? (n.script += "</" + n.tagName + a, n.tagName = "", n.state = w.SCRIPT) : (b(a) || A(n, "Invalid tagname in closing tag"), n.state = w.CLOSE_TAG_SAW_WHITE);
|
|
4831
|
+
else {
|
|
4832
|
+
if (b(a)) continue;
|
|
4833
|
+
ee(g, a) ? n.script ? (n.script += "</" + a, n.state = w.SCRIPT) : A(n, "Invalid tagname in closing tag.") : n.tagName = a;
|
|
4834
|
+
}
|
|
4835
|
+
continue;
|
|
4836
|
+
case w.CLOSE_TAG_SAW_WHITE:
|
|
4837
|
+
if (b(a)) continue;
|
|
4838
|
+
a === ">" ? N(n) : A(n, "Invalid characters in closing tag");
|
|
4839
|
+
continue;
|
|
4840
|
+
case w.TEXT_ENTITY:
|
|
4841
|
+
case w.ATTRIB_VALUE_ENTITY_Q:
|
|
4842
|
+
case w.ATTRIB_VALUE_ENTITY_U:
|
|
4843
|
+
var c, l;
|
|
4844
|
+
switch (n.state) {
|
|
4845
|
+
case w.TEXT_ENTITY:
|
|
4846
|
+
c = w.TEXT, l = "textNode";
|
|
4847
|
+
break;
|
|
4848
|
+
case w.ATTRIB_VALUE_ENTITY_Q:
|
|
4849
|
+
c = w.ATTRIB_VALUE_QUOTED, l = "attribValue";
|
|
4850
|
+
break;
|
|
4851
|
+
case w.ATTRIB_VALUE_ENTITY_U:
|
|
4852
|
+
c = w.ATTRIB_VALUE_UNQUOTED, l = "attribValue";
|
|
4853
|
+
break;
|
|
4854
|
+
}
|
|
4855
|
+
if (a === ";") {
|
|
4856
|
+
var u = ue(n);
|
|
4857
|
+
n.opt.unparsedEntities && !Object.values(e.XML_ENTITIES).includes(u) ? ((n.entityCount += 1) > n.opt.maxEntityCount && k(n, "Parsed entity count exceeds max entity count"), (n.entityDepth += 1) > n.opt.maxEntityDepth && k(n, "Parsed entity depth exceeds max entity depth"), n.entity = "", n.state = c, n.write(u), --n.entityDepth) : (n[l] += u, n.entity = "", n.state = c);
|
|
4858
|
+
} else C(n.entity.length ? y : v, a) ? n.entity += a : (A(n, "Invalid character in entity name"), n[l] += "&" + n.entity + a, n.entity = "", n.state = c);
|
|
4859
|
+
continue;
|
|
4860
|
+
default: throw Error(n, "Unknown state: " + n.state);
|
|
4861
|
+
}
|
|
4862
|
+
return n.position >= n.bufferCheckPosition && r(n), n;
|
|
4863
|
+
}
|
|
4864
|
+
/* istanbul ignore next */
|
|
4865
|
+
String.fromCodePoint || (function() {
|
|
4866
|
+
var e = String.fromCharCode, t = Math.floor, n = function() {
|
|
4867
|
+
var n = 16384, r = [], i, a, o = -1, s = arguments.length;
|
|
4868
|
+
if (!s) return "";
|
|
4869
|
+
for (var c = ""; ++o < s;) {
|
|
4870
|
+
var l = Number(arguments[o]);
|
|
4871
|
+
if (!isFinite(l) || l < 0 || l > 1114111 || t(l) !== l) throw RangeError("Invalid code point: " + l);
|
|
4872
|
+
l <= 65535 ? r.push(l) : (l -= 65536, i = (l >> 10) + 55296, a = l % 1024 + 56320, r.push(i, a)), (o + 1 === s || r.length > n) && (c += e.apply(null, r), r.length = 0);
|
|
4873
|
+
}
|
|
4874
|
+
return c;
|
|
4875
|
+
};
|
|
4876
|
+
/* istanbul ignore next */
|
|
4877
|
+
Object.defineProperty ? Object.defineProperty(String, "fromCodePoint", {
|
|
4878
|
+
value: n,
|
|
4879
|
+
configurable: !0,
|
|
4880
|
+
writable: !0
|
|
4881
|
+
}) : String.fromCodePoint = n;
|
|
4882
|
+
})();
|
|
4883
|
+
})(e === void 0 ? e.sax = {} : e);
|
|
4884
|
+
})))();
|
|
4885
|
+
//#endregion
|
|
4886
|
+
export { l as b };
|