1
2
|
this.webpackChunk([3],{214:function(e,t,n){"use strict";n.r(t);var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=Object.keys,o=Array.isArray,u="undefined"!=typeof self?self:"undefined"!=typeof window?window:global;function a(e,t){return"object"!=typeof t?e:(i(t).forEach(function(n){e[n]=t[n]}),e)}"undefined"==typeof Promise||u.Promise||(u.Promise=Promise);var s=Object.getPrototypeOf,c={}.hasOwnProperty;function l(e,t){return c.call(e,t)}function f(e,t){"function"==typeof t&&(t=t(s(e))),i(t).forEach(function(n){p(e,n,t[n])})}var h=Object.defineProperty;function p(e,t,n,r){h(e,t,a(n&&l(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function d(e){return{from:function(t){return e.prototype=Object.create(t.prototype),p(e.prototype,"constructor",e),{extend:f.bind(null,e.prototype)}}}}var y=Object.getOwnPropertyDescriptor;var v=[].slice;function m(e,t,n){return v.call(e,t,n)}function g(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function _(e){u.setImmediate?setImmediate(e):setTimeout(e,0)}function w(e,t){if(l(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,i=t.length;r<i;++r){var o=w(e,t[r]);n.push(o)}return n}var u=t.indexOf(".");if(-1!==u){var a=e[t.substr(0,u)];return void 0===a?void 0:w(a,t.substr(u+1))}}function k(e,t,n){if(e&&void 0!==t&&!("isFrozen"in Object&&Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){b("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)k(e,t[r],n[r])}else{var u=t.indexOf(".");if(-1!==u){var a=t.substr(0,u),s=t.substr(u+1);if(""===s)void 0===n?o(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var c=e[a];c||(c=e[a]={}),k(c,s,n)}}else void 0===n?o(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function x(e){var t={};for(var n in e)l(e,n)&&(t[n]=e[n]);return t}var O=[].concat;function P(e){return O.apply([],e)}var E="Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set".split(",").concat(P([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return u[e]}).map(function(e){return u[e]});function j(e){if(!e||"object"!=typeof e)return e;var t;if(o(e)){t=[];for(var n=0,r=e.length;n<r;++n)t.push(j(e[n]))}else if(E.indexOf(e.constructor)>=0)t=e;else for(var i in t=e.constructor?Object.create(e.constructor.prototype):{},e)l(e,i)&&(t[i]=j(e[i]));return t}function K(e,t,n,r){return n=n||{},r=r||"",i(e).forEach(function(i){if(l(t,i)){var o=e[i],u=t[i];"object"==typeof o&&"object"==typeof u&&o&&u&&""+o.constructor==""+u.constructor?K(o,u,n,r+i+"."):o!==u&&(n[r+i]=t[i])}else n[r+i]=void 0}),i(t).forEach(function(i){l(e,i)||(n[r+i]=t[i])}),n}var C="undefined"!=typeof Symbol&&Symbol.iterator,A=C?function(e){var t;return null!=e&&(t=e[C])&&t.apply(e)}:function(){return null},S={};function I(e){var t,n,r,i;if(1===arguments.length){if(o(e))return e.slice();if(this===S&&"string"==typeof e)return[e];if(i=A(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var T="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function D(e,t){T=e,B=t}var B=function(){return!0},R=!new Error("").stack;function F(){if(R)try{throw new Error}catch(e){return e}return new Error}function q(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(B).map(function(e){return"\n"+e}).join("")):""}var M=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],N=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(M),U={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};function V(e,t){this._e=F(),this.name=e,this.message=t}function W(e,t){return e+". Errors: "+Object.keys(t).map(function(e){return t[e].toString()}).filter(function(e,t,n){return n.indexOf(e)===t}).join("\n")}function z(e,t,n,r){this._e=F(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=W(e,t)}function L(e,t){this._e=F(),this.name="BulkError",this.failures=t,this.message=W(e,t)}d(V).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+q(this._e,2))}},toString:function(){return this.name+": "+this.message}}),d(z).from(V),d(L).from(V);var Y=N.reduce(function(e,t){return e[t]=t+"Error",e},{}),G=V,H=N.reduce(function(e,t){var n=t+"Error";function r(e,r){this._e=F(),this.name=n,e?"string"==typeof e?(this.message=e+(r?"\n "+r:""),this.inner=r||null):"object"==typeof e&&(this.message=e.name+" "+e.message,this.inner=e):(this.message=U[t]||n,this.inner=null)}return d(r).from(G),e[t]=r,e},{});H.Syntax=SyntaxError,H.Type=TypeError,H.Range=RangeError;var Q=M.reduce(function(e,t){return e[t+"Error"]=H[t],e},{});var X=N.reduce(function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=H[t]),e},{});function J(){}function $(e){return e}function Z(e,t){return null==e||e===$?t:function(n){return t(e(n))}}function ee(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function te(e,t){return e===J?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?ee(r,this.onsuccess):r),i&&(this.onerror=this.onerror?ee(i,this.onerror):i),void 0!==o?o:n}}function ne(e,t){return e===J?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?ee(n,this.onsuccess):n),r&&(this.onerror=this.onerror?ee(r,this.onerror):r)}}function re(e,t){return e===J?t:function(n){var r=e.apply(this,arguments);a(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var u=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?ee(i,this.onsuccess):i),o&&(this.onerror=this.onerror?ee(o,this.onerror):o),void 0===r?void 0===u?void 0:u:a(r,u)}}function ie(e,t){return e===J?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function oe(e,t){return e===J?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}X.ModifyError=z,X.DexieError=V,X.BulkError=L;var ue={},ae=100,se=7,ce=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(t){var e=u.Promise;return e?[e.resolve(),e.prototype,e.resolve()]:[]}}(),le=ce[0],fe=ce[1],he=ce[2],pe=fe&&fe.then,de=le&&le.constructor,ye=ce[3],ve=!!he,me=!1,ge=he?function(){he.then(Me)}:u.setImmediate?setImmediate.bind(null,Me):u.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){Me(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(Me,0)},be=function(e,t){Ke.push([e,t]),we&&(ge(),we=!1)},_e=!0,we=!0,ke=[],xe=[],Oe=null,Pe=$,Ee={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:st,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{st(e[0],e[1])}catch(e){}})}},je=Ee,Ke=[],Ce=0,Ae=[];function Se(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=J,this._lib=!1;var t=this._PSD=je;if(T&&(this._stackHolder=F(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ue)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&De(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n(function(n){if(null===t._state){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&Ne();n&&"function"==typeof n.then?e(t,function(e,t){n instanceof Se?n._then(e,t):n.then(e,t)}):(t._state=!0,t._value=n,Be(t)),r&&Ue()}},De.bind(null,t))}catch(e){De(t,e)}}(this,e)}var Ie={get:function(){var e=je,t=Qe;function n(n,r){var i=this,o=!e.global&&(e!==je||t!==Qe);o&&Ze();var u=new Se(function(t,u){Re(i,new Te(ot(n,e,o),ot(r,e,o),t,u,e))});return T&&qe(u,this),u}return n.prototype=ue,n},set:function(e){p(this,"then",e&&e.prototype===ue?Ie:{get:function(){return e},set:Ie.set})}};function Te(e,t,n,r,i){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=i}function De(e,t){if(xe.push(t),null===e._state){var n=e._lib&&Ne();t=Pe(t),e._state=!1,e._value=t,T&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,n)}catch(e){t&&t(e)}}(function(){var n=function e(t,n){var r;return y(t,n)||(r=s(t))&&e(r,n)}(t,"stack");t._promise=e,p(t,"stack",{get:function(){return me?n&&(n.get?n.get.apply(t):n.value):e.stack}})}),function(e){ke.some(function(t){return t._value===e._value})||ke.push(e)}(e),Be(e),n&&Ue()}}function Be(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Re(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===Ce&&(++Ce,be(function(){0==--Ce&&Ve()},[]))}function Re(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++Ce,be(Fe,[n,e,t])}else e._listeners.push(t)}function Fe(e,t,n){try{Oe=t;var r,i=t._value;t._state?r=e(i):(xe.length&&(xe=[]),r=e(i),-1===xe.indexOf(i)&&function(e){var t=ke.length;for(;t;)if(ke[--t]._value===e._value)return void ke.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Oe=null,0==--Ce&&Ve(),--n.psd.ref||n.psd.finalize()}}function qe(e,t){var n=t?t._numPrev+1:0;n<ae&&(e._prev=t,e._numPrev=n)}function Me(){Ne()&&Ue()}function Ne(){var e=_e;return _e=!1,we=!1,e}function Ue(){var e,t,n;do{for(;Ke.length>0;)for(e=Ke,Ke=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Ke.length>0);_e=!0,we=!0}function Ve(){var e=ke;ke=[],e.forEach(function(e){e._PSD.onunhandled.call(null,e._value,e)});for(var t=Ae.slice(0),n=t.length;n;)t[--n]()}function We(e){return new Se(ue,!1,e)}function ze(e,t){var n=je;return function(){var r=Ne(),i=je;try{return nt(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{nt(i,!1),r&&Ue()}}}f(Se.prototype,{then:Ie,_then:function(e,t){Re(this,new Te(null,null,e,t,je))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,function(e){return e instanceof t?n(e):We(e)}):this.then(null,function(e){return e&&e.name===t?n(e):We(e)})},finally:function(e){return this.then(function(t){return e(),t},function(t){return e(),We(t)})},stack:{get:function(){if(this._stack)return this._stack;try{me=!0;var e=function e(t,n,r){if(n.length===r)return n;var i="";if(!1===t._state){var o,u,a=t._value;null!=a?(o=a.name||"Error",u=a.message||a,i=q(a,0)):(o=a,u=""),n.push(o+(u?": "+u:"")+i)}T&&((i=q(t._stackHolder,2))&&-1===n.indexOf(i)&&n.push(i),t._prev&&e(t._prev,n,r));return n}(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{me=!1}}},timeout:function(e,t){var n=this;return e<1/0?new Se(function(r,i){var o=setTimeout(function(){return i(new H.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,o))}):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&p(Se.prototype,Symbol.toStringTag,"Promise"),Ee.env=rt(),f(Se,{all:function(){var e=I.apply(null,arguments).map(et);return new Se(function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(function(i,o){return Se.resolve(i).then(function(n){e[o]=n,--r||t(e)},n)})})},resolve:function(e){if(e instanceof Se)return e;if(e&&"function"==typeof e.then)return new Se(function(t,n){e.then(t,n)});var t=new Se(ue,!0,e);return qe(t,Oe),t},reject:We,race:function(){var e=I.apply(null,arguments).map(et);return new Se(function(t,n){e.map(function(e){return Se.resolve(e).then(t,n)})})},PSD:{get:function(){return je},set:function(e){return je=e}},newPSD:Je,usePSD:it,scheduler:{get:function(){return be},set:function(e){be=e}},rejectionMapper:{get:function(){return Pe},set:function(e){Pe=e}},follow:function(e,t){return new Se(function(n,r){return Je(function(t,n){var r=je;r.unhandleds=[],r.onunhandled=n,r.finalize=ee(function(){var e=this;!function(e){Ae.push(function t(){e(),Ae.splice(Ae.indexOf(t),1)}),++Ce,be(function(){0==--Ce&&Ve()},[])}(function(){0===e.unhandleds.length?t():n(e.unhandleds[0])})},r.finalize),e()},t,n,r)})}});var Le={awaits:0,echoes:0,id:0},Ye=0,Ge=[],He=0,Qe=0,Xe=0;function Je(e,t,n,r){var i=je,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Xe;var u=Ee.env;o.env=ve?{Promise:Se,PromiseProp:{value:Se,configurable:!0,writable:!0},all:Se.all,race:Se.race,resolve:Se.resolve,reject:Se.reject,nthen:ut(u.nthen,o),gthen:ut(u.gthen,o)}:{},t&&a(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=it(o,e,n,r);return 0===o.ref&&o.finalize(),s}function $e(){return Le.id||(Le.id=++Ye),++Le.awaits,Le.echoes+=se,Le.id}function Ze(e){!Le.awaits||e&&e!==Le.id||(0==--Le.awaits&&(Le.id=0),Le.echoes=Le.awaits*se)}function et(e){return Le.echoes&&e&&e.constructor===de?($e(),e.then(function(e){return Ze(),e},function(e){return Ze(),ct(e)})):e}function tt(){var e=Ge[Ge.length-1];Ge.pop(),nt(e,!1)}function nt(e,t){var n,r=je;if((t?!Le.echoes||He++&&e===je:!He||--He&&e===je)||(n=t?function(e){++Qe,Le.echoes&&0!=--Le.echoes||(Le.echoes=Le.id=0),Ge.push(je),nt(e,!0)}.bind(null,e):tt,pe.call(le,n)),e!==je&&(je=e,r===Ee&&(Ee.env=rt()),ve)){var i=Ee.env.Promise,o=e.env;fe.then=o.nthen,i.prototype.then=o.gthen,(r.global||e.global)&&(Object.defineProperty(u,"Promise",o.PromiseProp),i.all=o.all,i.race=o.race,i.resolve=o.resolve,i.reject=o.reject)}}function rt(){var e=u.Promise;return ve?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(u,"Promise"),all:e.all,race:e.race,resolve:e.resolve,reject:e.reject,nthen:fe.then,gthen:e.prototype.then}:{}}function it(e,t,n,r,i){var o=je;try{return nt(e,!0),t(n,r,i)}finally{nt(o,!1)}}function ot(e,t,n){return"function"!=typeof e?e:function(){var r=je;n&&$e(),nt(t,!0);try{return e.apply(this,arguments)}finally{nt(r,!1)}}}function ut(e,t){return function(n,r){return e.call(this,ot(n,t,!1),ot(r,t,!1))}}var at="unhandledrejection";function st(e,t){var n;try{n=t.onuncatched(e)}catch(e){}if(!1!==n)try{var r,i={promise:t,reason:e};if(u.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(at,!0,!0),a(r,i)):u.CustomEvent&&a(r=new CustomEvent(at,{detail:i}),i),r&&u.dispatchEvent&&(dispatchEvent(r),!u.PromiseRejectionEvent&&u.onunhandledrejection))try{u.onunhandledrejection(r)}catch(e){}T&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch(e){}}var ct=Se.reject;var lt=String.fromCharCode(65535),ft="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",ht="String expected.",pt=[],dt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),yt=dt,vt=dt,mt=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},gt="__dbnames";function bt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var _t={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1},wt=function(){function e(){}return e.prototype._trans=function(e,t,n){var r=this._tx||je.trans,i=this.name;function o(e,n,r){if(!r.schema[i])throw new H.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var u=Ne();try{return r&&r.db===this.db?r===je.trans?r._promise(e,o,n):Je(function(){return r._promise(e,o,n)},{trans:r,transless:je.transless||je}):function e(t,n,r,i){if(t._state.openComplete||je.letThrough){var o=t._createTransaction(n,r,t._dbSchema);try{o.create()}catch(e){return ct(e)}return o._promise(n,function(e,t){return Je(function(){return je.trans=o,i(e,t,o)})}).then(function(e){return o._completion.then(function(){return e})})}if(!t._state.isBeingOpened){if(!t._options.autoOpen)return ct(new H.DatabaseClosed);t.open().catch(J)}return t._state.dbReadyPromise.then(function(){return e(t,n,r,i)})}(this.db,e,[this.name],o)}finally{u&&Ue()}},e.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",function(t){return n.core.get({trans:t,key:e}).then(function(e){return n.hook.reading.fire(e)})}).then(t)},e.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(o(e))return new this.db.WhereClause(this,"["+e.join("+")+"]");var t=i(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter(function(e){return e.compound&&t.every(function(t){return e.keyPath.indexOf(t)>=0})&&e.keyPath.every(function(e){return t.indexOf(e)>=0})})[0];if(n&&this.db._maxKey!==lt)return this.where(n.name).equals(n.keyPath.map(function(t){return e[t]}));!n&&T&&console.warn("The query "+JSON.stringify(e)+" on "+this.name+" would benefit of a compound index ["+t.join("+")+"]");var r=this.schema.idxByName,u=this.db._deps.indexedDB;function a(e,t){try{return 0===u.cmp(e,t)}catch(e){return!1}}var s=t.reduce(function(t,n){var i=t[0],u=t[1],s=r[n],c=e[n];return[i||s,i||!s?bt(u,s&&s.multi?function(e){var t=w(e,n);return o(t)&&t.some(function(e){return a(c,e)})}:function(e){return a(c,w(e,n))}):u]},[null,null]),c=s[0],l=s[1];return c?this.where(c.name).equals(e[c.keyPath]).filter(l):n?this.filter(l):this.where(t).equals("")},e.prototype.filter=function(e){return this.toCollection().and(e)},e.prototype.count=function(e){return this.toCollection().count(e)},e.prototype.offset=function(e){return this.toCollection().offset(e)},e.prototype.limit=function(e){return this.toCollection().limit(e)},e.prototype.each=function(e){return this.toCollection().each(e)},e.prototype.toArray=function(e){return this.toCollection().toArray(e)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,o(e)?"["+e.join("+")+"]":e))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(e){this.schema.mappedClass=e;var t=function(t){if(!t)return t;var n=Object.create(e.prototype);for(var r in t)if(l(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e},e.prototype.defineClass=function(){return this.mapToClass(function(e){a(this,e)})},e.prototype.add=function(e,t){var n=this;return this._trans("readwrite",function(r){return n.core.mutate({trans:r,type:"add",keys:null!=t?[t]:null,values:[e]})}).then(function(e){return e.numFailures?Se.reject(e.failures[0]):e.lastResult}).then(function(t){if(!n.core.schema.primaryKey.outbound)try{k(e,n.core.schema.primaryKey.keyPath,t)}catch(e){}return t})},e.prototype.update=function(e,t){if("object"!=typeof t||o(t))throw new H.InvalidArgument("Modifications must be an object.");if("object"!=typeof e||o(e))return this.where(":id").equals(e).modify(t);i(t).forEach(function(n){k(e,n,t[n])});var n=w(e,this.schema.primKey.keyPath);return void 0===n?ct(new H.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(n).modify(t)},e.prototype.put=function(e,t){var n=this;return this._trans("readwrite",function(r){return n.core.mutate({trans:r,type:"put",values:[e],keys:null!=t?[t]:null})}).then(function(e){return e.numFailures?Se.reject(e.failures[0]):e.lastResult}).then(function(t){if(!n.core.schema.primaryKey.outbound)try{k(e,n.core.schema.primaryKey.keyPath,t)}catch(e){}return t})},e.prototype.delete=function(e){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]})}).then(function(e){return e.numFailures?Se.reject(e.failures[0]):void 0})},e.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:_t})}).then(function(e){return e.numFailures?Se.reject(e.failures[0]):void 0})},e.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",function(n){return t.core.getMany({keys:e,trans:n})})},e.prototype.bulkAdd=function(e,t){var n=this;return this._trans("readwrite",function(r){if(!n.core.schema.primaryKey.outbound&&t)throw new H.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(t&&t.length!==e.length)throw new H.InvalidArgument("Arguments objects and keys must have the same length");return n.core.mutate({trans:r,type:"add",keys:t,values:e}).then(function(t){var r=t.numFailures,i=t.lastResult,o=t.failures;if(0===r)return i;throw new L(n.name+".bulkAdd(): "+r+" of "+e.length+" operations failed",Object.keys(o).map(function(e){return o[e]}))})})},e.prototype.bulkPut=function(e,t){var n=this;return this._trans("readwrite",function(r){if(!n.core.schema.primaryKey.outbound&&t)throw new H.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(t&&t.length!==e.length)throw new H.InvalidArgument("Arguments objects and keys must have the same length");return n.core.mutate({trans:r,type:"put",keys:t,values:e}).then(function(t){var r=t.numFailures,i=t.lastResult,o=t.failures;if(0===r)return i;throw new L(n.name+".bulkPut(): "+r+" of "+e.length+" operations failed",Object.keys(o).map(function(e){return o[e]}))})})},e.prototype.bulkDelete=function(e){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:e})}).then(function(n){var r=n.numFailures,i=n.lastResult,o=n.failures;if(0===r)return i;throw new L(t.name+".bulkDelete(): "+r+" of "+e.length+" operations failed",o)})},e}();function kt(e){var t={},n=function(n,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return t[n].subscribe.apply(null,o),e}if("string"==typeof n)return t[n]};n.addEventType=a;for(var r=1,u=arguments.length;r<u;++r)a(arguments[r]);return n;function a(e,r,u){if("object"!=typeof e){var s;r||(r=ie),u||(u=J);var c={subscribers:[],fire:u,subscribe:function(e){-1===c.subscribers.indexOf(e)&&(c.subscribers.push(e),c.fire=r(c.fire,e))},unsubscribe:function(e){c.subscribers=c.subscribers.filter(function(t){return t!==e}),c.fire=c.subscribers.reduce(r,u)}};return t[e]=n[e]=c,c}i(s=e).forEach(function(e){var t=s[e];if(o(t))a(e,s[e][0],s[e][1]);else{if("asap"!==t)throw new H.InvalidArgument("Invalid event config");var n=a(e,$,function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach(function(e){_(function(){e.apply(null,t)})})})}})}}function xt(e,t){return d(t).from({prototype:e}),t}function Ot(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Pt(e,t){e.filter=bt(e.filter,t)}function Et(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return bt(r(),t())}:t,e.justLimit=n&&!r}function jt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new H.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Kt(e,t,n){var r=jt(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function Ct(e,t,n,r){var i=e.replayFilter?bt(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},u=function(e,n,r){if(!i||i(n,r,function(e){return n.stop(e)},function(e){return n.fail(e)})){var u=n.primaryKey,a=""+u;"[object ArrayBuffer]"===a&&(a=""+new Uint8Array(u)),l(o,a)||(o[a]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(u,n),At(Kt(e,r,n),e.algorithm,u,!e.keysOnly&&e.valueMapper)])}return At(Kt(e,r,n),bt(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function At(e,t,n,r){var i=ze(r?function(e,t,i){return n(r(e),t,i)}:n);return e.then(function(e){if(e)return e.start(function(){var n=function(){return e.continue()};t&&!t(e,function(e){return n=e},function(t){e.stop(t),n=J},function(t){e.fail(t),n=J})||i(e.value,e,function(e){return n=e}),n()})})}var St=function(){function e(){}return e.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,ct.bind(null,n.error)):n.table._trans("readonly",e).then(t)},e.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,ct.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},e.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=bt(t.algorithm,e)},e.prototype._iterate=function(e,t){return Ct(this._ctx,e,t,this._ctx.table.core)},e.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&a(n,e),t._ctx=n,t},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(e){var t=this._ctx;return this._read(function(n){return Ct(t,e,n,t.table.core)})},e.prototype.count=function(e){var t=this;return this._read(function(e){var n=t._ctx,r=n.table.core;if(Ot(n,!0))return r.count({trans:e,query:{index:jt(n,r.schema),range:n.range}}).then(function(e){return Math.min(e,n.limit)});var i=0;return Ct(n,function(){return++i,!1},e,r).then(function(){return i})}).then(e)},e.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var u="next"===this._ctx.dir?1:-1;function a(e,t){var n=o(e,i),r=o(t,i);return n<r?-u:n>r?u:0}return this.toArray(function(e){return e.sort(a)}).then(t)},e.prototype.toArray=function(e){var t=this;return this._read(function(e){var n=t._ctx;if("next"===n.dir&&Ot(n,!0)&&n.limit>0){var r=n.valueMapper,i=jt(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:i,range:n.range}}).then(function(e){var t=e.result;return r?t.map(r):t})}var o=[];return Ct(n,function(e){return o.push(e)},e,n.table.core).then(function(){return o})},e)},e.prototype.offset=function(e){var t=this._ctx;return e<=0?this:(t.offset+=e,Ot(t)?Et(t,function(){var t=e;return function(e,n){return 0===t||(1===t?(--t,!1):(n(function(){e.advance(t),t=0}),!1))}}):Et(t,function(){var t=e;return function(){return--t<0}}),this)},e.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Et(this._ctx,function(){var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}},!0),this},e.prototype.until=function(e,t){return Pt(this._ctx,function(n,r,i){return!e(n.value)||(r(i),t)}),this},e.prototype.first=function(e){return this.limit(1).toArray(function(e){return e[0]}).then(e)},e.prototype.last=function(e){return this.reverse().first(e)},e.prototype.filter=function(e){var t,n;return Pt(this._ctx,function(t){return e(t.value)}),t=this._ctx,n=e,t.isMatch=bt(t.isMatch,n),this},e.prototype.and=function(e){return this.filter(e)},e.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},e.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.key,n)})},e.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},e.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.primaryKey,n)})},e.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.key)}).then(function(){return n}).then(e)},e.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&Ot(t,!0)&&t.limit>0)return this._read(function(e){var n=jt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})}).then(function(e){return e.result}).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.primaryKey)}).then(function(){return n}).then(e)},e.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},e.prototype.firstKey=function(e){return this.limit(1).keys(function(e){return e[0]}).then(e)},e.prototype.lastKey=function(e){return this.reverse().firstKey(e)},e.prototype.distinct=function(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Pt(this._ctx,function(e){var t=e.primaryKey.toString(),r=l(n,t);return n[t]=!0,!r}),this},e.prototype.modify=function(e){var t=this,n=this._ctx;return this._write(function(r){var o;if("function"==typeof e)o=e;else{var u=i(e),a=u.length;o=function(t){for(var n=!1,r=0;r<a;++r){var i=u[r],o=e[i];w(t,i)!==o&&(k(t,i,o),n=!0)}return n}}var s=n.table.core,c=s.schema.primaryKey,l=c.outbound,f=c.extractKey,h="testmode"in _n?1:2e3,p=t.db.core.cmp,d=[],y=0,v=[],m=function(e,t){var n=t.failures,r=t.numFailures;for(var i in y+=e-r,n)d.push(n[i])};return t.clone().primaryKeys().then(function(e){var t=function(n){var i=Math.min(h,e.length-n);return s.getMany({trans:r,keys:e.slice(n,n+i)}).then(function(u){for(var a=[],c=[],d=l?[]:null,y=[],v=0;v<i;++v){var g=u[v],b={value:j(g),primKey:e[n+v]};!1!==o.call(b,b.value,b)&&(null==b.value?y.push(e[n+v]):l||0===p(f(g),f(b.value))?(c.push(b.value),l&&d.push(e[n+v])):(y.push(e[n+v]),a.push(b.value)))}return Promise.resolve(a.length>0&&s.mutate({trans:r,type:"add",values:a}).then(function(e){for(var t in e.failures)y.splice(parseInt(t),1);m(a.length,e)})).then(function(e){return c.length>0&&s.mutate({trans:r,type:"put",keys:d,values:c}).then(function(e){return m(c.length,e)})}).then(function(){return y.length>0&&s.mutate({trans:r,type:"delete",keys:y}).then(function(e){return m(y.length,e)})}).then(function(){return e.length>n+i&&t(n+h)})})};return t(0).then(function(){if(d.length>0)throw new z("Error modifying one or more objects",d,y,v);return e.length})})})},e.prototype.delete=function(){var e=this._ctx,t=e.range;return Ot(e)&&(e.isPrimKey&&!vt||3===t.type)?this._write(function(n){var r=e.table.core.schema.primaryKey,i=t;return e.table.core.count({trans:n,query:{index:r,range:i}}).then(function(t){return e.table.core.mutate({trans:n,type:"deleteRange",range:i}).then(function(e){var n=e.failures,r=(e.lastResult,e.results,e.numFailures);if(r)throw new z("Could not delete some values",Object.keys(n).map(function(e){return n[e]}),t-r);return t-r})})}):this.modify(function(e,t){return t.value=null})},e}();function It(e,t){return e<t?-1:e===t?0:1}function Tt(e,t){return e>t?-1:e===t?0:1}function Dt(e,t,n){var r=e instanceof Nt?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Bt(e){return new e.Collection(e,function(){return Mt("")}).limit(0)}function Rt(e,t,n,r,i,o){for(var u=Math.min(e.length,r.length),a=-1,s=0;s<u;++s){var c=t[s];if(c!==r[s])return i(e[s],n[s])<0?e.substr(0,s)+n[s]+n.substr(s+1):i(e[s],r[s])<0?e.substr(0,s)+r[s]+n.substr(s+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;i(e[s],c)<0&&(a=s)}return u<r.length&&"next"===o?e+n.substr(e.length):u<e.length&&"prev"===o?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function Ft(e,t,n,r){var i,o,u,a,s,c,l,f=n.length;if(!n.every(function(e){return"string"==typeof e}))return Dt(e,ht);function h(e){i=function(e){return"next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()}}(e),o=function(e){return"next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()}}(e),u="next"===e?It:Tt;var t=n.map(function(e){return{lower:o(e),upper:i(e)}}).sort(function(e,t){return u(e.lower,t.lower)});a=t.map(function(e){return e.upper}),s=t.map(function(e){return e.lower}),c=e,l="next"===e?"":r}h("next");var p=new e.Collection(e,function(){return qt(a[0],s[f-1]+r)});p._ondirectionchange=function(e){h(e)};var d=0;return p._addAlgorithm(function(e,n,r){var i=e.key;if("string"!=typeof i)return!1;var h=o(i);if(t(h,s,d))return!0;for(var p=null,y=d;y<f;++y){var v=Rt(i,h,a[y],s[y],u,c);null===v&&null===p?d=y+1:(null===p||u(p,v)>0)&&(p=v)}return n(null!==p?function(){e.continue(p+l)}:r),!1}),p}function qt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Mt(e){return{type:1,lower:e,upper:e}}var Nt=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!0,configurable:!0}),e.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?Bt(this):new this.Collection(this,function(){return qt(e,t,!n,!r)})}catch(e){return Dt(this,ft)}},e.prototype.equals=function(e){return new this.Collection(this,function(){return Mt(e)})},e.prototype.above=function(e){return null==e?Dt(this,ft):new this.Collection(this,function(){return qt(e,void 0,!0)})},e.prototype.aboveOrEqual=function(e){return null==e?Dt(this,ft):new this.Collection(this,function(){return qt(e,void 0,!1)})},e.prototype.below=function(e){return null==e?Dt(this,ft):new this.Collection(this,function(){return qt(void 0,e,!1,!0)})},e.prototype.belowOrEqual=function(e){return null==e?Dt(this,ft):new this.Collection(this,function(){return qt(void 0,e)})},e.prototype.startsWith=function(e){return"string"!=typeof e?Dt(this,ht):this.between(e,e+lt,!0,!0)},e.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):Ft(this,function(e,t){return 0===e.indexOf(t[0])},[e],lt)},e.prototype.equalsIgnoreCase=function(e){return Ft(this,function(e,t){return e===t[0]},[e],"")},e.prototype.anyOfIgnoreCase=function(){var e=I.apply(S,arguments);return 0===e.length?Bt(this):Ft(this,function(e,t){return-1!==t.indexOf(e)},e,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var e=I.apply(S,arguments);return 0===e.length?Bt(this):Ft(this,function(e,t){return t.some(function(t){return 0===e.indexOf(t)})},e,lt)},e.prototype.anyOf=function(){var e=this,t=I.apply(S,arguments),n=this._cmp;try{t.sort(n)}catch(e){return Dt(this,ft)}if(0===t.length)return Bt(this);var r=new this.Collection(this,function(){return qt(t[0],t[t.length-1])});r._ondirectionchange=function(r){n="next"===r?e._ascending:e._descending,t.sort(n)};var i=0;return r._addAlgorithm(function(e,r,o){for(var u=e.key;n(u,t[i])>0;)if(++i===t.length)return r(o),!1;return 0===n(u,t[i])||(r(function(){e.continue(t[i])}),!1)}),r},e.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var e=I.apply(S,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Dt(this,ft)}var t=e.reduce(function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,u=this._min,a=this._max;if(0===e.length)return Bt(this);if(!e.every(function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0}))return Dt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",H.InvalidArgument);var s=!t||!1!==t.includeLowers,c=t&&!0===t.includeUppers;var l,f=i;function h(e,t){return f(e[0],t[0])}try{(l=e.reduce(function(e,t){for(var n=0,i=e.length;n<i;++n){var o=e[n];if(r(t[0],o[1])<0&&r(t[1],o[0])>0){o[0]=u(o[0],t[0]),o[1]=a(o[1],t[1]);break}}return n===i&&e.push(t),e},[])).sort(h)}catch(e){return Dt(this,ft)}var p=0,d=c?function(e){return i(e,l[p][1])>0}:function(e){return i(e,l[p][1])>=0},y=s?function(e){return o(e,l[p][0])>0}:function(e){return o(e,l[p][0])>=0};var v=d,m=new this.Collection(this,function(){return qt(l[0][0],l[l.length-1][1],!s,!c)});return m._ondirectionchange=function(e){"next"===e?(v=d,f=i):(v=y,f=o),l.sort(h)},m._addAlgorithm(function(e,t,r){for(var o=e.key;v(o);)if(++p===l.length)return t(r),!1;return!!function(e){return!d(e)&&!y(e)}(o)||0!==n._cmp(o,l[p][1])&&0!==n._cmp(o,l[p][0])&&(t(function(){f===i?e.continue(l[p][0]):e.continue(l[p][1])}),!1)}),m},e.prototype.startsWithAnyOf=function(){var e=I.apply(S,arguments);return e.every(function(e){return"string"==typeof e})?0===e.length?Bt(this):this.inAnyRange(e.map(function(e){return[e,e+lt]})):Dt(this,"startsWithAnyOf() only works with strings")},e}();function Ut(e){return 1===e.length?e[0]:e}function Vt(e){try{return e.only([[]]),[[]]}catch(e){return lt}}function Wt(e){return ze(function(t){return zt(t),e(t.target.error),!1})}function zt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Lt=function(){function e(){}return e.prototype._lock=function(){return b(!je.global),++this._reculock,1!==this._reculock||je.global||(je.lockOwnerFor=this),this},e.prototype._unlock=function(){if(b(!je.global),0==--this._reculock)for(je.global||(je.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{it(e[1],e[0])}catch(e){}}return this},e.prototype._locked=function(){return this._reculock&&je.lockOwnerFor!==this},e.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new H.DatabaseClosed(r);case"MissingAPIError":throw new H.MissingAPI(r.message,r);default:throw new H.OpenFailed(r)}if(!this.active)throw new H.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||n.transaction(Ut(this.storeNames),this.mode)).onerror=ze(function(n){zt(n),t._reject(e.error)}),e.onabort=ze(function(n){zt(n),t.active&&t._reject(new H.Abort(e.error)),t.active=!1,t.on("abort").fire(n)}),e.oncomplete=ze(function(){t.active=!1,t._resolve()}),this},e.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return ct(new H.ReadOnly("Transaction is readonly"));if(!this.active)return ct(new H.TransactionInactive);if(this._locked())return new Se(function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},je])});if(n)return Je(function(){var e=new Se(function(e,n){r._lock();var i=t(e,n,r);i&&i.then&&i.then(e,n)});return e.finally(function(){return r._unlock()}),e._lib=!0,e});var i=new Se(function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)});return i._lib=!0,i},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(e){var t=this._root(),n=Se.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then(function(){return n});else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var i=t._waitingFor;return new Se(function(e,r){n.then(function(n){return t._waitingQueue.push(ze(e.bind(null,n)))},function(e){return t._waitingQueue.push(ze(r.bind(null,e)))}).finally(function(){t._waitingFor===i&&(t._waitingFor=null)})})},e.prototype.abort=function(){this.active&&this._reject(new H.Abort),this.active=!1},e.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(l(t,e))return t[e];var n=this.schema[e];if(!n)throw new H.NotFound("Table "+e+" not part of transaction");var r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r},e}();function Yt(e,t,n,r,i,o){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n?"&":"")+(r?"*":"")+(i?"++":"")+Gt(t)}}function Gt(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Ht(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=n,i=function(e){return[e.name,e]},r.reduce(function(e,t,n){var r=i(t,n);return r&&(e[r[0]]=r[1]),e},{}))};var r,i}function Qt(e){return null==e?function(){}:"string"==typeof e?function(e){return 1===e.split(".").length?function(t){return t[e]}:function(t){return w(t,e)}}(e):function(t){return w(t,e)}}function Xt(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}function Jt(e){return[].slice.call(e)}var $t=0;function Zt(e){return null==e?":id":"string"==typeof e?e:"["+e.join("+")+"]"}function en(e,t,n,r){var i=t.cmp.bind(t);function u(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var t=e.lower,r=e.upper,i=e.lowerOpen,o=e.upperOpen;return void 0===t?void 0===r?null:n.upperBound(r,!!o):void 0===r?n.lowerBound(t,!!i):n.bound(t,r,!!i,!!o)}var a=function(e,t){var n=Jt(e.objectStoreNames);return{schema:{name:e.name,tables:n.map(function(e){return t.objectStore(e)}).map(function(e){var t=e.keyPath,n=e.autoIncrement,r=o(t),i=null==t,u={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Qt(t)},indexes:Jt(e.indexNames).map(function(t){return e.index(t)}).map(function(e){var t=e.name,n=e.unique,r=e.multiEntry,i=e.keyPath,a={name:t,compound:o(i),keyPath:i,unique:n,multiEntry:r,extractKey:Qt(i)};return u[Zt(i)]=a,a}),getIndexByKeyPath:function(e){return u[Zt(e)]}};return u[":id"]=a.primaryKey,null!=t&&(u[Zt(t)]=a.primaryKey),a})},hasGetAll:n.length>0&&"getAll"in t.objectStore(n[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,r),s=a.schema,c=a.hasGetAll,l=s.tables.map(function(e){return function(e){var t=e.name;return{name:t,schema:e,mutate:function(n){var r=n.trans,i=n.type,o=n.keys,a=n.values,s=n.range,c=n.wantResults;return new Promise(function(n,l){n=ze(n);var f=r.objectStore(t),h=null==f.keyPath,p="put"===i||"add"===i;if(!p&&"delete"!==i&&"deleteRange"!==i)throw new Error("Invalid operation type: "+i);var d=(o||a||{length:1}).length;if(o&&a&&o.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return n({numFailures:0,failures:{},results:[],lastResult:void 0});var y,v=c&&(o||Xt(e.primaryKey,{type:i,keys:o,values:a})).slice(),m=[],g=0,b=function(e){++g,zt(e),v&&(v[e.target._reqno]=void 0),m[e.target._reqno]=e.target.error},_=function(e){var t=e.target;v[t._reqno]=t.result};if("deleteRange"===i){if(4===s.type)return n({numFailures:g,failures:m,results:v,lastResult:void 0});y=3===s.type?f.clear():f.delete(u(s))}else{var w=p?h?[a,o]:[a,null]:[o,null],k=w[0],x=w[1];if(p)for(var O=0;O<d;++O)(y=x&&void 0!==x[O]?f[i](k[O],x[O]):f[i](k[O]))._reqno=O,v&&void 0===v[O]&&(y.onsuccess=_),y.onerror=b;else for(O=0;O<d;++O)(y=f[i](k[O]))._reqno=O,y.onerror=b}var P=function(e){var t=e.target.result;v&&(v[d-1]=t),n({numFailures:g,failures:m,results:v,lastResult:t})};y.onerror=function(e){b(e),P(e)},y.onsuccess=P})},getMany:function(e){var n=e.trans,r=e.keys;return new Promise(function(e,i){e=ze(e);for(var o,u=n.objectStore(t),a=r.length,s=new Array(a),c=0,l=0,f=function(t){var n=t.target;null!=(s[n._pos]=n.result)&&0,++l===c&&e(s)},h=Wt(i),p=0;p<a;++p){null!=r[p]&&((o=u.get(r[p]))._pos=p,o.onsuccess=f,o.onerror=h,++c)}0===c&&e(s)})},get:function(e){var n=e.trans,r=e.key;return new Promise(function(e,i){e=ze(e);var o=n.objectStore(t).get(r);o.onsuccess=function(t){return e(t.target.result)},o.onerror=Wt(i)})},query:function(e){return function(n){return new Promise(function(r,i){r=ze(r);var o=n.trans,a=n.values,s=n.limit,c=n.query,l=s===1/0?void 0:s,f=c.index,h=c.range,p=o.objectStore(t),d=f.isPrimaryKey?p:p.index(f.name),y=u(h);if(0===s)return r({result:[]});if(e){var v=a?d.getAll(y,l):d.getAllKeys(y,l);v.onsuccess=function(e){return r({result:e.target.result})},v.onerror=Wt(i)}else{var m=0,g=!a&&"openKeyCursor"in d?d.openKeyCursor(y):d.openCursor(y),b=[];g.onsuccess=function(e){var t=g.result;return t?(b.push(a?t.value:t.primaryKey),++m===s?r({result:b}):void t.continue()):r({result:b})},g.onerror=Wt(i)}})}}(c),openCursor:function(e){var n=e.trans,r=e.values,i=e.query,o=e.reverse,a=e.unique;return new Promise(function(e,s){e=ze(e);var c=i.index,l=i.range,f=n.objectStore(t),h=c.isPrimaryKey?f:f.index(c.name),p=o?a?"prevunique":"prev":a?"nextunique":"next",d=!r&&"openKeyCursor"in h?h.openKeyCursor(u(l),p):h.openCursor(u(l),p);d.onerror=Wt(s),d.onsuccess=ze(function(t){var r=d.result;if(r){r.___id=++$t,r.done=!1;var i=r.continue.bind(r),o=r.continuePrimaryKey;o&&(o=o.bind(r));var u=r.advance.bind(r),a=function(){throw new Error("Cursor not stopped")};r.trans=n,r.stop=r.continue=r.continuePrimaryKey=r.advance=function(){throw new Error("Cursor not started")},r.fail=ze(s),r.next=function(){var e=this,t=1;return this.start(function(){return t--?e.continue():e.stop()}).then(function(){return e})},r.start=function(e){var t=new Promise(function(e,t){e=ze(e),d.onerror=Wt(t),r.fail=t,r.stop=function(t){r.stop=r.continue=r.continuePrimaryKey=r.advance=a,e(t)}}),n=function(){if(d.result)try{e()}catch(e){r.fail(e)}else r.done=!0,r.start=function(){throw new Error("Cursor behind last entry")},r.stop()};return d.onsuccess=ze(function(e){d.onsuccess=n,n()}),r.continue=i,r.continuePrimaryKey=o,r.advance=u,n(),t},e(r)}else e(null)},s)})},count:function(e){var n=e.query,r=e.trans,i=n.index,o=n.range;return new Promise(function(e,n){var a=r.objectStore(t),s=i.isPrimaryKey?a:a.index(i.name),c=u(o),l=c?s.count(c):s.count();l.onsuccess=ze(function(t){return e(t.target.result)}),l.onerror=Wt(n)})}}}(e)}),f={};return l.forEach(function(e){return f[e.name]=e}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!f[e])throw new Error("Table '"+e+"' not found");return f[e]},cmp:i,MIN_KEY:-1/0,MAX_KEY:Vt(n),schema:s}}function tn(e,t,n,i){var o=n.IDBKeyRange;return{dbcore:function(e,t){return t.reduce(function(e,t){var n=t.create;return r({},e,n(e))},e)}(en(t,n.indexedDB,o,i),e.dbcore)}}function nn(e,t){var n=t.db,r=tn(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach(function(t){var n=t.name;e.core.schema.tables.some(function(e){return e.name===n})&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))})}function rn(e,t,n,r){n.forEach(function(n){var i=r[n];t.forEach(function(t){n in t||(t===e.Transaction.prototype||t instanceof e.Transaction?p(t,n,{get:function(){return this.table(n)}}):t[n]=new e.Table(n,i))})})}function on(e,t){t.forEach(function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]})}function un(e,t){return e._cfg.version-t._cfg.version}function an(e,t,n,r){var o=e._dbSchema,u=e._createTransaction("readwrite",e._storeNames,o);u.create(n),u._completion.catch(r);var a=u._reject.bind(u),s=je.transless||je;Je(function(){je.trans=u,je.transless=s,0===t?(i(o).forEach(function(e){sn(n,e,o[e].primKey,o[e].indexes)}),nn(e,n),Se.follow(function(){return e.on.populate.fire(u)}).catch(a)):function(e,t,n,r){var o=[],u=e._versions,a=u.filter(function(e){return e._cfg.version===t})[0];if(!a)throw new H.Upgrade("Dexie specification of currently installed DB version is missing");var s=e._dbSchema=a._cfg.dbschema,c=!1;return u.filter(function(e){return e._cfg.version>t}).forEach(function(t){o.push(function(){var o=s,u=t._cfg.dbschema;ln(e,o,r),ln(e,u,r),s=e._dbSchema=u;var a=function(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var i=e[n],o=t[n];if(i){var u={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(i.primKey.src!==o.primKey.src)u.recreate=!0,r.change.push(u);else{var a=i.idxByName,s=o.idxByName,c=void 0;for(c in a)s[c]||u.del.push(c);for(c in s){var l=a[c],f=s[c];l?l.src!==f.src&&u.change.push(f):u.add.push(f)}(u.del.length>0||u.add.length>0||u.change.length>0)&&r.change.push(u)}}else r.add.push([n,o])}return r}(o,u);a.add.forEach(function(e){sn(r,e[0],e[1].primKey,e[1].indexes)}),a.change.forEach(function(e){if(e.recreate)throw new H.Upgrade("Not yet support for changing primary key");var t=r.objectStore(e.name);e.add.forEach(function(e){return cn(t,e)}),e.change.forEach(function(e){t.deleteIndex(e.name),cn(t,e)}),e.del.forEach(function(e){return t.deleteIndex(e)})});var l=t._cfg.contentUpgrade;if(l){nn(e,r),c=!0;var f,h=x(u);a.del.forEach(function(e){h[e]=o[e]}),on(e,[e.Transaction.prototype]),rn(e,[e.Transaction.prototype],i(h),h),n.schema=h,l.constructor===ye&&$e();var p=Se.follow(function(){if((f=l(n))&&f.constructor===de){var e=Ze.bind(null,null);f.then(e,e)}});return f&&"function"==typeof f.then?Se.resolve(f):p.then(function(){return f})}}),o.push(function(r){c&&yt||function(e,t){for(var n=0;n<t.db.objectStoreNames.length;++n){var r=t.db.objectStoreNames[n];null==e[r]&&t.db.deleteObjectStore(r)}}(t._cfg.dbschema,r);on(e,[e.Transaction.prototype]),rn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema})}),function e(){return o.length?Se.resolve(o.shift()(n.idbtrans)).then(e):Se.resolve()}().then(function(){var e,t;t=r,i(e=s).forEach(function(n){t.db.objectStoreNames.contains(n)||sn(t,n,e[n].primKey,e[n].indexes)})})}(e,t,u,n).catch(a)})}function sn(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(e){return cn(i,e)}),i}function cn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function ln(e,t,n){for(var r=n.db.objectStoreNames,i=0;i<r.length;++i){var o=r[i],a=n.objectStore(o);e._hasGetAll="getAll"in a;for(var s=0;s<a.indexNames.length;++s){var c=a.indexNames[s],l=a.index(c).keyPath,f="string"==typeof l?l:"["+m(l).join("+")+"]";if(t[o]){var h=t[o].idxByName[f];h&&(h.name=c)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&u.WorkerGlobalScope&&u instanceof u.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}var fn,hn=function(){function e(){}return e.prototype._parseStoresSpec=function(e,t){i(e).forEach(function(n){if(null!==e[n]){var r=function(e){var t=[];return e.split(",").forEach(function(e){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;t.push(Yt(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),o(r)))}),t}(e[n]),i=r.shift();if(i.multi)throw new H.Schema("Primary key cannot be multi-valued");r.forEach(function(e){if(e.auto)throw new H.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new H.Schema("Index must have a name and cannot be an empty string")}),t[n]=Ht(n,i,r)}})},e.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?a(this._cfg.storesSource,e):e;var n=t._versions,r={};n.forEach(function(e){a(r,e._cfg.storesSource)});var o=this._cfg.dbschema={};return this._parseStoresSpec(r,o),t._dbSchema=o,on(t,[t._allTables,t,t.Transaction.prototype]),rn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],i(o),o),t._storeNames=i(o),this},e.prototype.upgrade=function(e){return this._cfg.contentUpgrade=e,this},e}();function pn(e){return Je(function(){return je.letThrough=!0,e()})}function dn(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?ct(t.dbOpenError):e});T&&(t.openCanceller._stackHolder=F()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.dbReadyResolve,o=null;return Se.race([t.openCanceller,new Se(function(r,u){if(!n)throw new H.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 a=e.name,s=t.autoSchema?n.open(a):n.open(a,Math.round(10*e.verno));if(!s)throw new H.MissingAPI("IndexedDB API not available");s.onerror=Wt(u),s.onblocked=ze(e._fireOnBlocked),s.onupgradeneeded=ze(function(r){if(o=s.transaction,t.autoSchema&&!e._options.allowEmptyDB){s.onerror=zt,o.abort(),s.result.close();var i=n.deleteDatabase(a);i.onsuccess=i.onerror=ze(function(){u(new H.NoSuchDatabase("Database "+a+" doesnt exist"))})}else{o.onerror=Wt(u);var c=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;an(e,c/10,o,u)}},u),s.onsuccess=ze(function(){o=null;var n=e.idbdb=s.result,u=m(n.objectStoreNames);if(u.length>0)try{var c=n.transaction(Ut(u),"readonly");t.autoSchema?function(e,t,n){e.verno=t.version/10;var r=e._dbSchema={},o=e._storeNames=m(t.objectStoreNames,0);0!==o.length&&(o.forEach(function(e){for(var t=n.objectStore(e),i=t.keyPath,o=Yt(Gt(i),i||"",!1,!1,!!t.autoIncrement,i&&"string"!=typeof i),u=[],a=0;a<t.indexNames.length;++a){var s=t.index(t.indexNames[a]);i=s.keyPath;var c=Yt(s.name,i,!!s.unique,!!s.multiEntry,!1,i&&"string"!=typeof i);u.push(c)}r[e]=Ht(e,o,u)}),rn(e,[e._allTables],i(r),r))}(e,n,c):ln(e,e._dbSchema,c),nn(e,c)}catch(e){}pt.push(e),n.onversionchange=ze(function(n){t.vcFired=!0,e.on("versionchange").fire(n)}),fn.add(a),r()},u)})]).then(function(){return t.onReadyBeingFired=[],Se.resolve(pn(e.on.ready.fire)).then(function e(){if(t.onReadyBeingFired.length>0){var n=t.onReadyBeingFired.reduce(oe,J);return t.onReadyBeingFired=[],Se.resolve(pn(n)).then(e)}})}).finally(function(){t.onReadyBeingFired=null}).then(function(){return t.isBeingOpened=!1,e}).catch(function(n){try{o&&o.abort()}catch(e){}return t.isBeingOpened=!1,e.close(),t.dbOpenError=n,ct(t.dbOpenError)}).finally(function(){t.openComplete=!0,r()})}function yn(e){var t=function(t){return e.next(t)},n=i(t),r=i(function(t){return e.throw(t)});function i(e){return function(t){var i=e(t),u=i.value;return i.done?u:u&&"function"==typeof u.then?u.then(n,r):o(u)?Promise.all(u).then(n,r):n(u)}}return i(t)()}function vn(e,t,n){var r=arguments.length;if(r<2)throw new H.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,P(i),n]}function mn(e,t,n){o(e)||(e=[e]);for(var r=e.length,i=new Array(r+n),u=e.length+n-1;u>=r;--u)i[u]=t;return i}var gn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return r({},e,{table:function(t){var n=e.table(t),i=n.schema,o={},u=[];function a(e,t,n){var i=Zt(e),s=o[i]=o[i]||[],c=null==e?0:"string"==typeof e?1:e.length,l=t>0,f=r({},n,{isVirtual:l,isPrimaryKey:!l&&n.isPrimaryKey,keyTail:t,keyLength:c,extractKey:Qt(e),unique:!l&&n.unique});(s.push(f),f.isPrimaryKey||u.push(f),c>1)&&a(2===c?e[0]:e.slice(0,c-1),t+1,n);return s.sort(function(e,t){return e.keyTail-t.keyTail}),f}var s=a(i.primaryKey.keyPath,0,i.primaryKey);o[":id"]=[s];for(var c=0,l=i.indexes;c<l.length;c++){var f=l[c];a(f.keyPath,0,f)}function h(t){var n,i,o=t.query.index;return o.isVirtual?r({},t,{query:{index:o,range:(n=t.query.range,i=o.keyTail,{type:1===n.type?2:n.type,lower:mn(n.lower,n.lowerOpen?e.MAX_KEY:e.MIN_KEY,i),lowerOpen:!0,upper:mn(n.upper,n.upperOpen?e.MIN_KEY:e.MAX_KEY,i),upperOpen:!0})}}):t}return r({},n,{schema:r({},i,{primaryKey:s,indexes:u,getIndexByKeyPath:function(e){var t=o[Zt(e)];return t&&t[0]}}),count:function(e){return n.count(h(e))},query:function(e){return n.query(h(e))},openCursor:function(t){var i=t.query.index,o=i.keyTail,u=i.isVirtual,a=i.keyLength;if(!u)return n.openCursor(t);return n.openCursor(h(t)).then(function(n){return n&&function(n){return r({},n,{continue:function(r){null!=r?n.continue(mn(r,t.reverse?e.MAX_KEY:e.MIN_KEY,o)):t.unique?n.continue(mn(n.key,t.reverse?e.MIN_KEY:e.MAX_KEY,o)):n.continue()},continuePrimaryKey:function(t,r){n.continuePrimaryKey(mn(t,e.MAX_KEY,o),r)},get key(){var e=n.key;return 1===a?e[0]:e.slice(0,a)}})}(n)})}})}})}},bn={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return r({},e,{table:function(t){var n=e.table(t),i=n.schema.primaryKey;return r({},n,{mutate:function(e){var o=je.trans,u=o.table(t).hook,a=u.deleting,s=u.creating,c=u.updating;switch(e.type){case"add":if(s.fire===J)break;return o._promise("readwrite",function(){return l(e)},!0);case"put":if(s.fire===J&&c.fire===J)break;return o._promise("readwrite",function(){return l(e)},!0);case"delete":if(a.fire===J)break;return o._promise("readwrite",function(){return l(e)},!0);case"deleteRange":if(a.fire===J)break;return o._promise("readwrite",function(){return function(e){return function e(t,o,u){return n.query({trans:t,values:!1,query:{index:i,range:o},limit:u}).then(function(n){var i=n.result;return l({type:"delete",keys:i,trans:t}).then(function(n){return n.numFailures>0?Promise.reject(n.failures[0]):i.length<u?{failures:[],numFailures:0,lastResult:void 0}:e(t,r({},o,{lower:i[i.length-1],lowerOpen:!0}),u)})})}(e.trans,e.range,1e4)}(e)},!0)}return n.mutate(e);function l(e){var t=je.trans,o=e.keys||Xt(i,e);if(!o)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?r({},e,{keys:o,wantResults:!0}):r({},e)).type&&(e.values=e.values.slice()),e.keys&&(e.keys=e.keys.slice()),function(e,t,n){return"add"===t.type?Promise.resolve(new Array(t.values.length)):e.getMany({trans:t.trans,keys:n})}(n,e,o).then(function(r){var u=o.map(function(n,o){var u=r[o],l={onerror:null,onsuccess:null};if("delete"===e.type)a.fire.call(l,n,u,t);else if("add"===e.type||void 0===u){var f=s.fire.call(l,n,e.values[o],t);null==n&&null!=f&&(n=f,e.keys[o]=n,i.outbound||k(e.values[o],i.keyPath,n))}else{var h=K(u,e.values[o]),p=c.fire.call(l,h,n,u,t);if(p){var d=e.values[o];Object.keys(p).forEach(function(e){k(d,e,p[e])})}}return l});return n.mutate(e).then(function(t){for(var n=t.failures,i=t.results,a=t.numFailures,s=t.lastResult,c=0;c<o.length;++c){var l=i?i[c]:o[c],f=u[c];null==l?f.onerror&&f.onerror(n[c]):f.onsuccess&&f.onsuccess("put"===e.type&&r[c]?e.values[c]:l)}return{failures:n,results:i,numFailures:a,lastResult:s}}).catch(function(e){return u.forEach(function(t){return t.onerror&&t.onerror(e)}),Promise.reject(e)})})}}})}})}},_n=function(){function e(t,n){var i=this;this._middlewares={},this.verno=0;var o=e.dependencies;this._options=n=r({addons:e.addons,autoOpen:!0,indexedDB:o.indexedDB,IDBKeyRange:o.IDBKeyRange},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};var u=n.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null;var a,s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:J,dbReadyPromise:null,cancelOpen:J,openCanceller:null,autoSchema:!0};s.dbReadyPromise=new Se(function(e){s.dbReadyResolve=e}),s.openCanceller=new Se(function(e,t){s.cancelOpen=t}),this._state=s,this.name=t,this.on=kt(this,"populate","blocked","versionchange",{ready:[oe,J]}),this.on.ready.subscribe=g(this.on.ready.subscribe,function(t){return function(n,r){e.vip(function(){var e=i._state;if(e.openComplete)e.dbOpenError||Se.resolve().then(n),r&&t(n);else if(e.onReadyBeingFired)e.onReadyBeingFired.push(n),r&&t(n);else{t(n);var o=i;r||t(function e(){o.on.ready.unsubscribe(n),o.on.ready.unsubscribe(e)})}})}}),this.Collection=(a=this,xt(St.prototype,function(e,t){this.db=a;var n=_t,r=null;if(t)try{n=t()}catch(e){r=e}var i=e._ctx,o=i.table,u=o.hook.reading.fire;this._ctx={table:o,index:i.index,isPrimKey:!i.index||o.schema.primKey.keyPath&&i.index===o.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:u!==$?u:null}})),this.Table=function(e){return xt(wt.prototype,function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:kt(null,{creating:[te,J],reading:[Z,$],updating:[re,J],deleting:[ne,J]})})}(this),this.Transaction=function(e){return xt(Lt.prototype,function(t,n,r,i){var o=this;this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.idbtrans=null,this.on=kt(this,"complete","error","abort"),this.parent=i||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 Se(function(e,t){o._resolve=e,o._reject=t}),this._completion.then(function(){o.active=!1,o.on.complete.fire()},function(e){var t=o.active;return o.active=!1,o.on.error.fire(e),o.parent?o.parent._reject(e):t&&o.idbtrans&&o.idbtrans.abort(),ct(e)})})}(this),this.Version=function(e){return xt(hn.prototype,function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})})}(this),this.WhereClause=function(e){return xt(Nt.prototype,function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};var i=e._deps.indexedDB;if(!i)throw new H.MissingAPI("indexedDB API missing");this._cmp=this._ascending=i.cmp.bind(i),this._descending=function(e,t){return i.cmp(t,e)},this._max=function(e,t){return i.cmp(e,t)>0?e:t},this._min=function(e,t){return i.cmp(e,t)<0?e:t},this._IDBKeyRange=e._deps.IDBKeyRange})}(this),this.on("versionchange",function(e){e.newVersion>0?console.warn("Another connection wants to upgrade database '"+i.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+i.name+"'. Closing db now to resume the delete request."),i.close()}),this.on("blocked",function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('"+i.name+"') was blocked"):console.warn("Upgrade '"+i.name+"' blocked by other connection holding version "+e.oldVersion/10)}),this._maxKey=Vt(n.IDBKeyRange),this._createTransaction=function(e,t,n,r){return new i.Transaction(e,t,n,r)},this._fireOnBlocked=function(e){i.on("blocked").fire(e),pt.filter(function(e){return e.name===i.name&&e!==i&&!e._state.vcFired}).map(function(t){return t.on("versionchange").fire(e)})},this.use(gn),this.use(bn),u.forEach(function(e){return e(i)})}return e.prototype.version=function(e){if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new H.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter(function(t){return t._cfg.version===e})[0];return n||(n=new this.Version(e),t.push(n),t.sort(un),this._state.autoSchema=!1,n)},e.prototype._whenReady=function(e){var t=this;return this._state.openComplete||je.letThrough?e():new Se(function(e,n){if(!t._state.isBeingOpened){if(!t._options.autoOpen)return void n(new H.DatabaseClosed);t.open().catch(J)}t._state.dbReadyPromise.then(e,n)}).then(e)},e.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;i&&this.unuse({stack:t,name:i});var o=this._middlewares[t]||(this._middlewares[t]=[]);return o.push({stack:t,create:n,level:null==r?10:r,name:i}),o.sort(function(e,t){return e.level-t.level}),this},e.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(function(e){return r?e.create!==r:!!n&&e.name!==n})),this},e.prototype.open=function(){return dn(this)},e.prototype.close=function(){var e=pt.indexOf(this),t=this._state;if(e>=0&&pt.splice(e,1),this.idbdb){try{this.idbdb.close()}catch(e){}this.idbdb=null}this._options.autoOpen=!1,t.dbOpenError=new H.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError),t.dbReadyPromise=new Se(function(e){t.dbReadyResolve=e}),t.openCanceller=new Se(function(e,n){t.cancelOpen=n})},e.prototype.delete=function(){var e=this,t=arguments.length>0,n=this._state;return new Se(function(r,i){var o=function(){e.close();var t=e._deps.indexedDB.deleteDatabase(e.name);t.onsuccess=ze(function(){fn.remove(e.name),r()}),t.onerror=Wt(i),t.onblocked=e._fireOnBlocked};if(t)throw new H.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(o):o()})},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return null!==this.idbdb},e.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},e.prototype.hasFailed=function(){return null!==this._state.dbOpenError},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var e=this;return i(this._allTables).map(function(t){return e._allTables[t]})},enumerable:!0,configurable:!0}),e.prototype.transaction=function(){var e=vn.apply(this,arguments);return this._transaction.apply(this,e)},e.prototype._transaction=function(e,t,n){var r=this,i=je.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,u,a=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(u=t.map(function(e){var t=e instanceof r.Table?e.name:e;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t}),"r"==e||"readonly"===e)o="readonly";else{if("rw"!=e&&"readwrite"!=e)throw new H.InvalidArgument("Invalid transaction mode: "+e);o="readwrite"}if(i){if("readonly"===i.mode&&"readwrite"===o){if(!a)throw new H.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&u.forEach(function(e){if(i&&-1===i.storeNames.indexOf(e)){if(!a)throw new H.SubTransaction("Table "+e+" not included in parent transaction.");i=null}}),a&&i&&!i.active&&(i=null)}}catch(e){return i?i._promise(null,function(t,n){n(e)}):ct(e)}var s=function(e,t,n,r,i){return Se.resolve().then(function(){var o,u=je.transless||je,a=e._createTransaction(t,n,e._dbSchema,r),s={trans:a,transless:u};r?a.idbtrans=r.idbtrans:a.create(),i.constructor===ye&&$e();var c=Se.follow(function(){if(o=i.call(a,a))if(o.constructor===de){var e=Ze.bind(null,null);o.then(e,e)}else"function"==typeof o.next&&"function"==typeof o.throw&&(o=yn(o))},s);return(o&&"function"==typeof o.then?Se.resolve(o).then(function(e){return a.active?e:ct(new H.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):c.then(function(){return o})).then(function(e){return r&&a._resolve(),a._completion.then(function(){return e})}).catch(function(e){return a._reject(e),ct(e)})})}.bind(null,this,o,u,i,n);return i?i._promise(o,s,"lock"):je.trans?it(je.transless,function(){return r._whenReady(s)}):this._whenReady(s)},e.prototype.table=function(e){if(!l(this._allTables,e))throw new H.InvalidTable("Table "+e+" does not exist");return this._allTables[e]},e}(),wn=_n;f(wn,r({},X,{delete:function(e){return new wn(e).delete()},exists:function(e){return new wn(e,{addons:[]}).open().then(function(e){return e.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){return fn?fn.getDatabaseNames().then(e):Se.resolve([])},defineClass:function(){return function(e){a(this,e)}},ignoreTransaction:function(e){return je.trans?it(je.transless,e):e()},vip:pn,async:function(e){return function(){try{var t=yn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Se.resolve(t)}catch(e){return ct(e)}}},spawn:function(e,t,n){try{var r=yn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Se.resolve(r)}catch(e){return ct(e)}},currentTransaction:{get:function(){return je.trans||null}},waitFor:function(e,t){var n=Se.resolve("function"==typeof e?wn.ignoreTransaction(e):e).timeout(t||6e4);return je.trans?je.trans.waitFor(n):n},Promise:Se,debug:{get:function(){return T},set:function(e){D(e,"dexie"===e?function(){return!0}:mt)}},derive:d,extend:a,props:f,override:g,Events:kt,getByKeyPath:w,setByKeyPath:k,delByKeyPath:function(e,t){"string"==typeof t?k(e,t,void 0):"length"in t&&[].map.call(t,function(t){k(e,t,void 0)})},shallowClone:x,deepClone:j,getObjectDiff:K,asap:_,minKey:-1/0,addons:[],connections:pt,errnames:Y,dependencies:function(){try{return{indexedDB:u.indexedDB||u.mozIndexedDB||u.webkitIndexedDB||u.msIndexedDB,IDBKeyRange:u.IDBKeyRange||u.webkitIDBKeyRange}}catch(e){return{indexedDB:null,IDBKeyRange:null}}}(),semVer:"3.0.0-alpha.8",version:"3.0.0-alpha.8".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)}),default:wn,Dexie:wn})),wn.maxKey=Vt(wn.dependencies.IDBKeyRange),function(e){try{fn=function(e){var t,n=e&&(e.getDatabaseNames||e.webkitGetDatabaseNames);if(!n){var r=new _n(gt,{addons:[]});r.version(1).stores({dbnames:"name"}),t=r.table("dbnames")}return{getDatabaseNames:function(){return n?new Se(function(t,r){var i=n.call(e);i.onsuccess=function(e){return t(m(e.target.result,0))},i.onerror=Wt(r)}):t.toCollection().primaryKeys()},add:function(e){return!n&&e!==gt&&t.put({name:e}).catch(J)},remove:function(e){return!n&&e!==gt&&t.delete(e).catch(J)}}}(e)}catch(e){}}(_n.dependencies.indexedDB),Se.rejectionMapper=function(e,t){if(!e||e instanceof V||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Q[e.name])return e;var n=new Q[e.name](t||e.message,e);return"stack"in e&&p(n,"stack",{get:function(){return this.inner.stack}}),n},D(T,mt),t.default=_n}});
//# sourceMappingURL=3.2860b24d78cee11b8d5e.worker.js.map
|