@zh-keyboard/vue
Version:
基于Vue的中文虚拟键盘组件
1,240 lines • 213 kB
JavaScript
var Ui = Object.defineProperty;
var Yi = (g, k, O) => k in g ? Ui(g, k, { enumerable: !0, configurable: !0, writable: !0, value: O }) : g[k] = O;
var he = (g, k, O) => Yi(g, typeof k != "symbol" ? k + "" : k, O);
import { watch as bt, getCurrentScope as Xi, onScopeDispose as Gi, onMounted as fr, nextTick as hr, getCurrentInstance as ti, computed as we, toValue as mt, shallowRef as vn, watchEffect as gn, unref as Se, ref as de, onUnmounted as ni, defineComponent as Ve, createElementBlock as J, openBlock as U, Fragment as xe, renderList as Re, toDisplayString as Ee, createVNode as ri, createElementVNode as L, createTextVNode as pn, normalizeStyle as Qr, mergeModels as ur, useModel as ii, withDirectives as ai, createCommentVNode as gt, createBlock as ot, vShow as oi, normalizeClass as Rt, Teleport as Qi, mergeProps as Zi, withModifiers as Ji } from "vue";
function bn(g) {
return Xi() ? (Gi(g), !0) : !1;
}
const ea = typeof window < "u" && typeof document < "u";
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
const ta = (g) => g != null, na = Object.prototype.toString, ra = (g) => na.call(g) === "[object Object]", ia = () => {
};
function Bt(g) {
return Array.isArray(g) ? g : [g];
}
function aa(g) {
return ti();
}
function oa(g, k = !0, O) {
aa() ? fr(g, O) : k ? g() : hr(g);
}
function sa(g, k, O) {
return bt(
g,
k,
{
...O,
immediate: !0
}
);
}
const wt = ea ? window : void 0;
function Ie(g) {
var k;
const O = mt(g);
return (k = O == null ? void 0 : O.$el) != null ? k : O;
}
function yn(...g) {
const k = [], O = () => {
k.forEach((D) => D()), k.length = 0;
}, _ = (D, I, V, M) => (D.addEventListener(I, V, M), () => D.removeEventListener(I, V, M)), K = we(() => {
const D = Bt(mt(g[0])).filter((I) => I != null);
return D.every((I) => typeof I != "string") ? D : void 0;
}), E = sa(
() => {
var D, I;
return [
(I = (D = K.value) == null ? void 0 : D.map((V) => Ie(V))) != null ? I : [wt].filter((V) => V != null),
Bt(mt(K.value ? g[1] : g[0])),
Bt(Se(K.value ? g[2] : g[1])),
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
mt(K.value ? g[3] : g[2])
];
},
([D, I, V, M]) => {
if (O(), !(D != null && D.length) || !(I != null && I.length) || !(V != null && V.length))
return;
const q = ra(M) ? { ...M } : M;
k.push(
...D.flatMap(
(F) => I.flatMap(
(ne) => V.map((W) => _(F, ne, W, q))
)
)
);
},
{ flush: "post" }
), C = () => {
E(), O();
};
return bn(O), C;
}
function ua() {
const g = vn(!1), k = ti();
return k && fr(() => {
g.value = !0;
}, k), g;
}
function si(g) {
const k = ua();
return we(() => (k.value, !!g()));
}
function ca(g, k, O = {}) {
const { window: _ = wt, ...K } = O;
let E;
const C = si(() => _ && "MutationObserver" in _), D = () => {
E && (E.disconnect(), E = void 0);
}, I = we(() => {
const F = mt(g), ne = Bt(F).map(Ie).filter(ta);
return new Set(ne);
}), V = bt(
() => I.value,
(F) => {
D(), C.value && F.size && (E = new MutationObserver(k), F.forEach((ne) => E.observe(ne, K)));
},
{ immediate: !0, flush: "post" }
), M = () => E == null ? void 0 : E.takeRecords(), q = () => {
V(), D();
};
return bn(q), {
isSupported: C,
stop: q,
takeRecords: M
};
}
function la(g, k, O = {}) {
const {
window: _ = wt,
document: K = _ == null ? void 0 : _.document,
flush: E = "sync"
} = O;
if (!_ || !K)
return ia;
let C;
const D = (M) => {
C == null || C(), C = M;
}, I = gn(() => {
const M = Ie(g);
if (M) {
const { stop: q } = ca(
K,
(F) => {
F.map((W) => [...W.removedNodes]).flat().some((W) => W === M || W.contains(M)) && k(F);
},
{
window: _,
childList: !0,
subtree: !0
}
);
D(q);
}
}, { flush: E }), V = () => {
I(), D();
};
return bn(V), V;
}
function fa(g = {}) {
var k;
const {
window: O = wt,
deep: _ = !0,
triggerOnRemoval: K = !1
} = g, E = (k = g.document) != null ? k : O == null ? void 0 : O.document, C = () => {
var V;
let M = E == null ? void 0 : E.activeElement;
if (_)
for (; M != null && M.shadowRoot; )
M = (V = M == null ? void 0 : M.shadowRoot) == null ? void 0 : V.activeElement;
return M;
}, D = vn(), I = () => {
D.value = C();
};
if (O) {
const V = {
capture: !0,
passive: !0
};
yn(
O,
"blur",
(M) => {
M.relatedTarget === null && I();
},
V
), yn(
O,
"focus",
I,
V
);
}
return K && la(D, I, { document: E }), I(), D;
}
function ha(g, k, O = {}) {
const { window: _ = wt, ...K } = O;
let E;
const C = si(() => _ && "ResizeObserver" in _), D = () => {
E && (E.disconnect(), E = void 0);
}, I = we(() => {
const q = mt(g);
return Array.isArray(q) ? q.map((F) => Ie(F)) : [Ie(q)];
}), V = bt(
I,
(q) => {
if (D(), C.value && _) {
E = new ResizeObserver(k);
for (const F of q)
F && E.observe(F, K);
}
},
{ immediate: !0, flush: "post" }
), M = () => {
D(), V();
};
return bn(M), {
isSupported: C,
stop: M
};
}
function ui(g, k = { width: 0, height: 0 }, O = {}) {
const { window: _ = wt, box: K = "content-box" } = O, E = we(() => {
var q, F;
return (F = (q = Ie(g)) == null ? void 0 : q.namespaceURI) == null ? void 0 : F.includes("svg");
}), C = vn(k.width), D = vn(k.height), { stop: I } = ha(
g,
([q]) => {
const F = K === "border-box" ? q.borderBoxSize : K === "content-box" ? q.contentBoxSize : q.devicePixelContentBoxSize;
if (_ && E.value) {
const ne = Ie(g);
if (ne) {
const W = ne.getBoundingClientRect();
C.value = W.width, D.value = W.height;
}
} else if (F) {
const ne = Bt(F);
C.value = ne.reduce((W, { inlineSize: H }) => W + H, 0), D.value = ne.reduce((W, { blockSize: H }) => W + H, 0);
} else
C.value = q.contentRect.width, D.value = q.contentRect.height;
},
O
);
oa(() => {
const q = Ie(g);
q && (C.value = "offsetWidth" in q ? q.offsetWidth : k.width, D.value = "offsetHeight" in q ? q.offsetHeight : k.height);
});
const V = bt(
() => Ie(g),
(q) => {
C.value = q ? k.width : 0, D.value = q ? k.height : 0;
}
);
function M() {
I(), V();
}
return {
width: C,
height: D,
stop: M
};
}
var da = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function va(g) {
return g && g.__esModule && Object.prototype.hasOwnProperty.call(g, "default") ? g.default : g;
}
var dn = { exports: {} }, pa = dn.exports, Zr;
function ya() {
return Zr || (Zr = 1, function(g, k) {
(function(O, _) {
g.exports = _();
})(pa, function() {
var O = function(e, t) {
return (O = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
n.__proto__ = r;
} || function(n, r) {
for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]);
})(e, t);
}, _ = function() {
return (_ = Object.assign || function(e) {
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
return e;
}).apply(this, arguments);
};
function K(e, t, n) {
for (var r, i = 0, a = t.length; i < a; i++) !r && i in t || ((r = r || Array.prototype.slice.call(t, 0, i))[i] = t[i]);
return e.concat(r || Array.prototype.slice.call(t));
}
var E = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : da, C = Object.keys, D = Array.isArray;
function I(e, t) {
return typeof t != "object" || C(t).forEach(function(n) {
e[n] = t[n];
}), e;
}
typeof Promise > "u" || E.Promise || (E.Promise = Promise);
var V = Object.getPrototypeOf, M = {}.hasOwnProperty;
function q(e, t) {
return M.call(e, t);
}
function F(e, t) {
typeof t == "function" && (t = t(V(e))), (typeof Reflect > "u" ? C : Reflect.ownKeys)(t).forEach(function(n) {
W(e, n, t[n]);
});
}
var ne = Object.defineProperty;
function W(e, t, n, r) {
ne(e, t, I(n && q(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
}
function H(e) {
return { from: function(t) {
return e.prototype = Object.create(t.prototype), W(e.prototype, "constructor", e), { extend: F.bind(null, e.prototype) };
} };
}
var ve = Object.getOwnPropertyDescriptor, He = [].slice;
function Oe(e, t, n) {
return He.call(e, t, n);
}
function We(e, t) {
return t(e);
}
function pe(e) {
if (!e) throw new Error("Assertion Failed");
}
function ie(e) {
E.setImmediate ? setImmediate(e) : setTimeout(e, 0);
}
function G(e, t) {
if (typeof t == "string" && q(e, t)) return e[t];
if (!t) return e;
if (typeof t != "string") {
for (var n = [], r = 0, i = t.length; r < i; ++r) {
var a = G(e, t[r]);
n.push(a);
}
return n;
}
var o = t.indexOf(".");
if (o !== -1) {
var s = e[t.substr(0, o)];
return s == null ? void 0 : G(s, t.substr(o + 1));
}
}
function re(e, t, n) {
if (e && t !== void 0 && !("isFrozen" in Object && Object.isFrozen(e))) if (typeof t != "string" && "length" in t) {
pe(typeof n != "string" && "length" in n);
for (var r = 0, i = t.length; r < i; ++r) re(e, t[r], n[r]);
} else {
var a, o, s = t.indexOf(".");
s !== -1 ? (a = t.substr(0, s), (o = t.substr(s + 1)) === "" ? n === void 0 ? D(e) && !isNaN(parseInt(a)) ? e.splice(a, 1) : delete e[a] : e[a] = n : re(s = !(s = e[a]) || !q(e, a) ? e[a] = {} : s, o, n)) : n === void 0 ? D(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
}
}
function De(e) {
var t, n = {};
for (t in e) q(e, t) && (n[t] = e[t]);
return n;
}
var wn = [].concat;
function _n(e) {
return wn.apply([], e);
}
var Ge = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(_n([8, 16, 32, 64].map(function(e) {
return ["Int", "Uint", "Float"].map(function(t) {
return t + e + "Array";
});
}))).filter(function(e) {
return E[e];
}), pr = new Set(Ge.map(function(e) {
return E[e];
})), _t = null;
function Ue(e) {
return _t = /* @__PURE__ */ new WeakMap(), e = function t(n) {
if (!n || typeof n != "object") return n;
var r = _t.get(n);
if (r) return r;
if (D(n)) {
r = [], _t.set(n, r);
for (var i = 0, a = n.length; i < a; ++i) r.push(t(n[i]));
} else if (pr.has(n.constructor)) r = n;
else {
var o, s = V(n);
for (o in r = s === Object.prototype ? {} : Object.create(s), _t.set(n, r), n) q(n, o) && (r[o] = t(n[o]));
}
return r;
}(e), _t = null, e;
}
var di = {}.toString;
function kn(e) {
return di.call(e).slice(8, -1);
}
var xn = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", vi = typeof xn == "symbol" ? function(e) {
var t;
return e != null && (t = e[xn]) && t.apply(e);
} : function() {
return null;
};
function Ye(e, t) {
return t = e.indexOf(t), 0 <= t && e.splice(t, 1), 0 <= t;
}
var st = {};
function Ae(e) {
var t, n, r, i;
if (arguments.length === 1) {
if (D(e)) return e.slice();
if (this === st && typeof e == "string") return [e];
if (i = vi(e)) {
for (n = []; !(r = i.next()).done; ) n.push(r.value);
return n;
}
if (e == null) return [e];
if (typeof (t = e.length) != "number") return [e];
for (n = new Array(t); t--; ) n[t] = e[t];
return n;
}
for (t = arguments.length, n = new Array(t); t--; ) n[t] = arguments[t];
return n;
}
var Cn = typeof Symbol < "u" ? function(e) {
return e[Symbol.toStringTag] === "AsyncFunction";
} : function() {
return !1;
}, Ct = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], Ce = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(Ct), pi = { 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" };
function ut(e, t) {
this.name = e, this.message = t;
}
function yr(e, t) {
return e + ". Errors: " + Object.keys(t).map(function(n) {
return t[n].toString();
}).filter(function(n, r, i) {
return i.indexOf(n) === r;
}).join(`
`);
}
function qt(e, t, n, r) {
this.failures = t, this.failedKeys = r, this.successCount = n, this.message = yr(e, t);
}
function ct(e, t) {
this.name = "BulkError", this.failures = Object.keys(t).map(function(n) {
return t[n];
}), this.failuresByPos = t, this.message = yr(e, this.failures);
}
H(ut).from(Error).extend({ toString: function() {
return this.name + ": " + this.message;
} }), H(qt).from(ut), H(ct).from(ut);
var En = Ce.reduce(function(e, t) {
return e[t] = t + "Error", e;
}, {}), yi = ut, N = Ce.reduce(function(e, t) {
var n = t + "Error";
function r(i, a) {
this.name = n, i ? typeof i == "string" ? (this.message = "".concat(i).concat(a ? `
` + a : ""), this.inner = a || null) : typeof i == "object" && (this.message = "".concat(i.name, " ").concat(i.message), this.inner = i) : (this.message = pi[t] || n, this.inner = null);
}
return H(r).from(yi), e[t] = r, e;
}, {});
N.Syntax = SyntaxError, N.Type = TypeError, N.Range = RangeError;
var mr = Ct.reduce(function(e, t) {
return e[t + "Error"] = N[t], e;
}, {}), Mt = Ce.reduce(function(e, t) {
return ["Syntax", "Type", "Range"].indexOf(t) === -1 && (e[t + "Error"] = N[t]), e;
}, {});
function ae() {
}
function kt(e) {
return e;
}
function mi(e, t) {
return e == null || e === kt ? t : function(n) {
return t(e(n));
};
}
function Xe(e, t) {
return function() {
e.apply(this, arguments), t.apply(this, arguments);
};
}
function gi(e, t) {
return e === ae ? t : function() {
var n = e.apply(this, arguments);
n !== void 0 && (arguments[0] = n);
var r = this.onsuccess, i = this.onerror;
this.onsuccess = null, this.onerror = null;
var a = t.apply(this, arguments);
return r && (this.onsuccess = this.onsuccess ? Xe(r, this.onsuccess) : r), i && (this.onerror = this.onerror ? Xe(i, this.onerror) : i), a !== void 0 ? a : n;
};
}
function bi(e, t) {
return e === ae ? t : function() {
e.apply(this, arguments);
var n = this.onsuccess, r = this.onerror;
this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? Xe(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? Xe(r, this.onerror) : r);
};
}
function wi(e, t) {
return e === ae ? t : function(n) {
var r = e.apply(this, arguments);
I(n, r);
var i = this.onsuccess, a = this.onerror;
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), i && (this.onsuccess = this.onsuccess ? Xe(i, this.onsuccess) : i), a && (this.onerror = this.onerror ? Xe(a, this.onerror) : a), r === void 0 ? n === void 0 ? void 0 : n : I(r, n);
};
}
function _i(e, t) {
return e === ae ? t : function() {
return t.apply(this, arguments) !== !1 && e.apply(this, arguments);
};
}
function On(e, t) {
return e === ae ? t : function() {
var n = e.apply(this, arguments);
if (n && typeof n.then == "function") {
for (var r = this, i = arguments.length, a = new Array(i); i--; ) a[i] = arguments[i];
return n.then(function() {
return t.apply(r, a);
});
}
return t.apply(this, arguments);
};
}
Mt.ModifyError = qt, Mt.DexieError = ut, Mt.BulkError = ct;
var Pe = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
function gr(e) {
Pe = e;
}
var xt = {}, br = 100, Ge = typeof Promise > "u" ? [] : function() {
var e = Promise.resolve();
if (typeof crypto > "u" || !crypto.subtle) return [e, V(e), e];
var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
return [t, V(t), e];
}(), Ct = Ge[0], Ce = Ge[1], Ge = Ge[2], Ce = Ce && Ce.then, Qe = Ct && Ct.constructor, Sn = !!Ge, Et = function(e, t) {
Ot.push([e, t]), $t && (queueMicrotask(xi), $t = !1);
}, Pn = !0, $t = !0, Ze = [], Lt = [], Kn = kt, Be = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: ae, pgp: !1, env: {}, finalize: ae }, $ = Be, Ot = [], Je = 0, Nt = [];
function R(e) {
if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
this._listeners = [], this._lib = !1;
var t = this._PSD = $;
if (typeof e != "function") {
if (e !== xt) throw new TypeError("Not a function");
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Dn(this, this._value));
}
this._state = null, this._value = null, ++t.ref, function n(r, i) {
try {
i(function(a) {
if (r._state === null) {
if (a === r) throw new TypeError("A promise cannot be resolved with itself.");
var o = r._lib && lt();
a && typeof a.then == "function" ? n(r, function(s, c) {
a instanceof R ? a._then(s, c) : a.then(s, c);
}) : (r._state = !0, r._value = a, _r(r)), o && ft();
}
}, Dn.bind(null, r));
} catch (a) {
Dn(r, a);
}
}(this, e);
}
var zn = { get: function() {
var e = $, t = Wt;
function n(r, i) {
var a = this, o = !e.global && (e !== $ || t !== Wt), s = o && !Me(), c = new R(function(f, v) {
An(a, new wr(xr(r, e, o, s), xr(i, e, o, s), f, v, e));
});
return this._consoleTask && (c._consoleTask = this._consoleTask), c;
}
return n.prototype = xt, n;
}, set: function(e) {
W(this, "then", e && e.prototype === xt ? zn : { get: function() {
return e;
}, set: zn.set });
} };
function wr(e, t, n, r, i) {
this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = i;
}
function Dn(e, t) {
var n, r;
Lt.push(t), e._state === null && (n = e._lib && lt(), t = Kn(t), e._state = !1, e._value = t, r = e, Ze.some(function(i) {
return i._value === r._value;
}) || Ze.push(r), _r(e), n && ft());
}
function _r(e) {
var t = e._listeners;
e._listeners = [];
for (var n = 0, r = t.length; n < r; ++n) An(e, t[n]);
var i = e._PSD;
--i.ref || i.finalize(), Je === 0 && (++Je, Et(function() {
--Je == 0 && Tn();
}, []));
}
function An(e, t) {
if (e._state !== null) {
var n = e._state ? t.onFulfilled : t.onRejected;
if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
++t.psd.ref, ++Je, Et(ki, [n, e, t]);
} else e._listeners.push(t);
}
function ki(e, t, n) {
try {
var r, i = t._value;
!t._state && Lt.length && (Lt = []), r = Pe && t._consoleTask ? t._consoleTask.run(function() {
return e(i);
}) : e(i), t._state || Lt.indexOf(i) !== -1 || function(a) {
for (var o = Ze.length; o; ) if (Ze[--o]._value === a._value) return Ze.splice(o, 1);
}(t), n.resolve(r);
} catch (a) {
n.reject(a);
} finally {
--Je == 0 && Tn(), --n.psd.ref || n.psd.finalize();
}
}
function xi() {
et(Be, function() {
lt() && ft();
});
}
function lt() {
var e = Pn;
return $t = Pn = !1, e;
}
function ft() {
var e, t, n;
do
for (; 0 < Ot.length; ) for (e = Ot, Ot = [], n = e.length, t = 0; t < n; ++t) {
var r = e[t];
r[0].apply(null, r[1]);
}
while (0 < Ot.length);
$t = Pn = !0;
}
function Tn() {
var e = Ze;
Ze = [], e.forEach(function(r) {
r._PSD.onunhandled.call(null, r._value, r);
});
for (var t = Nt.slice(0), n = t.length; n; ) t[--n]();
}
function Ft(e) {
return new R(xt, !1, e);
}
function se(e, t) {
var n = $;
return function() {
var r = lt(), i = $;
try {
return $e(n, !0), e.apply(this, arguments);
} catch (a) {
t && t(a);
} finally {
$e(i, !1), r && ft();
}
};
}
F(R.prototype, { then: zn, _then: function(e, t) {
An(this, new wr(null, null, e, t, $));
}, catch: function(e) {
if (arguments.length === 1) return this.then(null, e);
var t = e, n = arguments[1];
return typeof t == "function" ? this.then(null, function(r) {
return (r instanceof t ? n : Ft)(r);
}) : this.then(null, function(r) {
return (r && r.name === t ? n : Ft)(r);
});
}, finally: function(e) {
return this.then(function(t) {
return R.resolve(e()).then(function() {
return t;
});
}, function(t) {
return R.resolve(e()).then(function() {
return Ft(t);
});
});
}, timeout: function(e, t) {
var n = this;
return e < 1 / 0 ? new R(function(r, i) {
var a = setTimeout(function() {
return i(new N.Timeout(t));
}, e);
n.then(r, i).finally(clearTimeout.bind(null, a));
}) : this;
} }), typeof Symbol < "u" && Symbol.toStringTag && W(R.prototype, Symbol.toStringTag, "Dexie.Promise"), Be.env = kr(), F(R, { all: function() {
var e = Ae.apply(null, arguments).map(Ut);
return new R(function(t, n) {
e.length === 0 && t([]);
var r = e.length;
e.forEach(function(i, a) {
return R.resolve(i).then(function(o) {
e[a] = o, --r || t(e);
}, n);
});
});
}, resolve: function(e) {
return e instanceof R ? e : e && typeof e.then == "function" ? new R(function(t, n) {
e.then(t, n);
}) : new R(xt, !0, e);
}, reject: Ft, race: function() {
var e = Ae.apply(null, arguments).map(Ut);
return new R(function(t, n) {
e.map(function(r) {
return R.resolve(r).then(t, n);
});
});
}, PSD: { get: function() {
return $;
}, set: function(e) {
return $ = e;
} }, totalEchoes: { get: function() {
return Wt;
} }, newPSD: qe, usePSD: et, scheduler: { get: function() {
return Et;
}, set: function(e) {
Et = e;
} }, rejectionMapper: { get: function() {
return Kn;
}, set: function(e) {
Kn = e;
} }, follow: function(e, t) {
return new R(function(n, r) {
return qe(function(i, a) {
var o = $;
o.unhandleds = [], o.onunhandled = a, o.finalize = Xe(function() {
var s, c = this;
s = function() {
c.unhandleds.length === 0 ? i() : a(c.unhandleds[0]);
}, Nt.push(function f() {
s(), Nt.splice(Nt.indexOf(f), 1);
}), ++Je, Et(function() {
--Je == 0 && Tn();
}, []);
}, o.finalize), e();
}, t, n, r);
});
} }), Qe && (Qe.allSettled && W(R, "allSettled", function() {
var e = Ae.apply(null, arguments).map(Ut);
return new R(function(t) {
e.length === 0 && t([]);
var n = e.length, r = new Array(n);
e.forEach(function(i, a) {
return R.resolve(i).then(function(o) {
return r[a] = { status: "fulfilled", value: o };
}, function(o) {
return r[a] = { status: "rejected", reason: o };
}).then(function() {
return --n || t(r);
});
});
});
}), Qe.any && typeof AggregateError < "u" && W(R, "any", function() {
var e = Ae.apply(null, arguments).map(Ut);
return new R(function(t, n) {
e.length === 0 && n(new AggregateError([]));
var r = e.length, i = new Array(r);
e.forEach(function(a, o) {
return R.resolve(a).then(function(s) {
return t(s);
}, function(s) {
i[o] = s, --r || n(new AggregateError(i));
});
});
});
}), Qe.withResolvers && (R.withResolvers = Qe.withResolvers));
var le = { awaits: 0, echoes: 0, id: 0 }, Ci = 0, Vt = [], Ht = 0, Wt = 0, Ei = 0;
function qe(e, t, n, r) {
var i = $, a = Object.create(i);
return a.parent = i, a.ref = 0, a.global = !1, a.id = ++Ei, Be.env, a.env = Sn ? { Promise: R, PromiseProp: { value: R, configurable: !0, writable: !0 }, all: R.all, race: R.race, allSettled: R.allSettled, any: R.any, resolve: R.resolve, reject: R.reject } : {}, t && I(a, t), ++i.ref, a.finalize = function() {
--this.parent.ref || this.parent.finalize();
}, r = et(a, e, n, r), a.ref === 0 && a.finalize(), r;
}
function ht() {
return le.id || (le.id = ++Ci), ++le.awaits, le.echoes += br, le.id;
}
function Me() {
return !!le.awaits && (--le.awaits == 0 && (le.id = 0), le.echoes = le.awaits * br, !0);
}
function Ut(e) {
return le.echoes && e && e.constructor === Qe ? (ht(), e.then(function(t) {
return Me(), t;
}, function(t) {
return Me(), ue(t);
})) : e;
}
function Oi() {
var e = Vt[Vt.length - 1];
Vt.pop(), $e(e, !1);
}
function $e(e, t) {
var n, r = $;
(t ? !le.echoes || Ht++ && e === $ : !Ht || --Ht && e === $) || queueMicrotask(t ? (function(i) {
++Wt, le.echoes && --le.echoes != 0 || (le.echoes = le.awaits = le.id = 0), Vt.push($), $e(i, !0);
}).bind(null, e) : Oi), e !== $ && ($ = e, r === Be && (Be.env = kr()), Sn && (n = Be.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(E, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
}
function kr() {
var e = E.Promise;
return Sn ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(E, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
}
function et(e, t, n, r, i) {
var a = $;
try {
return $e(e, !0), t(n, r, i);
} finally {
$e(a, !1);
}
}
function xr(e, t, n, r) {
return typeof e != "function" ? e : function() {
var i = $;
n && ht(), $e(t, !0);
try {
return e.apply(this, arguments);
} finally {
$e(i, !1), r && queueMicrotask(Me);
}
};
}
function jn(e) {
Promise === Qe && le.echoes === 0 ? Ht === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
}
("" + Ce).indexOf("[native code]") === -1 && (ht = Me = ae);
var ue = R.reject, tt = "", Te = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Cr = "String expected.", dt = [], Yt = "__dbnames", In = "readonly", Rn = "readwrite";
function nt(e, t) {
return e ? t ? function() {
return e.apply(this, arguments) && t.apply(this, arguments);
} : e : t;
}
var Er = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
function Xt(e) {
return typeof e != "string" || /\./.test(e) ? function(t) {
return t;
} : function(t) {
return t[e] === void 0 && e in t && delete (t = Ue(t))[e], t;
};
}
function Or() {
throw N.Type();
}
function ee(e, t) {
try {
var n = Sr(e), r = Sr(t);
if (n !== r) return n === "Array" ? 1 : r === "Array" ? -1 : n === "binary" ? 1 : r === "binary" ? -1 : n === "string" ? 1 : r === "string" ? -1 : n === "Date" ? 1 : r !== "Date" ? NaN : -1;
switch (n) {
case "number":
case "Date":
case "string":
return t < e ? 1 : e < t ? -1 : 0;
case "binary":
return function(i, a) {
for (var o = i.length, s = a.length, c = o < s ? o : s, f = 0; f < c; ++f) if (i[f] !== a[f]) return i[f] < a[f] ? -1 : 1;
return o === s ? 0 : o < s ? -1 : 1;
}(Pr(e), Pr(t));
case "Array":
return function(i, a) {
for (var o = i.length, s = a.length, c = o < s ? o : s, f = 0; f < c; ++f) {
var v = ee(i[f], a[f]);
if (v !== 0) return v;
}
return o === s ? 0 : o < s ? -1 : 1;
}(e, t);
}
} catch {
}
return NaN;
}
function Sr(e) {
var t = typeof e;
return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e = kn(e), e === "ArrayBuffer" ? "binary" : e);
}
function Pr(e) {
return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
}
var Kr = (oe.prototype._trans = function(e, t, n) {
var r = this._tx || $.trans, i = this.name, a = Pe && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
function o(f, v, u) {
if (!u.schema[i]) throw new N.NotFound("Table " + i + " not part of transaction");
return t(u.idbtrans, u);
}
var s = lt();
try {
var c = r && r.db._novip === this.db._novip ? r === $.trans ? r._promise(e, o, n) : qe(function() {
return r._promise(e, o, n);
}, { trans: r, transless: $.transless || $ }) : function f(v, u, y, l) {
if (v.idbdb && (v._state.openComplete || $.letThrough || v._vip)) {
var d = v._createTransaction(u, y, v._dbSchema);
try {
d.create(), v._state.PR1398_maxLoop = 3;
} catch (p) {
return p.name === En.InvalidState && v.isOpen() && 0 < --v._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), v.close({ disableAutoOpen: !1 }), v.open().then(function() {
return f(v, u, y, l);
})) : ue(p);
}
return d._promise(u, function(p, h) {
return qe(function() {
return $.trans = d, l(p, h, d);
});
}).then(function(p) {
if (u === "readwrite") try {
d.idbtrans.commit();
} catch {
}
return u === "readonly" ? p : d._completion.then(function() {
return p;
});
});
}
if (v._state.openComplete) return ue(new N.DatabaseClosed(v._state.dbOpenError));
if (!v._state.isBeingOpened) {
if (!v._state.autoOpen) return ue(new N.DatabaseClosed());
v.open().catch(ae);
}
return v._state.dbReadyPromise.then(function() {
return f(v, u, y, l);
});
}(this.db, e, [this.name], o);
return a && (c._consoleTask = a, c = c.catch(function(f) {
return console.trace(f), ue(f);
})), c;
} finally {
s && ft();
}
}, oe.prototype.get = function(e, t) {
var n = this;
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? ue(new N.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(r) {
return n.core.get({ trans: r, key: e }).then(function(i) {
return n.hook.reading.fire(i);
});
}).then(t);
}, oe.prototype.where = function(e) {
if (typeof e == "string") return new this.db.WhereClause(this, e);
if (D(e)) return new this.db.WhereClause(this, "[".concat(e.join("+"), "]"));
var t = C(e);
if (t.length === 1) return this.where(t[0]).equals(e[t[0]]);
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(s) {
if (s.compound && t.every(function(f) {
return 0 <= s.keyPath.indexOf(f);
})) {
for (var c = 0; c < t.length; ++c) if (t.indexOf(s.keyPath[c]) === -1) return !1;
return !0;
}
return !1;
}).sort(function(s, c) {
return s.keyPath.length - c.keyPath.length;
})[0];
if (n && this.db._maxKey !== tt) {
var a = n.keyPath.slice(0, t.length);
return this.where(a).equals(a.map(function(c) {
return e[c];
}));
}
!n && Pe && console.warn("The query ".concat(JSON.stringify(e), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(t.join("+"), "]"));
var r = this.schema.idxByName;
function i(s, c) {
return ee(s, c) === 0;
}
var o = t.reduce(function(u, c) {
var f = u[0], v = u[1], u = r[c], y = e[c];
return [f || u, f || !u ? nt(v, u && u.multi ? function(l) {
return l = G(l, c), D(l) && l.some(function(d) {
return i(y, d);
});
} : function(l) {
return i(y, G(l, c));
}) : v];
}, [null, null]), a = o[0], o = o[1];
return a ? this.where(a.name).equals(e[a.keyPath]).filter(o) : n ? this.filter(o) : this.where(t).equals("");
}, oe.prototype.filter = function(e) {
return this.toCollection().and(e);
}, oe.prototype.count = function(e) {
return this.toCollection().count(e);
}, oe.prototype.offset = function(e) {
return this.toCollection().offset(e);
}, oe.prototype.limit = function(e) {
return this.toCollection().limit(e);
}, oe.prototype.each = function(e) {
return this.toCollection().each(e);
}, oe.prototype.toArray = function(e) {
return this.toCollection().toArray(e);
}, oe.prototype.toCollection = function() {
return new this.db.Collection(new this.db.WhereClause(this));
}, oe.prototype.orderBy = function(e) {
return new this.db.Collection(new this.db.WhereClause(this, D(e) ? "[".concat(e.join("+"), "]") : e));
}, oe.prototype.reverse = function() {
return this.toCollection().reverse();
}, oe.prototype.mapToClass = function(e) {
var t, n = this.db, r = this.name;
function i() {
return t !== null && t.apply(this, arguments) || this;
}
(this.schema.mappedClass = e).prototype instanceof Or && (function(c, f) {
if (typeof f != "function" && f !== null) throw new TypeError("Class extends value " + String(f) + " is not a constructor or null");
function v() {
this.constructor = c;
}
O(c, f), c.prototype = f === null ? Object.create(f) : (v.prototype = f.prototype, new v());
}(i, t = e), Object.defineProperty(i.prototype, "db", { get: function() {
return n;
}, enumerable: !1, configurable: !0 }), i.prototype.table = function() {
return r;
}, e = i);
for (var a = /* @__PURE__ */ new Set(), o = e.prototype; o; o = V(o)) Object.getOwnPropertyNames(o).forEach(function(c) {
return a.add(c);
});
function s(c) {
if (!c) return c;
var f, v = Object.create(e.prototype);
for (f in c) if (!a.has(f)) try {
v[f] = c[f];
} catch {
}
return v;
}
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = s, this.hook("reading", s), e;
}, oe.prototype.defineClass = function() {
return this.mapToClass(function(e) {
I(this, e);
});
}, oe.prototype.add = function(e, t) {
var n = this, r = this.schema.primKey, i = r.auto, a = r.keyPath, o = e;
return a && i && (o = Xt(a)(e)), this._trans("readwrite", function(s) {
return n.core.mutate({ trans: s, type: "add", keys: t != null ? [t] : null, values: [o] });
}).then(function(s) {
return s.numFailures ? R.reject(s.failures[0]) : s.lastResult;
}).then(function(s) {
if (a) try {
re(e, a, s);
} catch {
}
return s;
});
}, oe.prototype.update = function(e, t) {
return typeof e != "object" || D(e) ? this.where(":id").equals(e).modify(t) : (e = G(e, this.schema.primKey.keyPath), e === void 0 ? ue(new N.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
}, oe.prototype.put = function(e, t) {
var n = this, r = this.schema.primKey, i = r.auto, a = r.keyPath, o = e;
return a && i && (o = Xt(a)(e)), this._trans("readwrite", function(s) {
return n.core.mutate({ trans: s, type: "put", values: [o], keys: t != null ? [t] : null });
}).then(function(s) {
return s.numFailures ? R.reject(s.failures[0]) : s.lastResult;
}).then(function(s) {
if (a) try {
re(e, a, s);
} catch {
}
return s;
});
}, oe.prototype.delete = function(e) {
var t = this;
return this._trans("readwrite", function(n) {
return t.core.mutate({ trans: n, type: "delete", keys: [e] });
}).then(function(n) {
return n.numFailures ? R.reject(n.failures[0]) : void 0;
});
}, oe.prototype.clear = function() {
var e = this;
return this._trans("readwrite", function(t) {
return e.core.mutate({ trans: t, type: "deleteRange", range: Er });
}).then(function(t) {
return t.numFailures ? R.reject(t.failures[0]) : void 0;
});
}, oe.prototype.bulkGet = function(e) {
var t = this;
return this._trans("readonly", function(n) {
return t.core.getMany({ keys: e, trans: n }).then(function(r) {
return r.map(function(i) {
return t.hook.reading.fire(i);
});
});
});
}, oe.prototype.bulkAdd = function(e, t, n) {
var r = this, i = Array.isArray(t) ? t : void 0, a = (n = n || (i ? void 0 : t)) ? n.allKeys : void 0;
return this._trans("readwrite", function(o) {
var f = r.schema.primKey, s = f.auto, f = f.keyPath;
if (f && i) throw new N.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
if (i && i.length !== e.length) throw new N.InvalidArgument("Arguments objects and keys must have the same length");
var c = e.length, f = f && s ? e.map(Xt(f)) : e;
return r.core.mutate({ trans: o, type: "add", keys: i, values: f, wantResults: a }).then(function(d) {
var u = d.numFailures, y = d.results, l = d.lastResult, d = d.failures;
if (u === 0) return a ? y : l;
throw new ct("".concat(r.name, ".bulkAdd(): ").concat(u, " of ").concat(c, " operations failed"), d);
});
});
}, oe.prototype.bulkPut = function(e, t, n) {
var r = this, i = Array.isArray(t) ? t : void 0, a = (n = n || (i ? void 0 : t)) ? n.allKeys : void 0;
return this._trans("readwrite", function(o) {
var f = r.schema.primKey, s = f.auto, f = f.keyPath;
if (f && i) throw new N.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
if (i && i.length !== e.length) throw new N.InvalidArgument("Arguments objects and keys must have the same length");
var c = e.length, f = f && s ? e.map(Xt(f)) : e;
return r.core.mutate({ trans: o, type: "put", keys: i, values: f, wantResults: a }).then(function(d) {
var u = d.numFailures, y = d.results, l = d.lastResult, d = d.failures;
if (u === 0) return a ? y : l;
throw new ct("".concat(r.name, ".bulkPut(): ").concat(u, " of ").concat(c, " operations failed"), d);
});
});
}, oe.prototype.bulkUpdate = function(e) {
var t = this, n = this.core, r = e.map(function(o) {
return o.key;
}), i = e.map(function(o) {
return o.changes;
}), a = [];
return this._trans("readwrite", function(o) {
return n.getMany({ trans: o, keys: r, cache: "clone" }).then(function(s) {
var c = [], f = [];
e.forEach(function(u, y) {
var l = u.key, d = u.changes, p = s[y];
if (p) {
for (var h = 0, m = Object.keys(d); h < m.length; h++) {
var b = m[h], w = d[b];
if (b === t.schema.primKey.keyPath) {
if (ee(w, l) !== 0) throw new N.Constraint("Cannot update primary key in bulkUpdate()");
} else re(p, b, w);
}
a.push(y), c.push(l), f.push(p);
}
});
var v = c.length;
return n.mutate({ trans: o, type: "put", keys: c, values: f, updates: { keys: r, changeSpecs: i } }).then(function(u) {
var y = u.numFailures, l = u.failures;
if (y === 0) return v;
for (var d = 0, p = Object.keys(l); d < p.length; d++) {
var h, m = p[d], b = a[Number(m)];
b != null && (h = l[m], delete l[m], l[b] = h);
}
throw new ct("".concat(t.name, ".bulkUpdate(): ").concat(y, " of ").concat(v, " operations failed"), l);
});
});
});
}, oe.prototype.bulkDelete = function(e) {
var t = this, n = e.length;
return this._trans("readwrite", function(r) {
return t.core.mutate({ trans: r, type: "delete", keys: e });
}).then(function(o) {
var i = o.numFailures, a = o.lastResult, o = o.failures;
if (i === 0) return a;
throw new ct("".concat(t.name, ".bulkDelete(): ").concat(i, " of ").concat(n, " operations failed"), o);
});
}, oe);
function oe() {
}
function St(e) {
function t(o, s) {
if (s) {
for (var c = arguments.length, f = new Array(c - 1); --c; ) f[c - 1] = arguments[c];
return n[o].subscribe.apply(null, f), e;
}
if (typeof o == "string") return n[o];
}
var n = {};
t.addEventType = a;
for (var r = 1, i = arguments.length; r < i; ++r) a(arguments[r]);
return t;
function a(o, s, c) {
if (typeof o != "object") {
var f;
s = s || _i;
var v = { subscribers: [], fire: c = c || ae, subscribe: function(u) {
v.subscribers.indexOf(u) === -1 && (v.subscribers.push(u), v.fire = s(v.fire, u));
}, unsubscribe: function(u) {
v.subscribers = v.subscribers.filter(function(y) {
return y !== u;
}), v.fire = v.subscribers.reduce(s, c);
} };
return n[o] = t[o] = v;
}
C(f = o).forEach(function(u) {
var y = f[u];
if (D(y)) a(u, f[u][0], f[u][1]);
else {
if (y !== "asap") throw new N.InvalidArgument("Invalid event config");
var l = a(u, kt, function() {
for (var d = arguments.length, p = new Array(d); d--; ) p[d] = arguments[d];
l.subscribers.forEach(function(h) {
ie(function() {
h.apply(null, p);
});
});
});
}
});
}
}
function Pt(e, t) {
return H(t).from({ prototype: e }), t;
}
function vt(e, t) {
return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter);
}
function Bn(e, t) {
e.filter = nt(e.filter, t);
}
function qn(e, t, n) {
var r = e.replayFilter;
e.replayFilter = r ? function() {
return nt(r(), t());
} : t, e.justLimit = n && !r;
}
function Gt(e, t) {
if (e.isPrimKey) return t.primaryKey;
var n = t.getIndexByKeyPath(e.index);
if (!n) throw new N.Schema("KeyPath " + e.index + " on object store " + t.name + " is not indexed");
return n;
}
function zr(e, t, n) {
var r = Gt(e, t.schema);
return t.openCursor({ trans: n, values: !e.keysOnly, reverse: e.dir === "prev", unique: !!e.unique, query: { index: r, range: e.range } });
}
function Qt(e, t, n, r) {
var i = e.replayFilter ? nt(e.filter, e.replayFilter()) : e.filter;
if (e.or) {
var a = {}, o = function(s, c, f) {
var v, u;
i && !i(c, f, function(y) {
return c.stop(y);
}, function(y) {
return c.fail(y);
}) || ((u = "" + (v = c.primaryKey)) == "[object ArrayBuffer]" && (u = "" + new Uint8Array(v)), q(a, u) || (a[u] = !0, t(s, c, f)));
};
return Promise.all([e.or._iterate(o, n), Dr(zr(e, r, n), e.algorithm, o, !e.keysOnly && e.valueMapper)]);
}
return Dr(zr(e, r, n), nt(e.algorithm, i), t, !e.keysOnly && e.valueMapper);
}
function Dr(e, t, n, r) {
var i = se(r ? function(a, o, s) {
return n(r(a), o, s);
} : n);
return e.then(function(a) {
if (a) return a.start(function() {
var o = function() {
return a.continue();
};
t && !t(a, function(s) {
return o = s;
}, function(s) {
a.stop(s), o = ae;
}, function(s) {
a.fail(s), o = ae;
}) || i(a.value, a, function(s) {
return o = s;
}), o();
});
});
}
var Kt = (Ar.prototype.execute = function(e) {
var t = this["@@propmod"];
if (t.add !== void 0) {
var n = t.add;
if (D(n)) return K(K([], D(e) ? e : [], !0), n).sort();
if (typeof n == "number") return (Number(e) || 0) + n;
if (typeof n == "bigint") try {
return BigInt(e) + n;
} catch {
return BigInt(0) + n;
}
throw new TypeError("Invalid term ".concat(n));
}
if (t.remove !== void 0) {
var r = t.remove;
if (D(r)) return D(e) ? e.filter(function(i) {
return !r.includes(i);
}).sort() : [];
if (typeof r == "number") return Number(e) - r;
if (typeof r == "bigint") try {
return BigInt(e) - r;
} catch {
return BigInt(0) - r;
}
throw new TypeError("Invalid subtrahend ".concat(r));
}
return n = (n = t.replacePrefix) === null || n === void 0 ? void 0 : n[0], n && typeof