(function(){var flagsCache={};function createFlags(flags){var object=flagsCache[flags]={},i,length;flags=flags.split(/\s+/);for(i=0,length=flags.length;i<length;i++){object[flags[i]]=!0}

return object}

jQuery.extend({_mark:function(elem,type){if(elem){type=(type||"fx")+"mark";jQuery.data(elem,type,(jQuery.data(elem,type,undefined,!0)||0)+1,!0)}},_unmark:function(force,elem,type){if(force!==!0){type=elem;elem=force;force=!1}

if(elem){type=type||"fx";var key=type+"mark",count=force?0:((jQuery.data(elem,key,undefined,!0)||1)-1);if(count){jQuery.data(elem,key,count,!0)}else{jQuery.removeData(elem,key,!0);handleQueueMarkDefer(elem,type,"mark")}}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type,undefined,!0);if(data){if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data),!0)}else{q.push(data)}}

return q||[]}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),fn=queue.shift(),defer;if(fn==="inprogress"){fn=queue.shift()}

if(fn){if(type==="fx"){queue.unshift("inprogress")}

fn.call(elem,function(){jQuery.dequeue(elem,type)})}

if(!queue.length){jQuery.removeData(elem,type+"queue",!0);handleQueueMarkDefer(elem,type,"queue")}}});jQuery.fn.extend({queue:function(type,data){if(typeof type!=="string"){data=type;type="fx"}

if(data===undefined){return jQuery.queue(this[0],type)}

return this.each(function(){var queue=jQuery.queue(this,type,data);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type)}})},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)})},delay:function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(){var elem=this;setTimeout(function(){jQuery.dequeue(elem,type)},time)})},clearQueue:function(type){return this.queue(type||"fx",[])},promise:function(type,object){if(typeof type!=="string"){object=type;type=undefined}

type=type||"fx";var defer=jQuery.Deferred(),elements=this,i=elements.length,count=1,deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark",tmp;function resolve(){if(!(--count)){defer.resolveWith(elements,[elements])}}

while(i--){if((tmp=jQuery.data(elements[i],deferDataKey,undefined,!0)||(jQuery.data(elements[i],queueDataKey,undefined,!0)||jQuery.data(elements[i],markDataKey,undefined,!0))&&jQuery.data(elements[i],deferDataKey,jQuery._Deferred(),!0))){count++;tmp.done(resolve)}}

resolve();return defer.promise()}});function handleQueueMarkDefer(elem,type,src){var deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark",defer=jQuery._data(elem,deferDataKey);if(defer&&(src==="queue"||!jQuery._data(elem,queueDataKey))&&(src==="mark"||!jQuery._data(elem,markDataKey))){setTimeout(function(){if(!jQuery._data(elem,queueDataKey)&&!jQuery._data(elem,markDataKey)){jQuery.removeData(elem,deferDataKey,!0);defer.fire()}},0)}}

jQuery.Callbacks=function(flags){flags=flags?(createFlags(flags)):{};var list=[],stack=[],memory,firing,firingStart,firingLength,firingIndex,add=function(args){var i,length,elem,type,actual;for(i=0,length=args.length;i<length;i++){elem=args[i];type=jQuery.type(elem);if(type==="array"){add(elem)}else if(type==="function"){if(!flags.unique||!self.has(elem)){list.push(elem)}}}},fire=function(context,args){args=args||[];memory=!flags.memory||[context,args];firing=!0;firingIndex=firingStart||0;firingStart=0;firingLength=list.length;for(;list&&firingIndex<firingLength;firingIndex++){if(list[firingIndex].apply(context,args)===!1&&flags.stopOnFalse){memory=!0;break}}

firing=!1;if(list){if(!flags.once){if(stack&&stack.length){memory=stack.shift();self.fireWith(memory[0],memory[1])}}else if(memory===!0){self.disable()}else{list=[]}}},self={add:function(){if(list){var length=list.length;add(arguments);if(firing){firingLength=list.length}else if(memory&&memory!==!0){firingStart=length;fire(memory[0],memory[1])}}

return this},remove:function(){if(list){var args=arguments,argIndex=0,argLength=args.length;for(;argIndex<argLength;argIndex++){for(var i=0;i<list.length;i++){if(args[argIndex]===list[i]){if(firing){if(i<=firingLength){firingLength--;if(i<=firingIndex){firingIndex--}}}

list.splice(i--,1);if(flags.unique){break}}}}}

return this},has:function(fn){if(list){var i=0,length=list.length;for(;i<length;i++){if(fn===list[i]){return!0}}}

return!1},empty:function(){list=[];return this},disable:function(){list=stack=memory=undefined;return this},disabled:function(){return!list},lock:function(){stack=undefined;if(!memory||memory===!0){self.disable()}

return this},locked:function(){return!stack},fireWith:function(context,args){if(stack){if(firing){if(!flags.once){stack.push([context,args])}}else if(!(flags.once&&memory)){fire(context,args)}}

return this},fire:function(){self.fireWith(this,arguments);return this},fired:function(){return!!memory}};return self};jQuery.fn.extend({promise:function(type,object){if(typeof type!=="string"){object=type;type=undefined}

type=type||"fx";var defer=jQuery.Deferred(),elements=this,i=elements.length,count=1,deferDataKey=type+"defer",queueDataKey=type+"queue",markDataKey=type+"mark",tmp;function resolve(){if(!(--count)){defer.resolveWith(elements,[elements])}}

while(i--){if((tmp=jQuery.data(elements[i],deferDataKey,undefined,!0)||(jQuery.data(elements[i],queueDataKey,undefined,!0)||jQuery.data(elements[i],markDataKey,undefined,!0))&&jQuery.data(elements[i],deferDataKey,jQuery.Callbacks("once memory"),!0))){count++;tmp.add(resolve)}}

resolve();return defer.promise()}})})()