Changeset 3207453
- Timestamp:
- 12/13/2024 08:58:34 AM (12 months ago)
- Location:
- super-admin-all-sites-menu
- Files:
-
- 2 added
- 8 edited
- 1 copied
-
tags/1.6.9 (copied) (copied from super-admin-all-sites-menu/trunk)
-
tags/1.6.9/blueprint.json (added)
-
tags/1.6.9/build/index.asset.php (modified) (1 diff)
-
tags/1.6.9/build/index.js (modified) (1 diff)
-
tags/1.6.9/readme.txt (modified) (2 diffs)
-
tags/1.6.9/super-admin-all-sites-menu.php (modified) (2 diffs)
-
trunk/blueprint.json (added)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/super-admin-all-sites-menu.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
super-admin-all-sites-menu/tags/1.6.9/build/index.asset.php
r3036551 r3207453 1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => ' 83258dff0f23c505ee1c');1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => '9878ba2245702b087402'); -
super-admin-all-sites-menu/tags/1.6.9/build/index.js
r3036551 r3207453 1 1 /*! 2 2 * super-admin-all-sites-menu 3 * version: 1.6. 73 * version: 1.6.9 4 4 * address: https://github.com/soderlind/super-admin-all-sites-menu#readme 5 5 * author: Per Søderlind 6 6 * license: GPLv2 7 */(()=>{ "use strict";var e={};e.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,n=Object.keys,r=Array.isArray;function s(e,t){return"object"!=typeof t||n(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||t.Promise||(t.Promise=Promise);const i=Object.getPrototypeOf,o={}.hasOwnProperty;function a(e,t){return o.call(e,t)}function l(e,t){"function"==typeof t&&(t=t(i(e))),("undefined"==typeof Reflect?n:Reflect.ownKeys)(t).forEach((n=>{c(e,n,t[n])}))}const u=Object.defineProperty;function c(e,t,n,r){u(e,t,s(n&&a(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function h(e){return{from:function(t){return e.prototype=Object.create(t.prototype),c(e.prototype,"constructor",e),{extend:l.bind(null,e.prototype)}}}}const d=Object.getOwnPropertyDescriptor;function f(e,t){let n;return d(e,t)||(n=i(e))&&f(n,t)}const p=[].slice;function y(e,t,n){return p.call(e,t,n)}function m(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function g(e){t.setImmediate?setImmediate(e):setTimeout(e,0)}function v(e,t){return e.reduce(((e,n,r)=>{var s=t(n,r);return s&&(e[s[0]]=s[1]),e}),{})}function w(e,t){if("string"==typeof t&&a(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,s=t.length;r<s;++r){var i=w(e,t[r]);n.push(i)}return n}var o=t.indexOf(".");if(-1!==o){var l=e[t.substr(0,o)];return void 0===l?void 0:w(l,t.substr(o+1))}}function _(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 s=0,i=t.length;s<i;++s)_(e,t[s],n[s])}else{var o=t.indexOf(".");if(-1!==o){var l=t.substr(0,o),u=t.substr(o+1);if(""===u)void 0===n?r(e)&&!isNaN(parseInt(l))?e.splice(l,1):delete e[l]:e[l]=n;else{var c=e[l];c&&a(e,l)||(c=e[l]={}),_(c,u,n)}}else void 0===n?r(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function x(e){var t={};for(var n in e)a(e,n)&&(t[n]=e[n]);return t}const k=[].concat;function E(e){return k.apply([],e)}const P="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(E([8,16,32,64].map((e=>["Int","Uint","Float"].map((t=>t+e+"Array")))))).filter((e=>t[e])),S=P.map((e=>t[e]));v(P,(e=>[e,!0]));let K=null;function O(e){K="undefined"!=typeof WeakMap&&new WeakMap;const t=A(e);return K=null,t}function A(e){if(!e||"object"!=typeof e)return e;let t=K&&K.get(e);if(t)return t;if(r(e)){t=[],K&&K.set(e,t);for(var n=0,s=e.length;n<s;++n)t.push(A(e[n]))}else if(S.indexOf(e.constructor)>=0)t=e;else{const n=i(e);for(var o in t=n===Object.prototype?{}:Object.create(n),K&&K.set(e,t),e)a(e,o)&&(t[o]=A(e[o]))}return t}const{toString:C}={};function j(e){return C.call(e).slice(8,-1)}const B="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",D="symbol"==typeof B?function(e){var t;return null!=e&&(t=e[B])&&t.apply(e)}:function(){return null},I={};function T(e){var t,n,s,i;if(1===arguments.length){if(r(e))return e.slice();if(this===I&&"string"==typeof e)return[e];if(i=D(e)){for(n=[];!(s=i.next()).done;)n.push(s.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}const R="undefined"!=typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var M="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function F(e,t){M=e,N=t}var N=()=>!0;const q=!new Error("").stack;function $(){if(q)try{throw $.arguments,new Error}catch(e){return e}return new Error}function L(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(N).map((e=>"\n"+e)).join("")):""}var U=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],V=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(U),W={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function Y(e,t){this._e=$(),this.name=e,this.message=t}function z(e,t){return e+". Errors: "+Object.keys(t).map((e=>t[e].toString())).filter(((e,t,n)=>n.indexOf(e)===t)).join("\n")}function H(e,t,n,r){this._e=$(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=z(e,t)}function G(e,t){this._e=$(),this.name="BulkError",this.failures=Object.keys(t).map((e=>t[e])),this.failuresByPos=t,this.message=z(e,t)}h(Y).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+L(this._e,2))}},toString:function(){return this.name+": "+this.message}}),h(H).from(Y),h(G).from(Y);var Q=V.reduce(((e,t)=>(e[t]=t+"Error",e)),{});const X=Y;var J=V.reduce(((e,t)=>{var n=t+"Error";function r(e,r){this._e=$(),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=W[t]||n,this.inner=null)}return h(r).from(X),e[t]=r,e}),{});J.Syntax=SyntaxError,J.Type=TypeError,J.Range=RangeError;var Z=U.reduce(((e,t)=>(e[t+"Error"]=J[t],e)),{}),ee=V.reduce(((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=J[t]),e)),{});function te(){}function ne(e){return e}function re(e,t){return null==e||e===ne?t:function(n){return t(e(n))}}function se(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ie(e,t){return e===te?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?se(r,this.onsuccess):r),s&&(this.onerror=this.onerror?se(s,this.onerror):s),void 0!==i?i:n}}function oe(e,t){return e===te?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?se(n,this.onsuccess):n),r&&(this.onerror=this.onerror?se(r,this.onerror):r)}}function ae(e,t){return e===te?t:function(n){var r=e.apply(this,arguments);s(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?se(i,this.onsuccess):i),o&&(this.onerror=this.onerror?se(o,this.onerror):o),void 0===r?void 0===a?void 0:a:s(r,a)}}function le(e,t){return e===te?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function ue(e,t){return e===te?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,s=arguments.length,i=new Array(s);s--;)i[s]=arguments[s];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}ee.ModifyError=H,ee.DexieError=Y,ee.BulkError=G;var ce={};const he=100,[de,fe,pe]="undefined"==typeof Promise?[]:(()=>{let e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,i(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,i(t),e]})(),ye=fe&&fe.then,me=de&&de.constructor,be=!!pe;var ge=!1,ve=pe?()=>{pe.then(Le)}:t.setImmediate?setImmediate.bind(null,Le):t.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver((()=>{Le(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Le,0)},we=function(e,t){Ae.push([e,t]),xe&&(ve(),xe=!1)},_e=!0,xe=!0,ke=[],Ee=[],Pe=null,Se=ne,Ke={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ft,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((e=>{try{ft(e[0],e[1])}catch(e){}}))}},Oe=Ke,Ae=[],Ce=0,je=[];function Be(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=te,this._lib=!1;var t=this._PSD=Oe;if(M&&(this._stackHolder=$(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ce)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Re(this,this._value))}this._state=null,this._value=null,++t.ref,Te(this,e)}const De={get:function(){var e=Oe,t=Je;function n(n,r){var s=!e.global&&(e!==Oe||t!==Je);const i=s&&!nt();var o=new Be(((t,o)=>{Fe(this,new Ie(ct(n,e,s,i),ct(r,e,s,i),t,o,e))}));return M&&$e(o,this),o}return n.prototype=ce,n},set:function(e){c(this,"then",e&&e.prototype===ce?De:{get:function(){return e},set:De.set})}};function Ie(e,t,n,r,s){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=s}function Te(e,t){try{t((t=>{if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ue();t&&"function"==typeof t.then?Te(e,((e,n)=>{t instanceof Be?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Me(e)),n&&Ve()}}),Re.bind(null,e))}catch(t){Re(e,t)}}function Re(e,t){if(Ee.push(t),null===e._state){var n=e._lib&&Ue();t=Se(t),e._state=!1,e._value=t,M&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,void 0)}catch(e){}}((()=>{var n=f(t,"stack");t._promise=e,c(t,"stack",{get:()=>ge?n&&(n.get?n.get.apply(t):n.value):e.stack})})),function(e){ke.some((t=>t._value===e._value))||ke.push(e)}(e),Me(e),n&&Ve()}}function Me(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Fe(e,t[n]);var s=e._PSD;--s.ref||s.finalize(),0===Ce&&(++Ce,we((()=>{0==--Ce&&We()}),[]))}function Fe(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,we(Ne,[n,e,t])}else e._listeners.push(t)}function Ne(e,t,n){try{Pe=t;var r,s=t._value;t._state?r=e(s):(Ee.length&&(Ee=[]),r=e(s),-1===Ee.indexOf(s)&&function(e){for(var t=ke.length;t;)if(ke[--t]._value===e._value)return void ke.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Pe=null,0==--Ce&&We(),--n.psd.ref||n.psd.finalize()}}function qe(e,t,n){if(t.length===n)return t;var r="";if(!1===e._state){var s,i,o=e._value;null!=o?(s=o.name||"Error",i=o.message||o,r=L(o,0)):(s=o,i=""),t.push(s+(i?": "+i:"")+r)}return M&&((r=L(e._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),e._prev&&qe(e._prev,t,n)),t}function $e(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Le(){Ue()&&Ve()}function Ue(){var e=_e;return _e=!1,xe=!1,e}function Ve(){var e,t,n;do{for(;Ae.length>0;)for(e=Ae,Ae=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Ae.length>0);_e=!0,xe=!0}function We(){var e=ke;ke=[],e.forEach((e=>{e._PSD.onunhandled.call(null,e._value,e)}));for(var t=je.slice(0),n=t.length;n;)t[--n]()}function Ye(e){return new Be(ce,!1,e)}function ze(e,t){var n=Oe;return function(){var r=Ue(),s=Oe;try{return ot(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{ot(s,!1),r&&Ve()}}}l(Be.prototype,{then:De,_then:function(e,t){Fe(this,new Ie(null,null,e,t,Oe))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,(e=>e instanceof t?n(e):Ye(e))):this.then(null,(e=>e&&e.name===t?n(e):Ye(e)))},finally:function(e){return this.then((t=>(e(),t)),(t=>(e(),Ye(t))))},stack:{get:function(){if(this._stack)return this._stack;try{ge=!0;var e=qe(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{ge=!1}}},timeout:function(e,t){return e<1/0?new Be(((n,r)=>{var s=setTimeout((()=>r(new J.Timeout(t))),e);this.then(n,r).finally(clearTimeout.bind(null,s))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&c(Be.prototype,Symbol.toStringTag,"Dexie.Promise"),Ke.env=at(),l(Be,{all:function(){var e=T.apply(null,arguments).map(rt);return new Be((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(((s,i)=>Be.resolve(s).then((n=>{e[i]=n,--r||t(e)}),n)))}))},resolve:e=>{if(e instanceof Be)return e;if(e&&"function"==typeof e.then)return new Be(((t,n)=>{e.then(t,n)}));var t=new Be(ce,!0,e);return $e(t,Pe),t},reject:Ye,race:function(){var e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{e.map((e=>Be.resolve(e).then(t,n)))}))},PSD:{get:()=>Oe,set:e=>Oe=e},totalEchoes:{get:()=>Je},newPSD:et,usePSD:lt,scheduler:{get:()=>we,set:e=>{we=e}},rejectionMapper:{get:()=>Se,set:e=>{Se=e}},follow:(e,t)=>new Be(((n,r)=>et(((t,n)=>{var r=Oe;r.unhandleds=[],r.onunhandled=n,r.finalize=se((function(){!function(e){je.push((function t(){e(),je.splice(je.indexOf(t),1)})),++Ce,we((()=>{0==--Ce&&We()}),[])}((()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])}))}),r.finalize),e()}),t,n,r)))}),me&&(me.allSettled&&c(Be,"allSettled",(function(){const e=T.apply(null,arguments).map(rt);return new Be((t=>{0===e.length&&t([]);let n=e.length;const r=new Array(n);e.forEach(((e,s)=>Be.resolve(e).then((e=>r[s]={status:"fulfilled",value:e}),(e=>r[s]={status:"rejected",reason:e})).then((()=>--n||t(r)))))}))})),me.any&&"undefined"!=typeof AggregateError&&c(Be,"any",(function(){const e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{0===e.length&&n(new AggregateError([]));let r=e.length;const s=new Array(r);e.forEach(((e,i)=>Be.resolve(e).then((e=>t(e)),(e=>{s[i]=e,--r||n(new AggregateError(s))}))))}))})));const He={awaits:0,echoes:0,id:0};var Ge=0,Qe=[],Xe=0,Je=0,Ze=0;function et(e,t,n,r){var i=Oe,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ze;var a=Ke.env;o.env=be?{Promise:Be,PromiseProp:{value:Be,configurable:!0,writable:!0},all:Be.all,race:Be.race,allSettled:Be.allSettled,any:Be.any,resolve:Be.resolve,reject:Be.reject,nthen:ht(a.nthen,o),gthen:ht(a.gthen,o)}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var l=lt(o,e,n,r);return 0===o.ref&&o.finalize(),l}function tt(){return He.id||(He.id=++Ge),++He.awaits,He.echoes+=he,He.id}function nt(){return!!He.awaits&&(0==--He.awaits&&(He.id=0),He.echoes=He.awaits*he,!0)}function rt(e){return He.echoes&&e&&e.constructor===me?(tt(),e.then((e=>(nt(),e)),(e=>(nt(),pt(e))))):e}function st(e){++Je,He.echoes&&0!=--He.echoes||(He.echoes=He.id=0),Qe.push(Oe),ot(e,!0)}function it(){var e=Qe[Qe.length-1];Qe.pop(),ot(e,!1)}function ot(e,n){var r=Oe;if((n?!He.echoes||Xe++&&e===Oe:!Xe||--Xe&&e===Oe)||ut(n?st.bind(null,e):it),e!==Oe&&(Oe=e,r===Ke&&(Ke.env=at()),be)){var s=Ke.env.Promise,i=e.env;fe.then=i.nthen,s.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(t,"Promise",i.PromiseProp),s.all=i.all,s.race=i.race,s.resolve=i.resolve,s.reject=i.reject,i.allSettled&&(s.allSettled=i.allSettled),i.any&&(s.any=i.any))}}function at(){var e=t.Promise;return be?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(t,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:fe.then,gthen:e.prototype.then}:{}}function lt(e,t,n,r,s){var i=Oe;try{return ot(e,!0),t(n,r,s)}finally{ot(i,!1)}}function ut(e){ye.call(de,e)}function ct(e,t,n,r){return"function"!=typeof e?e:function(){var s=Oe;n&&tt(),ot(t,!0);try{return e.apply(this,arguments)}finally{ot(s,!1),r&&ut(nt)}}}function ht(e,t){return function(n,r){return e.call(this,ct(n,t),ct(r,t))}}-1===(""+ye).indexOf("[native code]")&&(tt=nt=te);const dt="unhandledrejection";function ft(e,n){var r;try{r=n.onuncatched(e)}catch(e){}if(!1!==r)try{var i,o={promise:n,reason:e};if(t.document&&document.createEvent?((i=document.createEvent("Event")).initEvent(dt,!0,!0),s(i,o)):t.CustomEvent&&s(i=new CustomEvent(dt,{detail:o}),o),i&&t.dispatchEvent&&(dispatchEvent(i),!t.PromiseRejectionEvent&&t.onunhandledrejection))try{t.onunhandledrejection(i)}catch(e){}M&&i&&!i.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var pt=Be.reject;function yt(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Oe.letThrough||e._vip)){var s=e._createTransaction(t,n,e._dbSchema);try{s.create(),e._state.PR1398_maxLoop=3}catch(s){return s.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>yt(e,t,n,r)))):pt(s)}return s._promise(t,((e,t)=>et((()=>(Oe.trans=s,r(e,t,s)))))).then((e=>s._completion.then((()=>e))))}if(e._state.openComplete)return pt(new J.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return pt(new J.DatabaseClosed);e.open().catch(te)}return e._state.dbReadyPromise.then((()=>yt(e,t,n,r)))}const mt="3.2.5",bt=String.fromCharCode(65535),gt=-1/0,vt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",wt="String expected.",_t=[],xt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),kt=xt,Et=xt,Pt=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),St="__dbnames",Kt="readonly",Ot="readwrite";function At(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const Ct={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function jt(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=O(t))[e],t)}class Bt{_trans(e,t,n){const r=this._tx||Oe.trans,s=this.name;function i(e,n,r){if(!r.schema[s])throw new J.NotFound("Table "+s+" not part of transaction");return t(r.idbtrans,r)}const o=Ue();try{return r&&r.db===this.db?r===Oe.trans?r._promise(e,i,n):et((()=>r._promise(e,i,n)),{trans:r,transless:Oe.transless||Oe}):yt(this.db,e,[this.name],i)}finally{o&&Ve()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",(t=>this.core.get({trans:t,key:e}).then((e=>this.hook.reading.fire(e))))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(r(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const t=n(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);const s=this.schema.indexes.concat(this.schema.primKey).filter((e=>{if(e.compound&&t.every((t=>e.keyPath.indexOf(t)>=0))){for(let n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort(((e,t)=>e.keyPath.length-t.keyPath.length))[0];if(s&&this.db._maxKey!==bt){const n=s.keyPath.slice(0,t.length);return this.where(n).equals(n.map((t=>e[t])))}!s&&M&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);const{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function a(e,t){try{return 0===o.cmp(e,t)}catch(e){return!1}}const[l,u]=t.reduce((([t,n],s)=>{const o=i[s],l=e[s];return[t||o,t||!o?At(n,o&&o.multi?e=>{const t=w(e,s);return r(t)&&t.some((e=>a(l,e)))}:e=>a(l,w(e,s))):n]}),[null,null]);return l?this.where(l.name).equals(e[l.keyPath]).filter(u):s?this.filter(u):this.where(t).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,r(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const t=t=>{if(!t)return t;const n=Object.create(e.prototype);for(var r in t)if(a(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass((function(e){s(this,e)}))}add(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[s]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}update(e,t){if("object"!=typeof e||r(e))return this.where(":id").equals(e).modify(t);{const r=w(e,this.schema.primKey.keyPath);if(void 0===r)return pt(new J.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?n(t).forEach((n=>{_(e,n,t[n])})):t(e,{value:e,primKey:r})}catch(e){}return this.where(":id").equals(r).modify(t)}}put(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"put",values:[s],keys:null!=t?[t]:null}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}delete(e){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:[e]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}clear(){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"deleteRange",range:Ct}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}bulkGet(e){return this._trans("readonly",(t=>this.core.getMany({keys:e,trans:t}).then((e=>e.map((e=>this.hook.reading.fire(e)))))))}bulkAdd(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkAdd(): ${e} of ${o} operations failed`,r)}))}))}bulkPut(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkPut(): ${e} of ${o} operations failed`,r)}))}))}bulkDelete(e){const t=e.length;return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:e}))).then((({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new G(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)}))}}function Dt(e){var t={},s=function(n,r){if(r){for(var s=arguments.length,i=new Array(s-1);--s;)i[s-1]=arguments[s];return t[n].subscribe.apply(null,i),e}if("string"==typeof n)return t[n]};s.addEventType=a;for(var i=1,o=arguments.length;i<o;++i)a(arguments[i]);return s;function a(e,i,o){if("object"!=typeof e){var l;i||(i=le),o||(o=te);var u={subscribers:[],fire:o,subscribe:function(e){-1===u.subscribers.indexOf(e)&&(u.subscribers.push(e),u.fire=i(u.fire,e))},unsubscribe:function(e){u.subscribers=u.subscribers.filter((function(t){return t!==e})),u.fire=u.subscribers.reduce(i,o)}};return t[e]=s[e]=u,u}n(l=e).forEach((function(e){var t=l[e];if(r(t))a(e,l[e][0],l[e][1]);else{if("asap"!==t)throw new J.InvalidArgument("Invalid event config");var n=a(e,ne,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){g((function(){e.apply(null,t)}))}))}))}}))}}function It(e,t){return h(t).from({prototype:e}),t}function Tt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Rt(e,t){e.filter=At(e.filter,t)}function Mt(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>At(r(),t()):t,e.justLimit=n&&!r}function Ft(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new J.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Nt(e,t,n){const r=Ft(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function qt(e,t,n,r){const s=e.replayFilter?At(e.filter,e.replayFilter()):e.filter;if(e.or){const i={},o=(e,n,r)=>{if(!s||s(n,r,(e=>n.stop(e)),(e=>n.fail(e)))){var o=n.primaryKey,l=""+o;"[object ArrayBuffer]"===l&&(l=""+new Uint8Array(o)),a(i,l)||(i[l]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(o,n),$t(Nt(e,r,n),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return $t(Nt(e,r,n),At(e.algorithm,s),t,!e.keysOnly&&e.valueMapper)}function $t(e,t,n,r){var s=ze(r?(e,t,s)=>n(r(e),t,s):n);return e.then((e=>{if(e)return e.start((()=>{var n=()=>e.continue();t&&!t(e,(e=>n=e),(t=>{e.stop(t),n=te}),(t=>{e.fail(t),n=te}))||s(e.value,e,(e=>n=e)),n()}))}))}function Lt(e,t){try{const n=Ut(e),r=Ut(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(Vt(e),Vt(t));case"Array":return function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n){const r=Lt(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function Ut(e){const t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";const n=j(e);return"ArrayBuffer"===n?"binary":n}function Vt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class Wt{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,pt.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,pt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=At(t.algorithm,e)}_iterate(e,t){return qt(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read((n=>qt(t,e,n,t.table.core)))}count(e){return this._read((e=>{const t=this._ctx,n=t.table.core;if(Tt(t,!0))return n.count({trans:e,query:{index:Ft(t,n.schema),range:t.range}}).then((e=>Math.min(e,t.limit)));var r=0;return qt(t,(()=>(++r,!1)),e,n).then((()=>r))})).then(e)}sortBy(e,t){const n=e.split(".").reverse(),r=n[0],s=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var o="next"===this._ctx.dir?1:-1;function a(e,t){var n=i(e,s),r=i(t,s);return n<r?-o:n>r?o:0}return this.toArray((function(e){return e.sort(a)})).then(t)}toArray(e){return this._read((e=>{var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0){const{valueMapper:n}=t,r=Ft(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then((({result:e})=>n?e.map(n):e))}{const n=[];return qt(t,(e=>n.push(e)),e,t.table.core).then((()=>n))}}),e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,Tt(t)?Mt(t,(()=>{var t=e;return(e,n)=>0===t||(1===t?(--t,!1):(n((()=>{e.advance(t),t=0})),!1))})):Mt(t,(()=>{var t=e;return()=>--t<0}))),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Mt(this._ctx,(()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this}until(e,t){return Rt(this._ctx,(function(n,r,s){return!e(n.value)||(r(s),t)})),this}first(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)}last(e){return this.reverse().first(e)}filter(e){var t,n;return Rt(this._ctx,(function(t){return e(t.value)})),t=this._ctx,n=e,t.isMatch=At(t.isMatch,n),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))}keys(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0)return this._read((e=>{var n=Ft(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((({result:e})=>e)).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys((function(e){return e[0]})).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Rt(this._ctx,(function(e){var t=e.primaryKey.toString(),r=a(n,t);return n[t]=!0,!r})),this}modify(e){var t=this._ctx;return this._write((r=>{var s;if("function"==typeof e)s=e;else{var i=n(e),o=i.length;s=function(t){for(var n=!1,r=0;r<o;++r){var s=i[r],a=e[s];w(t,s)!==a&&(_(t,s,a),n=!0)}return n}}const a=t.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,h=[];let d=0;const f=[],p=(e,t)=>{const{failures:r,numFailures:s}=t;d+=e-s;for(let e of n(r))h.push(r[e])};return this.clone().primaryKeys().then((n=>{const i=o=>{const h=Math.min(c,n.length-o);return a.getMany({trans:r,keys:n.slice(o,o+h),cache:"immutable"}).then((d=>{const f=[],y=[],m=l?[]:null,b=[];for(let e=0;e<h;++e){const t=d[e],r={value:O(t),primKey:n[o+e]};!1!==s.call(r,r.value,r)&&(null==r.value?b.push(n[o+e]):l||0===Lt(u(t),u(r.value))?(y.push(r.value),l&&m.push(n[o+e])):(b.push(n[o+e]),f.push(r.value)))}const g=Tt(t)&&t.limit===1/0&&("function"!=typeof e||e===Yt)&&{index:t.index,range:t.range};return Promise.resolve(f.length>0&&a.mutate({trans:r,type:"add",values:f}).then((e=>{for(let t in e.failures)b.splice(parseInt(t),1);p(f.length,e)}))).then((()=>(y.length>0||g&&"object"==typeof e)&&a.mutate({trans:r,type:"put",keys:m,values:y,criteria:g,changeSpec:"function"!=typeof e&&e}).then((e=>p(y.length,e))))).then((()=>(b.length>0||g&&e===Yt)&&a.mutate({trans:r,type:"delete",keys:b,criteria:g}).then((e=>p(b.length,e))))).then((()=>n.length>o+h&&i(o+c)))}))};return i(0).then((()=>{if(h.length>0)throw new H("Error modifying one or more objects",h,d,f);return n.length}))}))}))}delete(){var e=this._ctx,t=e.range;return Tt(e)&&(e.isPrimKey&&!Et||3===t.type)?this._write((n=>{const{primaryKey:r}=e.table.core.schema,s=t;return e.table.core.count({trans:n,query:{index:r,range:s}}).then((t=>e.table.core.mutate({trans:n,type:"deleteRange",range:s}).then((({failures:e,lastResult:n,results:r,numFailures:s})=>{if(s)throw new H("Could not delete some values",Object.keys(e).map((t=>e[t])),t-s);return t-s}))))})):this.modify(Yt)}}const Yt=(e,t)=>t.value=null;function zt(e,t){return e<t?-1:e===t?0:1}function Ht(e,t){return e>t?-1:e===t?0:1}function Gt(e,t,n){var r=e instanceof tn?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Qt(e){return new e.Collection(e,(()=>en(""))).limit(0)}function Xt(e,t,n,r,s,i){for(var o=Math.min(e.length,r.length),a=-1,l=0;l<o;++l){var u=t[l];if(u!==r[l])return s(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):s(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;s(e[l],u)<0&&(a=l)}return o<r.length&&"next"===i?e+n.substr(e.length):o<e.length&&"prev"===i?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function Jt(e,t,n,r){var s,i,o,a,l,u,c,h=n.length;if(!n.every((e=>"string"==typeof e)))return Gt(e,wt);function d(e){s=function(e){return"next"===e?e=>e.toUpperCase():e=>e.toLowerCase()}(e),i=function(e){return"next"===e?e=>e.toLowerCase():e=>e.toUpperCase()}(e),o="next"===e?zt:Ht;var t=n.map((function(e){return{lower:i(e),upper:s(e)}})).sort((function(e,t){return o(e.lower,t.lower)}));a=t.map((function(e){return e.upper})),l=t.map((function(e){return e.lower})),u=e,c="next"===e?"":r}d("next");var f=new e.Collection(e,(()=>Zt(a[0],l[h-1]+r)));f._ondirectionchange=function(e){d(e)};var p=0;return f._addAlgorithm((function(e,n,r){var s=e.key;if("string"!=typeof s)return!1;var d=i(s);if(t(d,l,p))return!0;for(var f=null,y=p;y<h;++y){var m=Xt(s,d,a[y],l[y],o,u);null===m&&null===f?p=y+1:(null===f||o(f,m)>0)&&(f=m)}return n(null!==f?function(){e.continue(f+c)}:r),!1})),f}function Zt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function en(e){return{type:1,lower:e,upper:e}}class tn{get Collection(){return this._ctx.table.db.Collection}between(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?Qt(this):new this.Collection(this,(()=>Zt(e,t,!n,!r)))}catch(e){return Gt(this,vt)}}equals(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>en(e)))}above(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(e,void 0,!0)))}aboveOrEqual(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(e,void 0,!1)))}below(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(void 0,e,!1,!0)))}belowOrEqual(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(void 0,e)))}startsWith(e){return"string"!=typeof e?Gt(this,wt):this.between(e,e+bt,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):Jt(this,((e,t)=>0===e.indexOf(t[0])),[e],bt)}equalsIgnoreCase(e){return Jt(this,((e,t)=>e===t[0]),[e],"")}anyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>-1!==t.indexOf(e)),e,"")}startsWithAnyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>t.some((t=>0===e.indexOf(t)))),e,bt)}anyOf(){const e=T.apply(I,arguments);let t=this._cmp;try{e.sort(t)}catch(e){return Gt(this,vt)}if(0===e.length)return Qt(this);const n=new this.Collection(this,(()=>Zt(e[0],e[e.length-1])));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm(((n,s,i)=>{const o=n.key;for(;t(o,e[r])>0;)if(++r,r===e.length)return s(i),!1;return 0===t(o,e[r])||(s((()=>{n.continue(e[r])})),!1)})),n}notEqual(e){return this.inAnyRange([[gt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=T.apply(I,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Gt(this,vt)}const t=e.reduce(((e,t)=>e?e.concat([[e[e.length-1][1],t]]):[[gt,t]]),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,t){const n=this._cmp,r=this._ascending,s=this._descending,i=this._min,o=this._max;if(0===e.length)return Qt(this);if(!e.every((e=>void 0!==e[0]&&void 0!==e[1]&&r(e[0],e[1])<=0)))return Gt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",J.InvalidArgument);const a=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers;let u,c=r;function h(e,t){return c(e[0],t[0])}try{u=e.reduce((function(e,t){let r=0,s=e.length;for(;r<s;++r){const s=e[r];if(n(t[0],s[1])<0&&n(t[1],s[0])>0){s[0]=i(s[0],t[0]),s[1]=o(s[1],t[1]);break}}return r===s&&e.push(t),e}),[]),u.sort(h)}catch(e){return Gt(this,vt)}let d=0;const f=l?e=>r(e,u[d][1])>0:e=>r(e,u[d][1])>=0,p=a?e=>s(e,u[d][0])>0:e=>s(e,u[d][0])>=0;let y=f;const m=new this.Collection(this,(()=>Zt(u[0][0],u[u.length-1][1],!a,!l)));return m._ondirectionchange=e=>{"next"===e?(y=f,c=r):(y=p,c=s),u.sort(h)},m._addAlgorithm(((e,t,n)=>{for(var s=e.key;y(s);)if(++d,d===u.length)return t(n),!1;return!!function(e){return!f(e)&&!p(e)}(s)||(0===this._cmp(s,u[d][1])||0===this._cmp(s,u[d][0])||t((()=>{c===r?e.continue(u[d][0]):e.continue(u[d][1])})),!1)})),m}startsWithAnyOf(){const e=T.apply(I,arguments);return e.every((e=>"string"==typeof e))?0===e.length?Qt(this):this.inAnyRange(e.map((e=>[e,e+bt]))):Gt(this,"startsWithAnyOf() only works with strings")}}function nn(e){return ze((function(t){return rn(t),e(t.target.error),!1}))}function rn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const sn="storagemutated",on="x-storagemutated-1",an=Dt(null,sn);class ln{_lock(){return b(!Oe.global),++this._reculock,1!==this._reculock||Oe.global||(Oe.lockOwnerFor=this),this}_unlock(){if(b(!Oe.global),0==--this._reculock)for(Oe.global||(Oe.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{lt(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&Oe.lockOwnerFor!==this}create(e){if(!this.mode)return this;const t=this.db.idbdb,n=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new J.DatabaseClosed(n);case"MissingAPIError":throw new J.MissingAPI(n.message,n);default:throw new J.OpenFailed(n)}if(!this.active)throw new J.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=ze((t=>{rn(t),this._reject(e.error)})),e.onabort=ze((t=>{rn(t),this.active&&this._reject(new J.Abort(e.error)),this.active=!1,this.on("abort").fire(t)})),e.oncomplete=ze((()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&an.storagemutated.fire(e.mutatedParts)})),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return pt(new J.ReadOnly("Transaction is readonly"));if(!this.active)return pt(new J.TransactionInactive);if(this._locked())return new Be(((r,s)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,s)},Oe])}));if(n)return et((()=>{var e=new Be(((e,n)=>{this._lock();const r=t(e,n,this);r&&r.then&&r.then(e,n)}));return e.finally((()=>this._unlock())),e._lib=!0,e}));var r=new Be(((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();const n=Be.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((()=>n));else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var s=t._waitingFor;return new Be(((e,r)=>{n.then((n=>t._waitingQueue.push(ze(e.bind(null,n)))),(e=>t._waitingQueue.push(ze(r.bind(null,e))))).finally((()=>{t._waitingFor===s&&(t._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new J.Abort))}table(e){const t=this._memoizedTables||(this._memoizedTables={});if(a(t,e))return t[e];const n=this.schema[e];if(!n)throw new J.NotFound("Table "+e+" not part of transaction");const r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}}function un(e,t,n,r,s,i,o){return{name:e,keyPath:t,unique:n,multi:r,auto:s,compound:i,src:(n&&!o?"&":"")+(r?"*":"")+(s?"++":"")+cn(t)}}function cn(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function hn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:v(n,(e=>[e.name,e]))}}let dn=e=>{try{return e.only([[]]),dn=()=>[[]],[[]]}catch(e){return dn=()=>bt,bt}};function fn(e){return null==e?()=>{}:"string"==typeof e?function(e){return 1===e.split(".").length?t=>t[e]:t=>w(t,e)}(e):t=>w(t,e)}function pn(e){return[].slice.call(e)}let yn=0;function mn(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function bn(e,t,n){function s(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:n,upper:r,lowerOpen:s,upperOpen:i}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!i):void 0===r?t.lowerBound(n,!!s):t.bound(n,r,!!s,!!i)}const{schema:i,hasGetAll:o}=function(e,t){const n=pn(e.objectStoreNames);return{schema:{name:e.name,tables:n.map((e=>t.objectStore(e))).map((e=>{const{keyPath:t,autoIncrement:n}=e,s=r(t),i=null==t,o={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:s,keyPath:t,autoIncrement:n,unique:!0,extractKey:fn(t)},indexes:pn(e.indexNames).map((t=>e.index(t))).map((e=>{const{name:t,unique:n,multiEntry:s,keyPath:i}=e,a={name:t,compound:r(i),keyPath:i,unique:n,multiEntry:s,extractKey:fn(i)};return o[mn(i)]=a,a})),getIndexByKeyPath:e=>o[mn(e)]};return o[":id"]=a.primaryKey,null!=t&&(o[mn(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,n),a=i.tables.map((e=>function(e){const t=e.name;return{name:t,schema:e,mutate:function({trans:e,type:n,keys:r,values:i,range:o}){return new Promise(((a,l)=>{a=ze(a);const u=e.objectStore(t),c=null==u.keyPath,h="put"===n||"add"===n;if(!h&&"delete"!==n&&"deleteRange"!==n)throw new Error("Invalid operation type: "+n);const{length:d}=r||i||{length:1};if(r&&i&&r.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return a({numFailures:0,failures:{},results:[],lastResult:void 0});let f;const p=[],y=[];let m=0;const b=e=>{++m,rn(e)};if("deleteRange"===n){if(4===o.type)return a({numFailures:m,failures:y,results:[],lastResult:void 0});3===o.type?p.push(f=u.clear()):p.push(f=u.delete(s(o)))}else{const[e,t]=h?c?[i,r]:[i,null]:[r,null];if(h)for(let r=0;r<d;++r)p.push(f=t&&void 0!==t[r]?u[n](e[r],t[r]):u[n](e[r])),f.onerror=b;else for(let t=0;t<d;++t)p.push(f=u[n](e[t])),f.onerror=b}const g=e=>{const t=e.target.result;p.forEach(((e,t)=>null!=e.error&&(y[t]=e.error))),a({numFailures:m,failures:y,results:"delete"===n?r:p.map((e=>e.result)),lastResult:t})};f.onerror=e=>{b(e),g(e)},f.onsuccess=g}))},getMany:({trans:e,keys:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t),o=n.length,a=new Array(o);let l,u=0,c=0;const h=e=>{const t=e.target;a[t._pos]=t.result,++c===u&&r(a)},d=nn(s);for(let e=0;e<o;++e)null!=n[e]&&(l=i.get(n[e]),l._pos=e,l.onsuccess=h,l.onerror=d,++u);0===u&&r(a)})),get:({trans:e,key:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=nn(s)})),query:function(e){return n=>new Promise(((r,i)=>{r=ze(r);const{trans:o,values:a,limit:l,query:u}=n,c=l===1/0?void 0:l,{index:h,range:d}=u,f=o.objectStore(t),p=h.isPrimaryKey?f:f.index(h.name),y=s(d);if(0===l)return r({result:[]});if(e){const e=a?p.getAll(y,c):p.getAllKeys(y,c);e.onsuccess=e=>r({result:e.target.result}),e.onerror=nn(i)}else{let e=0;const t=a||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),n=[];t.onsuccess=s=>{const i=t.result;return i?(n.push(a?i.value:i.primaryKey),++e===l?r({result:n}):void i.continue()):r({result:n})},t.onerror=nn(i)}}))}(o),openCursor:function({trans:e,values:n,query:r,reverse:i,unique:o}){return new Promise(((a,l)=>{a=ze(a);const{index:u,range:c}=r,h=e.objectStore(t),d=u.isPrimaryKey?h:h.index(u.name),f=i?o?"prevunique":"prev":o?"nextunique":"next",p=n||!("openKeyCursor"in d)?d.openCursor(s(c),f):d.openKeyCursor(s(c),f);p.onerror=nn(l),p.onsuccess=ze((t=>{const n=p.result;if(!n)return void a(null);n.___id=++yn,n.done=!1;const r=n.continue.bind(n);let s=n.continuePrimaryKey;s&&(s=s.bind(n));const i=n.advance.bind(n),o=()=>{throw new Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw new Error("Cursor not started")},n.fail=ze(l),n.next=function(){let e=1;return this.start((()=>e--?this.continue():this.stop())).then((()=>this))},n.start=e=>{const t=new Promise(((e,t)=>{e=ze(e),p.onerror=nn(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=o,e(t)}})),a=()=>{if(p.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw new Error("Cursor behind last entry")},n.stop()};return p.onsuccess=ze((e=>{p.onsuccess=a,a()})),n.continue=r,n.continuePrimaryKey=s,n.advance=i,a(),t},a(n)}),l)}))},count({query:e,trans:n}){const{index:r,range:i}=e;return new Promise(((e,o)=>{const a=n.objectStore(t),l=r.isPrimaryKey?a:a.index(r.name),u=s(i),c=u?l.count(u):l.count();c.onsuccess=ze((t=>e(t.target.result))),c.onerror=nn(o)}))}}}(e))),l={};return a.forEach((e=>l[e.name]=e)),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!l[e])throw new Error(`Table '${e}' not found`);return l[e]},MIN_KEY:-1/0,MAX_KEY:dn(t),schema:i}}function gn({_novip:e},t){const n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},s){const i=function(e,t){return t.reduce(((e,{create:t})=>({...e,...t(e)})),e)}(bn(t,n,s),e.dbcore);return{dbcore:i}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach((t=>{const n=t.name;e.core.schema.tables.some((e=>e.name===n))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function vn({_novip:e},t,n,r){n.forEach((n=>{const s=r[n];t.forEach((t=>{const r=f(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?c(t,n,{get(){return this.table(n)},set(e){u(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,s))}))}))}function wn({_novip:e},t){t.forEach((t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]}))}function _n(e,t){return e._cfg.version-t._cfg.version}function xn(e,t,r,s){const i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(r),o._completion.catch(s);const a=o._reject.bind(o),l=Oe.transless||Oe;et((()=>{Oe.trans=o,Oe.transless=l,0===t?(n(i).forEach((e=>{En(r,e,i[e].primKey,i[e].indexes)})),gn(e,r),Be.follow((()=>e.on.populate.fire(o))).catch(a)):function({_novip:e},t,r,s){const i=[],o=e._versions;let a=e._dbSchema=Sn(e,e.idbdb,s),l=!1;const u=o.filter((e=>e._cfg.version>=t));return u.forEach((o=>{i.push((()=>{const i=a,u=o._cfg.dbschema;Kn(e,i,s),Kn(e,u,s),a=e._dbSchema=u;const c=kn(i,u);c.add.forEach((e=>{En(s,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((e=>{if(e.recreate)throw new J.Upgrade("Not yet support for changing primary key");{const t=s.objectStore(e.name);e.add.forEach((e=>Pn(t,e))),e.change.forEach((e=>{t.deleteIndex(e.name),Pn(t,e)})),e.del.forEach((e=>t.deleteIndex(e)))}}));const h=o._cfg.contentUpgrade;if(h&&o._cfg.version>t){gn(e,s),r._memoizedTables={},l=!0;let t=x(u);c.del.forEach((e=>{t[e]=i[e]})),wn(e,[e.Transaction.prototype]),vn(e,[e.Transaction.prototype],n(t),t),r.schema=t;const o=R(h);let a;o&&tt();const d=Be.follow((()=>{if(a=h(r),a&&o){var e=nt.bind(null,null);a.then(e,e)}}));return a&&"function"==typeof a.then?Be.resolve(a):d.then((()=>a))}})),i.push((t=>{l&&kt||function(e,t){[].slice.call(t.db.objectStoreNames).forEach((n=>null==e[n]&&t.db.deleteObjectStore(n)))}(o._cfg.dbschema,t),wn(e,[e.Transaction.prototype]),vn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),r.schema=e._dbSchema}))})),function e(){return i.length?Be.resolve(i.shift()(r.idbtrans)).then(e):Be.resolve()}().then((()=>{var e,t;t=s,n(e=a).forEach((n=>{t.db.objectStoreNames.contains(n)||En(t,n,e[n].primKey,e[n].indexes)}))}))}(e,t,o,r).catch(a)}))}function kn(e,t){const n={del:[],add:[],change:[]};let r;for(r in e)t[r]||n.del.push(r);for(r in t){const s=e[r],i=t[r];if(s){const e={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!xt)e.recreate=!0,n.change.push(e);else{const t=s.idxByName,r=i.idxByName;let o;for(o in t)r[o]||e.del.push(o);for(o in r){const n=t[o],s=r[o];n?n.src!==s.src&&e.change.push(s):e.add.push(s)}(e.del.length>0||e.add.length>0||e.change.length>0)&&n.change.push(e)}}else n.add.push([r,i])}return n}function En(e,t,n,r){const s=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((e=>Pn(s,e))),s}function Pn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Sn(e,t,n){const r={};return y(t.objectStoreNames,0).forEach((e=>{const t=n.objectStore(e);let s=t.keyPath;const i=un(cn(s),s||"",!1,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[];for(let e=0;e<t.indexNames.length;++e){const n=t.index(t.indexNames[e]);s=n.keyPath;var a=un(n.name,s,!!n.unique,!!n.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(a)}r[e]=hn(e,i,o)})),r}function Kn({_novip:e},n,r){const s=r.db.objectStoreNames;for(let t=0;t<s.length;++t){const i=s[t],o=r.objectStore(i);e._hasGetAll="getAll"in o;for(let e=0;e<o.indexNames.length;++e){const t=o.indexNames[e],r=o.index(t).keyPath,s="string"==typeof r?r:"["+y(r).join("+")+"]";if(n[i]){const e=n[i].idxByName[s];e&&(e.name=t,delete n[i].idxByName[s],n[i].idxByName[t]=e)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&t.WorkerGlobalScope&&t instanceof t.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class On{_parseStoresSpec(e,t){n(e).forEach((n=>{if(null!==e[n]){var s=e[n].split(",").map(((e,t)=>{const n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),s=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return un(n,s||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),r(s),0===t)})),i=s.shift();if(i.multi)throw new J.Schema("Primary key cannot be multi-valued");s.forEach((e=>{if(e.auto)throw new J.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new J.Schema("Index must have a name and cannot be an empty string")})),t[n]=hn(n,i,s)}}))}stores(e){const t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;const r=t._versions,i={};let o={};return r.forEach((e=>{s(i,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(i,o)})),t._dbSchema=o,wn(t,[t._allTables,t,t.Transaction.prototype]),vn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],n(o),o),t._storeNames=n(o),this}upgrade(e){return this._cfg.contentUpgrade=ue(this._cfg.contentUpgrade||te,e),this}}function An(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Qn(St,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Cn(e){return e&&"function"==typeof e.databases}function jn(e){return et((function(){return Oe.letThrough=!0,e()}))}function Bn(){var e;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(t){var n=function(){return indexedDB.databases().finally(t)};e=setInterval(n,100),n()})).finally((function(){return clearInterval(e)})):Promise.resolve()}function Dn(e){var t=t=>e.next(t),n=i(t),s=i((t=>e.throw(t)));function i(e){return t=>{var i=e(t),o=i.value;return i.done?o:o&&"function"==typeof o.then?o.then(n,s):r(o)?Promise.all(o).then(n,s):n(o)}}return i(t)()}function In(e,t,n){var r=arguments.length;if(r<2)throw new J.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];return n=s.pop(),[e,E(s),n]}function Tn(e,t,n,r,s){return Be.resolve().then((()=>{const i=Oe.transless||Oe,o=e._createTransaction(t,n,e._dbSchema,r),a={trans:o,transless:i};if(r)o.idbtrans=r.idbtrans;else try{o.create(),e._state.PR1398_maxLoop=3}catch(r){return r.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Tn(e,t,n,null,s)))):pt(r)}const l=R(s);let u;l&&tt();const c=Be.follow((()=>{if(u=s.call(o,o),u)if(l){var e=nt.bind(null,null);u.then(e,e)}else"function"==typeof u.next&&"function"==typeof u.throw&&(u=Dn(u))}),a);return(u&&"function"==typeof u.then?Be.resolve(u).then((e=>o.active?e:pt(new J.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):c.then((()=>u))).then((e=>(r&&o._resolve(),o._completion.then((()=>e))))).catch((e=>(o._reject(e),pt(e))))}))}function Rn(e,t,n){const s=r(e)?e.slice():[e];for(let e=0;e<n;++e)s.push(t);return s}const Mn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const n=e.table(t),{schema:r}=n,s={},i=[];function o(e,t,n){const r=mn(e),a=s[r]=s[r]||[],l=null==e?0:"string"==typeof e?1:e.length,u=t>0,c={...n,isVirtual:u,keyTail:t,keyLength:l,extractKey:fn(e),unique:!u&&n.unique};return a.push(c),c.isPrimaryKey||i.push(c),l>1&&o(2===l?e[0]:e.slice(0,l-1),t+1,n),a.sort(((e,t)=>e.keyTail-t.keyTail)),c}const a=o(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[a];for(const e of r.indexes)o(e.keyPath,0,e);function l(t){const n=t.query.index;return n.isVirtual?{...t,query:{index:n,range:(r=t.query.range,s=n.keyTail,{type:1===r.type?2:r.type,lower:Rn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,s),lowerOpen:!0,upper:Rn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,s),upperOpen:!0})}}:t;var r,s}const u={...n,schema:{...r,primaryKey:a,indexes:i,getIndexByKeyPath:function(e){const t=s[mn(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){const{keyTail:r,isVirtual:s,keyLength:i}=t.query.index;return s?n.openCursor(l(t)).then((n=>n&&function(n){const s=Object.create(n,{continue:{value:function(s){null!=s?n.continue(Rn(s,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,i).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,s){n.continuePrimaryKey(Rn(t,e.MAX_KEY,r),s)}},primaryKey:{get:()=>n.primaryKey},key:{get(){const e=n.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>n.value}});return s}(n))):n.openCursor(t)}};return u}}}};function Fn(e,t,r,s){return r=r||{},s=s||"",n(e).forEach((n=>{if(a(t,n)){var i=e[n],o=t[n];if("object"==typeof i&&"object"==typeof o&&i&&o){const e=j(i);e!==j(o)?r[s+n]=t[n]:"Object"===e?Fn(i,o,r,s+n+"."):i!==o&&(r[s+n]=t[n])}else i!==o&&(r[s+n]=t[n])}else r[s+n]=void 0})),n(t).forEach((n=>{a(e,n)||(r[s+n]=t[n])})),r}const Nn={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){const n=e.table(t),{primaryKey:r}=n.schema,s={...n,mutate(e){const s=Oe.trans,{deleting:i,creating:o,updating:l}=s.table(t).hook;switch(e.type){case"add":if(o.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"put":if(o.fire===te&&l.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"delete":if(i.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"deleteRange":if(i.fire===te)break;return s._promise("readwrite",(()=>function(e){return c(e.trans,e.range,1e4)}(e)),!0)}return n.mutate(e);function u(e){const t=Oe.trans,s=e.keys||function(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}(r,e);if(!s)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?{...e,keys:s}:{...e}).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),function(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}(n,e,s).then((u=>{const c=s.map(((n,s)=>{const c=u[s],h={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(h,n,c,t);else if("add"===e.type||void 0===c){const i=o.fire.call(h,n,e.values[s],t);null==n&&null!=i&&(n=i,e.keys[s]=n,r.outbound||_(e.values[s],r.keyPath,n))}else{const r=Fn(c,e.values[s]),i=l.fire.call(h,r,n,c,t);if(i){const t=e.values[s];Object.keys(i).forEach((e=>{a(t,e)?t[e]=i[e]:_(t,e,i[e])}))}}return h}));return n.mutate(e).then((({failures:t,results:n,numFailures:r,lastResult:i})=>{for(let r=0;r<s.length;++r){const i=n?n[r]:s[r],o=c[r];null==i?o.onerror&&o.onerror(t[r]):o.onsuccess&&o.onsuccess("put"===e.type&&u[r]?e.values[r]:i)}return{failures:t,results:n,numFailures:r,lastResult:i}})).catch((e=>(c.forEach((t=>t.onerror&&t.onerror(e))),Promise.reject(e))))}))}function c(e,t,s){return n.query({trans:e,values:!1,query:{index:r,range:t},limit:s}).then((({result:n})=>u({type:"delete",keys:n,trans:e}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<s?{failures:[],numFailures:0,lastResult:void 0}:c(e,{...t,lower:n[n.length-1],lowerOpen:!0},s)))))}}};return s}})};function qn(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;const r=[];for(let s=0,i=0;s<t.keys.length&&i<e.length;++s)0===Lt(t.keys[s],e[i])&&(r.push(n?O(t.values[s]):t.values[s]),++i);return r.length===e.length?r:null}catch(e){return null}}const $n={stack:"dbcore",level:-1,create:e=>({table:t=>{const n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);const t=qn(e.keys,e.trans._cache,"clone"===e.cache);return t?Be.resolve(t):n.getMany(e).then((t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?O(t):t},t)))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function Ln(e){return!("from"in e)}const Un=function(e,t){if(!this){const t=new Un;return e&&"d"in e&&s(t,e),t}s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function Vn(e,t,n){const r=Lt(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Ln(e))return s(e,{from:t,to:n,d:1});const i=e.l,o=e.r;if(Lt(n,e.from)<0)return i?Vn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},zn(e);if(Lt(t,e.to)>0)return o?Vn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},zn(e);Lt(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Lt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const a=!e.r;i&&!e.l&&Wn(e,i),o&&a&&Wn(e,o)}function Wn(e,t){Ln(t)||function e(t,{from:n,to:r,l:s,r:i}){Vn(t,n,r),s&&e(t,s),i&&e(t,i)}(e,t)}function Yn(e){let t=Ln(e)?null:{s:0,n:e};return{next(e){const n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&Lt(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||Lt(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function zn(e){var t,n;const r=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(n=e.l)||void 0===n?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){const t="r"===s?"l":"r",n={...e},r=e[s];e.from=r.from,e.to=r.to,e[s]=r[s],n[s]=r[t],e[t]=n,n.d=Hn(n)}e.d=Hn(e)}function Hn({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}l(Un.prototype,{add(e){return Wn(this,e),this},addKey(e){return Vn(this,e,e),this},addKeys(e){return e.forEach((e=>Vn(this,e,e))),this},[B](){return Yn(this)}});const Gn={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,s=new Un(e.MIN_KEY,e.MAX_KEY);return{...e,table:i=>{const o=e.table(i),{schema:a}=o,{primaryKey:l}=a,{extractKey:u,outbound:c}=l,h={...o,mutate:e=>{const n=e.trans,l=n.mutatedParts||(n.mutatedParts={}),u=e=>{const n=`idb://${t}/${i}/${e}`;return l[n]||(l[n]=new Un)},c=u(""),h=u(":dels"),{type:d}=e;let[f,p]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[];const y=e.trans._cache;return o.mutate(e).then((e=>{if(r(f)){"delete"!==d&&(f=e.results),c.addKeys(f);const t=qn(f,y);t||"add"===d||h.addKeys(f),(t||p)&&function(e,t,n,s){t.indexes.forEach((function(t){const i=e(t.name||"");function o(e){return null!=e?t.extractKey(e):null}const a=e=>t.multiEntry&&r(e)?e.forEach((e=>i.addKey(e))):i.addKey(e);(n||s).forEach(((e,t)=>{const r=n&&o(n[t]),i=s&&o(s[t]);0!==Lt(r,i)&&(null!=r&&a(r),null!=i&&a(i))}))}))}(u,a,t,p)}else if(f){const e={from:f.lower,to:f.upper};h.add(e),c.add(e)}else c.add(s),h.add(s),a.indexes.forEach((e=>u(e.name).add(s)));return e}))}},d=({query:{index:t,range:n}})=>{var r,s;return[t,new Un(null!==(r=n.lower)&&void 0!==r?r:e.MIN_KEY,null!==(s=n.upper)&&void 0!==s?s:e.MAX_KEY)]},f={get:e=>[l,new Un(e.key)],getMany:e=>[l,(new Un).addKeys(e.keys)],count:d,query:d,openCursor:d};return n(f).forEach((e=>{h[e]=function(n){const{subscr:r}=Oe;if(r){const a=e=>{const n=`idb://${t}/${i}/${e}`;return r[n]||(r[n]=new Un)},l=a(""),h=a(":dels"),[d,p]=f[e](n);if(a(d.name||"").add(p),!d.isPrimaryKey){if("count"!==e){const t="query"===e&&c&&n.values&&o.query({...n,values:!1});return o[e].apply(this,arguments).then((r=>{if("query"===e){if(c&&n.values)return t.then((({result:e})=>(l.addKeys(e),r)));const e=n.values?r.result.map(u):r.result;n.values?l.addKeys(e):h.addKeys(e)}else if("openCursor"===e){const e=r,t=n.values;return e&&Object.create(e,{key:{get:()=>(h.addKey(e.primaryKey),e.key)},primaryKey:{get(){const t=e.primaryKey;return h.addKey(t),t}},value:{get:()=>(t&&l.addKey(e.primaryKey),e.value)}})}return r}))}h.add(s)}}return o[e].apply(this,arguments)}})),h}}}};class Qn{constructor(e,t){this._middlewares={},this.verno=0;const n=Qn.dependencies;this._options=t={addons:Qn.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:r}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:te,dbReadyPromise:null,cancelOpen:te,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var i;s.dbReadyPromise=new Be((e=>{s.dbReadyResolve=e})),s.openCanceller=new Be(((e,t)=>{s.cancelOpen=t})),this._state=s,this.name=e,this.on=Dt(this,"populate","blocked","versionchange","close",{ready:[ue,te]}),this.on.ready.subscribe=m(this.on.ready.subscribe,(e=>(t,n)=>{Qn.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Be.resolve().then(t),n&&e(t);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(t),n&&e(t);else{e(t);const r=this;n||e((function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)}))}}))})),this.Collection=(i=this,It(Wt.prototype,(function(e,t){this.db=i;let n=Ct,r=null;if(t)try{n=t()}catch(e){r=e}const s=e._ctx,o=s.table,a=o.hook.reading.fire;this._ctx={table:o,index:s.index,isPrimKey:!s.index||o.schema.primKey.keyPath&&s.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:s.or,valueMapper:a!==ne?a:null}}))),this.Table=function(e){return It(Bt.prototype,(function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:Dt(null,{creating:[ie,te],reading:[re,ne],updating:[ae,te],deleting:[oe,te]})}))}(this),this.Transaction=function(e){return It(ln.prototype,(function(t,n,r,s,i){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=Dt(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 Be(((e,t)=>{this._resolve=e,this._reject=t})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),pt(e)}))}))}(this),this.Version=function(e){return It(On.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(e){return It(tn.prototype,(function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};const s=e._deps.indexedDB;if(!s)throw new J.MissingAPI;this._cmp=this._ascending=s.cmp.bind(s),this._descending=(e,t)=>s.cmp(t,e),this._max=(e,t)=>s.cmp(e,t)>0?e:t,this._min=(e,t)=>s.cmp(e,t)<0?e:t,this._IDBKeyRange=e._deps.IDBKeyRange}))}(this),this.on("versionchange",(e=>{e.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(e=>{!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)})),this._maxKey=dn(t.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),_t.filter((e=>e.name===this.name&&e!==this&&!e._state.vcFired)).map((t=>t.on("versionchange").fire(e)))},this.use(Mn),this.use(Nn),this.use(Gn),this.use($n),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((e=>e(this)))}version(e){if(isNaN(e)||e<.1)throw new J.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new J.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const t=this._versions;var n=t.filter((t=>t._cfg.version===e))[0];return n||(n=new this.Version(e),t.push(n),t.sort(_n),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||Oe.letThrough||this._vip)?e():new Be(((e,t)=>{if(this._state.openComplete)return t(new J.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new J.DatabaseClosed);this.open().catch(te)}this._state.dbReadyPromise.then(e,t)})).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});const s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:t,level:null==n?10:n,name:r}),s.sort(((e,t)=>e.level-t.level)),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter((e=>n?e.create!==n:!!t&&e.name!==t))),this}open(){return function(e){const t=e._state,{indexedDB:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((()=>t.dbOpenError?pt(t.dbOpenError):e));M&&(t.openCanceller._stackHolder=$()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const s=t.openCanceller;function i(){if(t.openCanceller!==s)throw new J.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,a=null,l=!1;const u=()=>new Be(((s,o)=>{if(i(),!r)throw new J.MissingAPI;const u=e.name,c=t.autoSchema?r.open(u):r.open(u,Math.round(10*e.verno));if(!c)throw new J.MissingAPI;c.onerror=nn(o),c.onblocked=ze(e._fireOnBlocked),c.onupgradeneeded=ze((n=>{if(a=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=rn,a.abort(),c.result.close();const e=r.deleteDatabase(u);e.onsuccess=e.onerror=ze((()=>{o(new J.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{a.onerror=nn(o);var s=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;l=s<1,e._novip.idbdb=c.result,xn(e,s/10,a,o)}}),o),c.onsuccess=ze((()=>{a=null;const r=e._novip.idbdb=c.result,i=y(r.objectStoreNames);if(i.length>0)try{const s=r.transaction(1===(o=i).length?o[0]:o,"readonly");t.autoSchema?function({_novip:e},t,r){e.verno=t.version/10;const s=e._dbSchema=Sn(0,t,r);e._storeNames=y(t.objectStoreNames,0),vn(e,[e._allTables],n(s),s)}(e,r,s):(Kn(e,e._dbSchema,s),function(e,t){const n=kn(Sn(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((e=>e.add.length||e.change.length)))}(e,s)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),gn(e,s)}catch(e){}var o;_t.push(e),r.onversionchange=ze((n=>{t.vcFired=!0,e.on("versionchange").fire(n)})),r.onclose=ze((t=>{e.on("close").fire(t)})),l&&function({indexedDB:e,IDBKeyRange:t},n){!Cn(e)&&n!==St&&An(e,t).put({name:n}).catch(te)}(e._deps,u),s()}),o)})).catch((e=>e&&"UnknownError"===e.name&&t.PR1398_maxLoop>0?(t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),u()):Be.reject(e)));return Be.race([s,("undefined"==typeof navigator?Be.resolve():Bn()).then(u)]).then((()=>(i(),t.onReadyBeingFired=[],Be.resolve(jn((()=>e.on.ready.fire(e.vip)))).then((function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(ue,te);return t.onReadyBeingFired=[],Be.resolve(jn((()=>r(e.vip)))).then(n)}}))))).finally((()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1})).then((()=>e)).catch((n=>{t.dbOpenError=n;try{a&&a.abort()}catch(e){}return s===t.openCanceller&&e._close(),pt(n)})).finally((()=>{t.openComplete=!0,o()}))}(this)}_close(){const e=this._state,t=_t.indexOf(this);if(t>=0&&_t.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new Be((t=>{e.dbReadyResolve=t})),e.openCanceller=new Be(((t,n)=>{e.cancelOpen=n}))}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new J.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,t=this._state;return new Be(((n,r)=>{const s=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=ze((()=>{!function({indexedDB:e,IDBKeyRange:t},n){!Cn(e)&&n!==St&&An(e,t).delete(n).catch(te)}(this._deps,this.name),n()})),e.onerror=nn(r),e.onblocked=this._fireOnBlocked};if(e)throw new J.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(s):s()}))}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){const e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return n(this._allTables).map((e=>this._allTables[e]))}transaction(){const e=In.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r=Oe.trans;r&&r.db===this&&-1===e.indexOf("!")||(r=null);const s=-1!==e.indexOf("?");let i,o;e=e.replace("!","").replace("?","");try{if(o=t.map((e=>{var t=e instanceof this.Table?e.name:e;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t})),"r"==e||e===Kt)i=Kt;else{if("rw"!=e&&e!=Ot)throw new J.InvalidArgument("Invalid transaction mode: "+e);i=Ot}if(r){if(r.mode===Kt&&i===Ot){if(!s)throw new J.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((e=>{if(r&&-1===r.storeNames.indexOf(e)){if(!s)throw new J.SubTransaction("Table "+e+" not included in parent transaction.");r=null}})),s&&r&&!r.active&&(r=null)}}catch(e){return r?r._promise(null,((t,n)=>{n(e)})):pt(e)}const a=Tn.bind(null,this,i,o,r,n);return r?r._promise(i,a,"lock"):Oe.trans?lt(Oe.transless,(()=>this._whenReady(a))):this._whenReady(a)}table(e){if(!a(this._allTables,e))throw new J.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Xn="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class Jn{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[Xn](){return this}}function Zn(e,t){return n(t).forEach((n=>{Wn(e[n]||(e[n]=new Un),t[n])})),e}let er;try{er={indexedDB:t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,IDBKeyRange:t.IDBKeyRange||t.webkitIDBKeyRange}}catch(t){er={indexedDB:null,IDBKeyRange:null}}const tr=Qn;function nr(e){let t=rr;try{rr=!0,an.storagemutated.fire(e)}finally{rr=t}}l(tr,{...ee,delete:e=>new tr(e,{addons:[]}).delete(),exists:e=>new tr(e,{addons:[]}).open().then((e=>(e.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(e){try{return function({indexedDB:e,IDBKeyRange:t}){return Cn(e)?Promise.resolve(e.databases()).then((e=>e.map((e=>e.name)).filter((e=>e!==St)))):An(e,t).toCollection().primaryKeys()}(tr.dependencies).then(e)}catch(e){return pt(new J.MissingAPI)}},defineClass:()=>function(e){s(this,e)},ignoreTransaction:e=>Oe.trans?lt(Oe.transless,e):e(),vip:jn,async:function(e){return function(){try{var t=Dn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Be.resolve(t)}catch(e){return pt(e)}}},spawn:function(e,t,n){try{var r=Dn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Be.resolve(r)}catch(e){return pt(e)}},currentTransaction:{get:()=>Oe.trans||null},waitFor:function(e,t){const n=Be.resolve("function"==typeof e?tr.ignoreTransaction(e):e).timeout(t||6e4);return Oe.trans?Oe.trans.waitFor(n):n},Promise:Be,debug:{get:()=>M,set:e=>{F(e,"dexie"===e?()=>!0:Pt)}},derive:h,extend:s,props:l,override:m,Events:Dt,on:an,liveQuery:function(e){let t,r=!1;const s=new Jn((s=>{const i=R(e);let o=!1,a={},l={};const u={get closed(){return o},unsubscribe:()=>{o=!0,an.storagemutated.unsubscribe(f)}};s.start&&s.start(u);let c=!1,h=!1;function d(){return n(l).some((e=>a[e]&&function(e,t){const n=Yn(t);let r=n.next();if(r.done)return!1;let s=r.value;const i=Yn(e);let o=i.next(s.from),a=o.value;for(;!r.done&&!o.done;){if(Lt(a.from,s.to)<=0&&Lt(a.to,s.from)>=0)return!0;Lt(s.from,a.from)<0?s=(r=n.next(a.from)).value:a=(o=i.next(s.from)).value}return!1}(a[e],l[e])))}const f=e=>{Zn(a,e),d()&&p()},p=()=>{if(c||o)return;a={};const n={},y=function(t){i&&tt();const n=()=>et(e,{subscr:t,trans:null}),r=Oe.trans?lt(Oe.transless,n):n();return i&&r.then(nt,nt),r}(n);h||(an(sn,f),h=!0),c=!0,Promise.resolve(y).then((e=>{r=!0,t=e,c=!1,o||(d()?p():(a={},l=n,s.next&&s.next(e)))}),(e=>{c=!1,r=!1,s.error&&s.error(e),u.unsubscribe()}))};return p(),u}));return s.hasValue=()=>r,s.getValue=()=>t,s},extendObservabilitySet:Zn,getByKeyPath:w,setByKeyPath:_,delByKeyPath:function(e,t){"string"==typeof t?_(e,t,void 0):"length"in t&&[].map.call(t,(function(t){_(e,t,void 0)}))},shallowClone:x,deepClone:O,getObjectDiff:Fn,cmp:Lt,asap:g,minKey:gt,addons:[],connections:_t,errnames:Q,dependencies:er,semVer:mt,version:mt.split(".").map((e=>parseInt(e))).reduce(((e,t,n)=>e+t/Math.pow(10,2*n)))}),tr.maxKey=dn(tr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(an(sn,(e=>{if(!rr){let t;xt?(t=document.createEvent("CustomEvent"),t.initCustomEvent(on,!0,!0,e)):t=new CustomEvent(on,{detail:e}),rr=!0,dispatchEvent(t),rr=!1}})),addEventListener(on,(({detail:e})=>{rr||nr(e)})));let rr=!1;if("undefined"!=typeof BroadcastChannel){const e=new BroadcastChannel(on);"function"==typeof e.unref&&e.unref(),an(sn,(t=>{rr||e.postMessage(t)})),e.onmessage=e=>{e.data&&nr(e.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){an(sn,(e=>{try{rr||("undefined"!=typeof localStorage&&localStorage.setItem(on,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((t=>t.postMessage({type:on,changedParts:e}))))}catch(e){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(e=>{if(e.key===on){const t=JSON.parse(e.newValue);t&&nr(t.changedParts)}}));const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",(function({data:e}){e&&e.type===on&&nr(e.changedParts)}))}Be.rejectionMapper=function(e,t){if(!e||e instanceof Y||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Z[e.name])return e;var n=new Z[e.name](t||e.message,e);return"stack"in e&&c(n,"stack",{get:function(){return this.inner.stack}}),n},F(M,Pt);class sr{constructor(e,t,n){this.name=e,this.table=t,this.keys=n}database(){const e=new Qn(this.name);let t=1;for(let n of this.keys)e.version(t).stores({[this.table]:n}),t++;return e}async save(e){const t=this.database();await t[this.table].bulkPut(e).then((()=>{t.close()})).catch((e=>{throw console.error("Error in db.save",e),e}))}async read(e="name"){const t=this.database();return await t[this.table].orderBy(e).toArray().then((e=>(t.close(),e))).catch((e=>{throw console.error("Error in db.read",errerr),e}))}async getFirstRow(){const e=this.database();return await e[this.table].orderBy(":id").first().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.getFirstRow",e),e}))}async delete(){const e=new Qn(this.name);await e.delete().then((()=>{e.close()})).catch((e=>{throw console.warn("Error in db.delete",e),e}))}async count(){const e=this.database();return await e[this.table].count().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.count",e),e}))}async getVersion(){const e=await new Qn(this.name).open().then((e=>{const t=e.verno;return e.close(),t})).catch((e=>{throw console.error("Error in db.getVersion",e),e}));return e}}const ir=window.wp.apiFetch;var or=e.n(ir);async function ar(e,t){try{await or().use(or().createNonceMiddleware(pluginAllSitesMenu.nonce));const n=await or()({url:pluginAllSitesMenu.restURL,method:"POST",data:{offset:t}}).catch((e=>{throw console.error("Error in apiFetch",e),e}));"success"===n.response&&(t+=pluginAllSitesMenu.loadincrements,e.save(n.data),await ar(e,t))}catch(e){throw console.error("Error in loadSites",e),e}}function lr(e,t){if(!e)return;e.classList&&e.classList.add?e.classList.add(t):cr(e,t)||(e.className&&(e.className+=" "),e.className+=t);let n=e.getBoundingClientRect().top,r=e.querySelector(".ab-submenu");r.style.top=n-6+"px",r.getBoundingClientRect().bottom>window.innerHeight&&(r.style.top="auto",r.style.bottom="0")}function ur(e,t){let n,r;if(e||cr(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=` ${t} `,r=` ${e.className} `;r.indexOf(n)>-1;)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function cr(e,t){let n;return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&(n=e.className.split(" "),n.indexOf(t)>-1))}const hr=window.wp.i18n;document.addEventListener("DOMContentLoaded",(async()=>{if(!document.getElementById("wpadminbar"))return;const e={load:document.querySelector("#wp-admin-bar-load-more"),menu:document.querySelector("#wp-admin-bar-my-sites-list"),timestamp:document.querySelector("#load-more-timestamp")};!0===pluginAllSitesMenu.displaySearch&&function(){const e=document.querySelector("#all-sites-search-text");null!==e&&e.addEventListener("keyup",(e=>{e.preventDefault();const t=e.target.value.toUpperCase(),n=document.querySelector("#wp-admin-bar-my-sites-list").getElementsByClassName("menupop");for(let e=0;e<n.length;e++){let r=n[e].querySelector(".ab-item");(r.textContent||r.innerText).toUpperCase().indexOf(t)>-1?n[e].style.display="":n[e].style.display="none"}}))}();const t=new sr("allsites","sites",["id,name,url","id,name,url,timestamp"]);var n;n=e.menu,new IntersectionObserver((e=>{e.forEach((e=>{const t=e.boundingClientRect,n=t.bottom<window.innerHeight&&t.bottom;if(window.matchMedia("(min-width: 783px)").matches){const e=document.querySelector("#wp-admin-bar-my-sites>.ab-sub-wrapper");n?(e.style.height="",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="0"):(e.style.height="calc(100vh - 32px)",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="32px")}}))}),{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]}).observe(n),await async function(e){const t=await e.getFirstRow();void 0!==t&&void 0!==t.timestamp&&pluginAllSitesMenu.timestamp>t.timestamp&&await e.delete();0===await e.count()&&ar(e,0)}(t);const r=function(e,t){const n=new IntersectionObserver((n=>{n.forEach((e=>{const{isIntersecting:n}=e;n&&t()}),{root:e})}));return n.observe(e),n}(e.load,(async()=>{const n=(await t.read(pluginAllSitesMenu.orderBy)).reduce(((e,t)=>e+function(e){return`\n\t\t\t\t<li id="wp-admin-bar-${e.id}" class="menupop">\n\t\t\t\t<a class="ab-item" aria-haspopup="true" href="${e.admin}/"><span class="wp-admin-bar-arrow" aria-hidden="true"></span>\n\t\t\t\t\t${e.title}\n\t\t\t\t</a>\n\t\t\t\t<div class="ab-sub-wrapper">\n\t\t\t\t\t<ul id="wp-admin-bar-${e.id}-default" class="ab-submenu">\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-d"><a class="ab-item"\thref="${e.admin}">${(0,hr.__)("Dashboard","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-n"><a class="ab-item" href="${e.admin}/post-new.php">${(0,hr.__)("New Post","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-o"><a class="ab-item" href="${e.admin}/post-new.php?post_type=page">${(0,hr.__)("New Page","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-c"><a class="ab-item" href="${e.admin}/edit-comments.php">${(0,hr.__)("Manage Comments","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-u"><a class="ab-item" href="${e.admin}/users.php">${(0,hr.__)("Users","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-p"><a class="ab-item" href="${e.admin}/plugins.php">${(0,hr.__)("Plugins","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-s"><a class="ab-item" href="${e.admin}/options-general.php">${(0,hr.__)("Settings","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-v"><a class="ab-item" href="${e.url}/">${(0,hr.__)("Visit","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t`}(t)),"");e.load.insertAdjacentHTML("beforeBegin",n),function(){const e=document.getElementById("wp-admin-bar-my-sites-list");e&&(e.addEventListener("mouseenter",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&lr(e.target,"hover")}),{capture:!0}),e.addEventListener("mouseleave",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&ur(e.target,"hover")}),{capture:!0}),e.addEventListener("keydown",(e=>{"Tab"===e.key&&(e.preventDefault(),e.target.classList.contains("menupop")&&toggleClass(e.target,"hover"))}),{capture:!0}))}(),e.load.style.display="none",r.unobserve(e.load)}))}))})();7 */(()=>{var e={744:function(e,t,n){e.exports=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},t=function(){return(t=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)};function r(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,o=Object.keys,a=Array.isArray;function u(e,t){return"object"!=typeof t||o(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||i.Promise||(i.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))),("undefined"==typeof Reflect?o:Reflect.ownKeys)(t).forEach((function(n){d(e,n,t[n])}))}var h=Object.defineProperty;function d(e,t,n,r){h(e,t,u(n&&l(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function p(e){return{from:function(t){return e.prototype=Object.create(t.prototype),d(e.prototype,"constructor",e),{extend:f.bind(null,e.prototype)}}}}var y=Object.getOwnPropertyDescriptor,m=[].slice;function v(e,t,n){return m.call(e,t,n)}function b(e,t){return t(e)}function g(e){if(!e)throw new Error("Assertion Failed")}function w(e){i.setImmediate?setImmediate(e):setTimeout(e,0)}function _(e,t){if("string"==typeof t&&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=_(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(-1!==a){var u=e[t.substr(0,a)];return null==u?void 0:_(u,t.substr(a+1))}}function x(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){g("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)x(e,t[r],n[r])}else{var o,u,s=t.indexOf(".");-1!==s?(o=t.substr(0,s),""===(u=t.substr(s+1))?void 0===n?a(e)&&!isNaN(parseInt(o))?e.splice(o,1):delete e[o]:e[o]=n:x(s=(s=e[o])&&l(e,o)?s:e[o]={},u,n)):void 0===n?a(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function k(e){var t,n={};for(t in e)l(e,t)&&(n[t]=e[t]);return n}var O=[].concat;function P(e){return O.apply([],e)}var E="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".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 i[e]})),S=new Set(E.map((function(e){return i[e]}))),K=null;function A(e){return K=new WeakMap,e=function e(t){if(!t||"object"!=typeof t)return t;var n=K.get(t);if(n)return n;if(a(t)){n=[],K.set(t,n);for(var r=0,i=t.length;r<i;++r)n.push(e(t[r]))}else if(S.has(t.constructor))n=t;else{var o,u=s(t);for(o in n=u===Object.prototype?{}:Object.create(u),K.set(t,n),t)l(t,o)&&(n[o]=e(t[o]))}return n}(e),K=null,e}var C={}.toString;function j(e){return C.call(e).slice(8,-1)}var q="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",T="symbol"==typeof q?function(e){var t;return null!=e&&(t=e[q])&&t.apply(e)}:function(){return null};function B(e,t){return 0<=(t=e.indexOf(t))&&e.splice(t,1),0<=t}var D={};function I(e){var t,n,r,i;if(1===arguments.length){if(a(e))return e.slice();if(this===D&&"string"==typeof e)return[e];if(i=T(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"!=typeof(t=e.length))return[e];for(n=new Array(t);t--;)n[t]=e[t];return n}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var R="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},M=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(se=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"]),N={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function F(e,t){this.name=e,this.message=t}function L(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 $(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=L(e,t)}function U(e,t){this.name="BulkError",this.failures=Object.keys(t).map((function(e){return t[e]})),this.failuresByPos=t,this.message=L(e,this.failures)}p(F).from(Error).extend({toString:function(){return this.name+": "+this.message}}),p($).from(F),p(U).from(F);var V=M.reduce((function(e,t){return e[t]=t+"Error",e}),{}),z=F,W=M.reduce((function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==typeof e&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=N[t]||n,this.inner=null)}return p(r).from(z),e[t]=r,e}),{});W.Syntax=SyntaxError,W.Type=TypeError,W.Range=RangeError;var Y=se.reduce((function(e,t){return e[t+"Error"]=W[t],e}),{}),Q=M.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=W[t]),e}),{});function G(){}function H(e){return e}function X(e,t){return null==e||e===H?t:function(n){return t(e(n))}}function J(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Z(e,t){return e===G?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?J(r,this.onsuccess):r),i&&(this.onerror=this.onerror?J(i,this.onerror):i),void 0!==o?o:n}}function ee(e,t){return e===G?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?J(n,this.onsuccess):n),r&&(this.onerror=this.onerror?J(r,this.onerror):r)}}function te(e,t){return e===G?t:function(n){var r=e.apply(this,arguments);u(n,r);var i=this.onsuccess,o=this.onerror;return this.onsuccess=null,this.onerror=null,n=t.apply(this,arguments),i&&(this.onsuccess=this.onsuccess?J(i,this.onsuccess):i),o&&(this.onerror=this.onerror?J(o,this.onerror):o),void 0===r?void 0===n?void 0:n:u(r,n)}}function ne(e,t){return e===G?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function re(e,t){return e===G?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)}}Q.ModifyError=$,Q.DexieError=F,Q.BulkError=U;var ie="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function oe(e){ie=e}var ae={},ue=100,se=(E="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,s(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,s(t),e]}(),E[0]),ce=(M=E[1],E=E[2],M=M&&M.then,se&&se.constructor),le=!!E,fe=function(e,t){ge.push([e,t]),de&&(queueMicrotask(Ae),de=!1)},he=!0,de=!0,pe=[],ye=[],me=H,ve={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:G,pgp:!1,env:{},finalize:G},be=ve,ge=[],we=0,_e=[];function xe(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=be;if("function"!=typeof e){if(e!==ae)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Pe(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&&Ce();n&&"function"==typeof n.then?e(t,(function(e,t){n instanceof xe?n._then(e,t):n.then(e,t)})):(t._state=!0,t._value=n,Ee(t)),r&&je()}}),Pe.bind(null,t))}catch(n){Pe(t,n)}}(this,e)}var ke={get:function(){var e=be,t=Ne;function n(n,r){var i=this,o=!e.global&&(e!==be||t!==Ne),a=o&&!Ue(),u=new xe((function(t,u){Se(i,new Oe(Ge(n,e,o,a),Ge(r,e,o,a),t,u,e))}));return this._consoleTask&&(u._consoleTask=this._consoleTask),u}return n.prototype=ae,n},set:function(e){d(this,"then",e&&e.prototype===ae?ke:{get:function(){return e},set:ke.set})}};function Oe(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 Pe(e,t){var n,r;ye.push(t),null===e._state&&(n=e._lib&&Ce(),t=me(t),e._state=!1,e._value=t,r=e,pe.some((function(e){return e._value===r._value}))||pe.push(r),Ee(e),n&&je())}function Ee(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Se(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===we&&(++we,fe((function(){0==--we&&qe()}),[]))}function Se(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,++we,fe(Ke,[n,e,t])}else e._listeners.push(t)}function Ke(e,t,n){try{var r,i=t._value;!t._state&&ye.length&&(ye=[]),r=ie&&t._consoleTask?t._consoleTask.run((function(){return e(i)})):e(i),t._state||-1!==ye.indexOf(i)||function(e){for(var t=pe.length;t;)if(pe[--t]._value===e._value)return pe.splice(t,1)}(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--we&&qe(),--n.psd.ref||n.psd.finalize()}}function Ae(){Qe(ve,(function(){Ce()&&je()}))}function Ce(){var e=he;return de=he=!1,e}function je(){var e,t,n;do{for(;0<ge.length;)for(e=ge,ge=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(0<ge.length);de=he=!0}function qe(){var e=pe;pe=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=_e.slice(0),n=t.length;n;)t[--n]()}function Te(e){return new xe(ae,!1,e)}function Be(e,t){var n=be;return function(){var r=Ce(),i=be;try{return We(n,!0),e.apply(this,arguments)}catch(r){t&&t(r)}finally{We(i,!1),r&&je()}}}f(xe.prototype,{then:ke,_then:function(e,t){Se(this,new Oe(null,null,e,t,be))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=e,n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return(e instanceof t?n:Te)(e)})):this.then(null,(function(e){return(e&&e.name===t?n:Te)(e)}))},finally:function(e){return this.then((function(t){return xe.resolve(e()).then((function(){return t}))}),(function(t){return xe.resolve(e()).then((function(){return Te(t)}))}))},timeout:function(e,t){var n=this;return e<1/0?new xe((function(r,i){var o=setTimeout((function(){return i(new W.Timeout(t))}),e);n.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&d(xe.prototype,Symbol.toStringTag,"Dexie.Promise"),ve.env=Ye(),f(xe,{all:function(){var e=I.apply(null,arguments).map(Ve);return new xe((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(i,o){return xe.resolve(i).then((function(n){e[o]=n,--r||t(e)}),n)}))}))},resolve:function(e){return e instanceof xe?e:e&&"function"==typeof e.then?new xe((function(t,n){e.then(t,n)})):new xe(ae,!0,e)},reject:Te,race:function(){var e=I.apply(null,arguments).map(Ve);return new xe((function(t,n){e.map((function(e){return xe.resolve(e).then(t,n)}))}))},PSD:{get:function(){return be},set:function(e){return be=e}},totalEchoes:{get:function(){return Ne}},newPSD:Le,usePSD:Qe,scheduler:{get:function(){return fe},set:function(e){fe=e}},rejectionMapper:{get:function(){return me},set:function(e){me=e}},follow:function(e,t){return new xe((function(n,r){return Le((function(t,n){var r=be;r.unhandleds=[],r.onunhandled=n,r.finalize=J((function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},_e.push((function t(){e(),_e.splice(_e.indexOf(t),1)})),++we,fe((function(){0==--we&&qe()}),[])}),r.finalize),e()}),t,n,r)}))}}),ce&&(ce.allSettled&&d(xe,"allSettled",(function(){var e=I.apply(null,arguments).map(Ve);return new xe((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);e.forEach((function(e,i){return xe.resolve(e).then((function(e){return r[i]={status:"fulfilled",value:e}}),(function(e){return r[i]={status:"rejected",reason:e}})).then((function(){return--n||t(r)}))}))}))})),ce.any&&"undefined"!=typeof AggregateError&&d(xe,"any",(function(){var e=I.apply(null,arguments).map(Ve);return new xe((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach((function(e,o){return xe.resolve(e).then((function(e){return t(e)}),(function(e){i[o]=e,--r||n(new AggregateError(i))}))}))}))})),ce.withResolvers&&(xe.withResolvers=ce.withResolvers));var De={awaits:0,echoes:0,id:0},Ie=0,Re=[],Me=0,Ne=0,Fe=0;function Le(e,t,n,r){var i=be,o=Object.create(i);return o.parent=i,o.ref=0,o.global=!1,o.id=++Fe,ve.env,o.env=le?{Promise:xe,PromiseProp:{value:xe,configurable:!0,writable:!0},all:xe.all,race:xe.race,allSettled:xe.allSettled,any:xe.any,resolve:xe.resolve,reject:xe.reject}:{},t&&u(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()},r=Qe(o,e,n,r),0===o.ref&&o.finalize(),r}function $e(){return De.id||(De.id=++Ie),++De.awaits,De.echoes+=ue,De.id}function Ue(){return!!De.awaits&&(0==--De.awaits&&(De.id=0),De.echoes=De.awaits*ue,!0)}function Ve(e){return De.echoes&&e&&e.constructor===ce?($e(),e.then((function(e){return Ue(),e}),(function(e){return Ue(),Xe(e)}))):e}function ze(){var e=Re[Re.length-1];Re.pop(),We(e,!1)}function We(e,t){var n,r=be;(t?!De.echoes||Me++&&e===be:!Me||--Me&&e===be)||queueMicrotask(t?function(e){++Ne,De.echoes&&0!=--De.echoes||(De.echoes=De.awaits=De.id=0),Re.push(be),We(e,!0)}.bind(null,e):ze),e!==be&&(be=e,r===ve&&(ve.env=Ye()),le&&(n=ve.env.Promise,t=e.env,(r.global||e.global)&&(Object.defineProperty(i,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function Ye(){var e=i.Promise;return le?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Qe(e,t,n,r,i){var o=be;try{return We(e,!0),t(n,r,i)}finally{We(o,!1)}}function Ge(e,t,n,r){return"function"!=typeof e?e:function(){var i=be;n&&$e(),We(t,!0);try{return e.apply(this,arguments)}finally{We(i,!1),r&&queueMicrotask(Ue)}}}function He(e){Promise===ce&&0===De.echoes?0===Me?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+M).indexOf("[native code]")&&($e=Ue=G);var Xe=xe.reject,Je=String.fromCharCode(65535),Ze="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",et="String expected.",tt=[],nt="__dbnames",rt="readonly",it="readwrite";function ot(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var at={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function ut(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=A(t))[e],t}}function st(){throw W.Type()}function ct(e,t){try{var n=lt(e),r=lt(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}(ft(e),ft(t));case"Array":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=ct(e[o],t[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function lt(e){var t=typeof e;return"object"!=t?t:ArrayBuffer.isView(e)||"ArrayBuffer"===(e=j(e))?"binary":e}function ft(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var ht=(dt.prototype._trans=function(e,t,n){var r=this._tx||be.trans,i=this.name,o=ie&&"undefined"!=typeof console&&console.createTask&&console.createTask("Dexie: ".concat("readonly"===e?"read":"write"," ").concat(this.name));function a(e,n,r){if(!r.schema[i])throw new W.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var u=Ce();try{var s=r&&r.db._novip===this.db._novip?r===be.trans?r._promise(e,a,n):Le((function(){return r._promise(e,a,n)}),{trans:r,transless:be.transless||be}):function e(t,n,r,i){if(t.idbdb&&(t._state.openComplete||be.letThrough||t._vip)){var o=t._createTransaction(n,r,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===V.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,i)}))):Xe(o)}return o._promise(n,(function(e,t){return Le((function(){return be.trans=o,i(e,t,o)}))})).then((function(e){if("readwrite"===n)try{o.idbtrans.commit()}catch(e){}return"readonly"===n?e:o._completion.then((function(){return e}))}))}if(t._state.openComplete)return Xe(new W.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return Xe(new W.DatabaseClosed);t.open().catch(G)}return t._state.dbReadyPromise.then((function(){return e(t,n,r,i)}))}(this.db,e,[this.name],a);return o&&(s._consoleTask=o,s=s.catch((function(e){return console.trace(e),Xe(e)}))),s}finally{u&&je()}},dt.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?Xe(new W.Type("Invalid argument to Table.get()")):this._trans("readonly",(function(t){return n.core.get({trans:t,key:e}).then((function(e){return n.hook.reading.fire(e)}))})).then(t)},dt.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(a(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=o(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){if(e.compound&&t.every((function(t){return 0<=e.keyPath.indexOf(t)}))){for(var n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort((function(e,t){return e.keyPath.length-t.keyPath.length}))[0];if(n&&this.db._maxKey!==Je){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map((function(t){return e[t]})))}!n&&ie&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var i=this.schema.idxByName;function u(e,t){return 0===ct(e,t)}var s=t.reduce((function(t,n){var r=t[0],o=t[1],s=(t=i[n],e[n]);return[r||t,r||!t?ot(o,t&&t.multi?function(e){return e=_(e,n),a(e)&&e.some((function(e){return u(s,e)}))}:function(e){return u(s,_(e,n))}):o]}),[null,null]);return r=s[0],s=s[1],r?this.where(r.name).equals(e[r.keyPath]).filter(s):n?this.filter(s):this.where(t).equals("")},dt.prototype.filter=function(e){return this.toCollection().and(e)},dt.prototype.count=function(e){return this.toCollection().count(e)},dt.prototype.offset=function(e){return this.toCollection().offset(e)},dt.prototype.limit=function(e){return this.toCollection().limit(e)},dt.prototype.each=function(e){return this.toCollection().each(e)},dt.prototype.toArray=function(e){return this.toCollection().toArray(e)},dt.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},dt.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,a(e)?"[".concat(e.join("+"),"]"):e))},dt.prototype.reverse=function(){return this.toCollection().reverse()},dt.prototype.mapToClass=function(t){var n,r=this.db,i=this.name;function o(){return null!==n&&n.apply(this,arguments)||this}(this.schema.mappedClass=t).prototype instanceof st&&(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(o,n=t),Object.defineProperty(o.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),o.prototype.table=function(){return i},t=o);for(var a=new Set,u=t.prototype;u;u=s(u))Object.getOwnPropertyNames(u).forEach((function(e){return a.add(e)}));function c(e){if(!e)return e;var n,r=Object.create(t.prototype);for(n in e)if(!a.has(n))try{r[n]=e[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=c,this.hook("reading",c),t},dt.prototype.defineClass=function(){return this.mapToClass((function(e){u(this,e)}))},dt.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=ut(o)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{x(e,o,t)}catch(t){}return t}))},dt.prototype.update=function(e,t){return"object"!=typeof e||a(e)?this.where(":id").equals(e).modify(t):void 0===(e=_(e,this.schema.primKey.keyPath))?Xe(new W.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},dt.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=ut(o)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{x(e,o,t)}catch(t){}return t}))},dt.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?xe.reject(e.failures[0]):void 0}))},dt.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(t){return e.core.mutate({trans:t,type:"deleteRange",range:at})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):void 0}))},dt.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",(function(n){return t.core.getMany({keys:e,trans:n}).then((function(e){return e.map((function(e){return t.hook.reading.fire(e)}))}))}))},dt.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(u=r.schema.primKey).auto;if((u=u.keyPath)&&i)throw new W.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new W.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,u=u&&n?e.map(ut(u)):e;return r.core.mutate({trans:t,type:"add",keys:i,values:u,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult;if(e=e.failures,0===t)return o?n:i;throw new U("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},dt.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(u=r.schema.primKey).auto;if((u=u.keyPath)&&i)throw new W.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new W.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,u=u&&n?e.map(ut(u)):e;return r.core.mutate({trans:t,type:"put",keys:i,values:u,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult;if(e=e.failures,0===t)return o?n:i;throw new U("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},dt.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map((function(e){return e.key})),i=e.map((function(e){return e.changes})),o=[];return this._trans("readwrite",(function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then((function(u){var s=[],c=[];e.forEach((function(e,n){var r=e.key,i=e.changes,a=u[n];if(a){for(var l=0,f=Object.keys(i);l<f.length;l++){var h=f[l],d=i[h];if(h===t.schema.primKey.keyPath){if(0!==ct(d,r))throw new W.Constraint("Cannot update primary key in bulkUpdate()")}else x(a,h,d)}o.push(n),s.push(r),c.push(a)}}));var l=s.length;return n.mutate({trans:a,type:"put",keys:s,values:c,updates:{keys:r,changeSpecs:i}}).then((function(e){var n=e.numFailures,r=e.failures;if(0===n)return l;for(var i=0,a=Object.keys(r);i<a.length;i++){var u,s=a[i],c=o[Number(s)];null!=c&&(u=r[s],delete r[s],r[c]=u)}throw new U("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)}))}))}))},dt.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:e})})).then((function(e){var r=e.numFailures,i=e.lastResult;if(e=e.failures,0===r)return i;throw new U("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),e)}))},dt);function dt(){}function pt(e){function t(t,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return n[t].subscribe.apply(null,o),e}if("string"==typeof t)return n[t]}var n={};t.addEventType=u;for(var r=1,i=arguments.length;r<i;++r)u(arguments[r]);return t;function u(e,r,i){if("object"!=typeof e){var s;r=r||ne;var c={subscribers:[],fire:i=i||G,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,i)}};return n[e]=t[e]=c}o(s=e).forEach((function(e){var t=s[e];if(a(t))u(e,s[e][0],s[e][1]);else{if("asap"!==t)throw new W.InvalidArgument("Invalid event config");var n=u(e,H,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){w((function(){e.apply(null,t)}))}))}))}}))}}function yt(e,t){return p(t).from({prototype:e}),t}function mt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function vt(e,t){e.filter=ot(e.filter,t)}function bt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return ot(r(),t())}:t,e.justLimit=n&&!r}function gt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new W.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function wt(e,t,n){var r=gt(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 _t(e,t,n,r){var i=e.replayFilter?ot(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(e,n,r){var a,u;i&&!i(n,r,(function(e){return n.stop(e)}),(function(e){return n.fail(e)}))||("[object ArrayBuffer]"==(u=""+(a=n.primaryKey))&&(u=""+new Uint8Array(a)),l(o,u)||(o[u]=!0,t(e,n,r)))};return Promise.all([e.or._iterate(a,n),xt(wt(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return xt(wt(e,r,n),ot(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function xt(e,t,n,r){var i=Be(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=G}),(function(t){e.fail(t),n=G}))||i(e.value,e,(function(e){return n=e})),n()}))}))}E=Symbol();var kt=(Ot.prototype.execute=function(e){if(void 0!==this.add){var t=this.add;if(a(t))return r(r([],a(e)?e:[],!0),t,!0).sort();if("number"==typeof t)return(Number(e)||0)+t;if("bigint"==typeof t)try{return BigInt(e)+t}catch(e){return BigInt(0)+t}throw new TypeError("Invalid term ".concat(t))}if(void 0!==this.remove){var n=this.remove;if(a(n))return a(e)?e.filter((function(e){return!n.includes(e)})).sort():[];if("number"==typeof n)return Number(e)-n;if("bigint"==typeof n)try{return BigInt(e)-n}catch(e){return BigInt(0)-n}throw new TypeError("Invalid subtrahend ".concat(n))}return(t=null===(t=this.replacePrefix)||void 0===t?void 0:t[0])&&"string"==typeof e&&e.startsWith(t)?this.replacePrefix[1]+e.substring(t.length):e},Ot);function Ot(e){Object.assign(this,e)}var Pt=(Et.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,Xe.bind(null,n.error)):n.table._trans("readonly",e).then(t)},Et.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,Xe.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},Et.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=ot(t.algorithm,e)},Et.prototype._iterate=function(e,t){return _t(this._ctx,e,t,this._ctx.table.core)},Et.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&u(n,e),t._ctx=n,t},Et.prototype.raw=function(){return this._ctx.valueMapper=null,this},Et.prototype.each=function(e){var t=this._ctx;return this._read((function(n){return _t(t,e,n,t.table.core)}))},Et.prototype.count=function(e){var t=this;return this._read((function(e){var n=t._ctx,r=n.table.core;if(mt(n,!0))return r.count({trans:e,query:{index:gt(n,r.schema),range:n.range}}).then((function(e){return Math.min(e,n.limit)}));var i=0;return _t(n,(function(){return++i,!1}),e,r).then((function(){return i}))})).then(e)},Et.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 a="next"===this._ctx.dir?1:-1;function u(e,t){return ct(o(e,i),o(t,i))*a}return this.toArray((function(e){return e.sort(u)})).then(t)},Et.prototype.toArray=function(e){var t=this;return this._read((function(e){var n=t._ctx;if("next"===n.dir&&mt(n,!0)&&0<n.limit){var r=n.valueMapper,i=gt(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){return e=e.result,r?e.map(r):e}))}var o=[];return _t(n,(function(e){return o.push(e)}),e,n.table.core).then((function(){return o}))}),e)},Et.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,mt(t)?bt(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?--t:n((function(){e.advance(t),t=0})),!1)}})):bt(t,(function(){var t=e;return function(){return--t<0}}))),this},Et.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),bt(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),0<=t}}),!0),this},Et.prototype.until=function(e,t){return vt(this._ctx,(function(n,r,i){return!e(n.value)||(r(i),t)})),this},Et.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},Et.prototype.last=function(e){return this.reverse().first(e)},Et.prototype.filter=function(e){var t;return vt(this._ctx,(function(t){return e(t.value)})),(t=this._ctx).isMatch=ot(t.isMatch,e),this},Et.prototype.and=function(e){return this.filter(e)},Et.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},Et.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},Et.prototype.desc=function(){return this.reverse()},Et.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},Et.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},Et.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},Et.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)},Et.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&mt(t,!0)&&0<t.limit)return this._read((function(e){var n=gt(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)},Et.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},Et.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},Et.prototype.lastKey=function(e){return this.reverse().firstKey(e)},Et.prototype.distinct=function(){var e;if(!(e=(e=this._ctx).index&&e.table.schema.idxByName[e.index])||!e.multi)return this;var t={};return vt(this._ctx,(function(e){var n=e.primaryKey.toString();return e=l(t,n),t[n]=!0,!e})),this},Et.prototype.modify=function(e){var t=this,n=this._ctx;return this._write((function(r){var i,a,u;u="function"==typeof e?e:(i=o(e),a=i.length,function(t){for(var n=!1,r=0;r<a;++r){var o=i[r],u=e[o],s=_(t,o);u instanceof kt?(x(t,o,u.execute(s)),n=!0):s!==u&&(x(t,o,u),n=!0)}return n});var s,c=n.table.core,l=(s=c.schema.primaryKey).outbound,f=s.extractKey,h=200;function d(e,t){var n=t.failures;t=t.numFailures,y+=e-t;for(var r=0,i=o(n);r<i.length;r++){var a=i[r];p.push(n[a])}}(s=t.db._options.modifyChunkSize)&&(h="object"==typeof s?s[c.name]||s["*"]||200:s);var p=[],y=0,m=[];return t.clone().primaryKeys().then((function(t){function i(n){var a=Math.min(h,t.length-n);return c.getMany({trans:r,keys:t.slice(n,n+a),cache:"immutable"}).then((function(s){for(var p=[],y=[],m=l?[]:null,v=[],b=0;b<a;++b){var g=s[b],w={value:A(g),primKey:t[n+b]};!1!==u.call(w,w.value,w)&&(null==w.value?v.push(t[n+b]):l||0===ct(f(g),f(w.value))?(y.push(w.value),l&&m.push(t[n+b])):(v.push(t[n+b]),p.push(w.value)))}return Promise.resolve(0<p.length&&c.mutate({trans:r,type:"add",values:p}).then((function(e){for(var t in e.failures)v.splice(parseInt(t),1);d(p.length,e)}))).then((function(){return(0<y.length||o&&"object"==typeof e)&&c.mutate({trans:r,type:"put",keys:m,values:y,criteria:o,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:0<n}).then((function(e){return d(y.length,e)}))})).then((function(){return(0<v.length||o&&e===St)&&c.mutate({trans:r,type:"delete",keys:v,criteria:o,isAdditionalChunk:0<n}).then((function(e){return d(v.length,e)}))})).then((function(){return t.length>n+a&&i(n+h)}))}))}var o=mt(n)&&n.limit===1/0&&("function"!=typeof e||e===St)&&{index:n.index,range:n.range};return i(0).then((function(){if(0<p.length)throw new $("Error modifying one or more objects",p,y,m);return t.length}))}))}))},Et.prototype.delete=function(){var e=this._ctx,t=e.range;return mt(e)&&(e.isPrimKey||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;if(e.lastResult,e.results,e=e.numFailures)throw new $("Could not delete some values",Object.keys(n).map((function(e){return n[e]})),t-e);return t-e}))}))})):this.modify(St)},Et);function Et(){}var St=function(e,t){return t.value=null};function Kt(e,t){return e<t?-1:e===t?0:1}function At(e,t){return t<e?-1:e===t?0:1}function Ct(e,t,n){return(e=e instanceof Dt?new e.Collection(e):e)._ctx.error=new(n||TypeError)(t),e}function jt(e){return new e.Collection(e,(function(){return Bt("")})).limit(0)}function qt(e,t,n,r){var i,o,a,u,s,c,l,f=n.length;if(!n.every((function(e){return"string"==typeof e})))return Ct(e,et);function h(e){i="next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()},o="next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()},a="next"===e?Kt:At;var t=n.map((function(e){return{lower:o(e),upper:i(e)}})).sort((function(e,t){return a(e.lower,t.lower)}));u=t.map((function(e){return e.upper})),s=t.map((function(e){return e.lower})),l="next"===(c=e)?"":r}h("next"),(e=new e.Collection(e,(function(){return Tt(u[0],s[f-1]+r)})))._ondirectionchange=function(e){h(e)};var d=0;return e._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 m=function(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),u=-1,s=0;s<a;++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):0<=u?e.substr(0,u)+t[u]+n.substr(u+1):null;i(e[s],c)<0&&(u=s)}return a<r.length&&"next"===o?e+n.substr(e.length):a<e.length&&"prev"===o?e.substr(0,n.length):u<0?null:e.substr(0,u)+r[u]+n.substr(u+1)}(i,h,u[y],s[y],a,c);null===m&&null===p?d=y+1:(null===p||0<a(p,m))&&(p=m)}return n(null!==p?function(){e.continue(p+l)}:r),!1})),e}function Tt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Bt(e){return{type:1,lower:e,upper:e}}var Dt=(Object.defineProperty(It.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),It.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return 0<this._cmp(e,t)||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?jt(this):new this.Collection(this,(function(){return Tt(e,t,!n,!r)}))}catch(e){return Ct(this,Ze)}},It.prototype.equals=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Bt(e)}))},It.prototype.above=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Tt(e,void 0,!0)}))},It.prototype.aboveOrEqual=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Tt(e,void 0,!1)}))},It.prototype.below=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Tt(void 0,e,!1,!0)}))},It.prototype.belowOrEqual=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Tt(void 0,e)}))},It.prototype.startsWith=function(e){return"string"!=typeof e?Ct(this,et):this.between(e,e+Je,!0,!0)},It.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):qt(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],Je)},It.prototype.equalsIgnoreCase=function(e){return qt(this,(function(e,t){return e===t[0]}),[e],"")},It.prototype.anyOfIgnoreCase=function(){var e=I.apply(D,arguments);return 0===e.length?jt(this):qt(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},It.prototype.startsWithAnyOfIgnoreCase=function(){var e=I.apply(D,arguments);return 0===e.length?jt(this):qt(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,Je)},It.prototype.anyOf=function(){var e=this,t=I.apply(D,arguments),n=this._cmp;try{t.sort(n)}catch(r){return Ct(this,Ze)}if(0===t.length)return jt(this);var r=new this.Collection(this,(function(){return Tt(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 a=e.key;0<n(a,t[i]);)if(++i===t.length)return r(o),!1;return 0===n(a,t[i])||(r((function(){e.continue(t[i])})),!1)})),r},It.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},It.prototype.noneOf=function(){var e=I.apply(D,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Ct(this,Ze)}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})},It.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,a=this._min,u=this._max;if(0===e.length)return jt(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0})))return Ct(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",W.InvalidArgument);var s,c=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,f=i;function h(e,t){return f(e[0],t[0])}try{(s=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&&0<r(t[1],o[0])){o[0]=a(o[0],t[0]),o[1]=u(o[1],t[1]);break}}return n===i&&e.push(t),e}),[])).sort(h)}catch(e){return Ct(this,Ze)}var d=0,p=l?function(e){return 0<i(e,s[d][1])}:function(e){return 0<=i(e,s[d][1])},y=c?function(e){return 0<o(e,s[d][0])}:function(e){return 0<=o(e,s[d][0])},m=p;return(e=new this.Collection(this,(function(){return Tt(s[0][0],s[s.length-1][1],!c,!l)})))._ondirectionchange=function(e){f="next"===e?(m=p,i):(m=y,o),s.sort(h)},e._addAlgorithm((function(e,t,r){for(var o,a=e.key;m(a);)if(++d===s.length)return t(r),!1;return!p(o=a)&&!y(o)||(0===n._cmp(a,s[d][1])||0===n._cmp(a,s[d][0])||t((function(){f===i?e.continue(s[d][0]):e.continue(s[d][1])})),!1)})),e},It.prototype.startsWithAnyOf=function(){var e=I.apply(D,arguments);return e.every((function(e){return"string"==typeof e}))?0===e.length?jt(this):this.inAnyRange(e.map((function(e){return[e,e+Je]}))):Ct(this,"startsWithAnyOf() only works with strings")},It);function It(){}function Rt(e){return Be((function(t){return Mt(t),e(t.target.error),!1}))}function Mt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Nt="storagemutated",Ft="x-storagemutated-1",Lt=pt(null,Nt),$t=(Ut.prototype._lock=function(){return g(!be.global),++this._reculock,1!==this._reculock||be.global||(be.lockOwnerFor=this),this},Ut.prototype._unlock=function(){if(g(!be.global),0==--this._reculock)for(be.global||(be.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Qe(e[1],e[0])}catch(e){}}return this},Ut.prototype._locked=function(){return this._reculock&&be.lockOwnerFor!==this},Ut.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(g(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new W.DatabaseClosed(r);case"MissingAPIError":throw new W.MissingAPI(r.message,r);default:throw new W.OpenFailed(r)}if(!this.active)throw new W.TransactionInactive;return g(null===this._completion._state),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Be((function(n){Mt(n),t._reject(e.error)})),e.onabort=Be((function(n){Mt(n),t.active&&t._reject(new W.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=Be((function(){t.active=!1,t._resolve(),"mutatedParts"in e&&Lt.storagemutated.fire(e.mutatedParts)})),this},Ut.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return Xe(new W.ReadOnly("Transaction is readonly"));if(!this.active)return Xe(new W.TransactionInactive);if(this._locked())return new xe((function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},be])}));if(n)return Le((function(){var e=new xe((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 xe((function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return i._lib=!0,i},Ut.prototype._root=function(){return this.parent?this.parent._root():this},Ut.prototype.waitFor=function(e){var t,n=this._root(),r=xe.resolve(e);n._waitingFor?n._waitingFor=n._waitingFor.then((function(){return r})):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=e)}());var i=n._waitingFor;return new xe((function(e,t){r.then((function(t){return n._waitingQueue.push(Be(e.bind(null,t)))}),(function(e){return n._waitingQueue.push(Be(t.bind(null,e)))})).finally((function(){n._waitingFor===i&&(n._waitingFor=null)}))}))},Ut.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new W.Abort))},Ut.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 W.NotFound("Table "+e+" not part of transaction");return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n},Ut);function Ut(){}function Vt(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+zt(t)}}function zt(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Wt(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(e){return[e.name,e]},n.reduce((function(e,t,n){return(n=r(t,n))&&(e[n[0]]=n[1]),e}),{}))};var r}var Yt=function(e){try{return e.only([[]]),Yt=function(){return[[]]},[[]]}catch(e){return Yt=function(){return Je},Je}};function Qt(e){return null==e?function(){}:"string"==typeof e?1===(t=e).split(".").length?function(e){return e[t]}:function(e){return _(e,t)}:function(t){return _(t,e)};var t}function Gt(e){return[].slice.call(e)}var Ht=0;function Xt(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function Jt(e,t,n){function r(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,i=e.lowerOpen;return e=e.upperOpen,void 0===n?void 0===r?null:t.upperBound(r,!!e):void 0===r?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!e)}function i(e){var t,n=e.name;return{name:n,schema:e,mutate:function(e){var t=e.trans,i=e.type,o=e.keys,a=e.values,u=e.range;return new Promise((function(e,s){e=Be(e);var c=t.objectStore(n),l=null==c.keyPath,f="put"===i||"add"===i;if(!f&&"delete"!==i&&"deleteRange"!==i)throw new Error("Invalid operation type: "+i);var h,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 e({numFailures:0,failures:{},results:[],lastResult:void 0});function p(e){++v,Mt(e)}var y=[],m=[],v=0;if("deleteRange"===i){if(4===u.type)return e({numFailures:v,failures:m,results:[],lastResult:void 0});3===u.type?y.push(h=c.clear()):y.push(h=c.delete(r(u)))}else{var b=(l=f?l?[a,o]:[a,null]:[o,null])[0],g=l[1];if(f)for(var w=0;w<d;++w)y.push(h=g&&void 0!==g[w]?c[i](b[w],g[w]):c[i](b[w])),h.onerror=p;else for(w=0;w<d;++w)y.push(h=c[i](b[w])),h.onerror=p}function _(t){t=t.target.result,y.forEach((function(e,t){return null!=e.error&&(m[t]=e.error)})),e({numFailures:v,failures:m,results:"delete"===i?o:y.map((function(e){return e.result})),lastResult:t})}h.onerror=function(e){p(e),_(e)},h.onsuccess=_}))},getMany:function(e){var t=e.trans,r=e.keys;return new Promise((function(e,i){e=Be(e);for(var o,a=t.objectStore(n),u=r.length,s=new Array(u),c=0,l=0,f=function(t){t=t.target,s[t._pos]=t.result,++l===c&&e(s)},h=Rt(i),d=0;d<u;++d)null!=r[d]&&((o=a.get(r[d]))._pos=d,o.onsuccess=f,o.onerror=h,++c);0===c&&e(s)}))},get:function(e){var t=e.trans,r=e.key;return new Promise((function(e,i){e=Be(e);var o=t.objectStore(n).get(r);o.onsuccess=function(t){return e(t.target.result)},o.onerror=Rt(i)}))},query:(t=l,function(e){return new Promise((function(i,o){i=Be(i);var a,u,s,c=e.trans,l=e.values,f=e.limit,h=e.query,d=f===1/0?void 0:f,p=h.index;if(h=h.range,c=c.objectStore(n),p=p.isPrimaryKey?c:c.index(p.name),h=r(h),0===f)return i({result:[]});t?((d=l?p.getAll(h,d):p.getAllKeys(h,d)).onsuccess=function(e){return i({result:e.target.result})},d.onerror=Rt(o)):(a=0,u=!l&&"openKeyCursor"in p?p.openKeyCursor(h):p.openCursor(h),s=[],u.onsuccess=function(e){var t=u.result;return t?(s.push(l?t.value:t.primaryKey),++a===f?i({result:s}):void t.continue()):i({result:s})},u.onerror=Rt(o))}))}),openCursor:function(e){var t=e.trans,i=e.values,o=e.query,a=e.reverse,u=e.unique;return new Promise((function(e,s){e=Be(e);var c=o.index,l=o.range,f=t.objectStore(n),h=(f=c.isPrimaryKey?f:f.index(c.name),c=a?u?"prevunique":"prev":u?"nextunique":"next",!i&&"openKeyCursor"in f?f.openKeyCursor(r(l),c):f.openCursor(r(l),c));h.onerror=Rt(s),h.onsuccess=Be((function(n){var r,i,o,a,u=h.result;u?(u.___id=++Ht,u.done=!1,r=u.continue.bind(u),i=(i=u.continuePrimaryKey)&&i.bind(u),o=u.advance.bind(u),a=function(){throw new Error("Cursor not stopped")},u.trans=t,u.stop=u.continue=u.continuePrimaryKey=u.advance=function(){throw new Error("Cursor not started")},u.fail=Be(s),u.next=function(){var e=this,t=1;return this.start((function(){return t--?e.continue():e.stop()})).then((function(){return e}))},u.start=function(e){function t(){if(h.result)try{e()}catch(e){u.fail(e)}else u.done=!0,u.start=function(){throw new Error("Cursor behind last entry")},u.stop()}var n=new Promise((function(e,t){e=Be(e),h.onerror=Rt(t),u.fail=t,u.stop=function(t){u.stop=u.continue=u.continuePrimaryKey=u.advance=a,e(t)}}));return h.onsuccess=Be((function(e){h.onsuccess=t,t()})),u.continue=r,u.continuePrimaryKey=i,u.advance=o,t(),n},e(u)):e(null)}),s)}))},count:function(e){var t=e.query,i=e.trans,o=t.index,a=t.range;return new Promise((function(e,t){var u=i.objectStore(n),s=o.isPrimaryKey?u:u.index(o.name);(s=(u=r(a))?s.count(u):s.count()).onsuccess=Be((function(t){return e(t.target.result)})),s.onerror=Rt(t)}))}}}var o,u,s,c=(u=n,s=Gt((o=e).objectStoreNames),{schema:{name:o.name,tables:s.map((function(e){return u.objectStore(e)})).map((function(e){var t=e.keyPath,n=e.autoIncrement,r=a(t),i={};return n={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:null==t,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Qt(t)},indexes:Gt(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry;return e=e.keyPath,r={name:t,compound:a(e),keyPath:e,unique:n,multiEntry:r,extractKey:Qt(e)},i[Xt(e)]=r})),getIndexByKeyPath:function(e){return i[Xt(e)]}},i[":id"]=n.primaryKey,null!=t&&(i[Xt(t)]=n.primaryKey),n}))},hasGetAll:0<s.length&&"getAll"in u.objectStore(s[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),l=(n=c.schema,c.hasGetAll),f=(c=n.tables.map(i),{});return c.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 '".concat(e,"' not found"));return f[e]},MIN_KEY:-1/0,MAX_KEY:Yt(t),schema:n}}function Zt(e,n,r,i){var o=r.IDBKeyRange;return r.indexedDB,{dbcore:(i=Jt(n,o,i),e.dbcore.reduce((function(e,n){return n=n.create,t(t({},e),n(e))}),i))}}function en(e,t){var n=t.db;t=Zt(e._middlewares,n,e._deps,t),e.core=t.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 tn(e,t,n,r){n.forEach((function(n){var i=r[n];t.forEach((function(t){var r=function e(t,n){return y(t,n)||(t=s(t))&&e(t,n)}(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?d(t,n,{get:function(){return this.table(n)},set:function(e){h(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,i))}))}))}function nn(e,t){t.forEach((function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]}))}function rn(e,t){return e._cfg.version-t._cfg.version}function on(e,t,n,r){var i=e._dbSchema;n.objectStoreNames.contains("$meta")&&!i.$meta&&(i.$meta=Wt("$meta",dn("")[0],[]),e._storeNames.push("$meta"));var a=e._createTransaction("readwrite",e._storeNames,i);a.create(n),a._completion.catch(r);var u=a._reject.bind(a),s=be.transless||be;Le((function(){return be.trans=a,be.transless=s,0!==t?(en(e,n),c=t,((r=a).storeNames.includes("$meta")?r.table("$meta").get("version").then((function(e){return null!=e?e:c})):xe.resolve(c)).then((function(t){return i=t,u=a,s=n,c=[],t=(r=e)._versions,l=r._dbSchema=fn(0,r.idbdb,s),0!==(t=t.filter((function(e){return e._cfg.version>=i}))).length?(t.forEach((function(e){c.push((function(){var t=l,n=e._cfg.dbschema;hn(r,t,s),hn(r,n,s),l=r._dbSchema=n;var a=un(t,n);a.add.forEach((function(e){sn(s,e[0],e[1].primKey,e[1].indexes)})),a.change.forEach((function(e){if(e.recreate)throw new W.Upgrade("Not yet support for changing primary key");var t=s.objectStore(e.name);e.add.forEach((function(e){return ln(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),ln(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var c=e._cfg.contentUpgrade;if(c&&e._cfg.version>i){en(r,s),u._memoizedTables={};var f=k(n);a.del.forEach((function(e){f[e]=t[e]})),nn(r,[r.Transaction.prototype]),tn(r,[r.Transaction.prototype],o(f),f),u.schema=f;var h,d=R(c);return d&&$e(),a=xe.follow((function(){var e;(h=c(u))&&d&&(e=Ue.bind(null,null),h.then(e,e))})),h&&"function"==typeof h.then?xe.resolve(h):a.then((function(){return h}))}})),c.push((function(t){var n,i,o=e._cfg.dbschema;n=o,i=t,[].slice.call(i.db.objectStoreNames).forEach((function(e){return null==n[e]&&i.db.deleteObjectStore(e)})),nn(r,[r.Transaction.prototype]),tn(r,[r.Transaction.prototype],r._storeNames,r._dbSchema),u.schema=r._dbSchema})),c.push((function(t){r.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(r.idbdb.version/10)===e._cfg.version?(r.idbdb.deleteObjectStore("$meta"),delete r._dbSchema.$meta,r._storeNames=r._storeNames.filter((function(e){return"$meta"!==e}))):t.objectStore("$meta").put(e._cfg.version,"version"))}))})),function e(){return c.length?xe.resolve(c.shift()(u.idbtrans)).then(e):xe.resolve()}().then((function(){cn(l,s)}))):xe.resolve();var r,i,u,s,c,l})).catch(u)):(o(i).forEach((function(e){sn(n,e,i[e].primKey,i[e].indexes)})),en(e,n),void xe.follow((function(){return e.on.populate.fire(a)})).catch(u));var r,c}))}function an(e,t){cn(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=fn(0,e.idbdb,t);hn(e,e._dbSchema,t);for(var r=0,i=un(n,e._dbSchema).change;r<i.length;r++){var o=function(e){if(e.change.length||e.recreate)return console.warn("Unable to patch indexes of table ".concat(e.name," because it has changes on the type of index or primary key.")),{value:void 0};var n=t.objectStore(e.name);e.add.forEach((function(t){ie&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),ln(n,t)}))}(i[r]);if("object"==typeof o)return o.value}}function un(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 a={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto)a.recreate=!0,r.change.push(a);else{var u=i.idxByName,s=o.idxByName,c=void 0;for(c in u)s[c]||a.del.push(c);for(c in s){var l=u[c],f=s[c];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,o])}return r}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 ln(i,e)})),i}function cn(e,t){o(e).forEach((function(n){t.db.objectStoreNames.contains(n)||(ie&&console.debug("Dexie: Creating missing table",n),sn(t,n,e[n].primKey,e[n].indexes))}))}function ln(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function fn(e,t,n){var r={};return v(t.objectStoreNames,0).forEach((function(e){for(var t=n.objectStore(e),i=Vt(zt(u=t.keyPath),u||"",!0,!1,!!t.autoIncrement,u&&"string"!=typeof u,!0),o=[],a=0;a<t.indexNames.length;++a){var u=(s=t.index(t.indexNames[a])).keyPath,s=Vt(s.name,u,!!s.unique,!!s.multiEntry,!1,u&&"string"!=typeof u,!1);o.push(s)}r[e]=Wt(e,i,o)})),r}function hn(e,t,n){for(var r=n.db.objectStoreNames,o=0;o<r.length;++o){var a=r[o],u=n.objectStore(a);e._hasGetAll="getAll"in u;for(var s=0;s<u.indexNames.length;++s){var c=u.indexNames[s],l=u.index(c).keyPath,f="string"==typeof l?l:"["+v(l).join("+")+"]";!t[a]||(l=t[a].idxByName[f])&&(l.name=c,delete t[a].idxByName[f],t[a].idxByName[c]=l)}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function dn(e){return e.split(",").map((function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return Vt(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),a(r),0===t)}))}var pn=(yn.prototype._parseStoresSpec=function(e,t){o(e).forEach((function(n){if(null!==e[n]){var r=dn(e[n]),i=r.shift();if(i.unique=!0,i.multi)throw new W.Schema("Primary key cannot be multi-valued");r.forEach((function(e){if(e.auto)throw new W.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new W.Schema("Index must have a name and cannot be an empty string")})),t[n]=Wt(n,i,r)}}))},yn.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?u(this._cfg.storesSource,e):e,e=t._versions;var n={},r={};return e.forEach((function(e){u(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)})),t._dbSchema=r,nn(t,[t._allTables,t,t.Transaction.prototype]),tn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],o(r),r),t._storeNames=o(r),this},yn.prototype.upgrade=function(e){return this._cfg.contentUpgrade=re(this._cfg.contentUpgrade||G,e),this},yn);function yn(){}function mn(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new tr(nt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function vn(e){return e&&"function"==typeof e.databases}function bn(e){return Le((function(){return be.letThrough=!0,e()}))}function gn(e){return!("from"in e)}var wn=function(e,t){if(!this){var n=new wn;return e&&"d"in e&&u(n,e),n}u(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function _n(e,t,n){var r=ct(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(gn(e))return u(e,{from:t,to:n,d:1});var i=e.l;if(r=e.r,ct(n,e.from)<0)return i?_n(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Pn(e);if(0<ct(t,e.to))return r?_n(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Pn(e);ct(t,e.from)<0&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<ct(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),n=!e.r,i&&!e.l&&xn(e,i),r&&n&&xn(e,r)}}function xn(e,t){gn(t)||function e(t,n){var r=n.from,i=n.to,o=n.l;n=n.r,_n(t,r,i),o&&e(t,o),n&&e(t,n)}(e,t)}function kn(e,t){var n=On(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=On(e),a=o.next(i.from),u=a.value;!r.done&&!a.done;){if(ct(u.from,i.to)<=0&&0<=ct(u.to,i.from))return!0;ct(i.from,u.from)<0?i=(r=n.next(u.from)).value:u=(a=o.next(i.from)).value}return!1}function On(e){var t=gn(e)?null:{s:0,n:e};return{next:function(e){for(var n=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&ct(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||ct(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function Pn(e){var n,r,i=((null===(n=e.r)||void 0===n?void 0:n.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),o=1<i?"r":i<-1?"l":"";o&&(n="r"==o?"l":"r",r=t({},e),i=e[o],e.from=i.from,e.to=i.to,e[o]=i[o],r[o]=i[n],(e[n]=r).d=En(r)),e.d=En(e)}function En(e){var t=e.r;return e=e.l,(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function Sn(e,t){return o(t).forEach((function(n){e[n]?xn(e[n],t[n]):e[n]=function e(t){var n,r,i={};for(n in t)l(t,n)&&(r=t[n],i[n]=!r||"object"!=typeof r||S.has(r.constructor)?r:e(r));return i}(t[n])})),e}function Kn(e,t){return e.all||t.all||Object.keys(e).some((function(n){return t[n]&&kn(t[n],e[n])}))}f(wn.prototype,((M={add:function(e){return xn(this,e),this},addKey:function(e){return _n(this,e,e),this},addKeys:function(e){var t=this;return e.forEach((function(e){return _n(t,e,e)})),this},hasKey:function(e){var t=On(this).next(e).value;return t&&ct(t.from,e)<=0&&0<=ct(t.to,e)}})[q]=function(){return On(this)},M));var An={},Cn={},jn=!1;function qn(e){Sn(Cn,e),jn||(jn=!0,setTimeout((function(){jn=!1,Tn(Cn,!(Cn={}))}),0))}function Tn(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,i=Object.values(An);r<i.length;r++)Bn(a=i[r],e,n,t);else for(var o in e){var a,u=/^idb\:\/\/(.*)\/(.*)\//.exec(o);u&&(o=u[1],u=u[2],(a=An["idb://".concat(o,"/").concat(u)])&&Bn(a,e,n,t))}n.forEach((function(e){return e()}))}function Bn(e,t,n,r){for(var i=[],o=0,a=Object.entries(e.queries.query);o<a.length;o++){for(var u=a[o],s=u[0],c=[],l=0,f=u[1];l<f.length;l++){var h=f[l];Kn(t,h.obsSet)?h.subscribers.forEach((function(e){return n.add(e)})):r&&c.push(h)}r&&i.push([s,c])}if(r)for(var d=0,p=i;d<p.length;d++){var y=p[d];s=y[0],c=y[1],e.queries.query[s]=c}}function Dn(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((function(){return t.dbOpenError?Xe(t.dbOpenError):e}));t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,i=Math.round(10*e.verno),a=!1;function u(){if(t.openCanceller!==r)throw new W.DatabaseClosed("db.open() was cancelled")}function s(){return new xe((function(r,c){if(u(),!n)throw new W.MissingAPI;var l=e.name,d=t.autoSchema||!i?n.open(l):n.open(l,i);if(!d)throw new W.MissingAPI;d.onerror=Rt(c),d.onblocked=Be(e._fireOnBlocked),d.onupgradeneeded=Be((function(r){var i;f=d.transaction,t.autoSchema&&!e._options.allowEmptyDB?(d.onerror=Mt,f.abort(),d.result.close(),(i=n.deleteDatabase(l)).onsuccess=i.onerror=Be((function(){c(new W.NoSuchDatabase("Database ".concat(l," doesnt exist")))}))):(f.onerror=Rt(c),r=r.oldVersion>Math.pow(2,62)?0:r.oldVersion,h=r<1,e.idbdb=d.result,a&&an(e,f),on(e,r/10,f,c))}),c),d.onsuccess=Be((function(){f=null;var n,u,c,p,y,m=e.idbdb=d.result,b=v(m.objectStoreNames);if(0<b.length)try{var g=m.transaction(1===(p=b).length?p[0]:p,"readonly");if(t.autoSchema)u=m,c=g,(n=e).verno=u.version/10,c=n._dbSchema=fn(0,u,c),n._storeNames=v(u.objectStoreNames,0),tn(n,[n._allTables],o(c),c);else if(hn(e,e._dbSchema,g),((y=un(fn(0,(y=e).idbdb,g),y._dbSchema)).add.length||y.change.some((function(e){return e.add.length||e.change.length})))&&!a)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),m.close(),i=m.version+1,a=!0,r(s());en(e,g)}catch(n){}tt.push(e),m.onversionchange=Be((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),m.onclose=Be((function(t){e.on("close").fire(t)})),h&&(y=e._deps,g=l,m=y.indexedDB,y=y.IDBKeyRange,vn(m)||g===nt||mn(m,y).put({name:g}).catch(G)),r()}),c)})).catch((function(e){switch(null==e?void 0:e.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),s();break;case"VersionError":if(0<i)return i=0,s()}return xe.reject(e)}))}var c,l=t.dbReadyResolve,f=null,h=!1;return xe.race([r,("undefined"==typeof navigator?xe.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(e){function t(){return indexedDB.databases().finally(e)}c=setInterval(t,100),t()})).finally((function(){return clearInterval(c)})):Promise.resolve()).then(s)]).then((function(){return u(),t.onReadyBeingFired=[],xe.resolve(bn((function(){return e.on.ready.fire(e.vip)}))).then((function n(){if(0<t.onReadyBeingFired.length){var r=t.onReadyBeingFired.reduce(re,G);return t.onReadyBeingFired=[],xe.resolve(bn((function(){return r(e.vip)}))).then(n)}}))})).finally((function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)})).catch((function(n){t.dbOpenError=n;try{f&&f.abort()}catch(n){}return r===t.openCanceller&&e._close(),Xe(n)})).finally((function(){t.openComplete=!0,l()})).then((function(){var t;return h&&(t={},e.tables.forEach((function(n){n.schema.indexes.forEach((function(r){r.name&&(t["idb://".concat(e.name,"/").concat(n.name,"/").concat(r.name)]=new wn(-1/0,[[[]]]))})),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new wn(-1/0,[[[]]])})),Lt(Nt).fire(t),Tn(t,!0)),e}))}function In(e){function t(t){return e.next(t)}var n=i(t),r=i((function(t){return e.throw(t)}));function i(e){return function(t){var i=e(t);return t=i.value,i.done?t:t&&"function"==typeof t.then?t.then(n,r):a(t)?Promise.all(t).then(n,r):n(t)}}return i(t)()}function Rn(e,t,n){for(var r=a(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}var Mn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return t(t({},e),{table:function(n){var r=e.table(n),i=r.schema,o={},a=[];function u(e,n,r){var i=Xt(e),s=o[i]=o[i]||[],c=null==e?0:"string"==typeof e?1:e.length,l=0<n;return l=t(t({},r),{name:l?"".concat(i,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:n,keyLength:c,extractKey:Qt(e),unique:!l&&r.unique}),s.push(l),l.isPrimaryKey||a.push(l),1<c&&u(2===c?e[0]:e.slice(0,c-1),n+1,r),s.sort((function(e,t){return e.keyTail-t.keyTail})),l}n=u(i.primaryKey.keyPath,0,i.primaryKey),o[":id"]=[n];for(var s=0,c=i.indexes;s<c.length;s++){var l=c[s];u(l.keyPath,0,l)}function f(n){var r,i=n.query.index;return i.isVirtual?t(t({},n),{query:{index:i.lowLevelIndex,range:(r=n.query.range,i=i.keyTail,{type:1===r.type?2:r.type,lower:Rn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,i),lowerOpen:!0,upper:Rn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,i),upperOpen:!0})}}):n}return t(t({},r),{schema:t(t({},i),{primaryKey:n,indexes:a,getIndexByKeyPath:function(e){return(e=o[Xt(e)])&&e[0]}}),count:function(e){return r.count(f(e))},query:function(e){return r.query(f(e))},openCursor:function(t){var n=t.query.index,i=n.keyTail,o=n.isVirtual,a=n.keyLength;return o?r.openCursor(f(t)).then((function(e){return e&&u(e)})):r.openCursor(t);function u(n){return Object.create(n,{continue:{value:function(r){null!=r?n.continue(Rn(r,t.reverse?e.MAX_KEY:e.MIN_KEY,i)):t.unique?n.continue(n.key.slice(0,a).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,i)):n.continue()}},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(Rn(t,e.MAX_KEY,i),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return 1===a?e[0]:e.slice(0,a)}},value:{get:function(){return n.value}}})}}})}})}};function Nn(e,t,n,r){return n=n||{},r=r||"",o(e).forEach((function(i){var o,a,u;l(t,i)?(o=e[i],a=t[i],"object"==typeof o&&"object"==typeof a&&o&&a?(u=j(o))!==j(a)?n[r+i]=t[i]:"Object"===u?Nn(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i]):o!==a&&(n[r+i]=t[i])):n[r+i]=void 0})),o(t).forEach((function(i){l(e,i)||(n[r+i]=t[i])})),n}function Fn(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var Ln={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return t(t({},e),{table:function(n){var i=e.table(n),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=be.trans,u=a.table(n).hook,s=u.deleting,c=u.creating,f=u.updating;switch(e.type){case"add":if(c.fire===G)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"put":if(c.fire===G&&f.fire===G)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"delete":if(s.fire===G)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"deleteRange":if(s.fire===G)break;return a._promise("readwrite",(function(){return function e(n,r,a){return i.query({trans:n,values:!1,query:{index:o,range:r},limit:a}).then((function(i){var o=i.result;return h({type:"delete",keys:o,trans:n}).then((function(i){return 0<i.numFailures?Promise.reject(i.failures[0]):o.length<a?{failures:[],numFailures:0,lastResult:void 0}:e(n,t(t({},r),{lower:o[o.length-1],lowerOpen:!0}),a)}))}))}(e.trans,e.range,1e4)}),!0)}return i.mutate(e);function h(e){var n,a,u,h=be.trans,d=e.keys||Fn(o,e);if(!d)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?t(t({},e),{keys:d}):t({},e)).type&&(e.values=r([],e.values,!0)),e.keys&&(e.keys=r([],e.keys,!0)),n=i,u=d,("add"===(a=e).type?Promise.resolve([]):n.getMany({trans:a.trans,keys:u,cache:"immutable"})).then((function(t){var n=d.map((function(n,r){var i,a,u,d=t[r],p={onerror:null,onsuccess:null};return"delete"===e.type?s.fire.call(p,n,d,h):"add"===e.type||void 0===d?(i=c.fire.call(p,n,e.values[r],h),null==n&&null!=i&&(e.keys[r]=n=i,o.outbound||x(e.values[r],o.keyPath,n))):(i=Nn(d,e.values[r]),(a=f.fire.call(p,i,n,d,h))&&(u=e.values[r],Object.keys(a).forEach((function(e){l(u,e)?u[e]=a[e]:x(u,e,a[e])})))),p}));return i.mutate(e).then((function(r){for(var i=r.failures,o=r.results,a=r.numFailures,u=(r=r.lastResult,0);u<d.length;++u){var s=(o||d)[u],c=n[u];null==s?c.onerror&&c.onerror(i[u]):c.onsuccess&&c.onsuccess("put"===e.type&&t[u]?e.values[u]:s)}return{failures:i,results:o,numFailures:a,lastResult:r}})).catch((function(e){return n.forEach((function(t){return t.onerror&&t.onerror(e)})),Promise.reject(e)}))}))}}})}})}};function $n(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)0===ct(t.keys[i],e[o])&&(r.push(n?A(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch(e){return null}}var Un={stack:"dbcore",level:-1,create:function(e){return{table:function(n){var r=e.table(n);return t(t({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=$n(e.keys,e.trans._cache,"clone"===e.cache);return t?xe.resolve(t):r.getMany(e).then((function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?A(t):t},t}))},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function Vn(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function zn(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Wn={stack:"dbcore",level:0,name:"Observability",create:function(e){var n=e.schema.name,r=new wn(e.MIN_KEY,e.MAX_KEY);return t(t({},e),{transaction:function(t,n,r){if(be.subscr&&"readonly"!==n)throw new W.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(be.querier));return e.transaction(t,n,r)},table:function(i){var u=e.table(i),s=u.schema,c=s.primaryKey,l=s.indexes,f=c.extractKey,h=c.outbound,d=c.autoIncrement&&l.filter((function(e){return e.compound&&e.keyPath.includes(c.keyPath)})),p=t(t({},u),{mutate:function(t){function o(e){return e="idb://".concat(n,"/").concat(i,"/").concat(e),y[e]||(y[e]=new wn)}var l,f,h,p=t.trans,y=t.mutatedParts||(t.mutatedParts={}),m=o(""),v=o(":dels"),b=t.type,g="deleteRange"===t.type?[t.range]:"delete"===t.type?[t.keys]:t.values.length<50?[Fn(c,t).filter((function(e){return e})),t.values]:[],w=g[0],_=g[1];return g=t.trans._cache,a(w)?(m.addKeys(w),(g="delete"===b||w.length===_.length?$n(w,g):null)||v.addKeys(w),(g||_)&&(l=o,f=g,h=_,s.indexes.forEach((function(e){var t=l(e.name||"");function n(t){return null!=t?e.extractKey(t):null}function r(n){return e.multiEntry&&a(n)?n.forEach((function(e){return t.addKey(e)})):t.addKey(n)}(f||h).forEach((function(e,t){var i=f&&n(f[t]);0!==ct(i,t=h&&n(h[t]))&&(null!=i&&r(i),null!=t&&r(t))}))})))):w?(_={from:null!==(_=w.lower)&&void 0!==_?_:e.MIN_KEY,to:null!==(_=w.upper)&&void 0!==_?_:e.MAX_KEY},v.add(_),m.add(_)):(m.add(r),v.add(r),s.indexes.forEach((function(e){return o(e.name).add(r)}))),u.mutate(t).then((function(e){return!w||"add"!==t.type&&"put"!==t.type||(m.addKeys(e.results),d&&d.forEach((function(n){for(var r=t.values.map((function(e){return n.extractKey(e)})),i=n.keyPath.findIndex((function(e){return e===c.keyPath})),a=0,u=e.results.length;a<u;++a)r[a][i]=e.results[a];o(n.name).addKeys(r)}))),p.mutatedParts=Sn(p.mutatedParts||{},y),e}))}}),y=(l=function(t){t=(n=t.query).index;var n=n.range;return[t,new wn(null!==(t=n.lower)&&void 0!==t?t:e.MIN_KEY,null!==(n=n.upper)&&void 0!==n?n:e.MAX_KEY)]},{get:function(e){return[c,new wn(e.key)]},getMany:function(e){return[c,(new wn).addKeys(e.keys)]},count:l,query:l,openCursor:l});return o(y).forEach((function(e){p[e]=function(o){var a=!!(p=be.subscr),s=Vn(be,u)&&zn(e,o)?o.obsSet={}:p;if(a){var c=function(e){return e="idb://".concat(n,"/").concat(i,"/").concat(e),s[e]||(s[e]=new wn)},l=c(""),d=c(":dels"),p=(a=(p=y[e](o))[0],p[1]);if(("query"===e&&a.isPrimaryKey&&!o.values?d:c(a.name||"")).add(p),!a.isPrimaryKey){if("count"!==e){var m="query"===e&&h&&o.values&&u.query(t(t({},o),{values:!1}));return u[e].apply(this,arguments).then((function(t){if("query"===e){if(h&&o.values)return m.then((function(e){return e=e.result,l.addKeys(e),t}));var n=o.values?t.result.map(f):t.result;(o.values?l:d).addKeys(n)}else if("openCursor"===e){var r=t,i=o.values;return r&&Object.create(r,{key:{get:function(){return d.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return d.addKey(e),e}},value:{get:function(){return i&&l.addKey(r.primaryKey),r.value}}})}return t}))}d.add(r)}}return u[e].apply(this,arguments)}})),p}})}};function Yn(e,n,r){if(0===r.numFailures)return n;if("deleteRange"===n.type)return null;var i=n.keys?n.keys.length:"values"in n&&n.values?n.values.length:1;return r.numFailures===i?null:(n=t({},n),a(n.keys)&&(n.keys=n.keys.filter((function(e,t){return!(t in r.failures)}))),"values"in n&&a(n.values)&&(n.values=n.values.filter((function(e,t){return!(t in r.failures)}))),n)}function Qn(e,t){return n=e,(void 0===(r=t).lower||(r.lowerOpen?0<ct(n,r.lower):0<=ct(n,r.lower)))&&(void 0===t.upper||(t.upperOpen?ct(e,t.upper)<0:ct(e,t.upper)<=0));var n,r}function Gn(e,t,n,r,i,o){if(!n||0===n.length)return e;var u=t.query.index,s=u.multiEntry,c=t.query.range,l=r.schema.primaryKey.extractKey,f=u.extractKey,h=(u.lowLevelIndex||u).extractKey;return n=n.reduce((function(e,n){var r=e,i=[];if("add"===n.type||"put"===n.type)for(var o=new wn,u=n.values.length-1;0<=u;--u){var h,d=n.values[u],p=l(d);o.hasKey(p)||(h=f(d),(s&&a(h)?h.some((function(e){return Qn(e,c)})):Qn(h,c))&&(o.addKey(p),i.push(d)))}switch(n.type){case"add":var y=(new wn).addKeys(t.values?e.map((function(e){return l(e)})):e);r=e.concat(t.values?i.filter((function(e){return e=l(e),!y.hasKey(e)&&(y.addKey(e),!0)})):i.map((function(e){return l(e)})).filter((function(e){return!y.hasKey(e)&&(y.addKey(e),!0)})));break;case"put":var m=(new wn).addKeys(n.values.map((function(e){return l(e)})));r=e.filter((function(e){return!m.hasKey(t.values?l(e):e)})).concat(t.values?i:i.map((function(e){return l(e)})));break;case"delete":var v=(new wn).addKeys(n.keys);r=e.filter((function(e){return!v.hasKey(t.values?l(e):e)}));break;case"deleteRange":var b=n.range;r=e.filter((function(e){return!Qn(l(e),b)}))}return r}),e),n===e?e:(n.sort((function(e,t){return ct(h(e),h(t))||ct(l(e),l(t))})),t.limit&&t.limit<1/0&&(n.length>t.limit?n.length=t.limit:e.length===t.limit&&n.length<t.limit&&(i.dirty=!0)),o?Object.freeze(n):n)}function Hn(e,t){return 0===ct(e.lower,t.lower)&&0===ct(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function Xn(e,t){return function(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(t=ct(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return-1}return t}(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=function(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return-1;if(0===(t=ct(e,t))){if(n&&r)return 0;if(n)return-1;if(r)return 1}return t}(e.upper,t.upper,e.upperOpen,t.upperOpen)}function Jn(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",(function(){var r,i;e.subscribers.delete(n),0===e.subscribers.size&&(r=e,i=t,setTimeout((function(){0===r.subscribers.size&&B(i,r)}),3e3))}))}var Zn={stack:"dbcore",level:0,name:"Cache",create:function(e){var n=e.schema.name;return t(t({},e),{transaction:function(t,r,i){var o,a,u=e.transaction(t,r,i);return"readwrite"===r&&(a=(o=new AbortController).signal,i=function(i){return function(){if(o.abort(),"readwrite"===r){for(var a=new Set,s=0,c=t;s<c.length;s++){var l=c[s],f=An["idb://".concat(n,"/").concat(l)];if(f){var h=e.table(l),d=f.optimisticOps.filter((function(e){return e.trans===u}));if(u._explicit&&i&&u.mutatedParts)for(var p=0,y=Object.values(f.queries.query);p<y.length;p++)for(var m=0,v=(w=y[p]).slice();m<v.length;m++)Kn((_=v[m]).obsSet,u.mutatedParts)&&(B(w,_),_.subscribers.forEach((function(e){return a.add(e)})));else if(0<d.length){f.optimisticOps=f.optimisticOps.filter((function(e){return e.trans!==u}));for(var b=0,g=Object.values(f.queries.query);b<g.length;b++)for(var w,_,x,k=0,O=(w=g[b]).slice();k<O.length;k++)null!=(_=O[k]).res&&u.mutatedParts&&(i&&!_.dirty?(x=Object.isFrozen(_.res),x=Gn(_.res,_.req,d,h,_,x),_.dirty?(B(w,_),_.subscribers.forEach((function(e){return a.add(e)}))):x!==_.res&&(_.res=x,_.promise=xe.resolve({result:x}))):(_.dirty&&B(w,_),_.subscribers.forEach((function(e){return a.add(e)}))))}}}a.forEach((function(e){return e()}))}}},u.addEventListener("abort",i(!1),{signal:a}),u.addEventListener("error",i(!1),{signal:a}),u.addEventListener("complete",i(!0),{signal:a})),u},table:function(r){var i=e.table(r),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=be.trans;if(o.outbound||"disabled"===a.db._options.cache||a.explicit||"readwrite"!==a.idbtrans.mode)return i.mutate(e);var u=An["idb://".concat(n,"/").concat(r)];return u?(a=i.mutate(e),"add"!==e.type&&"put"!==e.type||!(50<=e.values.length||Fn(o,e).some((function(e){return null==e})))?(u.optimisticOps.push(e),e.mutatedParts&&qn(e.mutatedParts),a.then((function(t){0<t.numFailures&&(B(u.optimisticOps,e),(t=Yn(0,e,t))&&u.optimisticOps.push(t),e.mutatedParts&&qn(e.mutatedParts))})),a.catch((function(){B(u.optimisticOps,e),e.mutatedParts&&qn(e.mutatedParts)}))):a.then((function(n){var r=Yn(0,t(t({},e),{values:e.values.map((function(e,r){var i;return n.failures[r]||x(e=null!==(i=o.keyPath)&&void 0!==i&&i.includes(".")?A(e):t({},e),o.keyPath,n.results[r]),e}))}),n);u.optimisticOps.push(r),queueMicrotask((function(){return e.mutatedParts&&qn(e.mutatedParts)}))})),a):i.mutate(e)},query:function(e){if(!Vn(be,i)||!zn("query",e))return i.query(e);var t="immutable"===(null===(u=be.trans)||void 0===u?void 0:u.db._options.cache),o=(c=be).requery,a=c.signal,u=function(e,t,n,r){var i=An["idb://".concat(e,"/").concat(t)];if(!i)return[];if(!(t=i.queries[n]))return[null,!1,i,null];var o=t[(r.query?r.query.index.name:null)||""];if(!o)return[null,!1,i,null];switch(n){case"query":var a=o.find((function(e){return e.req.limit===r.limit&&e.req.values===r.values&&Hn(e.req.query.range,r.query.range)}));return a?[a,!0,i,o]:[o.find((function(e){return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(!r.values||e.req.values)&&Xn(e.req.query.range,r.query.range)})),!1,i,o];case"count":return a=o.find((function(e){return Hn(e.req.query.range,r.query.range)})),[a,!!a,i,o]}}(n,r,"query",e),s=u[0],c=u[1],l=u[2],f=u[3];return s&&c?s.obsSet=e.obsSet:(c=i.query(e).then((function(e){var n=e.result;if(s&&(s.res=n),t){for(var r=0,i=n.length;r<i;++r)Object.freeze(n[r]);Object.freeze(n)}else e.result=A(n);return e})).catch((function(e){return f&&s&&B(f,s),Promise.reject(e)})),s={obsSet:e.obsSet,promise:c,subscribers:new Set,type:"query",req:e,dirty:!1},f?f.push(s):(f=[s],(l=l||(An["idb://".concat(n,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[e.query.index.name||""]=f)),Jn(s,f,o,a),s.promise.then((function(n){return{result:Gn(n.result,e,null==l?void 0:l.optimisticOps,i,s,t)}}))}})}})}};function er(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var tr=(nr.prototype.version=function(e){if(isNaN(e)||e<.1)throw new W.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new W.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(rn),n.stores({}),this._state.autoSchema=!1,n)},nr.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||be.letThrough||this._vip)?e():new xe((function(e,n){if(t._state.openComplete)return n(new W.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new W.DatabaseClosed);t.open().catch(G)}t._state.dbReadyPromise.then(e,n)})).then(e)},nr.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;return i&&this.unuse({stack:t,name:i}),(e=this._middlewares[t]||(this._middlewares[t]=[])).push({stack:t,create:n,level:null==r?10:r,name:i}),e.sort((function(e,t){return e.level-t.level})),this},nr.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},nr.prototype.open=function(){var e=this;return Qe(ve,(function(){return Dn(e)}))},nr.prototype._close=function(){var e=this._state,t=tt.indexOf(this);if(0<=t&&tt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(t){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new xe((function(t){e.dbReadyResolve=t})),e.openCanceller=new xe((function(t,n){e.cancelOpen=n})))},nr.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen;e=this._state,t?(e.isBeingOpened&&e.cancelOpen(new W.DatabaseClosed),this._close(),e.autoOpen=!1,e.dbOpenError=new W.DatabaseClosed):(this._close(),e.autoOpen=this._options.autoOpen||e.isBeingOpened,e.openComplete=!1,e.dbOpenError=null)},nr.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=0<arguments.length&&"object"!=typeof arguments[0],r=this._state;return new xe((function(i,o){function a(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=Be((function(){var e,n,r;e=t._deps,n=t.name,r=e.indexedDB,e=e.IDBKeyRange,vn(r)||n===nt||mn(r,e).delete(n).catch(G),i()})),n.onerror=Rt(o),n.onblocked=t._fireOnBlocked}if(n)throw new W.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()}))},nr.prototype.backendDB=function(){return this.idbdb},nr.prototype.isOpen=function(){return null!==this.idbdb},nr.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},nr.prototype.hasFailed=function(){return null!==this._state.dbOpenError},nr.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(nr.prototype,"tables",{get:function(){var e=this;return o(this._allTables).map((function(t){return e._allTables[t]}))},enumerable:!1,configurable:!0}),nr.prototype.transaction=function(){var e=function(e,t,n){var r=arguments.length;if(r<2)throw new W.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]}.apply(this,arguments);return this._transaction.apply(this,e)},nr.prototype._transaction=function(e,t,n){var r=this,i=be.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,a,u=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map((function(e){if("string"!=typeof(e=e instanceof r.Table?e.name:e))throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e})),"r"==e||e===rt)o=rt;else{if("rw"!=e&&e!=it)throw new W.InvalidArgument("Invalid transaction mode: "+e);o=it}if(i){if(i.mode===rt&&o===it){if(!u)throw new W.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&a.forEach((function(e){if(i&&-1===i.storeNames.indexOf(e)){if(!u)throw new W.SubTransaction("Table "+e+" not included in parent transaction.");i=null}})),u&&i&&!i.active&&(i=null)}}catch(n){return i?i._promise(null,(function(e,t){t(n)})):Xe(n)}var s=function e(t,n,r,i,o){return xe.resolve().then((function(){var a=be.transless||be,u=t._createTransaction(n,r,t._dbSchema,i);if(u.explicit=!0,a={trans:u,transless:a},i)u.idbtrans=i.idbtrans;else try{u.create(),u.idbtrans._explicit=!0,t._state.PR1398_maxLoop=3}catch(a){return a.name===V.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,null,o)}))):Xe(a)}var s,c=R(o);return c&&$e(),a=xe.follow((function(){var e;(s=o.call(u,u))&&(c?(e=Ue.bind(null,null),s.then(e,e)):"function"==typeof s.next&&"function"==typeof s.throw&&(s=In(s)))}),a),(s&&"function"==typeof s.then?xe.resolve(s).then((function(e){return u.active?e:Xe(new W.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):a.then((function(){return s}))).then((function(e){return i&&u._resolve(),u._completion.then((function(){return e}))})).catch((function(e){return u._reject(e),Xe(e)}))}))}.bind(null,this,o,a,i,n);return i?i._promise(o,s,"lock"):be.trans?Qe(be.transless,(function(){return r._whenReady(s)})):this._whenReady(s)},nr.prototype.table=function(e){if(!l(this._allTables,e))throw new W.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},nr);function nr(e,n){var r=this;this._middlewares={},this.verno=0;var i=nr.dependencies;this._options=n=t({addons:nr.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange,cache:"cloned"},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},i=n.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var o,a,u,s,c,l={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:G,dbReadyPromise:null,cancelOpen:G,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:n.autoOpen};l.dbReadyPromise=new xe((function(e){l.dbReadyResolve=e})),l.openCanceller=new xe((function(e,t){l.cancelOpen=t})),this._state=l,this.name=e,this.on=pt(this,"populate","blocked","versionchange","close",{ready:[re,G]}),this.on.ready.subscribe=b(this.on.ready.subscribe,(function(e){return function(t,n){nr.vip((function(){var i,o=r._state;o.openComplete?(o.dbOpenError||xe.resolve().then(t),n&&e(t)):o.onReadyBeingFired?(o.onReadyBeingFired.push(t),n&&e(t)):(e(t),i=r,n||e((function e(){i.on.ready.unsubscribe(t),i.on.ready.unsubscribe(e)})))}))}})),this.Collection=(o=this,yt(Pt.prototype,(function(e,t){this.db=o;var n=at,r=null;if(t)try{n=t()}catch(e){r=e}var i=e._ctx;e=(t=i.table).hook.reading.fire,this._ctx={table:t,index:i.index,isPrimKey:!i.index||t.schema.primKey.keyPath&&i.index===t.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:e!==H?e:null}}))),this.Table=(a=this,yt(ht.prototype,(function(e,t,n){this.db=a,this._tx=n,this.name=e,this.schema=t,this.hook=a._allTables[e]?a._allTables[e].hook:pt(null,{creating:[Z,G],reading:[X,H],updating:[te,G],deleting:[ee,G]})}))),this.Transaction=(u=this,yt($t.prototype,(function(e,t,n,r,i){var o=this;this.db=u,this.mode=e,this.storeNames=t,this.schema=n,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=pt(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 xe((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(),Xe(e)}))}))),this.Version=(s=this,yt(pn.prototype,(function(e){this.db=s,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))),this.WhereClause=(c=this,yt(Dt.prototype,(function(e,t,n){if(this.db=c,this._ctx={table:e,index:":id"===t?null:t,or:n},this._cmp=this._ascending=ct,this._descending=function(e,t){return ct(t,e)},this._max=function(e,t){return 0<ct(e,t)?e:t},this._min=function(e,t){return ct(e,t)<0?e:t},this._IDBKeyRange=c._deps.IDBKeyRange,!this._IDBKeyRange)throw new W.MissingAPI}))),this.on("versionchange",(function(e){0<e.newVersion?console.warn("Another connection wants to upgrade database '".concat(r.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(r.name,"'. Closing db now to resume the delete request.")),r.close({disableAutoOpen:!1})})),this.on("blocked",(function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('".concat(r.name,"') was blocked")):console.warn("Upgrade '".concat(r.name,"' blocked by other connection holding version ").concat(e.oldVersion/10))})),this._maxKey=Yt(n.IDBKeyRange),this._createTransaction=function(e,t,n,i){return new r.Transaction(e,t,n,r._options.chromeTransactionDurability,i)},this._fireOnBlocked=function(e){r.on("blocked").fire(e),tt.filter((function(e){return e.name===r.name&&e!==r&&!e._state.vcFired})).map((function(t){return t.on("versionchange").fire(e)}))},this.use(Un),this.use(Zn),this.use(Wn),this.use(Mn),this.use(Ln);var f=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return er(r.table(e),f)};var i=Reflect.get(e,t,n);return i instanceof ht?er(i,f):"tables"===t?i.map((function(e){return er(e,f)})):"_createTransaction"===t?function(){return er(i.apply(this,arguments),f)}:i}});this.vip=f,i.forEach((function(e){return e(r)}))}M="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";var rr,ir=(or.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},or.prototype[M]=function(){return this},or);function or(e){this._subscribe=e}try{rr={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch(E){rr={indexedDB:null,IDBKeyRange:null}}function ar(e){var t,n=!1,r=new ir((function(r){var i,o=R(e),a=!1,u={},s={},c={get closed(){return a},unsubscribe:function(){a||(a=!0,i&&i.abort(),f&&Lt.storagemutated.unsubscribe(d))}};r.start&&r.start(c);var f=!1,h=function(){return He(p)},d=function(e){Sn(u,e),Kn(s,u)&&h()},p=function(){var c,p,y;!a&&rr.indexedDB&&(u={},c={},i&&i.abort(),i=new AbortController,y=function(t){var n=Ce();try{o&&$e();var r=Le(e,t);return r=o?r.finally(Ue):r}finally{n&&je()}}(p={subscr:c,signal:i.signal,requery:h,querier:e,trans:null}),Promise.resolve(y).then((function(e){n=!0,t=e,a||p.signal.aborted||(u={},function(e){for(var t in e)if(l(e,t))return;return 1}(s=c)||f||(Lt(Nt,d),f=!0),He((function(){return!a&&r.next&&r.next(e)})))}),(function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||a||He((function(){a||r.error&&r.error(e)}))})))};return setTimeout(h,0),c}));return r.hasValue=function(){return n},r.getValue=function(){return t},r}var ur=tr;function sr(e){var t=lr;try{lr=!0,Lt.storagemutated.fire(e),Tn(e,!0)}finally{lr=t}}f(ur,t(t({},Q),{delete:function(e){return new ur(e,{addons:[]}).delete()},exists:function(e){return new ur(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){try{return n=(t=ur.dependencies).indexedDB,t=t.IDBKeyRange,(vn(n)?Promise.resolve(n.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==nt}))})):mn(n,t).toCollection().primaryKeys()).then(e)}catch(e){return Xe(new W.MissingAPI)}var t,n},defineClass:function(){return function(e){u(this,e)}},ignoreTransaction:function(e){return be.trans?Qe(be.transless,e):e()},vip:bn,async:function(e){return function(){try{var t=In(e.apply(this,arguments));return t&&"function"==typeof t.then?t:xe.resolve(t)}catch(t){return Xe(t)}}},spawn:function(e,t,n){try{var r=In(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:xe.resolve(r)}catch(e){return Xe(e)}},currentTransaction:{get:function(){return be.trans||null}},waitFor:function(e,t){return t=xe.resolve("function"==typeof e?ur.ignoreTransaction(e):e).timeout(t||6e4),be.trans?be.trans.waitFor(t):t},Promise:xe,debug:{get:function(){return ie},set:function(e){oe(e)}},derive:p,extend:u,props:f,override:b,Events:pt,on:Lt,liveQuery:ar,extendObservabilitySet:Sn,getByKeyPath:_,setByKeyPath:x,delByKeyPath:function(e,t){"string"==typeof t?x(e,t,void 0):"length"in t&&[].map.call(t,(function(t){x(e,t,void 0)}))},shallowClone:k,deepClone:A,getObjectDiff:Nn,cmp:ct,asap:w,minKey:-1/0,addons:[],connections:tt,errnames:V,dependencies:rr,cache:An,semVer:"4.0.10",version:"4.0.10".split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)}))})),ur.maxKey=Yt(ur.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(Lt(Nt,(function(e){lr||(e=new CustomEvent(Ft,{detail:e}),lr=!0,dispatchEvent(e),lr=!1)})),addEventListener(Ft,(function(e){e=e.detail,lr||sr(e)})));var cr,lr=!1,fr=function(){};return"undefined"!=typeof BroadcastChannel&&((fr=function(){(cr=new BroadcastChannel(Ft)).onmessage=function(e){return e.data&&sr(e.data)}})(),"function"==typeof cr.unref&&cr.unref(),Lt(Nt,(function(e){lr||cr.postMessage(e)}))),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",(function(e){if(!tr.disableBfCache&&e.persisted){ie&&console.debug("Dexie: handling persisted pagehide"),null!=cr&&cr.close();for(var t=0,n=tt;t<n.length;t++)n[t].close({disableAutoOpen:!1})}})),addEventListener("pageshow",(function(e){!tr.disableBfCache&&e.persisted&&(ie&&console.debug("Dexie: handling persisted pageshow"),fr(),sr({all:new wn(-1/0,[[]])}))}))),xe.rejectionMapper=function(e,t){return!e||e instanceof F||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Y[e.name]?e:(t=new Y[e.name](t||e.message,e),"stack"in e&&d(t,"stack",{get:function(){return this.inner.stack}}),t)},oe(ie),t(tr,Object.freeze({__proto__:null,Dexie:tr,liveQuery:ar,Entity:st,cmp:ct,PropModSymbol:E,PropModification:kt,replacePrefix:function(e,t){return new kt({replacePrefix:[e,t]})},add:function(e){return new kt({add:e})},remove:function(e){return new kt({remove:e})},default:tr,RangeSet:wn,mergeRanges:xn,rangesOverlap:kn}),{default:tr}),tr}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(744);const t=Symbol.for("Dexie"),r=globalThis[t]||(globalThis[t]=e);if(e.semVer!==r.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${e.semVer} and ${r.semVer}`);const{liveQuery:i,mergeRanges:o,rangesOverlap:a,RangeSet:u,cmp:s,Entity:c,PropModSymbol:l,PropModification:f,replacePrefix:h,add:d,remove:p}=r;class y{constructor(e,t,n){this.name=e,this.table=t,this.keys=n}database(){const e=new r(this.name);let t=1;for(let n of this.keys)e.version(t).stores({[this.table]:n}),t++;return e}async save(e){const t=this.database();await t[this.table].bulkPut(e).then((()=>{t.close()})).catch((e=>{throw console.error("Error in db.save",e),e}))}async read(e="name"){const t=this.database();return await t[this.table].orderBy(e).toArray().then((e=>(t.close(),e))).catch((e=>{throw console.error("Error in db.read",errerr),e}))}async getFirstRow(){const e=this.database();return await e[this.table].orderBy(":id").first().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.getFirstRow",e),e}))}async delete(){const e=new r(this.name);await e.delete().then((()=>{e.close()})).catch((e=>{throw console.warn("Error in db.delete",e),e}))}async count(){const e=this.database();return await e[this.table].count().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.count",e),e}))}async getVersion(){return await new r(this.name).open().then((e=>{const t=e.verno;return e.close(),t})).catch((e=>{throw console.error("Error in db.getVersion",e),e}))}}const m=window.wp.apiFetch;var v=n.n(m);async function b(e,t){try{await v().use(v().createNonceMiddleware(pluginAllSitesMenu.nonce));const n=await v()({url:pluginAllSitesMenu.restURL,method:"POST",data:{offset:t}}).catch((e=>{throw console.error("Error in apiFetch",e),e}));"success"===n.response&&(t+=pluginAllSitesMenu.loadincrements,e.save(n.data),await b(e,t))}catch(e){throw console.error("Error in loadSites",e),e}}function g(e,t){if(!e)return;e.classList&&e.classList.add?e.classList.add(t):_(e,t)||(e.className&&(e.className+=" "),e.className+=t);let n=e.getBoundingClientRect().top,r=e.querySelector(".ab-submenu");r.style.top=n-6+"px",r.getBoundingClientRect().bottom>window.innerHeight&&(r.style.top="auto",r.style.bottom="0")}function w(e,t){let n,r;if(e||_(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=` ${t} `,r=` ${e.className} `;r.indexOf(n)>-1;)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function _(e,t){let n;return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&(n=e.className.split(" "),n.indexOf(t)>-1))}const x=window.wp.i18n;document.addEventListener("DOMContentLoaded",(async()=>{if(!document.getElementById("wpadminbar"))return;const e={load:document.querySelector("#wp-admin-bar-load-more"),menu:document.querySelector("#wp-admin-bar-my-sites-list"),timestamp:document.querySelector("#load-more-timestamp")};!0===pluginAllSitesMenu.displaySearch&&function(){const e=document.querySelector("#all-sites-search-text");null!==e&&e.addEventListener("keyup",(e=>{e.preventDefault();const t=e.target.value.toUpperCase(),n=document.querySelector("#wp-admin-bar-my-sites-list").getElementsByClassName("menupop");for(let e=0;e<n.length;e++){let r=n[e].querySelector(".ab-item");(r.textContent||r.innerText).toUpperCase().indexOf(t)>-1?n[e].style.display="":n[e].style.display="none"}}))}();const t=new y("allsites","sites",["id,name,url","id,name,url,timestamp"]);var n;n=e.menu,new IntersectionObserver((e=>{e.forEach((e=>{const t=e.boundingClientRect,n=t.bottom<window.innerHeight&&t.bottom;if(window.matchMedia("(min-width: 783px)").matches){const e=document.querySelector("#wp-admin-bar-my-sites>.ab-sub-wrapper");n?(e.style.height="",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="0"):(e.style.height="calc(100vh - 32px)",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="32px")}}))}),{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]}).observe(n),await async function(e){const t=await e.getFirstRow();void 0!==t&&void 0!==t.timestamp&&pluginAllSitesMenu.timestamp>t.timestamp&&await e.delete();0===await e.count()&&b(e,0)}(t);const r=function(e,t){const n=new IntersectionObserver((n=>{n.forEach((e=>{const{isIntersecting:n}=e;n&&t()}),{root:e})}));return n.observe(e),n}(e.load,(async()=>{const n=(await t.read(pluginAllSitesMenu.orderBy)).reduce(((e,t)=>e+function(e){return`\n\t\t\t\t<li id="wp-admin-bar-${e.id}" class="menupop">\n\t\t\t\t<a class="ab-item" aria-haspopup="true" href="${e.admin}/"><span class="wp-admin-bar-arrow" aria-hidden="true"></span>\n\t\t\t\t\t${e.title}\n\t\t\t\t</a>\n\t\t\t\t<div class="ab-sub-wrapper">\n\t\t\t\t\t<ul id="wp-admin-bar-${e.id}-default" class="ab-submenu">\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-d"><a class="ab-item"\thref="${e.admin}">${(0,x.__)("Dashboard","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-n"><a class="ab-item" href="${e.admin}/post-new.php">${(0,x.__)("New Post","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-o"><a class="ab-item" href="${e.admin}/post-new.php?post_type=page">${(0,x.__)("New Page","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-c"><a class="ab-item" href="${e.admin}/edit-comments.php">${(0,x.__)("Manage Comments","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-u"><a class="ab-item" href="${e.admin}/users.php">${(0,x.__)("Users","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-p"><a class="ab-item" href="${e.admin}/plugins.php">${(0,x.__)("Plugins","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-s"><a class="ab-item" href="${e.admin}/options-general.php">${(0,x.__)("Settings","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-v"><a class="ab-item" href="${e.url}/">${(0,x.__)("Visit","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t`}(t)),"");e.load.insertAdjacentHTML("beforeBegin",n),function(){const e=document.getElementById("wp-admin-bar-my-sites-list");e&&(e.addEventListener("mouseenter",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&g(e.target,"hover")}),{capture:!0}),e.addEventListener("mouseleave",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&w(e.target,"hover")}),{capture:!0}),e.addEventListener("keydown",(e=>{"Tab"===e.key&&(e.preventDefault(),e.target.classList.contains("menupop")&&toggleClass(e.target,"hover"))}),{capture:!0}))}(),e.load.style.display="none",r.unobserve(e.load)}))}))})()})(); -
super-admin-all-sites-menu/tags/1.6.9/readme.txt
r3036551 r3207453 1 1 === Super Admin All Sites Menu === 2 Stable tag: 1.6. 72 Stable tag: 1.6.9 3 3 Requires at least: 5.6 4 Tested up to: 6. 44 Tested up to: 6.7 5 5 Requires PHP: 7.3 6 6 License: GPL v2 or later … … 101 101 == Changelog == 102 102 103 = 1.6.9 = 104 105 - Update dependencies 106 107 = 1.6.8 = 108 109 - Update dependencies 110 103 111 = 1.6.7 = 104 112 -
super-admin-all-sites-menu/tags/1.6.9/super-admin-all-sites-menu.php
r3036551 r3207453 13 13 * GitHub Plugin URI: https://github.com/soderlind/super-admin-all-sites-menu 14 14 * Description: For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu. 15 * Version: 1.6. 715 * Version: 1.6.9 16 16 * Author: Per Soderlind 17 17 * Network: true … … 439 439 ); 440 440 441 wp_add_inline_script( 'super-admin-all-sites-menu', "const pluginAllSitesMenu = ${data};", 'before' );441 wp_add_inline_script( 'super-admin-all-sites-menu', "const pluginAllSitesMenu = {$data};", 'before' ); 442 442 wp_set_script_translations( 'super-admin-all-sites-menu', 'super-admin-all-sites-menu' ); 443 443 } -
super-admin-all-sites-menu/trunk/build/index.asset.php
r3036551 r3207453 1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => ' 83258dff0f23c505ee1c');1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => '9878ba2245702b087402'); -
super-admin-all-sites-menu/trunk/build/index.js
r3036551 r3207453 1 1 /*! 2 2 * super-admin-all-sites-menu 3 * version: 1.6. 73 * version: 1.6.9 4 4 * address: https://github.com/soderlind/super-admin-all-sites-menu#readme 5 5 * author: Per Søderlind 6 6 * license: GPLv2 7 */(()=>{ "use strict";var e={};e.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,n=Object.keys,r=Array.isArray;function s(e,t){return"object"!=typeof t||n(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||t.Promise||(t.Promise=Promise);const i=Object.getPrototypeOf,o={}.hasOwnProperty;function a(e,t){return o.call(e,t)}function l(e,t){"function"==typeof t&&(t=t(i(e))),("undefined"==typeof Reflect?n:Reflect.ownKeys)(t).forEach((n=>{c(e,n,t[n])}))}const u=Object.defineProperty;function c(e,t,n,r){u(e,t,s(n&&a(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function h(e){return{from:function(t){return e.prototype=Object.create(t.prototype),c(e.prototype,"constructor",e),{extend:l.bind(null,e.prototype)}}}}const d=Object.getOwnPropertyDescriptor;function f(e,t){let n;return d(e,t)||(n=i(e))&&f(n,t)}const p=[].slice;function y(e,t,n){return p.call(e,t,n)}function m(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function g(e){t.setImmediate?setImmediate(e):setTimeout(e,0)}function v(e,t){return e.reduce(((e,n,r)=>{var s=t(n,r);return s&&(e[s[0]]=s[1]),e}),{})}function w(e,t){if("string"==typeof t&&a(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,s=t.length;r<s;++r){var i=w(e,t[r]);n.push(i)}return n}var o=t.indexOf(".");if(-1!==o){var l=e[t.substr(0,o)];return void 0===l?void 0:w(l,t.substr(o+1))}}function _(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 s=0,i=t.length;s<i;++s)_(e,t[s],n[s])}else{var o=t.indexOf(".");if(-1!==o){var l=t.substr(0,o),u=t.substr(o+1);if(""===u)void 0===n?r(e)&&!isNaN(parseInt(l))?e.splice(l,1):delete e[l]:e[l]=n;else{var c=e[l];c&&a(e,l)||(c=e[l]={}),_(c,u,n)}}else void 0===n?r(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function x(e){var t={};for(var n in e)a(e,n)&&(t[n]=e[n]);return t}const k=[].concat;function E(e){return k.apply([],e)}const P="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(E([8,16,32,64].map((e=>["Int","Uint","Float"].map((t=>t+e+"Array")))))).filter((e=>t[e])),S=P.map((e=>t[e]));v(P,(e=>[e,!0]));let K=null;function O(e){K="undefined"!=typeof WeakMap&&new WeakMap;const t=A(e);return K=null,t}function A(e){if(!e||"object"!=typeof e)return e;let t=K&&K.get(e);if(t)return t;if(r(e)){t=[],K&&K.set(e,t);for(var n=0,s=e.length;n<s;++n)t.push(A(e[n]))}else if(S.indexOf(e.constructor)>=0)t=e;else{const n=i(e);for(var o in t=n===Object.prototype?{}:Object.create(n),K&&K.set(e,t),e)a(e,o)&&(t[o]=A(e[o]))}return t}const{toString:C}={};function j(e){return C.call(e).slice(8,-1)}const B="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",D="symbol"==typeof B?function(e){var t;return null!=e&&(t=e[B])&&t.apply(e)}:function(){return null},I={};function T(e){var t,n,s,i;if(1===arguments.length){if(r(e))return e.slice();if(this===I&&"string"==typeof e)return[e];if(i=D(e)){for(n=[];!(s=i.next()).done;)n.push(s.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}const R="undefined"!=typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var M="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function F(e,t){M=e,N=t}var N=()=>!0;const q=!new Error("").stack;function $(){if(q)try{throw $.arguments,new Error}catch(e){return e}return new Error}function L(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(N).map((e=>"\n"+e)).join("")):""}var U=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],V=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(U),W={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function Y(e,t){this._e=$(),this.name=e,this.message=t}function z(e,t){return e+". Errors: "+Object.keys(t).map((e=>t[e].toString())).filter(((e,t,n)=>n.indexOf(e)===t)).join("\n")}function H(e,t,n,r){this._e=$(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=z(e,t)}function G(e,t){this._e=$(),this.name="BulkError",this.failures=Object.keys(t).map((e=>t[e])),this.failuresByPos=t,this.message=z(e,t)}h(Y).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+L(this._e,2))}},toString:function(){return this.name+": "+this.message}}),h(H).from(Y),h(G).from(Y);var Q=V.reduce(((e,t)=>(e[t]=t+"Error",e)),{});const X=Y;var J=V.reduce(((e,t)=>{var n=t+"Error";function r(e,r){this._e=$(),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=W[t]||n,this.inner=null)}return h(r).from(X),e[t]=r,e}),{});J.Syntax=SyntaxError,J.Type=TypeError,J.Range=RangeError;var Z=U.reduce(((e,t)=>(e[t+"Error"]=J[t],e)),{}),ee=V.reduce(((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=J[t]),e)),{});function te(){}function ne(e){return e}function re(e,t){return null==e||e===ne?t:function(n){return t(e(n))}}function se(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ie(e,t){return e===te?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?se(r,this.onsuccess):r),s&&(this.onerror=this.onerror?se(s,this.onerror):s),void 0!==i?i:n}}function oe(e,t){return e===te?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?se(n,this.onsuccess):n),r&&(this.onerror=this.onerror?se(r,this.onerror):r)}}function ae(e,t){return e===te?t:function(n){var r=e.apply(this,arguments);s(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?se(i,this.onsuccess):i),o&&(this.onerror=this.onerror?se(o,this.onerror):o),void 0===r?void 0===a?void 0:a:s(r,a)}}function le(e,t){return e===te?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function ue(e,t){return e===te?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,s=arguments.length,i=new Array(s);s--;)i[s]=arguments[s];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}ee.ModifyError=H,ee.DexieError=Y,ee.BulkError=G;var ce={};const he=100,[de,fe,pe]="undefined"==typeof Promise?[]:(()=>{let e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,i(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,i(t),e]})(),ye=fe&&fe.then,me=de&&de.constructor,be=!!pe;var ge=!1,ve=pe?()=>{pe.then(Le)}:t.setImmediate?setImmediate.bind(null,Le):t.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver((()=>{Le(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Le,0)},we=function(e,t){Ae.push([e,t]),xe&&(ve(),xe=!1)},_e=!0,xe=!0,ke=[],Ee=[],Pe=null,Se=ne,Ke={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ft,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((e=>{try{ft(e[0],e[1])}catch(e){}}))}},Oe=Ke,Ae=[],Ce=0,je=[];function Be(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=te,this._lib=!1;var t=this._PSD=Oe;if(M&&(this._stackHolder=$(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ce)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Re(this,this._value))}this._state=null,this._value=null,++t.ref,Te(this,e)}const De={get:function(){var e=Oe,t=Je;function n(n,r){var s=!e.global&&(e!==Oe||t!==Je);const i=s&&!nt();var o=new Be(((t,o)=>{Fe(this,new Ie(ct(n,e,s,i),ct(r,e,s,i),t,o,e))}));return M&&$e(o,this),o}return n.prototype=ce,n},set:function(e){c(this,"then",e&&e.prototype===ce?De:{get:function(){return e},set:De.set})}};function Ie(e,t,n,r,s){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=s}function Te(e,t){try{t((t=>{if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ue();t&&"function"==typeof t.then?Te(e,((e,n)=>{t instanceof Be?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Me(e)),n&&Ve()}}),Re.bind(null,e))}catch(t){Re(e,t)}}function Re(e,t){if(Ee.push(t),null===e._state){var n=e._lib&&Ue();t=Se(t),e._state=!1,e._value=t,M&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,void 0)}catch(e){}}((()=>{var n=f(t,"stack");t._promise=e,c(t,"stack",{get:()=>ge?n&&(n.get?n.get.apply(t):n.value):e.stack})})),function(e){ke.some((t=>t._value===e._value))||ke.push(e)}(e),Me(e),n&&Ve()}}function Me(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Fe(e,t[n]);var s=e._PSD;--s.ref||s.finalize(),0===Ce&&(++Ce,we((()=>{0==--Ce&&We()}),[]))}function Fe(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,we(Ne,[n,e,t])}else e._listeners.push(t)}function Ne(e,t,n){try{Pe=t;var r,s=t._value;t._state?r=e(s):(Ee.length&&(Ee=[]),r=e(s),-1===Ee.indexOf(s)&&function(e){for(var t=ke.length;t;)if(ke[--t]._value===e._value)return void ke.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Pe=null,0==--Ce&&We(),--n.psd.ref||n.psd.finalize()}}function qe(e,t,n){if(t.length===n)return t;var r="";if(!1===e._state){var s,i,o=e._value;null!=o?(s=o.name||"Error",i=o.message||o,r=L(o,0)):(s=o,i=""),t.push(s+(i?": "+i:"")+r)}return M&&((r=L(e._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),e._prev&&qe(e._prev,t,n)),t}function $e(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Le(){Ue()&&Ve()}function Ue(){var e=_e;return _e=!1,xe=!1,e}function Ve(){var e,t,n;do{for(;Ae.length>0;)for(e=Ae,Ae=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Ae.length>0);_e=!0,xe=!0}function We(){var e=ke;ke=[],e.forEach((e=>{e._PSD.onunhandled.call(null,e._value,e)}));for(var t=je.slice(0),n=t.length;n;)t[--n]()}function Ye(e){return new Be(ce,!1,e)}function ze(e,t){var n=Oe;return function(){var r=Ue(),s=Oe;try{return ot(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{ot(s,!1),r&&Ve()}}}l(Be.prototype,{then:De,_then:function(e,t){Fe(this,new Ie(null,null,e,t,Oe))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,(e=>e instanceof t?n(e):Ye(e))):this.then(null,(e=>e&&e.name===t?n(e):Ye(e)))},finally:function(e){return this.then((t=>(e(),t)),(t=>(e(),Ye(t))))},stack:{get:function(){if(this._stack)return this._stack;try{ge=!0;var e=qe(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{ge=!1}}},timeout:function(e,t){return e<1/0?new Be(((n,r)=>{var s=setTimeout((()=>r(new J.Timeout(t))),e);this.then(n,r).finally(clearTimeout.bind(null,s))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&c(Be.prototype,Symbol.toStringTag,"Dexie.Promise"),Ke.env=at(),l(Be,{all:function(){var e=T.apply(null,arguments).map(rt);return new Be((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(((s,i)=>Be.resolve(s).then((n=>{e[i]=n,--r||t(e)}),n)))}))},resolve:e=>{if(e instanceof Be)return e;if(e&&"function"==typeof e.then)return new Be(((t,n)=>{e.then(t,n)}));var t=new Be(ce,!0,e);return $e(t,Pe),t},reject:Ye,race:function(){var e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{e.map((e=>Be.resolve(e).then(t,n)))}))},PSD:{get:()=>Oe,set:e=>Oe=e},totalEchoes:{get:()=>Je},newPSD:et,usePSD:lt,scheduler:{get:()=>we,set:e=>{we=e}},rejectionMapper:{get:()=>Se,set:e=>{Se=e}},follow:(e,t)=>new Be(((n,r)=>et(((t,n)=>{var r=Oe;r.unhandleds=[],r.onunhandled=n,r.finalize=se((function(){!function(e){je.push((function t(){e(),je.splice(je.indexOf(t),1)})),++Ce,we((()=>{0==--Ce&&We()}),[])}((()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])}))}),r.finalize),e()}),t,n,r)))}),me&&(me.allSettled&&c(Be,"allSettled",(function(){const e=T.apply(null,arguments).map(rt);return new Be((t=>{0===e.length&&t([]);let n=e.length;const r=new Array(n);e.forEach(((e,s)=>Be.resolve(e).then((e=>r[s]={status:"fulfilled",value:e}),(e=>r[s]={status:"rejected",reason:e})).then((()=>--n||t(r)))))}))})),me.any&&"undefined"!=typeof AggregateError&&c(Be,"any",(function(){const e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{0===e.length&&n(new AggregateError([]));let r=e.length;const s=new Array(r);e.forEach(((e,i)=>Be.resolve(e).then((e=>t(e)),(e=>{s[i]=e,--r||n(new AggregateError(s))}))))}))})));const He={awaits:0,echoes:0,id:0};var Ge=0,Qe=[],Xe=0,Je=0,Ze=0;function et(e,t,n,r){var i=Oe,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ze;var a=Ke.env;o.env=be?{Promise:Be,PromiseProp:{value:Be,configurable:!0,writable:!0},all:Be.all,race:Be.race,allSettled:Be.allSettled,any:Be.any,resolve:Be.resolve,reject:Be.reject,nthen:ht(a.nthen,o),gthen:ht(a.gthen,o)}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var l=lt(o,e,n,r);return 0===o.ref&&o.finalize(),l}function tt(){return He.id||(He.id=++Ge),++He.awaits,He.echoes+=he,He.id}function nt(){return!!He.awaits&&(0==--He.awaits&&(He.id=0),He.echoes=He.awaits*he,!0)}function rt(e){return He.echoes&&e&&e.constructor===me?(tt(),e.then((e=>(nt(),e)),(e=>(nt(),pt(e))))):e}function st(e){++Je,He.echoes&&0!=--He.echoes||(He.echoes=He.id=0),Qe.push(Oe),ot(e,!0)}function it(){var e=Qe[Qe.length-1];Qe.pop(),ot(e,!1)}function ot(e,n){var r=Oe;if((n?!He.echoes||Xe++&&e===Oe:!Xe||--Xe&&e===Oe)||ut(n?st.bind(null,e):it),e!==Oe&&(Oe=e,r===Ke&&(Ke.env=at()),be)){var s=Ke.env.Promise,i=e.env;fe.then=i.nthen,s.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(t,"Promise",i.PromiseProp),s.all=i.all,s.race=i.race,s.resolve=i.resolve,s.reject=i.reject,i.allSettled&&(s.allSettled=i.allSettled),i.any&&(s.any=i.any))}}function at(){var e=t.Promise;return be?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(t,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:fe.then,gthen:e.prototype.then}:{}}function lt(e,t,n,r,s){var i=Oe;try{return ot(e,!0),t(n,r,s)}finally{ot(i,!1)}}function ut(e){ye.call(de,e)}function ct(e,t,n,r){return"function"!=typeof e?e:function(){var s=Oe;n&&tt(),ot(t,!0);try{return e.apply(this,arguments)}finally{ot(s,!1),r&&ut(nt)}}}function ht(e,t){return function(n,r){return e.call(this,ct(n,t),ct(r,t))}}-1===(""+ye).indexOf("[native code]")&&(tt=nt=te);const dt="unhandledrejection";function ft(e,n){var r;try{r=n.onuncatched(e)}catch(e){}if(!1!==r)try{var i,o={promise:n,reason:e};if(t.document&&document.createEvent?((i=document.createEvent("Event")).initEvent(dt,!0,!0),s(i,o)):t.CustomEvent&&s(i=new CustomEvent(dt,{detail:o}),o),i&&t.dispatchEvent&&(dispatchEvent(i),!t.PromiseRejectionEvent&&t.onunhandledrejection))try{t.onunhandledrejection(i)}catch(e){}M&&i&&!i.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var pt=Be.reject;function yt(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Oe.letThrough||e._vip)){var s=e._createTransaction(t,n,e._dbSchema);try{s.create(),e._state.PR1398_maxLoop=3}catch(s){return s.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>yt(e,t,n,r)))):pt(s)}return s._promise(t,((e,t)=>et((()=>(Oe.trans=s,r(e,t,s)))))).then((e=>s._completion.then((()=>e))))}if(e._state.openComplete)return pt(new J.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return pt(new J.DatabaseClosed);e.open().catch(te)}return e._state.dbReadyPromise.then((()=>yt(e,t,n,r)))}const mt="3.2.5",bt=String.fromCharCode(65535),gt=-1/0,vt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",wt="String expected.",_t=[],xt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),kt=xt,Et=xt,Pt=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),St="__dbnames",Kt="readonly",Ot="readwrite";function At(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const Ct={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function jt(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=O(t))[e],t)}class Bt{_trans(e,t,n){const r=this._tx||Oe.trans,s=this.name;function i(e,n,r){if(!r.schema[s])throw new J.NotFound("Table "+s+" not part of transaction");return t(r.idbtrans,r)}const o=Ue();try{return r&&r.db===this.db?r===Oe.trans?r._promise(e,i,n):et((()=>r._promise(e,i,n)),{trans:r,transless:Oe.transless||Oe}):yt(this.db,e,[this.name],i)}finally{o&&Ve()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",(t=>this.core.get({trans:t,key:e}).then((e=>this.hook.reading.fire(e))))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(r(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const t=n(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);const s=this.schema.indexes.concat(this.schema.primKey).filter((e=>{if(e.compound&&t.every((t=>e.keyPath.indexOf(t)>=0))){for(let n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort(((e,t)=>e.keyPath.length-t.keyPath.length))[0];if(s&&this.db._maxKey!==bt){const n=s.keyPath.slice(0,t.length);return this.where(n).equals(n.map((t=>e[t])))}!s&&M&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);const{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function a(e,t){try{return 0===o.cmp(e,t)}catch(e){return!1}}const[l,u]=t.reduce((([t,n],s)=>{const o=i[s],l=e[s];return[t||o,t||!o?At(n,o&&o.multi?e=>{const t=w(e,s);return r(t)&&t.some((e=>a(l,e)))}:e=>a(l,w(e,s))):n]}),[null,null]);return l?this.where(l.name).equals(e[l.keyPath]).filter(u):s?this.filter(u):this.where(t).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,r(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const t=t=>{if(!t)return t;const n=Object.create(e.prototype);for(var r in t)if(a(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass((function(e){s(this,e)}))}add(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[s]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}update(e,t){if("object"!=typeof e||r(e))return this.where(":id").equals(e).modify(t);{const r=w(e,this.schema.primKey.keyPath);if(void 0===r)return pt(new J.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?n(t).forEach((n=>{_(e,n,t[n])})):t(e,{value:e,primKey:r})}catch(e){}return this.where(":id").equals(r).modify(t)}}put(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"put",values:[s],keys:null!=t?[t]:null}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}delete(e){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:[e]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}clear(){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"deleteRange",range:Ct}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}bulkGet(e){return this._trans("readonly",(t=>this.core.getMany({keys:e,trans:t}).then((e=>e.map((e=>this.hook.reading.fire(e)))))))}bulkAdd(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkAdd(): ${e} of ${o} operations failed`,r)}))}))}bulkPut(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkPut(): ${e} of ${o} operations failed`,r)}))}))}bulkDelete(e){const t=e.length;return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:e}))).then((({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new G(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)}))}}function Dt(e){var t={},s=function(n,r){if(r){for(var s=arguments.length,i=new Array(s-1);--s;)i[s-1]=arguments[s];return t[n].subscribe.apply(null,i),e}if("string"==typeof n)return t[n]};s.addEventType=a;for(var i=1,o=arguments.length;i<o;++i)a(arguments[i]);return s;function a(e,i,o){if("object"!=typeof e){var l;i||(i=le),o||(o=te);var u={subscribers:[],fire:o,subscribe:function(e){-1===u.subscribers.indexOf(e)&&(u.subscribers.push(e),u.fire=i(u.fire,e))},unsubscribe:function(e){u.subscribers=u.subscribers.filter((function(t){return t!==e})),u.fire=u.subscribers.reduce(i,o)}};return t[e]=s[e]=u,u}n(l=e).forEach((function(e){var t=l[e];if(r(t))a(e,l[e][0],l[e][1]);else{if("asap"!==t)throw new J.InvalidArgument("Invalid event config");var n=a(e,ne,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){g((function(){e.apply(null,t)}))}))}))}}))}}function It(e,t){return h(t).from({prototype:e}),t}function Tt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Rt(e,t){e.filter=At(e.filter,t)}function Mt(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>At(r(),t()):t,e.justLimit=n&&!r}function Ft(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new J.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Nt(e,t,n){const r=Ft(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function qt(e,t,n,r){const s=e.replayFilter?At(e.filter,e.replayFilter()):e.filter;if(e.or){const i={},o=(e,n,r)=>{if(!s||s(n,r,(e=>n.stop(e)),(e=>n.fail(e)))){var o=n.primaryKey,l=""+o;"[object ArrayBuffer]"===l&&(l=""+new Uint8Array(o)),a(i,l)||(i[l]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(o,n),$t(Nt(e,r,n),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return $t(Nt(e,r,n),At(e.algorithm,s),t,!e.keysOnly&&e.valueMapper)}function $t(e,t,n,r){var s=ze(r?(e,t,s)=>n(r(e),t,s):n);return e.then((e=>{if(e)return e.start((()=>{var n=()=>e.continue();t&&!t(e,(e=>n=e),(t=>{e.stop(t),n=te}),(t=>{e.fail(t),n=te}))||s(e.value,e,(e=>n=e)),n()}))}))}function Lt(e,t){try{const n=Ut(e),r=Ut(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(Vt(e),Vt(t));case"Array":return function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n){const r=Lt(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function Ut(e){const t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";const n=j(e);return"ArrayBuffer"===n?"binary":n}function Vt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class Wt{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,pt.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,pt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=At(t.algorithm,e)}_iterate(e,t){return qt(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read((n=>qt(t,e,n,t.table.core)))}count(e){return this._read((e=>{const t=this._ctx,n=t.table.core;if(Tt(t,!0))return n.count({trans:e,query:{index:Ft(t,n.schema),range:t.range}}).then((e=>Math.min(e,t.limit)));var r=0;return qt(t,(()=>(++r,!1)),e,n).then((()=>r))})).then(e)}sortBy(e,t){const n=e.split(".").reverse(),r=n[0],s=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var o="next"===this._ctx.dir?1:-1;function a(e,t){var n=i(e,s),r=i(t,s);return n<r?-o:n>r?o:0}return this.toArray((function(e){return e.sort(a)})).then(t)}toArray(e){return this._read((e=>{var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0){const{valueMapper:n}=t,r=Ft(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then((({result:e})=>n?e.map(n):e))}{const n=[];return qt(t,(e=>n.push(e)),e,t.table.core).then((()=>n))}}),e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,Tt(t)?Mt(t,(()=>{var t=e;return(e,n)=>0===t||(1===t?(--t,!1):(n((()=>{e.advance(t),t=0})),!1))})):Mt(t,(()=>{var t=e;return()=>--t<0}))),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Mt(this._ctx,(()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this}until(e,t){return Rt(this._ctx,(function(n,r,s){return!e(n.value)||(r(s),t)})),this}first(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)}last(e){return this.reverse().first(e)}filter(e){var t,n;return Rt(this._ctx,(function(t){return e(t.value)})),t=this._ctx,n=e,t.isMatch=At(t.isMatch,n),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))}keys(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0)return this._read((e=>{var n=Ft(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((({result:e})=>e)).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys((function(e){return e[0]})).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Rt(this._ctx,(function(e){var t=e.primaryKey.toString(),r=a(n,t);return n[t]=!0,!r})),this}modify(e){var t=this._ctx;return this._write((r=>{var s;if("function"==typeof e)s=e;else{var i=n(e),o=i.length;s=function(t){for(var n=!1,r=0;r<o;++r){var s=i[r],a=e[s];w(t,s)!==a&&(_(t,s,a),n=!0)}return n}}const a=t.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,h=[];let d=0;const f=[],p=(e,t)=>{const{failures:r,numFailures:s}=t;d+=e-s;for(let e of n(r))h.push(r[e])};return this.clone().primaryKeys().then((n=>{const i=o=>{const h=Math.min(c,n.length-o);return a.getMany({trans:r,keys:n.slice(o,o+h),cache:"immutable"}).then((d=>{const f=[],y=[],m=l?[]:null,b=[];for(let e=0;e<h;++e){const t=d[e],r={value:O(t),primKey:n[o+e]};!1!==s.call(r,r.value,r)&&(null==r.value?b.push(n[o+e]):l||0===Lt(u(t),u(r.value))?(y.push(r.value),l&&m.push(n[o+e])):(b.push(n[o+e]),f.push(r.value)))}const g=Tt(t)&&t.limit===1/0&&("function"!=typeof e||e===Yt)&&{index:t.index,range:t.range};return Promise.resolve(f.length>0&&a.mutate({trans:r,type:"add",values:f}).then((e=>{for(let t in e.failures)b.splice(parseInt(t),1);p(f.length,e)}))).then((()=>(y.length>0||g&&"object"==typeof e)&&a.mutate({trans:r,type:"put",keys:m,values:y,criteria:g,changeSpec:"function"!=typeof e&&e}).then((e=>p(y.length,e))))).then((()=>(b.length>0||g&&e===Yt)&&a.mutate({trans:r,type:"delete",keys:b,criteria:g}).then((e=>p(b.length,e))))).then((()=>n.length>o+h&&i(o+c)))}))};return i(0).then((()=>{if(h.length>0)throw new H("Error modifying one or more objects",h,d,f);return n.length}))}))}))}delete(){var e=this._ctx,t=e.range;return Tt(e)&&(e.isPrimKey&&!Et||3===t.type)?this._write((n=>{const{primaryKey:r}=e.table.core.schema,s=t;return e.table.core.count({trans:n,query:{index:r,range:s}}).then((t=>e.table.core.mutate({trans:n,type:"deleteRange",range:s}).then((({failures:e,lastResult:n,results:r,numFailures:s})=>{if(s)throw new H("Could not delete some values",Object.keys(e).map((t=>e[t])),t-s);return t-s}))))})):this.modify(Yt)}}const Yt=(e,t)=>t.value=null;function zt(e,t){return e<t?-1:e===t?0:1}function Ht(e,t){return e>t?-1:e===t?0:1}function Gt(e,t,n){var r=e instanceof tn?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Qt(e){return new e.Collection(e,(()=>en(""))).limit(0)}function Xt(e,t,n,r,s,i){for(var o=Math.min(e.length,r.length),a=-1,l=0;l<o;++l){var u=t[l];if(u!==r[l])return s(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):s(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;s(e[l],u)<0&&(a=l)}return o<r.length&&"next"===i?e+n.substr(e.length):o<e.length&&"prev"===i?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function Jt(e,t,n,r){var s,i,o,a,l,u,c,h=n.length;if(!n.every((e=>"string"==typeof e)))return Gt(e,wt);function d(e){s=function(e){return"next"===e?e=>e.toUpperCase():e=>e.toLowerCase()}(e),i=function(e){return"next"===e?e=>e.toLowerCase():e=>e.toUpperCase()}(e),o="next"===e?zt:Ht;var t=n.map((function(e){return{lower:i(e),upper:s(e)}})).sort((function(e,t){return o(e.lower,t.lower)}));a=t.map((function(e){return e.upper})),l=t.map((function(e){return e.lower})),u=e,c="next"===e?"":r}d("next");var f=new e.Collection(e,(()=>Zt(a[0],l[h-1]+r)));f._ondirectionchange=function(e){d(e)};var p=0;return f._addAlgorithm((function(e,n,r){var s=e.key;if("string"!=typeof s)return!1;var d=i(s);if(t(d,l,p))return!0;for(var f=null,y=p;y<h;++y){var m=Xt(s,d,a[y],l[y],o,u);null===m&&null===f?p=y+1:(null===f||o(f,m)>0)&&(f=m)}return n(null!==f?function(){e.continue(f+c)}:r),!1})),f}function Zt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function en(e){return{type:1,lower:e,upper:e}}class tn{get Collection(){return this._ctx.table.db.Collection}between(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?Qt(this):new this.Collection(this,(()=>Zt(e,t,!n,!r)))}catch(e){return Gt(this,vt)}}equals(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>en(e)))}above(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(e,void 0,!0)))}aboveOrEqual(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(e,void 0,!1)))}below(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(void 0,e,!1,!0)))}belowOrEqual(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(void 0,e)))}startsWith(e){return"string"!=typeof e?Gt(this,wt):this.between(e,e+bt,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):Jt(this,((e,t)=>0===e.indexOf(t[0])),[e],bt)}equalsIgnoreCase(e){return Jt(this,((e,t)=>e===t[0]),[e],"")}anyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>-1!==t.indexOf(e)),e,"")}startsWithAnyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>t.some((t=>0===e.indexOf(t)))),e,bt)}anyOf(){const e=T.apply(I,arguments);let t=this._cmp;try{e.sort(t)}catch(e){return Gt(this,vt)}if(0===e.length)return Qt(this);const n=new this.Collection(this,(()=>Zt(e[0],e[e.length-1])));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm(((n,s,i)=>{const o=n.key;for(;t(o,e[r])>0;)if(++r,r===e.length)return s(i),!1;return 0===t(o,e[r])||(s((()=>{n.continue(e[r])})),!1)})),n}notEqual(e){return this.inAnyRange([[gt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=T.apply(I,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Gt(this,vt)}const t=e.reduce(((e,t)=>e?e.concat([[e[e.length-1][1],t]]):[[gt,t]]),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,t){const n=this._cmp,r=this._ascending,s=this._descending,i=this._min,o=this._max;if(0===e.length)return Qt(this);if(!e.every((e=>void 0!==e[0]&&void 0!==e[1]&&r(e[0],e[1])<=0)))return Gt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",J.InvalidArgument);const a=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers;let u,c=r;function h(e,t){return c(e[0],t[0])}try{u=e.reduce((function(e,t){let r=0,s=e.length;for(;r<s;++r){const s=e[r];if(n(t[0],s[1])<0&&n(t[1],s[0])>0){s[0]=i(s[0],t[0]),s[1]=o(s[1],t[1]);break}}return r===s&&e.push(t),e}),[]),u.sort(h)}catch(e){return Gt(this,vt)}let d=0;const f=l?e=>r(e,u[d][1])>0:e=>r(e,u[d][1])>=0,p=a?e=>s(e,u[d][0])>0:e=>s(e,u[d][0])>=0;let y=f;const m=new this.Collection(this,(()=>Zt(u[0][0],u[u.length-1][1],!a,!l)));return m._ondirectionchange=e=>{"next"===e?(y=f,c=r):(y=p,c=s),u.sort(h)},m._addAlgorithm(((e,t,n)=>{for(var s=e.key;y(s);)if(++d,d===u.length)return t(n),!1;return!!function(e){return!f(e)&&!p(e)}(s)||(0===this._cmp(s,u[d][1])||0===this._cmp(s,u[d][0])||t((()=>{c===r?e.continue(u[d][0]):e.continue(u[d][1])})),!1)})),m}startsWithAnyOf(){const e=T.apply(I,arguments);return e.every((e=>"string"==typeof e))?0===e.length?Qt(this):this.inAnyRange(e.map((e=>[e,e+bt]))):Gt(this,"startsWithAnyOf() only works with strings")}}function nn(e){return ze((function(t){return rn(t),e(t.target.error),!1}))}function rn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const sn="storagemutated",on="x-storagemutated-1",an=Dt(null,sn);class ln{_lock(){return b(!Oe.global),++this._reculock,1!==this._reculock||Oe.global||(Oe.lockOwnerFor=this),this}_unlock(){if(b(!Oe.global),0==--this._reculock)for(Oe.global||(Oe.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{lt(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&Oe.lockOwnerFor!==this}create(e){if(!this.mode)return this;const t=this.db.idbdb,n=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new J.DatabaseClosed(n);case"MissingAPIError":throw new J.MissingAPI(n.message,n);default:throw new J.OpenFailed(n)}if(!this.active)throw new J.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=ze((t=>{rn(t),this._reject(e.error)})),e.onabort=ze((t=>{rn(t),this.active&&this._reject(new J.Abort(e.error)),this.active=!1,this.on("abort").fire(t)})),e.oncomplete=ze((()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&an.storagemutated.fire(e.mutatedParts)})),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return pt(new J.ReadOnly("Transaction is readonly"));if(!this.active)return pt(new J.TransactionInactive);if(this._locked())return new Be(((r,s)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,s)},Oe])}));if(n)return et((()=>{var e=new Be(((e,n)=>{this._lock();const r=t(e,n,this);r&&r.then&&r.then(e,n)}));return e.finally((()=>this._unlock())),e._lib=!0,e}));var r=new Be(((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();const n=Be.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((()=>n));else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var s=t._waitingFor;return new Be(((e,r)=>{n.then((n=>t._waitingQueue.push(ze(e.bind(null,n)))),(e=>t._waitingQueue.push(ze(r.bind(null,e))))).finally((()=>{t._waitingFor===s&&(t._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new J.Abort))}table(e){const t=this._memoizedTables||(this._memoizedTables={});if(a(t,e))return t[e];const n=this.schema[e];if(!n)throw new J.NotFound("Table "+e+" not part of transaction");const r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}}function un(e,t,n,r,s,i,o){return{name:e,keyPath:t,unique:n,multi:r,auto:s,compound:i,src:(n&&!o?"&":"")+(r?"*":"")+(s?"++":"")+cn(t)}}function cn(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function hn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:v(n,(e=>[e.name,e]))}}let dn=e=>{try{return e.only([[]]),dn=()=>[[]],[[]]}catch(e){return dn=()=>bt,bt}};function fn(e){return null==e?()=>{}:"string"==typeof e?function(e){return 1===e.split(".").length?t=>t[e]:t=>w(t,e)}(e):t=>w(t,e)}function pn(e){return[].slice.call(e)}let yn=0;function mn(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function bn(e,t,n){function s(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:n,upper:r,lowerOpen:s,upperOpen:i}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!i):void 0===r?t.lowerBound(n,!!s):t.bound(n,r,!!s,!!i)}const{schema:i,hasGetAll:o}=function(e,t){const n=pn(e.objectStoreNames);return{schema:{name:e.name,tables:n.map((e=>t.objectStore(e))).map((e=>{const{keyPath:t,autoIncrement:n}=e,s=r(t),i=null==t,o={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:s,keyPath:t,autoIncrement:n,unique:!0,extractKey:fn(t)},indexes:pn(e.indexNames).map((t=>e.index(t))).map((e=>{const{name:t,unique:n,multiEntry:s,keyPath:i}=e,a={name:t,compound:r(i),keyPath:i,unique:n,multiEntry:s,extractKey:fn(i)};return o[mn(i)]=a,a})),getIndexByKeyPath:e=>o[mn(e)]};return o[":id"]=a.primaryKey,null!=t&&(o[mn(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,n),a=i.tables.map((e=>function(e){const t=e.name;return{name:t,schema:e,mutate:function({trans:e,type:n,keys:r,values:i,range:o}){return new Promise(((a,l)=>{a=ze(a);const u=e.objectStore(t),c=null==u.keyPath,h="put"===n||"add"===n;if(!h&&"delete"!==n&&"deleteRange"!==n)throw new Error("Invalid operation type: "+n);const{length:d}=r||i||{length:1};if(r&&i&&r.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return a({numFailures:0,failures:{},results:[],lastResult:void 0});let f;const p=[],y=[];let m=0;const b=e=>{++m,rn(e)};if("deleteRange"===n){if(4===o.type)return a({numFailures:m,failures:y,results:[],lastResult:void 0});3===o.type?p.push(f=u.clear()):p.push(f=u.delete(s(o)))}else{const[e,t]=h?c?[i,r]:[i,null]:[r,null];if(h)for(let r=0;r<d;++r)p.push(f=t&&void 0!==t[r]?u[n](e[r],t[r]):u[n](e[r])),f.onerror=b;else for(let t=0;t<d;++t)p.push(f=u[n](e[t])),f.onerror=b}const g=e=>{const t=e.target.result;p.forEach(((e,t)=>null!=e.error&&(y[t]=e.error))),a({numFailures:m,failures:y,results:"delete"===n?r:p.map((e=>e.result)),lastResult:t})};f.onerror=e=>{b(e),g(e)},f.onsuccess=g}))},getMany:({trans:e,keys:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t),o=n.length,a=new Array(o);let l,u=0,c=0;const h=e=>{const t=e.target;a[t._pos]=t.result,++c===u&&r(a)},d=nn(s);for(let e=0;e<o;++e)null!=n[e]&&(l=i.get(n[e]),l._pos=e,l.onsuccess=h,l.onerror=d,++u);0===u&&r(a)})),get:({trans:e,key:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=nn(s)})),query:function(e){return n=>new Promise(((r,i)=>{r=ze(r);const{trans:o,values:a,limit:l,query:u}=n,c=l===1/0?void 0:l,{index:h,range:d}=u,f=o.objectStore(t),p=h.isPrimaryKey?f:f.index(h.name),y=s(d);if(0===l)return r({result:[]});if(e){const e=a?p.getAll(y,c):p.getAllKeys(y,c);e.onsuccess=e=>r({result:e.target.result}),e.onerror=nn(i)}else{let e=0;const t=a||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),n=[];t.onsuccess=s=>{const i=t.result;return i?(n.push(a?i.value:i.primaryKey),++e===l?r({result:n}):void i.continue()):r({result:n})},t.onerror=nn(i)}}))}(o),openCursor:function({trans:e,values:n,query:r,reverse:i,unique:o}){return new Promise(((a,l)=>{a=ze(a);const{index:u,range:c}=r,h=e.objectStore(t),d=u.isPrimaryKey?h:h.index(u.name),f=i?o?"prevunique":"prev":o?"nextunique":"next",p=n||!("openKeyCursor"in d)?d.openCursor(s(c),f):d.openKeyCursor(s(c),f);p.onerror=nn(l),p.onsuccess=ze((t=>{const n=p.result;if(!n)return void a(null);n.___id=++yn,n.done=!1;const r=n.continue.bind(n);let s=n.continuePrimaryKey;s&&(s=s.bind(n));const i=n.advance.bind(n),o=()=>{throw new Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw new Error("Cursor not started")},n.fail=ze(l),n.next=function(){let e=1;return this.start((()=>e--?this.continue():this.stop())).then((()=>this))},n.start=e=>{const t=new Promise(((e,t)=>{e=ze(e),p.onerror=nn(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=o,e(t)}})),a=()=>{if(p.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw new Error("Cursor behind last entry")},n.stop()};return p.onsuccess=ze((e=>{p.onsuccess=a,a()})),n.continue=r,n.continuePrimaryKey=s,n.advance=i,a(),t},a(n)}),l)}))},count({query:e,trans:n}){const{index:r,range:i}=e;return new Promise(((e,o)=>{const a=n.objectStore(t),l=r.isPrimaryKey?a:a.index(r.name),u=s(i),c=u?l.count(u):l.count();c.onsuccess=ze((t=>e(t.target.result))),c.onerror=nn(o)}))}}}(e))),l={};return a.forEach((e=>l[e.name]=e)),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!l[e])throw new Error(`Table '${e}' not found`);return l[e]},MIN_KEY:-1/0,MAX_KEY:dn(t),schema:i}}function gn({_novip:e},t){const n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},s){const i=function(e,t){return t.reduce(((e,{create:t})=>({...e,...t(e)})),e)}(bn(t,n,s),e.dbcore);return{dbcore:i}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach((t=>{const n=t.name;e.core.schema.tables.some((e=>e.name===n))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function vn({_novip:e},t,n,r){n.forEach((n=>{const s=r[n];t.forEach((t=>{const r=f(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?c(t,n,{get(){return this.table(n)},set(e){u(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,s))}))}))}function wn({_novip:e},t){t.forEach((t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]}))}function _n(e,t){return e._cfg.version-t._cfg.version}function xn(e,t,r,s){const i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(r),o._completion.catch(s);const a=o._reject.bind(o),l=Oe.transless||Oe;et((()=>{Oe.trans=o,Oe.transless=l,0===t?(n(i).forEach((e=>{En(r,e,i[e].primKey,i[e].indexes)})),gn(e,r),Be.follow((()=>e.on.populate.fire(o))).catch(a)):function({_novip:e},t,r,s){const i=[],o=e._versions;let a=e._dbSchema=Sn(e,e.idbdb,s),l=!1;const u=o.filter((e=>e._cfg.version>=t));return u.forEach((o=>{i.push((()=>{const i=a,u=o._cfg.dbschema;Kn(e,i,s),Kn(e,u,s),a=e._dbSchema=u;const c=kn(i,u);c.add.forEach((e=>{En(s,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((e=>{if(e.recreate)throw new J.Upgrade("Not yet support for changing primary key");{const t=s.objectStore(e.name);e.add.forEach((e=>Pn(t,e))),e.change.forEach((e=>{t.deleteIndex(e.name),Pn(t,e)})),e.del.forEach((e=>t.deleteIndex(e)))}}));const h=o._cfg.contentUpgrade;if(h&&o._cfg.version>t){gn(e,s),r._memoizedTables={},l=!0;let t=x(u);c.del.forEach((e=>{t[e]=i[e]})),wn(e,[e.Transaction.prototype]),vn(e,[e.Transaction.prototype],n(t),t),r.schema=t;const o=R(h);let a;o&&tt();const d=Be.follow((()=>{if(a=h(r),a&&o){var e=nt.bind(null,null);a.then(e,e)}}));return a&&"function"==typeof a.then?Be.resolve(a):d.then((()=>a))}})),i.push((t=>{l&&kt||function(e,t){[].slice.call(t.db.objectStoreNames).forEach((n=>null==e[n]&&t.db.deleteObjectStore(n)))}(o._cfg.dbschema,t),wn(e,[e.Transaction.prototype]),vn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),r.schema=e._dbSchema}))})),function e(){return i.length?Be.resolve(i.shift()(r.idbtrans)).then(e):Be.resolve()}().then((()=>{var e,t;t=s,n(e=a).forEach((n=>{t.db.objectStoreNames.contains(n)||En(t,n,e[n].primKey,e[n].indexes)}))}))}(e,t,o,r).catch(a)}))}function kn(e,t){const n={del:[],add:[],change:[]};let r;for(r in e)t[r]||n.del.push(r);for(r in t){const s=e[r],i=t[r];if(s){const e={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!xt)e.recreate=!0,n.change.push(e);else{const t=s.idxByName,r=i.idxByName;let o;for(o in t)r[o]||e.del.push(o);for(o in r){const n=t[o],s=r[o];n?n.src!==s.src&&e.change.push(s):e.add.push(s)}(e.del.length>0||e.add.length>0||e.change.length>0)&&n.change.push(e)}}else n.add.push([r,i])}return n}function En(e,t,n,r){const s=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((e=>Pn(s,e))),s}function Pn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Sn(e,t,n){const r={};return y(t.objectStoreNames,0).forEach((e=>{const t=n.objectStore(e);let s=t.keyPath;const i=un(cn(s),s||"",!1,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[];for(let e=0;e<t.indexNames.length;++e){const n=t.index(t.indexNames[e]);s=n.keyPath;var a=un(n.name,s,!!n.unique,!!n.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(a)}r[e]=hn(e,i,o)})),r}function Kn({_novip:e},n,r){const s=r.db.objectStoreNames;for(let t=0;t<s.length;++t){const i=s[t],o=r.objectStore(i);e._hasGetAll="getAll"in o;for(let e=0;e<o.indexNames.length;++e){const t=o.indexNames[e],r=o.index(t).keyPath,s="string"==typeof r?r:"["+y(r).join("+")+"]";if(n[i]){const e=n[i].idxByName[s];e&&(e.name=t,delete n[i].idxByName[s],n[i].idxByName[t]=e)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&t.WorkerGlobalScope&&t instanceof t.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class On{_parseStoresSpec(e,t){n(e).forEach((n=>{if(null!==e[n]){var s=e[n].split(",").map(((e,t)=>{const n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),s=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return un(n,s||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),r(s),0===t)})),i=s.shift();if(i.multi)throw new J.Schema("Primary key cannot be multi-valued");s.forEach((e=>{if(e.auto)throw new J.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new J.Schema("Index must have a name and cannot be an empty string")})),t[n]=hn(n,i,s)}}))}stores(e){const t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;const r=t._versions,i={};let o={};return r.forEach((e=>{s(i,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(i,o)})),t._dbSchema=o,wn(t,[t._allTables,t,t.Transaction.prototype]),vn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],n(o),o),t._storeNames=n(o),this}upgrade(e){return this._cfg.contentUpgrade=ue(this._cfg.contentUpgrade||te,e),this}}function An(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Qn(St,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Cn(e){return e&&"function"==typeof e.databases}function jn(e){return et((function(){return Oe.letThrough=!0,e()}))}function Bn(){var e;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(t){var n=function(){return indexedDB.databases().finally(t)};e=setInterval(n,100),n()})).finally((function(){return clearInterval(e)})):Promise.resolve()}function Dn(e){var t=t=>e.next(t),n=i(t),s=i((t=>e.throw(t)));function i(e){return t=>{var i=e(t),o=i.value;return i.done?o:o&&"function"==typeof o.then?o.then(n,s):r(o)?Promise.all(o).then(n,s):n(o)}}return i(t)()}function In(e,t,n){var r=arguments.length;if(r<2)throw new J.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];return n=s.pop(),[e,E(s),n]}function Tn(e,t,n,r,s){return Be.resolve().then((()=>{const i=Oe.transless||Oe,o=e._createTransaction(t,n,e._dbSchema,r),a={trans:o,transless:i};if(r)o.idbtrans=r.idbtrans;else try{o.create(),e._state.PR1398_maxLoop=3}catch(r){return r.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Tn(e,t,n,null,s)))):pt(r)}const l=R(s);let u;l&&tt();const c=Be.follow((()=>{if(u=s.call(o,o),u)if(l){var e=nt.bind(null,null);u.then(e,e)}else"function"==typeof u.next&&"function"==typeof u.throw&&(u=Dn(u))}),a);return(u&&"function"==typeof u.then?Be.resolve(u).then((e=>o.active?e:pt(new J.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):c.then((()=>u))).then((e=>(r&&o._resolve(),o._completion.then((()=>e))))).catch((e=>(o._reject(e),pt(e))))}))}function Rn(e,t,n){const s=r(e)?e.slice():[e];for(let e=0;e<n;++e)s.push(t);return s}const Mn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const n=e.table(t),{schema:r}=n,s={},i=[];function o(e,t,n){const r=mn(e),a=s[r]=s[r]||[],l=null==e?0:"string"==typeof e?1:e.length,u=t>0,c={...n,isVirtual:u,keyTail:t,keyLength:l,extractKey:fn(e),unique:!u&&n.unique};return a.push(c),c.isPrimaryKey||i.push(c),l>1&&o(2===l?e[0]:e.slice(0,l-1),t+1,n),a.sort(((e,t)=>e.keyTail-t.keyTail)),c}const a=o(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[a];for(const e of r.indexes)o(e.keyPath,0,e);function l(t){const n=t.query.index;return n.isVirtual?{...t,query:{index:n,range:(r=t.query.range,s=n.keyTail,{type:1===r.type?2:r.type,lower:Rn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,s),lowerOpen:!0,upper:Rn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,s),upperOpen:!0})}}:t;var r,s}const u={...n,schema:{...r,primaryKey:a,indexes:i,getIndexByKeyPath:function(e){const t=s[mn(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){const{keyTail:r,isVirtual:s,keyLength:i}=t.query.index;return s?n.openCursor(l(t)).then((n=>n&&function(n){const s=Object.create(n,{continue:{value:function(s){null!=s?n.continue(Rn(s,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,i).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,s){n.continuePrimaryKey(Rn(t,e.MAX_KEY,r),s)}},primaryKey:{get:()=>n.primaryKey},key:{get(){const e=n.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>n.value}});return s}(n))):n.openCursor(t)}};return u}}}};function Fn(e,t,r,s){return r=r||{},s=s||"",n(e).forEach((n=>{if(a(t,n)){var i=e[n],o=t[n];if("object"==typeof i&&"object"==typeof o&&i&&o){const e=j(i);e!==j(o)?r[s+n]=t[n]:"Object"===e?Fn(i,o,r,s+n+"."):i!==o&&(r[s+n]=t[n])}else i!==o&&(r[s+n]=t[n])}else r[s+n]=void 0})),n(t).forEach((n=>{a(e,n)||(r[s+n]=t[n])})),r}const Nn={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){const n=e.table(t),{primaryKey:r}=n.schema,s={...n,mutate(e){const s=Oe.trans,{deleting:i,creating:o,updating:l}=s.table(t).hook;switch(e.type){case"add":if(o.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"put":if(o.fire===te&&l.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"delete":if(i.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"deleteRange":if(i.fire===te)break;return s._promise("readwrite",(()=>function(e){return c(e.trans,e.range,1e4)}(e)),!0)}return n.mutate(e);function u(e){const t=Oe.trans,s=e.keys||function(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}(r,e);if(!s)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?{...e,keys:s}:{...e}).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),function(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}(n,e,s).then((u=>{const c=s.map(((n,s)=>{const c=u[s],h={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(h,n,c,t);else if("add"===e.type||void 0===c){const i=o.fire.call(h,n,e.values[s],t);null==n&&null!=i&&(n=i,e.keys[s]=n,r.outbound||_(e.values[s],r.keyPath,n))}else{const r=Fn(c,e.values[s]),i=l.fire.call(h,r,n,c,t);if(i){const t=e.values[s];Object.keys(i).forEach((e=>{a(t,e)?t[e]=i[e]:_(t,e,i[e])}))}}return h}));return n.mutate(e).then((({failures:t,results:n,numFailures:r,lastResult:i})=>{for(let r=0;r<s.length;++r){const i=n?n[r]:s[r],o=c[r];null==i?o.onerror&&o.onerror(t[r]):o.onsuccess&&o.onsuccess("put"===e.type&&u[r]?e.values[r]:i)}return{failures:t,results:n,numFailures:r,lastResult:i}})).catch((e=>(c.forEach((t=>t.onerror&&t.onerror(e))),Promise.reject(e))))}))}function c(e,t,s){return n.query({trans:e,values:!1,query:{index:r,range:t},limit:s}).then((({result:n})=>u({type:"delete",keys:n,trans:e}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<s?{failures:[],numFailures:0,lastResult:void 0}:c(e,{...t,lower:n[n.length-1],lowerOpen:!0},s)))))}}};return s}})};function qn(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;const r=[];for(let s=0,i=0;s<t.keys.length&&i<e.length;++s)0===Lt(t.keys[s],e[i])&&(r.push(n?O(t.values[s]):t.values[s]),++i);return r.length===e.length?r:null}catch(e){return null}}const $n={stack:"dbcore",level:-1,create:e=>({table:t=>{const n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);const t=qn(e.keys,e.trans._cache,"clone"===e.cache);return t?Be.resolve(t):n.getMany(e).then((t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?O(t):t},t)))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function Ln(e){return!("from"in e)}const Un=function(e,t){if(!this){const t=new Un;return e&&"d"in e&&s(t,e),t}s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function Vn(e,t,n){const r=Lt(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Ln(e))return s(e,{from:t,to:n,d:1});const i=e.l,o=e.r;if(Lt(n,e.from)<0)return i?Vn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},zn(e);if(Lt(t,e.to)>0)return o?Vn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},zn(e);Lt(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Lt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const a=!e.r;i&&!e.l&&Wn(e,i),o&&a&&Wn(e,o)}function Wn(e,t){Ln(t)||function e(t,{from:n,to:r,l:s,r:i}){Vn(t,n,r),s&&e(t,s),i&&e(t,i)}(e,t)}function Yn(e){let t=Ln(e)?null:{s:0,n:e};return{next(e){const n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&Lt(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||Lt(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function zn(e){var t,n;const r=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(n=e.l)||void 0===n?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){const t="r"===s?"l":"r",n={...e},r=e[s];e.from=r.from,e.to=r.to,e[s]=r[s],n[s]=r[t],e[t]=n,n.d=Hn(n)}e.d=Hn(e)}function Hn({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}l(Un.prototype,{add(e){return Wn(this,e),this},addKey(e){return Vn(this,e,e),this},addKeys(e){return e.forEach((e=>Vn(this,e,e))),this},[B](){return Yn(this)}});const Gn={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,s=new Un(e.MIN_KEY,e.MAX_KEY);return{...e,table:i=>{const o=e.table(i),{schema:a}=o,{primaryKey:l}=a,{extractKey:u,outbound:c}=l,h={...o,mutate:e=>{const n=e.trans,l=n.mutatedParts||(n.mutatedParts={}),u=e=>{const n=`idb://${t}/${i}/${e}`;return l[n]||(l[n]=new Un)},c=u(""),h=u(":dels"),{type:d}=e;let[f,p]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[];const y=e.trans._cache;return o.mutate(e).then((e=>{if(r(f)){"delete"!==d&&(f=e.results),c.addKeys(f);const t=qn(f,y);t||"add"===d||h.addKeys(f),(t||p)&&function(e,t,n,s){t.indexes.forEach((function(t){const i=e(t.name||"");function o(e){return null!=e?t.extractKey(e):null}const a=e=>t.multiEntry&&r(e)?e.forEach((e=>i.addKey(e))):i.addKey(e);(n||s).forEach(((e,t)=>{const r=n&&o(n[t]),i=s&&o(s[t]);0!==Lt(r,i)&&(null!=r&&a(r),null!=i&&a(i))}))}))}(u,a,t,p)}else if(f){const e={from:f.lower,to:f.upper};h.add(e),c.add(e)}else c.add(s),h.add(s),a.indexes.forEach((e=>u(e.name).add(s)));return e}))}},d=({query:{index:t,range:n}})=>{var r,s;return[t,new Un(null!==(r=n.lower)&&void 0!==r?r:e.MIN_KEY,null!==(s=n.upper)&&void 0!==s?s:e.MAX_KEY)]},f={get:e=>[l,new Un(e.key)],getMany:e=>[l,(new Un).addKeys(e.keys)],count:d,query:d,openCursor:d};return n(f).forEach((e=>{h[e]=function(n){const{subscr:r}=Oe;if(r){const a=e=>{const n=`idb://${t}/${i}/${e}`;return r[n]||(r[n]=new Un)},l=a(""),h=a(":dels"),[d,p]=f[e](n);if(a(d.name||"").add(p),!d.isPrimaryKey){if("count"!==e){const t="query"===e&&c&&n.values&&o.query({...n,values:!1});return o[e].apply(this,arguments).then((r=>{if("query"===e){if(c&&n.values)return t.then((({result:e})=>(l.addKeys(e),r)));const e=n.values?r.result.map(u):r.result;n.values?l.addKeys(e):h.addKeys(e)}else if("openCursor"===e){const e=r,t=n.values;return e&&Object.create(e,{key:{get:()=>(h.addKey(e.primaryKey),e.key)},primaryKey:{get(){const t=e.primaryKey;return h.addKey(t),t}},value:{get:()=>(t&&l.addKey(e.primaryKey),e.value)}})}return r}))}h.add(s)}}return o[e].apply(this,arguments)}})),h}}}};class Qn{constructor(e,t){this._middlewares={},this.verno=0;const n=Qn.dependencies;this._options=t={addons:Qn.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:r}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:te,dbReadyPromise:null,cancelOpen:te,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var i;s.dbReadyPromise=new Be((e=>{s.dbReadyResolve=e})),s.openCanceller=new Be(((e,t)=>{s.cancelOpen=t})),this._state=s,this.name=e,this.on=Dt(this,"populate","blocked","versionchange","close",{ready:[ue,te]}),this.on.ready.subscribe=m(this.on.ready.subscribe,(e=>(t,n)=>{Qn.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Be.resolve().then(t),n&&e(t);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(t),n&&e(t);else{e(t);const r=this;n||e((function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)}))}}))})),this.Collection=(i=this,It(Wt.prototype,(function(e,t){this.db=i;let n=Ct,r=null;if(t)try{n=t()}catch(e){r=e}const s=e._ctx,o=s.table,a=o.hook.reading.fire;this._ctx={table:o,index:s.index,isPrimKey:!s.index||o.schema.primKey.keyPath&&s.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:s.or,valueMapper:a!==ne?a:null}}))),this.Table=function(e){return It(Bt.prototype,(function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:Dt(null,{creating:[ie,te],reading:[re,ne],updating:[ae,te],deleting:[oe,te]})}))}(this),this.Transaction=function(e){return It(ln.prototype,(function(t,n,r,s,i){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=Dt(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 Be(((e,t)=>{this._resolve=e,this._reject=t})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),pt(e)}))}))}(this),this.Version=function(e){return It(On.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(e){return It(tn.prototype,(function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};const s=e._deps.indexedDB;if(!s)throw new J.MissingAPI;this._cmp=this._ascending=s.cmp.bind(s),this._descending=(e,t)=>s.cmp(t,e),this._max=(e,t)=>s.cmp(e,t)>0?e:t,this._min=(e,t)=>s.cmp(e,t)<0?e:t,this._IDBKeyRange=e._deps.IDBKeyRange}))}(this),this.on("versionchange",(e=>{e.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(e=>{!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)})),this._maxKey=dn(t.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),_t.filter((e=>e.name===this.name&&e!==this&&!e._state.vcFired)).map((t=>t.on("versionchange").fire(e)))},this.use(Mn),this.use(Nn),this.use(Gn),this.use($n),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((e=>e(this)))}version(e){if(isNaN(e)||e<.1)throw new J.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new J.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const t=this._versions;var n=t.filter((t=>t._cfg.version===e))[0];return n||(n=new this.Version(e),t.push(n),t.sort(_n),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||Oe.letThrough||this._vip)?e():new Be(((e,t)=>{if(this._state.openComplete)return t(new J.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new J.DatabaseClosed);this.open().catch(te)}this._state.dbReadyPromise.then(e,t)})).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});const s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:t,level:null==n?10:n,name:r}),s.sort(((e,t)=>e.level-t.level)),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter((e=>n?e.create!==n:!!t&&e.name!==t))),this}open(){return function(e){const t=e._state,{indexedDB:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((()=>t.dbOpenError?pt(t.dbOpenError):e));M&&(t.openCanceller._stackHolder=$()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const s=t.openCanceller;function i(){if(t.openCanceller!==s)throw new J.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,a=null,l=!1;const u=()=>new Be(((s,o)=>{if(i(),!r)throw new J.MissingAPI;const u=e.name,c=t.autoSchema?r.open(u):r.open(u,Math.round(10*e.verno));if(!c)throw new J.MissingAPI;c.onerror=nn(o),c.onblocked=ze(e._fireOnBlocked),c.onupgradeneeded=ze((n=>{if(a=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=rn,a.abort(),c.result.close();const e=r.deleteDatabase(u);e.onsuccess=e.onerror=ze((()=>{o(new J.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{a.onerror=nn(o);var s=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;l=s<1,e._novip.idbdb=c.result,xn(e,s/10,a,o)}}),o),c.onsuccess=ze((()=>{a=null;const r=e._novip.idbdb=c.result,i=y(r.objectStoreNames);if(i.length>0)try{const s=r.transaction(1===(o=i).length?o[0]:o,"readonly");t.autoSchema?function({_novip:e},t,r){e.verno=t.version/10;const s=e._dbSchema=Sn(0,t,r);e._storeNames=y(t.objectStoreNames,0),vn(e,[e._allTables],n(s),s)}(e,r,s):(Kn(e,e._dbSchema,s),function(e,t){const n=kn(Sn(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((e=>e.add.length||e.change.length)))}(e,s)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),gn(e,s)}catch(e){}var o;_t.push(e),r.onversionchange=ze((n=>{t.vcFired=!0,e.on("versionchange").fire(n)})),r.onclose=ze((t=>{e.on("close").fire(t)})),l&&function({indexedDB:e,IDBKeyRange:t},n){!Cn(e)&&n!==St&&An(e,t).put({name:n}).catch(te)}(e._deps,u),s()}),o)})).catch((e=>e&&"UnknownError"===e.name&&t.PR1398_maxLoop>0?(t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),u()):Be.reject(e)));return Be.race([s,("undefined"==typeof navigator?Be.resolve():Bn()).then(u)]).then((()=>(i(),t.onReadyBeingFired=[],Be.resolve(jn((()=>e.on.ready.fire(e.vip)))).then((function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(ue,te);return t.onReadyBeingFired=[],Be.resolve(jn((()=>r(e.vip)))).then(n)}}))))).finally((()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1})).then((()=>e)).catch((n=>{t.dbOpenError=n;try{a&&a.abort()}catch(e){}return s===t.openCanceller&&e._close(),pt(n)})).finally((()=>{t.openComplete=!0,o()}))}(this)}_close(){const e=this._state,t=_t.indexOf(this);if(t>=0&&_t.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new Be((t=>{e.dbReadyResolve=t})),e.openCanceller=new Be(((t,n)=>{e.cancelOpen=n}))}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new J.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,t=this._state;return new Be(((n,r)=>{const s=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=ze((()=>{!function({indexedDB:e,IDBKeyRange:t},n){!Cn(e)&&n!==St&&An(e,t).delete(n).catch(te)}(this._deps,this.name),n()})),e.onerror=nn(r),e.onblocked=this._fireOnBlocked};if(e)throw new J.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(s):s()}))}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){const e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return n(this._allTables).map((e=>this._allTables[e]))}transaction(){const e=In.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r=Oe.trans;r&&r.db===this&&-1===e.indexOf("!")||(r=null);const s=-1!==e.indexOf("?");let i,o;e=e.replace("!","").replace("?","");try{if(o=t.map((e=>{var t=e instanceof this.Table?e.name:e;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t})),"r"==e||e===Kt)i=Kt;else{if("rw"!=e&&e!=Ot)throw new J.InvalidArgument("Invalid transaction mode: "+e);i=Ot}if(r){if(r.mode===Kt&&i===Ot){if(!s)throw new J.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((e=>{if(r&&-1===r.storeNames.indexOf(e)){if(!s)throw new J.SubTransaction("Table "+e+" not included in parent transaction.");r=null}})),s&&r&&!r.active&&(r=null)}}catch(e){return r?r._promise(null,((t,n)=>{n(e)})):pt(e)}const a=Tn.bind(null,this,i,o,r,n);return r?r._promise(i,a,"lock"):Oe.trans?lt(Oe.transless,(()=>this._whenReady(a))):this._whenReady(a)}table(e){if(!a(this._allTables,e))throw new J.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Xn="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class Jn{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[Xn](){return this}}function Zn(e,t){return n(t).forEach((n=>{Wn(e[n]||(e[n]=new Un),t[n])})),e}let er;try{er={indexedDB:t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,IDBKeyRange:t.IDBKeyRange||t.webkitIDBKeyRange}}catch(t){er={indexedDB:null,IDBKeyRange:null}}const tr=Qn;function nr(e){let t=rr;try{rr=!0,an.storagemutated.fire(e)}finally{rr=t}}l(tr,{...ee,delete:e=>new tr(e,{addons:[]}).delete(),exists:e=>new tr(e,{addons:[]}).open().then((e=>(e.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(e){try{return function({indexedDB:e,IDBKeyRange:t}){return Cn(e)?Promise.resolve(e.databases()).then((e=>e.map((e=>e.name)).filter((e=>e!==St)))):An(e,t).toCollection().primaryKeys()}(tr.dependencies).then(e)}catch(e){return pt(new J.MissingAPI)}},defineClass:()=>function(e){s(this,e)},ignoreTransaction:e=>Oe.trans?lt(Oe.transless,e):e(),vip:jn,async:function(e){return function(){try{var t=Dn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Be.resolve(t)}catch(e){return pt(e)}}},spawn:function(e,t,n){try{var r=Dn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Be.resolve(r)}catch(e){return pt(e)}},currentTransaction:{get:()=>Oe.trans||null},waitFor:function(e,t){const n=Be.resolve("function"==typeof e?tr.ignoreTransaction(e):e).timeout(t||6e4);return Oe.trans?Oe.trans.waitFor(n):n},Promise:Be,debug:{get:()=>M,set:e=>{F(e,"dexie"===e?()=>!0:Pt)}},derive:h,extend:s,props:l,override:m,Events:Dt,on:an,liveQuery:function(e){let t,r=!1;const s=new Jn((s=>{const i=R(e);let o=!1,a={},l={};const u={get closed(){return o},unsubscribe:()=>{o=!0,an.storagemutated.unsubscribe(f)}};s.start&&s.start(u);let c=!1,h=!1;function d(){return n(l).some((e=>a[e]&&function(e,t){const n=Yn(t);let r=n.next();if(r.done)return!1;let s=r.value;const i=Yn(e);let o=i.next(s.from),a=o.value;for(;!r.done&&!o.done;){if(Lt(a.from,s.to)<=0&&Lt(a.to,s.from)>=0)return!0;Lt(s.from,a.from)<0?s=(r=n.next(a.from)).value:a=(o=i.next(s.from)).value}return!1}(a[e],l[e])))}const f=e=>{Zn(a,e),d()&&p()},p=()=>{if(c||o)return;a={};const n={},y=function(t){i&&tt();const n=()=>et(e,{subscr:t,trans:null}),r=Oe.trans?lt(Oe.transless,n):n();return i&&r.then(nt,nt),r}(n);h||(an(sn,f),h=!0),c=!0,Promise.resolve(y).then((e=>{r=!0,t=e,c=!1,o||(d()?p():(a={},l=n,s.next&&s.next(e)))}),(e=>{c=!1,r=!1,s.error&&s.error(e),u.unsubscribe()}))};return p(),u}));return s.hasValue=()=>r,s.getValue=()=>t,s},extendObservabilitySet:Zn,getByKeyPath:w,setByKeyPath:_,delByKeyPath:function(e,t){"string"==typeof t?_(e,t,void 0):"length"in t&&[].map.call(t,(function(t){_(e,t,void 0)}))},shallowClone:x,deepClone:O,getObjectDiff:Fn,cmp:Lt,asap:g,minKey:gt,addons:[],connections:_t,errnames:Q,dependencies:er,semVer:mt,version:mt.split(".").map((e=>parseInt(e))).reduce(((e,t,n)=>e+t/Math.pow(10,2*n)))}),tr.maxKey=dn(tr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(an(sn,(e=>{if(!rr){let t;xt?(t=document.createEvent("CustomEvent"),t.initCustomEvent(on,!0,!0,e)):t=new CustomEvent(on,{detail:e}),rr=!0,dispatchEvent(t),rr=!1}})),addEventListener(on,(({detail:e})=>{rr||nr(e)})));let rr=!1;if("undefined"!=typeof BroadcastChannel){const e=new BroadcastChannel(on);"function"==typeof e.unref&&e.unref(),an(sn,(t=>{rr||e.postMessage(t)})),e.onmessage=e=>{e.data&&nr(e.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){an(sn,(e=>{try{rr||("undefined"!=typeof localStorage&&localStorage.setItem(on,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((t=>t.postMessage({type:on,changedParts:e}))))}catch(e){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(e=>{if(e.key===on){const t=JSON.parse(e.newValue);t&&nr(t.changedParts)}}));const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",(function({data:e}){e&&e.type===on&&nr(e.changedParts)}))}Be.rejectionMapper=function(e,t){if(!e||e instanceof Y||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Z[e.name])return e;var n=new Z[e.name](t||e.message,e);return"stack"in e&&c(n,"stack",{get:function(){return this.inner.stack}}),n},F(M,Pt);class sr{constructor(e,t,n){this.name=e,this.table=t,this.keys=n}database(){const e=new Qn(this.name);let t=1;for(let n of this.keys)e.version(t).stores({[this.table]:n}),t++;return e}async save(e){const t=this.database();await t[this.table].bulkPut(e).then((()=>{t.close()})).catch((e=>{throw console.error("Error in db.save",e),e}))}async read(e="name"){const t=this.database();return await t[this.table].orderBy(e).toArray().then((e=>(t.close(),e))).catch((e=>{throw console.error("Error in db.read",errerr),e}))}async getFirstRow(){const e=this.database();return await e[this.table].orderBy(":id").first().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.getFirstRow",e),e}))}async delete(){const e=new Qn(this.name);await e.delete().then((()=>{e.close()})).catch((e=>{throw console.warn("Error in db.delete",e),e}))}async count(){const e=this.database();return await e[this.table].count().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.count",e),e}))}async getVersion(){const e=await new Qn(this.name).open().then((e=>{const t=e.verno;return e.close(),t})).catch((e=>{throw console.error("Error in db.getVersion",e),e}));return e}}const ir=window.wp.apiFetch;var or=e.n(ir);async function ar(e,t){try{await or().use(or().createNonceMiddleware(pluginAllSitesMenu.nonce));const n=await or()({url:pluginAllSitesMenu.restURL,method:"POST",data:{offset:t}}).catch((e=>{throw console.error("Error in apiFetch",e),e}));"success"===n.response&&(t+=pluginAllSitesMenu.loadincrements,e.save(n.data),await ar(e,t))}catch(e){throw console.error("Error in loadSites",e),e}}function lr(e,t){if(!e)return;e.classList&&e.classList.add?e.classList.add(t):cr(e,t)||(e.className&&(e.className+=" "),e.className+=t);let n=e.getBoundingClientRect().top,r=e.querySelector(".ab-submenu");r.style.top=n-6+"px",r.getBoundingClientRect().bottom>window.innerHeight&&(r.style.top="auto",r.style.bottom="0")}function ur(e,t){let n,r;if(e||cr(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=` ${t} `,r=` ${e.className} `;r.indexOf(n)>-1;)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function cr(e,t){let n;return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&(n=e.className.split(" "),n.indexOf(t)>-1))}const hr=window.wp.i18n;document.addEventListener("DOMContentLoaded",(async()=>{if(!document.getElementById("wpadminbar"))return;const e={load:document.querySelector("#wp-admin-bar-load-more"),menu:document.querySelector("#wp-admin-bar-my-sites-list"),timestamp:document.querySelector("#load-more-timestamp")};!0===pluginAllSitesMenu.displaySearch&&function(){const e=document.querySelector("#all-sites-search-text");null!==e&&e.addEventListener("keyup",(e=>{e.preventDefault();const t=e.target.value.toUpperCase(),n=document.querySelector("#wp-admin-bar-my-sites-list").getElementsByClassName("menupop");for(let e=0;e<n.length;e++){let r=n[e].querySelector(".ab-item");(r.textContent||r.innerText).toUpperCase().indexOf(t)>-1?n[e].style.display="":n[e].style.display="none"}}))}();const t=new sr("allsites","sites",["id,name,url","id,name,url,timestamp"]);var n;n=e.menu,new IntersectionObserver((e=>{e.forEach((e=>{const t=e.boundingClientRect,n=t.bottom<window.innerHeight&&t.bottom;if(window.matchMedia("(min-width: 783px)").matches){const e=document.querySelector("#wp-admin-bar-my-sites>.ab-sub-wrapper");n?(e.style.height="",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="0"):(e.style.height="calc(100vh - 32px)",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="32px")}}))}),{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]}).observe(n),await async function(e){const t=await e.getFirstRow();void 0!==t&&void 0!==t.timestamp&&pluginAllSitesMenu.timestamp>t.timestamp&&await e.delete();0===await e.count()&&ar(e,0)}(t);const r=function(e,t){const n=new IntersectionObserver((n=>{n.forEach((e=>{const{isIntersecting:n}=e;n&&t()}),{root:e})}));return n.observe(e),n}(e.load,(async()=>{const n=(await t.read(pluginAllSitesMenu.orderBy)).reduce(((e,t)=>e+function(e){return`\n\t\t\t\t<li id="wp-admin-bar-${e.id}" class="menupop">\n\t\t\t\t<a class="ab-item" aria-haspopup="true" href="${e.admin}/"><span class="wp-admin-bar-arrow" aria-hidden="true"></span>\n\t\t\t\t\t${e.title}\n\t\t\t\t</a>\n\t\t\t\t<div class="ab-sub-wrapper">\n\t\t\t\t\t<ul id="wp-admin-bar-${e.id}-default" class="ab-submenu">\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-d"><a class="ab-item"\thref="${e.admin}">${(0,hr.__)("Dashboard","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-n"><a class="ab-item" href="${e.admin}/post-new.php">${(0,hr.__)("New Post","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-o"><a class="ab-item" href="${e.admin}/post-new.php?post_type=page">${(0,hr.__)("New Page","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-c"><a class="ab-item" href="${e.admin}/edit-comments.php">${(0,hr.__)("Manage Comments","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-u"><a class="ab-item" href="${e.admin}/users.php">${(0,hr.__)("Users","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-p"><a class="ab-item" href="${e.admin}/plugins.php">${(0,hr.__)("Plugins","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-s"><a class="ab-item" href="${e.admin}/options-general.php">${(0,hr.__)("Settings","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-v"><a class="ab-item" href="${e.url}/">${(0,hr.__)("Visit","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t`}(t)),"");e.load.insertAdjacentHTML("beforeBegin",n),function(){const e=document.getElementById("wp-admin-bar-my-sites-list");e&&(e.addEventListener("mouseenter",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&lr(e.target,"hover")}),{capture:!0}),e.addEventListener("mouseleave",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&ur(e.target,"hover")}),{capture:!0}),e.addEventListener("keydown",(e=>{"Tab"===e.key&&(e.preventDefault(),e.target.classList.contains("menupop")&&toggleClass(e.target,"hover"))}),{capture:!0}))}(),e.load.style.display="none",r.unobserve(e.load)}))}))})();7 */(()=>{var e={744:function(e,t,n){e.exports=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},t=function(){return(t=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)};function r(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,o=Object.keys,a=Array.isArray;function u(e,t){return"object"!=typeof t||o(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||i.Promise||(i.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))),("undefined"==typeof Reflect?o:Reflect.ownKeys)(t).forEach((function(n){d(e,n,t[n])}))}var h=Object.defineProperty;function d(e,t,n,r){h(e,t,u(n&&l(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function p(e){return{from:function(t){return e.prototype=Object.create(t.prototype),d(e.prototype,"constructor",e),{extend:f.bind(null,e.prototype)}}}}var y=Object.getOwnPropertyDescriptor,m=[].slice;function v(e,t,n){return m.call(e,t,n)}function b(e,t){return t(e)}function g(e){if(!e)throw new Error("Assertion Failed")}function w(e){i.setImmediate?setImmediate(e):setTimeout(e,0)}function _(e,t){if("string"==typeof t&&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=_(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(-1!==a){var u=e[t.substr(0,a)];return null==u?void 0:_(u,t.substr(a+1))}}function x(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){g("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)x(e,t[r],n[r])}else{var o,u,s=t.indexOf(".");-1!==s?(o=t.substr(0,s),""===(u=t.substr(s+1))?void 0===n?a(e)&&!isNaN(parseInt(o))?e.splice(o,1):delete e[o]:e[o]=n:x(s=(s=e[o])&&l(e,o)?s:e[o]={},u,n)):void 0===n?a(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function k(e){var t,n={};for(t in e)l(e,t)&&(n[t]=e[t]);return n}var O=[].concat;function P(e){return O.apply([],e)}var E="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".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 i[e]})),S=new Set(E.map((function(e){return i[e]}))),K=null;function A(e){return K=new WeakMap,e=function e(t){if(!t||"object"!=typeof t)return t;var n=K.get(t);if(n)return n;if(a(t)){n=[],K.set(t,n);for(var r=0,i=t.length;r<i;++r)n.push(e(t[r]))}else if(S.has(t.constructor))n=t;else{var o,u=s(t);for(o in n=u===Object.prototype?{}:Object.create(u),K.set(t,n),t)l(t,o)&&(n[o]=e(t[o]))}return n}(e),K=null,e}var C={}.toString;function j(e){return C.call(e).slice(8,-1)}var q="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",T="symbol"==typeof q?function(e){var t;return null!=e&&(t=e[q])&&t.apply(e)}:function(){return null};function B(e,t){return 0<=(t=e.indexOf(t))&&e.splice(t,1),0<=t}var D={};function I(e){var t,n,r,i;if(1===arguments.length){if(a(e))return e.slice();if(this===D&&"string"==typeof e)return[e];if(i=T(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"!=typeof(t=e.length))return[e];for(n=new Array(t);t--;)n[t]=e[t];return n}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var R="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},M=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(se=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"]),N={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function F(e,t){this.name=e,this.message=t}function L(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 $(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=L(e,t)}function U(e,t){this.name="BulkError",this.failures=Object.keys(t).map((function(e){return t[e]})),this.failuresByPos=t,this.message=L(e,this.failures)}p(F).from(Error).extend({toString:function(){return this.name+": "+this.message}}),p($).from(F),p(U).from(F);var V=M.reduce((function(e,t){return e[t]=t+"Error",e}),{}),z=F,W=M.reduce((function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==typeof e&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=N[t]||n,this.inner=null)}return p(r).from(z),e[t]=r,e}),{});W.Syntax=SyntaxError,W.Type=TypeError,W.Range=RangeError;var Y=se.reduce((function(e,t){return e[t+"Error"]=W[t],e}),{}),Q=M.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=W[t]),e}),{});function G(){}function H(e){return e}function X(e,t){return null==e||e===H?t:function(n){return t(e(n))}}function J(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Z(e,t){return e===G?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?J(r,this.onsuccess):r),i&&(this.onerror=this.onerror?J(i,this.onerror):i),void 0!==o?o:n}}function ee(e,t){return e===G?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?J(n,this.onsuccess):n),r&&(this.onerror=this.onerror?J(r,this.onerror):r)}}function te(e,t){return e===G?t:function(n){var r=e.apply(this,arguments);u(n,r);var i=this.onsuccess,o=this.onerror;return this.onsuccess=null,this.onerror=null,n=t.apply(this,arguments),i&&(this.onsuccess=this.onsuccess?J(i,this.onsuccess):i),o&&(this.onerror=this.onerror?J(o,this.onerror):o),void 0===r?void 0===n?void 0:n:u(r,n)}}function ne(e,t){return e===G?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function re(e,t){return e===G?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)}}Q.ModifyError=$,Q.DexieError=F,Q.BulkError=U;var ie="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function oe(e){ie=e}var ae={},ue=100,se=(E="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,s(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,s(t),e]}(),E[0]),ce=(M=E[1],E=E[2],M=M&&M.then,se&&se.constructor),le=!!E,fe=function(e,t){ge.push([e,t]),de&&(queueMicrotask(Ae),de=!1)},he=!0,de=!0,pe=[],ye=[],me=H,ve={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:G,pgp:!1,env:{},finalize:G},be=ve,ge=[],we=0,_e=[];function xe(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=be;if("function"!=typeof e){if(e!==ae)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Pe(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&&Ce();n&&"function"==typeof n.then?e(t,(function(e,t){n instanceof xe?n._then(e,t):n.then(e,t)})):(t._state=!0,t._value=n,Ee(t)),r&&je()}}),Pe.bind(null,t))}catch(n){Pe(t,n)}}(this,e)}var ke={get:function(){var e=be,t=Ne;function n(n,r){var i=this,o=!e.global&&(e!==be||t!==Ne),a=o&&!Ue(),u=new xe((function(t,u){Se(i,new Oe(Ge(n,e,o,a),Ge(r,e,o,a),t,u,e))}));return this._consoleTask&&(u._consoleTask=this._consoleTask),u}return n.prototype=ae,n},set:function(e){d(this,"then",e&&e.prototype===ae?ke:{get:function(){return e},set:ke.set})}};function Oe(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 Pe(e,t){var n,r;ye.push(t),null===e._state&&(n=e._lib&&Ce(),t=me(t),e._state=!1,e._value=t,r=e,pe.some((function(e){return e._value===r._value}))||pe.push(r),Ee(e),n&&je())}function Ee(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Se(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===we&&(++we,fe((function(){0==--we&&qe()}),[]))}function Se(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,++we,fe(Ke,[n,e,t])}else e._listeners.push(t)}function Ke(e,t,n){try{var r,i=t._value;!t._state&&ye.length&&(ye=[]),r=ie&&t._consoleTask?t._consoleTask.run((function(){return e(i)})):e(i),t._state||-1!==ye.indexOf(i)||function(e){for(var t=pe.length;t;)if(pe[--t]._value===e._value)return pe.splice(t,1)}(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--we&&qe(),--n.psd.ref||n.psd.finalize()}}function Ae(){Qe(ve,(function(){Ce()&&je()}))}function Ce(){var e=he;return de=he=!1,e}function je(){var e,t,n;do{for(;0<ge.length;)for(e=ge,ge=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(0<ge.length);de=he=!0}function qe(){var e=pe;pe=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=_e.slice(0),n=t.length;n;)t[--n]()}function Te(e){return new xe(ae,!1,e)}function Be(e,t){var n=be;return function(){var r=Ce(),i=be;try{return We(n,!0),e.apply(this,arguments)}catch(r){t&&t(r)}finally{We(i,!1),r&&je()}}}f(xe.prototype,{then:ke,_then:function(e,t){Se(this,new Oe(null,null,e,t,be))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=e,n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return(e instanceof t?n:Te)(e)})):this.then(null,(function(e){return(e&&e.name===t?n:Te)(e)}))},finally:function(e){return this.then((function(t){return xe.resolve(e()).then((function(){return t}))}),(function(t){return xe.resolve(e()).then((function(){return Te(t)}))}))},timeout:function(e,t){var n=this;return e<1/0?new xe((function(r,i){var o=setTimeout((function(){return i(new W.Timeout(t))}),e);n.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&d(xe.prototype,Symbol.toStringTag,"Dexie.Promise"),ve.env=Ye(),f(xe,{all:function(){var e=I.apply(null,arguments).map(Ve);return new xe((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(i,o){return xe.resolve(i).then((function(n){e[o]=n,--r||t(e)}),n)}))}))},resolve:function(e){return e instanceof xe?e:e&&"function"==typeof e.then?new xe((function(t,n){e.then(t,n)})):new xe(ae,!0,e)},reject:Te,race:function(){var e=I.apply(null,arguments).map(Ve);return new xe((function(t,n){e.map((function(e){return xe.resolve(e).then(t,n)}))}))},PSD:{get:function(){return be},set:function(e){return be=e}},totalEchoes:{get:function(){return Ne}},newPSD:Le,usePSD:Qe,scheduler:{get:function(){return fe},set:function(e){fe=e}},rejectionMapper:{get:function(){return me},set:function(e){me=e}},follow:function(e,t){return new xe((function(n,r){return Le((function(t,n){var r=be;r.unhandleds=[],r.onunhandled=n,r.finalize=J((function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},_e.push((function t(){e(),_e.splice(_e.indexOf(t),1)})),++we,fe((function(){0==--we&&qe()}),[])}),r.finalize),e()}),t,n,r)}))}}),ce&&(ce.allSettled&&d(xe,"allSettled",(function(){var e=I.apply(null,arguments).map(Ve);return new xe((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);e.forEach((function(e,i){return xe.resolve(e).then((function(e){return r[i]={status:"fulfilled",value:e}}),(function(e){return r[i]={status:"rejected",reason:e}})).then((function(){return--n||t(r)}))}))}))})),ce.any&&"undefined"!=typeof AggregateError&&d(xe,"any",(function(){var e=I.apply(null,arguments).map(Ve);return new xe((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach((function(e,o){return xe.resolve(e).then((function(e){return t(e)}),(function(e){i[o]=e,--r||n(new AggregateError(i))}))}))}))})),ce.withResolvers&&(xe.withResolvers=ce.withResolvers));var De={awaits:0,echoes:0,id:0},Ie=0,Re=[],Me=0,Ne=0,Fe=0;function Le(e,t,n,r){var i=be,o=Object.create(i);return o.parent=i,o.ref=0,o.global=!1,o.id=++Fe,ve.env,o.env=le?{Promise:xe,PromiseProp:{value:xe,configurable:!0,writable:!0},all:xe.all,race:xe.race,allSettled:xe.allSettled,any:xe.any,resolve:xe.resolve,reject:xe.reject}:{},t&&u(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()},r=Qe(o,e,n,r),0===o.ref&&o.finalize(),r}function $e(){return De.id||(De.id=++Ie),++De.awaits,De.echoes+=ue,De.id}function Ue(){return!!De.awaits&&(0==--De.awaits&&(De.id=0),De.echoes=De.awaits*ue,!0)}function Ve(e){return De.echoes&&e&&e.constructor===ce?($e(),e.then((function(e){return Ue(),e}),(function(e){return Ue(),Xe(e)}))):e}function ze(){var e=Re[Re.length-1];Re.pop(),We(e,!1)}function We(e,t){var n,r=be;(t?!De.echoes||Me++&&e===be:!Me||--Me&&e===be)||queueMicrotask(t?function(e){++Ne,De.echoes&&0!=--De.echoes||(De.echoes=De.awaits=De.id=0),Re.push(be),We(e,!0)}.bind(null,e):ze),e!==be&&(be=e,r===ve&&(ve.env=Ye()),le&&(n=ve.env.Promise,t=e.env,(r.global||e.global)&&(Object.defineProperty(i,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function Ye(){var e=i.Promise;return le?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Qe(e,t,n,r,i){var o=be;try{return We(e,!0),t(n,r,i)}finally{We(o,!1)}}function Ge(e,t,n,r){return"function"!=typeof e?e:function(){var i=be;n&&$e(),We(t,!0);try{return e.apply(this,arguments)}finally{We(i,!1),r&&queueMicrotask(Ue)}}}function He(e){Promise===ce&&0===De.echoes?0===Me?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+M).indexOf("[native code]")&&($e=Ue=G);var Xe=xe.reject,Je=String.fromCharCode(65535),Ze="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",et="String expected.",tt=[],nt="__dbnames",rt="readonly",it="readwrite";function ot(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var at={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function ut(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=A(t))[e],t}}function st(){throw W.Type()}function ct(e,t){try{var n=lt(e),r=lt(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}(ft(e),ft(t));case"Array":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=ct(e[o],t[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function lt(e){var t=typeof e;return"object"!=t?t:ArrayBuffer.isView(e)||"ArrayBuffer"===(e=j(e))?"binary":e}function ft(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var ht=(dt.prototype._trans=function(e,t,n){var r=this._tx||be.trans,i=this.name,o=ie&&"undefined"!=typeof console&&console.createTask&&console.createTask("Dexie: ".concat("readonly"===e?"read":"write"," ").concat(this.name));function a(e,n,r){if(!r.schema[i])throw new W.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var u=Ce();try{var s=r&&r.db._novip===this.db._novip?r===be.trans?r._promise(e,a,n):Le((function(){return r._promise(e,a,n)}),{trans:r,transless:be.transless||be}):function e(t,n,r,i){if(t.idbdb&&(t._state.openComplete||be.letThrough||t._vip)){var o=t._createTransaction(n,r,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===V.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,i)}))):Xe(o)}return o._promise(n,(function(e,t){return Le((function(){return be.trans=o,i(e,t,o)}))})).then((function(e){if("readwrite"===n)try{o.idbtrans.commit()}catch(e){}return"readonly"===n?e:o._completion.then((function(){return e}))}))}if(t._state.openComplete)return Xe(new W.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return Xe(new W.DatabaseClosed);t.open().catch(G)}return t._state.dbReadyPromise.then((function(){return e(t,n,r,i)}))}(this.db,e,[this.name],a);return o&&(s._consoleTask=o,s=s.catch((function(e){return console.trace(e),Xe(e)}))),s}finally{u&&je()}},dt.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?Xe(new W.Type("Invalid argument to Table.get()")):this._trans("readonly",(function(t){return n.core.get({trans:t,key:e}).then((function(e){return n.hook.reading.fire(e)}))})).then(t)},dt.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(a(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=o(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){if(e.compound&&t.every((function(t){return 0<=e.keyPath.indexOf(t)}))){for(var n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort((function(e,t){return e.keyPath.length-t.keyPath.length}))[0];if(n&&this.db._maxKey!==Je){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map((function(t){return e[t]})))}!n&&ie&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var i=this.schema.idxByName;function u(e,t){return 0===ct(e,t)}var s=t.reduce((function(t,n){var r=t[0],o=t[1],s=(t=i[n],e[n]);return[r||t,r||!t?ot(o,t&&t.multi?function(e){return e=_(e,n),a(e)&&e.some((function(e){return u(s,e)}))}:function(e){return u(s,_(e,n))}):o]}),[null,null]);return r=s[0],s=s[1],r?this.where(r.name).equals(e[r.keyPath]).filter(s):n?this.filter(s):this.where(t).equals("")},dt.prototype.filter=function(e){return this.toCollection().and(e)},dt.prototype.count=function(e){return this.toCollection().count(e)},dt.prototype.offset=function(e){return this.toCollection().offset(e)},dt.prototype.limit=function(e){return this.toCollection().limit(e)},dt.prototype.each=function(e){return this.toCollection().each(e)},dt.prototype.toArray=function(e){return this.toCollection().toArray(e)},dt.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},dt.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,a(e)?"[".concat(e.join("+"),"]"):e))},dt.prototype.reverse=function(){return this.toCollection().reverse()},dt.prototype.mapToClass=function(t){var n,r=this.db,i=this.name;function o(){return null!==n&&n.apply(this,arguments)||this}(this.schema.mappedClass=t).prototype instanceof st&&(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(o,n=t),Object.defineProperty(o.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),o.prototype.table=function(){return i},t=o);for(var a=new Set,u=t.prototype;u;u=s(u))Object.getOwnPropertyNames(u).forEach((function(e){return a.add(e)}));function c(e){if(!e)return e;var n,r=Object.create(t.prototype);for(n in e)if(!a.has(n))try{r[n]=e[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=c,this.hook("reading",c),t},dt.prototype.defineClass=function(){return this.mapToClass((function(e){u(this,e)}))},dt.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=ut(o)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{x(e,o,t)}catch(t){}return t}))},dt.prototype.update=function(e,t){return"object"!=typeof e||a(e)?this.where(":id").equals(e).modify(t):void 0===(e=_(e,this.schema.primKey.keyPath))?Xe(new W.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},dt.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=ut(o)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{x(e,o,t)}catch(t){}return t}))},dt.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?xe.reject(e.failures[0]):void 0}))},dt.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(t){return e.core.mutate({trans:t,type:"deleteRange",range:at})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):void 0}))},dt.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",(function(n){return t.core.getMany({keys:e,trans:n}).then((function(e){return e.map((function(e){return t.hook.reading.fire(e)}))}))}))},dt.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(u=r.schema.primKey).auto;if((u=u.keyPath)&&i)throw new W.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new W.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,u=u&&n?e.map(ut(u)):e;return r.core.mutate({trans:t,type:"add",keys:i,values:u,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult;if(e=e.failures,0===t)return o?n:i;throw new U("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},dt.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(u=r.schema.primKey).auto;if((u=u.keyPath)&&i)throw new W.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new W.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,u=u&&n?e.map(ut(u)):e;return r.core.mutate({trans:t,type:"put",keys:i,values:u,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult;if(e=e.failures,0===t)return o?n:i;throw new U("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},dt.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map((function(e){return e.key})),i=e.map((function(e){return e.changes})),o=[];return this._trans("readwrite",(function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then((function(u){var s=[],c=[];e.forEach((function(e,n){var r=e.key,i=e.changes,a=u[n];if(a){for(var l=0,f=Object.keys(i);l<f.length;l++){var h=f[l],d=i[h];if(h===t.schema.primKey.keyPath){if(0!==ct(d,r))throw new W.Constraint("Cannot update primary key in bulkUpdate()")}else x(a,h,d)}o.push(n),s.push(r),c.push(a)}}));var l=s.length;return n.mutate({trans:a,type:"put",keys:s,values:c,updates:{keys:r,changeSpecs:i}}).then((function(e){var n=e.numFailures,r=e.failures;if(0===n)return l;for(var i=0,a=Object.keys(r);i<a.length;i++){var u,s=a[i],c=o[Number(s)];null!=c&&(u=r[s],delete r[s],r[c]=u)}throw new U("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)}))}))}))},dt.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:e})})).then((function(e){var r=e.numFailures,i=e.lastResult;if(e=e.failures,0===r)return i;throw new U("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),e)}))},dt);function dt(){}function pt(e){function t(t,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return n[t].subscribe.apply(null,o),e}if("string"==typeof t)return n[t]}var n={};t.addEventType=u;for(var r=1,i=arguments.length;r<i;++r)u(arguments[r]);return t;function u(e,r,i){if("object"!=typeof e){var s;r=r||ne;var c={subscribers:[],fire:i=i||G,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,i)}};return n[e]=t[e]=c}o(s=e).forEach((function(e){var t=s[e];if(a(t))u(e,s[e][0],s[e][1]);else{if("asap"!==t)throw new W.InvalidArgument("Invalid event config");var n=u(e,H,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){w((function(){e.apply(null,t)}))}))}))}}))}}function yt(e,t){return p(t).from({prototype:e}),t}function mt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function vt(e,t){e.filter=ot(e.filter,t)}function bt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return ot(r(),t())}:t,e.justLimit=n&&!r}function gt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new W.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function wt(e,t,n){var r=gt(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 _t(e,t,n,r){var i=e.replayFilter?ot(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(e,n,r){var a,u;i&&!i(n,r,(function(e){return n.stop(e)}),(function(e){return n.fail(e)}))||("[object ArrayBuffer]"==(u=""+(a=n.primaryKey))&&(u=""+new Uint8Array(a)),l(o,u)||(o[u]=!0,t(e,n,r)))};return Promise.all([e.or._iterate(a,n),xt(wt(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return xt(wt(e,r,n),ot(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function xt(e,t,n,r){var i=Be(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=G}),(function(t){e.fail(t),n=G}))||i(e.value,e,(function(e){return n=e})),n()}))}))}E=Symbol();var kt=(Ot.prototype.execute=function(e){if(void 0!==this.add){var t=this.add;if(a(t))return r(r([],a(e)?e:[],!0),t,!0).sort();if("number"==typeof t)return(Number(e)||0)+t;if("bigint"==typeof t)try{return BigInt(e)+t}catch(e){return BigInt(0)+t}throw new TypeError("Invalid term ".concat(t))}if(void 0!==this.remove){var n=this.remove;if(a(n))return a(e)?e.filter((function(e){return!n.includes(e)})).sort():[];if("number"==typeof n)return Number(e)-n;if("bigint"==typeof n)try{return BigInt(e)-n}catch(e){return BigInt(0)-n}throw new TypeError("Invalid subtrahend ".concat(n))}return(t=null===(t=this.replacePrefix)||void 0===t?void 0:t[0])&&"string"==typeof e&&e.startsWith(t)?this.replacePrefix[1]+e.substring(t.length):e},Ot);function Ot(e){Object.assign(this,e)}var Pt=(Et.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,Xe.bind(null,n.error)):n.table._trans("readonly",e).then(t)},Et.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,Xe.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},Et.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=ot(t.algorithm,e)},Et.prototype._iterate=function(e,t){return _t(this._ctx,e,t,this._ctx.table.core)},Et.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&u(n,e),t._ctx=n,t},Et.prototype.raw=function(){return this._ctx.valueMapper=null,this},Et.prototype.each=function(e){var t=this._ctx;return this._read((function(n){return _t(t,e,n,t.table.core)}))},Et.prototype.count=function(e){var t=this;return this._read((function(e){var n=t._ctx,r=n.table.core;if(mt(n,!0))return r.count({trans:e,query:{index:gt(n,r.schema),range:n.range}}).then((function(e){return Math.min(e,n.limit)}));var i=0;return _t(n,(function(){return++i,!1}),e,r).then((function(){return i}))})).then(e)},Et.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 a="next"===this._ctx.dir?1:-1;function u(e,t){return ct(o(e,i),o(t,i))*a}return this.toArray((function(e){return e.sort(u)})).then(t)},Et.prototype.toArray=function(e){var t=this;return this._read((function(e){var n=t._ctx;if("next"===n.dir&&mt(n,!0)&&0<n.limit){var r=n.valueMapper,i=gt(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){return e=e.result,r?e.map(r):e}))}var o=[];return _t(n,(function(e){return o.push(e)}),e,n.table.core).then((function(){return o}))}),e)},Et.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,mt(t)?bt(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?--t:n((function(){e.advance(t),t=0})),!1)}})):bt(t,(function(){var t=e;return function(){return--t<0}}))),this},Et.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),bt(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),0<=t}}),!0),this},Et.prototype.until=function(e,t){return vt(this._ctx,(function(n,r,i){return!e(n.value)||(r(i),t)})),this},Et.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},Et.prototype.last=function(e){return this.reverse().first(e)},Et.prototype.filter=function(e){var t;return vt(this._ctx,(function(t){return e(t.value)})),(t=this._ctx).isMatch=ot(t.isMatch,e),this},Et.prototype.and=function(e){return this.filter(e)},Et.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},Et.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},Et.prototype.desc=function(){return this.reverse()},Et.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},Et.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},Et.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},Et.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)},Et.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&mt(t,!0)&&0<t.limit)return this._read((function(e){var n=gt(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)},Et.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},Et.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},Et.prototype.lastKey=function(e){return this.reverse().firstKey(e)},Et.prototype.distinct=function(){var e;if(!(e=(e=this._ctx).index&&e.table.schema.idxByName[e.index])||!e.multi)return this;var t={};return vt(this._ctx,(function(e){var n=e.primaryKey.toString();return e=l(t,n),t[n]=!0,!e})),this},Et.prototype.modify=function(e){var t=this,n=this._ctx;return this._write((function(r){var i,a,u;u="function"==typeof e?e:(i=o(e),a=i.length,function(t){for(var n=!1,r=0;r<a;++r){var o=i[r],u=e[o],s=_(t,o);u instanceof kt?(x(t,o,u.execute(s)),n=!0):s!==u&&(x(t,o,u),n=!0)}return n});var s,c=n.table.core,l=(s=c.schema.primaryKey).outbound,f=s.extractKey,h=200;function d(e,t){var n=t.failures;t=t.numFailures,y+=e-t;for(var r=0,i=o(n);r<i.length;r++){var a=i[r];p.push(n[a])}}(s=t.db._options.modifyChunkSize)&&(h="object"==typeof s?s[c.name]||s["*"]||200:s);var p=[],y=0,m=[];return t.clone().primaryKeys().then((function(t){function i(n){var a=Math.min(h,t.length-n);return c.getMany({trans:r,keys:t.slice(n,n+a),cache:"immutable"}).then((function(s){for(var p=[],y=[],m=l?[]:null,v=[],b=0;b<a;++b){var g=s[b],w={value:A(g),primKey:t[n+b]};!1!==u.call(w,w.value,w)&&(null==w.value?v.push(t[n+b]):l||0===ct(f(g),f(w.value))?(y.push(w.value),l&&m.push(t[n+b])):(v.push(t[n+b]),p.push(w.value)))}return Promise.resolve(0<p.length&&c.mutate({trans:r,type:"add",values:p}).then((function(e){for(var t in e.failures)v.splice(parseInt(t),1);d(p.length,e)}))).then((function(){return(0<y.length||o&&"object"==typeof e)&&c.mutate({trans:r,type:"put",keys:m,values:y,criteria:o,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:0<n}).then((function(e){return d(y.length,e)}))})).then((function(){return(0<v.length||o&&e===St)&&c.mutate({trans:r,type:"delete",keys:v,criteria:o,isAdditionalChunk:0<n}).then((function(e){return d(v.length,e)}))})).then((function(){return t.length>n+a&&i(n+h)}))}))}var o=mt(n)&&n.limit===1/0&&("function"!=typeof e||e===St)&&{index:n.index,range:n.range};return i(0).then((function(){if(0<p.length)throw new $("Error modifying one or more objects",p,y,m);return t.length}))}))}))},Et.prototype.delete=function(){var e=this._ctx,t=e.range;return mt(e)&&(e.isPrimKey||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;if(e.lastResult,e.results,e=e.numFailures)throw new $("Could not delete some values",Object.keys(n).map((function(e){return n[e]})),t-e);return t-e}))}))})):this.modify(St)},Et);function Et(){}var St=function(e,t){return t.value=null};function Kt(e,t){return e<t?-1:e===t?0:1}function At(e,t){return t<e?-1:e===t?0:1}function Ct(e,t,n){return(e=e instanceof Dt?new e.Collection(e):e)._ctx.error=new(n||TypeError)(t),e}function jt(e){return new e.Collection(e,(function(){return Bt("")})).limit(0)}function qt(e,t,n,r){var i,o,a,u,s,c,l,f=n.length;if(!n.every((function(e){return"string"==typeof e})))return Ct(e,et);function h(e){i="next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()},o="next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()},a="next"===e?Kt:At;var t=n.map((function(e){return{lower:o(e),upper:i(e)}})).sort((function(e,t){return a(e.lower,t.lower)}));u=t.map((function(e){return e.upper})),s=t.map((function(e){return e.lower})),l="next"===(c=e)?"":r}h("next"),(e=new e.Collection(e,(function(){return Tt(u[0],s[f-1]+r)})))._ondirectionchange=function(e){h(e)};var d=0;return e._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 m=function(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),u=-1,s=0;s<a;++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):0<=u?e.substr(0,u)+t[u]+n.substr(u+1):null;i(e[s],c)<0&&(u=s)}return a<r.length&&"next"===o?e+n.substr(e.length):a<e.length&&"prev"===o?e.substr(0,n.length):u<0?null:e.substr(0,u)+r[u]+n.substr(u+1)}(i,h,u[y],s[y],a,c);null===m&&null===p?d=y+1:(null===p||0<a(p,m))&&(p=m)}return n(null!==p?function(){e.continue(p+l)}:r),!1})),e}function Tt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Bt(e){return{type:1,lower:e,upper:e}}var Dt=(Object.defineProperty(It.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),It.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return 0<this._cmp(e,t)||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?jt(this):new this.Collection(this,(function(){return Tt(e,t,!n,!r)}))}catch(e){return Ct(this,Ze)}},It.prototype.equals=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Bt(e)}))},It.prototype.above=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Tt(e,void 0,!0)}))},It.prototype.aboveOrEqual=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Tt(e,void 0,!1)}))},It.prototype.below=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Tt(void 0,e,!1,!0)}))},It.prototype.belowOrEqual=function(e){return null==e?Ct(this,Ze):new this.Collection(this,(function(){return Tt(void 0,e)}))},It.prototype.startsWith=function(e){return"string"!=typeof e?Ct(this,et):this.between(e,e+Je,!0,!0)},It.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):qt(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],Je)},It.prototype.equalsIgnoreCase=function(e){return qt(this,(function(e,t){return e===t[0]}),[e],"")},It.prototype.anyOfIgnoreCase=function(){var e=I.apply(D,arguments);return 0===e.length?jt(this):qt(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},It.prototype.startsWithAnyOfIgnoreCase=function(){var e=I.apply(D,arguments);return 0===e.length?jt(this):qt(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,Je)},It.prototype.anyOf=function(){var e=this,t=I.apply(D,arguments),n=this._cmp;try{t.sort(n)}catch(r){return Ct(this,Ze)}if(0===t.length)return jt(this);var r=new this.Collection(this,(function(){return Tt(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 a=e.key;0<n(a,t[i]);)if(++i===t.length)return r(o),!1;return 0===n(a,t[i])||(r((function(){e.continue(t[i])})),!1)})),r},It.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},It.prototype.noneOf=function(){var e=I.apply(D,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Ct(this,Ze)}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})},It.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,a=this._min,u=this._max;if(0===e.length)return jt(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0})))return Ct(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",W.InvalidArgument);var s,c=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,f=i;function h(e,t){return f(e[0],t[0])}try{(s=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&&0<r(t[1],o[0])){o[0]=a(o[0],t[0]),o[1]=u(o[1],t[1]);break}}return n===i&&e.push(t),e}),[])).sort(h)}catch(e){return Ct(this,Ze)}var d=0,p=l?function(e){return 0<i(e,s[d][1])}:function(e){return 0<=i(e,s[d][1])},y=c?function(e){return 0<o(e,s[d][0])}:function(e){return 0<=o(e,s[d][0])},m=p;return(e=new this.Collection(this,(function(){return Tt(s[0][0],s[s.length-1][1],!c,!l)})))._ondirectionchange=function(e){f="next"===e?(m=p,i):(m=y,o),s.sort(h)},e._addAlgorithm((function(e,t,r){for(var o,a=e.key;m(a);)if(++d===s.length)return t(r),!1;return!p(o=a)&&!y(o)||(0===n._cmp(a,s[d][1])||0===n._cmp(a,s[d][0])||t((function(){f===i?e.continue(s[d][0]):e.continue(s[d][1])})),!1)})),e},It.prototype.startsWithAnyOf=function(){var e=I.apply(D,arguments);return e.every((function(e){return"string"==typeof e}))?0===e.length?jt(this):this.inAnyRange(e.map((function(e){return[e,e+Je]}))):Ct(this,"startsWithAnyOf() only works with strings")},It);function It(){}function Rt(e){return Be((function(t){return Mt(t),e(t.target.error),!1}))}function Mt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Nt="storagemutated",Ft="x-storagemutated-1",Lt=pt(null,Nt),$t=(Ut.prototype._lock=function(){return g(!be.global),++this._reculock,1!==this._reculock||be.global||(be.lockOwnerFor=this),this},Ut.prototype._unlock=function(){if(g(!be.global),0==--this._reculock)for(be.global||(be.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Qe(e[1],e[0])}catch(e){}}return this},Ut.prototype._locked=function(){return this._reculock&&be.lockOwnerFor!==this},Ut.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(g(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new W.DatabaseClosed(r);case"MissingAPIError":throw new W.MissingAPI(r.message,r);default:throw new W.OpenFailed(r)}if(!this.active)throw new W.TransactionInactive;return g(null===this._completion._state),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Be((function(n){Mt(n),t._reject(e.error)})),e.onabort=Be((function(n){Mt(n),t.active&&t._reject(new W.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=Be((function(){t.active=!1,t._resolve(),"mutatedParts"in e&&Lt.storagemutated.fire(e.mutatedParts)})),this},Ut.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return Xe(new W.ReadOnly("Transaction is readonly"));if(!this.active)return Xe(new W.TransactionInactive);if(this._locked())return new xe((function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},be])}));if(n)return Le((function(){var e=new xe((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 xe((function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return i._lib=!0,i},Ut.prototype._root=function(){return this.parent?this.parent._root():this},Ut.prototype.waitFor=function(e){var t,n=this._root(),r=xe.resolve(e);n._waitingFor?n._waitingFor=n._waitingFor.then((function(){return r})):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=e)}());var i=n._waitingFor;return new xe((function(e,t){r.then((function(t){return n._waitingQueue.push(Be(e.bind(null,t)))}),(function(e){return n._waitingQueue.push(Be(t.bind(null,e)))})).finally((function(){n._waitingFor===i&&(n._waitingFor=null)}))}))},Ut.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new W.Abort))},Ut.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 W.NotFound("Table "+e+" not part of transaction");return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n},Ut);function Ut(){}function Vt(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+zt(t)}}function zt(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Wt(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(e){return[e.name,e]},n.reduce((function(e,t,n){return(n=r(t,n))&&(e[n[0]]=n[1]),e}),{}))};var r}var Yt=function(e){try{return e.only([[]]),Yt=function(){return[[]]},[[]]}catch(e){return Yt=function(){return Je},Je}};function Qt(e){return null==e?function(){}:"string"==typeof e?1===(t=e).split(".").length?function(e){return e[t]}:function(e){return _(e,t)}:function(t){return _(t,e)};var t}function Gt(e){return[].slice.call(e)}var Ht=0;function Xt(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function Jt(e,t,n){function r(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,i=e.lowerOpen;return e=e.upperOpen,void 0===n?void 0===r?null:t.upperBound(r,!!e):void 0===r?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!e)}function i(e){var t,n=e.name;return{name:n,schema:e,mutate:function(e){var t=e.trans,i=e.type,o=e.keys,a=e.values,u=e.range;return new Promise((function(e,s){e=Be(e);var c=t.objectStore(n),l=null==c.keyPath,f="put"===i||"add"===i;if(!f&&"delete"!==i&&"deleteRange"!==i)throw new Error("Invalid operation type: "+i);var h,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 e({numFailures:0,failures:{},results:[],lastResult:void 0});function p(e){++v,Mt(e)}var y=[],m=[],v=0;if("deleteRange"===i){if(4===u.type)return e({numFailures:v,failures:m,results:[],lastResult:void 0});3===u.type?y.push(h=c.clear()):y.push(h=c.delete(r(u)))}else{var b=(l=f?l?[a,o]:[a,null]:[o,null])[0],g=l[1];if(f)for(var w=0;w<d;++w)y.push(h=g&&void 0!==g[w]?c[i](b[w],g[w]):c[i](b[w])),h.onerror=p;else for(w=0;w<d;++w)y.push(h=c[i](b[w])),h.onerror=p}function _(t){t=t.target.result,y.forEach((function(e,t){return null!=e.error&&(m[t]=e.error)})),e({numFailures:v,failures:m,results:"delete"===i?o:y.map((function(e){return e.result})),lastResult:t})}h.onerror=function(e){p(e),_(e)},h.onsuccess=_}))},getMany:function(e){var t=e.trans,r=e.keys;return new Promise((function(e,i){e=Be(e);for(var o,a=t.objectStore(n),u=r.length,s=new Array(u),c=0,l=0,f=function(t){t=t.target,s[t._pos]=t.result,++l===c&&e(s)},h=Rt(i),d=0;d<u;++d)null!=r[d]&&((o=a.get(r[d]))._pos=d,o.onsuccess=f,o.onerror=h,++c);0===c&&e(s)}))},get:function(e){var t=e.trans,r=e.key;return new Promise((function(e,i){e=Be(e);var o=t.objectStore(n).get(r);o.onsuccess=function(t){return e(t.target.result)},o.onerror=Rt(i)}))},query:(t=l,function(e){return new Promise((function(i,o){i=Be(i);var a,u,s,c=e.trans,l=e.values,f=e.limit,h=e.query,d=f===1/0?void 0:f,p=h.index;if(h=h.range,c=c.objectStore(n),p=p.isPrimaryKey?c:c.index(p.name),h=r(h),0===f)return i({result:[]});t?((d=l?p.getAll(h,d):p.getAllKeys(h,d)).onsuccess=function(e){return i({result:e.target.result})},d.onerror=Rt(o)):(a=0,u=!l&&"openKeyCursor"in p?p.openKeyCursor(h):p.openCursor(h),s=[],u.onsuccess=function(e){var t=u.result;return t?(s.push(l?t.value:t.primaryKey),++a===f?i({result:s}):void t.continue()):i({result:s})},u.onerror=Rt(o))}))}),openCursor:function(e){var t=e.trans,i=e.values,o=e.query,a=e.reverse,u=e.unique;return new Promise((function(e,s){e=Be(e);var c=o.index,l=o.range,f=t.objectStore(n),h=(f=c.isPrimaryKey?f:f.index(c.name),c=a?u?"prevunique":"prev":u?"nextunique":"next",!i&&"openKeyCursor"in f?f.openKeyCursor(r(l),c):f.openCursor(r(l),c));h.onerror=Rt(s),h.onsuccess=Be((function(n){var r,i,o,a,u=h.result;u?(u.___id=++Ht,u.done=!1,r=u.continue.bind(u),i=(i=u.continuePrimaryKey)&&i.bind(u),o=u.advance.bind(u),a=function(){throw new Error("Cursor not stopped")},u.trans=t,u.stop=u.continue=u.continuePrimaryKey=u.advance=function(){throw new Error("Cursor not started")},u.fail=Be(s),u.next=function(){var e=this,t=1;return this.start((function(){return t--?e.continue():e.stop()})).then((function(){return e}))},u.start=function(e){function t(){if(h.result)try{e()}catch(e){u.fail(e)}else u.done=!0,u.start=function(){throw new Error("Cursor behind last entry")},u.stop()}var n=new Promise((function(e,t){e=Be(e),h.onerror=Rt(t),u.fail=t,u.stop=function(t){u.stop=u.continue=u.continuePrimaryKey=u.advance=a,e(t)}}));return h.onsuccess=Be((function(e){h.onsuccess=t,t()})),u.continue=r,u.continuePrimaryKey=i,u.advance=o,t(),n},e(u)):e(null)}),s)}))},count:function(e){var t=e.query,i=e.trans,o=t.index,a=t.range;return new Promise((function(e,t){var u=i.objectStore(n),s=o.isPrimaryKey?u:u.index(o.name);(s=(u=r(a))?s.count(u):s.count()).onsuccess=Be((function(t){return e(t.target.result)})),s.onerror=Rt(t)}))}}}var o,u,s,c=(u=n,s=Gt((o=e).objectStoreNames),{schema:{name:o.name,tables:s.map((function(e){return u.objectStore(e)})).map((function(e){var t=e.keyPath,n=e.autoIncrement,r=a(t),i={};return n={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:null==t,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Qt(t)},indexes:Gt(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry;return e=e.keyPath,r={name:t,compound:a(e),keyPath:e,unique:n,multiEntry:r,extractKey:Qt(e)},i[Xt(e)]=r})),getIndexByKeyPath:function(e){return i[Xt(e)]}},i[":id"]=n.primaryKey,null!=t&&(i[Xt(t)]=n.primaryKey),n}))},hasGetAll:0<s.length&&"getAll"in u.objectStore(s[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),l=(n=c.schema,c.hasGetAll),f=(c=n.tables.map(i),{});return c.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 '".concat(e,"' not found"));return f[e]},MIN_KEY:-1/0,MAX_KEY:Yt(t),schema:n}}function Zt(e,n,r,i){var o=r.IDBKeyRange;return r.indexedDB,{dbcore:(i=Jt(n,o,i),e.dbcore.reduce((function(e,n){return n=n.create,t(t({},e),n(e))}),i))}}function en(e,t){var n=t.db;t=Zt(e._middlewares,n,e._deps,t),e.core=t.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 tn(e,t,n,r){n.forEach((function(n){var i=r[n];t.forEach((function(t){var r=function e(t,n){return y(t,n)||(t=s(t))&&e(t,n)}(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?d(t,n,{get:function(){return this.table(n)},set:function(e){h(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,i))}))}))}function nn(e,t){t.forEach((function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]}))}function rn(e,t){return e._cfg.version-t._cfg.version}function on(e,t,n,r){var i=e._dbSchema;n.objectStoreNames.contains("$meta")&&!i.$meta&&(i.$meta=Wt("$meta",dn("")[0],[]),e._storeNames.push("$meta"));var a=e._createTransaction("readwrite",e._storeNames,i);a.create(n),a._completion.catch(r);var u=a._reject.bind(a),s=be.transless||be;Le((function(){return be.trans=a,be.transless=s,0!==t?(en(e,n),c=t,((r=a).storeNames.includes("$meta")?r.table("$meta").get("version").then((function(e){return null!=e?e:c})):xe.resolve(c)).then((function(t){return i=t,u=a,s=n,c=[],t=(r=e)._versions,l=r._dbSchema=fn(0,r.idbdb,s),0!==(t=t.filter((function(e){return e._cfg.version>=i}))).length?(t.forEach((function(e){c.push((function(){var t=l,n=e._cfg.dbschema;hn(r,t,s),hn(r,n,s),l=r._dbSchema=n;var a=un(t,n);a.add.forEach((function(e){sn(s,e[0],e[1].primKey,e[1].indexes)})),a.change.forEach((function(e){if(e.recreate)throw new W.Upgrade("Not yet support for changing primary key");var t=s.objectStore(e.name);e.add.forEach((function(e){return ln(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),ln(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var c=e._cfg.contentUpgrade;if(c&&e._cfg.version>i){en(r,s),u._memoizedTables={};var f=k(n);a.del.forEach((function(e){f[e]=t[e]})),nn(r,[r.Transaction.prototype]),tn(r,[r.Transaction.prototype],o(f),f),u.schema=f;var h,d=R(c);return d&&$e(),a=xe.follow((function(){var e;(h=c(u))&&d&&(e=Ue.bind(null,null),h.then(e,e))})),h&&"function"==typeof h.then?xe.resolve(h):a.then((function(){return h}))}})),c.push((function(t){var n,i,o=e._cfg.dbschema;n=o,i=t,[].slice.call(i.db.objectStoreNames).forEach((function(e){return null==n[e]&&i.db.deleteObjectStore(e)})),nn(r,[r.Transaction.prototype]),tn(r,[r.Transaction.prototype],r._storeNames,r._dbSchema),u.schema=r._dbSchema})),c.push((function(t){r.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(r.idbdb.version/10)===e._cfg.version?(r.idbdb.deleteObjectStore("$meta"),delete r._dbSchema.$meta,r._storeNames=r._storeNames.filter((function(e){return"$meta"!==e}))):t.objectStore("$meta").put(e._cfg.version,"version"))}))})),function e(){return c.length?xe.resolve(c.shift()(u.idbtrans)).then(e):xe.resolve()}().then((function(){cn(l,s)}))):xe.resolve();var r,i,u,s,c,l})).catch(u)):(o(i).forEach((function(e){sn(n,e,i[e].primKey,i[e].indexes)})),en(e,n),void xe.follow((function(){return e.on.populate.fire(a)})).catch(u));var r,c}))}function an(e,t){cn(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=fn(0,e.idbdb,t);hn(e,e._dbSchema,t);for(var r=0,i=un(n,e._dbSchema).change;r<i.length;r++){var o=function(e){if(e.change.length||e.recreate)return console.warn("Unable to patch indexes of table ".concat(e.name," because it has changes on the type of index or primary key.")),{value:void 0};var n=t.objectStore(e.name);e.add.forEach((function(t){ie&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),ln(n,t)}))}(i[r]);if("object"==typeof o)return o.value}}function un(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 a={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto)a.recreate=!0,r.change.push(a);else{var u=i.idxByName,s=o.idxByName,c=void 0;for(c in u)s[c]||a.del.push(c);for(c in s){var l=u[c],f=s[c];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,o])}return r}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 ln(i,e)})),i}function cn(e,t){o(e).forEach((function(n){t.db.objectStoreNames.contains(n)||(ie&&console.debug("Dexie: Creating missing table",n),sn(t,n,e[n].primKey,e[n].indexes))}))}function ln(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function fn(e,t,n){var r={};return v(t.objectStoreNames,0).forEach((function(e){for(var t=n.objectStore(e),i=Vt(zt(u=t.keyPath),u||"",!0,!1,!!t.autoIncrement,u&&"string"!=typeof u,!0),o=[],a=0;a<t.indexNames.length;++a){var u=(s=t.index(t.indexNames[a])).keyPath,s=Vt(s.name,u,!!s.unique,!!s.multiEntry,!1,u&&"string"!=typeof u,!1);o.push(s)}r[e]=Wt(e,i,o)})),r}function hn(e,t,n){for(var r=n.db.objectStoreNames,o=0;o<r.length;++o){var a=r[o],u=n.objectStore(a);e._hasGetAll="getAll"in u;for(var s=0;s<u.indexNames.length;++s){var c=u.indexNames[s],l=u.index(c).keyPath,f="string"==typeof l?l:"["+v(l).join("+")+"]";!t[a]||(l=t[a].idxByName[f])&&(l.name=c,delete t[a].idxByName[f],t[a].idxByName[c]=l)}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function dn(e){return e.split(",").map((function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return Vt(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),a(r),0===t)}))}var pn=(yn.prototype._parseStoresSpec=function(e,t){o(e).forEach((function(n){if(null!==e[n]){var r=dn(e[n]),i=r.shift();if(i.unique=!0,i.multi)throw new W.Schema("Primary key cannot be multi-valued");r.forEach((function(e){if(e.auto)throw new W.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new W.Schema("Index must have a name and cannot be an empty string")})),t[n]=Wt(n,i,r)}}))},yn.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?u(this._cfg.storesSource,e):e,e=t._versions;var n={},r={};return e.forEach((function(e){u(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)})),t._dbSchema=r,nn(t,[t._allTables,t,t.Transaction.prototype]),tn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],o(r),r),t._storeNames=o(r),this},yn.prototype.upgrade=function(e){return this._cfg.contentUpgrade=re(this._cfg.contentUpgrade||G,e),this},yn);function yn(){}function mn(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new tr(nt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function vn(e){return e&&"function"==typeof e.databases}function bn(e){return Le((function(){return be.letThrough=!0,e()}))}function gn(e){return!("from"in e)}var wn=function(e,t){if(!this){var n=new wn;return e&&"d"in e&&u(n,e),n}u(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function _n(e,t,n){var r=ct(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(gn(e))return u(e,{from:t,to:n,d:1});var i=e.l;if(r=e.r,ct(n,e.from)<0)return i?_n(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Pn(e);if(0<ct(t,e.to))return r?_n(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Pn(e);ct(t,e.from)<0&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<ct(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),n=!e.r,i&&!e.l&&xn(e,i),r&&n&&xn(e,r)}}function xn(e,t){gn(t)||function e(t,n){var r=n.from,i=n.to,o=n.l;n=n.r,_n(t,r,i),o&&e(t,o),n&&e(t,n)}(e,t)}function kn(e,t){var n=On(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=On(e),a=o.next(i.from),u=a.value;!r.done&&!a.done;){if(ct(u.from,i.to)<=0&&0<=ct(u.to,i.from))return!0;ct(i.from,u.from)<0?i=(r=n.next(u.from)).value:u=(a=o.next(i.from)).value}return!1}function On(e){var t=gn(e)?null:{s:0,n:e};return{next:function(e){for(var n=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&ct(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||ct(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function Pn(e){var n,r,i=((null===(n=e.r)||void 0===n?void 0:n.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),o=1<i?"r":i<-1?"l":"";o&&(n="r"==o?"l":"r",r=t({},e),i=e[o],e.from=i.from,e.to=i.to,e[o]=i[o],r[o]=i[n],(e[n]=r).d=En(r)),e.d=En(e)}function En(e){var t=e.r;return e=e.l,(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function Sn(e,t){return o(t).forEach((function(n){e[n]?xn(e[n],t[n]):e[n]=function e(t){var n,r,i={};for(n in t)l(t,n)&&(r=t[n],i[n]=!r||"object"!=typeof r||S.has(r.constructor)?r:e(r));return i}(t[n])})),e}function Kn(e,t){return e.all||t.all||Object.keys(e).some((function(n){return t[n]&&kn(t[n],e[n])}))}f(wn.prototype,((M={add:function(e){return xn(this,e),this},addKey:function(e){return _n(this,e,e),this},addKeys:function(e){var t=this;return e.forEach((function(e){return _n(t,e,e)})),this},hasKey:function(e){var t=On(this).next(e).value;return t&&ct(t.from,e)<=0&&0<=ct(t.to,e)}})[q]=function(){return On(this)},M));var An={},Cn={},jn=!1;function qn(e){Sn(Cn,e),jn||(jn=!0,setTimeout((function(){jn=!1,Tn(Cn,!(Cn={}))}),0))}function Tn(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,i=Object.values(An);r<i.length;r++)Bn(a=i[r],e,n,t);else for(var o in e){var a,u=/^idb\:\/\/(.*)\/(.*)\//.exec(o);u&&(o=u[1],u=u[2],(a=An["idb://".concat(o,"/").concat(u)])&&Bn(a,e,n,t))}n.forEach((function(e){return e()}))}function Bn(e,t,n,r){for(var i=[],o=0,a=Object.entries(e.queries.query);o<a.length;o++){for(var u=a[o],s=u[0],c=[],l=0,f=u[1];l<f.length;l++){var h=f[l];Kn(t,h.obsSet)?h.subscribers.forEach((function(e){return n.add(e)})):r&&c.push(h)}r&&i.push([s,c])}if(r)for(var d=0,p=i;d<p.length;d++){var y=p[d];s=y[0],c=y[1],e.queries.query[s]=c}}function Dn(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((function(){return t.dbOpenError?Xe(t.dbOpenError):e}));t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,i=Math.round(10*e.verno),a=!1;function u(){if(t.openCanceller!==r)throw new W.DatabaseClosed("db.open() was cancelled")}function s(){return new xe((function(r,c){if(u(),!n)throw new W.MissingAPI;var l=e.name,d=t.autoSchema||!i?n.open(l):n.open(l,i);if(!d)throw new W.MissingAPI;d.onerror=Rt(c),d.onblocked=Be(e._fireOnBlocked),d.onupgradeneeded=Be((function(r){var i;f=d.transaction,t.autoSchema&&!e._options.allowEmptyDB?(d.onerror=Mt,f.abort(),d.result.close(),(i=n.deleteDatabase(l)).onsuccess=i.onerror=Be((function(){c(new W.NoSuchDatabase("Database ".concat(l," doesnt exist")))}))):(f.onerror=Rt(c),r=r.oldVersion>Math.pow(2,62)?0:r.oldVersion,h=r<1,e.idbdb=d.result,a&&an(e,f),on(e,r/10,f,c))}),c),d.onsuccess=Be((function(){f=null;var n,u,c,p,y,m=e.idbdb=d.result,b=v(m.objectStoreNames);if(0<b.length)try{var g=m.transaction(1===(p=b).length?p[0]:p,"readonly");if(t.autoSchema)u=m,c=g,(n=e).verno=u.version/10,c=n._dbSchema=fn(0,u,c),n._storeNames=v(u.objectStoreNames,0),tn(n,[n._allTables],o(c),c);else if(hn(e,e._dbSchema,g),((y=un(fn(0,(y=e).idbdb,g),y._dbSchema)).add.length||y.change.some((function(e){return e.add.length||e.change.length})))&&!a)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),m.close(),i=m.version+1,a=!0,r(s());en(e,g)}catch(n){}tt.push(e),m.onversionchange=Be((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),m.onclose=Be((function(t){e.on("close").fire(t)})),h&&(y=e._deps,g=l,m=y.indexedDB,y=y.IDBKeyRange,vn(m)||g===nt||mn(m,y).put({name:g}).catch(G)),r()}),c)})).catch((function(e){switch(null==e?void 0:e.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),s();break;case"VersionError":if(0<i)return i=0,s()}return xe.reject(e)}))}var c,l=t.dbReadyResolve,f=null,h=!1;return xe.race([r,("undefined"==typeof navigator?xe.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(e){function t(){return indexedDB.databases().finally(e)}c=setInterval(t,100),t()})).finally((function(){return clearInterval(c)})):Promise.resolve()).then(s)]).then((function(){return u(),t.onReadyBeingFired=[],xe.resolve(bn((function(){return e.on.ready.fire(e.vip)}))).then((function n(){if(0<t.onReadyBeingFired.length){var r=t.onReadyBeingFired.reduce(re,G);return t.onReadyBeingFired=[],xe.resolve(bn((function(){return r(e.vip)}))).then(n)}}))})).finally((function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)})).catch((function(n){t.dbOpenError=n;try{f&&f.abort()}catch(n){}return r===t.openCanceller&&e._close(),Xe(n)})).finally((function(){t.openComplete=!0,l()})).then((function(){var t;return h&&(t={},e.tables.forEach((function(n){n.schema.indexes.forEach((function(r){r.name&&(t["idb://".concat(e.name,"/").concat(n.name,"/").concat(r.name)]=new wn(-1/0,[[[]]]))})),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new wn(-1/0,[[[]]])})),Lt(Nt).fire(t),Tn(t,!0)),e}))}function In(e){function t(t){return e.next(t)}var n=i(t),r=i((function(t){return e.throw(t)}));function i(e){return function(t){var i=e(t);return t=i.value,i.done?t:t&&"function"==typeof t.then?t.then(n,r):a(t)?Promise.all(t).then(n,r):n(t)}}return i(t)()}function Rn(e,t,n){for(var r=a(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}var Mn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return t(t({},e),{table:function(n){var r=e.table(n),i=r.schema,o={},a=[];function u(e,n,r){var i=Xt(e),s=o[i]=o[i]||[],c=null==e?0:"string"==typeof e?1:e.length,l=0<n;return l=t(t({},r),{name:l?"".concat(i,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:n,keyLength:c,extractKey:Qt(e),unique:!l&&r.unique}),s.push(l),l.isPrimaryKey||a.push(l),1<c&&u(2===c?e[0]:e.slice(0,c-1),n+1,r),s.sort((function(e,t){return e.keyTail-t.keyTail})),l}n=u(i.primaryKey.keyPath,0,i.primaryKey),o[":id"]=[n];for(var s=0,c=i.indexes;s<c.length;s++){var l=c[s];u(l.keyPath,0,l)}function f(n){var r,i=n.query.index;return i.isVirtual?t(t({},n),{query:{index:i.lowLevelIndex,range:(r=n.query.range,i=i.keyTail,{type:1===r.type?2:r.type,lower:Rn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,i),lowerOpen:!0,upper:Rn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,i),upperOpen:!0})}}):n}return t(t({},r),{schema:t(t({},i),{primaryKey:n,indexes:a,getIndexByKeyPath:function(e){return(e=o[Xt(e)])&&e[0]}}),count:function(e){return r.count(f(e))},query:function(e){return r.query(f(e))},openCursor:function(t){var n=t.query.index,i=n.keyTail,o=n.isVirtual,a=n.keyLength;return o?r.openCursor(f(t)).then((function(e){return e&&u(e)})):r.openCursor(t);function u(n){return Object.create(n,{continue:{value:function(r){null!=r?n.continue(Rn(r,t.reverse?e.MAX_KEY:e.MIN_KEY,i)):t.unique?n.continue(n.key.slice(0,a).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,i)):n.continue()}},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(Rn(t,e.MAX_KEY,i),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return 1===a?e[0]:e.slice(0,a)}},value:{get:function(){return n.value}}})}}})}})}};function Nn(e,t,n,r){return n=n||{},r=r||"",o(e).forEach((function(i){var o,a,u;l(t,i)?(o=e[i],a=t[i],"object"==typeof o&&"object"==typeof a&&o&&a?(u=j(o))!==j(a)?n[r+i]=t[i]:"Object"===u?Nn(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i]):o!==a&&(n[r+i]=t[i])):n[r+i]=void 0})),o(t).forEach((function(i){l(e,i)||(n[r+i]=t[i])})),n}function Fn(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var Ln={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return t(t({},e),{table:function(n){var i=e.table(n),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=be.trans,u=a.table(n).hook,s=u.deleting,c=u.creating,f=u.updating;switch(e.type){case"add":if(c.fire===G)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"put":if(c.fire===G&&f.fire===G)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"delete":if(s.fire===G)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"deleteRange":if(s.fire===G)break;return a._promise("readwrite",(function(){return function e(n,r,a){return i.query({trans:n,values:!1,query:{index:o,range:r},limit:a}).then((function(i){var o=i.result;return h({type:"delete",keys:o,trans:n}).then((function(i){return 0<i.numFailures?Promise.reject(i.failures[0]):o.length<a?{failures:[],numFailures:0,lastResult:void 0}:e(n,t(t({},r),{lower:o[o.length-1],lowerOpen:!0}),a)}))}))}(e.trans,e.range,1e4)}),!0)}return i.mutate(e);function h(e){var n,a,u,h=be.trans,d=e.keys||Fn(o,e);if(!d)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?t(t({},e),{keys:d}):t({},e)).type&&(e.values=r([],e.values,!0)),e.keys&&(e.keys=r([],e.keys,!0)),n=i,u=d,("add"===(a=e).type?Promise.resolve([]):n.getMany({trans:a.trans,keys:u,cache:"immutable"})).then((function(t){var n=d.map((function(n,r){var i,a,u,d=t[r],p={onerror:null,onsuccess:null};return"delete"===e.type?s.fire.call(p,n,d,h):"add"===e.type||void 0===d?(i=c.fire.call(p,n,e.values[r],h),null==n&&null!=i&&(e.keys[r]=n=i,o.outbound||x(e.values[r],o.keyPath,n))):(i=Nn(d,e.values[r]),(a=f.fire.call(p,i,n,d,h))&&(u=e.values[r],Object.keys(a).forEach((function(e){l(u,e)?u[e]=a[e]:x(u,e,a[e])})))),p}));return i.mutate(e).then((function(r){for(var i=r.failures,o=r.results,a=r.numFailures,u=(r=r.lastResult,0);u<d.length;++u){var s=(o||d)[u],c=n[u];null==s?c.onerror&&c.onerror(i[u]):c.onsuccess&&c.onsuccess("put"===e.type&&t[u]?e.values[u]:s)}return{failures:i,results:o,numFailures:a,lastResult:r}})).catch((function(e){return n.forEach((function(t){return t.onerror&&t.onerror(e)})),Promise.reject(e)}))}))}}})}})}};function $n(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)0===ct(t.keys[i],e[o])&&(r.push(n?A(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch(e){return null}}var Un={stack:"dbcore",level:-1,create:function(e){return{table:function(n){var r=e.table(n);return t(t({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=$n(e.keys,e.trans._cache,"clone"===e.cache);return t?xe.resolve(t):r.getMany(e).then((function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?A(t):t},t}))},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function Vn(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function zn(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Wn={stack:"dbcore",level:0,name:"Observability",create:function(e){var n=e.schema.name,r=new wn(e.MIN_KEY,e.MAX_KEY);return t(t({},e),{transaction:function(t,n,r){if(be.subscr&&"readonly"!==n)throw new W.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(be.querier));return e.transaction(t,n,r)},table:function(i){var u=e.table(i),s=u.schema,c=s.primaryKey,l=s.indexes,f=c.extractKey,h=c.outbound,d=c.autoIncrement&&l.filter((function(e){return e.compound&&e.keyPath.includes(c.keyPath)})),p=t(t({},u),{mutate:function(t){function o(e){return e="idb://".concat(n,"/").concat(i,"/").concat(e),y[e]||(y[e]=new wn)}var l,f,h,p=t.trans,y=t.mutatedParts||(t.mutatedParts={}),m=o(""),v=o(":dels"),b=t.type,g="deleteRange"===t.type?[t.range]:"delete"===t.type?[t.keys]:t.values.length<50?[Fn(c,t).filter((function(e){return e})),t.values]:[],w=g[0],_=g[1];return g=t.trans._cache,a(w)?(m.addKeys(w),(g="delete"===b||w.length===_.length?$n(w,g):null)||v.addKeys(w),(g||_)&&(l=o,f=g,h=_,s.indexes.forEach((function(e){var t=l(e.name||"");function n(t){return null!=t?e.extractKey(t):null}function r(n){return e.multiEntry&&a(n)?n.forEach((function(e){return t.addKey(e)})):t.addKey(n)}(f||h).forEach((function(e,t){var i=f&&n(f[t]);0!==ct(i,t=h&&n(h[t]))&&(null!=i&&r(i),null!=t&&r(t))}))})))):w?(_={from:null!==(_=w.lower)&&void 0!==_?_:e.MIN_KEY,to:null!==(_=w.upper)&&void 0!==_?_:e.MAX_KEY},v.add(_),m.add(_)):(m.add(r),v.add(r),s.indexes.forEach((function(e){return o(e.name).add(r)}))),u.mutate(t).then((function(e){return!w||"add"!==t.type&&"put"!==t.type||(m.addKeys(e.results),d&&d.forEach((function(n){for(var r=t.values.map((function(e){return n.extractKey(e)})),i=n.keyPath.findIndex((function(e){return e===c.keyPath})),a=0,u=e.results.length;a<u;++a)r[a][i]=e.results[a];o(n.name).addKeys(r)}))),p.mutatedParts=Sn(p.mutatedParts||{},y),e}))}}),y=(l=function(t){t=(n=t.query).index;var n=n.range;return[t,new wn(null!==(t=n.lower)&&void 0!==t?t:e.MIN_KEY,null!==(n=n.upper)&&void 0!==n?n:e.MAX_KEY)]},{get:function(e){return[c,new wn(e.key)]},getMany:function(e){return[c,(new wn).addKeys(e.keys)]},count:l,query:l,openCursor:l});return o(y).forEach((function(e){p[e]=function(o){var a=!!(p=be.subscr),s=Vn(be,u)&&zn(e,o)?o.obsSet={}:p;if(a){var c=function(e){return e="idb://".concat(n,"/").concat(i,"/").concat(e),s[e]||(s[e]=new wn)},l=c(""),d=c(":dels"),p=(a=(p=y[e](o))[0],p[1]);if(("query"===e&&a.isPrimaryKey&&!o.values?d:c(a.name||"")).add(p),!a.isPrimaryKey){if("count"!==e){var m="query"===e&&h&&o.values&&u.query(t(t({},o),{values:!1}));return u[e].apply(this,arguments).then((function(t){if("query"===e){if(h&&o.values)return m.then((function(e){return e=e.result,l.addKeys(e),t}));var n=o.values?t.result.map(f):t.result;(o.values?l:d).addKeys(n)}else if("openCursor"===e){var r=t,i=o.values;return r&&Object.create(r,{key:{get:function(){return d.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return d.addKey(e),e}},value:{get:function(){return i&&l.addKey(r.primaryKey),r.value}}})}return t}))}d.add(r)}}return u[e].apply(this,arguments)}})),p}})}};function Yn(e,n,r){if(0===r.numFailures)return n;if("deleteRange"===n.type)return null;var i=n.keys?n.keys.length:"values"in n&&n.values?n.values.length:1;return r.numFailures===i?null:(n=t({},n),a(n.keys)&&(n.keys=n.keys.filter((function(e,t){return!(t in r.failures)}))),"values"in n&&a(n.values)&&(n.values=n.values.filter((function(e,t){return!(t in r.failures)}))),n)}function Qn(e,t){return n=e,(void 0===(r=t).lower||(r.lowerOpen?0<ct(n,r.lower):0<=ct(n,r.lower)))&&(void 0===t.upper||(t.upperOpen?ct(e,t.upper)<0:ct(e,t.upper)<=0));var n,r}function Gn(e,t,n,r,i,o){if(!n||0===n.length)return e;var u=t.query.index,s=u.multiEntry,c=t.query.range,l=r.schema.primaryKey.extractKey,f=u.extractKey,h=(u.lowLevelIndex||u).extractKey;return n=n.reduce((function(e,n){var r=e,i=[];if("add"===n.type||"put"===n.type)for(var o=new wn,u=n.values.length-1;0<=u;--u){var h,d=n.values[u],p=l(d);o.hasKey(p)||(h=f(d),(s&&a(h)?h.some((function(e){return Qn(e,c)})):Qn(h,c))&&(o.addKey(p),i.push(d)))}switch(n.type){case"add":var y=(new wn).addKeys(t.values?e.map((function(e){return l(e)})):e);r=e.concat(t.values?i.filter((function(e){return e=l(e),!y.hasKey(e)&&(y.addKey(e),!0)})):i.map((function(e){return l(e)})).filter((function(e){return!y.hasKey(e)&&(y.addKey(e),!0)})));break;case"put":var m=(new wn).addKeys(n.values.map((function(e){return l(e)})));r=e.filter((function(e){return!m.hasKey(t.values?l(e):e)})).concat(t.values?i:i.map((function(e){return l(e)})));break;case"delete":var v=(new wn).addKeys(n.keys);r=e.filter((function(e){return!v.hasKey(t.values?l(e):e)}));break;case"deleteRange":var b=n.range;r=e.filter((function(e){return!Qn(l(e),b)}))}return r}),e),n===e?e:(n.sort((function(e,t){return ct(h(e),h(t))||ct(l(e),l(t))})),t.limit&&t.limit<1/0&&(n.length>t.limit?n.length=t.limit:e.length===t.limit&&n.length<t.limit&&(i.dirty=!0)),o?Object.freeze(n):n)}function Hn(e,t){return 0===ct(e.lower,t.lower)&&0===ct(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function Xn(e,t){return function(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(t=ct(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return-1}return t}(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=function(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return-1;if(0===(t=ct(e,t))){if(n&&r)return 0;if(n)return-1;if(r)return 1}return t}(e.upper,t.upper,e.upperOpen,t.upperOpen)}function Jn(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",(function(){var r,i;e.subscribers.delete(n),0===e.subscribers.size&&(r=e,i=t,setTimeout((function(){0===r.subscribers.size&&B(i,r)}),3e3))}))}var Zn={stack:"dbcore",level:0,name:"Cache",create:function(e){var n=e.schema.name;return t(t({},e),{transaction:function(t,r,i){var o,a,u=e.transaction(t,r,i);return"readwrite"===r&&(a=(o=new AbortController).signal,i=function(i){return function(){if(o.abort(),"readwrite"===r){for(var a=new Set,s=0,c=t;s<c.length;s++){var l=c[s],f=An["idb://".concat(n,"/").concat(l)];if(f){var h=e.table(l),d=f.optimisticOps.filter((function(e){return e.trans===u}));if(u._explicit&&i&&u.mutatedParts)for(var p=0,y=Object.values(f.queries.query);p<y.length;p++)for(var m=0,v=(w=y[p]).slice();m<v.length;m++)Kn((_=v[m]).obsSet,u.mutatedParts)&&(B(w,_),_.subscribers.forEach((function(e){return a.add(e)})));else if(0<d.length){f.optimisticOps=f.optimisticOps.filter((function(e){return e.trans!==u}));for(var b=0,g=Object.values(f.queries.query);b<g.length;b++)for(var w,_,x,k=0,O=(w=g[b]).slice();k<O.length;k++)null!=(_=O[k]).res&&u.mutatedParts&&(i&&!_.dirty?(x=Object.isFrozen(_.res),x=Gn(_.res,_.req,d,h,_,x),_.dirty?(B(w,_),_.subscribers.forEach((function(e){return a.add(e)}))):x!==_.res&&(_.res=x,_.promise=xe.resolve({result:x}))):(_.dirty&&B(w,_),_.subscribers.forEach((function(e){return a.add(e)}))))}}}a.forEach((function(e){return e()}))}}},u.addEventListener("abort",i(!1),{signal:a}),u.addEventListener("error",i(!1),{signal:a}),u.addEventListener("complete",i(!0),{signal:a})),u},table:function(r){var i=e.table(r),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=be.trans;if(o.outbound||"disabled"===a.db._options.cache||a.explicit||"readwrite"!==a.idbtrans.mode)return i.mutate(e);var u=An["idb://".concat(n,"/").concat(r)];return u?(a=i.mutate(e),"add"!==e.type&&"put"!==e.type||!(50<=e.values.length||Fn(o,e).some((function(e){return null==e})))?(u.optimisticOps.push(e),e.mutatedParts&&qn(e.mutatedParts),a.then((function(t){0<t.numFailures&&(B(u.optimisticOps,e),(t=Yn(0,e,t))&&u.optimisticOps.push(t),e.mutatedParts&&qn(e.mutatedParts))})),a.catch((function(){B(u.optimisticOps,e),e.mutatedParts&&qn(e.mutatedParts)}))):a.then((function(n){var r=Yn(0,t(t({},e),{values:e.values.map((function(e,r){var i;return n.failures[r]||x(e=null!==(i=o.keyPath)&&void 0!==i&&i.includes(".")?A(e):t({},e),o.keyPath,n.results[r]),e}))}),n);u.optimisticOps.push(r),queueMicrotask((function(){return e.mutatedParts&&qn(e.mutatedParts)}))})),a):i.mutate(e)},query:function(e){if(!Vn(be,i)||!zn("query",e))return i.query(e);var t="immutable"===(null===(u=be.trans)||void 0===u?void 0:u.db._options.cache),o=(c=be).requery,a=c.signal,u=function(e,t,n,r){var i=An["idb://".concat(e,"/").concat(t)];if(!i)return[];if(!(t=i.queries[n]))return[null,!1,i,null];var o=t[(r.query?r.query.index.name:null)||""];if(!o)return[null,!1,i,null];switch(n){case"query":var a=o.find((function(e){return e.req.limit===r.limit&&e.req.values===r.values&&Hn(e.req.query.range,r.query.range)}));return a?[a,!0,i,o]:[o.find((function(e){return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(!r.values||e.req.values)&&Xn(e.req.query.range,r.query.range)})),!1,i,o];case"count":return a=o.find((function(e){return Hn(e.req.query.range,r.query.range)})),[a,!!a,i,o]}}(n,r,"query",e),s=u[0],c=u[1],l=u[2],f=u[3];return s&&c?s.obsSet=e.obsSet:(c=i.query(e).then((function(e){var n=e.result;if(s&&(s.res=n),t){for(var r=0,i=n.length;r<i;++r)Object.freeze(n[r]);Object.freeze(n)}else e.result=A(n);return e})).catch((function(e){return f&&s&&B(f,s),Promise.reject(e)})),s={obsSet:e.obsSet,promise:c,subscribers:new Set,type:"query",req:e,dirty:!1},f?f.push(s):(f=[s],(l=l||(An["idb://".concat(n,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[e.query.index.name||""]=f)),Jn(s,f,o,a),s.promise.then((function(n){return{result:Gn(n.result,e,null==l?void 0:l.optimisticOps,i,s,t)}}))}})}})}};function er(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var tr=(nr.prototype.version=function(e){if(isNaN(e)||e<.1)throw new W.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new W.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(rn),n.stores({}),this._state.autoSchema=!1,n)},nr.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||be.letThrough||this._vip)?e():new xe((function(e,n){if(t._state.openComplete)return n(new W.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new W.DatabaseClosed);t.open().catch(G)}t._state.dbReadyPromise.then(e,n)})).then(e)},nr.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;return i&&this.unuse({stack:t,name:i}),(e=this._middlewares[t]||(this._middlewares[t]=[])).push({stack:t,create:n,level:null==r?10:r,name:i}),e.sort((function(e,t){return e.level-t.level})),this},nr.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},nr.prototype.open=function(){var e=this;return Qe(ve,(function(){return Dn(e)}))},nr.prototype._close=function(){var e=this._state,t=tt.indexOf(this);if(0<=t&&tt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(t){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new xe((function(t){e.dbReadyResolve=t})),e.openCanceller=new xe((function(t,n){e.cancelOpen=n})))},nr.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen;e=this._state,t?(e.isBeingOpened&&e.cancelOpen(new W.DatabaseClosed),this._close(),e.autoOpen=!1,e.dbOpenError=new W.DatabaseClosed):(this._close(),e.autoOpen=this._options.autoOpen||e.isBeingOpened,e.openComplete=!1,e.dbOpenError=null)},nr.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=0<arguments.length&&"object"!=typeof arguments[0],r=this._state;return new xe((function(i,o){function a(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=Be((function(){var e,n,r;e=t._deps,n=t.name,r=e.indexedDB,e=e.IDBKeyRange,vn(r)||n===nt||mn(r,e).delete(n).catch(G),i()})),n.onerror=Rt(o),n.onblocked=t._fireOnBlocked}if(n)throw new W.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()}))},nr.prototype.backendDB=function(){return this.idbdb},nr.prototype.isOpen=function(){return null!==this.idbdb},nr.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},nr.prototype.hasFailed=function(){return null!==this._state.dbOpenError},nr.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(nr.prototype,"tables",{get:function(){var e=this;return o(this._allTables).map((function(t){return e._allTables[t]}))},enumerable:!1,configurable:!0}),nr.prototype.transaction=function(){var e=function(e,t,n){var r=arguments.length;if(r<2)throw new W.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]}.apply(this,arguments);return this._transaction.apply(this,e)},nr.prototype._transaction=function(e,t,n){var r=this,i=be.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,a,u=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map((function(e){if("string"!=typeof(e=e instanceof r.Table?e.name:e))throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e})),"r"==e||e===rt)o=rt;else{if("rw"!=e&&e!=it)throw new W.InvalidArgument("Invalid transaction mode: "+e);o=it}if(i){if(i.mode===rt&&o===it){if(!u)throw new W.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&a.forEach((function(e){if(i&&-1===i.storeNames.indexOf(e)){if(!u)throw new W.SubTransaction("Table "+e+" not included in parent transaction.");i=null}})),u&&i&&!i.active&&(i=null)}}catch(n){return i?i._promise(null,(function(e,t){t(n)})):Xe(n)}var s=function e(t,n,r,i,o){return xe.resolve().then((function(){var a=be.transless||be,u=t._createTransaction(n,r,t._dbSchema,i);if(u.explicit=!0,a={trans:u,transless:a},i)u.idbtrans=i.idbtrans;else try{u.create(),u.idbtrans._explicit=!0,t._state.PR1398_maxLoop=3}catch(a){return a.name===V.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,null,o)}))):Xe(a)}var s,c=R(o);return c&&$e(),a=xe.follow((function(){var e;(s=o.call(u,u))&&(c?(e=Ue.bind(null,null),s.then(e,e)):"function"==typeof s.next&&"function"==typeof s.throw&&(s=In(s)))}),a),(s&&"function"==typeof s.then?xe.resolve(s).then((function(e){return u.active?e:Xe(new W.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):a.then((function(){return s}))).then((function(e){return i&&u._resolve(),u._completion.then((function(){return e}))})).catch((function(e){return u._reject(e),Xe(e)}))}))}.bind(null,this,o,a,i,n);return i?i._promise(o,s,"lock"):be.trans?Qe(be.transless,(function(){return r._whenReady(s)})):this._whenReady(s)},nr.prototype.table=function(e){if(!l(this._allTables,e))throw new W.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},nr);function nr(e,n){var r=this;this._middlewares={},this.verno=0;var i=nr.dependencies;this._options=n=t({addons:nr.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange,cache:"cloned"},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},i=n.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var o,a,u,s,c,l={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:G,dbReadyPromise:null,cancelOpen:G,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:n.autoOpen};l.dbReadyPromise=new xe((function(e){l.dbReadyResolve=e})),l.openCanceller=new xe((function(e,t){l.cancelOpen=t})),this._state=l,this.name=e,this.on=pt(this,"populate","blocked","versionchange","close",{ready:[re,G]}),this.on.ready.subscribe=b(this.on.ready.subscribe,(function(e){return function(t,n){nr.vip((function(){var i,o=r._state;o.openComplete?(o.dbOpenError||xe.resolve().then(t),n&&e(t)):o.onReadyBeingFired?(o.onReadyBeingFired.push(t),n&&e(t)):(e(t),i=r,n||e((function e(){i.on.ready.unsubscribe(t),i.on.ready.unsubscribe(e)})))}))}})),this.Collection=(o=this,yt(Pt.prototype,(function(e,t){this.db=o;var n=at,r=null;if(t)try{n=t()}catch(e){r=e}var i=e._ctx;e=(t=i.table).hook.reading.fire,this._ctx={table:t,index:i.index,isPrimKey:!i.index||t.schema.primKey.keyPath&&i.index===t.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:e!==H?e:null}}))),this.Table=(a=this,yt(ht.prototype,(function(e,t,n){this.db=a,this._tx=n,this.name=e,this.schema=t,this.hook=a._allTables[e]?a._allTables[e].hook:pt(null,{creating:[Z,G],reading:[X,H],updating:[te,G],deleting:[ee,G]})}))),this.Transaction=(u=this,yt($t.prototype,(function(e,t,n,r,i){var o=this;this.db=u,this.mode=e,this.storeNames=t,this.schema=n,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=pt(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 xe((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(),Xe(e)}))}))),this.Version=(s=this,yt(pn.prototype,(function(e){this.db=s,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))),this.WhereClause=(c=this,yt(Dt.prototype,(function(e,t,n){if(this.db=c,this._ctx={table:e,index:":id"===t?null:t,or:n},this._cmp=this._ascending=ct,this._descending=function(e,t){return ct(t,e)},this._max=function(e,t){return 0<ct(e,t)?e:t},this._min=function(e,t){return ct(e,t)<0?e:t},this._IDBKeyRange=c._deps.IDBKeyRange,!this._IDBKeyRange)throw new W.MissingAPI}))),this.on("versionchange",(function(e){0<e.newVersion?console.warn("Another connection wants to upgrade database '".concat(r.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(r.name,"'. Closing db now to resume the delete request.")),r.close({disableAutoOpen:!1})})),this.on("blocked",(function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('".concat(r.name,"') was blocked")):console.warn("Upgrade '".concat(r.name,"' blocked by other connection holding version ").concat(e.oldVersion/10))})),this._maxKey=Yt(n.IDBKeyRange),this._createTransaction=function(e,t,n,i){return new r.Transaction(e,t,n,r._options.chromeTransactionDurability,i)},this._fireOnBlocked=function(e){r.on("blocked").fire(e),tt.filter((function(e){return e.name===r.name&&e!==r&&!e._state.vcFired})).map((function(t){return t.on("versionchange").fire(e)}))},this.use(Un),this.use(Zn),this.use(Wn),this.use(Mn),this.use(Ln);var f=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return er(r.table(e),f)};var i=Reflect.get(e,t,n);return i instanceof ht?er(i,f):"tables"===t?i.map((function(e){return er(e,f)})):"_createTransaction"===t?function(){return er(i.apply(this,arguments),f)}:i}});this.vip=f,i.forEach((function(e){return e(r)}))}M="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";var rr,ir=(or.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},or.prototype[M]=function(){return this},or);function or(e){this._subscribe=e}try{rr={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch(E){rr={indexedDB:null,IDBKeyRange:null}}function ar(e){var t,n=!1,r=new ir((function(r){var i,o=R(e),a=!1,u={},s={},c={get closed(){return a},unsubscribe:function(){a||(a=!0,i&&i.abort(),f&&Lt.storagemutated.unsubscribe(d))}};r.start&&r.start(c);var f=!1,h=function(){return He(p)},d=function(e){Sn(u,e),Kn(s,u)&&h()},p=function(){var c,p,y;!a&&rr.indexedDB&&(u={},c={},i&&i.abort(),i=new AbortController,y=function(t){var n=Ce();try{o&&$e();var r=Le(e,t);return r=o?r.finally(Ue):r}finally{n&&je()}}(p={subscr:c,signal:i.signal,requery:h,querier:e,trans:null}),Promise.resolve(y).then((function(e){n=!0,t=e,a||p.signal.aborted||(u={},function(e){for(var t in e)if(l(e,t))return;return 1}(s=c)||f||(Lt(Nt,d),f=!0),He((function(){return!a&&r.next&&r.next(e)})))}),(function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||a||He((function(){a||r.error&&r.error(e)}))})))};return setTimeout(h,0),c}));return r.hasValue=function(){return n},r.getValue=function(){return t},r}var ur=tr;function sr(e){var t=lr;try{lr=!0,Lt.storagemutated.fire(e),Tn(e,!0)}finally{lr=t}}f(ur,t(t({},Q),{delete:function(e){return new ur(e,{addons:[]}).delete()},exists:function(e){return new ur(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){try{return n=(t=ur.dependencies).indexedDB,t=t.IDBKeyRange,(vn(n)?Promise.resolve(n.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==nt}))})):mn(n,t).toCollection().primaryKeys()).then(e)}catch(e){return Xe(new W.MissingAPI)}var t,n},defineClass:function(){return function(e){u(this,e)}},ignoreTransaction:function(e){return be.trans?Qe(be.transless,e):e()},vip:bn,async:function(e){return function(){try{var t=In(e.apply(this,arguments));return t&&"function"==typeof t.then?t:xe.resolve(t)}catch(t){return Xe(t)}}},spawn:function(e,t,n){try{var r=In(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:xe.resolve(r)}catch(e){return Xe(e)}},currentTransaction:{get:function(){return be.trans||null}},waitFor:function(e,t){return t=xe.resolve("function"==typeof e?ur.ignoreTransaction(e):e).timeout(t||6e4),be.trans?be.trans.waitFor(t):t},Promise:xe,debug:{get:function(){return ie},set:function(e){oe(e)}},derive:p,extend:u,props:f,override:b,Events:pt,on:Lt,liveQuery:ar,extendObservabilitySet:Sn,getByKeyPath:_,setByKeyPath:x,delByKeyPath:function(e,t){"string"==typeof t?x(e,t,void 0):"length"in t&&[].map.call(t,(function(t){x(e,t,void 0)}))},shallowClone:k,deepClone:A,getObjectDiff:Nn,cmp:ct,asap:w,minKey:-1/0,addons:[],connections:tt,errnames:V,dependencies:rr,cache:An,semVer:"4.0.10",version:"4.0.10".split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)}))})),ur.maxKey=Yt(ur.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(Lt(Nt,(function(e){lr||(e=new CustomEvent(Ft,{detail:e}),lr=!0,dispatchEvent(e),lr=!1)})),addEventListener(Ft,(function(e){e=e.detail,lr||sr(e)})));var cr,lr=!1,fr=function(){};return"undefined"!=typeof BroadcastChannel&&((fr=function(){(cr=new BroadcastChannel(Ft)).onmessage=function(e){return e.data&&sr(e.data)}})(),"function"==typeof cr.unref&&cr.unref(),Lt(Nt,(function(e){lr||cr.postMessage(e)}))),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",(function(e){if(!tr.disableBfCache&&e.persisted){ie&&console.debug("Dexie: handling persisted pagehide"),null!=cr&&cr.close();for(var t=0,n=tt;t<n.length;t++)n[t].close({disableAutoOpen:!1})}})),addEventListener("pageshow",(function(e){!tr.disableBfCache&&e.persisted&&(ie&&console.debug("Dexie: handling persisted pageshow"),fr(),sr({all:new wn(-1/0,[[]])}))}))),xe.rejectionMapper=function(e,t){return!e||e instanceof F||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Y[e.name]?e:(t=new Y[e.name](t||e.message,e),"stack"in e&&d(t,"stack",{get:function(){return this.inner.stack}}),t)},oe(ie),t(tr,Object.freeze({__proto__:null,Dexie:tr,liveQuery:ar,Entity:st,cmp:ct,PropModSymbol:E,PropModification:kt,replacePrefix:function(e,t){return new kt({replacePrefix:[e,t]})},add:function(e){return new kt({add:e})},remove:function(e){return new kt({remove:e})},default:tr,RangeSet:wn,mergeRanges:xn,rangesOverlap:kn}),{default:tr}),tr}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(744);const t=Symbol.for("Dexie"),r=globalThis[t]||(globalThis[t]=e);if(e.semVer!==r.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${e.semVer} and ${r.semVer}`);const{liveQuery:i,mergeRanges:o,rangesOverlap:a,RangeSet:u,cmp:s,Entity:c,PropModSymbol:l,PropModification:f,replacePrefix:h,add:d,remove:p}=r;class y{constructor(e,t,n){this.name=e,this.table=t,this.keys=n}database(){const e=new r(this.name);let t=1;for(let n of this.keys)e.version(t).stores({[this.table]:n}),t++;return e}async save(e){const t=this.database();await t[this.table].bulkPut(e).then((()=>{t.close()})).catch((e=>{throw console.error("Error in db.save",e),e}))}async read(e="name"){const t=this.database();return await t[this.table].orderBy(e).toArray().then((e=>(t.close(),e))).catch((e=>{throw console.error("Error in db.read",errerr),e}))}async getFirstRow(){const e=this.database();return await e[this.table].orderBy(":id").first().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.getFirstRow",e),e}))}async delete(){const e=new r(this.name);await e.delete().then((()=>{e.close()})).catch((e=>{throw console.warn("Error in db.delete",e),e}))}async count(){const e=this.database();return await e[this.table].count().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.count",e),e}))}async getVersion(){return await new r(this.name).open().then((e=>{const t=e.verno;return e.close(),t})).catch((e=>{throw console.error("Error in db.getVersion",e),e}))}}const m=window.wp.apiFetch;var v=n.n(m);async function b(e,t){try{await v().use(v().createNonceMiddleware(pluginAllSitesMenu.nonce));const n=await v()({url:pluginAllSitesMenu.restURL,method:"POST",data:{offset:t}}).catch((e=>{throw console.error("Error in apiFetch",e),e}));"success"===n.response&&(t+=pluginAllSitesMenu.loadincrements,e.save(n.data),await b(e,t))}catch(e){throw console.error("Error in loadSites",e),e}}function g(e,t){if(!e)return;e.classList&&e.classList.add?e.classList.add(t):_(e,t)||(e.className&&(e.className+=" "),e.className+=t);let n=e.getBoundingClientRect().top,r=e.querySelector(".ab-submenu");r.style.top=n-6+"px",r.getBoundingClientRect().bottom>window.innerHeight&&(r.style.top="auto",r.style.bottom="0")}function w(e,t){let n,r;if(e||_(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=` ${t} `,r=` ${e.className} `;r.indexOf(n)>-1;)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function _(e,t){let n;return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&(n=e.className.split(" "),n.indexOf(t)>-1))}const x=window.wp.i18n;document.addEventListener("DOMContentLoaded",(async()=>{if(!document.getElementById("wpadminbar"))return;const e={load:document.querySelector("#wp-admin-bar-load-more"),menu:document.querySelector("#wp-admin-bar-my-sites-list"),timestamp:document.querySelector("#load-more-timestamp")};!0===pluginAllSitesMenu.displaySearch&&function(){const e=document.querySelector("#all-sites-search-text");null!==e&&e.addEventListener("keyup",(e=>{e.preventDefault();const t=e.target.value.toUpperCase(),n=document.querySelector("#wp-admin-bar-my-sites-list").getElementsByClassName("menupop");for(let e=0;e<n.length;e++){let r=n[e].querySelector(".ab-item");(r.textContent||r.innerText).toUpperCase().indexOf(t)>-1?n[e].style.display="":n[e].style.display="none"}}))}();const t=new y("allsites","sites",["id,name,url","id,name,url,timestamp"]);var n;n=e.menu,new IntersectionObserver((e=>{e.forEach((e=>{const t=e.boundingClientRect,n=t.bottom<window.innerHeight&&t.bottom;if(window.matchMedia("(min-width: 783px)").matches){const e=document.querySelector("#wp-admin-bar-my-sites>.ab-sub-wrapper");n?(e.style.height="",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="0"):(e.style.height="calc(100vh - 32px)",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="32px")}}))}),{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]}).observe(n),await async function(e){const t=await e.getFirstRow();void 0!==t&&void 0!==t.timestamp&&pluginAllSitesMenu.timestamp>t.timestamp&&await e.delete();0===await e.count()&&b(e,0)}(t);const r=function(e,t){const n=new IntersectionObserver((n=>{n.forEach((e=>{const{isIntersecting:n}=e;n&&t()}),{root:e})}));return n.observe(e),n}(e.load,(async()=>{const n=(await t.read(pluginAllSitesMenu.orderBy)).reduce(((e,t)=>e+function(e){return`\n\t\t\t\t<li id="wp-admin-bar-${e.id}" class="menupop">\n\t\t\t\t<a class="ab-item" aria-haspopup="true" href="${e.admin}/"><span class="wp-admin-bar-arrow" aria-hidden="true"></span>\n\t\t\t\t\t${e.title}\n\t\t\t\t</a>\n\t\t\t\t<div class="ab-sub-wrapper">\n\t\t\t\t\t<ul id="wp-admin-bar-${e.id}-default" class="ab-submenu">\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-d"><a class="ab-item"\thref="${e.admin}">${(0,x.__)("Dashboard","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-n"><a class="ab-item" href="${e.admin}/post-new.php">${(0,x.__)("New Post","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-o"><a class="ab-item" href="${e.admin}/post-new.php?post_type=page">${(0,x.__)("New Page","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-c"><a class="ab-item" href="${e.admin}/edit-comments.php">${(0,x.__)("Manage Comments","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-u"><a class="ab-item" href="${e.admin}/users.php">${(0,x.__)("Users","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-p"><a class="ab-item" href="${e.admin}/plugins.php">${(0,x.__)("Plugins","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-s"><a class="ab-item" href="${e.admin}/options-general.php">${(0,x.__)("Settings","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-v"><a class="ab-item" href="${e.url}/">${(0,x.__)("Visit","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t`}(t)),"");e.load.insertAdjacentHTML("beforeBegin",n),function(){const e=document.getElementById("wp-admin-bar-my-sites-list");e&&(e.addEventListener("mouseenter",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&g(e.target,"hover")}),{capture:!0}),e.addEventListener("mouseleave",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&w(e.target,"hover")}),{capture:!0}),e.addEventListener("keydown",(e=>{"Tab"===e.key&&(e.preventDefault(),e.target.classList.contains("menupop")&&toggleClass(e.target,"hover"))}),{capture:!0}))}(),e.load.style.display="none",r.unobserve(e.load)}))}))})()})(); -
super-admin-all-sites-menu/trunk/readme.txt
r3036551 r3207453 1 1 === Super Admin All Sites Menu === 2 Stable tag: 1.6. 72 Stable tag: 1.6.9 3 3 Requires at least: 5.6 4 Tested up to: 6. 44 Tested up to: 6.7 5 5 Requires PHP: 7.3 6 6 License: GPL v2 or later … … 101 101 == Changelog == 102 102 103 = 1.6.9 = 104 105 - Update dependencies 106 107 = 1.6.8 = 108 109 - Update dependencies 110 103 111 = 1.6.7 = 104 112 -
super-admin-all-sites-menu/trunk/super-admin-all-sites-menu.php
r3036551 r3207453 13 13 * GitHub Plugin URI: https://github.com/soderlind/super-admin-all-sites-menu 14 14 * Description: For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu. 15 * Version: 1.6. 715 * Version: 1.6.9 16 16 * Author: Per Soderlind 17 17 * Network: true … … 439 439 ); 440 440 441 wp_add_inline_script( 'super-admin-all-sites-menu', "const pluginAllSitesMenu = ${data};", 'before' );441 wp_add_inline_script( 'super-admin-all-sites-menu', "const pluginAllSitesMenu = {$data};", 'before' ); 442 442 wp_set_script_translations( 'super-admin-all-sites-menu', 'super-admin-all-sites-menu' ); 443 443 }
Note: See TracChangeset
for help on using the changeset viewer.