(function(n,t,i,r){ /** * @license AngularJS-DND v0.1.13 * (c) 2014-2015 Alexander Afonin (toafonin@gmail.com, http://github.com/Tuch) * License: MIT */ function o(){}function d(){return!1}function ut(){return!0}function a(n,t){return function(){t.apply(n,arguments)}}function tt(n){return n*(Math.PI/180)}function it(n){return n*(180/Math.PI)}function p(n,t,i){return ti?i:t}function ft(n){var i=n.data("events");return i!==t?i:(i=f.data(n,"events"),i!==t)?i:(i=f._data(n,"events"),i!==t)?i:(i=f._data(n[0],"events"),i!==t)?i:t}function g(n,t,i,r){arguments.length===3&&typeof i!="boolean"&&(r=i,i=!1);var u;return function(){var f=arguments;r=r||this;i&&!u&&n.apply(r,f);clearTimeout(u);u=setTimeout(function(){i||n.apply(r,f);u=null},t)}}function nt(n,t,i){var r,u;return function(){r||(u=arguments,i=i||this,n.apply(i,u),r=setTimeout(function(){r=null},t))}}function s(n,t){isNaN(t)&&(t=0);var i=Math.pow(10,t);return Math.round(n*i)/i}var e;"use strict";var f=n.element,et=f(i),h=f(r),c,w,y,v={mode:!1,helpers:{}},b=n.forEach,l=n.extend;(function(){i.console=i.console||{log:o,info:o,warn:o,error:o}})(),function(){var n=navigator.userAgent;/webkit\//i.test(n)?(c="-webkit-transform",w="-webkit-transform-origin",y="webkitMatchesSelector"):/gecko\//i.test(n)?(c="-moz-transform",w="-moz-transform-origin",y="mozMatchesSelector"):/trident\//i.test(n)?(c="-ms-transform",w="ms-transform-origin",y="msMatchesSelector"):/presto\//i.test(n)?(c="-o-transform",w="-o-transform-origin",y="oMatchesSelector"):(c="transform",w="transform-origin",y="matches")}();var u=function(){function n(n,t){typeof n=="object"&&(t=n.y||n.top,n=n.x||n.left);this.x=n||0;this.y=t||0}return n.prototype={equal:function(t){return t instanceof n||(t=new n(t)),this.x===t.x&&this.y===t.y},plus:function(t){return t instanceof n||(t=new n(t)),new n(this.x+t.x,this.y+t.y)},minus:function(t){return t instanceof n||(t=new n(t)),new n(this.x-t.x,this.y-t.y)},scale:function(t){return new n(this.x*t,this.y*t)},magnitude:function(){return this.distance(new n(0,0),this)},distance:function(t){return t instanceof n||(t=new n(t)),Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},angle:function(n,t){var i=Math.atan2(n.y-this.y,n.x-this.x);return t===!0&&(i*=180/Math.PI),i},deltaAngle:function(n,i,r){i=i===t?{x:0,y:0}:i;var u=this.angle(i)-n.angle(i);return u<0&&(u=Math.PI*2+u),r===!0&&(u*=180/Math.PI),u},transform:function(n){return n.transformPoint(this)},deltaTransform:function(n){return n.deltaTransformPoint(this)},rotate:function(n,t){var i=(new k).rotate(n,t);return this.transform(i)},getAsCss:function(){return{top:this.y,left:this.x}}},function(t,i){return new n(t,i)}}(),k=function(){function n(n,i,r,u,f,e){this.a=n!==t?n:1;this.b=i||0;this.c=r||0;this.d=u!==t?u:1;this.tx=f||0;this.ty=e||0}n.prototype={concat:function(t){return new n(this.a*t.a+this.c*t.b,this.b*t.a+this.d*t.b,this.a*t.c+this.c*t.d,this.b*t.c+this.d*t.d,this.a*t.tx+this.c*t.ty+this.tx,this.b*t.tx+this.d*t.ty+this.ty)},inverse:function(){var t=this.a*this.d-this.b*this.c;return new n(this.d/t,-this.b/t,-this.c/t,this.a/t,(this.c*this.ty-this.d*this.tx)/t,(this.b*this.tx-this.a*this.ty)/t)},rotate:function(t,i){var r=new n(Math.cos(t),Math.sin(t),-Math.sin(t),Math.cos(t));return i&&(r=this.translate(i.x,i.y).concat(r).translate(-i.x,-i.y)),this.concat(r)},scale:function(t,i,r){i=i||t;var u=new n(t,0,0,i);return r&&(u=u.translate(r.x,r.y).translate(-r.x,-r.y)),u},translate:function(t,i){var r=new n(1,0,0,1,t,i);return this.concat(r)},transformPoint:function(n){return new u(this.a*n.x+this.c*n.y+this.tx,this.b*n.x+this.d*n.y+this.ty)},deltaTransformPoint:function(n){return new u(this.a*n.x+this.c*n.y,this.b*n.x+this.d*n.y)},toStyle:function(){var n=s(this.a,3),t=s(this.b,3),i=s(this.c,3),r=s(this.d,3),u=s(this.tx,3),f=s(this.ty,3);return"matrix("+n+", "+t+", "+i+", "+r+", "+u+", "+f+")"}};var i=function(t,i,r,u,f,e){return new n(t,i,r,u,f,e)};return i.IDENTITY=new n,i.HORIZONTAL_FLIP=new n(-1,0,0,1),i.VERTICAL_FLIP=new n(1,0,0,-1),i}(),rt=function(){function n(n,t,i,r){this.tl=n;this.tr=t;this.bl=i;this.br=r}n.prototype={applyMatrix:function(i,r){var e,o,s,h,u=new k(1,0,0,1,r.x,r.y),f=new k(1,0,0,1,-r.x,-r.y);return r!==t?(e=this.tl.transform(f).transform(i).transform(u),o=this.tr.transform(f).transform(i).transform(u),s=this.bl.transform(f).transform(i).transform(u),h=this.br.transform(f).transform(i).transform(u)):(e=this.tl.transform(i),o=this.tr.transform(i),s=this.bl.transform(i),h=this.br.transform(i)),new n(e,o,s,h)},width:function(){var n=this.tl.x-this.tr.x,t=this.tl.y-this.tr.y;return Math.sqrt(n*n+t*t)},height:function(){var n=this.tl.x-this.bl.x,t=this.tl.y-this.bl.y;return Math.sqrt(n*n+t*t)},client:function(){var n=Math.min(this.tl.y,this.tr.y,this.bl.y,this.br.y),t=Math.min(this.tl.x,this.tr.x,this.bl.x,this.br.x),i=Math.max(this.tl.y,this.tr.y,this.bl.y,this.br.y)-n,r=Math.max(this.tl.x,this.tr.x,this.bl.x,this.br.x)-t;return{top:s(n,1),left:s(t,1),height:s(i,1),width:s(r,1),bottom:s(n+i,1),right:s(t+r,1)}},getAngle:function(){var n=this.tl.y-this.tr.y,t=this.tl.x-this.tr.x;return Math.tan(t/n)*180/Math.PI}};var i=function(t,i,r,f){var e=arguments;return typeof e[0]=="object"&&(i=e[0].top,t=e[0].left,r=e[0].width,f=e[0].height),new n(new u(t,i),new u(t+r,i),new u(t,i+f),new u(t+r,i+f))};return i.fromPoints=function(t,i,r,u){return new n(t,i,r,u)},i}();l(f.prototype,{dndDisableSelection:function(){this.on("dragstart selectstart",d).dndCss({"-moz-user-select":"none","-khtml-user-select":"none","-webkit-user-select":"none","-o-user-select":"none","-ms-user-select":"none","user-select":"none"})},dndEnableSelection:function(){this.off("dragstart selectstart",d).dndCss({"-moz-user-select":"auto","-khtml-user-select":"auto","-webkit-user-select":"auto","-o-user-select":"auto","-ms-user-select":"auto","user-select":"auto"})},dndClientRect:function(){if(this[0]){var n=this[0]===i?{top:0,bottom:0,left:0,right:0,width:0,height:0}:this[0].getBoundingClientRect();return{bottom:n.bottom,height:n.height,left:n.left,right:n.right,top:n.top,width:n.width}}},dndStyleRect:function(){var n=this.dndCss(["width","height","top","left"]),t=parseFloat(n.width),i=parseFloat(n.height),r=n.top==="auto"?0:parseFloat(n.top),u=n.left==="auto"?0:parseFloat(n.left);return{top:r,right:u+t,bottom:r+i,left:u,width:t,height:i}},dndGetParentScrollArea:function(){var t=[],l=this.dndClosest(),u,e,o,s,h,c,n,a=r.documentElement;return b(l,function(i){n=f(i).dndCss(["padding-top","padding-right","padding-bottom","padding-left"]);u=i.scrollWidth;e=i.clientWidth;o=i.scrollHeight;s=i.clientHeight;c=parseFloat(n["padding-top"])+parseFloat(n["padding-bottom"]);h=parseFloat(n["padding-left"])+parseFloat(n["padding-right"]);(u-h!==e||o-c!==s)&&t.push(i)}),t.push(i),f(t)},dndGetFirstNotStaticParent:function(){var n,t,i=this.dndClosest();return b(i,function(i){return t=f(i).dndCss("position"),t==="absolute"||t==="relative"||t==="fixed"?(n=i,!1):void 0}),n||(n=r.documentElement),f(n)},dndClosest:function(n){n=n||"*";for(var t=this[0],i=[];t;)t[y](n)&&i.push(t),t=t.parentElement;return f(i)},dndGetAngle:function(n){var i=this.dndCss(c);if(i==="none"||i==="")return 0;var r=i.split("(")[1].split(")")[0].split(","),u=r[0],f=r[1],t=Math.atan2(f,u);return t=t<0?t+=Math.PI*2:t,n?Math.round(t*180/Math.PI):t},dndCloneByStyles:function(){for(var r,u=[],t=0,f=this.length;t-1&&this.get().splice(t,1)},has:function(n){return this.get().indexOf(n)>-1},add:function(n){if(!this.has(n)){this.get().push(n);var t=this;f(n).on("$destroy",function(){t.remove(n)})}}},t}(),l=function(){function e(n,t){this.el=n;this.$el=f(n);this.listeners={dragstart:[],drag:[],dragend:[],dragenter:[],dragover:[],dragleave:[],drop:[]};this.regions=new c(t);this.layer=function(){return t};this.setCurrentManipulator(null)}var h=["dragstart","drag","dragend","dragenter","dragover","dragleave","drop"],n=["dragstart","drag","dragend"],t=["dragenter","dragover","dragleave","drop"],u;return n.has=t.has=function(n){return this.indexOf(n)>-1},u="ontouchstart"in r.documentElement?{start:"touchstart",move:"touchmove",end:"touchend",cancel:"touchcancel"}:"pointerEnabled"in i.navigator?{start:"pointerdown",move:"pointermove",end:"pointerup",cancel:"pointercancel"}:"msPointerEnabled"in i.navigator?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp",cancel:"MSPointerCancel"}:{start:"touchstart",move:"touchmove",end:"touchend",cancel:"touchcancel"},e.prototype={_isEmptyListeners:function(n){if(n instanceof Array){for(var t=0;t0)return!1;return!0},addListener:function(r,f){return h.indexOf(r)===-1?(console.error("jquery.dnd: invalid event name - ",r),this):(this.listeners[r].push(f),t.has(r)?this.regions.add(this.el):!n.has(r)||this.mouse||this.touch||("onmousedown"in i&&(this.mouse=new o(this)),("ontouchstart"in i||"onmsgesturechange"in i)&&(this.touch=new s(this,u))),this)},removeListener:function(i,r){var e=arguments,o,f,u;if(e.length===0)for(o in this.listeners)this.listeners[o].length=0;else if(e.length===1)this.listeners[i].length=0;else for(f=this.listeners[i],u=0;u-1&&t.splice(n,1)},getTarget:function(){return t[0]},isTarget:function(){return this.getTarget()===this},start:function(){this.started=!0;this.targets=[];this.asPoint=!1;this.api=new y(this);this.$scrollareas=this.dnd.$el.dndGetParentScrollArea();this.$reference=this.dnd.$el.dndGetFirstNotStaticParent();this.$scrollareas.on("scroll",this.onscroll);this.dnd.trigger("dragstart",this.api)},onscroll:function(){this.clearCache();this.dnd.trigger("drag",this.api)},getCache:function(n){return this.cache[n]},setCache:function(n,t){return this.cache[n]=t},clearCache:function(){this.cache={}},stop:function(){if(this.$scrollareas.off("scroll",this.onscroll),this.targets.length)for(var n=0,t=this.targets.length;na&&oy&&s<\/div>').dndCss({position:"absolute"});return i.prototype={init:function(n){return delete this.start,delete this.element,this.api=n,this.ready=!1,this.templateUrl==="clone"?this.createElementByClone():this.createElementByTemplate(),this.wrap().appendTo(f(r.body)),this.scope.$apply(),n.setReferenceElement(r.body),this.initBorderOffset(),this},createTemplateByUrl:function(t){return t=n.isFunction(t)?t():t,o.get(t,{cache:c}).then(function(n){this.template=n.data;this._offset=u();this.ready=!0}.bind(this))},createElementByClone:function(){return this.element=this.mainElement.dndCloneByStyles().dndCss("position","static"),this._offset=u(this.mainElement.dndClientRect()).minus(this.api.getBorderedAxis()),this.ready=!0,this},createElementByTemplate:function(){return this.element=s(this.template)(this.scope),this},wrap:function(){return t.html(""),t.append(this.element),this},appendTo:function(n){return n.append(t),this},initBorderOffset:function(){var i=this.api.getBorderedAxis(),n;this.templateUrl==="clone"?(n=this.mainElement.dndClientRect(),this.borderOffset={top:i.y-n.top,left:i.x-n.left,bottom:i.y-n.top-n.height,right:i.x-n.left-n.width}):(n=t.dndClientRect(),this.borderOffset={top:0,left:0,bottom:-n.height,right:-n.width})},updatePosition:function(){var n=this.api.getRelBorderedAxis(this.borderOffset).plus(this._offset);v.mode&&console.log(this.api.getRelBorderedAxis());t.dndCss(n.getAsCss())},destroy:function(){this.element.remove()}},i}();return{require:["?dndRect","?dndModel","?dndContainment"],scope:!0,link:p}}]);e.directive("dndDroppable",["$parse","$timeout",function(n){return{require:"?dndModel",scope:!0,link:function(i,r,u,f){function p(n){var r=n.droplocal={};(n.dropmodel=f?f.get():f,r.droppable=h(i,{$dragmodel:n.dragmodel,$dropmodel:n.dropmodel,$api:n}),r.droppable=r.droppable===t?!0:r.droppable,r.droppable)&&(c(i,{$dragmodel:n.dragmodel,$dropmodel:n.dropmodel,$api:n}),i.$apply())}function w(n){var t=n.droplocal;t.droppable&&(a(i,{$dragmodel:n.dragmodel,$dropmodel:n.dropmodel,$api:n}),i.$apply())}function b(n){var r=n.droplocal;r.droppable&&(v(i,{$dragmodel:n.dragmodel,$dropmodel:n.dropmodel,$api:n}),n.dropmodel=t,i.$apply())}function k(n){y(i,{$dragmodel:n.dragmodel,$dropmodel:n.dropmodel,$api:n})}var s={layer:"common"},h=n(u.dndDroppable),e=l({},s,n(u.dndDroppableOpts)(i)||{}),c=n(u.dndOnDragenter),a=n(u.dndOnDragover),v=n(u.dndOnDragleave),y=n(u.dndOnDrop),o={};e.layer=e.layer||s.layer;o[e.layer+".dragenter"]=p;o[e.layer+".dragover"]=w;o[e.layer+".dragleave"]=b;o[e.layer+".drop"]=k;r.dndBind(o)}}}]);e.directive("dndRotatable",["$parse","$timeout",function(i,f){function e(e,o,s,h){function ut(i){var f=i.local={},s;(f.rotatable=b(e),f.rotatable=f.rotatable===t?!0:f.rotatable,f.rotatable||i.unTarget(),i.isTarget())&&(f.started=!0,i.setBounderElement(y?y.get():n.element(r.body)),s=i.getRelBorderedAxis(),f.srect=o.dndStyleRect(),f.currAngle=o.dndGetAngle(),f.startPoint=u(s),f.borders=i.getBorders(),f.center=u(f.srect).plus(u(f.srect.width/2,f.srect.height/2)),e.$rotated=!0,d(e),e.$apply())}function ft(n){var t=n.local;if(t.started){var h=n.getRelBorderedAxis(),c=u(h).deltaAngle(t.startPoint,t.center),f=it(t.currAngle+c);f=Math.round(f/p.step)*p.step;var l=tt(f),s=k().rotate(l),i=rt(t.center.x-t.srect.width/2,t.center.y-t.srect.height/2,t.srect.width,t.srect.height).applyMatrix(s,t.center).client(),r=n.getReferencePoint();t.borders&&(i.left+r.xt.borders.right+1||i.top+r.y+i.height>t.borders.bottom+1)||(v?v.update("transform",s.toStyle()):o.dndCss("transform",s.toStyle()),g(e),e.$apply())}}function et(n){var t=n.local;t.started&&(nt(e),f(function(){e.$rotated=!1}))}var v=h[0],y=h[1],b=i(s.dndRotatable),p=l({},{step:5},i(s.dndRotatableOpts)(e)||{}),d=i(s.dndOnRotatestart),g=i(s.dndOnRotate),nt=i(s.dndOnRotateend),c=o.dndCss("position"),a,w;c!="fixed"&&c!="absolute"&&c!="relative"&&(c="relative",o.dndCss("position",c));a=n.element('
<\/div>');o.append(a);e.$rotated=!1;w={"$$rotatable.dragstart":ut,"$$rotatable.drag":ft,"$$rotatable.dragend":et};a.dndBind(w)}return{require:["?dndRect","?dndContainment"],scope:!0,link:e}}]);e.directive("dndResizable",["$parse","$timeout",function(i,f){function o(t){return n.element("
<\/div>").addClass("angular-dnd-resizable-handle angular-dnd-resizable-handle-"+t)}function e(n,t){return t=typeof t=="object"?t:{x:1,y:1},new u(n.left+n.width*t.x/2,n.top+n.height*t.y/2)}function s(s,h,c,a){function ft(i){function o(i){var u=i.local={};if(u.resizable=nt(s),u.resizable=u.resizable===t?!0:u.resizable,u.resizable||i.unTarget(),i.isTarget()){i.setBounderElement(g?g.get():n.element(r.body));u.started=!0;u.$parent=h.parent();u.rads=h.dndGetAngle();u.rotateMatrix=k.IDENTITY.rotate(u.rads);u.inverseRotateMatrix=u.rotateMatrix.inverse();u.parentRect=u.$parent.dndClientRect();var o=i.getBorderedAxis(),e=h.dndClientRect(),f=u.rect=h.dndStyleRect();u.borders=i.getBorders();u.startAxis=o;u.minScaleX=v.minWidth/f.width;u.minScaleY=v.minHeight/f.height;u.maxScaleX=v.maxWidth/f.width;u.maxScaleY=v.maxHeight/f.height;u.deltaX=e.left-f.left+e.width/2-f.width/2;u.deltaY=e.top-f.top+e.height/2-f.height/2;s.$resized=!0;tt(s);s.$apply()}}function c(n){var t=n.local,y,w,b,a,g,k;if(t.started){var nt=n.getBorderedAxis(),v=u(nt).minus(t.startAxis).transform(t.inverseRotateMatrix),r={x:1,y:1},f=t.rect.width,o=t.rect.height,c=t.rect.top,l=t.rect.left;switch(i){case"n":r.y=(o-v.y)/o;break;case"e":r.x=(f+v.x)/f;break;case"s":r.y=(o+v.y)/o;break;case"w":r.x=(f-v.x)/f;break;case"ne":r.x=(f+v.x)/f;r.y=(o-v.y)/o;break;case"se":r.x=(f+v.x)/f;r.y=(o+v.y)/o;break;case"sw":r.x=(f-v.x)/f;r.y=(o+v.y)/o;break;case"nw":r.x=(f-v.x)/f;r.y=(o-v.y)/o}r.x=p(t.minScaleX,r.x,t.maxScaleX);r.y=p(t.minScaleY,r.y,t.maxScaleY);w=e(t.rect);b=e(t.rect,r);switch(i){case"n":y=u(l,c+o*r.y).rotate(t.rads,b).minus(u(l,c+o).rotate(t.rads,w));break;case"e":y=u(l,c).rotate(t.rads,b).minus(u(l,c).rotate(t.rads,w));break;case"s":y=u(l,c).rotate(t.rads,b).minus(u(l,c).rotate(t.rads,w));break;case"w":y=u(l+f*r.x,c).rotate(t.rads,b).minus(u(l+f,c).rotate(t.rads,w));break;case"ne":y=u(l,c+o*r.y).rotate(t.rads,b).minus(u(l,c+o).rotate(t.rads,w));break;case"se":y=u(l,c).rotate(t.rads,b).minus(u(l,c).rotate(t.rads,w));break;case"sw":y=u(l+f*r.x,c).rotate(t.rads,b).minus(u(l+f,c).rotate(t.rads,w));break;case"nw":y=u(l+f*r.x,c+o*r.y).rotate(t.rads,b).minus(u(l+f,c+o).rotate(t.rads,w))}(a={},a.width=f*r.x,a.height=o*r.y,a.left=l-y.x,a.top=c-y.y,g=u(a.left+t.deltaX+a.width/2,a.top+t.deltaY+a.height/2),k=rt(a.left+t.deltaX,a.top+t.deltaY,a.width,a.height).applyMatrix(t.rotateMatrix,g).client(),t.borders&&(k.left+1t.borders.right||k.bottom-1>t.borders.bottom))||(d?d.update(a):h.dndCss(a),it(s),s.$apply())}}function l(n){var t=n.local;t.started&&(ut(s),f(function(){s.$resized=!1}))}return{"$$resizable.dragstart":o,"$$resizable.drag":c,"$$resizable.dragend":l}}var d=a[0],g=a[1],nt=i(c.dndResizable),v=l({},{handles:"ne, se, sw, nw, n, e, s, w",minWidth:20,minHeight:20,maxWidth:1e4,maxHeight:1e4},i(c.dndResizableOpts)(s)||{}),tt=i(c.dndOnResizestart),it=i(c.dndOnResize),ut=i(c.dndOnResizeend),y=h.dndCss("position"),b,w;for(y!=="fixed"&&y!=="absolute"&&y!=="relative"&&(y="relative",h.dndCss("position",y)),b=v.handles.replace(/\s/g,"").split(","),w=0;w<\/"+h+">"}function h(r,u,f){function g(n,t){var i=u.dndClientRect();return(b?(t.x-i.left)/i.width:(t.y-i.top)/i.height)>.5}function nt(n,t,i,r){r=r||t;r.splice(i,0,t.splice(n,1)[0])}var s=u[0].parentNode,c=n.element(s),e=c.data("dnd-sortable"),h=t(f.dndModel)||o,y=u.dndCss(["float","display"]),b=/left|right|inline/.test(y.float+y.display),a=l({},{layer:"common"},t(f.dndSortableOpts)(r)||{}),k=t(f.dndOnSortstart),p=t(f.dndOnSort),w=t(f.dndOnSortchange),d=t(f.dndOnSortend),tt=t(f.dndOnSortenter),it=t(f.dndOnSortleave),v;e&&e[a.layer]||(e=e||{},e[a.layer]=!0,v={},v[a.layer+".dragover"]=function(n){n.getEvent().target!==s||h(r).list.length>1||(n.$sortable.model=h(r),n.$sortable.insertBefore=!0,c.append(i[0]))},c.dndBind(v).data("dnd-sortable",e));r.$$onDragStart=function(n){k(r);i=u.clone();u.addClass("ng-hide");i.addClass("angular-dnd-placeholder");s.insertBefore(i[0],u[0]);n.$sortable={};n.clearCache();r.$apply()};r.$$onDragOver=function(t){var e=g(t.getDragTarget(),t.getBorderedAxis()),f;e?s.insertBefore(i[0],u[0].nextSibling):s.insertBefore(i[0],u[0]);f=h(r);w===n.noop||t.$sortable.model&&t.$sortable.model.index===f.index||(w(r),r.$apply());t.$sortable.model=f;t.$sortable.insertBefore=!e;t.clearCache()};r.$$onDragEnd=function(n){if(u.removeClass("ng-hide"),i.addClass("ng-hide"),n.$sortable.model){var f=r.$index,t=n.$sortable.model.index,e=h(r).list,o=n.$sortable.model.list;o===e?t=i.left&&n.right<=i.right&&(i.top<=n.bottom&&n.bottom<=i.bottom||i.bottom>=n.top&&n.top>=i.top||n.top<=i.top&&n.bottom>=i.bottom)||n.top>=i.top&&n.bottom<=i.bottom&&(i.left<=n.right&&n.right<=i.right||i.right>=n.left&&n.left>=i.left||n.left<=i.left&&n.right>=i.right)||n.top>=i.top&&n.right<=i.right&&n.bottom<=i.bottom&&n.left>=i.left}}function r(n){this.$element=n}return i.$inject=["$scope","$attrs","$element"],r.prototype={getClient:function(){return this.$element.dndClientRect()}},{restrict:"A",require:["dndSelectable","^dndLassoArea","?dndRect"],controller:i,scope:!0,link:function(i,u,f,e){function v(){e[1].remove(e[0]);i.$$phase||i.$apply()}var a;i.$dndSelectable=e[0];a=e[2];e[0].rectCtrl=a?a:new r(u);e[1].add(e[0]);u.on("$destroy",v);var s=n(f.dndOnSelected),h=n(f.dndOnUnselected),c=n(f.dndOnSelecting),l=n(f.dndOnUnselecting);(s||h)&&(s=s||o,h=h||o,i.$watch(f.dndModelSelected,function(n,r){n!==t&&r!==t&&n!==r&&(n?s(i):h(i))}));(c||l)&&(c=c||o,l=l||o,i.$watch(f.dndModelSelecting,function(n,r){n!==t&&r!==t&&n!==r&&(n?c(i):l(i))}))}}}]);e.directive("dndRect",["$parse",function(n){function r(r,f,e){function l(n){var f,s,o,r;for(n=typeof n=="object"?n:{},s=0;s-1},r.$inject=["$scope","$attrs","$element"],{restrict:"A",controller:r}}]);e.directive("dndModel",["$parse",function(n){function t(t,i){var r=n(i.dndModel),u=r.assign;this.set=function(n){u(t,n)};this.get=function(){return r(t)}}return t.$inject=["$scope","$attrs"],{restrict:"A",controller:t}}]);e.directive("dndLassoArea",["DndLasso","$parse","$timeout","dndKey",function(n,i,r){function f(){var n=[],i={};this.data=function(){return i};this.add=function(t){n.push(t)};this.remove=function(t){for(var i=0;i<\/span>").dndCss({position:"absolute",left:-99999,top:-99999,opacity:0,"z-index":-9999});return f(r.body).append(u),{restrict:"A",link:function(n,r,u){function e(i){var l,v,h,c,e,a;i=i===t?{}:i;var b=r.dndCss(["font-size","font-family","font-weight","text-transform","border-top","border-right","border-bottom","border-left","padding-top","padding-right","padding-bottom","padding-left"]),g=i.text==t?r.text()||r.val():i.text,f=[];i.width===t&&f.push("width");i.height===t&&f.push("height");f.length&&(f=r.dndCss(f));for(l in f){if(v=f[l],v[v.length-1]=="%")return;i[l]=f[l]}if(h=o(g,b),c=s(r,0,0),!h.width||!h.height){r.dndCss("font-size","");return}c.width=parseFloat(i.width);c.height=parseFloat(i.height);var k=c.height/h.height,d=c.width/h.width,y=n.$eval(u.dndFittextMax),w=n.$eval(u.dndFittextMin);(w==t&&(w=0),y==t&&(y=Number.POSITIVE_INFINITY),e=k.95&&e<=1||e>=1&&e<1.05)||(a=e*parseFloat(b["font-size"]),a=p(w,a,y),r.dndCss("font-size",a+"px"))}n.$watch(u.dndFittext,nt(function(n){e(n)}),!0);f(i).on("resize",function(){e()})}}}]);e.directive("dndKeyModel",["$parse","dndKey",function(n,i){return{restrict:"A",link:function(r,u,f){var e=n(f.dndKeyModel),o=e.assign;r.$watch(function(){return i.get()},function(n){n!==t&&o(r,n)})}}}]);e.directive("dndContainment",["$parse",function(n){function t(t,i,r){var u=n(i.dndContainment);this.get=function(){var n=u(r);return n?t.dndClosest(n).eq(0):t.parent()}}return t.$inject=["$element","$attrs","$scope"],{restrict:"EAC",controller:t}}]);e.factory("dndKey",["$rootScope",function(n){function i(){}function f(i){var r=i.keyCode;(u(i),t.indexOf(r)>-1)||(t.push(r),n.$digest())}function r(i){var u=i.keyCode,r=t.indexOf(u);r!==-1&&(t.splice(r,1),n.$digest())}var t=[],u;i.prototype={get:function(){return t},isset:function(n){var i=t.indexOf(n);return i!==-1}};u=g(r,1e3);h.on("keydown",f);h.on("keyup",r);return new i}]);e.factory("DndLasso",[function(){function u(i){this.getRect=function(){return this.isActive?i.rect:t};this.getClientRect=function(){return this.isActive?n.dndClientRect():t};this.isActive=function(){return i.active}}function e(n){var t=n.isTarget(),i=new u(this);this.isTarget=function(){return t};this.handler=function(){return i};this.getEvent=function(){return n.getEvent()}}function o(t){function h(i){var r=i.local=new e(i);if(!r.isTarget()){o.trigger("start",r.handler());return}r.active=!0;o.trigger("start",r.handler());i.setReferenceElement(t.$el);i.setBounderElement(t.$el);r.startAxis=i.getRelBorderedAxis();n.removeAttr("class style").removeClass("ng-hide").addClass(t.className);t.$el.append(n)}function c(i){var u=i.local,f,r;if(!u.active){o.trigger("drag",u.handler());return}f=i.getRelBorderedAxis().minus(u.startAxis);r={top:u.startAxis.y,left:u.startAxis.x,width:f.x,height:f.y};r.width<0&&(r.width=-r.width,r.left=r.left-r.width);r.height<0&&(r.height=-r.height,r.top=r.top-r.height);u.rect=r;r.top+=t.offsetY;r.left+=t.offsetX;n.dndCss(r);o.trigger("drag",u.handler())}function a(t){var i=t.local;if(!i.active){o.trigger("end",i.handler());return}n.addClass("ng-hide");f(r.body).append(n);o.trigger("end",i.handler())}var o=this,s,u;t=l({},i,t);s={"$$lasso.dragstart":h,"$$lasso.drag":c,"$$lasso.dragend":a};t.$el.dndBind(s);this.destroy=function(){t.$el.dndUnbind()};u={};this.on=function(n,t){u[n]=u[n]||[];u[n].push(t)};this.trigger=function(n,t){u[n]=u[n]||[];t=t||typeof t=="string"?[t]:[];u[n].forEach(function(n){n.apply(this,t)})}}var n=f("
<\/div>").dndCss({position:"absolute"}),i={className:"angular-dnd-lasso",offsetX:0,offsetY:0};return o}]);e.factory("EventEmitter",[function(){function n(){var n={};this.on=function(t,i){n[t]=n[t]||[];n[t].push(i)};this.off=function(t,i){if(n[t])for(var r=0,u=n[t].length;r