this.Flow||function(h){function e(a,b,c){this._={missable:0,reason:"",waits:a,state:f,name:"",pass:0,miss:0,args:[],tag:c||"",fn:b};c&&(d[c]=this);g(this)}function g(a){a=a._;var b;a.state===f&&(a.state=a.miss>a.missable?"fail":a.pass+a.miss>=a.waits?"done":a.state);a.state!==f&&a.fn&&(b=a.fn.pass||"function"===typeof a.fn?a.fn:a.fn[a.name||Object.keys(a.fn)[0]],"done"===a.state?b.pass?b.pass(a.args):b(null,a.args):b.miss?b.miss(a.args):b(Error(a.reason),a.args),a.fn=null,a.args=[],a.tag&&(d[a.tag]=
null))}e.name="Flow";e.dump=function(a){var b=[],c;for(c in d)null==d[c]?delete d[c]:b.push(JSON.stringify(d[c]._,"",4));a&&(d={});return b+""};e.prototype={constructor:e,missable:function(a){this._.missable+=a;return this},extend:function(a){this._.waits+=a;return this},pass:function(a,b){++this._.pass;void 0!==a&&(this._.args.push(a),b&&(this._.args[b]=a));g(this);return this},miss:function(a,b,c){++this._.miss;void 0!==a&&(this._.args.push(a),b&&(this._.args[b]=a),this._.reason=c||"fail");g(this);
return this},fork:function(a){this._.name=a||"";return this},exit:function(a){this._.state===f&&(this._.state="exit",this._.reason=a||"exit");g(this)}};var f="progress",d={};"undefined"!==typeof module&&(module.exports={Flow:e});h.Flow=e}(this.self||global);
