and
elements. It is important to note that the state\n * names/globs passed to ui-sref-active shadow the state provided by ui-sref.\n */\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active-eq\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * The same as {@link ui.router.state.directive:ui-sref-active ui-sref-active} but will only activate\n * when the exact target state used in the `ui-sref` is active; no child states.\n *\n */\n$StateRefActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];\nfunction $StateRefActiveDirective($state, $stateParams, $interpolate) {\n return {\n restrict: \"A\",\n controller: ['$scope', '$element', '$attrs', '$timeout', function ($scope, $element, $attrs, $timeout) {\n var states = [], activeClasses = {}, activeEqClass, uiSrefActive;\n\n // There probably isn't much point in $observing this\n // uiSrefActive and uiSrefActiveEq share the same directive object with some\n // slight difference in logic routing\n activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n try {\n uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n } catch (e) {\n // Do nothing. uiSrefActive is not a valid expression.\n // Fall back to using $interpolate below\n }\n uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n if (isObject(uiSrefActive)) {\n forEach(uiSrefActive, function(stateOrName, activeClass) {\n if (isString(stateOrName)) {\n var ref = parseStateRef(stateOrName, $state.current.name);\n addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n }\n });\n }\n\n // Allow uiSref to communicate with uiSrefActive[Equals]\n this.$$addStateInfo = function (newState, newParams) {\n // we already got an explicit state provided by ui-sref-active, so we\n // shadow the one that comes from ui-sref\n if (isObject(uiSrefActive) && states.length > 0) {\n return;\n }\n addState(newState, newParams, uiSrefActive);\n update();\n };\n\n $scope.$on('$stateChangeSuccess', update);\n\n function addState(stateName, stateParams, activeClass) {\n var state = $state.get(stateName, stateContext($element));\n var stateHash = createStateHash(stateName, stateParams);\n\n states.push({\n state: state || { name: stateName },\n params: stateParams,\n hash: stateHash\n });\n\n activeClasses[stateHash] = activeClass;\n }\n\n /**\n * @param {string} state\n * @param {Object|string} [params]\n * @return {string}\n */\n function createStateHash(state, params) {\n if (!isString(state)) {\n throw new Error('state should be a string');\n }\n if (isObject(params)) {\n return state + toJson(params);\n }\n params = $scope.$eval(params);\n if (isObject(params)) {\n return state + toJson(params);\n }\n return state;\n }\n\n // Update route state\n function update() {\n for (var i = 0; i < states.length; i++) {\n if (anyMatch(states[i].state, states[i].params)) {\n addClass($element, activeClasses[states[i].hash]);\n } else {\n removeClass($element, activeClasses[states[i].hash]);\n }\n\n if (exactMatch(states[i].state, states[i].params)) {\n addClass($element, activeEqClass);\n } else {\n removeClass($element, activeEqClass);\n }\n }\n }\n\n function addClass(el, className) { $timeout(function () { el.addClass(className); }); }\n function removeClass(el, className) { el.removeClass(className); }\n function anyMatch(state, params) { return $state.includes(state.name, params); }\n function exactMatch(state, params) { return $state.is(state.name, params); }\n\n update();\n }]\n };\n}\n\nangular.module('ui.router.state')\n .directive('uiSref', $StateRefDirective)\n .directive('uiSrefActive', $StateRefActiveDirective)\n .directive('uiSrefActiveEq', $StateRefActiveDirective)\n .directive('uiState', $StateRefDynamicDirective);\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:isState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_is $state.is(\"stateName\")}.\n */\n$IsStateFilter.$inject = ['$state'];\nfunction $IsStateFilter($state) {\n var isFilter = function (state, params) {\n return $state.is(state, params);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:includedByState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.\n */\n$IncludedByStateFilter.$inject = ['$state'];\nfunction $IncludedByStateFilter($state) {\n var includesFilter = function (state, params, options) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular.module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n})(window, window.angular);","angular.module(\"ui.bootstrap\", [\"ui.bootstrap.tpls\", \"ui.bootstrap.collapse\",\"ui.bootstrap.accordion\",\"ui.bootstrap.alert\",\"ui.bootstrap.buttons\",\"ui.bootstrap.carousel\",\"ui.bootstrap.dateparser\",\"ui.bootstrap.isClass\",\"ui.bootstrap.position\",\"ui.bootstrap.datepicker\",\"ui.bootstrap.debounce\",\"ui.bootstrap.dropdown\",\"ui.bootstrap.stackedMap\",\"ui.bootstrap.modal\",\"ui.bootstrap.paging\",\"ui.bootstrap.pager\",\"ui.bootstrap.pagination\",\"ui.bootstrap.tooltip\",\"ui.bootstrap.popover\",\"ui.bootstrap.progressbar\",\"ui.bootstrap.rating\",\"ui.bootstrap.tabs\",\"ui.bootstrap.timepicker\",\"ui.bootstrap.typeahead\"]);\nangular.module(\"ui.bootstrap.tpls\", [\"uib/template/accordion/accordion-group.html\",\"uib/template/accordion/accordion.html\",\"uib/template/alert/alert.html\",\"uib/template/carousel/carousel.html\",\"uib/template/carousel/slide.html\",\"uib/template/datepicker/datepicker.html\",\"uib/template/datepicker/day.html\",\"uib/template/datepicker/month.html\",\"uib/template/datepicker/popup.html\",\"uib/template/datepicker/year.html\",\"uib/template/modal/backdrop.html\",\"uib/template/modal/window.html\",\"uib/template/pager/pager.html\",\"uib/template/pagination/pagination.html\",\"uib/template/tooltip/tooltip-html-popup.html\",\"uib/template/tooltip/tooltip-popup.html\",\"uib/template/tooltip/tooltip-template-popup.html\",\"uib/template/popover/popover-html.html\",\"uib/template/popover/popover-template.html\",\"uib/template/popover/popover.html\",\"uib/template/progressbar/bar.html\",\"uib/template/progressbar/progress.html\",\"uib/template/progressbar/progressbar.html\",\"uib/template/rating/rating.html\",\"uib/template/tabs/tab.html\",\"uib/template/tabs/tabset.html\",\"uib/template/timepicker/timepicker.html\",\"uib/template/typeahead/typeahead-match.html\",\"uib/template/typeahead/typeahead-popup.html\"]);\nangular.module('ui.bootstrap.collapse', [])\n\n .directive('uibCollapse', ['$animate', '$q', '$parse', '$injector', function($animate, $q, $parse, $injector) {\n var $animateCss = $injector.has('$animateCss') ? $injector.get('$animateCss') : null;\n return {\n link: function(scope, element, attrs) {\n var expandingExpr = $parse(attrs.expanding),\n expandedExpr = $parse(attrs.expanded),\n collapsingExpr = $parse(attrs.collapsing),\n collapsedExpr = $parse(attrs.collapsed);\n\n if (!scope.$eval(attrs.uibCollapse)) {\n element.addClass('in')\n .addClass('collapse')\n .attr('aria-expanded', true)\n .attr('aria-hidden', false)\n .css({height: 'auto'});\n }\n\n function expand() {\n if (element.hasClass('collapse') && element.hasClass('in')) {\n return;\n }\n\n $q.resolve(expandingExpr(scope))\n .then(function() {\n element.removeClass('collapse')\n .addClass('collapsing')\n .attr('aria-expanded', true)\n .attr('aria-hidden', false);\n\n if ($animateCss) {\n $animateCss(element, {\n addClass: 'in',\n easing: 'ease',\n to: { height: element[0].scrollHeight + 'px' }\n }).start()['finally'](expandDone);\n } else {\n $animate.addClass(element, 'in', {\n to: { height: element[0].scrollHeight + 'px' }\n }).then(expandDone);\n }\n });\n }\n\n function expandDone() {\n element.removeClass('collapsing')\n .addClass('collapse')\n .css({height: 'auto'});\n expandedExpr(scope);\n }\n\n function collapse() {\n if (!element.hasClass('collapse') && !element.hasClass('in')) {\n return collapseDone();\n }\n\n $q.resolve(collapsingExpr(scope))\n .then(function() {\n element\n // IMPORTANT: The height must be set before adding \"collapsing\" class.\n // Otherwise, the browser attempts to animate from height 0 (in\n // collapsing class) to the given height here.\n .css({height: element[0].scrollHeight + 'px'})\n // initially all panel collapse have the collapse class, this removal\n // prevents the animation from jumping to collapsed state\n .removeClass('collapse')\n .addClass('collapsing')\n .attr('aria-expanded', false)\n .attr('aria-hidden', true);\n\n if ($animateCss) {\n $animateCss(element, {\n removeClass: 'in',\n to: {height: '0'}\n }).start()['finally'](collapseDone);\n } else {\n $animate.removeClass(element, 'in', {\n to: {height: '0'}\n }).then(collapseDone);\n }\n });\n }\n\n function collapseDone() {\n element.css({height: '0'}); // Required so that collapse works when animation is disabled\n element.removeClass('collapsing')\n .addClass('collapse');\n collapsedExpr(scope);\n }\n\n scope.$watch(attrs.uibCollapse, function(shouldCollapse) {\n if (shouldCollapse) {\n collapse();\n } else {\n expand();\n }\n });\n }\n };\n }]);\n\nangular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])\n\n.constant('uibAccordionConfig', {\n closeOthers: true\n})\n\n.controller('UibAccordionController', ['$scope', '$attrs', 'uibAccordionConfig', function($scope, $attrs, accordionConfig) {\n // This array keeps track of the accordion groups\n this.groups = [];\n\n // Ensure that all the groups in this accordion are closed, unless close-others explicitly says not to\n this.closeOthers = function(openGroup) {\n var closeOthers = angular.isDefined($attrs.closeOthers) ?\n $scope.$eval($attrs.closeOthers) : accordionConfig.closeOthers;\n if (closeOthers) {\n angular.forEach(this.groups, function(group) {\n if (group !== openGroup) {\n group.isOpen = false;\n }\n });\n }\n };\n\n // This is called from the accordion-group directive to add itself to the accordion\n this.addGroup = function(groupScope) {\n var that = this;\n this.groups.push(groupScope);\n\n groupScope.$on('$destroy', function(event) {\n that.removeGroup(groupScope);\n });\n };\n\n // This is called from the accordion-group directive when to remove itself\n this.removeGroup = function(group) {\n var index = this.groups.indexOf(group);\n if (index !== -1) {\n this.groups.splice(index, 1);\n }\n };\n}])\n\n// The accordion directive simply sets up the directive controller\n// and adds an accordion CSS class to itself element.\n.directive('uibAccordion', function() {\n return {\n controller: 'UibAccordionController',\n controllerAs: 'accordion',\n transclude: true,\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/accordion/accordion.html';\n }\n };\n})\n\n// The accordion-group directive indicates a block of html that will expand and collapse in an accordion\n.directive('uibAccordionGroup', function() {\n return {\n require: '^uibAccordion', // We need this directive to be inside an accordion\n transclude: true, // It transcludes the contents of the directive into the template\n replace: true, // The element containing the directive will be replaced with the template\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/accordion/accordion-group.html';\n },\n scope: {\n heading: '@', // Interpolate the heading attribute onto this scope\n isOpen: '=?',\n isDisabled: '=?'\n },\n controller: function() {\n this.setHeading = function(element) {\n this.heading = element;\n };\n },\n link: function(scope, element, attrs, accordionCtrl) {\n accordionCtrl.addGroup(scope);\n\n scope.openClass = attrs.openClass || 'panel-open';\n scope.panelClass = attrs.panelClass || 'panel-default';\n scope.$watch('isOpen', function(value) {\n element.toggleClass(scope.openClass, !!value);\n if (value) {\n accordionCtrl.closeOthers(scope);\n }\n });\n\n scope.toggleOpen = function($event) {\n if (!scope.isDisabled) {\n if (!$event || $event.which === 32) {\n scope.isOpen = !scope.isOpen;\n }\n }\n };\n\n var id = 'accordiongroup-' + scope.$id + '-' + Math.floor(Math.random() * 10000);\n scope.headingId = id + '-tab';\n scope.panelId = id + '-panel';\n }\n };\n})\n\n// Use accordion-heading below an accordion-group to provide a heading containing HTML\n.directive('uibAccordionHeading', function() {\n return {\n transclude: true, // Grab the contents to be used as the heading\n template: '', // In effect remove this element!\n replace: true,\n require: '^uibAccordionGroup',\n link: function(scope, element, attrs, accordionGroupCtrl, transclude) {\n // Pass the heading to the accordion-group controller\n // so that it can be transcluded into the right place in the template\n // [The second parameter to transclude causes the elements to be cloned so that they work in ng-repeat]\n accordionGroupCtrl.setHeading(transclude(scope, angular.noop));\n }\n };\n})\n\n// Use in the accordion-group template to indicate where you want the heading to be transcluded\n// You must provide the property on the accordion-group controller that will hold the transcluded element\n.directive('uibAccordionTransclude', function() {\n return {\n require: '^uibAccordionGroup',\n link: function(scope, element, attrs, controller) {\n scope.$watch(function() { return controller[attrs.uibAccordionTransclude]; }, function(heading) {\n if (heading) {\n element.find('span').html('');\n element.find('span').append(heading);\n }\n });\n }\n };\n});\n\nangular.module('ui.bootstrap.alert', [])\n\n.controller('UibAlertController', ['$scope', '$attrs', '$interpolate', '$timeout', function($scope, $attrs, $interpolate, $timeout) {\n $scope.closeable = !!$attrs.close;\n\n var dismissOnTimeout = angular.isDefined($attrs.dismissOnTimeout) ?\n $interpolate($attrs.dismissOnTimeout)($scope.$parent) : null;\n\n if (dismissOnTimeout) {\n $timeout(function() {\n $scope.close();\n }, parseInt(dismissOnTimeout, 10));\n }\n}])\n\n.directive('uibAlert', function() {\n return {\n controller: 'UibAlertController',\n controllerAs: 'alert',\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/alert/alert.html';\n },\n transclude: true,\n replace: true,\n scope: {\n type: '@',\n close: '&'\n }\n };\n});\n\nangular.module('ui.bootstrap.buttons', [])\n\n.constant('uibButtonConfig', {\n activeClass: 'active',\n toggleEvent: 'click'\n})\n\n.controller('UibButtonsController', ['uibButtonConfig', function(buttonConfig) {\n this.activeClass = buttonConfig.activeClass || 'active';\n this.toggleEvent = buttonConfig.toggleEvent || 'click';\n}])\n\n.directive('uibBtnRadio', ['$parse', function($parse) {\n return {\n require: ['uibBtnRadio', 'ngModel'],\n controller: 'UibButtonsController',\n controllerAs: 'buttons',\n link: function(scope, element, attrs, ctrls) {\n var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1];\n var uncheckableExpr = $parse(attrs.uibUncheckable);\n\n element.find('input').css({display: 'none'});\n\n //model -> UI\n ngModelCtrl.$render = function() {\n element.toggleClass(buttonsCtrl.activeClass, angular.equals(ngModelCtrl.$modelValue, scope.$eval(attrs.uibBtnRadio)));\n };\n\n //ui->model\n element.on(buttonsCtrl.toggleEvent, function() {\n if (attrs.disabled) {\n return;\n }\n\n var isActive = element.hasClass(buttonsCtrl.activeClass);\n\n if (!isActive || angular.isDefined(attrs.uncheckable)) {\n scope.$apply(function() {\n ngModelCtrl.$setViewValue(isActive ? null : scope.$eval(attrs.uibBtnRadio));\n ngModelCtrl.$render();\n });\n }\n });\n\n if (attrs.uibUncheckable) {\n scope.$watch(uncheckableExpr, function(uncheckable) {\n attrs.$set('uncheckable', uncheckable ? '' : null);\n });\n }\n }\n };\n}])\n\n.directive('uibBtnCheckbox', function() {\n return {\n require: ['uibBtnCheckbox', 'ngModel'],\n controller: 'UibButtonsController',\n controllerAs: 'button',\n link: function(scope, element, attrs, ctrls) {\n var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1];\n\n element.find('input').css({display: 'none'});\n\n function getTrueValue() {\n return getCheckboxValue(attrs.btnCheckboxTrue, true);\n }\n\n function getFalseValue() {\n return getCheckboxValue(attrs.btnCheckboxFalse, false);\n }\n\n function getCheckboxValue(attribute, defaultValue) {\n return angular.isDefined(attribute) ? scope.$eval(attribute) : defaultValue;\n }\n\n //model -> UI\n ngModelCtrl.$render = function() {\n element.toggleClass(buttonsCtrl.activeClass, angular.equals(ngModelCtrl.$modelValue, getTrueValue()));\n };\n\n //ui->model\n element.on(buttonsCtrl.toggleEvent, function() {\n if (attrs.disabled) {\n return;\n }\n\n scope.$apply(function() {\n ngModelCtrl.$setViewValue(element.hasClass(buttonsCtrl.activeClass) ? getFalseValue() : getTrueValue());\n ngModelCtrl.$render();\n });\n });\n }\n };\n});\n\nangular.module('ui.bootstrap.carousel', [])\n\n.controller('UibCarouselController', ['$scope', '$element', '$interval', '$timeout', '$animate', function($scope, $element, $interval, $timeout, $animate) {\n var self = this,\n slides = self.slides = $scope.slides = [],\n SLIDE_DIRECTION = 'uib-slideDirection',\n currentIndex = -1,\n currentInterval, isPlaying, bufferedTransitions = [];\n self.currentSlide = null;\n\n var destroyed = false;\n\n self.addSlide = function(slide, element) {\n slide.$element = element;\n slides.push(slide);\n //if this is the first slide or the slide is set to active, select it\n if (slides.length === 1 || slide.active) {\n if ($scope.$currentTransition) {\n $scope.$currentTransition = null;\n }\n\n self.select(slides[slides.length - 1]);\n if (slides.length === 1) {\n $scope.play();\n }\n } else {\n slide.active = false;\n }\n };\n\n self.getCurrentIndex = function() {\n if (self.currentSlide && angular.isDefined(self.currentSlide.index)) {\n return +self.currentSlide.index;\n }\n return currentIndex;\n };\n\n self.next = $scope.next = function() {\n var newIndex = (self.getCurrentIndex() + 1) % slides.length;\n\n if (newIndex === 0 && $scope.noWrap()) {\n $scope.pause();\n return;\n }\n\n return self.select(getSlideByIndex(newIndex), 'next');\n };\n\n self.prev = $scope.prev = function() {\n var newIndex = self.getCurrentIndex() - 1 < 0 ? slides.length - 1 : self.getCurrentIndex() - 1;\n\n if ($scope.noWrap() && newIndex === slides.length - 1) {\n $scope.pause();\n return;\n }\n\n return self.select(getSlideByIndex(newIndex), 'prev');\n };\n\n self.removeSlide = function(slide) {\n if (angular.isDefined(slide.index)) {\n slides.sort(function(a, b) {\n return +a.index > +b.index;\n });\n }\n\n var bufferedIndex = bufferedTransitions.indexOf(slide);\n if (bufferedIndex !== -1) {\n bufferedTransitions.splice(bufferedIndex, 1);\n }\n //get the index of the slide inside the carousel\n var index = slides.indexOf(slide);\n slides.splice(index, 1);\n $timeout(function() {\n if (slides.length > 0 && slide.active) {\n if (index >= slides.length) {\n self.select(slides[index - 1]);\n } else {\n self.select(slides[index]);\n }\n } else if (currentIndex > index) {\n currentIndex--;\n }\n });\n\n //clean the currentSlide when no more slide\n if (slides.length === 0) {\n self.currentSlide = null;\n clearBufferedTransitions();\n }\n };\n\n /* direction: \"prev\" or \"next\" */\n self.select = $scope.select = function(nextSlide, direction) {\n var nextIndex = $scope.indexOfSlide(nextSlide);\n //Decide direction if it's not given\n if (direction === undefined) {\n direction = nextIndex > self.getCurrentIndex() ? 'next' : 'prev';\n }\n //Prevent this user-triggered transition from occurring if there is already one in progress\n if (nextSlide && nextSlide !== self.currentSlide && !$scope.$currentTransition) {\n goNext(nextSlide, nextIndex, direction);\n } else if (nextSlide && nextSlide !== self.currentSlide && $scope.$currentTransition) {\n bufferedTransitions.push(nextSlide);\n nextSlide.active = false;\n }\n };\n\n /* Allow outside people to call indexOf on slides array */\n $scope.indexOfSlide = function(slide) {\n return angular.isDefined(slide.index) ? +slide.index : slides.indexOf(slide);\n };\n\n $scope.isActive = function(slide) {\n return self.currentSlide === slide;\n };\n\n $scope.pause = function() {\n if (!$scope.noPause) {\n isPlaying = false;\n resetTimer();\n }\n };\n\n $scope.play = function() {\n if (!isPlaying) {\n isPlaying = true;\n restartTimer();\n }\n };\n\n $scope.$on('$destroy', function() {\n destroyed = true;\n resetTimer();\n });\n\n $scope.$watch('noTransition', function(noTransition) {\n $animate.enabled($element, !noTransition);\n });\n\n $scope.$watch('interval', restartTimer);\n\n $scope.$watchCollection('slides', resetTransition);\n\n function clearBufferedTransitions() {\n while (bufferedTransitions.length) {\n bufferedTransitions.shift();\n }\n }\n\n function getSlideByIndex(index) {\n if (angular.isUndefined(slides[index].index)) {\n return slides[index];\n }\n for (var i = 0, l = slides.length; i < l; ++i) {\n if (slides[i].index === index) {\n return slides[i];\n }\n }\n }\n\n function goNext(slide, index, direction) {\n if (destroyed) { return; }\n\n angular.extend(slide, {direction: direction, active: true});\n angular.extend(self.currentSlide || {}, {direction: direction, active: false});\n if ($animate.enabled($element) && !$scope.$currentTransition &&\n slide.$element && self.slides.length > 1) {\n slide.$element.data(SLIDE_DIRECTION, slide.direction);\n if (self.currentSlide && self.currentSlide.$element) {\n self.currentSlide.$element.data(SLIDE_DIRECTION, slide.direction);\n }\n\n $scope.$currentTransition = true;\n $animate.on('addClass', slide.$element, function(element, phase) {\n if (phase === 'close') {\n $scope.$currentTransition = null;\n $animate.off('addClass', element);\n if (bufferedTransitions.length) {\n var nextSlide = bufferedTransitions.pop();\n var nextIndex = $scope.indexOfSlide(nextSlide);\n var nextDirection = nextIndex > self.getCurrentIndex() ? 'next' : 'prev';\n clearBufferedTransitions();\n\n goNext(nextSlide, nextIndex, nextDirection);\n }\n }\n });\n }\n\n self.currentSlide = slide;\n currentIndex = index;\n\n //every time you change slides, reset the timer\n restartTimer();\n }\n\n function resetTimer() {\n if (currentInterval) {\n $interval.cancel(currentInterval);\n currentInterval = null;\n }\n }\n\n function resetTransition(slides) {\n if (!slides.length) {\n $scope.$currentTransition = null;\n clearBufferedTransitions();\n }\n }\n\n function restartTimer() {\n resetTimer();\n var interval = +$scope.interval;\n if (!isNaN(interval) && interval > 0) {\n currentInterval = $interval(timerFn, interval);\n }\n }\n\n function timerFn() {\n var interval = +$scope.interval;\n if (isPlaying && !isNaN(interval) && interval > 0 && slides.length) {\n $scope.next();\n } else {\n $scope.pause();\n }\n }\n}])\n\n.directive('uibCarousel', function() {\n return {\n transclude: true,\n replace: true,\n controller: 'UibCarouselController',\n controllerAs: 'carousel',\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/carousel/carousel.html';\n },\n scope: {\n interval: '=',\n noTransition: '=',\n noPause: '=',\n noWrap: '&'\n }\n };\n})\n\n.directive('uibSlide', function() {\n return {\n require: '^uibCarousel',\n transclude: true,\n replace: true,\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/carousel/slide.html';\n },\n scope: {\n active: '=?',\n actual: '=?',\n index: '=?'\n },\n link: function (scope, element, attrs, carouselCtrl) {\n carouselCtrl.addSlide(scope, element);\n //when the scope is destroyed then remove the slide from the current slides array\n scope.$on('$destroy', function() {\n carouselCtrl.removeSlide(scope);\n });\n\n scope.$watch('active', function(active) {\n if (active) {\n carouselCtrl.select(scope);\n }\n });\n }\n };\n})\n\n.animation('.item', ['$animateCss',\nfunction($animateCss) {\n var SLIDE_DIRECTION = 'uib-slideDirection';\n\n function removeClass(element, className, callback) {\n element.removeClass(className);\n if (callback) {\n callback();\n }\n }\n\n return {\n beforeAddClass: function(element, className, done) {\n if (className === 'active') {\n var stopped = false;\n var direction = element.data(SLIDE_DIRECTION);\n var directionClass = direction === 'next' ? 'left' : 'right';\n var removeClassFn = removeClass.bind(this, element,\n directionClass + ' ' + direction, done);\n element.addClass(direction);\n\n $animateCss(element, {addClass: directionClass})\n .start()\n .done(removeClassFn);\n\n return function() {\n stopped = true;\n };\n }\n done();\n },\n beforeRemoveClass: function (element, className, done) {\n if (className === 'active') {\n var stopped = false;\n var direction = element.data(SLIDE_DIRECTION);\n var directionClass = direction === 'next' ? 'left' : 'right';\n var removeClassFn = removeClass.bind(this, element, directionClass, done);\n\n $animateCss(element, {addClass: directionClass})\n .start()\n .done(removeClassFn);\n\n return function() {\n stopped = true;\n };\n }\n done();\n }\n };\n}]);\n\nangular.module('ui.bootstrap.dateparser', [])\n\n.service('uibDateParser', ['$log', '$locale', 'dateFilter', 'orderByFilter', function($log, $locale, dateFilter, orderByFilter) {\n // Pulled from https://github.com/mbostock/d3/blob/master/src/format/requote.js\n var SPECIAL_CHARACTERS_REGEXP = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n var localeId;\n var formatCodeToRegex;\n\n this.init = function() {\n localeId = $locale.id;\n\n this.parsers = {};\n this.formatters = {};\n\n formatCodeToRegex = [\n {\n key: 'yyyy',\n regex: '\\\\d{4}',\n apply: function(value) { this.year = +value; },\n formatter: function(date) {\n var _date = new Date();\n _date.setFullYear(Math.abs(date.getFullYear()));\n return dateFilter(_date, 'yyyy');\n }\n },\n {\n key: 'yy',\n regex: '\\\\d{2}',\n apply: function(value) { this.year = +value + 2000; },\n formatter: function(date) {\n var _date = new Date();\n _date.setFullYear(Math.abs(date.getFullYear()));\n return dateFilter(_date, 'yy');\n }\n },\n {\n key: 'y',\n regex: '\\\\d{1,4}',\n apply: function(value) { this.year = +value; },\n formatter: function(date) {\n var _date = new Date();\n _date.setFullYear(Math.abs(date.getFullYear()));\n return dateFilter(_date, 'y');\n }\n },\n {\n key: 'M!',\n regex: '0?[1-9]|1[0-2]',\n apply: function(value) { this.month = value - 1; },\n formatter: function(date) {\n var value = date.getMonth();\n if (/^[0-9]$/.test(value)) {\n return dateFilter(date, 'MM');\n }\n\n return dateFilter(date, 'M');\n }\n },\n {\n key: 'MMMM',\n regex: $locale.DATETIME_FORMATS.MONTH.join('|'),\n apply: function(value) { this.month = $locale.DATETIME_FORMATS.MONTH.indexOf(value); },\n formatter: function(date) { return dateFilter(date, 'MMMM'); }\n },\n {\n key: 'MMM',\n regex: $locale.DATETIME_FORMATS.SHORTMONTH.join('|'),\n apply: function(value) { this.month = $locale.DATETIME_FORMATS.SHORTMONTH.indexOf(value); },\n formatter: function(date) { return dateFilter(date, 'MMM'); }\n },\n {\n key: 'MM',\n regex: '0[1-9]|1[0-2]',\n apply: function(value) { this.month = value - 1; },\n formatter: function(date) { return dateFilter(date, 'MM'); }\n },\n {\n key: 'M',\n regex: '[1-9]|1[0-2]',\n apply: function(value) { this.month = value - 1; },\n formatter: function(date) { return dateFilter(date, 'M'); }\n },\n {\n key: 'd!',\n regex: '[0-2]?[0-9]{1}|3[0-1]{1}',\n apply: function(value) { this.date = +value; },\n formatter: function(date) {\n var value = date.getDate();\n if (/^[1-9]$/.test(value)) {\n return dateFilter(date, 'dd');\n }\n\n return dateFilter(date, 'd');\n }\n },\n {\n key: 'dd',\n regex: '[0-2][0-9]{1}|3[0-1]{1}',\n apply: function(value) { this.date = +value; },\n formatter: function(date) { return dateFilter(date, 'dd'); }\n },\n {\n key: 'd',\n regex: '[1-2]?[0-9]{1}|3[0-1]{1}',\n apply: function(value) { this.date = +value; },\n formatter: function(date) { return dateFilter(date, 'd'); }\n },\n {\n key: 'EEEE',\n regex: $locale.DATETIME_FORMATS.DAY.join('|'),\n formatter: function(date) { return dateFilter(date, 'EEEE'); }\n },\n {\n key: 'EEE',\n regex: $locale.DATETIME_FORMATS.SHORTDAY.join('|'),\n formatter: function(date) { return dateFilter(date, 'EEE'); }\n },\n {\n key: 'HH',\n regex: '(?:0|1)[0-9]|2[0-3]',\n apply: function(value) { this.hours = +value; },\n formatter: function(date) { return dateFilter(date, 'HH'); }\n },\n {\n key: 'hh',\n regex: '0[0-9]|1[0-2]',\n apply: function(value) { this.hours = +value; },\n formatter: function(date) { return dateFilter(date, 'hh'); }\n },\n {\n key: 'H',\n regex: '1?[0-9]|2[0-3]',\n apply: function(value) { this.hours = +value; },\n formatter: function(date) { return dateFilter(date, 'H'); }\n },\n {\n key: 'h',\n regex: '[0-9]|1[0-2]',\n apply: function(value) { this.hours = +value; },\n formatter: function(date) { return dateFilter(date, 'h'); }\n },\n {\n key: 'mm',\n regex: '[0-5][0-9]',\n apply: function(value) { this.minutes = +value; },\n formatter: function(date) { return dateFilter(date, 'mm'); }\n },\n {\n key: 'm',\n regex: '[0-9]|[1-5][0-9]',\n apply: function(value) { this.minutes = +value; },\n formatter: function(date) { return dateFilter(date, 'm'); }\n },\n {\n key: 'sss',\n regex: '[0-9][0-9][0-9]',\n apply: function(value) { this.milliseconds = +value; },\n formatter: function(date) { return dateFilter(date, 'sss'); }\n },\n {\n key: 'ss',\n regex: '[0-5][0-9]',\n apply: function(value) { this.seconds = +value; },\n formatter: function(date) { return dateFilter(date, 'ss'); }\n },\n {\n key: 's',\n regex: '[0-9]|[1-5][0-9]',\n apply: function(value) { this.seconds = +value; },\n formatter: function(date) { return dateFilter(date, 's'); }\n },\n {\n key: 'a',\n regex: $locale.DATETIME_FORMATS.AMPMS.join('|'),\n apply: function(value) {\n if (this.hours === 12) {\n this.hours = 0;\n }\n\n if (value === 'PM') {\n this.hours += 12;\n }\n },\n formatter: function(date) { return dateFilter(date, 'a'); }\n },\n {\n key: 'Z',\n regex: '[+-]\\\\d{4}',\n apply: function(value) {\n var matches = value.match(/([+-])(\\d{2})(\\d{2})/),\n sign = matches[1],\n hours = matches[2],\n minutes = matches[3];\n this.hours += toInt(sign + hours);\n this.minutes += toInt(sign + minutes);\n },\n formatter: function(date) {\n return dateFilter(date, 'Z');\n }\n },\n {\n key: 'ww',\n regex: '[0-4][0-9]|5[0-3]',\n formatter: function(date) { return dateFilter(date, 'ww'); }\n },\n {\n key: 'w',\n regex: '[0-9]|[1-4][0-9]|5[0-3]',\n formatter: function(date) { return dateFilter(date, 'w'); }\n },\n {\n key: 'GGGG',\n regex: $locale.DATETIME_FORMATS.ERANAMES.join('|').replace(/\\s/g, '\\\\s'),\n formatter: function(date) { return dateFilter(date, 'GGGG'); }\n },\n {\n key: 'GGG',\n regex: $locale.DATETIME_FORMATS.ERAS.join('|'),\n formatter: function(date) { return dateFilter(date, 'GGG'); }\n },\n {\n key: 'GG',\n regex: $locale.DATETIME_FORMATS.ERAS.join('|'),\n formatter: function(date) { return dateFilter(date, 'GG'); }\n },\n {\n key: 'G',\n regex: $locale.DATETIME_FORMATS.ERAS.join('|'),\n formatter: function(date) { return dateFilter(date, 'G'); }\n }\n ];\n };\n\n this.init();\n\n function createParser(format, func) {\n var map = [], regex = format.split('');\n\n // check for literal values\n var quoteIndex = format.indexOf('\\'');\n if (quoteIndex > -1) {\n var inLiteral = false;\n format = format.split('');\n for (var i = quoteIndex; i < format.length; i++) {\n if (inLiteral) {\n if (format[i] === '\\'') {\n if (i + 1 < format.length && format[i+1] === '\\'') { // escaped single quote\n format[i+1] = '$';\n regex[i+1] = '';\n } else { // end of literal\n regex[i] = '';\n inLiteral = false;\n }\n }\n format[i] = '$';\n } else {\n if (format[i] === '\\'') { // start of literal\n format[i] = '$';\n regex[i] = '';\n inLiteral = true;\n }\n }\n }\n\n format = format.join('');\n }\n\n angular.forEach(formatCodeToRegex, function(data) {\n var index = format.indexOf(data.key);\n\n if (index > -1) {\n format = format.split('');\n\n regex[index] = '(' + data.regex + ')';\n format[index] = '$'; // Custom symbol to define consumed part of format\n for (var i = index + 1, n = index + data.key.length; i < n; i++) {\n regex[i] = '';\n format[i] = '$';\n }\n format = format.join('');\n\n map.push({\n index: index,\n key: data.key,\n apply: data[func],\n matcher: data.regex\n });\n }\n });\n\n return {\n regex: new RegExp('^' + regex.join('') + '$'),\n map: orderByFilter(map, 'index')\n };\n }\n\n this.filter = function(date, format) {\n if (!angular.isDate(date) || isNaN(date) || !format) {\n return '';\n }\n\n format = $locale.DATETIME_FORMATS[format] || format;\n\n if ($locale.id !== localeId) {\n this.init();\n }\n\n if (!this.formatters[format]) {\n this.formatters[format] = createParser(format, 'formatter');\n }\n\n var parser = this.formatters[format],\n map = parser.map;\n\n var _format = format;\n\n return map.reduce(function(str, mapper, i) {\n var match = _format.match(new RegExp('(.*)' + mapper.key));\n if (match && angular.isString(match[1])) {\n str += match[1];\n _format = _format.replace(match[1] + mapper.key, '');\n }\n\n if (mapper.apply) {\n return str + mapper.apply.call(null, date);\n }\n\n return str;\n }, '');\n };\n\n this.parse = function(input, format, baseDate) {\n if (!angular.isString(input) || !format) {\n return input;\n }\n\n format = $locale.DATETIME_FORMATS[format] || format;\n format = format.replace(SPECIAL_CHARACTERS_REGEXP, '\\\\$&');\n\n if ($locale.id !== localeId) {\n this.init();\n }\n\n if (!this.parsers[format]) {\n this.parsers[format] = createParser(format, 'apply');\n }\n\n var parser = this.parsers[format],\n regex = parser.regex,\n map = parser.map,\n results = input.match(regex),\n tzOffset = false;\n if (results && results.length) {\n var fields, dt;\n if (angular.isDate(baseDate) && !isNaN(baseDate.getTime())) {\n fields = {\n year: baseDate.getFullYear(),\n month: baseDate.getMonth(),\n date: baseDate.getDate(),\n hours: baseDate.getHours(),\n minutes: baseDate.getMinutes(),\n seconds: baseDate.getSeconds(),\n milliseconds: baseDate.getMilliseconds()\n };\n } else {\n if (baseDate) {\n $log.warn('dateparser:', 'baseDate is not a valid date');\n }\n fields = { year: 1900, month: 0, date: 1, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 };\n }\n\n for (var i = 1, n = results.length; i < n; i++) {\n var mapper = map[i - 1];\n if (mapper.matcher === 'Z') {\n tzOffset = true;\n }\n\n if (mapper.apply) {\n mapper.apply.call(fields, results[i]);\n }\n }\n\n var datesetter = tzOffset ? Date.prototype.setUTCFullYear :\n Date.prototype.setFullYear;\n var timesetter = tzOffset ? Date.prototype.setUTCHours :\n Date.prototype.setHours;\n\n if (isValid(fields.year, fields.month, fields.date)) {\n if (angular.isDate(baseDate) && !isNaN(baseDate.getTime()) && !tzOffset) {\n dt = new Date(baseDate);\n datesetter.call(dt, fields.year, fields.month, fields.date);\n timesetter.call(dt, fields.hours, fields.minutes,\n fields.seconds, fields.milliseconds);\n } else {\n dt = new Date(0);\n datesetter.call(dt, fields.year, fields.month, fields.date);\n timesetter.call(dt, fields.hours || 0, fields.minutes || 0,\n fields.seconds || 0, fields.milliseconds || 0);\n }\n }\n\n return dt;\n }\n };\n\n // Check if date is valid for specific month (and year for February).\n // Month: 0 = Jan, 1 = Feb, etc\n function isValid(year, month, date) {\n if (date < 1) {\n return false;\n }\n\n if (month === 1 && date > 28) {\n return date === 29 && (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0);\n }\n\n if (month === 3 || month === 5 || month === 8 || month === 10) {\n return date < 31;\n }\n\n return true;\n }\n\n function toInt(str) {\n return parseInt(str, 10);\n }\n\n this.toTimezone = toTimezone;\n this.fromTimezone = fromTimezone;\n this.timezoneToOffset = timezoneToOffset;\n this.addDateMinutes = addDateMinutes;\n this.convertTimezoneToLocal = convertTimezoneToLocal;\n\n function toTimezone(date, timezone) {\n return date && timezone ? convertTimezoneToLocal(date, timezone) : date;\n }\n\n function fromTimezone(date, timezone) {\n return date && timezone ? convertTimezoneToLocal(date, timezone, true) : date;\n }\n\n //https://github.com/angular/angular.js/blob/4daafd3dbe6a80d578f5a31df1bb99c77559543e/src/Angular.js#L1207\n function timezoneToOffset(timezone, fallback) {\n var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;\n return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;\n }\n\n function addDateMinutes(date, minutes) {\n date = new Date(date.getTime());\n date.setMinutes(date.getMinutes() + minutes);\n return date;\n }\n\n function convertTimezoneToLocal(date, timezone, reverse) {\n reverse = reverse ? -1 : 1;\n var timezoneOffset = timezoneToOffset(timezone, date.getTimezoneOffset());\n return addDateMinutes(date, reverse * (timezoneOffset - date.getTimezoneOffset()));\n }\n}]);\n\n// Avoiding use of ng-class as it creates a lot of watchers when a class is to be applied to\n// at most one element.\nangular.module('ui.bootstrap.isClass', [])\n.directive('uibIsClass', [\n '$animate',\nfunction ($animate) {\n // 11111111 22222222\n var ON_REGEXP = /^\\s*([\\s\\S]+?)\\s+on\\s+([\\s\\S]+?)\\s*$/;\n // 11111111 22222222\n var IS_REGEXP = /^\\s*([\\s\\S]+?)\\s+for\\s+([\\s\\S]+?)\\s*$/;\n\n var dataPerTracked = {};\n\n return {\n restrict: 'A',\n compile: function (tElement, tAttrs) {\n var linkedScopes = [];\n var instances = [];\n var expToData = {};\n var lastActivated = null;\n var onExpMatches = tAttrs.uibIsClass.match(ON_REGEXP);\n var onExp = onExpMatches[2];\n var expsStr = onExpMatches[1];\n var exps = expsStr.split(',');\n\n return linkFn;\n\n function linkFn(scope, element, attrs) {\n linkedScopes.push(scope);\n instances.push({\n scope: scope,\n element: element\n });\n\n exps.forEach(function (exp, k) {\n addForExp(exp, scope);\n });\n\n scope.$on('$destroy', removeScope);\n }\n\n function addForExp(exp, scope) {\n var matches = exp.match(IS_REGEXP);\n var clazz = scope.$eval(matches[1]);\n var compareWithExp = matches[2];\n var data = expToData[exp];\n if (!data) {\n var watchFn = function (compareWithVal) {\n var newActivated = null;\n instances.some(function (instance) {\n var thisVal = instance.scope.$eval(onExp);\n if (thisVal === compareWithVal) {\n newActivated = instance;\n return true;\n }\n });\n if (data.lastActivated !== newActivated) {\n if (data.lastActivated) {\n $animate.removeClass(data.lastActivated.element, clazz);\n }\n if (newActivated) {\n $animate.addClass(newActivated.element, clazz);\n }\n data.lastActivated = newActivated;\n }\n };\n expToData[exp] = data = {\n lastActivated: null,\n scope: scope,\n watchFn: watchFn,\n compareWithExp: compareWithExp,\n watcher: scope.$watch(compareWithExp, watchFn)\n };\n }\n data.watchFn(scope.$eval(compareWithExp));\n }\n\n function removeScope(e) {\n var removedScope = e.targetScope;\n var index = linkedScopes.indexOf(removedScope);\n linkedScopes.splice(index, 1);\n instances.splice(index, 1);\n if (linkedScopes.length) {\n var newWatchScope = linkedScopes[0];\n angular.forEach(expToData, function (data) {\n if (data.scope === removedScope) {\n data.watcher = newWatchScope.$watch(data.compareWithExp, data.watchFn);\n data.scope = newWatchScope;\n }\n });\n }\n else {\n expToData = {};\n }\n }\n }\n };\n}]);\nangular.module('ui.bootstrap.position', [])\n\n/**\n * A set of utility methods for working with the DOM.\n * It is meant to be used where we need to absolute-position elements in\n * relation to another element (this is the case for tooltips, popovers,\n * typeahead suggestions etc.).\n */\n .factory('$uibPosition', ['$document', '$window', function($document, $window) {\n /**\n * Used by scrollbarWidth() function to cache scrollbar's width.\n * Do not access this variable directly, use scrollbarWidth() instead.\n */\n var SCROLLBAR_WIDTH;\n var OVERFLOW_REGEX = {\n normal: /(auto|scroll)/,\n hidden: /(auto|scroll|hidden)/\n };\n var PLACEMENT_REGEX = {\n auto: /\\s?auto?\\s?/i,\n primary: /^(top|bottom|left|right)$/,\n secondary: /^(top|bottom|left|right|center)$/,\n vertical: /^(top|bottom)$/\n };\n\n return {\n\n /**\n * Provides a raw DOM element from a jQuery/jQLite element.\n *\n * @param {element} elem - The element to convert.\n *\n * @returns {element} A HTML element.\n */\n getRawNode: function(elem) {\n return elem[0] || elem;\n },\n\n /**\n * Provides a parsed number for a style property. Strips\n * units and casts invalid numbers to 0.\n *\n * @param {string} value - The style value to parse.\n *\n * @returns {number} A valid number.\n */\n parseStyle: function(value) {\n value = parseFloat(value);\n return isFinite(value) ? value : 0;\n },\n\n /**\n * Provides the closest positioned ancestor.\n *\n * @param {element} element - The element to get the offest parent for.\n *\n * @returns {element} The closest positioned ancestor.\n */\n offsetParent: function(elem) {\n elem = this.getRawNode(elem);\n\n var offsetParent = elem.offsetParent || $document[0].documentElement;\n\n function isStaticPositioned(el) {\n return ($window.getComputedStyle(el).position || 'static') === 'static';\n }\n\n while (offsetParent && offsetParent !== $document[0].documentElement && isStaticPositioned(offsetParent)) {\n offsetParent = offsetParent.offsetParent;\n }\n\n return offsetParent || $document[0].documentElement;\n },\n\n /**\n * Provides the scrollbar width, concept from TWBS measureScrollbar()\n * function in https://github.com/twbs/bootstrap/blob/master/js/modal.js\n *\n * @returns {number} The width of the browser scollbar.\n */\n scrollbarWidth: function() {\n if (angular.isUndefined(SCROLLBAR_WIDTH)) {\n var scrollElem = angular.element('');\n $document.find('body').append(scrollElem);\n SCROLLBAR_WIDTH = scrollElem[0].offsetWidth - scrollElem[0].clientWidth;\n SCROLLBAR_WIDTH = isFinite(SCROLLBAR_WIDTH) ? SCROLLBAR_WIDTH : 0;\n scrollElem.remove();\n }\n\n return SCROLLBAR_WIDTH;\n },\n\n /**\n * Provides the closest scrollable ancestor.\n * A port of the jQuery UI scrollParent method:\n * https://github.com/jquery/jquery-ui/blob/master/ui/scroll-parent.js\n *\n * @param {element} elem - The element to find the scroll parent of.\n * @param {boolean=} [includeHidden=false] - Should scroll style of 'hidden' be considered,\n * default is false.\n *\n * @returns {element} A HTML element.\n */\n scrollParent: function(elem, includeHidden) {\n elem = this.getRawNode(elem);\n\n var overflowRegex = includeHidden ? OVERFLOW_REGEX.hidden : OVERFLOW_REGEX.normal;\n var documentEl = $document[0].documentElement;\n var elemStyle = $window.getComputedStyle(elem);\n var excludeStatic = elemStyle.position === 'absolute';\n var scrollParent = elem.parentElement || documentEl;\n\n if (scrollParent === documentEl || elemStyle.position === 'fixed') {\n return documentEl;\n }\n\n while (scrollParent.parentElement && scrollParent !== documentEl) {\n var spStyle = $window.getComputedStyle(scrollParent);\n if (excludeStatic && spStyle.position !== 'static') {\n excludeStatic = false;\n }\n\n if (!excludeStatic && overflowRegex.test(spStyle.overflow + spStyle.overflowY + spStyle.overflowX)) {\n break;\n }\n scrollParent = scrollParent.parentElement;\n }\n\n return scrollParent;\n },\n\n /**\n * Provides read-only equivalent of jQuery's position function:\n * http://api.jquery.com/position/ - distance to closest positioned\n * ancestor. Does not account for margins by default like jQuery position.\n *\n * @param {element} elem - The element to caclulate the position on.\n * @param {boolean=} [includeMargins=false] - Should margins be accounted\n * for, default is false.\n *\n * @returns {object} An object with the following properties:\n * \n * - **width**: the width of the element
\n * - **height**: the height of the element
\n * - **top**: distance to top edge of offset parent
\n * - **left**: distance to left edge of offset parent
\n *
\n */\n position: function(elem, includeMagins) {\n elem = this.getRawNode(elem);\n\n var elemOffset = this.offset(elem);\n if (includeMagins) {\n var elemStyle = $window.getComputedStyle(elem);\n elemOffset.top -= this.parseStyle(elemStyle.marginTop);\n elemOffset.left -= this.parseStyle(elemStyle.marginLeft);\n }\n var parent = this.offsetParent(elem);\n var parentOffset = {top: 0, left: 0};\n\n if (parent !== $document[0].documentElement) {\n parentOffset = this.offset(parent);\n parentOffset.top += parent.clientTop - parent.scrollTop;\n parentOffset.left += parent.clientLeft - parent.scrollLeft;\n }\n\n return {\n width: Math.round(angular.isNumber(elemOffset.width) ? elemOffset.width : elem.offsetWidth),\n height: Math.round(angular.isNumber(elemOffset.height) ? elemOffset.height : elem.offsetHeight),\n top: Math.round(elemOffset.top - parentOffset.top),\n left: Math.round(elemOffset.left - parentOffset.left)\n };\n },\n\n /**\n * Provides read-only equivalent of jQuery's offset function:\n * http://api.jquery.com/offset/ - distance to viewport. Does\n * not account for borders, margins, or padding on the body\n * element.\n *\n * @param {element} elem - The element to calculate the offset on.\n *\n * @returns {object} An object with the following properties:\n * \n * - **width**: the width of the element
\n * - **height**: the height of the element
\n * - **top**: distance to top edge of viewport
\n * - **right**: distance to bottom edge of viewport
\n *
\n */\n offset: function(elem) {\n elem = this.getRawNode(elem);\n\n var elemBCR = elem.getBoundingClientRect();\n return {\n width: Math.round(angular.isNumber(elemBCR.width) ? elemBCR.width : elem.offsetWidth),\n height: Math.round(angular.isNumber(elemBCR.height) ? elemBCR.height : elem.offsetHeight),\n top: Math.round(elemBCR.top + ($window.pageYOffset || $document[0].documentElement.scrollTop)),\n left: Math.round(elemBCR.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft))\n };\n },\n\n /**\n * Provides offset distance to the closest scrollable ancestor\n * or viewport. Accounts for border and scrollbar width.\n *\n * Right and bottom dimensions represent the distance to the\n * respective edge of the viewport element. If the element\n * edge extends beyond the viewport, a negative value will be\n * reported.\n *\n * @param {element} elem - The element to get the viewport offset for.\n * @param {boolean=} [useDocument=false] - Should the viewport be the document element instead\n * of the first scrollable element, default is false.\n * @param {boolean=} [includePadding=true] - Should the padding on the offset parent element\n * be accounted for, default is true.\n *\n * @returns {object} An object with the following properties:\n * \n * - **top**: distance to the top content edge of viewport element
\n * - **bottom**: distance to the bottom content edge of viewport element
\n * - **left**: distance to the left content edge of viewport element
\n * - **right**: distance to the right content edge of viewport element
\n *
\n */\n viewportOffset: function(elem, useDocument, includePadding) {\n elem = this.getRawNode(elem);\n includePadding = includePadding !== false ? true : false;\n\n var elemBCR = elem.getBoundingClientRect();\n var offsetBCR = {top: 0, left: 0, bottom: 0, right: 0};\n\n var offsetParent = useDocument ? $document[0].documentElement : this.scrollParent(elem);\n var offsetParentBCR = offsetParent.getBoundingClientRect();\n\n offsetBCR.top = offsetParentBCR.top + offsetParent.clientTop;\n offsetBCR.left = offsetParentBCR.left + offsetParent.clientLeft;\n if (offsetParent === $document[0].documentElement) {\n offsetBCR.top += $window.pageYOffset;\n offsetBCR.left += $window.pageXOffset;\n }\n offsetBCR.bottom = offsetBCR.top + offsetParent.clientHeight;\n offsetBCR.right = offsetBCR.left + offsetParent.clientWidth;\n\n if (includePadding) {\n var offsetParentStyle = $window.getComputedStyle(offsetParent);\n offsetBCR.top += this.parseStyle(offsetParentStyle.paddingTop);\n offsetBCR.bottom -= this.parseStyle(offsetParentStyle.paddingBottom);\n offsetBCR.left += this.parseStyle(offsetParentStyle.paddingLeft);\n offsetBCR.right -= this.parseStyle(offsetParentStyle.paddingRight);\n }\n\n return {\n top: Math.round(elemBCR.top - offsetBCR.top),\n bottom: Math.round(offsetBCR.bottom - elemBCR.bottom),\n left: Math.round(elemBCR.left - offsetBCR.left),\n right: Math.round(offsetBCR.right - elemBCR.right)\n };\n },\n\n /**\n * Provides an array of placement values parsed from a placement string.\n * Along with the 'auto' indicator, supported placement strings are:\n * \n * - top: element on top, horizontally centered on host element.
\n * - top-left: element on top, left edge aligned with host element left edge.
\n * - top-right: element on top, lerightft edge aligned with host element right edge.
\n * - bottom: element on bottom, horizontally centered on host element.
\n * - bottom-left: element on bottom, left edge aligned with host element left edge.
\n * - bottom-right: element on bottom, right edge aligned with host element right edge.
\n * - left: element on left, vertically centered on host element.
\n * - left-top: element on left, top edge aligned with host element top edge.
\n * - left-bottom: element on left, bottom edge aligned with host element bottom edge.
\n * - right: element on right, vertically centered on host element.
\n * - right-top: element on right, top edge aligned with host element top edge.
\n * - right-bottom: element on right, bottom edge aligned with host element bottom edge.
\n *
\n * A placement string with an 'auto' indicator is expected to be\n * space separated from the placement, i.e: 'auto bottom-left' If\n * the primary and secondary placement values do not match 'top,\n * bottom, left, right' then 'top' will be the primary placement and\n * 'center' will be the secondary placement. If 'auto' is passed, true\n * will be returned as the 3rd value of the array.\n *\n * @param {string} placement - The placement string to parse.\n *\n * @returns {array} An array with the following values\n * \n * - **[0]**: The primary placement.
\n * - **[1]**: The secondary placement.
\n * - **[2]**: If auto is passed: true, else undefined.
\n *
\n */\n parsePlacement: function(placement) {\n var autoPlace = PLACEMENT_REGEX.auto.test(placement);\n if (autoPlace) {\n placement = placement.replace(PLACEMENT_REGEX.auto, '');\n }\n\n placement = placement.split('-');\n\n placement[0] = placement[0] || 'top';\n if (!PLACEMENT_REGEX.primary.test(placement[0])) {\n placement[0] = 'top';\n }\n\n placement[1] = placement[1] || 'center';\n if (!PLACEMENT_REGEX.secondary.test(placement[1])) {\n placement[1] = 'center';\n }\n\n if (autoPlace) {\n placement[2] = true;\n } else {\n placement[2] = false;\n }\n\n return placement;\n },\n\n /**\n * Provides coordinates for an element to be positioned relative to\n * another element. Passing 'auto' as part of the placement parameter\n * will enable smart placement - where the element fits. i.e:\n * 'auto left-top' will check to see if there is enough space to the left\n * of the hostElem to fit the targetElem, if not place right (same for secondary\n * top placement). Available space is calculated using the viewportOffset\n * function.\n *\n * @param {element} hostElem - The element to position against.\n * @param {element} targetElem - The element to position.\n * @param {string=} [placement=top] - The placement for the targetElem,\n * default is 'top'. 'center' is assumed as secondary placement for\n * 'top', 'left', 'right', and 'bottom' placements. Available placements are:\n * \n * - top
\n * - top-right
\n * - top-left
\n * - bottom
\n * - bottom-left
\n * - bottom-right
\n * - left
\n * - left-top
\n * - left-bottom
\n * - right
\n * - right-top
\n * - right-bottom
\n *
\n * @param {boolean=} [appendToBody=false] - Should the top and left values returned\n * be calculated from the body element, default is false.\n *\n * @returns {object} An object with the following properties:\n * \n * - **top**: Value for targetElem top.
\n * - **left**: Value for targetElem left.
\n * - **placement**: The resolved placement.
\n *
\n */\n positionElements: function(hostElem, targetElem, placement, appendToBody) {\n hostElem = this.getRawNode(hostElem);\n targetElem = this.getRawNode(targetElem);\n\n // need to read from prop to support tests.\n var targetWidth = angular.isDefined(targetElem.offsetWidth) ? targetElem.offsetWidth : targetElem.prop('offsetWidth');\n var targetHeight = angular.isDefined(targetElem.offsetHeight) ? targetElem.offsetHeight : targetElem.prop('offsetHeight');\n\n placement = this.parsePlacement(placement);\n\n var hostElemPos = appendToBody ? this.offset(hostElem) : this.position(hostElem);\n var targetElemPos = {top: 0, left: 0, placement: ''};\n\n if (placement[2]) {\n var viewportOffset = this.viewportOffset(hostElem);\n\n var targetElemStyle = $window.getComputedStyle(targetElem);\n var adjustedSize = {\n width: targetWidth + Math.round(Math.abs(this.parseStyle(targetElemStyle.marginLeft) + this.parseStyle(targetElemStyle.marginRight))),\n height: targetHeight + Math.round(Math.abs(this.parseStyle(targetElemStyle.marginTop) + this.parseStyle(targetElemStyle.marginBottom)))\n };\n\n placement[0] = placement[0] === 'top' && adjustedSize.height > viewportOffset.top && adjustedSize.height <= viewportOffset.bottom ? 'bottom' :\n placement[0] === 'bottom' && adjustedSize.height > viewportOffset.bottom && adjustedSize.height <= viewportOffset.top ? 'top' :\n placement[0] === 'left' && adjustedSize.width > viewportOffset.left && adjustedSize.width <= viewportOffset.right ? 'right' :\n placement[0] === 'right' && adjustedSize.width > viewportOffset.right && adjustedSize.width <= viewportOffset.left ? 'left' :\n placement[0];\n\n placement[1] = placement[1] === 'top' && adjustedSize.height - hostElemPos.height > viewportOffset.bottom && adjustedSize.height - hostElemPos.height <= viewportOffset.top ? 'bottom' :\n placement[1] === 'bottom' && adjustedSize.height - hostElemPos.height > viewportOffset.top && adjustedSize.height - hostElemPos.height <= viewportOffset.bottom ? 'top' :\n placement[1] === 'left' && adjustedSize.width - hostElemPos.width > viewportOffset.right && adjustedSize.width - hostElemPos.width <= viewportOffset.left ? 'right' :\n placement[1] === 'right' && adjustedSize.width - hostElemPos.width > viewportOffset.left && adjustedSize.width - hostElemPos.width <= viewportOffset.right ? 'left' :\n placement[1];\n\n if (placement[1] === 'center') {\n if (PLACEMENT_REGEX.vertical.test(placement[0])) {\n var xOverflow = hostElemPos.width / 2 - targetWidth / 2;\n if (viewportOffset.left + xOverflow < 0 && adjustedSize.width - hostElemPos.width <= viewportOffset.right) {\n placement[1] = 'left';\n } else if (viewportOffset.right + xOverflow < 0 && adjustedSize.width - hostElemPos.width <= viewportOffset.left) {\n placement[1] = 'right';\n }\n } else {\n var yOverflow = hostElemPos.height / 2 - adjustedSize.height / 2;\n if (viewportOffset.top + yOverflow < 0 && adjustedSize.height - hostElemPos.height <= viewportOffset.bottom) {\n placement[1] = 'top';\n } else if (viewportOffset.bottom + yOverflow < 0 && adjustedSize.height - hostElemPos.height <= viewportOffset.top) {\n placement[1] = 'bottom';\n }\n }\n }\n }\n\n switch (placement[0]) {\n case 'top':\n targetElemPos.top = hostElemPos.top - targetHeight;\n break;\n case 'bottom':\n targetElemPos.top = hostElemPos.top + hostElemPos.height;\n break;\n case 'left':\n targetElemPos.left = hostElemPos.left - targetWidth;\n break;\n case 'right':\n targetElemPos.left = hostElemPos.left + hostElemPos.width;\n break;\n }\n\n switch (placement[1]) {\n case 'top':\n targetElemPos.top = hostElemPos.top;\n break;\n case 'bottom':\n targetElemPos.top = hostElemPos.top + hostElemPos.height - targetHeight;\n break;\n case 'left':\n targetElemPos.left = hostElemPos.left;\n break;\n case 'right':\n targetElemPos.left = hostElemPos.left + hostElemPos.width - targetWidth;\n break;\n case 'center':\n if (PLACEMENT_REGEX.vertical.test(placement[0])) {\n targetElemPos.left = hostElemPos.left + hostElemPos.width / 2 - targetWidth / 2;\n } else {\n targetElemPos.top = hostElemPos.top + hostElemPos.height / 2 - targetHeight / 2;\n }\n break;\n }\n\n targetElemPos.top = Math.round(targetElemPos.top);\n targetElemPos.left = Math.round(targetElemPos.left);\n targetElemPos.placement = placement[1] === 'center' ? placement[0] : placement[0] + '-' + placement[1];\n\n return targetElemPos;\n },\n\n /**\n * Provides a way for positioning tooltip & dropdown\n * arrows when using placement options beyond the standard\n * left, right, top, or bottom.\n *\n * @param {element} elem - The tooltip/dropdown element.\n * @param {string} placement - The placement for the elem.\n */\n positionArrow: function(elem, placement) {\n elem = this.getRawNode(elem);\n\n var innerElem = elem.querySelector('.tooltip-inner, .popover-inner');\n if (!innerElem) {\n return;\n }\n\n var isTooltip = angular.element(innerElem).hasClass('tooltip-inner');\n\n var arrowElem = isTooltip ? elem.querySelector('.tooltip-arrow') : elem.querySelector('.arrow');\n if (!arrowElem) {\n return;\n }\n\n placement = this.parsePlacement(placement);\n if (placement[1] === 'center') {\n // no adjustment necessary - just reset styles\n angular.element(arrowElem).css({top: '', bottom: '', right: '', left: '', margin: ''});\n return;\n }\n\n var borderProp = 'border-' + placement[0] + '-width';\n var borderWidth = $window.getComputedStyle(arrowElem)[borderProp];\n\n var borderRadiusProp = 'border-';\n if (PLACEMENT_REGEX.vertical.test(placement[0])) {\n borderRadiusProp += placement[0] + '-' + placement[1];\n } else {\n borderRadiusProp += placement[1] + '-' + placement[0];\n }\n borderRadiusProp += '-radius';\n var borderRadius = $window.getComputedStyle(isTooltip ? innerElem : elem)[borderRadiusProp];\n\n var arrowCss = {\n top: 'auto',\n bottom: 'auto',\n left: 'auto',\n right: 'auto',\n margin: 0\n };\n\n switch (placement[0]) {\n case 'top':\n arrowCss.bottom = isTooltip ? '0' : '-' + borderWidth;\n break;\n case 'bottom':\n arrowCss.top = isTooltip ? '0' : '-' + borderWidth;\n break;\n case 'left':\n arrowCss.right = isTooltip ? '0' : '-' + borderWidth;\n break;\n case 'right':\n arrowCss.left = isTooltip ? '0' : '-' + borderWidth;\n break;\n }\n\n arrowCss[placement[1]] = borderRadius;\n\n angular.element(arrowElem).css(arrowCss);\n }\n };\n }]);\n\nangular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.isClass', 'ui.bootstrap.position'])\n\n.value('$datepickerSuppressError', false)\n\n.constant('uibDatepickerConfig', {\n datepickerMode: 'day',\n formatDay: 'dd',\n formatMonth: 'MMMM',\n formatYear: 'yyyy',\n formatDayHeader: 'EEE',\n formatDayTitle: 'MMMM yyyy',\n formatMonthTitle: 'yyyy',\n maxDate: null,\n maxMode: 'year',\n minDate: null,\n minMode: 'day',\n ngModelOptions: {},\n shortcutPropagation: false,\n showWeeks: true,\n yearColumns: 5,\n yearRows: 4\n})\n\n.controller('UibDatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$locale', '$log', 'dateFilter', 'uibDatepickerConfig', '$datepickerSuppressError', 'uibDateParser',\n function($scope, $attrs, $parse, $interpolate, $locale, $log, dateFilter, datepickerConfig, $datepickerSuppressError, dateParser) {\n var self = this,\n ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl;\n ngModelOptions = {},\n watchListeners = [];\n\n // Modes chain\n this.modes = ['day', 'month', 'year'];\n\n if ($attrs.datepickerOptions) {\n angular.forEach([\n 'formatDay',\n 'formatDayHeader',\n 'formatDayTitle',\n 'formatMonth',\n 'formatMonthTitle',\n 'formatYear',\n 'initDate',\n 'maxDate',\n 'maxMode',\n 'minDate',\n 'minMode',\n 'showWeeks',\n 'shortcutPropagation',\n 'startingDay',\n 'yearColumns',\n 'yearRows'\n ], function(key) {\n switch (key) {\n case 'formatDay':\n case 'formatDayHeader':\n case 'formatDayTitle':\n case 'formatMonth':\n case 'formatMonthTitle':\n case 'formatYear':\n self[key] = angular.isDefined($scope.datepickerOptions[key]) ? $interpolate($scope.datepickerOptions[key])($scope.$parent) : datepickerConfig[key];\n break;\n case 'showWeeks':\n case 'shortcutPropagation':\n case 'yearColumns':\n case 'yearRows':\n self[key] = angular.isDefined($scope.datepickerOptions[key]) ?\n $scope.datepickerOptions[key] : datepickerConfig[key];\n break;\n case 'startingDay':\n if (angular.isDefined($scope.datepickerOptions.startingDay)) {\n self.startingDay = $scope.datepickerOptions.startingDay;\n } else if (angular.isNumber(datepickerConfig.startingDay)) {\n self.startingDay = datepickerConfig.startingDay;\n } else {\n self.startingDay = ($locale.DATETIME_FORMATS.FIRSTDAYOFWEEK + 8) % 7;\n }\n\n break;\n case 'maxDate':\n case 'minDate':\n if ($scope.datepickerOptions[key]) {\n $scope.$watch(function() { return $scope.datepickerOptions[key]; }, function(value) {\n if (value) {\n if (angular.isDate(value)) {\n self[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);\n } else {\n self[key] = new Date(dateFilter(value, 'medium'));\n }\n } else {\n self[key] = null;\n }\n\n self.refreshView();\n });\n } else {\n self[key] = datepickerConfig[key] ? dateParser.fromTimezone(new Date(datepickerConfig[key]), ngModelOptions.timezone) : null;\n }\n\n break;\n case 'maxMode':\n case 'minMode':\n if ($scope.datepickerOptions[key]) {\n $scope.$watch(function() { return $scope.datepickerOptions[key]; }, function(value) {\n self[key] = $scope[key] = angular.isDefined(value) ? value : datepickerOptions[key];\n if (key === 'minMode' && self.modes.indexOf($scope.datepickerMode) < self.modes.indexOf(self[key]) ||\n key === 'maxMode' && self.modes.indexOf($scope.datepickerMode) > self.modes.indexOf(self[key])) {\n $scope.datepickerMode = self[key];\n }\n });\n } else {\n self[key] = $scope[key] = datepickerConfig[key] || null;\n }\n\n break;\n case 'initDate':\n if ($scope.datepickerOptions.initDate) {\n this.activeDate = dateParser.fromTimezone($scope.datepickerOptions.initDate, ngModelOptions.timezone) || new Date();\n $scope.$watch(function() { return $scope.datepickerOptions.initDate; }, function(initDate) {\n if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) {\n self.activeDate = dateParser.fromTimezone(initDate, ngModelOptions.timezone);\n self.refreshView();\n }\n });\n } else {\n this.activeDate = new Date();\n }\n }\n });\n } else {\n // Interpolated configuration attributes\n angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle'], function(key) {\n self[key] = angular.isDefined($attrs[key]) ? $interpolate($attrs[key])($scope.$parent) : datepickerConfig[key];\n });\n\n // Evaled configuration attributes\n angular.forEach(['showWeeks', 'yearRows', 'yearColumns', 'shortcutPropagation'], function(key) {\n self[key] = angular.isDefined($attrs[key]) ?\n $scope.$parent.$eval($attrs[key]) : datepickerConfig[key];\n });\n\n if (angular.isDefined($attrs.startingDay)) {\n self.startingDay = $scope.$parent.$eval($attrs.startingDay);\n } else if (angular.isNumber(datepickerConfig.startingDay)) {\n self.startingDay = datepickerConfig.startingDay;\n } else {\n self.startingDay = ($locale.DATETIME_FORMATS.FIRSTDAYOFWEEK + 8) % 7;\n }\n\n // Watchable date attributes\n angular.forEach(['minDate', 'maxDate'], function(key) {\n if ($attrs[key]) {\n watchListeners.push($scope.$parent.$watch($attrs[key], function(value) {\n if (value) {\n if (angular.isDate(value)) {\n self[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);\n } else {\n self[key] = new Date(dateFilter(value, 'medium'));\n }\n } else {\n self[key] = null;\n }\n\n self.refreshView();\n }));\n } else {\n self[key] = datepickerConfig[key] ? dateParser.fromTimezone(new Date(datepickerConfig[key]), ngModelOptions.timezone) : null;\n }\n });\n\n angular.forEach(['minMode', 'maxMode'], function(key) {\n if ($attrs[key]) {\n watchListeners.push($scope.$parent.$watch($attrs[key], function(value) {\n self[key] = $scope[key] = angular.isDefined(value) ? value : $attrs[key];\n if (key === 'minMode' && self.modes.indexOf($scope.datepickerMode) < self.modes.indexOf(self[key]) ||\n key === 'maxMode' && self.modes.indexOf($scope.datepickerMode) > self.modes.indexOf(self[key])) {\n $scope.datepickerMode = self[key];\n }\n }));\n } else {\n self[key] = $scope[key] = datepickerConfig[key] || null;\n }\n });\n\n if (angular.isDefined($attrs.initDate)) {\n this.activeDate = dateParser.fromTimezone($scope.$parent.$eval($attrs.initDate), ngModelOptions.timezone) || new Date();\n watchListeners.push($scope.$parent.$watch($attrs.initDate, function(initDate) {\n if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) {\n self.activeDate = dateParser.fromTimezone(initDate, ngModelOptions.timezone);\n self.refreshView();\n }\n }));\n } else {\n this.activeDate = new Date();\n }\n }\n\n $scope.datepickerMode = $scope.datepickerMode || datepickerConfig.datepickerMode;\n $scope.uniqueId = 'datepicker-' + $scope.$id + '-' + Math.floor(Math.random() * 10000);\n\n $scope.disabled = angular.isDefined($attrs.disabled) || false;\n if (angular.isDefined($attrs.ngDisabled)) {\n watchListeners.push($scope.$parent.$watch($attrs.ngDisabled, function(disabled) {\n $scope.disabled = disabled;\n self.refreshView();\n }));\n }\n\n $scope.isActive = function(dateObject) {\n if (self.compare(dateObject.date, self.activeDate) === 0) {\n $scope.activeDateId = dateObject.uid;\n return true;\n }\n return false;\n };\n\n this.init = function(ngModelCtrl_) {\n ngModelCtrl = ngModelCtrl_;\n ngModelOptions = ngModelCtrl_.$options || datepickerConfig.ngModelOptions;\n\n if (ngModelCtrl.$modelValue) {\n this.activeDate = ngModelCtrl.$modelValue;\n }\n\n ngModelCtrl.$render = function() {\n self.render();\n };\n };\n\n this.render = function() {\n if (ngModelCtrl.$viewValue) {\n var date = new Date(ngModelCtrl.$viewValue),\n isValid = !isNaN(date);\n\n if (isValid) {\n this.activeDate = dateParser.fromTimezone(date, ngModelOptions.timezone);\n } else if (!$datepickerSuppressError) {\n $log.error('Datepicker directive: \"ng-model\" value must be a Date object');\n }\n }\n this.refreshView();\n };\n\n this.refreshView = function() {\n if (this.element) {\n $scope.selectedDt = null;\n this._refreshView();\n if ($scope.activeDt) {\n $scope.activeDateId = $scope.activeDt.uid;\n }\n\n var date = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null;\n date = dateParser.fromTimezone(date, ngModelOptions.timezone);\n ngModelCtrl.$setValidity('dateDisabled', !date ||\n this.element && !this.isDisabled(date));\n }\n };\n\n this.createDateObject = function(date, format) {\n var model = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null;\n model = dateParser.fromTimezone(model, ngModelOptions.timezone);\n var dt = {\n date: date,\n label: dateParser.filter(date, format),\n selected: model && this.compare(date, model) === 0,\n disabled: this.isDisabled(date),\n current: this.compare(date, new Date()) === 0,\n customClass: this.customClass(date) || null\n };\n\n if (model && this.compare(date, model) === 0) {\n $scope.selectedDt = dt;\n }\n\n if (self.activeDate && this.compare(dt.date, self.activeDate) === 0) {\n $scope.activeDt = dt;\n }\n\n return dt;\n };\n\n this.isDisabled = function(date) {\n return $scope.disabled ||\n this.minDate && this.compare(date, this.minDate) < 0 ||\n this.maxDate && this.compare(date, this.maxDate) > 0 ||\n $attrs.dateDisabled && $scope.dateDisabled({date: date, mode: $scope.datepickerMode});\n };\n\n this.customClass = function(date) {\n return $scope.customClass({date: date, mode: $scope.datepickerMode});\n };\n\n // Split array into smaller arrays\n this.split = function(arr, size) {\n var arrays = [];\n while (arr.length > 0) {\n arrays.push(arr.splice(0, size));\n }\n return arrays;\n };\n\n $scope.select = function(date) {\n if ($scope.datepickerMode === self.minMode) {\n var dt = ngModelCtrl.$viewValue ? dateParser.fromTimezone(new Date(ngModelCtrl.$viewValue), ngModelOptions.timezone) : new Date(0, 0, 0, 0, 0, 0, 0);\n dt.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n dt = dateParser.toTimezone(dt, ngModelOptions.timezone);\n ngModelCtrl.$setViewValue(dt);\n ngModelCtrl.$render();\n } else {\n self.activeDate = date;\n $scope.datepickerMode = self.modes[self.modes.indexOf($scope.datepickerMode) - 1];\n }\n };\n\n $scope.move = function(direction) {\n var year = self.activeDate.getFullYear() + direction * (self.step.years || 0),\n month = self.activeDate.getMonth() + direction * (self.step.months || 0);\n self.activeDate.setFullYear(year, month, 1);\n self.refreshView();\n };\n\n $scope.toggleMode = function(direction) {\n direction = direction || 1;\n\n if ($scope.datepickerMode === self.maxMode && direction === 1 ||\n $scope.datepickerMode === self.minMode && direction === -1) {\n return;\n }\n\n $scope.datepickerMode = self.modes[self.modes.indexOf($scope.datepickerMode) + direction];\n };\n\n // Key event mapper\n $scope.keys = { 13: 'enter', 32: 'space', 33: 'pageup', 34: 'pagedown', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down' };\n\n var focusElement = function() {\n self.element[0].focus();\n };\n\n // Listen for focus requests from popup directive\n $scope.$on('uib:datepicker.focus', focusElement);\n\n $scope.keydown = function(evt) {\n var key = $scope.keys[evt.which];\n\n if (!key || evt.shiftKey || evt.altKey || $scope.disabled) {\n return;\n }\n\n evt.preventDefault();\n if (!self.shortcutPropagation) {\n evt.stopPropagation();\n }\n\n if (key === 'enter' || key === 'space') {\n if (self.isDisabled(self.activeDate)) {\n return; // do nothing\n }\n $scope.select(self.activeDate);\n } else if (evt.ctrlKey && (key === 'up' || key === 'down')) {\n $scope.toggleMode(key === 'up' ? 1 : -1);\n } else {\n self.handleKeyDown(key, evt);\n self.refreshView();\n }\n };\n\n $scope.$on(\"$destroy\", function() {\n //Clear all watch listeners on destroy\n while (watchListeners.length) {\n watchListeners.shift()();\n }\n });\n}])\n\n.controller('UibDaypickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) {\n var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\n this.step = { months: 1 };\n this.element = $element;\n function getDaysInMonth(year, month) {\n return month === 1 && year % 4 === 0 &&\n (year % 100 !== 0 || year % 400 === 0) ? 29 : DAYS_IN_MONTH[month];\n }\n\n this.init = function(ctrl) {\n angular.extend(ctrl, this);\n scope.showWeeks = ctrl.showWeeks;\n ctrl.refreshView();\n };\n\n this.getDates = function(startDate, n) {\n var dates = new Array(n), current = new Date(startDate), i = 0, date;\n while (i < n) {\n date = new Date(current);\n dates[i++] = date;\n current.setDate(current.getDate() + 1);\n }\n return dates;\n };\n\n this._refreshView = function() {\n var year = this.activeDate.getFullYear(),\n month = this.activeDate.getMonth(),\n firstDayOfMonth = new Date(this.activeDate);\n\n firstDayOfMonth.setFullYear(year, month, 1);\n\n var difference = this.startingDay - firstDayOfMonth.getDay(),\n numDisplayedFromPreviousMonth = difference > 0 ?\n 7 - difference : - difference,\n firstDate = new Date(firstDayOfMonth);\n\n if (numDisplayedFromPreviousMonth > 0) {\n firstDate.setDate(-numDisplayedFromPreviousMonth + 1);\n }\n\n // 42 is the number of days on a six-week calendar\n var days = this.getDates(firstDate, 42);\n for (var i = 0; i < 42; i ++) {\n days[i] = angular.extend(this.createDateObject(days[i], this.formatDay), {\n secondary: days[i].getMonth() !== month,\n uid: scope.uniqueId + '-' + i\n });\n }\n\n scope.labels = new Array(7);\n for (var j = 0; j < 7; j++) {\n scope.labels[j] = {\n abbr: dateFilter(days[j].date, this.formatDayHeader),\n full: dateFilter(days[j].date, 'EEEE')\n };\n }\n\n scope.title = dateFilter(this.activeDate, this.formatDayTitle);\n scope.rows = this.split(days, 7);\n\n if (scope.showWeeks) {\n scope.weekNumbers = [];\n var thursdayIndex = (4 + 7 - this.startingDay) % 7,\n numWeeks = scope.rows.length;\n for (var curWeek = 0; curWeek < numWeeks; curWeek++) {\n scope.weekNumbers.push(\n getISO8601WeekNumber(scope.rows[curWeek][thursdayIndex].date));\n }\n }\n };\n\n this.compare = function(date1, date2) {\n var _date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());\n var _date2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());\n _date1.setFullYear(date1.getFullYear());\n _date2.setFullYear(date2.getFullYear());\n return _date1 - _date2;\n };\n\n function getISO8601WeekNumber(date) {\n var checkDate = new Date(date);\n checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); // Thursday\n var time = checkDate.getTime();\n checkDate.setMonth(0); // Compare with Jan 1\n checkDate.setDate(1);\n return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;\n }\n\n this.handleKeyDown = function(key, evt) {\n var date = this.activeDate.getDate();\n\n if (key === 'left') {\n date = date - 1;\n } else if (key === 'up') {\n date = date - 7;\n } else if (key === 'right') {\n date = date + 1;\n } else if (key === 'down') {\n date = date + 7;\n } else if (key === 'pageup' || key === 'pagedown') {\n var month = this.activeDate.getMonth() + (key === 'pageup' ? - 1 : 1);\n this.activeDate.setMonth(month, 1);\n date = Math.min(getDaysInMonth(this.activeDate.getFullYear(), this.activeDate.getMonth()), date);\n } else if (key === 'home') {\n date = 1;\n } else if (key === 'end') {\n date = getDaysInMonth(this.activeDate.getFullYear(), this.activeDate.getMonth());\n }\n this.activeDate.setDate(date);\n };\n}])\n\n.controller('UibMonthpickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) {\n this.step = { years: 1 };\n this.element = $element;\n\n this.init = function(ctrl) {\n angular.extend(ctrl, this);\n ctrl.refreshView();\n };\n\n this._refreshView = function() {\n var months = new Array(12),\n year = this.activeDate.getFullYear(),\n date;\n\n for (var i = 0; i < 12; i++) {\n date = new Date(this.activeDate);\n date.setFullYear(year, i, 1);\n months[i] = angular.extend(this.createDateObject(date, this.formatMonth), {\n uid: scope.uniqueId + '-' + i\n });\n }\n\n scope.title = dateFilter(this.activeDate, this.formatMonthTitle);\n scope.rows = this.split(months, 3);\n };\n\n this.compare = function(date1, date2) {\n var _date1 = new Date(date1.getFullYear(), date1.getMonth());\n var _date2 = new Date(date2.getFullYear(), date2.getMonth());\n _date1.setFullYear(date1.getFullYear());\n _date2.setFullYear(date2.getFullYear());\n return _date1 - _date2;\n };\n\n this.handleKeyDown = function(key, evt) {\n var date = this.activeDate.getMonth();\n\n if (key === 'left') {\n date = date - 1;\n } else if (key === 'up') {\n date = date - 3;\n } else if (key === 'right') {\n date = date + 1;\n } else if (key === 'down') {\n date = date + 3;\n } else if (key === 'pageup' || key === 'pagedown') {\n var year = this.activeDate.getFullYear() + (key === 'pageup' ? - 1 : 1);\n this.activeDate.setFullYear(year);\n } else if (key === 'home') {\n date = 0;\n } else if (key === 'end') {\n date = 11;\n }\n this.activeDate.setMonth(date);\n };\n}])\n\n.controller('UibYearpickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) {\n var columns, range;\n this.element = $element;\n\n function getStartingYear(year) {\n return parseInt((year - 1) / range, 10) * range + 1;\n }\n\n this.yearpickerInit = function() {\n columns = this.yearColumns;\n range = this.yearRows * columns;\n this.step = { years: range };\n };\n\n this._refreshView = function() {\n var years = new Array(range), date;\n\n for (var i = 0, start = getStartingYear(this.activeDate.getFullYear()); i < range; i++) {\n date = new Date(this.activeDate);\n date.setFullYear(start + i, 0, 1);\n years[i] = angular.extend(this.createDateObject(date, this.formatYear), {\n uid: scope.uniqueId + '-' + i\n });\n }\n\n scope.title = [years[0].label, years[range - 1].label].join(' - ');\n scope.rows = this.split(years, columns);\n scope.columns = columns;\n };\n\n this.compare = function(date1, date2) {\n return date1.getFullYear() - date2.getFullYear();\n };\n\n this.handleKeyDown = function(key, evt) {\n var date = this.activeDate.getFullYear();\n\n if (key === 'left') {\n date = date - 1;\n } else if (key === 'up') {\n date = date - columns;\n } else if (key === 'right') {\n date = date + 1;\n } else if (key === 'down') {\n date = date + columns;\n } else if (key === 'pageup' || key === 'pagedown') {\n date += (key === 'pageup' ? - 1 : 1) * range;\n } else if (key === 'home') {\n date = getStartingYear(this.activeDate.getFullYear());\n } else if (key === 'end') {\n date = getStartingYear(this.activeDate.getFullYear()) + range - 1;\n }\n this.activeDate.setFullYear(date);\n };\n}])\n\n.directive('uibDatepicker', function() {\n return {\n replace: true,\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/datepicker/datepicker.html';\n },\n scope: {\n datepickerMode: '=?',\n datepickerOptions: '=?',\n dateDisabled: '&',\n customClass: '&',\n shortcutPropagation: '&?'\n },\n require: ['uibDatepicker', '^ngModel'],\n controller: 'UibDatepickerController',\n controllerAs: 'datepicker',\n link: function(scope, element, attrs, ctrls) {\n var datepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1];\n\n datepickerCtrl.init(ngModelCtrl);\n }\n };\n})\n\n.directive('uibDaypicker', function() {\n return {\n replace: true,\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/datepicker/day.html';\n },\n require: ['^uibDatepicker', 'uibDaypicker'],\n controller: 'UibDaypickerController',\n link: function(scope, element, attrs, ctrls) {\n var datepickerCtrl = ctrls[0],\n daypickerCtrl = ctrls[1];\n\n daypickerCtrl.init(datepickerCtrl);\n }\n };\n})\n\n.directive('uibMonthpicker', function() {\n return {\n replace: true,\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/datepicker/month.html';\n },\n require: ['^uibDatepicker', 'uibMonthpicker'],\n controller: 'UibMonthpickerController',\n link: function(scope, element, attrs, ctrls) {\n var datepickerCtrl = ctrls[0],\n monthpickerCtrl = ctrls[1];\n\n monthpickerCtrl.init(datepickerCtrl);\n }\n };\n})\n\n.directive('uibYearpicker', function() {\n return {\n replace: true,\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/datepicker/year.html';\n },\n require: ['^uibDatepicker', 'uibYearpicker'],\n controller: 'UibYearpickerController',\n link: function(scope, element, attrs, ctrls) {\n var ctrl = ctrls[0];\n angular.extend(ctrl, ctrls[1]);\n ctrl.yearpickerInit();\n\n ctrl.refreshView();\n }\n };\n})\n\n.constant('uibDatepickerPopupConfig', {\n altInputFormats: [],\n appendToBody: false,\n clearText: 'Clear',\n closeOnDateSelection: true,\n closeText: 'Done',\n currentText: 'Today',\n datepickerPopup: 'yyyy-MM-dd',\n datepickerPopupTemplateUrl: 'uib/template/datepicker/popup.html',\n datepickerTemplateUrl: 'uib/template/datepicker/datepicker.html',\n html5Types: {\n date: 'yyyy-MM-dd',\n 'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss',\n 'month': 'yyyy-MM'\n },\n onOpenFocus: true,\n showButtonBar: true\n})\n\n.controller('UibDatepickerPopupController', ['$scope', '$element', '$attrs', '$compile', '$parse', '$document', '$rootScope', '$uibPosition', 'dateFilter', 'uibDateParser', 'uibDatepickerPopupConfig', '$timeout', 'uibDatepickerConfig',\nfunction(scope, element, attrs, $compile, $parse, $document, $rootScope, $position, dateFilter, dateParser, datepickerPopupConfig, $timeout, datepickerConfig) {\n var cache = {},\n isHtml5DateInput = false;\n var dateFormat, closeOnDateSelection, appendToBody, onOpenFocus,\n datepickerPopupTemplateUrl, datepickerTemplateUrl, popupEl, datepickerEl,\n ngModel, ngModelOptions, $popup, altInputFormats, watchListeners = [];\n\n scope.watchData = {};\n\n this.init = function(_ngModel_) {\n ngModel = _ngModel_;\n ngModelOptions = _ngModel_.$options || datepickerConfig.ngModelOptions;\n closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? scope.$parent.$eval(attrs.closeOnDateSelection) : datepickerPopupConfig.closeOnDateSelection;\n appendToBody = angular.isDefined(attrs.datepickerAppendToBody) ? scope.$parent.$eval(attrs.datepickerAppendToBody) : datepickerPopupConfig.appendToBody;\n onOpenFocus = angular.isDefined(attrs.onOpenFocus) ? scope.$parent.$eval(attrs.onOpenFocus) : datepickerPopupConfig.onOpenFocus;\n datepickerPopupTemplateUrl = angular.isDefined(attrs.datepickerPopupTemplateUrl) ? attrs.datepickerPopupTemplateUrl : datepickerPopupConfig.datepickerPopupTemplateUrl;\n datepickerTemplateUrl = angular.isDefined(attrs.datepickerTemplateUrl) ? attrs.datepickerTemplateUrl : datepickerPopupConfig.datepickerTemplateUrl;\n altInputFormats = angular.isDefined(attrs.altInputFormats) ? scope.$parent.$eval(attrs.altInputFormats) : datepickerPopupConfig.altInputFormats;\n\n scope.showButtonBar = angular.isDefined(attrs.showButtonBar) ? scope.$parent.$eval(attrs.showButtonBar) : datepickerPopupConfig.showButtonBar;\n\n if (datepickerPopupConfig.html5Types[attrs.type]) {\n dateFormat = datepickerPopupConfig.html5Types[attrs.type];\n isHtml5DateInput = true;\n } else {\n dateFormat = attrs.uibDatepickerPopup || datepickerPopupConfig.datepickerPopup;\n attrs.$observe('uibDatepickerPopup', function(value, oldValue) {\n var newDateFormat = value || datepickerPopupConfig.datepickerPopup;\n // Invalidate the $modelValue to ensure that formatters re-run\n // FIXME: Refactor when PR is merged: https://github.com/angular/angular.js/pull/10764\n if (newDateFormat !== dateFormat) {\n dateFormat = newDateFormat;\n ngModel.$modelValue = null;\n\n if (!dateFormat) {\n throw new Error('uibDatepickerPopup must have a date format specified.');\n }\n }\n });\n }\n\n if (!dateFormat) {\n throw new Error('uibDatepickerPopup must have a date format specified.');\n }\n\n if (isHtml5DateInput && attrs.uibDatepickerPopup) {\n throw new Error('HTML5 date input types do not support custom formats.');\n }\n\n // popup element used to display calendar\n popupEl = angular.element('');\n scope.ngModelOptions = angular.copy(ngModelOptions);\n scope.ngModelOptions.timezone = null;\n popupEl.attr({\n 'ng-model': 'date',\n 'ng-model-options': 'ngModelOptions',\n 'ng-change': 'dateSelection(date)',\n 'template-url': datepickerPopupTemplateUrl\n });\n\n // datepicker element\n datepickerEl = angular.element(popupEl.children()[0]);\n datepickerEl.attr('template-url', datepickerTemplateUrl);\n\n if (isHtml5DateInput) {\n if (attrs.type === 'month') {\n datepickerEl.attr('datepicker-mode', '\"month\"');\n datepickerEl.attr('min-mode', 'month');\n }\n }\n\n if (scope.datepickerOptions) {\n angular.forEach(scope.datepickerOptions, function(value, option) {\n // Ignore this options, will be managed later\n if (['minDate', 'maxDate', 'minMode', 'maxMode', 'initDate', 'datepickerMode'].indexOf(option) === -1) {\n datepickerEl.attr(cameltoDash(option), value);\n } else {\n datepickerEl.attr(cameltoDash(option), 'datepickerOptions.' + option);\n }\n });\n }\n\n angular.forEach(['minMode', 'maxMode', 'datepickerMode', 'shortcutPropagation'], function(key) {\n if (attrs[key]) {\n var getAttribute = $parse(attrs[key]);\n var propConfig = {\n get: function() {\n return getAttribute(scope.$parent);\n }\n };\n\n datepickerEl.attr(cameltoDash(key), 'watchData.' + key);\n\n // Propagate changes from datepicker to outside\n if (key === 'datepickerMode') {\n var setAttribute = getAttribute.assign;\n propConfig.set = function(v) {\n setAttribute(scope.$parent, v);\n };\n }\n\n Object.defineProperty(scope.watchData, key, propConfig);\n }\n });\n\n angular.forEach(['minDate', 'maxDate', 'initDate'], function(key) {\n if (attrs[key]) {\n var getAttribute = $parse(attrs[key]);\n\n watchListeners.push(scope.$parent.$watch(getAttribute, function(value) {\n if (key === 'minDate' || key === 'maxDate') {\n if (value === null) {\n cache[key] = null;\n } else if (angular.isDate(value)) {\n cache[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);\n } else {\n cache[key] = new Date(dateFilter(value, 'medium'));\n }\n\n scope.watchData[key] = value === null ? null : cache[key];\n } else {\n scope.watchData[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);\n }\n }));\n\n datepickerEl.attr(cameltoDash(key), 'watchData.' + key);\n }\n });\n\n if (attrs.dateDisabled) {\n datepickerEl.attr('date-disabled', 'dateDisabled({ date: date, mode: mode })');\n }\n\n angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle', 'showWeeks', 'startingDay', 'yearRows', 'yearColumns'], function(key) {\n if (angular.isDefined(attrs[key])) {\n datepickerEl.attr(cameltoDash(key), attrs[key]);\n }\n });\n\n if (attrs.customClass) {\n datepickerEl.attr('custom-class', 'customClass({ date: date, mode: mode })');\n }\n\n if (!isHtml5DateInput) {\n // Internal API to maintain the correct ng-invalid-[key] class\n ngModel.$$parserName = 'date';\n ngModel.$validators.date = validator;\n ngModel.$parsers.unshift(parseDate);\n ngModel.$formatters.push(function(value) {\n if (ngModel.$isEmpty(value)) {\n scope.date = value;\n return value;\n }\n\n scope.date = dateParser.fromTimezone(value, ngModelOptions.timezone);\n\n if (angular.isNumber(scope.date)) {\n scope.date = new Date(scope.date);\n }\n\n return dateParser.filter(scope.date, dateFormat);\n });\n } else {\n ngModel.$formatters.push(function(value) {\n scope.date = dateParser.fromTimezone(value, ngModelOptions.timezone);\n return value;\n });\n }\n\n // Detect changes in the view from the text box\n ngModel.$viewChangeListeners.push(function() {\n scope.date = parseDateString(ngModel.$viewValue);\n });\n\n element.on('keydown', inputKeydownBind);\n\n $popup = $compile(popupEl)(scope);\n // Prevent jQuery cache memory leak (template is now redundant after linking)\n popupEl.remove();\n\n if (appendToBody) {\n $document.find('body').append($popup);\n } else {\n element.after($popup);\n }\n\n scope.$on('$destroy', function() {\n if (scope.isOpen === true) {\n if (!$rootScope.$$phase) {\n scope.$apply(function() {\n scope.isOpen = false;\n });\n }\n }\n\n $popup.remove();\n element.off('keydown', inputKeydownBind);\n $document.off('click', documentClickBind);\n\n //Clear all watch listeners on destroy\n while (watchListeners.length) {\n watchListeners.shift()();\n }\n });\n };\n\n scope.getText = function(key) {\n return scope[key + 'Text'] || datepickerPopupConfig[key + 'Text'];\n };\n\n scope.isDisabled = function(date) {\n if (date === 'today') {\n date = new Date();\n }\n\n return scope.watchData.minDate && scope.compare(date, cache.minDate) < 0 ||\n scope.watchData.maxDate && scope.compare(date, cache.maxDate) > 0;\n };\n\n scope.compare = function(date1, date2) {\n return new Date(date1.getFullYear(), date1.getMonth(), date1.getDate()) - new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());\n };\n\n // Inner change\n scope.dateSelection = function(dt) {\n if (angular.isDefined(dt)) {\n scope.date = dt;\n }\n var date = scope.date ? dateParser.filter(scope.date, dateFormat) : null; // Setting to NULL is necessary for form validators to function\n element.val(date);\n ngModel.$setViewValue(date);\n\n if (closeOnDateSelection) {\n scope.isOpen = false;\n element[0].focus();\n }\n };\n\n scope.keydown = function(evt) {\n if (evt.which === 27) {\n evt.stopPropagation();\n scope.isOpen = false;\n element[0].focus();\n }\n };\n\n scope.select = function(date) {\n if (date === 'today') {\n var today = new Date();\n if (angular.isDate(scope.date)) {\n date = new Date(scope.date);\n date.setFullYear(today.getFullYear(), today.getMonth(), today.getDate());\n } else {\n date = new Date(today.setHours(0, 0, 0, 0));\n }\n }\n scope.dateSelection(date);\n };\n\n scope.close = function() {\n scope.isOpen = false;\n element[0].focus();\n };\n\n scope.disabled = angular.isDefined(attrs.disabled) || false;\n if (attrs.ngDisabled) {\n watchListeners.push(scope.$parent.$watch($parse(attrs.ngDisabled), function(disabled) {\n scope.disabled = disabled;\n }));\n }\n\n scope.$watch('isOpen', function(value) {\n if (value) {\n if (!scope.disabled) {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top = scope.position.top + element.prop('offsetHeight');\n\n $timeout(function() {\n if (onOpenFocus) {\n scope.$broadcast('uib:datepicker.focus');\n }\n $document.on('click', documentClickBind);\n }, 0, false);\n } else {\n scope.isOpen = false;\n }\n } else {\n $document.off('click', documentClickBind);\n }\n });\n\n function cameltoDash(string) {\n return string.replace(/([A-Z])/g, function($1) { return '-' + $1.toLowerCase(); });\n }\n\n function parseDateString(viewValue) {\n var date = dateParser.parse(viewValue, dateFormat, scope.date);\n if (isNaN(date)) {\n for (var i = 0; i < altInputFormats.length; i++) {\n date = dateParser.parse(viewValue, altInputFormats[i], scope.date);\n if (!isNaN(date)) {\n return date;\n }\n }\n }\n return date;\n }\n\n function parseDate(viewValue) {\n if (angular.isNumber(viewValue)) {\n // presumably timestamp to date object\n viewValue = new Date(viewValue);\n }\n\n if (!viewValue) {\n return null;\n }\n\n if (angular.isDate(viewValue) && !isNaN(viewValue)) {\n return viewValue;\n }\n\n if (angular.isString(viewValue)) {\n var date = parseDateString(viewValue);\n if (!isNaN(date)) {\n return dateParser.toTimezone(date, ngModelOptions.timezone);\n }\n }\n\n return ngModel.$options && ngModel.$options.allowInvalid ? viewValue : undefined;\n }\n\n function validator(modelValue, viewValue) {\n var value = modelValue || viewValue;\n\n if (!attrs.ngRequired && !value) {\n return true;\n }\n\n if (angular.isNumber(value)) {\n value = new Date(value);\n }\n\n if (!value) {\n return true;\n }\n\n if (angular.isDate(value) && !isNaN(value)) {\n return true;\n }\n\n if (angular.isString(value)) {\n return !isNaN(parseDateString(viewValue));\n }\n\n return false;\n }\n\n function documentClickBind(event) {\n if (!scope.isOpen && scope.disabled) {\n return;\n }\n\n var popup = $popup[0];\n var dpContainsTarget = element[0].contains(event.target);\n // The popup node may not be an element node\n // In some browsers (IE) only element nodes have the 'contains' function\n var popupContainsTarget = popup.contains !== undefined && popup.contains(event.target);\n if (scope.isOpen && !(dpContainsTarget || popupContainsTarget)) {\n scope.$apply(function() {\n scope.isOpen = false;\n });\n }\n }\n\n function inputKeydownBind(evt) {\n if (evt.which === 27 && scope.isOpen) {\n evt.preventDefault();\n evt.stopPropagation();\n scope.$apply(function() {\n scope.isOpen = false;\n });\n element[0].focus();\n } else if (evt.which === 40 && !scope.isOpen) {\n evt.preventDefault();\n evt.stopPropagation();\n scope.$apply(function() {\n scope.isOpen = true;\n });\n }\n }\n}])\n\n.directive('uibDatepickerPopup', function() {\n return {\n require: ['ngModel', 'uibDatepickerPopup'],\n controller: 'UibDatepickerPopupController',\n scope: {\n datepickerOptions: '=?',\n isOpen: '=?',\n currentText: '@',\n clearText: '@',\n closeText: '@',\n dateDisabled: '&',\n customClass: '&'\n },\n link: function(scope, element, attrs, ctrls) {\n var ngModel = ctrls[0],\n ctrl = ctrls[1];\n\n ctrl.init(ngModel);\n }\n };\n})\n\n.directive('uibDatepickerPopupWrap', function() {\n return {\n replace: true,\n transclude: true,\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/datepicker/popup.html';\n }\n };\n});\n\nangular.module('ui.bootstrap.debounce', [])\n/**\n * A helper, internal service that debounces a function\n */\n .factory('$$debounce', ['$timeout', function($timeout) {\n return function(callback, debounceTime) {\n var timeoutPromise;\n\n return function() {\n var self = this;\n var args = Array.prototype.slice.call(arguments);\n if (timeoutPromise) {\n $timeout.cancel(timeoutPromise);\n }\n\n timeoutPromise = $timeout(function() {\n callback.apply(self, args);\n }, debounceTime);\n };\n };\n }]);\n\nangular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])\n\n.constant('uibDropdownConfig', {\n appendToOpenClass: 'uib-dropdown-open',\n openClass: 'open'\n})\n\n.service('uibDropdownService', ['$document', '$rootScope', function($document, $rootScope) {\n var openScope = null;\n\n this.open = function(dropdownScope) {\n if (!openScope) {\n $document.on('click', closeDropdown);\n $document.on('keydown', keybindFilter);\n }\n\n if (openScope && openScope !== dropdownScope) {\n openScope.isOpen = false;\n }\n\n openScope = dropdownScope;\n };\n\n this.close = function(dropdownScope) {\n if (openScope === dropdownScope) {\n openScope = null;\n $document.off('click', closeDropdown);\n $document.off('keydown', keybindFilter);\n }\n };\n\n var closeDropdown = function(evt) {\n // This method may still be called during the same mouse event that\n // unbound this event handler. So check openScope before proceeding.\n if (!openScope) { return; }\n\n if (evt && openScope.getAutoClose() === 'disabled') { return; }\n\n if (evt && evt.which === 3) { return; }\n\n var toggleElement = openScope.getToggleElement();\n if (evt && toggleElement && toggleElement[0].contains(evt.target)) {\n return;\n }\n\n var dropdownElement = openScope.getDropdownElement();\n if (evt && openScope.getAutoClose() === 'outsideClick' &&\n dropdownElement && dropdownElement[0].contains(evt.target)) {\n return;\n }\n\n openScope.isOpen = false;\n\n if (!$rootScope.$$phase) {\n openScope.$apply();\n }\n };\n\n var keybindFilter = function(evt) {\n if (evt.which === 27) {\n openScope.focusToggleElement();\n closeDropdown();\n } else if (openScope.isKeynavEnabled() && [38, 40].indexOf(evt.which) !== -1 && openScope.isOpen) {\n evt.preventDefault();\n evt.stopPropagation();\n openScope.focusDropdownEntry(evt.which);\n }\n };\n}])\n\n.controller('UibDropdownController', ['$scope', '$element', '$attrs', '$parse', 'uibDropdownConfig', 'uibDropdownService', '$animate', '$uibPosition', '$document', '$compile', '$templateRequest', function($scope, $element, $attrs, $parse, dropdownConfig, uibDropdownService, $animate, $position, $document, $compile, $templateRequest) {\n var self = this,\n scope = $scope.$new(), // create a child scope so we are not polluting original one\n templateScope,\n appendToOpenClass = dropdownConfig.appendToOpenClass,\n openClass = dropdownConfig.openClass,\n getIsOpen,\n setIsOpen = angular.noop,\n toggleInvoker = $attrs.onToggle ? $parse($attrs.onToggle) : angular.noop,\n appendToBody = false,\n appendTo = null,\n keynavEnabled = false,\n selectedOption = null,\n body = $document.find('body');\n\n $element.addClass('dropdown');\n\n this.init = function() {\n if ($attrs.isOpen) {\n getIsOpen = $parse($attrs.isOpen);\n setIsOpen = getIsOpen.assign;\n\n $scope.$watch(getIsOpen, function(value) {\n scope.isOpen = !!value;\n });\n }\n\n if (angular.isDefined($attrs.dropdownAppendTo)) {\n var appendToEl = $parse($attrs.dropdownAppendTo)(scope);\n if (appendToEl) {\n appendTo = angular.element(appendToEl);\n }\n }\n\n appendToBody = angular.isDefined($attrs.dropdownAppendToBody);\n keynavEnabled = angular.isDefined($attrs.keyboardNav);\n\n if (appendToBody && !appendTo) {\n appendTo = body;\n }\n\n if (appendTo && self.dropdownMenu) {\n appendTo.append(self.dropdownMenu);\n $element.on('$destroy', function handleDestroyEvent() {\n self.dropdownMenu.remove();\n });\n }\n };\n\n this.toggle = function(open) {\n return scope.isOpen = arguments.length ? !!open : !scope.isOpen;\n };\n\n // Allow other directives to watch status\n this.isOpen = function() {\n return scope.isOpen;\n };\n\n scope.getToggleElement = function() {\n return self.toggleElement;\n };\n\n scope.getAutoClose = function() {\n return $attrs.autoClose || 'always'; //or 'outsideClick' or 'disabled'\n };\n\n scope.getElement = function() {\n return $element;\n };\n\n scope.isKeynavEnabled = function() {\n return keynavEnabled;\n };\n\n scope.focusDropdownEntry = function(keyCode) {\n var elems = self.dropdownMenu ? //If append to body is used.\n angular.element(self.dropdownMenu).find('a') :\n $element.find('ul').eq(0).find('a');\n\n switch (keyCode) {\n case 40: {\n if (!angular.isNumber(self.selectedOption)) {\n self.selectedOption = 0;\n } else {\n self.selectedOption = self.selectedOption === elems.length - 1 ?\n self.selectedOption :\n self.selectedOption + 1;\n }\n break;\n }\n case 38: {\n if (!angular.isNumber(self.selectedOption)) {\n self.selectedOption = elems.length - 1;\n } else {\n self.selectedOption = self.selectedOption === 0 ?\n 0 : self.selectedOption - 1;\n }\n break;\n }\n }\n elems[self.selectedOption].focus();\n };\n\n scope.getDropdownElement = function() {\n return self.dropdownMenu;\n };\n\n scope.focusToggleElement = function() {\n if (self.toggleElement) {\n self.toggleElement[0].focus();\n }\n };\n\n scope.$watch('isOpen', function(isOpen, wasOpen) {\n if (appendTo && self.dropdownMenu) {\n var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true),\n css,\n rightalign;\n\n css = {\n top: pos.top + 'px',\n display: isOpen ? 'block' : 'none'\n };\n\n rightalign = self.dropdownMenu.hasClass('dropdown-menu-right');\n if (!rightalign) {\n css.left = pos.left + 'px';\n css.right = 'auto';\n } else {\n css.left = 'auto';\n css.right = window.innerWidth -\n (pos.left + $element.prop('offsetWidth')) + 'px';\n }\n\n // Need to adjust our positioning to be relative to the appendTo container\n // if it's not the body element\n if (!appendToBody) {\n var appendOffset = $position.offset(appendTo);\n\n css.top = pos.top - appendOffset.top + 'px';\n\n if (!rightalign) {\n css.left = pos.left - appendOffset.left + 'px';\n } else {\n css.right = window.innerWidth -\n (pos.left - appendOffset.left + $element.prop('offsetWidth')) + 'px';\n }\n }\n\n self.dropdownMenu.css(css);\n }\n\n var openContainer = appendTo ? appendTo : $element;\n\n $animate[isOpen ? 'addClass' : 'removeClass'](openContainer, appendTo ? appendToOpenClass : openClass).then(function() {\n if (angular.isDefined(isOpen) && isOpen !== wasOpen) {\n toggleInvoker($scope, { open: !!isOpen });\n }\n });\n\n if (isOpen) {\n if (self.dropdownMenuTemplateUrl) {\n $templateRequest(self.dropdownMenuTemplateUrl).then(function(tplContent) {\n templateScope = scope.$new();\n $compile(tplContent.trim())(templateScope, function(dropdownElement) {\n var newEl = dropdownElement;\n self.dropdownMenu.replaceWith(newEl);\n self.dropdownMenu = newEl;\n });\n });\n }\n\n scope.focusToggleElement();\n uibDropdownService.open(scope);\n } else {\n if (self.dropdownMenuTemplateUrl) {\n if (templateScope) {\n templateScope.$destroy();\n }\n var newEl = angular.element('');\n self.dropdownMenu.replaceWith(newEl);\n self.dropdownMenu = newEl;\n }\n\n uibDropdownService.close(scope);\n self.selectedOption = null;\n }\n\n if (angular.isFunction(setIsOpen)) {\n setIsOpen($scope, isOpen);\n }\n });\n\n $scope.$on('$locationChangeSuccess', function() {\n if (scope.getAutoClose() !== 'disabled') {\n scope.isOpen = false;\n }\n });\n}])\n\n.directive('uibDropdown', function() {\n return {\n controller: 'UibDropdownController',\n link: function(scope, element, attrs, dropdownCtrl) {\n dropdownCtrl.init();\n }\n };\n})\n\n.directive('uibDropdownMenu', function() {\n return {\n restrict: 'A',\n require: '?^uibDropdown',\n link: function(scope, element, attrs, dropdownCtrl) {\n if (!dropdownCtrl || angular.isDefined(attrs.dropdownNested)) {\n return;\n }\n\n element.addClass('dropdown-menu');\n\n var tplUrl = attrs.templateUrl;\n if (tplUrl) {\n dropdownCtrl.dropdownMenuTemplateUrl = tplUrl;\n }\n\n if (!dropdownCtrl.dropdownMenu) {\n dropdownCtrl.dropdownMenu = element;\n }\n }\n };\n})\n\n.directive('uibDropdownToggle', function() {\n return {\n require: '?^uibDropdown',\n link: function(scope, element, attrs, dropdownCtrl) {\n if (!dropdownCtrl) {\n return;\n }\n\n element.addClass('dropdown-toggle');\n\n dropdownCtrl.toggleElement = element;\n\n var toggleDropdown = function(event) {\n event.preventDefault();\n\n if (!element.hasClass('disabled') && !attrs.disabled) {\n scope.$apply(function() {\n dropdownCtrl.toggle();\n });\n }\n };\n\n element.bind('click', toggleDropdown);\n\n // WAI-ARIA\n element.attr({ 'aria-haspopup': true, 'aria-expanded': false });\n scope.$watch(dropdownCtrl.isOpen, function(isOpen) {\n element.attr('aria-expanded', !!isOpen);\n });\n\n scope.$on('$destroy', function() {\n element.unbind('click', toggleDropdown);\n });\n }\n };\n});\n\nangular.module('ui.bootstrap.stackedMap', [])\n/**\n * A helper, internal data structure that acts as a map but also allows getting / removing\n * elements in the LIFO order\n */\n .factory('$$stackedMap', function() {\n return {\n createNew: function() {\n var stack = [];\n\n return {\n add: function(key, value) {\n stack.push({\n key: key,\n value: value\n });\n },\n get: function(key) {\n for (var i = 0; i < stack.length; i++) {\n if (key === stack[i].key) {\n return stack[i];\n }\n }\n },\n keys: function() {\n var keys = [];\n for (var i = 0; i < stack.length; i++) {\n keys.push(stack[i].key);\n }\n return keys;\n },\n top: function() {\n return stack[stack.length - 1];\n },\n remove: function(key) {\n var idx = -1;\n for (var i = 0; i < stack.length; i++) {\n if (key === stack[i].key) {\n idx = i;\n break;\n }\n }\n return stack.splice(idx, 1)[0];\n },\n removeTop: function() {\n return stack.splice(stack.length - 1, 1)[0];\n },\n length: function() {\n return stack.length;\n }\n };\n }\n };\n });\nangular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])\n/**\n * A helper, internal data structure that stores all references attached to key\n */\n .factory('$$multiMap', function() {\n return {\n createNew: function() {\n var map = {};\n\n return {\n entries: function() {\n return Object.keys(map).map(function(key) {\n return {\n key: key,\n value: map[key]\n };\n });\n },\n get: function(key) {\n return map[key];\n },\n hasKey: function(key) {\n return !!map[key];\n },\n keys: function() {\n return Object.keys(map);\n },\n put: function(key, value) {\n if (!map[key]) {\n map[key] = [];\n }\n\n map[key].push(value);\n },\n remove: function(key, value) {\n var values = map[key];\n\n if (!values) {\n return;\n }\n\n var idx = values.indexOf(value);\n\n if (idx !== -1) {\n values.splice(idx, 1);\n }\n\n if (!values.length) {\n delete map[key];\n }\n }\n };\n }\n };\n })\n\n/**\n * Pluggable resolve mechanism for the modal resolve resolution\n * Supports UI Router's $resolve service\n */\n .provider('$uibResolve', function() {\n var resolve = this;\n this.resolver = null;\n\n this.setResolver = function(resolver) {\n this.resolver = resolver;\n };\n\n this.$get = ['$injector', '$q', function($injector, $q) {\n var resolver = resolve.resolver ? $injector.get(resolve.resolver) : null;\n return {\n resolve: function(invocables, locals, parent, self) {\n if (resolver) {\n return resolver.resolve(invocables, locals, parent, self);\n }\n\n var promises = [];\n\n angular.forEach(invocables, function(value) {\n if (angular.isFunction(value) || angular.isArray(value)) {\n promises.push($q.resolve($injector.invoke(value)));\n } else if (angular.isString(value)) {\n promises.push($q.resolve($injector.get(value)));\n } else {\n promises.push($q.resolve(value));\n }\n });\n\n return $q.all(promises).then(function(resolves) {\n var resolveObj = {};\n var resolveIter = 0;\n angular.forEach(invocables, function(value, key) {\n resolveObj[key] = resolves[resolveIter++];\n });\n\n return resolveObj;\n });\n }\n };\n }];\n })\n\n/**\n * A helper directive for the $modal service. It creates a backdrop element.\n */\n .directive('uibModalBackdrop', ['$animateCss', '$injector', '$uibModalStack',\n function($animateCss, $injector, $modalStack) {\n return {\n replace: true,\n templateUrl: 'uib/template/modal/backdrop.html',\n compile: function(tElement, tAttrs) {\n tElement.addClass(tAttrs.backdropClass);\n return linkFn;\n }\n };\n\n function linkFn(scope, element, attrs) {\n if (attrs.modalInClass) {\n $animateCss(element, {\n addClass: attrs.modalInClass\n }).start();\n\n scope.$on($modalStack.NOW_CLOSING_EVENT, function(e, setIsAsync) {\n var done = setIsAsync();\n if (scope.modalOptions.animation) {\n $animateCss(element, {\n removeClass: attrs.modalInClass\n }).start().then(done);\n } else {\n done();\n }\n });\n }\n }\n }])\n\n .directive('uibModalWindow', ['$uibModalStack', '$q', '$animate', '$animateCss', '$document',\n function($modalStack, $q, $animate, $animateCss, $document) {\n return {\n scope: {\n index: '@'\n },\n replace: true,\n transclude: true,\n templateUrl: function(tElement, tAttrs) {\n return tAttrs.templateUrl || 'uib/template/modal/window.html';\n },\n link: function(scope, element, attrs) {\n element.addClass(attrs.windowClass || '');\n element.addClass(attrs.windowTopClass || '');\n scope.size = attrs.size;\n\n scope.close = function(evt) {\n var modal = $modalStack.getTop();\n if (modal && modal.value.backdrop &&\n modal.value.backdrop !== 'static' &&\n evt.target === evt.currentTarget) {\n evt.preventDefault();\n evt.stopPropagation();\n $modalStack.dismiss(modal.key, 'backdrop click');\n }\n };\n\n // moved from template to fix issue #2280\n element.on('click', scope.close);\n\n // This property is only added to the scope for the purpose of detecting when this directive is rendered.\n // We can detect that by using this property in the template associated with this directive and then use\n // {@link Attribute#$observe} on it. For more details please see {@link TableColumnResize}.\n scope.$isRendered = true;\n\n // Deferred object that will be resolved when this modal is render.\n var modalRenderDeferObj = $q.defer();\n // Observe function will be called on next digest cycle after compilation, ensuring that the DOM is ready.\n // In order to use this way of finding whether DOM is ready, we need to observe a scope property used in modal's template.\n attrs.$observe('modalRender', function(value) {\n if (value === 'true') {\n modalRenderDeferObj.resolve();\n }\n });\n\n modalRenderDeferObj.promise.then(function() {\n var animationPromise = null;\n\n if (attrs.modalInClass) {\n animationPromise = $animateCss(element, {\n addClass: attrs.modalInClass\n }).start();\n\n scope.$on($modalStack.NOW_CLOSING_EVENT, function(e, setIsAsync) {\n var done = setIsAsync();\n if ($animateCss) {\n $animateCss(element, {\n removeClass: attrs.modalInClass\n }).start().then(done);\n } else {\n $animate.removeClass(element, attrs.modalInClass).then(done);\n }\n });\n }\n\n\n $q.when(animationPromise).then(function() {\n /**\n * If something within the freshly-opened modal already has focus (perhaps via a\n * directive that causes focus). then no need to try and focus anything.\n */\n if (!($document[0].activeElement && element[0].contains($document[0].activeElement))) {\n var inputWithAutofocus = element[0].querySelector('[autofocus]');\n /**\n * Auto-focusing of a freshly-opened modal element causes any child elements\n * with the autofocus attribute to lose focus. This is an issue on touch\n * based devices which will show and then hide the onscreen keyboard.\n * Attempts to refocus the autofocus element via JavaScript will not reopen\n * the onscreen keyboard. Fixed by updated the focusing logic to only autofocus\n * the modal element if the modal does not contain an autofocus element.\n */\n if (inputWithAutofocus) {\n inputWithAutofocus.focus();\n } else {\n element[0].focus();\n }\n }\n });\n\n // Notify {@link $modalStack} that modal is rendered.\n var modal = $modalStack.getTop();\n if (modal) {\n $modalStack.modalRendered(modal.key);\n }\n });\n }\n };\n }])\n\n .directive('uibModalAnimationClass', function() {\n return {\n compile: function(tElement, tAttrs) {\n if (tAttrs.modalAnimation) {\n tElement.addClass(tAttrs.uibModalAnimationClass);\n }\n }\n };\n })\n\n .directive('uibModalTransclude', function() {\n return {\n link: function(scope, element, attrs, controller, transclude) {\n transclude(scope.$parent, function(clone) {\n element.empty();\n element.append(clone);\n });\n }\n };\n })\n\n .factory('$uibModalStack', ['$animate', '$animateCss', '$document',\n '$compile', '$rootScope', '$q', '$$multiMap', '$$stackedMap',\n function($animate, $animateCss, $document, $compile, $rootScope, $q, $$multiMap, $$stackedMap) {\n var OPENED_MODAL_CLASS = 'modal-open';\n\n var backdropDomEl, backdropScope;\n var openedWindows = $$stackedMap.createNew();\n var openedClasses = $$multiMap.createNew();\n var $modalStack = {\n NOW_CLOSING_EVENT: 'modal.stack.now-closing'\n };\n\n //Modal focus behavior\n var focusableElementList;\n var focusIndex = 0;\n var tababbleSelector = 'a[href], area[href], input:not([disabled]), ' +\n 'button:not([disabled]),select:not([disabled]), textarea:not([disabled]), ' +\n 'iframe, object, embed, *[tabindex], *[contenteditable=true]';\n\n function backdropIndex() {\n var topBackdropIndex = -1;\n var opened = openedWindows.keys();\n for (var i = 0; i < opened.length; i++) {\n if (openedWindows.get(opened[i]).value.backdrop) {\n topBackdropIndex = i;\n }\n }\n return topBackdropIndex;\n }\n\n $rootScope.$watch(backdropIndex, function(newBackdropIndex) {\n if (backdropScope) {\n backdropScope.index = newBackdropIndex;\n }\n });\n\n function removeModalWindow(modalInstance, elementToReceiveFocus) {\n var modalWindow = openedWindows.get(modalInstance).value;\n var appendToElement = modalWindow.appendTo;\n\n //clean up the stack\n openedWindows.remove(modalInstance);\n\n removeAfterAnimate(modalWindow.modalDomEl, modalWindow.modalScope, function() {\n var modalBodyClass = modalWindow.openedClass || OPENED_MODAL_CLASS;\n openedClasses.remove(modalBodyClass, modalInstance);\n appendToElement.toggleClass(modalBodyClass, openedClasses.hasKey(modalBodyClass));\n toggleTopWindowClass(true);\n }, modalWindow.closedDeferred);\n checkRemoveBackdrop();\n\n //move focus to specified element if available, or else to body\n if (elementToReceiveFocus && elementToReceiveFocus.focus) {\n elementToReceiveFocus.focus();\n } else if (appendToElement.focus) {\n appendToElement.focus();\n }\n }\n\n // Add or remove \"windowTopClass\" from the top window in the stack\n function toggleTopWindowClass(toggleSwitch) {\n var modalWindow;\n\n if (openedWindows.length() > 0) {\n modalWindow = openedWindows.top().value;\n modalWindow.modalDomEl.toggleClass(modalWindow.windowTopClass || '', toggleSwitch);\n }\n }\n\n function checkRemoveBackdrop() {\n //remove backdrop if no longer needed\n if (backdropDomEl && backdropIndex() === -1) {\n var backdropScopeRef = backdropScope;\n removeAfterAnimate(backdropDomEl, backdropScope, function() {\n backdropScopeRef = null;\n });\n backdropDomEl = undefined;\n backdropScope = undefined;\n }\n }\n\n function removeAfterAnimate(domEl, scope, done, closedDeferred) {\n var asyncDeferred;\n var asyncPromise = null;\n var setIsAsync = function() {\n if (!asyncDeferred) {\n asyncDeferred = $q.defer();\n asyncPromise = asyncDeferred.promise;\n }\n\n return function asyncDone() {\n asyncDeferred.resolve();\n };\n };\n scope.$broadcast($modalStack.NOW_CLOSING_EVENT, setIsAsync);\n\n // Note that it's intentional that asyncPromise might be null.\n // That's when setIsAsync has not been called during the\n // NOW_CLOSING_EVENT broadcast.\n return $q.when(asyncPromise).then(afterAnimating);\n\n function afterAnimating() {\n if (afterAnimating.done) {\n return;\n }\n afterAnimating.done = true;\n\n $animateCss(domEl, {\n event: 'leave'\n }).start().then(function() {\n domEl.remove();\n if (closedDeferred) {\n closedDeferred.resolve();\n }\n });\n\n scope.$destroy();\n if (done) {\n done();\n }\n }\n }\n\n $document.on('keydown', keydownListener);\n\n $rootScope.$on('$destroy', function() {\n $document.off('keydown', keydownListener);\n });\n\n function keydownListener(evt) {\n if (evt.isDefaultPrevented()) {\n return evt;\n }\n\n var modal = openedWindows.top();\n if (modal) {\n switch (evt.which) {\n case 27: {\n if (modal.value.keyboard) {\n evt.preventDefault();\n $rootScope.$apply(function() {\n $modalStack.dismiss(modal.key, 'escape key press');\n });\n }\n break;\n }\n case 9: {\n $modalStack.loadFocusElementList(modal);\n var focusChanged = false;\n if (evt.shiftKey) {\n if ($modalStack.isFocusInFirstItem(evt) || $modalStack.isModalFocused(evt, modal)) {\n focusChanged = $modalStack.focusLastFocusableElement();\n }\n } else {\n if ($modalStack.isFocusInLastItem(evt)) {\n focusChanged = $modalStack.focusFirstFocusableElement();\n }\n }\n\n if (focusChanged) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n break;\n }\n }\n }\n }\n\n $modalStack.open = function(modalInstance, modal) {\n var modalOpener = $document[0].activeElement,\n modalBodyClass = modal.openedClass || OPENED_MODAL_CLASS;\n\n toggleTopWindowClass(false);\n\n openedWindows.add(modalInstance, {\n deferred: modal.deferred,\n renderDeferred: modal.renderDeferred,\n closedDeferred: modal.closedDeferred,\n modalScope: modal.scope,\n backdrop: modal.backdrop,\n keyboard: modal.keyboard,\n openedClass: modal.openedClass,\n windowTopClass: modal.windowTopClass,\n animation: modal.animation,\n appendTo: modal.appendTo\n });\n\n openedClasses.put(modalBodyClass, modalInstance);\n\n var appendToElement = modal.appendTo,\n currBackdropIndex = backdropIndex();\n\n if (!appendToElement.length) {\n throw new Error('appendTo element not found. Make sure that the element passed is in DOM.');\n }\n\n if (currBackdropIndex >= 0 && !backdropDomEl) {\n backdropScope = $rootScope.$new(true);\n backdropScope.modalOptions = modal;\n backdropScope.index = currBackdropIndex;\n backdropDomEl = angular.element('');\n backdropDomEl.attr('backdrop-class', modal.backdropClass);\n if (modal.animation) {\n backdropDomEl.attr('modal-animation', 'true');\n }\n $compile(backdropDomEl)(backdropScope);\n $animate.enter(backdropDomEl, appendToElement);\n }\n\n var angularDomEl = angular.element('');\n angularDomEl.attr({\n 'template-url': modal.windowTemplateUrl,\n 'window-class': modal.windowClass,\n 'window-top-class': modal.windowTopClass,\n 'size': modal.size,\n 'index': openedWindows.length() - 1,\n 'animate': 'animate'\n }).html(modal.content);\n if (modal.animation) {\n angularDomEl.attr('modal-animation', 'true');\n }\n\n $animate.enter($compile(angularDomEl)(modal.scope), appendToElement)\n .then(function() {\n $animate.addClass(appendToElement, modalBodyClass);\n });\n\n openedWindows.top().value.modalDomEl = angularDomEl;\n openedWindows.top().value.modalOpener = modalOpener;\n\n $modalStack.clearFocusListCache();\n };\n\n function broadcastClosing(modalWindow, resultOrReason, closing) {\n return !modalWindow.value.modalScope.$broadcast('modal.closing', resultOrReason, closing).defaultPrevented;\n }\n\n $modalStack.close = function(modalInstance, result) {\n var modalWindow = openedWindows.get(modalInstance);\n if (modalWindow && broadcastClosing(modalWindow, result, true)) {\n modalWindow.value.modalScope.$$uibDestructionScheduled = true;\n modalWindow.value.deferred.resolve(result);\n removeModalWindow(modalInstance, modalWindow.value.modalOpener);\n return true;\n }\n return !modalWindow;\n };\n\n $modalStack.dismiss = function(modalInstance, reason) {\n var modalWindow = openedWindows.get(modalInstance);\n if (modalWindow && broadcastClosing(modalWindow, reason, false)) {\n modalWindow.value.modalScope.$$uibDestructionScheduled = true;\n modalWindow.value.deferred.reject(reason);\n removeModalWindow(modalInstance, modalWindow.value.modalOpener);\n return true;\n }\n return !modalWindow;\n };\n\n $modalStack.dismissAll = function(reason) {\n var topModal = this.getTop();\n while (topModal && this.dismiss(topModal.key, reason)) {\n topModal = this.getTop();\n }\n };\n\n $modalStack.getTop = function() {\n return openedWindows.top();\n };\n\n $modalStack.modalRendered = function(modalInstance) {\n var modalWindow = openedWindows.get(modalInstance);\n if (modalWindow) {\n modalWindow.value.renderDeferred.resolve();\n }\n };\n\n $modalStack.focusFirstFocusableElement = function() {\n if (focusableElementList.length > 0) {\n focusableElementList[0].focus();\n return true;\n }\n return false;\n };\n $modalStack.focusLastFocusableElement = function() {\n if (focusableElementList.length > 0) {\n focusableElementList[focusableElementList.length - 1].focus();\n return true;\n }\n return false;\n };\n\n $modalStack.isModalFocused = function(evt, modalWindow) {\n if (evt && modalWindow) {\n var modalDomEl = modalWindow.value.modalDomEl;\n if (modalDomEl && modalDomEl.length) {\n return (evt.target || evt.srcElement) === modalDomEl[0];\n }\n }\n return false;\n };\n\n $modalStack.isFocusInFirstItem = function(evt) {\n if (focusableElementList.length > 0) {\n return (evt.target || evt.srcElement) === focusableElementList[0];\n }\n return false;\n };\n\n $modalStack.isFocusInLastItem = function(evt) {\n if (focusableElementList.length > 0) {\n return (evt.target || evt.srcElement) === focusableElementList[focusableElementList.length - 1];\n }\n return false;\n };\n\n $modalStack.clearFocusListCache = function() {\n focusableElementList = [];\n focusIndex = 0;\n };\n\n $modalStack.loadFocusElementList = function(modalWindow) {\n if (focusableElementList === undefined || !focusableElementList.length) {\n if (modalWindow) {\n var modalDomE1 = modalWindow.value.modalDomEl;\n if (modalDomE1 && modalDomE1.length) {\n focusableElementList = modalDomE1[0].querySelectorAll(tababbleSelector);\n }\n }\n }\n };\n\n return $modalStack;\n }])\n\n .provider('$uibModal', function() {\n var $modalProvider = {\n options: {\n animation: true,\n backdrop: true, //can also be false or 'static'\n keyboard: true\n },\n $get: ['$rootScope', '$q', '$document', '$templateRequest', '$controller', '$uibResolve', '$uibModalStack',\n function ($rootScope, $q, $document, $templateRequest, $controller, $uibResolve, $modalStack) {\n var $modal = {};\n\n function getTemplatePromise(options) {\n return options.template ? $q.when(options.template) :\n $templateRequest(angular.isFunction(options.templateUrl) ?\n options.templateUrl() : options.templateUrl);\n }\n\n var promiseChain = null;\n $modal.getPromiseChain = function() {\n return promiseChain;\n };\n\n $modal.open = function(modalOptions) {\n var modalResultDeferred = $q.defer();\n var modalOpenedDeferred = $q.defer();\n var modalClosedDeferred = $q.defer();\n var modalRenderDeferred = $q.defer();\n\n //prepare an instance of a modal to be injected into controllers and returned to a caller\n var modalInstance = {\n result: modalResultDeferred.promise,\n opened: modalOpenedDeferred.promise,\n closed: modalClosedDeferred.promise,\n rendered: modalRenderDeferred.promise,\n close: function (result) {\n return $modalStack.close(modalInstance, result);\n },\n dismiss: function (reason) {\n return $modalStack.dismiss(modalInstance, reason);\n }\n };\n\n //merge and clean up options\n modalOptions = angular.extend({}, $modalProvider.options, modalOptions);\n modalOptions.resolve = modalOptions.resolve || {};\n modalOptions.appendTo = modalOptions.appendTo || $document.find('body').eq(0);\n\n //verify options\n if (!modalOptions.template && !modalOptions.templateUrl) {\n throw new Error('One of template or templateUrl options is required.');\n }\n\n var templateAndResolvePromise =\n $q.all([getTemplatePromise(modalOptions), $uibResolve.resolve(modalOptions.resolve, {}, null, null)]);\n\n function resolveWithTemplate() {\n return templateAndResolvePromise;\n }\n\n // Wait for the resolution of the existing promise chain.\n // Then switch to our own combined promise dependency (regardless of how the previous modal fared).\n // Then add to $modalStack and resolve opened.\n // Finally clean up the chain variable if no subsequent modal has overwritten it.\n var samePromise;\n samePromise = promiseChain = $q.all([promiseChain])\n .then(resolveWithTemplate, resolveWithTemplate)\n .then(function resolveSuccess(tplAndVars) {\n var providedScope = modalOptions.scope || $rootScope;\n\n var modalScope = providedScope.$new();\n modalScope.$close = modalInstance.close;\n modalScope.$dismiss = modalInstance.dismiss;\n\n modalScope.$on('$destroy', function() {\n if (!modalScope.$$uibDestructionScheduled) {\n modalScope.$dismiss('$uibUnscheduledDestruction');\n }\n });\n\n var ctrlInstance, ctrlLocals = {};\n\n //controllers\n if (modalOptions.controller) {\n ctrlLocals.$scope = modalScope;\n ctrlLocals.$uibModalInstance = modalInstance;\n angular.forEach(tplAndVars[1], function(value, key) {\n ctrlLocals[key] = value;\n });\n\n ctrlInstance = $controller(modalOptions.controller, ctrlLocals);\n if (modalOptions.controllerAs) {\n if (modalOptions.bindToController) {\n ctrlInstance.$close = modalScope.$close;\n ctrlInstance.$dismiss = modalScope.$dismiss;\n angular.extend(ctrlInstance, providedScope);\n }\n\n modalScope[modalOptions.controllerAs] = ctrlInstance;\n }\n }\n\n $modalStack.open(modalInstance, {\n scope: modalScope,\n deferred: modalResultDeferred,\n renderDeferred: modalRenderDeferred,\n closedDeferred: modalClosedDeferred,\n content: tplAndVars[0],\n animation: modalOptions.animation,\n backdrop: modalOptions.backdrop,\n keyboard: modalOptions.keyboard,\n backdropClass: modalOptions.backdropClass,\n windowTopClass: modalOptions.windowTopClass,\n windowClass: modalOptions.windowClass,\n windowTemplateUrl: modalOptions.windowTemplateUrl,\n size: modalOptions.size,\n openedClass: modalOptions.openedClass,\n appendTo: modalOptions.appendTo\n });\n modalOpenedDeferred.resolve(true);\n\n }, function resolveError(reason) {\n modalOpenedDeferred.reject(reason);\n modalResultDeferred.reject(reason);\n })['finally'](function() {\n if (promiseChain === samePromise) {\n promiseChain = null;\n }\n });\n\n return modalInstance;\n };\n\n return $modal;\n }\n ]\n };\n\n return $modalProvider;\n });\n\nangular.module('ui.bootstrap.paging', [])\n/**\n * Helper internal service for generating common controller code between the\n * pager and pagination components\n */\n.factory('uibPaging', ['$parse', function($parse) {\n return {\n create: function(ctrl, $scope, $attrs) {\n ctrl.setNumPages = $attrs.numPages ? $parse($attrs.numPages).assign : angular.noop;\n ctrl.ngModelCtrl = { $setViewValue: angular.noop }; // nullModelCtrl\n ctrl._watchers = [];\n\n ctrl.init = function(ngModelCtrl, config) {\n ctrl.ngModelCtrl = ngModelCtrl;\n ctrl.config = config;\n\n ngModelCtrl.$render = function() {\n ctrl.render();\n };\n\n if ($attrs.itemsPerPage) {\n ctrl._watchers.push($scope.$parent.$watch($parse($attrs.itemsPerPage), function(value) {\n ctrl.itemsPerPage = parseInt(value, 10);\n $scope.totalPages = ctrl.calculateTotalPages();\n ctrl.updatePage();\n }));\n } else {\n ctrl.itemsPerPage = config.itemsPerPage;\n }\n\n $scope.$watch('totalItems', function(newTotal, oldTotal) {\n if (angular.isDefined(newTotal) || newTotal !== oldTotal) {\n $scope.totalPages = ctrl.calculateTotalPages();\n ctrl.updatePage();\n }\n });\n };\n\n ctrl.calculateTotalPages = function() {\n var totalPages = ctrl.itemsPerPage < 1 ? 1 : Math.ceil($scope.totalItems / ctrl.itemsPerPage);\n return Math.max(totalPages || 0, 1);\n };\n\n ctrl.render = function() {\n $scope.page = parseInt(ctrl.ngModelCtrl.$viewValue, 10) || 1;\n };\n\n $scope.selectPage = function(page, evt) {\n if (evt) {\n evt.preventDefault();\n }\n\n var clickAllowed = !$scope.ngDisabled || !evt;\n if (clickAllowed && $scope.page !== page && page > 0 && page <= $scope.totalPages) {\n if (evt && evt.target) {\n evt.target.blur();\n }\n ctrl.ngModelCtrl.$setViewValue(page);\n ctrl.ngModelCtrl.$render();\n }\n };\n\n $scope.getText = function(key) {\n return $scope[key + 'Text'] || ctrl.config[key + 'Text'];\n };\n\n $scope.noPrevious = function() {\n return $scope.page === 1;\n };\n\n $scope.noNext = function() {\n return $scope.page === $scope.totalPages;\n };\n\n ctrl.updatePage = function() {\n ctrl.setNumPages($scope.$parent, $scope.totalPages); // Readonly variable\n\n if ($scope.page > $scope.totalPages) {\n $scope.selectPage($scope.totalPages);\n } else {\n ctrl.ngModelCtrl.$render();\n }\n };\n\n $scope.$on('$destroy', function() {\n while (ctrl._watchers.length) {\n ctrl._watchers.shift()();\n }\n });\n }\n };\n}]);\n\nangular.module('ui.bootstrap.pager', ['ui.bootstrap.paging'])\n\n.controller('UibPagerController', ['$scope', '$attrs', 'uibPaging', 'uibPagerConfig', function($scope, $attrs, uibPaging, uibPagerConfig) {\n $scope.align = angular.isDefined($attrs.align) ? $scope.$parent.$eval($attrs.align) : uibPagerConfig.align;\n\n uibPaging.create(this, $scope, $attrs);\n}])\n\n.constant('uibPagerConfig', {\n itemsPerPage: 10,\n previousText: '« Previous',\n nextText: 'Next »',\n align: true\n})\n\n.directive('uibPager', ['uibPagerConfig', function(uibPagerConfig) {\n return {\n scope: {\n totalItems: '=',\n previousText: '@',\n nextText: '@',\n ngDisabled: '='\n },\n require: ['uibPager', '?ngModel'],\n controller: 'UibPagerController',\n controllerAs: 'pager',\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/pager/pager.html';\n },\n replace: true,\n link: function(scope, element, attrs, ctrls) {\n var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1];\n\n if (!ngModelCtrl) {\n return; // do nothing if no ng-model\n }\n\n paginationCtrl.init(ngModelCtrl, uibPagerConfig);\n }\n };\n}]);\n\nangular.module('ui.bootstrap.pagination', ['ui.bootstrap.paging'])\n.controller('UibPaginationController', ['$scope', '$attrs', '$parse', 'uibPaging', 'uibPaginationConfig', function($scope, $attrs, $parse, uibPaging, uibPaginationConfig) {\n var ctrl = this;\n // Setup configuration parameters\n var maxSize = angular.isDefined($attrs.maxSize) ? $scope.$parent.$eval($attrs.maxSize) : uibPaginationConfig.maxSize,\n rotate = angular.isDefined($attrs.rotate) ? $scope.$parent.$eval($attrs.rotate) : uibPaginationConfig.rotate,\n forceEllipses = angular.isDefined($attrs.forceEllipses) ? $scope.$parent.$eval($attrs.forceEllipses) : uibPaginationConfig.forceEllipses,\n boundaryLinkNumbers = angular.isDefined($attrs.boundaryLinkNumbers) ? $scope.$parent.$eval($attrs.boundaryLinkNumbers) : uibPaginationConfig.boundaryLinkNumbers;\n $scope.boundaryLinks = angular.isDefined($attrs.boundaryLinks) ? $scope.$parent.$eval($attrs.boundaryLinks) : uibPaginationConfig.boundaryLinks;\n $scope.directionLinks = angular.isDefined($attrs.directionLinks) ? $scope.$parent.$eval($attrs.directionLinks) : uibPaginationConfig.directionLinks;\n\n uibPaging.create(this, $scope, $attrs);\n\n if ($attrs.maxSize) {\n ctrl._watchers.push($scope.$parent.$watch($parse($attrs.maxSize), function(value) {\n maxSize = parseInt(value, 10);\n ctrl.render();\n }));\n }\n\n // Create page object used in template\n function makePage(number, text, isActive) {\n return {\n number: number,\n text: text,\n active: isActive\n };\n }\n\n function getPages(currentPage, totalPages) {\n var pages = [];\n\n // Default page limits\n var startPage = 1, endPage = totalPages;\n var isMaxSized = angular.isDefined(maxSize) && maxSize < totalPages;\n\n // recompute if maxSize\n if (isMaxSized) {\n if (rotate) {\n // Current page is displayed in the middle of the visible ones\n startPage = Math.max(currentPage - Math.floor(maxSize / 2), 1);\n endPage = startPage + maxSize - 1;\n\n // Adjust if limit is exceeded\n if (endPage > totalPages) {\n endPage = totalPages;\n startPage = endPage - maxSize + 1;\n }\n } else {\n // Visible pages are paginated with maxSize\n startPage = (Math.ceil(currentPage / maxSize) - 1) * maxSize + 1;\n\n // Adjust last page if limit is exceeded\n endPage = Math.min(startPage + maxSize - 1, totalPages);\n }\n }\n\n // Add page number links\n for (var number = startPage; number <= endPage; number++) {\n var page = makePage(number, number, number === currentPage);\n pages.push(page);\n }\n\n // Add links to move between page sets\n if (isMaxSized && maxSize > 0 && (!rotate || forceEllipses || boundaryLinkNumbers)) {\n if (startPage > 1) {\n if (!boundaryLinkNumbers || startPage > 3) { //need ellipsis for all options unless range is too close to beginning\n var previousPageSet = makePage(startPage - 1, '...', false);\n pages.unshift(previousPageSet);\n }\n if (boundaryLinkNumbers) {\n if (startPage === 3) { //need to replace ellipsis when the buttons would be sequential\n var secondPageLink = makePage(2, '2', false);\n pages.unshift(secondPageLink);\n }\n //add the first page\n var firstPageLink = makePage(1, '1', false);\n pages.unshift(firstPageLink);\n }\n }\n\n if (endPage < totalPages) {\n if (!boundaryLinkNumbers || endPage < totalPages - 2) { //need ellipsis for all options unless range is too close to end\n var nextPageSet = makePage(endPage + 1, '...', false);\n pages.push(nextPageSet);\n }\n if (boundaryLinkNumbers) {\n if (endPage === totalPages - 2) { //need to replace ellipsis when the buttons would be sequential\n var secondToLastPageLink = makePage(totalPages - 1, totalPages - 1, false);\n pages.push(secondToLastPageLink);\n }\n //add the last page\n var lastPageLink = makePage(totalPages, totalPages, false);\n pages.push(lastPageLink);\n }\n }\n }\n return pages;\n }\n\n var originalRender = this.render;\n this.render = function() {\n originalRender();\n if ($scope.page > 0 && $scope.page <= $scope.totalPages) {\n $scope.pages = getPages($scope.page, $scope.totalPages);\n }\n };\n}])\n\n.constant('uibPaginationConfig', {\n itemsPerPage: 10,\n boundaryLinks: false,\n boundaryLinkNumbers: false,\n directionLinks: true,\n firstText: 'First',\n previousText: 'Previous',\n nextText: 'Next',\n lastText: 'Last',\n rotate: true,\n forceEllipses: false\n})\n\n.directive('uibPagination', ['$parse', 'uibPaginationConfig', function($parse, uibPaginationConfig) {\n return {\n scope: {\n totalItems: '=',\n firstText: '@',\n previousText: '@',\n nextText: '@',\n lastText: '@',\n ngDisabled:'='\n },\n require: ['uibPagination', '?ngModel'],\n controller: 'UibPaginationController',\n controllerAs: 'pagination',\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || 'uib/template/pagination/pagination.html';\n },\n replace: true,\n link: function(scope, element, attrs, ctrls) {\n var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1];\n\n if (!ngModelCtrl) {\n return; // do nothing if no ng-model\n }\n\n paginationCtrl.init(ngModelCtrl, uibPaginationConfig);\n }\n };\n}]);\n\n/**\n * The following features are still outstanding: animation as a\n * function, placement as a function, inside, support for more triggers than\n * just mouse enter/leave, html tooltips, and selector delegation.\n */\nangular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.stackedMap'])\n\n/**\n * The $tooltip service creates tooltip- and popover-like directives as well as\n * houses global options for them.\n */\n.provider('$uibTooltip', function() {\n // The default options tooltip and popover.\n var defaultOptions = {\n placement: 'top',\n placementClassPrefix: '',\n animation: true,\n popupDelay: 0,\n popupCloseDelay: 0,\n useContentExp: false\n };\n\n // Default hide triggers for each show trigger\n var triggerMap = {\n 'mouseenter': 'mouseleave',\n 'click': 'click',\n 'outsideClick': 'outsideClick',\n 'focus': 'blur',\n 'none': ''\n };\n\n // The options specified to the provider globally.\n var globalOptions = {};\n\n /**\n * `options({})` allows global configuration of all tooltips in the\n * application.\n *\n * var app = angular.module( 'App', ['ui.bootstrap.tooltip'], function( $tooltipProvider ) {\n * // place tooltips left instead of top by default\n * $tooltipProvider.options( { placement: 'left' } );\n * });\n */\n\tthis.options = function(value) {\n\t\tangular.extend(globalOptions, value);\n\t};\n\n /**\n * This allows you to extend the set of trigger mappings available. E.g.:\n *\n * $tooltipProvider.setTriggers( 'openTrigger': 'closeTrigger' );\n */\n this.setTriggers = function setTriggers(triggers) {\n angular.extend(triggerMap, triggers);\n };\n\n /**\n * This is a helper function for translating camel-case to snake_case.\n */\n function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }\n\n /**\n * Returns the actual instance of the $tooltip service.\n * TODO support multiple triggers\n */\n this.$get = ['$window', '$compile', '$timeout', '$document', '$uibPosition', '$interpolate', '$rootScope', '$parse', '$$stackedMap', function($window, $compile, $timeout, $document, $position, $interpolate, $rootScope, $parse, $$stackedMap) {\n var openedTooltips = $$stackedMap.createNew();\n $document.on('keypress', keypressListener);\n\n $rootScope.$on('$destroy', function() {\n $document.off('keypress', keypressListener);\n });\n\n function keypressListener(e) {\n if (e.which === 27) {\n var last = openedTooltips.top();\n if (last) {\n last.value.close();\n openedTooltips.removeTop();\n last = null;\n }\n }\n }\n\n return function $tooltip(ttType, prefix, defaultTriggerShow, options) {\n options = angular.extend({}, defaultOptions, globalOptions, options);\n\n /**\n * Returns an object of show and hide triggers.\n *\n * If a trigger is supplied,\n * it is used to show the tooltip; otherwise, it will use the `trigger`\n * option passed to the `$tooltipProvider.options` method; else it will\n * default to the trigger supplied to this directive factory.\n *\n * The hide trigger is based on the show trigger. If the `trigger` option\n * was passed to the `$tooltipProvider.options` method, it will use the\n * mapped trigger from `triggerMap` or the passed trigger if the map is\n * undefined; otherwise, it uses the `triggerMap` value of the show\n * trigger; else it will just use the show trigger.\n */\n function getTriggers(trigger) {\n var show = (trigger || options.trigger || defaultTriggerShow).split(' ');\n var hide = show.map(function(trigger) {\n return triggerMap[trigger] || trigger;\n });\n return {\n show: show,\n hide: hide\n };\n }\n\n var directiveName = snake_case(ttType);\n\n var startSym = $interpolate.startSymbol();\n var endSym = $interpolate.endSymbol();\n var template =\n '' +\n '
';\n\n return {\n compile: function(tElem, tAttrs) {\n var tooltipLinker = $compile(template);\n\n return function link(scope, element, attrs, tooltipCtrl) {\n var tooltip;\n var tooltipLinkedScope;\n var transitionTimeout;\n var showTimeout;\n var hideTimeout;\n var positionTimeout;\n var appendToBody = angular.isDefined(options.appendToBody) ? options.appendToBody : false;\n var triggers = getTriggers(undefined);\n var hasEnableExp = angular.isDefined(attrs[prefix + 'Enable']);\n var ttScope = scope.$new(true);\n var repositionScheduled = false;\n var isOpenParse = angular.isDefined(attrs[prefix + 'IsOpen']) ? $parse(attrs[prefix + 'IsOpen']) : false;\n var contentParse = options.useContentExp ? $parse(attrs[ttType]) : false;\n var observers = [];\n\n var positionTooltip = function() {\n // check if tooltip exists and is not empty\n if (!tooltip || !tooltip.html()) { return; }\n\n if (!positionTimeout) {\n positionTimeout = $timeout(function() {\n // Reset the positioning.\n tooltip.css({ top: 0, left: 0 });\n\n // Now set the calculated positioning.\n var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);\n tooltip.css({ top: ttPosition.top + 'px', left: ttPosition.left + 'px', visibility: 'visible' });\n\n // If the placement class is prefixed, still need\n // to remove the TWBS standard class.\n if (options.placementClassPrefix) {\n tooltip.removeClass('top bottom left right');\n }\n\n tooltip.removeClass(\n options.placementClassPrefix + 'top ' +\n options.placementClassPrefix + 'top-left ' +\n options.placementClassPrefix + 'top-right ' +\n options.placementClassPrefix + 'bottom ' +\n options.placementClassPrefix + 'bottom-left ' +\n options.placementClassPrefix + 'bottom-right ' +\n options.placementClassPrefix + 'left ' +\n options.placementClassPrefix + 'left-top ' +\n options.placementClassPrefix + 'left-bottom ' +\n options.placementClassPrefix + 'right ' +\n options.placementClassPrefix + 'right-top ' +\n options.placementClassPrefix + 'right-bottom');\n\n var placement = ttPosition.placement.split('-');\n tooltip.addClass(placement[0] + ' ' + options.placementClassPrefix + ttPosition.placement);\n $position.positionArrow(tooltip, ttPosition.placement);\n\n positionTimeout = null;\n }, 0, false);\n }\n };\n\n // Set up the correct scope to allow transclusion later\n ttScope.origScope = scope;\n\n // By default, the tooltip is not open.\n // TODO add ability to start tooltip opened\n ttScope.isOpen = false;\n openedTooltips.add(ttScope, {\n close: hide\n });\n\n function toggleTooltipBind() {\n if (!ttScope.isOpen) {\n showTooltipBind();\n } else {\n hideTooltipBind();\n }\n }\n\n // Show the tooltip with delay if specified, otherwise show it immediately\n function showTooltipBind() {\n if (hasEnableExp && !scope.$eval(attrs[prefix + 'Enable'])) {\n return;\n }\n\n cancelHide();\n prepareTooltip();\n\n if (ttScope.popupDelay) {\n // Do nothing if the tooltip was already scheduled to pop-up.\n // This happens if show is triggered multiple times before any hide is triggered.\n if (!showTimeout) {\n showTimeout = $timeout(show, ttScope.popupDelay, false);\n }\n } else {\n show();\n }\n }\n\n function hideTooltipBind() {\n cancelShow();\n\n if (ttScope.popupCloseDelay) {\n if (!hideTimeout) {\n hideTimeout = $timeout(hide, ttScope.popupCloseDelay, false);\n }\n } else {\n hide();\n }\n }\n\n // Show the tooltip popup element.\n function show() {\n cancelShow();\n cancelHide();\n\n // Don't show empty tooltips.\n if (!ttScope.content) {\n return angular.noop;\n }\n\n createTooltip();\n\n // And show the tooltip.\n ttScope.$evalAsync(function() {\n ttScope.isOpen = true;\n assignIsOpen(true);\n positionTooltip();\n });\n }\n\n function cancelShow() {\n if (showTimeout) {\n $timeout.cancel(showTimeout);\n showTimeout = null;\n }\n\n if (positionTimeout) {\n $timeout.cancel(positionTimeout);\n positionTimeout = null;\n }\n }\n\n // Hide the tooltip popup element.\n function hide() {\n if (!ttScope) {\n return;\n }\n\n // First things first: we don't show it anymore.\n ttScope.$evalAsync(function() {\n if (ttScope) {\n ttScope.isOpen = false;\n assignIsOpen(false);\n // And now we remove it from the DOM. However, if we have animation, we\n // need to wait for it to expire beforehand.\n // FIXME: this is a placeholder for a port of the transitions library.\n // The fade transition in TWBS is 150ms.\n if (ttScope.animation) {\n if (!transitionTimeout) {\n transitionTimeout = $timeout(removeTooltip, 150, false);\n }\n } else {\n removeTooltip();\n }\n }\n });\n }\n\n function cancelHide() {\n if (hideTimeout) {\n $timeout.cancel(hideTimeout);\n hideTimeout = null;\n }\n\n if (transitionTimeout) {\n $timeout.cancel(transitionTimeout);\n transitionTimeout = null;\n }\n }\n\n function createTooltip() {\n // There can only be one tooltip element per directive shown at once.\n if (tooltip) {\n return;\n }\n\n tooltipLinkedScope = ttScope.$new();\n tooltip = tooltipLinker(tooltipLinkedScope, function(tooltip) {\n if (appendToBody) {\n $document.find('body').append(tooltip);\n } else {\n element.after(tooltip);\n }\n });\n\n prepObservers();\n }\n\n function removeTooltip() {\n cancelShow();\n cancelHide();\n unregisterObservers();\n\n if (tooltip) {\n tooltip.remove();\n tooltip = null;\n }\n if (tooltipLinkedScope) {\n tooltipLinkedScope.$destroy();\n tooltipLinkedScope = null;\n }\n }\n\n /**\n * Set the initial scope values. Once\n * the tooltip is created, the observers\n * will be added to keep things in sync.\n */\n function prepareTooltip() {\n ttScope.title = attrs[prefix + 'Title'];\n if (contentParse) {\n ttScope.content = contentParse(scope);\n } else {\n ttScope.content = attrs[ttType];\n }\n\n ttScope.popupClass = attrs[prefix + 'Class'];\n ttScope.placement = angular.isDefined(attrs[prefix + 'Placement']) ? attrs[prefix + 'Placement'] : options.placement;\n\n var delay = parseInt(attrs[prefix + 'PopupDelay'], 10);\n var closeDelay = parseInt(attrs[prefix + 'PopupCloseDelay'], 10);\n ttScope.popupDelay = !isNaN(delay) ? delay : options.popupDelay;\n ttScope.popupCloseDelay = !isNaN(closeDelay) ? closeDelay : options.popupCloseDelay;\n }\n\n function assignIsOpen(isOpen) {\n if (isOpenParse && angular.isFunction(isOpenParse.assign)) {\n isOpenParse.assign(scope, isOpen);\n }\n }\n\n ttScope.contentExp = function() {\n return ttScope.content;\n };\n\n /**\n * Observe the relevant attributes.\n */\n attrs.$observe('disabled', function(val) {\n if (val) {\n cancelShow();\n }\n\n if (val && ttScope.isOpen) {\n hide();\n }\n });\n\n if (isOpenParse) {\n scope.$watch(isOpenParse, function(val) {\n if (ttScope && !val === ttScope.isOpen) {\n toggleTooltipBind();\n }\n });\n }\n\n function prepObservers() {\n observers.length = 0;\n\n if (contentParse) {\n observers.push(\n scope.$watch(contentParse, function(val) {\n ttScope.content = val;\n if (!val && ttScope.isOpen) {\n hide();\n }\n })\n );\n\n observers.push(\n tooltipLinkedScope.$watch(function() {\n if (!repositionScheduled) {\n repositionScheduled = true;\n tooltipLinkedScope.$$postDigest(function() {\n repositionScheduled = false;\n if (ttScope && ttScope.isOpen) {\n positionTooltip();\n }\n });\n }\n })\n );\n } else {\n observers.push(\n attrs.$observe(ttType, function(val) {\n ttScope.content = val;\n if (!val && ttScope.isOpen) {\n hide();\n } else {\n positionTooltip();\n }\n })\n );\n }\n\n observers.push(\n attrs.$observe(prefix + 'Title', function(val) {\n ttScope.title = val;\n if (ttScope.isOpen) {\n positionTooltip();\n }\n })\n );\n\n observers.push(\n attrs.$observe(prefix + 'Placement', function(val) {\n ttScope.placement = val ? val : options.placement;\n if (ttScope.isOpen) {\n positionTooltip();\n }\n })\n );\n }\n\n function unregisterObservers() {\n if (observers.length) {\n angular.forEach(observers, function(observer) {\n observer();\n });\n observers.length = 0;\n }\n }\n\n // hide tooltips/popovers for outsideClick trigger\n function bodyHideTooltipBind(e) {\n if (!ttScope || !ttScope.isOpen || !tooltip) {\n return;\n }\n // make sure the tooltip/popover link or tool tooltip/popover itself were not clicked\n if (!element[0].contains(e.target) && !tooltip[0].contains(e.target)) {\n hideTooltipBind();\n }\n }\n\n var unregisterTriggers = function() {\n triggers.show.forEach(function(trigger) {\n if (trigger === 'outsideClick') {\n element.off('click', toggleTooltipBind);\n } else {\n element.off(trigger, showTooltipBind);\n element.off(trigger, toggleTooltipBind);\n }\n });\n triggers.hide.forEach(function(trigger) {\n if (trigger === 'outsideClick') {\n $document.off('click', bodyHideTooltipBind);\n } else {\n element.off(trigger, hideTooltipBind);\n }\n });\n };\n\n function prepTriggers() {\n var val = attrs[prefix + 'Trigger'];\n unregisterTriggers();\n\n triggers = getTriggers(val);\n\n if (triggers.show !== 'none') {\n triggers.show.forEach(function(trigger, idx) {\n if (trigger === 'outsideClick') {\n element.on('click', toggleTooltipBind);\n $document.on('click', bodyHideTooltipBind);\n } else if (trigger === triggers.hide[idx]) {\n element.on(trigger, toggleTooltipBind);\n } else if (trigger) {\n element.on(trigger, showTooltipBind);\n element.on(triggers.hide[idx], hideTooltipBind);\n }\n\n element.on('keypress', function(e) {\n if (e.which === 27) {\n hideTooltipBind();\n }\n });\n });\n }\n }\n\n prepTriggers();\n\n var animation = scope.$eval(attrs[prefix + 'Animation']);\n ttScope.animation = angular.isDefined(animation) ? !!animation : options.animation;\n\n var appendToBodyVal;\n var appendKey = prefix + 'AppendToBody';\n if (appendKey in attrs && attrs[appendKey] === undefined) {\n appendToBodyVal = true;\n } else {\n appendToBodyVal = scope.$eval(attrs[appendKey]);\n }\n\n appendToBody = angular.isDefined(appendToBodyVal) ? appendToBodyVal : appendToBody;\n \n // Make sure tooltip is destroyed and removed.\n scope.$on('$destroy', function onDestroyTooltip() {\n unregisterTriggers();\n removeTooltip();\n openedTooltips.remove(ttScope);\n ttScope = null;\n });\n };\n }\n };\n };\n }];\n})\n\n// This is mostly ngInclude code but with a custom scope\n.directive('uibTooltipTemplateTransclude', [\n '$animate', '$sce', '$compile', '$templateRequest',\nfunction ($animate, $sce, $compile, $templateRequest) {\n return {\n link: function(scope, elem, attrs) {\n var origScope = scope.$eval(attrs.tooltipTemplateTranscludeScope);\n\n var changeCounter = 0,\n currentScope,\n previousElement,\n currentElement;\n\n var cleanupLastIncludeContent = function() {\n if (previousElement) {\n previousElement.remove();\n previousElement = null;\n }\n\n if (currentScope) {\n currentScope.$destroy();\n currentScope = null;\n }\n\n if (currentElement) {\n $animate.leave(currentElement).then(function() {\n previousElement = null;\n });\n previousElement = currentElement;\n currentElement = null;\n }\n };\n\n scope.$watch($sce.parseAsResourceUrl(attrs.uibTooltipTemplateTransclude), function(src) {\n var thisChangeId = ++changeCounter;\n\n if (src) {\n //set the 2nd param to true to ignore the template request error so that the inner\n //contents and scope can be cleaned up.\n $templateRequest(src, true).then(function(response) {\n if (thisChangeId !== changeCounter) { return; }\n var newScope = origScope.$new();\n var template = response;\n\n var clone = $compile(template)(newScope, function(clone) {\n cleanupLastIncludeContent();\n $animate.enter(clone, elem);\n });\n\n currentScope = newScope;\n currentElement = clone;\n\n currentScope.$emit('$includeContentLoaded', src);\n }, function() {\n if (thisChangeId === changeCounter) {\n cleanupLastIncludeContent();\n scope.$emit('$includeContentError', src);\n }\n });\n scope.$emit('$includeContentRequested', src);\n } else {\n cleanupLastIncludeContent();\n }\n });\n\n scope.$on('$destroy', cleanupLastIncludeContent);\n }\n };\n}])\n\n/**\n * Note that it's intentional that these classes are *not* applied through $animate.\n * They must not be animated as they're expected to be present on the tooltip on\n * initialization.\n */\n.directive('uibTooltipClasses', ['$uibPosition', function($uibPosition) {\n return {\n restrict: 'A',\n link: function(scope, element, attrs) {\n // need to set the primary position so the\n // arrow has space during position measure.\n // tooltip.positionTooltip()\n if (scope.placement) {\n // // There are no top-left etc... classes\n // // in TWBS, so we need the primary position.\n var position = $uibPosition.parsePlacement(scope.placement);\n element.addClass(position[0]);\n } else {\n element.addClass('top');\n }\n\n if (scope.popupClass) {\n element.addClass(scope.popupClass);\n }\n\n if (scope.animation()) {\n element.addClass(attrs.tooltipAnimationClass);\n }\n }\n };\n}])\n\n.directive('uibTooltipPopup', function() {\n return {\n replace: true,\n scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },\n templateUrl: 'uib/template/tooltip/tooltip-popup.html'\n };\n})\n\n.directive('uibTooltip', [ '$uibTooltip', function($uibTooltip) {\n return $uibTooltip('uibTooltip', 'tooltip', 'mouseenter');\n}])\n\n.directive('uibTooltipTemplatePopup', function() {\n return {\n replace: true,\n scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',\n originScope: '&' },\n templateUrl: 'uib/template/tooltip/tooltip-template-popup.html'\n };\n})\n\n.directive('uibTooltipTemplate', ['$uibTooltip', function($uibTooltip) {\n return $uibTooltip('uibTooltipTemplate', 'tooltip', 'mouseenter', {\n useContentExp: true\n });\n}])\n\n.directive('uibTooltipHtmlPopup', function() {\n return {\n replace: true,\n scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },\n templateUrl: 'uib/template/tooltip/tooltip-html-popup.html'\n };\n})\n\n.directive('uibTooltipHtml', ['$uibTooltip', function($uibTooltip) {\n return $uibTooltip('uibTooltipHtml', 'tooltip', 'mouseenter', {\n useContentExp: true\n });\n}]);\n\n/**\n * The following features are still outstanding: popup delay, animation as a\n * function, placement as a function, inside, support for more triggers than\n * just mouse enter/leave, and selector delegatation.\n */\nangular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])\n\n.directive('uibPopoverTemplatePopup', function() {\n return {\n replace: true,\n scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',\n originScope: '&' },\n templateUrl: 'uib/template/popover/popover-template.html'\n };\n})\n\n.directive('uibPopoverTemplate', ['$uibTooltip', function($uibTooltip) {\n return $uibTooltip('uibPopoverTemplate', 'popover', 'click', {\n useContentExp: true\n });\n}])\n\n.directive('uibPopoverHtmlPopup', function() {\n return {\n replace: true,\n scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },\n templateUrl: 'uib/template/popover/popover-html.html'\n };\n})\n\n.directive('uibPopoverHtml', ['$uibTooltip', function($uibTooltip) {\n return $uibTooltip('uibPopoverHtml', 'popover', 'click', {\n useContentExp: true\n });\n}])\n\n.directive('uibPopoverPopup', function() {\n return {\n replace: true,\n scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },\n templateUrl: 'uib/template/popover/popover.html'\n };\n})\n\n.directive('uibPopover', ['$uibTooltip', function($uibTooltip) {\n return $uibTooltip('uibPopover', 'popover', 'click');\n}]);\n\nangular.module('ui.bootstrap.progressbar', [])\n\n.constant('uibProgressConfig', {\n animate: true,\n max: 100\n})\n\n.controller('UibProgressController', ['$scope', '$attrs', 'uibProgressConfig', function($scope, $attrs, progressConfig) {\n var self = this,\n animate = angular.isDefined($attrs.animate) ? $scope.$parent.$eval($attrs.animate) : progressConfig.animate;\n\n this.bars = [];\n $scope.max = angular.isDefined($scope.max) ? $scope.max : progressConfig.max;\n\n this.addBar = function(bar, element, attrs) {\n if (!animate) {\n element.css({'transition': 'none'});\n }\n\n this.bars.push(bar);\n\n bar.max = $scope.max;\n bar.title = attrs && angular.isDefined(attrs.title) ? attrs.title : 'progressbar';\n\n bar.$watch('value', function(value) {\n bar.recalculatePercentage();\n });\n\n bar.recalculatePercentage = function() {\n var totalPercentage = self.bars.reduce(function(total, bar) {\n bar.percent = +(100 * bar.value / bar.max).toFixed(2);\n return total + bar.percent;\n }, 0);\n\n if (totalPercentage > 100) {\n bar.percent -= totalPercentage - 100;\n }\n };\n\n bar.$on('$destroy', function() {\n element = null;\n self.removeBar(bar);\n });\n };\n\n this.removeBar = function(bar) {\n this.bars.splice(this.bars.indexOf(bar), 1);\n this.bars.forEach(function (bar) {\n bar.recalculatePercentage();\n });\n };\n\n $scope.$watch('max', function(max) {\n self.bars.forEach(function(bar) {\n bar.max = $scope.max;\n bar.recalculatePercentage();\n });\n });\n}])\n\n.directive('uibProgress', function() {\n return {\n replace: true,\n transclude: true,\n controller: 'UibProgressController',\n require: 'uibProgress',\n scope: {\n max: '=?'\n },\n templateUrl: 'uib/template/progressbar/progress.html'\n };\n})\n\n.directive('uibBar', function() {\n return {\n replace: true,\n transclude: true,\n require: '^uibProgress',\n scope: {\n value: '=',\n type: '@'\n },\n templateUrl: 'uib/template/progressbar/bar.html',\n link: function(scope, element, attrs, progressCtrl) {\n progressCtrl.addBar(scope, element, attrs);\n }\n };\n})\n\n.directive('uibProgressbar', function() {\n return {\n replace: true,\n transclude: true,\n controller: 'UibProgressController',\n scope: {\n value: '=',\n max: '=?',\n type: '@'\n },\n templateUrl: 'uib/template/progressbar/progressbar.html',\n link: function(scope, element, attrs, progressCtrl) {\n progressCtrl.addBar(scope, angular.element(element.children()[0]), {title: attrs.title});\n }\n };\n});\n\nangular.module('ui.bootstrap.rating', [])\n\n.constant('uibRatingConfig', {\n max: 5,\n stateOn: null,\n stateOff: null,\n titles : ['one', 'two', 'three', 'four', 'five']\n})\n\n.controller('UibRatingController', ['$scope', '$attrs', 'uibRatingConfig', function($scope, $attrs, ratingConfig) {\n var ngModelCtrl = { $setViewValue: angular.noop };\n\n this.init = function(ngModelCtrl_) {\n ngModelCtrl = ngModelCtrl_;\n ngModelCtrl.$render = this.render;\n\n ngModelCtrl.$formatters.push(function(value) {\n if (angular.isNumber(value) && value << 0 !== value) {\n value = Math.round(value);\n }\n\n return value;\n });\n\n this.stateOn = angular.isDefined($attrs.stateOn) ? $scope.$parent.$eval($attrs.stateOn) : ratingConfig.stateOn;\n this.stateOff = angular.isDefined($attrs.stateOff) ? $scope.$parent.$eval($attrs.stateOff) : ratingConfig.stateOff;\n var tmpTitles = angular.isDefined($attrs.titles) ? $scope.$parent.$eval($attrs.titles) : ratingConfig.titles ;\n this.titles = angular.isArray(tmpTitles) && tmpTitles.length > 0 ?\n tmpTitles : ratingConfig.titles;\n\n var ratingStates = angular.isDefined($attrs.ratingStates) ?\n $scope.$parent.$eval($attrs.ratingStates) :\n new Array(angular.isDefined($attrs.max) ? $scope.$parent.$eval($attrs.max) : ratingConfig.max);\n $scope.range = this.buildTemplateObjects(ratingStates);\n };\n\n this.buildTemplateObjects = function(states) {\n for (var i = 0, n = states.length; i < n; i++) {\n states[i] = angular.extend({ index: i }, { stateOn: this.stateOn, stateOff: this.stateOff, title: this.getTitle(i) }, states[i]);\n }\n return states;\n };\n\n this.getTitle = function(index) {\n if (index >= this.titles.length) {\n return index + 1;\n }\n\n return this.titles[index];\n };\n\n $scope.rate = function(value) {\n if (!$scope.readonly && value >= 0 && value <= $scope.range.length) {\n ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue === value ? 0 : value);\n ngModelCtrl.$render();\n }\n };\n\n $scope.enter = function(value) {\n if (!$scope.readonly) {\n $scope.value = value;\n }\n $scope.onHover({value: value});\n };\n\n $scope.reset = function() {\n $scope.value = ngModelCtrl.$viewValue;\n $scope.onLeave();\n };\n\n $scope.onKeydown = function(evt) {\n if (/(37|38|39|40)/.test(evt.which)) {\n evt.preventDefault();\n evt.stopPropagation();\n $scope.rate($scope.value + (evt.which === 38 || evt.which === 39 ? 1 : -1));\n }\n };\n\n this.render = function() {\n $scope.value = ngModelCtrl.$viewValue;\n };\n}])\n\n.directive('uibRating', function() {\n return {\n require: ['uibRating', 'ngModel'],\n scope: {\n readonly: '=?',\n onHover: '&',\n onLeave: '&'\n },\n controller: 'UibRatingController',\n templateUrl: 'uib/template/rating/rating.html',\n replace: true,\n link: function(scope, element, attrs, ctrls) {\n var ratingCtrl = ctrls[0], ngModelCtrl = ctrls[1];\n ratingCtrl.init(ngModelCtrl);\n }\n };\n});\n\nangular.module('ui.bootstrap.tabs', [])\n\n.controller('UibTabsetController', ['$scope', function ($scope) {\n var ctrl = this,\n tabs = ctrl.tabs = $scope.tabs = [];\n\n ctrl.select = function(selectedTab) {\n angular.forEach(tabs, function(tab) {\n if (tab.active && tab !== selectedTab) {\n tab.active = false;\n tab.onDeselect();\n selectedTab.selectCalled = false;\n }\n });\n selectedTab.active = true;\n // only call select if it has not already been called\n if (!selectedTab.selectCalled) {\n selectedTab.onSelect();\n selectedTab.selectCalled = true;\n }\n };\n\n ctrl.addTab = function addTab(tab) {\n tabs.push(tab);\n // we can't run the select function on the first tab\n // since that would select it twice\n if (tabs.length === 1 && tab.active !== false) {\n tab.active = true;\n } else if (tab.active) {\n ctrl.select(tab);\n } else {\n tab.active = false;\n }\n };\n\n ctrl.removeTab = function removeTab(tab) {\n var index = tabs.indexOf(tab);\n //Select a new tab if the tab to be removed is selected and not destroyed\n if (tab.active && tabs.length > 1 && !destroyed) {\n //If this is the last tab, select the previous tab. else, the next tab.\n var newActiveIndex = index === tabs.length - 1 ? index - 1 : index + 1;\n ctrl.select(tabs[newActiveIndex]);\n }\n tabs.splice(index, 1);\n };\n\n var destroyed;\n $scope.$on('$destroy', function() {\n destroyed = true;\n });\n}])\n\n.directive('uibTabset', function() {\n return {\n transclude: true,\n replace: true,\n scope: {\n type: '@'\n },\n controller: 'UibTabsetController',\n templateUrl: 'uib/template/tabs/tabset.html',\n link: function(scope, element, attrs) {\n scope.vertical = angular.isDefined(attrs.vertical) ? scope.$parent.$eval(attrs.vertical) : false;\n scope.justified = angular.isDefined(attrs.justified) ? scope.$parent.$eval(attrs.justified) : false;\n }\n };\n})\n\n.directive('uibTab', ['$parse', function($parse) {\n return {\n require: '^uibTabset',\n replace: true,\n templateUrl: 'uib/template/tabs/tab.html',\n transclude: true,\n scope: {\n active: '=?',\n heading: '@',\n onSelect: '&select', //This callback is called in contentHeadingTransclude\n //once it inserts the tab's content into the dom\n onDeselect: '&deselect'\n },\n controller: function() {\n //Empty controller so other directives can require being 'under' a tab\n },\n controllerAs: 'tab',\n link: function(scope, elm, attrs, tabsetCtrl, transclude) {\n scope.$watch('active', function(active) {\n if (active) {\n tabsetCtrl.select(scope);\n }\n });\n\n scope.disabled = false;\n if (attrs.disable) {\n scope.$parent.$watch($parse(attrs.disable), function(value) {\n scope.disabled = !! value;\n });\n }\n\n scope.select = function() {\n if (!scope.disabled) {\n scope.active = true;\n }\n };\n\n tabsetCtrl.addTab(scope);\n scope.$on('$destroy', function() {\n tabsetCtrl.removeTab(scope);\n });\n\n //We need to transclude later, once the content container is ready.\n //when this link happens, we're inside a tab heading.\n scope.$transcludeFn = transclude;\n }\n };\n}])\n\n.directive('uibTabHeadingTransclude', function() {\n return {\n restrict: 'A',\n require: '^uibTab',\n link: function(scope, elm) {\n scope.$watch('headingElement', function updateHeadingElement(heading) {\n if (heading) {\n elm.html('');\n elm.append(heading);\n }\n });\n }\n };\n})\n\n.directive('uibTabContentTransclude', function() {\n return {\n restrict: 'A',\n require: '^uibTabset',\n link: function(scope, elm, attrs) {\n var tab = scope.$eval(attrs.uibTabContentTransclude);\n\n //Now our tab is ready to be transcluded: both the tab heading area\n //and the tab content area are loaded. Transclude 'em both.\n tab.$transcludeFn(tab.$parent, function(contents) {\n angular.forEach(contents, function(node) {\n if (isTabHeading(node)) {\n //Let tabHeadingTransclude know.\n tab.headingElement = node;\n } else {\n elm.append(node);\n }\n });\n });\n }\n };\n\n function isTabHeading(node) {\n return node.tagName && (\n node.hasAttribute('uib-tab-heading') ||\n node.hasAttribute('data-uib-tab-heading') ||\n node.hasAttribute('x-uib-tab-heading') ||\n node.tagName.toLowerCase() === 'uib-tab-heading' ||\n node.tagName.toLowerCase() === 'data-uib-tab-heading' ||\n node.tagName.toLowerCase() === 'x-uib-tab-heading'\n );\n }\n});\n\nangular.module('ui.bootstrap.timepicker', [])\n\n.constant('uibTimepickerConfig', {\n hourStep: 1,\n minuteStep: 1,\n secondStep: 1,\n showMeridian: true,\n showSeconds: false,\n meridians: null,\n readonlyInput: false,\n mousewheel: true,\n arrowkeys: true,\n showSpinners: true,\n templateUrl: 'uib/template/timepicker/timepicker.html'\n})\n\n.controller('UibTimepickerController', ['$scope', '$element', '$attrs', '$parse', '$log', '$locale', 'uibTimepickerConfig', function($scope, $element, $attrs, $parse, $log, $locale, timepickerConfig) {\n var selected = new Date(),\n watchers = [],\n ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl\n meridians = angular.isDefined($attrs.meridians) ? $scope.$parent.$eval($attrs.meridians) : timepickerConfig.meridians || $locale.DATETIME_FORMATS.AMPMS;\n\n $scope.tabindex = angular.isDefined($attrs.tabindex) ? $attrs.tabindex : 0;\n $element.removeAttr('tabindex');\n\n this.init = function(ngModelCtrl_, inputs) {\n ngModelCtrl = ngModelCtrl_;\n ngModelCtrl.$render = this.render;\n\n ngModelCtrl.$formatters.unshift(function(modelValue) {\n return modelValue ? new Date(modelValue) : null;\n });\n\n var hoursInputEl = inputs.eq(0),\n minutesInputEl = inputs.eq(1),\n secondsInputEl = inputs.eq(2);\n\n var mousewheel = angular.isDefined($attrs.mousewheel) ? $scope.$parent.$eval($attrs.mousewheel) : timepickerConfig.mousewheel;\n\n if (mousewheel) {\n this.setupMousewheelEvents(hoursInputEl, minutesInputEl, secondsInputEl);\n }\n\n var arrowkeys = angular.isDefined($attrs.arrowkeys) ? $scope.$parent.$eval($attrs.arrowkeys) : timepickerConfig.arrowkeys;\n if (arrowkeys) {\n this.setupArrowkeyEvents(hoursInputEl, minutesInputEl, secondsInputEl);\n }\n\n $scope.readonlyInput = angular.isDefined($attrs.readonlyInput) ? $scope.$parent.$eval($attrs.readonlyInput) : timepickerConfig.readonlyInput;\n this.setupInputEvents(hoursInputEl, minutesInputEl, secondsInputEl);\n };\n\n var hourStep = timepickerConfig.hourStep;\n if ($attrs.hourStep) {\n watchers.push($scope.$parent.$watch($parse($attrs.hourStep), function(value) {\n hourStep = +value;\n }));\n }\n\n var minuteStep = timepickerConfig.minuteStep;\n if ($attrs.minuteStep) {\n watchers.push($scope.$parent.$watch($parse($attrs.minuteStep), function(value) {\n minuteStep = +value;\n }));\n }\n\n var min;\n watchers.push($scope.$parent.$watch($parse($attrs.min), function(value) {\n var dt = new Date(value);\n min = isNaN(dt) ? undefined : dt;\n }));\n\n var max;\n watchers.push($scope.$parent.$watch($parse($attrs.max), function(value) {\n var dt = new Date(value);\n max = isNaN(dt) ? undefined : dt;\n }));\n\n var disabled = false;\n if ($attrs.ngDisabled) {\n watchers.push($scope.$parent.$watch($parse($attrs.ngDisabled), function(value) {\n disabled = value;\n }));\n }\n\n $scope.noIncrementHours = function() {\n var incrementedSelected = addMinutes(selected, hourStep * 60);\n return disabled || incrementedSelected > max ||\n incrementedSelected < selected && incrementedSelected < min;\n };\n\n $scope.noDecrementHours = function() {\n var decrementedSelected = addMinutes(selected, -hourStep * 60);\n return disabled || decrementedSelected < min ||\n decrementedSelected > selected && decrementedSelected > max;\n };\n\n $scope.noIncrementMinutes = function() {\n var incrementedSelected = addMinutes(selected, minuteStep);\n return disabled || incrementedSelected > max ||\n incrementedSelected < selected && incrementedSelected < min;\n };\n\n $scope.noDecrementMinutes = function() {\n var decrementedSelected = addMinutes(selected, -minuteStep);\n return disabled || decrementedSelected < min ||\n decrementedSelected > selected && decrementedSelected > max;\n };\n\n $scope.noIncrementSeconds = function() {\n var incrementedSelected = addSeconds(selected, secondStep);\n return disabled || incrementedSelected > max ||\n incrementedSelected < selected && incrementedSelected < min;\n };\n\n $scope.noDecrementSeconds = function() {\n var decrementedSelected = addSeconds(selected, -secondStep);\n return disabled || decrementedSelected < min ||\n decrementedSelected > selected && decrementedSelected > max;\n };\n\n $scope.noToggleMeridian = function() {\n if (selected.getHours() < 12) {\n return disabled || addMinutes(selected, 12 * 60) > max;\n }\n\n return disabled || addMinutes(selected, -12 * 60) < min;\n };\n\n var secondStep = timepickerConfig.secondStep;\n if ($attrs.secondStep) {\n watchers.push($scope.$parent.$watch($parse($attrs.secondStep), function(value) {\n secondStep = +value;\n }));\n }\n\n $scope.showSeconds = timepickerConfig.showSeconds;\n if ($attrs.showSeconds) {\n watchers.push($scope.$parent.$watch($parse($attrs.showSeconds), function(value) {\n $scope.showSeconds = !!value;\n }));\n }\n\n // 12H / 24H mode\n $scope.showMeridian = timepickerConfig.showMeridian;\n if ($attrs.showMeridian) {\n watchers.push($scope.$parent.$watch($parse($attrs.showMeridian), function(value) {\n $scope.showMeridian = !!value;\n\n if (ngModelCtrl.$error.time) {\n // Evaluate from template\n var hours = getHoursFromTemplate(), minutes = getMinutesFromTemplate();\n if (angular.isDefined(hours) && angular.isDefined(minutes)) {\n selected.setHours(hours);\n refresh();\n }\n } else {\n updateTemplate();\n }\n }));\n }\n\n // Get $scope.hours in 24H mode if valid\n function getHoursFromTemplate() {\n var hours = +$scope.hours;\n var valid = $scope.showMeridian ? hours > 0 && hours < 13 :\n hours >= 0 && hours < 24;\n if (!valid) {\n return undefined;\n }\n\n if ($scope.showMeridian) {\n if (hours === 12) {\n hours = 0;\n }\n if ($scope.meridian === meridians[1]) {\n hours = hours + 12;\n }\n }\n return hours;\n }\n\n function getMinutesFromTemplate() {\n var minutes = +$scope.minutes;\n return minutes >= 0 && minutes < 60 ? minutes : undefined;\n }\n\n function getSecondsFromTemplate() {\n var seconds = +$scope.seconds;\n return seconds >= 0 && seconds < 60 ? seconds : undefined;\n }\n\n function pad(value) {\n if (value === null) {\n return '';\n }\n\n return angular.isDefined(value) && value.toString().length < 2 ?\n '0' + value : value.toString();\n }\n\n // Respond on mousewheel spin\n this.setupMousewheelEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) {\n var isScrollingUp = function(e) {\n if (e.originalEvent) {\n e = e.originalEvent;\n }\n //pick correct delta variable depending on event\n var delta = e.wheelDelta ? e.wheelDelta : -e.deltaY;\n return e.detail || delta > 0;\n };\n\n hoursInputEl.bind('mousewheel wheel', function(e) {\n if (!disabled) {\n $scope.$apply(isScrollingUp(e) ? $scope.incrementHours() : $scope.decrementHours());\n }\n e.preventDefault();\n });\n\n minutesInputEl.bind('mousewheel wheel', function(e) {\n if (!disabled) {\n $scope.$apply(isScrollingUp(e) ? $scope.incrementMinutes() : $scope.decrementMinutes());\n }\n e.preventDefault();\n });\n\n secondsInputEl.bind('mousewheel wheel', function(e) {\n if (!disabled) {\n $scope.$apply(isScrollingUp(e) ? $scope.incrementSeconds() : $scope.decrementSeconds());\n }\n e.preventDefault();\n });\n };\n\n // Respond on up/down arrowkeys\n this.setupArrowkeyEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) {\n hoursInputEl.bind('keydown', function(e) {\n if (!disabled) {\n if (e.which === 38) { // up\n e.preventDefault();\n $scope.incrementHours();\n $scope.$apply();\n } else if (e.which === 40) { // down\n e.preventDefault();\n $scope.decrementHours();\n $scope.$apply();\n }\n }\n });\n\n minutesInputEl.bind('keydown', function(e) {\n if (!disabled) {\n if (e.which === 38) { // up\n e.preventDefault();\n $scope.incrementMinutes();\n $scope.$apply();\n } else if (e.which === 40) { // down\n e.preventDefault();\n $scope.decrementMinutes();\n $scope.$apply();\n }\n }\n });\n\n secondsInputEl.bind('keydown', function(e) {\n if (!disabled) {\n if (e.which === 38) { // up\n e.preventDefault();\n $scope.incrementSeconds();\n $scope.$apply();\n } else if (e.which === 40) { // down\n e.preventDefault();\n $scope.decrementSeconds();\n $scope.$apply();\n }\n }\n });\n };\n\n this.setupInputEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) {\n if ($scope.readonlyInput) {\n $scope.updateHours = angular.noop;\n $scope.updateMinutes = angular.noop;\n $scope.updateSeconds = angular.noop;\n return;\n }\n\n var invalidate = function(invalidHours, invalidMinutes, invalidSeconds) {\n ngModelCtrl.$setViewValue(null);\n ngModelCtrl.$setValidity('time', false);\n if (angular.isDefined(invalidHours)) {\n $scope.invalidHours = invalidHours;\n }\n\n if (angular.isDefined(invalidMinutes)) {\n $scope.invalidMinutes = invalidMinutes;\n }\n\n if (angular.isDefined(invalidSeconds)) {\n $scope.invalidSeconds = invalidSeconds;\n }\n };\n\n $scope.updateHours = function() {\n var hours = getHoursFromTemplate(),\n minutes = getMinutesFromTemplate();\n\n ngModelCtrl.$setDirty();\n\n if (angular.isDefined(hours) && angular.isDefined(minutes)) {\n selected.setHours(hours);\n selected.setMinutes(minutes);\n if (selected < min || selected > max) {\n invalidate(true);\n } else {\n refresh('h');\n }\n } else {\n invalidate(true);\n }\n };\n\n hoursInputEl.bind('blur', function(e) {\n ngModelCtrl.$setTouched();\n if ($scope.hours === null || $scope.hours === '') {\n invalidate(true);\n } else if (!$scope.invalidHours && $scope.hours < 10) {\n $scope.$apply(function() {\n $scope.hours = pad($scope.hours);\n });\n }\n });\n\n $scope.updateMinutes = function() {\n var minutes = getMinutesFromTemplate(),\n hours = getHoursFromTemplate();\n\n ngModelCtrl.$setDirty();\n\n if (angular.isDefined(minutes) && angular.isDefined(hours)) {\n selected.setHours(hours);\n selected.setMinutes(minutes);\n if (selected < min || selected > max) {\n invalidate(undefined, true);\n } else {\n refresh('m');\n }\n } else {\n invalidate(undefined, true);\n }\n };\n\n minutesInputEl.bind('blur', function(e) {\n ngModelCtrl.$setTouched();\n if ($scope.minutes === null) {\n invalidate(undefined, true);\n } else if (!$scope.invalidMinutes && $scope.minutes < 10) {\n $scope.$apply(function() {\n $scope.minutes = pad($scope.minutes);\n });\n }\n });\n\n $scope.updateSeconds = function() {\n var seconds = getSecondsFromTemplate();\n\n ngModelCtrl.$setDirty();\n\n if (angular.isDefined(seconds)) {\n selected.setSeconds(seconds);\n refresh('s');\n } else {\n invalidate(undefined, undefined, true);\n }\n };\n\n secondsInputEl.bind('blur', function(e) {\n if (!$scope.invalidSeconds && $scope.seconds < 10) {\n $scope.$apply( function() {\n $scope.seconds = pad($scope.seconds);\n });\n }\n });\n\n };\n\n this.render = function() {\n var date = ngModelCtrl.$viewValue;\n\n if (isNaN(date)) {\n ngModelCtrl.$setValidity('time', false);\n $log.error('Timepicker directive: \"ng-model\" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.');\n } else {\n if (date) {\n selected = date;\n }\n\n if (selected < min || selected > max) {\n ngModelCtrl.$setValidity('time', false);\n $scope.invalidHours = true;\n $scope.invalidMinutes = true;\n } else {\n makeValid();\n }\n updateTemplate();\n }\n };\n\n // Call internally when we know that model is valid.\n function refresh(keyboardChange) {\n makeValid();\n ngModelCtrl.$setViewValue(new Date(selected));\n updateTemplate(keyboardChange);\n }\n\n function makeValid() {\n ngModelCtrl.$setValidity('time', true);\n $scope.invalidHours = false;\n $scope.invalidMinutes = false;\n $scope.invalidSeconds = false;\n }\n\n function updateTemplate(keyboardChange) {\n if (!ngModelCtrl.$modelValue) {\n $scope.hours = null;\n $scope.minutes = null;\n $scope.seconds = null;\n $scope.meridian = meridians[0];\n } else {\n var hours = selected.getHours(),\n minutes = selected.getMinutes(),\n seconds = selected.getSeconds();\n\n if ($scope.showMeridian) {\n hours = hours === 0 || hours === 12 ? 12 : hours % 12; // Convert 24 to 12 hour system\n }\n\n $scope.hours = keyboardChange === 'h' ? hours : pad(hours);\n if (keyboardChange !== 'm') {\n $scope.minutes = pad(minutes);\n }\n $scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1];\n\n if (keyboardChange !== 's') {\n $scope.seconds = pad(seconds);\n }\n $scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1];\n }\n }\n\n function addSecondsToSelected(seconds) {\n selected = addSeconds(selected, seconds);\n refresh();\n }\n\n function addMinutes(selected, minutes) {\n return addSeconds(selected, minutes*60);\n }\n\n function addSeconds(date, seconds) {\n var dt = new Date(date.getTime() + seconds * 1000);\n var newDate = new Date(date);\n newDate.setHours(dt.getHours(), dt.getMinutes(), dt.getSeconds());\n return newDate;\n }\n\n $scope.showSpinners = angular.isDefined($attrs.showSpinners) ?\n $scope.$parent.$eval($attrs.showSpinners) : timepickerConfig.showSpinners;\n\n $scope.incrementHours = function() {\n if (!$scope.noIncrementHours()) {\n addSecondsToSelected(hourStep * 60 * 60);\n }\n };\n\n $scope.decrementHours = function() {\n if (!$scope.noDecrementHours()) {\n addSecondsToSelected(-hourStep * 60 * 60);\n }\n };\n\n $scope.incrementMinutes = function() {\n if (!$scope.noIncrementMinutes()) {\n addSecondsToSelected(minuteStep * 60);\n }\n };\n\n $scope.decrementMinutes = function() {\n if (!$scope.noDecrementMinutes()) {\n addSecondsToSelected(-minuteStep * 60);\n }\n };\n\n $scope.incrementSeconds = function() {\n if (!$scope.noIncrementSeconds()) {\n addSecondsToSelected(secondStep);\n }\n };\n\n $scope.decrementSeconds = function() {\n if (!$scope.noDecrementSeconds()) {\n addSecondsToSelected(-secondStep);\n }\n };\n\n $scope.toggleMeridian = function() {\n var minutes = getMinutesFromTemplate(),\n hours = getHoursFromTemplate();\n\n if (!$scope.noToggleMeridian()) {\n if (angular.isDefined(minutes) && angular.isDefined(hours)) {\n addSecondsToSelected(12 * 60 * (selected.getHours() < 12 ? 60 : -60));\n } else {\n $scope.meridian = $scope.meridian === meridians[0] ? meridians[1] : meridians[0];\n }\n }\n };\n\n $scope.blur = function() {\n ngModelCtrl.$setTouched();\n };\n\n $scope.$on('$destroy', function() {\n while (watchers.length) {\n watchers.shift()();\n }\n });\n}])\n\n.directive('uibTimepicker', ['uibTimepickerConfig', function(uibTimepickerConfig) {\n return {\n require: ['uibTimepicker', '?^ngModel'],\n controller: 'UibTimepickerController',\n controllerAs: 'timepicker',\n replace: true,\n scope: {},\n templateUrl: function(element, attrs) {\n return attrs.templateUrl || uibTimepickerConfig.templateUrl;\n },\n link: function(scope, element, attrs, ctrls) {\n var timepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1];\n\n if (ngModelCtrl) {\n timepickerCtrl.init(ngModelCtrl, element.find('input'));\n }\n }\n };\n}]);\n\nangular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap.position'])\n\n/**\n * A helper service that can parse typeahead's syntax (string provided by users)\n * Extracted to a separate service for ease of unit testing\n */\n .factory('uibTypeaheadParser', ['$parse', function($parse) {\n // 00000111000000000000022200000000000000003333333333333330000000000044000\n var TYPEAHEAD_REGEXP = /^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?\\s+for\\s+(?:([\\$\\w][\\$\\w\\d]*))\\s+in\\s+([\\s\\S]+?)$/;\n return {\n parse: function(input) {\n var match = input.match(TYPEAHEAD_REGEXP);\n if (!match) {\n throw new Error(\n 'Expected typeahead specification in form of \"_modelValue_ (as _label_)? for _item_ in _collection_\"' +\n ' but got \"' + input + '\".');\n }\n\n return {\n itemName: match[3],\n source: $parse(match[4]),\n viewMapper: $parse(match[2] || match[1]),\n modelMapper: $parse(match[1])\n };\n }\n };\n }])\n\n .controller('UibTypeaheadController', ['$scope', '$element', '$attrs', '$compile', '$parse', '$q', '$timeout', '$document', '$window', '$rootScope', '$$debounce', '$uibPosition', 'uibTypeaheadParser',\n function(originalScope, element, attrs, $compile, $parse, $q, $timeout, $document, $window, $rootScope, $$debounce, $position, typeaheadParser) {\n var HOT_KEYS = [9, 13, 27, 38, 40];\n var eventDebounceTime = 200;\n var modelCtrl, ngModelOptions;\n //SUPPORTED ATTRIBUTES (OPTIONS)\n\n //minimal no of characters that needs to be entered before typeahead kicks-in\n var minLength = originalScope.$eval(attrs.typeaheadMinLength);\n if (!minLength && minLength !== 0) {\n minLength = 1;\n }\n\n //minimal wait time after last character typed before typeahead kicks-in\n var waitTime = originalScope.$eval(attrs.typeaheadWaitMs) || 0;\n\n //should it restrict model values to the ones selected from the popup only?\n var isEditable = originalScope.$eval(attrs.typeaheadEditable) !== false;\n originalScope.$watch(attrs.typeaheadEditable, function (newVal) {\n isEditable = newVal !== false;\n });\n\n //binding to a variable that indicates if matches are being retrieved asynchronously\n var isLoadingSetter = $parse(attrs.typeaheadLoading).assign || angular.noop;\n\n //a callback executed when a match is selected\n var onSelectCallback = $parse(attrs.typeaheadOnSelect);\n\n //should it select highlighted popup value when losing focus?\n var isSelectOnBlur = angular.isDefined(attrs.typeaheadSelectOnBlur) ? originalScope.$eval(attrs.typeaheadSelectOnBlur) : false;\n\n //binding to a variable that indicates if there were no results after the query is completed\n var isNoResultsSetter = $parse(attrs.typeaheadNoResults).assign || angular.noop;\n\n var inputFormatter = attrs.typeaheadInputFormatter ? $parse(attrs.typeaheadInputFormatter) : undefined;\n\n var appendToBody = attrs.typeaheadAppendToBody ? originalScope.$eval(attrs.typeaheadAppendToBody) : false;\n\n var appendTo = attrs.typeaheadAppendTo ?\n originalScope.$eval(attrs.typeaheadAppendTo) : null;\n\n var focusFirst = originalScope.$eval(attrs.typeaheadFocusFirst) !== false;\n\n //If input matches an item of the list exactly, select it automatically\n var selectOnExact = attrs.typeaheadSelectOnExact ? originalScope.$eval(attrs.typeaheadSelectOnExact) : false;\n\n //binding to a variable that indicates if dropdown is open\n var isOpenSetter = $parse(attrs.typeaheadIsOpen).assign || angular.noop;\n\n var showHint = originalScope.$eval(attrs.typeaheadShowHint) || false;\n\n //INTERNAL VARIABLES\n\n //model setter executed upon match selection\n var parsedModel = $parse(attrs.ngModel);\n var invokeModelSetter = $parse(attrs.ngModel + '($$$p)');\n var $setModelValue = function(scope, newValue) {\n if (angular.isFunction(parsedModel(originalScope)) &&\n ngModelOptions && ngModelOptions.$options && ngModelOptions.$options.getterSetter) {\n return invokeModelSetter(scope, {$$$p: newValue});\n }\n\n return parsedModel.assign(scope, newValue);\n };\n\n //expressions used by typeahead\n var parserResult = typeaheadParser.parse(attrs.uibTypeahead);\n\n var hasFocus;\n\n //Used to avoid bug in iOS webview where iOS keyboard does not fire\n //mousedown & mouseup events\n //Issue #3699\n var selected;\n\n //create a child scope for the typeahead directive so we are not polluting original scope\n //with typeahead-specific data (matches, query etc.)\n var scope = originalScope.$new();\n var offDestroy = originalScope.$on('$destroy', function() {\n scope.$destroy();\n });\n scope.$on('$destroy', offDestroy);\n\n // WAI-ARIA\n var popupId = 'typeahead-' + scope.$id + '-' + Math.floor(Math.random() * 10000);\n element.attr({\n 'aria-autocomplete': 'list',\n 'aria-expanded': false,\n 'aria-owns': popupId\n });\n\n var inputsContainer, hintInputElem;\n //add read-only input to show hint\n if (showHint) {\n inputsContainer = angular.element('');\n inputsContainer.css('position', 'relative');\n element.after(inputsContainer);\n hintInputElem = element.clone();\n hintInputElem.attr('placeholder', '');\n hintInputElem.val('');\n hintInputElem.css({\n 'position': 'absolute',\n 'top': '0px',\n 'left': '0px',\n 'border-color': 'transparent',\n 'box-shadow': 'none',\n 'opacity': 1,\n 'background': 'none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255)',\n 'color': '#999'\n });\n element.css({\n 'position': 'relative',\n 'vertical-align': 'top',\n 'background-color': 'transparent'\n });\n inputsContainer.append(hintInputElem);\n hintInputElem.after(element);\n }\n\n //pop-up element used to display matches\n var popUpEl = angular.element('');\n popUpEl.attr({\n id: popupId,\n matches: 'matches',\n active: 'activeIdx',\n select: 'select(activeIdx, evt)',\n 'move-in-progress': 'moveInProgress',\n query: 'query',\n position: 'position',\n 'assign-is-open': 'assignIsOpen(isOpen)',\n debounce: 'debounceUpdate'\n });\n //custom item template\n if (angular.isDefined(attrs.typeaheadTemplateUrl)) {\n popUpEl.attr('template-url', attrs.typeaheadTemplateUrl);\n }\n\n if (angular.isDefined(attrs.typeaheadPopupTemplateUrl)) {\n popUpEl.attr('popup-template-url', attrs.typeaheadPopupTemplateUrl);\n }\n\n var resetHint = function() {\n if (showHint) {\n hintInputElem.val('');\n }\n };\n\n var resetMatches = function() {\n scope.matches = [];\n scope.activeIdx = -1;\n element.attr('aria-expanded', false);\n resetHint();\n };\n\n var getMatchId = function(index) {\n return popupId + '-option-' + index;\n };\n\n // Indicate that the specified match is the active (pre-selected) item in the list owned by this typeahead.\n // This attribute is added or removed automatically when the `activeIdx` changes.\n scope.$watch('activeIdx', function(index) {\n if (index < 0) {\n element.removeAttr('aria-activedescendant');\n } else {\n element.attr('aria-activedescendant', getMatchId(index));\n }\n });\n\n var inputIsExactMatch = function(inputValue, index) {\n if (scope.matches.length > index && inputValue) {\n return inputValue.toUpperCase() === scope.matches[index].label.toUpperCase();\n }\n\n return false;\n };\n\n var getMatchesAsync = function(inputValue, evt) {\n var locals = {$viewValue: inputValue};\n isLoadingSetter(originalScope, true);\n isNoResultsSetter(originalScope, false);\n $q.when(parserResult.source(originalScope, locals)).then(function(matches) {\n //it might happen that several async queries were in progress if a user were typing fast\n //but we are interested only in responses that correspond to the current view value\n var onCurrentRequest = inputValue === modelCtrl.$viewValue;\n if (onCurrentRequest && hasFocus) {\n if (matches && matches.length > 0) {\n scope.activeIdx = focusFirst ? 0 : -1;\n isNoResultsSetter(originalScope, false);\n scope.matches.length = 0;\n\n //transform labels\n for (var i = 0; i < matches.length; i++) {\n locals[parserResult.itemName] = matches[i];\n scope.matches.push({\n id: getMatchId(i),\n label: parserResult.viewMapper(scope, locals),\n model: matches[i]\n });\n }\n\n scope.query = inputValue;\n //position pop-up with matches - we need to re-calculate its position each time we are opening a window\n //with matches as a pop-up might be absolute-positioned and position of an input might have changed on a page\n //due to other elements being rendered\n recalculatePosition();\n\n element.attr('aria-expanded', true);\n\n //Select the single remaining option if user input matches\n if (selectOnExact && scope.matches.length === 1 && inputIsExactMatch(inputValue, 0)) {\n if (angular.isNumber(scope.debounceUpdate) || angular.isObject(scope.debounceUpdate)) {\n $$debounce(function() {\n scope.select(0, evt);\n }, angular.isNumber(scope.debounceUpdate) ? scope.debounceUpdate : scope.debounceUpdate['default']);\n } else {\n scope.select(0, evt);\n }\n }\n\n if (showHint) {\n var firstLabel = scope.matches[0].label;\n if (angular.isString(inputValue) &&\n inputValue.length > 0 &&\n firstLabel.slice(0, inputValue.length).toUpperCase() === inputValue.toUpperCase()) {\n hintInputElem.val(inputValue + firstLabel.slice(inputValue.length));\n } else {\n hintInputElem.val('');\n }\n }\n } else {\n resetMatches();\n isNoResultsSetter(originalScope, true);\n }\n }\n if (onCurrentRequest) {\n isLoadingSetter(originalScope, false);\n }\n }, function() {\n resetMatches();\n isLoadingSetter(originalScope, false);\n isNoResultsSetter(originalScope, true);\n });\n };\n\n // bind events only if appendToBody params exist - performance feature\n if (appendToBody) {\n angular.element($window).on('resize', fireRecalculating);\n $document.find('body').on('scroll', fireRecalculating);\n }\n\n // Declare the debounced function outside recalculating for\n // proper debouncing\n var debouncedRecalculate = $$debounce(function() {\n // if popup is visible\n if (scope.matches.length) {\n recalculatePosition();\n }\n\n scope.moveInProgress = false;\n }, eventDebounceTime);\n\n // Default progress type\n scope.moveInProgress = false;\n\n function fireRecalculating() {\n if (!scope.moveInProgress) {\n scope.moveInProgress = true;\n scope.$digest();\n }\n\n debouncedRecalculate();\n }\n\n // recalculate actual position and set new values to scope\n // after digest loop is popup in right position\n function recalculatePosition() {\n scope.position = appendToBody ? $position.offset(element) : $position.position(element);\n scope.position.top += element.prop('offsetHeight');\n }\n\n //we need to propagate user's query so we can higlight matches\n scope.query = undefined;\n\n //Declare the timeout promise var outside the function scope so that stacked calls can be cancelled later\n var timeoutPromise;\n\n var scheduleSearchWithTimeout = function(inputValue) {\n timeoutPromise = $timeout(function() {\n getMatchesAsync(inputValue);\n }, waitTime);\n };\n\n var cancelPreviousTimeout = function() {\n if (timeoutPromise) {\n $timeout.cancel(timeoutPromise);\n }\n };\n\n resetMatches();\n\n scope.assignIsOpen = function (isOpen) {\n isOpenSetter(originalScope, isOpen);\n };\n\n scope.select = function(activeIdx, evt) {\n //called from within the $digest() cycle\n var locals = {};\n var model, item;\n\n selected = true;\n locals[parserResult.itemName] = item = scope.matches[activeIdx].model;\n model = parserResult.modelMapper(originalScope, locals);\n $setModelValue(originalScope, model);\n modelCtrl.$setValidity('editable', true);\n modelCtrl.$setValidity('parse', true);\n\n onSelectCallback(originalScope, {\n $item: item,\n $model: model,\n $label: parserResult.viewMapper(originalScope, locals),\n $event: evt\n });\n\n resetMatches();\n\n //return focus to the input element if a match was selected via a mouse click event\n // use timeout to avoid $rootScope:inprog error\n if (scope.$eval(attrs.typeaheadFocusOnSelect) !== false) {\n $timeout(function() { element[0].focus(); }, 0, false);\n }\n };\n\n //bind keyboard events: arrows up(38) / down(40), enter(13) and tab(9), esc(27)\n element.on('keydown', function(evt) {\n //typeahead is open and an \"interesting\" key was pressed\n if (scope.matches.length === 0 || HOT_KEYS.indexOf(evt.which) === -1) {\n return;\n }\n\n // if there's nothing selected (i.e. focusFirst) and enter or tab is hit, clear the results\n if (scope.activeIdx === -1 && (evt.which === 9 || evt.which === 13)) {\n resetMatches();\n scope.$digest();\n return;\n }\n\n evt.preventDefault();\n var target;\n switch (evt.which) {\n case 9:\n case 13:\n scope.$apply(function () {\n if (angular.isNumber(scope.debounceUpdate) || angular.isObject(scope.debounceUpdate)) {\n $$debounce(function() {\n scope.select(scope.activeIdx, evt);\n }, angular.isNumber(scope.debounceUpdate) ? scope.debounceUpdate : scope.debounceUpdate['default']);\n } else {\n scope.select(scope.activeIdx, evt);\n }\n });\n break;\n case 27:\n evt.stopPropagation();\n\n resetMatches();\n scope.$digest();\n break;\n case 38:\n scope.activeIdx = (scope.activeIdx > 0 ? scope.activeIdx : scope.matches.length) - 1;\n scope.$digest();\n target = popUpEl.find('li')[scope.activeIdx];\n target.parentNode.scrollTop = target.offsetTop;\n break;\n case 40:\n scope.activeIdx = (scope.activeIdx + 1) % scope.matches.length;\n scope.$digest();\n target = popUpEl.find('li')[scope.activeIdx];\n target.parentNode.scrollTop = target.offsetTop;\n break;\n }\n });\n\n element.bind('focus', function (evt) {\n hasFocus = true;\n if (minLength === 0 && !modelCtrl.$viewValue) {\n $timeout(function() {\n getMatchesAsync(modelCtrl.$viewValue, evt);\n }, 0);\n }\n });\n\n element.bind('blur', function(evt) {\n if (isSelectOnBlur && scope.matches.length && scope.activeIdx !== -1 && !selected) {\n selected = true;\n scope.$apply(function() {\n if (angular.isObject(scope.debounceUpdate) && angular.isNumber(scope.debounceUpdate.blur)) {\n $$debounce(function() {\n scope.select(scope.activeIdx, evt);\n }, scope.debounceUpdate.blur);\n } else {\n scope.select(scope.activeIdx, evt);\n }\n });\n }\n if (!isEditable && modelCtrl.$error.editable) {\n modelCtrl.$viewValue = '';\n element.val('');\n }\n hasFocus = false;\n selected = false;\n });\n\n // Keep reference to click handler to unbind it.\n var dismissClickHandler = function(evt) {\n // Issue #3973\n // Firefox treats right click as a click on document\n if (element[0] !== evt.target && evt.which !== 3 && scope.matches.length !== 0) {\n resetMatches();\n if (!$rootScope.$$phase) {\n scope.$digest();\n }\n }\n };\n\n $document.on('click', dismissClickHandler);\n\n originalScope.$on('$destroy', function() {\n $document.off('click', dismissClickHandler);\n if (appendToBody || appendTo) {\n $popup.remove();\n }\n\n if (appendToBody) {\n angular.element($window).off('resize', fireRecalculating);\n $document.find('body').off('scroll', fireRecalculating);\n }\n // Prevent jQuery cache memory leak\n popUpEl.remove();\n\n if (showHint) {\n inputsContainer.remove();\n }\n });\n\n var $popup = $compile(popUpEl)(scope);\n\n if (appendToBody) {\n $document.find('body').append($popup);\n } else if (appendTo) {\n angular.element(appendTo).eq(0).append($popup);\n } else {\n element.after($popup);\n }\n\n this.init = function(_modelCtrl, _ngModelOptions) {\n modelCtrl = _modelCtrl;\n ngModelOptions = _ngModelOptions;\n\n scope.debounceUpdate = modelCtrl.$options && $parse(modelCtrl.$options.debounce)(originalScope);\n\n //plug into $parsers pipeline to open a typeahead on view changes initiated from DOM\n //$parsers kick-in on all the changes coming from the view as well as manually triggered by $setViewValue\n modelCtrl.$parsers.unshift(function(inputValue) {\n hasFocus = true;\n\n if (minLength === 0 || inputValue && inputValue.length >= minLength) {\n if (waitTime > 0) {\n cancelPreviousTimeout();\n scheduleSearchWithTimeout(inputValue);\n } else {\n getMatchesAsync(inputValue);\n }\n } else {\n isLoadingSetter(originalScope, false);\n cancelPreviousTimeout();\n resetMatches();\n }\n\n if (isEditable) {\n return inputValue;\n }\n\n if (!inputValue) {\n // Reset in case user had typed something previously.\n modelCtrl.$setValidity('editable', true);\n return null;\n }\n\n modelCtrl.$setValidity('editable', false);\n return undefined;\n });\n\n modelCtrl.$formatters.push(function(modelValue) {\n var candidateViewValue, emptyViewValue;\n var locals = {};\n\n // The validity may be set to false via $parsers (see above) if\n // the model is restricted to selected values. If the model\n // is set manually it is considered to be valid.\n if (!isEditable) {\n modelCtrl.$setValidity('editable', true);\n }\n\n if (inputFormatter) {\n locals.$model = modelValue;\n return inputFormatter(originalScope, locals);\n }\n\n //it might happen that we don't have enough info to properly render input value\n //we need to check for this situation and simply return model value if we can't apply custom formatting\n locals[parserResult.itemName] = modelValue;\n candidateViewValue = parserResult.viewMapper(originalScope, locals);\n locals[parserResult.itemName] = undefined;\n emptyViewValue = parserResult.viewMapper(originalScope, locals);\n\n return candidateViewValue !== emptyViewValue ? candidateViewValue : modelValue;\n });\n };\n }])\n\n .directive('uibTypeahead', function() {\n return {\n controller: 'UibTypeaheadController',\n require: ['ngModel', '^?ngModelOptions', 'uibTypeahead'],\n link: function(originalScope, element, attrs, ctrls) {\n ctrls[2].init(ctrls[0], ctrls[1]);\n }\n };\n })\n\n .directive('uibTypeaheadPopup', ['$$debounce', function($$debounce) {\n return {\n scope: {\n matches: '=',\n query: '=',\n active: '=',\n position: '&',\n moveInProgress: '=',\n select: '&',\n assignIsOpen: '&',\n debounce: '&'\n },\n replace: true,\n templateUrl: function(element, attrs) {\n return attrs.popupTemplateUrl || 'uib/template/typeahead/typeahead-popup.html';\n },\n link: function(scope, element, attrs) {\n scope.templateUrl = attrs.templateUrl;\n\n scope.isOpen = function() {\n var isDropdownOpen = scope.matches.length > 0;\n scope.assignIsOpen({ isOpen: isDropdownOpen });\n return isDropdownOpen;\n };\n\n scope.isActive = function(matchIdx) {\n return scope.active === matchIdx;\n };\n\n scope.selectActive = function(matchIdx) {\n scope.active = matchIdx;\n };\n\n scope.selectMatch = function(activeIdx, evt) {\n var debounce = scope.debounce();\n if (angular.isNumber(debounce) || angular.isObject(debounce)) {\n $$debounce(function() {\n scope.select({activeIdx: activeIdx, evt: evt});\n }, angular.isNumber(debounce) ? debounce : debounce['default']);\n } else {\n scope.select({activeIdx: activeIdx, evt: evt});\n }\n };\n }\n };\n }])\n\n .directive('uibTypeaheadMatch', ['$templateRequest', '$compile', '$parse', function($templateRequest, $compile, $parse) {\n return {\n scope: {\n index: '=',\n match: '=',\n query: '='\n },\n link: function(scope, element, attrs) {\n var tplUrl = $parse(attrs.templateUrl)(scope.$parent) || 'uib/template/typeahead/typeahead-match.html';\n $templateRequest(tplUrl).then(function(tplContent) {\n var tplEl = angular.element(tplContent.trim());\n element.replaceWith(tplEl);\n $compile(tplEl)(scope);\n });\n }\n };\n }])\n\n .filter('uibTypeaheadHighlight', ['$sce', '$injector', '$log', function($sce, $injector, $log) {\n var isSanitizePresent;\n isSanitizePresent = $injector.has('$sanitize');\n\n function escapeRegexp(queryToEscape) {\n // Regex: capture the whole query string and replace it with the string that will be used to match\n // the results, for example if the capture is \"a\" the result will be \\a\n return queryToEscape.replace(/([.?*+^$[\\]\\\\(){}|-])/g, '\\\\$1');\n }\n\n function containsHtml(matchItem) {\n return /<.*>/g.test(matchItem);\n }\n\n return function(matchItem, query) {\n if (!isSanitizePresent && containsHtml(matchItem)) {\n $log.warn('Unsafe use of typeahead please use ngSanitize'); // Warn the user about the danger\n }\n matchItem = query ? ('' + matchItem).replace(new RegExp(escapeRegexp(query), 'gi'), '$&') : matchItem; // Replaces the capture string with a the same string inside of a \"strong\" tag\n if (!isSanitizePresent) {\n matchItem = $sce.trustAsHtml(matchItem); // If $sanitize is not present we pack the string in a $sce object for the ng-bind-html directive\n }\n return matchItem;\n };\n }]);\n\nangular.module(\"uib/template/accordion/accordion-group.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/accordion/accordion-group.html\",\n \"\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \" {{heading}}\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/accordion/accordion.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/accordion/accordion.html\",\n \"\");\n}]);\n\nangular.module(\"uib/template/alert/alert.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/alert/alert.html\",\n \"\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/carousel/carousel.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/carousel/carousel.html\",\n \"\");\n}]);\n\nangular.module(\"uib/template/carousel/slide.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/carousel/slide.html\",\n \"\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/datepicker/datepicker.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/datepicker/datepicker.html\",\n \"\\n\" +\n \" \\n\" +\n \" \\n\" +\n \" \\n\" +\n \"
\");\n}]);\n\nangular.module(\"uib/template/datepicker/day.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/datepicker/day.html\",\n \"\\n\" +\n \" \\n\" +\n \" \\n\" +\n \" | \\n\" +\n \" | \\n\" +\n \" | \\n\" +\n \"
\\n\" +\n \" \\n\" +\n \" | \\n\" +\n \" {{::label.abbr}} | \\n\" +\n \"
\\n\" +\n \" \\n\" +\n \" \\n\" +\n \" \\n\" +\n \" {{ weekNumbers[$index] }} | \\n\" +\n \" \\n\" +\n \" \\n\" +\n \" | \\n\" +\n \"
\\n\" +\n \" \\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/datepicker/month.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/datepicker/month.html\",\n \"
\\n\" +\n \" \\n\" +\n \" \\n\" +\n \" | \\n\" +\n \" | \\n\" +\n \" | \\n\" +\n \"
\\n\" +\n \" \\n\" +\n \" \\n\" +\n \" \\n\" +\n \" \\n\" +\n \" \\n\" +\n \" | \\n\" +\n \"
\\n\" +\n \" \\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/datepicker/popup.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/datepicker/popup.html\",\n \"
\\n\" +\n \" \\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/datepicker/year.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/datepicker/year.html\",\n \"
\\n\" +\n \" \\n\" +\n \" \\n\" +\n \" | \\n\" +\n \" | \\n\" +\n \" | \\n\" +\n \"
\\n\" +\n \" \\n\" +\n \" \\n\" +\n \" \\n\" +\n \" \\n\" +\n \" \\n\" +\n \" | \\n\" +\n \"
\\n\" +\n \" \\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/modal/backdrop.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/modal/backdrop.html\",\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/modal/window.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/modal/window.html\",\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/pager/pager.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/pager/pager.html\",\n \"\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/pagination/pagination.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/pagination/pagination.html\",\n \"\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/tooltip/tooltip-html-popup.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/tooltip/tooltip-html-popup.html\",\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/tooltip/tooltip-popup.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/tooltip/tooltip-popup.html\",\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/tooltip/tooltip-template-popup.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/tooltip/tooltip-template-popup.html\",\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/popover/popover-html.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/popover/popover-html.html\",\n \"
\\n\" +\n \"
\\n\" +\n \"\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/popover/popover-template.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/popover/popover-template.html\",\n \"
\\n\" +\n \"
\\n\" +\n \"\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/popover/popover.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/popover/popover.html\",\n \"
\\n\" +\n \"
\\n\" +\n \"\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/progressbar/bar.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/progressbar/bar.html\",\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/progressbar/progress.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/progressbar/progress.html\",\n \"
\");\n}]);\n\nangular.module(\"uib/template/progressbar/progressbar.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/progressbar/progressbar.html\",\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/rating/rating.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/rating/rating.html\",\n \"
\\n\" +\n \" ({{ $index < value ? '*' : ' ' }})\\n\" +\n \" \\n\" +\n \"\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/tabs/tab.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/tabs/tab.html\",\n \"
\\n\" +\n \" {{heading}}\\n\" +\n \"\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/tabs/tabset.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/tabs/tabset.html\",\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/timepicker/timepicker.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/timepicker/timepicker.html\",\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/typeahead/typeahead-match.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/typeahead/typeahead-match.html\",\n \"
\\n\" +\n \"\");\n}]);\n\nangular.module(\"uib/template/typeahead/typeahead-popup.html\", []).run([\"$templateCache\", function($templateCache) {\n $templateCache.put(\"uib/template/typeahead/typeahead-popup.html\",\n \"\\n\" +\n \"\");\n}]);\nangular.module('ui.bootstrap.carousel').run(function() {!angular.$$csp().noInlineStyle && angular.element(document).find('head').prepend(''); });\nangular.module('ui.bootstrap.datepicker').run(function() {!angular.$$csp().noInlineStyle && angular.element(document).find('head').prepend(''); });\nangular.module('ui.bootstrap.timepicker').run(function() {!angular.$$csp().noInlineStyle && angular.element(document).find('head').prepend(''); });\nangular.module('ui.bootstrap.typeahead').run(function() {!angular.$$csp().noInlineStyle && angular.element(document).find('head').prepend(''); });","/*!\n * Bootstrap v3.3.6 (http://getbootstrap.com)\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under the MIT license\n */\n\nif (typeof jQuery === 'undefined') {\n throw new Error('Bootstrap\\'s JavaScript requires jQuery')\n}\n\n+function ($) {\n 'use strict';\n var version = $.fn.jquery.split(' ')[0].split('.')\n if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 2)) {\n throw new Error('Bootstrap\\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3')\n }\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: transition.js v3.3.6\n * http://getbootstrap.com/javascript/#transitions\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)\n // ============================================================\n\n function transitionEnd() {\n var el = document.createElement('bootstrap')\n\n var transEndEventNames = {\n WebkitTransition : 'webkitTransitionEnd',\n MozTransition : 'transitionend',\n OTransition : 'oTransitionEnd otransitionend',\n transition : 'transitionend'\n }\n\n for (var name in transEndEventNames) {\n if (el.style[name] !== undefined) {\n return { end: transEndEventNames[name] }\n }\n }\n\n return false // explicit for ie8 ( ._.)\n }\n\n // http://blog.alexmaccaw.com/css-transitions\n $.fn.emulateTransitionEnd = function (duration) {\n var called = false\n var $el = this\n $(this).one('bsTransitionEnd', function () { called = true })\n var callback = function () { if (!called) $($el).trigger($.support.transition.end) }\n setTimeout(callback, duration)\n return this\n }\n\n $(function () {\n $.support.transition = transitionEnd()\n\n if (!$.support.transition) return\n\n $.event.special.bsTransitionEnd = {\n bindType: $.support.transition.end,\n delegateType: $.support.transition.end,\n handle: function (e) {\n if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)\n }\n }\n })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: alert.js v3.3.6\n * http://getbootstrap.com/javascript/#alerts\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // ALERT CLASS DEFINITION\n // ======================\n\n var dismiss = '[data-dismiss=\"alert\"]'\n var Alert = function (el) {\n $(el).on('click', dismiss, this.close)\n }\n\n Alert.VERSION = '3.3.6'\n\n Alert.TRANSITION_DURATION = 150\n\n Alert.prototype.close = function (e) {\n var $this = $(this)\n var selector = $this.attr('data-target')\n\n if (!selector) {\n selector = $this.attr('href')\n selector = selector && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n }\n\n var $parent = $(selector)\n\n if (e) e.preventDefault()\n\n if (!$parent.length) {\n $parent = $this.closest('.alert')\n }\n\n $parent.trigger(e = $.Event('close.bs.alert'))\n\n if (e.isDefaultPrevented()) return\n\n $parent.removeClass('in')\n\n function removeElement() {\n // detach from parent, fire event then clean up data\n $parent.detach().trigger('closed.bs.alert').remove()\n }\n\n $.support.transition && $parent.hasClass('fade') ?\n $parent\n .one('bsTransitionEnd', removeElement)\n .emulateTransitionEnd(Alert.TRANSITION_DURATION) :\n removeElement()\n }\n\n\n // ALERT PLUGIN DEFINITION\n // =======================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.alert')\n\n if (!data) $this.data('bs.alert', (data = new Alert(this)))\n if (typeof option == 'string') data[option].call($this)\n })\n }\n\n var old = $.fn.alert\n\n $.fn.alert = Plugin\n $.fn.alert.Constructor = Alert\n\n\n // ALERT NO CONFLICT\n // =================\n\n $.fn.alert.noConflict = function () {\n $.fn.alert = old\n return this\n }\n\n\n // ALERT DATA-API\n // ==============\n\n $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: button.js v3.3.6\n * http://getbootstrap.com/javascript/#buttons\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // BUTTON PUBLIC CLASS DEFINITION\n // ==============================\n\n var Button = function (element, options) {\n this.$element = $(element)\n this.options = $.extend({}, Button.DEFAULTS, options)\n this.isLoading = false\n }\n\n Button.VERSION = '3.3.6'\n\n Button.DEFAULTS = {\n loadingText: 'loading...'\n }\n\n Button.prototype.setState = function (state) {\n var d = 'disabled'\n var $el = this.$element\n var val = $el.is('input') ? 'val' : 'html'\n var data = $el.data()\n\n state += 'Text'\n\n if (data.resetText == null) $el.data('resetText', $el[val]())\n\n // push to event loop to allow forms to submit\n setTimeout($.proxy(function () {\n $el[val](data[state] == null ? this.options[state] : data[state])\n\n if (state == 'loadingText') {\n this.isLoading = true\n $el.addClass(d).attr(d, d)\n } else if (this.isLoading) {\n this.isLoading = false\n $el.removeClass(d).removeAttr(d)\n }\n }, this), 0)\n }\n\n Button.prototype.toggle = function () {\n var changed = true\n var $parent = this.$element.closest('[data-toggle=\"buttons\"]')\n\n if ($parent.length) {\n var $input = this.$element.find('input')\n if ($input.prop('type') == 'radio') {\n if ($input.prop('checked')) changed = false\n $parent.find('.active').removeClass('active')\n this.$element.addClass('active')\n } else if ($input.prop('type') == 'checkbox') {\n if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false\n this.$element.toggleClass('active')\n }\n $input.prop('checked', this.$element.hasClass('active'))\n if (changed) $input.trigger('change')\n } else {\n this.$element.attr('aria-pressed', !this.$element.hasClass('active'))\n this.$element.toggleClass('active')\n }\n }\n\n\n // BUTTON PLUGIN DEFINITION\n // ========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.button')\n var options = typeof option == 'object' && option\n\n if (!data) $this.data('bs.button', (data = new Button(this, options)))\n\n if (option == 'toggle') data.toggle()\n else if (option) data.setState(option)\n })\n }\n\n var old = $.fn.button\n\n $.fn.button = Plugin\n $.fn.button.Constructor = Button\n\n\n // BUTTON NO CONFLICT\n // ==================\n\n $.fn.button.noConflict = function () {\n $.fn.button = old\n return this\n }\n\n\n // BUTTON DATA-API\n // ===============\n\n $(document)\n .on('click.bs.button.data-api', '[data-toggle^=\"button\"]', function (e) {\n var $btn = $(e.target)\n if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')\n Plugin.call($btn, 'toggle')\n if (!($(e.target).is('input[type=\"radio\"]') || $(e.target).is('input[type=\"checkbox\"]'))) e.preventDefault()\n })\n .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^=\"button\"]', function (e) {\n $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))\n })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: carousel.js v3.3.6\n * http://getbootstrap.com/javascript/#carousel\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // CAROUSEL CLASS DEFINITION\n // =========================\n\n var Carousel = function (element, options) {\n this.$element = $(element)\n this.$indicators = this.$element.find('.carousel-indicators')\n this.options = options\n this.paused = null\n this.sliding = null\n this.interval = null\n this.$active = null\n this.$items = null\n\n this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))\n\n this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element\n .on('mouseenter.bs.carousel', $.proxy(this.pause, this))\n .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))\n }\n\n Carousel.VERSION = '3.3.6'\n\n Carousel.TRANSITION_DURATION = 600\n\n Carousel.DEFAULTS = {\n interval: 5000,\n pause: 'hover',\n wrap: true,\n keyboard: true\n }\n\n Carousel.prototype.keydown = function (e) {\n if (/input|textarea/i.test(e.target.tagName)) return\n switch (e.which) {\n case 37: this.prev(); break\n case 39: this.next(); break\n default: return\n }\n\n e.preventDefault()\n }\n\n Carousel.prototype.cycle = function (e) {\n e || (this.paused = false)\n\n this.interval && clearInterval(this.interval)\n\n this.options.interval\n && !this.paused\n && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))\n\n return this\n }\n\n Carousel.prototype.getItemIndex = function (item) {\n this.$items = item.parent().children('.item')\n return this.$items.index(item || this.$active)\n }\n\n Carousel.prototype.getItemForDirection = function (direction, active) {\n var activeIndex = this.getItemIndex(active)\n var willWrap = (direction == 'prev' && activeIndex === 0)\n || (direction == 'next' && activeIndex == (this.$items.length - 1))\n if (willWrap && !this.options.wrap) return active\n var delta = direction == 'prev' ? -1 : 1\n var itemIndex = (activeIndex + delta) % this.$items.length\n return this.$items.eq(itemIndex)\n }\n\n Carousel.prototype.to = function (pos) {\n var that = this\n var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))\n\n if (pos > (this.$items.length - 1) || pos < 0) return\n\n if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, \"slid\"\n if (activeIndex == pos) return this.pause().cycle()\n\n return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))\n }\n\n Carousel.prototype.pause = function (e) {\n e || (this.paused = true)\n\n if (this.$element.find('.next, .prev').length && $.support.transition) {\n this.$element.trigger($.support.transition.end)\n this.cycle(true)\n }\n\n this.interval = clearInterval(this.interval)\n\n return this\n }\n\n Carousel.prototype.next = function () {\n if (this.sliding) return\n return this.slide('next')\n }\n\n Carousel.prototype.prev = function () {\n if (this.sliding) return\n return this.slide('prev')\n }\n\n Carousel.prototype.slide = function (type, next) {\n var $active = this.$element.find('.item.active')\n var $next = next || this.getItemForDirection(type, $active)\n var isCycling = this.interval\n var direction = type == 'next' ? 'left' : 'right'\n var that = this\n\n if ($next.hasClass('active')) return (this.sliding = false)\n\n var relatedTarget = $next[0]\n var slideEvent = $.Event('slide.bs.carousel', {\n relatedTarget: relatedTarget,\n direction: direction\n })\n this.$element.trigger(slideEvent)\n if (slideEvent.isDefaultPrevented()) return\n\n this.sliding = true\n\n isCycling && this.pause()\n\n if (this.$indicators.length) {\n this.$indicators.find('.active').removeClass('active')\n var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])\n $nextIndicator && $nextIndicator.addClass('active')\n }\n\n var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, \"slid\"\n if ($.support.transition && this.$element.hasClass('slide')) {\n $next.addClass(type)\n $next[0].offsetWidth // force reflow\n $active.addClass(direction)\n $next.addClass(direction)\n $active\n .one('bsTransitionEnd', function () {\n $next.removeClass([type, direction].join(' ')).addClass('active')\n $active.removeClass(['active', direction].join(' '))\n that.sliding = false\n setTimeout(function () {\n that.$element.trigger(slidEvent)\n }, 0)\n })\n .emulateTransitionEnd(Carousel.TRANSITION_DURATION)\n } else {\n $active.removeClass('active')\n $next.addClass('active')\n this.sliding = false\n this.$element.trigger(slidEvent)\n }\n\n isCycling && this.cycle()\n\n return this\n }\n\n\n // CAROUSEL PLUGIN DEFINITION\n // ==========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.carousel')\n var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)\n var action = typeof option == 'string' ? option : options.slide\n\n if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))\n if (typeof option == 'number') data.to(option)\n else if (action) data[action]()\n else if (options.interval) data.pause().cycle()\n })\n }\n\n var old = $.fn.carousel\n\n $.fn.carousel = Plugin\n $.fn.carousel.Constructor = Carousel\n\n\n // CAROUSEL NO CONFLICT\n // ====================\n\n $.fn.carousel.noConflict = function () {\n $.fn.carousel = old\n return this\n }\n\n\n // CAROUSEL DATA-API\n // =================\n\n var clickHandler = function (e) {\n var href\n var $this = $(this)\n var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\\s]+$)/, '')) // strip for ie7\n if (!$target.hasClass('carousel')) return\n var options = $.extend({}, $target.data(), $this.data())\n var slideIndex = $this.attr('data-slide-to')\n if (slideIndex) options.interval = false\n\n Plugin.call($target, options)\n\n if (slideIndex) {\n $target.data('bs.carousel').to(slideIndex)\n }\n\n e.preventDefault()\n }\n\n $(document)\n .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)\n .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)\n\n $(window).on('load', function () {\n $('[data-ride=\"carousel\"]').each(function () {\n var $carousel = $(this)\n Plugin.call($carousel, $carousel.data())\n })\n })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: collapse.js v3.3.6\n * http://getbootstrap.com/javascript/#collapse\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // COLLAPSE PUBLIC CLASS DEFINITION\n // ================================\n\n var Collapse = function (element, options) {\n this.$element = $(element)\n this.options = $.extend({}, Collapse.DEFAULTS, options)\n this.$trigger = $('[data-toggle=\"collapse\"][href=\"#' + element.id + '\"],' +\n '[data-toggle=\"collapse\"][data-target=\"#' + element.id + '\"]')\n this.transitioning = null\n\n if (this.options.parent) {\n this.$parent = this.getParent()\n } else {\n this.addAriaAndCollapsedClass(this.$element, this.$trigger)\n }\n\n if (this.options.toggle) this.toggle()\n }\n\n Collapse.VERSION = '3.3.6'\n\n Collapse.TRANSITION_DURATION = 350\n\n Collapse.DEFAULTS = {\n toggle: true\n }\n\n Collapse.prototype.dimension = function () {\n var hasWidth = this.$element.hasClass('width')\n return hasWidth ? 'width' : 'height'\n }\n\n Collapse.prototype.show = function () {\n if (this.transitioning || this.$element.hasClass('in')) return\n\n var activesData\n var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')\n\n if (actives && actives.length) {\n activesData = actives.data('bs.collapse')\n if (activesData && activesData.transitioning) return\n }\n\n var startEvent = $.Event('show.bs.collapse')\n this.$element.trigger(startEvent)\n if (startEvent.isDefaultPrevented()) return\n\n if (actives && actives.length) {\n Plugin.call(actives, 'hide')\n activesData || actives.data('bs.collapse', null)\n }\n\n var dimension = this.dimension()\n\n this.$element\n .removeClass('collapse')\n .addClass('collapsing')[dimension](0)\n .attr('aria-expanded', true)\n\n this.$trigger\n .removeClass('collapsed')\n .attr('aria-expanded', true)\n\n this.transitioning = 1\n\n var complete = function () {\n this.$element\n .removeClass('collapsing')\n .addClass('collapse in')[dimension]('')\n this.transitioning = 0\n this.$element\n .trigger('shown.bs.collapse')\n }\n\n if (!$.support.transition) return complete.call(this)\n\n var scrollSize = $.camelCase(['scroll', dimension].join('-'))\n\n this.$element\n .one('bsTransitionEnd', $.proxy(complete, this))\n .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])\n }\n\n Collapse.prototype.hide = function () {\n if (this.transitioning || !this.$element.hasClass('in')) return\n\n var startEvent = $.Event('hide.bs.collapse')\n this.$element.trigger(startEvent)\n if (startEvent.isDefaultPrevented()) return\n\n var dimension = this.dimension()\n\n this.$element[dimension](this.$element[dimension]())[0].offsetHeight\n\n this.$element\n .addClass('collapsing')\n .removeClass('collapse in')\n .attr('aria-expanded', false)\n\n this.$trigger\n .addClass('collapsed')\n .attr('aria-expanded', false)\n\n this.transitioning = 1\n\n var complete = function () {\n this.transitioning = 0\n this.$element\n .removeClass('collapsing')\n .addClass('collapse')\n .trigger('hidden.bs.collapse')\n }\n\n if (!$.support.transition) return complete.call(this)\n\n this.$element\n [dimension](0)\n .one('bsTransitionEnd', $.proxy(complete, this))\n .emulateTransitionEnd(Collapse.TRANSITION_DURATION)\n }\n\n Collapse.prototype.toggle = function () {\n this[this.$element.hasClass('in') ? 'hide' : 'show']()\n }\n\n Collapse.prototype.getParent = function () {\n return $(this.options.parent)\n .find('[data-toggle=\"collapse\"][data-parent=\"' + this.options.parent + '\"]')\n .each($.proxy(function (i, element) {\n var $element = $(element)\n this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)\n }, this))\n .end()\n }\n\n Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {\n var isOpen = $element.hasClass('in')\n\n $element.attr('aria-expanded', isOpen)\n $trigger\n .toggleClass('collapsed', !isOpen)\n .attr('aria-expanded', isOpen)\n }\n\n function getTargetFromTrigger($trigger) {\n var href\n var target = $trigger.attr('data-target')\n || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\\s]+$)/, '') // strip for ie7\n\n return $(target)\n }\n\n\n // COLLAPSE PLUGIN DEFINITION\n // ==========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.collapse')\n var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)\n\n if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false\n if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.collapse\n\n $.fn.collapse = Plugin\n $.fn.collapse.Constructor = Collapse\n\n\n // COLLAPSE NO CONFLICT\n // ====================\n\n $.fn.collapse.noConflict = function () {\n $.fn.collapse = old\n return this\n }\n\n\n // COLLAPSE DATA-API\n // =================\n\n $(document).on('click.bs.collapse.data-api', '[data-toggle=\"collapse\"]', function (e) {\n var $this = $(this)\n\n if (!$this.attr('data-target')) e.preventDefault()\n\n var $target = getTargetFromTrigger($this)\n var data = $target.data('bs.collapse')\n var option = data ? 'toggle' : $this.data()\n\n Plugin.call($target, option)\n })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: dropdown.js v3.3.6\n * http://getbootstrap.com/javascript/#dropdowns\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // DROPDOWN CLASS DEFINITION\n // =========================\n\n var backdrop = '.dropdown-backdrop'\n var toggle = '[data-toggle=\"dropdown\"]'\n var Dropdown = function (element) {\n $(element).on('click.bs.dropdown', this.toggle)\n }\n\n Dropdown.VERSION = '3.3.6'\n\n function getParent($this) {\n var selector = $this.attr('data-target')\n\n if (!selector) {\n selector = $this.attr('href')\n selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n }\n\n var $parent = selector && $(selector)\n\n return $parent && $parent.length ? $parent : $this.parent()\n }\n\n function clearMenus(e) {\n if (e && e.which === 3) return\n $(backdrop).remove()\n $(toggle).each(function () {\n var $this = $(this)\n var $parent = getParent($this)\n var relatedTarget = { relatedTarget: this }\n\n if (!$parent.hasClass('open')) return\n\n if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return\n\n $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))\n\n if (e.isDefaultPrevented()) return\n\n $this.attr('aria-expanded', 'false')\n $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))\n })\n }\n\n Dropdown.prototype.toggle = function (e) {\n var $this = $(this)\n\n if ($this.is('.disabled, :disabled')) return\n\n var $parent = getParent($this)\n var isActive = $parent.hasClass('open')\n\n clearMenus()\n\n if (!isActive) {\n if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {\n // if mobile we use a backdrop because click events don't delegate\n $(document.createElement('div'))\n .addClass('dropdown-backdrop')\n .insertAfter($(this))\n .on('click', clearMenus)\n }\n\n var relatedTarget = { relatedTarget: this }\n $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))\n\n if (e.isDefaultPrevented()) return\n\n $this\n .trigger('focus')\n .attr('aria-expanded', 'true')\n\n $parent\n .toggleClass('open')\n .trigger($.Event('shown.bs.dropdown', relatedTarget))\n }\n\n return false\n }\n\n Dropdown.prototype.keydown = function (e) {\n if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return\n\n var $this = $(this)\n\n e.preventDefault()\n e.stopPropagation()\n\n if ($this.is('.disabled, :disabled')) return\n\n var $parent = getParent($this)\n var isActive = $parent.hasClass('open')\n\n if (!isActive && e.which != 27 || isActive && e.which == 27) {\n if (e.which == 27) $parent.find(toggle).trigger('focus')\n return $this.trigger('click')\n }\n\n var desc = ' li:not(.disabled):visible a'\n var $items = $parent.find('.dropdown-menu' + desc)\n\n if (!$items.length) return\n\n var index = $items.index(e.target)\n\n if (e.which == 38 && index > 0) index-- // up\n if (e.which == 40 && index < $items.length - 1) index++ // down\n if (!~index) index = 0\n\n $items.eq(index).trigger('focus')\n }\n\n\n // DROPDOWN PLUGIN DEFINITION\n // ==========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.dropdown')\n\n if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))\n if (typeof option == 'string') data[option].call($this)\n })\n }\n\n var old = $.fn.dropdown\n\n $.fn.dropdown = Plugin\n $.fn.dropdown.Constructor = Dropdown\n\n\n // DROPDOWN NO CONFLICT\n // ====================\n\n $.fn.dropdown.noConflict = function () {\n $.fn.dropdown = old\n return this\n }\n\n\n // APPLY TO STANDARD DROPDOWN ELEMENTS\n // ===================================\n\n $(document)\n .on('click.bs.dropdown.data-api', clearMenus)\n .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })\n .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)\n .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)\n .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: modal.js v3.3.6\n * http://getbootstrap.com/javascript/#modals\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // MODAL CLASS DEFINITION\n // ======================\n\n var Modal = function (element, options) {\n this.options = options\n this.$body = $(document.body)\n this.$element = $(element)\n this.$dialog = this.$element.find('.modal-dialog')\n this.$backdrop = null\n this.isShown = null\n this.originalBodyPad = null\n this.scrollbarWidth = 0\n this.ignoreBackdropClick = false\n\n if (this.options.remote) {\n this.$element\n .find('.modal-content')\n .load(this.options.remote, $.proxy(function () {\n this.$element.trigger('loaded.bs.modal')\n }, this))\n }\n }\n\n Modal.VERSION = '3.3.6'\n\n Modal.TRANSITION_DURATION = 300\n Modal.BACKDROP_TRANSITION_DURATION = 150\n\n Modal.DEFAULTS = {\n backdrop: true,\n keyboard: true,\n show: true\n }\n\n Modal.prototype.toggle = function (_relatedTarget) {\n return this.isShown ? this.hide() : this.show(_relatedTarget)\n }\n\n Modal.prototype.show = function (_relatedTarget) {\n var that = this\n var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })\n\n this.$element.trigger(e)\n\n if (this.isShown || e.isDefaultPrevented()) return\n\n this.isShown = true\n\n this.checkScrollbar()\n this.setScrollbar()\n this.$body.addClass('modal-open')\n\n this.escape()\n this.resize()\n\n this.$element.on('click.dismiss.bs.modal', '[data-dismiss=\"modal\"]', $.proxy(this.hide, this))\n\n this.$dialog.on('mousedown.dismiss.bs.modal', function () {\n that.$element.one('mouseup.dismiss.bs.modal', function (e) {\n if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true\n })\n })\n\n this.backdrop(function () {\n var transition = $.support.transition && that.$element.hasClass('fade')\n\n if (!that.$element.parent().length) {\n that.$element.appendTo(that.$body) // don't move modals dom position\n }\n\n that.$element\n .show()\n .scrollTop(0)\n\n that.adjustDialog()\n\n if (transition) {\n that.$element[0].offsetWidth // force reflow\n }\n\n that.$element.addClass('in')\n\n that.enforceFocus()\n\n var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })\n\n transition ?\n that.$dialog // wait for modal to slide in\n .one('bsTransitionEnd', function () {\n that.$element.trigger('focus').trigger(e)\n })\n .emulateTransitionEnd(Modal.TRANSITION_DURATION) :\n that.$element.trigger('focus').trigger(e)\n })\n }\n\n Modal.prototype.hide = function (e) {\n if (e) e.preventDefault()\n\n e = $.Event('hide.bs.modal')\n\n this.$element.trigger(e)\n\n if (!this.isShown || e.isDefaultPrevented()) return\n\n this.isShown = false\n\n this.escape()\n this.resize()\n\n $(document).off('focusin.bs.modal')\n\n this.$element\n .removeClass('in')\n .off('click.dismiss.bs.modal')\n .off('mouseup.dismiss.bs.modal')\n\n this.$dialog.off('mousedown.dismiss.bs.modal')\n\n $.support.transition && this.$element.hasClass('fade') ?\n this.$element\n .one('bsTransitionEnd', $.proxy(this.hideModal, this))\n .emulateTransitionEnd(Modal.TRANSITION_DURATION) :\n this.hideModal()\n }\n\n Modal.prototype.enforceFocus = function () {\n $(document)\n .off('focusin.bs.modal') // guard against infinite focus loop\n .on('focusin.bs.modal', $.proxy(function (e) {\n if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {\n this.$element.trigger('focus')\n }\n }, this))\n }\n\n Modal.prototype.escape = function () {\n if (this.isShown && this.options.keyboard) {\n this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {\n e.which == 27 && this.hide()\n }, this))\n } else if (!this.isShown) {\n this.$element.off('keydown.dismiss.bs.modal')\n }\n }\n\n Modal.prototype.resize = function () {\n if (this.isShown) {\n $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))\n } else {\n $(window).off('resize.bs.modal')\n }\n }\n\n Modal.prototype.hideModal = function () {\n var that = this\n this.$element.hide()\n this.backdrop(function () {\n that.$body.removeClass('modal-open')\n that.resetAdjustments()\n that.resetScrollbar()\n that.$element.trigger('hidden.bs.modal')\n })\n }\n\n Modal.prototype.removeBackdrop = function () {\n this.$backdrop && this.$backdrop.remove()\n this.$backdrop = null\n }\n\n Modal.prototype.backdrop = function (callback) {\n var that = this\n var animate = this.$element.hasClass('fade') ? 'fade' : ''\n\n if (this.isShown && this.options.backdrop) {\n var doAnimate = $.support.transition && animate\n\n this.$backdrop = $(document.createElement('div'))\n .addClass('modal-backdrop ' + animate)\n .appendTo(this.$body)\n\n this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {\n if (this.ignoreBackdropClick) {\n this.ignoreBackdropClick = false\n return\n }\n if (e.target !== e.currentTarget) return\n this.options.backdrop == 'static'\n ? this.$element[0].focus()\n : this.hide()\n }, this))\n\n if (doAnimate) this.$backdrop[0].offsetWidth // force reflow\n\n this.$backdrop.addClass('in')\n\n if (!callback) return\n\n doAnimate ?\n this.$backdrop\n .one('bsTransitionEnd', callback)\n .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :\n callback()\n\n } else if (!this.isShown && this.$backdrop) {\n this.$backdrop.removeClass('in')\n\n var callbackRemove = function () {\n that.removeBackdrop()\n callback && callback()\n }\n $.support.transition && this.$element.hasClass('fade') ?\n this.$backdrop\n .one('bsTransitionEnd', callbackRemove)\n .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :\n callbackRemove()\n\n } else if (callback) {\n callback()\n }\n }\n\n // these following methods are used to handle overflowing modals\n\n Modal.prototype.handleUpdate = function () {\n this.adjustDialog()\n }\n\n Modal.prototype.adjustDialog = function () {\n var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight\n\n this.$element.css({\n paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',\n paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''\n })\n }\n\n Modal.prototype.resetAdjustments = function () {\n this.$element.css({\n paddingLeft: '',\n paddingRight: ''\n })\n }\n\n Modal.prototype.checkScrollbar = function () {\n var fullWindowWidth = window.innerWidth\n if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8\n var documentElementRect = document.documentElement.getBoundingClientRect()\n fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)\n }\n this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth\n this.scrollbarWidth = this.measureScrollbar()\n }\n\n Modal.prototype.setScrollbar = function () {\n var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)\n this.originalBodyPad = document.body.style.paddingRight || ''\n if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)\n }\n\n Modal.prototype.resetScrollbar = function () {\n this.$body.css('padding-right', this.originalBodyPad)\n }\n\n Modal.prototype.measureScrollbar = function () { // thx walsh\n var scrollDiv = document.createElement('div')\n scrollDiv.className = 'modal-scrollbar-measure'\n this.$body.append(scrollDiv)\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth\n this.$body[0].removeChild(scrollDiv)\n return scrollbarWidth\n }\n\n\n // MODAL PLUGIN DEFINITION\n // =======================\n\n function Plugin(option, _relatedTarget) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.modal')\n var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)\n\n if (!data) $this.data('bs.modal', (data = new Modal(this, options)))\n if (typeof option == 'string') data[option](_relatedTarget)\n else if (options.show) data.show(_relatedTarget)\n })\n }\n\n var old = $.fn.modal\n\n $.fn.modal = Plugin\n $.fn.modal.Constructor = Modal\n\n\n // MODAL NO CONFLICT\n // =================\n\n $.fn.modal.noConflict = function () {\n $.fn.modal = old\n return this\n }\n\n\n // MODAL DATA-API\n // ==============\n\n $(document).on('click.bs.modal.data-api', '[data-toggle=\"modal\"]', function (e) {\n var $this = $(this)\n var href = $this.attr('href')\n var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\\s]+$)/, ''))) // strip for ie7\n var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())\n\n if ($this.is('a')) e.preventDefault()\n\n $target.one('show.bs.modal', function (showEvent) {\n if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown\n $target.one('hidden.bs.modal', function () {\n $this.is(':visible') && $this.trigger('focus')\n })\n })\n Plugin.call($target, option, this)\n })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: tooltip.js v3.3.6\n * http://getbootstrap.com/javascript/#tooltip\n * Inspired by the original jQuery.tipsy by Jason Frame\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // TOOLTIP PUBLIC CLASS DEFINITION\n // ===============================\n\n var Tooltip = function (element, options) {\n this.type = null\n this.options = null\n this.enabled = null\n this.timeout = null\n this.hoverState = null\n this.$element = null\n this.inState = null\n\n this.init('tooltip', element, options)\n }\n\n Tooltip.VERSION = '3.3.6'\n\n Tooltip.TRANSITION_DURATION = 150\n\n Tooltip.DEFAULTS = {\n animation: true,\n placement: 'top',\n selector: false,\n template: '
',\n trigger: 'hover focus',\n title: '',\n delay: 0,\n html: false,\n container: false,\n viewport: {\n selector: 'body',\n padding: 0\n }\n }\n\n Tooltip.prototype.init = function (type, element, options) {\n this.enabled = true\n this.type = type\n this.$element = $(element)\n this.options = this.getOptions(options)\n this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))\n this.inState = { click: false, hover: false, focus: false }\n\n if (this.$element[0] instanceof document.constructor && !this.options.selector) {\n throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')\n }\n\n var triggers = this.options.trigger.split(' ')\n\n for (var i = triggers.length; i--;) {\n var trigger = triggers[i]\n\n if (trigger == 'click') {\n this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))\n } else if (trigger != 'manual') {\n var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'\n var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'\n\n this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))\n this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))\n }\n }\n\n this.options.selector ?\n (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :\n this.fixTitle()\n }\n\n Tooltip.prototype.getDefaults = function () {\n return Tooltip.DEFAULTS\n }\n\n Tooltip.prototype.getOptions = function (options) {\n options = $.extend({}, this.getDefaults(), this.$element.data(), options)\n\n if (options.delay && typeof options.delay == 'number') {\n options.delay = {\n show: options.delay,\n hide: options.delay\n }\n }\n\n return options\n }\n\n Tooltip.prototype.getDelegateOptions = function () {\n var options = {}\n var defaults = this.getDefaults()\n\n this._options && $.each(this._options, function (key, value) {\n if (defaults[key] != value) options[key] = value\n })\n\n return options\n }\n\n Tooltip.prototype.enter = function (obj) {\n var self = obj instanceof this.constructor ?\n obj : $(obj.currentTarget).data('bs.' + this.type)\n\n if (!self) {\n self = new this.constructor(obj.currentTarget, this.getDelegateOptions())\n $(obj.currentTarget).data('bs.' + this.type, self)\n }\n\n if (obj instanceof $.Event) {\n self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true\n }\n\n if (self.tip().hasClass('in') || self.hoverState == 'in') {\n self.hoverState = 'in'\n return\n }\n\n clearTimeout(self.timeout)\n\n self.hoverState = 'in'\n\n if (!self.options.delay || !self.options.delay.show) return self.show()\n\n self.timeout = setTimeout(function () {\n if (self.hoverState == 'in') self.show()\n }, self.options.delay.show)\n }\n\n Tooltip.prototype.isInStateTrue = function () {\n for (var key in this.inState) {\n if (this.inState[key]) return true\n }\n\n return false\n }\n\n Tooltip.prototype.leave = function (obj) {\n var self = obj instanceof this.constructor ?\n obj : $(obj.currentTarget).data('bs.' + this.type)\n\n if (!self) {\n self = new this.constructor(obj.currentTarget, this.getDelegateOptions())\n $(obj.currentTarget).data('bs.' + this.type, self)\n }\n\n if (obj instanceof $.Event) {\n self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false\n }\n\n if (self.isInStateTrue()) return\n\n clearTimeout(self.timeout)\n\n self.hoverState = 'out'\n\n if (!self.options.delay || !self.options.delay.hide) return self.hide()\n\n self.timeout = setTimeout(function () {\n if (self.hoverState == 'out') self.hide()\n }, self.options.delay.hide)\n }\n\n Tooltip.prototype.show = function () {\n var e = $.Event('show.bs.' + this.type)\n\n if (this.hasContent() && this.enabled) {\n this.$element.trigger(e)\n\n var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])\n if (e.isDefaultPrevented() || !inDom) return\n var that = this\n\n var $tip = this.tip()\n\n var tipId = this.getUID(this.type)\n\n this.setContent()\n $tip.attr('id', tipId)\n this.$element.attr('aria-describedby', tipId)\n\n if (this.options.animation) $tip.addClass('fade')\n\n var placement = typeof this.options.placement == 'function' ?\n this.options.placement.call(this, $tip[0], this.$element[0]) :\n this.options.placement\n\n var autoToken = /\\s?auto?\\s?/i\n var autoPlace = autoToken.test(placement)\n if (autoPlace) placement = placement.replace(autoToken, '') || 'top'\n\n $tip\n .detach()\n .css({ top: 0, left: 0, display: 'block' })\n .addClass(placement)\n .data('bs.' + this.type, this)\n\n this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)\n this.$element.trigger('inserted.bs.' + this.type)\n\n var pos = this.getPosition()\n var actualWidth = $tip[0].offsetWidth\n var actualHeight = $tip[0].offsetHeight\n\n if (autoPlace) {\n var orgPlacement = placement\n var viewportDim = this.getPosition(this.$viewport)\n\n placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :\n placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :\n placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :\n placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :\n placement\n\n $tip\n .removeClass(orgPlacement)\n .addClass(placement)\n }\n\n var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)\n\n this.applyPlacement(calculatedOffset, placement)\n\n var complete = function () {\n var prevHoverState = that.hoverState\n that.$element.trigger('shown.bs.' + that.type)\n that.hoverState = null\n\n if (prevHoverState == 'out') that.leave(that)\n }\n\n $.support.transition && this.$tip.hasClass('fade') ?\n $tip\n .one('bsTransitionEnd', complete)\n .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :\n complete()\n }\n }\n\n Tooltip.prototype.applyPlacement = function (offset, placement) {\n var $tip = this.tip()\n var width = $tip[0].offsetWidth\n var height = $tip[0].offsetHeight\n\n // manually read margins because getBoundingClientRect includes difference\n var marginTop = parseInt($tip.css('margin-top'), 10)\n var marginLeft = parseInt($tip.css('margin-left'), 10)\n\n // we must check for NaN for ie 8/9\n if (isNaN(marginTop)) marginTop = 0\n if (isNaN(marginLeft)) marginLeft = 0\n\n offset.top += marginTop\n offset.left += marginLeft\n\n // $.fn.offset doesn't round pixel values\n // so we use setOffset directly with our own function B-0\n $.offset.setOffset($tip[0], $.extend({\n using: function (props) {\n $tip.css({\n top: Math.round(props.top),\n left: Math.round(props.left)\n })\n }\n }, offset), 0)\n\n $tip.addClass('in')\n\n // check to see if placing tip in new offset caused the tip to resize itself\n var actualWidth = $tip[0].offsetWidth\n var actualHeight = $tip[0].offsetHeight\n\n if (placement == 'top' && actualHeight != height) {\n offset.top = offset.top + height - actualHeight\n }\n\n var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)\n\n if (delta.left) offset.left += delta.left\n else offset.top += delta.top\n\n var isVertical = /top|bottom/.test(placement)\n var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight\n var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'\n\n $tip.offset(offset)\n this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)\n }\n\n Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {\n this.arrow()\n .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')\n .css(isVertical ? 'top' : 'left', '')\n }\n\n Tooltip.prototype.setContent = function () {\n var $tip = this.tip()\n var title = this.getTitle()\n\n $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)\n $tip.removeClass('fade in top bottom left right')\n }\n\n Tooltip.prototype.hide = function (callback) {\n var that = this\n var $tip = $(this.$tip)\n var e = $.Event('hide.bs.' + this.type)\n\n function complete() {\n if (that.hoverState != 'in') $tip.detach()\n that.$element\n .removeAttr('aria-describedby')\n .trigger('hidden.bs.' + that.type)\n callback && callback()\n }\n\n this.$element.trigger(e)\n\n if (e.isDefaultPrevented()) return\n\n $tip.removeClass('in')\n\n $.support.transition && $tip.hasClass('fade') ?\n $tip\n .one('bsTransitionEnd', complete)\n .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :\n complete()\n\n this.hoverState = null\n\n return this\n }\n\n Tooltip.prototype.fixTitle = function () {\n var $e = this.$element\n if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {\n $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')\n }\n }\n\n Tooltip.prototype.hasContent = function () {\n return this.getTitle()\n }\n\n Tooltip.prototype.getPosition = function ($element) {\n $element = $element || this.$element\n\n var el = $element[0]\n var isBody = el.tagName == 'BODY'\n\n var elRect = el.getBoundingClientRect()\n if (elRect.width == null) {\n // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093\n elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })\n }\n var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()\n var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }\n var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null\n\n return $.extend({}, elRect, scroll, outerDims, elOffset)\n }\n\n Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {\n return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :\n placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :\n placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :\n /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }\n\n }\n\n Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {\n var delta = { top: 0, left: 0 }\n if (!this.$viewport) return delta\n\n var viewportPadding = this.options.viewport && this.options.viewport.padding || 0\n var viewportDimensions = this.getPosition(this.$viewport)\n\n if (/right|left/.test(placement)) {\n var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll\n var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight\n if (topEdgeOffset < viewportDimensions.top) { // top overflow\n delta.top = viewportDimensions.top - topEdgeOffset\n } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow\n delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset\n }\n } else {\n var leftEdgeOffset = pos.left - viewportPadding\n var rightEdgeOffset = pos.left + viewportPadding + actualWidth\n if (leftEdgeOffset < viewportDimensions.left) { // left overflow\n delta.left = viewportDimensions.left - leftEdgeOffset\n } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow\n delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset\n }\n }\n\n return delta\n }\n\n Tooltip.prototype.getTitle = function () {\n var title\n var $e = this.$element\n var o = this.options\n\n title = $e.attr('data-original-title')\n || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)\n\n return title\n }\n\n Tooltip.prototype.getUID = function (prefix) {\n do prefix += ~~(Math.random() * 1000000)\n while (document.getElementById(prefix))\n return prefix\n }\n\n Tooltip.prototype.tip = function () {\n if (!this.$tip) {\n this.$tip = $(this.options.template)\n if (this.$tip.length != 1) {\n throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')\n }\n }\n return this.$tip\n }\n\n Tooltip.prototype.arrow = function () {\n return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))\n }\n\n Tooltip.prototype.enable = function () {\n this.enabled = true\n }\n\n Tooltip.prototype.disable = function () {\n this.enabled = false\n }\n\n Tooltip.prototype.toggleEnabled = function () {\n this.enabled = !this.enabled\n }\n\n Tooltip.prototype.toggle = function (e) {\n var self = this\n if (e) {\n self = $(e.currentTarget).data('bs.' + this.type)\n if (!self) {\n self = new this.constructor(e.currentTarget, this.getDelegateOptions())\n $(e.currentTarget).data('bs.' + this.type, self)\n }\n }\n\n if (e) {\n self.inState.click = !self.inState.click\n if (self.isInStateTrue()) self.enter(self)\n else self.leave(self)\n } else {\n self.tip().hasClass('in') ? self.leave(self) : self.enter(self)\n }\n }\n\n Tooltip.prototype.destroy = function () {\n var that = this\n clearTimeout(this.timeout)\n this.hide(function () {\n that.$element.off('.' + that.type).removeData('bs.' + that.type)\n if (that.$tip) {\n that.$tip.detach()\n }\n that.$tip = null\n that.$arrow = null\n that.$viewport = null\n })\n }\n\n\n // TOOLTIP PLUGIN DEFINITION\n // =========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.tooltip')\n var options = typeof option == 'object' && option\n\n if (!data && /destroy|hide/.test(option)) return\n if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.tooltip\n\n $.fn.tooltip = Plugin\n $.fn.tooltip.Constructor = Tooltip\n\n\n // TOOLTIP NO CONFLICT\n // ===================\n\n $.fn.tooltip.noConflict = function () {\n $.fn.tooltip = old\n return this\n }\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: popover.js v3.3.6\n * http://getbootstrap.com/javascript/#popovers\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // POPOVER PUBLIC CLASS DEFINITION\n // ===============================\n\n var Popover = function (element, options) {\n this.init('popover', element, options)\n }\n\n if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')\n\n Popover.VERSION = '3.3.6'\n\n Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {\n placement: 'right',\n trigger: 'click',\n content: '',\n template: '
'\n })\n\n\n // NOTE: POPOVER EXTENDS tooltip.js\n // ================================\n\n Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)\n\n Popover.prototype.constructor = Popover\n\n Popover.prototype.getDefaults = function () {\n return Popover.DEFAULTS\n }\n\n Popover.prototype.setContent = function () {\n var $tip = this.tip()\n var title = this.getTitle()\n var content = this.getContent()\n\n $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)\n $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events\n this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'\n ](content)\n\n $tip.removeClass('fade top bottom left right in')\n\n // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do\n // this manually by checking the contents.\n if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()\n }\n\n Popover.prototype.hasContent = function () {\n return this.getTitle() || this.getContent()\n }\n\n Popover.prototype.getContent = function () {\n var $e = this.$element\n var o = this.options\n\n return $e.attr('data-content')\n || (typeof o.content == 'function' ?\n o.content.call($e[0]) :\n o.content)\n }\n\n Popover.prototype.arrow = function () {\n return (this.$arrow = this.$arrow || this.tip().find('.arrow'))\n }\n\n\n // POPOVER PLUGIN DEFINITION\n // =========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.popover')\n var options = typeof option == 'object' && option\n\n if (!data && /destroy|hide/.test(option)) return\n if (!data) $this.data('bs.popover', (data = new Popover(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.popover\n\n $.fn.popover = Plugin\n $.fn.popover.Constructor = Popover\n\n\n // POPOVER NO CONFLICT\n // ===================\n\n $.fn.popover.noConflict = function () {\n $.fn.popover = old\n return this\n }\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: scrollspy.js v3.3.6\n * http://getbootstrap.com/javascript/#scrollspy\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // SCROLLSPY CLASS DEFINITION\n // ==========================\n\n function ScrollSpy(element, options) {\n this.$body = $(document.body)\n this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)\n this.options = $.extend({}, ScrollSpy.DEFAULTS, options)\n this.selector = (this.options.target || '') + ' .nav li > a'\n this.offsets = []\n this.targets = []\n this.activeTarget = null\n this.scrollHeight = 0\n\n this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))\n this.refresh()\n this.process()\n }\n\n ScrollSpy.VERSION = '3.3.6'\n\n ScrollSpy.DEFAULTS = {\n offset: 10\n }\n\n ScrollSpy.prototype.getScrollHeight = function () {\n return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)\n }\n\n ScrollSpy.prototype.refresh = function () {\n var that = this\n var offsetMethod = 'offset'\n var offsetBase = 0\n\n this.offsets = []\n this.targets = []\n this.scrollHeight = this.getScrollHeight()\n\n if (!$.isWindow(this.$scrollElement[0])) {\n offsetMethod = 'position'\n offsetBase = this.$scrollElement.scrollTop()\n }\n\n this.$body\n .find(this.selector)\n .map(function () {\n var $el = $(this)\n var href = $el.data('target') || $el.attr('href')\n var $href = /^#./.test(href) && $(href)\n\n return ($href\n && $href.length\n && $href.is(':visible')\n && [[$href[offsetMethod]().top + offsetBase, href]]) || null\n })\n .sort(function (a, b) { return a[0] - b[0] })\n .each(function () {\n that.offsets.push(this[0])\n that.targets.push(this[1])\n })\n }\n\n ScrollSpy.prototype.process = function () {\n var scrollTop = this.$scrollElement.scrollTop() + this.options.offset\n var scrollHeight = this.getScrollHeight()\n var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()\n var offsets = this.offsets\n var targets = this.targets\n var activeTarget = this.activeTarget\n var i\n\n if (this.scrollHeight != scrollHeight) {\n this.refresh()\n }\n\n if (scrollTop >= maxScroll) {\n return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)\n }\n\n if (activeTarget && scrollTop < offsets[0]) {\n this.activeTarget = null\n return this.clear()\n }\n\n for (i = offsets.length; i--;) {\n activeTarget != targets[i]\n && scrollTop >= offsets[i]\n && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])\n && this.activate(targets[i])\n }\n }\n\n ScrollSpy.prototype.activate = function (target) {\n this.activeTarget = target\n\n this.clear()\n\n var selector = this.selector +\n '[data-target=\"' + target + '\"],' +\n this.selector + '[href=\"' + target + '\"]'\n\n var active = $(selector)\n .parents('li')\n .addClass('active')\n\n if (active.parent('.dropdown-menu').length) {\n active = active\n .closest('li.dropdown')\n .addClass('active')\n }\n\n active.trigger('activate.bs.scrollspy')\n }\n\n ScrollSpy.prototype.clear = function () {\n $(this.selector)\n .parentsUntil(this.options.target, '.active')\n .removeClass('active')\n }\n\n\n // SCROLLSPY PLUGIN DEFINITION\n // ===========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.scrollspy')\n var options = typeof option == 'object' && option\n\n if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.scrollspy\n\n $.fn.scrollspy = Plugin\n $.fn.scrollspy.Constructor = ScrollSpy\n\n\n // SCROLLSPY NO CONFLICT\n // =====================\n\n $.fn.scrollspy.noConflict = function () {\n $.fn.scrollspy = old\n return this\n }\n\n\n // SCROLLSPY DATA-API\n // ==================\n\n $(window).on('load.bs.scrollspy.data-api', function () {\n $('[data-spy=\"scroll\"]').each(function () {\n var $spy = $(this)\n Plugin.call($spy, $spy.data())\n })\n })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: tab.js v3.3.6\n * http://getbootstrap.com/javascript/#tabs\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // TAB CLASS DEFINITION\n // ====================\n\n var Tab = function (element) {\n // jscs:disable requireDollarBeforejQueryAssignment\n this.element = $(element)\n // jscs:enable requireDollarBeforejQueryAssignment\n }\n\n Tab.VERSION = '3.3.6'\n\n Tab.TRANSITION_DURATION = 150\n\n Tab.prototype.show = function () {\n var $this = this.element\n var $ul = $this.closest('ul:not(.dropdown-menu)')\n var selector = $this.data('target')\n\n if (!selector) {\n selector = $this.attr('href')\n selector = selector && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n }\n\n if ($this.parent('li').hasClass('active')) return\n\n var $previous = $ul.find('.active:last a')\n var hideEvent = $.Event('hide.bs.tab', {\n relatedTarget: $this[0]\n })\n var showEvent = $.Event('show.bs.tab', {\n relatedTarget: $previous[0]\n })\n\n $previous.trigger(hideEvent)\n $this.trigger(showEvent)\n\n if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return\n\n var $target = $(selector)\n\n this.activate($this.closest('li'), $ul)\n this.activate($target, $target.parent(), function () {\n $previous.trigger({\n type: 'hidden.bs.tab',\n relatedTarget: $this[0]\n })\n $this.trigger({\n type: 'shown.bs.tab',\n relatedTarget: $previous[0]\n })\n })\n }\n\n Tab.prototype.activate = function (element, container, callback) {\n var $active = container.find('> .active')\n var transition = callback\n && $.support.transition\n && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)\n\n function next() {\n $active\n .removeClass('active')\n .find('> .dropdown-menu > .active')\n .removeClass('active')\n .end()\n .find('[data-toggle=\"tab\"]')\n .attr('aria-expanded', false)\n\n element\n .addClass('active')\n .find('[data-toggle=\"tab\"]')\n .attr('aria-expanded', true)\n\n if (transition) {\n element[0].offsetWidth // reflow for transition\n element.addClass('in')\n } else {\n element.removeClass('fade')\n }\n\n if (element.parent('.dropdown-menu').length) {\n element\n .closest('li.dropdown')\n .addClass('active')\n .end()\n .find('[data-toggle=\"tab\"]')\n .attr('aria-expanded', true)\n }\n\n callback && callback()\n }\n\n $active.length && transition ?\n $active\n .one('bsTransitionEnd', next)\n .emulateTransitionEnd(Tab.TRANSITION_DURATION) :\n next()\n\n $active.removeClass('in')\n }\n\n\n // TAB PLUGIN DEFINITION\n // =====================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.tab')\n\n if (!data) $this.data('bs.tab', (data = new Tab(this)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.tab\n\n $.fn.tab = Plugin\n $.fn.tab.Constructor = Tab\n\n\n // TAB NO CONFLICT\n // ===============\n\n $.fn.tab.noConflict = function () {\n $.fn.tab = old\n return this\n }\n\n\n // TAB DATA-API\n // ============\n\n var clickHandler = function (e) {\n e.preventDefault()\n Plugin.call($(this), 'show')\n }\n\n $(document)\n .on('click.bs.tab.data-api', '[data-toggle=\"tab\"]', clickHandler)\n .on('click.bs.tab.data-api', '[data-toggle=\"pill\"]', clickHandler)\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: affix.js v3.3.6\n * http://getbootstrap.com/javascript/#affix\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // AFFIX CLASS DEFINITION\n // ======================\n\n var Affix = function (element, options) {\n this.options = $.extend({}, Affix.DEFAULTS, options)\n\n this.$target = $(this.options.target)\n .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))\n .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))\n\n this.$element = $(element)\n this.affixed = null\n this.unpin = null\n this.pinnedOffset = null\n\n this.checkPosition()\n }\n\n Affix.VERSION = '3.3.6'\n\n Affix.RESET = 'affix affix-top affix-bottom'\n\n Affix.DEFAULTS = {\n offset: 0,\n target: window\n }\n\n Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {\n var scrollTop = this.$target.scrollTop()\n var position = this.$element.offset()\n var targetHeight = this.$target.height()\n\n if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false\n\n if (this.affixed == 'bottom') {\n if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'\n return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'\n }\n\n var initializing = this.affixed == null\n var colliderTop = initializing ? scrollTop : position.top\n var colliderHeight = initializing ? targetHeight : height\n\n if (offsetTop != null && scrollTop <= offsetTop) return 'top'\n if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'\n\n return false\n }\n\n Affix.prototype.getPinnedOffset = function () {\n if (this.pinnedOffset) return this.pinnedOffset\n this.$element.removeClass(Affix.RESET).addClass('affix')\n var scrollTop = this.$target.scrollTop()\n var position = this.$element.offset()\n return (this.pinnedOffset = position.top - scrollTop)\n }\n\n Affix.prototype.checkPositionWithEventLoop = function () {\n setTimeout($.proxy(this.checkPosition, this), 1)\n }\n\n Affix.prototype.checkPosition = function () {\n if (!this.$element.is(':visible')) return\n\n var height = this.$element.height()\n var offset = this.options.offset\n var offsetTop = offset.top\n var offsetBottom = offset.bottom\n var scrollHeight = Math.max($(document).height(), $(document.body).height())\n\n if (typeof offset != 'object') offsetBottom = offsetTop = offset\n if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)\n if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)\n\n var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)\n\n if (this.affixed != affix) {\n if (this.unpin != null) this.$element.css('top', '')\n\n var affixType = 'affix' + (affix ? '-' + affix : '')\n var e = $.Event(affixType + '.bs.affix')\n\n this.$element.trigger(e)\n\n if (e.isDefaultPrevented()) return\n\n this.affixed = affix\n this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null\n\n this.$element\n .removeClass(Affix.RESET)\n .addClass(affixType)\n .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')\n }\n\n if (affix == 'bottom') {\n this.$element.offset({\n top: scrollHeight - height - offsetBottom\n })\n }\n }\n\n\n // AFFIX PLUGIN DEFINITION\n // =======================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.affix')\n var options = typeof option == 'object' && option\n\n if (!data) $this.data('bs.affix', (data = new Affix(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.affix\n\n $.fn.affix = Plugin\n $.fn.affix.Constructor = Affix\n\n\n // AFFIX NO CONFLICT\n // =================\n\n $.fn.affix.noConflict = function () {\n $.fn.affix = old\n return this\n }\n\n\n // AFFIX DATA-API\n // ==============\n\n $(window).on('load', function () {\n $('[data-spy=\"affix\"]').each(function () {\n var $spy = $(this)\n var data = $spy.data()\n\n data.offset = data.offset || {}\n\n if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom\n if (data.offsetTop != null) data.offset.top = data.offsetTop\n\n Plugin.call($spy, data)\n })\n })\n\n}(jQuery);\n","// Generated by CoffeeScript 1.8.0\n(function() {\n var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n angular.module('localytics.directives', []);\n\n angular.module('localytics.directives').directive('chosen', [\n '$timeout', function($timeout) {\n var CHOSEN_OPTION_WHITELIST, NG_OPTIONS_REGEXP, isEmpty, snakeCase;\n NG_OPTIONS_REGEXP = /^\\s*(.*?)(?:\\s+as\\s+(.*?))?(?:\\s+group\\s+by\\s+(.*))?\\s+for\\s+(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+(.*?)(?:\\s+track\\s+by\\s+(.*?))?$/;\n CHOSEN_OPTION_WHITELIST = ['noResultsText', 'allowSingleDeselect', 'disableSearchThreshold', 'disableSearch', 'enableSplitWordSearch', 'inheritSelectClasses', 'maxSelectedOptions', 'placeholderTextMultiple', 'placeholderTextSingle', 'searchContains', 'singleBackstrokeDelete', 'displayDisabledOptions', 'displaySelectedOptions', 'width'];\n snakeCase = function(input) {\n return input.replace(/[A-Z]/g, function($1) {\n return \"_\" + ($1.toLowerCase());\n });\n };\n isEmpty = function(value) {\n var key;\n if (angular.isArray(value)) {\n return value.length === 0;\n } else if (angular.isObject(value)) {\n for (key in value) {\n if (value.hasOwnProperty(key)) {\n return false;\n }\n }\n }\n return true;\n };\n return {\n restrict: 'A',\n require: '?ngModel',\n terminal: true,\n link: function(scope, element, attr, ngModel) {\n var chosen, defaultText, disableWithMessage, empty, initOrUpdate, match, options, origRender, removeEmptyMessage, startLoading, stopLoading, valuesExpr, viewWatch;\n element.addClass('localytics-chosen');\n options = scope.$eval(attr.chosen) || {};\n angular.forEach(attr, function(value, key) {\n if (__indexOf.call(CHOSEN_OPTION_WHITELIST, key) >= 0) {\n return options[snakeCase(key)] = scope.$eval(value);\n }\n });\n startLoading = function() {\n return element.addClass('loading').attr('disabled', true).trigger('chosen:updated');\n };\n stopLoading = function() {\n return element.removeClass('loading').attr('disabled', false).trigger('chosen:updated');\n };\n chosen = null;\n defaultText = null;\n empty = false;\n initOrUpdate = function() {\n if (chosen) {\n return element.trigger('chosen:updated');\n } else {\n chosen = element.chosen(options).data('chosen');\n return defaultText = chosen.default_text;\n }\n };\n removeEmptyMessage = function() {\n empty = false;\n return element.attr('data-placeholder', defaultText);\n };\n disableWithMessage = function() {\n empty = true;\n return element.attr('data-placeholder', chosen.results_none_found).attr('disabled', true).trigger('chosen:updated');\n };\n if (ngModel) {\n origRender = ngModel.$render;\n ngModel.$render = function() {\n origRender();\n return initOrUpdate();\n };\n if (attr.multiple) {\n viewWatch = function() {\n return ngModel.$viewValue;\n };\n scope.$watch(viewWatch, ngModel.$render, true);\n }\n } else {\n initOrUpdate();\n }\n attr.$observe('disabled', function() {\n return element.trigger('chosen:updated');\n });\n if (attr.ngOptions && ngModel) {\n match = attr.ngOptions.match(NG_OPTIONS_REGEXP);\n valuesExpr = match[7];\n scope.$watchCollection(valuesExpr, function(newVal, oldVal) {\n var timer;\n return timer = $timeout(function() {\n if (angular.isUndefined(newVal)) {\n return startLoading();\n } else {\n if (empty) {\n removeEmptyMessage();\n }\n stopLoading();\n if (isEmpty(newVal)) {\n return disableWithMessage();\n }\n }\n });\n });\n return scope.$on('$destroy', function(event) {\n if (typeof timer !== \"undefined\" && timer !== null) {\n return $timeout.cancel(timer);\n }\n });\n }\n }\n };\n }\n ]);\n\n}).call(this);\n","(function(window, angular, undefined) {\r\n'use strict';\r\nangular.module('ngIdle', ['ngIdle.keepalive', 'ngIdle.idle', 'ngIdle.countdown', 'ngIdle.title', 'ngIdle.localStorage']);\r\nangular.module('ngIdle.keepalive', [])\r\n .provider('Keepalive', function() {\r\n var options = {\r\n http: null,\r\n interval: 10 * 60\r\n };\r\n\r\n this.http = function(value) {\r\n if (!value) throw new Error('Argument must be a string containing a URL, or an object containing the HTTP request configuration.');\r\n if (angular.isString(value)) {\r\n value = {\r\n url: value,\r\n method: 'GET'\r\n };\r\n }\r\n\r\n value.cache = false;\r\n\r\n options.http = value;\r\n };\r\n\r\n var setInterval = this.interval = function(seconds) {\r\n seconds = parseInt(seconds);\r\n\r\n if (isNaN(seconds) || seconds <= 0) throw new Error('Interval must be expressed in seconds and be greater than 0.');\r\n options.interval = seconds;\r\n };\r\n\r\n this.$get = ['$rootScope', '$log', '$interval', '$http',\r\n function($rootScope, $log, $interval, $http) {\r\n\r\n var state = {\r\n ping: null\r\n };\r\n\r\n function handleResponse(data, status) {\r\n $rootScope.$broadcast('KeepaliveResponse', data, status);\r\n }\r\n\r\n function ping() {\r\n $rootScope.$broadcast('Keepalive');\r\n\r\n if (angular.isObject(options.http)) {\r\n $http(options.http)\r\n .success(handleResponse)\r\n .error(handleResponse);\r\n }\r\n }\r\n\r\n return {\r\n _options: function() {\r\n return options;\r\n },\r\n setInterval: setInterval,\r\n start: function() {\r\n $interval.cancel(state.ping);\r\n\r\n state.ping = $interval(ping, options.interval * 1000);\r\n return state.ping;\r\n },\r\n stop: function() {\r\n $interval.cancel(state.ping);\r\n },\r\n ping: function() {\r\n ping();\r\n }\r\n };\r\n }\r\n ];\r\n });\r\n\r\nangular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage'])\r\n .provider('Idle', function() {\r\n var options = {\r\n idle: 20 * 60, // in seconds (default is 20min)\r\n timeout: 30, // in seconds (default is 30sec)\r\n autoResume: 'idle', // lets events automatically resume (unsets idle state/resets warning)\r\n interrupt: 'mousemove keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll',\r\n windowInterrupt: null,\r\n keepalive: true\r\n };\r\n\r\n /**\r\n * Sets the number of seconds a user can be idle before they are considered timed out.\r\n * @param {Number|Boolean} seconds A positive number representing seconds OR 0 or false to disable this feature.\r\n */\r\n var setTimeout = this.timeout = function(seconds) {\r\n if (seconds === false) options.timeout = 0;\r\n else if (angular.isNumber(seconds) && seconds >= 0) options.timeout = seconds;\r\n else throw new Error('Timeout must be zero or false to disable the feature, or a positive integer (in seconds) to enable it.');\r\n };\r\n\r\n this.interrupt = function(events) {\r\n options.interrupt = events;\r\n };\r\n\r\n this.windowInterrupt = function(events) {\r\n options.windowInterrupt = events;\r\n };\r\n\r\n var setIdle = this.idle = function(seconds) {\r\n if (seconds <= 0) throw new Error('Idle must be a value in seconds, greater than 0.');\r\n\r\n options.idle = seconds;\r\n };\r\n\r\n this.autoResume = function(value) {\r\n if (value === true) options.autoResume = 'idle';\r\n else if (value === false) options.autoResume = 'off';\r\n else options.autoResume = value;\r\n };\r\n\r\n this.keepalive = function(enabled) {\r\n options.keepalive = enabled === true;\r\n };\r\n\r\n this.$get = ['$interval', '$log', '$rootScope', '$document', 'Keepalive', 'IdleLocalStorage', '$window',\r\n function($interval, $log, $rootScope, $document, Keepalive, LocalStorage, $window) {\r\n var state = {\r\n idle: null,\r\n timeout: null,\r\n idling: false,\r\n running: false,\r\n countdown: null\r\n };\r\n\r\n var id = new Date().getTime();\r\n\r\n function startKeepalive() {\r\n if (!options.keepalive) return;\r\n\r\n if (state.running) Keepalive.ping();\r\n\r\n Keepalive.start();\r\n }\r\n\r\n function stopKeepalive() {\r\n if (!options.keepalive) return;\r\n\r\n Keepalive.stop();\r\n }\r\n\r\n function toggleState() {\r\n state.idling = !state.idling;\r\n var name = state.idling ? 'IdleStart' : 'IdleEnd';\r\n\r\n if (state.idling) {\r\n $rootScope.$broadcast(name);\r\n stopKeepalive();\r\n if (options.timeout) {\r\n state.countdown = options.timeout;\r\n countdown();\r\n state.timeout = $interval(countdown, 1000, options.timeout, false);\r\n }\r\n } else {\r\n startKeepalive();\r\n $rootScope.$broadcast(name);\r\n }\r\n\r\n $interval.cancel(state.idle);\r\n }\r\n\r\n function countdown() {\r\n\r\n // check not called when no longer idling\r\n // possible with multiple tabs\r\n if(!state.idling){\r\n return;\r\n }\r\n\r\n // countdown has expired, so signal timeout\r\n if (state.countdown <= 0) {\r\n timeout();\r\n return;\r\n }\r\n\r\n // countdown hasn't reached zero, so warn and decrement\r\n $rootScope.$broadcast('IdleWarn', state.countdown);\r\n state.countdown--;\r\n }\r\n\r\n function timeout() {\r\n stopKeepalive();\r\n $interval.cancel(state.idle);\r\n $interval.cancel(state.timeout);\r\n\r\n state.idling = true;\r\n state.running = false;\r\n state.countdown = 0;\r\n\r\n $rootScope.$broadcast('IdleTimeout');\r\n }\r\n\r\n function changeOption(self, fn, value) {\r\n var reset = self.running();\r\n\r\n self.unwatch();\r\n fn(value);\r\n if (reset) self.watch();\r\n }\r\n\r\n function getExpiry() {\r\n var obj = LocalStorage.get('expiry');\r\n\r\n return obj && obj.time ? new Date(obj.time) : null;\r\n }\r\n\r\n function setExpiry(date) {\r\n if (!date) LocalStorage.remove('expiry');\r\n else LocalStorage.set('expiry', {id: id, time: date});\r\n }\r\n\r\n var svc = {\r\n _options: function() {\r\n return options;\r\n },\r\n _getNow: function() {\r\n return new Date();\r\n },\r\n getIdle: function(){\r\n return options.idle;\r\n },\r\n getTimeout: function(){\r\n return options.timeout;\r\n },\r\n setIdle: function(seconds) {\r\n changeOption(this, setIdle, seconds);\r\n },\r\n setTimeout: function(seconds) {\r\n changeOption(this, setTimeout, seconds);\r\n },\r\n isExpired: function() {\r\n var expiry = getExpiry();\r\n return expiry !== null && expiry <= this._getNow();\r\n },\r\n running: function() {\r\n return state.running;\r\n },\r\n idling: function() {\r\n return state.idling;\r\n },\r\n watch: function(noExpiryUpdate) {\r\n $interval.cancel(state.idle);\r\n $interval.cancel(state.timeout);\r\n\r\n // calculate the absolute expiry date, as added insurance against a browser sleeping or paused in the background\r\n var timeout = !options.timeout ? 0 : options.timeout;\r\n if (!noExpiryUpdate) setExpiry(new Date(new Date().getTime() + ((options.idle + timeout) * 1000)));\r\n\r\n\r\n if (state.idling) toggleState(); // clears the idle state if currently idling\r\n else if (!state.running) startKeepalive(); // if about to run, start keep alive\r\n\r\n state.running = true;\r\n\r\n state.idle = $interval(toggleState, options.idle * 1000, 0, false);\r\n },\r\n unwatch: function() {\r\n $interval.cancel(state.idle);\r\n $interval.cancel(state.timeout);\r\n\r\n state.idling = false;\r\n state.running = false;\r\n setExpiry(null);\r\n\r\n stopKeepalive();\r\n },\r\n interrupt: function(anotherTab) {\r\n if (!state.running) return;\r\n\r\n if (options.timeout && this.isExpired()) {\r\n timeout();\r\n return;\r\n }\r\n\r\n // note: you can no longer auto resume once we exceed the expiry; you will reset state by calling watch() manually\r\n if (anotherTab || options.autoResume === 'idle' || (options.autoResume === 'notIdle' && !state.idling)) this.watch(anotherTab);\r\n }\r\n };\r\n\r\n var lastMove = {\r\n clientX: null,\r\n clientY: null,\r\n swap: function(event) {\r\n var last = {clientX: this.clientX, clientY: this.clientY};\r\n this.clientX = event.clientX;\r\n this.clientY = event.clientY;\r\n return last;\r\n },\r\n hasMoved: function(event) {\r\n var last = this.swap(event);\r\n if (this.clientX === null || event.movementX || event.movementY) return true;\r\n else if (last.clientX != event.clientX || last.clientY != event.clientY) return true;\r\n else return false;\r\n }\r\n };\r\n\r\n $document.find('html').on(options.interrupt, function(event) {\r\n if (event.type === 'mousemove' && event.originalEvent && event.originalEvent.movementX === 0 && event.originalEvent.movementY === 0) {\r\n return; // Fix for Chrome desktop notifications, triggering mousemove event.\r\n }\r\n\r\n if (event.type !== 'mousemove' || lastMove.hasMoved(event)) {\r\n svc.interrupt();\r\n }\r\n });\r\n\r\n if(options.windowInterrupt) {\r\n var eventList = options.windowInterrupt.split(' ');\r\n var fn = function() {\r\n svc.interrupt();\r\n };\r\n\r\n for(var i=0; i