summaryrefslogtreecommitdiff
path: root/ext/lib/dexie.min.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/lib/dexie.min.js')
-rw-r--r--ext/lib/dexie.min.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/lib/dexie.min.js b/ext/lib/dexie.min.js
index 62b12442..81676ce2 100644
--- a/ext/lib/dexie.min.js
+++ b/ext/lib/dexie.min.js
@@ -1,2 +1,3 @@
-!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Dexie=b()}(this,function(){"use strict";function d(b,c){return"object"!=typeof c?b:(a(c).forEach(function(a){b[a]=c[a]}),b)}function g(a,b){return f.call(a,b)}function h(b,c){"function"==typeof c&&(c=c(e(b))),a(c).forEach(function(a){j(b,a,c[a])})}function j(a,b,c,e){i(a,b,d(c&&g(c,"get")&&"function"==typeof c.get?{get:c.get,set:c.set,configurable:!0}:{value:c,configurable:!0,writable:!0},e))}function k(a){return{from:function(b){return a.prototype=Object.create(b.prototype),j(a.prototype,"constructor",a),{extend:h.bind(null,a.prototype)}}}}function m(a,b){var d,c=l(a,b);return c||(d=e(a))&&m(d,b)}function o(a,b,c){return n.call(a,b,c)}function p(a,b){return b(a)}function q(a){var b=setTimeout(a,1e3);clearTimeout(b)}function r(a){if(!a)throw new Error("Assertion Failed")}function s(a){c.setImmediate?setImmediate(a):setTimeout(a,0)}function t(a,b){return a.reduce(function(a,c,d){var e=b(c,d);return e&&(a[e[0]]=e[1]),a},{})}function u(a,b){return function(){try{a.apply(this,arguments)}catch(a){b(a)}}}function v(a,b,c){try{a.apply(null,c)}catch(a){b&&b(a)}}function w(a,b){if(g(a,b))return a[b];if(!b)return a;if("string"!=typeof b){for(var c=[],d=0,e=b.length;d<e;++d){var f=w(a,b[d]);c.push(f)}return c}var h=b.indexOf(".");if(h!==-1){var i=a[b.substr(0,h)];return void 0===i?void 0:w(i,b.substr(h+1))}}function x(a,b,c){if(a&&void 0!==b&&!("isFrozen"in Object&&Object.isFrozen(a)))if("string"!=typeof b&&"length"in b){r("string"!=typeof c&&"length"in c);for(var d=0,e=b.length;d<e;++d)x(a,b[d],c[d])}else{var f=b.indexOf(".");if(f!==-1){var g=b.substr(0,f),h=b.substr(f+1);if(""===h)void 0===c?delete a[g]:a[g]=c;else{var i=a[g];i||(i=a[g]={}),x(i,h,c)}}else void 0===c?delete a[b]:a[b]=c}}function y(a,b){"string"==typeof b?x(a,b,void 0):"length"in b&&[].map.call(b,function(b){x(a,b,void 0)})}function z(a){var b={};for(var c in a)g(a,c)&&(b[c]=a[c]);return b}function A(a){if(!a||"object"!=typeof a)return a;var c;if(b(a)){c=[];for(var d=0,e=a.length;d<e;++d)c.push(A(a[d]))}else if(a instanceof Date)c=new Date,c.setTime(a.getTime());else{c=a.constructor?Object.create(a.constructor.prototype):{};for(var f in a)g(a,f)&&(c[f]=A(a[f]))}return c}function B(b,c,d,e){return d=d||{},e=e||"",a(b).forEach(function(a){if(g(c,a)){var f=b[a],h=c[a];"object"==typeof f&&"object"==typeof h&&f&&h&&f.constructor===h.constructor?B(f,h,d,e+a+"."):f!==h&&(d[e+a]=c[a])}else d[e+a]=void 0}),a(c).forEach(function(a){g(b,a)||(d[e+a]=c[a])}),d}function F(a){var c,d,e,f;if(1===arguments.length){if(b(a))return a.slice();if(this===E&&"string"==typeof a)return[a];if(f=D(a)){for(d=[];e=f.next(),!e.done;)d.push(e.value);return d}if(null==a)return[a];if(c=a.length,"number"==typeof c){for(d=new Array(c);c--;)d[c]=a[c];return d}return[a]}for(c=arguments.length,d=new Array(c);c--;)d[c]=arguments[c];return d}function H(a){return G.apply([],a)}function J(a,b){I=a,K=b}function M(){if(L)try{throw M.arguments,new Error}catch(a){return a}return new Error}function N(a,b){var c=a.stack;return c?(b=b||0,0===c.indexOf(a.name)&&(b+=(a.name+a.message).split("\n").length),c.split("\n").slice(b).filter(K).map(function(a){return"\n"+a}).join("")):""}function O(a,b){return function(){return console.warn(a+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+N(M(),1)),b.apply(this,arguments)}}function T(a,b){this._e=M(),this.name=a,this.message=b}function U(a,b){return a+". Errors: "+b.map(function(a){return a.toString()}).filter(function(a,b,c){return c.indexOf(a)===b}).join("\n")}function V(a,b,c,d){this._e=M(),this.failures=b,this.failedKeys=d,this.successCount=c}function W(a,b){this._e=M(),this.name="BulkError",this.failures=b,this.message=U(a,b)}function _(a,b){if(!a||a instanceof T||a instanceof TypeError||a instanceof SyntaxError||!a.name||!$[a.name])return a;var c=new $[a.name](b||a.message,a);return"stack"in a&&j(c,"stack",{get:function(){return this.inner.stack}}),c}function ba(){}function ca(a){return a}function da(a,b){return null==a||a===ca?b:function(c){return b(a(c))}}function ea(a,b){return function(){a.apply(this,arguments),b.apply(this,arguments)}}function fa(a,b){return a===ba?b:function(){var c=a.apply(this,arguments);void 0!==c&&(arguments[0]=c);var d=this.onsuccess,e=this.onerror;this.onsuccess=null,this.onerror=null;var f=b.apply(this,arguments);return d&&(this.onsuccess=this.onsuccess?ea(d,this.onsuccess):d),e&&(this.onerror=this.onerror?ea(e,this.onerror):e),void 0!==f?f:c}}function ga(a,b){return a===ba?b:function(){a.apply(this,arguments);var c=this.onsuccess,d=this.onerror;this.onsuccess=this.onerror=null,b.apply(this,arguments),c&&(this.onsuccess=this.onsuccess?ea(c,this.onsuccess):c),d&&(this.onerror=this.onerror?ea(d,this.onerror):d)}}function ha(a,b){return a===ba?b:function(c){var e=a.apply(this,arguments);d(c,e);var f=this.onsuccess,g=this.onerror;this.onsuccess=null,this.onerror=null;var h=b.apply(this,arguments);return f&&(this.onsuccess=this.onsuccess?ea(f,this.onsuccess):f),g&&(this.onerror=this.onerror?ea(g,this.onerror):g),void 0===e?void 0===h?void 0:h:d(e,h)}}function ia(a,b){return a===ba?b:function(){return b.apply(this,arguments)!==!1&&a.apply(this,arguments)}}function ja(a,b){return a===ba?b:function(){var c=a.apply(this,arguments);if(c&&"function"==typeof c.then){for(var d=this,e=arguments.length,f=new Array(e);e--;)f[e]=arguments[e];return c.then(function(){return b.apply(d,f)})}return b.apply(this,arguments)}}function Ja(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ba,this._lib=!1;var b=this._PSD=Fa;if(I&&(this._stackHolder=M(),this._prev=null,this._numPrev=0,Sa(this,Ca)),"function"!=typeof a){if(a!==ka)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Na(this,this._value))}this._state=null,this._value=null,++b.ref,Ma(this,a)}function La(a,b,c,d,e){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d,this.psd=e}function Ma(a,b){try{b(function(b){if(null===a._state){if(b===a)throw new TypeError("A promise cannot be resolved with itself.");var c=a._lib&&Ua();b&&"function"==typeof b.then?Ma(a,function(a,c){b instanceof Ja?b._then(a,c):b.then(a,c)}):(a._state=!0,a._value=b,Oa(a)),c&&Va()}},Na.bind(null,a))}catch(b){Na(a,b)}}function Na(a,b){if(Ba.push(b),null===a._state){var c=a._lib&&Ua();b=Da(b),a._state=!1,a._value=b,I&&null!==b&&"object"==typeof b&&!b._promise&&v(function(){var c=m(b,"stack");b._promise=a,j(b,"stack",{get:function(){return va?c&&(c.get?c.get.apply(b):c.value):a.stack}})}),Ya(a),Oa(a),c&&Va()}}function Oa(a){var b=a._listeners;a._listeners=[];for(var c=0,d=b.length;c<d;++c)Pa(a,b[c]);var e=a._PSD;--e.ref||e.finalize(),0===Ha&&(++Ha,xa(function(){0===--Ha&&Wa()},[]))}function Pa(a,b){if(null===a._state)return void a._listeners.push(b);var c=a._state?b.onFulfilled:b.onRejected;return null===c?(a._state?b.resolve:b.reject)(a._value):(++b.psd.ref,++Ha,void xa(Qa,[c,a,b]))}function Qa(a,b,c){try{Ca=b;var d,e=b._value;b._state?d=a(e):(Ba.length&&(Ba=[]),d=a(e),Ba.indexOf(e)===-1&&Za(b)),c.resolve(d)}catch(a){c.reject(a)}finally{Ca=null,0===--Ha&&Wa(),--c.psd.ref||c.psd.finalize()}}function Ra(a,b,c){if(b.length===c)return b;var d="";if(a._state===!1){var f,g,e=a._value;null!=e?(f=e.name||"Error",g=e.message||e,d=N(e,0)):(f=e,g=""),b.push(f+(g?": "+g:"")+d)}return I&&(d=N(a._stackHolder,2),d&&b.indexOf(d)===-1&&b.push(d),a._prev&&Ra(a._prev,b,c)),b}function Sa(a,b){var c=b?b._numPrev+1:0;c<la&&(a._prev=b,a._numPrev=c)}function Ta(){Ua()&&Va()}function Ua(){var a=ya;return ya=!1,za=!1,a}function Va(){var a,b,c;do for(;Ga.length>0;)for(a=Ga,Ga=[],c=a.length,b=0;b<c;++b){var d=a[b];d[0].apply(null,d[1])}while(Ga.length>0);ya=!0,za=!0}function Wa(){var a=Aa;Aa=[],a.forEach(function(a){a._PSD.onunhandled.call(null,a._value,a)});for(var b=Ia.slice(0),c=b.length;c;)b[--c]()}function Xa(a){function b(){a(),Ia.splice(Ia.indexOf(b),1)}Ia.push(b),++Ha,xa(function(){0===--Ha&&Wa()},[])}function Ya(a){Aa.some(function(b){return b._value===a._value})||Aa.push(a)}function Za(a){for(var b=Aa.length;b;)if(Aa[--b]._value===a._value)return void Aa.splice(b,1)}function $a(a){return new Ja(ka,!1,a)}function _a(a,b){var c=Fa;return function(){var d=Ua(),e=Fa;try{return mb(c,!0),a.apply(this,arguments)}catch(a){b&&b(a)}finally{mb(e,!1),d&&Va()}}}function gb(a,b,c,e){var f=Fa,g=Object.create(f);g.parent=f,g.ref=0,g.global=!1,g.id=++fb;var h=Ea.env;g.env=sa?{Promise:Ja,all:Ja.all,race:Ja.race,resolve:Ja.resolve,reject:Ja.reject,nthen:rb(h.nthen,g),gthen:rb(h.gthen,g)}:{},b&&d(g,b),++f.ref,g.finalize=function(){--this.parent.ref||this.parent.finalize()};var i=ob(g,a,c,e);return 0===g.ref&&g.finalize(),i}function hb(){return ab.id||(ab.id=++bb),++ab.awaits,ab.echoes+=na,ab.id}function ib(a){!ab.awaits||a&&a!==ab.id||(0===--ab.awaits&&(ab.id=0),ab.echoes=ab.awaits*na)}function jb(a){return ab.echoes&&a&&a.constructor===ta?(hb(),a.then(function(a){return ib(),a},function(a){return ib(),ub(a)})):a}function kb(a){++eb,ab.echoes&&0!==--ab.echoes||(ab.echoes=ab.id=0),cb.push(Fa),mb(a,!0)}function lb(){var a=cb[cb.length-1];cb.pop(),mb(a,!1)}function mb(a,b){var d=Fa;if((b?!ab.echoes||db++&&a===Fa:!db||--db&&a===Fa)||pb(b?kb.bind(null,a):lb),a!==Fa){Fa=a,d===Ea&&(Ea.env=nb());var e=Ea.env.Promise;if(e){var f=a.env;qa.then=f.nthen,e.prototype.then=f.gthen,(d.global||a.global)&&(c.Promise=f.Promise,e.all=f.all,e.race=f.race,e.resolve=f.resolve,e.reject=f.reject)}}}function nb(){var a=c.Promise;return a?{Promise:a,all:a.all,race:a.race,resolve:a.resolve,reject:a.reject,nthen:qa.then,gthen:a.prototype.then}:{}}function ob(a,b,c,d,e){var f=Fa;try{return mb(a,!0),b(c,d,e)}finally{mb(f,!1)}}function pb(a){sa.call(pa,a)}function qb(a,b,c){return"function"!=typeof a?a:function(){var d=Fa;c&&hb(),mb(b,!0);try{return a.apply(this,arguments)}finally{mb(d,!1)}}}function rb(a,b){return function(c,d){return a.call(this,qb(c,b,!1),qb(d,b,!1))}}function tb(a,b){var e;try{e=b.onuncatched(a)}catch(a){}if(e!==!1)try{var f,g={promise:b,reason:a};if(c.document&&document.createEvent?(f=document.createEvent("Event"),f.initEvent(sb,!0,!0),d(f,g)):c.CustomEvent&&(f=new CustomEvent(sb,{detail:g}),d(f,g)),f&&c.dispatchEvent&&(dispatchEvent(f),!c.PromiseRejectionEvent&&c.onunhandledrejection))try{c.onunhandledrejection(f)}catch(a){}f.defaultPrevented||console.warn("Unhandled rejection: "+(a.stack||a))}catch(a){}}function vb(c){function h(a,b,c){if("object"==typeof a)return i(a);b||(b=ia),c||(c=ba);var f={subscribers:[],fire:c,subscribe:function(a){f.subscribers.indexOf(a)===-1&&(f.subscribers.push(a),f.fire=b(f.fire,a))},unsubscribe:function(a){f.subscribers=f.subscribers.filter(function(b){return b!==a}),f.fire=f.subscribers.reduce(b,c)}};return d[a]=e[a]=f,f}function i(c){a(c).forEach(function(a){var d=c[a];if(b(d))h(a,c[a][0],c[a][1]);else{if("asap"!==d)throw new Z.InvalidArgument("Invalid event config");var e=h(a,ca,function(){for(var b=arguments.length,c=new Array(b);b--;)c[b]=arguments[b];e.subscribers.forEach(function(a){s(function(){a.apply(null,c)})})})}})}var d={},e=function(a,b){if(b){for(var e=arguments.length,f=new Array(e-1);--e;)f[e-1]=arguments[e];return d[a].subscribe.apply(null,f),c}if("string"==typeof a)return d[a]};e.addEventType=h;for(var f=1,g=arguments.length;f<g;++f)h(arguments[f]);return e}function Gb(c,e){function _(){Q.on("versionchange",function(a){a.newVersion>0?console.warn("Another connection wants to upgrade database '"+Q.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+Q.name+"'. Closing db now to resume the delete request."),Q.close()}),Q.on("blocked",function(a){!a.newVersion||a.newVersion<a.oldVersion?console.warn("Dexie.delete('"+Q.name+"') was blocked"):console.warn("Upgrade '"+Q.name+"' blocked by other connection holding version "+a.oldVersion/10)})}function aa(a){this._cfg={version:a,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function ea(b,c,d){var e=Q._createTransaction(P,C,s);e.create(c),e._completion.catch(d);var f=e._reject.bind(e);gb(function(){Fa.trans=e,0===b?(a(s).forEach(function(a){la(c,a,s[a].primKey,s[a].indexes)}),Ja.follow(function(){return Q.on.populate.fire(e)}).catch(f)):ia(b,e,c).catch(f)})}function ia(a,b,c){function h(){return d.length?Ja.resolve(d.shift()(b.idbtrans)).then(h):Ja.resolve()}var d=[],e=y.filter(function(b){return b._cfg.version===a})[0];if(!e)throw new Z.Upgrade("Dexie specification of currently installed DB version is missing");s=Q._dbSchema=e._cfg.dbschema;var f=!1,g=y.filter(function(b){return b._cfg.version>a});return g.forEach(function(a){d.push(function(){var d=s,e=a._cfg.dbschema;Qa(d,c),Qa(e,c),s=Q._dbSchema=e;var g=ka(d,e);if(g.add.forEach(function(a){la(c,a[0],a[1].primKey,a[1].indexes)}),g.change.forEach(function(a){if(a.recreate)throw new Z.Upgrade("Not yet support for changing primary key");var b=c.objectStore(a.name);a.add.forEach(function(a){oa(b,a)}),a.change.forEach(function(a){b.deleteIndex(a.name),oa(b,a)}),a.del.forEach(function(a){b.deleteIndex(a)})}),a._cfg.contentUpgrade)return f=!0,Ja.follow(function(){a._cfg.contentUpgrade(b)})}),d.push(function(b){if(!f||!Db){var c=a._cfg.dbschema;na(c,b)}})}),h().then(function(){ma(s,c)})}function ka(a,b){var c={del:[],add:[],change:[]};for(var d in a)b[d]||c.del.push(d);for(d in b){var e=a[d],f=b[d];if(e){var g={name:d,def:f,recreate:!1,del:[],add:[],change:[]};if(e.primKey.src!==f.primKey.src)g.recreate=!0,c.change.push(g);else{var h=e.idxByName,i=f.idxByName;for(var j in h)i[j]||g.del.push(j);for(j in i){var k=h[j],l=i[j];k?k.src!==l.src&&g.change.push(l):g.add.push(l)}(g.del.length>0||g.add.length>0||g.change.length>0)&&c.change.push(g)}}else c.add.push([d,f])}return c}function la(a,b,c,d){var e=a.db.createObjectStore(b,c.keyPath?{keyPath:c.keyPath,autoIncrement:c.auto}:{autoIncrement:c.auto});return d.forEach(function(a){oa(e,a)}),e}function ma(b,c){a(b).forEach(function(a){c.db.objectStoreNames.contains(a)||la(c,a,b[a].primKey,b[a].indexes)})}function na(a,b){for(var c=0;c<b.db.objectStoreNames.length;++c){var d=b.db.objectStoreNames[c];null==a[d]&&b.db.deleteObjectStore(d)}}function oa(a,b){a.createIndex(b.name,b.keyPath,{unique:b.unique,multiEntry:b.multi})}function pa(a,b,c){if(L||Fa.letThrough){var d=Q._createTransaction(a,b,s).create();return d._promise(a,function(a,b){return gb(function(){return Fa.trans=d,c(a,b,d)})}).then(function(a){return d._completion.then(function(){return a})})}if(!K){if(!l)return ub(new Z.DatabaseClosed);Q.open().catch(ba)}return S.then(function(){return pa(a,b,c)})}function qa(a,b,c){var d=arguments.length;if(d<2)throw new Z.InvalidArgument("Too few arguments");for(var e=new Array(d-1);--d;)e[d-1]=arguments[d];c=e.pop();var f=H(e);return[a,f,c]}function ra(a,b){this.name=a,this.schema=b,this.hook=D[a]?D[a].hook:vb(null,{creating:[fa,ba],reading:[da,ca],updating:[ha,ba],deleting:[ga,ba]})}function sa(a,b,c){return(c?Ob:Mb)(function(c){a.push(c),b&&b()})}function va(a,b,c,d,e){return new Ja(function(f,g){var h=c.length,i=h-1;if(0===h)return f();if(d){var l,m=Ob(g),n=Lb(null);v(function(){for(var d=0;d<h;++d){l={onsuccess:null,onerror:null};var g=c[d];e.call(l,g[0],g[1],b);var j=a.delete(g[0]);j._hookCtx=l,j.onerror=m,d===i?j.onsuccess=Lb(f):j.onsuccess=n}},function(a){throw l.onerror&&l.onerror(a),a})}else for(var j=0;j<h;++j){var k=a.delete(c[j]);k.onerror=Mb(g),j===i&&(k.onsuccess=_a(function(){return f()}))}})}function wa(a,b,c,d){var e=this;this.db=Q,this.mode=a,this.storeNames=b,this.idbtrans=null,this.on=vb(this,"complete","error","abort"),this.parent=d||null,this.active=!0,this._tables=null,this._reculock=0,this._blockedFuncs=[],this._psd=null,this._dbschema=c,this._resolve=null,this._reject=null,this._completion=new Ja(function(a,b){e._resolve=a,e._reject=b}),this._completion.then(function(){e.on.complete.fire()},function(a){return e.on.error.fire(a),e.parent?e.parent._reject(a):e.active&&e.idbtrans&&e.idbtrans.abort(),e.active=!1,ub(a)})}function xa(a,b,c){this._ctx={table:a,index:":id"===b?null:b,or:c}}function ya(a,b){var c=null,d=null;if(b)try{c=b()}catch(a){d=a}var e=a._ctx,f=e.table;this._ctx={table:f,index:e.index,isPrimKey:!e.index||f.schema.primKey.keyPath&&e.index===f.schema.primKey.name,range:c,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:d,or:e.or,valueMapper:f.hook.reading.fire}}function za(a,b){return!(a.filter||a.algorithm||a.or)&&(b?a.justLimit:!a.replayFilter)}function Aa(a,b){return a._cfg.version-b._cfg.version}function Ba(a,b,c){b.forEach(function(b){var d=Q._tableFactory(P,c[b]);a.forEach(function(a){b in a||(a[b]=d)})})}function Ca(a){a.forEach(function(a){for(var b in a)a[b]instanceof ra&&delete a[b]})}function Da(a,b,c,d,e,f){var g=f?function(a,b,d){return c(f(a),b,d)}:c,h=_a(g,e);a.onerror||(a.onerror=Mb(e)),b?a.onsuccess=u(function(){var f=a.result;if(f){var g=function(){f.continue()};b(f,function(a){g=a},d,e)&&h(f.value,f,function(a){g=a}),g()}else d()},e):a.onsuccess=u(function(){var c=a.result;if(c){var e=function(){c.continue()};h(c.value,c,function(a){e=a}),e()}else d()},e)}function Ea(a){var c=[];return a.split(",").forEach(function(a){a=a.trim();var d=a.replace(/([&*]|\+\+)/g,""),e=/^\[/.test(d)?d.match(/^\[(.*)\]$/)[1].split("+"):d;c.push(new Sb(d,e||null,/\&/.test(a),/\*/.test(a),/\+\+/.test(a),b(e),/\./.test(a)))}),c}function Ga(a,b){return m.cmp(a,b)}function Ha(a,b){return Ga(a,b)<0?a:b}function Ia(a,b){return Ga(a,b)>0?a:b}function Ka(a,b){return m.cmp(a,b)}function La(a,b){return m.cmp(b,a)}function Ma(a,b){return a<b?-1:a===b?0:1}function Na(a,b){return a>b?-1:a===b?0:1}function Oa(a,b){return a?b?function(){return a.apply(this,arguments)&&b.apply(this,arguments)}:a:b}function Pa(){if(Q.verno=G.version/10,Q._dbSchema=s={},C=o(G.objectStoreNames,0),0!==C.length){var b=G.transaction(Vb(C),"readonly");C.forEach(function(a){for(var c=b.objectStore(a),d=c.keyPath,e=d&&"string"==typeof d&&d.indexOf(".")!==-1,f=new Sb(d,d||"",!1,!1,!!c.autoIncrement,d&&"string"!=typeof d,e),g=[],h=0;h<c.indexNames.length;++h){var i=c.index(c.indexNames[h]);d=i.keyPath,e=d&&"string"==typeof d&&d.indexOf(".")!==-1;var j=new Sb(i.name,d,!!i.unique,!!i.multiEntry,!1,d&&"string"!=typeof d,e);g.push(j)}s[a]=new Tb(a,f,g,{})}),Ba([D],a(s),s)}}function Qa(a,b){for(var c=b.db.objectStoreNames,d=0;d<c.length;++d){var e=c[d],f=b.objectStore(e);$="getAll"in f;for(var g=0;g<f.indexNames.length;++g){var h=f.indexNames[g],i=f.index(h).keyPath,j="string"==typeof i?i:"["+o(i).join("+")+"]";if(a[e]){var k=a[e].idxByName[j];k&&(k.name=h)}}}}function Ra(a){Q.on("blocked").fire(a),Bb.filter(function(a){return a.name===Q.name&&a!==Q&&!a._vcFired}).map(function(b){return b.on("versionchange").fire(a)})}var R,T,$,f=Gb.dependencies,i=d({addons:Gb.addons,autoOpen:!0,indexedDB:f.indexedDB,IDBKeyRange:f.IDBKeyRange},e),k=i.addons,l=i.autoOpen,m=i.indexedDB,n=i.IDBKeyRange,s=this._dbSchema={},y=[],C=[],D={},G=null,J=null,K=!1,L=!1,N="readonly",P="readwrite",Q=this,S=new Ja(function(a){R=a}),U=new Ja(function(a,b){T=b}),X=!0,Y=!!Wb(m);this.version=function(a){if(G||K)throw new Z.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,a);var b=y.filter(function(b){return b._cfg.version===a})[0];return b?b:(b=new aa(a),y.push(b),y.sort(Aa),b)},d(aa.prototype,{stores:function(b){this._cfg.storesSource=this._cfg.storesSource?d(this._cfg.storesSource,b):b;var c={};y.forEach(function(a){d(c,a._cfg.storesSource)});var e=this._cfg.dbschema={};return this._parseStoresSpec(c,e),s=Q._dbSchema=e,Ca([D,Q,wa.prototype]),Ba([D,Q,wa.prototype,this._cfg.tables],a(e),e),C=a(e),this},upgrade:function(b){var c=this;return Hb(function(){b(Q._createTransaction(P,a(c._cfg.dbschema),c._cfg.dbschema))}),this._cfg.contentUpgrade=b,this},_parseStoresSpec:function(b,c){a(b).forEach(function(a){if(null!==b[a]){var d={},e=Ea(b[a]),f=e.shift();if(f.multi)throw new Z.Schema("Primary key cannot be multi-valued");f.keyPath&&x(d,f.keyPath,f.auto?0:f.keyPath),e.forEach(function(a){if(a.auto)throw new Z.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new Z.Schema("Index must have a name and cannot be an empty string");x(d,a.keyPath,a.compound?a.keyPath.map(function(){return""}):"")}),c[a]=new Tb(a,f,e,d)}})}}),this._allTables=D,this._tableFactory=function(b,c){return new ra(c.name,c)},this._createTransaction=function(a,b,c,d){return new wa(a,b,c,d)},this._whenReady=function(a){return new Ja(Ib||L||Fa.letThrough?a:function(b,c){if(!K){if(!l)return void c(new Z.DatabaseClosed);Q.open().catch(ba)}S.then(function(){a(b,c)})})},this.verno=0,this.open=function(){if(K||G)return S.then(function(){return J?ub(J):Q});I&&(U._stackHolder=M()),K=!0,J=null,L=!1;var a=R,b=null;return Ja.race([U,new Ja(function(a,d){if(q(function(){return a()}),y.length>0&&(X=!1),!m)throw new Z.MissingAPI("indexedDB API not found. If using IE10+, make sure to run your code on a server URL (not locally). If using old Safari versions, make sure to include indexedDB polyfill.");var e=X?m.open(c):m.open(c,Math.round(10*Q.verno));if(!e)throw new Z.MissingAPI("IndexedDB API not available");e.onerror=Mb(d),e.onblocked=_a(Ra),e.onupgradeneeded=_a(function(a){if(b=e.transaction,X&&!Q._allowEmptyDB){e.onerror=Pb,b.abort(),e.result.close();var f=m.deleteDatabase(c);f.onsuccess=f.onerror=_a(function(){d(new Z.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{b.onerror=Mb(d);var g=a.oldVersion>Math.pow(2,62)?0:a.oldVersion;ea(g/10,b,d,e)}},d),e.onsuccess=_a(function(){if(b=null,G=e.result,Bb.push(Q),X)Pa();else if(G.objectStoreNames.length>0)try{Qa(s,G.transaction(Vb(G.objectStoreNames),N))}catch(a){}G.onversionchange=_a(function(a){Q._vcFired=!0,Q.on("versionchange").fire(a)}),Y||Qb(function(a){if(a.indexOf(c)===-1)return a.push(c)}),a()},d)})]).then(function(){return Gb.vip(Q.on.ready.fire)}).then(function(){return K=!1,Q}).catch(function(a){try{b&&b.abort()}catch(a){}return K=!1,Q.close(),J=a,ub(J)}).finally(function(){L=!0,a()})},this.close=function(){var a=Bb.indexOf(Q);if(a>=0&&Bb.splice(a,1),G){try{G.close()}catch(a){}G=null}l=!1,J=new Z.DatabaseClosed,K&&T(J),S=new Ja(function(a){R=a}),U=new Ja(function(a,b){T=b})},this.delete=function(){var a=arguments.length>0;return new Ja(function(b,d){function e(){Q.close();var a=m.deleteDatabase(c);a.onsuccess=_a(function(){Y||Qb(function(a){var b=a.indexOf(c);if(b>=0)return a.splice(b,1)}),b()}),a.onerror=Mb(d),a.onblocked=Ra}if(a)throw new Z.InvalidArgument("Arguments not allowed in db.delete()");K?S.then(e):e()})},this.backendDB=function(){return G},this.isOpen=function(){return null!==G},this.hasFailed=function(){return null!==J},this.dynamicallyOpened=function(){return X},this.name=c,j(this,"tables",{get:function(){return a(D).map(function(a){return D[a]})}}),this.on=vb(this,"populate","blocked","versionchange",{ready:[ja,ba]}),this.on.ready.subscribe=p(this.on.ready.subscribe,function(a){return function(b,c){Gb.vip(function(){L?(J||Ja.resolve().then(b),c&&a(b)):(a(b),c||a(function a(){Q.on.ready.unsubscribe(b),Q.on.ready.unsubscribe(a)}))})}}),Hb(function(){Q.on("populate").fire(Q._createTransaction(P,C,s))}),this.transaction=function(){var a=qa.apply(this,arguments);return this._transaction.apply(this,a)},this._transaction=function(a,b,c){function g(b){var e=Fa;b(Ja.resolve().then(function(){var b=Fa.transless||e,g=Q._createTransaction(a,f,s,d),h={trans:g,transless:b};d?g.idbtrans=d.idbtrans:g.create(),c.constructor===ua&&hb();var i,j=Ja.follow(function(){if(i=c.call(g,g))if(i.constructor===ta){var a=ib.bind(null,null);i.then(a,a)}else"function"==typeof i.next&&"function"==typeof i.throw&&(i=Rb(i))},h);return Ja.resolve(i).finally(function(){if(!g.active)throw new Z.PrematureCommit("Transaction committed too early. See http://bit.ly/2eVASrf")}).then(function(a){return j.then(function(){d&&g._resolve()}).then(function(){return g._completion}).then(function(){return a})}).catch(function(a){return g._reject(a),ub(a)})}))}var d=Fa.trans;d&&d.db===Q&&a.indexOf("!")===-1||(d=null);var e=a.indexOf("?")!==-1;a=a.replace("!","").replace("?","");try{var f=b.map(function(a){var b=a instanceof ra?a.name:a;if("string"!=typeof b)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return b});if("r"==a||a==N)a=N;else{if("rw"!=a&&a!=P)throw new Z.InvalidArgument("Invalid transaction mode: "+a);a=P}if(d){if(d.mode===N&&a===P){if(!e)throw new Z.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");d=null}d&&f.forEach(function(a){if(d&&d.storeNames.indexOf(a)===-1){if(!e)throw new Z.SubTransaction("Table "+a+" not included in parent transaction.");d=null}})}}catch(a){return d?d._promise(null,function(b,c){c(a)}):ub(a)}return d?d._promise(a,g,"lock"):Q._whenReady(g)},this.table=function(a){if(Ib&&X)return new ra(a);if(!g(D,a))throw new Z.InvalidTable("Table "+a+" does not exist");return D[a]},h(ra.prototype,{_trans:function(b,c,d){var e=Fa.trans;return e&&e.db===Q?e._promise(b,c,d):pa(b,[this.name],c)},_idbstore:function(b,c,d){function g(a,b,d){c(a,b,d.idbtrans.objectStore(f),d)}if(Ib)return new Ja(c);var e=Fa.trans,f=this.name;return e&&e.db===Q?e._promise(b,g,d):pa(b,[this.name],g)},get:function(a,b){var c=this;return this._idbstore(N,function(b,d,e){Ib&&b(c.schema.instanceTemplate);var f=e.get(a);f.onerror=Mb(d),f.onsuccess=_a(function(){b(c.hook.reading.fire(f.result))},d)}).then(b)},where:function(a){return new xa(this,a)},count:function(a){return this.toCollection().count(a)},offset:function(a){return this.toCollection().offset(a)},limit:function(a){return this.toCollection().limit(a)},reverse:function(){return this.toCollection().reverse()},filter:function(a){return this.toCollection().and(a)},each:function(a){return this.toCollection().each(a)},toArray:function(a){return this.toCollection().toArray(a)},orderBy:function(a){return new ya(new xa(this,a))},toCollection:function(){return new ya(new xa(this))},mapToClass:function(a,b){this.schema.mappedClass=a;var c=Object.create(a.prototype);b&&Kb(c,b),this.schema.instanceTemplate=c;var d=function(b){if(!b)return b;var c=Object.create(a.prototype);for(var d in b)if(g(b,d))try{c[d]=b[d]}catch(a){}return c};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=d,this.hook("reading",d),a},defineClass:function(a){return this.mapToClass(Gb.defineClass(a),a)},bulkDelete:function(a){return this.hook.deleting.fire===ba?this._idbstore(P,function(b,c,d,e){b(va(d,e,a,!1,ba))}):this.where(":id").anyOf(a).delete().then(function(){})},bulkPut:function(a,b){var c=this;return this._idbstore(P,function(d,e,f){if(!f.keyPath&&!c.schema.primKey.auto&&!b)throw new Z.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(f.keyPath&&b)throw new Z.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(b&&b.length!==a.length)throw new Z.InvalidArgument("Arguments objects and keys must have the same length");if(0===a.length)return d();var h,j,g=function(a){0===i.length?d(a):e(new W(c.name+".bulkPut(): "+i.length+" of "+k+" operations failed",i))},i=[],k=a.length,l=c;if(c.hook.creating.fire===ba&&c.hook.updating.fire===ba){j=sa(i);for(var m=0,n=a.length;m<n;++m)h=b?f.put(a[m],b[m]):f.put(a[m]),h.onerror=j;h.onerror=sa(i,g),h.onsuccess=Nb(g)}else{var o=b||f.keyPath&&a.map(function(a){return w(a,f.keyPath)}),p=o&&t(o,function(b,c){return null!=b&&[b,a[c]]}),q=o?l.where(":id").anyOf(o.filter(function(a){return null!=a})).modify(function(){this.value=p[this.primKey],p[this.primKey]=null}).catch(V,function(a){i=a.failures}).then(function(){for(var c=[],d=b&&[],e=o.length-1;e>=0;--e){var f=o[e];(null==f||p[f])&&(c.push(a[e]),b&&d.push(f),null!=f&&(p[f]=null))}return c.reverse(),b&&d.reverse(),l.bulkAdd(c,d)}).then(function(a){var b=o[o.length-1];return null!=b?b:a}):l.bulkAdd(a);q.then(g).catch(W,function(a){i=i.concat(a.failures),g()}).catch(e)}},"locked")},bulkAdd:function(a,b){var c=this,d=this.hook.creating.fire;return this._idbstore(P,function(e,f,g,h){function i(a){0===k.length?e(a):f(new W(c.name+".bulkAdd(): "+k.length+" of "+n+" operations failed",k))}if(!g.keyPath&&!c.schema.primKey.auto&&!b)throw new Z.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(g.keyPath&&b)throw new Z.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(b&&b.length!==a.length)throw new Z.InvalidArgument("Arguments objects and keys must have the same length");if(0===a.length)return e();var j,l,m,k=[],n=a.length;if(d!==ba){var p,o=g.keyPath;l=sa(k,null,!0),m=Lb(null),v(function(){for(var c=0,e=a.length;c<e;++c){p={onerror:null,onsuccess:null};var f=b&&b[c],i=a[c],k=b?f:o?w(i,o):void 0,n=d.call(p,k,i,h);null==k&&null!=n&&(o?(i=A(i),x(i,o,n)):f=n),j=null!=f?g.add(i,f):g.add(i),j._hookCtx=p,c<e-1&&(j.onerror=l,p.onsuccess&&(j.onsuccess=m))}},function(a){throw p.onerror&&p.onerror(a),a}),j.onerror=sa(k,i,!0),j.onsuccess=Lb(i)}else{l=sa(k);for(var q=0,r=a.length;q<r;++q)j=b?g.add(a[q],b[q]):g.add(a[q]),j.onerror=l;j.onerror=sa(k,i),j.onsuccess=Nb(i)}})},add:function(a,b){var c=this.hook.creating.fire;return this._idbstore(P,function(d,e,f,g){var h={onsuccess:null,onerror:null};if(c!==ba){var i=null!=b?b:f.keyPath?w(a,f.keyPath):void 0,j=c.call(h,i,a,g);null==i&&null!=j&&(f.keyPath?x(a,f.keyPath,j):b=j)}try{var k=null!=b?f.add(a,b):f.add(a);k._hookCtx=h,k.onerror=Ob(e),k.onsuccess=Lb(function(b){var c=f.keyPath;c&&x(a,c,b),d(b)})}catch(a){throw h.onerror&&h.onerror(a),a}})},put:function(a,b){var c=this,d=this.hook.creating.fire,e=this.hook.updating.fire;if(d!==ba||e!==ba){var f=this.schema.primKey.keyPath,g=void 0!==b?b:f&&w(a,f);return null==g?this.add(a):(a=A(a),this._trans(P,function(){return c.where(":id").equals(g).modify(function(){this.value=a}).then(function(d){return 0===d?c.add(a,b):g})},"locked"))}return this._idbstore(P,function(c,d,e){var f=void 0!==b?e.put(a,b):e.put(a);f.onerror=Mb(d),f.onsuccess=_a(function(b){var d=e.keyPath;d&&x(a,d,b.target.result),c(f.result)})})},delete:function(a){return this.hook.deleting.subscribers.length?this.where(":id").equals(a).delete():this._idbstore(P,function(b,c,d){var e=d.delete(a);e.onerror=Mb(c),e.onsuccess=_a(function(){b(e.result)})})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(P,function(a,b,c){var d=c.clear();d.onerror=Mb(b),d.onsuccess=_a(function(){a(d.result)})})},update:function(c,d){if("object"!=typeof d||b(d))throw new Z.InvalidArgument("Modifications must be an object.");if("object"!=typeof c||b(c))return this.where(":id").equals(c).modify(d);a(d).forEach(function(a){x(c,a,d[a])});var e=w(c,this.schema.primKey.keyPath);return void 0===e?ub(new Z.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(d)}}),h(wa.prototype,{_lock:function(){return r(!Fa.global),++this._reculock,1!==this._reculock||Fa.global||(Fa.lockOwnerFor=this),this},_unlock:function(){if(r(!Fa.global),0===--this._reculock)for(Fa.global||(Fa.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var a=this._blockedFuncs.shift();try{ob(a[1],a[0])}catch(a){}}return this},_locked:function(){return this._reculock&&Fa.lockOwnerFor!==this},create:function(a){var b=this;if(!this.mode)return this;if(r(!this.idbtrans),!a&&!G)switch(J&&J.name){case"DatabaseClosedError":throw new Z.DatabaseClosed(J);case"MissingAPIError":throw new Z.MissingAPI(J.message,J);default:throw new Z.OpenFailed(J)}if(!this.active)throw new Z.TransactionInactive;return r(null===this._completion._state),a=this.idbtrans=a||G.transaction(Vb(this.storeNames),this.mode),
-a.onerror=_a(function(c){Pb(c),b._reject(a.error)}),a.onabort=_a(function(a){Pb(a),b.active&&b._reject(new Z.Abort),b.active=!1,b.on("abort").fire(a)}),a.oncomplete=_a(function(){b.active=!1,b._resolve()}),this},_promise:function(a,b,c){var d=this;if(a===P&&this.mode!==P)return ub(new Z.ReadOnly("Transaction is readonly"));if(!this.active)return ub(new Z.TransactionInactive);if(this._locked())return new Ja(function(e,f){d._blockedFuncs.push([function(){d._promise(a,b,c).then(e,f)},Fa])});if(c)return gb(function(){var a=new Ja(function(a,c){d._lock();var e=b(a,c,d);e&&e.then&&e.then(a,c)});return a.finally(function(){return d._unlock()}),a._lib=!0,a});var e=new Ja(function(a,c){var e=b(a,c,d);e&&e.then&&e.then(a,c)});return e._lib=!0,e},abort:function(){this.active&&this._reject(new Z.Abort),this.active=!1},tables:{get:O("Transaction.tables",function(){return D})},table:O("Transaction.table()",function(a){return D[a]})}),h(xa.prototype,function(){function a(a,b,c){var d=a instanceof xa?new ya(a):a;return d._ctx.error=c?new c(b):new TypeError(b),d}function b(a){return new ya(a,function(){return n.only("")}).limit(0)}function c(a){return"next"===a?function(a){return a.toUpperCase()}:function(a){return a.toLowerCase()}}function d(a){return"next"===a?function(a){return a.toLowerCase()}:function(a){return a.toUpperCase()}}function e(a,b,c,d,e,f){for(var g=Math.min(a.length,d.length),h=-1,i=0;i<g;++i){var j=b[i];if(j!==d[i])return e(a[i],c[i])<0?a.substr(0,i)+c[i]+c.substr(i+1):e(a[i],d[i])<0?a.substr(0,i)+d[i]+c.substr(i+1):h>=0?a.substr(0,h)+b[h]+c.substr(h+1):null;e(a[i],j)<0&&(h=i)}return g<d.length&&"next"===f?a+c.substr(a.length):g<a.length&&"prev"===f?a.substr(0,c.length):h<0?null:a.substr(0,h)+d[h]+c.substr(h+1)}function f(b,f,g,h){function r(a){i=c(a),j=d(a),k="next"===a?Ma:Na;var b=g.map(function(a){return{lower:j(a),upper:i(a)}}).sort(function(a,b){return k(a.lower,b.lower)});l=b.map(function(a){return a.upper}),m=b.map(function(a){return a.lower}),o=a,p="next"===a?"":h}var i,j,k,l,m,o,p,q=g.length;if(!g.every(function(a){return"string"==typeof a}))return a(b,Ab);r("next");var s=new ya(b,function(){return n.bound(l[0],m[q-1]+h)});s._ondirectionchange=function(a){r(a)};var t=0;return s._addAlgorithm(function(a,b,c){var d=a.key;if("string"!=typeof d)return!1;var g=j(d);if(f(g,m,t))return!0;for(var h=null,i=t;i<q;++i){var n=e(d,g,l[i],m[i],k,o);null===n&&null===h?t=i+1:(null===h||k(h,n)>0)&&(h=n)}return b(null!==h?function(){a.continue(h+p)}:c),!1}),s}return{between:function(c,d,e,f){e=e!==!1,f=f===!0;try{return Ga(c,d)>0||0===Ga(c,d)&&(e||f)&&(!e||!f)?b(this):new ya(this,function(){return n.bound(c,d,!e,!f)})}catch(b){return a(this,zb)}},equals:function(a){return new ya(this,function(){return n.only(a)})},above:function(a){return new ya(this,function(){return n.lowerBound(a,!0)})},aboveOrEqual:function(a){return new ya(this,function(){return n.lowerBound(a)})},below:function(a){return new ya(this,function(){return n.upperBound(a,!0)})},belowOrEqual:function(a){return new ya(this,function(){return n.upperBound(a)})},startsWith:function(b){return"string"!=typeof b?a(this,Ab):this.between(b,b+xb,!0,!0)},startsWithIgnoreCase:function(a){return""===a?this.startsWith(a):f(this,function(a,b){return 0===a.indexOf(b[0])},[a],xb)},equalsIgnoreCase:function(a){return f(this,function(a,b){return a===b[0]},[a],"")},anyOfIgnoreCase:function(){var a=F.apply(E,arguments);return 0===a.length?b(this):f(this,function(a,b){return b.indexOf(a)!==-1},a,"")},startsWithAnyOfIgnoreCase:function(){var a=F.apply(E,arguments);return 0===a.length?b(this):f(this,function(a,b){return b.some(function(b){return 0===a.indexOf(b)})},a,xb)},anyOf:function(){var c=F.apply(E,arguments),d=Ka;try{c.sort(d)}catch(b){return a(this,zb)}if(0===c.length)return b(this);var e=new ya(this,function(){return n.bound(c[0],c[c.length-1])});e._ondirectionchange=function(a){d="next"===a?Ka:La,c.sort(d)};var f=0;return e._addAlgorithm(function(a,b,e){for(var g=a.key;d(g,c[f])>0;)if(++f,f===c.length)return b(e),!1;return 0===d(g,c[f])||(b(function(){a.continue(c[f])}),!1)}),e},notEqual:function(a){return this.inAnyRange([[-(1/0),a],[a,yb]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var b=F.apply(E,arguments);if(0===b.length)return new ya(this);try{b.sort(Ka)}catch(b){return a(this,zb)}var c=b.reduce(function(a,b){return a?a.concat([[a[a.length-1][1],b]]):[[-(1/0),b]]},null);return c.push([b[b.length-1],yb]),this.inAnyRange(c,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(c,d){function g(a,b){for(var c=0,d=a.length;c<d;++c){var e=a[c];if(Ga(b[0],e[1])<0&&Ga(b[1],e[0])>0){e[0]=Ha(e[0],b[0]),e[1]=Ia(e[1],b[1]);break}}return c===d&&a.push(b),a}function i(a,b){return h(a[0],b[0])}function o(a){return!l(a)&&!m(a)}if(0===c.length)return b(this);if(!c.every(function(a){return void 0!==a[0]&&void 0!==a[1]&&Ka(a[0],a[1])<=0}))return a(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",Z.InvalidArgument);var j,e=!d||d.includeLowers!==!1,f=d&&d.includeUppers===!0,h=Ka;try{j=c.reduce(g,[]),j.sort(i)}catch(b){return a(this,zb)}var k=0,l=f?function(a){return Ka(a,j[k][1])>0}:function(a){return Ka(a,j[k][1])>=0},m=e?function(a){return La(a,j[k][0])>0}:function(a){return La(a,j[k][0])>=0},p=l,q=new ya(this,function(){return n.bound(j[0][0],j[j.length-1][1],!e,!f)});return q._ondirectionchange=function(a){"next"===a?(p=l,h=Ka):(p=m,h=La),j.sort(i)},q._addAlgorithm(function(a,b,c){for(var d=a.key;p(d);)if(++k,k===j.length)return b(c),!1;return!!o(d)||0!==Ga(d,j[k][1])&&0!==Ga(d,j[k][0])&&(b(function(){h===Ka?a.continue(j[k][0]):a.continue(j[k][1])}),!1)}),q},startsWithAnyOf:function(){var c=F.apply(E,arguments);return c.every(function(a){return"string"==typeof a})?0===c.length?b(this):this.inAnyRange(c.map(function(a){return[a,a+xb]})):a(this,"startsWithAnyOf() only works with strings")}}}),h(ya.prototype,function(){function b(a,b){a.filter=Oa(a.filter,b)}function c(a,b,c){var d=a.replayFilter;a.replayFilter=d?function(){return Oa(d(),b())}:b,a.justLimit=c&&!d}function e(a,b){a.isMatch=Oa(a.isMatch,b)}function f(a,b){if(a.isPrimKey)return b;var c=a.table.schema.idxByName[a.index];if(!c)throw new Z.Schema("KeyPath "+a.index+" on object store "+b.name+" is not indexed");return b.index(c.name)}function h(a,b){var c=f(a,b);return a.keysOnly&&"openKeyCursor"in c?c.openKeyCursor(a.range||null,a.dir+a.unique):c.openCursor(a.range||null,a.dir+a.unique)}function i(a,b,c,d,e){var f=a.replayFilter?Oa(a.filter,a.replayFilter()):a.filter;a.or?function(){function k(){2===++j&&c()}function l(a,c,e){if(!f||f(c,e,k,d)){var h=c.primaryKey.toString();g(i,h)||(i[h]=!0,b(a,c,e))}}var i={},j=0;a.or._iterate(l,k,d,e),Da(h(a,e),a.algorithm,l,k,d,!a.keysOnly&&a.valueMapper)}():Da(h(a,e),Oa(a.algorithm,f),b,c,d,!a.keysOnly&&a.valueMapper)}function j(a){return a.table.schema.instanceTemplate}return{_read:function(a,b){var c=this._ctx;return c.error?c.table._trans(null,function(b,d){d(c.error)}):c.table._idbstore(N,a).then(b)},_write:function(a){var b=this._ctx;return b.error?b.table._trans(null,function(c,d){d(b.error)}):b.table._idbstore(P,a,"locked")},_addAlgorithm:function(a){var b=this._ctx;b.algorithm=Oa(b.algorithm,a)},_iterate:function(a,b,c,d){return i(this._ctx,a,b,c,d)},clone:function(a){var b=Object.create(this.constructor.prototype),c=Object.create(this._ctx);return a&&d(c,a),b._ctx=c,b},raw:function(){return this._ctx.valueMapper=null,this},each:function(a){var b=this._ctx;if(Ib){var c=j(b),d=b.table.schema.primKey.keyPath,e=w(c,b.index?b.table.schema.idxByName[b.index].keyPath:d),f=w(c,d);a(c,{key:e,primaryKey:f})}return this._read(function(c,d,e){i(b,a,c,d,e)})},count:function(a){if(Ib)return Ja.resolve(0).then(a);var b=this._ctx;if(za(b,!0))return this._read(function(a,c,d){var e=f(b,d),g=b.range?e.count(b.range):e.count();g.onerror=Mb(c),g.onsuccess=function(c){a(Math.min(c.target.result,b.limit))}},a);var c=0;return this._read(function(a,d,e){i(b,function(){return++c,!1},function(){a(c)},d,e)},a)},sortBy:function(a,b){function f(a,b){return b?f(a[c[b]],b-1):a[d]}function h(a,b){var c=f(a,e),d=f(b,e);return c<d?-g:c>d?g:0}var c=a.split(".").reverse(),d=c[0],e=c.length-1,g="next"===this._ctx.dir?1:-1;return this.toArray(function(a){return a.sort(h)}).then(b)},toArray:function(a){var b=this._ctx;return this._read(function(a,c,d){if(Ib&&a([j(b)]),$&&"next"===b.dir&&za(b,!0)&&b.limit>0){var e=b.table.hook.reading.fire,g=f(b,d),h=b.limit<1/0?g.getAll(b.range,b.limit):g.getAll(b.range);h.onerror=Mb(c),h.onsuccess=Nb(e===ca?a:function(b){try{a(b.map(e))}catch(a){c(a)}})}else{var k=[];i(b,function(a){k.push(a)},function(){a(k)},c,d)}},a)},offset:function(a){var b=this._ctx;return a<=0?this:(b.offset+=a,za(b)?c(b,function(){var b=a;return function(a,c){return 0===b||(1===b?(--b,!1):(c(function(){a.advance(b),b=0}),!1))}}):c(b,function(){var b=a;return function(){return--b<0}}),this)},limit:function(a){return this._ctx.limit=Math.min(this._ctx.limit,a),c(this._ctx,function(){var b=a;return function(a,c,d){return--b<=0&&c(d),b>=0}},!0),this},until:function(a,c){var d=this._ctx;return Ib&&a(j(d)),b(this._ctx,function(b,d,e){return!a(b.value)||(d(e),c)}),this},first:function(a){return this.limit(1).toArray(function(a){return a[0]}).then(a)},last:function(a){return this.reverse().first(a)},filter:function(a){return Ib&&a(j(this._ctx)),b(this._ctx,function(b){return a(b.value)}),e(this._ctx,a),this},and:function(a){return this.filter(a)},or:function(a){return new xa(this._ctx.table,a,this)},reverse:function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},desc:function(){return this.reverse()},eachKey:function(a){var b=this._ctx;return b.keysOnly=!b.isMatch,this.each(function(b,c){a(c.key,c)})},eachUniqueKey:function(a){return this._ctx.unique="unique",this.eachKey(a)},eachPrimaryKey:function(a){var b=this._ctx;return b.keysOnly=!b.isMatch,this.each(function(b,c){a(c.primaryKey,c)})},keys:function(a){var b=this._ctx;b.keysOnly=!b.isMatch;var c=[];return this.each(function(a,b){c.push(b.key)}).then(function(){return c}).then(a)},primaryKeys:function(a){var b=this._ctx;if($&&"next"===b.dir&&za(b,!0)&&b.limit>0)return this._read(function(a,c,d){var e=f(b,d),g=b.limit<1/0?e.getAllKeys(b.range,b.limit):e.getAllKeys(b.range);g.onerror=Mb(c),g.onsuccess=Nb(a)}).then(a);b.keysOnly=!b.isMatch;var c=[];return this.each(function(a,b){c.push(b.primaryKey)}).then(function(){return c}).then(a)},uniqueKeys:function(a){return this._ctx.unique="unique",this.keys(a)},firstKey:function(a){return this.limit(1).keys(function(a){return a[0]}).then(a)},lastKey:function(a){return this.reverse().firstKey(a)},distinct:function(){var a=this._ctx,c=a.index&&a.table.schema.idxByName[a.index];if(!c||!c.multi)return this;var d={};return b(this._ctx,function(a){var b=a.primaryKey.toString(),c=g(d,b);return d[b]=!0,!c}),this},modify:function(b){var c=this,e=this._ctx,f=e.table.hook,h=f.updating.fire,i=f.deleting.fire;return Ib&&"function"==typeof b&&b.call({value:e.table.schema.instanceTemplate},e.table.schema.instanceTemplate),this._write(function(e,f,j,k){function y(a,b){function d(a){return s.push(a),t.push(c.primKey),D(),!0}u=b.primaryKey;var c={primKey:b.primaryKey,value:a,onsuccess:null,onerror:null};if(l.call(c,a,c)!==!1){var e=!g(c,"value");++p,v(function(){var a=e?b.delete():b.update(c.value);a._hookCtx=c,a.onerror=Ob(d),a.onsuccess=Lb(function(){++q,D()})},d)}else c.onsuccess&&c.onsuccess(c.value)}function C(a){return a&&(s.push(a),t.push(u)),f(new V("Error modifying one or more objects",s,q,t))}function D(){r&&q+s.length===p&&(s.length>0?C():e(q))}var l;if("function"==typeof b)l=h===ba&&i===ba?b:function(c){var d=A(c);if(b.call(this,c,this)===!1)return!1;if(g(this,"value")){var e=B(d,this.value),f=h.call(this,e,this.primKey,d,k);f&&(c=this.value,a(f).forEach(function(a){x(c,a,f[a])}))}else i.call(this,this.primKey,c,k)};else if(h===ba){var m=a(b),n=m.length;l=function(a){for(var c=!1,d=0;d<n;++d){var e=m[d],f=b[e];w(a,e)!==f&&(x(a,e,f),c=!0)}return c}}else{var o=b;b=z(o),l=function(c){var e=!1,f=h.call(this,b,this.primKey,A(c),k);return f&&d(b,f),a(b).forEach(function(a){var d=b[a];w(c,a)!==d&&(x(c,a,d),e=!0)}),f&&(b=z(o)),e}}var p=0,q=0,r=!1,s=[],t=[],u=null;c.clone().raw()._iterate(y,function(){r=!0,D()},C,j)})},delete:function(){var a=this,b=this._ctx,c=b.range,d=b.table.hook.deleting.fire,e=d!==ba;if(!e&&za(b)&&(b.isPrimKey&&!Eb||!c))return this._write(function(a,b,d){var e=Mb(b),f=c?d.count(c):d.count();f.onerror=e,f.onsuccess=function(){var g=f.result;v(function(){var b=c?d.delete(c):d.clear();b.onerror=e,b.onsuccess=function(){return a(g)}},function(a){return b(a)})}});var f=e?2e3:1e4;return this._write(function(c,g,h,i){var j=0,k=a.clone({keysOnly:!b.isMatch&&!e}).distinct().limit(f).raw(),l=[],m=function(){return k.each(e?function(a,b){l.push([b.primaryKey,b.value])}:function(a,b){l.push(b.primaryKey)}).then(function(){return e?l.sort(function(a,b){return Ka(a[0],b[0])}):l.sort(Ka),va(h,i,l,e,d)}).then(function(){var a=l.length;return j+=a,l=[],a<f?j:m()})};c(m())})}}}),d(this,{Collection:ya,Table:ra,Transaction:wa,Version:aa,WhereClause:xa}),_(),k.forEach(function(a){a(Q)})}function Jb(a){if("function"==typeof a)return new a;if(b(a))return[Jb(a[0])];if(a&&"object"==typeof a){var c={};return Kb(c,a),c}return a}function Kb(b,c){return a(c).forEach(function(a){var d=Jb(c[a]);b[a]=d}),b}function Lb(a){return _a(function(b){var c=b.target,d=c.result,e=c._hookCtx,f=e&&e.onsuccess;f&&f(d),a&&a(d)},a)}function Mb(a){return _a(function(b){return Pb(b),a(b.target.error),!1})}function Nb(a){return _a(function(b){a(b.target.result)})}function Ob(a){return _a(function(b){var c=b.target,d=c.error,e=c._hookCtx,f=e&&e.onerror;return f&&f(d),Pb(b),a(d),!1})}function Pb(a){a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault()}function Qb(a){var b,c=Gb.dependencies.localStorage;if(!c)return a([]);try{b=JSON.parse(c.getItem("Dexie.DatabaseNames")||"[]")}catch(a){b=[]}a(b)&&c.setItem("Dexie.DatabaseNames",JSON.stringify(b))}function Rb(a){function g(a){return function(c){var d=a(c),g=d.value;return d.done?g:g&&"function"==typeof g.then?g.then(e,f):b(g)?Ja.all(g).then(e,f):e(g)}}var c=function(b){return a.next(b)},d=function(b){return a.throw(b)},e=g(c),f=g(d);return g(c)()}function Sb(a,b,c,d,e,f,g){this.name=a,this.keyPath=b,this.unique=c,this.multi=d,this.auto=e,this.compound=f,this.dotted=g;var h="string"==typeof b?b:b&&"["+[].join.call(b,"+")+"]";this.src=(c?"&":"")+(d?"*":"")+(e?"++":"")+h}function Tb(a,b,c,d){this.name=a,this.primKey=b||new Sb,this.indexes=c||[new Sb],this.instanceTemplate=d,this.mappedClass=null,this.idxByName=t(c,function(a){return[a.name,a]})}function Vb(a){return 1===a.length?a[0]:a}function Wb(a){var b=a&&(a.getDatabaseNames||a.webkitGetDatabaseNames);return b&&b.bind(a)}var a=Object.keys,b=Array.isArray,c="undefined"!=typeof self?self:"undefined"!=typeof window?window:global,e=Object.getPrototypeOf,f={}.hasOwnProperty,i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,n=[].slice,C="undefined"!=typeof Symbol&&Symbol.iterator,D=C?function(a){var b;return null!=a&&(b=a[C])&&b.apply(a)}:function(){return null},E={},G=[].concat,I="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),K=function(){return!0},L=!new Error("").stack,P=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Q=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],R=P.concat(Q),S={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};k(T).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+N(this._e,2))}},toString:function(){return this.name+": "+this.message}}),k(V).from(T),k(W).from(T);var X=R.reduce(function(a,b){return a[b]=b+"Error",a},{}),Y=T,Z=R.reduce(function(a,b){function d(a,d){this._e=M(),this.name=c,a?"string"==typeof a?(this.message=a,this.inner=d||null):"object"==typeof a&&(this.message=a.name+" "+a.message,this.inner=a):(this.message=S[b]||c,this.inner=null)}var c=b+"Error";return k(d).from(Y),a[b]=d,a},{});Z.Syntax=SyntaxError,Z.Type=TypeError,Z.Range=RangeError;var $=Q.reduce(function(a,b){return a[b+"Error"]=Z[b],a},{}),aa=R.reduce(function(a,b){return["Syntax","Type","Range"].indexOf(b)===-1&&(a[b+"Error"]=Z[b]),a},{});aa.ModifyError=V,aa.DexieError=T,aa.BulkError=W;var ka={},la=100,ma=20,na=7,oa=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(b){var a=c.Promise;return a?[a.resolve(),a.prototype,a.resolve()]:[]}}(),pa=oa[0],qa=oa[1],ra=oa[2],sa=qa&&qa.then,ta=pa&&pa.constructor,ua=oa[3],va=!1,wa=ra?function(){ra.then(Ta)}:c.setImmediate?setImmediate.bind(null,Ta):c.MutationObserver?function(){var a=document.createElement("div");new MutationObserver(function(){Ta(),a=null}).observe(a,{attributes:!0}),a.setAttribute("i","1")}:function(){setTimeout(Ta,0)},xa=function(a,b){Ga.push([a,b]),za&&(wa(),za=!1)},ya=!0,za=!0,Aa=[],Ba=[],Ca=null,Da=ca,Ea={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:tb,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(a){try{tb(a[0],a[1])}catch(a){}})}},Fa=Ea,Ga=[],Ha=0,Ia=[],Ka={get:function(){function c(c,d){var e=this,f=!a.global&&(a!==Fa||b!==eb);f&&ib();var g=new Ja(function(b,g){Pa(e,new La(qb(c,a,f),qb(d,a,f),b,g,a))});return I&&(!this._prev||null===this._state)&&Sa(g,this),g}var a=Fa,b=eb;return c._tQzo=!0,c},set:function(a){j(this,"then",a&&a._tQzo?Ka:{get:function(){return a},set:Ka.set})}};h(Ja.prototype,{then:Ka,_then:function(a,b){Pa(this,new La(null,null,a,b,Fa))},catch:function(a){if(1===arguments.length)return this.then(null,a);var b=arguments[0],c=arguments[1];return"function"==typeof b?this.then(null,function(a){return a instanceof b?c(a):$a(a)}):this.then(null,function(a){return a&&a.name===b?c(a):$a(a)})},finally:function(a){return this.then(function(b){return a(),b},function(b){return a(),$a(b)})},stack:{get:function(){if(this._stack)return this._stack;try{va=!0;var a=Ra(this,[],ma),b=a.join("\nFrom previous: ");return null!==this._state&&(this._stack=b),b}finally{va=!1}}}}),Ea.env=nb(),h(Ja,{all:function(){var a=F.apply(null,arguments).map(jb);return new Ja(function(b,c){0===a.length&&b([]);var d=a.length;a.forEach(function(e,f){return Ja.resolve(e).then(function(c){a[f]=c,--d||b(a)},c)})})},resolve:function(a){return a instanceof Ja?a:a&&"function"==typeof a.then?new Ja(function(b,c){a.then(b,c)}):new Ja(ka,!0,a)},reject:$a,race:function(){var a=F.apply(null,arguments).map(jb);return new Ja(function(b,c){a.map(function(a){return Ja.resolve(a).then(b,c)})})},PSD:{get:function(){return Fa},set:function(a){return Fa=a}},newPSD:gb,usePSD:ob,scheduler:{get:function(){return xa},set:function(a){xa=a}},rejectionMapper:{get:function(){return Da},set:function(a){Da=a}},follow:function(a,b){return new Ja(function(c,d){return gb(function(b,c){var d=Fa;d.unhandleds=[],d.onunhandled=c,d.finalize=ea(function(){var a=this;Xa(function(){0===a.unhandleds.length?b():c(a.unhandleds[0])})},d.finalize),a()},b,c,d)})}});var ab={awaits:0,echoes:0,id:0},bb=0,cb=[],db=0,eb=0,fb=0,sb="unhandledrejection";q(function(){xa=function(a,b){setTimeout(function(){a.apply(null,b)},0)}});var ub=Ja.reject,wb="2.0.0-beta.4",xb=String.fromCharCode(65535),yb=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(a){return xb}}(),zb="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Ab="String expected.",Bb=[],Cb="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Db=Cb,Eb=Cb,Fb=function(a){return!/(dexie\.js|dexie\.min\.js)/.test(a)};J(I,Fb);var Hb=function(){},Ib=!1,Ub=c.idbModules&&c.idbModules.shimIndexedDB?c.idbModules:{};return h(Gb,aa),h(Gb,{delete:function(a){var b=new Gb(a),c=b.delete();return c.onblocked=function(a){return b.on("blocked",a),this},c},exists:function(a){return new Gb(a).open().then(function(a){return a.close(),!0}).catch(Gb.NoSuchDatabaseError,function(){return!1})},getDatabaseNames:function(a){return new Ja(function(a,b){var c=Wb(indexedDB);if(c){var d=c();d.onsuccess=function(b){a(o(b.target.result,0))},d.onerror=Mb(b)}else Qb(function(b){return a(b),!1})}).then(a)},defineClass:function(a){function b(b){b?d(this,b):Ib&&Kb(this,a)}return b},applyStructure:Kb,ignoreTransaction:function(a){return Fa.trans?ob(Fa.transless,a):a()},vip:function(a){return gb(function(){return Fa.letThrough=!0,a()})},async:function(a){return function(){try{var b=Rb(a.apply(this,arguments));return b&&"function"==typeof b.then?b:Ja.resolve(b)}catch(a){return ub(a)}}},spawn:function(a,b,c){try{var d=Rb(a.apply(c,b||[]));return d&&"function"==typeof d.then?d:Ja.resolve(d)}catch(a){return ub(a)}},currentTransaction:{get:function(){return Fa.trans||null}},Promise:Ja,debug:{get:function(){return I},set:function(a){J(a,"dexie"===a?function(){return!0}:Fb)}},derive:k,extend:d,props:h,override:p,Events:vb,getByKeyPath:w,setByKeyPath:x,delByKeyPath:y,shallowClone:z,deepClone:A,getObjectDiff:B,asap:s,maxKey:yb,addons:[],connections:Bb,MultiModifyError:Z.Modify,errnames:X,IndexSpec:Sb,TableSchema:Tb,dependencies:{indexedDB:Ub.shimIndexedDB||c.indexedDB||c.mozIndexedDB||c.webkitIndexedDB||c.msIndexedDB,IDBKeyRange:Ub.IDBKeyRange||c.IDBKeyRange||c.webkitIDBKeyRange},semVer:wb,version:wb.split(".").map(function(a){return parseInt(a)}).reduce(function(a,b,c){return a+b/Math.pow(10,2*c)}),fakeAutoComplete:Hb,default:Gb}),v(function(){Gb.dependencies.localStorage=null!=("undefined"!=typeof chrome&&null!==chrome?chrome.storage:void 0)?null:c.localStorage}),Ja.rejectionMapper=_,q(function(){Gb.fakeAutoComplete=Hb=q,Gb.fake=Ib=!0}),Gb}); \ No newline at end of file
+!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.Dexie=t()}(this,function(){"use strict";function n(n,t){return"object"!=typeof t?n:(Cn(t).forEach(function(e){n[e]=t[e]}),n)}function t(n,t){return Fn.call(n,t)}function e(n,t){"function"==typeof t&&(t=t(Bn(n))),Cn(t).forEach(function(e){r(n,e,t[e])})}function r(e,r,i,o){Mn(e,r,n(i&&t(i,"get")&&"function"==typeof i.get?{get:i.get,set:i.set,configurable:!0}:{value:i,configurable:!0,writable:!0},o))}function i(n){return{from:function(t){return n.prototype=Object.create(t.prototype),r(n.prototype,"constructor",n),{extend:e.bind(null,n.prototype)}}}}function o(n,t){var e,r=Nn(n,t);return r||(e=Bn(n))&&o(e,t)}function u(n,t,e){return qn.call(n,t,e)}function a(n,t){return t(n)}function c(n){var t=setTimeout(n,1e3);clearTimeout(t)}function s(n){if(!n)throw new Error("Assertion Failed")}function f(n){Kn.setImmediate?setImmediate(n):setTimeout(n,0)}function l(n,t){return n.reduce(function(n,e,r){var i=t(e,r);return i&&(n[i[0]]=i[1]),n},{})}function h(n,t){return function(){try{n.apply(this,arguments)}catch(n){t(n)}}}function d(n,t,e){try{n.apply(null,e)}catch(n){t&&t(n)}}function v(n,e){if(t(n,e))return n[e];if(!e)return n;if("string"!=typeof e){for(var r=[],i=0,o=e.length;i<o;++i){var u=v(n,e[i]);r.push(u)}return r}var a=e.indexOf(".");if(a!==-1){var c=n[e.substr(0,a)];return void 0===c?void 0:v(c,e.substr(a+1))}}function p(n,t,e){if(n&&void 0!==t&&!("isFrozen"in Object&&Object.isFrozen(n)))if("string"!=typeof t&&"length"in t){s("string"!=typeof e&&"length"in e);for(var r=0,i=t.length;r<i;++r)p(n,t[r],e[r])}else{var o=t.indexOf(".");if(o!==-1){var u=t.substr(0,o),a=t.substr(o+1);if(""===a)void 0===e?delete n[u]:n[u]=e;else{var c=n[u];c||(c=n[u]={}),p(c,a,e)}}else void 0===e?delete n[t]:n[t]=e}}function y(n,t){"string"==typeof t?p(n,t,void 0):"length"in t&&[].map.call(t,function(t){p(n,t,void 0)})}function m(n){var e={};for(var r in n)t(n,r)&&(e[r]=n[r]);return e}function g(n){return Rn.apply([],n)}function b(n){if(!n||"object"!=typeof n)return n;var e;if(Tn(n)){e=[];for(var r=0,i=n.length;r<i;++r)e.push(b(n[r]))}else if(Un.indexOf(n.constructor)>=0)e=n;else{e=n.constructor?Object.create(n.constructor.prototype):{};for(var o in n)t(n,o)&&(e[o]=b(n[o]))}return e}function w(n,e,r,i){return r=r||{},i=i||"",Cn(n).forEach(function(o){if(t(e,o)){var u=n[o],a=e[o];"object"==typeof u&&"object"==typeof a&&u&&a&&u.constructor===a.constructor?w(u,a,r,i+o+"."):u!==a&&(r[i+o]=e[o])}else r[i+o]=void 0}),Cn(e).forEach(function(o){t(n,o)||(r[i+o]=e[o])}),r}function _(n){var t,e,r,i;if(1===arguments.length){if(Tn(n))return n.slice();if(this===Ln&&"string"==typeof n)return[n];if(i=zn(n)){for(e=[];r=i.next(),!r.done;)e.push(r.value);return e}if(null==n)return[n];if(t=n.length,"number"==typeof t){for(e=new Array(t);t--;)e[t]=n[t];return e}return[n]}for(t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return e}function k(n,t){Wn=n,Qn=t}function x(){if(Hn)try{throw x.arguments,new Error}catch(n){return n}return new Error}function j(n,t){var e=n.stack;return e?(t=t||0,0===e.indexOf(n.name)&&(t+=(n.name+n.message).split("\n").length),e.split("\n").slice(t).filter(Qn).map(function(n){return"\n"+n}).join("")):""}function E(n,t){return function(){return console.warn(n+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+j(x(),1)),t.apply(this,arguments)}}function P(n,t){this._e=x(),this.name=n,this.message=t}function A(n,t){return n+". Errors: "+t.map(function(n){return n.toString()}).filter(function(n,t,e){return e.indexOf(n)===t}).join("\n")}function O(n,t,e,r){this._e=x(),this.failures=t,this.failedKeys=r,this.successCount=e}function S(n,t){this._e=x(),this.name="BulkError",this.failures=t,this.message=A(n,t)}function I(n,t){if(!n||n instanceof P||n instanceof TypeError||n instanceof SyntaxError||!n.name||!tt[n.name])return n;var e=new tt[n.name](t||n.message,n);return"stack"in n&&r(e,"stack",{get:function(){return this.inner.stack}}),e}function D(){}function C(n){return n}function T(n,t){return null==n||n===C?t:function(e){return t(n(e))}}function K(n,t){return function(){n.apply(this,arguments),t.apply(this,arguments)}}function B(n,t){return n===D?t:function(){var e=n.apply(this,arguments);void 0!==e&&(arguments[0]=e);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?K(r,this.onsuccess):r),i&&(this.onerror=this.onerror?K(i,this.onerror):i),void 0!==o?o:e}}function F(n,t){return n===D?t:function(){n.apply(this,arguments);var e=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),e&&(this.onsuccess=this.onsuccess?K(e,this.onsuccess):e),r&&(this.onerror=this.onerror?K(r,this.onerror):r)}}function M(t,e){return t===D?e:function(r){var i=t.apply(this,arguments);n(r,i);var o=this.onsuccess,u=this.onerror;this.onsuccess=null,this.onerror=null;var a=e.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?K(o,this.onsuccess):o),u&&(this.onerror=this.onerror?K(u,this.onerror):u),void 0===i?void 0===a?void 0:a:n(i,a)}}function N(n,t){return n===D?t:function(){return t.apply(this,arguments)!==!1&&n.apply(this,arguments)}}function q(n,t){return n===D?t:function(){var e=n.apply(this,arguments);if(e&&"function"==typeof e.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return e.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}function R(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=D,this._lib=!1;var t=this._PSD=Et;if(Wn&&(this._stackHolder=x(),this._prev=null,this._numPrev=0),"function"!=typeof n){if(n!==rt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&z(this,this._value))}this._state=null,this._value=null,++t.ref,V(this,n)}function U(n,t,e,r,i){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=r,this.psd=i}function V(n,t){try{t(function(t){if(null===n._state){if(t===n)throw new TypeError("A promise cannot be resolved with itself.");var e=n._lib&&Y();t&&"function"==typeof t.then?V(n,function(n,e){t instanceof R?t._then(n,e):t.then(n,e)}):(n._state=!0,n._value=t,L(n)),e&&$()}},z.bind(null,n))}catch(t){z(n,t)}}function z(n,t){if(_t.push(t),null===n._state){var e=n._lib&&Y();t=xt(t),n._state=!1,n._value=t,Wn&&null!==t&&"object"==typeof t&&!t._promise&&d(function(){var e=o(t,"stack");t._promise=n,r(t,"stack",{get:function(){return pt?e&&(e.get?e.get.apply(t):e.value):n.stack}})}),nn(n),L(n),e&&$()}}function L(n){var t=n._listeners;n._listeners=[];for(var e=0,r=t.length;e<r;++e)W(n,t[e]);var i=n._PSD;--i.ref||i.finalize(),0===At&&(++At,mt(function(){0===--At&&X()},[]))}function W(n,t){if(null===n._state)return void n._listeners.push(t);var e=n._state?t.onFulfilled:t.onRejected;return null===e?(n._state?t.resolve:t.reject)(n._value):(++t.psd.ref,++At,void mt(Q,[e,n,t]))}function Q(n,t,e){try{kt=t;var r,i=t._value;t._state?r=n(i):(_t.length&&(_t=[]),r=n(i),_t.indexOf(i)===-1&&tn(t)),e.resolve(r)}catch(n){e.reject(n)}finally{kt=null,0===--At&&X(),--e.psd.ref||e.psd.finalize()}}function H(n,t,e){if(t.length===e)return t;var r="";if(n._state===!1){var i,o,u=n._value;null!=u?(i=u.name||"Error",o=u.message||u,r=j(u,0)):(i=u,o=""),t.push(i+(o?": "+o:"")+r)}return Wn&&(r=j(n._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),n._prev&&H(n._prev,t,e)),t}function G(n,t){var e=t?t._numPrev+1:0;e<it&&(n._prev=t,n._numPrev=e)}function J(){Y()&&$()}function Y(){var n=gt;return gt=!1,bt=!1,n}function $(){var n,t,e;do for(;Pt.length>0;)for(n=Pt,Pt=[],e=n.length,t=0;t<e;++t){var r=n[t];r[0].apply(null,r[1])}while(Pt.length>0);gt=!0,bt=!0}function X(){var n=wt;wt=[],n.forEach(function(n){n._PSD.onunhandled.call(null,n._value,n)});for(var t=Ot.slice(0),e=t.length;e;)t[--e]()}function Z(n){function t(){n(),Ot.splice(Ot.indexOf(t),1)}Ot.push(t),++At,mt(function(){0===--At&&X()},[])}function nn(n){wt.some(function(t){return t._value===n._value})||wt.push(n)}function tn(n){for(var t=wt.length;t;)if(wt[--t]._value===n._value)return void wt.splice(t,1)}function en(n){return new R(rt,!1,n)}function rn(n,t){var e=Et;return function(){var r=Y(),i=Et;try{return ln(e,!0),n.apply(this,arguments)}catch(n){t&&t(n)}finally{ln(i,!1),r&&$()}}}function on(t,e,r,i){var o=Et,u=Object.create(o);u.parent=o,u.ref=0,u.global=!1,u.id=++Bt;var a=jt.env;u.env=vt?{Promise:R,all:R.all,race:R.race,resolve:R.resolve,reject:R.reject,nthen:yn(a.nthen,u),gthen:yn(a.gthen,u)}:{},e&&n(u,e),++o.ref,u.finalize=function(){--this.parent.ref||this.parent.finalize()};var c=dn(u,t,r,i);return 0===u.ref&&u.finalize(),c}function un(){return It.id||(It.id=++Dt),++It.awaits,It.echoes+=ut,It.id}function an(n){!It.awaits||n&&n!==It.id||(0===--It.awaits&&(It.id=0),It.echoes=It.awaits*ut)}function cn(n){return It.echoes&&n&&n.constructor===ht?(un(),n.then(function(n){return an(),n},function(n){return an(),Nt(n)})):n}function sn(n){++Kt,It.echoes&&0!==--It.echoes||(It.echoes=It.id=0),Ct.push(Et),ln(n,!0)}function fn(){var n=Ct[Ct.length-1];Ct.pop(),ln(n,!1)}function ln(n,t){var e=Et;if((t?!It.echoes||Tt++&&n===Et:!Tt||--Tt&&n===Et)||vn(t?sn.bind(null,n):fn),n!==Et&&(Et=n,e===jt&&(jt.env=hn()),vt)){var r=jt.env.Promise,i=n.env;st.then=i.nthen,r.prototype.then=i.gthen,(e.global||n.global)&&(Kn.Promise=i.Promise,r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject)}}function hn(){var n=Kn.Promise;return vt?{Promise:n,all:n.all,race:n.race,resolve:n.resolve,reject:n.reject,nthen:st.then,gthen:n.prototype.then}:{}}function dn(n,t,e,r,i){var o=Et;try{return ln(n,!0),t(e,r,i)}finally{ln(o,!1)}}function vn(n){lt.call(ct,n)}function pn(n,t,e){return"function"!=typeof n?n:function(){var r=Et;e&&un(),ln(t,!0);try{return n.apply(this,arguments)}finally{ln(r,!1)}}}function yn(n,t){return function(e,r){return n.call(this,pn(e,t,!1),pn(r,t,!1))}}function mn(t,e){var r;try{r=e.onuncatched(t)}catch(n){}if(r!==!1)try{var i,o={promise:e,reason:t};if(Kn.document&&document.createEvent?(i=document.createEvent("Event"),i.initEvent(Ft,!0,!0),n(i,o)):Kn.CustomEvent&&(i=new CustomEvent(Ft,{detail:o}),n(i,o)),i&&Kn.dispatchEvent&&(dispatchEvent(i),!Kn.PromiseRejectionEvent&&Kn.onunhandledrejection))try{Kn.onunhandledrejection(i)}catch(n){}i.defaultPrevented||console.warn("Unhandled rejection: "+(t.stack||t))}catch(n){}}function gn(n){function t(n,t,o){if("object"==typeof n)return e(n);t||(t=N),o||(o=D);var u={subscribers:[],fire:o,subscribe:function(n){u.subscribers.indexOf(n)===-1&&(u.subscribers.push(n),u.fire=t(u.fire,n))},unsubscribe:function(n){u.subscribers=u.subscribers.filter(function(t){return t!==n}),u.fire=u.subscribers.reduce(t,o)}};return r[n]=i[n]=u,u}function e(n){Cn(n).forEach(function(e){var r=n[e];if(Tn(r))t(e,n[e][0],n[e][1]);else{if("asap"!==r)throw new nt.InvalidArgument("Invalid event config");var i=t(e,C,function(){for(var n=arguments.length,t=new Array(n);n--;)t[n]=arguments[n];i.subscribers.forEach(function(n){f(function(){n.apply(null,t)})})})}})}var r={},i=function(t,e){if(e){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return r[t].subscribe.apply(null,o),n}if("string"==typeof t)return r[t]};i.addEventType=t;for(var o=1,u=arguments.length;o<u;++o)t(arguments[o]);return i}function bn(i,o){function f(){et.on("versionchange",function(n){n.newVersion>0?console.warn("Another connection wants to upgrade database '"+et.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+et.name+"'. Closing db now to resume the delete request."),et.close()}),et.on("blocked",function(n){!n.newVersion||n.newVersion<n.oldVersion?console.warn("Dexie.delete('"+et.name+"') was blocked"):console.warn("Upgrade '"+et.name+"' blocked by other connection holding version "+n.oldVersion/10)})}function y(n){this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function k(n,t,e){var r=et._createTransaction(tt,Qn,Vn);r.create(t),r._completion.catch(e);var i=r._reject.bind(r);on(function(){Et.trans=r,0===n?(Cn(Vn).forEach(function(n){A(t,n,Vn[n].primKey,Vn[n].indexes)}),R.follow(function(){return et.on.populate.fire(r)}).catch(i)):j(n,r,t).catch(i)})}function j(n,t,e){function r(){return i.length?R.resolve(i.shift()(t.idbtrans)).then(r):R.resolve()}var i=[],o=zn.filter(function(t){return t._cfg.version===n})[0];if(!o)throw new nt.Upgrade("Dexie specification of currently installed DB version is missing");Vn=et._dbSchema=o._cfg.dbschema;var u=!1,a=zn.filter(function(t){return t._cfg.version>n});return a.forEach(function(n){i.push(function(){var r=Vn,i=n._cfg.dbschema;yn(r,e),yn(i,e),Vn=et._dbSchema=i;var o=P(r,i);if(o.add.forEach(function(n){A(e,n[0],n[1].primKey,n[1].indexes)}),o.change.forEach(function(n){if(n.recreate)throw new nt.Upgrade("Not yet support for changing primary key");var t=e.objectStore(n.name);n.add.forEach(function(n){N(t,n)}),n.change.forEach(function(n){t.deleteIndex(n.name),N(t,n)}),n.del.forEach(function(n){t.deleteIndex(n)})}),n._cfg.contentUpgrade)return u=!0,R.follow(function(){n._cfg.contentUpgrade(t)})}),i.push(function(t){if(!u||!Ht){var e=n._cfg.dbschema;K(e,t)}})}),r().then(function(){I(Vn,e)})}function P(n,t){var e={del:[],add:[],change:[]};for(var r in n)t[r]||e.del.push(r);for(r in t){var i=n[r],o=t[r];if(i){var u={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(i.primKey.src!==o.primKey.src)u.recreate=!0,e.change.push(u);else{var a=i.idxByName,c=o.idxByName;for(var s in a)c[s]||u.del.push(s);for(s in c){var f=a[s],l=c[s];f?f.src!==l.src&&u.change.push(l):u.add.push(l)}(u.del.length>0||u.add.length>0||u.change.length>0)&&e.change.push(u)}}else e.add.push([r,o])}return e}function A(n,t,e,r){var i=n.db.createObjectStore(t,e.keyPath?{keyPath:e.keyPath,autoIncrement:e.auto}:{autoIncrement:e.auto});return r.forEach(function(n){N(i,n)}),i}function I(n,t){Cn(n).forEach(function(e){t.db.objectStoreNames.contains(e)||A(t,e,n[e].primKey,n[e].indexes)})}function K(n,t){for(var e=0;e<t.db.objectStoreNames.length;++e){var r=t.db.objectStoreNames[e];null==n[r]&&t.db.deleteObjectStore(r)}}function N(n,t){n.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function U(n,t,e){if(Xn||Et.letThrough){var r=et._createTransaction(n,t,Vn);try{r.create()}catch(n){return Nt(n)}return r._promise(n,function(n,t){return on(function(){return Et.trans=r,e(n,t,r)})}).then(function(n){return r._completion.then(function(){return n})})}if(!Yn){if(!qn)return Nt(new nt.DatabaseClosed);et.open().catch(D)}return rt.then(function(){return U(n,t,e)})}function V(n,t,e){var r=arguments.length;if(r<2)throw new nt.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];e=i.pop();var o=g(i);return[n,o,e]}function z(n,t,e){this.name=n,this.schema=t,this._tx=e,this.hook=Hn[n]?Hn[n].hook:gn(null,{creating:[B,D],reading:[T,C],updating:[M,D],deleting:[F,D]})}function L(n,t,e){return(e?En:xn)(function(e){n.push(e),t&&t()})}function W(n,t,e,r,i){return new R(function(o,u){var a=e.length,c=a-1;if(0===a)return o();if(r){var s,f=En(u),l=kn(null);d(function(){for(var r=0;r<a;++r){s={onsuccess:null,onerror:null};var u=e[r];i.call(s,u[0],u[1],t);var h=n.delete(u[0]);h._hookCtx=s,h.onerror=f,r===c?h.onsuccess=kn(o):h.onsuccess=l}},function(n){throw s.onerror&&s.onerror(n),n})}else for(var h=0;h<a;++h){var v=n.delete(e[h]);v.onerror=xn(u),h===c&&(v.onsuccess=rn(function(){return o()}))}})}function Q(n,t,e,r){var i=this;this.db=et,this.mode=n,this.storeNames=t,this.idbtrans=null,this.on=gn(this,"complete","error","abort"),this.parent=r||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 R(function(n,t){i._resolve=n,i._reject=t}),this._completion.then(function(){i.active=!1,i.on.complete.fire()},function(n){var t=i.active;return i.active=!1,i.on.error.fire(n),i.parent?i.parent._reject(n):t&&i.idbtrans&&i.idbtrans.abort(),Nt(n)})}function H(n,t,e){this._ctx={table:n,index:":id"===t?null:t,or:e}}function G(n,t){var e=null,r=null;if(t)try{e=t()}catch(n){r=n}var i=n._ctx,o=i.table;this._ctx={table:o,index:i.index,isPrimKey:!i.index||o.schema.primKey.keyPath&&i.index===o.schema.primKey.name,range:e,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:o.hook.reading.fire}}function J(n,t){return!(n.filter||n.algorithm||n.or)&&(t?n.justLimit:!n.replayFilter)}function Y(n,t){return n._cfg.version-t._cfg.version}function $(n,t,e){t.forEach(function(t){var i=e[t];n.forEach(function(n){t in n||(n===Q.prototype||n instanceof Q?r(n,t,{get:function(){return this.table(t)}}):n[t]=new z(t,i))})})}function X(n){n.forEach(function(n){for(var t in n)n[t]instanceof z&&delete n[t]})}function Z(n,t,e,r,i,o){var u=o?function(n,t,r){return e(o(n),t,r)}:e,a=rn(u,i);n.onerror||(n.onerror=xn(i)),t?n.onsuccess=h(function(){var e=n.result;if(e){var o=function(){e.continue()};t(e,function(n){o=n},r,i)&&a(e.value,e,function(n){o=n}),o()}else r()},i):n.onsuccess=h(function(){var t=n.result;if(t){var e=function(){t.continue()};a(t.value,t,function(n){e=n}),e()}else r()},i)}function nn(n){var t=[];return n.split(",").forEach(function(n){n=n.trim();var e=n.replace(/([&*]|\+\+)/g,""),r=/^\[/.test(e)?e.match(/^\[(.*)\]$/)[1].split("+"):e;t.push(new On(e,r||null,/\&/.test(n),/\*/.test(n),/\+\+/.test(n),Tn(r),/\./.test(n)))}),t}function tn(n,t){return Rn.cmp(n,t)}function en(n,t){return tn(n,t)<0?n:t}function cn(n,t){return tn(n,t)>0?n:t}function sn(n,t){return Rn.cmp(n,t)}function fn(n,t){return Rn.cmp(t,n)}function ln(n,t){return n<t?-1:n===t?0:1}function hn(n,t){return n>t?-1:n===t?0:1}function vn(n,t){return n?t?function(){return n.apply(this,arguments)&&t.apply(this,arguments)}:n:t}function pn(){if(et.verno=Gn.version/10,et._dbSchema=Vn={},Qn=u(Gn.objectStoreNames,0),0!==Qn.length){var n=Gn.transaction(In(Qn),"readonly");Qn.forEach(function(t){for(var e=n.objectStore(t),r=e.keyPath,i=r&&"string"==typeof r&&r.indexOf(".")!==-1,o=new On(r,r||"",!1,!1,!!e.autoIncrement,r&&"string"!=typeof r,i),u=[],a=0;a<e.indexNames.length;++a){var c=e.index(e.indexNames[a]);r=c.keyPath,i=r&&"string"==typeof r&&r.indexOf(".")!==-1;var s=new On(c.name,r,!!c.unique,!!c.multiEntry,!1,r&&"string"!=typeof r,i);u.push(s)}Vn[t]=new Sn(t,o,u,{})}),$([Hn],Cn(Vn),Vn)}}function yn(n,t){for(var e=t.db.objectStoreNames,r=0;r<e.length;++r){var i=e[r],o=t.objectStore(i);Bn="getAll"in o;for(var a=0;a<o.indexNames.length;++a){var c=o.indexNames[a],s=o.index(c).keyPath,f="string"==typeof s?s:"["+u(s).join("+")+"]";if(n[i]){var l=n[i].idxByName[f];l&&(l.name=c)}}}}function mn(n){et.on("blocked").fire(n),Wt.filter(function(n){return n.name===et.name&&n!==et&&!n._vcFired}).map(function(t){return t.on("versionchange").fire(n)})}var wn,Kn,Bn,Fn=bn.dependencies,Mn=n({addons:bn.addons,autoOpen:!0,indexedDB:Fn.indexedDB,IDBKeyRange:Fn.IDBKeyRange},o),Nn=Mn.addons,qn=Mn.autoOpen,Rn=Mn.indexedDB,Un=Mn.IDBKeyRange,Vn=this._dbSchema={},zn=[],Qn=[],Hn={},Gn=null,Jn=null,Yn=!1,$n=null,Xn=!1,Zn="readonly",tt="readwrite",et=this,rt=new R(function(n){wn=n}),it=new R(function(n,t){Kn=t}),ot=!0,ut=!!Dn(Rn);this.version=function(n){if(Gn||Yn)throw new nt.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,n);var t=zn.filter(function(t){return t._cfg.version===n})[0];return t?t:(t=new y(n),zn.push(t),zn.sort(Y),ot=!1,t)},n(y.prototype,{stores:function(t){this._cfg.storesSource=this._cfg.storesSource?n(this._cfg.storesSource,t):t;var e={};zn.forEach(function(t){n(e,t._cfg.storesSource)});var r=this._cfg.dbschema={};return this._parseStoresSpec(e,r),Vn=et._dbSchema=r,X([Hn,et,Q.prototype]),$([Hn,et,Q.prototype,this._cfg.tables],Cn(r),r),Qn=Cn(r),this},upgrade:function(n){var t=this;return Yt(function(){n(et._createTransaction(tt,Cn(t._cfg.dbschema),t._cfg.dbschema))}),this._cfg.contentUpgrade=n,this},_parseStoresSpec:function(n,t){Cn(n).forEach(function(e){if(null!==n[e]){var r={},i=nn(n[e]),o=i.shift();if(o.multi)throw new nt.Schema("Primary key cannot be multi-valued");o.keyPath&&p(r,o.keyPath,o.auto?0:o.keyPath),i.forEach(function(n){if(n.auto)throw new nt.Schema("Only primary key can be marked as autoIncrement (++)");if(!n.keyPath)throw new nt.Schema("Index must have a name and cannot be an empty string");p(r,n.keyPath,n.compound?n.keyPath.map(function(){return""}):"")}),t[e]=new Sn(e,o,i,r)}})}}),this._allTables=Hn,this._createTransaction=function(n,t,e,r){return new Q(n,t,e,r)},this._whenReady=function(n){return $t||Xn||Et.letThrough?n():new R(function(n,t){if(!Yn){if(!qn)return void t(new nt.DatabaseClosed);et.open().catch(D)}rt.then(n,t)}).then(n)},this.verno=0,this.open=function(){if(Yn||Gn)return rt.then(function(){return Jn?Nt(Jn):et});Wn&&(it._stackHolder=x()),Yn=!0,Jn=null,Xn=!1;var n=wn,t=null;return R.race([it,new R(function(n,e){if(c(function(){return n()}),!Rn)throw new nt.MissingAPI("indexedDB API not found. If using IE10+, make sure to run your code on a server URL (not locally). If using old Safari versions, make sure to include indexedDB polyfill.");var r=ot?Rn.open(i):Rn.open(i,Math.round(10*et.verno));if(!r)throw new nt.MissingAPI("IndexedDB API not available");r.onerror=xn(e),r.onblocked=rn(mn),r.onupgradeneeded=rn(function(n){if(t=r.transaction,ot&&!et._allowEmptyDB){r.onerror=Pn,t.abort(),r.result.close();var o=Rn.deleteDatabase(i);o.onsuccess=o.onerror=rn(function(){e(new nt.NoSuchDatabase("Database "+i+" doesnt exist"))})}else{t.onerror=xn(e);var u=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;k(u/10,t,e,r)}},e),r.onsuccess=rn(function(){if(t=null,Gn=r.result,Wt.push(et),ot)pn();else if(Gn.objectStoreNames.length>0)try{yn(Vn,Gn.transaction(In(Gn.objectStoreNames),Zn))}catch(n){}Gn.onversionchange=rn(function(n){et._vcFired=!0,et.on("versionchange").fire(n)}),ut||"__dbnames"===i||Mt.dbnames.put({name:i}).catch(D),n()},e)})]).then(function(){return $n=[],R.resolve(bn.vip(et.on.ready.fire)).then(function n(){if($n.length>0){var t=$n.reduce(q,D);return $n=[],R.resolve(bn.vip(t)).then(n)}})}).finally(function(){$n=null}).then(function(){return Yn=!1,et}).catch(function(n){try{t&&t.abort()}catch(n){}return Yn=!1,et.close(),Jn=n,Nt(Jn)}).finally(function(){Xn=!0,n()})},this.close=function(){var n=Wt.indexOf(et);if(n>=0&&Wt.splice(n,1),Gn){try{Gn.close()}catch(n){}Gn=null}qn=!1,Jn=new nt.DatabaseClosed,Yn&&Kn(Jn),rt=new R(function(n){wn=n}),it=new R(function(n,t){Kn=t})},this.delete=function(){var n=arguments.length>0;return new R(function(t,e){function r(){et.close();var n=Rn.deleteDatabase(i);n.onsuccess=rn(function(){ut||Mt.dbnames.delete(i).catch(D),t()}),n.onerror=xn(e),n.onblocked=mn}if(n)throw new nt.InvalidArgument("Arguments not allowed in db.delete()");Yn?rt.then(r):r()})},this.backendDB=function(){return Gn},this.isOpen=function(){return null!==Gn},this.hasBeenClosed=function(){return Jn&&Jn instanceof nt.DatabaseClosed},this.hasFailed=function(){return null!==Jn},this.dynamicallyOpened=function(){return ot},this.name=i,e(this,{tables:{get:function(){return Cn(Hn).map(function(n){return Hn[n]})}}}),this.on=gn(this,"populate","blocked","versionchange",{ready:[q,D]}),this.on.ready.subscribe=a(this.on.ready.subscribe,function(n){return function(t,e){bn.vip(function(){Xn?(Jn||R.resolve().then(t),e&&n(t)):$n?($n.push(t),e&&n(t)):(n(t),e||n(function n(){et.on.ready.unsubscribe(t),et.on.ready.unsubscribe(n)}))})}}),Yt(function(){et.on("populate").fire(et._createTransaction(tt,Qn,Vn))}),this.transaction=function(){var n=V.apply(this,arguments);return this._transaction.apply(this,n)},this._transaction=function(n,t,e){function r(){return R.resolve().then(function(){var t=Et.transless||Et,r=et._createTransaction(n,u,Vn,i),o={trans:r,transless:t};i?r.idbtrans=i.idbtrans:r.create(),e.constructor===dt&&un();var a,c=R.follow(function(){if(a=e.call(r,r))if(a.constructor===ht){var n=an.bind(null,null);a.then(n,n)}else"function"==typeof a.next&&"function"==typeof a.throw&&(a=An(a))},o);return(a&&"function"==typeof a.then?R.resolve(a).then(function(n){return r.active?n:Nt(new nt.PrematureCommit("Transaction committed too early. See http://bit.ly/2eVASrf"))}):c.then(function(){return a})).then(function(n){return i&&r._resolve(),r._completion.then(function(){return n})}).catch(function(n){return r._reject(n),Nt(n)})})}var i=Et.trans;i&&i.db===et&&n.indexOf("!")===-1||(i=null);var o=n.indexOf("?")!==-1;n=n.replace("!","").replace("?","");try{var u=t.map(function(n){var t=n instanceof z?n.name:n;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t});if("r"==n||n==Zn)n=Zn;else{if("rw"!=n&&n!=tt)throw new nt.InvalidArgument("Invalid transaction mode: "+n);n=tt}if(i){if(i.mode===Zn&&n===tt){if(!o)throw new nt.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&u.forEach(function(n){if(i&&i.storeNames.indexOf(n)===-1){if(!o)throw new nt.SubTransaction("Table "+n+" not included in parent transaction.");i=null}}),o&&i&&!i.active&&(i=null)}}catch(n){return i?i._promise(null,function(t,e){e(n)}):Nt(n)}return i?i._promise(n,r,"lock"):Et.trans?dn(Et.transless,function(){return et._whenReady(r)}):et._whenReady(r)},this.table=function(n){if($t&&ot)return new z(n);if(!t(Hn,n))throw new nt.InvalidTable("Table "+n+" does not exist");return Hn[n]},e(z.prototype,{_trans:function(n,t,e){var r=this._tx||Et.trans;return r&&r.db===et?r===Et.trans?r._promise(n,t,e):on(function(){return r._promise(n,t,e)},{trans:r,transless:Et.transless||Et}):U(n,[this.name],t)},_idbstore:function(n,t,e){function r(n,e,r){if(r.storeNames.indexOf(i)===-1)throw new nt.NotFound("Table"+i+" not part of transaction");return t(n,e,r.idbtrans.objectStore(i),r)}if($t)return new R(t);var i=this.name;return this._trans(n,r,e)},get:function(n,t){if(n&&n.constructor===Object)return this.where(n).first(t);var e=this;return this._idbstore(Zn,function(t,r,i){$t&&t(e.schema.instanceTemplate);var o=i.get(n);o.onerror=xn(r),o.onsuccess=rn(function(){t(e.hook.reading.fire(o.result))},r)}).then(t)},where:function(n){if("string"==typeof n)return new H(this,n);if(Tn(n))return new H(this,"["+n.join("+")+"]");var t=Cn(n);if(1===t.length)return this.where(t[0]).equals(n[t[0]]);var e=this.schema.indexes.concat(this.schema.primKey).filter(function(n){return n.compound&&t.every(function(t){return n.keyPath.indexOf(t)>=0})&&n.keyPath.every(function(n){return t.indexOf(n)>=0})})[0];if(e&&Ut!==Rt)return this.where(e.name).equals(e.keyPath.map(function(t){return n[t]}));e||console.warn("The query "+JSON.stringify(n)+" on "+this.name+" would benefit of a "+("compound index ["+t.join("+")+"]"));var r=this.schema.idxByName,i=t.reduce(function(t,e){return[t[0]||r[e],t[0]||!r[e]?vn(t[1],function(t){return""+v(t,e)==""+n[e]}):t[1]]},[null,null]),o=i[0];return o?this.where(o.name).equals(n[o.keyPath]).filter(i[1]):e?this.filter(i[1]):this.where(t).equals("")},count:function(n){return this.toCollection().count(n)},offset:function(n){return this.toCollection().offset(n)},limit:function(n){return this.toCollection().limit(n)},reverse:function(){return this.toCollection().reverse()},filter:function(n){return this.toCollection().and(n)},each:function(n){return this.toCollection().each(n)},toArray:function(n){return this.toCollection().toArray(n)},orderBy:function(n){return new G(new H(this,Tn(n)?"["+n.join("+")+"]":n))},toCollection:function(){return new G(new H(this))},mapToClass:function(n,e){this.schema.mappedClass=n;var r=Object.create(n.prototype);e&&_n(r,e),this.schema.instanceTemplate=r;var i=function(e){if(!e)return e;var r=Object.create(n.prototype);for(var i in e)if(t(e,i))try{r[i]=e[i]}catch(n){}return r};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=i,this.hook("reading",i),n},defineClass:function(n){return this.mapToClass(bn.defineClass(n),n)},bulkDelete:function(n){return this.hook.deleting.fire===D?this._idbstore(tt,function(t,e,r,i){t(W(r,i,n,!1,D))}):this.where(":id").anyOf(n).delete().then(function(){})},bulkPut:function(n,t){var e=this;return this._idbstore(tt,function(r,i,o){if(!o.keyPath&&!e.schema.primKey.auto&&!t)throw new nt.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(o.keyPath&&t)throw new nt.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new nt.InvalidArgument("Arguments objects and keys must have the same length");if(0===n.length)return r();var u,a,c=function(n){0===s.length?r(n):i(new S(e.name+".bulkPut(): "+s.length+" of "+f+" operations failed",s))},s=[],f=n.length,h=e;if(e.hook.creating.fire===D&&e.hook.updating.fire===D){a=L(s);for(var d=0,p=n.length;d<p;++d)u=t?o.put(n[d],t[d]):o.put(n[d]),u.onerror=a;u.onerror=L(s,c),u.onsuccess=jn(c)}else{var y=t||o.keyPath&&n.map(function(n){return v(n,o.keyPath)}),m=y&&l(y,function(t,e){return null!=t&&[t,n[e]]}),g=y?h.where(":id").anyOf(y.filter(function(n){return null!=n})).modify(function(){this.value=m[this.primKey],m[this.primKey]=null}).catch(O,function(n){s=n.failures}).then(function(){for(var e=[],r=t&&[],i=y.length-1;i>=0;--i){var o=y[i];(null==o||m[o])&&(e.push(n[i]),t&&r.push(o),null!=o&&(m[o]=null))}return e.reverse(),t&&r.reverse(),h.bulkAdd(e,r)}).then(function(n){var t=y[y.length-1];return null!=t?t:n}):h.bulkAdd(n);g.then(c).catch(S,function(n){s=s.concat(n.failures),c()}).catch(i)}},"locked")},bulkAdd:function(n,t){var e=this,r=this.hook.creating.fire;return this._idbstore(tt,function(i,o,u,a){function c(n){0===h.length?i(n):o(new S(e.name+".bulkAdd(): "+h.length+" of "+y+" operations failed",h))}if(!u.keyPath&&!e.schema.primKey.auto&&!t)throw new nt.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(u.keyPath&&t)throw new nt.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new nt.InvalidArgument("Arguments objects and keys must have the same length");if(0===n.length)return i();var s,f,l,h=[],y=n.length;if(r!==D){var m,g=u.keyPath;f=L(h,null,!0),l=kn(null),d(function(){for(var e=0,i=n.length;e<i;++e){m={onerror:null,onsuccess:null};var o=t&&t[e],c=n[e],h=t?o:g?v(c,g):void 0,d=r.call(m,h,c,a);null==h&&null!=d&&(g?(c=b(c),p(c,g,d)):o=d),s=null!=o?u.add(c,o):u.add(c),s._hookCtx=m,e<i-1&&(s.onerror=f,m.onsuccess&&(s.onsuccess=l))}},function(n){throw m.onerror&&m.onerror(n),n}),s.onerror=L(h,c,!0),s.onsuccess=kn(c)}else{f=L(h);for(var w=0,_=n.length;w<_;++w)s=t?u.add(n[w],t[w]):u.add(n[w]),s.onerror=f;s.onerror=L(h,c),s.onsuccess=jn(c)}})},add:function(n,t){var e=this.hook.creating.fire;return this._idbstore(tt,function(r,i,o,u){var a={onsuccess:null,onerror:null};if(e!==D){var c=null!=t?t:o.keyPath?v(n,o.keyPath):void 0,s=e.call(a,c,n,u);null==c&&null!=s&&(o.keyPath?p(n,o.keyPath,s):t=s)}try{var f=null!=t?o.add(n,t):o.add(n);f._hookCtx=a,f.onerror=En(i),f.onsuccess=kn(function(t){var e=o.keyPath;e&&p(n,e,t),r(t)})}catch(n){throw a.onerror&&a.onerror(n),n}})},put:function(n,t){var e=this,r=this.hook.creating.fire,i=this.hook.updating.fire;if(r!==D||i!==D){var o=this.schema.primKey.keyPath,u=void 0!==t?t:o&&v(n,o);return null==u?this.add(n):(n=b(n),this._trans(tt,function(){return e.where(":id").equals(u).modify(function(){this.value=n}).then(function(r){return 0===r?e.add(n,t):u})},"locked"))}return this._idbstore(tt,function(e,r,i){var o=void 0!==t?i.put(n,t):i.put(n);o.onerror=xn(r),o.onsuccess=rn(function(t){var r=i.keyPath;r&&p(n,r,t.target.result),e(o.result)})})},delete:function(n){return this.hook.deleting.subscribers.length?this.where(":id").equals(n).delete():this._idbstore(tt,function(t,e,r){
+var i=r.delete(n);i.onerror=xn(e),i.onsuccess=rn(function(){t(i.result)})})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(tt,function(n,t,e){var r=e.clear();r.onerror=xn(t),r.onsuccess=rn(function(){n(r.result)})})},update:function(n,t){if("object"!=typeof t||Tn(t))throw new nt.InvalidArgument("Modifications must be an object.");if("object"!=typeof n||Tn(n))return this.where(":id").equals(n).modify(t);Cn(t).forEach(function(e){p(n,e,t[e])});var e=v(n,this.schema.primKey.keyPath);return void 0===e?Nt(new nt.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)}}),e(Q.prototype,{_lock:function(){return s(!Et.global),++this._reculock,1!==this._reculock||Et.global||(Et.lockOwnerFor=this),this},_unlock:function(){if(s(!Et.global),0===--this._reculock)for(Et.global||(Et.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var n=this._blockedFuncs.shift();try{dn(n[1],n[0])}catch(n){}}return this},_locked:function(){return this._reculock&&Et.lockOwnerFor!==this},create:function(n){var t=this;if(!this.mode)return this;if(s(!this.idbtrans),!n&&!Gn)switch(Jn&&Jn.name){case"DatabaseClosedError":throw new nt.DatabaseClosed(Jn);case"MissingAPIError":throw new nt.MissingAPI(Jn.message,Jn);default:throw new nt.OpenFailed(Jn)}if(!this.active)throw new nt.TransactionInactive;return s(null===this._completion._state),n=this.idbtrans=n||Gn.transaction(In(this.storeNames),this.mode),n.onerror=rn(function(e){Pn(e),t._reject(n.error)}),n.onabort=rn(function(n){Pn(n),t.active&&t._reject(new nt.Abort),t.active=!1,t.on("abort").fire(n)}),n.oncomplete=rn(function(){t.active=!1,t._resolve()}),this},_promise:function(n,t,e){var r=this;if(n===tt&&this.mode!==tt)return Nt(new nt.ReadOnly("Transaction is readonly"));if(!this.active)return Nt(new nt.TransactionInactive);if(this._locked())return new R(function(i,o){r._blockedFuncs.push([function(){r._promise(n,t,e).then(i,o)},Et])});if(e)return on(function(){var n=new R(function(n,e){r._lock();var i=t(n,e,r);i&&i.then&&i.then(n,e)});return n.finally(function(){return r._unlock()}),n._lib=!0,n});var i=new R(function(n,e){var i=t(n,e,r);i&&i.then&&i.then(n,e)});return i._lib=!0,i},_root:function(){return this.parent?this.parent._root():this},waitFor:function(n){var t=this._root();if(n=R.resolve(n),t._waitingFor)t._waitingFor=t._waitingFor.then(function(){return n});else{t._waitingFor=n,t._waitingQueue=[];var e=t.idbtrans.objectStore(t.storeNames[0]);!function n(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(e.get(-(1/0)).onsuccess=n)}()}var r=t._waitingFor;return new R(function(e,i){n.then(function(n){return t._waitingQueue.push(rn(e.bind(null,n)))},function(n){return t._waitingQueue.push(rn(i.bind(null,n)))}).finally(function(){t._waitingFor===r&&(t._waitingFor=null)})})},abort:function(){this.active&&this._reject(new nt.Abort),this.active=!1},tables:{get:E("Transaction.tables",function(){return Hn})},table:function(n){var t=et.table(n);return new z(n,t.schema,this)}}),e(H.prototype,function(){function n(n,t,e){var r=n instanceof H?new G(n):n;return r._ctx.error=e?new e(t):new TypeError(t),r}function t(n){return new G(n,function(){return Un.only("")}).limit(0)}function e(n){return"next"===n?function(n){return n.toUpperCase()}:function(n){return n.toLowerCase()}}function r(n){return"next"===n?function(n){return n.toLowerCase()}:function(n){return n.toUpperCase()}}function i(n,t,e,r,i,o){for(var u=Math.min(n.length,r.length),a=-1,c=0;c<u;++c){var s=t[c];if(s!==r[c])return i(n[c],e[c])<0?n.substr(0,c)+e[c]+e.substr(c+1):i(n[c],r[c])<0?n.substr(0,c)+r[c]+e.substr(c+1):a>=0?n.substr(0,a)+t[a]+e.substr(a+1):null;i(n[c],s)<0&&(a=c)}return u<r.length&&"next"===o?n+e.substr(n.length):u<n.length&&"prev"===o?n.substr(0,e.length):a<0?null:n.substr(0,a)+r[a]+e.substr(a+1)}function o(t,o,u,a){function c(n){s=e(n),f=r(n),l="next"===n?ln:hn;var t=u.map(function(n){return{lower:f(n),upper:s(n)}}).sort(function(n,t){return l(n.lower,t.lower)});h=t.map(function(n){return n.upper}),d=t.map(function(n){return n.lower}),v=n,p="next"===n?"":a}var s,f,l,h,d,v,p,y=u.length;if(!u.every(function(n){return"string"==typeof n}))return n(t,Lt);c("next");var m=new G(t,function(){return Un.bound(h[0],d[y-1]+a)});m._ondirectionchange=function(n){c(n)};var g=0;return m._addAlgorithm(function(n,t,e){var r=n.key;if("string"!=typeof r)return!1;var u=f(r);if(o(u,d,g))return!0;for(var a=null,c=g;c<y;++c){var s=i(r,u,h[c],d[c],l,v);null===s&&null===a?g=c+1:(null===a||l(a,s)>0)&&(a=s)}return t(null!==a?function(){n.continue(a+p)}:e),!1}),m}return{between:function(e,r,i,o){i=i!==!1,o=o===!0;try{return tn(e,r)>0||0===tn(e,r)&&(i||o)&&(!i||!o)?t(this):new G(this,function(){return Un.bound(e,r,!i,!o)})}catch(t){return n(this,zt)}},equals:function(n){return new G(this,function(){return Un.only(n)})},above:function(n){return new G(this,function(){return Un.lowerBound(n,!0)})},aboveOrEqual:function(n){return new G(this,function(){return Un.lowerBound(n)})},below:function(n){return new G(this,function(){return Un.upperBound(n,!0)})},belowOrEqual:function(n){return new G(this,function(){return Un.upperBound(n)})},startsWith:function(t){return"string"!=typeof t?n(this,Lt):this.between(t,t+Rt,!0,!0)},startsWithIgnoreCase:function(n){return""===n?this.startsWith(n):o(this,function(n,t){return 0===n.indexOf(t[0])},[n],Rt)},equalsIgnoreCase:function(n){return o(this,function(n,t){return n===t[0]},[n],"")},anyOfIgnoreCase:function(){var n=_.apply(Ln,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.indexOf(n)!==-1},n,"")},startsWithAnyOfIgnoreCase:function(){var n=_.apply(Ln,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.some(function(t){return 0===n.indexOf(t)})},n,Rt)},anyOf:function(){var e=_.apply(Ln,arguments),r=sn;try{e.sort(r)}catch(t){return n(this,zt)}if(0===e.length)return t(this);var i=new G(this,function(){return Un.bound(e[0],e[e.length-1])});i._ondirectionchange=function(n){r="next"===n?sn:fn,e.sort(r)};var o=0;return i._addAlgorithm(function(n,t,i){for(var u=n.key;r(u,e[o])>0;)if(++o,o===e.length)return t(i),!1;return 0===r(u,e[o])||(t(function(){n.continue(e[o])}),!1)}),i},notEqual:function(n){return this.inAnyRange([[Vt,n],[n,Ut]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var t=_.apply(Ln,arguments);if(0===t.length)return new G(this);try{t.sort(sn)}catch(t){return n(this,zt)}var e=t.reduce(function(n,t){return n?n.concat([[n[n.length-1][1],t]]):[[Vt,t]]},null);return e.push([t[t.length-1],Ut]),this.inAnyRange(e,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(e,r){function i(n,t){for(var e=0,r=n.length;e<r;++e){var i=n[e];if(tn(t[0],i[1])<0&&tn(t[1],i[0])>0){i[0]=en(i[0],t[0]),i[1]=cn(i[1],t[1]);break}}return e===r&&n.push(t),n}function o(n,t){return f(n[0],t[0])}function u(n){return!h(n)&&!d(n)}if(0===e.length)return t(this);if(!e.every(function(n){return void 0!==n[0]&&void 0!==n[1]&&sn(n[0],n[1])<=0}))return n(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",nt.InvalidArgument);var a,c=!r||r.includeLowers!==!1,s=r&&r.includeUppers===!0,f=sn;try{a=e.reduce(i,[]),a.sort(o)}catch(t){return n(this,zt)}var l=0,h=s?function(n){return sn(n,a[l][1])>0}:function(n){return sn(n,a[l][1])>=0},d=c?function(n){return fn(n,a[l][0])>0}:function(n){return fn(n,a[l][0])>=0},v=h,p=new G(this,function(){return Un.bound(a[0][0],a[a.length-1][1],!c,!s)});return p._ondirectionchange=function(n){"next"===n?(v=h,f=sn):(v=d,f=fn),a.sort(o)},p._addAlgorithm(function(n,t,e){for(var r=n.key;v(r);)if(++l,l===a.length)return t(e),!1;return!!u(r)||0!==tn(r,a[l][1])&&0!==tn(r,a[l][0])&&(t(function(){f===sn?n.continue(a[l][0]):n.continue(a[l][1])}),!1)}),p},startsWithAnyOf:function(){var e=_.apply(Ln,arguments);return e.every(function(n){return"string"==typeof n})?0===e.length?t(this):this.inAnyRange(e.map(function(n){return[n,n+Rt]})):n(this,"startsWithAnyOf() only works with strings")}}}),e(G.prototype,function(){function e(n,t){n.filter=vn(n.filter,t)}function r(n,t,e){var r=n.replayFilter;n.replayFilter=r?function(){return vn(r(),t())}:t,n.justLimit=e&&!r}function i(n,t){n.isMatch=vn(n.isMatch,t)}function o(n,t){if(n.isPrimKey)return t;var e=n.table.schema.idxByName[n.index];if(!e)throw new nt.Schema("KeyPath "+n.index+" on object store "+t.name+" is not indexed");return t.index(e.name)}function u(n,t){var e=o(n,t);return n.keysOnly&&"openKeyCursor"in e?e.openKeyCursor(n.range||null,n.dir+n.unique):e.openCursor(n.range||null,n.dir+n.unique)}function a(n,e,r,i,o){var a=n.replayFilter?vn(n.filter,n.replayFilter()):n.filter;n.or?function(){function c(){2===++l&&r()}function s(n,r,o){if(!a||a(r,o,c,i)){var u=r.primaryKey.toString();t(f,u)||(f[u]=!0,e(n,r,o))}}var f={},l=0;n.or._iterate(s,c,i,o),Z(u(n,o),n.algorithm,s,c,i,!n.keysOnly&&n.valueMapper)}():Z(u(n,o),vn(n.algorithm,a),e,r,i,!n.keysOnly&&n.valueMapper)}function c(n){return n.table.schema.instanceTemplate}return{_read:function(n,t){var e=this._ctx;return e.error?e.table._trans(null,Nt.bind(null,e.error)):e.table._idbstore(Zn,n).then(t)},_write:function(n){var t=this._ctx;return t.error?t.table._trans(null,Nt.bind(null,t.error)):t.table._idbstore(tt,n,"locked")},_addAlgorithm:function(n){var t=this._ctx;t.algorithm=vn(t.algorithm,n)},_iterate:function(n,t,e,r){return a(this._ctx,n,t,e,r)},clone:function(t){var e=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&n(r,t),e._ctx=r,e},raw:function(){return this._ctx.valueMapper=null,this},each:function(n){var t=this._ctx;if($t){var e=c(t),r=t.table.schema.primKey.keyPath,i=v(e,t.index?t.table.schema.idxByName[t.index].keyPath:r),o=v(e,r);n(e,{key:i,primaryKey:o})}return this._read(function(e,r,i){a(t,n,e,r,i)})},count:function(n){if($t)return R.resolve(0).then(n);var t=this._ctx;if(J(t,!0))return this._read(function(n,e,r){var i=o(t,r),u=t.range?i.count(t.range):i.count();u.onerror=xn(e),u.onsuccess=function(e){n(Math.min(e.target.result,t.limit))}},n);var e=0;return this._read(function(n,r,i){a(t,function(){return++e,!1},function(){n(e)},r,i)},n)},sortBy:function(n,t){function e(n,t){return t?e(n[i[t]],t-1):n[o]}function r(n,t){var r=e(n,u),i=e(t,u);return r<i?-a:r>i?a:0}var i=n.split(".").reverse(),o=i[0],u=i.length-1,a="next"===this._ctx.dir?1:-1;return this.toArray(function(n){return n.sort(r)}).then(t)},toArray:function(n){var t=this._ctx;return this._read(function(n,e,r){if($t&&n([c(t)]),Bn&&"next"===t.dir&&J(t,!0)&&t.limit>0){var i=t.table.hook.reading.fire,u=o(t,r),s=t.limit<1/0?u.getAll(t.range,t.limit):u.getAll(t.range);s.onerror=xn(e),s.onsuccess=jn(i===C?n:function(t){try{n(t.map(i))}catch(n){e(n)}})}else{var f=[];a(t,function(n){f.push(n)},function(){n(f)},e,r)}},n)},offset:function(n){var t=this._ctx;return n<=0?this:(t.offset+=n,J(t)?r(t,function(){var t=n;return function(n,e){return 0===t||(1===t?(--t,!1):(e(function(){n.advance(t),t=0}),!1))}}):r(t,function(){var t=n;return function(){return--t<0}}),this)},limit:function(n){return this._ctx.limit=Math.min(this._ctx.limit,n),r(this._ctx,function(){var t=n;return function(n,e,r){return--t<=0&&e(r),t>=0}},!0),this},until:function(n,t){var r=this._ctx;return $t&&n(c(r)),e(this._ctx,function(e,r,i){return!n(e.value)||(r(i),t)}),this},first:function(n){return this.limit(1).toArray(function(n){return n[0]}).then(n)},last:function(n){return this.reverse().first(n)},filter:function(n){return $t&&n(c(this._ctx)),e(this._ctx,function(t){return n(t.value)}),i(this._ctx,n),this},and:function(n){return this.filter(n)},or:function(n){return new H(this._ctx.table,n,this)},reverse:function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},desc:function(){return this.reverse()},eachKey:function(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,e){n(e.key,e)})},eachUniqueKey:function(n){return this._ctx.unique="unique",this.eachKey(n)},eachPrimaryKey:function(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,e){n(e.primaryKey,e)})},keys:function(n){var t=this._ctx;t.keysOnly=!t.isMatch;var e=[];return this.each(function(n,t){e.push(t.key)}).then(function(){return e}).then(n)},primaryKeys:function(n){var t=this._ctx;if(Bn&&"next"===t.dir&&J(t,!0)&&t.limit>0)return this._read(function(n,e,r){var i=o(t,r),u=t.limit<1/0?i.getAllKeys(t.range,t.limit):i.getAllKeys(t.range);u.onerror=xn(e),u.onsuccess=jn(n)}).then(n);t.keysOnly=!t.isMatch;var e=[];return this.each(function(n,t){e.push(t.primaryKey)}).then(function(){return e}).then(n)},uniqueKeys:function(n){return this._ctx.unique="unique",this.keys(n)},firstKey:function(n){return this.limit(1).keys(function(n){return n[0]}).then(n)},lastKey:function(n){return this.reverse().firstKey(n)},distinct:function(){var n=this._ctx,r=n.index&&n.table.schema.idxByName[n.index];if(!r||!r.multi)return this;var i={};return e(this._ctx,function(n){var e=n.primaryKey.toString(),r=t(i,e);return i[e]=!0,!r}),this},modify:function(e){var r=this,i=this._ctx,o=i.table.hook,u=o.updating.fire,a=o.deleting.fire;return $t&&"function"==typeof e&&e.call({value:i.table.schema.instanceTemplate},i.table.schema.instanceTemplate),this._write(function(i,o,c,s){function f(n,e){function r(n){return P.push(n),A.push(i.primKey),h(),!0}S=e.primaryKey;var i={primKey:e.primaryKey,value:n,onsuccess:null,onerror:null};if(y.call(i,n,i)!==!1){var o=!t(i,"value");++x,d(function(){var n=o?e.delete():e.update(i.value);n._hookCtx=i,n.onerror=En(r),n.onsuccess=kn(function(){++j,h()})},r)}else i.onsuccess&&i.onsuccess(i.value)}function l(n){return n&&(P.push(n),A.push(S)),o(new O("Error modifying one or more objects",P,j,A))}function h(){E&&j+P.length===x&&(P.length>0?l():i(j))}var y;if("function"==typeof e)y=u===D&&a===D?e:function(n){var r=b(n);if(e.call(this,n,this)===!1)return!1;if(t(this,"value")){var i=w(r,this.value),o=u.call(this,i,this.primKey,r,s);o&&(n=this.value,Cn(o).forEach(function(t){p(n,t,o[t])}))}else a.call(this,this.primKey,n,s)};else if(u===D){var g=Cn(e),_=g.length;y=function(n){for(var t=!1,r=0;r<_;++r){var i=g[r],o=e[i];v(n,i)!==o&&(p(n,i,o),t=!0)}return t}}else{var k=e;e=m(k),y=function(t){var r=!1,i=u.call(this,e,this.primKey,b(t),s);return i&&n(e,i),Cn(e).forEach(function(n){var i=e[n];v(t,n)!==i&&(p(t,n,i),r=!0)}),i&&(e=m(k)),r}}var x=0,j=0,E=!1,P=[],A=[],S=null;r.clone().raw()._iterate(f,function(){E=!0,h()},l,c)})},delete:function(){var n=this,t=this._ctx,e=t.range,r=t.table.hook.deleting.fire,i=r!==D;if(!i&&J(t)&&(t.isPrimKey&&!Gt||!e))return this._write(function(n,t,r){var i=xn(t),o=e?r.count(e):r.count();o.onerror=i,o.onsuccess=function(){var u=o.result;d(function(){var t=e?r.delete(e):r.clear();t.onerror=i,t.onsuccess=function(){return n(u)}},function(n){return t(n)})}});var o=i?2e3:1e4;return this._write(function(e,u,a,c){var s=0,f=n.clone({keysOnly:!t.isMatch&&!i}).distinct().limit(o).raw(),l=[],h=function(){return f.each(i?function(n,t){l.push([t.primaryKey,t.value])}:function(n,t){l.push(t.primaryKey)}).then(function(){return i?l.sort(function(n,t){return sn(n[0],t[0])}):l.sort(sn),W(a,c,l,i,r)}).then(function(){var n=l.length;return s+=n,l=[],n<o?s:h()})};e(h())})}}}),n(this,{Collection:G,Table:z,Transaction:Q,Version:y,WhereClause:H}),f(),Nn.forEach(function(n){n(et)})}function wn(n){if("function"==typeof n)return new n;if(Tn(n))return[wn(n[0])];if(n&&"object"==typeof n){var t={};return _n(t,n),t}return n}function _n(n,t){return Cn(t).forEach(function(e){var r=wn(t[e]);n[e]=r}),n}function kn(n){return rn(function(t){var e=t.target,r=e.result,i=e._hookCtx,o=i&&i.onsuccess;o&&o(r),n&&n(r)},n)}function xn(n){return rn(function(t){return Pn(t),n(t.target.error),!1})}function jn(n){return rn(function(t){n(t.target.result)})}function En(n){return rn(function(t){var e=t.target,r=e.error,i=e._hookCtx,o=i&&i.onerror;return o&&o(r),Pn(t),n(r),!1})}function Pn(n){n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault()}function An(n){function t(n){return function(t){var e=n(t),r=e.value;return e.done?r:r&&"function"==typeof r.then?r.then(i,o):Tn(r)?R.all(r).then(i,o):i(r)}}var e=function(t){return n.next(t)},r=function(t){return n.throw(t)},i=t(e),o=t(r);return t(e)()}function On(n,t,e,r,i,o,u){this.name=n,this.keyPath=t,this.unique=e,this.multi=r,this.auto=i,this.compound=o,this.dotted=u;var a="string"==typeof t?t:t&&"["+[].join.call(t,"+")+"]";this.src=(e?"&":"")+(r?"*":"")+(i?"++":"")+a}function Sn(n,t,e,r){this.name=n,this.primKey=t||new On,this.indexes=e||[new On],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=l(e,function(n){return[n.name,n]})}function In(n){return 1===n.length?n[0]:n}function Dn(n){var t=n&&(n.getDatabaseNames||n.webkitGetDatabaseNames);return t&&t.bind(n)}var Cn=Object.keys,Tn=Array.isArray,Kn="undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Bn=Object.getPrototypeOf,Fn={}.hasOwnProperty,Mn=Object.defineProperty,Nn=Object.getOwnPropertyDescriptor,qn=[].slice,Rn=[].concat,Un="Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set".split(",").concat(g([8,16,32,64].map(function(n){return["Int","Uint","Float"].map(function(t){return t+n+"Array"})}))).filter(function(n){return Kn[n]}).map(function(n){return Kn[n]}),Vn="undefined"!=typeof Symbol&&Symbol.iterator,zn=Vn?function(n){var t;return null!=n&&(t=n[Vn])&&t.apply(n)}:function(){return null},Ln={},Wn="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),Qn=function(){return!0},Hn=!new Error("").stack,Gn=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Jn=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Yn=Gn.concat(Jn),$n={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};i(P).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}}),i(O).from(P),i(S).from(P);var Xn=Yn.reduce(function(n,t){return n[t]=t+"Error",n},{}),Zn=P,nt=Yn.reduce(function(n,t){function e(n,e){this._e=x(),this.name=r,n?"string"==typeof n?(this.message=n,this.inner=e||null):"object"==typeof n&&(this.message=n.name+" "+n.message,this.inner=n):(this.message=$n[t]||r,this.inner=null)}var r=t+"Error";return i(e).from(Zn),n[t]=e,n},{});nt.Syntax=SyntaxError,nt.Type=TypeError,nt.Range=RangeError;var tt=Jn.reduce(function(n,t){return n[t+"Error"]=nt[t],n},{}),et=Yn.reduce(function(n,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(n[t+"Error"]=nt[t]),n},{});et.ModifyError=O,et.DexieError=P,et.BulkError=S;var rt={},it=100,ot=20,ut=7,at=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(t){var n=Kn.Promise;return n?[n.resolve(),n.prototype,n.resolve()]:[]}}(),ct=at[0],st=at[1],ft=at[2],lt=st&&st.then,ht=ct&&ct.constructor,dt=at[3],vt=!!ft,pt=!1,yt=ft?function(){ft.then(J)}:Kn.setImmediate?setImmediate.bind(null,J):Kn.MutationObserver?function(){var n=document.createElement("div");new MutationObserver(function(){J(),n=null}).observe(n,{attributes:!0}),n.setAttribute("i","1")}:function(){setTimeout(J,0)},mt=function(n,t){Pt.push([n,t]),bt&&(yt(),bt=!1)},gt=!0,bt=!0,wt=[],_t=[],kt=null,xt=C,jt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:mn,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(n){try{mn(n[0],n[1])}catch(n){}})}},Et=jt,Pt=[],At=0,Ot=[],St={get:function(){function n(n,r){var i=this,o=!t.global&&(t!==Et||e!==Kt);o&&an();var u=new R(function(e,u){W(i,new U(pn(n,t,o),pn(r,t,o),e,u,t))});return Wn&&G(u,this),u}var t=Et,e=Kt;return n.prototype=rt,n},set:function(n){r(this,"then",n&&n.prototype===rt?St:{get:function(){return n},set:St.set})}};e(R.prototype,{then:St,_then:function(n,t){W(this,new U(null,null,n,t,Et))},catch:function(n){if(1===arguments.length)return this.then(null,n);var t=arguments[0],e=arguments[1];return"function"==typeof t?this.then(null,function(n){return n instanceof t?e(n):en(n)}):this.then(null,function(n){return n&&n.name===t?e(n):en(n)})},finally:function(n){return this.then(function(t){return n(),t},function(t){return n(),en(t)})},stack:{get:function(){if(this._stack)return this._stack;try{pt=!0;var n=H(this,[],ot),t=n.join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{pt=!1}}},timeout:function(n,t){var e=this;return n<1/0?new R(function(r,i){var o=setTimeout(function(){return i(new nt.Timeout(t))},n);e.then(r,i).finally(clearTimeout.bind(null,o))}):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&r(R.prototype,Symbol.toStringTag,"Promise"),jt.env=hn(),e(R,{all:function(){var n=_.apply(null,arguments).map(cn);return new R(function(t,e){0===n.length&&t([]);var r=n.length;n.forEach(function(i,o){return R.resolve(i).then(function(e){n[o]=e,--r||t(n)},e)})})},resolve:function(n){if(n instanceof R)return n;if(n&&"function"==typeof n.then)return new R(function(t,e){n.then(t,e)});var t=new R(rt,!0,n);return G(t,kt),t},reject:en,race:function(){var n=_.apply(null,arguments).map(cn);return new R(function(t,e){n.map(function(n){return R.resolve(n).then(t,e)})})},PSD:{get:function(){return Et},set:function(n){return Et=n}},newPSD:on,usePSD:dn,scheduler:{get:function(){return mt},set:function(n){mt=n}},rejectionMapper:{get:function(){return xt},set:function(n){xt=n}},follow:function(n,t){return new R(function(e,r){return on(function(t,e){var r=Et;r.unhandleds=[],r.onunhandled=e,r.finalize=K(function(){var n=this;Z(function(){0===n.unhandleds.length?t():e(n.unhandleds[0])})},r.finalize),n()},t,e,r)})}});var It={awaits:0,echoes:0,id:0},Dt=0,Ct=[],Tt=0,Kt=0,Bt=0,Ft="unhandledrejection";c(function(){mt=function(n,t){setTimeout(function(){n.apply(null,t)},0)}});var Mt,Nt=R.reject,qt="2.0.0-beta.10",Rt=String.fromCharCode(65535),Ut=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(n){return Rt}}(),Vt=-(1/0),zt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Lt="String expected.",Wt=[],Qt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Ht=Qt,Gt=Qt,Jt=function(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};k(Wn,Jt);var Yt=function(){},$t=!1,Xt=Kn.idbModules&&Kn.idbModules.shimIndexedDB?Kn.idbModules:{};return e(bn,et),e(bn,{delete:function(n){var t=new bn(n),e=t.delete();return e.onblocked=function(n){return t.on("blocked",n),this},e},exists:function(n){return new bn(n).open().then(function(n){return n.close(),!0}).catch(bn.NoSuchDatabaseError,function(){return!1})},getDatabaseNames:function(n){var t=Dn(bn.dependencies.indexedDB);return t?new R(function(n,e){var r=t();r.onsuccess=function(t){n(u(t.target.result,0))},r.onerror=xn(e)}).then(n):Mt.dbnames.toCollection().primaryKeys(n)},defineClass:function(t){function e(e){e?n(this,e):$t&&_n(this,t)}return e},applyStructure:_n,ignoreTransaction:function(n){return Et.trans?dn(Et.transless,n):n()},vip:function(n){return on(function(){return Et.letThrough=!0,n()})},async:function(n){return function(){try{var t=An(n.apply(this,arguments));return t&&"function"==typeof t.then?t:R.resolve(t)}catch(n){return Nt(n)}}},spawn:function(n,t,e){try{var r=An(n.apply(e,t||[]));return r&&"function"==typeof r.then?r:R.resolve(r)}catch(n){return Nt(n)}},currentTransaction:{get:function(){return Et.trans||null}},waitFor:function(n,t){var e=R.resolve("function"==typeof n?bn.ignoreTransaction(n):n).timeout(t||6e4);return Et.trans?Et.trans.waitFor(e):e},Promise:R,debug:{get:function(){return Wn},set:function(n){k(n,"dexie"===n?function(){return!0}:Jt)}},derive:i,extend:n,props:e,override:a,Events:gn,getByKeyPath:v,setByKeyPath:p,delByKeyPath:y,shallowClone:m,deepClone:b,getObjectDiff:w,asap:f,maxKey:Ut,minKey:Vt,addons:[],connections:Wt,MultiModifyError:nt.Modify,errnames:Xn,IndexSpec:On,TableSchema:Sn,dependencies:{indexedDB:Xt.shimIndexedDB||Kn.indexedDB||Kn.mozIndexedDB||Kn.webkitIndexedDB||Kn.msIndexedDB,IDBKeyRange:Xt.IDBKeyRange||Kn.IDBKeyRange||Kn.webkitIDBKeyRange},semVer:qt,version:qt.split(".").map(function(n){return parseInt(n)}).reduce(function(n,t,e){return n+t/Math.pow(10,2*e)}),fakeAutoComplete:Yt,default:bn,Dexie:bn}),R.rejectionMapper=I,c(function(){bn.fakeAutoComplete=Yt=c,bn.fake=$t=!0}),Mt=new bn("__dbnames"),Mt.version(1).stores({dbnames:"name"}),function(){var n="Dexie.DatabaseNames";if(void 0!==typeof localStorage&&void 0!==Kn.document)try{JSON.parse(localStorage.getItem(n)||"[]").forEach(function(n){return Mt.dbnames.put({name:n}).catch(D)}),localStorage.removeItem(n)}catch(n){}}(),bn});
+//# sourceMappingURL=dist/dexie.min.js.map \ No newline at end of file