//>>built
define("dojox/lang/async",["dojo","dijit","dojox"],function(k,q,n){k.provide("dojox.lang.async");(function(){var d=k.Deferred,g=k.forEach,m=k.some,j=n.lang.async,o=Array.prototype.slice,l=Object.prototype.toString;j.seq=function(a){var c="[object Array]"==l.call(a)?a:arguments;return function(a){var b=new d;g(c,function(a){b.addCallback(a)});b.callback(a);return b}};j.par=function(a){var c="[object Array]"==l.call(a)?a:arguments;return function(a){var b=Array(c.length),e=function(){g(b,function(a){a instanceof
d&&0>a.fired&&a.cancel()})},f=new d(e),h=c.length;g(c,function(p,h){var f;try{f=p(a)}catch(c){f=c}b[h]=f});m(b,function(a){return a instanceof Error?(e(),f.errback(a),!0):!1})||g(b,function(a,c){a instanceof d?a.addCallbacks(function(a){b[c]=a;--h||f.callback(b)},function(a){e();f.errback(a)}):--h});h||f.callback(b);return f}};j.any=function(a){var c="[object Array]"==l.call(a)?a:arguments;return function(i){var b=Array(c.length),e=!0;cancel=function(a){g(b,function(b,c){c!=a&&b instanceof d&&0>b.fired&&
b.cancel()})};a=new d(cancel);g(c,function(a,c){var e;try{e=a(i)}catch(d){e=d}b[c]=e});m(b,function(b,c){return!(b instanceof d)?(cancel(c),a.callback(b),!0):!1})||g(b,function(b,c){b.addBoth(function(b){e&&(e=!1,cancel(c),a.callback(b))})});return a}};j.select=function(a,c){var i="[object Array]"==l.call(c)?c:o.call(arguments,1);return function(b){return(new d).addCallback(a).addCallback(function(a){return"number"==typeof a&&0<=a&&a<i.length?i[a](b):Error("async.select: out of range")}).callback(b)}};
j.ifThen=function(a,c,i){return function(b){return(new d).addCallback(a).addCallback(function(a){return(a?c:i)(b)}).callback(b)}};j.loop=function(a,c){return function(i){function b(a){g.errback(a)}function e(a){a?h.addCallback(c).addCallback(f):g.callback(a);return a}function f(c){h=(new d).addCallback(a).addCallback(e).addErrback(b);h.callback(c)}var h,g=new d(function(){h.cancel()});f(i);return g}}})()});