/*! ng-contextmenu by Adam Timberlake created on 2017-12-11 */ !function(e,n){"use strict";var t=e.module("ngContextMenu",[]);t.factory("contextMenu",["$rootScope",function(e){return{cancelAll:function(){e.$broadcast("context-menu/close")},eventBound:!1}}]),t.directive("contextMenu",["$timeout","$interpolate","$compile","contextMenu","$templateRequest","$sce",function(t,o,c,i,u,l){return{restrict:"EA",scope:!0,require:"?ngModel",link:function(t,r,a,p){function s(){t.menu&&(t.menu.remove(),t.menu=null,t.position=null)}function d(r,d){if(d=d||"append","preventDefault"in r)i.cancelAll(),r.stopPropagation(),r.preventDefault(),t.position={x:r.clientX,y:r.clientY};else if(!t.menu)return;u(l.getTrustedResourceUrl(a.contextMenu)).then(function(i){var u=c(i)(e.extend(p?e.extend(t,p.$modelValue):t)),l=e.element(u);switch(d){case"append":angular.element(n.body).append(l);break;default:t.menu.replaceWith(l)}l.css({position:a.contextMenuPosition||"fixed",top:0,left:0,transform:o("translate({{x}}px, {{y}}px)")({x:t.position.x,y:t.position.y})}),t.menu=l,t.menu.bind("click",s)})}if(i.eventBound||(n.addEventListener("click",function(e){1===e.which&&(i.cancelAll(),t.$apply())}),i.eventBound=!0),t.$on("context-menu/close",s),t.$on("$destroy",s),p){t.$watch(function(){return p.$modelValue},function(){d({},"replaceWith")},!0)}r.bind(a.contextEvent||"contextmenu",d)}}}])}(window.angular,window.document);