define(["jquery","underscore","backbone"],function(e,t,n){var r;r={deferred:{},initialize:function(){var e,t,n,r,i=this;this.pending(),r=this.deferred,n=function(e,t){var n;return n=i[e],i[e]=function(){return i.defer(e,n,t,arguments)}};for(e in r)t=r[e],n(e,t)},pending:function(t){return t==null&&(t=!1),this._deferred!=null&&this.state()==="pending"&&!t?this:((this._deferred=e.Deferred()).once={},this)},defer:function(e,n,r,i){r==null&&(r=!0);if(t.isString(e)){t.isFunction(n)||(r=n,n=this[e]);if(r&&this.state()==="pending"){if(this._deferred.once[e])return this;this._deferred.once[e]=!0}}else n=e;return this._deferred.done(function(){return n.apply(this,i)}),this},resolve:function(e){return e==null&&(e=this),this._deferred&&this._deferred.resolveWith(e),this},reject:function(e){return e==null&&(e=this),this._deferred.rejectWith(e),this},promise:function(){var e;return(e=this._deferred).promise.apply(e,arguments)},when:function(t){return e.when(this).done(t),this},state:function(){var e;return(e=this._deferred)!=null?e.state():void 0}},r.resolveWith=r.resolve,r.rejectWith=r.reject,t.extend(n.View.prototype,r),t.extend(n.Model.prototype,r),t.extend(n.Collection.prototype,r),t.extend(n.Router.prototype,r)})