#14 JavaScript::Eval (size: 108326) - SHA256: 5d7092c1753c2a9e33e76eaf95c3d6103c2a5ef9986e5dd6f8acf8a05a5e39a6
(() => {
"use strict";
var e = "2.50.1",
t = Number("0");
class n extends Error {
constructor(e) {
super(e)
}
}
function r(e, t, n, r, i, o, s) {
try {
var a = e[o](s),
c = a.value
} catch (e) {
return void n(e)
}
a.done ? t(c) : Promise.resolve(c).then(r, i)
}
function i(e) {
return function() {
var t = this,
n = arguments;
return new Promise((function(i, o) {
var s = e.apply(t, n);
function a(e) {
r(s, i, o, a, c, "next", e)
}
function c(e) {
r(s, i, o, a, c, "throw", e)
}
a(void 0)
}))
}
}
var o = (e, t) => new Promise((n => setTimeout(n.bind(null, t), e)));
function s() {
t && console.log(...arguments)
}
function a() {
return (a = i((function*(e) {
var t =
yield fetch(e);
if (!t.ok) throw new Error(t.statusText);
if (204 === t.status) throw new n("non-purchase of the auction");
return yield t.json()
}))).apply(this, arguments)
}
function c(e) {
return void 0 === e
}
const l = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : "undefined" != typeof window ? window : global,
u = Object.keys,
d = Array.isArray;
function h(e, t) {
return "object" != typeof t || u(t).forEach((function(n) {
e[n] = t[n]
})), e
}
"undefined" == typeof Promise || l.Promise || (l.Promise = Promise);
const f = Object.getPrototypeOf,
p = {}.hasOwnProperty;
function y(e, t) {
return p.call(e, t)
}
function v(e, t) {
"function" == typeof t && (t = t(f(e))), ("undefined" == typeof Reflect ? u : Reflect.ownKeys)(t).forEach((n => {
g(e, n, t[n])
}))
}
const m = Object.defineProperty;
function g(e, t, n, r) {
m(e, t, h(n && y(n, "get") && "function" == typeof n.get ? {get: n.get,
set: n.set,
configurable: !0
} : {
value: n,
configurable: !0,
writable: !0
}, r))
}
function b(e) {
return {
from: function(t) {
return e.prototype = Object.create(t.prototype), g(e.prototype, "constructor", e), {
extend: v.bind(null, e.prototype)
}
}
}
}
const _ = Object.getOwnPropertyDescriptor;
function w(e, t) {
let n;
return _(e, t) || (n = f(e)) && w(n, t)
}
const k = [].slice;
function x(e, t, n) {
return k.call(e, t, n)
}
function C(e, t) {
return t(e)
}
function P(e) {
if (!e) throw new Error("Assertion Failed")
}
function S(e) {
l.setImmediate ? setImmediate(e) : setTimeout(e, 0)
}
function O(e, t) {
return e.reduce(((e, n, r) => {
var i = t(n, r);
return i && (e[i[0]] = i[1]), e
}), {})
}
function K(e, t) {
if (y(e, t)) return e[t];
if (!t) return e;
if ("string" != typeof t) {
for (var n = [], r = 0, i = t.length; r < i; ++r) {
var o = K(e, t[r]);
n.push(o)
}
return n
}
var s = t.indexOf(".");
if (-1 !== s) {
var a = e[t.substr(0, s)];
return void 0 === a ? void 0 : K(a, t.substr(s + 1))
}
}
function E(e, t, n) {
if (e && void 0 !== t && (!("isFrozen" in Object) || !Object.isFrozen(e)))
if ("string" != typeof t && "length" in t) {
P("string" != typeof n && "length" in n);
for (var r = 0, i = t.length; r < i; ++r) E(e, t[r], n[r])
} else {
var o = t.indexOf(".");
if (-1 !== o) {
var s = t.substr(0, o),
a = t.substr(o + 1);
if ("" === a) void 0 === n ? d(e) && !isNaN(parseInt(s)) ? e.splice(s, 1) : delete e[s] : e[s] = n;
else {
var c = e[s];
c || (c = e[s] = {}), E(c, a, n)
}
} else void 0 === n ? d(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n
}
}
function A(e) {
var t = {};
for (var n in e) y(e, n) && (t[n] = e[n]);
return t
}
const D = [].concat;
function B(e) {
return D.apply([], e)
}
const I = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(B([8, 16, 32, 64].map((e => ["Int", "Uint", "Float"].map((t => t + e + "Array")))))).filter((e => l[e])),
j = I.map((e => l[e]));
O(I, (e => [e, !0]));
let T = null;
function M(e) {
T = "undefined" != typeof WeakMap && new WeakMap;
const t = R(e);
return T = null, t
}
function R(e) {
if (!e || "object" != typeof e) return e;
let t = T && T.get(e);
if (t) return t;
if (d(e)) {
t = [], T && T.set(e, t);
for (var n = 0, r = e.length; n < r; ++n) t.push(R(e[n]))
} else if (j.indexOf(e.constructor) >= 0) t = e;
else {
const n = f(e);
for (var i in t = n === Object.prototype ? {} : Object.create(n), T && T.set(e, t), e) y(e, i) && (t[i] = R(e[i]))
}
return t
}
const {
toString: F
} = {};
function N(e) {
return F.call(e).slice(8, -1)
}
const U = "undefined" != typeof Symbol ? Symbol.iterator : "@@iterator",
q = "symbol" == typeof U ? function(e) {
var t;
return null != e && (t = e[U]) && t.apply(e)
} : function() {
return null
},
L = {};
function z(e) {
var t, n, r, i;
if (1 === arguments.length) {
if (d(e)) return e.slice();
if (this === L && "string" == typeof e) return [e];
if (i = q(e)) {
for (n = []; !(r = i.next()).done;) n.push(r.value);
return n
}
if (null == e) return [e];
if ("number" == typeof(t = e.length)) {
for (n = new Array(t); t--;) n[t] = e[t];
return n
}
return [e]
}
for (t = arguments.length, n = new Array(t); t--;) n[t] = arguments[t];
return n
}
const V = "undefined" != typeof Symbol ? e => "AsyncFunction" === e[Symbol.toStringTag] : () => !1;
var W = "undefined" != typeof location && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
function G(e, t) {
W = e, Y = t
}
var Y = () => !0;
const Q = !new Error("").stack;
function H() {
if (Q) try {
throw H.arguments, new Error
} catch (e) {
return e
}
return new Error
}
function J(e, t) {
var n = e.stack;
return n ? (t = t || 0, 0 === n.indexOf(e.name) && (t += (e.name + e.message).split("\n").length), n.split("\n").slice(t).filter(Y).map((e => "\n" + e)).join("")) : ""
}
var Z = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"],
X = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(Z),
$ = {
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 ee(e, t) {
this._e = H(), this.name = e, this.message = t
}
function te(e, t) {
return e + ". Errors: " + Object.keys(t).map((e => t[e].toString())).filter(((e, t, n) => n.indexOf(e) === t)).join("\n")
}
function ne(e, t, n, r) {
this._e = H(), this.failures = t, this.failedKeys = r, this.successCount = n, this.message = te(e, t)
}
function re(e, t) {
this._e = H(), this.name = "BulkError", this.failures = Object.keys(t).map((e => t[e])), this.failuresByPos = t, this.message = te(e, t)
}
b(ee).from(Error).extend({
stack: {get: function() {
return this._stack || (this._stack = this.name + ": " + this.message + J(this._e, 2))
}
},
toString: function() {
return this.name + ": " + this.message
}
}), b(ne).from(ee), b(re).from(ee);
var ie = X.reduce(((e, t) => (e[t] = t + "Error", e)), {});
const oe = ee;
var se = X.reduce(((e, t) => {
var n = t + "Error";
function r(e, r) {
this._e = H(), this.name = n, e ? "string" == typeof e ? (this.message = `${e}${r?"\n "+r:""}`, this.inner = r || null) : "object" == typeof e && (this.message = `${e.name} ${e.message}`, this.inner = e) : (this.message = $[t] || n, this.inner = null)
}
return b(r).from(oe), e[t] = r, e
}), {});
se.Syntax = SyntaxError, se.Type = TypeError, se.Range = RangeError;
var ae = Z.reduce(((e, t) => (e[t + "Error"] = se[t], e)), {}),
ce = X.reduce(((e, t) => (-1 === ["Syntax", "Type", "Range"].indexOf(t) && (e[t + "Error"] = se[t]), e)), {});
function le() {}
function ue(e) {
return e
}
function de(e, t) {
return null == e || e === ue ? t : function(n) {
return t(e(n))
}
}
function he(e, t) {
return function() {
e.apply(this, arguments), t.apply(this, arguments)
}
}
function fe(e, t) {
return e === le ? t : function() {
var n = e.apply(this, arguments);
void 0 !== n && (arguments[0] = n);
var r = this.onsuccess,
i = this.onerror;
this.onsuccess = null, this.onerror = null;
var o = t.apply(this, arguments);
return r && (this.onsuccess = this.onsuccess ? he(r, this.onsuccess) : r), i && (this.onerror = this.onerror ? he(i, this.onerror) : i), void 0 !== o ? o : n
}
}
function pe(e, t) {
return e === le ? 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 ? he(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? he(r, this.onerror) : r)
}
}
function ye(e, t) {
return e === le ? t : function(n) {
var r = e.apply(this, arguments);
h(n, r);
var i = this.onsuccess,
o = this.onerror;
this.onsuccess = null, this.onerror = null;
var s = t.apply(this, arguments);
return i && (this.onsuccess = this.onsuccess ? he(i, this.onsuccess) : i), o && (this.onerror = this.onerror ? he(o, this.onerror) : o), void 0 === r ? void 0 === s ? void 0 : s : h(r, s)
}
}
function ve(e, t) {
return e === le ? t : function() {
return !1 !== t.apply(this, arguments) && e.apply(this, arguments)
}
}
function me(e, t) {
return e === le ? t : function() {
var n = e.apply(this, arguments);
if (n && "function" == typeof n.then) {
for (var r = this, i = arguments.length, o = new Array(i); i--;) o[i] = arguments[i];
return n.then((function() {
return t.apply(r, o)
}))
}
return t.apply(this, arguments)
}
}
ce.ModifyError = ne, ce.DexieError = ee, ce.BulkError = re;
var ge = {};
const [be, _e, we] = "undefined" == typeof Promise ? [] : (() => {
let e = Promise.resolve();
if ("undefined" == typeof crypto || !crypto.subtle) return [e, f(e), e];
const t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
return [t, f(t), e]
})(), ke = _e && _e.then, xe = be && be.constructor, Ce = !!we;
var Pe = !1,
Se = we ? () => {
we.then(He)
} : l.setImmediate ? setImmediate.bind(null, He) : l.MutationObserver ? () => {
var e = document.createElement("div");
new MutationObserver((() => {
He(), e = null
})).observe(e, {
attributes: !0
}), e.setAttribute("i", "1")
} : () => {
setTimeout(He, 0)
},
Oe = function(e, t) {
Me.push([e, t]), Ee && (Se(), Ee = !1)
},
Ke = !0,
Ee = !0,
Ae = [],
De = [],
Be = null,
Ie = ue,
je = {
id: "global",
global: !0,
ref: 0,
unhandleds: [],
onunhandled: bt,
pgp: !1,
env: {},
finalize: function() {
this.unhandleds.forEach((e => {
try {
bt(e[0], e[1])
} catch (e) {}
}))
}
},
Te = je,
Me = [],
Re = 0,
Fe = [];
function Ne(e) {
if ("object" != typeof this) throw new TypeError("Promises must be constructed via new");
this._listeners = [], this.onuncatched = le, this._lib = !1;
var t = this._PSD = Te;
if (W && (this._stackHolder = H(), this._prev = null, this._numPrev = 0), "function" != typeof e) {
if (e !== ge) throw new TypeError("Not a function");
return this._state = arguments[1], this._value = arguments[2], void(!1 === this._state && ze(this, this._value))
}
this._state = null, this._value = null, ++t.ref, Le(this, e)
}
const Ue = {get: function() {
var e = Te,
t = ot;
function n(n, r) {
var i = !e.global && (e !== Te || t !== ot);
const o = i && !lt();
var s = new Ne(((t, s) => {
We(this, new qe(mt(n, e, i, o), mt(r, e, i, o), t, s, e))
}));
return W && Qe(s, this), s
}
return n.prototype = ge, n
},
set: function(e) {
g(this, "then", e && e.prototype === ge ? Ue : {get: function() {
return e
},
set: Ue.set
})
}
};
function qe(e, t, n, r, i) {
this.onFulfilled = "function" == typeof e ? e : null, this.onRejected = "function" == typeof t ? t : null, this.resolve = n, this.reject = r, this.psd = i
}
function Le(e, t) {
try {
t((t => {
if (null === e._state) {
if (t === e) throw new TypeError("A promise cannot be resolved with itself.");
var n = e._lib && Je();
t && "function" == typeof t.then ? Le(e, ((e, n) => {
t instanceof Ne ? t._then(e, n) : t.then(e, n)
})) : (e._state = !0, e._value = t, Ve(e)), n && Ze()
}
}), ze.bind(null, e))
} catch (t) {
ze(e, t)
}
}
function ze(e, t) {
if (De.push(t), null === e._state) {
var n = e._lib && Je();
t = Ie(t), e._state = !1, e._value = t, W && null !== t && "object" == typeof t && !t._promise && function(e, t, n) {
try {
e.apply(null, void 0)
} catch (e) {}
}((() => {
var n = w(t, "stack");
t._promise = e, g(t, "stack", {get: () => Pe ? n && (n.get ? n.get.apply(t) : n.value) : e.stack
})
})),
function(e) {
Ae.some((t => t._value === e._value)) || Ae.push(e)
}(e), Ve(e), n && Ze()
}
}
function Ve(e) {
var t = e._listeners;
e._listeners = [];
for (var n = 0, r = t.length; n < r; ++n) We(e, t[n]);
var i = e._PSD;
--i.ref || i.finalize(), 0 === Re && (++Re, Oe((() => {
0 == --Re && Xe()
}), []))
}
function We(e, t) {
if (null !== e._state) {
var n = e._state ? t.onFulfilled : t.onRejected;
if (null === n) return (e._state ? t.resolve : t.reject)(e._value);
++t.psd.ref, ++Re, Oe(Ge, [n, e, t])
} else e._listeners.push(t)
}
function Ge(e, t, n) {
try {
Be = t;
var r, i = t._value;
t._state ? r = e(i) : (De.length && (De = []), r = e(i), -1 === De.indexOf(i) && function(e) {
for (var t = Ae.length; t;)
if (Ae[--t]._value === e._value) return void Ae.splice(t, 1)
}(t)), n.resolve(r)
} catch (e) {
n.reject(e)
} finally {
Be = null, 0 == --Re && Xe(), --n.psd.ref || n.psd.finalize()
}
}
function Ye(e, t, n) {
if (t.length === n) return t;
var r = "";
if (!1 === e._state) {
var i, o, s = e._value;
null != s ? (i = s.name || "Error", o = s.message || s, r = J(s, 0)) : (i = s, o = ""), t.push(i + (o ? ": " + o : "") + r)
}
return W && ((r = J(e._stackHolder, 2)) && -1 === t.indexOf(r) && t.push(r), e._prev && Ye(e._prev, t, n)), t
}
function Qe(e, t) {
var n = t ? t._numPrev + 1 : 0;
n < 100 && (e._prev = t, e._numPrev = n)
}
function He() {
Je() && Ze()
}
function Je() {
var e = Ke;
return Ke = !1, Ee = !1, e
}
function Ze() {
var e, t, n;
do {
for (; Me.length > 0;)
for (e = Me, Me = [], n = e.length, t = 0; t < n; ++t) {
var r = e[t];
r[0].apply(null, r[1])
}
} while (Me.length > 0);
Ke = !0, Ee = !0
}
function Xe() {
var e = Ae;
Ae = [], e.forEach((e => {
e._PSD.onunhandled.call(null, e._value, e)
}));
for (var t = Fe.slice(0), n = t.length; n;) t[--n]()
}
function $e(e) {
return new Ne(ge, !1, e)
}
function et(e, t) {
var n = Te;
return function() {
var r = Je(),
i = Te;
try {
return ft(n, !0), e.apply(this, arguments)
} catch (e) {
t && t(e)
} finally {
ft(i, !1), r && Ze()
}
}
}
v(Ne.prototype, {
then: Ue,
_then: function(e, t) {
We(this, new qe(null, null, e, t, Te))
},
catch: function(e) {
if (1 === arguments.length) return this.then(null, e);
var t = arguments[0],
n = arguments[1];
return "function" == typeof t ? this.then(null, (e => e instanceof t ? n(e) : $e(e))) : this.then(null, (e => e && e.name === t ? n(e) : $e(e)))
},
finally: function(e) {
return this.then((t => (e(), t)), (t => (e(), $e(t))))
},
stack: {get: function() {
if (this._stack) return this._stack;
try {
Pe = !0;
var e = Ye(this, [], 20).join("\nFrom previous: ");
return null !== this._state && (this._stack = e), e
} finally {
Pe = !1
}
}
},
timeout: function(e, t) {
return e < 1 / 0 ? new Ne(((n, r) => {
var i = setTimeout((() => r(new se.Timeout(t))), e);
this.then(n, r).finally(clearTimeout.bind(null, i))
})) : this
}
}), "undefined" != typeof Symbol && Symbol.toStringTag && g(Ne.prototype, Symbol.toStringTag, "Dexie.Promise"), je.env = pt(), v(Ne, {
all: function() {
var e = z.apply(null, arguments).map(ut);
return new Ne((function(t, n) {
0 === e.length && t([]);
var r = e.length;
e.forEach(((i, o) => Ne.resolve(i).then((n => {
e[o] = n, --r || t(e)
}), n)))
}))
},
resolve: e => {
if (e instanceof Ne) return e;
if (e && "function" == typeof e.then) return new Ne(((t, n) => {
e.then(t, n)
}));
var t = new Ne(ge, !0, e);
return Qe(t, Be), t
},
reject: $e,
race: function() {
var e = z.apply(null, arguments).map(ut);
return new Ne(((t, n) => {
e.map((e => Ne.resolve(e).then(t, n)))
}))
},
PSD: {get: () => Te,
set: e => Te = e
},
totalEchoes: {get: () => ot
},
newPSD: at,
usePSD: yt,
scheduler: {get: () => Oe,
set: e => {
Oe = e
}
},
rejectionMapper: {get: () => Ie,
set: e => {
Ie = e
}
},
follow: (e, t) => new Ne(((n, r) => at(((t, n) => {
var r = Te;
r.unhandleds = [], r.onunhandled = n, r.finalize = he((function() {
! function(e) {
Fe.push((function t() {
e(), Fe.splice(Fe.indexOf(t), 1)
})), ++Re, Oe((() => {
0 == --Re && Xe()
}), [])
}((() => {
0 === this.unhandleds.length ? t() : n(this.unhandleds[0])
}))
}), r.finalize), e()
}), t, n, r)))
}), xe && (xe.allSettled && g(Ne, "allSettled", (function() {
const e = z.apply(null, arguments).map(ut);
return new Ne((t => {
0 === e.length && t([]);
let n = e.length;
const r = new Array(n);
e.forEach(((e, i) => Ne.resolve(e).then((e => r[i] = {
status: "fulfilled",
value: e
}), (e => r[i] = {
status: "rejected",
reason: e
})).then((() => --n || t(r)))))
}))
})), xe.any && "undefined" != typeof AggregateError && g(Ne, "any", (function() {
const e = z.apply(null, arguments).map(ut);
return new Ne(((t, n) => {
0 === e.length && n(new AggregateError([]));
let r = e.length;
const i = new Array(r);
e.forEach(((e, o) => Ne.resolve(e).then((e => t(e)), (e => {
i[o] = e, --r || n(new AggregateError(i))
}))))
}))
})));
const tt = {
awaits: 0,
echoes: 0,
id: 0
};
var nt = 0,
rt = [],
it = 0,
ot = 0,
st = 0;
function at(e, t, n, r) {
var i = Te,
o = Object.create(i);
o.parent = i, o.ref = 0, o.global = !1, o.id = ++st;
var s = je.env;
o.env = Ce ? {
Promise: Ne,
PromiseProp: {
value: Ne,
configurable: !0,
writable: !0
},
all: Ne.all,
race: Ne.race,
allSettled: Ne.allSettled,
any: Ne.any,
resolve: Ne.resolve,
reject: Ne.reject,
nthen: gt(s.nthen, o),
gthen: gt(s.gthen, o)
} : {}, t && h(o, t), ++i.ref, o.finalize = function() {
--this.parent.ref || this.parent.finalize()
};
var a = yt(o, e, n, r);
return 0 === o.ref && o.finalize(), a
}
function ct() {
return tt.id || (tt.id = ++nt), ++tt.awaits, tt.echoes += 100, tt.id
}
function lt() {
return !!tt.awaits && (0 == --tt.awaits && (tt.id = 0), tt.echoes = 100 * tt.awaits, !0)
}
function ut(e) {
return tt.echoes && e && e.constructor === xe ? (ct(), e.then((e => (lt(), e)), (e => (lt(), _t(e))))) : e
}
function dt(e) {
++ot, tt.echoes && 0 != --tt.echoes || (tt.echoes = tt.id = 0), rt.push(Te), ft(e, !0)
}
function ht() {
var e = rt[rt.length - 1];
rt.pop(), ft(e, !1)
}
function ft(e, t) {
var n = Te;
if ((t ? !tt.echoes || it++ && e === Te : !it || --it && e === Te) || vt(t ? dt.bind(null, e) : ht), e !== Te && (Te = e, n === je && (je.env = pt()), Ce)) {
var r = je.env.Promise,
i = e.env;
_e.then = i.nthen, r.prototype.then = i.gthen, (n.global || e.global) && (Object.defineProperty(l, "Promise", i.PromiseProp), r.all = i.all, r.race = i.race, r.resolve = i.resolve, r.reject = i.reject, i.allSettled && (r.allSettled = i.allSettled), i.any && (r.any = i.any))
}
}
function pt() {
var e = l.Promise;
return Ce ? {
Promise: e,
PromiseProp: Object.getOwnPropertyDescriptor(l, "Promise"),
all: e.all,
race: e.race,
allSettled: e.allSettled,
any: e.any,
resolve: e.resolve,
reject: e.reject,
nthen: _e.then,
gthen: e.prototype.then
} : {}
}
function yt(e, t, n, r, i) {
var o = Te;
try {
return ft(e, !0), t(n, r, i)
} finally {
ft(o, !1)
}
}
function vt(e) {
ke.call(be, e)
}
function mt(e, t, n, r) {
return "function" != typeof e ? e : function() {
var i = Te;
n && ct(), ft(t, !0);
try {
return e.apply(this, arguments)
} finally {
ft(i, !1), r && vt(lt)
}
}
}
function gt(e, t) {
return function(n, r) {
return e.call(this, mt(n, t), mt(r, t))
}
}
function bt(e, t) {
var n;
try {
n = t.onuncatched(e)
} catch (e) {}
if (!1 !== n) try {
var r, i = {
promise: t,
reason: e
};
if (l.document && document.createEvent ? ((r = document.createEvent("Event")).initEvent("unhandledrejection", !0, !0), h(r, i)) : l.CustomEvent && h(r = new CustomEvent("unhandledrejection", {
detail: i
}), i), r && l.dispatchEvent && (dispatchEvent(r), !l.PromiseRejectionEvent && l.onunhandledrejection)) try {
l.onunhandledrejection(r)
} catch (e) {}
W && r && !r.defaultPrevented && console.warn(`Unhandled rejection: ${e.stack||e}`)
} catch (e) {}
} - 1 === ("" + ke).indexOf("[native code]") && (ct = lt = le);
var _t = Ne.reject;
function wt(e, t, n, r) {
if (e.idbdb && (e._state.openComplete || Te.letThrough || e._vip)) {
var i = e._createTransaction(t, n, e._dbSchema);
try {
i.create(), e._state.PR1398_maxLoop = 3
} catch (i) {
return i.name === ie.InvalidState && e.isOpen() && --e._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), e._close(), e.open().then((() => wt(e, t, n, r)))) : _t(i)
}
return i._promise(t, ((e, t) => at((() => (Te.trans = i, r(e, t, i)))))).then((e => i._completion.then((() => e))))
}
if (e._state.openComplete) return _t(new se.DatabaseClosed(e._state.dbOpenError));
if (!e._state.isBeingOpened) {
if (!e._options.autoOpen) return _t(new se.DatabaseClosed);
e.open().catch(le)
}
return e._state.dbReadyPromise.then((() => wt(e, t, n, r)))
}
const kt = String.fromCharCode(65535),
xt = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",
Ct = [],
Pt = "undefined" != typeof navigator && /(MSIE|Trident|Edge)/.test(navigator.userAgent),
St = Pt,
Ot = Pt,
Kt = e => !/(dexie\.js|dexie\.min\.js)/.test(e);
function Et(e, t) {
return e ? t ? function() {
return e.apply(this, arguments) && t.apply(this, arguments)
} : e : t
}
const At = {
type: 3,
lower: -1 / 0,
lowerOpen: !1,
upper: [
[]
],
upperOpen: !1
};
function Dt(e) {
return "string" != typeof e || /\./.test(e) ? e => e : t => (void 0 === t[e] && e in t && delete(t = M(t))[e], t)
}
class Bt {
_trans(e, t, n) {
const r = this._tx || Te.trans,
i = this.name;
function o(e, n, r) {
if (!r.schema[i]) throw new se.NotFound("Table " + i + " not part of transaction");
return t(r.idbtrans, r)
}
const s = Je();
try {
return r && r.db === this.db ? r === Te.trans ? r._promise(e, o, n) : at((() => r._promise(e, o, n)), {
trans: r,
transless: Te.transless || Te
}) : wt(this.db, e, [this.name], o)
} finally {
s && Ze()
}
}
get(e, t) {
return e && e.constructor === Object ? this.where(e).first(t) : this._trans("readonly", (t => this.core.get({
trans: t,
key: e
}).then((e => this.hook.reading.fire(e))))).then(t)
}
where(e) {
if ("string" == typeof e) return new this.db.WhereClause(this, e);
if (d(e)) return new this.db.WhereClause(this, `[${e.join("+")}]`);
const t = u(e);
if (1 === t.length) return this.where(t[0]).equals(e[t[0]]);
const n = this.schema.indexes.concat(this.schema.primKey).filter((e => e.compound && t.every((t => e.keyPath.indexOf(t) >= 0)) && e.keyPath.every((e => t.indexOf(e) >= 0))))[0];
if (n && this.db._maxKey !== kt) return this.where(n.name).equals(n.keyPath.map((t => e[t])));
!n && W && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);
const {
idxByName: r
} = this.schema, i = this.db._deps.indexedDB;
function o(e, t) {
try {
return 0 === i.cmp(e, t)
} catch (e) {
return !1
}
}
const [s, a] = t.reduce((([t, n], i) => {
const s = r[i],
a = e[i];
return [t || s, t || !s ? Et(n, s && s.multi ? e => {
const t = K(e, i);
return d(t) && t.some((e => o(a, e)))
} : e => o(a, K(e, i))) : n]
}), [null, null]);
return s ? this.where(s.name).equals(e[s.keyPath]).filter(a) : n ? this.filter(a) : this.where(t).equals("")
}
filter(e) {
return this.toCollection().and(e)
}
count(e) {
return this.toCollection().count(e)
}
offset(e) {
return this.toCollection().offset(e)
}
limit(e) {
return this.toCollection().limit(e)
}
each(e) {
return this.toCollection().each(e)
}
toArray(e) {
return this.toCollection().toArray(e)
}
toCollection() {
return new this.db.Collection(new this.db.WhereClause(this))
}
orderBy(e) {
return new this.db.Collection(new this.db.WhereClause(this, d(e) ? `[${e.join("+")}]` : e))
}
reverse() {
return this.toCollection().reverse()
}
mapToClass(e) {
this.schema.mappedClass = e;
const t = t => {
if (!t) return t;
const n = Object.create(e.prototype);
for (var r in t)
if (y(t, r)) try {
n[r] = t[r]
} catch (e) {}
return n
};
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = t, this.hook("reading", t), e
}
defineClass() {
return this.mapToClass((function(e) {
h(this, e)
}))
}
add(e, t) {
const {
auto: n,
keyPath: r
} = this.schema.primKey;
let i = e;
return r && n && (i = Dt(r)(e)), this._trans("readwrite", (e => this.core.mutate({
trans: e,
type: "add",
keys: null != t ? [t] : null,
values: [i]
}))).then((e => e.numFailures ? Ne.reject(e.failures[0]) : e.lastResult)).then((t => {
if (r) try {
E(e, r, t)
} catch (e) {}
return t
}))
}
update(e, t) {
if ("object" != typeof e || d(e)) return this.where(":id").equals(e).modify(t); {
const n = K(e, this.schema.primKey.keyPath);
if (void 0 === n) return _t(new se.InvalidArgument("Given object does not contain its primary key"));
try {
"function" != typeof t ? u(t).forEach((n => {
E(e, n, t[n])
})) : t(e, {
value: e,
primKey: n
})
} catch (e) {}
return this.where(":id").equals(n).modify(t)
}
}
put(e, t) {
const {
auto: n,
keyPath: r
} = this.schema.primKey;
let i = e;
return r && n && (i = Dt(r)(e)), this._trans("readwrite", (e => this.core.mutate({
trans: e,
type: "put",
values: [i],
keys: null != t ? [t] : null
}))).then((e => e.numFailures ? Ne.reject(e.failures[0]) : e.lastResult)).then((t => {
if (r) try {
E(e, r, t)
} catch (e) {}
return t
}))
}
delete(e) {
return this._trans("readwrite", (t => this.core.mutate({
trans: t,
type: "delete",
keys: [e]
}))).then((e => e.numFailures ? Ne.reject(e.failures[0]) : void 0))
}
clear() {
return this._trans("readwrite", (e => this.core.mutate({
trans: e,
type: "deleteRange",
range: At
}))).then((e => e.numFailures ? Ne.reject(e.failures[0]) : void 0))
}
bulkGet(e) {
return this._trans("readonly", (t => this.core.getMany({
keys: e,
trans: t
}).then((e => e.map((e => this.hook.reading.fire(e)))))))
}
bulkAdd(e, t, n) {
const r = Array.isArray(t) ? t : void 0,
i = (n = n || (r ? void 0 : t)) ? n.allKeys : void 0;
return this._trans("readwrite", (t => {
const {
auto: n,
keyPath: o
} = this.schema.primKey;
if (o && r) throw new se.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
if (r && r.length !== e.length) throw new se.InvalidArgument("Arguments objects and keys must have the same length");
const s = e.length;
let a = o && n ? e.map(Dt(o)) : e;
return this.core.mutate({
trans: t,
type: "add",
keys: r,
values: a,
wantResults: i
}).then((({
numFailures: e,
results: t,
lastResult: n,
failures: r
}) => {
if (0 === e) return i ? t : n;
throw new re(`${this.name}.bulkAdd(): ${e} of ${s} operations failed`, r)
}))
}))
}
bulkPut(e, t, n) {
const r = Array.isArray(t) ? t : void 0,
i = (n = n || (r ? void 0 : t)) ? n.allKeys : void 0;
return this._trans("readwrite", (t => {
const {
auto: n,
keyPath: o
} = this.schema.primKey;
if (o && r) throw new se.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
if (r && r.length !== e.length) throw new se.InvalidArgument("Arguments objects and keys must have the same length");
const s = e.length;
let a = o && n ? e.map(Dt(o)) : e;
return this.core.mutate({
trans: t,
type: "put",
keys: r,
values: a,
wantResults: i
}).then((({
numFailures: e,
results: t,
lastResult: n,
failures: r
}) => {
if (0 === e) return i ? t : n;
throw new re(`${this.name}.bulkPut(): ${e} of ${s} operations failed`, r)
}))
}))
}
bulkDelete(e) {
const t = e.length;
return this._trans("readwrite", (t => this.core.mutate({
trans: t,
type: "delete",
keys: e
}))).then((({
numFailures: e,
lastResult: n,
failures: r
}) => {
if (0 === e) return n;
throw new re(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`, r)
}))
}
}
function It(e) {
var t = {},
n = function(n, r) {
if (r) {
for (var i = arguments.length, o = new Array(i - 1); --i;) o[i - 1] = arguments[i];
return t[n].subscribe.apply(null, o), e
}
if ("string" == typeof n) return t[n]
};
n.addEventType = o;
for (var r = 1, i = arguments.length; r < i; ++r) o(arguments[r]);
return n;
function o(e, r, i) {
if ("object" == typeof e) return s(e);
r || (r = ve), i || (i = le);
var o = {
subscribers: [],
fire: i,
subscribe: function(e) {
-1 === o.subscribers.indexOf(e) && (o.subscribers.push(e), o.fire = r(o.fire, e))
},
unsubscribe: function(e) {
o.subscribers = o.subscribers.filter((function(t) {
return t !== e
})), o.fire = o.subscribers.reduce(r, i)
}
};
return t[e] = n[e] = o, o
}
function s(e) {
u(e).forEach((function(t) {
var n = e[t];
if (d(n)) o(t, e[t][0], e[t][1]);
else {
if ("asap" !== n) throw new se.InvalidArgument("Invalid event config");
var r = o(t, ue, (function() {
for (var e = arguments.length, t = new Array(e); e--;) t[e] = arguments[e];
r.subscribers.forEach((function(e) {
S((function() {
e.apply(null, t)
}))
}))
}))
}
}))
}
}
function jt(e, t) {
return b(t).from({
prototype: e
}), t
}
function Tt(e, t) {
return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter)
}
function Mt(e, t) {
e.filter = Et(e.filter, t)
}
function Rt(e, t, n) {
var r = e.replayFilter;
e.replayFilter = r ? () => Et(r(), t()) : t, e.justLimit = n && !r
}
function Ft(e, t) {
if (e.isPrimKey) return t.primaryKey;
const n = t.getIndexByKeyPath(e.index);
if (!n) throw new se.Schema("KeyPath " + e.index + " on object store " + t.name + " is not indexed");
return n
}
function Nt(e, t, n) {
const r = Ft(e, t.schema);
return t.openCursor({
trans: n,
values: !e.keysOnly,
reverse: "prev" === e.dir,
unique: !!e.unique,
query: {
index: r,
range: e.range
}
})
}
function Ut(e, t, n, r) {
const i = e.replayFilter ? Et(e.filter, e.replayFilter()) : e.filter;
if (e.or) {
const o = {},
s = (e, n, r) => {
if (!i || i(n, r, (e => n.stop(e)), (e => n.fail(e)))) {
var s = n.primaryKey,
a = "" + s;
"[object ArrayBuffer]" === a && (a = "" + new Uint8Array(s)), y(o, a) || (o[a] = !0, t(e, n, r))
}
};
return Promise.all([e.or._iterate(s, n), qt(Nt(e, r, n), e.algorithm, s, !e.keysOnly && e.valueMapper)])
}
return qt(Nt(e, r, n), Et(e.algorithm, i), t, !e.keysOnly && e.valueMapper)
}
function qt(e, t, n, r) {
var i = et(r ? (e, t, i) => n(r(e), t, i) : n);
return e.then((e => {
if (e) return e.start((() => {
var n = () => e.continue();
t && !t(e, (e => n = e), (t => {
e.stop(t), n = le
}), (t => {
e.fail(t), n = le
})) || i(e.value, e, (e => n = e)), n()
}))
}))
}
function Lt(e, t) {
try {
const n = zt(e),
r = zt(t);
if (n !== r) return "Array" === n ? 1 : "Array" === r ? -1 : "binary" === n ? 1 : "binary" === r ? -1 : "string" === n ? 1 : "string" === r ? -1 : "Date" === n ? 1 : "Date" !== r ? NaN : -1;
switch (n) {
case "number":
case "Date":
case "string":
return e > t ? 1 : e < t ? -1 : 0;
case "binary":
return function(e, t) {
const n = e.length,
r = t.length,
i = n < r ? n : r;
for (let n = 0; n < i; ++n)
if (e[n] !== t[n]) return e[n] < t[n] ? -1 : 1;
return n === r ? 0 : n < r ? -1 : 1
}(Vt(e), Vt(t));
case "Array":
return function(e, t) {
const n = e.length,
r = t.length,
i = n < r ? n : r;
for (let n = 0; n < i; ++n) {
const r = Lt(e[n], t[n]);
if (0 !== r) return r
}
return n === r ? 0 : n < r ? -1 : 1
}(e, t)
}
} catch (e) {}
return NaN
}
function zt(e) {
const t = typeof e;
if ("object" !== t) return t;
if (ArrayBuffer.isView(e)) return "binary";
const n = N(e);
return "ArrayBuffer" === n ? "binary" : n
}
function Vt(e) {
return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e)
}
class Wt {
_read(e, t) {
var n = this._ctx;
return n.error ? n.table._trans(null, _t.bind(null, n.error)) : n.table._trans("readonly", e).then(t)
}
_write(e) {
var t = this._ctx;
return t.error ? t.table._trans(null, _t.bind(null, t.error)) : t.table._trans("readwrite", e, "locked")
}
_addAlgorithm(e) {
var t = this._ctx;
t.algorithm = Et(t.algorithm, e)
}
_iterate(e, t) {
return Ut(this._ctx, e, t, this._ctx.table.core)
}
clone(e) {
var t = Object.create(this.constructor.prototype),
n = Object.create(this._ctx);
return e && h(n, e), t._ctx = n, t
}
raw() {
return this._ctx.valueMapper = null, this
}
each(e) {
var t = this._ctx;
return this._read((n => Ut(t, e, n, t.table.core)))
}
count(e) {
return this._read((e => {
const t = this._ctx,
n = t.table.core;
if (Tt(t, !0)) return n.count({
trans: e,
query: {
index: Ft(t, n.schema),
range: t.range
}
}).then((e => Math.min(e, t.limit)));
var r = 0;
return Ut(t, (() => (++r, !1)), e, n).then((() => r))
})).then(e)
}
sortBy(e, t) {
const n = e.split(".").reverse(),
r = n[0],
i = n.length - 1;
function o(e, t) {
return t ? o(e[n[t]], t - 1) : e[r]
}
var s = "next" === this._ctx.dir ? 1 : -1;
function a(e, t) {
var n = o(e, i),
r = o(t, i);
return n < r ? -s : n > r ? s : 0
}
return this.toArray((function(e) {
return e.sort(a)
})).then(t)
}
toArray(e) {
return this._read((e => {
var t = this._ctx;
if ("next" === t.dir && Tt(t, !0) && t.limit > 0) {
const {
valueMapper: n
} = t, r = Ft(t, t.table.core.schema);
return t.table.core.query({
trans: e,
limit: t.limit,
values: !0,
query: {
index: r,
range: t.range
}
}).then((({
result: e
}) => n ? e.map(n) : e))
} {
const n = [];
return Ut(t, (e => n.push(e)), e, t.table.core).then((() => n))
}
}), e)
}
offset(e) {
var t = this._ctx;
return e <= 0 || (t.offset += e, Tt(t) ? Rt(t, (() => {
var t = e;
return (e, n) => 0 === t || (1 === t ? (--t, !1) : (n((() => {
e.advance(t), t = 0
})), !1))
})) : Rt(t, (() => {
var t = e;
return () => --t < 0
}))), this
}
limit(e) {
return this._ctx.limit = Math.min(this._ctx.limit, e), Rt(this._ctx, (() => {
var t = e;
return function(e, n, r) {
return --t <= 0 && n(r), t >= 0
}
}), !0), this
}
until(e, t) {
return Mt(this._ctx, (function(n, r, i) {
return !e(n.value) || (r(i), t)
})), this
}
first(e) {
return this.limit(1).toArray((function(e) {
return e[0]
})).then(e)
}
last(e) {
return this.reverse().first(e)
}
filter(e) {
var t, n;
return Mt(this._ctx, (function(t) {
return e(t.value)
})), t = this._ctx, n = e, t.isMatch = Et(t.isMatch, n), this
}
and(e) {
return this.filter(e)
}
or(e) {
return new this.db.WhereClause(this._ctx.table, e, this)
}
reverse() {
return this._ctx.dir = "prev" === this._ctx.dir ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this
}
desc() {
return this.reverse()
}
eachKey(e) {
var t = this._ctx;
return t.keysOnly = !t.isMatch, this.each((function(t, n) {
e(n.key, n)
}))
}
eachUniqueKey(e) {
return this._ctx.unique = "unique", this.eachKey(e)
}
eachPrimaryKey(e) {
var t = this._ctx;
return t.keysOnly = !t.isMatch, this.each((function(t, n) {
e(n.primaryKey, n)
}))
}
keys(e) {
var t = this._ctx;
t.keysOnly = !t.isMatch;
var n = [];
return this.each((function(e, t) {
n.push(t.key)
})).then((function() {
return n
})).then(e)
}
primaryKeys(e) {
var t = this._ctx;
if ("next" === t.dir && Tt(t, !0) && t.limit > 0) return this._read((e => {
var n = Ft(t, t.table.core.schema);
return t.table.core.query({
trans: e,
values: !1,
limit: t.limit,
query: {
index: n,
range: t.range
}
})
})).then((({
result: e
}) => e)).then(e);
t.keysOnly = !t.isMatch;
var n = [];
return this.each((function(e, t) {
n.push(t.primaryKey)
})).then((function() {
return n
})).then(e)
}
uniqueKeys(e) {
return this._ctx.unique = "unique", this.keys(e)
}
firstKey(e) {
return this.limit(1).keys((function(e) {
return e[0]
})).then(e)
}
lastKey(e) {
return this.reverse().firstKey(e)
}
distinct() {
var e = this._ctx,
t = e.index && e.table.schema.idxByName[e.index];
if (!t || !t.multi) return this;
var n = {};
return Mt(this._ctx, (function(e) {
var t = e.primaryKey.toString(),
r = y(n, t);
return n[t] = !0, !r
})), this
}
modify(e) {
var t = this._ctx;
return this._write((n => {
var r;
if ("function" == typeof e) r = e;
else {
var i = u(e),
o = i.length;
r = function(t) {
for (var n = !1, r = 0; r < o; ++r) {
var s = i[r],
a = e[s];
K(t, s) !== a && (E(t, s, a), n = !0)
}
return n
}
}
const s = t.table.core,
{
outbound: a,
extractKey: c
} = s.schema.primaryKey,
l = this.db._options.modifyChunkSize || 200,
d = [];
let h = 0;
const f = [],
p = (e, t) => {
const {
failures: n,
numFailures: r
} = t;
h += e - r;
for (let e of u(n)) d.push(n[e])
};
return this.clone().primaryKeys().then((i => {
const o = u => {
const d = Math.min(l, i.length - u);
return s.getMany({
trans: n,
keys: i.slice(u, u + d),
cache: "immutable"
}).then((h => {
const f = [],
y = [],
v = a ? [] : null,
m = [];
for (let e = 0; e < d; ++e) {
const t = h[e],
n = {
value: M(t),
primKey: i[u + e]
};
!1 !== r.call(n, n.value, n) && (null == n.value ? m.push(i[u + e]) : a || 0 === Lt(c(t), c(n.value)) ? (y.push(n.value), a && v.push(i[u + e])) : (m.push(i[u + e]), f.push(n.value)))
}
const g = Tt(t) && t.limit === 1 / 0 && ("function" != typeof e || e === Gt) && {
index: t.index,
range: t.range
};
return Promise.resolve(f.length > 0 && s.mutate({
trans: n,
type: "add",
values: f
}).then((e => {
for (let t in e.failures) m.splice(parseInt(t), 1);
p(f.length, e)
}))).then((() => (y.length > 0 || g && "object" == typeof e) && s.mutate({
trans: n,
type: "put",
keys: v,
values: y,
criteria: g,
changeSpec: "function" != typeof e && e
}).then((e => p(y.length, e))))).then((() => (m.length > 0 || g && e === Gt) && s.mutate({
trans: n,
type: "delete",
keys: m,
criteria: g
}).then((e => p(m.length, e))))).then((() => i.length > u + d && o(u + l)))
}))
};
return o(0).then((() => {
if (d.length > 0) throw new ne("Error modifying one or more objects", d, h, f);
return i.length
}))
}))
}))
}
delete() {
var e = this._ctx,
t = e.range;
return Tt(e) && (e.isPrimKey && !Ot || 3 === t.type) ? this._write((n => {
const {
primaryKey: r
} = e.table.core.schema, i = t;
return e.table.core.count({
trans: n,
query: {
index: r,
range: i
}
}).then((t => e.table.core.mutate({
trans: n,
type: "deleteRange",
range: i
}).then((({
failures: e,
lastResult: n,
results: r,
numFailures: i
}) => {
if (i) throw new ne("Could not delete some values", Object.keys(e).map((t => e[t])), t - i);
return t - i
}))))
})) : this.modify(Gt)
}
}
const Gt = (e, t) => t.value = null;
function Yt(e, t) {
return e < t ? -1 : e === t ? 0 : 1
}
function Qt(e, t) {
return e > t ? -1 : e === t ? 0 : 1
}
function Ht(e, t, n) {
var r = e instanceof tn ? new e.Collection(e) : e;
return r._ctx.error = n ? new n(t) : new TypeError(t), r
}
function Jt(e) {
return new e.Collection(e, (() => en(""))).limit(0)
}
function Zt(e, t, n, r, i, o) {
for (var s = Math.min(e.length, r.length), a = -1, c = 0; c < s; ++c) {
var l = t[c];
if (l !== r[c]) return i(e[c], n[c]) < 0 ? e.substr(0, c) + n[c] + n.substr(c + 1) : i(e[c], r[c]) < 0 ? e.substr(0, c) + r[c] + n.substr(c + 1) : a >= 0 ? e.substr(0, a) + t[a] + n.substr(a + 1) : null;
i(e[c], l) < 0 && (a = c)
}
return s < r.length && "next" === o ? e + n.substr(e.length) : s < e.length && "prev" === o ? e.substr(0, n.length) : a < 0 ? null : e.substr(0, a) + r[a] + n.substr(a + 1)
}
function Xt(e, t, n, r) {
var i, o, s, a, c, l, u, d = n.length;
if (!n.every((e => "string" == typeof e))) return Ht(e, "String expected.");
function h(e) {
i = function(e) {
return "next" === e ? e => e.toUpperCase() : e => e.toLowerCase()
}(e), o = function(e) {
return "next" === e ? e => e.toLowerCase() : e => e.toUpperCase()
}(e), s = "next" === e ? Yt : Qt;
var t = n.map((function(e) {
return {
lower: o(e),
upper: i(e)
}
})).sort((function(e, t) {
return s(e.lower, t.lower)
}));
a = t.map((function(e) {
return e.upper
})), c = t.map((function(e) {
return e.lower
})), l = e, u = "next" === e ? "" : r
}
h("next");
var f = new e.Collection(e, (() => $t(a[0], c[d - 1] + r)));
f._ondirectionchange = function(e) {
h(e)
};
var p = 0;
return f._addAlgorithm((function(e, n, r) {
var i = e.key;
if ("string" != typeof i) return !1;
var h = o(i);
if (t(h, c, p)) return !0;
for (var f = null, y = p; y < d; ++y) {
var v = Zt(i, h, a[y], c[y], s, l);
null === v && null === f ? p = y + 1 : (null === f || s(f, v) > 0) && (f = v)
}
return n(null !== f ? function() {
e.continue(f + u)
} : r), !1
})), f
}
function $t(e, t, n, r) {
return {
type: 2,
lower: e,
upper: t,
lowerOpen: n,
upperOpen: r
}
}
function en(e) {
return {
type: 1,
lower: e,
upper: e
}
}
class tn {
get Collection() {
return this._ctx.table.db.Collection
}
between(e, t, n, r) {
n = !1 !== n, r = !0 === r;
try {
return this._cmp(e, t) > 0 || 0 === this._cmp(e, t) && (n || r) && (!n || !r) ? Jt(this) : new this.Collection(this, (() => $t(e, t, !n, !r)))
} catch (e) {
return Ht(this, xt)
}
}
equals(e) {
return null == e ? Ht(this, xt) : new this.Collection(this, (() => en(e)))
}
above(e) {
return null == e ? Ht(this, xt) : new this.Collection(this, (() => $t(e, void 0, !0)))
}
aboveOrEqual(e) {
return null == e ? Ht(this, xt) : new this.Collection(this, (() => $t(e, void 0, !1)))
}
below(e) {
return null == e ? Ht(this, xt) : new this.Collection(this, (() => $t(void 0, e, !1, !0)))
}
belowOrEqual(e) {
return null == e ? Ht(this, xt) : new this.Collection(this, (() => $t(void 0, e)))
}
startsWith(e) {
return "string" != typeof e ? Ht(this, "String expected.") : this.between(e, e + kt, !0, !0)
}
startsWithIgnoreCase(e) {
return "" === e ? this.startsWith(e) : Xt(this, ((e, t) => 0 === e.indexOf(t[0])), [e], kt)
}
equalsIgnoreCase(e) {
return Xt(this, ((e, t) => e === t[0]), [e], "")
}
anyOfIgnoreCase() {
var e = z.apply(L, arguments);
return 0 === e.length ? Jt(this) : Xt(this, ((e, t) => -1 !== t.indexOf(e)), e, "")
}
startsWithAnyOfIgnoreCase() {
var e = z.apply(L, arguments);
return 0 === e.length ? Jt(this) : Xt(this, ((e, t) => t.some((t => 0 === e.indexOf(t)))), e, kt)
}
anyOf() {
const e = z.apply(L, arguments);
let t = this._cmp;
try {
e.sort(t)
} catch (e) {
return Ht(this, xt)
}
if (0 === e.length) return Jt(this);
const n = new this.Collection(this, (() => $t(e[0], e[e.length - 1])));
n._ondirectionchange = n => {
t = "next" === n ? this._ascending : this._descending, e.sort(t)
};
let r = 0;
return n._addAlgorithm(((n, i, o) => {
const s = n.key;
for (; t(s, e[r]) > 0;)
if (++r, r === e.length) return i(o), !1;
return 0 === t(s, e[r]) || (i((() => {
n.continue(e[r])
})), !1)
})), n
}
notEqual(e) {
return this.inAnyRange([
[-1 / 0, e],
[e, this.db._maxKey]
], {
includeLowers: !1,
includeUppers: !1
})
}
noneOf() {
const e = z.apply(L, arguments);
if (0 === e.length) return new this.Collection(this);
try {
e.sort(this._ascending)
} catch (e) {
return Ht(this, xt)
}
const t = e.reduce(((e, t) => e ? e.concat([
[e[e.length - 1][1], t]
]) : [
[-1 / 0, t]
]), null);
return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, {
includeLowers: !1,
includeUppers: !1
})
}
inAnyRange(e, t) {
const n = this._cmp,
r = this._ascending,
i = this._descending,
o = this._min,
s = this._max;
if (0 === e.length) return Jt(this);
if (!e.every((e => void 0 !== e[0] && void 0 !== e[1] && r(e[0], e[1]) <= 0))) return Ht(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", se.InvalidArgument);
const a = !t || !1 !== t.includeLowers,
c = t && !0 === t.includeUppers;
let l, u = r;
function d(e, t) {
return u(e[0], t[0])
}
try {
l = e.reduce((function(e, t) {
let r = 0,
i = e.length;
for (; r < i; ++r) {
const i = e[r];
if (n(t[0], i[1]) < 0 && n(t[1], i[0]) > 0) {
i[0] = o(i[0], t[0]), i[1] = s(i[1], t[1]);
break
}
}
return r === i && e.push(t), e
}), []), l.sort(d)
} catch (e) {
return Ht(this, xt)
}
let h = 0;
const f = c ? e => r(e, l[h][1]) > 0 : e => r(e, l[h][1]) >= 0,
p = a ? e => i(e, l[h][0]) > 0 : e => i(e, l[h][0]) >= 0;
let y = f;
const v = new this.Collection(this, (() => $t(l[0][0], l[l.length - 1][1], !a, !c)));
return v._ondirectionchange = e => {
"next" === e ? (y = f, u = r) : (y = p, u = i), l.sort(d)
}, v._addAlgorithm(((e, t, n) => {
for (var i = e.key; y(i);)
if (++h, h === l.length) return t(n), !1;
return !! function(e) {
return !f(e) && !p(e)
}(i) || (0 === this._cmp(i, l[h][1]) || 0 === this._cmp(i, l[h][0]) || t((() => {
u === r ? e.continue(l[h][0]) : e.continue(l[h][1])
})), !1)
})), v
}
startsWithAnyOf() {
const e = z.apply(L, arguments);
return e.every((e => "string" == typeof e)) ? 0 === e.length ? Jt(this) : this.inAnyRange(e.map((e => [e, e + kt]))) : Ht(this, "startsWithAnyOf() only works with strings")
}
}
function nn(e) {
return et((function(t) {
return rn(t), e(t.target.error), !1
}))
}
function rn(e) {
e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault()
}
const on = It(null, "storagemutated");
class sn {
_lock() {
return P(!Te.global), ++this._reculock, 1 !== this._reculock || Te.global || (Te.lockOwnerFor = this), this
}
_unlock() {
if (P(!Te.global), 0 == --this._reculock)
for (Te.global || (Te.lockOwnerFor = null); this._blockedFuncs.length > 0 && !this._locked();) {
var e = this._blockedFuncs.shift();
try {
yt(e[1], e[0])
} catch (e) {}
}
return this
}
_locked() {
return this._reculock && Te.lockOwnerFor !== this
}
create(e) {
if (!this.mode) return this;
const t = this.db.idbdb,
n = this.db._state.dbOpenError;
if (P(!this.idbtrans), !e && !t) switch (n && n.name) {
case "DatabaseClosedError":
throw new se.DatabaseClosed(n);
case "MissingAPIError":
throw new se.MissingAPI(n.message, n);
default:
throw new se.OpenFailed(n)
}
if (!this.active) throw new se.TransactionInactive;
return P(null === this._completion._state), (e = this.idbtrans = e || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, {
durability: this.chromeTransactionDurability
}) : t.transaction(this.storeNames, this.mode, {
durability: this.chromeTransactionDurability
}))).onerror = et((t => {
rn(t), this._reject(e.error)
})), e.onabort = et((t => {
rn(t), this.active && this._reject(new se.Abort(e.error)), this.active = !1, this.on("abort").fire(t)
})), e.oncomplete = et((() => {
this.active = !1, this._resolve(), "mutatedParts" in e && on.storagemutated.fire(e.mutatedParts)
})), this
}
_promise(e, t, n) {
if ("readwrite" === e && "readwrite" !== this.mode) return _t(new se.ReadOnly("Transaction is readonly"));
if (!this.active) return _t(new se.TransactionInactive);
if (this._locked()) return new Ne(((r, i) => {
this._blockedFuncs.push([() => {
this._promise(e, t, n).then(r, i)
}, Te])
}));
if (n) return at((() => {
var e = new Ne(((e, n) => {
this._lock();
const r = t(e, n, this);
r && r.then && r.then(e, n)
}));
return e.finally((() => this._unlock())), e._lib = !0, e
}));
var r = new Ne(((e, n) => {
var r = t(e, n, this);
r && r.then && r.then(e, n)
}));
return r._lib = !0, r
}
_root() {
return this.parent ? this.parent._root() : this
}
waitFor(e) {
var t = this._root();
const n = Ne.resolve(e);
if (t._waitingFor) t._waitingFor = t._waitingFor.then((() => n));
else {
t._waitingFor = n, t._waitingQueue = [];
var r = t.idbtrans.objectStore(t.storeNames[0]);
! function e() {
for (++t._spinCount; t._waitingQueue.length;) t._waitingQueue.shift()();
t._waitingFor && (r.get(-1 / 0).onsuccess = e)
}()
}
var i = t._waitingFor;
return new Ne(((e, r) => {
n.then((n => t._waitingQueue.push(et(e.bind(null, n)))), (e => t._waitingQueue.push(et(r.bind(null, e))))).finally((() => {
t._waitingFor === i && (t._waitingFor = null)
}))
}))
}
abort() {
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new se.Abort))
}
table(e) {
const t = this._memoizedTables || (this._memoizedTables = {});
if (y(t, e)) return t[e];
const n = this.schema[e];
if (!n) throw new se.NotFound("Table " + e + " not part of transaction");
const r = new this.db.Table(e, n, this);
return r.core = this.db.core.table(e), t[e] = r, r
}
}
function an(e, t, n, r, i, o, s) {
return {
name: e,
keyPath: t,
unique: n,
multi: r,
auto: i,
compound: o,
src: (n && !s ? "&" : "") + (r ? "*" : "") + (i ? "++" : "") + cn(t)
}
}
function cn(e) {
return "string" == typeof e ? e : e ? "[" + [].join.call(e, "+") + "]" : ""
}
function ln(e, t, n) {
return {
name: e,
primKey: t,
indexes: n,
mappedClass: null,
idxByName: O(n, (e => [e.name, e]))
}
}
let un = e => {
try {
return e.only([
[]
]), un = () => [
[]
], [
[]
]
} catch (e) {
return un = () => kt, kt
}
};
function dn(e) {
return null == e ? () => {} : "string" == typeof e ? function(e) {
return 1 === e.split(".").length ? t => t[e] : t => K(t, e)
}(e) : t => K(t, e)
}
function hn(e) {
return [].slice.call(e)
}
let fn = 0;
function pn(e) {
return null == e ? ":id" : "string" == typeof e ? e : `[${e.join("+")}]`
}
function yn(e, t, n) {
function r(e) {
if (3 === e.type) return null;
if (4 === e.type) throw new Error("Cannot convert never type to IDBKeyRange");
const {
lower: n,
upper: r,
lowerOpen: i,
upperOpen: o
} = e;
return void 0 === n ? void 0 === r ? null : t.upperBound(r, !!o) : void 0 === r ? t.lowerBound(n, !!i) : t.bound(n, r, !!i, !!o)
}
const {
schema: i,
hasGetAll: o
} = function(e, t) {
const n = hn(e.objectStoreNames);
return {
schema: {
name: e.name,
tables: n.map((e => t.objectStore(e))).map((e => {
const {
keyPath: t,
autoIncrement: n
} = e, r = d(t), i = null == t, o = {}, s = {
name: e.name,
primaryKey: {
name: null,
isPrimaryKey: !0,
outbound: i,
compound: r,
keyPath: t,
autoIncrement: n,
unique: !0,
extractKey: dn(t)
},
indexes: hn(e.indexNames).map((t => e.index(t))).map((e => {
const {
name: t,
unique: n,
multiEntry: r,
keyPath: i
} = e, s = {
name: t,
compound: d(i),
keyPath: i,
unique: n,
multiEntry: r,
extractKey: dn(i)
};
return o[pn(i)] = s, s
})),
getIndexByKeyPath: e => o[pn(e)]
};
return o[":id"] = s.primaryKey, null != t && (o[pn(t)] = s.primaryKey), s
}))
},
hasGetAll: n.length > 0 && "getAll" in t.objectStore(n[0]) && !("undefined" != typeof navigator && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604)
}
}(e, n), s = i.tables.map((e => function(e) {
const t = e.name;
return {
name: t,
schema: e,
mutate: function({
trans: e,
type: n,
keys: i,
values: o,
range: s
}) {
return new Promise(((a, c) => {
a = et(a);
const l = e.objectStore(t),
u = null == l.keyPath,
d = "put" === n || "add" === n;
if (!d && "delete" !== n && "deleteRange" !== n) throw new Error("Invalid operation type: " + n);
const {
length: h
} = i || o || {
length: 1
};
if (i && o && i.length !== o.length) throw new Error("Given keys array must have same length as given values array.");
if (0 === h) return a({
numFailures: 0,
failures: {},
results: [],
lastResult: void 0
});
let f;
const p = [],
y = [];
let v = 0;
const m = e => {
++v, rn(e)
};
if ("deleteRange" === n) {
if (4 === s.type) return a({
numFailures: v,
failures: y,
results: [],
lastResult: void 0
});
3 === s.type ? p.push(f = l.clear()) : p.push(f = l.delete(r(s)))
} else {
const [e, t] = d ? u ? [o, i] : [o, null] : [i, null];
if (d)
for (let r = 0; r < h; ++r) p.push(f = t && void 0 !== t[r] ? l[n](e[r], t[r]) : l[n](e[r])), f.onerror = m;
else
for (let t = 0; t < h; ++t) p.push(f = l[n](e[t])), f.onerror = m
}
const g = e => {
const t = e.target.result;
p.forEach(((e, t) => null != e.error && (y[t] = e.error))), a({
numFailures: v,
failures: y,
results: "delete" === n ? i : p.map((e => e.result)),
lastResult: t
})
};
f.onerror = e => {
m(e), g(e)
}, f.onsuccess = g
}))
},
getMany: ({
trans: e,
keys: n
}) => new Promise(((r, i) => {
r = et(r);
const o = e.objectStore(t),
s = n.length,
a = new Array(s);
let c, l = 0,
u = 0;
const d = e => {
const t = e.target;
a[t._pos] = t.result, ++u === l && r(a)
},
h = nn(i);
for (let e = 0; e < s; ++e) null != n[e] && (c = o.get(n[e]), c._pos = e, c.onsuccess = d, c.onerror = h, ++l);
0 === l && r(a)
})),
get: ({
trans: e,
key: n
}) => new Promise(((r, i) => {
r = et(r);
const o = e.objectStore(t).get(n);
o.onsuccess = e => r(e.target.result), o.onerror = nn(i)
})),
query: function(e) {
return n => new Promise(((i, o) => {
i = et(i);
const {
trans: s,
values: a,
limit: c,
query: l
} = n, u = c === 1 / 0 ? void 0 : c, {
index: d,
range: h
} = l, f = s.objectStore(t), p = d.isPrimaryKey ? f : f.index(d.name), y = r(h);
if (0 === c) return i({
result: []
});
if (e) {
const e = a ? p.getAll(y, u) : p.getAllKeys(y, u);
e.onsuccess = e => i({
result: e.target.result
}), e.onerror = nn(o)
} else {
let e = 0;
const t = a || !("openKeyCursor" in p) ? p.openCursor(y) : p.openKeyCursor(y),
n = [];
t.onsuccess = r => {
const o = t.result;
return o ? (n.push(a ? o.value : o.primaryKey), ++e === c ? i({
result: n
}) : void o.continue()) : i({
result: n
})
}, t.onerror = nn(o)
}
}))
}(o),
openCursor: function({
trans: e,
values: n,
query: i,
reverse: o,
unique: s
}) {
return new Promise(((a, c) => {
a = et(a);
const {
index: l,
range: u
} = i, d = e.objectStore(t), h = l.isPrimaryKey ? d : d.index(l.name), f = o ? s ? "prevunique" : "prev" : s ? "nextunique" : "next", p = n || !("openKeyCursor" in h) ? h.openCursor(r(u), f) : h.openKeyCursor(r(u), f);
p.onerror = nn(c), p.onsuccess = et((t => {
const n = p.result;
if (!n) return void a(null);
n.___id = ++fn, n.done = !1;
const r = n.continue.bind(n);
let i = n.continuePrimaryKey;
i && (i = i.bind(n));
const o = n.advance.bind(n),
s = () => {
throw new Error("Cursor not stopped")
};
n.trans = e, n.stop = n.continue = n.continuePrimaryKey = n.advance = () => {
throw new Error("Cursor not started")
}, n.fail = et(c), n.next = function() {
let e = 1;
return this.start((() => e-- ? this.continue() : this.stop())).then((() => this))
}, n.start = e => {
const t = new Promise(((e, t) => {
e = et(e), p.onerror = nn(t), n.fail = t, n.stop = t => {
n.stop = n.continue = n.continuePrimaryKey = n.advance = s, e(t)
}
})),
a = () => {
if (p.result) try {
e()
} catch (e) {
n.fail(e)
} else n.done = !0, n.start = () => {
throw new Error("Cursor behind last entry")
}, n.stop()
};
return p.onsuccess = et((e => {
p.onsuccess = a, a()
})), n.continue = r, n.continuePrimaryKey = i, n.advance = o, a(), t
}, a(n)
}), c)
}))
},
count({
query: e,
trans: n
}) {
const {
index: i,
range: o
} = e;
return new Promise(((e, s) => {
const a = n.objectStore(t),
c = i.isPrimaryKey ? a : a.index(i.name),
l = r(o),
u = l ? c.count(l) : c.count();
u.onsuccess = et((t => e(t.target.result))), u.onerror = nn(s)
}))
}
}
}(e))), a = {};
return s.forEach((e => a[e.name] = e)), {
stack: "dbcore",
transaction: e.transaction.bind(e),
table(e) {
if (!a[e]) throw new Error(`Table '${e}' not found`);
return a[e]
},
MIN_KEY: -1 / 0,
MAX_KEY: un(t),
schema: i
}
}
function vn({
_novip: e
}, t) {
const n = t.db,
r = function(e, t, {
IDBKeyRange: n,
indexedDB: r
}, i) {
const o = function(e, t) {
return t.reduce(((e, {
create: t
}) => ({...e, ...t(e)
})), e)
}(yn(t, n, i), e.dbcore);
return {
dbcore: o
}
}(e._middlewares, n, e._deps, t);
e.core = r.dbcore, e.tables.forEach((t => {
const n = t.name;
e.core.schema.tables.some((e => e.name === n)) && (t.core = e.core.table(n), e[n] instanceof e.Table && (e[n].core = t.core))
}))
}
function mn({
_novip: e
}, t, n, r) {
n.forEach((n => {
const i = r[n];
t.forEach((t => {
const r = w(t, n);
(!r || "value" in r && void 0 === r.value) && (t === e.Transaction.prototype || t instanceof e.Transaction ? g(t, n, {
get() {
return this.table(n)
}, set(e) {
m(this, n, {
value: e,
writable: !0,
configurable: !0,
enumerable: !0
})
}
}) : t[n] = new e.Table(n, i))
}))
}))
}
function gn({
_novip: e
}, t) {
t.forEach((t => {
for (let n in t) t[n] instanceof e.Table && delete t[n]
}))
}
function bn(e, t) {
return e._cfg.version - t._cfg.version
}
function _n(e, t, n, r) {
const i = e._dbSchema,
o = e._createTransaction("readwrite", e._storeNames, i);
o.create(n), o._completion.catch(r);
const s = o._reject.bind(o),
a = Te.transless || Te;
at((() => {
Te.trans = o, Te.transless = a, 0 === t ? (u(i).forEach((e => {
kn(n, e, i[e].primKey, i[e].indexes)
})), vn(e, n), Ne.follow((() => e.on.populate.fire(o))).catch(s)) : function({
_novip: e
}, t, n, r) {
const i = [],
o = e._versions;
let s = e._dbSchema = Cn(e, e.idbdb, r),
a = !1;
return o.filter((e => e._cfg.version >= t)).forEach((o => {
i.push((() => {
const i = s,
c = o._cfg.dbschema;
Pn(e, i, r), Pn(e, c, r), s = e._dbSchema = c;
const l = wn(i, c);
l.add.forEach((e => {
kn(r, e[0], e[1].primKey, e[1].indexes)
})), l.change.forEach((e => {
if (e.recreate) throw new se.Upgrade("Not yet support for changing primary key"); {
const t = r.objectStore(e.name);
e.add.forEach((e => xn(t, e))), e.change.forEach((e => {
t.deleteIndex(e.name), xn(t, e)
})), e.del.forEach((e => t.deleteIndex(e)))
}
}));
const d = o._cfg.contentUpgrade;
if (d && o._cfg.version > t) {
vn(e, r), n._memoizedTables = {}, a = !0;
let t = A(c);
l.del.forEach((e => {
t[e] = i[e]
})), gn(e, [e.Transaction.prototype]), mn(e, [e.Transaction.prototype], u(t), t), n.schema = t;
const o = V(d);
let s;
o && ct();
const h = Ne.follow((() => {
if (s = d(n), s && o) {
var e = lt.bind(null, null);
s.then(e, e)
}
}));
return s && "function" == typeof s.then ? Ne.resolve(s) : h.then((() => s))
}
})), i.push((t => {
a && St || function(e, t) {
[].slice.call(t.db.objectStoreNames).forEach((n => null == e[n] && t.db.deleteObjectStore(n)))
}(o._cfg.dbschema, t), gn(e, [e.Transaction.prototype]), mn(e, [e.Transaction.prototype], e._storeNames, e._dbSchema), n.schema = e._dbSchema
}))
})),
function e() {
return i.length ? Ne.resolve(i.shift()(n.idbtrans)).then(e) : Ne.resolve()
}().then((() => {
var e, t;
t = r, u(e = s).forEach((n => {
t.db.objectStoreNames.contains(n) || kn(t, n, e[n].primKey, e[n].indexes)
}))
}))
}(e, t, o, n).catch(s)
}))
}
function wn(e, t) {
const n = {
del: [],
add: [],
change: []
};
let r;
for (r in e) t[r] || n.del.push(r);
for (r in t) {
const i = e[r],
o = t[r];
if (i) {
const e = {
name: r,
def: o,
recreate: !1,
del: [],
add: [],
change: []
};
if ("" + (i.primKey.keyPath || "") != "" + (o.primKey.keyPath || "") || i.primKey.auto !== o.primKey.auto && !Pt) e.recreate = !0, n.change.push(e);
else {
const t = i.idxByName,
r = o.idxByName;
let s;
for (s in t) r[s] || e.del.push(s);
for (s in r) {
const n = t[s],
i = r[s];
n ? n.src !== i.src && e.change.push(i) : e.add.push(i)
}(e.del.length > 0 || e.add.length > 0 || e.change.length > 0) && n.change.push(e)
}
} else n.add.push([r, o])
}
return n
}
function kn(e, t, n, r) {
const i = e.db.createObjectStore(t, n.keyPath ? {
keyPath: n.keyPath,
autoIncrement: n.auto
} : {
autoIncrement: n.auto
});
return r.forEach((e => xn(i, e))), i
}
function xn(e, t) {
e.createIndex(t.name, t.keyPath, {
unique: t.unique,
multiEntry: t.multi
})
}
function Cn(e, t, n) {
const r = {};
return x(t.objectStoreNames, 0).forEach((e => {
const t = n.objectStore(e);
let i = t.keyPath;
const o = an(cn(i), i || "", !1, !1, !!t.autoIncrement, i && "string" != typeof i, !0),
s = [];
for (let e = 0; e < t.indexNames.length; ++e) {
const n = t.index(t.indexNames[e]);
i = n.keyPath;
var a = an(n.name, i, !!n.unique, !!n.multiEntry, !1, i && "string" != typeof i, !1);
s.push(a)
}
r[e] = ln(e, o, s)
})), r
}
function Pn({
_novip: e
}, t, n) {
const r = n.db.objectStoreNames;
for (let i = 0; i < r.length; ++i) {
const o = r[i],
s = n.objectStore(o);
e._hasGetAll = "getAll" in s;
for (let e = 0; e < s.indexNames.length; ++e) {
const n = s.indexNames[e],
r = s.index(n).keyPath,
i = "string" == typeof r ? r : "[" + x(r).join("+") + "]";
if (t[o]) {
const e = t[o].idxByName[i];
e && (e.name = n, delete t[o].idxByName[i], t[o].idxByName[n] = e)
}
}
}
"undefined" != typeof navigator && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && l.WorkerGlobalScope && l instanceof l.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1)
}
class Sn {
_parseStoresSpec(e, t) {
u(e).forEach((n => {
if (null !== e[n]) {
var r = e[n].split(",").map(((e, t) => {
const n = (e = e.trim()).replace(/([&*]|\+\+)/g, ""),
r = /^\[/.test(n) ? n.match(/^\[(.*)\]$/)[1].split("+") : n;
return an(n, r || null, /\&/.test(e), /\*/.test(e), /\+\+/.test(e), d(r), 0 === t)
})),
i = r.shift();
if (i.multi) throw new se.Schema("Primary key cannot be multi-valued");
r.forEach((e => {
if (e.auto) throw new se.Schema("Only primary key can be marked as autoIncrement (++)");
if (!e.keyPath) throw new se.Schema("Index must have a name and cannot be an empty string")
})), t[n] = ln(n, i, r)
}
}))
}
stores(e) {
const t = this.db;
this._cfg.storesSource = this._cfg.storesSource ? h(this._cfg.storesSource, e) : e;
const n = t._versions,
r = {};
let i = {};
return n.forEach((e => {
h(r, e._cfg.storesSource), i = e._cfg.dbschema = {}, e._parseStoresSpec(r, i)
})), t._dbSchema = i, gn(t, [t._allTables, t, t.Transaction.prototype]), mn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], u(i), i), t._storeNames = u(i), this
}
upgrade(e) {
return this._cfg.contentUpgrade = me(this._cfg.contentUpgrade || le, e), this
}
}
function On(e, t) {
let n = e._dbNamesDB;
return n || (n = e._dbNamesDB = new Qn("__dbnames", {
addons: [],
indexedDB: e,
IDBKeyRange: t
}), n.version(1).stores({
dbnames: "name"
})), n.table("dbnames")
}
function Kn(e) {
return e && "function" == typeof e.databases
}
function En(e) {
return at((function() {
return Te.letThrough = !0, e()
}))
}
function An() {
var e;
return !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise((function(t) {
var n = function() {
return indexedDB.databases().finally(t)
};
e = setInterval(n, 100), n()
})).finally((function() {
return clearInterval(e)
})) : Promise.resolve()
}
function Dn(e) {
var t = t => e.next(t),
n = i(t),
r = i((t => e.throw(t)));
function i(e) {
return t => {
var i = e(t),
o = i.value;
return i.done ? o : o && "function" == typeof o.then ? o.then(n, r) : d(o) ? Promise.all(o).then(n, r) : n(o)
}
}
return i(t)()
}
function Bn(e, t, n) {
var r = arguments.length;
if (r < 2) throw new se.InvalidArgument("Too few arguments");
for (var i = new Array(r - 1); --r;) i[r - 1] = arguments[r];
n = i.pop();
var o = B(i);
return [e, o, n]
}
function In(e, t, n, r, i) {
return Ne.resolve().then((() => {
const o = Te.transless || Te,
s = e._createTransaction(t, n, e._dbSchema, r),
a = {
trans: s,
transless: o
};
if (r) s.idbtrans = r.idbtrans;
else try {
s.create(), e._state.PR1398_maxLoop = 3
} catch (r) {
return r.name === ie.InvalidState && e.isOpen() && --e._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), e._close(), e.open().then((() => In(e, t, n, null, i)))) : _t(r)
}
const c = V(i);
let l;
c && ct();
const u = Ne.follow((() => {
if (l = i.call(s, s), l)
if (c) {
var e = lt.bind(null, null);
l.then(e, e)
} else "function" == typeof l.next && "function" == typeof l.throw && (l = Dn(l))
}), a);
return (l && "function" == typeof l.then ? Ne.resolve(l).then((e => s.active ? e : _t(new se.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))) : u.then((() => l))).then((e => (r && s._resolve(), s._completion.then((() => e))))).catch((e => (s._reject(e), _t(e))))
}))
}
function jn(e, t, n) {
const r = d(e) ? e.slice() : [e];
for (let e = 0; e < n; ++e) r.push(t);
return r
}
const Tn = {
stack: "dbcore",
name: "VirtualIndexMiddleware",
level: 1,
create: function(e) {
return {...e, table(t) {
const n = e.table(t),
{
schema: r
} = n,
i = {},
o = [];
function s(e, t, n) {
const r = pn(e),
a = i[r] = i[r] || [],
c = null == e ? 0 : "string" == typeof e ? 1 : e.length,
l = t > 0,
u = {...n, isVirtual: l, keyTail: t, keyLength: c, extractKey: dn(e), unique: !l && n.unique
};
return a.push(u), u.isPrimaryKey || o.push(u), c > 1 && s(2 === c ? e[0] : e.slice(0, c - 1), t + 1, n), a.sort(((e, t) => e.keyTail - t.keyTail)), u
}
const a = s(r.primaryKey.keyPath, 0, r.primaryKey);
i[":id"] = [a];
for (const e of r.indexes) s(e.keyPath, 0, e);
function c(t) {
const n = t.query.index;
return n.isVirtual ? {...t, query: {
index: n,
range: (r = t.query.range, i = n.keyTail, {
type: 1 === r.type ? 2 : r.type,
lower: jn(r.lower, r.lowerOpen ? e.MAX_KEY : e.MIN_KEY, i),
lowerOpen: !0,
upper: jn(r.upper, r.upperOpen ? e.MIN_KEY : e.MAX_KEY, i),
upperOpen: !0
})
}
} : t;
var r, i
}
const l = {...n, schema: {...r, primaryKey: a, indexes: o, getIndexByKeyPath: function(e) {
const t = i[pn(e)];
return t && t[0]
}
}, count: e => n.count(c(e)), query: e => n.query(c(e)), openCursor(t) {
const {
keyTail: r,
isVirtual: i,
keyLength: o
} = t.query.index;
return i ? n.openCursor(c(t)).then((n => n && function(n) {
const i = Object.create(n, {
continue: {
value: function(i) {
null != i ? n.continue(jn(i, t.reverse ? e.MAX_KEY : e.MIN_KEY, r)) : t.unique ? n.continue(n.key.slice(0, o).concat(t.reverse ? e.MIN_KEY : e.MAX_KEY, r)) : n.continue()
}
},
continuePrimaryKey: {
value(t, i) {
n.continuePrimaryKey(jn(t, e.MAX_KEY, r), i)
}
},
primaryKey: {get: () => n.primaryKey
},
key: {
get() {
const e = n.key;
return 1 === o ? e[0] : e.slice(0, o)
}
},
value: {get: () => n.value
}
});
return i
}(n))) : n.openCursor(t)
}
};
return l
}
}
}
};
function Mn(e, t, n, r) {
return n = n || {}, r = r || "", u(e).forEach((i => {
if (y(t, i)) {
var o = e[i],
s = t[i];
if ("object" == typeof o && "object" == typeof s && o && s) {
const e = N(o);
e !== N(s) ? n[r + i] = t[i] : "Object" === e ? Mn(o, s, n, r + i + ".") : o !== s && (n[r + i] = t[i])
} else o !== s && (n[r + i] = t[i])
} else n[r + i] = void 0
})), u(t).forEach((i => {
y(e, i) || (n[r + i] = t[i])
})), n
}
const Rn = {
stack: "dbcore",
name: "HooksMiddleware",
level: 2,
create: e => ({...e, table(t) {
const n = e.table(t),
{
primaryKey: r
} = n.schema,
i = {...n, mutate(e) {
const i = Te.trans,
{
deleting: o,
creating: s,
updating: a
} = i.table(t).hook;
switch (e.type) {
case "add":
if (s.fire === le) break;
return i._promise("readwrite", (() => c(e)), !0);
case "put":
if (s.fire === le && a.fire === le) break;
return i._promise("readwrite", (() => c(e)), !0);
case "delete":
if (o.fire === le) break;
return i._promise("readwrite", (() => c(e)), !0);
case "deleteRange":
if (o.fire === le) break;
return i._promise("readwrite", (() => function(e) {
return l(e.trans, e.range, 1e4)
}(e)), !0)
}
return n.mutate(e);
function c(e) {
const t = Te.trans,
i = e.keys || function(e, t) {
return "delete" === t.type ? t.keys : t.keys || t.values.map(e.extractKey)
}(r, e);
if (!i) throw new Error("Keys missing");
return "delete" !== (e = "add" === e.type || "put" === e.type ? {...e, keys: i
} : {...e
}).type && (e.values = [...e.values]), e.keys && (e.keys = [...e.keys]),
function(e, t, n) {
return "add" === t.type ? Promise.resolve([]) : e.getMany({
trans: t.trans,
keys: n,
cache: "immutable"
})
}(n, e, i).then((c => {
const l = i.map(((n, i) => {
const l = c[i],
u = {
onerror: null,
onsuccess: null
};
if ("delete" === e.type) o.fire.call(u, n, l, t);
else if ("add" === e.type || void 0 === l) {
const o = s.fire.call(u, n, e.values[i], t);
null == n && null != o && (n = o, e.keys[i] = n, r.outbound || E(e.values[i], r.keyPath, n))
} else {
const r = Mn(l, e.values[i]),
o = a.fire.call(u, r, n, l, t);
if (o) {
const t = e.values[i];
Object.keys(o).forEach((e => {
y(t, e) ? t[e] = o[e] : E(t, e, o[e])
}))
}
}
return u
}));
return n.mutate(e).then((({
failures: t,
results: n,
numFailures: r,
lastResult: o
}) => {
for (let r = 0; r < i.length; ++r) {
const o = n ? n[r] : i[r],
s = l[r];
null == o ? s.onerror && s.onerror(t[r]) : s.onsuccess && s.onsuccess("put" === e.type && c[r] ? e.values[r] : o)
}
return {
failures: t,
results: n,
numFailures: r,
lastResult: o
}
})).catch((e => (l.forEach((t => t.onerror && t.onerror(e))), Promise.reject(e))))
}))
}
function l(e, t, i) {
return n.query({
trans: e,
values: !1,
query: {
index: r,
range: t
},
limit: i
}).then((({
result: n
}) => c({
type: "delete",
keys: n,
trans: e
}).then((r => r.numFailures > 0 ? Promise.reject(r.failures[0]) : n.length < i ? {
failures: [],
numFailures: 0,
lastResult: void 0
} : l(e, {...t, lower: n[n.length - 1], lowerOpen: !0
}, i)))))
}
}
};
return i
}
})
};
function Fn(e, t, n) {
try {
if (!t) return null;
if (t.keys.length < e.length) return null;
const r = [];
for (let i = 0, o = 0; i < t.keys.length && o < e.length; ++i) 0 === Lt(t.keys[i], e[o]) && (r.push(n ? M(t.values[i]) : t.values[i]), ++o);
return r.length === e.length ? r : null
} catch (e) {
return null
}
}
const Nn = {
stack: "dbcore",
level: -1,
create: e => ({
table: t => {
const n = e.table(t);
return {...n, getMany: e => {
if (!e.cache) return n.getMany(e);
const t = Fn(e.keys, e.trans._cache, "clone" === e.cache);
return t ? Ne.resolve(t) : n.getMany(e).then((t => (e.trans._cache = {
keys: e.keys,
values: "clone" === e.cache ? M(t) : t
}, t)))
}, mutate: e => ("add" !== e.type && (e.trans._cache = null), n.mutate(e))
}
}
})
};
function Un(e) {
return !("from" in e)
}
const qn = function(e, t) {
if (!this) {
const t = new qn;
return e && "d" in e && h(t, e), t
}
h(this, arguments.length ? {
d: 1,
from: e,
to: arguments.length > 1 ? t : e
} : {
d: 0
})
};
function Ln(e, t, n) {
const r = Lt(t, n);
if (isNaN(r)) return;
if (r > 0) throw RangeError();
if (Un(e)) return h(e, {
from: t,
to: n,
d: 1
});
const i = e.l,
o = e.r;
if (Lt(n, e.from) < 0) return i ? Ln(i, t, n) : e.l = {
from: t,
to: n,
d: 1,
l: null,
r: null
}, Wn(e);
if (Lt(t, e.to) > 0) return o ? Ln(o, t, n) : e.r = {
from: t,
to: n,
d: 1,
l: null,
r: null
}, Wn(e);
Lt(t, e.from) < 0 && (e.from = t, e.l = null, e.d = o ? o.d + 1 : 1), Lt(n, e.to) > 0 && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1);
const s = !e.r;
i && !e.l && zn(e, i), o && s && zn(e, o)
}
function zn(e, t) {
Un(t) || function e(t, {
from: n,
to: r,
l: i,
r: o
}) {
Ln(t, n, r), i && e(t, i), o && e(t, o)
}(e, t)
}
function Vn(e) {
let t = Un(e) ? null : {
s: 0,
n: e
};
return {
next(e) {
const n = arguments.length > 0;
for (; t;) switch (t.s) {
case 0:
if (t.s = 1, n)
for (; t.n.l && Lt(e, t.n.from) < 0;) t = {
up: t,
n: t.n.l,
s: 1
};
else
for (; t.n.l;) t = {
up: t,
n: t.n.l,
s: 1
};
case 1:
if (t.s = 2, !n || Lt(e, t.n.to) <= 0) return {
value: t.n,
done: !1
};
case 2:
if (t.n.r) {
t.s = 3, t = {
up: t,
n: t.n.r,
s: 0
};
continue
}
case 3:
t = t.up
}
return {
done: !0
}
}
}
}
function Wn(e) {
var t, n;
const r = ((null === (t = e.r) || void 0 === t ? void 0 : t.d) || 0) - ((null === (n = e.l) || void 0 === n ? void 0 : n.d) || 0),
i = r > 1 ? "r" : r < -1 ? "l" : "";
if (i) {
const t = "r" === i ? "l" : "r",
n = {...e
},
r = e[i];
e.from = r.from, e.to = r.to, e[i] = r[i], n[i] = r[t], e[t] = n, n.d = Gn(n)
}
e.d = Gn(e)
}
function Gn({
r: e,
l: t
}) {
return (e ? t ? Math.max(e.d, t.d) : e.d : t ? t.d : 0) + 1
}
v(qn.prototype, {
add(e) {
return zn(this, e), this
}, addKey(e) {
return Ln(this, e, e), this
}, addKeys(e) {
return e.forEach((e => Ln(this, e, e))), this
}, [U]() {
return Vn(this)
}
});
const Yn = {
stack: "dbcore",
level: 0,
create: e => {
const t = e.schema.name,
n = new qn(e.MIN_KEY, e.MAX_KEY);
return {...e, table: r => {
const i = e.table(r),
{
schema: o
} = i,
{
primaryKey: s
} = o,
{
extractKey: a,
outbound: c
} = s,
l = {...i, mutate: e => {
const s = e.trans,
a = s.mutatedParts || (s.mutatedParts = {}),
c = e => {
const n = `idb://${t}/${r}/${e}`;
return a[n] || (a[n] = new qn)
},
l = c(""),
u = c(":dels"),
{
type: h
} = e;
let [f, p] = "deleteRange" === e.type ? [e.range] : "delete" === e.type ? [e.keys] : e.values.length < 50 ? [
[], e.values
] : [];
const y = e.trans._cache;
return i.mutate(e).then((e => {
if (d(f)) {
"delete" !== h && (f = e.results), l.addKeys(f);
const t = Fn(f, y);
t || "add" === h || u.addKeys(f), (t || p) && function(e, t, n, r) {
t.indexes.forEach((function(t) {
const i = e(t.name || "");
function o(e) {
return null != e ? t.extractKey(e) : null
}
const s = e => t.multiEntry && d(e) ? e.forEach((e => i.addKey(e))) : i.addKey(e);
(n || r).forEach(((e, t) => {
const i = n && o(n[t]),
a = r && o(r[t]);
0 !== Lt(i, a) && (null != i && s(i), null != a && s(a))
}))
}))
}(c, o, t, p)
} else if (f) {
const e = {
from: f.lower,
to: f.upper
};
u.add(e), l.add(e)
} else l.add(n), u.add(n), o.indexes.forEach((e => c(e.name).add(n)));
return e
}))
}
},
h = ({
query: {
index: t,
range: n
}
}) => {
var r, i;
return [t, new qn(null !== (r = n.lower) && void 0 !== r ? r : e.MIN_KEY, null !== (i = n.upper) && void 0 !== i ? i : e.MAX_KEY)]
},
f = {get: e => [s, new qn(e.key)],
getMany: e => [s, (new qn).addKeys(e.keys)],
count: h,
query: h,
openCursor: h
};
return u(f).forEach((e => {
l[e] = function(o) {
const {
subscr: s
} = Te;
if (s) {
const l = e => {
const n = `idb://${t}/${r}/${e}`;
return s[n] || (s[n] = new qn)
},
u = l(""),
d = l(":dels"),
[h, p] = f[e](o);
if (l(h.name || "").add(p), !h.isPrimaryKey) {
if ("count" !== e) {
const t = "query" === e && c && o.values && i.query({...o, values: !1
});
return i[e].apply(this, arguments).then((n => {
if ("query" === e) {
if (c && o.values) return t.then((({
result: e
}) => (u.addKeys(e), n)));
const e = o.values ? n.result.map(a) : n.result;
o.values ? u.addKeys(e) : d.addKeys(e)
} else if ("openCursor" === e) {
const e = n,
t = o.values;
return e && Object.create(e, {
key: {get: () => (d.addKey(e.primaryKey), e.key)
},
primaryKey: {
get() {
const t = e.primaryKey;
return d.addKey(t), t
}
},
value: {get: () => (t && u.addKey(e.primaryKey), e.value)
}
})
}
return n
}))
}
d.add(n)
}
}
return i[e].apply(this, arguments)
}
})), l
}
}
}
};
class Qn {
constructor(e, t) {
this._middlewares = {}, this.verno = 0;
const n = Qn.dependencies;
this._options = t = {
addons: Qn.addons,
autoOpen: !0,
indexedDB: n.indexedDB,
IDBKeyRange: n.IDBKeyRange,
...t
}, this._deps = {
indexedDB: t.indexedDB,
IDBKeyRange: t.IDBKeyRange
};
const {
addons: r
} = t;
this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
const i = {
dbOpenError: null,
isBeingOpened: !1,
onReadyBeingFired: null,
openComplete: !1,
dbReadyResolve: le,
dbReadyPromise: null,
cancelOpen: le,
openCanceller: null,
autoSchema: !0,
PR1398_maxLoop: 3
};
var o;
i.dbReadyPromise = new Ne((e => {
i.dbReadyResolve = e
})), i.openCanceller = new Ne(((e, t) => {
i.cancelOpen = t
})), this._state = i, this.name = e, this.on = It(this, "populate", "blocked", "versionchange", "close", {
ready: [me, le]
}), this.on.ready.subscribe = C(this.on.ready.subscribe, (e => (t, n) => {
Qn.vip((() => {
const r = this._state;
if (r.openComplete) r.dbOpenError || Ne.resolve().then(t), n && e(t);
else if (r.onReadyBeingFired) r.onReadyBeingFired.push(t), n && e(t);
else {
e(t);
const r = this;
n || e((function e() {
r.on.ready.unsubscribe(t), r.on.ready.unsubscribe(e)
}))
}
}))
})), this.Collection = (o = this, jt(Wt.prototype, (function(e, t) {
this.db = o;
let n = At,
r = null;
if (t) try {
n = t()
} catch (e) {
r = e
}
const i = e._ctx,
s = i.table,
a = s.hook.reading.fire;
this._ctx = {
table: s,
index: i.index,
isPrimKey: !i.index || s.schema.primKey.keyPath && i.index === s.schema.primKey.name,
range: n,
keysOnly: !1,
dir: "next",
unique: "",
algorithm: null,
filter: null,
replayFilter: null,
justLimit: !0,
isMatch: null,
offset: 0,
limit: 1 / 0,
error: r,
or: i.or,
valueMapper: a !== ue ? a : null
}
}))), this.Table = function(e) {
return jt(Bt.prototype, (function(t, n, r) {
this.db = e, this._tx = r, this.name = t, this.schema = n, this.hook = e._allTables[t] ? e._allTables[t].hook : It(null, {
creating: [fe, le],
reading: [de, ue],
updating: [ye, le],
deleting: [pe, le]
})
}))
}(this), this.Transaction = function(e) {
return jt(sn.prototype, (function(t, n, r, i, o) {
this.db = e, this.mode = t, this.storeNames = n, this.schema = r, this.chromeTransactionDurability = i, this.idbtrans = null, this.on = It(this, "complete", "error", "abort"), this.parent = o || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new Ne(((e, t) => {
this._resolve = e, this._reject = t
})), this._completion.then((() => {
this.active = !1, this.on.complete.fire()
}), (e => {
var t = this.active;
return this.active = !1, this.on.error.fire(e), this.parent ? this.parent._reject(e) : t && this.idbtrans && this.idbtrans.abort(), _t(e)
}))
}))
}(this), this.Version = function(e) {
return jt(Sn.prototype, (function(t) {
this.db = e, this._cfg = {
version: t,
storesSource: null,
dbschema: {},
tables: {},
contentUpgrade: null
}
}))
}(this), this.WhereClause = function(e) {
return jt(tn.prototype, (function(t, n, r) {
this.db = e, this._ctx = {
table: t,
index: ":id" === n ? null : n,
or: r
};
const i = e._deps.indexedDB;
if (!i) throw new se.MissingAPI;
this._cmp = this._ascending = i.cmp.bind(i), this._descending = (e, t) => i.cmp(t, e), this._max = (e, t) => i.cmp(e, t) > 0 ? e : t, this._min = (e, t) => i.cmp(e, t) < 0 ? e : t, this._IDBKeyRange = e._deps.IDBKeyRange
}))
}(this), this.on("versionchange", (e => {
e.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()
})), this.on("blocked", (e => {
!e.newVersion || e.newVersion < e.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)
})), this._maxKey = un(t.IDBKeyRange), this._createTransaction = (e, t, n, r) => new this.Transaction(e, t, n, this._options.chromeTransactionDurability, r), this._fireOnBlocked = e => {
this.on("blocked").fire(e), Ct.filter((e => e.name === this.name && e !== this && !e._state.vcFired)).map((t => t.on("versionchange").fire(e)))
}, this.use(Tn), this.use(Rn), this.use(Yn), this.use(Nn), this.vip = Object.create(this, {
_vip: {
value: !0
}
}), r.forEach((e => e(this)))
}
version(e) {
if (isNaN(e) || e < .1) throw new se.Type("Given version is not a positive number");
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new se.Schema("Cannot add version when database is open");
this.verno = Math.max(this.verno, e);
const t = this._versions;
var n = t.filter((t => t._cfg.version === e))[0];
return n || (n = new this.Version(e), t.push(n), t.sort(bn), n.stores({}), this._state.autoSchema = !1, n)
}
_whenReady(e) {
return this.idbdb && (this._state.openComplete || Te.letThrough || this._vip) ? e() : new Ne(((e, t) => {
if (this._state.openComplete) return t(new se.DatabaseClosed(this._state.dbOpenError));
if (!this._state.isBeingOpened) {
if (!this._options.autoOpen) return void t(new se.DatabaseClosed);
this.open().catch(le)
}
this._state.dbReadyPromise.then(e, t)
})).then(e)
}
use({
stack: e,
create: t,
level: n,
name: r
}) {
r && this.unuse({
stack: e,
name: r
});
const i = this._middlewares[e] || (this._middlewares[e] = []);
return i.push({
stack: e,
create: t,
level: null == n ? 10 : n,
name: r
}), i.sort(((e, t) => e.level - t.level)), this
}
unuse({
stack: e,
name: t,
create: n
}) {
return e && this._middlewares[e] && (this._middlewares[e] = this._middlewares[e].filter((e => n ? e.create !== n : !!t && e.name !== t))), this
}
open() {
return function(e) {
const t = e._state,
{
indexedDB: n
} = e._deps;
if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then((() => t.dbOpenError ? _t(t.dbOpenError) : e));
W && (t.openCanceller._stackHolder = H()), t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
const r = t.openCanceller;
function i() {
if (t.openCanceller !== r) throw new se.DatabaseClosed("db.open() was cancelled")
}
let o = t.dbReadyResolve,
s = null,
a = !1;
return Ne.race([r, ("undefined" == typeof navigator ? Ne.resolve() : An()).then((() => new Ne(((r, o) => {
if (i(), !n) throw new se.MissingAPI;
const c = e.name,
l = t.autoSchema ? n.open(c) : n.open(c, Math.round(10 * e.verno));
if (!l) throw new se.MissingAPI;
l.onerror = nn(o), l.onblocked = et(e._fireOnBlocked), l.onupgradeneeded = et((r => {
if (s = l.transaction, t.autoSchema && !e._options.allowEmptyDB) {
l.onerror = rn, s.abort(), l.result.close();
const e = n.deleteDatabase(c);
e.onsuccess = e.onerror = et((() => {
o(new se.NoSuchDatabase(`Database ${c} doesnt exist`))
}))
} else {
s.onerror = nn(o);
var i = r.oldVersion > Math.pow(2, 62) ? 0 : r.oldVersion;
a = i < 1, e._novip.idbdb = l.result, _n(e, i / 10, s, o)
}
}), o), l.onsuccess = et((() => {
s = null;
const n = e._novip.idbdb = l.result,
i = x(n.objectStoreNames);
if (i.length > 0) try {
const r = n.transaction(1 === (o = i).length ? o[0] : o, "readonly");
t.autoSchema ? function({
_novip: e
}, t, n) {
e.verno = t.version / 10;
const r = e._dbSchema = Cn(0, t, n);
e._storeNames = x(t.objectStoreNames, 0), mn(e, [e._allTables], u(r), r)
}(e, n, r) : (Pn(e, e._dbSchema, r), function(e, t) {
const n = wn(Cn(0, e.idbdb, t), e._dbSchema);
return !(n.add.length || n.change.some((e => e.add.length || e.change.length)))
}(e, r) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")), vn(e, r)
} catch (e) {}
var o;
Ct.push(e), n.onversionchange = et((n => {
t.vcFired = !0, e.on("versionchange").fire(n)
})), n.onclose = et((t => {
e.on("close").fire(t)
})), a && function({
indexedDB: e,
IDBKeyRange: t
}, n) {
!Kn(e) && "__dbnames" !== n && On(e, t).put({
name: n
}).catch(le)
}(e._deps, c), r()
}), o)
}))))]).then((() => (i(), t.onReadyBeingFired = [], Ne.resolve(En((() => e.on.ready.fire(e.vip)))).then((function n() {
if (t.onReadyBeingFired.length > 0) {
let r = t.onReadyBeingFired.reduce(me, le);
return t.onReadyBeingFired = [], Ne.resolve(En((() => r(e.vip)))).then(n)
}
}))))).finally((() => {
t.onReadyBeingFired = null, t.isBeingOpened = !1
})).then((() => e)).catch((n => {
t.dbOpenError = n;
try {
s && s.abort()
} catch (e) {}
return r === t.openCanceller && e._close(), _t(n)
})).finally((() => {
t.openComplete = !0, o()
}))
}(this)
}
_close() {
const e = this._state,
t = Ct.indexOf(this);
if (t >= 0 && Ct.splice(t, 1), this.idbdb) {
try {
this.idbdb.close()
} catch (e) {}
this._novip.idbdb = null
}
e.dbReadyPromise = new Ne((t => {
e.dbReadyResolve = t
})), e.openCanceller = new Ne(((t, n) => {
e.cancelOpen = n
}))
}
close() {
this._close();
const e = this._state;
this._options.autoOpen = !1, e.dbOpenError = new se.DatabaseClosed, e.isBeingOpened && e.cancelOpen(e.dbOpenError)
}
delete() {
const e = arguments.length > 0,
t = this._state;
return new Ne(((n, r) => {
const i = () => {
this.close();
var e = this._deps.indexedDB.deleteDatabase(this.name);
e.onsuccess = et((() => {
! function({
indexedDB: e,
IDBKeyRange: t
}, n) {
!Kn(e) && "__dbnames" !== n && On(e, t).delete(n).catch(le)
}(this._deps, this.name), n()
})), e.onerror = nn(r), e.onblocked = this._fireOnBlocked
};
if (e) throw new se.InvalidArgument("Arguments not allowed in db.delete()");
t.isBeingOpened ? t.dbReadyPromise.then(i) : i()
}))
}
backendDB() {
return this.idbdb
}
isOpen() {
return null !== this.idbdb
}
hasBeenClosed() {
const e = this._state.dbOpenError;
return e && "DatabaseClosed" === e.name
}
hasFailed() {
return null !== this._state.dbOpenError
}
dynamicallyOpened() {
return this._state.autoSchema
}
get tables() {
return u(this._allTables).map((e => this._allTables[e]))
}
transaction() {
const e = Bn.apply(this, arguments);
return this._transaction.apply(this, e)
}
_transaction(e, t, n) {
let r = Te.trans;
r && r.db === this && -1 === e.indexOf("!") || (r = null);
const i = -1 !== e.indexOf("?");
let o, s;
e = e.replace("!", "").replace("?", "");
try {
if (s = t.map((e => {
var t = e instanceof this.Table ? e.name : e;
if ("string" != typeof t) throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
return t
})), "r" == e || "readonly" === e) o = "readonly";
else {
if ("rw" != e && "readwrite" != e) throw new se.InvalidArgument("Invalid transaction mode: " + e);
o = "readwrite"
}
if (r) {
if ("readonly" === r.mode && "readwrite" === o) {
if (!i) throw new se.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
r = null
}
r && s.forEach((e => {
if (r && -1 === r.storeNames.indexOf(e)) {
if (!i) throw new se.SubTransaction("Table " + e + " not included in parent transaction.");
r = null
}
})), i && r && !r.active && (r = null)
}
} catch (e) {
return r ? r._promise(null, ((t, n) => {
n(e)
})) : _t(e)
}
const a = In.bind(null, this, o, s, r, n);
return r ? r._promise(o, a, "lock") : Te.trans ? yt(Te.transless, (() => this._whenReady(a))) : this._whenReady(a)
}
table(e) {
if (!y(this._allTables, e)) throw new se.InvalidTable(`Table ${e} does not exist`);
return this._allTables[e]
}
}
const Hn = "undefined" != typeof Symbol && "observable" in Symbol ? Symbol.observable : "@@observable";
class Jn {
constructor(e) {
this._subscribe = e
}
subscribe(e, t, n) {
return this._subscribe(e && "function" != typeof e ? e : {
next: e,
error: t,
complete: n
})
}[Hn]() {
return this
}
}
function Zn(e, t) {
return u(t).forEach((n => {
zn(e[n] || (e[n] = new qn), t[n])
})), e
}
let Xn;
try {
Xn = {
indexedDB: l.indexedDB || l.mozIndexedDB || l.webkitIndexedDB || l.msIndexedDB,
IDBKeyRange: l.IDBKeyRange || l.webkitIDBKeyRange
}
} catch (l) {
Xn = {
indexedDB: null,
IDBKeyRange: null
}
}
const $n = Qn;
function er(e) {
let t = tr;
try {
tr = !0, on.storagemutated.fire(e)
} finally {
tr = t
}
}
v($n, {...ce, delete: e => new $n(e, {
addons: []
}).delete(), exists: e => new $n(e, {
addons: []
}).open().then((e => (e.close(), !0))).catch("NoSuchDatabaseError", (() => !1)), getDatabaseNames(e) {
try {
return function({
indexedDB: e,
IDBKeyRange: t
}) {
return Kn(e) ? Promise.resolve(e.databases()).then((e => e.map((e => e.name)).filter((e => "__dbnames" !== e)))) : On(e, t).toCollection().primaryKeys()
}($n.dependencies).then(e)
} catch (e) {
return _t(new se.MissingAPI)
}
}, defineClass: () => function(e) {
h(this, e)
}, ignoreTransaction: e => Te.trans ? yt(Te.transless, e) : e(), vip: En, async: function(e) {
return function() {
try {
var t = Dn(e.apply(this, arguments));
return t && "function" == typeof t.then ? t : Ne.resolve(t)
} catch (e) {
return _t(e)
}
}
}, spawn: function(e, t, n) {
try {
var r = Dn(e.apply(n, t || []));
return r && "function" == typeof r.then ? r : Ne.resolve(r)
} catch (e) {
return _t(e)
}
}, currentTransaction: {get: () => Te.trans || null
}, waitFor: function(e, t) {
const n = Ne.resolve("function" == typeof e ? $n.ignoreTransaction(e) : e).timeout(t || 6e4);
return Te.trans ? Te.trans.waitFor(n) : n
}, Promise: Ne, debug: {get: () => W,
set: e => {
G(e, "dexie" === e ? () => !0 : Kt)
}
}, derive: b, extend: h, props: v, override: C, Events: It, on, liveQuery: function(e) {
return new Jn((t => {
const n = V(e);
let r = !1,
i = {},
o = {};
const s = {get closed() {
return r
},
unsubscribe: () => {
r = !0, on.storagemutated.unsubscribe(d)
}
};
t.start && t.start(s);
let a = !1,
c = !1;
function l() {
return u(o).some((e => i[e] && function(e, t) {
const n = Vn(t);
let r = n.next();
if (r.done) return !1;
let i = r.value;
const o = Vn(e);
let s = o.next(i.from),
a = s.value;
for (; !r.done && !s.done;) {
if (Lt(a.from, i.to) <= 0 && Lt(a.to, i.from) >= 0) return !0;
Lt(i.from, a.from) < 0 ? i = (r = n.next(a.from)).value : a = (s = o.next(i.from)).value
}
return !1
}(i[e], o[e])))
}
const d = e => {
Zn(i, e), l() && h()
},
h = () => {
if (a || r) return;
i = {};
const u = {},
f = function(t) {
n && ct();
const r = () => at(e, {
subscr: t,
trans: null
}),
i = Te.trans ? yt(Te.transless, r) : r();
return n && i.then(lt, lt), i
}(u);
c || (on("storagemutated", d), c = !0), a = !0, Promise.resolve(f).then((e => {
a = !1, r || (l() ? h() : (i = {}, o = u, t.next && t.next(e)))
}), (e => {
a = !1, t.error && t.error(e), s.unsubscribe()
}))
};
return h(), s
}))
}, extendObservabilitySet: Zn, getByKeyPath: K, setByKeyPath: E, delByKeyPath: function(e, t) {
"string" == typeof t ? E(e, t, void 0) : "length" in t && [].map.call(t, (function(t) {
E(e, t, void 0)
}))
}, shallowClone: A, deepClone: M, getObjectDiff: Mn, cmp: Lt, asap: S, minKey: -1 / 0, addons: [], connections: Ct, errnames: ie, dependencies: Xn, semVer: "3.2.1", version: "3.2.1".split(".").map((e => parseInt(e))).reduce(((e, t, n) => e + t / Math.pow(10, 2 * n)))
}), $n.maxKey = un($n.dependencies.IDBKeyRange), "undefined" != typeof dispatchEvent && "undefined" != typeof addEventListener && (on("storagemutated", (e => {
if (!tr) {
let t;
Pt ? (t = document.createEvent("CustomEvent"), t.initCustomEvent("x-storagemutated-1", !0, !0, e)) : t = new CustomEvent("x-storagemutated-1", {
detail: e
}), tr = !0, dispatchEvent(t), tr = !1
}
})), addEventListener("x-storagemutated-1", (({
detail: e
}) => {
tr || er(e)
})));
let tr = !1;
if ("undefined" != typeof BroadcastChannel) {
const e = new BroadcastChannel("x-storagemutated-1");
on("storagemutated", (t => {
tr || e.postMessage(t)
})), e.onmessage = e => {
e.data && er(e.data)
}
} else if ("undefined" != typeof self && "undefined" != typeof navigator) {
on("storagemutated", (e => {
try {
tr || ("undefined" != typeof localStorage && localStorage.setItem("x-storagemutated-1", JSON.stringify({
trig: Math.random(),
changedParts: e
})), "object" == typeof self.clients && [...self.clients.matchAll({
includeUncontrolled: !0
})].forEach((t => t.postMessage({
type: "x-storagemutated-1",
changedParts: e
}))))
} catch (e) {}
})), addEventListener("storage", (e => {
if ("x-storagemutated-1" === e.key) {
const t = JSON.parse(e.newValue);
t && er(t.changedParts)
}
}));
const e = self.document && navigator.serviceWorker;
e && e.addEventListener("message", (function({
data: e
}) {
e && "x-storagemutated-1" === e.type && er(e.changedParts)
}))
}
Ne.rejectionMapper = function(e, t) {
if (!e || e instanceof ee || e instanceof TypeError || e instanceof SyntaxError || !e.name || !ae[e.name]) return e;
var n = new ae[e.name](t || e.message, e);
return "stack" in e && g(n, "stack", {get: function() {
return this.inner.stack
}
}), n
}, G(W, Kt);
var nr = new class extends Qn {
constructor() {
super("tcp_ccl");
var e = this;
e.version(1).stores({
fclicks: "++id,url,rid,ttl,date",
clicks: "++id,url,crtid,price,ttl,date"
}), e.version(2).stores({
impWCl: "++id,rid,cl"
}), e.version(3).stores({
fclicks: "++id,url,rid,cid,ttl,date",
clicks: "++id,url,cid,crtid,capping,capping_period,price,ttl,date"
}), e.version(4).stores({
fclicks: "++id,url,rid,cid,capping_uid,capping_endat,ttl,date",
clicks: "++id,url,cid,crtid,capping_uid,capping_endat,capping,capping_period,price,ttl,date"
}), e.version(5).stores({
fclicks: "++id,url,rid,cid,capping_uid,ttl,date",
clicks: "++id,url,cid,crtid,capping_uid,price,ttl,date",
plimit: "++id,uid,limit,count,event_trigger,end_at"
}), e.version(6).stores({
ownNotifications: "++id,url,title",
clicks: "++id,url,cid,crtid,capping_uid,price,ttl,date",
plimit: "++id,uid,limit,count,event_trigger,end_at"
}), e.version(7).stores({
auction: "request_options,last_notifications_request,notifications"
}), e.version(8).stores({
auction: "request_options,last_notifications_request,notifications",
settings: "++id,settings"
}), e.version(9).stores({
stat: "++id,creative_id,impressions,clicks,create_time,update_time"
}), e.version(10).stores({
stat: "++id,creative_id,impressions,clicks,create_time,update_time,category,creative_country"
}), e.version(11).stores({
stat: "++id,creative_id,impressions,clicks,create_time,update_time,category,creative_country,tag"
}), e.version(12).stores({
auction: null
}), e.version(13).stores({
clicks: "++id,url,cid,crtid,price,ttl,date",
fclicks: "++id,url,rid,cid,ttl,date",
stat: null,
impWCl: null,
plimit: null,
ownNotifications: null
}), e.version(14).stores({
queue: "++id,tag"
})
}
};
function rr(e, t, n, r, i, o, s) {
try {
var a = e[o](s),
c = a.value
} catch (e) {
return void n(e)
}
a.done ? t(c) : Promise.resolve(c).then(r, i)
}
function ir(e) {
return function() {
var t = this,
n = arguments;
return new Promise((function(r, i) {
var o = e.apply(t, n);
function s(e) {
rr(o, r, i, s, a, "next", e)
}
function a(e) {
rr(o, r, i, s, a, "throw", e)
}
s(void 0)
}))
}
}
class or {
saveSettings(e) {
return nr.transaction("rw", nr.settings, function() {
var t = ir((function*(t) {
yield nr.settings.clear(),
yield nr.settings.put({
next_notification: e.nextNotification,
mode: e.mode,
demand_mode_probability: e.demandModeProbability,
creatives_update_time: e.creativesUpdateTime,
postponed_update_time: e.postponedUpdateTime,
stat_send_time: e.statSendTime,
is_adblock: Boolean(e.is_adblock),
is_meta_mask_active: e.isMetaMaskActive,
user_keywords: e.userKeywords,
entry_referrer_domain: e.entryReferrerDomain,
tag_ab: e.tagAbVersion,
visitor_id: e.visitorId,
is_safari: e.isSafari,
v2: e.v2,
page: e.page,
language: e.language,
subscriptions: e.subscriptions,
auctionUrl: e.auctionUrl
})
}));
return function(e) {
return t.apply(this, arguments)
}
}())
}
getSettings() {
return ir((function*() {
var e =
yield nr.settings.toArray();
if (e.length) {
var t = e[0];
return {
nextNotification: t.next_notification || 0,
mode: t.mode || null,
demandModeProbability: t.demand_mode_probability || 0,
creativesUpdateTime: t.creatives_update_time || null,
postponedUpdateTime: t.postponed_update_time || null,
statSendTime: t.stat_send_time || null,
is_adblock: t.is_adblock || !1,
isMetaMaskActive: t.is_meta_mask_active || !1,
userKeywords: t.user_keywords,
entryReferrerDomain: t.entry_referrer_domain,
tagAbVersion: t.tag_ab,
visitorId: t.visitor_id,
isSafari: t.is_safari,
v2: t.v2,
page: t.page,
language: t.language,
subscriptions: t.subscriptions,
auctionUrl: t.auctionUrl
}
}
return null
}))()
}
}
var sr = new class {
clearOld() {
return nr.transaction("rw", [nr.fclicks, nr.clicks], (() => {
var e = Date.now(),
t = e - 1728e5;
return Promise.all([nr.fclicks.filter((e => void 0 === e.date)).delete(), nr.fclicks.where("ttl").belowOrEqual(e).delete(), nr.clicks.where("ttl").belowOrEqual(e).delete(), nr.fclicks.where("date").below(t).delete(), nr.clicks.where("date").below(t).delete()])
}))
}
getFiredClicks() {
return nr.fclicks.toArray()
}
addFiredClicks(e) {
return nr.fclicks.bulkPut(e)
}
getStoredClicks() {
return nr.clicks.toArray()
}
addStoredClicks(e) {
return nr.clicks.bulkPut(e)
}
removeStoredClicks(e) {
return nr.clicks.bulkDelete(e)
}
};
class ar {
constructor() {
var e, t, n;
sr.clearOld(), this.firedClicks = null, this.storedClicks = null, this.newFiredClicks = [], this.newStoredClicks = [], this.newRemovedStoredClicks = [], this.syncLocalDataWithIDB = (e = () => {
this.addLocalFiredClicksToIDB(), this.addLocalStoredClicksToIDB(), this.removeLocalStoredClicksFromIDB()
}, t = 2e3, function() {
var r = this,
i = arguments;
clearTimeout(n), n = setTimeout((() => e.apply(r, i)), t)
})
}
loadClickStore() {
return Promise.all([this.loadStoredClicks(), this.loadFiredClicks()])
}
loadFiredClicks() {
return sr.getFiredClicks().then((e => {
null === this.firedClicks && (this.firedClicks = e)
}))
}
addLocalFiredClicksToIDB() {
0 !== this.newFiredClicks.length && (sr.addFiredClicks(this.newFiredClicks), this.newFiredClicks = [])
}
isClickUrlFired(e) {
return this.getFiredClicks().some((t => t.url === e))
}
getFiredClicks() {
return this.syncLocalDataWithIDB(), this.firedClicks
}
addFiredClick(e) {
return this.getFiredClicks().push(e), this.newFiredClicks.push(e), e
}
loadStoredClicks() {
return sr.getStoredClicks().then((e => {
null === this.storedClicks && (this.storedClicks = e)
}))
}
addLocalStoredClicksToIDB() {
0 !== this.newStoredClicks.length && (sr.addStoredClicks(this.newStoredClicks.filter((e => !this.firedClicks.some((t => e.url === t.url))))), this.newStoredClicks = [])
}
removeLocalStoredClicksFromIDB() {
0 !== this.newRemovedStoredClicks.length && (sr.removeStoredClicks(this.newRemovedStoredClicks), this.newRemovedStoredClicks = [])
}
getStoredMaxPriceClick() {
var e = this.getStoredClicks().sort(((e, t) => t.price - e.price)).shift();
return void 0 !== e && e.id && this.newRemovedStoredClicks.push(e.id), e
}
getStoredClicks() {
return this.syncLocalDataWithIDB(), this.storedClicks
}
addStoredClick(e) {
return this.getStoredClicks().push(e), this.newStoredClicks.push(e), e
}
}
function cr(e, t, n, r, i, o, s) {
try {
var a = e[o](s),
c = a.value
} catch (e) {
return void n(e)
}
a.done ? t(c) : Promise.resolve(c).then(r, i)
}
function lr(e) {
return function() {
var t = this,
n = arguments;
return new Promise((function(r, i) {
var o = e.apply(t, n);
function s(e) {
cr(o, r, i, s, a, "next", e)
}
function a(e) {
cr(o, r, i, s, a, "throw", e)
}
s(void 0)
}))
}
}
class ur {
constructor(e, t, n) {
this.url = e.notification.data.url, this.price = e.notification.data.price, this.ttl = e.notification.data.ttl, this.cid = e.notification.data.cid, this.ignoreClickLogic = e.notification.data.ignoreClickLogic, this.crtid = e.notification.data.crtid, this.isCpm = e.notification.data.isCpm, this.tokenId = e.notification.data.tokenId, this.showTime = e.notification.data.showTime, this.ClickLocalDB = t, this.notificationService = n
}
closeNotification(e) {
e.notification.close()
}
track(e, t, n) {
var r = this;
return lr((function*() {
var i, o, s, a, c = new URL(t);
c.searchParams.append("button_title", null !== (i = null === (o = e.notification.data.dataAction) || void 0 === o ? void 0 : o.title) && void 0 !== i ? i : ""), c.searchParams.append("action", null !== (s = null === (a = e.notification.data.dataAction) || void 0 === a ? void 0 : a.action) && void 0 !== s ? s : "unknown"), c.searchParams.append("on_site", n);
var l =
yield r.notificationService.getNotificationOrder(e.notification.tag);
c.searchParams.append("notification_position_number", l),
function(e, t) {
try {
fetch(e, t)
} catch (e) {
console.log(e)
}
}(c.toString())
}))()
}
isIgnoreClickLogic() {
return this.ignoreClickLogic
}
storeMisslead() {
var e = this;
return lr((function*() {
var t = new URL(e.url);
t.searchParams.append("ml", 1), e.ClickLocalDB.getStoredClicks() || (
yield e.ClickLocalDB.loadClickStore()), e.ClickLocalDB.isClickUrlFired(e.url) || e.isCpm || e.ttl && !(e.ttl > Date.now()) || e.ClickLocalDB.addStoredClick({
url: t.toString(),
price: e.price,
ttl: e.ttl,
cid: e.cid,
crtid: e.crtid,
tokenId: e.tokenId,
showTime: e.showTime,
date: Date.now()
})
}))()
}
}
function dr(e, t) {
var n = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var r = Object.getOwnPropertySymbols(e);
t && (r = r.filter((function(t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable
}))), n.push.apply(n, r)
}
return n
}
function hr(e) {
for (var t = 1; t < arguments.length; t++) {
var n = null != arguments[t] ? arguments[t] : {};
t % 2 ? dr(Object(n), !0).forEach((function(t) {
fr(e, t, n[t])
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : dr(Object(n)).forEach((function(t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t))
}))
}
return e
}
function fr(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n, e
}
function pr(e, t, n, r, i, o, s) {
try {
var a = e[o](s),
c = a.value
} catch (e) {
return void n(e)
}
a.done ? t(c) : Promise.resolve(c).then(r, i)
}
function yr(e) {
return function() {
var t = this,
n = arguments;
return new Promise((function(r, i) {
var o = e.apply(t, n);
function s(e) {
pr(o, r, i, s, a, "next", e)
}
function a(e) {
pr(o, r, i, s, a, "throw", e)
}
s(void 0)
}))
}
}
function vr(e, t) {
! function(e, t) {
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object")
}(e, t), t.add(e)
}
var mr = new WeakSet;
class gr {
constructor(e, t) {
vr(this, mr), this.ClickLocalDB = e, this.notificationService = t
}
openNotificationUrl(e, t, n) {
var r = this;
return yr((function*() {
var i = Date.now();
r.ClickLocalDB.addFiredClick({
rid: e.rid,
cid: e.cid,
url: e.url,
ttl: e.ttl,
date: i
});
var o =
yield
function(e, t, n) {
if (!t.has(e)) throw new TypeError("attempted to get private field on non-instance");
return n
}(r, mr, br).call(r, e, t, i, n);
return self.clients.openWindow(o)
}))()
}
isClickPossible(e) {
var t = this;
return yr((function*() {
return t.ClickLocalDB.isClickUrlFired(e.url) ? (s("ClickUrlFired"), !1) : !(e.ttl && e.ttl <= Date.now()) || (s("Click ttl expired"), !1)
}))()
}
processClick(e, t, n) {
var r = this;
return yr((function*() {
var {
rid: i,
botProtection: o,
ignoreClickLogic: a
} = e.data, c = e.tag;
s("ignoreClickLogic", a), r.ClickLocalDB.getStoredClicks() || (
yield r.ClickLocalDB.loadClickStore());
var l =
yield r.isClickPossible(e.data),
u = r.ClickLocalDB.getStoredClicks().length;
if (s("originalClickPossible: ", l, e.data), (0 === u || 1 === u && !l || a) && e.close(), l) return yield r.openNotificationUrl(hr(hr({}, e.data), {}, {
tag: c
}), t, n), void((0 === u || a) && r.notificationService.removeFromQueue(c));
var d = r.ClickLocalDB.getStoredMaxPriceClick();
if (d) {
if (!(
yield r.isClickPossible(d))) return r.processClick(e, t, n);
yield r.openNotificationUrl(Object.assign(d, {
rid: i,
count: u,
botProtection: o,
tag: c
}), t, n), 1 !== u || l || r.notificationService.removeFromQueue(c)
}
}))()
}
openDirectURL(e) {
var t = this;
return yr((function*() {
var {
buttonTitle: n,
action: r,
directUrl: i,
pageVisibility: o,
tag: s
} = e, a = new URL(i);
a.searchParams.append("button_title", n), a.searchParams.append("action", r), a.searchParams.append("on_site", o);
var c =
yield t.notificationService.getNotificationOrder(s);
return a.searchParams.append("notification_position_number", c), self.clients.openWindow(a)
}))()
}
getAction(e) {
return yr((function*() {
var t, n;
return null !== (n = (null !== (t = e.notification.data.actions) && void 0 !== t ? t : e.notification.actions).find((t => t.action === e.action))) && void 0 !== n ? n : {
action: "banner"
}
}))()
}
}
function br(e, t, n, r) {
return _r.apply(this, arguments)
}
function _r() {
return (_r = yr((function*(e, t, n, r) {
var i = new URL(e.url);
c(e.count) || i.searchParams.append("scheme_id", e.count), i.searchParams.append("event_timestamp", n), i.searchParams.append("action", t.action), t.title && i.searchParams.append("button_title", encodeURIComponent(t.title)), i.searchParams.append("token_id", e.tokenId), i.searchParams.append("show_time", e.showTime), i.searchParams.append("on_site", r);
var o =
yield this.notificationService.getNotificationOrder(e.tag);
return i.searchParams.append("notification_position_number", o), i
}))).apply(this, arguments)
}
function wr(e, t, n, r, i, o, s) {
try {
var a = e[o](s),
c = a.value
} catch (e) {
return void n(e)
}
a.done ? t(c) : Promise.resolve(c).then(r, i)
}
function kr(e) {
return function() {
var t = this,
n = arguments;
return new Promise((function(r, i) {
var o = e.apply(t, n);
function s(e) {
wr(o, r, i, s, a, "next", e)
}
function a(e) {
wr(o, r, i, s, a, "throw", e)
}
s(void 0)
}))
}
}
class xr {
getAllItems() {
return kr((function*() {
return nr.queue.toArray()
}))()
}
getItemIndex(e) {
var t = this;
return kr((function*() {
var n = [],
r =
yield nr.transaction("r", nr.queue, kr((function*() {
for (var t = (n =
yield nr.queue.toArray()).length - 1; t >= 0; t--)
if (n[t].tag === e) return n.length - t;
return 1
})));
return n.length > 1 ? t.filterQueue(n).then((() => r)) : r
}))()
}
addItem(e) {
return nr.transaction("rw", nr.queue, kr((function*() {
if ((
yield nr.queue.toArray()).findIndex((t => t.tag === e)) < 0) return nr.queue.put({
tag: e
})
})))
}
filterQueue(e) {
var t = this;
return kr((function*() {
var n =
yield self.registration.getNotifications();
e.forEach((e => {
n.findIndex((t => t.tag === e.tag)) < 0 && t.removeItem(e.tag)
}))
}))()
}
removeItem(e) {
return nr.transaction("rw", nr.queue, kr((function*() {
return nr.queue.where({
tag: e
}).delete()
})))
}
}
function Cr(e, t) {
var n = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var r = Object.getOwnPropertySymbols(e);
t && (r = r.filter((function(t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable
}))), n.push.apply(n, r)
}
return n
}
function Pr(e) {
for (var t = 1; t < arguments.length; t++) {
var n = null != arguments[t] ? arguments[t] : {};
t % 2 ? Cr(Object(n), !0).forEach((function(t) {
Sr(e, t, n[t])
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Cr(Object(n)).forEach((function(t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t))
}))
}
return e
}
function Sr(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n, e
}
function Or(e, t, n, r, i, o, s) {
try {
var a = e[o](s),
c = a.value
} catch (e) {
return void n(e)
}
a.done ? t(c) : Promise.resolve(c).then(r, i)
}
function Kr(e) {
return function() {
var t = this,
n = arguments;
return new Promise((function(r, i) {
var o = e.apply(t, n);
function s(e) {
Or(o, r, i, s, a, "next", e)
}
function a(e) {
Or(o, r, i, s, a, "throw", e)
}
s(void 0)
}))
}
}
function Er(e, t) {
! function(e, t) {
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object")
}(e, t), t.add(e)
}
function Ar(e, t, n) {
if (!t.has(e)) throw new TypeError("attempted to get private field on non-instance");
return n
}
var Dr = new WeakSet;
class Br {
constructor() {
Er(this, Dr), this.data = null, this.queue = new xr, this.isRenotify = !1
}
setData(e) {
this.data = e
}
getNotificationOrder(e) {
var t = this;
return Kr((function*() {
return yield t.queue.getItemIndex(e)
}))()
}
removeFromQueue(e) {
this.queue.removeItem(e)
}
createNotificationRecord(e) {
var t = arguments,
n = this;
return Kr((function*() {
var r, i, o, s = t.length > 1 && void 0 !== t[1] ? t[1] : {},
a = t.length > 2 ? t[2] : void 0,
c = t.length > 3 ? t[3] : void 0,
l = Date.now() - 1e3 * e.currentTime,
u = Date.now();
var d, h, f = Math.random().toString(36).substring(5) + Math.random().toString(36).substring(5);
return e.tag = e.tag || f, {
data: Pr(Pr({}, s), {}, {
status: e.status,
notificationUrl: e.notificationUrl,
delay: e.delay,
cid: e.cid,
url: e.url,
price: e.ecpm || e.correctedPrice || 0,
ttl: (d = e.expirationTimestamp, h = l, void 0 === d || "number" != typeof d || 0 === d ? null : d + h),
botProtection: e.botProtection || !1,
isCpm: -1 === e.url.indexOf("is_cpm=0"),
ignoreClickLogic: e.ignoreClickLogic || !1,
crtid: e.crtid,
rid: Math.random().toString(36).substring(5) + Math.random().toString(36).substring(5),
trackCloseUrl: e.track_close_url,
showTime: u,
actions: null == e || null === (r = e.options) || void 0 === r ? void 0 : r.actions
}),
title: e.title,
body: e.body,
image: e.image,
icon: yield Ar(n, Dr, Ir).call(n, e, u, c),
badge: e.badge_url,
actions: null == e || null === (i = e.options) || void 0 === i ? void 0 : i.actions,
requireInteraction: null == e || null === (o = e.options) || void 0 === o ? void 0 : o.requireInteraction,
tag: e.tag,
renotify: a || !1
}
}))()
}
closeExpiredNotifications() {
var e = this;
return Kr((function*() {
(
yield self.registration.getNotifications()).forEach((t => {
var n;
(null === (n = t.data) || void 0 === n ? void 0 : n.ttl) <= Date.now() && (e.removeFromQueue(t.tag), t.close())
}))
}))()
}
showAndAddToQueue(e) {
return "close" !== e.data.status && this.queue.addItem(e.tag), self.registration.showNotification(e.title, e)
}
displayNotification(e, t) {
return o(e.data.delay, this.showAndAddToQueue(e)).then((() => (e.data.notificationUrl && fetch(e.data.notificationUrl), t && e.icon && fetch(e.icon), e))).catch((e => {
console.log("TC SW Imp Error: ".concat(e.toString()))
}))
}
sort() {
var e = this;
return Kr((function*() {
e.isRenotify = !0,
yield e.closeExpiredNotifications();
var t =
yield self.registration.getNotifications();
if (t = t.sort(((e, t) => e.data.price - t.data.price)), e.data = e.data.sort(((e, t) => e.ecpm - t.ecpm)), e.data.forEach((e => e.ecpm = Number(e.ecpm.toFixed(6)))), t.length >= 2) {
var n = t[t.length - 1].data.price;
e.data.forEach((e => {
if (!(e.ecpm > n)) {
var r = t.findIndex((t => {
if (e.ecpm > t.data.price) return e.tag = t.tag, !0
}));
if (-1 !== r && t.splice(r, 1), -1 === r) {
var i, o = null === (i = t[0]) || void 0 === i ? void 0 : i.tag;
e.tag = o || "ipntub".concat(Math.random()), t.splice(0, 1)
}
}
}))
}
}))()
}
displayDefaultNotification() {
return self.registration.showNotification("", {
body: "This site has been updated in the background",
tag: "nstub"
})
}
resetRenotify() {
this.isRenotify = !1
}
showNotifications(e, t, n, r) {
var i = this;
return Kr((function*() {
return yield Promise.all(i.data.map(function() {
var o = Kr((function*(o) {
var s =
yield i.createNotificationRecord(o, {
auctionUrl: t,
pushPayload: e,
tokenId: e.token_id,
isSafari: n
}, i.isRenotify, r);
return i.displayNotification(s, n)
}));
return function(e) {
return o.apply(this, arguments)
}
}()))
}))()
}
}
function Ir(e, t, n) {
return jr.apply(this, arguments)
}
function jr() {
return (jr = Kr((function*(e, t, n) {
var r = new URL(e.icon),
i = e.options.actions.map((e => e.title)).join(",");
r.searchParams.append("button_title", encodeURI(i)), r.searchParams.append("show_time", t), r.searchParams.append("on_site", n);
var o =
yield this.getNotificationOrder(e.tag);
return r.searchParams.append("notification_position_number", o), r.href
}))).apply(this, arguments)
}
for (var Tr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", Mr = new Uint8Array(256), Rr = 0; Rr < Tr.length; Rr++) Mr[Tr.charCodeAt(Rr)] = Rr;
function Fr(e) {
for (var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Tr, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "", r = new Uint8Array(e), i = r.length, o = "", s = 0; s < i; s += 3) o += t[r[s] >> 2], o += t[(3 & r[s]) << 4 | r[s + 1] >> 4], o += t[(15 & r[s + 1]) << 2 | r[s + 2] >> 6], o += t[63 & r[s + 2]];
return i % 3 == 2 ? o = o.slice(0, o.length - 1) + n : i % 3 == 1 && (o = o.slice(0, o.length - 2) + n + n), o
}
function Nr(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Mr,
n = e.length,
r = Math.floor(.75 * e.length),
i = 0;
"=" === e[n - 1] && (r--, "=" === e[n - 2] && r--);
for (var o = new Uint8Array(r), s = 0; s < n; s += 4) {
var a = t[e.charCodeAt(s)],
c = t[e.charCodeAt(s + 1)],
l = t[e.charCodeAt(s + 2)],
u = t[e.charCodeAt(s + 3)];
o[i++] = a << 2 | c >> 4, o[i++] = (15 & c) << 4 | l >> 2, o[i++] = (3 & l) << 6 | 63 & u
}
return o
}
Mr[45] = 62, Mr[95] = 63;
const Ur = JSON.parse('{"x":[{"id":0,"publicKey":"BA+ojkq9so7q7OARyvfbHGohFYx7mCLSzi2lztFiKoL5Nrnh2Iqdx7/3A12uiiYs4zRO9qotEtHApQ02R7KeY/Y=","privateKey":"J0SwjEIJcfxppH2m6jxyUa/GL8E6K1jKf/NZr3tEhDg="},{"id":1,"publicKey":"BPZP2eiVQ9M9ldQ7r2fhzutv-XFsMp-Td09w-YeUa4GfRM0v67zx1qaGM63ObPzaTsCP5dDka49rKFLAdMPE6OE","privateKey":"SRw6iGC8p0D_rch2VJJAD2DfI39Rq3aLy6kYBLcw54Y"},{"id":2,"publicKey":"BF6EtvSBQCWLNPiIKFl1BDdED6YuQP6-SzMrPMbNW7sVfANmHqfBFw740chC-It4jksmVqZisq0_PSF7gAgP5nQ","privateKey":"dMhda8ZV6PvVZKrtCO6m_zXhTTY_PO7Gca--ay32pX0"},{"id":3,"publicKey":"BEHF3tidJXPYC72Em3qikxTlUu8muOulHJZslAdiiYUnfzHf4WK4DcgPwmrPaAogLp5qPnC8heItmL_1YWFSAhY","privateKey":"K4-CPL84qFnYUzJyfOy7S2SJOO5-aWCtD7dZ-32FImQ"},{"id":4,"publicKey":"BBDqg-WUChOYKzOIX6NN5XJrar5S07W-CKaZZXXJGB60ZSgxwngaE2rUaAEtk6d7YubEG8O41nTU3WfgUylFQ58","privateKey":"HlH2-3te9k6uump5dD1yGtO1VF_xzGaewzwI2tUz_HM"},{"id":5,"publicKey":"BJYNCsbiJGzE8t9JwcXGYGuCqCMpnvmXWrbMoSzmbnjzxMHQj1q1ID-opWyEWc_S9uV4O8AywYCrlsXmm9tXiOo","privateKey":"6AL8w5ADSWOpTiyWeLYCmQbATZojYRVVpVCZSmPPfzI"},{"id":6,"publicKey":"BPXqJtk9Bdkncr9C2ufUukTZSSF9glUiIZAIiSzAcxW0dLYQQIybaflPfEAKB5SniyGy4ClBMyRK4vCZ1pKsPqI","privateKey":"Rtq7aePf5xT5cXdUQ8-aV2mKiKGnxJpgSvTkTwIlvCw"},{"id":7,"publicKey":"BMJh9g24g8sh8vW1tkCeH_KtNuZnibzf1I-7Bs6vrwFaLsQIMovo1V5xjG2OFLhyATSkD0w2KCHtBaQOcQSnuHk","privateKey":"wNDseDj6MMa1fZODaHqMZdWF7PvceFfGaFz1dMNNWBI"},{"id":8,"publicKey":"BE2A1EVOc4rObFyk2Nm-xFoDzyWzQcpnJGrWddYd4ZqNZDR-5YpjJ19iDI6JVwk9C_AkxaHqAw5URUyg7HIIPYk","privateKey":"X4cCxtvFpbZwaHg4D6BpItXRoCPD3rRVWlRhDhMulb0"},{"id":9,"publicKey":"BAqDDxkwMOnPahAtxNpsYdK8YCQFtaOdHE98XBO89YW0MZ0F7WZnTK7Q5Pz6wQ-N3ZHoPfZVZcgAs6VwPlLbQYY","privateKey":"B1S_I-klUdAPZsuDO59BIhrCEUEb-BceCUm9nrAvcX8"},{"id":10,"publicKey":"BBzCwiEPu1eobZvl_KHxzz3SUYJolGR4YZM-oplWC-oT5DfXXAcolbHY0i3qXwekwgD8ALMNwPtfpTuu77TpeFo","privateKey":"Wx-mwGLAmRGLuT4fsLqrA9dl-BTGTMYV4ghUpGGswDs"},{"id":11,"publicKey":"BEFv-JC2neGUXalb09va2aGjz4D5GHVHPcT6oHhoLhb3ZUgQywuVFy4HTh7VM_W74ZXGGa2p94IsZa2muhfTtDo","privateKey":"zQEKtUrcM0HvqgQzoA7kELu7_hGTVAUCOEaBl7TIjQM"},{"id":12,"publicKey":"BBzueAo9ImxPRg1hAT45FOxxkOhpw6nqsAOn78o4K94vuGrYxhn6Z5R9n_40IjhTfIM2DCxY1-k8A5c19omjKEQ","privateKey":"4BkiHfeJ_igDORlmx1MlJ3Heceez4CyoQfu6wjbv6GY"},{"id":13,"publicKey":"BCyBc56nn-zkbnQKJLh7G_KHGYRRN0zB7wSuwHhKo04zKj_ajZCbtGiufGddn_Hn9R1ShgdGPYuen3YkPuREDNk","privateKey":"2AJsDkii7KOhUIWfW9rN7riCtKdhquuEJAO8E_Wmlwg"},{"id":14,"publicKey":"BBdjVYgvM8VxAOPHBj1lPKxMtNgudcgw6UjkvPCvwicj3Go6iCgNdE9UsJXESnUbsBdxWPtaphjZ5Z0p_B0DOxU","privateKey":"HQEfHtvc_kwvAUyUqCFkGEbixMfzwsIB6aXnp0s4QG0"},{"id":15,"publicKey":"BFN9nGQSgD4PkkiGmgzf1jhImZrDdXkX-nUi1J_Vi6AtFymSfSMMXjF5GSsUjbL0NQO81YWuIpRsOSz7eR1Hs2Q","privateKey":"QOVWcay4m0NXSElJS-tBfyB2dvb_69n4lqeJr67WOGM"},{"id":16,"publicKey":"BBVEJplDPoX7Wl9-uHQFYPmUhDxBnBUdO_2ilTUN4gsUcqh7R7Z-zqJMHdbkx2UI2FIZ2yKFwNX9ov3FUGa-FT8","privateKey":"AwM1XS3A4TaJJL7DhQkPfZpQ_l3hAJCNCvofv6zDD-4"},{"id":17,"publicKey":"BMcljipZcnmxn2I-vVmWr3eENKXMxZ1C1X_ffIV02S2h5ltE0gL9iRuukT2gB-HYdh5VkIlJQus0DfeWEXQnBFA","privateKey":"eYmTgEF-oZven1YK8O3lGOU3s1Xq611Lh6MszwgzLyc"},{"id":18,"publicKey":"BDODN9DbpTXP3FB-NUE_pPxsS-OBMlpJUI-YAUsY-RguSzboQQeuMTzzopfDrmdGCScB4W_5DIMdmJ7g6bTLLYs","privateKey":"F-lsx0NoUCu_3OkNpoqOoeVZ1MGEj6hP46yuo4_aVYA"},{"id":19,"publicKey":"BPkizkKtqQTLNLR-SSYwi3nvAMSMFWJ5PzPV7iAS0c1VZVNPqAZt-iSCdKi0SNqL96afrnz959x5a3LI0nxCLe0","privateKey":"hzIxQXjSEiSOw3r234RkRg1vRCRJMRbOdpnp1-mOJPQ"},{"id":20,"publicKey":"BORkMYRMLhgUSKHs3w4AE5pNuLGU795obmB3nrUWmzEJHWddWEszHG8A1BYTk8SER80M2qEJa55kDtEAhbSHP-o","privateKey":"Mv3-4zDqM8iGv6FwFx0IPhY_pIFAZZj7jL64sZZMBCk"},{"id":21,"publicKey":"BBWGT0JNCgkuEbakF26pyL6CGEYJZiMsdKR-FGVBpshr9yDtYdlNDqnMrP7Tsgsg9oayG7qyA8hwAId2rvbHNxY","privateKey":"dImp_iFqstH8GrG641WwCTIfvH-gUYWyY0G-dGV2Ev8"},{"id":22,"publicKey":"BAiXrsjkiBnG49Nqb-CHOrtoLWZ0WyjV0FKLw3K0xZeGsUyREy-Rt_nmjLNd5zXXmXfEfcTqzBvrUBX18N3gkS4","privateKey":"zHomSXSv_nuZWHNBb7LzVfsl0z5lZvbO3YcP8UEI9mA"},{"id":23,"publicKey":"BKHxooeIkJAGM__VZMOPNf_eWW7xDPc9A1U8QU5pFNgfJQjIaUcJUiiSLOS3BYzDbxAUOI361KAIZQD22BKhB9Y","privateKey":"mB_5soSImOI-xElX-HrHojkUQ1ZSYSxy4Ga_-iRXrfg"},{"id":24,"publicKey":"BAIPvLA7WiYtvC-RdxhY7FvdnzEdA3o1MKqxnTfWjkfyK_gnlWtBVV5zOMiYQvhr1nbfzZi0GH8ye75n_ufgVvU","privateKey":"9IpMgu7qiUfR_vuedSo3YphgeV41yJNIi0FbqzzXZ7U"},{"id":25,"publicKey":"BFJnYsFNNuHSacuzylt1M6fyCYrZT3NNGxKGeQeG8f4mIsDcDHjK0MAoqeDD4vhBp_ZSj_IFJOZidFGfhbqolno","privateKey":"HSuyfoUfoGvR3Vb0OwtD3i1UC5V2bG4XTvZkQR2OQjI"},{"id":26,"publicKey":"BA6epAzFJ6vGppad_WPQ9e4hybpsOtx60Gg7AzKROy_Msbdi4vQN9TVCWiLVkagkXC4lUp7W03i7Uv7mFOhMF50","privateKey":"XrvW6TH0i9kDf1tSJcVBhAIBFKkzgizcX6CUKILRb6U"},{"id":27,"publicKey":"BFDJdEweGkbC7tyox7a5id6deOvOEg5jI4zD3_mM5Nthxcchr0IMr4-Sp6C40AH6oKUtJ-__O0nirPNUUO_rXdU","privateKey":"dBWCDB4w9NpEqF-mpn7K30-Po43ThpJO4vTVfM0ae3o"},{"id":28,"publicKey":"BFi-zcJoVhHOde2CmQYIi8ht30R1176eeUcAsWsxyTzQaARhGI7gmcv92oS_tZQx3OJhEOygU3gGBz_dGqBpMFE","privateKey":"VCjppYkHbDDtrQoNoimLyvLgRbtVKdHp5j-b7znzTyI"},{"id":29,"publicKey":"BAPJbkUpORgly-IyS7SWb2MOwgapL_RzE5zvRc_85Oa_9vVEmbg1JWmniOVPVgu9NjICSFmRozPvskGvicuNQWo","privateKey":"5m9xHyGByOgl5Bvj8CGWS8fMC5hzb8ZeNg5rWire3mU"},{"id":30,"publicKey":"BO5ulR7aC1L9nBV9zZSdMCOa75Dy87xu2n5dL53V0B-maYLcJ2ojCpNFB5MlXHvhVC1xbHIrEdUybb8I_BgQo90","privateKey":"8xd56TwJsx9VXya98BgET8Rm-sRVLyFyLzsmIBGeERg"}]}');
function qr(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e.length - 1,
r = e.slice(t, n + 1);
return r[Math.floor(Math.random() * r.length)]
}
function Lr(e, t, n, r, i, o, s) {
try {
var a = e[o](s),
c = a.value
} catch (e) {
return void n(e)
}
a.done ? t(c) : Promise.resolve(c).then(r, i)
}
function zr(e) {
return function() {
var t = this,
n = arguments;
return new Promise((function(r, i) {
var o = e.apply(t, n);
function s(e) {
Lr(o, r, i, s, a, "next", e)
}
function a(e) {
Lr(o, r, i, s, a, "throw", e)
}
s(void 0)
}))
}
}
function Vr() {
return (Vr = zr((function*(t, n) {
var {
tcId: r,
spotId: i,
tube: o,
sub: s,
utmSource: a,
utmMedium: c,
utmCampaign: l,
utmContent: u,
isAdblock: d,
fingerprint: h,
referrer: f = "",
href: p = "",
sid: y
} = n, v = Ur.x, m = qr(v, 0, v.length - 1) || v[0], g =
yield t.getSubscription();
yield g.unsubscribe();
var b =
yield t.subscribe({
applicationServerKey: Nr(m.publicKey),
userVisibleOnly: !0
}),
_ = b.getKey("p256dh"),
w = b.getKey("auth"),
k =
yield fetch("https://subscribers.production.wpu.sh/register", {
method: "POST",
headers: {
"Content-type": "application/json"
},
body: JSON.stringify({
contentEncoding: (t.supportedContentEncodings || ["aesgcm"])[0],
authToken: Fr(w),
publicKey: Fr(_),
endpoint: b.endpoint,
sdkVersion: e,
tcid: r,
spot_id: i,
token_id: m.id,
tube: "other" === o ? "tcpublisher" : o,
sub: s,
utm_source: a,
utm_medium: c,
utm_campaign: l,
utm_content: u,
is_adblock: d,
fp: h,
referrer: f,
href: p,
sid: y
})
}),
{
sid: x
} =
yield k.json();
return {
sid: x,
tokenId: m.id
}
}))).apply(this, arguments)
}
function Wr() {
return (Wr = zr((function*(e) {
var t = Ur.x.map((e => {
var {
publicKey: t
} = e;
return t
})),
n = Fr((
yield e.getSubscription()).options.applicationServerKey);
return !t.includes(n)
}))).apply(this, arguments)
}
function Gr(e, t) {
var n = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var r = Object.getOwnPropertySymbols(e);
t && (r = r.filter((function(t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable
}))), n.push.apply(n, r)
}
return n
}
function Yr(e) {
for (var t = 1; t < arguments.length; t++) {
var n = null != arguments[t] ? arguments[t] : {};
t % 2 ? Gr(Object(n), !0).forEach((function(t) {
Qr(e, t, n[t])
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Gr(Object(n)).forEach((function(t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t))
}))
}
return e
}
function Qr(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n, e
}
function Hr(e, t, n, r, i, o, s) {
try {
var a = e[o](s),
c = a.value
} catch (e) {
return void n(e)
}
a.done ? t(c) : Promise.resolve(c).then(r, i)
}
function Jr(e) {
return function() {
var t = this,
n = arguments;
return new Promise((function(r, i) {
var o = e.apply(t, n);
function s(e) {
Hr(o, r, i, s, a, "next", e)
}
function a(e) {
Hr(o, r, i, s, a, "throw", e)
}
s(void 0)
}))
}
}
var Zr = [10, 20, 30],
Xr = {
nextNotification: 0,
mode: null,
demandModeProbability: .5,
creativesUpdateTime: null,
statSendTime: null,
postponedUpdateTime: null,
isMetaMaskActive: !1,
userKeywords: "",
entryReferrerDomain: null,
tagAbVersion: "",
visitorId: 0,
isSafari: !1,
v2: 0,
page: "",
subscriptions: "",
language: "",
auctionUrl: null
};
class $r {
constructor() {
this.Auction = new or, this.version = e, this.settingsRestored = !1, Object.keys(Xr).forEach((e => {
this[e] = Xr[e]
})), this.timezone_offset = (new Date).getTimezoneOffset() / -60, this.version = e, this.ClickLocalDB = new ar, this.isWindows = navigator && navigator.userAgent.includes("Windows"), this.notificationService = new Br, this.subscriptions = "", this.language = "", this.isSafari = !1, this.auctionUrl = null
}
isPageVisible() {
return Jr((function*() {
return (
yield self.clients.matchAll({
includeUncontrolled: !0,
type: "window"
})).some((e => "visible" === e.visibilityState))
}))()
}
static getVersion() {
return e
}
restoreEnvironment() {
var e = this;
return Jr((function*() {
if (!e.settingsRestored) {
e.settingsRestored = !0;
var t =
yield e.Auction.getSettings();
Object.keys(Xr).forEach((n => {
e[n] = t && t[n] || e[n]
}))
}
}))()
}
saveEnvironment() {
var e = this;
return Jr((function*() {
return t = [e.Auction.saveSettings(Object.keys(Xr).reduce(((t, n) => (t[n] = e[n], t)), {}))], Promise.allSettled && Promise.allSettled(t) || Promise.all(t.map((e => e.then((e => ({
status: "fulfilled",
value: e
}))).catch((e => ({
status: "rejected",
reason: e
}))))));
var t
}))()
}
message(e) {
var t, n, r, i, o, s, a, c, l, u, d, h, f, p, y, v, m, g, b, _, w, k;
this.isMetaMaskActive = null === (t = e.data) || void 0 === t || null === (n = t.adManagerEnv) || void 0 === n ? void 0 : n.isMetaMaskActive, this.userKeywords = null === (r = e.data) || void 0 === r || null === (i = r.adManagerEnv) || void 0 === i ? void 0 : i.keywords, this.entryReferrerDomain = null === (o = e.data) || void 0 === o || null === (s = o.adManagerEnv) || void 0 === s ? void 0 : s.entryReferrerDomain, this.tagAbVersion = null === (a = e.data) || void 0 === a || null === (c = a.adManagerEnv) || void 0 === c ? void 0 : c.tagAbVersion, this.visitorId = null === (l = e.data) || void 0 === l || null === (u = l.adManagerEnv) || void 0 === u ? void 0 : u.visitorId, this.isSafari = "Safari" === (null === (d = e.data) || void 0 === d || null === (h = d.adManagerEnv) || void 0 === h || null === (f = h.ua) || void 0 === f || null === (p = f.browser) || void 0 === p ? void 0 : p.name), this.v2 = null === (y = e.data) || void 0 === y || null === (v = y.adManagerEnv) || void 0 === v ? void 0 : v.v2, this.subscriptions = null === (m = e.data) || void 0 === m ? void 0 : m.subscriptions, this.language = null === (g = e.data) || void 0 === g ? void 0 : g.language, this.page = null === (b = e.data) || void 0 === b || null === (_ = b.adManagerEnv) || void 0 === _ || null === (w = _.page) || void 0 === w ? void 0 : w.split(encodeURIComponent("?"))[0], this.auctionUrl = null === (k = e.data) || void 0 === k ? void 0 : k.auctionUrl, e.waitUntil(this.saveEnvironment())
}
push(e) {
var t = this;
return Jr((function*() {
try {
var r;
t.isSafari && console.log(e),
yield t.restoreEnvironment();
var i = e.data.json();
if (!i) return Promise.resolve();
if (!t.isSafari && null !== (r = self.location.origin) && void 0 !== r && r.includes("xn----itbooccbfegeay")) {
var o =
yield
function(e) {
return Wr.apply(this, arguments)
}(self.registration.pushManager);
if (o) {
var c, l, u, d, h, f, p, y, v, m, g, {
tokenId: b
} =
yield
function(e, t) {
return Vr.apply(this, arguments)
}(self.registration.pushManager, {
tcId: null !== (c = null == i ? void 0 : i.tcid) && void 0 !== c ? c : null,
spotId: null !== (l = null == i ? void 0 : i.spot_id) && void 0 !== l ? l : 322952,
tube: null !== (u = null == i ? void 0 : i.site) && void 0 !== u ? u : "tcpublisher",
sub: null !== (d = null == i ? void 0 : i.ad_sub) && void 0 !== d ? d : 0,
utmSource: null !== (h = null == i ? void 0 : i.utm_source) && void 0 !== h ? h : "",
utmMedium: null !== (f = null == i ? void 0 : i.utm_medium) && void 0 !== f ? f : "",
utmCampaign: null !== (p = null == i ? void 0 : i.utm_campaign) && void 0 !== p ? p : "",
utmContent: null !== (y = null == i ? void 0 : i.utm_content) && void 0 !== y ? y : "",
isAdblock: null !== (v = null == i ? void 0 : i.is_adblock) && void 0 !== v ? v : 0,
fingerprint: null !== (m = null == i ? void 0 : i.fingerprint) && void 0 !== m ? m : "",
sid: null !== (g = null == i ? void 0 : i.sid) && void 0 !== g ? g : null
});
i.token_id = b
}
}
yield t.saveEnvironment();
var _ = 0 === t.timezone_offset ? 0 : t.timezone_offset;
i.ver = t.version, i.ver_c = t.version;
var w =
yield t.isPageVisible(),
k = function(e, t) {
var n = new URL(t);
return Object.entries(e).forEach((e => {
var [t, r] = e;
"object" == typeof r ? n.searchParams.append(t, encodeURI(JSON.stringify(r))) : n.searchParams.append(t, r)
})), n.toString()
}(Yr(Yr({}, i), {}, {
timezone_offset: _,
token_id: i.token_id,
mm: t.isMetaMaskActive,
user_keywords: t.userKeywords,
pr: t.entryReferrerDomain,
tag_ab: t.tagAbVersion,
user_fp: t.visitorId,
v2: t.v2,
subscriptions: t.subscriptions,
page: t.page
}), t.auctionUrl || "".concat("https://notification.tubecup.net").concat("/in/multy")),
x =
yield
function(e) {
return a.apply(this, arguments)
}(k);
t.notificationService.setData(x), t.isSafari || t.isWindows || Zr.includes(i.token_id) ? t.isSafari || t.notificationService.closeExpiredNotifications() : yield t.notificationService.sort();
var C =
yield t.notificationService.showNotifications(i, k, t.isSafari, w);
return t.notificationService.resetRenotify(), C
} catch (e) {
if (t.isSafari) return t.notificationService.displayDefaultNotification();
if (e instanceof n) return void s("TC SW Error: ".concat(e));
throw new Error("TC SW Error: ".concat(e))
}
}))()
}
notificationclick(e) {
var t = this;
return Jr((function*() {
if (e.notification.data) {
var n, r, i, s, a = new gr(t.ClickLocalDB, t.notificationService),
c =
yield a.getAction(e),
l =
yield t.isPageVisible();
return e.notification.data.dataAction = c, "close" === c.status || "close" === e.notification.data.status ? t.notificationclose(e) : "direct_link" === c.status ? (e.notification.close(), a.openDirectURL({
directUrl: e.notification.data.trackCloseUrl,
buttonTitle: null !== (n = null === (r = e.notification.data.dataAction) || void 0 === r ? void 0 : r.title) && void 0 !== n ? n : "",
action: null !== (i = null === (s = e.notification.data.dataAction) || void 0 === s ? void 0 : s.action) && void 0 !== i ? i : "unknown",
pageVisibility: l,
tag: e.notification.tag
})) : o(0, a.processClick(e.notification, c, l))
}
}))()
}
notificationclose(e) {
var t = this;
return Jr((function*() {
var n, r;
if (e.notification.data && (null === (n = e.notification) || void 0 === n || null === (r = n.data) || void 0 === r || !r.isSafari)) {
var i = new ur(e, t.ClickLocalDB, t.notificationService);
"notificationclick" === e.type && i.closeNotification(e);
var o =
yield t.isPageVisible();
if (
yield i.track(e, e.notification.data.trackCloseUrl, o), t.notificationService.removeFromQueue(e.notification.tag), i.isIgnoreClickLogic()) return !1;
yield i.storeMisslead()
}
}))()
}
install() {
return self.skipWaiting()
}
activate() {
return self.clients.claim()
}
}
self.getWorker = () => $r
})();