!function(){var moduleFactory=function($){var module=this;$.require().script("mvc/dom.range","mvc/controller","mvc/event.livehack").done(function(){var exports=function(){var event=$.event;event.selection={delay:300,preventDefault:event.supportTouch},event.setupHelper(["selectionStart","selectionEnd","selectionEnding","selectionMoving","selectionMove"],"mousedown",function(ev){var moveTimer,delegate=ev.delegateTarget||ev.currentTarget,selector=ev.handleObj.selector,ready=!1,el=this,startRange=$.Range(ev),getRange=function(ev){var range=$.Range(ev),pos=startRange.compare("START_TO_START",range);
return-1==pos||0==pos?startRange.clone().move("END_TO_END",range):range.clone().move("END_TO_END",startRange)},cleanUp=function(){$(delegate).unbind("mousemove",mousemove).unbind("mouseup",mouseup),clearTimeout(moveTimer),startRange=null},mouseup=function(moveev){if(!ready)return cleanUp(),void 0;$.each(event.find(delegate,["selectionMoving"],selector),function(){this.call(el,moveev,range)});var range=getRange(moveev);cleanUp(),$.each(event.find(delegate,["selectionEnd"],selector),function(){this.call(el,ev,range)
})},mousemove=function(moveev){if(moveev.clientX!=ev.clientX||moveev.clientY!=ev.clientY){if(!ready)return cleanUp();$.each(event.find(delegate,["selectionMoving"],selector),function(){this.call(el,moveev,range)});var range=getRange(moveev);$.each(event.find(delegate,["selectionMove"],selector),function(){this.call(el,moveev,range)})}},start=function(){ready=!0;var startEv=event.selection.preventDefault?$.Event("selectionStart"):ev,startEv=$.extend(ev,startEv);$.each(event.find(delegate,["selectionStart"],selector),function(){this.call(el,startEv,startRange)
}),event.selection.preventDefault&&startEv.isDefaultPrevented()&&(ready=!1,cleanUp())};event.selection.preventDefault?(ev.preventDefault(),moveTimer=setTimeout(start,event.selection.delay)):start(),$(delegate).bind("mousemove",mousemove).bind("mouseup",mouseup)})};exports(),module.resolveWith(exports)})};dispatch("mvc/event.selection").containing(moduleFactory).to("Foundry/2.1 Modules")}();