jQuery Pin It Button for Images - Version 2.2.6

Version Description

  • Released 2017-02-16
  • Fixed conflict with other plugins that use angular
Download this release

Release Info

Developer mrsztuczkens
Plugin Icon wp plugin jQuery Pin It Button for Images
Version 2.2.6
Comparing to
See all releases

Code changes from version 2.2.5 to 2.2.6

includes/admin/jpibfi-admin.php CHANGED
@@ -157,10 +157,10 @@ class JPIBFI_Admin {
157
 
158
  public function print_admin_page() {
159
  ?>
160
- <div ng-app="app" class="wrap">
161
  <h2><?php _e( 'jQuery Pin It Button For Images Options', 'jquery-pin-it-button-for-images' ); ?></h2>
162
  <div id="icon-plugins" class="icon32"></div>
163
- <app settings-name="jpibfi_settings"></app>
164
  </div>
165
  <?php
166
  }
157
 
158
  public function print_admin_page() {
159
  ?>
160
+ <div id="jpibfi-container" class="wrap">
161
  <h2><?php _e( 'jQuery Pin It Button For Images Options', 'jquery-pin-it-button-for-images' ); ?></h2>
162
  <div id="icon-plugins" class="icon32"></div>
163
+ <jpibfi settings-name="jpibfi_settings"></jpibfi>
164
  </div>
165
  <?php
166
  }
jquery-pin-it-button-for-images.php CHANGED
@@ -6,7 +6,7 @@ Description: Highlights images on hover and adds a "Pin It" button over them for
6
  Text Domain: jquery-pin-it-button-for-images
7
  Domain Path: /languages
8
  Author: Marcin Skrzypiec
9
- Version:2.2.5
10
  Author URI: https://highfiveplugins.com/
11
  */
12
 
@@ -18,7 +18,7 @@ if ( !class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) {
18
  final class jQuery_Pin_It_Button_For_Images {
19
 
20
  function __construct() {
21
- $version = '2.2.5';
22
  require_once plugin_dir_path(__FILE__) . 'includes/jpibfi.php';
23
  new JPIBFI(__FILE__, $version);
24
  }
6
  Text Domain: jquery-pin-it-button-for-images
7
  Domain Path: /languages
8
  Author: Marcin Skrzypiec
9
+ Version:2.2.6
10
  Author URI: https://highfiveplugins.com/
11
  */
12
 
18
  final class jQuery_Pin_It_Button_For_Images {
19
 
20
  function __construct() {
21
+ $version = '2.2.6';
22
  require_once plugin_dir_path(__FILE__) . 'includes/jpibfi.php';
23
  new JPIBFI(__FILE__, $version);
24
  }
js/jpibfi.admin.js CHANGED
@@ -1,9 +1,20079 @@
1
- !function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./app.controller"),o=r(i),a={bindings:{settingsName:"@"},controller:o["default"],template:'<navbar id="settings-navbar"\n tabs="$ctrl.config.tabs"\n page="$ctrl.config.page"\n links="$ctrl.config.links"\n current-tab="$ctrl.config.currentTab">\n </navbar>\n <form method="POST" enctype="multipart/form-data" id="jpibfi-form" action="{{ $ctrl.config.save.post_url }}">\n <input name="{{ ::$ctrl.config.save.action }}" value="{{ ::$ctrl.config.save.nonce }}" type="hidden" />\n <input name="{{ ::$ctrl.config.save.tab }}" value="{{ ::$ctrl.config.currentTab }}" type="hidden" />\n <select-editor\n ng-if="$ctrl.config.currentTab == \'select\'"\n settings="$ctrl.config.settings"\n i18n="$ctrl.config.i18n.editor">\n </select-editor>\n <visual-editor\n ng-if="$ctrl.config.currentTab == \'visual\'"\n settings="$ctrl.config.settings"\n i18n="$ctrl.config.i18n.editor">\n </visual-editor>\n <advanced-editor\n ng-if="$ctrl.config.currentTab == \'advanced\'"\n settings="$ctrl.config.settings"\n i18n="$ctrl.config.i18n.editor">\n </advanced-editor>\n <import-editor\n ng-if="$ctrl.config.currentTab == \'import\'"\n settings="$ctrl.config.settings"\n i18n="$ctrl.config.i18n.editor">\n </import-editor>\n <input ng-if="$ctrl.config.currentTab == \'select\' || $ctrl.config.currentTab == \'visual\' || $ctrl.config.currentTab == \'advanced\'" \n type="submit" class="button button-primary" value="{{ ::$ctrl.config.save.submit }}" /> \n </form>\n '};n["default"]=a},{"./app.controller":2}],2:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){r(this,e),this.linkService=t,this.config={},this.settingsValue={}}return i(e,[{key:"$onInit",value:function(){this.config=window[this.settingsName],this.linkService.init(this.config.page)}}]),e}();o.$inject=["linkService"],n["default"]=o},{}],3:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("angular-sanitize"),s=r(a),u=e("ng-file-upload"),l=r(u),c=e("angular-drag-and-drop-lists"),f=(r(c),e("./app.component")),d=r(f),p=e("./components/components"),h=r(p),g=e("./common/components"),$=r(g),v=e("./services"),m=r(v),y=o["default"].module("app",[s["default"],l["default"],h["default"],$["default"],m["default"]]).component("app",d["default"]).name;n["default"]=y},{"./app.component":1,"./common/components":8,"./components/components":18,"./services":35,angular:42,"angular-drag-and-drop-lists":38,"angular-sanitize":40,"ng-file-upload":44}],4:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./../base.controller"),o=r(i),a={bindings:{settings:"<",i18n:"<"},controller:o["default"],template:'\n <h2>{{ $ctrl.i18n.title }}</h2>\n <table class="form-table">\n <tbody>\n <tr>\n <th>{{ ::$ctrl.i18n.filters_label }}</th>\n <td>\n <p>\n <filter name="$ctrl.settings.filter_the_content_on" priority="$ctrl.settings.filter_the_content_priority"\n update="$ctrl.update($event)" template="$ctrl.i18n.filter_template">\n </filter>\n </p>\n <p>\n <filter name="$ctrl.settings.filter_the_excerpt_on" priority="$ctrl.settings.filter_the_excerpt_priority"\n update="$ctrl.update($event)" template="$ctrl.i18n.filter_template">\n </filter>\n </p>\n <p>\n <filter name="$ctrl.settings.filter_post_thumbnail_html_on" priority="$ctrl.settings.filter_post_thumbnail_html_priority"\n update="$ctrl.update($event)" template="$ctrl.i18n.filter_template">\n </filter>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.filters_description"></p>\n </td>\n </tr>\n </tbody>\n </table>\n '};n["default"]=a},{"./../base.controller":7}],5:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){r(this,e),this.$compile=t,this.restrict="E",this.scope={name:"=",priority:"=",template:"=",update:"&"}}return i(e,[{key:"link",value:function(e,t,n){var r=e.template,i=r.replace("%name%",'<editor-checkbox args="name" on-update="update({ $event })" add-br="false"></editor-checkbox>').replace("%priority%",'<editor-number args="priority" on-update="update({ $event })"></editor-number>');t.html(i),this.$compile(t.contents())(e)}}]),e}();n["default"]=o},{}],6:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./filter.directive"),s=r(a),u=e("./advanced.component"),l=r(u),c=e("./../../components/components"),f=r(c),d=o["default"].module("app.common.advanced",[f["default"]]).directive("filter",["$compile",function(e){return new s["default"](e)}]).component("advancedEditor",l["default"]).name;n["default"]=d},{"./../../components/components":18,"./advanced.component":4,"./filter.directive":5,angular:42}],7:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(){r(this,e)}return o(e,[{key:"$onChanges",value:function(e){var t=this;e.settings&&(this.settings=i({},this.settings),this.values=Object.keys(this.settings).reduce(function(e,n){return e[n]=t.settings[n].value,e},{}))}},{key:"update",value:function(e){var t=e.key,n=e.value;this.values[t]=n}},{key:"updateValue",value:function(e,t){this.settings[e]=i({},this.settings[e],{value:t}),this.values[e]=t}}]),e}();n["default"]=a},{}],8:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./select"),s=r(a),u=e("./visual"),l=r(u),c=e("./import"),f=r(c),d=e("./advanced"),p=r(d),h=o["default"].module("app.common",[s["default"],l["default"],f["default"],p["default"]]).name;n["default"]=h},{"./advanced":6,"./import":11,"./select":12,"./visual":15,angular:42}],9:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./import.controller"),o=r(i),a={bindings:{i18n:"<"},require:{form:"^form"},controller:o["default"],template:'\n <h2>{{ ::$ctrl.i18n.title }}</h2>\n <table class="form-table">\n <tbody>\n <tr>\n <th><label>{{ ::$ctrl.i18n.export_title }}</label></th>\n <td>\n <a href="{{ ::$ctrl.i18n.export_url }}" class="button button-default">\n {{ ::$ctrl.i18n.export_button_text }}\n </a>\n </td>\n </tr>\n <tr>\n <th><label>{{ ::$ctrl.i18n.import_title }}</label></th>\n <td>\n <input type="file" name="import" ng-change="$ctrl.upload()" ng-model="$ctrl.file" ngf-accept="\'.json\'"\n ngf-select="$ctrl.upload()" ngf-max-size="1MB" />\n </td>\n </tr>\n </tbody>\n </table>\n '};n["default"]=a},{"./import.controller":10}],10:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){r(this,e),this.Upload=t}return i(e,[{key:"upload",value:function(){document.getElementById("jpibfi-form").submit()}}]),e}();o.$inject=["Upload"],n["default"]=o},{}],11:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./import.component"),s=r(a),u=o["default"].module("app.common.import",[]).component("importEditor",s["default"]).name;n["default"]=u},{"./import.component":9,angular:42}],12:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./resolution.directive"),s=r(a),u=e("./select.component"),l=r(u),c=e("./../../components/components"),f=r(c),d=o["default"].module("app.common.select",[f["default"]]).directive("resolution",["$compile",function(e){return new s["default"](e)}]).component("selectEditor",l["default"]).name;n["default"]=d},{"./../../components/components":18,"./resolution.directive":13,"./select.component":14,angular:42}],13:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){r(this,e),this.$compile=t,this.restrict="E",this.scope={height:"=",width:"=",template:"=",update:"&"}}return i(e,[{key:"link",value:function(e,t,n){var r=e.template,i=r.replace("%height%",'<editor-number args="height" on-update="update({ $event })"></editor-number>').replace("%width%",'<editor-number args="width" on-update="update({ $event })"></editor-number>');t.html(i),this.$compile(t.contents())(e)}}]),e}();n["default"]=o},{}],14:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./../base.controller"),o=r(i),a={bindings:{settings:"<",i18n:"<"},controller:o["default"],template:'\n <h2>{{ $ctrl.i18n.title }}</h2>\n <table class="form-table">\n <tbody>\n <tr>\n <th><label for="image_selector">{{ ::$ctrl.settings.image_selector.label }}</label></th>\n <td>\n <editor-text args="$ctrl.settings.image_selector" on-update="$ctrl.update($event)"></editor-text>\n <p class="description" ng-bind-html="$ctrl.settings.image_selector.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label for="disabled_classes">{{ ::$ctrl.settings.disabled_classes.label }}</label></th>\n <td>\n <editor-text args="$ctrl.settings.disabled_classes" on-update="$ctrl.update($event)"></editor-text>\n <p class="description" ng-bind-html="$ctrl.settings.disabled_classes.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label for="enabled_classes">{{ ::$ctrl.settings.enabled_classes.label }}</label></th>\n <td>\n <editor-text args="$ctrl.settings.enabled_classes" on-update="$ctrl.update($event)"></editor-text>\n <p class="description" ng-bind-html="$ctrl.settings.enabled_classes.desc"></p>\n </td>\n </tr>\n <tr>\n <th>{{ ::$ctrl.i18n.image_resolution_label }}</th>\n <td>\n <p>\n <resolution height="$ctrl.settings.min_image_height_small" width="$ctrl.settings.min_image_width_small"\n update="$ctrl.update($event)" template="$ctrl.i18n.min_resolution_template_small">\n </resolution>\n </p>\n <p>\n <resolution height="$ctrl.settings.min_image_height" width="$ctrl.settings.min_image_width"\n update="$ctrl.update($event)" template="$ctrl.i18n.min_resolution_template">\n </resolution>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.image_resolution_desc"></p>\n <p class="description" ng-bind-html="$ctrl.i18n.image_resolution_desc_2"></p>\n </td>\n </tr>\n <tr>\n <th>{{ ::$ctrl.i18n.show_on_field_label }}</th>\n <td>\n <p>\n <label for="show_on">{{ ::$ctrl.settings.show_on.label }}:</label><br/>\n <editor-textarea args="$ctrl.settings.show_on" on-update="$ctrl.update($event)"></editor-text>\n </p>\n <p>\n <label for="disable_on">{{ ::$ctrl.settings.disable_on.label }}:</label><br/>\n <editor-textarea args="$ctrl.settings.disable_on" on-update="$ctrl.update($event)"></editor-text>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.show_on_field_desc"></p>\n </td>\n </tr>\n </tbody>\n </table>\n '};n["default"]=a},{"./../base.controller":7}],15:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./visual.component"),s=r(a),u=e("./../../components/components"),l=r(u),c=o["default"].module("app.common.visual",[l["default"]]).component("visualEditor",s["default"]).name;n["default"]=c},{"./../../components/components":18,"./visual.component":16,angular:42}],16:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./visual.controller"),o=r(i),a={bindings:{settings:"<",i18n:"<"},controller:o["default"],template:'\n <h2>{{ $ctrl.i18n.title }}</h2>\n <table class="form-table">\n <tbody>\n <tr>\n <th><label for="show_button">{{ ::$ctrl.settings.show_button.label }}</label></th>\n <td>\n <editor-select args="$ctrl.settings.show_button" on-update="$ctrl.update($event)"></editor-select>\n <p class="description" ng-bind-html="$ctrl.settings.show_button.desc"></p>\n <p ng-if="$ctrl.values.show_button != \'hover\'">\n <b ng-bind-html="$ctrl.i18n.pro_feature_error"></b>\n </p>\n </td>\n </tr>\n <tr>\n <th><label>{{ ::$ctrl.settings.description_option.label }}</label></th>\n <td>\n <editor-sortable-select args="$ctrl.settings.description_option" on-update="$ctrl.update($event)"></editor-sortable-select>\n <p class="description" ng-bind-html="$ctrl.settings.description_option.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label for="pinLinkedImages">{{ ::$ctrl.settings.pinLinkedImages.label }}</label></th>\n <td>\n <editor-checkbox args="$ctrl.settings.pinLinkedImages" on-update="$ctrl.update($event)"></editor-checkbox>\n <p class="description" ng-bind-html="$ctrl.settings.pinLinkedImages.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label for="transparency_value">{{ ::$ctrl.settings.transparency_value.label }}</label></th>\n <td>\n <editor-number args="$ctrl.settings.transparency_value" on-update="$ctrl.update($event)"></editor-number>\n <p class="description" ng-bind-html="$ctrl.settings.transparency_value.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label>{{ ::$ctrl.settings.pin_image.label }}</label></th>\n <td>\n <table class="jpibfi-inner-table">\n <tr>\n <th>{{ ::$ctrl.i18n.mode }}</th>\n <th ng-if="$ctrl.values.pin_image != \'old_default\'">{{ ::$ctrl.i18n.settings }}</th>\n <th>{{ ::$ctrl.i18n.preview }}</th>\n </tr>\n <tr>\n <td>\n <p><label><input type="radio" name="{{ ::$ctrl.settings.pin_image.key }}" ng_model="$ctrl.values.pin_image" value="old_default">{{ ::$ctrl.settings.pin_image.options[\'old_default\'] }}</label></p>\n <p><label><input type="radio" name="{{ ::$ctrl.settings.pin_image.key }}" ng_model="$ctrl.values.pin_image" value="default">{{ ::$ctrl.settings.pin_image.options[\'default\'] }}</label></p>\n <p><label><input type="radio" name="{{ ::$ctrl.settings.pin_image.key }}" ng_model="$ctrl.values.pin_image" value="custom">{{ ::$ctrl.settings.pin_image.options[\'custom\'] }}</label></p>\n </td>\n <td ng-if="$ctrl.values.pin_image != \'old_default\'">\n <div ng-show="$ctrl.values.pin_image == \'default\'">\n <p>\n <label for="pin_image_icon">{{ ::$ctrl.settings.pin_image_icon.label }}</label>\n <editor-select args="$ctrl.settings.pin_image_icon" on-update="$ctrl.update($event)"></editor-select>\n <p ng-if="$ctrl.values.pin_image_icon != \'circle\'">\n <b ng-bind-html="$ctrl.i18n.pro_feature_error"></b>\n </p>\n </p>\n <p>\n <label for="pin_image_size">{{ ::$ctrl.settings.pin_image_size.label }}</label>\n <editor-select args="$ctrl.settings.pin_image_size" on-update="$ctrl.update($event)"></editor-select>\n </p>\n <p>\n <label for="pin_image_button">{{ ::$ctrl.settings.pin_image_button.label }}</label>\n <editor-select args="$ctrl.settings.pin_image_button" on-update="$ctrl.update($event)"></editor-select>\n </p>\n </div>\n <div ng-if="$ctrl.values.pin_image == \'custom\'">\n <p><button type="button" class="button button-default" ng-click="$ctrl.upload()">{{ ::$ctrl.i18n.custom_button_upload }}</button></p>\n <p>\n <label for="custom_image_url">{{ ::$ctrl.settings.custom_image_url.label }}</label>\n <editor-text args="$ctrl.settings.custom_image_url" on-update="$ctrl.update($event)"></editor-text>\n </p>\n <p>\n <div style="display: inline-block; width: 49%;">\n <label for="custom_image_height">{{ ::$ctrl.settings.custom_image_height.label }}</label>\n <editor-number args="$ctrl.settings.custom_image_height" on-update="$ctrl.update($event)"></editor-number>\n </div>\n <div style="display: inline-block; width: 49%;">\n <label for="custom_image_width">{{ ::$ctrl.settings.custom_image_width.label }}</label>\n <editor-number args="$ctrl.settings.custom_image_width" on-update="$ctrl.update($event)"></editor-number>\n </div>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.custom_button_desc"></p>\n </div>\n </td>\n <td>\n <div ng-if="$ctrl.values.pin_image == \'old_default\'">\n <a class="pinit-button old_default"><span></span></a>\n </div>\n <div ng-show="$ctrl.values.pin_image == \'default\'">\n <a class="pinit-button default" ng-class="[\'jpibfi-size-\' + $ctrl.values.pin_image_size, \'jpibfi-button-\' + $ctrl.values.pin_image_button]">\n <span ng-class="[\'jpibfi-icon-\' + $ctrl.values.pin_image_icon]"></span>\n </a>\n </div>\n <div ng-show="$ctrl.values.pin_image == \'custom\'">\n <div ng-if="$ctrl.values.custom_image_url">\n <div style="width: {{ $ctrl.values.custom_image_width }}px;\n height: {{ $ctrl.values.custom_image_height }}px;\n background-image: url(\'{{ $ctrl.values.custom_image_url }}\');">\n </div>\n </div>\n <div ng-if="!$ctrl.values.custom_image_url">\n {{ ::$ctrl.i18n.custom_button_no_image_to_preview }}\n </div>\n </div>\n </td>\n </tr>\n </table>\n </tr>\n <tr>\n <th><label for="button_position">{{ ::$ctrl.settings.button_position.label }}</label></th>\n <td>\n <editor-select args="$ctrl.settings.button_position" on-update="$ctrl.update($event)"></editor-select>\n <p class="description" ng-bind-html="$ctrl.settings.button_position.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label>{{ ::$ctrl.i18n.margins_label }}</label></th>\n <td>\n <p>\n <label for="button_margin_top">{{ ::$ctrl.settings.button_margin_top.label }}</label>\n <editor-number ng-disabled="!$ctrl.marginAvailability.top" args="$ctrl.settings.button_margin_top" on-update="$ctrl.update($event)">\n </editor-number>\n </p>\n <p>\n <label for="button_margin_bottom">{{ ::$ctrl.settings.button_margin_bottom.label }}</label>\n <editor-number ng-disabled="!$ctrl.marginAvailability.bottom" args="$ctrl.settings.button_margin_bottom" on-update="$ctrl.update($event)">\n </editor-number>\n </p>\n <p>\n <label for="button_margin_left">{{ ::$ctrl.settings.button_margin_left.label }}</label>\n <editor-number ng-disabled="!$ctrl.marginAvailability.left" args="$ctrl.settings.button_margin_left" on-update="$ctrl.update($event)">\n </editor-number>\n </p>\n <p>\n <label for="button_margin_right">{{ ::$ctrl.settings.button_margin_right.label }}</label>\n <editor-number ng-disabled="!$ctrl.marginAvailability.right" args="$ctrl.settings.button_margin_right" on-update="$ctrl.update($event)">\n </editor-number>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.margins_desc"></p>\n </td>\n </tr>\n </tbody>\n </table>\n <p ng-bind-html="$ctrl.i18n.attribution"></p>\n '};n["default"]=a},{"./visual.controller":17}],17:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function d(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var i=Object.getPrototypeOf(e);return null===i?void 0:d(i,t,n)}if("value"in r)return r.value;var o=r.get;if(void 0!==o)return o.call(n)},l=e("./../base.controller"),c=r(l),f=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.$scope=e,n.fileFrame=null,n}return a(t,e),s(t,[{key:"$onChanges",value:function(e){u(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"$onChanges",this).call(this,e),this.updateMarginAvailability()}},{key:"update",value:function(e){var t=e.key,n=e.value;this.values[t]=n,"button_position"===t&&this.updateMarginAvailability()}},{key:"updateMarginAvailability",value:function(){var e=this.values.button_position;this.marginAvailability={top:"top-left"===e||"top-right"===e,bottom:"bottom-left"===e||"bottom-right"===e,left:"top-left"===e||"bottom-left"===e,right:"top-right"===e||"bottom-right"===e}}},{key:"upload",value:function(e){var t=this;return this.fileFrame?void this.fileFrame.open():(this.fileFrame=wp.media.frames.file_frame=wp.media({title:this.i18n.custom_button_frame_title,button:{text:this.i18n.custom_button_frame_button_text},multiple:!1}).on("select",function(){var e=t.fileFrame.state().get("selection").first().toJSON();t.updateValue("custom_image_url",e.url),t.updateValue("custom_image_width",e.width),t.updateValue("custom_image_height",e.height),t.$scope.$digest()}),void this.fileFrame.open())}}]),t}(c["default"]);f.$inject=["$scope"],n["default"]=f},{"./../base.controller":7}],18:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./navbar"),s=r(a),u=e("./editors"),l=r(u),c=o["default"].module("app.components",[s["default"],l["default"]]).name;n["default"]=c},{"./editors":32,"./navbar":33,angular:42}],19:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./editor.checkbox.controller"),o=r(i),a={bindings:{args:"<",onUpdate:"&",addBr:"<?"},controller:o["default"],template:'<input type="checkbox" ng-change="$ctrl.change()" name="{{ ::$ctrl.key }}" id="{{ ::$ctrl.key }}" ng-model="$ctrl.value">\n <label for="{{ ::$ctrl.key }}">{{ ::$ctrl.args.text }}</label>\n <span ng-if="$ctrl.args.tooltip" tooltips tooltip-template="{{ ::$ctrl.args.tooltip }}" class="dashicons dashicons-editor-help"></span>\n <br ng-if="$ctrl.addBr" />'};n["default"]=a},{"./editor.checkbox.controller":20}],20:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=e("./editor.controller"),l=r(u),c=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),s(t,[{key:"$onInit",value:function(){void 0===this.addBr&&(this.addBr=!0)}}]),t}(l["default"]);n["default"]=c},{"./editor.controller":21}],21:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(){r(this,e)}return o(e,[{key:"$onChanges",value:function(e){e.args&&(this.args=i({},this.args),this.key=this.args.key,this.value=this.args.value)}},{key:"change",value:function(){this.onUpdate({$event:{key:this.key,value:this.value}})}}]),e}();a.$inject=[],n["default"]=a},{}],22:[function(e,t,n){"use strict";
2
- function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./editor.image.controller"),o=r(i),a={bindings:{args:"<",onUpdate:"&","class":"@"},controller:o["default"],template:'<input type="text" id="{{ $ctrl.key }}" name="{{ ::$ctrl.args.key }}" ng-model="$ctrl.value" ng-change="$ctrl.change()" class="regular-text" />\n<input type="button" class="button" value="{{ ::$ctrl.args.button_text }}" ng-click="$ctrl.selectFile()" />'};n["default"]=a},{"./editor.image.controller":23}],23:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=e("./editor.controller"),l=r(u),c=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.$scope=e,n}return a(t,e),s(t,[{key:"selectFile",value:function(){var e=this;return this.fileFrame=this.fileFrame||null,this.fileFrame?this.fileFrame.open():(this.fileFrame=wp.media.frames.file_frame=wp.media({title:this.args.title_text,button:{text:this.args.button_text},multiple:!1}).on("select",function(){var t=e.fileFrame.state().get("selection").first().toJSON();e.value=t.url,e.onUpdate({$event:{key:e.key,value:e.value}}),e.$scope.$apply()}),void this.fileFrame.open())}}]),t}(l["default"]);c.$inject=["$scope"],n["default"]=c},{"./editor.controller":21}],24:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./editor.controller"),o=r(i),a={bindings:{args:"<",ngDisabled:"<",onUpdate:"&"},controller:o["default"],template:'\n <input id="{{ $ctrl.key }}" name="{{ ::$ctrl.args.key }}" ng-disabled="$ctrl.ngDisabled" number-attributes="$ctrl.args" class="small-text" type="number" ng-model="$ctrl.value" ng-change="$ctrl.change()" />'};n["default"]=a},{"./editor.controller":21}],25:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){r(this,e),this.$parse=t,this.restrict="A"}return i(e,[{key:"link",value:function(e,t,n){var r=this.$parse(n.numberAttributes)(e),i=["step","min","max"];i.forEach(function(e){void 0!==r[e]&&t.attr(e,r[e])})}}]),e}();n["default"]=o},{}],26:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./editor.select.controller"),o=r(i),a={bindings:{args:"<",onUpdate:"&"},controller:o["default"],template:'\n <select name="{{ ::$ctrl.key }}" ng-model="$ctrl.value" id="{{ ::$ctrl.args.key }}" ng-change="$ctrl.change()">\n <option ng-repeat="(value, name) in $ctrl.args.options" value="{{ value }}">{{ name }}</option>\n </select>'};n["default"]=a},{"./editor.select.controller":27}],27:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function d(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var i=Object.getPrototypeOf(e);return null===i?void 0:d(i,t,n)}if("value"in r)return r.value;var o=r.get;if(void 0!==o)return o.call(n)},l=e("./editor.controller"),c=r(l),f=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),s(t,[{key:"$onChanges",value:function(e){u(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"$onChanges",this).call(this,e),e.args&&(void 0!==this.args.value&&null!==this.args.value||(this.value=Object.keys(this.args.options)[0],this.change()),this.args.truthy&&(this.value=this.value?"1":"0"))}},{key:"change",value:function(){this.onUpdate({$event:{key:this.key,value:this.args.truthy?"1"===this.value:this.value}})}}]),t}(c["default"]);f.$inject=[],n["default"]=f},{"./editor.controller":21}],28:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./editor.sortableSelect.controller"),o=r(i),a={bindings:{args:"<",onUpdate:"&"},controller:o["default"],template:'\n <input type="hidden" name="{{ ::$ctrl.args.key }}" ng-value="$ctrl.hiddenInputValue" />\n <ul class="frizzly-sortable" dnd-list="$ctrl.options">\n <li ng-repeat="item in $ctrl.options"\n dnd-draggable="item"\n dnd-moved="$ctrl.options.splice($index, 1); $ctrl.change()"\n dnd-effect-allowed="move">\n <input type="checkbox" id="{{ item.key }}" ng-model="item.selected" ng-change="$ctrl.change()" />\n <label for="{{ item.key }}">{{ item.label }}\n </li>\n </ul>\n '};n["default"]=a},{"./editor.sortableSelect.controller":29}],29:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(){r(this,e)}return o(e,[{key:"$onChanges",value:function(e){var t=this;if(e.args){this.args=i({},this.args),this.key=this.args.key,this.value=this.args.value||[],this.hiddenInputValue=this.value;var n=this.value.slice().concat(Object.keys(this.args.options).filter(function(e){return t.value.indexOf(e)===-1}));this.options=n.map(function(e){return{key:e,label:t.args.options[e],selected:t.value.indexOf(e)!==-1}})}}},{key:"change",value:function(){var e=this.options.reduce(function(e,t){return t.selected?e.concat([t.key]):e},[]);this.hiddenInputValue=e,this.onUpdate({$event:{key:this.key,value:e}})}}]),e}();a.$inject=[],n["default"]=a},{}],30:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=e("./editor.controller"),u=r(s),l=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e["class"]="regular-text",e}return a(t,e),t}(u["default"]),c={bindings:{args:"<",onUpdate:"&","class":"@",ngDisabled:"<"},controller:l,template:'<input type="text" placeholder="{{ $ctrl.args.placeholder || \'\' }}" name="{{ ::$ctrl.key }}" id="{{ $ctrl.key }}" ng-model="$ctrl.value" ng-change="$ctrl.change()" ng-class="$ctrl.class" ng-disabled="$ctrl.ngDisabled" />'};n["default"]=c},{"./editor.controller":21}],31:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("./editor.controller"),o=r(i),a={bindings:{args:"<",onUpdate:"&"},controller:o["default"],template:'<textarea rows="3" cols="50" id="{{ $ctrl.key }}" name="{{ ::$ctrl.args.key }}" class="large-text code" ng-model="$ctrl.value" ng-change="$ctrl.change()"></textarea>'};n["default"]=a},{"./editor.controller":21}],32:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./editor.text.component"),s=r(a),u=e("./editor.textarea.component"),l=r(u),c=e("./editor.image.component"),f=r(c),d=e("./editor.number.component"),p=r(d),h=e("./editor.number.directive"),g=r(h),$=e("./editor.checkbox.component"),v=r($),m=e("./editor.select.component"),y=r(m),b=e("./editor.sortableSelect.component"),w=r(b),x=o["default"].module("editors",["dndLists"]).component("editorText",s["default"]).component("editorTextarea",l["default"]).component("editorImage",f["default"]).component("editorNumber",p["default"]).component("editorCheckbox",v["default"]).component("editorSelect",y["default"]).component("editorSortableSelect",w["default"]).directive("numberAttributes",["$parse",function(e){return new g["default"](e)}]).name;n["default"]=x},{"./editor.checkbox.component":19,"./editor.image.component":22,"./editor.number.component":24,"./editor.number.directive":25,"./editor.select.component":26,"./editor.sortableSelect.component":28,"./editor.text.component":30,"./editor.textarea.component":31,angular:42}],33:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./navbar.component"),s=r(a),u=o["default"].module("navbar",[]).component("navbar",s["default"]).name;n["default"]=u},{"./navbar.component":34,angular:42}],34:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={bindings:{currentTab:"<",tabs:"<",page:"<",links:"<"},controller:function(){},template:'\n <h2 class="nav-tab-wrapper">\n <a ng-repeat="tab in $ctrl.tabs" \n href="?page={{ $ctrl.page }}&tab={{ tab.slug }}" class="nav-tab {{ $ctrl.currentTab == tab.slug ? \'nav-tab-active\' : \'\' }}">\n {{ tab.name }}\n </a>\n <a ng-repeat="link in $ctrl.links" href="{{ link.url }}" target="_blank" class="nav-tab">\n {{ link.label }}\n </a>\n </h2>\n '};n["default"]=r},{}],35:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var i=e("angular"),o=r(i),a=e("./link.service"),s=r(a),u=o["default"].module("services",[]).service("linkService",s["default"]).name;n["default"]=u},{"./link.service":36,angular:42}],36:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(u){i=!0,o=u}finally{try{!r&&s["return"]&&s["return"]()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(){r(this,e),this.baseLink=""}return o(e,[{key:"init",value:function(e){this.baseLink="?page="+e}},{key:"generateQuery",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(function(e,t){var n=i(t,2),r=n[0],o=n[1];return e+"&"+r+"="+o},this.baseLink)}}]),e}();a.$inject=[],n["default"]=a},{}],37:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=e("./app/app");r(i)},{"./app/app":3}],38:[function(e,t,n){angular.module("dndLists",[]).directive("dndDraggable",["$parse","$timeout","dndDropEffectWorkaround","dndDragTypeWorkaround",function(e,t,n,r){return function(i,o,a){o.attr("draggable","true"),a.dndDisableIf&&i.$watch(a.dndDisableIf,function(e){o.attr("draggable",!e)}),o.on("dragstart",function(s){return s=s.originalEvent||s,"false"==o.attr("draggable")||(s.dataTransfer.setData("Text",angular.toJson(i.$eval(a.dndDraggable))),s.dataTransfer.effectAllowed=a.dndEffectAllowed||"move",o.addClass("dndDragging"),t(function(){o.addClass("dndDraggingSource")},0),n.dropEffect="none",r.isDragging=!0,r.dragType=a.dndType?i.$eval(a.dndType):void 0,s._dndHandle&&s.dataTransfer.setDragImage&&s.dataTransfer.setDragImage(o[0],0,0),e(a.dndDragstart)(i,{event:s}),void s.stopPropagation())}),o.on("dragend",function(s){s=s.originalEvent||s;var u=n.dropEffect;i.$apply(function(){switch(u){case"move":e(a.dndMoved)(i,{event:s});break;case"copy":e(a.dndCopied)(i,{event:s});break;case"none":e(a.dndCanceled)(i,{event:s})}e(a.dndDragend)(i,{event:s,dropEffect:u})}),o.removeClass("dndDragging"),t(function(){o.removeClass("dndDraggingSource")},0),r.isDragging=!1,s.stopPropagation()}),o.on("click",function(t){a.dndSelected&&(t=t.originalEvent||t,i.$apply(function(){e(a.dndSelected)(i,{event:t})}),t.stopPropagation())}),o.on("selectstart",function(){this.dragDrop&&this.dragDrop()})}}]).directive("dndList",["$parse","$timeout","dndDropEffectWorkaround","dndDragTypeWorkaround",function(e,t,n,r){return function(i,o,a){function s(e,t,n){var r=v?e.offsetX||e.layerX:e.offsetY||e.layerY,i=v?t.offsetWidth:t.offsetHeight,o=v?t.offsetLeft:t.offsetTop;return o=n?o:0,r<o+i/2}function u(){var e;return angular.forEach(o.children(),function(t){var n=angular.element(t);n.hasClass("dndPlaceholder")&&(e=n)}),e||angular.element("<li class='dndPlaceholder'></li>")}function l(){return Array.prototype.indexOf.call($.children,g)}function c(e){if(!r.isDragging&&!m)return!1;if(!p(e.dataTransfer.types))return!1;if(a.dndAllowedTypes&&r.isDragging){var t=i.$eval(a.dndAllowedTypes);if(angular.isArray(t)&&t.indexOf(r.dragType)===-1)return!1}return!a.dndDisableIf||!i.$eval(a.dndDisableIf)}function f(){return h.remove(),o.removeClass("dndDragover"),!0}function d(t,n,o,a){return e(t)(i,{event:n,index:o,item:a||void 0,external:!r.isDragging,type:r.isDragging?r.dragType:void 0})}function p(e){if(!e)return!0;for(var t=0;t<e.length;t++)if("Text"===e[t]||"text/plain"===e[t])return!0;return!1}var h=u(),g=h[0],$=o[0];h.remove();var v=a.dndHorizontalList&&i.$eval(a.dndHorizontalList),m=a.dndExternalSources&&i.$eval(a.dndExternalSources);o.on("dragenter",function(e){return e=e.originalEvent||e,!c(e)||void e.preventDefault()}),o.on("dragover",function(e){if(e=e.originalEvent||e,!c(e))return!0;if(g.parentNode!=$&&o.append(h),e.target!==$){for(var t=e.target;t.parentNode!==$&&t.parentNode;)t=t.parentNode;t.parentNode===$&&t!==g&&(s(e,t)?$.insertBefore(g,t):$.insertBefore(g,t.nextSibling))}else if(s(e,g,!0))for(;g.previousElementSibling&&(s(e,g.previousElementSibling,!0)||0===g.previousElementSibling.offsetHeight);)$.insertBefore(g,g.previousElementSibling);else for(;g.nextElementSibling&&!s(e,g.nextElementSibling,!0);)$.insertBefore(g,g.nextElementSibling.nextElementSibling);return a.dndDragover&&!d(a.dndDragover,e,l())?f():(o.addClass("dndDragover"),e.preventDefault(),e.stopPropagation(),!1)}),o.on("drop",function(e){if(e=e.originalEvent||e,!c(e))return!0;e.preventDefault();var t,r=e.dataTransfer.getData("Text")||e.dataTransfer.getData("text/plain");try{t=JSON.parse(r)}catch(o){return f()}var s=l();return a.dndDrop&&(t=d(a.dndDrop,e,s,t),!t)?f():(t!==!0&&i.$apply(function(){i.$eval(a.dndList).splice(s,0,t)}),d(a.dndInserted,e,s,t),"none"===e.dataTransfer.dropEffect?"copy"===e.dataTransfer.effectAllowed||"move"===e.dataTransfer.effectAllowed?n.dropEffect=e.dataTransfer.effectAllowed:n.dropEffect=e.ctrlKey?"copy":"move":n.dropEffect=e.dataTransfer.dropEffect,f(),e.stopPropagation(),!1)}),o.on("dragleave",function(e){e=e.originalEvent||e,o.removeClass("dndDragover"),t(function(){o.hasClass("dndDragover")||h.remove()},100)})}}]).directive("dndNodrag",function(){return function(e,t,n){t.attr("draggable","true"),t.on("dragstart",function(e){e=e.originalEvent||e,e._dndHandle||(e.dataTransfer.types&&e.dataTransfer.types.length||e.preventDefault(),e.stopPropagation())}),t.on("dragend",function(e){e=e.originalEvent||e,e._dndHandle||e.stopPropagation()})}}).directive("dndHandle",function(){return function(e,t,n){t.attr("draggable","true"),t.on("dragstart dragend",function(e){e=e.originalEvent||e,e._dndHandle=!0})}}).factory("dndDragTypeWorkaround",function(){return{}}).factory("dndDropEffectWorkaround",function(){return{}})},{}],39:[function(e,t,n){!function(e,t){"use strict";function n(){function n(e,t){var n,r={},i=e.split(",");for(n=0;n<i.length;n++)r[t?u(i[n]):i[n]]=!0;return r}function r(t,n){null===t||void 0===t?t="":"string"!=typeof t&&(t=""+t),m.innerHTML=t;var r=5;do{if(0===r)throw d("uinput","Failed to sanitize html because the input is unstable");r--,e.document.documentMode&&$(m),t=m.innerHTML,m.innerHTML=t}while(t!==m.innerHTML);for(var i=m.firstChild;i;){switch(i.nodeType){case 1:n.start(i.nodeName.toLowerCase(),p(i.attributes));break;case 3:n.chars(i.textContent)}var o;if(!(o=i.firstChild)&&(1===i.nodeType&&n.end(i.nodeName.toLowerCase()),o=i.nextSibling,!o))for(;null==o&&(i=i.parentNode,i!==m);)o=i.nextSibling,1===i.nodeType&&n.end(i.nodeName.toLowerCase());i=o}for(;i=m.firstChild;)m.removeChild(i)}function p(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n];t[i.name]=i.value}return t}function h(e){return e.replace(/&/g,"&amp;").replace(y,function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1);return"&#"+(1024*(t-55296)+(n-56320)+65536)+";"}).replace(b,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function g(e,t){var n=!1,r=i(e,e.push);return{start:function(e,i){e=u(e),!n&&A[e]&&(n=e),n||O[e]!==!0||(r("<"),r(e),a(i,function(n,i){var o=u(i),a="img"===e&&"src"===o||"background"===o;P[o]!==!0||M[o]===!0&&!t(n,a)||(r(" "),r(i),r('="'),r(h(n)),r('"'))}),r(">"))},end:function(e){e=u(e),n||O[e]!==!0||w[e]===!0||(r("</"),r(e),r(">")),e==n&&(n=!1)},chars:function(e){n||r(h(e))}}}function $(t){for(;t;){if(t.nodeType===e.Node.ELEMENT_NODE)for(var n=t.attributes,r=0,i=n.length;r<i;r++){var o=n[r],a=o.name.toLowerCase();"xmlns:ns1"!==a&&0!==a.lastIndexOf("ns1:",0)||(t.removeAttributeNode(o),r--,i--)}var s=t.firstChild;s&&$(s),t=t.nextSibling}}var v=!1;this.$get=["$$sanitizeUri",function(e){return v&&o(O,C),function(t){var n=[];return c(t,f(n,function(t,n){return!/^unsafe:/.test(e(t,n))})),n.join("")}}],this.enableSvg=function(e){return s(e)?(v=e,this):v},i=t.bind,o=t.extend,a=t.forEach,s=t.isDefined,u=t.lowercase,l=t.noop,c=r,f=g;var m,y=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/([^#-~ |!])/g,w=n("area,br,col,hr,img,wbr"),x=n("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),_=n("rp,rt"),k=o({},_,x),E=o({},x,n("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),S=o({},_,n("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),C=n("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),A=n("script,style"),O=o({},w,E,S,k),M=n("background,cite,href,longdesc,src,xlink:href"),T=n("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"),j=n("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",!0),P=o({},M,j,T);!function(e){var t;if(!e.document||!e.document.implementation)throw d("noinert","Can't create an inert html document");t=e.document.implementation.createHTMLDocument("inert");var n=t.documentElement||t.getDocumentElement(),r=n.getElementsByTagName("body");if(1===r.length)m=r[0];else{var i=t.createElement("html");m=t.createElement("body"),i.appendChild(m),t.appendChild(i)}}(e)}function r(e){var t=[],n=f(t,l);return n.chars(e),t.join("")}var i,o,a,s,u,l,c,f,d=t.$$minErr("$sanitize");t.module("ngSanitize",[]).provider("$sanitize",n),t.module("ngSanitize").filter("linky",["$sanitize",function(e){var n=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,i=/^mailto:/i,o=t.$$minErr("linky"),a=t.isDefined,s=t.isFunction,u=t.isObject,l=t.isString;return function(t,c,f){function d(e){e&&y.push(r(e))}function p(e,t){var n,r=v(e);y.push("<a ");for(n in r)y.push(n+'="'+r[n]+'" ');!a(c)||"target"in r||y.push('target="',c,'" '),y.push('href="',e.replace(/"/g,"&quot;"),'">'),d(t),y.push("</a>")}if(null==t||""===t)return t;if(!l(t))throw o("notstring","Expected string but received: {0}",t);for(var h,g,$,v=s(f)?f:u(f)?function(){return f}:function(){return{}},m=t,y=[];h=m.match(n);)g=h[0],h[2]||h[4]||(g=(h[3]?"http://":"mailto:")+g),$=h.index,d(m.substr(0,$)),p(g,h[0].replace(i,"")),m=m.substring($+h[0].length);return d(m),e(y.join(""))}}])}(window,window.angular)},{}],40:[function(e,t,n){e("./angular-sanitize"),t.exports="ngSanitize"},{"./angular-sanitize":39}],41:[function(e,t,n){!function(e){"use strict";function t(e,t){return t=t||Error,function(){var n,r,i=2,o=arguments,a=o[0],s="["+(e?e+":":"")+a+"] ",u=o[1];for(s+=u.replace(/\{\d+\}/g,function(e){var t=+e.slice(1,-1),n=t+i;return n<o.length?we(o[n]):e}),s+="\nhttp://errors.angularjs.org/1.6.1/"+(e?e+"/":"")+a,r=i,n="?";r<o.length;r++,n="&")s+=n+"p"+(r-i)+"="+encodeURIComponent(we(o[r]));return new t(s)}}function n(e){if(null==e||S(e))return!1;if(li(e)||w(e)||Jr&&e instanceof Jr)return!0;var t="length"in Object(e)&&e.length;return x(t)&&(t>=0&&(t-1 in e||e instanceof Array)||"function"==typeof e.item)}function r(e,t,i){var o,a;if(e)if(k(e))for(o in e)"prototype"!==o&&"length"!==o&&"name"!==o&&e.hasOwnProperty(o)&&t.call(i,e[o],o,e);else if(li(e)||n(e)){var s="object"!=typeof e;for(o=0,a=e.length;o<a;o++)(s||o in e)&&t.call(i,e[o],o,e)}else if(e.forEach&&e.forEach!==r)e.forEach(t,i,e);else if(b(e))for(o in e)t.call(i,e[o],o,e);else if("function"==typeof e.hasOwnProperty)for(o in e)e.hasOwnProperty(o)&&t.call(i,e[o],o,e);else for(o in e)Br.call(e,o)&&t.call(i,e[o],o,e);return e}function i(e,t,n){for(var r=Object.keys(e).sort(),i=0;i<r.length;i++)t.call(n,e[r[i]],r[i]);return r}function o(e){return function(t,n){e(n,t)}}function a(){return++si}function s(e,t){t?e.$$hashKey=t:delete e.$$hashKey}function u(e,t,n){for(var r=e.$$hashKey,i=0,o=t.length;i<o;++i){var a=t[i];if(y(a)||k(a))for(var l=Object.keys(a),c=0,f=l.length;c<f;c++){var d=l[c],p=a[d];n&&y(p)?_(p)?e[d]=new Date(p.valueOf()):E(p)?e[d]=new RegExp(p):p.nodeName?e[d]=p.cloneNode(!0):V(p)?e[d]=p.clone():(y(e[d])||(e[d]=li(p)?[]:{}),u(e[d],[p],!0)):e[d]=p}}return s(e,r),e}function l(e){return u(e,ei.call(arguments,1),!1)}function c(e){return u(e,ei.call(arguments,1),!0)}function f(e){return parseInt(e,10)}function d(e,t){return l(Object.create(e),t)}function p(){}function h(e){return e}function g(e){return function(){return e}}function $(e){return k(e.toString)&&e.toString!==ri}function v(e){return"undefined"==typeof e}function m(e){return"undefined"!=typeof e}function y(e){return null!==e&&"object"==typeof e}function b(e){return null!==e&&"object"==typeof e&&!ii(e)}function w(e){return"string"==typeof e}function x(e){return"number"==typeof e}function _(e){return"[object Date]"===ri.call(e)}function k(e){return"function"==typeof e}function E(e){return"[object RegExp]"===ri.call(e)}function S(e){return e&&e.window===e}function C(e){return e&&e.$evalAsync&&e.$watch}function A(e){return"[object File]"===ri.call(e)}function O(e){return"[object FormData]"===ri.call(e)}function M(e){return"[object Blob]"===ri.call(e)}function T(e){return"boolean"==typeof e}function j(e){return e&&k(e.then)}function P(e){return e&&x(e.length)&&ci.test(ri.call(e))}function D(e){return"[object ArrayBuffer]"===ri.call(e)}function V(e){return!(!e||!(e.nodeName||e.prop&&e.attr&&e.find))}function I(e){var t,n={},r=e.split(",");for(t=0;t<r.length;t++)n[r[t]]=!0;return n}function U(e){return Wr(e.nodeName||e[0]&&e[0].nodeName)}function F(e,t){return Array.prototype.indexOf.call(e,t)!==-1}function N(e,t){var n=e.indexOf(t);return n>=0&&e.splice(n,1),n}function R(e,t){function n(e,t){var n,r=t.$$hashKey;if(li(e))for(var o=0,a=e.length;o<a;o++)t.push(i(e[o]));else if(b(e))for(n in e)t[n]=i(e[n]);else if(e&&"function"==typeof e.hasOwnProperty)for(n in e)e.hasOwnProperty(n)&&(t[n]=i(e[n]));else for(n in e)Br.call(e,n)&&(t[n]=i(e[n]));return s(t,r),t}function i(e){if(!y(e))return e;var t=a.indexOf(e);if(t!==-1)return u[t];if(S(e)||C(e))throw oi("cpws","Can't copy! Making copies of Window or Scope instances is not supported.");var r=!1,i=o(e);return void 0===i&&(i=li(e)?[]:Object.create(ii(e)),r=!0),a.push(e),u.push(i),r?n(e,i):i}function o(e){switch(ri.call(e)){case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Float32Array]":case"[object Float64Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return new e.constructor(i(e.buffer),e.byteOffset,e.length);case"[object ArrayBuffer]":if(!e.slice){var t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}return e.slice(0);case"[object Boolean]":case"[object Number]":case"[object String]":case"[object Date]":return new e.constructor(e.valueOf());case"[object RegExp]":var n=new RegExp(e.source,e.toString().match(/[^\/]*$/)[0]);return n.lastIndex=e.lastIndex,n;case"[object Blob]":return new e.constructor([e],{type:e.type})}if(k(e.cloneNode))return e.cloneNode(!0)}var a=[],u=[];if(t){if(P(t)||D(t))throw oi("cpta","Can't copy! TypedArray destination cannot be mutated.");if(e===t)throw oi("cpi","Can't copy! Source and destination are identical.");return li(t)?t.length=0:r(t,function(e,n){"$$hashKey"!==n&&delete t[n]}),a.push(e),u.push(t),n(e,t)}return i(e)}function z(e,t){if(e===t)return!0;if(null===e||null===t)return!1;if(e!==e&&t!==t)return!0;var n,r,i,o=typeof e,a=typeof t;if(o===a&&"object"===o){if(!li(e)){if(_(e))return!!_(t)&&z(e.getTime(),t.getTime());if(E(e))return!!E(t)&&e.toString()===t.toString();if(C(e)||C(t)||S(e)||S(t)||li(t)||_(t)||E(t))return!1;i=$e();for(r in e)if("$"!==r.charAt(0)&&!k(e[r])){if(!z(e[r],t[r]))return!1;i[r]=!0}for(r in t)if(!(r in i)&&"$"!==r.charAt(0)&&m(t[r])&&!k(t[r]))return!1;return!0}if(!li(t))return!1;if((n=e.length)===t.length){for(r=0;r<n;r++)if(!z(e[r],t[r]))return!1;return!0}}return!1}function L(e,t,n){return e.concat(ei.call(t,n))}function H(e,t){return ei.call(e,t||0)}function q(e,t){var n=arguments.length>2?H(arguments,2):[];return!k(t)||t instanceof RegExp?t:n.length?function(){return arguments.length?t.apply(e,L(n,arguments,0)):t.apply(e,n)}:function(){return arguments.length?t.apply(e,arguments):t.call(e)}}function B(t,n){var r=n;return"string"==typeof t&&"$"===t.charAt(0)&&"$"===t.charAt(1)?r=void 0:S(n)?r="$WINDOW":n&&e.document===n?r="$DOCUMENT":C(n)&&(r="$SCOPE"),r}function W(e,t){if(!v(e))return x(t)||(t=t?2:null),JSON.stringify(e,B,t)}function G(e){return w(e)?JSON.parse(e):e}function X(e,t){e=e.replace(gi,"");var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return ui(n)?t:n}function K(e,t){return e=new Date(e.getTime()),e.setMinutes(e.getMinutes()+t),e}function Y(e,t,n){n=n?-1:1;var r=e.getTimezoneOffset(),i=X(t,r);return K(e,n*(i-r))}function J(e){e=Jr(e).clone();try{e.empty()}catch(t){}var n=Jr("<div>").append(e).html();try{return e[0].nodeType===xi?Wr(n):n.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(e,t){return"<"+Wr(t)})}catch(t){return Wr(n)}}function Z(e){try{return decodeURIComponent(e)}catch(t){}}function Q(e){var t={};return r((e||"").split("&"),function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),n=e.indexOf("="),n!==-1&&(r=e.substring(0,n),i=e.substring(n+1)),r=Z(r),m(r)&&(i=!m(i)||Z(i),Br.call(t,r)?li(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))}),t}function ee(e){var t=[];return r(e,function(e,n){li(e)?r(e,function(e){t.push(ne(n,!0)+(e===!0?"":"="+ne(e,!0)))}):t.push(ne(n,!0)+(e===!0?"":"="+ne(e,!0)))}),t.length?t.join("&"):""}function te(e){return ne(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ne(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}function re(e,t){var n,r,i=$i.length;for(r=0;r<i;++r)if(n=$i[r]+t,w(n=e.getAttribute(n)))return n;return null}function ie(e){if(!e.currentScript)return!0;var t=e.currentScript.getAttribute("src"),n=e.createElement("a");if(n.href=t,e.location.origin===n.origin)return!0;switch(n.protocol){case"http:":case"https:":case"ftp:":case"blob:":case"file:":case"data:":return!0;default:return!1}}function oe(t,n){var i,o,a={};if(r($i,function(e){var n=e+"app";!i&&t.hasAttribute&&t.hasAttribute(n)&&(i=t,
3
- o=t.getAttribute(n))}),r($i,function(e){var n,r=e+"app";!i&&(n=t.querySelector("["+r.replace(":","\\:")+"]"))&&(i=n,o=n.getAttribute(r))}),i){if(!vi)return void e.console.error("Angular: disabling automatic bootstrap. <script> protocol indicates an extension, document.location.href does not match.");a.strictDi=null!==re(i,"strict-di"),n(i,o?[o]:[],a)}}function ae(t,n,i){y(i)||(i={});var o={strictDi:!1};i=l(o,i);var a=function(){if(t=Jr(t),t.injector()){var r=t[0]===e.document?"document":J(t);throw oi("btstrpd","App already bootstrapped with this element '{0}'",r.replace(/</,"&lt;").replace(/>/,"&gt;"))}n=n||[],n.unshift(["$provide",function(e){e.value("$rootElement",t)}]),i.debugInfoEnabled&&n.push(["$compileProvider",function(e){e.debugInfoEnabled(!0)}]),n.unshift("ng");var o=lt(n,i.strictDi);return o.invoke(["$rootScope","$rootElement","$compile","$injector",function(e,t,n,r){e.$apply(function(){t.data("$injector",r),n(t)(e)})}]),o},s=/^NG_ENABLE_DEBUG_INFO!/,u=/^NG_DEFER_BOOTSTRAP!/;return e&&s.test(e.name)&&(i.debugInfoEnabled=!0,e.name=e.name.replace(s,"")),e&&!u.test(e.name)?a():(e.name=e.name.replace(u,""),ai.resumeBootstrap=function(e){return r(e,function(e){n.push(e)}),a()},void(k(ai.resumeDeferredBootstrap)&&ai.resumeDeferredBootstrap()))}function se(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function ue(e){var t=ai.element(e).injector();if(!t)throw oi("test","no injector found for element argument to getTestability");return t.get("$$testability")}function le(e,t){return t=t||"_",e.replace(mi,function(e,n){return(n?t:"")+e.toLowerCase()})}function ce(){var t;if(!yi){var n=hi();Zr=v(n)?e.jQuery:n?e[n]:void 0,Zr&&Zr.fn.on?(Jr=Zr,l(Zr.fn,{scope:Ni.scope,isolateScope:Ni.isolateScope,controller:Ni.controller,injector:Ni.injector,inheritedData:Ni.inheritedData}),t=Zr.cleanData,Zr.cleanData=function(e){for(var n,r,i=0;null!=(r=e[i]);i++)n=Zr._data(r,"events"),n&&n.$destroy&&Zr(r).triggerHandler("$destroy");t(e)}):Jr=De,ai.element=Jr,yi=!0}}function fe(e,t,n){if(!e)throw oi("areq","Argument '{0}' is {1}",t||"?",n||"required");return e}function de(e,t,n){return n&&li(e)&&(e=e[e.length-1]),fe(k(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function pe(e,t){if("hasOwnProperty"===e)throw oi("badname","hasOwnProperty is not a valid {0} name",t)}function he(e,t,n){if(!t)return e;for(var r,i=t.split("."),o=e,a=i.length,s=0;s<a;s++)r=i[s],e&&(e=(o=e)[r]);return!n&&k(e)?q(o,e):e}function ge(e){for(var t,n=e[0],r=e[e.length-1],i=1;n!==r&&(n=n.nextSibling);i++)(t||e[i]!==n)&&(t||(t=Jr(ei.call(e,0,i))),t.push(n));return t||e}function $e(){return Object.create(null)}function ve(e){if(null==e)return"";switch(typeof e){case"string":break;case"number":e=""+e;break;default:e=!$(e)||li(e)||_(e)?W(e):e.toString()}return e}function me(e){function n(e,t,n){return e[t]||(e[t]=n())}var r=t("$injector"),i=t("ng"),o=n(e,"angular",Object);return o.$$minErr=o.$$minErr||t,n(o,"module",function(){var e={};return function(t,o,a){var s=function(e,t){if("hasOwnProperty"===e)throw i("badname","hasOwnProperty is not a valid {0} name",t)};return s(t,"module"),o&&e.hasOwnProperty(t)&&(e[t]=null),n(e,t,function(){function e(e,t,n,r){return r||(r=i),function(){return r[n||"push"]([e,t,arguments]),c}}function n(e,n,r){return r||(r=i),function(i,o){return o&&k(o)&&(o.$$moduleName=t),r.push([e,n,arguments]),c}}if(!o)throw r("nomod","Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.",t);var i=[],s=[],u=[],l=e("$injector","invoke","push",s),c={_invokeQueue:i,_configBlocks:s,_runBlocks:u,requires:o,name:t,provider:n("$provide","provider"),factory:n("$provide","factory"),service:n("$provide","service"),value:e("$provide","value"),constant:e("$provide","constant","unshift"),decorator:n("$provide","decorator",s),animation:n("$animateProvider","register"),filter:n("$filterProvider","register"),controller:n("$controllerProvider","register"),directive:n("$compileProvider","directive"),component:n("$compileProvider","component"),config:l,run:function(e){return u.push(e),this}};return a&&l(a),c})}})}function ye(e,t){if(li(e)){t=t||[];for(var n=0,r=e.length;n<r;n++)t[n]=e[n]}else if(y(e)){t=t||{};for(var i in e)"$"===i.charAt(0)&&"$"===i.charAt(1)||(t[i]=e[i])}return t||e}function be(e){var t=[];return JSON.stringify(e,function(e,n){if(n=B(e,n),y(n)){if(t.indexOf(n)>=0)return"...";t.push(n)}return n})}function we(e){return"function"==typeof e?e.toString().replace(/ \{[\s\S]*$/,""):v(e)?"undefined":"string"!=typeof e?be(e):e}function xe(n){l(n,{bootstrap:ae,copy:R,extend:l,merge:c,equals:z,element:Jr,forEach:r,injector:lt,noop:p,bind:q,toJson:W,fromJson:G,identity:h,isUndefined:v,isDefined:m,isString:w,isFunction:k,isObject:y,isNumber:x,isElement:V,isArray:li,version:Si,isDate:_,lowercase:Wr,uppercase:Gr,callbacks:{$$counter:0},getTestability:ue,reloadWithDebugInfo:se,$$minErr:t,$$csp:pi,$$encodeUriSegment:te,$$encodeUriQuery:ne,$$stringify:ve}),(Qr=me(e))("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:Cn}),e.provider("$compile",bt).directive({a:Go,input:pa,textarea:pa,form:Qo,script:ss,select:cs,option:fs,ngBind:$a,ngBindHtml:ma,ngBindTemplate:va,ngClass:ba,ngClassEven:xa,ngClassOdd:wa,ngCloak:_a,ngController:ka,ngForm:ea,ngHide:es,ngIf:Ca,ngInclude:Aa,ngInit:Ma,ngNonBindable:Ba,ngPluralize:Ka,ngRepeat:Ya,ngShow:Qa,ngStyle:ts,ngSwitch:ns,ngSwitchWhen:rs,ngSwitchDefault:is,ngOptions:Xa,ngTransclude:as,ngModel:La,ngList:Ta,ngChange:ya,pattern:ps,ngPattern:ps,required:ds,ngRequired:ds,minlength:gs,ngMinlength:gs,maxlength:hs,ngMaxlength:hs,ngValue:ga,ngModelOptions:qa}).directive({ngInclude:Oa}).directive(Xo).directive(Ea),e.provider({$anchorScroll:ct,$animate:to,$animateCss:io,$$animateJs:Qi,$$animateQueue:eo,$$AnimateRunner:ro,$$animateAsyncRun:no,$browser:$t,$cacheFactory:vt,$controller:St,$document:Ct,$$isDocumentHidden:At,$exceptionHandler:Ot,$filter:Ln,$$forceReflow:fo,$interpolate:Ht,$interval:qt,$http:Nt,$httpParamSerializer:Tt,$httpParamSerializerJQLike:jt,$httpBackend:zt,$xhrFactory:Rt,$jsonpCallbacks:bo,$location:an,$log:sn,$parse:wn,$rootScope:Sn,$q:xn,$$q:_n,$sce:jn,$sceDelegate:Tn,$sniffer:Pn,$templateCache:mt,$templateRequest:Dn,$$testability:Vn,$timeout:In,$window:Nn,$$rAF:En,$$jqLite:nt,$$HashMap:Hi,$$cookieReader:zn})}])}function _e(){return++Ai}function ke(e){return Se(e.replace(Mi,"ms-"))}function Ee(e,t){return t.toUpperCase()}function Se(e){return e.replace(Oi,Ee)}function Ce(e){return!Di.test(e)}function Ae(e){var t=e.nodeType;return t===bi||!t||t===ki}function Oe(e){for(var t in Ci[e.ng339])return!0;return!1}function Me(e){for(var t=0,n=e.length;t<n;t++)Fe(e[t])}function Te(e,t){var n,i,o,a,s=t.createDocumentFragment(),u=[];if(Ce(e))u.push(t.createTextNode(e));else{for(n=s.appendChild(t.createElement("div")),i=(Vi.exec(e)||["",""])[1].toLowerCase(),o=Ui[i]||Ui._default,n.innerHTML=o[1]+e.replace(Ii,"<$1></$2>")+o[2],a=o[0];a--;)n=n.lastChild;u=L(u,n.childNodes),n=s.firstChild,n.textContent=""}return s.textContent="",s.innerHTML="",r(u,function(e){s.appendChild(e)}),s}function je(t,n){n=n||e.document;var r;return(r=Pi.exec(t))?[n.createElement(r[1])]:(r=Te(t,n))?r.childNodes:[]}function Pe(e,t){var n=e.parentNode;n&&n.replaceChild(t,e),t.appendChild(e)}function De(e){if(e instanceof De)return e;var t;if(w(e)&&(e=fi(e),t=!0),!(this instanceof De)){if(t&&"<"!==e.charAt(0))throw ji("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new De(e)}t?qe(this,je(e)):k(e)?Ye(e):qe(this,e)}function Ve(e){return e.cloneNode(!0)}function Ie(e,t){if(t||Fe(e),e.querySelectorAll)for(var n=e.querySelectorAll("*"),r=0,i=n.length;r<i;r++)Fe(n[r])}function Ue(e,t,n,i){if(m(i))throw ji("offargs","jqLite#off() does not support the `selector` argument");var o=Ne(e),a=o&&o.events,s=o&&o.handle;if(s)if(t){var u=function(t){var r=a[t];m(n)&&N(r||[],n),m(n)&&r&&r.length>0||(e.removeEventListener(t,s),delete a[t])};r(t.split(" "),function(e){u(e),Ti[e]&&u(Ti[e])})}else for(t in a)"$destroy"!==t&&e.removeEventListener(t,s),delete a[t]}function Fe(e,t){var n=e.ng339,r=n&&Ci[n];if(r){if(t)return void delete r.data[t];r.handle&&(r.events.$destroy&&r.handle({},"$destroy"),Ue(e)),delete Ci[n],e.ng339=void 0}}function Ne(e,t){var n=e.ng339,r=n&&Ci[n];return t&&!r&&(e.ng339=n=_e(),r=Ci[n]={events:{},data:{},handle:void 0}),r}function Re(e,t,n){if(Ae(e)){var r,i=m(n),o=!i&&t&&!y(t),a=!t,s=Ne(e,!o),u=s&&s.data;if(i)u[Se(t)]=n;else{if(a)return u;if(o)return u&&u[Se(t)];for(r in t)u[Se(r)]=t[r]}}}function ze(e,t){return!!e.getAttribute&&(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+t+" ")>-1}function Le(e,t){t&&e.setAttribute&&r(t.split(" "),function(t){e.setAttribute("class",fi((" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+fi(t)+" "," ")))})}function He(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");r(t.split(" "),function(e){e=fi(e),n.indexOf(" "+e+" ")===-1&&(n+=e+" ")}),e.setAttribute("class",fi(n))}}function qe(e,t){if(t)if(t.nodeType)e[e.length++]=t;else{var n=t.length;if("number"==typeof n&&t.window!==t){if(n)for(var r=0;r<n;r++)e[e.length++]=t[r]}else e[e.length++]=t}}function Be(e,t){return We(e,"$"+(t||"ngController")+"Controller")}function We(e,t,n){e.nodeType===ki&&(e=e.documentElement);for(var r=li(t)?t:[t];e;){for(var i=0,o=r.length;i<o;i++)if(m(n=Jr.data(e,r[i])))return n;e=e.parentNode||e.nodeType===Ei&&e.host}}function Ge(e){for(Ie(e,!0);e.firstChild;)e.removeChild(e.firstChild)}function Xe(e,t){t||Ie(e);var n=e.parentNode;n&&n.removeChild(e)}function Ke(t,n){n=n||e,"complete"===n.document.readyState?n.setTimeout(t):Jr(n).on("load",t)}function Ye(t){function n(){e.document.removeEventListener("DOMContentLoaded",n),e.removeEventListener("load",n),t()}"complete"===e.document.readyState?e.setTimeout(t):(e.document.addEventListener("DOMContentLoaded",n),e.addEventListener("load",n))}function Je(e,t){var n=Ri[t.toLowerCase()];return n&&zi[U(e)]&&n}function Ze(e){return Li[e]}function Qe(e,t){var n=function(n,r){n.isDefaultPrevented=function(){return n.defaultPrevented};var i=t[r||n.type],o=i?i.length:0;if(o){if(v(n.immediatePropagationStopped)){var a=n.stopImmediatePropagation;n.stopImmediatePropagation=function(){n.immediatePropagationStopped=!0,n.stopPropagation&&n.stopPropagation(),a&&a.call(n)}}n.isImmediatePropagationStopped=function(){return n.immediatePropagationStopped===!0};var s=i.specialHandlerWrapper||et;o>1&&(i=ye(i));for(var u=0;u<o;u++)n.isImmediatePropagationStopped()||s(e,n,i[u])}};return n.elem=e,n}function et(e,t,n){n.call(e,t)}function tt(e,t,n){var r=t.relatedTarget;r&&(r===e||Fi.call(e,r))||n.call(e,t)}function nt(){this.$get=function(){return l(De,{hasClass:function(e,t){return e.attr&&(e=e[0]),ze(e,t)},addClass:function(e,t){return e.attr&&(e=e[0]),He(e,t)},removeClass:function(e,t){return e.attr&&(e=e[0]),Le(e,t)}})}}function rt(e,t){var n=e&&e.$$hashKey;if(n)return"function"==typeof n&&(n=e.$$hashKey()),n;var r=typeof e;return n="function"===r||"object"===r&&null!==e?e.$$hashKey=r+":"+(t||a)():r+":"+e}function it(e,t){if(t){var n=0;this.nextUid=function(){return++n}}r(e,this.put,this)}function ot(e){return Function.prototype.toString.call(e)+" "}function at(e){var t=ot(e).replace(Xi,""),n=t.match(qi)||t.match(Bi);return n}function st(e){var t=at(e);return t?"function("+(t[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function ut(e,t,n){var i,o,a;if("function"==typeof e){if(!(i=e.$inject)){if(i=[],e.length){if(t)throw w(n)&&n||(n=e.name||st(e)),Ki("strictdi","{0} is not using explicit annotation and cannot be invoked in strict mode",n);o=at(e),r(o[1].split(Wi),function(e){e.replace(Gi,function(e,t,n){i.push(n)})})}e.$inject=i}}else li(e)?(a=e.length-1,de(e[a],"fn"),i=e.slice(0,a)):de(e,"fn",!0);return i}function lt(e,t){function n(e){return function(t,n){return y(t)?void r(t,o(e)):e(t,n)}}function i(e,t){if(pe(e,"service"),(k(t)||li(t))&&(t=_.instantiate(t)),!t.$get)throw Ki("pget","Provider '{0}' must define $get factory method.",e);return x[e+$]=t}function a(e,t){return function(){var n=C.invoke(t,this);if(v(n))throw Ki("undef","Provider '{0}' must return a value from $get factory method.",e);return n}}function s(e,t,n){return i(e,{$get:n!==!1?a(e,t):t})}function u(e,t){return s(e,["$injector",function(e){return e.instantiate(t)}])}function l(e,t){return s(e,g(t),!1)}function c(e,t){pe(e,"constant"),x[e]=t,E[e]=t}function f(e,t){var n=_.get(e+$),r=n.$get;n.$get=function(){var e=C.invoke(r,n);return C.invoke(t,null,{$delegate:e})}}function d(e){fe(v(e)||li(e),"modulesToLoad","not an array");var t,n=[];return r(e,function(e){function r(e){var t,n;for(t=0,n=e.length;t<n;t++){var r=e[t],i=_.get(r[0]);i[r[1]].apply(i,r[2])}}if(!b.get(e)){b.put(e,!0);try{w(e)?(t=Qr(e),n=n.concat(d(t.requires)).concat(t._runBlocks),r(t._invokeQueue),r(t._configBlocks)):k(e)?n.push(_.invoke(e)):li(e)?n.push(_.invoke(e)):de(e,"module")}catch(i){throw li(e)&&(e=e[e.length-1]),i.message&&i.stack&&i.stack.indexOf(i.message)===-1&&(i=i.message+"\n"+i.stack),Ki("modulerr","Failed to instantiate module {0} due to:\n{1}",e,i.stack||i.message||i)}}}),n}function p(e,n){function r(t,r){if(e.hasOwnProperty(t)){if(e[t]===h)throw Ki("cdep","Circular dependency found: {0}",t+" <- "+m.join(" <- "));return e[t]}try{return m.unshift(t),e[t]=h,e[t]=n(t,r),e[t]}catch(i){throw e[t]===h&&delete e[t],i}finally{m.shift()}}function i(e,n,i){for(var o=[],a=lt.$$annotate(e,t,i),s=0,u=a.length;s<u;s++){var l=a[s];if("string"!=typeof l)throw Ki("itkn","Incorrect injection token! Expected service name as string, got {0}",l);o.push(n&&n.hasOwnProperty(l)?n[l]:r(l,i))}return o}function o(e){if(Yr||"function"!=typeof e)return!1;var t=e.$$ngIsClass;return T(t)||(t=e.$$ngIsClass=/^(?:class\b|constructor\()/.test(ot(e))),t}function a(e,t,n,r){"string"==typeof n&&(r=n,n=null);var a=i(e,n,r);return li(e)&&(e=e[e.length-1]),o(e)?(a.unshift(null),new(Function.prototype.bind.apply(e,a))):e.apply(t,a)}function s(e,t,n){var r=li(e)?e[e.length-1]:e,o=i(e,t,n);return o.unshift(null),new(Function.prototype.bind.apply(r,o))}return{invoke:a,instantiate:s,get:r,annotate:lt.$$annotate,has:function(t){return x.hasOwnProperty(t+$)||e.hasOwnProperty(t)}}}t=t===!0;var h={},$="Provider",m=[],b=new it([],(!0)),x={$provide:{provider:n(i),factory:n(s),service:n(u),value:n(l),constant:n(c),decorator:f}},_=x.$injector=p(x,function(e,t){throw ai.isString(t)&&m.push(t),Ki("unpr","Unknown provider: {0}",m.join(" <- "))}),E={},S=p(E,function(e,t){var n=_.get(e+$,t);return C.invoke(n.$get,n,void 0,e)}),C=S;x["$injector"+$]={$get:g(S)};var A=d(e);return C=S.get("$injector"),C.strictDi=t,r(A,function(e){e&&C.invoke(e)}),C}function ct(){var e=!0;this.disableAutoScrolling=function(){e=!1},this.$get=["$window","$location","$rootScope",function(t,n,r){function i(e){var t=null;return Array.prototype.some.call(e,function(e){if("a"===U(e))return t=e,!0}),t}function o(){var e=s.yOffset;if(k(e))e=e();else if(V(e)){var n=e[0],r=t.getComputedStyle(n);e="fixed"!==r.position?0:n.getBoundingClientRect().bottom}else x(e)||(e=0);return e}function a(e){if(e){e.scrollIntoView();var n=o();if(n){var r=e.getBoundingClientRect().top;t.scrollBy(0,r-n)}}else t.scrollTo(0,0)}function s(e){e=w(e)?e:x(e)?e.toString():n.hash();var t;e?(t=u.getElementById(e))?a(t):(t=i(u.getElementsByName(e)))?a(t):"top"===e&&a(null):a(null)}var u=t.document;return e&&r.$watch(function(){return n.hash()},function(e,t){e===t&&""===e||Ke(function(){r.$evalAsync(s)})}),s}]}function ft(e,t){return e||t?e?t?(li(e)&&(e=e.join(" ")),li(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function dt(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.nodeType===Ji)return n}}function pt(e){w(e)&&(e=e.split(" "));var t=$e();return r(e,function(e){e.length&&(t[e]=!0)}),t}function ht(e){return y(e)?e:{}}function gt(e,t,n,i){function o(e){try{e.apply(null,H(arguments,1))}finally{if(m--,0===m)for(;y.length;)try{y.pop()()}catch(t){n.error(t)}}}function a(e){var t=e.indexOf("#");return t===-1?"":e.substr(t)}function s(){k=null,u(),l()}function u(){b=E(),b=v(b)?null:b,z(b,A)&&(b=A),A=b}function l(){x===c.url()&&w===b||(x=c.url(),w=b,r(S,function(e){e(c.url(),b)}))}var c=this,f=e.location,d=e.history,h=e.setTimeout,g=e.clearTimeout,$={};c.isMock=!1;var m=0,y=[];c.$$completeOutstandingRequest=o,c.$$incOutstandingRequestCount=function(){m++},c.notifyWhenNoOutstandingRequests=function(e){0===m?e():y.push(e)};var b,w,x=f.href,_=t.find("base"),k=null,E=i.history?function(){try{return d.state}catch(e){}}:p;u(),w=b,c.url=function(t,n,r){if(v(r)&&(r=null),f!==e.location&&(f=e.location),d!==e.history&&(d=e.history),t){var o=w===r;if(x===t&&(!i.history||o))return c;var s=x&&Yt(x)===Yt(t);return x=t,w=r,!i.history||s&&o?(s||(k=t),n?f.replace(t):s?f.hash=a(t):f.href=t,f.href!==t&&(k=t)):(d[n?"replaceState":"pushState"](r,"",t),u(),w=b),k&&(k=t),c}return k||f.href.replace(/%27/g,"'")},c.state=function(){return b};var S=[],C=!1,A=null;c.onUrlChange=function(t){return C||(i.history&&Jr(e).on("popstate",s),Jr(e).on("hashchange",s),C=!0),S.push(t),t},c.$$applicationDestroyed=function(){Jr(e).off("hashchange popstate",s)},c.$$checkUrlChange=l,c.baseHref=function(){var e=_.attr("href");return e?e.replace(/^(https?:)?\/\/[^\/]*/,""):""},c.defer=function(e,t){var n;return m++,n=h(function(){delete $[n],o(e)},t||0),$[n]=!0,n},c.defer.cancel=function(e){return!!$[e]&&(delete $[e],g(e),o(p),!0)}}function $t(){this.$get=["$window","$log","$sniffer","$document",function(e,t,n,r){return new gt(e,r,t,n)}]}function vt(){this.$get=function(){function e(e,r){function i(e){e!==d&&(p?p===e&&(p=e.n):p=e,o(e.n,e.p),o(e,d),d=e,d.n=null)}function o(e,t){e!==t&&(e&&(e.p=t),t&&(t.n=e))}if(e in n)throw t("$cacheFactory")("iid","CacheId '{0}' is already taken!",e);var a=0,s=l({},r,{id:e}),u=$e(),c=r&&r.capacity||Number.MAX_VALUE,f=$e(),d=null,p=null;return n[e]={put:function(e,t){if(!v(t)){if(c<Number.MAX_VALUE){var n=f[e]||(f[e]={key:e});i(n)}return e in u||a++,u[e]=t,a>c&&this.remove(p.key),t}},get:function(e){if(c<Number.MAX_VALUE){var t=f[e];if(!t)return;i(t)}return u[e]},remove:function(e){if(c<Number.MAX_VALUE){var t=f[e];if(!t)return;t===d&&(d=t.p),t===p&&(p=t.n),o(t.n,t.p),delete f[e]}e in u&&(delete u[e],a--)},removeAll:function(){u=$e(),a=0,f=$e(),d=p=null},destroy:function(){u=null,s=null,f=null,delete n[e]},info:function(){return l({},s,{size:a})}}}var n={};return e.info=function(){var e={};return r(n,function(t,n){e[n]=t.info()}),e},e.get=function(e){return n[e]},e}}function mt(){this.$get=["$cacheFactory",function(e){return e("templates")}]}function yt(){}function bt(t,n){function i(e,t,n){var i=/^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/,o=$e();return r(e,function(e,r){if(e in A)return void(o[r]=A[e]);var a=e.match(i);if(!a)throw oo("iscp","Invalid {3} for directive '{0}'. Definition: {... {1}: '{2}' ...}",t,r,e,n?"controller bindings definition":"isolate scope definition");o[r]={mode:a[1][0],collection:"*"===a[2],optional:"?"===a[3],attrName:a[4]||r},a[4]&&(A[e]=o[r])}),o}function a(e,t){var n={isolateScope:null,bindToController:null};if(y(e.scope)&&(e.bindToController===!0?(n.bindToController=i(e.scope,t,!0),n.isolateScope={}):n.isolateScope=i(e.scope,t,!1)),y(e.bindToController)&&(n.bindToController=i(e.bindToController,t,!0)),n.bindToController&&!e.controller)throw oo("noctrl","Cannot bind to controller without directive '{0}'s controller.",t);return n}function s(e){var t=e.charAt(0);if(!t||t!==Wr(t))throw oo("baddir","Directive/Component name '{0}' is invalid. The first character must be a lowercase letter",e);if(e!==e.trim())throw oo("baddir","Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces",e)}function u(e){var t=e.require||e.controller&&e.name;return!li(t)&&y(t)&&r(t,function(e,n){var r=e.match(E),i=e.substring(r[0].length);i||(t[n]=r[0]+n)}),t}function c(e,t){if(e&&(!w(e)||!/[EACM]/.test(e)))throw oo("badrestrict","Restrict property '{0}' of directive '{1}' is invalid",e,t);return e||"EA"}var f={},$="Directive",b=/^\s*directive:\s*([\w-]+)\s+(.*)$/,x=/(([\w-]+)(?::([^;]+))?;?)/,_=I("ngSrc,ngSrcset,src,srcset"),E=/^(?:(\^\^?)?(\?)?(\^\^?)?)?/,S=/^(on[a-z]+|formaction)$/,A=$e();this.directive=function V(e,n){return fe(e,"name"),pe(e,"directive"),w(e)?(s(e),fe(n,"directiveFactory"),f.hasOwnProperty(e)||(f[e]=[],t.factory(e+$,["$injector","$exceptionHandler",function(t,n){var i=[];return r(f[e],function(r,o){try{var a=t.invoke(r);k(a)?a={compile:g(a)}:!a.compile&&a.link&&(a.compile=g(a.link)),a.priority=a.priority||0,a.index=o,a.name=a.name||e,a.require=u(a),a.restrict=c(a.restrict,e),a.$$moduleName=r.$$moduleName,i.push(a)}catch(s){n(s)}}),i}])),f[e].push(n)):r(e,o(V)),this},this.component=function(e,t){function n(e){function n(t){return k(t)||li(t)?function(n,r){return e.invoke(t,this,{$element:n,$attrs:r})}:t}var o=t.template||t.templateUrl?t.template:"",a={controller:i,controllerAs:Et(t.controller)||t.controllerAs||"$ctrl",template:n(o),templateUrl:n(t.templateUrl),transclude:t.transclude,scope:{},bindToController:t.bindings||{},restrict:"E",require:t.require};return r(t,function(e,t){"$"===t.charAt(0)&&(a[t]=e)}),a}var i=t.controller||function(){};return r(t,function(e,t){"$"===t.charAt(0)&&(n[t]=e,k(i)&&(i[t]=e))}),n.$inject=["$injector"],this.directive(e,n)},this.aHrefSanitizationWhitelist=function(e){return m(e)?(n.aHrefSanitizationWhitelist(e),this):n.aHrefSanitizationWhitelist()},this.imgSrcSanitizationWhitelist=function(e){return m(e)?(n.imgSrcSanitizationWhitelist(e),this):n.imgSrcSanitizationWhitelist()};var O=!0;this.debugInfoEnabled=function(e){return m(e)?(O=e,this):O};var M=!1;this.preAssignBindingsEnabled=function(e){return m(e)?(M=e,this):M};var j=10;this.onChangesTtl=function(e){return arguments.length?(j=e,this):j};var P=!0;this.commentDirectivesEnabled=function(e){return arguments.length?(P=e,this):P};var D=!0;this.cssClassDirectivesEnabled=function(e){return arguments.length?(D=e,this):D},this.$get=["$injector","$interpolate","$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$sce","$animate","$$sanitizeUri",function(t,n,i,o,s,u,c,g,A,V){function I(){try{if(!--Oe)throw _e=void 0,oo("infchng","{0} $onChanges() iterations reached. Aborting!\n",j);c.$apply(function(){for(var e=[],t=0,n=_e.length;t<n;++t)try{_e[t]()}catch(r){e.push(r)}if(_e=void 0,e.length)throw e})}finally{Oe++}}function F(e,t){if(t){var n,r,i,o=Object.keys(t);for(n=0,r=o.length;n<r;n++)i=o[n],this[i]=t[i]}else this.$attr={};this.$$element=e}function R(e,t,n){Ee.innerHTML="<span "+t+">";var r=Ee.firstChild.attributes,i=r[0];r.removeNamedItem(i.name),i.value=n,e.attributes.setNamedItem(i)}function L(e,t){try{e.addClass(t)}catch(n){}}function B(e,t,n,r,i){e instanceof Jr||(e=Jr(e));var o=G(e,t,e,n,r,i);B.$$addScopeClass(e);var a=null;return function(t,n,r){if(!e)throw oo("multilink","This element has already been linked.");fe(t,"scope"),i&&i.needsNewScope&&(t=t.$parent.$new()),r=r||{};var s=r.parentBoundTranscludeFn,u=r.transcludeControllers,l=r.futureParentElement;s&&s.$$boundTransclude&&(s=s.$$boundTransclude),a||(a=W(l));var c;if(c="html"!==a?Jr(ge(a,Jr("<div>").append(e).html())):n?Ni.clone.call(e):e,u)for(var f in u)c.data("$"+f+"Controller",u[f].instance);return B.$$addScopeInfo(c,t),n&&n(c,t),o&&o(t,c,c,s),n||(e=o=null),c}}function W(e){var t=e&&e[0];return t&&"foreignobject"!==U(t)&&ri.call(t).match(/SVG/)?"svg":"html"}function G(e,t,n,r,i,o){function a(e,n,r,i){var o,a,s,u,l,c,f,d,g;if(p){var $=n.length;for(g=new Array($),l=0;l<h.length;l+=3)f=h[l],g[f]=n[f]}else g=n;for(l=0,c=h.length;l<c;)s=g[h[l++]],o=h[l++],a=h[l++],o?(o.scope?(u=e.$new(),B.$$addScopeInfo(Jr(s),u)):u=e,d=o.transcludeOnThisElement?K(e,o.transclude,i):!o.templateOnThisElement&&i?i:!i&&t?K(e,t):null,o(a,u,s,r,d)):a&&a(e,s.childNodes,void 0,i)}for(var s,u,l,c,f,d,p,h=[],g=li(e)||e instanceof Jr,$=0;$<e.length;$++)s=new F,11===Yr&&X(e,$,g),u=Y(e[$],[],s,0===$?r:void 0,i),l=u.length?ne(u,e[$],s,t,n,null,[],[],o):null,l&&l.scope&&B.$$addScopeClass(s.$$element),f=l&&l.terminal||!(c=e[$].childNodes)||!c.length?null:G(c,l?(l.transcludeOnThisElement||!l.templateOnThisElement)&&l.transclude:t),(l||f)&&(h.push($,l,f),d=!0,p=p||l),o=null;return d?a:null}function X(e,t,n){var r,i=e[t],o=i.parentNode;if(i.nodeType===xi)for(;;){if(r=o?i.nextSibling:e[t+1],!r||r.nodeType!==xi)break;i.nodeValue=i.nodeValue+r.nodeValue,r.parentNode&&r.parentNode.removeChild(r),n&&r===e[t+1]&&e.splice(t+1,1)}}function K(e,t,n){function r(r,i,o,a,s){return r||(r=e.$new(!1,s),r.$$transcluded=!0),t(r,i,{parentBoundTranscludeFn:n,transcludeControllers:o,futureParentElement:a})}var i=r.$$slots=$e();for(var o in t.$$slots)t.$$slots[o]?i[o]=K(e,t.$$slots[o],n):i[o]=null;return r}function Y(e,t,n,r,i){var o,a,s,u=e.nodeType,l=n.$attr;switch(u){case bi:a=U(e),ae(t,xt(a),"E",r,i);for(var c,f,d,p,h,g,$=e.attributes,v=0,m=$&&$.length;v<m;v++){var b=!1,_=!1;c=$[v],f=c.name,h=c.value,p=xt(f),g=Pe.test(p),g&&(f=f.replace(so,"").substr(8).replace(/_(.)/g,function(e,t){return t.toUpperCase()}));var k=p.match(De);k&&se(k[1])&&(b=f,_=f.substr(0,f.length-5)+"end",f=f.substr(0,f.length-6)),d=xt(f.toLowerCase()),l[d]=f,!g&&n.hasOwnProperty(d)||(n[d]=h,Je(e,d)&&(n[d]=!0)),me(e,t,h,d,g),ae(t,d,"A",r,i,b,_)}if("input"===a&&"hidden"===e.getAttribute("type")&&e.setAttribute("autocomplete","off"),!Ae)break;if(s=e.className,y(s)&&(s=s.animVal),w(s)&&""!==s)for(;o=x.exec(s);)d=xt(o[2]),ae(t,d,"C",r,i)&&(n[d]=fi(o[3])),s=s.substr(o.index+o[0].length);break;case xi:he(t,e.nodeValue);break;case _i:if(!Se)break;Z(e,t,n,r,i)}return t.sort(de),t}function Z(e,t,n,r,i){try{var o=b.exec(e.nodeValue);if(o){var a=xt(o[1]);ae(t,a,"M",r,i)&&(n[a]=fi(o[2]))}}catch(s){}}function Q(e,t,n){var r=[],i=0;if(t&&e.hasAttribute&&e.hasAttribute(t)){do{if(!e)throw oo("uterdir","Unterminated attribute, found '{0}' but no matching '{1}' found.",t,n);e.nodeType===bi&&(e.hasAttribute(t)&&i++,e.hasAttribute(n)&&i--),r.push(e),e=e.nextSibling}while(i>0)}else r.push(e);return Jr(r)}function ee(e,t,n){return function(r,i,o,a,s){return i=Q(i[0],t,n),e(r,i,o,a,s)}}function te(e,t,n,r,i,o){var a;return e?B(t,n,r,i,o):function(){return a||(a=B(t,n,r,i,o),t=n=o=null),a.apply(this,arguments)}}function ne(e,t,n,o,a,s,u,c,f){function d(e,t,n,r){e&&(n&&(e=ee(e,n,r)),e.require=h.require,e.directiveName=g,(E===h||h.$$isolateScope)&&(e=be(e,{isolateScope:!0})),u.push(e)),t&&(n&&(t=ee(t,n,r)),t.require=h.require,t.directiveName=g,(E===h||h.$$isolateScope)&&(t=be(t,{isolateScope:!0})),c.push(t))}function p(e,o,a,s,f){function d(e,t,n,r){var i;if(C(e)||(r=n,n=t,t=e,e=void 0),j&&(i=b),n||(n=j?A.parent():A),!r)return f(e,t,i,n,N);var o=f.$$slots[r];if(o)return o(e,t,i,n,N);if(v(o))throw oo("noslot",'No parent directive that requires a transclusion with slot name "{0}". Element: {1}',r,J(A))}var p,h,g,$,m,b,w,A,O,T;t===a?(O=n,A=n.$$element):(A=Jr(a),O=new F(A,n)),m=o,E?$=o.$new(!0):x&&(m=o.$parent),f&&(w=d,w.$$boundTransclude=f,w.isSlotFilled=function(e){return!!f.$$slots[e]}),_&&(b=ie(A,O,w,_,$,o,E)),E&&(B.$$addScopeInfo(A,$,!0,!(S&&(S===E||S===E.$$originalDirective))),B.$$addScopeClass(A,!0),$.$$isolateBindings=E.$$isolateBindings,T=xe(o,O,$,$.$$isolateBindings,E),T.removeWatches&&$.$on("$destroy",T.removeWatches));for(var P in b){var D=_[P],V=b[P],I=D.$$bindings.bindToController;if(M){I?V.bindingInfo=xe(m,O,V.instance,I,D):V.bindingInfo={};var U=V();U!==V.instance&&(V.instance=U,A.data("$"+D.name+"Controller",U),V.bindingInfo.removeWatches&&V.bindingInfo.removeWatches(),V.bindingInfo=xe(m,O,V.instance,I,D))}else V.instance=V(),A.data("$"+D.name+"Controller",V.instance),V.bindingInfo=xe(m,O,V.instance,I,D)}for(r(_,function(e,t){var n=e.require;e.bindToController&&!li(n)&&y(n)&&l(b[t].instance,re(t,n,A,b))}),r(b,function(e){var t=e.instance;if(k(t.$onChanges))try{t.$onChanges(e.bindingInfo.initialChanges)}catch(n){i(n)}if(k(t.$onInit))try{t.$onInit()}catch(n){i(n)}k(t.$doCheck)&&(m.$watch(function(){t.$doCheck()}),t.$doCheck()),k(t.$onDestroy)&&m.$on("$destroy",function(){t.$onDestroy()})}),p=0,h=u.length;p<h;p++)g=u[p],we(g,g.isolateScope?$:o,A,O,g.require&&re(g.directiveName,g.require,A,b),w);var N=o;for(E&&(E.template||null===E.templateUrl)&&(N=$),e&&e(N,a.childNodes,void 0,f),p=c.length-1;p>=0;p--)g=c[p],we(g,g.isolateScope?$:o,A,O,g.require&&re(g.directiveName,g.require,A,b),w);r(b,function(e){var t=e.instance;k(t.$postLink)&&t.$postLink()})}f=f||{};for(var h,g,$,m,b,w=-Number.MAX_VALUE,x=f.newScopeDirective,_=f.controllerDirectives,E=f.newIsolateScopeDirective,S=f.templateDirective,A=f.nonTlbTranscludeDirective,O=!1,T=!1,j=f.hasElementTranscludeDirective,P=n.$$element=Jr(t),D=s,V=o,I=!1,N=!1,R=0,z=e.length;R<z;R++){h=e[R];var L=h.$$start,W=h.$$end;if(L&&(P=Q(t,L,W)),$=void 0,w>h.priority)break;if(b=h.scope,b&&(h.templateUrl||(y(b)?(pe("new/isolated scope",E||x,h,P),E=h):pe("new/isolated scope",E,h,P)),x=x||h),g=h.name,!I&&(h.replace&&(h.templateUrl||h.template)||h.transclude&&!h.$$tlb)){for(var G,X=R+1;G=e[X++];)if(G.transclude&&!G.$$tlb||G.replace&&(G.templateUrl||G.template)){N=!0;break}I=!0}if(!h.templateUrl&&h.controller&&(_=_||$e(),pe("'"+g+"' controller",_[g],h,P),_[g]=h),b=h.transclude)if(O=!0,h.$$tlb||(pe("transclusion",A,h,P),A=h),"element"===b)j=!0,w=h.priority,$=P,P=n.$$element=Jr(B.$$createComment(g,n[g])),t=P[0],ye(a,H($),t),$[0].$$parentNode=$[0].parentNode,V=te(N,$,o,w,D&&D.name,{nonTlbTranscludeDirective:A});else{var K=$e();if(y(b)){$=[];var Z=$e(),ne=$e();r(b,function(e,t){var n="?"===e.charAt(0);e=n?e.substring(1):e,Z[e]=t,K[t]=null,ne[t]=n}),r(P.contents(),function(e){var t=Z[xt(U(e))];t?(ne[t]=!0,K[t]=K[t]||[],K[t].push(e)):$.push(e)}),r(ne,function(e,t){if(!e)throw oo("reqslot","Required transclusion slot `{0}` was not filled.",t)});for(var ae in K)K[ae]&&(K[ae]=te(N,K[ae],o))}else $=Jr(Ve(t)).contents();P.empty(),V=te(N,$,o,void 0,void 0,{needsNewScope:h.$$isolateScope||h.$$newScope}),V.$$slots=K}if(h.template)if(T=!0,pe("template",S,h,P),S=h,b=k(h.template)?h.template(P,n):h.template,b=je(b),h.replace){if(D=h,$=Ce(b)?[]:kt(ge(h.templateNamespace,fi(b))),t=$[0],1!==$.length||t.nodeType!==bi)throw oo("tplrt","Template for directive '{0}' must have exactly one root element. {1}",g,"");ye(a,P,t);var se={$attr:{}},le=Y(t,[],se),fe=e.splice(R+1,e.length-(R+1));(E||x)&&oe(le,E,x),e=e.concat(le).concat(fe),ue(n,se),z=e.length}else P.html(b);if(h.templateUrl)T=!0,pe("template",S,h,P),S=h,h.replace&&(D=h),p=ce(e.splice(R,e.length-R),P,n,a,O&&V,u,c,{controllerDirectives:_,newScopeDirective:x!==h&&x,newIsolateScopeDirective:E,templateDirective:S,nonTlbTranscludeDirective:A}),z=e.length;else if(h.compile)try{m=h.compile(P,n,V);var de=h.$$originalDirective||h;k(m)?d(null,q(de,m),L,W):m&&d(q(de,m.pre),q(de,m.post),L,W)}catch(he){i(he,J(P))}h.terminal&&(p.terminal=!0,w=Math.max(w,h.priority))}return p.scope=x&&x.scope===!0,p.transcludeOnThisElement=O,p.templateOnThisElement=T,p.transclude=V,f.hasElementTranscludeDirective=j,p}function re(e,t,n,i){var o;if(w(t)){var a=t.match(E),s=t.substring(a[0].length),u=a[1]||a[3],l="?"===a[2];if("^^"===u?n=n.parent():(o=i&&i[s],o=o&&o.instance),!o){var c="$"+s+"Controller";o=u?n.inheritedData(c):n.data(c)}if(!o&&!l)throw oo("ctreq","Controller '{0}', required by directive '{1}', can't be found!",s,e)}else if(li(t)){o=[];for(var f=0,d=t.length;f<d;f++)o[f]=re(e,t[f],n,i)}else y(t)&&(o={},r(t,function(t,r){o[r]=re(e,t,n,i)}));return o||null}function ie(e,t,n,r,i,o,a){var s=$e();for(var l in r){var c=r[l],f={$scope:c===a||c.$$isolateScope?i:o,$element:e,$attrs:t,$transclude:n},d=c.controller;"@"===d&&(d=t[c.name]);var p=u(d,f,!0,c.controllerAs);s[c.name]=p,e.data("$"+c.name+"Controller",p.instance)}return s}function oe(e,t,n){for(var r=0,i=e.length;r<i;r++)e[r]=d(e[r],{$$isolateScope:t,$$newScope:n})}function ae(e,n,r,i,o,s,u){if(n===o)return null;
4
- var l=null;if(f.hasOwnProperty(n))for(var c,p=t.get(n+$),h=0,g=p.length;h<g;h++)if(c=p[h],(v(i)||i>c.priority)&&c.restrict.indexOf(r)!==-1){if(s&&(c=d(c,{$$start:s,$$end:u})),!c.$$bindings){var m=c.$$bindings=a(c,c.name);y(m.isolateScope)&&(c.$$isolateBindings=m.isolateScope)}e.push(c),l=c}return l}function se(e){if(f.hasOwnProperty(e))for(var n,r=t.get(e+$),i=0,o=r.length;i<o;i++)if(n=r[i],n.multiElement)return!0;return!1}function ue(e,t){var n=t.$attr,i=e.$attr;r(e,function(r,i){"$"!==i.charAt(0)&&(t[i]&&t[i]!==r&&(r.length?r+=("style"===i?";":" ")+t[i]:r=t[i]),e.$set(i,r,!0,n[i]))}),r(t,function(t,r){e.hasOwnProperty(r)||"$"===r.charAt(0)||(e[r]=t,"class"!==r&&"style"!==r&&(i[r]=n[r]))})}function ce(e,t,n,a,s,u,l,c){var f,h,g=[],$=t[0],v=e.shift(),m=d(v,{templateUrl:null,transclude:null,replace:null,$$originalDirective:v}),b=k(v.templateUrl)?v.templateUrl(t,n):v.templateUrl,w=v.templateNamespace;return t.empty(),o(b).then(function(i){var o,d,p,x;if(i=je(i),v.replace){if(p=Ce(i)?[]:kt(ge(w,fi(i))),o=p[0],1!==p.length||o.nodeType!==bi)throw oo("tplrt","Template for directive '{0}' must have exactly one root element. {1}",v.name,b);d={$attr:{}},ye(a,t,o);var _=Y(o,[],d);y(v.scope)&&oe(_,!0),e=_.concat(e),ue(n,d)}else o=$,t.html(i);for(e.unshift(m),f=ne(e,o,n,s,t,v,u,l,c),r(a,function(e,n){e===o&&(a[n]=t[0])}),h=G(t[0].childNodes,s);g.length;){var k=g.shift(),E=g.shift(),S=g.shift(),C=g.shift(),A=t[0];if(!k.$$destroyed){if(E!==$){var O=E.className;c.hasElementTranscludeDirective&&v.replace||(A=Ve(o)),ye(S,Jr(E),A),L(Jr(A),O)}x=f.transcludeOnThisElement?K(k,f.transclude,C):C,f(h,k,A,a,x)}}g=null})["catch"](function(e){e instanceof Error&&i(e)})["catch"](p),function(e,t,n,r,i){var o=i;t.$$destroyed||(g?g.push(t,n,r,o):(f.transcludeOnThisElement&&(o=K(t,f.transclude,i)),f(h,t,n,r,o)))}}function de(e,t){var n=t.priority-e.priority;return 0!==n?n:e.name!==t.name?e.name<t.name?-1:1:e.index-t.index}function pe(e,t,n,r){function i(e){return e?" (module: "+e+")":""}if(t)throw oo("multidir","Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}",t.name,i(t.$$moduleName),n.name,i(n.$$moduleName),e,J(r))}function he(e,t){var r=n(t,!0);r&&e.push({priority:0,compile:function(e){var t=e.parent(),n=!!t.length;return n&&B.$$addBindingClass(t),function(e,t){var i=t.parent();n||B.$$addBindingClass(i),B.$$addBindingInfo(i,r.expressions),e.$watch(r,function(e){t[0].nodeValue=e})}}})}function ge(t,n){switch(t=Wr(t||"html")){case"svg":case"math":var r=e.document.createElement("div");return r.innerHTML="<"+t+">"+n+"</"+t+">",r.childNodes[0].childNodes;default:return n}}function ve(e,t){if("srcdoc"===t)return g.HTML;var n=U(e);if("src"===t||"ngSrc"===t){if(["img","video","audio","source","track"].indexOf(n)===-1)return g.RESOURCE_URL}else if("xlinkHref"===t||"form"===n&&"action"===t||"link"===n&&"href"===t)return g.RESOURCE_URL}function me(e,t,r,i,o){var a=ve(e,i),s=!o,u=_[i]||o,l=n(r,s,a,u);if(l){if("multiple"===i&&"select"===U(e))throw oo("selmulti","Binding to the 'multiple' attribute is not supported. Element: {0}",J(e));if(S.test(i))throw oo("nodomevents","Interpolations for HTML DOM event attributes are disallowed. Please use the ng- versions (such as ng-click instead of onclick) instead.");t.push({priority:100,compile:function(){return{pre:function(e,t,o){var s=o.$$observers||(o.$$observers=$e()),c=o[i];c!==r&&(l=c&&n(c,!0,a,u),r=c),l&&(o[i]=l(e),(s[i]||(s[i]=[])).$$inter=!0,(o.$$observers&&o.$$observers[i].$$scope||e).$watch(l,function(e,t){"class"===i&&e!==t?o.$updateClass(e,t):o.$set(i,e)}))}}}})}}function ye(t,n,r){var i,o,a=n[0],s=n.length,u=a.parentNode;if(t)for(i=0,o=t.length;i<o;i++)if(t[i]===a){t[i++]=r;for(var l=i,c=l+s-1,f=t.length;l<f;l++,c++)c<f?t[l]=t[c]:delete t[l];t.length-=s-1,t.context===a&&(t.context=r);break}u&&u.replaceChild(r,a);var d=e.document.createDocumentFragment();for(i=0;i<s;i++)d.appendChild(n[i]);for(Jr.hasData(a)&&(Jr.data(r,Jr.data(a)),Jr(a).off("$destroy")),Jr.cleanData(d.querySelectorAll("*")),i=1;i<s;i++)delete n[i];n[0]=r,n.length=1}function be(e,t){return l(function(){return e.apply(null,arguments)},e,t)}function we(e,t,n,r,o,a){try{e(t,n,r,o,a)}catch(s){i(s,J(n))}}function xe(e,t,i,o,a){function u(t,n,r){!k(i.$onChanges)||n===r||n!==n&&r!==r||(_e||(e.$$postDigest(I),_e=[]),c||(c={},_e.push(l)),c[t]&&(r=c[t].previousValue),c[t]=new wt(r,n))}function l(){i.$onChanges(c),c=void 0}var c,f=[],d={};return r(o,function(r,o){var l,c,h,g,$,v=r.attrName,m=r.optional,y=r.mode;switch(y){case"@":m||Br.call(t,v)||(i[o]=t[v]=void 0),$=t.$observe(v,function(e){if(w(e)||T(e)){var t=i[o];u(o,e,t),i[o]=e}}),t.$$observers[v].$$scope=e,l=t[v],w(l)?i[o]=n(l)(e):T(l)&&(i[o]=l),d[o]=new wt(ao,i[o]),f.push($);break;case"=":if(!Br.call(t,v)){if(m)break;t[v]=void 0}if(m&&!t[v])break;c=s(t[v]),g=c.literal?z:function(e,t){return e===t||e!==e&&t!==t},h=c.assign||function(){throw l=i[o]=c(e),oo("nonassign","Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",t[v],v,a.name)},l=i[o]=c(e);var b=function(t){return g(t,i[o])||(g(t,l)?h(e,t=i[o]):i[o]=t),l=t};b.$stateful=!0,$=r.collection?e.$watchCollection(t[v],b):e.$watch(s(t[v],b),null,c.literal),f.push($);break;case"<":if(!Br.call(t,v)){if(m)break;t[v]=void 0}if(m&&!t[v])break;c=s(t[v]);var x=c.literal,_=i[o]=c(e);d[o]=new wt(ao,i[o]),$=e.$watch(c,function(e,t){if(t===e){if(t===_||x&&z(t,_))return;t=_}u(o,e,t),i[o]=e},x),f.push($);break;case"&":if(c=t.hasOwnProperty(v)?s(t[v]):p,c===p&&m)break;i[o]=function(t){return c(e,t)}}}),{initialChanges:d,removeWatches:f.length&&function(){for(var e=0,t=f.length;e<t;++e)f[e]()}}}var _e,ke=/^\w/,Ee=e.document.createElement("div"),Se=P,Ae=D,Oe=j;F.prototype={$normalize:xt,$addClass:function(e){e&&e.length>0&&A.addClass(this.$$element,e)},$removeClass:function(e){e&&e.length>0&&A.removeClass(this.$$element,e)},$updateClass:function(e,t){var n=_t(e,t);n&&n.length&&A.addClass(this.$$element,n);var r=_t(t,e);r&&r.length&&A.removeClass(this.$$element,r)},$set:function(e,t,n,o){var a,s=this.$$element[0],u=Je(s,e),l=Ze(e),c=e;if(u?(this.$$element.prop(e,t),o=u):l&&(this[l]=t,c=l),this[e]=t,o?this.$attr[e]=o:(o=this.$attr[e],o||(this.$attr[e]=o=le(e,"-"))),a=U(this.$$element),"a"===a&&("href"===e||"xlinkHref"===e)||"img"===a&&"src"===e)this[e]=t=V(t,"src"===e);else if("img"===a&&"srcset"===e&&m(t)){for(var f="",d=fi(t),p=/(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/,h=/\s/.test(d)?p:/(,)/,g=d.split(h),$=Math.floor(g.length/2),y=0;y<$;y++){var b=2*y;f+=V(fi(g[b]),!0),f+=" "+fi(g[b+1])}var w=fi(g[2*y]).split(/\s/);f+=V(fi(w[0]),!0),2===w.length&&(f+=" "+fi(w[1])),this[e]=t=f}n!==!1&&(null===t||v(t)?this.$$element.removeAttr(o):ke.test(o)?this.$$element.attr(o,t):R(this.$$element[0],o,t));var x=this.$$observers;x&&r(x[c],function(e){try{e(t)}catch(n){i(n)}})},$observe:function(e,t){var n=this,r=n.$$observers||(n.$$observers=$e()),i=r[e]||(r[e]=[]);return i.push(t),c.$evalAsync(function(){i.$$inter||!n.hasOwnProperty(e)||v(n[e])||t(n[e])}),function(){N(i,t)}}};var Me=n.startSymbol(),Te=n.endSymbol(),je="{{"===Me&&"}}"===Te?h:function(e){return e.replace(/\{\{/g,Me).replace(/}}/g,Te)},Pe=/^ngAttr[A-Z]/,De=/^(.+)Start$/;return B.$$addBindingInfo=O?function(e,t){var n=e.data("$binding")||[];li(t)?n=n.concat(t):n.push(t),e.data("$binding",n)}:p,B.$$addBindingClass=O?function(e){L(e,"ng-binding")}:p,B.$$addScopeInfo=O?function(e,t,n,r){var i=n?r?"$isolateScopeNoTemplate":"$isolateScope":"$scope";e.data(i,t)}:p,B.$$addScopeClass=O?function(e,t){L(e,t?"ng-isolate-scope":"ng-scope")}:p,B.$$createComment=function(t,n){var r="";return O&&(r=" "+(t||"")+": ",n&&(r+=n+" ")),e.document.createComment(r)},B}]}function wt(e,t){this.previousValue=e,this.currentValue=t}function xt(e){return e.replace(so,"").replace(uo,Ee)}function _t(e,t){var n="",r=e.split(/\s+/),i=t.split(/\s+/);e:for(var o=0;o<r.length;o++){for(var a=r[o],s=0;s<i.length;s++)if(a===i[s])continue e;n+=(n.length>0?" ":"")+a}return n}function kt(e){e=Jr(e);var t=e.length;if(t<=1)return e;for(;t--;){var n=e[t];(n.nodeType===_i||n.nodeType===xi&&""===n.nodeValue.trim())&&ti.call(e,t,1)}return e}function Et(e,t){if(t&&w(t))return t;if(w(e)){var n=co.exec(e);if(n)return n[3]}}function St(){var e={},n=!1;this.has=function(t){return e.hasOwnProperty(t)},this.register=function(t,n){pe(t,"controller"),y(t)?l(e,t):e[t]=n},this.allowGlobals=function(){n=!0},this.$get=["$injector","$window",function(r,i){function o(e,n,r,i){if(!e||!y(e.$scope))throw t("$controller")("noscp","Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",i,n);e.$scope[n]=r}return function(t,a,s,u){var c,f,d,p;if(s=s===!0,u&&w(u)&&(p=u),w(t)){if(f=t.match(co),!f)throw lo("ctrlfmt","Badly formed controller string '{0}'. Must match `__name__ as __id__` or `__name__`.",t);if(d=f[1],p=p||f[3],t=e.hasOwnProperty(d)?e[d]:he(a.$scope,d,!0)||(n?he(i,d,!0):void 0),!t)throw lo("ctrlreg","The controller with the name '{0}' is not registered.",d);de(t,d,!0)}if(s){var h=(li(t)?t[t.length-1]:t).prototype;return c=Object.create(h||null),p&&o(a,p,c,d||t.name),l(function(){var e=r.invoke(t,c,a,d);return e!==c&&(y(e)||k(e))&&(c=e,p&&o(a,p,c,d||t.name)),c},{instance:c,identifier:p})}return c=r.instantiate(t,a,d),p&&o(a,p,c,d||t.name),c}}]}function Ct(){this.$get=["$window",function(e){return Jr(e.document)}]}function At(){this.$get=["$document","$rootScope",function(e,t){function n(){i=r.hidden}var r=e[0],i=r&&r.hidden;return e.on("visibilitychange",n),t.$on("$destroy",function(){e.off("visibilitychange",n)}),function(){return i}}]}function Ot(){this.$get=["$log",function(e){return function(t,n){e.error.apply(e,arguments)}}]}function Mt(e){return y(e)?_(e)?e.toISOString():W(e):e}function Tt(){this.$get=function(){return function(e){if(!e)return"";var t=[];return i(e,function(e,n){null===e||v(e)||(li(e)?r(e,function(e){t.push(ne(n)+"="+ne(Mt(e)))}):t.push(ne(n)+"="+ne(Mt(e))))}),t.join("&")}}}function jt(){this.$get=function(){return function(e){function t(e,o,a){null===e||v(e)||(li(e)?r(e,function(e,n){t(e,o+"["+(y(e)?n:"")+"]")}):y(e)&&!_(e)?i(e,function(e,n){t(e,o+(a?"":"[")+n+(a?"":"]"))}):n.push(ne(o)+"="+ne(Mt(e))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function Pt(e,t){if(w(e)){var n=e.replace(vo,"").trim();if(n){var r=t("Content-Type");(r&&0===r.indexOf(po)||Dt(n))&&(e=G(n))}}return e}function Dt(e){var t=e.match(go);return t&&$o[t[0]].test(e)}function Vt(e){function t(e,t){e&&(i[e]=i[e]?i[e]+", "+t:t)}var n,i=$e();return w(e)?r(e.split("\n"),function(e){n=e.indexOf(":"),t(Wr(fi(e.substr(0,n))),fi(e.substr(n+1)))}):y(e)&&r(e,function(e,n){t(Wr(n),fi(e))}),i}function It(e){var t;return function(n){if(t||(t=Vt(e)),n){var r=t[Wr(n)];return void 0===r&&(r=null),r}return t}}function Ut(e,t,n,i){return k(i)?i(e,t,n):(r(i,function(r){e=r(e,t,n)}),e)}function Ft(e){return 200<=e&&e<300}function Nt(){var e=this.defaults={transformResponse:[Pt],transformRequest:[function(e){return!y(e)||A(e)||M(e)||O(e)?e:W(e)}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ye(ho),put:ye(ho),patch:ye(ho)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer",jsonpCallbackParam:"callback"},n=!1;this.useApplyAsync=function(e){return m(e)?(n=!!e,this):n};var i=this.interceptors=[];this.$get=["$browser","$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector","$sce",function(o,a,s,u,c,f,d,h){function g(n){function i(e,t){for(var n=0,r=t.length;n<r;){var i=t[n++],o=t[n++];e=e.then(i,o)}return t.length=0,e}function a(){o.$$completeOutstandingRequest(p)}function s(e,t){var n,i={};return r(e,function(e,r){k(e)?(n=e(t),null!=n&&(i[r]=n)):i[r]=e}),i}function u(t){var n,r,i,o=e.headers,a=l({},t.headers);o=l({},o.common,o[Wr(t.method)]);e:for(n in o){r=Wr(n);for(i in a)if(Wr(i)===r)continue e;a[n]=o[n]}return s(a,ye(t))}function c(t){var n=t.headers,i=Ut(t.data,It(n),void 0,t.transformRequest);return v(i)&&r(n,function(e,t){"content-type"===Wr(t)&&delete n[t]}),v(t.withCredentials)&&!v(e.withCredentials)&&(t.withCredentials=e.withCredentials),x(t,i).then(g,g)}function g(e){var t=l({},e);return t.data=Ut(e.data,e.headers,e.status,$.transformResponse),Ft(e.status)?t:f.reject(t)}if(!y(n))throw t("$http")("badreq","Http request configuration must be an object. Received: {0}",n);if(!w(h.valueOf(n.url)))throw t("$http")("badreq","Http request configuration url must be a string or a $sce trusted object. Received: {0}",n.url);var $=l({method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse,paramSerializer:e.paramSerializer,jsonpCallbackParam:e.jsonpCallbackParam},n);$.headers=u(n),$.method=Gr($.method),$.paramSerializer=w($.paramSerializer)?d.get($.paramSerializer):$.paramSerializer,o.$$incOutstandingRequestCount();var m=[],b=[],_=f.resolve($);return r(C,function(e){(e.request||e.requestError)&&m.unshift(e.request,e.requestError),(e.response||e.responseError)&&b.push(e.response,e.responseError)}),_=i(_,m),_=_.then(c),_=i(_,b),_=_["finally"](a)}function $(e){r(arguments,function(e){g[e]=function(t,n){return g(l({},n||{},{method:e,url:t}))}})}function b(e){r(arguments,function(e){g[e]=function(t,n,r){return g(l({},r||{},{method:e,url:t,data:n}))}})}function x(t,i){function o(e){if(e){var t={};return r(e,function(e,r){t[r]=function(t){function r(){e(t)}n?c.$applyAsync(r):c.$$phase?r():c.$apply(r)}}),t}}function u(e,t,r,i){function o(){l(t,e,r,i)}$&&(Ft(e)?$.put(O,[e,t,Vt(r),i]):$.remove(O)),n?c.$applyAsync(o):(o(),c.$$phase||c.$apply())}function l(e,n,r,i){n=n>=-1?n:0,(Ft(n)?x.resolve:x.reject)({data:e,status:n,headers:It(r),config:t,statusText:i})}function d(e){l(e.data,e.status,ye(e.headers()),e.statusText)}function p(){var e=g.pendingRequests.indexOf(t);e!==-1&&g.pendingRequests.splice(e,1)}var $,b,x=f.defer(),k=x.promise,C=t.headers,A="jsonp"===Wr(t.method),O=t.url;if(A?O=h.getTrustedResourceUrl(O):w(O)||(O=h.valueOf(O)),O=_(O,t.paramSerializer(t.params)),A&&(O=E(O,t.jsonpCallbackParam)),g.pendingRequests.push(t),k.then(p,p),!t.cache&&!e.cache||t.cache===!1||"GET"!==t.method&&"JSONP"!==t.method||($=y(t.cache)?t.cache:y(e.cache)?e.cache:S),$&&(b=$.get(O),m(b)?j(b)?b.then(d,d):li(b)?l(b[1],b[0],ye(b[2]),b[3]):l(b,200,{},"OK"):$.put(O,k)),v(b)){var M=Fn(t.url)?s()[t.xsrfCookieName||e.xsrfCookieName]:void 0;M&&(C[t.xsrfHeaderName||e.xsrfHeaderName]=M),a(t.method,O,i,u,C,t.timeout,t.withCredentials,t.responseType,o(t.eventHandlers),o(t.uploadEventHandlers))}return k}function _(e,t){return t.length>0&&(e+=(e.indexOf("?")===-1?"?":"&")+t),e}function E(e,t){if(/[&?][^=]+=JSON_CALLBACK/.test(e))throw mo("badjsonp",'Illegal use of JSON_CALLBACK in url, "{0}"',e);var n=new RegExp("[&?]"+t+"=");if(n.test(e))throw mo("badjsonp",'Illegal use of callback param, "{0}", in url, "{1}"',t,e);return e+=(e.indexOf("?")===-1?"?":"&")+t+"=JSON_CALLBACK"}var S=u("$http");e.paramSerializer=w(e.paramSerializer)?d.get(e.paramSerializer):e.paramSerializer;var C=[];return r(i,function(e){C.unshift(w(e)?d.get(e):d.invoke(e))}),g.pendingRequests=[],$("get","delete","head","jsonp"),b("post","put","patch"),g.defaults=e,g}]}function Rt(){this.$get=function(){return function(){return new e.XMLHttpRequest}}}function zt(){this.$get=["$browser","$jsonpCallbacks","$document","$xhrFactory",function(e,t,n,r){return Lt(e,r,e.defer,t,n[0])}]}function Lt(e,t,n,i,o){function a(e,t,n){e=e.replace("JSON_CALLBACK",t);var r=o.createElement("script"),a=null;return r.type="text/javascript",r.src=e,r.async=!0,a=function(e){r.removeEventListener("load",a),r.removeEventListener("error",a),o.body.removeChild(r),r=null;var s=-1,u="unknown";e&&("load"!==e.type||i.wasCalled(t)||(e={type:"error"}),u=e.type,s="error"===e.type?404:200),n&&n(s,u)},r.addEventListener("load",a),r.addEventListener("error",a),o.body.appendChild(r),a}return function(o,s,u,l,c,f,d,p,h,g){function $(){w&&w(),x&&x.abort()}function y(e,t,r,i,o){m(E)&&n.cancel(E),w=x=null,e(t,r,i,o)}if(s=s||e.url(),"jsonp"===Wr(o))var b=i.createCallback(s),w=a(s,b,function(e,t){var n=200===e&&i.getResponse(b);y(l,e,n,"",t),i.removeCallback(b)});else{var x=t(o,s);x.open(o,s,!0),r(c,function(e,t){m(e)&&x.setRequestHeader(t,e)}),x.onload=function(){var e=x.statusText||"",t="response"in x?x.response:x.responseText,n=1223===x.status?204:x.status;0===n&&(n=t?200:"file"===Un(s).protocol?404:0),y(l,n,t,x.getAllResponseHeaders(),e)};var _=function(){y(l,-1,null,null,"")};if(x.onerror=_,x.onabort=_,x.ontimeout=_,r(h,function(e,t){x.addEventListener(t,e)}),r(g,function(e,t){x.upload.addEventListener(t,e)}),d&&(x.withCredentials=!0),p)try{x.responseType=p}catch(k){if("json"!==p)throw k}x.send(v(u)?null:u)}if(f>0)var E=n($,f);else j(f)&&f.then($)}}function Ht(){var e="{{",t="}}";this.startSymbol=function(t){return t?(e=t,this):e},this.endSymbol=function(e){return e?(t=e,this):t},this.$get=["$parse","$exceptionHandler","$sce",function(n,r,i){function o(e){return"\\\\\\"+e}function a(n){return n.replace(d,e).replace(p,t)}function s(e,t,n,r){var i=e.$watch(function(e){return i(),r(e)},t,n);return i}function u(o,u,d,p){function h(e){try{return e=T(e),p&&!m(e)?e:ve(e)}catch(t){r(yo.interr(o,t))}}if(!o.length||o.indexOf(e)===-1){var $;if(!u){var y=a(o);$=g(y),$.exp=o,$.expressions=[],$.$$watchDelegate=s}return $}p=!!p;for(var b,w,x,_=0,E=[],S=[],C=o.length,A=[],O=[];_<C;){if((b=o.indexOf(e,_))===-1||(w=o.indexOf(t,b+c))===-1){_!==C&&A.push(a(o.substring(_)));break}_!==b&&A.push(a(o.substring(_,b))),x=o.substring(b+c,w),E.push(x),S.push(n(x,h)),_=w+f,O.push(A.length),A.push("")}if(d&&A.length>1&&yo.throwNoconcat(o),!u||E.length){var M=function(e){for(var t=0,n=E.length;t<n;t++){if(p&&v(e[t]))return;A[O[t]]=e[t]}return A.join("")},T=function(e){return d?i.getTrusted(d,e):i.valueOf(e)};return l(function(e){var t=0,n=E.length,i=new Array(n);try{for(;t<n;t++)i[t]=S[t](e);return M(i)}catch(a){r(yo.interr(o,a))}},{exp:o,expressions:E,$$watchDelegate:function(e,t){var n;return e.$watchGroup(S,function(r,i){var o=M(r);k(t)&&t.call(this,o,r!==i?n:o,e),n=o})}})}}var c=e.length,f=t.length,d=new RegExp(e.replace(/./g,o),"g"),p=new RegExp(t.replace(/./g,o),"g");return u.startSymbol=function(){return e},u.endSymbol=function(){return t},u}]}function qt(){this.$get=["$rootScope","$window","$q","$$q","$browser",function(e,t,n,r,i){function o(o,s,u,l){function c(){f?o.apply(null,d):o(g)}var f=arguments.length>4,d=f?H(arguments,4):[],p=t.setInterval,h=t.clearInterval,g=0,$=m(l)&&!l,v=($?r:n).defer(),y=v.promise;return u=m(u)?u:0,y.$$intervalId=p(function(){$?i.defer(c):e.$evalAsync(c),v.notify(g++),u>0&&g>=u&&(v.resolve(g),h(y.$$intervalId),delete a[y.$$intervalId]),$||e.$apply()},s),a[y.$$intervalId]=v,y}var a={};return o.cancel=function(e){return!!(e&&e.$$intervalId in a)&&(a[e.$$intervalId].promise["catch"](p),a[e.$$intervalId].reject("canceled"),t.clearInterval(e.$$intervalId),delete a[e.$$intervalId],!0)},o}]}function Bt(e){for(var t=e.split("/"),n=t.length;n--;)t[n]=te(t[n]);return t.join("/")}function Wt(e,t){var n=Un(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=f(n.port)||xo[n.protocol]||null}function Gt(e,t){if(ko.test(e))throw _o("badpath",'Invalid url "{0}".',e);var n="/"!==e.charAt(0);n&&(e="/"+e);var r=Un(e);t.$$path=decodeURIComponent(n&&"/"===r.pathname.charAt(0)?r.pathname.substring(1):r.pathname),t.$$search=Q(r.search),t.$$hash=decodeURIComponent(r.hash),t.$$path&&"/"!==t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function Xt(e,t){return e.slice(0,t.length)===t}function Kt(e,t){if(Xt(t,e))return t.substr(e.length)}function Yt(e){var t=e.indexOf("#");return t===-1?e:e.substr(0,t)}function Jt(e){return e.replace(/(#.+)|#$/,"$1")}function Zt(e){return e.substr(0,Yt(e).lastIndexOf("/")+1)}function Qt(e){return e.substring(0,e.indexOf("/",e.indexOf("//")+2))}function en(e,t,n){this.$$html5=!0,n=n||"",Wt(e,this),this.$$parse=function(e){var n=Kt(t,e);if(!w(n))throw _o("ipthprfx",'Invalid url "{0}", missing path prefix "{1}".',e,t);Gt(n,this),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=ee(this.$$search),n=this.$$hash?"#"+te(this.$$hash):"";this.$$url=Bt(this.$$path)+(e?"?"+e:"")+n,this.$$absUrl=t+this.$$url.substr(1)},this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a,s;return m(o=Kt(e,r))?(a=o,s=n&&m(o=Kt(n,o))?t+(Kt("/",o)||o):e+a):m(o=Kt(t,r))?s=t+o:t===r+"/"&&(s=t),s&&this.$$parse(s),!!s}}function tn(e,t,n){Wt(e,this),this.$$parse=function(r){function i(e,t,n){var r,i=/^\/[A-Z]:(\/.*)/;return Xt(t,n)&&(t=t.replace(n,"")),i.exec(t)?e:(r=i.exec(e),r?r[1]:e)}var o,a=Kt(e,r)||Kt(t,r);v(a)||"#"!==a.charAt(0)?this.$$html5?o=a:(o="",v(a)&&(e=r,this.replace())):(o=Kt(n,a),v(o)&&(o=a)),Gt(o,this),this.$$path=i(this.$$path,o,e),this.$$compose()},this.$$compose=function(){var t=ee(this.$$search),r=this.$$hash?"#"+te(this.$$hash):"";this.$$url=Bt(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+(this.$$url?n+this.$$url:"")},this.$$parseLinkUrl=function(t,n){return Yt(e)===Yt(t)&&(this.$$parse(t),!0)}}function nn(e,t,n){this.$$html5=!0,tn.apply(this,arguments),this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return e===Yt(r)?o=r:(a=Kt(t,r))?o=e+n+a:t===r+"/"&&(o=t),o&&this.$$parse(o),!!o},this.$$compose=function(){var t=ee(this.$$search),r=this.$$hash?"#"+te(this.$$hash):"";this.$$url=Bt(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+n+this.$$url}}function rn(e){return function(){return this[e]}}function on(e,t){return function(n){return v(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function an(){var e="!",t={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(t){return m(t)?(e=t,this):e},this.html5Mode=function(e){return T(e)?(t.enabled=e,this):y(e)?(T(e.enabled)&&(t.enabled=e.enabled),T(e.requireBase)&&(t.requireBase=e.requireBase),(T(e.rewriteLinks)||w(e.rewriteLinks))&&(t.rewriteLinks=e.rewriteLinks),this):t},this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(n,r,i,o,a){function s(e,t,n){var i=l.url(),o=l.$$state;try{r.url(e,t,n),l.$$state=r.state()}catch(a){throw l.url(i),l.$$state=o,a}}function u(e,t){n.$broadcast("$locationChangeSuccess",l.absUrl(),e,l.$$state,t)}var l,c,f,d=r.baseHref(),p=r.url();if(t.enabled){if(!d&&t.requireBase)throw _o("nobase","$location in HTML5 mode requires a <base> tag to be present!");f=Qt(p)+(d||"/"),c=i.history?en:nn}else f=Yt(p),c=tn;var h=Zt(f);l=new c(f,h,"#"+e),l.$$parseLinkUrl(p,p),l.$$state=r.state();var g=/^\s*(javascript|mailto):/i;o.on("click",function(e){var i=t.rewriteLinks;if(i&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&2!==e.which&&2!==e.button){for(var s=Jr(e.target);"a"!==U(s[0]);)if(s[0]===o[0]||!(s=s.parent())[0])return;if(!w(i)||!v(s.attr(i))){var u=s.prop("href"),c=s.attr("href")||s.attr("xlink:href");y(u)&&"[object SVGAnimatedString]"===u.toString()&&(u=Un(u.animVal).href),g.test(u)||!u||s.attr("target")||e.isDefaultPrevented()||l.$$parseLinkUrl(u,c)&&(e.preventDefault(),l.absUrl()!==r.url()&&(n.$apply(),a.angular["ff-684208-preventDefault"]=!0))}}}),Jt(l.absUrl())!==Jt(p)&&r.url(l.absUrl(),!0);var $=!0;return r.onUrlChange(function(e,t){return Xt(e,h)?(n.$evalAsync(function(){var r,i=l.absUrl(),o=l.$$state;e=Jt(e),l.$$parse(e),l.$$state=t,r=n.$broadcast("$locationChangeStart",e,i,t,o).defaultPrevented,l.absUrl()===e&&(r?(l.$$parse(i),l.$$state=o,s(i,!1,o)):($=!1,u(i,o)))}),void(n.$$phase||n.$digest())):void(a.location.href=e)}),n.$watch(function(){var e=Jt(r.url()),t=Jt(l.absUrl()),o=r.state(),a=l.$$replace,c=e!==t||l.$$html5&&i.history&&o!==l.$$state;($||c)&&($=!1,n.$evalAsync(function(){var t=l.absUrl(),r=n.$broadcast("$locationChangeStart",t,e,l.$$state,o).defaultPrevented;l.absUrl()===t&&(r?(l.$$parse(e),l.$$state=o):(c&&s(t,a,o===l.$$state?null:l.$$state),u(e,o)))})),l.$$replace=!1}),l}]}function sn(){var e=!0,t=this;this.debugEnabled=function(t){return m(t)?(e=t,this):e},this.$get=["$window",function(n){function i(e){return e instanceof Error&&(e.stack?e=e.message&&e.stack.indexOf(e.message)===-1?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function o(e){var t=n.console||{},o=t[e]||t.log||p,a=!1;try{a=!!o.apply}catch(s){}return a?function(){var e=[];return r(arguments,function(t){e.push(i(t))}),o.apply(t,e)}:function(e,t){o(e,null==t?"":t)}}return{log:o("log"),info:o("info"),warn:o("warn"),error:o("error"),debug:function(){var n=o("debug");return function(){e&&n.apply(t,arguments)}}()}}]}function un(e){return e+""}function ln(e,t){return"undefined"!=typeof e?e:t}function cn(e,t){return"undefined"==typeof e?t:"undefined"==typeof t?e:e+t}function fn(e,t){var n=e(t);return!n.$stateful}function dn(e,t){var n,i,o;switch(e.type){case To.Program:n=!0,r(e.body,function(e){dn(e.expression,t),n=n&&e.expression.constant}),e.constant=n;break;case To.Literal:e.constant=!0,e.toWatch=[];break;case To.UnaryExpression:dn(e.argument,t),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case To.BinaryExpression:dn(e.left,t),dn(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case To.LogicalExpression:dn(e.left,t),dn(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case To.ConditionalExpression:dn(e.test,t),dn(e.alternate,t),dn(e.consequent,t),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case To.Identifier:e.constant=!1,e.toWatch=[e];break;case To.MemberExpression:dn(e.object,t),e.computed&&dn(e.property,t),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=[e];break;case To.CallExpression:o=!!e.filter&&fn(t,e.callee.name),n=o,i=[],r(e.arguments,function(e){dn(e,t),n=n&&e.constant,e.constant||i.push.apply(i,e.toWatch)}),e.constant=n,e.toWatch=o?i:[e];break;case To.AssignmentExpression:dn(e.left,t),dn(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case To.ArrayExpression:n=!0,i=[],r(e.elements,function(e){dn(e,t),n=n&&e.constant,e.constant||i.push.apply(i,e.toWatch)}),e.constant=n,e.toWatch=i;break;case To.ObjectExpression:n=!0,i=[],r(e.properties,function(e){dn(e.value,t),n=n&&e.value.constant&&!e.computed,e.value.constant||i.push.apply(i,e.value.toWatch)}),e.constant=n,e.toWatch=i;break;case To.ThisExpression:e.constant=!1,e.toWatch=[];break;case To.LocalsExpression:e.constant=!1,e.toWatch=[]}}function pn(e){if(1===e.length){var t=e[0].expression,n=t.toWatch;return 1!==n.length?n:n[0]!==t?n:void 0}}function hn(e){return e.type===To.Identifier||e.type===To.MemberExpression}function gn(e){if(1===e.body.length&&hn(e.body[0].expression))return{type:To.AssignmentExpression,left:e.body[0].expression,right:{type:To.NGValueParameter},operator:"="}}function $n(e){return 0===e.body.length||1===e.body.length&&(e.body[0].expression.type===To.Literal||e.body[0].expression.type===To.ArrayExpression||e.body[0].expression.type===To.ObjectExpression)}function vn(e){return e.constant}function mn(e,t){this.astBuilder=e,this.$filter=t}function yn(e,t){this.astBuilder=e,this.$filter=t}function bn(e){return k(e.valueOf)?e.valueOf():Co.call(e)}function wn(){var e,t,n=$e(),i={"true":!0,"false":!1,"null":null,undefined:void 0};this.addLiteral=function(e,t){i[e]=t},this.setIdentifierFns=function(n,r){return e=n,t=r,this},this.$get=["$filter",function(o){function a(e,t){var r,i,a;switch(typeof e){case"string":if(e=e.trim(),a=e,r=n[a],!r){":"===e.charAt(0)&&":"===e.charAt(1)&&(i=!0,e=e.substring(2));var s=new Mo(g),h=new jo(s,o,g);r=h.parse(e),r.constant?r.$$watchDelegate=f:i?r.$$watchDelegate=r.literal?c:l:r.inputs&&(r.$$watchDelegate=u),n[a]=r}return d(r,t);case"function":return d(e,t);default:return d(p,t)}}function s(e,t){return null==e||null==t?e===t:("object"!=typeof e||(e=bn(e),"object"!=typeof e))&&(e===t||e!==e&&t!==t)}function u(e,t,n,r,i){var o,a=r.inputs;if(1===a.length){var u=s;return a=a[0],e.$watch(function(e){var t=a(e);return s(t,u)||(o=r(e,void 0,void 0,[t]),u=t&&bn(t)),o},t,n,i)}for(var l=[],c=[],f=0,d=a.length;f<d;f++)l[f]=s,c[f]=null;return e.$watch(function(e){for(var t=!1,n=0,i=a.length;n<i;n++){var u=a[n](e);(t||(t=!s(u,l[n])))&&(c[n]=u,l[n]=u&&bn(u))}return t&&(o=r(e,void 0,void 0,c)),o},t,n,i)}function l(e,t,n,r,i){function o(e){return r(e)}function a(e,n,r){l=e,k(t)&&t(e,n,r),m(e)&&r.$$postDigest(function(){m(l)&&s()})}var s,l;return s=r.inputs?u(e,a,n,r,i):e.$watch(o,a,n)}function c(e,t,n,i){function o(e){var t=!0;return r(e,function(e){m(e)||(t=!1)}),t}var a,s;return a=e.$watch(function(e){return i(e)},function(e,n,r){s=e,k(t)&&t(e,n,r),o(e)&&r.$$postDigest(function(){o(s)&&a()})},n)}function f(e,t,n,r){var i=e.$watch(function(e){return i(),r(e)},t,n);return i}function d(e,t){if(!t)return e;var n=e.$$watchDelegate,r=!1,i=n!==c&&n!==l,o=i?function(n,i,o,a){var s=r&&a?a[0]:e(n,i,o,a);return t(s,n,i)}:function(n,r,i,o){var a=e(n,r,i,o),s=t(a,n,r);return m(a)?s:a};return r=!e.inputs,e.$$watchDelegate&&e.$$watchDelegate!==u?(o.$$watchDelegate=e.$$watchDelegate,o.inputs=e.inputs):t.$stateful||(o.$$watchDelegate=u,o.inputs=e.inputs?e.inputs:[e]),o}var h=pi().noUnsafeEval,g={csp:h,literals:R(i),isIdentifierStart:k(e)&&e,isIdentifierContinue:k(t)&&t};return a}]}function xn(){var e=!0;this.$get=["$rootScope","$exceptionHandler",function(t,n){return kn(function(e){t.$evalAsync(e)},n,e)}],this.errorOnUnhandledRejections=function(t){return m(t)?(e=t,this):e}}function _n(){var e=!0;this.$get=["$browser","$exceptionHandler",function(t,n){return kn(function(e){t.defer(e)},n,e)}],this.errorOnUnhandledRejections=function(t){return m(t)?(e=t,this):e}}function kn(e,n,i){function o(){return new a}function a(){var e=this.promise=new s;this.resolve=function(t){d(e,t)},this.reject=function(t){h(e,t)},this.notify=function(t){$(e,t)}}function s(){this.$$state={status:0}}function u(t){var n,r,o;o=t.pending,t.processScheduled=!1,t.pending=void 0;try{for(var a=0,s=o.length;a<s;++a){t.pur=!0,r=o[a][0],n=o[a][t.status];try{k(n)?d(r,n(t.value)):1===t.status?d(r,t.value):h(r,t.value)}catch(u){h(r,u)}}}finally{--C,i&&0===C&&e(c)}}function c(){for(;!C&&A.length;){var e=A.shift();if(!e.pur){e.pur=!0;var t="Possibly unhandled rejection: "+we(e.value);e.value instanceof Error?n(e.value,t):n(t)}}}function f(t){!i||t.pending||2!==t.status||t.pur||(0===C&&0===A.length&&e(c),A.push(t)),!t.processScheduled&&t.pending&&(t.processScheduled=!0,++C,e(function(){u(t)}))}function d(e,t){e.$$state.status||(t===e?g(e,S("qcycle","Expected promise to be resolved with value other than itself '{0}'",t)):p(e,t))}function p(e,t){function n(t){a||(a=!0,p(e,t))}function r(t){a||(a=!0,g(e,t))}function i(t){$(e,t)}var o,a=!1;try{(y(t)||k(t))&&(o=t.then),k(o)?(e.$$state.status=-1,o.call(t,n,r,i)):(e.$$state.value=t,e.$$state.status=1,f(e.$$state))}catch(s){r(s)}}function h(e,t){e.$$state.status||g(e,t)}function g(e,t){e.$$state.value=t,e.$$state.status=2,f(e.$$state)}function $(t,r){var i=t.$$state.pending;t.$$state.status<=0&&i&&i.length&&e(function(){for(var e,t,o=0,a=i.length;o<a;o++){t=i[o][0],e=i[o][3];try{$(t,k(e)?e(r):r)}catch(s){n(s)}}})}function m(e){var t=new s;return h(t,e),t}function b(e,t,n){var r=null;try{k(n)&&(r=n())}catch(i){return m(i)}return j(r)?r.then(function(){return t(e)},m):t(e)}function w(e,t,n,r){var i=new s;return d(i,e),i.then(t,n,r)}function x(e){var t=new s,n=0,i=li(e)?[]:{};return r(e,function(e,r){n++,w(e).then(function(e){i[r]=e,--n||d(t,i)},function(e){h(t,e)})}),0===n&&d(t,i),t}function _(e){var t=o();return r(e,function(e){w(e).then(t.resolve,t.reject)}),t.promise}function E(e){function t(e){d(r,e)}function n(e){h(r,e)}if(!k(e))throw S("norslvr","Expected resolverFn, got '{0}'",e);var r=new s;return e(t,n),r}var S=t("$q",TypeError),C=0,A=[];l(s.prototype,{then:function(e,t,n){if(v(e)&&v(t)&&v(n))return this;var r=new s;return this.$$state.pending=this.$$state.pending||[],this.$$state.pending.push([r,e,t,n]),this.$$state.status>0&&f(this.$$state),r},"catch":function(e){return this.then(null,e)},"finally":function(e,t){return this.then(function(t){return b(t,O,e);
5
- },function(t){return b(t,m,e)},t)}});var O=w;return E.prototype=s.prototype,E.defer=o,E.reject=m,E.when=w,E.resolve=O,E.all=x,E.race=_,E}function En(){this.$get=["$window","$timeout",function(e,t){var n=e.requestAnimationFrame||e.webkitRequestAnimationFrame,r=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.webkitCancelRequestAnimationFrame,i=!!n,o=i?function(e){var t=n(e);return function(){r(t)}}:function(e){var n=t(e,16.66,!1);return function(){t.cancel(n)}};return o.supported=i,o}]}function Sn(){function e(e){function t(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$id=a(),this.$$ChildScope=null}return t.prototype=e,t}var i=10,o=t("$rootScope"),s=null,u=null;this.digestTtl=function(e){return arguments.length&&(i=e),i},this.$get=["$exceptionHandler","$parse","$browser",function(t,l,c){function f(e){e.currentScope.$$destroyed=!0}function d(e){9===Yr&&(e.$$childHead&&d(e.$$childHead),e.$$nextSibling&&d(e.$$nextSibling)),e.$parent=e.$$nextSibling=e.$$prevSibling=e.$$childHead=e.$$childTail=e.$root=e.$$watchers=null}function h(){this.$id=a(),this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null,this.$root=this,this.$$destroyed=!1,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$$isolateBindings=null}function g(e){if(E.$$phase)throw o("inprog","{0} already in progress",E.$$phase);E.$$phase=e}function $(){E.$$phase=null}function m(e,t){do e.$$watchersCount+=t;while(e=e.$parent)}function b(e,t,n){do e.$$listenerCount[n]-=t,0===e.$$listenerCount[n]&&delete e.$$listenerCount[n];while(e=e.$parent)}function w(){}function x(){for(;A.length;)try{A.shift()()}catch(e){t(e)}u=null}function _(){null===u&&(u=c.defer(function(){E.$apply(x)}))}h.prototype={constructor:h,$new:function(t,n){var r;return n=n||this,t?(r=new h,r.$root=this.$root):(this.$$ChildScope||(this.$$ChildScope=e(this)),r=new this.$$ChildScope),r.$parent=n,r.$$prevSibling=n.$$childTail,n.$$childHead?(n.$$childTail.$$nextSibling=r,n.$$childTail=r):n.$$childHead=n.$$childTail=r,(t||n!==this)&&r.$on("$destroy",f),r},$watch:function(e,t,n,r){var i=l(e);if(i.$$watchDelegate)return i.$$watchDelegate(this,t,n,i,e);var o=this,a=o.$$watchers,u={fn:t,last:w,get:i,exp:r||e,eq:!!n};return s=null,k(t)||(u.fn=p),a||(a=o.$$watchers=[],a.$$digestWatchIndex=-1),a.unshift(u),a.$$digestWatchIndex++,m(this,1),function(){var e=N(a,u);e>=0&&(m(o,-1),e<a.$$digestWatchIndex&&a.$$digestWatchIndex--),s=null}},$watchGroup:function(e,t){function n(){u=!1,l?(l=!1,t(o,o,s)):t(o,i,s)}var i=new Array(e.length),o=new Array(e.length),a=[],s=this,u=!1,l=!0;if(!e.length){var c=!0;return s.$evalAsync(function(){c&&t(o,o,s)}),function(){c=!1}}return 1===e.length?this.$watch(e[0],function(e,n,r){o[0]=e,i[0]=n,t(o,e===n?o:i,r)}):(r(e,function(e,t){var r=s.$watch(e,function(e,r){o[t]=e,i[t]=r,u||(u=!0,s.$evalAsync(n))});a.push(r)}),function(){for(;a.length;)a.shift()()})},$watchCollection:function(e,t){function r(e){o=e;var t,r,i,s,u;if(!v(o)){if(y(o))if(n(o)){a!==p&&(a=p,$=a.length=0,f++),t=o.length,$!==t&&(f++,a.length=$=t);for(var l=0;l<t;l++)u=a[l],s=o[l],i=u!==u&&s!==s,i||u===s||(f++,a[l]=s)}else{a!==h&&(a=h={},$=0,f++),t=0;for(r in o)Br.call(o,r)&&(t++,s=o[r],u=a[r],r in a?(i=u!==u&&s!==s,i||u===s||(f++,a[r]=s)):($++,a[r]=s,f++));if($>t){f++;for(r in a)Br.call(o,r)||($--,delete a[r])}}else a!==o&&(a=o,f++);return f}}function i(){if(g?(g=!1,t(o,o,u)):t(o,s,u),c)if(y(o))if(n(o)){s=new Array(o.length);for(var e=0;e<o.length;e++)s[e]=o[e]}else{s={};for(var r in o)Br.call(o,r)&&(s[r]=o[r])}else s=o}r.$stateful=!0;var o,a,s,u=this,c=t.length>1,f=0,d=l(e,r),p=[],h={},g=!0,$=0;return this.$watch(d,i)},$digest:function(){var e,n,r,a,l,f,d,p,h,v,m,y=i,b=this,_=[];g("$digest"),c.$$checkUrlChange(),this===E&&null!==u&&(c.defer.cancel(u),x()),s=null;do{d=!1,h=b;for(var A=0;A<S.length;A++){try{m=S[A],m.scope.$eval(m.expression,m.locals)}catch(M){t(M)}s=null}S.length=0;e:do{if(f=h.$$watchers)for(f.$$digestWatchIndex=f.length;f.$$digestWatchIndex--;)try{if(e=f[f.$$digestWatchIndex])if(l=e.get,(n=l(h))===(r=e.last)||(e.eq?z(n,r):ui(n)&&ui(r))){if(e===s){d=!1;break e}}else d=!0,s=e,e.last=e.eq?R(n,null):n,a=e.fn,a(n,r===w?n:r,h),y<5&&(v=4-y,_[v]||(_[v]=[]),_[v].push({msg:k(e.exp)?"fn: "+(e.exp.name||e.exp.toString()):e.exp,newVal:n,oldVal:r}))}catch(M){t(M)}if(!(p=h.$$watchersCount&&h.$$childHead||h!==b&&h.$$nextSibling))for(;h!==b&&!(p=h.$$nextSibling);)h=h.$parent}while(h=p);if((d||S.length)&&!y--)throw $(),o("infdig","{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}",i,_)}while(d||S.length);for($();O<C.length;)try{C[O++]()}catch(M){t(M)}C.length=O=0},$destroy:function(){if(!this.$$destroyed){var e=this.$parent;this.$broadcast("$destroy"),this.$$destroyed=!0,this===E&&c.$$applicationDestroyed(),m(this,-this.$$watchersCount);for(var t in this.$$listenerCount)b(this,this.$$listenerCount[t],t);e&&e.$$childHead===this&&(e.$$childHead=this.$$nextSibling),e&&e.$$childTail===this&&(e.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=p,this.$on=this.$watch=this.$watchGroup=function(){return p},this.$$listeners={},this.$$nextSibling=null,d(this)}},$eval:function(e,t){return l(e)(this,t)},$evalAsync:function(e,t){E.$$phase||S.length||c.defer(function(){S.length&&E.$digest()}),S.push({scope:this,expression:l(e),locals:t})},$$postDigest:function(e){C.push(e)},$apply:function(e){try{g("$apply");try{return this.$eval(e)}finally{$()}}catch(n){t(n)}finally{try{E.$digest()}catch(n){throw t(n),n}}},$applyAsync:function(e){function t(){n.$eval(e)}var n=this;e&&A.push(t),e=l(e),_()},$on:function(e,t){var n=this.$$listeners[e];n||(this.$$listeners[e]=n=[]),n.push(t);var r=this;do r.$$listenerCount[e]||(r.$$listenerCount[e]=0),r.$$listenerCount[e]++;while(r=r.$parent);var i=this;return function(){var r=n.indexOf(t);r!==-1&&(n[r]=null,b(i,1,e))}},$emit:function(e,n){var r,i,o,a=[],s=this,u=!1,l={name:e,targetScope:s,stopPropagation:function(){u=!0},preventDefault:function(){l.defaultPrevented=!0},defaultPrevented:!1},c=L([l],arguments,1);do{for(r=s.$$listeners[e]||a,l.currentScope=s,i=0,o=r.length;i<o;i++)if(r[i])try{r[i].apply(null,c)}catch(f){t(f)}else r.splice(i,1),i--,o--;if(u)return l.currentScope=null,l;s=s.$parent}while(s);return l.currentScope=null,l},$broadcast:function(e,n){var r=this,i=r,o=r,a={name:e,targetScope:r,preventDefault:function(){a.defaultPrevented=!0},defaultPrevented:!1};if(!r.$$listenerCount[e])return a;for(var s,u,l,c=L([a],arguments,1);i=o;){for(a.currentScope=i,s=i.$$listeners[e]||[],u=0,l=s.length;u<l;u++)if(s[u])try{s[u].apply(null,c)}catch(f){t(f)}else s.splice(u,1),u--,l--;if(!(o=i.$$listenerCount[e]&&i.$$childHead||i!==r&&i.$$nextSibling))for(;i!==r&&!(o=i.$$nextSibling);)i=i.$parent}return a.currentScope=null,a}};var E=new h,S=E.$$asyncQueue=[],C=E.$$postDigestQueue=[],A=E.$$applyAsyncQueue=[],O=0;return E}]}function Cn(){var e=/^\s*(https?|ftp|mailto|tel|file):/,t=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationWhitelist=function(t){return m(t)?(e=t,this):e},this.imgSrcSanitizationWhitelist=function(e){return m(e)?(t=e,this):t},this.$get=function(){return function(n,r){var i,o=r?t:e;return i=Un(n).href,""===i||i.match(o)?n:"unsafe:"+i}}}function An(e){return e.replace(Vo,Ee)}function On(e){if("self"===e)return e;if(w(e)){if(e.indexOf("***")>-1)throw Po("iwcard","Illegal sequence *** in string matcher. String: {0}",e);return e=di(e).replace(/\\\*\\\*/g,".*").replace(/\\\*/g,"[^:/.?&;]*"),new RegExp("^"+e+"$")}if(E(e))return new RegExp("^"+e.source+"$");throw Po("imatcher",'Matchers may only be "self", string patterns or RegExp objects')}function Mn(e){var t=[];return m(e)&&r(e,function(e){t.push(On(e))}),t}function Tn(){this.SCE_CONTEXTS=Do;var e=["self"],t=[];this.resourceUrlWhitelist=function(t){return arguments.length&&(e=Mn(t)),e},this.resourceUrlBlacklist=function(e){return arguments.length&&(t=Mn(e)),t},this.$get=["$injector",function(n){function r(e,t){return"self"===e?Fn(t):!!e.exec(t.href)}function i(n){var i,o,a=Un(n.toString()),s=!1;for(i=0,o=e.length;i<o;i++)if(r(e[i],a)){s=!0;break}if(s)for(i=0,o=t.length;i<o;i++)if(r(t[i],a)){s=!1;break}return s}function o(e){var t=function(e){this.$$unwrapTrustedValue=function(){return e}};return e&&(t.prototype=new e),t.prototype.valueOf=function(){return this.$$unwrapTrustedValue()},t.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()},t}function a(e,t){var n=f.hasOwnProperty(e)?f[e]:null;if(!n)throw Po("icontext","Attempted to trust a value in invalid context. Context: {0}; Value: {1}",e,t);if(null===t||v(t)||""===t)return t;if("string"!=typeof t)throw Po("itype","Attempted to trust a non-string value in a content requiring a string: Context: {0}",e);return new n(t)}function s(e){return e instanceof c?e.$$unwrapTrustedValue():e}function u(e,t){if(null===t||v(t)||""===t)return t;var n=f.hasOwnProperty(e)?f[e]:null;if(n&&t instanceof n)return t.$$unwrapTrustedValue();if(e===Do.RESOURCE_URL){if(i(t))return t;throw Po("insecurl","Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}",t.toString())}if(e===Do.HTML)return l(t);throw Po("unsafe","Attempting to use an unsafe value in a safe context.")}var l=function(e){throw Po("unsafe","Attempting to use an unsafe value in a safe context.")};n.has("$sanitize")&&(l=n.get("$sanitize"));var c=o(),f={};return f[Do.HTML]=o(c),f[Do.CSS]=o(c),f[Do.URL]=o(c),f[Do.JS]=o(c),f[Do.RESOURCE_URL]=o(f[Do.URL]),{trustAs:a,getTrusted:u,valueOf:s}}]}function jn(){var e=!0;this.enabled=function(t){return arguments.length&&(e=!!t),e},this.$get=["$parse","$sceDelegate",function(t,n){if(e&&Yr<8)throw Po("iequirks","Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks mode. You can fix this by adding the text <!doctype html> to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.");var i=ye(Do);i.isEnabled=function(){return e},i.trustAs=n.trustAs,i.getTrusted=n.getTrusted,i.valueOf=n.valueOf,e||(i.trustAs=i.getTrusted=function(e,t){return t},i.valueOf=h),i.parseAs=function(e,n){var r=t(n);return r.literal&&r.constant?r:t(n,function(t){return i.getTrusted(e,t)})};var o=i.parseAs,a=i.getTrusted,s=i.trustAs;return r(Do,function(e,t){var n=Wr(t);i[An("parse_as_"+n)]=function(t){return o(e,t)},i[An("get_trusted_"+n)]=function(t){return a(e,t)},i[An("trust_as_"+n)]=function(t){return s(e,t)}}),i}]}function Pn(){this.$get=["$window","$document",function(e,t){var n={},r=e.chrome&&(e.chrome.app&&e.chrome.app.runtime||!e.chrome.app&&e.chrome.runtime&&e.chrome.runtime.id),i=!r&&e.history&&e.history.pushState,o=f((/android (\d+)/.exec(Wr((e.navigator||{}).userAgent))||[])[1]),a=/Boxee/i.test((e.navigator||{}).userAgent),s=t[0]||{},u=s.body&&s.body.style,l=!1,c=!1;return u&&(l=!!("transition"in u||"webkitTransition"in u),c=!!("animation"in u||"webkitAnimation"in u)),{history:!(!i||o<4||a),hasEvent:function(e){if("input"===e&&Yr)return!1;if(v(n[e])){var t=s.createElement("div");n[e]="on"+e in t}return n[e]},csp:pi(),transitions:l,animations:c,android:o}}]}function Dn(){var e;this.httpOptions=function(t){return t?(e=t,this):e},this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(t,n,r,i,o){function a(s,u){function c(e){return u||(e=Io("tpload","Failed to load template: {0} (HTTP status: {1} {2})",s,e.status,e.statusText),t(e)),i.reject(e)}a.totalPendingRequests++,w(s)&&!v(n.get(s))||(s=o.getTrustedResourceUrl(s));var f=r.defaults&&r.defaults.transformResponse;return li(f)?f=f.filter(function(e){return e!==Pt}):f===Pt&&(f=null),r.get(s,l({cache:n,transformResponse:f},e))["finally"](function(){a.totalPendingRequests--}).then(function(e){return n.put(s,e.data),e.data},c)}return a.totalPendingRequests=0,a}]}function Vn(){this.$get=["$rootScope","$browser","$location",function(e,t,n){var i={};return i.findBindings=function(e,t,n){var i=e.getElementsByClassName("ng-binding"),o=[];return r(i,function(e){var i=ai.element(e).data("$binding");i&&r(i,function(r){if(n){var i=new RegExp("(^|\\s)"+di(t)+"(\\s|\\||$)");i.test(r)&&o.push(e)}else r.indexOf(t)!==-1&&o.push(e)})}),o},i.findModels=function(e,t,n){for(var r=["ng-","data-ng-","ng\\:"],i=0;i<r.length;++i){var o=n?"=":"*=",a="["+r[i]+"model"+o+'"'+t+'"]',s=e.querySelectorAll(a);if(s.length)return s}},i.getLocation=function(){return n.url()},i.setLocation=function(t){t!==n.url()&&(n.url(t),e.$digest())},i.whenStable=function(e){t.notifyWhenNoOutstandingRequests(e)},i}]}function In(){this.$get=["$rootScope","$browser","$q","$$q","$exceptionHandler",function(e,t,n,r,i){function o(o,s,u){k(o)||(u=s,s=o,o=p);var l,c=H(arguments,3),f=m(u)&&!u,d=(f?r:n).defer(),h=d.promise;return l=t.defer(function(){try{d.resolve(o.apply(null,c))}catch(t){d.reject(t),i(t)}finally{delete a[h.$$timeoutId]}f||e.$apply()},s),h.$$timeoutId=l,a[l]=d,h}var a={};return o.cancel=function(e){return!!(e&&e.$$timeoutId in a)&&(a[e.$$timeoutId].promise["catch"](p),a[e.$$timeoutId].reject("canceled"),delete a[e.$$timeoutId],t.defer.cancel(e.$$timeoutId))},o}]}function Un(e){var t=e;return Yr&&(Uo.setAttribute("href",t),t=Uo.href),Uo.setAttribute("href",t),{href:Uo.href,protocol:Uo.protocol?Uo.protocol.replace(/:$/,""):"",host:Uo.host,search:Uo.search?Uo.search.replace(/^\?/,""):"",hash:Uo.hash?Uo.hash.replace(/^#/,""):"",hostname:Uo.hostname,port:Uo.port,pathname:"/"===Uo.pathname.charAt(0)?Uo.pathname:"/"+Uo.pathname}}function Fn(e){var t=w(e)?Un(e):e;return t.protocol===Fo.protocol&&t.host===Fo.host}function Nn(){this.$get=g(e)}function Rn(e){function t(e){try{return e.cookie||""}catch(t){return""}}function n(e){try{return decodeURIComponent(e)}catch(t){return e}}var r=e[0]||{},i={},o="";return function(){var e,a,s,u,l,c=t(r);if(c!==o)for(o=c,e=o.split("; "),i={},s=0;s<e.length;s++)a=e[s],u=a.indexOf("="),u>0&&(l=n(a.substring(0,u)),v(i[l])&&(i[l]=n(a.substring(u+1))));return i}}function zn(){this.$get=Rn}function Ln(e){function t(i,o){if(y(i)){var a={};return r(i,function(e,n){a[n]=t(n,e)}),a}return e.factory(i+n,o)}var n="Filter";this.register=t,this.$get=["$injector",function(e){return function(t){return e.get(t+n)}}],t("currency",Gn),t("date",ur),t("filter",Hn),t("json",lr),t("limitTo",cr),t("lowercase",Bo),t("number",Xn),t("orderBy",dr),t("uppercase",Wo)}function Hn(){return function(e,r,i,o){if(!n(e)){if(null==e)return e;throw t("filter")("notarray","Expected array but received: {0}",e)}o=o||"$";var a,s,u=Wn(r);switch(u){case"function":a=r;break;case"boolean":case"null":case"number":case"string":s=!0;case"object":a=qn(r,i,o,s);break;default:return e}return Array.prototype.filter.call(e,a)}}function qn(e,t,n,r){var i,o=y(e)&&n in e;return t===!0?t=z:k(t)||(t=function(e,t){return!v(e)&&(null===e||null===t?e===t:!(y(t)||y(e)&&!$(e))&&(e=Wr(""+e),t=Wr(""+t),e.indexOf(t)!==-1))}),i=function(i){return o&&!y(i)?Bn(i,e[n],t,n,!1):Bn(i,e,t,n,r)}}function Bn(e,t,n,r,i,o){var a=Wn(e),s=Wn(t);if("string"===s&&"!"===t.charAt(0))return!Bn(e,t.substring(1),n,r,i);if(li(e))return e.some(function(e){return Bn(e,t,n,r,i)});switch(a){case"object":var u;if(i){for(u in e)if("$"!==u.charAt(0)&&Bn(e[u],t,n,r,!0))return!0;return!o&&Bn(e,t,n,r,!1)}if("object"===s){for(u in t){var l=t[u];if(!k(l)&&!v(l)){var c=u===r,f=c?e:e[u];if(!Bn(f,l,n,r,c,c))return!1}}return!0}return n(e,t);case"function":return!1;default:return n(e,t)}}function Wn(e){return null===e?"null":typeof e}function Gn(e){var t=e.NUMBER_FORMATS;return function(e,n,r){return v(n)&&(n=t.CURRENCY_SYM),v(r)&&(r=t.PATTERNS[1].maxFrac),null==e?e:Jn(e,t.PATTERNS[1],t.GROUP_SEP,t.DECIMAL_SEP,r).replace(/\u00A4/g,n)}}function Xn(e){var t=e.NUMBER_FORMATS;return function(e,n){return null==e?e:Jn(e,t.PATTERNS[0],t.GROUP_SEP,t.DECIMAL_SEP,n)}}function Kn(e){var t,n,r,i,o,a=0;for((n=e.indexOf(Ro))>-1&&(e=e.replace(Ro,"")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charAt(r)===zo;r++);if(r===(o=e.length))t=[0],n=1;else{for(o--;e.charAt(o)===zo;)o--;for(n-=r,t=[],i=0;r<=o;r++,i++)t[i]=+e.charAt(r)}return n>No&&(t=t.splice(0,No-1),a=n-1,n=1),{d:t,e:a,i:n}}function Yn(e,t,n,r){var i=e.d,o=i.length-e.i;t=v(t)?Math.min(Math.max(n,o),r):+t;var a=t+e.i,s=i[a];if(a>0){i.splice(Math.max(e.i,a));for(var u=a;u<i.length;u++)i[u]=0}else{o=Math.max(0,o),e.i=1,i.length=Math.max(1,a=t+1),i[0]=0;for(var l=1;l<a;l++)i[l]=0}if(s>=5)if(a-1<0){for(var c=0;c>a;c--)i.unshift(0),e.i++;i.unshift(1),e.i++}else i[a-1]++;for(;o<Math.max(0,t);o++)i.push(0);var f=i.reduceRight(function(e,t,n,r){return t+=e,r[n]=t%10,Math.floor(t/10)},0);f&&(i.unshift(f),e.i++)}function Jn(e,t,n,r,i){if(!w(e)&&!x(e)||isNaN(e))return"";var o,a=!isFinite(e),s=!1,u=Math.abs(e)+"",l="";if(a)l="∞";else{o=Kn(u),Yn(o,i,t.minFrac,t.maxFrac);var c=o.d,f=o.i,d=o.e,p=[];for(s=c.reduce(function(e,t){return e&&!t},!0);f<0;)c.unshift(0),f++;f>0?p=c.splice(f,c.length):(p=c,c=[0]);var h=[];for(c.length>=t.lgSize&&h.unshift(c.splice(-t.lgSize,c.length).join(""));c.length>t.gSize;)h.unshift(c.splice(-t.gSize,c.length).join(""));c.length&&h.unshift(c.join("")),l=h.join(n),p.length&&(l+=r+p.join("")),d&&(l+="e+"+d)}return e<0&&!s?t.negPre+l+t.negSuf:t.posPre+l+t.posSuf}function Zn(e,t,n,r){var i="";for((e<0||r&&e<=0)&&(r?e=-e+1:(e=-e,i="-")),e=""+e;e.length<t;)e=zo+e;return n&&(e=e.substr(e.length-t)),i+e}function Qn(e,t,n,r,i){return n=n||0,function(o){var a=o["get"+e]();return(n>0||a>-n)&&(a+=n),0===a&&n===-12&&(a=12),Zn(a,t,r,i)}}function er(e,t,n){return function(r,i){var o=r["get"+e](),a=(n?"STANDALONE":"")+(t?"SHORT":""),s=Gr(a+e);return i[s][o]}}function tr(e,t,n){var r=-1*n,i=r>=0?"+":"";return i+=Zn(Math[r>0?"floor":"ceil"](r/60),2)+Zn(Math.abs(r%60),2)}function nr(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(t<=4?5:12)-t)}function rr(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+(4-e.getDay()))}function ir(e){return function(t){var n=nr(t.getFullYear()),r=rr(t),i=+r-+n,o=1+Math.round(i/6048e5);return Zn(o,e)}}function or(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}function ar(e,t){return e.getFullYear()<=0?t.ERAS[0]:t.ERAS[1]}function sr(e,t){return e.getFullYear()<=0?t.ERANAMES[0]:t.ERANAMES[1]}function ur(e){function t(e){var t;if(t=e.match(n)){var r=new Date(0),i=0,o=0,a=t[8]?r.setUTCFullYear:r.setFullYear,s=t[8]?r.setUTCHours:r.setHours;t[9]&&(i=f(t[9]+t[10]),o=f(t[9]+t[11])),a.call(r,f(t[1]),f(t[2])-1,f(t[3]));var u=f(t[4]||0)-i,l=f(t[5]||0)-o,c=f(t[6]||0),d=Math.round(1e3*parseFloat("0."+(t[7]||0)));return s.call(r,u,l,c,d),r}return e}var n=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,i,o){var a,s,u="",l=[];if(i=i||"mediumDate",i=e.DATETIME_FORMATS[i]||i,w(n)&&(n=qo.test(n)?f(n):t(n)),x(n)&&(n=new Date(n)),!_(n)||!isFinite(n.getTime()))return n;for(;i;)s=Ho.exec(i),s?(l=L(l,s,1),i=l.pop()):(l.push(i),i=null);var c=n.getTimezoneOffset();return o&&(c=X(o,c),n=Y(n,o,!0)),r(l,function(t){a=Lo[t],u+=a?a(n,e.DATETIME_FORMATS,c):"''"===t?"'":t.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),u}}function lr(){return function(e,t){return v(t)&&(t=2),W(e,t)}}function cr(){return function(e,t,r){return t=Math.abs(Number(t))===1/0?Number(t):f(t),ui(t)?e:(x(e)&&(e=e.toString()),n(e)?(r=!r||isNaN(r)?0:f(r),r=r<0?Math.max(0,e.length+r):r,t>=0?fr(e,r,r+t):0===r?fr(e,t,e.length):fr(e,Math.max(0,r+t),r)):e)}}function fr(e,t,n){return w(e)?e.slice(t,n):ei.call(e,t,n)}function dr(e){function r(t){return t.map(function(t){var n=1,r=h;if(k(t))r=t;else if(w(t)&&("+"!==t.charAt(0)&&"-"!==t.charAt(0)||(n="-"===t.charAt(0)?-1:1,t=t.substring(1)),""!==t&&(r=e(t),r.constant))){var i=r();r=function(e){return e[i]}}return{get:r,descending:n}})}function i(e){switch(typeof e){case"number":case"boolean":case"string":return!0;default:return!1}}function o(e){return k(e.valueOf)&&(e=e.valueOf(),i(e))?e:$(e)&&(e=e.toString(),i(e))?e:e}function a(e,t){var n=typeof e;return null===e?(n="string",e="null"):"object"===n&&(e=o(e)),{value:e,type:n,index:t}}function s(e,t){var n=0,r=e.type,i=t.type;if(r===i){var o=e.value,a=t.value;"string"===r?(o=o.toLowerCase(),a=a.toLowerCase()):"object"===r&&(y(o)&&(o=e.index),y(a)&&(a=t.index)),o!==a&&(n=o<a?-1:1)}else n=r<i?-1:1;return n}return function(e,i,o,u){function l(e,t){return{value:e,tieBreaker:{value:t,type:"number",index:t},predicateValues:f.map(function(n){return a(n.get(e),t)})}}function c(e,t){for(var n=0,r=f.length;n<r;n++){var i=p(e.predicateValues[n],t.predicateValues[n]);if(i)return i*f[n].descending*d}return p(e.tieBreaker,t.tieBreaker)*d}if(null==e)return e;if(!n(e))throw t("orderBy")("notarray","Expected array but received: {0}",e);li(i)||(i=[i]),0===i.length&&(i=["+"]);var f=r(i),d=o?-1:1,p=k(u)?u:s,h=Array.prototype.map.call(e,l);return h.sort(c),e=h.map(function(e){return e.value})}}function pr(e){return k(e)&&(e={link:e}),e.restrict=e.restrict||"AC",g(e)}function hr(e,t){e.$name=t}function gr(e,t,n,r,i){this.$$controls=[],this.$error={},this.$$success={},this.$pending=void 0,this.$name=i(t.name||t.ngForm||"")(n),this.$dirty=!1,this.$pristine=!0,this.$valid=!0,this.$invalid=!1,this.$submitted=!1,this.$$parentForm=Ko,this.$$element=e,this.$$animate=r,$r(this)}function $r(e){e.$$classCache={},e.$$classCache[Pa]=!(e.$$classCache[ja]=e.$$element.hasClass(ja))}function vr(e){function t(e,t,n,r){e[t]||(e[t]={}),a(e[t],n,r)}function n(e,t,n,r){e[t]&&s(e[t],n,r),mr(e[t])&&(e[t]=void 0)}function r(e,t,n){n&&!e.$$classCache[t]?(e.$$animate.addClass(e.$$element,t),e.$$classCache[t]=!0):!n&&e.$$classCache[t]&&(e.$$animate.removeClass(e.$$element,t),e.$$classCache[t]=!1)}function i(e,t,n){t=t?"-"+le(t,"-"):"",r(e,ja+t,n===!0),r(e,Pa+t,n===!1)}var o=e.clazz,a=e.set,s=e.unset;o.prototype.$setValidity=function(e,o,u){v(o)?t(this,"$pending",e,u):n(this,"$pending",e,u),T(o)?o?(s(this.$error,e,u),a(this.$$success,e,u)):(a(this.$error,e,u),s(this.$$success,e,u)):(s(this.$error,e,u),s(this.$$success,e,u)),this.$pending?(r(this,Yo,!0),this.$valid=this.$invalid=void 0,i(this,"",null)):(r(this,Yo,!1),this.$valid=mr(this.$error),this.$invalid=!this.$valid,i(this,"",this.$valid));var l;l=this.$pending&&this.$pending[e]?void 0:!this.$error[e]&&(!!this.$$success[e]||null),i(this,e,l),this.$$parentForm.$setValidity(e,l,this)}}function mr(e){if(e)for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function yr(e){e.$formatters.push(function(t){return e.$isEmpty(t)?t:t.toString()})}function br(e,t,n,r,i,o){wr(e,t,n,r,i,o),yr(r)}function wr(e,t,n,r,i,o){var a=Wr(t[0].type);if(!i.android){var s=!1;t.on("compositionstart",function(){s=!0}),t.on("compositionend",function(){s=!1,l()})}var u,l=function(e){if(u&&(o.defer.cancel(u),u=null),!s){var i=t.val(),l=e&&e.type;"password"===a||n.ngTrim&&"false"===n.ngTrim||(i=fi(i)),(r.$viewValue!==i||""===i&&r.$$hasNativeValidators)&&r.$setViewValue(i,l)}};if(i.hasEvent("input"))t.on("input",l);else{var c=function(e,t,n){u||(u=o.defer(function(){u=null,t&&t.value===n||l(e)}))};t.on("keydown",function(e){var t=e.keyCode;91===t||15<t&&t<19||37<=t&&t<=40||c(e,this,this.value)}),i.hasEvent("paste")&&t.on("paste cut",c)}t.on("change",l),fa[a]&&r.$$hasNativeValidators&&a===n.type&&t.on(ca,function(e){if(!u){var t=this[qr],n=t.badInput,r=t.typeMismatch;u=o.defer(function(){u=null,t.badInput===n&&t.typeMismatch===r||l(e)})}}),r.$render=function(){var e=r.$isEmpty(r.$viewValue)?"":r.$viewValue;t.val()!==e&&t.val(e)}}function xr(e,t){if(_(e))return e;if(w(e)){sa.lastIndex=0;var n=sa.exec(e);if(n){var r=+n[1],i=+n[2],o=0,a=0,s=0,u=0,l=nr(r),c=7*(i-1);return t&&(o=t.getHours(),a=t.getMinutes(),s=t.getSeconds(),u=t.getMilliseconds()),new Date(r,0,l.getDate()+c,o,a,s,u)}}return NaN}function _r(e,t){return function(n,i){var o,a;if(_(n))return n;if(w(n)){if('"'===n.charAt(0)&&'"'===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),ta.test(n))return new Date(n);if(e.lastIndex=0,o=e.exec(n))return o.shift(),a=i?{yyyy:i.getFullYear(),MM:i.getMonth()+1,dd:i.getDate(),HH:i.getHours(),mm:i.getMinutes(),ss:i.getSeconds(),sss:i.getMilliseconds()/1e3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},r(o,function(e,n){n<t.length&&(a[t[n]]=+e)}),new Date(a.yyyy,a.MM-1,a.dd,a.HH,a.mm,a.ss||0,1e3*a.sss||0)}return NaN}}function kr(e,t,n,r){return function(i,o,a,s,u,l,c){function f(e){return e&&!(e.getTime&&e.getTime()!==e.getTime())}function d(e){return m(e)&&!_(e)?n(e)||void 0:e}Er(i,o,a,s),wr(i,o,a,s,u,l);var p,h=s&&s.$options.getOption("timezone");if(s.$$parserName=e,s.$parsers.push(function(e){if(s.$isEmpty(e))return null;if(t.test(e)){var r=n(e,p);return h&&(r=Y(r,h)),r}}),s.$formatters.push(function(e){if(e&&!_(e))throw Ra("datefmt","Expected `{0}` to be a date",e);return f(e)?(p=e,p&&h&&(p=Y(p,h,!0)),c("date")(e,r,h)):(p=null,"")}),m(a.min)||a.ngMin){var g;s.$validators.min=function(e){return!f(e)||v(g)||n(e)>=g},a.$observe("min",function(e){g=d(e),s.$validate()})}if(m(a.max)||a.ngMax){var $;s.$validators.max=function(e){return!f(e)||v($)||n(e)<=$},a.$observe("max",function(e){$=d(e),s.$validate()})}}}function Er(e,t,n,r){var i=t[0],o=r.$$hasNativeValidators=y(i.validity);o&&r.$parsers.push(function(e){var n=t.prop(qr)||{};return n.badInput||n.typeMismatch?void 0:e})}function Sr(e){e.$$parserName="number",e.$parsers.push(function(t){return e.$isEmpty(t)?null:ia.test(t)?parseFloat(t):void 0}),e.$formatters.push(function(t){if(!e.$isEmpty(t)){if(!x(t))throw Ra("numfmt","Expected `{0}` to be a number",t);t=t.toString()}return t})}function Cr(e){return m(e)&&!x(e)&&(e=parseFloat(e)),ui(e)?void 0:e}function Ar(e){return(0|e)===e}function Or(e){var t=e.toString(),n=t.indexOf(".");if(n===-1){if(-1<e&&e<1){var r=/e-(\d+)$/.exec(t);if(r)return Number(r[1])}return 0}return t.length-n-1}function Mr(e,t,n){var r=Number(e);if(!Ar(r)||!Ar(t)||!Ar(n)){var i=Math.max(Or(r),Or(t),Or(n)),o=Math.pow(10,i);r*=o,t*=o,n*=o}return(r-t)%n===0}function Tr(e,t,n,r,i,o){Er(e,t,n,r),Sr(r),wr(e,t,n,r,i,o);var a,s;if((m(n.min)||n.ngMin)&&(r.$validators.min=function(e){return r.$isEmpty(e)||v(a)||e>=a},n.$observe("min",function(e){a=Cr(e),r.$validate()})),(m(n.max)||n.ngMax)&&(r.$validators.max=function(e){return r.$isEmpty(e)||v(s)||e<=s},n.$observe("max",function(e){s=Cr(e),r.$validate()})),m(n.step)||n.ngStep){var u;r.$validators.step=function(e,t){return r.$isEmpty(t)||v(u)||Mr(t,a||0,u)},n.$observe("step",function(e){u=Cr(e),r.$validate()})}}function jr(e,t,n,r,i,o){function a(e,r){t.attr(e,n[e]),n.$observe(e,r)}function s(e){if(f=Cr(e),!ui(r.$modelValue))if(c){var n=t.val();f>n&&(n=f,t.val(n)),r.$setViewValue(n)}else r.$validate()}function u(e){if(d=Cr(e),!ui(r.$modelValue))if(c){var n=t.val();d<n&&(t.val(d),n=d<f?f:d),r.$setViewValue(n)}else r.$validate()}function l(e){p=Cr(e),ui(r.$modelValue)||(c&&r.$viewValue!==t.val()?r.$setViewValue(t.val()):r.$validate())}Er(e,t,n,r),Sr(r),wr(e,t,n,r,i,o);var c=r.$$hasNativeValidators&&"range"===t[0].type,f=c?0:void 0,d=c?100:void 0,p=c?1:void 0,h=t[0].validity,g=m(n.min),$=m(n.max),y=m(n.step),b=r.$render;r.$render=c&&m(h.rangeUnderflow)&&m(h.rangeOverflow)?function(){b(),r.$setViewValue(t.val())}:b,g&&(r.$validators.min=c?function(){return!0}:function(e,t){return r.$isEmpty(t)||v(f)||t>=f},a("min",s)),$&&(r.$validators.max=c?function(){return!0}:function(e,t){return r.$isEmpty(t)||v(d)||t<=d},a("max",u)),y&&(r.$validators.step=c?function(){return!h.stepMismatch}:function(e,t){return r.$isEmpty(t)||v(p)||Mr(t,f||0,p)},a("step",l))}function Pr(e,t,n,r,i,o){wr(e,t,n,r,i,o),yr(r),r.$$parserName="url",r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||na.test(n)}}function Dr(e,t,n,r,i,o){wr(e,t,n,r,i,o),yr(r),r.$$parserName="email",r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||ra.test(n)}}function Vr(e,t,n,r){var i=!n.ngTrim||"false"!==fi(n.ngTrim);v(n.name)&&t.attr("name",a());var o=function(e){var o;t[0].checked&&(o=n.value,i&&(o=fi(o)),r.$setViewValue(o,e&&e.type))};t.on("click",o),r.$render=function(){var e=n.value;i&&(e=fi(e)),t[0].checked=e===r.$viewValue},n.$observe("value",r.$render)}function Ir(e,t,n,r,i){var o;if(m(r)){if(o=e(r),!o.constant)throw Ra("constexpr","Expected constant expression for `{0}`, but saw `{1}`.",n,r);return o(t)}return i}function Ur(e,t,n,r,i,o,a,s){var u=Ir(s,e,"ngTrueValue",n.ngTrueValue,!0),l=Ir(s,e,"ngFalseValue",n.ngFalseValue,!1),c=function(e){r.$setViewValue(t[0].checked,e&&e.type)};t.on("click",c),r.$render=function(){t[0].checked=r.$viewValue},r.$isEmpty=function(e){return e===!1},r.$formatters.push(function(e){return z(e,u)}),r.$parsers.push(function(e){return e?u:l})}function Fr(e,t){function n(e,t){if(!e||!e.length)return[];if(!t||!t.length)return e;var n=[];e:for(var r=0;r<e.length;r++){for(var i=e[r],o=0;o<t.length;o++)if(i===t[o])continue e;n.push(i)}return n}function i(e){return e&&e.split(" ")}function o(e){var t=e;return li(e)?t=e.map(o).join(" "):y(e)&&(t=Object.keys(e).filter(function(t){return e[t]}).join(" ")),t}function a(e){var t=e;if(li(e))t=e.map(a);else if(y(e)){var n=!1;t=Object.keys(e).filter(function(t){var r=e[t];return!n&&v(r)&&(n=!0),r}),n&&t.push(void 0)}return t}e="ngClass"+e;var s;return["$parse",function(u){return{restrict:"AC",link:function(l,c,f){function d(e){e=g(i(e),1),f.$addClass(e)}function p(e){e=g(i(e),-1),f.$removeClass(e)}function h(e,t){var r=i(e),o=i(t),a=n(r,o),s=n(o,r),u=g(a,-1),l=g(s,1);f.$addClass(l),f.$removeClass(u)}function g(e,t){var n=[];return r(e,function(e){(t>0||E[e])&&(E[e]=(E[e]||0)+t,E[e]===+(t>0)&&n.push(e))}),n.join(" ")}function $(e){e===t?d(y):p(y),S=e}function v(e){var t=o(e);t!==y&&m(t)}function m(e){S===t&&h(y,e),y=e}var y,b=f[e].trim(),w=":"===b.charAt(0)&&":"===b.charAt(1),x=w?a:o,_=u(b,x),k=w?v:m,E=c.data("$classCounts"),S=!0;E||(E=$e(),c.data("$classCounts",E)),"ngClass"!==e&&(s||(s=u("$index",function(e){return 1&e})),l.$watch(s,$)),l.$watch(_,k,w)}}}]}function Nr(e,t,n,r,i,o,a,s,u){this.$viewValue=Number.NaN,this.$modelValue=Number.NaN,this.$$rawModelValue=void 0,this.$validators={},this.$asyncValidators={},this.$parsers=[],this.$formatters=[],this.$viewChangeListeners=[],this.$untouched=!0,this.$touched=!1,this.$pristine=!0,this.$dirty=!1,this.$valid=!0,this.$invalid=!1,this.$error={},this.$$success={},this.$pending=void 0,this.$name=u(n.name||"",!1)(e),this.$$parentForm=Ko,this.$options=za,this.$$parsedNgModel=i(n.ngModel),this.$$parsedNgModelAssign=this.$$parsedNgModel.assign,this.$$ngModelGet=this.$$parsedNgModel,this.$$ngModelSet=this.$$parsedNgModelAssign,this.$$pendingDebounce=null,this.$$parserValid=void 0,this.$$currentValidationRunId=0,this.$$scope=e,this.$$attr=n,this.$$element=r,this.$$animate=o,this.$$timeout=a,this.$$parse=i,this.$$q=s,this.$$exceptionHandler=t,$r(this),Rr(this)}function Rr(e){e.$$scope.$watch(function(){var t=e.$$ngModelGet(e.$$scope);if(t!==e.$modelValue&&(e.$modelValue===e.$modelValue||t===t)){e.$modelValue=e.$$rawModelValue=t,e.$$parserValid=void 0;for(var n=e.$formatters,r=n.length,i=t;r--;)i=n[r](i);e.$viewValue!==i&&(e.$$updateEmptyClasses(i),e.$viewValue=e.$$lastCommittedViewValue=i,e.$render(),e.$$runValidators(e.$modelValue,e.$viewValue,p))}return t})}function zr(e){this.$$options=e}function Lr(e,t){r(t,function(t,n){m(e[n])||(e[n]=t)})}var Hr=/^\/(.+)\/([a-z]*)$/,qr="validity",Br=Object.prototype.hasOwnProperty,Wr=function(e){return w(e)?e.toLowerCase():e},Gr=function(e){return w(e)?e.toUpperCase():e},Xr=function(e){return w(e)?e.replace(/[A-Z]/g,function(e){return String.fromCharCode(32|e.charCodeAt(0))}):e},Kr=function(e){return w(e)?e.replace(/[a-z]/g,function(e){return String.fromCharCode(e.charCodeAt(0)&-33)}):e};"i"!=="I".toLowerCase()&&(Wr=Xr,Gr=Kr);var Yr,Jr,Zr,Qr,ei=[].slice,ti=[].splice,ni=[].push,ri=Object.prototype.toString,ii=Object.getPrototypeOf,oi=t("ng"),ai=e.angular||(e.angular={}),si=0;
6
- Yr=e.document.documentMode;var ui=Number.isNaN||function(e){return e!==e};p.$inject=[],h.$inject=[];var li=Array.isArray,ci=/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/,fi=function(e){return w(e)?e.trim():e},di=function(e){return e.replace(/([-()[\]{}+?*.$^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},pi=function(){function t(){try{return new Function(""),!1}catch(e){return!0}}if(!m(pi.rules)){var n=e.document.querySelector("[ng-csp]")||e.document.querySelector("[data-ng-csp]");if(n){var r=n.getAttribute("ng-csp")||n.getAttribute("data-ng-csp");pi.rules={noUnsafeEval:!r||r.indexOf("no-unsafe-eval")!==-1,noInlineStyle:!r||r.indexOf("no-inline-style")!==-1}}else pi.rules={noUnsafeEval:t(),noInlineStyle:!1}}return pi.rules},hi=function(){if(m(hi.name_))return hi.name_;var t,n,r,i,o=$i.length;for(n=0;n<o;++n)if(r=$i[n],t=e.document.querySelector("["+r.replace(":","\\:")+"jq]")){i=t.getAttribute(r+"jq");break}return hi.name_=i},gi=/:/g,$i=["ng-","data-ng-","ng:","x-ng-"],vi=ie(e.document),mi=/[A-Z]/g,yi=!1,bi=1,wi=2,xi=3,_i=8,ki=9,Ei=11,Si={full:"1.6.1",major:1,minor:6,dot:1,codeName:"promise-rectification"};De.expando="ng339";var Ci=De.cache={},Ai=1;De._data=function(e){return this.cache[e[this.expando]]||{}};var Oi=/-([a-z])/g,Mi=/^-ms-/,Ti={mouseleave:"mouseout",mouseenter:"mouseover"},ji=t("jqLite"),Pi=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Di=/<|&#?\w+;/,Vi=/<([\w:-]+)/,Ii=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Ui={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Ui.optgroup=Ui.option,Ui.tbody=Ui.tfoot=Ui.colgroup=Ui.caption=Ui.thead,Ui.th=Ui.td;var Fi=e.Node.prototype.contains||function(e){return!!(16&this.compareDocumentPosition(e))},Ni=De.prototype={ready:Ye,toString:function(){var e=[];return r(this,function(t){e.push(""+t)}),"["+e.join(", ")+"]"},eq:function(e){return Jr(e>=0?this[e]:this[this.length+e])},length:0,push:ni,sort:[].sort,splice:[].splice},Ri={};r("multiple,selected,checked,disabled,readOnly,required,open".split(","),function(e){Ri[Wr(e)]=e});var zi={};r("input,select,option,textarea,button,form,details".split(","),function(e){zi[e]=!0});var Li={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};r({data:Re,removeData:Fe,hasData:Oe,cleanData:Me},function(e,t){De[t]=e}),r({data:Re,inheritedData:We,scope:function(e){return Jr.data(e,"$scope")||We(e.parentNode||e,["$isolateScope","$scope"])},isolateScope:function(e){return Jr.data(e,"$isolateScope")||Jr.data(e,"$isolateScopeNoTemplate")},controller:Be,injector:function(e){return We(e,"$injector")},removeAttr:function(e,t){e.removeAttribute(t)},hasClass:ze,css:function(e,t,n){return t=ke(t),m(n)?void(e.style[t]=n):e.style[t]},attr:function(e,t,n){var r,i=e.nodeType;if(i!==xi&&i!==wi&&i!==_i&&e.getAttribute){var o=Wr(t),a=Ri[o];return m(n)?void(null===n||n===!1&&a?e.removeAttribute(t):e.setAttribute(t,a?o:n)):(r=e.getAttribute(t),a&&null!==r&&(r=o),null===r?void 0:r)}},prop:function(e,t,n){return m(n)?void(e[t]=n):e[t]},text:function(){function e(e,t){if(v(t)){var n=e.nodeType;return n===bi||n===xi?e.textContent:""}e.textContent=t}return e.$dv="",e}(),val:function(e,t){if(v(t)){if(e.multiple&&"select"===U(e)){var n=[];return r(e.options,function(e){e.selected&&n.push(e.value||e.text)}),n}return e.value}e.value=t},html:function(e,t){return v(t)?e.innerHTML:(Ie(e,!0),void(e.innerHTML=t))},empty:Ge},function(e,t){De.prototype[t]=function(t,n){var r,i,o=this.length;if(e!==Ge&&v(2===e.length&&e!==ze&&e!==Be?t:n)){if(y(t)){for(r=0;r<o;r++)if(e===Re)e(this[r],t);else for(i in t)e(this[r],i,t[i]);return this}for(var a=e.$dv,s=v(a)?Math.min(o,1):o,u=0;u<s;u++){var l=e(this[u],t,n);a=a?a+l:l}return a}for(r=0;r<o;r++)e(this[r],t,n);return this}}),r({removeData:Fe,on:function(e,t,n,r){if(m(r))throw ji("onargs","jqLite#on() does not support the `selector` or `eventData` parameters");if(Ae(e)){var i=Ne(e,!0),o=i.events,a=i.handle;a||(a=i.handle=Qe(e,o));for(var s=t.indexOf(" ")>=0?t.split(" "):[t],u=s.length,l=function(t,r,i){var s=o[t];s||(s=o[t]=[],s.specialHandlerWrapper=r,"$destroy"===t||i||e.addEventListener(t,a)),s.push(n)};u--;)t=s[u],Ti[t]?(l(Ti[t],tt),l(t,void 0,!0)):l(t)}},off:Ue,one:function(e,t,n){e=Jr(e),e.on(t,function r(){e.off(t,n),e.off(t,r)}),e.on(t,n)},replaceWith:function(e,t){var n,i=e.parentNode;Ie(e),r(new De(t),function(t){n?i.insertBefore(t,n.nextSibling):i.replaceChild(t,e),n=t})},children:function(e){var t=[];return r(e.childNodes,function(e){e.nodeType===bi&&t.push(e)}),t},contents:function(e){return e.contentDocument||e.childNodes||[]},append:function(e,t){var n=e.nodeType;if(n===bi||n===Ei){t=new De(t);for(var r=0,i=t.length;r<i;r++){var o=t[r];e.appendChild(o)}}},prepend:function(e,t){if(e.nodeType===bi){var n=e.firstChild;r(new De(t),function(t){e.insertBefore(t,n)})}},wrap:function(e,t){Pe(e,Jr(t).eq(0).clone()[0])},remove:Xe,detach:function(e){Xe(e,!0)},after:function(e,t){var n=e,r=e.parentNode;if(r){t=new De(t);for(var i=0,o=t.length;i<o;i++){var a=t[i];r.insertBefore(a,n.nextSibling),n=a}}},addClass:He,removeClass:Le,toggleClass:function(e,t,n){t&&r(t.split(" "),function(t){var r=n;v(r)&&(r=!ze(e,t)),(r?He:Le)(e,t)})},parent:function(e){var t=e.parentNode;return t&&t.nodeType!==Ei?t:null},next:function(e){return e.nextElementSibling},find:function(e,t){return e.getElementsByTagName?e.getElementsByTagName(t):[]},clone:Ve,triggerHandler:function(e,t,n){var i,o,a,s=t.type||t,u=Ne(e),c=u&&u.events,f=c&&c[s];f&&(i={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return this.defaultPrevented===!0},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return this.immediatePropagationStopped===!0},stopPropagation:p,type:s,target:e},t.type&&(i=l(i,t)),o=ye(f),a=n?[i].concat(n):[i],r(o,function(t){i.isImmediatePropagationStopped()||t.apply(e,a)}))}},function(e,t){De.prototype[t]=function(t,n,r){for(var i,o=0,a=this.length;o<a;o++)v(i)?(i=e(this[o],t,n,r),m(i)&&(i=Jr(i))):qe(i,e(this[o],t,n,r));return m(i)?i:this}}),De.prototype.bind=De.prototype.on,De.prototype.unbind=De.prototype.off,it.prototype={put:function(e,t){this[rt(e,this.nextUid)]=t},get:function(e){return this[rt(e,this.nextUid)]},remove:function(e){var t=this[e=rt(e,this.nextUid)];return delete this[e],t}};var Hi=[function(){this.$get=[function(){return it}]}],qi=/^([^(]+?)=>/,Bi=/^[^(]*\(\s*([^)]*)\)/m,Wi=/,/,Gi=/^\s*(_?)(\S+?)\1\s*$/,Xi=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Ki=t("$injector");lt.$$annotate=ut;var Yi=t("$animate"),Ji=1,Zi="ng-animate",Qi=function(){this.$get=p},eo=function(){var e=new it,t=[];this.$get=["$$AnimateRunner","$rootScope",function(n,i){function o(e,t,n){var i=!1;return t&&(t=w(t)?t.split(" "):li(t)?t:[],r(t,function(t){t&&(i=!0,e[t]=n)})),i}function a(){r(t,function(t){var n=e.get(t);if(n){var i=pt(t.attr("class")),o="",a="";r(n,function(e,t){var n=!!i[t];e!==n&&(e?o+=(o.length?" ":"")+t:a+=(a.length?" ":"")+t)}),r(t,function(e){o&&He(e,o),a&&Le(e,a)}),e.remove(t)}}),t.length=0}function s(n,r,s){var u=e.get(n)||{},l=o(u,r,!0),c=o(u,s,!1);(l||c)&&(e.put(n,u),t.push(n),1===t.length&&i.$$postDigest(a))}return{enabled:p,on:p,off:p,pin:p,push:function(e,t,r,i){i&&i(),r=r||{},r.from&&e.css(r.from),r.to&&e.css(r.to),(r.addClass||r.removeClass)&&s(e,r.addClass,r.removeClass);var o=new n;return o.complete(),o}}}]},to=["$provide",function(e){var t=this;this.$$registeredAnimations=Object.create(null),this.register=function(n,r){if(n&&"."!==n.charAt(0))throw Yi("notcsel","Expecting class selector starting with '.' got '{0}'.",n);var i=n+"-animation";t.$$registeredAnimations[n.substr(1)]=i,e.factory(i,r)},this.classNameFilter=function(e){if(1===arguments.length&&(this.$$classNameFilter=e instanceof RegExp?e:null,this.$$classNameFilter)){var t=new RegExp("(\\s+|\\/)"+Zi+"(\\s+|\\/)");if(t.test(this.$$classNameFilter.toString()))throw Yi("nongcls",'$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.',Zi)}return this.$$classNameFilter},this.$get=["$$animateQueue",function(e){function t(e,t,n){if(n){var r=dt(n);!r||r.parentNode||r.previousElementSibling||(n=null)}n?n.after(e):t.prepend(e)}return{on:e.on,off:e.off,pin:e.pin,enabled:e.enabled,cancel:function(e){e.end&&e.end()},enter:function(n,r,i,o){return r=r&&Jr(r),i=i&&Jr(i),r=r||i.parent(),t(n,r,i),e.push(n,"enter",ht(o))},move:function(n,r,i,o){return r=r&&Jr(r),i=i&&Jr(i),r=r||i.parent(),t(n,r,i),e.push(n,"move",ht(o))},leave:function(t,n){return e.push(t,"leave",ht(n),function(){t.remove()})},addClass:function(t,n,r){return r=ht(r),r.addClass=ft(r.addclass,n),e.push(t,"addClass",r)},removeClass:function(t,n,r){return r=ht(r),r.removeClass=ft(r.removeClass,n),e.push(t,"removeClass",r)},setClass:function(t,n,r,i){return i=ht(i),i.addClass=ft(i.addClass,n),i.removeClass=ft(i.removeClass,r),e.push(t,"setClass",i)},animate:function(t,n,r,i,o){return o=ht(o),o.from=o.from?l(o.from,n):n,o.to=o.to?l(o.to,r):r,i=i||"ng-inline-animate",o.tempClasses=ft(o.tempClasses,i),e.push(t,"animate",o)}}}]}],no=function(){this.$get=["$$rAF",function(e){function t(t){n.push(t),n.length>1||e(function(){for(var e=0;e<n.length;e++)n[e]();n=[]})}var n=[];return function(){var e=!1;return t(function(){e=!0}),function(n){e?n():t(n)}}}]},ro=function(){this.$get=["$q","$sniffer","$$animateAsyncRun","$$isDocumentHidden","$timeout",function(e,t,n,i,o){function a(e){this.setHost(e);var t=n(),r=function(e){o(e,0,!1)};this._doneCallbacks=[],this._tick=function(e){i()?r(e):t(e)},this._state=0}var s=0,u=1,l=2;return a.chain=function(e,t){function n(){return r===e.length?void t(!0):void e[r](function(e){return e===!1?void t(!1):(r++,void n())})}var r=0;n()},a.all=function(e,t){function n(n){o=o&&n,++i===e.length&&t(o)}var i=0,o=!0;r(e,function(e){e.done(n)})},a.prototype={setHost:function(e){this.host=e||{}},done:function(e){this._state===l?e():this._doneCallbacks.push(e)},progress:p,getPromise:function(){if(!this.promise){var t=this;this.promise=e(function(e,n){t.done(function(t){t===!1?n():e()})})}return this.promise},then:function(e,t){return this.getPromise().then(e,t)},"catch":function(e){return this.getPromise()["catch"](e)},"finally":function(e){return this.getPromise()["finally"](e)},pause:function(){this.host.pause&&this.host.pause()},resume:function(){this.host.resume&&this.host.resume()},end:function(){this.host.end&&this.host.end(),this._resolve(!0)},cancel:function(){this.host.cancel&&this.host.cancel(),this._resolve(!1)},complete:function(e){var t=this;t._state===s&&(t._state=u,t._tick(function(){t._resolve(e)}))},_resolve:function(e){this._state!==l&&(r(this._doneCallbacks,function(t){t(e)}),this._doneCallbacks.length=0,this._state=l)}},a}]},io=function(){this.$get=["$$rAF","$q","$$AnimateRunner",function(e,t,n){return function(t,r){function i(){return e(function(){o(),s||u.complete(),s=!0}),u}function o(){a.addClass&&(t.addClass(a.addClass),a.addClass=null),a.removeClass&&(t.removeClass(a.removeClass),a.removeClass=null),a.to&&(t.css(a.to),a.to=null)}var a=r||{};a.$$prepared||(a=R(a)),a.cleanupStyles&&(a.from=a.to=null),a.from&&(t.css(a.from),a.from=null);var s,u=new n;return{start:i,end:i}}}]},oo=t("$compile"),ao=new yt;bt.$inject=["$provide","$$sanitizeUriProvider"],wt.prototype.isFirstChange=function(){return this.previousValue===ao};var so=/^((?:x|data)[:\-_])/i,uo=/[:\-_]+(.)/g,lo=t("$controller"),co=/^(\S+)(\s+as\s+([\w$]+))?$/,fo=function(){this.$get=["$document",function(e){return function(t){return t?!t.nodeType&&t instanceof Jr&&(t=t[0]):t=e[0].body,t.offsetWidth+1}}]},po="application/json",ho={"Content-Type":po+";charset=utf-8"},go=/^\[|^\{(?!\{)/,$o={"[":/]$/,"{":/}$/},vo=/^\)]\}',?\n/,mo=t("$http"),yo=ai.$interpolateMinErr=t("$interpolate");yo.throwNoconcat=function(e){throw yo("noconcat","Error while interpolating: {0}\nStrict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce",e)},yo.interr=function(e,t){return yo("interr","Can't interpolate: {0}\n{1}",e,t.toString())};var bo=function(){this.$get=["$window",function(e){function t(e){var t=function(e){t.data=e,t.called=!0};return t.id=e,t}var n=e.angular.callbacks,r={};return{createCallback:function(e){var i="_"+(n.$$counter++).toString(36),o="angular.callbacks."+i,a=t(i);return r[o]=n[i]=a,o},wasCalled:function(e){return r[e].called},getResponse:function(e){return r[e].data},removeCallback:function(e){var t=r[e];delete n[t.id],delete r[e]}}}]},wo=/^([^?#]*)(\?([^#]*))?(#(.*))?$/,xo={http:80,https:443,ftp:21},_o=t("$location"),ko=/^\s*[\\/]{2,}/,Eo={$$absUrl:"",$$html5:!1,$$replace:!1,absUrl:rn("$$absUrl"),url:function(e){if(v(e))return this.$$url;var t=wo.exec(e);return(t[1]||""===e)&&this.path(decodeURIComponent(t[1])),(t[2]||t[1]||""===e)&&this.search(t[3]||""),this.hash(t[5]||""),this},protocol:rn("$$protocol"),host:rn("$$host"),port:rn("$$port"),path:on("$$path",function(e){return e=null!==e?e.toString():"","/"===e.charAt(0)?e:"/"+e}),search:function(e,t){switch(arguments.length){case 0:return this.$$search;case 1:if(w(e)||x(e))e=e.toString(),this.$$search=Q(e);else{if(!y(e))throw _o("isrcharg","The first argument of the `$location#search()` call must be a string or an object.");e=R(e,{}),r(e,function(t,n){null==t&&delete e[n]}),this.$$search=e}break;default:v(t)||null===t?delete this.$$search[e]:this.$$search[e]=t}return this.$$compose(),this},hash:on("$$hash",function(e){return null!==e?e.toString():""}),replace:function(){return this.$$replace=!0,this}};r([nn,tn,en],function(e){e.prototype=Object.create(Eo),e.prototype.state=function(t){if(!arguments.length)return this.$$state;if(e!==en||!this.$$html5)throw _o("nostate","History API state support is available only in HTML5 mode and only in browsers supporting HTML5 History API");return this.$$state=v(t)?null:t,this}});var So=t("$parse"),Co={}.constructor.prototype.valueOf,Ao=$e();r("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),function(e){Ao[e]=!0});var Oo={n:"\n",f:"\f",r:"\r",t:"\t",v:"\x0B","'":"'",'"':'"'},Mo=function(e){this.options=e};Mo.prototype={constructor:Mo,lex:function(e){for(this.text=e,this.index=0,this.tokens=[];this.index<this.text.length;){var t=this.text.charAt(this.index);if('"'===t||"'"===t)this.readString(t);else if(this.isNumber(t)||"."===t&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdentifierStart(this.peekMultichar()))this.readIdent();else if(this.is(t,"(){}[].,;:?"))this.tokens.push({index:this.index,text:t}),this.index++;else if(this.isWhitespace(t))this.index++;else{var n=t+this.peek(),r=n+this.peek(2),i=Ao[t],o=Ao[n],a=Ao[r];if(i||o||a){var s=a?r:o?n:t;this.tokens.push({index:this.index,text:s,operator:!0}),this.index+=s.length}else this.throwError("Unexpected next character ",this.index,this.index+1)}}return this.tokens},is:function(e,t){return t.indexOf(e)!==-1},peek:function(e){var t=e||1;return this.index+t<this.text.length&&this.text.charAt(this.index+t)},isNumber:function(e){return"0"<=e&&e<="9"&&"string"==typeof e},isWhitespace:function(e){return" "===e||"\r"===e||"\t"===e||"\n"===e||"\x0B"===e||" "===e},isIdentifierStart:function(e){return this.options.isIdentifierStart?this.options.isIdentifierStart(e,this.codePointAt(e)):this.isValidIdentifierStart(e)},isValidIdentifierStart:function(e){return"a"<=e&&e<="z"||"A"<=e&&e<="Z"||"_"===e||"$"===e},isIdentifierContinue:function(e){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(e,this.codePointAt(e)):this.isValidIdentifierContinue(e)},isValidIdentifierContinue:function(e,t){return this.isValidIdentifierStart(e,t)||this.isNumber(e)},codePointAt:function(e){return 1===e.length?e.charCodeAt(0):(e.charCodeAt(0)<<10)+e.charCodeAt(1)-56613888},peekMultichar:function(){var e=this.text.charAt(this.index),t=this.peek();if(!t)return e;var n=e.charCodeAt(0),r=t.charCodeAt(0);return n>=55296&&n<=56319&&r>=56320&&r<=57343?e+t:e},isExpOperator:function(e){return"-"===e||"+"===e||this.isNumber(e)},throwError:function(e,t,n){n=n||this.index;var r=m(t)?"s "+t+"-"+this.index+" ["+this.text.substring(t,n)+"]":" "+n;throw So("lexerr","Lexer Error: {0} at column{1} in expression [{2}].",e,r,this.text)},readNumber:function(){for(var e="",t=this.index;this.index<this.text.length;){var n=Wr(this.text.charAt(this.index));if("."===n||this.isNumber(n))e+=n;else{var r=this.peek();if("e"===n&&this.isExpOperator(r))e+=n;else if(this.isExpOperator(n)&&r&&this.isNumber(r)&&"e"===e.charAt(e.length-1))e+=n;else{if(!this.isExpOperator(n)||r&&this.isNumber(r)||"e"!==e.charAt(e.length-1))break;this.throwError("Invalid exponent")}}this.index++}this.tokens.push({index:t,text:e,constant:!0,value:Number(e)})},readIdent:function(){var e=this.index;for(this.index+=this.peekMultichar().length;this.index<this.text.length;){var t=this.peekMultichar();if(!this.isIdentifierContinue(t))break;this.index+=t.length}this.tokens.push({index:e,text:this.text.slice(e,this.index),identifier:!0})},readString:function(e){var t=this.index;this.index++;for(var n="",r=e,i=!1;this.index<this.text.length;){var o=this.text.charAt(this.index);if(r+=o,i){if("u"===o){var a=this.text.substring(this.index+1,this.index+5);a.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+a+"]"),this.index+=4,n+=String.fromCharCode(parseInt(a,16))}else{var s=Oo[o];n+=s||o}i=!1}else if("\\"===o)i=!0;else{if(o===e)return this.index++,void this.tokens.push({index:t,text:r,constant:!0,value:n});n+=o}this.index++}this.throwError("Unterminated quote",t)}};var To=function(e,t){this.lexer=e,this.options=t};To.Program="Program",To.ExpressionStatement="ExpressionStatement",To.AssignmentExpression="AssignmentExpression",To.ConditionalExpression="ConditionalExpression",To.LogicalExpression="LogicalExpression",To.BinaryExpression="BinaryExpression",To.UnaryExpression="UnaryExpression",To.CallExpression="CallExpression",To.MemberExpression="MemberExpression",To.Identifier="Identifier",To.Literal="Literal",To.ArrayExpression="ArrayExpression",To.Property="Property",To.ObjectExpression="ObjectExpression",To.ThisExpression="ThisExpression",To.LocalsExpression="LocalsExpression",To.NGValueParameter="NGValueParameter",To.prototype={ast:function(e){this.text=e,this.tokens=this.lexer.lex(e);var t=this.program();return 0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]),t},program:function(){for(var e=[];;)if(this.tokens.length>0&&!this.peek("}",")",";","]")&&e.push(this.expressionStatement()),!this.expect(";"))return{type:To.Program,body:e}},expressionStatement:function(){return{type:To.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var e=this.expression();this.expect("|");)e=this.filter(e);return e},expression:function(){return this.assignment()},assignment:function(){var e=this.ternary();if(this.expect("=")){if(!hn(e))throw So("lval","Trying to assign a value to a non l-value");e={type:To.AssignmentExpression,left:e,right:this.assignment(),operator:"="}}return e},ternary:function(){var e,t,n=this.logicalOR();return this.expect("?")&&(e=this.expression(),this.consume(":"))?(t=this.expression(),{type:To.ConditionalExpression,test:n,alternate:e,consequent:t}):n},logicalOR:function(){for(var e=this.logicalAND();this.expect("||");)e={type:To.LogicalExpression,operator:"||",left:e,right:this.logicalAND()};return e},logicalAND:function(){for(var e=this.equality();this.expect("&&");)e={type:To.LogicalExpression,operator:"&&",left:e,right:this.equality()};return e},equality:function(){for(var e,t=this.relational();e=this.expect("==","!=","===","!==");)t={type:To.BinaryExpression,operator:e.text,left:t,right:this.relational()};return t},relational:function(){for(var e,t=this.additive();e=this.expect("<",">","<=",">=");)t={type:To.BinaryExpression,operator:e.text,left:t,right:this.additive()};return t},additive:function(){for(var e,t=this.multiplicative();e=this.expect("+","-");)t={type:To.BinaryExpression,operator:e.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t={type:To.BinaryExpression,operator:e.text,left:t,right:this.unary()};return t},unary:function(){var e;return(e=this.expect("+","-","!"))?{type:To.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e;this.expect("(")?(e=this.filterChain(),this.consume(")")):this.expect("[")?e=this.arrayDeclaration():this.expect("{")?e=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?e=R(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:To.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError("not a primary expression",this.peek());for(var t;t=this.expect("(","[",".");)"("===t.text?(e={type:To.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(")")):"["===t.text?(e={type:To.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume("]")):"."===t.text?e={type:To.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return e},filter:function(e){for(var t=[e],n={type:To.CallExpression,callee:this.identifier(),arguments:t,filter:!0};this.expect(":");)t.push(this.expression());return n},parseArguments:function(){var e=[];if(")"!==this.peekToken().text)do e.push(this.filterChain());while(this.expect(","));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError("is not a valid identifier",e),{type:To.Identifier,name:e.text}},constant:function(){return{type:To.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if("]"!==this.peekToken().text)do{if(this.peek("]"))break;e.push(this.expression())}while(this.expect(","));return this.consume("]"),{type:To.ArrayExpression,elements:e}},object:function(){var e,t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;e={type:To.Property,kind:"init"},this.peek().constant?(e.key=this.constant(),e.computed=!1,this.consume(":"),e.value=this.expression()):this.peek().identifier?(e.key=this.identifier(),e.computed=!1,this.peek(":")?(this.consume(":"),e.value=this.expression()):e.value=e.key):this.peek("[")?(this.consume("["),e.key=this.expression(),this.consume("]"),e.computed=!0,this.consume(":"),e.value=this.expression()):this.throwError("invalid key",this.peek()),t.push(e)}while(this.expect(","));return this.consume("}"),{type:To.ObjectExpression,properties:t}},throwError:function(e,t){throw So("syntax","Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw So("ueoe","Unexpected end of expression: {0}",this.text);var t=this.expect(e);return t||this.throwError("is unexpected, expecting ["+e+"]",this.peek()),t},peekToken:function(){if(0===this.tokens.length)throw So("ueoe","Unexpected end of expression: {0}",this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){var o=this.tokens[e],a=o.text;if(a===t||a===n||a===r||a===i||!t&&!n&&!r&&!i)return o}return!1},expect:function(e,t,n,r){var i=this.peek(e,t,n,r);return!!i&&(this.tokens.shift(),i)},selfReferential:{"this":{type:To.ThisExpression},$locals:{type:To.LocalsExpression}}},mn.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},dn(n,t.$filter);var i,o="";if(this.stage="assign",i=gn(n)){this.state.computing="assign";var a=this.nextId();this.recurse(i,a),this.return_(a),o="fn.assign="+this.generateFunction("assign","s,v,l")}var s=pn(n.body);t.stage="inputs",r(s,function(e,n){var r="fn"+n;t.state[r]={vars:[],body:[],own:{}},t.state.computing=r;var i=t.nextId();t.recurse(e,i),t.return_(i),t.state.inputs.push(r),e.watchId=n}),this.state.computing="fn",this.stage="main",this.recurse(n);var u='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+o+this.watchFns()+"return fn;",l=new Function("$filter","getStringValue","ifDefined","plus",u)(this.$filter,un,ln,cn);return this.state=this.stage=void 0,l.literal=$n(n),l.constant=vn(n),l},USE:"use",STRICT:"strict",watchFns:function(){var e=[],t=this.state.inputs,n=this;return r(t,function(t){e.push("var "+t+"="+n.generateFunction(t,"s"))}),t.length&&e.push("fn.inputs=["+t.join(",")+"];"),e.join("")},generateFunction:function(e,t){return"function("+t+"){"+this.varsPrefix(e)+this.body(e)+"};"},filterPrefix:function(){var e=[],t=this;return r(this.state.filters,function(n,r){e.push(n+"=$filter("+t.escape(r)+")")}),e.length?"var "+e.join(",")+";":""},varsPrefix:function(e){return this.state[e].vars.length?"var "+this.state[e].vars.join(",")+";":""},body:function(e){return this.state[e].body.join("")},recurse:function(e,t,n,i,o,a){var s,u,l,c,f,d=this;if(i=i||p,!a&&m(e.watchId))return t=t||this.nextId(),void this.if_("i",this.lazyAssign(t,this.computedMember("i",e.watchId)),this.lazyRecurse(e,t,n,i,o,!0));switch(e.type){case To.Program:r(e.body,function(t,n){d.recurse(t.expression,void 0,void 0,function(e){u=e}),n!==e.body.length-1?d.current().body.push(u,";"):d.return_(u)});break;case To.Literal:c=this.escape(e.value),this.assign(t,c),i(t||c);break;case To.UnaryExpression:this.recurse(e.argument,void 0,void 0,function(e){u=e}),c=e.operator+"("+this.ifDefined(u,0)+")",this.assign(t,c),i(c);break;case To.BinaryExpression:this.recurse(e.left,void 0,void 0,function(e){s=e}),this.recurse(e.right,void 0,void 0,function(e){u=e}),c="+"===e.operator?this.plus(s,u):"-"===e.operator?this.ifDefined(s,0)+e.operator+this.ifDefined(u,0):"("+s+")"+e.operator+"("+u+")",this.assign(t,c),i(c);break;case To.LogicalExpression:t=t||this.nextId(),d.recurse(e.left,t),d.if_("&&"===e.operator?t:d.not(t),d.lazyRecurse(e.right,t)),i(t);break;case To.ConditionalExpression:t=t||this.nextId(),d.recurse(e.test,t),d.if_(t,d.lazyRecurse(e.alternate,t),d.lazyRecurse(e.consequent,t)),i(t);break;case To.Identifier:t=t||this.nextId(),n&&(n.context="inputs"===d.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",e.name)+"?l:s"),n.computed=!1,n.name=e.name),d.if_("inputs"===d.stage||d.not(d.getHasOwnProperty("l",e.name)),function(){d.if_("inputs"===d.stage||"s",function(){o&&1!==o&&d.if_(d.isNull(d.nonComputedMember("s",e.name)),d.lazyAssign(d.nonComputedMember("s",e.name),"{}")),d.assign(t,d.nonComputedMember("s",e.name))})},t&&d.lazyAssign(t,d.nonComputedMember("l",e.name))),i(t);break;case To.MemberExpression:s=n&&(n.context=this.nextId())||this.nextId(),t=t||this.nextId(),d.recurse(e.object,s,void 0,function(){d.if_(d.notNull(s),function(){e.computed?(u=d.nextId(),d.recurse(e.property,u),d.getStringValue(u),o&&1!==o&&d.if_(d.not(d.computedMember(s,u)),d.lazyAssign(d.computedMember(s,u),"{}")),c=d.computedMember(s,u),d.assign(t,c),n&&(n.computed=!0,n.name=u)):(o&&1!==o&&d.if_(d.isNull(d.nonComputedMember(s,e.property.name)),d.lazyAssign(d.nonComputedMember(s,e.property.name),"{}")),c=d.nonComputedMember(s,e.property.name),d.assign(t,c),n&&(n.computed=!1,n.name=e.property.name))},function(){d.assign(t,"undefined")}),i(t)},!!o);break;case To.CallExpression:t=t||this.nextId(),e.filter?(u=d.filter(e.callee.name),l=[],r(e.arguments,function(e){var t=d.nextId();d.recurse(e,t),l.push(t)}),c=u+"("+l.join(",")+")",d.assign(t,c),i(t)):(u=d.nextId(),s={},l=[],d.recurse(e.callee,u,s,function(){d.if_(d.notNull(u),function(){r(e.arguments,function(t){d.recurse(t,e.constant?void 0:d.nextId(),void 0,function(e){l.push(e)})}),c=s.name?d.member(s.context,s.name,s.computed)+"("+l.join(",")+")":u+"("+l.join(",")+")",d.assign(t,c)},function(){d.assign(t,"undefined")}),i(t)}));break;case To.AssignmentExpression:u=this.nextId(),s={},this.recurse(e.left,void 0,s,function(){d.if_(d.notNull(s.context),function(){d.recurse(e.right,u),c=d.member(s.context,s.name,s.computed)+e.operator+u,d.assign(t,c),i(t||c)})},1);break;case To.ArrayExpression:l=[],r(e.elements,function(t){d.recurse(t,e.constant?void 0:d.nextId(),void 0,function(e){l.push(e)})}),c="["+l.join(",")+"]",this.assign(t,c),i(t||c);break;case To.ObjectExpression:l=[],f=!1,r(e.properties,function(e){e.computed&&(f=!0)}),f?(t=t||this.nextId(),this.assign(t,"{}"),r(e.properties,function(e){e.computed?(s=d.nextId(),d.recurse(e.key,s)):s=e.key.type===To.Identifier?e.key.name:""+e.key.value,u=d.nextId(),d.recurse(e.value,u),d.assign(d.member(t,s,e.computed),u)})):(r(e.properties,function(t){d.recurse(t.value,e.constant?void 0:d.nextId(),void 0,function(e){l.push(d.escape(t.key.type===To.Identifier?t.key.name:""+t.key.value)+":"+e)})}),c="{"+l.join(",")+"}",this.assign(t,c)),i(t||c);break;case To.ThisExpression:this.assign(t,"s"),i(t||"s");break;case To.LocalsExpression:this.assign(t,"l"),i(t||"l");break;case To.NGValueParameter:this.assign(t,"v"),i(t||"v")}},getHasOwnProperty:function(e,t){var n=e+"."+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+"&&("+this.escape(t)+" in "+e+")")),r[n]},assign:function(e,t){if(e)return this.current().body.push(e,"=",t,";"),e},filter:function(e){return this.state.filters.hasOwnProperty(e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return"ifDefined("+e+","+this.escape(t)+")"},plus:function(e,t){return"plus("+e+","+t+")"},return_:function(e){this.current().body.push("return ",e,";")},if_:function(e,t,n){if(e===!0)t();else{var r=this.current().body;r.push("if(",e,"){"),t(),r.push("}"),n&&(r.push("else{"),n(),r.push("}"))}},not:function(e){return"!("+e+")"},isNull:function(e){return e+"==null"},notNull:function(e){return e+"!=null"},nonComputedMember:function(e,t){var n=/^[$_a-zA-Z][$_a-zA-Z0-9]*$/,r=/[^$_a-zA-Z0-9]/g;return n.test(t)?e+"."+t:e+'["'+t.replace(r,this.stringEscapeFn)+'"]'},computedMember:function(e,t){return e+"["+t+"]"},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},getStringValue:function(e){this.assign(e,"getStringValue("+e+")")},lazyRecurse:function(e,t,n,r,i,o){var a=this;return function(){a.recurse(e,t,n,r,i,o)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if(w(e))return"'"+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(x(e))return e.toString();if(e===!0)return"true";if(e===!1)return"false";if(null===e)return"null";if("undefined"==typeof e)return"undefined";throw So("esc","IMPOSSIBLE")},nextId:function(e,t){var n="v"+this.state.nextId++;return e||this.current().vars.push(n+(t?"="+t:"")),n},current:function(){return this.state[this.state.computing]}},yn.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);dn(n,t.$filter);var i,o;(i=gn(n))&&(o=this.recurse(i));var a,s=pn(n.body);s&&(a=[],r(s,function(e,n){var r=t.recurse(e);e.input=r,a.push(r),e.watchId=n}));var u=[];r(n.body,function(e){u.push(t.recurse(e.expression))});var l=0===n.body.length?p:1===n.body.length?u[0]:function(e,t){var n;return r(u,function(r){n=r(e,t)}),n};return o&&(l.assign=function(e,t,n){return o(e,n,t)}),a&&(l.inputs=a),l.literal=$n(n),l.constant=vn(n),l},recurse:function(e,t,n){var i,o,a,s=this;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case To.Literal:return this.value(e.value,t);case To.UnaryExpression:return o=this.recurse(e.argument),this["unary"+e.operator](o,t);
7
- case To.BinaryExpression:return i=this.recurse(e.left),o=this.recurse(e.right),this["binary"+e.operator](i,o,t);case To.LogicalExpression:return i=this.recurse(e.left),o=this.recurse(e.right),this["binary"+e.operator](i,o,t);case To.ConditionalExpression:return this["ternary?:"](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case To.Identifier:return s.identifier(e.name,t,n);case To.MemberExpression:return i=this.recurse(e.object,!1,!!n),e.computed||(o=e.property.name),e.computed&&(o=this.recurse(e.property)),e.computed?this.computedMember(i,o,t,n):this.nonComputedMember(i,o,t,n);case To.CallExpression:return a=[],r(e.arguments,function(e){a.push(s.recurse(e))}),e.filter&&(o=this.$filter(e.callee.name)),e.filter||(o=this.recurse(e.callee,!0)),e.filter?function(e,n,r,i){for(var s=[],u=0;u<a.length;++u)s.push(a[u](e,n,r,i));var l=o.apply(void 0,s,i);return t?{context:void 0,name:void 0,value:l}:l}:function(e,n,r,i){var s,u=o(e,n,r,i);if(null!=u.value){for(var l=[],c=0;c<a.length;++c)l.push(a[c](e,n,r,i));s=u.value.apply(u.context,l)}return t?{value:s}:s};case To.AssignmentExpression:return i=this.recurse(e.left,!0,1),o=this.recurse(e.right),function(e,n,r,a){var s=i(e,n,r,a),u=o(e,n,r,a);return s.context[s.name]=u,t?{value:u}:u};case To.ArrayExpression:return a=[],r(e.elements,function(e){a.push(s.recurse(e))}),function(e,n,r,i){for(var o=[],s=0;s<a.length;++s)o.push(a[s](e,n,r,i));return t?{value:o}:o};case To.ObjectExpression:return a=[],r(e.properties,function(e){e.computed?a.push({key:s.recurse(e.key),computed:!0,value:s.recurse(e.value)}):a.push({key:e.key.type===To.Identifier?e.key.name:""+e.key.value,computed:!1,value:s.recurse(e.value)})}),function(e,n,r,i){for(var o={},s=0;s<a.length;++s)a[s].computed?o[a[s].key(e,n,r,i)]=a[s].value(e,n,r,i):o[a[s].key]=a[s].value(e,n,r,i);return t?{value:o}:o};case To.ThisExpression:return function(e){return t?{value:e}:e};case To.LocalsExpression:return function(e,n){return t?{value:n}:n};case To.NGValueParameter:return function(e,n,r){return t?{value:r}:r}}},"unary+":function(e,t){return function(n,r,i,o){var a=e(n,r,i,o);return a=m(a)?+a:0,t?{value:a}:a}},"unary-":function(e,t){return function(n,r,i,o){var a=e(n,r,i,o);return a=m(a)?-a:-0,t?{value:a}:a}},"unary!":function(e,t){return function(n,r,i,o){var a=!e(n,r,i,o);return t?{value:a}:a}},"binary+":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a),u=t(r,i,o,a),l=cn(s,u);return n?{value:l}:l}},"binary-":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a),u=t(r,i,o,a),l=(m(s)?s:0)-(m(u)?u:0);return n?{value:l}:l}},"binary*":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)*t(r,i,o,a);return n?{value:s}:s}},"binary/":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)/t(r,i,o,a);return n?{value:s}:s}},"binary%":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)%t(r,i,o,a);return n?{value:s}:s}},"binary===":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)===t(r,i,o,a);return n?{value:s}:s}},"binary!==":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)!==t(r,i,o,a);return n?{value:s}:s}},"binary==":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)==t(r,i,o,a);return n?{value:s}:s}},"binary!=":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)!=t(r,i,o,a);return n?{value:s}:s}},"binary<":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)<t(r,i,o,a);return n?{value:s}:s}},"binary>":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)>t(r,i,o,a);return n?{value:s}:s}},"binary<=":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)<=t(r,i,o,a);return n?{value:s}:s}},"binary>=":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)>=t(r,i,o,a);return n?{value:s}:s}},"binary&&":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)&&t(r,i,o,a);return n?{value:s}:s}},"binary||":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)||t(r,i,o,a);return n?{value:s}:s}},"ternary?:":function(e,t,n,r){return function(i,o,a,s){var u=e(i,o,a,s)?t(i,o,a,s):n(i,o,a,s);return r?{value:u}:u}},value:function(e,t){return function(){return t?{context:void 0,name:void 0,value:e}:e}},identifier:function(e,t,n){return function(r,i,o,a){var s=i&&e in i?i:r;n&&1!==n&&s&&null==s[e]&&(s[e]={});var u=s?s[e]:void 0;return t?{context:s,name:e,value:u}:u}},computedMember:function(e,t,n,r){return function(i,o,a,s){var u,l,c=e(i,o,a,s);return null!=c&&(u=t(i,o,a,s),u=un(u),r&&1!==r&&c&&!c[u]&&(c[u]={}),l=c[u]),n?{context:c,name:u,value:l}:l}},nonComputedMember:function(e,t,n,r){return function(i,o,a,s){var u=e(i,o,a,s);r&&1!==r&&u&&null==u[t]&&(u[t]={});var l=null!=u?u[t]:void 0;return n?{context:u,name:t,value:l}:l}},inputs:function(e,t){return function(n,r,i,o){return o?o[t]:e(n,r,i)}}};var jo=function(e,t,n){this.lexer=e,this.$filter=t,this.options=n,this.ast=new To(e,n),this.astCompiler=n.csp?new yn(this.ast,t):new mn(this.ast,t)};jo.prototype={constructor:jo,parse:function(e){return this.astCompiler.compile(e)}};var Po=t("$sce"),Do={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Vo=/_([a-z])/g,Io=t("$compile"),Uo=e.document.createElement("a"),Fo=Un(e.location.href);Rn.$inject=["$document"],Ln.$inject=["$provide"];var No=22,Ro=".",zo="0";Gn.$inject=["$locale"],Xn.$inject=["$locale"];var Lo={yyyy:Qn("FullYear",4,0,!1,!0),yy:Qn("FullYear",2,0,!0,!0),y:Qn("FullYear",1,0,!1,!0),MMMM:er("Month"),MMM:er("Month",!0),MM:Qn("Month",2,1),M:Qn("Month",1,1),LLLL:er("Month",!1,!0),dd:Qn("Date",2),d:Qn("Date",1),HH:Qn("Hours",2),H:Qn("Hours",1),hh:Qn("Hours",2,-12),h:Qn("Hours",1,-12),mm:Qn("Minutes",2),m:Qn("Minutes",1),ss:Qn("Seconds",2),s:Qn("Seconds",1),sss:Qn("Milliseconds",3),EEEE:er("Day"),EEE:er("Day",!0),a:or,Z:tr,ww:ir(2),w:ir(1),G:ar,GG:ar,GGG:ar,GGGG:sr},Ho=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,qo=/^-?\d+$/;ur.$inject=["$locale"];var Bo=g(Wr),Wo=g(Gr);dr.$inject=["$parse"];var Go=g({restrict:"E",compile:function(e,t){if(!t.href&&!t.xlinkHref)return function(e,t){if("a"===t[0].nodeName.toLowerCase()){var n="[object SVGAnimatedString]"===ri.call(t.prop("href"))?"xlink:href":"href";t.on("click",function(e){t.attr(n)||e.preventDefault()})}}}}),Xo={};r(Ri,function(e,t){function n(e,n,i){e.$watch(i[r],function(e){i.$set(t,!!e)})}if("multiple"!==e){var r=xt("ng-"+t),i=n;"checked"===e&&(i=function(e,t,i){i.ngModel!==i[r]&&n(e,t,i)}),Xo[r]=function(){return{restrict:"A",priority:100,link:i}}}}),r(Li,function(e,t){Xo[t]=function(){return{priority:100,link:function(e,n,r){if("ngPattern"===t&&"/"===r.ngPattern.charAt(0)){var i=r.ngPattern.match(Hr);if(i)return void r.$set("ngPattern",new RegExp(i[1],i[2]))}e.$watch(r[t],function(e){r.$set(t,e)})}}}}),r(["src","srcset","href"],function(e){var t=xt("ng-"+e);Xo[t]=function(){return{priority:99,link:function(n,r,i){var o=e,a=e;"href"===e&&"[object SVGAnimatedString]"===ri.call(r.prop("href"))&&(a="xlinkHref",i.$attr[a]="xlink:href",o=null),i.$observe(t,function(t){return t?(i.$set(a,t),void(Yr&&o&&r.prop(o,i[a]))):void("href"===e&&i.$set(a,null))})}}}});var Ko={$addControl:p,$$renameControl:hr,$removeControl:p,$setValidity:p,$setDirty:p,$setPristine:p,$setSubmitted:p},Yo="ng-pending",Jo="ng-submitted";gr.$inject=["$element","$attrs","$scope","$animate","$interpolate"],gr.prototype={$rollbackViewValue:function(){r(this.$$controls,function(e){e.$rollbackViewValue()})},$commitViewValue:function(){r(this.$$controls,function(e){e.$commitViewValue()})},$addControl:function(e){pe(e.$name,"input"),this.$$controls.push(e),e.$name&&(this[e.$name]=e),e.$$parentForm=this},$$renameControl:function(e,t){var n=e.$name;this[n]===e&&delete this[n],this[t]=e,e.$name=t},$removeControl:function(e){e.$name&&this[e.$name]===e&&delete this[e.$name],r(this.$pending,function(t,n){this.$setValidity(n,null,e)},this),r(this.$error,function(t,n){this.$setValidity(n,null,e)},this),r(this.$$success,function(t,n){this.$setValidity(n,null,e)},this),N(this.$$controls,e),e.$$parentForm=Ko},$setDirty:function(){this.$$animate.removeClass(this.$$element,Da),this.$$animate.addClass(this.$$element,Va),this.$dirty=!0,this.$pristine=!1,this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,Da,Va+" "+Jo),this.$dirty=!1,this.$pristine=!0,this.$submitted=!1,r(this.$$controls,function(e){e.$setPristine()})},$setUntouched:function(){r(this.$$controls,function(e){e.$setUntouched()})},$setSubmitted:function(){this.$$animate.addClass(this.$$element,Jo),this.$submitted=!0,this.$$parentForm.$setSubmitted()}},vr({clazz:gr,set:function(e,t,n){var r=e[t];if(r){var i=r.indexOf(n);i===-1&&r.push(n)}else e[t]=[n]},unset:function(e,t,n){var r=e[t];r&&(N(r,n),0===r.length&&delete e[t])}});var Zo=function(e){return["$timeout","$parse",function(t,n){function r(e){return""===e?n('this[""]').assign:n(e).assign||p}var i={name:"form",restrict:e?"EAC":"E",require:["form","^^?form"],controller:gr,compile:function(n,i){n.addClass(Da).addClass(ja);var o=i.name?"name":!(!e||!i.ngForm)&&"ngForm";return{pre:function(e,n,i,a){var s=a[0];if(!("action"in i)){var u=function(t){e.$apply(function(){s.$commitViewValue(),s.$setSubmitted()}),t.preventDefault()};n[0].addEventListener("submit",u),n.on("$destroy",function(){t(function(){n[0].removeEventListener("submit",u)},0,!1)})}var c=a[1]||s.$$parentForm;c.$addControl(s);var f=o?r(s.$name):p;o&&(f(e,s),i.$observe(o,function(t){s.$name!==t&&(f(e,void 0),s.$$parentForm.$$renameControl(s,t),(f=r(s.$name))(e,s))})),n.on("$destroy",function(){s.$$parentForm.$removeControl(s),f(e,void 0),l(s,Ko)})}}}};return i}]},Qo=Zo(),ea=Zo(!0),ta=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,na=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:\/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,ra=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,ia=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,oa=/^(\d{4,})-(\d{2})-(\d{2})$/,aa=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,sa=/^(\d{4,})-W(\d\d)$/,ua=/^(\d{4,})-(\d\d)$/,la=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ca="keydown wheel mousedown",fa=$e();r("date,datetime-local,month,time,week".split(","),function(e){fa[e]=!0});var da={text:br,date:kr("date",oa,_r(oa,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":kr("datetimelocal",aa,_r(aa,["yyyy","MM","dd","HH","mm","ss","sss"]),"yyyy-MM-ddTHH:mm:ss.sss"),time:kr("time",la,_r(la,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:kr("week",sa,xr,"yyyy-Www"),month:kr("month",ua,_r(ua,["yyyy","MM"]),"yyyy-MM"),number:Tr,url:Pr,email:Dr,radio:Vr,range:jr,checkbox:Ur,hidden:p,button:p,submit:p,reset:p,file:p},pa=["$browser","$sniffer","$filter","$parse",function(e,t,n,r){return{restrict:"E",require:["?ngModel"],link:{pre:function(i,o,a,s){s[0]&&(da[Wr(a.type)]||da.text)(i,o,a,s[0],t,e,n,r)}}}}],ha=/^(true|false|\d+)$/,ga=function(){function e(e,t,n){e.prop("value",n),t.$set("value",n)}return{restrict:"A",priority:100,compile:function(t,n){return ha.test(n.ngValue)?function(t,n,r){var i=t.$eval(r.ngValue);e(n,r,i)}:function(t,n,r){t.$watch(r.ngValue,function(t){e(n,r,t)})}}}},$a=["$compile",function(e){return{restrict:"AC",compile:function(t){return e.$$addBindingClass(t),function(t,n,r){e.$$addBindingInfo(n,r.ngBind),n=n[0],t.$watch(r.ngBind,function(e){n.textContent=ve(e)})}}}}],va=["$interpolate","$compile",function(e,t){return{compile:function(n){return t.$$addBindingClass(n),function(n,r,i){var o=e(r.attr(i.$attr.ngBindTemplate));t.$$addBindingInfo(r,o.expressions),r=r[0],i.$observe("ngBindTemplate",function(e){r.textContent=v(e)?"":e})}}}}],ma=["$sce","$parse","$compile",function(e,t,n){return{restrict:"A",compile:function(r,i){var o=t(i.ngBindHtml),a=t(i.ngBindHtml,function(t){return e.valueOf(t)});return n.$$addBindingClass(r),function(t,r,i){n.$$addBindingInfo(r,i.ngBindHtml),t.$watch(a,function(){var n=o(t);r.html(e.getTrustedHtml(n)||"")})}}}}],ya=g({restrict:"A",require:"ngModel",link:function(e,t,n,r){r.$viewChangeListeners.push(function(){e.$eval(n.ngChange)})}}),ba=Fr("",!0),wa=Fr("Odd",0),xa=Fr("Even",1),_a=pr({compile:function(e,t){t.$set("ngCloak",void 0),e.removeClass("ng-cloak")}}),ka=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Ea={},Sa={blur:!0,focus:!0};r("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(e){var t=xt("ng-"+e);Ea[t]=["$parse","$rootScope",function(n,r){return{restrict:"A",compile:function(i,o){var a=n(o[t],null,!0);return function(t,n){n.on(e,function(n){var i=function(){a(t,{$event:n})};Sa[e]&&r.$$phase?t.$evalAsync(i):t.$apply(i)})}}}}]});var Ca=["$animate","$compile",function(e,t){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(n,r,i,o,a){var s,u,l;n.$watch(i.ngIf,function(n){n?u||a(function(n,o){u=o,n[n.length++]=t.$$createComment("end ngIf",i.ngIf),s={clone:n},e.enter(n,r.parent(),r)}):(l&&(l.remove(),l=null),u&&(u.$destroy(),u=null),s&&(l=ge(s.clone),e.leave(l).done(function(e){e!==!1&&(l=null)}),s=null))})}}}],Aa=["$templateRequest","$anchorScroll","$animate",function(e,t,n){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:ai.noop,compile:function(r,i){var o=i.ngInclude||i.src,a=i.onload||"",s=i.autoscroll;return function(r,i,u,l,c){var f,d,p,h=0,g=function(){d&&(d.remove(),d=null),f&&(f.$destroy(),f=null),p&&(n.leave(p).done(function(e){e!==!1&&(d=null)}),d=p,p=null)};r.$watch(o,function(o){var u=function(e){e===!1||!m(s)||s&&!r.$eval(s)||t()},d=++h;o?(e(o,!0).then(function(e){if(!r.$$destroyed&&d===h){var t=r.$new();l.template=e;var s=c(t,function(e){g(),n.enter(e,null,i).done(u)});f=t,p=s,f.$emit("$includeContentLoaded",o),r.$eval(a)}},function(){r.$$destroyed||d===h&&(g(),r.$emit("$includeContentError",o))}),r.$emit("$includeContentRequested",o)):(g(),l.template=null)})}}}}],Oa=["$compile",function(t){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(n,r,i,o){return ri.call(r[0]).match(/SVG/)?(r.empty(),void t(Te(o.template,e.document).childNodes)(n,function(e){r.append(e)},{futureParentElement:r})):(r.html(o.template),void t(r.contents())(n))}}}],Ma=pr({priority:450,compile:function(){return{pre:function(e,t,n){e.$eval(n.ngInit)}}}}),Ta=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(e,t,n,i){var o=n.ngList||", ",a="false"!==n.ngTrim,s=a?fi(o):o,u=function(e){if(!v(e)){var t=[];return e&&r(e.split(s),function(e){e&&t.push(a?fi(e):e)}),t}};i.$parsers.push(u),i.$formatters.push(function(e){if(li(e))return e.join(o)}),i.$isEmpty=function(e){return!e||!e.length}}}},ja="ng-valid",Pa="ng-invalid",Da="ng-pristine",Va="ng-dirty",Ia="ng-untouched",Ua="ng-touched",Fa="ng-empty",Na="ng-not-empty",Ra=t("ngModel");Nr.$inject=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$q","$interpolate"],Nr.prototype={$$initGetterSetters:function(){if(this.$options.getOption("getterSetter")){var e=this.$$parse(this.$$attr.ngModel+"()"),t=this.$$parse(this.$$attr.ngModel+"($$$p)");this.$$ngModelGet=function(t){var n=this.$$parsedNgModel(t);return k(n)&&(n=e(t)),n},this.$$ngModelSet=function(e,n){k(this.$$parsedNgModel(e))?t(e,{$$$p:n}):this.$$parsedNgModelAssign(e,n)}}else if(!this.$$parsedNgModel.assign)throw Ra("nonassign","Expression '{0}' is non-assignable. Element: {1}",this.$$attr.ngModel,J(this.$$element))},$render:p,$isEmpty:function(e){return v(e)||""===e||null===e||e!==e},$$updateEmptyClasses:function(e){this.$isEmpty(e)?(this.$$animate.removeClass(this.$$element,Na),this.$$animate.addClass(this.$$element,Fa)):(this.$$animate.removeClass(this.$$element,Fa),this.$$animate.addClass(this.$$element,Na))},$setPristine:function(){this.$dirty=!1,this.$pristine=!0,this.$$animate.removeClass(this.$$element,Va),this.$$animate.addClass(this.$$element,Da)},$setDirty:function(){this.$dirty=!0,this.$pristine=!1,this.$$animate.removeClass(this.$$element,Da),this.$$animate.addClass(this.$$element,Va),this.$$parentForm.$setDirty()},$setUntouched:function(){this.$touched=!1,this.$untouched=!0,this.$$animate.setClass(this.$$element,Ia,Ua)},$setTouched:function(){this.$touched=!0,this.$untouched=!1,this.$$animate.setClass(this.$$element,Ua,Ia)},$rollbackViewValue:function(){this.$$timeout.cancel(this.$$pendingDebounce),this.$viewValue=this.$$lastCommittedViewValue,this.$render()},$validate:function(){if(!ui(this.$modelValue)){var e=this.$$lastCommittedViewValue,t=this.$$rawModelValue,n=this.$valid,r=this.$modelValue,i=this.$options.getOption("allowInvalid"),o=this;this.$$runValidators(t,e,function(e){i||n===e||(o.$modelValue=e?t:void 0,o.$modelValue!==r&&o.$$writeModelToScope())})}},$$runValidators:function(e,t,n){function i(){var e=c.$$parserName||"parse";return v(c.$$parserValid)?(s(e,null),!0):(c.$$parserValid||(r(c.$validators,function(e,t){s(t,null)}),r(c.$asyncValidators,function(e,t){s(t,null)})),s(e,c.$$parserValid),c.$$parserValid)}function o(){var n=!0;return r(c.$validators,function(r,i){var o=Boolean(r(e,t));n=n&&o,s(i,o)}),!!n||(r(c.$asyncValidators,function(e,t){s(t,null)}),!1)}function a(){var n=[],i=!0;r(c.$asyncValidators,function(r,o){var a=r(e,t);if(!j(a))throw Ra("nopromise","Expected asynchronous validator to return a promise but got '{0}' instead.",a);s(o,void 0),n.push(a.then(function(){s(o,!0)},function(){i=!1,s(o,!1)}))}),n.length?c.$$q.all(n).then(function(){u(i)},p):u(!0)}function s(e,t){l===c.$$currentValidationRunId&&c.$setValidity(e,t)}function u(e){l===c.$$currentValidationRunId&&n(e)}this.$$currentValidationRunId++;var l=this.$$currentValidationRunId,c=this;return i()&&o()?void a():void u(!1)},$commitViewValue:function(){var e=this.$viewValue;this.$$timeout.cancel(this.$$pendingDebounce),(this.$$lastCommittedViewValue!==e||""===e&&this.$$hasNativeValidators)&&(this.$$updateEmptyClasses(e),this.$$lastCommittedViewValue=e,this.$pristine&&this.$setDirty(),this.$$parseAndValidate())},$$parseAndValidate:function(){function e(){r.$modelValue!==o&&r.$$writeModelToScope()}var t=this.$$lastCommittedViewValue,n=t,r=this;if(this.$$parserValid=!v(n)||void 0,this.$$parserValid)for(var i=0;i<this.$parsers.length;i++)if(n=this.$parsers[i](n),v(n)){this.$$parserValid=!1;break}ui(this.$modelValue)&&(this.$modelValue=this.$$ngModelGet(this.$$scope));var o=this.$modelValue,a=this.$options.getOption("allowInvalid");this.$$rawModelValue=n,a&&(this.$modelValue=n,e()),this.$$runValidators(n,this.$$lastCommittedViewValue,function(t){a||(r.$modelValue=t?n:void 0,e())})},$$writeModelToScope:function(){this.$$ngModelSet(this.$$scope,this.$modelValue),r(this.$viewChangeListeners,function(e){try{e()}catch(t){this.$$exceptionHandler(t)}},this)},$setViewValue:function(e,t){this.$viewValue=e,this.$options.getOption("updateOnDefault")&&this.$$debounceViewValueCommit(t)},$$debounceViewValueCommit:function(e){var t=this.$options.getOption("debounce");x(t[e])?t=t[e]:x(t["default"])&&(t=t["default"]),this.$$timeout.cancel(this.$$pendingDebounce);var n=this;t>0?this.$$pendingDebounce=this.$$timeout(function(){n.$commitViewValue()},t):this.$$scope.$root.$$phase?this.$commitViewValue():this.$$scope.$apply(function(){n.$commitViewValue()})}},vr({clazz:Nr,set:function(e,t){e[t]=!0},unset:function(e,t){delete e[t]}});var za,La=["$rootScope",function(e){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:Nr,priority:1,compile:function(t){return t.addClass(Da).addClass(Ia).addClass(ja),{pre:function(e,t,n,r){var i=r[0],o=r[1]||i.$$parentForm,a=r[2];a&&(i.$options=a.$options),i.$$initGetterSetters(),o.$addControl(i),n.$observe("name",function(e){i.$name!==e&&i.$$parentForm.$$renameControl(i,e)}),e.$on("$destroy",function(){i.$$parentForm.$removeControl(i)})},post:function(t,n,r,i){function o(){a.$setTouched()}var a=i[0];a.$options.getOption("updateOn")&&n.on(a.$options.getOption("updateOn"),function(e){a.$$debounceViewValueCommit(e&&e.type)}),n.on("blur",function(){a.$touched||(e.$$phase?t.$evalAsync(o):t.$apply(o))})}}}}}],Ha=/(\s+|^)default(\s+|$)/;zr.prototype={getOption:function(e){return this.$$options[e]},createChild:function(e){var t=!1;return e=l({},e),r(e,function(n,r){"$inherit"===n?"*"===r?t=!0:(e[r]=this.$$options[r],"updateOn"===r&&(e.updateOnDefault=this.$$options.updateOnDefault)):"updateOn"===r&&(e.updateOnDefault=!1,e[r]=fi(n.replace(Ha,function(){return e.updateOnDefault=!0," "})))},this),t&&(delete e["*"],Lr(e,this.$$options)),Lr(e,za.$$options),new zr(e)}},za=new zr({updateOn:"",updateOnDefault:!0,debounce:0,getterSetter:!1,allowInvalid:!1,timezone:null});var qa=function(){function e(e,t){this.$$attrs=e,this.$$scope=t}return e.$inject=["$attrs","$scope"],e.prototype={$onInit:function(){var e=this.parentCtrl?this.parentCtrl.$options:za,t=this.$$scope.$eval(this.$$attrs.ngModelOptions);this.$options=e.createChild(t)}},{restrict:"A",priority:10,require:{parentCtrl:"?^^ngModelOptions"},bindToController:!0,controller:e}},Ba=pr({terminal:!0,priority:1e3}),Wa=t("ngOptions"),Ga=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,Xa=["$compile","$document","$parse",function(t,i,o){function a(e,t,r){function i(e,t,n,r,i){this.selectValue=e,this.viewValue=t,this.label=n,this.group=r,this.disabled=i}function a(e){var t;if(!l&&n(e))t=e;else{t=[];for(var r in e)e.hasOwnProperty(r)&&"$"!==r.charAt(0)&&t.push(r)}return t}var s=e.match(Ga);if(!s)throw Wa("iexp","Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}",e,J(t));var u=s[5]||s[7],l=s[6],c=/ as /.test(s[0])&&s[1],f=s[9],d=o(s[2]?s[1]:u),p=c&&o(c),h=p||d,g=f&&o(f),$=f?function(e,t){return g(r,t)}:function(e){return rt(e)},v=function(e,t){return $(e,_(e,t))},m=o(s[2]||s[1]),y=o(s[3]||""),b=o(s[4]||""),w=o(s[8]),x={},_=l?function(e,t){return x[l]=t,x[u]=e,x}:function(e){return x[u]=e,x};return{trackBy:f,getTrackByValue:v,getWatchables:o(w,function(e){var t=[];e=e||[];for(var n=a(e),i=n.length,o=0;o<i;o++){var u=e===n?o:n[o],l=e[u],c=_(l,u),f=$(l,c);if(t.push(f),s[2]||s[1]){var d=m(r,c);t.push(d)}if(s[4]){var p=b(r,c);t.push(p)}}return t}),getOptions:function(){for(var e=[],t={},n=w(r)||[],o=a(n),s=o.length,u=0;u<s;u++){var l=n===o?u:o[u],c=n[l],d=_(c,l),p=h(r,d),g=$(p,d),x=m(r,d),k=y(r,d),E=b(r,d),S=new i(g,p,x,k,E);e.push(S),t[g]=S}return{items:e,selectValueMap:t,getOptionFromViewValue:function(e){return t[v(e)]},getViewValueFromOption:function(e){return f?R(e.viewValue):e.viewValue}}}}}function s(e,n,o,s){function c(e,t){var n=u.cloneNode(!1);t.appendChild(n),d(e,n)}function f(e){var t=_.getOptionFromViewValue(e),n=t&&t.element;return n&&!n.selected&&(n.selected=!0),t}function d(e,t){e.element=t,t.disabled=e.disabled,e.label!==t.label&&(t.label=e.label,t.textContent=e.label),t.value=e.selectValue}function p(){var e=_&&h.readValue();if(_)for(var t=_.items.length-1;t>=0;t--){var r=_.items[t];Xe(m(r.group)?r.element.parentNode:r.element)}_=k.getOptions();var i={};if(w&&n.prepend(h.emptyOption),_.items.forEach(function(e){var t;m(e.group)?(t=i[e.group],t||(t=l.cloneNode(!1),E.appendChild(t),t.label=null===e.group?"null":e.group,i[e.group]=t),c(e,t)):c(e,E)}),n[0].appendChild(E),g.$render(),!g.$isEmpty(e)){var o=h.readValue(),a=k.trackBy||$;(a?z(e,o):e===o)||(g.$setViewValue(o),g.$render())}}for(var h=s[0],g=s[1],$=o.multiple,v=0,y=n.children(),b=y.length;v<b;v++)if(""===y[v].value){h.hasEmptyOption=!0,h.emptyOption=y.eq(v);break}var w=!!h.emptyOption,x=Jr(u.cloneNode(!1));x.val("?");var _,k=a(o.ngOptions,n,e),E=i[0].createDocumentFragment();h.generateUnknownOptionValue=function(e){return"?"},$?(h.writeValue=function(e){var t=e&&e.map(f)||[];_.items.forEach(function(e){e.element.selected&&!F(t,e)&&(e.element.selected=!1)})},h.readValue=function(){var e=n.val()||[],t=[];return r(e,function(e){var n=_.selectValueMap[e];n&&!n.disabled&&t.push(_.getViewValueFromOption(n))}),t},k.trackBy&&e.$watchCollection(function(){if(li(g.$viewValue))return g.$viewValue.map(function(e){return k.getTrackByValue(e)})},function(){g.$render()})):(h.writeValue=function(e){var t=_.selectValueMap[n.val()],r=_.getOptionFromViewValue(e);t&&t.element.removeAttribute("selected"),r?(n[0].value!==r.selectValue&&(h.removeUnknownOption(),h.unselectEmptyOption(),n[0].value=r.selectValue,r.element.selected=!0),r.element.setAttribute("selected","selected")):w?h.selectEmptyOption():h.unknownOption.parent().length?h.updateUnknownOption(e):h.renderUnknownOption(e)},h.readValue=function(){var e=_.selectValueMap[n.val()];return e&&!e.disabled?(h.unselectEmptyOption(),h.removeUnknownOption(),_.getViewValueFromOption(e)):null},k.trackBy&&e.$watch(function(){return k.getTrackByValue(g.$viewValue)},function(){g.$render()})),w&&(h.emptyOption.remove(),t(h.emptyOption)(e),h.emptyOption[0].nodeType===_i?(h.hasEmptyOption=!1,h.registerOption=function(e,t){""===t.val()&&(h.hasEmptyOption=!0,h.emptyOption=t,h.emptyOption.removeClass("ng-scope"),g.$render(),t.on("$destroy",function(){h.hasEmptyOption=!1,h.emptyOption=void 0}))}):h.emptyOption.removeClass("ng-scope")),n.empty(),p(),e.$watchCollection(k.getWatchables,p)}var u=e.document.createElement("option"),l=e.document.createElement("optgroup");return{restrict:"A",terminal:!0,require:["select","ngModel"],link:{pre:function(e,t,n,r){r[0].registerOption=p},post:s}}}],Ka=["$locale","$interpolate","$log",function(e,t,n){var i=/{}/g,o=/^when(Minus)?(.+)$/;return{link:function(a,s,u){function l(e){s.text(e||"")}var c,f=u.count,d=u.$attr.when&&s.attr(u.$attr.when),h=u.offset||0,g=a.$eval(d)||{},$={},m=t.startSymbol(),y=t.endSymbol(),b=m+f+"-"+h+y,w=ai.noop;r(u,function(e,t){var n=o.exec(t);if(n){var r=(n[1]?"-":"")+Wr(n[2]);g[r]=s.attr(u.$attr[t])}}),r(g,function(e,n){$[n]=t(e.replace(i,b))}),a.$watch(f,function(t){var r=parseFloat(t),i=ui(r);if(i||r in g||(r=e.pluralCat(r-h)),!(r===c||i&&ui(c))){w();var o=$[r];v(o)?(null!=t&&n.debug("ngPluralize: no rule defined for '"+r+"' in "+d),w=p,l()):w=a.$watch(o,l),c=r}})}}}],Ya=["$parse","$animate","$compile",function(e,i,o){var a="$$NG_REMOVED",s=t("ngRepeat"),u=function(e,t,n,r,i,o,a){e[n]=r,i&&(e[i]=o),e.$index=t,e.$first=0===t,e.$last=t===a-1,e.$middle=!(e.$first||e.$last),e.$odd=!(e.$even=0===(1&t))},l=function(e){return e.clone[0]},c=function(e){return e.clone[e.clone.length-1]};return{restrict:"A",multiElement:!0,transclude:"element",priority:1e3,terminal:!0,$$tlb:!0,compile:function(t,f){var d=f.ngRepeat,p=o.$$createComment("end ngRepeat",d),h=d.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!h)throw s("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",d);var g=h[1],$=h[2],v=h[3],m=h[4];if(h=g.match(/^(?:(\s*[$\w]+)|\(\s*([$\w]+)\s*,\s*([$\w]+)\s*\))$/),!h)throw s("iidexp","'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",g);var y=h[3]||h[1],b=h[2];if(v&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(v)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(v)))throw s("badident","alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",v);var w,x,_,k,E={$id:rt};return m?w=e(m):(_=function(e,t){return rt(t)},k=function(e){return e}),function(e,t,o,f,h){w&&(x=function(t,n,r){return b&&(E[b]=t),E[y]=n,E.$index=r,w(e,E)});var g=$e();e.$watchCollection($,function(o){var f,$,m,w,E,S,C,A,O,M,T,j,P=t[0],D=$e();if(v&&(e[v]=o),n(o))O=o,A=x||_;else{A=x||k,O=[];for(var V in o)Br.call(o,V)&&"$"!==V.charAt(0)&&O.push(V)}for(w=O.length,T=new Array(w),f=0;f<w;f++)if(E=o===O?f:O[f],S=o[E],C=A(E,S,f),g[C])M=g[C],delete g[C],D[C]=M,T[f]=M;else{if(D[C])throw r(T,function(e){e&&e.scope&&(g[e.id]=e)}),s("dupes","Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",d,C,S);T[f]={id:C,scope:void 0,clone:void 0},D[C]=!0}for(var I in g){if(M=g[I],j=ge(M.clone),i.leave(j),j[0].parentNode)for(f=0,$=j.length;f<$;f++)j[f][a]=!0;M.scope.$destroy()}for(f=0;f<w;f++)if(E=o===O?f:O[f],S=o[E],M=T[f],M.scope){m=P;do m=m.nextSibling;while(m&&m[a]);l(M)!==m&&i.move(ge(M.clone),null,P),P=c(M),u(M.scope,f,y,S,b,E,w)}else h(function(e,t){M.scope=t;var n=p.cloneNode(!1);e[e.length++]=n,i.enter(e,null,P),P=n,M.clone=e,D[M.id]=M,u(M.scope,f,y,S,b,E,w)});g=D})}}}}],Ja="ng-hide",Za="ng-hide-animate",Qa=["$animate",function(e){return{restrict:"A",multiElement:!0,link:function(t,n,r){t.$watch(r.ngShow,function(t){e[t?"removeClass":"addClass"](n,Ja,{tempClasses:Za})})}}}],es=["$animate",function(e){return{restrict:"A",multiElement:!0,link:function(t,n,r){t.$watch(r.ngHide,function(t){e[t?"addClass":"removeClass"](n,Ja,{tempClasses:Za})})}}}],ts=pr(function(e,t,n){e.$watch(n.ngStyle,function(e,n){n&&e!==n&&r(n,function(e,n){t.css(n,"")}),e&&t.css(e)},!0)}),ns=["$animate","$compile",function(e,t){return{require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(n,i,o,a){var s=o.ngSwitch||o.on,u=[],l=[],c=[],f=[],d=function(e,t){return function(n){n!==!1&&e.splice(t,1)}};n.$watch(s,function(n){for(var i,o;c.length;)e.cancel(c.pop());for(i=0,o=f.length;i<o;++i){var s=ge(l[i].clone);f[i].$destroy();var p=c[i]=e.leave(s);p.done(d(c,i))}l.length=0,f.length=0,(u=a.cases["!"+n]||a.cases["?"])&&r(u,function(n){n.transclude(function(r,i){f.push(i);var o=n.element;r[r.length++]=t.$$createComment("end ngSwitchWhen");var a={clone:r};l.push(a),e.enter(r,o.parent(),o)})})})}}}],rs=pr({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(e,t,n,i,o){var a=n.ngSwitchWhen.split(n.ngSwitchWhenSeparator).sort().filter(function(e,t,n){return n[t-1]!==e});r(a,function(e){i.cases["!"+e]=i.cases["!"+e]||[],i.cases["!"+e].push({transclude:o,element:t})})}}),is=pr({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(e,t,n,r,i){r.cases["?"]=r.cases["?"]||[],r.cases["?"].push({transclude:i,element:t})}}),os=t("ngTransclude"),as=["$compile",function(e){return{restrict:"EAC",terminal:!0,compile:function(t){var n=e(t.contents());return t.empty(),function(e,t,r,i,o){function a(e,n){e.length&&u(e)?t.append(e):(s(),n.$destroy())}function s(){n(e,function(e){t.append(e)})}function u(e){for(var t=0,n=e.length;t<n;t++){var r=e[t];if(r.nodeType!==xi||r.nodeValue.trim())return!0}}if(!o)throw os("orphan","Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}",J(t));r.ngTransclude===r.$attr.ngTransclude&&(r.ngTransclude="");var l=r.ngTransclude||r.ngTranscludeSlot;o(a,null,l),l&&!o.isSlotFilled(l)&&s()}}}}],ss=["$templateCache",function(e){return{restrict:"E",terminal:!0,compile:function(t,n){if("text/ng-template"===n.type){var r=n.id,i=t[0].text;e.put(r,i)}}}}],us={$setViewValue:p,$render:p},ls=["$element","$scope",function(t,n){function r(){u||(u=!0,n.$$postDigest(function(){u=!1,a.ngModelCtrl.$render()}))}function i(e){l||(l=!0,n.$$postDigest(function(){n.$$destroyed||(l=!1,a.ngModelCtrl.$setViewValue(a.readValue()),e&&a.ngModelCtrl.$render())}))}function o(e){e.prop("selected",!0),e.attr("selected",!0)}var a=this,s=new it;a.selectValueMap={},a.ngModelCtrl=us,a.multiple=!1,a.unknownOption=Jr(e.document.createElement("option")),a.hasEmptyOption=!1,a.emptyOption=void 0,a.renderUnknownOption=function(e){var n=a.generateUnknownOptionValue(e);a.unknownOption.val(n),t.prepend(a.unknownOption),o(a.unknownOption),t.val(n)},a.updateUnknownOption=function(e){var n=a.generateUnknownOptionValue(e);a.unknownOption.val(n),o(a.unknownOption),t.val(n)},a.generateUnknownOptionValue=function(e){
8
- return"? "+rt(e)+" ?"},a.removeUnknownOption=function(){a.unknownOption.parent()&&a.unknownOption.remove()},a.selectEmptyOption=function(){a.emptyOption&&(t.val(""),o(a.emptyOption))},a.unselectEmptyOption=function(){a.hasEmptyOption&&a.emptyOption.removeAttr("selected")},n.$on("$destroy",function(){a.renderUnknownOption=p}),a.readValue=function(){var e=t.val(),n=e in a.selectValueMap?a.selectValueMap[e]:e;return a.hasOption(n)?n:null},a.writeValue=function(e){var n=t[0].options[t[0].selectedIndex];if(n&&n.removeAttribute("selected"),a.hasOption(e)){a.removeUnknownOption();var r=rt(e);t.val(r in a.selectValueMap?r:e);var i=t[0].options[t[0].selectedIndex];o(Jr(i))}else null==e&&a.emptyOption?(a.removeUnknownOption(),a.selectEmptyOption()):a.unknownOption.parent().length?a.updateUnknownOption(e):a.renderUnknownOption(e)},a.addOption=function(e,t){if(t[0].nodeType!==_i){pe(e,'"option value"'),""===e&&(a.hasEmptyOption=!0,a.emptyOption=t);var n=s.get(e)||0;s.put(e,n+1),r()}},a.removeOption=function(e){var t=s.get(e);t&&(1===t?(s.remove(e),""===e&&(a.hasEmptyOption=!1,a.emptyOption=void 0)):s.put(e,t-1))},a.hasOption=function(e){return!!s.get(e)};var u=!1,l=!1;a.registerOption=function(e,t,n,r,o){if(n.$attr.ngValue){var s,u=NaN;n.$observe("value",function(e){var n,r=t.prop("selected");m(u)&&(a.removeOption(s),delete a.selectValueMap[u],n=!0),u=rt(e),s=e,a.selectValueMap[u]=e,a.addOption(e,t),t.attr("value",u),n&&r&&i()})}else r?n.$observe("value",function(e){a.readValue();var n,r=t.prop("selected");m(s)&&(a.removeOption(s),n=!0),s=e,a.addOption(e,t),n&&r&&i()}):o?e.$watch(o,function(e,r){n.$set("value",e);var o=t.prop("selected");r!==e&&a.removeOption(r),a.addOption(e,t),r&&o&&i()}):a.addOption(n.value,t);n.$observe("disabled",function(e){("true"===e||e&&t.prop("selected"))&&(a.multiple?i(!0):(a.ngModelCtrl.$setViewValue(null),a.ngModelCtrl.$render()))}),t.on("$destroy",function(){var e=a.readValue(),t=n.value;a.removeOption(t),a.ngModelCtrl.$render(),(a.multiple&&e&&e.indexOf(t)!==-1||e===t)&&i(!0)})}}],cs=function(){function e(e,t,n,i){var o=i[0],a=i[1];if(!a)return void(o.registerOption=p);if(o.ngModelCtrl=a,t.on("change",function(){o.removeUnknownOption(),e.$apply(function(){a.$setViewValue(o.readValue())})}),n.multiple){o.multiple=!0,o.readValue=function(){var e=[];return r(t.find("option"),function(t){if(t.selected&&!t.disabled){var n=t.value;e.push(n in o.selectValueMap?o.selectValueMap[n]:n)}}),e},o.writeValue=function(e){var n=new it(e);r(t.find("option"),function(e){e.selected=m(n.get(e.value))||m(n.get(o.selectValueMap[e.value]))})};var s,u=NaN;e.$watch(function(){u!==a.$viewValue||z(s,a.$viewValue)||(s=ye(a.$viewValue),a.$render()),u=a.$viewValue}),a.$isEmpty=function(e){return!e||0===e.length}}}function t(e,t,n,r){var i=r[1];if(i){var o=r[0];i.$render=function(){o.writeValue(i.$viewValue)}}}return{restrict:"E",require:["select","?ngModel"],controller:ls,priority:1,link:{pre:e,post:t}}},fs=["$interpolate",function(e){return{restrict:"E",priority:100,compile:function(t,n){var r,i;return m(n.ngValue)||(m(n.value)?r=e(n.value,!0):(i=e(t.text(),!0),i||n.$set("value",t.text()))),function(e,t,n){var o="$selectController",a=t.parent(),s=a.data(o)||a.parent().data(o);s&&s.registerOption(e,t,n,r,i)}}}}],ds=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){r&&(n.required=!0,r.$validators.required=function(e,t){return!n.required||!r.$isEmpty(t)},n.$observe("required",function(){r.$validate()}))}}},ps=function(){return{restrict:"A",require:"?ngModel",link:function(e,n,r,i){if(i){var o,a=r.ngPattern||r.pattern;r.$observe("pattern",function(e){if(w(e)&&e.length>0&&(e=new RegExp("^"+e+"$")),e&&!e.test)throw t("ngPattern")("noregexp","Expected {0} to be a RegExp but was {1}. Element: {2}",a,e,J(n));o=e||void 0,i.$validate()}),i.$validators.pattern=function(e,t){return i.$isEmpty(t)||v(o)||o.test(t)}}}}},hs=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){if(r){var i=-1;n.$observe("maxlength",function(e){var t=f(e);i=ui(t)?-1:t,r.$validate()}),r.$validators.maxlength=function(e,t){return i<0||r.$isEmpty(t)||t.length<=i}}}}},gs=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){if(r){var i=0;n.$observe("minlength",function(e){i=f(e)||0,r.$validate()}),r.$validators.minlength=function(e,t){return r.$isEmpty(t)||t.length>=i}}}}};return e.angular.bootstrap?void(e.console&&console.log("WARNING: Tried to load angular more than once.")):(ce(),xe(ai),ai.module("ngLocale",[],["$provide",function(e){function t(e){e+="";var t=e.indexOf(".");return t==-1?0:e.length-t-1}function n(e,n){var r=n;void 0===r&&(r=Math.min(t(e),3));var i=Math.pow(10,r),o=(e*i|0)%i;return{v:r,f:o}}var r={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};e.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],SHORTDAY:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],SHORTMONTH:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],STANDALONEMONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-¤",negSuf:"",posPre:"¤",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(e,t){var i=0|e,o=n(e,t);return 1==i&&0==o.v?r.ONE:r.OTHER}})}]),void Jr(function(){oe(e.document,ae)}))}(window),!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>')},{}],42:[function(e,t,n){e("./angular"),t.exports=angular},{"./angular":41}],43:[function(e,t,n){!function(){function e(e,t){window.XMLHttpRequest.prototype[e]=t(window.XMLHttpRequest.prototype[e])}function t(e,t,n){try{Object.defineProperty(e,t,{get:n})}catch(r){}}if(window.FileAPI||(window.FileAPI={}),!window.XMLHttpRequest)throw"AJAX is not supported. XMLHttpRequest is not defined.";if(FileAPI.shouldLoad=!window.FormData||FileAPI.forceLoad,FileAPI.shouldLoad){var n=function(e){if(!e.__listeners){e.upload||(e.upload={}),e.__listeners=[];var t=e.upload.addEventListener;e.upload.addEventListener=function(n,r){e.__listeners[n]=r,t&&t.apply(this,arguments)}}};e("open",function(e){return function(t,r,i){n(this),this.__url=r;try{e.apply(this,[t,r,i])}catch(o){o.message.indexOf("Access is denied")>-1&&(this.__origError=o,e.apply(this,[t,"_fix_for_ie_crossdomain__",i]))}}}),e("getResponseHeader",function(e){return function(t){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(t):null==e?null:e.apply(this,[t])}}),e("getAllResponseHeaders",function(e){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==e?null:e.apply(this)}}),e("abort",function(e){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==e?null:e.apply(this)}}),e("setRequestHeader",function(e){return function(t,r){if("__setXHR_"===t){n(this);var i=r(this);i instanceof Function&&i(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[t]=r,e.apply(this,arguments)}}),e("send",function(e){return function(){var n=this;if(arguments[0]&&arguments[0].__isFileAPIShim){var r=arguments[0],i={url:n.__url,jsonp:!1,cache:!0,complete:function(e,r){e&&angular.isString(e)&&e.indexOf("#2174")!==-1&&(e=null),n.__completed=!0,!e&&n.__listeners.load&&n.__listeners.load({type:"load",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),!e&&n.__listeners.loadend&&n.__listeners.loadend({type:"loadend",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),"abort"===e&&n.__listeners.abort&&n.__listeners.abort({type:"abort",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),void 0!==r.status&&t(n,"status",function(){return 0===r.status&&e&&"abort"!==e?500:r.status}),void 0!==r.statusText&&t(n,"statusText",function(){return r.statusText}),t(n,"readyState",function(){return 4}),void 0!==r.response&&t(n,"response",function(){return r.response});var i=r.responseText||(e&&0===r.status&&"abort"!==e?e:void 0);t(n,"responseText",function(){return i}),t(n,"response",function(){return i}),e&&t(n,"err",function(){return e}),n.__fileApiXHR=r,n.onreadystatechange&&n.onreadystatechange(),n.onload&&n.onload()},progress:function(e){if(e.target=n,n.__listeners.progress&&n.__listeners.progress(e),n.__total=e.total,n.__loaded=e.loaded,e.total===e.loaded){var t=this;setTimeout(function(){n.__completed||(n.getAllResponseHeaders=function(){},t.complete(null,{status:204,statusText:"No Content"}))},FileAPI.noContentTimeout||1e4)}},headers:n.__requestHeaders};i.data={},i.files={};for(var o=0;o<r.data.length;o++){var a=r.data[o];null!=a.val&&null!=a.val.name&&null!=a.val.size&&null!=a.val.type?i.files[a.key]=a.val:i.data[a.key]=a.val}setTimeout(function(){if(!FileAPI.hasFlash)throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';n.__fileApiXHR=FileAPI.upload(i)},1)}else{if(this.__origError)throw this.__origError;e.apply(n,arguments)}}}),window.XMLHttpRequest.__isFileAPIShim=!0,window.FormData=FormData=function(){return{append:function(e,t,n){t.__isFileAPIBlobShim&&(t=t.data[0]),this.data.push({key:e,val:t,name:n})},data:[],__isFileAPIShim:!0}},window.Blob=Blob=function(e){return{data:e,__isFileAPIBlobShim:!0}}}}(),function(){function e(e){return"input"===e[0].tagName.toLowerCase()&&e.attr("type")&&"file"===e.attr("type").toLowerCase()}function t(){try{var e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(e)return!0}catch(t){if(void 0!==navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1}function n(e){var t=0,n=0;if(window.jQuery)return jQuery(e).offset();if(e.offsetParent)do t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent;while(e);return{left:t,top:n}}if(FileAPI.shouldLoad){if(FileAPI.hasFlash=t(),FileAPI.forceLoad&&(FileAPI.html5=!1),!FileAPI.upload){var r,i,o,a,s,u=document.createElement("script"),l=document.getElementsByTagName("script");if(window.FileAPI.jsUrl)r=window.FileAPI.jsUrl;else if(window.FileAPI.jsPath)i=window.FileAPI.jsPath;else for(o=0;o<l.length;o++)if(s=l[o].src,a=s.search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/),a>-1){i=s.substring(0,a+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=i),u.setAttribute("src",r||i+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(u)}FileAPI.ngfFixIE=function(r,i,o){if(!t())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var a=function(){var t=i.parent();r.attr("disabled")?t&&t.removeClass("js-fileapi-wrapper"):(i.attr("__ngf_flash_")||(i.unbind("change"),i.unbind("click"),i.bind("change",function(e){s.apply(this,[e]),o.apply(this,[e])}),i.attr("__ngf_flash_","true")),t.addClass("js-fileapi-wrapper"),e(r)||(t.css("position","absolute").css("top",n(r[0]).top+"px").css("left",n(r[0]).left+"px").css("width",r[0].offsetWidth+"px").css("height",r[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",r.css("display")).css("overflow","hidden").css("z-index","900000").css("visibility","visible"),i.css("width",r[0].offsetWidth+"px").css("height",r[0].offsetHeight+"px").css("position","absolute").css("top","0px").css("left","0px")))};r.bind("mouseenter",a);var s=function(e){for(var t=FileAPI.getFiles(e),n=0;n<t.length;n++)void 0===t[n].size&&(t[n].size=0),void 0===t[n].name&&(t[n].name="file"),void 0===t[n].type&&(t[n].type="undefined");e.target||(e.target={}),e.target.files=t,e.target.files!==t&&(e.__files_=t),(e.__files_||e.target.files).item=function(t){return(e.__files_||e.target.files)[t]||null}}},FileAPI.disableFileInput=function(e,t){t?e.removeClass("js-fileapi-wrapper"):e.addClass("js-fileapi-wrapper")}}}(),window.FileReader||(window.FileReader=function(){var e=this,t=!1;this.listeners={},this.addEventListener=function(t,n){e.listeners[t]=e.listeners[t]||[],e.listeners[t].push(n)},this.removeEventListener=function(t,n){e.listeners[t]&&e.listeners[t].splice(e.listeners[t].indexOf(n),1)},this.dispatchEvent=function(t){var n=e.listeners[t.type];if(n)for(var r=0;r<n.length;r++)n[r].call(e,t)},this.onabort=this.onerror=this.onload=this.onloadstart=this.onloadend=this.onprogress=null;var n=function(t,n){var r={type:t,target:e,loaded:n.loaded,total:n.total,error:n.error};return null!=n.result&&(r.target.result=n.result),r},r=function(r){t||(t=!0,e.onloadstart&&e.onloadstart(n("loadstart",r)));var i;"load"===r.type?(e.onloadend&&e.onloadend(n("loadend",r)),i=n("load",r),e.onload&&e.onload(i),e.dispatchEvent(i)):"progress"===r.type?(i=n("progress",r),e.onprogress&&e.onprogress(i),e.dispatchEvent(i)):(i=n("error",r),e.onerror&&e.onerror(i),e.dispatchEvent(i))};this.readAsDataURL=function(e){FileAPI.readAsDataURL(e,r)},this.readAsText=function(e){FileAPI.readAsText(e,r)}}),!window.XMLHttpRequest||window.FileAPI&&FileAPI.shouldLoad||(window.XMLHttpRequest.prototype.setRequestHeader=function(e){return function(t,n){if("__setXHR_"===t){var r=n(this);r instanceof Function&&r(this)}else e.apply(this,arguments)}}(window.XMLHttpRequest.prototype.setRequestHeader));var r=angular.module("ngFileUpload",[]);r.version="12.2.13",r.service("UploadBase",["$http","$q","$timeout",function(e,t,n){function i(r){function i(e){l.notify&&l.notify(e),c.progressFunc&&n(function(){c.progressFunc(e)})}function o(e){return null!=r._start&&s?{loaded:e.loaded+r._start,total:r._file&&r._file.size||e.total,type:e.type,config:r,lengthComputable:!0,target:e.target}:e}function u(){e(r).then(function(e){if(s&&r._chunkSize&&!r._finished&&r._file){var t=r._file&&r._file.size||0;i({loaded:Math.min(r._end,t),total:t,config:r,type:"progress"}),a.upload(r,!0)}else r._finished&&delete r._finished,l.resolve(e)},function(e){l.reject(e)},function(e){l.notify(e)})}r.method=r.method||"POST",r.headers=r.headers||{};var l=r._deferred=r._deferred||t.defer(),c=l.promise;return r.disableProgress||(r.headers.__setXHR_=function(){return function(e){e&&e.upload&&e.upload.addEventListener&&(r.__XHR=e,r.xhrFn&&r.xhrFn(e),e.upload.addEventListener("progress",function(e){e.config=r,i(o(e))},!1),e.upload.addEventListener("load",function(e){e.lengthComputable&&(e.config=r,i(o(e)))},!1))}}),s?r._chunkSize&&r._end&&!r._finished?(r._start=r._end,r._end+=r._chunkSize,u()):r.resumeSizeUrl?e.get(r.resumeSizeUrl).then(function(e){r.resumeSizeResponseReader?r._start=r.resumeSizeResponseReader(e.data):r._start=parseInt((null==e.data.size?e.data:e.data.size).toString()),r._chunkSize&&(r._end=r._start+r._chunkSize),u()},function(e){throw e}):r.resumeSize?r.resumeSize().then(function(e){r._start=e,r._chunkSize&&(r._end=r._start+r._chunkSize),u()},function(e){throw e}):(r._chunkSize&&(r._start=0,r._end=r._start+r._chunkSize),u()):u(),c.success=function(e){return c.then(function(t){e(t.data,t.status,t.headers,r)}),c},c.error=function(e){return c.then(null,function(t){e(t.data,t.status,t.headers,r)}),c},c.progress=function(e){return c.progressFunc=e,c.then(null,null,function(t){e(t)}),c},c.abort=c.pause=function(){return r.__XHR&&n(function(){r.__XHR.abort()}),c},c.xhr=function(e){return r.xhrFn=function(t){return function(){t&&t.apply(c,arguments),e.apply(c,arguments)}}(r.xhrFn),c},a.promisesCount++,c["finally"]&&c["finally"]instanceof Function&&c["finally"](function(){a.promisesCount--}),c}function o(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var a=this;a.promisesCount=0,this.isResumeSupported=function(){return window.Blob&&window.Blob.prototype.slice};var s=this.isResumeSupported();this.isUploadInProgress=function(){return a.promisesCount>0},this.rename=function(e,t){return e.ngfName=t,e},this.jsonBlob=function(e){null==e||angular.isString(e)||(e=JSON.stringify(e));var t=new window.Blob([e],{type:"application/json"});return t._ngfBlob=!0,t},this.json=function(e){return angular.toJson(e)},this.isFile=function(e){return null!=e&&(e instanceof window.Blob||e.flashId&&e.name&&e.size)},this.upload=function(e,t){function n(t,n){if(t._ngfBlob)return t;if(e._file=e._file||t,null!=e._start&&s){e._end&&e._end>=t.size&&(e._finished=!0,e._end=t.size);var r=t.slice(e._start,e._end||t.size);return r.name=t.name,r.ngfName=t.ngfName,e._chunkSize&&(n.append("_chunkSize",e._chunkSize),n.append("_currentChunkSize",e._end-e._start),n.append("_chunkNumber",Math.floor(e._start/e._chunkSize)),n.append("_totalSize",e._file.size)),r}return t}function r(t,i,o){if(void 0!==i)if(angular.isDate(i)&&(i=i.toISOString()),angular.isString(i))t.append(o,i);else if(a.isFile(i)){var s=n(i,t),u=o.split(",");u[1]&&(s.ngfName=u[1].replace(/^\s+|\s+$/g,""),o=u[0]),e._fileKey=e._fileKey||o,t.append(o,s,s.ngfName||s.name)}else if(angular.isObject(i)){if(i.$$ngfCircularDetection)throw"ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: "+o;i.$$ngfCircularDetection=!0;try{for(var l in i)if(i.hasOwnProperty(l)&&"$$ngfCircularDetection"!==l){var c=null==e.objectKey?"[i]":e.objectKey;i.length&&parseInt(l)>-1&&(c=null==e.arrayKey?c:e.arrayKey),r(t,i[l],o+c.replace(/[ik]/g,l))}}finally{delete i.$$ngfCircularDetection}}else t.append(o,i)}function u(){e._chunkSize=a.translateScalars(e.resumeChunkSize),e._chunkSize=e._chunkSize?parseInt(e._chunkSize.toString()):null,e.headers=e.headers||{},e.headers["Content-Type"]=void 0,e.transformRequest=e.transformRequest?angular.isArray(e.transformRequest)?e.transformRequest:[e.transformRequest]:[],e.transformRequest.push(function(t){var n,i=new window.FormData;t=t||e.fields||{},e.file&&(t.file=e.file);for(n in t)if(t.hasOwnProperty(n)){var o=t[n];e.formDataAppender?e.formDataAppender(i,n,o):r(i,o,n)}return i})}return t||(e=o(e)),e._isDigested||(e._isDigested=!0,u()),i(e)},this.http=function(t){return t=o(t),t.transformRequest=t.transformRequest||function(t){return window.ArrayBuffer&&t instanceof window.ArrayBuffer||t instanceof window.Blob?t:e.defaults.transformRequest[0].apply(this,arguments)},t._chunkSize=a.translateScalars(t.resumeChunkSize),t._chunkSize=t._chunkSize?parseInt(t._chunkSize.toString()):null,i(t)},this.translateScalars=function(e){if(angular.isString(e)){if(e.search(/kb/i)===e.length-2)return parseFloat(1024*e.substring(0,e.length-2));if(e.search(/mb/i)===e.length-2)return parseFloat(1048576*e.substring(0,e.length-2));if(e.search(/gb/i)===e.length-2)return parseFloat(1073741824*e.substring(0,e.length-2));if(e.search(/b/i)===e.length-1)return parseFloat(e.substring(0,e.length-1));if(e.search(/s/i)===e.length-1)return parseFloat(e.substring(0,e.length-1));if(e.search(/m/i)===e.length-1)return parseFloat(60*e.substring(0,e.length-1));if(e.search(/h/i)===e.length-1)return parseFloat(3600*e.substring(0,e.length-1))}return e},this.urlToBlob=function(n){var r=t.defer();return e({url:n,method:"get",responseType:"arraybuffer"}).then(function(e){var t=new Uint8Array(e.data),i=e.headers("content-type")||"image/WebP",o=new window.Blob([t],{type:i}),a=n.match(/.*\/(.+?)(\?.*)?$/);a.length>1&&(o.name=a[1]),r.resolve(o)},function(e){r.reject(e)}),r.promise},this.setDefaults=function(e){this.defaults=e||{}},this.defaults={},this.version=r.version}]),r.service("Upload",["$parse","$timeout","$compile","$q","UploadExif",function(e,t,n,r,i){function o(e,t,n){var i=[u.emptyPromise()];return angular.forEach(e,function(r,o){0===r.type.indexOf("image/jpeg")&&u.attrGetter("ngfFixOrientation",t,n,{$file:r})&&i.push(u.happyPromise(u.applyExifRotation(r),r).then(function(t){e.splice(o,1,t)}))}),r.all(i)}function a(e,t,n,i){var o=u.attrGetter("ngfResize",t,n);if(!o||!u.isResizeSupported()||!e.length)return u.emptyPromise();if(o instanceof Function){var a=r.defer();return o(e).then(function(r){s(r,e,t,n,i).then(function(e){a.resolve(e)},function(e){a.reject(e)})},function(e){a.reject(e)})}return s(o,e,t,n,i)}function s(e,t,n,i,o){function a(r,a){if(0===r.type.indexOf("image")){if(e.pattern&&!u.validatePattern(r,e.pattern))return;e.resizeIf=function(e,t){return u.attrGetter("ngfResizeIf",n,i,{$width:e,$height:t,$file:r})};var l=u.resize(r,e);s.push(l),l.then(function(e){t.splice(a,1,e)},function(e){r.$error="resize",(r.$errorMessages=r.$errorMessages||{}).resize=!0,r.$errorParam=(e?(e.message?e.message:e)+": ":"")+(r&&r.name),o.$ngfValidations.push({name:"resize",valid:!1}),u.applyModelValidation(o,t)})}}for(var s=[u.emptyPromise()],l=0;l<t.length;l++)a(t[l],l);return r.all(s)}var u=i;return u.getAttrWithDefaults=function(e,t){if(null!=e[t])return e[t];var n=u.defaults[t];return null==n?n:angular.isString(n)?n:JSON.stringify(n)},u.attrGetter=function(t,n,r,i){var o=this.getAttrWithDefaults(n,t);if(!r)return o;try{return i?e(o)(r,i):e(o)(r)}catch(a){if(t.search(/min|max|pattern/i))return o;throw a}},u.shouldUpdateOn=function(e,t,n){var r=u.attrGetter("ngfModelOptions",t,n);return!r||!r.updateOn||r.updateOn.split(" ").indexOf(e)>-1},u.emptyPromise=function(){var e=r.defer(),n=arguments;return t(function(){e.resolve.apply(e,n)}),e.promise},u.rejectPromise=function(){var e=r.defer(),n=arguments;return t(function(){e.reject.apply(e,n)}),e.promise},u.happyPromise=function(e,n){var i=r.defer();return e.then(function(e){i.resolve(e)},function(e){t(function(){throw e}),i.resolve(n)}),i.promise},u.updateModel=function(n,r,i,s,l,c,f){function d(o,a,l,f,d){r.$$ngfPrevValidFiles=o,r.$$ngfPrevInvalidFiles=a;var p=o&&o.length?o[0]:null,h=a&&a.length?a[0]:null;n&&(u.applyModelValidation(n,o),n.$setViewValue(d?p:o)),s&&e(s)(i,{$files:o,$file:p,$newFiles:l,$duplicateFiles:f,$invalidFiles:a,$invalidFile:h,$event:c});var g=u.attrGetter("ngfModelInvalid",r);g&&t(function(){e(g).assign(i,d?h:a)}),t(function(){})}function p(){function e(e,t){return e.name===t.name&&(e.$ngfOrigSize||e.size)===(t.$ngfOrigSize||t.size)&&e.type===t.type}function t(t){var n;for(n=0;n<v.length;n++)if(e(t,v[n]))return!0;for(n=0;n<m.length;n++)if(e(t,m[n]))return!0;return!1}if(l){$=[],y=[];for(var n=0;n<l.length;n++)t(l[n])?y.push(l[n]):$.push(l[n])}}function h(e){return angular.isArray(e)?e:[e]}function g(){function e(){t(function(){d(x?v.concat(w):w,x?m.concat(b):b,l,y,_)},E&&E.debounce?E.debounce.change||E.debounce:0)}var o=k?$:w;a(o,r,i,n).then(function(){k?u.validate($,x?v.length:0,n,r,i).then(function(t){w=t.validsFiles,b=t.invalidsFiles,e()}):e()},function(){for(var t=0;t<o.length;t++){var n=o[t];if("resize"===n.$error){var r=w.indexOf(n);r>-1&&(w.splice(r,1),b.push(n)),e()}}})}var $,v,m,y=[],b=[],w=[];v=r.$$ngfPrevValidFiles||[],m=r.$$ngfPrevInvalidFiles||[],n&&n.$modelValue&&(v=h(n.$modelValue));var x=u.attrGetter("ngfKeep",r,i);$=(l||[]).slice(0),"distinct"!==x&&u.attrGetter("ngfKeepDistinct",r,i)!==!0||p(r,i);var _=!x&&!u.attrGetter("ngfMultiple",r,i)&&!u.attrGetter("multiple",r);if(!x||$.length){u.attrGetter("ngfBeforeModelChange",r,i,{$files:l,$file:l&&l.length?l[0]:null,$newFiles:$,$duplicateFiles:y,$event:c});var k=u.attrGetter("ngfValidateAfterResize",r,i),E=u.attrGetter("ngfModelOptions",r,i);u.validate($,x?v.length:0,n,r,i).then(function(e){f?d($,[],l,y,_):(E&&E.allowInvalid||k?w=$:(w=e.validFiles,b=e.invalidFiles),u.attrGetter("ngfFixOrientation",r,i)&&u.isExifSupported()?o(w,r,i).then(function(){g()}):g())})}},u}]),r.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(e,t,n,r){function i(e){var t=e.match(/Android[^\d]*(\d+)\.(\d+)/);if(t&&t.length>2){var n=r.defaults.androidFixMinorVersion||4;return parseInt(t[1])<4||parseInt(t[1])===n&&parseInt(t[2])<n}return e.indexOf("Chrome")===-1&&/.*Windows.*Safari.*/.test(e)}function o(e,t,n,r,o,s,u,l){function c(){return"input"===t[0].tagName.toLowerCase()&&n.type&&"file"===n.type.toLowerCase()}function f(){return y("ngfChange")||y("ngfSelect")}function d(t){if(l.shouldUpdateOn("change",n,e)){var i=t.__files_||t.target&&t.target.files,o=[];if(!i)return;for(var a=0;a<i.length;a++)o.push(i[a]);l.updateModel(r,n,e,f(),o.length?o:null,t)}}function p(e,r){function i(t){e.attr("id","ngf-"+t),r.attr("id","ngf-label-"+t)}for(var o=0;o<t[0].attributes.length;o++){var a=t[0].attributes[o];"type"!==a.name&&"class"!==a.name&&"style"!==a.name&&("id"===a.name?(i(a.value),b.push(n.$observe("id",i))):e.attr(a.name,a.value||"required"!==a.name&&"multiple"!==a.name?a.value:a.name))}}function h(){if(c())return t;var e=angular.element('<input type="file">'),n=angular.element("<label>upload</label>");return n.css("visibility","hidden").css("position","absolute").css("overflow","hidden").css("width","0px").css("height","0px").css("border","none").css("margin","0px").css("padding","0px").attr("tabindex","-1"),p(e,n),a.push({el:t,ref:n}),document.body.appendChild(n.append(e)[0]),e}function g(n){if(t.attr("disabled"))return!1;if(!y("ngfSelectDisabled",e)){var r=$(n);if(null!=r)return r;v(n);try{c()||document.body.contains(_[0])||(a.push({el:t,ref:_.parent()}),document.body.appendChild(_.parent()[0]),_.bind("change",d))}catch(o){}return i(navigator.userAgent)?setTimeout(function(){_[0].click()},0):_[0].click(),!1}}function $(e){var t=e.changedTouches||e.originalEvent&&e.originalEvent.changedTouches;if(t){if("touchstart"===e.type)return x=t[0].clientX,w=t[0].clientY,!0;if("touchend"===e.type){var n=t[0].clientX,r=t[0].clientY;if(Math.abs(n-x)>20||Math.abs(r-w)>20)return e.stopPropagation(),e.preventDefault(),!1}return!0}}function v(t){l.shouldUpdateOn("click",n,e)&&_.val()&&(_.val(null),l.updateModel(r,n,e,f(),null,t,!0))}function m(e){if(_&&!_.attr("__ngf_ie10_Fix_")){if(!_[0].parentNode)return void(_=null);e.preventDefault(),e.stopPropagation(),_.unbind("click");var t=_.clone();return _.replaceWith(t),_=t,_.attr("__ngf_ie10_Fix_","true"),_.bind("change",d),_.bind("click",m),_[0].click(),!1}_.removeAttr("__ngf_ie10_Fix_")}var y=function(e,t){return l.attrGetter(e,n,t)};l.registerModelChangeValidator(r,n,e);var b=[];y("ngfMultiple")&&b.push(e.$watch(y("ngfMultiple"),function(){_.attr("multiple",y("ngfMultiple",e))})),y("ngfCapture")&&b.push(e.$watch(y("ngfCapture"),function(){_.attr("capture",y("ngfCapture",e))})),y("ngfAccept")&&b.push(e.$watch(y("ngfAccept"),function(){_.attr("accept",y("ngfAccept",e))})),b.push(n.$observe("accept",function(){_.attr("accept",y("accept"))}));var w=0,x=0,_=t;c()||(_=h()),_.bind("change",d),c()?t.bind("click",v):t.bind("click touchstart touchend",g),navigator.appVersion.indexOf("MSIE 10")!==-1&&_.bind("click",m),r&&r.$formatters.push(function(e){return null!=e&&0!==e.length||_.val()&&_.val(null),e}),e.$on("$destroy",function(){c()||_.parent().remove(),angular.forEach(b,function(e){e()})}),s(function(){for(var e=0;e<a.length;e++){var t=a[e];document.body.contains(t.el[0])||(a.splice(e,1),t.ref.remove())}}),window.FileAPI&&window.FileAPI.ngfFixIE&&window.FileAPI.ngfFixIE(t,_,d)}var a=[];return{restrict:"AEC",require:"?ngModel",link:function(i,a,s,u){o(i,a,s,u,e,t,n,r)}}}]),function(){function e(e){return"img"===e.tagName.toLowerCase()?"image":"audio"===e.tagName.toLowerCase()?"audio":"video"===e.tagName.toLowerCase()?"video":/./}function t(t,n,r,i,o,a,s,u){function l(e){var a=t.attrGetter("ngfNoObjectUrl",o,r);t.dataUrl(e,a)["finally"](function(){n(function(){var t=(a?e.$ngfDataUrl:e.$ngfBlobUrl)||e.$ngfDataUrl;u?i.css("background-image","url('"+(t||"")+"')"):i.attr("src",t),t?i.removeClass("ng-hide"):i.addClass("ng-hide")})})}n(function(){var n=r.$watch(o[a],function(n){var c=s;if("ngfThumbnail"===a&&(c||(c={width:i[0].naturalWidth||i[0].clientWidth,height:i[0].naturalHeight||i[0].clientHeight}),0===c.width&&window.getComputedStyle)){var f=getComputedStyle(i[0]);f.width&&f.width.indexOf("px")>-1&&f.height&&f.height.indexOf("px")>-1&&(c={width:parseInt(f.width.slice(0,-2)),height:parseInt(f.height.slice(0,-2))})}return angular.isString(n)?(i.removeClass("ng-hide"),u?i.css("background-image","url('"+n+"')"):i.attr("src",n)):void(!n||!n.type||0!==n.type.search(e(i[0]))||u&&0!==n.type.indexOf("image")?i.addClass("ng-hide"):c&&t.isResizeSupported()?(c.resizeIf=function(e,i){return t.attrGetter("ngfResizeIf",o,r,{$width:e,$height:i,$file:n})},t.resize(n,c).then(function(e){l(e)},function(e){throw e})):l(n))});r.$on("$destroy",function(){n()})})}r.service("UploadDataUrl",["UploadBase","$timeout","$q",function(e,t,n){var r=e;return r.base64DataUrl=function(e){if(angular.isArray(e)){var t=n.defer(),i=0;return angular.forEach(e,function(n){r.dataUrl(n,!0)["finally"](function(){if(i++,i===e.length){var n=[];angular.forEach(e,function(e){n.push(e.$ngfDataUrl)}),t.resolve(n,e)}})}),t.promise}return r.dataUrl(e,!0)},r.dataUrl=function(e,i){if(!e)return r.emptyPromise(e,e);if(i&&null!=e.$ngfDataUrl||!i&&null!=e.$ngfBlobUrl)return r.emptyPromise(i?e.$ngfDataUrl:e.$ngfBlobUrl,e);var o=i?e.$$ngfDataUrlPromise:e.$$ngfBlobUrlPromise;if(o)return o;var a=n.defer();return t(function(){if(window.FileReader&&e&&(!window.FileAPI||navigator.userAgent.indexOf("MSIE 8")===-1||e.size<2e4)&&(!window.FileAPI||navigator.userAgent.indexOf("MSIE 9")===-1||e.size<4e6)){var n=window.URL||window.webkitURL;if(n&&n.createObjectURL&&!i){var o;try{o=n.createObjectURL(e)}catch(s){return void t(function(){e.$ngfBlobUrl="",a.reject()})}t(function(){if(e.$ngfBlobUrl=o,o){a.resolve(o,e),r.blobUrls=r.blobUrls||[],r.blobUrlsTotalSize=r.blobUrlsTotalSize||0,r.blobUrls.push({url:o,size:e.size}),r.blobUrlsTotalSize+=e.size||0;for(var t=r.defaults.blobUrlsMaxMemory||268435456,i=r.defaults.blobUrlsMaxQueueSize||200;(r.blobUrlsTotalSize>t||r.blobUrls.length>i)&&r.blobUrls.length>1;){var s=r.blobUrls.splice(0,1)[0];n.revokeObjectURL(s.url),r.blobUrlsTotalSize-=s.size}}})}else{var u=new FileReader;u.onload=function(n){t(function(){e.$ngfDataUrl=n.target.result,a.resolve(n.target.result,e),t(function(){delete e.$ngfDataUrl},1e3)})},u.onerror=function(){t(function(){e.$ngfDataUrl="",a.reject()})},u.readAsDataURL(e)}}else t(function(){e[i?"$ngfDataUrl":"$ngfBlobUrl"]="",a.reject()})}),o=i?e.$$ngfDataUrlPromise=a.promise:e.$$ngfBlobUrlPromise=a.promise,o["finally"](function(){delete e[i?"$$ngfDataUrlPromise":"$$ngfBlobUrlPromise"]}),o},r}]),r.directive("ngfSrc",["Upload","$timeout",function(e,n){return{restrict:"AE",link:function(r,i,o){t(e,n,r,i,o,"ngfSrc",e.attrGetter("ngfResize",o,r),!1)}}}]),r.directive("ngfBackground",["Upload","$timeout",function(e,n){return{restrict:"AE",link:function(r,i,o){t(e,n,r,i,o,"ngfBackground",e.attrGetter("ngfResize",o,r),!0)}}}]),r.directive("ngfThumbnail",["Upload","$timeout",function(e,n){return{restrict:"AE",link:function(r,i,o){var a=e.attrGetter("ngfSize",o,r);t(e,n,r,i,o,"ngfThumbnail",a,e.attrGetter("ngfAsBackground",o,r))}}}]),r.config(["$compileProvider",function(e){e.imgSrcSanitizationWhitelist&&e.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/),e.aHrefSanitizationWhitelist&&e.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/)}]),r.filter("ngfDataUrl",["UploadDataUrl","$sce",function(e,t){return function(n,r,i){if(angular.isString(n))return t.trustAsResourceUrl(n);var o=n&&((r?n.$ngfDataUrl:n.$ngfBlobUrl)||n.$ngfDataUrl);return n&&!o?(!n.$ngfDataUrlFilterInProgress&&angular.isObject(n)&&(n.$ngfDataUrlFilterInProgress=!0,e.dataUrl(n,r)),""):(n&&delete n.$ngfDataUrlFilterInProgress,(n&&o?i?t.trustAsResourceUrl(o):o:n)||"")}}])}(),
9
- r.service("UploadValidate",["UploadDataUrl","$q","$timeout",function(e,t,n){function r(e){var t="",n=[];if(e.length>2&&"/"===e[0]&&"/"===e[e.length-1])t=e.substring(1,e.length-1);else{var i=e.split(",");if(i.length>1)for(var o=0;o<i.length;o++){var a=r(i[o]);a.regexp?(t+="("+a.regexp+")",o<i.length-1&&(t+="|")):n=n.concat(a.excludes)}else 0===e.indexOf("!")?n.push("^((?!"+r(e.substring(1)).regexp+").)*$"):(0===e.indexOf(".")&&(e="*"+e),t="^"+e.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",t=t.replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:t,excludes:n}}function i(e,t){null==t||e.$dirty||(e.$setDirty?e.$setDirty():e.$dirty=!0)}var o=e;return o.validatePattern=function(e,t){if(!t)return!0;var n=r(t),i=!0;if(n.regexp&&n.regexp.length){var o=new RegExp(n.regexp,"i");i=null!=e.type&&o.test(e.type)||null!=e.name&&o.test(e.name)}for(var a=n.excludes.length;a--;){var s=new RegExp(n.excludes[a],"i");i=i&&(null==e.type||s.test(e.type))&&(null==e.name||s.test(e.name))}return i},o.ratioToFloat=function(e){var t=e.toString(),n=t.search(/[x:]/i);return t=n>-1?parseFloat(t.substring(0,n))/parseFloat(t.substring(n+1)):parseFloat(t)},o.registerModelChangeValidator=function(e,t,n){e&&e.$formatters.push(function(r){if(e.$dirty){var i=r;r&&!angular.isArray(r)&&(i=[r]),o.validate(i,0,e,t,n).then(function(){o.applyModelValidation(e,i)})}return r})},o.applyModelValidation=function(e,t){i(e,t),angular.forEach(e.$ngfValidations,function(t){e.$setValidity(t.name,t.valid)})},o.getValidationAttr=function(e,t,n,r,i){var a="ngf"+n[0].toUpperCase()+n.substr(1),s=o.attrGetter(a,e,t,{$file:i});if(null==s&&(s=o.attrGetter("ngfValidate",e,t,{$file:i}))){var u=(r||n).split(".");s=s[u[0]],u.length>1&&(s=s&&s[u[1]])}return s},o.validate=function(e,n,r,i,a){function s(t,n,s){if(e){for(var u=e.length,l=null;u--;){var p=e[u];if(p){var h=o.getValidationAttr(i,a,t,n,p);null!=h&&(s(p,h,u)||(c.indexOf(t)===-1?(p.$error=t,(p.$errorMessages=p.$errorMessages||{})[t]=!0,p.$errorParam=h,d.indexOf(p)===-1&&d.push(p),f||e.splice(u,1),l=!1):e.splice(u,1)))}}null!==l&&r.$ngfValidations.push({name:t,valid:l})}}function u(n,s,u,p,h){function g(t,r,i){function o(o){if(o())if(c.indexOf(n)===-1){if(r.$error=n,(r.$errorMessages=r.$errorMessages||{})[n]=!0,r.$errorParam=i,d.indexOf(r)===-1&&d.push(r),!f){var a=e.indexOf(r);a>-1&&e.splice(a,1)}t.resolve(!1)}else{var s=e.indexOf(r);s>-1&&e.splice(s,1),t.resolve(!0)}else t.resolve(!0)}null!=i?p(r,i).then(function(e){o(function(){return!h(e,i)})},function(){o(function(){return l("ngfValidateForce",{$file:r})})}):t.resolve(!0)}var $=[o.emptyPromise(!0)];e&&(e=void 0===e.length?[e]:e,angular.forEach(e,function(e){var r=t.defer();return $.push(r.promise),!u||null!=e.type&&0===e.type.search(u)?void("dimensions"===n&&null!=o.attrGetter("ngfDimensions",i)?o.imageDimensions(e).then(function(t){g(r,e,l("ngfDimensions",{$file:e,$width:t.width,$height:t.height}))},function(){r.resolve(!1)}):"duration"===n&&null!=o.attrGetter("ngfDuration",i)?o.mediaDuration(e).then(function(t){g(r,e,l("ngfDuration",{$file:e,$duration:t}))},function(){r.resolve(!1)}):g(r,e,o.getValidationAttr(i,a,n,s,e))):void r.resolve(!0)}));var v=t.defer();return t.all($).then(function(e){for(var t=!0,i=0;i<e.length;i++)if(!e[i]){t=!1;break}r.$ngfValidations.push({name:n,valid:t}),v.resolve(t)}),v.promise}r=r||{},r.$ngfValidations=r.$ngfValidations||[],angular.forEach(r.$ngfValidations,function(e){e.valid=!0});var l=function(e,t){return o.attrGetter(e,i,a,t)},c=(o.attrGetter("ngfIgnoreInvalid",i,a)||"").split(" "),f=o.attrGetter("ngfRunAllValidations",i,a);if(null==e||0===e.length)return o.emptyPromise({validFiles:e,invalidFiles:[]});e=void 0===e.length?[e]:e.slice(0);var d=[];s("pattern",null,o.validatePattern),s("minSize","size.min",function(e,t){return e.size+.1>=o.translateScalars(t)}),s("maxSize","size.max",function(e,t){return e.size-.1<=o.translateScalars(t)});var p=0;if(s("maxTotalSize",null,function(t,n){return p+=t.size,!(p>o.translateScalars(n))||(e.splice(0,e.length),!1)}),s("validateFn",null,function(e,t){return t===!0||null===t||""===t}),!e.length)return o.emptyPromise({validFiles:[],invalidFiles:d});var h=t.defer(),g=[];return g.push(u("maxHeight","height.max",/image/,this.imageDimensions,function(e,t){return e.height<=t})),g.push(u("minHeight","height.min",/image/,this.imageDimensions,function(e,t){return e.height>=t})),g.push(u("maxWidth","width.max",/image/,this.imageDimensions,function(e,t){return e.width<=t})),g.push(u("minWidth","width.min",/image/,this.imageDimensions,function(e,t){return e.width>=t})),g.push(u("dimensions",null,/image/,function(e,t){return o.emptyPromise(t)},function(e){return e})),g.push(u("ratio",null,/image/,this.imageDimensions,function(e,t){for(var n=t.toString().split(","),r=!1,i=0;i<n.length;i++)Math.abs(e.width/e.height-o.ratioToFloat(n[i]))<.01&&(r=!0);return r})),g.push(u("maxRatio","ratio.max",/image/,this.imageDimensions,function(e,t){return e.width/e.height-o.ratioToFloat(t)<1e-4})),g.push(u("minRatio","ratio.min",/image/,this.imageDimensions,function(e,t){return e.width/e.height-o.ratioToFloat(t)>-1e-4})),g.push(u("maxDuration","duration.max",/audio|video/,this.mediaDuration,function(e,t){return e<=o.translateScalars(t)})),g.push(u("minDuration","duration.min",/audio|video/,this.mediaDuration,function(e,t){return e>=o.translateScalars(t)})),g.push(u("duration",null,/audio|video/,function(e,t){return o.emptyPromise(t)},function(e){return e})),g.push(u("validateAsyncFn",null,null,function(e,t){return t},function(e){return e===!0||null===e||""===e})),t.all(g).then(function(){if(f)for(var t=0;t<e.length;t++){var r=e[t];r.$error&&e.splice(t--,1)}f=!1,s("maxFiles",null,function(e,t,r){return n+r<t}),h.resolve({validFiles:e,invalidFiles:d})}),h.promise},o.imageDimensions=function(e){if(e.$ngfWidth&&e.$ngfHeight){var r=t.defer();return n(function(){r.resolve({width:e.$ngfWidth,height:e.$ngfHeight})}),r.promise}if(e.$ngfDimensionPromise)return e.$ngfDimensionPromise;var i=t.defer();return n(function(){return 0!==e.type.indexOf("image")?void i.reject("not image"):void o.dataUrl(e).then(function(t){function r(){var t=s[0].naturalWidth||s[0].clientWidth,n=s[0].naturalHeight||s[0].clientHeight;s.remove(),e.$ngfWidth=t,e.$ngfHeight=n,i.resolve({width:t,height:n})}function o(){s.remove(),i.reject("load error")}function a(){n(function(){s[0].parentNode&&(s[0].clientWidth?r():u++>10?o():a())},1e3)}var s=angular.element("<img>").attr("src",t).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important");s.on("load",r),s.on("error",o);var u=0;a(),angular.element(document.getElementsByTagName("body")[0]).append(s)},function(){i.reject("load error")})}),e.$ngfDimensionPromise=i.promise,e.$ngfDimensionPromise["finally"](function(){delete e.$ngfDimensionPromise}),e.$ngfDimensionPromise},o.mediaDuration=function(e){if(e.$ngfDuration){var r=t.defer();return n(function(){r.resolve(e.$ngfDuration)}),r.promise}if(e.$ngfDurationPromise)return e.$ngfDurationPromise;var i=t.defer();return n(function(){return 0!==e.type.indexOf("audio")&&0!==e.type.indexOf("video")?void i.reject("not media"):void o.dataUrl(e).then(function(t){function r(){var t=s[0].duration;e.$ngfDuration=t,s.remove(),i.resolve(t)}function o(){s.remove(),i.reject("load error")}function a(){n(function(){s[0].parentNode&&(s[0].duration?r():u>10?o():a())},1e3)}var s=angular.element(0===e.type.indexOf("audio")?"<audio>":"<video>").attr("src",t).css("visibility","none").css("position","fixed");s.on("loadedmetadata",r),s.on("error",o);var u=0;a(),angular.element(document.body).append(s)},function(){i.reject("load error")})}),e.$ngfDurationPromise=i.promise,e.$ngfDurationPromise["finally"](function(){delete e.$ngfDurationPromise}),e.$ngfDurationPromise},o}]),r.service("UploadResize",["UploadValidate","$q",function(e,t){var n=e,r=function(e,t,n,r,i){var o=i?Math.max(n/e,r/t):Math.min(n/e,r/t);return{width:e*o,height:t*o,marginX:e*o-n,marginY:t*o-r}},i=function(e,i,o,a,s,u,l,c){var f=t.defer(),d=document.createElement("canvas"),p=document.createElement("img");return p.setAttribute("style","visibility:hidden;position:fixed;z-index:-100000"),document.body.appendChild(p),p.onload=function(){var e=p.width,t=p.height;if(p.parentNode.removeChild(p),null!=c&&c(e,t)===!1)return void f.reject("resizeIf");try{if(u){var h=n.ratioToFloat(u),g=e/t;g<h?(i=e,o=i/h):(o=t,i=o*h)}i||(i=e),o||(o=t);var $=r(e,t,i,o,l);d.width=Math.min($.width,i),d.height=Math.min($.height,o);var v=d.getContext("2d");v.drawImage(p,Math.min(0,-$.marginX/2),Math.min(0,-$.marginY/2),$.width,$.height),f.resolve(d.toDataURL(s||"image/WebP",a||.934))}catch(m){f.reject(m)}},p.onerror=function(){p.parentNode.removeChild(p),f.reject()},p.src=e,f.promise};return n.dataUrltoBlob=function(e,t,n){for(var r=e.split(","),i=r[0].match(/:(.*?);/)[1],o=atob(r[1]),a=o.length,s=new Uint8Array(a);a--;)s[a]=o.charCodeAt(a);var u=new window.Blob([s],{type:i});return u.name=t,u.$ngfOrigSize=n,u},n.isResizeSupported=function(){var e=document.createElement("canvas");return window.atob&&e.getContext&&e.getContext("2d")&&window.Blob},n.isResizeSupported()&&Object.defineProperty(window.Blob.prototype,"name",{get:function(){return this.$ngfName},set:function(e){this.$ngfName=e},configurable:!0}),n.resize=function(e,r){if(0!==e.type.indexOf("image"))return n.emptyPromise(e);var o=t.defer();return n.dataUrl(e,!0).then(function(t){i(t,r.width,r.height,r.quality,r.type||e.type,r.ratio,r.centerCrop,r.resizeIf).then(function(i){if("image/jpeg"===e.type&&r.restoreExif!==!1)try{i=n.restoreExif(t,i)}catch(a){setTimeout(function(){throw a},1)}try{var s=n.dataUrltoBlob(i,e.name,e.size);o.resolve(s)}catch(a){o.reject(a)}},function(t){"resizeIf"===t&&o.resolve(e),o.reject(t)})},function(e){o.reject(e)}),o.promise},n}]),function(){function e(e,n,r,i,o,a,s,u,l,c){function f(){return n.attr("disabled")||m("ngfDropDisabled",e)}function d(t,n,r){if(t){var i;try{i=t&&t.getData&&t.getData("text/html")}catch(o){}$(t.items,t.files,m("ngfAllowDir",e)!==!1,m("multiple")||m("ngfMultiple",e)).then(function(e){e.length?p(e,n):h(r,i).then(function(e){p(e,n)})})}}function p(t,n){u.updateModel(i,r,e,m("ngfChange")||m("ngfDrop"),t,n)}function h(t,n){if(!u.shouldUpdateOn(t,r,e)||"string"!=typeof n)return u.rejectPromise([]);var i=[];n.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi,function(e,t,n){i.push(n)});var o=[],a=[];if(i.length){angular.forEach(i,function(e){o.push(u.urlToBlob(e).then(function(e){a.push(e)}))});var s=c.defer();return c.all(o).then(function(){s.resolve(a)},function(e){s.reject(e)}),s.promise}return u.emptyPromise()}function g(e,t,n,r){var i=m("ngfDragOverClass",e,{$event:n}),o="dragover";if(angular.isString(i))o=i;else if(i&&(i.delay&&(x=i.delay),i.accept||i.reject)){var a=n.dataTransfer.items;if(null!=a&&a.length)for(var s=i.pattern||m("ngfPattern",e,{$event:n}),l=a.length;l--;){if(!u.validatePattern(a[l],s)){o=i.reject;break}o=i.accept}else o=i.accept}r(o)}function $(t,n,i,o){function a(e,t){var n=c.defer();if(null!=e)if(e.isDirectory){var r=[u.emptyPromise()];if(d){var i={type:"directory"};i.name=i.path=(t||"")+e.name,p.push(i)}var o=e.createReader(),s=[],g=function(){o.readEntries(function(i){try{i.length?(s=s.concat(Array.prototype.slice.call(i||[],0)),g()):(angular.forEach(s.slice(0),function(n){p.length<=l&&h<=f&&r.push(a(n,(t?t:"")+e.name+"/"))}),c.all(r).then(function(){n.resolve()},function(e){n.reject(e)}))}catch(o){n.reject(o)}},function(e){n.reject(e)})};g()}else e.file(function(e){try{e.path=(t?t:"")+e.name,d&&(e=u.rename(e,e.path)),p.push(e),h+=e.size,n.resolve()}catch(r){n.reject(r)}},function(e){n.reject(e)});return n.promise}var l=u.getValidationAttr(r,e,"maxFiles");null==l&&(l=Number.MAX_VALUE);var f=u.getValidationAttr(r,e,"maxTotalSize");null==f&&(f=Number.MAX_VALUE);var d=m("ngfIncludeDir",e),p=[],h=0,g=[u.emptyPromise()];if(t&&t.length>0&&"file:"!==s.location.protocol)for(var $=0;$<t.length;$++){if(t[$].webkitGetAsEntry&&t[$].webkitGetAsEntry()&&t[$].webkitGetAsEntry().isDirectory){var v=t[$].webkitGetAsEntry();if(v.isDirectory&&!i)continue;null!=v&&g.push(a(v))}else{var y=t[$].getAsFile();null!=y&&(p.push(y),h+=y.size)}if(p.length>l||h>f||!o&&p.length>0)break}else if(null!=n)for(var b=0;b<n.length;b++){var w=n.item(b);if((w.type||w.size>0)&&(p.push(w),h+=w.size),p.length>l||h>f||!o&&p.length>0)break}var x=c.defer();return c.all(g).then(function(){if(o||d||!p.length)x.resolve(p);else{for(var e=0;p[e]&&"directory"===p[e].type;)e++;x.resolve([p[e]])}},function(e){x.reject(e)}),x.promise}var v=t(),m=function(e,t,n){return u.attrGetter(e,r,t,n)};if(m("dropAvailable")&&a(function(){e[m("dropAvailable")]?e[m("dropAvailable")].value=v:e[m("dropAvailable")]=v}),!v)return void(m("ngfHideOnDropNotAvailable",e)===!0&&n.css("display","none"));null==m("ngfSelect")&&u.registerModelChangeValidator(i,r,e);var y,b=null,w=o(m("ngfStopPropagation")),x=1;n[0].addEventListener("dragover",function(t){if(!f()&&u.shouldUpdateOn("drop",r,e)){if(t.preventDefault(),w(e)&&t.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var i=t.dataTransfer.effectAllowed;t.dataTransfer.dropEffect="move"===i||"linkMove"===i?"move":"copy"}a.cancel(b),y||(y="C",g(e,r,t,function(r){y=r,n.addClass(y),m("ngfDrag",e,{$isDragging:!0,$class:y,$event:t})}))}},!1),n[0].addEventListener("dragenter",function(t){!f()&&u.shouldUpdateOn("drop",r,e)&&(t.preventDefault(),w(e)&&t.stopPropagation())},!1),n[0].addEventListener("dragleave",function(t){!f()&&u.shouldUpdateOn("drop",r,e)&&(t.preventDefault(),w(e)&&t.stopPropagation(),b=a(function(){y&&n.removeClass(y),y=null,m("ngfDrag",e,{$isDragging:!1,$event:t})},x||100))},!1),n[0].addEventListener("drop",function(t){!f()&&u.shouldUpdateOn("drop",r,e)&&(t.preventDefault(),w(e)&&t.stopPropagation(),y&&n.removeClass(y),y=null,d(t.dataTransfer,t,"dropUrl"))},!1),n[0].addEventListener("paste",function(t){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&m("ngfEnableFirefoxPaste",e)&&t.preventDefault(),!f()&&u.shouldUpdateOn("paste",r,e)&&d(t.clipboardData||t.originalEvent.clipboardData,t,"pasteUrl")},!1),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&m("ngfEnableFirefoxPaste",e)&&(n.attr("contenteditable",!0),n.on("keypress",function(e){e.metaKey||e.ctrlKey||e.preventDefault()}))}function t(){var e=document.createElement("div");return"draggable"in e&&"ondrop"in e&&!/Edge\/12./i.test(navigator.userAgent)}r.directive("ngfDrop",["$parse","$timeout","$window","Upload","$http","$q",function(t,n,r,i,o,a){return{restrict:"AEC",require:"?ngModel",link:function(s,u,l,c){e(s,u,l,c,t,n,r,i,o,a)}}}]),r.directive("ngfNoFileDrop",function(){return function(e,n){t()&&n.css("display","none")}}),r.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(e,n,r){return function(i,o,a){if(t()){var s=e(r.attrGetter("ngfDropAvailable",a));n(function(){s(i),s.assign&&s.assign(i,!0)})}}}])}(),r.service("UploadExif",["UploadResize","$q",function(e,t){function n(e,t,n,r){switch(t){case 2:return e.transform(-1,0,0,1,n,0);case 3:return e.transform(-1,0,0,-1,n,r);case 4:return e.transform(1,0,0,-1,0,r);case 5:return e.transform(0,1,1,0,0,0);case 6:return e.transform(0,1,-1,0,r,0);case 7:return e.transform(0,-1,-1,0,r,n);case 8:return e.transform(0,-1,1,0,0,n)}}function r(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=0;i<r;i++)t+=String.fromCharCode(n[i]);return window.btoa(t)}var i=e;return i.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&i.isResizeSupported()},i.readOrientation=function(e){var n=t.defer(),r=new FileReader,i=e.slice?e.slice(0,65536):e;return r.readAsArrayBuffer(i),r.onerror=function(e){return n.reject(e)},r.onload=function(e){var t={orientation:1},r=new DataView(this.result);if(65496!==r.getUint16(0,!1))return n.resolve(t);for(var i=r.byteLength,o=2;o<i;){var a=r.getUint16(o,!1);if(o+=2,65505===a){if(1165519206!==r.getUint32(o+=2,!1))return n.resolve(t);var s=18761===r.getUint16(o+=6,!1);o+=r.getUint32(o+4,s);var u=r.getUint16(o,s);o+=2;for(var l=0;l<u;l++)if(274===r.getUint16(o+12*l,s)){var c=r.getUint16(o+12*l+8,s);return c>=2&&c<=8&&(r.setUint16(o+12*l+8,1,s),t.fixedArrayBuffer=e.target.result),t.orientation=c,n.resolve(t)}}else{if(65280!==(65280&a))break;o+=r.getUint16(o,!1)}}return n.resolve(t)},n.promise},i.applyExifRotation=function(e){if(0!==e.type.indexOf("image/jpeg"))return i.emptyPromise(e);var o=t.defer();return i.readOrientation(e).then(function(t){return t.orientation<2||t.orientation>8?o.resolve(e):void i.dataUrl(e,!0).then(function(a){var s=document.createElement("canvas"),u=document.createElement("img");u.onload=function(){try{s.width=t.orientation>4?u.height:u.width,s.height=t.orientation>4?u.width:u.height;var a=s.getContext("2d");n(a,t.orientation,u.width,u.height),a.drawImage(u,0,0);var l=s.toDataURL(e.type||"image/WebP",.934);l=i.restoreExif(r(t.fixedArrayBuffer),l);var c=i.dataUrltoBlob(l,e.name);o.resolve(c)}catch(f){return o.reject(f)}},u.onerror=function(){o.reject()},u.src=a},function(e){o.reject(e)})},function(e){o.reject(e)}),o.promise},i.restoreExif=function(e,t){var n={};return n.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n.encode64=function(e){var t,n,r,i,o,a="",s="",u="",l=0;do t=e[l++],n=e[l++],s=e[l++],r=t>>2,i=(3&t)<<4|n>>4,o=(15&n)<<2|s>>6,u=63&s,isNaN(n)?o=u=64:isNaN(s)&&(u=64),a=a+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(u),t=n=s="",r=i=o=u="";while(l<e.length);return a},n.restore=function(e,t){e.match("data:image/jpeg;base64,")&&(e=e.replace("data:image/jpeg;base64,",""));var n=this.decode64(e),r=this.slice2Segments(n),i=this.exifManipulation(t,r);return"data:image/jpeg;base64,"+this.encode64(i)},n.exifManipulation=function(e,t){var n=this.getExifArray(t),r=this.insertExif(e,n);return new Uint8Array(r)},n.getExifArray=function(e){for(var t,n=0;n<e.length;n++)if(t=e[n],255===t[0]&225===t[1])return t;return[]},n.insertExif=function(e,t){var n=e.replace("data:image/jpeg;base64,",""),r=this.decode64(n),i=r.indexOf(255,3),o=r.slice(0,i),a=r.slice(i),s=o;return s=s.concat(t),s=s.concat(a)},n.slice2Segments=function(e){for(var t=0,n=[];;){if(255===e[t]&218===e[t+1])break;if(255===e[t]&216===e[t+1])t+=2;else{var r=256*e[t+2]+e[t+3],i=t+r+2,o=e.slice(t,i);n.push(o),t=i}if(t>e.length)break}return n},n.decode64=function(e){var t,n,r,i,o,a="",s="",u=0,l=[],c=/[^A-Za-z0-9\+\/\=]/g;c.exec(e)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do r=this.KEY_STR.indexOf(e.charAt(u++)),i=this.KEY_STR.indexOf(e.charAt(u++)),o=this.KEY_STR.indexOf(e.charAt(u++)),s=this.KEY_STR.indexOf(e.charAt(u++)),t=r<<2|i>>4,n=(15&i)<<4|o>>2,a=(3&o)<<6|s,l.push(t),64!==o&&l.push(n),64!==s&&l.push(a),t=n=a="",r=i=o=s="";while(u<e.length);return l},n.restore(e,t)},i}])},{}],44:[function(e,t,n){e("./dist/ng-file-upload-all"),t.exports="ngFileUpload"},{"./dist/ng-file-upload-all":43}]},{},[37]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ (function() {
3
+ var existingWindowDotAngular = window.angular;
4
+ var angular = (window.angular = {});
5
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+
12
+ var _app = require('./app.controller');
13
+
14
+ var _app2 = _interopRequireDefault(_app);
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ var AppComponent = {
19
+ bindings: {
20
+ settingsName: '@'
21
+ },
22
+ controller: _app2.default,
23
+ template: '<navbar id="settings-navbar"\n tabs="$ctrl.config.tabs"\n page="$ctrl.config.page"\n links="$ctrl.config.links"\n current-tab="$ctrl.config.currentTab">\n </navbar>\n <form method="POST" enctype="multipart/form-data" id="jpibfi-form" action="{{ $ctrl.config.save.post_url }}">\n <input name="{{ ::$ctrl.config.save.action }}" value="{{ ::$ctrl.config.save.nonce }}" type="hidden" />\n <input name="{{ ::$ctrl.config.save.tab }}" value="{{ ::$ctrl.config.currentTab }}" type="hidden" />\n <select-editor\n ng-if="$ctrl.config.currentTab == \'select\'"\n settings="$ctrl.config.settings"\n i18n="$ctrl.config.i18n.editor">\n </select-editor>\n <visual-editor\n ng-if="$ctrl.config.currentTab == \'visual\'"\n settings="$ctrl.config.settings"\n i18n="$ctrl.config.i18n.editor">\n </visual-editor>\n <advanced-editor\n ng-if="$ctrl.config.currentTab == \'advanced\'"\n settings="$ctrl.config.settings"\n i18n="$ctrl.config.i18n.editor">\n </advanced-editor>\n <import-editor\n ng-if="$ctrl.config.currentTab == \'import\'"\n settings="$ctrl.config.settings"\n i18n="$ctrl.config.i18n.editor">\n </import-editor>\n <input ng-if="$ctrl.config.currentTab == \'select\' || $ctrl.config.currentTab == \'visual\' || $ctrl.config.currentTab == \'advanced\'" \n type="submit" class="button button-primary" value="{{ ::$ctrl.config.save.submit }}" /> \n </form>\n '
24
+ };
25
+
26
+ exports.default = AppComponent;
27
+
28
+ },{"./app.controller":2}],2:[function(require,module,exports){
29
+ 'use strict';
30
+
31
+ Object.defineProperty(exports, "__esModule", {
32
+ value: true
33
+ });
34
+
35
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
36
+
37
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
38
+
39
+ var AppController = function () {
40
+ function AppController(linkService) {
41
+ _classCallCheck(this, AppController);
42
+
43
+ this.linkService = linkService;
44
+ this.config = {};
45
+ this.settingsValue = {};
46
+ }
47
+
48
+ _createClass(AppController, [{
49
+ key: '$onInit',
50
+ value: function $onInit() {
51
+ this.config = window[this.settingsName];
52
+ this.linkService.init(this.config.page);
53
+ }
54
+ }]);
55
+
56
+ return AppController;
57
+ }();
58
+
59
+ AppController.$inject = ['linkService'];
60
+
61
+ exports.default = AppController;
62
+
63
+ },{}],3:[function(require,module,exports){
64
+ 'use strict';
65
+
66
+ Object.defineProperty(exports, "__esModule", {
67
+ value: true
68
+ });
69
+
70
+ var _angular = require('angular');
71
+
72
+ var _angular2 = _interopRequireDefault(_angular);
73
+
74
+ var _angularSanitize = require('angular-sanitize');
75
+
76
+ var _angularSanitize2 = _interopRequireDefault(_angularSanitize);
77
+
78
+ var _ngFileUpload = require('ng-file-upload');
79
+
80
+ var _ngFileUpload2 = _interopRequireDefault(_ngFileUpload);
81
+
82
+ var _angularDragAndDropLists = require('angular-drag-and-drop-lists');
83
+
84
+ var _angularDragAndDropLists2 = _interopRequireDefault(_angularDragAndDropLists);
85
+
86
+ var _app = require('./app.component');
87
+
88
+ var _app2 = _interopRequireDefault(_app);
89
+
90
+ var _components = require('./components/components');
91
+
92
+ var _components2 = _interopRequireDefault(_components);
93
+
94
+ var _components3 = require('./common/components');
95
+
96
+ var _components4 = _interopRequireDefault(_components3);
97
+
98
+ var _services = require('./services');
99
+
100
+ var _services2 = _interopRequireDefault(_services);
101
+
102
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
103
+
104
+
105
+ var root = _angular2.default.module('jpibfi', [_angularSanitize2.default, _ngFileUpload2.default, _components2.default, _components4.default, _services2.default]).component('jpibfi', _app2.default).name;
106
+
107
+ exports.default = root;
108
+
109
+ },{"./app.component":1,"./common/components":8,"./components/components":18,"./services":35,"angular":42,"angular-drag-and-drop-lists":38,"angular-sanitize":40,"ng-file-upload":44}],4:[function(require,module,exports){
110
+ 'use strict';
111
+
112
+ Object.defineProperty(exports, "__esModule", {
113
+ value: true
114
+ });
115
+
116
+ var _base = require('./../base.controller');
117
+
118
+ var _base2 = _interopRequireDefault(_base);
119
+
120
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
121
+
122
+ var AdvancedComponent = {
123
+ bindings: {
124
+ settings: '<',
125
+ i18n: '<'
126
+ },
127
+ controller: _base2.default,
128
+ template: '\n <h2>{{ $ctrl.i18n.title }}</h2>\n <table class="form-table">\n <tbody>\n <tr>\n <th>{{ ::$ctrl.i18n.filters_label }}</th>\n <td>\n <p>\n <filter name="$ctrl.settings.filter_the_content_on" priority="$ctrl.settings.filter_the_content_priority"\n update="$ctrl.update($event)" template="$ctrl.i18n.filter_template">\n </filter>\n </p>\n <p>\n <filter name="$ctrl.settings.filter_the_excerpt_on" priority="$ctrl.settings.filter_the_excerpt_priority"\n update="$ctrl.update($event)" template="$ctrl.i18n.filter_template">\n </filter>\n </p>\n <p>\n <filter name="$ctrl.settings.filter_post_thumbnail_html_on" priority="$ctrl.settings.filter_post_thumbnail_html_priority"\n update="$ctrl.update($event)" template="$ctrl.i18n.filter_template">\n </filter>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.filters_description"></p>\n </td>\n </tr>\n </tbody>\n </table>\n '
129
+ };
130
+
131
+ exports.default = AdvancedComponent;
132
+
133
+ },{"./../base.controller":7}],5:[function(require,module,exports){
134
+ 'use strict';
135
+
136
+ Object.defineProperty(exports, "__esModule", {
137
+ value: true
138
+ });
139
+
140
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
141
+
142
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
143
+
144
+ var FilterDirective = function () {
145
+ function FilterDirective($compile) {
146
+ _classCallCheck(this, FilterDirective);
147
+
148
+ this.$compile = $compile;
149
+ this.restrict = 'E';
150
+ this.scope = {
151
+ name: '=',
152
+ priority: '=',
153
+ template: '=',
154
+ update: '&'
155
+ };
156
+ }
157
+
158
+ _createClass(FilterDirective, [{
159
+ key: 'link',
160
+ value: function link($scope, $element, $attrs) {
161
+ var template = $scope.template;
162
+ var html = template.replace('%name%', '<editor-checkbox args="name" on-update="update({ $event })" add-br="false"></editor-checkbox>').replace('%priority%', '<editor-number args="priority" on-update="update({ $event })"></editor-number>');
163
+ $element.html(html);
164
+ this.$compile($element.contents())($scope);
165
+ }
166
+ }]);
167
+
168
+ return FilterDirective;
169
+ }();
170
+
171
+ exports.default = FilterDirective;
172
+
173
+ },{}],6:[function(require,module,exports){
174
+ 'use strict';
175
+
176
+ Object.defineProperty(exports, "__esModule", {
177
+ value: true
178
+ });
179
+
180
+ var _angular = require('angular');
181
+
182
+ var _angular2 = _interopRequireDefault(_angular);
183
+
184
+ var _filter = require('./filter.directive');
185
+
186
+ var _filter2 = _interopRequireDefault(_filter);
187
+
188
+ var _advanced = require('./advanced.component');
189
+
190
+ var _advanced2 = _interopRequireDefault(_advanced);
191
+
192
+ var _components = require('./../../components/components');
193
+
194
+ var _components2 = _interopRequireDefault(_components);
195
+
196
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
197
+
198
+ var advanced = _angular2.default.module('app.common.advanced', [_components2.default]).directive('filter', ['$compile', function ($compile) {
199
+ return new _filter2.default($compile);
200
+ }]).component('advancedEditor', _advanced2.default).name;
201
+
202
+ exports.default = advanced;
203
+
204
+ },{"./../../components/components":18,"./advanced.component":4,"./filter.directive":5,"angular":42}],7:[function(require,module,exports){
205
+ "use strict";
206
+
207
+ Object.defineProperty(exports, "__esModule", {
208
+ value: true
209
+ });
210
+
211
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
212
+
213
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
214
+
215
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
216
+
217
+ var BaseController = function () {
218
+ function BaseController() {
219
+ _classCallCheck(this, BaseController);
220
+ }
221
+
222
+ _createClass(BaseController, [{
223
+ key: "$onChanges",
224
+ value: function $onChanges(changes) {
225
+ var _this = this;
226
+
227
+ if (changes.settings) {
228
+ this.settings = _extends({}, this.settings);
229
+ this.values = Object.keys(this.settings).reduce(function (prev, key) {
230
+ prev[key] = _this.settings[key].value;
231
+ return prev;
232
+ }, {});
233
+ }
234
+ }
235
+ }, {
236
+ key: "update",
237
+ value: function update(_ref) {
238
+ var key = _ref.key,
239
+ value = _ref.value;
240
+
241
+ this.values[key] = value;
242
+ }
243
+ }, {
244
+ key: "updateValue",
245
+ value: function updateValue(key, value) {
246
+ this.settings[key] = _extends({}, this.settings[key], { value: value });
247
+ this.values[key] = value;
248
+ }
249
+ }]);
250
+
251
+ return BaseController;
252
+ }();
253
+
254
+ exports.default = BaseController;
255
+
256
+ },{}],8:[function(require,module,exports){
257
+ 'use strict';
258
+
259
+ Object.defineProperty(exports, "__esModule", {
260
+ value: true
261
+ });
262
+
263
+ var _angular = require('angular');
264
+
265
+ var _angular2 = _interopRequireDefault(_angular);
266
+
267
+ var _select = require('./select');
268
+
269
+ var _select2 = _interopRequireDefault(_select);
270
+
271
+ var _visual = require('./visual');
272
+
273
+ var _visual2 = _interopRequireDefault(_visual);
274
+
275
+ var _import = require('./import');
276
+
277
+ var _import2 = _interopRequireDefault(_import);
278
+
279
+ var _advanced = require('./advanced');
280
+
281
+ var _advanced2 = _interopRequireDefault(_advanced);
282
+
283
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
284
+
285
+ var components = _angular2.default.module('app.common', [_select2.default, _visual2.default, _import2.default, _advanced2.default]).name;
286
+
287
+ exports.default = components;
288
+
289
+ },{"./advanced":6,"./import":11,"./select":12,"./visual":15,"angular":42}],9:[function(require,module,exports){
290
+ 'use strict';
291
+
292
+ Object.defineProperty(exports, "__esModule", {
293
+ value: true
294
+ });
295
+
296
+ var _import = require('./import.controller');
297
+
298
+ var _import2 = _interopRequireDefault(_import);
299
+
300
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
301
+
302
+ var ImportComponent = {
303
+ bindings: {
304
+ i18n: '<'
305
+ },
306
+ require: {
307
+ form: '^form'
308
+ },
309
+ controller: _import2.default,
310
+ template: '\n <h2>{{ ::$ctrl.i18n.title }}</h2>\n <table class="form-table">\n <tbody>\n <tr>\n <th><label>{{ ::$ctrl.i18n.export_title }}</label></th>\n <td>\n <a href="{{ ::$ctrl.i18n.export_url }}" class="button button-default">\n {{ ::$ctrl.i18n.export_button_text }}\n </a>\n </td>\n </tr>\n <tr>\n <th><label>{{ ::$ctrl.i18n.import_title }}</label></th>\n <td>\n <input type="file" name="import" ng-change="$ctrl.upload()" ng-model="$ctrl.file" ngf-accept="\'.json\'"\n ngf-select="$ctrl.upload()" ngf-max-size="1MB" />\n </td>\n </tr>\n </tbody>\n </table>\n '
311
+ };
312
+
313
+ exports.default = ImportComponent;
314
+
315
+ },{"./import.controller":10}],10:[function(require,module,exports){
316
+ 'use strict';
317
+
318
+ Object.defineProperty(exports, "__esModule", {
319
+ value: true
320
+ });
321
+
322
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
323
+
324
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
325
+
326
+ var ImportController = function () {
327
+ function ImportController(Upload) {
328
+ _classCallCheck(this, ImportController);
329
+
330
+ this.Upload = Upload;
331
+ }
332
+
333
+ _createClass(ImportController, [{
334
+ key: 'upload',
335
+ value: function upload() {
336
+ document.getElementById('jpibfi-form').submit();
337
+ }
338
+ }]);
339
+
340
+ return ImportController;
341
+ }();
342
+
343
+ ImportController.$inject = ['Upload'];
344
+
345
+ exports.default = ImportController;
346
+
347
+ },{}],11:[function(require,module,exports){
348
+ 'use strict';
349
+
350
+ Object.defineProperty(exports, "__esModule", {
351
+ value: true
352
+ });
353
+
354
+ var _angular = require('angular');
355
+
356
+ var _angular2 = _interopRequireDefault(_angular);
357
+
358
+ var _import = require('./import.component');
359
+
360
+ var _import2 = _interopRequireDefault(_import);
361
+
362
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
363
+
364
+ var importComponentName = _angular2.default.module('app.common.import', []).component('importEditor', _import2.default).name;
365
+
366
+ exports.default = importComponentName;
367
+
368
+ },{"./import.component":9,"angular":42}],12:[function(require,module,exports){
369
+ 'use strict';
370
+
371
+ Object.defineProperty(exports, "__esModule", {
372
+ value: true
373
+ });
374
+
375
+ var _angular = require('angular');
376
+
377
+ var _angular2 = _interopRequireDefault(_angular);
378
+
379
+ var _resolution = require('./resolution.directive');
380
+
381
+ var _resolution2 = _interopRequireDefault(_resolution);
382
+
383
+ var _select = require('./select.component');
384
+
385
+ var _select2 = _interopRequireDefault(_select);
386
+
387
+ var _components = require('./../../components/components');
388
+
389
+ var _components2 = _interopRequireDefault(_components);
390
+
391
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
392
+
393
+ var select = _angular2.default.module('app.common.select', [_components2.default]).directive('resolution', ['$compile', function ($compile) {
394
+ return new _resolution2.default($compile);
395
+ }]).component('selectEditor', _select2.default).name;
396
+
397
+ exports.default = select;
398
+
399
+ },{"./../../components/components":18,"./resolution.directive":13,"./select.component":14,"angular":42}],13:[function(require,module,exports){
400
+ 'use strict';
401
+
402
+ Object.defineProperty(exports, "__esModule", {
403
+ value: true
404
+ });
405
+
406
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
407
+
408
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
409
+
410
+ var ResolutionDirective = function () {
411
+ function ResolutionDirective($compile) {
412
+ _classCallCheck(this, ResolutionDirective);
413
+
414
+ this.$compile = $compile;
415
+ this.restrict = 'E';
416
+ this.scope = {
417
+ height: '=',
418
+ width: '=',
419
+ template: '=',
420
+ update: '&'
421
+ };
422
+ }
423
+
424
+ _createClass(ResolutionDirective, [{
425
+ key: 'link',
426
+ value: function link($scope, $element, $attrs) {
427
+ var template = $scope.template;
428
+ var html = template.replace('%height%', '<editor-number args="height" on-update="update({ $event })"></editor-number>').replace('%width%', '<editor-number args="width" on-update="update({ $event })"></editor-number>');
429
+ $element.html(html);
430
+ this.$compile($element.contents())($scope);
431
+ }
432
+ }]);
433
+
434
+ return ResolutionDirective;
435
+ }();
436
+
437
+ exports.default = ResolutionDirective;
438
+
439
+ },{}],14:[function(require,module,exports){
440
+ 'use strict';
441
+
442
+ Object.defineProperty(exports, "__esModule", {
443
+ value: true
444
+ });
445
+
446
+ var _base = require('./../base.controller');
447
+
448
+ var _base2 = _interopRequireDefault(_base);
449
+
450
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
451
+
452
+ var SelectComponent = {
453
+ bindings: {
454
+ settings: '<',
455
+ i18n: '<'
456
+ },
457
+ controller: _base2.default,
458
+ template: '\n <h2>{{ $ctrl.i18n.title }}</h2>\n <table class="form-table">\n <tbody>\n <tr>\n <th><label for="image_selector">{{ ::$ctrl.settings.image_selector.label }}</label></th>\n <td>\n <editor-text args="$ctrl.settings.image_selector" on-update="$ctrl.update($event)"></editor-text>\n <p class="description" ng-bind-html="$ctrl.settings.image_selector.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label for="disabled_classes">{{ ::$ctrl.settings.disabled_classes.label }}</label></th>\n <td>\n <editor-text args="$ctrl.settings.disabled_classes" on-update="$ctrl.update($event)"></editor-text>\n <p class="description" ng-bind-html="$ctrl.settings.disabled_classes.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label for="enabled_classes">{{ ::$ctrl.settings.enabled_classes.label }}</label></th>\n <td>\n <editor-text args="$ctrl.settings.enabled_classes" on-update="$ctrl.update($event)"></editor-text>\n <p class="description" ng-bind-html="$ctrl.settings.enabled_classes.desc"></p>\n </td>\n </tr>\n <tr>\n <th>{{ ::$ctrl.i18n.image_resolution_label }}</th>\n <td>\n <p>\n <resolution height="$ctrl.settings.min_image_height_small" width="$ctrl.settings.min_image_width_small"\n update="$ctrl.update($event)" template="$ctrl.i18n.min_resolution_template_small">\n </resolution>\n </p>\n <p>\n <resolution height="$ctrl.settings.min_image_height" width="$ctrl.settings.min_image_width"\n update="$ctrl.update($event)" template="$ctrl.i18n.min_resolution_template">\n </resolution>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.image_resolution_desc"></p>\n <p class="description" ng-bind-html="$ctrl.i18n.image_resolution_desc_2"></p>\n </td>\n </tr>\n <tr>\n <th>{{ ::$ctrl.i18n.show_on_field_label }}</th>\n <td>\n <p>\n <label for="show_on">{{ ::$ctrl.settings.show_on.label }}:</label><br/>\n <editor-textarea args="$ctrl.settings.show_on" on-update="$ctrl.update($event)"></editor-text>\n </p>\n <p>\n <label for="disable_on">{{ ::$ctrl.settings.disable_on.label }}:</label><br/>\n <editor-textarea args="$ctrl.settings.disable_on" on-update="$ctrl.update($event)"></editor-text>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.show_on_field_desc"></p>\n </td>\n </tr>\n </tbody>\n </table>\n '
459
+ };
460
+
461
+ exports.default = SelectComponent;
462
+
463
+ },{"./../base.controller":7}],15:[function(require,module,exports){
464
+ 'use strict';
465
+
466
+ Object.defineProperty(exports, "__esModule", {
467
+ value: true
468
+ });
469
+
470
+ var _angular = require('angular');
471
+
472
+ var _angular2 = _interopRequireDefault(_angular);
473
+
474
+ var _visual = require('./visual.component');
475
+
476
+ var _visual2 = _interopRequireDefault(_visual);
477
+
478
+ var _components = require('./../../components/components');
479
+
480
+ var _components2 = _interopRequireDefault(_components);
481
+
482
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
483
+
484
+ var visual = _angular2.default.module('app.common.visual', [_components2.default]).component('visualEditor', _visual2.default).name;
485
+
486
+ exports.default = visual;
487
+
488
+ },{"./../../components/components":18,"./visual.component":16,"angular":42}],16:[function(require,module,exports){
489
+ 'use strict';
490
+
491
+ Object.defineProperty(exports, "__esModule", {
492
+ value: true
493
+ });
494
+
495
+ var _visual = require('./visual.controller');
496
+
497
+ var _visual2 = _interopRequireDefault(_visual);
498
+
499
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
500
+
501
+ var VisualComponent = {
502
+ bindings: {
503
+ settings: '<',
504
+ i18n: '<'
505
+ },
506
+ controller: _visual2.default,
507
+ template: '\n <h2>{{ $ctrl.i18n.title }}</h2>\n <table class="form-table">\n <tbody>\n <tr>\n <th><label for="show_button">{{ ::$ctrl.settings.show_button.label }}</label></th>\n <td>\n <editor-select args="$ctrl.settings.show_button" on-update="$ctrl.update($event)"></editor-select>\n <p class="description" ng-bind-html="$ctrl.settings.show_button.desc"></p>\n <p ng-if="$ctrl.values.show_button != \'hover\'">\n <b ng-bind-html="$ctrl.i18n.pro_feature_error"></b>\n </p>\n </td>\n </tr>\n <tr>\n <th><label>{{ ::$ctrl.settings.description_option.label }}</label></th>\n <td>\n <editor-sortable-select args="$ctrl.settings.description_option" on-update="$ctrl.update($event)"></editor-sortable-select>\n <p class="description" ng-bind-html="$ctrl.settings.description_option.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label for="pinLinkedImages">{{ ::$ctrl.settings.pinLinkedImages.label }}</label></th>\n <td>\n <editor-checkbox args="$ctrl.settings.pinLinkedImages" on-update="$ctrl.update($event)"></editor-checkbox>\n <p class="description" ng-bind-html="$ctrl.settings.pinLinkedImages.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label for="transparency_value">{{ ::$ctrl.settings.transparency_value.label }}</label></th>\n <td>\n <editor-number args="$ctrl.settings.transparency_value" on-update="$ctrl.update($event)"></editor-number>\n <p class="description" ng-bind-html="$ctrl.settings.transparency_value.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label>{{ ::$ctrl.settings.pin_image.label }}</label></th>\n <td>\n <table class="jpibfi-inner-table">\n <tr>\n <th>{{ ::$ctrl.i18n.mode }}</th>\n <th ng-if="$ctrl.values.pin_image != \'old_default\'">{{ ::$ctrl.i18n.settings }}</th>\n <th>{{ ::$ctrl.i18n.preview }}</th>\n </tr>\n <tr>\n <td>\n <p><label><input type="radio" name="{{ ::$ctrl.settings.pin_image.key }}" ng_model="$ctrl.values.pin_image" value="old_default">{{ ::$ctrl.settings.pin_image.options[\'old_default\'] }}</label></p>\n <p><label><input type="radio" name="{{ ::$ctrl.settings.pin_image.key }}" ng_model="$ctrl.values.pin_image" value="default">{{ ::$ctrl.settings.pin_image.options[\'default\'] }}</label></p>\n <p><label><input type="radio" name="{{ ::$ctrl.settings.pin_image.key }}" ng_model="$ctrl.values.pin_image" value="custom">{{ ::$ctrl.settings.pin_image.options[\'custom\'] }}</label></p>\n </td>\n <td ng-if="$ctrl.values.pin_image != \'old_default\'">\n <div ng-show="$ctrl.values.pin_image == \'default\'">\n <p>\n <label for="pin_image_icon">{{ ::$ctrl.settings.pin_image_icon.label }}</label>\n <editor-select args="$ctrl.settings.pin_image_icon" on-update="$ctrl.update($event)"></editor-select>\n <p ng-if="$ctrl.values.pin_image_icon != \'circle\'">\n <b ng-bind-html="$ctrl.i18n.pro_feature_error"></b>\n </p>\n </p>\n <p>\n <label for="pin_image_size">{{ ::$ctrl.settings.pin_image_size.label }}</label>\n <editor-select args="$ctrl.settings.pin_image_size" on-update="$ctrl.update($event)"></editor-select>\n </p>\n <p>\n <label for="pin_image_button">{{ ::$ctrl.settings.pin_image_button.label }}</label>\n <editor-select args="$ctrl.settings.pin_image_button" on-update="$ctrl.update($event)"></editor-select>\n </p>\n </div>\n <div ng-if="$ctrl.values.pin_image == \'custom\'">\n <p><button type="button" class="button button-default" ng-click="$ctrl.upload()">{{ ::$ctrl.i18n.custom_button_upload }}</button></p>\n <p>\n <label for="custom_image_url">{{ ::$ctrl.settings.custom_image_url.label }}</label>\n <editor-text args="$ctrl.settings.custom_image_url" on-update="$ctrl.update($event)"></editor-text>\n </p>\n <p>\n <div style="display: inline-block; width: 49%;">\n <label for="custom_image_height">{{ ::$ctrl.settings.custom_image_height.label }}</label>\n <editor-number args="$ctrl.settings.custom_image_height" on-update="$ctrl.update($event)"></editor-number>\n </div>\n <div style="display: inline-block; width: 49%;">\n <label for="custom_image_width">{{ ::$ctrl.settings.custom_image_width.label }}</label>\n <editor-number args="$ctrl.settings.custom_image_width" on-update="$ctrl.update($event)"></editor-number>\n </div>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.custom_button_desc"></p>\n </div>\n </td>\n <td>\n <div ng-if="$ctrl.values.pin_image == \'old_default\'">\n <a class="pinit-button old_default"><span></span></a>\n </div>\n <div ng-show="$ctrl.values.pin_image == \'default\'">\n <a class="pinit-button default" ng-class="[\'jpibfi-size-\' + $ctrl.values.pin_image_size, \'jpibfi-button-\' + $ctrl.values.pin_image_button]">\n <span ng-class="[\'jpibfi-icon-\' + $ctrl.values.pin_image_icon]"></span>\n </a>\n </div>\n <div ng-show="$ctrl.values.pin_image == \'custom\'">\n <div ng-if="$ctrl.values.custom_image_url">\n <div style="width: {{ $ctrl.values.custom_image_width }}px;\n height: {{ $ctrl.values.custom_image_height }}px;\n background-image: url(\'{{ $ctrl.values.custom_image_url }}\');">\n </div>\n </div>\n <div ng-if="!$ctrl.values.custom_image_url">\n {{ ::$ctrl.i18n.custom_button_no_image_to_preview }}\n </div>\n </div>\n </td>\n </tr>\n </table>\n </tr>\n <tr>\n <th><label for="button_position">{{ ::$ctrl.settings.button_position.label }}</label></th>\n <td>\n <editor-select args="$ctrl.settings.button_position" on-update="$ctrl.update($event)"></editor-select>\n <p class="description" ng-bind-html="$ctrl.settings.button_position.desc"></p>\n </td>\n </tr>\n <tr>\n <th><label>{{ ::$ctrl.i18n.margins_label }}</label></th>\n <td>\n <p>\n <label for="button_margin_top">{{ ::$ctrl.settings.button_margin_top.label }}</label>\n <editor-number ng-disabled="!$ctrl.marginAvailability.top" args="$ctrl.settings.button_margin_top" on-update="$ctrl.update($event)">\n </editor-number>\n </p>\n <p>\n <label for="button_margin_bottom">{{ ::$ctrl.settings.button_margin_bottom.label }}</label>\n <editor-number ng-disabled="!$ctrl.marginAvailability.bottom" args="$ctrl.settings.button_margin_bottom" on-update="$ctrl.update($event)">\n </editor-number>\n </p>\n <p>\n <label for="button_margin_left">{{ ::$ctrl.settings.button_margin_left.label }}</label>\n <editor-number ng-disabled="!$ctrl.marginAvailability.left" args="$ctrl.settings.button_margin_left" on-update="$ctrl.update($event)">\n </editor-number>\n </p>\n <p>\n <label for="button_margin_right">{{ ::$ctrl.settings.button_margin_right.label }}</label>\n <editor-number ng-disabled="!$ctrl.marginAvailability.right" args="$ctrl.settings.button_margin_right" on-update="$ctrl.update($event)">\n </editor-number>\n </p>\n <p class="description" ng-bind-html="$ctrl.i18n.margins_desc"></p>\n </td>\n </tr>\n </tbody>\n </table>\n <p ng-bind-html="$ctrl.i18n.attribution"></p>\n '
508
+ };
509
+
510
+ exports.default = VisualComponent;
511
+
512
+ },{"./visual.controller":17}],17:[function(require,module,exports){
513
+ 'use strict';
514
+
515
+ Object.defineProperty(exports, "__esModule", {
516
+ value: true
517
+ });
518
+
519
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
520
+
521
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
522
+
523
+ var _base = require('./../base.controller');
524
+
525
+ var _base2 = _interopRequireDefault(_base);
526
+
527
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
528
+
529
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
530
+
531
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
532
+
533
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
534
+
535
+ var VisualController = function (_BaseController) {
536
+ _inherits(VisualController, _BaseController);
537
+
538
+ function VisualController($scope) {
539
+ _classCallCheck(this, VisualController);
540
+
541
+ var _this = _possibleConstructorReturn(this, (VisualController.__proto__ || Object.getPrototypeOf(VisualController)).call(this));
542
+
543
+ _this.$scope = $scope;
544
+ _this.fileFrame = null;
545
+ return _this;
546
+ }
547
+
548
+ _createClass(VisualController, [{
549
+ key: '$onChanges',
550
+ value: function $onChanges(changes) {
551
+ _get(VisualController.prototype.__proto__ || Object.getPrototypeOf(VisualController.prototype), '$onChanges', this).call(this, changes);
552
+ this.updateMarginAvailability();
553
+ }
554
+ }, {
555
+ key: 'update',
556
+ value: function update(_ref) {
557
+ var key = _ref.key,
558
+ value = _ref.value;
559
+
560
+ this.values[key] = value;
561
+ if (key === 'button_position') {
562
+ this.updateMarginAvailability();
563
+ }
564
+ }
565
+ }, {
566
+ key: 'updateMarginAvailability',
567
+ value: function updateMarginAvailability() {
568
+ var btnPosition = this.values.button_position;
569
+ this.marginAvailability = {
570
+ top: btnPosition === 'top-left' || btnPosition === 'top-right',
571
+ bottom: btnPosition === 'bottom-left' || btnPosition === 'bottom-right',
572
+ left: btnPosition === 'top-left' || btnPosition === 'bottom-left',
573
+ right: btnPosition === 'top-right' || btnPosition === 'bottom-right'
574
+ };
575
+ }
576
+ }, {
577
+ key: 'upload',
578
+ value: function upload($event) {
579
+ var _this2 = this;
580
+
581
+ if (this.fileFrame) {
582
+ this.fileFrame.open();
583
+ return;
584
+ }
585
+
586
+ this.fileFrame = wp.media.frames.file_frame = wp.media({
587
+ title: this.i18n.custom_button_frame_title,
588
+ button: {
589
+ text: this.i18n.custom_button_frame_button_text
590
+ },
591
+ multiple: false
592
+ }).on('select', function () {
593
+ var image = _this2.fileFrame.state().get('selection').first().toJSON();
594
+ _this2.updateValue('custom_image_url', image.url);
595
+ _this2.updateValue('custom_image_width', image.width);
596
+ _this2.updateValue('custom_image_height', image.height);
597
+ _this2.$scope.$digest();
598
+ });
599
+
600
+ this.fileFrame.open();
601
+ }
602
+ }]);
603
+
604
+ return VisualController;
605
+ }(_base2.default);
606
+
607
+ VisualController.$inject = ['$scope'];
608
+
609
+ exports.default = VisualController;
610
+
611
+ },{"./../base.controller":7}],18:[function(require,module,exports){
612
+ 'use strict';
613
+
614
+ Object.defineProperty(exports, "__esModule", {
615
+ value: true
616
+ });
617
+
618
+ var _angular = require('angular');
619
+
620
+ var _angular2 = _interopRequireDefault(_angular);
621
+
622
+ var _navbar = require('./navbar');
623
+
624
+ var _navbar2 = _interopRequireDefault(_navbar);
625
+
626
+ var _editors = require('./editors');
627
+
628
+ var _editors2 = _interopRequireDefault(_editors);
629
+
630
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
631
+
632
+ var components = _angular2.default.module('app.components', [_navbar2.default, _editors2.default]).name;
633
+
634
+ exports.default = components;
635
+
636
+ },{"./editors":32,"./navbar":33,"angular":42}],19:[function(require,module,exports){
637
+ 'use strict';
638
+
639
+ Object.defineProperty(exports, "__esModule", {
640
+ value: true
641
+ });
642
+
643
+ var _editorCheckbox = require('./editor.checkbox.controller');
644
+
645
+ var _editorCheckbox2 = _interopRequireDefault(_editorCheckbox);
646
+
647
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
648
+
649
+ var EditorCheckboxComponent = {
650
+ bindings: {
651
+ args: '<',
652
+ onUpdate: '&',
653
+ addBr: '<?'
654
+ },
655
+ controller: _editorCheckbox2.default,
656
+ template: '<input type="checkbox" ng-change="$ctrl.change()" name="{{ ::$ctrl.key }}" id="{{ ::$ctrl.key }}" ng-model="$ctrl.value">\n <label for="{{ ::$ctrl.key }}">{{ ::$ctrl.args.text }}</label>\n <span ng-if="$ctrl.args.tooltip" tooltips tooltip-template="{{ ::$ctrl.args.tooltip }}" class="dashicons dashicons-editor-help"></span>\n <br ng-if="$ctrl.addBr" />'
657
+ };
658
+
659
+ exports.default = EditorCheckboxComponent;
660
+
661
+ },{"./editor.checkbox.controller":20}],20:[function(require,module,exports){
662
+ 'use strict';
663
+
664
+ Object.defineProperty(exports, "__esModule", {
665
+ value: true
666
+ });
667
+
668
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
669
+
670
+ var _editor = require('./editor.controller');
671
+
672
+ var _editor2 = _interopRequireDefault(_editor);
673
+
674
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
675
+
676
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
677
+
678
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
679
+
680
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
681
+
682
+ var EditorCheckboxController = function (_controller) {
683
+ _inherits(EditorCheckboxController, _controller);
684
+
685
+ function EditorCheckboxController() {
686
+ _classCallCheck(this, EditorCheckboxController);
687
+
688
+ return _possibleConstructorReturn(this, (EditorCheckboxController.__proto__ || Object.getPrototypeOf(EditorCheckboxController)).apply(this, arguments));
689
+ }
690
+
691
+ _createClass(EditorCheckboxController, [{
692
+ key: '$onInit',
693
+ value: function $onInit() {
694
+ if (undefined === this.addBr) {
695
+ this.addBr = true;
696
+ }
697
+ }
698
+ }]);
699
+
700
+ return EditorCheckboxController;
701
+ }(_editor2.default);
702
+
703
+ exports.default = EditorCheckboxController;
704
+
705
+ },{"./editor.controller":21}],21:[function(require,module,exports){
706
+ "use strict";
707
+
708
+ Object.defineProperty(exports, "__esModule", {
709
+ value: true
710
+ });
711
+
712
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
713
+
714
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
715
+
716
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
717
+
718
+ var EditorController = function () {
719
+ function EditorController() {
720
+ _classCallCheck(this, EditorController);
721
+ }
722
+
723
+ _createClass(EditorController, [{
724
+ key: "$onChanges",
725
+ value: function $onChanges(changes) {
726
+ if (changes.args) {
727
+ this.args = _extends({}, this.args);
728
+ this.key = this.args.key;
729
+ this.value = this.args.value;
730
+ }
731
+ }
732
+ }, {
733
+ key: "change",
734
+ value: function change() {
735
+ this.onUpdate({
736
+ $event: {
737
+ key: this.key,
738
+ value: this.value
739
+ }
740
+ });
741
+ }
742
+ }]);
743
+
744
+ return EditorController;
745
+ }();
746
+
747
+ EditorController.$inject = [];
748
+
749
+ exports.default = EditorController;
750
+
751
+ },{}],22:[function(require,module,exports){
752
+ 'use strict';
753
+
754
+ Object.defineProperty(exports, "__esModule", {
755
+ value: true
756
+ });
757
+
758
+ var _editorImage = require('./editor.image.controller');
759
+
760
+ var _editorImage2 = _interopRequireDefault(_editorImage);
761
+
762
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
763
+
764
+ var EditorImageComponent = {
765
+ bindings: {
766
+ args: '<',
767
+ onUpdate: '&',
768
+ class: '@'
769
+ },
770
+ controller: _editorImage2.default,
771
+ template: '<input type="text" id="{{ $ctrl.key }}" name="{{ ::$ctrl.args.key }}" ng-model="$ctrl.value" ng-change="$ctrl.change()" class="regular-text" />\n<input type="button" class="button" value="{{ ::$ctrl.args.button_text }}" ng-click="$ctrl.selectFile()" />'
772
+ };
773
+
774
+ exports.default = EditorImageComponent;
775
+
776
+ },{"./editor.image.controller":23}],23:[function(require,module,exports){
777
+ 'use strict';
778
+
779
+ Object.defineProperty(exports, "__esModule", {
780
+ value: true
781
+ });
782
+
783
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
784
+
785
+ var _editor = require('./editor.controller');
786
+
787
+ var _editor2 = _interopRequireDefault(_editor);
788
+
789
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
790
+
791
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
792
+
793
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
794
+
795
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
796
+
797
+ var ImageController = function (_BaseController) {
798
+ _inherits(ImageController, _BaseController);
799
+
800
+ function ImageController($scope) {
801
+ _classCallCheck(this, ImageController);
802
+
803
+ var _this = _possibleConstructorReturn(this, (ImageController.__proto__ || Object.getPrototypeOf(ImageController)).call(this));
804
+
805
+ _this.$scope = $scope;
806
+ return _this;
807
+ }
808
+
809
+ _createClass(ImageController, [{
810
+ key: 'selectFile',
811
+ value: function selectFile() {
812
+ var _this2 = this;
813
+
814
+ this.fileFrame = this.fileFrame || null;
815
+ if (this.fileFrame) {
816
+ return this.fileFrame.open();
817
+ }
818
+
819
+ this.fileFrame = wp.media.frames.file_frame = wp.media({
820
+ title: this.args.title_text,
821
+ button: {
822
+ text: this.args.button_text
823
+ },
824
+ multiple: false
825
+ }).on('select', function () {
826
+ var image = _this2.fileFrame.state().get('selection').first().toJSON();
827
+ _this2.value = image.url;
828
+ _this2.onUpdate({
829
+ $event: {
830
+ key: _this2.key,
831
+ value: _this2.value
832
+ }
833
+ });
834
+ _this2.$scope.$apply();
835
+ });
836
+
837
+ this.fileFrame.open();
838
+ }
839
+ }]);
840
+
841
+ return ImageController;
842
+ }(_editor2.default);
843
+
844
+ ImageController.$inject = ['$scope'];
845
+
846
+ exports.default = ImageController;
847
+
848
+ },{"./editor.controller":21}],24:[function(require,module,exports){
849
+ 'use strict';
850
+
851
+ Object.defineProperty(exports, "__esModule", {
852
+ value: true
853
+ });
854
+
855
+ var _editor = require('./editor.controller');
856
+
857
+ var _editor2 = _interopRequireDefault(_editor);
858
+
859
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
860
+
861
+ var EditorNumberComponent = {
862
+ bindings: {
863
+ args: '<',
864
+ ngDisabled: '<',
865
+ onUpdate: '&'
866
+ },
867
+ controller: _editor2.default,
868
+ template: '\n <input id="{{ $ctrl.key }}" name="{{ ::$ctrl.args.key }}" ng-disabled="$ctrl.ngDisabled" number-attributes="$ctrl.args" class="small-text" type="number" ng-model="$ctrl.value" ng-change="$ctrl.change()" />'
869
+ };
870
+
871
+ exports.default = EditorNumberComponent;
872
+
873
+ },{"./editor.controller":21}],25:[function(require,module,exports){
874
+ 'use strict';
875
+
876
+ Object.defineProperty(exports, "__esModule", {
877
+ value: true
878
+ });
879
+
880
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
881
+
882
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
883
+
884
+ var NumberAttributes = function () {
885
+ function NumberAttributes($parse) {
886
+ _classCallCheck(this, NumberAttributes);
887
+
888
+ this.$parse = $parse;
889
+ this.restrict = 'A';
890
+ }
891
+
892
+ _createClass(NumberAttributes, [{
893
+ key: 'link',
894
+ value: function link($scope, $element, $attrs) {
895
+ var args = this.$parse($attrs.numberAttributes)($scope);
896
+ var attributes = ['step', 'min', 'max'];
897
+ attributes.forEach(function (attName) {
898
+ if (args[attName] !== undefined) {
899
+ $element.attr(attName, args[attName]);
900
+ }
901
+ });
902
+ }
903
+ }]);
904
+
905
+ return NumberAttributes;
906
+ }();
907
+
908
+ exports.default = NumberAttributes;
909
+
910
+ },{}],26:[function(require,module,exports){
911
+ 'use strict';
912
+
913
+ Object.defineProperty(exports, "__esModule", {
914
+ value: true
915
+ });
916
+
917
+ var _editorSelect = require('./editor.select.controller');
918
+
919
+ var _editorSelect2 = _interopRequireDefault(_editorSelect);
920
+
921
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
922
+
923
+ var EditorSelectComponent = {
924
+ bindings: {
925
+ args: '<',
926
+ onUpdate: '&'
927
+ },
928
+ controller: _editorSelect2.default,
929
+ template: '\n <select name="{{ ::$ctrl.key }}" ng-model="$ctrl.value" id="{{ ::$ctrl.args.key }}" ng-change="$ctrl.change()">\n <option ng-repeat="(value, name) in $ctrl.args.options" value="{{ value }}">{{ name }}</option>\n </select>'
930
+ };
931
+
932
+ exports.default = EditorSelectComponent;
933
+
934
+ },{"./editor.select.controller":27}],27:[function(require,module,exports){
935
+ 'use strict';
936
+
937
+ Object.defineProperty(exports, "__esModule", {
938
+ value: true
939
+ });
940
+
941
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
942
+
943
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
944
+
945
+ var _editor = require('./editor.controller');
946
+
947
+ var _editor2 = _interopRequireDefault(_editor);
948
+
949
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
950
+
951
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
952
+
953
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
954
+
955
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
956
+
957
+ var SelectEditorController = function (_EditorController) {
958
+ _inherits(SelectEditorController, _EditorController);
959
+
960
+ function SelectEditorController() {
961
+ _classCallCheck(this, SelectEditorController);
962
+
963
+ return _possibleConstructorReturn(this, (SelectEditorController.__proto__ || Object.getPrototypeOf(SelectEditorController)).apply(this, arguments));
964
+ }
965
+
966
+ _createClass(SelectEditorController, [{
967
+ key: '$onChanges',
968
+ value: function $onChanges(changes) {
969
+ _get(SelectEditorController.prototype.__proto__ || Object.getPrototypeOf(SelectEditorController.prototype), '$onChanges', this).call(this, changes);
970
+ if (changes.args) {
971
+ if (this.args.value === undefined || this.args.value === null) {
972
+ this.value = Object.keys(this.args.options)[0];
973
+ this.change();
974
+ }
975
+ if (this.args.truthy) {
976
+ this.value = this.value ? '1' : '0';
977
+ }
978
+ }
979
+ }
980
+ }, {
981
+ key: 'change',
982
+ value: function change() {
983
+ this.onUpdate({
984
+ $event: {
985
+ key: this.key,
986
+ value: this.args.truthy ? this.value === '1' : this.value
987
+ }
988
+ });
989
+ }
990
+ }]);
991
+
992
+ return SelectEditorController;
993
+ }(_editor2.default);
994
+
995
+ SelectEditorController.$inject = [];
996
+
997
+ exports.default = SelectEditorController;
998
+
999
+ },{"./editor.controller":21}],28:[function(require,module,exports){
1000
+ 'use strict';
1001
+
1002
+ Object.defineProperty(exports, "__esModule", {
1003
+ value: true
1004
+ });
1005
+
1006
+ var _editorSortableSelect = require('./editor.sortableSelect.controller');
1007
+
1008
+ var _editorSortableSelect2 = _interopRequireDefault(_editorSortableSelect);
1009
+
1010
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1011
+
1012
+ var EditorSortableSelectComponent = {
1013
+ bindings: {
1014
+ args: '<',
1015
+ onUpdate: '&'
1016
+ },
1017
+ controller: _editorSortableSelect2.default,
1018
+ template: '\n <input type="hidden" name="{{ ::$ctrl.args.key }}" ng-value="$ctrl.hiddenInputValue" />\n <ul class="frizzly-sortable" dnd-list="$ctrl.options">\n <li ng-repeat="item in $ctrl.options"\n dnd-draggable="item"\n dnd-moved="$ctrl.options.splice($index, 1); $ctrl.change()"\n dnd-effect-allowed="move">\n <input type="checkbox" id="{{ item.key }}" ng-model="item.selected" ng-change="$ctrl.change()" />\n <label for="{{ item.key }}">{{ item.label }}\n </li>\n </ul>\n '
1019
+ };
1020
+
1021
+ exports.default = EditorSortableSelectComponent;
1022
+
1023
+ },{"./editor.sortableSelect.controller":29}],29:[function(require,module,exports){
1024
+ "use strict";
1025
+
1026
+ Object.defineProperty(exports, "__esModule", {
1027
+ value: true
1028
+ });
1029
+
1030
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
1031
+
1032
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1033
+
1034
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1035
+
1036
+ var EditorController = function () {
1037
+ function EditorController() {
1038
+ _classCallCheck(this, EditorController);
1039
+ }
1040
+
1041
+ _createClass(EditorController, [{
1042
+ key: "$onChanges",
1043
+ value: function $onChanges(changes) {
1044
+ var _this = this;
1045
+
1046
+ if (changes.args) {
1047
+ this.args = _extends({}, this.args);
1048
+ this.key = this.args.key;
1049
+ this.value = this.args.value || [];
1050
+ this.hiddenInputValue = this.value;
1051
+ var keysSorted = this.value.slice().concat(Object.keys(this.args.options).filter(function (key) {
1052
+ return _this.value.indexOf(key) === -1;
1053
+ }));
1054
+ this.options = keysSorted.map(function (key) {
1055
+ return { key: key, label: _this.args.options[key], selected: _this.value.indexOf(key) !== -1 };
1056
+ });
1057
+ }
1058
+ }
1059
+ }, {
1060
+ key: "change",
1061
+ value: function change() {
1062
+ var value = this.options.reduce(function (prev, option) {
1063
+ return option.selected ? prev.concat([option.key]) : prev;
1064
+ }, []);
1065
+ this.hiddenInputValue = value;
1066
+ this.onUpdate({
1067
+ $event: {
1068
+ key: this.key,
1069
+ value: value
1070
+ }
1071
+ });
1072
+ }
1073
+ }]);
1074
+
1075
+ return EditorController;
1076
+ }();
1077
+
1078
+ EditorController.$inject = [];
1079
+
1080
+ exports.default = EditorController;
1081
+
1082
+ },{}],30:[function(require,module,exports){
1083
+ 'use strict';
1084
+
1085
+ Object.defineProperty(exports, "__esModule", {
1086
+ value: true
1087
+ });
1088
+
1089
+ var _editor = require('./editor.controller');
1090
+
1091
+ var _editor2 = _interopRequireDefault(_editor);
1092
+
1093
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1094
+
1095
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1096
+
1097
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1098
+
1099
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1100
+
1101
+ var controller = function (_BaseController) {
1102
+ _inherits(controller, _BaseController);
1103
+
1104
+ function controller() {
1105
+ _classCallCheck(this, controller);
1106
+
1107
+ var _this = _possibleConstructorReturn(this, (controller.__proto__ || Object.getPrototypeOf(controller)).call(this));
1108
+
1109
+ _this.class = 'regular-text';
1110
+ return _this;
1111
+ }
1112
+
1113
+ return controller;
1114
+ }(_editor2.default);
1115
+
1116
+ var EditorTextComponent = {
1117
+ bindings: {
1118
+ args: '<',
1119
+ onUpdate: '&',
1120
+ class: '@',
1121
+ ngDisabled: '<'
1122
+ },
1123
+ controller: controller,
1124
+ template: '<input type="text" placeholder="{{ $ctrl.args.placeholder || \'\' }}" name="{{ ::$ctrl.key }}" id="{{ $ctrl.key }}" ng-model="$ctrl.value" ng-change="$ctrl.change()" ng-class="$ctrl.class" ng-disabled="$ctrl.ngDisabled" />'
1125
+ };
1126
+
1127
+ exports.default = EditorTextComponent;
1128
+
1129
+ },{"./editor.controller":21}],31:[function(require,module,exports){
1130
+ 'use strict';
1131
+
1132
+ Object.defineProperty(exports, "__esModule", {
1133
+ value: true
1134
+ });
1135
+
1136
+ var _editor = require('./editor.controller');
1137
+
1138
+ var _editor2 = _interopRequireDefault(_editor);
1139
+
1140
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1141
+
1142
+ var EditorTextAreaComponent = {
1143
+ bindings: {
1144
+ args: '<',
1145
+ onUpdate: '&'
1146
+ },
1147
+ controller: _editor2.default,
1148
+ template: '<textarea rows="3" cols="50" id="{{ $ctrl.key }}" name="{{ ::$ctrl.args.key }}" class="large-text code" ng-model="$ctrl.value" ng-change="$ctrl.change()"></textarea>'
1149
+ };
1150
+
1151
+ exports.default = EditorTextAreaComponent;
1152
+
1153
+ },{"./editor.controller":21}],32:[function(require,module,exports){
1154
+ 'use strict';
1155
+
1156
+ Object.defineProperty(exports, "__esModule", {
1157
+ value: true
1158
+ });
1159
+
1160
+ var _angular = require('angular');
1161
+
1162
+ var _angular2 = _interopRequireDefault(_angular);
1163
+
1164
+ var _editorText = require('./editor.text.component');
1165
+
1166
+ var _editorText2 = _interopRequireDefault(_editorText);
1167
+
1168
+ var _editorTextarea = require('./editor.textarea.component');
1169
+
1170
+ var _editorTextarea2 = _interopRequireDefault(_editorTextarea);
1171
+
1172
+ var _editorImage = require('./editor.image.component');
1173
+
1174
+ var _editorImage2 = _interopRequireDefault(_editorImage);
1175
+
1176
+ var _editorNumber = require('./editor.number.component');
1177
+
1178
+ var _editorNumber2 = _interopRequireDefault(_editorNumber);
1179
+
1180
+ var _editorNumber3 = require('./editor.number.directive');
1181
+
1182
+ var _editorNumber4 = _interopRequireDefault(_editorNumber3);
1183
+
1184
+ var _editorCheckbox = require('./editor.checkbox.component');
1185
+
1186
+ var _editorCheckbox2 = _interopRequireDefault(_editorCheckbox);
1187
+
1188
+ var _editorSelect = require('./editor.select.component');
1189
+
1190
+ var _editorSelect2 = _interopRequireDefault(_editorSelect);
1191
+
1192
+ var _editorSortableSelect = require('./editor.sortableSelect.component');
1193
+
1194
+ var _editorSortableSelect2 = _interopRequireDefault(_editorSortableSelect);
1195
+
1196
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1197
+
1198
+ var editors = _angular2.default.module('editors', ['dndLists']).component('editorText', _editorText2.default).component('editorTextarea', _editorTextarea2.default).component('editorImage', _editorImage2.default).component('editorNumber', _editorNumber2.default).component('editorCheckbox', _editorCheckbox2.default).component('editorSelect', _editorSelect2.default).component('editorSortableSelect', _editorSortableSelect2.default).directive('numberAttributes', ['$parse', function ($parse) {
1199
+ return new _editorNumber4.default($parse);
1200
+ }]).name;
1201
+
1202
+ exports.default = editors;
1203
+
1204
+ },{"./editor.checkbox.component":19,"./editor.image.component":22,"./editor.number.component":24,"./editor.number.directive":25,"./editor.select.component":26,"./editor.sortableSelect.component":28,"./editor.text.component":30,"./editor.textarea.component":31,"angular":42}],33:[function(require,module,exports){
1205
+ 'use strict';
1206
+
1207
+ Object.defineProperty(exports, "__esModule", {
1208
+ value: true
1209
+ });
1210
+
1211
+ var _angular = require('angular');
1212
+
1213
+ var _angular2 = _interopRequireDefault(_angular);
1214
+
1215
+ var _navbar = require('./navbar.component');
1216
+
1217
+ var _navbar2 = _interopRequireDefault(_navbar);
1218
+
1219
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1220
+
1221
+ var navbar = _angular2.default.module('navbar', []).component('navbar', _navbar2.default).name;
1222
+
1223
+ exports.default = navbar;
1224
+
1225
+ },{"./navbar.component":34,"angular":42}],34:[function(require,module,exports){
1226
+ 'use strict';
1227
+
1228
+ Object.defineProperty(exports, "__esModule", {
1229
+ value: true
1230
+ });
1231
+ var NavbarComponent = {
1232
+ bindings: {
1233
+ currentTab: '<',
1234
+ tabs: '<',
1235
+ page: '<',
1236
+ links: '<'
1237
+ },
1238
+ controller: function controller() {},
1239
+ template: '\n <h2 class="nav-tab-wrapper">\n <a ng-repeat="tab in $ctrl.tabs" \n href="?page={{ $ctrl.page }}&tab={{ tab.slug }}" class="nav-tab {{ $ctrl.currentTab == tab.slug ? \'nav-tab-active\' : \'\' }}">\n {{ tab.name }}\n </a>\n <a ng-repeat="link in $ctrl.links" href="{{ link.url }}" target="_blank" class="nav-tab">\n {{ link.label }}\n </a>\n </h2>\n '
1240
+ };
1241
+
1242
+ exports.default = NavbarComponent;
1243
+
1244
+ },{}],35:[function(require,module,exports){
1245
+ 'use strict';
1246
+
1247
+ Object.defineProperty(exports, "__esModule", {
1248
+ value: true
1249
+ });
1250
+
1251
+ var _angular = require('angular');
1252
+
1253
+ var _angular2 = _interopRequireDefault(_angular);
1254
+
1255
+ var _link = require('./link.service');
1256
+
1257
+ var _link2 = _interopRequireDefault(_link);
1258
+
1259
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1260
+
1261
+ var services = _angular2.default.module('services', []).service('linkService', _link2.default).name;
1262
+
1263
+ exports.default = services;
1264
+
1265
+ },{"./link.service":36,"angular":42}],36:[function(require,module,exports){
1266
+ 'use strict';
1267
+
1268
+ Object.defineProperty(exports, "__esModule", {
1269
+ value: true
1270
+ });
1271
+
1272
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
1273
+
1274
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1275
+
1276
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1277
+
1278
+ var LinkService = function () {
1279
+ function LinkService() {
1280
+ _classCallCheck(this, LinkService);
1281
+
1282
+ this.baseLink = '';
1283
+ }
1284
+
1285
+ _createClass(LinkService, [{
1286
+ key: 'init',
1287
+ value: function init(page) {
1288
+ this.baseLink = '?page=' + page;
1289
+ }
1290
+ }, {
1291
+ key: 'generateQuery',
1292
+ value: function generateQuery() {
1293
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1294
+ args[_key] = arguments[_key];
1295
+ }
1296
+
1297
+ return args.reduce(function (prev, _ref) {
1298
+ var _ref2 = _slicedToArray(_ref, 2),
1299
+ key = _ref2[0],
1300
+ value = _ref2[1];
1301
+
1302
+ return prev + '&' + key + '=' + value;
1303
+ }, this.baseLink);
1304
+ }
1305
+ }]);
1306
+
1307
+ return LinkService;
1308
+ }();
1309
+
1310
+ LinkService.$inject = [];
1311
+
1312
+ exports.default = LinkService;
1313
+
1314
+ },{}],37:[function(require,module,exports){
1315
+ 'use strict';
1316
+
1317
+ var _app = require('./app/app');
1318
+
1319
+ var _app2 = _interopRequireDefault(_app);
1320
+
1321
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1322
+
1323
+ },{"./app/app":3}],38:[function(require,module,exports){
1324
+ angular.module('dndLists', [])
1325
+
1326
+ .directive('dndDraggable', ['$parse', '$timeout', 'dndDropEffectWorkaround', 'dndDragTypeWorkaround',
1327
+ function($parse, $timeout, dndDropEffectWorkaround, dndDragTypeWorkaround) {
1328
+ return function(scope, element, attr) {
1329
+ element.attr("draggable", "true");
1330
+
1331
+ if (attr.dndDisableIf) {
1332
+ scope.$watch(attr.dndDisableIf, function(disabled) {
1333
+ element.attr("draggable", !disabled);
1334
+ });
1335
+ }
1336
+
1337
+ element.on('dragstart', function(event) {
1338
+ event = event.originalEvent || event;
1339
+
1340
+ if (element.attr('draggable') == 'false') return true;
1341
+
1342
+ event.dataTransfer.setData("Text", angular.toJson(scope.$eval(attr.dndDraggable)));
1343
+
1344
+ event.dataTransfer.effectAllowed = attr.dndEffectAllowed || "move";
1345
+
1346
+ element.addClass("dndDragging");
1347
+ $timeout(function() { element.addClass("dndDraggingSource"); }, 0);
1348
+
1349
+ dndDropEffectWorkaround.dropEffect = "none";
1350
+ dndDragTypeWorkaround.isDragging = true;
1351
+
1352
+ dndDragTypeWorkaround.dragType = attr.dndType ? scope.$eval(attr.dndType) : undefined;
1353
+
1354
+ if (event._dndHandle && event.dataTransfer.setDragImage) {
1355
+ event.dataTransfer.setDragImage(element[0], 0, 0);
1356
+ }
1357
+
1358
+ $parse(attr.dndDragstart)(scope, {event: event});
1359
+
1360
+ event.stopPropagation();
1361
+ });
1362
+
1363
+ element.on('dragend', function(event) {
1364
+ event = event.originalEvent || event;
1365
+
1366
+ var dropEffect = dndDropEffectWorkaround.dropEffect;
1367
+ scope.$apply(function() {
1368
+ switch (dropEffect) {
1369
+ case "move":
1370
+ $parse(attr.dndMoved)(scope, {event: event});
1371
+ break;
1372
+ case "copy":
1373
+ $parse(attr.dndCopied)(scope, {event: event});
1374
+ break;
1375
+ case "none":
1376
+ $parse(attr.dndCanceled)(scope, {event: event});
1377
+ break;
1378
+ }
1379
+ $parse(attr.dndDragend)(scope, {event: event, dropEffect: dropEffect});
1380
+ });
1381
+
1382
+ element.removeClass("dndDragging");
1383
+ $timeout(function() { element.removeClass("dndDraggingSource"); }, 0);
1384
+ dndDragTypeWorkaround.isDragging = false;
1385
+ event.stopPropagation();
1386
+ });
1387
+
1388
+ element.on('click', function(event) {
1389
+ if (!attr.dndSelected) return;
1390
+
1391
+ event = event.originalEvent || event;
1392
+ scope.$apply(function() {
1393
+ $parse(attr.dndSelected)(scope, {event: event});
1394
+ });
1395
+
1396
+ event.stopPropagation();
1397
+ });
1398
+
1399
+ element.on('selectstart', function() {
1400
+ if (this.dragDrop) this.dragDrop();
1401
+ });
1402
+ };
1403
+ }])
1404
+
1405
+ .directive('dndList', ['$parse', '$timeout', 'dndDropEffectWorkaround', 'dndDragTypeWorkaround',
1406
+ function($parse, $timeout, dndDropEffectWorkaround, dndDragTypeWorkaround) {
1407
+ return function(scope, element, attr) {
1408
+ var placeholder = getPlaceholderElement();
1409
+ var placeholderNode = placeholder[0];
1410
+ var listNode = element[0];
1411
+ placeholder.remove();
1412
+
1413
+ var horizontal = attr.dndHorizontalList && scope.$eval(attr.dndHorizontalList);
1414
+ var externalSources = attr.dndExternalSources && scope.$eval(attr.dndExternalSources);
1415
+
1416
+ element.on('dragenter', function (event) {
1417
+ event = event.originalEvent || event;
1418
+ if (!isDropAllowed(event)) return true;
1419
+ event.preventDefault();
1420
+ });
1421
+
1422
+ element.on('dragover', function(event) {
1423
+ event = event.originalEvent || event;
1424
+
1425
+ if (!isDropAllowed(event)) return true;
1426
+
1427
+ if (placeholderNode.parentNode != listNode) {
1428
+ element.append(placeholder);
1429
+ }
1430
+
1431
+ if (event.target !== listNode) {
1432
+ var listItemNode = event.target;
1433
+ while (listItemNode.parentNode !== listNode && listItemNode.parentNode) {
1434
+ listItemNode = listItemNode.parentNode;
1435
+ }
1436
+
1437
+ if (listItemNode.parentNode === listNode && listItemNode !== placeholderNode) {
1438
+ if (isMouseInFirstHalf(event, listItemNode)) {
1439
+ listNode.insertBefore(placeholderNode, listItemNode);
1440
+ } else {
1441
+ listNode.insertBefore(placeholderNode, listItemNode.nextSibling);
1442
+ }
1443
+ }
1444
+ } else {
1445
+ if (isMouseInFirstHalf(event, placeholderNode, true)) {
1446
+ while (placeholderNode.previousElementSibling
1447
+ && (isMouseInFirstHalf(event, placeholderNode.previousElementSibling, true)
1448
+ || placeholderNode.previousElementSibling.offsetHeight === 0)) {
1449
+ listNode.insertBefore(placeholderNode, placeholderNode.previousElementSibling);
1450
+ }
1451
+ } else {
1452
+ while (placeholderNode.nextElementSibling &&
1453
+ !isMouseInFirstHalf(event, placeholderNode.nextElementSibling, true)) {
1454
+ listNode.insertBefore(placeholderNode,
1455
+ placeholderNode.nextElementSibling.nextElementSibling);
1456
+ }
1457
+ }
1458
+ }
1459
+
1460
+ if (attr.dndDragover && !invokeCallback(attr.dndDragover, event, getPlaceholderIndex())) {
1461
+ return stopDragover();
1462
+ }
1463
+
1464
+ element.addClass("dndDragover");
1465
+ event.preventDefault();
1466
+ event.stopPropagation();
1467
+ return false;
1468
+ });
1469
+
1470
+ element.on('drop', function(event) {
1471
+ event = event.originalEvent || event;
1472
+
1473
+ if (!isDropAllowed(event)) return true;
1474
+
1475
+ event.preventDefault();
1476
+
1477
+ var data = event.dataTransfer.getData("Text") || event.dataTransfer.getData("text/plain");
1478
+ var transferredObject;
1479
+ try {
1480
+ transferredObject = JSON.parse(data);
1481
+ } catch(e) {
1482
+ return stopDragover();
1483
+ }
1484
+
1485
+ var index = getPlaceholderIndex();
1486
+ if (attr.dndDrop) {
1487
+ transferredObject = invokeCallback(attr.dndDrop, event, index, transferredObject);
1488
+ if (!transferredObject) {
1489
+ return stopDragover();
1490
+ }
1491
+ }
1492
+
1493
+ if (transferredObject !== true) {
1494
+ scope.$apply(function() {
1495
+ scope.$eval(attr.dndList).splice(index, 0, transferredObject);
1496
+ });
1497
+ }
1498
+ invokeCallback(attr.dndInserted, event, index, transferredObject);
1499
+
1500
+ if (event.dataTransfer.dropEffect === "none") {
1501
+ if (event.dataTransfer.effectAllowed === "copy" ||
1502
+ event.dataTransfer.effectAllowed === "move") {
1503
+ dndDropEffectWorkaround.dropEffect = event.dataTransfer.effectAllowed;
1504
+ } else {
1505
+ dndDropEffectWorkaround.dropEffect = event.ctrlKey ? "copy" : "move";
1506
+ }
1507
+ } else {
1508
+ dndDropEffectWorkaround.dropEffect = event.dataTransfer.dropEffect;
1509
+ }
1510
+
1511
+ stopDragover();
1512
+ event.stopPropagation();
1513
+ return false;
1514
+ });
1515
+
1516
+ element.on('dragleave', function(event) {
1517
+ event = event.originalEvent || event;
1518
+
1519
+ element.removeClass("dndDragover");
1520
+ $timeout(function() {
1521
+ if (!element.hasClass("dndDragover")) {
1522
+ placeholder.remove();
1523
+ }
1524
+ }, 100);
1525
+ });
1526
+
1527
+ function isMouseInFirstHalf(event, targetNode, relativeToParent) {
1528
+ var mousePointer = horizontal ? (event.offsetX || event.layerX)
1529
+ : (event.offsetY || event.layerY);
1530
+ var targetSize = horizontal ? targetNode.offsetWidth : targetNode.offsetHeight;
1531
+ var targetPosition = horizontal ? targetNode.offsetLeft : targetNode.offsetTop;
1532
+ targetPosition = relativeToParent ? targetPosition : 0;
1533
+ return mousePointer < targetPosition + targetSize / 2;
1534
+ }
1535
+
1536
+ function getPlaceholderElement() {
1537
+ var placeholder;
1538
+ angular.forEach(element.children(), function(childNode) {
1539
+ var child = angular.element(childNode);
1540
+ if (child.hasClass('dndPlaceholder')) {
1541
+ placeholder = child;
1542
+ }
1543
+ });
1544
+ return placeholder || angular.element("<li class='dndPlaceholder'></li>");
1545
+ }
1546
+
1547
+ function getPlaceholderIndex() {
1548
+ return Array.prototype.indexOf.call(listNode.children, placeholderNode);
1549
+ }
1550
+
1551
+ function isDropAllowed(event) {
1552
+ if (!dndDragTypeWorkaround.isDragging && !externalSources) return false;
1553
+
1554
+ if (!hasTextMimetype(event.dataTransfer.types)) return false;
1555
+
1556
+ if (attr.dndAllowedTypes && dndDragTypeWorkaround.isDragging) {
1557
+ var allowed = scope.$eval(attr.dndAllowedTypes);
1558
+ if (angular.isArray(allowed) && allowed.indexOf(dndDragTypeWorkaround.dragType) === -1) {
1559
+ return false;
1560
+ }
1561
+ }
1562
+
1563
+ if (attr.dndDisableIf && scope.$eval(attr.dndDisableIf)) return false;
1564
+
1565
+ return true;
1566
+ }
1567
+
1568
+ function stopDragover() {
1569
+ placeholder.remove();
1570
+ element.removeClass("dndDragover");
1571
+ return true;
1572
+ }
1573
+
1574
+ function invokeCallback(expression, event, index, item) {
1575
+ return $parse(expression)(scope, {
1576
+ event: event,
1577
+ index: index,
1578
+ item: item || undefined,
1579
+ external: !dndDragTypeWorkaround.isDragging,
1580
+ type: dndDragTypeWorkaround.isDragging ? dndDragTypeWorkaround.dragType : undefined
1581
+ });
1582
+ }
1583
+
1584
+ function hasTextMimetype(types) {
1585
+ if (!types) return true;
1586
+ for (var i = 0; i < types.length; i++) {
1587
+ if (types[i] === "Text" || types[i] === "text/plain") return true;
1588
+ }
1589
+
1590
+ return false;
1591
+ }
1592
+ };
1593
+ }])
1594
+
1595
+ .directive('dndNodrag', function() {
1596
+ return function(scope, element, attr) {
1597
+ element.attr("draggable", "true");
1598
+
1599
+ element.on('dragstart', function(event) {
1600
+ event = event.originalEvent || event;
1601
+
1602
+ if (!event._dndHandle) {
1603
+ if (!(event.dataTransfer.types && event.dataTransfer.types.length)) {
1604
+ event.preventDefault();
1605
+ }
1606
+ event.stopPropagation();
1607
+ }
1608
+ });
1609
+
1610
+ element.on('dragend', function(event) {
1611
+ event = event.originalEvent || event;
1612
+ if (!event._dndHandle) {
1613
+ event.stopPropagation();
1614
+ }
1615
+ });
1616
+ };
1617
+ })
1618
+
1619
+ .directive('dndHandle', function() {
1620
+ return function(scope, element, attr) {
1621
+ element.attr("draggable", "true");
1622
+
1623
+ element.on('dragstart dragend', function(event) {
1624
+ event = event.originalEvent || event;
1625
+ event._dndHandle = true;
1626
+ });
1627
+ };
1628
+ })
1629
+
1630
+ .factory('dndDragTypeWorkaround', function(){ return {} })
1631
+
1632
+ .factory('dndDropEffectWorkaround', function(){ return {} });
1633
+
1634
+ },{}],39:[function(require,module,exports){
1635
+ (function(window, angular) {'use strict';
1636
+
1637
+
1638
+ var $sanitizeMinErr = angular.$$minErr('$sanitize');
1639
+ var bind;
1640
+ var extend;
1641
+ var forEach;
1642
+ var isDefined;
1643
+ var lowercase;
1644
+ var noop;
1645
+ var htmlParser;
1646
+ var htmlSanitizeWriter;
1647
+
1648
+
1649
+
1650
+
1651
+ function $SanitizeProvider() {
1652
+ var svgEnabled = false;
1653
+
1654
+ this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
1655
+ if (svgEnabled) {
1656
+ extend(validElements, svgElements);
1657
+ }
1658
+ return function(html) {
1659
+ var buf = [];
1660
+ htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
1661
+ return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
1662
+ }));
1663
+ return buf.join('');
1664
+ };
1665
+ }];
1666
+
1667
+
1668
+ this.enableSvg = function(enableSvg) {
1669
+ if (isDefined(enableSvg)) {
1670
+ svgEnabled = enableSvg;
1671
+ return this;
1672
+ } else {
1673
+ return svgEnabled;
1674
+ }
1675
+ };
1676
+
1677
+
1678
+ bind = angular.bind;
1679
+ extend = angular.extend;
1680
+ forEach = angular.forEach;
1681
+ isDefined = angular.isDefined;
1682
+ lowercase = angular.lowercase;
1683
+ noop = angular.noop;
1684
+
1685
+ htmlParser = htmlParserImpl;
1686
+ htmlSanitizeWriter = htmlSanitizeWriterImpl;
1687
+
1688
+ var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
1689
+ NON_ALPHANUMERIC_REGEXP = /([^#-~ |!])/g;
1690
+
1691
+
1692
+
1693
+ var voidElements = toMap('area,br,col,hr,img,wbr');
1694
+
1695
+ var optionalEndTagBlockElements = toMap('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'),
1696
+ optionalEndTagInlineElements = toMap('rp,rt'),
1697
+ optionalEndTagElements = extend({},
1698
+ optionalEndTagInlineElements,
1699
+ optionalEndTagBlockElements);
1700
+
1701
+ var blockElements = extend({}, optionalEndTagBlockElements, toMap('address,article,' +
1702
+ 'aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
1703
+ 'h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul'));
1704
+
1705
+ var inlineElements = extend({}, optionalEndTagInlineElements, toMap('a,abbr,acronym,b,' +
1706
+ 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,' +
1707
+ 'samp,small,span,strike,strong,sub,sup,time,tt,u,var'));
1708
+
1709
+ var svgElements = toMap('circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,' +
1710
+ 'hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,' +
1711
+ 'radialGradient,rect,stop,svg,switch,text,title,tspan');
1712
+
1713
+ var blockedElements = toMap('script,style');
1714
+
1715
+ var validElements = extend({},
1716
+ voidElements,
1717
+ blockElements,
1718
+ inlineElements,
1719
+ optionalEndTagElements);
1720
+
1721
+ var uriAttrs = toMap('background,cite,href,longdesc,src,xlink:href');
1722
+
1723
+ var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
1724
+ 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
1725
+ 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
1726
+ 'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
1727
+ 'valign,value,vspace,width');
1728
+
1729
+ var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
1730
+ 'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
1731
+ 'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
1732
+ 'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
1733
+ 'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
1734
+ 'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
1735
+ 'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
1736
+ 'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
1737
+ 'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
1738
+ 'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
1739
+ 'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
1740
+ 'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
1741
+ 'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
1742
+ 'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
1743
+ 'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
1744
+
1745
+ var validAttrs = extend({},
1746
+ uriAttrs,
1747
+ svgAttrs,
1748
+ htmlAttrs);
1749
+
1750
+ function toMap(str, lowercaseKeys) {
1751
+ var obj = {}, items = str.split(','), i;
1752
+ for (i = 0; i < items.length; i++) {
1753
+ obj[lowercaseKeys ? lowercase(items[i]) : items[i]] = true;
1754
+ }
1755
+ return obj;
1756
+ }
1757
+
1758
+ var inertBodyElement;
1759
+ (function(window) {
1760
+ var doc;
1761
+ if (window.document && window.document.implementation) {
1762
+ doc = window.document.implementation.createHTMLDocument('inert');
1763
+ } else {
1764
+ throw $sanitizeMinErr('noinert', 'Can\'t create an inert html document');
1765
+ }
1766
+ var docElement = doc.documentElement || doc.getDocumentElement();
1767
+ var bodyElements = docElement.getElementsByTagName('body');
1768
+
1769
+ if (bodyElements.length === 1) {
1770
+ inertBodyElement = bodyElements[0];
1771
+ } else {
1772
+ var html = doc.createElement('html');
1773
+ inertBodyElement = doc.createElement('body');
1774
+ html.appendChild(inertBodyElement);
1775
+ doc.appendChild(html);
1776
+ }
1777
+ })(window);
1778
+
1779
+ function htmlParserImpl(html, handler) {
1780
+ if (html === null || html === undefined) {
1781
+ html = '';
1782
+ } else if (typeof html !== 'string') {
1783
+ html = '' + html;
1784
+ }
1785
+ inertBodyElement.innerHTML = html;
1786
+
1787
+ var mXSSAttempts = 5;
1788
+ do {
1789
+ if (mXSSAttempts === 0) {
1790
+ throw $sanitizeMinErr('uinput', 'Failed to sanitize html because the input is unstable');
1791
+ }
1792
+ mXSSAttempts--;
1793
+
1794
+ if (window.document.documentMode) {
1795
+ stripCustomNsAttrs(inertBodyElement);
1796
+ }
1797
+ html = inertBodyElement.innerHTML;
1798
+ inertBodyElement.innerHTML = html;
1799
+ } while (html !== inertBodyElement.innerHTML);
1800
+
1801
+ var node = inertBodyElement.firstChild;
1802
+ while (node) {
1803
+ switch (node.nodeType) {
1804
+ case 1:
1805
+ handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
1806
+ break;
1807
+ case 3:
1808
+ handler.chars(node.textContent);
1809
+ break;
1810
+ }
1811
+
1812
+ var nextNode;
1813
+ if (!(nextNode = node.firstChild)) {
1814
+ if (node.nodeType === 1) {
1815
+ handler.end(node.nodeName.toLowerCase());
1816
+ }
1817
+ nextNode = node.nextSibling;
1818
+ if (!nextNode) {
1819
+ while (nextNode == null) {
1820
+ node = node.parentNode;
1821
+ if (node === inertBodyElement) break;
1822
+ nextNode = node.nextSibling;
1823
+ if (node.nodeType === 1) {
1824
+ handler.end(node.nodeName.toLowerCase());
1825
+ }
1826
+ }
1827
+ }
1828
+ }
1829
+ node = nextNode;
1830
+ }
1831
+
1832
+ while ((node = inertBodyElement.firstChild)) {
1833
+ inertBodyElement.removeChild(node);
1834
+ }
1835
+ }
1836
+
1837
+ function attrToMap(attrs) {
1838
+ var map = {};
1839
+ for (var i = 0, ii = attrs.length; i < ii; i++) {
1840
+ var attr = attrs[i];
1841
+ map[attr.name] = attr.value;
1842
+ }
1843
+ return map;
1844
+ }
1845
+
1846
+
1847
+ function encodeEntities(value) {
1848
+ return value.
1849
+ replace(/&/g, '&amp;').
1850
+ replace(SURROGATE_PAIR_REGEXP, function(value) {
1851
+ var hi = value.charCodeAt(0);
1852
+ var low = value.charCodeAt(1);
1853
+ return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
1854
+ }).
1855
+ replace(NON_ALPHANUMERIC_REGEXP, function(value) {
1856
+ return '&#' + value.charCodeAt(0) + ';';
1857
+ }).
1858
+ replace(/</g, '&lt;').
1859
+ replace(/>/g, '&gt;');
1860
+ }
1861
+
1862
+ function htmlSanitizeWriterImpl(buf, uriValidator) {
1863
+ var ignoreCurrentElement = false;
1864
+ var out = bind(buf, buf.push);
1865
+ return {
1866
+ start: function(tag, attrs) {
1867
+ tag = lowercase(tag);
1868
+ if (!ignoreCurrentElement && blockedElements[tag]) {
1869
+ ignoreCurrentElement = tag;
1870
+ }
1871
+ if (!ignoreCurrentElement && validElements[tag] === true) {
1872
+ out('<');
1873
+ out(tag);
1874
+ forEach(attrs, function(value, key) {
1875
+ var lkey = lowercase(key);
1876
+ var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
1877
+ if (validAttrs[lkey] === true &&
1878
+ (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
1879
+ out(' ');
1880
+ out(key);
1881
+ out('="');
1882
+ out(encodeEntities(value));
1883
+ out('"');
1884
+ }
1885
+ });
1886
+ out('>');
1887
+ }
1888
+ },
1889
+ end: function(tag) {
1890
+ tag = lowercase(tag);
1891
+ if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
1892
+ out('</');
1893
+ out(tag);
1894
+ out('>');
1895
+ }
1896
+ if (tag == ignoreCurrentElement) {
1897
+ ignoreCurrentElement = false;
1898
+ }
1899
+ },
1900
+ chars: function(chars) {
1901
+ if (!ignoreCurrentElement) {
1902
+ out(encodeEntities(chars));
1903
+ }
1904
+ }
1905
+ };
1906
+ }
1907
+
1908
+
1909
+ function stripCustomNsAttrs(node) {
1910
+ while (node) {
1911
+ if (node.nodeType === window.Node.ELEMENT_NODE) {
1912
+ var attrs = node.attributes;
1913
+ for (var i = 0, l = attrs.length; i < l; i++) {
1914
+ var attrNode = attrs[i];
1915
+ var attrName = attrNode.name.toLowerCase();
1916
+ if (attrName === 'xmlns:ns1' || attrName.lastIndexOf('ns1:', 0) === 0) {
1917
+ node.removeAttributeNode(attrNode);
1918
+ i--;
1919
+ l--;
1920
+ }
1921
+ }
1922
+ }
1923
+
1924
+ var nextNode = node.firstChild;
1925
+ if (nextNode) {
1926
+ stripCustomNsAttrs(nextNode);
1927
+ }
1928
+
1929
+ node = node.nextSibling;
1930
+ }
1931
+ }
1932
+ }
1933
+
1934
+ function sanitizeText(chars) {
1935
+ var buf = [];
1936
+ var writer = htmlSanitizeWriter(buf, noop);
1937
+ writer.chars(chars);
1938
+ return buf.join('');
1939
+ }
1940
+
1941
+
1942
+ angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
1943
+
1944
+ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
1945
+ var LINKY_URL_REGEXP =
1946
+ /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
1947
+ MAILTO_REGEXP = /^mailto:/i;
1948
+
1949
+ var linkyMinErr = angular.$$minErr('linky');
1950
+ var isDefined = angular.isDefined;
1951
+ var isFunction = angular.isFunction;
1952
+ var isObject = angular.isObject;
1953
+ var isString = angular.isString;
1954
+
1955
+ return function(text, target, attributes) {
1956
+ if (text == null || text === '') return text;
1957
+ if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
1958
+
1959
+ var attributesFn =
1960
+ isFunction(attributes) ? attributes :
1961
+ isObject(attributes) ? function getAttributesObject() {return attributes;} :
1962
+ function getEmptyAttributesObject() {return {};};
1963
+
1964
+ var match;
1965
+ var raw = text;
1966
+ var html = [];
1967
+ var url;
1968
+ var i;
1969
+ while ((match = raw.match(LINKY_URL_REGEXP))) {
1970
+ url = match[0];
1971
+ if (!match[2] && !match[4]) {
1972
+ url = (match[3] ? 'http://' : 'mailto:') + url;
1973
+ }
1974
+ i = match.index;
1975
+ addText(raw.substr(0, i));
1976
+ addLink(url, match[0].replace(MAILTO_REGEXP, ''));
1977
+ raw = raw.substring(i + match[0].length);
1978
+ }
1979
+ addText(raw);
1980
+ return $sanitize(html.join(''));
1981
+
1982
+ function addText(text) {
1983
+ if (!text) {
1984
+ return;
1985
+ }
1986
+ html.push(sanitizeText(text));
1987
+ }
1988
+
1989
+ function addLink(url, text) {
1990
+ var key, linkAttributes = attributesFn(url);
1991
+ html.push('<a ');
1992
+
1993
+ for (key in linkAttributes) {
1994
+ html.push(key + '="' + linkAttributes[key] + '" ');
1995
+ }
1996
+
1997
+ if (isDefined(target) && !('target' in linkAttributes)) {
1998
+ html.push('target="',
1999
+ target,
2000
+ '" ');
2001
+ }
2002
+ html.push('href="',
2003
+ url.replace(/"/g, '&quot;'),
2004
+ '">');
2005
+ addText(text);
2006
+ html.push('</a>');
2007
+ }
2008
+ };
2009
+ }]);
2010
+
2011
+
2012
+ })(window, window.angular);
2013
+
2014
+ },{}],40:[function(require,module,exports){
2015
+ require('./angular-sanitize');
2016
+ module.exports = 'ngSanitize';
2017
+
2018
+ },{"./angular-sanitize":39}],41:[function(require,module,exports){
2019
+ (function(window) {'use strict';
2020
+
2021
+
2022
+ function minErr(module, ErrorConstructor) {
2023
+ ErrorConstructor = ErrorConstructor || Error;
2024
+ return function() {
2025
+ var SKIP_INDEXES = 2;
2026
+
2027
+ var templateArgs = arguments,
2028
+ code = templateArgs[0],
2029
+ message = '[' + (module ? module + ':' : '') + code + '] ',
2030
+ template = templateArgs[1],
2031
+ paramPrefix, i;
2032
+
2033
+ message += template.replace(/\{\d+\}/g, function(match) {
2034
+ var index = +match.slice(1, -1),
2035
+ shiftedIndex = index + SKIP_INDEXES;
2036
+
2037
+ if (shiftedIndex < templateArgs.length) {
2038
+ return toDebugString(templateArgs[shiftedIndex]);
2039
+ }
2040
+
2041
+ return match;
2042
+ });
2043
+
2044
+ message += '\nhttp://errors.angularjs.org/1.6.1/' +
2045
+ (module ? module + '/' : '') + code;
2046
+
2047
+ for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
2048
+ message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +
2049
+ encodeURIComponent(toDebugString(templateArgs[i]));
2050
+ }
2051
+
2052
+ return new ErrorConstructor(message);
2053
+ };
2054
+ }
2055
+
2056
+
2057
+
2058
+
2059
+ var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
2060
+
2061
+ var VALIDITY_STATE_PROPERTY = 'validity';
2062
+
2063
+
2064
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2065
+
2066
+ var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};
2067
+
2068
+ var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};
2069
+
2070
+
2071
+ var manualLowercase = function(s) {
2072
+ return isString(s)
2073
+ ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
2074
+ : s;
2075
+ };
2076
+ var manualUppercase = function(s) {
2077
+ return isString(s)
2078
+ ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
2079
+ : s;
2080
+ };
2081
+
2082
+
2083
+ if ('i' !== 'I'.toLowerCase()) {
2084
+ lowercase = manualLowercase;
2085
+ uppercase = manualUppercase;
2086
+ }
2087
+
2088
+
2089
+ var
2090
+ msie,
2091
+ jqLite,
2092
+ jQuery,
2093
+ slice = [].slice,
2094
+ splice = [].splice,
2095
+ push = [].push,
2096
+ toString = Object.prototype.toString,
2097
+ getPrototypeOf = Object.getPrototypeOf,
2098
+ ngMinErr = minErr('ng'),
2099
+
2100
+ angular = window.angular || (window.angular = {}),
2101
+ angularModule,
2102
+ uid = 0;
2103
+
2104
+ msie = window.document.documentMode;
2105
+
2106
+
2107
+ function isArrayLike(obj) {
2108
+
2109
+ if (obj == null || isWindow(obj)) return false;
2110
+
2111
+ if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;
2112
+
2113
+ var length = 'length' in Object(obj) && obj.length;
2114
+
2115
+ return isNumber(length) &&
2116
+ (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item === 'function');
2117
+
2118
+ }
2119
+
2120
+
2121
+ function forEach(obj, iterator, context) {
2122
+ var key, length;
2123
+ if (obj) {
2124
+ if (isFunction(obj)) {
2125
+ for (key in obj) {
2126
+ if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) {
2127
+ iterator.call(context, obj[key], key, obj);
2128
+ }
2129
+ }
2130
+ } else if (isArray(obj) || isArrayLike(obj)) {
2131
+ var isPrimitive = typeof obj !== 'object';
2132
+ for (key = 0, length = obj.length; key < length; key++) {
2133
+ if (isPrimitive || key in obj) {
2134
+ iterator.call(context, obj[key], key, obj);
2135
+ }
2136
+ }
2137
+ } else if (obj.forEach && obj.forEach !== forEach) {
2138
+ obj.forEach(iterator, context, obj);
2139
+ } else if (isBlankObject(obj)) {
2140
+ for (key in obj) {
2141
+ iterator.call(context, obj[key], key, obj);
2142
+ }
2143
+ } else if (typeof obj.hasOwnProperty === 'function') {
2144
+ for (key in obj) {
2145
+ if (obj.hasOwnProperty(key)) {
2146
+ iterator.call(context, obj[key], key, obj);
2147
+ }
2148
+ }
2149
+ } else {
2150
+ for (key in obj) {
2151
+ if (hasOwnProperty.call(obj, key)) {
2152
+ iterator.call(context, obj[key], key, obj);
2153
+ }
2154
+ }
2155
+ }
2156
+ }
2157
+ return obj;
2158
+ }
2159
+
2160
+ function forEachSorted(obj, iterator, context) {
2161
+ var keys = Object.keys(obj).sort();
2162
+ for (var i = 0; i < keys.length; i++) {
2163
+ iterator.call(context, obj[keys[i]], keys[i]);
2164
+ }
2165
+ return keys;
2166
+ }
2167
+
2168
+
2169
+ function reverseParams(iteratorFn) {
2170
+ return function(value, key) {iteratorFn(key, value);};
2171
+ }
2172
+
2173
+ function nextUid() {
2174
+ return ++uid;
2175
+ }
2176
+
2177
+
2178
+ function setHashKey(obj, h) {
2179
+ if (h) {
2180
+ obj.$$hashKey = h;
2181
+ } else {
2182
+ delete obj.$$hashKey;
2183
+ }
2184
+ }
2185
+
2186
+
2187
+ function baseExtend(dst, objs, deep) {
2188
+ var h = dst.$$hashKey;
2189
+
2190
+ for (var i = 0, ii = objs.length; i < ii; ++i) {
2191
+ var obj = objs[i];
2192
+ if (!isObject(obj) && !isFunction(obj)) continue;
2193
+ var keys = Object.keys(obj);
2194
+ for (var j = 0, jj = keys.length; j < jj; j++) {
2195
+ var key = keys[j];
2196
+ var src = obj[key];
2197
+
2198
+ if (deep && isObject(src)) {
2199
+ if (isDate(src)) {
2200
+ dst[key] = new Date(src.valueOf());
2201
+ } else if (isRegExp(src)) {
2202
+ dst[key] = new RegExp(src);
2203
+ } else if (src.nodeName) {
2204
+ dst[key] = src.cloneNode(true);
2205
+ } else if (isElement(src)) {
2206
+ dst[key] = src.clone();
2207
+ } else {
2208
+ if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
2209
+ baseExtend(dst[key], [src], true);
2210
+ }
2211
+ } else {
2212
+ dst[key] = src;
2213
+ }
2214
+ }
2215
+ }
2216
+
2217
+ setHashKey(dst, h);
2218
+ return dst;
2219
+ }
2220
+
2221
+ function extend(dst) {
2222
+ return baseExtend(dst, slice.call(arguments, 1), false);
2223
+ }
2224
+
2225
+
2226
+ function merge(dst) {
2227
+ return baseExtend(dst, slice.call(arguments, 1), true);
2228
+ }
2229
+
2230
+
2231
+
2232
+ function toInt(str) {
2233
+ return parseInt(str, 10);
2234
+ }
2235
+
2236
+ var isNumberNaN = Number.isNaN || function isNumberNaN(num) {
2237
+ return num !== num;
2238
+ };
2239
+
2240
+
2241
+ function inherit(parent, extra) {
2242
+ return extend(Object.create(parent), extra);
2243
+ }
2244
+
2245
+ function noop() {}
2246
+ noop.$inject = [];
2247
+
2248
+
2249
+ function identity($) {return $;}
2250
+ identity.$inject = [];
2251
+
2252
+
2253
+ function valueFn(value) {return function valueRef() {return value;};}
2254
+
2255
+ function hasCustomToString(obj) {
2256
+ return isFunction(obj.toString) && obj.toString !== toString;
2257
+ }
2258
+
2259
+
2260
+ function isUndefined(value) {return typeof value === 'undefined';}
2261
+
2262
+
2263
+ function isDefined(value) {return typeof value !== 'undefined';}
2264
+
2265
+
2266
+ function isObject(value) {
2267
+ return value !== null && typeof value === 'object';
2268
+ }
2269
+
2270
+
2271
+ function isBlankObject(value) {
2272
+ return value !== null && typeof value === 'object' && !getPrototypeOf(value);
2273
+ }
2274
+
2275
+
2276
+ function isString(value) {return typeof value === 'string';}
2277
+
2278
+
2279
+ function isNumber(value) {return typeof value === 'number';}
2280
+
2281
+
2282
+ function isDate(value) {
2283
+ return toString.call(value) === '[object Date]';
2284
+ }
2285
+
2286
+
2287
+ var isArray = Array.isArray;
2288
+
2289
+ function isFunction(value) {return typeof value === 'function';}
2290
+
2291
+
2292
+ function isRegExp(value) {
2293
+ return toString.call(value) === '[object RegExp]';
2294
+ }
2295
+
2296
+
2297
+ function isWindow(obj) {
2298
+ return obj && obj.window === obj;
2299
+ }
2300
+
2301
+
2302
+ function isScope(obj) {
2303
+ return obj && obj.$evalAsync && obj.$watch;
2304
+ }
2305
+
2306
+
2307
+ function isFile(obj) {
2308
+ return toString.call(obj) === '[object File]';
2309
+ }
2310
+
2311
+
2312
+ function isFormData(obj) {
2313
+ return toString.call(obj) === '[object FormData]';
2314
+ }
2315
+
2316
+
2317
+ function isBlob(obj) {
2318
+ return toString.call(obj) === '[object Blob]';
2319
+ }
2320
+
2321
+
2322
+ function isBoolean(value) {
2323
+ return typeof value === 'boolean';
2324
+ }
2325
+
2326
+
2327
+ function isPromiseLike(obj) {
2328
+ return obj && isFunction(obj.then);
2329
+ }
2330
+
2331
+
2332
+ var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/;
2333
+ function isTypedArray(value) {
2334
+ return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
2335
+ }
2336
+
2337
+ function isArrayBuffer(obj) {
2338
+ return toString.call(obj) === '[object ArrayBuffer]';
2339
+ }
2340
+
2341
+
2342
+ var trim = function(value) {
2343
+ return isString(value) ? value.trim() : value;
2344
+ };
2345
+
2346
+ var escapeForRegexp = function(s) {
2347
+ return s
2348
+ .replace(/([-()[\]{}+?*.$^|,:#<!\\])/g, '\\$1')
2349
+ .replace(/\x08/g, '\\x08');
2350
+ };
2351
+
2352
+
2353
+ function isElement(node) {
2354
+ return !!(node &&
2355
+ (node.nodeName
2356
+ || (node.prop && node.attr && node.find)));
2357
+ }
2358
+
2359
+ function makeMap(str) {
2360
+ var obj = {}, items = str.split(','), i;
2361
+ for (i = 0; i < items.length; i++) {
2362
+ obj[items[i]] = true;
2363
+ }
2364
+ return obj;
2365
+ }
2366
+
2367
+
2368
+ function nodeName_(element) {
2369
+ return lowercase(element.nodeName || (element[0] && element[0].nodeName));
2370
+ }
2371
+
2372
+ function includes(array, obj) {
2373
+ return Array.prototype.indexOf.call(array, obj) !== -1;
2374
+ }
2375
+
2376
+ function arrayRemove(array, value) {
2377
+ var index = array.indexOf(value);
2378
+ if (index >= 0) {
2379
+ array.splice(index, 1);
2380
+ }
2381
+ return index;
2382
+ }
2383
+
2384
+ function copy(source, destination) {
2385
+ var stackSource = [];
2386
+ var stackDest = [];
2387
+
2388
+ if (destination) {
2389
+ if (isTypedArray(destination) || isArrayBuffer(destination)) {
2390
+ throw ngMinErr('cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
2391
+ }
2392
+ if (source === destination) {
2393
+ throw ngMinErr('cpi', 'Can\'t copy! Source and destination are identical.');
2394
+ }
2395
+
2396
+ if (isArray(destination)) {
2397
+ destination.length = 0;
2398
+ } else {
2399
+ forEach(destination, function(value, key) {
2400
+ if (key !== '$$hashKey') {
2401
+ delete destination[key];
2402
+ }
2403
+ });
2404
+ }
2405
+
2406
+ stackSource.push(source);
2407
+ stackDest.push(destination);
2408
+ return copyRecurse(source, destination);
2409
+ }
2410
+
2411
+ return copyElement(source);
2412
+
2413
+ function copyRecurse(source, destination) {
2414
+ var h = destination.$$hashKey;
2415
+ var key;
2416
+ if (isArray(source)) {
2417
+ for (var i = 0, ii = source.length; i < ii; i++) {
2418
+ destination.push(copyElement(source[i]));
2419
+ }
2420
+ } else if (isBlankObject(source)) {
2421
+ for (key in source) {
2422
+ destination[key] = copyElement(source[key]);
2423
+ }
2424
+ } else if (source && typeof source.hasOwnProperty === 'function') {
2425
+ for (key in source) {
2426
+ if (source.hasOwnProperty(key)) {
2427
+ destination[key] = copyElement(source[key]);
2428
+ }
2429
+ }
2430
+ } else {
2431
+ for (key in source) {
2432
+ if (hasOwnProperty.call(source, key)) {
2433
+ destination[key] = copyElement(source[key]);
2434
+ }
2435
+ }
2436
+ }
2437
+ setHashKey(destination, h);
2438
+ return destination;
2439
+ }
2440
+
2441
+ function copyElement(source) {
2442
+ if (!isObject(source)) {
2443
+ return source;
2444
+ }
2445
+
2446
+ var index = stackSource.indexOf(source);
2447
+ if (index !== -1) {
2448
+ return stackDest[index];
2449
+ }
2450
+
2451
+ if (isWindow(source) || isScope(source)) {
2452
+ throw ngMinErr('cpws',
2453
+ 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
2454
+ }
2455
+
2456
+ var needsRecurse = false;
2457
+ var destination = copyType(source);
2458
+
2459
+ if (destination === undefined) {
2460
+ destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
2461
+ needsRecurse = true;
2462
+ }
2463
+
2464
+ stackSource.push(source);
2465
+ stackDest.push(destination);
2466
+
2467
+ return needsRecurse
2468
+ ? copyRecurse(source, destination)
2469
+ : destination;
2470
+ }
2471
+
2472
+ function copyType(source) {
2473
+ switch (toString.call(source)) {
2474
+ case '[object Int8Array]':
2475
+ case '[object Int16Array]':
2476
+ case '[object Int32Array]':
2477
+ case '[object Float32Array]':
2478
+ case '[object Float64Array]':
2479
+ case '[object Uint8Array]':
2480
+ case '[object Uint8ClampedArray]':
2481
+ case '[object Uint16Array]':
2482
+ case '[object Uint32Array]':
2483
+ return new source.constructor(copyElement(source.buffer), source.byteOffset, source.length);
2484
+
2485
+ case '[object ArrayBuffer]':
2486
+ if (!source.slice) {
2487
+ var copied = new ArrayBuffer(source.byteLength);
2488
+ new Uint8Array(copied).set(new Uint8Array(source));
2489
+ return copied;
2490
+ }
2491
+ return source.slice(0);
2492
+
2493
+ case '[object Boolean]':
2494
+ case '[object Number]':
2495
+ case '[object String]':
2496
+ case '[object Date]':
2497
+ return new source.constructor(source.valueOf());
2498
+
2499
+ case '[object RegExp]':
2500
+ var re = new RegExp(source.source, source.toString().match(/[^/]*$/)[0]);
2501
+ re.lastIndex = source.lastIndex;
2502
+ return re;
2503
+
2504
+ case '[object Blob]':
2505
+ return new source.constructor([source], {type: source.type});
2506
+ }
2507
+
2508
+ if (isFunction(source.cloneNode)) {
2509
+ return source.cloneNode(true);
2510
+ }
2511
+ }
2512
+ }
2513
+
2514
+
2515
+ function equals(o1, o2) {
2516
+ if (o1 === o2) return true;
2517
+ if (o1 === null || o2 === null) return false;
2518
+ if (o1 !== o1 && o2 !== o2) return true;
2519
+ var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
2520
+ if (t1 === t2 && t1 === 'object') {
2521
+ if (isArray(o1)) {
2522
+ if (!isArray(o2)) return false;
2523
+ if ((length = o1.length) === o2.length) {
2524
+ for (key = 0; key < length; key++) {
2525
+ if (!equals(o1[key], o2[key])) return false;
2526
+ }
2527
+ return true;
2528
+ }
2529
+ } else if (isDate(o1)) {
2530
+ if (!isDate(o2)) return false;
2531
+ return equals(o1.getTime(), o2.getTime());
2532
+ } else if (isRegExp(o1)) {
2533
+ if (!isRegExp(o2)) return false;
2534
+ return o1.toString() === o2.toString();
2535
+ } else {
2536
+ if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
2537
+ isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
2538
+ keySet = createMap();
2539
+ for (key in o1) {
2540
+ if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
2541
+ if (!equals(o1[key], o2[key])) return false;
2542
+ keySet[key] = true;
2543
+ }
2544
+ for (key in o2) {
2545
+ if (!(key in keySet) &&
2546
+ key.charAt(0) !== '$' &&
2547
+ isDefined(o2[key]) &&
2548
+ !isFunction(o2[key])) return false;
2549
+ }
2550
+ return true;
2551
+ }
2552
+ }
2553
+ return false;
2554
+ }
2555
+
2556
+ var csp = function() {
2557
+ if (!isDefined(csp.rules)) {
2558
+
2559
+
2560
+ var ngCspElement = (window.document.querySelector('[ng-csp]') ||
2561
+ window.document.querySelector('[data-ng-csp]'));
2562
+
2563
+ if (ngCspElement) {
2564
+ var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
2565
+ ngCspElement.getAttribute('data-ng-csp');
2566
+ csp.rules = {
2567
+ noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
2568
+ noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
2569
+ };
2570
+ } else {
2571
+ csp.rules = {
2572
+ noUnsafeEval: noUnsafeEval(),
2573
+ noInlineStyle: false
2574
+ };
2575
+ }
2576
+ }
2577
+
2578
+ return csp.rules;
2579
+
2580
+ function noUnsafeEval() {
2581
+ try {
2582
+ new Function('');
2583
+ return false;
2584
+ } catch (e) {
2585
+ return true;
2586
+ }
2587
+ }
2588
+ };
2589
+
2590
+ var jq = function() {
2591
+ if (isDefined(jq.name_)) return jq.name_;
2592
+ var el;
2593
+ var i, ii = ngAttrPrefixes.length, prefix, name;
2594
+ for (i = 0; i < ii; ++i) {
2595
+ prefix = ngAttrPrefixes[i];
2596
+ el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]');
2597
+ if (el) {
2598
+ name = el.getAttribute(prefix + 'jq');
2599
+ break;
2600
+ }
2601
+ }
2602
+
2603
+ return (jq.name_ = name);
2604
+ };
2605
+
2606
+ function concat(array1, array2, index) {
2607
+ return array1.concat(slice.call(array2, index));
2608
+ }
2609
+
2610
+ function sliceArgs(args, startIndex) {
2611
+ return slice.call(args, startIndex || 0);
2612
+ }
2613
+
2614
+
2615
+ function bind(self, fn) {
2616
+ var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
2617
+ if (isFunction(fn) && !(fn instanceof RegExp)) {
2618
+ return curryArgs.length
2619
+ ? function() {
2620
+ return arguments.length
2621
+ ? fn.apply(self, concat(curryArgs, arguments, 0))
2622
+ : fn.apply(self, curryArgs);
2623
+ }
2624
+ : function() {
2625
+ return arguments.length
2626
+ ? fn.apply(self, arguments)
2627
+ : fn.call(self);
2628
+ };
2629
+ } else {
2630
+ return fn;
2631
+ }
2632
+ }
2633
+
2634
+
2635
+ function toJsonReplacer(key, value) {
2636
+ var val = value;
2637
+
2638
+ if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
2639
+ val = undefined;
2640
+ } else if (isWindow(value)) {
2641
+ val = '$WINDOW';
2642
+ } else if (value && window.document === value) {
2643
+ val = '$DOCUMENT';
2644
+ } else if (isScope(value)) {
2645
+ val = '$SCOPE';
2646
+ }
2647
+
2648
+ return val;
2649
+ }
2650
+
2651
+
2652
+ function toJson(obj, pretty) {
2653
+ if (isUndefined(obj)) return undefined;
2654
+ if (!isNumber(pretty)) {
2655
+ pretty = pretty ? 2 : null;
2656
+ }
2657
+ return JSON.stringify(obj, toJsonReplacer, pretty);
2658
+ }
2659
+
2660
+
2661
+ function fromJson(json) {
2662
+ return isString(json)
2663
+ ? JSON.parse(json)
2664
+ : json;
2665
+ }
2666
+
2667
+
2668
+ var ALL_COLONS = /:/g;
2669
+ function timezoneToOffset(timezone, fallback) {
2670
+ timezone = timezone.replace(ALL_COLONS, '');
2671
+ var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
2672
+ return isNumberNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
2673
+ }
2674
+
2675
+
2676
+ function addDateMinutes(date, minutes) {
2677
+ date = new Date(date.getTime());
2678
+ date.setMinutes(date.getMinutes() + minutes);
2679
+ return date;
2680
+ }
2681
+
2682
+
2683
+ function convertTimezoneToLocal(date, timezone, reverse) {
2684
+ reverse = reverse ? -1 : 1;
2685
+ var dateTimezoneOffset = date.getTimezoneOffset();
2686
+ var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
2687
+ return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));
2688
+ }
2689
+
2690
+
2691
+ function startingTag(element) {
2692
+ element = jqLite(element).clone();
2693
+ try {
2694
+ element.empty();
2695
+ } catch (e) { }
2696
+ var elemHtml = jqLite('<div>').append(element).html();
2697
+ try {
2698
+ return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
2699
+ elemHtml.
2700
+ match(/^(<[^>]+>)/)[1].
2701
+ replace(/^<([\w-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
2702
+ } catch (e) {
2703
+ return lowercase(elemHtml);
2704
+ }
2705
+
2706
+ }
2707
+
2708
+
2709
+
2710
+ function tryDecodeURIComponent(value) {
2711
+ try {
2712
+ return decodeURIComponent(value);
2713
+ } catch (e) {
2714
+ }
2715
+ }
2716
+
2717
+
2718
+ function parseKeyValue(keyValue) {
2719
+ var obj = {};
2720
+ forEach((keyValue || '').split('&'), function(keyValue) {
2721
+ var splitPoint, key, val;
2722
+ if (keyValue) {
2723
+ key = keyValue = keyValue.replace(/\+/g,'%20');
2724
+ splitPoint = keyValue.indexOf('=');
2725
+ if (splitPoint !== -1) {
2726
+ key = keyValue.substring(0, splitPoint);
2727
+ val = keyValue.substring(splitPoint + 1);
2728
+ }
2729
+ key = tryDecodeURIComponent(key);
2730
+ if (isDefined(key)) {
2731
+ val = isDefined(val) ? tryDecodeURIComponent(val) : true;
2732
+ if (!hasOwnProperty.call(obj, key)) {
2733
+ obj[key] = val;
2734
+ } else if (isArray(obj[key])) {
2735
+ obj[key].push(val);
2736
+ } else {
2737
+ obj[key] = [obj[key],val];
2738
+ }
2739
+ }
2740
+ }
2741
+ });
2742
+ return obj;
2743
+ }
2744
+
2745
+ function toKeyValue(obj) {
2746
+ var parts = [];
2747
+ forEach(obj, function(value, key) {
2748
+ if (isArray(value)) {
2749
+ forEach(value, function(arrayValue) {
2750
+ parts.push(encodeUriQuery(key, true) +
2751
+ (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));
2752
+ });
2753
+ } else {
2754
+ parts.push(encodeUriQuery(key, true) +
2755
+ (value === true ? '' : '=' + encodeUriQuery(value, true)));
2756
+ }
2757
+ });
2758
+ return parts.length ? parts.join('&') : '';
2759
+ }
2760
+
2761
+
2762
+ function encodeUriSegment(val) {
2763
+ return encodeUriQuery(val, true).
2764
+ replace(/%26/gi, '&').
2765
+ replace(/%3D/gi, '=').
2766
+ replace(/%2B/gi, '+');
2767
+ }
2768
+
2769
+
2770
+ function encodeUriQuery(val, pctEncodeSpaces) {
2771
+ return encodeURIComponent(val).
2772
+ replace(/%40/gi, '@').
2773
+ replace(/%3A/gi, ':').
2774
+ replace(/%24/g, '$').
2775
+ replace(/%2C/gi, ',').
2776
+ replace(/%3B/gi, ';').
2777
+ replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
2778
+ }
2779
+
2780
+ var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
2781
+
2782
+ function getNgAttribute(element, ngAttr) {
2783
+ var attr, i, ii = ngAttrPrefixes.length;
2784
+ for (i = 0; i < ii; ++i) {
2785
+ attr = ngAttrPrefixes[i] + ngAttr;
2786
+ if (isString(attr = element.getAttribute(attr))) {
2787
+ return attr;
2788
+ }
2789
+ }
2790
+ return null;
2791
+ }
2792
+
2793
+ function allowAutoBootstrap(document) {
2794
+ if (!document.currentScript) {
2795
+ return true;
2796
+ }
2797
+ var src = document.currentScript.getAttribute('src');
2798
+ var link = document.createElement('a');
2799
+ link.href = src;
2800
+ if (document.location.origin === link.origin) {
2801
+ return true;
2802
+ }
2803
+ switch (link.protocol) {
2804
+ case 'http:':
2805
+ case 'https:':
2806
+ case 'ftp:':
2807
+ case 'blob:':
2808
+ case 'file:':
2809
+ case 'data:':
2810
+ return true;
2811
+ default:
2812
+ return false;
2813
+ }
2814
+ }
2815
+
2816
+ var isAutoBootstrapAllowed = allowAutoBootstrap(window.document);
2817
+
2818
+ function angularInit(element, bootstrap) {
2819
+ var appElement,
2820
+ module,
2821
+ config = {};
2822
+
2823
+ forEach(ngAttrPrefixes, function(prefix) {
2824
+ var name = prefix + 'app';
2825
+
2826
+ if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
2827
+ appElement = element;
2828
+ module = element.getAttribute(name);
2829
+ }
2830
+ });
2831
+ forEach(ngAttrPrefixes, function(prefix) {
2832
+ var name = prefix + 'app';
2833
+ var candidate;
2834
+
2835
+ if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
2836
+ appElement = candidate;
2837
+ module = candidate.getAttribute(name);
2838
+ }
2839
+ });
2840
+ if (appElement) {
2841
+ if (!isAutoBootstrapAllowed) {
2842
+ window.console.error('Angular: disabling automatic bootstrap. <script> protocol indicates ' +
2843
+ 'an extension, document.location.href does not match.');
2844
+ return;
2845
+ }
2846
+ config.strictDi = getNgAttribute(appElement, 'strict-di') !== null;
2847
+ bootstrap(appElement, module ? [module] : [], config);
2848
+ }
2849
+ }
2850
+
2851
+ function bootstrap(element, modules, config) {
2852
+ if (!isObject(config)) config = {};
2853
+ var defaultConfig = {
2854
+ strictDi: false
2855
+ };
2856
+ config = extend(defaultConfig, config);
2857
+ var doBootstrap = function() {
2858
+ element = jqLite(element);
2859
+
2860
+ if (element.injector()) {
2861
+ var tag = (element[0] === window.document) ? 'document' : startingTag(element);
2862
+ throw ngMinErr(
2863
+ 'btstrpd',
2864
+ 'App already bootstrapped with this element \'{0}\'',
2865
+ tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
2866
+ }
2867
+
2868
+ modules = modules || [];
2869
+ modules.unshift(['$provide', function($provide) {
2870
+ $provide.value('$rootElement', element);
2871
+ }]);
2872
+
2873
+ if (config.debugInfoEnabled) {
2874
+ modules.push(['$compileProvider', function($compileProvider) {
2875
+ $compileProvider.debugInfoEnabled(true);
2876
+ }]);
2877
+ }
2878
+
2879
+ modules.unshift('ng');
2880
+ var injector = createInjector(modules, config.strictDi);
2881
+ injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
2882
+ function bootstrapApply(scope, element, compile, injector) {
2883
+ scope.$apply(function() {
2884
+ element.data('$injector', injector);
2885
+ compile(element)(scope);
2886
+ });
2887
+ }]
2888
+ );
2889
+ return injector;
2890
+ };
2891
+
2892
+ var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
2893
+ var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
2894
+
2895
+ if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
2896
+ config.debugInfoEnabled = true;
2897
+ window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
2898
+ }
2899
+
2900
+ if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
2901
+ return doBootstrap();
2902
+ }
2903
+
2904
+ window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
2905
+ angular.resumeBootstrap = function(extraModules) {
2906
+ forEach(extraModules, function(module) {
2907
+ modules.push(module);
2908
+ });
2909
+ return doBootstrap();
2910
+ };
2911
+
2912
+ if (isFunction(angular.resumeDeferredBootstrap)) {
2913
+ angular.resumeDeferredBootstrap();
2914
+ }
2915
+ }
2916
+
2917
+ function reloadWithDebugInfo() {
2918
+ window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;
2919
+ window.location.reload();
2920
+ }
2921
+
2922
+ function getTestability(rootElement) {
2923
+ var injector = angular.element(rootElement).injector();
2924
+ if (!injector) {
2925
+ throw ngMinErr('test',
2926
+ 'no injector found for element argument to getTestability');
2927
+ }
2928
+ return injector.get('$$testability');
2929
+ }
2930
+
2931
+ var SNAKE_CASE_REGEXP = /[A-Z]/g;
2932
+ function snake_case(name, separator) {
2933
+ separator = separator || '_';
2934
+ return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
2935
+ return (pos ? separator : '') + letter.toLowerCase();
2936
+ });
2937
+ }
2938
+
2939
+ var bindJQueryFired = false;
2940
+ function bindJQuery() {
2941
+ var originalCleanData;
2942
+
2943
+ if (bindJQueryFired) {
2944
+ return;
2945
+ }
2946
+
2947
+ var jqName = jq();
2948
+ jQuery = isUndefined(jqName) ? window.jQuery :
2949
+ !jqName ? undefined :
2950
+ window[jqName];
2951
+
2952
+ if (jQuery && jQuery.fn.on) {
2953
+ jqLite = jQuery;
2954
+ extend(jQuery.fn, {
2955
+ scope: JQLitePrototype.scope,
2956
+ isolateScope: JQLitePrototype.isolateScope,
2957
+ controller: JQLitePrototype.controller,
2958
+ injector: JQLitePrototype.injector,
2959
+ inheritedData: JQLitePrototype.inheritedData
2960
+ });
2961
+
2962
+ originalCleanData = jQuery.cleanData;
2963
+ jQuery.cleanData = function(elems) {
2964
+ var events;
2965
+ for (var i = 0, elem; (elem = elems[i]) != null; i++) {
2966
+ events = jQuery._data(elem, 'events');
2967
+ if (events && events.$destroy) {
2968
+ jQuery(elem).triggerHandler('$destroy');
2969
+ }
2970
+ }
2971
+ originalCleanData(elems);
2972
+ };
2973
+ } else {
2974
+ jqLite = JQLite;
2975
+ }
2976
+
2977
+ angular.element = jqLite;
2978
+
2979
+ bindJQueryFired = true;
2980
+ }
2981
+
2982
+ function assertArg(arg, name, reason) {
2983
+ if (!arg) {
2984
+ throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required'));
2985
+ }
2986
+ return arg;
2987
+ }
2988
+
2989
+ function assertArgFn(arg, name, acceptArrayAnnotation) {
2990
+ if (acceptArrayAnnotation && isArray(arg)) {
2991
+ arg = arg[arg.length - 1];
2992
+ }
2993
+
2994
+ assertArg(isFunction(arg), name, 'not a function, got ' +
2995
+ (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));
2996
+ return arg;
2997
+ }
2998
+
2999
+ function assertNotHasOwnProperty(name, context) {
3000
+ if (name === 'hasOwnProperty') {
3001
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
3002
+ }
3003
+ }
3004
+
3005
+ function getter(obj, path, bindFnToScope) {
3006
+ if (!path) return obj;
3007
+ var keys = path.split('.');
3008
+ var key;
3009
+ var lastInstance = obj;
3010
+ var len = keys.length;
3011
+
3012
+ for (var i = 0; i < len; i++) {
3013
+ key = keys[i];
3014
+ if (obj) {
3015
+ obj = (lastInstance = obj)[key];
3016
+ }
3017
+ }
3018
+ if (!bindFnToScope && isFunction(obj)) {
3019
+ return bind(lastInstance, obj);
3020
+ }
3021
+ return obj;
3022
+ }
3023
+
3024
+ function getBlockNodes(nodes) {
3025
+ var node = nodes[0];
3026
+ var endNode = nodes[nodes.length - 1];
3027
+ var blockNodes;
3028
+
3029
+ for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {
3030
+ if (blockNodes || nodes[i] !== node) {
3031
+ if (!blockNodes) {
3032
+ blockNodes = jqLite(slice.call(nodes, 0, i));
3033
+ }
3034
+ blockNodes.push(node);
3035
+ }
3036
+ }
3037
+
3038
+ return blockNodes || nodes;
3039
+ }
3040
+
3041
+
3042
+ function createMap() {
3043
+ return Object.create(null);
3044
+ }
3045
+
3046
+ function stringify(value) {
3047
+ if (value == null) {
3048
+ return '';
3049
+ }
3050
+ switch (typeof value) {
3051
+ case 'string':
3052
+ break;
3053
+ case 'number':
3054
+ value = '' + value;
3055
+ break;
3056
+ default:
3057
+ if (hasCustomToString(value) && !isArray(value) && !isDate(value)) {
3058
+ value = value.toString();
3059
+ } else {
3060
+ value = toJson(value);
3061
+ }
3062
+ }
3063
+
3064
+ return value;
3065
+ }
3066
+
3067
+ var NODE_TYPE_ELEMENT = 1;
3068
+ var NODE_TYPE_ATTRIBUTE = 2;
3069
+ var NODE_TYPE_TEXT = 3;
3070
+ var NODE_TYPE_COMMENT = 8;
3071
+ var NODE_TYPE_DOCUMENT = 9;
3072
+ var NODE_TYPE_DOCUMENT_FRAGMENT = 11;
3073
+
3074
+
3075
+ function setupModuleLoader(window) {
3076
+
3077
+ var $injectorMinErr = minErr('$injector');
3078
+ var ngMinErr = minErr('ng');
3079
+
3080
+ function ensure(obj, name, factory) {
3081
+ return obj[name] || (obj[name] = factory());
3082
+ }
3083
+
3084
+ var angular = ensure(window, 'angular', Object);
3085
+
3086
+ angular.$$minErr = angular.$$minErr || minErr;
3087
+
3088
+ return ensure(angular, 'module', function() {
3089
+ var modules = {};
3090
+
3091
+ return function module(name, requires, configFn) {
3092
+ var assertNotHasOwnProperty = function(name, context) {
3093
+ if (name === 'hasOwnProperty') {
3094
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
3095
+ }
3096
+ };
3097
+
3098
+ assertNotHasOwnProperty(name, 'module');
3099
+ if (requires && modules.hasOwnProperty(name)) {
3100
+ modules[name] = null;
3101
+ }
3102
+ return ensure(modules, name, function() {
3103
+ if (!requires) {
3104
+ throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' +
3105
+ 'the module name or forgot to load it. If registering a module ensure that you ' +
3106
+ 'specify the dependencies as the second argument.', name);
3107
+ }
3108
+
3109
+ var invokeQueue = [];
3110
+
3111
+ var configBlocks = [];
3112
+
3113
+ var runBlocks = [];
3114
+
3115
+ var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
3116
+
3117
+ var moduleInstance = {
3118
+ _invokeQueue: invokeQueue,
3119
+ _configBlocks: configBlocks,
3120
+ _runBlocks: runBlocks,
3121
+
3122
+ requires: requires,
3123
+
3124
+ name: name,
3125
+
3126
+
3127
+ provider: invokeLaterAndSetModuleName('$provide', 'provider'),
3128
+
3129
+ factory: invokeLaterAndSetModuleName('$provide', 'factory'),
3130
+
3131
+ service: invokeLaterAndSetModuleName('$provide', 'service'),
3132
+
3133
+ value: invokeLater('$provide', 'value'),
3134
+
3135
+ constant: invokeLater('$provide', 'constant', 'unshift'),
3136
+
3137
+ decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks),
3138
+
3139
+ animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
3140
+
3141
+ filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
3142
+
3143
+ controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
3144
+
3145
+ directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
3146
+
3147
+ component: invokeLaterAndSetModuleName('$compileProvider', 'component'),
3148
+
3149
+ config: config,
3150
+
3151
+ run: function(block) {
3152
+ runBlocks.push(block);
3153
+ return this;
3154
+ }
3155
+ };
3156
+
3157
+ if (configFn) {
3158
+ config(configFn);
3159
+ }
3160
+
3161
+ return moduleInstance;
3162
+
3163
+ function invokeLater(provider, method, insertMethod, queue) {
3164
+ if (!queue) queue = invokeQueue;
3165
+ return function() {
3166
+ queue[insertMethod || 'push']([provider, method, arguments]);
3167
+ return moduleInstance;
3168
+ };
3169
+ }
3170
+
3171
+ function invokeLaterAndSetModuleName(provider, method, queue) {
3172
+ if (!queue) queue = invokeQueue;
3173
+ return function(recipeName, factoryFunction) {
3174
+ if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
3175
+ queue.push([provider, method, arguments]);
3176
+ return moduleInstance;
3177
+ };
3178
+ }
3179
+ });
3180
+ };
3181
+ });
3182
+
3183
+ }
3184
+
3185
+
3186
+ function shallowCopy(src, dst) {
3187
+ if (isArray(src)) {
3188
+ dst = dst || [];
3189
+
3190
+ for (var i = 0, ii = src.length; i < ii; i++) {
3191
+ dst[i] = src[i];
3192
+ }
3193
+ } else if (isObject(src)) {
3194
+ dst = dst || {};
3195
+
3196
+ for (var key in src) {
3197
+ if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
3198
+ dst[key] = src[key];
3199
+ }
3200
+ }
3201
+ }
3202
+
3203
+ return dst || src;
3204
+ }
3205
+
3206
+
3207
+ function serializeObject(obj) {
3208
+ var seen = [];
3209
+
3210
+ return JSON.stringify(obj, function(key, val) {
3211
+ val = toJsonReplacer(key, val);
3212
+ if (isObject(val)) {
3213
+
3214
+ if (seen.indexOf(val) >= 0) return '...';
3215
+
3216
+ seen.push(val);
3217
+ }
3218
+ return val;
3219
+ });
3220
+ }
3221
+
3222
+ function toDebugString(obj) {
3223
+ if (typeof obj === 'function') {
3224
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
3225
+ } else if (isUndefined(obj)) {
3226
+ return 'undefined';
3227
+ } else if (typeof obj !== 'string') {
3228
+ return serializeObject(obj);
3229
+ }
3230
+ return obj;
3231
+ }
3232
+
3233
+
3234
+
3235
+ var version = {
3236
+ full: '1.6.1',
3237
+ major: 1,
3238
+ minor: 6,
3239
+ dot: 1,
3240
+ codeName: 'promise-rectification'
3241
+ };
3242
+
3243
+
3244
+ function publishExternalAPI(angular) {
3245
+ extend(angular, {
3246
+ 'bootstrap': bootstrap,
3247
+ 'copy': copy,
3248
+ 'extend': extend,
3249
+ 'merge': merge,
3250
+ 'equals': equals,
3251
+ 'element': jqLite,
3252
+ 'forEach': forEach,
3253
+ 'injector': createInjector,
3254
+ 'noop': noop,
3255
+ 'bind': bind,
3256
+ 'toJson': toJson,
3257
+ 'fromJson': fromJson,
3258
+ 'identity': identity,
3259
+ 'isUndefined': isUndefined,
3260
+ 'isDefined': isDefined,
3261
+ 'isString': isString,
3262
+ 'isFunction': isFunction,
3263
+ 'isObject': isObject,
3264
+ 'isNumber': isNumber,
3265
+ 'isElement': isElement,
3266
+ 'isArray': isArray,
3267
+ 'version': version,
3268
+ 'isDate': isDate,
3269
+ 'lowercase': lowercase,
3270
+ 'uppercase': uppercase,
3271
+ 'callbacks': {$$counter: 0},
3272
+ 'getTestability': getTestability,
3273
+ 'reloadWithDebugInfo': reloadWithDebugInfo,
3274
+ '$$minErr': minErr,
3275
+ '$$csp': csp,
3276
+ '$$encodeUriSegment': encodeUriSegment,
3277
+ '$$encodeUriQuery': encodeUriQuery,
3278
+ '$$stringify': stringify
3279
+ });
3280
+
3281
+ angularModule = setupModuleLoader(window);
3282
+
3283
+ angularModule('ng', ['ngLocale'], ['$provide',
3284
+ function ngModule($provide) {
3285
+ $provide.provider({
3286
+ $$sanitizeUri: $$SanitizeUriProvider
3287
+ });
3288
+ $provide.provider('$compile', $CompileProvider).
3289
+ directive({
3290
+ a: htmlAnchorDirective,
3291
+ input: inputDirective,
3292
+ textarea: inputDirective,
3293
+ form: formDirective,
3294
+ script: scriptDirective,
3295
+ select: selectDirective,
3296
+ option: optionDirective,
3297
+ ngBind: ngBindDirective,
3298
+ ngBindHtml: ngBindHtmlDirective,
3299
+ ngBindTemplate: ngBindTemplateDirective,
3300
+ ngClass: ngClassDirective,
3301
+ ngClassEven: ngClassEvenDirective,
3302
+ ngClassOdd: ngClassOddDirective,
3303
+ ngCloak: ngCloakDirective,
3304
+ ngController: ngControllerDirective,
3305
+ ngForm: ngFormDirective,
3306
+ ngHide: ngHideDirective,
3307
+ ngIf: ngIfDirective,
3308
+ ngInclude: ngIncludeDirective,
3309
+ ngInit: ngInitDirective,
3310
+ ngNonBindable: ngNonBindableDirective,
3311
+ ngPluralize: ngPluralizeDirective,
3312
+ ngRepeat: ngRepeatDirective,
3313
+ ngShow: ngShowDirective,
3314
+ ngStyle: ngStyleDirective,
3315
+ ngSwitch: ngSwitchDirective,
3316
+ ngSwitchWhen: ngSwitchWhenDirective,
3317
+ ngSwitchDefault: ngSwitchDefaultDirective,
3318
+ ngOptions: ngOptionsDirective,
3319
+ ngTransclude: ngTranscludeDirective,
3320
+ ngModel: ngModelDirective,
3321
+ ngList: ngListDirective,
3322
+ ngChange: ngChangeDirective,
3323
+ pattern: patternDirective,
3324
+ ngPattern: patternDirective,
3325
+ required: requiredDirective,
3326
+ ngRequired: requiredDirective,
3327
+ minlength: minlengthDirective,
3328
+ ngMinlength: minlengthDirective,
3329
+ maxlength: maxlengthDirective,
3330
+ ngMaxlength: maxlengthDirective,
3331
+ ngValue: ngValueDirective,
3332
+ ngModelOptions: ngModelOptionsDirective
3333
+ }).
3334
+ directive({
3335
+ ngInclude: ngIncludeFillContentDirective
3336
+ }).
3337
+ directive(ngAttributeAliasDirectives).
3338
+ directive(ngEventDirectives);
3339
+ $provide.provider({
3340
+ $anchorScroll: $AnchorScrollProvider,
3341
+ $animate: $AnimateProvider,
3342
+ $animateCss: $CoreAnimateCssProvider,
3343
+ $$animateJs: $$CoreAnimateJsProvider,
3344
+ $$animateQueue: $$CoreAnimateQueueProvider,
3345
+ $$AnimateRunner: $$AnimateRunnerFactoryProvider,
3346
+ $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,
3347
+ $browser: $BrowserProvider,
3348
+ $cacheFactory: $CacheFactoryProvider,
3349
+ $controller: $ControllerProvider,
3350
+ $document: $DocumentProvider,
3351
+ $$isDocumentHidden: $$IsDocumentHiddenProvider,
3352
+ $exceptionHandler: $ExceptionHandlerProvider,
3353
+ $filter: $FilterProvider,
3354
+ $$forceReflow: $$ForceReflowProvider,
3355
+ $interpolate: $InterpolateProvider,
3356
+ $interval: $IntervalProvider,
3357
+ $http: $HttpProvider,
3358
+ $httpParamSerializer: $HttpParamSerializerProvider,
3359
+ $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
3360
+ $httpBackend: $HttpBackendProvider,
3361
+ $xhrFactory: $xhrFactoryProvider,
3362
+ $jsonpCallbacks: $jsonpCallbacksProvider,
3363
+ $location: $LocationProvider,
3364
+ $log: $LogProvider,
3365
+ $parse: $ParseProvider,
3366
+ $rootScope: $RootScopeProvider,
3367
+ $q: $QProvider,
3368
+ $$q: $$QProvider,
3369
+ $sce: $SceProvider,
3370
+ $sceDelegate: $SceDelegateProvider,
3371
+ $sniffer: $SnifferProvider,
3372
+ $templateCache: $TemplateCacheProvider,
3373
+ $templateRequest: $TemplateRequestProvider,
3374
+ $$testability: $$TestabilityProvider,
3375
+ $timeout: $TimeoutProvider,
3376
+ $window: $WindowProvider,
3377
+ $$rAF: $$RAFProvider,
3378
+ $$jqLite: $$jqLiteProvider,
3379
+ $$HashMap: $$HashMapProvider,
3380
+ $$cookieReader: $$CookieReaderProvider
3381
+ });
3382
+ }
3383
+ ]);
3384
+ }
3385
+
3386
+
3387
+
3388
+
3389
+
3390
+ JQLite.expando = 'ng339';
3391
+
3392
+ var jqCache = JQLite.cache = {},
3393
+ jqId = 1;
3394
+
3395
+ JQLite._data = function(node) {
3396
+ return this.cache[node[this.expando]] || {};
3397
+ };
3398
+
3399
+ function jqNextId() { return ++jqId; }
3400
+
3401
+
3402
+ var DASH_LOWERCASE_REGEXP = /-([a-z])/g;
3403
+ var MS_HACK_REGEXP = /^-ms-/;
3404
+ var MOUSE_EVENT_MAP = { mouseleave: 'mouseout', mouseenter: 'mouseover' };
3405
+ var jqLiteMinErr = minErr('jqLite');
3406
+
3407
+ function cssKebabToCamel(name) {
3408
+ return kebabToCamel(name.replace(MS_HACK_REGEXP, 'ms-'));
3409
+ }
3410
+
3411
+ function fnCamelCaseReplace(all, letter) {
3412
+ return letter.toUpperCase();
3413
+ }
3414
+
3415
+ function kebabToCamel(name) {
3416
+ return name
3417
+ .replace(DASH_LOWERCASE_REGEXP, fnCamelCaseReplace);
3418
+ }
3419
+
3420
+ var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;
3421
+ var HTML_REGEXP = /<|&#?\w+;/;
3422
+ var TAG_NAME_REGEXP = /<([\w:-]+)/;
3423
+ var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi;
3424
+
3425
+ var wrapMap = {
3426
+ 'option': [1, '<select multiple="multiple">', '</select>'],
3427
+
3428
+ 'thead': [1, '<table>', '</table>'],
3429
+ 'col': [2, '<table><colgroup>', '</colgroup></table>'],
3430
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
3431
+ 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
3432
+ '_default': [0, '', '']
3433
+ };
3434
+
3435
+ wrapMap.optgroup = wrapMap.option;
3436
+ wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
3437
+ wrapMap.th = wrapMap.td;
3438
+
3439
+
3440
+ function jqLiteIsTextNode(html) {
3441
+ return !HTML_REGEXP.test(html);
3442
+ }
3443
+
3444
+ function jqLiteAcceptsData(node) {
3445
+ var nodeType = node.nodeType;
3446
+ return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
3447
+ }
3448
+
3449
+ function jqLiteHasData(node) {
3450
+ for (var key in jqCache[node.ng339]) {
3451
+ return true;
3452
+ }
3453
+ return false;
3454
+ }
3455
+
3456
+ function jqLiteCleanData(nodes) {
3457
+ for (var i = 0, ii = nodes.length; i < ii; i++) {
3458
+ jqLiteRemoveData(nodes[i]);
3459
+ }
3460
+ }
3461
+
3462
+ function jqLiteBuildFragment(html, context) {
3463
+ var tmp, tag, wrap,
3464
+ fragment = context.createDocumentFragment(),
3465
+ nodes = [], i;
3466
+
3467
+ if (jqLiteIsTextNode(html)) {
3468
+ nodes.push(context.createTextNode(html));
3469
+ } else {
3470
+ tmp = fragment.appendChild(context.createElement('div'));
3471
+ tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();
3472
+ wrap = wrapMap[tag] || wrapMap._default;
3473
+ tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2];
3474
+
3475
+ i = wrap[0];
3476
+ while (i--) {
3477
+ tmp = tmp.lastChild;
3478
+ }
3479
+
3480
+ nodes = concat(nodes, tmp.childNodes);
3481
+
3482
+ tmp = fragment.firstChild;
3483
+ tmp.textContent = '';
3484
+ }
3485
+
3486
+ fragment.textContent = '';
3487
+ fragment.innerHTML = '';
3488
+ forEach(nodes, function(node) {
3489
+ fragment.appendChild(node);
3490
+ });
3491
+
3492
+ return fragment;
3493
+ }
3494
+
3495
+ function jqLiteParseHTML(html, context) {
3496
+ context = context || window.document;
3497
+ var parsed;
3498
+
3499
+ if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
3500
+ return [context.createElement(parsed[1])];
3501
+ }
3502
+
3503
+ if ((parsed = jqLiteBuildFragment(html, context))) {
3504
+ return parsed.childNodes;
3505
+ }
3506
+
3507
+ return [];
3508
+ }
3509
+
3510
+ function jqLiteWrapNode(node, wrapper) {
3511
+ var parent = node.parentNode;
3512
+
3513
+ if (parent) {
3514
+ parent.replaceChild(wrapper, node);
3515
+ }
3516
+
3517
+ wrapper.appendChild(node);
3518
+ }
3519
+
3520
+
3521
+ var jqLiteContains = window.Node.prototype.contains || function(arg) {
3522
+ return !!(this.compareDocumentPosition(arg) & 16);
3523
+ };
3524
+
3525
+ function JQLite(element) {
3526
+ if (element instanceof JQLite) {
3527
+ return element;
3528
+ }
3529
+
3530
+ var argIsString;
3531
+
3532
+ if (isString(element)) {
3533
+ element = trim(element);
3534
+ argIsString = true;
3535
+ }
3536
+ if (!(this instanceof JQLite)) {
3537
+ if (argIsString && element.charAt(0) !== '<') {
3538
+ throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
3539
+ }
3540
+ return new JQLite(element);
3541
+ }
3542
+
3543
+ if (argIsString) {
3544
+ jqLiteAddNodes(this, jqLiteParseHTML(element));
3545
+ } else if (isFunction(element)) {
3546
+ jqLiteReady(element);
3547
+ } else {
3548
+ jqLiteAddNodes(this, element);
3549
+ }
3550
+ }
3551
+
3552
+ function jqLiteClone(element) {
3553
+ return element.cloneNode(true);
3554
+ }
3555
+
3556
+ function jqLiteDealoc(element, onlyDescendants) {
3557
+ if (!onlyDescendants) jqLiteRemoveData(element);
3558
+
3559
+ if (element.querySelectorAll) {
3560
+ var descendants = element.querySelectorAll('*');
3561
+ for (var i = 0, l = descendants.length; i < l; i++) {
3562
+ jqLiteRemoveData(descendants[i]);
3563
+ }
3564
+ }
3565
+ }
3566
+
3567
+ function jqLiteOff(element, type, fn, unsupported) {
3568
+ if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
3569
+
3570
+ var expandoStore = jqLiteExpandoStore(element);
3571
+ var events = expandoStore && expandoStore.events;
3572
+ var handle = expandoStore && expandoStore.handle;
3573
+
3574
+ if (!handle) return;
3575
+
3576
+ if (!type) {
3577
+ for (type in events) {
3578
+ if (type !== '$destroy') {
3579
+ element.removeEventListener(type, handle);
3580
+ }
3581
+ delete events[type];
3582
+ }
3583
+ } else {
3584
+
3585
+ var removeHandler = function(type) {
3586
+ var listenerFns = events[type];
3587
+ if (isDefined(fn)) {
3588
+ arrayRemove(listenerFns || [], fn);
3589
+ }
3590
+ if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
3591
+ element.removeEventListener(type, handle);
3592
+ delete events[type];
3593
+ }
3594
+ };
3595
+
3596
+ forEach(type.split(' '), function(type) {
3597
+ removeHandler(type);
3598
+ if (MOUSE_EVENT_MAP[type]) {
3599
+ removeHandler(MOUSE_EVENT_MAP[type]);
3600
+ }
3601
+ });
3602
+ }
3603
+ }
3604
+
3605
+ function jqLiteRemoveData(element, name) {
3606
+ var expandoId = element.ng339;
3607
+ var expandoStore = expandoId && jqCache[expandoId];
3608
+
3609
+ if (expandoStore) {
3610
+ if (name) {
3611
+ delete expandoStore.data[name];
3612
+ return;
3613
+ }
3614
+
3615
+ if (expandoStore.handle) {
3616
+ if (expandoStore.events.$destroy) {
3617
+ expandoStore.handle({}, '$destroy');
3618
+ }
3619
+ jqLiteOff(element);
3620
+ }
3621
+ delete jqCache[expandoId];
3622
+ element.ng339 = undefined;
3623
+ }
3624
+ }
3625
+
3626
+
3627
+ function jqLiteExpandoStore(element, createIfNecessary) {
3628
+ var expandoId = element.ng339,
3629
+ expandoStore = expandoId && jqCache[expandoId];
3630
+
3631
+ if (createIfNecessary && !expandoStore) {
3632
+ element.ng339 = expandoId = jqNextId();
3633
+ expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};
3634
+ }
3635
+
3636
+ return expandoStore;
3637
+ }
3638
+
3639
+
3640
+ function jqLiteData(element, key, value) {
3641
+ if (jqLiteAcceptsData(element)) {
3642
+ var prop;
3643
+
3644
+ var isSimpleSetter = isDefined(value);
3645
+ var isSimpleGetter = !isSimpleSetter && key && !isObject(key);
3646
+ var massGetter = !key;
3647
+ var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);
3648
+ var data = expandoStore && expandoStore.data;
3649
+
3650
+ if (isSimpleSetter) {
3651
+ data[kebabToCamel(key)] = value;
3652
+ } else {
3653
+ if (massGetter) {
3654
+ return data;
3655
+ } else {
3656
+ if (isSimpleGetter) {
3657
+ return data && data[kebabToCamel(key)];
3658
+ } else {
3659
+ for (prop in key) {
3660
+ data[kebabToCamel(prop)] = key[prop];
3661
+ }
3662
+ }
3663
+ }
3664
+ }
3665
+ }
3666
+ }
3667
+
3668
+ function jqLiteHasClass(element, selector) {
3669
+ if (!element.getAttribute) return false;
3670
+ return ((' ' + (element.getAttribute('class') || '') + ' ').replace(/[\n\t]/g, ' ').
3671
+ indexOf(' ' + selector + ' ') > -1);
3672
+ }
3673
+
3674
+ function jqLiteRemoveClass(element, cssClasses) {
3675
+ if (cssClasses && element.setAttribute) {
3676
+ forEach(cssClasses.split(' '), function(cssClass) {
3677
+ element.setAttribute('class', trim(
3678
+ (' ' + (element.getAttribute('class') || '') + ' ')
3679
+ .replace(/[\n\t]/g, ' ')
3680
+ .replace(' ' + trim(cssClass) + ' ', ' '))
3681
+ );
3682
+ });
3683
+ }
3684
+ }
3685
+
3686
+ function jqLiteAddClass(element, cssClasses) {
3687
+ if (cssClasses && element.setAttribute) {
3688
+ var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
3689
+ .replace(/[\n\t]/g, ' ');
3690
+
3691
+ forEach(cssClasses.split(' '), function(cssClass) {
3692
+ cssClass = trim(cssClass);
3693
+ if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {
3694
+ existingClasses += cssClass + ' ';
3695
+ }
3696
+ });
3697
+
3698
+ element.setAttribute('class', trim(existingClasses));
3699
+ }
3700
+ }
3701
+
3702
+
3703
+ function jqLiteAddNodes(root, elements) {
3704
+
3705
+ if (elements) {
3706
+
3707
+ if (elements.nodeType) {
3708
+ root[root.length++] = elements;
3709
+ } else {
3710
+ var length = elements.length;
3711
+
3712
+ if (typeof length === 'number' && elements.window !== elements) {
3713
+ if (length) {
3714
+ for (var i = 0; i < length; i++) {
3715
+ root[root.length++] = elements[i];
3716
+ }
3717
+ }
3718
+ } else {
3719
+ root[root.length++] = elements;
3720
+ }
3721
+ }
3722
+ }
3723
+ }
3724
+
3725
+
3726
+ function jqLiteController(element, name) {
3727
+ return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');
3728
+ }
3729
+
3730
+ function jqLiteInheritedData(element, name, value) {
3731
+ if (element.nodeType === NODE_TYPE_DOCUMENT) {
3732
+ element = element.documentElement;
3733
+ }
3734
+ var names = isArray(name) ? name : [name];
3735
+
3736
+ while (element) {
3737
+ for (var i = 0, ii = names.length; i < ii; i++) {
3738
+ if (isDefined(value = jqLite.data(element, names[i]))) return value;
3739
+ }
3740
+
3741
+ element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);
3742
+ }
3743
+ }
3744
+
3745
+ function jqLiteEmpty(element) {
3746
+ jqLiteDealoc(element, true);
3747
+ while (element.firstChild) {
3748
+ element.removeChild(element.firstChild);
3749
+ }
3750
+ }
3751
+
3752
+ function jqLiteRemove(element, keepData) {
3753
+ if (!keepData) jqLiteDealoc(element);
3754
+ var parent = element.parentNode;
3755
+ if (parent) parent.removeChild(element);
3756
+ }
3757
+
3758
+
3759
+ function jqLiteDocumentLoaded(action, win) {
3760
+ win = win || window;
3761
+ if (win.document.readyState === 'complete') {
3762
+ win.setTimeout(action);
3763
+ } else {
3764
+ jqLite(win).on('load', action);
3765
+ }
3766
+ }
3767
+
3768
+ function jqLiteReady(fn) {
3769
+ function trigger() {
3770
+ window.document.removeEventListener('DOMContentLoaded', trigger);
3771
+ window.removeEventListener('load', trigger);
3772
+ fn();
3773
+ }
3774
+
3775
+ if (window.document.readyState === 'complete') {
3776
+ window.setTimeout(fn);
3777
+ } else {
3778
+
3779
+ window.document.addEventListener('DOMContentLoaded', trigger);
3780
+
3781
+ window.addEventListener('load', trigger);
3782
+ }
3783
+ }
3784
+
3785
+ var JQLitePrototype = JQLite.prototype = {
3786
+ ready: jqLiteReady,
3787
+ toString: function() {
3788
+ var value = [];
3789
+ forEach(this, function(e) { value.push('' + e);});
3790
+ return '[' + value.join(', ') + ']';
3791
+ },
3792
+
3793
+ eq: function(index) {
3794
+ return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
3795
+ },
3796
+
3797
+ length: 0,
3798
+ push: push,
3799
+ sort: [].sort,
3800
+ splice: [].splice
3801
+ };
3802
+
3803
+ var BOOLEAN_ATTR = {};
3804
+ forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {
3805
+ BOOLEAN_ATTR[lowercase(value)] = value;
3806
+ });
3807
+ var BOOLEAN_ELEMENTS = {};
3808
+ forEach('input,select,option,textarea,button,form,details'.split(','), function(value) {
3809
+ BOOLEAN_ELEMENTS[value] = true;
3810
+ });
3811
+ var ALIASED_ATTR = {
3812
+ 'ngMinlength': 'minlength',
3813
+ 'ngMaxlength': 'maxlength',
3814
+ 'ngMin': 'min',
3815
+ 'ngMax': 'max',
3816
+ 'ngPattern': 'pattern',
3817
+ 'ngStep': 'step'
3818
+ };
3819
+
3820
+ function getBooleanAttrName(element, name) {
3821
+ var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
3822
+
3823
+ return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;
3824
+ }
3825
+
3826
+ function getAliasedAttrName(name) {
3827
+ return ALIASED_ATTR[name];
3828
+ }
3829
+
3830
+ forEach({
3831
+ data: jqLiteData,
3832
+ removeData: jqLiteRemoveData,
3833
+ hasData: jqLiteHasData,
3834
+ cleanData: jqLiteCleanData
3835
+ }, function(fn, name) {
3836
+ JQLite[name] = fn;
3837
+ });
3838
+
3839
+ forEach({
3840
+ data: jqLiteData,
3841
+ inheritedData: jqLiteInheritedData,
3842
+
3843
+ scope: function(element) {
3844
+ return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
3845
+ },
3846
+
3847
+ isolateScope: function(element) {
3848
+ return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');
3849
+ },
3850
+
3851
+ controller: jqLiteController,
3852
+
3853
+ injector: function(element) {
3854
+ return jqLiteInheritedData(element, '$injector');
3855
+ },
3856
+
3857
+ removeAttr: function(element, name) {
3858
+ element.removeAttribute(name);
3859
+ },
3860
+
3861
+ hasClass: jqLiteHasClass,
3862
+
3863
+ css: function(element, name, value) {
3864
+ name = cssKebabToCamel(name);
3865
+
3866
+ if (isDefined(value)) {
3867
+ element.style[name] = value;
3868
+ } else {
3869
+ return element.style[name];
3870
+ }
3871
+ },
3872
+
3873
+ attr: function(element, name, value) {
3874
+ var ret;
3875
+ var nodeType = element.nodeType;
3876
+ if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT ||
3877
+ !element.getAttribute) {
3878
+ return;
3879
+ }
3880
+
3881
+ var lowercasedName = lowercase(name);
3882
+ var isBooleanAttr = BOOLEAN_ATTR[lowercasedName];
3883
+
3884
+ if (isDefined(value)) {
3885
+
3886
+ if (value === null || (value === false && isBooleanAttr)) {
3887
+ element.removeAttribute(name);
3888
+ } else {
3889
+ element.setAttribute(name, isBooleanAttr ? lowercasedName : value);
3890
+ }
3891
+ } else {
3892
+
3893
+ ret = element.getAttribute(name);
3894
+
3895
+ if (isBooleanAttr && ret !== null) {
3896
+ ret = lowercasedName;
3897
+ }
3898
+ return ret === null ? undefined : ret;
3899
+ }
3900
+ },
3901
+
3902
+ prop: function(element, name, value) {
3903
+ if (isDefined(value)) {
3904
+ element[name] = value;
3905
+ } else {
3906
+ return element[name];
3907
+ }
3908
+ },
3909
+
3910
+ text: (function() {
3911
+ getText.$dv = '';
3912
+ return getText;
3913
+
3914
+ function getText(element, value) {
3915
+ if (isUndefined(value)) {
3916
+ var nodeType = element.nodeType;
3917
+ return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';
3918
+ }
3919
+ element.textContent = value;
3920
+ }
3921
+ })(),
3922
+
3923
+ val: function(element, value) {
3924
+ if (isUndefined(value)) {
3925
+ if (element.multiple && nodeName_(element) === 'select') {
3926
+ var result = [];
3927
+ forEach(element.options, function(option) {
3928
+ if (option.selected) {
3929
+ result.push(option.value || option.text);
3930
+ }
3931
+ });
3932
+ return result;
3933
+ }
3934
+ return element.value;
3935
+ }
3936
+ element.value = value;
3937
+ },
3938
+
3939
+ html: function(element, value) {
3940
+ if (isUndefined(value)) {
3941
+ return element.innerHTML;
3942
+ }
3943
+ jqLiteDealoc(element, true);
3944
+ element.innerHTML = value;
3945
+ },
3946
+
3947
+ empty: jqLiteEmpty
3948
+ }, function(fn, name) {
3949
+ JQLite.prototype[name] = function(arg1, arg2) {
3950
+ var i, key;
3951
+ var nodeCount = this.length;
3952
+
3953
+ if (fn !== jqLiteEmpty &&
3954
+ (isUndefined((fn.length === 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {
3955
+ if (isObject(arg1)) {
3956
+
3957
+ for (i = 0; i < nodeCount; i++) {
3958
+ if (fn === jqLiteData) {
3959
+ fn(this[i], arg1);
3960
+ } else {
3961
+ for (key in arg1) {
3962
+ fn(this[i], key, arg1[key]);
3963
+ }
3964
+ }
3965
+ }
3966
+ return this;
3967
+ } else {
3968
+ var value = fn.$dv;
3969
+ var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;
3970
+ for (var j = 0; j < jj; j++) {
3971
+ var nodeValue = fn(this[j], arg1, arg2);
3972
+ value = value ? value + nodeValue : nodeValue;
3973
+ }
3974
+ return value;
3975
+ }
3976
+ } else {
3977
+ for (i = 0; i < nodeCount; i++) {
3978
+ fn(this[i], arg1, arg2);
3979
+ }
3980
+ return this;
3981
+ }
3982
+ };
3983
+ });
3984
+
3985
+ function createEventHandler(element, events) {
3986
+ var eventHandler = function(event, type) {
3987
+ event.isDefaultPrevented = function() {
3988
+ return event.defaultPrevented;
3989
+ };
3990
+
3991
+ var eventFns = events[type || event.type];
3992
+ var eventFnsLength = eventFns ? eventFns.length : 0;
3993
+
3994
+ if (!eventFnsLength) return;
3995
+
3996
+ if (isUndefined(event.immediatePropagationStopped)) {
3997
+ var originalStopImmediatePropagation = event.stopImmediatePropagation;
3998
+ event.stopImmediatePropagation = function() {
3999
+ event.immediatePropagationStopped = true;
4000
+
4001
+ if (event.stopPropagation) {
4002
+ event.stopPropagation();
4003
+ }
4004
+
4005
+ if (originalStopImmediatePropagation) {
4006
+ originalStopImmediatePropagation.call(event);
4007
+ }
4008
+ };
4009
+ }
4010
+
4011
+ event.isImmediatePropagationStopped = function() {
4012
+ return event.immediatePropagationStopped === true;
4013
+ };
4014
+
4015
+ var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;
4016
+
4017
+ if ((eventFnsLength > 1)) {
4018
+ eventFns = shallowCopy(eventFns);
4019
+ }
4020
+
4021
+ for (var i = 0; i < eventFnsLength; i++) {
4022
+ if (!event.isImmediatePropagationStopped()) {
4023
+ handlerWrapper(element, event, eventFns[i]);
4024
+ }
4025
+ }
4026
+ };
4027
+
4028
+ eventHandler.elem = element;
4029
+ return eventHandler;
4030
+ }
4031
+
4032
+ function defaultHandlerWrapper(element, event, handler) {
4033
+ handler.call(element, event);
4034
+ }
4035
+
4036
+ function specialMouseHandlerWrapper(target, event, handler) {
4037
+ var related = event.relatedTarget;
4038
+ if (!related || (related !== target && !jqLiteContains.call(target, related))) {
4039
+ handler.call(target, event);
4040
+ }
4041
+ }
4042
+
4043
+ forEach({
4044
+ removeData: jqLiteRemoveData,
4045
+
4046
+ on: function jqLiteOn(element, type, fn, unsupported) {
4047
+ if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');
4048
+
4049
+ if (!jqLiteAcceptsData(element)) {
4050
+ return;
4051
+ }
4052
+
4053
+ var expandoStore = jqLiteExpandoStore(element, true);
4054
+ var events = expandoStore.events;
4055
+ var handle = expandoStore.handle;
4056
+
4057
+ if (!handle) {
4058
+ handle = expandoStore.handle = createEventHandler(element, events);
4059
+ }
4060
+
4061
+ var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];
4062
+ var i = types.length;
4063
+
4064
+ var addHandler = function(type, specialHandlerWrapper, noEventListener) {
4065
+ var eventFns = events[type];
4066
+
4067
+ if (!eventFns) {
4068
+ eventFns = events[type] = [];
4069
+ eventFns.specialHandlerWrapper = specialHandlerWrapper;
4070
+ if (type !== '$destroy' && !noEventListener) {
4071
+ element.addEventListener(type, handle);
4072
+ }
4073
+ }
4074
+
4075
+ eventFns.push(fn);
4076
+ };
4077
+
4078
+ while (i--) {
4079
+ type = types[i];
4080
+ if (MOUSE_EVENT_MAP[type]) {
4081
+ addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);
4082
+ addHandler(type, undefined, true);
4083
+ } else {
4084
+ addHandler(type);
4085
+ }
4086
+ }
4087
+ },
4088
+
4089
+ off: jqLiteOff,
4090
+
4091
+ one: function(element, type, fn) {
4092
+ element = jqLite(element);
4093
+
4094
+ element.on(type, function onFn() {
4095
+ element.off(type, fn);
4096
+ element.off(type, onFn);
4097
+ });
4098
+ element.on(type, fn);
4099
+ },
4100
+
4101
+ replaceWith: function(element, replaceNode) {
4102
+ var index, parent = element.parentNode;
4103
+ jqLiteDealoc(element);
4104
+ forEach(new JQLite(replaceNode), function(node) {
4105
+ if (index) {
4106
+ parent.insertBefore(node, index.nextSibling);
4107
+ } else {
4108
+ parent.replaceChild(node, element);
4109
+ }
4110
+ index = node;
4111
+ });
4112
+ },
4113
+
4114
+ children: function(element) {
4115
+ var children = [];
4116
+ forEach(element.childNodes, function(element) {
4117
+ if (element.nodeType === NODE_TYPE_ELEMENT) {
4118
+ children.push(element);
4119
+ }
4120
+ });
4121
+ return children;
4122
+ },
4123
+
4124
+ contents: function(element) {
4125
+ return element.contentDocument || element.childNodes || [];
4126
+ },
4127
+
4128
+ append: function(element, node) {
4129
+ var nodeType = element.nodeType;
4130
+ if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;
4131
+
4132
+ node = new JQLite(node);
4133
+
4134
+ for (var i = 0, ii = node.length; i < ii; i++) {
4135
+ var child = node[i];
4136
+ element.appendChild(child);
4137
+ }
4138
+ },
4139
+
4140
+ prepend: function(element, node) {
4141
+ if (element.nodeType === NODE_TYPE_ELEMENT) {
4142
+ var index = element.firstChild;
4143
+ forEach(new JQLite(node), function(child) {
4144
+ element.insertBefore(child, index);
4145
+ });
4146
+ }
4147
+ },
4148
+
4149
+ wrap: function(element, wrapNode) {
4150
+ jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);
4151
+ },
4152
+
4153
+ remove: jqLiteRemove,
4154
+
4155
+ detach: function(element) {
4156
+ jqLiteRemove(element, true);
4157
+ },
4158
+
4159
+ after: function(element, newElement) {
4160
+ var index = element, parent = element.parentNode;
4161
+
4162
+ if (parent) {
4163
+ newElement = new JQLite(newElement);
4164
+
4165
+ for (var i = 0, ii = newElement.length; i < ii; i++) {
4166
+ var node = newElement[i];
4167
+ parent.insertBefore(node, index.nextSibling);
4168
+ index = node;
4169
+ }
4170
+ }
4171
+ },
4172
+
4173
+ addClass: jqLiteAddClass,
4174
+ removeClass: jqLiteRemoveClass,
4175
+
4176
+ toggleClass: function(element, selector, condition) {
4177
+ if (selector) {
4178
+ forEach(selector.split(' '), function(className) {
4179
+ var classCondition = condition;
4180
+ if (isUndefined(classCondition)) {
4181
+ classCondition = !jqLiteHasClass(element, className);
4182
+ }
4183
+ (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);
4184
+ });
4185
+ }
4186
+ },
4187
+
4188
+ parent: function(element) {
4189
+ var parent = element.parentNode;
4190
+ return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;
4191
+ },
4192
+
4193
+ next: function(element) {
4194
+ return element.nextElementSibling;
4195
+ },
4196
+
4197
+ find: function(element, selector) {
4198
+ if (element.getElementsByTagName) {
4199
+ return element.getElementsByTagName(selector);
4200
+ } else {
4201
+ return [];
4202
+ }
4203
+ },
4204
+
4205
+ clone: jqLiteClone,
4206
+
4207
+ triggerHandler: function(element, event, extraParameters) {
4208
+
4209
+ var dummyEvent, eventFnsCopy, handlerArgs;
4210
+ var eventName = event.type || event;
4211
+ var expandoStore = jqLiteExpandoStore(element);
4212
+ var events = expandoStore && expandoStore.events;
4213
+ var eventFns = events && events[eventName];
4214
+
4215
+ if (eventFns) {
4216
+ dummyEvent = {
4217
+ preventDefault: function() { this.defaultPrevented = true; },
4218
+ isDefaultPrevented: function() { return this.defaultPrevented === true; },
4219
+ stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },
4220
+ isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },
4221
+ stopPropagation: noop,
4222
+ type: eventName,
4223
+ target: element
4224
+ };
4225
+
4226
+ if (event.type) {
4227
+ dummyEvent = extend(dummyEvent, event);
4228
+ }
4229
+
4230
+ eventFnsCopy = shallowCopy(eventFns);
4231
+ handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];
4232
+
4233
+ forEach(eventFnsCopy, function(fn) {
4234
+ if (!dummyEvent.isImmediatePropagationStopped()) {
4235
+ fn.apply(element, handlerArgs);
4236
+ }
4237
+ });
4238
+ }
4239
+ }
4240
+ }, function(fn, name) {
4241
+ JQLite.prototype[name] = function(arg1, arg2, arg3) {
4242
+ var value;
4243
+
4244
+ for (var i = 0, ii = this.length; i < ii; i++) {
4245
+ if (isUndefined(value)) {
4246
+ value = fn(this[i], arg1, arg2, arg3);
4247
+ if (isDefined(value)) {
4248
+ value = jqLite(value);
4249
+ }
4250
+ } else {
4251
+ jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));
4252
+ }
4253
+ }
4254
+ return isDefined(value) ? value : this;
4255
+ };
4256
+ });
4257
+
4258
+ JQLite.prototype.bind = JQLite.prototype.on;
4259
+ JQLite.prototype.unbind = JQLite.prototype.off;
4260
+
4261
+
4262
+ function $$jqLiteProvider() {
4263
+ this.$get = function $$jqLite() {
4264
+ return extend(JQLite, {
4265
+ hasClass: function(node, classes) {
4266
+ if (node.attr) node = node[0];
4267
+ return jqLiteHasClass(node, classes);
4268
+ },
4269
+ addClass: function(node, classes) {
4270
+ if (node.attr) node = node[0];
4271
+ return jqLiteAddClass(node, classes);
4272
+ },
4273
+ removeClass: function(node, classes) {
4274
+ if (node.attr) node = node[0];
4275
+ return jqLiteRemoveClass(node, classes);
4276
+ }
4277
+ });
4278
+ };
4279
+ }
4280
+
4281
+ function hashKey(obj, nextUidFn) {
4282
+ var key = obj && obj.$$hashKey;
4283
+
4284
+ if (key) {
4285
+ if (typeof key === 'function') {
4286
+ key = obj.$$hashKey();
4287
+ }
4288
+ return key;
4289
+ }
4290
+
4291
+ var objType = typeof obj;
4292
+ if (objType === 'function' || (objType === 'object' && obj !== null)) {
4293
+ key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
4294
+ } else {
4295
+ key = objType + ':' + obj;
4296
+ }
4297
+
4298
+ return key;
4299
+ }
4300
+
4301
+ function HashMap(array, isolatedUid) {
4302
+ if (isolatedUid) {
4303
+ var uid = 0;
4304
+ this.nextUid = function() {
4305
+ return ++uid;
4306
+ };
4307
+ }
4308
+ forEach(array, this.put, this);
4309
+ }
4310
+ HashMap.prototype = {
4311
+ put: function(key, value) {
4312
+ this[hashKey(key, this.nextUid)] = value;
4313
+ },
4314
+
4315
+ get: function(key) {
4316
+ return this[hashKey(key, this.nextUid)];
4317
+ },
4318
+
4319
+ remove: function(key) {
4320
+ var value = this[key = hashKey(key, this.nextUid)];
4321
+ delete this[key];
4322
+ return value;
4323
+ }
4324
+ };
4325
+
4326
+ var $$HashMapProvider = [function() {
4327
+ this.$get = [function() {
4328
+ return HashMap;
4329
+ }];
4330
+ }];
4331
+
4332
+
4333
+
4334
+
4335
+ var ARROW_ARG = /^([^(]+?)=>/;
4336
+ var FN_ARGS = /^[^(]*\(\s*([^)]*)\)/m;
4337
+ var FN_ARG_SPLIT = /,/;
4338
+ var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
4339
+ var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
4340
+ var $injectorMinErr = minErr('$injector');
4341
+
4342
+ function stringifyFn(fn) {
4343
+ return Function.prototype.toString.call(fn) + ' ';
4344
+ }
4345
+
4346
+ function extractArgs(fn) {
4347
+ var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, ''),
4348
+ args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
4349
+ return args;
4350
+ }
4351
+
4352
+ function anonFn(fn) {
4353
+ var args = extractArgs(fn);
4354
+ if (args) {
4355
+ return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')';
4356
+ }
4357
+ return 'fn';
4358
+ }
4359
+
4360
+ function annotate(fn, strictDi, name) {
4361
+ var $inject,
4362
+ argDecl,
4363
+ last;
4364
+
4365
+ if (typeof fn === 'function') {
4366
+ if (!($inject = fn.$inject)) {
4367
+ $inject = [];
4368
+ if (fn.length) {
4369
+ if (strictDi) {
4370
+ if (!isString(name) || !name) {
4371
+ name = fn.name || anonFn(fn);
4372
+ }
4373
+ throw $injectorMinErr('strictdi',
4374
+ '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
4375
+ }
4376
+ argDecl = extractArgs(fn);
4377
+ forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
4378
+ arg.replace(FN_ARG, function(all, underscore, name) {
4379
+ $inject.push(name);
4380
+ });
4381
+ });
4382
+ }
4383
+ fn.$inject = $inject;
4384
+ }
4385
+ } else if (isArray(fn)) {
4386
+ last = fn.length - 1;
4387
+ assertArgFn(fn[last], 'fn');
4388
+ $inject = fn.slice(0, last);
4389
+ } else {
4390
+ assertArgFn(fn, 'fn', true);
4391
+ }
4392
+ return $inject;
4393
+ }
4394
+
4395
+
4396
+
4397
+
4398
+
4399
+
4400
+
4401
+
4402
+
4403
+
4404
+
4405
+
4406
+
4407
+
4408
+
4409
+
4410
+
4411
+
4412
+
4413
+
4414
+
4415
+
4416
+ function createInjector(modulesToLoad, strictDi) {
4417
+ strictDi = (strictDi === true);
4418
+ var INSTANTIATING = {},
4419
+ providerSuffix = 'Provider',
4420
+ path = [],
4421
+ loadedModules = new HashMap([], true),
4422
+ providerCache = {
4423
+ $provide: {
4424
+ provider: supportObject(provider),
4425
+ factory: supportObject(factory),
4426
+ service: supportObject(service),
4427
+ value: supportObject(value),
4428
+ constant: supportObject(constant),
4429
+ decorator: decorator
4430
+ }
4431
+ },
4432
+ providerInjector = (providerCache.$injector =
4433
+ createInternalInjector(providerCache, function(serviceName, caller) {
4434
+ if (angular.isString(caller)) {
4435
+ path.push(caller);
4436
+ }
4437
+ throw $injectorMinErr('unpr', 'Unknown provider: {0}', path.join(' <- '));
4438
+ })),
4439
+ instanceCache = {},
4440
+ protoInstanceInjector =
4441
+ createInternalInjector(instanceCache, function(serviceName, caller) {
4442
+ var provider = providerInjector.get(serviceName + providerSuffix, caller);
4443
+ return instanceInjector.invoke(
4444
+ provider.$get, provider, undefined, serviceName);
4445
+ }),
4446
+ instanceInjector = protoInstanceInjector;
4447
+
4448
+ providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };
4449
+ var runBlocks = loadModules(modulesToLoad);
4450
+ instanceInjector = protoInstanceInjector.get('$injector');
4451
+ instanceInjector.strictDi = strictDi;
4452
+ forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); });
4453
+
4454
+ return instanceInjector;
4455
+
4456
+
4457
+ function supportObject(delegate) {
4458
+ return function(key, value) {
4459
+ if (isObject(key)) {
4460
+ forEach(key, reverseParams(delegate));
4461
+ } else {
4462
+ return delegate(key, value);
4463
+ }
4464
+ };
4465
+ }
4466
+
4467
+ function provider(name, provider_) {
4468
+ assertNotHasOwnProperty(name, 'service');
4469
+ if (isFunction(provider_) || isArray(provider_)) {
4470
+ provider_ = providerInjector.instantiate(provider_);
4471
+ }
4472
+ if (!provider_.$get) {
4473
+ throw $injectorMinErr('pget', 'Provider \'{0}\' must define $get factory method.', name);
4474
+ }
4475
+ return (providerCache[name + providerSuffix] = provider_);
4476
+ }
4477
+
4478
+ function enforceReturnValue(name, factory) {
4479
+ return function enforcedReturnValue() {
4480
+ var result = instanceInjector.invoke(factory, this);
4481
+ if (isUndefined(result)) {
4482
+ throw $injectorMinErr('undef', 'Provider \'{0}\' must return a value from $get factory method.', name);
4483
+ }
4484
+ return result;
4485
+ };
4486
+ }
4487
+
4488
+ function factory(name, factoryFn, enforce) {
4489
+ return provider(name, {
4490
+ $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn
4491
+ });
4492
+ }
4493
+
4494
+ function service(name, constructor) {
4495
+ return factory(name, ['$injector', function($injector) {
4496
+ return $injector.instantiate(constructor);
4497
+ }]);
4498
+ }
4499
+
4500
+ function value(name, val) { return factory(name, valueFn(val), false); }
4501
+
4502
+ function constant(name, value) {
4503
+ assertNotHasOwnProperty(name, 'constant');
4504
+ providerCache[name] = value;
4505
+ instanceCache[name] = value;
4506
+ }
4507
+
4508
+ function decorator(serviceName, decorFn) {
4509
+ var origProvider = providerInjector.get(serviceName + providerSuffix),
4510
+ orig$get = origProvider.$get;
4511
+
4512
+ origProvider.$get = function() {
4513
+ var origInstance = instanceInjector.invoke(orig$get, origProvider);
4514
+ return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
4515
+ };
4516
+ }
4517
+
4518
+ function loadModules(modulesToLoad) {
4519
+ assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
4520
+ var runBlocks = [], moduleFn;
4521
+ forEach(modulesToLoad, function(module) {
4522
+ if (loadedModules.get(module)) return;
4523
+ loadedModules.put(module, true);
4524
+
4525
+ function runInvokeQueue(queue) {
4526
+ var i, ii;
4527
+ for (i = 0, ii = queue.length; i < ii; i++) {
4528
+ var invokeArgs = queue[i],
4529
+ provider = providerInjector.get(invokeArgs[0]);
4530
+
4531
+ provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
4532
+ }
4533
+ }
4534
+
4535
+ try {
4536
+ if (isString(module)) {
4537
+ moduleFn = angularModule(module);
4538
+ runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
4539
+ runInvokeQueue(moduleFn._invokeQueue);
4540
+ runInvokeQueue(moduleFn._configBlocks);
4541
+ } else if (isFunction(module)) {
4542
+ runBlocks.push(providerInjector.invoke(module));
4543
+ } else if (isArray(module)) {
4544
+ runBlocks.push(providerInjector.invoke(module));
4545
+ } else {
4546
+ assertArgFn(module, 'module');
4547
+ }
4548
+ } catch (e) {
4549
+ if (isArray(module)) {
4550
+ module = module[module.length - 1];
4551
+ }
4552
+ if (e.message && e.stack && e.stack.indexOf(e.message) === -1) {
4553
+ e = e.message + '\n' + e.stack;
4554
+ }
4555
+ throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}',
4556
+ module, e.stack || e.message || e);
4557
+ }
4558
+ });
4559
+ return runBlocks;
4560
+ }
4561
+
4562
+
4563
+ function createInternalInjector(cache, factory) {
4564
+
4565
+ function getService(serviceName, caller) {
4566
+ if (cache.hasOwnProperty(serviceName)) {
4567
+ if (cache[serviceName] === INSTANTIATING) {
4568
+ throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
4569
+ serviceName + ' <- ' + path.join(' <- '));
4570
+ }
4571
+ return cache[serviceName];
4572
+ } else {
4573
+ try {
4574
+ path.unshift(serviceName);
4575
+ cache[serviceName] = INSTANTIATING;
4576
+ cache[serviceName] = factory(serviceName, caller);
4577
+ return cache[serviceName];
4578
+ } catch (err) {
4579
+ if (cache[serviceName] === INSTANTIATING) {
4580
+ delete cache[serviceName];
4581
+ }
4582
+ throw err;
4583
+ } finally {
4584
+ path.shift();
4585
+ }
4586
+ }
4587
+ }
4588
+
4589
+
4590
+ function injectionArgs(fn, locals, serviceName) {
4591
+ var args = [],
4592
+ $inject = createInjector.$$annotate(fn, strictDi, serviceName);
4593
+
4594
+ for (var i = 0, length = $inject.length; i < length; i++) {
4595
+ var key = $inject[i];
4596
+ if (typeof key !== 'string') {
4597
+ throw $injectorMinErr('itkn',
4598
+ 'Incorrect injection token! Expected service name as string, got {0}', key);
4599
+ }
4600
+ args.push(locals && locals.hasOwnProperty(key) ? locals[key] :
4601
+ getService(key, serviceName));
4602
+ }
4603
+ return args;
4604
+ }
4605
+
4606
+ function isClass(func) {
4607
+ if (msie || typeof func !== 'function') {
4608
+ return false;
4609
+ }
4610
+ var result = func.$$ngIsClass;
4611
+ if (!isBoolean(result)) {
4612
+ result = func.$$ngIsClass = /^(?:class\b|constructor\()/.test(stringifyFn(func));
4613
+ }
4614
+ return result;
4615
+ }
4616
+
4617
+ function invoke(fn, self, locals, serviceName) {
4618
+ if (typeof locals === 'string') {
4619
+ serviceName = locals;
4620
+ locals = null;
4621
+ }
4622
+
4623
+ var args = injectionArgs(fn, locals, serviceName);
4624
+ if (isArray(fn)) {
4625
+ fn = fn[fn.length - 1];
4626
+ }
4627
+
4628
+ if (!isClass(fn)) {
4629
+ return fn.apply(self, args);
4630
+ } else {
4631
+ args.unshift(null);
4632
+ return new (Function.prototype.bind.apply(fn, args))();
4633
+ }
4634
+ }
4635
+
4636
+
4637
+ function instantiate(Type, locals, serviceName) {
4638
+ var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);
4639
+ var args = injectionArgs(Type, locals, serviceName);
4640
+ args.unshift(null);
4641
+ return new (Function.prototype.bind.apply(ctor, args))();
4642
+ }
4643
+
4644
+
4645
+ return {
4646
+ invoke: invoke,
4647
+ instantiate: instantiate,
4648
+ get: getService,
4649
+ annotate: createInjector.$$annotate,
4650
+ has: function(name) {
4651
+ return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
4652
+ }
4653
+ };
4654
+ }
4655
+ }
4656
+
4657
+ createInjector.$$annotate = annotate;
4658
+
4659
+ function $AnchorScrollProvider() {
4660
+
4661
+ var autoScrollingEnabled = true;
4662
+
4663
+ this.disableAutoScrolling = function() {
4664
+ autoScrollingEnabled = false;
4665
+ };
4666
+
4667
+ this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
4668
+ var document = $window.document;
4669
+
4670
+ function getFirstAnchor(list) {
4671
+ var result = null;
4672
+ Array.prototype.some.call(list, function(element) {
4673
+ if (nodeName_(element) === 'a') {
4674
+ result = element;
4675
+ return true;
4676
+ }
4677
+ });
4678
+ return result;
4679
+ }
4680
+
4681
+ function getYOffset() {
4682
+
4683
+ var offset = scroll.yOffset;
4684
+
4685
+ if (isFunction(offset)) {
4686
+ offset = offset();
4687
+ } else if (isElement(offset)) {
4688
+ var elem = offset[0];
4689
+ var style = $window.getComputedStyle(elem);
4690
+ if (style.position !== 'fixed') {
4691
+ offset = 0;
4692
+ } else {
4693
+ offset = elem.getBoundingClientRect().bottom;
4694
+ }
4695
+ } else if (!isNumber(offset)) {
4696
+ offset = 0;
4697
+ }
4698
+
4699
+ return offset;
4700
+ }
4701
+
4702
+ function scrollTo(elem) {
4703
+ if (elem) {
4704
+ elem.scrollIntoView();
4705
+
4706
+ var offset = getYOffset();
4707
+
4708
+ if (offset) {
4709
+ var elemTop = elem.getBoundingClientRect().top;
4710
+ $window.scrollBy(0, elemTop - offset);
4711
+ }
4712
+ } else {
4713
+ $window.scrollTo(0, 0);
4714
+ }
4715
+ }
4716
+
4717
+ function scroll(hash) {
4718
+ hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash();
4719
+ var elm;
4720
+
4721
+ if (!hash) scrollTo(null);
4722
+
4723
+ else if ((elm = document.getElementById(hash))) scrollTo(elm);
4724
+
4725
+ else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
4726
+
4727
+ else if (hash === 'top') scrollTo(null);
4728
+ }
4729
+
4730
+ if (autoScrollingEnabled) {
4731
+ $rootScope.$watch(function autoScrollWatch() {return $location.hash();},
4732
+ function autoScrollWatchAction(newVal, oldVal) {
4733
+ if (newVal === oldVal && newVal === '') return;
4734
+
4735
+ jqLiteDocumentLoaded(function() {
4736
+ $rootScope.$evalAsync(scroll);
4737
+ });
4738
+ });
4739
+ }
4740
+
4741
+ return scroll;
4742
+ }];
4743
+ }
4744
+
4745
+ var $animateMinErr = minErr('$animate');
4746
+ var ELEMENT_NODE = 1;
4747
+ var NG_ANIMATE_CLASSNAME = 'ng-animate';
4748
+
4749
+ function mergeClasses(a,b) {
4750
+ if (!a && !b) return '';
4751
+ if (!a) return b;
4752
+ if (!b) return a;
4753
+ if (isArray(a)) a = a.join(' ');
4754
+ if (isArray(b)) b = b.join(' ');
4755
+ return a + ' ' + b;
4756
+ }
4757
+
4758
+ function extractElementNode(element) {
4759
+ for (var i = 0; i < element.length; i++) {
4760
+ var elm = element[i];
4761
+ if (elm.nodeType === ELEMENT_NODE) {
4762
+ return elm;
4763
+ }
4764
+ }
4765
+ }
4766
+
4767
+ function splitClasses(classes) {
4768
+ if (isString(classes)) {
4769
+ classes = classes.split(' ');
4770
+ }
4771
+
4772
+ var obj = createMap();
4773
+ forEach(classes, function(klass) {
4774
+ if (klass.length) {
4775
+ obj[klass] = true;
4776
+ }
4777
+ });
4778
+ return obj;
4779
+ }
4780
+
4781
+ function prepareAnimateOptions(options) {
4782
+ return isObject(options)
4783
+ ? options
4784
+ : {};
4785
+ }
4786
+
4787
+ var $$CoreAnimateJsProvider = function() {
4788
+ this.$get = noop;
4789
+ };
4790
+
4791
+ var $$CoreAnimateQueueProvider = function() {
4792
+ var postDigestQueue = new HashMap();
4793
+ var postDigestElements = [];
4794
+
4795
+ this.$get = ['$$AnimateRunner', '$rootScope',
4796
+ function($$AnimateRunner, $rootScope) {
4797
+ return {
4798
+ enabled: noop,
4799
+ on: noop,
4800
+ off: noop,
4801
+ pin: noop,
4802
+
4803
+ push: function(element, event, options, domOperation) {
4804
+ if (domOperation) {
4805
+ domOperation();
4806
+ }
4807
+
4808
+ options = options || {};
4809
+ if (options.from) {
4810
+ element.css(options.from);
4811
+ }
4812
+ if (options.to) {
4813
+ element.css(options.to);
4814
+ }
4815
+
4816
+ if (options.addClass || options.removeClass) {
4817
+ addRemoveClassesPostDigest(element, options.addClass, options.removeClass);
4818
+ }
4819
+
4820
+ var runner = new $$AnimateRunner();
4821
+
4822
+ runner.complete();
4823
+ return runner;
4824
+ }
4825
+ };
4826
+
4827
+
4828
+ function updateData(data, classes, value) {
4829
+ var changed = false;
4830
+ if (classes) {
4831
+ classes = isString(classes) ? classes.split(' ') :
4832
+ isArray(classes) ? classes : [];
4833
+ forEach(classes, function(className) {
4834
+ if (className) {
4835
+ changed = true;
4836
+ data[className] = value;
4837
+ }
4838
+ });
4839
+ }
4840
+ return changed;
4841
+ }
4842
+
4843
+ function handleCSSClassChanges() {
4844
+ forEach(postDigestElements, function(element) {
4845
+ var data = postDigestQueue.get(element);
4846
+ if (data) {
4847
+ var existing = splitClasses(element.attr('class'));
4848
+ var toAdd = '';
4849
+ var toRemove = '';
4850
+ forEach(data, function(status, className) {
4851
+ var hasClass = !!existing[className];
4852
+ if (status !== hasClass) {
4853
+ if (status) {
4854
+ toAdd += (toAdd.length ? ' ' : '') + className;
4855
+ } else {
4856
+ toRemove += (toRemove.length ? ' ' : '') + className;
4857
+ }
4858
+ }
4859
+ });
4860
+
4861
+ forEach(element, function(elm) {
4862
+ if (toAdd) {
4863
+ jqLiteAddClass(elm, toAdd);
4864
+ }
4865
+ if (toRemove) {
4866
+ jqLiteRemoveClass(elm, toRemove);
4867
+ }
4868
+ });
4869
+ postDigestQueue.remove(element);
4870
+ }
4871
+ });
4872
+ postDigestElements.length = 0;
4873
+ }
4874
+
4875
+
4876
+ function addRemoveClassesPostDigest(element, add, remove) {
4877
+ var data = postDigestQueue.get(element) || {};
4878
+
4879
+ var classesAdded = updateData(data, add, true);
4880
+ var classesRemoved = updateData(data, remove, false);
4881
+
4882
+ if (classesAdded || classesRemoved) {
4883
+
4884
+ postDigestQueue.put(element, data);
4885
+ postDigestElements.push(element);
4886
+
4887
+ if (postDigestElements.length === 1) {
4888
+ $rootScope.$$postDigest(handleCSSClassChanges);
4889
+ }
4890
+ }
4891
+ }
4892
+ }];
4893
+ };
4894
+
4895
+ var $AnimateProvider = ['$provide', function($provide) {
4896
+ var provider = this;
4897
+
4898
+ this.$$registeredAnimations = Object.create(null);
4899
+
4900
+ this.register = function(name, factory) {
4901
+ if (name && name.charAt(0) !== '.') {
4902
+ throw $animateMinErr('notcsel', 'Expecting class selector starting with \'.\' got \'{0}\'.', name);
4903
+ }
4904
+
4905
+ var key = name + '-animation';
4906
+ provider.$$registeredAnimations[name.substr(1)] = key;
4907
+ $provide.factory(key, factory);
4908
+ };
4909
+
4910
+ this.classNameFilter = function(expression) {
4911
+ if (arguments.length === 1) {
4912
+ this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
4913
+ if (this.$$classNameFilter) {
4914
+ var reservedRegex = new RegExp('(\\s+|\\/)' + NG_ANIMATE_CLASSNAME + '(\\s+|\\/)');
4915
+ if (reservedRegex.test(this.$$classNameFilter.toString())) {
4916
+ throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
4917
+ }
4918
+ }
4919
+ }
4920
+ return this.$$classNameFilter;
4921
+ };
4922
+
4923
+ this.$get = ['$$animateQueue', function($$animateQueue) {
4924
+ function domInsert(element, parentElement, afterElement) {
4925
+ if (afterElement) {
4926
+ var afterNode = extractElementNode(afterElement);
4927
+ if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {
4928
+ afterElement = null;
4929
+ }
4930
+ }
4931
+ if (afterElement) {
4932
+ afterElement.after(element);
4933
+ } else {
4934
+ parentElement.prepend(element);
4935
+ }
4936
+ }
4937
+
4938
+ return {
4939
+
4940
+ on: $$animateQueue.on,
4941
+
4942
+ off: $$animateQueue.off,
4943
+
4944
+ pin: $$animateQueue.pin,
4945
+
4946
+ enabled: $$animateQueue.enabled,
4947
+
4948
+ cancel: function(runner) {
4949
+ if (runner.end) {
4950
+ runner.end();
4951
+ }
4952
+ },
4953
+
4954
+ enter: function(element, parent, after, options) {
4955
+ parent = parent && jqLite(parent);
4956
+ after = after && jqLite(after);
4957
+ parent = parent || after.parent();
4958
+ domInsert(element, parent, after);
4959
+ return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));
4960
+ },
4961
+
4962
+ move: function(element, parent, after, options) {
4963
+ parent = parent && jqLite(parent);
4964
+ after = after && jqLite(after);
4965
+ parent = parent || after.parent();
4966
+ domInsert(element, parent, after);
4967
+ return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));
4968
+ },
4969
+
4970
+ leave: function(element, options) {
4971
+ return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {
4972
+ element.remove();
4973
+ });
4974
+ },
4975
+
4976
+ addClass: function(element, className, options) {
4977
+ options = prepareAnimateOptions(options);
4978
+ options.addClass = mergeClasses(options.addclass, className);
4979
+ return $$animateQueue.push(element, 'addClass', options);
4980
+ },
4981
+
4982
+ removeClass: function(element, className, options) {
4983
+ options = prepareAnimateOptions(options);
4984
+ options.removeClass = mergeClasses(options.removeClass, className);
4985
+ return $$animateQueue.push(element, 'removeClass', options);
4986
+ },
4987
+
4988
+ setClass: function(element, add, remove, options) {
4989
+ options = prepareAnimateOptions(options);
4990
+ options.addClass = mergeClasses(options.addClass, add);
4991
+ options.removeClass = mergeClasses(options.removeClass, remove);
4992
+ return $$animateQueue.push(element, 'setClass', options);
4993
+ },
4994
+
4995
+ animate: function(element, from, to, className, options) {
4996
+ options = prepareAnimateOptions(options);
4997
+ options.from = options.from ? extend(options.from, from) : from;
4998
+ options.to = options.to ? extend(options.to, to) : to;
4999
+
5000
+ className = className || 'ng-inline-animate';
5001
+ options.tempClasses = mergeClasses(options.tempClasses, className);
5002
+ return $$animateQueue.push(element, 'animate', options);
5003
+ }
5004
+ };
5005
+ }];
5006
+ }];
5007
+
5008
+ var $$AnimateAsyncRunFactoryProvider = function() {
5009
+ this.$get = ['$$rAF', function($$rAF) {
5010
+ var waitQueue = [];
5011
+
5012
+ function waitForTick(fn) {
5013
+ waitQueue.push(fn);
5014
+ if (waitQueue.length > 1) return;
5015
+ $$rAF(function() {
5016
+ for (var i = 0; i < waitQueue.length; i++) {
5017
+ waitQueue[i]();
5018
+ }
5019
+ waitQueue = [];
5020
+ });
5021
+ }
5022
+
5023
+ return function() {
5024
+ var passed = false;
5025
+ waitForTick(function() {
5026
+ passed = true;
5027
+ });
5028
+ return function(callback) {
5029
+ if (passed) {
5030
+ callback();
5031
+ } else {
5032
+ waitForTick(callback);
5033
+ }
5034
+ };
5035
+ };
5036
+ }];
5037
+ };
5038
+
5039
+ var $$AnimateRunnerFactoryProvider = function() {
5040
+ this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$$isDocumentHidden', '$timeout',
5041
+ function($q, $sniffer, $$animateAsyncRun, $$isDocumentHidden, $timeout) {
5042
+
5043
+ var INITIAL_STATE = 0;
5044
+ var DONE_PENDING_STATE = 1;
5045
+ var DONE_COMPLETE_STATE = 2;
5046
+
5047
+ AnimateRunner.chain = function(chain, callback) {
5048
+ var index = 0;
5049
+
5050
+ next();
5051
+ function next() {
5052
+ if (index === chain.length) {
5053
+ callback(true);
5054
+ return;
5055
+ }
5056
+
5057
+ chain[index](function(response) {
5058
+ if (response === false) {
5059
+ callback(false);
5060
+ return;
5061
+ }
5062
+ index++;
5063
+ next();
5064
+ });
5065
+ }
5066
+ };
5067
+
5068
+ AnimateRunner.all = function(runners, callback) {
5069
+ var count = 0;
5070
+ var status = true;
5071
+ forEach(runners, function(runner) {
5072
+ runner.done(onProgress);
5073
+ });
5074
+
5075
+ function onProgress(response) {
5076
+ status = status && response;
5077
+ if (++count === runners.length) {
5078
+ callback(status);
5079
+ }
5080
+ }
5081
+ };
5082
+
5083
+ function AnimateRunner(host) {
5084
+ this.setHost(host);
5085
+
5086
+ var rafTick = $$animateAsyncRun();
5087
+ var timeoutTick = function(fn) {
5088
+ $timeout(fn, 0, false);
5089
+ };
5090
+
5091
+ this._doneCallbacks = [];
5092
+ this._tick = function(fn) {
5093
+ if ($$isDocumentHidden()) {
5094
+ timeoutTick(fn);
5095
+ } else {
5096
+ rafTick(fn);
5097
+ }
5098
+ };
5099
+ this._state = 0;
5100
+ }
5101
+
5102
+ AnimateRunner.prototype = {
5103
+ setHost: function(host) {
5104
+ this.host = host || {};
5105
+ },
5106
+
5107
+ done: function(fn) {
5108
+ if (this._state === DONE_COMPLETE_STATE) {
5109
+ fn();
5110
+ } else {
5111
+ this._doneCallbacks.push(fn);
5112
+ }
5113
+ },
5114
+
5115
+ progress: noop,
5116
+
5117
+ getPromise: function() {
5118
+ if (!this.promise) {
5119
+ var self = this;
5120
+ this.promise = $q(function(resolve, reject) {
5121
+ self.done(function(status) {
5122
+ if (status === false) {
5123
+ reject();
5124
+ } else {
5125
+ resolve();
5126
+ }
5127
+ });
5128
+ });
5129
+ }
5130
+ return this.promise;
5131
+ },
5132
+
5133
+ then: function(resolveHandler, rejectHandler) {
5134
+ return this.getPromise().then(resolveHandler, rejectHandler);
5135
+ },
5136
+
5137
+ 'catch': function(handler) {
5138
+ return this.getPromise()['catch'](handler);
5139
+ },
5140
+
5141
+ 'finally': function(handler) {
5142
+ return this.getPromise()['finally'](handler);
5143
+ },
5144
+
5145
+ pause: function() {
5146
+ if (this.host.pause) {
5147
+ this.host.pause();
5148
+ }
5149
+ },
5150
+
5151
+ resume: function() {
5152
+ if (this.host.resume) {
5153
+ this.host.resume();
5154
+ }
5155
+ },
5156
+
5157
+ end: function() {
5158
+ if (this.host.end) {
5159
+ this.host.end();
5160
+ }
5161
+ this._resolve(true);
5162
+ },
5163
+
5164
+ cancel: function() {
5165
+ if (this.host.cancel) {
5166
+ this.host.cancel();
5167
+ }
5168
+ this._resolve(false);
5169
+ },
5170
+
5171
+ complete: function(response) {
5172
+ var self = this;
5173
+ if (self._state === INITIAL_STATE) {
5174
+ self._state = DONE_PENDING_STATE;
5175
+ self._tick(function() {
5176
+ self._resolve(response);
5177
+ });
5178
+ }
5179
+ },
5180
+
5181
+ _resolve: function(response) {
5182
+ if (this._state !== DONE_COMPLETE_STATE) {
5183
+ forEach(this._doneCallbacks, function(fn) {
5184
+ fn(response);
5185
+ });
5186
+ this._doneCallbacks.length = 0;
5187
+ this._state = DONE_COMPLETE_STATE;
5188
+ }
5189
+ }
5190
+ };
5191
+
5192
+ return AnimateRunner;
5193
+ }];
5194
+ };
5195
+
5196
+
5197
+ var $CoreAnimateCssProvider = function() {
5198
+ this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
5199
+
5200
+ return function(element, initialOptions) {
5201
+ var options = initialOptions || {};
5202
+ if (!options.$$prepared) {
5203
+ options = copy(options);
5204
+ }
5205
+
5206
+ if (options.cleanupStyles) {
5207
+ options.from = options.to = null;
5208
+ }
5209
+
5210
+ if (options.from) {
5211
+ element.css(options.from);
5212
+ options.from = null;
5213
+ }
5214
+
5215
+ var closed, runner = new $$AnimateRunner();
5216
+ return {
5217
+ start: run,
5218
+ end: run
5219
+ };
5220
+
5221
+ function run() {
5222
+ $$rAF(function() {
5223
+ applyAnimationContents();
5224
+ if (!closed) {
5225
+ runner.complete();
5226
+ }
5227
+ closed = true;
5228
+ });
5229
+ return runner;
5230
+ }
5231
+
5232
+ function applyAnimationContents() {
5233
+ if (options.addClass) {
5234
+ element.addClass(options.addClass);
5235
+ options.addClass = null;
5236
+ }
5237
+ if (options.removeClass) {
5238
+ element.removeClass(options.removeClass);
5239
+ options.removeClass = null;
5240
+ }
5241
+ if (options.to) {
5242
+ element.css(options.to);
5243
+ options.to = null;
5244
+ }
5245
+ }
5246
+ };
5247
+ }];
5248
+ };
5249
+
5250
+
5251
+ function Browser(window, document, $log, $sniffer) {
5252
+ var self = this,
5253
+ location = window.location,
5254
+ history = window.history,
5255
+ setTimeout = window.setTimeout,
5256
+ clearTimeout = window.clearTimeout,
5257
+ pendingDeferIds = {};
5258
+
5259
+ self.isMock = false;
5260
+
5261
+ var outstandingRequestCount = 0;
5262
+ var outstandingRequestCallbacks = [];
5263
+
5264
+ self.$$completeOutstandingRequest = completeOutstandingRequest;
5265
+ self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
5266
+
5267
+ function completeOutstandingRequest(fn) {
5268
+ try {
5269
+ fn.apply(null, sliceArgs(arguments, 1));
5270
+ } finally {
5271
+ outstandingRequestCount--;
5272
+ if (outstandingRequestCount === 0) {
5273
+ while (outstandingRequestCallbacks.length) {
5274
+ try {
5275
+ outstandingRequestCallbacks.pop()();
5276
+ } catch (e) {
5277
+ $log.error(e);
5278
+ }
5279
+ }
5280
+ }
5281
+ }
5282
+ }
5283
+
5284
+ function getHash(url) {
5285
+ var index = url.indexOf('#');
5286
+ return index === -1 ? '' : url.substr(index);
5287
+ }
5288
+
5289
+ self.notifyWhenNoOutstandingRequests = function(callback) {
5290
+ if (outstandingRequestCount === 0) {
5291
+ callback();
5292
+ } else {
5293
+ outstandingRequestCallbacks.push(callback);
5294
+ }
5295
+ };
5296
+
5297
+
5298
+ var cachedState, lastHistoryState,
5299
+ lastBrowserUrl = location.href,
5300
+ baseElement = document.find('base'),
5301
+ pendingLocation = null,
5302
+ getCurrentState = !$sniffer.history ? noop : function getCurrentState() {
5303
+ try {
5304
+ return history.state;
5305
+ } catch (e) {
5306
+ }
5307
+ };
5308
+
5309
+ cacheState();
5310
+ lastHistoryState = cachedState;
5311
+
5312
+ self.url = function(url, replace, state) {
5313
+ if (isUndefined(state)) {
5314
+ state = null;
5315
+ }
5316
+
5317
+ if (location !== window.location) location = window.location;
5318
+ if (history !== window.history) history = window.history;
5319
+
5320
+ if (url) {
5321
+ var sameState = lastHistoryState === state;
5322
+
5323
+ if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {
5324
+ return self;
5325
+ }
5326
+ var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);
5327
+ lastBrowserUrl = url;
5328
+ lastHistoryState = state;
5329
+ if ($sniffer.history && (!sameBase || !sameState)) {
5330
+ history[replace ? 'replaceState' : 'pushState'](state, '', url);
5331
+ cacheState();
5332
+ lastHistoryState = cachedState;
5333
+ } else {
5334
+ if (!sameBase) {
5335
+ pendingLocation = url;
5336
+ }
5337
+ if (replace) {
5338
+ location.replace(url);
5339
+ } else if (!sameBase) {
5340
+ location.href = url;
5341
+ } else {
5342
+ location.hash = getHash(url);
5343
+ }
5344
+ if (location.href !== url) {
5345
+ pendingLocation = url;
5346
+ }
5347
+ }
5348
+ if (pendingLocation) {
5349
+ pendingLocation = url;
5350
+ }
5351
+ return self;
5352
+ } else {
5353
+ return pendingLocation || location.href.replace(/%27/g,'\'');
5354
+ }
5355
+ };
5356
+
5357
+ self.state = function() {
5358
+ return cachedState;
5359
+ };
5360
+
5361
+ var urlChangeListeners = [],
5362
+ urlChangeInit = false;
5363
+
5364
+ function cacheStateAndFireUrlChange() {
5365
+ pendingLocation = null;
5366
+ cacheState();
5367
+ fireUrlChange();
5368
+ }
5369
+
5370
+ var lastCachedState = null;
5371
+ function cacheState() {
5372
+ cachedState = getCurrentState();
5373
+ cachedState = isUndefined(cachedState) ? null : cachedState;
5374
+
5375
+ if (equals(cachedState, lastCachedState)) {
5376
+ cachedState = lastCachedState;
5377
+ }
5378
+ lastCachedState = cachedState;
5379
+ }
5380
+
5381
+ function fireUrlChange() {
5382
+ if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {
5383
+ return;
5384
+ }
5385
+
5386
+ lastBrowserUrl = self.url();
5387
+ lastHistoryState = cachedState;
5388
+ forEach(urlChangeListeners, function(listener) {
5389
+ listener(self.url(), cachedState);
5390
+ });
5391
+ }
5392
+
5393
+ self.onUrlChange = function(callback) {
5394
+ if (!urlChangeInit) {
5395
+
5396
+ if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);
5397
+ jqLite(window).on('hashchange', cacheStateAndFireUrlChange);
5398
+
5399
+ urlChangeInit = true;
5400
+ }
5401
+
5402
+ urlChangeListeners.push(callback);
5403
+ return callback;
5404
+ };
5405
+
5406
+ self.$$applicationDestroyed = function() {
5407
+ jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);
5408
+ };
5409
+
5410
+ self.$$checkUrlChange = fireUrlChange;
5411
+
5412
+
5413
+ self.baseHref = function() {
5414
+ var href = baseElement.attr('href');
5415
+ return href ? href.replace(/^(https?:)?\/\/[^/]*/, '') : '';
5416
+ };
5417
+
5418
+ self.defer = function(fn, delay) {
5419
+ var timeoutId;
5420
+ outstandingRequestCount++;
5421
+ timeoutId = setTimeout(function() {
5422
+ delete pendingDeferIds[timeoutId];
5423
+ completeOutstandingRequest(fn);
5424
+ }, delay || 0);
5425
+ pendingDeferIds[timeoutId] = true;
5426
+ return timeoutId;
5427
+ };
5428
+
5429
+
5430
+ self.defer.cancel = function(deferId) {
5431
+ if (pendingDeferIds[deferId]) {
5432
+ delete pendingDeferIds[deferId];
5433
+ clearTimeout(deferId);
5434
+ completeOutstandingRequest(noop);
5435
+ return true;
5436
+ }
5437
+ return false;
5438
+ };
5439
+
5440
+ }
5441
+
5442
+ function $BrowserProvider() {
5443
+ this.$get = ['$window', '$log', '$sniffer', '$document',
5444
+ function($window, $log, $sniffer, $document) {
5445
+ return new Browser($window, $document, $log, $sniffer);
5446
+ }];
5447
+ }
5448
+
5449
+ function $CacheFactoryProvider() {
5450
+
5451
+ this.$get = function() {
5452
+ var caches = {};
5453
+
5454
+ function cacheFactory(cacheId, options) {
5455
+ if (cacheId in caches) {
5456
+ throw minErr('$cacheFactory')('iid', 'CacheId \'{0}\' is already taken!', cacheId);
5457
+ }
5458
+
5459
+ var size = 0,
5460
+ stats = extend({}, options, {id: cacheId}),
5461
+ data = createMap(),
5462
+ capacity = (options && options.capacity) || Number.MAX_VALUE,
5463
+ lruHash = createMap(),
5464
+ freshEnd = null,
5465
+ staleEnd = null;
5466
+
5467
+ return (caches[cacheId] = {
5468
+
5469
+ put: function(key, value) {
5470
+ if (isUndefined(value)) return;
5471
+ if (capacity < Number.MAX_VALUE) {
5472
+ var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
5473
+
5474
+ refresh(lruEntry);
5475
+ }
5476
+
5477
+ if (!(key in data)) size++;
5478
+ data[key] = value;
5479
+
5480
+ if (size > capacity) {
5481
+ this.remove(staleEnd.key);
5482
+ }
5483
+
5484
+ return value;
5485
+ },
5486
+
5487
+ get: function(key) {
5488
+ if (capacity < Number.MAX_VALUE) {
5489
+ var lruEntry = lruHash[key];
5490
+
5491
+ if (!lruEntry) return;
5492
+
5493
+ refresh(lruEntry);
5494
+ }
5495
+
5496
+ return data[key];
5497
+ },
5498
+
5499
+
5500
+ remove: function(key) {
5501
+ if (capacity < Number.MAX_VALUE) {
5502
+ var lruEntry = lruHash[key];
5503
+
5504
+ if (!lruEntry) return;
5505
+
5506
+ if (lruEntry === freshEnd) freshEnd = lruEntry.p;
5507
+ if (lruEntry === staleEnd) staleEnd = lruEntry.n;
5508
+ link(lruEntry.n,lruEntry.p);
5509
+
5510
+ delete lruHash[key];
5511
+ }
5512
+
5513
+ if (!(key in data)) return;
5514
+
5515
+ delete data[key];
5516
+ size--;
5517
+ },
5518
+
5519
+
5520
+ removeAll: function() {
5521
+ data = createMap();
5522
+ size = 0;
5523
+ lruHash = createMap();
5524
+ freshEnd = staleEnd = null;
5525
+ },
5526
+
5527
+
5528
+ destroy: function() {
5529
+ data = null;
5530
+ stats = null;
5531
+ lruHash = null;
5532
+ delete caches[cacheId];
5533
+ },
5534
+
5535
+
5536
+ info: function() {
5537
+ return extend({}, stats, {size: size});
5538
+ }
5539
+ });
5540
+
5541
+
5542
+ function refresh(entry) {
5543
+ if (entry !== freshEnd) {
5544
+ if (!staleEnd) {
5545
+ staleEnd = entry;
5546
+ } else if (staleEnd === entry) {
5547
+ staleEnd = entry.n;
5548
+ }
5549
+
5550
+ link(entry.n, entry.p);
5551
+ link(entry, freshEnd);
5552
+ freshEnd = entry;
5553
+ freshEnd.n = null;
5554
+ }
5555
+ }
5556
+
5557
+
5558
+ function link(nextEntry, prevEntry) {
5559
+ if (nextEntry !== prevEntry) {
5560
+ if (nextEntry) nextEntry.p = prevEntry;
5561
+ if (prevEntry) prevEntry.n = nextEntry;
5562
+ }
5563
+ }
5564
+ }
5565
+
5566
+
5567
+ cacheFactory.info = function() {
5568
+ var info = {};
5569
+ forEach(caches, function(cache, cacheId) {
5570
+ info[cacheId] = cache.info();
5571
+ });
5572
+ return info;
5573
+ };
5574
+
5575
+
5576
+ cacheFactory.get = function(cacheId) {
5577
+ return caches[cacheId];
5578
+ };
5579
+
5580
+
5581
+ return cacheFactory;
5582
+ };
5583
+ }
5584
+
5585
+ function $TemplateCacheProvider() {
5586
+ this.$get = ['$cacheFactory', function($cacheFactory) {
5587
+ return $cacheFactory('templates');
5588
+ }];
5589
+ }
5590
+
5591
+
5592
+
5593
+
5594
+
5595
+ var $compileMinErr = minErr('$compile');
5596
+
5597
+ function UNINITIALIZED_VALUE() {}
5598
+ var _UNINITIALIZED_VALUE = new UNINITIALIZED_VALUE();
5599
+
5600
+ $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
5601
+ function $CompileProvider($provide, $$sanitizeUriProvider) {
5602
+ var hasDirectives = {},
5603
+ Suffix = 'Directive',
5604
+ COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/,
5605
+ CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/,
5606
+ ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
5607
+ REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
5608
+
5609
+ var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
5610
+ var bindingCache = createMap();
5611
+
5612
+ function parseIsolateBindings(scope, directiveName, isController) {
5613
+ var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/;
5614
+
5615
+ var bindings = createMap();
5616
+
5617
+ forEach(scope, function(definition, scopeName) {
5618
+ if (definition in bindingCache) {
5619
+ bindings[scopeName] = bindingCache[definition];
5620
+ return;
5621
+ }
5622
+ var match = definition.match(LOCAL_REGEXP);
5623
+
5624
+ if (!match) {
5625
+ throw $compileMinErr('iscp',
5626
+ 'Invalid {3} for directive \'{0}\'.' +
5627
+ ' Definition: {... {1}: \'{2}\' ...}',
5628
+ directiveName, scopeName, definition,
5629
+ (isController ? 'controller bindings definition' :
5630
+ 'isolate scope definition'));
5631
+ }
5632
+
5633
+ bindings[scopeName] = {
5634
+ mode: match[1][0],
5635
+ collection: match[2] === '*',
5636
+ optional: match[3] === '?',
5637
+ attrName: match[4] || scopeName
5638
+ };
5639
+ if (match[4]) {
5640
+ bindingCache[definition] = bindings[scopeName];
5641
+ }
5642
+ });
5643
+
5644
+ return bindings;
5645
+ }
5646
+
5647
+ function parseDirectiveBindings(directive, directiveName) {
5648
+ var bindings = {
5649
+ isolateScope: null,
5650
+ bindToController: null
5651
+ };
5652
+ if (isObject(directive.scope)) {
5653
+ if (directive.bindToController === true) {
5654
+ bindings.bindToController = parseIsolateBindings(directive.scope,
5655
+ directiveName, true);
5656
+ bindings.isolateScope = {};
5657
+ } else {
5658
+ bindings.isolateScope = parseIsolateBindings(directive.scope,
5659
+ directiveName, false);
5660
+ }
5661
+ }
5662
+ if (isObject(directive.bindToController)) {
5663
+ bindings.bindToController =
5664
+ parseIsolateBindings(directive.bindToController, directiveName, true);
5665
+ }
5666
+ if (bindings.bindToController && !directive.controller) {
5667
+ throw $compileMinErr('noctrl',
5668
+ 'Cannot bind to controller without directive \'{0}\'s controller.',
5669
+ directiveName);
5670
+ }
5671
+ return bindings;
5672
+ }
5673
+
5674
+ function assertValidDirectiveName(name) {
5675
+ var letter = name.charAt(0);
5676
+ if (!letter || letter !== lowercase(letter)) {
5677
+ throw $compileMinErr('baddir', 'Directive/Component name \'{0}\' is invalid. The first character must be a lowercase letter', name);
5678
+ }
5679
+ if (name !== name.trim()) {
5680
+ throw $compileMinErr('baddir',
5681
+ 'Directive/Component name \'{0}\' is invalid. The name should not contain leading or trailing whitespaces',
5682
+ name);
5683
+ }
5684
+ }
5685
+
5686
+ function getDirectiveRequire(directive) {
5687
+ var require = directive.require || (directive.controller && directive.name);
5688
+
5689
+ if (!isArray(require) && isObject(require)) {
5690
+ forEach(require, function(value, key) {
5691
+ var match = value.match(REQUIRE_PREFIX_REGEXP);
5692
+ var name = value.substring(match[0].length);
5693
+ if (!name) require[key] = match[0] + key;
5694
+ });
5695
+ }
5696
+
5697
+ return require;
5698
+ }
5699
+
5700
+ function getDirectiveRestrict(restrict, name) {
5701
+ if (restrict && !(isString(restrict) && /[EACM]/.test(restrict))) {
5702
+ throw $compileMinErr('badrestrict',
5703
+ 'Restrict property \'{0}\' of directive \'{1}\' is invalid',
5704
+ restrict,
5705
+ name);
5706
+ }
5707
+
5708
+ return restrict || 'EA';
5709
+ }
5710
+
5711
+ this.directive = function registerDirective(name, directiveFactory) {
5712
+ assertArg(name, 'name');
5713
+ assertNotHasOwnProperty(name, 'directive');
5714
+ if (isString(name)) {
5715
+ assertValidDirectiveName(name);
5716
+ assertArg(directiveFactory, 'directiveFactory');
5717
+ if (!hasDirectives.hasOwnProperty(name)) {
5718
+ hasDirectives[name] = [];
5719
+ $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
5720
+ function($injector, $exceptionHandler) {
5721
+ var directives = [];
5722
+ forEach(hasDirectives[name], function(directiveFactory, index) {
5723
+ try {
5724
+ var directive = $injector.invoke(directiveFactory);
5725
+ if (isFunction(directive)) {
5726
+ directive = { compile: valueFn(directive) };
5727
+ } else if (!directive.compile && directive.link) {
5728
+ directive.compile = valueFn(directive.link);
5729
+ }
5730
+ directive.priority = directive.priority || 0;
5731
+ directive.index = index;
5732
+ directive.name = directive.name || name;
5733
+ directive.require = getDirectiveRequire(directive);
5734
+ directive.restrict = getDirectiveRestrict(directive.restrict, name);
5735
+ directive.$$moduleName = directiveFactory.$$moduleName;
5736
+ directives.push(directive);
5737
+ } catch (e) {
5738
+ $exceptionHandler(e);
5739
+ }
5740
+ });
5741
+ return directives;
5742
+ }]);
5743
+ }
5744
+ hasDirectives[name].push(directiveFactory);
5745
+ } else {
5746
+ forEach(name, reverseParams(registerDirective));
5747
+ }
5748
+ return this;
5749
+ };
5750
+
5751
+ this.component = function registerComponent(name, options) {
5752
+ var controller = options.controller || function() {};
5753
+
5754
+ function factory($injector) {
5755
+ function makeInjectable(fn) {
5756
+ if (isFunction(fn) || isArray(fn)) {
5757
+ return function(tElement, tAttrs) {
5758
+ return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});
5759
+ };
5760
+ } else {
5761
+ return fn;
5762
+ }
5763
+ }
5764
+
5765
+ var template = (!options.template && !options.templateUrl ? '' : options.template);
5766
+ var ddo = {
5767
+ controller: controller,
5768
+ controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl',
5769
+ template: makeInjectable(template),
5770
+ templateUrl: makeInjectable(options.templateUrl),
5771
+ transclude: options.transclude,
5772
+ scope: {},
5773
+ bindToController: options.bindings || {},
5774
+ restrict: 'E',
5775
+ require: options.require
5776
+ };
5777
+
5778
+ forEach(options, function(val, key) {
5779
+ if (key.charAt(0) === '$') ddo[key] = val;
5780
+ });
5781
+
5782
+ return ddo;
5783
+ }
5784
+
5785
+
5786
+ forEach(options, function(val, key) {
5787
+ if (key.charAt(0) === '$') {
5788
+ factory[key] = val;
5789
+ if (isFunction(controller)) controller[key] = val;
5790
+ }
5791
+ });
5792
+
5793
+ factory.$inject = ['$injector'];
5794
+
5795
+ return this.directive(name, factory);
5796
+ };
5797
+
5798
+
5799
+ this.aHrefSanitizationWhitelist = function(regexp) {
5800
+ if (isDefined(regexp)) {
5801
+ $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);
5802
+ return this;
5803
+ } else {
5804
+ return $$sanitizeUriProvider.aHrefSanitizationWhitelist();
5805
+ }
5806
+ };
5807
+
5808
+
5809
+ this.imgSrcSanitizationWhitelist = function(regexp) {
5810
+ if (isDefined(regexp)) {
5811
+ $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);
5812
+ return this;
5813
+ } else {
5814
+ return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();
5815
+ }
5816
+ };
5817
+
5818
+ var debugInfoEnabled = true;
5819
+ this.debugInfoEnabled = function(enabled) {
5820
+ if (isDefined(enabled)) {
5821
+ debugInfoEnabled = enabled;
5822
+ return this;
5823
+ }
5824
+ return debugInfoEnabled;
5825
+ };
5826
+
5827
+ var preAssignBindingsEnabled = false;
5828
+ this.preAssignBindingsEnabled = function(enabled) {
5829
+ if (isDefined(enabled)) {
5830
+ preAssignBindingsEnabled = enabled;
5831
+ return this;
5832
+ }
5833
+ return preAssignBindingsEnabled;
5834
+ };
5835
+
5836
+
5837
+ var TTL = 10;
5838
+ this.onChangesTtl = function(value) {
5839
+ if (arguments.length) {
5840
+ TTL = value;
5841
+ return this;
5842
+ }
5843
+ return TTL;
5844
+ };
5845
+
5846
+ var commentDirectivesEnabledConfig = true;
5847
+ this.commentDirectivesEnabled = function(value) {
5848
+ if (arguments.length) {
5849
+ commentDirectivesEnabledConfig = value;
5850
+ return this;
5851
+ }
5852
+ return commentDirectivesEnabledConfig;
5853
+ };
5854
+
5855
+
5856
+ var cssClassDirectivesEnabledConfig = true;
5857
+ this.cssClassDirectivesEnabled = function(value) {
5858
+ if (arguments.length) {
5859
+ cssClassDirectivesEnabledConfig = value;
5860
+ return this;
5861
+ }
5862
+ return cssClassDirectivesEnabledConfig;
5863
+ };
5864
+
5865
+ this.$get = [
5866
+ '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',
5867
+ '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',
5868
+ function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse,
5869
+ $controller, $rootScope, $sce, $animate, $$sanitizeUri) {
5870
+
5871
+ var SIMPLE_ATTR_NAME = /^\w/;
5872
+ var specialAttrHolder = window.document.createElement('div');
5873
+
5874
+
5875
+ var commentDirectivesEnabled = commentDirectivesEnabledConfig;
5876
+ var cssClassDirectivesEnabled = cssClassDirectivesEnabledConfig;
5877
+
5878
+
5879
+ var onChangesTtl = TTL;
5880
+ var onChangesQueue;
5881
+
5882
+ function flushOnChangesQueue() {
5883
+ try {
5884
+ if (!(--onChangesTtl)) {
5885
+ onChangesQueue = undefined;
5886
+ throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\n', TTL);
5887
+ }
5888
+ $rootScope.$apply(function() {
5889
+ var errors = [];
5890
+ for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) {
5891
+ try {
5892
+ onChangesQueue[i]();
5893
+ } catch (e) {
5894
+ errors.push(e);
5895
+ }
5896
+ }
5897
+ onChangesQueue = undefined;
5898
+ if (errors.length) {
5899
+ throw errors;
5900
+ }
5901
+ });
5902
+ } finally {
5903
+ onChangesTtl++;
5904
+ }
5905
+ }
5906
+
5907
+
5908
+ function Attributes(element, attributesToCopy) {
5909
+ if (attributesToCopy) {
5910
+ var keys = Object.keys(attributesToCopy);
5911
+ var i, l, key;
5912
+
5913
+ for (i = 0, l = keys.length; i < l; i++) {
5914
+ key = keys[i];
5915
+ this[key] = attributesToCopy[key];
5916
+ }
5917
+ } else {
5918
+ this.$attr = {};
5919
+ }
5920
+
5921
+ this.$$element = element;
5922
+ }
5923
+
5924
+ Attributes.prototype = {
5925
+ $normalize: directiveNormalize,
5926
+
5927
+
5928
+ $addClass: function(classVal) {
5929
+ if (classVal && classVal.length > 0) {
5930
+ $animate.addClass(this.$$element, classVal);
5931
+ }
5932
+ },
5933
+
5934
+ $removeClass: function(classVal) {
5935
+ if (classVal && classVal.length > 0) {
5936
+ $animate.removeClass(this.$$element, classVal);
5937
+ }
5938
+ },
5939
+
5940
+ $updateClass: function(newClasses, oldClasses) {
5941
+ var toAdd = tokenDifference(newClasses, oldClasses);
5942
+ if (toAdd && toAdd.length) {
5943
+ $animate.addClass(this.$$element, toAdd);
5944
+ }
5945
+
5946
+ var toRemove = tokenDifference(oldClasses, newClasses);
5947
+ if (toRemove && toRemove.length) {
5948
+ $animate.removeClass(this.$$element, toRemove);
5949
+ }
5950
+ },
5951
+
5952
+ $set: function(key, value, writeAttr, attrName) {
5953
+
5954
+ var node = this.$$element[0],
5955
+ booleanKey = getBooleanAttrName(node, key),
5956
+ aliasedKey = getAliasedAttrName(key),
5957
+ observer = key,
5958
+ nodeName;
5959
+
5960
+ if (booleanKey) {
5961
+ this.$$element.prop(key, value);
5962
+ attrName = booleanKey;
5963
+ } else if (aliasedKey) {
5964
+ this[aliasedKey] = value;
5965
+ observer = aliasedKey;
5966
+ }
5967
+
5968
+ this[key] = value;
5969
+
5970
+ if (attrName) {
5971
+ this.$attr[key] = attrName;
5972
+ } else {
5973
+ attrName = this.$attr[key];
5974
+ if (!attrName) {
5975
+ this.$attr[key] = attrName = snake_case(key, '-');
5976
+ }
5977
+ }
5978
+
5979
+ nodeName = nodeName_(this.$$element);
5980
+
5981
+ if ((nodeName === 'a' && (key === 'href' || key === 'xlinkHref')) ||
5982
+ (nodeName === 'img' && key === 'src')) {
5983
+ this[key] = value = $$sanitizeUri(value, key === 'src');
5984
+ } else if (nodeName === 'img' && key === 'srcset' && isDefined(value)) {
5985
+ var result = '';
5986
+
5987
+ var trimmedSrcset = trim(value);
5988
+ var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/;
5989
+ var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/;
5990
+
5991
+ var rawUris = trimmedSrcset.split(pattern);
5992
+
5993
+ var nbrUrisWith2parts = Math.floor(rawUris.length / 2);
5994
+ for (var i = 0; i < nbrUrisWith2parts; i++) {
5995
+ var innerIdx = i * 2;
5996
+ result += $$sanitizeUri(trim(rawUris[innerIdx]), true);
5997
+ result += (' ' + trim(rawUris[innerIdx + 1]));
5998
+ }
5999
+
6000
+ var lastTuple = trim(rawUris[i * 2]).split(/\s/);
6001
+
6002
+ result += $$sanitizeUri(trim(lastTuple[0]), true);
6003
+
6004
+ if (lastTuple.length === 2) {
6005
+ result += (' ' + trim(lastTuple[1]));
6006
+ }
6007
+ this[key] = value = result;
6008
+ }
6009
+
6010
+ if (writeAttr !== false) {
6011
+ if (value === null || isUndefined(value)) {
6012
+ this.$$element.removeAttr(attrName);
6013
+ } else {
6014
+ if (SIMPLE_ATTR_NAME.test(attrName)) {
6015
+ this.$$element.attr(attrName, value);
6016
+ } else {
6017
+ setSpecialAttr(this.$$element[0], attrName, value);
6018
+ }
6019
+ }
6020
+ }
6021
+
6022
+ var $$observers = this.$$observers;
6023
+ if ($$observers) {
6024
+ forEach($$observers[observer], function(fn) {
6025
+ try {
6026
+ fn(value);
6027
+ } catch (e) {
6028
+ $exceptionHandler(e);
6029
+ }
6030
+ });
6031
+ }
6032
+ },
6033
+
6034
+
6035
+ $observe: function(key, fn) {
6036
+ var attrs = this,
6037
+ $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),
6038
+ listeners = ($$observers[key] || ($$observers[key] = []));
6039
+
6040
+ listeners.push(fn);
6041
+ $rootScope.$evalAsync(function() {
6042
+ if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {
6043
+ fn(attrs[key]);
6044
+ }
6045
+ });
6046
+
6047
+ return function() {
6048
+ arrayRemove(listeners, fn);
6049
+ };
6050
+ }
6051
+ };
6052
+
6053
+ function setSpecialAttr(element, attrName, value) {
6054
+ specialAttrHolder.innerHTML = '<span ' + attrName + '>';
6055
+ var attributes = specialAttrHolder.firstChild.attributes;
6056
+ var attribute = attributes[0];
6057
+ attributes.removeNamedItem(attribute.name);
6058
+ attribute.value = value;
6059
+ element.attributes.setNamedItem(attribute);
6060
+ }
6061
+
6062
+ function safeAddClass($element, className) {
6063
+ try {
6064
+ $element.addClass(className);
6065
+ } catch (e) {
6066
+ }
6067
+ }
6068
+
6069
+
6070
+ var startSymbol = $interpolate.startSymbol(),
6071
+ endSymbol = $interpolate.endSymbol(),
6072
+ denormalizeTemplate = (startSymbol === '{{' && endSymbol === '}}')
6073
+ ? identity
6074
+ : function denormalizeTemplate(template) {
6075
+ return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
6076
+ },
6077
+ NG_ATTR_BINDING = /^ngAttr[A-Z]/;
6078
+ var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
6079
+
6080
+ compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {
6081
+ var bindings = $element.data('$binding') || [];
6082
+
6083
+ if (isArray(binding)) {
6084
+ bindings = bindings.concat(binding);
6085
+ } else {
6086
+ bindings.push(binding);
6087
+ }
6088
+
6089
+ $element.data('$binding', bindings);
6090
+ } : noop;
6091
+
6092
+ compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {
6093
+ safeAddClass($element, 'ng-binding');
6094
+ } : noop;
6095
+
6096
+ compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {
6097
+ var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';
6098
+ $element.data(dataName, scope);
6099
+ } : noop;
6100
+
6101
+ compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {
6102
+ safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');
6103
+ } : noop;
6104
+
6105
+ compile.$$createComment = function(directiveName, comment) {
6106
+ var content = '';
6107
+ if (debugInfoEnabled) {
6108
+ content = ' ' + (directiveName || '') + ': ';
6109
+ if (comment) content += comment + ' ';
6110
+ }
6111
+ return window.document.createComment(content);
6112
+ };
6113
+
6114
+ return compile;
6115
+
6116
+
6117
+ function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
6118
+ previousCompileContext) {
6119
+ if (!($compileNodes instanceof jqLite)) {
6120
+ $compileNodes = jqLite($compileNodes);
6121
+ }
6122
+ var compositeLinkFn =
6123
+ compileNodes($compileNodes, transcludeFn, $compileNodes,
6124
+ maxPriority, ignoreDirective, previousCompileContext);
6125
+ compile.$$addScopeClass($compileNodes);
6126
+ var namespace = null;
6127
+ return function publicLinkFn(scope, cloneConnectFn, options) {
6128
+ if (!$compileNodes) {
6129
+ throw $compileMinErr('multilink', 'This element has already been linked.');
6130
+ }
6131
+ assertArg(scope, 'scope');
6132
+
6133
+ if (previousCompileContext && previousCompileContext.needsNewScope) {
6134
+ scope = scope.$parent.$new();
6135
+ }
6136
+
6137
+ options = options || {};
6138
+ var parentBoundTranscludeFn = options.parentBoundTranscludeFn,
6139
+ transcludeControllers = options.transcludeControllers,
6140
+ futureParentElement = options.futureParentElement;
6141
+
6142
+ if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {
6143
+ parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;
6144
+ }
6145
+
6146
+ if (!namespace) {
6147
+ namespace = detectNamespaceForChildElements(futureParentElement);
6148
+ }
6149
+ var $linkNode;
6150
+ if (namespace !== 'html') {
6151
+ $linkNode = jqLite(
6152
+ wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())
6153
+ );
6154
+ } else if (cloneConnectFn) {
6155
+ $linkNode = JQLitePrototype.clone.call($compileNodes);
6156
+ } else {
6157
+ $linkNode = $compileNodes;
6158
+ }
6159
+
6160
+ if (transcludeControllers) {
6161
+ for (var controllerName in transcludeControllers) {
6162
+ $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);
6163
+ }
6164
+ }
6165
+
6166
+ compile.$$addScopeInfo($linkNode, scope);
6167
+
6168
+ if (cloneConnectFn) cloneConnectFn($linkNode, scope);
6169
+ if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);
6170
+
6171
+ if (!cloneConnectFn) {
6172
+ $compileNodes = compositeLinkFn = null;
6173
+ }
6174
+ return $linkNode;
6175
+ };
6176
+ }
6177
+
6178
+ function detectNamespaceForChildElements(parentElement) {
6179
+ var node = parentElement && parentElement[0];
6180
+ if (!node) {
6181
+ return 'html';
6182
+ } else {
6183
+ return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html';
6184
+ }
6185
+ }
6186
+
6187
+ function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
6188
+ previousCompileContext) {
6189
+ var linkFns = [],
6190
+ notLiveList = isArray(nodeList) || (nodeList instanceof jqLite),
6191
+ attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;
6192
+
6193
+
6194
+ for (var i = 0; i < nodeList.length; i++) {
6195
+ attrs = new Attributes();
6196
+
6197
+ if (msie === 11) {
6198
+ mergeConsecutiveTextNodes(nodeList, i, notLiveList);
6199
+ }
6200
+
6201
+ directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,
6202
+ ignoreDirective);
6203
+
6204
+ nodeLinkFn = (directives.length)
6205
+ ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,
6206
+ null, [], [], previousCompileContext)
6207
+ : null;
6208
+
6209
+ if (nodeLinkFn && nodeLinkFn.scope) {
6210
+ compile.$$addScopeClass(attrs.$$element);
6211
+ }
6212
+
6213
+ childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||
6214
+ !(childNodes = nodeList[i].childNodes) ||
6215
+ !childNodes.length)
6216
+ ? null
6217
+ : compileNodes(childNodes,
6218
+ nodeLinkFn ? (
6219
+ (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)
6220
+ && nodeLinkFn.transclude) : transcludeFn);
6221
+
6222
+ if (nodeLinkFn || childLinkFn) {
6223
+ linkFns.push(i, nodeLinkFn, childLinkFn);
6224
+ linkFnFound = true;
6225
+ nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;
6226
+ }
6227
+
6228
+ previousCompileContext = null;
6229
+ }
6230
+
6231
+ return linkFnFound ? compositeLinkFn : null;
6232
+
6233
+ function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
6234
+ var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
6235
+ var stableNodeList;
6236
+
6237
+
6238
+ if (nodeLinkFnFound) {
6239
+ var nodeListLength = nodeList.length;
6240
+ stableNodeList = new Array(nodeListLength);
6241
+
6242
+ for (i = 0; i < linkFns.length; i += 3) {
6243
+ idx = linkFns[i];
6244
+ stableNodeList[idx] = nodeList[idx];
6245
+ }
6246
+ } else {
6247
+ stableNodeList = nodeList;
6248
+ }
6249
+
6250
+ for (i = 0, ii = linkFns.length; i < ii;) {
6251
+ node = stableNodeList[linkFns[i++]];
6252
+ nodeLinkFn = linkFns[i++];
6253
+ childLinkFn = linkFns[i++];
6254
+
6255
+ if (nodeLinkFn) {
6256
+ if (nodeLinkFn.scope) {
6257
+ childScope = scope.$new();
6258
+ compile.$$addScopeInfo(jqLite(node), childScope);
6259
+ } else {
6260
+ childScope = scope;
6261
+ }
6262
+
6263
+ if (nodeLinkFn.transcludeOnThisElement) {
6264
+ childBoundTranscludeFn = createBoundTranscludeFn(
6265
+ scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
6266
+
6267
+ } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
6268
+ childBoundTranscludeFn = parentBoundTranscludeFn;
6269
+
6270
+ } else if (!parentBoundTranscludeFn && transcludeFn) {
6271
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
6272
+
6273
+ } else {
6274
+ childBoundTranscludeFn = null;
6275
+ }
6276
+
6277
+ nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);
6278
+
6279
+ } else if (childLinkFn) {
6280
+ childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
6281
+ }
6282
+ }
6283
+ }
6284
+ }
6285
+
6286
+ function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) {
6287
+ var node = nodeList[idx];
6288
+ var parent = node.parentNode;
6289
+ var sibling;
6290
+
6291
+ if (node.nodeType !== NODE_TYPE_TEXT) {
6292
+ return;
6293
+ }
6294
+
6295
+ while (true) {
6296
+ sibling = parent ? node.nextSibling : nodeList[idx + 1];
6297
+ if (!sibling || sibling.nodeType !== NODE_TYPE_TEXT) {
6298
+ break;
6299
+ }
6300
+
6301
+ node.nodeValue = node.nodeValue + sibling.nodeValue;
6302
+
6303
+ if (sibling.parentNode) {
6304
+ sibling.parentNode.removeChild(sibling);
6305
+ }
6306
+ if (notLiveList && sibling === nodeList[idx + 1]) {
6307
+ nodeList.splice(idx + 1, 1);
6308
+ }
6309
+ }
6310
+ }
6311
+
6312
+ function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
6313
+ function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
6314
+
6315
+ if (!transcludedScope) {
6316
+ transcludedScope = scope.$new(false, containingScope);
6317
+ transcludedScope.$$transcluded = true;
6318
+ }
6319
+
6320
+ return transcludeFn(transcludedScope, cloneFn, {
6321
+ parentBoundTranscludeFn: previousBoundTranscludeFn,
6322
+ transcludeControllers: controllers,
6323
+ futureParentElement: futureParentElement
6324
+ });
6325
+ }
6326
+
6327
+ var boundSlots = boundTranscludeFn.$$slots = createMap();
6328
+ for (var slotName in transcludeFn.$$slots) {
6329
+ if (transcludeFn.$$slots[slotName]) {
6330
+ boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn);
6331
+ } else {
6332
+ boundSlots[slotName] = null;
6333
+ }
6334
+ }
6335
+
6336
+ return boundTranscludeFn;
6337
+ }
6338
+
6339
+ function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
6340
+ var nodeType = node.nodeType,
6341
+ attrsMap = attrs.$attr,
6342
+ match,
6343
+ nodeName,
6344
+ className;
6345
+
6346
+ switch (nodeType) {
6347
+ case NODE_TYPE_ELEMENT:
6348
+
6349
+ nodeName = nodeName_(node);
6350
+
6351
+ addDirective(directives,
6352
+ directiveNormalize(nodeName), 'E', maxPriority, ignoreDirective);
6353
+
6354
+ for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,
6355
+ j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
6356
+ var attrStartName = false;
6357
+ var attrEndName = false;
6358
+
6359
+ attr = nAttrs[j];
6360
+ name = attr.name;
6361
+ value = attr.value;
6362
+
6363
+ ngAttrName = directiveNormalize(name);
6364
+ isNgAttr = NG_ATTR_BINDING.test(ngAttrName);
6365
+ if (isNgAttr) {
6366
+ name = name.replace(PREFIX_REGEXP, '')
6367
+ .substr(8).replace(/_(.)/g, function(match, letter) {
6368
+ return letter.toUpperCase();
6369
+ });
6370
+ }
6371
+
6372
+ var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);
6373
+ if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {
6374
+ attrStartName = name;
6375
+ attrEndName = name.substr(0, name.length - 5) + 'end';
6376
+ name = name.substr(0, name.length - 6);
6377
+ }
6378
+
6379
+ nName = directiveNormalize(name.toLowerCase());
6380
+ attrsMap[nName] = name;
6381
+ if (isNgAttr || !attrs.hasOwnProperty(nName)) {
6382
+ attrs[nName] = value;
6383
+ if (getBooleanAttrName(node, nName)) {
6384
+ attrs[nName] = true;
6385
+ }
6386
+ }
6387
+ addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);
6388
+ addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
6389
+ attrEndName);
6390
+ }
6391
+
6392
+ if (nodeName === 'input' && node.getAttribute('type') === 'hidden') {
6393
+ node.setAttribute('autocomplete', 'off');
6394
+ }
6395
+
6396
+ if (!cssClassDirectivesEnabled) break;
6397
+ className = node.className;
6398
+ if (isObject(className)) {
6399
+ className = className.animVal;
6400
+ }
6401
+ if (isString(className) && className !== '') {
6402
+ while ((match = CLASS_DIRECTIVE_REGEXP.exec(className))) {
6403
+ nName = directiveNormalize(match[2]);
6404
+ if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {
6405
+ attrs[nName] = trim(match[3]);
6406
+ }
6407
+ className = className.substr(match.index + match[0].length);
6408
+ }
6409
+ }
6410
+ break;
6411
+ case NODE_TYPE_TEXT:
6412
+ addTextInterpolateDirective(directives, node.nodeValue);
6413
+ break;
6414
+ case NODE_TYPE_COMMENT:
6415
+ if (!commentDirectivesEnabled) break;
6416
+ collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective);
6417
+ break;
6418
+ }
6419
+
6420
+ directives.sort(byPriority);
6421
+ return directives;
6422
+ }
6423
+
6424
+ function collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
6425
+ try {
6426
+ var match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
6427
+ if (match) {
6428
+ var nName = directiveNormalize(match[1]);
6429
+ if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
6430
+ attrs[nName] = trim(match[2]);
6431
+ }
6432
+ }
6433
+ } catch (e) {
6434
+ }
6435
+ }
6436
+
6437
+ function groupScan(node, attrStart, attrEnd) {
6438
+ var nodes = [];
6439
+ var depth = 0;
6440
+ if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
6441
+ do {
6442
+ if (!node) {
6443
+ throw $compileMinErr('uterdir',
6444
+ 'Unterminated attribute, found \'{0}\' but no matching \'{1}\' found.',
6445
+ attrStart, attrEnd);
6446
+ }
6447
+ if (node.nodeType === NODE_TYPE_ELEMENT) {
6448
+ if (node.hasAttribute(attrStart)) depth++;
6449
+ if (node.hasAttribute(attrEnd)) depth--;
6450
+ }
6451
+ nodes.push(node);
6452
+ node = node.nextSibling;
6453
+ } while (depth > 0);
6454
+ } else {
6455
+ nodes.push(node);
6456
+ }
6457
+
6458
+ return jqLite(nodes);
6459
+ }
6460
+
6461
+ function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
6462
+ return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) {
6463
+ element = groupScan(element[0], attrStart, attrEnd);
6464
+ return linkFn(scope, element, attrs, controllers, transcludeFn);
6465
+ };
6466
+ }
6467
+
6468
+ function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
6469
+ var compiled;
6470
+
6471
+ if (eager) {
6472
+ return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
6473
+ }
6474
+ return function lazyCompilation() {
6475
+ if (!compiled) {
6476
+ compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
6477
+
6478
+ $compileNodes = transcludeFn = previousCompileContext = null;
6479
+ }
6480
+ return compiled.apply(this, arguments);
6481
+ };
6482
+ }
6483
+
6484
+ function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
6485
+ jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
6486
+ previousCompileContext) {
6487
+ previousCompileContext = previousCompileContext || {};
6488
+
6489
+ var terminalPriority = -Number.MAX_VALUE,
6490
+ newScopeDirective = previousCompileContext.newScopeDirective,
6491
+ controllerDirectives = previousCompileContext.controllerDirectives,
6492
+ newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
6493
+ templateDirective = previousCompileContext.templateDirective,
6494
+ nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
6495
+ hasTranscludeDirective = false,
6496
+ hasTemplate = false,
6497
+ hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
6498
+ $compileNode = templateAttrs.$$element = jqLite(compileNode),
6499
+ directive,
6500
+ directiveName,
6501
+ $template,
6502
+ replaceDirective = originalReplaceDirective,
6503
+ childTranscludeFn = transcludeFn,
6504
+ linkFn,
6505
+ didScanForMultipleTransclusion = false,
6506
+ mightHaveMultipleTransclusionError = false,
6507
+ directiveValue;
6508
+
6509
+ for (var i = 0, ii = directives.length; i < ii; i++) {
6510
+ directive = directives[i];
6511
+ var attrStart = directive.$$start;
6512
+ var attrEnd = directive.$$end;
6513
+
6514
+ if (attrStart) {
6515
+ $compileNode = groupScan(compileNode, attrStart, attrEnd);
6516
+ }
6517
+ $template = undefined;
6518
+
6519
+ if (terminalPriority > directive.priority) {
6520
+ break;
6521
+ }
6522
+
6523
+ directiveValue = directive.scope;
6524
+
6525
+ if (directiveValue) {
6526
+
6527
+ if (!directive.templateUrl) {
6528
+ if (isObject(directiveValue)) {
6529
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
6530
+ directive, $compileNode);
6531
+ newIsolateScopeDirective = directive;
6532
+ } else {
6533
+ assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
6534
+ $compileNode);
6535
+ }
6536
+ }
6537
+
6538
+ newScopeDirective = newScopeDirective || directive;
6539
+ }
6540
+
6541
+ directiveName = directive.name;
6542
+
6543
+ if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template))
6544
+ || (directive.transclude && !directive.$$tlb))) {
6545
+ var candidateDirective;
6546
+
6547
+ for (var scanningIndex = i + 1; (candidateDirective = directives[scanningIndex++]);) {
6548
+ if ((candidateDirective.transclude && !candidateDirective.$$tlb)
6549
+ || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {
6550
+ mightHaveMultipleTransclusionError = true;
6551
+ break;
6552
+ }
6553
+ }
6554
+
6555
+ didScanForMultipleTransclusion = true;
6556
+ }
6557
+
6558
+ if (!directive.templateUrl && directive.controller) {
6559
+ controllerDirectives = controllerDirectives || createMap();
6560
+ assertNoDuplicate('\'' + directiveName + '\' controller',
6561
+ controllerDirectives[directiveName], directive, $compileNode);
6562
+ controllerDirectives[directiveName] = directive;
6563
+ }
6564
+
6565
+ directiveValue = directive.transclude;
6566
+
6567
+ if (directiveValue) {
6568
+ hasTranscludeDirective = true;
6569
+
6570
+ if (!directive.$$tlb) {
6571
+ assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
6572
+ nonTlbTranscludeDirective = directive;
6573
+ }
6574
+
6575
+ if (directiveValue === 'element') {
6576
+ hasElementTranscludeDirective = true;
6577
+ terminalPriority = directive.priority;
6578
+ $template = $compileNode;
6579
+ $compileNode = templateAttrs.$$element =
6580
+ jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName]));
6581
+ compileNode = $compileNode[0];
6582
+ replaceWith(jqCollection, sliceArgs($template), compileNode);
6583
+
6584
+
6585
+ $template[0].$$parentNode = $template[0].parentNode;
6586
+
6587
+ childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority,
6588
+ replaceDirective && replaceDirective.name, {
6589
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
6590
+ });
6591
+ } else {
6592
+
6593
+ var slots = createMap();
6594
+
6595
+ if (!isObject(directiveValue)) {
6596
+ $template = jqLite(jqLiteClone(compileNode)).contents();
6597
+ } else {
6598
+
6599
+ $template = [];
6600
+
6601
+ var slotMap = createMap();
6602
+ var filledSlots = createMap();
6603
+
6604
+ forEach(directiveValue, function(elementSelector, slotName) {
6605
+ var optional = (elementSelector.charAt(0) === '?');
6606
+ elementSelector = optional ? elementSelector.substring(1) : elementSelector;
6607
+
6608
+ slotMap[elementSelector] = slotName;
6609
+
6610
+ slots[slotName] = null;
6611
+
6612
+ filledSlots[slotName] = optional;
6613
+ });
6614
+
6615
+ forEach($compileNode.contents(), function(node) {
6616
+ var slotName = slotMap[directiveNormalize(nodeName_(node))];
6617
+ if (slotName) {
6618
+ filledSlots[slotName] = true;
6619
+ slots[slotName] = slots[slotName] || [];
6620
+ slots[slotName].push(node);
6621
+ } else {
6622
+ $template.push(node);
6623
+ }
6624
+ });
6625
+
6626
+ forEach(filledSlots, function(filled, slotName) {
6627
+ if (!filled) {
6628
+ throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName);
6629
+ }
6630
+ });
6631
+
6632
+ for (var slotName in slots) {
6633
+ if (slots[slotName]) {
6634
+ slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn);
6635
+ }
6636
+ }
6637
+ }
6638
+
6639
+ $compileNode.empty();
6640
+ childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined,
6641
+ undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});
6642
+ childTranscludeFn.$$slots = slots;
6643
+ }
6644
+ }
6645
+
6646
+ if (directive.template) {
6647
+ hasTemplate = true;
6648
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
6649
+ templateDirective = directive;
6650
+
6651
+ directiveValue = (isFunction(directive.template))
6652
+ ? directive.template($compileNode, templateAttrs)
6653
+ : directive.template;
6654
+
6655
+ directiveValue = denormalizeTemplate(directiveValue);
6656
+
6657
+ if (directive.replace) {
6658
+ replaceDirective = directive;
6659
+ if (jqLiteIsTextNode(directiveValue)) {
6660
+ $template = [];
6661
+ } else {
6662
+ $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));
6663
+ }
6664
+ compileNode = $template[0];
6665
+
6666
+ if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
6667
+ throw $compileMinErr('tplrt',
6668
+ 'Template for directive \'{0}\' must have exactly one root element. {1}',
6669
+ directiveName, '');
6670
+ }
6671
+
6672
+ replaceWith(jqCollection, $compileNode, compileNode);
6673
+
6674
+ var newTemplateAttrs = {$attr: {}};
6675
+
6676
+ var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);
6677
+ var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));
6678
+
6679
+ if (newIsolateScopeDirective || newScopeDirective) {
6680
+ markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);
6681
+ }
6682
+ directives = directives.concat(templateDirectives).concat(unprocessedDirectives);
6683
+ mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
6684
+
6685
+ ii = directives.length;
6686
+ } else {
6687
+ $compileNode.html(directiveValue);
6688
+ }
6689
+ }
6690
+
6691
+ if (directive.templateUrl) {
6692
+ hasTemplate = true;
6693
+ assertNoDuplicate('template', templateDirective, directive, $compileNode);
6694
+ templateDirective = directive;
6695
+
6696
+ if (directive.replace) {
6697
+ replaceDirective = directive;
6698
+ }
6699
+
6700
+ nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,
6701
+ templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {
6702
+ controllerDirectives: controllerDirectives,
6703
+ newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,
6704
+ newIsolateScopeDirective: newIsolateScopeDirective,
6705
+ templateDirective: templateDirective,
6706
+ nonTlbTranscludeDirective: nonTlbTranscludeDirective
6707
+ });
6708
+ ii = directives.length;
6709
+ } else if (directive.compile) {
6710
+ try {
6711
+ linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
6712
+ var context = directive.$$originalDirective || directive;
6713
+ if (isFunction(linkFn)) {
6714
+ addLinkFns(null, bind(context, linkFn), attrStart, attrEnd);
6715
+ } else if (linkFn) {
6716
+ addLinkFns(bind(context, linkFn.pre), bind(context, linkFn.post), attrStart, attrEnd);
6717
+ }
6718
+ } catch (e) {
6719
+ $exceptionHandler(e, startingTag($compileNode));
6720
+ }
6721
+ }
6722
+
6723
+ if (directive.terminal) {
6724
+ nodeLinkFn.terminal = true;
6725
+ terminalPriority = Math.max(terminalPriority, directive.priority);
6726
+ }
6727
+
6728
+ }
6729
+
6730
+ nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
6731
+ nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;
6732
+ nodeLinkFn.templateOnThisElement = hasTemplate;
6733
+ nodeLinkFn.transclude = childTranscludeFn;
6734
+
6735
+ previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;
6736
+
6737
+ return nodeLinkFn;
6738
+
6739
+
6740
+ function addLinkFns(pre, post, attrStart, attrEnd) {
6741
+ if (pre) {
6742
+ if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
6743
+ pre.require = directive.require;
6744
+ pre.directiveName = directiveName;
6745
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
6746
+ pre = cloneAndAnnotateFn(pre, {isolateScope: true});
6747
+ }
6748
+ preLinkFns.push(pre);
6749
+ }
6750
+ if (post) {
6751
+ if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);
6752
+ post.require = directive.require;
6753
+ post.directiveName = directiveName;
6754
+ if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
6755
+ post = cloneAndAnnotateFn(post, {isolateScope: true});
6756
+ }
6757
+ postLinkFns.push(post);
6758
+ }
6759
+ }
6760
+
6761
+ function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
6762
+ var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,
6763
+ attrs, scopeBindingInfo;
6764
+
6765
+ if (compileNode === linkNode) {
6766
+ attrs = templateAttrs;
6767
+ $element = templateAttrs.$$element;
6768
+ } else {
6769
+ $element = jqLite(linkNode);
6770
+ attrs = new Attributes($element, templateAttrs);
6771
+ }
6772
+
6773
+ controllerScope = scope;
6774
+ if (newIsolateScopeDirective) {
6775
+ isolateScope = scope.$new(true);
6776
+ } else if (newScopeDirective) {
6777
+ controllerScope = scope.$parent;
6778
+ }
6779
+
6780
+ if (boundTranscludeFn) {
6781
+ transcludeFn = controllersBoundTransclude;
6782
+ transcludeFn.$$boundTransclude = boundTranscludeFn;
6783
+ transcludeFn.isSlotFilled = function(slotName) {
6784
+ return !!boundTranscludeFn.$$slots[slotName];
6785
+ };
6786
+ }
6787
+
6788
+ if (controllerDirectives) {
6789
+ elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective);
6790
+ }
6791
+
6792
+ if (newIsolateScopeDirective) {
6793
+ compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||
6794
+ templateDirective === newIsolateScopeDirective.$$originalDirective)));
6795
+ compile.$$addScopeClass($element, true);
6796
+ isolateScope.$$isolateBindings =
6797
+ newIsolateScopeDirective.$$isolateBindings;
6798
+ scopeBindingInfo = initializeDirectiveBindings(scope, attrs, isolateScope,
6799
+ isolateScope.$$isolateBindings,
6800
+ newIsolateScopeDirective);
6801
+ if (scopeBindingInfo.removeWatches) {
6802
+ isolateScope.$on('$destroy', scopeBindingInfo.removeWatches);
6803
+ }
6804
+ }
6805
+
6806
+ for (var name in elementControllers) {
6807
+ var controllerDirective = controllerDirectives[name];
6808
+ var controller = elementControllers[name];
6809
+ var bindings = controllerDirective.$$bindings.bindToController;
6810
+
6811
+ if (preAssignBindingsEnabled) {
6812
+ if (bindings) {
6813
+ controller.bindingInfo =
6814
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
6815
+ } else {
6816
+ controller.bindingInfo = {};
6817
+ }
6818
+
6819
+ var controllerResult = controller();
6820
+ if (controllerResult !== controller.instance) {
6821
+ controller.instance = controllerResult;
6822
+ $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
6823
+ if (controller.bindingInfo.removeWatches) {
6824
+ controller.bindingInfo.removeWatches();
6825
+ }
6826
+ controller.bindingInfo =
6827
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
6828
+ }
6829
+ } else {
6830
+ controller.instance = controller();
6831
+ $element.data('$' + controllerDirective.name + 'Controller', controller.instance);
6832
+ controller.bindingInfo =
6833
+ initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
6834
+ }
6835
+ }
6836
+
6837
+ forEach(controllerDirectives, function(controllerDirective, name) {
6838
+ var require = controllerDirective.require;
6839
+ if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {
6840
+ extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));
6841
+ }
6842
+ });
6843
+
6844
+ forEach(elementControllers, function(controller) {
6845
+ var controllerInstance = controller.instance;
6846
+ if (isFunction(controllerInstance.$onChanges)) {
6847
+ try {
6848
+ controllerInstance.$onChanges(controller.bindingInfo.initialChanges);
6849
+ } catch (e) {
6850
+ $exceptionHandler(e);
6851
+ }
6852
+ }
6853
+ if (isFunction(controllerInstance.$onInit)) {
6854
+ try {
6855
+ controllerInstance.$onInit();
6856
+ } catch (e) {
6857
+ $exceptionHandler(e);
6858
+ }
6859
+ }
6860
+ if (isFunction(controllerInstance.$doCheck)) {
6861
+ controllerScope.$watch(function() { controllerInstance.$doCheck(); });
6862
+ controllerInstance.$doCheck();
6863
+ }
6864
+ if (isFunction(controllerInstance.$onDestroy)) {
6865
+ controllerScope.$on('$destroy', function callOnDestroyHook() {
6866
+ controllerInstance.$onDestroy();
6867
+ });
6868
+ }
6869
+ });
6870
+
6871
+ for (i = 0, ii = preLinkFns.length; i < ii; i++) {
6872
+ linkFn = preLinkFns[i];
6873
+ invokeLinkFn(linkFn,
6874
+ linkFn.isolateScope ? isolateScope : scope,
6875
+ $element,
6876
+ attrs,
6877
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
6878
+ transcludeFn
6879
+ );
6880
+ }
6881
+
6882
+ var scopeToChild = scope;
6883
+ if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {
6884
+ scopeToChild = isolateScope;
6885
+ }
6886
+ if (childLinkFn) {
6887
+ childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
6888
+ }
6889
+
6890
+ for (i = postLinkFns.length - 1; i >= 0; i--) {
6891
+ linkFn = postLinkFns[i];
6892
+ invokeLinkFn(linkFn,
6893
+ linkFn.isolateScope ? isolateScope : scope,
6894
+ $element,
6895
+ attrs,
6896
+ linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
6897
+ transcludeFn
6898
+ );
6899
+ }
6900
+
6901
+ forEach(elementControllers, function(controller) {
6902
+ var controllerInstance = controller.instance;
6903
+ if (isFunction(controllerInstance.$postLink)) {
6904
+ controllerInstance.$postLink();
6905
+ }
6906
+ });
6907
+
6908
+ function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {
6909
+ var transcludeControllers;
6910
+ if (!isScope(scope)) {
6911
+ slotName = futureParentElement;
6912
+ futureParentElement = cloneAttachFn;
6913
+ cloneAttachFn = scope;
6914
+ scope = undefined;
6915
+ }
6916
+
6917
+ if (hasElementTranscludeDirective) {
6918
+ transcludeControllers = elementControllers;
6919
+ }
6920
+ if (!futureParentElement) {
6921
+ futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;
6922
+ }
6923
+ if (slotName) {
6924
+ var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
6925
+ if (slotTranscludeFn) {
6926
+ return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
6927
+ } else if (isUndefined(slotTranscludeFn)) {
6928
+ throw $compileMinErr('noslot',
6929
+ 'No parent directive that requires a transclusion with slot name "{0}". ' +
6930
+ 'Element: {1}',
6931
+ slotName, startingTag($element));
6932
+ }
6933
+ } else {
6934
+ return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
6935
+ }
6936
+ }
6937
+ }
6938
+ }
6939
+
6940
+ function getControllers(directiveName, require, $element, elementControllers) {
6941
+ var value;
6942
+
6943
+ if (isString(require)) {
6944
+ var match = require.match(REQUIRE_PREFIX_REGEXP);
6945
+ var name = require.substring(match[0].length);
6946
+ var inheritType = match[1] || match[3];
6947
+ var optional = match[2] === '?';
6948
+
6949
+ if (inheritType === '^^') {
6950
+ $element = $element.parent();
6951
+ } else {
6952
+ value = elementControllers && elementControllers[name];
6953
+ value = value && value.instance;
6954
+ }
6955
+
6956
+ if (!value) {
6957
+ var dataName = '$' + name + 'Controller';
6958
+ value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);
6959
+ }
6960
+
6961
+ if (!value && !optional) {
6962
+ throw $compileMinErr('ctreq',
6963
+ 'Controller \'{0}\', required by directive \'{1}\', can\'t be found!',
6964
+ name, directiveName);
6965
+ }
6966
+ } else if (isArray(require)) {
6967
+ value = [];
6968
+ for (var i = 0, ii = require.length; i < ii; i++) {
6969
+ value[i] = getControllers(directiveName, require[i], $element, elementControllers);
6970
+ }
6971
+ } else if (isObject(require)) {
6972
+ value = {};
6973
+ forEach(require, function(controller, property) {
6974
+ value[property] = getControllers(directiveName, controller, $element, elementControllers);
6975
+ });
6976
+ }
6977
+
6978
+ return value || null;
6979
+ }
6980
+
6981
+ function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) {
6982
+ var elementControllers = createMap();
6983
+ for (var controllerKey in controllerDirectives) {
6984
+ var directive = controllerDirectives[controllerKey];
6985
+ var locals = {
6986
+ $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
6987
+ $element: $element,
6988
+ $attrs: attrs,
6989
+ $transclude: transcludeFn
6990
+ };
6991
+
6992
+ var controller = directive.controller;
6993
+ if (controller === '@') {
6994
+ controller = attrs[directive.name];
6995
+ }
6996
+
6997
+ var controllerInstance = $controller(controller, locals, true, directive.controllerAs);
6998
+
6999
+ elementControllers[directive.name] = controllerInstance;
7000
+ $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
7001
+ }
7002
+ return elementControllers;
7003
+ }
7004
+
7005
+ function markDirectiveScope(directives, isolateScope, newScope) {
7006
+ for (var j = 0, jj = directives.length; j < jj; j++) {
7007
+ directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});
7008
+ }
7009
+ }
7010
+
7011
+ function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
7012
+ endAttrName) {
7013
+ if (name === ignoreDirective) return null;
7014
+ var match = null;
7015
+ if (hasDirectives.hasOwnProperty(name)) {
7016
+ for (var directive, directives = $injector.get(name + Suffix),
7017
+ i = 0, ii = directives.length; i < ii; i++) {
7018
+ directive = directives[i];
7019
+ if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
7020
+ directive.restrict.indexOf(location) !== -1) {
7021
+ if (startAttrName) {
7022
+ directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
7023
+ }
7024
+ if (!directive.$$bindings) {
7025
+ var bindings = directive.$$bindings =
7026
+ parseDirectiveBindings(directive, directive.name);
7027
+ if (isObject(bindings.isolateScope)) {
7028
+ directive.$$isolateBindings = bindings.isolateScope;
7029
+ }
7030
+ }
7031
+ tDirectives.push(directive);
7032
+ match = directive;
7033
+ }
7034
+ }
7035
+ }
7036
+ return match;
7037
+ }
7038
+
7039
+
7040
+ function directiveIsMultiElement(name) {
7041
+ if (hasDirectives.hasOwnProperty(name)) {
7042
+ for (var directive, directives = $injector.get(name + Suffix),
7043
+ i = 0, ii = directives.length; i < ii; i++) {
7044
+ directive = directives[i];
7045
+ if (directive.multiElement) {
7046
+ return true;
7047
+ }
7048
+ }
7049
+ }
7050
+ return false;
7051
+ }
7052
+
7053
+ function mergeTemplateAttributes(dst, src) {
7054
+ var srcAttr = src.$attr,
7055
+ dstAttr = dst.$attr;
7056
+
7057
+ forEach(dst, function(value, key) {
7058
+ if (key.charAt(0) !== '$') {
7059
+ if (src[key] && src[key] !== value) {
7060
+ if (value.length) {
7061
+ value += (key === 'style' ? ';' : ' ') + src[key];
7062
+ } else {
7063
+ value = src[key];
7064
+ }
7065
+ }
7066
+ dst.$set(key, value, true, srcAttr[key]);
7067
+ }
7068
+ });
7069
+
7070
+ forEach(src, function(value, key) {
7071
+ if (!dst.hasOwnProperty(key) && key.charAt(0) !== '$') {
7072
+ dst[key] = value;
7073
+
7074
+ if (key !== 'class' && key !== 'style') {
7075
+ dstAttr[key] = srcAttr[key];
7076
+ }
7077
+ }
7078
+ });
7079
+ }
7080
+
7081
+
7082
+ function compileTemplateUrl(directives, $compileNode, tAttrs,
7083
+ $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
7084
+ var linkQueue = [],
7085
+ afterTemplateNodeLinkFn,
7086
+ afterTemplateChildLinkFn,
7087
+ beforeTemplateCompileNode = $compileNode[0],
7088
+ origAsyncDirective = directives.shift(),
7089
+ derivedSyncDirective = inherit(origAsyncDirective, {
7090
+ templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
7091
+ }),
7092
+ templateUrl = (isFunction(origAsyncDirective.templateUrl))
7093
+ ? origAsyncDirective.templateUrl($compileNode, tAttrs)
7094
+ : origAsyncDirective.templateUrl,
7095
+ templateNamespace = origAsyncDirective.templateNamespace;
7096
+
7097
+ $compileNode.empty();
7098
+
7099
+ $templateRequest(templateUrl)
7100
+ .then(function(content) {
7101
+ var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
7102
+
7103
+ content = denormalizeTemplate(content);
7104
+
7105
+ if (origAsyncDirective.replace) {
7106
+ if (jqLiteIsTextNode(content)) {
7107
+ $template = [];
7108
+ } else {
7109
+ $template = removeComments(wrapTemplate(templateNamespace, trim(content)));
7110
+ }
7111
+ compileNode = $template[0];
7112
+
7113
+ if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
7114
+ throw $compileMinErr('tplrt',
7115
+ 'Template for directive \'{0}\' must have exactly one root element. {1}',
7116
+ origAsyncDirective.name, templateUrl);
7117
+ }
7118
+
7119
+ tempTemplateAttrs = {$attr: {}};
7120
+ replaceWith($rootElement, $compileNode, compileNode);
7121
+ var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
7122
+
7123
+ if (isObject(origAsyncDirective.scope)) {
7124
+ markDirectiveScope(templateDirectives, true);
7125
+ }
7126
+ directives = templateDirectives.concat(directives);
7127
+ mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
7128
+ } else {
7129
+ compileNode = beforeTemplateCompileNode;
7130
+ $compileNode.html(content);
7131
+ }
7132
+
7133
+ directives.unshift(derivedSyncDirective);
7134
+
7135
+ afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
7136
+ childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
7137
+ previousCompileContext);
7138
+ forEach($rootElement, function(node, i) {
7139
+ if (node === compileNode) {
7140
+ $rootElement[i] = $compileNode[0];
7141
+ }
7142
+ });
7143
+ afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
7144
+
7145
+ while (linkQueue.length) {
7146
+ var scope = linkQueue.shift(),
7147
+ beforeTemplateLinkNode = linkQueue.shift(),
7148
+ linkRootElement = linkQueue.shift(),
7149
+ boundTranscludeFn = linkQueue.shift(),
7150
+ linkNode = $compileNode[0];
7151
+
7152
+ if (scope.$$destroyed) continue;
7153
+
7154
+ if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
7155
+ var oldClasses = beforeTemplateLinkNode.className;
7156
+
7157
+ if (!(previousCompileContext.hasElementTranscludeDirective &&
7158
+ origAsyncDirective.replace)) {
7159
+ linkNode = jqLiteClone(compileNode);
7160
+ }
7161
+ replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
7162
+
7163
+ safeAddClass(jqLite(linkNode), oldClasses);
7164
+ }
7165
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
7166
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
7167
+ } else {
7168
+ childBoundTranscludeFn = boundTranscludeFn;
7169
+ }
7170
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,
7171
+ childBoundTranscludeFn);
7172
+ }
7173
+ linkQueue = null;
7174
+ }).catch(function(error) {
7175
+ if (error instanceof Error) {
7176
+ $exceptionHandler(error);
7177
+ }
7178
+ }).catch(noop);
7179
+
7180
+ return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
7181
+ var childBoundTranscludeFn = boundTranscludeFn;
7182
+ if (scope.$$destroyed) return;
7183
+ if (linkQueue) {
7184
+ linkQueue.push(scope,
7185
+ node,
7186
+ rootElement,
7187
+ childBoundTranscludeFn);
7188
+ } else {
7189
+ if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
7190
+ childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
7191
+ }
7192
+ afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);
7193
+ }
7194
+ };
7195
+ }
7196
+
7197
+
7198
+ function byPriority(a, b) {
7199
+ var diff = b.priority - a.priority;
7200
+ if (diff !== 0) return diff;
7201
+ if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
7202
+ return a.index - b.index;
7203
+ }
7204
+
7205
+ function assertNoDuplicate(what, previousDirective, directive, element) {
7206
+
7207
+ function wrapModuleNameIfDefined(moduleName) {
7208
+ return moduleName ?
7209
+ (' (module: ' + moduleName + ')') :
7210
+ '';
7211
+ }
7212
+
7213
+ if (previousDirective) {
7214
+ throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',
7215
+ previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),
7216
+ directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));
7217
+ }
7218
+ }
7219
+
7220
+
7221
+ function addTextInterpolateDirective(directives, text) {
7222
+ var interpolateFn = $interpolate(text, true);
7223
+ if (interpolateFn) {
7224
+ directives.push({
7225
+ priority: 0,
7226
+ compile: function textInterpolateCompileFn(templateNode) {
7227
+ var templateNodeParent = templateNode.parent(),
7228
+ hasCompileParent = !!templateNodeParent.length;
7229
+
7230
+ if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);
7231
+
7232
+ return function textInterpolateLinkFn(scope, node) {
7233
+ var parent = node.parent();
7234
+ if (!hasCompileParent) compile.$$addBindingClass(parent);
7235
+ compile.$$addBindingInfo(parent, interpolateFn.expressions);
7236
+ scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
7237
+ node[0].nodeValue = value;
7238
+ });
7239
+ };
7240
+ }
7241
+ });
7242
+ }
7243
+ }
7244
+
7245
+
7246
+ function wrapTemplate(type, template) {
7247
+ type = lowercase(type || 'html');
7248
+ switch (type) {
7249
+ case 'svg':
7250
+ case 'math':
7251
+ var wrapper = window.document.createElement('div');
7252
+ wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';
7253
+ return wrapper.childNodes[0].childNodes;
7254
+ default:
7255
+ return template;
7256
+ }
7257
+ }
7258
+
7259
+
7260
+ function getTrustedContext(node, attrNormalizedName) {
7261
+ if (attrNormalizedName === 'srcdoc') {
7262
+ return $sce.HTML;
7263
+ }
7264
+ var tag = nodeName_(node);
7265
+ if (attrNormalizedName === 'src' || attrNormalizedName === 'ngSrc') {
7266
+ if (['img', 'video', 'audio', 'source', 'track'].indexOf(tag) === -1) {
7267
+ return $sce.RESOURCE_URL;
7268
+ }
7269
+ } else if (attrNormalizedName === 'xlinkHref' ||
7270
+ (tag === 'form' && attrNormalizedName === 'action') ||
7271
+ (tag === 'link' && attrNormalizedName === 'href')
7272
+ ) {
7273
+ return $sce.RESOURCE_URL;
7274
+ }
7275
+ }
7276
+
7277
+
7278
+ function addAttrInterpolateDirective(node, directives, value, name, isNgAttr) {
7279
+ var trustedContext = getTrustedContext(node, name);
7280
+ var mustHaveExpression = !isNgAttr;
7281
+ var allOrNothing = ALL_OR_NOTHING_ATTRS[name] || isNgAttr;
7282
+
7283
+ var interpolateFn = $interpolate(value, mustHaveExpression, trustedContext, allOrNothing);
7284
+
7285
+ if (!interpolateFn) return;
7286
+
7287
+ if (name === 'multiple' && nodeName_(node) === 'select') {
7288
+ throw $compileMinErr('selmulti',
7289
+ 'Binding to the \'multiple\' attribute is not supported. Element: {0}',
7290
+ startingTag(node));
7291
+ }
7292
+
7293
+ if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
7294
+ throw $compileMinErr('nodomevents',
7295
+ 'Interpolations for HTML DOM event attributes are disallowed. Please use the ' +
7296
+ 'ng- versions (such as ng-click instead of onclick) instead.');
7297
+ }
7298
+
7299
+ directives.push({
7300
+ priority: 100,
7301
+ compile: function() {
7302
+ return {
7303
+ pre: function attrInterpolatePreLinkFn(scope, element, attr) {
7304
+ var $$observers = (attr.$$observers || (attr.$$observers = createMap()));
7305
+
7306
+ var newValue = attr[name];
7307
+ if (newValue !== value) {
7308
+ interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);
7309
+ value = newValue;
7310
+ }
7311
+
7312
+ if (!interpolateFn) return;
7313
+
7314
+ attr[name] = interpolateFn(scope);
7315
+
7316
+ ($$observers[name] || ($$observers[name] = [])).$$inter = true;
7317
+ (attr.$$observers && attr.$$observers[name].$$scope || scope).
7318
+ $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
7319
+ if (name === 'class' && newValue !== oldValue) {
7320
+ attr.$updateClass(newValue, oldValue);
7321
+ } else {
7322
+ attr.$set(name, newValue);
7323
+ }
7324
+ });
7325
+ }
7326
+ };
7327
+ }
7328
+ });
7329
+ }
7330
+
7331
+
7332
+ function replaceWith($rootElement, elementsToRemove, newNode) {
7333
+ var firstElementToRemove = elementsToRemove[0],
7334
+ removeCount = elementsToRemove.length,
7335
+ parent = firstElementToRemove.parentNode,
7336
+ i, ii;
7337
+
7338
+ if ($rootElement) {
7339
+ for (i = 0, ii = $rootElement.length; i < ii; i++) {
7340
+ if ($rootElement[i] === firstElementToRemove) {
7341
+ $rootElement[i++] = newNode;
7342
+ for (var j = i, j2 = j + removeCount - 1,
7343
+ jj = $rootElement.length;
7344
+ j < jj; j++, j2++) {
7345
+ if (j2 < jj) {
7346
+ $rootElement[j] = $rootElement[j2];
7347
+ } else {
7348
+ delete $rootElement[j];
7349
+ }
7350
+ }
7351
+ $rootElement.length -= removeCount - 1;
7352
+
7353
+ if ($rootElement.context === firstElementToRemove) {
7354
+ $rootElement.context = newNode;
7355
+ }
7356
+ break;
7357
+ }
7358
+ }
7359
+ }
7360
+
7361
+ if (parent) {
7362
+ parent.replaceChild(newNode, firstElementToRemove);
7363
+ }
7364
+
7365
+ var fragment = window.document.createDocumentFragment();
7366
+ for (i = 0; i < removeCount; i++) {
7367
+ fragment.appendChild(elementsToRemove[i]);
7368
+ }
7369
+
7370
+ if (jqLite.hasData(firstElementToRemove)) {
7371
+ jqLite.data(newNode, jqLite.data(firstElementToRemove));
7372
+
7373
+ jqLite(firstElementToRemove).off('$destroy');
7374
+ }
7375
+
7376
+ jqLite.cleanData(fragment.querySelectorAll('*'));
7377
+
7378
+ for (i = 1; i < removeCount; i++) {
7379
+ delete elementsToRemove[i];
7380
+ }
7381
+ elementsToRemove[0] = newNode;
7382
+ elementsToRemove.length = 1;
7383
+ }
7384
+
7385
+
7386
+ function cloneAndAnnotateFn(fn, annotation) {
7387
+ return extend(function() { return fn.apply(null, arguments); }, fn, annotation);
7388
+ }
7389
+
7390
+
7391
+ function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {
7392
+ try {
7393
+ linkFn(scope, $element, attrs, controllers, transcludeFn);
7394
+ } catch (e) {
7395
+ $exceptionHandler(e, startingTag($element));
7396
+ }
7397
+ }
7398
+
7399
+
7400
+ function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {
7401
+ var removeWatchCollection = [];
7402
+ var initialChanges = {};
7403
+ var changes;
7404
+ forEach(bindings, function initializeBinding(definition, scopeName) {
7405
+ var attrName = definition.attrName,
7406
+ optional = definition.optional,
7407
+ mode = definition.mode,
7408
+ lastValue,
7409
+ parentGet, parentSet, compare, removeWatch;
7410
+
7411
+ switch (mode) {
7412
+
7413
+ case '@':
7414
+ if (!optional && !hasOwnProperty.call(attrs, attrName)) {
7415
+ destination[scopeName] = attrs[attrName] = undefined;
7416
+ }
7417
+ removeWatch = attrs.$observe(attrName, function(value) {
7418
+ if (isString(value) || isBoolean(value)) {
7419
+ var oldValue = destination[scopeName];
7420
+ recordChanges(scopeName, value, oldValue);
7421
+ destination[scopeName] = value;
7422
+ }
7423
+ });
7424
+ attrs.$$observers[attrName].$$scope = scope;
7425
+ lastValue = attrs[attrName];
7426
+ if (isString(lastValue)) {
7427
+ destination[scopeName] = $interpolate(lastValue)(scope);
7428
+ } else if (isBoolean(lastValue)) {
7429
+ destination[scopeName] = lastValue;
7430
+ }
7431
+ initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]);
7432
+ removeWatchCollection.push(removeWatch);
7433
+ break;
7434
+
7435
+ case '=':
7436
+ if (!hasOwnProperty.call(attrs, attrName)) {
7437
+ if (optional) break;
7438
+ attrs[attrName] = undefined;
7439
+ }
7440
+ if (optional && !attrs[attrName]) break;
7441
+
7442
+ parentGet = $parse(attrs[attrName]);
7443
+ if (parentGet.literal) {
7444
+ compare = equals;
7445
+ } else {
7446
+ compare = function simpleCompare(a, b) { return a === b || (a !== a && b !== b); };
7447
+ }
7448
+ parentSet = parentGet.assign || function() {
7449
+ lastValue = destination[scopeName] = parentGet(scope);
7450
+ throw $compileMinErr('nonassign',
7451
+ 'Expression \'{0}\' in attribute \'{1}\' used with directive \'{2}\' is non-assignable!',
7452
+ attrs[attrName], attrName, directive.name);
7453
+ };
7454
+ lastValue = destination[scopeName] = parentGet(scope);
7455
+ var parentValueWatch = function parentValueWatch(parentValue) {
7456
+ if (!compare(parentValue, destination[scopeName])) {
7457
+ if (!compare(parentValue, lastValue)) {
7458
+ destination[scopeName] = parentValue;
7459
+ } else {
7460
+ parentSet(scope, parentValue = destination[scopeName]);
7461
+ }
7462
+ }
7463
+ lastValue = parentValue;
7464
+ return lastValue;
7465
+ };
7466
+ parentValueWatch.$stateful = true;
7467
+ if (definition.collection) {
7468
+ removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);
7469
+ } else {
7470
+ removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);
7471
+ }
7472
+ removeWatchCollection.push(removeWatch);
7473
+ break;
7474
+
7475
+ case '<':
7476
+ if (!hasOwnProperty.call(attrs, attrName)) {
7477
+ if (optional) break;
7478
+ attrs[attrName] = undefined;
7479
+ }
7480
+ if (optional && !attrs[attrName]) break;
7481
+
7482
+ parentGet = $parse(attrs[attrName]);
7483
+ var deepWatch = parentGet.literal;
7484
+
7485
+ var initialValue = destination[scopeName] = parentGet(scope);
7486
+ initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]);
7487
+
7488
+ removeWatch = scope.$watch(parentGet, function parentValueWatchAction(newValue, oldValue) {
7489
+ if (oldValue === newValue) {
7490
+ if (oldValue === initialValue || (deepWatch && equals(oldValue, initialValue))) {
7491
+ return;
7492
+ }
7493
+ oldValue = initialValue;
7494
+ }
7495
+ recordChanges(scopeName, newValue, oldValue);
7496
+ destination[scopeName] = newValue;
7497
+ }, deepWatch);
7498
+
7499
+ removeWatchCollection.push(removeWatch);
7500
+ break;
7501
+
7502
+ case '&':
7503
+ parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;
7504
+
7505
+ if (parentGet === noop && optional) break;
7506
+
7507
+ destination[scopeName] = function(locals) {
7508
+ return parentGet(scope, locals);
7509
+ };
7510
+ break;
7511
+ }
7512
+ });
7513
+
7514
+ function recordChanges(key, currentValue, previousValue) {
7515
+ if (isFunction(destination.$onChanges) && currentValue !== previousValue &&
7516
+ (currentValue === currentValue || previousValue === previousValue)) {
7517
+ if (!onChangesQueue) {
7518
+ scope.$$postDigest(flushOnChangesQueue);
7519
+ onChangesQueue = [];
7520
+ }
7521
+ if (!changes) {
7522
+ changes = {};
7523
+ onChangesQueue.push(triggerOnChangesHook);
7524
+ }
7525
+ if (changes[key]) {
7526
+ previousValue = changes[key].previousValue;
7527
+ }
7528
+ changes[key] = new SimpleChange(previousValue, currentValue);
7529
+ }
7530
+ }
7531
+
7532
+ function triggerOnChangesHook() {
7533
+ destination.$onChanges(changes);
7534
+ changes = undefined;
7535
+ }
7536
+
7537
+ return {
7538
+ initialChanges: initialChanges,
7539
+ removeWatches: removeWatchCollection.length && function removeWatches() {
7540
+ for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {
7541
+ removeWatchCollection[i]();
7542
+ }
7543
+ }
7544
+ };
7545
+ }
7546
+ }];
7547
+ }
7548
+
7549
+ function SimpleChange(previous, current) {
7550
+ this.previousValue = previous;
7551
+ this.currentValue = current;
7552
+ }
7553
+ SimpleChange.prototype.isFirstChange = function() { return this.previousValue === _UNINITIALIZED_VALUE; };
7554
+
7555
+
7556
+ var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i;
7557
+ var SPECIAL_CHARS_REGEXP = /[:\-_]+(.)/g;
7558
+
7559
+ function directiveNormalize(name) {
7560
+ return name
7561
+ .replace(PREFIX_REGEXP, '')
7562
+ .replace(SPECIAL_CHARS_REGEXP, fnCamelCaseReplace);
7563
+ }
7564
+
7565
+
7566
+
7567
+
7568
+
7569
+
7570
+
7571
+
7572
+ function nodesetLinkingFn(
7573
+ scope,
7574
+ nodeList,
7575
+ rootElement,
7576
+ boundTranscludeFn
7577
+ ) {}
7578
+
7579
+ function directiveLinkingFn(
7580
+ nodesetLinkingFn,
7581
+ scope,
7582
+ node,
7583
+ rootElement,
7584
+ boundTranscludeFn
7585
+ ) {}
7586
+
7587
+ function tokenDifference(str1, str2) {
7588
+ var values = '',
7589
+ tokens1 = str1.split(/\s+/),
7590
+ tokens2 = str2.split(/\s+/);
7591
+
7592
+ outer:
7593
+ for (var i = 0; i < tokens1.length; i++) {
7594
+ var token = tokens1[i];
7595
+ for (var j = 0; j < tokens2.length; j++) {
7596
+ if (token === tokens2[j]) continue outer;
7597
+ }
7598
+ values += (values.length > 0 ? ' ' : '') + token;
7599
+ }
7600
+ return values;
7601
+ }
7602
+
7603
+ function removeComments(jqNodes) {
7604
+ jqNodes = jqLite(jqNodes);
7605
+ var i = jqNodes.length;
7606
+
7607
+ if (i <= 1) {
7608
+ return jqNodes;
7609
+ }
7610
+
7611
+ while (i--) {
7612
+ var node = jqNodes[i];
7613
+ if (node.nodeType === NODE_TYPE_COMMENT ||
7614
+ (node.nodeType === NODE_TYPE_TEXT && node.nodeValue.trim() === '')) {
7615
+ splice.call(jqNodes, i, 1);
7616
+ }
7617
+ }
7618
+ return jqNodes;
7619
+ }
7620
+
7621
+ var $controllerMinErr = minErr('$controller');
7622
+
7623
+
7624
+ var CNTRL_REG = /^(\S+)(\s+as\s+([\w$]+))?$/;
7625
+ function identifierForController(controller, ident) {
7626
+ if (ident && isString(ident)) return ident;
7627
+ if (isString(controller)) {
7628
+ var match = CNTRL_REG.exec(controller);
7629
+ if (match) return match[3];
7630
+ }
7631
+ }
7632
+
7633
+
7634
+ function $ControllerProvider() {
7635
+ var controllers = {},
7636
+ globals = false;
7637
+
7638
+ this.has = function(name) {
7639
+ return controllers.hasOwnProperty(name);
7640
+ };
7641
+
7642
+ this.register = function(name, constructor) {
7643
+ assertNotHasOwnProperty(name, 'controller');
7644
+ if (isObject(name)) {
7645
+ extend(controllers, name);
7646
+ } else {
7647
+ controllers[name] = constructor;
7648
+ }
7649
+ };
7650
+
7651
+ this.allowGlobals = function() {
7652
+ globals = true;
7653
+ };
7654
+
7655
+
7656
+ this.$get = ['$injector', '$window', function($injector, $window) {
7657
+
7658
+ return function $controller(expression, locals, later, ident) {
7659
+ var instance, match, constructor, identifier;
7660
+ later = later === true;
7661
+ if (ident && isString(ident)) {
7662
+ identifier = ident;
7663
+ }
7664
+
7665
+ if (isString(expression)) {
7666
+ match = expression.match(CNTRL_REG);
7667
+ if (!match) {
7668
+ throw $controllerMinErr('ctrlfmt',
7669
+ 'Badly formed controller string \'{0}\'. ' +
7670
+ 'Must match `__name__ as __id__` or `__name__`.', expression);
7671
+ }
7672
+ constructor = match[1];
7673
+ identifier = identifier || match[3];
7674
+ expression = controllers.hasOwnProperty(constructor)
7675
+ ? controllers[constructor]
7676
+ : getter(locals.$scope, constructor, true) ||
7677
+ (globals ? getter($window, constructor, true) : undefined);
7678
+
7679
+ if (!expression) {
7680
+ throw $controllerMinErr('ctrlreg',
7681
+ 'The controller with the name \'{0}\' is not registered.', constructor);
7682
+ }
7683
+
7684
+ assertArgFn(expression, constructor, true);
7685
+ }
7686
+
7687
+ if (later) {
7688
+ var controllerPrototype = (isArray(expression) ?
7689
+ expression[expression.length - 1] : expression).prototype;
7690
+ instance = Object.create(controllerPrototype || null);
7691
+
7692
+ if (identifier) {
7693
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
7694
+ }
7695
+
7696
+ return extend(function $controllerInit() {
7697
+ var result = $injector.invoke(expression, instance, locals, constructor);
7698
+ if (result !== instance && (isObject(result) || isFunction(result))) {
7699
+ instance = result;
7700
+ if (identifier) {
7701
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
7702
+ }
7703
+ }
7704
+ return instance;
7705
+ }, {
7706
+ instance: instance,
7707
+ identifier: identifier
7708
+ });
7709
+ }
7710
+
7711
+ instance = $injector.instantiate(expression, locals, constructor);
7712
+
7713
+ if (identifier) {
7714
+ addIdentifier(locals, identifier, instance, constructor || expression.name);
7715
+ }
7716
+
7717
+ return instance;
7718
+ };
7719
+
7720
+ function addIdentifier(locals, identifier, instance, name) {
7721
+ if (!(locals && isObject(locals.$scope))) {
7722
+ throw minErr('$controller')('noscp',
7723
+ 'Cannot export controller \'{0}\' as \'{1}\'! No $scope object provided via `locals`.',
7724
+ name, identifier);
7725
+ }
7726
+
7727
+ locals.$scope[identifier] = instance;
7728
+ }
7729
+ }];
7730
+ }
7731
+
7732
+ function $DocumentProvider() {
7733
+ this.$get = ['$window', function(window) {
7734
+ return jqLite(window.document);
7735
+ }];
7736
+ }
7737
+
7738
+
7739
+ function $$IsDocumentHiddenProvider() {
7740
+ this.$get = ['$document', '$rootScope', function($document, $rootScope) {
7741
+ var doc = $document[0];
7742
+ var hidden = doc && doc.hidden;
7743
+
7744
+ $document.on('visibilitychange', changeListener);
7745
+
7746
+ $rootScope.$on('$destroy', function() {
7747
+ $document.off('visibilitychange', changeListener);
7748
+ });
7749
+
7750
+ function changeListener() {
7751
+ hidden = doc.hidden;
7752
+ }
7753
+
7754
+ return function() {
7755
+ return hidden;
7756
+ };
7757
+ }];
7758
+ }
7759
+
7760
+ function $ExceptionHandlerProvider() {
7761
+ this.$get = ['$log', function($log) {
7762
+ return function(exception, cause) {
7763
+ $log.error.apply($log, arguments);
7764
+ };
7765
+ }];
7766
+ }
7767
+
7768
+ var $$ForceReflowProvider = function() {
7769
+ this.$get = ['$document', function($document) {
7770
+ return function(domNode) {
7771
+ if (domNode) {
7772
+ if (!domNode.nodeType && domNode instanceof jqLite) {
7773
+ domNode = domNode[0];
7774
+ }
7775
+ } else {
7776
+ domNode = $document[0].body;
7777
+ }
7778
+ return domNode.offsetWidth + 1;
7779
+ };
7780
+ }];
7781
+ };
7782
+
7783
+ var APPLICATION_JSON = 'application/json';
7784
+ var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};
7785
+ var JSON_START = /^\[|^\{(?!\{)/;
7786
+ var JSON_ENDS = {
7787
+ '[': /]$/,
7788
+ '{': /}$/
7789
+ };
7790
+ var JSON_PROTECTION_PREFIX = /^\)]\}',?\n/;
7791
+ var $httpMinErr = minErr('$http');
7792
+
7793
+ function serializeValue(v) {
7794
+ if (isObject(v)) {
7795
+ return isDate(v) ? v.toISOString() : toJson(v);
7796
+ }
7797
+ return v;
7798
+ }
7799
+
7800
+
7801
+ function $HttpParamSerializerProvider() {
7802
+
7803
+ this.$get = function() {
7804
+ return function ngParamSerializer(params) {
7805
+ if (!params) return '';
7806
+ var parts = [];
7807
+ forEachSorted(params, function(value, key) {
7808
+ if (value === null || isUndefined(value)) return;
7809
+ if (isArray(value)) {
7810
+ forEach(value, function(v) {
7811
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));
7812
+ });
7813
+ } else {
7814
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
7815
+ }
7816
+ });
7817
+
7818
+ return parts.join('&');
7819
+ };
7820
+ };
7821
+ }
7822
+
7823
+ function $HttpParamSerializerJQLikeProvider() {
7824
+ this.$get = function() {
7825
+ return function jQueryLikeParamSerializer(params) {
7826
+ if (!params) return '';
7827
+ var parts = [];
7828
+ serialize(params, '', true);
7829
+ return parts.join('&');
7830
+
7831
+ function serialize(toSerialize, prefix, topLevel) {
7832
+ if (toSerialize === null || isUndefined(toSerialize)) return;
7833
+ if (isArray(toSerialize)) {
7834
+ forEach(toSerialize, function(value, index) {
7835
+ serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');
7836
+ });
7837
+ } else if (isObject(toSerialize) && !isDate(toSerialize)) {
7838
+ forEachSorted(toSerialize, function(value, key) {
7839
+ serialize(value, prefix +
7840
+ (topLevel ? '' : '[') +
7841
+ key +
7842
+ (topLevel ? '' : ']'));
7843
+ });
7844
+ } else {
7845
+ parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));
7846
+ }
7847
+ }
7848
+ };
7849
+ };
7850
+ }
7851
+
7852
+ function defaultHttpResponseTransform(data, headers) {
7853
+ if (isString(data)) {
7854
+ var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
7855
+
7856
+ if (tempData) {
7857
+ var contentType = headers('Content-Type');
7858
+ if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {
7859
+ data = fromJson(tempData);
7860
+ }
7861
+ }
7862
+ }
7863
+
7864
+ return data;
7865
+ }
7866
+
7867
+ function isJsonLike(str) {
7868
+ var jsonStart = str.match(JSON_START);
7869
+ return jsonStart && JSON_ENDS[jsonStart[0]].test(str);
7870
+ }
7871
+
7872
+ function parseHeaders(headers) {
7873
+ var parsed = createMap(), i;
7874
+
7875
+ function fillInParsed(key, val) {
7876
+ if (key) {
7877
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
7878
+ }
7879
+ }
7880
+
7881
+ if (isString(headers)) {
7882
+ forEach(headers.split('\n'), function(line) {
7883
+ i = line.indexOf(':');
7884
+ fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
7885
+ });
7886
+ } else if (isObject(headers)) {
7887
+ forEach(headers, function(headerVal, headerKey) {
7888
+ fillInParsed(lowercase(headerKey), trim(headerVal));
7889
+ });
7890
+ }
7891
+
7892
+ return parsed;
7893
+ }
7894
+
7895
+
7896
+ function headersGetter(headers) {
7897
+ var headersObj;
7898
+
7899
+ return function(name) {
7900
+ if (!headersObj) headersObj = parseHeaders(headers);
7901
+
7902
+ if (name) {
7903
+ var value = headersObj[lowercase(name)];
7904
+ if (value === undefined) {
7905
+ value = null;
7906
+ }
7907
+ return value;
7908
+ }
7909
+
7910
+ return headersObj;
7911
+ };
7912
+ }
7913
+
7914
+
7915
+ function transformData(data, headers, status, fns) {
7916
+ if (isFunction(fns)) {
7917
+ return fns(data, headers, status);
7918
+ }
7919
+
7920
+ forEach(fns, function(fn) {
7921
+ data = fn(data, headers, status);
7922
+ });
7923
+
7924
+ return data;
7925
+ }
7926
+
7927
+
7928
+ function isSuccess(status) {
7929
+ return 200 <= status && status < 300;
7930
+ }
7931
+
7932
+
7933
+ function $HttpProvider() {
7934
+ var defaults = this.defaults = {
7935
+ transformResponse: [defaultHttpResponseTransform],
7936
+
7937
+ transformRequest: [function(d) {
7938
+ return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;
7939
+ }],
7940
+
7941
+ headers: {
7942
+ common: {
7943
+ 'Accept': 'application/json, text/plain, */*'
7944
+ },
7945
+ post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
7946
+ put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
7947
+ patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
7948
+ },
7949
+
7950
+ xsrfCookieName: 'XSRF-TOKEN',
7951
+ xsrfHeaderName: 'X-XSRF-TOKEN',
7952
+
7953
+ paramSerializer: '$httpParamSerializer',
7954
+
7955
+ jsonpCallbackParam: 'callback'
7956
+ };
7957
+
7958
+ var useApplyAsync = false;
7959
+ this.useApplyAsync = function(value) {
7960
+ if (isDefined(value)) {
7961
+ useApplyAsync = !!value;
7962
+ return this;
7963
+ }
7964
+ return useApplyAsync;
7965
+ };
7966
+
7967
+ var interceptorFactories = this.interceptors = [];
7968
+
7969
+ this.$get = ['$browser', '$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector', '$sce',
7970
+ function($browser, $httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector, $sce) {
7971
+
7972
+ var defaultCache = $cacheFactory('$http');
7973
+
7974
+ defaults.paramSerializer = isString(defaults.paramSerializer) ?
7975
+ $injector.get(defaults.paramSerializer) : defaults.paramSerializer;
7976
+
7977
+ var reversedInterceptors = [];
7978
+
7979
+ forEach(interceptorFactories, function(interceptorFactory) {
7980
+ reversedInterceptors.unshift(isString(interceptorFactory)
7981
+ ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
7982
+ });
7983
+
7984
+ function $http(requestConfig) {
7985
+
7986
+ if (!isObject(requestConfig)) {
7987
+ throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig);
7988
+ }
7989
+
7990
+ if (!isString($sce.valueOf(requestConfig.url))) {
7991
+ throw minErr('$http')('badreq', 'Http request configuration url must be a string or a $sce trusted object. Received: {0}', requestConfig.url);
7992
+ }
7993
+
7994
+ var config = extend({
7995
+ method: 'get',
7996
+ transformRequest: defaults.transformRequest,
7997
+ transformResponse: defaults.transformResponse,
7998
+ paramSerializer: defaults.paramSerializer,
7999
+ jsonpCallbackParam: defaults.jsonpCallbackParam
8000
+ }, requestConfig);
8001
+
8002
+ config.headers = mergeHeaders(requestConfig);
8003
+ config.method = uppercase(config.method);
8004
+ config.paramSerializer = isString(config.paramSerializer) ?
8005
+ $injector.get(config.paramSerializer) : config.paramSerializer;
8006
+
8007
+ $browser.$$incOutstandingRequestCount();
8008
+
8009
+ var requestInterceptors = [];
8010
+ var responseInterceptors = [];
8011
+ var promise = $q.resolve(config);
8012
+
8013
+ forEach(reversedInterceptors, function(interceptor) {
8014
+ if (interceptor.request || interceptor.requestError) {
8015
+ requestInterceptors.unshift(interceptor.request, interceptor.requestError);
8016
+ }
8017
+ if (interceptor.response || interceptor.responseError) {
8018
+ responseInterceptors.push(interceptor.response, interceptor.responseError);
8019
+ }
8020
+ });
8021
+
8022
+ promise = chainInterceptors(promise, requestInterceptors);
8023
+ promise = promise.then(serverRequest);
8024
+ promise = chainInterceptors(promise, responseInterceptors);
8025
+ promise = promise.finally(completeOutstandingRequest);
8026
+
8027
+ return promise;
8028
+
8029
+
8030
+ function chainInterceptors(promise, interceptors) {
8031
+ for (var i = 0, ii = interceptors.length; i < ii;) {
8032
+ var thenFn = interceptors[i++];
8033
+ var rejectFn = interceptors[i++];
8034
+
8035
+ promise = promise.then(thenFn, rejectFn);
8036
+ }
8037
+
8038
+ interceptors.length = 0;
8039
+
8040
+ return promise;
8041
+ }
8042
+
8043
+ function completeOutstandingRequest() {
8044
+ $browser.$$completeOutstandingRequest(noop);
8045
+ }
8046
+
8047
+ function executeHeaderFns(headers, config) {
8048
+ var headerContent, processedHeaders = {};
8049
+
8050
+ forEach(headers, function(headerFn, header) {
8051
+ if (isFunction(headerFn)) {
8052
+ headerContent = headerFn(config);
8053
+ if (headerContent != null) {
8054
+ processedHeaders[header] = headerContent;
8055
+ }
8056
+ } else {
8057
+ processedHeaders[header] = headerFn;
8058
+ }
8059
+ });
8060
+
8061
+ return processedHeaders;
8062
+ }
8063
+
8064
+ function mergeHeaders(config) {
8065
+ var defHeaders = defaults.headers,
8066
+ reqHeaders = extend({}, config.headers),
8067
+ defHeaderName, lowercaseDefHeaderName, reqHeaderName;
8068
+
8069
+ defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
8070
+
8071
+ defaultHeadersIteration:
8072
+ for (defHeaderName in defHeaders) {
8073
+ lowercaseDefHeaderName = lowercase(defHeaderName);
8074
+
8075
+ for (reqHeaderName in reqHeaders) {
8076
+ if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {
8077
+ continue defaultHeadersIteration;
8078
+ }
8079
+ }
8080
+
8081
+ reqHeaders[defHeaderName] = defHeaders[defHeaderName];
8082
+ }
8083
+
8084
+ return executeHeaderFns(reqHeaders, shallowCopy(config));
8085
+ }
8086
+
8087
+ function serverRequest(config) {
8088
+ var headers = config.headers;
8089
+ var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);
8090
+
8091
+ if (isUndefined(reqData)) {
8092
+ forEach(headers, function(value, header) {
8093
+ if (lowercase(header) === 'content-type') {
8094
+ delete headers[header];
8095
+ }
8096
+ });
8097
+ }
8098
+
8099
+ if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
8100
+ config.withCredentials = defaults.withCredentials;
8101
+ }
8102
+
8103
+ return sendReq(config, reqData).then(transformResponse, transformResponse);
8104
+ }
8105
+
8106
+ function transformResponse(response) {
8107
+ var resp = extend({}, response);
8108
+ resp.data = transformData(response.data, response.headers, response.status,
8109
+ config.transformResponse);
8110
+ return (isSuccess(response.status))
8111
+ ? resp
8112
+ : $q.reject(resp);
8113
+ }
8114
+ }
8115
+
8116
+ $http.pendingRequests = [];
8117
+
8118
+
8119
+
8120
+
8121
+ createShortMethods('get', 'delete', 'head', 'jsonp');
8122
+
8123
+
8124
+
8125
+ createShortMethodsWithData('post', 'put', 'patch');
8126
+
8127
+ $http.defaults = defaults;
8128
+
8129
+
8130
+ return $http;
8131
+
8132
+
8133
+ function createShortMethods(names) {
8134
+ forEach(arguments, function(name) {
8135
+ $http[name] = function(url, config) {
8136
+ return $http(extend({}, config || {}, {
8137
+ method: name,
8138
+ url: url
8139
+ }));
8140
+ };
8141
+ });
8142
+ }
8143
+
8144
+
8145
+ function createShortMethodsWithData(name) {
8146
+ forEach(arguments, function(name) {
8147
+ $http[name] = function(url, data, config) {
8148
+ return $http(extend({}, config || {}, {
8149
+ method: name,
8150
+ url: url,
8151
+ data: data
8152
+ }));
8153
+ };
8154
+ });
8155
+ }
8156
+
8157
+
8158
+ function sendReq(config, reqData) {
8159
+ var deferred = $q.defer(),
8160
+ promise = deferred.promise,
8161
+ cache,
8162
+ cachedResp,
8163
+ reqHeaders = config.headers,
8164
+ isJsonp = lowercase(config.method) === 'jsonp',
8165
+ url = config.url;
8166
+
8167
+ if (isJsonp) {
8168
+ url = $sce.getTrustedResourceUrl(url);
8169
+ } else if (!isString(url)) {
8170
+ url = $sce.valueOf(url);
8171
+ }
8172
+
8173
+ url = buildUrl(url, config.paramSerializer(config.params));
8174
+
8175
+ if (isJsonp) {
8176
+ url = sanitizeJsonpCallbackParam(url, config.jsonpCallbackParam);
8177
+ }
8178
+
8179
+ $http.pendingRequests.push(config);
8180
+ promise.then(removePendingReq, removePendingReq);
8181
+
8182
+ if ((config.cache || defaults.cache) && config.cache !== false &&
8183
+ (config.method === 'GET' || config.method === 'JSONP')) {
8184
+ cache = isObject(config.cache) ? config.cache
8185
+ : isObject(defaults.cache) ? defaults.cache
8186
+ : defaultCache;
8187
+ }
8188
+
8189
+ if (cache) {
8190
+ cachedResp = cache.get(url);
8191
+ if (isDefined(cachedResp)) {
8192
+ if (isPromiseLike(cachedResp)) {
8193
+ cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);
8194
+ } else {
8195
+ if (isArray(cachedResp)) {
8196
+ resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);
8197
+ } else {
8198
+ resolvePromise(cachedResp, 200, {}, 'OK');
8199
+ }
8200
+ }
8201
+ } else {
8202
+ cache.put(url, promise);
8203
+ }
8204
+ }
8205
+
8206
+
8207
+ if (isUndefined(cachedResp)) {
8208
+ var xsrfValue = urlIsSameOrigin(config.url)
8209
+ ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]
8210
+ : undefined;
8211
+ if (xsrfValue) {
8212
+ reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
8213
+ }
8214
+
8215
+ $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
8216
+ config.withCredentials, config.responseType,
8217
+ createApplyHandlers(config.eventHandlers),
8218
+ createApplyHandlers(config.uploadEventHandlers));
8219
+ }
8220
+
8221
+ return promise;
8222
+
8223
+ function createApplyHandlers(eventHandlers) {
8224
+ if (eventHandlers) {
8225
+ var applyHandlers = {};
8226
+ forEach(eventHandlers, function(eventHandler, key) {
8227
+ applyHandlers[key] = function(event) {
8228
+ if (useApplyAsync) {
8229
+ $rootScope.$applyAsync(callEventHandler);
8230
+ } else if ($rootScope.$$phase) {
8231
+ callEventHandler();
8232
+ } else {
8233
+ $rootScope.$apply(callEventHandler);
8234
+ }
8235
+
8236
+ function callEventHandler() {
8237
+ eventHandler(event);
8238
+ }
8239
+ };
8240
+ });
8241
+ return applyHandlers;
8242
+ }
8243
+ }
8244
+
8245
+
8246
+ function done(status, response, headersString, statusText) {
8247
+ if (cache) {
8248
+ if (isSuccess(status)) {
8249
+ cache.put(url, [status, response, parseHeaders(headersString), statusText]);
8250
+ } else {
8251
+ cache.remove(url);
8252
+ }
8253
+ }
8254
+
8255
+ function resolveHttpPromise() {
8256
+ resolvePromise(response, status, headersString, statusText);
8257
+ }
8258
+
8259
+ if (useApplyAsync) {
8260
+ $rootScope.$applyAsync(resolveHttpPromise);
8261
+ } else {
8262
+ resolveHttpPromise();
8263
+ if (!$rootScope.$$phase) $rootScope.$apply();
8264
+ }
8265
+ }
8266
+
8267
+
8268
+ function resolvePromise(response, status, headers, statusText) {
8269
+ status = status >= -1 ? status : 0;
8270
+
8271
+ (isSuccess(status) ? deferred.resolve : deferred.reject)({
8272
+ data: response,
8273
+ status: status,
8274
+ headers: headersGetter(headers),
8275
+ config: config,
8276
+ statusText: statusText
8277
+ });
8278
+ }
8279
+
8280
+ function resolvePromiseWithResult(result) {
8281
+ resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);
8282
+ }
8283
+
8284
+ function removePendingReq() {
8285
+ var idx = $http.pendingRequests.indexOf(config);
8286
+ if (idx !== -1) $http.pendingRequests.splice(idx, 1);
8287
+ }
8288
+ }
8289
+
8290
+
8291
+ function buildUrl(url, serializedParams) {
8292
+ if (serializedParams.length > 0) {
8293
+ url += ((url.indexOf('?') === -1) ? '?' : '&') + serializedParams;
8294
+ }
8295
+ return url;
8296
+ }
8297
+
8298
+ function sanitizeJsonpCallbackParam(url, key) {
8299
+ if (/[&?][^=]+=JSON_CALLBACK/.test(url)) {
8300
+ throw $httpMinErr('badjsonp', 'Illegal use of JSON_CALLBACK in url, "{0}"', url);
8301
+ }
8302
+
8303
+ var callbackParamRegex = new RegExp('[&?]' + key + '=');
8304
+ if (callbackParamRegex.test(url)) {
8305
+ throw $httpMinErr('badjsonp', 'Illegal use of callback param, "{0}", in url, "{1}"', key, url);
8306
+ }
8307
+
8308
+ url += ((url.indexOf('?') === -1) ? '?' : '&') + key + '=JSON_CALLBACK';
8309
+
8310
+ return url;
8311
+ }
8312
+ }];
8313
+ }
8314
+
8315
+ function $xhrFactoryProvider() {
8316
+ this.$get = function() {
8317
+ return function createXhr() {
8318
+ return new window.XMLHttpRequest();
8319
+ };
8320
+ };
8321
+ }
8322
+
8323
+ function $HttpBackendProvider() {
8324
+ this.$get = ['$browser', '$jsonpCallbacks', '$document', '$xhrFactory', function($browser, $jsonpCallbacks, $document, $xhrFactory) {
8325
+ return createHttpBackend($browser, $xhrFactory, $browser.defer, $jsonpCallbacks, $document[0]);
8326
+ }];
8327
+ }
8328
+
8329
+ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
8330
+ return function(method, url, post, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) {
8331
+ url = url || $browser.url();
8332
+
8333
+ if (lowercase(method) === 'jsonp') {
8334
+ var callbackPath = callbacks.createCallback(url);
8335
+ var jsonpDone = jsonpReq(url, callbackPath, function(status, text) {
8336
+ var response = (status === 200) && callbacks.getResponse(callbackPath);
8337
+ completeRequest(callback, status, response, '', text);
8338
+ callbacks.removeCallback(callbackPath);
8339
+ });
8340
+ } else {
8341
+
8342
+ var xhr = createXhr(method, url);
8343
+
8344
+ xhr.open(method, url, true);
8345
+ forEach(headers, function(value, key) {
8346
+ if (isDefined(value)) {
8347
+ xhr.setRequestHeader(key, value);
8348
+ }
8349
+ });
8350
+
8351
+ xhr.onload = function requestLoaded() {
8352
+ var statusText = xhr.statusText || '';
8353
+
8354
+ var response = ('response' in xhr) ? xhr.response : xhr.responseText;
8355
+
8356
+ var status = xhr.status === 1223 ? 204 : xhr.status;
8357
+
8358
+ if (status === 0) {
8359
+ status = response ? 200 : urlResolve(url).protocol === 'file' ? 404 : 0;
8360
+ }
8361
+
8362
+ completeRequest(callback,
8363
+ status,
8364
+ response,
8365
+ xhr.getAllResponseHeaders(),
8366
+ statusText);
8367
+ };
8368
+
8369
+ var requestError = function() {
8370
+ completeRequest(callback, -1, null, null, '');
8371
+ };
8372
+
8373
+ xhr.onerror = requestError;
8374
+ xhr.onabort = requestError;
8375
+ xhr.ontimeout = requestError;
8376
+
8377
+ forEach(eventHandlers, function(value, key) {
8378
+ xhr.addEventListener(key, value);
8379
+ });
8380
+
8381
+ forEach(uploadEventHandlers, function(value, key) {
8382
+ xhr.upload.addEventListener(key, value);
8383
+ });
8384
+
8385
+ if (withCredentials) {
8386
+ xhr.withCredentials = true;
8387
+ }
8388
+
8389
+ if (responseType) {
8390
+ try {
8391
+ xhr.responseType = responseType;
8392
+ } catch (e) {
8393
+ if (responseType !== 'json') {
8394
+ throw e;
8395
+ }
8396
+ }
8397
+ }
8398
+
8399
+ xhr.send(isUndefined(post) ? null : post);
8400
+ }
8401
+
8402
+ if (timeout > 0) {
8403
+ var timeoutId = $browserDefer(timeoutRequest, timeout);
8404
+ } else if (isPromiseLike(timeout)) {
8405
+ timeout.then(timeoutRequest);
8406
+ }
8407
+
8408
+
8409
+ function timeoutRequest() {
8410
+ if (jsonpDone) {
8411
+ jsonpDone();
8412
+ }
8413
+ if (xhr) {
8414
+ xhr.abort();
8415
+ }
8416
+ }
8417
+
8418
+ function completeRequest(callback, status, response, headersString, statusText) {
8419
+ if (isDefined(timeoutId)) {
8420
+ $browserDefer.cancel(timeoutId);
8421
+ }
8422
+ jsonpDone = xhr = null;
8423
+
8424
+ callback(status, response, headersString, statusText);
8425
+ }
8426
+ };
8427
+
8428
+ function jsonpReq(url, callbackPath, done) {
8429
+ url = url.replace('JSON_CALLBACK', callbackPath);
8430
+ var script = rawDocument.createElement('script'), callback = null;
8431
+ script.type = 'text/javascript';
8432
+ script.src = url;
8433
+ script.async = true;
8434
+
8435
+ callback = function(event) {
8436
+ script.removeEventListener('load', callback);
8437
+ script.removeEventListener('error', callback);
8438
+ rawDocument.body.removeChild(script);
8439
+ script = null;
8440
+ var status = -1;
8441
+ var text = 'unknown';
8442
+
8443
+ if (event) {
8444
+ if (event.type === 'load' && !callbacks.wasCalled(callbackPath)) {
8445
+ event = { type: 'error' };
8446
+ }
8447
+ text = event.type;
8448
+ status = event.type === 'error' ? 404 : 200;
8449
+ }
8450
+
8451
+ if (done) {
8452
+ done(status, text);
8453
+ }
8454
+ };
8455
+
8456
+ script.addEventListener('load', callback);
8457
+ script.addEventListener('error', callback);
8458
+ rawDocument.body.appendChild(script);
8459
+ return callback;
8460
+ }
8461
+ }
8462
+
8463
+ var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');
8464
+ $interpolateMinErr.throwNoconcat = function(text) {
8465
+ throw $interpolateMinErr('noconcat',
8466
+ 'Error while interpolating: {0}\nStrict Contextual Escaping disallows ' +
8467
+ 'interpolations that concatenate multiple expressions when a trusted value is ' +
8468
+ 'required. See http://docs.angularjs.org/api/ng.$sce', text);
8469
+ };
8470
+
8471
+ $interpolateMinErr.interr = function(text, err) {
8472
+ return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString());
8473
+ };
8474
+
8475
+ function $InterpolateProvider() {
8476
+ var startSymbol = '{{';
8477
+ var endSymbol = '}}';
8478
+
8479
+ this.startSymbol = function(value) {
8480
+ if (value) {
8481
+ startSymbol = value;
8482
+ return this;
8483
+ } else {
8484
+ return startSymbol;
8485
+ }
8486
+ };
8487
+
8488
+ this.endSymbol = function(value) {
8489
+ if (value) {
8490
+ endSymbol = value;
8491
+ return this;
8492
+ } else {
8493
+ return endSymbol;
8494
+ }
8495
+ };
8496
+
8497
+
8498
+ this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {
8499
+ var startSymbolLength = startSymbol.length,
8500
+ endSymbolLength = endSymbol.length,
8501
+ escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),
8502
+ escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');
8503
+
8504
+ function escape(ch) {
8505
+ return '\\\\\\' + ch;
8506
+ }
8507
+
8508
+ function unescapeText(text) {
8509
+ return text.replace(escapedStartRegexp, startSymbol).
8510
+ replace(escapedEndRegexp, endSymbol);
8511
+ }
8512
+
8513
+ function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
8514
+ var unwatch = scope.$watch(function constantInterpolateWatch(scope) {
8515
+ unwatch();
8516
+ return constantInterp(scope);
8517
+ }, listener, objectEquality);
8518
+ return unwatch;
8519
+ }
8520
+
8521
+ function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
8522
+ if (!text.length || text.indexOf(startSymbol) === -1) {
8523
+ var constantInterp;
8524
+ if (!mustHaveExpression) {
8525
+ var unescapedText = unescapeText(text);
8526
+ constantInterp = valueFn(unescapedText);
8527
+ constantInterp.exp = text;
8528
+ constantInterp.expressions = [];
8529
+ constantInterp.$$watchDelegate = constantWatchDelegate;
8530
+ }
8531
+ return constantInterp;
8532
+ }
8533
+
8534
+ allOrNothing = !!allOrNothing;
8535
+ var startIndex,
8536
+ endIndex,
8537
+ index = 0,
8538
+ expressions = [],
8539
+ parseFns = [],
8540
+ textLength = text.length,
8541
+ exp,
8542
+ concat = [],
8543
+ expressionPositions = [];
8544
+
8545
+ while (index < textLength) {
8546
+ if (((startIndex = text.indexOf(startSymbol, index)) !== -1) &&
8547
+ ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) !== -1)) {
8548
+ if (index !== startIndex) {
8549
+ concat.push(unescapeText(text.substring(index, startIndex)));
8550
+ }
8551
+ exp = text.substring(startIndex + startSymbolLength, endIndex);
8552
+ expressions.push(exp);
8553
+ parseFns.push($parse(exp, parseStringifyInterceptor));
8554
+ index = endIndex + endSymbolLength;
8555
+ expressionPositions.push(concat.length);
8556
+ concat.push('');
8557
+ } else {
8558
+ if (index !== textLength) {
8559
+ concat.push(unescapeText(text.substring(index)));
8560
+ }
8561
+ break;
8562
+ }
8563
+ }
8564
+
8565
+ if (trustedContext && concat.length > 1) {
8566
+ $interpolateMinErr.throwNoconcat(text);
8567
+ }
8568
+
8569
+ if (!mustHaveExpression || expressions.length) {
8570
+ var compute = function(values) {
8571
+ for (var i = 0, ii = expressions.length; i < ii; i++) {
8572
+ if (allOrNothing && isUndefined(values[i])) return;
8573
+ concat[expressionPositions[i]] = values[i];
8574
+ }
8575
+ return concat.join('');
8576
+ };
8577
+
8578
+ var getValue = function(value) {
8579
+ return trustedContext ?
8580
+ $sce.getTrusted(trustedContext, value) :
8581
+ $sce.valueOf(value);
8582
+ };
8583
+
8584
+ return extend(function interpolationFn(context) {
8585
+ var i = 0;
8586
+ var ii = expressions.length;
8587
+ var values = new Array(ii);
8588
+
8589
+ try {
8590
+ for (; i < ii; i++) {
8591
+ values[i] = parseFns[i](context);
8592
+ }
8593
+
8594
+ return compute(values);
8595
+ } catch (err) {
8596
+ $exceptionHandler($interpolateMinErr.interr(text, err));
8597
+ }
8598
+
8599
+ }, {
8600
+ exp: text,
8601
+ expressions: expressions,
8602
+ $$watchDelegate: function(scope, listener) {
8603
+ var lastValue;
8604
+ return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {
8605
+ var currValue = compute(values);
8606
+ if (isFunction(listener)) {
8607
+ listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);
8608
+ }
8609
+ lastValue = currValue;
8610
+ });
8611
+ }
8612
+ });
8613
+ }
8614
+
8615
+ function parseStringifyInterceptor(value) {
8616
+ try {
8617
+ value = getValue(value);
8618
+ return allOrNothing && !isDefined(value) ? value : stringify(value);
8619
+ } catch (err) {
8620
+ $exceptionHandler($interpolateMinErr.interr(text, err));
8621
+ }
8622
+ }
8623
+ }
8624
+
8625
+
8626
+ $interpolate.startSymbol = function() {
8627
+ return startSymbol;
8628
+ };
8629
+
8630
+
8631
+ $interpolate.endSymbol = function() {
8632
+ return endSymbol;
8633
+ };
8634
+
8635
+ return $interpolate;
8636
+ }];
8637
+ }
8638
+
8639
+ function $IntervalProvider() {
8640
+ this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',
8641
+ function($rootScope, $window, $q, $$q, $browser) {
8642
+ var intervals = {};
8643
+
8644
+
8645
+ function interval(fn, delay, count, invokeApply) {
8646
+ var hasParams = arguments.length > 4,
8647
+ args = hasParams ? sliceArgs(arguments, 4) : [],
8648
+ setInterval = $window.setInterval,
8649
+ clearInterval = $window.clearInterval,
8650
+ iteration = 0,
8651
+ skipApply = (isDefined(invokeApply) && !invokeApply),
8652
+ deferred = (skipApply ? $$q : $q).defer(),
8653
+ promise = deferred.promise;
8654
+
8655
+ count = isDefined(count) ? count : 0;
8656
+
8657
+ promise.$$intervalId = setInterval(function tick() {
8658
+ if (skipApply) {
8659
+ $browser.defer(callback);
8660
+ } else {
8661
+ $rootScope.$evalAsync(callback);
8662
+ }
8663
+ deferred.notify(iteration++);
8664
+
8665
+ if (count > 0 && iteration >= count) {
8666
+ deferred.resolve(iteration);
8667
+ clearInterval(promise.$$intervalId);
8668
+ delete intervals[promise.$$intervalId];
8669
+ }
8670
+
8671
+ if (!skipApply) $rootScope.$apply();
8672
+
8673
+ }, delay);
8674
+
8675
+ intervals[promise.$$intervalId] = deferred;
8676
+
8677
+ return promise;
8678
+
8679
+ function callback() {
8680
+ if (!hasParams) {
8681
+ fn(iteration);
8682
+ } else {
8683
+ fn.apply(null, args);
8684
+ }
8685
+ }
8686
+ }
8687
+
8688
+
8689
+ interval.cancel = function(promise) {
8690
+ if (promise && promise.$$intervalId in intervals) {
8691
+ intervals[promise.$$intervalId].promise.catch(noop);
8692
+ intervals[promise.$$intervalId].reject('canceled');
8693
+ $window.clearInterval(promise.$$intervalId);
8694
+ delete intervals[promise.$$intervalId];
8695
+ return true;
8696
+ }
8697
+ return false;
8698
+ };
8699
+
8700
+ return interval;
8701
+ }];
8702
+ }
8703
+
8704
+ var $jsonpCallbacksProvider = function() {
8705
+ this.$get = ['$window', function($window) {
8706
+ var callbacks = $window.angular.callbacks;
8707
+ var callbackMap = {};
8708
+
8709
+ function createCallback(callbackId) {
8710
+ var callback = function(data) {
8711
+ callback.data = data;
8712
+ callback.called = true;
8713
+ };
8714
+ callback.id = callbackId;
8715
+ return callback;
8716
+ }
8717
+
8718
+ return {
8719
+ createCallback: function(url) {
8720
+ var callbackId = '_' + (callbacks.$$counter++).toString(36);
8721
+ var callbackPath = 'angular.callbacks.' + callbackId;
8722
+ var callback = createCallback(callbackId);
8723
+ callbackMap[callbackPath] = callbacks[callbackId] = callback;
8724
+ return callbackPath;
8725
+ },
8726
+ wasCalled: function(callbackPath) {
8727
+ return callbackMap[callbackPath].called;
8728
+ },
8729
+ getResponse: function(callbackPath) {
8730
+ return callbackMap[callbackPath].data;
8731
+ },
8732
+ removeCallback: function(callbackPath) {
8733
+ var callback = callbackMap[callbackPath];
8734
+ delete callbacks[callback.id];
8735
+ delete callbackMap[callbackPath];
8736
+ }
8737
+ };
8738
+ }];
8739
+ };
8740
+
8741
+
8742
+ var PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/,
8743
+ DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
8744
+ var $locationMinErr = minErr('$location');
8745
+
8746
+
8747
+ function encodePath(path) {
8748
+ var segments = path.split('/'),
8749
+ i = segments.length;
8750
+
8751
+ while (i--) {
8752
+ segments[i] = encodeUriSegment(segments[i]);
8753
+ }
8754
+
8755
+ return segments.join('/');
8756
+ }
8757
+
8758
+ function parseAbsoluteUrl(absoluteUrl, locationObj) {
8759
+ var parsedUrl = urlResolve(absoluteUrl);
8760
+
8761
+ locationObj.$$protocol = parsedUrl.protocol;
8762
+ locationObj.$$host = parsedUrl.hostname;
8763
+ locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
8764
+ }
8765
+
8766
+ var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/;
8767
+ function parseAppUrl(url, locationObj) {
8768
+
8769
+ if (DOUBLE_SLASH_REGEX.test(url)) {
8770
+ throw $locationMinErr('badpath', 'Invalid url "{0}".', url);
8771
+ }
8772
+
8773
+ var prefixed = (url.charAt(0) !== '/');
8774
+ if (prefixed) {
8775
+ url = '/' + url;
8776
+ }
8777
+ var match = urlResolve(url);
8778
+ locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
8779
+ match.pathname.substring(1) : match.pathname);
8780
+ locationObj.$$search = parseKeyValue(match.search);
8781
+ locationObj.$$hash = decodeURIComponent(match.hash);
8782
+
8783
+ if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') {
8784
+ locationObj.$$path = '/' + locationObj.$$path;
8785
+ }
8786
+ }
8787
+
8788
+ function startsWith(str, search) {
8789
+ return str.slice(0, search.length) === search;
8790
+ }
8791
+
8792
+ function stripBaseUrl(base, url) {
8793
+ if (startsWith(url, base)) {
8794
+ return url.substr(base.length);
8795
+ }
8796
+ }
8797
+
8798
+
8799
+ function stripHash(url) {
8800
+ var index = url.indexOf('#');
8801
+ return index === -1 ? url : url.substr(0, index);
8802
+ }
8803
+
8804
+ function trimEmptyHash(url) {
8805
+ return url.replace(/(#.+)|#$/, '$1');
8806
+ }
8807
+
8808
+
8809
+ function stripFile(url) {
8810
+ return url.substr(0, stripHash(url).lastIndexOf('/') + 1);
8811
+ }
8812
+
8813
+ function serverBase(url) {
8814
+ return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));
8815
+ }
8816
+
8817
+
8818
+ function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
8819
+ this.$$html5 = true;
8820
+ basePrefix = basePrefix || '';
8821
+ parseAbsoluteUrl(appBase, this);
8822
+
8823
+
8824
+ this.$$parse = function(url) {
8825
+ var pathUrl = stripBaseUrl(appBaseNoFile, url);
8826
+ if (!isString(pathUrl)) {
8827
+ throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url,
8828
+ appBaseNoFile);
8829
+ }
8830
+
8831
+ parseAppUrl(pathUrl, this);
8832
+
8833
+ if (!this.$$path) {
8834
+ this.$$path = '/';
8835
+ }
8836
+
8837
+ this.$$compose();
8838
+ };
8839
+
8840
+ this.$$compose = function() {
8841
+ var search = toKeyValue(this.$$search),
8842
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
8843
+
8844
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
8845
+ this.$$absUrl = appBaseNoFile + this.$$url.substr(1);
8846
+ };
8847
+
8848
+ this.$$parseLinkUrl = function(url, relHref) {
8849
+ if (relHref && relHref[0] === '#') {
8850
+ this.hash(relHref.slice(1));
8851
+ return true;
8852
+ }
8853
+ var appUrl, prevAppUrl;
8854
+ var rewrittenUrl;
8855
+
8856
+
8857
+ if (isDefined(appUrl = stripBaseUrl(appBase, url))) {
8858
+ prevAppUrl = appUrl;
8859
+ if (basePrefix && isDefined(appUrl = stripBaseUrl(basePrefix, appUrl))) {
8860
+ rewrittenUrl = appBaseNoFile + (stripBaseUrl('/', appUrl) || appUrl);
8861
+ } else {
8862
+ rewrittenUrl = appBase + prevAppUrl;
8863
+ }
8864
+ } else if (isDefined(appUrl = stripBaseUrl(appBaseNoFile, url))) {
8865
+ rewrittenUrl = appBaseNoFile + appUrl;
8866
+ } else if (appBaseNoFile === url + '/') {
8867
+ rewrittenUrl = appBaseNoFile;
8868
+ }
8869
+ if (rewrittenUrl) {
8870
+ this.$$parse(rewrittenUrl);
8871
+ }
8872
+ return !!rewrittenUrl;
8873
+ };
8874
+ }
8875
+
8876
+
8877
+ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
8878
+
8879
+ parseAbsoluteUrl(appBase, this);
8880
+
8881
+
8882
+ this.$$parse = function(url) {
8883
+ var withoutBaseUrl = stripBaseUrl(appBase, url) || stripBaseUrl(appBaseNoFile, url);
8884
+ var withoutHashUrl;
8885
+
8886
+ if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {
8887
+
8888
+ withoutHashUrl = stripBaseUrl(hashPrefix, withoutBaseUrl);
8889
+ if (isUndefined(withoutHashUrl)) {
8890
+ withoutHashUrl = withoutBaseUrl;
8891
+ }
8892
+
8893
+ } else {
8894
+ if (this.$$html5) {
8895
+ withoutHashUrl = withoutBaseUrl;
8896
+ } else {
8897
+ withoutHashUrl = '';
8898
+ if (isUndefined(withoutBaseUrl)) {
8899
+ appBase = url;
8900
+ this.replace();
8901
+ }
8902
+ }
8903
+ }
8904
+
8905
+ parseAppUrl(withoutHashUrl, this);
8906
+
8907
+ this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
8908
+
8909
+ this.$$compose();
8910
+
8911
+ function removeWindowsDriveName(path, url, base) {
8912
+ var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
8913
+
8914
+ var firstPathSegmentMatch;
8915
+
8916
+ if (startsWith(url, base)) {
8917
+ url = url.replace(base, '');
8918
+ }
8919
+
8920
+ if (windowsFilePathExp.exec(url)) {
8921
+ return path;
8922
+ }
8923
+
8924
+ firstPathSegmentMatch = windowsFilePathExp.exec(path);
8925
+ return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
8926
+ }
8927
+ };
8928
+
8929
+ this.$$compose = function() {
8930
+ var search = toKeyValue(this.$$search),
8931
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
8932
+
8933
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
8934
+ this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
8935
+ };
8936
+
8937
+ this.$$parseLinkUrl = function(url, relHref) {
8938
+ if (stripHash(appBase) === stripHash(url)) {
8939
+ this.$$parse(url);
8940
+ return true;
8941
+ }
8942
+ return false;
8943
+ };
8944
+ }
8945
+
8946
+
8947
+ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
8948
+ this.$$html5 = true;
8949
+ LocationHashbangUrl.apply(this, arguments);
8950
+
8951
+ this.$$parseLinkUrl = function(url, relHref) {
8952
+ if (relHref && relHref[0] === '#') {
8953
+ this.hash(relHref.slice(1));
8954
+ return true;
8955
+ }
8956
+
8957
+ var rewrittenUrl;
8958
+ var appUrl;
8959
+
8960
+ if (appBase === stripHash(url)) {
8961
+ rewrittenUrl = url;
8962
+ } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) {
8963
+ rewrittenUrl = appBase + hashPrefix + appUrl;
8964
+ } else if (appBaseNoFile === url + '/') {
8965
+ rewrittenUrl = appBaseNoFile;
8966
+ }
8967
+ if (rewrittenUrl) {
8968
+ this.$$parse(rewrittenUrl);
8969
+ }
8970
+ return !!rewrittenUrl;
8971
+ };
8972
+
8973
+ this.$$compose = function() {
8974
+ var search = toKeyValue(this.$$search),
8975
+ hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
8976
+
8977
+ this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
8978
+ this.$$absUrl = appBase + hashPrefix + this.$$url;
8979
+ };
8980
+
8981
+ }
8982
+
8983
+
8984
+ var locationPrototype = {
8985
+
8986
+ $$absUrl:'',
8987
+
8988
+ $$html5: false,
8989
+
8990
+ $$replace: false,
8991
+
8992
+ absUrl: locationGetter('$$absUrl'),
8993
+
8994
+ url: function(url) {
8995
+ if (isUndefined(url)) {
8996
+ return this.$$url;
8997
+ }
8998
+
8999
+ var match = PATH_MATCH.exec(url);
9000
+ if (match[1] || url === '') this.path(decodeURIComponent(match[1]));
9001
+ if (match[2] || match[1] || url === '') this.search(match[3] || '');
9002
+ this.hash(match[5] || '');
9003
+
9004
+ return this;
9005
+ },
9006
+
9007
+ protocol: locationGetter('$$protocol'),
9008
+
9009
+ host: locationGetter('$$host'),
9010
+
9011
+ port: locationGetter('$$port'),
9012
+
9013
+ path: locationGetterSetter('$$path', function(path) {
9014
+ path = path !== null ? path.toString() : '';
9015
+ return path.charAt(0) === '/' ? path : '/' + path;
9016
+ }),
9017
+
9018
+ search: function(search, paramValue) {
9019
+ switch (arguments.length) {
9020
+ case 0:
9021
+ return this.$$search;
9022
+ case 1:
9023
+ if (isString(search) || isNumber(search)) {
9024
+ search = search.toString();
9025
+ this.$$search = parseKeyValue(search);
9026
+ } else if (isObject(search)) {
9027
+ search = copy(search, {});
9028
+ forEach(search, function(value, key) {
9029
+ if (value == null) delete search[key];
9030
+ });
9031
+
9032
+ this.$$search = search;
9033
+ } else {
9034
+ throw $locationMinErr('isrcharg',
9035
+ 'The first argument of the `$location#search()` call must be a string or an object.');
9036
+ }
9037
+ break;
9038
+ default:
9039
+ if (isUndefined(paramValue) || paramValue === null) {
9040
+ delete this.$$search[search];
9041
+ } else {
9042
+ this.$$search[search] = paramValue;
9043
+ }
9044
+ }
9045
+
9046
+ this.$$compose();
9047
+ return this;
9048
+ },
9049
+
9050
+ hash: locationGetterSetter('$$hash', function(hash) {
9051
+ return hash !== null ? hash.toString() : '';
9052
+ }),
9053
+
9054
+ replace: function() {
9055
+ this.$$replace = true;
9056
+ return this;
9057
+ }
9058
+ };
9059
+
9060
+ forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {
9061
+ Location.prototype = Object.create(locationPrototype);
9062
+
9063
+ Location.prototype.state = function(state) {
9064
+ if (!arguments.length) {
9065
+ return this.$$state;
9066
+ }
9067
+
9068
+ if (Location !== LocationHtml5Url || !this.$$html5) {
9069
+ throw $locationMinErr('nostate', 'History API state support is available only ' +
9070
+ 'in HTML5 mode and only in browsers supporting HTML5 History API');
9071
+ }
9072
+ this.$$state = isUndefined(state) ? null : state;
9073
+
9074
+ return this;
9075
+ };
9076
+ });
9077
+
9078
+
9079
+ function locationGetter(property) {
9080
+ return function() {
9081
+ return this[property];
9082
+ };
9083
+ }
9084
+
9085
+
9086
+ function locationGetterSetter(property, preprocess) {
9087
+ return function(value) {
9088
+ if (isUndefined(value)) {
9089
+ return this[property];
9090
+ }
9091
+
9092
+ this[property] = preprocess(value);
9093
+ this.$$compose();
9094
+
9095
+ return this;
9096
+ };
9097
+ }
9098
+
9099
+
9100
+
9101
+ function $LocationProvider() {
9102
+ var hashPrefix = '!',
9103
+ html5Mode = {
9104
+ enabled: false,
9105
+ requireBase: true,
9106
+ rewriteLinks: true
9107
+ };
9108
+
9109
+ this.hashPrefix = function(prefix) {
9110
+ if (isDefined(prefix)) {
9111
+ hashPrefix = prefix;
9112
+ return this;
9113
+ } else {
9114
+ return hashPrefix;
9115
+ }
9116
+ };
9117
+
9118
+ this.html5Mode = function(mode) {
9119
+ if (isBoolean(mode)) {
9120
+ html5Mode.enabled = mode;
9121
+ return this;
9122
+ } else if (isObject(mode)) {
9123
+
9124
+ if (isBoolean(mode.enabled)) {
9125
+ html5Mode.enabled = mode.enabled;
9126
+ }
9127
+
9128
+ if (isBoolean(mode.requireBase)) {
9129
+ html5Mode.requireBase = mode.requireBase;
9130
+ }
9131
+
9132
+ if (isBoolean(mode.rewriteLinks) || isString(mode.rewriteLinks)) {
9133
+ html5Mode.rewriteLinks = mode.rewriteLinks;
9134
+ }
9135
+
9136
+ return this;
9137
+ } else {
9138
+ return html5Mode;
9139
+ }
9140
+ };
9141
+
9142
+
9143
+
9144
+ this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',
9145
+ function($rootScope, $browser, $sniffer, $rootElement, $window) {
9146
+ var $location,
9147
+ LocationMode,
9148
+ baseHref = $browser.baseHref(),
9149
+ initialUrl = $browser.url(),
9150
+ appBase;
9151
+
9152
+ if (html5Mode.enabled) {
9153
+ if (!baseHref && html5Mode.requireBase) {
9154
+ throw $locationMinErr('nobase',
9155
+ '$location in HTML5 mode requires a <base> tag to be present!');
9156
+ }
9157
+ appBase = serverBase(initialUrl) + (baseHref || '/');
9158
+ LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
9159
+ } else {
9160
+ appBase = stripHash(initialUrl);
9161
+ LocationMode = LocationHashbangUrl;
9162
+ }
9163
+ var appBaseNoFile = stripFile(appBase);
9164
+
9165
+ $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);
9166
+ $location.$$parseLinkUrl(initialUrl, initialUrl);
9167
+
9168
+ $location.$$state = $browser.state();
9169
+
9170
+ var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
9171
+
9172
+ function setBrowserUrlWithFallback(url, replace, state) {
9173
+ var oldUrl = $location.url();
9174
+ var oldState = $location.$$state;
9175
+ try {
9176
+ $browser.url(url, replace, state);
9177
+
9178
+ $location.$$state = $browser.state();
9179
+ } catch (e) {
9180
+ $location.url(oldUrl);
9181
+ $location.$$state = oldState;
9182
+
9183
+ throw e;
9184
+ }
9185
+ }
9186
+
9187
+ $rootElement.on('click', function(event) {
9188
+ var rewriteLinks = html5Mode.rewriteLinks;
9189
+
9190
+ if (!rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which === 2 || event.button === 2) return;
9191
+
9192
+ var elm = jqLite(event.target);
9193
+
9194
+ while (nodeName_(elm[0]) !== 'a') {
9195
+ if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
9196
+ }
9197
+
9198
+ if (isString(rewriteLinks) && isUndefined(elm.attr(rewriteLinks))) return;
9199
+
9200
+ var absHref = elm.prop('href');
9201
+ var relHref = elm.attr('href') || elm.attr('xlink:href');
9202
+
9203
+ if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {
9204
+ absHref = urlResolve(absHref.animVal).href;
9205
+ }
9206
+
9207
+ if (IGNORE_URI_REGEXP.test(absHref)) return;
9208
+
9209
+ if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {
9210
+ if ($location.$$parseLinkUrl(absHref, relHref)) {
9211
+ event.preventDefault();
9212
+ if ($location.absUrl() !== $browser.url()) {
9213
+ $rootScope.$apply();
9214
+ $window.angular['ff-684208-preventDefault'] = true;
9215
+ }
9216
+ }
9217
+ }
9218
+ });
9219
+
9220
+
9221
+ if (trimEmptyHash($location.absUrl()) !== trimEmptyHash(initialUrl)) {
9222
+ $browser.url($location.absUrl(), true);
9223
+ }
9224
+
9225
+ var initializing = true;
9226
+
9227
+ $browser.onUrlChange(function(newUrl, newState) {
9228
+
9229
+ if (!startsWith(newUrl, appBaseNoFile)) {
9230
+ $window.location.href = newUrl;
9231
+ return;
9232
+ }
9233
+
9234
+ $rootScope.$evalAsync(function() {
9235
+ var oldUrl = $location.absUrl();
9236
+ var oldState = $location.$$state;
9237
+ var defaultPrevented;
9238
+ newUrl = trimEmptyHash(newUrl);
9239
+ $location.$$parse(newUrl);
9240
+ $location.$$state = newState;
9241
+
9242
+ defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
9243
+ newState, oldState).defaultPrevented;
9244
+
9245
+ if ($location.absUrl() !== newUrl) return;
9246
+
9247
+ if (defaultPrevented) {
9248
+ $location.$$parse(oldUrl);
9249
+ $location.$$state = oldState;
9250
+ setBrowserUrlWithFallback(oldUrl, false, oldState);
9251
+ } else {
9252
+ initializing = false;
9253
+ afterLocationChange(oldUrl, oldState);
9254
+ }
9255
+ });
9256
+ if (!$rootScope.$$phase) $rootScope.$digest();
9257
+ });
9258
+
9259
+ $rootScope.$watch(function $locationWatch() {
9260
+ var oldUrl = trimEmptyHash($browser.url());
9261
+ var newUrl = trimEmptyHash($location.absUrl());
9262
+ var oldState = $browser.state();
9263
+ var currentReplace = $location.$$replace;
9264
+ var urlOrStateChanged = oldUrl !== newUrl ||
9265
+ ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
9266
+
9267
+ if (initializing || urlOrStateChanged) {
9268
+ initializing = false;
9269
+
9270
+ $rootScope.$evalAsync(function() {
9271
+ var newUrl = $location.absUrl();
9272
+ var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
9273
+ $location.$$state, oldState).defaultPrevented;
9274
+
9275
+ if ($location.absUrl() !== newUrl) return;
9276
+
9277
+ if (defaultPrevented) {
9278
+ $location.$$parse(oldUrl);
9279
+ $location.$$state = oldState;
9280
+ } else {
9281
+ if (urlOrStateChanged) {
9282
+ setBrowserUrlWithFallback(newUrl, currentReplace,
9283
+ oldState === $location.$$state ? null : $location.$$state);
9284
+ }
9285
+ afterLocationChange(oldUrl, oldState);
9286
+ }
9287
+ });
9288
+ }
9289
+
9290
+ $location.$$replace = false;
9291
+
9292
+ });
9293
+
9294
+ return $location;
9295
+
9296
+ function afterLocationChange(oldUrl, oldState) {
9297
+ $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,
9298
+ $location.$$state, oldState);
9299
+ }
9300
+ }];
9301
+ }
9302
+
9303
+
9304
+ function $LogProvider() {
9305
+ var debug = true,
9306
+ self = this;
9307
+
9308
+ this.debugEnabled = function(flag) {
9309
+ if (isDefined(flag)) {
9310
+ debug = flag;
9311
+ return this;
9312
+ } else {
9313
+ return debug;
9314
+ }
9315
+ };
9316
+
9317
+ this.$get = ['$window', function($window) {
9318
+ return {
9319
+ log: consoleLog('log'),
9320
+
9321
+ info: consoleLog('info'),
9322
+
9323
+ warn: consoleLog('warn'),
9324
+
9325
+ error: consoleLog('error'),
9326
+
9327
+ debug: (function() {
9328
+ var fn = consoleLog('debug');
9329
+
9330
+ return function() {
9331
+ if (debug) {
9332
+ fn.apply(self, arguments);
9333
+ }
9334
+ };
9335
+ })()
9336
+ };
9337
+
9338
+ function formatError(arg) {
9339
+ if (arg instanceof Error) {
9340
+ if (arg.stack) {
9341
+ arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
9342
+ ? 'Error: ' + arg.message + '\n' + arg.stack
9343
+ : arg.stack;
9344
+ } else if (arg.sourceURL) {
9345
+ arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
9346
+ }
9347
+ }
9348
+ return arg;
9349
+ }
9350
+
9351
+ function consoleLog(type) {
9352
+ var console = $window.console || {},
9353
+ logFn = console[type] || console.log || noop,
9354
+ hasApply = false;
9355
+
9356
+ try {
9357
+ hasApply = !!logFn.apply;
9358
+ } catch (e) { }
9359
+
9360
+ if (hasApply) {
9361
+ return function() {
9362
+ var args = [];
9363
+ forEach(arguments, function(arg) {
9364
+ args.push(formatError(arg));
9365
+ });
9366
+ return logFn.apply(console, args);
9367
+ };
9368
+ }
9369
+
9370
+ return function(arg1, arg2) {
9371
+ logFn(arg1, arg2 == null ? '' : arg2);
9372
+ };
9373
+ }
9374
+ }];
9375
+ }
9376
+
9377
+
9378
+ var $parseMinErr = minErr('$parse');
9379
+
9380
+ var objectValueOf = {}.constructor.prototype.valueOf;
9381
+
9382
+
9383
+
9384
+ function getStringValue(name) {
9385
+ return name + '';
9386
+ }
9387
+
9388
+
9389
+ var OPERATORS = createMap();
9390
+ forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });
9391
+ var ESCAPE = {'n':'\n', 'f':'\f', 'r':'\r', 't':'\t', 'v':'\v', '\'':'\'', '"':'"'};
9392
+
9393
+
9394
+
9395
+
9396
+ var Lexer = function Lexer(options) {
9397
+ this.options = options;
9398
+ };
9399
+
9400
+ Lexer.prototype = {
9401
+ constructor: Lexer,
9402
+
9403
+ lex: function(text) {
9404
+ this.text = text;
9405
+ this.index = 0;
9406
+ this.tokens = [];
9407
+
9408
+ while (this.index < this.text.length) {
9409
+ var ch = this.text.charAt(this.index);
9410
+ if (ch === '"' || ch === '\'') {
9411
+ this.readString(ch);
9412
+ } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {
9413
+ this.readNumber();
9414
+ } else if (this.isIdentifierStart(this.peekMultichar())) {
9415
+ this.readIdent();
9416
+ } else if (this.is(ch, '(){}[].,;:?')) {
9417
+ this.tokens.push({index: this.index, text: ch});
9418
+ this.index++;
9419
+ } else if (this.isWhitespace(ch)) {
9420
+ this.index++;
9421
+ } else {
9422
+ var ch2 = ch + this.peek();
9423
+ var ch3 = ch2 + this.peek(2);
9424
+ var op1 = OPERATORS[ch];
9425
+ var op2 = OPERATORS[ch2];
9426
+ var op3 = OPERATORS[ch3];
9427
+ if (op1 || op2 || op3) {
9428
+ var token = op3 ? ch3 : (op2 ? ch2 : ch);
9429
+ this.tokens.push({index: this.index, text: token, operator: true});
9430
+ this.index += token.length;
9431
+ } else {
9432
+ this.throwError('Unexpected next character ', this.index, this.index + 1);
9433
+ }
9434
+ }
9435
+ }
9436
+ return this.tokens;
9437
+ },
9438
+
9439
+ is: function(ch, chars) {
9440
+ return chars.indexOf(ch) !== -1;
9441
+ },
9442
+
9443
+ peek: function(i) {
9444
+ var num = i || 1;
9445
+ return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
9446
+ },
9447
+
9448
+ isNumber: function(ch) {
9449
+ return ('0' <= ch && ch <= '9') && typeof ch === 'string';
9450
+ },
9451
+
9452
+ isWhitespace: function(ch) {
9453
+ return (ch === ' ' || ch === '\r' || ch === '\t' ||
9454
+ ch === '\n' || ch === '\v' || ch === '\u00A0');
9455
+ },
9456
+
9457
+ isIdentifierStart: function(ch) {
9458
+ return this.options.isIdentifierStart ?
9459
+ this.options.isIdentifierStart(ch, this.codePointAt(ch)) :
9460
+ this.isValidIdentifierStart(ch);
9461
+ },
9462
+
9463
+ isValidIdentifierStart: function(ch) {
9464
+ return ('a' <= ch && ch <= 'z' ||
9465
+ 'A' <= ch && ch <= 'Z' ||
9466
+ '_' === ch || ch === '$');
9467
+ },
9468
+
9469
+ isIdentifierContinue: function(ch) {
9470
+ return this.options.isIdentifierContinue ?
9471
+ this.options.isIdentifierContinue(ch, this.codePointAt(ch)) :
9472
+ this.isValidIdentifierContinue(ch);
9473
+ },
9474
+
9475
+ isValidIdentifierContinue: function(ch, cp) {
9476
+ return this.isValidIdentifierStart(ch, cp) || this.isNumber(ch);
9477
+ },
9478
+
9479
+ codePointAt: function(ch) {
9480
+ if (ch.length === 1) return ch.charCodeAt(0);
9481
+ return (ch.charCodeAt(0) << 10) + ch.charCodeAt(1) - 0x35FDC00;
9482
+ },
9483
+
9484
+ peekMultichar: function() {
9485
+ var ch = this.text.charAt(this.index);
9486
+ var peek = this.peek();
9487
+ if (!peek) {
9488
+ return ch;
9489
+ }
9490
+ var cp1 = ch.charCodeAt(0);
9491
+ var cp2 = peek.charCodeAt(0);
9492
+ if (cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF) {
9493
+ return ch + peek;
9494
+ }
9495
+ return ch;
9496
+ },
9497
+
9498
+ isExpOperator: function(ch) {
9499
+ return (ch === '-' || ch === '+' || this.isNumber(ch));
9500
+ },
9501
+
9502
+ throwError: function(error, start, end) {
9503
+ end = end || this.index;
9504
+ var colStr = (isDefined(start)
9505
+ ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']'
9506
+ : ' ' + end);
9507
+ throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',
9508
+ error, colStr, this.text);
9509
+ },
9510
+
9511
+ readNumber: function() {
9512
+ var number = '';
9513
+ var start = this.index;
9514
+ while (this.index < this.text.length) {
9515
+ var ch = lowercase(this.text.charAt(this.index));
9516
+ if (ch === '.' || this.isNumber(ch)) {
9517
+ number += ch;
9518
+ } else {
9519
+ var peekCh = this.peek();
9520
+ if (ch === 'e' && this.isExpOperator(peekCh)) {
9521
+ number += ch;
9522
+ } else if (this.isExpOperator(ch) &&
9523
+ peekCh && this.isNumber(peekCh) &&
9524
+ number.charAt(number.length - 1) === 'e') {
9525
+ number += ch;
9526
+ } else if (this.isExpOperator(ch) &&
9527
+ (!peekCh || !this.isNumber(peekCh)) &&
9528
+ number.charAt(number.length - 1) === 'e') {
9529
+ this.throwError('Invalid exponent');
9530
+ } else {
9531
+ break;
9532
+ }
9533
+ }
9534
+ this.index++;
9535
+ }
9536
+ this.tokens.push({
9537
+ index: start,
9538
+ text: number,
9539
+ constant: true,
9540
+ value: Number(number)
9541
+ });
9542
+ },
9543
+
9544
+ readIdent: function() {
9545
+ var start = this.index;
9546
+ this.index += this.peekMultichar().length;
9547
+ while (this.index < this.text.length) {
9548
+ var ch = this.peekMultichar();
9549
+ if (!this.isIdentifierContinue(ch)) {
9550
+ break;
9551
+ }
9552
+ this.index += ch.length;
9553
+ }
9554
+ this.tokens.push({
9555
+ index: start,
9556
+ text: this.text.slice(start, this.index),
9557
+ identifier: true
9558
+ });
9559
+ },
9560
+
9561
+ readString: function(quote) {
9562
+ var start = this.index;
9563
+ this.index++;
9564
+ var string = '';
9565
+ var rawString = quote;
9566
+ var escape = false;
9567
+ while (this.index < this.text.length) {
9568
+ var ch = this.text.charAt(this.index);
9569
+ rawString += ch;
9570
+ if (escape) {
9571
+ if (ch === 'u') {
9572
+ var hex = this.text.substring(this.index + 1, this.index + 5);
9573
+ if (!hex.match(/[\da-f]{4}/i)) {
9574
+ this.throwError('Invalid unicode escape [\\u' + hex + ']');
9575
+ }
9576
+ this.index += 4;
9577
+ string += String.fromCharCode(parseInt(hex, 16));
9578
+ } else {
9579
+ var rep = ESCAPE[ch];
9580
+ string = string + (rep || ch);
9581
+ }
9582
+ escape = false;
9583
+ } else if (ch === '\\') {
9584
+ escape = true;
9585
+ } else if (ch === quote) {
9586
+ this.index++;
9587
+ this.tokens.push({
9588
+ index: start,
9589
+ text: rawString,
9590
+ constant: true,
9591
+ value: string
9592
+ });
9593
+ return;
9594
+ } else {
9595
+ string += ch;
9596
+ }
9597
+ this.index++;
9598
+ }
9599
+ this.throwError('Unterminated quote', start);
9600
+ }
9601
+ };
9602
+
9603
+ var AST = function AST(lexer, options) {
9604
+ this.lexer = lexer;
9605
+ this.options = options;
9606
+ };
9607
+
9608
+ AST.Program = 'Program';
9609
+ AST.ExpressionStatement = 'ExpressionStatement';
9610
+ AST.AssignmentExpression = 'AssignmentExpression';
9611
+ AST.ConditionalExpression = 'ConditionalExpression';
9612
+ AST.LogicalExpression = 'LogicalExpression';
9613
+ AST.BinaryExpression = 'BinaryExpression';
9614
+ AST.UnaryExpression = 'UnaryExpression';
9615
+ AST.CallExpression = 'CallExpression';
9616
+ AST.MemberExpression = 'MemberExpression';
9617
+ AST.Identifier = 'Identifier';
9618
+ AST.Literal = 'Literal';
9619
+ AST.ArrayExpression = 'ArrayExpression';
9620
+ AST.Property = 'Property';
9621
+ AST.ObjectExpression = 'ObjectExpression';
9622
+ AST.ThisExpression = 'ThisExpression';
9623
+ AST.LocalsExpression = 'LocalsExpression';
9624
+
9625
+ AST.NGValueParameter = 'NGValueParameter';
9626
+
9627
+ AST.prototype = {
9628
+ ast: function(text) {
9629
+ this.text = text;
9630
+ this.tokens = this.lexer.lex(text);
9631
+
9632
+ var value = this.program();
9633
+
9634
+ if (this.tokens.length !== 0) {
9635
+ this.throwError('is an unexpected token', this.tokens[0]);
9636
+ }
9637
+
9638
+ return value;
9639
+ },
9640
+
9641
+ program: function() {
9642
+ var body = [];
9643
+ while (true) {
9644
+ if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))
9645
+ body.push(this.expressionStatement());
9646
+ if (!this.expect(';')) {
9647
+ return { type: AST.Program, body: body};
9648
+ }
9649
+ }
9650
+ },
9651
+
9652
+ expressionStatement: function() {
9653
+ return { type: AST.ExpressionStatement, expression: this.filterChain() };
9654
+ },
9655
+
9656
+ filterChain: function() {
9657
+ var left = this.expression();
9658
+ while (this.expect('|')) {
9659
+ left = this.filter(left);
9660
+ }
9661
+ return left;
9662
+ },
9663
+
9664
+ expression: function() {
9665
+ return this.assignment();
9666
+ },
9667
+
9668
+ assignment: function() {
9669
+ var result = this.ternary();
9670
+ if (this.expect('=')) {
9671
+ if (!isAssignable(result)) {
9672
+ throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');
9673
+ }
9674
+
9675
+ result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};
9676
+ }
9677
+ return result;
9678
+ },
9679
+
9680
+ ternary: function() {
9681
+ var test = this.logicalOR();
9682
+ var alternate;
9683
+ var consequent;
9684
+ if (this.expect('?')) {
9685
+ alternate = this.expression();
9686
+ if (this.consume(':')) {
9687
+ consequent = this.expression();
9688
+ return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};
9689
+ }
9690
+ }
9691
+ return test;
9692
+ },
9693
+
9694
+ logicalOR: function() {
9695
+ var left = this.logicalAND();
9696
+ while (this.expect('||')) {
9697
+ left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };
9698
+ }
9699
+ return left;
9700
+ },
9701
+
9702
+ logicalAND: function() {
9703
+ var left = this.equality();
9704
+ while (this.expect('&&')) {
9705
+ left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};
9706
+ }
9707
+ return left;
9708
+ },
9709
+
9710
+ equality: function() {
9711
+ var left = this.relational();
9712
+ var token;
9713
+ while ((token = this.expect('==','!=','===','!=='))) {
9714
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };
9715
+ }
9716
+ return left;
9717
+ },
9718
+
9719
+ relational: function() {
9720
+ var left = this.additive();
9721
+ var token;
9722
+ while ((token = this.expect('<', '>', '<=', '>='))) {
9723
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };
9724
+ }
9725
+ return left;
9726
+ },
9727
+
9728
+ additive: function() {
9729
+ var left = this.multiplicative();
9730
+ var token;
9731
+ while ((token = this.expect('+','-'))) {
9732
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };
9733
+ }
9734
+ return left;
9735
+ },
9736
+
9737
+ multiplicative: function() {
9738
+ var left = this.unary();
9739
+ var token;
9740
+ while ((token = this.expect('*','/','%'))) {
9741
+ left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };
9742
+ }
9743
+ return left;
9744
+ },
9745
+
9746
+ unary: function() {
9747
+ var token;
9748
+ if ((token = this.expect('+', '-', '!'))) {
9749
+ return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };
9750
+ } else {
9751
+ return this.primary();
9752
+ }
9753
+ },
9754
+
9755
+ primary: function() {
9756
+ var primary;
9757
+ if (this.expect('(')) {
9758
+ primary = this.filterChain();
9759
+ this.consume(')');
9760
+ } else if (this.expect('[')) {
9761
+ primary = this.arrayDeclaration();
9762
+ } else if (this.expect('{')) {
9763
+ primary = this.object();
9764
+ } else if (this.selfReferential.hasOwnProperty(this.peek().text)) {
9765
+ primary = copy(this.selfReferential[this.consume().text]);
9766
+ } else if (this.options.literals.hasOwnProperty(this.peek().text)) {
9767
+ primary = { type: AST.Literal, value: this.options.literals[this.consume().text]};
9768
+ } else if (this.peek().identifier) {
9769
+ primary = this.identifier();
9770
+ } else if (this.peek().constant) {
9771
+ primary = this.constant();
9772
+ } else {
9773
+ this.throwError('not a primary expression', this.peek());
9774
+ }
9775
+
9776
+ var next;
9777
+ while ((next = this.expect('(', '[', '.'))) {
9778
+ if (next.text === '(') {
9779
+ primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };
9780
+ this.consume(')');
9781
+ } else if (next.text === '[') {
9782
+ primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };
9783
+ this.consume(']');
9784
+ } else if (next.text === '.') {
9785
+ primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };
9786
+ } else {
9787
+ this.throwError('IMPOSSIBLE');
9788
+ }
9789
+ }
9790
+ return primary;
9791
+ },
9792
+
9793
+ filter: function(baseExpression) {
9794
+ var args = [baseExpression];
9795
+ var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};
9796
+
9797
+ while (this.expect(':')) {
9798
+ args.push(this.expression());
9799
+ }
9800
+
9801
+ return result;
9802
+ },
9803
+
9804
+ parseArguments: function() {
9805
+ var args = [];
9806
+ if (this.peekToken().text !== ')') {
9807
+ do {
9808
+ args.push(this.filterChain());
9809
+ } while (this.expect(','));
9810
+ }
9811
+ return args;
9812
+ },
9813
+
9814
+ identifier: function() {
9815
+ var token = this.consume();
9816
+ if (!token.identifier) {
9817
+ this.throwError('is not a valid identifier', token);
9818
+ }
9819
+ return { type: AST.Identifier, name: token.text };
9820
+ },
9821
+
9822
+ constant: function() {
9823
+ return { type: AST.Literal, value: this.consume().value };
9824
+ },
9825
+
9826
+ arrayDeclaration: function() {
9827
+ var elements = [];
9828
+ if (this.peekToken().text !== ']') {
9829
+ do {
9830
+ if (this.peek(']')) {
9831
+ break;
9832
+ }
9833
+ elements.push(this.expression());
9834
+ } while (this.expect(','));
9835
+ }
9836
+ this.consume(']');
9837
+
9838
+ return { type: AST.ArrayExpression, elements: elements };
9839
+ },
9840
+
9841
+ object: function() {
9842
+ var properties = [], property;
9843
+ if (this.peekToken().text !== '}') {
9844
+ do {
9845
+ if (this.peek('}')) {
9846
+ break;
9847
+ }
9848
+ property = {type: AST.Property, kind: 'init'};
9849
+ if (this.peek().constant) {
9850
+ property.key = this.constant();
9851
+ property.computed = false;
9852
+ this.consume(':');
9853
+ property.value = this.expression();
9854
+ } else if (this.peek().identifier) {
9855
+ property.key = this.identifier();
9856
+ property.computed = false;
9857
+ if (this.peek(':')) {
9858
+ this.consume(':');
9859
+ property.value = this.expression();
9860
+ } else {
9861
+ property.value = property.key;
9862
+ }
9863
+ } else if (this.peek('[')) {
9864
+ this.consume('[');
9865
+ property.key = this.expression();
9866
+ this.consume(']');
9867
+ property.computed = true;
9868
+ this.consume(':');
9869
+ property.value = this.expression();
9870
+ } else {
9871
+ this.throwError('invalid key', this.peek());
9872
+ }
9873
+ properties.push(property);
9874
+ } while (this.expect(','));
9875
+ }
9876
+ this.consume('}');
9877
+
9878
+ return {type: AST.ObjectExpression, properties: properties };
9879
+ },
9880
+
9881
+ throwError: function(msg, token) {
9882
+ throw $parseMinErr('syntax',
9883
+ 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].',
9884
+ token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));
9885
+ },
9886
+
9887
+ consume: function(e1) {
9888
+ if (this.tokens.length === 0) {
9889
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
9890
+ }
9891
+
9892
+ var token = this.expect(e1);
9893
+ if (!token) {
9894
+ this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());
9895
+ }
9896
+ return token;
9897
+ },
9898
+
9899
+ peekToken: function() {
9900
+ if (this.tokens.length === 0) {
9901
+ throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
9902
+ }
9903
+ return this.tokens[0];
9904
+ },
9905
+
9906
+ peek: function(e1, e2, e3, e4) {
9907
+ return this.peekAhead(0, e1, e2, e3, e4);
9908
+ },
9909
+
9910
+ peekAhead: function(i, e1, e2, e3, e4) {
9911
+ if (this.tokens.length > i) {
9912
+ var token = this.tokens[i];
9913
+ var t = token.text;
9914
+ if (t === e1 || t === e2 || t === e3 || t === e4 ||
9915
+ (!e1 && !e2 && !e3 && !e4)) {
9916
+ return token;
9917
+ }
9918
+ }
9919
+ return false;
9920
+ },
9921
+
9922
+ expect: function(e1, e2, e3, e4) {
9923
+ var token = this.peek(e1, e2, e3, e4);
9924
+ if (token) {
9925
+ this.tokens.shift();
9926
+ return token;
9927
+ }
9928
+ return false;
9929
+ },
9930
+
9931
+ selfReferential: {
9932
+ 'this': {type: AST.ThisExpression },
9933
+ '$locals': {type: AST.LocalsExpression }
9934
+ }
9935
+ };
9936
+
9937
+ function ifDefined(v, d) {
9938
+ return typeof v !== 'undefined' ? v : d;
9939
+ }
9940
+
9941
+ function plusFn(l, r) {
9942
+ if (typeof l === 'undefined') return r;
9943
+ if (typeof r === 'undefined') return l;
9944
+ return l + r;
9945
+ }
9946
+
9947
+ function isStateless($filter, filterName) {
9948
+ var fn = $filter(filterName);
9949
+ return !fn.$stateful;
9950
+ }
9951
+
9952
+ function findConstantAndWatchExpressions(ast, $filter) {
9953
+ var allConstants;
9954
+ var argsToWatch;
9955
+ var isStatelessFilter;
9956
+ switch (ast.type) {
9957
+ case AST.Program:
9958
+ allConstants = true;
9959
+ forEach(ast.body, function(expr) {
9960
+ findConstantAndWatchExpressions(expr.expression, $filter);
9961
+ allConstants = allConstants && expr.expression.constant;
9962
+ });
9963
+ ast.constant = allConstants;
9964
+ break;
9965
+ case AST.Literal:
9966
+ ast.constant = true;
9967
+ ast.toWatch = [];
9968
+ break;
9969
+ case AST.UnaryExpression:
9970
+ findConstantAndWatchExpressions(ast.argument, $filter);
9971
+ ast.constant = ast.argument.constant;
9972
+ ast.toWatch = ast.argument.toWatch;
9973
+ break;
9974
+ case AST.BinaryExpression:
9975
+ findConstantAndWatchExpressions(ast.left, $filter);
9976
+ findConstantAndWatchExpressions(ast.right, $filter);
9977
+ ast.constant = ast.left.constant && ast.right.constant;
9978
+ ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);
9979
+ break;
9980
+ case AST.LogicalExpression:
9981
+ findConstantAndWatchExpressions(ast.left, $filter);
9982
+ findConstantAndWatchExpressions(ast.right, $filter);
9983
+ ast.constant = ast.left.constant && ast.right.constant;
9984
+ ast.toWatch = ast.constant ? [] : [ast];
9985
+ break;
9986
+ case AST.ConditionalExpression:
9987
+ findConstantAndWatchExpressions(ast.test, $filter);
9988
+ findConstantAndWatchExpressions(ast.alternate, $filter);
9989
+ findConstantAndWatchExpressions(ast.consequent, $filter);
9990
+ ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;
9991
+ ast.toWatch = ast.constant ? [] : [ast];
9992
+ break;
9993
+ case AST.Identifier:
9994
+ ast.constant = false;
9995
+ ast.toWatch = [ast];
9996
+ break;
9997
+ case AST.MemberExpression:
9998
+ findConstantAndWatchExpressions(ast.object, $filter);
9999
+ if (ast.computed) {
10000
+ findConstantAndWatchExpressions(ast.property, $filter);
10001
+ }
10002
+ ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);
10003
+ ast.toWatch = [ast];
10004
+ break;
10005
+ case AST.CallExpression:
10006
+ isStatelessFilter = ast.filter ? isStateless($filter, ast.callee.name) : false;
10007
+ allConstants = isStatelessFilter;
10008
+ argsToWatch = [];
10009
+ forEach(ast.arguments, function(expr) {
10010
+ findConstantAndWatchExpressions(expr, $filter);
10011
+ allConstants = allConstants && expr.constant;
10012
+ if (!expr.constant) {
10013
+ argsToWatch.push.apply(argsToWatch, expr.toWatch);
10014
+ }
10015
+ });
10016
+ ast.constant = allConstants;
10017
+ ast.toWatch = isStatelessFilter ? argsToWatch : [ast];
10018
+ break;
10019
+ case AST.AssignmentExpression:
10020
+ findConstantAndWatchExpressions(ast.left, $filter);
10021
+ findConstantAndWatchExpressions(ast.right, $filter);
10022
+ ast.constant = ast.left.constant && ast.right.constant;
10023
+ ast.toWatch = [ast];
10024
+ break;
10025
+ case AST.ArrayExpression:
10026
+ allConstants = true;
10027
+ argsToWatch = [];
10028
+ forEach(ast.elements, function(expr) {
10029
+ findConstantAndWatchExpressions(expr, $filter);
10030
+ allConstants = allConstants && expr.constant;
10031
+ if (!expr.constant) {
10032
+ argsToWatch.push.apply(argsToWatch, expr.toWatch);
10033
+ }
10034
+ });
10035
+ ast.constant = allConstants;
10036
+ ast.toWatch = argsToWatch;
10037
+ break;
10038
+ case AST.ObjectExpression:
10039
+ allConstants = true;
10040
+ argsToWatch = [];
10041
+ forEach(ast.properties, function(property) {
10042
+ findConstantAndWatchExpressions(property.value, $filter);
10043
+ allConstants = allConstants && property.value.constant && !property.computed;
10044
+ if (!property.value.constant) {
10045
+ argsToWatch.push.apply(argsToWatch, property.value.toWatch);
10046
+ }
10047
+ });
10048
+ ast.constant = allConstants;
10049
+ ast.toWatch = argsToWatch;
10050
+ break;
10051
+ case AST.ThisExpression:
10052
+ ast.constant = false;
10053
+ ast.toWatch = [];
10054
+ break;
10055
+ case AST.LocalsExpression:
10056
+ ast.constant = false;
10057
+ ast.toWatch = [];
10058
+ break;
10059
+ }
10060
+ }
10061
+
10062
+ function getInputs(body) {
10063
+ if (body.length !== 1) return;
10064
+ var lastExpression = body[0].expression;
10065
+ var candidate = lastExpression.toWatch;
10066
+ if (candidate.length !== 1) return candidate;
10067
+ return candidate[0] !== lastExpression ? candidate : undefined;
10068
+ }
10069
+
10070
+ function isAssignable(ast) {
10071
+ return ast.type === AST.Identifier || ast.type === AST.MemberExpression;
10072
+ }
10073
+
10074
+ function assignableAST(ast) {
10075
+ if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
10076
+ return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};
10077
+ }
10078
+ }
10079
+
10080
+ function isLiteral(ast) {
10081
+ return ast.body.length === 0 ||
10082
+ ast.body.length === 1 && (
10083
+ ast.body[0].expression.type === AST.Literal ||
10084
+ ast.body[0].expression.type === AST.ArrayExpression ||
10085
+ ast.body[0].expression.type === AST.ObjectExpression);
10086
+ }
10087
+
10088
+ function isConstant(ast) {
10089
+ return ast.constant;
10090
+ }
10091
+
10092
+ function ASTCompiler(astBuilder, $filter) {
10093
+ this.astBuilder = astBuilder;
10094
+ this.$filter = $filter;
10095
+ }
10096
+
10097
+ ASTCompiler.prototype = {
10098
+ compile: function(expression) {
10099
+ var self = this;
10100
+ var ast = this.astBuilder.ast(expression);
10101
+ this.state = {
10102
+ nextId: 0,
10103
+ filters: {},
10104
+ fn: {vars: [], body: [], own: {}},
10105
+ assign: {vars: [], body: [], own: {}},
10106
+ inputs: []
10107
+ };
10108
+ findConstantAndWatchExpressions(ast, self.$filter);
10109
+ var extra = '';
10110
+ var assignable;
10111
+ this.stage = 'assign';
10112
+ if ((assignable = assignableAST(ast))) {
10113
+ this.state.computing = 'assign';
10114
+ var result = this.nextId();
10115
+ this.recurse(assignable, result);
10116
+ this.return_(result);
10117
+ extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');
10118
+ }
10119
+ var toWatch = getInputs(ast.body);
10120
+ self.stage = 'inputs';
10121
+ forEach(toWatch, function(watch, key) {
10122
+ var fnKey = 'fn' + key;
10123
+ self.state[fnKey] = {vars: [], body: [], own: {}};
10124
+ self.state.computing = fnKey;
10125
+ var intoId = self.nextId();
10126
+ self.recurse(watch, intoId);
10127
+ self.return_(intoId);
10128
+ self.state.inputs.push(fnKey);
10129
+ watch.watchId = key;
10130
+ });
10131
+ this.state.computing = 'fn';
10132
+ this.stage = 'main';
10133
+ this.recurse(ast);
10134
+ var fnString =
10135
+ '"' + this.USE + ' ' + this.STRICT + '";\n' +
10136
+ this.filterPrefix() +
10137
+ 'var fn=' + this.generateFunction('fn', 's,l,a,i') +
10138
+ extra +
10139
+ this.watchFns() +
10140
+ 'return fn;';
10141
+
10142
+ var fn = (new Function('$filter',
10143
+ 'getStringValue',
10144
+ 'ifDefined',
10145
+ 'plus',
10146
+ fnString))(
10147
+ this.$filter,
10148
+ getStringValue,
10149
+ ifDefined,
10150
+ plusFn);
10151
+ this.state = this.stage = undefined;
10152
+ fn.literal = isLiteral(ast);
10153
+ fn.constant = isConstant(ast);
10154
+ return fn;
10155
+ },
10156
+
10157
+ USE: 'use',
10158
+
10159
+ STRICT: 'strict',
10160
+
10161
+ watchFns: function() {
10162
+ var result = [];
10163
+ var fns = this.state.inputs;
10164
+ var self = this;
10165
+ forEach(fns, function(name) {
10166
+ result.push('var ' + name + '=' + self.generateFunction(name, 's'));
10167
+ });
10168
+ if (fns.length) {
10169
+ result.push('fn.inputs=[' + fns.join(',') + '];');
10170
+ }
10171
+ return result.join('');
10172
+ },
10173
+
10174
+ generateFunction: function(name, params) {
10175
+ return 'function(' + params + '){' +
10176
+ this.varsPrefix(name) +
10177
+ this.body(name) +
10178
+ '};';
10179
+ },
10180
+
10181
+ filterPrefix: function() {
10182
+ var parts = [];
10183
+ var self = this;
10184
+ forEach(this.state.filters, function(id, filter) {
10185
+ parts.push(id + '=$filter(' + self.escape(filter) + ')');
10186
+ });
10187
+ if (parts.length) return 'var ' + parts.join(',') + ';';
10188
+ return '';
10189
+ },
10190
+
10191
+ varsPrefix: function(section) {
10192
+ return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';
10193
+ },
10194
+
10195
+ body: function(section) {
10196
+ return this.state[section].body.join('');
10197
+ },
10198
+
10199
+ recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
10200
+ var left, right, self = this, args, expression, computed;
10201
+ recursionFn = recursionFn || noop;
10202
+ if (!skipWatchIdCheck && isDefined(ast.watchId)) {
10203
+ intoId = intoId || this.nextId();
10204
+ this.if_('i',
10205
+ this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),
10206
+ this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)
10207
+ );
10208
+ return;
10209
+ }
10210
+ switch (ast.type) {
10211
+ case AST.Program:
10212
+ forEach(ast.body, function(expression, pos) {
10213
+ self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });
10214
+ if (pos !== ast.body.length - 1) {
10215
+ self.current().body.push(right, ';');
10216
+ } else {
10217
+ self.return_(right);
10218
+ }
10219
+ });
10220
+ break;
10221
+ case AST.Literal:
10222
+ expression = this.escape(ast.value);
10223
+ this.assign(intoId, expression);
10224
+ recursionFn(intoId || expression);
10225
+ break;
10226
+ case AST.UnaryExpression:
10227
+ this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });
10228
+ expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';
10229
+ this.assign(intoId, expression);
10230
+ recursionFn(expression);
10231
+ break;
10232
+ case AST.BinaryExpression:
10233
+ this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });
10234
+ this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });
10235
+ if (ast.operator === '+') {
10236
+ expression = this.plus(left, right);
10237
+ } else if (ast.operator === '-') {
10238
+ expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);
10239
+ } else {
10240
+ expression = '(' + left + ')' + ast.operator + '(' + right + ')';
10241
+ }
10242
+ this.assign(intoId, expression);
10243
+ recursionFn(expression);
10244
+ break;
10245
+ case AST.LogicalExpression:
10246
+ intoId = intoId || this.nextId();
10247
+ self.recurse(ast.left, intoId);
10248
+ self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));
10249
+ recursionFn(intoId);
10250
+ break;
10251
+ case AST.ConditionalExpression:
10252
+ intoId = intoId || this.nextId();
10253
+ self.recurse(ast.test, intoId);
10254
+ self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));
10255
+ recursionFn(intoId);
10256
+ break;
10257
+ case AST.Identifier:
10258
+ intoId = intoId || this.nextId();
10259
+ if (nameId) {
10260
+ nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');
10261
+ nameId.computed = false;
10262
+ nameId.name = ast.name;
10263
+ }
10264
+ self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),
10265
+ function() {
10266
+ self.if_(self.stage === 'inputs' || 's', function() {
10267
+ if (create && create !== 1) {
10268
+ self.if_(
10269
+ self.isNull(self.nonComputedMember('s', ast.name)),
10270
+ self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));
10271
+ }
10272
+ self.assign(intoId, self.nonComputedMember('s', ast.name));
10273
+ });
10274
+ }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))
10275
+ );
10276
+ recursionFn(intoId);
10277
+ break;
10278
+ case AST.MemberExpression:
10279
+ left = nameId && (nameId.context = this.nextId()) || this.nextId();
10280
+ intoId = intoId || this.nextId();
10281
+ self.recurse(ast.object, left, undefined, function() {
10282
+ self.if_(self.notNull(left), function() {
10283
+ if (ast.computed) {
10284
+ right = self.nextId();
10285
+ self.recurse(ast.property, right);
10286
+ self.getStringValue(right);
10287
+ if (create && create !== 1) {
10288
+ self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));
10289
+ }
10290
+ expression = self.computedMember(left, right);
10291
+ self.assign(intoId, expression);
10292
+ if (nameId) {
10293
+ nameId.computed = true;
10294
+ nameId.name = right;
10295
+ }
10296
+ } else {
10297
+ if (create && create !== 1) {
10298
+ self.if_(self.isNull(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
10299
+ }
10300
+ expression = self.nonComputedMember(left, ast.property.name);
10301
+ self.assign(intoId, expression);
10302
+ if (nameId) {
10303
+ nameId.computed = false;
10304
+ nameId.name = ast.property.name;
10305
+ }
10306
+ }
10307
+ }, function() {
10308
+ self.assign(intoId, 'undefined');
10309
+ });
10310
+ recursionFn(intoId);
10311
+ }, !!create);
10312
+ break;
10313
+ case AST.CallExpression:
10314
+ intoId = intoId || this.nextId();
10315
+ if (ast.filter) {
10316
+ right = self.filter(ast.callee.name);
10317
+ args = [];
10318
+ forEach(ast.arguments, function(expr) {
10319
+ var argument = self.nextId();
10320
+ self.recurse(expr, argument);
10321
+ args.push(argument);
10322
+ });
10323
+ expression = right + '(' + args.join(',') + ')';
10324
+ self.assign(intoId, expression);
10325
+ recursionFn(intoId);
10326
+ } else {
10327
+ right = self.nextId();
10328
+ left = {};
10329
+ args = [];
10330
+ self.recurse(ast.callee, right, left, function() {
10331
+ self.if_(self.notNull(right), function() {
10332
+ forEach(ast.arguments, function(expr) {
10333
+ self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function(argument) {
10334
+ args.push(argument);
10335
+ });
10336
+ });
10337
+ if (left.name) {
10338
+ expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';
10339
+ } else {
10340
+ expression = right + '(' + args.join(',') + ')';
10341
+ }
10342
+ self.assign(intoId, expression);
10343
+ }, function() {
10344
+ self.assign(intoId, 'undefined');
10345
+ });
10346
+ recursionFn(intoId);
10347
+ });
10348
+ }
10349
+ break;
10350
+ case AST.AssignmentExpression:
10351
+ right = this.nextId();
10352
+ left = {};
10353
+ this.recurse(ast.left, undefined, left, function() {
10354
+ self.if_(self.notNull(left.context), function() {
10355
+ self.recurse(ast.right, right);
10356
+ expression = self.member(left.context, left.name, left.computed) + ast.operator + right;
10357
+ self.assign(intoId, expression);
10358
+ recursionFn(intoId || expression);
10359
+ });
10360
+ }, 1);
10361
+ break;
10362
+ case AST.ArrayExpression:
10363
+ args = [];
10364
+ forEach(ast.elements, function(expr) {
10365
+ self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function(argument) {
10366
+ args.push(argument);
10367
+ });
10368
+ });
10369
+ expression = '[' + args.join(',') + ']';
10370
+ this.assign(intoId, expression);
10371
+ recursionFn(intoId || expression);
10372
+ break;
10373
+ case AST.ObjectExpression:
10374
+ args = [];
10375
+ computed = false;
10376
+ forEach(ast.properties, function(property) {
10377
+ if (property.computed) {
10378
+ computed = true;
10379
+ }
10380
+ });
10381
+ if (computed) {
10382
+ intoId = intoId || this.nextId();
10383
+ this.assign(intoId, '{}');
10384
+ forEach(ast.properties, function(property) {
10385
+ if (property.computed) {
10386
+ left = self.nextId();
10387
+ self.recurse(property.key, left);
10388
+ } else {
10389
+ left = property.key.type === AST.Identifier ?
10390
+ property.key.name :
10391
+ ('' + property.key.value);
10392
+ }
10393
+ right = self.nextId();
10394
+ self.recurse(property.value, right);
10395
+ self.assign(self.member(intoId, left, property.computed), right);
10396
+ });
10397
+ } else {
10398
+ forEach(ast.properties, function(property) {
10399
+ self.recurse(property.value, ast.constant ? undefined : self.nextId(), undefined, function(expr) {
10400
+ args.push(self.escape(
10401
+ property.key.type === AST.Identifier ? property.key.name :
10402
+ ('' + property.key.value)) +
10403
+ ':' + expr);
10404
+ });
10405
+ });
10406
+ expression = '{' + args.join(',') + '}';
10407
+ this.assign(intoId, expression);
10408
+ }
10409
+ recursionFn(intoId || expression);
10410
+ break;
10411
+ case AST.ThisExpression:
10412
+ this.assign(intoId, 's');
10413
+ recursionFn(intoId || 's');
10414
+ break;
10415
+ case AST.LocalsExpression:
10416
+ this.assign(intoId, 'l');
10417
+ recursionFn(intoId || 'l');
10418
+ break;
10419
+ case AST.NGValueParameter:
10420
+ this.assign(intoId, 'v');
10421
+ recursionFn(intoId || 'v');
10422
+ break;
10423
+ }
10424
+ },
10425
+
10426
+ getHasOwnProperty: function(element, property) {
10427
+ var key = element + '.' + property;
10428
+ var own = this.current().own;
10429
+ if (!own.hasOwnProperty(key)) {
10430
+ own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');
10431
+ }
10432
+ return own[key];
10433
+ },
10434
+
10435
+ assign: function(id, value) {
10436
+ if (!id) return;
10437
+ this.current().body.push(id, '=', value, ';');
10438
+ return id;
10439
+ },
10440
+
10441
+ filter: function(filterName) {
10442
+ if (!this.state.filters.hasOwnProperty(filterName)) {
10443
+ this.state.filters[filterName] = this.nextId(true);
10444
+ }
10445
+ return this.state.filters[filterName];
10446
+ },
10447
+
10448
+ ifDefined: function(id, defaultValue) {
10449
+ return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';
10450
+ },
10451
+
10452
+ plus: function(left, right) {
10453
+ return 'plus(' + left + ',' + right + ')';
10454
+ },
10455
+
10456
+ return_: function(id) {
10457
+ this.current().body.push('return ', id, ';');
10458
+ },
10459
+
10460
+ if_: function(test, alternate, consequent) {
10461
+ if (test === true) {
10462
+ alternate();
10463
+ } else {
10464
+ var body = this.current().body;
10465
+ body.push('if(', test, '){');
10466
+ alternate();
10467
+ body.push('}');
10468
+ if (consequent) {
10469
+ body.push('else{');
10470
+ consequent();
10471
+ body.push('}');
10472
+ }
10473
+ }
10474
+ },
10475
+
10476
+ not: function(expression) {
10477
+ return '!(' + expression + ')';
10478
+ },
10479
+
10480
+ isNull: function(expression) {
10481
+ return expression + '==null';
10482
+ },
10483
+
10484
+ notNull: function(expression) {
10485
+ return expression + '!=null';
10486
+ },
10487
+
10488
+ nonComputedMember: function(left, right) {
10489
+ var SAFE_IDENTIFIER = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/;
10490
+ var UNSAFE_CHARACTERS = /[^$_a-zA-Z0-9]/g;
10491
+ if (SAFE_IDENTIFIER.test(right)) {
10492
+ return left + '.' + right;
10493
+ } else {
10494
+ return left + '["' + right.replace(UNSAFE_CHARACTERS, this.stringEscapeFn) + '"]';
10495
+ }
10496
+ },
10497
+
10498
+ computedMember: function(left, right) {
10499
+ return left + '[' + right + ']';
10500
+ },
10501
+
10502
+ member: function(left, right, computed) {
10503
+ if (computed) return this.computedMember(left, right);
10504
+ return this.nonComputedMember(left, right);
10505
+ },
10506
+
10507
+ getStringValue: function(item) {
10508
+ this.assign(item, 'getStringValue(' + item + ')');
10509
+ },
10510
+
10511
+ lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
10512
+ var self = this;
10513
+ return function() {
10514
+ self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);
10515
+ };
10516
+ },
10517
+
10518
+ lazyAssign: function(id, value) {
10519
+ var self = this;
10520
+ return function() {
10521
+ self.assign(id, value);
10522
+ };
10523
+ },
10524
+
10525
+ stringEscapeRegex: /[^ a-zA-Z0-9]/g,
10526
+
10527
+ stringEscapeFn: function(c) {
10528
+ return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);
10529
+ },
10530
+
10531
+ escape: function(value) {
10532
+ if (isString(value)) return '\'' + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + '\'';
10533
+ if (isNumber(value)) return value.toString();
10534
+ if (value === true) return 'true';
10535
+ if (value === false) return 'false';
10536
+ if (value === null) return 'null';
10537
+ if (typeof value === 'undefined') return 'undefined';
10538
+
10539
+ throw $parseMinErr('esc', 'IMPOSSIBLE');
10540
+ },
10541
+
10542
+ nextId: function(skip, init) {
10543
+ var id = 'v' + (this.state.nextId++);
10544
+ if (!skip) {
10545
+ this.current().vars.push(id + (init ? '=' + init : ''));
10546
+ }
10547
+ return id;
10548
+ },
10549
+
10550
+ current: function() {
10551
+ return this.state[this.state.computing];
10552
+ }
10553
+ };
10554
+
10555
+
10556
+ function ASTInterpreter(astBuilder, $filter) {
10557
+ this.astBuilder = astBuilder;
10558
+ this.$filter = $filter;
10559
+ }
10560
+
10561
+ ASTInterpreter.prototype = {
10562
+ compile: function(expression) {
10563
+ var self = this;
10564
+ var ast = this.astBuilder.ast(expression);
10565
+ findConstantAndWatchExpressions(ast, self.$filter);
10566
+ var assignable;
10567
+ var assign;
10568
+ if ((assignable = assignableAST(ast))) {
10569
+ assign = this.recurse(assignable);
10570
+ }
10571
+ var toWatch = getInputs(ast.body);
10572
+ var inputs;
10573
+ if (toWatch) {
10574
+ inputs = [];
10575
+ forEach(toWatch, function(watch, key) {
10576
+ var input = self.recurse(watch);
10577
+ watch.input = input;
10578
+ inputs.push(input);
10579
+ watch.watchId = key;
10580
+ });
10581
+ }
10582
+ var expressions = [];
10583
+ forEach(ast.body, function(expression) {
10584
+ expressions.push(self.recurse(expression.expression));
10585
+ });
10586
+ var fn = ast.body.length === 0 ? noop :
10587
+ ast.body.length === 1 ? expressions[0] :
10588
+ function(scope, locals) {
10589
+ var lastValue;
10590
+ forEach(expressions, function(exp) {
10591
+ lastValue = exp(scope, locals);
10592
+ });
10593
+ return lastValue;
10594
+ };
10595
+ if (assign) {
10596
+ fn.assign = function(scope, value, locals) {
10597
+ return assign(scope, locals, value);
10598
+ };
10599
+ }
10600
+ if (inputs) {
10601
+ fn.inputs = inputs;
10602
+ }
10603
+ fn.literal = isLiteral(ast);
10604
+ fn.constant = isConstant(ast);
10605
+ return fn;
10606
+ },
10607
+
10608
+ recurse: function(ast, context, create) {
10609
+ var left, right, self = this, args;
10610
+ if (ast.input) {
10611
+ return this.inputs(ast.input, ast.watchId);
10612
+ }
10613
+ switch (ast.type) {
10614
+ case AST.Literal:
10615
+ return this.value(ast.value, context);
10616
+ case AST.UnaryExpression:
10617
+ right = this.recurse(ast.argument);
10618
+ return this['unary' + ast.operator](right, context);
10619
+ case AST.BinaryExpression:
10620
+ left = this.recurse(ast.left);
10621
+ right = this.recurse(ast.right);
10622
+ return this['binary' + ast.operator](left, right, context);
10623
+ case AST.LogicalExpression:
10624
+ left = this.recurse(ast.left);
10625
+ right = this.recurse(ast.right);
10626
+ return this['binary' + ast.operator](left, right, context);
10627
+ case AST.ConditionalExpression:
10628
+ return this['ternary?:'](
10629
+ this.recurse(ast.test),
10630
+ this.recurse(ast.alternate),
10631
+ this.recurse(ast.consequent),
10632
+ context
10633
+ );
10634
+ case AST.Identifier:
10635
+ return self.identifier(ast.name, context, create);
10636
+ case AST.MemberExpression:
10637
+ left = this.recurse(ast.object, false, !!create);
10638
+ if (!ast.computed) {
10639
+ right = ast.property.name;
10640
+ }
10641
+ if (ast.computed) right = this.recurse(ast.property);
10642
+ return ast.computed ?
10643
+ this.computedMember(left, right, context, create) :
10644
+ this.nonComputedMember(left, right, context, create);
10645
+ case AST.CallExpression:
10646
+ args = [];
10647
+ forEach(ast.arguments, function(expr) {
10648
+ args.push(self.recurse(expr));
10649
+ });
10650
+ if (ast.filter) right = this.$filter(ast.callee.name);
10651
+ if (!ast.filter) right = this.recurse(ast.callee, true);
10652
+ return ast.filter ?
10653
+ function(scope, locals, assign, inputs) {
10654
+ var values = [];
10655
+ for (var i = 0; i < args.length; ++i) {
10656
+ values.push(args[i](scope, locals, assign, inputs));
10657
+ }
10658
+ var value = right.apply(undefined, values, inputs);
10659
+ return context ? {context: undefined, name: undefined, value: value} : value;
10660
+ } :
10661
+ function(scope, locals, assign, inputs) {
10662
+ var rhs = right(scope, locals, assign, inputs);
10663
+ var value;
10664
+ if (rhs.value != null) {
10665
+ var values = [];
10666
+ for (var i = 0; i < args.length; ++i) {
10667
+ values.push(args[i](scope, locals, assign, inputs));
10668
+ }
10669
+ value = rhs.value.apply(rhs.context, values);
10670
+ }
10671
+ return context ? {value: value} : value;
10672
+ };
10673
+ case AST.AssignmentExpression:
10674
+ left = this.recurse(ast.left, true, 1);
10675
+ right = this.recurse(ast.right);
10676
+ return function(scope, locals, assign, inputs) {
10677
+ var lhs = left(scope, locals, assign, inputs);
10678
+ var rhs = right(scope, locals, assign, inputs);
10679
+ lhs.context[lhs.name] = rhs;
10680
+ return context ? {value: rhs} : rhs;
10681
+ };
10682
+ case AST.ArrayExpression:
10683
+ args = [];
10684
+ forEach(ast.elements, function(expr) {
10685
+ args.push(self.recurse(expr));
10686
+ });
10687
+ return function(scope, locals, assign, inputs) {
10688
+ var value = [];
10689
+ for (var i = 0; i < args.length; ++i) {
10690
+ value.push(args[i](scope, locals, assign, inputs));
10691
+ }
10692
+ return context ? {value: value} : value;
10693
+ };
10694
+ case AST.ObjectExpression:
10695
+ args = [];
10696
+ forEach(ast.properties, function(property) {
10697
+ if (property.computed) {
10698
+ args.push({key: self.recurse(property.key),
10699
+ computed: true,
10700
+ value: self.recurse(property.value)
10701
+ });
10702
+ } else {
10703
+ args.push({key: property.key.type === AST.Identifier ?
10704
+ property.key.name :
10705
+ ('' + property.key.value),
10706
+ computed: false,
10707
+ value: self.recurse(property.value)
10708
+ });
10709
+ }
10710
+ });
10711
+ return function(scope, locals, assign, inputs) {
10712
+ var value = {};
10713
+ for (var i = 0; i < args.length; ++i) {
10714
+ if (args[i].computed) {
10715
+ value[args[i].key(scope, locals, assign, inputs)] = args[i].value(scope, locals, assign, inputs);
10716
+ } else {
10717
+ value[args[i].key] = args[i].value(scope, locals, assign, inputs);
10718
+ }
10719
+ }
10720
+ return context ? {value: value} : value;
10721
+ };
10722
+ case AST.ThisExpression:
10723
+ return function(scope) {
10724
+ return context ? {value: scope} : scope;
10725
+ };
10726
+ case AST.LocalsExpression:
10727
+ return function(scope, locals) {
10728
+ return context ? {value: locals} : locals;
10729
+ };
10730
+ case AST.NGValueParameter:
10731
+ return function(scope, locals, assign) {
10732
+ return context ? {value: assign} : assign;
10733
+ };
10734
+ }
10735
+ },
10736
+
10737
+ 'unary+': function(argument, context) {
10738
+ return function(scope, locals, assign, inputs) {
10739
+ var arg = argument(scope, locals, assign, inputs);
10740
+ if (isDefined(arg)) {
10741
+ arg = +arg;
10742
+ } else {
10743
+ arg = 0;
10744
+ }
10745
+ return context ? {value: arg} : arg;
10746
+ };
10747
+ },
10748
+ 'unary-': function(argument, context) {
10749
+ return function(scope, locals, assign, inputs) {
10750
+ var arg = argument(scope, locals, assign, inputs);
10751
+ if (isDefined(arg)) {
10752
+ arg = -arg;
10753
+ } else {
10754
+ arg = -0;
10755
+ }
10756
+ return context ? {value: arg} : arg;
10757
+ };
10758
+ },
10759
+ 'unary!': function(argument, context) {
10760
+ return function(scope, locals, assign, inputs) {
10761
+ var arg = !argument(scope, locals, assign, inputs);
10762
+ return context ? {value: arg} : arg;
10763
+ };
10764
+ },
10765
+ 'binary+': function(left, right, context) {
10766
+ return function(scope, locals, assign, inputs) {
10767
+ var lhs = left(scope, locals, assign, inputs);
10768
+ var rhs = right(scope, locals, assign, inputs);
10769
+ var arg = plusFn(lhs, rhs);
10770
+ return context ? {value: arg} : arg;
10771
+ };
10772
+ },
10773
+ 'binary-': function(left, right, context) {
10774
+ return function(scope, locals, assign, inputs) {
10775
+ var lhs = left(scope, locals, assign, inputs);
10776
+ var rhs = right(scope, locals, assign, inputs);
10777
+ var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);
10778
+ return context ? {value: arg} : arg;
10779
+ };
10780
+ },
10781
+ 'binary*': function(left, right, context) {
10782
+ return function(scope, locals, assign, inputs) {
10783
+ var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);
10784
+ return context ? {value: arg} : arg;
10785
+ };
10786
+ },
10787
+ 'binary/': function(left, right, context) {
10788
+ return function(scope, locals, assign, inputs) {
10789
+ var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);
10790
+ return context ? {value: arg} : arg;
10791
+ };
10792
+ },
10793
+ 'binary%': function(left, right, context) {
10794
+ return function(scope, locals, assign, inputs) {
10795
+ var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);
10796
+ return context ? {value: arg} : arg;
10797
+ };
10798
+ },
10799
+ 'binary===': function(left, right, context) {
10800
+ return function(scope, locals, assign, inputs) {
10801
+ var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);
10802
+ return context ? {value: arg} : arg;
10803
+ };
10804
+ },
10805
+ 'binary!==': function(left, right, context) {
10806
+ return function(scope, locals, assign, inputs) {
10807
+ var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);
10808
+ return context ? {value: arg} : arg;
10809
+ };
10810
+ },
10811
+ 'binary==': function(left, right, context) {
10812
+ return function(scope, locals, assign, inputs) {
10813
+ var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);
10814
+ return context ? {value: arg} : arg;
10815
+ };
10816
+ },
10817
+ 'binary!=': function(left, right, context) {
10818
+ return function(scope, locals, assign, inputs) {
10819
+ var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);
10820
+ return context ? {value: arg} : arg;
10821
+ };
10822
+ },
10823
+ 'binary<': function(left, right, context) {
10824
+ return function(scope, locals, assign, inputs) {
10825
+ var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);
10826
+ return context ? {value: arg} : arg;
10827
+ };
10828
+ },
10829
+ 'binary>': function(left, right, context) {
10830
+ return function(scope, locals, assign, inputs) {
10831
+ var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);
10832
+ return context ? {value: arg} : arg;
10833
+ };
10834
+ },
10835
+ 'binary<=': function(left, right, context) {
10836
+ return function(scope, locals, assign, inputs) {
10837
+ var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);
10838
+ return context ? {value: arg} : arg;
10839
+ };
10840
+ },
10841
+ 'binary>=': function(left, right, context) {
10842
+ return function(scope, locals, assign, inputs) {
10843
+ var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);
10844
+ return context ? {value: arg} : arg;
10845
+ };
10846
+ },
10847
+ 'binary&&': function(left, right, context) {
10848
+ return function(scope, locals, assign, inputs) {
10849
+ var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);
10850
+ return context ? {value: arg} : arg;
10851
+ };
10852
+ },
10853
+ 'binary||': function(left, right, context) {
10854
+ return function(scope, locals, assign, inputs) {
10855
+ var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);
10856
+ return context ? {value: arg} : arg;
10857
+ };
10858
+ },
10859
+ 'ternary?:': function(test, alternate, consequent, context) {
10860
+ return function(scope, locals, assign, inputs) {
10861
+ var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);
10862
+ return context ? {value: arg} : arg;
10863
+ };
10864
+ },
10865
+ value: function(value, context) {
10866
+ return function() { return context ? {context: undefined, name: undefined, value: value} : value; };
10867
+ },
10868
+ identifier: function(name, context, create) {
10869
+ return function(scope, locals, assign, inputs) {
10870
+ var base = locals && (name in locals) ? locals : scope;
10871
+ if (create && create !== 1 && base && base[name] == null) {
10872
+ base[name] = {};
10873
+ }
10874
+ var value = base ? base[name] : undefined;
10875
+ if (context) {
10876
+ return {context: base, name: name, value: value};
10877
+ } else {
10878
+ return value;
10879
+ }
10880
+ };
10881
+ },
10882
+ computedMember: function(left, right, context, create) {
10883
+ return function(scope, locals, assign, inputs) {
10884
+ var lhs = left(scope, locals, assign, inputs);
10885
+ var rhs;
10886
+ var value;
10887
+ if (lhs != null) {
10888
+ rhs = right(scope, locals, assign, inputs);
10889
+ rhs = getStringValue(rhs);
10890
+ if (create && create !== 1) {
10891
+ if (lhs && !(lhs[rhs])) {
10892
+ lhs[rhs] = {};
10893
+ }
10894
+ }
10895
+ value = lhs[rhs];
10896
+ }
10897
+ if (context) {
10898
+ return {context: lhs, name: rhs, value: value};
10899
+ } else {
10900
+ return value;
10901
+ }
10902
+ };
10903
+ },
10904
+ nonComputedMember: function(left, right, context, create) {
10905
+ return function(scope, locals, assign, inputs) {
10906
+ var lhs = left(scope, locals, assign, inputs);
10907
+ if (create && create !== 1) {
10908
+ if (lhs && lhs[right] == null) {
10909
+ lhs[right] = {};
10910
+ }
10911
+ }
10912
+ var value = lhs != null ? lhs[right] : undefined;
10913
+ if (context) {
10914
+ return {context: lhs, name: right, value: value};
10915
+ } else {
10916
+ return value;
10917
+ }
10918
+ };
10919
+ },
10920
+ inputs: function(input, watchId) {
10921
+ return function(scope, value, locals, inputs) {
10922
+ if (inputs) return inputs[watchId];
10923
+ return input(scope, value, locals);
10924
+ };
10925
+ }
10926
+ };
10927
+
10928
+ var Parser = function Parser(lexer, $filter, options) {
10929
+ this.lexer = lexer;
10930
+ this.$filter = $filter;
10931
+ this.options = options;
10932
+ this.ast = new AST(lexer, options);
10933
+ this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :
10934
+ new ASTCompiler(this.ast, $filter);
10935
+ };
10936
+
10937
+ Parser.prototype = {
10938
+ constructor: Parser,
10939
+
10940
+ parse: function(text) {
10941
+ return this.astCompiler.compile(text);
10942
+ }
10943
+ };
10944
+
10945
+ function getValueOf(value) {
10946
+ return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);
10947
+ }
10948
+
10949
+
10950
+
10951
+
10952
+ function $ParseProvider() {
10953
+ var cache = createMap();
10954
+ var literals = {
10955
+ 'true': true,
10956
+ 'false': false,
10957
+ 'null': null,
10958
+ 'undefined': undefined
10959
+ };
10960
+ var identStart, identContinue;
10961
+
10962
+ this.addLiteral = function(literalName, literalValue) {
10963
+ literals[literalName] = literalValue;
10964
+ };
10965
+
10966
+ this.setIdentifierFns = function(identifierStart, identifierContinue) {
10967
+ identStart = identifierStart;
10968
+ identContinue = identifierContinue;
10969
+ return this;
10970
+ };
10971
+
10972
+ this.$get = ['$filter', function($filter) {
10973
+ var noUnsafeEval = csp().noUnsafeEval;
10974
+ var $parseOptions = {
10975
+ csp: noUnsafeEval,
10976
+ literals: copy(literals),
10977
+ isIdentifierStart: isFunction(identStart) && identStart,
10978
+ isIdentifierContinue: isFunction(identContinue) && identContinue
10979
+ };
10980
+ return $parse;
10981
+
10982
+ function $parse(exp, interceptorFn) {
10983
+ var parsedExpression, oneTime, cacheKey;
10984
+
10985
+ switch (typeof exp) {
10986
+ case 'string':
10987
+ exp = exp.trim();
10988
+ cacheKey = exp;
10989
+
10990
+ parsedExpression = cache[cacheKey];
10991
+
10992
+ if (!parsedExpression) {
10993
+ if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {
10994
+ oneTime = true;
10995
+ exp = exp.substring(2);
10996
+ }
10997
+ var lexer = new Lexer($parseOptions);
10998
+ var parser = new Parser(lexer, $filter, $parseOptions);
10999
+ parsedExpression = parser.parse(exp);
11000
+ if (parsedExpression.constant) {
11001
+ parsedExpression.$$watchDelegate = constantWatchDelegate;
11002
+ } else if (oneTime) {
11003
+ parsedExpression.$$watchDelegate = parsedExpression.literal ?
11004
+ oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;
11005
+ } else if (parsedExpression.inputs) {
11006
+ parsedExpression.$$watchDelegate = inputsWatchDelegate;
11007
+ }
11008
+ cache[cacheKey] = parsedExpression;
11009
+ }
11010
+ return addInterceptor(parsedExpression, interceptorFn);
11011
+
11012
+ case 'function':
11013
+ return addInterceptor(exp, interceptorFn);
11014
+
11015
+ default:
11016
+ return addInterceptor(noop, interceptorFn);
11017
+ }
11018
+ }
11019
+
11020
+ function expressionInputDirtyCheck(newValue, oldValueOfValue) {
11021
+
11022
+ if (newValue == null || oldValueOfValue == null) {
11023
+ return newValue === oldValueOfValue;
11024
+ }
11025
+
11026
+ if (typeof newValue === 'object') {
11027
+
11028
+ newValue = getValueOf(newValue);
11029
+
11030
+ if (typeof newValue === 'object') {
11031
+ return false;
11032
+ }
11033
+
11034
+ }
11035
+
11036
+ return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);
11037
+ }
11038
+
11039
+ function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {
11040
+ var inputExpressions = parsedExpression.inputs;
11041
+ var lastResult;
11042
+
11043
+ if (inputExpressions.length === 1) {
11044
+ var oldInputValueOf = expressionInputDirtyCheck;
11045
+ inputExpressions = inputExpressions[0];
11046
+ return scope.$watch(function expressionInputWatch(scope) {
11047
+ var newInputValue = inputExpressions(scope);
11048
+ if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {
11049
+ lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);
11050
+ oldInputValueOf = newInputValue && getValueOf(newInputValue);
11051
+ }
11052
+ return lastResult;
11053
+ }, listener, objectEquality, prettyPrintExpression);
11054
+ }
11055
+
11056
+ var oldInputValueOfValues = [];
11057
+ var oldInputValues = [];
11058
+ for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
11059
+ oldInputValueOfValues[i] = expressionInputDirtyCheck;
11060
+ oldInputValues[i] = null;
11061
+ }
11062
+
11063
+ return scope.$watch(function expressionInputsWatch(scope) {
11064
+ var changed = false;
11065
+
11066
+ for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
11067
+ var newInputValue = inputExpressions[i](scope);
11068
+ if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {
11069
+ oldInputValues[i] = newInputValue;
11070
+ oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);
11071
+ }
11072
+ }
11073
+
11074
+ if (changed) {
11075
+ lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);
11076
+ }
11077
+
11078
+ return lastResult;
11079
+ }, listener, objectEquality, prettyPrintExpression);
11080
+ }
11081
+
11082
+ function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {
11083
+ var unwatch, lastValue;
11084
+ if (parsedExpression.inputs) {
11085
+ unwatch = inputsWatchDelegate(scope, oneTimeListener, objectEquality, parsedExpression, prettyPrintExpression);
11086
+ } else {
11087
+ unwatch = scope.$watch(oneTimeWatch, oneTimeListener, objectEquality);
11088
+ }
11089
+ return unwatch;
11090
+
11091
+ function oneTimeWatch(scope) {
11092
+ return parsedExpression(scope);
11093
+ }
11094
+ function oneTimeListener(value, old, scope) {
11095
+ lastValue = value;
11096
+ if (isFunction(listener)) {
11097
+ listener(value, old, scope);
11098
+ }
11099
+ if (isDefined(value)) {
11100
+ scope.$$postDigest(function() {
11101
+ if (isDefined(lastValue)) {
11102
+ unwatch();
11103
+ }
11104
+ });
11105
+ }
11106
+ }
11107
+ }
11108
+
11109
+ function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {
11110
+ var unwatch, lastValue;
11111
+ unwatch = scope.$watch(function oneTimeWatch(scope) {
11112
+ return parsedExpression(scope);
11113
+ }, function oneTimeListener(value, old, scope) {
11114
+ lastValue = value;
11115
+ if (isFunction(listener)) {
11116
+ listener(value, old, scope);
11117
+ }
11118
+ if (isAllDefined(value)) {
11119
+ scope.$$postDigest(function() {
11120
+ if (isAllDefined(lastValue)) unwatch();
11121
+ });
11122
+ }
11123
+ }, objectEquality);
11124
+
11125
+ return unwatch;
11126
+
11127
+ function isAllDefined(value) {
11128
+ var allDefined = true;
11129
+ forEach(value, function(val) {
11130
+ if (!isDefined(val)) allDefined = false;
11131
+ });
11132
+ return allDefined;
11133
+ }
11134
+ }
11135
+
11136
+ function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {
11137
+ var unwatch = scope.$watch(function constantWatch(scope) {
11138
+ unwatch();
11139
+ return parsedExpression(scope);
11140
+ }, listener, objectEquality);
11141
+ return unwatch;
11142
+ }
11143
+
11144
+ function addInterceptor(parsedExpression, interceptorFn) {
11145
+ if (!interceptorFn) return parsedExpression;
11146
+ var watchDelegate = parsedExpression.$$watchDelegate;
11147
+ var useInputs = false;
11148
+
11149
+ var regularWatch =
11150
+ watchDelegate !== oneTimeLiteralWatchDelegate &&
11151
+ watchDelegate !== oneTimeWatchDelegate;
11152
+
11153
+ var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {
11154
+ var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
11155
+ return interceptorFn(value, scope, locals);
11156
+ } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {
11157
+ var value = parsedExpression(scope, locals, assign, inputs);
11158
+ var result = interceptorFn(value, scope, locals);
11159
+ return isDefined(value) ? result : value;
11160
+ };
11161
+
11162
+ useInputs = !parsedExpression.inputs;
11163
+ if (parsedExpression.$$watchDelegate &&
11164
+ parsedExpression.$$watchDelegate !== inputsWatchDelegate) {
11165
+ fn.$$watchDelegate = parsedExpression.$$watchDelegate;
11166
+ fn.inputs = parsedExpression.inputs;
11167
+ } else if (!interceptorFn.$stateful) {
11168
+ fn.$$watchDelegate = inputsWatchDelegate;
11169
+ fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];
11170
+ }
11171
+
11172
+ return fn;
11173
+ }
11174
+ }];
11175
+ }
11176
+
11177
+ function $QProvider() {
11178
+ var errorOnUnhandledRejections = true;
11179
+ this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
11180
+ return qFactory(function(callback) {
11181
+ $rootScope.$evalAsync(callback);
11182
+ }, $exceptionHandler, errorOnUnhandledRejections);
11183
+ }];
11184
+
11185
+ this.errorOnUnhandledRejections = function(value) {
11186
+ if (isDefined(value)) {
11187
+ errorOnUnhandledRejections = value;
11188
+ return this;
11189
+ } else {
11190
+ return errorOnUnhandledRejections;
11191
+ }
11192
+ };
11193
+ }
11194
+
11195
+ function $$QProvider() {
11196
+ var errorOnUnhandledRejections = true;
11197
+ this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {
11198
+ return qFactory(function(callback) {
11199
+ $browser.defer(callback);
11200
+ }, $exceptionHandler, errorOnUnhandledRejections);
11201
+ }];
11202
+
11203
+ this.errorOnUnhandledRejections = function(value) {
11204
+ if (isDefined(value)) {
11205
+ errorOnUnhandledRejections = value;
11206
+ return this;
11207
+ } else {
11208
+ return errorOnUnhandledRejections;
11209
+ }
11210
+ };
11211
+ }
11212
+
11213
+ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
11214
+ var $qMinErr = minErr('$q', TypeError);
11215
+ var queueSize = 0;
11216
+ var checkQueue = [];
11217
+
11218
+ function defer() {
11219
+ return new Deferred();
11220
+ }
11221
+
11222
+ function Deferred() {
11223
+ var promise = this.promise = new Promise();
11224
+ this.resolve = function(val) { resolvePromise(promise, val); };
11225
+ this.reject = function(reason) { rejectPromise(promise, reason); };
11226
+ this.notify = function(progress) { notifyPromise(promise, progress); };
11227
+ }
11228
+
11229
+
11230
+ function Promise() {
11231
+ this.$$state = { status: 0 };
11232
+ }
11233
+
11234
+ extend(Promise.prototype, {
11235
+ then: function(onFulfilled, onRejected, progressBack) {
11236
+ if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
11237
+ return this;
11238
+ }
11239
+ var result = new Promise();
11240
+
11241
+ this.$$state.pending = this.$$state.pending || [];
11242
+ this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
11243
+ if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
11244
+
11245
+ return result;
11246
+ },
11247
+
11248
+ 'catch': function(callback) {
11249
+ return this.then(null, callback);
11250
+ },
11251
+
11252
+ 'finally': function(callback, progressBack) {
11253
+ return this.then(function(value) {
11254
+ return handleCallback(value, resolve, callback);
11255
+ }, function(error) {
11256
+ return handleCallback(error, reject, callback);
11257
+ }, progressBack);
11258
+ }
11259
+ });
11260
+
11261
+ function processQueue(state) {
11262
+ var fn, promise, pending;
11263
+
11264
+ pending = state.pending;
11265
+ state.processScheduled = false;
11266
+ state.pending = undefined;
11267
+ try {
11268
+ for (var i = 0, ii = pending.length; i < ii; ++i) {
11269
+ state.pur = true;
11270
+ promise = pending[i][0];
11271
+ fn = pending[i][state.status];
11272
+ try {
11273
+ if (isFunction(fn)) {
11274
+ resolvePromise(promise, fn(state.value));
11275
+ } else if (state.status === 1) {
11276
+ resolvePromise(promise, state.value);
11277
+ } else {
11278
+ rejectPromise(promise, state.value);
11279
+ }
11280
+ } catch (e) {
11281
+ rejectPromise(promise, e);
11282
+ }
11283
+ }
11284
+ } finally {
11285
+ --queueSize;
11286
+ if (errorOnUnhandledRejections && queueSize === 0) {
11287
+ nextTick(processChecks);
11288
+ }
11289
+ }
11290
+ }
11291
+
11292
+ function processChecks() {
11293
+ while (!queueSize && checkQueue.length) {
11294
+ var toCheck = checkQueue.shift();
11295
+ if (!toCheck.pur) {
11296
+ toCheck.pur = true;
11297
+ var errorMessage = 'Possibly unhandled rejection: ' + toDebugString(toCheck.value);
11298
+ if (toCheck.value instanceof Error) {
11299
+ exceptionHandler(toCheck.value, errorMessage);
11300
+ } else {
11301
+ exceptionHandler(errorMessage);
11302
+ }
11303
+ }
11304
+ }
11305
+ }
11306
+
11307
+ function scheduleProcessQueue(state) {
11308
+ if (errorOnUnhandledRejections && !state.pending && state.status === 2 && !state.pur) {
11309
+ if (queueSize === 0 && checkQueue.length === 0) {
11310
+ nextTick(processChecks);
11311
+ }
11312
+ checkQueue.push(state);
11313
+ }
11314
+ if (state.processScheduled || !state.pending) return;
11315
+ state.processScheduled = true;
11316
+ ++queueSize;
11317
+ nextTick(function() { processQueue(state); });
11318
+ }
11319
+
11320
+ function resolvePromise(promise, val) {
11321
+ if (promise.$$state.status) return;
11322
+ if (val === promise) {
11323
+ $$reject(promise, $qMinErr(
11324
+ 'qcycle',
11325
+ 'Expected promise to be resolved with value other than itself \'{0}\'',
11326
+ val));
11327
+ } else {
11328
+ $$resolve(promise, val);
11329
+ }
11330
+
11331
+ }
11332
+
11333
+ function $$resolve(promise, val) {
11334
+ var then;
11335
+ var done = false;
11336
+ try {
11337
+ if (isObject(val) || isFunction(val)) then = val.then;
11338
+ if (isFunction(then)) {
11339
+ promise.$$state.status = -1;
11340
+ then.call(val, doResolve, doReject, doNotify);
11341
+ } else {
11342
+ promise.$$state.value = val;
11343
+ promise.$$state.status = 1;
11344
+ scheduleProcessQueue(promise.$$state);
11345
+ }
11346
+ } catch (e) {
11347
+ doReject(e);
11348
+ }
11349
+
11350
+ function doResolve(val) {
11351
+ if (done) return;
11352
+ done = true;
11353
+ $$resolve(promise, val);
11354
+ }
11355
+ function doReject(val) {
11356
+ if (done) return;
11357
+ done = true;
11358
+ $$reject(promise, val);
11359
+ }
11360
+ function doNotify(progress) {
11361
+ notifyPromise(promise, progress);
11362
+ }
11363
+ }
11364
+
11365
+ function rejectPromise(promise, reason) {
11366
+ if (promise.$$state.status) return;
11367
+ $$reject(promise, reason);
11368
+ }
11369
+
11370
+ function $$reject(promise, reason) {
11371
+ promise.$$state.value = reason;
11372
+ promise.$$state.status = 2;
11373
+ scheduleProcessQueue(promise.$$state);
11374
+ }
11375
+
11376
+ function notifyPromise(promise, progress) {
11377
+ var callbacks = promise.$$state.pending;
11378
+
11379
+ if ((promise.$$state.status <= 0) && callbacks && callbacks.length) {
11380
+ nextTick(function() {
11381
+ var callback, result;
11382
+ for (var i = 0, ii = callbacks.length; i < ii; i++) {
11383
+ result = callbacks[i][0];
11384
+ callback = callbacks[i][3];
11385
+ try {
11386
+ notifyPromise(result, isFunction(callback) ? callback(progress) : progress);
11387
+ } catch (e) {
11388
+ exceptionHandler(e);
11389
+ }
11390
+ }
11391
+ });
11392
+ }
11393
+ }
11394
+
11395
+ function reject(reason) {
11396
+ var result = new Promise();
11397
+ rejectPromise(result, reason);
11398
+ return result;
11399
+ }
11400
+
11401
+ function handleCallback(value, resolver, callback) {
11402
+ var callbackOutput = null;
11403
+ try {
11404
+ if (isFunction(callback)) callbackOutput = callback();
11405
+ } catch (e) {
11406
+ return reject(e);
11407
+ }
11408
+ if (isPromiseLike(callbackOutput)) {
11409
+ return callbackOutput.then(function() {
11410
+ return resolver(value);
11411
+ }, reject);
11412
+ } else {
11413
+ return resolver(value);
11414
+ }
11415
+ }
11416
+
11417
+
11418
+
11419
+ function when(value, callback, errback, progressBack) {
11420
+ var result = new Promise();
11421
+ resolvePromise(result, value);
11422
+ return result.then(callback, errback, progressBack);
11423
+ }
11424
+
11425
+ var resolve = when;
11426
+
11427
+
11428
+ function all(promises) {
11429
+ var result = new Promise(),
11430
+ counter = 0,
11431
+ results = isArray(promises) ? [] : {};
11432
+
11433
+ forEach(promises, function(promise, key) {
11434
+ counter++;
11435
+ when(promise).then(function(value) {
11436
+ results[key] = value;
11437
+ if (!(--counter)) resolvePromise(result, results);
11438
+ }, function(reason) {
11439
+ rejectPromise(result, reason);
11440
+ });
11441
+ });
11442
+
11443
+ if (counter === 0) {
11444
+ resolvePromise(result, results);
11445
+ }
11446
+
11447
+ return result;
11448
+ }
11449
+
11450
+
11451
+ function race(promises) {
11452
+ var deferred = defer();
11453
+
11454
+ forEach(promises, function(promise) {
11455
+ when(promise).then(deferred.resolve, deferred.reject);
11456
+ });
11457
+
11458
+ return deferred.promise;
11459
+ }
11460
+
11461
+ function $Q(resolver) {
11462
+ if (!isFunction(resolver)) {
11463
+ throw $qMinErr('norslvr', 'Expected resolverFn, got \'{0}\'', resolver);
11464
+ }
11465
+
11466
+ var promise = new Promise();
11467
+
11468
+ function resolveFn(value) {
11469
+ resolvePromise(promise, value);
11470
+ }
11471
+
11472
+ function rejectFn(reason) {
11473
+ rejectPromise(promise, reason);
11474
+ }
11475
+
11476
+ resolver(resolveFn, rejectFn);
11477
+
11478
+ return promise;
11479
+ }
11480
+
11481
+ $Q.prototype = Promise.prototype;
11482
+
11483
+ $Q.defer = defer;
11484
+ $Q.reject = reject;
11485
+ $Q.when = when;
11486
+ $Q.resolve = resolve;
11487
+ $Q.all = all;
11488
+ $Q.race = race;
11489
+
11490
+ return $Q;
11491
+ }
11492
+
11493
+ function $$RAFProvider() {
11494
+ this.$get = ['$window', '$timeout', function($window, $timeout) {
11495
+ var requestAnimationFrame = $window.requestAnimationFrame ||
11496
+ $window.webkitRequestAnimationFrame;
11497
+
11498
+ var cancelAnimationFrame = $window.cancelAnimationFrame ||
11499
+ $window.webkitCancelAnimationFrame ||
11500
+ $window.webkitCancelRequestAnimationFrame;
11501
+
11502
+ var rafSupported = !!requestAnimationFrame;
11503
+ var raf = rafSupported
11504
+ ? function(fn) {
11505
+ var id = requestAnimationFrame(fn);
11506
+ return function() {
11507
+ cancelAnimationFrame(id);
11508
+ };
11509
+ }
11510
+ : function(fn) {
11511
+ var timer = $timeout(fn, 16.66, false);
11512
+ return function() {
11513
+ $timeout.cancel(timer);
11514
+ };
11515
+ };
11516
+
11517
+ raf.supported = rafSupported;
11518
+
11519
+ return raf;
11520
+ }];
11521
+ }
11522
+
11523
+
11524
+
11525
+
11526
+
11527
+
11528
+ function $RootScopeProvider() {
11529
+ var TTL = 10;
11530
+ var $rootScopeMinErr = minErr('$rootScope');
11531
+ var lastDirtyWatch = null;
11532
+ var applyAsyncId = null;
11533
+
11534
+ this.digestTtl = function(value) {
11535
+ if (arguments.length) {
11536
+ TTL = value;
11537
+ }
11538
+ return TTL;
11539
+ };
11540
+
11541
+ function createChildScopeClass(parent) {
11542
+ function ChildScope() {
11543
+ this.$$watchers = this.$$nextSibling =
11544
+ this.$$childHead = this.$$childTail = null;
11545
+ this.$$listeners = {};
11546
+ this.$$listenerCount = {};
11547
+ this.$$watchersCount = 0;
11548
+ this.$id = nextUid();
11549
+ this.$$ChildScope = null;
11550
+ }
11551
+ ChildScope.prototype = parent;
11552
+ return ChildScope;
11553
+ }
11554
+
11555
+ this.$get = ['$exceptionHandler', '$parse', '$browser',
11556
+ function($exceptionHandler, $parse, $browser) {
11557
+
11558
+ function destroyChildScope($event) {
11559
+ $event.currentScope.$$destroyed = true;
11560
+ }
11561
+
11562
+ function cleanUpScope($scope) {
11563
+
11564
+ if (msie === 9) {
11565
+ if ($scope.$$childHead) {
11566
+ cleanUpScope($scope.$$childHead);
11567
+ }
11568
+ if ($scope.$$nextSibling) {
11569
+ cleanUpScope($scope.$$nextSibling);
11570
+ }
11571
+ }
11572
+
11573
+
11574
+ $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =
11575
+ $scope.$$childTail = $scope.$root = $scope.$$watchers = null;
11576
+ }
11577
+
11578
+ function Scope() {
11579
+ this.$id = nextUid();
11580
+ this.$$phase = this.$parent = this.$$watchers =
11581
+ this.$$nextSibling = this.$$prevSibling =
11582
+ this.$$childHead = this.$$childTail = null;
11583
+ this.$root = this;
11584
+ this.$$destroyed = false;
11585
+ this.$$listeners = {};
11586
+ this.$$listenerCount = {};
11587
+ this.$$watchersCount = 0;
11588
+ this.$$isolateBindings = null;
11589
+ }
11590
+
11591
+
11592
+
11593
+
11594
+ Scope.prototype = {
11595
+ constructor: Scope,
11596
+ $new: function(isolate, parent) {
11597
+ var child;
11598
+
11599
+ parent = parent || this;
11600
+
11601
+ if (isolate) {
11602
+ child = new Scope();
11603
+ child.$root = this.$root;
11604
+ } else {
11605
+ if (!this.$$ChildScope) {
11606
+ this.$$ChildScope = createChildScopeClass(this);
11607
+ }
11608
+ child = new this.$$ChildScope();
11609
+ }
11610
+ child.$parent = parent;
11611
+ child.$$prevSibling = parent.$$childTail;
11612
+ if (parent.$$childHead) {
11613
+ parent.$$childTail.$$nextSibling = child;
11614
+ parent.$$childTail = child;
11615
+ } else {
11616
+ parent.$$childHead = parent.$$childTail = child;
11617
+ }
11618
+
11619
+ if (isolate || parent !== this) child.$on('$destroy', destroyChildScope);
11620
+
11621
+ return child;
11622
+ },
11623
+
11624
+ $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {
11625
+ var get = $parse(watchExp);
11626
+
11627
+ if (get.$$watchDelegate) {
11628
+ return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);
11629
+ }
11630
+ var scope = this,
11631
+ array = scope.$$watchers,
11632
+ watcher = {
11633
+ fn: listener,
11634
+ last: initWatchVal,
11635
+ get: get,
11636
+ exp: prettyPrintExpression || watchExp,
11637
+ eq: !!objectEquality
11638
+ };
11639
+
11640
+ lastDirtyWatch = null;
11641
+
11642
+ if (!isFunction(listener)) {
11643
+ watcher.fn = noop;
11644
+ }
11645
+
11646
+ if (!array) {
11647
+ array = scope.$$watchers = [];
11648
+ array.$$digestWatchIndex = -1;
11649
+ }
11650
+ array.unshift(watcher);
11651
+ array.$$digestWatchIndex++;
11652
+ incrementWatchersCount(this, 1);
11653
+
11654
+ return function deregisterWatch() {
11655
+ var index = arrayRemove(array, watcher);
11656
+ if (index >= 0) {
11657
+ incrementWatchersCount(scope, -1);
11658
+ if (index < array.$$digestWatchIndex) {
11659
+ array.$$digestWatchIndex--;
11660
+ }
11661
+ }
11662
+ lastDirtyWatch = null;
11663
+ };
11664
+ },
11665
+
11666
+ $watchGroup: function(watchExpressions, listener) {
11667
+ var oldValues = new Array(watchExpressions.length);
11668
+ var newValues = new Array(watchExpressions.length);
11669
+ var deregisterFns = [];
11670
+ var self = this;
11671
+ var changeReactionScheduled = false;
11672
+ var firstRun = true;
11673
+
11674
+ if (!watchExpressions.length) {
11675
+ var shouldCall = true;
11676
+ self.$evalAsync(function() {
11677
+ if (shouldCall) listener(newValues, newValues, self);
11678
+ });
11679
+ return function deregisterWatchGroup() {
11680
+ shouldCall = false;
11681
+ };
11682
+ }
11683
+
11684
+ if (watchExpressions.length === 1) {
11685
+ return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {
11686
+ newValues[0] = value;
11687
+ oldValues[0] = oldValue;
11688
+ listener(newValues, (value === oldValue) ? newValues : oldValues, scope);
11689
+ });
11690
+ }
11691
+
11692
+ forEach(watchExpressions, function(expr, i) {
11693
+ var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {
11694
+ newValues[i] = value;
11695
+ oldValues[i] = oldValue;
11696
+ if (!changeReactionScheduled) {
11697
+ changeReactionScheduled = true;
11698
+ self.$evalAsync(watchGroupAction);
11699
+ }
11700
+ });
11701
+ deregisterFns.push(unwatchFn);
11702
+ });
11703
+
11704
+ function watchGroupAction() {
11705
+ changeReactionScheduled = false;
11706
+
11707
+ if (firstRun) {
11708
+ firstRun = false;
11709
+ listener(newValues, newValues, self);
11710
+ } else {
11711
+ listener(newValues, oldValues, self);
11712
+ }
11713
+ }
11714
+
11715
+ return function deregisterWatchGroup() {
11716
+ while (deregisterFns.length) {
11717
+ deregisterFns.shift()();
11718
+ }
11719
+ };
11720
+ },
11721
+
11722
+
11723
+ $watchCollection: function(obj, listener) {
11724
+ $watchCollectionInterceptor.$stateful = true;
11725
+
11726
+ var self = this;
11727
+ var newValue;
11728
+ var oldValue;
11729
+ var veryOldValue;
11730
+ var trackVeryOldValue = (listener.length > 1);
11731
+ var changeDetected = 0;
11732
+ var changeDetector = $parse(obj, $watchCollectionInterceptor);
11733
+ var internalArray = [];
11734
+ var internalObject = {};
11735
+ var initRun = true;
11736
+ var oldLength = 0;
11737
+
11738
+ function $watchCollectionInterceptor(_value) {
11739
+ newValue = _value;
11740
+ var newLength, key, bothNaN, newItem, oldItem;
11741
+
11742
+ if (isUndefined(newValue)) return;
11743
+
11744
+ if (!isObject(newValue)) {
11745
+ if (oldValue !== newValue) {
11746
+ oldValue = newValue;
11747
+ changeDetected++;
11748
+ }
11749
+ } else if (isArrayLike(newValue)) {
11750
+ if (oldValue !== internalArray) {
11751
+ oldValue = internalArray;
11752
+ oldLength = oldValue.length = 0;
11753
+ changeDetected++;
11754
+ }
11755
+
11756
+ newLength = newValue.length;
11757
+
11758
+ if (oldLength !== newLength) {
11759
+ changeDetected++;
11760
+ oldValue.length = oldLength = newLength;
11761
+ }
11762
+ for (var i = 0; i < newLength; i++) {
11763
+ oldItem = oldValue[i];
11764
+ newItem = newValue[i];
11765
+
11766
+ bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
11767
+ if (!bothNaN && (oldItem !== newItem)) {
11768
+ changeDetected++;
11769
+ oldValue[i] = newItem;
11770
+ }
11771
+ }
11772
+ } else {
11773
+ if (oldValue !== internalObject) {
11774
+ oldValue = internalObject = {};
11775
+ oldLength = 0;
11776
+ changeDetected++;
11777
+ }
11778
+ newLength = 0;
11779
+ for (key in newValue) {
11780
+ if (hasOwnProperty.call(newValue, key)) {
11781
+ newLength++;
11782
+ newItem = newValue[key];
11783
+ oldItem = oldValue[key];
11784
+
11785
+ if (key in oldValue) {
11786
+ bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
11787
+ if (!bothNaN && (oldItem !== newItem)) {
11788
+ changeDetected++;
11789
+ oldValue[key] = newItem;
11790
+ }
11791
+ } else {
11792
+ oldLength++;
11793
+ oldValue[key] = newItem;
11794
+ changeDetected++;
11795
+ }
11796
+ }
11797
+ }
11798
+ if (oldLength > newLength) {
11799
+ changeDetected++;
11800
+ for (key in oldValue) {
11801
+ if (!hasOwnProperty.call(newValue, key)) {
11802
+ oldLength--;
11803
+ delete oldValue[key];
11804
+ }
11805
+ }
11806
+ }
11807
+ }
11808
+ return changeDetected;
11809
+ }
11810
+
11811
+ function $watchCollectionAction() {
11812
+ if (initRun) {
11813
+ initRun = false;
11814
+ listener(newValue, newValue, self);
11815
+ } else {
11816
+ listener(newValue, veryOldValue, self);
11817
+ }
11818
+
11819
+ if (trackVeryOldValue) {
11820
+ if (!isObject(newValue)) {
11821
+ veryOldValue = newValue;
11822
+ } else if (isArrayLike(newValue)) {
11823
+ veryOldValue = new Array(newValue.length);
11824
+ for (var i = 0; i < newValue.length; i++) {
11825
+ veryOldValue[i] = newValue[i];
11826
+ }
11827
+ } else {
11828
+ veryOldValue = {};
11829
+ for (var key in newValue) {
11830
+ if (hasOwnProperty.call(newValue, key)) {
11831
+ veryOldValue[key] = newValue[key];
11832
+ }
11833
+ }
11834
+ }
11835
+ }
11836
+ }
11837
+
11838
+ return this.$watch(changeDetector, $watchCollectionAction);
11839
+ },
11840
+
11841
+ $digest: function() {
11842
+ var watch, value, last, fn, get,
11843
+ watchers,
11844
+ dirty, ttl = TTL,
11845
+ next, current, target = this,
11846
+ watchLog = [],
11847
+ logIdx, asyncTask;
11848
+
11849
+ beginPhase('$digest');
11850
+ $browser.$$checkUrlChange();
11851
+
11852
+ if (this === $rootScope && applyAsyncId !== null) {
11853
+ $browser.defer.cancel(applyAsyncId);
11854
+ flushApplyAsync();
11855
+ }
11856
+
11857
+ lastDirtyWatch = null;
11858
+
11859
+ do {
11860
+ dirty = false;
11861
+ current = target;
11862
+
11863
+ for (var asyncQueuePosition = 0; asyncQueuePosition < asyncQueue.length; asyncQueuePosition++) {
11864
+ try {
11865
+ asyncTask = asyncQueue[asyncQueuePosition];
11866
+ asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);
11867
+ } catch (e) {
11868
+ $exceptionHandler(e);
11869
+ }
11870
+ lastDirtyWatch = null;
11871
+ }
11872
+ asyncQueue.length = 0;
11873
+
11874
+ traverseScopesLoop:
11875
+ do {
11876
+ if ((watchers = current.$$watchers)) {
11877
+ watchers.$$digestWatchIndex = watchers.length;
11878
+ while (watchers.$$digestWatchIndex--) {
11879
+ try {
11880
+ watch = watchers[watchers.$$digestWatchIndex];
11881
+ if (watch) {
11882
+ get = watch.get;
11883
+ if ((value = get(current)) !== (last = watch.last) &&
11884
+ !(watch.eq
11885
+ ? equals(value, last)
11886
+ : (isNumberNaN(value) && isNumberNaN(last)))) {
11887
+ dirty = true;
11888
+ lastDirtyWatch = watch;
11889
+ watch.last = watch.eq ? copy(value, null) : value;
11890
+ fn = watch.fn;
11891
+ fn(value, ((last === initWatchVal) ? value : last), current);
11892
+ if (ttl < 5) {
11893
+ logIdx = 4 - ttl;
11894
+ if (!watchLog[logIdx]) watchLog[logIdx] = [];
11895
+ watchLog[logIdx].push({
11896
+ msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,
11897
+ newVal: value,
11898
+ oldVal: last
11899
+ });
11900
+ }
11901
+ } else if (watch === lastDirtyWatch) {
11902
+ dirty = false;
11903
+ break traverseScopesLoop;
11904
+ }
11905
+ }
11906
+ } catch (e) {
11907
+ $exceptionHandler(e);
11908
+ }
11909
+ }
11910
+ }
11911
+
11912
+ if (!(next = ((current.$$watchersCount && current.$$childHead) ||
11913
+ (current !== target && current.$$nextSibling)))) {
11914
+ while (current !== target && !(next = current.$$nextSibling)) {
11915
+ current = current.$parent;
11916
+ }
11917
+ }
11918
+ } while ((current = next));
11919
+
11920
+
11921
+ if ((dirty || asyncQueue.length) && !(ttl--)) {
11922
+ clearPhase();
11923
+ throw $rootScopeMinErr('infdig',
11924
+ '{0} $digest() iterations reached. Aborting!\n' +
11925
+ 'Watchers fired in the last 5 iterations: {1}',
11926
+ TTL, watchLog);
11927
+ }
11928
+
11929
+ } while (dirty || asyncQueue.length);
11930
+
11931
+ clearPhase();
11932
+
11933
+ while (postDigestQueuePosition < postDigestQueue.length) {
11934
+ try {
11935
+ postDigestQueue[postDigestQueuePosition++]();
11936
+ } catch (e) {
11937
+ $exceptionHandler(e);
11938
+ }
11939
+ }
11940
+ postDigestQueue.length = postDigestQueuePosition = 0;
11941
+ },
11942
+
11943
+
11944
+
11945
+ $destroy: function() {
11946
+ if (this.$$destroyed) return;
11947
+ var parent = this.$parent;
11948
+
11949
+ this.$broadcast('$destroy');
11950
+ this.$$destroyed = true;
11951
+
11952
+ if (this === $rootScope) {
11953
+ $browser.$$applicationDestroyed();
11954
+ }
11955
+
11956
+ incrementWatchersCount(this, -this.$$watchersCount);
11957
+ for (var eventName in this.$$listenerCount) {
11958
+ decrementListenerCount(this, this.$$listenerCount[eventName], eventName);
11959
+ }
11960
+
11961
+ if (parent && parent.$$childHead === this) parent.$$childHead = this.$$nextSibling;
11962
+ if (parent && parent.$$childTail === this) parent.$$childTail = this.$$prevSibling;
11963
+ if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
11964
+ if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
11965
+
11966
+ this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;
11967
+ this.$on = this.$watch = this.$watchGroup = function() { return noop; };
11968
+ this.$$listeners = {};
11969
+
11970
+ this.$$nextSibling = null;
11971
+ cleanUpScope(this);
11972
+ },
11973
+
11974
+ $eval: function(expr, locals) {
11975
+ return $parse(expr)(this, locals);
11976
+ },
11977
+
11978
+ $evalAsync: function(expr, locals) {
11979
+ if (!$rootScope.$$phase && !asyncQueue.length) {
11980
+ $browser.defer(function() {
11981
+ if (asyncQueue.length) {
11982
+ $rootScope.$digest();
11983
+ }
11984
+ });
11985
+ }
11986
+
11987
+ asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});
11988
+ },
11989
+
11990
+ $$postDigest: function(fn) {
11991
+ postDigestQueue.push(fn);
11992
+ },
11993
+
11994
+ $apply: function(expr) {
11995
+ try {
11996
+ beginPhase('$apply');
11997
+ try {
11998
+ return this.$eval(expr);
11999
+ } finally {
12000
+ clearPhase();
12001
+ }
12002
+ } catch (e) {
12003
+ $exceptionHandler(e);
12004
+ } finally {
12005
+ try {
12006
+ $rootScope.$digest();
12007
+ } catch (e) {
12008
+ $exceptionHandler(e);
12009
+ throw e;
12010
+ }
12011
+ }
12012
+ },
12013
+
12014
+ $applyAsync: function(expr) {
12015
+ var scope = this;
12016
+ if (expr) {
12017
+ applyAsyncQueue.push($applyAsyncExpression);
12018
+ }
12019
+ expr = $parse(expr);
12020
+ scheduleApplyAsync();
12021
+
12022
+ function $applyAsyncExpression() {
12023
+ scope.$eval(expr);
12024
+ }
12025
+ },
12026
+
12027
+ $on: function(name, listener) {
12028
+ var namedListeners = this.$$listeners[name];
12029
+ if (!namedListeners) {
12030
+ this.$$listeners[name] = namedListeners = [];
12031
+ }
12032
+ namedListeners.push(listener);
12033
+
12034
+ var current = this;
12035
+ do {
12036
+ if (!current.$$listenerCount[name]) {
12037
+ current.$$listenerCount[name] = 0;
12038
+ }
12039
+ current.$$listenerCount[name]++;
12040
+ } while ((current = current.$parent));
12041
+
12042
+ var self = this;
12043
+ return function() {
12044
+ var indexOfListener = namedListeners.indexOf(listener);
12045
+ if (indexOfListener !== -1) {
12046
+ namedListeners[indexOfListener] = null;
12047
+ decrementListenerCount(self, 1, name);
12048
+ }
12049
+ };
12050
+ },
12051
+
12052
+
12053
+ $emit: function(name, args) {
12054
+ var empty = [],
12055
+ namedListeners,
12056
+ scope = this,
12057
+ stopPropagation = false,
12058
+ event = {
12059
+ name: name,
12060
+ targetScope: scope,
12061
+ stopPropagation: function() {stopPropagation = true;},
12062
+ preventDefault: function() {
12063
+ event.defaultPrevented = true;
12064
+ },
12065
+ defaultPrevented: false
12066
+ },
12067
+ listenerArgs = concat([event], arguments, 1),
12068
+ i, length;
12069
+
12070
+ do {
12071
+ namedListeners = scope.$$listeners[name] || empty;
12072
+ event.currentScope = scope;
12073
+ for (i = 0, length = namedListeners.length; i < length; i++) {
12074
+
12075
+ if (!namedListeners[i]) {
12076
+ namedListeners.splice(i, 1);
12077
+ i--;
12078
+ length--;
12079
+ continue;
12080
+ }
12081
+ try {
12082
+ namedListeners[i].apply(null, listenerArgs);
12083
+ } catch (e) {
12084
+ $exceptionHandler(e);
12085
+ }
12086
+ }
12087
+ if (stopPropagation) {
12088
+ event.currentScope = null;
12089
+ return event;
12090
+ }
12091
+ scope = scope.$parent;
12092
+ } while (scope);
12093
+
12094
+ event.currentScope = null;
12095
+
12096
+ return event;
12097
+ },
12098
+
12099
+
12100
+ $broadcast: function(name, args) {
12101
+ var target = this,
12102
+ current = target,
12103
+ next = target,
12104
+ event = {
12105
+ name: name,
12106
+ targetScope: target,
12107
+ preventDefault: function() {
12108
+ event.defaultPrevented = true;
12109
+ },
12110
+ defaultPrevented: false
12111
+ };
12112
+
12113
+ if (!target.$$listenerCount[name]) return event;
12114
+
12115
+ var listenerArgs = concat([event], arguments, 1),
12116
+ listeners, i, length;
12117
+
12118
+ while ((current = next)) {
12119
+ event.currentScope = current;
12120
+ listeners = current.$$listeners[name] || [];
12121
+ for (i = 0, length = listeners.length; i < length; i++) {
12122
+ if (!listeners[i]) {
12123
+ listeners.splice(i, 1);
12124
+ i--;
12125
+ length--;
12126
+ continue;
12127
+ }
12128
+
12129
+ try {
12130
+ listeners[i].apply(null, listenerArgs);
12131
+ } catch (e) {
12132
+ $exceptionHandler(e);
12133
+ }
12134
+ }
12135
+
12136
+ if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||
12137
+ (current !== target && current.$$nextSibling)))) {
12138
+ while (current !== target && !(next = current.$$nextSibling)) {
12139
+ current = current.$parent;
12140
+ }
12141
+ }
12142
+ }
12143
+
12144
+ event.currentScope = null;
12145
+ return event;
12146
+ }
12147
+ };
12148
+
12149
+ var $rootScope = new Scope();
12150
+
12151
+ var asyncQueue = $rootScope.$$asyncQueue = [];
12152
+ var postDigestQueue = $rootScope.$$postDigestQueue = [];
12153
+ var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];
12154
+
12155
+ var postDigestQueuePosition = 0;
12156
+
12157
+ return $rootScope;
12158
+
12159
+
12160
+ function beginPhase(phase) {
12161
+ if ($rootScope.$$phase) {
12162
+ throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
12163
+ }
12164
+
12165
+ $rootScope.$$phase = phase;
12166
+ }
12167
+
12168
+ function clearPhase() {
12169
+ $rootScope.$$phase = null;
12170
+ }
12171
+
12172
+ function incrementWatchersCount(current, count) {
12173
+ do {
12174
+ current.$$watchersCount += count;
12175
+ } while ((current = current.$parent));
12176
+ }
12177
+
12178
+ function decrementListenerCount(current, count, name) {
12179
+ do {
12180
+ current.$$listenerCount[name] -= count;
12181
+
12182
+ if (current.$$listenerCount[name] === 0) {
12183
+ delete current.$$listenerCount[name];
12184
+ }
12185
+ } while ((current = current.$parent));
12186
+ }
12187
+
12188
+ function initWatchVal() {}
12189
+
12190
+ function flushApplyAsync() {
12191
+ while (applyAsyncQueue.length) {
12192
+ try {
12193
+ applyAsyncQueue.shift()();
12194
+ } catch (e) {
12195
+ $exceptionHandler(e);
12196
+ }
12197
+ }
12198
+ applyAsyncId = null;
12199
+ }
12200
+
12201
+ function scheduleApplyAsync() {
12202
+ if (applyAsyncId === null) {
12203
+ applyAsyncId = $browser.defer(function() {
12204
+ $rootScope.$apply(flushApplyAsync);
12205
+ });
12206
+ }
12207
+ }
12208
+ }];
12209
+ }
12210
+
12211
+
12212
+
12213
+
12214
+ function $$SanitizeUriProvider() {
12215
+ var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
12216
+ imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/;
12217
+
12218
+ this.aHrefSanitizationWhitelist = function(regexp) {
12219
+ if (isDefined(regexp)) {
12220
+ aHrefSanitizationWhitelist = regexp;
12221
+ return this;
12222
+ }
12223
+ return aHrefSanitizationWhitelist;
12224
+ };
12225
+
12226
+
12227
+ this.imgSrcSanitizationWhitelist = function(regexp) {
12228
+ if (isDefined(regexp)) {
12229
+ imgSrcSanitizationWhitelist = regexp;
12230
+ return this;
12231
+ }
12232
+ return imgSrcSanitizationWhitelist;
12233
+ };
12234
+
12235
+ this.$get = function() {
12236
+ return function sanitizeUri(uri, isImage) {
12237
+ var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
12238
+ var normalizedVal;
12239
+ normalizedVal = urlResolve(uri).href;
12240
+ if (normalizedVal !== '' && !normalizedVal.match(regex)) {
12241
+ return 'unsafe:' + normalizedVal;
12242
+ }
12243
+ return uri;
12244
+ };
12245
+ };
12246
+ }
12247
+
12248
+
12249
+
12250
+ var $sceMinErr = minErr('$sce');
12251
+
12252
+ var SCE_CONTEXTS = {
12253
+ HTML: 'html',
12254
+ CSS: 'css',
12255
+ URL: 'url',
12256
+ RESOURCE_URL: 'resourceUrl',
12257
+ JS: 'js'
12258
+ };
12259
+
12260
+
12261
+ var UNDERSCORE_LOWERCASE_REGEXP = /_([a-z])/g;
12262
+
12263
+ function snakeToCamel(name) {
12264
+ return name
12265
+ .replace(UNDERSCORE_LOWERCASE_REGEXP, fnCamelCaseReplace);
12266
+ }
12267
+
12268
+ function adjustMatcher(matcher) {
12269
+ if (matcher === 'self') {
12270
+ return matcher;
12271
+ } else if (isString(matcher)) {
12272
+ if (matcher.indexOf('***') > -1) {
12273
+ throw $sceMinErr('iwcard',
12274
+ 'Illegal sequence *** in string matcher. String: {0}', matcher);
12275
+ }
12276
+ matcher = escapeForRegexp(matcher).
12277
+ replace(/\\\*\\\*/g, '.*').
12278
+ replace(/\\\*/g, '[^:/.?&;]*');
12279
+ return new RegExp('^' + matcher + '$');
12280
+ } else if (isRegExp(matcher)) {
12281
+ return new RegExp('^' + matcher.source + '$');
12282
+ } else {
12283
+ throw $sceMinErr('imatcher',
12284
+ 'Matchers may only be "self", string patterns or RegExp objects');
12285
+ }
12286
+ }
12287
+
12288
+
12289
+ function adjustMatchers(matchers) {
12290
+ var adjustedMatchers = [];
12291
+ if (isDefined(matchers)) {
12292
+ forEach(matchers, function(matcher) {
12293
+ adjustedMatchers.push(adjustMatcher(matcher));
12294
+ });
12295
+ }
12296
+ return adjustedMatchers;
12297
+ }
12298
+
12299
+
12300
+
12301
+
12302
+ function $SceDelegateProvider() {
12303
+ this.SCE_CONTEXTS = SCE_CONTEXTS;
12304
+
12305
+ var resourceUrlWhitelist = ['self'],
12306
+ resourceUrlBlacklist = [];
12307
+
12308
+ this.resourceUrlWhitelist = function(value) {
12309
+ if (arguments.length) {
12310
+ resourceUrlWhitelist = adjustMatchers(value);
12311
+ }
12312
+ return resourceUrlWhitelist;
12313
+ };
12314
+
12315
+
12316
+ this.resourceUrlBlacklist = function(value) {
12317
+ if (arguments.length) {
12318
+ resourceUrlBlacklist = adjustMatchers(value);
12319
+ }
12320
+ return resourceUrlBlacklist;
12321
+ };
12322
+
12323
+ this.$get = ['$injector', function($injector) {
12324
+
12325
+ var htmlSanitizer = function htmlSanitizer(html) {
12326
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
12327
+ };
12328
+
12329
+ if ($injector.has('$sanitize')) {
12330
+ htmlSanitizer = $injector.get('$sanitize');
12331
+ }
12332
+
12333
+
12334
+ function matchUrl(matcher, parsedUrl) {
12335
+ if (matcher === 'self') {
12336
+ return urlIsSameOrigin(parsedUrl);
12337
+ } else {
12338
+ return !!matcher.exec(parsedUrl.href);
12339
+ }
12340
+ }
12341
+
12342
+ function isResourceUrlAllowedByPolicy(url) {
12343
+ var parsedUrl = urlResolve(url.toString());
12344
+ var i, n, allowed = false;
12345
+ for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {
12346
+ if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {
12347
+ allowed = true;
12348
+ break;
12349
+ }
12350
+ }
12351
+ if (allowed) {
12352
+ for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {
12353
+ if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {
12354
+ allowed = false;
12355
+ break;
12356
+ }
12357
+ }
12358
+ }
12359
+ return allowed;
12360
+ }
12361
+
12362
+ function generateHolderType(Base) {
12363
+ var holderType = function TrustedValueHolderType(trustedValue) {
12364
+ this.$$unwrapTrustedValue = function() {
12365
+ return trustedValue;
12366
+ };
12367
+ };
12368
+ if (Base) {
12369
+ holderType.prototype = new Base();
12370
+ }
12371
+ holderType.prototype.valueOf = function sceValueOf() {
12372
+ return this.$$unwrapTrustedValue();
12373
+ };
12374
+ holderType.prototype.toString = function sceToString() {
12375
+ return this.$$unwrapTrustedValue().toString();
12376
+ };
12377
+ return holderType;
12378
+ }
12379
+
12380
+ var trustedValueHolderBase = generateHolderType(),
12381
+ byType = {};
12382
+
12383
+ byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);
12384
+ byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);
12385
+ byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);
12386
+ byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);
12387
+ byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);
12388
+
12389
+ function trustAs(type, trustedValue) {
12390
+ var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
12391
+ if (!Constructor) {
12392
+ throw $sceMinErr('icontext',
12393
+ 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',
12394
+ type, trustedValue);
12395
+ }
12396
+ if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {
12397
+ return trustedValue;
12398
+ }
12399
+ if (typeof trustedValue !== 'string') {
12400
+ throw $sceMinErr('itype',
12401
+ 'Attempted to trust a non-string value in a content requiring a string: Context: {0}',
12402
+ type);
12403
+ }
12404
+ return new Constructor(trustedValue);
12405
+ }
12406
+
12407
+ function valueOf(maybeTrusted) {
12408
+ if (maybeTrusted instanceof trustedValueHolderBase) {
12409
+ return maybeTrusted.$$unwrapTrustedValue();
12410
+ } else {
12411
+ return maybeTrusted;
12412
+ }
12413
+ }
12414
+
12415
+ function getTrusted(type, maybeTrusted) {
12416
+ if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {
12417
+ return maybeTrusted;
12418
+ }
12419
+ var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
12420
+ if (constructor && maybeTrusted instanceof constructor) {
12421
+ return maybeTrusted.$$unwrapTrustedValue();
12422
+ }
12423
+ if (type === SCE_CONTEXTS.RESOURCE_URL) {
12424
+ if (isResourceUrlAllowedByPolicy(maybeTrusted)) {
12425
+ return maybeTrusted;
12426
+ } else {
12427
+ throw $sceMinErr('insecurl',
12428
+ 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}',
12429
+ maybeTrusted.toString());
12430
+ }
12431
+ } else if (type === SCE_CONTEXTS.HTML) {
12432
+ return htmlSanitizer(maybeTrusted);
12433
+ }
12434
+ throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
12435
+ }
12436
+
12437
+ return { trustAs: trustAs,
12438
+ getTrusted: getTrusted,
12439
+ valueOf: valueOf };
12440
+ }];
12441
+ }
12442
+
12443
+
12444
+
12445
+
12446
+ function $SceProvider() {
12447
+ var enabled = true;
12448
+
12449
+ this.enabled = function(value) {
12450
+ if (arguments.length) {
12451
+ enabled = !!value;
12452
+ }
12453
+ return enabled;
12454
+ };
12455
+
12456
+
12457
+
12458
+ this.$get = ['$parse', '$sceDelegate', function(
12459
+ $parse, $sceDelegate) {
12460
+ if (enabled && msie < 8) {
12461
+ throw $sceMinErr('iequirks',
12462
+ 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +
12463
+ 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' +
12464
+ 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
12465
+ }
12466
+
12467
+ var sce = shallowCopy(SCE_CONTEXTS);
12468
+
12469
+ sce.isEnabled = function() {
12470
+ return enabled;
12471
+ };
12472
+ sce.trustAs = $sceDelegate.trustAs;
12473
+ sce.getTrusted = $sceDelegate.getTrusted;
12474
+ sce.valueOf = $sceDelegate.valueOf;
12475
+
12476
+ if (!enabled) {
12477
+ sce.trustAs = sce.getTrusted = function(type, value) { return value; };
12478
+ sce.valueOf = identity;
12479
+ }
12480
+
12481
+ sce.parseAs = function sceParseAs(type, expr) {
12482
+ var parsed = $parse(expr);
12483
+ if (parsed.literal && parsed.constant) {
12484
+ return parsed;
12485
+ } else {
12486
+ return $parse(expr, function(value) {
12487
+ return sce.getTrusted(type, value);
12488
+ });
12489
+ }
12490
+ };
12491
+
12492
+
12493
+
12494
+
12495
+
12496
+
12497
+
12498
+
12499
+
12500
+
12501
+
12502
+
12503
+
12504
+
12505
+
12506
+
12507
+
12508
+ var parse = sce.parseAs,
12509
+ getTrusted = sce.getTrusted,
12510
+ trustAs = sce.trustAs;
12511
+
12512
+ forEach(SCE_CONTEXTS, function(enumValue, name) {
12513
+ var lName = lowercase(name);
12514
+ sce[snakeToCamel('parse_as_' + lName)] = function(expr) {
12515
+ return parse(enumValue, expr);
12516
+ };
12517
+ sce[snakeToCamel('get_trusted_' + lName)] = function(value) {
12518
+ return getTrusted(enumValue, value);
12519
+ };
12520
+ sce[snakeToCamel('trust_as_' + lName)] = function(value) {
12521
+ return trustAs(enumValue, value);
12522
+ };
12523
+ });
12524
+
12525
+ return sce;
12526
+ }];
12527
+ }
12528
+
12529
+
12530
+ function $SnifferProvider() {
12531
+ this.$get = ['$window', '$document', function($window, $document) {
12532
+ var eventSupport = {},
12533
+ isChromePackagedApp =
12534
+ $window.chrome &&
12535
+ ($window.chrome.app && $window.chrome.app.runtime ||
12536
+ !$window.chrome.app && $window.chrome.runtime && $window.chrome.runtime.id),
12537
+ hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState,
12538
+ android =
12539
+ toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
12540
+ boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
12541
+ document = $document[0] || {},
12542
+ bodyStyle = document.body && document.body.style,
12543
+ transitions = false,
12544
+ animations = false;
12545
+
12546
+ if (bodyStyle) {
12547
+ transitions = !!('transition' in bodyStyle || 'webkitTransition' in bodyStyle);
12548
+ animations = !!('animation' in bodyStyle || 'webkitAnimation' in bodyStyle);
12549
+ }
12550
+
12551
+
12552
+ return {
12553
+
12554
+ history: !!(hasHistoryPushState && !(android < 4) && !boxee),
12555
+ hasEvent: function(event) {
12556
+ if (event === 'input' && msie) return false;
12557
+
12558
+ if (isUndefined(eventSupport[event])) {
12559
+ var divElm = document.createElement('div');
12560
+ eventSupport[event] = 'on' + event in divElm;
12561
+ }
12562
+
12563
+ return eventSupport[event];
12564
+ },
12565
+ csp: csp(),
12566
+ transitions: transitions,
12567
+ animations: animations,
12568
+ android: android
12569
+ };
12570
+ }];
12571
+ }
12572
+
12573
+ var $templateRequestMinErr = minErr('$compile');
12574
+
12575
+ function $TemplateRequestProvider() {
12576
+
12577
+ var httpOptions;
12578
+
12579
+ this.httpOptions = function(val) {
12580
+ if (val) {
12581
+ httpOptions = val;
12582
+ return this;
12583
+ }
12584
+ return httpOptions;
12585
+ };
12586
+
12587
+ this.$get = ['$exceptionHandler', '$templateCache', '$http', '$q', '$sce',
12588
+ function($exceptionHandler, $templateCache, $http, $q, $sce) {
12589
+
12590
+ function handleRequestFn(tpl, ignoreRequestError) {
12591
+ handleRequestFn.totalPendingRequests++;
12592
+
12593
+ if (!isString(tpl) || isUndefined($templateCache.get(tpl))) {
12594
+ tpl = $sce.getTrustedResourceUrl(tpl);
12595
+ }
12596
+
12597
+ var transformResponse = $http.defaults && $http.defaults.transformResponse;
12598
+
12599
+ if (isArray(transformResponse)) {
12600
+ transformResponse = transformResponse.filter(function(transformer) {
12601
+ return transformer !== defaultHttpResponseTransform;
12602
+ });
12603
+ } else if (transformResponse === defaultHttpResponseTransform) {
12604
+ transformResponse = null;
12605
+ }
12606
+
12607
+ return $http.get(tpl, extend({
12608
+ cache: $templateCache,
12609
+ transformResponse: transformResponse
12610
+ }, httpOptions))
12611
+ .finally(function() {
12612
+ handleRequestFn.totalPendingRequests--;
12613
+ })
12614
+ .then(function(response) {
12615
+ $templateCache.put(tpl, response.data);
12616
+ return response.data;
12617
+ }, handleError);
12618
+
12619
+ function handleError(resp) {
12620
+ if (!ignoreRequestError) {
12621
+ resp = $templateRequestMinErr('tpload',
12622
+ 'Failed to load template: {0} (HTTP status: {1} {2})',
12623
+ tpl, resp.status, resp.statusText);
12624
+
12625
+ $exceptionHandler(resp);
12626
+ }
12627
+
12628
+ return $q.reject(resp);
12629
+ }
12630
+ }
12631
+
12632
+ handleRequestFn.totalPendingRequests = 0;
12633
+
12634
+ return handleRequestFn;
12635
+ }
12636
+ ];
12637
+ }
12638
+
12639
+ function $$TestabilityProvider() {
12640
+ this.$get = ['$rootScope', '$browser', '$location',
12641
+ function($rootScope, $browser, $location) {
12642
+
12643
+ var testability = {};
12644
+
12645
+ testability.findBindings = function(element, expression, opt_exactMatch) {
12646
+ var bindings = element.getElementsByClassName('ng-binding');
12647
+ var matches = [];
12648
+ forEach(bindings, function(binding) {
12649
+ var dataBinding = angular.element(binding).data('$binding');
12650
+ if (dataBinding) {
12651
+ forEach(dataBinding, function(bindingName) {
12652
+ if (opt_exactMatch) {
12653
+ var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)');
12654
+ if (matcher.test(bindingName)) {
12655
+ matches.push(binding);
12656
+ }
12657
+ } else {
12658
+ if (bindingName.indexOf(expression) !== -1) {
12659
+ matches.push(binding);
12660
+ }
12661
+ }
12662
+ });
12663
+ }
12664
+ });
12665
+ return matches;
12666
+ };
12667
+
12668
+ testability.findModels = function(element, expression, opt_exactMatch) {
12669
+ var prefixes = ['ng-', 'data-ng-', 'ng\\:'];
12670
+ for (var p = 0; p < prefixes.length; ++p) {
12671
+ var attributeEquals = opt_exactMatch ? '=' : '*=';
12672
+ var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]';
12673
+ var elements = element.querySelectorAll(selector);
12674
+ if (elements.length) {
12675
+ return elements;
12676
+ }
12677
+ }
12678
+ };
12679
+
12680
+ testability.getLocation = function() {
12681
+ return $location.url();
12682
+ };
12683
+
12684
+ testability.setLocation = function(url) {
12685
+ if (url !== $location.url()) {
12686
+ $location.url(url);
12687
+ $rootScope.$digest();
12688
+ }
12689
+ };
12690
+
12691
+ testability.whenStable = function(callback) {
12692
+ $browser.notifyWhenNoOutstandingRequests(callback);
12693
+ };
12694
+
12695
+ return testability;
12696
+ }];
12697
+ }
12698
+
12699
+ function $TimeoutProvider() {
12700
+ this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',
12701
+ function($rootScope, $browser, $q, $$q, $exceptionHandler) {
12702
+
12703
+ var deferreds = {};
12704
+
12705
+
12706
+ function timeout(fn, delay, invokeApply) {
12707
+ if (!isFunction(fn)) {
12708
+ invokeApply = delay;
12709
+ delay = fn;
12710
+ fn = noop;
12711
+ }
12712
+
12713
+ var args = sliceArgs(arguments, 3),
12714
+ skipApply = (isDefined(invokeApply) && !invokeApply),
12715
+ deferred = (skipApply ? $$q : $q).defer(),
12716
+ promise = deferred.promise,
12717
+ timeoutId;
12718
+
12719
+ timeoutId = $browser.defer(function() {
12720
+ try {
12721
+ deferred.resolve(fn.apply(null, args));
12722
+ } catch (e) {
12723
+ deferred.reject(e);
12724
+ $exceptionHandler(e);
12725
+ } finally {
12726
+ delete deferreds[promise.$$timeoutId];
12727
+ }
12728
+
12729
+ if (!skipApply) $rootScope.$apply();
12730
+ }, delay);
12731
+
12732
+ promise.$$timeoutId = timeoutId;
12733
+ deferreds[timeoutId] = deferred;
12734
+
12735
+ return promise;
12736
+ }
12737
+
12738
+
12739
+ timeout.cancel = function(promise) {
12740
+ if (promise && promise.$$timeoutId in deferreds) {
12741
+ deferreds[promise.$$timeoutId].promise.catch(noop);
12742
+ deferreds[promise.$$timeoutId].reject('canceled');
12743
+ delete deferreds[promise.$$timeoutId];
12744
+ return $browser.defer.cancel(promise.$$timeoutId);
12745
+ }
12746
+ return false;
12747
+ };
12748
+
12749
+ return timeout;
12750
+ }];
12751
+ }
12752
+
12753
+ var urlParsingNode = window.document.createElement('a');
12754
+ var originUrl = urlResolve(window.location.href);
12755
+
12756
+
12757
+ function urlResolve(url) {
12758
+ var href = url;
12759
+
12760
+ if (msie) {
12761
+ urlParsingNode.setAttribute('href', href);
12762
+ href = urlParsingNode.href;
12763
+ }
12764
+
12765
+ urlParsingNode.setAttribute('href', href);
12766
+
12767
+ return {
12768
+ href: urlParsingNode.href,
12769
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
12770
+ host: urlParsingNode.host,
12771
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
12772
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
12773
+ hostname: urlParsingNode.hostname,
12774
+ port: urlParsingNode.port,
12775
+ pathname: (urlParsingNode.pathname.charAt(0) === '/')
12776
+ ? urlParsingNode.pathname
12777
+ : '/' + urlParsingNode.pathname
12778
+ };
12779
+ }
12780
+
12781
+ function urlIsSameOrigin(requestUrl) {
12782
+ var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
12783
+ return (parsed.protocol === originUrl.protocol &&
12784
+ parsed.host === originUrl.host);
12785
+ }
12786
+
12787
+ function $WindowProvider() {
12788
+ this.$get = valueFn(window);
12789
+ }
12790
+
12791
+ function $$CookieReader($document) {
12792
+ var rawDocument = $document[0] || {};
12793
+ var lastCookies = {};
12794
+ var lastCookieString = '';
12795
+
12796
+ function safeGetCookie(rawDocument) {
12797
+ try {
12798
+ return rawDocument.cookie || '';
12799
+ } catch (e) {
12800
+ return '';
12801
+ }
12802
+ }
12803
+
12804
+ function safeDecodeURIComponent(str) {
12805
+ try {
12806
+ return decodeURIComponent(str);
12807
+ } catch (e) {
12808
+ return str;
12809
+ }
12810
+ }
12811
+
12812
+ return function() {
12813
+ var cookieArray, cookie, i, index, name;
12814
+ var currentCookieString = safeGetCookie(rawDocument);
12815
+
12816
+ if (currentCookieString !== lastCookieString) {
12817
+ lastCookieString = currentCookieString;
12818
+ cookieArray = lastCookieString.split('; ');
12819
+ lastCookies = {};
12820
+
12821
+ for (i = 0; i < cookieArray.length; i++) {
12822
+ cookie = cookieArray[i];
12823
+ index = cookie.indexOf('=');
12824
+ if (index > 0) {
12825
+ name = safeDecodeURIComponent(cookie.substring(0, index));
12826
+ if (isUndefined(lastCookies[name])) {
12827
+ lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));
12828
+ }
12829
+ }
12830
+ }
12831
+ }
12832
+ return lastCookies;
12833
+ };
12834
+ }
12835
+
12836
+ $$CookieReader.$inject = ['$document'];
12837
+
12838
+ function $$CookieReaderProvider() {
12839
+ this.$get = $$CookieReader;
12840
+ }
12841
+
12842
+
12843
+
12844
+ $FilterProvider.$inject = ['$provide'];
12845
+ function $FilterProvider($provide) {
12846
+ var suffix = 'Filter';
12847
+
12848
+ function register(name, factory) {
12849
+ if (isObject(name)) {
12850
+ var filters = {};
12851
+ forEach(name, function(filter, key) {
12852
+ filters[key] = register(key, filter);
12853
+ });
12854
+ return filters;
12855
+ } else {
12856
+ return $provide.factory(name + suffix, factory);
12857
+ }
12858
+ }
12859
+ this.register = register;
12860
+
12861
+ this.$get = ['$injector', function($injector) {
12862
+ return function(name) {
12863
+ return $injector.get(name + suffix);
12864
+ };
12865
+ }];
12866
+
12867
+
12868
+
12869
+ register('currency', currencyFilter);
12870
+ register('date', dateFilter);
12871
+ register('filter', filterFilter);
12872
+ register('json', jsonFilter);
12873
+ register('limitTo', limitToFilter);
12874
+ register('lowercase', lowercaseFilter);
12875
+ register('number', numberFilter);
12876
+ register('orderBy', orderByFilter);
12877
+ register('uppercase', uppercaseFilter);
12878
+ }
12879
+
12880
+
12881
+ function filterFilter() {
12882
+ return function(array, expression, comparator, anyPropertyKey) {
12883
+ if (!isArrayLike(array)) {
12884
+ if (array == null) {
12885
+ return array;
12886
+ } else {
12887
+ throw minErr('filter')('notarray', 'Expected array but received: {0}', array);
12888
+ }
12889
+ }
12890
+
12891
+ anyPropertyKey = anyPropertyKey || '$';
12892
+ var expressionType = getTypeForFilter(expression);
12893
+ var predicateFn;
12894
+ var matchAgainstAnyProp;
12895
+
12896
+ switch (expressionType) {
12897
+ case 'function':
12898
+ predicateFn = expression;
12899
+ break;
12900
+ case 'boolean':
12901
+ case 'null':
12902
+ case 'number':
12903
+ case 'string':
12904
+ matchAgainstAnyProp = true;
12905
+ case 'object':
12906
+ predicateFn = createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp);
12907
+ break;
12908
+ default:
12909
+ return array;
12910
+ }
12911
+
12912
+ return Array.prototype.filter.call(array, predicateFn);
12913
+ };
12914
+ }
12915
+
12916
+ function createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp) {
12917
+ var shouldMatchPrimitives = isObject(expression) && (anyPropertyKey in expression);
12918
+ var predicateFn;
12919
+
12920
+ if (comparator === true) {
12921
+ comparator = equals;
12922
+ } else if (!isFunction(comparator)) {
12923
+ comparator = function(actual, expected) {
12924
+ if (isUndefined(actual)) {
12925
+ return false;
12926
+ }
12927
+ if ((actual === null) || (expected === null)) {
12928
+ return actual === expected;
12929
+ }
12930
+ if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {
12931
+ return false;
12932
+ }
12933
+
12934
+ actual = lowercase('' + actual);
12935
+ expected = lowercase('' + expected);
12936
+ return actual.indexOf(expected) !== -1;
12937
+ };
12938
+ }
12939
+
12940
+ predicateFn = function(item) {
12941
+ if (shouldMatchPrimitives && !isObject(item)) {
12942
+ return deepCompare(item, expression[anyPropertyKey], comparator, anyPropertyKey, false);
12943
+ }
12944
+ return deepCompare(item, expression, comparator, anyPropertyKey, matchAgainstAnyProp);
12945
+ };
12946
+
12947
+ return predicateFn;
12948
+ }
12949
+
12950
+ function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstAnyProp, dontMatchWholeObject) {
12951
+ var actualType = getTypeForFilter(actual);
12952
+ var expectedType = getTypeForFilter(expected);
12953
+
12954
+ if ((expectedType === 'string') && (expected.charAt(0) === '!')) {
12955
+ return !deepCompare(actual, expected.substring(1), comparator, anyPropertyKey, matchAgainstAnyProp);
12956
+ } else if (isArray(actual)) {
12957
+ return actual.some(function(item) {
12958
+ return deepCompare(item, expected, comparator, anyPropertyKey, matchAgainstAnyProp);
12959
+ });
12960
+ }
12961
+
12962
+ switch (actualType) {
12963
+ case 'object':
12964
+ var key;
12965
+ if (matchAgainstAnyProp) {
12966
+ for (key in actual) {
12967
+ if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) {
12968
+ return true;
12969
+ }
12970
+ }
12971
+ return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, anyPropertyKey, false);
12972
+ } else if (expectedType === 'object') {
12973
+ for (key in expected) {
12974
+ var expectedVal = expected[key];
12975
+ if (isFunction(expectedVal) || isUndefined(expectedVal)) {
12976
+ continue;
12977
+ }
12978
+
12979
+ var matchAnyProperty = key === anyPropertyKey;
12980
+ var actualVal = matchAnyProperty ? actual : actual[key];
12981
+ if (!deepCompare(actualVal, expectedVal, comparator, anyPropertyKey, matchAnyProperty, matchAnyProperty)) {
12982
+ return false;
12983
+ }
12984
+ }
12985
+ return true;
12986
+ } else {
12987
+ return comparator(actual, expected);
12988
+ }
12989
+ case 'function':
12990
+ return false;
12991
+ default:
12992
+ return comparator(actual, expected);
12993
+ }
12994
+ }
12995
+
12996
+ function getTypeForFilter(val) {
12997
+ return (val === null) ? 'null' : typeof val;
12998
+ }
12999
+
13000
+ var MAX_DIGITS = 22;
13001
+ var DECIMAL_SEP = '.';
13002
+ var ZERO_CHAR = '0';
13003
+
13004
+ currencyFilter.$inject = ['$locale'];
13005
+ function currencyFilter($locale) {
13006
+ var formats = $locale.NUMBER_FORMATS;
13007
+ return function(amount, currencySymbol, fractionSize) {
13008
+ if (isUndefined(currencySymbol)) {
13009
+ currencySymbol = formats.CURRENCY_SYM;
13010
+ }
13011
+
13012
+ if (isUndefined(fractionSize)) {
13013
+ fractionSize = formats.PATTERNS[1].maxFrac;
13014
+ }
13015
+
13016
+ return (amount == null)
13017
+ ? amount
13018
+ : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).
13019
+ replace(/\u00A4/g, currencySymbol);
13020
+ };
13021
+ }
13022
+
13023
+ numberFilter.$inject = ['$locale'];
13024
+ function numberFilter($locale) {
13025
+ var formats = $locale.NUMBER_FORMATS;
13026
+ return function(number, fractionSize) {
13027
+
13028
+ return (number == null)
13029
+ ? number
13030
+ : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
13031
+ fractionSize);
13032
+ };
13033
+ }
13034
+
13035
+ function parse(numStr) {
13036
+ var exponent = 0, digits, numberOfIntegerDigits;
13037
+ var i, j, zeros;
13038
+
13039
+ if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {
13040
+ numStr = numStr.replace(DECIMAL_SEP, '');
13041
+ }
13042
+
13043
+ if ((i = numStr.search(/e/i)) > 0) {
13044
+ if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i;
13045
+ numberOfIntegerDigits += +numStr.slice(i + 1);
13046
+ numStr = numStr.substring(0, i);
13047
+ } else if (numberOfIntegerDigits < 0) {
13048
+ numberOfIntegerDigits = numStr.length;
13049
+ }
13050
+
13051
+ for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { }
13052
+
13053
+ if (i === (zeros = numStr.length)) {
13054
+ digits = [0];
13055
+ numberOfIntegerDigits = 1;
13056
+ } else {
13057
+ zeros--;
13058
+ while (numStr.charAt(zeros) === ZERO_CHAR) zeros--;
13059
+
13060
+ numberOfIntegerDigits -= i;
13061
+ digits = [];
13062
+ for (j = 0; i <= zeros; i++, j++) {
13063
+ digits[j] = +numStr.charAt(i);
13064
+ }
13065
+ }
13066
+
13067
+ if (numberOfIntegerDigits > MAX_DIGITS) {
13068
+ digits = digits.splice(0, MAX_DIGITS - 1);
13069
+ exponent = numberOfIntegerDigits - 1;
13070
+ numberOfIntegerDigits = 1;
13071
+ }
13072
+
13073
+ return { d: digits, e: exponent, i: numberOfIntegerDigits };
13074
+ }
13075
+
13076
+ function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {
13077
+ var digits = parsedNumber.d;
13078
+ var fractionLen = digits.length - parsedNumber.i;
13079
+
13080
+ fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize;
13081
+
13082
+ var roundAt = fractionSize + parsedNumber.i;
13083
+ var digit = digits[roundAt];
13084
+
13085
+ if (roundAt > 0) {
13086
+ digits.splice(Math.max(parsedNumber.i, roundAt));
13087
+
13088
+ for (var j = roundAt; j < digits.length; j++) {
13089
+ digits[j] = 0;
13090
+ }
13091
+ } else {
13092
+ fractionLen = Math.max(0, fractionLen);
13093
+ parsedNumber.i = 1;
13094
+ digits.length = Math.max(1, roundAt = fractionSize + 1);
13095
+ digits[0] = 0;
13096
+ for (var i = 1; i < roundAt; i++) digits[i] = 0;
13097
+ }
13098
+
13099
+ if (digit >= 5) {
13100
+ if (roundAt - 1 < 0) {
13101
+ for (var k = 0; k > roundAt; k--) {
13102
+ digits.unshift(0);
13103
+ parsedNumber.i++;
13104
+ }
13105
+ digits.unshift(1);
13106
+ parsedNumber.i++;
13107
+ } else {
13108
+ digits[roundAt - 1]++;
13109
+ }
13110
+ }
13111
+
13112
+ for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);
13113
+
13114
+
13115
+ var carry = digits.reduceRight(function(carry, d, i, digits) {
13116
+ d = d + carry;
13117
+ digits[i] = d % 10;
13118
+ return Math.floor(d / 10);
13119
+ }, 0);
13120
+ if (carry) {
13121
+ digits.unshift(carry);
13122
+ parsedNumber.i++;
13123
+ }
13124
+ }
13125
+
13126
+ function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
13127
+
13128
+ if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';
13129
+
13130
+ var isInfinity = !isFinite(number);
13131
+ var isZero = false;
13132
+ var numStr = Math.abs(number) + '',
13133
+ formattedText = '',
13134
+ parsedNumber;
13135
+
13136
+ if (isInfinity) {
13137
+ formattedText = '\u221e';
13138
+ } else {
13139
+ parsedNumber = parse(numStr);
13140
+
13141
+ roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac);
13142
+
13143
+ var digits = parsedNumber.d;
13144
+ var integerLen = parsedNumber.i;
13145
+ var exponent = parsedNumber.e;
13146
+ var decimals = [];
13147
+ isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true);
13148
+
13149
+ while (integerLen < 0) {
13150
+ digits.unshift(0);
13151
+ integerLen++;
13152
+ }
13153
+
13154
+ if (integerLen > 0) {
13155
+ decimals = digits.splice(integerLen, digits.length);
13156
+ } else {
13157
+ decimals = digits;
13158
+ digits = [0];
13159
+ }
13160
+
13161
+ var groups = [];
13162
+ if (digits.length >= pattern.lgSize) {
13163
+ groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
13164
+ }
13165
+ while (digits.length > pattern.gSize) {
13166
+ groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
13167
+ }
13168
+ if (digits.length) {
13169
+ groups.unshift(digits.join(''));
13170
+ }
13171
+ formattedText = groups.join(groupSep);
13172
+
13173
+ if (decimals.length) {
13174
+ formattedText += decimalSep + decimals.join('');
13175
+ }
13176
+
13177
+ if (exponent) {
13178
+ formattedText += 'e+' + exponent;
13179
+ }
13180
+ }
13181
+ if (number < 0 && !isZero) {
13182
+ return pattern.negPre + formattedText + pattern.negSuf;
13183
+ } else {
13184
+ return pattern.posPre + formattedText + pattern.posSuf;
13185
+ }
13186
+ }
13187
+
13188
+ function padNumber(num, digits, trim, negWrap) {
13189
+ var neg = '';
13190
+ if (num < 0 || (negWrap && num <= 0)) {
13191
+ if (negWrap) {
13192
+ num = -num + 1;
13193
+ } else {
13194
+ num = -num;
13195
+ neg = '-';
13196
+ }
13197
+ }
13198
+ num = '' + num;
13199
+ while (num.length < digits) num = ZERO_CHAR + num;
13200
+ if (trim) {
13201
+ num = num.substr(num.length - digits);
13202
+ }
13203
+ return neg + num;
13204
+ }
13205
+
13206
+
13207
+ function dateGetter(name, size, offset, trim, negWrap) {
13208
+ offset = offset || 0;
13209
+ return function(date) {
13210
+ var value = date['get' + name]();
13211
+ if (offset > 0 || value > -offset) {
13212
+ value += offset;
13213
+ }
13214
+ if (value === 0 && offset === -12) value = 12;
13215
+ return padNumber(value, size, trim, negWrap);
13216
+ };
13217
+ }
13218
+
13219
+ function dateStrGetter(name, shortForm, standAlone) {
13220
+ return function(date, formats) {
13221
+ var value = date['get' + name]();
13222
+ var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : '');
13223
+ var get = uppercase(propPrefix + name);
13224
+
13225
+ return formats[get][value];
13226
+ };
13227
+ }
13228
+
13229
+ function timeZoneGetter(date, formats, offset) {
13230
+ var zone = -1 * offset;
13231
+ var paddedZone = (zone >= 0) ? '+' : '';
13232
+
13233
+ paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
13234
+ padNumber(Math.abs(zone % 60), 2);
13235
+
13236
+ return paddedZone;
13237
+ }
13238
+
13239
+ function getFirstThursdayOfYear(year) {
13240
+ var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();
13241
+ return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);
13242
+ }
13243
+
13244
+ function getThursdayThisWeek(datetime) {
13245
+ return new Date(datetime.getFullYear(), datetime.getMonth(),
13246
+ datetime.getDate() + (4 - datetime.getDay()));
13247
+ }
13248
+
13249
+ function weekGetter(size) {
13250
+ return function(date) {
13251
+ var firstThurs = getFirstThursdayOfYear(date.getFullYear()),
13252
+ thisThurs = getThursdayThisWeek(date);
13253
+
13254
+ var diff = +thisThurs - +firstThurs,
13255
+ result = 1 + Math.round(diff / 6.048e8);
13256
+
13257
+ return padNumber(result, size);
13258
+ };
13259
+ }
13260
+
13261
+ function ampmGetter(date, formats) {
13262
+ return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
13263
+ }
13264
+
13265
+ function eraGetter(date, formats) {
13266
+ return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];
13267
+ }
13268
+
13269
+ function longEraGetter(date, formats) {
13270
+ return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];
13271
+ }
13272
+
13273
+ var DATE_FORMATS = {
13274
+ yyyy: dateGetter('FullYear', 4, 0, false, true),
13275
+ yy: dateGetter('FullYear', 2, 0, true, true),
13276
+ y: dateGetter('FullYear', 1, 0, false, true),
13277
+ MMMM: dateStrGetter('Month'),
13278
+ MMM: dateStrGetter('Month', true),
13279
+ MM: dateGetter('Month', 2, 1),
13280
+ M: dateGetter('Month', 1, 1),
13281
+ LLLL: dateStrGetter('Month', false, true),
13282
+ dd: dateGetter('Date', 2),
13283
+ d: dateGetter('Date', 1),
13284
+ HH: dateGetter('Hours', 2),
13285
+ H: dateGetter('Hours', 1),
13286
+ hh: dateGetter('Hours', 2, -12),
13287
+ h: dateGetter('Hours', 1, -12),
13288
+ mm: dateGetter('Minutes', 2),
13289
+ m: dateGetter('Minutes', 1),
13290
+ ss: dateGetter('Seconds', 2),
13291
+ s: dateGetter('Seconds', 1),
13292
+ sss: dateGetter('Milliseconds', 3),
13293
+ EEEE: dateStrGetter('Day'),
13294
+ EEE: dateStrGetter('Day', true),
13295
+ a: ampmGetter,
13296
+ Z: timeZoneGetter,
13297
+ ww: weekGetter(2),
13298
+ w: weekGetter(1),
13299
+ G: eraGetter,
13300
+ GG: eraGetter,
13301
+ GGG: eraGetter,
13302
+ GGGG: longEraGetter
13303
+ };
13304
+
13305
+ var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
13306
+ NUMBER_STRING = /^-?\d+$/;
13307
+
13308
+ dateFilter.$inject = ['$locale'];
13309
+ function dateFilter($locale) {
13310
+
13311
+
13312
+ var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
13313
+ function jsonStringToDate(string) {
13314
+ var match;
13315
+ if ((match = string.match(R_ISO8601_STR))) {
13316
+ var date = new Date(0),
13317
+ tzHour = 0,
13318
+ tzMin = 0,
13319
+ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,
13320
+ timeSetter = match[8] ? date.setUTCHours : date.setHours;
13321
+
13322
+ if (match[9]) {
13323
+ tzHour = toInt(match[9] + match[10]);
13324
+ tzMin = toInt(match[9] + match[11]);
13325
+ }
13326
+ dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));
13327
+ var h = toInt(match[4] || 0) - tzHour;
13328
+ var m = toInt(match[5] || 0) - tzMin;
13329
+ var s = toInt(match[6] || 0);
13330
+ var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
13331
+ timeSetter.call(date, h, m, s, ms);
13332
+ return date;
13333
+ }
13334
+ return string;
13335
+ }
13336
+
13337
+
13338
+ return function(date, format, timezone) {
13339
+ var text = '',
13340
+ parts = [],
13341
+ fn, match;
13342
+
13343
+ format = format || 'mediumDate';
13344
+ format = $locale.DATETIME_FORMATS[format] || format;
13345
+ if (isString(date)) {
13346
+ date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);
13347
+ }
13348
+
13349
+ if (isNumber(date)) {
13350
+ date = new Date(date);
13351
+ }
13352
+
13353
+ if (!isDate(date) || !isFinite(date.getTime())) {
13354
+ return date;
13355
+ }
13356
+
13357
+ while (format) {
13358
+ match = DATE_FORMATS_SPLIT.exec(format);
13359
+ if (match) {
13360
+ parts = concat(parts, match, 1);
13361
+ format = parts.pop();
13362
+ } else {
13363
+ parts.push(format);
13364
+ format = null;
13365
+ }
13366
+ }
13367
+
13368
+ var dateTimezoneOffset = date.getTimezoneOffset();
13369
+ if (timezone) {
13370
+ dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
13371
+ date = convertTimezoneToLocal(date, timezone, true);
13372
+ }
13373
+ forEach(parts, function(value) {
13374
+ fn = DATE_FORMATS[value];
13375
+ text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)
13376
+ : value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
13377
+ });
13378
+
13379
+ return text;
13380
+ };
13381
+ }
13382
+
13383
+
13384
+ function jsonFilter() {
13385
+ return function(object, spacing) {
13386
+ if (isUndefined(spacing)) {
13387
+ spacing = 2;
13388
+ }
13389
+ return toJson(object, spacing);
13390
+ };
13391
+ }
13392
+
13393
+
13394
+ var lowercaseFilter = valueFn(lowercase);
13395
+
13396
+
13397
+ var uppercaseFilter = valueFn(uppercase);
13398
+
13399
+ function limitToFilter() {
13400
+ return function(input, limit, begin) {
13401
+ if (Math.abs(Number(limit)) === Infinity) {
13402
+ limit = Number(limit);
13403
+ } else {
13404
+ limit = toInt(limit);
13405
+ }
13406
+ if (isNumberNaN(limit)) return input;
13407
+
13408
+ if (isNumber(input)) input = input.toString();
13409
+ if (!isArrayLike(input)) return input;
13410
+
13411
+ begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);
13412
+ begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;
13413
+
13414
+ if (limit >= 0) {
13415
+ return sliceFn(input, begin, begin + limit);
13416
+ } else {
13417
+ if (begin === 0) {
13418
+ return sliceFn(input, limit, input.length);
13419
+ } else {
13420
+ return sliceFn(input, Math.max(0, begin + limit), begin);
13421
+ }
13422
+ }
13423
+ };
13424
+ }
13425
+
13426
+ function sliceFn(input, begin, end) {
13427
+ if (isString(input)) return input.slice(begin, end);
13428
+
13429
+ return slice.call(input, begin, end);
13430
+ }
13431
+
13432
+ orderByFilter.$inject = ['$parse'];
13433
+ function orderByFilter($parse) {
13434
+ return function(array, sortPredicate, reverseOrder, compareFn) {
13435
+
13436
+ if (array == null) return array;
13437
+ if (!isArrayLike(array)) {
13438
+ throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array);
13439
+ }
13440
+
13441
+ if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }
13442
+ if (sortPredicate.length === 0) { sortPredicate = ['+']; }
13443
+
13444
+ var predicates = processPredicates(sortPredicate);
13445
+
13446
+ var descending = reverseOrder ? -1 : 1;
13447
+
13448
+ var compare = isFunction(compareFn) ? compareFn : defaultCompare;
13449
+
13450
+ var compareValues = Array.prototype.map.call(array, getComparisonObject);
13451
+ compareValues.sort(doComparison);
13452
+ array = compareValues.map(function(item) { return item.value; });
13453
+
13454
+ return array;
13455
+
13456
+ function getComparisonObject(value, index) {
13457
+ return {
13458
+ value: value,
13459
+ tieBreaker: {value: index, type: 'number', index: index},
13460
+ predicateValues: predicates.map(function(predicate) {
13461
+ return getPredicateValue(predicate.get(value), index);
13462
+ })
13463
+ };
13464
+ }
13465
+
13466
+ function doComparison(v1, v2) {
13467
+ for (var i = 0, ii = predicates.length; i < ii; i++) {
13468
+ var result = compare(v1.predicateValues[i], v2.predicateValues[i]);
13469
+ if (result) {
13470
+ return result * predicates[i].descending * descending;
13471
+ }
13472
+ }
13473
+
13474
+ return compare(v1.tieBreaker, v2.tieBreaker) * descending;
13475
+ }
13476
+ };
13477
+
13478
+ function processPredicates(sortPredicates) {
13479
+ return sortPredicates.map(function(predicate) {
13480
+ var descending = 1, get = identity;
13481
+
13482
+ if (isFunction(predicate)) {
13483
+ get = predicate;
13484
+ } else if (isString(predicate)) {
13485
+ if ((predicate.charAt(0) === '+' || predicate.charAt(0) === '-')) {
13486
+ descending = predicate.charAt(0) === '-' ? -1 : 1;
13487
+ predicate = predicate.substring(1);
13488
+ }
13489
+ if (predicate !== '') {
13490
+ get = $parse(predicate);
13491
+ if (get.constant) {
13492
+ var key = get();
13493
+ get = function(value) { return value[key]; };
13494
+ }
13495
+ }
13496
+ }
13497
+ return {get: get, descending: descending};
13498
+ });
13499
+ }
13500
+
13501
+ function isPrimitive(value) {
13502
+ switch (typeof value) {
13503
+ case 'number':
13504
+ case 'boolean':
13505
+ case 'string':
13506
+ return true;
13507
+ default:
13508
+ return false;
13509
+ }
13510
+ }
13511
+
13512
+ function objectValue(value) {
13513
+ if (isFunction(value.valueOf)) {
13514
+ value = value.valueOf();
13515
+ if (isPrimitive(value)) return value;
13516
+ }
13517
+ if (hasCustomToString(value)) {
13518
+ value = value.toString();
13519
+ if (isPrimitive(value)) return value;
13520
+ }
13521
+
13522
+ return value;
13523
+ }
13524
+
13525
+ function getPredicateValue(value, index) {
13526
+ var type = typeof value;
13527
+ if (value === null) {
13528
+ type = 'string';
13529
+ value = 'null';
13530
+ } else if (type === 'object') {
13531
+ value = objectValue(value);
13532
+ }
13533
+ return {value: value, type: type, index: index};
13534
+ }
13535
+
13536
+ function defaultCompare(v1, v2) {
13537
+ var result = 0;
13538
+ var type1 = v1.type;
13539
+ var type2 = v2.type;
13540
+
13541
+ if (type1 === type2) {
13542
+ var value1 = v1.value;
13543
+ var value2 = v2.value;
13544
+
13545
+ if (type1 === 'string') {
13546
+ value1 = value1.toLowerCase();
13547
+ value2 = value2.toLowerCase();
13548
+ } else if (type1 === 'object') {
13549
+ if (isObject(value1)) value1 = v1.index;
13550
+ if (isObject(value2)) value2 = v2.index;
13551
+ }
13552
+
13553
+ if (value1 !== value2) {
13554
+ result = value1 < value2 ? -1 : 1;
13555
+ }
13556
+ } else {
13557
+ result = type1 < type2 ? -1 : 1;
13558
+ }
13559
+
13560
+ return result;
13561
+ }
13562
+ }
13563
+
13564
+ function ngDirective(directive) {
13565
+ if (isFunction(directive)) {
13566
+ directive = {
13567
+ link: directive
13568
+ };
13569
+ }
13570
+ directive.restrict = directive.restrict || 'AC';
13571
+ return valueFn(directive);
13572
+ }
13573
+
13574
+ var htmlAnchorDirective = valueFn({
13575
+ restrict: 'E',
13576
+ compile: function(element, attr) {
13577
+ if (!attr.href && !attr.xlinkHref) {
13578
+ return function(scope, element) {
13579
+ if (element[0].nodeName.toLowerCase() !== 'a') return;
13580
+
13581
+ var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
13582
+ 'xlink:href' : 'href';
13583
+ element.on('click', function(event) {
13584
+ if (!element.attr(href)) {
13585
+ event.preventDefault();
13586
+ }
13587
+ });
13588
+ };
13589
+ }
13590
+ }
13591
+ });
13592
+
13593
+
13594
+
13595
+
13596
+
13597
+
13598
+
13599
+
13600
+
13601
+
13602
+
13603
+
13604
+ var ngAttributeAliasDirectives = {};
13605
+
13606
+ forEach(BOOLEAN_ATTR, function(propName, attrName) {
13607
+ if (propName === 'multiple') return;
13608
+
13609
+ function defaultLinkFn(scope, element, attr) {
13610
+ scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
13611
+ attr.$set(attrName, !!value);
13612
+ });
13613
+ }
13614
+
13615
+ var normalized = directiveNormalize('ng-' + attrName);
13616
+ var linkFn = defaultLinkFn;
13617
+
13618
+ if (propName === 'checked') {
13619
+ linkFn = function(scope, element, attr) {
13620
+ if (attr.ngModel !== attr[normalized]) {
13621
+ defaultLinkFn(scope, element, attr);
13622
+ }
13623
+ };
13624
+ }
13625
+
13626
+ ngAttributeAliasDirectives[normalized] = function() {
13627
+ return {
13628
+ restrict: 'A',
13629
+ priority: 100,
13630
+ link: linkFn
13631
+ };
13632
+ };
13633
+ });
13634
+
13635
+ forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {
13636
+ ngAttributeAliasDirectives[ngAttr] = function() {
13637
+ return {
13638
+ priority: 100,
13639
+ link: function(scope, element, attr) {
13640
+ if (ngAttr === 'ngPattern' && attr.ngPattern.charAt(0) === '/') {
13641
+ var match = attr.ngPattern.match(REGEX_STRING_REGEXP);
13642
+ if (match) {
13643
+ attr.$set('ngPattern', new RegExp(match[1], match[2]));
13644
+ return;
13645
+ }
13646
+ }
13647
+
13648
+ scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {
13649
+ attr.$set(ngAttr, value);
13650
+ });
13651
+ }
13652
+ };
13653
+ };
13654
+ });
13655
+
13656
+ forEach(['src', 'srcset', 'href'], function(attrName) {
13657
+ var normalized = directiveNormalize('ng-' + attrName);
13658
+ ngAttributeAliasDirectives[normalized] = function() {
13659
+ return {
13660
+ priority: 99,
13661
+ link: function(scope, element, attr) {
13662
+ var propName = attrName,
13663
+ name = attrName;
13664
+
13665
+ if (attrName === 'href' &&
13666
+ toString.call(element.prop('href')) === '[object SVGAnimatedString]') {
13667
+ name = 'xlinkHref';
13668
+ attr.$attr[name] = 'xlink:href';
13669
+ propName = null;
13670
+ }
13671
+
13672
+ attr.$observe(normalized, function(value) {
13673
+ if (!value) {
13674
+ if (attrName === 'href') {
13675
+ attr.$set(name, null);
13676
+ }
13677
+ return;
13678
+ }
13679
+
13680
+ attr.$set(name, value);
13681
+
13682
+ if (msie && propName) element.prop(propName, attr[name]);
13683
+ });
13684
+ }
13685
+ };
13686
+ };
13687
+ });
13688
+
13689
+ var nullFormCtrl = {
13690
+ $addControl: noop,
13691
+ $$renameControl: nullFormRenameControl,
13692
+ $removeControl: noop,
13693
+ $setValidity: noop,
13694
+ $setDirty: noop,
13695
+ $setPristine: noop,
13696
+ $setSubmitted: noop
13697
+ },
13698
+ PENDING_CLASS = 'ng-pending',
13699
+ SUBMITTED_CLASS = 'ng-submitted';
13700
+
13701
+ function nullFormRenameControl(control, name) {
13702
+ control.$name = name;
13703
+ }
13704
+
13705
+ FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];
13706
+ function FormController($element, $attrs, $scope, $animate, $interpolate) {
13707
+ this.$$controls = [];
13708
+
13709
+ this.$error = {};
13710
+ this.$$success = {};
13711
+ this.$pending = undefined;
13712
+ this.$name = $interpolate($attrs.name || $attrs.ngForm || '')($scope);
13713
+ this.$dirty = false;
13714
+ this.$pristine = true;
13715
+ this.$valid = true;
13716
+ this.$invalid = false;
13717
+ this.$submitted = false;
13718
+ this.$$parentForm = nullFormCtrl;
13719
+
13720
+ this.$$element = $element;
13721
+ this.$$animate = $animate;
13722
+
13723
+ setupValidity(this);
13724
+ }
13725
+
13726
+ FormController.prototype = {
13727
+ $rollbackViewValue: function() {
13728
+ forEach(this.$$controls, function(control) {
13729
+ control.$rollbackViewValue();
13730
+ });
13731
+ },
13732
+
13733
+ $commitViewValue: function() {
13734
+ forEach(this.$$controls, function(control) {
13735
+ control.$commitViewValue();
13736
+ });
13737
+ },
13738
+
13739
+ $addControl: function(control) {
13740
+ assertNotHasOwnProperty(control.$name, 'input');
13741
+ this.$$controls.push(control);
13742
+
13743
+ if (control.$name) {
13744
+ this[control.$name] = control;
13745
+ }
13746
+
13747
+ control.$$parentForm = this;
13748
+ },
13749
+
13750
+ $$renameControl: function(control, newName) {
13751
+ var oldName = control.$name;
13752
+
13753
+ if (this[oldName] === control) {
13754
+ delete this[oldName];
13755
+ }
13756
+ this[newName] = control;
13757
+ control.$name = newName;
13758
+ },
13759
+
13760
+ $removeControl: function(control) {
13761
+ if (control.$name && this[control.$name] === control) {
13762
+ delete this[control.$name];
13763
+ }
13764
+ forEach(this.$pending, function(value, name) {
13765
+ this.$setValidity(name, null, control);
13766
+ }, this);
13767
+ forEach(this.$error, function(value, name) {
13768
+ this.$setValidity(name, null, control);
13769
+ }, this);
13770
+ forEach(this.$$success, function(value, name) {
13771
+ this.$setValidity(name, null, control);
13772
+ }, this);
13773
+
13774
+ arrayRemove(this.$$controls, control);
13775
+ control.$$parentForm = nullFormCtrl;
13776
+ },
13777
+
13778
+ $setDirty: function() {
13779
+ this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
13780
+ this.$$animate.addClass(this.$$element, DIRTY_CLASS);
13781
+ this.$dirty = true;
13782
+ this.$pristine = false;
13783
+ this.$$parentForm.$setDirty();
13784
+ },
13785
+
13786
+ $setPristine: function() {
13787
+ this.$$animate.setClass(this.$$element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
13788
+ this.$dirty = false;
13789
+ this.$pristine = true;
13790
+ this.$submitted = false;
13791
+ forEach(this.$$controls, function(control) {
13792
+ control.$setPristine();
13793
+ });
13794
+ },
13795
+
13796
+ $setUntouched: function() {
13797
+ forEach(this.$$controls, function(control) {
13798
+ control.$setUntouched();
13799
+ });
13800
+ },
13801
+
13802
+ $setSubmitted: function() {
13803
+ this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
13804
+ this.$submitted = true;
13805
+ this.$$parentForm.$setSubmitted();
13806
+ }
13807
+ };
13808
+
13809
+ addSetValidityMethod({
13810
+ clazz: FormController,
13811
+ set: function(object, property, controller) {
13812
+ var list = object[property];
13813
+ if (!list) {
13814
+ object[property] = [controller];
13815
+ } else {
13816
+ var index = list.indexOf(controller);
13817
+ if (index === -1) {
13818
+ list.push(controller);
13819
+ }
13820
+ }
13821
+ },
13822
+ unset: function(object, property, controller) {
13823
+ var list = object[property];
13824
+ if (!list) {
13825
+ return;
13826
+ }
13827
+ arrayRemove(list, controller);
13828
+ if (list.length === 0) {
13829
+ delete object[property];
13830
+ }
13831
+ }
13832
+ });
13833
+
13834
+
13835
+ var formDirectiveFactory = function(isNgForm) {
13836
+ return ['$timeout', '$parse', function($timeout, $parse) {
13837
+ var formDirective = {
13838
+ name: 'form',
13839
+ restrict: isNgForm ? 'EAC' : 'E',
13840
+ require: ['form', '^^?form'],
13841
+ controller: FormController,
13842
+ compile: function ngFormCompile(formElement, attr) {
13843
+ formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);
13844
+
13845
+ var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);
13846
+
13847
+ return {
13848
+ pre: function ngFormPreLink(scope, formElement, attr, ctrls) {
13849
+ var controller = ctrls[0];
13850
+
13851
+ if (!('action' in attr)) {
13852
+ var handleFormSubmission = function(event) {
13853
+ scope.$apply(function() {
13854
+ controller.$commitViewValue();
13855
+ controller.$setSubmitted();
13856
+ });
13857
+
13858
+ event.preventDefault();
13859
+ };
13860
+
13861
+ formElement[0].addEventListener('submit', handleFormSubmission);
13862
+
13863
+ formElement.on('$destroy', function() {
13864
+ $timeout(function() {
13865
+ formElement[0].removeEventListener('submit', handleFormSubmission);
13866
+ }, 0, false);
13867
+ });
13868
+ }
13869
+
13870
+ var parentFormCtrl = ctrls[1] || controller.$$parentForm;
13871
+ parentFormCtrl.$addControl(controller);
13872
+
13873
+ var setter = nameAttr ? getSetter(controller.$name) : noop;
13874
+
13875
+ if (nameAttr) {
13876
+ setter(scope, controller);
13877
+ attr.$observe(nameAttr, function(newValue) {
13878
+ if (controller.$name === newValue) return;
13879
+ setter(scope, undefined);
13880
+ controller.$$parentForm.$$renameControl(controller, newValue);
13881
+ setter = getSetter(controller.$name);
13882
+ setter(scope, controller);
13883
+ });
13884
+ }
13885
+ formElement.on('$destroy', function() {
13886
+ controller.$$parentForm.$removeControl(controller);
13887
+ setter(scope, undefined);
13888
+ extend(controller, nullFormCtrl);
13889
+ });
13890
+ }
13891
+ };
13892
+ }
13893
+ };
13894
+
13895
+ return formDirective;
13896
+
13897
+ function getSetter(expression) {
13898
+ if (expression === '') {
13899
+ return $parse('this[""]').assign;
13900
+ }
13901
+ return $parse(expression).assign || noop;
13902
+ }
13903
+ }];
13904
+ };
13905
+
13906
+ var formDirective = formDirectiveFactory();
13907
+ var ngFormDirective = formDirectiveFactory(true);
13908
+
13909
+
13910
+
13911
+ function setupValidity(instance) {
13912
+ instance.$$classCache = {};
13913
+ instance.$$classCache[INVALID_CLASS] = !(instance.$$classCache[VALID_CLASS] = instance.$$element.hasClass(VALID_CLASS));
13914
+ }
13915
+ function addSetValidityMethod(context) {
13916
+ var clazz = context.clazz,
13917
+ set = context.set,
13918
+ unset = context.unset;
13919
+
13920
+ clazz.prototype.$setValidity = function(validationErrorKey, state, controller) {
13921
+ if (isUndefined(state)) {
13922
+ createAndSet(this, '$pending', validationErrorKey, controller);
13923
+ } else {
13924
+ unsetAndCleanup(this, '$pending', validationErrorKey, controller);
13925
+ }
13926
+ if (!isBoolean(state)) {
13927
+ unset(this.$error, validationErrorKey, controller);
13928
+ unset(this.$$success, validationErrorKey, controller);
13929
+ } else {
13930
+ if (state) {
13931
+ unset(this.$error, validationErrorKey, controller);
13932
+ set(this.$$success, validationErrorKey, controller);
13933
+ } else {
13934
+ set(this.$error, validationErrorKey, controller);
13935
+ unset(this.$$success, validationErrorKey, controller);
13936
+ }
13937
+ }
13938
+ if (this.$pending) {
13939
+ cachedToggleClass(this, PENDING_CLASS, true);
13940
+ this.$valid = this.$invalid = undefined;
13941
+ toggleValidationCss(this, '', null);
13942
+ } else {
13943
+ cachedToggleClass(this, PENDING_CLASS, false);
13944
+ this.$valid = isObjectEmpty(this.$error);
13945
+ this.$invalid = !this.$valid;
13946
+ toggleValidationCss(this, '', this.$valid);
13947
+ }
13948
+
13949
+ var combinedState;
13950
+ if (this.$pending && this.$pending[validationErrorKey]) {
13951
+ combinedState = undefined;
13952
+ } else if (this.$error[validationErrorKey]) {
13953
+ combinedState = false;
13954
+ } else if (this.$$success[validationErrorKey]) {
13955
+ combinedState = true;
13956
+ } else {
13957
+ combinedState = null;
13958
+ }
13959
+
13960
+ toggleValidationCss(this, validationErrorKey, combinedState);
13961
+ this.$$parentForm.$setValidity(validationErrorKey, combinedState, this);
13962
+ };
13963
+
13964
+ function createAndSet(ctrl, name, value, controller) {
13965
+ if (!ctrl[name]) {
13966
+ ctrl[name] = {};
13967
+ }
13968
+ set(ctrl[name], value, controller);
13969
+ }
13970
+
13971
+ function unsetAndCleanup(ctrl, name, value, controller) {
13972
+ if (ctrl[name]) {
13973
+ unset(ctrl[name], value, controller);
13974
+ }
13975
+ if (isObjectEmpty(ctrl[name])) {
13976
+ ctrl[name] = undefined;
13977
+ }
13978
+ }
13979
+
13980
+ function cachedToggleClass(ctrl, className, switchValue) {
13981
+ if (switchValue && !ctrl.$$classCache[className]) {
13982
+ ctrl.$$animate.addClass(ctrl.$$element, className);
13983
+ ctrl.$$classCache[className] = true;
13984
+ } else if (!switchValue && ctrl.$$classCache[className]) {
13985
+ ctrl.$$animate.removeClass(ctrl.$$element, className);
13986
+ ctrl.$$classCache[className] = false;
13987
+ }
13988
+ }
13989
+
13990
+ function toggleValidationCss(ctrl, validationErrorKey, isValid) {
13991
+ validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
13992
+
13993
+ cachedToggleClass(ctrl, VALID_CLASS + validationErrorKey, isValid === true);
13994
+ cachedToggleClass(ctrl, INVALID_CLASS + validationErrorKey, isValid === false);
13995
+ }
13996
+ }
13997
+
13998
+ function isObjectEmpty(obj) {
13999
+ if (obj) {
14000
+ for (var prop in obj) {
14001
+ if (obj.hasOwnProperty(prop)) {
14002
+ return false;
14003
+ }
14004
+ }
14005
+ }
14006
+ return true;
14007
+ }
14008
+
14009
+
14010
+ var ISO_DATE_REGEXP = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/;
14011
+ var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
14012
+ var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
14013
+ var NUMBER_REGEXP = /^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
14014
+ var DATE_REGEXP = /^(\d{4,})-(\d{2})-(\d{2})$/;
14015
+ var DATETIMELOCAL_REGEXP = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
14016
+ var WEEK_REGEXP = /^(\d{4,})-W(\d\d)$/;
14017
+ var MONTH_REGEXP = /^(\d{4,})-(\d\d)$/;
14018
+ var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
14019
+
14020
+ var PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown';
14021
+ var PARTIAL_VALIDATION_TYPES = createMap();
14022
+ forEach('date,datetime-local,month,time,week'.split(','), function(type) {
14023
+ PARTIAL_VALIDATION_TYPES[type] = true;
14024
+ });
14025
+
14026
+ var inputType = {
14027
+
14028
+ 'text': textInputType,
14029
+
14030
+ 'date': createDateInputType('date', DATE_REGEXP,
14031
+ createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),
14032
+ 'yyyy-MM-dd'),
14033
+
14034
+ 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,
14035
+ createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),
14036
+ 'yyyy-MM-ddTHH:mm:ss.sss'),
14037
+
14038
+ 'time': createDateInputType('time', TIME_REGEXP,
14039
+ createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),
14040
+ 'HH:mm:ss.sss'),
14041
+
14042
+ 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),
14043
+
14044
+ 'month': createDateInputType('month', MONTH_REGEXP,
14045
+ createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),
14046
+ 'yyyy-MM'),
14047
+
14048
+ 'number': numberInputType,
14049
+
14050
+
14051
+ 'url': urlInputType,
14052
+
14053
+
14054
+ 'email': emailInputType,
14055
+
14056
+
14057
+ 'radio': radioInputType,
14058
+
14059
+ 'range': rangeInputType,
14060
+
14061
+ 'checkbox': checkboxInputType,
14062
+
14063
+ 'hidden': noop,
14064
+ 'button': noop,
14065
+ 'submit': noop,
14066
+ 'reset': noop,
14067
+ 'file': noop
14068
+ };
14069
+
14070
+ function stringBasedInputType(ctrl) {
14071
+ ctrl.$formatters.push(function(value) {
14072
+ return ctrl.$isEmpty(value) ? value : value.toString();
14073
+ });
14074
+ }
14075
+
14076
+ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
14077
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
14078
+ stringBasedInputType(ctrl);
14079
+ }
14080
+
14081
+ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
14082
+ var type = lowercase(element[0].type);
14083
+
14084
+ if (!$sniffer.android) {
14085
+ var composing = false;
14086
+
14087
+ element.on('compositionstart', function() {
14088
+ composing = true;
14089
+ });
14090
+
14091
+ element.on('compositionend', function() {
14092
+ composing = false;
14093
+ listener();
14094
+ });
14095
+ }
14096
+
14097
+ var timeout;
14098
+
14099
+ var listener = function(ev) {
14100
+ if (timeout) {
14101
+ $browser.defer.cancel(timeout);
14102
+ timeout = null;
14103
+ }
14104
+ if (composing) return;
14105
+ var value = element.val(),
14106
+ event = ev && ev.type;
14107
+
14108
+ if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {
14109
+ value = trim(value);
14110
+ }
14111
+
14112
+ if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {
14113
+ ctrl.$setViewValue(value, event);
14114
+ }
14115
+ };
14116
+
14117
+ if ($sniffer.hasEvent('input')) {
14118
+ element.on('input', listener);
14119
+ } else {
14120
+ var deferListener = function(ev, input, origValue) {
14121
+ if (!timeout) {
14122
+ timeout = $browser.defer(function() {
14123
+ timeout = null;
14124
+ if (!input || input.value !== origValue) {
14125
+ listener(ev);
14126
+ }
14127
+ });
14128
+ }
14129
+ };
14130
+
14131
+ element.on('keydown', function(event) {
14132
+ var key = event.keyCode;
14133
+
14134
+ if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
14135
+
14136
+ deferListener(event, this, this.value);
14137
+ });
14138
+
14139
+ if ($sniffer.hasEvent('paste')) {
14140
+ element.on('paste cut', deferListener);
14141
+ }
14142
+ }
14143
+
14144
+ element.on('change', listener);
14145
+
14146
+ if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) {
14147
+ element.on(PARTIAL_VALIDATION_EVENTS, function(ev) {
14148
+ if (!timeout) {
14149
+ var validity = this[VALIDITY_STATE_PROPERTY];
14150
+ var origBadInput = validity.badInput;
14151
+ var origTypeMismatch = validity.typeMismatch;
14152
+ timeout = $browser.defer(function() {
14153
+ timeout = null;
14154
+ if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) {
14155
+ listener(ev);
14156
+ }
14157
+ });
14158
+ }
14159
+ });
14160
+ }
14161
+
14162
+ ctrl.$render = function() {
14163
+ var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;
14164
+ if (element.val() !== value) {
14165
+ element.val(value);
14166
+ }
14167
+ };
14168
+ }
14169
+
14170
+ function weekParser(isoWeek, existingDate) {
14171
+ if (isDate(isoWeek)) {
14172
+ return isoWeek;
14173
+ }
14174
+
14175
+ if (isString(isoWeek)) {
14176
+ WEEK_REGEXP.lastIndex = 0;
14177
+ var parts = WEEK_REGEXP.exec(isoWeek);
14178
+ if (parts) {
14179
+ var year = +parts[1],
14180
+ week = +parts[2],
14181
+ hours = 0,
14182
+ minutes = 0,
14183
+ seconds = 0,
14184
+ milliseconds = 0,
14185
+ firstThurs = getFirstThursdayOfYear(year),
14186
+ addDays = (week - 1) * 7;
14187
+
14188
+ if (existingDate) {
14189
+ hours = existingDate.getHours();
14190
+ minutes = existingDate.getMinutes();
14191
+ seconds = existingDate.getSeconds();
14192
+ milliseconds = existingDate.getMilliseconds();
14193
+ }
14194
+
14195
+ return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);
14196
+ }
14197
+ }
14198
+
14199
+ return NaN;
14200
+ }
14201
+
14202
+ function createDateParser(regexp, mapping) {
14203
+ return function(iso, date) {
14204
+ var parts, map;
14205
+
14206
+ if (isDate(iso)) {
14207
+ return iso;
14208
+ }
14209
+
14210
+ if (isString(iso)) {
14211
+ if (iso.charAt(0) === '"' && iso.charAt(iso.length - 1) === '"') {
14212
+ iso = iso.substring(1, iso.length - 1);
14213
+ }
14214
+ if (ISO_DATE_REGEXP.test(iso)) {
14215
+ return new Date(iso);
14216
+ }
14217
+ regexp.lastIndex = 0;
14218
+ parts = regexp.exec(iso);
14219
+
14220
+ if (parts) {
14221
+ parts.shift();
14222
+ if (date) {
14223
+ map = {
14224
+ yyyy: date.getFullYear(),
14225
+ MM: date.getMonth() + 1,
14226
+ dd: date.getDate(),
14227
+ HH: date.getHours(),
14228
+ mm: date.getMinutes(),
14229
+ ss: date.getSeconds(),
14230
+ sss: date.getMilliseconds() / 1000
14231
+ };
14232
+ } else {
14233
+ map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };
14234
+ }
14235
+
14236
+ forEach(parts, function(part, index) {
14237
+ if (index < mapping.length) {
14238
+ map[mapping[index]] = +part;
14239
+ }
14240
+ });
14241
+ return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);
14242
+ }
14243
+ }
14244
+
14245
+ return NaN;
14246
+ };
14247
+ }
14248
+
14249
+ function createDateInputType(type, regexp, parseDate, format) {
14250
+ return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {
14251
+ badInputChecker(scope, element, attr, ctrl);
14252
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
14253
+ var timezone = ctrl && ctrl.$options.getOption('timezone');
14254
+ var previousDate;
14255
+
14256
+ ctrl.$$parserName = type;
14257
+ ctrl.$parsers.push(function(value) {
14258
+ if (ctrl.$isEmpty(value)) return null;
14259
+ if (regexp.test(value)) {
14260
+ var parsedDate = parseDate(value, previousDate);
14261
+ if (timezone) {
14262
+ parsedDate = convertTimezoneToLocal(parsedDate, timezone);
14263
+ }
14264
+ return parsedDate;
14265
+ }
14266
+ return undefined;
14267
+ });
14268
+
14269
+ ctrl.$formatters.push(function(value) {
14270
+ if (value && !isDate(value)) {
14271
+ throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);
14272
+ }
14273
+ if (isValidDate(value)) {
14274
+ previousDate = value;
14275
+ if (previousDate && timezone) {
14276
+ previousDate = convertTimezoneToLocal(previousDate, timezone, true);
14277
+ }
14278
+ return $filter('date')(value, format, timezone);
14279
+ } else {
14280
+ previousDate = null;
14281
+ return '';
14282
+ }
14283
+ });
14284
+
14285
+ if (isDefined(attr.min) || attr.ngMin) {
14286
+ var minVal;
14287
+ ctrl.$validators.min = function(value) {
14288
+ return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;
14289
+ };
14290
+ attr.$observe('min', function(val) {
14291
+ minVal = parseObservedDateValue(val);
14292
+ ctrl.$validate();
14293
+ });
14294
+ }
14295
+
14296
+ if (isDefined(attr.max) || attr.ngMax) {
14297
+ var maxVal;
14298
+ ctrl.$validators.max = function(value) {
14299
+ return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;
14300
+ };
14301
+ attr.$observe('max', function(val) {
14302
+ maxVal = parseObservedDateValue(val);
14303
+ ctrl.$validate();
14304
+ });
14305
+ }
14306
+
14307
+ function isValidDate(value) {
14308
+ return value && !(value.getTime && value.getTime() !== value.getTime());
14309
+ }
14310
+
14311
+ function parseObservedDateValue(val) {
14312
+ return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;
14313
+ }
14314
+ };
14315
+ }
14316
+
14317
+ function badInputChecker(scope, element, attr, ctrl) {
14318
+ var node = element[0];
14319
+ var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);
14320
+ if (nativeValidation) {
14321
+ ctrl.$parsers.push(function(value) {
14322
+ var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};
14323
+ return validity.badInput || validity.typeMismatch ? undefined : value;
14324
+ });
14325
+ }
14326
+ }
14327
+
14328
+ function numberFormatterParser(ctrl) {
14329
+ ctrl.$$parserName = 'number';
14330
+ ctrl.$parsers.push(function(value) {
14331
+ if (ctrl.$isEmpty(value)) return null;
14332
+ if (NUMBER_REGEXP.test(value)) return parseFloat(value);
14333
+ return undefined;
14334
+ });
14335
+
14336
+ ctrl.$formatters.push(function(value) {
14337
+ if (!ctrl.$isEmpty(value)) {
14338
+ if (!isNumber(value)) {
14339
+ throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
14340
+ }
14341
+ value = value.toString();
14342
+ }
14343
+ return value;
14344
+ });
14345
+ }
14346
+
14347
+ function parseNumberAttrVal(val) {
14348
+ if (isDefined(val) && !isNumber(val)) {
14349
+ val = parseFloat(val);
14350
+ }
14351
+ return !isNumberNaN(val) ? val : undefined;
14352
+ }
14353
+
14354
+ function isNumberInteger(num) {
14355
+
14356
+ return (num | 0) === num;
14357
+ }
14358
+
14359
+ function countDecimals(num) {
14360
+ var numString = num.toString();
14361
+ var decimalSymbolIndex = numString.indexOf('.');
14362
+
14363
+ if (decimalSymbolIndex === -1) {
14364
+ if (-1 < num && num < 1) {
14365
+ var match = /e-(\d+)$/.exec(numString);
14366
+
14367
+ if (match) {
14368
+ return Number(match[1]);
14369
+ }
14370
+ }
14371
+
14372
+ return 0;
14373
+ }
14374
+
14375
+ return numString.length - decimalSymbolIndex - 1;
14376
+ }
14377
+
14378
+ function isValidForStep(viewValue, stepBase, step) {
14379
+ var value = Number(viewValue);
14380
+
14381
+ if (!isNumberInteger(value) || !isNumberInteger(stepBase) || !isNumberInteger(step)) {
14382
+ var decimalCount = Math.max(countDecimals(value), countDecimals(stepBase), countDecimals(step));
14383
+ var multiplier = Math.pow(10, decimalCount);
14384
+
14385
+ value = value * multiplier;
14386
+ stepBase = stepBase * multiplier;
14387
+ step = step * multiplier;
14388
+ }
14389
+
14390
+ return (value - stepBase) % step === 0;
14391
+ }
14392
+
14393
+ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
14394
+ badInputChecker(scope, element, attr, ctrl);
14395
+ numberFormatterParser(ctrl);
14396
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
14397
+
14398
+ var minVal;
14399
+ var maxVal;
14400
+
14401
+ if (isDefined(attr.min) || attr.ngMin) {
14402
+ ctrl.$validators.min = function(value) {
14403
+ return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;
14404
+ };
14405
+
14406
+ attr.$observe('min', function(val) {
14407
+ minVal = parseNumberAttrVal(val);
14408
+ ctrl.$validate();
14409
+ });
14410
+ }
14411
+
14412
+ if (isDefined(attr.max) || attr.ngMax) {
14413
+ ctrl.$validators.max = function(value) {
14414
+ return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;
14415
+ };
14416
+
14417
+ attr.$observe('max', function(val) {
14418
+ maxVal = parseNumberAttrVal(val);
14419
+ ctrl.$validate();
14420
+ });
14421
+ }
14422
+
14423
+ if (isDefined(attr.step) || attr.ngStep) {
14424
+ var stepVal;
14425
+ ctrl.$validators.step = function(modelValue, viewValue) {
14426
+ return ctrl.$isEmpty(viewValue) || isUndefined(stepVal) ||
14427
+ isValidForStep(viewValue, minVal || 0, stepVal);
14428
+ };
14429
+
14430
+ attr.$observe('step', function(val) {
14431
+ stepVal = parseNumberAttrVal(val);
14432
+ ctrl.$validate();
14433
+ });
14434
+ }
14435
+ }
14436
+
14437
+ function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
14438
+ badInputChecker(scope, element, attr, ctrl);
14439
+ numberFormatterParser(ctrl);
14440
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
14441
+
14442
+ var supportsRange = ctrl.$$hasNativeValidators && element[0].type === 'range',
14443
+ minVal = supportsRange ? 0 : undefined,
14444
+ maxVal = supportsRange ? 100 : undefined,
14445
+ stepVal = supportsRange ? 1 : undefined,
14446
+ validity = element[0].validity,
14447
+ hasMinAttr = isDefined(attr.min),
14448
+ hasMaxAttr = isDefined(attr.max),
14449
+ hasStepAttr = isDefined(attr.step);
14450
+
14451
+ var originalRender = ctrl.$render;
14452
+
14453
+ ctrl.$render = supportsRange && isDefined(validity.rangeUnderflow) && isDefined(validity.rangeOverflow) ?
14454
+ function rangeRender() {
14455
+ originalRender();
14456
+ ctrl.$setViewValue(element.val());
14457
+ } :
14458
+ originalRender;
14459
+
14460
+ if (hasMinAttr) {
14461
+ ctrl.$validators.min = supportsRange ?
14462
+ function noopMinValidator() { return true; } :
14463
+ function minValidator(modelValue, viewValue) {
14464
+ return ctrl.$isEmpty(viewValue) || isUndefined(minVal) || viewValue >= minVal;
14465
+ };
14466
+
14467
+ setInitialValueAndObserver('min', minChange);
14468
+ }
14469
+
14470
+ if (hasMaxAttr) {
14471
+ ctrl.$validators.max = supportsRange ?
14472
+ function noopMaxValidator() { return true; } :
14473
+ function maxValidator(modelValue, viewValue) {
14474
+ return ctrl.$isEmpty(viewValue) || isUndefined(maxVal) || viewValue <= maxVal;
14475
+ };
14476
+
14477
+ setInitialValueAndObserver('max', maxChange);
14478
+ }
14479
+
14480
+ if (hasStepAttr) {
14481
+ ctrl.$validators.step = supportsRange ?
14482
+ function nativeStepValidator() {
14483
+ return !validity.stepMismatch;
14484
+ } :
14485
+ function stepValidator(modelValue, viewValue) {
14486
+ return ctrl.$isEmpty(viewValue) || isUndefined(stepVal) ||
14487
+ isValidForStep(viewValue, minVal || 0, stepVal);
14488
+ };
14489
+
14490
+ setInitialValueAndObserver('step', stepChange);
14491
+ }
14492
+
14493
+ function setInitialValueAndObserver(htmlAttrName, changeFn) {
14494
+ element.attr(htmlAttrName, attr[htmlAttrName]);
14495
+ attr.$observe(htmlAttrName, changeFn);
14496
+ }
14497
+
14498
+ function minChange(val) {
14499
+ minVal = parseNumberAttrVal(val);
14500
+ if (isNumberNaN(ctrl.$modelValue)) {
14501
+ return;
14502
+ }
14503
+
14504
+ if (supportsRange) {
14505
+ var elVal = element.val();
14506
+ if (minVal > elVal) {
14507
+ elVal = minVal;
14508
+ element.val(elVal);
14509
+ }
14510
+ ctrl.$setViewValue(elVal);
14511
+ } else {
14512
+ ctrl.$validate();
14513
+ }
14514
+ }
14515
+
14516
+ function maxChange(val) {
14517
+ maxVal = parseNumberAttrVal(val);
14518
+ if (isNumberNaN(ctrl.$modelValue)) {
14519
+ return;
14520
+ }
14521
+
14522
+ if (supportsRange) {
14523
+ var elVal = element.val();
14524
+ if (maxVal < elVal) {
14525
+ element.val(maxVal);
14526
+ elVal = maxVal < minVal ? minVal : maxVal;
14527
+ }
14528
+ ctrl.$setViewValue(elVal);
14529
+ } else {
14530
+ ctrl.$validate();
14531
+ }
14532
+ }
14533
+
14534
+ function stepChange(val) {
14535
+ stepVal = parseNumberAttrVal(val);
14536
+ if (isNumberNaN(ctrl.$modelValue)) {
14537
+ return;
14538
+ }
14539
+
14540
+ if (supportsRange && ctrl.$viewValue !== element.val()) {
14541
+ ctrl.$setViewValue(element.val());
14542
+ } else {
14543
+ ctrl.$validate();
14544
+ }
14545
+ }
14546
+ }
14547
+
14548
+ function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
14549
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
14550
+ stringBasedInputType(ctrl);
14551
+
14552
+ ctrl.$$parserName = 'url';
14553
+ ctrl.$validators.url = function(modelValue, viewValue) {
14554
+ var value = modelValue || viewValue;
14555
+ return ctrl.$isEmpty(value) || URL_REGEXP.test(value);
14556
+ };
14557
+ }
14558
+
14559
+ function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
14560
+ baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
14561
+ stringBasedInputType(ctrl);
14562
+
14563
+ ctrl.$$parserName = 'email';
14564
+ ctrl.$validators.email = function(modelValue, viewValue) {
14565
+ var value = modelValue || viewValue;
14566
+ return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);
14567
+ };
14568
+ }
14569
+
14570
+ function radioInputType(scope, element, attr, ctrl) {
14571
+ var doTrim = !attr.ngTrim || trim(attr.ngTrim) !== 'false';
14572
+ if (isUndefined(attr.name)) {
14573
+ element.attr('name', nextUid());
14574
+ }
14575
+
14576
+ var listener = function(ev) {
14577
+ var value;
14578
+ if (element[0].checked) {
14579
+ value = attr.value;
14580
+ if (doTrim) {
14581
+ value = trim(value);
14582
+ }
14583
+ ctrl.$setViewValue(value, ev && ev.type);
14584
+ }
14585
+ };
14586
+
14587
+ element.on('click', listener);
14588
+
14589
+ ctrl.$render = function() {
14590
+ var value = attr.value;
14591
+ if (doTrim) {
14592
+ value = trim(value);
14593
+ }
14594
+ element[0].checked = (value === ctrl.$viewValue);
14595
+ };
14596
+
14597
+ attr.$observe('value', ctrl.$render);
14598
+ }
14599
+
14600
+ function parseConstantExpr($parse, context, name, expression, fallback) {
14601
+ var parseFn;
14602
+ if (isDefined(expression)) {
14603
+ parseFn = $parse(expression);
14604
+ if (!parseFn.constant) {
14605
+ throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +
14606
+ '`{1}`.', name, expression);
14607
+ }
14608
+ return parseFn(context);
14609
+ }
14610
+ return fallback;
14611
+ }
14612
+
14613
+ function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
14614
+ var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);
14615
+ var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);
14616
+
14617
+ var listener = function(ev) {
14618
+ ctrl.$setViewValue(element[0].checked, ev && ev.type);
14619
+ };
14620
+
14621
+ element.on('click', listener);
14622
+
14623
+ ctrl.$render = function() {
14624
+ element[0].checked = ctrl.$viewValue;
14625
+ };
14626
+
14627
+ ctrl.$isEmpty = function(value) {
14628
+ return value === false;
14629
+ };
14630
+
14631
+ ctrl.$formatters.push(function(value) {
14632
+ return equals(value, trueValue);
14633
+ });
14634
+
14635
+ ctrl.$parsers.push(function(value) {
14636
+ return value ? trueValue : falseValue;
14637
+ });
14638
+ }
14639
+
14640
+
14641
+
14642
+
14643
+ var inputDirective = ['$browser', '$sniffer', '$filter', '$parse',
14644
+ function($browser, $sniffer, $filter, $parse) {
14645
+ return {
14646
+ restrict: 'E',
14647
+ require: ['?ngModel'],
14648
+ link: {
14649
+ pre: function(scope, element, attr, ctrls) {
14650
+ if (ctrls[0]) {
14651
+ (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,
14652
+ $browser, $filter, $parse);
14653
+ }
14654
+ }
14655
+ }
14656
+ };
14657
+ }];
14658
+
14659
+
14660
+
14661
+ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
14662
+ var ngValueDirective = function() {
14663
+ function updateElementValue(element, attr, value) {
14664
+ element.prop('value', value);
14665
+ attr.$set('value', value);
14666
+ }
14667
+
14668
+ return {
14669
+ restrict: 'A',
14670
+ priority: 100,
14671
+ compile: function(tpl, tplAttr) {
14672
+ if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
14673
+ return function ngValueConstantLink(scope, elm, attr) {
14674
+ var value = scope.$eval(attr.ngValue);
14675
+ updateElementValue(elm, attr, value);
14676
+ };
14677
+ } else {
14678
+ return function ngValueLink(scope, elm, attr) {
14679
+ scope.$watch(attr.ngValue, function valueWatchAction(value) {
14680
+ updateElementValue(elm, attr, value);
14681
+ });
14682
+ };
14683
+ }
14684
+ }
14685
+ };
14686
+ };
14687
+
14688
+ var ngBindDirective = ['$compile', function($compile) {
14689
+ return {
14690
+ restrict: 'AC',
14691
+ compile: function ngBindCompile(templateElement) {
14692
+ $compile.$$addBindingClass(templateElement);
14693
+ return function ngBindLink(scope, element, attr) {
14694
+ $compile.$$addBindingInfo(element, attr.ngBind);
14695
+ element = element[0];
14696
+ scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
14697
+ element.textContent = stringify(value);
14698
+ });
14699
+ };
14700
+ }
14701
+ };
14702
+ }];
14703
+
14704
+
14705
+ var ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {
14706
+ return {
14707
+ compile: function ngBindTemplateCompile(templateElement) {
14708
+ $compile.$$addBindingClass(templateElement);
14709
+ return function ngBindTemplateLink(scope, element, attr) {
14710
+ var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
14711
+ $compile.$$addBindingInfo(element, interpolateFn.expressions);
14712
+ element = element[0];
14713
+ attr.$observe('ngBindTemplate', function(value) {
14714
+ element.textContent = isUndefined(value) ? '' : value;
14715
+ });
14716
+ };
14717
+ }
14718
+ };
14719
+ }];
14720
+
14721
+
14722
+ var ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {
14723
+ return {
14724
+ restrict: 'A',
14725
+ compile: function ngBindHtmlCompile(tElement, tAttrs) {
14726
+ var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);
14727
+ var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function sceValueOf(val) {
14728
+ return $sce.valueOf(val);
14729
+ });
14730
+ $compile.$$addBindingClass(tElement);
14731
+
14732
+ return function ngBindHtmlLink(scope, element, attr) {
14733
+ $compile.$$addBindingInfo(element, attr.ngBindHtml);
14734
+
14735
+ scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {
14736
+ var value = ngBindHtmlGetter(scope);
14737
+ element.html($sce.getTrustedHtml(value) || '');
14738
+ });
14739
+ };
14740
+ }
14741
+ };
14742
+ }];
14743
+
14744
+ var ngChangeDirective = valueFn({
14745
+ restrict: 'A',
14746
+ require: 'ngModel',
14747
+ link: function(scope, element, attr, ctrl) {
14748
+ ctrl.$viewChangeListeners.push(function() {
14749
+ scope.$eval(attr.ngChange);
14750
+ });
14751
+ }
14752
+ });
14753
+
14754
+
14755
+ function classDirective(name, selector) {
14756
+ name = 'ngClass' + name;
14757
+ var indexWatchExpression;
14758
+
14759
+ return ['$parse', function($parse) {
14760
+ return {
14761
+ restrict: 'AC',
14762
+ link: function(scope, element, attr) {
14763
+ var expression = attr[name].trim();
14764
+ var isOneTime = (expression.charAt(0) === ':') && (expression.charAt(1) === ':');
14765
+
14766
+ var watchInterceptor = isOneTime ? toFlatValue : toClassString;
14767
+ var watchExpression = $parse(expression, watchInterceptor);
14768
+ var watchAction = isOneTime ? ngClassOneTimeWatchAction : ngClassWatchAction;
14769
+
14770
+ var classCounts = element.data('$classCounts');
14771
+ var oldModulo = true;
14772
+ var oldClassString;
14773
+
14774
+ if (!classCounts) {
14775
+ classCounts = createMap();
14776
+ element.data('$classCounts', classCounts);
14777
+ }
14778
+
14779
+ if (name !== 'ngClass') {
14780
+ if (!indexWatchExpression) {
14781
+ indexWatchExpression = $parse('$index', function moduloTwo($index) {
14782
+ return $index & 1;
14783
+ });
14784
+ }
14785
+
14786
+ scope.$watch(indexWatchExpression, ngClassIndexWatchAction);
14787
+ }
14788
+
14789
+ scope.$watch(watchExpression, watchAction, isOneTime);
14790
+
14791
+ function addClasses(classString) {
14792
+ classString = digestClassCounts(split(classString), 1);
14793
+ attr.$addClass(classString);
14794
+ }
14795
+
14796
+ function removeClasses(classString) {
14797
+ classString = digestClassCounts(split(classString), -1);
14798
+ attr.$removeClass(classString);
14799
+ }
14800
+
14801
+ function updateClasses(oldClassString, newClassString) {
14802
+ var oldClassArray = split(oldClassString);
14803
+ var newClassArray = split(newClassString);
14804
+
14805
+ var toRemoveArray = arrayDifference(oldClassArray, newClassArray);
14806
+ var toAddArray = arrayDifference(newClassArray, oldClassArray);
14807
+
14808
+ var toRemoveString = digestClassCounts(toRemoveArray, -1);
14809
+ var toAddString = digestClassCounts(toAddArray, 1);
14810
+
14811
+ attr.$addClass(toAddString);
14812
+ attr.$removeClass(toRemoveString);
14813
+ }
14814
+
14815
+ function digestClassCounts(classArray, count) {
14816
+ var classesToUpdate = [];
14817
+
14818
+ forEach(classArray, function(className) {
14819
+ if (count > 0 || classCounts[className]) {
14820
+ classCounts[className] = (classCounts[className] || 0) + count;
14821
+ if (classCounts[className] === +(count > 0)) {
14822
+ classesToUpdate.push(className);
14823
+ }
14824
+ }
14825
+ });
14826
+
14827
+ return classesToUpdate.join(' ');
14828
+ }
14829
+
14830
+ function ngClassIndexWatchAction(newModulo) {
14831
+ if (newModulo === selector) {
14832
+ addClasses(oldClassString);
14833
+ } else {
14834
+ removeClasses(oldClassString);
14835
+ }
14836
+
14837
+ oldModulo = newModulo;
14838
+ }
14839
+
14840
+ function ngClassOneTimeWatchAction(newClassValue) {
14841
+ var newClassString = toClassString(newClassValue);
14842
+
14843
+ if (newClassString !== oldClassString) {
14844
+ ngClassWatchAction(newClassString);
14845
+ }
14846
+ }
14847
+
14848
+ function ngClassWatchAction(newClassString) {
14849
+ if (oldModulo === selector) {
14850
+ updateClasses(oldClassString, newClassString);
14851
+ }
14852
+
14853
+ oldClassString = newClassString;
14854
+ }
14855
+ }
14856
+ };
14857
+ }];
14858
+
14859
+ function arrayDifference(tokens1, tokens2) {
14860
+ if (!tokens1 || !tokens1.length) return [];
14861
+ if (!tokens2 || !tokens2.length) return tokens1;
14862
+
14863
+ var values = [];
14864
+
14865
+ outer:
14866
+ for (var i = 0; i < tokens1.length; i++) {
14867
+ var token = tokens1[i];
14868
+ for (var j = 0; j < tokens2.length; j++) {
14869
+ if (token === tokens2[j]) continue outer;
14870
+ }
14871
+ values.push(token);
14872
+ }
14873
+
14874
+ return values;
14875
+ }
14876
+
14877
+ function split(classString) {
14878
+ return classString && classString.split(' ');
14879
+ }
14880
+
14881
+ function toClassString(classValue) {
14882
+ var classString = classValue;
14883
+
14884
+ if (isArray(classValue)) {
14885
+ classString = classValue.map(toClassString).join(' ');
14886
+ } else if (isObject(classValue)) {
14887
+ classString = Object.keys(classValue).
14888
+ filter(function(key) { return classValue[key]; }).
14889
+ join(' ');
14890
+ }
14891
+
14892
+ return classString;
14893
+ }
14894
+
14895
+ function toFlatValue(classValue) {
14896
+ var flatValue = classValue;
14897
+
14898
+ if (isArray(classValue)) {
14899
+ flatValue = classValue.map(toFlatValue);
14900
+ } else if (isObject(classValue)) {
14901
+ var hasUndefined = false;
14902
+
14903
+ flatValue = Object.keys(classValue).filter(function(key) {
14904
+ var value = classValue[key];
14905
+
14906
+ if (!hasUndefined && isUndefined(value)) {
14907
+ hasUndefined = true;
14908
+ }
14909
+
14910
+ return value;
14911
+ });
14912
+
14913
+ if (hasUndefined) {
14914
+ flatValue.push(undefined);
14915
+ }
14916
+ }
14917
+
14918
+ return flatValue;
14919
+ }
14920
+ }
14921
+
14922
+ var ngClassDirective = classDirective('', true);
14923
+
14924
+ var ngClassOddDirective = classDirective('Odd', 0);
14925
+
14926
+ var ngClassEvenDirective = classDirective('Even', 1);
14927
+
14928
+ var ngCloakDirective = ngDirective({
14929
+ compile: function(element, attr) {
14930
+ attr.$set('ngCloak', undefined);
14931
+ element.removeClass('ng-cloak');
14932
+ }
14933
+ });
14934
+
14935
+ var ngControllerDirective = [function() {
14936
+ return {
14937
+ restrict: 'A',
14938
+ scope: true,
14939
+ controller: '@',
14940
+ priority: 500
14941
+ };
14942
+ }];
14943
+
14944
+
14945
+
14946
+ var ngEventDirectives = {};
14947
+
14948
+ var forceAsyncEvents = {
14949
+ 'blur': true,
14950
+ 'focus': true
14951
+ };
14952
+ forEach(
14953
+ 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),
14954
+ function(eventName) {
14955
+ var directiveName = directiveNormalize('ng-' + eventName);
14956
+ ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {
14957
+ return {
14958
+ restrict: 'A',
14959
+ compile: function($element, attr) {
14960
+ var fn = $parse(attr[directiveName], null, true);
14961
+ return function ngEventHandler(scope, element) {
14962
+ element.on(eventName, function(event) {
14963
+ var callback = function() {
14964
+ fn(scope, {$event:event});
14965
+ };
14966
+ if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
14967
+ scope.$evalAsync(callback);
14968
+ } else {
14969
+ scope.$apply(callback);
14970
+ }
14971
+ });
14972
+ };
14973
+ }
14974
+ };
14975
+ }];
14976
+ }
14977
+ );
14978
+
14979
+
14980
+
14981
+
14982
+
14983
+
14984
+
14985
+
14986
+
14987
+
14988
+
14989
+
14990
+
14991
+
14992
+
14993
+
14994
+
14995
+
14996
+
14997
+
14998
+
14999
+
15000
+
15001
+
15002
+
15003
+
15004
+ var ngIfDirective = ['$animate', '$compile', function($animate, $compile) {
15005
+ return {
15006
+ multiElement: true,
15007
+ transclude: 'element',
15008
+ priority: 600,
15009
+ terminal: true,
15010
+ restrict: 'A',
15011
+ $$tlb: true,
15012
+ link: function($scope, $element, $attr, ctrl, $transclude) {
15013
+ var block, childScope, previousElements;
15014
+ $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
15015
+
15016
+ if (value) {
15017
+ if (!childScope) {
15018
+ $transclude(function(clone, newScope) {
15019
+ childScope = newScope;
15020
+ clone[clone.length++] = $compile.$$createComment('end ngIf', $attr.ngIf);
15021
+ block = {
15022
+ clone: clone
15023
+ };
15024
+ $animate.enter(clone, $element.parent(), $element);
15025
+ });
15026
+ }
15027
+ } else {
15028
+ if (previousElements) {
15029
+ previousElements.remove();
15030
+ previousElements = null;
15031
+ }
15032
+ if (childScope) {
15033
+ childScope.$destroy();
15034
+ childScope = null;
15035
+ }
15036
+ if (block) {
15037
+ previousElements = getBlockNodes(block.clone);
15038
+ $animate.leave(previousElements).done(function(response) {
15039
+ if (response !== false) previousElements = null;
15040
+ });
15041
+ block = null;
15042
+ }
15043
+ }
15044
+ });
15045
+ }
15046
+ };
15047
+ }];
15048
+
15049
+
15050
+
15051
+
15052
+
15053
+
15054
+
15055
+ var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',
15056
+ function($templateRequest, $anchorScroll, $animate) {
15057
+ return {
15058
+ restrict: 'ECA',
15059
+ priority: 400,
15060
+ terminal: true,
15061
+ transclude: 'element',
15062
+ controller: angular.noop,
15063
+ compile: function(element, attr) {
15064
+ var srcExp = attr.ngInclude || attr.src,
15065
+ onloadExp = attr.onload || '',
15066
+ autoScrollExp = attr.autoscroll;
15067
+
15068
+ return function(scope, $element, $attr, ctrl, $transclude) {
15069
+ var changeCounter = 0,
15070
+ currentScope,
15071
+ previousElement,
15072
+ currentElement;
15073
+
15074
+ var cleanupLastIncludeContent = function() {
15075
+ if (previousElement) {
15076
+ previousElement.remove();
15077
+ previousElement = null;
15078
+ }
15079
+ if (currentScope) {
15080
+ currentScope.$destroy();
15081
+ currentScope = null;
15082
+ }
15083
+ if (currentElement) {
15084
+ $animate.leave(currentElement).done(function(response) {
15085
+ if (response !== false) previousElement = null;
15086
+ });
15087
+ previousElement = currentElement;
15088
+ currentElement = null;
15089
+ }
15090
+ };
15091
+
15092
+ scope.$watch(srcExp, function ngIncludeWatchAction(src) {
15093
+ var afterAnimation = function(response) {
15094
+ if (response !== false && isDefined(autoScrollExp) &&
15095
+ (!autoScrollExp || scope.$eval(autoScrollExp))) {
15096
+ $anchorScroll();
15097
+ }
15098
+ };
15099
+ var thisChangeId = ++changeCounter;
15100
+
15101
+ if (src) {
15102
+ $templateRequest(src, true).then(function(response) {
15103
+ if (scope.$$destroyed) return;
15104
+
15105
+ if (thisChangeId !== changeCounter) return;
15106
+ var newScope = scope.$new();
15107
+ ctrl.template = response;
15108
+
15109
+ var clone = $transclude(newScope, function(clone) {
15110
+ cleanupLastIncludeContent();
15111
+ $animate.enter(clone, null, $element).done(afterAnimation);
15112
+ });
15113
+
15114
+ currentScope = newScope;
15115
+ currentElement = clone;
15116
+
15117
+ currentScope.$emit('$includeContentLoaded', src);
15118
+ scope.$eval(onloadExp);
15119
+ }, function() {
15120
+ if (scope.$$destroyed) return;
15121
+
15122
+ if (thisChangeId === changeCounter) {
15123
+ cleanupLastIncludeContent();
15124
+ scope.$emit('$includeContentError', src);
15125
+ }
15126
+ });
15127
+ scope.$emit('$includeContentRequested', src);
15128
+ } else {
15129
+ cleanupLastIncludeContent();
15130
+ ctrl.template = null;
15131
+ }
15132
+ });
15133
+ };
15134
+ }
15135
+ };
15136
+ }];
15137
+
15138
+ var ngIncludeFillContentDirective = ['$compile',
15139
+ function($compile) {
15140
+ return {
15141
+ restrict: 'ECA',
15142
+ priority: -400,
15143
+ require: 'ngInclude',
15144
+ link: function(scope, $element, $attr, ctrl) {
15145
+ if (toString.call($element[0]).match(/SVG/)) {
15146
+ $element.empty();
15147
+ $compile(jqLiteBuildFragment(ctrl.template, window.document).childNodes)(scope,
15148
+ function namespaceAdaptedClone(clone) {
15149
+ $element.append(clone);
15150
+ }, {futureParentElement: $element});
15151
+ return;
15152
+ }
15153
+
15154
+ $element.html(ctrl.template);
15155
+ $compile($element.contents())(scope);
15156
+ }
15157
+ };
15158
+ }];
15159
+
15160
+ var ngInitDirective = ngDirective({
15161
+ priority: 450,
15162
+ compile: function() {
15163
+ return {
15164
+ pre: function(scope, element, attrs) {
15165
+ scope.$eval(attrs.ngInit);
15166
+ }
15167
+ };
15168
+ }
15169
+ });
15170
+
15171
+ var ngListDirective = function() {
15172
+ return {
15173
+ restrict: 'A',
15174
+ priority: 100,
15175
+ require: 'ngModel',
15176
+ link: function(scope, element, attr, ctrl) {
15177
+ var ngList = attr.ngList || ', ';
15178
+ var trimValues = attr.ngTrim !== 'false';
15179
+ var separator = trimValues ? trim(ngList) : ngList;
15180
+
15181
+ var parse = function(viewValue) {
15182
+ if (isUndefined(viewValue)) return;
15183
+
15184
+ var list = [];
15185
+
15186
+ if (viewValue) {
15187
+ forEach(viewValue.split(separator), function(value) {
15188
+ if (value) list.push(trimValues ? trim(value) : value);
15189
+ });
15190
+ }
15191
+
15192
+ return list;
15193
+ };
15194
+
15195
+ ctrl.$parsers.push(parse);
15196
+ ctrl.$formatters.push(function(value) {
15197
+ if (isArray(value)) {
15198
+ return value.join(ngList);
15199
+ }
15200
+
15201
+ return undefined;
15202
+ });
15203
+
15204
+ ctrl.$isEmpty = function(value) {
15205
+ return !value || !value.length;
15206
+ };
15207
+ }
15208
+ };
15209
+ };
15210
+
15211
+
15212
+
15213
+ var VALID_CLASS = 'ng-valid',
15214
+ INVALID_CLASS = 'ng-invalid',
15215
+ PRISTINE_CLASS = 'ng-pristine',
15216
+ DIRTY_CLASS = 'ng-dirty',
15217
+ UNTOUCHED_CLASS = 'ng-untouched',
15218
+ TOUCHED_CLASS = 'ng-touched',
15219
+ EMPTY_CLASS = 'ng-empty',
15220
+ NOT_EMPTY_CLASS = 'ng-not-empty';
15221
+
15222
+ var ngModelMinErr = minErr('ngModel');
15223
+
15224
+ NgModelController.$inject = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$q', '$interpolate'];
15225
+ function NgModelController($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $q, $interpolate) {
15226
+ this.$viewValue = Number.NaN;
15227
+ this.$modelValue = Number.NaN;
15228
+ this.$$rawModelValue = undefined;
15229
+ this.$validators = {};
15230
+ this.$asyncValidators = {};
15231
+ this.$parsers = [];
15232
+ this.$formatters = [];
15233
+ this.$viewChangeListeners = [];
15234
+ this.$untouched = true;
15235
+ this.$touched = false;
15236
+ this.$pristine = true;
15237
+ this.$dirty = false;
15238
+ this.$valid = true;
15239
+ this.$invalid = false;
15240
+ this.$error = {};
15241
+ this.$$success = {};
15242
+ this.$pending = undefined;
15243
+ this.$name = $interpolate($attr.name || '', false)($scope);
15244
+ this.$$parentForm = nullFormCtrl;
15245
+ this.$options = defaultModelOptions;
15246
+
15247
+ this.$$parsedNgModel = $parse($attr.ngModel);
15248
+ this.$$parsedNgModelAssign = this.$$parsedNgModel.assign;
15249
+ this.$$ngModelGet = this.$$parsedNgModel;
15250
+ this.$$ngModelSet = this.$$parsedNgModelAssign;
15251
+ this.$$pendingDebounce = null;
15252
+ this.$$parserValid = undefined;
15253
+
15254
+ this.$$currentValidationRunId = 0;
15255
+
15256
+ this.$$scope = $scope;
15257
+ this.$$attr = $attr;
15258
+ this.$$element = $element;
15259
+ this.$$animate = $animate;
15260
+ this.$$timeout = $timeout;
15261
+ this.$$parse = $parse;
15262
+ this.$$q = $q;
15263
+ this.$$exceptionHandler = $exceptionHandler;
15264
+
15265
+ setupValidity(this);
15266
+ setupModelWatcher(this);
15267
+ }
15268
+
15269
+ NgModelController.prototype = {
15270
+ $$initGetterSetters: function() {
15271
+ if (this.$options.getOption('getterSetter')) {
15272
+ var invokeModelGetter = this.$$parse(this.$$attr.ngModel + '()'),
15273
+ invokeModelSetter = this.$$parse(this.$$attr.ngModel + '($$$p)');
15274
+
15275
+ this.$$ngModelGet = function($scope) {
15276
+ var modelValue = this.$$parsedNgModel($scope);
15277
+ if (isFunction(modelValue)) {
15278
+ modelValue = invokeModelGetter($scope);
15279
+ }
15280
+ return modelValue;
15281
+ };
15282
+ this.$$ngModelSet = function($scope, newValue) {
15283
+ if (isFunction(this.$$parsedNgModel($scope))) {
15284
+ invokeModelSetter($scope, {$$$p: newValue});
15285
+ } else {
15286
+ this.$$parsedNgModelAssign($scope, newValue);
15287
+ }
15288
+ };
15289
+ } else if (!this.$$parsedNgModel.assign) {
15290
+ throw ngModelMinErr('nonassign', 'Expression \'{0}\' is non-assignable. Element: {1}',
15291
+ this.$$attr.ngModel, startingTag(this.$$element));
15292
+ }
15293
+ },
15294
+
15295
+
15296
+ $render: noop,
15297
+
15298
+ $isEmpty: function(value) {
15299
+ return isUndefined(value) || value === '' || value === null || value !== value;
15300
+ },
15301
+
15302
+ $$updateEmptyClasses: function(value) {
15303
+ if (this.$isEmpty(value)) {
15304
+ this.$$animate.removeClass(this.$$element, NOT_EMPTY_CLASS);
15305
+ this.$$animate.addClass(this.$$element, EMPTY_CLASS);
15306
+ } else {
15307
+ this.$$animate.removeClass(this.$$element, EMPTY_CLASS);
15308
+ this.$$animate.addClass(this.$$element, NOT_EMPTY_CLASS);
15309
+ }
15310
+ },
15311
+
15312
+ $setPristine: function() {
15313
+ this.$dirty = false;
15314
+ this.$pristine = true;
15315
+ this.$$animate.removeClass(this.$$element, DIRTY_CLASS);
15316
+ this.$$animate.addClass(this.$$element, PRISTINE_CLASS);
15317
+ },
15318
+
15319
+ $setDirty: function() {
15320
+ this.$dirty = true;
15321
+ this.$pristine = false;
15322
+ this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
15323
+ this.$$animate.addClass(this.$$element, DIRTY_CLASS);
15324
+ this.$$parentForm.$setDirty();
15325
+ },
15326
+
15327
+ $setUntouched: function() {
15328
+ this.$touched = false;
15329
+ this.$untouched = true;
15330
+ this.$$animate.setClass(this.$$element, UNTOUCHED_CLASS, TOUCHED_CLASS);
15331
+ },
15332
+
15333
+ $setTouched: function() {
15334
+ this.$touched = true;
15335
+ this.$untouched = false;
15336
+ this.$$animate.setClass(this.$$element, TOUCHED_CLASS, UNTOUCHED_CLASS);
15337
+ },
15338
+
15339
+ $rollbackViewValue: function() {
15340
+ this.$$timeout.cancel(this.$$pendingDebounce);
15341
+ this.$viewValue = this.$$lastCommittedViewValue;
15342
+ this.$render();
15343
+ },
15344
+
15345
+ $validate: function() {
15346
+ if (isNumberNaN(this.$modelValue)) {
15347
+ return;
15348
+ }
15349
+
15350
+ var viewValue = this.$$lastCommittedViewValue;
15351
+ var modelValue = this.$$rawModelValue;
15352
+
15353
+ var prevValid = this.$valid;
15354
+ var prevModelValue = this.$modelValue;
15355
+
15356
+ var allowInvalid = this.$options.getOption('allowInvalid');
15357
+
15358
+ var that = this;
15359
+ this.$$runValidators(modelValue, viewValue, function(allValid) {
15360
+ if (!allowInvalid && prevValid !== allValid) {
15361
+ that.$modelValue = allValid ? modelValue : undefined;
15362
+
15363
+ if (that.$modelValue !== prevModelValue) {
15364
+ that.$$writeModelToScope();
15365
+ }
15366
+ }
15367
+ });
15368
+ },
15369
+
15370
+ $$runValidators: function(modelValue, viewValue, doneCallback) {
15371
+ this.$$currentValidationRunId++;
15372
+ var localValidationRunId = this.$$currentValidationRunId;
15373
+ var that = this;
15374
+
15375
+ if (!processParseErrors()) {
15376
+ validationDone(false);
15377
+ return;
15378
+ }
15379
+ if (!processSyncValidators()) {
15380
+ validationDone(false);
15381
+ return;
15382
+ }
15383
+ processAsyncValidators();
15384
+
15385
+ function processParseErrors() {
15386
+ var errorKey = that.$$parserName || 'parse';
15387
+ if (isUndefined(that.$$parserValid)) {
15388
+ setValidity(errorKey, null);
15389
+ } else {
15390
+ if (!that.$$parserValid) {
15391
+ forEach(that.$validators, function(v, name) {
15392
+ setValidity(name, null);
15393
+ });
15394
+ forEach(that.$asyncValidators, function(v, name) {
15395
+ setValidity(name, null);
15396
+ });
15397
+ }
15398
+ setValidity(errorKey, that.$$parserValid);
15399
+ return that.$$parserValid;
15400
+ }
15401
+ return true;
15402
+ }
15403
+
15404
+ function processSyncValidators() {
15405
+ var syncValidatorsValid = true;
15406
+ forEach(that.$validators, function(validator, name) {
15407
+ var result = Boolean(validator(modelValue, viewValue));
15408
+ syncValidatorsValid = syncValidatorsValid && result;
15409
+ setValidity(name, result);
15410
+ });
15411
+ if (!syncValidatorsValid) {
15412
+ forEach(that.$asyncValidators, function(v, name) {
15413
+ setValidity(name, null);
15414
+ });
15415
+ return false;
15416
+ }
15417
+ return true;
15418
+ }
15419
+
15420
+ function processAsyncValidators() {
15421
+ var validatorPromises = [];
15422
+ var allValid = true;
15423
+ forEach(that.$asyncValidators, function(validator, name) {
15424
+ var promise = validator(modelValue, viewValue);
15425
+ if (!isPromiseLike(promise)) {
15426
+ throw ngModelMinErr('nopromise',
15427
+ 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise);
15428
+ }
15429
+ setValidity(name, undefined);
15430
+ validatorPromises.push(promise.then(function() {
15431
+ setValidity(name, true);
15432
+ }, function() {
15433
+ allValid = false;
15434
+ setValidity(name, false);
15435
+ }));
15436
+ });
15437
+ if (!validatorPromises.length) {
15438
+ validationDone(true);
15439
+ } else {
15440
+ that.$$q.all(validatorPromises).then(function() {
15441
+ validationDone(allValid);
15442
+ }, noop);
15443
+ }
15444
+ }
15445
+
15446
+ function setValidity(name, isValid) {
15447
+ if (localValidationRunId === that.$$currentValidationRunId) {
15448
+ that.$setValidity(name, isValid);
15449
+ }
15450
+ }
15451
+
15452
+ function validationDone(allValid) {
15453
+ if (localValidationRunId === that.$$currentValidationRunId) {
15454
+
15455
+ doneCallback(allValid);
15456
+ }
15457
+ }
15458
+ },
15459
+
15460
+ $commitViewValue: function() {
15461
+ var viewValue = this.$viewValue;
15462
+
15463
+ this.$$timeout.cancel(this.$$pendingDebounce);
15464
+
15465
+ if (this.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !this.$$hasNativeValidators)) {
15466
+ return;
15467
+ }
15468
+ this.$$updateEmptyClasses(viewValue);
15469
+ this.$$lastCommittedViewValue = viewValue;
15470
+
15471
+ if (this.$pristine) {
15472
+ this.$setDirty();
15473
+ }
15474
+ this.$$parseAndValidate();
15475
+ },
15476
+
15477
+ $$parseAndValidate: function() {
15478
+ var viewValue = this.$$lastCommittedViewValue;
15479
+ var modelValue = viewValue;
15480
+ var that = this;
15481
+
15482
+ this.$$parserValid = isUndefined(modelValue) ? undefined : true;
15483
+
15484
+ if (this.$$parserValid) {
15485
+ for (var i = 0; i < this.$parsers.length; i++) {
15486
+ modelValue = this.$parsers[i](modelValue);
15487
+ if (isUndefined(modelValue)) {
15488
+ this.$$parserValid = false;
15489
+ break;
15490
+ }
15491
+ }
15492
+ }
15493
+ if (isNumberNaN(this.$modelValue)) {
15494
+ this.$modelValue = this.$$ngModelGet(this.$$scope);
15495
+ }
15496
+ var prevModelValue = this.$modelValue;
15497
+ var allowInvalid = this.$options.getOption('allowInvalid');
15498
+ this.$$rawModelValue = modelValue;
15499
+
15500
+ if (allowInvalid) {
15501
+ this.$modelValue = modelValue;
15502
+ writeToModelIfNeeded();
15503
+ }
15504
+
15505
+ this.$$runValidators(modelValue, this.$$lastCommittedViewValue, function(allValid) {
15506
+ if (!allowInvalid) {
15507
+ that.$modelValue = allValid ? modelValue : undefined;
15508
+ writeToModelIfNeeded();
15509
+ }
15510
+ });
15511
+
15512
+ function writeToModelIfNeeded() {
15513
+ if (that.$modelValue !== prevModelValue) {
15514
+ that.$$writeModelToScope();
15515
+ }
15516
+ }
15517
+ },
15518
+
15519
+ $$writeModelToScope: function() {
15520
+ this.$$ngModelSet(this.$$scope, this.$modelValue);
15521
+ forEach(this.$viewChangeListeners, function(listener) {
15522
+ try {
15523
+ listener();
15524
+ } catch (e) {
15525
+ this.$$exceptionHandler(e);
15526
+ }
15527
+ }, this);
15528
+ },
15529
+
15530
+ $setViewValue: function(value, trigger) {
15531
+ this.$viewValue = value;
15532
+ if (this.$options.getOption('updateOnDefault')) {
15533
+ this.$$debounceViewValueCommit(trigger);
15534
+ }
15535
+ },
15536
+
15537
+ $$debounceViewValueCommit: function(trigger) {
15538
+ var debounceDelay = this.$options.getOption('debounce');
15539
+
15540
+ if (isNumber(debounceDelay[trigger])) {
15541
+ debounceDelay = debounceDelay[trigger];
15542
+ } else if (isNumber(debounceDelay['default'])) {
15543
+ debounceDelay = debounceDelay['default'];
15544
+ }
15545
+
15546
+ this.$$timeout.cancel(this.$$pendingDebounce);
15547
+ var that = this;
15548
+ if (debounceDelay > 0) {
15549
+ this.$$pendingDebounce = this.$$timeout(function() {
15550
+ that.$commitViewValue();
15551
+ }, debounceDelay);
15552
+ } else if (this.$$scope.$root.$$phase) {
15553
+ this.$commitViewValue();
15554
+ } else {
15555
+ this.$$scope.$apply(function() {
15556
+ that.$commitViewValue();
15557
+ });
15558
+ }
15559
+ }
15560
+ };
15561
+
15562
+ function setupModelWatcher(ctrl) {
15563
+ ctrl.$$scope.$watch(function ngModelWatch() {
15564
+ var modelValue = ctrl.$$ngModelGet(ctrl.$$scope);
15565
+
15566
+ if (modelValue !== ctrl.$modelValue &&
15567
+ (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)
15568
+ ) {
15569
+ ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;
15570
+ ctrl.$$parserValid = undefined;
15571
+
15572
+ var formatters = ctrl.$formatters,
15573
+ idx = formatters.length;
15574
+
15575
+ var viewValue = modelValue;
15576
+ while (idx--) {
15577
+ viewValue = formatters[idx](viewValue);
15578
+ }
15579
+ if (ctrl.$viewValue !== viewValue) {
15580
+ ctrl.$$updateEmptyClasses(viewValue);
15581
+ ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;
15582
+ ctrl.$render();
15583
+
15584
+ ctrl.$$runValidators(ctrl.$modelValue, ctrl.$viewValue, noop);
15585
+ }
15586
+ }
15587
+
15588
+ return modelValue;
15589
+ });
15590
+ }
15591
+
15592
+ addSetValidityMethod({
15593
+ clazz: NgModelController,
15594
+ set: function(object, property) {
15595
+ object[property] = true;
15596
+ },
15597
+ unset: function(object, property) {
15598
+ delete object[property];
15599
+ }
15600
+ });
15601
+
15602
+
15603
+ var ngModelDirective = ['$rootScope', function($rootScope) {
15604
+ return {
15605
+ restrict: 'A',
15606
+ require: ['ngModel', '^?form', '^?ngModelOptions'],
15607
+ controller: NgModelController,
15608
+ priority: 1,
15609
+ compile: function ngModelCompile(element) {
15610
+ element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);
15611
+
15612
+ return {
15613
+ pre: function ngModelPreLink(scope, element, attr, ctrls) {
15614
+ var modelCtrl = ctrls[0],
15615
+ formCtrl = ctrls[1] || modelCtrl.$$parentForm,
15616
+ optionsCtrl = ctrls[2];
15617
+
15618
+ if (optionsCtrl) {
15619
+ modelCtrl.$options = optionsCtrl.$options;
15620
+ }
15621
+
15622
+ modelCtrl.$$initGetterSetters();
15623
+
15624
+ formCtrl.$addControl(modelCtrl);
15625
+
15626
+ attr.$observe('name', function(newValue) {
15627
+ if (modelCtrl.$name !== newValue) {
15628
+ modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
15629
+ }
15630
+ });
15631
+
15632
+ scope.$on('$destroy', function() {
15633
+ modelCtrl.$$parentForm.$removeControl(modelCtrl);
15634
+ });
15635
+ },
15636
+ post: function ngModelPostLink(scope, element, attr, ctrls) {
15637
+ var modelCtrl = ctrls[0];
15638
+ if (modelCtrl.$options.getOption('updateOn')) {
15639
+ element.on(modelCtrl.$options.getOption('updateOn'), function(ev) {
15640
+ modelCtrl.$$debounceViewValueCommit(ev && ev.type);
15641
+ });
15642
+ }
15643
+
15644
+ function setTouched() {
15645
+ modelCtrl.$setTouched();
15646
+ }
15647
+
15648
+ element.on('blur', function() {
15649
+ if (modelCtrl.$touched) return;
15650
+
15651
+ if ($rootScope.$$phase) {
15652
+ scope.$evalAsync(setTouched);
15653
+ } else {
15654
+ scope.$apply(setTouched);
15655
+ }
15656
+ });
15657
+ }
15658
+ };
15659
+ }
15660
+ };
15661
+ }];
15662
+
15663
+ var defaultModelOptions;
15664
+ var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
15665
+
15666
+ function ModelOptions(options) {
15667
+ this.$$options = options;
15668
+ }
15669
+
15670
+ ModelOptions.prototype = {
15671
+
15672
+ getOption: function(name) {
15673
+ return this.$$options[name];
15674
+ },
15675
+
15676
+ createChild: function(options) {
15677
+ var inheritAll = false;
15678
+
15679
+ options = extend({}, options);
15680
+
15681
+ forEach(options, function(option, key) {
15682
+ if (option === '$inherit') {
15683
+ if (key === '*') {
15684
+ inheritAll = true;
15685
+ } else {
15686
+ options[key] = this.$$options[key];
15687
+ if (key === 'updateOn') {
15688
+ options.updateOnDefault = this.$$options.updateOnDefault;
15689
+ }
15690
+ }
15691
+ } else {
15692
+ if (key === 'updateOn') {
15693
+ options.updateOnDefault = false;
15694
+ options[key] = trim(option.replace(DEFAULT_REGEXP, function() {
15695
+ options.updateOnDefault = true;
15696
+ return ' ';
15697
+ }));
15698
+ }
15699
+ }
15700
+ }, this);
15701
+
15702
+ if (inheritAll) {
15703
+ delete options['*'];
15704
+ defaults(options, this.$$options);
15705
+ }
15706
+
15707
+ defaults(options, defaultModelOptions.$$options);
15708
+
15709
+ return new ModelOptions(options);
15710
+ }
15711
+ };
15712
+
15713
+
15714
+ defaultModelOptions = new ModelOptions({
15715
+ updateOn: '',
15716
+ updateOnDefault: true,
15717
+ debounce: 0,
15718
+ getterSetter: false,
15719
+ allowInvalid: false,
15720
+ timezone: null
15721
+ });
15722
+
15723
+
15724
+ var ngModelOptionsDirective = function() {
15725
+ NgModelOptionsController.$inject = ['$attrs', '$scope'];
15726
+ function NgModelOptionsController($attrs, $scope) {
15727
+ this.$$attrs = $attrs;
15728
+ this.$$scope = $scope;
15729
+ }
15730
+ NgModelOptionsController.prototype = {
15731
+ $onInit: function() {
15732
+ var parentOptions = this.parentCtrl ? this.parentCtrl.$options : defaultModelOptions;
15733
+ var modelOptionsDefinition = this.$$scope.$eval(this.$$attrs.ngModelOptions);
15734
+
15735
+ this.$options = parentOptions.createChild(modelOptionsDefinition);
15736
+ }
15737
+ };
15738
+
15739
+ return {
15740
+ restrict: 'A',
15741
+ priority: 10,
15742
+ require: {parentCtrl: '?^^ngModelOptions'},
15743
+ bindToController: true,
15744
+ controller: NgModelOptionsController
15745
+ };
15746
+ };
15747
+
15748
+
15749
+ function defaults(dst, src) {
15750
+ forEach(src, function(value, key) {
15751
+ if (!isDefined(dst[key])) {
15752
+ dst[key] = value;
15753
+ }
15754
+ });
15755
+ }
15756
+
15757
+ var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
15758
+
15759
+
15760
+
15761
+ var ngOptionsMinErr = minErr('ngOptions');
15762
+
15763
+
15764
+ var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
15765
+
15766
+
15767
+ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile, $document, $parse) {
15768
+
15769
+ function parseOptionsExpression(optionsExp, selectElement, scope) {
15770
+
15771
+ var match = optionsExp.match(NG_OPTIONS_REGEXP);
15772
+ if (!(match)) {
15773
+ throw ngOptionsMinErr('iexp',
15774
+ 'Expected expression in form of ' +
15775
+ '\'_select_ (as _label_)? for (_key_,)?_value_ in _collection_\'' +
15776
+ ' but got \'{0}\'. Element: {1}',
15777
+ optionsExp, startingTag(selectElement));
15778
+ }
15779
+
15780
+
15781
+ var valueName = match[5] || match[7];
15782
+ var keyName = match[6];
15783
+
15784
+ var selectAs = / as /.test(match[0]) && match[1];
15785
+ var trackBy = match[9];
15786
+ var valueFn = $parse(match[2] ? match[1] : valueName);
15787
+ var selectAsFn = selectAs && $parse(selectAs);
15788
+ var viewValueFn = selectAsFn || valueFn;
15789
+ var trackByFn = trackBy && $parse(trackBy);
15790
+
15791
+ var getTrackByValueFn = trackBy ?
15792
+ function(value, locals) { return trackByFn(scope, locals); } :
15793
+ function getHashOfValue(value) { return hashKey(value); };
15794
+ var getTrackByValue = function(value, key) {
15795
+ return getTrackByValueFn(value, getLocals(value, key));
15796
+ };
15797
+
15798
+ var displayFn = $parse(match[2] || match[1]);
15799
+ var groupByFn = $parse(match[3] || '');
15800
+ var disableWhenFn = $parse(match[4] || '');
15801
+ var valuesFn = $parse(match[8]);
15802
+
15803
+ var locals = {};
15804
+ var getLocals = keyName ? function(value, key) {
15805
+ locals[keyName] = key;
15806
+ locals[valueName] = value;
15807
+ return locals;
15808
+ } : function(value) {
15809
+ locals[valueName] = value;
15810
+ return locals;
15811
+ };
15812
+
15813
+
15814
+ function Option(selectValue, viewValue, label, group, disabled) {
15815
+ this.selectValue = selectValue;
15816
+ this.viewValue = viewValue;
15817
+ this.label = label;
15818
+ this.group = group;
15819
+ this.disabled = disabled;
15820
+ }
15821
+
15822
+ function getOptionValuesKeys(optionValues) {
15823
+ var optionValuesKeys;
15824
+
15825
+ if (!keyName && isArrayLike(optionValues)) {
15826
+ optionValuesKeys = optionValues;
15827
+ } else {
15828
+ optionValuesKeys = [];
15829
+ for (var itemKey in optionValues) {
15830
+ if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {
15831
+ optionValuesKeys.push(itemKey);
15832
+ }
15833
+ }
15834
+ }
15835
+ return optionValuesKeys;
15836
+ }
15837
+
15838
+ return {
15839
+ trackBy: trackBy,
15840
+ getTrackByValue: getTrackByValue,
15841
+ getWatchables: $parse(valuesFn, function(optionValues) {
15842
+ var watchedArray = [];
15843
+ optionValues = optionValues || [];
15844
+
15845
+ var optionValuesKeys = getOptionValuesKeys(optionValues);
15846
+ var optionValuesLength = optionValuesKeys.length;
15847
+ for (var index = 0; index < optionValuesLength; index++) {
15848
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
15849
+ var value = optionValues[key];
15850
+
15851
+ var locals = getLocals(value, key);
15852
+ var selectValue = getTrackByValueFn(value, locals);
15853
+ watchedArray.push(selectValue);
15854
+
15855
+ if (match[2] || match[1]) {
15856
+ var label = displayFn(scope, locals);
15857
+ watchedArray.push(label);
15858
+ }
15859
+
15860
+ if (match[4]) {
15861
+ var disableWhen = disableWhenFn(scope, locals);
15862
+ watchedArray.push(disableWhen);
15863
+ }
15864
+ }
15865
+ return watchedArray;
15866
+ }),
15867
+
15868
+ getOptions: function() {
15869
+
15870
+ var optionItems = [];
15871
+ var selectValueMap = {};
15872
+
15873
+ var optionValues = valuesFn(scope) || [];
15874
+ var optionValuesKeys = getOptionValuesKeys(optionValues);
15875
+ var optionValuesLength = optionValuesKeys.length;
15876
+
15877
+ for (var index = 0; index < optionValuesLength; index++) {
15878
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
15879
+ var value = optionValues[key];
15880
+ var locals = getLocals(value, key);
15881
+ var viewValue = viewValueFn(scope, locals);
15882
+ var selectValue = getTrackByValueFn(viewValue, locals);
15883
+ var label = displayFn(scope, locals);
15884
+ var group = groupByFn(scope, locals);
15885
+ var disabled = disableWhenFn(scope, locals);
15886
+ var optionItem = new Option(selectValue, viewValue, label, group, disabled);
15887
+
15888
+ optionItems.push(optionItem);
15889
+ selectValueMap[selectValue] = optionItem;
15890
+ }
15891
+
15892
+ return {
15893
+ items: optionItems,
15894
+ selectValueMap: selectValueMap,
15895
+ getOptionFromViewValue: function(value) {
15896
+ return selectValueMap[getTrackByValue(value)];
15897
+ },
15898
+ getViewValueFromOption: function(option) {
15899
+ return trackBy ? copy(option.viewValue) : option.viewValue;
15900
+ }
15901
+ };
15902
+ }
15903
+ };
15904
+ }
15905
+
15906
+
15907
+ var optionTemplate = window.document.createElement('option'),
15908
+ optGroupTemplate = window.document.createElement('optgroup');
15909
+
15910
+ function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
15911
+
15912
+ var selectCtrl = ctrls[0];
15913
+ var ngModelCtrl = ctrls[1];
15914
+ var multiple = attr.multiple;
15915
+
15916
+ for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {
15917
+ if (children[i].value === '') {
15918
+ selectCtrl.hasEmptyOption = true;
15919
+ selectCtrl.emptyOption = children.eq(i);
15920
+ break;
15921
+ }
15922
+ }
15923
+
15924
+ var providedEmptyOption = !!selectCtrl.emptyOption;
15925
+
15926
+ var unknownOption = jqLite(optionTemplate.cloneNode(false));
15927
+ unknownOption.val('?');
15928
+
15929
+ var options;
15930
+ var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);
15931
+ var listFragment = $document[0].createDocumentFragment();
15932
+
15933
+ selectCtrl.generateUnknownOptionValue = function(val) {
15934
+ return '?';
15935
+ };
15936
+
15937
+ if (!multiple) {
15938
+
15939
+ selectCtrl.writeValue = function writeNgOptionsValue(value) {
15940
+ var selectedOption = options.selectValueMap[selectElement.val()];
15941
+ var option = options.getOptionFromViewValue(value);
15942
+
15943
+ if (selectedOption) selectedOption.element.removeAttribute('selected');
15944
+
15945
+ if (option) {
15946
+
15947
+ if (selectElement[0].value !== option.selectValue) {
15948
+ selectCtrl.removeUnknownOption();
15949
+ selectCtrl.unselectEmptyOption();
15950
+
15951
+ selectElement[0].value = option.selectValue;
15952
+ option.element.selected = true;
15953
+ }
15954
+
15955
+ option.element.setAttribute('selected', 'selected');
15956
+ } else {
15957
+
15958
+ if (providedEmptyOption) {
15959
+ selectCtrl.selectEmptyOption();
15960
+ } else if (selectCtrl.unknownOption.parent().length) {
15961
+ selectCtrl.updateUnknownOption(value);
15962
+ } else {
15963
+ selectCtrl.renderUnknownOption(value);
15964
+ }
15965
+ }
15966
+ };
15967
+
15968
+ selectCtrl.readValue = function readNgOptionsValue() {
15969
+
15970
+ var selectedOption = options.selectValueMap[selectElement.val()];
15971
+
15972
+ if (selectedOption && !selectedOption.disabled) {
15973
+ selectCtrl.unselectEmptyOption();
15974
+ selectCtrl.removeUnknownOption();
15975
+ return options.getViewValueFromOption(selectedOption);
15976
+ }
15977
+ return null;
15978
+ };
15979
+
15980
+ if (ngOptions.trackBy) {
15981
+ scope.$watch(
15982
+ function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },
15983
+ function() { ngModelCtrl.$render(); }
15984
+ );
15985
+ }
15986
+
15987
+ } else {
15988
+
15989
+ selectCtrl.writeValue = function writeNgOptionsMultiple(values) {
15990
+
15991
+ var selectedOptions = values && values.map(getAndUpdateSelectedOption) || [];
15992
+
15993
+ options.items.forEach(function(option) {
15994
+ if (option.element.selected && !includes(selectedOptions, option)) {
15995
+ option.element.selected = false;
15996
+ }
15997
+ });
15998
+ };
15999
+
16000
+
16001
+ selectCtrl.readValue = function readNgOptionsMultiple() {
16002
+ var selectedValues = selectElement.val() || [],
16003
+ selections = [];
16004
+
16005
+ forEach(selectedValues, function(value) {
16006
+ var option = options.selectValueMap[value];
16007
+ if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));
16008
+ });
16009
+
16010
+ return selections;
16011
+ };
16012
+
16013
+ if (ngOptions.trackBy) {
16014
+
16015
+ scope.$watchCollection(function() {
16016
+ if (isArray(ngModelCtrl.$viewValue)) {
16017
+ return ngModelCtrl.$viewValue.map(function(value) {
16018
+ return ngOptions.getTrackByValue(value);
16019
+ });
16020
+ }
16021
+ }, function() {
16022
+ ngModelCtrl.$render();
16023
+ });
16024
+
16025
+ }
16026
+ }
16027
+
16028
+ if (providedEmptyOption) {
16029
+
16030
+ selectCtrl.emptyOption.remove();
16031
+
16032
+ $compile(selectCtrl.emptyOption)(scope);
16033
+
16034
+ if (selectCtrl.emptyOption[0].nodeType === NODE_TYPE_COMMENT) {
16035
+ selectCtrl.hasEmptyOption = false;
16036
+
16037
+ selectCtrl.registerOption = function(optionScope, optionEl) {
16038
+ if (optionEl.val() === '') {
16039
+ selectCtrl.hasEmptyOption = true;
16040
+ selectCtrl.emptyOption = optionEl;
16041
+ selectCtrl.emptyOption.removeClass('ng-scope');
16042
+ ngModelCtrl.$render();
16043
+
16044
+ optionEl.on('$destroy', function() {
16045
+ selectCtrl.hasEmptyOption = false;
16046
+ selectCtrl.emptyOption = undefined;
16047
+ });
16048
+ }
16049
+ };
16050
+
16051
+ } else {
16052
+ selectCtrl.emptyOption.removeClass('ng-scope');
16053
+ }
16054
+
16055
+ }
16056
+
16057
+ selectElement.empty();
16058
+
16059
+ updateOptions();
16060
+
16061
+ scope.$watchCollection(ngOptions.getWatchables, updateOptions);
16062
+
16063
+
16064
+ function addOptionElement(option, parent) {
16065
+ var optionElement = optionTemplate.cloneNode(false);
16066
+ parent.appendChild(optionElement);
16067
+ updateOptionElement(option, optionElement);
16068
+ }
16069
+
16070
+ function getAndUpdateSelectedOption(viewValue) {
16071
+ var option = options.getOptionFromViewValue(viewValue);
16072
+ var element = option && option.element;
16073
+
16074
+ if (element && !element.selected) element.selected = true;
16075
+
16076
+ return option;
16077
+ }
16078
+
16079
+ function updateOptionElement(option, element) {
16080
+ option.element = element;
16081
+ element.disabled = option.disabled;
16082
+ if (option.label !== element.label) {
16083
+ element.label = option.label;
16084
+ element.textContent = option.label;
16085
+ }
16086
+ element.value = option.selectValue;
16087
+ }
16088
+
16089
+ function updateOptions() {
16090
+ var previousValue = options && selectCtrl.readValue();
16091
+
16092
+ if (options) {
16093
+
16094
+ for (var i = options.items.length - 1; i >= 0; i--) {
16095
+ var option = options.items[i];
16096
+ if (isDefined(option.group)) {
16097
+ jqLiteRemove(option.element.parentNode);
16098
+ } else {
16099
+ jqLiteRemove(option.element);
16100
+ }
16101
+ }
16102
+ }
16103
+
16104
+ options = ngOptions.getOptions();
16105
+
16106
+ var groupElementMap = {};
16107
+
16108
+ if (providedEmptyOption) {
16109
+ selectElement.prepend(selectCtrl.emptyOption);
16110
+ }
16111
+
16112
+ options.items.forEach(function addOption(option) {
16113
+ var groupElement;
16114
+
16115
+ if (isDefined(option.group)) {
16116
+
16117
+ groupElement = groupElementMap[option.group];
16118
+
16119
+ if (!groupElement) {
16120
+
16121
+ groupElement = optGroupTemplate.cloneNode(false);
16122
+ listFragment.appendChild(groupElement);
16123
+
16124
+ groupElement.label = option.group === null ? 'null' : option.group;
16125
+
16126
+ groupElementMap[option.group] = groupElement;
16127
+ }
16128
+
16129
+ addOptionElement(option, groupElement);
16130
+
16131
+ } else {
16132
+
16133
+ addOptionElement(option, listFragment);
16134
+ }
16135
+ });
16136
+
16137
+ selectElement[0].appendChild(listFragment);
16138
+
16139
+ ngModelCtrl.$render();
16140
+
16141
+ if (!ngModelCtrl.$isEmpty(previousValue)) {
16142
+ var nextValue = selectCtrl.readValue();
16143
+ var isNotPrimitive = ngOptions.trackBy || multiple;
16144
+ if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) {
16145
+ ngModelCtrl.$setViewValue(nextValue);
16146
+ ngModelCtrl.$render();
16147
+ }
16148
+ }
16149
+
16150
+ }
16151
+ }
16152
+
16153
+ return {
16154
+ restrict: 'A',
16155
+ terminal: true,
16156
+ require: ['select', 'ngModel'],
16157
+ link: {
16158
+ pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
16159
+ ctrls[0].registerOption = noop;
16160
+ },
16161
+ post: ngOptionsPostLink
16162
+ }
16163
+ };
16164
+ }];
16165
+
16166
+ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {
16167
+ var BRACE = /{}/g,
16168
+ IS_WHEN = /^when(Minus)?(.+)$/;
16169
+
16170
+ return {
16171
+ link: function(scope, element, attr) {
16172
+ var numberExp = attr.count,
16173
+ whenExp = attr.$attr.when && element.attr(attr.$attr.when),
16174
+ offset = attr.offset || 0,
16175
+ whens = scope.$eval(whenExp) || {},
16176
+ whensExpFns = {},
16177
+ startSymbol = $interpolate.startSymbol(),
16178
+ endSymbol = $interpolate.endSymbol(),
16179
+ braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,
16180
+ watchRemover = angular.noop,
16181
+ lastCount;
16182
+
16183
+ forEach(attr, function(expression, attributeName) {
16184
+ var tmpMatch = IS_WHEN.exec(attributeName);
16185
+ if (tmpMatch) {
16186
+ var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);
16187
+ whens[whenKey] = element.attr(attr.$attr[attributeName]);
16188
+ }
16189
+ });
16190
+ forEach(whens, function(expression, key) {
16191
+ whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));
16192
+
16193
+ });
16194
+
16195
+ scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {
16196
+ var count = parseFloat(newVal);
16197
+ var countIsNaN = isNumberNaN(count);
16198
+
16199
+ if (!countIsNaN && !(count in whens)) {
16200
+ count = $locale.pluralCat(count - offset);
16201
+ }
16202
+
16203
+ if ((count !== lastCount) && !(countIsNaN && isNumberNaN(lastCount))) {
16204
+ watchRemover();
16205
+ var whenExpFn = whensExpFns[count];
16206
+ if (isUndefined(whenExpFn)) {
16207
+ if (newVal != null) {
16208
+ $log.debug('ngPluralize: no rule defined for \'' + count + '\' in ' + whenExp);
16209
+ }
16210
+ watchRemover = noop;
16211
+ updateElementText();
16212
+ } else {
16213
+ watchRemover = scope.$watch(whenExpFn, updateElementText);
16214
+ }
16215
+ lastCount = count;
16216
+ }
16217
+ });
16218
+
16219
+ function updateElementText(newText) {
16220
+ element.text(newText || '');
16221
+ }
16222
+ }
16223
+ };
16224
+ }];
16225
+
16226
+
16227
+ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $animate, $compile) {
16228
+ var NG_REMOVED = '$$NG_REMOVED';
16229
+ var ngRepeatMinErr = minErr('ngRepeat');
16230
+
16231
+ var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
16232
+ scope[valueIdentifier] = value;
16233
+ if (keyIdentifier) scope[keyIdentifier] = key;
16234
+ scope.$index = index;
16235
+ scope.$first = (index === 0);
16236
+ scope.$last = (index === (arrayLength - 1));
16237
+ scope.$middle = !(scope.$first || scope.$last);
16238
+ scope.$odd = !(scope.$even = (index & 1) === 0);
16239
+ };
16240
+
16241
+ var getBlockStart = function(block) {
16242
+ return block.clone[0];
16243
+ };
16244
+
16245
+ var getBlockEnd = function(block) {
16246
+ return block.clone[block.clone.length - 1];
16247
+ };
16248
+
16249
+
16250
+ return {
16251
+ restrict: 'A',
16252
+ multiElement: true,
16253
+ transclude: 'element',
16254
+ priority: 1000,
16255
+ terminal: true,
16256
+ $$tlb: true,
16257
+ compile: function ngRepeatCompile($element, $attr) {
16258
+ var expression = $attr.ngRepeat;
16259
+ var ngRepeatEndComment = $compile.$$createComment('end ngRepeat', expression);
16260
+
16261
+ var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
16262
+
16263
+ if (!match) {
16264
+ throw ngRepeatMinErr('iexp', 'Expected expression in form of \'_item_ in _collection_[ track by _id_]\' but got \'{0}\'.',
16265
+ expression);
16266
+ }
16267
+
16268
+ var lhs = match[1];
16269
+ var rhs = match[2];
16270
+ var aliasAs = match[3];
16271
+ var trackByExp = match[4];
16272
+
16273
+ match = lhs.match(/^(?:(\s*[$\w]+)|\(\s*([$\w]+)\s*,\s*([$\w]+)\s*\))$/);
16274
+
16275
+ if (!match) {
16276
+ throw ngRepeatMinErr('iidexp', '\'_item_\' in \'_item_ in _collection_\' should be an identifier or \'(_key_, _value_)\' expression, but got \'{0}\'.',
16277
+ lhs);
16278
+ }
16279
+ var valueIdentifier = match[3] || match[1];
16280
+ var keyIdentifier = match[2];
16281
+
16282
+ if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||
16283
+ /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) {
16284
+ throw ngRepeatMinErr('badident', 'alias \'{0}\' is invalid --- must be a valid JS identifier which is not a reserved name.',
16285
+ aliasAs);
16286
+ }
16287
+
16288
+ var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;
16289
+ var hashFnLocals = {$id: hashKey};
16290
+
16291
+ if (trackByExp) {
16292
+ trackByExpGetter = $parse(trackByExp);
16293
+ } else {
16294
+ trackByIdArrayFn = function(key, value) {
16295
+ return hashKey(value);
16296
+ };
16297
+ trackByIdObjFn = function(key) {
16298
+ return key;
16299
+ };
16300
+ }
16301
+
16302
+ return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {
16303
+
16304
+ if (trackByExpGetter) {
16305
+ trackByIdExpFn = function(key, value, index) {
16306
+ if (keyIdentifier) hashFnLocals[keyIdentifier] = key;
16307
+ hashFnLocals[valueIdentifier] = value;
16308
+ hashFnLocals.$index = index;
16309
+ return trackByExpGetter($scope, hashFnLocals);
16310
+ };
16311
+ }
16312
+
16313
+ var lastBlockMap = createMap();
16314
+
16315
+ $scope.$watchCollection(rhs, function ngRepeatAction(collection) {
16316
+ var index, length,
16317
+ previousNode = $element[0],
16318
+ nextNode,
16319
+ nextBlockMap = createMap(),
16320
+ collectionLength,
16321
+ key, value,
16322
+ trackById,
16323
+ trackByIdFn,
16324
+ collectionKeys,
16325
+ block,
16326
+ nextBlockOrder,
16327
+ elementsToRemove;
16328
+
16329
+ if (aliasAs) {
16330
+ $scope[aliasAs] = collection;
16331
+ }
16332
+
16333
+ if (isArrayLike(collection)) {
16334
+ collectionKeys = collection;
16335
+ trackByIdFn = trackByIdExpFn || trackByIdArrayFn;
16336
+ } else {
16337
+ trackByIdFn = trackByIdExpFn || trackByIdObjFn;
16338
+ collectionKeys = [];
16339
+ for (var itemKey in collection) {
16340
+ if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {
16341
+ collectionKeys.push(itemKey);
16342
+ }
16343
+ }
16344
+ }
16345
+
16346
+ collectionLength = collectionKeys.length;
16347
+ nextBlockOrder = new Array(collectionLength);
16348
+
16349
+ for (index = 0; index < collectionLength; index++) {
16350
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
16351
+ value = collection[key];
16352
+ trackById = trackByIdFn(key, value, index);
16353
+ if (lastBlockMap[trackById]) {
16354
+ block = lastBlockMap[trackById];
16355
+ delete lastBlockMap[trackById];
16356
+ nextBlockMap[trackById] = block;
16357
+ nextBlockOrder[index] = block;
16358
+ } else if (nextBlockMap[trackById]) {
16359
+ forEach(nextBlockOrder, function(block) {
16360
+ if (block && block.scope) lastBlockMap[block.id] = block;
16361
+ });
16362
+ throw ngRepeatMinErr('dupes',
16363
+ 'Duplicates in a repeater are not allowed. Use \'track by\' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}',
16364
+ expression, trackById, value);
16365
+ } else {
16366
+ nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};
16367
+ nextBlockMap[trackById] = true;
16368
+ }
16369
+ }
16370
+
16371
+ for (var blockKey in lastBlockMap) {
16372
+ block = lastBlockMap[blockKey];
16373
+ elementsToRemove = getBlockNodes(block.clone);
16374
+ $animate.leave(elementsToRemove);
16375
+ if (elementsToRemove[0].parentNode) {
16376
+ for (index = 0, length = elementsToRemove.length; index < length; index++) {
16377
+ elementsToRemove[index][NG_REMOVED] = true;
16378
+ }
16379
+ }
16380
+ block.scope.$destroy();
16381
+ }
16382
+
16383
+ for (index = 0; index < collectionLength; index++) {
16384
+ key = (collection === collectionKeys) ? index : collectionKeys[index];
16385
+ value = collection[key];
16386
+ block = nextBlockOrder[index];
16387
+
16388
+ if (block.scope) {
16389
+
16390
+ nextNode = previousNode;
16391
+
16392
+ do {
16393
+ nextNode = nextNode.nextSibling;
16394
+ } while (nextNode && nextNode[NG_REMOVED]);
16395
+
16396
+ if (getBlockStart(block) !== nextNode) {
16397
+ $animate.move(getBlockNodes(block.clone), null, previousNode);
16398
+ }
16399
+ previousNode = getBlockEnd(block);
16400
+ updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
16401
+ } else {
16402
+ $transclude(function ngRepeatTransclude(clone, scope) {
16403
+ block.scope = scope;
16404
+ var endNode = ngRepeatEndComment.cloneNode(false);
16405
+ clone[clone.length++] = endNode;
16406
+
16407
+ $animate.enter(clone, null, previousNode);
16408
+ previousNode = endNode;
16409
+ block.clone = clone;
16410
+ nextBlockMap[block.id] = block;
16411
+ updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
16412
+ });
16413
+ }
16414
+ }
16415
+ lastBlockMap = nextBlockMap;
16416
+ });
16417
+ };
16418
+ }
16419
+ };
16420
+ }];
16421
+
16422
+ var NG_HIDE_CLASS = 'ng-hide';
16423
+ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
16424
+ var ngShowDirective = ['$animate', function($animate) {
16425
+ return {
16426
+ restrict: 'A',
16427
+ multiElement: true,
16428
+ link: function(scope, element, attr) {
16429
+ scope.$watch(attr.ngShow, function ngShowWatchAction(value) {
16430
+ $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {
16431
+ tempClasses: NG_HIDE_IN_PROGRESS_CLASS
16432
+ });
16433
+ });
16434
+ }
16435
+ };
16436
+ }];
16437
+
16438
+
16439
+ var ngHideDirective = ['$animate', function($animate) {
16440
+ return {
16441
+ restrict: 'A',
16442
+ multiElement: true,
16443
+ link: function(scope, element, attr) {
16444
+ scope.$watch(attr.ngHide, function ngHideWatchAction(value) {
16445
+ $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {
16446
+ tempClasses: NG_HIDE_IN_PROGRESS_CLASS
16447
+ });
16448
+ });
16449
+ }
16450
+ };
16451
+ }];
16452
+
16453
+ var ngStyleDirective = ngDirective(function(scope, element, attr) {
16454
+ scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
16455
+ if (oldStyles && (newStyles !== oldStyles)) {
16456
+ forEach(oldStyles, function(val, style) { element.css(style, '');});
16457
+ }
16458
+ if (newStyles) element.css(newStyles);
16459
+ }, true);
16460
+ });
16461
+
16462
+ var ngSwitchDirective = ['$animate', '$compile', function($animate, $compile) {
16463
+ return {
16464
+ require: 'ngSwitch',
16465
+
16466
+ controller: ['$scope', function NgSwitchController() {
16467
+ this.cases = {};
16468
+ }],
16469
+ link: function(scope, element, attr, ngSwitchController) {
16470
+ var watchExpr = attr.ngSwitch || attr.on,
16471
+ selectedTranscludes = [],
16472
+ selectedElements = [],
16473
+ previousLeaveAnimations = [],
16474
+ selectedScopes = [];
16475
+
16476
+ var spliceFactory = function(array, index) {
16477
+ return function(response) {
16478
+ if (response !== false) array.splice(index, 1);
16479
+ };
16480
+ };
16481
+
16482
+ scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
16483
+ var i, ii;
16484
+
16485
+ while (previousLeaveAnimations.length) {
16486
+ $animate.cancel(previousLeaveAnimations.pop());
16487
+ }
16488
+
16489
+ for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
16490
+ var selected = getBlockNodes(selectedElements[i].clone);
16491
+ selectedScopes[i].$destroy();
16492
+ var runner = previousLeaveAnimations[i] = $animate.leave(selected);
16493
+ runner.done(spliceFactory(previousLeaveAnimations, i));
16494
+ }
16495
+
16496
+ selectedElements.length = 0;
16497
+ selectedScopes.length = 0;
16498
+
16499
+ if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {
16500
+ forEach(selectedTranscludes, function(selectedTransclude) {
16501
+ selectedTransclude.transclude(function(caseElement, selectedScope) {
16502
+ selectedScopes.push(selectedScope);
16503
+ var anchor = selectedTransclude.element;
16504
+ caseElement[caseElement.length++] = $compile.$$createComment('end ngSwitchWhen');
16505
+ var block = { clone: caseElement };
16506
+
16507
+ selectedElements.push(block);
16508
+ $animate.enter(caseElement, anchor.parent(), anchor);
16509
+ });
16510
+ });
16511
+ }
16512
+ });
16513
+ }
16514
+ };
16515
+ }];
16516
+
16517
+ var ngSwitchWhenDirective = ngDirective({
16518
+ transclude: 'element',
16519
+ priority: 1200,
16520
+ require: '^ngSwitch',
16521
+ multiElement: true,
16522
+ link: function(scope, element, attrs, ctrl, $transclude) {
16523
+
16524
+ var cases = attrs.ngSwitchWhen.split(attrs.ngSwitchWhenSeparator).sort().filter(
16525
+ function(element, index, array) { return array[index - 1] !== element; }
16526
+ );
16527
+
16528
+ forEach(cases, function(whenCase) {
16529
+ ctrl.cases['!' + whenCase] = (ctrl.cases['!' + whenCase] || []);
16530
+ ctrl.cases['!' + whenCase].push({ transclude: $transclude, element: element });
16531
+ });
16532
+ }
16533
+ });
16534
+
16535
+ var ngSwitchDefaultDirective = ngDirective({
16536
+ transclude: 'element',
16537
+ priority: 1200,
16538
+ require: '^ngSwitch',
16539
+ multiElement: true,
16540
+ link: function(scope, element, attr, ctrl, $transclude) {
16541
+ ctrl.cases['?'] = (ctrl.cases['?'] || []);
16542
+ ctrl.cases['?'].push({ transclude: $transclude, element: element });
16543
+ }
16544
+ });
16545
+
16546
+ var ngTranscludeMinErr = minErr('ngTransclude');
16547
+ var ngTranscludeDirective = ['$compile', function($compile) {
16548
+ return {
16549
+ restrict: 'EAC',
16550
+ terminal: true,
16551
+ compile: function ngTranscludeCompile(tElement) {
16552
+
16553
+ var fallbackLinkFn = $compile(tElement.contents());
16554
+ tElement.empty();
16555
+
16556
+ return function ngTranscludePostLink($scope, $element, $attrs, controller, $transclude) {
16557
+
16558
+ if (!$transclude) {
16559
+ throw ngTranscludeMinErr('orphan',
16560
+ 'Illegal use of ngTransclude directive in the template! ' +
16561
+ 'No parent directive that requires a transclusion found. ' +
16562
+ 'Element: {0}',
16563
+ startingTag($element));
16564
+ }
16565
+
16566
+
16567
+ if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {
16568
+ $attrs.ngTransclude = '';
16569
+ }
16570
+ var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;
16571
+
16572
+ $transclude(ngTranscludeCloneAttachFn, null, slotName);
16573
+
16574
+ if (slotName && !$transclude.isSlotFilled(slotName)) {
16575
+ useFallbackContent();
16576
+ }
16577
+
16578
+ function ngTranscludeCloneAttachFn(clone, transcludedScope) {
16579
+ if (clone.length && notWhitespace(clone)) {
16580
+ $element.append(clone);
16581
+ } else {
16582
+ useFallbackContent();
16583
+ transcludedScope.$destroy();
16584
+ }
16585
+ }
16586
+
16587
+ function useFallbackContent() {
16588
+ fallbackLinkFn($scope, function(clone) {
16589
+ $element.append(clone);
16590
+ });
16591
+ }
16592
+
16593
+ function notWhitespace(nodes) {
16594
+ for (var i = 0, ii = nodes.length; i < ii; i++) {
16595
+ var node = nodes[i];
16596
+ if (node.nodeType !== NODE_TYPE_TEXT || node.nodeValue.trim()) {
16597
+ return true;
16598
+ }
16599
+ }
16600
+ }
16601
+ };
16602
+ }
16603
+ };
16604
+ }];
16605
+
16606
+ var scriptDirective = ['$templateCache', function($templateCache) {
16607
+ return {
16608
+ restrict: 'E',
16609
+ terminal: true,
16610
+ compile: function(element, attr) {
16611
+ if (attr.type === 'text/ng-template') {
16612
+ var templateUrl = attr.id,
16613
+ text = element[0].text;
16614
+
16615
+ $templateCache.put(templateUrl, text);
16616
+ }
16617
+ }
16618
+ };
16619
+ }];
16620
+
16621
+
16622
+ var noopNgModelController = { $setViewValue: noop, $render: noop };
16623
+
16624
+ var SelectController =
16625
+ ['$element', '$scope', function($element, $scope) {
16626
+
16627
+ var self = this,
16628
+ optionsMap = new HashMap();
16629
+
16630
+ self.selectValueMap = {};
16631
+
16632
+ self.ngModelCtrl = noopNgModelController;
16633
+ self.multiple = false;
16634
+
16635
+ self.unknownOption = jqLite(window.document.createElement('option'));
16636
+
16637
+ self.hasEmptyOption = false;
16638
+ self.emptyOption = undefined;
16639
+
16640
+ self.renderUnknownOption = function(val) {
16641
+ var unknownVal = self.generateUnknownOptionValue(val);
16642
+ self.unknownOption.val(unknownVal);
16643
+ $element.prepend(self.unknownOption);
16644
+ setOptionAsSelected(self.unknownOption);
16645
+ $element.val(unknownVal);
16646
+ };
16647
+
16648
+ self.updateUnknownOption = function(val) {
16649
+ var unknownVal = self.generateUnknownOptionValue(val);
16650
+ self.unknownOption.val(unknownVal);
16651
+ setOptionAsSelected(self.unknownOption);
16652
+ $element.val(unknownVal);
16653
+ };
16654
+
16655
+ self.generateUnknownOptionValue = function(val) {
16656
+ return '? ' + hashKey(val) + ' ?';
16657
+ };
16658
+
16659
+ self.removeUnknownOption = function() {
16660
+ if (self.unknownOption.parent()) self.unknownOption.remove();
16661
+ };
16662
+
16663
+ self.selectEmptyOption = function() {
16664
+ if (self.emptyOption) {
16665
+ $element.val('');
16666
+ setOptionAsSelected(self.emptyOption);
16667
+ }
16668
+ };
16669
+
16670
+ self.unselectEmptyOption = function() {
16671
+ if (self.hasEmptyOption) {
16672
+ self.emptyOption.removeAttr('selected');
16673
+ }
16674
+ };
16675
+
16676
+ $scope.$on('$destroy', function() {
16677
+ self.renderUnknownOption = noop;
16678
+ });
16679
+
16680
+ self.readValue = function readSingleValue() {
16681
+ var val = $element.val();
16682
+ var realVal = val in self.selectValueMap ? self.selectValueMap[val] : val;
16683
+
16684
+ if (self.hasOption(realVal)) {
16685
+ return realVal;
16686
+ }
16687
+
16688
+ return null;
16689
+ };
16690
+
16691
+
16692
+ self.writeValue = function writeSingleValue(value) {
16693
+ var currentlySelectedOption = $element[0].options[$element[0].selectedIndex];
16694
+ if (currentlySelectedOption) currentlySelectedOption.removeAttribute('selected');
16695
+
16696
+ if (self.hasOption(value)) {
16697
+ self.removeUnknownOption();
16698
+
16699
+ var hashedVal = hashKey(value);
16700
+ $element.val(hashedVal in self.selectValueMap ? hashedVal : value);
16701
+
16702
+ var selectedOption = $element[0].options[$element[0].selectedIndex];
16703
+ setOptionAsSelected(jqLite(selectedOption));
16704
+ } else {
16705
+ if (value == null && self.emptyOption) {
16706
+ self.removeUnknownOption();
16707
+ self.selectEmptyOption();
16708
+ } else if (self.unknownOption.parent().length) {
16709
+ self.updateUnknownOption(value);
16710
+ } else {
16711
+ self.renderUnknownOption(value);
16712
+ }
16713
+ }
16714
+ };
16715
+
16716
+
16717
+ self.addOption = function(value, element) {
16718
+ if (element[0].nodeType === NODE_TYPE_COMMENT) return;
16719
+
16720
+ assertNotHasOwnProperty(value, '"option value"');
16721
+ if (value === '') {
16722
+ self.hasEmptyOption = true;
16723
+ self.emptyOption = element;
16724
+ }
16725
+ var count = optionsMap.get(value) || 0;
16726
+ optionsMap.put(value, count + 1);
16727
+ scheduleRender();
16728
+ };
16729
+
16730
+ self.removeOption = function(value) {
16731
+ var count = optionsMap.get(value);
16732
+ if (count) {
16733
+ if (count === 1) {
16734
+ optionsMap.remove(value);
16735
+ if (value === '') {
16736
+ self.hasEmptyOption = false;
16737
+ self.emptyOption = undefined;
16738
+ }
16739
+ } else {
16740
+ optionsMap.put(value, count - 1);
16741
+ }
16742
+ }
16743
+ };
16744
+
16745
+ self.hasOption = function(value) {
16746
+ return !!optionsMap.get(value);
16747
+ };
16748
+
16749
+
16750
+ var renderScheduled = false;
16751
+ function scheduleRender() {
16752
+ if (renderScheduled) return;
16753
+ renderScheduled = true;
16754
+ $scope.$$postDigest(function() {
16755
+ renderScheduled = false;
16756
+ self.ngModelCtrl.$render();
16757
+ });
16758
+ }
16759
+
16760
+ var updateScheduled = false;
16761
+ function scheduleViewValueUpdate(renderAfter) {
16762
+ if (updateScheduled) return;
16763
+
16764
+ updateScheduled = true;
16765
+
16766
+ $scope.$$postDigest(function() {
16767
+ if ($scope.$$destroyed) return;
16768
+
16769
+ updateScheduled = false;
16770
+ self.ngModelCtrl.$setViewValue(self.readValue());
16771
+ if (renderAfter) self.ngModelCtrl.$render();
16772
+ });
16773
+ }
16774
+
16775
+
16776
+ self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
16777
+
16778
+ if (optionAttrs.$attr.ngValue) {
16779
+ var oldVal, hashedVal = NaN;
16780
+ optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {
16781
+
16782
+ var removal;
16783
+ var previouslySelected = optionElement.prop('selected');
16784
+
16785
+ if (isDefined(hashedVal)) {
16786
+ self.removeOption(oldVal);
16787
+ delete self.selectValueMap[hashedVal];
16788
+ removal = true;
16789
+ }
16790
+
16791
+ hashedVal = hashKey(newVal);
16792
+ oldVal = newVal;
16793
+ self.selectValueMap[hashedVal] = newVal;
16794
+ self.addOption(newVal, optionElement);
16795
+ optionElement.attr('value', hashedVal);
16796
+
16797
+ if (removal && previouslySelected) {
16798
+ scheduleViewValueUpdate();
16799
+ }
16800
+
16801
+ });
16802
+ } else if (interpolateValueFn) {
16803
+ optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {
16804
+ self.readValue();
16805
+
16806
+ var removal;
16807
+ var previouslySelected = optionElement.prop('selected');
16808
+
16809
+ if (isDefined(oldVal)) {
16810
+ self.removeOption(oldVal);
16811
+ removal = true;
16812
+ }
16813
+ oldVal = newVal;
16814
+ self.addOption(newVal, optionElement);
16815
+
16816
+ if (removal && previouslySelected) {
16817
+ scheduleViewValueUpdate();
16818
+ }
16819
+ });
16820
+ } else if (interpolateTextFn) {
16821
+ optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {
16822
+ optionAttrs.$set('value', newVal);
16823
+ var previouslySelected = optionElement.prop('selected');
16824
+ if (oldVal !== newVal) {
16825
+ self.removeOption(oldVal);
16826
+ }
16827
+ self.addOption(newVal, optionElement);
16828
+
16829
+ if (oldVal && previouslySelected) {
16830
+ scheduleViewValueUpdate();
16831
+ }
16832
+ });
16833
+ } else {
16834
+ self.addOption(optionAttrs.value, optionElement);
16835
+ }
16836
+
16837
+
16838
+ optionAttrs.$observe('disabled', function(newVal) {
16839
+
16840
+
16841
+ if (newVal === 'true' || newVal && optionElement.prop('selected')) {
16842
+ if (self.multiple) {
16843
+ scheduleViewValueUpdate(true);
16844
+ } else {
16845
+ self.ngModelCtrl.$setViewValue(null);
16846
+ self.ngModelCtrl.$render();
16847
+ }
16848
+ }
16849
+ });
16850
+
16851
+ optionElement.on('$destroy', function() {
16852
+ var currentValue = self.readValue();
16853
+ var removeValue = optionAttrs.value;
16854
+
16855
+ self.removeOption(removeValue);
16856
+ self.ngModelCtrl.$render();
16857
+
16858
+ if (self.multiple && currentValue && currentValue.indexOf(removeValue) !== -1 ||
16859
+ currentValue === removeValue
16860
+ ) {
16861
+ scheduleViewValueUpdate(true);
16862
+ }
16863
+ });
16864
+ };
16865
+
16866
+ function setOptionAsSelected(optionEl) {
16867
+ optionEl.prop('selected', true);
16868
+ optionEl.attr('selected', true);
16869
+ }
16870
+ }];
16871
+
16872
+ var selectDirective = function() {
16873
+
16874
+ return {
16875
+ restrict: 'E',
16876
+ require: ['select', '?ngModel'],
16877
+ controller: SelectController,
16878
+ priority: 1,
16879
+ link: {
16880
+ pre: selectPreLink,
16881
+ post: selectPostLink
16882
+ }
16883
+ };
16884
+
16885
+ function selectPreLink(scope, element, attr, ctrls) {
16886
+
16887
+ var selectCtrl = ctrls[0];
16888
+ var ngModelCtrl = ctrls[1];
16889
+
16890
+ if (!ngModelCtrl) {
16891
+ selectCtrl.registerOption = noop;
16892
+ return;
16893
+ }
16894
+
16895
+
16896
+ selectCtrl.ngModelCtrl = ngModelCtrl;
16897
+
16898
+ element.on('change', function() {
16899
+ selectCtrl.removeUnknownOption();
16900
+ scope.$apply(function() {
16901
+ ngModelCtrl.$setViewValue(selectCtrl.readValue());
16902
+ });
16903
+ });
16904
+
16905
+ if (attr.multiple) {
16906
+ selectCtrl.multiple = true;
16907
+
16908
+ selectCtrl.readValue = function readMultipleValue() {
16909
+ var array = [];
16910
+ forEach(element.find('option'), function(option) {
16911
+ if (option.selected && !option.disabled) {
16912
+ var val = option.value;
16913
+ array.push(val in selectCtrl.selectValueMap ? selectCtrl.selectValueMap[val] : val);
16914
+ }
16915
+ });
16916
+ return array;
16917
+ };
16918
+
16919
+ selectCtrl.writeValue = function writeMultipleValue(value) {
16920
+ var items = new HashMap(value);
16921
+ forEach(element.find('option'), function(option) {
16922
+ option.selected = isDefined(items.get(option.value)) || isDefined(items.get(selectCtrl.selectValueMap[option.value]));
16923
+ });
16924
+ };
16925
+
16926
+ var lastView, lastViewRef = NaN;
16927
+ scope.$watch(function selectMultipleWatch() {
16928
+ if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {
16929
+ lastView = shallowCopy(ngModelCtrl.$viewValue);
16930
+ ngModelCtrl.$render();
16931
+ }
16932
+ lastViewRef = ngModelCtrl.$viewValue;
16933
+ });
16934
+
16935
+ ngModelCtrl.$isEmpty = function(value) {
16936
+ return !value || value.length === 0;
16937
+ };
16938
+
16939
+ }
16940
+ }
16941
+
16942
+ function selectPostLink(scope, element, attrs, ctrls) {
16943
+ var ngModelCtrl = ctrls[1];
16944
+ if (!ngModelCtrl) return;
16945
+
16946
+ var selectCtrl = ctrls[0];
16947
+
16948
+ ngModelCtrl.$render = function() {
16949
+ selectCtrl.writeValue(ngModelCtrl.$viewValue);
16950
+ };
16951
+ }
16952
+ };
16953
+
16954
+
16955
+ var optionDirective = ['$interpolate', function($interpolate) {
16956
+ return {
16957
+ restrict: 'E',
16958
+ priority: 100,
16959
+ compile: function(element, attr) {
16960
+ var interpolateValueFn, interpolateTextFn;
16961
+
16962
+ if (isDefined(attr.ngValue)) {
16963
+ } else if (isDefined(attr.value)) {
16964
+ interpolateValueFn = $interpolate(attr.value, true);
16965
+ } else {
16966
+ interpolateTextFn = $interpolate(element.text(), true);
16967
+ if (!interpolateTextFn) {
16968
+ attr.$set('value', element.text());
16969
+ }
16970
+ }
16971
+
16972
+ return function(scope, element, attr) {
16973
+ var selectCtrlName = '$selectController',
16974
+ parent = element.parent(),
16975
+ selectCtrl = parent.data(selectCtrlName) ||
16976
+ parent.parent().data(selectCtrlName);
16977
+
16978
+ if (selectCtrl) {
16979
+ selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);
16980
+ }
16981
+ };
16982
+ }
16983
+ };
16984
+ }];
16985
+
16986
+ var requiredDirective = function() {
16987
+ return {
16988
+ restrict: 'A',
16989
+ require: '?ngModel',
16990
+ link: function(scope, elm, attr, ctrl) {
16991
+ if (!ctrl) return;
16992
+ attr.required = true;
16993
+
16994
+ ctrl.$validators.required = function(modelValue, viewValue) {
16995
+ return !attr.required || !ctrl.$isEmpty(viewValue);
16996
+ };
16997
+
16998
+ attr.$observe('required', function() {
16999
+ ctrl.$validate();
17000
+ });
17001
+ }
17002
+ };
17003
+ };
17004
+
17005
+ var patternDirective = function() {
17006
+ return {
17007
+ restrict: 'A',
17008
+ require: '?ngModel',
17009
+ link: function(scope, elm, attr, ctrl) {
17010
+ if (!ctrl) return;
17011
+
17012
+ var regexp, patternExp = attr.ngPattern || attr.pattern;
17013
+ attr.$observe('pattern', function(regex) {
17014
+ if (isString(regex) && regex.length > 0) {
17015
+ regex = new RegExp('^' + regex + '$');
17016
+ }
17017
+
17018
+ if (regex && !regex.test) {
17019
+ throw minErr('ngPattern')('noregexp',
17020
+ 'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,
17021
+ regex, startingTag(elm));
17022
+ }
17023
+
17024
+ regexp = regex || undefined;
17025
+ ctrl.$validate();
17026
+ });
17027
+
17028
+ ctrl.$validators.pattern = function(modelValue, viewValue) {
17029
+ return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);
17030
+ };
17031
+ }
17032
+ };
17033
+ };
17034
+
17035
+ var maxlengthDirective = function() {
17036
+ return {
17037
+ restrict: 'A',
17038
+ require: '?ngModel',
17039
+ link: function(scope, elm, attr, ctrl) {
17040
+ if (!ctrl) return;
17041
+
17042
+ var maxlength = -1;
17043
+ attr.$observe('maxlength', function(value) {
17044
+ var intVal = toInt(value);
17045
+ maxlength = isNumberNaN(intVal) ? -1 : intVal;
17046
+ ctrl.$validate();
17047
+ });
17048
+ ctrl.$validators.maxlength = function(modelValue, viewValue) {
17049
+ return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);
17050
+ };
17051
+ }
17052
+ };
17053
+ };
17054
+
17055
+ var minlengthDirective = function() {
17056
+ return {
17057
+ restrict: 'A',
17058
+ require: '?ngModel',
17059
+ link: function(scope, elm, attr, ctrl) {
17060
+ if (!ctrl) return;
17061
+
17062
+ var minlength = 0;
17063
+ attr.$observe('minlength', function(value) {
17064
+ minlength = toInt(value) || 0;
17065
+ ctrl.$validate();
17066
+ });
17067
+ ctrl.$validators.minlength = function(modelValue, viewValue) {
17068
+ return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
17069
+ };
17070
+ }
17071
+ };
17072
+ };
17073
+
17074
+ if (window.angular.bootstrap) {
17075
+ if (window.console) {
17076
+ console.log('WARNING: Tried to load angular more than once.');
17077
+ }
17078
+ return;
17079
+ }
17080
+
17081
+ bindJQuery();
17082
+
17083
+ publishExternalAPI(angular);
17084
+
17085
+ angular.module("ngLocale", [], ["$provide", function($provide) {
17086
+ var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
17087
+ function getDecimals(n) {
17088
+ n = n + '';
17089
+ var i = n.indexOf('.');
17090
+ return (i == -1) ? 0 : n.length - i - 1;
17091
+ }
17092
+
17093
+ function getVF(n, opt_precision) {
17094
+ var v = opt_precision;
17095
+
17096
+ if (undefined === v) {
17097
+ v = Math.min(getDecimals(n), 3);
17098
+ }
17099
+
17100
+ var base = Math.pow(10, v);
17101
+ var f = ((n * base) | 0) % base;
17102
+ return {v: v, f: f};
17103
+ }
17104
+
17105
+ $provide.value("$locale", {
17106
+ "DATETIME_FORMATS": {
17107
+ "AMPMS": [
17108
+ "AM",
17109
+ "PM"
17110
+ ],
17111
+ "DAY": [
17112
+ "Sunday",
17113
+ "Monday",
17114
+ "Tuesday",
17115
+ "Wednesday",
17116
+ "Thursday",
17117
+ "Friday",
17118
+ "Saturday"
17119
+ ],
17120
+ "ERANAMES": [
17121
+ "Before Christ",
17122
+ "Anno Domini"
17123
+ ],
17124
+ "ERAS": [
17125
+ "BC",
17126
+ "AD"
17127
+ ],
17128
+ "FIRSTDAYOFWEEK": 6,
17129
+ "MONTH": [
17130
+ "January",
17131
+ "February",
17132
+ "March",
17133
+ "April",
17134
+ "May",
17135
+ "June",
17136
+ "July",
17137
+ "August",
17138
+ "September",
17139
+ "October",
17140
+ "November",
17141
+ "December"
17142
+ ],
17143
+ "SHORTDAY": [
17144
+ "Sun",
17145
+ "Mon",
17146
+ "Tue",
17147
+ "Wed",
17148
+ "Thu",
17149
+ "Fri",
17150
+ "Sat"
17151
+ ],
17152
+ "SHORTMONTH": [
17153
+ "Jan",
17154
+ "Feb",
17155
+ "Mar",
17156
+ "Apr",
17157
+ "May",
17158
+ "Jun",
17159
+ "Jul",
17160
+ "Aug",
17161
+ "Sep",
17162
+ "Oct",
17163
+ "Nov",
17164
+ "Dec"
17165
+ ],
17166
+ "STANDALONEMONTH": [
17167
+ "January",
17168
+ "February",
17169
+ "March",
17170
+ "April",
17171
+ "May",
17172
+ "June",
17173
+ "July",
17174
+ "August",
17175
+ "September",
17176
+ "October",
17177
+ "November",
17178
+ "December"
17179
+ ],
17180
+ "WEEKENDRANGE": [
17181
+ 5,
17182
+ 6
17183
+ ],
17184
+ "fullDate": "EEEE, MMMM d, y",
17185
+ "longDate": "MMMM d, y",
17186
+ "medium": "MMM d, y h:mm:ss a",
17187
+ "mediumDate": "MMM d, y",
17188
+ "mediumTime": "h:mm:ss a",
17189
+ "short": "M/d/yy h:mm a",
17190
+ "shortDate": "M/d/yy",
17191
+ "shortTime": "h:mm a"
17192
+ },
17193
+ "NUMBER_FORMATS": {
17194
+ "CURRENCY_SYM": "$",
17195
+ "DECIMAL_SEP": ".",
17196
+ "GROUP_SEP": ",",
17197
+ "PATTERNS": [
17198
+ {
17199
+ "gSize": 3,
17200
+ "lgSize": 3,
17201
+ "maxFrac": 3,
17202
+ "minFrac": 0,
17203
+ "minInt": 1,
17204
+ "negPre": "-",
17205
+ "negSuf": "",
17206
+ "posPre": "",
17207
+ "posSuf": ""
17208
+ },
17209
+ {
17210
+ "gSize": 3,
17211
+ "lgSize": 3,
17212
+ "maxFrac": 2,
17213
+ "minFrac": 2,
17214
+ "minInt": 1,
17215
+ "negPre": "-\u00a4",
17216
+ "negSuf": "",
17217
+ "posPre": "\u00a4",
17218
+ "posSuf": ""
17219
+ }
17220
+ ]
17221
+ },
17222
+ "id": "en-us",
17223
+ "localeID": "en_US",
17224
+ "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
17225
+ });
17226
+ }]);
17227
+
17228
+ jqLite(function() {
17229
+ angularInit(window.document, bootstrap);
17230
+ });
17231
+
17232
+ })(window);
17233
+
17234
+ !window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');
17235
+ },{}],42:[function(require,module,exports){
17236
+ require('./angular');
17237
+ module.exports = angular;
17238
+
17239
+ },{"./angular":41}],43:[function(require,module,exports){
17240
+
17241
+ (function () {
17242
+
17243
+ function patchXHR(fnName, newFn) {
17244
+ window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
17245
+ }
17246
+
17247
+ function redefineProp(xhr, prop, fn) {
17248
+ try {
17249
+ Object.defineProperty(xhr, prop, {get: fn});
17250
+ } catch (e) {
17251
+ }
17252
+ }
17253
+
17254
+ if (!window.FileAPI) {
17255
+ window.FileAPI = {};
17256
+ }
17257
+
17258
+ if (!window.XMLHttpRequest) {
17259
+ throw 'AJAX is not supported. XMLHttpRequest is not defined.';
17260
+ }
17261
+
17262
+ FileAPI.shouldLoad = !window.FormData || FileAPI.forceLoad;
17263
+ if (FileAPI.shouldLoad) {
17264
+ var initializeUploadListener = function (xhr) {
17265
+ if (!xhr.__listeners) {
17266
+ if (!xhr.upload) xhr.upload = {};
17267
+ xhr.__listeners = [];
17268
+ var origAddEventListener = xhr.upload.addEventListener;
17269
+ xhr.upload.addEventListener = function (t, fn) {
17270
+ xhr.__listeners[t] = fn;
17271
+ if (origAddEventListener) origAddEventListener.apply(this, arguments);
17272
+ };
17273
+ }
17274
+ };
17275
+
17276
+ patchXHR('open', function (orig) {
17277
+ return function (m, url, b) {
17278
+ initializeUploadListener(this);
17279
+ this.__url = url;
17280
+ try {
17281
+ orig.apply(this, [m, url, b]);
17282
+ } catch (e) {
17283
+ if (e.message.indexOf('Access is denied') > -1) {
17284
+ this.__origError = e;
17285
+ orig.apply(this, [m, '_fix_for_ie_crossdomain__', b]);
17286
+ }
17287
+ }
17288
+ };
17289
+ });
17290
+
17291
+ patchXHR('getResponseHeader', function (orig) {
17292
+ return function (h) {
17293
+ return this.__fileApiXHR && this.__fileApiXHR.getResponseHeader ? this.__fileApiXHR.getResponseHeader(h) : (orig == null ? null : orig.apply(this, [h]));
17294
+ };
17295
+ });
17296
+
17297
+ patchXHR('getAllResponseHeaders', function (orig) {
17298
+ return function () {
17299
+ return this.__fileApiXHR && this.__fileApiXHR.getAllResponseHeaders ? this.__fileApiXHR.getAllResponseHeaders() : (orig == null ? null : orig.apply(this));
17300
+ };
17301
+ });
17302
+
17303
+ patchXHR('abort', function (orig) {
17304
+ return function () {
17305
+ return this.__fileApiXHR && this.__fileApiXHR.abort ? this.__fileApiXHR.abort() : (orig == null ? null : orig.apply(this));
17306
+ };
17307
+ });
17308
+
17309
+ patchXHR('setRequestHeader', function (orig) {
17310
+ return function (header, value) {
17311
+ if (header === '__setXHR_') {
17312
+ initializeUploadListener(this);
17313
+ var val = value(this);
17314
+ if (val instanceof Function) {
17315
+ val(this);
17316
+ }
17317
+ } else {
17318
+ this.__requestHeaders = this.__requestHeaders || {};
17319
+ this.__requestHeaders[header] = value;
17320
+ orig.apply(this, arguments);
17321
+ }
17322
+ };
17323
+ });
17324
+
17325
+ patchXHR('send', function (orig) {
17326
+ return function () {
17327
+ var xhr = this;
17328
+ if (arguments[0] && arguments[0].__isFileAPIShim) {
17329
+ var formData = arguments[0];
17330
+ var config = {
17331
+ url: xhr.__url,
17332
+ jsonp: false,
17333
+ cache: true,
17334
+ complete: function (err, fileApiXHR) {
17335
+ if (err && angular.isString(err) && err.indexOf('#2174') !== -1) {
17336
+ err = null;
17337
+ }
17338
+ xhr.__completed = true;
17339
+ if (!err && xhr.__listeners.load)
17340
+ xhr.__listeners.load({
17341
+ type: 'load',
17342
+ loaded: xhr.__loaded,
17343
+ total: xhr.__total,
17344
+ target: xhr,
17345
+ lengthComputable: true
17346
+ });
17347
+ if (!err && xhr.__listeners.loadend)
17348
+ xhr.__listeners.loadend({
17349
+ type: 'loadend',
17350
+ loaded: xhr.__loaded,
17351
+ total: xhr.__total,
17352
+ target: xhr,
17353
+ lengthComputable: true
17354
+ });
17355
+ if (err === 'abort' && xhr.__listeners.abort)
17356
+ xhr.__listeners.abort({
17357
+ type: 'abort',
17358
+ loaded: xhr.__loaded,
17359
+ total: xhr.__total,
17360
+ target: xhr,
17361
+ lengthComputable: true
17362
+ });
17363
+ if (fileApiXHR.status !== undefined) redefineProp(xhr, 'status', function () {
17364
+ return (fileApiXHR.status === 0 && err && err !== 'abort') ? 500 : fileApiXHR.status;
17365
+ });
17366
+ if (fileApiXHR.statusText !== undefined) redefineProp(xhr, 'statusText', function () {
17367
+ return fileApiXHR.statusText;
17368
+ });
17369
+ redefineProp(xhr, 'readyState', function () {
17370
+ return 4;
17371
+ });
17372
+ if (fileApiXHR.response !== undefined) redefineProp(xhr, 'response', function () {
17373
+ return fileApiXHR.response;
17374
+ });
17375
+ var resp = fileApiXHR.responseText || (err && fileApiXHR.status === 0 && err !== 'abort' ? err : undefined);
17376
+ redefineProp(xhr, 'responseText', function () {
17377
+ return resp;
17378
+ });
17379
+ redefineProp(xhr, 'response', function () {
17380
+ return resp;
17381
+ });
17382
+ if (err) redefineProp(xhr, 'err', function () {
17383
+ return err;
17384
+ });
17385
+ xhr.__fileApiXHR = fileApiXHR;
17386
+ if (xhr.onreadystatechange) xhr.onreadystatechange();
17387
+ if (xhr.onload) xhr.onload();
17388
+ },
17389
+ progress: function (e) {
17390
+ e.target = xhr;
17391
+ if (xhr.__listeners.progress) xhr.__listeners.progress(e);
17392
+ xhr.__total = e.total;
17393
+ xhr.__loaded = e.loaded;
17394
+ if (e.total === e.loaded) {
17395
+ var _this = this;
17396
+ setTimeout(function () {
17397
+ if (!xhr.__completed) {
17398
+ xhr.getAllResponseHeaders = function () {
17399
+ };
17400
+ _this.complete(null, {status: 204, statusText: 'No Content'});
17401
+ }
17402
+ }, FileAPI.noContentTimeout || 10000);
17403
+ }
17404
+ },
17405
+ headers: xhr.__requestHeaders
17406
+ };
17407
+ config.data = {};
17408
+ config.files = {};
17409
+ for (var i = 0; i < formData.data.length; i++) {
17410
+ var item = formData.data[i];
17411
+ if (item.val != null && item.val.name != null && item.val.size != null && item.val.type != null) {
17412
+ config.files[item.key] = item.val;
17413
+ } else {
17414
+ config.data[item.key] = item.val;
17415
+ }
17416
+ }
17417
+
17418
+ setTimeout(function () {
17419
+ if (!FileAPI.hasFlash) {
17420
+ throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
17421
+ }
17422
+ xhr.__fileApiXHR = FileAPI.upload(config);
17423
+ }, 1);
17424
+ } else {
17425
+ if (this.__origError) {
17426
+ throw this.__origError;
17427
+ }
17428
+ orig.apply(xhr, arguments);
17429
+ }
17430
+ };
17431
+ });
17432
+ window.XMLHttpRequest.__isFileAPIShim = true;
17433
+ window.FormData = FormData = function () {
17434
+ return {
17435
+ append: function (key, val, name) {
17436
+ if (val.__isFileAPIBlobShim) {
17437
+ val = val.data[0];
17438
+ }
17439
+ this.data.push({
17440
+ key: key,
17441
+ val: val,
17442
+ name: name
17443
+ });
17444
+ },
17445
+ data: [],
17446
+ __isFileAPIShim: true
17447
+ };
17448
+ };
17449
+
17450
+ window.Blob = Blob = function (b) {
17451
+ return {
17452
+ data: b,
17453
+ __isFileAPIBlobShim: true
17454
+ };
17455
+ };
17456
+ }
17457
+
17458
+ })();
17459
+
17460
+ (function () {
17461
+
17462
+ function isInputTypeFile(elem) {
17463
+ return elem[0].tagName.toLowerCase() === 'input' && elem.attr('type') && elem.attr('type').toLowerCase() === 'file';
17464
+ }
17465
+
17466
+ function hasFlash() {
17467
+ try {
17468
+ var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
17469
+ if (fo) return true;
17470
+ } catch (e) {
17471
+ if (navigator.mimeTypes['application/x-shockwave-flash'] !== undefined) return true;
17472
+ }
17473
+ return false;
17474
+ }
17475
+
17476
+ function getOffset(obj) {
17477
+ var left = 0, top = 0;
17478
+
17479
+ if (window.jQuery) {
17480
+ return jQuery(obj).offset();
17481
+ }
17482
+
17483
+ if (obj.offsetParent) {
17484
+ do {
17485
+ left += (obj.offsetLeft - obj.scrollLeft);
17486
+ top += (obj.offsetTop - obj.scrollTop);
17487
+ obj = obj.offsetParent;
17488
+ } while (obj);
17489
+ }
17490
+ return {
17491
+ left: left,
17492
+ top: top
17493
+ };
17494
+ }
17495
+
17496
+ if (FileAPI.shouldLoad) {
17497
+ FileAPI.hasFlash = hasFlash();
17498
+
17499
+ if (FileAPI.forceLoad) {
17500
+ FileAPI.html5 = false;
17501
+ }
17502
+
17503
+ if (!FileAPI.upload) {
17504
+ var jsUrl, basePath, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
17505
+ if (window.FileAPI.jsUrl) {
17506
+ jsUrl = window.FileAPI.jsUrl;
17507
+ } else if (window.FileAPI.jsPath) {
17508
+ basePath = window.FileAPI.jsPath;
17509
+ } else {
17510
+ for (i = 0; i < allScripts.length; i++) {
17511
+ src = allScripts[i].src;
17512
+ index = src.search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/);
17513
+ if (index > -1) {
17514
+ basePath = src.substring(0, index + 1);
17515
+ break;
17516
+ }
17517
+ }
17518
+ }
17519
+
17520
+ if (FileAPI.staticPath == null) FileAPI.staticPath = basePath;
17521
+ script.setAttribute('src', jsUrl || basePath + 'FileAPI.min.js');
17522
+ document.getElementsByTagName('head')[0].appendChild(script);
17523
+ }
17524
+
17525
+ FileAPI.ngfFixIE = function (elem, fileElem, changeFn) {
17526
+ if (!hasFlash()) {
17527
+ throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
17528
+ }
17529
+ var fixInputStyle = function () {
17530
+ var label = fileElem.parent();
17531
+ if (elem.attr('disabled')) {
17532
+ if (label) label.removeClass('js-fileapi-wrapper');
17533
+ } else {
17534
+ if (!fileElem.attr('__ngf_flash_')) {
17535
+ fileElem.unbind('change');
17536
+ fileElem.unbind('click');
17537
+ fileElem.bind('change', function (evt) {
17538
+ fileApiChangeFn.apply(this, [evt]);
17539
+ changeFn.apply(this, [evt]);
17540
+ });
17541
+ fileElem.attr('__ngf_flash_', 'true');
17542
+ }
17543
+ label.addClass('js-fileapi-wrapper');
17544
+ if (!isInputTypeFile(elem)) {
17545
+ label.css('position', 'absolute')
17546
+ .css('top', getOffset(elem[0]).top + 'px').css('left', getOffset(elem[0]).left + 'px')
17547
+ .css('width', elem[0].offsetWidth + 'px').css('height', elem[0].offsetHeight + 'px')
17548
+ .css('filter', 'alpha(opacity=0)').css('display', elem.css('display'))
17549
+ .css('overflow', 'hidden').css('z-index', '900000')
17550
+ .css('visibility', 'visible');
17551
+ fileElem.css('width', elem[0].offsetWidth + 'px').css('height', elem[0].offsetHeight + 'px')
17552
+ .css('position', 'absolute').css('top', '0px').css('left', '0px');
17553
+ }
17554
+ }
17555
+ };
17556
+
17557
+ elem.bind('mouseenter', fixInputStyle);
17558
+
17559
+ var fileApiChangeFn = function (evt) {
17560
+ var files = FileAPI.getFiles(evt);
17561
+ for (var i = 0; i < files.length; i++) {
17562
+ if (files[i].size === undefined) files[i].size = 0;
17563
+ if (files[i].name === undefined) files[i].name = 'file';
17564
+ if (files[i].type === undefined) files[i].type = 'undefined';
17565
+ }
17566
+ if (!evt.target) {
17567
+ evt.target = {};
17568
+ }
17569
+ evt.target.files = files;
17570
+ if (evt.target.files !== files) {
17571
+ evt.__files_ = files;
17572
+ }
17573
+ (evt.__files_ || evt.target.files).item = function (i) {
17574
+ return (evt.__files_ || evt.target.files)[i] || null;
17575
+ };
17576
+ };
17577
+ };
17578
+
17579
+ FileAPI.disableFileInput = function (elem, disable) {
17580
+ if (disable) {
17581
+ elem.removeClass('js-fileapi-wrapper');
17582
+ } else {
17583
+ elem.addClass('js-fileapi-wrapper');
17584
+ }
17585
+ };
17586
+ }
17587
+ })();
17588
+
17589
+ if (!window.FileReader) {
17590
+ window.FileReader = function () {
17591
+ var _this = this, loadStarted = false;
17592
+ this.listeners = {};
17593
+ this.addEventListener = function (type, fn) {
17594
+ _this.listeners[type] = _this.listeners[type] || [];
17595
+ _this.listeners[type].push(fn);
17596
+ };
17597
+ this.removeEventListener = function (type, fn) {
17598
+ if (_this.listeners[type]) _this.listeners[type].splice(_this.listeners[type].indexOf(fn), 1);
17599
+ };
17600
+ this.dispatchEvent = function (evt) {
17601
+ var list = _this.listeners[evt.type];
17602
+ if (list) {
17603
+ for (var i = 0; i < list.length; i++) {
17604
+ list[i].call(_this, evt);
17605
+ }
17606
+ }
17607
+ };
17608
+ this.onabort = this.onerror = this.onload = this.onloadstart = this.onloadend = this.onprogress = null;
17609
+
17610
+ var constructEvent = function (type, evt) {
17611
+ var e = {type: type, target: _this, loaded: evt.loaded, total: evt.total, error: evt.error};
17612
+ if (evt.result != null) e.target.result = evt.result;
17613
+ return e;
17614
+ };
17615
+ var listener = function (evt) {
17616
+ if (!loadStarted) {
17617
+ loadStarted = true;
17618
+ if (_this.onloadstart) _this.onloadstart(constructEvent('loadstart', evt));
17619
+ }
17620
+ var e;
17621
+ if (evt.type === 'load') {
17622
+ if (_this.onloadend) _this.onloadend(constructEvent('loadend', evt));
17623
+ e = constructEvent('load', evt);
17624
+ if (_this.onload) _this.onload(e);
17625
+ _this.dispatchEvent(e);
17626
+ } else if (evt.type === 'progress') {
17627
+ e = constructEvent('progress', evt);
17628
+ if (_this.onprogress) _this.onprogress(e);
17629
+ _this.dispatchEvent(e);
17630
+ } else {
17631
+ e = constructEvent('error', evt);
17632
+ if (_this.onerror) _this.onerror(e);
17633
+ _this.dispatchEvent(e);
17634
+ }
17635
+ };
17636
+ this.readAsDataURL = function (file) {
17637
+ FileAPI.readAsDataURL(file, listener);
17638
+ };
17639
+ this.readAsText = function (file) {
17640
+ FileAPI.readAsText(file, listener);
17641
+ };
17642
+ };
17643
+ }
17644
+
17645
+
17646
+ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
17647
+ window.XMLHttpRequest.prototype.setRequestHeader = (function (orig) {
17648
+ return function (header, value) {
17649
+ if (header === '__setXHR_') {
17650
+ var val = value(this);
17651
+ if (val instanceof Function) {
17652
+ val(this);
17653
+ }
17654
+ } else {
17655
+ orig.apply(this, arguments);
17656
+ }
17657
+ };
17658
+ })(window.XMLHttpRequest.prototype.setRequestHeader);
17659
+ }
17660
+
17661
+ var ngFileUpload = angular.module('ngFileUpload', []);
17662
+
17663
+ ngFileUpload.version = '12.2.13';
17664
+
17665
+ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
17666
+ var upload = this;
17667
+ upload.promisesCount = 0;
17668
+
17669
+ this.isResumeSupported = function () {
17670
+ return window.Blob && window.Blob.prototype.slice;
17671
+ };
17672
+
17673
+ var resumeSupported = this.isResumeSupported();
17674
+
17675
+ function sendHttp(config) {
17676
+ config.method = config.method || 'POST';
17677
+ config.headers = config.headers || {};
17678
+
17679
+ var deferred = config._deferred = config._deferred || $q.defer();
17680
+ var promise = deferred.promise;
17681
+
17682
+ function notifyProgress(e) {
17683
+ if (deferred.notify) {
17684
+ deferred.notify(e);
17685
+ }
17686
+ if (promise.progressFunc) {
17687
+ $timeout(function () {
17688
+ promise.progressFunc(e);
17689
+ });
17690
+ }
17691
+ }
17692
+
17693
+ function getNotifyEvent(n) {
17694
+ if (config._start != null && resumeSupported) {
17695
+ return {
17696
+ loaded: n.loaded + config._start,
17697
+ total: (config._file && config._file.size) || n.total,
17698
+ type: n.type, config: config,
17699
+ lengthComputable: true, target: n.target
17700
+ };
17701
+ } else {
17702
+ return n;
17703
+ }
17704
+ }
17705
+
17706
+ if (!config.disableProgress) {
17707
+ config.headers.__setXHR_ = function () {
17708
+ return function (xhr) {
17709
+ if (!xhr || !xhr.upload || !xhr.upload.addEventListener) return;
17710
+ config.__XHR = xhr;
17711
+ if (config.xhrFn) config.xhrFn(xhr);
17712
+ xhr.upload.addEventListener('progress', function (e) {
17713
+ e.config = config;
17714
+ notifyProgress(getNotifyEvent(e));
17715
+ }, false);
17716
+ xhr.upload.addEventListener('load', function (e) {
17717
+ if (e.lengthComputable) {
17718
+ e.config = config;
17719
+ notifyProgress(getNotifyEvent(e));
17720
+ }
17721
+ }, false);
17722
+ };
17723
+ };
17724
+ }
17725
+
17726
+ function uploadWithAngular() {
17727
+ $http(config).then(function (r) {
17728
+ if (resumeSupported && config._chunkSize && !config._finished && config._file) {
17729
+ var fileSize = config._file && config._file.size || 0;
17730
+ notifyProgress({
17731
+ loaded: Math.min(config._end, fileSize),
17732
+ total: fileSize,
17733
+ config: config,
17734
+ type: 'progress'
17735
+ }
17736
+ );
17737
+ upload.upload(config, true);
17738
+ } else {
17739
+ if (config._finished) delete config._finished;
17740
+ deferred.resolve(r);
17741
+ }
17742
+ }, function (e) {
17743
+ deferred.reject(e);
17744
+ }, function (n) {
17745
+ deferred.notify(n);
17746
+ }
17747
+ );
17748
+ }
17749
+
17750
+ if (!resumeSupported) {
17751
+ uploadWithAngular();
17752
+ } else if (config._chunkSize && config._end && !config._finished) {
17753
+ config._start = config._end;
17754
+ config._end += config._chunkSize;
17755
+ uploadWithAngular();
17756
+ } else if (config.resumeSizeUrl) {
17757
+ $http.get(config.resumeSizeUrl).then(function (resp) {
17758
+ if (config.resumeSizeResponseReader) {
17759
+ config._start = config.resumeSizeResponseReader(resp.data);
17760
+ } else {
17761
+ config._start = parseInt((resp.data.size == null ? resp.data : resp.data.size).toString());
17762
+ }
17763
+ if (config._chunkSize) {
17764
+ config._end = config._start + config._chunkSize;
17765
+ }
17766
+ uploadWithAngular();
17767
+ }, function (e) {
17768
+ throw e;
17769
+ });
17770
+ } else if (config.resumeSize) {
17771
+ config.resumeSize().then(function (size) {
17772
+ config._start = size;
17773
+ if (config._chunkSize) {
17774
+ config._end = config._start + config._chunkSize;
17775
+ }
17776
+ uploadWithAngular();
17777
+ }, function (e) {
17778
+ throw e;
17779
+ });
17780
+ } else {
17781
+ if (config._chunkSize) {
17782
+ config._start = 0;
17783
+ config._end = config._start + config._chunkSize;
17784
+ }
17785
+ uploadWithAngular();
17786
+ }
17787
+
17788
+
17789
+ promise.success = function (fn) {
17790
+ promise.then(function (response) {
17791
+ fn(response.data, response.status, response.headers, config);
17792
+ });
17793
+ return promise;
17794
+ };
17795
+
17796
+ promise.error = function (fn) {
17797
+ promise.then(null, function (response) {
17798
+ fn(response.data, response.status, response.headers, config);
17799
+ });
17800
+ return promise;
17801
+ };
17802
+
17803
+ promise.progress = function (fn) {
17804
+ promise.progressFunc = fn;
17805
+ promise.then(null, null, function (n) {
17806
+ fn(n);
17807
+ });
17808
+ return promise;
17809
+ };
17810
+ promise.abort = promise.pause = function () {
17811
+ if (config.__XHR) {
17812
+ $timeout(function () {
17813
+ config.__XHR.abort();
17814
+ });
17815
+ }
17816
+ return promise;
17817
+ };
17818
+ promise.xhr = function (fn) {
17819
+ config.xhrFn = (function (origXhrFn) {
17820
+ return function () {
17821
+ if (origXhrFn) origXhrFn.apply(promise, arguments);
17822
+ fn.apply(promise, arguments);
17823
+ };
17824
+ })(config.xhrFn);
17825
+ return promise;
17826
+ };
17827
+
17828
+ upload.promisesCount++;
17829
+ if (promise['finally'] && promise['finally'] instanceof Function) {
17830
+ promise['finally'](function () {
17831
+ upload.promisesCount--;
17832
+ });
17833
+ }
17834
+ return promise;
17835
+ }
17836
+
17837
+ this.isUploadInProgress = function () {
17838
+ return upload.promisesCount > 0;
17839
+ };
17840
+
17841
+ this.rename = function (file, name) {
17842
+ file.ngfName = name;
17843
+ return file;
17844
+ };
17845
+
17846
+ this.jsonBlob = function (val) {
17847
+ if (val != null && !angular.isString(val)) {
17848
+ val = JSON.stringify(val);
17849
+ }
17850
+ var blob = new window.Blob([val], {type: 'application/json'});
17851
+ blob._ngfBlob = true;
17852
+ return blob;
17853
+ };
17854
+
17855
+ this.json = function (val) {
17856
+ return angular.toJson(val);
17857
+ };
17858
+
17859
+ function copy(obj) {
17860
+ var clone = {};
17861
+ for (var key in obj) {
17862
+ if (obj.hasOwnProperty(key)) {
17863
+ clone[key] = obj[key];
17864
+ }
17865
+ }
17866
+ return clone;
17867
+ }
17868
+
17869
+ this.isFile = function (file) {
17870
+ return file != null && (file instanceof window.Blob || (file.flashId && file.name && file.size));
17871
+ };
17872
+
17873
+ this.upload = function (config, internal) {
17874
+ function toResumeFile(file, formData) {
17875
+ if (file._ngfBlob) return file;
17876
+ config._file = config._file || file;
17877
+ if (config._start != null && resumeSupported) {
17878
+ if (config._end && config._end >= file.size) {
17879
+ config._finished = true;
17880
+ config._end = file.size;
17881
+ }
17882
+ var slice = file.slice(config._start, config._end || file.size);
17883
+ slice.name = file.name;
17884
+ slice.ngfName = file.ngfName;
17885
+ if (config._chunkSize) {
17886
+ formData.append('_chunkSize', config._chunkSize);
17887
+ formData.append('_currentChunkSize', config._end - config._start);
17888
+ formData.append('_chunkNumber', Math.floor(config._start / config._chunkSize));
17889
+ formData.append('_totalSize', config._file.size);
17890
+ }
17891
+ return slice;
17892
+ }
17893
+ return file;
17894
+ }
17895
+
17896
+ function addFieldToFormData(formData, val, key) {
17897
+ if (val !== undefined) {
17898
+ if (angular.isDate(val)) {
17899
+ val = val.toISOString();
17900
+ }
17901
+ if (angular.isString(val)) {
17902
+ formData.append(key, val);
17903
+ } else if (upload.isFile(val)) {
17904
+ var file = toResumeFile(val, formData);
17905
+ var split = key.split(',');
17906
+ if (split[1]) {
17907
+ file.ngfName = split[1].replace(/^\s+|\s+$/g, '');
17908
+ key = split[0];
17909
+ }
17910
+ config._fileKey = config._fileKey || key;
17911
+ formData.append(key, file, file.ngfName || file.name);
17912
+ } else {
17913
+ if (angular.isObject(val)) {
17914
+ if (val.$$ngfCircularDetection) throw 'ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: ' + key;
17915
+
17916
+ val.$$ngfCircularDetection = true;
17917
+ try {
17918
+ for (var k in val) {
17919
+ if (val.hasOwnProperty(k) && k !== '$$ngfCircularDetection') {
17920
+ var objectKey = config.objectKey == null ? '[i]' : config.objectKey;
17921
+ if (val.length && parseInt(k) > -1) {
17922
+ objectKey = config.arrayKey == null ? objectKey : config.arrayKey;
17923
+ }
17924
+ addFieldToFormData(formData, val[k], key + objectKey.replace(/[ik]/g, k));
17925
+ }
17926
+ }
17927
+ } finally {
17928
+ delete val.$$ngfCircularDetection;
17929
+ }
17930
+ } else {
17931
+ formData.append(key, val);
17932
+ }
17933
+ }
17934
+ }
17935
+ }
17936
+
17937
+ function digestConfig() {
17938
+ config._chunkSize = upload.translateScalars(config.resumeChunkSize);
17939
+ config._chunkSize = config._chunkSize ? parseInt(config._chunkSize.toString()) : null;
17940
+
17941
+ config.headers = config.headers || {};
17942
+ config.headers['Content-Type'] = undefined;
17943
+ config.transformRequest = config.transformRequest ?
17944
+ (angular.isArray(config.transformRequest) ?
17945
+ config.transformRequest : [config.transformRequest]) : [];
17946
+ config.transformRequest.push(function (data) {
17947
+ var formData = new window.FormData(), key;
17948
+ data = data || config.fields || {};
17949
+ if (config.file) {
17950
+ data.file = config.file;
17951
+ }
17952
+ for (key in data) {
17953
+ if (data.hasOwnProperty(key)) {
17954
+ var val = data[key];
17955
+ if (config.formDataAppender) {
17956
+ config.formDataAppender(formData, key, val);
17957
+ } else {
17958
+ addFieldToFormData(formData, val, key);
17959
+ }
17960
+ }
17961
+ }
17962
+
17963
+ return formData;
17964
+ });
17965
+ }
17966
+
17967
+ if (!internal) config = copy(config);
17968
+ if (!config._isDigested) {
17969
+ config._isDigested = true;
17970
+ digestConfig();
17971
+ }
17972
+
17973
+ return sendHttp(config);
17974
+ };
17975
+
17976
+ this.http = function (config) {
17977
+ config = copy(config);
17978
+ config.transformRequest = config.transformRequest || function (data) {
17979
+ if ((window.ArrayBuffer && data instanceof window.ArrayBuffer) || data instanceof window.Blob) {
17980
+ return data;
17981
+ }
17982
+ return $http.defaults.transformRequest[0].apply(this, arguments);
17983
+ };
17984
+ config._chunkSize = upload.translateScalars(config.resumeChunkSize);
17985
+ config._chunkSize = config._chunkSize ? parseInt(config._chunkSize.toString()) : null;
17986
+
17987
+ return sendHttp(config);
17988
+ };
17989
+
17990
+ this.translateScalars = function (str) {
17991
+ if (angular.isString(str)) {
17992
+ if (str.search(/kb/i) === str.length - 2) {
17993
+ return parseFloat(str.substring(0, str.length - 2) * 1024);
17994
+ } else if (str.search(/mb/i) === str.length - 2) {
17995
+ return parseFloat(str.substring(0, str.length - 2) * 1048576);
17996
+ } else if (str.search(/gb/i) === str.length - 2) {
17997
+ return parseFloat(str.substring(0, str.length - 2) * 1073741824);
17998
+ } else if (str.search(/b/i) === str.length - 1) {
17999
+ return parseFloat(str.substring(0, str.length - 1));
18000
+ } else if (str.search(/s/i) === str.length - 1) {
18001
+ return parseFloat(str.substring(0, str.length - 1));
18002
+ } else if (str.search(/m/i) === str.length - 1) {
18003
+ return parseFloat(str.substring(0, str.length - 1) * 60);
18004
+ } else if (str.search(/h/i) === str.length - 1) {
18005
+ return parseFloat(str.substring(0, str.length - 1) * 3600);
18006
+ }
18007
+ }
18008
+ return str;
18009
+ };
18010
+
18011
+ this.urlToBlob = function(url) {
18012
+ var defer = $q.defer();
18013
+ $http({url: url, method: 'get', responseType: 'arraybuffer'}).then(function (resp) {
18014
+ var arrayBufferView = new Uint8Array(resp.data);
18015
+ var type = resp.headers('content-type') || 'image/WebP';
18016
+ var blob = new window.Blob([arrayBufferView], {type: type});
18017
+ var matches = url.match(/.*\/(.+?)(\?.*)?$/);
18018
+ if (matches.length > 1) {
18019
+ blob.name = matches[1];
18020
+ }
18021
+ defer.resolve(blob);
18022
+ }, function (e) {
18023
+ defer.reject(e);
18024
+ });
18025
+ return defer.promise;
18026
+ };
18027
+
18028
+ this.setDefaults = function (defaults) {
18029
+ this.defaults = defaults || {};
18030
+ };
18031
+
18032
+ this.defaults = {};
18033
+ this.version = ngFileUpload.version;
18034
+ }
18035
+
18036
+ ]);
18037
+
18038
+ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadExif', function ($parse, $timeout, $compile, $q, UploadExif) {
18039
+ var upload = UploadExif;
18040
+ upload.getAttrWithDefaults = function (attr, name) {
18041
+ if (attr[name] != null) return attr[name];
18042
+ var def = upload.defaults[name];
18043
+ return (def == null ? def : (angular.isString(def) ? def : JSON.stringify(def)));
18044
+ };
18045
+
18046
+ upload.attrGetter = function (name, attr, scope, params) {
18047
+ var attrVal = this.getAttrWithDefaults(attr, name);
18048
+ if (scope) {
18049
+ try {
18050
+ if (params) {
18051
+ return $parse(attrVal)(scope, params);
18052
+ } else {
18053
+ return $parse(attrVal)(scope);
18054
+ }
18055
+ } catch (e) {
18056
+ if (name.search(/min|max|pattern/i)) {
18057
+ return attrVal;
18058
+ } else {
18059
+ throw e;
18060
+ }
18061
+ }
18062
+ } else {
18063
+ return attrVal;
18064
+ }
18065
+ };
18066
+
18067
+ upload.shouldUpdateOn = function (type, attr, scope) {
18068
+ var modelOptions = upload.attrGetter('ngfModelOptions', attr, scope);
18069
+ if (modelOptions && modelOptions.updateOn) {
18070
+ return modelOptions.updateOn.split(' ').indexOf(type) > -1;
18071
+ }
18072
+ return true;
18073
+ };
18074
+
18075
+ upload.emptyPromise = function () {
18076
+ var d = $q.defer();
18077
+ var args = arguments;
18078
+ $timeout(function () {
18079
+ d.resolve.apply(d, args);
18080
+ });
18081
+ return d.promise;
18082
+ };
18083
+
18084
+ upload.rejectPromise = function () {
18085
+ var d = $q.defer();
18086
+ var args = arguments;
18087
+ $timeout(function () {
18088
+ d.reject.apply(d, args);
18089
+ });
18090
+ return d.promise;
18091
+ };
18092
+
18093
+ upload.happyPromise = function (promise, data) {
18094
+ var d = $q.defer();
18095
+ promise.then(function (result) {
18096
+ d.resolve(result);
18097
+ }, function (error) {
18098
+ $timeout(function () {
18099
+ throw error;
18100
+ });
18101
+ d.resolve(data);
18102
+ });
18103
+ return d.promise;
18104
+ };
18105
+
18106
+ function applyExifRotations(files, attr, scope) {
18107
+ var promises = [upload.emptyPromise()];
18108
+ angular.forEach(files, function (f, i) {
18109
+ if (f.type.indexOf('image/jpeg') === 0 && upload.attrGetter('ngfFixOrientation', attr, scope, {$file: f})) {
18110
+ promises.push(upload.happyPromise(upload.applyExifRotation(f), f).then(function (fixedFile) {
18111
+ files.splice(i, 1, fixedFile);
18112
+ }));
18113
+ }
18114
+ });
18115
+ return $q.all(promises);
18116
+ }
18117
+
18118
+ function resizeFile(files, attr, scope, ngModel) {
18119
+ var resizeVal = upload.attrGetter('ngfResize', attr, scope);
18120
+ if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise();
18121
+ if (resizeVal instanceof Function) {
18122
+ var defer = $q.defer();
18123
+ return resizeVal(files).then(function (p) {
18124
+ resizeWithParams(p, files, attr, scope, ngModel).then(function (r) {
18125
+ defer.resolve(r);
18126
+ }, function (e) {
18127
+ defer.reject(e);
18128
+ });
18129
+ }, function (e) {
18130
+ defer.reject(e);
18131
+ });
18132
+ } else {
18133
+ return resizeWithParams(resizeVal, files, attr, scope, ngModel);
18134
+ }
18135
+ }
18136
+
18137
+ function resizeWithParams(params, files, attr, scope, ngModel) {
18138
+ var promises = [upload.emptyPromise()];
18139
+
18140
+ function handleFile(f, i) {
18141
+ if (f.type.indexOf('image') === 0) {
18142
+ if (params.pattern && !upload.validatePattern(f, params.pattern)) return;
18143
+ params.resizeIf = function (width, height) {
18144
+ return upload.attrGetter('ngfResizeIf', attr, scope,
18145
+ {$width: width, $height: height, $file: f});
18146
+ };
18147
+ var promise = upload.resize(f, params);
18148
+ promises.push(promise);
18149
+ promise.then(function (resizedFile) {
18150
+ files.splice(i, 1, resizedFile);
18151
+ }, function (e) {
18152
+ f.$error = 'resize';
18153
+ (f.$errorMessages = (f.$errorMessages || {})).resize = true;
18154
+ f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name);
18155
+ ngModel.$ngfValidations.push({name: 'resize', valid: false});
18156
+ upload.applyModelValidation(ngModel, files);
18157
+ });
18158
+ }
18159
+ }
18160
+
18161
+ for (var i = 0; i < files.length; i++) {
18162
+ handleFile(files[i], i);
18163
+ }
18164
+ return $q.all(promises);
18165
+ }
18166
+
18167
+ upload.updateModel = function (ngModel, attr, scope, fileChange, files, evt, noDelay) {
18168
+ function update(files, invalidFiles, newFiles, dupFiles, isSingleModel) {
18169
+ attr.$$ngfPrevValidFiles = files;
18170
+ attr.$$ngfPrevInvalidFiles = invalidFiles;
18171
+ var file = files && files.length ? files[0] : null;
18172
+ var invalidFile = invalidFiles && invalidFiles.length ? invalidFiles[0] : null;
18173
+
18174
+ if (ngModel) {
18175
+ upload.applyModelValidation(ngModel, files);
18176
+ ngModel.$setViewValue(isSingleModel ? file : files);
18177
+ }
18178
+
18179
+ if (fileChange) {
18180
+ $parse(fileChange)(scope, {
18181
+ $files: files,
18182
+ $file: file,
18183
+ $newFiles: newFiles,
18184
+ $duplicateFiles: dupFiles,
18185
+ $invalidFiles: invalidFiles,
18186
+ $invalidFile: invalidFile,
18187
+ $event: evt
18188
+ });
18189
+ }
18190
+
18191
+ var invalidModel = upload.attrGetter('ngfModelInvalid', attr);
18192
+ if (invalidModel) {
18193
+ $timeout(function () {
18194
+ $parse(invalidModel).assign(scope, isSingleModel ? invalidFile : invalidFiles);
18195
+ });
18196
+ }
18197
+ $timeout(function () {
18198
+ });
18199
+ }
18200
+
18201
+ var allNewFiles, dupFiles = [], prevValidFiles, prevInvalidFiles,
18202
+ invalids = [], valids = [];
18203
+
18204
+ function removeDuplicates() {
18205
+ function equals(f1, f2) {
18206
+ return f1.name === f2.name && (f1.$ngfOrigSize || f1.size) === (f2.$ngfOrigSize || f2.size) &&
18207
+ f1.type === f2.type;
18208
+ }
18209
+
18210
+ function isInPrevFiles(f) {
18211
+ var j;
18212
+ for (j = 0; j < prevValidFiles.length; j++) {
18213
+ if (equals(f, prevValidFiles[j])) {
18214
+ return true;
18215
+ }
18216
+ }
18217
+ for (j = 0; j < prevInvalidFiles.length; j++) {
18218
+ if (equals(f, prevInvalidFiles[j])) {
18219
+ return true;
18220
+ }
18221
+ }
18222
+ return false;
18223
+ }
18224
+
18225
+ if (files) {
18226
+ allNewFiles = [];
18227
+ dupFiles = [];
18228
+ for (var i = 0; i < files.length; i++) {
18229
+ if (isInPrevFiles(files[i])) {
18230
+ dupFiles.push(files[i]);
18231
+ } else {
18232
+ allNewFiles.push(files[i]);
18233
+ }
18234
+ }
18235
+ }
18236
+ }
18237
+
18238
+ function toArray(v) {
18239
+ return angular.isArray(v) ? v : [v];
18240
+ }
18241
+
18242
+ function resizeAndUpdate() {
18243
+ function updateModel() {
18244
+ $timeout(function () {
18245
+ update(keep ? prevValidFiles.concat(valids) : valids,
18246
+ keep ? prevInvalidFiles.concat(invalids) : invalids,
18247
+ files, dupFiles, isSingleModel);
18248
+ }, options && options.debounce ? options.debounce.change || options.debounce : 0);
18249
+ }
18250
+
18251
+ var resizingFiles = validateAfterResize ? allNewFiles : valids;
18252
+ resizeFile(resizingFiles, attr, scope, ngModel).then(function () {
18253
+ if (validateAfterResize) {
18254
+ upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
18255
+ .then(function (validationResult) {
18256
+ valids = validationResult.validsFiles;
18257
+ invalids = validationResult.invalidsFiles;
18258
+ updateModel();
18259
+ });
18260
+ } else {
18261
+ updateModel();
18262
+ }
18263
+ }, function () {
18264
+ for (var i = 0; i < resizingFiles.length; i++) {
18265
+ var f = resizingFiles[i];
18266
+ if (f.$error === 'resize') {
18267
+ var index = valids.indexOf(f);
18268
+ if (index > -1) {
18269
+ valids.splice(index, 1);
18270
+ invalids.push(f);
18271
+ }
18272
+ updateModel();
18273
+ }
18274
+ }
18275
+ });
18276
+ }
18277
+
18278
+ prevValidFiles = attr.$$ngfPrevValidFiles || [];
18279
+ prevInvalidFiles = attr.$$ngfPrevInvalidFiles || [];
18280
+ if (ngModel && ngModel.$modelValue) {
18281
+ prevValidFiles = toArray(ngModel.$modelValue);
18282
+ }
18283
+
18284
+ var keep = upload.attrGetter('ngfKeep', attr, scope);
18285
+ allNewFiles = (files || []).slice(0);
18286
+ if (keep === 'distinct' || upload.attrGetter('ngfKeepDistinct', attr, scope) === true) {
18287
+ removeDuplicates(attr, scope);
18288
+ }
18289
+
18290
+ var isSingleModel = !keep && !upload.attrGetter('ngfMultiple', attr, scope) && !upload.attrGetter('multiple', attr);
18291
+
18292
+ if (keep && !allNewFiles.length) return;
18293
+
18294
+ upload.attrGetter('ngfBeforeModelChange', attr, scope, {
18295
+ $files: files,
18296
+ $file: files && files.length ? files[0] : null,
18297
+ $newFiles: allNewFiles,
18298
+ $duplicateFiles: dupFiles,
18299
+ $event: evt
18300
+ });
18301
+
18302
+ var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope);
18303
+
18304
+ var options = upload.attrGetter('ngfModelOptions', attr, scope);
18305
+ upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
18306
+ .then(function (validationResult) {
18307
+ if (noDelay) {
18308
+ update(allNewFiles, [], files, dupFiles, isSingleModel);
18309
+ } else {
18310
+ if ((!options || !options.allowInvalid) && !validateAfterResize) {
18311
+ valids = validationResult.validFiles;
18312
+ invalids = validationResult.invalidFiles;
18313
+ } else {
18314
+ valids = allNewFiles;
18315
+ }
18316
+ if (upload.attrGetter('ngfFixOrientation', attr, scope) && upload.isExifSupported()) {
18317
+ applyExifRotations(valids, attr, scope).then(function () {
18318
+ resizeAndUpdate();
18319
+ });
18320
+ } else {
18321
+ resizeAndUpdate();
18322
+ }
18323
+ }
18324
+ });
18325
+ };
18326
+
18327
+ return upload;
18328
+ }]);
18329
+
18330
+ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', function ($parse, $timeout, $compile, Upload) {
18331
+ var generatedElems = [];
18332
+
18333
+ function isDelayedClickSupported(ua) {
18334
+ var m = ua.match(/Android[^\d]*(\d+)\.(\d+)/);
18335
+ if (m && m.length > 2) {
18336
+ var v = Upload.defaults.androidFixMinorVersion || 4;
18337
+ return parseInt(m[1]) < 4 || (parseInt(m[1]) === v && parseInt(m[2]) < v);
18338
+ }
18339
+
18340
+ return ua.indexOf('Chrome') === -1 && /.*Windows.*Safari.*/.test(ua);
18341
+ }
18342
+
18343
+ function linkFileSelect(scope, elem, attr, ngModel, $parse, $timeout, $compile, upload) {
18344
+ var attrGetter = function (name, scope) {
18345
+ return upload.attrGetter(name, attr, scope);
18346
+ };
18347
+
18348
+ function isInputTypeFile() {
18349
+ return elem[0].tagName.toLowerCase() === 'input' && attr.type && attr.type.toLowerCase() === 'file';
18350
+ }
18351
+
18352
+ function fileChangeAttr() {
18353
+ return attrGetter('ngfChange') || attrGetter('ngfSelect');
18354
+ }
18355
+
18356
+ function changeFn(evt) {
18357
+ if (upload.shouldUpdateOn('change', attr, scope)) {
18358
+ var fileList = evt.__files_ || (evt.target && evt.target.files), files = [];
18359
+ if (!fileList) return;
18360
+ for (var i = 0; i < fileList.length; i++) {
18361
+ files.push(fileList[i]);
18362
+ }
18363
+ upload.updateModel(ngModel, attr, scope, fileChangeAttr(),
18364
+ files.length ? files : null, evt);
18365
+ }
18366
+ }
18367
+
18368
+ upload.registerModelChangeValidator(ngModel, attr, scope);
18369
+
18370
+ var unwatches = [];
18371
+ if (attrGetter('ngfMultiple')) {
18372
+ unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {
18373
+ fileElem.attr('multiple', attrGetter('ngfMultiple', scope));
18374
+ }));
18375
+ }
18376
+ if (attrGetter('ngfCapture')) {
18377
+ unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {
18378
+ fileElem.attr('capture', attrGetter('ngfCapture', scope));
18379
+ }));
18380
+ }
18381
+ if (attrGetter('ngfAccept')) {
18382
+ unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {
18383
+ fileElem.attr('accept', attrGetter('ngfAccept', scope));
18384
+ }));
18385
+ }
18386
+ unwatches.push(attr.$observe('accept', function () {
18387
+ fileElem.attr('accept', attrGetter('accept'));
18388
+ }));
18389
+ function bindAttrToFileInput(fileElem, label) {
18390
+ function updateId(val) {
18391
+ fileElem.attr('id', 'ngf-' + val);
18392
+ label.attr('id', 'ngf-label-' + val);
18393
+ }
18394
+
18395
+ for (var i = 0; i < elem[0].attributes.length; i++) {
18396
+ var attribute = elem[0].attributes[i];
18397
+ if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {
18398
+ if (attribute.name === 'id') {
18399
+ updateId(attribute.value);
18400
+ unwatches.push(attr.$observe('id', updateId));
18401
+ } else {
18402
+ fileElem.attr(attribute.name, (!attribute.value && (attribute.name === 'required' ||
18403
+ attribute.name === 'multiple')) ? attribute.name : attribute.value);
18404
+ }
18405
+ }
18406
+ }
18407
+ }
18408
+
18409
+ function createFileInput() {
18410
+ if (isInputTypeFile()) {
18411
+ return elem;
18412
+ }
18413
+
18414
+ var fileElem = angular.element('<input type="file">');
18415
+
18416
+ var label = angular.element('<label>upload</label>');
18417
+ label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden')
18418
+ .css('width', '0px').css('height', '0px').css('border', 'none')
18419
+ .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1');
18420
+ bindAttrToFileInput(fileElem, label);
18421
+
18422
+ generatedElems.push({el: elem, ref: label});
18423
+
18424
+ document.body.appendChild(label.append(fileElem)[0]);
18425
+
18426
+ return fileElem;
18427
+ }
18428
+
18429
+ function clickHandler(evt) {
18430
+ if (elem.attr('disabled')) return false;
18431
+ if (attrGetter('ngfSelectDisabled', scope)) return;
18432
+
18433
+ var r = detectSwipe(evt);
18434
+ if (r != null) return r;
18435
+
18436
+ resetModel(evt);
18437
+
18438
+ try {
18439
+ if (!isInputTypeFile() && !document.body.contains(fileElem[0])) {
18440
+ generatedElems.push({el: elem, ref: fileElem.parent()});
18441
+ document.body.appendChild(fileElem.parent()[0]);
18442
+ fileElem.bind('change', changeFn);
18443
+ }
18444
+ } catch (e) {
18445
+ }
18446
+
18447
+ if (isDelayedClickSupported(navigator.userAgent)) {
18448
+ setTimeout(function () {
18449
+ fileElem[0].click();
18450
+ }, 0);
18451
+ } else {
18452
+ fileElem[0].click();
18453
+ }
18454
+
18455
+ return false;
18456
+ }
18457
+
18458
+
18459
+ var initialTouchStartY = 0;
18460
+ var initialTouchStartX = 0;
18461
+
18462
+ function detectSwipe(evt) {
18463
+ var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
18464
+ if (touches) {
18465
+ if (evt.type === 'touchstart') {
18466
+ initialTouchStartX = touches[0].clientX;
18467
+ initialTouchStartY = touches[0].clientY;
18468
+ return true;
18469
+ } else {
18470
+ if (evt.type === 'touchend') {
18471
+ var currentX = touches[0].clientX;
18472
+ var currentY = touches[0].clientY;
18473
+ if ((Math.abs(currentX - initialTouchStartX) > 20) ||
18474
+ (Math.abs(currentY - initialTouchStartY) > 20)) {
18475
+ evt.stopPropagation();
18476
+ evt.preventDefault();
18477
+ return false;
18478
+ }
18479
+ }
18480
+ return true;
18481
+ }
18482
+ }
18483
+ }
18484
+
18485
+ var fileElem = elem;
18486
+
18487
+ function resetModel(evt) {
18488
+ if (upload.shouldUpdateOn('click', attr, scope) && fileElem.val()) {
18489
+ fileElem.val(null);
18490
+ upload.updateModel(ngModel, attr, scope, fileChangeAttr(), null, evt, true);
18491
+ }
18492
+ }
18493
+
18494
+ if (!isInputTypeFile()) {
18495
+ fileElem = createFileInput();
18496
+ }
18497
+ fileElem.bind('change', changeFn);
18498
+
18499
+ if (!isInputTypeFile()) {
18500
+ elem.bind('click touchstart touchend', clickHandler);
18501
+ } else {
18502
+ elem.bind('click', resetModel);
18503
+ }
18504
+
18505
+ function ie10SameFileSelectFix(evt) {
18506
+ if (fileElem && !fileElem.attr('__ngf_ie10_Fix_')) {
18507
+ if (!fileElem[0].parentNode) {
18508
+ fileElem = null;
18509
+ return;
18510
+ }
18511
+ evt.preventDefault();
18512
+ evt.stopPropagation();
18513
+ fileElem.unbind('click');
18514
+ var clone = fileElem.clone();
18515
+ fileElem.replaceWith(clone);
18516
+ fileElem = clone;
18517
+ fileElem.attr('__ngf_ie10_Fix_', 'true');
18518
+ fileElem.bind('change', changeFn);
18519
+ fileElem.bind('click', ie10SameFileSelectFix);
18520
+ fileElem[0].click();
18521
+ return false;
18522
+ } else {
18523
+ fileElem.removeAttr('__ngf_ie10_Fix_');
18524
+ }
18525
+ }
18526
+
18527
+ if (navigator.appVersion.indexOf('MSIE 10') !== -1) {
18528
+ fileElem.bind('click', ie10SameFileSelectFix);
18529
+ }
18530
+
18531
+ if (ngModel) ngModel.$formatters.push(function (val) {
18532
+ if (val == null || val.length === 0) {
18533
+ if (fileElem.val()) {
18534
+ fileElem.val(null);
18535
+ }
18536
+ }
18537
+ return val;
18538
+ });
18539
+
18540
+ scope.$on('$destroy', function () {
18541
+ if (!isInputTypeFile()) fileElem.parent().remove();
18542
+ angular.forEach(unwatches, function (unwatch) {
18543
+ unwatch();
18544
+ });
18545
+ });
18546
+
18547
+ $timeout(function () {
18548
+ for (var i = 0; i < generatedElems.length; i++) {
18549
+ var g = generatedElems[i];
18550
+ if (!document.body.contains(g.el[0])) {
18551
+ generatedElems.splice(i, 1);
18552
+ g.ref.remove();
18553
+ }
18554
+ }
18555
+ });
18556
+
18557
+ if (window.FileAPI && window.FileAPI.ngfFixIE) {
18558
+ window.FileAPI.ngfFixIE(elem, fileElem, changeFn);
18559
+ }
18560
+ }
18561
+
18562
+ return {
18563
+ restrict: 'AEC',
18564
+ require: '?ngModel',
18565
+ link: function (scope, elem, attr, ngModel) {
18566
+ linkFileSelect(scope, elem, attr, ngModel, $parse, $timeout, $compile, Upload);
18567
+ }
18568
+ };
18569
+ }]);
18570
+
18571
+ (function () {
18572
+
18573
+ ngFileUpload.service('UploadDataUrl', ['UploadBase', '$timeout', '$q', function (UploadBase, $timeout, $q) {
18574
+ var upload = UploadBase;
18575
+ upload.base64DataUrl = function (file) {
18576
+ if (angular.isArray(file)) {
18577
+ var d = $q.defer(), count = 0;
18578
+ angular.forEach(file, function (f) {
18579
+ upload.dataUrl(f, true)['finally'](function () {
18580
+ count++;
18581
+ if (count === file.length) {
18582
+ var urls = [];
18583
+ angular.forEach(file, function (ff) {
18584
+ urls.push(ff.$ngfDataUrl);
18585
+ });
18586
+ d.resolve(urls, file);
18587
+ }
18588
+ });
18589
+ });
18590
+ return d.promise;
18591
+ } else {
18592
+ return upload.dataUrl(file, true);
18593
+ }
18594
+ };
18595
+ upload.dataUrl = function (file, disallowObjectUrl) {
18596
+ if (!file) return upload.emptyPromise(file, file);
18597
+ if ((disallowObjectUrl && file.$ngfDataUrl != null) || (!disallowObjectUrl && file.$ngfBlobUrl != null)) {
18598
+ return upload.emptyPromise(disallowObjectUrl ? file.$ngfDataUrl : file.$ngfBlobUrl, file);
18599
+ }
18600
+ var p = disallowObjectUrl ? file.$$ngfDataUrlPromise : file.$$ngfBlobUrlPromise;
18601
+ if (p) return p;
18602
+
18603
+ var deferred = $q.defer();
18604
+ $timeout(function () {
18605
+ if (window.FileReader && file &&
18606
+ (!window.FileAPI || navigator.userAgent.indexOf('MSIE 8') === -1 || file.size < 20000) &&
18607
+ (!window.FileAPI || navigator.userAgent.indexOf('MSIE 9') === -1 || file.size < 4000000)) {
18608
+ var URL = window.URL || window.webkitURL;
18609
+ if (URL && URL.createObjectURL && !disallowObjectUrl) {
18610
+ var url;
18611
+ try {
18612
+ url = URL.createObjectURL(file);
18613
+ } catch (e) {
18614
+ $timeout(function () {
18615
+ file.$ngfBlobUrl = '';
18616
+ deferred.reject();
18617
+ });
18618
+ return;
18619
+ }
18620
+ $timeout(function () {
18621
+ file.$ngfBlobUrl = url;
18622
+ if (url) {
18623
+ deferred.resolve(url, file);
18624
+ upload.blobUrls = upload.blobUrls || [];
18625
+ upload.blobUrlsTotalSize = upload.blobUrlsTotalSize || 0;
18626
+ upload.blobUrls.push({url: url, size: file.size});
18627
+ upload.blobUrlsTotalSize += file.size || 0;
18628
+ var maxMemory = upload.defaults.blobUrlsMaxMemory || 268435456;
18629
+ var maxLength = upload.defaults.blobUrlsMaxQueueSize || 200;
18630
+ while ((upload.blobUrlsTotalSize > maxMemory || upload.blobUrls.length > maxLength) && upload.blobUrls.length > 1) {
18631
+ var obj = upload.blobUrls.splice(0, 1)[0];
18632
+ URL.revokeObjectURL(obj.url);
18633
+ upload.blobUrlsTotalSize -= obj.size;
18634
+ }
18635
+ }
18636
+ });
18637
+ } else {
18638
+ var fileReader = new FileReader();
18639
+ fileReader.onload = function (e) {
18640
+ $timeout(function () {
18641
+ file.$ngfDataUrl = e.target.result;
18642
+ deferred.resolve(e.target.result, file);
18643
+ $timeout(function () {
18644
+ delete file.$ngfDataUrl;
18645
+ }, 1000);
18646
+ });
18647
+ };
18648
+ fileReader.onerror = function () {
18649
+ $timeout(function () {
18650
+ file.$ngfDataUrl = '';
18651
+ deferred.reject();
18652
+ });
18653
+ };
18654
+ fileReader.readAsDataURL(file);
18655
+ }
18656
+ } else {
18657
+ $timeout(function () {
18658
+ file[disallowObjectUrl ? '$ngfDataUrl' : '$ngfBlobUrl'] = '';
18659
+ deferred.reject();
18660
+ });
18661
+ }
18662
+ });
18663
+
18664
+ if (disallowObjectUrl) {
18665
+ p = file.$$ngfDataUrlPromise = deferred.promise;
18666
+ } else {
18667
+ p = file.$$ngfBlobUrlPromise = deferred.promise;
18668
+ }
18669
+ p['finally'](function () {
18670
+ delete file[disallowObjectUrl ? '$$ngfDataUrlPromise' : '$$ngfBlobUrlPromise'];
18671
+ });
18672
+ return p;
18673
+ };
18674
+ return upload;
18675
+ }]);
18676
+
18677
+ function getTagType(el) {
18678
+ if (el.tagName.toLowerCase() === 'img') return 'image';
18679
+ if (el.tagName.toLowerCase() === 'audio') return 'audio';
18680
+ if (el.tagName.toLowerCase() === 'video') return 'video';
18681
+ return /./;
18682
+ }
18683
+
18684
+ function linkFileDirective(Upload, $timeout, scope, elem, attr, directiveName, resizeParams, isBackground) {
18685
+ function constructDataUrl(file) {
18686
+ var disallowObjectUrl = Upload.attrGetter('ngfNoObjectUrl', attr, scope);
18687
+ Upload.dataUrl(file, disallowObjectUrl)['finally'](function () {
18688
+ $timeout(function () {
18689
+ var src = (disallowObjectUrl ? file.$ngfDataUrl : file.$ngfBlobUrl) || file.$ngfDataUrl;
18690
+ if (isBackground) {
18691
+ elem.css('background-image', 'url(\'' + (src || '') + '\')');
18692
+ } else {
18693
+ elem.attr('src', src);
18694
+ }
18695
+ if (src) {
18696
+ elem.removeClass('ng-hide');
18697
+ } else {
18698
+ elem.addClass('ng-hide');
18699
+ }
18700
+ });
18701
+ });
18702
+ }
18703
+
18704
+ $timeout(function () {
18705
+ var unwatch = scope.$watch(attr[directiveName], function (file) {
18706
+ var size = resizeParams;
18707
+ if (directiveName === 'ngfThumbnail') {
18708
+ if (!size) {
18709
+ size = {
18710
+ width: elem[0].naturalWidth || elem[0].clientWidth,
18711
+ height: elem[0].naturalHeight || elem[0].clientHeight
18712
+ };
18713
+ }
18714
+ if (size.width === 0 && window.getComputedStyle) {
18715
+ var style = getComputedStyle(elem[0]);
18716
+ if (style.width && style.width.indexOf('px') > -1 && style.height && style.height.indexOf('px') > -1) {
18717
+ size = {
18718
+ width: parseInt(style.width.slice(0, -2)),
18719
+ height: parseInt(style.height.slice(0, -2))
18720
+ };
18721
+ }
18722
+ }
18723
+ }
18724
+
18725
+ if (angular.isString(file)) {
18726
+ elem.removeClass('ng-hide');
18727
+ if (isBackground) {
18728
+ return elem.css('background-image', 'url(\'' + file + '\')');
18729
+ } else {
18730
+ return elem.attr('src', file);
18731
+ }
18732
+ }
18733
+ if (file && file.type && file.type.search(getTagType(elem[0])) === 0 &&
18734
+ (!isBackground || file.type.indexOf('image') === 0)) {
18735
+ if (size && Upload.isResizeSupported()) {
18736
+ size.resizeIf = function (width, height) {
18737
+ return Upload.attrGetter('ngfResizeIf', attr, scope,
18738
+ {$width: width, $height: height, $file: file});
18739
+ };
18740
+ Upload.resize(file, size).then(
18741
+ function (f) {
18742
+ constructDataUrl(f);
18743
+ }, function (e) {
18744
+ throw e;
18745
+ }
18746
+ );
18747
+ } else {
18748
+ constructDataUrl(file);
18749
+ }
18750
+ } else {
18751
+ elem.addClass('ng-hide');
18752
+ }
18753
+ });
18754
+
18755
+ scope.$on('$destroy', function () {
18756
+ unwatch();
18757
+ });
18758
+ });
18759
+ }
18760
+
18761
+
18762
+ ngFileUpload.directive('ngfSrc', ['Upload', '$timeout', function (Upload, $timeout) {
18763
+ return {
18764
+ restrict: 'AE',
18765
+ link: function (scope, elem, attr) {
18766
+ linkFileDirective(Upload, $timeout, scope, elem, attr, 'ngfSrc',
18767
+ Upload.attrGetter('ngfResize', attr, scope), false);
18768
+ }
18769
+ };
18770
+ }]);
18771
+
18772
+ ngFileUpload.directive('ngfBackground', ['Upload', '$timeout', function (Upload, $timeout) {
18773
+ return {
18774
+ restrict: 'AE',
18775
+ link: function (scope, elem, attr) {
18776
+ linkFileDirective(Upload, $timeout, scope, elem, attr, 'ngfBackground',
18777
+ Upload.attrGetter('ngfResize', attr, scope), true);
18778
+ }
18779
+ };
18780
+ }]);
18781
+
18782
+ ngFileUpload.directive('ngfThumbnail', ['Upload', '$timeout', function (Upload, $timeout) {
18783
+ return {
18784
+ restrict: 'AE',
18785
+ link: function (scope, elem, attr) {
18786
+ var size = Upload.attrGetter('ngfSize', attr, scope);
18787
+ linkFileDirective(Upload, $timeout, scope, elem, attr, 'ngfThumbnail', size,
18788
+ Upload.attrGetter('ngfAsBackground', attr, scope));
18789
+ }
18790
+ };
18791
+ }]);
18792
+
18793
+ ngFileUpload.config(['$compileProvider', function ($compileProvider) {
18794
+ if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
18795
+ if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
18796
+ }]);
18797
+
18798
+ ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) {
18799
+ return function (file, disallowObjectUrl, trustedUrl) {
18800
+ if (angular.isString(file)) {
18801
+ return $sce.trustAsResourceUrl(file);
18802
+ }
18803
+ var src = file && ((disallowObjectUrl ? file.$ngfDataUrl : file.$ngfBlobUrl) || file.$ngfDataUrl);
18804
+ if (file && !src) {
18805
+ if (!file.$ngfDataUrlFilterInProgress && angular.isObject(file)) {
18806
+ file.$ngfDataUrlFilterInProgress = true;
18807
+ UploadDataUrl.dataUrl(file, disallowObjectUrl);
18808
+ }
18809
+ return '';
18810
+ }
18811
+ if (file) delete file.$ngfDataUrlFilterInProgress;
18812
+ return (file && src ? (trustedUrl ? $sce.trustAsResourceUrl(src) : src) : file) || '';
18813
+ };
18814
+ }]);
18815
+
18816
+ })();
18817
+
18818
+ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', function (UploadDataUrl, $q, $timeout) {
18819
+ var upload = UploadDataUrl;
18820
+
18821
+ function globStringToRegex(str) {
18822
+ var regexp = '', excludes = [];
18823
+ if (str.length > 2 && str[0] === '/' && str[str.length - 1] === '/') {
18824
+ regexp = str.substring(1, str.length - 1);
18825
+ } else {
18826
+ var split = str.split(',');
18827
+ if (split.length > 1) {
18828
+ for (var i = 0; i < split.length; i++) {
18829
+ var r = globStringToRegex(split[i]);
18830
+ if (r.regexp) {
18831
+ regexp += '(' + r.regexp + ')';
18832
+ if (i < split.length - 1) {
18833
+ regexp += '|';
18834
+ }
18835
+ } else {
18836
+ excludes = excludes.concat(r.excludes);
18837
+ }
18838
+ }
18839
+ } else {
18840
+ if (str.indexOf('!') === 0) {
18841
+ excludes.push('^((?!' + globStringToRegex(str.substring(1)).regexp + ').)*$');
18842
+ } else {
18843
+ if (str.indexOf('.') === 0) {
18844
+ str = '*' + str;
18845
+ }
18846
+ regexp = '^' + str.replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]', 'g'), '\\$&') + '$';
18847
+ regexp = regexp.replace(/\\\*/g, '.*').replace(/\\\?/g, '.');
18848
+ }
18849
+ }
18850
+ }
18851
+ return {regexp: regexp, excludes: excludes};
18852
+ }
18853
+
18854
+ upload.validatePattern = function (file, val) {
18855
+ if (!val) {
18856
+ return true;
18857
+ }
18858
+ var pattern = globStringToRegex(val), valid = true;
18859
+ if (pattern.regexp && pattern.regexp.length) {
18860
+ var regexp = new RegExp(pattern.regexp, 'i');
18861
+ valid = (file.type != null && regexp.test(file.type)) ||
18862
+ (file.name != null && regexp.test(file.name));
18863
+ }
18864
+ var len = pattern.excludes.length;
18865
+ while (len--) {
18866
+ var exclude = new RegExp(pattern.excludes[len], 'i');
18867
+ valid = valid && (file.type == null || exclude.test(file.type)) &&
18868
+ (file.name == null || exclude.test(file.name));
18869
+ }
18870
+ return valid;
18871
+ };
18872
+
18873
+ upload.ratioToFloat = function (val) {
18874
+ var r = val.toString(), xIndex = r.search(/[x:]/i);
18875
+ if (xIndex > -1) {
18876
+ r = parseFloat(r.substring(0, xIndex)) / parseFloat(r.substring(xIndex + 1));
18877
+ } else {
18878
+ r = parseFloat(r);
18879
+ }
18880
+ return r;
18881
+ };
18882
+
18883
+ upload.registerModelChangeValidator = function (ngModel, attr, scope) {
18884
+ if (ngModel) {
18885
+ ngModel.$formatters.push(function (files) {
18886
+ if (ngModel.$dirty) {
18887
+ var filesArray = files;
18888
+ if (files && !angular.isArray(files)) {
18889
+ filesArray = [files];
18890
+ }
18891
+ upload.validate(filesArray, 0, ngModel, attr, scope).then(function () {
18892
+ upload.applyModelValidation(ngModel, filesArray);
18893
+ });
18894
+ }
18895
+ return files;
18896
+ });
18897
+ }
18898
+ };
18899
+
18900
+ function markModelAsDirty(ngModel, files) {
18901
+ if (files != null && !ngModel.$dirty) {
18902
+ if (ngModel.$setDirty) {
18903
+ ngModel.$setDirty();
18904
+ } else {
18905
+ ngModel.$dirty = true;
18906
+ }
18907
+ }
18908
+ }
18909
+
18910
+ upload.applyModelValidation = function (ngModel, files) {
18911
+ markModelAsDirty(ngModel, files);
18912
+ angular.forEach(ngModel.$ngfValidations, function (validation) {
18913
+ ngModel.$setValidity(validation.name, validation.valid);
18914
+ });
18915
+ };
18916
+
18917
+ upload.getValidationAttr = function (attr, scope, name, validationName, file) {
18918
+ var dName = 'ngf' + name[0].toUpperCase() + name.substr(1);
18919
+ var val = upload.attrGetter(dName, attr, scope, {$file: file});
18920
+ if (val == null) {
18921
+ val = upload.attrGetter('ngfValidate', attr, scope, {$file: file});
18922
+ if (val) {
18923
+ var split = (validationName || name).split('.');
18924
+ val = val[split[0]];
18925
+ if (split.length > 1) {
18926
+ val = val && val[split[1]];
18927
+ }
18928
+ }
18929
+ }
18930
+ return val;
18931
+ };
18932
+
18933
+ upload.validate = function (files, prevLength, ngModel, attr, scope) {
18934
+ ngModel = ngModel || {};
18935
+ ngModel.$ngfValidations = ngModel.$ngfValidations || [];
18936
+
18937
+ angular.forEach(ngModel.$ngfValidations, function (v) {
18938
+ v.valid = true;
18939
+ });
18940
+
18941
+ var attrGetter = function (name, params) {
18942
+ return upload.attrGetter(name, attr, scope, params);
18943
+ };
18944
+
18945
+ var ignoredErrors = (upload.attrGetter('ngfIgnoreInvalid', attr, scope) || '').split(' ');
18946
+ var runAllValidation = upload.attrGetter('ngfRunAllValidations', attr, scope);
18947
+
18948
+ if (files == null || files.length === 0) {
18949
+ return upload.emptyPromise({'validFiles': files, 'invalidFiles': []});
18950
+ }
18951
+
18952
+ files = files.length === undefined ? [files] : files.slice(0);
18953
+ var invalidFiles = [];
18954
+
18955
+ function validateSync(name, validationName, fn) {
18956
+ if (files) {
18957
+ var i = files.length, valid = null;
18958
+ while (i--) {
18959
+ var file = files[i];
18960
+ if (file) {
18961
+ var val = upload.getValidationAttr(attr, scope, name, validationName, file);
18962
+ if (val != null) {
18963
+ if (!fn(file, val, i)) {
18964
+ if (ignoredErrors.indexOf(name) === -1) {
18965
+ file.$error = name;
18966
+ (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
18967
+ file.$errorParam = val;
18968
+ if (invalidFiles.indexOf(file) === -1) {
18969
+ invalidFiles.push(file);
18970
+ }
18971
+ if (!runAllValidation) {
18972
+ files.splice(i, 1);
18973
+ }
18974
+ valid = false;
18975
+ } else {
18976
+ files.splice(i, 1);
18977
+ }
18978
+ }
18979
+ }
18980
+ }
18981
+ }
18982
+ if (valid !== null) {
18983
+ ngModel.$ngfValidations.push({name: name, valid: valid});
18984
+ }
18985
+ }
18986
+ }
18987
+
18988
+ validateSync('pattern', null, upload.validatePattern);
18989
+ validateSync('minSize', 'size.min', function (file, val) {
18990
+ return file.size + 0.1 >= upload.translateScalars(val);
18991
+ });
18992
+ validateSync('maxSize', 'size.max', function (file, val) {
18993
+ return file.size - 0.1 <= upload.translateScalars(val);
18994
+ });
18995
+ var totalSize = 0;
18996
+ validateSync('maxTotalSize', null, function (file, val) {
18997
+ totalSize += file.size;
18998
+ if (totalSize > upload.translateScalars(val)) {
18999
+ files.splice(0, files.length);
19000
+ return false;
19001
+ }
19002
+ return true;
19003
+ });
19004
+
19005
+ validateSync('validateFn', null, function (file, r) {
19006
+ return r === true || r === null || r === '';
19007
+ });
19008
+
19009
+ if (!files.length) {
19010
+ return upload.emptyPromise({'validFiles': [], 'invalidFiles': invalidFiles});
19011
+ }
19012
+
19013
+ function validateAsync(name, validationName, type, asyncFn, fn) {
19014
+ function resolveResult(defer, file, val) {
19015
+ function resolveInternal(fn) {
19016
+ if (fn()) {
19017
+ if (ignoredErrors.indexOf(name) === -1) {
19018
+ file.$error = name;
19019
+ (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
19020
+ file.$errorParam = val;
19021
+ if (invalidFiles.indexOf(file) === -1) {
19022
+ invalidFiles.push(file);
19023
+ }
19024
+ if (!runAllValidation) {
19025
+ var i = files.indexOf(file);
19026
+ if (i > -1) files.splice(i, 1);
19027
+ }
19028
+ defer.resolve(false);
19029
+ } else {
19030
+ var j = files.indexOf(file);
19031
+ if (j > -1) files.splice(j, 1);
19032
+ defer.resolve(true);
19033
+ }
19034
+ } else {
19035
+ defer.resolve(true);
19036
+ }
19037
+ }
19038
+
19039
+ if (val != null) {
19040
+ asyncFn(file, val).then(function (d) {
19041
+ resolveInternal(function () {
19042
+ return !fn(d, val);
19043
+ });
19044
+ }, function () {
19045
+ resolveInternal(function () {
19046
+ return attrGetter('ngfValidateForce', {$file: file});
19047
+ });
19048
+ });
19049
+ } else {
19050
+ defer.resolve(true);
19051
+ }
19052
+ }
19053
+
19054
+ var promises = [upload.emptyPromise(true)];
19055
+ if (files) {
19056
+ files = files.length === undefined ? [files] : files;
19057
+ angular.forEach(files, function (file) {
19058
+ var defer = $q.defer();
19059
+ promises.push(defer.promise);
19060
+ if (type && (file.type == null || file.type.search(type) !== 0)) {
19061
+ defer.resolve(true);
19062
+ return;
19063
+ }
19064
+ if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) {
19065
+ upload.imageDimensions(file).then(function (d) {
19066
+ resolveResult(defer, file,
19067
+ attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height}));
19068
+ }, function () {
19069
+ defer.resolve(false);
19070
+ });
19071
+ } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) {
19072
+ upload.mediaDuration(file).then(function (d) {
19073
+ resolveResult(defer, file,
19074
+ attrGetter('ngfDuration', {$file: file, $duration: d}));
19075
+ }, function () {
19076
+ defer.resolve(false);
19077
+ });
19078
+ } else {
19079
+ resolveResult(defer, file,
19080
+ upload.getValidationAttr(attr, scope, name, validationName, file));
19081
+ }
19082
+ });
19083
+ }
19084
+ var deffer = $q.defer();
19085
+ $q.all(promises).then(function (values) {
19086
+ var isValid = true;
19087
+ for (var i = 0; i < values.length; i++) {
19088
+ if (!values[i]) {
19089
+ isValid = false;
19090
+ break;
19091
+ }
19092
+ }
19093
+ ngModel.$ngfValidations.push({name: name, valid: isValid});
19094
+ deffer.resolve(isValid);
19095
+ });
19096
+ return deffer.promise;
19097
+ }
19098
+
19099
+ var deffer = $q.defer();
19100
+ var promises = [];
19101
+
19102
+ promises.push(validateAsync('maxHeight', 'height.max', /image/,
19103
+ this.imageDimensions, function (d, val) {
19104
+ return d.height <= val;
19105
+ }));
19106
+ promises.push(validateAsync('minHeight', 'height.min', /image/,
19107
+ this.imageDimensions, function (d, val) {
19108
+ return d.height >= val;
19109
+ }));
19110
+ promises.push(validateAsync('maxWidth', 'width.max', /image/,
19111
+ this.imageDimensions, function (d, val) {
19112
+ return d.width <= val;
19113
+ }));
19114
+ promises.push(validateAsync('minWidth', 'width.min', /image/,
19115
+ this.imageDimensions, function (d, val) {
19116
+ return d.width >= val;
19117
+ }));
19118
+ promises.push(validateAsync('dimensions', null, /image/,
19119
+ function (file, val) {
19120
+ return upload.emptyPromise(val);
19121
+ }, function (r) {
19122
+ return r;
19123
+ }));
19124
+ promises.push(validateAsync('ratio', null, /image/,
19125
+ this.imageDimensions, function (d, val) {
19126
+ var split = val.toString().split(','), valid = false;
19127
+ for (var i = 0; i < split.length; i++) {
19128
+ if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.01) {
19129
+ valid = true;
19130
+ }
19131
+ }
19132
+ return valid;
19133
+ }));
19134
+ promises.push(validateAsync('maxRatio', 'ratio.max', /image/,
19135
+ this.imageDimensions, function (d, val) {
19136
+ return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001;
19137
+ }));
19138
+ promises.push(validateAsync('minRatio', 'ratio.min', /image/,
19139
+ this.imageDimensions, function (d, val) {
19140
+ return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001;
19141
+ }));
19142
+ promises.push(validateAsync('maxDuration', 'duration.max', /audio|video/,
19143
+ this.mediaDuration, function (d, val) {
19144
+ return d <= upload.translateScalars(val);
19145
+ }));
19146
+ promises.push(validateAsync('minDuration', 'duration.min', /audio|video/,
19147
+ this.mediaDuration, function (d, val) {
19148
+ return d >= upload.translateScalars(val);
19149
+ }));
19150
+ promises.push(validateAsync('duration', null, /audio|video/,
19151
+ function (file, val) {
19152
+ return upload.emptyPromise(val);
19153
+ }, function (r) {
19154
+ return r;
19155
+ }));
19156
+
19157
+ promises.push(validateAsync('validateAsyncFn', null, null,
19158
+ function (file, val) {
19159
+ return val;
19160
+ }, function (r) {
19161
+ return r === true || r === null || r === '';
19162
+ }));
19163
+
19164
+ $q.all(promises).then(function () {
19165
+
19166
+ if (runAllValidation) {
19167
+ for (var i = 0; i < files.length; i++) {
19168
+ var file = files[i];
19169
+ if (file.$error) {
19170
+ files.splice(i--, 1);
19171
+ }
19172
+ }
19173
+ }
19174
+
19175
+ runAllValidation = false;
19176
+ validateSync('maxFiles', null, function (file, val, i) {
19177
+ return prevLength + i < val;
19178
+ });
19179
+
19180
+ deffer.resolve({'validFiles': files, 'invalidFiles': invalidFiles});
19181
+ });
19182
+ return deffer.promise;
19183
+ };
19184
+
19185
+ upload.imageDimensions = function (file) {
19186
+ if (file.$ngfWidth && file.$ngfHeight) {
19187
+ var d = $q.defer();
19188
+ $timeout(function () {
19189
+ d.resolve({width: file.$ngfWidth, height: file.$ngfHeight});
19190
+ });
19191
+ return d.promise;
19192
+ }
19193
+ if (file.$ngfDimensionPromise) return file.$ngfDimensionPromise;
19194
+
19195
+ var deferred = $q.defer();
19196
+ $timeout(function () {
19197
+ if (file.type.indexOf('image') !== 0) {
19198
+ deferred.reject('not image');
19199
+ return;
19200
+ }
19201
+ upload.dataUrl(file).then(function (dataUrl) {
19202
+ var img = angular.element('<img>').attr('src', dataUrl)
19203
+ .css('visibility', 'hidden').css('position', 'fixed')
19204
+ .css('max-width', 'none !important').css('max-height', 'none !important');
19205
+
19206
+ function success() {
19207
+ var width = img[0].naturalWidth || img[0].clientWidth;
19208
+ var height = img[0].naturalHeight || img[0].clientHeight;
19209
+ img.remove();
19210
+ file.$ngfWidth = width;
19211
+ file.$ngfHeight = height;
19212
+ deferred.resolve({width: width, height: height});
19213
+ }
19214
+
19215
+ function error() {
19216
+ img.remove();
19217
+ deferred.reject('load error');
19218
+ }
19219
+
19220
+ img.on('load', success);
19221
+ img.on('error', error);
19222
+
19223
+ var secondsCounter = 0;
19224
+ function checkLoadErrorInCaseOfNoCallback() {
19225
+ $timeout(function () {
19226
+ if (img[0].parentNode) {
19227
+ if (img[0].clientWidth) {
19228
+ success();
19229
+ } else if (secondsCounter++ > 10) {
19230
+ error();
19231
+ } else {
19232
+ checkLoadErrorInCaseOfNoCallback();
19233
+ }
19234
+ }
19235
+ }, 1000);
19236
+ }
19237
+
19238
+ checkLoadErrorInCaseOfNoCallback();
19239
+
19240
+ angular.element(document.getElementsByTagName('body')[0]).append(img);
19241
+ }, function () {
19242
+ deferred.reject('load error');
19243
+ });
19244
+ });
19245
+
19246
+ file.$ngfDimensionPromise = deferred.promise;
19247
+ file.$ngfDimensionPromise['finally'](function () {
19248
+ delete file.$ngfDimensionPromise;
19249
+ });
19250
+ return file.$ngfDimensionPromise;
19251
+ };
19252
+
19253
+ upload.mediaDuration = function (file) {
19254
+ if (file.$ngfDuration) {
19255
+ var d = $q.defer();
19256
+ $timeout(function () {
19257
+ d.resolve(file.$ngfDuration);
19258
+ });
19259
+ return d.promise;
19260
+ }
19261
+ if (file.$ngfDurationPromise) return file.$ngfDurationPromise;
19262
+
19263
+ var deferred = $q.defer();
19264
+ $timeout(function () {
19265
+ if (file.type.indexOf('audio') !== 0 && file.type.indexOf('video') !== 0) {
19266
+ deferred.reject('not media');
19267
+ return;
19268
+ }
19269
+ upload.dataUrl(file).then(function (dataUrl) {
19270
+ var el = angular.element(file.type.indexOf('audio') === 0 ? '<audio>' : '<video>')
19271
+ .attr('src', dataUrl).css('visibility', 'none').css('position', 'fixed');
19272
+
19273
+ function success() {
19274
+ var duration = el[0].duration;
19275
+ file.$ngfDuration = duration;
19276
+ el.remove();
19277
+ deferred.resolve(duration);
19278
+ }
19279
+
19280
+ function error() {
19281
+ el.remove();
19282
+ deferred.reject('load error');
19283
+ }
19284
+
19285
+ el.on('loadedmetadata', success);
19286
+ el.on('error', error);
19287
+ var count = 0;
19288
+
19289
+ function checkLoadError() {
19290
+ $timeout(function () {
19291
+ if (el[0].parentNode) {
19292
+ if (el[0].duration) {
19293
+ success();
19294
+ } else if (count > 10) {
19295
+ error();
19296
+ } else {
19297
+ checkLoadError();
19298
+ }
19299
+ }
19300
+ }, 1000);
19301
+ }
19302
+
19303
+ checkLoadError();
19304
+
19305
+ angular.element(document.body).append(el);
19306
+ }, function () {
19307
+ deferred.reject('load error');
19308
+ });
19309
+ });
19310
+
19311
+ file.$ngfDurationPromise = deferred.promise;
19312
+ file.$ngfDurationPromise['finally'](function () {
19313
+ delete file.$ngfDurationPromise;
19314
+ });
19315
+ return file.$ngfDurationPromise;
19316
+ };
19317
+ return upload;
19318
+ }
19319
+ ]);
19320
+
19321
+ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadValidate, $q) {
19322
+ var upload = UploadValidate;
19323
+
19324
+ var calculateAspectRatioFit = function (srcWidth, srcHeight, maxWidth, maxHeight, centerCrop) {
19325
+ var ratio = centerCrop ? Math.max(maxWidth / srcWidth, maxHeight / srcHeight) :
19326
+ Math.min(maxWidth / srcWidth, maxHeight / srcHeight);
19327
+ return {
19328
+ width: srcWidth * ratio, height: srcHeight * ratio,
19329
+ marginX: srcWidth * ratio - maxWidth, marginY: srcHeight * ratio - maxHeight
19330
+ };
19331
+ };
19332
+
19333
+ var resize = function (imagen, width, height, quality, type, ratio, centerCrop, resizeIf) {
19334
+ var deferred = $q.defer();
19335
+ var canvasElement = document.createElement('canvas');
19336
+ var imageElement = document.createElement('img');
19337
+ imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000');
19338
+ document.body.appendChild(imageElement);
19339
+
19340
+ imageElement.onload = function () {
19341
+ var imgWidth = imageElement.width, imgHeight = imageElement.height;
19342
+ imageElement.parentNode.removeChild(imageElement);
19343
+ if (resizeIf != null && resizeIf(imgWidth, imgHeight) === false) {
19344
+ deferred.reject('resizeIf');
19345
+ return;
19346
+ }
19347
+ try {
19348
+ if (ratio) {
19349
+ var ratioFloat = upload.ratioToFloat(ratio);
19350
+ var imgRatio = imgWidth / imgHeight;
19351
+ if (imgRatio < ratioFloat) {
19352
+ width = imgWidth;
19353
+ height = width / ratioFloat;
19354
+ } else {
19355
+ height = imgHeight;
19356
+ width = height * ratioFloat;
19357
+ }
19358
+ }
19359
+ if (!width) {
19360
+ width = imgWidth;
19361
+ }
19362
+ if (!height) {
19363
+ height = imgHeight;
19364
+ }
19365
+ var dimensions = calculateAspectRatioFit(imgWidth, imgHeight, width, height, centerCrop);
19366
+ canvasElement.width = Math.min(dimensions.width, width);
19367
+ canvasElement.height = Math.min(dimensions.height, height);
19368
+ var context = canvasElement.getContext('2d');
19369
+ context.drawImage(imageElement,
19370
+ Math.min(0, -dimensions.marginX / 2), Math.min(0, -dimensions.marginY / 2),
19371
+ dimensions.width, dimensions.height);
19372
+ deferred.resolve(canvasElement.toDataURL(type || 'image/WebP', quality || 0.934));
19373
+ } catch (e) {
19374
+ deferred.reject(e);
19375
+ }
19376
+ };
19377
+ imageElement.onerror = function () {
19378
+ imageElement.parentNode.removeChild(imageElement);
19379
+ deferred.reject();
19380
+ };
19381
+ imageElement.src = imagen;
19382
+ return deferred.promise;
19383
+ };
19384
+
19385
+ upload.dataUrltoBlob = function (dataurl, name, origSize) {
19386
+ var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
19387
+ bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
19388
+ while (n--) {
19389
+ u8arr[n] = bstr.charCodeAt(n);
19390
+ }
19391
+ var blob = new window.Blob([u8arr], {type: mime});
19392
+ blob.name = name;
19393
+ blob.$ngfOrigSize = origSize;
19394
+ return blob;
19395
+ };
19396
+
19397
+ upload.isResizeSupported = function () {
19398
+ var elem = document.createElement('canvas');
19399
+ return window.atob && elem.getContext && elem.getContext('2d') && window.Blob;
19400
+ };
19401
+
19402
+ if (upload.isResizeSupported()) {
19403
+ Object.defineProperty(window.Blob.prototype, 'name', {
19404
+ get: function () {
19405
+ return this.$ngfName;
19406
+ },
19407
+ set: function (v) {
19408
+ this.$ngfName = v;
19409
+ },
19410
+ configurable: true
19411
+ });
19412
+ }
19413
+
19414
+ upload.resize = function (file, options) {
19415
+ if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file);
19416
+
19417
+ var deferred = $q.defer();
19418
+ upload.dataUrl(file, true).then(function (url) {
19419
+ resize(url, options.width, options.height, options.quality, options.type || file.type,
19420
+ options.ratio, options.centerCrop, options.resizeIf)
19421
+ .then(function (dataUrl) {
19422
+ if (file.type === 'image/jpeg' && options.restoreExif !== false) {
19423
+ try {
19424
+ dataUrl = upload.restoreExif(url, dataUrl);
19425
+ } catch (e) {
19426
+ setTimeout(function () {throw e;}, 1);
19427
+ }
19428
+ }
19429
+ try {
19430
+ var blob = upload.dataUrltoBlob(dataUrl, file.name, file.size);
19431
+ deferred.resolve(blob);
19432
+ } catch (e) {
19433
+ deferred.reject(e);
19434
+ }
19435
+ }, function (r) {
19436
+ if (r === 'resizeIf') {
19437
+ deferred.resolve(file);
19438
+ }
19439
+ deferred.reject(r);
19440
+ });
19441
+ }, function (e) {
19442
+ deferred.reject(e);
19443
+ });
19444
+ return deferred.promise;
19445
+ };
19446
+
19447
+ return upload;
19448
+ }]);
19449
+
19450
+ (function () {
19451
+ ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$window', 'Upload', '$http', '$q',
19452
+ function ($parse, $timeout, $window, Upload, $http, $q) {
19453
+ return {
19454
+ restrict: 'AEC',
19455
+ require: '?ngModel',
19456
+ link: function (scope, elem, attr, ngModel) {
19457
+ linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, Upload, $http, $q);
19458
+ }
19459
+ };
19460
+ }]);
19461
+
19462
+ ngFileUpload.directive('ngfNoFileDrop', function () {
19463
+ return function (scope, elem) {
19464
+ if (dropAvailable()) elem.css('display', 'none');
19465
+ };
19466
+ });
19467
+
19468
+ ngFileUpload.directive('ngfDropAvailable', ['$parse', '$timeout', 'Upload', function ($parse, $timeout, Upload) {
19469
+ return function (scope, elem, attr) {
19470
+ if (dropAvailable()) {
19471
+ var model = $parse(Upload.attrGetter('ngfDropAvailable', attr));
19472
+ $timeout(function () {
19473
+ model(scope);
19474
+ if (model.assign) {
19475
+ model.assign(scope, true);
19476
+ }
19477
+ });
19478
+ }
19479
+ };
19480
+ }]);
19481
+
19482
+ function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, upload, $http, $q) {
19483
+ var available = dropAvailable();
19484
+
19485
+ var attrGetter = function (name, scope, params) {
19486
+ return upload.attrGetter(name, attr, scope, params);
19487
+ };
19488
+
19489
+ if (attrGetter('dropAvailable')) {
19490
+ $timeout(function () {
19491
+ if (scope[attrGetter('dropAvailable')]) {
19492
+ scope[attrGetter('dropAvailable')].value = available;
19493
+ } else {
19494
+ scope[attrGetter('dropAvailable')] = available;
19495
+ }
19496
+ });
19497
+ }
19498
+ if (!available) {
19499
+ if (attrGetter('ngfHideOnDropNotAvailable', scope) === true) {
19500
+ elem.css('display', 'none');
19501
+ }
19502
+ return;
19503
+ }
19504
+
19505
+ function isDisabled() {
19506
+ return elem.attr('disabled') || attrGetter('ngfDropDisabled', scope);
19507
+ }
19508
+
19509
+ if (attrGetter('ngfSelect') == null) {
19510
+ upload.registerModelChangeValidator(ngModel, attr, scope);
19511
+ }
19512
+
19513
+ var leaveTimeout = null;
19514
+ var stopPropagation = $parse(attrGetter('ngfStopPropagation'));
19515
+ var dragOverDelay = 1;
19516
+ var actualDragOverClass;
19517
+
19518
+ elem[0].addEventListener('dragover', function (evt) {
19519
+ if (isDisabled() || !upload.shouldUpdateOn('drop', attr, scope)) return;
19520
+ evt.preventDefault();
19521
+ if (stopPropagation(scope)) evt.stopPropagation();
19522
+ if (navigator.userAgent.indexOf('Chrome') > -1) {
19523
+ var b = evt.dataTransfer.effectAllowed;
19524
+ evt.dataTransfer.dropEffect = ('move' === b || 'linkMove' === b) ? 'move' : 'copy';
19525
+ }
19526
+ $timeout.cancel(leaveTimeout);
19527
+ if (!actualDragOverClass) {
19528
+ actualDragOverClass = 'C';
19529
+ calculateDragOverClass(scope, attr, evt, function (clazz) {
19530
+ actualDragOverClass = clazz;
19531
+ elem.addClass(actualDragOverClass);
19532
+ attrGetter('ngfDrag', scope, {$isDragging: true, $class: actualDragOverClass, $event: evt});
19533
+ });
19534
+ }
19535
+ }, false);
19536
+ elem[0].addEventListener('dragenter', function (evt) {
19537
+ if (isDisabled() || !upload.shouldUpdateOn('drop', attr, scope)) return;
19538
+ evt.preventDefault();
19539
+ if (stopPropagation(scope)) evt.stopPropagation();
19540
+ }, false);
19541
+ elem[0].addEventListener('dragleave', function (evt) {
19542
+ if (isDisabled() || !upload.shouldUpdateOn('drop', attr, scope)) return;
19543
+ evt.preventDefault();
19544
+ if (stopPropagation(scope)) evt.stopPropagation();
19545
+ leaveTimeout = $timeout(function () {
19546
+ if (actualDragOverClass) elem.removeClass(actualDragOverClass);
19547
+ actualDragOverClass = null;
19548
+ attrGetter('ngfDrag', scope, {$isDragging: false, $event: evt});
19549
+ }, dragOverDelay || 100);
19550
+ }, false);
19551
+ elem[0].addEventListener('drop', function (evt) {
19552
+ if (isDisabled() || !upload.shouldUpdateOn('drop', attr, scope)) return;
19553
+ evt.preventDefault();
19554
+ if (stopPropagation(scope)) evt.stopPropagation();
19555
+ if (actualDragOverClass) elem.removeClass(actualDragOverClass);
19556
+ actualDragOverClass = null;
19557
+ extractFilesAndUpdateModel(evt.dataTransfer, evt, 'dropUrl');
19558
+ }, false);
19559
+ elem[0].addEventListener('paste', function (evt) {
19560
+ if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
19561
+ attrGetter('ngfEnableFirefoxPaste', scope)) {
19562
+ evt.preventDefault();
19563
+ }
19564
+ if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return;
19565
+ extractFilesAndUpdateModel(evt.clipboardData || evt.originalEvent.clipboardData, evt, 'pasteUrl');
19566
+ }, false);
19567
+
19568
+ if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
19569
+ attrGetter('ngfEnableFirefoxPaste', scope)) {
19570
+ elem.attr('contenteditable', true);
19571
+ elem.on('keypress', function (e) {
19572
+ if (!e.metaKey && !e.ctrlKey) {
19573
+ e.preventDefault();
19574
+ }
19575
+ });
19576
+ }
19577
+
19578
+ function extractFilesAndUpdateModel(source, evt, updateOnType) {
19579
+ if (!source) return;
19580
+ var html;
19581
+ try {
19582
+ html = source && source.getData && source.getData('text/html');
19583
+ } catch (e) {
19584
+ }
19585
+ extractFiles(source.items, source.files, attrGetter('ngfAllowDir', scope) !== false,
19586
+ attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
19587
+ if (files.length) {
19588
+ updateModel(files, evt);
19589
+ } else {
19590
+ extractFilesFromHtml(updateOnType, html).then(function (files) {
19591
+ updateModel(files, evt);
19592
+ });
19593
+ }
19594
+ });
19595
+ }
19596
+
19597
+ function updateModel(files, evt) {
19598
+ upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt);
19599
+ }
19600
+
19601
+ function extractFilesFromHtml(updateOn, html) {
19602
+ if (!upload.shouldUpdateOn(updateOn, attr, scope) || typeof html !== 'string') return upload.rejectPromise([]);
19603
+ var urls = [];
19604
+ html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) {
19605
+ urls.push(src);
19606
+ });
19607
+ var promises = [], files = [];
19608
+ if (urls.length) {
19609
+ angular.forEach(urls, function (url) {
19610
+ promises.push(upload.urlToBlob(url).then(function (blob) {
19611
+ files.push(blob);
19612
+ }));
19613
+ });
19614
+ var defer = $q.defer();
19615
+ $q.all(promises).then(function () {
19616
+ defer.resolve(files);
19617
+ }, function (e) {
19618
+ defer.reject(e);
19619
+ });
19620
+ return defer.promise;
19621
+ }
19622
+ return upload.emptyPromise();
19623
+ }
19624
+
19625
+ function calculateDragOverClass(scope, attr, evt, callback) {
19626
+ var obj = attrGetter('ngfDragOverClass', scope, {$event: evt}), dClass = 'dragover';
19627
+ if (angular.isString(obj)) {
19628
+ dClass = obj;
19629
+ } else if (obj) {
19630
+ if (obj.delay) dragOverDelay = obj.delay;
19631
+ if (obj.accept || obj.reject) {
19632
+ var items = evt.dataTransfer.items;
19633
+ if (items == null || !items.length) {
19634
+ dClass = obj.accept;
19635
+ } else {
19636
+ var pattern = obj.pattern || attrGetter('ngfPattern', scope, {$event: evt});
19637
+ var len = items.length;
19638
+ while (len--) {
19639
+ if (!upload.validatePattern(items[len], pattern)) {
19640
+ dClass = obj.reject;
19641
+ break;
19642
+ } else {
19643
+ dClass = obj.accept;
19644
+ }
19645
+ }
19646
+ }
19647
+ }
19648
+ }
19649
+ callback(dClass);
19650
+ }
19651
+
19652
+ function extractFiles(items, fileList, allowDir, multiple) {
19653
+ var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles');
19654
+ if (maxFiles == null) {
19655
+ maxFiles = Number.MAX_VALUE;
19656
+ }
19657
+ var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize');
19658
+ if (maxTotalSize == null) {
19659
+ maxTotalSize = Number.MAX_VALUE;
19660
+ }
19661
+ var includeDir = attrGetter('ngfIncludeDir', scope);
19662
+ var files = [], totalSize = 0;
19663
+
19664
+ function traverseFileTree(entry, path) {
19665
+ var defer = $q.defer();
19666
+ if (entry != null) {
19667
+ if (entry.isDirectory) {
19668
+ var promises = [upload.emptyPromise()];
19669
+ if (includeDir) {
19670
+ var file = {type: 'directory'};
19671
+ file.name = file.path = (path || '') + entry.name;
19672
+ files.push(file);
19673
+ }
19674
+ var dirReader = entry.createReader();
19675
+ var entries = [];
19676
+ var readEntries = function () {
19677
+ dirReader.readEntries(function (results) {
19678
+ try {
19679
+ if (!results.length) {
19680
+ angular.forEach(entries.slice(0), function (e) {
19681
+ if (files.length <= maxFiles && totalSize <= maxTotalSize) {
19682
+ promises.push(traverseFileTree(e, (path ? path : '') + entry.name + '/'));
19683
+ }
19684
+ });
19685
+ $q.all(promises).then(function () {
19686
+ defer.resolve();
19687
+ }, function (e) {
19688
+ defer.reject(e);
19689
+ });
19690
+ } else {
19691
+ entries = entries.concat(Array.prototype.slice.call(results || [], 0));
19692
+ readEntries();
19693
+ }
19694
+ } catch (e) {
19695
+ defer.reject(e);
19696
+ }
19697
+ }, function (e) {
19698
+ defer.reject(e);
19699
+ });
19700
+ };
19701
+ readEntries();
19702
+ } else {
19703
+ entry.file(function (file) {
19704
+ try {
19705
+ file.path = (path ? path : '') + file.name;
19706
+ if (includeDir) {
19707
+ file = upload.rename(file, file.path);
19708
+ }
19709
+ files.push(file);
19710
+ totalSize += file.size;
19711
+ defer.resolve();
19712
+ } catch (e) {
19713
+ defer.reject(e);
19714
+ }
19715
+ }, function (e) {
19716
+ defer.reject(e);
19717
+ });
19718
+ }
19719
+ }
19720
+ return defer.promise;
19721
+ }
19722
+
19723
+ var promises = [upload.emptyPromise()];
19724
+
19725
+ if (items && items.length > 0 && $window.location.protocol !== 'file:') {
19726
+ for (var i = 0; i < items.length; i++) {
19727
+ if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) {
19728
+ var entry = items[i].webkitGetAsEntry();
19729
+ if (entry.isDirectory && !allowDir) {
19730
+ continue;
19731
+ }
19732
+ if (entry != null) {
19733
+ promises.push(traverseFileTree(entry));
19734
+ }
19735
+ } else {
19736
+ var f = items[i].getAsFile();
19737
+ if (f != null) {
19738
+ files.push(f);
19739
+ totalSize += f.size;
19740
+ }
19741
+ }
19742
+ if (files.length > maxFiles || totalSize > maxTotalSize ||
19743
+ (!multiple && files.length > 0)) break;
19744
+ }
19745
+ } else {
19746
+ if (fileList != null) {
19747
+ for (var j = 0; j < fileList.length; j++) {
19748
+ var file = fileList.item(j);
19749
+ if (file.type || file.size > 0) {
19750
+ files.push(file);
19751
+ totalSize += file.size;
19752
+ }
19753
+ if (files.length > maxFiles || totalSize > maxTotalSize ||
19754
+ (!multiple && files.length > 0)) break;
19755
+ }
19756
+ }
19757
+ }
19758
+
19759
+ var defer = $q.defer();
19760
+ $q.all(promises).then(function () {
19761
+ if (!multiple && !includeDir && files.length) {
19762
+ var i = 0;
19763
+ while (files[i] && files[i].type === 'directory') i++;
19764
+ defer.resolve([files[i]]);
19765
+ } else {
19766
+ defer.resolve(files);
19767
+ }
19768
+ }, function (e) {
19769
+ defer.reject(e);
19770
+ });
19771
+
19772
+ return defer.promise;
19773
+ }
19774
+ }
19775
+
19776
+ function dropAvailable() {
19777
+ var div = document.createElement('div');
19778
+ return ('draggable' in div) && ('ondrop' in div) && !/Edge\/12./i.test(navigator.userAgent);
19779
+ }
19780
+
19781
+ })();
19782
+
19783
+ ngFileUpload.service('UploadExif', ['UploadResize', '$q', function (UploadResize, $q) {
19784
+ var upload = UploadResize;
19785
+
19786
+ upload.isExifSupported = function () {
19787
+ return window.FileReader && new FileReader().readAsArrayBuffer && upload.isResizeSupported();
19788
+ };
19789
+
19790
+ function applyTransform(ctx, orientation, width, height) {
19791
+ switch (orientation) {
19792
+ case 2:
19793
+ return ctx.transform(-1, 0, 0, 1, width, 0);
19794
+ case 3:
19795
+ return ctx.transform(-1, 0, 0, -1, width, height);
19796
+ case 4:
19797
+ return ctx.transform(1, 0, 0, -1, 0, height);
19798
+ case 5:
19799
+ return ctx.transform(0, 1, 1, 0, 0, 0);
19800
+ case 6:
19801
+ return ctx.transform(0, 1, -1, 0, height, 0);
19802
+ case 7:
19803
+ return ctx.transform(0, -1, -1, 0, height, width);
19804
+ case 8:
19805
+ return ctx.transform(0, -1, 1, 0, 0, width);
19806
+ }
19807
+ }
19808
+
19809
+ upload.readOrientation = function (file) {
19810
+ var defer = $q.defer();
19811
+ var reader = new FileReader();
19812
+ var slicedFile = file.slice ? file.slice(0, 64 * 1024) : file;
19813
+ reader.readAsArrayBuffer(slicedFile);
19814
+ reader.onerror = function (e) {
19815
+ return defer.reject(e);
19816
+ };
19817
+ reader.onload = function (e) {
19818
+ var result = {orientation: 1};
19819
+ var view = new DataView(this.result);
19820
+ if (view.getUint16(0, false) !== 0xFFD8) return defer.resolve(result);
19821
+
19822
+ var length = view.byteLength,
19823
+ offset = 2;
19824
+ while (offset < length) {
19825
+ var marker = view.getUint16(offset, false);
19826
+ offset += 2;
19827
+ if (marker === 0xFFE1) {
19828
+ if (view.getUint32(offset += 2, false) !== 0x45786966) return defer.resolve(result);
19829
+
19830
+ var little = view.getUint16(offset += 6, false) === 0x4949;
19831
+ offset += view.getUint32(offset + 4, little);
19832
+ var tags = view.getUint16(offset, little);
19833
+ offset += 2;
19834
+ for (var i = 0; i < tags; i++)
19835
+ if (view.getUint16(offset + (i * 12), little) === 0x0112) {
19836
+ var orientation = view.getUint16(offset + (i * 12) + 8, little);
19837
+ if (orientation >= 2 && orientation <= 8) {
19838
+ view.setUint16(offset + (i * 12) + 8, 1, little);
19839
+ result.fixedArrayBuffer = e.target.result;
19840
+ }
19841
+ result.orientation = orientation;
19842
+ return defer.resolve(result);
19843
+ }
19844
+ } else if ((marker & 0xFF00) !== 0xFF00) break;
19845
+ else offset += view.getUint16(offset, false);
19846
+ }
19847
+ return defer.resolve(result);
19848
+ };
19849
+ return defer.promise;
19850
+ };
19851
+
19852
+ function arrayBufferToBase64(buffer) {
19853
+ var binary = '';
19854
+ var bytes = new Uint8Array(buffer);
19855
+ var len = bytes.byteLength;
19856
+ for (var i = 0; i < len; i++) {
19857
+ binary += String.fromCharCode(bytes[i]);
19858
+ }
19859
+ return window.btoa(binary);
19860
+ }
19861
+
19862
+ upload.applyExifRotation = function (file) {
19863
+ if (file.type.indexOf('image/jpeg') !== 0) {
19864
+ return upload.emptyPromise(file);
19865
+ }
19866
+
19867
+ var deferred = $q.defer();
19868
+ upload.readOrientation(file).then(function (result) {
19869
+ if (result.orientation < 2 || result.orientation > 8) {
19870
+ return deferred.resolve(file);
19871
+ }
19872
+ upload.dataUrl(file, true).then(function (url) {
19873
+ var canvas = document.createElement('canvas');
19874
+ var img = document.createElement('img');
19875
+
19876
+ img.onload = function () {
19877
+ try {
19878
+ canvas.width = result.orientation > 4 ? img.height : img.width;
19879
+ canvas.height = result.orientation > 4 ? img.width : img.height;
19880
+ var ctx = canvas.getContext('2d');
19881
+ applyTransform(ctx, result.orientation, img.width, img.height);
19882
+ ctx.drawImage(img, 0, 0);
19883
+ var dataUrl = canvas.toDataURL(file.type || 'image/WebP', 0.934);
19884
+ dataUrl = upload.restoreExif(arrayBufferToBase64(result.fixedArrayBuffer), dataUrl);
19885
+ var blob = upload.dataUrltoBlob(dataUrl, file.name);
19886
+ deferred.resolve(blob);
19887
+ } catch (e) {
19888
+ return deferred.reject(e);
19889
+ }
19890
+ };
19891
+ img.onerror = function () {
19892
+ deferred.reject();
19893
+ };
19894
+ img.src = url;
19895
+ }, function (e) {
19896
+ deferred.reject(e);
19897
+ });
19898
+ }, function (e) {
19899
+ deferred.reject(e);
19900
+ });
19901
+ return deferred.promise;
19902
+ };
19903
+
19904
+ upload.restoreExif = function (orig, resized) {
19905
+ var ExifRestorer = {};
19906
+
19907
+ ExifRestorer.KEY_STR = 'ABCDEFGHIJKLMNOP' +
19908
+ 'QRSTUVWXYZabcdef' +
19909
+ 'ghijklmnopqrstuv' +
19910
+ 'wxyz0123456789+/' +
19911
+ '=';
19912
+
19913
+ ExifRestorer.encode64 = function (input) {
19914
+ var output = '',
19915
+ chr1, chr2, chr3 = '',
19916
+ enc1, enc2, enc3, enc4 = '',
19917
+ i = 0;
19918
+
19919
+ do {
19920
+ chr1 = input[i++];
19921
+ chr2 = input[i++];
19922
+ chr3 = input[i++];
19923
+
19924
+ enc1 = chr1 >> 2;
19925
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
19926
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
19927
+ enc4 = chr3 & 63;
19928
+
19929
+ if (isNaN(chr2)) {
19930
+ enc3 = enc4 = 64;
19931
+ } else if (isNaN(chr3)) {
19932
+ enc4 = 64;
19933
+ }
19934
+
19935
+ output = output +
19936
+ this.KEY_STR.charAt(enc1) +
19937
+ this.KEY_STR.charAt(enc2) +
19938
+ this.KEY_STR.charAt(enc3) +
19939
+ this.KEY_STR.charAt(enc4);
19940
+ chr1 = chr2 = chr3 = '';
19941
+ enc1 = enc2 = enc3 = enc4 = '';
19942
+ } while (i < input.length);
19943
+
19944
+ return output;
19945
+ };
19946
+
19947
+ ExifRestorer.restore = function (origFileBase64, resizedFileBase64) {
19948
+ if (origFileBase64.match('data:image/jpeg;base64,')) {
19949
+ origFileBase64 = origFileBase64.replace('data:image/jpeg;base64,', '');
19950
+ }
19951
+
19952
+ var rawImage = this.decode64(origFileBase64);
19953
+ var segments = this.slice2Segments(rawImage);
19954
+
19955
+ var image = this.exifManipulation(resizedFileBase64, segments);
19956
+
19957
+ return 'data:image/jpeg;base64,' + this.encode64(image);
19958
+ };
19959
+
19960
+
19961
+ ExifRestorer.exifManipulation = function (resizedFileBase64, segments) {
19962
+ var exifArray = this.getExifArray(segments),
19963
+ newImageArray = this.insertExif(resizedFileBase64, exifArray);
19964
+ return new Uint8Array(newImageArray);
19965
+ };
19966
+
19967
+
19968
+ ExifRestorer.getExifArray = function (segments) {
19969
+ var seg;
19970
+ for (var x = 0; x < segments.length; x++) {
19971
+ seg = segments[x];
19972
+ if (seg[0] === 255 & seg[1] === 225)
19973
+ {
19974
+ return seg;
19975
+ }
19976
+ }
19977
+ return [];
19978
+ };
19979
+
19980
+
19981
+ ExifRestorer.insertExif = function (resizedFileBase64, exifArray) {
19982
+ var imageData = resizedFileBase64.replace('data:image/jpeg;base64,', ''),
19983
+ buf = this.decode64(imageData),
19984
+ separatePoint = buf.indexOf(255, 3),
19985
+ mae = buf.slice(0, separatePoint),
19986
+ ato = buf.slice(separatePoint),
19987
+ array = mae;
19988
+
19989
+ array = array.concat(exifArray);
19990
+ array = array.concat(ato);
19991
+ return array;
19992
+ };
19993
+
19994
+
19995
+ ExifRestorer.slice2Segments = function (rawImageArray) {
19996
+ var head = 0,
19997
+ segments = [];
19998
+
19999
+ while (1) {
20000
+ if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 218) {
20001
+ break;
20002
+ }
20003
+ if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 216) {
20004
+ head += 2;
20005
+ }
20006
+ else {
20007
+ var length = rawImageArray[head + 2] * 256 + rawImageArray[head + 3],
20008
+ endPoint = head + length + 2,
20009
+ seg = rawImageArray.slice(head, endPoint);
20010
+ segments.push(seg);
20011
+ head = endPoint;
20012
+ }
20013
+ if (head > rawImageArray.length) {
20014
+ break;
20015
+ }
20016
+ }
20017
+
20018
+ return segments;
20019
+ };
20020
+
20021
+
20022
+ ExifRestorer.decode64 = function (input) {
20023
+ var chr1, chr2, chr3 = '',
20024
+ enc1, enc2, enc3, enc4 = '',
20025
+ i = 0,
20026
+ buf = [];
20027
+
20028
+ var base64test = /[^A-Za-z0-9\+\/\=]/g;
20029
+ if (base64test.exec(input)) {
20030
+ console.log('There were invalid base64 characters in the input text.\n' +
20031
+ 'Valid base64 characters are A-Z, a-z, 0-9, ' + ', ' / ',and "="\n' +
20032
+ 'Expect errors in decoding.');
20033
+ }
20034
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
20035
+
20036
+ do {
20037
+ enc1 = this.KEY_STR.indexOf(input.charAt(i++));
20038
+ enc2 = this.KEY_STR.indexOf(input.charAt(i++));
20039
+ enc3 = this.KEY_STR.indexOf(input.charAt(i++));
20040
+ enc4 = this.KEY_STR.indexOf(input.charAt(i++));
20041
+
20042
+ chr1 = (enc1 << 2) | (enc2 >> 4);
20043
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
20044
+ chr3 = ((enc3 & 3) << 6) | enc4;
20045
+
20046
+ buf.push(chr1);
20047
+
20048
+ if (enc3 !== 64) {
20049
+ buf.push(chr2);
20050
+ }
20051
+ if (enc4 !== 64) {
20052
+ buf.push(chr3);
20053
+ }
20054
+
20055
+ chr1 = chr2 = chr3 = '';
20056
+ enc1 = enc2 = enc3 = enc4 = '';
20057
+
20058
+ } while (i < input.length);
20059
+
20060
+ return buf;
20061
+ };
20062
+
20063
+ return ExifRestorer.restore(orig, resized);
20064
+ };
20065
+
20066
+ return upload;
20067
+ }]);
20068
+
20069
+
20070
+ },{}],44:[function(require,module,exports){
20071
+ require('./dist/ng-file-upload-all');
20072
+ module.exports = 'ngFileUpload';
20073
+ },{"./dist/ng-file-upload-all":43}]},{},[37]);
20074
+
20075
+ angular.element(document).ready(function() {
20076
+ angular.bootstrap(document.getElementById('jpibfi-container'), ['jpibfi']);
20077
+ window.angular = existingWindowDotAngular;
20078
+ });
20079
+ })()
js/jpibfi.client.js CHANGED
@@ -1 +1 @@
1
- !function t(e,n,i){function r(a,u){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return r(n?n:t)},c,c.exports,t,e,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<i.length;a++)r(i[a]);return r}({1:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.siteTitle,r=void 0===n?"":n;i(this,t),this.desc_funcs={img_title:function(t){return t.attr("title")},img_alt:function(t){return t.attr("alt")},post_title:function(t){return t.attr("data-jpibfi-post-title")},post_excerpt:function(t){return t.attr("data-jpibfi-post-excerpt")},img_description:function(t){return t.attr("data-jpibfi-description")},img_caption:function(t){return t.attr("data-jpibfi-caption")},site_title:function(){return r}}}return r(t,[{key:"getDescription",value:function(t,e){for(var n="",i=0;i<e.length&&!n;i++)n=this.desc_funcs[e[i]](t);return n||""}}]),t}();n["default"]=o},{}],2:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e){var n=this;i(this,t),this.flags={},this.pluginName=e;var r="undefined"!=typeof console&&"undefined"!=typeof console.log,o="undefined"!=typeof JSON&&"function"==typeof JSON.stringify;r?(this.logString=function(t){n.log(t)},this.logObject=o?function(t){n.log(JSON.stringify(t,null,4))}:function(t){return n.simplelogObject(t)}):(this.logString=function(){},this.logObject=function(){});var a=this.getQueryParams(document.location.search);Object.keys(a).forEach(function(t){var i=t.replace(e+"_","");n.setFlag(i,a[t])})}return r(t,[{key:"getFlag",value:function(t){return void 0!=this.flags[t]&&this.flags[t]}},{key:"getQueryParams",value:function(t){t=t.split("+").join(" ");for(var e={},n=void 0,i=/[?&]?([^=]+)=([^&]*)/g;n=i.exec(t);)e[decodeURIComponent(n[1])]=decodeURIComponent(n[2]);return e}},{key:"log",value:function(t){this.getFlag("print")&&console.log(this.pluginName+" debug: "+t)}},{key:"setFlag",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.flags[t]=e}},{key:"simplelogObject",value:function(t){if(this.getFlag("print")){var e=Object.keys(t).filter(function(e){return t.hasOwnPrototype(e)}).map(function(e){return e+": "+t[e]+"\n"}).join();this.log(e)}}}]),t}();n["default"]=o},{}],3:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=t("./link-generator"),u=i(a),s=function(){function t(e,n){r(this,t),this.$=e,this.settings=n,this.linkGenerator=new u["default"](n),this.$element=this.$("<a />",{target:"_blank","class":"pinit-button "+n.pin_image});var i="default"===n.pin_image?"jpibfi-icon-"+n.pin_image_icon:"";this.$element.html('<span class="'+i+'"></span>'),"default"===n.pin_image&&this.$element.addClass("jpibfi-size-"+n.pin_image_size+" jpibfi-button-"+n.pin_image_button),this.size={height:n.pinImageHeight,width:n.pinImageWidth}}return o(t,[{key:"createButton",value:function(t){var e=this.$element.clone(!1);return e.attr("href",this.linkGenerator.generate(t)).click(function(t){t.preventDefault(),t.stopPropagation(),"#"!==t.currentTarget.href.slice(-1)&&window.open(t.currentTarget.href,"mw"+t.timeStamp,"left=20,top=20,width=500,height=500,toolbar=1,resizable=0")}),{$element:e,size:this.size}}}]),t}();n["default"]=s},{"./link-generator":6}],4:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e){var n=this;i(this,t),this.settings=e,this.disabledClasses=this.createClassList(e.disabled_classes),this.enabledClasses=this.createClassList(e.enabled_classes),this.updateSizeConstraints(),window.addEventListener("resize",function(){return n.updateSizeConstraints()},!1)}return r(t,[{key:"createClassList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.split(";").filter(function(t){return!!t})}},{key:"imageEligible",value:function(t){return this.enabledClasses.every(function(e){return t.hasClass(e)})&&!this.disabledClasses.some(function(e){return t.hasClass(e)})&&this.imageSizeIsOk(t)}},{key:"imageSizeIsOk",value:function(t){var e=t[0].clientWidth,n=t[0].clientHeight;return e>=this.minWidth&&n>=this.minHeight}},{key:"updateSizeConstraints",value:function(){this.minWidth=window.outerWidth<768?this.settings.min_image_width_small:this.settings.min_image_width,this.minHeight=window.outerWidth<768?this.settings.min_image_height_small:this.settings.min_image_height}}]),t}();n["default"]=o},{}],5:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=t("./show-on-hover-strategy"),u=i(a),s=function(){function t(e,n,i){r(this,t),this.settings=n,this.$=e,this.logger=i}return o(t,[{key:"init",value:function(){this.showStrategy=this.getStrategy(),this.showStrategy.start()}},{key:"getStrategy",value:function(){var t=null;return new(t=u["default"])(this.$,this.settings,this.logger)}}]),t}();n["default"]=s},{"./show-on-hover-strategy":8}],6:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=t("./../common/description-helper"),u=i(a),s=function(){function t(e){r(this,t),this.descriptionHelper=new u["default"]({siteTitle:e.siteTitle}),this.pinLinkedImages=e.pinLinkedImages,this.description_option=e.description_option,this.desc_funcs={img_title:function(t){return t.attr("title")},img_alt:function(t){return t.attr("alt")},post_title:function(t){return t.attr("data-jpibfi-post-title")},img_description:function(t){return t.attr("data-jpibfi-description")},img_caption:function(t){return t.attr("data-jpibfi-caption")},site_title:function(){return e.siteTitle}}}return o(t,[{key:"getDescription",value:function(t){return this.descriptionHelper.getDescription(t,this.description_option)}},{key:"getImage",value:function(t){var e=t.prop?t.prop("src"):t.attr("src");if(!this.pinLinkedImages)return e;var n=t.closest("a");if(0===n.length)return e;var i=e.split(".").pop(),r=n.attr("href"),o=r.split(".").pop();return o.toLowerCase()===i.toLowerCase()?r:e}},{key:"getUrl",value:function(t){return t.attr("data-jpibfi-post-url")||window.location.href}},{key:"generate",value:function(t){var e=encodeURIComponent(this.getDescription(t)),n=encodeURIComponent(this.getUrl(t)),i=encodeURIComponent(this.getImage(t));return"http://pinterest.com/pin/create/bookmarklet/?is_video=false&url="+n+"&media="+i+"&description="+e}}]),t}();n["default"]=s},{"./../common/description-helper":1}],7:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(t,e,n,i){return t.top+i.top},a=function(t,e,n,i){return t.left+i.left},u=function(t,e,n,i){return e.top-n.height-i.bottom},s=function(t,e,n,i){return e.left-i.right-n.width},l=function(t,e,n){return t.top+((e.top-t.top)/2-n.height/2)},c=function(t,e,n){return t.left+((e.left-t.left)/2-n.width/2)},f=function(){function t(e,n){i(this,t),this.topF=e,this.leftF=n}return r(t,[{key:"calculate",value:function(t,e,n,i){return{top:this.topF(t,e,n,i),left:this.leftF(t,e,n,i)}}}]),t}(),p=function(){function t(e,n){i(this,t),this.margins=n,this.positionCalculator=this.getPositionCalculator(e)}return r(t,[{key:"getPositionCalculator",value:function(t){switch(t){case"top-left":return new f(o,a);case"top-right":return new f(o,s);case"bottom-left":return new f(u,a);case"bottom-right":return new f(u,s);case"center":default:return new f(l,c)}}},{key:"calculatePosition",value:function(t,e,n){return this.positionCalculator.calculate(t,e,n,this.margins)}}]),t}();n["default"]=p},{}],8:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=t("./show-strategy"),l=i(s),c=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"init",value:function(){var t=this,e=function(){return t.$(".jpibfi").closest("div").addClass("jpibfi_container")};e()}},{key:"start",value:function(){var t=this;this.init();var e="data-jpibfi-timeout",n=0,i=function(e){return t.$("a.pinit-button["+t.indexerAttr+'="'+e+'"]')},r=this;r.$(document).delegate(this.settings.image_selector,"mouseenter",function(){var t=r.$(this);if(r.imageFilter.imageEligible(t)){t.addClass("pinit-hover");var o=t.attr(r.indexerAttr);o||(o=n++,t.attr(r.indexerAttr,o));var a=i(o);0===a.length?!function(){var n=r.buttonGenerator.createButton(t),i=n.$element,a=n.size,u=t.offset(),s={top:u.top+t[0].clientHeight,left:u.left+t[0].clientWidth},l=r.positioner.calculatePosition(u,s,a);t.after(i),i.attr(r.indexerAttr,o).css("visibility","hidden").show().offset(l).css("visibility","visible").hover(function(){return clearTimeout(i.attr(e))},function(){return i.attr(e,setTimeout(function(){t.removeClass("pinit-hover"),i.remove()},100))})}():clearTimeout(a.attr(e))}}),r.$(document).delegate(this.settings.image_selector,"mouseleave",function(){if(!r.logger.getFlag("prevent_hide")){var t=r.$(this),n=t.attr(r.indexerAttr);if(n){var o=i(n);o.attr(e,setTimeout(function(){t.removeClass("pinit-hover"),o.remove()},100))}}})}}]),e}(l["default"]);n["default"]=c},{"./show-strategy":9}],9:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=t("./image-filter"),a=i(o),u=t("./button-generator"),s=i(u),l=t("./positioner"),c=i(l),f=function p(t,e,n){r(this,p),this.$=t,this.settings=e,this.logger=n,this.imageFilter=new a["default"](e),this.buttonGenerator=new s["default"](t,e);var i={left:e.button_margin_left,top:e.button_margin_top,right:e.button_margin_right,bottom:e.button_margin_bottom};this.positioner=new c["default"](e.button_position,i),this.indexerAttr="data-jpibfi-indexer"};n["default"]=f},{"./button-generator":3,"./image-filter":4,"./positioner":7}],10:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=t("./settings"),o=i(r),a=t("./debugger"),u=i(a),s=t("./hover"),l=i(s);!function(t){var e=window.jpibfi_options,n=new o["default"](t.extend({pageUrl:document.URL,pageTitle:document.title,pageDescription:t('meta[name="description"]').attr("content")||""},e.hover)),i=new u["default"]("jpibfi");window.jpibfi_debugger=i;var r=function(){var e=new l["default"](t,n,i);e.init()};t(document).ready(r)}(jQuery)},{"./debugger":2,"./hover":5,"./settings":11}],11:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function o(t){var e=this;i(this,o),Object.keys(t).forEach(function(n){e[n]=t[n]}),this.isTouchDevice="ontouchstart"in window||{}.hasOwnProperty.call(navigator,"maxTouchPoints")};n["default"]=r},{}]},{},[10]);
1
+ !function(){var t=window.angular,e=window.angular={};!function n(t,e,i){function r(a,u){if(!e[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=e[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return r(n?n:e)},c,c.exports,n,t,e,i)}return e[a].exports}for(var o="function"==typeof require&&require,a=0;a<i.length;a++)r(i[a]);return r}({1:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.siteTitle,r=void 0===n?"":n;i(this,t),this.desc_funcs={img_title:function(t){return t.attr("title")},img_alt:function(t){return t.attr("alt")},post_title:function(t){return t.attr("data-jpibfi-post-title")},post_excerpt:function(t){return t.attr("data-jpibfi-post-excerpt")},img_description:function(t){return t.attr("data-jpibfi-description")},img_caption:function(t){return t.attr("data-jpibfi-caption")},site_title:function(){return r}}}return r(t,[{key:"getDescription",value:function(t,e){for(var n="",i=0;i<e.length&&!n;i++)n=this.desc_funcs[e[i]](t);return n||""}}]),t}();n["default"]=o},{}],2:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e){var n=this;i(this,t),this.flags={},this.pluginName=e;var r="undefined"!=typeof console&&"undefined"!=typeof console.log,o="undefined"!=typeof JSON&&"function"==typeof JSON.stringify;r?(this.logString=function(t){n.log(t)},this.logObject=o?function(t){n.log(JSON.stringify(t,null,4))}:function(t){return n.simplelogObject(t)}):(this.logString=function(){},this.logObject=function(){});var a=this.getQueryParams(document.location.search);Object.keys(a).forEach(function(t){var i=t.replace(e+"_","");n.setFlag(i,a[t])})}return r(t,[{key:"getFlag",value:function(t){return void 0!=this.flags[t]&&this.flags[t]}},{key:"getQueryParams",value:function(t){t=t.split("+").join(" ");for(var e={},n=void 0,i=/[?&]?([^=]+)=([^&]*)/g;n=i.exec(t);)e[decodeURIComponent(n[1])]=decodeURIComponent(n[2]);return e}},{key:"log",value:function(t){this.getFlag("print")&&console.log(this.pluginName+" debug: "+t)}},{key:"setFlag",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.flags[t]=e}},{key:"simplelogObject",value:function(t){if(this.getFlag("print")){var e=Object.keys(t).filter(function(e){return t.hasOwnPrototype(e)}).map(function(e){return e+": "+t[e]+"\n"}).join();this.log(e)}}}]),t}();n["default"]=o},{}],3:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=t("./link-generator"),u=i(a),s=function(){function t(e,n){r(this,t),this.$=e,this.settings=n,this.linkGenerator=new u["default"](n),this.$element=this.$("<a />",{target:"_blank","class":"pinit-button "+n.pin_image});var i="default"===n.pin_image?"jpibfi-icon-"+n.pin_image_icon:"";this.$element.html('<span class="'+i+'"></span>'),"default"===n.pin_image&&this.$element.addClass("jpibfi-size-"+n.pin_image_size+" jpibfi-button-"+n.pin_image_button),this.size={height:n.pinImageHeight,width:n.pinImageWidth}}return o(t,[{key:"createButton",value:function(t){var e=this.$element.clone(!1);return e.attr("href",this.linkGenerator.generate(t)).click(function(t){t.preventDefault(),t.stopPropagation(),"#"!==t.currentTarget.href.slice(-1)&&window.open(t.currentTarget.href,"mw"+t.timeStamp,"left=20,top=20,width=500,height=500,toolbar=1,resizable=0")}),{$element:e,size:this.size}}}]),t}();n["default"]=s},{"./link-generator":6}],4:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e){var n=this;i(this,t),this.settings=e,this.disabledClasses=this.createClassList(e.disabled_classes),this.enabledClasses=this.createClassList(e.enabled_classes),this.updateSizeConstraints(),window.addEventListener("resize",function(){return n.updateSizeConstraints()},!1)}return r(t,[{key:"createClassList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.split(";").filter(function(t){return!!t})}},{key:"imageEligible",value:function(t){return this.enabledClasses.every(function(e){return t.hasClass(e)})&&!this.disabledClasses.some(function(e){return t.hasClass(e)})&&this.imageSizeIsOk(t)}},{key:"imageSizeIsOk",value:function(t){var e=t[0].clientWidth,n=t[0].clientHeight;return e>=this.minWidth&&n>=this.minHeight}},{key:"updateSizeConstraints",value:function(){this.minWidth=window.outerWidth<768?this.settings.min_image_width_small:this.settings.min_image_width,this.minHeight=window.outerWidth<768?this.settings.min_image_height_small:this.settings.min_image_height}}]),t}();n["default"]=o},{}],5:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=t("./show-on-hover-strategy"),u=i(a),s=function(){function t(e,n,i){r(this,t),this.settings=n,this.$=e,this.logger=i}return o(t,[{key:"init",value:function(){this.showStrategy=this.getStrategy(),this.showStrategy.start()}},{key:"getStrategy",value:function(){var t=null;return new(t=u["default"])(this.$,this.settings,this.logger)}}]),t}();n["default"]=s},{"./show-on-hover-strategy":8}],6:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=t("./../common/description-helper"),u=i(a),s=function(){function t(e){r(this,t),this.descriptionHelper=new u["default"]({siteTitle:e.siteTitle}),this.pinLinkedImages=e.pinLinkedImages,this.description_option=e.description_option,this.desc_funcs={img_title:function(t){return t.attr("title")},img_alt:function(t){return t.attr("alt")},post_title:function(t){return t.attr("data-jpibfi-post-title")},img_description:function(t){return t.attr("data-jpibfi-description")},img_caption:function(t){return t.attr("data-jpibfi-caption")},site_title:function(){return e.siteTitle}}}return o(t,[{key:"getDescription",value:function(t){return this.descriptionHelper.getDescription(t,this.description_option)}},{key:"getImage",value:function(t){var e=t.prop?t.prop("src"):t.attr("src");if(!this.pinLinkedImages)return e;var n=t.closest("a");if(0===n.length)return e;var i=e.split(".").pop(),r=n.attr("href"),o=r.split(".").pop();return o.toLowerCase()===i.toLowerCase()?r:e}},{key:"getUrl",value:function(t){return t.attr("data-jpibfi-post-url")||window.location.href}},{key:"generate",value:function(t){var e=encodeURIComponent(this.getDescription(t)),n=encodeURIComponent(this.getUrl(t)),i=encodeURIComponent(this.getImage(t));return"http://pinterest.com/pin/create/bookmarklet/?is_video=false&url="+n+"&media="+i+"&description="+e}}]),t}();n["default"]=s},{"./../common/description-helper":1}],7:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(t,e,n,i){return t.top+i.top},a=function(t,e,n,i){return t.left+i.left},u=function(t,e,n,i){return e.top-n.height-i.bottom},s=function(t,e,n,i){return e.left-i.right-n.width},l=function(t,e,n){return t.top+((e.top-t.top)/2-n.height/2)},c=function(t,e,n){return t.left+((e.left-t.left)/2-n.width/2)},f=function(){function t(e,n){i(this,t),this.topF=e,this.leftF=n}return r(t,[{key:"calculate",value:function(t,e,n,i){return{top:this.topF(t,e,n,i),left:this.leftF(t,e,n,i)}}}]),t}(),p=function(){function t(e,n){i(this,t),this.margins=n,this.positionCalculator=this.getPositionCalculator(e)}return r(t,[{key:"getPositionCalculator",value:function(t){switch(t){case"top-left":return new f(o,a);case"top-right":return new f(o,s);case"bottom-left":return new f(u,a);case"bottom-right":return new f(u,s);case"center":default:return new f(l,c)}}},{key:"calculatePosition",value:function(t,e,n){return this.positionCalculator.calculate(t,e,n,this.margins)}}]),t}();n["default"]=p},{}],8:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=t("./show-strategy"),l=i(s),c=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"init",value:function(){var t=this,e=function(){return t.$(".jpibfi").closest("div").addClass("jpibfi_container")};e()}},{key:"start",value:function(){var t=this;this.init();var e="data-jpibfi-timeout",n=0,i=function(e){return t.$("a.pinit-button["+t.indexerAttr+'="'+e+'"]')},r=this;r.$(document).delegate(this.settings.image_selector,"mouseenter",function(){var t=r.$(this);if(r.imageFilter.imageEligible(t)){t.addClass("pinit-hover");var o=t.attr(r.indexerAttr);o||(o=n++,t.attr(r.indexerAttr,o));var a=i(o);0===a.length?!function(){var n=r.buttonGenerator.createButton(t),i=n.$element,a=n.size,u=t.offset(),s={top:u.top+t[0].clientHeight,left:u.left+t[0].clientWidth},l=r.positioner.calculatePosition(u,s,a);t.after(i),i.attr(r.indexerAttr,o).css("visibility","hidden").show().offset(l).css("visibility","visible").hover(function(){return clearTimeout(i.attr(e))},function(){return i.attr(e,setTimeout(function(){t.removeClass("pinit-hover"),i.remove()},100))})}():clearTimeout(a.attr(e))}}),r.$(document).delegate(this.settings.image_selector,"mouseleave",function(){if(!r.logger.getFlag("prevent_hide")){var t=r.$(this),n=t.attr(r.indexerAttr);if(n){var o=i(n);o.attr(e,setTimeout(function(){t.removeClass("pinit-hover"),o.remove()},100))}}})}}]),e}(l["default"]);n["default"]=c},{"./show-strategy":9}],9:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=t("./image-filter"),a=i(o),u=t("./button-generator"),s=i(u),l=t("./positioner"),c=i(l),f=function p(t,e,n){r(this,p),this.$=t,this.settings=e,this.logger=n,this.imageFilter=new a["default"](e),this.buttonGenerator=new s["default"](t,e);var i={left:e.button_margin_left,top:e.button_margin_top,right:e.button_margin_right,bottom:e.button_margin_bottom};this.positioner=new c["default"](e.button_position,i),this.indexerAttr="data-jpibfi-indexer"};n["default"]=f},{"./button-generator":3,"./image-filter":4,"./positioner":7}],10:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=t("./settings"),o=i(r),a=t("./debugger"),u=i(a),s=t("./hover"),l=i(s);!function(t){var e=window.jpibfi_options,n=new o["default"](t.extend({pageUrl:document.URL,pageTitle:document.title,pageDescription:t('meta[name="description"]').attr("content")||""},e.hover)),i=new u["default"]("jpibfi");window.jpibfi_debugger=i;var r=function(){var e=new l["default"](t,n,i);e.init()};t(document).ready(r)}(jQuery)},{"./debugger":2,"./hover":5,"./settings":11}],11:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function o(t){var e=this;i(this,o),Object.keys(t).forEach(function(n){e[n]=t[n]}),this.isTouchDevice="ontouchstart"in window||{}.hasOwnProperty.call(navigator,"maxTouchPoints")};n["default"]=r},{}]},{},[10]),e.element(document).ready(function(){e.bootstrap(document.getElementById("jpibfi-container"),["jpibfi"]),window.angular=t})}();
readme.txt CHANGED
@@ -68,6 +68,10 @@ Please report them in the plugin's support forum on Wordpress.org.
68
 
69
  == Changelog ==
70
 
 
 
 
 
71
  = 2.2.5 =
72
  * Released 2017-01-31
73
  * Fixed issue with updating the settings
@@ -304,6 +308,9 @@ Please report them in the plugin's support forum on Wordpress.org.
304
 
305
  == Upgrade Notice ==
306
 
 
 
 
307
  = 2.2.5 =
308
  * Fixed issue with updating the settings
309
 
68
 
69
  == Changelog ==
70
 
71
+ = 2.2.6 =
72
+ * Released 2017-02-16
73
+ * Fixed conflict with other plugins that use angular
74
+
75
  = 2.2.5 =
76
  * Released 2017-01-31
77
  * Fixed issue with updating the settings
308
 
309
  == Upgrade Notice ==
310
 
311
+ = 2.2.6 =
312
+ * Fixed conflict with other plugins that use angular
313
+
314
  = 2.2.5 =
315
  * Fixed issue with updating the settings
316