text: angular.module("dndLists",[]).directive("dndDraggable",["$parse","$timeout","dndDropEffectWorkaround","dndDragTypeWorkaround",function(d,b,c,a){return function(g,f,e){f.attr("draggable","true");f.on("dragstart",function(h){h.dataTransfer.setData("Text",angular.toJson(g.$eval(e.dndDraggable)));h.dataTransfer.effectAllowed=e.dndEffectAllowed||"move";f.addClass("dndDragging");b(function(){f.addClass("dndDraggingSource")},0);c.dropEffect="none";a.isDragging=true;h.stopPropagation()});f.on("dragend",function(h){var i=h.dataTransfer.dropEffect!=="none"?h.dataTransfer.dropEffect:c.dropEffect;g.$apply(function(){switch(i){case"move":d(e.dndMoved)(g);break;case"copy":d(e.dndCopied)(g);break}});f.removeClass("dndDragging");f.removeClass("dndDraggingSource");a.isDragging=false;h.stopPropagation()});f.on("click",function(h){g.$apply(function(){d(e.dndSelected)(g)});h.stopPropagation()});f.on("selectstart",function(){this.dragDrop();return false})}}]).directive("dndList",["$timeout","dndDropEffectWorkaround","dndDragTypeWorkaround",function(b,c,a){return function(g,f,d){var i=angular.element("<li class='dndPlaceholder'></li>");var j=i[0];var h=f[0];f.on("dragover",function(k){if(!a.isDragging){return true}if(!e(k.dataTransfer.types)){return true}if(j.parentNode!=h){f.append(i)}if(k.target.parentNode===h&&k.target!==j){var l=(k.offsetY||k.layerY)<k.target.offsetHeight/2;h.insertBefore(j,l?k.target:k.target.nextSibling)}else{if(k.target===h){if(k.offsetY<j.offsetTop){while(j.previousElementSibling&&(j.previousElementSibling.offsetHeight===0||k.offsetY<j.previousElementSibling.offsetTop+j.previousElementSibling.offsetHeight/2)){h.insertBefore(j,j.previousElementSibling)}}else{while(j.nextElementSibling&&k.offsetY>j.nextElementSibling.offsetTop+j.nextElementSibling.offsetHeight/2){h.insertBefore(j,j.nextElementSibling.nextElementSibling)}}}}f.addClass("dndDragover");k.preventDefault();k.stopPropagation();return false});f.on("drop",function(l){var n=JSON.parse(l.dataTransfer.getData("Text")||l.dataTransfer.getData("text/plain"));var m=g.$eval(d.dndList);var k=Array.prototype.indexOf.call(h.children,j);g.$apply(function(){m.splice(k,0,n)});if(l.dataTransfer.dropEffect==="none"){c.dropEffect=l.dataTransfer.effectAllowed==="copyMove"?(l.ctrlKey?"copy":"move"):l.dataTransfer.effectAllowed}i.remove();f.removeClass("dndDragover");l.preventDefault();l.stopPropagation();return false});f.on("dragleave",function(k){f.removeClass("dndDragover");b(function(){if(!f.hasClass("dndDragover")){i.remove()}},100)});function e(l){if(!l){return true}for(var k=0;k<l.length;k++){if(l[k]==="Text"||l[k]==="text/plain"){return true}}return false}}}]).factory("dndDragTypeWorkaround",function(){return{}}).factory("dndDropEffectWorkaround",function(){return{}});