text: /*! ng-cells 2015-08-21 Copyright 2013,2014 Guy de Pourtalès. Licensed under the Apache License, Version 2.0 */
  !function(){var a=angular.module("ngcTableDirective",["ngc-template","ngSanitize","ngScrollable"]);a.directive("ngcTable",["$templateCache","$sce","$timeout","$parse",function(a,b,c,d){function e(){return{pre:function(a){function b(a,b,c){return angular.isArray(b)?c<b.length?a+":"+b[c]:a+":"+b[b.length-1]:angular.isDefined(b)?a+":"+b:""}function c(a,c,d){if(angular.isNumber(a))for(var e=0;a>e;e++)c.push({style:b("width",d,e)+";"+b("max-width",d,e)})}function d(a,c){return{index:c,height:b("height",a,c)+";"+b("max-height",a,c)}}function e(a){var b=a.showRows,c=a.rowNumber,e=a.rowHeights,f=a.defaultRowNumber||1,g=[];if(!b)return g;c=angular.isNumber(c)?c:f;for(var h=0;c>h;h++)g.push(d(e,h));return g}a.$$leftRowHeadersColumns=[],a.$$leftFixedColumns=[],c(angular.isNumber(a.leftColumnNumber)?a.leftColumnNumber:1,a.$$leftFixedColumns,a.leftColumnWidths),a.$$variableCenterColumns=[],c(angular.isNumber(a.centerColumnNumber)?a.centerColumnNumber:10,a.$$variableCenterColumns,a.centerColumnWidths),a.$$rightFixedColumns=[],c(angular.isNumber(a.rightColumnNumber)?a.rightColumnNumber:1,a.$$rightFixedColumns,a.rightColumnWidths),a.$$topLeftRowHeadersData=[],a.$$middleLeftRowHeadersData=[],a.$$bottomLeftRowHeadersData=[],a.$$leftColumnNames=[],a.$$centerColumnNames=[],a.$$rightColumnNames=[],a.$$scrollTopPosition=angular.isNumber(a.$$scrollTopPosition)?a.$$scrollTopPosition:0,a.$$scrollLeftPosition=angular.isNumber(a.$$scrollLeftPosition)?a.$$scrollLeftPosition:0,a.$$getDataValue=angular.isFunction(a.customDataValueFn)?a.customDataValueFn:function(a,b,c){return angular.isArray(a[b])?a[b][c]:void 0},a.$$topLeftData=[],a.$$topCenterData=[],a.$$topRightData=[],a.$$middleLeftData=[],a.$$middleCenterData=[],a.$$middleRightData=[],a.$$bottomLeftData=[],a.$$bottomCenterData=[],a.$$bottomRightData=[],a.$$scrollPosition={top:angular.isDefined(a.scrollTopPosition)?a.scrollTopPosition:0,left:angular.isDefined(a.scrollLeftPosition)?a.scrollLeftPosition:0},a.ranges=[],a.showColumnNames=angular.isDefined(a.showColumnNames)?a.showColumnNames:!0,a.showRowNumbers=angular.isDefined(a.showRowNumbers)?a.showRowNumbers:!0,a.showRowNumbers&&a.$$leftRowHeadersColumns.push({clazz:"row-number",rowNumberColumn:!0}),a.showHeader=angular.isDefined(a.showHeader)?a.showHeader:!0,a.$$headerRows=e({showRows:a.showHeader,rowNumber:a.headerRowNumber,rowHeights:a.headerRowHeights,defaultRowNumber:1}),a.showFilter=angular.isDefined(a.showFilter)?a.showFilter:!1,a.$$rows=e({showRows:!0,rowNumber:a.rowNumber,rowHeights:a.rowHeights,defaultRowNumber:10}),a.showFooter=angular.isDefined(a.showFooter)?a.showFooter:!0,a.$$footerRows=e({showRows:a.showFooter,rowNumber:a.footerRowNumber,rowHeights:a.footerRowHeights,defaultRowNumber:1})},post:function(a){function e(a){var b=a%26,c=String.fromCharCode(65+b);return a>25&&(c=e((a-b)/26-1)+c),c}function f(){return""}function g(a){return angular.isDefined(a)?a:"&nbsp;"}function h(a,b,c,d){return angular.isDefined(d)?String(d):"&nbsp;"}function i(a,c,d){var e="",i="",j=f,k=g,l=a.$$getDataValue(a.data,c,d),m=h,n=void 0,o=void 0,p={},q=[],r=["click","dblclick","keydown","keypress","keyup","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup"];angular.forEach(a.ranges,function(a){c>=a.top&&c<a.bottom&&d>=a.left&&d<a.right&&(q.push(a),angular.isFunction(a.formatFn)&&(k=a.formatFn),angular.isString(a.clazz)&&(e=a.clazz),angular.isString(a.style)&&(i=a.style),angular.isFunction(a.styleFn)&&(j=a.styleFn),angular.isFunction(a.customHtmlFn)&&(m=a.customHtmlFn),angular.isFunction(a.customTrustedHtmlFn)&&(n=a.customTrustedHtmlFn),angular.isDefined(a.customCellTemplate)&&(o=a.customCellTemplate),angular.forEach(r,function(b){angular.isFunction(a[b])&&(p[b]=a[b])}))});var s,t=k(l,c,d);return o&&angular.isFunction(o)&&(o=o(l,c,d,t,a)),(null==o||""==o)&&(s=angular.isDefined(n)?b.trustAsHtml(n(l,c,d,t)):m(l,c,d,t)),{row:c,col:d,data:l,value:t,clazz:e,style:j(l,c,d)+";"+i,eventCallbacks:p,enclosingRanges:q,customCellTemplate:o,customHTML:s}}function j(a,b,e){a.$$onVerticalScrollUpdate=!0;var f=a.data.length-a.$$headerRows.length-a.$$footerRows.length,g=f-a.$$middleCenterData.length,h=0;angular.isNumber(b)?h=b/a.$$contentHeight:angular.isNumber(e)&&(h=e/f);var i=Math.min(Math.ceil(f*Math.min(h,1)),g);a.$$scrollPosition.top=i,angular.isNumber(b)?d("scrollTopPosition").assign(a,i):angular.isNumber(e)&&(a.$$scrollTopPosition=h*a.$$contentHeight,a.$emit("content.reload")),c(function(){a.$$onVerticalScrollUpdate=!1})}function k(a,b,e){a.$$onHorizontalScrollUpdate=!0;var f=a.data[0].length-a.$$leftFixedColumns.length-a.$$rightFixedColumns.length,g=f-a.$$variableCenterColumns.length,h=0;angular.isNumber(b)?h=b/a.$$contentWidth:angular.isNumber(e)&&(h=e/f);var i=Math.min(Math.ceil(f*Math.min(h,1)),g);a.$$scrollPosition.left=i,angular.isNumber(b)?d("scrollLeftPosition").assign(a,i):angular.isNumber(e)&&(a.$$scrollLeftPosition=h*a.$$contentWidth,a.$emit("content.reload")),c(function(){a.$$onHorizontalScrollUpdate=!1})}a.$$dispatchEvent=function(a,b,c){c&&angular.isFunction(c.eventCallbacks[a])&&c.eventCallbacks[a](b,c)},a.$$setCenterColumnsData=function(b,c,d){var f;for(f=0;f<this.$$variableCenterColumns.length;f++)this.$$centerColumnNames[f]={value:e(f+this.$$leftFixedColumns.length+this.$$scrollPosition.left)};for(var g=0;b>g;g++){var h=g+d;for(c[g]=[],f=0;f<this.$$variableCenterColumns.length;f++){var j=f+this.$$leftFixedColumns.length+this.$$scrollPosition.left;c[g].push(i(a,h,j))}}},a.$$setLeftAndRightColumnsData=function(b,c,d,f,g){var h;for(h=0;h<this.$$leftFixedColumns.length;h++)this.$$leftColumnNames[h]={value:e(h)};var j=angular.isDefined(this.data[0])?this.data[0].length:0,k=Math.max(j-this.$$rightFixedColumns.length,this.$$leftFixedColumns.length+this.$$variableCenterColumns.length);for(h=0;h<this.$$rightFixedColumns.length;h++)this.$$rightColumnNames[h]={value:e(k+h)};for(var l=0;b>l;l++){var m=g+l;for(c[l]=[],c[l][this.$$leftRowHeadersColumns.length-1]={value:m+1},d[l]=[],h=0;h<this.$$leftFixedColumns.length;h++)d[l].push(i(a,m,h));for(f[l]=[],h=0;h<this.$$rightFixedColumns.length;h++)f[l].push(i(a,m,k+h))}},a.$$updateData=function(){this.$$setCenterColumnsData(this.$$headerRows.length,this.$$topCenterData,0),this.$$setLeftAndRightColumnsData(this.$$headerRows.length,this.$$topLeftRowHeadersData,this.$$topLeftData,this.$$topRightData,0),this.$$setCenterColumnsData(this.$$rows.length,this.$$middleCenterData,this.$$headerRows.length+this.$$scrollPosition.top),this.$$setLeftAndRightColumnsData(this.$$rows.length,this.$$middleLeftRowHeadersData,this.$$middleLeftData,this.$$middleRightData,this.$$headerRows.length+this.$$scrollPosition.top);var a=Math.max(this.data.length-this.$$footerRows.length,this.$$headerRows.length+this.$$rows.length);this.$$setCenterColumnsData(this.$$footerRows.length,this.$$bottomCenterData,a),this.$$setLeftAndRightColumnsData(this.$$footerRows.length,this.$$bottomLeftRowHeadersData,this.$$bottomLeftData,this.$$bottomRightData,a)},angular.isFunction(a.scrollFn)&&a.scrollFn(null,{top:a.$$headerRows.length,left:a.$$leftFixedColumns.length,direction:"none"}),a.$$updateData(),a.dataTotalRows=0,a.dataTotalCols=0,a.$watch("data",function(b,d){b!==d&&(b.length!==a.dataTotalRows||b[0].length!==a.dataTotalCols?(a.$emit("content.reload"),a.$$scrollPosition.top>b.length-a.$$headerRows.length-a.$$middleCenterData.length-a.$$footerRows.length&&j(a,null,b.length-a.$$headerRows.length-a.$$middleCenterData.length-a.$$footerRows.length),a.$$scrollPosition.left>a.data[0].length-a.$$leftFixedColumns.length-a.$$variableCenterColumns.length-a.$$rightFixedColumns.length&&k(a,null,b.length-a.$$leftFixedColumns.length-a.$$variableCenterColumns.length-a.$$rightFixedColumns.length),a.$$updateData()):c(function(){a.$$updateData()}))}),a.$$containerWidth=void 0,a.$$containerHeight=void 0,a.$$onVerticalScrollUpdate=!1,a.$$onHorizontalScrollUpdate=!1,a.$watch("scrollTopPosition",function(b,c){!a.$$onVerticalScrollUpdate&&angular.isNumber(b)&&angular.isNumber(c)&&b!==c&&!isNaN(b)&&b>=0&&(j(a,null,b),a.$$updateData())}),a.$watch("$$scrollTopPosition",function(b,c){angular.isNumber(b)&&angular.isNumber(c)&&b!==c&&!isNaN(b)&&b>=0&&(j(a,b,null),a.$$updateData())}),a.$watch("scrollLeftPosition",function(b,c){!a.$$onHorizontalScrollUpdate&&angular.isNumber(b)&&angular.isNumber(c)&&b!==c&&!isNaN(b)&&b>=0&&(k(a,null,b),a.$$updateData())}),a.$watch("$$scrollLeftPosition",function(b,c){angular.isNumber(b)&&angular.isNumber(c)&&b!==c&&!isNaN(b)&&b>=0&&(k(a,b,null),a.$$updateData())}),a.$on("scrollable.dimensions",function(b,c,d,e,f){if(e!=a.$$contentWidth||f!=a.$$contentHeight||c!=a.$$containerWidth||d!=a.$$containerHeight){a.dataTotalRows=a.data.length,a.dataTotalCols=a.data[0].length;var g=a.data.length-a.$$headerRows.length-a.$$footerRows.length,h=a.$$rows.length,i=a.data[0].length-a.$$leftFixedColumns.length-a.$$rightFixedColumns.length,j=a.$$variableCenterColumns.length,k=g/h,l=i/j;a.$$contentHeight=d*k,a.$$contentWidth=c*l,a.$$containerWidth=c,a.$$containerHeight=d,a.$emit("content.changed")}})}}}var f=["$scope",function(a){this.addRange=function(b){a.ranges.push(b)}}];return{scope:{customDataValueFn:"=?",data:"=",showColumnNames:"=?",showRowNumbers:"=?",showHeader:"=?",showFilter:"=?",showFooter:"=?",leftColumnNumber:"=?",leftColumnWidths:"=?",centerColumnNumber:"=",centerColumnWidths:"=?",rightColumnNumber:"=?",rightColumnWidths:"=?",headerRowNumber:"=?",headerRowHeights:"=?",rowNumber:"=?",rowHeights:"=?",footerRowNumber:"=?",footerRowHeights:"=?",scrollTopPosition:"=?",scrollLeftPosition:"=?",$$scrollTopPosition:"=?",$$scrollLeftPosition:"=?",$$contentHeight:"=?",$$contentWidth:"=?"},restrict:"AE",replace:!0,transclude:!0,template:a.get("ngc.table.tpl.html"),compile:e,controller:f}}]).directive("ngcRange",function(){return{require:"^ngcTable",restrict:"AE",scope:{top:"=",bottom:"=",left:"=",right:"=",formatFn:"=?",customHtmlFn:"=?",customTrustedHtmlFn:"=?",customCellTemplate:"=?",clazz:"=?",style:"=?",styleFn:"=?",clickFn:"=?",dblclickFn:"=?",keydownFn:"=?",keypressFn:"=?",keyupFn:"=?",mousedownFn:"=?",mouseenterFn:"=?",mouseleaveFn:"=?",mousemoveFn:"=?",mouseoverFn:"=?",mouseupFn:"=?"},link:function(a,b,c,d){d.addRange({top:a.top,bottom:a.bottom,left:a.left,right:a.right,formatFn:a.formatFn,clazz:a.clazz,styleFn:a.styleFn,style:a.style,customHtmlFn:a.customHtmlFn,customTrustedHtmlFn:a.customTrustedHtmlFn,customCellTemplate:a.customCellTemplate,click:a.clickFn,dblclick:a.dblclickFn,keydown:a.keydownFn,keypress:a.keypressFn,keyup:a.keyupFn,mousedown:a.mousedownFn,mouseenter:a.mouseenterFn,mouseleave:a.mouseleaveFn,mousemove:a.mousemoveFn,mouseover:a.mouseoverFn,mouseup:a.mouseupFn,touchstart:a.touchstartFn,touchmove:a.touchmoveFn,touchend:a.touchendFn})}}}).directive("extInclude",[function(){var a=["extInclude","scopeExtension"],b=function(a,b,c){a.$watch(b[c],function(b,d){b!==d&&(a[c]=b)},!0),a[c]=a.$eval(b[c])};return{restrict:"A",template:'<ng-include src="extInclude"></ng-include>',scope:!0,link:function(c,d,e){for(var f=0,g=a.length;g>f;f++)b(c,e,a[f])}}}])}(),angular.module("ngc-template",["ngc.table.tpl.html"]),angular.module("ngc.table.tpl.html",[]).run(["$templateCache",function(a){a.put("ngc.table.tpl.html",'<div class="ngc table">\n    <div ng-transclude style="display: hidden"></div>\n\n    <div class="ngc scroll-wrapper" ng-scrollable="{updateContentPosition:false, enableKinetic:false, wheelSpeed:1}"\n         spy-x="$$scrollLeftPosition"\n         spy-y="$$scrollTopPosition"\n         spy-custom-content-width="$$contentWidth"\n         spy-custom-content-height="$$contentHeight"\n            >\n        <table class="ngc">\n            <!-- Column Names -->\n            <tr class="ngc row column-names" ng-show="{{showColumnNames}}"  ng-class="{first: $first, last: $last}">\n                <!-- Cells for row headers columns -->\n                <td ng-repeat="column in $$leftRowHeadersColumns"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc row-header column-name cell {{column.clazz}}"\n                    style="{{column.style}}">\n                    <div class="ngc cell-content" style="{{column.style}}"></div>\n                </td>\n\n                <!-- Cells for left fixed columns -->\n                <td ng-repeat="column in $$leftFixedColumns"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc left column-name cell {{$$leftColumnNames[$index].clazz}} {{column.clazz}}"\n                    style="{{$$leftColumnNames[$index].style}}; {{column.style}}">\n                    <div class="ngc cell-content" style="{{column.style}}">{{$$leftColumnNames[$index].value}}</div>\n                </td>\n\n                <!-- Cells for middle variable columns -->\n                <td ng-repeat="column in $$variableCenterColumns"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc center column-name cell {{$$centerColumnNames[$index].clazz}} {{column.clazz}}"\n                    style="{{$$centerColumnNames[$index].style}}; {{column.style}}">\n                    <div class="ngc cell-content" style="{{column.style}}">{{$$centerColumnNames[$index].value}}</div>\n                </td>\n\n                <!-- Cells for right fixed columns -->\n                <td ng-repeat="column in $$rightFixedColumns"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc right column-name cell {{$$rightColumnNames[$index].clazz}} {{column.clazz}}"\n                    style="{{$$rightColumnNames[$index].style}}; {{column.style}}">\n                    <div class="ngc cell-content" style="{{column.style}}">{{$$rightColumnNames[$index].value}}</div>\n                </td>\n\n            </tr>\n\n            <!-- Headers -->\n            <tr class="ngc row header"  ng-show="{{showHeader}}" ng-repeat="row in $$headerRows" ng-class="{first: $first, last: $last}">\n                <!-- Cells for row headers columns -->\n                <td ng-repeat="column in $$leftRowHeadersColumns"\n                    ng-class="{first: $first, last: $last}"\n                     class="ngc row-header header cell {{$$topLeftRowHeadersData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                     style="{{$$topLeftRowHeadersData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content" style="{{row.height}}; {{column.style}}" >{{$$topLeftRowHeadersData[$parent.$index][$index].value}}</div>\n                </td>\n\n                <!-- Cells for left fixed columns -->\n                <td ng-repeat="column in $$leftFixedColumns"\n                    ng-click="$$dispatchEvent(\'click\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-keydown="$$dispatchEvent(\'keydown\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-keypress="$$dispatchEvent(\'keypress\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-keyup="$$dispatchEvent(\'keyup\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$topLeftData[$parent.$index][$index])"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc left header cell {{$$topLeftData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$topLeftData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$topLeftData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$topLeftData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$topLeftData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$topLeftData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$topLeftData[row.index][$index]}"></div>\n                </td>\n\n                <!-- Cells for middle variable columns -->\n                <td ng-repeat="column in $$variableCenterColumns"\n                    ng-click="$$dispatchEvent(\'click\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-keydown="$$dispatchEvent(\'keydown\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-keypress="$$dispatchEvent(\'keypress\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-keyup="$$dispatchEvent(\'keyup\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$topCenterData[$parent.$index][$index])"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc center header cell {{$$topCenterData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$topCenterData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$topCenterData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$topCenterData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$topCenterData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$topCenterData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$topCenterData[row.index][$index]}"></div>\n                </td>\n\n                <!-- Cells for right fixed columns -->\n                <td ng-repeat="column in $$rightFixedColumns"\n                    ng-click="$$dispatchEvent(\'click\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-keydown="$$dispatchEvent(\'keydown\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-keypress="$$dispatchEvent(\'keypress\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-keyup="$$dispatchEvent(\'keyup\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$topRightData[$parent.$index][$index])"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc right header cell {{$$topRightData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$topRightData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$topRightData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$topRightData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$topRightData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$topRightData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$topRightData[row.index][$index]}"></div>\n                </td>\n\n\n            </tr>\n\n            <!-- Middle -->\n            <tr class="ngc row middle" ng-repeat="row in $$rows" ng-class="{first: $first, last: $last}">\n                <!-- Cells for row headers columns -->\n                <td ng-repeat="column in $$leftRowHeadersColumns"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc row-header middle cell {{$$middleLeftRowHeadersData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$middleLeftRowHeadersData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content" style="{{row.height}}; {{column.style}}">{{$$middleLeftRowHeadersData[$parent.$index][$index].value}}</div>\n                </td>\n\n                <!-- Cells for left fixed columns -->\n                <td ng-repeat="column in $$leftFixedColumns"\n                    ng-click="$$dispatchEvent(\'click\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-keydown="$$dispatchEvent(\'keydown\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-keypress="$$dispatchEvent(\'keypress\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-keyup="$$dispatchEvent(\'keyup\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$middleLeftData[$parent.$index][$index])"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc left middle cell {{$$middleLeftData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$middleLeftData[$parent.$index][$index].style}} ; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$middleLeftData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$middleLeftData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$middleLeftData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$middleLeftData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$middleLeftData[row.index][$index]}"></div>\n                </td>\n\n                <!-- Cells for middle variable columns -->\n                <td ng-repeat="column in $$variableCenterColumns"\n                    ng-click="$$dispatchEvent(\'click\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-keydown="$$dispatchEvent(\'keydown\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-keypress="$$dispatchEvent(\'keypress\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-keyup="$$dispatchEvent(\'keyup\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$middleCenterData[$parent.$index][$index])"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc center cell middle {{$$middleCenterData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$middleCenterData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$middleCenterData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$middleCenterData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$middleCenterData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$middleCenterData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$middleCenterData[row.index][$index]}"></div>\n                </td>\n\n                <!-- Cells for right fixed columns -->\n                <td ng-repeat="column in $$rightFixedColumns"\n                    ng-click="$$dispatchEvent(\'click\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-keydown="$$dispatchEvent(\'keydown\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-keypress="$$dispatchEvent(\'keypress\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-keyup="$$dispatchEvent(\'keyup\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$middleRightData[$parent.$index][$index])"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc right cell middle {{$$middleRightData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$middleRightData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$middleRightData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$middleRightData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$middleRightData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$middleRightData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$middleRightData[row.index][$index]}"></div>\n                </td>\n\n            </tr>\n\n            <!-- Bottom -->\n            <tr class="ngc row footer" ng-repeat="row in $$footerRows" ng-class="{first: $first, last: $last}">\n                <!-- Cells for row headers columns -->\n                <td ng-repeat="column in $$leftRowHeadersColumns"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc row-header footer cell {{$$bottomLeftRowHeadersData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$bottomLeftRowHeadersData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content" style="{{row.height}}; {{column.style}}">{{$$bottomLeftRowHeadersData[$parent.$index][$index].value}}</div>\n                </td>\n\n                <!-- Cells for left fixed columns -->\n                <td  ng-repeat="column in $$leftFixedColumns"\n                     ng-click="$$dispatchEvent(\'click\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-keydown="$$dispatchEvent(\'keydown\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-keypress="$$dispatchEvent(\'keypress\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-keyup="$$dispatchEvent(\'keyup\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$bottomLeftData[$parent.$index][$index])"\n                     ng-class="{first: $first, last: $last}"\n                     class="ngc left footer cell {{$$bottomLeftData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                     style="{{$$bottomLeftData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$bottomLeftData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$bottomLeftData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$bottomLeftData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$bottomLeftData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$bottomLeftData[row.index][$index]}"></div>\n                </td>\n\n                <!-- Cells for middle variable columns -->\n                <td ng-repeat="column in $$variableCenterColumns"\n                    ng-click="$$dispatchEvent(\'click\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-keydown="$$dispatchEvent(\'keydown\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-keypress="$$dispatchEvent(\'keypress\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-keyup="$$dispatchEvent(\'keyup\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$bottomCenterData[$parent.$index][$index])"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc center footer cell {{$$bottomCenterData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$bottomCenterData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$bottomCenterData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$bottomCenterData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$bottomCenterData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$bottomCenterData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$bottomCenterData[row.index][$index]}"></div>\n                </td>\n\n                <!-- Cells for right fixed columns -->\n                <td ng-repeat="column in $$rightFixedColumns"\n                    ng-click="$$dispatchEvent(\'click\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-dblclick="$$dispatchEvent(\'dblclick\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-keydown="$$dispatchEvent(\'keydown\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-keypress="$$dispatchEvent(\'keypress\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-keyup="$$dispatchEvent(\'keyup\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-mousedown="$$dispatchEvent(\'mousedown\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-mouseleave="$$dispatchEvent(\'mouseleave\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-mouseenter="$$dispatchEvent(\'mouseenter\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-mousemove="$$dispatchEvent(\'mousemove\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-mouseover="$$dispatchEvent(\'mouseover\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-mouseup="$$dispatchEvent(\'mouseup\', $event, $$bottomRightData[$parent.$index][$index])"\n                    ng-class="{first: $first, last: $last}"\n                    class="ngc right footer cell {{$$bottomRightData[$parent.$index][$index].clazz}} {{column.clazz}}"\n                    style="{{$$bottomRightData[$parent.$index][$index].style}}; {{row.height}}; {{column.style}}">\n                    <div class="ngc cell-content ngc-custom-html" style="{{row.height}}; {{column.style}}"\n                         ng-if="!$$bottomRightData[$parent.$index][$index].customCellTemplate"\n                         ng-bind-html="$$bottomRightData[$parent.$parent.$index][$index].customHTML"></div>\n                    <div class="ngc cell-content ngc-custom-cell-template" style="{{row.height}}; {{column.style}}"\n                         ng-if="$$bottomRightData[$parent.$index][$index].customCellTemplate"\n                         ext-include="$$bottomRightData[row.index][$index].customCellTemplate"\n                         scope-extension="{\'rawCellData\': $$bottomRightData[row.index][$index]}"></div>\n                </td>\n\n            </tr>\n        </table>\n    </div>\n</div>')
  }]),angular.module("ngScrollable",[]).directive("ngScrollable",["$injector",function(a){"use strict";var b=a.get("$document"),c=a.get("$interval"),d=a.get("$timeout"),e=a.get("$window"),f=a.get("$parse"),g=angular.extend,h=angular.element,i=(angular.isDefined,"undefined"!=typeof e.ontouchstart),j="transform",k=e.requestAnimationFrame||e.webkitRequestAnimationFrame;["webkit","moz","o","ms"].every(function(a){var c=a+"Transform",d=b.find("body").eq(0);return"undefined"!=typeof d[0].style[c]?(j=c,!1):!0});var l={id:0,scrollX:"bottom",scrollY:"right",scrollXSlackSpace:0,scrollYSlackSpace:0,scrollXAlways:!1,scrollYAlways:!1,usePadding:!1,wheelSpeed:1,minSliderLength:10,useBothWheelAxes:!1,useKeyboard:!0,updateOnResize:!0,kineticTau:325,enableKinetic:!0,updateContentPosition:!0};return{restrict:"A",transclude:!0,template:"<div class=\"scrollable\"><div class=\"scrollable-content\" ng-transclude></div><div class='scrollable-bar scrollable-bar-x'><div class='scrollable-slider'></div></div><div class='scrollable-bar scrollable-bar-y'><div class='scrollable-slider'></div></div></div>",link:function(a,m,n){var o,p,q,r=g({},l,a.$eval(n.ngScrollable)),s=h(m.children()[0]),t={window:h(e),el:s,content:h(s.children()[0]),barX:h(s.children()[1]),barY:h(s.children()[2]),sliderX:h(h(s.children()[1]).children()[0]),sliderY:h(h(s.children()[2]).children()[0])},u=!1,v=!1,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=null,J=null,K=null,L=null,M=!1,N=!1,O=!1,P={},Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=function(a){return a.toFixed(3)+"px"},Z=function(a,b,c){return Math.max(b,Math.min(a,c))},$=function(){var a=w-3;u?(E=Math.max(r.minSliderLength,parseInt(a*a/y,10)),F=parseInt(D*(a-E)/(y-a),10),F>=a-E?F=a-E:0>F&&(F=0),t.sliderX[0].style[j]="translate3d("+Y(F)+",0,0)",t.sliderX[0].style.width=Y(E)):(E=F=0,t.sliderX[0].style[j]="translate3d(0,0,0)",t.sliderX[0].style.width="0")},_=function(){var a=x-3;v?(G=Math.max(r.minSliderLength,parseInt(a*a/z,10)),H=parseInt(C*(a-G)/(z-a),10),H>=a-G?H=a-G:0>H&&(H=0),t.sliderY[0].style[j]="translate3d(0,"+Y(H)+",0)",t.sliderY[0].style.height=Y(G)):(H=G=0,t.sliderY[0].style[j]="translate3d(0,0,0)",t.sliderY[0].style.height="0")},ab=function(){var a=r.scrollXAlways,b={left:0,width:Y(w),display:u||a?"inherit":"none"};switch(r.scrollX){case"bottom":b.bottom=0,t.content[u||a?"addClass":"removeClass"]("scrollable-bottom"),t.barX[u||a?"addClass":"removeClass"]("scrollable-bottom");break;case"top":b.top=0,t.content[u||a?"addClass":"removeClass"]("scrollable-top"),t.barX[u||a?"addClass":"removeClass"]("scrollable-top")}t.barX.css(b),t.sliderX[0].style.display=u?"inherit":"none"},bb=function(){var a=r.scrollYAlways,b={top:0,height:Y(x),display:v||a?"inherit":"none"};switch(r.scrollY){case"right":b.right=0,t.content[v||a?"addClass":"removeClass"]("scrollable-right"),t.barY[v||a?"addClass":"removeClass"]("scrollable-right");break;case"left":b.left=0,t.content[v||a?"addClass":"removeClass"]("scrollable-left"),t.barY[v||a?"addClass":"removeClass"]("scrollable-left")}t.barY.css(b),t.sliderY[0].style.display=v?"inherit":"none"},cb=function(b,c){C=Z(c,0,z-x),D=Z(b,0,y-w),r.updateContentPosition&&(t.content[0].style[j]="translate3d("+Y(-D)+","+Y(-C)+",0)"),P.spyX&&P.spyX(a,parseInt(D,10)),P.spyY&&P.spyY(a,parseInt(C,10)),P.spyCustomContentHeight&&P.spyCustomContentHeight(a,parseInt(B)),P.spyCustomContentWidth&&P.spyCustomContentWidth(a,parseInt(A))},db=function(a){u&&(cb(a,C),$())},eb=function(a){v&&(cb(D,a),_())},fb=function(b,c){w=r.usePadding?t.el[0].clientWidth:t.el[0].offsetWidth,x=r.usePadding?t.el[0].clientHeight:t.el[0].offsetHeight,y=angular.isDefined(A)?A:t.content[0].scrollWidth,z=angular.isDefined(B)?B:t.content[0].scrollHeight,"none"!==r.scrollX&&w+r.scrollXSlackSpace<y?u=!0:(u=!1,db(0)),"none"!==r.scrollY&&x+r.scrollYSlackSpace<z?v=!0:(v=!1,eb(0)),ab(),bb(),$(),_(),c||a.$broadcast("scrollable.dimensions",w,x,y,z,r.id)},gb=function(a,b){return a.stopPropagation(),b&&a.preventDefault(),!1},hb=function(a){return a=a.originalEvent||a,a.targetTouches&&a.targetTouches.length>=1?a.targetTouches[0].pageY:a.pageY},ib=function(a){return a=a.originalEvent||a,a.targetTouches&&a.targetTouches.length>=1?a.targetTouches[0].pageX:a.pageX},jb=function(){var a,b,c,d;a=Date.now(),b=a-p,p=a,c=D-S,S=D,d=1e3*c/(1+b),Q=.8*d+.2*Q,c=C-W,W=C,d=1e3*c/(1+b),U=.8*d+.2*U},kb=function(){var a,b;R&&(a=Date.now()-p,b=-R*Math.exp(-a/r.kineticTau),b>.5||-.5>b?(db(T+b),k(kb)):db(T))},lb=function(){var a,b;V&&(a=Date.now()-p,b=-V*Math.exp(-a/r.kineticTau),b>.5||-.5>b?(eb(X+b),k(lb)):eb(X))},mb=function(a){return J=ib(a),I=D,M=!0,Q=R=0,S=D,q||(q=c(jb,100)),t.el.addClass("active"),i||gb(a,!i)},nb=function(a){if(M){var b=ib(a)-J,c=i?-b:parseInt(b*(y-w)/(w-E),10);return db(I+c),i||gb(a,!0)}},ob=function(a){return M&&(M=!1,t.el.removeClass("active"),I=J=null),r.enableKinetic&&(q&&(c.cancel(q),q=null),(Q>10||-10>Q)&&(R=.8*Q,T=Math.round(D+R),p=Date.now(),k(kb))),i||gb(a,!i)},pb=function(a){return L=hb(a),K=C,N=!0,U=V=0,W=C,q||(q=c(jb,100)),t.el.addClass("active"),i||gb(a,!i)},qb=function(a){if(N){var b=hb(a)-L,c=i?-b:parseInt(b*(z-x)/(x-G),10);return eb(K+c),i||gb(a,!0)}},rb=function(a){return N&&(N=!1,t.el.removeClass("active"),K=L=null),r.enableKinetic&&(q&&(c.cancel(q),q=null),(U>10||-10>U)&&(V=.8*U,X=Math.round(C+V),p=Date.now(),k(lb))),i||gb(a,!0)},sb=function(b){var c=parseInt(E/2,10),d=b.clientX-t.barX[0].getBoundingClientRect().left-c,e=w-E,f=Z(d/e,0,1);db((y-w)*f),a.$digest()},tb=function(b){var c=parseInt(G/2,10),d=b.clientY-t.barY[0].getBoundingClientRect().top-c,e=x-G,f=Z(d/e,0,1);eb((z-x)*f),a.$digest()},ub=function(){O=!0},vb=function(){O=!1},wb=function(c){var d=0,e=0,f=30;if(!(!O||b[0].activeElement.isContentEditable||c.altKey||c.ctrlKey||c.metaKey)){switch(c.which){case 37:d=-f;break;case 38:e=f;break;case 39:d=f;break;case 40:e=-f;break;case 33:e=x;break;case 32:case 34:e=-x;break;case 35:v&&!u?e=-z:d=x;break;case 36:v&&!u?e=z:d=-x;break;default:return}eb(C-e),db(D+d),c.preventDefault(),a.$digest()}},xb=function(b){b=b.originalEvent||b;var c=b.deltaX*r.wheelSpeed,e=b.deltaY*r.wheelSpeed;t.el.addClass("active"),d.cancel(o),o=d(function(){t.el.removeClass("active")},500),r.useBothWheelAxes?v&&!u?e?eb(C+e):eb(C+c):u&&!v&&(c?db(D+c):db(D+e)):(eb(C+e),db(D+c)),gb(b,!0),a.$digest()},yb=function(){r.updateOnResize&&t.window.on("resize",fb),"none"!==r.scrollX&&(t.sliderX.on("click",gb),t.barX.on("click",sb),i?(t.el.on("touchstart",mb),t.el.on("touchmove",nb),t.el.on("touchend",ob)):(t.sliderX.on("mousedown",mb),b.on("mousemove",nb),b.on("mouseup",ob))),"none"!==r.scrollY&&(t.sliderY.on("click",gb),t.barY.on("click",tb),i?(t.el.on("touchstart",pb),t.el.on("touchmove",qb),t.el.on("touchend",rb)):(t.sliderY.on("mousedown",pb),b.on("mousemove",qb),b.on("mouseup",rb))),i||t.el.on("wheel",xb),r.useKeyboard&&!i&&(t.el.on("mouseenter",ub),t.el.on("mouseleave",vb),b.on("keydown",wb))},zb=function(){r.updateOnResize&&t.window.off("resize",fb),t.sliderX.off("click",gb),t.barX.off("click",sb),t.sliderY.off("click",gb),t.barY.off("click",tb),i?(t.el.off("touchstart",mb),t.el.off("touchmove",nb),t.el.off("touchend",ob),t.el.off("touchstart",pb),t.el.off("touchmove",qb),t.el.off("touchend",rb)):(t.sliderX.off("mousedown",mb),b.off("mousemove",nb),b.off("mouseup",ob),t.sliderY.off("mousedown",pb),b.off("mousemove",qb),b.off("mouseup",rb),r.useKeyboard&&(t.el.off("mouseenter",ub),t.el.off("mouseleave",vb),b.off("keydown",wb)),t.el.off("wheel",xb))};a.$on("content.reload",function(a,b){zb(),d(function(){t.el=h(m.children()[0]),t.content=h(t.el.children()[0]),yb(),fb(a,b)})}),a.$on("content.changed",function(a,b,c){b=b||100,d(function(){fb(a,c)},b),a.preventDefault()}),a.$on("scrollable.scroll.left",function(){a.$applyAsync(function(){db(0)})}),a.$on("scrollable.scroll.right",function(){a.$applyAsync(function(){db(y)})}),a.$on("scrollable.scroll.top",function(){a.$applyAsync(function(){eb(0)})}),a.$on("scrollable.scroll.bottom",function(){a.$applyAsync(function(){eb(z)})}),a.$on("$destroy",function(){d.cancel(o),zb()}),yb(),fb(),angular.forEach(["spyX","spyY","spyCustomContentHeight","spyCustomContentWidth"],function(b){n[b]&&(P[b]=f(n[b]).assign,a.$watch(n[b],function(a){switch(b){case"spyX":db(a);break;case"spyY":eb(a);break;case"spyCustomContentHeight":B=a,fb(null,null);break;case"spyCustomContentWidth":A=a,fb(null,null)}}))})}}}]);