text: "use strict";var angularDc=angular.module("angularDc",[]);angularDc.directive("dcChart",["$timeout",function($timeout){function setupChart(scope,iElement,iAttrs,options){var chartElement=iElement[0],chartType=iAttrs.dcChart,chartGroupName=iAttrs.dcChartGroup||void 0,chartFactory=dc[chartType],chart=chartFactory(chartElement,chartGroupName),validOptions=getValidOptionsForChart(chart);options=getOptionsFromAttrs(scope,iAttrs,validOptions),"options"in options&&(options=_.merge(options,options.options),options.options=void 0),"name"in options&&(scope[options.name]=chart,options.name=void 0),chart.options(options);var eventHandlers=_({preRender:options.onPreRender,postRender:options.onPostRender,preRedraw:options.onPreRedraw,postRedraw:options.onPostRedraw,filtered:options.onFiltered,zoomed:options.onZoomed}).omit(_.isUndefined);return eventHandlers.each(function(handler,evt){chart.on(evt,handler)}),_.isFunction(options.postSetupChart)&&options.postSetupChart(chart,options),chart}function getValidOptionsForChart(chart){return _(chart).functions().extend(directiveOptions).map(function(s){return"dc"+s.charAt(0).toUpperCase()+s.substring(1)}).value()}function getOptionsFromAttrs(scope,iAttrs,validOptions){return _(iAttrs.$attr).keys().intersection(validOptions).map(function(key){var value=scope.$eval(iAttrs[key]);return"dc"===key.substring(0,2)&&(key=key.charAt(2).toLowerCase()+key.substring(3)),[key,value]}).zipObject().value()}var directiveOptions=["name","onFiltered","onPostRedraw","onPostRender","onPreRedraw","onPreRender","onZoomed","postSetupChart"];return{restrict:"A",link:function(scope,iElement,iAttrs){var printExceptions=!1;scope.dc=dc,scope.d3=d3,scope.DateTime=function(a,b,c,d,e,f){return new Date(a,b,c,d,e,f)},scope.Date=function(a,b,c){return new Date(a,b,c)};var unwatch=scope.$watch(function(){var options=_(iAttrs.$attr).keys().filter(function(s){return"dc"===s.substring(0,2)&&"dcChart"!==s&&"dcChartGroup"!==s}).map(function(key){try{var r=scope.$eval(iAttrs[key]);if(_.isUndefined(r))throw new Error(iAttrs[key]+" is undefined");return r}catch(e){if(printExceptions)throw console.log("unable to eval"+key+":"+iAttrs[key]),e;return void 0}});return options.any(_.isUndefined)?void 0:options.value()},function(options){if(!_.isUndefined(options)){unwatch();var chart=setupChart(scope,iElement,iAttrs),a=angular.element(iElement[0].querySelector("a.reset"));a.on("click",function(){chart.filterAll(),dc.redrawAll()}),a.attr("href","javascript:;"),a.css("display","none"),chart.render()}});$timeout(function(){printExceptions=!0},2e3)}}}]),angularDc.directive("dcSelect",[function(){return{restrict:"E",scope:{dcDimension:"=",allLabel:"@"},template:'<select class="form-control" ng-model="selectModel" ng-options="d.key for d in selectOptions">',link:function(scope){return scope.$watch("dcDimension",function(dimension){var allkeys,chart;null!==dimension&&(chart=dc.baseMixin({}),chart.dimension(dimension),chart.group(dimension),chart._doRender=function(){},chart._doRedraw=function(){},scope.selectModel={key:scope.allLabel},allkeys=dimension.group().orderNatural().all(),scope.selectOptions=[scope.selectModel].concat(allkeys))}),scope.$watch("selectModel",function(sel){null!==scope.dcDimension&&(scope.dcDimension.filter(null!==sel&&sel.key!==scope.allLabel?function(d){return d===sel.key}:null),dc.redrawAll())})}}}]);