!function(){function n(){}function t(n){return n}function e(n){return!!n}function r(n){return!n}function u(n){return function(){if(null===n)throw new Error("Callback was already called.");n.apply(this,arguments),n=null}}function i(n){return function(){null!==n&&(n.apply(this,arguments),n=null)}}function o(n){return U(n)||"number"==typeof n.length&&n.length>=0&&n.length%1===0}function c(n,t){return o(n)?a(n,t):p(n,t)}function a(n,t){for(var e=-1,r=n.length;++er?r:null}):(e=B(n),t=e.length,function(){return r++,t>r?e[r]:null})}function y(n,t){return t=null==t?n.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),u=0;e>u;u++)r[u]=arguments[u+t];switch(t){case 0:return n.call(this,r);case 1:return n.call(this,arguments[0],r)}}}function v(n){return function(t,e,r){return n(t,r)}}function d(t){return function(e,r,o){o=i(o||n),e=e||[];var c=m(e);if(0>=t)return o(null);var a=!1,f=0,l=!1;!function s(){if(a&&0>=f)return o(null);for(;t>f&&!l;){var n=c();if(null===n)return a=!0,void(0>=f&&o(null));f+=1,r(e[n],n,u(function(n){f-=1,n?(o(n),l=!0):s()}))}}()}}function g(n){return function(t,e,r){return n(P.eachOf,t,e,r)}}function k(n){return function(t,e,r,u){return n(d(e),t,r,u)}}function b(n){return function(t,e,r){return n(P.eachOfSeries,t,e,r)}}function w(t,e,r,u){u=i(u||n);var o=[];t(e,function(n,t,e){r(n,function(n,r){o[t]=r,e(n)})},function(n){u(n,o)})}function O(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(e){e&&u.push({index:t,value:n}),r()})},function(){r(f(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})}function S(n,t,e,r){O(n,t,function(n,t){e(n,function(n){t(!n)})},r)}function E(n,t,e){return function(r,u,i,o){function c(){o&&o(e(!1,void 0))}function a(n,r,u){return o?void i(n,function(r){o&&t(r)&&(o(e(!0,n)),o=i=!1),u()}):u()}arguments.length>3?n(r,u,a,c):(o=i,i=u,n(r,a,c))}}function x(n,t){return t}function L(t,e,r){r=r||n;var u=o(e)?[]:{};t(e,function(n,t,e){n(y(function(n,r){r.length<=1&&(r=r[0]),u[t]=r,e(n)}))},function(n){r(n,u)})}function j(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(n,t){u=u.concat(t||[]),r(n)})},function(n){r(n,u)})}function I(t,e,r){function i(t,e,r,u){if(null!=u&&"function"!=typeof u)throw new Error("task callback must be a function");return t.started=!0,U(e)||(e=[e]),0===e.length&&t.idle()?P.setImmediate(function(){t.drain()}):(a(e,function(e){var i={data:e,callback:u||n};r?t.tasks.unshift(i):t.tasks.push(i),t.tasks.length===t.concurrency&&t.saturated()}),void P.setImmediate(t.process))}function o(n,t){return function(){c-=1;var e=arguments;a(t,function(n){n.callback.apply(n,e)}),n.tasks.length+c===0&&n.drain(),n.process()}}if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var c=0,l={tasks:[],concurrency:e,payload:r,saturated:n,empty:n,drain:n,started:!1,paused:!1,push:function(n,t){i(l,n,!1,t)},kill:function(){l.drain=n,l.tasks=[]},unshift:function(n,t){i(l,n,!0,t)},process:function(){if(!l.paused&&c=t;t++)P.setImmediate(l.process)}}};return l}function T(n){return y(function(t,e){t.apply(null,e.concat([y(function(t,e){"object"==typeof console&&(t?console.error&&console.error(t):console[n]&&a(e,function(t){console[n](t)}))})]))})}function A(n){return function(t,e,r){n(l(t),e,r)}}function z(n){return y(function(t,e){var r=y(function(e){var r=this,u=e.pop();return n(t,function(n,t,u){n.apply(r,e.concat([u]))},u)});return e.length?r.apply(this,e):r})}function q(n){return y(function(t){var e=t.pop();t.push(function(){var n=arguments;r?P.setImmediate(function(){e.apply(null,n)}):e.apply(null,n)});var r=!0;n.apply(this,t),r=!1})}var C,P={},H="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this;null!=H&&(C=H.async),P.noConflict=function(){return H.async=C,P};var M=Object.prototype.toString,U=Array.isArray||function(n){return"[object Array]"===M.call(n)},W=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},B=Object.keys||function(n){var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t},D="function"==typeof setImmediate&&setImmediate,F=D?function(n){D(n)}:function(n){setTimeout(n,0)};"object"==typeof process&&"function"==typeof process.nextTick?P.nextTick=process.nextTick:P.nextTick=F,P.setImmediate=D?F:P.nextTick,P.forEach=P.each=function(n,t,e){return P.eachOf(n,v(t),e)},P.forEachSeries=P.eachSeries=function(n,t,e){return P.eachOfSeries(n,v(t),e)},P.forEachLimit=P.eachLimit=function(n,t,e,r){return d(t)(n,v(e),r)},P.forEachOf=P.eachOf=function(t,e,r){function a(n){n?r(n):(l+=1,l>=f&&r(null))}r=i(r||n),t=t||[];var f=o(t)?t.length:B(t).length,l=0;return f?void c(t,function(n,r){e(t[r],r,u(a))}):r(null)},P.forEachOfSeries=P.eachOfSeries=function(t,e,r){function o(){var n=!0;return null===a?r(null):(e(t[a],a,u(function(t){if(t)r(t);else{if(a=c(),null===a)return r(null);n?P.nextTick(o):o()}})),void(n=!1))}r=i(r||n),t=t||[];var c=m(t),a=c();o()},P.forEachOfLimit=P.eachOfLimit=function(n,t,e,r){d(t)(n,e,r)},P.map=g(w),P.mapSeries=b(w),P.mapLimit=k(w),P.inject=P.foldl=P.reduce=function(n,t,e,r){P.eachOfSeries(n,function(n,r,u){e(t,n,function(n,e){t=e,u(n)})},function(n){r(n||null,t)})},P.foldr=P.reduceRight=function(n,e,r,u){var i=f(n,t).reverse();P.reduce(i,e,r,u)},P.select=P.filter=g(O),P.selectLimit=P.filterLimit=k(O),P.selectSeries=P.filterSeries=b(O),P.reject=g(S),P.rejectLimit=k(S),P.rejectSeries=b(S),P.any=P.some=E(P.eachOf,e,t),P.someLimit=E(P.eachOfLimit,e,t),P.all=P.every=E(P.eachOf,r,r),P.everyLimit=E(P.eachOfLimit,r,r),P.detect=E(P.eachOf,t,x),P.detectSeries=E(P.eachOfSeries,t,x),P.detectLimit=E(P.eachOfLimit,t,x),P.sortBy=function(n,t,e){function r(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0}P.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){return n?e(n):void e(null,f(t.sort(r),function(n){return n.value}))})},P.auto=function(t,e){function r(n){m.unshift(n)}function u(n){var t=h(m,n);t>=0&&m.splice(t,1)}function o(){f--,a(m.slice(0),function(n){n()})}e=i(e||n);var c=B(t),f=c.length;if(!f)return e(null);var l={},m=[];r(function(){f||e(null,l)}),a(c,function(n){function i(){return s(v,function(n,t){return n&&l.hasOwnProperty(t)},!0)&&!l.hasOwnProperty(n)}function c(){i()&&(u(c),f[f.length-1](m,l))}for(var a,f=U(t[n])?t[n]:[t[n]],m=y(function(t,r){if(r.length<=1&&(r=r[0]),t){var u={};p(l,function(n,t){u[t]=n}),u[n]=r,e(t,u)}else l[n]=r,P.setImmediate(o)}),v=f.slice(0,f.length-1),d=v.length;d--;){if(!(a=t[v[d]]))throw new Error("Has inexistant dependency");if(U(a)&&h(a,n)>=0)throw new Error("Has cyclic dependencies")}i()?f[f.length-1](m,l):r(c)})},P.retry=function(n,t,e){function r(n,t){if("number"==typeof t)n.times=parseInt(t,10)||i;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);n.times=parseInt(t.times,10)||i,n.interval=parseInt(t.interval,10)||o}}function u(n,t){function e(n,e){return function(r){n(function(n,t){r(!n||e,{err:n,result:t})},t)}}function r(n){return function(t){setTimeout(function(){t(null)},n)}}for(;a.times;){var u=!(a.times-=1);c.push(e(a.task,u)),!u&&a.interval>0&&c.push(r(a.interval))}P.series(c,function(t,e){e=e[e.length-1],(n||a.callback)(e.err,e.result)})}var i=5,o=0,c=[],a={times:i,interval:o},f=arguments.length;if(1>f||f>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=f&&"function"==typeof n&&(e=t,t=n),"function"!=typeof n&&r(a,n),a.callback=e,a.task=t,a.callback?u():u},P.waterfall=function(t,e){function r(n){return y(function(t,u){if(t)e.apply(null,[t].concat(u));else{var i=n.next();i?u.push(r(i)):u.push(e),q(n).apply(null,u)}})}if(e=i(e||n),!U(t)){var u=new Error("First argument to waterfall must be an array of functions");return e(u)}return t.length?void r(P.iterator(t))():e()},P.parallel=function(n,t){L(P.eachOf,n,t)},P.parallelLimit=function(n,t,e){L(d(t),n,e)},P.series=function(n,t){L(P.eachOfSeries,n,t)},P.iterator=function(n){function t(e){function r(){return n.length&&n[e].apply(null,arguments),r.next()}return r.next=function(){return er;){var i=r+(u-r+1>>>1);e(t,n[i])>=0?r=i:u=i-1}return r}function i(t,e,i,o){if(null!=o&&"function"!=typeof o)throw new Error("task callback must be a function");return t.started=!0,U(e)||(e=[e]),0===e.length?P.setImmediate(function(){t.drain()}):void a(e,function(e){var c={data:e,priority:i,callback:"function"==typeof o?o:n};t.tasks.splice(u(t.tasks,c,r)+1,0,c),t.tasks.length===t.concurrency&&t.saturated(),P.setImmediate(t.process)})}var o=P.queue(t,e);return o.push=function(n,t,e){i(o,n,t,e)},delete o.unshift,o},P.cargo=function(n,t){return I(n,1,t)},P.log=T("log"),P.dir=T("dir"),P.memoize=function(n,e){var r={},u={};e=e||t;var i=y(function(t){var i=t.pop(),o=e.apply(null,t);o in r?P.nextTick(function(){i.apply(null,r[o])}):o in u?u[o].push(i):(u[o]=[i],n.apply(null,t.concat([y(function(n){r[o]=n;var t=u[o];delete u[o];for(var e=0,i=t.length;i>e;e++)t[e].apply(null,n)})])))});return i.memo=r,i.unmemoized=n,i},P.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},P.times=A(P.map),P.timesSeries=A(P.mapSeries),P.timesLimit=function(n,t,e,r){return P.mapLimit(l(n),t,e,r)},P.seq=function(){var t=arguments;return y(function(e){var r=this,u=e[e.length-1];"function"==typeof u?e.pop():u=n,P.reduce(t,e,function(n,t,e){t.apply(r,n.concat([y(function(n,t){e(n,t)})]))},function(n,t){u.apply(r,[n].concat(t))})})},P.compose=function(){return P.seq.apply(null,Array.prototype.reverse.call(arguments))},P.applyEach=z(P.eachOf),P.applyEachSeries=z(P.eachOfSeries),P.forever=function(t,e){function r(n){return n?i(n):void o(r)}var i=u(e||n),o=q(t);r()},P.ensureAsync=q,P.constant=y(function(n){var t=[null].concat(n);return function(n){return n.apply(this,t)}}),P.wrapSync=P.asyncify=function(n){return y(function(t){var e,r=t.pop();try{e=n.apply(this,t)}catch(u){return r(u)}W(e)&&"function"==typeof e.then?e.then(function(n){r(null,n)})["catch"](function(n){r(n.message?n:new Error(n))}):r(null,e)})},"object"==typeof module&&module.exports?module.exports=P:"function"==typeof define&&define.amd?define([],function(){return P}):H.async=P}(); //# sourceMappingURL=async.min.map