PouchDB 3.0.6
//
//
(c) 2012-2014 Dale Harvey and the PouchDB team
//
PouchDB may be freely distributed under the Apache license, version 2.0.
//
For all details and documentation:
//
http://pouchdb.com
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==
typeof define&&define.amd)define(e);else{var t;"undefined"!=typeof window?t=wind
ow:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.Pouc
hDB=e()}}(function(){var define,module,exports;return function e(t,n,r){function
o(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)r
eturn u(s,!0);if(i)return i(s,!0);throw new Error("Cannot find module '"+s+"'")}
var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];retu
rn o(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var i="function"==type
of require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t){"use
strict";function n(e,t){for(var n=0;n<e.length;n++)if(t(e[n],n)===!0)return e[n]
;return!1}function r(e){return function(t,n){t||n[0].error?e(t||n[0]):e(null,n[0
])}}function o(e){var t={},n=[];return u.traverseRevTree(e,function(e,r,o,i){var
s=r+"-"+o;return e&&(t[s]=0),void 0!==i&&n.push({from:i,to:s}),s}),n.reverse(),
n.forEach(function(e){t[e.from]=void 0===t[e.from]?1+t[e.to]:Math.min(t[e.from],
1+t[e.to])}),t}function i(e,t,n){var r="limit"in t?t.keys.slice(t.skip,t.limit+t
.skip):t.skip>0?t.keys.slice(t.skip):t.keys;if(t.descending&&r.reverse(),!r.leng
th)return e._allDocs({limit:0},n);var o={offset:t.skip};return p.all(r.map(funct
ion(n){var r=a.extend(!0,{key:n,deleted:"ok"},t);return["limit","skip","keys"].f
orEach(function(e){delete r[e]}),new p(function(t,i){e._allDocs(r,function(e,r){
return e?i(e):(o.total_rows=r.total_rows,void t(r.rows[0]||{key:n,error:"not_fou
nd"}))})})})).then(function(e){return o.rows=e,o})}function s(){var e=this;l.cal
l(this),e.autoCompact=function(t){return e.auto_compaction&&"http"!==e.type()?fu
nction(n,r){if(n)t(n);else{var o=r.length,i=function(){o--,o||t(null,r)};if(!r.l
ength)return t(null,r);r.forEach(function(t){t.ok&&t.id?e.compactDocument(t.id,1
,i):i()})}}:t};var t,n=0,r=["change","delete","create","update"];this.on("newLis
tener",function(o){if(~r.indexOf(o)){if(n)return void n++;n++;var i=0;t=this.cha
nges({conflicts:!0,include_docs:!0,continuous:!0,since:"now",onChange:function(t
){t.seq<=i||(i=t.seq,e.emit("change",t),t.doc._deleted?e.emit("delete",t):"1"===
t.doc._rev.split("-")[0]?e.emit("create",t):e.emit("update",t))}})}}),this.on("r
emoveListener",function(e){~r.indexOf(e)&&(n--,n||t.cancel())})}var a=e("./utils
"),u=e("./merge"),c=e("./deps/errors"),l=e("events").EventEmitter,d=e("./deps/up
sert"),f=e("./changes"),p=a.Promise;a.inherits(s,l),t.exports=s,s.prototype.post
=a.adapterFun("post",function(e,t,n){return"function"==typeof t&&(n=t,t={}),"obj
ect"!=typeof e||Array.isArray(e)?n(c.NOT_AN_OBJECT):void this.bulkDocs({docs:[e]
},t,this.autoCompact(r(n)))}),s.prototype.put=a.adapterFun("put",a.getArguments(
function(e){var t,n,o,i,s=e.shift(),u="_id"in s;if("object"!=typeof s||Array.isA
rray(s))return(i=e.pop())(c.NOT_AN_OBJECT);for(s=a.clone(s);;)if(t=e.shift(),n=t
ypeof t,"string"!==n||u?"string"!==n||!u||"_rev"in s?"object"===n?o=t:"function"
===n&&(i=t):s._rev=t:(s._id=t,u=!0),!e.length)break;o=o||{};var l=a.invalidIdErr
or(s._id);return l?i(l):a.isLocalId(s._id)&&"function"==typeof this._putLocal?s.
_deleted?this._removeLocal(s,i):this._putLocal(s,i):void this.bulkDocs({docs:[s]
},o,this.autoCompact(r(i)))})),s.prototype.putAttachment=a.adapterFun("putAttach
ment",function(e,t,n,r,o,i){function s(e){return e._attachments=e._attachments||
{},e._attachments[t]={content_type:o,data:r},a.put(e)}var a=this;return"function
"==typeof o&&(i=o,o=r,r=n,n=null),"undefined"==typeof o&&(o=r,r=n,n=null),a.get(
e).then(function(e){if(e._rev!==n)throw c.REV_CONFLICT;return s(e)},function(t){
if(t.error===c.MISSING_DOC.error)return s({_id:e});throw t})}),s.prototype.remov
eAttachment=a.adapterFun("removeAttachment",function(e,t,n,r){var o=this;o.get(e
,function(e,i){return e?void r(e):i._rev!==n?void r(c.REV_CONFLICT):i._attachmen
ts?(delete i._attachments[t],0===Object.keys(i._attachments).length&&delete i._a
ttachments,void o.put(i,r)):r()})}),s.prototype.remove=a.adapterFun("remove",fun
ction(e,t,n,o){var i;"string"==typeof t?(i={_id:e,_rev:t},"function"==typeof n&&
(o=n,n={})):(i=e,"function"==typeof t?(o=t,n={}):(o=n,n=t)),n=a.clone(n||{}),n.w
as_delete=!0;var s={_id:i._id,_rev:i._rev||n.rev};return s._deleted=!0,a.isLocal
",function(e){return this._closed=!0,this._close(e)}),s.prototype.info=a.adapter
Fun("info",function(e){var t=this;this._info(function(n,r){return n?e(n):(r.db_n
ame=r.db_name||t._db_name,r.auto_compaction=!(!t._auto_compaction||"http"===t.ty
pe()),void e(null,r))})}),s.prototype.id=a.adapterFun("id",function(e){return th
is._id(e)}),s.prototype.type=function(){return"function"==typeof this._type?this
._type():this.adapter},s.prototype.bulkDocs=a.adapterFun("bulkDocs",function(e,t
,n){if("function"==typeof t&&(n=t,t={}),t=a.clone(t),Array.isArray(e)&&(e={docs:
e}),!e||!e.docs||!Array.isArray(e.docs))return n(c.MISSING_BULK_DOCS);for(var r=
0;r<e.docs.length;++r)if("object"!=typeof e.docs[r]||Array.isArray(e.docs[r]))re
turn n(c.NOT_AN_OBJECT);return e=a.clone(e),"new_edits"in t||(t.new_edits="new_e
dits"in e?e.new_edits:!0),this._bulkDocs(e,t,this.autoCompact(n))}),s.prototype.
registerDependentDatabase=a.adapterFun("registerDependentDatabase",function(e,t)
{function n(t){return t.dependentDbs=t.dependentDbs||{},t.dependentDbs[e]?!1:(t.
dependentDbs[e]=!0,t)}var r=new this.constructor(e,{adapter:this._adapter});d(th
is,"_local/_pouch_dependentDbs",n,function(e){return e?t(e):t(null,{db:r})})})},
{"./changes":6,"./deps/errors":11,"./deps/upsert":13,"./merge":18,"./utils":23,e
vents:27}],2:[function(e,t){(function(n){"use strict";function r(e){for(var t=r.
options,n=t.parser[t.strictMode?"strict":"loose"].exec(e),o={},i=14;i--;)o[t.key
[i]]=n[i]||"";return o[t.q.name]={},o[t.key[12]].replace(t.q.parser,function(e,n
,r){n&&(o[t.q.name][n]=r)}),o}function o(e){return/^_(design|local)/.test(e)?e:e
ncodeURIComponent(e)}function i(e){return e._attachments&&Object.keys(e._attachm
ents)?d.Promise.all(Object.keys(e._attachments).map(function(t){var r=e._attachm
ents[t];if(r.data&&"string"!=typeof r.data){if(void 0===typeof n||n.browser)retu
rn new d.Promise(function(e){var t=new FileReader;t.onloadend=function(t){r.data
=d.btoa(d.arrayBufferToBinaryString(t.target.result)),e()},t.readAsArrayBuffer(r
.data)});r.data=r.data.toString("base64")}})):d.Promise.resolve()}function s(e,t
){if(/http(s?):/.test(e)){var n=r(e);n.remote=!0,(n.user||n.password)&&(n.auth={
username:n.user,password:n.password});var o=n.path.replace(/(^\/|\/$)/g,"").spli
t("/");if(n.db=o.pop(),n.path=o.join("/"),t=t||{},t=d.clone(t),n.headers=t.heade
rs||{},t.auth||n.auth){var i=t.auth||n.auth,s=d.btoa(i.username+":"+i.password);
n.headers.Authorization="Basic "+s}return t.headers&&(n.headers=t.headers),n}ret
urn{host:"",path:"/",db:e,auth:!1}}function a(e,t){return u(e,e.db+"/"+t)}functi
on u(e,t){if(e.remote){var n=e.path?"/":"";return e.protocol+"://"+e.host+":"+e.
port+"/"+e.path+n+t}return"/"+t}function c(e,t){function n(e,t){return d.ajax(d.
extend({},h,e),t)}var r=this;r.getHost=e.getHost?e.getHost:s;var c=r.getHost(e.n
ame,e),p=a(c,"");r.getUrl=function(){return p},r.getHeaders=function(){return d.
clone(c.headers)};var h=e.ajax||{};e=d.clone(e);var v=function(){n({headers:c.he
aders,method:"PUT",url:p},function(e){e&&401===e.status?n({headers:c.headers,met
hod:"HEAD",url:p},function(e){e?t(e):t(null,r)}):e&&412!==e.status?t(e):t(null,r
)})};e.skipSetup||n({headers:c.headers,method:"GET",url:p},function(e){e?404===e
.status?v():t(e):t(null,r)}),r.type=function(){return"http"},r.id=d.adapterFun("
id",function(e){n({headers:c.headers,method:"GET",url:u(c,"")},function(t,n){var
r=n&&n.uuid?n.uuid+c.db:a(c,"");e(null,r)})}),r.request=d.adapterFun("request",
function(e,t){e.headers=c.headers,e.url=a(c,e.url),n(e,t)}),r.compact=d.adapterF
un("compact",function(e,t){"function"==typeof e&&(t=e,e={}),e=d.clone(e),n({head
ers:c.headers,url:a(c,"_compact"),method:"POST"},function(){function n(){r.info(
function(r,o){o.compact_running?setTimeout(n,e.interval||200):t()})}"function"==
typeof t&&n()})}),r._info=function(e){n({headers:c.headers,method:"GET",url:a(c,
"")},function(t,n){t?e(t):(n.host=a(c,""),e(null,n))})},r.get=d.adapterFun("get"
,function(e,t,r){"function"==typeof t&&(r=t,t={}),t=d.clone(t),void 0===t.auto_e
ncode&&(t.auto_encode=!0);var i=[];t.revs&&i.push("revs=true"),t.revs_info&&i.pu
sh("revs_info=true"),t.local_seq&&i.push("local_seq=true"),t.open_revs&&("all"!=
=t.open_revs&&(t.open_revs=JSON.stringify(t.open_revs)),i.push("open_revs="+t.op
en_revs)),t.attachments&&i.push("attachments=true"),t.rev&&i.push("rev="+t.rev),
t.conflicts&&i.push("conflicts="+t.conflicts),i=i.join("&"),i=""===i?"":"?"+i,t.
auto_encode&&(e=o(e));var s={headers:c.headers,method:"GET",url:a(c,e+i)},u=e.sp
lit("/");(u.length>1&&"_design"!==u[0]&&"_local"!==u[0]||u.length>2&&"_design"==
=u[0]&&"_local"!==u[0])&&(s.binary=!0),n(s,function(e,t,n){return e?r(e):void r(
null,t,n)})}),r.remove=d.adapterFun("remove",function(e,t,r,i){var s;"string"==t
ypeof t?(s={_id:e,_rev:t},"function"==typeof r&&(i=r,r={})):(s=e,"function"==typ
LETE",headers:c.headers},function(t,n){t?(r.emit("error",t),e(t)):(r.emit("destr
oyed"),e(null,n))})})}var l=25,d=e("../utils"),f=e("../deps/errors");r.options={
strictMode:!1,key:["source","protocol","authority","userInfo","user","password",
"host","port","relative","path","directory","file","query","anchor"],q:{name:"qu
eryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?
:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*
)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+)
:)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#]
(?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},
c.destroy=d.toPromise(function(e,t,n){var r=s(e,t);t=t||{},"function"==typeof t&
&(n=t,t={}),t=d.clone(t),t.headers=r.headers,t.method="DELETE",t.url=a(r,"");var
o=t.ajax||{};t=d.extend({},t,o),d.ajax(t,n)}),c.valid=function(){return!0},t.ex
ports=c}).call(this,e("/Users/nolan/workspace/pouchdb/node_modules/browserify/no
de_modules/insert-module-globals/node_modules/process/browser.js"))},{"../deps/e
rrors":11,"../utils":23,"/Users/nolan/workspace/pouchdb/node_modules/browserify/
node_modules/insert-module-globals/node_modules/process/browser.js":28}],3:[func
tion(e,t){(function(n,r){"use strict";function o(e,t,n){try{e.apply(t,n)}catch(r
){window.PouchDB&&window.PouchDB.emit("error",r)}}function i(){if(!y.running&&y.
queue.length){y.running=!0;var e=y.queue.shift();e.action(function(t,r){o(e.call
back,this,[t,r]),y.running=!1,n.nextTick(i)})}}function s(e){return function(t){
var n=t.target&&t.target.error&&t.target.error.name||t.target;e(v.error(v.IDB_ER
ROR,n,t.type))}}function a(){var e="_pouch__checkModernIdb_"+(r.navigator&&r.nav
igator.appVersion),t=p.hasLocalStorage()&&r.localStorage[e];if(t)return JSON.par
se(t);var n="_pouch__checkModernIdb",o=null===r.indexedDB.open(n,1).onupgradenee
ded;return r.indexedDB.deleteDatabase&&r.indexedDB.deleteDatabase(n),p.hasLocalS
torage()&&(r.localStorage[e]=JSON.stringify(o)),o}function u(e,t,n){var r={data:
m.stringify(e)};return r.winningRev=t,r.deletedOrLocal=n?"1":"0",r.id=e.id,r}fun
ction c(e){if(!e)return null;if(!e.data)return e;var t=m.parse(e.data);return t.
winningRev=e.winningRev,t.deletedOrLocal="1"===e.deletedOrLocal,t}function l(e,t
){var n=this;y.queue.push({action:function(t){d(n,e,t)},callback:t}),i()}functio
n d(e,t,o){function i(e){e.createObjectStore(b,{keyPath:"id"}).createIndex("seq"
,"seq",{unique:!0}),e.createObjectStore(w,{autoIncrement:!0}).createIndex("_doc_
id_rev","_doc_id_rev",{unique:!0}),e.createObjectStore(E,{keyPath:"digest"}),e.c
reateObjectStore(S,{keyPath:"id",autoIncrement:!1}),e.createObjectStore(x)}funct
ion a(e,t){var n=e.currentTarget.transaction,r=n.objectStore(b);r.createIndex("d
eletedOrLocal","deletedOrLocal",{unique:!1}),r.openCursor().onsuccess=function(e
){var o=e.target.result;if(o){var i=o.value,s=p.isDeleted(i);i.deletedOrLocal=s?
"1":"0",r.put(i),o["continue"]()}else t(n)}}function d(e){e.createObjectStore(k,
{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function f
(e,t){t=t||e.currentTarget.transaction;var n=t.objectStore(k),o=t.objectStore(b)
,i=t.objectStore(w),s=o.openCursor();s.onsuccess=function(e){var t=e.target.resu
lt;if(t){var s=t.value,a=s.id,u=p.isLocalId(a),c=h.winningRev(s);if(u){var l=a+"
::"+c,d=a+"::",f=a+"::~",v=i.index("_doc_id_rev"),m=r.IDBKeyRange.bound(d,f,!1,!
1),_=v.openCursor(m);_.onsuccess=function(e){if(_=e.target.result){var r=_.value
;r._doc_id_rev===l&&n.put(r),i["delete"](_.primaryKey),_["continue"]()}else o["d
elete"](t.primaryKey),t["continue"]()}}else t["continue"]()}}}function m(e,t,n){
var o="startkey"in t?t.startkey:!1,i="endkey"in t?t.endkey:!1,s="key"in t?t.key:
!1,a=t.skip||0,u="number"==typeof t.limit?t.limit:-1,l=t.inclusive_end!==!1,d="d
escending"in t&&t.descending?"prev":null,f=!1;d&&o&&i&&(f=i,i=!1);var m=null;try
{o&&i?m=r.IDBKeyRange.bound(o,i,!1,!l):o?m=d?r.IDBKeyRange.upperBound(o):r.IDBKe
yRange.lowerBound(o):i?m=d?r.IDBKeyRange.lowerBound(i,!l):r.IDBKeyRange.upperBou
nd(i,!l):s&&(m=r.IDBKeyRange.only(s))}catch(_){return"DataError"===_.name&&0===_
.code?n(null,{total_rows:e,offset:t.skip,rows:[]}):n(v.error(v.IDB_ERROR,_.name,
_.message))}var y=O.transaction([b,w],"readonly");y.oncomplete=function(){n(null
,{total_rows:e,offset:t.skip,rows:S})};var g=y.objectStore(b),E=d?g.openCursor(m
,d):g.openCursor(m),S=[];E.onsuccess=function(e){function n(e,n){var o={id:e.id,
key:e.id,value:{rev:i}};if(t.include_docs){o.doc=n,o.doc._rev=i,o.doc._doc_id_re
v&&delete o.doc._doc_id_rev,t.conflicts&&(o.doc._conflicts=h.collectConflicts(e)
);for(var s in o.doc._attachments)o.doc._attachments.hasOwnProperty(s)&&(o.doc._
attachments[s].stub=!0)}var c=p.isDeleted(e,i);if("ok"===t.deleted)c&&(o.value.d
eleted=!0,o.doc=null),S.push(o);else if(!c&&a--<=0){if(f){if(l&&o.key<f)return;i
f(!l&&o.key<=f)return}if(S.push(o),0===--u)return}r["continue"]()}if(e.target.re
sult){var r=e.target.result,o=c(r.value),i=o.winningRev||h.winningRev(o);if(t.in
clude_docs){var s=y.objectStore(w).index("_doc_id_rev"),d=o.id+"::"+i;s.get(d).o
nsuccess=function(e){n(c(r.value),e.target.result)}}else n(o)}}}function y(e){if
(-1!==R)return e(null,R);var t,n=O.transaction([b],"readonly"),o=n.objectStore(b
).index("deletedOrLocal");o.count(r.IDBKeyRange.only("0")).onsuccess=function(e)
{t=e.target.result},n.onerror=s(e),n.oncomplete=function(){R=t,e(null,R)}}var g=
3,b="document-store",w="by-sequence",E="attach-store",S="meta-store",k="local-st
ore",x="detect-blob-support",q=t.name,T=null,A=null,L=!1,O=null,R=-1;e.type=func
tion(){return"idb"},e._id=p.toPromise(function(e){e(null,A)}),e._bulkDocs=functi
on(t,n,r){function o(e){var t=e.target.result;t.updateSeq=(t.updateSeq||0)+M,N.o
bjectStore(S).put(t)}function i(){++P===C.length&&(N.objectStore(S).get(S).onsuc
cess=o)}function a(){if(C.length){var t=new p.Map;C.forEach(function(n,r){if(n._
id&&p.isLocalId(n._id))return void e[n._deleted?"_removeLocal":"_putLocal"](n,{c
tx:N},function(e){F[r]=e?e:{},i()});var o=n.metadata.id;t.has(o)?t.get(o).push([
n,r]):t.set(o,[[n,r]])}),t.forEach(function(e,t){function n(){i(),++o<e.length&&
r()}function r(){var r=e[o],i=r[0],s=r[1];B.has(t)?g(B.get(t),i,s,n):x(i,s,n)}va
r o=0;r()})}}function d(e){function t(){++n===C.length&&e()}if(!C.length)return
e();var n=0;C.forEach(function(e){if(e._id&&p.isLocalId(e._id))return t();var n=
e.metadata.id,r=N.objectStore(b).get(n);r.onsuccess=function(e){var r=c(e.target
.result);r&&B.set(n,r),t()}})}function f(){var e=F.map(function(e){if(e._bulk_se
q)delete e._bulk_seq;else if(!Object.keys(e).length)return{ok:!0};if(e.error)ret
urn e;var t=e.metadata,n=h.winningRev(t);return{ok:!0,id:t.id,rev:n}});l.Changes
.notify(q),R=-1,r(null,e)}function m(e,t){if(e.stub)return t();if("string"==type
of e.data){var n;try{n=atob(e.data)}catch(o){var i=v.error(v.BAD_ARG,"Attachment
s need to be base64 encoded");return r(i)}if(T){var s=e.content_type;n=p.fixBina
ry(n),e.data=p.createBlob([n],{type:s})}return void p.MD5(n).then(function(n){e.
digest="md5-"+n,t()})}var a=new FileReader;a.onloadend=function(){var n=p.arrayB
ufferToBinaryString(this.result||"");T||(e.data=btoa(n)),p.MD5(n).then(function(
n){e.digest="md5-"+n,t()})},a.readAsArrayBuffer(e.data)}function _(e){function t
(){n++,C.length===n&&e()}if(!C.length)return e();var n=0;C.forEach(function(e){f
unction n(){o++,o===r.length&&t()}var r=e.data&&e.data._attachments?Object.keys(
e.data._attachments):[];if(!r.length)return t();var o=0;for(var i in e.data._att
achments)e.data._attachments.hasOwnProperty(i)&&m(e.data._attachments[i],n)})}fu
nction y(e,t,n,r,o){function i(e){c||(e?(c=e,r(c)):l===d.length&&a())}function s
(e){l++,i(e)}function a(){function i(i){var s=e.metadata;s.seq=i.target.result,d
elete s.rev;var a=u(s,t,n),c=N.objectStore(b).put(a);c.onsuccess=function(){dele
te s.deletedOrLocal,delete s.winningRev,F[o]=e,B.set(e.metadata.id,e.metadata),p
.call(r)}}M++,e.data._doc_id_rev=e.data._id+"::"+e.data._rev;var s=N.objectStore
(w),a=s.index("_doc_id_rev"),c=s.put(e.data);c.onsuccess=i,c.onerror=function(t)
{t.preventDefault(),t.stopPropagation();var n=a.getKey(e.data._doc_id_rev);n.ons
uccess=function(t){var n=s.put(e.data,t.target.result);M--,n.onsuccess=i}}}var c
=null,l=0;e.data._id=e.metadata.id,e.data._rev=e.metadata.rev,n&&(e.data._delete
d=!0);var d=e.data._attachments?Object.keys(e.data._attachments):[];for(var f in
e.data._attachments)if(e.data._attachments[f].stub)l++,i();else{var h=e.data._a
ttachments[f].data;delete e.data._attachments[f].data;var v=e.data._attachments[
f].digest;L(e,v,h,s)}d.length||a()}function g(e,t,n,r){var o=h.merge(e.rev_tree,
t.metadata.rev_tree[0],1e3),i=p.isDeleted(e),s=p.isDeleted(t.metadata),a=i&&s&&I
||!i&&I&&"new_leaf"!==o.conflicts;if(a)return F[n]=A(v.REV_CONFLICT,t._bulk_seq)
,r();t.metadata.rev_tree=o.tree;var u=h.winningRev(t.metadata);s=p.isDeleted(t.m
etadata,u),y(t,u,s,r,n)}function x(e,t,r){var o=h.winningRev(e.metadata),i=p.isD
eleted(e.metadata,o);return"was_delete"in n&&i?(F[t]=v.MISSING_DOC,r()):void y(e
,o,i,r,t)}function A(e,t){return e._bulk_seq=t,e}function L(e,t,n,r){var o=N.obj
ectStore(E);o.get(t).onsuccess=function(i){var s=i.target.result&&i.target.resul
t.refs||{},a=[e.metadata.id,e.metadata.rev].join("@"),u={digest:t,body:n,refs:s}
;u.refs[a]=!0,o.put(u).onsuccess=function(){p.call(r)}}}var I=n.new_edits,D=t.do
cs,C=D.map(function(e,t){if(e._id&&p.isLocalId(e._id))return e;var n=p.parseDoc(
e,I);return n._bulk_seq=t,n}),j=C.filter(function(e){return e.error});if(j.lengt
h)return r(j[0]);var N,F=new Array(C.length),B=new p.Map,M=0,P=0;_(function(){va
r e=[b,w,E,S,k];N=O.transaction(e,"readwrite"),N.onerror=s(r),N.ontimeout=s(r),N
.oncomplete=f,d(a)})},e._get=function(e,t,n){function r(){n(s,{doc:o,metadata:i,
ctx:a})}var o,i,s,a;t=p.clone(t),a=t.ctx?t.ctx:O.transaction([b,w,E],"readonly")
,a.objectStore(b).get(e).onsuccess=function(e){if(i=c(e.target.result),!i)return
s=v.MISSING_DOC,r();if(p.isDeleted(i)&&!t.rev)return s=v.error(v.MISSING_DOC,"d
eleted"),r();var n=a.objectStore(w),u=t.rev||i.winningRev||h.winningRev(i),l=i.i
d+"::"+u;n.index("_doc_id_rev").get(l).onsuccess=function(e){return o=e.target.r
esult,o&&o._doc_id_rev&&delete o._doc_id_rev,o?void r():(s=v.MISSING_DOC,r())}}}
,e._getAttachment=function(e,t,n){var r;t=p.clone(t),r=t.ctx?t.ctx:O.transaction
([b,w,E],"readonly");var o=e.digest,i=e.content_type;r.objectStore(E).get(o).ons
uccess=function(e){var r=e.target.result.body;if(t.encode)if(r)if("string"!=type
of r){var o=new FileReader;o.onloadend=function(){var e=p.arrayBufferToBinaryStr
ing(this.result||"");n(null,btoa(e))},o.readAsArrayBuffer(r)}else n(null,r);else
n(null,"");else r?"string"!=typeof r?n(null,r):(r=p.fixBinary(atob(r)),n(null,p
.createBlob([r],{type:i}))):n(null,p.createBlob([""],{type:i}))}},e._allDocs=fun
ction(e,t){y(function(n,r){return n?t(n):0===e.limit?t(null,{total_rows:r,offset
:e.skip,rows:[]}):void m(r,e,t)})},e._info=function(e){y(function(t,n){if(t)retu
rn e(t);if(null===O){var r=new Error("db isn't open");return r.id="idbNull",e(r)
}var o=0,i=O.transaction([S],"readonly");i.objectStore(S).get(S).onsuccess=funct
ion(e){o=e.target.result&&e.target.result.updateSeq||0},i.oncomplete=function(){
e(null,{doc_count:n,update_seq:o})}})},e._changes=function(t){function n(){v=O.t
ransaction([b,w],"readonly"),v.oncomplete=i;var e;e=a?v.objectStore(w).openCurso
r(r.IDBKeyRange.lowerBound(t.since,!0),a):v.objectStore(w).openCursor(r.IDBKeyRa
nge.lowerBound(t.since,!0)),e.onsuccess=o,e.onerror=onerror}function o(e){var n=
e.target.result;if(n){var r=n.value;if(t.doc_ids&&-1===t.doc_ids.indexOf(r._id))
return n["continue"]();var o=v.objectStore(b);o.get(r._id).onsuccess=function(e)
{var o=c(e.target.result);u<o.seq&&(u=o.seq);var i=o.winningRev||h.winningRev(o)
;if(r._rev!==i)return n["continue"]();delete r._doc_id_rev;var s=t.processChange
(r,o,t);s.seq=n.key,y(s)&&(_++,f&&m.push(s),t.onChange(s)),_!==d&&n["continue"](
)}}}function i(){t.continuous||t.complete(null,{results:m,last_seq:u})}if(t=p.cl
one(t),t.continuous){var s=q+":"+p.uuid();return l.Changes.addListener(q,s,e,t),
l.Changes.notify(q),{cancel:function(){l.Changes.removeListener(q,s)}}}var a=t.d
escending?"prev":null,u=0;t.since=t.since&&!a?t.since:0;var d="limit"in t?t.limi
t:-1;0===d&&(d=1);var f;f="returnDocs"in t?t.returnDocs:!0;var v,m=[],_=0,y=p.fi
lterChange(t);n()},e._close=function(e){return null===O?e(v.NOT_OPEN):(O.close()
,delete _[q],O=null,void e())},e._getRevisionTree=function(e,t){var n=O.transact
ion([b],"readonly"),r=n.objectStore(b).get(e);r.onsuccess=function(e){var n=c(e.
target.result);n?t(null,n.rev_tree):t(v.MISSING_DOC)}},e._doCompaction=function(
e,t,n,r){var o=O.transaction([b,w],"readwrite"),i=o.objectStore(b);i.get(e).onsu
ccess=function(r){var i=c(r.target.result);i.rev_tree=t;var s=n.length;n.forEach
(function(t){var n=o.objectStore(w).index("_doc_id_rev"),r=e+"::"+t;n.getKey(r).
onsuccess=function(e){var t=e.target.result;if(t&&(o.objectStore(w)["delete"](t)
,s--,!s)){var n=i.winningRev||h.winningRev(i),r=i.deletedOrLocal;o.objectStore(b
).put(u(i,n,r))}}})},o.oncomplete=function(){p.call(r)}},e._getLocal=function(e,
t){var n=O.transaction([k],"readonly"),r=n.objectStore(k).get(e);r.onerror=s(t),
r.onsuccess=function(e){var n=e.target.result;n?(delete n._doc_id_rev,t(null,n))
:t(v.MISSING_DOC)
}},e._putLocal=function(e,t,n){"function"==typeof t&&(n=t,t={}),delete e._revisi
ons;var r=e._rev,o=e._id;e._rev=r?"0-"+(parseInt(r.split("-")[1],10)+1):"0-1",e.
_doc_id_rev=o+"::"+e._rev;var i,a=t.ctx;a||(a=O.transaction([k],"readwrite"),a.o
nerror=s(n),a.oncomplete=function(){i&&n(null,i)});var u,c=a.objectStore(k);if(r
){var l=c.index("_doc_id_rev"),d=o+"::"+r;u=l.get(d),u.onsuccess=function(r){if(
r.target.result){var o=c.put(e);o.onsuccess=function(){i={ok:!0,id:e._id,rev:e._
rev},t.ctx&&n(null,i)}}else n(v.REV_CONFLICT)}}else u=c.get(o),u.onsuccess=funct
ion(r){if(r.target.result)n(v.REV_CONFLICT);else{var o=c.put(e);o.onsuccess=func
tion(){i={ok:!0,id:e._id,rev:e._rev},t.ctx&&n(null,i)}}}},e._removeLocal=functio
n(e,t){var n,r=O.transaction([k],"readwrite");r.oncomplete=function(){n&&t(null,
n)};var o=e._id+"::"+e._rev,i=r.objectStore(k),a=i.index("_doc_id_rev"),u=a.get(
o);u.onerror=s(t),u.onsuccess=function(e){var r=e.target.result;if(r){var s=a.ge
tKey(o);s.onsuccess=function(e){var t=e.target.result;i["delete"](t),n={ok:!0,id
){t?i.emit("error",t):i.emit("complete",n),i.removeAllListeners(),e.removeListen
er("destroyed",r)});s&&(i.on("complete",function(e){s(null,e)}),i.on("error",fun
ction(e){s(e)}));var c=t.onChange;c&&i.on("change",c),e.once("destroyed",r),t.on
Change=function(e){t.isCancelled||(i.emit("change",e),i.startSeq&&i.startSeq<=e.
seq&&(i.emit("uptodate"),i.startSeq=!1),e.deleted?i.emit("delete",e):1===e.chang
es.length&&"1-"===e.changes[0].rev.slice(0,2)?i.emit("create",e):i.emit("update"
,e))};var l=new o.Promise(function(e,n){t.complete=function(t,r){t?n(t):e(r)}});
i.once("cancel",function(){c&&i.removeListener("change",c),t.complete(null,{stat
us:"cancelled"})}),this.then=l.then.bind(l),this["catch"]=l["catch"].bind(l),thi
s.then(function(e){u(null,e)},u),e.taskqueue.isReady?i.doChanges(t):e.taskqueue.
addTask(function(){i.isCancelled?i.emit("cancel"):i.doChanges(t)})}function r(e,
t,n){var r=[{rev:e._rev}];"all_docs"===n.style&&(r=i.collectLeaves(t.rev_tree).m
ap(function(e){return{rev:e.rev}}));var s={id:t.id,changes:r,doc:e};return o.isD
eleted(t,e._rev)&&(s.deleted=!0),n.conflicts&&(s.doc._conflicts=i.collectConflic
ts(t),s.doc._conflicts.length||delete s.doc._conflicts),s}var o=e("./utils"),i=e
("./merge"),s=e("./deps/errors"),a=e("events").EventEmitter,u=e("./evalFilter"),
c=e("./evalView");t.exports=n,o.inherits(n,a),n.prototype.cancel=function(){this
.isCancelled=!0,this.db.taskqueue.isReady&&this.emit("cancel")},n.prototype.doCh
anges=function(e){var t=this,n=e.complete;if(e=o.clone(e),"live"in e&&!("continu
ous"in e)&&(e.continuous=e.live),e.processChange=r,"latest"===e.since&&(e.since=
"now"),e.since||(e.since=0),"now"===e.since)return void this.db.info().then(func
tion(r){return t.isCancelled?void n(null,{status:"cancelled"}):(e.since=r.update
_seq-1,void t.doChanges(e))},n);if(e.continuous&&"now"!==e.since&&this.db.info()
.then(function(e){t.startSeq=e.update_seq-1},function(e){if("idbNull"!==e.id)thr
ow e}),"http"!==this.db.type()&&e.filter&&"string"==typeof e.filter)return this.
filterChanges(e);"descending"in e||(e.descending=!1),e.limit=0===e.limit?1:e.lim
it,e.complete=n;var i=this.db._changes(e);if(i&&"function"==typeof i.cancel){var
s=t.cancel;t.cancel=o.getArguments(function(e){i.cancel(),s.apply(this,e)})}},n
.prototype.filterChanges=function(e){var t=this,n=e.complete;if("_view"===e.filt
er){if(!e.view||"string"!=typeof e.view){var r=new Error("`view` filter paramete
r is not provided.");return r.status=s.BAD_REQUEST.status,r.name=s.BAD_REQUEST.n
ame,r.error=!0,void n(r)}var o=e.view.split("/");this.db.get("_design/"+o[0],fun
ction(r,i){if(t.isCancelled)return void n(null,{status:"cancelled"});if(r)return
void n(r);if(i&&i.views&&i.views[o[1]]){var a=c(i.views[o[1]].map);return e.fil
ter=a,void t.doChanges(e)}var u=i.views?"missing json key: "+o[1]:"missing json
key: views";r||(r=new Error(u),r.status=s.MISSING_DOC.status,r.name=s.MISSING_DO
C.name,r.error=!0),n(r)})}else{var i=e.filter.split("/");this.db.get("_design/"+
i[0],function(r,o){if(t.isCancelled)return void n(null,{status:"cancelled"});if(
r)return void n(r);if(o&&o.filters&&o.filters[i[1]]){var a=u(o.filters[i[1]]);re
turn e.filter=a,void t.doChanges(e)}var c=o&&o.filters?"missing json key: "+i[1]
:"missing json key: filters";return r||(r=new Error(c),r.status=s.MISSING_DOC.st
atus,r.name=s.MISSING_DOC.name,r.error=!0),void n(r)})}}},{"./deps/errors":11,".
/evalFilter":15,"./evalView":16,"./merge":18,"./utils":23,events:27}],7:[functio
n(e,t){(function(n){"use strict";function r(e){e&&n.debug&&console.error(e)}func
tion o(e,t,n){if(!(this instanceof o))return new o(e,t,n);var c=this;("function"
==typeof t||"undefined"==typeof t)&&(n=t,t={}),e&&"object"==typeof e&&(t=e,e=voi
d 0),"undefined"==typeof n&&(n=r),t=t||{};var l=n;c.auto_compaction=t.auto_compa
ction,c.prefix=o.prefix,i.call(c),c.taskqueue=new a;var d=new u(function(r,i){n=
function(e,t){return e?i(e):(delete t.then,void r(t))},t=s.clone(t);var a,u,l=t.
name||e;return function(){try{if("string"!=typeof l)throw u=new Error("Missing/i
nvalid DB name"),u.code=400,u;if(a=o.parseAdapter(l,t),t.originalName=l,t.name=a
.name,t.prefix&&"http"!==a.adapter&&"https"!==a.adapter&&(t.name=t.prefix+t.name
),t.adapter=t.adapter||a.adapter,c._adapter=t.adapter,c._db_name=l,!o.adapters[t
.adapter])throw u=new Error("Adapter is missing"),u.code=404,u;if(!o.adapters[t.
adapter].valid())throw u=new Error("Invalid Adapter"),u.code=404,u}catch(e){c.ta
skqueue.fail(e),c.changes=s.toPromise(function(t){t.complete&&t.complete(e)})}}(
),u?i(u):(c.adapter=t.adapter,c.replicate={},c.replicate.from=function(e,t,n){re
turn c.constructor.replicate(e,c,t,n)},c.replicate.to=function(e,t,n){return c.c
onstructor.replicate(c,e,t,n)},c.sync=function(e,t,n){return c.constructor.sync(
c,e,t,n)},c.replicate.sync=c.sync,c.destroy=s.adapterFun("destroy",function(e){v
s=function(e){return this.store.has(e)},o.prototype["delete"]=function(e){return
this.store["delete"](e)}},{}],11:[function(e,t,n){"use strict";function r(e){th
is.status=e.status,this.name=e.error,this.message=e.reason,this.error=!0}r.proto
type__proto__=Error.prototype,r.prototype.toString=function(){return JSON.string
ify({status:this.status,name:this.name,message:this.message})},n.UNAUTHORIZED=ne
w r({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),n
.MISSING_BULK_DOCS=new r({status:400,error:"bad_request",reason:"Missing JSON li
st of 'docs'"}),n.MISSING_DOC=new r({status:404,error:"not_found",reason:"missin
g"}),n.REV_CONFLICT=new r({status:409,error:"conflict",reason:"Document update c
onflict"}),n.INVALID_ID=new r({status:400,error:"invalid_id",reason:"_id field m
ust contain a string"}),n.MISSING_ID=new r({status:412,error:"missing_id",reason
:"_id is required for puts"}),n.RESERVED_ID=new r({status:400,error:"bad_request
",reason:"Only reserved document ids may start with underscore."}),n.NOT_OPEN=ne
w r({status:412,error:"precondition_failed",reason:"Database not open"}),n.UNKNO
WN_ERROR=new r({status:500,error:"unknown_error",reason:"Database encountered an
unknown error"}),n.BAD_ARG=new r({status:500,error:"badarg",reason:"Some query
argument is invalid"}),n.INVALID_REQUEST=new r({status:400,error:"invalid_reques
t",reason:"Request was invalid"}),n.QUERY_PARSE_ERROR=new r({status:400,error:"q
uery_parse_error",reason:"Some query parameter is invalid"}),n.DOC_VALIDATION=ne
w r({status:500,error:"doc_validation",reason:"Bad special document member"}),n.
BAD_REQUEST=new r({status:400,error:"bad_request",reason:"Something wrong with t
he request"}),n.NOT_AN_OBJECT=new r({status:400,error:"bad_request",reason:"Docu
ment must be a JSON object"}),n.DB_MISSING=new r({status:404,error:"not_found",r
eason:"Database not found"}),n.IDB_ERROR=new r({status:500,error:"indexed_db_wen
t_bad",reason:"unknown"}),n.WSQ_ERROR=new r({status:500,error:"web_sql_went_bad"
,reason:"unknown"}),n.LDB_ERROR=new r({status:500,error:"levelDB_went_went_bad",
reason:"unknown"}),n.FORBIDDEN=new r({status:403,error:"forbidden",reason:"Forbi
dden by design doc validate_doc_update function"}),n.error=function(e,t,n){funct
ion r(){this.message=t,n&&(this.name=n)
}return r.prototype=e,new r(t)}},{}],12:[function(e,t){(function(n,r){"use stric
t";function o(e,t,n){if("function"==typeof e.slice)return t?n?e.slice(t,n):e.sli
ce(t):e.slice();t=Math.floor(t||0),n=Math.floor(n||0);var r=e.byteLength;if(t=0>
t?Math.max(t+r,0):Math.min(r,t),n=0>n?Math.max(n+r,0):Math.min(r,n),0>=n-t)retur
n new ArrayBuffer(0);var o=new ArrayBuffer(n-t),i=new Uint8Array(o),s=new Uint8A
rray(e,t,n-t);return i.set(s),o}function i(e){var t=[255&e,e>>>8&255,e>>>16&255,
e>>>24&255];return t.map(function(e){return String.fromCharCode(e)}).join("")}fu
nction s(e){for(var t="",n=0;n<e.length;n++)t+=i(e[n]);return r.btoa(t)}var a=e(
"crypto"),u=e("spark-md5"),c=r.setImmediate||r.setTimeout;t.exports=function(e,t
){function r(e,t,n,r){d?e.appendBinary(t.substring(n,r)):e.append(o(t,n,r))}func
tion i(){var n=v*p,o=n+p;if(n+p>=e.size&&(o=e.size),v++,h>v)r(m,e,n,o),c(i);else
{r(m,e,n,o);var a=m.end(!0),u=s(a);t(null,u),m.destroy()}}if(!n.browser){var l=a
.createHash("md5").update(e).digest("base64");return void t(null,l)}var d="strin
g"==typeof e,f=d?e.length:e.byteLength,p=Math.min(524288,f),h=Math.ceil(f/p),v=0
,m=d?new u:new u.ArrayBuffer;i()}}).call(this,e("/Users/nolan/workspace/pouchdb/
node_modules/browserify/node_modules/insert-module-globals/node_modules/process/
browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})
},{"/Users/nolan/workspace/pouchdb/node_modules/browserify/node_modules/insert-m
odule-globals/node_modules/process/browser.js":28,crypto:26,"spark-md5":57}],13:
[function(e,t){"use strict";function n(e,t,n){return new o(function(o,i){return
t&&"object"==typeof t&&(t=t._id),"string"!=typeof t?i(new Error("doc id is requi
red")):void e.get(t,function(s,a){if(s)return 404!==s.status?i(s):o(r(e,n({_id:t
}),n));var u=n(a);return u?void o(r(e,u,n)):o(a)})})}function r(e,t,r){return e.
put(t)["catch"](function(o){if(409!==o.status)throw o;return n(e,t,r)})}var o=e(
"../utils").Promise;t.exports=function(e,t,r,o){return"function"!=typeof o?n(e,t
,r):void n(e,t,r).then(function(e){o(null,e)},o)}},{"../utils":23}],14:[function
(e,t){"use strict";function n(e){return 0|Math.random()*e}function r(e,t){t=t||o
.length;var r="",i=-1;if(e){for(;++i<e;)r+=o[n(t)];return r}for(;++i<36;)switch(
i){case 8:case 13:case 18:case 23:r+="-";break;case 19:r+=o[3&n(16)|8];break;def
ault:r+=o[n(16)]}return r}var o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk
lmnopqrstuvwxyz".split("");t.exports=r},{}],15:[function(_dereq_,module,exports)
evTree(e.rev_tree,function(e,n,o,i,s){o===t&&(r=!!s.deleted)}),r},n.filterChange
=function(e){return function(t){var n={},r=e.filter&&"function"==typeof e.filter
;if(n.query=e.query_params,e.filter&&r&&!e.filter.call(this,t.doc,n))return!1;if
(e.doc_ids&&-1===e.doc_ids.indexOf(t.id))return!1;if(e.include_docs)for(var o in
t.doc._attachments)t.doc._attachments.hasOwnProperty(o)&&(t.doc._attachments[o]
.stub=!0);else delete t.doc;return!0}},n.parseDoc=function(e,t){var r,o,i,s,a={s
tatus:"available"};if(e._deleted&&(a.deleted=!0),t)if(e._id||(e._id=n.uuid()),o=
n.uuid(32,16).toLowerCase(),e._rev){if(i=/^(\d+)-(.+)$/.exec(e._rev),!i){var u=n
ew TypeError("invalid value for property '_rev'");u.status=400}e._rev_tree=[{pos
:parseInt(i[1],10),ids:[i[2],{status:"missing"},[[o,a,[]]]]}],r=parseInt(i[1],10
)+1}else e._rev_tree=[{pos:1,ids:[o,a,[]]}],r=1;else if(e._revisions&&(e._rev_tr
ee=[{pos:e._revisions.start-e._revisions.ids.length+1,ids:e._revisions.ids.reduc
e(function(e,t){return null===e?[t,a,[]]:[t,{status:"missing"},[e]]},null)}],r=e
._revisions.start,o=e._revisions.ids[0]),!e._rev_tree){if(i=/^(\d+)-(.+)$/.exec(
e._rev),!i)throw s=new TypeError(c.BAD_ARG.message),s.status=c.BAD_ARG.status,s;
r=parseInt(i[1],10),o=i[2],e._rev_tree=[{pos:parseInt(i[1],10),ids:[i[2],a,[]]}]
}n.invalidIdError(e._id),e._rev=[r,o].join("-");var l={metadata:{},data:{}};for(
var d in e)if(e.hasOwnProperty(d)){var f="_"===d[0];if(f&&!p[d])throw s=new Erro
r(c.DOC_VALIDATION.message+": "+d),s.status=c.DOC_VALIDATION.status,s;f&&!h[d]?l
.metadata[d.slice(1)]=e[d]:l.data[d]=e[d]}return l},n.isCordova=function(){retur
n"undefined"!=typeof cordova||"undefined"!=typeof PhoneGap||"undefined"!=typeof
phonegap},n.hasLocalStorage=function(){if(i())return!1;try{return r.localStorage
}catch(e){return!1}},n.Changes=s,n.inherits(s,l),s.prototype.addListener=functio
n(e,t,r,o){function i(){r.changes({include_docs:o.include_docs,conflicts:o.confl
icts,continuous:!1,descending:!1,filter:o.filter,view:o.view,since:o.since,query
_params:o.query_params,onChange:function(e){e.seq>o.since&&!o.cancelled&&(o.sinc
e=e.seq,n.call(o.onChange,e))}})}this.listeners[t]||(this.listeners[t]=i,this.on
(e,i))},s.prototype.removeListener=function(e,t){t in this.listeners&&l.prototyp
e.removeListener.call(this,e,this.listeners[t])},s.prototype.notifyLocalWindows=
function(e){this.isChrome?chrome.storage.local.set({dbName:e}):this.hasLocal&&(l
ocalStorage[e]="a"===localStorage[e]?"b":"a")},s.prototype.notify=function(e){th
is.emit(e),this.notifyLocalWindows(e)},n.atob=t.browser&&"atob"in r?function(e){
return atob(e)}:function(e){var t=new u(e,"base64");if(t.toString("base64")!==e)
throw"Cannot base64 encode full string";return t.toString("binary")},n.btoa=t.br
owser&&"btoa"in r?function(e){return btoa(e)}:function(e){return new u(e,"binary
").toString("base64")},n.fixBinary=function(e){if(!t.browser)return e;for(var n=
e.length,r=new ArrayBuffer(n),o=new Uint8Array(r),i=0;n>i;i++)o[i]=e.charCodeAt(
i);return r},n.once=function(e){var t=!1;return n.getArguments(function(n){if(t)
throw"function"==typeof console.trace&&console.trace(),new Error("once called m
ore than once");t=!0,e.apply(this,n)})},n.toPromise=function(e){return n.getArgu
ments(function(r){var o,i=this,s="function"==typeof r[r.length-1]?r.pop():!1;s&&
(o=function(e,n){t.nextTick(function(){s(e,n)})});var a=new f(function(t,o){var
s;try{var a=n.once(function(e,n){e?o(e):t(n)});r.push(a),s=e.apply(i,r),s&&"func
tion"==typeof s.then&&t(s)}catch(u){o(u)}});return o&&a.then(function(e){o(null,
e)},o),a.cancel=function(){return this},a})},n.adapterFun=function(e,t){return n
.toPromise(n.getArguments(function(r){if(this._closed)return f.reject(new Error(
"database is closed"));var o=this;return this.taskqueue.isReady?t.apply(this,r):
new n.Promise(function(t,n){o.taskqueue.addTask(function(i){i?n(i):t(o[e].apply(
o,r))})})}))},n.arrayBufferToBinaryString=function(e){for(var t="",n=new Uint8Ar
ray(e),r=n.byteLength,o=0;r>o;o++)t+=String.fromCharCode(n[o]);return t},n.cance
llableFun=function(e,t,r){r=r?n.clone(!0,{},r):{};var o=new l,i=r.complete||func
tion(){},s=r.complete=n.once(function(e,t){e?i(e):(o.emit("end",t),i(null,t)),o.
removeAllListeners()}),a=r.onChange||function(){},u=0;t.on("destroyed",function(
){o.removeAllListeners()}),r.onChange=function(e){a(e),e.seq<=u||(u=e.seq,o.emit
("change",e),e.deleted?o.emit("delete",e):1===e.changes.length&&"1-"===e.changes
[0].rev.slice(0,1)?o.emit("create",e):o.emit("update",e))};var c=new f(function(
e,t){r.complete=function(n,r){n?t(n):e(r)}});return c.then(function(e){s(null,e)
},s),c.cancel=function(){c.isCancelled=!0,t.taskqueue.isReady&&r.complete(null,{
status:"cancelled"})},t.taskqueue.isReady?e(t,r,c):t.taskqueue.addTask(function(
){c.isCancelled?r.complete(null,{status:"cancelled"}):e(t,r,c)}),c.on=o.on.bind(
o),c.once=o.once.bind(o),c.addListener=o.addListener.bind(o),c.removeListener=o.
removeListener.bind(o),c.removeAllListeners=o.removeAllListeners.bind(o),c.setMa
xListeners=o.setMaxListeners.bind(o),c.listeners=o.listeners.bind(o),c.emit=o.em
it.bind(o),c},n.MD5=n.toPromise(e("./deps/md5"))}).call(this,e("/Users/nolan/wor
kspace/pouchdb/node_modules/browserify/node_modules/insert-module-globals/node_m
odules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof wi
ndow?window:{})},{"./deps/ajax":8,"./deps/blob":9,"./deps/buffer":26,"./deps/col
lections":10,"./deps/errors":11,"./deps/md5":12,"./deps/uuid":14,"./merge":18,"/
Users/nolan/workspace/pouchdb/node_modules/browserify/node_modules/insert-module
-globals/node_modules/process/browser.js":28,argsarray:25,bluebird:33,events:27,
inherits:29,"pouchdb-extend":48}],24:[function(e,t){t.exports="3.0.6"},{}],25:[f
unction(e,t){"use strict";function n(e){return function(){var t=arguments.length
;if(t){for(var n=[],r=-1;++r<t;)n[r]=arguments[r];return e.call(this,n)}return e
.call(this,[])}}t.exports=n},{}],26:[function(){},{}],27:[function(e,t){function
n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0
}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e
}function i(e){return"object"==typeof e&&null!==e}function s(e){return void 0===
e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListen
ers=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!
o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._
maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,a,u,c;if(this._event
s||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!
this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw T
ypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))retur
n!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(thi
s,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;defaul
t:for(o=arguments.length,a=new Array(o-1),u=1;o>u;u++)a[u-1]=arguments[u];n.appl
y(this,a)}else if(i(n)){for(o=arguments.length,a=new Array(o-1),u=1;o>u;u++)a[u1]=arguments[u];for(c=n.slice(),o=c.length,u=0;o>u;u++)c[u].apply(this,a)}return
!0},n.prototype.addListener=function(e,t){var o;if(!r(t))throw TypeError("listen
er must be a function");if(this._events||(this._events={}),this._events.newListe
ner&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(thi
s._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._
events[e]=t,i(this._events[e])&&!this._events[e].warned){var o;o=s(this._maxList
eners)?n.defaultMaxListeners:this._maxListeners,o&&o>0&&this._events[e].length>o
&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitte
r memory leak detected. %d listeners added. Use emitter.setMaxListeners() to inc
rease limit.",this._events[e].length),"function"==typeof console.trace&&console.
trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=fu
nction(e,t){function n(){this.removeListener(e,n),o||(o=!0,t.apply(this,argument
s))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.li
stener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,s,a
;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this
._events[e])return this;if(n=this._events[e],s=n.length,o=-1,n===t||r(n.listener
)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit(
"removeListener",e,t);else if(i(n)){for(a=s;a-->0;)if(n[a]===t||n[a].listener&&n
[a].listener===t){o=a;break}if(0>o)return this;1===n.length?(n.length=0,delete t
his._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeList
ener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!t
his._events)return this;if(!this._events.removeListener)return 0===arguments.len
gth?this._events={}:this._events[e]&&delete this._events[e],this;if(0===argument
s.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t)
;return this.removeAllListeners("removeListener"),this._events={},this}if(n=this
._events[e],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListene
r(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=fun
ction(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._
events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;retur
n n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],28:[fu
nction(e,t){var n=t.exports={};n.nextTick=function(){var e="undefined"!=typeof w
indow&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&win
get("_local/lastSeq")["catch"](function(e){if(404!==e.status)throw e}).then(func
tion(e){return r.seq=e?e.seq:0,u||(t._cachedViews=t._cachedViews||{},t._cachedVi
ews[c]=r,r.db.on("destroyed",function(){delete t._cachedViews[c]})),r})})})})}},
{"./upsert":55,"./utils":56}],50:[function(_dereq_,module,exports){"use strict";
module.exports=function(func,emit,sum,log,isArray,toJSON){return eval("'use stri
ct'; ("+func.replace(/;\s*$/,"")+");")}},{}],51:[function(e,t,n){(function(t){"u
se strict";function r(e){return-1===e.indexOf("/")?[e,e]:e.split("/")}function o
(e,t,n){try{return{output:t.apply(null,n)}}catch(r){return e.emit("error",r),{er
ror:r}}}function i(e,t){var n=S(e.key,t.key);return 0!==n?n:S(e.value,t.value)}f
unction s(e,t,n){return n=n||0,"number"==typeof t?e.slice(n,t+n):n>0?e.slice(n):
e}function a(e){var t=new Error("builtin "+e+" function requires map values to b
e numbers or number arrays");return t.name="invalid_value",t.status=500,t}functi
on u(e){for(var t=0,n=0,r=e.length;r>n;n++){var o=e[n];if("number"!=typeof o){if
(!Array.isArray(o))throw a("_sum");t="number"==typeof t?[t]:t;for(var i=0,s=o.le
ngth;s>i;i++){var u=o[i];if("number"!=typeof u)throw a("_sum");"undefined"==type
of t[i]?t.push(u):t[i]+=u}}else"number"==typeof t?t+=o:t[0]+=o}return t}function
c(e,t,n,r){var o=t[e];"undefined"!=typeof o&&(r&&(o=encodeURIComponent(JSON.str
ingify(o))),n.push(e+"="+o))}function l(e,t){var n=e.descending?"endkey":"startk
ey",r=e.descending?"startkey":"endkey";if("undefined"!=typeof e[n]&&"undefined"!
=typeof e[r]&&S(e[n],e[r])>0)throw new y("No rows can match your key range, reve
rse your start_key and end_key or set {descending : true}");if(t.reduce&&e.reduc
e!==!1){if(e.include_docs)throw new y("{include_docs:true} is invalid for reduce
");if(e.keys&&e.keys.length>1&&!e.group&&!e.group_level)throw new y("Multi-key f
etches for reduce views must use {group: true}")}if(e.group_level){if("number"!=
typeof e.group_level)throw new y('Invalid value for integer: "'+e.group_level+'"
');if(e.group_level<0)throw new y('Invalid value for positive integer: "'+e.grou
p_level+'"')}}function d(e,t,n){var o,i=[],s="GET";if(c("reduce",n,i),c("include
_docs",n,i),c("limit",n,i),c("descending",n,i),c("group",n,i),c("group_level",n,
i),c("skip",n,i),c("stale",n,i),c("startkey",n,i,!0),c("endkey",n,i,!0),c("inclu
sive_end",n,i),c("key",n,i,!0),i=i.join("&"),i=""===i?"":"?"+i,"undefined"!=type
of n.keys){var a=2e3,u="keys="+encodeURIComponent(JSON.stringify(n.keys));u.leng
th+i.length+1<=a?i+=("?"===i[0]?"&":"?")+u:(s="POST","string"==typeof t?o=JSON.s
tringify({keys:n.keys}):t.keys=n.keys)}if("string"==typeof t){var l=r(t);return
e.request({method:s,url:"_design/"+l[0]+"/_view/"+l[1]+i,body:o})}return o=o||{}
,Object.keys(t).forEach(function(e){o[e]=Array.isArray(t[e])?t[e]:t[e].toString(
)}),e.request({method:"POST",url:"_temp_view"+i,body:o})}function f(e){return fu
nction(t){if(404===t.status)return e;throw t}}function p(e,t,n){var r="_local/do
c_"+e;return t.db.get(r)["catch"](f({_id:r,keys:[]})).then(function(r){return L.
resolve().then(function(){return r.keys.length?t.db.allDocs({keys:r.keys,include
_docs:!0}):{rows:[]}}).then(function(t){var o=t.rows.map(function(e){return e.do
c}).filter(function(e){return e}),i=n[e],s={};o.forEach(function(e){if(s[e._id]=
!0,e._deleted=!i[e._id],!e._deleted){var t=i[e._id];"value"in t&&(e.value=t.valu
e)}});var a=Object.keys(i);return a.forEach(function(e){if(!s[e]){var t={_id:e},
n=i[e];"value"in n&&(t.value=n.value),o.push(t)}}),r.keys=A.uniq(a.concat(r.keys
)),o.splice(0,0,r),o})})}function h(e,t,n){var r="_local/lastSeq";return e.db.ge
t(r)["catch"](f({_id:r,seq:0})).then(function(r){var o=Object.keys(t);return L.a
ll(o.map(function(n){return p(n,e,t)})).then(function(t){var o=[];return t.forEa
ch(function(e){o=o.concat(e)}),r.seq=n,o.push(r),e.db.bulkDocs({docs:o})})})}fun
ction v(e,t,n){0===n.group_level&&delete n.group_level;var r,i=n.group||n.group_
level;r=D[e.reduceFun]?D[e.reduceFun]:T(e.reduceFun.toString(),null,u,b,Array.is
Array,JSON.parse);var a=[],c=n.group_level;t.forEach(function(e){var t=a[a.lengt
h-1],n=i?e.key:null;return i&&Array.isArray(n)&&"number"==typeof c&&(n=n.length>
c?n.slice(0,c):n),t&&0===S(t.key[0][0],n)?(t.key.push([n,e.id]),void t.value.pus
h(e.value)):void a.push({key:[[n,e.id]],value:[e.value]})});for(var l=0,d=a.leng
th;d>l;l++){var f=a[l],p=o(e.sourceDB,r,[f.key,f.value,!1]);f.value=p.error?null
:p.output,f.key=f.key[0][0]}return{rows:s(a,n.limit,n.skip)}}function m(e){retur
n e.request({method:"POST",url:"_view_cleanup"})}function _(e,n,o){if("http"===e
.type())return d(e,n,o);if("string"!=typeof n){l(o,n);var i={db:e,viewName:"temp
_view/temp_view",map:n.map,reduce:n.reduce,temporary:!0};return R.add(function()
{return q(i).then(function(e){function t(){return e.db.destroy()}return A.fin(C(
s,e("/Users/nolan/workspace/pouchdb/node_modules/browserify/node_modules/insertmodule-globals/node_modules/process/browser.js"))},{"./create-view":49,"./evalfu
nc":50,"./taskqueue":54,"./utils":56,"/Users/nolan/workspace/pouchdb/node_module
s/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"
:28,"pouchdb-collate":52}],52:[function(e,t,n){"use strict";function r(e){if(nul
l!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return l(e);case"
string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");cas
e"object":var t=Array.isArray(e),r=t?e:Object.keys(e),o=-1,i=r.length,s="";if(t)
for(;++o<i;)s+=n.toIndexableString(r[o]);else for(;++o<i;){var a=r[o];s+=n.toInd
exableString(a)+n.toIndexableString(e[a])}return s}return""}function o(e,t){var
n,r=t,o="1"===e[t];if(o)n=0,t++;else{var i="0"===e[t];t++;var s="",a=e.substring
(t,t+f),u=parseInt(a,10)+d;for(i&&(u=-u),t+=f;;){var c=e[t];if("\x00"===c)break;
s+=c,t++}s=s.split("."),n=1===s.length?parseInt(s,10):parseFloat(s[0]+"."+s[1]),
i&&(n-=10),0!==u&&(n=parseFloat(n+"e"+u))}return{num:n,length:t-r}}function i(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 o=r.element,i=r.index;if(Array.isArray(o))o.push(n);else if(i===e
.length-2){var s=e.pop();o[s]=n}else e.push(n)}}function s(e,t){for(var r=Math.m
in(e.length,t.length),o=0;r>o;o++){var i=n.collate(e[o],t[o]);if(0!==i)return i}
return e.length===t.length?0:e.length>t.length?1:-1}function a(e,t){return e===t
?0:e>t?1:-1}function u(e,t){for(var r=Object.keys(e),o=Object.keys(t),i=Math.min
(r.length,o.length),s=0;i>s;s++){var a=n.collate(r[s],o[s]);if(0!==a)return a;if
(a=n.collate(e[r[s]],t[o[s]]),0!==a)return a}return r.length===o.length?0:r.leng
th>o.length?1:-1}function c(e){var t=["boolean","number","string","object"],n=t.
indexOf(typeof e);return~n?null===e?1:Array.isArray(e)?5:3>n?n+2:n+3:Array.isArr
ay(e)?5:void 0}function l(e){if(0===e)return"1";var t=e.toExponential().split(/e
\+?/),n=parseInt(t[1],10),r=0>e,o=r?"0":"2",i=(r?-n:n)-d,s=h.padLeft(i.toString(
),"0",f);o+=p+s;var a=Math.abs(parseFloat(t[0]));r&&(a=10-a);var u=a.toFixed(20)
;return u=u.replace(/\.?0+$/,""),o+=p+u}var d=-324,f=3,p="",h=e("./utils");n.col
late=function(e,t){if(e===t)return 0;e=n.normalizeKey(e),t=n.normalizeKey(t);var
r=c(e),o=c(t);if(r-o!==0)return r-o;if(null===e)return 0;switch(typeof e){case"
number":return e-t;case"boolean":return e===t?0:t>e?-1:1;case"string":return a(e
,t)}return Array.isArray(e)?s(e,t):u(e,t)},n.normalizeKey=function(e){switch(typ
eof e){case"undefined":return null;case"number":return 1/0===e||e===-1/0||isNaN(
e)?null:e;case"object":var t=e;if(Array.isArray(e)){var r=e.length;e=new Array(r
);for(var o=0;r>o;o++)e[o]=n.normalizeKey(t[o])}else{if(e instanceof Date)return
e.toJSON();if(null!==e){e={};for(var i in t)if(t.hasOwnProperty(i)){var s=t[i];
"undefined"!=typeof s&&(e[i]=n.normalizeKey(s))}}}}return e},n.toIndexableString
=function(e){var t="\x00";return e=n.normalizeKey(e),c(e)+p+r(e)+t},n.parseIndex
ableString=function(e){for(var t=[],n=[],r=0;;){var s=e[r++];if("\x00"!==s)switc
h(s){case"1":t.push(null);break;case"2":t.push("1"===e[r]),r++;break;case"3":var
a=o(e,r);t.push(a.num),r+=a.length;break;case"4":for(var u="";;){var c=e[r];if(
"\x00"===c)break;u+=c,r++}u=u.replace(/\u0001\u0001/g,"\x00").replace(/\u0001\u0
002/g,"").replace(/\u0002\u0002/g,""),t.push(u);break;case"5":var l={element:[],in
dex:t.length};t.push(l.element),n.push(l);break;case"6":var d={element:{},index:
t.length};t.push(d.element),n.push(d);break;default:throw new Error("bad collati
onIndex or unexpectedly reached end of input: "+s)}else{if(1===t.length)return t
.pop();i(t,n)}}}},{"./utils":53}],53:[function(e,t,n){"use strict";function r(e,
t,n){for(var r="",o=n-e.length;r.length<o;)r+=t;return r}n.padLeft=function(e,t,
n){var o=r(e,t,n);return o+e},n.padRight=function(e,t,n){var o=r(e,t,n);return e
+o},n.stringLexCompare=function(e,t){var n,r=e.length,o=t.length;for(n=0;r>n;n++
){if(n===o)return 1;var i=e.charAt(n),s=t.charAt(n);if(i!==s)return s>i?-1:1}ret
urn o>r?-1:0},n.intToDecimalForm=function(e){var t=0>e,n="";do{var r=t?-Math.cei
l(e%10):Math.floor(e%10);n=r+n,e=t?Math.ceil(e/10):Math.floor(e/10)}while(e);ret
urn t&&"0"!==n&&(n="-"+n),n}},{}],54:[function(e,t){"use strict";function n(){th
is.promise=new r(function(e){e()})}var r=e("./utils").Promise;n.prototype.add=fu
nction(e){return this.promise=this.promise["catch"](function(){}).then(function(
){return e()}),this.promise},n.prototype.finish=function(){return this.promise},
t.exports=n},{"./utils":56}],55:[function(e,t){"use strict";function n(e,t,n){re
turn new o(function(o,i){return t&&"object"==typeof t&&(t=t._id),"string"!=typeo
f t?i(new Error("doc id is required")):void e.get(t,function(s,a){if(s)return 40
,0,0,0,0,0],t=0;n>t;t+=1)r[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(r[t>>2]|=128<<(t%
4<<3),t>55)for(s(l,r),t=0;16>t;t+=1)r[t]=0;return o=8*c,o=o.toString(16).match(/
(.*?)(.{0,8})$/),i=parseInt(o[2],16),u=parseInt(o[1],16)||0,r[14]=i,r[15]=u,s(l,
r),l},l=function(e){var t,n,r,o,i,a,c=e.length,l=[1732584193,-271733879,-1732584
194,271733878];for(t=64;c>=t;t+=64)s(l,u(e.subarray(t-64,t)));for(e=c>t-64?e.sub
array(t-64):new Uint8Array(0),n=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0
;n>t;t+=1)r[t>>2]|=e[t]<<(t%4<<3);if(r[t>>2]|=128<<(t%4<<3),t>55)for(s(l,r),t=0;
16>t;t+=1)r[t]=0;return o=8*c,o=o.toString(16).match(/(.*?)(.{0,8})$/),i=parseIn
t(o[2],16),a=parseInt(o[1],16)||0,r[14]=i,r[15]=a,s(l,r),l},d=["0","1","2","3","
4","5","6","7","8","9","a","b","c","d","e","f"],f=function(e){var t,n="";for(t=0
;4>t;t+=1)n+=d[e>>8*t+4&15]+d[e>>8*t&15];return n},p=function(e){var t;for(t=0;t
<e.length;t+=1)e[t]=f(e[t]);return e.join("")},h=function(e){return p(c(e))},v=f
unction(){this.reset()};return"5d41402abc4b2a76b9719d911017c592"!==h("hello")&&(
e=function(e,t){var n=(65535&e)+(65535&t),r=(e>>16)+(t>>16)+(n>>16);return r<<16
|65535&n}),v.prototype.append=function(e){return/[\u0080-\uFFFF]/.test(e)&&(e=un
escape(encodeURIComponent(e))),this.appendBinary(e),this},v.prototype.appendBina
ry=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;fo
r(t=64;n>=t;t+=64)s(this._state,a(this._buff.substring(t-64,t)));return this._bu
ff=this._buff.substr(t-64),this},v.prototype.end=function(e){var t,n,r=this._buf
f,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;o>t;t+=1)i[t>>2]|=r.cha
rCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=e?this._state:p(this._state),thi
s.reset(),n},v.prototype._finish=function(e,t){var n,r,o,i=t;if(e[i>>2]|=128<<(i
%4<<3),i>55)for(s(this._state,e),i=0;16>i;i+=1)e[i]=0;n=8*this._length,n=n.toStr
ing(16).match(/(.*?)(.{0,8})$/),r=parseInt(n[2],16),o=parseInt(n[1],16)||0,e[14]
=r,e[15]=o,s(this._state,e)},v.prototype.reset=function(){return this._buff="",t
his._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},v.
prototype.destroy=function(){delete this._state,delete this._buff,delete this._l
ength},v.hash=function(e,t){/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComp
onent(e)));var n=c(e);return t?n:p(n)},v.hashBinary=function(e,t){var n=c(e);ret
urn t?n:p(n)},v.ArrayBuffer=function(){this.reset()},v.ArrayBuffer.prototype.app
end=function(e){var t,n=this._concatArrayBuffer(this._buff,e),r=n.length;for(thi
s._length+=e.byteLength,t=64;r>=t;t+=64)s(this._state,u(n.subarray(t-64,t)));ret
urn this._buff=r>t-64?n.subarray(t-64):new Uint8Array(0),this},v.ArrayBuffer.pro
totype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0];for(t=0;o>t;t+=1)i[t>>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=e
?this._state:p(this._state),this.reset(),n},v.ArrayBuffer.prototype._finish=v.pr
ototype._finish,v.ArrayBuffer.prototype.reset=function(){return this._buff=new U
int8Array(0),this._length=0,this._state=[1732584193,-271733879,-1732584194,27173
3878],this},v.ArrayBuffer.prototype.destroy=v.prototype.destroy,v.ArrayBuffer.pr
ototype._concatArrayBuffer=function(e,t){var n=e.length,r=new Uint8Array(n+t.byt
eLength);return r.set(e),r.set(new Uint8Array(t),n),r},v.ArrayBuffer.hash=functi
on(e,t){var n=l(new Uint8Array(e));return t?n:p(n)},v})},{}],58:[function(e,t,n)
{"use strict";function r(e,t,n){var r=n[n.length-1];e===r.element&&(n.pop(),r=n[
n.length-1]);var o=r.element,i=r.index;if(Array.isArray(o))o.push(e);else if(i==
=t.length-2){var s=t.pop();o[s]=e}else t.push(e)}n.stringify=function(e){var t=[
];t.push({obj:e});for(var n,r,o,i,s,a,u,c,l,d,f,p="";n=t.pop();)if(r=n.obj,o=n.p
refix||"",i=n.val||"",p+=o,i)p+=i;else if("object"!=typeof r)p+="undefined"==typ
eof r?null:JSON.stringify(r);else if(null===r)p+="null";else if(Array.isArray(r)
){for(t.push({val:"]"}),s=r.length-1;s>=0;s--)a=0===s?"":",",t.push({obj:r[s],pr
efix:a});t.push({val:"["})}else{u=[];for(c in r)r.hasOwnProperty(c)&&u.push(c);
for(t.push({val:"}"}),s=u.length-1;s>=0;s--)l=u[s],d=r[l],f=s>0?",":"",f+=JSON.s
tringify(l)+":",t.push({obj:d,prefix:f});t.push({val:"{"})}return p},n.parse=fun
ction(e){for(var t,n,o,i,s,a,u,c,l,d=[],f=[],p=0;;)if(t=e[p++],"}"!==t&&"]"!==t&
&"undefined"!=typeof t)switch(t){case" ":case" ":case"\n":case":":case",":break
;case"n":p+=3,r(null,d,f);break;case"t":p+=3,r(!0,d,f);break;case"f":p+=4,r(!1,d
,f);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8
":case"9":case"-":for(n="",p--;;){if(o=e[p++],!/[\d\.\-e\+]/.test(o)){p--;break}
n+=o}r(parseFloat(n),d,f);break;case'"':for(i="",s=void 0,a=0;;){if(u=e[p++],'"'
===u&&("\\"!==s||a%2!==1))break;i+=u,s=u,"\\"===s?a++:a=0}r(JSON.parse('"'+i+'"'
),d,f);break;case"[":c={element:[],index:d.length},d.push(c.element),f.push(c);b
reak;case"{":l={element:{},index:d.length},d.push(l.element),f.push(l);break;def
ault:throw new Error("unexpectedly reached end of input: "+t)}else{if(1===d.leng
th)return d.pop();r(d.pop(),d,f)}}},{}]},{},[17])(17)});