mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
12 lines
141 KiB
JavaScript
12 lines
141 KiB
JavaScript
|
|
// PouchDB 5.4.5
|
|||
|
|
//
|
|||
|
|
// (c) 2012-2016 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&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.PouchDB=e()}}(function(){var e;return function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};e[a][0].call(f.exports,function(t){var n=e[a][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(e){return"function"==typeof e}function i(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,i,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(n=this._events[e],s(n))return!1;if(o(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),n.apply(this,i)}else if(a(n))for(i=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,u=0;r>u;u++)c[u].apply(this,i);return!0},r.prototype.addListener=function(e,t){var n;if(!o(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,o(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,i,s;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,r=-1,n===t||o(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],o(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?o(this._events[e])?[this._e
|
|||
|
|
error:i}}return null}function vt(e,t,n,r){return"DataError"===n.name&&0===n.code?r(null,{total_rows:e._meta.docCount,offset:t.skip,rows:[]}):void r(x($r,n.name,n.message))}function yt(e,t,n,r){function o(e,r){function o(t,n,r){var o=t.id+"::"+r;k.get(o).onsuccess=function(r){n.doc=st(r.target.result),e.conflicts&&(n.doc._conflicts=K(t)),ct(n.doc,e,g)}}function i(t,n,r){var i={id:r.id,key:r.id,value:{rev:n}},a=r.deleted;if("ok"===e.deleted)S.push(i),a?(i.value.deleted=!0,i.doc=null):e.include_docs&&o(r,i,n);else if(!a&&d--<=0&&(S.push(i),e.include_docs&&o(r,i,n),0===--h))return;t["continue"]()}function a(e){q=t._meta.docCount;var n=e.target.result;if(n){var r=at(n.value),o=r.winningRev;i(n,o,r)}}function s(){r(null,{total_rows:q,offset:e.skip,rows:S})}function u(){e.attachments?ft(S,e.binary).then(s):s()}var c="startkey"in e?e.startkey:!1,f="endkey"in e?e.endkey:!1,l="key"in e?e.key:!1,d=e.skip||0,h="number"==typeof e.limit?e.limit:-1,p=e.inclusive_end!==!1,v="descending"in e&&e.descending?"prev":null,y=pt(c,f,p,l,v);if(y&&y.error)return vt(t,e,y.error,r);var _=[_o,mo];e.attachments&&_.push(go);var m=dt(n,_,"readonly");if(m.error)return r(m.error);var g=m.txn,b=g.objectStore(_o),w=g.objectStore(mo),E=v?b.openCursor(y,v):b.openCursor(y),k=w.index("_doc_id_rev"),S=[],q=0;g.oncomplete=u,E.onsuccess=a}function i(e,n){return 0===e.limit?n(null,{total_rows:t._meta.docCount,offset:e.skip,rows:[]}):void o(e,n)}i(e,r)}function _t(e){return new Lr(function(t){var n=je([""]);e.objectStore(ko).put(n,"key"),e.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},e.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})["catch"](function(){return!1})}function mt(e,t){var n=this;So.queue.push({action:function(t){gt(n,e,t)},callback:t}),rt(n.constructor)}function gt(e,t,r){function o(e){var t=e.createObjectStore(_o,{keyPath:"id"});e.createObjectStore(mo,{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),e.createObjectStore(go,{keyPath:"digest"}),e.createObjectStore(wo,{keyPath:"id",autoIncrement:!1}),e.createObjectStore(ko),t.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),e.createObjectStore(Eo,{keyPath:"_id"});var n=e.createObjectStore(bo,{autoIncrement:!0});n.createIndex("seq","seq"),n.createIndex("digestSeq","digestSeq",{unique:!0})}function i(e,t){var n=e.objectStore(_o);n.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),n.openCursor().onsuccess=function(e){var r=e.target.result;if(r){var o=r.value,i=oe(o);o.deletedOrLocal=i?"1":"0",n.put(o),r["continue"]()}else t()}}function a(e){e.createObjectStore(Eo,{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function s(e,t){var n=e.objectStore(Eo),r=e.objectStore(_o),o=e.objectStore(mo),i=r.openCursor();i.onsuccess=function(e){var i=e.target.result;if(i){var a=i.value,s=a.id,u=ie(s),c=F(a);if(u){var f=s+"::"+c,l=s+"::",d=s+"::~",h=o.index("_doc_id_rev"),p=IDBKeyRange.bound(l,d,!1,!1),v=h.openCursor(p);v.onsuccess=function(e){if(v=e.target.result){var t=v.value;t._doc_id_rev===f&&n.put(t),o["delete"](v.primaryKey),v["continue"]()}else r["delete"](i.primaryKey),i["continue"]()}}else i["continue"]()}else t&&t()}}function u(e){var t=e.createObjectStore(bo,{autoIncrement:!0});t.createIndex("seq","seq"),t.createIndex("digestSeq","digestSeq",{unique:!0})}function f(e,t){var n=e.objectStore(mo),r=e.objectStore(go),o=e.objectStore(bo),i=r.count();i.onsuccess=function(e){var r=e.target.result;return r?void(n.openCursor().onsuccess=function(e){var n=e.target.result;if(!n)return t();for(var r=n.value,i=n.primaryKey,a=Object.keys(r._attachments||{}),s={},u=0;u<a.length;u++){var c=r._attachments[a[u]];s[c.digest]=!0}var f=Object.keys(s);for(u=0;u<f.length;u++){var l=f[u];o.put({seq:i,digestSeq:l+"::"+i})}n["continue"]()}):t()}}function d(e){function t(e){return e.data?at(e):(e.deleted="1"===e.deletedOrLocal,e)}var n=e.objectStore(mo),r=e.objectStore(_o),o=r.openCursor();o.onsuccess=function(e){function o(){var e=s.id+"::",t=s.id+"::",r=n.
|
|||
|
|
type:n.getResponseHeader("Content-Type")}):n.responseText,t(null,r,i)}else{var a={};if(o)a=new Error("ETIMEDOUT"),a.code="ETIMEDOUT";else try{a=JSON.parse(n.response)}catch(s){}a.status=n.status,t(a)}}},e.body&&e.body instanceof Blob?Pe(e.body,function(e){n.send(e)}):n.send(e.body),{abort:i}}function Zt(){try{return new XMLHttpRequest,!0}catch(e){return!1}}function en(e,t){return Wo||e.xhr?Yt(e,t):$t(e,t)}function tn(){return""}function nn(e,t){function n(t,n,r){if(!e.binary&&e.json&&"string"==typeof t)try{t=JSON.parse(t)}catch(o){return r(o)}Array.isArray(t)&&(t=t.map(function(e){return e.error||e.missing?A(e):e})),e.binary&&Jo(t,n),r(null,t,n)}e=c(e);var r={method:"GET",headers:{},json:!0,processData:!0,timeout:1e4,cache:!1};return e=br.extend(r,e),e.json&&(e.binary||(e.headers.Accept="application/json"),e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json"),e.binary&&(e.encoding=null,e.json=!1),e.processData||(e.json=!1),en(e,function(r,o,i){if(r)return t(A(r));var a,s=o.headers&&o.headers["content-type"],u=i||tn();if(!e.binary&&(e.json||!e.processData)&&"object"!=typeof u&&(/json/.test(s)||/^[\s]*\{/.test(u)&&/\}[\s]*$/.test(u)))try{u=JSON.parse(u.toString())}catch(c){}o.statusCode>=200&&o.statusCode<300?n(u,o,t):(a=A(u),a.status=o.statusCode,t(a))})}function rn(e,t){var n=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",r=-1!==n.indexOf("safari")&&-1===n.indexOf("chrome"),o=-1!==n.indexOf("msie"),i=-1!==n.indexOf("edge"),a=r||(o||i)&&"GET"===e.method,s="cache"in e?e.cache:!0,u=/^blob:/.test(e.url);if(!u&&(a||!s)){var c=-1!==e.url.indexOf("?");e.url+=(c?"&":"?")+"_nonce="+Date.now()}return nn(e,t)}function on(e){var t=e.doc&&e.doc._attachments;t&&Object.keys(t).forEach(function(e){var n=t[e];n.data=Ie(n.data,n.content_type)})}function an(e){return/^_design/.test(e)?"_design/"+encodeURIComponent(e.slice(8)):/^_local/.test(e)?"_local/"+encodeURIComponent(e.slice(7)):encodeURIComponent(e)}function sn(e){return e._attachments&&Object.keys(e._attachments)?Lr.all(Object.keys(e._attachments).map(function(t){var n=e._attachments[t];return n.data&&"string"!=typeof n.data?new Lr(function(e){Be(n.data,e)}).then(function(e){n.data=e}):void 0})):Lr.resolve()}function un(e){var t=R(e);(t.user||t.password)&&(t.auth={username:t.user,password:t.password});var n=t.path.replace(/(^\/|\/$)/g,"").split("/");return t.db=n.pop(),-1===t.db.indexOf("%")&&(t.db=encodeURIComponent(t.db)),t.path=n.join("/"),t}function cn(e,t){return fn(e,e.db+"/"+t)}function fn(e,t){var n=e.path?"/":"";return e.protocol+"://"+e.host+(e.port?":"+e.port:"")+"/"+e.path+n+t}function ln(e){return"?"+Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")}function dn(e,t){function n(e,t,n){var r=e.ajax||{},o=br.extend(c(p),r,t);return $o(o.method+" "+o.url),s._ajax(o,n)}function r(e,t){return new Lr(function(r,o){n(e,t,function(e,t){return e?o(e):void r(t)})})}function o(e,t){return d(e,qr(function(e){i().then(function(){return t.apply(this,e)})["catch"](function(t){var n=e.pop();n(t)})}))}function i(){if(e.skipSetup||e.skip_setup)return Lr.resolve();if(g)return g;var t={method:"GET",url:l};return g=r({},t)["catch"](function(e){return e&&e.status&&404===e.status?(S(404,"PouchDB is just detecting if the remote exists."),r({},{method:"PUT",url:l})):Lr.reject(e)})["catch"](function(e){return e&&e.status&&412===e.status?!0:Lr.reject(e)}),g["catch"](function(){g=null}),g}function a(e){return e.split("/").map(encodeURIComponent).join("/")}var s=this,u=un;e.getHost&&(u=e.getHost);var f=u(e.name,e),l=cn(f,"");e=c(e);var p=e.ajax||{};if(s.getUrl=function(){return l},s.getHeaders=function(){return p.headers||{}},e.auth||f.auth){var v=e.auth||f.auth,_=v.username+":"+v.password,m=ho(unescape(encodeURIComponent(_)));p.headers=p.headers||{},p.headers.Authorization="Basic "+m}s._ajax=rn;var g;setTimeout(function(){t(null,s)}),s.type=function(){return"http"},s.id=o("id",function(e){n({},{method:"GET",url:fn(f,"")},function(t,n){var r=n&&n.uuid?n.uuid+f.db:cn(f,"");e(null,r)})}),s.request=o("request",function(e,t){e.url=c
|
|||
|
|
var y={};n.live&&(this.push.on("complete",h.pull.cancel.bind(h.pull)),this.pull.on("complete",h.push.cancel.bind(h.push))),this.on("newListener",function(e){"change"===e?(h.pull.on("change",o),h.push.on("change",i)):"denied"===e?(h.pull.on("denied",s),h.push.on("denied",a)):"active"===e?(h.pull.on("active",l),h.push.on("active",f)):"paused"===e&&(h.pull.on("paused",c),h.push.on("paused",u))}),this.on("removeListener",function(e){"change"===e?(h.pull.removeListener("change",o),h.push.removeListener("change",i)):"denied"===e?(h.pull.removeListener("denied",s),h.push.removeListener("denied",a)):"active"===e?(h.pull.removeListener("active",l),h.push.removeListener("active",f)):"paused"===e&&(h.pull.removeListener("paused",c),h.push.removeListener("paused",u))}),this.pull.on("removeListener",d("pull")),this.push.on("removeListener",d("push"));var _=Lr.all([this.push,this.pull]).then(function(e){var t={push:e[0],pull:e[1]};return h.emit("complete",t),r&&r(null,t),h.removeAllListeners(),t},function(e){if(h.cancel(),r?r(e):h.emit("error",e),h.removeAllListeners(),r)throw e});this.then=function(e,t){return _.then(e,t)},this["catch"]=function(e){return _["catch"](e)}}function mr(e){e.replicate=vr,e.sync=yr}var gr,br=e(10),wr=o(e(5)),Er=o(e(9)),kr=o(e(11)),Sr=e(15),qr=o(e(4)),xr=e(1),Ar=o(e(16)),Tr=o(e(17)),Or=o(e(18)),jr=o(e(7)),Cr=e(13),Lr="function"==typeof Promise?Promise:kr,Ir=Function.prototype.toString,Dr=Ir.call(Object),Rr=wr("pouchdb:api"),Nr=6;if(_())gr=!1;else try{localStorage.setItem("_pouch_check_localstorage",1),gr=!!localStorage.getItem("_pouch_check_localstorage")}catch(Br){gr=!1}Er(b,xr.EventEmitter),b.prototype.addListener=function(e,t,n,r){function o(){function e(){a=!1}if(i._listeners[t]){if(a)return void(a="waiting");a=!0;var s=h(r,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary"]);n.changes(s).on("change",function(e){e.seq>r.since&&!r.cancelled&&(r.since=e.seq,r.onChange(e))}).on("complete",function(){"waiting"===a&&setTimeout(function(){o()},0),a=!1}).on("error",e)}}if(!this._listeners[t]){var i=this,a=!1;this._listeners[t]=o,this.on(e,o)}},b.prototype.removeListener=function(e,t){t in this._listeners&&xr.EventEmitter.prototype.removeListener.call(this,e,this._listeners[t])},b.prototype.notifyLocalWindows=function(e){_()?chrome.storage.local.set({dbName:e}):m()&&(localStorage[e]="a"===localStorage[e]?"b":"a")},b.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)},Er(q,Error),q.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var Pr=(new q({status:401,error:"unauthorized",reason:"Name or password is incorrect."}),new q({status:400,error:"bad_request",reason:"Missing JSON list of 'docs'"})),Mr=new q({status:404,error:"not_found",reason:"missing"}),Fr=new q({status:409,error:"conflict",reason:"Document update conflict"}),Ur=new q({status:400,error:"bad_request",reason:"_id field must contain a string"}),Hr=new q({status:412,error:"missing_id",reason:"_id is required for puts"}),zr=new q({status:400,error:"bad_request",reason:"Only reserved document ids may start with underscore."}),Kr=new q({status:412,error:"precondition_failed",reason:"Database not open"}),Wr=new q({status:500,error:"unknown_error",reason:"Database encountered an unknown error"}),Jr=new q({status:500,error:"badarg",reason:"Some query argument is invalid"}),Xr=(new q({status:400,error:"invalid_request",reason:"Request was invalid"}),new q({status:400,error:"query_parse_error",reason:"Some query parameter is invalid"})),Gr=new q({status:500,error:"doc_validation",reason:"Bad special document member"}),Vr=new q({status:400,error:"bad_request",reason:"Something wrong with the request"}),Qr=new q({status:400,error:"bad_request",reason:"Document must be a JSON object"}),$r=(new q({status:404,error:"not_found",reason:"Database not found"}),new q({status:500,error:"indexed_db_went_bad",reason:"unknown"})),Yr=new q({status:500,error:"web_sql_went_bad",reason:"unknown"}),Zr=(new q({status:500,erro
|
|||
|
|
var n=c(s,t);if("error"===n.status)return v.reject(e,n.value);var r=n.value;if(r)u(e,r);else{e.state=_,e.outcome=t;for(var o=-1,i=e.queue.length;++o<i;)e.queue[o].callFulfilled(t)}return e},v.reject=function(e,t){e.state=y,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},o.resolve=f,o.reject=l,o.all=d,o.race=h},{8:8}],12:[function(e,t,n){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function o(e){return e>=f?Math.round(e/f)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function i(e){return a(e,f,"day")||a(e,c,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var s=1e3,u=60*s,c=60*u,f=24*c,l=365.25*f;t.exports=function(e,t){return t=t||{},"string"==typeof e?r(e):t["long"]?i(e):o(e)}},{}],13:[function(e,t,n){"use strict";function r(e){if(null!==e)switch(typeof e){case"boolean":return e?1:0;case"number":return f(e);case"string":return e.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var t=Array.isArray(e),r=t?e:Object.keys(e),o=-1,i=r.length,a="";if(t)for(;++o<i;)a+=n.toIndexableString(r[o]);else for(;++o<i;){var s=r[o];a+=n.toIndexableString(s)+n.toIndexableString(e[s])}return a}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 a="",s=e.substring(t,t+d),u=parseInt(s,10)+l;for(i&&(u=-u),t+=d;;){var c=e[t];if("\x00"===c)break;a+=c,t++}a=a.split("."),n=1===a.length?parseInt(a,10):parseFloat(a[0]+"."+a[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 a=e.pop();o[a]=n}else e.push(n)}}function a(e,t){for(var r=Math.min(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 s(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),a=0;i>a;a++){var s=n.collate(r[a],o[a]);if(0!==s)return s;if(s=n.collate(e[r[a]],t[o[a]]),0!==s)return s}return r.length===o.length?0:r.length>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.isArray(e)?5:void 0}function f(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)-l,a=p.padLeft(i.toString(),"0",d);o+=h+a;var s=Math.abs(parseFloat(t[0]));r&&(s=10-s);var u=s.toFixed(20);return u=u.replace(/\.?0+$/,""),o+=h+u}var l=-324,d=3,h="",p=e(14);n.collate=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 s(e,t)}return Array.isArray(e)?a(e,t):u(e,t)},n.normalizeKey=function(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 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 a=t[i];"undefined"!=typeof a&&(e[i]=n.normalizeKey(a))}}}}return e},n.toIndexableString=function(e){var t="\x00";return e=n
|