├── .gitignore ├── .jshintrc ├── Gruntfile.js ├── LICENSE ├── README.md ├── angular-prompt.html ├── angular-prompt.js ├── bower.json ├── bower_components ├── angular-bootstrap │ ├── .bower.json │ ├── .gitignore │ ├── .npmignore │ ├── README.md │ ├── bower.json │ ├── index.js │ ├── package.json │ ├── ui-bootstrap-csp.css │ ├── ui-bootstrap-tpls.js │ ├── ui-bootstrap-tpls.min.js │ ├── ui-bootstrap.js │ └── ui-bootstrap.min.js ├── angular │ ├── .bower.json │ ├── README.md │ ├── angular-csp.css │ ├── angular.js │ ├── angular.min.js │ ├── angular.min.js.gzip │ ├── angular.min.js.map │ ├── bower.json │ ├── index.js │ └── package.json └── underscore │ ├── .bower.json │ ├── .editorconfig │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── bower.json │ ├── component.json │ ├── package.json │ └── underscore.js ├── demo ├── demo.js └── index.html ├── dist ├── angular-prompt.js └── angular-prompt.min.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Deployed apps should consider commenting this line out: 24 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 25 | node_modules 26 | 27 | temp -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "boss": true, 11 | "eqnull": true, 12 | "browser": true, 13 | "smarttabs": true, 14 | "globals": { 15 | "jQuery": true, 16 | "angular": true, 17 | "console": true, 18 | "$": true, 19 | "_": true, 20 | "moment": true, 21 | "describe": true, 22 | "beforeEach": true, 23 | "module": true, 24 | "inject": true, 25 | "it": true, 26 | "expect": true 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (grunt) { 4 | 5 | require('load-grunt-tasks')(grunt); 6 | 7 | grunt.initConfig({ 8 | connect: { 9 | main: { 10 | options: { 11 | port: 9001 12 | } 13 | } 14 | }, 15 | watch: { 16 | main: { 17 | options: { 18 | livereload: true, 19 | livereloadOnError: false, 20 | spawn: false 21 | }, 22 | files: ['angular-prompt.html','angular-prompt.js','dist/**/*','demo/**/*'], 23 | tasks: ['build'] 24 | } 25 | }, 26 | jshint: { 27 | main: { 28 | options: { 29 | jshintrc: '.jshintrc' 30 | }, 31 | src: 'angular-prompt.js' 32 | } 33 | }, 34 | jasmine: { 35 | unit: { 36 | src: ['./bower_components/angular/angular.js','./bower_components/angular-bootstrap/ui-bootstrap-tpls.js','./dist/angular-prompt.js','./demo/demo.js'], 37 | options: { 38 | specs: 'test/*.js' 39 | } 40 | } 41 | }, 42 | ngtemplates: { 43 | main: { 44 | options: { 45 | module:'cgPrompt', 46 | base:'' 47 | }, 48 | src:'angular-prompt.html', 49 | dest: 'temp/templates.js' 50 | } 51 | }, 52 | concat: { 53 | main: { 54 | src: ['angular-prompt.js', 'temp/templates.js'], 55 | dest: 'dist/angular-prompt.js' 56 | } 57 | }, 58 | uglify: { 59 | main: { 60 | files: [ 61 | {src:'dist/angular-prompt.js',dest:'dist/angular-prompt.min.js'} 62 | ] 63 | } 64 | } 65 | }); 66 | 67 | grunt.registerTask('serve', ['jshint','connect', 'watch']); 68 | grunt.registerTask('build',['ngtemplates','concat','uglify']); 69 | grunt.registerTask('test',['build','jasmine']); 70 | 71 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Chris Gross 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # angular-prompt 2 | 3 | > Angular service to easily display prompt and confirmation modals. 4 | 5 | This library depends on [angular-ui-bootstrap](https://github.com/angular-ui/bootstrap). 6 | 7 | ## Demo 8 | 9 | [Live Demo](http://cgross.github.io/angular-prompt/demo) 10 | 11 | ## Getting Started 12 | 13 | Install with Bower or download the the files directly from the dist folder in the repo. 14 | ```bash 15 | bower install angular-prompt --save 16 | ``` 17 | 18 | Add `dist/angular-prompt.js` to your index.html. 19 | 20 | Add `cgPrompt` as a module dependency for your module. 21 | 22 | ```js 23 | angular.module('your_app', ['ui.bootstrap','cgPrompt']); 24 | ``` 25 | 26 | Now you can inject and use the `prompt` service. 27 | 28 | ```js 29 | function MyCtrl($scope, prompt) { 30 | 31 | //simple confirmation 32 | prompt({ 33 | title: 'Delete this Thing?', 34 | message: 'Are you sure you want to do that?' 35 | }).then(function(){ 36 | //he hit ok and not cancel 37 | }); 38 | 39 | //ask the user for a string 40 | prompt({ 41 | title: 'Give me a name', 42 | message: 'What would you like to name it?', 43 | input: true, 44 | label: 'Name', 45 | value: 'Current name', 46 | values: ['other','possible','names'] 47 | }).then(function(name){ 48 | //the promise is resolved with the user input 49 | }); 50 | } 51 | ``` 52 | 53 | ## API 54 | 55 | ### prompt(options); 56 | 57 | - #### options.title 58 | Type: `String` 59 | Default: `''` 60 | The title for the dialog. 61 | 62 | - #### options.message 63 | Type: `String` 64 | Default: `''` 65 | The message inside the dialog. 66 | 67 | - #### options.input 68 | Type: `Boolean` 69 | Default: `false` 70 | Set to `true` if you wish to prompt the user for a text value. 71 | 72 | - #### options.label 73 | Type: `String` 74 | Default: `''` 75 | The label for the input if `input=true`. 76 | 77 | - #### options.value 78 | Type: `String` 79 | Default: `''` 80 | The initial value of the input if `input=true`. 81 | 82 | - #### options.values 83 | Type: `Array` of `String` 84 | Default: `undefined` 85 | A list of values available in a dropdown for the user to select as the input value. 86 | 87 | - #### options.buttons 88 | Type: `Array` of `Object` with properties `label`,`cancel`, `style`, and `primary` 89 | Default: `[{ label:'OK', primary: true }, { label:'Cancel', cancel: true }]` 90 | A list of the buttons to display on the dialog. 91 | 92 | The function returns a promise. That promise is resolved with either the button that was pressed, or in the case of input prompts, the value the user entered. If the user pressed a button where `cancel=true` or canceled the dialog another way (hit ESC, etc) then the promise is rejected. 93 | 94 | ## Release History 95 | * v1.2.0 96 | * Moved to Angular 1.5 and UI Bootstrap 1.3. 97 | * Refactored code to no longer use angular.element(...).scope(). 98 | * v1.1.0 99 | * Added `style` option to buttons. 100 | * v1.0.1 101 | * Updated modal template with correct modal title class. 102 | * Added bower_components to ignore in bower.json. 103 | * Moved to angular-bootstrap v0.11. 104 | * v1.0.0 - Initial release. 105 | -------------------------------------------------------------------------------- /angular-prompt.html: -------------------------------------------------------------------------------- 1 |
2 | 6 | 30 | 33 |
-------------------------------------------------------------------------------- /angular-prompt.js: -------------------------------------------------------------------------------- 1 | angular.module('cgPrompt',['ui.bootstrap']); 2 | 3 | angular.module('cgPrompt').factory('prompt',['$uibModal','$q',function($uibModal,$q){ 4 | 5 | var prompt = function(options){ 6 | 7 | var defaults = { 8 | title: '', 9 | message: '', 10 | input: false, 11 | label: '', 12 | value: '', 13 | values: false, 14 | buttons: [ 15 | {label:'Cancel',cancel:true}, 16 | {label:'OK',primary:true} 17 | ] 18 | }; 19 | 20 | if (options === undefined){ 21 | options = {}; 22 | } 23 | 24 | for (var key in defaults) { 25 | if (options[key] === undefined) { 26 | options[key] = defaults[key]; 27 | } 28 | } 29 | 30 | var defer = $q.defer(); 31 | 32 | $uibModal.open({ 33 | templateUrl:'angular-prompt.html', 34 | controller: 'cgPromptCtrl', 35 | resolve: { 36 | options:function(){ 37 | return options; 38 | } 39 | } 40 | }).result.then(function(result){ 41 | if (options.input){ 42 | defer.resolve(result.input); 43 | } else { 44 | defer.resolve(result.button); 45 | } 46 | }, function(){ 47 | defer.reject(); 48 | }); 49 | 50 | return defer.promise; 51 | }; 52 | 53 | return prompt; 54 | } 55 | ]); 56 | 57 | angular.module('cgPrompt').controller('cgPromptCtrl',['$scope','options','$timeout',function($scope,options,$timeout){ 58 | 59 | $scope.input = {name:options.value}; 60 | 61 | $scope.options = options; 62 | 63 | $scope.form = {}; 64 | 65 | $scope.buttonClicked = function(button){ 66 | if (button.cancel){ 67 | $scope.$dismiss(); 68 | return; 69 | } 70 | if (options.input && $scope.form.cgPromptForm.$invalid){ 71 | $scope.changed = true; 72 | return; 73 | } 74 | $scope.$close({button:button,input:$scope.input.name}); 75 | }; 76 | 77 | $scope.submit = function(){ 78 | var ok; 79 | angular.forEach($scope.options.buttons,function(button){ 80 | if (button.primary){ 81 | ok = button; 82 | } 83 | }); 84 | if (ok){ 85 | $scope.buttonClicked(ok); 86 | } 87 | }; 88 | 89 | $timeout(function(){ 90 | var elem = document.querySelector('#cgPromptInput'); 91 | if (elem) { 92 | if (elem.select) { 93 | elem.select(); 94 | } 95 | if (elem.focus) { 96 | elem.focus(); 97 | } 98 | } 99 | },100); 100 | 101 | 102 | }]); 103 | 104 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-prompt", 3 | "description": "Angular service to easily display prompt and confirmation modals.", 4 | "version": "1.2.0", 5 | "main": [ 6 | "dist/angular-prompt.js" 7 | ], 8 | "dependencies": { 9 | "angular": "~1.5", 10 | "angular-bootstrap": "~1.3" 11 | }, 12 | "ignore": [ 13 | "**/.*", 14 | "node_modules", 15 | "bower_components", 16 | "test", 17 | "temp", 18 | "demo", 19 | "lib", 20 | "angular-prompt.html", 21 | "./angular-prompt.js", 22 | "Gruntfile.js", 23 | "package.json", 24 | "README.md" 25 | ], 26 | "devDependencies": { 27 | "underscore": "~1.6.0" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "https://github.com/angular-ui/bootstrap/graphs/contributors" 4 | }, 5 | "name": "angular-bootstrap", 6 | "keywords": [ 7 | "angular", 8 | "angular-ui", 9 | "bootstrap" 10 | ], 11 | "license": "MIT", 12 | "ignore": [], 13 | "description": "Native AngularJS (Angular) directives for Bootstrap.", 14 | "version": "1.3.2", 15 | "main": [ 16 | "./ui-bootstrap-tpls.js" 17 | ], 18 | "dependencies": { 19 | "angular": ">=1.4.0" 20 | }, 21 | "homepage": "https://github.com/angular-ui/bootstrap-bower", 22 | "_release": "1.3.2", 23 | "_resolution": { 24 | "type": "version", 25 | "tag": "1.3.2", 26 | "commit": "77da362b0b86c0a86762b56d64aaec107889f31a" 27 | }, 28 | "_source": "https://github.com/angular-ui/bootstrap-bower.git", 29 | "_target": "~1.3", 30 | "_originalSource": "angular-bootstrap" 31 | } -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/.npmignore: -------------------------------------------------------------------------------- 1 | bower.json -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/README.md: -------------------------------------------------------------------------------- 1 | ### UI Bootstrap - [AngularJS](http://angularjs.org/) directives specific to [Bootstrap](http://getbootstrap.com) 2 | 3 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/bootstrap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | [![Build Status](https://secure.travis-ci.org/angular-ui/bootstrap.svg)](http://travis-ci.org/angular-ui/bootstrap) 5 | [![devDependency Status](https://david-dm.org/angular-ui/bootstrap/dev-status.svg?branch=master)](https://david-dm.org/angular-ui/bootstrap#info=devDependencies) 6 | 7 | ### Quick links 8 | - [Demo](#demo) 9 | - [Installation](#installation) 10 | - [NPM](#install-with-npm) 11 | - [Bower](#install-with-bower) 12 | - [NuGet](#install-with-nuget) 13 | - [Custom](#custom-build) 14 | - [Manual](#manual-download) 15 | - [Support](#support) 16 | - [FAQ](#faq) 17 | - [Supported browsers](#supported-browsers) 18 | - [Need help?](#need-help) 19 | - [Found a bug?](#found-a-bug) 20 | - [Contributing to the project](#contributing-to-the-project) 21 | - [Development, meeting minutes, roadmap and more.](#development-meeting-minutes-roadmap-and-more) 22 | 23 | 24 | # Demo 25 | 26 | Do you want to see directives in action? Visit http://angular-ui.github.io/bootstrap/! 27 | 28 | # Installation 29 | 30 | Installation is easy as UI Bootstrap has minimal dependencies - only the AngularJS and Twitter Bootstrap's CSS are required. 31 | Note: Since version 0.13.0, UI Bootstrap depends on [ngAnimate](https://docs.angularjs.org/api/ngAnimate) for transitions and animations, such as the accordion, carousel, etc. Include `ngAnimate` in the module dependencies for your app in order to enable animation. 32 | 33 | #### Install with NPM 34 | 35 | ```sh 36 | $ npm install angular-ui-bootstrap 37 | ``` 38 | 39 | This will install AngularJS and Bootstrap NPM packages. 40 | 41 | #### Install with Bower 42 | ```sh 43 | $ bower install angular-bootstrap 44 | ``` 45 | 46 | Note: do not install 'angular-ui-bootstrap'. A separate repository - [bootstrap-bower](https://github.com/angular-ui/bootstrap-bower) - hosts the compiled javascript file and bower.json. 47 | 48 | #### Install with NuGet 49 | To install AngularJS UI Bootstrap, run the following command in the Package Manager Console 50 | 51 | ```sh 52 | PM> Install-Package Angular.UI.Bootstrap 53 | ``` 54 | 55 | #### Custom build 56 | 57 | Head over to http://angular-ui.github.io/bootstrap/ and hit the *Custom build* button to create your own custom UI Bootstrap build, just the way you like it. 58 | 59 | #### Manual download 60 | 61 | After downloading dependencies (or better yet, referencing them from your favorite CDN) you need to download build version of this project. All the files and their purposes are described here: 62 | https://github.com/angular-ui/bootstrap/tree/gh-pages#build-files 63 | Don't worry, if you are not sure which file to take, opt for `ui-bootstrap-tpls-[version].min.js`. 64 | 65 | ### Adding dependency to your project 66 | 67 | When you are done downloading all the dependencies and project files the only remaining part is to add dependencies on the `ui.bootstrap` AngularJS module: 68 | 69 | ```js 70 | angular.module('myModule', ['ui.bootstrap']); 71 | ``` 72 | 73 | If you're a Browserify or Webpack user, you can do: 74 | 75 | ```js 76 | var uibs = require('angular-ui-bootstrap'); 77 | 78 | angular.module('myModule', [uibs]); 79 | ``` 80 | 81 | # Support 82 | 83 | ## FAQ 84 | 85 | https://github.com/angular-ui/bootstrap/wiki/FAQ 86 | 87 | ## Supported browsers 88 | 89 | Directives from this repository are automatically tested with the following browsers: 90 | * Chrome (stable and canary channel) 91 | * Firefox 92 | * IE 9 and 10 93 | * Opera 94 | * Safari 95 | 96 | Modern mobile browsers should work without problems. 97 | 98 | 99 | ## Need help? 100 | Need help using UI Bootstrap? 101 | 102 | * Live help in the IRC (`#angularjs` channel at the `freenode` network). Use this [webchat](https://webchat.freenode.net/) or your own IRC client. 103 | * Ask a question in [StackOverflow](http://stackoverflow.com/) under the [angular-ui-bootstrap](http://stackoverflow.com/questions/tagged/angular-ui-bootstrap) tag. 104 | 105 | **Please do not create new issues in this repository to ask questions about using UI Bootstrap** 106 | 107 | ## Found a bug? 108 | Please take a look at [CONTRIBUTING.md](CONTRIBUTING.md#you-think-youve-found-a-bug) and submit your issue [here](https://github.com/angular-ui/bootstrap/issues/new). 109 | 110 | 111 | ---- 112 | 113 | 114 | # Contributing to the project 115 | 116 | We are always looking for the quality contributions! Please check the [CONTRIBUTING.md](CONTRIBUTING.md) for the contribution guidelines. 117 | 118 | # Development, meeting minutes, roadmap and more. 119 | 120 | Head over to the [Wiki](https://github.com/angular-ui/bootstrap/wiki) for notes on development for UI Bootstrap, meeting minutes from the UI Bootstrap team, roadmap plans, project philosophy and more. 121 | -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "https://github.com/angular-ui/bootstrap/graphs/contributors" 4 | }, 5 | "name": "angular-bootstrap", 6 | "keywords": [ 7 | "angular", 8 | "angular-ui", 9 | "bootstrap" 10 | ], 11 | "license": "MIT", 12 | "ignore": [], 13 | "description": "Native AngularJS (Angular) directives for Bootstrap.", 14 | "version": "1.3.2", 15 | "main": ["./ui-bootstrap-tpls.js"], 16 | "dependencies": { 17 | "angular": ">=1.4.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/index.js: -------------------------------------------------------------------------------- 1 | require('./ui-bootstrap-tpls'); 2 | module.exports = 'ui.bootstrap'; 3 | -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-ui-bootstrap", 3 | "version": "1.3.2", 4 | "description": "Bootstrap widgets for Angular", 5 | "main": "index.js", 6 | "homepage": "http://angular-ui.github.io/bootstrap/", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/angular-ui/bootstrap.git" 10 | }, 11 | "keywords": [ 12 | "angular", 13 | "bootstrap", 14 | "angular-ui", 15 | "components", 16 | "client-side" 17 | ], 18 | "author": "https://github.com/angular-ui/bootstrap/graphs/contributors", 19 | "peerDependencies": { 20 | "angular": ">= 1.4.0-beta.0 || >= 1.5.0-beta.0" 21 | }, 22 | "license": "MIT" 23 | } 24 | -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/ui-bootstrap-csp.css: -------------------------------------------------------------------------------- 1 | /* Include this file in your html if you are using the CSP mode. */ 2 | 3 | .ng-animate.item:not(.left):not(.right) { 4 | -webkit-transition: 0s ease-in-out left; 5 | transition: 0s ease-in-out left 6 | } 7 | .uib-datepicker .uib-title { 8 | width: 100%; 9 | } 10 | 11 | .uib-day button, .uib-month button, .uib-year button { 12 | min-width: 100%; 13 | } 14 | 15 | .uib-left, .uib-right { 16 | width: 100% 17 | } 18 | 19 | .uib-position-measure { 20 | display: block !important; 21 | visibility: hidden !important; 22 | position: absolute !important; 23 | top: -9999px !important; 24 | left: -9999px !important; 25 | } 26 | 27 | .uib-position-scrollbar-measure { 28 | position: absolute !important; 29 | top: -9999px !important; 30 | width: 50px !important; 31 | height: 50px !important; 32 | overflow: scroll !important; 33 | } 34 | 35 | .uib-position-body-scrollbar-measure { 36 | overflow: scroll !important; 37 | } 38 | .uib-datepicker-popup.dropdown-menu { 39 | display: block; 40 | float: none; 41 | margin: 0; 42 | } 43 | 44 | .uib-button-bar { 45 | padding: 10px 9px 2px; 46 | } 47 | 48 | [uib-tooltip-popup].tooltip.top-left > .tooltip-arrow, 49 | [uib-tooltip-popup].tooltip.top-right > .tooltip-arrow, 50 | [uib-tooltip-popup].tooltip.bottom-left > .tooltip-arrow, 51 | [uib-tooltip-popup].tooltip.bottom-right > .tooltip-arrow, 52 | [uib-tooltip-popup].tooltip.left-top > .tooltip-arrow, 53 | [uib-tooltip-popup].tooltip.left-bottom > .tooltip-arrow, 54 | [uib-tooltip-popup].tooltip.right-top > .tooltip-arrow, 55 | [uib-tooltip-popup].tooltip.right-bottom > .tooltip-arrow, 56 | [uib-tooltip-html-popup].tooltip.top-left > .tooltip-arrow, 57 | [uib-tooltip-html-popup].tooltip.top-right > .tooltip-arrow, 58 | [uib-tooltip-html-popup].tooltip.bottom-left > .tooltip-arrow, 59 | [uib-tooltip-html-popup].tooltip.bottom-right > .tooltip-arrow, 60 | [uib-tooltip-html-popup].tooltip.left-top > .tooltip-arrow, 61 | [uib-tooltip-html-popup].tooltip.left-bottom > .tooltip-arrow, 62 | [uib-tooltip-html-popup].tooltip.right-top > .tooltip-arrow, 63 | [uib-tooltip-html-popup].tooltip.right-bottom > .tooltip-arrow, 64 | [uib-tooltip-template-popup].tooltip.top-left > .tooltip-arrow, 65 | [uib-tooltip-template-popup].tooltip.top-right > .tooltip-arrow, 66 | [uib-tooltip-template-popup].tooltip.bottom-left > .tooltip-arrow, 67 | [uib-tooltip-template-popup].tooltip.bottom-right > .tooltip-arrow, 68 | [uib-tooltip-template-popup].tooltip.left-top > .tooltip-arrow, 69 | [uib-tooltip-template-popup].tooltip.left-bottom > .tooltip-arrow, 70 | [uib-tooltip-template-popup].tooltip.right-top > .tooltip-arrow, 71 | [uib-tooltip-template-popup].tooltip.right-bottom > .tooltip-arrow, 72 | [uib-popover-popup].popover.top-left > .arrow, 73 | [uib-popover-popup].popover.top-right > .arrow, 74 | [uib-popover-popup].popover.bottom-left > .arrow, 75 | [uib-popover-popup].popover.bottom-right > .arrow, 76 | [uib-popover-popup].popover.left-top > .arrow, 77 | [uib-popover-popup].popover.left-bottom > .arrow, 78 | [uib-popover-popup].popover.right-top > .arrow, 79 | [uib-popover-popup].popover.right-bottom > .arrow, 80 | [uib-popover-html-popup].popover.top-left > .arrow, 81 | [uib-popover-html-popup].popover.top-right > .arrow, 82 | [uib-popover-html-popup].popover.bottom-left > .arrow, 83 | [uib-popover-html-popup].popover.bottom-right > .arrow, 84 | [uib-popover-html-popup].popover.left-top > .arrow, 85 | [uib-popover-html-popup].popover.left-bottom > .arrow, 86 | [uib-popover-html-popup].popover.right-top > .arrow, 87 | [uib-popover-html-popup].popover.right-bottom > .arrow, 88 | [uib-popover-template-popup].popover.top-left > .arrow, 89 | [uib-popover-template-popup].popover.top-right > .arrow, 90 | [uib-popover-template-popup].popover.bottom-left > .arrow, 91 | [uib-popover-template-popup].popover.bottom-right > .arrow, 92 | [uib-popover-template-popup].popover.left-top > .arrow, 93 | [uib-popover-template-popup].popover.left-bottom > .arrow, 94 | [uib-popover-template-popup].popover.right-top > .arrow, 95 | [uib-popover-template-popup].popover.right-bottom > .arrow { 96 | top: auto; 97 | bottom: auto; 98 | left: auto; 99 | right: auto; 100 | margin: 0; 101 | } 102 | 103 | [uib-popover-popup].popover, 104 | [uib-popover-html-popup].popover, 105 | [uib-popover-template-popup].popover { 106 | display: block !important; 107 | } 108 | 109 | .uib-time input { 110 | width: 50px; 111 | } 112 | 113 | [uib-typeahead-popup].dropdown-menu { 114 | display: block; 115 | } 116 | -------------------------------------------------------------------------------- /bower_components/angular-bootstrap/ui-bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * angular-ui-bootstrap 3 | * http://angular-ui.github.io/bootstrap/ 4 | 5 | * Version: 1.3.2 - 2016-04-14 6 | * License: MIT 7 | */angular.module("ui.bootstrap",["ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.datepicker","ui.bootstrap.position","ui.bootstrap.datepickerPopup","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"]),angular.module("ui.bootstrap.collapse",[]).directive("uibCollapse",["$animate","$q","$parse","$injector",function(a,b,c,d){var e=d.has("$animateCss")?d.get("$animateCss"):null;return{link:function(d,f,g){function h(){f.hasClass("collapse")&&f.hasClass("in")||b.resolve(l(d)).then(function(){f.removeClass("collapse").addClass("collapsing").attr("aria-expanded",!0).attr("aria-hidden",!1),e?e(f,{addClass:"in",easing:"ease",to:{height:f[0].scrollHeight+"px"}}).start()["finally"](i):a.addClass(f,"in",{to:{height:f[0].scrollHeight+"px"}}).then(i)})}function i(){f.removeClass("collapsing").addClass("collapse").css({height:"auto"}),m(d)}function j(){return f.hasClass("collapse")||f.hasClass("in")?void b.resolve(n(d)).then(function(){f.css({height:f[0].scrollHeight+"px"}).removeClass("collapse").addClass("collapsing").attr("aria-expanded",!1).attr("aria-hidden",!0),e?e(f,{removeClass:"in",to:{height:"0"}}).start()["finally"](k):a.removeClass(f,"in",{to:{height:"0"}}).then(k)}):k()}function k(){f.css({height:"0"}),f.removeClass("collapsing").addClass("collapse"),o(d)}var l=c(g.expanding),m=c(g.expanded),n=c(g.collapsing),o=c(g.collapsed);d.$eval(g.uibCollapse)||f.addClass("in").addClass("collapse").attr("aria-expanded",!0).attr("aria-hidden",!1).css({height:"auto"}),d.$watch(g.uibCollapse,function(a){a?j():h()})}}}]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("uibAccordionConfig",{closeOthers:!0}).controller("UibAccordionController",["$scope","$attrs","uibAccordionConfig",function(a,b,c){this.groups=[],this.closeOthers=function(d){var e=angular.isDefined(b.closeOthers)?a.$eval(b.closeOthers):c.closeOthers;e&&angular.forEach(this.groups,function(a){a!==d&&(a.isOpen=!1)})},this.addGroup=function(a){var b=this;this.groups.push(a),a.$on("$destroy",function(c){b.removeGroup(a)})},this.removeGroup=function(a){var b=this.groups.indexOf(a);-1!==b&&this.groups.splice(b,1)}}]).directive("uibAccordion",function(){return{controller:"UibAccordionController",controllerAs:"accordion",transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/accordion/accordion.html"}}}).directive("uibAccordionGroup",function(){return{require:"^uibAccordion",transclude:!0,replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/accordion/accordion-group.html"},scope:{heading:"@",panelClass:"@?",isOpen:"=?",isDisabled:"=?"},controller:function(){this.setHeading=function(a){this.heading=a}},link:function(a,b,c,d){d.addGroup(a),a.openClass=c.openClass||"panel-open",a.panelClass=c.panelClass||"panel-default",a.$watch("isOpen",function(c){b.toggleClass(a.openClass,!!c),c&&d.closeOthers(a)}),a.toggleOpen=function(b){a.isDisabled||b&&32!==b.which||(a.isOpen=!a.isOpen)};var e="accordiongroup-"+a.$id+"-"+Math.floor(1e4*Math.random());a.headingId=e+"-tab",a.panelId=e+"-panel"}}}).directive("uibAccordionHeading",function(){return{transclude:!0,template:"",replace:!0,require:"^uibAccordionGroup",link:function(a,b,c,d,e){d.setHeading(e(a,angular.noop))}}}).directive("uibAccordionTransclude",function(){return{require:"^uibAccordionGroup",link:function(a,b,c,d){a.$watch(function(){return d[c.uibAccordionTransclude]},function(a){if(a){var c=angular.element(b[0].querySelector("[uib-accordion-header]"));c.html(""),c.append(a)}})}}}),angular.module("ui.bootstrap.alert",[]).controller("UibAlertController",["$scope","$attrs","$interpolate","$timeout",function(a,b,c,d){a.closeable=!!b.close;var e=angular.isDefined(b.dismissOnTimeout)?c(b.dismissOnTimeout)(a.$parent):null;e&&d(function(){a.close()},parseInt(e,10))}]).directive("uibAlert",function(){return{controller:"UibAlertController",controllerAs:"alert",templateUrl:function(a,b){return b.templateUrl||"uib/template/alert/alert.html"},transclude:!0,replace:!0,scope:{type:"@",close:"&"}}}),angular.module("ui.bootstrap.buttons",[]).constant("uibButtonConfig",{activeClass:"active",toggleEvent:"click"}).controller("UibButtonsController",["uibButtonConfig",function(a){this.activeClass=a.activeClass||"active",this.toggleEvent=a.toggleEvent||"click"}]).directive("uibBtnRadio",["$parse",function(a){return{require:["uibBtnRadio","ngModel"],controller:"UibButtonsController",controllerAs:"buttons",link:function(b,c,d,e){var f=e[0],g=e[1],h=a(d.uibUncheckable);c.find("input").css({display:"none"}),g.$render=function(){c.toggleClass(f.activeClass,angular.equals(g.$modelValue,b.$eval(d.uibBtnRadio)))},c.on(f.toggleEvent,function(){if(!d.disabled){var a=c.hasClass(f.activeClass);a&&!angular.isDefined(d.uncheckable)||b.$apply(function(){g.$setViewValue(a?null:b.$eval(d.uibBtnRadio)),g.$render()})}}),d.uibUncheckable&&b.$watch(h,function(a){d.$set("uncheckable",a?"":void 0)})}}}]).directive("uibBtnCheckbox",function(){return{require:["uibBtnCheckbox","ngModel"],controller:"UibButtonsController",controllerAs:"button",link:function(a,b,c,d){function e(){return g(c.btnCheckboxTrue,!0)}function f(){return g(c.btnCheckboxFalse,!1)}function g(b,c){return angular.isDefined(b)?a.$eval(b):c}var h=d[0],i=d[1];b.find("input").css({display:"none"}),i.$render=function(){b.toggleClass(h.activeClass,angular.equals(i.$modelValue,e()))},b.on(h.toggleEvent,function(){c.disabled||a.$apply(function(){i.$setViewValue(b.hasClass(h.activeClass)?f():e()),i.$render()})})}}}),angular.module("ui.bootstrap.carousel",[]).controller("UibCarouselController",["$scope","$element","$interval","$timeout","$animate",function(a,b,c,d,e){function f(){for(;t.length;)t.shift()}function g(a){for(var b=0;b1){q[d].element.data(r,c.direction);var j=p.getCurrentIndex();angular.isNumber(j)&&q[j].element&&q[j].element.data(r,c.direction),a.$currentTransition=!0,e.on("addClass",q[d].element,function(b,c){if("close"===c&&(a.$currentTransition=null,e.off("addClass",b),t.length)){var d=t.pop().slide,g=d.index,i=g>p.getCurrentIndex()?"next":"prev";f(),h(d,g,i)}})}a.active=c.index,s=c.index,g(d),l()}}function i(a){for(var b=0;b0&&(n=c(m,b))}function m(){var b=+a.interval;o&&!isNaN(b)&&b>0&&q.length?a.next():a.pause()}var n,o,p=this,q=p.slides=a.slides=[],r="uib-slideDirection",s=a.active,t=[],u=!1;p.addSlide=function(b,c){q.push({slide:b,element:c}),q.sort(function(a,b){return+a.slide.index-+b.slide.index}),(b.index===a.active||1===q.length&&!angular.isNumber(a.active))&&(a.$currentTransition&&(a.$currentTransition=null),s=b.index,a.active=b.index,g(s),p.select(q[i(b)]),1===q.length&&a.play())},p.getCurrentIndex=function(){for(var a=0;a0&&s===c?c>=q.length?(s=q.length-1,a.active=s,g(s),p.select(q[q.length-1])):(s=c,a.active=s,g(s),p.select(q[c])):s>c&&(s--,a.active=s),0===q.length&&(s=null,a.active=null,f())},p.select=a.select=function(b,c){var d=i(b.slide);void 0===c&&(c=d>p.getCurrentIndex()?"next":"prev"),b.slide.index===s||a.$currentTransition?b&&b.slide.index!==s&&a.$currentTransition&&t.push(q[d]):h(b.slide,d,c)},a.indexOfSlide=function(a){return+a.slide.index},a.isActive=function(b){return a.active===b.slide.index},a.isPrevDisabled=function(){return 0===a.active&&a.noWrap()},a.isNextDisabled=function(){return a.active===q.length-1&&a.noWrap()},a.pause=function(){a.noPause||(o=!1,j())},a.play=function(){o||(o=!0,l())},a.$on("$destroy",function(){u=!0,j()}),a.$watch("noTransition",function(a){e.enabled(b,!a)}),a.$watch("interval",l),a.$watchCollection("slides",k),a.$watch("active",function(a){if(angular.isNumber(a)&&s!==a){for(var b=0;b-1){var g=!1;a=a.split("");for(var h=f;h-1){a=a.split(""),e[f]="("+d.regex+")",a[f]="$";for(var g=f+1,h=f+d.key.length;h>g;g++)e[g]="",a[g]="$";a=a.join(""),c.push({index:f,key:d.key,apply:d[b],matcher:d.regex})}}),{regex:new RegExp("^"+e.join("")+"$"),map:d(c,"index")}}function f(a,b,c){return 1>c?!1:1===b&&c>28?29===c&&(a%4===0&&a%100!==0||a%400===0):3===b||5===b||8===b||10===b?31>c:!0}function g(a){return parseInt(a,10)}function h(a,b){return a&&b?l(a,b):a}function i(a,b){return a&&b?l(a,b,!0):a}function j(a,b){var c=Date.parse("Jan 01, 1970 00:00:00 "+a)/6e4;return isNaN(c)?b:c}function k(a,b){return a=new Date(a.getTime()),a.setMinutes(a.getMinutes()+b),a}function l(a,b,c){c=c?-1:1;var d=j(b,a.getTimezoneOffset());return k(a,c*(d-a.getTimezoneOffset()))}var m,n,o=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;this.init=function(){m=b.id,this.parsers={},this.formatters={},n=[{key:"yyyy",regex:"\\d{4}",apply:function(a){this.year=+a},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"yyyy")}},{key:"yy",regex:"\\d{2}",apply:function(a){a=+a,this.year=69>a?a+2e3:a+1900},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"yy")}},{key:"y",regex:"\\d{1,4}",apply:function(a){this.year=+a},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"y")}},{key:"M!",regex:"0?[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){var b=a.getMonth();return/^[0-9]$/.test(b)?c(a,"MM"):c(a,"M")}},{key:"MMMM",regex:b.DATETIME_FORMATS.MONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.MONTH.indexOf(a)},formatter:function(a){return c(a,"MMMM")}},{key:"MMM",regex:b.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.SHORTMONTH.indexOf(a)},formatter:function(a){return c(a,"MMM")}},{key:"MM",regex:"0[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){return c(a,"MM")}},{key:"M",regex:"[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){return c(a,"M")}},{key:"d!",regex:"[0-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){var b=a.getDate();return/^[1-9]$/.test(b)?c(a,"dd"):c(a,"d")}},{key:"dd",regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){return c(a,"dd")}},{key:"d",regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){return c(a,"d")}},{key:"EEEE",regex:b.DATETIME_FORMATS.DAY.join("|"),formatter:function(a){return c(a,"EEEE")}},{key:"EEE",regex:b.DATETIME_FORMATS.SHORTDAY.join("|"),formatter:function(a){return c(a,"EEE")}},{key:"HH",regex:"(?:0|1)[0-9]|2[0-3]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"HH")}},{key:"hh",regex:"0[0-9]|1[0-2]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"hh")}},{key:"H",regex:"1?[0-9]|2[0-3]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"H")}},{key:"h",regex:"[0-9]|1[0-2]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"h")}},{key:"mm",regex:"[0-5][0-9]",apply:function(a){this.minutes=+a},formatter:function(a){return c(a,"mm")}},{key:"m",regex:"[0-9]|[1-5][0-9]",apply:function(a){this.minutes=+a},formatter:function(a){return c(a,"m")}},{key:"sss",regex:"[0-9][0-9][0-9]",apply:function(a){this.milliseconds=+a},formatter:function(a){return c(a,"sss")}},{key:"ss",regex:"[0-5][0-9]",apply:function(a){this.seconds=+a},formatter:function(a){return c(a,"ss")}},{key:"s",regex:"[0-9]|[1-5][0-9]",apply:function(a){this.seconds=+a},formatter:function(a){return c(a,"s")}},{key:"a",regex:b.DATETIME_FORMATS.AMPMS.join("|"),apply:function(a){12===this.hours&&(this.hours=0),"PM"===a&&(this.hours+=12)},formatter:function(a){return c(a,"a")}},{key:"Z",regex:"[+-]\\d{4}",apply:function(a){var b=a.match(/([+-])(\d{2})(\d{2})/),c=b[1],d=b[2],e=b[3];this.hours+=g(c+d),this.minutes+=g(c+e)},formatter:function(a){return c(a,"Z")}},{key:"ww",regex:"[0-4][0-9]|5[0-3]",formatter:function(a){return c(a,"ww")}},{key:"w",regex:"[0-9]|[1-4][0-9]|5[0-3]",formatter:function(a){return c(a,"w")}},{key:"GGGG",regex:b.DATETIME_FORMATS.ERANAMES.join("|").replace(/\s/g,"\\s"),formatter:function(a){return c(a,"GGGG")}},{key:"GGG",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"GGG")}},{key:"GG",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"GG")}},{key:"G",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"G")}}]},this.init(),this.filter=function(a,c){if(!angular.isDate(a)||isNaN(a)||!c)return"";c=b.DATETIME_FORMATS[c]||c,b.id!==m&&this.init(),this.formatters[c]||(this.formatters[c]=e(c,"formatter"));var d=this.formatters[c],f=d.map,g=c;return f.reduce(function(b,c,d){var e=g.match(new RegExp("(.*)"+c.key));e&&angular.isString(e[1])&&(b+=e[1],g=g.replace(e[1]+c.key,""));var h=d===f.length-1?g:"";return c.apply?b+c.apply.call(null,a)+h:b+h},"")},this.parse=function(c,d,g){if(!angular.isString(c)||!d)return c;d=b.DATETIME_FORMATS[d]||d,d=d.replace(o,"\\$&"),b.id!==m&&this.init(),this.parsers[d]||(this.parsers[d]=e(d,"apply"));var h=this.parsers[d],i=h.regex,j=h.map,k=c.match(i),l=!1;if(k&&k.length){var n,p;angular.isDate(g)&&!isNaN(g.getTime())?n={year:g.getFullYear(),month:g.getMonth(),date:g.getDate(),hours:g.getHours(),minutes:g.getMinutes(),seconds:g.getSeconds(),milliseconds:g.getMilliseconds()}:(g&&a.warn("dateparser:","baseDate is not a valid date"),n={year:1900,month:0,date:1,hours:0,minutes:0,seconds:0,milliseconds:0});for(var q=1,r=k.length;r>q;q++){var s=j[q-1];"Z"===s.matcher&&(l=!0),s.apply&&s.apply.call(n,k[q])}var t=l?Date.prototype.setUTCFullYear:Date.prototype.setFullYear,u=l?Date.prototype.setUTCHours:Date.prototype.setHours;return f(n.year,n.month,n.date)&&(!angular.isDate(g)||isNaN(g.getTime())||l?(p=new Date(0),t.call(p,n.year,n.month,n.date),u.call(p,n.hours||0,n.minutes||0,n.seconds||0,n.milliseconds||0)):(p=new Date(g),t.call(p,n.year,n.month,n.date),u.call(p,n.hours,n.minutes,n.seconds,n.milliseconds))),p}},this.toTimezone=h,this.fromTimezone=i,this.timezoneToOffset=j,this.addDateMinutes=k,this.convertTimezoneToLocal=l}]),angular.module("ui.bootstrap.isClass",[]).directive("uibIsClass",["$animate",function(a){var b=/^\s*([\s\S]+?)\s+on\s+([\s\S]+?)\s*$/,c=/^\s*([\s\S]+?)\s+for\s+([\s\S]+?)\s*$/;return{restrict:"A",compile:function(d,e){function f(a,b,c){i.push(a),j.push({scope:a,element:b}),o.forEach(function(b,c){g(b,a)}),a.$on("$destroy",h)}function g(b,d){var e=b.match(c),f=d.$eval(e[1]),g=e[2],h=k[b];if(!h){var i=function(b){var c=null;j.some(function(a){var d=a.scope.$eval(m);return d===b?(c=a,!0):void 0}),h.lastActivated!==c&&(h.lastActivated&&a.removeClass(h.lastActivated.element,f),c&&a.addClass(c.element,f),h.lastActivated=c)};k[b]=h={lastActivated:null,scope:d,watchFn:i,compareWithExp:g,watcher:d.$watch(g,i)}}h.watchFn(d.$eval(g))}function h(a){var b=a.targetScope,c=i.indexOf(b);if(i.splice(c,1),j.splice(c,1),i.length){var d=i[0];angular.forEach(k,function(a){a.scope===b&&(a.watcher=d.$watch(a.compareWithExp,a.watchFn),a.scope=d)})}else k={}}var i=[],j=[],k={},l=e.uibIsClass.match(b),m=l[2],n=l[1],o=n.split(",");return f}}}]),angular.module("ui.bootstrap.datepicker",["ui.bootstrap.dateparser","ui.bootstrap.isClass"]).value("$datepickerSuppressError",!1).value("$datepickerLiteralWarning",!0).constant("uibDatepickerConfig",{datepickerMode:"day",formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",maxDate:null,maxMode:"year",minDate:null,minMode:"day",ngModelOptions:{},shortcutPropagation:!1,showWeeks:!0,yearColumns:5,yearRows:4}).controller("UibDatepickerController",["$scope","$attrs","$parse","$interpolate","$locale","$log","dateFilter","uibDatepickerConfig","$datepickerLiteralWarning","$datepickerSuppressError","uibDateParser",function(a,b,c,d,e,f,g,h,i,j,k){function l(b){a.datepickerMode=b,a.datepickerOptions.datepickerMode=b}var m=this,n={$setViewValue:angular.noop},o={},p=[];!!b.datepickerOptions;a.datepickerOptions||(a.datepickerOptions={}),this.modes=["day","month","year"],["customClass","dateDisabled","datepickerMode","formatDay","formatDayHeader","formatDayTitle","formatMonth","formatMonthTitle","formatYear","maxDate","maxMode","minDate","minMode","showWeeks","shortcutPropagation","startingDay","yearColumns","yearRows"].forEach(function(b){switch(b){case"customClass":case"dateDisabled":a[b]=a.datepickerOptions[b]||angular.noop;break;case"datepickerMode":a.datepickerMode=angular.isDefined(a.datepickerOptions.datepickerMode)?a.datepickerOptions.datepickerMode:h.datepickerMode;break;case"formatDay":case"formatDayHeader":case"formatDayTitle":case"formatMonth":case"formatMonthTitle":case"formatYear":m[b]=angular.isDefined(a.datepickerOptions[b])?d(a.datepickerOptions[b])(a.$parent):h[b];break;case"showWeeks":case"shortcutPropagation":case"yearColumns":case"yearRows":m[b]=angular.isDefined(a.datepickerOptions[b])?a.datepickerOptions[b]:h[b];break;case"startingDay":angular.isDefined(a.datepickerOptions.startingDay)?m.startingDay=a.datepickerOptions.startingDay:angular.isNumber(h.startingDay)?m.startingDay=h.startingDay:m.startingDay=(e.DATETIME_FORMATS.FIRSTDAYOFWEEK+8)%7;break;case"maxDate":case"minDate":a.$watch("datepickerOptions."+b,function(a){a?angular.isDate(a)?m[b]=k.fromTimezone(new Date(a),o.timezone):(i&&f.warn("Literal date support has been deprecated, please switch to date object usage"),m[b]=new Date(g(a,"medium"))):m[b]=h[b]?k.fromTimezone(new Date(h[b]),o.timezone):null,m.refreshView()});break;case"maxMode":case"minMode":a.datepickerOptions[b]?a.$watch(function(){return a.datepickerOptions[b]},function(c){m[b]=a[b]=angular.isDefined(c)?c:datepickerOptions[b],("minMode"===b&&m.modes.indexOf(a.datepickerOptions.datepickerMode)m.modes.indexOf(m[b]))&&(a.datepickerMode=m[b],a.datepickerOptions.datepickerMode=m[b])}):m[b]=a[b]=h[b]||null}}),a.uniqueId="datepicker-"+a.$id+"-"+Math.floor(1e4*Math.random()),a.disabled=angular.isDefined(b.disabled)||!1,angular.isDefined(b.ngDisabled)&&p.push(a.$parent.$watch(b.ngDisabled,function(b){a.disabled=b,m.refreshView()})),a.isActive=function(b){return 0===m.compare(b.date,m.activeDate)?(a.activeDateId=b.uid,!0):!1},this.init=function(b){n=b,o=b.$options||h.ngModelOptions,a.datepickerOptions.initDate?(m.activeDate=k.fromTimezone(a.datepickerOptions.initDate,o.timezone)||new Date,a.$watch("datepickerOptions.initDate",function(a){a&&(n.$isEmpty(n.$modelValue)||n.$invalid)&&(m.activeDate=k.fromTimezone(a,o.timezone),m.refreshView())})):m.activeDate=new Date,this.activeDate=n.$modelValue?k.fromTimezone(new Date(n.$modelValue),o.timezone):k.fromTimezone(new Date,o.timezone),n.$render=function(){m.render()}},this.render=function(){if(n.$viewValue){var a=new Date(n.$viewValue),b=!isNaN(a);b?this.activeDate=k.fromTimezone(a,o.timezone):j||f.error('Datepicker directive: "ng-model" value must be a Date object')}this.refreshView()},this.refreshView=function(){if(this.element){a.selectedDt=null,this._refreshView(),a.activeDt&&(a.activeDateId=a.activeDt.uid);var b=n.$viewValue?new Date(n.$viewValue):null;b=k.fromTimezone(b,o.timezone),n.$setValidity("dateDisabled",!b||this.element&&!this.isDisabled(b))}},this.createDateObject=function(b,c){var d=n.$viewValue?new Date(n.$viewValue):null;d=k.fromTimezone(d,o.timezone);var e=new Date;e=k.fromTimezone(e,o.timezone);var f=this.compare(b,e),g={date:b,label:k.filter(b,c),selected:d&&0===this.compare(b,d),disabled:this.isDisabled(b),past:0>f,current:0===f,future:f>0,customClass:this.customClass(b)||null};return d&&0===this.compare(b,d)&&(a.selectedDt=g),m.activeDate&&0===this.compare(g.date,m.activeDate)&&(a.activeDt=g),g},this.isDisabled=function(b){return a.disabled||this.minDate&&this.compare(b,this.minDate)<0||this.maxDate&&this.compare(b,this.maxDate)>0||a.dateDisabled&&a.dateDisabled({date:b,mode:a.datepickerMode})},this.customClass=function(b){return a.customClass({date:b,mode:a.datepickerMode})},this.split=function(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c},a.select=function(b){if(a.datepickerMode===m.minMode){var c=n.$viewValue?k.fromTimezone(new Date(n.$viewValue),o.timezone):new Date(0,0,0,0,0,0,0);c.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),c=k.toTimezone(c,o.timezone),n.$setViewValue(c),n.$render()}else m.activeDate=b,l(m.modes[m.modes.indexOf(a.datepickerMode)-1]),a.$emit("uib:datepicker.mode");a.$broadcast("uib:datepicker.focus")},a.move=function(a){var b=m.activeDate.getFullYear()+a*(m.step.years||0),c=m.activeDate.getMonth()+a*(m.step.months||0);m.activeDate.setFullYear(b,c,1),m.refreshView()},a.toggleMode=function(b){b=b||1,a.datepickerMode===m.maxMode&&1===b||a.datepickerMode===m.minMode&&-1===b||(l(m.modes[m.modes.indexOf(a.datepickerMode)+b]),a.$emit("uib:datepicker.mode"))},a.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var q=function(){m.element[0].focus()};a.$on("uib:datepicker.focus",q),a.keydown=function(b){var c=a.keys[b.which];if(c&&!b.shiftKey&&!b.altKey&&!a.disabled)if(b.preventDefault(),m.shortcutPropagation||b.stopPropagation(),"enter"===c||"space"===c){if(m.isDisabled(m.activeDate))return;a.select(m.activeDate)}else!b.ctrlKey||"up"!==c&&"down"!==c?(m.handleKeyDown(c,b),m.refreshView()):a.toggleMode("up"===c?1:-1)},a.$on("$destroy",function(){for(;p.length;)p.shift()()})}]).controller("UibDaypickerController",["$scope","$element","dateFilter",function(a,b,c){function d(a,b){return 1!==b||a%4!==0||a%100===0&&a%400!==0?f[b]:29}function e(a){var b=new Date(a);b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1}var f=[31,28,31,30,31,30,31,31,30,31,30,31];this.step={months:1},this.element=b,this.init=function(b){angular.extend(b,this),a.showWeeks=b.showWeeks,b.refreshView()},this.getDates=function(a,b){for(var c,d=new Array(b),e=new Date(a),f=0;b>f;)c=new Date(e),d[f++]=c,e.setDate(e.getDate()+1);return d},this._refreshView=function(){var b=this.activeDate.getFullYear(),d=this.activeDate.getMonth(),f=new Date(this.activeDate);f.setFullYear(b,d,1);var g=this.startingDay-f.getDay(),h=g>0?7-g:-g,i=new Date(f);h>0&&i.setDate(-h+1);for(var j=this.getDates(i,42),k=0;42>k;k++)j[k]=angular.extend(this.createDateObject(j[k],this.formatDay),{secondary:j[k].getMonth()!==d,uid:a.uniqueId+"-"+k});a.labels=new Array(7);for(var l=0;7>l;l++)a.labels[l]={abbr:c(j[l].date,this.formatDayHeader),full:c(j[l].date,"EEEE")};if(a.title=c(this.activeDate,this.formatDayTitle),a.rows=this.split(j,7),a.showWeeks){a.weekNumbers=[];for(var m=(11-this.startingDay)%7,n=a.rows.length,o=0;n>o;o++)a.weekNumbers.push(e(a.rows[o][m].date))}},this.compare=function(a,b){var c=new Date(a.getFullYear(),a.getMonth(),a.getDate()),d=new Date(b.getFullYear(),b.getMonth(),b.getDate());return c.setFullYear(a.getFullYear()),d.setFullYear(b.getFullYear()),c-d},this.handleKeyDown=function(a,b){var c=this.activeDate.getDate();if("left"===a)c-=1;else if("up"===a)c-=7;else if("right"===a)c+=1;else if("down"===a)c+=7;else if("pageup"===a||"pagedown"===a){var e=this.activeDate.getMonth()+("pageup"===a?-1:1);this.activeDate.setMonth(e,1),c=Math.min(d(this.activeDate.getFullYear(),this.activeDate.getMonth()),c)}else"home"===a?c=1:"end"===a&&(c=d(this.activeDate.getFullYear(),this.activeDate.getMonth()));this.activeDate.setDate(c)}}]).controller("UibMonthpickerController",["$scope","$element","dateFilter",function(a,b,c){this.step={years:1},this.element=b,this.init=function(a){angular.extend(a,this),a.refreshView()},this._refreshView=function(){for(var b,d=new Array(12),e=this.activeDate.getFullYear(),f=0;12>f;f++)b=new Date(this.activeDate),b.setFullYear(e,f,1),d[f]=angular.extend(this.createDateObject(b,this.formatMonth),{uid:a.uniqueId+"-"+f});a.title=c(this.activeDate,this.formatMonthTitle),a.rows=this.split(d,3)},this.compare=function(a,b){var c=new Date(a.getFullYear(),a.getMonth()),d=new Date(b.getFullYear(),b.getMonth());return c.setFullYear(a.getFullYear()),d.setFullYear(b.getFullYear()),c-d},this.handleKeyDown=function(a,b){var c=this.activeDate.getMonth();if("left"===a)c-=1;else if("up"===a)c-=3;else if("right"===a)c+=1;else if("down"===a)c+=3;else if("pageup"===a||"pagedown"===a){var d=this.activeDate.getFullYear()+("pageup"===a?-1:1);this.activeDate.setFullYear(d)}else"home"===a?c=0:"end"===a&&(c=11);this.activeDate.setMonth(c)}}]).controller("UibYearpickerController",["$scope","$element","dateFilter",function(a,b,c){function d(a){return parseInt((a-1)/f,10)*f+1}var e,f;this.element=b,this.yearpickerInit=function(){e=this.yearColumns,f=this.yearRows*e,this.step={years:f}},this._refreshView=function(){for(var b,c=new Array(f),g=0,h=d(this.activeDate.getFullYear());f>g;g++)b=new Date(this.activeDate),b.setFullYear(h+g,0,1),c[g]=angular.extend(this.createDateObject(b,this.formatYear),{uid:a.uniqueId+"-"+g});a.title=[c[0].label,c[f-1].label].join(" - "),a.rows=this.split(c,e),a.columns=e},this.compare=function(a,b){return a.getFullYear()-b.getFullYear()},this.handleKeyDown=function(a,b){var c=this.activeDate.getFullYear();"left"===a?c-=1:"up"===a?c-=e:"right"===a?c+=1:"down"===a?c+=e:"pageup"===a||"pagedown"===a?c+=("pageup"===a?-1:1)*f:"home"===a?c=d(this.activeDate.getFullYear()):"end"===a&&(c=d(this.activeDate.getFullYear())+f-1),this.activeDate.setFullYear(c)}}]).directive("uibDatepicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/datepicker.html"},scope:{datepickerOptions:"=?"},require:["uibDatepicker","^ngModel"],controller:"UibDatepickerController",controllerAs:"datepicker",link:function(a,b,c,d){var e=d[0],f=d[1];e.init(f)}}}).directive("uibDaypicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/day.html"},require:["^uibDatepicker","uibDaypicker"],controller:"UibDaypickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibMonthpicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/month.html"},require:["^uibDatepicker","uibMonthpicker"],controller:"UibMonthpickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibYearpicker",function(){return{replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/year.html"},require:["^uibDatepicker","uibYearpicker"],controller:"UibYearpickerController",link:function(a,b,c,d){var e=d[0];angular.extend(e,d[1]),e.yearpickerInit(),e.refreshView()}}}),angular.module("ui.bootstrap.position",[]).factory("$uibPosition",["$document","$window",function(a,b){var c,d,e={normal:/(auto|scroll)/,hidden:/(auto|scroll|hidden)/},f={auto:/\s?auto?\s?/i,primary:/^(top|bottom|left|right)$/,secondary:/^(top|bottom|left|right|center)$/,vertical:/^(top|bottom)$/},g=/(HTML|BODY)/;return{getRawNode:function(a){return a.nodeName?a:a[0]||a},parseStyle:function(a){return a=parseFloat(a),isFinite(a)?a:0},offsetParent:function(c){function d(a){return"static"===(b.getComputedStyle(a).position||"static")}c=this.getRawNode(c);for(var e=c.offsetParent||a[0].documentElement;e&&e!==a[0].documentElement&&d(e);)e=e.offsetParent;return e||a[0].documentElement},scrollbarWidth:function(e){if(e){if(angular.isUndefined(d)){var f=a.find("body");f.addClass("uib-position-body-scrollbar-measure"),d=b.innerWidth-f[0].clientWidth,d=isFinite(d)?d:0,f.removeClass("uib-position-body-scrollbar-measure")}return d}if(angular.isUndefined(c)){var g=angular.element('
');a.find("body").append(g),c=g[0].offsetWidth-g[0].clientWidth,c=isFinite(c)?c:0,g.remove()}return c},scrollbarPadding:function(a){a=this.getRawNode(a);var c=b.getComputedStyle(a),d=this.parseStyle(c.paddingRight),e=this.parseStyle(c.paddingBottom),f=this.scrollParent(a,!1,!0),h=this.scrollbarWidth(f,g.test(f.tagName));return{scrollbarWidth:h,widthOverflow:f.scrollWidth>f.clientWidth,right:d+h,originalRight:d,heightOverflow:f.scrollHeight>f.clientHeight,bottom:e+h,originalBottom:e}},isScrollable:function(a,c){a=this.getRawNode(a);var d=c?e.hidden:e.normal,f=b.getComputedStyle(a);return d.test(f.overflow+f.overflowY+f.overflowX)},scrollParent:function(c,d,f){c=this.getRawNode(c);var g=d?e.hidden:e.normal,h=a[0].documentElement,i=b.getComputedStyle(c);if(f&&g.test(i.overflow+i.overflowY+i.overflowX))return c;var j="absolute"===i.position,k=c.parentElement||h;if(k===h||"fixed"===i.position)return h;for(;k.parentElement&&k!==h;){var l=b.getComputedStyle(k);if(j&&"static"!==l.position&&(j=!1),!j&&g.test(l.overflow+l.overflowY+l.overflowX))break;k=k.parentElement}return k},position:function(c,d){c=this.getRawNode(c);var e=this.offset(c);if(d){var f=b.getComputedStyle(c);e.top-=this.parseStyle(f.marginTop),e.left-=this.parseStyle(f.marginLeft)}var g=this.offsetParent(c),h={top:0,left:0};return g!==a[0].documentElement&&(h=this.offset(g),h.top+=g.clientTop-g.scrollTop,h.left+=g.clientLeft-g.scrollLeft),{width:Math.round(angular.isNumber(e.width)?e.width:c.offsetWidth),height:Math.round(angular.isNumber(e.height)?e.height:c.offsetHeight),top:Math.round(e.top-h.top),left:Math.round(e.left-h.left)}},offset:function(c){c=this.getRawNode(c);var d=c.getBoundingClientRect();return{width:Math.round(angular.isNumber(d.width)?d.width:c.offsetWidth),height:Math.round(angular.isNumber(d.height)?d.height:c.offsetHeight), 8 | top:Math.round(d.top+(b.pageYOffset||a[0].documentElement.scrollTop)),left:Math.round(d.left+(b.pageXOffset||a[0].documentElement.scrollLeft))}},viewportOffset:function(c,d,e){c=this.getRawNode(c),e=e!==!1;var f=c.getBoundingClientRect(),g={top:0,left:0,bottom:0,right:0},h=d?a[0].documentElement:this.scrollParent(c),i=h.getBoundingClientRect();if(g.top=i.top+h.clientTop,g.left=i.left+h.clientLeft,h===a[0].documentElement&&(g.top+=b.pageYOffset,g.left+=b.pageXOffset),g.bottom=g.top+h.clientHeight,g.right=g.left+h.clientWidth,e){var j=b.getComputedStyle(h);g.top+=this.parseStyle(j.paddingTop),g.bottom-=this.parseStyle(j.paddingBottom),g.left+=this.parseStyle(j.paddingLeft),g.right-=this.parseStyle(j.paddingRight)}return{top:Math.round(f.top-g.top),bottom:Math.round(g.bottom-f.bottom),left:Math.round(f.left-g.left),right:Math.round(g.right-f.right)}},parsePlacement:function(a){var b=f.auto.test(a);return b&&(a=a.replace(f.auto,"")),a=a.split("-"),a[0]=a[0]||"top",f.primary.test(a[0])||(a[0]="top"),a[1]=a[1]||"center",f.secondary.test(a[1])||(a[1]="center"),b?a[2]=!0:a[2]=!1,a},positionElements:function(a,c,d,e){a=this.getRawNode(a),c=this.getRawNode(c);var g=angular.isDefined(c.offsetWidth)?c.offsetWidth:c.prop("offsetWidth"),h=angular.isDefined(c.offsetHeight)?c.offsetHeight:c.prop("offsetHeight");d=this.parsePlacement(d);var i=e?this.offset(a):this.position(a),j={top:0,left:0,placement:""};if(d[2]){var k=this.viewportOffset(a,e),l=b.getComputedStyle(c),m={width:g+Math.round(Math.abs(this.parseStyle(l.marginLeft)+this.parseStyle(l.marginRight))),height:h+Math.round(Math.abs(this.parseStyle(l.marginTop)+this.parseStyle(l.marginBottom)))};if(d[0]="top"===d[0]&&m.height>k.top&&m.height<=k.bottom?"bottom":"bottom"===d[0]&&m.height>k.bottom&&m.height<=k.top?"top":"left"===d[0]&&m.width>k.left&&m.width<=k.right?"right":"right"===d[0]&&m.width>k.right&&m.width<=k.left?"left":d[0],d[1]="top"===d[1]&&m.height-i.height>k.bottom&&m.height-i.height<=k.top?"bottom":"bottom"===d[1]&&m.height-i.height>k.top&&m.height-i.height<=k.bottom?"top":"left"===d[1]&&m.width-i.width>k.right&&m.width-i.width<=k.left?"right":"right"===d[1]&&m.width-i.width>k.left&&m.width-i.width<=k.right?"left":d[1],"center"===d[1])if(f.vertical.test(d[0])){var n=i.width/2-g/2;k.left+n<0&&m.width-i.width<=k.right?d[1]="left":k.right+n<0&&m.width-i.width<=k.left&&(d[1]="right")}else{var o=i.height/2-m.height/2;k.top+o<0&&m.height-i.height<=k.bottom?d[1]="top":k.bottom+o<0&&m.height-i.height<=k.top&&(d[1]="bottom")}}switch(d[0]){case"top":j.top=i.top-h;break;case"bottom":j.top=i.top+i.height;break;case"left":j.left=i.left-g;break;case"right":j.left=i.left+i.width}switch(d[1]){case"top":j.top=i.top;break;case"bottom":j.top=i.top+i.height-h;break;case"left":j.left=i.left;break;case"right":j.left=i.left+i.width-g;break;case"center":f.vertical.test(d[0])?j.left=i.left+i.width/2-g/2:j.top=i.top+i.height/2-h/2}return j.top=Math.round(j.top),j.left=Math.round(j.left),j.placement="center"===d[1]?d[0]:d[0]+"-"+d[1],j},positionArrow:function(a,c){a=this.getRawNode(a);var d=a.querySelector(".tooltip-inner, .popover-inner");if(d){var e=angular.element(d).hasClass("tooltip-inner"),g=e?a.querySelector(".tooltip-arrow"):a.querySelector(".arrow");if(g){var h={top:"",bottom:"",left:"",right:""};if(c=this.parsePlacement(c),"center"===c[1])return void angular.element(g).css(h);var i="border-"+c[0]+"-width",j=b.getComputedStyle(g)[i],k="border-";k+=f.vertical.test(c[0])?c[0]+"-"+c[1]:c[1]+"-"+c[0],k+="-radius";var l=b.getComputedStyle(e?d:a)[k];switch(c[0]){case"top":h.bottom=e?"0":"-"+j;break;case"bottom":h.top=e?"0":"-"+j;break;case"left":h.right=e?"0":"-"+j;break;case"right":h.left=e?"0":"-"+j}h[c[1]]=l,angular.element(g).css(h)}}}}}]),angular.module("ui.bootstrap.datepickerPopup",["ui.bootstrap.datepicker","ui.bootstrap.position"]).value("$datepickerPopupLiteralWarning",!0).constant("uibDatepickerPopupConfig",{altInputFormats:[],appendToBody:!1,clearText:"Clear",closeOnDateSelection:!0,closeText:"Done",currentText:"Today",datepickerPopup:"yyyy-MM-dd",datepickerPopupTemplateUrl:"uib/template/datepickerPopup/popup.html",datepickerTemplateUrl:"uib/template/datepicker/datepicker.html",html5Types:{date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm:ss.sss",month:"yyyy-MM"},onOpenFocus:!0,showButtonBar:!0,placement:"auto bottom-left"}).controller("UibDatepickerPopupController",["$scope","$element","$attrs","$compile","$log","$parse","$window","$document","$rootScope","$uibPosition","dateFilter","uibDateParser","uibDatepickerPopupConfig","$timeout","uibDatepickerConfig","$datepickerPopupLiteralWarning",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){function q(b){var c=l.parse(b,w,a.date);if(isNaN(c))for(var d=0;d
"),G?(J=G.timezone,a.ngModelOptions=angular.copy(G),a.ngModelOptions.timezone=null,a.ngModelOptions.updateOnDefault===!0&&(a.ngModelOptions.updateOn=a.ngModelOptions.updateOn?a.ngModelOptions.updateOn+" default":"default"),C.attr("ng-model-options","ngModelOptions")):J=null,C.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":A}),D=angular.element(C.children()[0]),D.attr("template-url",B),a.datepickerOptions||(a.datepickerOptions={}),K&&"month"===c.type&&(a.datepickerOptions.datepickerMode="month",a.datepickerOptions.minMode="month"),D.attr("datepicker-options","datepickerOptions"),K?F.$formatters.push(function(b){return a.date=l.fromTimezone(b,J),b}):(F.$$parserName="date",F.$validators.date=s,F.$parsers.unshift(r),F.$formatters.push(function(b){return F.$isEmpty(b)?(a.date=b,b):(a.date=l.fromTimezone(b,J),angular.isNumber(a.date)&&(a.date=new Date(a.date)),l.filter(a.date,w))})),F.$viewChangeListeners.push(function(){a.date=q(F.$viewValue)}),b.on("keydown",u),H=d(C)(a),C.remove(),y?h.find("body").append(H):b.after(H),a.$on("$destroy",function(){for(a.isOpen===!0&&(i.$$phase||a.$apply(function(){a.isOpen=!1})),H.remove(),b.off("keydown",u),h.off("click",t),E&&E.off("scroll",v),angular.element(g).off("resize",v);L.length;)L.shift()()})},a.getText=function(b){return a[b+"Text"]||m[b+"Text"]},a.isDisabled=function(b){"today"===b&&(b=l.fromTimezone(new Date,J));var c={};return angular.forEach(["minDate","maxDate"],function(b){a.datepickerOptions[b]?angular.isDate(a.datepickerOptions[b])?c[b]=l.fromTimezone(new Date(a.datepickerOptions[b]),J):(p&&e.warn("Literal date support has been deprecated, please switch to date object usage"),c[b]=new Date(k(a.datepickerOptions[b],"medium"))):c[b]=null}),a.datepickerOptions&&c.minDate&&a.compare(b,c.minDate)<0||c.maxDate&&a.compare(b,c.maxDate)>0},a.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth(),a.getDate())-new Date(b.getFullYear(),b.getMonth(),b.getDate())},a.dateSelection=function(c){angular.isDefined(c)&&(a.date=c);var d=a.date?l.filter(a.date,w):null;b.val(d),F.$setViewValue(d),x&&(a.isOpen=!1,b[0].focus())},a.keydown=function(c){27===c.which&&(c.stopPropagation(),a.isOpen=!1,b[0].focus())},a.select=function(b,c){if(c.stopPropagation(),"today"===b){var d=new Date;angular.isDate(a.date)?(b=new Date(a.date),b.setFullYear(d.getFullYear(),d.getMonth(),d.getDate())):b=new Date(d.setHours(0,0,0,0))}a.dateSelection(b)},a.close=function(c){c.stopPropagation(),a.isOpen=!1,b[0].focus()},a.disabled=angular.isDefined(c.disabled)||!1,c.ngDisabled&&L.push(a.$parent.$watch(f(c.ngDisabled),function(b){a.disabled=b})),a.$watch("isOpen",function(d){d?a.disabled?a.isOpen=!1:n(function(){v(),z&&a.$broadcast("uib:datepicker.focus"),h.on("click",t);var d=c.popupPlacement?c.popupPlacement:m.placement;y||j.parsePlacement(d)[2]?(E=E||angular.element(j.scrollParent(b)),E&&E.on("scroll",v)):E=null,angular.element(g).on("resize",v)},0,!1):(h.off("click",t),E&&E.off("scroll",v),angular.element(g).off("resize",v))}),a.$on("uib:datepicker.mode",function(){n(v,0,!1)})}]).directive("uibDatepickerPopup",function(){return{require:["ngModel","uibDatepickerPopup"],controller:"UibDatepickerPopupController",scope:{datepickerOptions:"=?",isOpen:"=?",currentText:"@",clearText:"@",closeText:"@"},link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibDatepickerPopupWrap",function(){return{replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepickerPopup/popup.html"}}}),angular.module("ui.bootstrap.debounce",[]).factory("$$debounce",["$timeout",function(a){return function(b,c){var d;return function(){var e=this,f=Array.prototype.slice.call(arguments);d&&a.cancel(d),d=a(function(){b.apply(e,f)},c)}}}]),angular.module("ui.bootstrap.dropdown",["ui.bootstrap.position"]).constant("uibDropdownConfig",{appendToOpenClass:"uib-dropdown-open",openClass:"open"}).service("uibDropdownService",["$document","$rootScope",function(a,b){var c=null;this.open=function(b,f){c||(a.on("click",d),f.on("keydown",e)),c&&c!==b&&(c.isOpen=!1),c=b},this.close=function(b,f){c===b&&(c=null,a.off("click",d),f.off("keydown",e))};var d=function(a){if(c&&!(a&&"disabled"===c.getAutoClose()||a&&3===a.which)){var d=c.getToggleElement();if(!(a&&d&&d[0].contains(a.target))){var e=c.getDropdownElement();a&&"outsideClick"===c.getAutoClose()&&e&&e[0].contains(a.target)||(c.isOpen=!1,b.$$phase||c.$apply())}}},e=function(a){27===a.which?(a.stopPropagation(),c.focusToggleElement(),d()):c.isKeynavEnabled()&&-1!==[38,40].indexOf(a.which)&&c.isOpen&&(a.preventDefault(),a.stopPropagation(),c.focusDropdownEntry(a.which))}}]).controller("UibDropdownController",["$scope","$element","$attrs","$parse","uibDropdownConfig","uibDropdownService","$animate","$uibPosition","$document","$compile","$templateRequest",function(a,b,c,d,e,f,g,h,i,j,k){var l,m,n=this,o=a.$new(),p=e.appendToOpenClass,q=e.openClass,r=angular.noop,s=c.onToggle?d(c.onToggle):angular.noop,t=!1,u=null,v=!1,w=i.find("body");b.addClass("dropdown"),this.init=function(){if(c.isOpen&&(m=d(c.isOpen),r=m.assign,a.$watch(m,function(a){o.isOpen=!!a})),angular.isDefined(c.dropdownAppendTo)){var e=d(c.dropdownAppendTo)(o);e&&(u=angular.element(e))}t=angular.isDefined(c.dropdownAppendToBody),v=angular.isDefined(c.keyboardNav),t&&!u&&(u=w),u&&n.dropdownMenu&&(u.append(n.dropdownMenu),b.on("$destroy",function(){n.dropdownMenu.remove()}))},this.toggle=function(a){return o.isOpen=arguments.length?!!a:!o.isOpen,angular.isFunction(r)&&r(o,o.isOpen),o.isOpen},this.isOpen=function(){return o.isOpen},o.getToggleElement=function(){return n.toggleElement},o.getAutoClose=function(){return c.autoClose||"always"},o.getElement=function(){return b},o.isKeynavEnabled=function(){return v},o.focusDropdownEntry=function(a){var c=n.dropdownMenu?angular.element(n.dropdownMenu).find("a"):b.find("ul").eq(0).find("a");switch(a){case 40:angular.isNumber(n.selectedOption)?n.selectedOption=n.selectedOption===c.length-1?n.selectedOption:n.selectedOption+1:n.selectedOption=0;break;case 38:angular.isNumber(n.selectedOption)?n.selectedOption=0===n.selectedOption?0:n.selectedOption-1:n.selectedOption=c.length-1}c[n.selectedOption].focus()},o.getDropdownElement=function(){return n.dropdownMenu},o.focusToggleElement=function(){n.toggleElement&&n.toggleElement[0].focus()},o.$watch("isOpen",function(c,d){if(u&&n.dropdownMenu){var e,i,m=h.positionElements(b,n.dropdownMenu,"bottom-left",!0);if(e={top:m.top+"px",display:c?"block":"none"},i=n.dropdownMenu.hasClass("dropdown-menu-right"),i?(e.left="auto",e.right=window.innerWidth-(m.left+b.prop("offsetWidth"))+"px"):(e.left=m.left+"px",e.right="auto"),!t){var v=h.offset(u);e.top=m.top-v.top+"px",i?e.right=window.innerWidth-(m.left-v.left+b.prop("offsetWidth"))+"px":e.left=m.left-v.left+"px"}n.dropdownMenu.css(e)}var w=u?u:b,x=w.hasClass(u?p:q);if(x===!c&&g[c?"addClass":"removeClass"](w,u?p:q).then(function(){angular.isDefined(c)&&c!==d&&s(a,{open:!!c})}),c)n.dropdownMenuTemplateUrl&&k(n.dropdownMenuTemplateUrl).then(function(a){l=o.$new(),j(a.trim())(l,function(a){var b=a;n.dropdownMenu.replaceWith(b),n.dropdownMenu=b})}),o.focusToggleElement(),f.open(o,b);else{if(n.dropdownMenuTemplateUrl){l&&l.$destroy();var y=angular.element('');n.dropdownMenu.replaceWith(y),n.dropdownMenu=y}f.close(o,b),n.selectedOption=null}angular.isFunction(r)&&r(a,c)})}]).directive("uibDropdown",function(){return{controller:"UibDropdownController",link:function(a,b,c,d){d.init()}}}).directive("uibDropdownMenu",function(){return{restrict:"A",require:"?^uibDropdown",link:function(a,b,c,d){if(d&&!angular.isDefined(c.dropdownNested)){b.addClass("dropdown-menu");var e=c.templateUrl;e&&(d.dropdownMenuTemplateUrl=e),d.dropdownMenu||(d.dropdownMenu=b)}}}}).directive("uibDropdownToggle",function(){return{require:"?^uibDropdown",link:function(a,b,c,d){if(d){b.addClass("dropdown-toggle"),d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.stackedMap",[]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c-1&&y>a&&(a=y),a}function l(a,b){var c=v.get(a).value,d=c.appendTo;v.remove(a),z=v.top(),z&&(y=parseInt(z.value.modalDomEl.attr("index"),10)),o(c.modalDomEl,c.modalScope,function(){var b=c.openedClass||u;w.remove(b,a);var e=w.hasKey(b);d.toggleClass(b,e),!e&&t&&t.heightOverflow&&t.scrollbarWidth&&(t.originalRight?d.css({paddingRight:t.originalRight+"px"}):d.css({paddingRight:""}),t=null),m(!0)},c.closedDeferred),n(),b&&b.focus?b.focus():d.focus&&d.focus()}function m(a){var b;v.length()>0&&(b=v.top().value,b.modalDomEl.toggleClass(b.windowTopClass||"",a))}function n(){if(r&&-1===k()){var a=s;o(r,s,function(){a=null}),r=void 0,s=void 0}}function o(b,c,d,e){function g(){g.done||(g.done=!0,a.leave(b).then(function(){b.remove(),e&&e.resolve()}),c.$destroy(),d&&d())}var h,i=null,j=function(){return h||(h=f.defer(),i=h.promise),function(){h.resolve()}};return c.$broadcast(x.NOW_CLOSING_EVENT,j),f.when(i).then(g)}function p(a){if(a.isDefaultPrevented())return a;var b=v.top();if(b)switch(a.which){case 27:b.value.keyboard&&(a.preventDefault(),e.$apply(function(){x.dismiss(b.key,"escape key press")}));break;case 9:var c=x.loadFocusElementList(b),d=!1;a.shiftKey?(x.isFocusInFirstItem(a,c)||x.isModalFocused(a,b))&&(d=x.focusLastFocusableElement(c)):x.isFocusInLastItem(a,c)&&(d=x.focusFirstFocusableElement(c)),d&&(a.preventDefault(),a.stopPropagation())}}function q(a,b,c){return!a.value.modalScope.$broadcast("modal.closing",b,c).defaultPrevented}var r,s,t,u="modal-open",v=h.createNew(),w=g.createNew(),x={NOW_CLOSING_EVENT:"modal.stack.now-closing"},y=0,z=null,A="a[href], area[href], input:not([disabled]), button:not([disabled]),select:not([disabled]), textarea:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable=true]";return e.$watch(k,function(a){s&&(s.index=a)}),c.on("keydown",p),e.$on("$destroy",function(){c.off("keydown",p)}),x.open=function(b,f){var g=c[0].activeElement,h=f.openedClass||u;m(!1),z=v.top(),v.add(b,{deferred:f.deferred,renderDeferred:f.renderDeferred,closedDeferred:f.closedDeferred,modalScope:f.scope,backdrop:f.backdrop,keyboard:f.keyboard,openedClass:f.openedClass,windowTopClass:f.windowTopClass,animation:f.animation,appendTo:f.appendTo}),w.put(h,b);var j=f.appendTo,l=k();if(!j.length)throw new Error("appendTo element not found. Make sure that the element passed is in DOM.");l>=0&&!r&&(s=e.$new(!0),s.modalOptions=f,s.index=l,r=angular.element('
'),r.attr("backdrop-class",f.backdropClass),f.animation&&r.attr("modal-animation","true"),d(r)(s),a.enter(r,j),t=i.scrollbarPadding(j),t.heightOverflow&&t.scrollbarWidth&&j.css({paddingRight:t.right+"px"})),y=z?parseInt(z.value.modalDomEl.attr("index"),10)+1:0;var n=angular.element('
');n.attr({"template-url":f.windowTemplateUrl,"window-class":f.windowClass,"window-top-class":f.windowTopClass,size:f.size,index:y,animate:"animate"}).html(f.content),f.animation&&n.attr("modal-animation","true"),j.addClass(h),a.enter(d(n)(f.scope),j),v.top().value.modalDomEl=n,v.top().value.modalOpener=g},x.close=function(a,b){var c=v.get(a);return c&&q(c,b,!0)?(c.value.modalScope.$$uibDestructionScheduled=!0,c.value.deferred.resolve(b),l(a,c.value.modalOpener),!0):!c},x.dismiss=function(a,b){var c=v.get(a);return c&&q(c,b,!1)?(c.value.modalScope.$$uibDestructionScheduled=!0,c.value.deferred.reject(b),l(a,c.value.modalOpener),!0):!c},x.dismissAll=function(a){for(var b=this.getTop();b&&this.dismiss(b.key,a);)b=this.getTop()},x.getTop=function(){return v.top()},x.modalRendered=function(a){var b=v.get(a);b&&b.value.renderDeferred.resolve()},x.focusFirstFocusableElement=function(a){return a.length>0?(a[0].focus(),!0):!1},x.focusLastFocusableElement=function(a){return a.length>0?(a[a.length-1].focus(),!0):!1},x.isModalFocused=function(a,b){if(a&&b){var c=b.value.modalDomEl;if(c&&c.length)return(a.target||a.srcElement)===c[0]}return!1},x.isFocusInFirstItem=function(a,b){return b.length>0?(a.target||a.srcElement)===b[0]:!1},x.isFocusInLastItem=function(a,b){return b.length>0?(a.target||a.srcElement)===b[b.length-1]:!1},x.loadFocusElementList=function(a){if(a){var b=a.value.modalDomEl;if(b&&b.length){var c=b[0].querySelectorAll(A);return c?Array.prototype.filter.call(c,function(a){return j(a)}):c}}},x}]).provider("$uibModal",function(){var a={options:{animation:!0,backdrop:!0,keyboard:!0},$get:["$rootScope","$q","$document","$templateRequest","$controller","$uibResolve","$uibModalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?c.when(a.template):e(angular.isFunction(a.templateUrl)?a.templateUrl():a.templateUrl)}var j={},k=null;return j.getPromiseChain=function(){return k},j.open=function(e){function j(){return r}var l=c.defer(),m=c.defer(),n=c.defer(),o=c.defer(),p={result:l.promise,opened:m.promise,closed:n.promise,rendered:o.promise,close:function(a){return h.close(p,a)},dismiss:function(a){return h.dismiss(p,a)}};if(e=angular.extend({},a.options,e),e.resolve=e.resolve||{},e.appendTo=e.appendTo||d.find("body").eq(0),!e.template&&!e.templateUrl)throw new Error("One of template or templateUrl options is required.");var q,r=c.all([i(e),g.resolve(e.resolve,{},null,null)]);return q=k=c.all([k]).then(j,j).then(function(a){var c=e.scope||b,d=c.$new();d.$close=p.close,d.$dismiss=p.dismiss,d.$on("$destroy",function(){d.$$uibDestructionScheduled||d.$dismiss("$uibUnscheduledDestruction")});var g,i,j={};e.controller&&(j.$scope=d,j.$uibModalInstance=p,angular.forEach(a[1],function(a,b){j[b]=a}),i=f(e.controller,j,!0),e.controllerAs?(g=i.instance,e.bindToController&&(g.$close=d.$close,g.$dismiss=d.$dismiss,angular.extend(g,c)),g=i(),d[e.controllerAs]=g):g=i(),angular.isFunction(g.$onInit)&&g.$onInit()),h.open(p,{scope:d,deferred:l,renderDeferred:o,closedDeferred:n,content:a[0],animation:e.animation,backdrop:e.backdrop,keyboard:e.keyboard,backdropClass:e.backdropClass,windowTopClass:e.windowTopClass,windowClass:e.windowClass,windowTemplateUrl:e.windowTemplateUrl,size:e.size,openedClass:e.openedClass,appendTo:e.appendTo}),m.resolve(!0)},function(a){m.reject(a),l.reject(a)})["finally"](function(){k===q&&(k=null)}),p},j}]};return a}),angular.module("ui.bootstrap.paging",[]).factory("uibPaging",["$parse",function(a){return{create:function(b,c,d){b.setNumPages=d.numPages?a(d.numPages).assign:angular.noop,b.ngModelCtrl={$setViewValue:angular.noop},b._watchers=[],b.init=function(a,e){b.ngModelCtrl=a,b.config=e,a.$render=function(){b.render()},d.itemsPerPage?b._watchers.push(c.$parent.$watch(d.itemsPerPage,function(a){b.itemsPerPage=parseInt(a,10),c.totalPages=b.calculateTotalPages(),b.updatePage()})):b.itemsPerPage=e.itemsPerPage,c.$watch("totalItems",function(a,d){(angular.isDefined(a)||a!==d)&&(c.totalPages=b.calculateTotalPages(),b.updatePage())})},b.calculateTotalPages=function(){var a=b.itemsPerPage<1?1:Math.ceil(c.totalItems/b.itemsPerPage);return Math.max(a||0,1)},b.render=function(){c.page=parseInt(b.ngModelCtrl.$viewValue,10)||1},c.selectPage=function(a,d){d&&d.preventDefault();var e=!c.ngDisabled||!d;e&&c.page!==a&&a>0&&a<=c.totalPages&&(d&&d.target&&d.target.blur(),b.ngModelCtrl.$setViewValue(a),b.ngModelCtrl.$render())},c.getText=function(a){return c[a+"Text"]||b.config[a+"Text"]},c.noPrevious=function(){return 1===c.page},c.noNext=function(){return c.page===c.totalPages},b.updatePage=function(){b.setNumPages(c.$parent,c.totalPages),c.page>c.totalPages?c.selectPage(c.totalPages):b.ngModelCtrl.$render()},c.$on("$destroy",function(){for(;b._watchers.length;)b._watchers.shift()()})}}}]),angular.module("ui.bootstrap.pager",["ui.bootstrap.paging"]).controller("UibPagerController",["$scope","$attrs","uibPaging","uibPagerConfig",function(a,b,c,d){a.align=angular.isDefined(b.align)?a.$parent.$eval(b.align):d.align,c.create(this,a,b)}]).constant("uibPagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:!0}).directive("uibPager",["uibPagerConfig",function(a){return{scope:{totalItems:"=",previousText:"@",nextText:"@",ngDisabled:"="},require:["uibPager","?ngModel"],controller:"UibPagerController",controllerAs:"pager",templateUrl:function(a,b){return b.templateUrl||"uib/template/pager/pager.html"},replace:!0,link:function(b,c,d,e){var f=e[0],g=e[1];g&&f.init(g,a)}}}]),angular.module("ui.bootstrap.pagination",["ui.bootstrap.paging"]).controller("UibPaginationController",["$scope","$attrs","$parse","uibPaging","uibPaginationConfig",function(a,b,c,d,e){function f(a,b,c){return{number:a,text:b,active:c}}function g(a,b){var c=[],d=1,e=b,g=angular.isDefined(i)&&b>i;g&&(j?(d=Math.max(a-Math.floor(i/2),1),e=d+i-1,e>b&&(e=b,d=e-i+1)):(d=(Math.ceil(a/i)-1)*i+1,e=Math.min(d+i-1,b)));for(var h=d;e>=h;h++){var n=f(h,m(h),h===a);c.push(n)}if(g&&i>0&&(!j||k||l)){if(d>1){if(!l||d>3){var o=f(d-1,"...",!1);c.unshift(o)}if(l){if(3===d){var p=f(2,"2",!1);c.unshift(p)}var q=f(1,"1",!1);c.unshift(q)}}if(b>e){if(!l||b-2>e){var r=f(e+1,"...",!1);c.push(r)}if(l){if(e===b-2){var s=f(b-1,b-1,!1);c.push(s)}var t=f(b,b,!1);c.push(t)}}}return c}var h=this,i=angular.isDefined(b.maxSize)?a.$parent.$eval(b.maxSize):e.maxSize,j=angular.isDefined(b.rotate)?a.$parent.$eval(b.rotate):e.rotate,k=angular.isDefined(b.forceEllipses)?a.$parent.$eval(b.forceEllipses):e.forceEllipses,l=angular.isDefined(b.boundaryLinkNumbers)?a.$parent.$eval(b.boundaryLinkNumbers):e.boundaryLinkNumbers,m=angular.isDefined(b.pageLabel)?function(c){return a.$parent.$eval(b.pageLabel,{$page:c})}:angular.identity;a.boundaryLinks=angular.isDefined(b.boundaryLinks)?a.$parent.$eval(b.boundaryLinks):e.boundaryLinks,a.directionLinks=angular.isDefined(b.directionLinks)?a.$parent.$eval(b.directionLinks):e.directionLinks,d.create(this,a,b),b.maxSize&&h._watchers.push(a.$parent.$watch(c(b.maxSize),function(a){i=parseInt(a,10),h.render()}));var n=this.render;this.render=function(){n(),a.page>0&&a.page<=a.totalPages&&(a.pages=g(a.page,a.totalPages))}}]).constant("uibPaginationConfig",{itemsPerPage:10,boundaryLinks:!1,boundaryLinkNumbers:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:!0,forceEllipses:!1}).directive("uibPagination",["$parse","uibPaginationConfig",function(a,b){return{scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@",ngDisabled:"="},require:["uibPagination","?ngModel"],controller:"UibPaginationController",controllerAs:"pagination",templateUrl:function(a,b){return b.templateUrl||"uib/template/pagination/pagination.html"},replace:!0,link:function(a,c,d,e){var f=e[0],g=e[1];g&&f.init(g,b)}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.stackedMap"]).provider("$uibTooltip",function(){function a(a){var b=/[A-Z]/g,c="-";return a.replace(b,function(a,b){return(b?c:"")+a.toLowerCase()})}var b={placement:"top",placementClassPrefix:"",animation:!0,popupDelay:0,popupCloseDelay:0,useContentExp:!1},c={mouseenter:"mouseleave",click:"click",outsideClick:"outsideClick",focus:"blur",none:""},d={};this.options=function(a){angular.extend(d,a)},this.setTriggers=function(a){angular.extend(c,a)},this.$get=["$window","$compile","$timeout","$document","$uibPosition","$interpolate","$rootScope","$parse","$$stackedMap",function(e,f,g,h,i,j,k,l,m){function n(a){if(27===a.which){var b=o.top();b&&(b.value.close(),o.removeTop(),b=null)}}var o=m.createNew();return h.on("keypress",n),k.$on("$destroy",function(){h.off("keypress",n)}),function(e,k,m,n){function p(a){var b=(a||n.trigger||m).split(" "),d=b.map(function(a){return c[a]||a});return{show:b,hide:d}}n=angular.extend({},b,d,n);var q=a(e),r=j.startSymbol(),s=j.endSymbol(),t="
';return{compile:function(a,b){var c=f(t);return function(a,b,d,f){function j(){N.isOpen?q():m()}function m(){M&&!a.$eval(d[k+"Enable"])||(u(),x(),N.popupDelay?G||(G=g(r,N.popupDelay,!1)):r())}function q(){s(),N.popupCloseDelay?H||(H=g(t,N.popupCloseDelay,!1)):t()}function r(){return s(),u(),N.content?(v(),void N.$evalAsync(function(){N.isOpen=!0,y(!0),S()})):angular.noop}function s(){G&&(g.cancel(G),G=null),I&&(g.cancel(I),I=null)}function t(){N&&N.$evalAsync(function(){N&&(N.isOpen=!1,y(!1),N.animation?F||(F=g(w,150,!1)):w())})}function u(){H&&(g.cancel(H),H=null),F&&(g.cancel(F),F=null)}function v(){D||(E=N.$new(),D=c(E,function(a){K?h.find("body").append(a):b.after(a)}),z())}function w(){s(),u(),A(),D&&(D.remove(),D=null),E&&(E.$destroy(),E=null)}function x(){N.title=d[k+"Title"],Q?N.content=Q(a):N.content=d[e],N.popupClass=d[k+"Class"],N.placement=angular.isDefined(d[k+"Placement"])?d[k+"Placement"]:n.placement;var b=i.parsePlacement(N.placement);J=b[1]?b[0]+"-"+b[1]:b[0];var c=parseInt(d[k+"PopupDelay"],10),f=parseInt(d[k+"PopupCloseDelay"],10); 9 | N.popupDelay=isNaN(c)?n.popupDelay:c,N.popupCloseDelay=isNaN(f)?n.popupCloseDelay:f}function y(b){P&&angular.isFunction(P.assign)&&P.assign(a,b)}function z(){R.length=0,Q?(R.push(a.$watch(Q,function(a){N.content=a,!a&&N.isOpen&&t()})),R.push(E.$watch(function(){O||(O=!0,E.$$postDigest(function(){O=!1,N&&N.isOpen&&S()}))}))):R.push(d.$observe(e,function(a){N.content=a,!a&&N.isOpen?t():S()})),R.push(d.$observe(k+"Title",function(a){N.title=a,N.isOpen&&S()})),R.push(d.$observe(k+"Placement",function(a){N.placement=a?a:n.placement,N.isOpen&&S()}))}function A(){R.length&&(angular.forEach(R,function(a){a()}),R.length=0)}function B(a){N&&N.isOpen&&D&&(b[0].contains(a.target)||D[0].contains(a.target)||q())}function C(){var a=d[k+"Trigger"];T(),L=p(a),"none"!==L.show&&L.show.forEach(function(a,c){"outsideClick"===a?(b.on("click",j),h.on("click",B)):a===L.hide[c]?b.on(a,j):a&&(b.on(a,m),b.on(L.hide[c],q)),b.on("keypress",function(a){27===a.which&&q()})})}var D,E,F,G,H,I,J,K=angular.isDefined(n.appendToBody)?n.appendToBody:!1,L=p(void 0),M=angular.isDefined(d[k+"Enable"]),N=a.$new(!0),O=!1,P=angular.isDefined(d[k+"IsOpen"])?l(d[k+"IsOpen"]):!1,Q=n.useContentExp?l(d[e]):!1,R=[],S=function(){D&&D.html()&&(I||(I=g(function(){var a=i.positionElements(b,D,N.placement,K);D.css({top:a.top+"px",left:a.left+"px"}),D.hasClass(a.placement.split("-")[0])||(D.removeClass(J.split("-")[0]),D.addClass(a.placement.split("-")[0])),D.hasClass(n.placementClassPrefix+a.placement)||(D.removeClass(n.placementClassPrefix+J),D.addClass(n.placementClassPrefix+a.placement)),D.hasClass("uib-position-measure")?(i.positionArrow(D,a.placement),D.removeClass("uib-position-measure")):J!==a.placement&&i.positionArrow(D,a.placement),J=a.placement,I=null},0,!1)))};N.origScope=a,N.isOpen=!1,o.add(N,{close:t}),N.contentExp=function(){return N.content},d.$observe("disabled",function(a){a&&s(),a&&N.isOpen&&t()}),P&&a.$watch(P,function(a){N&&!a===N.isOpen&&j()});var T=function(){L.show.forEach(function(a){"outsideClick"===a?b.off("click",j):(b.off(a,m),b.off(a,j))}),L.hide.forEach(function(a){"outsideClick"===a?h.off("click",B):b.off(a,q)})};C();var U=a.$eval(d[k+"Animation"]);N.animation=angular.isDefined(U)?!!U:n.animation;var V,W=k+"AppendToBody";V=W in d&&void 0===d[W]?!0:a.$eval(d[W]),K=angular.isDefined(V)?V:K,a.$on("$destroy",function(){T(),w(),o.remove(N),N=null})}}}}}]}).directive("uibTooltipTemplateTransclude",["$animate","$sce","$compile","$templateRequest",function(a,b,c,d){return{link:function(e,f,g){var h,i,j,k=e.$eval(g.tooltipTemplateTranscludeScope),l=0,m=function(){i&&(i.remove(),i=null),h&&(h.$destroy(),h=null),j&&(a.leave(j).then(function(){i=null}),i=j,j=null)};e.$watch(b.parseAsResourceUrl(g.uibTooltipTemplateTransclude),function(b){var g=++l;b?(d(b,!0).then(function(d){if(g===l){var e=k.$new(),i=d,n=c(i)(e,function(b){m(),a.enter(b,f)});h=e,j=n,h.$emit("$includeContentLoaded",b)}},function(){g===l&&(m(),e.$emit("$includeContentError",b))}),e.$emit("$includeContentRequested",b)):m()}),e.$on("$destroy",m)}}}]).directive("uibTooltipClasses",["$uibPosition",function(a){return{restrict:"A",link:function(b,c,d){if(b.placement){var e=a.parsePlacement(b.placement);c.addClass(e[0])}b.popupClass&&c.addClass(b.popupClass),b.animation()&&c.addClass(d.tooltipAnimationClass)}}}]).directive("uibTooltipPopup",function(){return{replace:!0,scope:{content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-popup.html"}}).directive("uibTooltip",["$uibTooltip",function(a){return a("uibTooltip","tooltip","mouseenter")}]).directive("uibTooltipTemplatePopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/tooltip/tooltip-template-popup.html"}}).directive("uibTooltipTemplate",["$uibTooltip",function(a){return a("uibTooltipTemplate","tooltip","mouseenter",{useContentExp:!0})}]).directive("uibTooltipHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/tooltip/tooltip-html-popup.html"}}).directive("uibTooltipHtml",["$uibTooltip",function(a){return a("uibTooltipHtml","tooltip","mouseenter",{useContentExp:!0})}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("uibPopoverTemplatePopup",function(){return{replace:!0,scope:{uibTitle:"@",contentExp:"&",placement:"@",popupClass:"@",animation:"&",isOpen:"&",originScope:"&"},templateUrl:"uib/template/popover/popover-template.html"}}).directive("uibPopoverTemplate",["$uibTooltip",function(a){return a("uibPopoverTemplate","popover","click",{useContentExp:!0})}]).directive("uibPopoverHtmlPopup",function(){return{replace:!0,scope:{contentExp:"&",uibTitle:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover-html.html"}}).directive("uibPopoverHtml",["$uibTooltip",function(a){return a("uibPopoverHtml","popover","click",{useContentExp:!0})}]).directive("uibPopoverPopup",function(){return{replace:!0,scope:{uibTitle:"@",content:"@",placement:"@",popupClass:"@",animation:"&",isOpen:"&"},templateUrl:"uib/template/popover/popover.html"}}).directive("uibPopover",["$uibTooltip",function(a){return a("uibPopover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("uibProgressConfig",{animate:!0,max:100}).controller("UibProgressController",["$scope","$attrs","uibProgressConfig",function(a,b,c){function d(){return angular.isDefined(a.maxParam)?a.maxParam:c.max}var e=this,f=angular.isDefined(b.animate)?a.$parent.$eval(b.animate):c.animate;this.bars=[],a.max=d(),this.addBar=function(a,b,c){f||b.css({transition:"none"}),this.bars.push(a),a.max=d(),a.title=c&&angular.isDefined(c.title)?c.title:"progressbar",a.$watch("value",function(b){a.recalculatePercentage()}),a.recalculatePercentage=function(){var b=e.bars.reduce(function(a,b){return b.percent=+(100*b.value/b.max).toFixed(2),a+b.percent},0);b>100&&(a.percent-=b-100)},a.$on("$destroy",function(){b=null,e.removeBar(a)})},this.removeBar=function(a){this.bars.splice(this.bars.indexOf(a),1),this.bars.forEach(function(a){a.recalculatePercentage()})},a.$watch("maxParam",function(a){e.bars.forEach(function(a){a.max=d(),a.recalculatePercentage()})})}]).directive("uibProgress",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",require:"uibProgress",scope:{maxParam:"=?max"},templateUrl:"uib/template/progressbar/progress.html"}}).directive("uibBar",function(){return{replace:!0,transclude:!0,require:"^uibProgress",scope:{value:"=",type:"@"},templateUrl:"uib/template/progressbar/bar.html",link:function(a,b,c,d){d.addBar(a,b,c)}}}).directive("uibProgressbar",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",scope:{value:"=",maxParam:"=?max",type:"@"},templateUrl:"uib/template/progressbar/progressbar.html",link:function(a,b,c,d){d.addBar(a,angular.element(b.children()[0]),{title:c.title})}}}),angular.module("ui.bootstrap.rating",[]).constant("uibRatingConfig",{max:5,stateOn:null,stateOff:null,enableReset:!0,titles:["one","two","three","four","five"]}).controller("UibRatingController",["$scope","$attrs","uibRatingConfig",function(a,b,c){var d={$setViewValue:angular.noop},e=this;this.init=function(e){d=e,d.$render=this.render,d.$formatters.push(function(a){return angular.isNumber(a)&&a<<0!==a&&(a=Math.round(a)),a}),this.stateOn=angular.isDefined(b.stateOn)?a.$parent.$eval(b.stateOn):c.stateOn,this.stateOff=angular.isDefined(b.stateOff)?a.$parent.$eval(b.stateOff):c.stateOff,this.enableReset=angular.isDefined(b.enableReset)?a.$parent.$eval(b.enableReset):c.enableReset;var f=angular.isDefined(b.titles)?a.$parent.$eval(b.titles):c.titles;this.titles=angular.isArray(f)&&f.length>0?f:c.titles;var g=angular.isDefined(b.ratingStates)?a.$parent.$eval(b.ratingStates):new Array(angular.isDefined(b.max)?a.$parent.$eval(b.max):c.max);a.range=this.buildTemplateObjects(g)},this.buildTemplateObjects=function(a){for(var b=0,c=a.length;c>b;b++)a[b]=angular.extend({index:b},{stateOn:this.stateOn,stateOff:this.stateOff,title:this.getTitle(b)},a[b]);return a},this.getTitle=function(a){return a>=this.titles.length?a+1:this.titles[a]},a.rate=function(b){if(!a.readonly&&b>=0&&b<=a.range.length){var c=e.enableReset&&d.$viewValue===b?0:b;d.$setViewValue(c),d.$render()}},a.enter=function(b){a.readonly||(a.value=b),a.onHover({value:b})},a.reset=function(){a.value=d.$viewValue,a.onLeave()},a.onKeydown=function(b){/(37|38|39|40)/.test(b.which)&&(b.preventDefault(),b.stopPropagation(),a.rate(a.value+(38===b.which||39===b.which?1:-1)))},this.render=function(){a.value=d.$viewValue,a.title=e.getTitle(a.value-1)}}]).directive("uibRating",function(){return{require:["uibRating","ngModel"],scope:{readonly:"=?readOnly",onHover:"&",onLeave:"&"},controller:"UibRatingController",templateUrl:"uib/template/rating/rating.html",replace:!0,link:function(a,b,c,d){var e=d[0],f=d[1];e.init(f)}}}),angular.module("ui.bootstrap.tabs",[]).controller("UibTabsetController",["$scope",function(a){function b(a){for(var b=0;bb.index?1:a.index0&&13>b:b>=0&&24>b;return c&&""!==a.hours?(a.showMeridian&&(12===b&&(b=0),a.meridian===v[1]&&(b+=12)),b):void 0}function i(){var b=+a.minutes,c=b>=0&&60>b;return c&&""!==a.minutes?b:void 0}function j(){var b=+a.seconds;return b>=0&&60>b?b:void 0}function k(a,b){return null===a?"":angular.isDefined(a)&&a.toString().length<2&&!b?"0"+a:a.toString()}function l(a){m(),u.$setViewValue(new Date(s)),n(a)}function m(){u.$setValidity("time",!0),a.invalidHours=!1,a.invalidMinutes=!1,a.invalidSeconds=!1}function n(b){if(u.$modelValue){var c=s.getHours(),d=s.getMinutes(),e=s.getSeconds();a.showMeridian&&(c=0===c||12===c?12:c%12),a.hours="h"===b?c:k(c,!w),"m"!==b&&(a.minutes=k(d)),a.meridian=s.getHours()<12?v[0]:v[1],"s"!==b&&(a.seconds=k(e)),a.meridian=s.getHours()<12?v[0]:v[1]}else a.hours=null,a.minutes=null,a.seconds=null,a.meridian=v[0]}function o(a){s=q(s,a),l()}function p(a,b){return q(a,60*b)}function q(a,b){var c=new Date(a.getTime()+1e3*b),d=new Date(a);return d.setHours(c.getHours(),c.getMinutes(),c.getSeconds()),d}function r(){return(null===a.hours||""===a.hours)&&(null===a.minutes||""===a.minutes)&&(!a.showSeconds||a.showSeconds&&(null===a.seconds||""===a.seconds))}var s=new Date,t=[],u={$setViewValue:angular.noop},v=angular.isDefined(c.meridians)?a.$parent.$eval(c.meridians):g.meridians||f.DATETIME_FORMATS.AMPMS,w=angular.isDefined(c.padHours)?a.$parent.$eval(c.padHours):!0;a.tabindex=angular.isDefined(c.tabindex)?c.tabindex:0,b.removeAttr("tabindex"),this.init=function(b,d){u=b,u.$render=this.render,u.$formatters.unshift(function(a){return a?new Date(a):null});var e=d.eq(0),f=d.eq(1),h=d.eq(2),i=angular.isDefined(c.mousewheel)?a.$parent.$eval(c.mousewheel):g.mousewheel;i&&this.setupMousewheelEvents(e,f,h);var j=angular.isDefined(c.arrowkeys)?a.$parent.$eval(c.arrowkeys):g.arrowkeys;j&&this.setupArrowkeyEvents(e,f,h),a.readonlyInput=angular.isDefined(c.readonlyInput)?a.$parent.$eval(c.readonlyInput):g.readonlyInput,this.setupInputEvents(e,f,h)};var x=g.hourStep;c.hourStep&&t.push(a.$parent.$watch(d(c.hourStep),function(a){x=+a}));var y=g.minuteStep;c.minuteStep&&t.push(a.$parent.$watch(d(c.minuteStep),function(a){y=+a}));var z;t.push(a.$parent.$watch(d(c.min),function(a){var b=new Date(a);z=isNaN(b)?void 0:b}));var A;t.push(a.$parent.$watch(d(c.max),function(a){var b=new Date(a);A=isNaN(b)?void 0:b}));var B=!1;c.ngDisabled&&t.push(a.$parent.$watch(d(c.ngDisabled),function(a){B=a})),a.noIncrementHours=function(){var a=p(s,60*x);return B||a>A||s>a&&z>a},a.noDecrementHours=function(){var a=p(s,60*-x);return B||z>a||a>s&&a>A},a.noIncrementMinutes=function(){var a=p(s,y);return B||a>A||s>a&&z>a},a.noDecrementMinutes=function(){var a=p(s,-y);return B||z>a||a>s&&a>A},a.noIncrementSeconds=function(){var a=q(s,C);return B||a>A||s>a&&z>a},a.noDecrementSeconds=function(){var a=q(s,-C);return B||z>a||a>s&&a>A},a.noToggleMeridian=function(){return s.getHours()<12?B||p(s,720)>A:B||p(s,-720)0};b.bind("mousewheel wheel",function(b){B||a.$apply(e(b)?a.incrementHours():a.decrementHours()),b.preventDefault()}),c.bind("mousewheel wheel",function(b){B||a.$apply(e(b)?a.incrementMinutes():a.decrementMinutes()),b.preventDefault()}),d.bind("mousewheel wheel",function(b){B||a.$apply(e(b)?a.incrementSeconds():a.decrementSeconds()),b.preventDefault()})},this.setupArrowkeyEvents=function(b,c,d){b.bind("keydown",function(b){B||(38===b.which?(b.preventDefault(),a.incrementHours(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementHours(),a.$apply()))}),c.bind("keydown",function(b){B||(38===b.which?(b.preventDefault(),a.incrementMinutes(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementMinutes(),a.$apply()))}),d.bind("keydown",function(b){B||(38===b.which?(b.preventDefault(),a.incrementSeconds(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementSeconds(),a.$apply()))})},this.setupInputEvents=function(b,c,d){if(a.readonlyInput)return a.updateHours=angular.noop,a.updateMinutes=angular.noop,void(a.updateSeconds=angular.noop);var e=function(b,c,d){u.$setViewValue(null),u.$setValidity("time",!1),angular.isDefined(b)&&(a.invalidHours=b),angular.isDefined(c)&&(a.invalidMinutes=c),angular.isDefined(d)&&(a.invalidSeconds=d)};a.updateHours=function(){var a=h(),b=i();u.$setDirty(),angular.isDefined(a)&&angular.isDefined(b)?(s.setHours(a),s.setMinutes(b),z>s||s>A?e(!0):l("h")):e(!0)},b.bind("blur",function(b){u.$setTouched(),r()?m():null===a.hours||""===a.hours?e(!0):!a.invalidHours&&a.hours<10&&a.$apply(function(){a.hours=k(a.hours,!w)})}),a.updateMinutes=function(){var a=i(),b=h();u.$setDirty(),angular.isDefined(a)&&angular.isDefined(b)?(s.setHours(b),s.setMinutes(a),z>s||s>A?e(void 0,!0):l("m")):e(void 0,!0)},c.bind("blur",function(b){u.$setTouched(),r()?m():null===a.minutes?e(void 0,!0):!a.invalidMinutes&&a.minutes<10&&a.$apply(function(){a.minutes=k(a.minutes)})}),a.updateSeconds=function(){var a=j();u.$setDirty(),angular.isDefined(a)?(s.setSeconds(a),l("s")):e(void 0,void 0,!0)},d.bind("blur",function(b){r()?m():!a.invalidSeconds&&a.seconds<10&&a.$apply(function(){a.seconds=k(a.seconds)})})},this.render=function(){var b=u.$viewValue;isNaN(b)?(u.$setValidity("time",!1),e.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.')):(b&&(s=b),z>s||s>A?(u.$setValidity("time",!1),a.invalidHours=!0,a.invalidMinutes=!0):m(),n())},a.showSpinners=angular.isDefined(c.showSpinners)?a.$parent.$eval(c.showSpinners):g.showSpinners,a.incrementHours=function(){a.noIncrementHours()||o(60*x*60)},a.decrementHours=function(){a.noDecrementHours()||o(60*-x*60)},a.incrementMinutes=function(){a.noIncrementMinutes()||o(60*y)},a.decrementMinutes=function(){a.noDecrementMinutes()||o(60*-y)},a.incrementSeconds=function(){a.noIncrementSeconds()||o(C)},a.decrementSeconds=function(){a.noDecrementSeconds()||o(-C)},a.toggleMeridian=function(){var b=i(),c=h();a.noToggleMeridian()||(angular.isDefined(b)&&angular.isDefined(c)?o(720*(s.getHours()<12?60:-60)):a.meridian=a.meridian===v[0]?v[1]:v[0])},a.blur=function(){u.$setTouched()},a.$on("$destroy",function(){for(;t.length;)t.shift()()})}]).directive("uibTimepicker",["uibTimepickerConfig",function(a){return{require:["uibTimepicker","?^ngModel"],controller:"UibTimepickerController",controllerAs:"timepicker",replace:!0,scope:{},templateUrl:function(b,c){return c.templateUrl||a.templateUrl},link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f,b.find("input"))}}}]),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.debounce","ui.bootstrap.position"]).factory("uibTypeaheadParser",["$parse",function(a){var b=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).controller("UibTypeaheadController",["$scope","$element","$attrs","$compile","$parse","$q","$timeout","$document","$window","$rootScope","$$debounce","$uibPosition","uibTypeaheadParser",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){N.moveInProgress||(N.moveInProgress=!0,N.$digest()),Y()}function o(){N.position=D?l.offset(b):l.position(b),N.position.top+=b.prop("offsetHeight")}var p,q,r=[9,13,27,38,40],s=200,t=a.$eval(c.typeaheadMinLength);t||0===t||(t=1),a.$watch(c.typeaheadMinLength,function(a){t=a||0===a?a:1});var u=a.$eval(c.typeaheadWaitMs)||0,v=a.$eval(c.typeaheadEditable)!==!1;a.$watch(c.typeaheadEditable,function(a){v=a!==!1});var w,x,y=e(c.typeaheadLoading).assign||angular.noop,z=e(c.typeaheadOnSelect),A=angular.isDefined(c.typeaheadSelectOnBlur)?a.$eval(c.typeaheadSelectOnBlur):!1,B=e(c.typeaheadNoResults).assign||angular.noop,C=c.typeaheadInputFormatter?e(c.typeaheadInputFormatter):void 0,D=c.typeaheadAppendToBody?a.$eval(c.typeaheadAppendToBody):!1,E=c.typeaheadAppendTo?a.$eval(c.typeaheadAppendTo):null,F=a.$eval(c.typeaheadFocusFirst)!==!1,G=c.typeaheadSelectOnExact?a.$eval(c.typeaheadSelectOnExact):!1,H=e(c.typeaheadIsOpen).assign||angular.noop,I=a.$eval(c.typeaheadShowHint)||!1,J=e(c.ngModel),K=e(c.ngModel+"($$$p)"),L=function(b,c){return angular.isFunction(J(a))&&q&&q.$options&&q.$options.getterSetter?K(b,{$$$p:c}):J.assign(b,c)},M=m.parse(c.uibTypeahead),N=a.$new(),O=a.$on("$destroy",function(){N.$destroy()});N.$on("$destroy",O);var P="typeahead-"+N.$id+"-"+Math.floor(1e4*Math.random());b.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":P});var Q,R;I&&(Q=angular.element("
"),Q.css("position","relative"),b.after(Q),R=b.clone(),R.attr("placeholder",""),R.attr("tabindex","-1"),R.val(""),R.css({position:"absolute",top:"0px",left:"0px","border-color":"transparent","box-shadow":"none",opacity:1,background:"none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255)",color:"#999"}),b.css({position:"relative","vertical-align":"top","background-color":"transparent"}),Q.append(R),R.after(b));var S=angular.element("
");S.attr({id:P,matches:"matches",active:"activeIdx",select:"select(activeIdx, evt)","move-in-progress":"moveInProgress",query:"query",position:"position","assign-is-open":"assignIsOpen(isOpen)",debounce:"debounceUpdate"}),angular.isDefined(c.typeaheadTemplateUrl)&&S.attr("template-url",c.typeaheadTemplateUrl),angular.isDefined(c.typeaheadPopupTemplateUrl)&&S.attr("popup-template-url",c.typeaheadPopupTemplateUrl);var T=function(){I&&R.val("")},U=function(){N.matches=[],N.activeIdx=-1,b.attr("aria-expanded",!1),T()},V=function(a){return P+"-option-"+a};N.$watch("activeIdx",function(a){0>a?b.removeAttr("aria-activedescendant"):b.attr("aria-activedescendant",V(a))});var W=function(a,b){return N.matches.length>b&&a?a.toUpperCase()===N.matches[b].label.toUpperCase():!1},X=function(c,d){var e={$viewValue:c};y(a,!0),B(a,!1),f.when(M.source(a,e)).then(function(f){var g=c===p.$viewValue;if(g&&w)if(f&&f.length>0){N.activeIdx=F?0:-1,B(a,!1),N.matches.length=0;for(var h=0;h0&&i.slice(0,c.length).toUpperCase()===c.toUpperCase()?R.val(c+i.slice(c.length)):R.val("")}}else U(),B(a,!0);g&&y(a,!1)},function(){U(),y(a,!1),B(a,!0)})};D&&(angular.element(i).on("resize",n),h.find("body").on("scroll",n));var Y=k(function(){N.matches.length&&o(),N.moveInProgress=!1},s);N.moveInProgress=!1,N.query=void 0;var Z,$=function(a){Z=g(function(){X(a)},u)},_=function(){Z&&g.cancel(Z)};U(),N.assignIsOpen=function(b){H(a,b)},N.select=function(d,e){var f,h,i={};x=!0,i[M.itemName]=h=N.matches[d].model,f=M.modelMapper(a,i),L(a,f),p.$setValidity("editable",!0),p.$setValidity("parse",!0),z(a,{$item:h,$model:f,$label:M.viewMapper(a,i),$event:e}),U(),N.$eval(c.typeaheadFocusOnSelect)!==!1&&g(function(){b[0].focus()},0,!1)},b.on("keydown",function(b){if(0!==N.matches.length&&-1!==r.indexOf(b.which)){if(-1===N.activeIdx&&(9===b.which||13===b.which)||9===b.which&&b.shiftKey)return U(),void N.$digest();b.preventDefault();var c;switch(b.which){case 9:case 13:N.$apply(function(){angular.isNumber(N.debounceUpdate)||angular.isObject(N.debounceUpdate)?k(function(){N.select(N.activeIdx,b)},angular.isNumber(N.debounceUpdate)?N.debounceUpdate:N.debounceUpdate["default"]):N.select(N.activeIdx,b)});break;case 27:b.stopPropagation(),U(),a.$digest();break;case 38:N.activeIdx=(N.activeIdx>0?N.activeIdx:N.matches.length)-1,N.$digest(),c=S.find("li")[N.activeIdx],c.parentNode.scrollTop=c.offsetTop;break;case 40:N.activeIdx=(N.activeIdx+1)%N.matches.length,N.$digest(),c=S.find("li")[N.activeIdx],c.parentNode.scrollTop=c.offsetTop}}}),b.bind("focus",function(a){w=!0,0!==t||p.$viewValue||g(function(){X(p.$viewValue,a)},0)}),b.bind("blur",function(a){A&&N.matches.length&&-1!==N.activeIdx&&!x&&(x=!0,N.$apply(function(){angular.isObject(N.debounceUpdate)&&angular.isNumber(N.debounceUpdate.blur)?k(function(){N.select(N.activeIdx,a)},N.debounceUpdate.blur):N.select(N.activeIdx,a)})),!v&&p.$error.editable&&(p.$setViewValue(),p.$setValidity("editable",!0),p.$setValidity("parse",!0),b.val("")),w=!1,x=!1});var aa=function(c){b[0]!==c.target&&3!==c.which&&0!==N.matches.length&&(U(),j.$$phase||a.$digest())};h.on("click",aa),a.$on("$destroy",function(){h.off("click",aa),(D||E)&&ba.remove(),D&&(angular.element(i).off("resize",n),h.find("body").off("scroll",n)),S.remove(),I&&Q.remove()});var ba=d(S)(N);D?h.find("body").append(ba):E?angular.element(E).eq(0).append(ba):b.after(ba),this.init=function(b,c){p=b,q=c,N.debounceUpdate=p.$options&&e(p.$options.debounce)(a),p.$parsers.unshift(function(b){return w=!0,0===t||b&&b.length>=t?u>0?(_(),$(b)):X(b):(y(a,!1),_(),U()),v?b:b?void p.$setValidity("editable",!1):(p.$setValidity("editable",!0),null)}),p.$formatters.push(function(b){var c,d,e={};return v||p.$setValidity("editable",!0),C?(e.$model=b,C(a,e)):(e[M.itemName]=b,c=M.viewMapper(a,e),e[M.itemName]=void 0,d=M.viewMapper(a,e),c!==d?c:b)})}}]).directive("uibTypeahead",function(){return{controller:"UibTypeaheadController",require:["ngModel","^?ngModelOptions","uibTypeahead"],link:function(a,b,c,d){d[2].init(d[0],d[1])}}}).directive("uibTypeaheadPopup",["$$debounce",function(a){return{scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&",assignIsOpen:"&",debounce:"&"},replace:!0,templateUrl:function(a,b){return b.popupTemplateUrl||"uib/template/typeahead/typeahead-popup.html"},link:function(b,c,d){b.templateUrl=d.templateUrl,b.isOpen=function(){var a=b.matches.length>0;return b.assignIsOpen({isOpen:a}),a},b.isActive=function(a){return b.active===a},b.selectActive=function(a){b.active=a},b.selectMatch=function(c,d){var e=b.debounce();angular.isNumber(e)||angular.isObject(e)?a(function(){b.select({activeIdx:c,evt:d})},angular.isNumber(e)?e:e["default"]):b.select({activeIdx:c,evt:d})}}}}]).directive("uibTypeaheadMatch",["$templateRequest","$compile","$parse",function(a,b,c){return{scope:{index:"=",match:"=",query:"="},link:function(d,e,f){var g=c(f.templateUrl)(d.$parent)||"uib/template/typeahead/typeahead-match.html";a(g).then(function(a){var c=angular.element(a.trim());e.replaceWith(c),b(c)(d)})}}}]).filter("uibTypeaheadHighlight",["$sce","$injector","$log",function(a,b,c){function d(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function e(a){return/<.*>/g.test(a)}var f;return f=b.has("$sanitize"),function(b,g){return!f&&e(b)&&c.warn("Unsafe use of typeahead please use ngSanitize"),b=g?(""+b).replace(new RegExp(d(g),"gi"),"$&"):b,f||(b=a.trustAsHtml(b)),b}}]),angular.module("ui.bootstrap.carousel").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibCarouselCss&&angular.element(document).find("head").prepend(''),angular.$$uibCarouselCss=!0}),angular.module("ui.bootstrap.datepicker").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibDatepickerCss&&angular.element(document).find("head").prepend(''),angular.$$uibDatepickerCss=!0}),angular.module("ui.bootstrap.position").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibPositionCss&&angular.element(document).find("head").prepend(''),angular.$$uibPositionCss=!0}),angular.module("ui.bootstrap.datepickerPopup").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibDatepickerpopupCss&&angular.element(document).find("head").prepend(''),angular.$$uibDatepickerpopupCss=!0}),angular.module("ui.bootstrap.tooltip").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibTooltipCss&&angular.element(document).find("head").prepend(''), 10 | angular.$$uibTooltipCss=!0}),angular.module("ui.bootstrap.timepicker").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibTimepickerCss&&angular.element(document).find("head").prepend(''),angular.$$uibTimepickerCss=!0}),angular.module("ui.bootstrap.typeahead").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibTypeaheadCss&&angular.element(document).find("head").prepend(''),angular.$$uibTypeaheadCss=!0}); -------------------------------------------------------------------------------- /bower_components/angular/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "1.5.5", 4 | "license": "MIT", 5 | "main": "./angular.js", 6 | "ignore": [], 7 | "dependencies": {}, 8 | "homepage": "https://github.com/angular/bower-angular", 9 | "_release": "1.5.5", 10 | "_resolution": { 11 | "type": "version", 12 | "tag": "v1.5.5", 13 | "commit": "cd353693d20736baa44fb44f65f8f573ef6e8e18" 14 | }, 15 | "_source": "https://github.com/angular/bower-angular.git", 16 | "_target": "~1.5", 17 | "_originalSource": "angular" 18 | } -------------------------------------------------------------------------------- /bower_components/angular/README.md: -------------------------------------------------------------------------------- 1 | # packaged angular 2 | 3 | This repo is for distribution on `npm` and `bower`. The source for this module is in the 4 | [main AngularJS repo](https://github.com/angular/angular.js). 5 | Please file issues and pull requests against that repo. 6 | 7 | ## Install 8 | 9 | You can install this package either with `npm` or with `bower`. 10 | 11 | ### npm 12 | 13 | ```shell 14 | npm install angular 15 | ``` 16 | 17 | Then add a ` 21 | ``` 22 | 23 | Or `require('angular')` from your code. 24 | 25 | ### bower 26 | 27 | ```shell 28 | bower install angular 29 | ``` 30 | 31 | Then add a ` 35 | ``` 36 | 37 | ## Documentation 38 | 39 | Documentation is available on the 40 | [AngularJS docs site](http://docs.angularjs.org/). 41 | 42 | ## License 43 | 44 | The MIT License 45 | 46 | Copyright (c) 2010-2015 Google, Inc. http://angularjs.org 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a copy 49 | of this software and associated documentation files (the "Software"), to deal 50 | in the Software without restriction, including without limitation the rights 51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 52 | copies of the Software, and to permit persons to whom the Software is 53 | furnished to do so, subject to the following conditions: 54 | 55 | The above copyright notice and this permission notice shall be included in 56 | all copies or substantial portions of the Software. 57 | 58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 64 | THE SOFTWARE. 65 | -------------------------------------------------------------------------------- /bower_components/angular/angular-csp.css: -------------------------------------------------------------------------------- 1 | /* Include this file in your html if you are using the CSP mode. */ 2 | 3 | @charset "UTF-8"; 4 | 5 | [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], 6 | .ng-cloak, .x-ng-cloak, 7 | .ng-hide:not(.ng-hide-animate) { 8 | display: none !important; 9 | } 10 | 11 | ng\:form { 12 | display: block; 13 | } 14 | 15 | .ng-animate-shim { 16 | visibility:hidden; 17 | } 18 | 19 | .ng-anchor { 20 | position:absolute; 21 | } 22 | -------------------------------------------------------------------------------- /bower_components/angular/angular.min.js.gzip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgross/angular-prompt/7d49bbcea4e9979c410fc2c65c9ac33c72ba3714/bower_components/angular/angular.min.js.gzip -------------------------------------------------------------------------------- /bower_components/angular/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "1.5.5", 4 | "license": "MIT", 5 | "main": "./angular.js", 6 | "ignore": [], 7 | "dependencies": { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /bower_components/angular/index.js: -------------------------------------------------------------------------------- 1 | require('./angular'); 2 | module.exports = angular; 3 | -------------------------------------------------------------------------------- /bower_components/angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "1.5.5", 4 | "description": "HTML enhanced for web apps", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/angular/angular.js.git" 12 | }, 13 | "keywords": [ 14 | "angular", 15 | "framework", 16 | "browser", 17 | "client-side" 18 | ], 19 | "author": "Angular Core Team ", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/angular/angular.js/issues" 23 | }, 24 | "homepage": "http://angularjs.org" 25 | } 26 | -------------------------------------------------------------------------------- /bower_components/underscore/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "underscore", 3 | "version": "1.6.0", 4 | "main": "underscore.js", 5 | "keywords": [ 6 | "util", 7 | "functional", 8 | "server", 9 | "client", 10 | "browser" 11 | ], 12 | "ignore": [ 13 | "underscore-min.js", 14 | "docs", 15 | "test", 16 | "*.yml", 17 | "*.map", 18 | "CNAME", 19 | "index.html", 20 | "favicon.ico", 21 | "CONTRIBUTING.md" 22 | ], 23 | "homepage": "https://github.com/jashkenas/underscore", 24 | "_release": "1.6.0", 25 | "_resolution": { 26 | "type": "version", 27 | "tag": "1.6.0", 28 | "commit": "1f4bf626f23a99f7a676f5076dc1b1475554c8f7" 29 | }, 30 | "_source": "git://github.com/jashkenas/underscore.git", 31 | "_target": "~1.6.0", 32 | "_originalSource": "underscore", 33 | "_direct": true 34 | } -------------------------------------------------------------------------------- /bower_components/underscore/.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [**.{js,json,html}] 13 | indent_style = space 14 | indent_size = 2 15 | -------------------------------------------------------------------------------- /bower_components/underscore/.gitignore: -------------------------------------------------------------------------------- 1 | raw 2 | node_modules 3 | -------------------------------------------------------------------------------- /bower_components/underscore/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative 2 | Reporters & Editors 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /bower_components/underscore/README.md: -------------------------------------------------------------------------------- 1 | __ 2 | /\ \ __ 3 | __ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____ 4 | /\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\ 5 | \ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\ 6 | \ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/ 7 | \/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/ 8 | \ \____/ 9 | \/___/ 10 | 11 | Underscore.js is a utility-belt library for JavaScript that provides 12 | support for the usual functional suspects (each, map, reduce, filter...) 13 | without extending any core JavaScript objects. 14 | 15 | For Docs, License, Tests, and pre-packed downloads, see: 16 | http://underscorejs.org 17 | 18 | Underscore is an open-sourced component of DocumentCloud: 19 | https://github.com/documentcloud 20 | 21 | Many thanks to our contributors: 22 | https://github.com/jashkenas/underscore/contributors 23 | -------------------------------------------------------------------------------- /bower_components/underscore/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "underscore", 3 | "version": "1.6.0", 4 | "main": "underscore.js", 5 | "keywords": ["util", "functional", "server", "client", "browser"], 6 | "ignore" : ["underscore-min.js", "docs", "test", "*.yml", "*.map", 7 | "CNAME", "index.html", "favicon.ico", "CONTRIBUTING.md"] 8 | } 9 | -------------------------------------------------------------------------------- /bower_components/underscore/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "underscore", 3 | "description" : "JavaScript's functional programming helper library.", 4 | "keywords" : ["util", "functional", "server", "client", "browser"], 5 | "repo" : "jashkenas/underscore", 6 | "main" : "underscore.js", 7 | "scripts" : ["underscore.js"], 8 | "version" : "1.6.0", 9 | "license" : "MIT" 10 | } 11 | -------------------------------------------------------------------------------- /bower_components/underscore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "underscore", 3 | "description" : "JavaScript's functional programming helper library.", 4 | "homepage" : "http://underscorejs.org", 5 | "keywords" : ["util", "functional", "server", "client", "browser"], 6 | "author" : "Jeremy Ashkenas ", 7 | "repository" : {"type": "git", "url": "git://github.com/jashkenas/underscore.git"}, 8 | "main" : "underscore.js", 9 | "version" : "1.6.0", 10 | "devDependencies": { 11 | "docco": "0.6.x", 12 | "phantomjs": "1.9.0-1", 13 | "uglify-js": "2.4.x" 14 | }, 15 | "scripts": { 16 | "test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true", 17 | "build": "uglifyjs underscore.js -c \"evaluate=false\" --comments \"/ .*/\" -m --source-map underscore-min.map -o underscore-min.js", 18 | "doc": "docco underscore.js" 19 | }, 20 | "licenses": [ 21 | { 22 | "type": "MIT", 23 | "url": "https://raw.github.com/jashkenas/underscore/master/LICENSE" 24 | } 25 | ], 26 | "files" : ["underscore.js", "underscore-min.js", "LICENSE"] 27 | } 28 | -------------------------------------------------------------------------------- /bower_components/underscore/underscore.js: -------------------------------------------------------------------------------- 1 | // Underscore.js 1.6.0 2 | // http://underscorejs.org 3 | // (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 4 | // Underscore may be freely distributed under the MIT license. 5 | 6 | (function() { 7 | 8 | // Baseline setup 9 | // -------------- 10 | 11 | // Establish the root object, `window` in the browser, or `exports` on the server. 12 | var root = this; 13 | 14 | // Save the previous value of the `_` variable. 15 | var previousUnderscore = root._; 16 | 17 | // Establish the object that gets returned to break out of a loop iteration. 18 | var breaker = {}; 19 | 20 | // Save bytes in the minified (but not gzipped) version: 21 | var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; 22 | 23 | // Create quick reference variables for speed access to core prototypes. 24 | var 25 | push = ArrayProto.push, 26 | slice = ArrayProto.slice, 27 | concat = ArrayProto.concat, 28 | toString = ObjProto.toString, 29 | hasOwnProperty = ObjProto.hasOwnProperty; 30 | 31 | // All **ECMAScript 5** native function implementations that we hope to use 32 | // are declared here. 33 | var 34 | nativeForEach = ArrayProto.forEach, 35 | nativeMap = ArrayProto.map, 36 | nativeReduce = ArrayProto.reduce, 37 | nativeReduceRight = ArrayProto.reduceRight, 38 | nativeFilter = ArrayProto.filter, 39 | nativeEvery = ArrayProto.every, 40 | nativeSome = ArrayProto.some, 41 | nativeIndexOf = ArrayProto.indexOf, 42 | nativeLastIndexOf = ArrayProto.lastIndexOf, 43 | nativeIsArray = Array.isArray, 44 | nativeKeys = Object.keys, 45 | nativeBind = FuncProto.bind; 46 | 47 | // Create a safe reference to the Underscore object for use below. 48 | var _ = function(obj) { 49 | if (obj instanceof _) return obj; 50 | if (!(this instanceof _)) return new _(obj); 51 | this._wrapped = obj; 52 | }; 53 | 54 | // Export the Underscore object for **Node.js**, with 55 | // backwards-compatibility for the old `require()` API. If we're in 56 | // the browser, add `_` as a global object via a string identifier, 57 | // for Closure Compiler "advanced" mode. 58 | if (typeof exports !== 'undefined') { 59 | if (typeof module !== 'undefined' && module.exports) { 60 | exports = module.exports = _; 61 | } 62 | exports._ = _; 63 | } else { 64 | root._ = _; 65 | } 66 | 67 | // Current version. 68 | _.VERSION = '1.6.0'; 69 | 70 | // Collection Functions 71 | // -------------------- 72 | 73 | // The cornerstone, an `each` implementation, aka `forEach`. 74 | // Handles objects with the built-in `forEach`, arrays, and raw objects. 75 | // Delegates to **ECMAScript 5**'s native `forEach` if available. 76 | var each = _.each = _.forEach = function(obj, iterator, context) { 77 | if (obj == null) return obj; 78 | if (nativeForEach && obj.forEach === nativeForEach) { 79 | obj.forEach(iterator, context); 80 | } else if (obj.length === +obj.length) { 81 | for (var i = 0, length = obj.length; i < length; i++) { 82 | if (iterator.call(context, obj[i], i, obj) === breaker) return; 83 | } 84 | } else { 85 | var keys = _.keys(obj); 86 | for (var i = 0, length = keys.length; i < length; i++) { 87 | if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return; 88 | } 89 | } 90 | return obj; 91 | }; 92 | 93 | // Return the results of applying the iterator to each element. 94 | // Delegates to **ECMAScript 5**'s native `map` if available. 95 | _.map = _.collect = function(obj, iterator, context) { 96 | var results = []; 97 | if (obj == null) return results; 98 | if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); 99 | each(obj, function(value, index, list) { 100 | results.push(iterator.call(context, value, index, list)); 101 | }); 102 | return results; 103 | }; 104 | 105 | var reduceError = 'Reduce of empty array with no initial value'; 106 | 107 | // **Reduce** builds up a single result from a list of values, aka `inject`, 108 | // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. 109 | _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { 110 | var initial = arguments.length > 2; 111 | if (obj == null) obj = []; 112 | if (nativeReduce && obj.reduce === nativeReduce) { 113 | if (context) iterator = _.bind(iterator, context); 114 | return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); 115 | } 116 | each(obj, function(value, index, list) { 117 | if (!initial) { 118 | memo = value; 119 | initial = true; 120 | } else { 121 | memo = iterator.call(context, memo, value, index, list); 122 | } 123 | }); 124 | if (!initial) throw new TypeError(reduceError); 125 | return memo; 126 | }; 127 | 128 | // The right-associative version of reduce, also known as `foldr`. 129 | // Delegates to **ECMAScript 5**'s native `reduceRight` if available. 130 | _.reduceRight = _.foldr = function(obj, iterator, memo, context) { 131 | var initial = arguments.length > 2; 132 | if (obj == null) obj = []; 133 | if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { 134 | if (context) iterator = _.bind(iterator, context); 135 | return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); 136 | } 137 | var length = obj.length; 138 | if (length !== +length) { 139 | var keys = _.keys(obj); 140 | length = keys.length; 141 | } 142 | each(obj, function(value, index, list) { 143 | index = keys ? keys[--length] : --length; 144 | if (!initial) { 145 | memo = obj[index]; 146 | initial = true; 147 | } else { 148 | memo = iterator.call(context, memo, obj[index], index, list); 149 | } 150 | }); 151 | if (!initial) throw new TypeError(reduceError); 152 | return memo; 153 | }; 154 | 155 | // Return the first value which passes a truth test. Aliased as `detect`. 156 | _.find = _.detect = function(obj, predicate, context) { 157 | var result; 158 | any(obj, function(value, index, list) { 159 | if (predicate.call(context, value, index, list)) { 160 | result = value; 161 | return true; 162 | } 163 | }); 164 | return result; 165 | }; 166 | 167 | // Return all the elements that pass a truth test. 168 | // Delegates to **ECMAScript 5**'s native `filter` if available. 169 | // Aliased as `select`. 170 | _.filter = _.select = function(obj, predicate, context) { 171 | var results = []; 172 | if (obj == null) return results; 173 | if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context); 174 | each(obj, function(value, index, list) { 175 | if (predicate.call(context, value, index, list)) results.push(value); 176 | }); 177 | return results; 178 | }; 179 | 180 | // Return all the elements for which a truth test fails. 181 | _.reject = function(obj, predicate, context) { 182 | return _.filter(obj, function(value, index, list) { 183 | return !predicate.call(context, value, index, list); 184 | }, context); 185 | }; 186 | 187 | // Determine whether all of the elements match a truth test. 188 | // Delegates to **ECMAScript 5**'s native `every` if available. 189 | // Aliased as `all`. 190 | _.every = _.all = function(obj, predicate, context) { 191 | predicate || (predicate = _.identity); 192 | var result = true; 193 | if (obj == null) return result; 194 | if (nativeEvery && obj.every === nativeEvery) return obj.every(predicate, context); 195 | each(obj, function(value, index, list) { 196 | if (!(result = result && predicate.call(context, value, index, list))) return breaker; 197 | }); 198 | return !!result; 199 | }; 200 | 201 | // Determine if at least one element in the object matches a truth test. 202 | // Delegates to **ECMAScript 5**'s native `some` if available. 203 | // Aliased as `any`. 204 | var any = _.some = _.any = function(obj, predicate, context) { 205 | predicate || (predicate = _.identity); 206 | var result = false; 207 | if (obj == null) return result; 208 | if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context); 209 | each(obj, function(value, index, list) { 210 | if (result || (result = predicate.call(context, value, index, list))) return breaker; 211 | }); 212 | return !!result; 213 | }; 214 | 215 | // Determine if the array or object contains a given value (using `===`). 216 | // Aliased as `include`. 217 | _.contains = _.include = function(obj, target) { 218 | if (obj == null) return false; 219 | if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; 220 | return any(obj, function(value) { 221 | return value === target; 222 | }); 223 | }; 224 | 225 | // Invoke a method (with arguments) on every item in a collection. 226 | _.invoke = function(obj, method) { 227 | var args = slice.call(arguments, 2); 228 | var isFunc = _.isFunction(method); 229 | return _.map(obj, function(value) { 230 | return (isFunc ? method : value[method]).apply(value, args); 231 | }); 232 | }; 233 | 234 | // Convenience version of a common use case of `map`: fetching a property. 235 | _.pluck = function(obj, key) { 236 | return _.map(obj, _.property(key)); 237 | }; 238 | 239 | // Convenience version of a common use case of `filter`: selecting only objects 240 | // containing specific `key:value` pairs. 241 | _.where = function(obj, attrs) { 242 | return _.filter(obj, _.matches(attrs)); 243 | }; 244 | 245 | // Convenience version of a common use case of `find`: getting the first object 246 | // containing specific `key:value` pairs. 247 | _.findWhere = function(obj, attrs) { 248 | return _.find(obj, _.matches(attrs)); 249 | }; 250 | 251 | // Return the maximum element or (element-based computation). 252 | // Can't optimize arrays of integers longer than 65,535 elements. 253 | // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797) 254 | _.max = function(obj, iterator, context) { 255 | if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { 256 | return Math.max.apply(Math, obj); 257 | } 258 | var result = -Infinity, lastComputed = -Infinity; 259 | each(obj, function(value, index, list) { 260 | var computed = iterator ? iterator.call(context, value, index, list) : value; 261 | if (computed > lastComputed) { 262 | result = value; 263 | lastComputed = computed; 264 | } 265 | }); 266 | return result; 267 | }; 268 | 269 | // Return the minimum element (or element-based computation). 270 | _.min = function(obj, iterator, context) { 271 | if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { 272 | return Math.min.apply(Math, obj); 273 | } 274 | var result = Infinity, lastComputed = Infinity; 275 | each(obj, function(value, index, list) { 276 | var computed = iterator ? iterator.call(context, value, index, list) : value; 277 | if (computed < lastComputed) { 278 | result = value; 279 | lastComputed = computed; 280 | } 281 | }); 282 | return result; 283 | }; 284 | 285 | // Shuffle an array, using the modern version of the 286 | // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). 287 | _.shuffle = function(obj) { 288 | var rand; 289 | var index = 0; 290 | var shuffled = []; 291 | each(obj, function(value) { 292 | rand = _.random(index++); 293 | shuffled[index - 1] = shuffled[rand]; 294 | shuffled[rand] = value; 295 | }); 296 | return shuffled; 297 | }; 298 | 299 | // Sample **n** random values from a collection. 300 | // If **n** is not specified, returns a single random element. 301 | // The internal `guard` argument allows it to work with `map`. 302 | _.sample = function(obj, n, guard) { 303 | if (n == null || guard) { 304 | if (obj.length !== +obj.length) obj = _.values(obj); 305 | return obj[_.random(obj.length - 1)]; 306 | } 307 | return _.shuffle(obj).slice(0, Math.max(0, n)); 308 | }; 309 | 310 | // An internal function to generate lookup iterators. 311 | var lookupIterator = function(value) { 312 | if (value == null) return _.identity; 313 | if (_.isFunction(value)) return value; 314 | return _.property(value); 315 | }; 316 | 317 | // Sort the object's values by a criterion produced by an iterator. 318 | _.sortBy = function(obj, iterator, context) { 319 | iterator = lookupIterator(iterator); 320 | return _.pluck(_.map(obj, function(value, index, list) { 321 | return { 322 | value: value, 323 | index: index, 324 | criteria: iterator.call(context, value, index, list) 325 | }; 326 | }).sort(function(left, right) { 327 | var a = left.criteria; 328 | var b = right.criteria; 329 | if (a !== b) { 330 | if (a > b || a === void 0) return 1; 331 | if (a < b || b === void 0) return -1; 332 | } 333 | return left.index - right.index; 334 | }), 'value'); 335 | }; 336 | 337 | // An internal function used for aggregate "group by" operations. 338 | var group = function(behavior) { 339 | return function(obj, iterator, context) { 340 | var result = {}; 341 | iterator = lookupIterator(iterator); 342 | each(obj, function(value, index) { 343 | var key = iterator.call(context, value, index, obj); 344 | behavior(result, key, value); 345 | }); 346 | return result; 347 | }; 348 | }; 349 | 350 | // Groups the object's values by a criterion. Pass either a string attribute 351 | // to group by, or a function that returns the criterion. 352 | _.groupBy = group(function(result, key, value) { 353 | _.has(result, key) ? result[key].push(value) : result[key] = [value]; 354 | }); 355 | 356 | // Indexes the object's values by a criterion, similar to `groupBy`, but for 357 | // when you know that your index values will be unique. 358 | _.indexBy = group(function(result, key, value) { 359 | result[key] = value; 360 | }); 361 | 362 | // Counts instances of an object that group by a certain criterion. Pass 363 | // either a string attribute to count by, or a function that returns the 364 | // criterion. 365 | _.countBy = group(function(result, key) { 366 | _.has(result, key) ? result[key]++ : result[key] = 1; 367 | }); 368 | 369 | // Use a comparator function to figure out the smallest index at which 370 | // an object should be inserted so as to maintain order. Uses binary search. 371 | _.sortedIndex = function(array, obj, iterator, context) { 372 | iterator = lookupIterator(iterator); 373 | var value = iterator.call(context, obj); 374 | var low = 0, high = array.length; 375 | while (low < high) { 376 | var mid = (low + high) >>> 1; 377 | iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid; 378 | } 379 | return low; 380 | }; 381 | 382 | // Safely create a real, live array from anything iterable. 383 | _.toArray = function(obj) { 384 | if (!obj) return []; 385 | if (_.isArray(obj)) return slice.call(obj); 386 | if (obj.length === +obj.length) return _.map(obj, _.identity); 387 | return _.values(obj); 388 | }; 389 | 390 | // Return the number of elements in an object. 391 | _.size = function(obj) { 392 | if (obj == null) return 0; 393 | return (obj.length === +obj.length) ? obj.length : _.keys(obj).length; 394 | }; 395 | 396 | // Array Functions 397 | // --------------- 398 | 399 | // Get the first element of an array. Passing **n** will return the first N 400 | // values in the array. Aliased as `head` and `take`. The **guard** check 401 | // allows it to work with `_.map`. 402 | _.first = _.head = _.take = function(array, n, guard) { 403 | if (array == null) return void 0; 404 | if ((n == null) || guard) return array[0]; 405 | if (n < 0) return []; 406 | return slice.call(array, 0, n); 407 | }; 408 | 409 | // Returns everything but the last entry of the array. Especially useful on 410 | // the arguments object. Passing **n** will return all the values in 411 | // the array, excluding the last N. The **guard** check allows it to work with 412 | // `_.map`. 413 | _.initial = function(array, n, guard) { 414 | return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); 415 | }; 416 | 417 | // Get the last element of an array. Passing **n** will return the last N 418 | // values in the array. The **guard** check allows it to work with `_.map`. 419 | _.last = function(array, n, guard) { 420 | if (array == null) return void 0; 421 | if ((n == null) || guard) return array[array.length - 1]; 422 | return slice.call(array, Math.max(array.length - n, 0)); 423 | }; 424 | 425 | // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. 426 | // Especially useful on the arguments object. Passing an **n** will return 427 | // the rest N values in the array. The **guard** 428 | // check allows it to work with `_.map`. 429 | _.rest = _.tail = _.drop = function(array, n, guard) { 430 | return slice.call(array, (n == null) || guard ? 1 : n); 431 | }; 432 | 433 | // Trim out all falsy values from an array. 434 | _.compact = function(array) { 435 | return _.filter(array, _.identity); 436 | }; 437 | 438 | // Internal implementation of a recursive `flatten` function. 439 | var flatten = function(input, shallow, output) { 440 | if (shallow && _.every(input, _.isArray)) { 441 | return concat.apply(output, input); 442 | } 443 | each(input, function(value) { 444 | if (_.isArray(value) || _.isArguments(value)) { 445 | shallow ? push.apply(output, value) : flatten(value, shallow, output); 446 | } else { 447 | output.push(value); 448 | } 449 | }); 450 | return output; 451 | }; 452 | 453 | // Flatten out an array, either recursively (by default), or just one level. 454 | _.flatten = function(array, shallow) { 455 | return flatten(array, shallow, []); 456 | }; 457 | 458 | // Return a version of the array that does not contain the specified value(s). 459 | _.without = function(array) { 460 | return _.difference(array, slice.call(arguments, 1)); 461 | }; 462 | 463 | // Split an array into two arrays: one whose elements all satisfy the given 464 | // predicate, and one whose elements all do not satisfy the predicate. 465 | _.partition = function(array, predicate) { 466 | var pass = [], fail = []; 467 | each(array, function(elem) { 468 | (predicate(elem) ? pass : fail).push(elem); 469 | }); 470 | return [pass, fail]; 471 | }; 472 | 473 | // Produce a duplicate-free version of the array. If the array has already 474 | // been sorted, you have the option of using a faster algorithm. 475 | // Aliased as `unique`. 476 | _.uniq = _.unique = function(array, isSorted, iterator, context) { 477 | if (_.isFunction(isSorted)) { 478 | context = iterator; 479 | iterator = isSorted; 480 | isSorted = false; 481 | } 482 | var initial = iterator ? _.map(array, iterator, context) : array; 483 | var results = []; 484 | var seen = []; 485 | each(initial, function(value, index) { 486 | if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) { 487 | seen.push(value); 488 | results.push(array[index]); 489 | } 490 | }); 491 | return results; 492 | }; 493 | 494 | // Produce an array that contains the union: each distinct element from all of 495 | // the passed-in arrays. 496 | _.union = function() { 497 | return _.uniq(_.flatten(arguments, true)); 498 | }; 499 | 500 | // Produce an array that contains every item shared between all the 501 | // passed-in arrays. 502 | _.intersection = function(array) { 503 | var rest = slice.call(arguments, 1); 504 | return _.filter(_.uniq(array), function(item) { 505 | return _.every(rest, function(other) { 506 | return _.contains(other, item); 507 | }); 508 | }); 509 | }; 510 | 511 | // Take the difference between one array and a number of other arrays. 512 | // Only the elements present in just the first array will remain. 513 | _.difference = function(array) { 514 | var rest = concat.apply(ArrayProto, slice.call(arguments, 1)); 515 | return _.filter(array, function(value){ return !_.contains(rest, value); }); 516 | }; 517 | 518 | // Zip together multiple lists into a single array -- elements that share 519 | // an index go together. 520 | _.zip = function() { 521 | var length = _.max(_.pluck(arguments, 'length').concat(0)); 522 | var results = new Array(length); 523 | for (var i = 0; i < length; i++) { 524 | results[i] = _.pluck(arguments, '' + i); 525 | } 526 | return results; 527 | }; 528 | 529 | // Converts lists into objects. Pass either a single array of `[key, value]` 530 | // pairs, or two parallel arrays of the same length -- one of keys, and one of 531 | // the corresponding values. 532 | _.object = function(list, values) { 533 | if (list == null) return {}; 534 | var result = {}; 535 | for (var i = 0, length = list.length; i < length; i++) { 536 | if (values) { 537 | result[list[i]] = values[i]; 538 | } else { 539 | result[list[i][0]] = list[i][1]; 540 | } 541 | } 542 | return result; 543 | }; 544 | 545 | // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), 546 | // we need this function. Return the position of the first occurrence of an 547 | // item in an array, or -1 if the item is not included in the array. 548 | // Delegates to **ECMAScript 5**'s native `indexOf` if available. 549 | // If the array is large and already in sort order, pass `true` 550 | // for **isSorted** to use binary search. 551 | _.indexOf = function(array, item, isSorted) { 552 | if (array == null) return -1; 553 | var i = 0, length = array.length; 554 | if (isSorted) { 555 | if (typeof isSorted == 'number') { 556 | i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted); 557 | } else { 558 | i = _.sortedIndex(array, item); 559 | return array[i] === item ? i : -1; 560 | } 561 | } 562 | if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted); 563 | for (; i < length; i++) if (array[i] === item) return i; 564 | return -1; 565 | }; 566 | 567 | // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. 568 | _.lastIndexOf = function(array, item, from) { 569 | if (array == null) return -1; 570 | var hasIndex = from != null; 571 | if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) { 572 | return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item); 573 | } 574 | var i = (hasIndex ? from : array.length); 575 | while (i--) if (array[i] === item) return i; 576 | return -1; 577 | }; 578 | 579 | // Generate an integer Array containing an arithmetic progression. A port of 580 | // the native Python `range()` function. See 581 | // [the Python documentation](http://docs.python.org/library/functions.html#range). 582 | _.range = function(start, stop, step) { 583 | if (arguments.length <= 1) { 584 | stop = start || 0; 585 | start = 0; 586 | } 587 | step = arguments[2] || 1; 588 | 589 | var length = Math.max(Math.ceil((stop - start) / step), 0); 590 | var idx = 0; 591 | var range = new Array(length); 592 | 593 | while(idx < length) { 594 | range[idx++] = start; 595 | start += step; 596 | } 597 | 598 | return range; 599 | }; 600 | 601 | // Function (ahem) Functions 602 | // ------------------ 603 | 604 | // Reusable constructor function for prototype setting. 605 | var ctor = function(){}; 606 | 607 | // Create a function bound to a given object (assigning `this`, and arguments, 608 | // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if 609 | // available. 610 | _.bind = function(func, context) { 611 | var args, bound; 612 | if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); 613 | if (!_.isFunction(func)) throw new TypeError; 614 | args = slice.call(arguments, 2); 615 | return bound = function() { 616 | if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); 617 | ctor.prototype = func.prototype; 618 | var self = new ctor; 619 | ctor.prototype = null; 620 | var result = func.apply(self, args.concat(slice.call(arguments))); 621 | if (Object(result) === result) return result; 622 | return self; 623 | }; 624 | }; 625 | 626 | // Partially apply a function by creating a version that has had some of its 627 | // arguments pre-filled, without changing its dynamic `this` context. _ acts 628 | // as a placeholder, allowing any combination of arguments to be pre-filled. 629 | _.partial = function(func) { 630 | var boundArgs = slice.call(arguments, 1); 631 | return function() { 632 | var position = 0; 633 | var args = boundArgs.slice(); 634 | for (var i = 0, length = args.length; i < length; i++) { 635 | if (args[i] === _) args[i] = arguments[position++]; 636 | } 637 | while (position < arguments.length) args.push(arguments[position++]); 638 | return func.apply(this, args); 639 | }; 640 | }; 641 | 642 | // Bind a number of an object's methods to that object. Remaining arguments 643 | // are the method names to be bound. Useful for ensuring that all callbacks 644 | // defined on an object belong to it. 645 | _.bindAll = function(obj) { 646 | var funcs = slice.call(arguments, 1); 647 | if (funcs.length === 0) throw new Error('bindAll must be passed function names'); 648 | each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); 649 | return obj; 650 | }; 651 | 652 | // Memoize an expensive function by storing its results. 653 | _.memoize = function(func, hasher) { 654 | var memo = {}; 655 | hasher || (hasher = _.identity); 656 | return function() { 657 | var key = hasher.apply(this, arguments); 658 | return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); 659 | }; 660 | }; 661 | 662 | // Delays a function for the given number of milliseconds, and then calls 663 | // it with the arguments supplied. 664 | _.delay = function(func, wait) { 665 | var args = slice.call(arguments, 2); 666 | return setTimeout(function(){ return func.apply(null, args); }, wait); 667 | }; 668 | 669 | // Defers a function, scheduling it to run after the current call stack has 670 | // cleared. 671 | _.defer = function(func) { 672 | return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); 673 | }; 674 | 675 | // Returns a function, that, when invoked, will only be triggered at most once 676 | // during a given window of time. Normally, the throttled function will run 677 | // as much as it can, without ever going more than once per `wait` duration; 678 | // but if you'd like to disable the execution on the leading edge, pass 679 | // `{leading: false}`. To disable execution on the trailing edge, ditto. 680 | _.throttle = function(func, wait, options) { 681 | var context, args, result; 682 | var timeout = null; 683 | var previous = 0; 684 | options || (options = {}); 685 | var later = function() { 686 | previous = options.leading === false ? 0 : _.now(); 687 | timeout = null; 688 | result = func.apply(context, args); 689 | context = args = null; 690 | }; 691 | return function() { 692 | var now = _.now(); 693 | if (!previous && options.leading === false) previous = now; 694 | var remaining = wait - (now - previous); 695 | context = this; 696 | args = arguments; 697 | if (remaining <= 0) { 698 | clearTimeout(timeout); 699 | timeout = null; 700 | previous = now; 701 | result = func.apply(context, args); 702 | context = args = null; 703 | } else if (!timeout && options.trailing !== false) { 704 | timeout = setTimeout(later, remaining); 705 | } 706 | return result; 707 | }; 708 | }; 709 | 710 | // Returns a function, that, as long as it continues to be invoked, will not 711 | // be triggered. The function will be called after it stops being called for 712 | // N milliseconds. If `immediate` is passed, trigger the function on the 713 | // leading edge, instead of the trailing. 714 | _.debounce = function(func, wait, immediate) { 715 | var timeout, args, context, timestamp, result; 716 | 717 | var later = function() { 718 | var last = _.now() - timestamp; 719 | if (last < wait) { 720 | timeout = setTimeout(later, wait - last); 721 | } else { 722 | timeout = null; 723 | if (!immediate) { 724 | result = func.apply(context, args); 725 | context = args = null; 726 | } 727 | } 728 | }; 729 | 730 | return function() { 731 | context = this; 732 | args = arguments; 733 | timestamp = _.now(); 734 | var callNow = immediate && !timeout; 735 | if (!timeout) { 736 | timeout = setTimeout(later, wait); 737 | } 738 | if (callNow) { 739 | result = func.apply(context, args); 740 | context = args = null; 741 | } 742 | 743 | return result; 744 | }; 745 | }; 746 | 747 | // Returns a function that will be executed at most one time, no matter how 748 | // often you call it. Useful for lazy initialization. 749 | _.once = function(func) { 750 | var ran = false, memo; 751 | return function() { 752 | if (ran) return memo; 753 | ran = true; 754 | memo = func.apply(this, arguments); 755 | func = null; 756 | return memo; 757 | }; 758 | }; 759 | 760 | // Returns the first function passed as an argument to the second, 761 | // allowing you to adjust arguments, run code before and after, and 762 | // conditionally execute the original function. 763 | _.wrap = function(func, wrapper) { 764 | return _.partial(wrapper, func); 765 | }; 766 | 767 | // Returns a function that is the composition of a list of functions, each 768 | // consuming the return value of the function that follows. 769 | _.compose = function() { 770 | var funcs = arguments; 771 | return function() { 772 | var args = arguments; 773 | for (var i = funcs.length - 1; i >= 0; i--) { 774 | args = [funcs[i].apply(this, args)]; 775 | } 776 | return args[0]; 777 | }; 778 | }; 779 | 780 | // Returns a function that will only be executed after being called N times. 781 | _.after = function(times, func) { 782 | return function() { 783 | if (--times < 1) { 784 | return func.apply(this, arguments); 785 | } 786 | }; 787 | }; 788 | 789 | // Object Functions 790 | // ---------------- 791 | 792 | // Retrieve the names of an object's properties. 793 | // Delegates to **ECMAScript 5**'s native `Object.keys` 794 | _.keys = function(obj) { 795 | if (!_.isObject(obj)) return []; 796 | if (nativeKeys) return nativeKeys(obj); 797 | var keys = []; 798 | for (var key in obj) if (_.has(obj, key)) keys.push(key); 799 | return keys; 800 | }; 801 | 802 | // Retrieve the values of an object's properties. 803 | _.values = function(obj) { 804 | var keys = _.keys(obj); 805 | var length = keys.length; 806 | var values = new Array(length); 807 | for (var i = 0; i < length; i++) { 808 | values[i] = obj[keys[i]]; 809 | } 810 | return values; 811 | }; 812 | 813 | // Convert an object into a list of `[key, value]` pairs. 814 | _.pairs = function(obj) { 815 | var keys = _.keys(obj); 816 | var length = keys.length; 817 | var pairs = new Array(length); 818 | for (var i = 0; i < length; i++) { 819 | pairs[i] = [keys[i], obj[keys[i]]]; 820 | } 821 | return pairs; 822 | }; 823 | 824 | // Invert the keys and values of an object. The values must be serializable. 825 | _.invert = function(obj) { 826 | var result = {}; 827 | var keys = _.keys(obj); 828 | for (var i = 0, length = keys.length; i < length; i++) { 829 | result[obj[keys[i]]] = keys[i]; 830 | } 831 | return result; 832 | }; 833 | 834 | // Return a sorted list of the function names available on the object. 835 | // Aliased as `methods` 836 | _.functions = _.methods = function(obj) { 837 | var names = []; 838 | for (var key in obj) { 839 | if (_.isFunction(obj[key])) names.push(key); 840 | } 841 | return names.sort(); 842 | }; 843 | 844 | // Extend a given object with all the properties in passed-in object(s). 845 | _.extend = function(obj) { 846 | each(slice.call(arguments, 1), function(source) { 847 | if (source) { 848 | for (var prop in source) { 849 | obj[prop] = source[prop]; 850 | } 851 | } 852 | }); 853 | return obj; 854 | }; 855 | 856 | // Return a copy of the object only containing the whitelisted properties. 857 | _.pick = function(obj) { 858 | var copy = {}; 859 | var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); 860 | each(keys, function(key) { 861 | if (key in obj) copy[key] = obj[key]; 862 | }); 863 | return copy; 864 | }; 865 | 866 | // Return a copy of the object without the blacklisted properties. 867 | _.omit = function(obj) { 868 | var copy = {}; 869 | var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); 870 | for (var key in obj) { 871 | if (!_.contains(keys, key)) copy[key] = obj[key]; 872 | } 873 | return copy; 874 | }; 875 | 876 | // Fill in a given object with default properties. 877 | _.defaults = function(obj) { 878 | each(slice.call(arguments, 1), function(source) { 879 | if (source) { 880 | for (var prop in source) { 881 | if (obj[prop] === void 0) obj[prop] = source[prop]; 882 | } 883 | } 884 | }); 885 | return obj; 886 | }; 887 | 888 | // Create a (shallow-cloned) duplicate of an object. 889 | _.clone = function(obj) { 890 | if (!_.isObject(obj)) return obj; 891 | return _.isArray(obj) ? obj.slice() : _.extend({}, obj); 892 | }; 893 | 894 | // Invokes interceptor with the obj, and then returns obj. 895 | // The primary purpose of this method is to "tap into" a method chain, in 896 | // order to perform operations on intermediate results within the chain. 897 | _.tap = function(obj, interceptor) { 898 | interceptor(obj); 899 | return obj; 900 | }; 901 | 902 | // Internal recursive comparison function for `isEqual`. 903 | var eq = function(a, b, aStack, bStack) { 904 | // Identical objects are equal. `0 === -0`, but they aren't identical. 905 | // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). 906 | if (a === b) return a !== 0 || 1 / a == 1 / b; 907 | // A strict comparison is necessary because `null == undefined`. 908 | if (a == null || b == null) return a === b; 909 | // Unwrap any wrapped objects. 910 | if (a instanceof _) a = a._wrapped; 911 | if (b instanceof _) b = b._wrapped; 912 | // Compare `[[Class]]` names. 913 | var className = toString.call(a); 914 | if (className != toString.call(b)) return false; 915 | switch (className) { 916 | // Strings, numbers, dates, and booleans are compared by value. 917 | case '[object String]': 918 | // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is 919 | // equivalent to `new String("5")`. 920 | return a == String(b); 921 | case '[object Number]': 922 | // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for 923 | // other numeric values. 924 | return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); 925 | case '[object Date]': 926 | case '[object Boolean]': 927 | // Coerce dates and booleans to numeric primitive values. Dates are compared by their 928 | // millisecond representations. Note that invalid dates with millisecond representations 929 | // of `NaN` are not equivalent. 930 | return +a == +b; 931 | // RegExps are compared by their source patterns and flags. 932 | case '[object RegExp]': 933 | return a.source == b.source && 934 | a.global == b.global && 935 | a.multiline == b.multiline && 936 | a.ignoreCase == b.ignoreCase; 937 | } 938 | if (typeof a != 'object' || typeof b != 'object') return false; 939 | // Assume equality for cyclic structures. The algorithm for detecting cyclic 940 | // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. 941 | var length = aStack.length; 942 | while (length--) { 943 | // Linear search. Performance is inversely proportional to the number of 944 | // unique nested structures. 945 | if (aStack[length] == a) return bStack[length] == b; 946 | } 947 | // Objects with different constructors are not equivalent, but `Object`s 948 | // from different frames are. 949 | var aCtor = a.constructor, bCtor = b.constructor; 950 | if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) && 951 | _.isFunction(bCtor) && (bCtor instanceof bCtor)) 952 | && ('constructor' in a && 'constructor' in b)) { 953 | return false; 954 | } 955 | // Add the first object to the stack of traversed objects. 956 | aStack.push(a); 957 | bStack.push(b); 958 | var size = 0, result = true; 959 | // Recursively compare objects and arrays. 960 | if (className == '[object Array]') { 961 | // Compare array lengths to determine if a deep comparison is necessary. 962 | size = a.length; 963 | result = size == b.length; 964 | if (result) { 965 | // Deep compare the contents, ignoring non-numeric properties. 966 | while (size--) { 967 | if (!(result = eq(a[size], b[size], aStack, bStack))) break; 968 | } 969 | } 970 | } else { 971 | // Deep compare objects. 972 | for (var key in a) { 973 | if (_.has(a, key)) { 974 | // Count the expected number of properties. 975 | size++; 976 | // Deep compare each member. 977 | if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break; 978 | } 979 | } 980 | // Ensure that both objects contain the same number of properties. 981 | if (result) { 982 | for (key in b) { 983 | if (_.has(b, key) && !(size--)) break; 984 | } 985 | result = !size; 986 | } 987 | } 988 | // Remove the first object from the stack of traversed objects. 989 | aStack.pop(); 990 | bStack.pop(); 991 | return result; 992 | }; 993 | 994 | // Perform a deep comparison to check if two objects are equal. 995 | _.isEqual = function(a, b) { 996 | return eq(a, b, [], []); 997 | }; 998 | 999 | // Is a given array, string, or object empty? 1000 | // An "empty" object has no enumerable own-properties. 1001 | _.isEmpty = function(obj) { 1002 | if (obj == null) return true; 1003 | if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; 1004 | for (var key in obj) if (_.has(obj, key)) return false; 1005 | return true; 1006 | }; 1007 | 1008 | // Is a given value a DOM element? 1009 | _.isElement = function(obj) { 1010 | return !!(obj && obj.nodeType === 1); 1011 | }; 1012 | 1013 | // Is a given value an array? 1014 | // Delegates to ECMA5's native Array.isArray 1015 | _.isArray = nativeIsArray || function(obj) { 1016 | return toString.call(obj) == '[object Array]'; 1017 | }; 1018 | 1019 | // Is a given variable an object? 1020 | _.isObject = function(obj) { 1021 | return obj === Object(obj); 1022 | }; 1023 | 1024 | // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. 1025 | each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) { 1026 | _['is' + name] = function(obj) { 1027 | return toString.call(obj) == '[object ' + name + ']'; 1028 | }; 1029 | }); 1030 | 1031 | // Define a fallback version of the method in browsers (ahem, IE), where 1032 | // there isn't any inspectable "Arguments" type. 1033 | if (!_.isArguments(arguments)) { 1034 | _.isArguments = function(obj) { 1035 | return !!(obj && _.has(obj, 'callee')); 1036 | }; 1037 | } 1038 | 1039 | // Optimize `isFunction` if appropriate. 1040 | if (typeof (/./) !== 'function') { 1041 | _.isFunction = function(obj) { 1042 | return typeof obj === 'function'; 1043 | }; 1044 | } 1045 | 1046 | // Is a given object a finite number? 1047 | _.isFinite = function(obj) { 1048 | return isFinite(obj) && !isNaN(parseFloat(obj)); 1049 | }; 1050 | 1051 | // Is the given value `NaN`? (NaN is the only number which does not equal itself). 1052 | _.isNaN = function(obj) { 1053 | return _.isNumber(obj) && obj != +obj; 1054 | }; 1055 | 1056 | // Is a given value a boolean? 1057 | _.isBoolean = function(obj) { 1058 | return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; 1059 | }; 1060 | 1061 | // Is a given value equal to null? 1062 | _.isNull = function(obj) { 1063 | return obj === null; 1064 | }; 1065 | 1066 | // Is a given variable undefined? 1067 | _.isUndefined = function(obj) { 1068 | return obj === void 0; 1069 | }; 1070 | 1071 | // Shortcut function for checking if an object has a given property directly 1072 | // on itself (in other words, not on a prototype). 1073 | _.has = function(obj, key) { 1074 | return hasOwnProperty.call(obj, key); 1075 | }; 1076 | 1077 | // Utility Functions 1078 | // ----------------- 1079 | 1080 | // Run Underscore.js in *noConflict* mode, returning the `_` variable to its 1081 | // previous owner. Returns a reference to the Underscore object. 1082 | _.noConflict = function() { 1083 | root._ = previousUnderscore; 1084 | return this; 1085 | }; 1086 | 1087 | // Keep the identity function around for default iterators. 1088 | _.identity = function(value) { 1089 | return value; 1090 | }; 1091 | 1092 | _.constant = function(value) { 1093 | return function () { 1094 | return value; 1095 | }; 1096 | }; 1097 | 1098 | _.property = function(key) { 1099 | return function(obj) { 1100 | return obj[key]; 1101 | }; 1102 | }; 1103 | 1104 | // Returns a predicate for checking whether an object has a given set of `key:value` pairs. 1105 | _.matches = function(attrs) { 1106 | return function(obj) { 1107 | if (obj === attrs) return true; //avoid comparing an object to itself. 1108 | for (var key in attrs) { 1109 | if (attrs[key] !== obj[key]) 1110 | return false; 1111 | } 1112 | return true; 1113 | } 1114 | }; 1115 | 1116 | // Run a function **n** times. 1117 | _.times = function(n, iterator, context) { 1118 | var accum = Array(Math.max(0, n)); 1119 | for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i); 1120 | return accum; 1121 | }; 1122 | 1123 | // Return a random integer between min and max (inclusive). 1124 | _.random = function(min, max) { 1125 | if (max == null) { 1126 | max = min; 1127 | min = 0; 1128 | } 1129 | return min + Math.floor(Math.random() * (max - min + 1)); 1130 | }; 1131 | 1132 | // A (possibly faster) way to get the current timestamp as an integer. 1133 | _.now = Date.now || function() { return new Date().getTime(); }; 1134 | 1135 | // List of HTML entities for escaping. 1136 | var entityMap = { 1137 | escape: { 1138 | '&': '&', 1139 | '<': '<', 1140 | '>': '>', 1141 | '"': '"', 1142 | "'": ''' 1143 | } 1144 | }; 1145 | entityMap.unescape = _.invert(entityMap.escape); 1146 | 1147 | // Regexes containing the keys and values listed immediately above. 1148 | var entityRegexes = { 1149 | escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'), 1150 | unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g') 1151 | }; 1152 | 1153 | // Functions for escaping and unescaping strings to/from HTML interpolation. 1154 | _.each(['escape', 'unescape'], function(method) { 1155 | _[method] = function(string) { 1156 | if (string == null) return ''; 1157 | return ('' + string).replace(entityRegexes[method], function(match) { 1158 | return entityMap[method][match]; 1159 | }); 1160 | }; 1161 | }); 1162 | 1163 | // If the value of the named `property` is a function then invoke it with the 1164 | // `object` as context; otherwise, return it. 1165 | _.result = function(object, property) { 1166 | if (object == null) return void 0; 1167 | var value = object[property]; 1168 | return _.isFunction(value) ? value.call(object) : value; 1169 | }; 1170 | 1171 | // Add your own custom functions to the Underscore object. 1172 | _.mixin = function(obj) { 1173 | each(_.functions(obj), function(name) { 1174 | var func = _[name] = obj[name]; 1175 | _.prototype[name] = function() { 1176 | var args = [this._wrapped]; 1177 | push.apply(args, arguments); 1178 | return result.call(this, func.apply(_, args)); 1179 | }; 1180 | }); 1181 | }; 1182 | 1183 | // Generate a unique integer id (unique within the entire client session). 1184 | // Useful for temporary DOM ids. 1185 | var idCounter = 0; 1186 | _.uniqueId = function(prefix) { 1187 | var id = ++idCounter + ''; 1188 | return prefix ? prefix + id : id; 1189 | }; 1190 | 1191 | // By default, Underscore uses ERB-style template delimiters, change the 1192 | // following template settings to use alternative delimiters. 1193 | _.templateSettings = { 1194 | evaluate : /<%([\s\S]+?)%>/g, 1195 | interpolate : /<%=([\s\S]+?)%>/g, 1196 | escape : /<%-([\s\S]+?)%>/g 1197 | }; 1198 | 1199 | // When customizing `templateSettings`, if you don't want to define an 1200 | // interpolation, evaluation or escaping regex, we need one that is 1201 | // guaranteed not to match. 1202 | var noMatch = /(.)^/; 1203 | 1204 | // Certain characters need to be escaped so that they can be put into a 1205 | // string literal. 1206 | var escapes = { 1207 | "'": "'", 1208 | '\\': '\\', 1209 | '\r': 'r', 1210 | '\n': 'n', 1211 | '\t': 't', 1212 | '\u2028': 'u2028', 1213 | '\u2029': 'u2029' 1214 | }; 1215 | 1216 | var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; 1217 | 1218 | // JavaScript micro-templating, similar to John Resig's implementation. 1219 | // Underscore templating handles arbitrary delimiters, preserves whitespace, 1220 | // and correctly escapes quotes within interpolated code. 1221 | _.template = function(text, data, settings) { 1222 | var render; 1223 | settings = _.defaults({}, settings, _.templateSettings); 1224 | 1225 | // Combine delimiters into one regular expression via alternation. 1226 | var matcher = new RegExp([ 1227 | (settings.escape || noMatch).source, 1228 | (settings.interpolate || noMatch).source, 1229 | (settings.evaluate || noMatch).source 1230 | ].join('|') + '|$', 'g'); 1231 | 1232 | // Compile the template source, escaping string literals appropriately. 1233 | var index = 0; 1234 | var source = "__p+='"; 1235 | text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { 1236 | source += text.slice(index, offset) 1237 | .replace(escaper, function(match) { return '\\' + escapes[match]; }); 1238 | 1239 | if (escape) { 1240 | source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; 1241 | } 1242 | if (interpolate) { 1243 | source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; 1244 | } 1245 | if (evaluate) { 1246 | source += "';\n" + evaluate + "\n__p+='"; 1247 | } 1248 | index = offset + match.length; 1249 | return match; 1250 | }); 1251 | source += "';\n"; 1252 | 1253 | // If a variable is not specified, place data values in local scope. 1254 | if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; 1255 | 1256 | source = "var __t,__p='',__j=Array.prototype.join," + 1257 | "print=function(){__p+=__j.call(arguments,'');};\n" + 1258 | source + "return __p;\n"; 1259 | 1260 | try { 1261 | render = new Function(settings.variable || 'obj', '_', source); 1262 | } catch (e) { 1263 | e.source = source; 1264 | throw e; 1265 | } 1266 | 1267 | if (data) return render(data, _); 1268 | var template = function(data) { 1269 | return render.call(this, data, _); 1270 | }; 1271 | 1272 | // Provide the compiled function source as a convenience for precompilation. 1273 | template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; 1274 | 1275 | return template; 1276 | }; 1277 | 1278 | // Add a "chain" function, which will delegate to the wrapper. 1279 | _.chain = function(obj) { 1280 | return _(obj).chain(); 1281 | }; 1282 | 1283 | // OOP 1284 | // --------------- 1285 | // If Underscore is called as a function, it returns a wrapped object that 1286 | // can be used OO-style. This wrapper holds altered versions of all the 1287 | // underscore functions. Wrapped objects may be chained. 1288 | 1289 | // Helper function to continue chaining intermediate results. 1290 | var result = function(obj) { 1291 | return this._chain ? _(obj).chain() : obj; 1292 | }; 1293 | 1294 | // Add all of the Underscore functions to the wrapper object. 1295 | _.mixin(_); 1296 | 1297 | // Add all mutator Array functions to the wrapper. 1298 | each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { 1299 | var method = ArrayProto[name]; 1300 | _.prototype[name] = function() { 1301 | var obj = this._wrapped; 1302 | method.apply(obj, arguments); 1303 | if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0]; 1304 | return result.call(this, obj); 1305 | }; 1306 | }); 1307 | 1308 | // Add all accessor Array functions to the wrapper. 1309 | each(['concat', 'join', 'slice'], function(name) { 1310 | var method = ArrayProto[name]; 1311 | _.prototype[name] = function() { 1312 | return result.call(this, method.apply(this._wrapped, arguments)); 1313 | }; 1314 | }); 1315 | 1316 | _.extend(_.prototype, { 1317 | 1318 | // Start chaining a wrapped Underscore object. 1319 | chain: function() { 1320 | this._chain = true; 1321 | return this; 1322 | }, 1323 | 1324 | // Extracts the result from a wrapped and chained object. 1325 | value: function() { 1326 | return this._wrapped; 1327 | } 1328 | 1329 | }); 1330 | 1331 | // AMD registration happens at the end for compatibility with AMD loaders 1332 | // that may not enforce next-turn semantics on modules. Even though general 1333 | // practice for AMD registration is to be anonymous, underscore registers 1334 | // as a named module because, like jQuery, it is a base library that is 1335 | // popular enough to be bundled in a third party lib, but not be part of 1336 | // an AMD load request. Those cases could generate an error when an 1337 | // anonymous define() is called outside of a loader request. 1338 | if (typeof define === 'function' && define.amd) { 1339 | define('underscore', [], function() { 1340 | return _; 1341 | }); 1342 | } 1343 | }).call(this); 1344 | -------------------------------------------------------------------------------- /demo/demo.js: -------------------------------------------------------------------------------- 1 | angular.module('app', ['ui.bootstrap','cgPrompt']); 2 | 3 | angular.module('app').controller('DemoCtrl',function($scope,prompt){ 4 | 5 | $scope.options = { 6 | title: 'Title', 7 | message:'Message', 8 | input:false, 9 | label:'Input label', 10 | value:'Input initial value', 11 | values:'', 12 | buttons:'' 13 | }; 14 | 15 | var processOptions = function(){ 16 | var options = angular.copy($scope.options); 17 | 18 | if (options.values.length === 0) { 19 | options.values = undefined; 20 | } 21 | 22 | options.buttons = _.chain(options.buttons.split(',')) 23 | .filter(function(val){ 24 | return val; 25 | }) 26 | .map(function(val){ 27 | val = val.trim(); 28 | return {label:val,cancel:val.toLowerCase() === 'cancel',primary:val.toLowerCase() === 'ok'}; 29 | }) 30 | .value(); 31 | if (options.buttons.length === 0) { 32 | options.buttons = undefined; 33 | } 34 | 35 | if (!options.input){ 36 | options.input = undefined; 37 | options.value = undefined; 38 | options.values = undefined; 39 | options.label = undefined; 40 | } 41 | return options; 42 | }; 43 | 44 | $scope.getCode = function(){ 45 | var options = processOptions(); 46 | return 'prompt(' + JSON.stringify(options,null,'\t') + ').then(function(result){\n\tconsole.log(result);\n});'; 47 | }; 48 | 49 | $scope.go = function(){ 50 | $scope.results = ''; 51 | 52 | var options = processOptions(); 53 | 54 | prompt(options).then(function(results){ 55 | $scope.results = JSON.stringify(results,null,'\t'); 56 | },function(){ 57 | $scope.results = 'Promise rejected'; 58 | }); 59 | 60 | }; 61 | 62 | }); -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Angular Prompt Demo 5 | 6 | 7 | 8 | 9 | 10 | 21 | 22 | 23 | 24 | 25 |
26 |
27 |
28 |

angular-prompt

29 |
30 |
31 |

Options

32 |
33 |
34 |
35 | 36 |
37 | 38 |
39 |
40 |
41 | 42 |
43 | 44 |
45 |
46 |
47 |
48 |
49 | 52 |
53 |
54 |
55 |
56 | 57 |
58 | 59 |
60 |
61 |
62 | 63 |
64 | 65 |
66 |
67 |
68 | 69 |
70 | 71 |
72 |
73 |
74 | 75 |
76 | 77 |
78 |
79 |
80 |
81 | 82 |
83 |
84 |

Code

85 |
86 |
{{getCode()}}
87 |
88 |

Result

89 |
90 |
{{results}}
91 |
92 |
93 |
94 |
95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /dist/angular-prompt.js: -------------------------------------------------------------------------------- 1 | angular.module('cgPrompt',['ui.bootstrap']); 2 | 3 | angular.module('cgPrompt').factory('prompt',['$uibModal','$q',function($uibModal,$q){ 4 | 5 | var prompt = function(options){ 6 | 7 | var defaults = { 8 | title: '', 9 | message: '', 10 | input: false, 11 | label: '', 12 | value: '', 13 | values: false, 14 | buttons: [ 15 | {label:'Cancel',cancel:true}, 16 | {label:'OK',primary:true} 17 | ] 18 | }; 19 | 20 | if (options === undefined){ 21 | options = {}; 22 | } 23 | 24 | for (var key in defaults) { 25 | if (options[key] === undefined) { 26 | options[key] = defaults[key]; 27 | } 28 | } 29 | 30 | var defer = $q.defer(); 31 | 32 | $uibModal.open({ 33 | templateUrl:'angular-prompt.html', 34 | controller: 'cgPromptCtrl', 35 | resolve: { 36 | options:function(){ 37 | return options; 38 | } 39 | } 40 | }).result.then(function(result){ 41 | if (options.input){ 42 | defer.resolve(result.input); 43 | } else { 44 | defer.resolve(result.button); 45 | } 46 | }, function(){ 47 | defer.reject(); 48 | }); 49 | 50 | return defer.promise; 51 | }; 52 | 53 | return prompt; 54 | } 55 | ]); 56 | 57 | angular.module('cgPrompt').controller('cgPromptCtrl',['$scope','options','$timeout',function($scope,options,$timeout){ 58 | 59 | $scope.input = {name:options.value}; 60 | 61 | $scope.options = options; 62 | 63 | $scope.form = {}; 64 | 65 | $scope.buttonClicked = function(button){ 66 | if (button.cancel){ 67 | $scope.$dismiss(); 68 | return; 69 | } 70 | if (options.input && $scope.form.cgPromptForm.$invalid){ 71 | $scope.changed = true; 72 | return; 73 | } 74 | $scope.$close({button:button,input:$scope.input.name}); 75 | }; 76 | 77 | $scope.submit = function(){ 78 | var ok; 79 | angular.forEach($scope.options.buttons,function(button){ 80 | if (button.primary){ 81 | ok = button; 82 | } 83 | }); 84 | if (ok){ 85 | $scope.buttonClicked(ok); 86 | } 87 | }; 88 | 89 | $timeout(function(){ 90 | var elem = document.querySelector('#cgPromptInput'); 91 | if (elem) { 92 | if (elem.select) { 93 | elem.select(); 94 | } 95 | if (elem.focus) { 96 | elem.focus(); 97 | } 98 | } 99 | },100); 100 | 101 | 102 | }]); 103 | 104 | 105 | angular.module('cgPrompt').run(['$templateCache', function($templateCache) { 106 | 'use strict'; 107 | 108 | $templateCache.put('angular-prompt.html', 109 | "
\n" + 110 | "
\n" + 111 | " \n" + 112 | "

{{options.title}}

\n" + 113 | "
\n" + 114 | "
\n" + 115 | "\n" + 116 | "

\n" + 117 | " {{options.message}}\n" + 118 | "

\n" + 119 | "\n" + 120 | "
\n" + 121 | "
\n" + 122 | " \n" + 123 | " \n" + 124 | "
\n" + 125 | " \n" + 126 | "\n" + 127 | "
\n" + 128 | " \n" + 129 | " \n" + 132 | "
\n" + 133 | "
\n" + 134 | "
\n" + 135 | "
\n" + 136 | "\n" + 137 | "
\n" + 138 | "
\n" + 139 | " \n" + 140 | "
\n" + 141 | "
" 142 | ); 143 | 144 | }]); 145 | -------------------------------------------------------------------------------- /dist/angular-prompt.min.js: -------------------------------------------------------------------------------- 1 | angular.module("cgPrompt",["ui.bootstrap"]),angular.module("cgPrompt").factory("prompt",["$uibModal","$q",function(a,b){var c=function(c){var d={title:"",message:"",input:!1,label:"",value:"",values:!1,buttons:[{label:"Cancel",cancel:!0},{label:"OK",primary:!0}]};void 0===c&&(c={});for(var e in d)void 0===c[e]&&(c[e]=d[e]);var f=b.defer();return a.open({templateUrl:"angular-prompt.html",controller:"cgPromptCtrl",resolve:{options:function(){return c}}}).result.then(function(a){c.input?f.resolve(a.input):f.resolve(a.button)},function(){f.reject()}),f.promise};return c}]),angular.module("cgPrompt").controller("cgPromptCtrl",["$scope","options","$timeout",function(a,b,c){a.input={name:b.value},a.options=b,a.form={},a.buttonClicked=function(c){return c.cancel?void a.$dismiss():b.input&&a.form.cgPromptForm.$invalid?void(a.changed=!0):void a.$close({button:c,input:a.input.name})},a.submit=function(){var b;angular.forEach(a.options.buttons,function(a){a.primary&&(b=a)}),b&&a.buttonClicked(b)},c(function(){var a=document.querySelector("#cgPromptInput");a&&(a.select&&a.select(),a.focus&&a.focus())},100)}]),angular.module("cgPrompt").run(["$templateCache",function(a){"use strict";a.put("angular-prompt.html",'
\n \n \n \n
')}]); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-prompt", 3 | "version": "1.2.0", 4 | "description": "", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/cgross/angular-prompt.git" 8 | }, 9 | "devDependencies": { 10 | "grunt": "~0.4.4", 11 | "grunt-contrib-uglify": "~0.4.0", 12 | "grunt-contrib-jshint": "~0.10.0", 13 | "grunt-contrib-jasmine": "~0.6.3", 14 | "grunt-contrib-concat": "~0.4.0", 15 | "grunt-angular-templates": "~0.5.4", 16 | "grunt-contrib-connect": "~0.7.1", 17 | "grunt-contrib-watch": "~0.6.1", 18 | "load-grunt-tasks": "~0.4.0" 19 | }, 20 | "scripts": { 21 | "test": "grunt test -v" 22 | } 23 | } 24 | --------------------------------------------------------------------------------