Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/indexeddb/ |
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/indexeddb/dexie.min.js |
(function(n,e){typeof exports==="object"&&typeof module!=="undefined"?module.exports=e():typeof define==="function"&&define.amd?define(e):n.Dexie=e();if(!n.Dexie){n.Dexie=e()}})(this,function(){"use strict";var n=Object.keys;var e=Array.isArray;var t=typeof self!=="undefined"?self:typeof window!=="undefined"?window:global;function r(e,t){if(typeof t!=="object")return e;n(t).forEach(function(n){e[n]=t[n]});return e}var i=Object.getPrototypeOf;var o={}.hasOwnProperty;function u(n,e){return o.call(n,e)}function a(e,t){if(typeof t==="function")t=t(i(e));if(typeof t!=="object")return;n(t).forEach(function(n){c(e,n,t[n])})}var s=Object.defineProperty;function c(n,e,t,i){s(n,e,r(t&&u(t,"get")&&typeof t.get==="function"?{get:t.get,set:t.set,configurable:true}:{value:t,configurable:true,writable:true},i))}function f(n){return{from:function(e){n.prototype=Object.create(e.prototype);c(n.prototype,"constructor",n);return{extend:a.bind(null,n.prototype)}}}}var l=Object.getOwnPropertyDescriptor;function h(n,e){var t=l(n,e),r;return t||(r=i(n))&&h(r,e)}var v=[].slice;function d(n,e,t){return v.call(n,e,t)}function p(n,e){return e(n)}function y(n){if(!n)throw new Error("Assertion Failed")}function m(n){if(t.setImmediate)setImmediate(n);else setTimeout(n,0)}function g(n,e){return n.reduce(function(n,t,r){var i=e(t,r);if(i)n[i[0]]=i[1];return n},{})}function b(n,e){return function(){try{n.apply(this,arguments)}catch(n){e(n)}}}function w(n,e,t){try{n.apply(null,t)}catch(n){e&&e(n)}}function _(n,e){if(u(n,e))return n[e];if(!e)return n;if(typeof e!=="string"){var t=[];for(var r=0,i=e.length;r<i;++r){var o=_(n,e[r]);t.push(o)}return t}var a=e.indexOf(".");if(a!==-1){var s=n[e.substr(0,a)];return s===undefined?undefined:_(s,e.substr(a+1))}return undefined}function k(n,e,t){if(!n||e===undefined)return;if("isFrozen"in Object&&Object.isFrozen(n))return;if(typeof e!=="string"&&"length"in e){y(typeof t!=="string"&&"length"in t);for(var r=0,i=e.length;r<i;++r){k(n,e[r],t[r])}}else{var o=e.indexOf(".");if(o!==-1){var u=e.substr(0,o);var a=e.substr(o+1);if(a==="")if(t===undefined)delete n[u];else n[u]=t;else{var s=n[u];if(!s)s=n[u]={};k(s,a,t)}}else{if(t===undefined)delete n[e];else n[e]=t}}}function x(n,e){if(typeof e==="string")k(n,e,undefined);else if("length"in e)[].map.call(e,function(e){k(n,e,undefined)})}function j(n){var e={};for(var t in n){if(u(n,t))e[t]=n[t]}return e}var P=[].concat;function E(n){return P.apply([],n)}var A="Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set".split(",").concat(E([8,16,32,64].map(function(n){return["Int","Uint","Float"].map(function(e){return e+n+"Array"})}))).filter(function(n){return t[n]}).map(function(n){return t[n]});function O(n){if(!n||typeof n!=="object")return n;var t;if(e(n)){t=[];for(var r=0,i=n.length;r<i;++r){t.push(O(n[r]))}}else if(A.indexOf(n.constructor)>=0){t=n}else{t=n.constructor?Object.create(n.constructor.prototype):{};for(var o in n){if(u(n,o)){t[o]=O(n[o])}}}return t}function S(e,t,r,i){r=r||{};i=i||"";n(e).forEach(function(n){if(!u(t,n))r[i+n]=undefined;else{var o=e[n],a=t[n];if(typeof o==="object"&&typeof a==="object"&&o&&a&&""+o.constructor===""+a.constructor)S(o,a,r,i+n+".");else if(o!==a)r[i+n]=t[n]}});n(t).forEach(function(n){if(!u(e,n)){r[i+n]=t[n]}});return r}var I=typeof Symbol!=="undefined"&&Symbol.iterator;var D=I?function(n){var e;return n!=null&&(e=n[I])&&e.apply(n)}:function(){return null};var C={};function K(n){var t,r,i,o;if(arguments.length===1){if(e(n))return n.slice();if(this===C&&typeof n==="string")return[n];if(o=D(n)){r=[];while(i=o.next(),!i.done)r.push(i.value);return r}if(n==null)return[n];t=n.length;if(typeof t==="number"){r=new Array(t);while(t--)r[t]=n[t];return r}return[n]}t=arguments.length;r=new Array(t);while(t--)r[t]=arguments[t];return r}var T=typeof location!=="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function B(n,e){T=n;F=e}var F=function(){return true};var M=!new Error("").stack;function N(){"use strict";if(M)try{N.arguments;throw new Error}catch(n){return n}return new Error}function q(n,e){var t=n.stack;if(!t)return"";e=e||0;if(t.indexOf(n.name)===0)e+=(n.name+n.message).split("\n").length;return t.split("\n").slice(e).filter(F).map(function(n){return"\n"+n}).join("")}function R(n,e){return function(){console.warn(n+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+q(N(),1));return e.apply(this,arguments)}}var U=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"];var V=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"];var z=U.concat(V);var L={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};function W(n,e){this._e=N();this.name=n;this.message=e}f(W).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}});function Q(n,e){return n+". Errors: "+e.map(function(n){return n.toString()}).filter(function(n,e,t){return t.indexOf(n)===e}).join("\n")}function H(n,e,t,r){this._e=N();this.failures=e;this.failedKeys=r;this.successCount=t}f(H).from(W);function G(n,e){this._e=N();this.name="BulkError";this.failures=e;this.message=Q(n,e)}f(G).from(W);var J=z.reduce(function(n,e){return n[e]=e+"Error",n},{});var Y=W;var $=z.reduce(function(n,e){var t=e+"Error";function r(n,r){this._e=N();this.name=t;if(!n){this.message=L[e]||t;this.inner=null}else if(typeof n==="string"){this.message=n;this.inner=r||null}else if(typeof n==="object"){this.message=n.name+" "+n.message;this.inner=n}}f(r).from(Y);n[e]=r;return n},{});$.Syntax=SyntaxError;$.Type=TypeError;$.Range=RangeError;var X=V.reduce(function(n,e){n[e+"Error"]=$[e];return n},{});function Z(n,e){if(!n||n instanceof W||n instanceof TypeError||n instanceof SyntaxError||!n.name||!X[n.name])return n;var t=new X[n.name](e||n.message,n);if("stack"in n){c(t,"stack",{get:function(){return this.inner.stack}})}return t}var nn=z.reduce(function(n,e){if(["Syntax","Type","Range"].indexOf(e)===-1)n[e+"Error"]=$[e];return n},{});nn.ModifyError=H;nn.DexieError=W;nn.BulkError=G;function en(){}function tn(n){return n}function rn(n,e){if(n==null||n===tn)return e;return function(t){return e(n(t))}}function on(n,e){return function(){n.apply(this,arguments);e.apply(this,arguments)}}function un(n,e){if(n===en)return e;return function(){var t=n.apply(this,arguments);if(t!==undefined)arguments[0]=t;var r=this.onsuccess,i=this.onerror;this.onsuccess=null;this.onerror=null;var o=e.apply(this,arguments);if(r)this.onsuccess=this.onsuccess?on(r,this.onsuccess):r;if(i)this.onerror=this.onerror?on(i,this.onerror):i;return o!==undefined?o:t}}function an(n,e){if(n===en)return e;return function(){n.apply(this,arguments);var t=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null;e.apply(this,arguments);if(t)this.onsuccess=this.onsuccess?on(t,this.onsuccess):t;if(r)this.onerror=this.onerror?on(r,this.onerror):r}}function sn(n,e){if(n===en)return e;return function(t){var i=n.apply(this,arguments);r(t,i);var o=this.onsuccess,u=this.onerror;this.onsuccess=null;this.onerror=null;var a=e.apply(this,arguments);if(o)this.onsuccess=this.onsuccess?on(o,this.onsuccess):o;if(u)this.onerror=this.onerror?on(u,this.onerror):u;return i===undefined?a===undefined?undefined:a:r(i,a)}}function cn(n,e){if(n===en)return e;return function(){if(e.apply(this,arguments)===false)return false;return n.apply(this,arguments)}}function fn(n,e){if(n===en)return e;return function(){var t=n.apply(this,arguments);if(t&&typeof t.then==="function"){var r=this,i=arguments.length,o=new Array(i);while(i--)o[i]=arguments[i];return t.then(function(){return e.apply(r,o)})}return e.apply(this,arguments)}}var ln={};var hn=100;var vn=20;var dn=7;var pn=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(e){var n=t.Promise;return n?[n.resolve(),n.prototype,n.resolve()]:[]}}();var yn=pn[0];var mn=pn[1];var gn=pn[2];var bn=mn&&mn.then;var wn=yn&&yn.constructor;var _n=pn[3];var kn=!!gn;var xn=false;var jn=gn?function(){gn.then(Hn)}:t.setImmediate?setImmediate.bind(null,Hn):t.MutationObserver?function(){var n=document.createElement("div");new MutationObserver(function(){Hn();n=null}).observe(n,{attributes:true});n.setAttribute("i","1")}:function(){setTimeout(Hn,0)};var Pn=function(n,e){Tn.push([n,e]);if(An){jn();An=false}};var En=true;var An=true;var On=[];var Sn=[];var In=null;var Dn=tn;var Cn={id:"global",global:true,ref:0,unhandleds:[],onunhandled:_e,pgp:false,env:{},finalize:function(){this.unhandleds.forEach(function(n){try{_e(n[0],n[1])}catch(n){}})}};var Kn=Cn;var Tn=[];var Bn=0;var Fn=[];function Mn(n){if(typeof this!=="object")throw new TypeError("Promises must be constructed via new");this._listeners=[];this.onuncatched=en;this._lib=false;var e=this._PSD=Kn;if(T){this._stackHolder=N();this._prev=null;this._numPrev=0}if(typeof n!=="function"){if(n!==ln)throw new TypeError("Not a function");this._state=arguments[1];this._value=arguments[2];if(this._state===false)Un(this,this._value);return}this._state=null;this._value=null;++e.ref;Rn(this,n)}var Nn={get:function(){var n=Kn,e=ue;function t(t,r){var i=this;var o=!n.global&&(n!==Kn||e!==ue);if(o)fe();var u=new Mn(function(e,u){zn(i,new qn(ge(t,n,o),ge(r,n,o),e,u,n))});T&&Qn(u,this);return u}t.prototype=ln;return t},set:function(n){c(this,"then",n&&n.prototype===ln?Nn:{get:function(){return n},set:Nn.set})}};a(Mn.prototype,{then:Nn,_then:function(n,e){zn(this,new qn(null,null,n,e,Kn))},catch:function(n){if(arguments.length===1)return this.then(null,n);var e=arguments[0],t=arguments[1];return typeof e==="function"?this.then(null,function(n){return n instanceof e?t(n):ne(n)}):this.then(null,function(n){return n&&n.name===e?t(n):ne(n)})},finally:function(n){return this.then(function(e){n();return e},function(e){n();return ne(e)})},stack:{get:function(){if(this._stack)return this._stack;try{xn=true;var n=Wn(this,[],vn);var e=n.join("\nFrom previous: ");if(this._state!==null)this._stack=e;return e}finally{xn=false}}},timeout:function(n,e){var t=this;return n<Infinity?new Mn(function(r,i){var o=setTimeout(function(){return i(new $.Timeout(e))},n);t.then(r,i).finally(clearTimeout.bind(null,o))}):this}});if(typeof Symbol!=="undefined"&&Symbol.toStringTag)c(Mn.prototype,Symbol.toStringTag,"Promise");Cn.env=pe();function qn(n,e,t,r,i){this.onFulfilled=typeof n==="function"?n:null;this.onRejected=typeof e==="function"?e:null;this.resolve=t;this.reject=r;this.psd=i}a(Mn,{all:function(){var n=K.apply(null,arguments).map(le);return new Mn(function(e,t){if(n.length===0)e([]);var r=n.length;n.forEach(function(i,o){return Mn.resolve(i).then(function(t){n[o]=t;if(!--r)e(n)},t)})})},resolve:function(n){if(n instanceof Mn)return n;if(n&&typeof n.then==="function")return new Mn(function(e,t){n.then(e,t)});var e=new Mn(ln,true,n);Qn(e,In);return e},reject:ne,race:function(){var n=K.apply(null,arguments).map(le);return new Mn(function(e,t){n.map(function(n){return Mn.resolve(n).then(e,t)})})},PSD:{get:function(){return Kn},set:function(n){return Kn=n}},newPSD:se,usePSD:ye,scheduler:{get:function(){return Pn},set:function(n){Pn=n}},rejectionMapper:{get:function(){return Dn},set:function(n){Dn=n}},follow:function(n,e){return new Mn(function(t,r){return se(function(e,t){var r=Kn;r.unhandleds=[];r.onunhandled=t;r.finalize=on(function(){var n=this;$n(function(){n.unhandleds.length===0?e():t(n.unhandleds[0])})},r.finalize);n()},e,t,r)})}});function Rn(n,e){try{e(function(e){if(n._state!==null)return;if(e===n)throw new TypeError("A promise cannot be resolved with itself.");var t=n._lib&&Gn();if(e&&typeof e.then==="function"){Rn(n,function(n,t){e instanceof Mn?e._then(n,t):e.then(n,t)})}else{n._state=true;n._value=e;Vn(n)}if(t)Jn()},Un.bind(null,n))}catch(e){Un(n,e)}}function Un(n,e){Sn.push(e);if(!n||n._state!==null)return;var t=n._lib&&Gn();e=Dn(e);n._state=false;n._value=e;T&&e!==null&&typeof e==="object"&&!e._promise&&w(function(){var t=h(e,"stack");e._promise=n;c(e,"stack",{get:function(){return xn?t&&(t.get?t.get.apply(e):t.value):n.stack}})});Xn(n);Vn(n);if(t)Jn()}function Vn(n){var e=n._listeners;n._listeners=[];for(var t=0,r=e.length;t<r;++t){zn(n,e[t])}var i=n._PSD;--i.ref||i.finalize();if(Bn===0){++Bn;Pn(function(){if(--Bn===0)Yn()},[])}}function zn(n,e){if(n._state===null){n._listeners.push(e);return}var t=n._state?e.onFulfilled:e.onRejected;if(t===null){return(n._state?e.resolve:e.reject)(n._value)}++e.psd.ref;++Bn;Pn(Ln,[t,n,e])}function Ln(n,e,t){try{In=e;var r,i=e._value;if(e._state){r=n(i)}else{if(Sn.length)Sn=[];r=n(i);if(Sn.indexOf(i)===-1)Zn(e)}t.resolve(r)}catch(n){t.reject(n)}finally{In=null;if(--Bn===0)Yn();--t.psd.ref||t.psd.finalize()}}function Wn(n,e,t){if(e.length===t)return e;var r="";if(n._state===false){var i=n._value,o,u;if(i!=null){o=i.name||"Error";u=i.message||i;r=q(i,0)}else{o=i;u=""}e.push(o+(u?": "+u:"")+r)}if(T){r=q(n._stackHolder,2);if(r&&e.indexOf(r)===-1)e.push(r);if(n._prev)Wn(n._prev,e,t)}return e}function Qn(n,e){var t=e?e._numPrev+1:0;if(t<hn){n._prev=e;n._numPrev=t}}function Hn(){Gn()&&Jn()}function Gn(){var n=En;En=false;An=false;return n}function Jn(){var n,e,t;do{while(Tn.length>0){n=Tn;Tn=[];t=n.length;for(e=0;e<t;++e){var r=n[e];r[0].apply(null,r[1])}}}while(Tn.length>0);En=true;An=true}function Yn(){var n=On;On=[];n.forEach(function(n){n._PSD.onunhandled.call(null,n._value,n)});var e=Fn.slice(0);var t=e.length;while(t)e[--t]()}function $n(n){function e(){n();Fn.splice(Fn.indexOf(e),1)}Fn.push(e);++Bn;Pn(function(){if(--Bn===0)Yn()},[])}function Xn(n){if(!On.some(function(e){return e._value===n._value}))On.push(n)}function Zn(n){var e=On.length;while(e)if(On[--e]._value===n._value){On.splice(e,1);return}}function ne(n){return new Mn(ln,false,n)}function ee(n,e){var t=Kn;return function(){var r=Gn(),i=Kn;try{de(t,true);return n.apply(this,arguments)}catch(n){e&&e(n)}finally{de(i,false);if(r)Jn()}}}var te={awaits:0,echoes:0,id:0};var re=0;var ie=[];var oe=0;var ue=0;var ae=0;function se(n,e,t,i){var o=Kn,u=Object.create(o);u.parent=o;u.ref=0;u.global=false;u.id=++ae;var a=Cn.env;u.env=kn?{Promise:Mn,PromiseProp:{value:Mn,configurable:true,writable:true},all:Mn.all,race:Mn.race,resolve:Mn.resolve,reject:Mn.reject,nthen:be(a.nthen,u),gthen:be(a.gthen,u)}:{};if(e)r(u,e);++o.ref;u.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=ye(u,n,t,i);if(u.ref===0)u.finalize();return s}function ce(){if(!te.id)te.id=++re;++te.awaits;te.echoes+=dn;return te.id}function fe(n){if(!te.awaits||n&&n!==te.id)return;if(--te.awaits===0)te.id=0;te.echoes=te.awaits*dn}function le(n){if(te.echoes&&n&&n.constructor===wn){ce();return n.then(function(n){fe();return n},function(n){fe();return ke(n)})}return n}function he(n){++ue;if(!te.echoes||--te.echoes===0){te.echoes=te.id=0}ie.push(Kn);de(n,true)}function ve(){var n=ie[ie.length-1];ie.pop();de(n,false)}function de(n,e){var r=Kn;if(e?te.echoes&&(!oe++||n!==Kn):oe&&(!--oe||n!==Kn)){me(e?he.bind(null,n):ve)}if(n===Kn)return;Kn=n;if(r===Cn)Cn.env=pe();if(kn){var i=Cn.env.Promise;var o=n.env;mn.then=o.nthen;i.prototype.then=o.gthen;if(r.global||n.global){Object.defineProperty(t,"Promise",o.PromiseProp);i.all=o.all;i.race=o.race;i.resolve=o.resolve;i.reject=o.reject}}}function pe(){var n=t.Promise;return kn?{Promise:n,PromiseProp:Object.getOwnPropertyDescriptor(t,"Promise"),all:n.all,race:n.race,resolve:n.resolve,reject:n.reject,nthen:mn.then,gthen:n.prototype.then}:{}}function ye(n,e,t,r,i){var o=Kn;try{de(n,true);return e(t,r,i)}finally{de(o,false)}}function me(n){bn.call(yn,n)}function ge(n,e,t){return typeof n!=="function"?n:function(){var r=Kn;if(t)ce();de(e,true);try{return n.apply(this,arguments)}finally{de(r,false)}}}function be(n,e){return function(t,r){return n.call(this,ge(t,e,false),ge(r,e,false))}}var we="unhandledrejection";function _e(n,e){var i;try{i=e.onuncatched(n)}catch(n){}if(i!==false)try{var o,u={promise:e,reason:n};if(t.document&&document.createEvent){o=document.createEvent("Event");o.initEvent(we,true,true);r(o,u)}else if(t.CustomEvent){o=new CustomEvent(we,{detail:u});r(o,u)}if(o&&t.dispatchEvent){dispatchEvent(o);if(!t.PromiseRejectionEvent&&t.onunhandledrejection)try{t.onunhandledrejection(o)}catch(n){}}if(!o.defaultPrevented){console.warn("Unhandled rejection: "+(n.stack||n))}}catch(n){}}var ke=Mn.reject;function xe(t){var r={};var i=function(n,e){if(e){var i=arguments.length,o=new Array(i-1);while(--i)o[i-1]=arguments[i];r[n].subscribe.apply(null,o);return t}else if(typeof n==="string"){return r[n]}};i.addEventType=a;for(var o=1,u=arguments.length;o<u;++o){a(arguments[o])}return i;function a(n,e,t){if(typeof n==="object")return s(n);if(!e)e=cn;if(!t)t=en;var o={subscribers:[],fire:t,subscribe:function(n){if(o.subscribers.indexOf(n)===-1){o.subscribers.push(n);o.fire=e(o.fire,n)}},unsubscribe:function(n){o.subscribers=o.subscribers.filter(function(e){return e!==n});o.fire=o.subscribers.reduce(e,t)}};r[n]=i[n]=o;return o}function s(t){n(t).forEach(function(n){var r=t[n];if(e(r)){a(n,t[n][0],t[n][1])}else if(r==="asap"){var i=a(n,tn,function n(){var e=arguments.length,t=new Array(e);while(e--)t[e]=arguments[e];i.subscribers.forEach(function(n){m(function e(){n.apply(null,t)})})})}else throw new $.InvalidArgument("Invalid event config")})}}var je="2.0.4";var Pe=String.fromCharCode(65535);var Ee=function(){try{IDBKeyRange.only([[]]);return[[]]}catch(n){return Pe}}();var Ae=-Infinity;var Oe="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";var Se="String expected.";var Ie=[];var De=typeof navigator!=="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent);var Ce=De;var Ke=De;var Te=function(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};var Be;B(T,Te);function Fe(i,o){var s=Fe.dependencies;var f=r({addons:Fe.addons,autoOpen:true,indexedDB:s.indexedDB,IDBKeyRange:s.IDBKeyRange},o);var l=f.addons,h=f.autoOpen,v=f.indexedDB,m=f.IDBKeyRange;var x=this._dbSchema={};var P=[];var A=[];var I={};var D=null;var B=null;var F=false;var M=null;var q=false;var U="readonly",V="readwrite";var z=this;var L,W=new Mn(function(n){L=n}),Q,J=new Mn(function(n,e){Q=e});var Y=true;var X=!!Ge(v),Z;function nn(){z.on("versionchange",function(n){if(n.newVersion>0)console.warn("Another connection wants to upgrade database '"+z.name+"'. Closing db now to resume the upgrade.");else console.warn("Another connection wants to delete database '"+z.name+"'. Closing db now to resume the delete request.");z.close()});z.on("blocked",function(n){if(!n.newVersion||n.newVersion<n.oldVersion)console.warn("Dexie.delete('"+z.name+"') was blocked");else console.warn("Upgrade '"+z.name+"' blocked by other connection holding version "+n.oldVersion/10)})}this.version=function(n){if(D||F)throw new $.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,n);var e=P.filter(function(e){return e._cfg.version===n})[0];if(e)return e;e=new on(n);P.push(e);P.sort(On);Y=false;return e};function on(n){this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null};this.stores({})}r(on.prototype,{stores:function(e){this._cfg.storesSource=this._cfg.storesSource?r(this._cfg.storesSource,e):e;var t={};P.forEach(function(n){r(t,n._cfg.storesSource)});var i=this._cfg.dbschema={};this._parseStoresSpec(t,i);x=z._dbSchema=i;In([I,z,jn.prototype]);Sn([I,z,jn.prototype,this._cfg.tables],n(i),i);A=n(i);return this},upgrade:function(n){this._cfg.contentUpgrade=n;return this},_parseStoresSpec:function(e,t){n(e).forEach(function(n){if(e[n]!==null){var r={};var i=Cn(e[n]);var o=i.shift();if(o.multi)throw new $.Schema("Primary key cannot be multi-valued");if(o.keyPath)k(r,o.keyPath,o.auto?0:o.keyPath);i.forEach(function(n){if(n.auto)throw new $.Schema("Only primary key can be marked as autoIncrement (++)");if(!n.keyPath)throw new $.Schema("Index must have a name and cannot be an empty string");k(r,n.keyPath,n.compound?n.keyPath.map(function(){return""}):"")});t[n]=new Qe(n,o,i,r)}})}});function cn(e,t,r){var i=z._createTransaction(V,A,x);i.create(t);i._completion.catch(r);var o=i._reject.bind(i);se(function(){Kn.trans=i;if(e===0){n(x).forEach(function(n){vn(t,n,x[n].primKey,x[n].indexes)});Mn.follow(function(){return z.on.populate.fire(i)}).catch(o)}else ln(e,i,t).catch(o)})}function ln(n,e,t){var r=[];var i=P.filter(function(e){return e._cfg.version===n})[0];if(!i)throw new $.Upgrade("Dexie specification of currently installed DB version is missing");x=z._dbSchema=i._cfg.dbschema;var o=false;var u=P.filter(function(e){return e._cfg.version>n});u.forEach(function(n){r.push(function(){var r=x;var i=n._cfg.dbschema;Ln(r,t);Ln(i,t);x=z._dbSchema=i;var u=hn(r,i);u.add.forEach(function(n){vn(t,n[0],n[1].primKey,n[1].indexes)});u.change.forEach(function(n){if(n.recreate){throw new $.Upgrade("Not yet support for changing primary key")}else{var e=t.objectStore(n.name);n.add.forEach(function(n){yn(e,n)});n.change.forEach(function(n){e.deleteIndex(n.name);yn(e,n)});n.del.forEach(function(n){e.deleteIndex(n)})}});if(n._cfg.contentUpgrade){o=true;return Mn.follow(function(){n._cfg.contentUpgrade(e)})}});r.push(function(e){if(!o||!Ce){var t=n._cfg.dbschema;pn(t,e)}})});function a(){return r.length?Mn.resolve(r.shift()(e.idbtrans)).then(a):Mn.resolve()}return a().then(function(){dn(x,t)})}function hn(n,e){var t={del:[],add:[],change:[]};for(var r in n){if(!e[r])t.del.push(r)}for(r in e){var i=n[r],o=e[r];if(!i){t.add.push([r,o])}else{var u={name:r,def:o,recreate:false,del:[],add:[],change:[]};if(i.primKey.src!==o.primKey.src){u.recreate=true;t.change.push(u)}else{var a=i.idxByName;var s=o.idxByName;for(var c in a){if(!s[c])u.del.push(c)}for(c in s){var f=a[c],l=s[c];if(!f)u.add.push(l);else if(f.src!==l.src)u.change.push(l)}if(u.del.length>0||u.add.length>0||u.change.length>0){t.change.push(u)}}}}return t}function vn(n,e,t,r){var i=n.db.createObjectStore(e,t.keyPath?{keyPath:t.keyPath,autoIncrement:t.auto}:{autoIncrement:t.auto});r.forEach(function(n){yn(i,n)});return i}function dn(e,t){n(e).forEach(function(n){if(!t.db.objectStoreNames.contains(n)){vn(t,n,e[n].primKey,e[n].indexes)}})}function pn(n,e){for(var t=0;t<e.db.objectStoreNames.length;++t){var r=e.db.objectStoreNames[t];if(n[r]==null){e.db.deleteObjectStore(r)}}}function yn(n,e){n.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}this._allTables=I;this._createTransaction=function(n,e,t,r){return new jn(n,e,t,r)};function mn(n,e,t){if(!q&&!Kn.letThrough){if(!F){if(!h)return ke(new $.DatabaseClosed);z.open().catch(en)}return W.then(function(){return mn(n,e,t)})}else{var r=z._createTransaction(n,e,x);try{r.create()}catch(n){return ke(n)}return r._promise(n,function(n,e){return se(function(){Kn.trans=r;return t(n,e,r)})}).then(function(n){return r._completion.then(function(){return n})})}}this._whenReady=function(n){return q||Kn.letThrough?n():new Mn(function(n,e){if(!F){if(!h){e(new $.DatabaseClosed);return}z.open().catch(en)}W.then(n,e)}).then(n)};this.verno=0;this.open=function(){if(F||D)return W.then(function(){return B?ke(B):z});T&&(J._stackHolder=N());F=true;B=null;q=false;var n=L,e=null;return Mn.race([J,new Mn(function(n,t){if(!v)throw new $.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=Y?v.open(i):v.open(i,Math.round(z.verno*10));if(!r)throw new $.MissingAPI("IndexedDB API not available");r.onerror=Re(t);r.onblocked=ee(Wn);r.onupgradeneeded=ee(function(n){e=r.transaction;if(Y&&!z._allowEmptyDB){r.onerror=ze;e.abort();r.result.close();var o=v.deleteDatabase(i);o.onsuccess=o.onerror=ee(function(){t(new $.NoSuchDatabase("Database "+i+" doesnt exist"))})}else{e.onerror=Re(t);var u=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;cn(u/10,e,t,r)}},t);r.onsuccess=ee(function(){e=null;D=r.result;Ie.push(z);if(Y)zn();else if(D.objectStoreNames.length>0){try{Ln(x,D.transaction(He(D.objectStoreNames),U))}catch(n){}}D.onversionchange=ee(function(n){z._vcFired=true;z.on("versionchange").fire(n)});if(!X&&i!=="__dbnames"){Be.dbnames.put({name:i}).catch(en)}n()},t)})]).then(function(){M=[];return Mn.resolve(Fe.vip(z.on.ready.fire)).then(function n(){if(M.length>0){var e=M.reduce(fn,en);M=[];return Mn.resolve(Fe.vip(e)).then(n)}})}).finally(function(){M=null}).then(function(){F=false;return z}).catch(function(n){try{e&&e.abort()}catch(n){}F=false;z.close();B=n;return ke(B)}).finally(function(){q=true;n()})};this.close=function(){var n=Ie.indexOf(z);if(n>=0)Ie.splice(n,1);if(D){try{D.close()}catch(n){}D=null}h=false;B=new $.DatabaseClosed;if(F)Q(B);W=new Mn(function(n){L=n});J=new Mn(function(n,e){Q=e})};this.delete=function(){var n=arguments.length>0;return new Mn(function(e,t){if(n)throw new $.InvalidArgument("Arguments not allowed in db.delete()");if(F){W.then(r)}else{r()}function r(){z.close();var n=v.deleteDatabase(i);n.onsuccess=ee(function(){if(!X){Be.dbnames.delete(i).catch(en)}e()});n.onerror=Re(t);n.onblocked=Wn}})};this.backendDB=function(){return D};this.isOpen=function(){return D!==null};this.hasBeenClosed=function(){return B&&B instanceof $.DatabaseClosed};this.hasFailed=function(){return B!==null};this.dynamicallyOpened=function(){return Y};this.name=i;a(this,{tables:{get:function(){return n(I).map(function(n){return I[n]})}}});this.on=xe(this,"populate","blocked","versionchange",{ready:[fn,en]});this.on.ready.subscribe=p(this.on.ready.subscribe,function(n){return function(e,t){Fe.vip(function(){if(q){if(!B)Mn.resolve().then(e);if(t)n(e)}else if(M){M.push(e);if(t)n(e)}else{n(e);if(!t)n(function n(){z.on.ready.unsubscribe(e);z.on.ready.unsubscribe(n)})}})}});this.transaction=function(){var n=gn.apply(this,arguments);return this._transaction.apply(this,n)};function gn(n,e,t){var r=arguments.length;if(r<2)throw new $.InvalidArgument("Too few arguments");var i=new Array(r-1);while(--r)i[r-1]=arguments[r];t=i.pop();var o=E(i);return[n,o,t]}this._transaction=function(n,e,t){var r=Kn.trans;if(!r||r.db!==z||n.indexOf("!")!==-1)r=null;var i=n.indexOf("?")!==-1;n=n.replace("!","").replace("?","");try{var o=e.map(function(n){var e=n instanceof bn?n.name:n;if(typeof e!=="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e});if(n=="r"||n==U)n=U;else if(n=="rw"||n==V)n=V;else throw new $.InvalidArgument("Invalid transaction mode: "+n);if(r){if(r.mode===U&&n===V){if(i){r=null}else throw new $.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY")}if(r){o.forEach(function(n){if(r&&r.storeNames.indexOf(n)===-1){if(i){r=null}else throw new $.SubTransaction("Table "+n+" not included in parent transaction.")}})}if(i&&r&&!r.active){r=null}}}catch(n){return r?r._promise(null,function(e,t){t(n)}):ke(n)}return r?r._promise(n,u,"lock"):Kn.trans?ye(Kn.transless,function(){return z._whenReady(u)}):z._whenReady(u);function u(){return Mn.resolve().then(function(){var e=Kn.transless||Kn;var i=z._createTransaction(n,o,x,r);var u={trans:i,transless:e};if(r){i.idbtrans=r.idbtrans}else{i.create()}if(t.constructor===_n){ce()}var a;var s=Mn.follow(function(){a=t.call(i,i);if(a){if(a.constructor===wn){var n=fe.bind(null,null);a.then(n,n)}else if(typeof a.next==="function"&&typeof a.throw==="function"){a=Le(a)}}},u);return(a&&typeof a.then==="function"?Mn.resolve(a).then(function(n){return i.active?n:ke(new $.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):s.then(function(){return a})).then(function(n){if(r)i._resolve();return i._completion.then(function(){return n})}).catch(function(n){i._reject(n);return ke(n)})})}};this.table=function(n){if(!u(I,n)){throw new $.InvalidTable("Table "+n+" does not exist")}return I[n]};function bn(n,e,t){this.name=n;this.schema=e;this._tx=t;this.hook=I[n]?I[n].hook:xe(null,{creating:[un,en],reading:[rn,tn],updating:[sn,en],deleting:[an,en]})}function kn(n,e,t){return(t?Ve:Re)(function(t){n.push(t);e&&e()})}function xn(n,e,t,r,i){return new Mn(function(o,u){var a=t.length,s=a-1;if(a===0)return o();if(!r){for(var c=0;c<a;++c){var f=n.delete(t[c]);f.onerror=Re(u);if(c===s)f.onsuccess=ee(function(){return o()})}}else{var l,h=Ve(u),v=qe(null);w(function(){for(var r=0;r<a;++r){l={onsuccess:null,onerror:null};var u=t[r];i.call(l,u[0],u[1],e);var c=n.delete(u[0]);c._hookCtx=l;c.onerror=h;if(r===s)c.onsuccess=qe(o);else c.onsuccess=v}},function(n){l.onerror&&l.onerror(n);throw n})}})}a(bn.prototype,{_trans:function n(e,t,r){var i=this._tx||Kn.trans;return i&&i.db===z?i===Kn.trans?i._promise(e,t,r):se(function(){return i._promise(e,t,r)},{trans:i,transless:Kn.transless||Kn}):mn(e,[this.name],t)},_idbstore:function n(e,t,r){var i=this.name;function o(n,e,r){if(r.storeNames.indexOf(i)===-1)throw new $.NotFound("Table"+i+" not part of transaction");return t(n,e,r.idbtrans.objectStore(i),r)}return this._trans(e,o,r)},get:function(n,e){if(n&&n.constructor===Object)return this.where(n).first(e);var t=this;return this._idbstore(U,function(e,r,i){var o=i.get(n);o.onerror=Re(r);o.onsuccess=ee(function(){e(t.hook.reading.fire(o.result))},r)}).then(e)},where:function(t){if(typeof t==="string")return new Pn(this,t);if(e(t))return new Pn(this,"["+t.join("+")+"]");var r=n(t);if(r.length===1)return this.where(r[0]).equals(t[r[0]]);var i=this.schema.indexes.concat(this.schema.primKey).filter(function(n){return n.compound&&r.every(function(e){return n.keyPath.indexOf(e)>=0})&&n.keyPath.every(function(n){return r.indexOf(n)>=0})})[0];if(i&&Ee!==Pe)return this.where(i.name).equals(i.keyPath.map(function(n){return t[n]}));if(!i)console.warn("The query "+JSON.stringify(t)+" on "+this.name+" would benefit of a "+("compound index ["+r.join("+")+"]"));var o=this.schema.idxByName;var u=r.reduce(function(n,e){return[n[0]||o[e],n[0]||!o[e]?Vn(n[1],function(n){return""+_(n,e)==""+t[e]}):n[1]]},[null,null]);var a=u[0];return a?this.where(a.name).equals(t[a.keyPath]).filter(u[1]):i?this.filter(u[1]):this.where(r).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 En(new Pn(this,e(n)?"["+n.join("+")+"]":n))},toCollection:function(){return new En(new Pn(this))},mapToClass:function(n,e){this.schema.mappedClass=n;var t=Object.create(n.prototype);if(e){Ne(t,e)}this.schema.instanceTemplate=t;var r=function(e){if(!e)return e;var t=Object.create(n.prototype);for(var r in e)if(u(e,r))try{t[r]=e[r]}catch(n){}return t};if(this.schema.readHook){this.hook.reading.unsubscribe(this.schema.readHook)}this.schema.readHook=r;this.hook("reading",r);return n},defineClass:function(n){return this.mapToClass(Fe.defineClass(n),n)},bulkDelete:function(n){if(this.hook.deleting.fire===en){return this._idbstore(V,function(e,t,r,i){e(xn(r,i,n,false,en))})}else{return this.where(":id").anyOf(n).delete().then(function(){})}},bulkPut:function(n,e){var t=this;return this._idbstore(V,function(r,i,o){if(!o.keyPath&&!t.schema.primKey.auto&&!e)throw new $.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(o.keyPath&&e)throw new $.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(e&&e.length!==n.length)throw new $.InvalidArgument("Arguments objects and keys must have the same length");if(n.length===0)return r();var u=function(n){if(s.length===0)r(n);else i(new G(t.name+".bulkPut(): "+s.length+" of "+f+" operations failed",s))};var a,s=[],c,f=n.length,l=t;if(t.hook.creating.fire===en&&t.hook.updating.fire===en){c=kn(s);for(var h=0,v=n.length;h<v;++h){a=e?o.put(n[h],e[h]):o.put(n[h]);a.onerror=c}a.onerror=kn(s,u);a.onsuccess=Ue(u)}else{var d=e||o.keyPath&&n.map(function(n){return _(n,o.keyPath)});var p=d&&g(d,function(e,t){return e!=null&&[e,n[t]]});var y=!d?l.bulkAdd(n):l.where(":id").anyOf(d.filter(function(n){return n!=null})).modify(function(){this.value=p[this.primKey];p[this.primKey]=null}).catch(H,function(n){s=n.failures}).then(function(){var t=[],r=e&&[];for(var i=d.length-1;i>=0;--i){var o=d[i];if(o==null||p[o]){t.push(n[i]);e&&r.push(o);if(o!=null)p[o]=null}}t.reverse();e&&r.reverse();return l.bulkAdd(t,r)}).then(function(n){var e=d[d.length-1];return e!=null?e:n});y.then(u).catch(G,function(n){s=s.concat(n.failures);u()}).catch(i)}},"locked")},bulkAdd:function(n,e){var t=this,r=this.hook.creating.fire;return this._idbstore(V,function(i,o,u,a){if(!u.keyPath&&!t.schema.primKey.auto&&!e)throw new $.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(u.keyPath&&e)throw new $.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(e&&e.length!==n.length)throw new $.InvalidArgument("Arguments objects and keys must have the same length");if(n.length===0)return i();function s(n){if(f.length===0)i(n);else o(new G(t.name+".bulkAdd(): "+f.length+" of "+v+" operations failed",f))}var c,f=[],l,h,v=n.length;if(r!==en){var d=u.keyPath,p;l=kn(f,null,true);h=qe(null);w(function(){for(var t=0,i=n.length;t<i;++t){p={onerror:null,onsuccess:null};var o=e&&e[t];var s=n[t],f=e?o:d?_(s,d):undefined,v=r.call(p,f,s,a);if(f==null&&v!=null){if(d){s=O(s);k(s,d,v)}else{o=v}}c=o!=null?u.add(s,o):u.add(s);c._hookCtx=p;if(t<i-1){c.onerror=l;if(p.onsuccess)c.onsuccess=h}}},function(n){p.onerror&&p.onerror(n);throw n});c.onerror=kn(f,s,true);c.onsuccess=qe(s)}else{l=kn(f);for(var y=0,m=n.length;y<m;++y){c=e?u.add(n[y],e[y]):u.add(n[y]);c.onerror=l}c.onerror=kn(f,s);c.onsuccess=Ue(s)}})},add:function(n,e){var t=this.hook.creating.fire;return this._idbstore(V,function(r,i,o,u){var a={onsuccess:null,onerror:null};if(t!==en){var s=e!=null?e:o.keyPath?_(n,o.keyPath):undefined;var c=t.call(a,s,n,u);if(s==null&&c!=null){if(o.keyPath)k(n,o.keyPath,c);else e=c}}try{var f=e!=null?o.add(n,e):o.add(n);f._hookCtx=a;f.onerror=Ve(i);f.onsuccess=qe(function(e){var t=o.keyPath;if(t)k(n,t,e);r(e)})}catch(n){if(a.onerror)a.onerror(n);throw n}})},put:function(n,e){var t=this;var r=this.hook.creating.fire,i=this.hook.updating.fire;if(r!==en||i!==en){var o=this.schema.primKey.keyPath;var u=e!==undefined?e:o&&_(n,o);if(u==null)return this.add(n);n=O(n);return this._trans(V,function(){return t.where(":id").equals(u).modify(function(){this.value=n}).then(function(r){return r===0?t.add(n,e):u})},"locked")}else{return this._idbstore(V,function(t,r,i){var o=e!==undefined?i.put(n,e):i.put(n);o.onerror=Re(r);o.onsuccess=ee(function(e){var r=i.keyPath;if(r)k(n,r,e.target.result);t(o.result)})})}},delete:function(n){if(this.hook.deleting.subscribers.length){return this.where(":id").equals(n).delete()}else{return this._idbstore(V,function(e,t,r){var i=r.delete(n);i.onerror=Re(t);i.onsuccess=ee(function(){e(i.result)})})}},clear:function(){if(this.hook.deleting.subscribers.length){return this.toCollection().delete()}else{return this._idbstore(V,function(n,e,t){var r=t.clear();r.onerror=Re(e);r.onsuccess=ee(function(){n(r.result)})})}},update:function(t,r){if(typeof r!=="object"||e(r))throw new $.InvalidArgument("Modifications must be an object.");if(typeof t==="object"&&!e(t)){n(r).forEach(function(n){k(t,n,r[n])});var i=_(t,this.schema.primKey.keyPath);if(i===undefined)return ke(new $.InvalidArgument("Given object does not contain its primary key"));return this.where(":id").equals(i).modify(r)}else{return this.where(":id").equals(t).modify(r)}}});function jn(n,e,t,r){var i=this;this.db=z;this.mode=n;this.storeNames=e;this.idbtrans=null;this.on=xe(this,"complete","error","abort");this.parent=r||null;this.active=true;this._reculock=0;this._blockedFuncs=[];this._resolve=null;this._reject=null;this._waitingFor=null;this._waitingQueue=null;this._spinCount=0;this._completion=new Mn(function(n,e){i._resolve=n;i._reject=e});this._completion.then(function(){i.active=false;i.on.complete.fire()},function(n){var e=i.active;i.active=false;i.on.error.fire(n);i.parent?i.parent._reject(n):e&&i.idbtrans&&i.idbtrans.abort();return ke(n)})}a(jn.prototype,{_lock:function(){y(!Kn.global);++this._reculock;if(this._reculock===1&&!Kn.global)Kn.lockOwnerFor=this;return this},_unlock:function(){y(!Kn.global);if(--this._reculock===0){if(!Kn.global)Kn.lockOwnerFor=null;while(this._blockedFuncs.length>0&&!this._locked()){var n=this._blockedFuncs.shift();try{ye(n[1],n[0])}catch(n){}}}return this},_locked:function(){return this._reculock&&Kn.lockOwnerFor!==this},create:function(n){var e=this;if(!this.mode)return this;y(!this.idbtrans);if(!n&&!D){switch(B&&B.name){case"DatabaseClosedError":throw new $.DatabaseClosed(B);case"MissingAPIError":throw new $.MissingAPI(B.message,B);default:throw new $.OpenFailed(B)}}if(!this.active)throw new $.TransactionInactive;y(this._completion._state===null);n=this.idbtrans=n||D.transaction(He(this.storeNames),this.mode);n.onerror=ee(function(t){ze(t);e._reject(n.error)});n.onabort=ee(function(t){ze(t);e.active&&e._reject(new $.Abort(n.error));e.active=false;e.on("abort").fire(t)});n.oncomplete=ee(function(){e.active=false;e._resolve()});return this},_promise:function(n,e,t){var r=this;if(n===V&&this.mode!==V)return ke(new $.ReadOnly("Transaction is readonly"));if(!this.active)return ke(new $.TransactionInactive);if(this._locked()){return new Mn(function(i,o){r._blockedFuncs.push([function(){r._promise(n,e,t).then(i,o)},Kn])})}else if(t){return se(function(){var n=new Mn(function(n,t){r._lock();var i=e(n,t,r);if(i&&i.then)i.then(n,t)});n.finally(function(){return r._unlock()});n._lib=true;return n})}else{var i=new Mn(function(n,t){var i=e(n,t,r);if(i&&i.then)i.then(n,t)});i._lib=true;return i}},_root:function(){return this.parent?this.parent._root():this},waitFor:function(n){var e=this._root();n=Mn.resolve(n);if(e._waitingFor){e._waitingFor=e._waitingFor.then(function(){return n})}else{e._waitingFor=n;e._waitingQueue=[];var t=e.idbtrans.objectStore(e.storeNames[0]);(function n(){++e._spinCount;while(e._waitingQueue.length)e._waitingQueue.shift()();if(e._waitingFor)t.get(-Infinity).onsuccess=n})()}var r=e._waitingFor;return new Mn(function(t,i){n.then(function(n){return e._waitingQueue.push(ee(t.bind(null,n)))},function(n){return e._waitingQueue.push(ee(i.bind(null,n)))}).finally(function(){if(e._waitingFor===r){e._waitingFor=null}})})},abort:function(){this.active&&this._reject(new $.Abort);this.active=false},tables:{get:R("Transaction.tables",function(){return I})},table:function(n){var e=z.table(n);return new bn(n,e.schema,this)}});function Pn(n,e,t){this._ctx={table:n,index:e===":id"?null:e,or:t}}a(Pn.prototype,function(){function n(n,e,t){var r=n instanceof Pn?new En(n):n;r._ctx.error=t?new t(e):new TypeError(e);return r}function e(n){return new En(n,function(){return m.only("")}).limit(0)}function t(n){return n==="next"?function(n){return n.toUpperCase()}:function(n){return n.toLowerCase()}}function r(n){return n==="next"?function(n){return n.toLowerCase()}:function(n){return n.toUpperCase()}}function i(n,e,t,r,i,o){var u=Math.min(n.length,r.length);var a=-1;for(var s=0;s<u;++s){var c=e[s];if(c!==r[s]){if(i(n[s],t[s])<0)return n.substr(0,s)+t[s]+t.substr(s+1);if(i(n[s],r[s])<0)return n.substr(0,s)+r[s]+t.substr(s+1);if(a>=0)return n.substr(0,a)+e[a]+t.substr(a+1);return null}if(i(n[s],c)<0)a=s}if(u<r.length&&o==="next")return n+t.substr(n.length);if(u<n.length&&o==="prev")return n.substr(0,t.length);return a<0?null:n.substr(0,a)+r[a]+t.substr(a+1)}function o(e,o,u,a){var s,c,f,l,h,v,d,p=u.length;if(!u.every(function(n){return typeof n==="string"})){return n(e,Se)}function y(n){s=t(n);c=r(n);f=n==="next"?Rn:Un;var e=u.map(function(n){return{lower:c(n),upper:s(n)}}).sort(function(n,e){return f(n.lower,e.lower)});l=e.map(function(n){return n.upper});h=e.map(function(n){return n.lower});v=n;d=n==="next"?"":a}y("next");var g=new En(e,function(){return m.bound(l[0],h[p-1]+a)});g._ondirectionchange=function(n){y(n)};var b=0;g._addAlgorithm(function(n,e,t){var r=n.key;if(typeof r!=="string")return false;var u=c(r);if(o(u,h,b)){return true}else{var a=null;for(var s=b;s<p;++s){var y=i(r,u,l[s],h[s],f,v);if(y===null&&a===null)b=s+1;else if(a===null||f(a,y)>0){a=y}}if(a!==null){e(function(){n.continue(a+d)})}else{e(t)}return false}});return g}return{between:function(t,r,i,o){i=i!==false;o=o===true;try{if(Tn(t,r)>0||Tn(t,r)===0&&(i||o)&&!(i&&o))return e(this);return new En(this,function(){return m.bound(t,r,!i,!o)})}catch(e){return n(this,Oe)}},equals:function(n){return new En(this,function(){return m.only(n)})},above:function(n){return new En(this,function(){return m.lowerBound(n,true)})},aboveOrEqual:function(n){return new En(this,function(){return m.lowerBound(n)})},below:function(n){return new En(this,function(){return m.upperBound(n,true)})},belowOrEqual:function(n){return new En(this,function(){return m.upperBound(n)})},startsWith:function(e){if(typeof e!=="string")return n(this,Se);return this.between(e,e+Pe,true,true)},startsWithIgnoreCase:function(n){if(n==="")return this.startsWith(n);return o(this,function(n,e){return n.indexOf(e[0])===0},[n],Pe)},equalsIgnoreCase:function(n){return o(this,function(n,e){return n===e[0]},[n],"")},anyOfIgnoreCase:function(){var n=K.apply(C,arguments);if(n.length===0)return e(this);return o(this,function(n,e){return e.indexOf(n)!==-1},n,"")},startsWithAnyOfIgnoreCase:function(){var n=K.apply(C,arguments);if(n.length===0)return e(this);return o(this,function(n,e){return e.some(function(e){return n.indexOf(e)===0})},n,Pe)},anyOf:function(){var t=K.apply(C,arguments);var r=Nn;try{t.sort(r)}catch(e){return n(this,Oe)}if(t.length===0)return e(this);var i=new En(this,function(){return m.bound(t[0],t[t.length-1])});i._ondirectionchange=function(n){r=n==="next"?Nn:qn;t.sort(r)};var o=0;i._addAlgorithm(function(n,e,i){var u=n.key;while(r(u,t[o])>0){++o;if(o===t.length){e(i);return false}}if(r(u,t[o])===0){return true}else{e(function(){n.continue(t[o])});return false}});return i},notEqual:function(n){return this.inAnyRange([[Ae,n],[n,Ee]],{includeLowers:false,includeUppers:false})},noneOf:function(){var e=K.apply(C,arguments);if(e.length===0)return new En(this);try{e.sort(Nn)}catch(e){return n(this,Oe)}var t=e.reduce(function(n,e){return n?n.concat([[n[n.length-1][1],e]]):[[Ae,e]]},null);t.push([e[e.length-1],Ee]);return this.inAnyRange(t,{includeLowers:false,includeUppers:false})},inAnyRange:function(t,r){if(t.length===0)return e(this);if(!t.every(function(n){return n[0]!==undefined&&n[1]!==undefined&&Nn(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",$.InvalidArgument)}var i=!r||r.includeLowers!==false;var o=r&&r.includeUppers===true;function u(n,e){for(var t=0,r=n.length;t<r;++t){var i=n[t];if(Tn(e[0],i[1])<0&&Tn(e[1],i[0])>0){i[0]=Bn(i[0],e[0]);i[1]=Fn(i[1],e[1]);break}}if(t===r)n.push(e);return n}var a=Nn;function s(n,e){return a(n[0],e[0])}var c;try{c=t.reduce(u,[]);c.sort(s)}catch(e){return n(this,Oe)}var f=0;var l=o?function(n){return Nn(n,c[f][1])>0}:function(n){return Nn(n,c[f][1])>=0};var h=i?function(n){return qn(n,c[f][0])>0}:function(n){return qn(n,c[f][0])>=0};function v(n){return!l(n)&&!h(n)}var d=l;var p=new En(this,function(){return m.bound(c[0][0],c[c.length-1][1],!i,!o)});p._ondirectionchange=function(n){if(n==="next"){d=l;a=Nn}else{d=h;a=qn}c.sort(s)};p._addAlgorithm(function(n,e,t){var r=n.key;while(d(r)){++f;if(f===c.length){e(t);return false}}if(v(r)){return true}else if(Tn(r,c[f][1])===0||Tn(r,c[f][0])===0){return false}else{e(function(){if(a===Nn)n.continue(c[f][0]);else n.continue(c[f][1])});return false}});return p},startsWithAnyOf:function(){var t=K.apply(C,arguments);if(!t.every(function(n){return typeof n==="string"})){return n(this,"startsWithAnyOf() only works with strings")}if(t.length===0)return e(this);return this.inAnyRange(t.map(function(n){return[n,n+Pe]}))}}});function En(n,e){var t=null,r=null;if(e)try{t=e()}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:t,keysOnly:false,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:true,isMatch:null,offset:0,limit:Infinity,error:r,or:i.or,valueMapper:o.hook.reading.fire}}function An(n,e){return!(n.filter||n.algorithm||n.or)&&(e?n.justLimit:!n.replayFilter)}a(En.prototype,function(){function e(n,e){n.filter=Vn(n.filter,e)}function t(n,e,t){var r=n.replayFilter;n.replayFilter=r?function(){return Vn(r(),e())}:e;n.justLimit=t&&!r}function i(n,e){n.isMatch=Vn(n.isMatch,e)}function o(n,e){if(n.isPrimKey)return e;var t=n.table.schema.idxByName[n.index];if(!t)throw new $.Schema("KeyPath "+n.index+" on object store "+e.name+" is not indexed");return e.index(t.name)}function a(n,e){var t=o(n,e);return n.keysOnly&&"openKeyCursor"in t?t.openKeyCursor(n.range||null,n.dir+n.unique):t.openCursor(n.range||null,n.dir+n.unique)}function s(n,e,t,r,i){var o=n.replayFilter?Vn(n.filter,n.replayFilter()):n.filter;if(!n.or){Dn(a(n,i),Vn(n.algorithm,o),e,t,r,!n.keysOnly&&n.valueMapper)}else(function(){var s={};var c=0;function f(){if(++c===2)t()}function l(n,t,i){if(!o||o(t,i,f,r)){var a=t.primaryKey;var c=""+a;if(c==="[object ArrayBuffer]")c=""+new Uint8Array(a);if(!u(s,c)){s[c]=true;e(n,t,i)}}}n.or._iterate(l,f,r,i);Dn(a(n,i),n.algorithm,l,f,r,!n.keysOnly&&n.valueMapper)})()}return{_read:function(n,e){var t=this._ctx;return t.error?t.table._trans(null,ke.bind(null,t.error)):t.table._idbstore(U,n).then(e)},_write:function(n){var e=this._ctx;return e.error?e.table._trans(null,ke.bind(null,e.error)):e.table._idbstore(V,n,"locked")},_addAlgorithm:function(n){var e=this._ctx;e.algorithm=Vn(e.algorithm,n)},_iterate:function(n,e,t,r){return s(this._ctx,n,e,t,r)},clone:function(n){var e=Object.create(this.constructor.prototype),t=Object.create(this._ctx);if(n)r(t,n);e._ctx=t;return e},raw:function(){this._ctx.valueMapper=null;return this},each:function(n){var e=this._ctx;return this._read(function(t,r,i){s(e,n,t,r,i)})},count:function(n){var e=this._ctx;if(An(e,true)){return this._read(function(n,t,r){var i=o(e,r);var u=e.range?i.count(e.range):i.count();u.onerror=Re(t);u.onsuccess=function(t){n(Math.min(t.target.result,e.limit))}},n)}else{var t=0;return this._read(function(n,r,i){s(e,function(){++t;return false},function(){n(t)},r,i)},n)}},sortBy:function(n,e){var t=n.split(".").reverse(),r=t[0],i=t.length-1;function o(n,e){if(e)return o(n[t[e]],e-1);return n[r]}var u=this._ctx.dir==="next"?1:-1;function a(n,e){var t=o(n,i),r=o(e,i);return t<r?-u:t>r?u:0}return this.toArray(function(n){return n.sort(a)}).then(e)},toArray:function(n){var e=this._ctx;return this._read(function(n,t,r){if(Z&&e.dir==="next"&&An(e,true)&&e.limit>0){var i=e.table.hook.reading.fire;var u=o(e,r);var a=e.limit<Infinity?u.getAll(e.range,e.limit):u.getAll(e.range);a.onerror=Re(t);a.onsuccess=i===tn?Ue(n):Ue(function(e){try{n(e.map(i))}catch(n){t(n)}})}else{var c=[];s(e,function(n){c.push(n)},function e(){n(c)},t,r)}},n)},offset:function(n){var e=this._ctx;if(n<=0)return this;e.offset+=n;if(An(e)){t(e,function(){var e=n;return function(n,t){if(e===0)return true;if(e===1){--e;return false}t(function(){n.advance(e);e=0});return false}})}else{t(e,function(){var e=n;return function(){return--e<0}})}return this},limit:function(n){this._ctx.limit=Math.min(this._ctx.limit,n);t(this._ctx,function(){var e=n;return function(n,t,r){if(--e<=0)t(r);return e>=0}},true);return this},until:function(n,t){e(this._ctx,function(e,r,i){if(n(e.value)){r(i);return t}else{return true}});return 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){e(this._ctx,function(e){return n(e.value)});i(this._ctx,n);return this},and:function(n){return this.filter(n)},or:function(n){return new Pn(this._ctx.table,n,this)},reverse:function(){this._ctx.dir=this._ctx.dir==="prev"?"next":"prev";if(this._ondirectionchange)this._ondirectionchange(this._ctx.dir);return this},desc:function(){return this.reverse()},eachKey:function(n){var e=this._ctx;e.keysOnly=!e.isMatch;return this.each(function(e,t){n(t.key,t)})},eachUniqueKey:function(n){this._ctx.unique="unique";return this.eachKey(n)},eachPrimaryKey:function(n){var e=this._ctx;e.keysOnly=!e.isMatch;return this.each(function(e,t){n(t.primaryKey,t)})},keys:function(n){var e=this._ctx;e.keysOnly=!e.isMatch;var t=[];return this.each(function(n,e){t.push(e.key)}).then(function(){return t}).then(n)},primaryKeys:function(n){var e=this._ctx;if(Z&&e.dir==="next"&&An(e,true)&&e.limit>0){return this._read(function(n,t,r){var i=o(e,r);var u=e.limit<Infinity?i.getAllKeys(e.range,e.limit):i.getAllKeys(e.range);u.onerror=Re(t);u.onsuccess=Ue(n)}).then(n)}e.keysOnly=!e.isMatch;var t=[];return this.each(function(n,e){t.push(e.primaryKey)}).then(function(){return t}).then(n)},uniqueKeys:function(n){this._ctx.unique="unique";return 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,t=n.index&&n.table.schema.idxByName[n.index];if(!t||!t.multi)return this;var r={};e(this._ctx,function(n){var e=n.primaryKey.toString();var t=u(r,e);r[e]=true;return!t});return this},modify:function(e){var t=this,i=this._ctx,o=i.table.hook,a=o.updating.fire,s=o.deleting.fire;return this._write(function(i,o,c,f){var l;if(typeof e==="function"){if(a===en&&s===en){l=e}else{l=function(t){var r=O(t);if(e.call(this,t,this)===false)return false;if(!u(this,"value")){s.call(this,this.primKey,t,f)}else{var i=S(r,this.value);var o=a.call(this,i,this.primKey,r,f);if(o){t=this.value;n(o).forEach(function(n){k(t,n,o[n])})}}}}}else if(a===en){var h=n(e);var v=h.length;l=function(n){var t=false;for(var r=0;r<v;++r){var i=h[r],o=e[i];if(_(n,i)!==o){k(n,i,o);t=true}}return t}}else{var d=e;e=j(d);l=function(t){var i=false;var o=a.call(this,e,this.primKey,O(t),f);if(o)r(e,o);n(e).forEach(function(n){var r=e[n];if(_(t,n)!==r){k(t,n,r);i=true}});if(o)e=j(d);return i}}var p=0;var y=0;var m=false;var g=[];var b=[];var x=null;function P(n,e){x=e.primaryKey;var t={primKey:e.primaryKey,value:n,onsuccess:null,onerror:null};function r(n){g.push(n);b.push(t.primKey);A();return true}if(l.call(t,n,t)!==false){var i=!u(t,"value");++p;w(function(){var n=i?e.delete():e.update(t.value);n._hookCtx=t;n.onerror=Ve(r);n.onsuccess=qe(function(){++y;A()})},r)}else if(t.onsuccess){t.onsuccess(t.value)}}function E(n){if(n){g.push(n);b.push(x)}return o(new H("Error modifying one or more objects",g,y,b))}function A(){if(m&&y+g.length===p){if(g.length>0)E();else i(y)}}t.clone().raw()._iterate(P,function(){m=true;A()},E,c)})},delete:function(){var n=this;var e=this._ctx,t=e.range,r=e.table.hook.deleting.fire,i=r!==en;if(!i&&An(e)&&(e.isPrimKey&&!Ke||!t)){return this._write(function(n,e,r){var i=Re(e),o=t?r.count(t):r.count();o.onerror=i;o.onsuccess=function(){var u=o.result;w(function(){var e=t?r.delete(t):r.clear();e.onerror=i;e.onsuccess=function(){return n(u)}},function(n){return e(n)})}})}var o=i?2e3:1e4;return this._write(function(t,u,a,s){var c=0;var f=n.clone({keysOnly:!e.isMatch&&!i}).distinct().limit(o).raw();var l=[];var h=function(){return f.each(i?function(n,e){l.push([e.primaryKey,e.value])}:function(n,e){l.push(e.primaryKey)}).then(function(){i?l.sort(function(n,e){return Nn(n[0],e[0])}):l.sort(Nn);return xn(a,s,l,i,r)}).then(function(){var n=l.length;c+=n;l=[];return n<o?c:h()})};t(h())})}}});function On(n,e){return n._cfg.version-e._cfg.version}function Sn(n,e,t){e.forEach(function(e){var r=t[e];n.forEach(function(n){if(!(e in n)){if(n===jn.prototype||n instanceof jn){c(n,e,{get:function(){return this.table(e)}})}else{n[e]=new bn(e,r)}}})})}function In(n){n.forEach(function(n){for(var e in n){if(n[e]instanceof bn)delete n[e]}})}function Dn(n,e,t,r,i,o){var u=o?function(n,e,r){return t(o(n),e,r)}:t;var a=ee(u,i);if(!n.onerror)n.onerror=Re(i);if(e){n.onsuccess=b(function t(){var o=n.result;if(o){var u=function(){o.continue()};if(e(o,function(n){u=n},r,i))a(o.value,o,function(n){u=n});u()}else{r()}},i)}else{n.onsuccess=b(function e(){var t=n.result;if(t){var i=function(){t.continue()};a(t.value,t,function(n){i=n});i()}else{r()}},i)}}function Cn(n){var t=[];n.split(",").forEach(function(n){n=n.trim();var r=n.replace(/([&*]|\+\+)/g,"");var i=/^\[/.test(r)?r.match(/^\[(.*)\]$/)[1].split("+"):r;t.push(new We(r,i||null,/\&/.test(n),/\*/.test(n),/\+\+/.test(n),e(i),/\./.test(n)))});return t}function Tn(n,e){return v.cmp(n,e)}function Bn(n,e){return Tn(n,e)<0?n:e}function Fn(n,e){return Tn(n,e)>0?n:e}function Nn(n,e){return v.cmp(n,e)}function qn(n,e){return v.cmp(e,n)}function Rn(n,e){return n<e?-1:n===e?0:1}function Un(n,e){return n>e?-1:n===e?0:1}function Vn(n,e){return n?e?function(){return n.apply(this,arguments)&&e.apply(this,arguments)}:n:e}function zn(){z.verno=D.version/10;z._dbSchema=x={};A=d(D.objectStoreNames,0);if(A.length===0)return;var e=D.transaction(He(A),"readonly");A.forEach(function(n){var t=e.objectStore(n),r=t.keyPath,i=r&&typeof r==="string"&&r.indexOf(".")!==-1;var o=new We(r,r||"",false,false,!!t.autoIncrement,r&&typeof r!=="string",i);var u=[];for(var a=0;a<t.indexNames.length;++a){var s=t.index(t.indexNames[a]);r=s.keyPath;i=r&&typeof r==="string"&&r.indexOf(".")!==-1;var c=new We(s.name,r,!!s.unique,!!s.multiEntry,false,r&&typeof r!=="string",i);u.push(c)}x[n]=new Qe(n,o,u,{})});Sn([I],n(x),x)}function Ln(n,e){var r=e.db.objectStoreNames;for(var i=0;i<r.length;++i){var o=r[i];var u=e.objectStore(o);Z="getAll"in u;for(var a=0;a<u.indexNames.length;++a){var s=u.indexNames[a];var c=u.index(s).keyPath;var f=typeof c==="string"?c:"["+d(c).join("+")+"]";if(n[o]){var l=n[o].idxByName[f];if(l)l.name=s}}}if(/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&t.WorkerGlobalScope&&t instanceof t.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604){Z=false}}function Wn(n){z.on("blocked").fire(n);Ie.filter(function(n){return n.name===z.name&&n!==z&&!n._vcFired}).map(function(e){return e.on("versionchange").fire(n)})}r(this,{Collection:En,Table:bn,Transaction:jn,Version:on,WhereClause:Pn});nn();l.forEach(function(n){n(z)})}function Me(n){if(typeof n==="function"){return new n}else if(e(n)){return[Me(n[0])]}else if(n&&typeof n==="object"){var t={};Ne(t,n);return t}else{return n}}function Ne(e,t){n(t).forEach(function(n){var r=Me(t[n]);e[n]=r});return e}function qe(n){return ee(function(e){var t=e.target,r=t._hookCtx,i=r.value||t.result,o=r&&r.onsuccess;o&&o(i);n&&n(i)},n)}function Re(n){return ee(function(e){ze(e);n(e.target.error);return false})}function Ue(n){return ee(function(e){n(e.target.result)})}function Ve(n){return ee(function(e){var t=e.target,r=t.error,i=t._hookCtx,o=i&&i.onerror;o&&o(r);ze(e);n(r);return false})}function ze(n){if(n.stopPropagation)n.stopPropagation();if(n.preventDefault)n.preventDefault()}function Le(n){var t=function(e){return n.next(e)},r=function(e){return n.throw(e)},i=u(t),o=u(r);function u(n){return function(t){var r=n(t),u=r.value;return r.done?u:!u||typeof u.then!=="function"?e(u)?Mn.all(u).then(i,o):i(u):u.then(i,o)}}return u(t)()}function We(n,e,t,r,i,o,u){this.name=n;this.keyPath=e;this.unique=t;this.multi=r;this.auto=i;this.compound=o;this.dotted=u;var a=typeof e==="string"?e:e&&"["+[].join.call(e,"+")+"]";this.src=(t?"&":"")+(r?"*":"")+(i?"++":"")+a}function Qe(n,e,t,r){this.name=n;this.primKey=e||new We;this.indexes=t||[new We];this.instanceTemplate=r;this.mappedClass=null;this.idxByName=g(t,function(n){return[n.name,n]})}function He(n){return n.length===1?n[0]:n}function Ge(n){var e=n&&(n.getDatabaseNames||n.webkitGetDatabaseNames);return e&&e.bind(n)}a(Fe,nn);a(Fe,{delete:function(n){var e=new Fe(n),t=e.delete();t.onblocked=function(n){e.on("blocked",n);return this};return t},exists:function(n){return new Fe(n).open().then(function(n){n.close();return true}).catch(Fe.NoSuchDatabaseError,function(){return false})},getDatabaseNames:function(n){var e=Ge(Fe.dependencies.indexedDB);return e?new Mn(function(n,t){var r=e();r.onsuccess=function(e){n(d(e.target.result,0))};r.onerror=Re(t)}).then(n):Be.dbnames.toCollection().primaryKeys(n)},defineClass:function(){function n(n){if(n)r(this,n)}return n},applyStructure:Ne,ignoreTransaction:function(n){return Kn.trans?ye(Kn.transless,n):n()},vip:function(n){return se(function(){Kn.letThrough=true;return n()})},async:function(n){return function(){try{var e=Le(n.apply(this,arguments));if(!e||typeof e.then!=="function")return Mn.resolve(e);return e}catch(n){return ke(n)}}},spawn:function(n,e,t){try{var r=Le(n.apply(t,e||[]));if(!r||typeof r.then!=="function")return Mn.resolve(r);return r}catch(n){return ke(n)}},currentTransaction:{get:function(){return Kn.trans||null}},waitFor:function(n,e){var t=Mn.resolve(typeof n==="function"?Fe.ignoreTransaction(n):n).timeout(e||6e4);return Kn.trans?Kn.trans.waitFor(t):t},Promise:Mn,debug:{get:function(){return T},set:function(n){B(n,n==="dexie"?function(){return true}:Te)}},derive:f,extend:r,props:a,override:p,Events:xe,getByKeyPath:_,setByKeyPath:k,delByKeyPath:x,shallowClone:j,deepClone:O,getObjectDiff:S,asap:m,maxKey:Ee,minKey:Ae,addons:[],connections:Ie,MultiModifyError:$.Modify,errnames:J,IndexSpec:We,TableSchema:Qe,dependencies:function(){try{return{indexedDB:t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,IDBKeyRange:t.IDBKeyRange||t.webkitIDBKeyRange}}catch(n){return{indexedDB:null,IDBKeyRange:null}}}(),semVer:je,version:je.split(".").map(function(n){return parseInt(n)}).reduce(function(n,e,t){return n+e/Math.pow(10,t*2)}),default:Fe,Dexie:Fe});Mn.rejectionMapper=Z;Be=new Fe("__dbnames");Be.version(1).stores({dbnames:"name"});(function(){var n="Dexie.DatabaseNames";try{if(typeof localStorage!==undefined&&t.document!==undefined){JSON.parse(localStorage.getItem(n)||"[]").forEach(function(n){return Be.dbnames.put({name:n}).catch(en)});localStorage.removeItem(n)}}catch(n){}})();return Fe}); //# sourceMappingURL=dexie.map.js