UNPKG

74.2 kBJavaScriptView Raw
1// pouchdb-find plugin 8.0.1
2// Based on Mango: https://github.com/cloudant/mango
3//
4// (c) 2012-2023 Dale Harvey and the PouchDB team
5// PouchDB may be freely distributed under the Apache license, version 2.0.
6// For all details and documentation:
7// http://pouchdb.com
8!function e(t,n,r){function i(u,s){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(o)return o(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[u]={exports:{}};t[u][0].call(f.exports,(function(e){return i(t[u][1][e]||e)}),f,f.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,t,n){},{}],2:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function u(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._maxListeners=void 0;var s,a=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),s=0===c.x}catch(e){s=!1}function f(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n){if(t)e.call(n);else for(var r=e.length,i=w(e,r),o=0;o<r;++o)i[o].call(n)}function d(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=w(e,i),u=0;u<i;++u)o[u].call(n,r)}function h(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,u=w(e,o),s=0;s<o;++s)u[s].call(n,r,i)}function p(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var u=e.length,s=w(e,u),a=0;a<u;++a)s[a].call(n,r,i,o)}function y(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=w(e,i),u=0;u<i;++u)o[u].apply(n,r)}function v(e,t,n,i){var o,u,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((u=e._events)?(u.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),u=e._events),s=u[t]):(u=e._events=r(null),e._eventsCount=0),s){if("function"==typeof s?s=u[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(o=f(e))&&o>0&&s.length>o){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else s=u[t]=n,++e._eventsCount;return e}function g(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function m(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=o.call(g,r);return i.listener=n,r.wrapFn=i,i}function _(e,t,n){var r=e._events;if(!r)return[];var i=r[t];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):w(i,i.length):[]}function b(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function w(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}s?Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');a=e}}):u.defaultMaxListeners=a,u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return f(this)},u.prototype.emit=function(e){var t,n,r,i,o,u,s="error"===e;if(u=this._events)s=s&&null==u.error;else if(!s)return!1;if(s){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var a=new Error('Unhandled "error" event. ('+t+")");throw a.context=t,a}if(!(n=u[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:l(n,c,this);break;case 2:d(n,c,this,arguments[1]);break;case 3:h(n,c,this,arguments[1],arguments[2]);break;case 4:p(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];y(n,c,this,i)}return!0},u.prototype.addListener=function(e,t){return v(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return v(this,e,t,!0)},u.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,m(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,m(this,e,t)),this},u.prototype.removeListener=function(e,t){var n,i,o,u,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,u=n.length-1;u>=0;u--)if(n[u]===t||n[u].listener===t){s=n[u].listener,o=u;break}if(o<0)return this;0===o?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),i.removeListener&&this.emit("removeListener",e,s||t)}return this},u.prototype.removeAllListeners=function(e){var t,n,o;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var u,s=i(n);for(o=0;o<s.length;++o)"removeListener"!==(u=s[o])&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},u.prototype.listeners=function(e){return _(this,e,!0)},u.prototype.rawListeners=function(e){return _(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},u.prototype.listenerCount=b,u.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],3:[function(e,t,n){"use strict";var r,i,o,u=[e(1),e(6),e(5),e(4),e(7),e(8)],s=-1,a=[],c=!1;function f(){r&&i&&(r=!1,i.length?a=i.concat(a):s=-1,a.length&&l())}function l(){if(!r){c=!1,r=!0;for(var e=a.length,t=setTimeout(f);e;){for(i=a,a=[];i&&++s<e;)i[s].run();s=-1,e=a.length}i=null,s=-1,r=!1,clearTimeout(t)}}for(var d=-1,h=u.length;++d<h;)if(u[d]&&u[d].test&&u[d].test()){o=u[d].install(l);break}function p(e,t){this.fun=e,this.array=t}p.prototype.run=function(){var e=this.fun,t=this.array;switch(t.length){case 0:return e();case 1:return e(t[0]);case 2:return e(t[0],t[1]);case 3:return e(t[0],t[1],t[2]);default:return e.apply(null,t)}},t.exports=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];a.push(new p(e,t)),c||r||(c=!0,o())}},{1:1,4:4,5:5,6:6,7:7,8:8}],4:[function(e,t,n){(function(e){(function(){"use strict";n.test=function(){return!e.setImmediate&&void 0!==e.MessageChannel},n.install=function(t){var n=new e.MessageChannel;return n.port1.onmessage=t,function(){n.port2.postMessage(0)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(e,t,n){(function(e){(function(){"use strict";var t=e.MutationObserver||e.WebKitMutationObserver;n.test=function(){return t},n.install=function(n){var r=0,i=new t(n),o=e.document.createTextNode("");return i.observe(o,{characterData:!0}),function(){o.data=r=++r%2}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(e,t,n){(function(e){(function(){"use strict";n.test=function(){return"function"==typeof e.queueMicrotask},n.install=function(t){return function(){e.queueMicrotask(t)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,n){(function(e){(function(){"use strict";n.test=function(){return"document"in e&&"onreadystatechange"in e.document.createElement("script")},n.install=function(t){return function(){var n=e.document.createElement("script");return n.onreadystatechange=function(){t(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},e.document.documentElement.appendChild(n),t}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,t,n){"use strict";n.test=function(){return!0},n.install=function(e){return function(){setTimeout(e,0)}}},{}],9:[function(e,t,n){!function(e){if("object"==typeof n)t.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var r;try{r=window}catch(e){r=self}r.SparkMD5=e()}}((function(e){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],i=e[2],o=e[3];r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&i)+t[1]-389564586|0)<<12|o>>>20)+n|0)&n|~o&r)+t[2]+606105819|0)<<17|i>>>15)+o|0)&o|~i&n)+t[3]-1044525330|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&i)+t[5]+1200080426|0)<<12|o>>>20)+n|0)&n|~o&r)+t[6]-1473231341|0)<<17|i>>>15)+o|0)&o|~i&n)+t[7]-45705983|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&i)+t[9]-1958414417|0)<<12|o>>>20)+n|0)&n|~o&r)+t[10]-42063|0)<<17|i>>>15)+o|0)&o|~i&n)+t[11]-1990404162|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&i|~r&o)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&i)+t[13]-40341101|0)<<12|o>>>20)+n|0)&n|~o&r)+t[14]-1502002290|0)<<17|i>>>15)+o|0)&o|~i&n)+t[15]+1236535329|0)<<22|r>>>10)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[1]-165796510|0)<<5|n>>>27)+r|0)&i|r&~i)+t[6]-1069501632|0)<<9|o>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|i>>>18)+o|0)&n|o&~n)+t[0]-373897302|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[5]-701558691|0)<<5|n>>>27)+r|0)&i|r&~i)+t[10]+38016083|0)<<9|o>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|i>>>18)+o|0)&n|o&~n)+t[4]-405537848|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[9]+568446438|0)<<5|n>>>27)+r|0)&i|r&~i)+t[14]-1019803690|0)<<9|o>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|i>>>18)+o|0)&n|o&~n)+t[8]+1163531501|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r&o|i&~o)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&i|r&~i)+t[2]-51403784|0)<<9|o>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|i>>>18)+o|0)&n|o&~n)+t[12]-1926607734|0)<<20|r>>>12)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^i)+t[8]-2022574463|0)<<11|o>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|i>>>16)+o|0)^o^n)+t[14]-35309556|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^i)+t[4]+1272893353|0)<<11|o>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|i>>>16)+o|0)^o^n)+t[10]-1094730640|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^i)+t[0]-358537222|0)<<11|o>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|i>>>16)+o|0)^o^n)+t[6]+76029189|0)<<23|r>>>9)+i|0,r=((r+=((i=((i+=((o=((o+=((n=((n+=(r^i^o)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^i)+t[12]-421815835|0)<<11|o>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|i>>>16)+o|0)^o^n)+t[2]-995338651|0)<<23|r>>>9)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~i))+t[7]+1126891415|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[14]-1416354905|0)<<15|i>>>17)+o|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~i))+t[3]-1894986606|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[10]-1051523|0)<<15|i>>>17)+o|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~i))+t[15]-30611744|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[6]-1560198380|0)<<15|i>>>17)+o|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+i|0,r=((r+=((o=((o+=(r^((n=((n+=(i^(r|~o))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~i))+t[11]-1120210379|0)<<10|o>>>22)+n|0)^((i=((i+=(n^(o|~r))+t[2]+718787259|0)<<15|i>>>17)+o|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function o(e){var t,i,o,u,s,a,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(f,r(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<i;t+=1)o[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(f,o),t=0;t<16;t+=1)o[t]=0;return u=(u=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(u[2],16),a=parseInt(u[1],16)||0,o[14]=s,o[15]=a,n(f,o),f}function u(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;t<e.length;t+=1)e[t]=u(e[t]);return e.join("")}function a(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function c(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function f(){this.reset()}return"5d41402abc4b2a76b9719d911017c592"!==s(o("hello"))&&function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var i,o,u,s,a=this.byteLength,c=t(n,a),f=a;return r!==e&&(f=t(r,a)),c>f?new ArrayBuffer(0):(i=f-c,o=new ArrayBuffer(i),u=new Uint8Array(o),s=new Uint8Array(this,c,i),u.set(s),o)}}(),f.prototype.append=function(e){return this.appendBinary(a(e)),this},f.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},f.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),n=s(this._hash),e&&(n=c(n)),this.reset(),n},f.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},f.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},f.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},f.prototype._finish=function(e,t){var r,i,o,u=t;if(e[u>>2]|=128<<(u%4<<3),u>55)for(n(this._hash,e),u=0;u<16;u+=1)e[u]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(r[2],16),o=parseInt(r[1],16)||0,e[14]=i,e[15]=o,n(this._hash,e)},f.hash=function(e,t){return f.hashBinary(a(e),t)},f.hashBinary=function(e,t){var n=s(o(e));return t?c(n):n},f.ArrayBuffer=function(){this.reset()},f.ArrayBuffer.prototype.append=function(e){var t,r,o,u,s,a=(r=this._buff.buffer,o=e,u=!0,(s=new Uint8Array(r.byteLength+o.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(o),r.byteLength),u?s:s.buffer),c=a.length;for(this._length+=e.byteLength,t=64;t<=c;t+=64)n(this._hash,i(a.subarray(t-64,t)));return this._buff=t-64<c?new Uint8Array(a.buffer.slice(t-64)):new Uint8Array(0),this},f.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,i=r.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<i;t+=1)o[t>>2]|=r[t]<<(t%4<<3);return this._finish(o,i),n=s(this._hash),e&&(n=c(n)),this.reset(),n},f.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.ArrayBuffer.prototype.getState=function(){var e,t=f.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},f.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,i=new ArrayBuffer(r),o=new Uint8Array(i);for(n=0;n<r;n+=1)o[n]=e.charCodeAt(n);return t?o:i}(e.buff,!0),f.prototype.setState.call(this,e)},f.ArrayBuffer.prototype.destroy=f.prototype.destroy,f.ArrayBuffer.prototype._finish=f.prototype._finish,f.ArrayBuffer.hash=function(e,t){var r=s(function(e){var t,r,o,u,s,a,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(f,i(e.subarray(t-64,t)));for(r=(e=t-64<c?e.subarray(t-64):new Uint8Array(0)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)o[t>>2]|=e[t]<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(f,o),t=0;t<16;t+=1)o[t]=0;return u=(u=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(u[2],16),a=parseInt(u[1],16)||0,o[14]=s,o[15]=a,n(f,o),f}(new Uint8Array(e)));return t?c(r):r},f}))},{}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"v1",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(n,"v3",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(n,"v4",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(n,"v5",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(n,"NIL",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(n,"version",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(n,"validate",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(n,"parse",{enumerable:!0,get:function(){return l.default}});var r=d(e(18)),i=d(e(19)),o=d(e(21)),u=d(e(22)),s=d(e(12)),a=d(e(24)),c=d(e(23)),f=d(e(17)),l=d(e(13));function d(e){return e&&e.__esModule?e:{default:e}}},{12:12,13:13,17:17,18:18,19:19,21:21,22:22,23:23,24:24}],11:[function(e,t,n){"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function i(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,r,o,u){return i((s=i(i(t,e),i(r,u)))<<(a=o)|s>>>32-a,n);var s,a}function u(e,t,n,r,i,u,s){return o(t&n|~t&r,e,t,i,u,s)}function s(e,t,n,r,i,u,s){return o(t&r|n&~r,e,t,i,u,s)}function a(e,t,n,r,i,u,s){return o(t^n^r,e,t,i,u,s)}function c(e,t,n,r,i,u,s){return o(n^(t|~r),e,t,i,u,s)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var f=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length;for(let r=0;r<n;r+=8){const n=e[r>>5]>>>r%32&255,i=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[r(t)-1]=t;let n=1732584193,o=-271733879,f=-1732584194,l=271733878;for(let t=0;t<e.length;t+=16){const r=n,d=o,h=f,p=l;n=u(n,o,f,l,e[t],7,-680876936),l=u(l,n,o,f,e[t+1],12,-389564586),f=u(f,l,n,o,e[t+2],17,606105819),o=u(o,f,l,n,e[t+3],22,-1044525330),n=u(n,o,f,l,e[t+4],7,-176418897),l=u(l,n,o,f,e[t+5],12,1200080426),f=u(f,l,n,o,e[t+6],17,-1473231341),o=u(o,f,l,n,e[t+7],22,-45705983),n=u(n,o,f,l,e[t+8],7,1770035416),l=u(l,n,o,f,e[t+9],12,-1958414417),f=u(f,l,n,o,e[t+10],17,-42063),o=u(o,f,l,n,e[t+11],22,-1990404162),n=u(n,o,f,l,e[t+12],7,1804603682),l=u(l,n,o,f,e[t+13],12,-40341101),f=u(f,l,n,o,e[t+14],17,-1502002290),o=u(o,f,l,n,e[t+15],22,1236535329),n=s(n,o,f,l,e[t+1],5,-165796510),l=s(l,n,o,f,e[t+6],9,-1069501632),f=s(f,l,n,o,e[t+11],14,643717713),o=s(o,f,l,n,e[t],20,-373897302),n=s(n,o,f,l,e[t+5],5,-701558691),l=s(l,n,o,f,e[t+10],9,38016083),f=s(f,l,n,o,e[t+15],14,-660478335),o=s(o,f,l,n,e[t+4],20,-405537848),n=s(n,o,f,l,e[t+9],5,568446438),l=s(l,n,o,f,e[t+14],9,-1019803690),f=s(f,l,n,o,e[t+3],14,-187363961),o=s(o,f,l,n,e[t+8],20,1163531501),n=s(n,o,f,l,e[t+13],5,-1444681467),l=s(l,n,o,f,e[t+2],9,-51403784),f=s(f,l,n,o,e[t+7],14,1735328473),o=s(o,f,l,n,e[t+12],20,-1926607734),n=a(n,o,f,l,e[t+5],4,-378558),l=a(l,n,o,f,e[t+8],11,-2022574463),f=a(f,l,n,o,e[t+11],16,1839030562),o=a(o,f,l,n,e[t+14],23,-35309556),n=a(n,o,f,l,e[t+1],4,-1530992060),l=a(l,n,o,f,e[t+4],11,1272893353),f=a(f,l,n,o,e[t+7],16,-155497632),o=a(o,f,l,n,e[t+10],23,-1094730640),n=a(n,o,f,l,e[t+13],4,681279174),l=a(l,n,o,f,e[t],11,-358537222),f=a(f,l,n,o,e[t+3],16,-722521979),o=a(o,f,l,n,e[t+6],23,76029189),n=a(n,o,f,l,e[t+9],4,-640364487),l=a(l,n,o,f,e[t+12],11,-421815835),f=a(f,l,n,o,e[t+15],16,530742520),o=a(o,f,l,n,e[t+2],23,-995338651),n=c(n,o,f,l,e[t],6,-198630844),l=c(l,n,o,f,e[t+7],10,1126891415),f=c(f,l,n,o,e[t+14],15,-1416354905),o=c(o,f,l,n,e[t+5],21,-57434055),n=c(n,o,f,l,e[t+12],6,1700485571),l=c(l,n,o,f,e[t+3],10,-1894986606),f=c(f,l,n,o,e[t+10],15,-1051523),o=c(o,f,l,n,e[t+1],21,-2054922799),n=c(n,o,f,l,e[t+8],6,1873313359),l=c(l,n,o,f,e[t+15],10,-30611744),f=c(f,l,n,o,e[t+6],15,-1560198380),o=c(o,f,l,n,e[t+13],21,1309151649),n=c(n,o,f,l,e[t+4],6,-145523070),l=c(l,n,o,f,e[t+11],10,-1120210379),f=c(f,l,n,o,e[t+2],15,718787259),o=c(o,f,l,n,e[t+9],21,-343485551),n=i(n,r),o=i(o,d),f=i(f,h),l=i(l,p)}return[n,o,f,l]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(r(t));for(let r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))};n.default=f},{}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default="00000000-0000-0000-0000-000000000000"},{}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e(23))&&r.__esModule?r:{default:r};var o=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};n.default=o},{23:23}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},{}],15:[function(e,t,n){"use strict";let r;Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)};const i=new Uint8Array(16)},{}],16:[function(e,t,n){"use strict";function r(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function i(e,t){return e<<t|e>>>32-t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const o=e.length/4+2,u=Math.ceil(o/16),s=new Array(u);for(let t=0;t<u;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];s[t]=n}s[u-1][14]=8*(e.length-1)/Math.pow(2,32),s[u-1][14]=Math.floor(s[u-1][14]),s[u-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<u;++e){const o=new Uint32Array(80);for(let t=0;t<16;++t)o[t]=s[e][t];for(let e=16;e<80;++e)o[e]=i(o[e-3]^o[e-8]^o[e-14]^o[e-16],1);let u=n[0],a=n[1],c=n[2],f=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=i(u,5)+r(n,a,c,f)+l+t[n]+o[e]>>>0;l=f,f=c,c=i(a,30)>>>0,a=u,u=s}n[0]=n[0]+u>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+c>>>0,n[3]=n[3]+f>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]};n.default=o},{}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e(23))&&r.__esModule?r:{default:r};const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).substr(1));var u=function(e,t=0){const n=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!(0,i.default)(n))throw TypeError("Stringified UUID is invalid");return n};n.default=u},{23:23}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e(15)),i=o(e(17));function o(e){return e&&e.__esModule?e:{default:e}}let u,s,a=0,c=0;var f=function(e,t,n){let o=t&&n||0;const f=t||new Array(16);let l=(e=e||{}).node||u,d=void 0!==e.clockseq?e.clockseq:s;if(null==l||null==d){const t=e.random||(e.rng||r.default)();null==l&&(l=u=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==d&&(d=s=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),p=void 0!==e.nsecs?e.nsecs:c+1;const y=h-a+(p-c)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||h>a)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,c=p,s=d,h+=122192928e5;const v=(1e4*(268435455&h)+p)%4294967296;f[o++]=v>>>24&255,f[o++]=v>>>16&255,f[o++]=v>>>8&255,f[o++]=255&v;const g=h/4294967296*1e4&268435455;f[o++]=g>>>8&255,f[o++]=255&g,f[o++]=g>>>24&15|16,f[o++]=g>>>16&255,f[o++]=d>>>8|128,f[o++]=255&d;for(let e=0;e<6;++e)f[o+e]=l[e];return t||(0,i.default)(f)};n.default=f},{15:15,17:17}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e(20)),i=o(e(11));function o(e){return e&&e.__esModule?e:{default:e}}var u=(0,r.default)("v3",48,i.default);n.default=u},{11:11,20:20}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t,n){function o(e,o,u,s){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof o&&(o=(0,i.default)(o)),16!==o.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let a=new Uint8Array(16+e.length);if(a.set(o),a.set(e,o.length),a=n(a),a[6]=15&a[6]|t,a[8]=63&a[8]|128,u){s=s||0;for(let e=0;e<16;++e)u[s+e]=a[e];return u}return(0,r.default)(a)}try{o.name=e}catch(e){}return o.DNS=u,o.URL=s,o},n.URL=n.DNS=void 0;var r=o(e(17)),i=o(e(13));function o(e){return e&&e.__esModule?e:{default:e}}const u="6ba7b810-9dad-11d1-80b4-00c04fd430c8";n.DNS=u;const s="6ba7b811-9dad-11d1-80b4-00c04fd430c8";n.URL=s},{13:13,17:17}],21:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e(15)),i=o(e(17));function o(e){return e&&e.__esModule?e:{default:e}}var u=function(e,t,n){const o=(e=e||{}).random||(e.rng||r.default)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=o[e];return t}return(0,i.default)(o)};n.default=u},{15:15,17:17}],22:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e(20)),i=o(e(16));function o(e){return e&&e.__esModule?e:{default:e}}var u=(0,r.default)("v5",80,i.default);n.default=u},{16:16,20:20}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e(14))&&r.__esModule?r:{default:r};var o=function(e){return"string"==typeof e&&i.default.test(e)};n.default=o},{14:14}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,i=(r=e(23))&&r.__esModule?r:{default:r};var o=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)};n.default=o},{23:23}],25:[function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var i=r(e(3));e(2),e(10);var o=r(e(9));function u(e){if(e instanceof ArrayBuffer)return function(e){if("function"==typeof e.slice)return e.slice(0);var t=new ArrayBuffer(e.byteLength),n=new Uint8Array(t),r=new Uint8Array(e);return n.set(r),t}(e);var t=e.size,n=e.type;return"function"==typeof e.slice?e.slice(0,t,n):e.webkitSlice(0,t,n)}var s,a,c=Function.prototype.toString,f=c.call(Object);function l(e){var t,n,r;if(!e||"object"!=typeof e)return e;if(Array.isArray(e)){for(t=[],n=0,r=e.length;n<r;n++)t[n]=l(e[n]);return t}if(e instanceof Date&&isFinite(e))return e.toISOString();if(function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Blob&&e instanceof Blob}(e))return u(e);if(!function(e){var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==f}(e))return e;for(n in t={},e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=l(e[n]);void 0!==i&&(t[n]=i)}return t}function d(e){return function(...t){t=l(t);var n=this,r="function"==typeof t[t.length-1]&&t.pop(),i=new Promise((function(r,i){var o,u,s;try{var a=(u=function(e,t){e?i(e):r(t)},s=!1,function(...e){if(s)throw new Error("once called more than once");s=!0,u.apply(this,e)});t.push(a),(o=e.apply(n,t))&&"function"==typeof o.then&&r(o)}catch(e){i(e)}}));return r&&i.then((function(e){r(null,e)}),r),i}}function h(e){return"$"+e}function p(e){return e.substring(1)}function y(){this._store={}}function v(e){if(this._store=new y,e&&Array.isArray(e))for(var t=0,n=e.length;t<n;t++)this.add(e[t])}y.prototype.get=function(e){var t=h(e);return this._store[t]},y.prototype.set=function(e,t){var n=h(e);return this._store[n]=t,!0},y.prototype.has=function(e){return h(e)in this._store},y.prototype.keys=function(){return Object.keys(this._store).map(e=>p(e))},y.prototype.delete=function(e){var t=h(e),n=t in this._store;return delete this._store[t],n},y.prototype.forEach=function(e){for(var t=Object.keys(this._store),n=0,r=t.length;n<r;n++){var i=t[n];e(this._store[i],i=p(i))}},Object.defineProperty(y.prototype,"size",{get:function(){return Object.keys(this._store).length}}),v.prototype.add=function(e){return this._store.set(e,!0)},v.prototype.has=function(e){return this._store.has(e)},v.prototype.forEach=function(e){this._store.forEach((function(t,n){e(n)}))},Object.defineProperty(v.prototype,"size",{get:function(){return this._store.size}}),!function(){if("undefined"==typeof Symbol||"undefined"==typeof Map||"undefined"==typeof Set)return!1;var e=Object.getOwnPropertyDescriptor(Map,Symbol.species);return e&&"get"in e&&Map[Symbol.species]===Map}()?(s=v,a=y):(s=Set,a=Map);try{localStorage.setItem("_pouch_check_localstorage",1),!!localStorage.getItem("_pouch_check_localstorage")}catch(e){!1}function g(e){if("undefined"!=typeof console&&"function"==typeof console[e]){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}var m="function"==typeof Object.assign?Object.assign:function(e){for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t};class _ extends Error{constructor(e,t,n){super(),this.status=e,this.name=t,this.message=n,this.error=!0}toString(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})}}new _(401,"unauthorized","Name or password is incorrect."),new _(400,"bad_request","Missing JSON list of 'docs'"),new _(404,"not_found","missing"),new _(409,"conflict","Document update conflict"),new _(400,"bad_request","_id field must contain a string"),new _(412,"missing_id","_id is required for puts"),new _(400,"bad_request","Only reserved document ids may start with underscore."),new _(412,"precondition_failed","Database not open");var b=new _(500,"unknown_error","Database encountered an unknown error");new _(500,"badarg","Some query argument is invalid"),new _(400,"invalid_request","Request was invalid"),new _(400,"query_parse_error","Some query parameter is invalid"),new _(500,"doc_validation","Bad special document member"),new _(400,"bad_request","Something wrong with the request"),new _(400,"bad_request","Document must be a JSON object"),new _(404,"not_found","Database not found"),new _(500,"indexed_db_went_bad","unknown"),new _(500,"web_sql_went_bad","unknown"),new _(500,"levelDB_went_went_bad","unknown"),new _(403,"forbidden","Forbidden by design doc validate_doc_update function"),new _(400,"bad_request","Invalid rev format"),new _(412,"file_exists","The database could not be created, the file already exists."),new _(412,"missing_stub","A pre-existing attachment stub wasn't found"),new _(413,"invalid_url","Provided URL is invalid");function w(e){if("object"!=typeof e){var t=e;(e=b).data=t}return"error"in e&&"conflict"===e.error&&(e.name="conflict",e.status=409),"name"in e||(e.name=e.error||"unknown"),"status"in e||(e.status=500),"message"in e||(e.message=e.message||e.reason),"stack"in e||(e.stack=(new Error).stack),e}function k(e){for(var t=[],n=0,r=e.length;n<r;n++)t=t.concat(e[n]);return t}function $(e){return"boolean"==typeof e._remote?e._remote:"function"==typeof e.type&&(g("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),"http"===e.type())}function O(e,t,n){return e.get(t).catch((function(e){if(404!==e.status)throw e;return{}})).then((function(r){var i=r._rev,o=n(r);return o?(o._id=t,o._rev=i,function(e,t,n){return e.put(t).then((function(e){return{updated:!0,rev:e.rev}}),(function(r){if(409!==r.status)throw r;return O(e,t._id,n)}))}(e,o,n)):{updated:!1,rev:i}}))}function j(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}function x(e,t){return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}([j(e)],{type:t})}function A(e,t){return x(atob(e),t)}self.setImmediate||self.setTimeout;function E(e){return o.hash(e)}var q=Headers;function M(e){return(e=l(e)).index||(e.index={}),["type","name","ddoc"].forEach((function(t){e.index[t]&&(e[t]=e.index[t],delete e.index[t])})),e.fields&&(e.index.fields=e.fields,delete e.fields),e.type||(e.type="json"),e}function S(e,t,n){var r="",i=t,o=!0;if(-1!==["$in","$nin","$or","$and","$mod","$nor","$all"].indexOf(e)&&(Array.isArray(t)||(r="Query operator "+e+" must be an array.")),-1!==["$not","$elemMatch","$allMatch"].indexOf(e)&&(Array.isArray(t)||"object"!=typeof t||null===t)&&(r="Query operator "+e+" must be an object."),"$mod"===e&&Array.isArray(t))if(2!==t.length)r="Query operator $mod must be in the format [divisor, remainder], where divisor and remainder are both integers.";else{var u=t[0],s=t[1];0===u&&(r="Query operator $mod's divisor cannot be 0, cannot divide by zero.",o=!1),"number"==typeof u&&parseInt(u,10)===u||(r="Query operator $mod's divisor is not an integer.",i=u),parseInt(s,10)!==s&&(r="Query operator $mod's remainder is not an integer.",i=s)}if("$exists"===e&&"boolean"!=typeof t&&(r="Query operator $exists must be a boolean."),"$type"===e){var a=["null","boolean","number","string","array","object"],c='"'+a.slice(0,a.length-1).join('", "')+'", or "'+a[a.length-1]+'"';("string"!=typeof t||-1==a.indexOf(t))&&(r="Query operator $type must be a string. Supported values: "+c+".")}if("$size"===e&&parseInt(t,10)!==t&&(r="Query operator $size must be a integer."),"$regex"===e&&"string"!=typeof t&&(n?r="Query operator $regex must be a string.":t instanceof RegExp||(r="Query operator $regex must be a string or an instance of a javascript regular expression.")),r){if(o)r+=" Received"+(null===i?" ":Array.isArray(i)?" array":" "+typeof i)+": "+("object"==typeof i&&null!==i?JSON.stringify(i,null,"\t"):i);throw new Error(r)}}var P=["$all","$allMatch","$and","$elemMatch","$exists","$in","$mod","$nin","$nor","$not","$or","$regex","$size","$type"],B=["$in","$nin","$mod","$all"],C=["$eq","$gt","$gte","$lt","$lte"];function I(e,t){if(Array.isArray(e))for(var n of e)"object"==typeof n&&null!==u&&I(n,t);else for(var r=Object.keys(e),i=0;i<r.length;i++){var o=r[i],u=e[o];-1!==P.indexOf(o)&&S(o,u,t),-1===C.indexOf(o)&&(-1===B.indexOf(o)&&"object"==typeof u&&null!==u&&I(u,t))}}function L(e,t,n,r){var i,o;n.headers=new q({"Content-type":"application/json"}),e.fetch(t,n).then((function(e){return i=e.status,o=e.ok,e.json()})).then((function(e){if(o)r(null,e);else{e.status=i;var t=w(e);r(t)}})).catch(r)}function U(e,t,n){t=M(t),L(e,"_index",{method:"POST",body:JSON.stringify(t)},n)}function D(e,t,n){I(t.selector,!0),L(e,"_find",{method:"POST",body:JSON.stringify(t)},n)}function N(e,t,n){L(e,"_explain",{method:"POST",body:JSON.stringify(t)},n)}function T(e,t){L(e,"_index",{method:"GET"},t)}function F(e,t,n){var r=t.ddoc,i=t.type||"json",o=t.name;return r?o?void L(e,"_index/"+[r,i,o].map(encodeURIComponent).join("/"),{method:"DELETE"},n):n(new Error("you must provide an index's name")):n(new Error("you must provide an index's ddoc"))}function R(e,t){for(var n=e,r=0,i=t.length;r<i;r++){if(!(n=n[t[r]]))break}return n}function z(e,t,n){for(var r=0,i=t.length;r<i-1;r++){var o=t[r];e=e[o]=e[o]||{}}e[t[i-1]]=n}function J(e,t){return e<t?-1:e>t?1:0}function V(e){for(var t=[],n="",r=0,i=e.length;r<i;r++){var o=e[r];r>0&&"\\"===e[r-1]&&("$"===o||"."===o)?n=n.substring(0,n.length-1)+o:"."===o?(t.push(n),n=""):n+=o}return t.push(n),t}var Q=["$or","$nor","$not"];function K(e){return Q.indexOf(e)>-1}function X(e){return Object.keys(e)[0]}function W(e){return e[X(e)]}function G(e){var t={},n={$or:!0,$nor:!0};return e.forEach((function(e){Object.keys(e).forEach((function(r){var i=e[r];if("object"!=typeof i&&(i={$eq:i}),K(r))if(i instanceof Array){if(n[r])return n[r]=!1,void(t[r]=i);var o=[];t[r].forEach((function(e){Object.keys(i).forEach((function(t){var n=i[t],r=Math.max(Object.keys(e).length,Object.keys(n).length),u=G([e,n]);Object.keys(u).length<=r||o.push(u)}))})),t[r]=o}else t[r]=G([i]);else{var u=t[r]=t[r]||{};Object.keys(i).forEach((function(e){var t=i[e];return"$gt"===e||"$gte"===e?function(e,t,n){if(void 0!==n.$eq)return;void 0!==n.$gte?"$gte"===e?t>n.$gte&&(n.$gte=t):t>=n.$gte&&(delete n.$gte,n.$gt=t):void 0!==n.$gt?"$gte"===e?t>n.$gt&&(delete n.$gt,n.$gte=t):t>n.$gt&&(n.$gt=t):n[e]=t}(e,t,u):"$lt"===e||"$lte"===e?function(e,t,n){if(void 0!==n.$eq)return;void 0!==n.$lte?"$lte"===e?t<n.$lte&&(n.$lte=t):t<=n.$lte&&(delete n.$lte,n.$lt=t):void 0!==n.$lt?"$lte"===e?t<n.$lt&&(delete n.$lt,n.$lte=t):t<n.$lt&&(n.$lt=t):n[e]=t}(e,t,u):"$ne"===e?function(e,t){"$ne"in t?t.$ne.push(e):t.$ne=[e]}(t,u):"$eq"===e?function(e,t){delete t.$gt,delete t.$gte,delete t.$lt,delete t.$lte,delete t.$ne,t.$eq=e}(t,u):"$regex"===e?function(e,t){"$regex"in t?t.$regex.push(e):t.$regex=[e]}(t,u):void(u[e]=t)}))}}))})),t}function Y(e){var t=l(e);(function e(t,n){for(var r in t){"$and"===r&&(n=!0);var i=t[r];"object"==typeof i&&(n=e(i,n))}return n})(t,!1)&&"$and"in(t=function e(t){for(var n in t){if(Array.isArray(t))for(var r in t)t[r].$and&&(t[r]=G(t[r].$and));var i=t[n];"object"==typeof i&&e(i)}return t}(t))&&(t=G(t.$and)),["$or","$nor"].forEach((function(e){e in t&&t[e].forEach((function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var r=t[n],i=e[r];"object"==typeof i&&null!==i||(e[r]={$eq:i})}}))})),"$not"in t&&(t.$not=G([t.$not]));for(var n=Object.keys(t),r=0;r<n.length;r++){var i=n[r],o=t[i];"object"==typeof o&&null!==o||(o={$eq:o}),t[i]=o}return function e(t){Object.keys(t).forEach((function(n){var r=t[n];Array.isArray(r)?r.forEach((function(t){t&&"object"==typeof t&&e(t)})):"$ne"===n?t.$ne=[r]:"$regex"===n?t.$regex=[r]:r&&"object"==typeof r&&e(r)}))}(t),t}function H(e,t){if(e===t)return 0;e=Z(e),t=Z(t);var n=ie(e),r=ie(t);if(n-r!=0)return n-r;switch(typeof e){case"number":return e-t;case"boolean":return e<t?-1:1;case"string":return function(e,t){return e===t?0:e>t?1:-1}(e,t)}return Array.isArray(e)?function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=H(e[r],t[r]);if(0!==i)return i}return e.length===t.length?0:e.length>t.length?1:-1}(e,t):function(e,t){for(var n=Object.keys(e),r=Object.keys(t),i=Math.min(n.length,r.length),o=0;o<i;o++){var u=H(n[o],r[o]);if(0!==u)return u;if(0!==(u=H(e[n[o]],t[r[o]])))return u}return n.length===r.length?0:n.length>r.length?1:-1}(e,t)}function Z(e){switch(typeof e){case"undefined":return null;case"number":return e===1/0||e===-1/0||isNaN(e)?null:e;case"object":var t=e;if(Array.isArray(e)){var n=e.length;e=new Array(n);for(var r=0;r<n;r++)e[r]=Z(t[r])}else{if(e instanceof Date)return e.toJSON();if(null!==e)for(var i in e={},t)if(Object.prototype.hasOwnProperty.call(t,i)){var o=t[i];void 0!==o&&(e[i]=Z(o))}}}return e}function ee(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return function(e){if(0===e)return"1";var t=e.toExponential().split(/e\+?/),n=parseInt(t[1],10),r=e<0,i=r?"0":"2",o=(u=((r?-n:n)- -324).toString(),s="0",a=3,function(e,t,n){for(var r="",i=n-e.length;r.length<i;)r+=t;return r}(u,s,a)+u);var u,s,a;i+=""+o;var c=Math.abs(parseFloat(t[0]));r&&(c=10-c);var f=c.toFixed(20);return f=f.replace(/\.?0+$/,""),i+=""+f}(e);case"string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var t=Array.isArray(e),n=t?e:Object.keys(e),r=-1,i=n.length,o="";if(t)for(;++r<i;)o+=te(n[r]);else for(;++r<i;){var u=n[r];o+=te(u)+te(e[u])}return o}return""}function te(e){return ie(e=Z(e))+""+ee(e)+"\0"}function ne(e,t){var n,r=t;if("1"===e[t])n=0,t++;else{var i="0"===e[t];t++;var o="",u=e.substring(t,t+3),s=parseInt(u,10)+-324;for(i&&(s=-s),t+=3;;){var a=e[t];if("\0"===a)break;o+=a,t++}n=1===(o=o.split(".")).length?parseInt(o,10):parseFloat(o[0]+"."+o[1]),i&&(n-=10),0!==s&&(n=parseFloat(n+"e"+s))}return{num:n,length:t-r}}function re(e,t){var n=e.pop();if(t.length){var r=t[t.length-1];n===r.element&&(t.pop(),r=t[t.length-1]);var i=r.element,o=r.index;if(Array.isArray(i))i.push(n);else if(o===e.length-2){i[e.pop()]=n}else e.push(n)}}function ie(e){var t=["boolean","number","string","object"].indexOf(typeof e);return~t?null===e?1:Array.isArray(e)?5:t<3?t+2:t+3:Array.isArray(e)?5:void 0}function oe(e,t,n){if(e=e.filter((function(e){return ue(e.doc,t.selector,n)})),t.sort){var r=function(e){function t(t){return e.map((function(e){var n=V(X(e));return R(t,n)}))}return function(e,n){var r=H(t(e.doc),t(n.doc));return 0!==r?r:J(e.doc._id,n.doc._id)}}(t.sort);e=e.sort(r),"string"!=typeof t.sort[0]&&"desc"===W(t.sort[0])&&(e=e.reverse())}if("limit"in t||"skip"in t){var i=t.skip||0,o=("limit"in t?t.limit:e.length)+i;e=e.slice(i,o)}return e}function ue(e,t,n){return n.every((function(n){var r=t[n],i=V(n),o=R(e,i);return K(n)?function(e,t,n){if("$or"===e)return t.some((function(e){return ue(n,e,Object.keys(e))}));if("$not"===e)return!ue(n,t,Object.keys(t));return!t.find((function(e){return ue(n,e,Object.keys(e))}))}(n,r,e):se(r,e,i,o)}))}function se(e,t,n,r){return!e||("object"==typeof e?Object.keys(e).every((function(i){var o=e[i];if(0===i.indexOf("$"))return ae(i,t,o,n,r);var u=V(i);if(void 0===r&&"object"!=typeof o&&u.length>0)return!1;var s=R(r,u);return"object"==typeof o?se(o,t,n,s):ae("$eq",t,o,u,s)})):e===r)}function ae(e,t,n,r,i){if(!de[e])throw new Error('unknown operator "'+e+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');return de[e](t,n,r,i)}function ce(e){return null!=e}function fe(e){return void 0!==e}function le(e,t){return t.some((function(t){return e instanceof Array?e.some((function(e){return 0===H(t,e)})):0===H(t,e)}))}var de={$elemMatch:function(e,t,n,r){return!!Array.isArray(r)&&(0!==r.length&&("object"==typeof r[0]&&null!==r[0]?r.some((function(e){return ue(e,t,Object.keys(t))})):r.some((function(r){return se(t,e,n,r)}))))},$allMatch:function(e,t,n,r){return!!Array.isArray(r)&&(0!==r.length&&("object"==typeof r[0]&&null!==r[0]?r.every((function(e){return ue(e,t,Object.keys(t))})):r.every((function(r){return se(t,e,n,r)}))))},$eq:function(e,t,n,r){return fe(r)&&0===H(r,t)},$gte:function(e,t,n,r){return fe(r)&&H(r,t)>=0},$gt:function(e,t,n,r){return fe(r)&&H(r,t)>0},$lte:function(e,t,n,r){return fe(r)&&H(r,t)<=0},$lt:function(e,t,n,r){return fe(r)&&H(r,t)<0},$exists:function(e,t,n,r){return t?fe(r):!fe(r)},$mod:function(e,t,n,r){return ce(r)&&function(e,t){return"number"==typeof e&&parseInt(e,10)===e&&e%t[0]===t[1]}(r,t)},$ne:function(e,t,n,r){return t.every((function(e){return 0!==H(r,e)}))},$in:function(e,t,n,r){return ce(r)&&le(r,t)},$nin:function(e,t,n,r){return ce(r)&&!le(r,t)},$size:function(e,t,n,r){return ce(r)&&Array.isArray(r)&&function(e,t){return e.length===t}(r,t)},$all:function(e,t,n,r){return Array.isArray(r)&&function(e,t){return t.every((function(t){return e.some((function(e){return 0===H(t,e)}))}))}(r,t)},$regex:function(e,t,n,r){return ce(r)&&"string"==typeof r&&t.every((function(e){return function(e,t){return new RegExp(t).test(e)}(r,e)}))},$type:function(e,t,n,r){return function(e,t){switch(t){case"null":return null===e;case"boolean":return"boolean"==typeof e;case"number":return"number"==typeof e;case"string":return"string"==typeof e;case"array":return e instanceof Array;case"object":return"[object Object]"==={}.toString.call(e)}}(r,t)}};function he(e,t){if("object"!=typeof t)throw new Error("Selector error: expected a JSON object");var n=oe([{doc:e}],{selector:t=Y(t)},Object.keys(t));return n&&1===n.length}function pe(e){return function(...t){var n=t.pop(),r=e.apply(this,t);return function(e,t){e.then((function(e){i((function(){t(null,e)}))}),(function(e){i((function(){t(e)}))}))}(r,n),r}}var ye=function(...e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];Array.isArray(i)?t=t.concat(ye.apply(null,i)):t.push(i)}return t};function ve(e){for(var t={},n=0,r=e.length;n<r;n++)t=m(t,e[n]);return t}function ge(e,t){for(var n=0,r=Math.min(e.length,t.length);n<r;n++)if(e[n]!==t[n])return!1;return!0}function me(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}class _e{constructor(){this.promise=new Promise((function(e){e()}))}add(e){return this.promise=this.promise.catch((function(){})).then((function(){return e()})),this.promise}finish(){return this.promise}}function be(e){if(!e)return"undefined";switch(typeof e){case"function":case"string":return e.toString();default:return JSON.stringify(e)}}async function we(e,t,n,r,i,o){const u=function(e,t){return be(e)+be(t)+"undefined"}(n,r);let s;if(!i&&(s=e._cachedViews=e._cachedViews||{},s[u]))return s[u];const a=e.info().then((async function(a){const c=a.db_name+"-mrview-"+(i?"temp":E(u));await O(e,"_local/"+o,(function(e){e.views=e.views||{};let n=t;-1===n.indexOf("/")&&(n=t+"/"+t);const r=e.views[n]=e.views[n]||{};if(!r[c])return r[c]=!0,e}));const f=(await e.registerDependentDatabase(c)).db;f.auto_compaction=!0;const l={name:c,db:f,sourceDB:e,adapter:e.adapter,mapFun:n,reduceFun:r};let d;try{d=await l.db.get("_local/lastSeq")}catch(e){if(404!==e.status)throw e}return l.seq=d?d.seq:0,s&&l.db.once("destroyed",(function(){delete s[u]})),l}));return s&&(s[u]=a),a}class ke extends Error{constructor(e){super(),this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,ke)}catch(e){}}}class $e extends Error{constructor(e){super(),this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,$e)}catch(e){}}}class Oe extends Error{constructor(e){super(),this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,Oe)}catch(e){}}}function je(e,t){return t&&e.then((function(e){i((function(){t(null,e)}))}),(function(e){i((function(){t(e)}))})),e}function xe(e,t){return function(){var n=arguments,r=this;return e.add((function(){return t.apply(r,n)}))}}function Ae(e){var t=new s(e),n=new Array(t.size),r=-1;return t.forEach((function(e){n[++r]=e})),n}function Ee(e){var t=new Array(e.size),n=-1;return e.forEach((function(e,r){t[++n]=r})),t}var qe={},Me=new _e;function Se(e){return-1===e.indexOf("/")?[e,e]:e.split("/")}function Pe(e,t,n){try{e.emit("error",t)}catch(e){g("error","The user's map/reduce function threw an uncaught error.\nYou can debug this error by doing:\nmyDatabase.on('error', function (err) { debugger; });\nPlease double-check your map/reduce function."),g("error",t,n)}}function Be(e,t,n){var r=function(e){for(var t=0,n=e.length;t<n;t++){if(-1!==e[t].indexOf("."))return!1}return!0}(e),i=1===e.length;return r?i?function(e,t,n){return function(r){n&&!he(r,n)||t(r[e])}}(e[0],t,n):function(e,t,n){return function(r){if(!n||he(r,n)){for(var i=[],o=0,u=e.length;o<u;o++)i.push(r[e[o]]);t(i)}}}(e,t,n):i?function(e,t,n){var r=V(e);return function(e){if(!n||he(e,n)){for(var i=e,o=0,u=r.length;o<u;o++){if(void 0===(i=i[r[o]]))return}t(i)}}}(e[0],t,n):function(e,t,n){return function(r){if(!n||he(r,n)){for(var i=[],o=0,u=e.length;o<u;o++){for(var s=V(e[o]),a=r,c=0,f=s.length;c<f;c++){if(void 0===(a=a[s[c]]))return}i.push(a)}t(i)}}}(e,t,n)}var Ce=function(e,t,n,r){function o(e,t,n){try{t(n)}catch(r){Pe(e,r,{fun:t,doc:n})}}function u(e,t,n,r,i){try{return{output:t(n,r,i)}}catch(o){return Pe(e,o,{fun:t,keys:n,values:r,rereduce:i}),{error:o}}}function c(e,t){const n=H(e.key,t.key);return 0!==n?n:H(e.value,t.value)}function f(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):e}function l(e){const t=e.value;return t&&"object"==typeof t&&t._id||e.id}function d(e){return function(t){return e.include_docs&&e.attachments&&e.binary&&function(e){e.rows.forEach((function(e){const t=e.doc&&e.doc._attachments;t&&Object.keys(t).forEach((function(e){const n=t[e];t[e].data=A(n.data,n.content_type)}))}))}(t),t}}function h(e,t,n,r){let i=t[e];void 0!==i&&(r&&(i=encodeURIComponent(JSON.stringify(i))),n.push(e+"="+i))}function p(e){if(void 0!==e){const t=Number(e);return isNaN(t)||t!==parseInt(e,10)?e:t}}function y(e,t){const n=e.descending?"endkey":"startkey",r=e.descending?"startkey":"endkey";if(void 0!==e[n]&&void 0!==e[r]&&H(e[n],e[r])>0)throw new ke("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(t.reduce&&!1!==e.reduce){if(e.include_docs)throw new ke("{include_docs:true} is invalid for reduce");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new ke("Multi-key fetches for reduce views must use {group: true}")}["group_level","limit","skip"].forEach((function(t){const n=function(e){if(e){if("number"!=typeof e)return new ke(`Invalid value for integer: "${e}"`);if(e<0)return new ke(`Invalid value for positive integer: "${e}"`)}}(e[t]);if(n)throw n}))}function v(e){return function(t){if(404===t.status)return e;throw t}}function g(e,t,n){return e.db.get("_local/lastSeq").catch(v({_id:"_local/lastSeq",seq:0})).then((function(r){var i=Ee(t);return Promise.all(i.map((function(n){return async function(e,t,n){const r="_local/doc_"+e,i={_id:r,keys:[]},o=n.get(e),u=o[0],a=o[1],c=await(function(e){return 1===e.length&&/^1-/.test(e[0].rev)}(a)?Promise.resolve(i):t.db.get(r).catch(v(i)));return function(e,t){const n=[],r=new s;for(let e=0,i=t.rows.length;e<i;e++){const i=t.rows[e].doc;if(i&&(n.push(i),r.add(i._id),i._deleted=!u.has(i._id),!i._deleted)){const e=u.get(i._id);"value"in e&&(i.value=e.value)}}const i=Ee(u);return i.forEach((function(e){if(!r.has(e)){const t={_id:e},r=u.get(e);"value"in r&&(t.value=r.value),n.push(t)}})),e.keys=Ae(i.concat(e.keys)),n.push(e),n}(c,await function(e){return e.keys.length?t.db.allDocs({keys:e.keys,include_docs:!0}):Promise.resolve({rows:[]})}(c))}(n,e,t)}))).then((function(t){var i=k(t);return r.seq=n,i.push(r),e.db.bulkDocs({docs:i})})).then(()=>function(e){return e.sourceDB.get("_local/purges").then((function(t){const n=t.purgeSeq;return e.db.get("_local/purgeSeq").then((function(e){return e._rev})).catch((function(e){if(404!==e.status)throw e})).then((function(t){return e.db.put({_id:"_local/purgeSeq",_rev:t,purgeSeq:n})}))})).catch((function(e){if(404!==e.status)throw e}))}(e))}))}function m(e){const t="string"==typeof e?e:e.name;let n=qe[t];return n||(n=qe[t]=new _e),n}async function _(e,n){return xe(m(e),(function(){return async function(e,n){let r,i,u;const s=t(e.mapFun,(function(e,t){const n={id:i._id,key:Z(e)};null!=t&&(n.value=Z(t)),r.push(n)}));let f=e.seq||0;let l=0;const d={view:e.name,indexed_docs:l};e.sourceDB.emit("indexing",d);const h=new _e;async function p(){return function(t,d){var v=t.results;if(!v.length&&!d.length)return;for(let e of d){if(v.findIndex((function(t){return t.id===e.docId}))<0){const t={_id:e.docId,doc:{_id:e.docId,_deleted:1},changes:[]};e.doc&&(t.doc=e.doc,t.changes.push({rev:e.doc._rev})),v.push(t)}}var m=function(t){const n=new a;for(let u=0,a=t.length;u<a;u++){const a=t[u];if("_"!==a.doc._id[0]){r=[],i=a.doc,i._deleted||o(e.sourceDB,s,i),r.sort(c);const t=y(r);n.set(a.doc._id,[t,a.changes])}f=a.seq}return n}(v);h.add(function(t,n){return function(){return g(e,t,n)}}(m,f)),l+=v.length;const _={view:e.name,last_seq:t.last_seq,results_count:v.length,indexed_docs:l};if(e.sourceDB.emit("indexing",_),e.sourceDB.activeTasks.update(u,{completed_items:l}),v.length<n.changes_batch_size)return;return p()}(await e.sourceDB.changes({return_docs:!0,conflicts:!0,include_docs:!0,style:"all_docs",since:f,limit:n.changes_batch_size}),await e.db.get("_local/purgeSeq").then((function(e){return e.purgeSeq})).catch((function(e){if(e&&404!==e.status)throw e;return-1})).then((function(t){return e.sourceDB.get("_local/purges").then((function(n){const r=n.purges.filter((function(e,n){return n>t})).map(e=>e.docId),i=r.filter((function(e,t){return r.indexOf(e)===t}));return Promise.all(i.map((function(t){return e.sourceDB.get(t).then((function(e){return{docId:t,doc:e}})).catch((function(e){if(404!==e.status)throw e;return{docId:t}}))})))})).catch((function(e){if(e&&404!==e.status)throw e;return[]}))})))}function y(e){const t=new a;let n;for(let r=0,i=e.length;r<i;r++){const i=e[r],o=[i.key,i.id];r>0&&0===H(i.key,n)&&o.push(r),t.set(te(o),i),n=i.key}return t}try{await e.sourceDB.info().then((function(t){u=e.sourceDB.activeTasks.add({name:"view_indexing",total_items:t.update_seq-f})})),await p(),await h.finish(),e.seq=f,e.sourceDB.activeTasks.remove(u)}catch(t){e.sourceDB.activeTasks.remove(u,t)}}(e,n)}))()}function b(e,t){return xe(m(e),(function(){return async function(e,t){let r;const i=e.reduceFun&&!1!==t.reduce,o=t.skip||0;void 0===t.keys||t.keys.length||(t.limit=0,delete t.keys);async function s(t){t.include_docs=!0;const n=await e.db.allDocs(t);return r=n.total_rows,n.rows.map((function(e){if("value"in e.doc&&"object"==typeof e.doc.value&&null!==e.doc.value){const t=Object.keys(e.doc.value).sort(),n=["id","key","value"];if(!(t<n||t>n))return e.doc.value}const t=function(e){for(var t=[],n=[],r=0;;){var i=e[r++];if("\0"!==i)switch(i){case"1":t.push(null);break;case"2":t.push("1"===e[r]),r++;break;case"3":var o=ne(e,r);t.push(o.num),r+=o.length;break;case"4":for(var u="";;){var s=e[r];if("\0"===s)break;u+=s,r++}u=u.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),t.push(u);break;case"5":var a={element:[],index:t.length};t.push(a.element),n.push(a);break;case"6":var c={element:{},index:t.length};t.push(c.element),n.push(c);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+i)}else{if(1===t.length)return t.pop();re(t,n)}}}(e.doc._id);return{key:t[0],id:t[1],value:"value"in e.doc?e.doc.value:null}}))}async function c(s){let c;if(c=i?function(e,t,r){0===r.group_level&&delete r.group_level;const i=r.group||r.group_level,o=n(e.reduceFun),s=[],a=isNaN(r.group_level)?Number.POSITIVE_INFINITY:r.group_level;t.forEach((function(e){const t=s[s.length-1];let n=i?e.key:null;if(i&&Array.isArray(n)&&(n=n.slice(0,a)),t&&0===H(t.groupKey,n))return t.keys.push([e.key,e.id]),void t.values.push(e.value);s.push({keys:[[e.key,e.id]],values:[e.value],groupKey:n})})),t=[];for(let n=0,r=s.length;n<r;n++){const r=s[n],i=u(e.sourceDB,o,r.keys,r.values,!1);if(i.error&&i.error instanceof Oe)throw i.error;t.push({value:i.error?null:i.output,key:r.groupKey})}return{rows:f(t,r.limit,r.skip)}}(e,s,t):void 0===t.keys?{total_rows:r,offset:o,rows:s}:{total_rows:r,offset:o,rows:f(s,t.limit,t.skip)},t.update_seq&&(c.update_seq=e.seq),t.include_docs){const n=Ae(s.map(l)),r=await e.sourceDB.allDocs({keys:n,include_docs:!0,conflicts:t.conflicts,attachments:t.attachments,binary:t.binary});var d=new a;return r.rows.forEach((function(e){d.set(e.id,e.doc)})),s.forEach((function(e){var t=l(e),n=d.get(t);n&&(e.doc=n)})),c}return c}if(void 0!==t.keys){const e=t.keys.map((function(e){const n={startkey:te([e]),endkey:te([e,{}])};return t.update_seq&&(n.update_seq=!0),s(n)})),n=await Promise.all(e);return c(k(n))}{const e={descending:t.descending};let n,r;if(t.update_seq&&(e.update_seq=!0),"start_key"in t&&(n=t.start_key),"startkey"in t&&(n=t.startkey),"end_key"in t&&(r=t.end_key),"endkey"in t&&(r=t.endkey),void 0!==n&&(e.startkey=t.descending?te([n,{}]):te([n])),void 0!==r){let n=!1!==t.inclusive_end;t.descending&&(n=!n),e.endkey=te(n?[r,{}]:[r])}if(void 0!==t.key){const n=te([t.key]),r=te([t.key,{}]);e.descending?(e.endkey=n,e.startkey=r):(e.startkey=n,e.endkey=r)}i||("number"==typeof t.limit&&(e.limit=t.limit),e.skip=o);return c(await s(e))}}(e,t)}))()}async function O(t,n,o){if("function"==typeof t._query)return function(e,t,n){return new Promise((function(r,i){e._query(t,n,(function(e,t){if(e)return i(e);r(t)}))}))}(t,n,o);if($(t))return async function(e,t,n){let r,i,o=[],u="GET";if(h("reduce",n,o),h("include_docs",n,o),h("attachments",n,o),h("limit",n,o),h("descending",n,o),h("group",n,o),h("group_level",n,o),h("skip",n,o),h("stale",n,o),h("conflicts",n,o),h("startkey",n,o,!0),h("start_key",n,o,!0),h("endkey",n,o,!0),h("end_key",n,o,!0),h("inclusive_end",n,o),h("key",n,o,!0),h("update_seq",n,o),o=o.join("&"),o=""===o?"":"?"+o,void 0!==n.keys){const e=2e3,i="keys="+encodeURIComponent(JSON.stringify(n.keys));i.length+o.length+1<=e?o+=("?"===o[0]?"&":"?")+i:(u="POST","string"==typeof t?r={keys:n.keys}:t.keys=n.keys)}if("string"==typeof t){const s=Se(t),a=await e.fetch("_design/"+s[0]+"/_view/"+s[1]+o,{headers:new q({"Content-Type":"application/json"}),method:u,body:JSON.stringify(r)});i=a.ok;const c=await a.json();if(!i)throw c.status=a.status,w(c);return c.rows.forEach((function(e){if(e.value&&e.value.error&&"builtin_reduce_error"===e.value.error)throw new Error(e.reason)})),new Promise((function(e){e(c)})).then(d(n))}r=r||{},Object.keys(t).forEach((function(e){Array.isArray(t[e])?r[e]=t[e]:r[e]=t[e].toString()}));const s=await e.fetch("_temp_view"+o,{headers:new q({"Content-Type":"application/json"}),method:"POST",body:JSON.stringify(r)});i=s.ok;const a=await s.json();if(!i)throw a.status=s.status,w(a);return new Promise((function(e){e(a)})).then(d(n))}(t,n,o);const u={changes_batch_size:t.__opts.view_update_changes_batch_size||50};if("string"!=typeof n)return y(o,n),Me.add((async function(){const r=await we(t,"temp_view/temp_view",n.map,n.reduce,!0,e);return i=_(r,u).then((function(){return b(r,o)})),s=function(){return r.db.destroy()},i.then((function(e){return s().then((function(){return e}))}),(function(e){return s().then((function(){throw e}))}));var i,s})),Me.finish();{const s=n,a=Se(s),c=a[0],f=a[1],l=await t.get("_design/"+c);if(!(n=l.views&&l.views[f]))throw new $e(`ddoc ${l._id} has no view named ${f}`);r(l,f),y(o,n);const d=await we(t,s,n.map,n.reduce,!1,e);return"ok"===o.stale||"update_after"===o.stale?("update_after"===o.stale&&i((function(){_(d,u)})),b(d,o)):(await _(d,u),b(d,o))}}var j;return{query:function(e,t,n){const r=this;"function"==typeof t&&(n=t,t={}),t=t?function(e){return e.group_level=p(e.group_level),e.limit=p(e.limit),e.skip=p(e.skip),e}(t):{},"function"==typeof e&&(e={map:e});const i=Promise.resolve().then((function(){return O(r,e,t)}));return je(i,n),i},viewCleanup:(j=function(){const t=this;return"function"==typeof t._viewCleanup?function(e){return new Promise((function(t,n){e._viewCleanup((function(e,r){if(e)return n(e);t(r)}))}))}(t):$(t)?async function(e){return(await e.fetch("_view_cleanup",{headers:new q({"Content-Type":"application/json"}),method:"POST"})).json()}(t):async function(t){try{const n=await t.get("_local/"+e),r=new a;Object.keys(n.views).forEach((function(e){const t=Se(e),n="_design/"+t[0],i=t[1];let o=r.get(n);o||(o=new s,r.set(n,o)),o.add(i)}));const i={keys:Ee(r),include_docs:!0},o=await t.allDocs(i),u={};o.rows.forEach((function(e){const t=e.key.substring(8);r.get(e.key).forEach((function(r){let i=t+"/"+r;n.views[i]||(i=r);const o=Object.keys(n.views[i]),s=e.doc&&e.doc.views&&e.doc.views[r];o.forEach((function(e){u[e]=u[e]||s}))}))}));const c=Object.keys(u).filter((function(e){return!u[e]})).map((function(e){return xe(m(e),(function(){return new t.constructor(e,t.__opts).destroy()}))()}));return Promise.all(c).then((function(){return{ok:!0}}))}catch(e){if(404===e.status)return{ok:!0};throw e}}(t)},function(...e){var t=e.pop(),n=j.apply(this,e);return"function"==typeof t&&je(n,t),n})}}("indexes",(function(e,t){return Be(Object.keys(e.fields),t,e.partial_filter_selector)}),(function(){throw new Error("reduce not supported")}),(function(e,t){var n=e.views[t];if(!n.map||!n.map.fields)throw new Error("ddoc "+e._id+" with view "+t+" doesn't have map.fields defined. maybe it wasn't created by this plugin?")}));function Ie(e){return e._customFindAbstractMapper?{query:function(t,n){var r=Ce.query.bind(this);return e._customFindAbstractMapper.query.call(this,t,n,r)},viewCleanup:function(){var t=Ce.viewCleanup.bind(this);return e._customFindAbstractMapper.viewCleanup.call(this,t)}}:Ce}function Le(e){return e.fields=e.fields.map((function(e){if("string"==typeof e){var t={};return t[e]="asc",t}return e})),e.partial_filter_selector&&(e.partial_filter_selector=Y(e.partial_filter_selector)),e}function Ue(e,t){for(var n=[],r=0;r<t.def.fields.length;r++){var i=X(t.def.fields[r]);n.push(R(e,V(i)))}return n}function De(e){return e.allDocs({startkey:"_design/",endkey:"_design/￿",include_docs:!0}).then((function(e){var t={indexes:[{ddoc:null,name:"_all_docs",type:"special",def:{fields:[{_id:"asc"}]}}]};return t.indexes=ye(t.indexes,e.rows.filter((function(e){return"query"===e.doc.language})).map((function(e){return(void 0!==e.doc.views?Object.keys(e.doc.views):[]).map((function(t){var n=e.doc.views[t];return{ddoc:e.id,name:t,type:"json",def:Le(n.options.def)}}))}))),t.indexes.sort((function(e,t){return J(e.name,t.name)})),t.total_rows=t.indexes.length,t}))}var Ne={"￿":{}};const Te={queryOpts:{limit:0,startkey:Ne,endkey:null},inMemoryFields:[]};function Fe(e,t){for(var n=e.def.fields.map(X),r=0,i=n.length;r<i;r++){if(t===n[r])return!0}return!1}function Re(e,t){return"$eq"!==X(e[t])}function ze(e,t){var n=t.def.fields.map(X);return e.slice().sort((function(e,t){var r=n.indexOf(e),i=n.indexOf(t);return-1===r&&(r=Number.MAX_VALUE),-1===i&&(i=Number.MAX_VALUE),J(r,i)}))}function Je(e,t,n,r){var i=ye(e,function(e,t,n){for(var r=!1,i=0,o=(n=ze(n,e)).length;i<o;i++){var u=n[i];if(r||!Fe(e,u))return n.slice(i);i<o-1&&Re(t,u)&&(r=!0)}return[]}(t,n,r),function(e){var t=[];return Object.keys(e).forEach((function(n){var r=e[n];Object.keys(r).forEach((function(e){"$ne"===e&&t.push(n)}))})),t}(n));return ze(function(e){for(var t={},n=0;n<e.length;n++)t["$"+e[n]]=!0;return Object.keys(t).map((function(e){return e.substring(1)}))}(i),t)}function Ve(e,t,n){if(t){var r=(u=e,!((o=t).length>u.length)&&ge(o,u)),i=ge(n,e);return r&&i}var o,u;return function(e,t){e=e.slice();for(var n=0,r=t.length;n<r;n++){var i=t[n];if(!e.length)break;var o=e.indexOf(i);if(-1===o)return!1;e.splice(o,1)}return!0}(n,e)}var Qe=["$eq","$gt","$gte","$lt","$lte"];function Ke(e){return-1===Qe.indexOf(e)}function Xe(e,t,n,r){var i=e.def.fields.map(X);return!!Ve(i,t,n)&&function(e,t){var n=t[e[0]];return void 0===n||!(1===Object.keys(n).length&&"$ne"===X(n))}(i,r)}function We(e,t,n,r,i){var o=function(e,t,n,r){return r.filter((function(r){return Xe(r,n,t,e)}))}(e,t,n,r);if(0===o.length){if(i)throw{error:"no_usable_index",message:"There is no index available for this selector."};var u=r[0];return u.defaultUsed=!0,u}if(1===o.length&&!i)return o[0];var s=function(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}(t);if(i){var a="_design/"+i[0],c=2===i.length&&i[1],f=o.find((function(e){return!(!c||e.ddoc!==a||c!==e.name)||e.ddoc===a}));if(!f)throw{error:"unknown_error",message:"Could not find that index or could not use that index for the query"};return f}return function(e,t){for(var n=null,r=-1,i=0,o=e.length;i<o;i++){var u=e[i],s=t(u);s>r&&(r=s,n=u)}return n}(o,(function(e){for(var t=e.def.fields.map(X),n=0,r=0,i=t.length;r<i;r++){var o=t[r];s[o]&&n++}return n}))}function Ge(e,t){switch(e){case"$eq":return{startkey:t,endkey:t};case"$lte":return{endkey:t};case"$gte":return{startkey:t};case"$lt":return{endkey:t,inclusive_end:!1};case"$gt":return{startkey:t,inclusive_start:!1}}}function Ye(e,t){return t.defaultUsed?function(e){return{queryOpts:{startkey:null},inMemoryFields:[Object.keys(e)]}}(e):1===t.def.fields.length?function(e,t){var n,r=X(t.def.fields[0]),i=e[r]||{},o=[];return Object.keys(i).forEach((function(e){Ke(e)&&o.push(r);var t=function(e,t){switch(e){case"$eq":return{key:t};case"$lte":return{endkey:t};case"$gte":return{startkey:t};case"$lt":return{endkey:t,inclusive_end:!1};case"$gt":return{startkey:t,inclusive_start:!1}}return{startkey:null}}(e,i[e]);n=n?ve([n,t]):t})),{queryOpts:n,inMemoryFields:o}}(e,t):function(e,t){var n,r,i=t.def.fields.map(X),o=[],u=[],s=[];function a(e){!1!==n&&u.push(null),!1!==r&&s.push(Ne),o=i.slice(e)}for(var c=0,f=i.length;c<f;c++){var l=e[i[c]];if(!l||!Object.keys(l).length){a(c);break}if(Object.keys(l).some(Ke)){a(c);break}if(c>0){var d="$gt"in l||"$gte"in l||"$lt"in l||"$lte"in l,h=Object.keys(e[i[c-1]]),p=me(h,["$eq"]),y=me(h,Object.keys(l));if(d&&!p&&!y){a(c);break}}for(var v=Object.keys(l),g=null,m=0;m<v.length;m++){var _=v[m],b=Ge(_,l[_]);g=g?ve([g,b]):b}u.push("startkey"in g?g.startkey:null),s.push("endkey"in g?g.endkey:Ne),"inclusive_start"in g&&(n=g.inclusive_start),"inclusive_end"in g&&(r=g.inclusive_end)}var w={startkey:u,endkey:s};return void 0!==n&&(w.inclusive_start=n),void 0!==r&&(w.inclusive_end=r),{queryOpts:w,inMemoryFields:o}}(e,t)}function He(e,t){var n=e.selector,r=e.sort;if(function(e){return Object.keys(e).map((function(t){return e[t]})).some((function(e){return"object"==typeof e&&0===Object.keys(e).length}))}(n))return m({},Te,{index:t[0]});var i=function(e,t){var n,r=Object.keys(e),i=t?t.map(X):[];return n=r.length>=i.length?r:i,0===i.length?{fields:n}:{fields:n=n.sort((function(e,t){var n=i.indexOf(e);-1===n&&(n=Number.MAX_VALUE);var r=i.indexOf(t);return-1===r&&(r=Number.MAX_VALUE),n<r?-1:n>r?1:0})),sortOrder:t.map(X)}}(n,r),o=i.fields,u=We(n,o,i.sortOrder,t,e.use_index),s=Ye(n,u);return{queryOpts:s.queryOpts,index:u,inMemoryFields:Je(s.inMemoryFields,u,n,o)}}function Ze(e,t,n){var r,i;return t.selector&&(I(t.selector,!1),t.selector=Y(t.selector)),t.sort&&(t.sort=function(e){if(!Array.isArray(e))throw new Error("invalid sort json - should be an array");return e.map((function(e){if("string"==typeof e){var t={};return t[e]="asc",t}return e}))}(t.sort)),t.use_index&&(t.use_index=(r=t.use_index,i=[],"string"==typeof r?i.push(r):i=r,i.map((function(e){return e.replace("_design/","")})))),function(e){if("object"!=typeof e.selector)throw new Error("you must provide a selector when you find()")}(t),De(e).then((function(r){e.constructor.emit("debug",["find","planning query",t]);var i=He(t,r.indexes);e.constructor.emit("debug",["find","query plan",i]);var o=i.index;!function(e,t){if(t.defaultUsed&&e.sort){var n=e.sort.filter((function(e){return"_id"!==Object.keys(e)[0]})).map((function(e){return Object.keys(e)[0]}));if(n.length>0)throw new Error('Cannot sort on field(s) "'+n.join(",")+'" when using the default index')}t.defaultUsed}(t,o);var u=m({include_docs:!0,reduce:!1,indexes_count:r.total_rows},i.queryOpts);return"startkey"in u&&"endkey"in u&&H(u.startkey,u.endkey)>0?{docs:[]}:(t.sort&&"string"!=typeof t.sort[0]&&"desc"===W(t.sort[0])&&(u.descending=!0,u=function(e){var t=l(e);return delete t.startkey,delete t.endkey,delete t.inclusive_start,delete t.inclusive_end,"endkey"in e&&(t.startkey=e.endkey),"startkey"in e&&(t.endkey=e.startkey),"inclusive_start"in e&&(t.inclusive_end=e.inclusive_start),"inclusive_end"in e&&(t.inclusive_start=e.inclusive_end),t}(u)),i.inMemoryFields.length||("limit"in t&&(u.limit=t.limit),"skip"in t&&(u.skip=t.skip)),n?Promise.resolve(i,u):Promise.resolve().then((function(){if("_all_docs"===o.name)return function(e,t){var n=l(t);return n.descending?("endkey"in n&&"string"!=typeof n.endkey&&(n.endkey=""),"startkey"in n&&"string"!=typeof n.startkey&&(n.limit=0)):("startkey"in n&&"string"!=typeof n.startkey&&(n.startkey=""),"endkey"in n&&"string"!=typeof n.endkey&&(n.limit=0)),"key"in n&&"string"!=typeof n.key&&(n.limit=0),n.limit>0&&n.indexes_count&&(n.original_limit=n.limit,n.limit+=n.indexes_count),e.allDocs(n).then((function(e){return e.rows=e.rows.filter((function(e){return!/^_design\//.test(e.id)})),n.original_limit&&(n.limit=n.original_limit),e.rows=e.rows.slice(0,n.limit),e}))}(e,u);var t,n=(t=o).ddoc.substring(8)+"/"+t.name;return Ie(e).query.call(e,n,u)})).then((function(e){!1===u.inclusive_start&&(e.rows=function(e,t,n){for(var r=n.def.fields,i=0,o=e.length;i<o;i++){var u=Ue(e[i].doc,n);if(1===r.length)u=u[0];else for(;u.length>t.length;)u.pop();if(Math.abs(H(u,t))>0)break}return i>0?e.slice(i):e}(e.rows,u.startkey,o)),i.inMemoryFields.length&&(e.rows=oe(e.rows,t,i.inMemoryFields));var n={docs:e.rows.map((function(e){var n=e.doc;return t.fields?function(e,t){for(var n={},r=0,i=t.length;r<i;r++){var o=V(t[r]),u=R(e,o);void 0!==u&&z(n,o,u)}return n}(n,t.fields):n}))};return o.defaultUsed&&(n.warning="No matching index found, create an index to optimize query time."),n})))}))}var et=pe((function(e,t){var n,r=l((t=M(t)).index);function i(){return n||(n=E(JSON.stringify(t)))}t.index=Le(t.index),function(e){var t=e.fields.filter((function(e){return"asc"===W(e)}));if(0!==t.length&&t.length!==e.fields.length)throw new Error("unsupported mixed sorting")}(t.index);var o=t.name||"idx-"+i(),u=t.ddoc||"idx-"+i(),s="_design/"+u,a=!1,c=!1;return e.constructor.emit("debug",["find","creating index",s]),O(e,s,(function(e){return e._rev&&"query"!==e.language&&(a=!0),e.language="query",e.views=e.views||{},!(c=!!e.views[o])&&(e.views[o]={map:{fields:ve(t.index.fields),partial_filter_selector:t.index.partial_filter_selector},reduce:"_count",options:{def:r}},e)})).then((function(){if(a)throw new Error('invalid language for ddoc with id "'+s+'" (should be "query")')})).then((function(){var t=u+"/"+o;return Ie(e).query.call(e,t,{limit:0,reduce:!1}).then((function(){return{id:s,name:o,result:c?"exists":"created"}}))}))})),tt=pe(Ze),nt=pe((function(e,t){return Ze(e,t,!0).then((function(n){return{dbname:e.name,index:n.index,selector:t.selector,range:{start_key:n.queryOpts.startkey,end_key:n.queryOpts.endkey},opts:{use_index:t.use_index||[],bookmark:"nil",limit:t.limit,skip:t.skip,sort:t.sort||{},fields:t.fields,conflicts:!1,r:[49]},limit:t.limit,skip:t.skip||0,fields:t.fields}}))})),rt=pe(De),it=pe((function(e,t){if(!t.ddoc)throw new Error("you must supply an index.ddoc when deleting");if(!t.name)throw new Error("you must supply an index.name when deleting");var n=t.ddoc,r=t.name;return O(e,n,(function(e){return 1===Object.keys(e.views).length&&e.views[r]?{_id:n,_deleted:!0}:(delete e.views[r],e)})).then((function(){return Ie(e).viewCleanup.apply(e)})).then((function(){return{ok:!0}}))})),ot={};ot.createIndex=d((function(e,t){if("object"!=typeof e)return t(new Error("you must provide an index to create"));($(this)?U:et)(this,e,t)})),ot.find=d((function(e,t){if(void 0===t&&(t=e,e=void 0),"object"!=typeof e)return t(new Error("you must provide search parameters to find()"));($(this)?D:tt)(this,e,t)})),ot.explain=d((function(e,t){if(void 0===t&&(t=e,e=void 0),"object"!=typeof e)return t(new Error("you must provide search parameters to explain()"));($(this)?N:nt)(this,e,t)})),ot.getIndexes=d((function(e){($(this)?T:rt)(this,e)})),ot.deleteIndex=d((function(e,t){if("object"!=typeof e)return t(new Error("you must provide an index to delete"));($(this)?F:it)(this,e,t)})),"undefined"==typeof PouchDB?g("error",'pouchdb-find plugin error: Cannot find global "PouchDB" object! Did you remember to include pouchdb.js?'):PouchDB.plugin(ot)},{10:10,2:2,3:3,9:9}]},{},[25]);
\No newline at end of file