@nylas/react 1.4.4 → 2.0.0
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/README.md +7 -0
- package/dist/add-circle-icon_2.entry-8a1c55bc.cjs +1 -0
- package/dist/{add-circle-icon_2.entry-615fc101.js → add-circle-icon_2.entry-b4bbcfee.js} +3 -3
- package/dist/archive-icon.entry-a2492cf3.js +16 -0
- package/dist/archive-icon.entry-e48d2356.cjs +1 -0
- package/dist/{arrow-icon.entry-da152ec2.js → arrow-icon.entry-9414299f.js} +5 -5
- package/dist/arrow-icon.entry-b1ecb2aa.cjs +1 -0
- package/dist/{bold-icon.entry-61046c15.js → bold-icon.entry-b72aed9f.js} +4 -4
- package/dist/{bold-icon.entry-58679992.cjs → bold-icon.entry-c781e9c1.cjs} +1 -1
- package/dist/{button-component_2.entry-db53e00a.js → button-component_2.entry-36e49459.js} +9 -9
- package/dist/{button-component_2.entry-53bfdc19.cjs → button-component_2.entry-73f76545.cjs} +1 -1
- package/dist/calendar-agenda-fill-icon_36.entry-e9b92e0e.cjs +6 -0
- package/dist/{calendar-agenda-fill-icon_36.entry-76796ea7.js → calendar-agenda-fill-icon_36.entry-efa7ad26.js} +100 -100
- package/dist/{calendar-cancel-icon.entry-e5032d71.cjs → calendar-cancel-icon.entry-01c388eb.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-f3b8ae99.js → calendar-cancel-icon.entry-0f739a8a.js} +4 -4
- package/dist/{calendar-check-icon_2.entry-7303362a.cjs → calendar-check-icon_2.entry-5febbadf.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-27dc91f7.js → calendar-check-icon_2.entry-dfb0036d.js} +3 -3
- package/dist/{calendar-icon.entry-4f432baf.cjs → calendar-icon.entry-9743e0b7.cjs} +1 -1
- package/dist/{calendar-icon.entry-48fc45d6.js → calendar-icon.entry-f197396d.js} +2 -2
- package/dist/{checkbox-component.entry-8fad4faf.cjs → checkbox-component.entry-1aa5782f.cjs} +1 -1
- package/dist/{checkbox-component.entry-a15ffc4c.js → checkbox-component.entry-72a6aa72.js} +4 -4
- package/dist/checkmark-icon_15.entry-35dd97b7.cjs +5 -0
- package/dist/{checkmark-icon_15.entry-9f926a70.js → checkmark-icon_15.entry-5c09cff5.js} +225 -223
- package/dist/{chevron-icon_3.entry-5130fbba.js → chevron-icon_3.entry-4a72f211.js} +6 -6
- package/dist/chevron-icon_3.entry-e0608b7c.cjs +1 -0
- package/dist/{clock-icon_4.entry-40a393c9.js → clock-icon_4.entry-0afe79c2.js} +8 -8
- package/dist/{clock-icon_4.entry-ac65deae.cjs → clock-icon_4.entry-202ce025.cjs} +1 -1
- package/dist/constants-f51538ef-cd2a67c4.cjs +1 -0
- package/dist/{constants-3d8016e3-3c080f00.js → constants-f51538ef-e0a5f026.js} +27 -32
- package/dist/{customParseFormat-a4d9ea69-763f219e.cjs → customParseFormat-d1de5ed0-65a0bba3.cjs} +1 -1
- package/dist/{customParseFormat-a4d9ea69-7caebeb2.js → customParseFormat-d1de5ed0-c0ef002d.js} +1 -1
- package/dist/{delete-icon.entry-78e44eba.js → delete-icon.entry-580bfcc9.js} +4 -4
- package/dist/{delete-icon.entry-770dac8c.cjs → delete-icon.entry-762ac892.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-d331f844.cjs → document-refresh-icon.entry-4e0f0c61.cjs} +1 -1
- package/dist/document-refresh-icon.entry-e500b4e3.js +16 -0
- package/dist/elements/index.d.ts +0 -8
- package/dist/{feedbackSync-57bb471a-ee800a95.js → feedbackSync-172f942c-42124493.js} +1 -1
- package/dist/{feedbackSync-57bb471a-5afb7715.cjs → feedbackSync-172f942c-62f72bd2.cjs} +1 -1
- package/dist/{folder-icon.entry-163e0aee.cjs → folder-icon.entry-2694e253.cjs} +1 -1
- package/dist/{folder-icon.entry-42650400.js → folder-icon.entry-54c3cc66.js} +2 -2
- package/dist/{forward-icon.entry-d60b6e31.js → forward-icon.entry-5e540f05.js} +5 -5
- package/dist/{forward-icon.entry-0a499b38.cjs → forward-icon.entry-f07102d8.cjs} +1 -1
- package/dist/{globe-icon_2.entry-19359092.cjs → globe-icon_2.entry-14a4c168.cjs} +1 -1
- package/dist/{globe-icon_2.entry-5afa8049.js → globe-icon_2.entry-aaceb196.js} +90 -80
- package/dist/{google-logo-icon_6.entry-d2febb78.js → google-logo-icon_6.entry-00d40db2.js} +473 -439
- package/dist/google-logo-icon_6.entry-fa76ffe3.cjs +2 -0
- package/dist/{google-meet-icon_5.entry-4a94137f.cjs → google-meet-icon_5.entry-6c20e149.cjs} +1 -1
- package/dist/{google-meet-icon_5.entry-7b1b36f2.js → google-meet-icon_5.entry-f1f05903.js} +12 -12
- package/dist/inbox-icon.entry-9a4628f2.cjs +1 -0
- package/dist/inbox-icon.entry-aa78ba8c.js +16 -0
- package/dist/index-1e75512f.cjs +57 -0
- package/dist/{index-9243e481.js → index-e8380973.js} +5687 -4802
- package/dist/{index.es-13ff6710-0f748bd2.cjs → index.es-fc8588de-034ead51.cjs} +6 -6
- package/dist/{index.es-13ff6710-73fa05e6.js → index.es-fc8588de-c943eef6.js} +827 -1065
- package/dist/{info-icon_2.entry-ba869bab.js → info-icon_2.entry-b3b313ab.js} +3 -3
- package/dist/{info-icon_2.entry-6667923a.cjs → info-icon_2.entry-bbcefb9a.cjs} +1 -1
- package/dist/{input-component.entry-7396acf1.js → input-component.entry-401b9ba5.js} +9 -9
- package/dist/{input-component.entry-db84f917.cjs → input-component.entry-ec8e8e7c.cjs} +1 -1
- package/dist/input-dropdown_2.entry-8cb11601.cjs +1 -0
- package/dist/{input-dropdown_2.entry-20f2031b.js → input-dropdown_2.entry-c37f392c.js} +6 -6
- package/dist/italic-icon.entry-0e85d0d9.js +16 -0
- package/dist/italic-icon.entry-6675558a.cjs +1 -0
- package/dist/{multi-select-dropdown_2.entry-81740b34.js → multi-select-dropdown_2.entry-3eecf18a.js} +22 -16
- package/dist/{multi-select-dropdown_2.entry-8e07b42b.cjs → multi-select-dropdown_2.entry-e37c501d.cjs} +1 -1
- package/dist/{nylas-booked-event-card_12.entry-e56c8e92.js → nylas-booked-event-card_12.entry-e7464ae7.js} +226 -224
- package/dist/nylas-booked-event-card_12.entry-fddc9ab8.cjs +1 -0
- package/dist/{nylas-event-calendar_3.entry-2504c7c0.js → nylas-event-calendar_3.entry-9abd46c2.js} +2360 -2238
- package/dist/nylas-event-calendar_3.entry-e6669bbf.cjs +11 -0
- package/dist/{nylas-form-card.entry-98903549.js → nylas-form-card.entry-a3186807.js} +3 -3
- package/dist/{nylas-form-card.entry-c406e3d3.cjs → nylas-form-card.entry-cbb00fba.cjs} +1 -1
- package/dist/nylas-scheduler-editor.entry-5c92901a.cjs +2 -0
- package/dist/{nylas-scheduler-editor.entry-670cc0b8.js → nylas-scheduler-editor.entry-7b188a38.js} +83 -50
- package/dist/nylas-scheduling.entry-970240f6.cjs +1 -0
- package/dist/nylas-scheduling.entry-e9929b03.js +968 -0
- package/dist/{person-icon.entry-bdaa899b.cjs → person-icon.entry-8998fdb8.cjs} +1 -1
- package/dist/{person-icon.entry-3bca6e51.js → person-icon.entry-d2856f08.js} +4 -4
- package/dist/{play-icon.entry-ecc86e85.cjs → play-icon.entry-99eb969b.cjs} +1 -1
- package/dist/play-icon.entry-f949a80f.js +16 -0
- package/dist/{radio-button-group.entry-9851076c.js → radio-button-group.entry-bc3b12fd.js} +2 -2
- package/dist/{radio-button-group.entry-6965ad34.cjs → radio-button-group.entry-d66edd04.cjs} +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +96 -104
- package/dist/{refresh-icon.entry-90d52ab3.cjs → refresh-icon.entry-99d1982d.cjs} +1 -1
- package/dist/{refresh-icon.entry-d776c4a7.js → refresh-icon.entry-d6df8b1c.js} +2 -2
- package/dist/{register-component-02a05665-2e992621.js → register-component-62d792d4-448b6a43.js} +1 -1
- package/dist/{register-component-02a05665-75652287.cjs → register-component-62d792d4-c6e7d129.cjs} +1 -1
- package/dist/{reply-all-icon.entry-24f7c0fe.js → reply-all-icon.entry-7ebf01a0.js} +2 -2
- package/dist/{reply-all-icon.entry-6e49eb03.cjs → reply-all-icon.entry-d7c44139.cjs} +1 -1
- package/dist/{reply-icon.entry-7fff25c9.cjs → reply-icon.entry-058c00e8.cjs} +1 -1
- package/dist/{reply-icon.entry-d5d26d65.js → reply-icon.entry-d1622d85.js} +5 -5
- package/dist/sent-icon.entry-6c604512.cjs +1 -0
- package/dist/sent-icon.entry-fe12bc2f.js +16 -0
- package/dist/spam-icon.entry-45e5292e.cjs +1 -0
- package/dist/spam-icon.entry-b97c7709.js +16 -0
- package/dist/{star-icon.entry-3c57a35c.cjs → star-icon.entry-4db13fdb.cjs} +1 -1
- package/dist/{star-icon.entry-c2e743a9.js → star-icon.entry-98b80645.js} +6 -6
- package/dist/{stop-icon.entry-0b9563d5.js → stop-icon.entry-0290fd30.js} +2 -2
- package/dist/{stop-icon.entry-cf4c4e63.cjs → stop-icon.entry-9d7b53fd.cjs} +1 -1
- package/dist/{textarea-component.entry-2eccc173.cjs → textarea-component.entry-9b474ab5.cjs} +1 -1
- package/dist/{textarea-component.entry-60e7a4d0.js → textarea-component.entry-a62c257b.js} +2 -2
- package/dist/{toggle-switch.entry-612744fd.cjs → toggle-switch.entry-5dbfcd48.cjs} +1 -1
- package/dist/{toggle-switch.entry-0a6b01e6.js → toggle-switch.entry-e423b793.js} +2 -2
- package/dist/{translate-icon.entry-ede5f77d.js → translate-icon.entry-60c55a2e.js} +4 -4
- package/dist/{translate-icon.entry-8adc4146.cjs → translate-icon.entry-f82fa6fc.cjs} +1 -1
- package/dist/trash-fill-icon.entry-095caae3.cjs +1 -0
- package/dist/trash-fill-icon.entry-825055fd.js +16 -0
- package/dist/{underline-icon.entry-d2fe2da6.cjs → underline-icon.entry-0807a43d.cjs} +1 -1
- package/dist/{underline-icon.entry-b2b43ba2.js → underline-icon.entry-40028bc6.js} +2 -2
- package/dist/{warning-icon.entry-0a5c7337.js → warning-icon.entry-24e37759.js} +2 -2
- package/dist/{warning-icon.entry-85822f4d.cjs → warning-icon.entry-fce7c14f.cjs} +1 -1
- package/package.json +2 -2
- package/dist/add-circle-icon_2.entry-e616ece6.cjs +0 -1
- package/dist/archive-icon.entry-41938a61.cjs +0 -1
- package/dist/archive-icon.entry-bd81d2d9.js +0 -16
- package/dist/arrow-icon.entry-4103be57.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_36.entry-917e4a9d.cjs +0 -6
- package/dist/checkmark-icon_15.entry-08c8b107.cjs +0 -5
- package/dist/chevron-icon_3.entry-2f75c3c4.cjs +0 -1
- package/dist/constants-3d8016e3-fd6c3848.cjs +0 -1
- package/dist/document-refresh-icon.entry-f6dfe744.js +0 -16
- package/dist/google-logo-icon_6.entry-896a10a5.cjs +0 -2
- package/dist/inbox-icon.entry-24ec450f.cjs +0 -1
- package/dist/inbox-icon.entry-b71acde0.js +0 -16
- package/dist/index-efb6db79.cjs +0 -57
- package/dist/input-dropdown_2.entry-0c219620.cjs +0 -1
- package/dist/italic-icon.entry-a9324a8a.cjs +0 -1
- package/dist/italic-icon.entry-c42f8112.js +0 -16
- package/dist/notebook-store-b61693cd-5657061b.js +0 -14
- package/dist/notebook-store-b61693cd-6515d345.cjs +0 -5
- package/dist/nylas-booked-event-card_12.entry-7c7afae5.cjs +0 -1
- package/dist/nylas-call-summary.entry-4bf7284f.cjs +0 -1
- package/dist/nylas-call-summary.entry-ad6fb46a.js +0 -16
- package/dist/nylas-event-calendar_3.entry-f747f6a8.cjs +0 -6
- package/dist/nylas-if-state.entry-6b071705.cjs +0 -1
- package/dist/nylas-if-state.entry-7468854a.js +0 -95
- package/dist/nylas-key-points.entry-7af8da1a.cjs +0 -1
- package/dist/nylas-key-points.entry-c186445e.js +0 -29
- package/dist/nylas-login.entry-171bd025.cjs +0 -1
- package/dist/nylas-login.entry-d85c1473.js +0 -74
- package/dist/nylas-provider.entry-ab1f6886.js +0 -265
- package/dist/nylas-provider.entry-e4231b93.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-d522ca98.cjs +0 -2
- package/dist/nylas-scheduling.entry-9e81c6fc.js +0 -439
- package/dist/nylas-scheduling.entry-c52edb14.cjs +0 -1
- package/dist/nylas-transcript.entry-a1fa7e17.cjs +0 -6
- package/dist/nylas-transcript.entry-fb39b5af.js +0 -128
- package/dist/nylas-video-player.entry-25e8cd9a.js +0 -39
- package/dist/nylas-video-player.entry-89842545.cjs +0 -1
- package/dist/nylas-video-preview.entry-28a0bd60.cjs +0 -1
- package/dist/nylas-video-preview.entry-80171531.js +0 -16
- package/dist/play-icon.entry-d548464e.js +0 -16
- package/dist/scheduler-config-store-d6729d8d-50920e8c.js +0 -29
- package/dist/scheduler-config-store-d6729d8d-a0bdda83.cjs +0 -1
- package/dist/scheduler-store-fe9e85a4-1dcfddfa.js +0 -533
- package/dist/scheduler-store-fe9e85a4-baabf78a.cjs +0 -1
- package/dist/sent-icon.entry-42ce5bcb.cjs +0 -1
- package/dist/sent-icon.entry-858fe83e.js +0 -16
- package/dist/spam-icon.entry-0827144e.js +0 -16
- package/dist/spam-icon.entry-bf1a48b6.cjs +0 -1
- package/dist/trash-fill-icon.entry-b6456ec8.cjs +0 -1
- package/dist/trash-fill-icon.entry-d48f72c5.js +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
class
|
|
1
|
+
import { n as er, b as T, o as tr, q as bt } from "./index-e8380973.js";
|
|
2
|
+
class nr {
|
|
3
3
|
constructor(e, n, r = !0, s) {
|
|
4
4
|
this.automaticComponentRegistration = !0, this.registeredComponents = {}, this.propStateRegistrations = /* @__PURE__ */ new Map(), this.eventListenerRegistrations = /* @__PURE__ */ new Map(), this.host = e, this.stores = n, this.automaticComponentRegistration = r, this.eventOverrides = s, T(`[${this.hostTagName}] Initializing (abstract) provider.`, { eventOverrides: s }), this.registerComponent = this.registerComponent.bind(this), this.getStore = this.getStore.bind(this), Object.keys(this.stores).forEach((i) => {
|
|
5
5
|
this.propStateRegistrations.set(i, /* @__PURE__ */ new Map());
|
|
@@ -59,7 +59,7 @@ class sr {
|
|
|
59
59
|
async registerComponent(e) {
|
|
60
60
|
T(`~[${this.hostTagName}] (registerComponent) Registering component ${e.name}.`);
|
|
61
61
|
const n = e.element.dataset.nylasId;
|
|
62
|
-
n && this.registeredComponents[n] ? (T(`[${this.hostTagName}] (registerComponent) Component ${e.name} already registered. Updating registration.`), this.cleanupComponentRegistration(n, !1)) : e.element.dataset.nylasId = n ||
|
|
62
|
+
n && this.registeredComponents[n] ? (T(`[${this.hostTagName}] (registerComponent) Component ${e.name} already registered. Updating registration.`), this.cleanupComponentRegistration(n, !1)) : e.element.dataset.nylasId = n || tr();
|
|
63
63
|
const s = e.element.dataset.nylasId;
|
|
64
64
|
s && (this.registeredComponents[s] = e), T(`[${this.hostTagName}] (registerComponent) Waiting for "${e.element.localName}" component to be defined`, { component: e });
|
|
65
65
|
try {
|
|
@@ -67,7 +67,7 @@ class sr {
|
|
|
67
67
|
} catch (p) {
|
|
68
68
|
T(`[${this.hostTagName}] (registerComponent) Error waiting for component "${e.element.localName}" to be defined:`, p);
|
|
69
69
|
}
|
|
70
|
-
const i = this.eventOverrides, { stateToProps: o, getStoresToProp:
|
|
70
|
+
const i = this.eventOverrides, { stateToProps: o, getStoresToProp: u, eventToProps: a, storeToProps: c, connectorToProp: h, localPropsToProp: l, element: d } = e;
|
|
71
71
|
a == null || a.forEach((p, m) => {
|
|
72
72
|
var b;
|
|
73
73
|
const f = this.nylasConnector, v = async (w) => {
|
|
@@ -92,10 +92,10 @@ class sr {
|
|
|
92
92
|
propKey: p
|
|
93
93
|
}
|
|
94
94
|
]), d[p.toString()] = g, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to "${m}" value.`, { stateValue: g });
|
|
95
|
-
}),
|
|
95
|
+
}), l == null || l.forEach((p, m) => {
|
|
96
96
|
const f = this.host[m];
|
|
97
97
|
d[p.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to the value of "${m}" value.`, { value: m, mappedPropValue: f });
|
|
98
|
-
}),
|
|
98
|
+
}), u && (d[u == null ? void 0 : u.toString()] = this.getStore, T(`[${this.hostTagName}] Setting "${e.name}" prop "${u.toString()}" to "getStore" method.`)), c == null || c.forEach((p, m) => {
|
|
99
99
|
const f = this.getStore(m);
|
|
100
100
|
d[p.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to "${m}" store.`, { store: f });
|
|
101
101
|
}), h && (d[h == null ? void 0 : h.toString()] = this.nylasConnector, T(`[${this.hostTagName}] Setting "${e.name}" prop "${h.toString()}" to "nylasConnector" value.`, { connectorToProp: h })), typeof d.registerCallback == "function" && (T(`[${this.hostTagName}] (registerComponent) Calling registerCallback method for "${e.name}".`), await d.registerCallback()), T(`[${this.hostTagName}] (registerComponent) Component ${e.name} registered.`);
|
|
@@ -103,13 +103,13 @@ class sr {
|
|
|
103
103
|
cleanupComponentRegistration(e, n = !0) {
|
|
104
104
|
const r = this.eventListenerRegistrations.get(e);
|
|
105
105
|
r && (r.forEach(([s, i, o]) => {
|
|
106
|
-
const
|
|
107
|
-
T(`[${this.hostTagName}] (cleanupComponentRegistration) Removing event listener for "${
|
|
106
|
+
const u = bt(i.toString());
|
|
107
|
+
T(`[${this.hostTagName}] (cleanupComponentRegistration) Removing event listener for "${u}" on "${s.tagName}"`), s.removeEventListener(u, o);
|
|
108
108
|
}), this.eventListenerRegistrations.delete(e)), this.propStateRegistrations.forEach((s, i) => {
|
|
109
|
-
s.forEach((o,
|
|
109
|
+
s.forEach((o, u) => {
|
|
110
110
|
var c;
|
|
111
111
|
const a = o.filter((h) => h.elementId !== e);
|
|
112
|
-
a.length !== o.length && ((c = this.propStateRegistrations.get(i)) == null || c.set(
|
|
112
|
+
a.length !== o.length && ((c = this.propStateRegistrations.get(i)) == null || c.set(u, a));
|
|
113
113
|
});
|
|
114
114
|
}), n && delete this.registeredComponents[e];
|
|
115
115
|
}
|
|
@@ -125,16 +125,16 @@ class sr {
|
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
this.propStateRegistrations.forEach((s, i) => {
|
|
128
|
-
s.forEach((o,
|
|
129
|
-
var h,
|
|
130
|
-
const a = (h = this.propStateRegistrations.get(i)) == null ? void 0 : h.get(
|
|
131
|
-
c && ((
|
|
128
|
+
s.forEach((o, u) => {
|
|
129
|
+
var h, l;
|
|
130
|
+
const a = (h = this.propStateRegistrations.get(i)) == null ? void 0 : h.get(u), c = a == null ? void 0 : a.filter((d) => d.elementId !== n);
|
|
131
|
+
c && ((l = this.propStateRegistrations.get(i)) == null || l.set(u, c));
|
|
132
132
|
});
|
|
133
133
|
});
|
|
134
134
|
const r = this.eventListenerRegistrations.get(n);
|
|
135
135
|
r == null || r.forEach(([s, i, o]) => {
|
|
136
|
-
const
|
|
137
|
-
T(`[${this.hostTagName}] (unregisterComponent) Removing event listener for "${
|
|
136
|
+
const u = bt(i.toString());
|
|
137
|
+
T(`[${this.hostTagName}] (unregisterComponent) Removing event listener for "${u}" on "${s.tagName}"`), s.removeEventListener(u, o);
|
|
138
138
|
}), delete this.registeredComponents[n];
|
|
139
139
|
}
|
|
140
140
|
getStore(e) {
|
|
@@ -153,8 +153,8 @@ class sr {
|
|
|
153
153
|
T(`[${e.hostTagName}] (setupStoreListeners) Store "${n}" state "${s.toString()}" unchanged. Skipping.`);
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
if (!
|
|
156
|
+
const u = e.registeredComponents;
|
|
157
|
+
if (!u) {
|
|
158
158
|
T(`[${e.hostTagName}] (setupStoreListeners) No registered components found. Skipping.`);
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
@@ -162,14 +162,14 @@ class sr {
|
|
|
162
162
|
T(`[${e.hostTagName}] (setupStoreListeners) Found ${a.length} prop(s) registered for "${s.toString()}" store.`, {
|
|
163
163
|
props: a,
|
|
164
164
|
propStateRegistrations: e.propStateRegistrations
|
|
165
|
-
}), a.forEach(({ elementId: h, propKey:
|
|
166
|
-
const d =
|
|
165
|
+
}), a.forEach(({ elementId: h, propKey: l }) => {
|
|
166
|
+
const d = u[h];
|
|
167
167
|
if (!d) {
|
|
168
168
|
T(`[${e.hostTagName}] (setupStoreListeners) Component "${h}" not found. Skipping.`, { component: d });
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
const m = e.getStore(n).state[s];
|
|
172
|
-
d.element[
|
|
172
|
+
d.element[l.toString()] = m, T(`[${e.hostTagName}] (setupStoreListeners) Setting "${d.name}" prop "${l.toString()}" to "${s.toString()}" value.`, { stateValue: m });
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
});
|
|
@@ -180,59 +180,54 @@ class sr {
|
|
|
180
180
|
return ((n = (e = this.host) == null ? void 0 : e.tagName) == null ? void 0 : n.toLowerCase()) ?? "nylas-provider";
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
class
|
|
183
|
+
class Xr extends nr {
|
|
184
184
|
}
|
|
185
|
-
var
|
|
186
|
-
const
|
|
187
|
-
async function dn(t) {
|
|
188
|
-
const e = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", e), r = Array.from(new Uint8Array(n)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
189
|
-
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
190
|
-
}
|
|
191
|
-
const R = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : nr, j = Object.keys, M = Array.isArray;
|
|
185
|
+
var rr = /* @__PURE__ */ ((t) => (t.Error = "error", t.Warning = "warning", t.Info = "info", t.Success = "success", t))(rr || {});
|
|
186
|
+
const Qr = (t) => t !== null && typeof t == "object" && "error" in t, $ = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : er, I = Object.keys, M = Array.isArray;
|
|
192
187
|
function U(t, e) {
|
|
193
|
-
return typeof e != "object" ||
|
|
188
|
+
return typeof e != "object" || I(e).forEach(function(n) {
|
|
194
189
|
t[n] = e[n];
|
|
195
190
|
}), t;
|
|
196
191
|
}
|
|
197
|
-
typeof Promise > "u" ||
|
|
198
|
-
const Be = Object.getPrototypeOf,
|
|
192
|
+
typeof Promise > "u" || $.Promise || ($.Promise = Promise);
|
|
193
|
+
const Be = Object.getPrototypeOf, sr = {}.hasOwnProperty;
|
|
199
194
|
function z(t, e) {
|
|
200
|
-
return
|
|
195
|
+
return sr.call(t, e);
|
|
201
196
|
}
|
|
202
197
|
function Ce(t, e) {
|
|
203
|
-
typeof e == "function" && (e = e(Be(t))), (typeof Reflect > "u" ?
|
|
198
|
+
typeof e == "function" && (e = e(Be(t))), (typeof Reflect > "u" ? I : Reflect.ownKeys)(e).forEach((n) => {
|
|
204
199
|
ee(t, n, e[n]);
|
|
205
200
|
});
|
|
206
201
|
}
|
|
207
|
-
const
|
|
202
|
+
const xn = Object.defineProperty;
|
|
208
203
|
function ee(t, e, n, r) {
|
|
209
|
-
|
|
204
|
+
xn(t, e, U(n && z(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
|
|
210
205
|
}
|
|
211
|
-
function
|
|
206
|
+
function _e(t) {
|
|
212
207
|
return { from: function(e) {
|
|
213
208
|
return t.prototype = Object.create(e.prototype), ee(t.prototype, "constructor", t), { extend: Ce.bind(null, t.prototype) };
|
|
214
209
|
} };
|
|
215
210
|
}
|
|
216
|
-
const
|
|
217
|
-
function
|
|
211
|
+
const ir = Object.getOwnPropertyDescriptor;
|
|
212
|
+
function Jt(t, e) {
|
|
218
213
|
let n;
|
|
219
|
-
return
|
|
214
|
+
return ir(t, e) || (n = Be(t)) && Jt(n, e);
|
|
220
215
|
}
|
|
221
|
-
const
|
|
222
|
-
function
|
|
223
|
-
return
|
|
216
|
+
const or = [].slice;
|
|
217
|
+
function ut(t, e, n) {
|
|
218
|
+
return or.call(t, e, n);
|
|
224
219
|
}
|
|
225
|
-
function
|
|
220
|
+
function Sn(t, e) {
|
|
226
221
|
return e(t);
|
|
227
222
|
}
|
|
228
|
-
function
|
|
223
|
+
function Ke(t) {
|
|
229
224
|
if (!t)
|
|
230
225
|
throw new Error("Assertion Failed");
|
|
231
226
|
}
|
|
232
|
-
function
|
|
233
|
-
|
|
227
|
+
function Cn(t) {
|
|
228
|
+
$.setImmediate ? setImmediate(t) : setTimeout(t, 0);
|
|
234
229
|
}
|
|
235
|
-
function
|
|
230
|
+
function En(t, e) {
|
|
236
231
|
return t.reduce((n, r, s) => {
|
|
237
232
|
var i = e(r, s);
|
|
238
233
|
return i && (n[i[0]] = i[1]), n;
|
|
@@ -252,49 +247,49 @@ function te(t, e) {
|
|
|
252
247
|
}
|
|
253
248
|
var o = e.indexOf(".");
|
|
254
249
|
if (o !== -1) {
|
|
255
|
-
var
|
|
256
|
-
return
|
|
250
|
+
var u = t[e.substr(0, o)];
|
|
251
|
+
return u === void 0 ? void 0 : te(u, e.substr(o + 1));
|
|
257
252
|
}
|
|
258
253
|
}
|
|
259
|
-
function
|
|
254
|
+
function Y(t, e, n) {
|
|
260
255
|
if (t && e !== void 0 && (!("isFrozen" in Object) || !Object.isFrozen(t)))
|
|
261
256
|
if (typeof e != "string" && "length" in e) {
|
|
262
|
-
|
|
257
|
+
Ke(typeof n != "string" && "length" in n);
|
|
263
258
|
for (var r = 0, s = e.length; r < s; ++r)
|
|
264
|
-
|
|
259
|
+
Y(t, e[r], n[r]);
|
|
265
260
|
} else {
|
|
266
261
|
var i = e.indexOf(".");
|
|
267
262
|
if (i !== -1) {
|
|
268
|
-
var o = e.substr(0, i),
|
|
269
|
-
if (
|
|
263
|
+
var o = e.substr(0, i), u = e.substr(i + 1);
|
|
264
|
+
if (u === "")
|
|
270
265
|
n === void 0 ? M(t) && !isNaN(parseInt(o)) ? t.splice(o, 1) : delete t[o] : t[o] = n;
|
|
271
266
|
else {
|
|
272
267
|
var a = t[o];
|
|
273
|
-
a && z(t, o) || (a = t[o] = {}),
|
|
268
|
+
a && z(t, o) || (a = t[o] = {}), Y(a, u, n);
|
|
274
269
|
}
|
|
275
270
|
} else
|
|
276
271
|
n === void 0 ? M(t) && !isNaN(parseInt(e)) ? t.splice(e, 1) : delete t[e] : t[e] = n;
|
|
277
272
|
}
|
|
278
273
|
}
|
|
279
|
-
function
|
|
274
|
+
function Pn(t) {
|
|
280
275
|
var e = {};
|
|
281
276
|
for (var n in t)
|
|
282
277
|
z(t, n) && (e[n] = t[n]);
|
|
283
278
|
return e;
|
|
284
279
|
}
|
|
285
|
-
const
|
|
286
|
-
function
|
|
287
|
-
return
|
|
280
|
+
const ar = [].concat;
|
|
281
|
+
function Tn(t) {
|
|
282
|
+
return ar.apply([], t);
|
|
288
283
|
}
|
|
289
|
-
const
|
|
290
|
-
|
|
284
|
+
const On = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Tn([8, 16, 32, 64].map((t) => ["Int", "Uint", "Float"].map((e) => e + t + "Array")))).filter((t) => $[t]), ur = On.map((t) => $[t]);
|
|
285
|
+
En(On, (t) => [t, !0]);
|
|
291
286
|
let se = null;
|
|
292
|
-
function
|
|
287
|
+
function Ve(t) {
|
|
293
288
|
se = typeof WeakMap < "u" && /* @__PURE__ */ new WeakMap();
|
|
294
|
-
const e =
|
|
289
|
+
const e = Pt(t);
|
|
295
290
|
return se = null, e;
|
|
296
291
|
}
|
|
297
|
-
function
|
|
292
|
+
function Pt(t) {
|
|
298
293
|
if (!t || typeof t != "object")
|
|
299
294
|
return t;
|
|
300
295
|
let e = se && se.get(t);
|
|
@@ -303,34 +298,34 @@ function Tt(t) {
|
|
|
303
298
|
if (M(t)) {
|
|
304
299
|
e = [], se && se.set(t, e);
|
|
305
300
|
for (var n = 0, r = t.length; n < r; ++n)
|
|
306
|
-
e.push(
|
|
307
|
-
} else if (
|
|
301
|
+
e.push(Pt(t[n]));
|
|
302
|
+
} else if (ur.indexOf(t.constructor) >= 0)
|
|
308
303
|
e = t;
|
|
309
304
|
else {
|
|
310
305
|
const i = Be(t);
|
|
311
306
|
for (var s in e = i === Object.prototype ? {} : Object.create(i), se && se.set(t, e), t)
|
|
312
|
-
z(t, s) && (e[s] =
|
|
307
|
+
z(t, s) && (e[s] = Pt(t[s]));
|
|
313
308
|
}
|
|
314
309
|
return e;
|
|
315
310
|
}
|
|
316
|
-
const { toString:
|
|
317
|
-
function
|
|
318
|
-
return
|
|
311
|
+
const { toString: lr } = {};
|
|
312
|
+
function Tt(t) {
|
|
313
|
+
return lr.call(t).slice(8, -1);
|
|
319
314
|
}
|
|
320
|
-
const Ot = typeof Symbol < "u" ? Symbol.iterator : "@@iterator",
|
|
315
|
+
const Ot = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", cr = typeof Ot == "symbol" ? function(t) {
|
|
321
316
|
var e;
|
|
322
317
|
return t != null && (e = t[Ot]) && e.apply(t);
|
|
323
318
|
} : function() {
|
|
324
319
|
return null;
|
|
325
|
-
},
|
|
320
|
+
}, we = {};
|
|
326
321
|
function J(t) {
|
|
327
322
|
var e, n, r, s;
|
|
328
323
|
if (arguments.length === 1) {
|
|
329
324
|
if (M(t))
|
|
330
325
|
return t.slice();
|
|
331
|
-
if (this ===
|
|
326
|
+
if (this === we && typeof t == "string")
|
|
332
327
|
return [t];
|
|
333
|
-
if (s =
|
|
328
|
+
if (s = cr(t)) {
|
|
334
329
|
for (n = []; !(r = s.next()).done; )
|
|
335
330
|
n.push(r.value);
|
|
336
331
|
return n;
|
|
@@ -348,15 +343,15 @@ function J(t) {
|
|
|
348
343
|
n[e] = arguments[e];
|
|
349
344
|
return n;
|
|
350
345
|
}
|
|
351
|
-
const
|
|
346
|
+
const Zt = typeof Symbol < "u" ? (t) => t[Symbol.toStringTag] === "AsyncFunction" : () => !1;
|
|
352
347
|
var G = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
353
|
-
function
|
|
354
|
-
G = t,
|
|
348
|
+
function An(t, e) {
|
|
349
|
+
G = t, Kn = e;
|
|
355
350
|
}
|
|
356
|
-
var
|
|
357
|
-
const
|
|
358
|
-
function
|
|
359
|
-
if (
|
|
351
|
+
var Kn = () => !0;
|
|
352
|
+
const hr = !new Error("").stack;
|
|
353
|
+
function Ee() {
|
|
354
|
+
if (hr)
|
|
360
355
|
try {
|
|
361
356
|
throw new Error();
|
|
362
357
|
} catch (t) {
|
|
@@ -364,93 +359,93 @@ function Pe() {
|
|
|
364
359
|
}
|
|
365
360
|
return new Error();
|
|
366
361
|
}
|
|
367
|
-
function
|
|
362
|
+
function At(t, e) {
|
|
368
363
|
var n = t.stack;
|
|
369
364
|
return n ? (e = e || 0, n.indexOf(t.name) === 0 && (e += (t.name + t.message).split(`
|
|
370
365
|
`).length), n.split(`
|
|
371
|
-
`).slice(e).filter(
|
|
366
|
+
`).slice(e).filter(Kn).map((r) => `
|
|
372
367
|
` + r).join("")) : "";
|
|
373
368
|
}
|
|
374
|
-
var
|
|
375
|
-
function
|
|
376
|
-
this._e =
|
|
369
|
+
var $n = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], en = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat($n), dr = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
|
|
370
|
+
function ke(t, e) {
|
|
371
|
+
this._e = Ee(), this.name = t, this.message = e;
|
|
377
372
|
}
|
|
378
|
-
function
|
|
373
|
+
function Nn(t, e) {
|
|
379
374
|
return t + ". Errors: " + Object.keys(e).map((n) => e[n].toString()).filter((n, r, s) => s.indexOf(n) === r).join(`
|
|
380
375
|
`);
|
|
381
376
|
}
|
|
382
|
-
function
|
|
383
|
-
this._e =
|
|
377
|
+
function lt(t, e, n, r) {
|
|
378
|
+
this._e = Ee(), this.failures = e, this.failedKeys = r, this.successCount = n, this.message = Nn(t, e);
|
|
384
379
|
}
|
|
385
|
-
function
|
|
386
|
-
this._e =
|
|
380
|
+
function Ne(t, e) {
|
|
381
|
+
this._e = Ee(), this.name = "BulkError", this.failures = Object.keys(e).map((n) => e[n]), this.failuresByPos = e, this.message = Nn(t, e);
|
|
387
382
|
}
|
|
388
|
-
ke
|
|
389
|
-
return this._stack || (this._stack = this.name + ": " + this.message +
|
|
383
|
+
_e(ke).from(Error).extend({ stack: { get: function() {
|
|
384
|
+
return this._stack || (this._stack = this.name + ": " + this.message + At(this._e, 2));
|
|
390
385
|
} }, toString: function() {
|
|
391
386
|
return this.name + ": " + this.message;
|
|
392
|
-
} }),
|
|
393
|
-
var
|
|
394
|
-
const
|
|
395
|
-
var
|
|
387
|
+
} }), _e(lt).from(ke), _e(Ne).from(ke);
|
|
388
|
+
var tn = en.reduce((t, e) => (t[e] = e + "Error", t), {});
|
|
389
|
+
const fr = ke;
|
|
390
|
+
var P = en.reduce((t, e) => {
|
|
396
391
|
var n = e + "Error";
|
|
397
392
|
function r(s, i) {
|
|
398
|
-
this._e =
|
|
399
|
-
` + i : ""}`, this.inner = i || null) : typeof s == "object" && (this.message = `${s.name} ${s.message}`, this.inner = s) : (this.message =
|
|
393
|
+
this._e = Ee(), this.name = n, s ? typeof s == "string" ? (this.message = `${s}${i ? `
|
|
394
|
+
` + i : ""}`, this.inner = i || null) : typeof s == "object" && (this.message = `${s.name} ${s.message}`, this.inner = s) : (this.message = dr[e] || n, this.inner = null);
|
|
400
395
|
}
|
|
401
|
-
return
|
|
396
|
+
return _e(r).from(fr), t[e] = r, t;
|
|
402
397
|
}, {});
|
|
403
|
-
|
|
404
|
-
var
|
|
405
|
-
function
|
|
398
|
+
P.Syntax = SyntaxError, P.Type = TypeError, P.Range = RangeError;
|
|
399
|
+
var hn = $n.reduce((t, e) => (t[e + "Error"] = P[e], t), {}), tt = en.reduce((t, e) => (["Syntax", "Type", "Range"].indexOf(e) === -1 && (t[e + "Error"] = P[e]), t), {});
|
|
400
|
+
function K() {
|
|
406
401
|
}
|
|
407
402
|
function Fe(t) {
|
|
408
403
|
return t;
|
|
409
404
|
}
|
|
410
|
-
function
|
|
405
|
+
function pr(t, e) {
|
|
411
406
|
return t == null || t === Fe ? e : function(n) {
|
|
412
407
|
return e(t(n));
|
|
413
408
|
};
|
|
414
409
|
}
|
|
415
|
-
function
|
|
410
|
+
function pe(t, e) {
|
|
416
411
|
return function() {
|
|
417
412
|
t.apply(this, arguments), e.apply(this, arguments);
|
|
418
413
|
};
|
|
419
414
|
}
|
|
420
|
-
function
|
|
421
|
-
return t ===
|
|
415
|
+
function mr(t, e) {
|
|
416
|
+
return t === K ? e : function() {
|
|
422
417
|
var n = t.apply(this, arguments);
|
|
423
418
|
n !== void 0 && (arguments[0] = n);
|
|
424
419
|
var r = this.onsuccess, s = this.onerror;
|
|
425
420
|
this.onsuccess = null, this.onerror = null;
|
|
426
421
|
var i = e.apply(this, arguments);
|
|
427
|
-
return r && (this.onsuccess = this.onsuccess ?
|
|
422
|
+
return r && (this.onsuccess = this.onsuccess ? pe(r, this.onsuccess) : r), s && (this.onerror = this.onerror ? pe(s, this.onerror) : s), i !== void 0 ? i : n;
|
|
428
423
|
};
|
|
429
424
|
}
|
|
430
|
-
function
|
|
431
|
-
return t ===
|
|
425
|
+
function gr(t, e) {
|
|
426
|
+
return t === K ? e : function() {
|
|
432
427
|
t.apply(this, arguments);
|
|
433
428
|
var n = this.onsuccess, r = this.onerror;
|
|
434
|
-
this.onsuccess = this.onerror = null, e.apply(this, arguments), n && (this.onsuccess = this.onsuccess ?
|
|
429
|
+
this.onsuccess = this.onerror = null, e.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? pe(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? pe(r, this.onerror) : r);
|
|
435
430
|
};
|
|
436
431
|
}
|
|
437
|
-
function
|
|
438
|
-
return t ===
|
|
432
|
+
function yr(t, e) {
|
|
433
|
+
return t === K ? e : function(n) {
|
|
439
434
|
var r = t.apply(this, arguments);
|
|
440
435
|
U(n, r);
|
|
441
436
|
var s = this.onsuccess, i = this.onerror;
|
|
442
437
|
this.onsuccess = null, this.onerror = null;
|
|
443
438
|
var o = e.apply(this, arguments);
|
|
444
|
-
return s && (this.onsuccess = this.onsuccess ?
|
|
439
|
+
return s && (this.onsuccess = this.onsuccess ? pe(s, this.onsuccess) : s), i && (this.onerror = this.onerror ? pe(i, this.onerror) : i), r === void 0 ? o === void 0 ? void 0 : o : U(r, o);
|
|
445
440
|
};
|
|
446
441
|
}
|
|
447
|
-
function
|
|
448
|
-
return t ===
|
|
442
|
+
function vr(t, e) {
|
|
443
|
+
return t === K ? e : function() {
|
|
449
444
|
return e.apply(this, arguments) !== !1 && t.apply(this, arguments);
|
|
450
445
|
};
|
|
451
446
|
}
|
|
452
|
-
function
|
|
453
|
-
return t ===
|
|
447
|
+
function nn(t, e) {
|
|
448
|
+
return t === K ? e : function() {
|
|
454
449
|
var n = t.apply(this, arguments);
|
|
455
450
|
if (n && typeof n.then == "function") {
|
|
456
451
|
for (var r = this, s = arguments.length, i = new Array(s); s--; )
|
|
@@ -462,118 +457,118 @@ function rn(t, e) {
|
|
|
462
457
|
return e.apply(this, arguments);
|
|
463
458
|
};
|
|
464
459
|
}
|
|
465
|
-
tt.ModifyError =
|
|
460
|
+
tt.ModifyError = lt, tt.DexieError = ke, tt.BulkError = Ne;
|
|
466
461
|
var Me = {};
|
|
467
|
-
const
|
|
462
|
+
const Rn = 100, [Kt, ct, $t] = typeof Promise > "u" ? [] : (() => {
|
|
468
463
|
let t = Promise.resolve();
|
|
469
464
|
if (typeof crypto > "u" || !crypto.subtle)
|
|
470
465
|
return [t, Be(t), t];
|
|
471
466
|
const e = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
472
467
|
return [e, Be(e), t];
|
|
473
|
-
})(),
|
|
474
|
-
var Nt = !1,
|
|
475
|
-
$t.then(
|
|
476
|
-
} :
|
|
468
|
+
})(), jn = ct && ct.then, nt = Kt && Kt.constructor, rn = !!$t;
|
|
469
|
+
var Nt = !1, br = $t ? () => {
|
|
470
|
+
$t.then(He);
|
|
471
|
+
} : $.setImmediate ? setImmediate.bind(null, He) : $.MutationObserver ? () => {
|
|
477
472
|
var t = document.createElement("div");
|
|
478
473
|
new MutationObserver(() => {
|
|
479
|
-
|
|
474
|
+
He(), t = null;
|
|
480
475
|
}).observe(t, { attributes: !0 }), t.setAttribute("i", "1");
|
|
481
476
|
} : () => {
|
|
482
|
-
setTimeout(
|
|
483
|
-
},
|
|
484
|
-
|
|
485
|
-
},
|
|
477
|
+
setTimeout(He, 0);
|
|
478
|
+
}, Re = function(t, e) {
|
|
479
|
+
$e.push([t, e]), ht && (br(), ht = !1);
|
|
480
|
+
}, Rt = !0, ht = !0, de = [], rt = [], jt = null, It = Fe, xe = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: pn, pgp: !1, env: {}, finalize: function() {
|
|
486
481
|
this.unhandleds.forEach((t) => {
|
|
487
482
|
try {
|
|
488
|
-
|
|
483
|
+
pn(t[0], t[1]);
|
|
489
484
|
} catch {
|
|
490
485
|
}
|
|
491
486
|
});
|
|
492
|
-
} },
|
|
487
|
+
} }, E = xe, $e = [], fe = 0, st = [];
|
|
493
488
|
function S(t) {
|
|
494
489
|
if (typeof this != "object")
|
|
495
490
|
throw new TypeError("Promises must be constructed via new");
|
|
496
|
-
this._listeners = [], this.onuncatched =
|
|
497
|
-
var e = this._PSD =
|
|
498
|
-
if (G && (this._stackHolder =
|
|
491
|
+
this._listeners = [], this.onuncatched = K, this._lib = !1;
|
|
492
|
+
var e = this._PSD = E;
|
|
493
|
+
if (G && (this._stackHolder = Ee(), this._prev = null, this._numPrev = 0), typeof t != "function") {
|
|
499
494
|
if (t !== Me)
|
|
500
495
|
throw new TypeError("Not a function");
|
|
501
|
-
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 &&
|
|
496
|
+
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Bt(this, this._value));
|
|
502
497
|
}
|
|
503
|
-
this._state = null, this._value = null, ++e.ref,
|
|
498
|
+
this._state = null, this._value = null, ++e.ref, Dn(this, t);
|
|
504
499
|
}
|
|
505
|
-
const
|
|
506
|
-
var t =
|
|
500
|
+
const Dt = { get: function() {
|
|
501
|
+
var t = E, e = dt;
|
|
507
502
|
function n(r, s) {
|
|
508
|
-
var i = !t.global && (t !==
|
|
503
|
+
var i = !t.global && (t !== E || e !== dt);
|
|
509
504
|
const o = i && !ne();
|
|
510
|
-
var
|
|
511
|
-
|
|
505
|
+
var u = new S((a, c) => {
|
|
506
|
+
sn(this, new In(ft(r, t, i, o), ft(s, t, i, o), a, c, t));
|
|
512
507
|
});
|
|
513
|
-
return G &&
|
|
508
|
+
return G && Mn(u, this), u;
|
|
514
509
|
}
|
|
515
510
|
return n.prototype = Me, n;
|
|
516
511
|
}, set: function(t) {
|
|
517
|
-
ee(this, "then", t && t.prototype === Me ?
|
|
512
|
+
ee(this, "then", t && t.prototype === Me ? Dt : { get: function() {
|
|
518
513
|
return t;
|
|
519
|
-
}, set:
|
|
514
|
+
}, set: Dt.set });
|
|
520
515
|
} };
|
|
521
|
-
function
|
|
516
|
+
function In(t, e, n, r, s) {
|
|
522
517
|
this.onFulfilled = typeof t == "function" ? t : null, this.onRejected = typeof e == "function" ? e : null, this.resolve = n, this.reject = r, this.psd = s;
|
|
523
518
|
}
|
|
524
|
-
function
|
|
519
|
+
function Dn(t, e) {
|
|
525
520
|
try {
|
|
526
521
|
e((n) => {
|
|
527
522
|
if (t._state === null) {
|
|
528
523
|
if (n === t)
|
|
529
524
|
throw new TypeError("A promise cannot be resolved with itself.");
|
|
530
525
|
var r = t._lib && ze();
|
|
531
|
-
n && typeof n.then == "function" ?
|
|
526
|
+
n && typeof n.then == "function" ? Dn(t, (s, i) => {
|
|
532
527
|
n instanceof S ? n._then(s, i) : n.then(s, i);
|
|
533
|
-
}) : (t._state = !0, t._value = n,
|
|
528
|
+
}) : (t._state = !0, t._value = n, Bn(t)), r && Ye();
|
|
534
529
|
}
|
|
535
|
-
},
|
|
530
|
+
}, Bt.bind(null, t));
|
|
536
531
|
} catch (n) {
|
|
537
|
-
|
|
532
|
+
Bt(t, n);
|
|
538
533
|
}
|
|
539
534
|
}
|
|
540
|
-
function
|
|
535
|
+
function Bt(t, e) {
|
|
541
536
|
if (rt.push(e), t._state === null) {
|
|
542
537
|
var n = t._lib && ze();
|
|
543
|
-
e =
|
|
538
|
+
e = It(e), t._state = !1, t._value = e, G && e !== null && typeof e == "object" && !e._promise && function(r, s, i) {
|
|
544
539
|
try {
|
|
545
540
|
r.apply(null, i);
|
|
546
541
|
} catch (o) {
|
|
547
542
|
s && s(o);
|
|
548
543
|
}
|
|
549
544
|
}(() => {
|
|
550
|
-
var r =
|
|
545
|
+
var r = Jt(e, "stack");
|
|
551
546
|
e._promise = t, ee(e, "stack", { get: () => Nt ? r && (r.get ? r.get.apply(e) : r.value) : t.stack });
|
|
552
547
|
}), function(r) {
|
|
553
548
|
de.some((s) => s._value === r._value) || de.push(r);
|
|
554
|
-
}(t),
|
|
549
|
+
}(t), Bn(t), n && Ye();
|
|
555
550
|
}
|
|
556
551
|
}
|
|
557
|
-
function
|
|
552
|
+
function Bn(t) {
|
|
558
553
|
var e = t._listeners;
|
|
559
554
|
t._listeners = [];
|
|
560
555
|
for (var n = 0, r = e.length; n < r; ++n)
|
|
561
|
-
|
|
556
|
+
sn(t, e[n]);
|
|
562
557
|
var s = t._PSD;
|
|
563
|
-
--s.ref || s.finalize(), fe === 0 && (++fe,
|
|
564
|
-
--fe == 0 &&
|
|
558
|
+
--s.ref || s.finalize(), fe === 0 && (++fe, Re(() => {
|
|
559
|
+
--fe == 0 && on();
|
|
565
560
|
}, []));
|
|
566
561
|
}
|
|
567
|
-
function
|
|
562
|
+
function sn(t, e) {
|
|
568
563
|
if (t._state !== null) {
|
|
569
564
|
var n = t._state ? e.onFulfilled : e.onRejected;
|
|
570
565
|
if (n === null)
|
|
571
566
|
return (t._state ? e.resolve : e.reject)(t._value);
|
|
572
|
-
++e.psd.ref, ++fe,
|
|
567
|
+
++e.psd.ref, ++fe, Re(wr, [n, t, e]);
|
|
573
568
|
} else
|
|
574
569
|
t._listeners.push(e);
|
|
575
570
|
}
|
|
576
|
-
function
|
|
571
|
+
function wr(t, e, n) {
|
|
577
572
|
try {
|
|
578
573
|
jt = e;
|
|
579
574
|
var r, s = e._value;
|
|
@@ -585,42 +580,42 @@ function Sr(t, e, n) {
|
|
|
585
580
|
} catch (i) {
|
|
586
581
|
n.reject(i);
|
|
587
582
|
} finally {
|
|
588
|
-
jt = null, --fe == 0 &&
|
|
583
|
+
jt = null, --fe == 0 && on(), --n.psd.ref || n.psd.finalize();
|
|
589
584
|
}
|
|
590
585
|
}
|
|
591
|
-
function
|
|
586
|
+
function Fn(t, e, n) {
|
|
592
587
|
if (e.length === n)
|
|
593
588
|
return e;
|
|
594
589
|
var r = "";
|
|
595
590
|
if (t._state === !1) {
|
|
596
591
|
var s, i, o = t._value;
|
|
597
|
-
o != null ? (s = o.name || "Error", i = o.message || o, r =
|
|
592
|
+
o != null ? (s = o.name || "Error", i = o.message || o, r = At(o, 0)) : (s = o, i = ""), e.push(s + (i ? ": " + i : "") + r);
|
|
598
593
|
}
|
|
599
|
-
return G && ((r =
|
|
594
|
+
return G && ((r = At(t._stackHolder, 2)) && e.indexOf(r) === -1 && e.push(r), t._prev && Fn(t._prev, e, n)), e;
|
|
600
595
|
}
|
|
601
|
-
function
|
|
596
|
+
function Mn(t, e) {
|
|
602
597
|
var n = e ? e._numPrev + 1 : 0;
|
|
603
598
|
n < 100 && (t._prev = e, t._numPrev = n);
|
|
604
599
|
}
|
|
605
|
-
function
|
|
606
|
-
ze() &&
|
|
600
|
+
function He() {
|
|
601
|
+
ze() && Ye();
|
|
607
602
|
}
|
|
608
603
|
function ze() {
|
|
609
|
-
var t =
|
|
610
|
-
return
|
|
604
|
+
var t = Rt;
|
|
605
|
+
return Rt = !1, ht = !1, t;
|
|
611
606
|
}
|
|
612
|
-
function
|
|
607
|
+
function Ye() {
|
|
613
608
|
var t, e, n;
|
|
614
609
|
do
|
|
615
|
-
for (;
|
|
616
|
-
for (t =
|
|
610
|
+
for (; $e.length > 0; )
|
|
611
|
+
for (t = $e, $e = [], n = t.length, e = 0; e < n; ++e) {
|
|
617
612
|
var r = t[e];
|
|
618
613
|
r[0].apply(null, r[1]);
|
|
619
614
|
}
|
|
620
|
-
while (
|
|
621
|
-
|
|
615
|
+
while ($e.length > 0);
|
|
616
|
+
Rt = !0, ht = !0;
|
|
622
617
|
}
|
|
623
|
-
function
|
|
618
|
+
function on() {
|
|
624
619
|
var t = de;
|
|
625
620
|
de = [], t.forEach((r) => {
|
|
626
621
|
r._PSD.onunhandled.call(null, r._value, r);
|
|
@@ -631,21 +626,21 @@ function an() {
|
|
|
631
626
|
function Ge(t) {
|
|
632
627
|
return new S(Me, !1, t);
|
|
633
628
|
}
|
|
634
|
-
function
|
|
635
|
-
var n =
|
|
629
|
+
function N(t, e) {
|
|
630
|
+
var n = E;
|
|
636
631
|
return function() {
|
|
637
|
-
var r = ze(), s =
|
|
632
|
+
var r = ze(), s = E;
|
|
638
633
|
try {
|
|
639
634
|
return ae(n, !0), t.apply(this, arguments);
|
|
640
635
|
} catch (i) {
|
|
641
636
|
e && e(i);
|
|
642
637
|
} finally {
|
|
643
|
-
ae(s, !1), r &&
|
|
638
|
+
ae(s, !1), r && Ye();
|
|
644
639
|
}
|
|
645
640
|
};
|
|
646
641
|
}
|
|
647
|
-
Ce(S.prototype, { then:
|
|
648
|
-
|
|
642
|
+
Ce(S.prototype, { then: Dt, _then: function(t, e) {
|
|
643
|
+
sn(this, new In(null, null, t, e, E));
|
|
649
644
|
}, catch: function(t) {
|
|
650
645
|
if (arguments.length === 1)
|
|
651
646
|
return this.then(null, t);
|
|
@@ -658,7 +653,7 @@ Ce(S.prototype, { then: Bt, _then: function(t, e) {
|
|
|
658
653
|
return this._stack;
|
|
659
654
|
try {
|
|
660
655
|
Nt = !0;
|
|
661
|
-
var t =
|
|
656
|
+
var t = Fn(this, [], 20).join(`
|
|
662
657
|
From previous: `);
|
|
663
658
|
return this._state !== null && (this._stack = t), t;
|
|
664
659
|
} finally {
|
|
@@ -666,10 +661,10 @@ From previous: `);
|
|
|
666
661
|
}
|
|
667
662
|
} }, timeout: function(t, e) {
|
|
668
663
|
return t < 1 / 0 ? new S((n, r) => {
|
|
669
|
-
var s = setTimeout(() => r(new
|
|
664
|
+
var s = setTimeout(() => r(new P.Timeout(e)), t);
|
|
670
665
|
this.then(n, r).finally(clearTimeout.bind(null, s));
|
|
671
666
|
}) : this;
|
|
672
|
-
} }), typeof Symbol < "u" && Symbol.toStringTag && ee(S.prototype, Symbol.toStringTag, "Dexie.Promise"),
|
|
667
|
+
} }), typeof Symbol < "u" && Symbol.toStringTag && ee(S.prototype, Symbol.toStringTag, "Dexie.Promise"), xe.env = qn(), Ce(S, { all: function() {
|
|
673
668
|
var t = J.apply(null, arguments).map(Xe);
|
|
674
669
|
return new S(function(e, n) {
|
|
675
670
|
t.length === 0 && e([]);
|
|
@@ -686,25 +681,25 @@ From previous: `);
|
|
|
686
681
|
t.then(n, r);
|
|
687
682
|
});
|
|
688
683
|
var e = new S(Me, !0, t);
|
|
689
|
-
return
|
|
684
|
+
return Mn(e, jt), e;
|
|
690
685
|
}, reject: Ge, race: function() {
|
|
691
686
|
var t = J.apply(null, arguments).map(Xe);
|
|
692
687
|
return new S((e, n) => {
|
|
693
688
|
t.map((r) => S.resolve(r).then(e, n));
|
|
694
689
|
});
|
|
695
|
-
}, PSD: { get: () =>
|
|
696
|
-
|
|
697
|
-
} }, rejectionMapper: { get: () =>
|
|
698
|
-
|
|
690
|
+
}, PSD: { get: () => E, set: (t) => E = t }, totalEchoes: { get: () => dt }, newPSD: oe, usePSD: Te, scheduler: { get: () => Re, set: (t) => {
|
|
691
|
+
Re = t;
|
|
692
|
+
} }, rejectionMapper: { get: () => It, set: (t) => {
|
|
693
|
+
It = t;
|
|
699
694
|
} }, follow: (t, e) => new S((n, r) => oe((s, i) => {
|
|
700
|
-
var o =
|
|
701
|
-
o.unhandleds = [], o.onunhandled = i, o.finalize =
|
|
702
|
-
(function(
|
|
695
|
+
var o = E;
|
|
696
|
+
o.unhandleds = [], o.onunhandled = i, o.finalize = pe(function() {
|
|
697
|
+
(function(u) {
|
|
703
698
|
function a() {
|
|
704
|
-
|
|
699
|
+
u(), st.splice(st.indexOf(a), 1);
|
|
705
700
|
}
|
|
706
|
-
st.push(a), ++fe,
|
|
707
|
-
--fe == 0 &&
|
|
701
|
+
st.push(a), ++fe, Re(() => {
|
|
702
|
+
--fe == 0 && on();
|
|
708
703
|
}, []);
|
|
709
704
|
})(() => {
|
|
710
705
|
this.unhandleds.length === 0 ? s() : i(this.unhandleds[0]);
|
|
@@ -724,80 +719,80 @@ From previous: `);
|
|
|
724
719
|
t.length === 0 && n(new AggregateError([]));
|
|
725
720
|
let r = t.length;
|
|
726
721
|
const s = new Array(r);
|
|
727
|
-
t.forEach((i, o) => S.resolve(i).then((
|
|
728
|
-
s[o] =
|
|
722
|
+
t.forEach((i, o) => S.resolve(i).then((u) => e(u), (u) => {
|
|
723
|
+
s[o] = u, --r || n(new AggregateError(s));
|
|
729
724
|
}));
|
|
730
725
|
});
|
|
731
726
|
}));
|
|
732
727
|
const F = { awaits: 0, echoes: 0, id: 0 };
|
|
733
|
-
var
|
|
728
|
+
var _r = 0, it = [], wt = 0, dt = 0, kr = 0;
|
|
734
729
|
function oe(t, e, n, r) {
|
|
735
|
-
var s =
|
|
736
|
-
i.parent = s, i.ref = 0, i.global = !1, i.id = ++
|
|
737
|
-
var o =
|
|
738
|
-
i.env =
|
|
730
|
+
var s = E, i = Object.create(s);
|
|
731
|
+
i.parent = s, i.ref = 0, i.global = !1, i.id = ++kr;
|
|
732
|
+
var o = xe.env;
|
|
733
|
+
i.env = rn ? { Promise: S, PromiseProp: { value: S, configurable: !0, writable: !0 }, all: S.all, race: S.race, allSettled: S.allSettled, any: S.any, resolve: S.resolve, reject: S.reject, nthen: dn(o.nthen, i), gthen: dn(o.gthen, i) } : {}, e && U(i, e), ++s.ref, i.finalize = function() {
|
|
739
734
|
--this.parent.ref || this.parent.finalize();
|
|
740
735
|
};
|
|
741
|
-
var
|
|
742
|
-
return i.ref === 0 && i.finalize(),
|
|
736
|
+
var u = Te(i, t, n, r);
|
|
737
|
+
return i.ref === 0 && i.finalize(), u;
|
|
743
738
|
}
|
|
744
|
-
function
|
|
745
|
-
return F.id || (F.id = ++
|
|
739
|
+
function Pe() {
|
|
740
|
+
return F.id || (F.id = ++_r), ++F.awaits, F.echoes += Rn, F.id;
|
|
746
741
|
}
|
|
747
742
|
function ne() {
|
|
748
|
-
return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits *
|
|
743
|
+
return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits * Rn, !0);
|
|
749
744
|
}
|
|
750
745
|
function Xe(t) {
|
|
751
|
-
return F.echoes && t && t.constructor === nt ? (
|
|
746
|
+
return F.echoes && t && t.constructor === nt ? (Pe(), t.then((e) => (ne(), e), (e) => (ne(), D(e)))) : t;
|
|
752
747
|
}
|
|
753
|
-
function
|
|
754
|
-
++dt, F.echoes && --F.echoes != 0 || (F.echoes = F.id = 0), it.push(
|
|
748
|
+
function xr(t) {
|
|
749
|
+
++dt, F.echoes && --F.echoes != 0 || (F.echoes = F.id = 0), it.push(E), ae(t, !0);
|
|
755
750
|
}
|
|
756
|
-
function
|
|
751
|
+
function Sr() {
|
|
757
752
|
var t = it[it.length - 1];
|
|
758
753
|
it.pop(), ae(t, !1);
|
|
759
754
|
}
|
|
760
755
|
function ae(t, e) {
|
|
761
|
-
var n =
|
|
762
|
-
if ((e ? !F.echoes || wt++ && t ===
|
|
763
|
-
var r =
|
|
764
|
-
ct.then = s.nthen, r.prototype.then = s.gthen, (n.global || t.global) && (Object.defineProperty(
|
|
756
|
+
var n = E;
|
|
757
|
+
if ((e ? !F.echoes || wt++ && t === E : !wt || --wt && t === E) || Ln(e ? xr.bind(null, t) : Sr), t !== E && (E = t, n === xe && (xe.env = qn()), rn)) {
|
|
758
|
+
var r = xe.env.Promise, s = t.env;
|
|
759
|
+
ct.then = s.nthen, r.prototype.then = s.gthen, (n.global || t.global) && (Object.defineProperty($, "Promise", s.PromiseProp), r.all = s.all, r.race = s.race, r.resolve = s.resolve, r.reject = s.reject, s.allSettled && (r.allSettled = s.allSettled), s.any && (r.any = s.any));
|
|
765
760
|
}
|
|
766
761
|
}
|
|
767
|
-
function
|
|
768
|
-
var t =
|
|
769
|
-
return
|
|
762
|
+
function qn() {
|
|
763
|
+
var t = $.Promise;
|
|
764
|
+
return rn ? { Promise: t, PromiseProp: Object.getOwnPropertyDescriptor($, "Promise"), all: t.all, race: t.race, allSettled: t.allSettled, any: t.any, resolve: t.resolve, reject: t.reject, nthen: ct.then, gthen: t.prototype.then } : {};
|
|
770
765
|
}
|
|
771
766
|
function Te(t, e, n, r, s) {
|
|
772
|
-
var i =
|
|
767
|
+
var i = E;
|
|
773
768
|
try {
|
|
774
769
|
return ae(t, !0), e(n, r, s);
|
|
775
770
|
} finally {
|
|
776
771
|
ae(i, !1);
|
|
777
772
|
}
|
|
778
773
|
}
|
|
779
|
-
function
|
|
780
|
-
|
|
774
|
+
function Ln(t) {
|
|
775
|
+
jn.call(Kt, t);
|
|
781
776
|
}
|
|
782
777
|
function ft(t, e, n, r) {
|
|
783
778
|
return typeof t != "function" ? t : function() {
|
|
784
|
-
var s =
|
|
785
|
-
n &&
|
|
779
|
+
var s = E;
|
|
780
|
+
n && Pe(), ae(e, !0);
|
|
786
781
|
try {
|
|
787
782
|
return t.apply(this, arguments);
|
|
788
783
|
} finally {
|
|
789
|
-
ae(s, !1), r &&
|
|
784
|
+
ae(s, !1), r && Ln(ne);
|
|
790
785
|
}
|
|
791
786
|
};
|
|
792
787
|
}
|
|
793
|
-
function
|
|
788
|
+
function dn(t, e) {
|
|
794
789
|
return function(n, r) {
|
|
795
790
|
return t.call(this, ft(n, e), ft(r, e));
|
|
796
791
|
};
|
|
797
792
|
}
|
|
798
|
-
("" +
|
|
799
|
-
const
|
|
800
|
-
function
|
|
793
|
+
("" + jn).indexOf("[native code]") === -1 && (Pe = ne = K);
|
|
794
|
+
const fn = "unhandledrejection";
|
|
795
|
+
function pn(t, e) {
|
|
801
796
|
var n;
|
|
802
797
|
try {
|
|
803
798
|
n = e.onuncatched(t);
|
|
@@ -806,9 +801,9 @@ function gn(t, e) {
|
|
|
806
801
|
if (n !== !1)
|
|
807
802
|
try {
|
|
808
803
|
var r, s = { promise: e, reason: t };
|
|
809
|
-
if (
|
|
804
|
+
if ($.document && document.createEvent ? ((r = document.createEvent("Event")).initEvent(fn, !0, !0), U(r, s)) : $.CustomEvent && U(r = new CustomEvent(fn, { detail: s }), s), r && $.dispatchEvent && (dispatchEvent(r), !$.PromiseRejectionEvent && $.onunhandledrejection))
|
|
810
805
|
try {
|
|
811
|
-
|
|
806
|
+
$.onunhandledrejection(r);
|
|
812
807
|
} catch {
|
|
813
808
|
}
|
|
814
809
|
G && r && !r.defaultPrevented && console.warn(`Unhandled rejection: ${t.stack || t}`);
|
|
@@ -816,48 +811,48 @@ function gn(t, e) {
|
|
|
816
811
|
}
|
|
817
812
|
}
|
|
818
813
|
var D = S.reject;
|
|
819
|
-
function
|
|
820
|
-
if (t.idbdb && (t._state.openComplete ||
|
|
814
|
+
function Ft(t, e, n, r) {
|
|
815
|
+
if (t.idbdb && (t._state.openComplete || E.letThrough || t._vip)) {
|
|
821
816
|
var s = t._createTransaction(e, n, t._dbSchema);
|
|
822
817
|
try {
|
|
823
818
|
s.create(), t._state.PR1398_maxLoop = 3;
|
|
824
819
|
} catch (i) {
|
|
825
|
-
return i.name ===
|
|
820
|
+
return i.name === tn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Ft(t, e, n, r))) : D(i);
|
|
826
821
|
}
|
|
827
|
-
return s._promise(e, (i, o) => oe(() => (
|
|
822
|
+
return s._promise(e, (i, o) => oe(() => (E.trans = s, r(i, o, s)))).then((i) => s._completion.then(() => i));
|
|
828
823
|
}
|
|
829
824
|
if (t._state.openComplete)
|
|
830
|
-
return D(new
|
|
825
|
+
return D(new P.DatabaseClosed(t._state.dbOpenError));
|
|
831
826
|
if (!t._state.isBeingOpened) {
|
|
832
827
|
if (!t._options.autoOpen)
|
|
833
|
-
return D(new
|
|
834
|
-
t.open().catch(
|
|
828
|
+
return D(new P.DatabaseClosed());
|
|
829
|
+
t.open().catch(K);
|
|
835
830
|
}
|
|
836
|
-
return t._state.dbReadyPromise.then(() =>
|
|
831
|
+
return t._state.dbReadyPromise.then(() => Ft(t, e, n, r));
|
|
837
832
|
}
|
|
838
|
-
const
|
|
839
|
-
function
|
|
833
|
+
const mn = "3.2.4", he = String.fromCharCode(65535), Mt = -1 / 0, X = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Un = "String expected.", je = [], gt = typeof navigator < "u" && /(MSIE|Trident|Edge)/.test(navigator.userAgent), Cr = gt, Er = gt, Wn = (t) => !/(dexie\.js|dexie\.min\.js)/.test(t), yt = "__dbnames", _t = "readonly", kt = "readwrite";
|
|
834
|
+
function me(t, e) {
|
|
840
835
|
return t ? e ? function() {
|
|
841
836
|
return t.apply(this, arguments) && e.apply(this, arguments);
|
|
842
837
|
} : t : e;
|
|
843
838
|
}
|
|
844
|
-
const
|
|
839
|
+
const Vn = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
|
|
845
840
|
function Qe(t) {
|
|
846
|
-
return typeof t != "string" || /\./.test(t) ? (e) => e : (e) => (e[t] === void 0 && t in e && delete (e =
|
|
841
|
+
return typeof t != "string" || /\./.test(t) ? (e) => e : (e) => (e[t] === void 0 && t in e && delete (e = Ve(e))[t], e);
|
|
847
842
|
}
|
|
848
|
-
class
|
|
843
|
+
class Pr {
|
|
849
844
|
_trans(e, n, r) {
|
|
850
|
-
const s = this._tx ||
|
|
845
|
+
const s = this._tx || E.trans, i = this.name;
|
|
851
846
|
function o(a, c, h) {
|
|
852
847
|
if (!h.schema[i])
|
|
853
|
-
throw new
|
|
848
|
+
throw new P.NotFound("Table " + i + " not part of transaction");
|
|
854
849
|
return n(h.idbtrans, h);
|
|
855
850
|
}
|
|
856
|
-
const
|
|
851
|
+
const u = ze();
|
|
857
852
|
try {
|
|
858
|
-
return s && s.db === this.db ? s ===
|
|
853
|
+
return s && s.db === this.db ? s === E.trans ? s._promise(e, o, r) : oe(() => s._promise(e, o, r), { trans: s, transless: E.transless || E }) : Ft(this.db, e, [this.name], o);
|
|
859
854
|
} finally {
|
|
860
|
-
|
|
855
|
+
u && Ye();
|
|
861
856
|
}
|
|
862
857
|
}
|
|
863
858
|
get(e, n) {
|
|
@@ -868,7 +863,7 @@ class Ir {
|
|
|
868
863
|
return new this.db.WhereClause(this, e);
|
|
869
864
|
if (M(e))
|
|
870
865
|
return new this.db.WhereClause(this, `[${e.join("+")}]`);
|
|
871
|
-
const n =
|
|
866
|
+
const n = I(e);
|
|
872
867
|
if (n.length === 1)
|
|
873
868
|
return this.where(n[0]).equals(e[n[0]]);
|
|
874
869
|
const r = this.schema.indexes.concat(this.schema.primKey).filter((c) => c.compound && n.every((h) => c.keyPath.indexOf(h) >= 0) && c.keyPath.every((h) => n.indexOf(h) >= 0))[0];
|
|
@@ -883,14 +878,14 @@ class Ir {
|
|
|
883
878
|
return !1;
|
|
884
879
|
}
|
|
885
880
|
}
|
|
886
|
-
const [
|
|
887
|
-
const d = s[
|
|
888
|
-
return [c || d, c || !d ?
|
|
889
|
-
const f = te(m,
|
|
881
|
+
const [u, a] = n.reduce(([c, h], l) => {
|
|
882
|
+
const d = s[l], p = e[l];
|
|
883
|
+
return [c || d, c || !d ? me(h, d && d.multi ? (m) => {
|
|
884
|
+
const f = te(m, l);
|
|
890
885
|
return M(f) && f.some((v) => o(p, v));
|
|
891
|
-
} : (m) => o(p, te(m,
|
|
886
|
+
} : (m) => o(p, te(m, l))) : h];
|
|
892
887
|
}, [null, null]);
|
|
893
|
-
return
|
|
888
|
+
return u ? this.where(u.name).equals(e[u.keyPath]).filter(a) : r ? this.filter(a) : this.where(n).equals("");
|
|
894
889
|
}
|
|
895
890
|
filter(e) {
|
|
896
891
|
return this.toCollection().and(e);
|
|
@@ -946,7 +941,7 @@ class Ir {
|
|
|
946
941
|
return s && r && (i = Qe(s)(e)), this._trans("readwrite", (o) => this.core.mutate({ trans: o, type: "add", keys: n != null ? [n] : null, values: [i] })).then((o) => o.numFailures ? S.reject(o.failures[0]) : o.lastResult).then((o) => {
|
|
947
942
|
if (s)
|
|
948
943
|
try {
|
|
949
|
-
|
|
944
|
+
Y(e, s, o);
|
|
950
945
|
} catch {
|
|
951
946
|
}
|
|
952
947
|
return o;
|
|
@@ -958,10 +953,10 @@ class Ir {
|
|
|
958
953
|
{
|
|
959
954
|
const r = te(e, this.schema.primKey.keyPath);
|
|
960
955
|
if (r === void 0)
|
|
961
|
-
return D(new
|
|
956
|
+
return D(new P.InvalidArgument("Given object does not contain its primary key"));
|
|
962
957
|
try {
|
|
963
|
-
typeof n != "function" ?
|
|
964
|
-
|
|
958
|
+
typeof n != "function" ? I(n).forEach((s) => {
|
|
959
|
+
Y(e, s, n[s]);
|
|
965
960
|
}) : n(e, { value: e, primKey: r });
|
|
966
961
|
} catch {
|
|
967
962
|
}
|
|
@@ -974,7 +969,7 @@ class Ir {
|
|
|
974
969
|
return s && r && (i = Qe(s)(e)), this._trans("readwrite", (o) => this.core.mutate({ trans: o, type: "put", values: [i], keys: n != null ? [n] : null })).then((o) => o.numFailures ? S.reject(o.failures[0]) : o.lastResult).then((o) => {
|
|
975
970
|
if (s)
|
|
976
971
|
try {
|
|
977
|
-
|
|
972
|
+
Y(e, s, o);
|
|
978
973
|
} catch {
|
|
979
974
|
}
|
|
980
975
|
return o;
|
|
@@ -984,7 +979,7 @@ class Ir {
|
|
|
984
979
|
return this._trans("readwrite", (n) => this.core.mutate({ trans: n, type: "delete", keys: [e] })).then((n) => n.numFailures ? S.reject(n.failures[0]) : void 0);
|
|
985
980
|
}
|
|
986
981
|
clear() {
|
|
987
|
-
return this._trans("readwrite", (e) => this.core.mutate({ trans: e, type: "deleteRange", range:
|
|
982
|
+
return this._trans("readwrite", (e) => this.core.mutate({ trans: e, type: "deleteRange", range: Vn })).then((e) => e.numFailures ? S.reject(e.failures[0]) : void 0);
|
|
988
983
|
}
|
|
989
984
|
bulkGet(e) {
|
|
990
985
|
return this._trans("readonly", (n) => this.core.getMany({ keys: e, trans: n }).then((r) => r.map((s) => this.hook.reading.fire(s))));
|
|
@@ -992,34 +987,34 @@ class Ir {
|
|
|
992
987
|
bulkAdd(e, n, r) {
|
|
993
988
|
const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
|
|
994
989
|
return this._trans("readwrite", (o) => {
|
|
995
|
-
const { auto:
|
|
990
|
+
const { auto: u, keyPath: a } = this.schema.primKey;
|
|
996
991
|
if (a && s)
|
|
997
|
-
throw new
|
|
992
|
+
throw new P.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
998
993
|
if (s && s.length !== e.length)
|
|
999
|
-
throw new
|
|
994
|
+
throw new P.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1000
995
|
const c = e.length;
|
|
1001
|
-
let h = a &&
|
|
1002
|
-
return this.core.mutate({ trans: o, type: "add", keys: s, values: h, wantResults: i }).then(({ numFailures:
|
|
1003
|
-
if (
|
|
996
|
+
let h = a && u ? e.map(Qe(a)) : e;
|
|
997
|
+
return this.core.mutate({ trans: o, type: "add", keys: s, values: h, wantResults: i }).then(({ numFailures: l, results: d, lastResult: p, failures: m }) => {
|
|
998
|
+
if (l === 0)
|
|
1004
999
|
return i ? d : p;
|
|
1005
|
-
throw new
|
|
1000
|
+
throw new Ne(`${this.name}.bulkAdd(): ${l} of ${c} operations failed`, m);
|
|
1006
1001
|
});
|
|
1007
1002
|
});
|
|
1008
1003
|
}
|
|
1009
1004
|
bulkPut(e, n, r) {
|
|
1010
1005
|
const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
|
|
1011
1006
|
return this._trans("readwrite", (o) => {
|
|
1012
|
-
const { auto:
|
|
1007
|
+
const { auto: u, keyPath: a } = this.schema.primKey;
|
|
1013
1008
|
if (a && s)
|
|
1014
|
-
throw new
|
|
1009
|
+
throw new P.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
1015
1010
|
if (s && s.length !== e.length)
|
|
1016
|
-
throw new
|
|
1011
|
+
throw new P.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1017
1012
|
const c = e.length;
|
|
1018
|
-
let h = a &&
|
|
1019
|
-
return this.core.mutate({ trans: o, type: "put", keys: s, values: h, wantResults: i }).then(({ numFailures:
|
|
1020
|
-
if (
|
|
1013
|
+
let h = a && u ? e.map(Qe(a)) : e;
|
|
1014
|
+
return this.core.mutate({ trans: o, type: "put", keys: s, values: h, wantResults: i }).then(({ numFailures: l, results: d, lastResult: p, failures: m }) => {
|
|
1015
|
+
if (l === 0)
|
|
1021
1016
|
return i ? d : p;
|
|
1022
|
-
throw new
|
|
1017
|
+
throw new Ne(`${this.name}.bulkPut(): ${l} of ${c} operations failed`, m);
|
|
1023
1018
|
});
|
|
1024
1019
|
});
|
|
1025
1020
|
}
|
|
@@ -1028,13 +1023,13 @@ class Ir {
|
|
|
1028
1023
|
return this._trans("readwrite", (r) => this.core.mutate({ trans: r, type: "delete", keys: e })).then(({ numFailures: r, lastResult: s, failures: i }) => {
|
|
1029
1024
|
if (r === 0)
|
|
1030
1025
|
return s;
|
|
1031
|
-
throw new
|
|
1026
|
+
throw new Ne(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`, i);
|
|
1032
1027
|
});
|
|
1033
1028
|
}
|
|
1034
1029
|
}
|
|
1035
|
-
function
|
|
1036
|
-
var e = {}, n = function(o,
|
|
1037
|
-
if (
|
|
1030
|
+
function Ie(t) {
|
|
1031
|
+
var e = {}, n = function(o, u) {
|
|
1032
|
+
if (u) {
|
|
1038
1033
|
for (var a = arguments.length, c = new Array(a - 1); --a; )
|
|
1039
1034
|
c[a - 1] = arguments[a];
|
|
1040
1035
|
return e[o].subscribe.apply(null, c), t;
|
|
@@ -1046,31 +1041,31 @@ function je(t) {
|
|
|
1046
1041
|
for (var r = 1, s = arguments.length; r < s; ++r)
|
|
1047
1042
|
i(arguments[r]);
|
|
1048
1043
|
return n;
|
|
1049
|
-
function i(o,
|
|
1044
|
+
function i(o, u, a) {
|
|
1050
1045
|
if (typeof o != "object") {
|
|
1051
1046
|
var c;
|
|
1052
|
-
|
|
1053
|
-
var h = { subscribers: [], fire: a, subscribe: function(
|
|
1054
|
-
h.subscribers.indexOf(
|
|
1055
|
-
}, unsubscribe: function(
|
|
1047
|
+
u || (u = vr), a || (a = K);
|
|
1048
|
+
var h = { subscribers: [], fire: a, subscribe: function(l) {
|
|
1049
|
+
h.subscribers.indexOf(l) === -1 && (h.subscribers.push(l), h.fire = u(h.fire, l));
|
|
1050
|
+
}, unsubscribe: function(l) {
|
|
1056
1051
|
h.subscribers = h.subscribers.filter(function(d) {
|
|
1057
|
-
return d !==
|
|
1058
|
-
}), h.fire = h.subscribers.reduce(
|
|
1052
|
+
return d !== l;
|
|
1053
|
+
}), h.fire = h.subscribers.reduce(u, a);
|
|
1059
1054
|
} };
|
|
1060
1055
|
return e[o] = n[o] = h, h;
|
|
1061
1056
|
}
|
|
1062
|
-
|
|
1063
|
-
var d = c[
|
|
1057
|
+
I(c = o).forEach(function(l) {
|
|
1058
|
+
var d = c[l];
|
|
1064
1059
|
if (M(d))
|
|
1065
|
-
i(
|
|
1060
|
+
i(l, c[l][0], c[l][1]);
|
|
1066
1061
|
else {
|
|
1067
1062
|
if (d !== "asap")
|
|
1068
|
-
throw new
|
|
1069
|
-
var p = i(
|
|
1063
|
+
throw new P.InvalidArgument("Invalid event config");
|
|
1064
|
+
var p = i(l, Fe, function() {
|
|
1070
1065
|
for (var m = arguments.length, f = new Array(m); m--; )
|
|
1071
1066
|
f[m] = arguments[m];
|
|
1072
1067
|
p.subscribers.forEach(function(v) {
|
|
1073
|
-
|
|
1068
|
+
Cn(function() {
|
|
1074
1069
|
v.apply(null, f);
|
|
1075
1070
|
});
|
|
1076
1071
|
});
|
|
@@ -1079,61 +1074,61 @@ function je(t) {
|
|
|
1079
1074
|
});
|
|
1080
1075
|
}
|
|
1081
1076
|
}
|
|
1082
|
-
function
|
|
1083
|
-
return
|
|
1077
|
+
function Ae(t, e) {
|
|
1078
|
+
return _e(e).from({ prototype: t }), e;
|
|
1084
1079
|
}
|
|
1085
|
-
function
|
|
1080
|
+
function ve(t, e) {
|
|
1086
1081
|
return !(t.filter || t.algorithm || t.or) && (e ? t.justLimit : !t.replayFilter);
|
|
1087
1082
|
}
|
|
1088
1083
|
function xt(t, e) {
|
|
1089
|
-
t.filter =
|
|
1084
|
+
t.filter = me(t.filter, e);
|
|
1090
1085
|
}
|
|
1091
1086
|
function St(t, e, n) {
|
|
1092
1087
|
var r = t.replayFilter;
|
|
1093
|
-
t.replayFilter = r ? () =>
|
|
1088
|
+
t.replayFilter = r ? () => me(r(), e()) : e, t.justLimit = n && !r;
|
|
1094
1089
|
}
|
|
1095
1090
|
function ot(t, e) {
|
|
1096
1091
|
if (t.isPrimKey)
|
|
1097
1092
|
return e.primaryKey;
|
|
1098
1093
|
const n = e.getIndexByKeyPath(t.index);
|
|
1099
1094
|
if (!n)
|
|
1100
|
-
throw new
|
|
1095
|
+
throw new P.Schema("KeyPath " + t.index + " on object store " + e.name + " is not indexed");
|
|
1101
1096
|
return n;
|
|
1102
1097
|
}
|
|
1103
|
-
function
|
|
1098
|
+
function gn(t, e, n) {
|
|
1104
1099
|
const r = ot(t, e.schema);
|
|
1105
1100
|
return e.openCursor({ trans: n, values: !t.keysOnly, reverse: t.dir === "prev", unique: !!t.unique, query: { index: r, range: t.range } });
|
|
1106
1101
|
}
|
|
1107
1102
|
function Je(t, e, n, r) {
|
|
1108
|
-
const s = t.replayFilter ?
|
|
1103
|
+
const s = t.replayFilter ? me(t.filter, t.replayFilter()) : t.filter;
|
|
1109
1104
|
if (t.or) {
|
|
1110
|
-
const i = {}, o = (
|
|
1105
|
+
const i = {}, o = (u, a, c) => {
|
|
1111
1106
|
if (!s || s(a, c, (d) => a.stop(d), (d) => a.fail(d))) {
|
|
1112
|
-
var h = a.primaryKey,
|
|
1113
|
-
|
|
1107
|
+
var h = a.primaryKey, l = "" + h;
|
|
1108
|
+
l === "[object ArrayBuffer]" && (l = "" + new Uint8Array(h)), z(i, l) || (i[l] = !0, e(u, a, c));
|
|
1114
1109
|
}
|
|
1115
1110
|
};
|
|
1116
|
-
return Promise.all([t.or._iterate(o, n),
|
|
1111
|
+
return Promise.all([t.or._iterate(o, n), yn(gn(t, r, n), t.algorithm, o, !t.keysOnly && t.valueMapper)]);
|
|
1117
1112
|
}
|
|
1118
|
-
return
|
|
1113
|
+
return yn(gn(t, r, n), me(t.algorithm, s), e, !t.keysOnly && t.valueMapper);
|
|
1119
1114
|
}
|
|
1120
|
-
function
|
|
1121
|
-
var s =
|
|
1115
|
+
function yn(t, e, n, r) {
|
|
1116
|
+
var s = N(r ? (i, o, u) => n(r(i), o, u) : n);
|
|
1122
1117
|
return t.then((i) => {
|
|
1123
1118
|
if (i)
|
|
1124
1119
|
return i.start(() => {
|
|
1125
1120
|
var o = () => i.continue();
|
|
1126
|
-
e && !e(i, (
|
|
1127
|
-
i.stop(
|
|
1128
|
-
}, (
|
|
1129
|
-
i.fail(
|
|
1130
|
-
}) || s(i.value, i, (
|
|
1121
|
+
e && !e(i, (u) => o = u, (u) => {
|
|
1122
|
+
i.stop(u), o = K;
|
|
1123
|
+
}, (u) => {
|
|
1124
|
+
i.fail(u), o = K;
|
|
1125
|
+
}) || s(i.value, i, (u) => o = u), o();
|
|
1131
1126
|
});
|
|
1132
1127
|
});
|
|
1133
1128
|
}
|
|
1134
1129
|
function L(t, e) {
|
|
1135
1130
|
try {
|
|
1136
|
-
const n =
|
|
1131
|
+
const n = vn(t), r = vn(e);
|
|
1137
1132
|
if (n !== r)
|
|
1138
1133
|
return n === "Array" ? 1 : r === "Array" ? -1 : n === "binary" ? 1 : r === "binary" ? -1 : n === "string" ? 1 : r === "string" ? -1 : n === "Date" ? 1 : r !== "Date" ? NaN : -1;
|
|
1139
1134
|
switch (n) {
|
|
@@ -1143,40 +1138,40 @@ function L(t, e) {
|
|
|
1143
1138
|
return t > e ? 1 : t < e ? -1 : 0;
|
|
1144
1139
|
case "binary":
|
|
1145
1140
|
return function(s, i) {
|
|
1146
|
-
const o = s.length,
|
|
1141
|
+
const o = s.length, u = i.length, a = o < u ? o : u;
|
|
1147
1142
|
for (let c = 0; c < a; ++c)
|
|
1148
1143
|
if (s[c] !== i[c])
|
|
1149
1144
|
return s[c] < i[c] ? -1 : 1;
|
|
1150
|
-
return o ===
|
|
1151
|
-
}(
|
|
1145
|
+
return o === u ? 0 : o < u ? -1 : 1;
|
|
1146
|
+
}(bn(t), bn(e));
|
|
1152
1147
|
case "Array":
|
|
1153
1148
|
return function(s, i) {
|
|
1154
|
-
const o = s.length,
|
|
1149
|
+
const o = s.length, u = i.length, a = o < u ? o : u;
|
|
1155
1150
|
for (let c = 0; c < a; ++c) {
|
|
1156
1151
|
const h = L(s[c], i[c]);
|
|
1157
1152
|
if (h !== 0)
|
|
1158
1153
|
return h;
|
|
1159
1154
|
}
|
|
1160
|
-
return o ===
|
|
1155
|
+
return o === u ? 0 : o < u ? -1 : 1;
|
|
1161
1156
|
}(t, e);
|
|
1162
1157
|
}
|
|
1163
1158
|
} catch {
|
|
1164
1159
|
}
|
|
1165
1160
|
return NaN;
|
|
1166
1161
|
}
|
|
1167
|
-
function
|
|
1162
|
+
function vn(t) {
|
|
1168
1163
|
const e = typeof t;
|
|
1169
1164
|
if (e !== "object")
|
|
1170
1165
|
return e;
|
|
1171
1166
|
if (ArrayBuffer.isView(t))
|
|
1172
1167
|
return "binary";
|
|
1173
|
-
const n =
|
|
1168
|
+
const n = Tt(t);
|
|
1174
1169
|
return n === "ArrayBuffer" ? "binary" : n;
|
|
1175
1170
|
}
|
|
1176
|
-
function
|
|
1171
|
+
function bn(t) {
|
|
1177
1172
|
return t instanceof Uint8Array ? t : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : new Uint8Array(t);
|
|
1178
1173
|
}
|
|
1179
|
-
class
|
|
1174
|
+
class Tr {
|
|
1180
1175
|
_read(e, n) {
|
|
1181
1176
|
var r = this._ctx;
|
|
1182
1177
|
return r.error ? r.table._trans(null, D.bind(null, r.error)) : r.table._trans("readonly", e).then(n);
|
|
@@ -1187,7 +1182,7 @@ class Rr {
|
|
|
1187
1182
|
}
|
|
1188
1183
|
_addAlgorithm(e) {
|
|
1189
1184
|
var n = this._ctx;
|
|
1190
|
-
n.algorithm =
|
|
1185
|
+
n.algorithm = me(n.algorithm, e);
|
|
1191
1186
|
}
|
|
1192
1187
|
_iterate(e, n) {
|
|
1193
1188
|
return Je(this._ctx, e, n, this._ctx.table.core);
|
|
@@ -1206,7 +1201,7 @@ class Rr {
|
|
|
1206
1201
|
count(e) {
|
|
1207
1202
|
return this._read((n) => {
|
|
1208
1203
|
const r = this._ctx, s = r.table.core;
|
|
1209
|
-
if (
|
|
1204
|
+
if (ve(r, !0))
|
|
1210
1205
|
return s.count({ trans: n, query: { index: ot(r, s.schema), range: r.range } }).then((o) => Math.min(o, r.limit));
|
|
1211
1206
|
var i = 0;
|
|
1212
1207
|
return Je(r, () => (++i, !1), n, s).then(() => i);
|
|
@@ -1217,10 +1212,10 @@ class Rr {
|
|
|
1217
1212
|
function o(c, h) {
|
|
1218
1213
|
return h ? o(c[r[h]], h - 1) : c[s];
|
|
1219
1214
|
}
|
|
1220
|
-
var
|
|
1215
|
+
var u = this._ctx.dir === "next" ? 1 : -1;
|
|
1221
1216
|
function a(c, h) {
|
|
1222
|
-
var
|
|
1223
|
-
return
|
|
1217
|
+
var l = o(c, i), d = o(h, i);
|
|
1218
|
+
return l < d ? -u : l > d ? u : 0;
|
|
1224
1219
|
}
|
|
1225
1220
|
return this.toArray(function(c) {
|
|
1226
1221
|
return c.sort(a);
|
|
@@ -1229,7 +1224,7 @@ class Rr {
|
|
|
1229
1224
|
toArray(e) {
|
|
1230
1225
|
return this._read((n) => {
|
|
1231
1226
|
var r = this._ctx;
|
|
1232
|
-
if (r.dir === "next" &&
|
|
1227
|
+
if (r.dir === "next" && ve(r, !0) && r.limit > 0) {
|
|
1233
1228
|
const { valueMapper: s } = r, i = ot(r, r.table.core.schema);
|
|
1234
1229
|
return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: i, range: r.range } }).then(({ result: o }) => s ? o.map(s) : o);
|
|
1235
1230
|
}
|
|
@@ -1241,7 +1236,7 @@ class Rr {
|
|
|
1241
1236
|
}
|
|
1242
1237
|
offset(e) {
|
|
1243
1238
|
var n = this._ctx;
|
|
1244
|
-
return e <= 0 || (n.offset += e,
|
|
1239
|
+
return e <= 0 || (n.offset += e, ve(n) ? St(n, () => {
|
|
1245
1240
|
var r = e;
|
|
1246
1241
|
return (s, i) => r === 0 || (r === 1 ? (--r, !1) : (i(() => {
|
|
1247
1242
|
s.advance(r), r = 0;
|
|
@@ -1276,7 +1271,7 @@ class Rr {
|
|
|
1276
1271
|
var n, r;
|
|
1277
1272
|
return xt(this._ctx, function(s) {
|
|
1278
1273
|
return e(s.value);
|
|
1279
|
-
}), n = this._ctx, r = e, n.isMatch =
|
|
1274
|
+
}), n = this._ctx, r = e, n.isMatch = me(n.isMatch, r), this;
|
|
1280
1275
|
}
|
|
1281
1276
|
and(e) {
|
|
1282
1277
|
return this.filter(e);
|
|
@@ -1317,7 +1312,7 @@ class Rr {
|
|
|
1317
1312
|
}
|
|
1318
1313
|
primaryKeys(e) {
|
|
1319
1314
|
var n = this._ctx;
|
|
1320
|
-
if (n.dir === "next" &&
|
|
1315
|
+
if (n.dir === "next" && ve(n, !0) && n.limit > 0)
|
|
1321
1316
|
return this._read((s) => {
|
|
1322
1317
|
var i = ot(n, n.table.core.schema);
|
|
1323
1318
|
return n.table.core.query({ trans: s, values: !1, limit: n.limit, query: { index: i, range: n.range } });
|
|
@@ -1358,43 +1353,43 @@ class Rr {
|
|
|
1358
1353
|
if (typeof e == "function")
|
|
1359
1354
|
s = e;
|
|
1360
1355
|
else {
|
|
1361
|
-
var i =
|
|
1356
|
+
var i = I(e), o = i.length;
|
|
1362
1357
|
s = function(f) {
|
|
1363
1358
|
for (var v = !1, y = 0; y < o; ++y) {
|
|
1364
1359
|
var g = i[y], b = e[g];
|
|
1365
|
-
te(f, g) !== b && (
|
|
1360
|
+
te(f, g) !== b && (Y(f, g, b), v = !0);
|
|
1366
1361
|
}
|
|
1367
1362
|
return v;
|
|
1368
1363
|
};
|
|
1369
1364
|
}
|
|
1370
|
-
const
|
|
1365
|
+
const u = n.table.core, { outbound: a, extractKey: c } = u.schema.primaryKey, h = this.db._options.modifyChunkSize || 200, l = [];
|
|
1371
1366
|
let d = 0;
|
|
1372
1367
|
const p = [], m = (f, v) => {
|
|
1373
1368
|
const { failures: y, numFailures: g } = v;
|
|
1374
1369
|
d += f - g;
|
|
1375
|
-
for (let b of
|
|
1376
|
-
|
|
1370
|
+
for (let b of I(y))
|
|
1371
|
+
l.push(y[b]);
|
|
1377
1372
|
};
|
|
1378
1373
|
return this.clone().primaryKeys().then((f) => {
|
|
1379
1374
|
const v = (y) => {
|
|
1380
1375
|
const g = Math.min(h, f.length - y);
|
|
1381
|
-
return
|
|
1376
|
+
return u.getMany({ trans: r, keys: f.slice(y, y + g), cache: "immutable" }).then((b) => {
|
|
1382
1377
|
const w = [], C = [], k = a ? [] : null, _ = [];
|
|
1383
1378
|
for (let x = 0; x < g; ++x) {
|
|
1384
|
-
const
|
|
1385
|
-
s.call(
|
|
1379
|
+
const R = b[x], A = { value: Ve(R), primKey: f[y + x] };
|
|
1380
|
+
s.call(A, A.value, A) !== !1 && (A.value == null ? _.push(f[y + x]) : a || L(c(R), c(A.value)) === 0 ? (C.push(A.value), a && k.push(f[y + x])) : (_.push(f[y + x]), w.push(A.value)));
|
|
1386
1381
|
}
|
|
1387
|
-
const
|
|
1388
|
-
return Promise.resolve(w.length > 0 &&
|
|
1389
|
-
for (let
|
|
1390
|
-
_.splice(parseInt(
|
|
1382
|
+
const O = ve(n) && n.limit === 1 / 0 && (typeof e != "function" || e === Ct) && { index: n.index, range: n.range };
|
|
1383
|
+
return Promise.resolve(w.length > 0 && u.mutate({ trans: r, type: "add", values: w }).then((x) => {
|
|
1384
|
+
for (let R in x.failures)
|
|
1385
|
+
_.splice(parseInt(R), 1);
|
|
1391
1386
|
m(w.length, x);
|
|
1392
|
-
})).then(() => (C.length > 0 ||
|
|
1387
|
+
})).then(() => (C.length > 0 || O && typeof e == "object") && u.mutate({ trans: r, type: "put", keys: k, values: C, criteria: O, changeSpec: typeof e != "function" && e }).then((x) => m(C.length, x))).then(() => (_.length > 0 || O && e === Ct) && u.mutate({ trans: r, type: "delete", keys: _, criteria: O }).then((x) => m(_.length, x))).then(() => f.length > y + g && v(y + h));
|
|
1393
1388
|
});
|
|
1394
1389
|
};
|
|
1395
1390
|
return v(0).then(() => {
|
|
1396
|
-
if (
|
|
1397
|
-
throw new
|
|
1391
|
+
if (l.length > 0)
|
|
1392
|
+
throw new lt("Error modifying one or more objects", l, d, p);
|
|
1398
1393
|
return f.length;
|
|
1399
1394
|
});
|
|
1400
1395
|
});
|
|
@@ -1402,62 +1397,62 @@ class Rr {
|
|
|
1402
1397
|
}
|
|
1403
1398
|
delete() {
|
|
1404
1399
|
var e = this._ctx, n = e.range;
|
|
1405
|
-
return
|
|
1400
|
+
return ve(e) && (e.isPrimKey && !Er || n.type === 3) ? this._write((r) => {
|
|
1406
1401
|
const { primaryKey: s } = e.table.core.schema, i = n;
|
|
1407
|
-
return e.table.core.count({ trans: r, query: { index: s, range: i } }).then((o) => e.table.core.mutate({ trans: r, type: "deleteRange", range: i }).then(({ failures:
|
|
1402
|
+
return e.table.core.count({ trans: r, query: { index: s, range: i } }).then((o) => e.table.core.mutate({ trans: r, type: "deleteRange", range: i }).then(({ failures: u, lastResult: a, results: c, numFailures: h }) => {
|
|
1408
1403
|
if (h)
|
|
1409
|
-
throw new
|
|
1404
|
+
throw new lt("Could not delete some values", Object.keys(u).map((l) => u[l]), o - h);
|
|
1410
1405
|
return o - h;
|
|
1411
1406
|
}));
|
|
1412
1407
|
}) : this.modify(Ct);
|
|
1413
1408
|
}
|
|
1414
1409
|
}
|
|
1415
1410
|
const Ct = (t, e) => e.value = null;
|
|
1416
|
-
function
|
|
1411
|
+
function Or(t, e) {
|
|
1417
1412
|
return t < e ? -1 : t === e ? 0 : 1;
|
|
1418
1413
|
}
|
|
1419
|
-
function
|
|
1414
|
+
function Ar(t, e) {
|
|
1420
1415
|
return t > e ? -1 : t === e ? 0 : 1;
|
|
1421
1416
|
}
|
|
1422
|
-
function
|
|
1423
|
-
var r = t instanceof
|
|
1417
|
+
function V(t, e, n) {
|
|
1418
|
+
var r = t instanceof Yn ? new t.Collection(t) : t;
|
|
1424
1419
|
return r._ctx.error = n ? new n(e) : new TypeError(e), r;
|
|
1425
1420
|
}
|
|
1426
|
-
function
|
|
1427
|
-
return new t.Collection(t, () =>
|
|
1421
|
+
function be(t) {
|
|
1422
|
+
return new t.Collection(t, () => zn("")).limit(0);
|
|
1428
1423
|
}
|
|
1429
1424
|
function Kr(t, e, n, r, s, i) {
|
|
1430
|
-
for (var o = Math.min(t.length, r.length),
|
|
1425
|
+
for (var o = Math.min(t.length, r.length), u = -1, a = 0; a < o; ++a) {
|
|
1431
1426
|
var c = e[a];
|
|
1432
1427
|
if (c !== r[a])
|
|
1433
|
-
return s(t[a], n[a]) < 0 ? t.substr(0, a) + n[a] + n.substr(a + 1) : s(t[a], r[a]) < 0 ? t.substr(0, a) + r[a] + n.substr(a + 1) :
|
|
1434
|
-
s(t[a], c) < 0 && (
|
|
1428
|
+
return s(t[a], n[a]) < 0 ? t.substr(0, a) + n[a] + n.substr(a + 1) : s(t[a], r[a]) < 0 ? t.substr(0, a) + r[a] + n.substr(a + 1) : u >= 0 ? t.substr(0, u) + e[u] + n.substr(u + 1) : null;
|
|
1429
|
+
s(t[a], c) < 0 && (u = a);
|
|
1435
1430
|
}
|
|
1436
|
-
return o < r.length && i === "next" ? t + n.substr(t.length) : o < t.length && i === "prev" ? t.substr(0, n.length) :
|
|
1431
|
+
return o < r.length && i === "next" ? t + n.substr(t.length) : o < t.length && i === "prev" ? t.substr(0, n.length) : u < 0 ? null : t.substr(0, u) + r[u] + n.substr(u + 1);
|
|
1437
1432
|
}
|
|
1438
1433
|
function Ze(t, e, n, r) {
|
|
1439
|
-
var s, i, o,
|
|
1434
|
+
var s, i, o, u, a, c, h, l = n.length;
|
|
1440
1435
|
if (!n.every((f) => typeof f == "string"))
|
|
1441
|
-
return
|
|
1436
|
+
return V(t, Un);
|
|
1442
1437
|
function d(f) {
|
|
1443
1438
|
s = function(y) {
|
|
1444
1439
|
return y === "next" ? (g) => g.toUpperCase() : (g) => g.toLowerCase();
|
|
1445
1440
|
}(f), i = function(y) {
|
|
1446
1441
|
return y === "next" ? (g) => g.toLowerCase() : (g) => g.toUpperCase();
|
|
1447
|
-
}(f), o = f === "next" ?
|
|
1442
|
+
}(f), o = f === "next" ? Or : Ar;
|
|
1448
1443
|
var v = n.map(function(y) {
|
|
1449
1444
|
return { lower: i(y), upper: s(y) };
|
|
1450
1445
|
}).sort(function(y, g) {
|
|
1451
1446
|
return o(y.lower, g.lower);
|
|
1452
1447
|
});
|
|
1453
|
-
|
|
1448
|
+
u = v.map(function(y) {
|
|
1454
1449
|
return y.upper;
|
|
1455
1450
|
}), a = v.map(function(y) {
|
|
1456
1451
|
return y.lower;
|
|
1457
1452
|
}), c = f, h = f === "next" ? "" : r;
|
|
1458
1453
|
}
|
|
1459
1454
|
d("next");
|
|
1460
|
-
var p = new t.Collection(t, () => re(
|
|
1455
|
+
var p = new t.Collection(t, () => re(u[0], a[l - 1] + r));
|
|
1461
1456
|
p._ondirectionchange = function(f) {
|
|
1462
1457
|
d(f);
|
|
1463
1458
|
};
|
|
@@ -1469,8 +1464,8 @@ function Ze(t, e, n, r) {
|
|
|
1469
1464
|
var b = i(g);
|
|
1470
1465
|
if (e(b, a, m))
|
|
1471
1466
|
return !0;
|
|
1472
|
-
for (var w = null, C = m; C <
|
|
1473
|
-
var k = Kr(g, b,
|
|
1467
|
+
for (var w = null, C = m; C < l; ++C) {
|
|
1468
|
+
var k = Kr(g, b, u[C], a[C], o, c);
|
|
1474
1469
|
k === null && w === null ? m = C + 1 : (w === null || o(w, k) > 0) && (w = k);
|
|
1475
1470
|
}
|
|
1476
1471
|
return v(w !== null ? function() {
|
|
@@ -1481,38 +1476,38 @@ function Ze(t, e, n, r) {
|
|
|
1481
1476
|
function re(t, e, n, r) {
|
|
1482
1477
|
return { type: 2, lower: t, upper: e, lowerOpen: n, upperOpen: r };
|
|
1483
1478
|
}
|
|
1484
|
-
function
|
|
1479
|
+
function zn(t) {
|
|
1485
1480
|
return { type: 1, lower: t, upper: t };
|
|
1486
1481
|
}
|
|
1487
|
-
class
|
|
1482
|
+
class Yn {
|
|
1488
1483
|
get Collection() {
|
|
1489
1484
|
return this._ctx.table.db.Collection;
|
|
1490
1485
|
}
|
|
1491
1486
|
between(e, n, r, s) {
|
|
1492
1487
|
r = r !== !1, s = s === !0;
|
|
1493
1488
|
try {
|
|
1494
|
-
return this._cmp(e, n) > 0 || this._cmp(e, n) === 0 && (r || s) && (!r || !s) ?
|
|
1489
|
+
return this._cmp(e, n) > 0 || this._cmp(e, n) === 0 && (r || s) && (!r || !s) ? be(this) : new this.Collection(this, () => re(e, n, !r, !s));
|
|
1495
1490
|
} catch {
|
|
1496
|
-
return
|
|
1491
|
+
return V(this, X);
|
|
1497
1492
|
}
|
|
1498
1493
|
}
|
|
1499
1494
|
equals(e) {
|
|
1500
|
-
return e == null ?
|
|
1495
|
+
return e == null ? V(this, X) : new this.Collection(this, () => zn(e));
|
|
1501
1496
|
}
|
|
1502
1497
|
above(e) {
|
|
1503
|
-
return e == null ?
|
|
1498
|
+
return e == null ? V(this, X) : new this.Collection(this, () => re(e, void 0, !0));
|
|
1504
1499
|
}
|
|
1505
1500
|
aboveOrEqual(e) {
|
|
1506
|
-
return e == null ?
|
|
1501
|
+
return e == null ? V(this, X) : new this.Collection(this, () => re(e, void 0, !1));
|
|
1507
1502
|
}
|
|
1508
1503
|
below(e) {
|
|
1509
|
-
return e == null ?
|
|
1504
|
+
return e == null ? V(this, X) : new this.Collection(this, () => re(void 0, e, !1, !0));
|
|
1510
1505
|
}
|
|
1511
1506
|
belowOrEqual(e) {
|
|
1512
|
-
return e == null ?
|
|
1507
|
+
return e == null ? V(this, X) : new this.Collection(this, () => re(void 0, e));
|
|
1513
1508
|
}
|
|
1514
1509
|
startsWith(e) {
|
|
1515
|
-
return typeof e != "string" ?
|
|
1510
|
+
return typeof e != "string" ? V(this, Un) : this.between(e, e + he, !0, !0);
|
|
1516
1511
|
}
|
|
1517
1512
|
startsWithIgnoreCase(e) {
|
|
1518
1513
|
return e === "" ? this.startsWith(e) : Ze(this, (n, r) => n.indexOf(r[0]) === 0, [e], he);
|
|
@@ -1521,63 +1516,63 @@ class Gn {
|
|
|
1521
1516
|
return Ze(this, (n, r) => n === r[0], [e], "");
|
|
1522
1517
|
}
|
|
1523
1518
|
anyOfIgnoreCase() {
|
|
1524
|
-
var e = J.apply(
|
|
1525
|
-
return e.length === 0 ?
|
|
1519
|
+
var e = J.apply(we, arguments);
|
|
1520
|
+
return e.length === 0 ? be(this) : Ze(this, (n, r) => r.indexOf(n) !== -1, e, "");
|
|
1526
1521
|
}
|
|
1527
1522
|
startsWithAnyOfIgnoreCase() {
|
|
1528
|
-
var e = J.apply(
|
|
1529
|
-
return e.length === 0 ?
|
|
1523
|
+
var e = J.apply(we, arguments);
|
|
1524
|
+
return e.length === 0 ? be(this) : Ze(this, (n, r) => r.some((s) => n.indexOf(s) === 0), e, he);
|
|
1530
1525
|
}
|
|
1531
1526
|
anyOf() {
|
|
1532
|
-
const e = J.apply(
|
|
1527
|
+
const e = J.apply(we, arguments);
|
|
1533
1528
|
let n = this._cmp;
|
|
1534
1529
|
try {
|
|
1535
1530
|
e.sort(n);
|
|
1536
1531
|
} catch {
|
|
1537
|
-
return
|
|
1532
|
+
return V(this, X);
|
|
1538
1533
|
}
|
|
1539
1534
|
if (e.length === 0)
|
|
1540
|
-
return
|
|
1535
|
+
return be(this);
|
|
1541
1536
|
const r = new this.Collection(this, () => re(e[0], e[e.length - 1]));
|
|
1542
1537
|
r._ondirectionchange = (i) => {
|
|
1543
1538
|
n = i === "next" ? this._ascending : this._descending, e.sort(n);
|
|
1544
1539
|
};
|
|
1545
1540
|
let s = 0;
|
|
1546
|
-
return r._addAlgorithm((i, o,
|
|
1541
|
+
return r._addAlgorithm((i, o, u) => {
|
|
1547
1542
|
const a = i.key;
|
|
1548
1543
|
for (; n(a, e[s]) > 0; )
|
|
1549
1544
|
if (++s, s === e.length)
|
|
1550
|
-
return o(
|
|
1545
|
+
return o(u), !1;
|
|
1551
1546
|
return n(a, e[s]) === 0 || (o(() => {
|
|
1552
1547
|
i.continue(e[s]);
|
|
1553
1548
|
}), !1);
|
|
1554
1549
|
}), r;
|
|
1555
1550
|
}
|
|
1556
1551
|
notEqual(e) {
|
|
1557
|
-
return this.inAnyRange([[
|
|
1552
|
+
return this.inAnyRange([[Mt, e], [e, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 });
|
|
1558
1553
|
}
|
|
1559
1554
|
noneOf() {
|
|
1560
|
-
const e = J.apply(
|
|
1555
|
+
const e = J.apply(we, arguments);
|
|
1561
1556
|
if (e.length === 0)
|
|
1562
1557
|
return new this.Collection(this);
|
|
1563
1558
|
try {
|
|
1564
1559
|
e.sort(this._ascending);
|
|
1565
1560
|
} catch {
|
|
1566
|
-
return
|
|
1561
|
+
return V(this, X);
|
|
1567
1562
|
}
|
|
1568
|
-
const n = e.reduce((r, s) => r ? r.concat([[r[r.length - 1][1], s]]) : [[
|
|
1563
|
+
const n = e.reduce((r, s) => r ? r.concat([[r[r.length - 1][1], s]]) : [[Mt, s]], null);
|
|
1569
1564
|
return n.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(n, { includeLowers: !1, includeUppers: !1 });
|
|
1570
1565
|
}
|
|
1571
1566
|
inAnyRange(e, n) {
|
|
1572
|
-
const r = this._cmp, s = this._ascending, i = this._descending, o = this._min,
|
|
1567
|
+
const r = this._cmp, s = this._ascending, i = this._descending, o = this._min, u = this._max;
|
|
1573
1568
|
if (e.length === 0)
|
|
1574
|
-
return
|
|
1569
|
+
return be(this);
|
|
1575
1570
|
if (!e.every((g) => g[0] !== void 0 && g[1] !== void 0 && s(g[0], g[1]) <= 0))
|
|
1576
|
-
return
|
|
1571
|
+
return V(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);
|
|
1577
1572
|
const a = !n || n.includeLowers !== !1, c = n && n.includeUppers === !0;
|
|
1578
|
-
let h,
|
|
1573
|
+
let h, l = s;
|
|
1579
1574
|
function d(g, b) {
|
|
1580
|
-
return
|
|
1575
|
+
return l(g[0], b[0]);
|
|
1581
1576
|
}
|
|
1582
1577
|
try {
|
|
1583
1578
|
h = e.reduce(function(g, b) {
|
|
@@ -1585,21 +1580,21 @@ class Gn {
|
|
|
1585
1580
|
for (; w < C; ++w) {
|
|
1586
1581
|
const k = g[w];
|
|
1587
1582
|
if (r(b[0], k[1]) < 0 && r(b[1], k[0]) > 0) {
|
|
1588
|
-
k[0] = o(k[0], b[0]), k[1] =
|
|
1583
|
+
k[0] = o(k[0], b[0]), k[1] = u(k[1], b[1]);
|
|
1589
1584
|
break;
|
|
1590
1585
|
}
|
|
1591
1586
|
}
|
|
1592
1587
|
return w === C && g.push(b), g;
|
|
1593
1588
|
}, []), h.sort(d);
|
|
1594
1589
|
} catch {
|
|
1595
|
-
return
|
|
1590
|
+
return V(this, X);
|
|
1596
1591
|
}
|
|
1597
1592
|
let p = 0;
|
|
1598
1593
|
const m = c ? (g) => s(g, h[p][1]) > 0 : (g) => s(g, h[p][1]) >= 0, f = a ? (g) => i(g, h[p][0]) > 0 : (g) => i(g, h[p][0]) >= 0;
|
|
1599
1594
|
let v = m;
|
|
1600
1595
|
const y = new this.Collection(this, () => re(h[0][0], h[h.length - 1][1], !a, !c));
|
|
1601
1596
|
return y._ondirectionchange = (g) => {
|
|
1602
|
-
g === "next" ? (v = m,
|
|
1597
|
+
g === "next" ? (v = m, l = s) : (v = f, l = i), h.sort(d);
|
|
1603
1598
|
}, y._addAlgorithm((g, b, w) => {
|
|
1604
1599
|
for (var C = g.key; v(C); )
|
|
1605
1600
|
if (++p, p === h.length)
|
|
@@ -1607,31 +1602,31 @@ class Gn {
|
|
|
1607
1602
|
return !!function(k) {
|
|
1608
1603
|
return !m(k) && !f(k);
|
|
1609
1604
|
}(C) || (this._cmp(C, h[p][1]) === 0 || this._cmp(C, h[p][0]) === 0 || b(() => {
|
|
1610
|
-
|
|
1605
|
+
l === s ? g.continue(h[p][0]) : g.continue(h[p][1]);
|
|
1611
1606
|
}), !1);
|
|
1612
1607
|
}), y;
|
|
1613
1608
|
}
|
|
1614
1609
|
startsWithAnyOf() {
|
|
1615
|
-
const e = J.apply(
|
|
1616
|
-
return e.every((n) => typeof n == "string") ? e.length === 0 ?
|
|
1610
|
+
const e = J.apply(we, arguments);
|
|
1611
|
+
return e.every((n) => typeof n == "string") ? e.length === 0 ? be(this) : this.inAnyRange(e.map((n) => [n, n + he])) : V(this, "startsWithAnyOf() only works with strings");
|
|
1617
1612
|
}
|
|
1618
1613
|
}
|
|
1619
|
-
function
|
|
1620
|
-
return
|
|
1614
|
+
function H(t) {
|
|
1615
|
+
return N(function(e) {
|
|
1621
1616
|
return qe(e), t(e.target.error), !1;
|
|
1622
1617
|
});
|
|
1623
1618
|
}
|
|
1624
1619
|
function qe(t) {
|
|
1625
1620
|
t.stopPropagation && t.stopPropagation(), t.preventDefault && t.preventDefault();
|
|
1626
1621
|
}
|
|
1627
|
-
const Le = "storagemutated", ie = "x-storagemutated-1",
|
|
1628
|
-
class
|
|
1622
|
+
const Le = "storagemutated", ie = "x-storagemutated-1", ue = Ie(null, Le);
|
|
1623
|
+
class $r {
|
|
1629
1624
|
_lock() {
|
|
1630
|
-
return
|
|
1625
|
+
return Ke(!E.global), ++this._reculock, this._reculock !== 1 || E.global || (E.lockOwnerFor = this), this;
|
|
1631
1626
|
}
|
|
1632
1627
|
_unlock() {
|
|
1633
|
-
if (
|
|
1634
|
-
for (
|
|
1628
|
+
if (Ke(!E.global), --this._reculock == 0)
|
|
1629
|
+
for (E.global || (E.lockOwnerFor = null); this._blockedFuncs.length > 0 && !this._locked(); ) {
|
|
1635
1630
|
var e = this._blockedFuncs.shift();
|
|
1636
1631
|
try {
|
|
1637
1632
|
Te(e[1], e[0]);
|
|
@@ -1641,54 +1636,54 @@ class jr {
|
|
|
1641
1636
|
return this;
|
|
1642
1637
|
}
|
|
1643
1638
|
_locked() {
|
|
1644
|
-
return this._reculock &&
|
|
1639
|
+
return this._reculock && E.lockOwnerFor !== this;
|
|
1645
1640
|
}
|
|
1646
1641
|
create(e) {
|
|
1647
1642
|
if (!this.mode)
|
|
1648
1643
|
return this;
|
|
1649
1644
|
const n = this.db.idbdb, r = this.db._state.dbOpenError;
|
|
1650
|
-
if (
|
|
1645
|
+
if (Ke(!this.idbtrans), !e && !n)
|
|
1651
1646
|
switch (r && r.name) {
|
|
1652
1647
|
case "DatabaseClosedError":
|
|
1653
|
-
throw new
|
|
1648
|
+
throw new P.DatabaseClosed(r);
|
|
1654
1649
|
case "MissingAPIError":
|
|
1655
|
-
throw new
|
|
1650
|
+
throw new P.MissingAPI(r.message, r);
|
|
1656
1651
|
default:
|
|
1657
|
-
throw new
|
|
1652
|
+
throw new P.OpenFailed(r);
|
|
1658
1653
|
}
|
|
1659
1654
|
if (!this.active)
|
|
1660
|
-
throw new
|
|
1661
|
-
return
|
|
1655
|
+
throw new P.TransactionInactive();
|
|
1656
|
+
return Ke(this._completion._state === null), (e = this.idbtrans = e || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }) : n.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }))).onerror = N((s) => {
|
|
1662
1657
|
qe(s), this._reject(e.error);
|
|
1663
|
-
}), e.onabort =
|
|
1664
|
-
qe(s), this.active && this._reject(new
|
|
1665
|
-
}), e.oncomplete =
|
|
1666
|
-
this.active = !1, this._resolve(), "mutatedParts" in e &&
|
|
1658
|
+
}), e.onabort = N((s) => {
|
|
1659
|
+
qe(s), this.active && this._reject(new P.Abort(e.error)), this.active = !1, this.on("abort").fire(s);
|
|
1660
|
+
}), e.oncomplete = N(() => {
|
|
1661
|
+
this.active = !1, this._resolve(), "mutatedParts" in e && ue.storagemutated.fire(e.mutatedParts);
|
|
1667
1662
|
}), this;
|
|
1668
1663
|
}
|
|
1669
1664
|
_promise(e, n, r) {
|
|
1670
1665
|
if (e === "readwrite" && this.mode !== "readwrite")
|
|
1671
|
-
return D(new
|
|
1666
|
+
return D(new P.ReadOnly("Transaction is readonly"));
|
|
1672
1667
|
if (!this.active)
|
|
1673
|
-
return D(new
|
|
1668
|
+
return D(new P.TransactionInactive());
|
|
1674
1669
|
if (this._locked())
|
|
1675
1670
|
return new S((i, o) => {
|
|
1676
1671
|
this._blockedFuncs.push([() => {
|
|
1677
1672
|
this._promise(e, n, r).then(i, o);
|
|
1678
|
-
},
|
|
1673
|
+
}, E]);
|
|
1679
1674
|
});
|
|
1680
1675
|
if (r)
|
|
1681
1676
|
return oe(() => {
|
|
1682
|
-
var i = new S((o,
|
|
1677
|
+
var i = new S((o, u) => {
|
|
1683
1678
|
this._lock();
|
|
1684
|
-
const a = n(o,
|
|
1685
|
-
a && a.then && a.then(o,
|
|
1679
|
+
const a = n(o, u, this);
|
|
1680
|
+
a && a.then && a.then(o, u);
|
|
1686
1681
|
});
|
|
1687
1682
|
return i.finally(() => this._unlock()), i._lib = !0, i;
|
|
1688
1683
|
});
|
|
1689
1684
|
var s = new S((i, o) => {
|
|
1690
|
-
var
|
|
1691
|
-
|
|
1685
|
+
var u = n(i, o, this);
|
|
1686
|
+
u && u.then && u.then(i, o);
|
|
1692
1687
|
});
|
|
1693
1688
|
return s._lib = !0, s;
|
|
1694
1689
|
}
|
|
@@ -1710,14 +1705,14 @@ class jr {
|
|
|
1710
1705
|
})();
|
|
1711
1706
|
}
|
|
1712
1707
|
var i = n._waitingFor;
|
|
1713
|
-
return new S((o,
|
|
1714
|
-
r.then((a) => n._waitingQueue.push(
|
|
1708
|
+
return new S((o, u) => {
|
|
1709
|
+
r.then((a) => n._waitingQueue.push(N(o.bind(null, a))), (a) => n._waitingQueue.push(N(u.bind(null, a)))).finally(() => {
|
|
1715
1710
|
n._waitingFor === i && (n._waitingFor = null);
|
|
1716
1711
|
});
|
|
1717
1712
|
});
|
|
1718
1713
|
}
|
|
1719
1714
|
abort() {
|
|
1720
|
-
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new
|
|
1715
|
+
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new P.Abort()));
|
|
1721
1716
|
}
|
|
1722
1717
|
table(e) {
|
|
1723
1718
|
const n = this._memoizedTables || (this._memoizedTables = {});
|
|
@@ -1725,19 +1720,19 @@ class jr {
|
|
|
1725
1720
|
return n[e];
|
|
1726
1721
|
const r = this.schema[e];
|
|
1727
1722
|
if (!r)
|
|
1728
|
-
throw new
|
|
1723
|
+
throw new P.NotFound("Table " + e + " not part of transaction");
|
|
1729
1724
|
const s = new this.db.Table(e, r, this);
|
|
1730
1725
|
return s.core = this.db.core.table(e), n[e] = s, s;
|
|
1731
1726
|
}
|
|
1732
1727
|
}
|
|
1733
|
-
function
|
|
1734
|
-
return { name: t, keyPath: e, unique: n, multi: r, auto: s, compound: i, src: (n && !o ? "&" : "") + (r ? "*" : "") + (s ? "++" : "") +
|
|
1728
|
+
function qt(t, e, n, r, s, i, o) {
|
|
1729
|
+
return { name: t, keyPath: e, unique: n, multi: r, auto: s, compound: i, src: (n && !o ? "&" : "") + (r ? "*" : "") + (s ? "++" : "") + Hn(e) };
|
|
1735
1730
|
}
|
|
1736
|
-
function
|
|
1731
|
+
function Hn(t) {
|
|
1737
1732
|
return typeof t == "string" ? t : t ? "[" + [].join.call(t, "+") + "]" : "";
|
|
1738
1733
|
}
|
|
1739
|
-
function
|
|
1740
|
-
return { name: t, primKey: e, indexes: n, mappedClass: null, idxByName:
|
|
1734
|
+
function Gn(t, e, n) {
|
|
1735
|
+
return { name: t, primKey: e, indexes: n, mappedClass: null, idxByName: En(n, (r) => [r.name, r]) };
|
|
1741
1736
|
}
|
|
1742
1737
|
let Ue = (t) => {
|
|
1743
1738
|
try {
|
|
@@ -1746,43 +1741,43 @@ let Ue = (t) => {
|
|
|
1746
1741
|
return Ue = () => he, he;
|
|
1747
1742
|
}
|
|
1748
1743
|
};
|
|
1749
|
-
function
|
|
1744
|
+
function Lt(t) {
|
|
1750
1745
|
return t == null ? () => {
|
|
1751
1746
|
} : typeof t == "string" ? function(e) {
|
|
1752
1747
|
return e.split(".").length === 1 ? (n) => n[e] : (n) => te(n, e);
|
|
1753
1748
|
}(t) : (e) => te(e, t);
|
|
1754
1749
|
}
|
|
1755
|
-
function
|
|
1750
|
+
function wn(t) {
|
|
1756
1751
|
return [].slice.call(t);
|
|
1757
1752
|
}
|
|
1758
|
-
let
|
|
1753
|
+
let Nr = 0;
|
|
1759
1754
|
function De(t) {
|
|
1760
1755
|
return t == null ? ":id" : typeof t == "string" ? t : `[${t.join("+")}]`;
|
|
1761
1756
|
}
|
|
1762
|
-
function
|
|
1757
|
+
function Rr(t, e, n) {
|
|
1763
1758
|
function r(a) {
|
|
1764
1759
|
if (a.type === 3)
|
|
1765
1760
|
return null;
|
|
1766
1761
|
if (a.type === 4)
|
|
1767
1762
|
throw new Error("Cannot convert never type to IDBKeyRange");
|
|
1768
|
-
const { lower: c, upper: h, lowerOpen:
|
|
1769
|
-
return c === void 0 ? h === void 0 ? null : e.upperBound(h, !!d) : h === void 0 ? e.lowerBound(c, !!
|
|
1763
|
+
const { lower: c, upper: h, lowerOpen: l, upperOpen: d } = a;
|
|
1764
|
+
return c === void 0 ? h === void 0 ? null : e.upperBound(h, !!d) : h === void 0 ? e.lowerBound(c, !!l) : e.bound(c, h, !!l, !!d);
|
|
1770
1765
|
}
|
|
1771
1766
|
const { schema: s, hasGetAll: i } = function(a, c) {
|
|
1772
|
-
const h =
|
|
1773
|
-
return { schema: { name: a.name, tables: h.map((
|
|
1774
|
-
const { keyPath: d, autoIncrement: p } =
|
|
1775
|
-
const { name: b, unique: w, multiEntry: C, keyPath: k } = g, _ = { name: b, compound: M(k), keyPath: k, unique: w, multiEntry: C, extractKey:
|
|
1767
|
+
const h = wn(a.objectStoreNames);
|
|
1768
|
+
return { schema: { name: a.name, tables: h.map((l) => c.objectStore(l)).map((l) => {
|
|
1769
|
+
const { keyPath: d, autoIncrement: p } = l, m = M(d), f = d == null, v = {}, y = { name: l.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: f, compound: m, keyPath: d, autoIncrement: p, unique: !0, extractKey: Lt(d) }, indexes: wn(l.indexNames).map((g) => l.index(g)).map((g) => {
|
|
1770
|
+
const { name: b, unique: w, multiEntry: C, keyPath: k } = g, _ = { name: b, compound: M(k), keyPath: k, unique: w, multiEntry: C, extractKey: Lt(k) };
|
|
1776
1771
|
return v[De(k)] = _, _;
|
|
1777
1772
|
}), getIndexByKeyPath: (g) => v[De(g)] };
|
|
1778
1773
|
return v[":id"] = y.primaryKey, d != null && (v[De(d)] = y.primaryKey), y;
|
|
1779
1774
|
}) }, hasGetAll: h.length > 0 && "getAll" in c.objectStore(h[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) };
|
|
1780
1775
|
}(t, n), o = s.tables.map((a) => function(c) {
|
|
1781
1776
|
const h = c.name;
|
|
1782
|
-
return { name: h, schema: c, mutate: function({ trans:
|
|
1777
|
+
return { name: h, schema: c, mutate: function({ trans: l, type: d, keys: p, values: m, range: f }) {
|
|
1783
1778
|
return new Promise((v, y) => {
|
|
1784
|
-
v =
|
|
1785
|
-
const g =
|
|
1779
|
+
v = N(v);
|
|
1780
|
+
const g = l.objectStore(h), b = g.keyPath == null, w = d === "put" || d === "add";
|
|
1786
1781
|
if (!w && d !== "delete" && d !== "deleteRange")
|
|
1787
1782
|
throw new Error("Invalid operation type: " + d);
|
|
1788
1783
|
const { length: C } = p || m || { length: 1 };
|
|
@@ -1791,127 +1786,127 @@ function Br(t, e, n) {
|
|
|
1791
1786
|
if (C === 0)
|
|
1792
1787
|
return v({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
1793
1788
|
let k;
|
|
1794
|
-
const _ = [],
|
|
1789
|
+
const _ = [], O = [];
|
|
1795
1790
|
let x = 0;
|
|
1796
|
-
const
|
|
1791
|
+
const R = (q) => {
|
|
1797
1792
|
++x, qe(q);
|
|
1798
1793
|
};
|
|
1799
1794
|
if (d === "deleteRange") {
|
|
1800
1795
|
if (f.type === 4)
|
|
1801
|
-
return v({ numFailures: x, failures:
|
|
1796
|
+
return v({ numFailures: x, failures: O, results: [], lastResult: void 0 });
|
|
1802
1797
|
f.type === 3 ? _.push(k = g.clear()) : _.push(k = g.delete(r(f)));
|
|
1803
1798
|
} else {
|
|
1804
1799
|
const [q, B] = w ? b ? [m, p] : [m, null] : [p, null];
|
|
1805
1800
|
if (w)
|
|
1806
|
-
for (let
|
|
1807
|
-
_.push(k = B && B[
|
|
1801
|
+
for (let j = 0; j < C; ++j)
|
|
1802
|
+
_.push(k = B && B[j] !== void 0 ? g[d](q[j], B[j]) : g[d](q[j])), k.onerror = R;
|
|
1808
1803
|
else
|
|
1809
|
-
for (let
|
|
1810
|
-
_.push(k = g[d](q[
|
|
1804
|
+
for (let j = 0; j < C; ++j)
|
|
1805
|
+
_.push(k = g[d](q[j])), k.onerror = R;
|
|
1811
1806
|
}
|
|
1812
|
-
const
|
|
1807
|
+
const A = (q) => {
|
|
1813
1808
|
const B = q.target.result;
|
|
1814
|
-
_.forEach((
|
|
1809
|
+
_.forEach((j, ge) => j.error != null && (O[ge] = j.error)), v({ numFailures: x, failures: O, results: d === "delete" ? p : _.map((j) => j.result), lastResult: B });
|
|
1815
1810
|
};
|
|
1816
1811
|
k.onerror = (q) => {
|
|
1817
|
-
|
|
1818
|
-
}, k.onsuccess =
|
|
1812
|
+
R(q), A(q);
|
|
1813
|
+
}, k.onsuccess = A;
|
|
1819
1814
|
});
|
|
1820
|
-
}, getMany: ({ trans:
|
|
1821
|
-
p =
|
|
1822
|
-
const f =
|
|
1815
|
+
}, getMany: ({ trans: l, keys: d }) => new Promise((p, m) => {
|
|
1816
|
+
p = N(p);
|
|
1817
|
+
const f = l.objectStore(h), v = d.length, y = new Array(v);
|
|
1823
1818
|
let g, b = 0, w = 0;
|
|
1824
1819
|
const C = (_) => {
|
|
1825
|
-
const
|
|
1826
|
-
y[
|
|
1827
|
-
}, k =
|
|
1820
|
+
const O = _.target;
|
|
1821
|
+
y[O._pos] = O.result, ++w === b && p(y);
|
|
1822
|
+
}, k = H(m);
|
|
1828
1823
|
for (let _ = 0; _ < v; ++_)
|
|
1829
1824
|
d[_] != null && (g = f.get(d[_]), g._pos = _, g.onsuccess = C, g.onerror = k, ++b);
|
|
1830
1825
|
b === 0 && p(y);
|
|
1831
|
-
}), get: ({ trans:
|
|
1832
|
-
p =
|
|
1833
|
-
const f =
|
|
1834
|
-
f.onsuccess = (v) => p(v.target.result), f.onerror =
|
|
1835
|
-
}), query: function(
|
|
1826
|
+
}), get: ({ trans: l, key: d }) => new Promise((p, m) => {
|
|
1827
|
+
p = N(p);
|
|
1828
|
+
const f = l.objectStore(h).get(d);
|
|
1829
|
+
f.onsuccess = (v) => p(v.target.result), f.onerror = H(m);
|
|
1830
|
+
}), query: function(l) {
|
|
1836
1831
|
return (d) => new Promise((p, m) => {
|
|
1837
|
-
p =
|
|
1838
|
-
const { trans: f, values: v, limit: y, query: g } = d, b = y === 1 / 0 ? void 0 : y, { index: w, range: C } = g, k = f.objectStore(h), _ = w.isPrimaryKey ? k : k.index(w.name),
|
|
1832
|
+
p = N(p);
|
|
1833
|
+
const { trans: f, values: v, limit: y, query: g } = d, b = y === 1 / 0 ? void 0 : y, { index: w, range: C } = g, k = f.objectStore(h), _ = w.isPrimaryKey ? k : k.index(w.name), O = r(C);
|
|
1839
1834
|
if (y === 0)
|
|
1840
1835
|
return p({ result: [] });
|
|
1841
|
-
if (
|
|
1842
|
-
const x = v ? _.getAll(
|
|
1843
|
-
x.onsuccess = (
|
|
1836
|
+
if (l) {
|
|
1837
|
+
const x = v ? _.getAll(O, b) : _.getAllKeys(O, b);
|
|
1838
|
+
x.onsuccess = (R) => p({ result: R.target.result }), x.onerror = H(m);
|
|
1844
1839
|
} else {
|
|
1845
1840
|
let x = 0;
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1848
|
-
const B =
|
|
1849
|
-
return B ? (
|
|
1850
|
-
},
|
|
1841
|
+
const R = v || !("openKeyCursor" in _) ? _.openCursor(O) : _.openKeyCursor(O), A = [];
|
|
1842
|
+
R.onsuccess = (q) => {
|
|
1843
|
+
const B = R.result;
|
|
1844
|
+
return B ? (A.push(v ? B.value : B.primaryKey), ++x === y ? p({ result: A }) : void B.continue()) : p({ result: A });
|
|
1845
|
+
}, R.onerror = H(m);
|
|
1851
1846
|
}
|
|
1852
1847
|
});
|
|
1853
|
-
}(i), openCursor: function({ trans:
|
|
1848
|
+
}(i), openCursor: function({ trans: l, values: d, query: p, reverse: m, unique: f }) {
|
|
1854
1849
|
return new Promise((v, y) => {
|
|
1855
|
-
v =
|
|
1856
|
-
const { index: g, range: b } = p, w =
|
|
1857
|
-
_.onerror =
|
|
1850
|
+
v = N(v);
|
|
1851
|
+
const { index: g, range: b } = p, w = l.objectStore(h), C = g.isPrimaryKey ? w : w.index(g.name), k = m ? f ? "prevunique" : "prev" : f ? "nextunique" : "next", _ = d || !("openKeyCursor" in C) ? C.openCursor(r(b), k) : C.openKeyCursor(r(b), k);
|
|
1852
|
+
_.onerror = H(y), _.onsuccess = N((O) => {
|
|
1858
1853
|
const x = _.result;
|
|
1859
1854
|
if (!x)
|
|
1860
1855
|
return void v(null);
|
|
1861
|
-
x.___id = ++
|
|
1862
|
-
const
|
|
1863
|
-
let
|
|
1864
|
-
|
|
1856
|
+
x.___id = ++Nr, x.done = !1;
|
|
1857
|
+
const R = x.continue.bind(x);
|
|
1858
|
+
let A = x.continuePrimaryKey;
|
|
1859
|
+
A && (A = A.bind(x));
|
|
1865
1860
|
const q = x.advance.bind(x), B = () => {
|
|
1866
1861
|
throw new Error("Cursor not stopped");
|
|
1867
1862
|
};
|
|
1868
|
-
x.trans =
|
|
1863
|
+
x.trans = l, x.stop = x.continue = x.continuePrimaryKey = x.advance = () => {
|
|
1869
1864
|
throw new Error("Cursor not started");
|
|
1870
|
-
}, x.fail =
|
|
1871
|
-
let
|
|
1872
|
-
return this.start(() =>
|
|
1873
|
-
}, x.start = (
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1876
|
-
x.stop = x.continue = x.continuePrimaryKey = x.advance = B,
|
|
1865
|
+
}, x.fail = N(y), x.next = function() {
|
|
1866
|
+
let j = 1;
|
|
1867
|
+
return this.start(() => j-- ? this.continue() : this.stop()).then(() => this);
|
|
1868
|
+
}, x.start = (j) => {
|
|
1869
|
+
const ge = new Promise((W, le) => {
|
|
1870
|
+
W = N(W), _.onerror = H(le), x.fail = le, x.stop = (Oe) => {
|
|
1871
|
+
x.stop = x.continue = x.continuePrimaryKey = x.advance = B, W(Oe);
|
|
1877
1872
|
};
|
|
1878
|
-
}),
|
|
1873
|
+
}), ye = () => {
|
|
1879
1874
|
if (_.result)
|
|
1880
1875
|
try {
|
|
1881
|
-
|
|
1882
|
-
} catch (
|
|
1883
|
-
x.fail(
|
|
1876
|
+
j();
|
|
1877
|
+
} catch (W) {
|
|
1878
|
+
x.fail(W);
|
|
1884
1879
|
}
|
|
1885
1880
|
else
|
|
1886
1881
|
x.done = !0, x.start = () => {
|
|
1887
1882
|
throw new Error("Cursor behind last entry");
|
|
1888
1883
|
}, x.stop();
|
|
1889
1884
|
};
|
|
1890
|
-
return _.onsuccess =
|
|
1891
|
-
_.onsuccess =
|
|
1892
|
-
}), x.continue =
|
|
1885
|
+
return _.onsuccess = N((W) => {
|
|
1886
|
+
_.onsuccess = ye, ye();
|
|
1887
|
+
}), x.continue = R, x.continuePrimaryKey = A, x.advance = q, ye(), ge;
|
|
1893
1888
|
}, v(x);
|
|
1894
1889
|
}, y);
|
|
1895
1890
|
});
|
|
1896
|
-
}, count({ query:
|
|
1897
|
-
const { index: p, range: m } =
|
|
1891
|
+
}, count({ query: l, trans: d }) {
|
|
1892
|
+
const { index: p, range: m } = l;
|
|
1898
1893
|
return new Promise((f, v) => {
|
|
1899
1894
|
const y = d.objectStore(h), g = p.isPrimaryKey ? y : y.index(p.name), b = r(m), w = b ? g.count(b) : g.count();
|
|
1900
|
-
w.onsuccess =
|
|
1895
|
+
w.onsuccess = N((C) => f(C.target.result)), w.onerror = H(v);
|
|
1901
1896
|
});
|
|
1902
1897
|
} };
|
|
1903
|
-
}(a)),
|
|
1904
|
-
return o.forEach((a) =>
|
|
1905
|
-
if (!
|
|
1898
|
+
}(a)), u = {};
|
|
1899
|
+
return o.forEach((a) => u[a.name] = a), { stack: "dbcore", transaction: t.transaction.bind(t), table(a) {
|
|
1900
|
+
if (!u[a])
|
|
1906
1901
|
throw new Error(`Table '${a}' not found`);
|
|
1907
|
-
return
|
|
1902
|
+
return u[a];
|
|
1908
1903
|
}, MIN_KEY: -1 / 0, MAX_KEY: Ue(e), schema: s };
|
|
1909
1904
|
}
|
|
1910
|
-
function
|
|
1911
|
-
const n = e.db, r = function(s, i, { IDBKeyRange: o, indexedDB:
|
|
1905
|
+
function Ut({ _novip: t }, e) {
|
|
1906
|
+
const n = e.db, r = function(s, i, { IDBKeyRange: o, indexedDB: u }, a) {
|
|
1912
1907
|
return { dbcore: function(c, h) {
|
|
1913
|
-
return h.reduce((
|
|
1914
|
-
}(
|
|
1908
|
+
return h.reduce((l, { create: d }) => ({ ...l, ...d(l) }), c);
|
|
1909
|
+
}(Rr(i, o, a), s.dbcore) };
|
|
1915
1910
|
}(t._middlewares, n, t._deps, e);
|
|
1916
1911
|
t.core = r.dbcore, t.tables.forEach((s) => {
|
|
1917
1912
|
const i = s.name;
|
|
@@ -1922,11 +1917,11 @@ function pt({ _novip: t }, e, n, r) {
|
|
|
1922
1917
|
n.forEach((s) => {
|
|
1923
1918
|
const i = r[s];
|
|
1924
1919
|
e.forEach((o) => {
|
|
1925
|
-
const
|
|
1926
|
-
(!
|
|
1920
|
+
const u = Jt(o, s);
|
|
1921
|
+
(!u || "value" in u && u.value === void 0) && (o === t.Transaction.prototype || o instanceof t.Transaction ? ee(o, s, { get() {
|
|
1927
1922
|
return this.table(s);
|
|
1928
1923
|
}, set(a) {
|
|
1929
|
-
|
|
1924
|
+
xn(this, s, { value: a, writable: !0, configurable: !0, enumerable: !0 });
|
|
1930
1925
|
} }) : o[s] = new t.Table(s, i));
|
|
1931
1926
|
});
|
|
1932
1927
|
});
|
|
@@ -1937,19 +1932,19 @@ function Wt({ _novip: t }, e) {
|
|
|
1937
1932
|
n[r] instanceof t.Table && delete n[r];
|
|
1938
1933
|
});
|
|
1939
1934
|
}
|
|
1940
|
-
function
|
|
1935
|
+
function jr(t, e) {
|
|
1941
1936
|
return t._cfg.version - e._cfg.version;
|
|
1942
1937
|
}
|
|
1943
|
-
function
|
|
1938
|
+
function Ir(t, e, n, r) {
|
|
1944
1939
|
const s = t._dbSchema, i = t._createTransaction("readwrite", t._storeNames, s);
|
|
1945
1940
|
i.create(n), i._completion.catch(r);
|
|
1946
|
-
const o = i._reject.bind(i),
|
|
1941
|
+
const o = i._reject.bind(i), u = E.transless || E;
|
|
1947
1942
|
oe(() => {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
}),
|
|
1943
|
+
E.trans = i, E.transless = u, e === 0 ? (I(s).forEach((a) => {
|
|
1944
|
+
Et(n, a, s[a].primKey, s[a].indexes);
|
|
1945
|
+
}), Ut(t, n), S.follow(() => t.on.populate.fire(i)).catch(o)) : function({ _novip: a }, c, h, l) {
|
|
1951
1946
|
const d = [], p = a._versions;
|
|
1952
|
-
let m = a._dbSchema =
|
|
1947
|
+
let m = a._dbSchema = zt(a, a.idbdb, l), f = !1;
|
|
1953
1948
|
const v = p.filter((g) => g._cfg.version >= c);
|
|
1954
1949
|
function y() {
|
|
1955
1950
|
return d.length ? S.resolve(d.shift()(h.idbtrans)).then(y) : S.resolve();
|
|
@@ -1957,53 +1952,53 @@ function Mr(t, e, n, r) {
|
|
|
1957
1952
|
return v.forEach((g) => {
|
|
1958
1953
|
d.push(() => {
|
|
1959
1954
|
const b = m, w = g._cfg.dbschema;
|
|
1960
|
-
Yt(a, b,
|
|
1961
|
-
const C =
|
|
1955
|
+
Yt(a, b, l), Yt(a, w, l), m = a._dbSchema = w;
|
|
1956
|
+
const C = Xn(b, w);
|
|
1962
1957
|
C.add.forEach((_) => {
|
|
1963
|
-
|
|
1958
|
+
Et(l, _[0], _[1].primKey, _[1].indexes);
|
|
1964
1959
|
}), C.change.forEach((_) => {
|
|
1965
1960
|
if (_.recreate)
|
|
1966
|
-
throw new
|
|
1961
|
+
throw new P.Upgrade("Not yet support for changing primary key");
|
|
1967
1962
|
{
|
|
1968
|
-
const
|
|
1969
|
-
_.add.forEach((x) =>
|
|
1970
|
-
|
|
1971
|
-
}), _.del.forEach((x) =>
|
|
1963
|
+
const O = l.objectStore(_.name);
|
|
1964
|
+
_.add.forEach((x) => Vt(O, x)), _.change.forEach((x) => {
|
|
1965
|
+
O.deleteIndex(x.name), Vt(O, x);
|
|
1966
|
+
}), _.del.forEach((x) => O.deleteIndex(x));
|
|
1972
1967
|
}
|
|
1973
1968
|
});
|
|
1974
1969
|
const k = g._cfg.contentUpgrade;
|
|
1975
1970
|
if (k && g._cfg.version > c) {
|
|
1976
|
-
|
|
1977
|
-
let _ =
|
|
1978
|
-
C.del.forEach((
|
|
1979
|
-
_[
|
|
1980
|
-
}), Wt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype],
|
|
1981
|
-
const
|
|
1971
|
+
Ut(a, l), h._memoizedTables = {}, f = !0;
|
|
1972
|
+
let _ = Pn(w);
|
|
1973
|
+
C.del.forEach((A) => {
|
|
1974
|
+
_[A] = b[A];
|
|
1975
|
+
}), Wt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], I(_), _), h.schema = _;
|
|
1976
|
+
const O = Zt(k);
|
|
1982
1977
|
let x;
|
|
1983
|
-
|
|
1984
|
-
const
|
|
1985
|
-
if (x = k(h), x &&
|
|
1986
|
-
var
|
|
1987
|
-
x.then(
|
|
1978
|
+
O && Pe();
|
|
1979
|
+
const R = S.follow(() => {
|
|
1980
|
+
if (x = k(h), x && O) {
|
|
1981
|
+
var A = ne.bind(null, null);
|
|
1982
|
+
x.then(A, A);
|
|
1988
1983
|
}
|
|
1989
1984
|
});
|
|
1990
|
-
return x && typeof x.then == "function" ? S.resolve(x) :
|
|
1985
|
+
return x && typeof x.then == "function" ? S.resolve(x) : R.then(() => x);
|
|
1991
1986
|
}
|
|
1992
1987
|
}), d.push((b) => {
|
|
1993
|
-
(!f || !
|
|
1988
|
+
(!f || !Cr) && function(w, C) {
|
|
1994
1989
|
[].slice.call(C.db.objectStoreNames).forEach((k) => w[k] == null && C.db.deleteObjectStore(k));
|
|
1995
1990
|
}(g._cfg.dbschema, b), Wt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], a._storeNames, a._dbSchema), h.schema = a._dbSchema;
|
|
1996
1991
|
});
|
|
1997
1992
|
}), y().then(() => {
|
|
1998
1993
|
var g, b;
|
|
1999
|
-
b =
|
|
2000
|
-
b.db.objectStoreNames.contains(w) ||
|
|
1994
|
+
b = l, I(g = m).forEach((w) => {
|
|
1995
|
+
b.db.objectStoreNames.contains(w) || Et(b, w, g[w].primKey, g[w].indexes);
|
|
2001
1996
|
});
|
|
2002
1997
|
});
|
|
2003
1998
|
}(t, e, i, n).catch(o);
|
|
2004
1999
|
});
|
|
2005
2000
|
}
|
|
2006
|
-
function
|
|
2001
|
+
function Xn(t, e) {
|
|
2007
2002
|
const n = { del: [], add: [], change: [] };
|
|
2008
2003
|
let r;
|
|
2009
2004
|
for (r in t)
|
|
@@ -2015,13 +2010,13 @@ function Jn(t, e) {
|
|
|
2015
2010
|
if ("" + (s.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || s.primKey.auto !== i.primKey.auto && !gt)
|
|
2016
2011
|
o.recreate = !0, n.change.push(o);
|
|
2017
2012
|
else {
|
|
2018
|
-
const
|
|
2013
|
+
const u = s.idxByName, a = i.idxByName;
|
|
2019
2014
|
let c;
|
|
2020
|
-
for (c in
|
|
2015
|
+
for (c in u)
|
|
2021
2016
|
a[c] || o.del.push(c);
|
|
2022
2017
|
for (c in a) {
|
|
2023
|
-
const h =
|
|
2024
|
-
h ? h.src !==
|
|
2018
|
+
const h = u[c], l = a[c];
|
|
2019
|
+
h ? h.src !== l.src && o.change.push(l) : o.add.push(l);
|
|
2025
2020
|
}
|
|
2026
2021
|
(o.del.length > 0 || o.add.length > 0 || o.change.length > 0) && n.change.push(o);
|
|
2027
2022
|
}
|
|
@@ -2030,26 +2025,26 @@ function Jn(t, e) {
|
|
|
2030
2025
|
}
|
|
2031
2026
|
return n;
|
|
2032
2027
|
}
|
|
2033
|
-
function
|
|
2028
|
+
function Et(t, e, n, r) {
|
|
2034
2029
|
const s = t.db.createObjectStore(e, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
|
|
2035
|
-
return r.forEach((i) =>
|
|
2030
|
+
return r.forEach((i) => Vt(s, i)), s;
|
|
2036
2031
|
}
|
|
2037
|
-
function
|
|
2032
|
+
function Vt(t, e) {
|
|
2038
2033
|
t.createIndex(e.name, e.keyPath, { unique: e.unique, multiEntry: e.multi });
|
|
2039
2034
|
}
|
|
2040
|
-
function
|
|
2035
|
+
function zt(t, e, n) {
|
|
2041
2036
|
const r = {};
|
|
2042
|
-
return
|
|
2037
|
+
return ut(e.objectStoreNames, 0).forEach((s) => {
|
|
2043
2038
|
const i = n.objectStore(s);
|
|
2044
2039
|
let o = i.keyPath;
|
|
2045
|
-
const
|
|
2040
|
+
const u = qt(Hn(o), o || "", !1, !1, !!i.autoIncrement, o && typeof o != "string", !0), a = [];
|
|
2046
2041
|
for (let h = 0; h < i.indexNames.length; ++h) {
|
|
2047
|
-
const
|
|
2048
|
-
o =
|
|
2049
|
-
var c =
|
|
2042
|
+
const l = i.index(i.indexNames[h]);
|
|
2043
|
+
o = l.keyPath;
|
|
2044
|
+
var c = qt(l.name, o, !!l.unique, !!l.multiEntry, !1, o && typeof o != "string", !1);
|
|
2050
2045
|
a.push(c);
|
|
2051
2046
|
}
|
|
2052
|
-
r[s] =
|
|
2047
|
+
r[s] = Gn(s, u, a);
|
|
2053
2048
|
}), r;
|
|
2054
2049
|
}
|
|
2055
2050
|
function Yt({ _novip: t }, e, n) {
|
|
@@ -2057,32 +2052,32 @@ function Yt({ _novip: t }, e, n) {
|
|
|
2057
2052
|
for (let s = 0; s < r.length; ++s) {
|
|
2058
2053
|
const i = r[s], o = n.objectStore(i);
|
|
2059
2054
|
t._hasGetAll = "getAll" in o;
|
|
2060
|
-
for (let
|
|
2061
|
-
const a = o.indexNames[
|
|
2055
|
+
for (let u = 0; u < o.indexNames.length; ++u) {
|
|
2056
|
+
const a = o.indexNames[u], c = o.index(a).keyPath, h = typeof c == "string" ? c : "[" + ut(c).join("+") + "]";
|
|
2062
2057
|
if (e[i]) {
|
|
2063
|
-
const
|
|
2064
|
-
|
|
2058
|
+
const l = e[i].idxByName[h];
|
|
2059
|
+
l && (l.name = a, delete e[i].idxByName[h], e[i].idxByName[a] = l);
|
|
2065
2060
|
}
|
|
2066
2061
|
}
|
|
2067
2062
|
}
|
|
2068
|
-
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) &&
|
|
2063
|
+
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && $.WorkerGlobalScope && $ instanceof $.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (t._hasGetAll = !1);
|
|
2069
2064
|
}
|
|
2070
|
-
class
|
|
2065
|
+
class Dr {
|
|
2071
2066
|
_parseStoresSpec(e, n) {
|
|
2072
|
-
|
|
2067
|
+
I(e).forEach((r) => {
|
|
2073
2068
|
if (e[r] !== null) {
|
|
2074
|
-
var s = e[r].split(",").map((o,
|
|
2069
|
+
var s = e[r].split(",").map((o, u) => {
|
|
2075
2070
|
const a = (o = o.trim()).replace(/([&*]|\+\+)/g, ""), c = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
2076
|
-
return
|
|
2071
|
+
return qt(a, c || null, /\&/.test(o), /\*/.test(o), /\+\+/.test(o), M(c), u === 0);
|
|
2077
2072
|
}), i = s.shift();
|
|
2078
2073
|
if (i.multi)
|
|
2079
|
-
throw new
|
|
2074
|
+
throw new P.Schema("Primary key cannot be multi-valued");
|
|
2080
2075
|
s.forEach((o) => {
|
|
2081
2076
|
if (o.auto)
|
|
2082
|
-
throw new
|
|
2077
|
+
throw new P.Schema("Only primary key can be marked as autoIncrement (++)");
|
|
2083
2078
|
if (!o.keyPath)
|
|
2084
|
-
throw new
|
|
2085
|
-
}), n[r] =
|
|
2079
|
+
throw new P.Schema("Index must have a name and cannot be an empty string");
|
|
2080
|
+
}), n[r] = Gn(r, i, s);
|
|
2086
2081
|
}
|
|
2087
2082
|
});
|
|
2088
2083
|
}
|
|
@@ -2093,25 +2088,25 @@ class qr {
|
|
|
2093
2088
|
let i = {};
|
|
2094
2089
|
return r.forEach((o) => {
|
|
2095
2090
|
U(s, o._cfg.storesSource), i = o._cfg.dbschema = {}, o._parseStoresSpec(s, i);
|
|
2096
|
-
}), n._dbSchema = i, Wt(n, [n._allTables, n, n.Transaction.prototype]), pt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables],
|
|
2091
|
+
}), n._dbSchema = i, Wt(n, [n._allTables, n, n.Transaction.prototype]), pt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables], I(i), i), n._storeNames = I(i), this;
|
|
2097
2092
|
}
|
|
2098
2093
|
upgrade(e) {
|
|
2099
|
-
return this._cfg.contentUpgrade =
|
|
2094
|
+
return this._cfg.contentUpgrade = nn(this._cfg.contentUpgrade || K, e), this;
|
|
2100
2095
|
}
|
|
2101
2096
|
}
|
|
2102
|
-
function
|
|
2097
|
+
function an(t, e) {
|
|
2103
2098
|
let n = t._dbNamesDB;
|
|
2104
|
-
return n || (n = t._dbNamesDB = new
|
|
2099
|
+
return n || (n = t._dbNamesDB = new Se(yt, { addons: [], indexedDB: t, IDBKeyRange: e }), n.version(1).stores({ dbnames: "name" })), n.table("dbnames");
|
|
2105
2100
|
}
|
|
2106
2101
|
function un(t) {
|
|
2107
2102
|
return t && typeof t.databases == "function";
|
|
2108
2103
|
}
|
|
2109
|
-
function
|
|
2104
|
+
function Ht(t) {
|
|
2110
2105
|
return oe(function() {
|
|
2111
|
-
return
|
|
2106
|
+
return E.letThrough = !0, t();
|
|
2112
2107
|
});
|
|
2113
2108
|
}
|
|
2114
|
-
function
|
|
2109
|
+
function Br() {
|
|
2115
2110
|
var t;
|
|
2116
2111
|
return !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(e) {
|
|
2117
2112
|
var n = function() {
|
|
@@ -2122,64 +2117,64 @@ function Lr() {
|
|
|
2122
2117
|
return clearInterval(t);
|
|
2123
2118
|
}) : Promise.resolve();
|
|
2124
2119
|
}
|
|
2125
|
-
function
|
|
2120
|
+
function Fr(t) {
|
|
2126
2121
|
const e = t._state, { indexedDB: n } = t._deps;
|
|
2127
2122
|
if (e.isBeingOpened || t.idbdb)
|
|
2128
2123
|
return e.dbReadyPromise.then(() => e.dbOpenError ? D(e.dbOpenError) : t);
|
|
2129
|
-
G && (e.openCanceller._stackHolder =
|
|
2124
|
+
G && (e.openCanceller._stackHolder = Ee()), e.isBeingOpened = !0, e.dbOpenError = null, e.openComplete = !1;
|
|
2130
2125
|
const r = e.openCanceller;
|
|
2131
2126
|
function s() {
|
|
2132
2127
|
if (e.openCanceller !== r)
|
|
2133
|
-
throw new
|
|
2128
|
+
throw new P.DatabaseClosed("db.open() was cancelled");
|
|
2134
2129
|
}
|
|
2135
|
-
let i = e.dbReadyResolve, o = null,
|
|
2136
|
-
return S.race([r, (typeof navigator > "u" ? S.resolve() :
|
|
2130
|
+
let i = e.dbReadyResolve, o = null, u = !1;
|
|
2131
|
+
return S.race([r, (typeof navigator > "u" ? S.resolve() : Br()).then(() => new S((a, c) => {
|
|
2137
2132
|
if (s(), !n)
|
|
2138
|
-
throw new
|
|
2139
|
-
const h = t.name,
|
|
2140
|
-
if (!
|
|
2141
|
-
throw new
|
|
2142
|
-
|
|
2143
|
-
if (o =
|
|
2144
|
-
|
|
2133
|
+
throw new P.MissingAPI();
|
|
2134
|
+
const h = t.name, l = e.autoSchema ? n.open(h) : n.open(h, Math.round(10 * t.verno));
|
|
2135
|
+
if (!l)
|
|
2136
|
+
throw new P.MissingAPI();
|
|
2137
|
+
l.onerror = H(c), l.onblocked = N(t._fireOnBlocked), l.onupgradeneeded = N((d) => {
|
|
2138
|
+
if (o = l.transaction, e.autoSchema && !t._options.allowEmptyDB) {
|
|
2139
|
+
l.onerror = qe, o.abort(), l.result.close();
|
|
2145
2140
|
const m = n.deleteDatabase(h);
|
|
2146
|
-
m.onsuccess = m.onerror =
|
|
2147
|
-
c(new
|
|
2141
|
+
m.onsuccess = m.onerror = N(() => {
|
|
2142
|
+
c(new P.NoSuchDatabase(`Database ${h} doesnt exist`));
|
|
2148
2143
|
});
|
|
2149
2144
|
} else {
|
|
2150
|
-
o.onerror =
|
|
2145
|
+
o.onerror = H(c);
|
|
2151
2146
|
var p = d.oldVersion > Math.pow(2, 62) ? 0 : d.oldVersion;
|
|
2152
|
-
|
|
2147
|
+
u = p < 1, t._novip.idbdb = l.result, Ir(t, p / 10, o, c);
|
|
2153
2148
|
}
|
|
2154
|
-
}, c),
|
|
2149
|
+
}, c), l.onsuccess = N(() => {
|
|
2155
2150
|
o = null;
|
|
2156
|
-
const d = t._novip.idbdb =
|
|
2151
|
+
const d = t._novip.idbdb = l.result, p = ut(d.objectStoreNames);
|
|
2157
2152
|
if (p.length > 0)
|
|
2158
2153
|
try {
|
|
2159
2154
|
const f = d.transaction((m = p).length === 1 ? m[0] : m, "readonly");
|
|
2160
2155
|
e.autoSchema ? function({ _novip: v }, y, g) {
|
|
2161
2156
|
v.verno = y.version / 10;
|
|
2162
|
-
const b = v._dbSchema =
|
|
2163
|
-
v._storeNames =
|
|
2157
|
+
const b = v._dbSchema = zt(0, y, g);
|
|
2158
|
+
v._storeNames = ut(y.objectStoreNames, 0), pt(v, [v._allTables], I(b), b);
|
|
2164
2159
|
}(t, d, f) : (Yt(t, t._dbSchema, f), function(v, y) {
|
|
2165
|
-
const g =
|
|
2160
|
+
const g = Xn(zt(0, v.idbdb, y), v._dbSchema);
|
|
2166
2161
|
return !(g.add.length || g.change.some((b) => b.add.length || b.change.length));
|
|
2167
|
-
}(t, f) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),
|
|
2162
|
+
}(t, f) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")), Ut(t, f);
|
|
2168
2163
|
} catch {
|
|
2169
2164
|
}
|
|
2170
2165
|
var m;
|
|
2171
|
-
|
|
2166
|
+
je.push(t), d.onversionchange = N((f) => {
|
|
2172
2167
|
e.vcFired = !0, t.on("versionchange").fire(f);
|
|
2173
|
-
}), d.onclose =
|
|
2168
|
+
}), d.onclose = N((f) => {
|
|
2174
2169
|
t.on("close").fire(f);
|
|
2175
|
-
}),
|
|
2176
|
-
!un(f) && y !== yt &&
|
|
2170
|
+
}), u && function({ indexedDB: f, IDBKeyRange: v }, y) {
|
|
2171
|
+
!un(f) && y !== yt && an(f, v).put({ name: y }).catch(K);
|
|
2177
2172
|
}(t._deps, h), a();
|
|
2178
2173
|
}, c);
|
|
2179
|
-
}))]).then(() => (s(), e.onReadyBeingFired = [], S.resolve(
|
|
2174
|
+
}))]).then(() => (s(), e.onReadyBeingFired = [], S.resolve(Ht(() => t.on.ready.fire(t.vip))).then(function a() {
|
|
2180
2175
|
if (e.onReadyBeingFired.length > 0) {
|
|
2181
|
-
let c = e.onReadyBeingFired.reduce(
|
|
2182
|
-
return e.onReadyBeingFired = [], S.resolve(
|
|
2176
|
+
let c = e.onReadyBeingFired.reduce(nn, K);
|
|
2177
|
+
return e.onReadyBeingFired = [], S.resolve(Ht(() => c(t.vip))).then(a);
|
|
2183
2178
|
}
|
|
2184
2179
|
}))).finally(() => {
|
|
2185
2180
|
e.onReadyBeingFired = null, e.isBeingOpened = !1;
|
|
@@ -2194,47 +2189,47 @@ function Ur(t) {
|
|
|
2194
2189
|
e.openComplete = !0, i();
|
|
2195
2190
|
});
|
|
2196
2191
|
}
|
|
2197
|
-
function
|
|
2192
|
+
function Gt(t) {
|
|
2198
2193
|
var e = (i) => t.next(i), n = s(e), r = s((i) => t.throw(i));
|
|
2199
2194
|
function s(i) {
|
|
2200
2195
|
return (o) => {
|
|
2201
|
-
var
|
|
2202
|
-
return
|
|
2196
|
+
var u = i(o), a = u.value;
|
|
2197
|
+
return u.done ? a : a && typeof a.then == "function" ? a.then(n, r) : M(a) ? Promise.all(a).then(n, r) : n(a);
|
|
2203
2198
|
};
|
|
2204
2199
|
}
|
|
2205
2200
|
return s(e)();
|
|
2206
2201
|
}
|
|
2207
|
-
function
|
|
2202
|
+
function Mr(t, e, n) {
|
|
2208
2203
|
var r = arguments.length;
|
|
2209
2204
|
if (r < 2)
|
|
2210
|
-
throw new
|
|
2205
|
+
throw new P.InvalidArgument("Too few arguments");
|
|
2211
2206
|
for (var s = new Array(r - 1); --r; )
|
|
2212
2207
|
s[r - 1] = arguments[r];
|
|
2213
|
-
return n = s.pop(), [t,
|
|
2208
|
+
return n = s.pop(), [t, Tn(s), n];
|
|
2214
2209
|
}
|
|
2215
|
-
function
|
|
2210
|
+
function Qn(t, e, n, r, s) {
|
|
2216
2211
|
return S.resolve().then(() => {
|
|
2217
|
-
const i =
|
|
2212
|
+
const i = E.transless || E, o = t._createTransaction(e, n, t._dbSchema, r), u = { trans: o, transless: i };
|
|
2218
2213
|
if (r)
|
|
2219
2214
|
o.idbtrans = r.idbtrans;
|
|
2220
2215
|
else
|
|
2221
2216
|
try {
|
|
2222
2217
|
o.create(), t._state.PR1398_maxLoop = 3;
|
|
2223
|
-
} catch (
|
|
2224
|
-
return
|
|
2218
|
+
} catch (l) {
|
|
2219
|
+
return l.name === tn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Qn(t, e, n, null, s))) : D(l);
|
|
2225
2220
|
}
|
|
2226
|
-
const a =
|
|
2221
|
+
const a = Zt(s);
|
|
2227
2222
|
let c;
|
|
2228
|
-
a &&
|
|
2223
|
+
a && Pe();
|
|
2229
2224
|
const h = S.follow(() => {
|
|
2230
2225
|
if (c = s.call(o, o), c)
|
|
2231
2226
|
if (a) {
|
|
2232
|
-
var
|
|
2233
|
-
c.then(
|
|
2227
|
+
var l = ne.bind(null, null);
|
|
2228
|
+
c.then(l, l);
|
|
2234
2229
|
} else
|
|
2235
|
-
typeof c.next == "function" && typeof c.throw == "function" && (c =
|
|
2236
|
-
},
|
|
2237
|
-
return (c && typeof c.then == "function" ? S.resolve(c).then((
|
|
2230
|
+
typeof c.next == "function" && typeof c.throw == "function" && (c = Gt(c));
|
|
2231
|
+
}, u);
|
|
2232
|
+
return (c && typeof c.then == "function" ? S.resolve(c).then((l) => o.active ? l : D(new P.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))) : h.then(() => c)).then((l) => (r && o._resolve(), o._completion.then(() => l))).catch((l) => (o._reject(l), D(l)));
|
|
2238
2233
|
});
|
|
2239
2234
|
}
|
|
2240
2235
|
function et(t, e, n) {
|
|
@@ -2243,28 +2238,28 @@ function et(t, e, n) {
|
|
|
2243
2238
|
r.push(e);
|
|
2244
2239
|
return r;
|
|
2245
2240
|
}
|
|
2246
|
-
const
|
|
2241
|
+
const qr = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(t) {
|
|
2247
2242
|
return { ...t, table(e) {
|
|
2248
2243
|
const n = t.table(e), { schema: r } = n, s = {}, i = [];
|
|
2249
|
-
function o(c, h,
|
|
2250
|
-
const d = De(c), p = s[d] = s[d] || [], m = c == null ? 0 : typeof c == "string" ? 1 : c.length, f = h > 0, v = { ...
|
|
2251
|
-
return p.push(v), v.isPrimaryKey || i.push(v), m > 1 && o(m === 2 ? c[0] : c.slice(0, m - 1), h + 1,
|
|
2244
|
+
function o(c, h, l) {
|
|
2245
|
+
const d = De(c), p = s[d] = s[d] || [], m = c == null ? 0 : typeof c == "string" ? 1 : c.length, f = h > 0, v = { ...l, isVirtual: f, keyTail: h, keyLength: m, extractKey: Lt(c), unique: !f && l.unique };
|
|
2246
|
+
return p.push(v), v.isPrimaryKey || i.push(v), m > 1 && o(m === 2 ? c[0] : c.slice(0, m - 1), h + 1, l), p.sort((y, g) => y.keyTail - g.keyTail), v;
|
|
2252
2247
|
}
|
|
2253
|
-
const
|
|
2254
|
-
s[":id"] = [
|
|
2248
|
+
const u = o(r.primaryKey.keyPath, 0, r.primaryKey);
|
|
2249
|
+
s[":id"] = [u];
|
|
2255
2250
|
for (const c of r.indexes)
|
|
2256
2251
|
o(c.keyPath, 0, c);
|
|
2257
2252
|
function a(c) {
|
|
2258
2253
|
const h = c.query.index;
|
|
2259
|
-
return h.isVirtual ? { ...c, query: { index: h, range: (
|
|
2260
|
-
var
|
|
2254
|
+
return h.isVirtual ? { ...c, query: { index: h, range: (l = c.query.range, d = h.keyTail, { type: l.type === 1 ? 2 : l.type, lower: et(l.lower, l.lowerOpen ? t.MAX_KEY : t.MIN_KEY, d), lowerOpen: !0, upper: et(l.upper, l.upperOpen ? t.MIN_KEY : t.MAX_KEY, d), upperOpen: !0 }) } } : c;
|
|
2255
|
+
var l, d;
|
|
2261
2256
|
}
|
|
2262
|
-
return { ...n, schema: { ...r, primaryKey:
|
|
2257
|
+
return { ...n, schema: { ...r, primaryKey: u, indexes: i, getIndexByKeyPath: function(c) {
|
|
2263
2258
|
const h = s[De(c)];
|
|
2264
2259
|
return h && h[0];
|
|
2265
2260
|
} }, count: (c) => n.count(a(c)), query: (c) => n.query(a(c)), openCursor(c) {
|
|
2266
|
-
const { keyTail: h, isVirtual:
|
|
2267
|
-
return
|
|
2261
|
+
const { keyTail: h, isVirtual: l, keyLength: d } = c.query.index;
|
|
2262
|
+
return l ? n.openCursor(a(c)).then((p) => p && function(m) {
|
|
2268
2263
|
return Object.create(m, { continue: { value: function(f) {
|
|
2269
2264
|
f != null ? m.continue(et(f, c.reverse ? t.MAX_KEY : t.MIN_KEY, h)) : c.unique ? m.continue(m.key.slice(0, d).concat(c.reverse ? t.MIN_KEY : t.MAX_KEY, h)) : m.continue();
|
|
2270
2265
|
} }, continuePrimaryKey: { value(f, v) {
|
|
@@ -2277,109 +2272,109 @@ const Wr = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create:
|
|
|
2277
2272
|
} };
|
|
2278
2273
|
} };
|
|
2279
2274
|
} };
|
|
2280
|
-
function
|
|
2281
|
-
return n = n || {}, r = r || "",
|
|
2275
|
+
function ln(t, e, n, r) {
|
|
2276
|
+
return n = n || {}, r = r || "", I(t).forEach((s) => {
|
|
2282
2277
|
if (z(e, s)) {
|
|
2283
2278
|
var i = t[s], o = e[s];
|
|
2284
2279
|
if (typeof i == "object" && typeof o == "object" && i && o) {
|
|
2285
|
-
const
|
|
2286
|
-
|
|
2280
|
+
const u = Tt(i);
|
|
2281
|
+
u !== Tt(o) ? n[r + s] = e[s] : u === "Object" ? ln(i, o, n, r + s + ".") : i !== o && (n[r + s] = e[s]);
|
|
2287
2282
|
} else
|
|
2288
2283
|
i !== o && (n[r + s] = e[s]);
|
|
2289
2284
|
} else
|
|
2290
2285
|
n[r + s] = void 0;
|
|
2291
|
-
}),
|
|
2286
|
+
}), I(e).forEach((s) => {
|
|
2292
2287
|
z(t, s) || (n[r + s] = e[s]);
|
|
2293
2288
|
}), n;
|
|
2294
2289
|
}
|
|
2295
|
-
const
|
|
2290
|
+
const Lr = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) => ({ ...t, table(e) {
|
|
2296
2291
|
const n = t.table(e), { primaryKey: r } = n.schema;
|
|
2297
2292
|
return { ...n, mutate(s) {
|
|
2298
|
-
const i =
|
|
2293
|
+
const i = E.trans, { deleting: o, creating: u, updating: a } = i.table(e).hook;
|
|
2299
2294
|
switch (s.type) {
|
|
2300
2295
|
case "add":
|
|
2301
|
-
if (
|
|
2296
|
+
if (u.fire === K)
|
|
2302
2297
|
break;
|
|
2303
2298
|
return i._promise("readwrite", () => c(s), !0);
|
|
2304
2299
|
case "put":
|
|
2305
|
-
if (
|
|
2300
|
+
if (u.fire === K && a.fire === K)
|
|
2306
2301
|
break;
|
|
2307
2302
|
return i._promise("readwrite", () => c(s), !0);
|
|
2308
2303
|
case "delete":
|
|
2309
|
-
if (o.fire ===
|
|
2304
|
+
if (o.fire === K)
|
|
2310
2305
|
break;
|
|
2311
2306
|
return i._promise("readwrite", () => c(s), !0);
|
|
2312
2307
|
case "deleteRange":
|
|
2313
|
-
if (o.fire ===
|
|
2308
|
+
if (o.fire === K)
|
|
2314
2309
|
break;
|
|
2315
|
-
return i._promise("readwrite", () => function(
|
|
2316
|
-
return h(
|
|
2310
|
+
return i._promise("readwrite", () => function(l) {
|
|
2311
|
+
return h(l.trans, l.range, 1e4);
|
|
2317
2312
|
}(s), !0);
|
|
2318
2313
|
}
|
|
2319
2314
|
return n.mutate(s);
|
|
2320
|
-
function c(
|
|
2321
|
-
const d =
|
|
2315
|
+
function c(l) {
|
|
2316
|
+
const d = E.trans, p = l.keys || function(m, f) {
|
|
2322
2317
|
return f.type === "delete" ? f.keys : f.keys || f.values.map(m.extractKey);
|
|
2323
|
-
}(r,
|
|
2318
|
+
}(r, l);
|
|
2324
2319
|
if (!p)
|
|
2325
2320
|
throw new Error("Keys missing");
|
|
2326
|
-
return (
|
|
2321
|
+
return (l = l.type === "add" || l.type === "put" ? { ...l, keys: p } : { ...l }).type !== "delete" && (l.values = [...l.values]), l.keys && (l.keys = [...l.keys]), function(m, f, v) {
|
|
2327
2322
|
return f.type === "add" ? Promise.resolve([]) : m.getMany({ trans: f.trans, keys: v, cache: "immutable" });
|
|
2328
|
-
}(n,
|
|
2323
|
+
}(n, l, p).then((m) => {
|
|
2329
2324
|
const f = p.map((v, y) => {
|
|
2330
2325
|
const g = m[y], b = { onerror: null, onsuccess: null };
|
|
2331
|
-
if (
|
|
2326
|
+
if (l.type === "delete")
|
|
2332
2327
|
o.fire.call(b, v, g, d);
|
|
2333
|
-
else if (
|
|
2334
|
-
const w =
|
|
2335
|
-
v == null && w != null && (v = w,
|
|
2328
|
+
else if (l.type === "add" || g === void 0) {
|
|
2329
|
+
const w = u.fire.call(b, v, l.values[y], d);
|
|
2330
|
+
v == null && w != null && (v = w, l.keys[y] = v, r.outbound || Y(l.values[y], r.keyPath, v));
|
|
2336
2331
|
} else {
|
|
2337
|
-
const w =
|
|
2332
|
+
const w = ln(g, l.values[y]), C = a.fire.call(b, w, v, g, d);
|
|
2338
2333
|
if (C) {
|
|
2339
|
-
const k =
|
|
2334
|
+
const k = l.values[y];
|
|
2340
2335
|
Object.keys(C).forEach((_) => {
|
|
2341
|
-
z(k, _) ? k[_] = C[_] :
|
|
2336
|
+
z(k, _) ? k[_] = C[_] : Y(k, _, C[_]);
|
|
2342
2337
|
});
|
|
2343
2338
|
}
|
|
2344
2339
|
}
|
|
2345
2340
|
return b;
|
|
2346
2341
|
});
|
|
2347
|
-
return n.mutate(
|
|
2342
|
+
return n.mutate(l).then(({ failures: v, results: y, numFailures: g, lastResult: b }) => {
|
|
2348
2343
|
for (let w = 0; w < p.length; ++w) {
|
|
2349
2344
|
const C = y ? y[w] : p[w], k = f[w];
|
|
2350
|
-
C == null ? k.onerror && k.onerror(v[w]) : k.onsuccess && k.onsuccess(
|
|
2345
|
+
C == null ? k.onerror && k.onerror(v[w]) : k.onsuccess && k.onsuccess(l.type === "put" && m[w] ? l.values[w] : C);
|
|
2351
2346
|
}
|
|
2352
2347
|
return { failures: v, results: y, numFailures: g, lastResult: b };
|
|
2353
2348
|
}).catch((v) => (f.forEach((y) => y.onerror && y.onerror(v)), Promise.reject(v)));
|
|
2354
2349
|
});
|
|
2355
2350
|
}
|
|
2356
|
-
function h(
|
|
2357
|
-
return n.query({ trans:
|
|
2351
|
+
function h(l, d, p) {
|
|
2352
|
+
return n.query({ trans: l, values: !1, query: { index: r, range: d }, limit: p }).then(({ result: m }) => c({ type: "delete", keys: m, trans: l }).then((f) => f.numFailures > 0 ? Promise.reject(f.failures[0]) : m.length < p ? { failures: [], numFailures: 0, lastResult: void 0 } : h(l, { ...d, lower: m[m.length - 1], lowerOpen: !0 }, p)));
|
|
2358
2353
|
}
|
|
2359
2354
|
} };
|
|
2360
2355
|
} }) };
|
|
2361
|
-
function
|
|
2356
|
+
function Jn(t, e, n) {
|
|
2362
2357
|
try {
|
|
2363
2358
|
if (!e || e.keys.length < t.length)
|
|
2364
2359
|
return null;
|
|
2365
2360
|
const r = [];
|
|
2366
2361
|
for (let s = 0, i = 0; s < e.keys.length && i < t.length; ++s)
|
|
2367
|
-
L(e.keys[s], t[i]) === 0 && (r.push(n ?
|
|
2362
|
+
L(e.keys[s], t[i]) === 0 && (r.push(n ? Ve(e.values[s]) : e.values[s]), ++i);
|
|
2368
2363
|
return r.length === t.length ? r : null;
|
|
2369
2364
|
} catch {
|
|
2370
2365
|
return null;
|
|
2371
2366
|
}
|
|
2372
2367
|
}
|
|
2373
|
-
const
|
|
2368
|
+
const Ur = { stack: "dbcore", level: -1, create: (t) => ({ table: (e) => {
|
|
2374
2369
|
const n = t.table(e);
|
|
2375
2370
|
return { ...n, getMany: (r) => {
|
|
2376
2371
|
if (!r.cache)
|
|
2377
2372
|
return n.getMany(r);
|
|
2378
|
-
const s =
|
|
2379
|
-
return s ? S.resolve(s) : n.getMany(r).then((i) => (r.trans._cache = { keys: r.keys, values: r.cache === "clone" ?
|
|
2373
|
+
const s = Jn(r.keys, r.trans._cache, r.cache === "clone");
|
|
2374
|
+
return s ? S.resolve(s) : n.getMany(r).then((i) => (r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? Ve(i) : i }, i));
|
|
2380
2375
|
}, mutate: (r) => (r.type !== "add" && (r.trans._cache = null), n.mutate(r)) };
|
|
2381
2376
|
} }) };
|
|
2382
|
-
function
|
|
2377
|
+
function cn(t) {
|
|
2383
2378
|
return !("from" in t);
|
|
2384
2379
|
}
|
|
2385
2380
|
const Q = function(t, e) {
|
|
@@ -2389,45 +2384,45 @@ const Q = function(t, e) {
|
|
|
2389
2384
|
}
|
|
2390
2385
|
U(this, arguments.length ? { d: 1, from: t, to: arguments.length > 1 ? e : t } : { d: 0 });
|
|
2391
2386
|
};
|
|
2392
|
-
function
|
|
2387
|
+
function We(t, e, n) {
|
|
2393
2388
|
const r = L(e, n);
|
|
2394
2389
|
if (isNaN(r))
|
|
2395
2390
|
return;
|
|
2396
2391
|
if (r > 0)
|
|
2397
2392
|
throw RangeError();
|
|
2398
|
-
if (
|
|
2393
|
+
if (cn(t))
|
|
2399
2394
|
return U(t, { from: e, to: n, d: 1 });
|
|
2400
2395
|
const s = t.l, i = t.r;
|
|
2401
2396
|
if (L(n, t.from) < 0)
|
|
2402
|
-
return s ?
|
|
2397
|
+
return s ? We(s, e, n) : t.l = { from: e, to: n, d: 1, l: null, r: null }, _n(t);
|
|
2403
2398
|
if (L(e, t.to) > 0)
|
|
2404
|
-
return i ?
|
|
2399
|
+
return i ? We(i, e, n) : t.r = { from: e, to: n, d: 1, l: null, r: null }, _n(t);
|
|
2405
2400
|
L(e, t.from) < 0 && (t.from = e, t.l = null, t.d = i ? i.d + 1 : 1), L(n, t.to) > 0 && (t.to = n, t.r = null, t.d = t.l ? t.l.d + 1 : 1);
|
|
2406
2401
|
const o = !t.r;
|
|
2407
2402
|
s && !t.l && mt(t, s), i && o && mt(t, i);
|
|
2408
2403
|
}
|
|
2409
2404
|
function mt(t, e) {
|
|
2410
|
-
|
|
2411
|
-
|
|
2405
|
+
cn(e) || function n(r, { from: s, to: i, l: o, r: u }) {
|
|
2406
|
+
We(r, s, i), o && n(r, o), u && n(r, u);
|
|
2412
2407
|
}(t, e);
|
|
2413
2408
|
}
|
|
2414
|
-
function
|
|
2415
|
-
const n =
|
|
2409
|
+
function Wr(t, e) {
|
|
2410
|
+
const n = Xt(e);
|
|
2416
2411
|
let r = n.next();
|
|
2417
2412
|
if (r.done)
|
|
2418
2413
|
return !1;
|
|
2419
2414
|
let s = r.value;
|
|
2420
|
-
const i =
|
|
2421
|
-
let o = i.next(s.from),
|
|
2415
|
+
const i = Xt(t);
|
|
2416
|
+
let o = i.next(s.from), u = o.value;
|
|
2422
2417
|
for (; !r.done && !o.done; ) {
|
|
2423
|
-
if (L(
|
|
2418
|
+
if (L(u.from, s.to) <= 0 && L(u.to, s.from) >= 0)
|
|
2424
2419
|
return !0;
|
|
2425
|
-
L(s.from,
|
|
2420
|
+
L(s.from, u.from) < 0 ? s = (r = n.next(u.from)).value : u = (o = i.next(s.from)).value;
|
|
2426
2421
|
}
|
|
2427
2422
|
return !1;
|
|
2428
2423
|
}
|
|
2429
|
-
function
|
|
2430
|
-
let e =
|
|
2424
|
+
function Xt(t) {
|
|
2425
|
+
let e = cn(t) ? null : { s: 0, n: t };
|
|
2431
2426
|
return { next(n) {
|
|
2432
2427
|
const r = arguments.length > 0;
|
|
2433
2428
|
for (; e; )
|
|
@@ -2453,31 +2448,31 @@ function Qt(t) {
|
|
|
2453
2448
|
return { done: !0 };
|
|
2454
2449
|
} };
|
|
2455
2450
|
}
|
|
2456
|
-
function
|
|
2451
|
+
function _n(t) {
|
|
2457
2452
|
var e, n;
|
|
2458
2453
|
const r = (((e = t.r) === null || e === void 0 ? void 0 : e.d) || 0) - (((n = t.l) === null || n === void 0 ? void 0 : n.d) || 0), s = r > 1 ? "r" : r < -1 ? "l" : "";
|
|
2459
2454
|
if (s) {
|
|
2460
|
-
const i = s === "r" ? "l" : "r", o = { ...t },
|
|
2461
|
-
t.from =
|
|
2455
|
+
const i = s === "r" ? "l" : "r", o = { ...t }, u = t[s];
|
|
2456
|
+
t.from = u.from, t.to = u.to, t[s] = u[s], o[s] = u[i], t[i] = o, o.d = kn(o);
|
|
2462
2457
|
}
|
|
2463
|
-
t.d =
|
|
2458
|
+
t.d = kn(t);
|
|
2464
2459
|
}
|
|
2465
|
-
function
|
|
2460
|
+
function kn({ r: t, l: e }) {
|
|
2466
2461
|
return (t ? e ? Math.max(t.d, e.d) : t.d : e ? e.d : 0) + 1;
|
|
2467
2462
|
}
|
|
2468
2463
|
Ce(Q.prototype, { add(t) {
|
|
2469
2464
|
return mt(this, t), this;
|
|
2470
2465
|
}, addKey(t) {
|
|
2471
|
-
return
|
|
2466
|
+
return We(this, t, t), this;
|
|
2472
2467
|
}, addKeys(t) {
|
|
2473
|
-
return t.forEach((e) =>
|
|
2468
|
+
return t.forEach((e) => We(this, e, e)), this;
|
|
2474
2469
|
}, [Ot]() {
|
|
2475
|
-
return
|
|
2470
|
+
return Xt(this);
|
|
2476
2471
|
} });
|
|
2477
|
-
const
|
|
2472
|
+
const Vr = { stack: "dbcore", level: 0, create: (t) => {
|
|
2478
2473
|
const e = t.schema.name, n = new Q(t.MIN_KEY, t.MAX_KEY);
|
|
2479
2474
|
return { ...t, table: (r) => {
|
|
2480
|
-
const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey:
|
|
2475
|
+
const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey: u, outbound: a } = o, c = { ...s, mutate: (d) => {
|
|
2481
2476
|
const p = d.trans, m = p.mutatedParts || (p.mutatedParts = {}), f = (k) => {
|
|
2482
2477
|
const _ = `idb://${e}/${r}/${k}`;
|
|
2483
2478
|
return m[_] || (m[_] = new Q());
|
|
@@ -2487,17 +2482,17 @@ const Gr = { stack: "dbcore", level: 0, create: (t) => {
|
|
|
2487
2482
|
return s.mutate(d).then((k) => {
|
|
2488
2483
|
if (M(b)) {
|
|
2489
2484
|
g !== "delete" && (b = k.results), v.addKeys(b);
|
|
2490
|
-
const _ =
|
|
2491
|
-
_ || g === "add" || y.addKeys(b), (_ || w) && function(
|
|
2485
|
+
const _ = Jn(b, C);
|
|
2486
|
+
_ || g === "add" || y.addKeys(b), (_ || w) && function(O, x, R, A) {
|
|
2492
2487
|
function q(B) {
|
|
2493
|
-
const
|
|
2494
|
-
function
|
|
2495
|
-
return
|
|
2488
|
+
const j = O(B.name || "");
|
|
2489
|
+
function ge(W) {
|
|
2490
|
+
return W != null ? B.extractKey(W) : null;
|
|
2496
2491
|
}
|
|
2497
|
-
const
|
|
2498
|
-
(
|
|
2499
|
-
const
|
|
2500
|
-
L(
|
|
2492
|
+
const ye = (W) => B.multiEntry && M(W) ? W.forEach((le) => j.addKey(le)) : j.addKey(W);
|
|
2493
|
+
(R || A).forEach((W, le) => {
|
|
2494
|
+
const Oe = R && ge(R[le]), vt = A && ge(A[le]);
|
|
2495
|
+
L(Oe, vt) !== 0 && (Oe != null && ye(Oe), vt != null && ye(vt));
|
|
2501
2496
|
});
|
|
2502
2497
|
}
|
|
2503
2498
|
x.indexes.forEach(q);
|
|
@@ -2512,15 +2507,15 @@ const Gr = { stack: "dbcore", level: 0, create: (t) => {
|
|
|
2512
2507
|
} }, h = ({ query: { index: d, range: p } }) => {
|
|
2513
2508
|
var m, f;
|
|
2514
2509
|
return [d, new Q((m = p.lower) !== null && m !== void 0 ? m : t.MIN_KEY, (f = p.upper) !== null && f !== void 0 ? f : t.MAX_KEY)];
|
|
2515
|
-
},
|
|
2516
|
-
return
|
|
2510
|
+
}, l = { get: (d) => [o, new Q(d.key)], getMany: (d) => [o, new Q().addKeys(d.keys)], count: h, query: h, openCursor: h };
|
|
2511
|
+
return I(l).forEach((d) => {
|
|
2517
2512
|
c[d] = function(p) {
|
|
2518
|
-
const { subscr: m } =
|
|
2513
|
+
const { subscr: m } = E;
|
|
2519
2514
|
if (m) {
|
|
2520
2515
|
const f = (w) => {
|
|
2521
2516
|
const C = `idb://${e}/${r}/${w}`;
|
|
2522
2517
|
return m[C] || (m[C] = new Q());
|
|
2523
|
-
}, v = f(""), y = f(":dels"), [g, b] =
|
|
2518
|
+
}, v = f(""), y = f(":dels"), [g, b] = l[d](p);
|
|
2524
2519
|
if (f(g.name || "").add(b), !g.isPrimaryKey) {
|
|
2525
2520
|
if (d !== "count") {
|
|
2526
2521
|
const w = d === "query" && a && p.values && s.query({ ...p, values: !1 });
|
|
@@ -2528,13 +2523,13 @@ const Gr = { stack: "dbcore", level: 0, create: (t) => {
|
|
|
2528
2523
|
if (d === "query") {
|
|
2529
2524
|
if (a && p.values)
|
|
2530
2525
|
return w.then(({ result: _ }) => (v.addKeys(_), C));
|
|
2531
|
-
const k = p.values ? C.result.map(
|
|
2526
|
+
const k = p.values ? C.result.map(u) : C.result;
|
|
2532
2527
|
p.values ? v.addKeys(k) : y.addKeys(k);
|
|
2533
2528
|
} else if (d === "openCursor") {
|
|
2534
2529
|
const k = C, _ = p.values;
|
|
2535
2530
|
return k && Object.create(k, { key: { get: () => (y.addKey(k.primaryKey), k.key) }, primaryKey: { get() {
|
|
2536
|
-
const
|
|
2537
|
-
return y.addKey(
|
|
2531
|
+
const O = k.primaryKey;
|
|
2532
|
+
return y.addKey(O), O;
|
|
2538
2533
|
} }, value: { get: () => (_ && v.addKey(k.primaryKey), k.value) } });
|
|
2539
2534
|
}
|
|
2540
2535
|
return C;
|
|
@@ -2548,52 +2543,52 @@ const Gr = { stack: "dbcore", level: 0, create: (t) => {
|
|
|
2548
2543
|
}), c;
|
|
2549
2544
|
} };
|
|
2550
2545
|
} };
|
|
2551
|
-
class
|
|
2546
|
+
class Se {
|
|
2552
2547
|
constructor(e, n) {
|
|
2553
2548
|
this._middlewares = {}, this.verno = 0;
|
|
2554
|
-
const r =
|
|
2555
|
-
this._options = n = { addons:
|
|
2549
|
+
const r = Se.dependencies;
|
|
2550
|
+
this._options = n = { addons: Se.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, ...n }, this._deps = { indexedDB: n.indexedDB, IDBKeyRange: n.IDBKeyRange };
|
|
2556
2551
|
const { addons: s } = n;
|
|
2557
2552
|
this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
2558
|
-
const i = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve:
|
|
2553
|
+
const i = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: K, dbReadyPromise: null, cancelOpen: K, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3 };
|
|
2559
2554
|
var o;
|
|
2560
|
-
i.dbReadyPromise = new S((
|
|
2561
|
-
i.dbReadyResolve =
|
|
2562
|
-
}), i.openCanceller = new S((
|
|
2555
|
+
i.dbReadyPromise = new S((u) => {
|
|
2556
|
+
i.dbReadyResolve = u;
|
|
2557
|
+
}), i.openCanceller = new S((u, a) => {
|
|
2563
2558
|
i.cancelOpen = a;
|
|
2564
|
-
}), this._state = i, this.name = e, this.on =
|
|
2565
|
-
|
|
2559
|
+
}), this._state = i, this.name = e, this.on = Ie(this, "populate", "blocked", "versionchange", "close", { ready: [nn, K] }), this.on.ready.subscribe = Sn(this.on.ready.subscribe, (u) => (a, c) => {
|
|
2560
|
+
Se.vip(() => {
|
|
2566
2561
|
const h = this._state;
|
|
2567
2562
|
if (h.openComplete)
|
|
2568
|
-
h.dbOpenError || S.resolve().then(a), c &&
|
|
2563
|
+
h.dbOpenError || S.resolve().then(a), c && u(a);
|
|
2569
2564
|
else if (h.onReadyBeingFired)
|
|
2570
|
-
h.onReadyBeingFired.push(a), c &&
|
|
2565
|
+
h.onReadyBeingFired.push(a), c && u(a);
|
|
2571
2566
|
else {
|
|
2572
|
-
|
|
2573
|
-
const
|
|
2574
|
-
c ||
|
|
2575
|
-
|
|
2567
|
+
u(a);
|
|
2568
|
+
const l = this;
|
|
2569
|
+
c || u(function d() {
|
|
2570
|
+
l.on.ready.unsubscribe(a), l.on.ready.unsubscribe(d);
|
|
2576
2571
|
});
|
|
2577
2572
|
}
|
|
2578
2573
|
});
|
|
2579
|
-
}), this.Collection = (o = this,
|
|
2574
|
+
}), this.Collection = (o = this, Ae(Tr.prototype, function(u, a) {
|
|
2580
2575
|
this.db = o;
|
|
2581
|
-
let c =
|
|
2576
|
+
let c = Vn, h = null;
|
|
2582
2577
|
if (a)
|
|
2583
2578
|
try {
|
|
2584
2579
|
c = a();
|
|
2585
2580
|
} catch (m) {
|
|
2586
2581
|
h = m;
|
|
2587
2582
|
}
|
|
2588
|
-
const
|
|
2589
|
-
this._ctx = { table: d, index:
|
|
2590
|
-
})), this.Table = function(
|
|
2591
|
-
return
|
|
2592
|
-
this.db =
|
|
2583
|
+
const l = u._ctx, d = l.table, p = d.hook.reading.fire;
|
|
2584
|
+
this._ctx = { table: d, index: l.index, isPrimKey: !l.index || d.schema.primKey.keyPath && l.index === d.schema.primKey.name, range: c, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: h, or: l.or, valueMapper: p !== Fe ? p : null };
|
|
2585
|
+
})), this.Table = function(u) {
|
|
2586
|
+
return Ae(Pr.prototype, function(a, c, h) {
|
|
2587
|
+
this.db = u, this._tx = h, this.name = a, this.schema = c, this.hook = u._allTables[a] ? u._allTables[a].hook : Ie(null, { creating: [mr, K], reading: [pr, Fe], updating: [yr, K], deleting: [gr, K] });
|
|
2593
2588
|
});
|
|
2594
|
-
}(this), this.Transaction = function(
|
|
2595
|
-
return
|
|
2596
|
-
this.db =
|
|
2589
|
+
}(this), this.Transaction = function(u) {
|
|
2590
|
+
return Ae($r.prototype, function(a, c, h, l, d) {
|
|
2591
|
+
this.db = u, this.mode = a, this.storeNames = c, this.schema = h, this.chromeTransactionDurability = l, this.idbtrans = null, this.on = Ie(this, "complete", "error", "abort"), this.parent = d || 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 S((p, m) => {
|
|
2597
2592
|
this._resolve = p, this._reject = m;
|
|
2598
2593
|
}), this._completion.then(() => {
|
|
2599
2594
|
this.active = !1, this.on.complete.fire();
|
|
@@ -2602,44 +2597,44 @@ class pe {
|
|
|
2602
2597
|
return this.active = !1, this.on.error.fire(p), this.parent ? this.parent._reject(p) : m && this.idbtrans && this.idbtrans.abort(), D(p);
|
|
2603
2598
|
});
|
|
2604
2599
|
});
|
|
2605
|
-
}(this), this.Version = function(
|
|
2606
|
-
return
|
|
2607
|
-
this.db =
|
|
2600
|
+
}(this), this.Version = function(u) {
|
|
2601
|
+
return Ae(Dr.prototype, function(a) {
|
|
2602
|
+
this.db = u, this._cfg = { version: a, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
2608
2603
|
});
|
|
2609
|
-
}(this), this.WhereClause = function(
|
|
2610
|
-
return
|
|
2611
|
-
this.db =
|
|
2612
|
-
const
|
|
2613
|
-
if (!
|
|
2614
|
-
throw new
|
|
2615
|
-
this._cmp = this._ascending =
|
|
2604
|
+
}(this), this.WhereClause = function(u) {
|
|
2605
|
+
return Ae(Yn.prototype, function(a, c, h) {
|
|
2606
|
+
this.db = u, this._ctx = { table: a, index: c === ":id" ? null : c, or: h };
|
|
2607
|
+
const l = u._deps.indexedDB;
|
|
2608
|
+
if (!l)
|
|
2609
|
+
throw new P.MissingAPI();
|
|
2610
|
+
this._cmp = this._ascending = l.cmp.bind(l), this._descending = (d, p) => l.cmp(p, d), this._max = (d, p) => l.cmp(d, p) > 0 ? d : p, this._min = (d, p) => l.cmp(d, p) < 0 ? d : p, this._IDBKeyRange = u._deps.IDBKeyRange;
|
|
2616
2611
|
});
|
|
2617
|
-
}(this), this.on("versionchange", (
|
|
2618
|
-
|
|
2619
|
-
}), this.on("blocked", (
|
|
2620
|
-
!
|
|
2621
|
-
}), this._maxKey = Ue(n.IDBKeyRange), this._createTransaction = (
|
|
2622
|
-
this.on("blocked").fire(
|
|
2623
|
-
}, this.use(
|
|
2612
|
+
}(this), this.on("versionchange", (u) => {
|
|
2613
|
+
u.newVersion > 0 ? console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`), this.close();
|
|
2614
|
+
}), this.on("blocked", (u) => {
|
|
2615
|
+
!u.newVersion || u.newVersion < u.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${u.oldVersion / 10}`);
|
|
2616
|
+
}), this._maxKey = Ue(n.IDBKeyRange), this._createTransaction = (u, a, c, h) => new this.Transaction(u, a, c, this._options.chromeTransactionDurability, h), this._fireOnBlocked = (u) => {
|
|
2617
|
+
this.on("blocked").fire(u), je.filter((a) => a.name === this.name && a !== this && !a._state.vcFired).map((a) => a.on("versionchange").fire(u));
|
|
2618
|
+
}, this.use(qr), this.use(Lr), this.use(Vr), this.use(Ur), this.vip = Object.create(this, { _vip: { value: !0 } }), s.forEach((u) => u(this));
|
|
2624
2619
|
}
|
|
2625
2620
|
version(e) {
|
|
2626
2621
|
if (isNaN(e) || e < 0.1)
|
|
2627
|
-
throw new
|
|
2622
|
+
throw new P.Type("Given version is not a positive number");
|
|
2628
2623
|
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened)
|
|
2629
|
-
throw new
|
|
2624
|
+
throw new P.Schema("Cannot add version when database is open");
|
|
2630
2625
|
this.verno = Math.max(this.verno, e);
|
|
2631
2626
|
const n = this._versions;
|
|
2632
2627
|
var r = n.filter((s) => s._cfg.version === e)[0];
|
|
2633
|
-
return r || (r = new this.Version(e), n.push(r), n.sort(
|
|
2628
|
+
return r || (r = new this.Version(e), n.push(r), n.sort(jr), r.stores({}), this._state.autoSchema = !1, r);
|
|
2634
2629
|
}
|
|
2635
2630
|
_whenReady(e) {
|
|
2636
|
-
return this.idbdb && (this._state.openComplete ||
|
|
2631
|
+
return this.idbdb && (this._state.openComplete || E.letThrough || this._vip) ? e() : new S((n, r) => {
|
|
2637
2632
|
if (this._state.openComplete)
|
|
2638
|
-
return r(new
|
|
2633
|
+
return r(new P.DatabaseClosed(this._state.dbOpenError));
|
|
2639
2634
|
if (!this._state.isBeingOpened) {
|
|
2640
2635
|
if (!this._options.autoOpen)
|
|
2641
|
-
return void r(new
|
|
2642
|
-
this.open().catch(
|
|
2636
|
+
return void r(new P.DatabaseClosed());
|
|
2637
|
+
this.open().catch(K);
|
|
2643
2638
|
}
|
|
2644
2639
|
this._state.dbReadyPromise.then(n, r);
|
|
2645
2640
|
}).then(e);
|
|
@@ -2647,17 +2642,17 @@ class pe {
|
|
|
2647
2642
|
use({ stack: e, create: n, level: r, name: s }) {
|
|
2648
2643
|
s && this.unuse({ stack: e, name: s });
|
|
2649
2644
|
const i = this._middlewares[e] || (this._middlewares[e] = []);
|
|
2650
|
-
return i.push({ stack: e, create: n, level: r ?? 10, name: s }), i.sort((o,
|
|
2645
|
+
return i.push({ stack: e, create: n, level: r ?? 10, name: s }), i.sort((o, u) => o.level - u.level), this;
|
|
2651
2646
|
}
|
|
2652
2647
|
unuse({ stack: e, name: n, create: r }) {
|
|
2653
2648
|
return e && this._middlewares[e] && (this._middlewares[e] = this._middlewares[e].filter((s) => r ? s.create !== r : !!n && s.name !== n)), this;
|
|
2654
2649
|
}
|
|
2655
2650
|
open() {
|
|
2656
|
-
return
|
|
2651
|
+
return Fr(this);
|
|
2657
2652
|
}
|
|
2658
2653
|
_close() {
|
|
2659
|
-
const e = this._state, n =
|
|
2660
|
-
if (n >= 0 &&
|
|
2654
|
+
const e = this._state, n = je.indexOf(this);
|
|
2655
|
+
if (n >= 0 && je.splice(n, 1), this.idbdb) {
|
|
2661
2656
|
try {
|
|
2662
2657
|
this.idbdb.close();
|
|
2663
2658
|
} catch {
|
|
@@ -2673,7 +2668,7 @@ class pe {
|
|
|
2673
2668
|
close() {
|
|
2674
2669
|
this._close();
|
|
2675
2670
|
const e = this._state;
|
|
2676
|
-
this._options.autoOpen = !1, e.dbOpenError = new
|
|
2671
|
+
this._options.autoOpen = !1, e.dbOpenError = new P.DatabaseClosed(), e.isBeingOpened && e.cancelOpen(e.dbOpenError);
|
|
2677
2672
|
}
|
|
2678
2673
|
delete() {
|
|
2679
2674
|
const e = arguments.length > 0, n = this._state;
|
|
@@ -2681,14 +2676,14 @@ class pe {
|
|
|
2681
2676
|
const i = () => {
|
|
2682
2677
|
this.close();
|
|
2683
2678
|
var o = this._deps.indexedDB.deleteDatabase(this.name);
|
|
2684
|
-
o.onsuccess =
|
|
2685
|
-
(function({ indexedDB:
|
|
2686
|
-
!un(
|
|
2679
|
+
o.onsuccess = N(() => {
|
|
2680
|
+
(function({ indexedDB: u, IDBKeyRange: a }, c) {
|
|
2681
|
+
!un(u) && c !== yt && an(u, a).delete(c).catch(K);
|
|
2687
2682
|
})(this._deps, this.name), r();
|
|
2688
|
-
}), o.onerror =
|
|
2683
|
+
}), o.onerror = H(s), o.onblocked = this._fireOnBlocked;
|
|
2689
2684
|
};
|
|
2690
2685
|
if (e)
|
|
2691
|
-
throw new
|
|
2686
|
+
throw new P.InvalidArgument("Arguments not allowed in db.delete()");
|
|
2692
2687
|
n.isBeingOpened ? n.dbReadyPromise.then(i) : i();
|
|
2693
2688
|
});
|
|
2694
2689
|
}
|
|
@@ -2709,20 +2704,20 @@ class pe {
|
|
|
2709
2704
|
return this._state.autoSchema;
|
|
2710
2705
|
}
|
|
2711
2706
|
get tables() {
|
|
2712
|
-
return
|
|
2707
|
+
return I(this._allTables).map((e) => this._allTables[e]);
|
|
2713
2708
|
}
|
|
2714
2709
|
transaction() {
|
|
2715
|
-
const e =
|
|
2710
|
+
const e = Mr.apply(this, arguments);
|
|
2716
2711
|
return this._transaction.apply(this, e);
|
|
2717
2712
|
}
|
|
2718
2713
|
_transaction(e, n, r) {
|
|
2719
|
-
let s =
|
|
2714
|
+
let s = E.trans;
|
|
2720
2715
|
s && s.db === this && e.indexOf("!") === -1 || (s = null);
|
|
2721
2716
|
const i = e.indexOf("?") !== -1;
|
|
2722
|
-
let o,
|
|
2717
|
+
let o, u;
|
|
2723
2718
|
e = e.replace("!", "").replace("?", "");
|
|
2724
2719
|
try {
|
|
2725
|
-
if (
|
|
2720
|
+
if (u = n.map((c) => {
|
|
2726
2721
|
var h = c instanceof this.Table ? c.name : c;
|
|
2727
2722
|
if (typeof h != "string")
|
|
2728
2723
|
throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
@@ -2731,82 +2726,82 @@ class pe {
|
|
|
2731
2726
|
o = _t;
|
|
2732
2727
|
else {
|
|
2733
2728
|
if (e != "rw" && e != kt)
|
|
2734
|
-
throw new
|
|
2729
|
+
throw new P.InvalidArgument("Invalid transaction mode: " + e);
|
|
2735
2730
|
o = kt;
|
|
2736
2731
|
}
|
|
2737
2732
|
if (s) {
|
|
2738
2733
|
if (s.mode === _t && o === kt) {
|
|
2739
2734
|
if (!i)
|
|
2740
|
-
throw new
|
|
2735
|
+
throw new P.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
2741
2736
|
s = null;
|
|
2742
2737
|
}
|
|
2743
|
-
s &&
|
|
2738
|
+
s && u.forEach((c) => {
|
|
2744
2739
|
if (s && s.storeNames.indexOf(c) === -1) {
|
|
2745
2740
|
if (!i)
|
|
2746
|
-
throw new
|
|
2741
|
+
throw new P.SubTransaction("Table " + c + " not included in parent transaction.");
|
|
2747
2742
|
s = null;
|
|
2748
2743
|
}
|
|
2749
2744
|
}), i && s && !s.active && (s = null);
|
|
2750
2745
|
}
|
|
2751
2746
|
} catch (c) {
|
|
2752
|
-
return s ? s._promise(null, (h,
|
|
2753
|
-
|
|
2747
|
+
return s ? s._promise(null, (h, l) => {
|
|
2748
|
+
l(c);
|
|
2754
2749
|
}) : D(c);
|
|
2755
2750
|
}
|
|
2756
|
-
const a =
|
|
2757
|
-
return s ? s._promise(o, a, "lock") :
|
|
2751
|
+
const a = Qn.bind(null, this, o, u, s, r);
|
|
2752
|
+
return s ? s._promise(o, a, "lock") : E.trans ? Te(E.transless, () => this._whenReady(a)) : this._whenReady(a);
|
|
2758
2753
|
}
|
|
2759
2754
|
table(e) {
|
|
2760
2755
|
if (!z(this._allTables, e))
|
|
2761
|
-
throw new
|
|
2756
|
+
throw new P.InvalidTable(`Table ${e} does not exist`);
|
|
2762
2757
|
return this._allTables[e];
|
|
2763
2758
|
}
|
|
2764
2759
|
}
|
|
2765
|
-
const
|
|
2766
|
-
class
|
|
2760
|
+
const zr = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable";
|
|
2761
|
+
class Yr {
|
|
2767
2762
|
constructor(e) {
|
|
2768
2763
|
this._subscribe = e;
|
|
2769
2764
|
}
|
|
2770
2765
|
subscribe(e, n, r) {
|
|
2771
2766
|
return this._subscribe(e && typeof e != "function" ? e : { next: e, error: n, complete: r });
|
|
2772
2767
|
}
|
|
2773
|
-
[
|
|
2768
|
+
[zr]() {
|
|
2774
2769
|
return this;
|
|
2775
2770
|
}
|
|
2776
2771
|
}
|
|
2777
|
-
function
|
|
2778
|
-
return
|
|
2772
|
+
function Zn(t, e) {
|
|
2773
|
+
return I(e).forEach((n) => {
|
|
2779
2774
|
mt(t[n] || (t[n] = new Q()), e[n]);
|
|
2780
2775
|
}), t;
|
|
2781
2776
|
}
|
|
2782
|
-
function
|
|
2777
|
+
function Hr(t) {
|
|
2783
2778
|
let e, n = !1;
|
|
2784
|
-
const r = new
|
|
2785
|
-
const i =
|
|
2786
|
-
let o = !1,
|
|
2779
|
+
const r = new Yr((s) => {
|
|
2780
|
+
const i = Zt(t);
|
|
2781
|
+
let o = !1, u = {}, a = {};
|
|
2787
2782
|
const c = { get closed() {
|
|
2788
2783
|
return o;
|
|
2789
2784
|
}, unsubscribe: () => {
|
|
2790
|
-
o = !0,
|
|
2785
|
+
o = !0, ue.storagemutated.unsubscribe(p);
|
|
2791
2786
|
} };
|
|
2792
2787
|
s.start && s.start(c);
|
|
2793
|
-
let h = !1,
|
|
2788
|
+
let h = !1, l = !1;
|
|
2794
2789
|
function d() {
|
|
2795
|
-
return
|
|
2790
|
+
return I(a).some((f) => u[f] && Wr(u[f], a[f]));
|
|
2796
2791
|
}
|
|
2797
2792
|
const p = (f) => {
|
|
2798
|
-
|
|
2793
|
+
Zn(u, f), d() && m();
|
|
2799
2794
|
}, m = () => {
|
|
2800
2795
|
if (h || o)
|
|
2801
2796
|
return;
|
|
2802
|
-
|
|
2797
|
+
u = {};
|
|
2803
2798
|
const f = {}, v = function(y) {
|
|
2804
|
-
i &&
|
|
2805
|
-
const g = () => oe(t, { subscr: y, trans: null }), b =
|
|
2799
|
+
i && Pe();
|
|
2800
|
+
const g = () => oe(t, { subscr: y, trans: null }), b = E.trans ? Te(E.transless, g) : g();
|
|
2806
2801
|
return i && b.then(ne, ne), b;
|
|
2807
2802
|
}(f);
|
|
2808
|
-
|
|
2809
|
-
n = !0, e = y, h = !1, o || (d() ? m() : (
|
|
2803
|
+
l || (ue(Le, p), l = !0), h = !0, Promise.resolve(v).then((y) => {
|
|
2804
|
+
n = !0, e = y, h = !1, o || (d() ? m() : (u = {}, a = f, s.next && s.next(y)));
|
|
2810
2805
|
}, (y) => {
|
|
2811
2806
|
h = !1, n = !1, s.error && s.error(y), c.unsubscribe();
|
|
2812
2807
|
});
|
|
@@ -2815,17 +2810,17 @@ function Jr(t) {
|
|
|
2815
2810
|
});
|
|
2816
2811
|
return r.hasValue = () => n, r.getValue = () => e, r;
|
|
2817
2812
|
}
|
|
2818
|
-
let
|
|
2813
|
+
let Qt;
|
|
2819
2814
|
try {
|
|
2820
|
-
|
|
2815
|
+
Qt = { indexedDB: $.indexedDB || $.mozIndexedDB || $.webkitIndexedDB || $.msIndexedDB, IDBKeyRange: $.IDBKeyRange || $.webkitIDBKeyRange };
|
|
2821
2816
|
} catch {
|
|
2822
|
-
|
|
2817
|
+
Qt = { indexedDB: null, IDBKeyRange: null };
|
|
2823
2818
|
}
|
|
2824
|
-
const ce =
|
|
2819
|
+
const ce = Se;
|
|
2825
2820
|
function at(t) {
|
|
2826
2821
|
let e = Z;
|
|
2827
2822
|
try {
|
|
2828
|
-
Z = !0,
|
|
2823
|
+
Z = !0, ue.storagemutated.fire(t);
|
|
2829
2824
|
} finally {
|
|
2830
2825
|
Z = e;
|
|
2831
2826
|
}
|
|
@@ -2833,17 +2828,17 @@ function at(t) {
|
|
|
2833
2828
|
Ce(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) => new ce(t, { addons: [] }).open().then((e) => (e.close(), !0)).catch("NoSuchDatabaseError", () => !1), getDatabaseNames(t) {
|
|
2834
2829
|
try {
|
|
2835
2830
|
return function({ indexedDB: e, IDBKeyRange: n }) {
|
|
2836
|
-
return un(e) ? Promise.resolve(e.databases()).then((r) => r.map((s) => s.name).filter((s) => s !== yt)) :
|
|
2831
|
+
return un(e) ? Promise.resolve(e.databases()).then((r) => r.map((s) => s.name).filter((s) => s !== yt)) : an(e, n).toCollection().primaryKeys();
|
|
2837
2832
|
}(ce.dependencies).then(t);
|
|
2838
2833
|
} catch {
|
|
2839
|
-
return D(new
|
|
2834
|
+
return D(new P.MissingAPI());
|
|
2840
2835
|
}
|
|
2841
2836
|
}, defineClass: () => function(t) {
|
|
2842
2837
|
U(this, t);
|
|
2843
|
-
}, ignoreTransaction: (t) =>
|
|
2838
|
+
}, ignoreTransaction: (t) => E.trans ? Te(E.transless, t) : t(), vip: Ht, async: function(t) {
|
|
2844
2839
|
return function() {
|
|
2845
2840
|
try {
|
|
2846
|
-
var e =
|
|
2841
|
+
var e = Gt(t.apply(this, arguments));
|
|
2847
2842
|
return e && typeof e.then == "function" ? e : S.resolve(e);
|
|
2848
2843
|
} catch (n) {
|
|
2849
2844
|
return D(n);
|
|
@@ -2851,21 +2846,21 @@ Ce(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) =
|
|
|
2851
2846
|
};
|
|
2852
2847
|
}, spawn: function(t, e, n) {
|
|
2853
2848
|
try {
|
|
2854
|
-
var r =
|
|
2849
|
+
var r = Gt(t.apply(n, e || []));
|
|
2855
2850
|
return r && typeof r.then == "function" ? r : S.resolve(r);
|
|
2856
2851
|
} catch (s) {
|
|
2857
2852
|
return D(s);
|
|
2858
2853
|
}
|
|
2859
|
-
}, currentTransaction: { get: () =>
|
|
2854
|
+
}, currentTransaction: { get: () => E.trans || null }, waitFor: function(t, e) {
|
|
2860
2855
|
const n = S.resolve(typeof t == "function" ? ce.ignoreTransaction(t) : t).timeout(e || 6e4);
|
|
2861
|
-
return
|
|
2856
|
+
return E.trans ? E.trans.waitFor(n) : n;
|
|
2862
2857
|
}, Promise: S, debug: { get: () => G, set: (t) => {
|
|
2863
|
-
|
|
2864
|
-
} }, derive:
|
|
2865
|
-
typeof e == "string" ?
|
|
2866
|
-
|
|
2858
|
+
An(t, t === "dexie" ? () => !0 : Wn);
|
|
2859
|
+
} }, derive: _e, extend: U, props: Ce, override: Sn, Events: Ie, on: ue, liveQuery: Hr, extendObservabilitySet: Zn, getByKeyPath: te, setByKeyPath: Y, delByKeyPath: function(t, e) {
|
|
2860
|
+
typeof e == "string" ? Y(t, e, void 0) : "length" in e && [].map.call(e, function(n) {
|
|
2861
|
+
Y(t, n, void 0);
|
|
2867
2862
|
});
|
|
2868
|
-
}, shallowClone:
|
|
2863
|
+
}, shallowClone: Pn, deepClone: Ve, getObjectDiff: ln, cmp: L, asap: Cn, minKey: Mt, addons: [], connections: je, errnames: tn, dependencies: Qt, semVer: mn, version: mn.split(".").map((t) => parseInt(t)).reduce((t, e, n) => t + e / Math.pow(10, 2 * n)) }), ce.maxKey = Ue(ce.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (ue(Le, (t) => {
|
|
2869
2864
|
if (!Z) {
|
|
2870
2865
|
let e;
|
|
2871
2866
|
gt ? (e = document.createEvent("CustomEvent"), e.initCustomEvent(ie, !0, !0, t)) : e = new CustomEvent(ie, { detail: t }), Z = !0, dispatchEvent(e), Z = !1;
|
|
@@ -2876,13 +2871,13 @@ Ce(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) =
|
|
|
2876
2871
|
let Z = !1;
|
|
2877
2872
|
if (typeof BroadcastChannel < "u") {
|
|
2878
2873
|
const t = new BroadcastChannel(ie);
|
|
2879
|
-
typeof t.unref == "function" && t.unref(),
|
|
2874
|
+
typeof t.unref == "function" && t.unref(), ue(Le, (e) => {
|
|
2880
2875
|
Z || t.postMessage(e);
|
|
2881
2876
|
}), t.onmessage = (e) => {
|
|
2882
2877
|
e.data && at(e.data);
|
|
2883
2878
|
};
|
|
2884
2879
|
} else if (typeof self < "u" && typeof navigator < "u") {
|
|
2885
|
-
|
|
2880
|
+
ue(Le, (e) => {
|
|
2886
2881
|
try {
|
|
2887
2882
|
Z || (typeof localStorage < "u" && localStorage.setItem(ie, JSON.stringify({ trig: Math.random(), changedParts: e })), typeof self.clients == "object" && [...self.clients.matchAll({ includeUncontrolled: !0 })].forEach((n) => n.postMessage({ type: ie, changedParts: e })));
|
|
2888
2883
|
} catch {
|
|
@@ -2899,248 +2894,15 @@ if (typeof BroadcastChannel < "u") {
|
|
|
2899
2894
|
});
|
|
2900
2895
|
}
|
|
2901
2896
|
S.rejectionMapper = function(t, e) {
|
|
2902
|
-
if (!t || t instanceof
|
|
2897
|
+
if (!t || t instanceof ke || t instanceof TypeError || t instanceof SyntaxError || !t.name || !hn[t.name])
|
|
2903
2898
|
return t;
|
|
2904
|
-
var n = new
|
|
2899
|
+
var n = new hn[t.name](e || t.message, t);
|
|
2905
2900
|
return "stack" in t && ee(n, "stack", { get: function() {
|
|
2906
2901
|
return this.inner.stack;
|
|
2907
2902
|
} }), n;
|
|
2908
|
-
},
|
|
2909
|
-
class Zr extends pe {
|
|
2910
|
-
constructor() {
|
|
2911
|
-
super("NylasAuthDatabase"), Et(this, "grant"), Et(this, "pkce"), this.version(1).stores({
|
|
2912
|
-
grant: "++id,token",
|
|
2913
|
-
pkce: "++id,codeVerifier"
|
|
2914
|
-
}), this.grant = this.table("grant"), this.pkce = this.table("pkce");
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
class es {
|
|
2918
|
-
constructor() {
|
|
2919
|
-
Et(this, "theDB"), this.theDB = new Zr();
|
|
2920
|
-
}
|
|
2921
|
-
async setCodeVerifier(e) {
|
|
2922
|
-
await this.theDB.pkce.put({ id: 1, codeVerifier: e }, 1);
|
|
2923
|
-
}
|
|
2924
|
-
async getCodeVerifier() {
|
|
2925
|
-
const [e] = await this.theDB.pkce.toArray();
|
|
2926
|
-
return e ? e.codeVerifier : null;
|
|
2927
|
-
}
|
|
2928
|
-
async getTokenInfo() {
|
|
2929
|
-
const e = await this.theDB.grant.get(1);
|
|
2930
|
-
return e ? e.token : null;
|
|
2931
|
-
}
|
|
2932
|
-
async setTokenInfo(e) {
|
|
2933
|
-
await this.theDB.grant.put({ id: 1, token: e }, 1);
|
|
2934
|
-
}
|
|
2935
|
-
async reset() {
|
|
2936
|
-
await this.theDB.grant.clear();
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
function ss(t) {
|
|
2940
|
-
const e = "NylasAuth";
|
|
2941
|
-
if (!t)
|
|
2942
|
-
throw new Error("NylasAuth requires a config object");
|
|
2943
|
-
let n = null;
|
|
2944
|
-
if (t.storageType === "indexeddb" && (n = new es()), !n)
|
|
2945
|
-
throw new Error("NylasAuth requires a storage object");
|
|
2946
|
-
const r = [
|
|
2947
|
-
{
|
|
2948
|
-
type: "read-only",
|
|
2949
|
-
value: "https://www.googleapis.com/auth/gmail.readonly"
|
|
2950
|
-
},
|
|
2951
|
-
{
|
|
2952
|
-
type: "modify",
|
|
2953
|
-
value: "https://www.googleapis.com/auth/gmail.modify"
|
|
2954
|
-
},
|
|
2955
|
-
{
|
|
2956
|
-
type: "compose",
|
|
2957
|
-
value: "https://www.googleapis.com/auth/gmail.compose"
|
|
2958
|
-
},
|
|
2959
|
-
{
|
|
2960
|
-
type: "insert",
|
|
2961
|
-
value: "https://www.googleapis.com/auth/gmail.insert"
|
|
2962
|
-
},
|
|
2963
|
-
{
|
|
2964
|
-
type: "labels",
|
|
2965
|
-
value: "https://www.googleapis.com/auth/gmail.labels"
|
|
2966
|
-
},
|
|
2967
|
-
{
|
|
2968
|
-
type: "metadata",
|
|
2969
|
-
value: "https://www.googleapis.com/auth/gmail.metadata"
|
|
2970
|
-
},
|
|
2971
|
-
{
|
|
2972
|
-
type: "settings.basic",
|
|
2973
|
-
value: "https://www.googleapis.com/auth/gmail.settings.basic"
|
|
2974
|
-
},
|
|
2975
|
-
{
|
|
2976
|
-
type: "settings.sharing",
|
|
2977
|
-
value: "https://www.googleapis.com/auth/gmail.settings.sharing"
|
|
2978
|
-
}
|
|
2979
|
-
], s = [
|
|
2980
|
-
{
|
|
2981
|
-
type: "read-only",
|
|
2982
|
-
value: "https://outlook.office.com/mail.read"
|
|
2983
|
-
},
|
|
2984
|
-
{
|
|
2985
|
-
type: "modify",
|
|
2986
|
-
value: "https://outlook.office.com/mail.readwrite"
|
|
2987
|
-
},
|
|
2988
|
-
{
|
|
2989
|
-
type: "send",
|
|
2990
|
-
value: "https://outlook.office.com/mail.send"
|
|
2991
|
-
},
|
|
2992
|
-
{
|
|
2993
|
-
type: "offline",
|
|
2994
|
-
value: "offline_access"
|
|
2995
|
-
}
|
|
2996
|
-
];
|
|
2997
|
-
async function i(o, l, a, c = !0, h, u) {
|
|
2998
|
-
const d = await (n == null ? void 0 : n.getTokenInfo()), p = new URL(o, h ?? t.apiUri), m = new Headers();
|
|
2999
|
-
m.append("Accept", "application/json"), m.append("Content-Type", "application/json"), m.append("User-Agent", e), d && m.append("Authorization", `Bearer ${d.access_token}`);
|
|
3000
|
-
const f = await fetch(p.toString(), {
|
|
3001
|
-
method: l || "GET",
|
|
3002
|
-
headers: m,
|
|
3003
|
-
mode: "cors",
|
|
3004
|
-
referrer: location.origin,
|
|
3005
|
-
body: a ? JSON.stringify(a) : void 0,
|
|
3006
|
-
...u || {}
|
|
3007
|
-
});
|
|
3008
|
-
return c ? await f.json() : f.body;
|
|
3009
|
-
}
|
|
3010
|
-
return {
|
|
3011
|
-
config: t,
|
|
3012
|
-
/**
|
|
3013
|
-
* This method will make a request to the Nylas API to exchange an authorization code for an access token.
|
|
3014
|
-
* @param scopes The scopes that were used to generate the authorization code
|
|
3015
|
-
* @param email The email that was used to generate the authorization code
|
|
3016
|
-
* @param provider The provider that was used to generate the authorization code
|
|
3017
|
-
* @returns A promise that resolves to a URL string that can be used to redirect the user to the Nylas API to complete the authorization flow
|
|
3018
|
-
*/
|
|
3019
|
-
async getHostedAuthRedirectURL(o = t.defaultScopes, l, a) {
|
|
3020
|
-
const c = await dn(Math.random().toString()), h = await dn(c);
|
|
3021
|
-
await (n == null ? void 0 : n.setCodeVerifier(c));
|
|
3022
|
-
const u = new URL(`${t.apiUri}/v3/connect/auth`);
|
|
3023
|
-
return u.searchParams.set("client_id", t.clientId), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", o.join(" ")), u.searchParams.set("redirect_uri", t.redirectURI), u.searchParams.set("access_type", "offline"), u.searchParams.set("code_challenge", h), u.searchParams.set("code_challenge_method", "S256"), u.searchParams.set("options", "rotate_refresh_token"), a && u.searchParams.set("provider", a), l && u.searchParams.set("login_hint", l), u.toString();
|
|
3024
|
-
},
|
|
3025
|
-
/**
|
|
3026
|
-
* This method will make a request to the Nylas API to exchange an authorization code for an access token.
|
|
3027
|
-
* @param path A path to the Nylas API, e.g. `/v3/grants/methreads`
|
|
3028
|
-
* @param method GET, POST, PUT, DELETE, etc.
|
|
3029
|
-
* @param body A JSON object to send as the body of the request
|
|
3030
|
-
* @param domain The domain to use for the request, e.g. `api.us.nylas.com`
|
|
3031
|
-
* @param parseJSON Whether to parse the response as JSON or return the raw response (default: true)
|
|
3032
|
-
* @returns
|
|
3033
|
-
*/
|
|
3034
|
-
nylasAPIRequest: i,
|
|
3035
|
-
/**
|
|
3036
|
-
* This method will make a request to the Nylas API to exchange an authorization code for an access token.
|
|
3037
|
-
* @param code The authorization code that was returned from the Nylas API
|
|
3038
|
-
* @returns A promise that resolves to a TokenExchangeResponse object
|
|
3039
|
-
*/
|
|
3040
|
-
async exchangeAuthCodeForTokenInfo(o) {
|
|
3041
|
-
if (!o)
|
|
3042
|
-
return null;
|
|
3043
|
-
const l = await (n == null ? void 0 : n.getCodeVerifier()), a = await this.nylasAPIRequest("/v3/connect/token", "POST", {
|
|
3044
|
-
code: o,
|
|
3045
|
-
client_id: t.clientId,
|
|
3046
|
-
grant_type: "authorization_code",
|
|
3047
|
-
redirect_uri: t.redirectURI,
|
|
3048
|
-
code_verifier: l
|
|
3049
|
-
});
|
|
3050
|
-
return "error" in a || await (n == null ? void 0 : n.setTokenInfo(a)), a;
|
|
3051
|
-
},
|
|
3052
|
-
/**
|
|
3053
|
-
* This method will make a `application/octet-stream` request to the Nylas API to download a file.
|
|
3054
|
-
*/
|
|
3055
|
-
async nylasDownloadFileRequest(o, l = "GET", a) {
|
|
3056
|
-
const c = await (n == null ? void 0 : n.getTokenInfo()), h = new URL(o, t.apiUri), u = new Headers();
|
|
3057
|
-
return u.append("Accept", "application/json"), u.append("Content-Type", "application/octet-stream"), u.append("User-Agent", e), c && u.append("Authorization", `Bearer ${c.access_token}`), (await fetch(h.toString(), {
|
|
3058
|
-
method: l,
|
|
3059
|
-
headers: u,
|
|
3060
|
-
mode: "cors",
|
|
3061
|
-
referrer: location.origin,
|
|
3062
|
-
body: a ? JSON.stringify(a) : void 0
|
|
3063
|
-
})).blob();
|
|
3064
|
-
},
|
|
3065
|
-
/**
|
|
3066
|
-
* This methid will clear the access token from the storage object
|
|
3067
|
-
*/
|
|
3068
|
-
async logout() {
|
|
3069
|
-
const o = await (n == null ? void 0 : n.getTokenInfo());
|
|
3070
|
-
o && await this.nylasAPIRequest(`/v3/connect/revoke?token=${o.access_token}`, "POST"), await (n == null ? void 0 : n.reset());
|
|
3071
|
-
},
|
|
3072
|
-
/**
|
|
3073
|
-
* This method will make a request to the Nylas API to exchange an authorization code for an access token.
|
|
3074
|
-
* @returns A promise that resolves to a boolean indicating whether the user is authenticated
|
|
3075
|
-
*/
|
|
3076
|
-
async isAuthenticated() {
|
|
3077
|
-
return !!await (n == null ? void 0 : n.getTokenInfo());
|
|
3078
|
-
},
|
|
3079
|
-
/**
|
|
3080
|
-
* This method will return information about the current access token.
|
|
3081
|
-
* @returns A promise with the token info
|
|
3082
|
-
*/
|
|
3083
|
-
async getTokenInfo() {
|
|
3084
|
-
const o = await (n == null ? void 0 : n.getTokenInfo());
|
|
3085
|
-
if (!o)
|
|
3086
|
-
return null;
|
|
3087
|
-
const { access_token: l, ...a } = o;
|
|
3088
|
-
return a;
|
|
3089
|
-
},
|
|
3090
|
-
/**
|
|
3091
|
-
* This method will make a request to the Nylas API to validate if the current access token is valid.
|
|
3092
|
-
* @returns A promise that resolves to a boolean indicating whether the current access token is valid
|
|
3093
|
-
*/
|
|
3094
|
-
async isAccessTokenValid() {
|
|
3095
|
-
const o = await (n == null ? void 0 : n.getTokenInfo());
|
|
3096
|
-
return o ? "data" in await this.nylasAPIRequest(`/v3/connect/tokeninfo?id_token=${o.id_token}`, "GET") : !1;
|
|
3097
|
-
},
|
|
3098
|
-
/**
|
|
3099
|
-
* This method will make a request to the Nylas API to refresh the current access token.
|
|
3100
|
-
* @returns A promise that resolves to a TokenExchangeResponse object
|
|
3101
|
-
*/
|
|
3102
|
-
async refreshAccessToken() {
|
|
3103
|
-
const o = await (n == null ? void 0 : n.getTokenInfo());
|
|
3104
|
-
if (!o)
|
|
3105
|
-
return null;
|
|
3106
|
-
const l = await this.nylasAPIRequest("/v3/connect/token", "POST", {
|
|
3107
|
-
client_id: t.clientId,
|
|
3108
|
-
grant_type: "refresh_token",
|
|
3109
|
-
refresh_token: o.refresh_token
|
|
3110
|
-
});
|
|
3111
|
-
return "error" in l || await (n == null ? void 0 : n.setTokenInfo(l)), l;
|
|
3112
|
-
},
|
|
3113
|
-
/**
|
|
3114
|
-
* This method will return true if the current access token has the given scope
|
|
3115
|
-
* based on the type of scope (e.g. 'read-only', 'modify', 'compose', 'insert', 'labels', 'metadata', 'settings.basic', or 'settings.sharing')
|
|
3116
|
-
* @param type Either 'read-only', 'modify', 'compose', 'insert', 'labels', 'metadata', 'settings.basic', or 'settings.sharing'
|
|
3117
|
-
*/
|
|
3118
|
-
async hasScopeByType(o = "email", l) {
|
|
3119
|
-
const a = await (n == null ? void 0 : n.getTokenInfo());
|
|
3120
|
-
if (!a)
|
|
3121
|
-
return !1;
|
|
3122
|
-
const c = a.scope.toLowerCase().split(" ");
|
|
3123
|
-
let h = [];
|
|
3124
|
-
const u = Array.isArray(l) ? l : [l];
|
|
3125
|
-
return o === "email" && (h = [...s, ...r].filter((d) => u.includes(d.type))), h.every((d) => c.includes(d.value));
|
|
3126
|
-
},
|
|
3127
|
-
/**
|
|
3128
|
-
* A helper method to check if the current access token has a given scope.
|
|
3129
|
-
* @param scope The scope(s) to check for in the current access token (e.g. https://www.googleapis.com/auth/gmail.modify)
|
|
3130
|
-
* @returns boolean indicating whether the current access token has the given scope
|
|
3131
|
-
*/
|
|
3132
|
-
async hasScope(o) {
|
|
3133
|
-
const l = await (n == null ? void 0 : n.getTokenInfo());
|
|
3134
|
-
if (!l)
|
|
3135
|
-
return !1;
|
|
3136
|
-
const a = l.scope.toLowerCase().split(" ");
|
|
3137
|
-
return (Array.isArray(o) ? o : [o]).some((c) => a.includes(c.toLowerCase()));
|
|
3138
|
-
}
|
|
3139
|
-
};
|
|
3140
|
-
}
|
|
2903
|
+
}, An(G, Wn);
|
|
3141
2904
|
export {
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
ar as n
|
|
2905
|
+
Xr as N,
|
|
2906
|
+
Qr as X,
|
|
2907
|
+
rr as n
|
|
3146
2908
|
};
|