!function(a,b){"object"==typeofexports&&"undefined"!=typeofmodule?module.exports=b():"function"==typeofdefine&&define.amd?define(b):a.Dexie=b()}(this,function(){"use strict";functiond(b,c){return"object"!=typeofc?b:(a(c).forEach(function(a){b[a]=c[a]}),b)}functiong(a,b){returnf.call(a,b)}functionh(b,c){"function"==typeofc&&(c=c(e(b))),a(c).forEach(function(a){j(b,a,c[a])})}functionj(a,b,c,e){i(a,b,d(c&&g(c,"get")&&"function"==typeofc.get?{get:c.get,set:c.set,configurable:!0}:{value:c,configurable:!0,writable:!0},e))}functionk(a){return{from:function(b){returna.prototype=Object.create(b.prototype),j(a.prototype,"constructor",a),{extend:h.bind(null,a.prototype)}}}}functionm(a,b){vard,c=l(a,b);returnc||(d=e(a))&&m(d,b)}functiono(a,b,c){returnn.call(a,b,c)}functionp(a,b){returnb(a)}functionq(a){varb=setTimeout(a,1e3);clearTimeout(b)}functionr(a){if(!a)thrownewError("Assertion Failed")}functions(a){c.setImmediate?setImmediate(a):setTimeout(a,0)}functiont(a,b){returna.reduce(function(a,c,d){vare=b(c,d);returne&&(a[e[0]]=e[1]),a},{})}functionu(a,b){returnfunction(){try{a.apply(this,arguments)}catch(a){b(a)}}}functionv(a,b,c){try{a.apply(null,c)}catch(a){b&&b(a)}}functionw(a,b){if(g(a,b))returna[b];if(!b)returna;if("string"!=typeofb){for(varc=[],d=0,e=b.length;d<e;++d){varf=w(a,b[d]);c.push(f)}returnc}varh=b.indexOf(".");if(h!==-1){vari=a[b.substr(0,h)];returnvoid0===i?void0:w(i,b.substr(h+1))}}functionx(a,b,c){if(a&&void0!==b&&!("isFrozen"inObject&&Object.isFrozen(a)))if("string"!=typeofb&&"length"inb){r("string"!=typeofc&&"length"inc);for(vard=0,e=b.length;d<e;++d)x(a,b[d],c[d])}else{varf=b.indexOf(".");if(f!==-1){varg=b.substr(0,f),h=b.substr(f+1);if(""===h)void0===c?deletea[g]:a[g]=c;else{vari=a[g];i||(i=a[g]={}),x(i,h,c)}}elsevoid0===c?deletea[b]:a[b]=c}}functiony(a,b){"string"==typeofb?x(a,b,void0):"length"inb&&[].map.call(b,function(b){x(a,b,void0)})}functionz(a){varb={};for(varcina)g(a,c)&&(b[c]=a[c]);returnb}functionA(a){if(!a||"object"!=typeofa)returna;varc;if(b(a)){c=[];for(vard=0,e=a.length;d<e;++d)c.push(A(a[d]))}elseif(ainstanceofDate)c=newDate,c.setTime(a.getTime());else{c=a.constructor?Object.create(a.constructor.prototype):{};for(varfina)g(a,f)&&(c[f]=A(a[f]))}returnc}functionB(b,c,d,e){returnd=d||{},e=e||"",a(b).forEach(function(a){if(g(c,a)){varf=b[a],h=c[a];"object"==typeoff&&"object"==typeofh&&f&&h&&f.constructor===h.constructor?B(f,h,d,e+a+"."):f!==h&&(d[e+a]=c[a])}elsed[e+a]=void0}),a(c).forEach(function(a){g(b,a)||(d[e+a]=c[a])}),d}functionF(a){varc,d,e,f;if(1===arguments.length){if(b(a))returna.slice();if(this===E&&"string"==typeofa)return[a];if(f=D(a)){for(d=[];e=f.next(),!e.done;)d.push(e.value);returnd}if(null==a)return[a];if(c=a.length,"number"==typeofc){for(d=newArray(c);c--;)d[c]=a[c];returnd}return[a]}for(c=arguments.length,d=newArray(c);c--;)d[c]=arguments[c];returnd}functionH(a){returnG.apply([],a)}functionJ(a,b){I=a,K=b}functionM(){if(L)try{throwM.arguments,newError}catch(a){returna}returnnewError}functionN(a,b){varc=a.stack;returnc?(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("")):""}functionO(a,b){returnfunction(){returnconsole.warn(a+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+N(M(),1)),b.apply(this,arguments)}}functionT(a,b){this._e=M(),this.name=a,this.message=b}functionU(a,b){returna+". Errors: "+b.map(function(a){returna.toString()}).filter(function(a,b,c){returnc.indexOf(a)===b}).join("\n")}functionV(a,b,c,d){this._e=M(),this.failures=b,this.failedKeys=d,this.successCount=c}functionW(a,b){this._e=M(),this.name="BulkError",this.failures=b,this.message=U(a,b)}function_(a,b){if(!a||ainstanceofT||ainstanceofTypeError||ainstanceofSyntaxError||!a.name||!$[a.name])returna;varc=new$[a.name](b||a.message,a);return"stack"ina&&j(c,"stack",{get:function(){returnthis.inner.stack}}),c}functionba(){}functionca(a){returna}functiond
a.onerror=_a(function(c){Pb(c),b._reject(a.error)}),a.onabort=_a(function(a){Pb(a),b.active&&b._reject(newZ.Abort),b.active=!1,b.on("abort").fire(a)}),a.oncomplete=_a(function(){b.active=!1,b._resolve()}),this},_promise:function(a,b,c){vard=this;if(a===P&&this.mode!==P)returnub(newZ.ReadOnly("Transaction is readonly"));if(!this.active)returnub(newZ.TransactionInactive);if(this._locked())returnnewJa(function(e,f){d._blockedFuncs.push([function(){d._promise(a,b,c).then(e,f)},Fa])});if(c)returngb(function(){vara=newJa(function(a,c){d._lock();vare=b(a,c,d);e&&e.then&&e.then(a,c)});returna.finally(function(){returnd._unlock()}),a._lib=!0,a});vare=newJa(function(a,c){vare=b(a,c,d);e&&e.then&&e.then(a,c)});returne._lib=!0,e},abort:function(){this.active&&this._reject(newZ.Abort),this.active=!1},tables:{get:O("Transaction.tables",function(){returnD})},table:O("Transaction.table()",function(a){returnD[a]})}),h(xa.prototype,function(){functiona(a,b,c){vard=ainstanceofxa?newya(a):a;returnd._ctx.error=c?newc(b):newTypeError(b),d}functionb(a){returnnewya(a,function(){returnn.only("")}).limit(0)}functionc(a){return"next"===a?function(a){returna.toUpperCase()}:function(a){returna.toLowerCase()}}functiond(a){return"next"===a?function(a){returna.toLowerCase()}:function(a){returna.toUpperCase()}}functione(a,b,c,d,e,f){for(varg=Math.min(a.length,d.length),h=-1,i=0;i<g;++i){varj=b[i];if(j!==d[i])returne(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)}returng<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)}functionf(b,f,g,h){functionr(a){i=c(a),j=d(a),k="next"===a?Ma:Na;varb=g.map(function(a){return{lower:j(a),upper:i(a)}}).sort(function(a,b){returnk(a.lower,b.lower)});l=b.map(function(a){returna.upper}),m=b.map(function(a){returna.lower}),o=a,p="next"===a?"":h}vari,j,k,l,m,o,p,q=g.length;if(!g.every(function(a){return"string"==typeofa}))returna(b,Ab);r("next");vars=newya(b,function(){returnn.bound(l[0],m[q-1]+h)});s._ondirectionchange=function(a){r(a)};vart=0;returns._addAlgorithm(function(a,b,c){vard=a.key;if("string"!=typeofd)return!1;varg=j(d);if(f(g,m,t))return!0;for(varh=null,i=t;i<q;++i){varn=e(d,g,l[i],m[i],k,o);null===n&&null===h?t=i+1:(null===h||k(h,n)>0)&&(h=n)}returnb(null!==h?function(){a.continue(h+p)}:c),!1}),s}return{between:function(c,d,e,f){e=e!==!1,f=f===!0;try{returnGa(c,d)>0||0===Ga(c,d)&&(e||f)&&(!e||!f)?b(this):newya(this,function(){returnn.bound(c,d,!e,!f)})}catch(b){returna(this,zb)}},equals:function(a){returnnewya(this,function(){returnn.only(a)})},above:function(a){returnnewya(this,function(){returnn.lowerBound(a,!0)})},aboveOrEqual:function(a){returnnewya(this,function(){returnn.lowerBound(a)})},below:function(a){returnnewya(this,function(){returnn.upperBound(a,!0)})},belowOrEqual:function(a){returnnewya(this,function(){returnn.upperBound(a)})},startsWith:function(b){return"string"!=typeofb?a(this,Ab):this.between(b,b+xb,!0,!0)},startsWithIgnoreCase:function(a){return""===a?this.startsWith(a):f(this,function(a,b){return0===a.indexOf(b[0])},[a],xb)},equalsIgnoreCase:function(a){returnf(this,function(a,b){returna===b[0]},[a],"")},anyOfIgnoreCase:function(){vara=F.apply(E,arguments);return0===a.length?b(this):f(this,function(a,b){returnb.indexOf(a)!==-1},a,"")},startsWithAnyOfIgnoreCase:function(){vara=F.apply(E,arguments);return0===a.length?b(this):f(this,function(a,b){returnb.some(function(b){return0===a.indexOf(b)})},a,xb)},anyOf:function(){varc=F.apply(E,arguments),d=Ka;try{c.sort(d)}catch(b){returna(this,zb)}if(0===c.length)returnb(this);vare=newya(this,function(){returnn.bound(c[0],c[c.length-1])});e._ondirectionchange=function(a){d="next"===a?Ka:La,c.sort(d)};varf=0;returne._addAlgorithm(function(a,b,e){for(varg=a.key;d(g,c[f])>0;)if(++f,f===c.length)returnb(e),!1;return0===d(g,c[f])||(b(function(){a.continue(c[f])}),!1)}