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