[
  {
    "path": ".bowerrc",
    "content": "{\n  \"directory\": \"www/lib\"\n}\n"
  },
  {
    "path": ".gitignore",
    "content": "# Specifies intentionally untracked files to ignore when using Git\n# http://git-scm.com/docs/gitignore\n\nnode_modules/\nplatforms/\nplugins/\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2014\nJeremy Wilken (Gnome on the run)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Ionic Framework Demo App\n\nThis is a demo app built with the Ionic Framework that you can preview in the browser or clone and run locally on an emulator or device.\n\n# View it now\n\nhttps://ionic-in-action.github.io/ionic-demo-resort-app/www/\n\n# Run locally\n\nThis assumes you already have an emulator setup for iOS or Android. Substitute `ios` for `android` below to use Android.\n\n    npm install -g ionic cordova\n    git clone https://github.com/ionic-in-action/ionic-demo-resort-app.git\n    cd ionic-demo-resort-app\n    ionic platform add ios\n    ionic emulate ios\n\n# LICENSE\n\nIonic is licensed under the MIT Open Source license. For more information, see the LICENSE file in this repository.\n"
  },
  {
    "path": "bower.json",
    "content": "{\n  \"name\": \"ionic-in-action-demo\",\n  \"private\": \"true\",\n  \"dependencies\": {\n    \"ionic\": \"driftyco/ionic-bower#1.0.0-beta.12\",\n    \"firebase\": \"~1.0.21\",\n    \"angularfire\": \"~0.8.2\"\n  }\n}\n"
  },
  {
    "path": "config.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<widget id=\"com.ionicinaction.demo\" version=\"0.0.1\" xmlns=\"http://www.w3.org/ns/widgets\" xmlns:cdv=\"http://cordova.apache.org/ns/1.0\">\n  <name>Ionic In Action</name>\n  <description>\n    Demo of Ionic.\n    </description>\n  <author email=\"author@ionicinaction.com\" href=\"http://ionicinaction.com/\">\n      Ionic in Action\n    </author>\n  <content src=\"index.html\"/>\n  <access origin=\"*\"/>\n  <preference name=\"webviewbounce\" value=\"false\"/>\n  <preference name=\"UIWebViewBounce\" value=\"false\"/>\n  <preference name=\"DisallowOverscroll\" value=\"true\"/>\n  <preference name=\"BackupWebStorage\" value=\"none\"/>\n  <preference name=\"SplashScreen\" value=\"screen\" />\n  <preference name=\"SplashScreenDelay\" value=\"10000\" />\n  <feature name=\"StatusBar\">\n    <param name=\"ios-package\" value=\"CDVStatusBar\" onload=\"true\"/>\n  </feature>\n  <icon src=\"media/icons/icon.png\" />\n</widget>\n"
  },
  {
    "path": "gulpfile.js",
    "content": "var gulp = require('gulp');\nvar gutil = require('gulp-util');\nvar bower = require('bower');\nvar concat = require('gulp-concat');\nvar sass = require('gulp-sass');\nvar minifyCss = require('gulp-minify-css');\nvar rename = require('gulp-rename');\nvar sh = require('shelljs');\n\nvar paths = {\n  sass: ['./scss/**/*.scss']\n};\n\ngulp.task('default', ['sass']);\n\ngulp.task('sass', function(done) {\n  gulp.src('./scss/ionic.app.scss')\n    .pipe(sass())\n    .pipe(gulp.dest('./www/css/'))\n    .pipe(minifyCss({\n      keepSpecialComments: 0\n    }))\n    .pipe(rename({ extname: '.min.css' }))\n    .pipe(gulp.dest('./www/css/'))\n    .on('end', done);\n});\n\ngulp.task('watch', function() {\n  gulp.watch(paths.sass, ['sass']);\n});\n\ngulp.task('install', ['git-check'], function() {\n  return bower.commands.install()\n    .on('log', function(data) {\n      gutil.log('bower', gutil.colors.cyan(data.id), data.message);\n    });\n});\n\ngulp.task('git-check', function(done) {\n  if (!sh.which('git')) {\n    console.log(\n      '  ' + gutil.colors.red('Git is not installed.'),\n      '\\n  Git, the version control system, is required to download Ionic.',\n      '\\n  Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',\n      '\\n  Once git is installed, run \\'' + gutil.colors.cyan('gulp install') + '\\' again.'\n    );\n    process.exit(1);\n  }\n  done();\n});\n"
  },
  {
    "path": "hooks/README.md",
    "content": "<!--\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#  KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n-->\n# Cordova Hooks\n\nThis directory may contain scripts used to customize cordova commands. This\ndirectory used to exist at `.cordova/hooks`, but has now been moved to the\nproject root. Any scripts you add to these directories will be executed before\nand after the commands corresponding to the directory name. Useful for\nintegrating your own build systems or integrating with version control systems.\n\n__Remember__: Make your scripts executable.\n\n## Hook Directories\nThe following subdirectories will be used for hooks:\n\n    after_build/\n    after_compile/\n    after_docs/\n    after_emulate/\n    after_platform_add/\n    after_platform_rm/\n    after_platform_ls/\n    after_plugin_add/\n    after_plugin_ls/\n    after_plugin_rm/\n    after_plugin_search/\n    after_prepare/\n    after_run/\n    after_serve/\n    before_build/\n    before_compile/\n    before_docs/\n    before_emulate/\n    before_platform_add/\n    before_platform_rm/\n    before_platform_ls/\n    before_plugin_add/\n    before_plugin_ls/\n    before_plugin_rm/\n    before_plugin_search/\n    before_prepare/\n    before_run/\n    before_serve/\n    pre_package/ <-- Windows 8 and Windows Phone only.\n\n## Script Interface\n\nAll scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:\n\n* CORDOVA_VERSION - The version of the Cordova-CLI.\n* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).\n* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)\n* CORDOVA_HOOK - Path to the hook that is being executed.\n* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)\n\nIf a script returns a non-zero exit code, then the parent cordova command will be aborted.\n\n\n## Writing hooks\n\nWe highly recommend writting your hooks using Node.js so that they are\ncross-platform. Some good examples are shown here:\n\n[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)\n\n"
  },
  {
    "path": "hooks/after_prepare/010_add_platform_class.js",
    "content": "#!/usr/bin/env node\n\n// Add Platform Class\n// v1.0\n// Automatically adds the platform class to the body tag\n// after the `prepare` command. By placing the platform CSS classes\n// directly in the HTML built for the platform, it speeds up\n// rendering the correct layout/style for the specific platform\n// instead of waiting for the JS to figure out the correct classes.\n\nvar fs = require('fs');\nvar path = require('path');\n\nvar rootdir = process.argv[2];\n\nfunction addPlatformBodyTag(indexPath, platform) {\n  // add the platform class to the body tag\n  try {\n    var platformClass = 'platform-' + platform;\n    var cordovaClass = 'platform-cordova platform-webview';\n\n    var html = fs.readFileSync(indexPath, 'utf8');\n\n    var bodyTag = findBodyTag(html);\n    if(!bodyTag) return; // no opening body tag, something's wrong\n\n    if(bodyTag.indexOf(platformClass) > -1) return; // already added\n\n    var newBodyTag = bodyTag;\n\n    var classAttr = findClassAttr(bodyTag);\n    if(classAttr) {\n      // body tag has existing class attribute, add the classname\n      var endingQuote = classAttr.substring(classAttr.length-1);\n      var newClassAttr = classAttr.substring(0, classAttr.length-1);\n      newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote;\n      newBodyTag = bodyTag.replace(classAttr, newClassAttr);\n\n    } else {\n      // add class attribute to the body tag\n      newBodyTag = bodyTag.replace('>', ' class=\"' + platformClass + ' ' + cordovaClass + '\">');\n    }\n\n    html = html.replace(bodyTag, newBodyTag);\n\n    fs.writeFileSync(indexPath, html, 'utf8');\n\n    process.stdout.write('add to body class: ' + platformClass + '\\n');\n  } catch(e) {\n    process.stdout.write(e);\n  }\n}\n\nfunction findBodyTag(html) {\n  // get the body tag\n  try{\n    return html.match(/<body(?=[\\s>])(.*?)>/gi)[0];\n  }catch(e){}\n}\n\nfunction findClassAttr(bodyTag) {\n  // get the body tag's class attribute\n  try{\n    return bodyTag.match(/ class=[\"|'](.*?)[\"|']/gi)[0];\n  }catch(e){}\n}\n\nif (rootdir) {\n\n  // go through each of the platform directories that have been prepared\n  var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);\n\n  for(var x=0; x<platforms.length; x++) {\n    // open up the index.html file at the www root\n    try {\n      var platform = platforms[x].trim().toLowerCase();\n      var indexPath;\n\n      if(platform == 'android') {\n        indexPath = path.join('platforms', platform, 'assets', 'www', 'index.html');\n      } else {\n        indexPath = path.join('platforms', platform, 'www', 'index.html');\n      }\n\n      if(fs.existsSync(indexPath)) {\n        addPlatformBodyTag(indexPath, platform);\n      }\n\n    } catch(e) {\n      process.stdout.write(e);\n    }\n  }\n\n}\n"
  },
  {
    "path": "ionic.project",
    "content": "{\n  \"name\": \"ionic-in-action-demo\",\n  \"app_id\": \"\"\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"ionic-in-action-demo\",\n  \"version\": \"1.0.0\",\n  \"description\": \"Ionic in Action Demo\",\n  \"dependencies\": {\n    \"gulp\": \"^3.5.6\",\n    \"gulp-sass\": \"^0.7.1\",\n    \"gulp-concat\": \"^2.2.0\",\n    \"gulp-minify-css\": \"^0.3.0\",\n    \"gulp-rename\": \"^1.2.0\"\n  },\n  \"devDependencies\": {\n    \"bower\": \"^1.3.3\",\n    \"gulp-util\": \"^2.2.14\",\n    \"shelljs\": \"^0.3.0\"\n  }\n}\n"
  },
  {
    "path": "scss/ionic.app.scss",
    "content": "/*\nTo customize the look and feel of Ionic, you can override the variables\nin ionic's _variables.scss file.\n\nFor example, you might change some of the default colors:\n\n$light:                           #fff !default;\n$stable:                          #f8f8f8 !default;\n$positive:                        #4a87ee !default;\n$calm:                            #43cee6 !default;\n$balanced:                        #66cc33 !default;\n$energized:                       #f0b840 !default;\n$assertive:                       #ef4e3a !default;\n$royal:                           #8a6de9 !default;\n$dark:                            #444 !default;\n*/\n\n// The path for our ionicons font files, relative to the built CSS in www/css\n$ionicons-font-path: \"../lib/ionic/fonts\" !default;\n\n// Include all of Ionic\n@import \"www/lib/ionic/scss/ionic\";\n\n"
  },
  {
    "path": "www/api/data.json",
    "content": "{\n  \"menu\": [\n    {\n      \"meal\": \"Breakfast\",\n      \"items\": [\n        { \"item\": \"Eggs\", \"price\": 2.50 },\n        { \"item\": \"Cereal\", \"price\": 3.00 },\n        { \"item\": \"Fruit\", \"price\": 4.00 },\n        { \"item\": \"Pancakes\", \"price\": 5.50 },\n        { \"item\": \"Bacon\", \"price\": 4.50 }\n      ]\n    },\n    {\n      \"meal\": \"Lunch\",\n      \"items\": [\n        { \"item\": \"Grilled Cheese\", \"price\": 3.50 },\n        { \"item\": \"Salad\", \"price\": 4.50 },\n        { \"item\": \"Hamburger & Fries\", \"price\": 6.50 },\n        { \"item\": \"Pork Sandwich & Fries\", \"price\": 6.50 },\n        { \"item\": \"Fish Sandwich & Fries\", \"price\": 5.50 },\n        { \"item\": \"Tofu Sandwish & Vegitables\", \"price\": 5.50 },\n        { \"item\": \"Chicken Fingers\", \"price\": 4.50 }\n      ]\n    },\n    {\n      \"meal\": \"Dinner\",\n      \"items\": [\n        { \"item\": \"Chicken Fried Chicken\", \"price\": 8.50 },\n        { \"item\": \"Chicken Parmesean\", \"price\": 7.50 },\n        { \"item\": \"Steak & Vegitables\", \"price\": 11.50 },\n        { \"item\": \"Lobster & Rice\", \"price\": 14.50 },\n        { \"item\": \"Shrimp Scampi & Pasta\", \"price\": 12.50 },\n        { \"item\": \"Tofu Pasta Primavera\", \"price\": 10.50 },\n        { \"item\": \"10\\\" Pizza\", \"price\": 7.50 }\n      ]\n    },\n    {\n      \"meal\": \"Dessert\",\n      \"items\": [\n        { \"item\": \"Ice Cream\", \"price\": 3.50 },\n        { \"item\": \"Cake\", \"price\": 4.50 },\n        { \"item\": \"Strawberry Sundae\", \"price\": 4.50 }\n      ]\n    }\n  ],\n  \"events\": [\n    {\n      \"day\": \"Sunday\",\n      \"events\": [\n        { \"day\": \"Sunday\", \"time\": \"8:00am\",  \"location\": \"Fitness Center\", \"event\": \"Morning Yoga\" },\n        { \"day\": \"Sunday\", \"time\": \"10:00am\", \"location\": \"Beach\", \"event\": \"Surfing Lessons\" },\n        { \"day\": \"Sunday\", \"time\": \"11:00am\", \"location\": \"Community Center\", \"event\": \"Bingo\" },\n        { \"day\": \"Sunday\", \"time\": \"1:00pm\",  \"location\": \"Community Center\", \"event\": \"Ice Cream Social\" },\n        { \"day\": \"Sunday\", \"time\": \"2:00pm\",  \"location\": \"Community Center\", \"event\": \"Wine Tasting\" },\n        { \"day\": \"Sunday\", \"time\": \"4:00pm\",  \"location\": \"Front Desk\", \"event\": \"Resort Tour\" },\n        { \"day\": \"Sunday\", \"time\": \"6:00pm\",  \"location\": \"Pool 2\", \"event\": \"Sing and Swim\" },\n        { \"day\": \"Sunday\", \"time\": \"8:00pm\",  \"location\": \"Dock\", \"event\": \"Sunset Cruise\" }\n      ]\n    },\n    {\n      \"day\": \"Monday\",\n      \"events\": [\n        { \"day\": \"Monday\", \"time\": \"8:00am\",  \"location\": \"Fitness Center\", \"event\": \"Morning Training\" },\n        { \"day\": \"Monday\", \"time\": \"10:00am\", \"location\": \"Beach\", \"event\": \"Snorkeling Lessons\" },\n        { \"day\": \"Monday\", \"time\": \"11:00am\", \"location\": \"Community Center\", \"event\": \"Bingo\" },\n        { \"day\": \"Monday\", \"time\": \"1:00pm\",  \"location\": \"Community Center\", \"event\": \"Lawn Darts\" },\n        { \"day\": \"Monday\", \"time\": \"2:00pm\",  \"location\": \"Community Center\", \"event\": \"Beer Tasting\" },\n        { \"day\": \"Monday\", \"time\": \"4:00pm\",  \"location\": \"Front Desk\", \"event\": \"Resort Tour\" },\n        { \"day\": \"Monday\", \"time\": \"6:00pm\",  \"location\": \"Community Center\", \"event\": \"Poker Tournament\" },\n        { \"day\": \"Monday\", \"time\": \"8:00pm\",  \"location\": \"Pool 3\", \"event\": \"Swim in Kids Movie\" }\n      ]\n    },\n    {\n      \"day\": \"Tuesday\",\n      \"events\": [\n        { \"day\": \"Tuesday\", \"time\": \"8:00am\",  \"location\": \"Fitness Center\", \"event\": \"Morning Yoga\" },\n        { \"day\": \"Tuesday\", \"time\": \"10:00am\", \"location\": \"Beach\", \"event\": \"Scuba Lessons\" },\n        { \"day\": \"Tuesday\", \"time\": \"11:00am\", \"location\": \"Community Center\", \"event\": \"Build Your Own Pizza\" },\n        { \"day\": \"Tuesday\", \"time\": \"1:00pm\",  \"location\": \"Community Center\", \"event\": \"Ice Cream Social\" },\n        { \"day\": \"Tuesday\", \"time\": \"2:00pm\",  \"location\": \"Pool 1\", \"event\": \"Adults Only Swim\" },\n        { \"day\": \"Tuesday\", \"time\": \"4:00pm\",  \"location\": \"Front Desk\", \"event\": \"Resort Tour\" },\n        { \"day\": \"Tuesday\", \"time\": \"6:00pm\",  \"location\": \"Pool 3\", \"event\": \"Cannonball Competition\" },\n        { \"day\": \"Tuesday\", \"time\": \"8:00pm\",  \"location\": \"Dock\", \"event\": \"Sunset Cruise\" }\n      ]\n    },\n    {\n      \"day\": \"Wednesday\",\n      \"events\": [\n        { \"day\": \"Tuesday\", \"time\": \"8:00am\",  \"location\": \"Fitness Center\", \"event\": \"Morning Resort Run\" },\n        { \"day\": \"Tuesday\", \"time\": \"10:00am\", \"location\": \"Beach\", \"event\": \"Wildlife Tour\" },\n        { \"day\": \"Tuesday\", \"time\": \"11:00am\", \"location\": \"Community Center\", \"event\": \"Tennis Challenge\" },\n        { \"day\": \"Tuesday\", \"time\": \"1:00pm\",  \"location\": \"Pool 2\", \"event\": \"Adults Only Swim\" },\n        { \"day\": \"Tuesday\", \"time\": \"2:00pm\",  \"location\": \"Community Center\", \"event\": \"Cheese Tasting\" },\n        { \"day\": \"Tuesday\", \"time\": \"4:00pm\",  \"location\": \"Front Desk\", \"event\": \"Resort Tour\" },\n        { \"day\": \"Tuesday\", \"time\": \"6:00pm\",  \"location\": \"Pool 3\", \"event\": \"Happy Hour\" },\n        { \"day\": \"Tuesday\", \"time\": \"8:00pm\",  \"location\": \"Beach\", \"event\": \"Crab Search\" }\n      ]\n    },\n    {\n      \"day\": \"Thursday\",\n      \"events\": [\n        { \"day\": \"Monday\", \"time\": \"8:00am\",  \"location\": \"Fitness Center\", \"event\": \"Morning Yoga\" },\n        { \"day\": \"Monday\", \"time\": \"10:00am\", \"location\": \"Community Center\", \"event\": \"Build and Fly Kites\" },\n        { \"day\": \"Monday\", \"time\": \"11:00am\", \"location\": \"Community Center\", \"event\": \"Hole in One Challenge\" },\n        { \"day\": \"Monday\", \"time\": \"1:00pm\",  \"location\": \"Community Center\", \"event\": \"Cooking Local Cuisine\" },\n        { \"day\": \"Monday\", \"time\": \"2:00pm\",  \"location\": \"Community Center\", \"event\": \"Basketball\" },\n        { \"day\": \"Monday\", \"time\": \"4:00pm\",  \"location\": \"Front Desk\", \"event\": \"Resort Tour\" },\n        { \"day\": \"Monday\", \"time\": \"6:00pm\",  \"location\": \"Community Center\", \"event\": \"Hay Ride\" },\n        { \"day\": \"Monday\", \"time\": \"8:00pm\",  \"location\": \"Pool 3\", \"event\": \"Live Music\" }\n      ]\n    },\n    {\n      \"day\": \"Friday\",\n      \"events\": [\n        { \"day\": \"Monday\", \"time\": \"8:00am\",  \"location\": \"Fitness Center\", \"event\": \"Morning P90X\" },\n        { \"day\": \"Monday\", \"time\": \"10:00am\", \"location\": \"Community Center\", \"event\": \"Kayaking\" },\n        { \"day\": \"Monday\", \"time\": \"11:00am\", \"location\": \"Community Center\", \"event\": \"Kids Crafts\" },\n        { \"day\": \"Monday\", \"time\": \"1:00pm\",  \"location\": \"Community Center\", \"event\": \"Driving Range Contest\" },\n        { \"day\": \"Monday\", \"time\": \"2:00pm\",  \"location\": \"Pool 1\", \"event\": \"Adults Only Swim\" },\n        { \"day\": \"Monday\", \"time\": \"4:00pm\",  \"location\": \"Front Desk\", \"event\": \"Resort Tour\" },\n        { \"day\": \"Monday\", \"time\": \"6:00pm\",  \"location\": \"Community Center\", \"event\": \"Family Style Dinner\" },\n        { \"day\": \"Monday\", \"time\": \"8:00pm\",  \"location\": \"Pool 3\", \"event\": \"Live Music\" }\n      ]\n    },\n    {\n      \"day\": \"Saturday\",\n      \"events\": [\n        { \"day\": \"Sunday\", \"time\": \"8:00am\",  \"location\": \"Fitness Center\", \"event\": \"Morning Fitness\" },\n        { \"day\": \"Sunday\", \"time\": \"10:00am\", \"location\": \"Clubhouse\", \"event\": \"Golf Scramble\" },\n        { \"day\": \"Sunday\", \"time\": \"11:00am\", \"location\": \"Community Center\", \"event\": \"Bridge\" },\n        { \"day\": \"Sunday\", \"time\": \"1:00pm\",  \"location\": \"Community Center\", \"event\": \"Sand Castle Competition\" },\n        { \"day\": \"Sunday\", \"time\": \"2:00pm\",  \"location\": \"Community Center\", \"event\": \"Happy Hour\" },\n        { \"day\": \"Sunday\", \"time\": \"4:00pm\",  \"location\": \"Front Desk\", \"event\": \"Resort Tour\" },\n        { \"day\": \"Sunday\", \"time\": \"6:00pm\",  \"location\": \"Beach\", \"event\": \"BBQ\" },\n        { \"day\": \"Sunday\", \"time\": \"8:00pm\",  \"location\": \"Dock\", \"event\": \"Stargazing Cruise\" }\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "www/css/style.css",
    "content": ".tour {\n  background-color: #ffefd6;\n  text-align: center;\n  position: absolute;\n  z-index: 100;\n}\n.tour .slider {\n  height: 100%;\n  padding-top: 80px;\n}\n.tour img {\n  max-height: 70%;\n}\n.comments .button-block {\n  margin: 0;\n}\n.room-service ion-header-bar {\n  margin-top: 44px;\n}\n.room-service ion-content {\n  top: 88px;\n}\n.item.button-block {\n  margin-top: 0;\n  border-radius: 0;\n}\n"
  },
  {
    "path": "www/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width\">\n    <title></title>\n\n    <link href=\"lib/ionic/css/ionic.css\" rel=\"stylesheet\">\n    <link href=\"css/style.css\" rel=\"stylesheet\">\n\n    <!-- ionic/angularjs js -->\n    <script src=\"lib/ionic/js/ionic.bundle.js\"></script>\n\n    <!-- firebase -->\n    <script src=\"lib/firebase/firebase.js\"></script>\n    <script src=\"lib/angularfire/dist/angularfire.js\"></script>\n\n    <!-- cordova script (this will be a 404 during development) -->\n    <script src=\"cordova.js\"></script>\n\n    <!-- your app's js -->\n    <script src=\"js/app.js\"></script>\n    <script src=\"views/events/events.js\"></script>\n    <script src=\"views/food/food.js\"></script>\n    <script src=\"views/home/home.js\"></script>\n    <script src=\"views/reservation/reservation.js\"></script>\n    <script src=\"views/tour/tour.js\"></script>\n    <script src=\"views/weather/weather.js\"></script>\n  </head>\n  <body ng-app=\"App\">\n\n    <ion-side-menus>\n      <ion-side-menu-content>\n        <ion-nav-bar class=\"bar-positive nav-title-slide-ios7\">\n          <button menu-toggle=\"left\" class=\"button button-icon icon ion-navicon\"></button>\n        </ion-nav-bar>\n        <ion-nav-view></ion-nav-view>\n      </ion-side-menu-content>\n\n      <ion-side-menu side=\"left\">\n        <ion-header-bar class=\"bar-dark\">\n          <h1 class=\"title\">Sunshine Resort</h1>\n        </ion-header-bar>\n        <ion-content has-header=\"true\">\n          <ion-list>\n            <ion-item href=\"#/\" class=\"item-icon-left\" menu-close><i class=\"icon ion-home\"></i> Home</ion-item>\n            <ion-item href=\"#/reservation\" class=\"item-icon-left\" menu-close><i class=\"icon ion-folder\"></i> Reservation</ion-item>\n            <ion-item href=\"tel:8005555555\" class=\"item-icon-left\" menu-close><i class=\"icon ion-ios7-telephone\"></i> Call Concierge</ion-item>\n            <ion-item href=\"#/weather\" class=\"item-icon-left\" menu-close><i class=\"icon ion-ios7-partlysunny\"></i> Weather</ion-item>\n            <ion-item href=\"#/events\" class=\"item-icon-left\" menu-close><i class=\"icon ion-calendar\"></i> Events</ion-item>\n            <ion-item href=\"#/local/food\" class=\"item-icon-left\" menu-close> <i class=\"icon ion-location\"></i> Local Places</ion-item>\n            <ion-item href=\"#/food\" class=\"item-icon-left\" menu-close> <i class=\"icon ion-fork\"></i> Order Room Service</ion-item>\n            <ion-item href=\"#/about\" class=\"item-icon-left\" menu-close> <i class=\"icon ion-ios7-information\"></i> About</ion-item>\n          </ion-list>\n        </ion-content>\n      </ion-side-menu>\n\n    </ion-side-menus>\n  </body>\n</html>\n"
  },
  {
    "path": "www/js/app.js",
    "content": "angular.module('App', ['ionic', 'firebase'])\n\n.config(function ($stateProvider, $urlRouterProvider) {\n  $stateProvider\n    .state('tour', {\n      url: '/tour',\n      templateUrl: 'views/tour/tour.html',\n      controller: 'TourCtrl'\n    })\n    .state('home', {\n      url: '/',\n      templateUrl: 'views/home/home.html',\n      controller: 'HomeCtrl'\n    })\n    .state('about', {\n      url: '/about',\n      templateUrl: 'views/about/about.html'\n    })\n    .state('reservation', {\n      url: '/reservation',\n      templateUrl: 'views/reservation/reservation.html',\n      controller: 'ReservationCtrl'\n    })\n    .state('events', {\n      url: '/events',\n      templateUrl: 'views/events/events.html',\n      controller: 'EventsCtrl'\n    })\n    .state('food', {\n      url: '/food',\n      templateUrl: 'views/food/food.html',\n      controller: 'FoodCtrl'\n    })\n    .state('weather', {\n      url: '/weather',\n      templateUrl: 'views/weather/weather.html',\n      controller: 'WeatherCtrl'\n    })\n    .state('local', {\n      abstract: true,\n      url: '/local',\n      templateUrl: 'views/local/local.html'\n    })\n    .state('local.food', {\n      url: '/food',\n      views: {\n        'local-food': {\n          templateUrl: 'views/local/food.html'\n        }\n      }\n    })\n    .state('local.beaches', {\n      url: '/beaches',\n      views: {\n        'local-beaches': {\n          templateUrl: 'views/local/beaches.html'\n        }\n      }\n    })\n    .state('local.sights', {\n      url: '/sights',\n      views: {\n        'local-sights': {\n          templateUrl: 'views/local/sights.html'\n        }\n      }\n    });\n\n  $urlRouterProvider.otherwise('/');\n})\n\n.run(function($ionicPlatform, $location) {\n  $ionicPlatform.ready(function() {\n    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard\n    // for form inputs)\n    if(window.cordova && window.cordova.plugins.Keyboard) {\n      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);\n    }\n    if(window.StatusBar) {\n      StatusBar.styleDefault();\n    }\n  });\n\n  var firstVisit = localStorage.getItem('firstVisit');\n  if (!firstVisit) {\n    $location.url('/tour');\n  }\n})\n\n.factory('EventsService', function ($firebase) {\n  var firebase = new Firebase('https://ionic-in-action-demo.firebaseio.com/events');\n  var service = $firebase(firebase);\n  return service;\n})\n\n.factory('MenuService', function ($firebase) {\n  var firebase = new Firebase('https://ionic-in-action-demo.firebaseio.com/menu');\n  var service = $firebase(firebase);\n  return service;\n})\n\n.controller('NavbarCtrl', function ($scope, $ionicSideMenuDelegate) {\n\n  $scope.openMenu = function () {\n    $ionicSideMenuDelegate.toggleLeft();\n  };\n});\n"
  },
  {
    "path": "www/lib/angular/.bower.json",
    "content": "{\n  \"name\": \"angular\",\n  \"version\": \"1.2.24\",\n  \"main\": \"./angular.js\",\n  \"dependencies\": {},\n  \"homepage\": \"https://github.com/angular/bower-angular\",\n  \"_release\": \"1.2.24\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.2.24\",\n    \"commit\": \"e2acb3e79e8f571bd36e12f31c7b2587e0c9dff3\"\n  },\n  \"_source\": \"git://github.com/angular/bower-angular.git\",\n  \"_target\": \"~1.2.17\",\n  \"_originalSource\": \"angular\"\n}"
  },
  {
    "path": "www/lib/angular/README.md",
    "content": "# bower-angular\n\nThis repo is for distribution on `bower`. The source for this module is in the\n[main AngularJS repo](https://github.com/angular/angular.js).\nPlease file issues and pull requests against that repo.\n\n## Install\n\nInstall with `bower`:\n\n```shell\nbower install angular\n```\n\nAdd a `<script>` to your `index.html`:\n\n```html\n<script src=\"/bower_components/angular/angular.js\"></script>\n```\n\n## Documentation\n\nDocumentation is available on the\n[AngularJS docs site](http://docs.angularjs.org/).\n\n## License\n\nThe MIT License\n\nCopyright (c) 2010-2012 Google, Inc. http://angularjs.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "www/lib/angular/angular-csp.css",
    "content": "/* Include this file in your html if you are using the CSP mode. */\n\n@charset \"UTF-8\";\n\n[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],\n.ng-cloak, .x-ng-cloak,\n.ng-hide {\n  display: none !important;\n}\n\nng\\:form {\n  display: block;\n}\n\n.ng-animate-block-transitions {\n  transition:0s all!important;\n  -webkit-transition:0s all!important;\n}\n\n/* show the element during a show/hide animation when the\n * animation is ongoing, but the .ng-hide class is active */\n.ng-hide-add-active, .ng-hide-remove {\n  display: block!important;\n}\n"
  },
  {
    "path": "www/lib/angular/angular.js",
    "content": "/**\n * @license AngularJS v1.2.24\n * (c) 2010-2014 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, document, undefined) {'use strict';\n\n/**\n * @description\n *\n * This object provides a utility for producing rich Error messages within\n * Angular. It can be called as follows:\n *\n * var exampleMinErr = minErr('example');\n * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);\n *\n * The above creates an instance of minErr in the example namespace. The\n * resulting error will have a namespaced error code of example.one.  The\n * resulting error will replace {0} with the value of foo, and {1} with the\n * value of bar. The object is not restricted in the number of arguments it can\n * take.\n *\n * If fewer arguments are specified than necessary for interpolation, the extra\n * interpolation markers will be preserved in the final string.\n *\n * Since data will be parsed statically during a build step, some restrictions\n * are applied with respect to how minErr instances are created and called.\n * Instances should have names of the form namespaceMinErr for a minErr created\n * using minErr('namespace') . Error codes, namespaces and template strings\n * should all be static strings, not variables or general expressions.\n *\n * @param {string} module The namespace to use for the new minErr instance.\n * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance\n */\n\nfunction minErr(module) {\n  return function () {\n    var code = arguments[0],\n      prefix = '[' + (module ? module + ':' : '') + code + '] ',\n      template = arguments[1],\n      templateArgs = arguments,\n      stringify = function (obj) {\n        if (typeof obj === 'function') {\n          return obj.toString().replace(/ \\{[\\s\\S]*$/, '');\n        } else if (typeof obj === 'undefined') {\n          return 'undefined';\n        } else if (typeof obj !== 'string') {\n          return JSON.stringify(obj);\n        }\n        return obj;\n      },\n      message, i;\n\n    message = prefix + template.replace(/\\{\\d+\\}/g, function (match) {\n      var index = +match.slice(1, -1), arg;\n\n      if (index + 2 < templateArgs.length) {\n        arg = templateArgs[index + 2];\n        if (typeof arg === 'function') {\n          return arg.toString().replace(/ ?\\{[\\s\\S]*$/, '');\n        } else if (typeof arg === 'undefined') {\n          return 'undefined';\n        } else if (typeof arg !== 'string') {\n          return toJson(arg);\n        }\n        return arg;\n      }\n      return match;\n    });\n\n    message = message + '\\nhttp://errors.angularjs.org/1.2.24/' +\n      (module ? module + '/' : '') + code;\n    for (i = 2; i < arguments.length; i++) {\n      message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +\n        encodeURIComponent(stringify(arguments[i]));\n    }\n\n    return new Error(message);\n  };\n}\n\n/* We need to tell jshint what variables are being exported */\n/* global angular: true,\n    msie: true,\n    jqLite: true,\n    jQuery: true,\n    slice: true,\n    push: true,\n    toString: true,\n    ngMinErr: true,\n    angularModule: true,\n    nodeName_: true,\n    uid: true,\n    VALIDITY_STATE_PROPERTY: true,\n\n    lowercase: true,\n    uppercase: true,\n    manualLowercase: true,\n    manualUppercase: true,\n    nodeName_: true,\n    isArrayLike: true,\n    forEach: true,\n    sortedKeys: true,\n    forEachSorted: true,\n    reverseParams: true,\n    nextUid: true,\n    setHashKey: true,\n    extend: true,\n    int: true,\n    inherit: true,\n    noop: true,\n    identity: true,\n    valueFn: true,\n    isUndefined: true,\n    isDefined: true,\n    isObject: true,\n    isString: true,\n    isNumber: true,\n    isDate: true,\n    isArray: true,\n    isFunction: true,\n    isRegExp: true,\n    isWindow: true,\n    isScope: true,\n    isFile: true,\n    isBlob: true,\n    isBoolean: true,\n    isPromiseLike: true,\n    trim: true,\n    isElement: true,\n    makeMap: true,\n    map: true,\n    size: true,\n    includes: true,\n    indexOf: true,\n    arrayRemove: true,\n    isLeafNode: true,\n    copy: true,\n    shallowCopy: true,\n    equals: true,\n    csp: true,\n    concat: true,\n    sliceArgs: true,\n    bind: true,\n    toJsonReplacer: true,\n    toJson: true,\n    fromJson: true,\n    toBoolean: true,\n    startingTag: true,\n    tryDecodeURIComponent: true,\n    parseKeyValue: true,\n    toKeyValue: true,\n    encodeUriSegment: true,\n    encodeUriQuery: true,\n    angularInit: true,\n    bootstrap: true,\n    snake_case: true,\n    bindJQuery: true,\n    assertArg: true,\n    assertArgFn: true,\n    assertNotHasOwnProperty: true,\n    getter: true,\n    getBlockElements: true,\n    hasOwnProperty: true,\n*/\n\n////////////////////////////////////\n\n/**\n * @ngdoc module\n * @name ng\n * @module ng\n * @description\n *\n * # ng (core module)\n * The ng module is loaded by default when an AngularJS application is started. The module itself\n * contains the essential components for an AngularJS application to function. The table below\n * lists a high level breakdown of each of the services/factories, filters, directives and testing\n * components available within this core module.\n *\n * <div doc-module-components=\"ng\"></div>\n */\n\n// The name of a form control's ValidityState property.\n// This is used so that it's possible for internal tests to create mock ValidityStates.\nvar VALIDITY_STATE_PROPERTY = 'validity';\n\n/**\n * @ngdoc function\n * @name angular.lowercase\n * @module ng\n * @kind function\n *\n * @description Converts the specified string to lowercase.\n * @param {string} string String to be converted to lowercase.\n * @returns {string} Lowercased string.\n */\nvar lowercase = function(string){return isString(string) ? string.toLowerCase() : string;};\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * @ngdoc function\n * @name angular.uppercase\n * @module ng\n * @kind function\n *\n * @description Converts the specified string to uppercase.\n * @param {string} string String to be converted to uppercase.\n * @returns {string} Uppercased string.\n */\nvar uppercase = function(string){return isString(string) ? string.toUpperCase() : string;};\n\n\nvar manualLowercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})\n      : s;\n};\nvar manualUppercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})\n      : s;\n};\n\n\n// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish\n// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods\n// with correct but slower alternatives.\nif ('i' !== 'I'.toLowerCase()) {\n  lowercase = manualLowercase;\n  uppercase = manualUppercase;\n}\n\n\nvar /** holds major version number for IE or NaN for real browsers */\n    msie,\n    jqLite,           // delay binding since jQuery could be loaded after us.\n    jQuery,           // delay binding\n    slice             = [].slice,\n    push              = [].push,\n    toString          = Object.prototype.toString,\n    ngMinErr          = minErr('ng'),\n\n    /** @name angular */\n    angular           = window.angular || (window.angular = {}),\n    angularModule,\n    nodeName_,\n    uid               = ['0', '0', '0'];\n\n/**\n * IE 11 changed the format of the UserAgent string.\n * See http://msdn.microsoft.com/en-us/library/ms537503.aspx\n */\nmsie = int((/msie (\\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);\nif (isNaN(msie)) {\n  msie = int((/trident\\/.*; rv:(\\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);\n}\n\n\n/**\n * @private\n * @param {*} obj\n * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,\n *                   String ...)\n */\nfunction isArrayLike(obj) {\n  if (obj == null || isWindow(obj)) {\n    return false;\n  }\n\n  var length = obj.length;\n\n  if (obj.nodeType === 1 && length) {\n    return true;\n  }\n\n  return isString(obj) || isArray(obj) || length === 0 ||\n         typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\n/**\n * @ngdoc function\n * @name angular.forEach\n * @module ng\n * @kind function\n *\n * @description\n * Invokes the `iterator` function once for each item in `obj` collection, which can be either an\n * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value`\n * is the value of an object property or an array element and `key` is the object property key or\n * array element index. Specifying a `context` for the function is optional.\n *\n * It is worth noting that `.forEach` does not iterate over inherited properties because it filters\n * using the `hasOwnProperty` method.\n *\n   ```js\n     var values = {name: 'misko', gender: 'male'};\n     var log = [];\n     angular.forEach(values, function(value, key) {\n       this.push(key + ': ' + value);\n     }, log);\n     expect(log).toEqual(['name: misko', 'gender: male']);\n   ```\n *\n * @param {Object|Array} obj Object to iterate over.\n * @param {Function} iterator Iterator function.\n * @param {Object=} context Object to become context (`this`) for the iterator function.\n * @returns {Object|Array} Reference to `obj`.\n */\nfunction forEach(obj, iterator, context) {\n  var key;\n  if (obj) {\n    if (isFunction(obj)) {\n      for (key in obj) {\n        // Need to check if hasOwnProperty exists,\n        // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n        if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n          iterator.call(context, obj[key], key);\n        }\n      }\n    } else if (isArray(obj) || isArrayLike(obj)) {\n      for (key = 0; key < obj.length; key++) {\n        iterator.call(context, obj[key], key);\n      }\n    } else if (obj.forEach && obj.forEach !== forEach) {\n        obj.forEach(iterator, context);\n    } else {\n      for (key in obj) {\n        if (obj.hasOwnProperty(key)) {\n          iterator.call(context, obj[key], key);\n        }\n      }\n    }\n  }\n  return obj;\n}\n\nfunction sortedKeys(obj) {\n  var keys = [];\n  for (var key in obj) {\n    if (obj.hasOwnProperty(key)) {\n      keys.push(key);\n    }\n  }\n  return keys.sort();\n}\n\nfunction forEachSorted(obj, iterator, context) {\n  var keys = sortedKeys(obj);\n  for ( var i = 0; i < keys.length; i++) {\n    iterator.call(context, obj[keys[i]], keys[i]);\n  }\n  return keys;\n}\n\n\n/**\n * when using forEach the params are value, key, but it is often useful to have key, value.\n * @param {function(string, *)} iteratorFn\n * @returns {function(*, string)}\n */\nfunction reverseParams(iteratorFn) {\n  return function(value, key) { iteratorFn(key, value); };\n}\n\n/**\n * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric\n * characters such as '012ABC'. The reason why we are not using simply a number counter is that\n * the number string gets longer over time, and it can also overflow, where as the nextId\n * will grow much slower, it is a string, and it will never overflow.\n *\n * @returns {string} an unique alpha-numeric string\n */\nfunction nextUid() {\n  var index = uid.length;\n  var digit;\n\n  while(index) {\n    index--;\n    digit = uid[index].charCodeAt(0);\n    if (digit == 57 /*'9'*/) {\n      uid[index] = 'A';\n      return uid.join('');\n    }\n    if (digit == 90  /*'Z'*/) {\n      uid[index] = '0';\n    } else {\n      uid[index] = String.fromCharCode(digit + 1);\n      return uid.join('');\n    }\n  }\n  uid.unshift('0');\n  return uid.join('');\n}\n\n\n/**\n * Set or clear the hashkey for an object.\n * @param obj object\n * @param h the hashkey (!truthy to delete the hashkey)\n */\nfunction setHashKey(obj, h) {\n  if (h) {\n    obj.$$hashKey = h;\n  }\n  else {\n    delete obj.$$hashKey;\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.extend\n * @module ng\n * @kind function\n *\n * @description\n * Extends the destination object `dst` by copying all of the properties from the `src` object(s)\n * to `dst`. You can specify multiple `src` objects.\n *\n * @param {Object} dst Destination object.\n * @param {...Object} src Source object(s).\n * @returns {Object} Reference to `dst`.\n */\nfunction extend(dst) {\n  var h = dst.$$hashKey;\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        dst[key] = value;\n      });\n    }\n  });\n\n  setHashKey(dst,h);\n  return dst;\n}\n\nfunction int(str) {\n  return parseInt(str, 10);\n}\n\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, {prototype:parent}))(), extra);\n}\n\n/**\n * @ngdoc function\n * @name angular.noop\n * @module ng\n * @kind function\n *\n * @description\n * A function that performs no operations. This function can be useful when writing code in the\n * functional style.\n   ```js\n     function foo(callback) {\n       var result = calculateResult();\n       (callback || angular.noop)(result);\n     }\n   ```\n */\nfunction noop() {}\nnoop.$inject = [];\n\n\n/**\n * @ngdoc function\n * @name angular.identity\n * @module ng\n * @kind function\n *\n * @description\n * A function that returns its first argument. This function is useful when writing code in the\n * functional style.\n *\n   ```js\n     function transformer(transformationFn, value) {\n       return (transformationFn || angular.identity)(value);\n     };\n   ```\n */\nfunction identity($) {return $;}\nidentity.$inject = [];\n\n\nfunction valueFn(value) {return function() {return value;};}\n\n/**\n * @ngdoc function\n * @name angular.isUndefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is undefined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is undefined.\n */\nfunction isUndefined(value){return typeof value === 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is defined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is defined.\n */\nfunction isDefined(value){return typeof value !== 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isObject\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not\n * considered to be objects. Note that JavaScript arrays are objects.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Object` but not `null`.\n */\nfunction isObject(value){return value != null && typeof value === 'object';}\n\n\n/**\n * @ngdoc function\n * @name angular.isString\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `String`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `String`.\n */\nfunction isString(value){return typeof value === 'string';}\n\n\n/**\n * @ngdoc function\n * @name angular.isNumber\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Number`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Number`.\n */\nfunction isNumber(value){return typeof value === 'number';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDate\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a value is a date.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Date`.\n */\nfunction isDate(value) {\n  return toString.call(value) === '[object Date]';\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isArray\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Array`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Array`.\n */\nvar isArray = (function() {\n  if (!isFunction(Array.isArray)) {\n    return function(value) {\n      return toString.call(value) === '[object Array]';\n    };\n  }\n  return Array.isArray;\n})();\n\n/**\n * @ngdoc function\n * @name angular.isFunction\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Function`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Function`.\n */\nfunction isFunction(value){return typeof value === 'function';}\n\n\n/**\n * Determines if a value is a regular expression object.\n *\n * @private\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `RegExp`.\n */\nfunction isRegExp(value) {\n  return toString.call(value) === '[object RegExp]';\n}\n\n\n/**\n * Checks if `obj` is a window object.\n *\n * @private\n * @param {*} obj Object to check\n * @returns {boolean} True if `obj` is a window obj.\n */\nfunction isWindow(obj) {\n  return obj && obj.document && obj.location && obj.alert && obj.setInterval;\n}\n\n\nfunction isScope(obj) {\n  return obj && obj.$evalAsync && obj.$watch;\n}\n\n\nfunction isFile(obj) {\n  return toString.call(obj) === '[object File]';\n}\n\n\nfunction isBlob(obj) {\n  return toString.call(obj) === '[object Blob]';\n}\n\n\nfunction isBoolean(value) {\n  return typeof value === 'boolean';\n}\n\n\nfunction isPromiseLike(obj) {\n  return obj && isFunction(obj.then);\n}\n\n\nvar trim = (function() {\n  // native trim is way faster: http://jsperf.com/angular-trim-test\n  // but IE doesn't have it... :-(\n  // TODO: we should move this into IE/ES5 polyfill\n  if (!String.prototype.trim) {\n    return function(value) {\n      return isString(value) ? value.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '') : value;\n    };\n  }\n  return function(value) {\n    return isString(value) ? value.trim() : value;\n  };\n})();\n\n\n/**\n * @ngdoc function\n * @name angular.isElement\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a DOM element (or wrapped jQuery element).\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).\n */\nfunction isElement(node) {\n  return !!(node &&\n    (node.nodeName  // we are a direct element\n    || (node.prop && node.attr && node.find)));  // we have an on and find method part of jQuery API\n}\n\n/**\n * @param str 'key1,key2,...'\n * @returns {object} in the form of {key1:true, key2:true, ...}\n */\nfunction makeMap(str) {\n  var obj = {}, items = str.split(\",\"), i;\n  for ( i = 0; i < items.length; i++ )\n    obj[ items[i] ] = true;\n  return obj;\n}\n\n\nif (msie < 9) {\n  nodeName_ = function(element) {\n    element = element.nodeName ? element : element[0];\n    return (element.scopeName && element.scopeName != 'HTML')\n      ? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName;\n  };\n} else {\n  nodeName_ = function(element) {\n    return element.nodeName ? element.nodeName : element[0].nodeName;\n  };\n}\n\n\nfunction map(obj, iterator, context) {\n  var results = [];\n  forEach(obj, function(value, index, list) {\n    results.push(iterator.call(context, value, index, list));\n  });\n  return results;\n}\n\n\n/**\n * @description\n * Determines the number of elements in an array, the number of properties an object has, or\n * the length of a string.\n *\n * Note: This function is used to augment the Object type in Angular expressions. See\n * {@link angular.Object} for more information about Angular arrays.\n *\n * @param {Object|Array|string} obj Object, array, or string to inspect.\n * @param {boolean} [ownPropsOnly=false] Count only \"own\" properties in an object\n * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array.\n */\nfunction size(obj, ownPropsOnly) {\n  var count = 0, key;\n\n  if (isArray(obj) || isString(obj)) {\n    return obj.length;\n  } else if (isObject(obj)) {\n    for (key in obj)\n      if (!ownPropsOnly || obj.hasOwnProperty(key))\n        count++;\n  }\n\n  return count;\n}\n\n\nfunction includes(array, obj) {\n  return indexOf(array, obj) != -1;\n}\n\nfunction indexOf(array, obj) {\n  if (array.indexOf) return array.indexOf(obj);\n\n  for (var i = 0; i < array.length; i++) {\n    if (obj === array[i]) return i;\n  }\n  return -1;\n}\n\nfunction arrayRemove(array, value) {\n  var index = indexOf(array, value);\n  if (index >=0)\n    array.splice(index, 1);\n  return value;\n}\n\nfunction isLeafNode (node) {\n  if (node) {\n    switch (node.nodeName) {\n    case \"OPTION\":\n    case \"PRE\":\n    case \"TITLE\":\n      return true;\n    }\n  }\n  return false;\n}\n\n/**\n * @ngdoc function\n * @name angular.copy\n * @module ng\n * @kind function\n *\n * @description\n * Creates a deep copy of `source`, which should be an object or an array.\n *\n * * If no destination is supplied, a copy of the object or array is created.\n * * If a destination is provided, all of its elements (for array) or properties (for objects)\n *   are deleted and then all elements/properties from the source are copied to it.\n * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.\n * * If `source` is identical to 'destination' an exception will be thrown.\n *\n * @param {*} source The source that will be used to make a copy.\n *                   Can be any type, including primitives, `null`, and `undefined`.\n * @param {(Object|Array)=} destination Destination into which the source is copied. If\n *     provided, must be of the same type as `source`.\n * @returns {*} The copy or updated `destination`, if `destination` was specified.\n *\n * @example\n <example module=\"copyExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form novalidate class=\"simple-form\">\n Name: <input type=\"text\" ng-model=\"user.name\" /><br />\n E-mail: <input type=\"email\" ng-model=\"user.email\" /><br />\n Gender: <input type=\"radio\" ng-model=\"user.gender\" value=\"male\" />male\n <input type=\"radio\" ng-model=\"user.gender\" value=\"female\" />female<br />\n <button ng-click=\"reset()\">RESET</button>\n <button ng-click=\"update(user)\">SAVE</button>\n </form>\n <pre>form = {{user | json}}</pre>\n <pre>master = {{master | json}}</pre>\n </div>\n\n <script>\n  angular.module('copyExample', [])\n    .controller('ExampleController', ['$scope', function($scope) {\n      $scope.master= {};\n\n      $scope.update = function(user) {\n        // Example with 1 argument\n        $scope.master= angular.copy(user);\n      };\n\n      $scope.reset = function() {\n        // Example with 2 arguments\n        angular.copy($scope.master, $scope.user);\n      };\n\n      $scope.reset();\n    }]);\n </script>\n </file>\n </example>\n */\nfunction copy(source, destination, stackSource, stackDest) {\n  if (isWindow(source) || isScope(source)) {\n    throw ngMinErr('cpws',\n      \"Can't copy! Making copies of Window or Scope instances is not supported.\");\n  }\n\n  if (!destination) {\n    destination = source;\n    if (source) {\n      if (isArray(source)) {\n        destination = copy(source, [], stackSource, stackDest);\n      } else if (isDate(source)) {\n        destination = new Date(source.getTime());\n      } else if (isRegExp(source)) {\n        destination = new RegExp(source.source, source.toString().match(/[^\\/]*$/)[0]);\n        destination.lastIndex = source.lastIndex;\n      } else if (isObject(source)) {\n        destination = copy(source, {}, stackSource, stackDest);\n      }\n    }\n  } else {\n    if (source === destination) throw ngMinErr('cpi',\n      \"Can't copy! Source and destination are identical.\");\n\n    stackSource = stackSource || [];\n    stackDest = stackDest || [];\n\n    if (isObject(source)) {\n      var index = indexOf(stackSource, source);\n      if (index !== -1) return stackDest[index];\n\n      stackSource.push(source);\n      stackDest.push(destination);\n    }\n\n    var result;\n    if (isArray(source)) {\n      destination.length = 0;\n      for ( var i = 0; i < source.length; i++) {\n        result = copy(source[i], null, stackSource, stackDest);\n        if (isObject(source[i])) {\n          stackSource.push(source[i]);\n          stackDest.push(result);\n        }\n        destination.push(result);\n      }\n    } else {\n      var h = destination.$$hashKey;\n      if (isArray(destination)) {\n        destination.length = 0;\n      } else {\n        forEach(destination, function(value, key) {\n          delete destination[key];\n        });\n      }\n      for ( var key in source) {\n        result = copy(source[key], null, stackSource, stackDest);\n        if (isObject(source[key])) {\n          stackSource.push(source[key]);\n          stackDest.push(result);\n        }\n        destination[key] = result;\n      }\n      setHashKey(destination,h);\n    }\n\n  }\n  return destination;\n}\n\n/**\n * Creates a shallow copy of an object, an array or a primitive\n */\nfunction shallowCopy(src, dst) {\n  if (isArray(src)) {\n    dst = dst || [];\n\n    for ( var i = 0; i < src.length; i++) {\n      dst[i] = src[i];\n    }\n  } else if (isObject(src)) {\n    dst = dst || {};\n\n    for (var key in src) {\n      if (hasOwnProperty.call(src, key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {\n        dst[key] = src[key];\n      }\n    }\n  }\n\n  return dst || src;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.equals\n * @module ng\n * @kind function\n *\n * @description\n * Determines if two objects or two values are equivalent. Supports value types, regular\n * expressions, arrays and objects.\n *\n * Two objects or values are considered equivalent if at least one of the following is true:\n *\n * * Both objects or values pass `===` comparison.\n * * Both objects or values are of the same type and all of their properties are equal by\n *   comparing them with `angular.equals`.\n * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)\n * * Both values represent the same regular expression (In JavaScript,\n *   /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual\n *   representation matches).\n *\n * During a property comparison, properties of `function` type and properties with names\n * that begin with `$` are ignored.\n *\n * Scope and DOMWindow objects are being compared only by identify (`===`).\n *\n * @param {*} o1 Object or value to compare.\n * @param {*} o2 Object or value to compare.\n * @returns {boolean} True if arguments are equal.\n */\nfunction equals(o1, o2) {\n  if (o1 === o2) return true;\n  if (o1 === null || o2 === null) return false;\n  if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n  var t1 = typeof o1, t2 = typeof o2, length, key, keySet;\n  if (t1 == t2) {\n    if (t1 == 'object') {\n      if (isArray(o1)) {\n        if (!isArray(o2)) return false;\n        if ((length = o1.length) == o2.length) {\n          for(key=0; key<length; key++) {\n            if (!equals(o1[key], o2[key])) return false;\n          }\n          return true;\n        }\n      } else if (isDate(o1)) {\n        if (!isDate(o2)) return false;\n        return (isNaN(o1.getTime()) && isNaN(o2.getTime())) || (o1.getTime() === o2.getTime());\n      } else if (isRegExp(o1) && isRegExp(o2)) {\n        return o1.toString() == o2.toString();\n      } else {\n        if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false;\n        keySet = {};\n        for(key in o1) {\n          if (key.charAt(0) === '$' || isFunction(o1[key])) continue;\n          if (!equals(o1[key], o2[key])) return false;\n          keySet[key] = true;\n        }\n        for(key in o2) {\n          if (!keySet.hasOwnProperty(key) &&\n              key.charAt(0) !== '$' &&\n              o2[key] !== undefined &&\n              !isFunction(o2[key])) return false;\n        }\n        return true;\n      }\n    }\n  }\n  return false;\n}\n\nvar csp = function() {\n  if (isDefined(csp.isActive_)) return csp.isActive_;\n\n  var active = !!(document.querySelector('[ng-csp]') ||\n                  document.querySelector('[data-ng-csp]'));\n\n  if (!active) {\n    try {\n      /* jshint -W031, -W054 */\n      new Function('');\n      /* jshint +W031, +W054 */\n    } catch (e) {\n      active = true;\n    }\n  }\n\n  return (csp.isActive_ = active);\n};\n\n\n\nfunction concat(array1, array2, index) {\n  return array1.concat(slice.call(array2, index));\n}\n\nfunction sliceArgs(args, startIndex) {\n  return slice.call(args, startIndex || 0);\n}\n\n\n/* jshint -W101 */\n/**\n * @ngdoc function\n * @name angular.bind\n * @module ng\n * @kind function\n *\n * @description\n * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for\n * `fn`). You can supply optional `args` that are prebound to the function. This feature is also\n * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as\n * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).\n *\n * @param {Object} self Context which `fn` should be evaluated in.\n * @param {function()} fn Function to be bound.\n * @param {...*} args Optional arguments to be prebound to the `fn` function call.\n * @returns {function()} Function that wraps the `fn` with all the specified bindings.\n */\n/* jshint +W101 */\nfunction bind(self, fn) {\n  var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];\n  if (isFunction(fn) && !(fn instanceof RegExp)) {\n    return curryArgs.length\n      ? function() {\n          return arguments.length\n            ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0)))\n            : fn.apply(self, curryArgs);\n        }\n      : function() {\n          return arguments.length\n            ? fn.apply(self, arguments)\n            : fn.call(self);\n        };\n  } else {\n    // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)\n    return fn;\n  }\n}\n\n\nfunction toJsonReplacer(key, value) {\n  var val = value;\n\n  if (typeof key === 'string' && key.charAt(0) === '$') {\n    val = undefined;\n  } else if (isWindow(value)) {\n    val = '$WINDOW';\n  } else if (value &&  document === value) {\n    val = '$DOCUMENT';\n  } else if (isScope(value)) {\n    val = '$SCOPE';\n  }\n\n  return val;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.toJson\n * @module ng\n * @kind function\n *\n * @description\n * Serializes input into a JSON-formatted string. Properties with leading $ characters will be\n * stripped since angular uses this notation internally.\n *\n * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.\n * @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace.\n * @returns {string|undefined} JSON-ified string representing `obj`.\n */\nfunction toJson(obj, pretty) {\n  if (typeof obj === 'undefined') return undefined;\n  return JSON.stringify(obj, toJsonReplacer, pretty ? '  ' : null);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.fromJson\n * @module ng\n * @kind function\n *\n * @description\n * Deserializes a JSON string.\n *\n * @param {string} json JSON string to deserialize.\n * @returns {Object|Array|string|number} Deserialized thingy.\n */\nfunction fromJson(json) {\n  return isString(json)\n      ? JSON.parse(json)\n      : json;\n}\n\n\nfunction toBoolean(value) {\n  if (typeof value === 'function') {\n    value = true;\n  } else if (value && value.length !== 0) {\n    var v = lowercase(\"\" + value);\n    value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');\n  } else {\n    value = false;\n  }\n  return value;\n}\n\n/**\n * @returns {string} Returns the string representation of the element.\n */\nfunction startingTag(element) {\n  element = jqLite(element).clone();\n  try {\n    // turns out IE does not let you set .html() on elements which\n    // are not allowed to have children. So we just ignore it.\n    element.empty();\n  } catch(e) {}\n  // As Per DOM Standards\n  var TEXT_NODE = 3;\n  var elemHtml = jqLite('<div>').append(element).html();\n  try {\n    return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) :\n        elemHtml.\n          match(/^(<[^>]+>)/)[1].\n          replace(/^<([\\w\\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });\n  } catch(e) {\n    return lowercase(elemHtml);\n  }\n\n}\n\n\n/////////////////////////////////////////////////\n\n/**\n * Tries to decode the URI component without throwing an exception.\n *\n * @private\n * @param str value potential URI component to check.\n * @returns {boolean} True if `value` can be decoded\n * with the decodeURIComponent function.\n */\nfunction tryDecodeURIComponent(value) {\n  try {\n    return decodeURIComponent(value);\n  } catch(e) {\n    // Ignore any invalid uri component\n  }\n}\n\n\n/**\n * Parses an escaped url query string into key-value pairs.\n * @returns {Object.<string,boolean|Array>}\n */\nfunction parseKeyValue(/**string*/keyValue) {\n  var obj = {}, key_value, key;\n  forEach((keyValue || \"\").split('&'), function(keyValue) {\n    if ( keyValue ) {\n      key_value = keyValue.replace(/\\+/g,'%20').split('=');\n      key = tryDecodeURIComponent(key_value[0]);\n      if ( isDefined(key) ) {\n        var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;\n        if (!hasOwnProperty.call(obj, key)) {\n          obj[key] = val;\n        } else if(isArray(obj[key])) {\n          obj[key].push(val);\n        } else {\n          obj[key] = [obj[key],val];\n        }\n      }\n    }\n  });\n  return obj;\n}\n\nfunction toKeyValue(obj) {\n  var parts = [];\n  forEach(obj, function(value, key) {\n    if (isArray(value)) {\n      forEach(value, function(arrayValue) {\n        parts.push(encodeUriQuery(key, true) +\n                   (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));\n      });\n    } else {\n    parts.push(encodeUriQuery(key, true) +\n               (value === true ? '' : '=' + encodeUriQuery(value, true)));\n    }\n  });\n  return parts.length ? parts.join('&') : '';\n}\n\n\n/**\n * We need our custom method because encodeURIComponent is too aggressive and doesn't follow\n * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path\n * segments:\n *    segment       = *pchar\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriSegment(val) {\n  return encodeUriQuery(val, true).\n             replace(/%26/gi, '&').\n             replace(/%3D/gi, '=').\n             replace(/%2B/gi, '+');\n}\n\n\n/**\n * This method is intended for encoding *key* or *value* parts of query component. We need a custom\n * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be\n * encoded per http://tools.ietf.org/html/rfc3986:\n *    query       = *( pchar / \"/\" / \"?\" )\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriQuery(val, pctEncodeSpaces) {\n  return encodeURIComponent(val).\n             replace(/%40/gi, '@').\n             replace(/%3A/gi, ':').\n             replace(/%24/g, '$').\n             replace(/%2C/gi, ',').\n             replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));\n}\n\n\n/**\n * @ngdoc directive\n * @name ngApp\n * @module ng\n *\n * @element ANY\n * @param {angular.Module} ngApp an optional application\n *   {@link angular.module module} name to load.\n *\n * @description\n *\n * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive\n * designates the **root element** of the application and is typically placed near the root element\n * of the page - e.g. on the `<body>` or `<html>` tags.\n *\n * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`\n * found in the document will be used to define the root element to auto-bootstrap as an\n * application. To run multiple applications in an HTML document you must manually bootstrap them using\n * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.\n *\n * You can specify an **AngularJS module** to be used as the root module for the application.  This\n * module will be loaded into the {@link auto.$injector} when the application is bootstrapped and\n * should contain the application code needed or have dependencies on other modules that will\n * contain the code. See {@link angular.module} for more information.\n *\n * In the example below if the `ngApp` directive were not placed on the `html` element then the\n * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`\n * would not be resolved to `3`.\n *\n * `ngApp` is the easiest, and most common, way to bootstrap an application.\n *\n <example module=\"ngAppDemo\">\n   <file name=\"index.html\">\n   <div ng-controller=\"ngAppDemoController\">\n     I can add: {{a}} + {{b}} =  {{ a+b }}\n   </div>\n   </file>\n   <file name=\"script.js\">\n   angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {\n     $scope.a = 1;\n     $scope.b = 2;\n   });\n   </file>\n </example>\n *\n */\nfunction angularInit(element, bootstrap) {\n  var elements = [element],\n      appElement,\n      module,\n      names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'],\n      NG_APP_CLASS_REGEXP = /\\sng[:\\-]app(:\\s*([\\w\\d_]+);?)?\\s/;\n\n  function append(element) {\n    element && elements.push(element);\n  }\n\n  forEach(names, function(name) {\n    names[name] = true;\n    append(document.getElementById(name));\n    name = name.replace(':', '\\\\:');\n    if (element.querySelectorAll) {\n      forEach(element.querySelectorAll('.' + name), append);\n      forEach(element.querySelectorAll('.' + name + '\\\\:'), append);\n      forEach(element.querySelectorAll('[' + name + ']'), append);\n    }\n  });\n\n  forEach(elements, function(element) {\n    if (!appElement) {\n      var className = ' ' + element.className + ' ';\n      var match = NG_APP_CLASS_REGEXP.exec(className);\n      if (match) {\n        appElement = element;\n        module = (match[2] || '').replace(/\\s+/g, ',');\n      } else {\n        forEach(element.attributes, function(attr) {\n          if (!appElement && names[attr.name]) {\n            appElement = element;\n            module = attr.value;\n          }\n        });\n      }\n    }\n  });\n  if (appElement) {\n    bootstrap(appElement, module ? [module] : []);\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.bootstrap\n * @module ng\n * @description\n * Use this function to manually start up angular application.\n *\n * See: {@link guide/bootstrap Bootstrap}\n *\n * Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually.\n * They must use {@link ng.directive:ngApp ngApp}.\n *\n * Angular will detect if it has been loaded into the browser more than once and only allow the\n * first loaded script to be bootstrapped and will report a warning to the browser console for\n * each of the subsequent scripts. This prevents strange results in applications, where otherwise\n * multiple instances of Angular try to work on the DOM.\n *\n * <example name=\"multi-bootstrap\" module=\"multi-bootstrap\">\n * <file name=\"index.html\">\n * <script src=\"../../../angular.js\"></script>\n * <div ng-controller=\"BrokenTable\">\n *   <table>\n *   <tr>\n *     <th ng-repeat=\"heading in headings\">{{heading}}</th>\n *   </tr>\n *   <tr ng-repeat=\"filling in fillings\">\n *     <td ng-repeat=\"fill in filling\">{{fill}}</td>\n *   </tr>\n * </table>\n * </div>\n * </file>\n * <file name=\"controller.js\">\n * var app = angular.module('multi-bootstrap', [])\n *\n * .controller('BrokenTable', function($scope) {\n *     $scope.headings = ['One', 'Two', 'Three'];\n *     $scope.fillings = [[1, 2, 3], ['A', 'B', 'C'], [7, 8, 9]];\n * });\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should only insert one table cell for each item in $scope.fillings', function() {\n *  expect(element.all(by.css('td')).count())\n *      .toBe(9);\n * });\n * </file>\n * </example>\n *\n * @param {DOMElement} element DOM element which is the root of angular application.\n * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.\n *     Each item in the array should be the name of a predefined module or a (DI annotated)\n *     function that will be invoked by the injector as a run block.\n *     See: {@link angular.module modules}\n * @returns {auto.$injector} Returns the newly created injector for this app.\n */\nfunction bootstrap(element, modules) {\n  var doBootstrap = function() {\n    element = jqLite(element);\n\n    if (element.injector()) {\n      var tag = (element[0] === document) ? 'document' : startingTag(element);\n      //Encode angle brackets to prevent input from being sanitized to empty string #8683\n      throw ngMinErr(\n          'btstrpd',\n          \"App Already Bootstrapped with this Element '{0}'\",\n          tag.replace(/</,'&lt;').replace(/>/,'&gt;'));\n    }\n\n    modules = modules || [];\n    modules.unshift(['$provide', function($provide) {\n      $provide.value('$rootElement', element);\n    }]);\n    modules.unshift('ng');\n    var injector = createInjector(modules);\n    injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', '$animate',\n       function(scope, element, compile, injector, animate) {\n        scope.$apply(function() {\n          element.data('$injector', injector);\n          compile(element)(scope);\n        });\n      }]\n    );\n    return injector;\n  };\n\n  var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;\n\n  if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {\n    return doBootstrap();\n  }\n\n  window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');\n  angular.resumeBootstrap = function(extraModules) {\n    forEach(extraModules, function(module) {\n      modules.push(module);\n    });\n    doBootstrap();\n  };\n}\n\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nfunction snake_case(name, separator) {\n  separator = separator || '_';\n  return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n    return (pos ? separator : '') + letter.toLowerCase();\n  });\n}\n\nfunction bindJQuery() {\n  // bind to jQuery if present;\n  jQuery = window.jQuery;\n  // Use jQuery if it exists with proper functionality, otherwise default to us.\n  // Angular 1.2+ requires jQuery 1.7.1+ for on()/off() support.\n  if (jQuery && jQuery.fn.on) {\n    jqLite = jQuery;\n    extend(jQuery.fn, {\n      scope: JQLitePrototype.scope,\n      isolateScope: JQLitePrototype.isolateScope,\n      controller: JQLitePrototype.controller,\n      injector: JQLitePrototype.injector,\n      inheritedData: JQLitePrototype.inheritedData\n    });\n    // Method signature:\n    //     jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments)\n    jqLitePatchJQueryRemove('remove', true, true, false);\n    jqLitePatchJQueryRemove('empty', false, false, false);\n    jqLitePatchJQueryRemove('html', false, false, true);\n  } else {\n    jqLite = JQLite;\n  }\n  angular.element = jqLite;\n}\n\n/**\n * throw error if the argument is falsy.\n */\nfunction assertArg(arg, name, reason) {\n  if (!arg) {\n    throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n  }\n  return arg;\n}\n\nfunction assertArgFn(arg, name, acceptArrayAnnotation) {\n  if (acceptArrayAnnotation && isArray(arg)) {\n      arg = arg[arg.length - 1];\n  }\n\n  assertArg(isFunction(arg), name, 'not a function, got ' +\n      (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));\n  return arg;\n}\n\n/**\n * throw error if the name given is hasOwnProperty\n * @param  {String} name    the name to test\n * @param  {String} context the context in which the name is used, such as module or directive\n */\nfunction assertNotHasOwnProperty(name, context) {\n  if (name === 'hasOwnProperty') {\n    throw ngMinErr('badname', \"hasOwnProperty is not a valid {0} name\", context);\n  }\n}\n\n/**\n * Return the value accessible from the object by path. Any undefined traversals are ignored\n * @param {Object} obj starting object\n * @param {String} path path to traverse\n * @param {boolean} [bindFnToScope=true]\n * @returns {Object} value as accessible by path\n */\n//TODO(misko): this function needs to be removed\nfunction getter(obj, path, bindFnToScope) {\n  if (!path) return obj;\n  var keys = path.split('.');\n  var key;\n  var lastInstance = obj;\n  var len = keys.length;\n\n  for (var i = 0; i < len; i++) {\n    key = keys[i];\n    if (obj) {\n      obj = (lastInstance = obj)[key];\n    }\n  }\n  if (!bindFnToScope && isFunction(obj)) {\n    return bind(lastInstance, obj);\n  }\n  return obj;\n}\n\n/**\n * Return the DOM siblings between the first and last node in the given array.\n * @param {Array} array like object\n * @returns {DOMElement} object containing the elements\n */\nfunction getBlockElements(nodes) {\n  var startNode = nodes[0],\n      endNode = nodes[nodes.length - 1];\n  if (startNode === endNode) {\n    return jqLite(startNode);\n  }\n\n  var element = startNode;\n  var elements = [element];\n\n  do {\n    element = element.nextSibling;\n    if (!element) break;\n    elements.push(element);\n  } while (element !== endNode);\n\n  return jqLite(elements);\n}\n\n/**\n * @ngdoc type\n * @name angular.Module\n * @module ng\n * @description\n *\n * Interface for configuring angular {@link angular.module modules}.\n */\n\nfunction setupModuleLoader(window) {\n\n  var $injectorMinErr = minErr('$injector');\n  var ngMinErr = minErr('ng');\n\n  function ensure(obj, name, factory) {\n    return obj[name] || (obj[name] = factory());\n  }\n\n  var angular = ensure(window, 'angular', Object);\n\n  // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap\n  angular.$$minErr = angular.$$minErr || minErr;\n\n  return ensure(angular, 'module', function() {\n    /** @type {Object.<string, angular.Module>} */\n    var modules = {};\n\n    /**\n     * @ngdoc function\n     * @name angular.module\n     * @module ng\n     * @description\n     *\n     * The `angular.module` is a global place for creating, registering and retrieving Angular\n     * modules.\n     * All modules (angular core or 3rd party) that should be available to an application must be\n     * registered using this mechanism.\n     *\n     * When passed two or more arguments, a new module is created.  If passed only one argument, an\n     * existing module (the name passed as the first argument to `module`) is retrieved.\n     *\n     *\n     * # Module\n     *\n     * A module is a collection of services, directives, controllers, filters, and configuration information.\n     * `angular.module` is used to configure the {@link auto.$injector $injector}.\n     *\n     * ```js\n     * // Create a new module\n     * var myModule = angular.module('myModule', []);\n     *\n     * // register a new service\n     * myModule.value('appName', 'MyCoolApp');\n     *\n     * // configure existing services inside initialization blocks.\n     * myModule.config(['$locationProvider', function($locationProvider) {\n     *   // Configure existing providers\n     *   $locationProvider.hashPrefix('!');\n     * }]);\n     * ```\n     *\n     * Then you can create an injector and load your modules like this:\n     *\n     * ```js\n     * var injector = angular.injector(['ng', 'myModule'])\n     * ```\n     *\n     * However it's more likely that you'll just use\n     * {@link ng.directive:ngApp ngApp} or\n     * {@link angular.bootstrap} to simplify this process for you.\n     *\n     * @param {!string} name The name of the module to create or retrieve.\n     * @param {!Array.<string>=} requires If specified then new module is being created. If\n     *        unspecified then the module is being retrieved for further configuration.\n     * @param {Function=} configFn Optional configuration function for the module. Same as\n     *        {@link angular.Module#config Module#config()}.\n     * @returns {module} new module with the {@link angular.Module} api.\n     */\n    return function module(name, requires, configFn) {\n      var assertNotHasOwnProperty = function(name, context) {\n        if (name === 'hasOwnProperty') {\n          throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);\n        }\n      };\n\n      assertNotHasOwnProperty(name, 'module');\n      if (requires && modules.hasOwnProperty(name)) {\n        modules[name] = null;\n      }\n      return ensure(modules, name, function() {\n        if (!requires) {\n          throw $injectorMinErr('nomod', \"Module '{0}' is not available! You either misspelled \" +\n             \"the module name or forgot to load it. If registering a module ensure that you \" +\n             \"specify the dependencies as the second argument.\", name);\n        }\n\n        /** @type {!Array.<Array.<*>>} */\n        var invokeQueue = [];\n\n        /** @type {!Array.<Function>} */\n        var runBlocks = [];\n\n        var config = invokeLater('$injector', 'invoke');\n\n        /** @type {angular.Module} */\n        var moduleInstance = {\n          // Private state\n          _invokeQueue: invokeQueue,\n          _runBlocks: runBlocks,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#requires\n           * @module ng\n           *\n           * @description\n           * Holds the list of modules which the injector will load before the current module is\n           * loaded.\n           */\n          requires: requires,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#name\n           * @module ng\n           *\n           * @description\n           * Name of the module.\n           */\n          name: name,\n\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#provider\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerType Construction function for creating new instance of the\n           *                                service.\n           * @description\n           * See {@link auto.$provide#provider $provide.provider()}.\n           */\n          provider: invokeLater('$provide', 'provider'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#factory\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerFunction Function for creating new instance of the service.\n           * @description\n           * See {@link auto.$provide#factory $provide.factory()}.\n           */\n          factory: invokeLater('$provide', 'factory'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#service\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} constructor A constructor function that will be instantiated.\n           * @description\n           * See {@link auto.$provide#service $provide.service()}.\n           */\n          service: invokeLater('$provide', 'service'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#value\n           * @module ng\n           * @param {string} name service name\n           * @param {*} object Service instance object.\n           * @description\n           * See {@link auto.$provide#value $provide.value()}.\n           */\n          value: invokeLater('$provide', 'value'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#constant\n           * @module ng\n           * @param {string} name constant name\n           * @param {*} object Constant value.\n           * @description\n           * Because the constant are fixed, they get applied before other provide methods.\n           * See {@link auto.$provide#constant $provide.constant()}.\n           */\n          constant: invokeLater('$provide', 'constant', 'unshift'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#animation\n           * @module ng\n           * @param {string} name animation name\n           * @param {Function} animationFactory Factory function for creating new instance of an\n           *                                    animation.\n           * @description\n           *\n           * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.\n           *\n           *\n           * Defines an animation hook that can be later used with\n           * {@link ngAnimate.$animate $animate} service and directives that use this service.\n           *\n           * ```js\n           * module.animation('.animation-name', function($inject1, $inject2) {\n           *   return {\n           *     eventName : function(element, done) {\n           *       //code to run the animation\n           *       //once complete, then run done()\n           *       return function cancellationFunction(element) {\n           *         //code to cancel the animation\n           *       }\n           *     }\n           *   }\n           * })\n           * ```\n           *\n           * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and\n           * {@link ngAnimate ngAnimate module} for more information.\n           */\n          animation: invokeLater('$animateProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#filter\n           * @module ng\n           * @param {string} name Filter name.\n           * @param {Function} filterFactory Factory function for creating new instance of filter.\n           * @description\n           * See {@link ng.$filterProvider#register $filterProvider.register()}.\n           */\n          filter: invokeLater('$filterProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#controller\n           * @module ng\n           * @param {string|Object} name Controller name, or an object map of controllers where the\n           *    keys are the names and the values are the constructors.\n           * @param {Function} constructor Controller constructor function.\n           * @description\n           * See {@link ng.$controllerProvider#register $controllerProvider.register()}.\n           */\n          controller: invokeLater('$controllerProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#directive\n           * @module ng\n           * @param {string|Object} name Directive name, or an object map of directives where the\n           *    keys are the names and the values are the factories.\n           * @param {Function} directiveFactory Factory function for creating new instance of\n           * directives.\n           * @description\n           * See {@link ng.$compileProvider#directive $compileProvider.directive()}.\n           */\n          directive: invokeLater('$compileProvider', 'directive'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#config\n           * @module ng\n           * @param {Function} configFn Execute this function on module load. Useful for service\n           *    configuration.\n           * @description\n           * Use this method to register work which needs to be performed on module loading.\n           * For more about how to configure services, see\n           * {@link providers#providers_provider-recipe Provider Recipe}.\n           */\n          config: config,\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#run\n           * @module ng\n           * @param {Function} initializationFn Execute this function after injector creation.\n           *    Useful for application initialization.\n           * @description\n           * Use this method to register work which should be performed when the injector is done\n           * loading all modules.\n           */\n          run: function(block) {\n            runBlocks.push(block);\n            return this;\n          }\n        };\n\n        if (configFn) {\n          config(configFn);\n        }\n\n        return  moduleInstance;\n\n        /**\n         * @param {string} provider\n         * @param {string} method\n         * @param {String=} insertMethod\n         * @returns {angular.Module}\n         */\n        function invokeLater(provider, method, insertMethod) {\n          return function() {\n            invokeQueue[insertMethod || 'push']([provider, method, arguments]);\n            return moduleInstance;\n          };\n        }\n      });\n    };\n  });\n\n}\n\n/* global angularModule: true,\n  version: true,\n\n  $LocaleProvider,\n  $CompileProvider,\n\n    htmlAnchorDirective,\n    inputDirective,\n    inputDirective,\n    formDirective,\n    scriptDirective,\n    selectDirective,\n    styleDirective,\n    optionDirective,\n    ngBindDirective,\n    ngBindHtmlDirective,\n    ngBindTemplateDirective,\n    ngClassDirective,\n    ngClassEvenDirective,\n    ngClassOddDirective,\n    ngCspDirective,\n    ngCloakDirective,\n    ngControllerDirective,\n    ngFormDirective,\n    ngHideDirective,\n    ngIfDirective,\n    ngIncludeDirective,\n    ngIncludeFillContentDirective,\n    ngInitDirective,\n    ngNonBindableDirective,\n    ngPluralizeDirective,\n    ngRepeatDirective,\n    ngShowDirective,\n    ngStyleDirective,\n    ngSwitchDirective,\n    ngSwitchWhenDirective,\n    ngSwitchDefaultDirective,\n    ngOptionsDirective,\n    ngTranscludeDirective,\n    ngModelDirective,\n    ngListDirective,\n    ngChangeDirective,\n    requiredDirective,\n    requiredDirective,\n    ngValueDirective,\n    ngAttributeAliasDirectives,\n    ngEventDirectives,\n\n    $AnchorScrollProvider,\n    $AnimateProvider,\n    $BrowserProvider,\n    $CacheFactoryProvider,\n    $ControllerProvider,\n    $DocumentProvider,\n    $ExceptionHandlerProvider,\n    $FilterProvider,\n    $InterpolateProvider,\n    $IntervalProvider,\n    $HttpProvider,\n    $HttpBackendProvider,\n    $LocationProvider,\n    $LogProvider,\n    $ParseProvider,\n    $RootScopeProvider,\n    $QProvider,\n    $$SanitizeUriProvider,\n    $SceProvider,\n    $SceDelegateProvider,\n    $SnifferProvider,\n    $TemplateCacheProvider,\n    $TimeoutProvider,\n    $$RAFProvider,\n    $$AsyncCallbackProvider,\n    $WindowProvider\n*/\n\n\n/**\n * @ngdoc object\n * @name angular.version\n * @module ng\n * @description\n * An object that contains information about the current AngularJS version. This object has the\n * following properties:\n *\n * - `full` – `{string}` – Full version string, such as \"0.9.18\".\n * - `major` – `{number}` – Major version number, such as \"0\".\n * - `minor` – `{number}` – Minor version number, such as \"9\".\n * - `dot` – `{number}` – Dot version number, such as \"18\".\n * - `codeName` – `{string}` – Code name of the release, such as \"jiggling-armfat\".\n */\nvar version = {\n  full: '1.2.24',    // all of these placeholder strings will be replaced by grunt's\n  major: 1,    // package task\n  minor: 2,\n  dot: 24,\n  codeName: 'static-levitation'\n};\n\n\nfunction publishExternalAPI(angular){\n  extend(angular, {\n    'bootstrap': bootstrap,\n    'copy': copy,\n    'extend': extend,\n    'equals': equals,\n    'element': jqLite,\n    'forEach': forEach,\n    'injector': createInjector,\n    'noop': noop,\n    'bind': bind,\n    'toJson': toJson,\n    'fromJson': fromJson,\n    'identity': identity,\n    'isUndefined': isUndefined,\n    'isDefined': isDefined,\n    'isString': isString,\n    'isFunction': isFunction,\n    'isObject': isObject,\n    'isNumber': isNumber,\n    'isElement': isElement,\n    'isArray': isArray,\n    'version': version,\n    'isDate': isDate,\n    'lowercase': lowercase,\n    'uppercase': uppercase,\n    'callbacks': {counter: 0},\n    '$$minErr': minErr,\n    '$$csp': csp\n  });\n\n  angularModule = setupModuleLoader(window);\n  try {\n    angularModule('ngLocale');\n  } catch (e) {\n    angularModule('ngLocale', []).provider('$locale', $LocaleProvider);\n  }\n\n  angularModule('ng', ['ngLocale'], ['$provide',\n    function ngModule($provide) {\n      // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.\n      $provide.provider({\n        $$sanitizeUri: $$SanitizeUriProvider\n      });\n      $provide.provider('$compile', $CompileProvider).\n        directive({\n            a: htmlAnchorDirective,\n            input: inputDirective,\n            textarea: inputDirective,\n            form: formDirective,\n            script: scriptDirective,\n            select: selectDirective,\n            style: styleDirective,\n            option: optionDirective,\n            ngBind: ngBindDirective,\n            ngBindHtml: ngBindHtmlDirective,\n            ngBindTemplate: ngBindTemplateDirective,\n            ngClass: ngClassDirective,\n            ngClassEven: ngClassEvenDirective,\n            ngClassOdd: ngClassOddDirective,\n            ngCloak: ngCloakDirective,\n            ngController: ngControllerDirective,\n            ngForm: ngFormDirective,\n            ngHide: ngHideDirective,\n            ngIf: ngIfDirective,\n            ngInclude: ngIncludeDirective,\n            ngInit: ngInitDirective,\n            ngNonBindable: ngNonBindableDirective,\n            ngPluralize: ngPluralizeDirective,\n            ngRepeat: ngRepeatDirective,\n            ngShow: ngShowDirective,\n            ngStyle: ngStyleDirective,\n            ngSwitch: ngSwitchDirective,\n            ngSwitchWhen: ngSwitchWhenDirective,\n            ngSwitchDefault: ngSwitchDefaultDirective,\n            ngOptions: ngOptionsDirective,\n            ngTransclude: ngTranscludeDirective,\n            ngModel: ngModelDirective,\n            ngList: ngListDirective,\n            ngChange: ngChangeDirective,\n            required: requiredDirective,\n            ngRequired: requiredDirective,\n            ngValue: ngValueDirective\n        }).\n        directive({\n          ngInclude: ngIncludeFillContentDirective\n        }).\n        directive(ngAttributeAliasDirectives).\n        directive(ngEventDirectives);\n      $provide.provider({\n        $anchorScroll: $AnchorScrollProvider,\n        $animate: $AnimateProvider,\n        $browser: $BrowserProvider,\n        $cacheFactory: $CacheFactoryProvider,\n        $controller: $ControllerProvider,\n        $document: $DocumentProvider,\n        $exceptionHandler: $ExceptionHandlerProvider,\n        $filter: $FilterProvider,\n        $interpolate: $InterpolateProvider,\n        $interval: $IntervalProvider,\n        $http: $HttpProvider,\n        $httpBackend: $HttpBackendProvider,\n        $location: $LocationProvider,\n        $log: $LogProvider,\n        $parse: $ParseProvider,\n        $rootScope: $RootScopeProvider,\n        $q: $QProvider,\n        $sce: $SceProvider,\n        $sceDelegate: $SceDelegateProvider,\n        $sniffer: $SnifferProvider,\n        $templateCache: $TemplateCacheProvider,\n        $timeout: $TimeoutProvider,\n        $window: $WindowProvider,\n        $$rAF: $$RAFProvider,\n        $$asyncCallback : $$AsyncCallbackProvider\n      });\n    }\n  ]);\n}\n\n/* global JQLitePrototype: true,\n  addEventListenerFn: true,\n  removeEventListenerFn: true,\n  BOOLEAN_ATTR: true\n*/\n\n//////////////////////////////////\n//JQLite\n//////////////////////////////////\n\n/**\n * @ngdoc function\n * @name angular.element\n * @module ng\n * @kind function\n *\n * @description\n * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.\n *\n * If jQuery is available, `angular.element` is an alias for the\n * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`\n * delegates to Angular's built-in subset of jQuery, called \"jQuery lite\" or \"jqLite.\"\n *\n * <div class=\"alert alert-success\">jqLite is a tiny, API-compatible subset of jQuery that allows\n * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most\n * commonly needed functionality with the goal of having a very small footprint.</div>\n *\n * To use jQuery, simply load it before `DOMContentLoaded` event fired.\n *\n * <div class=\"alert\">**Note:** all element references in Angular are always wrapped with jQuery or\n * jqLite; they are never raw DOM references.</div>\n *\n * ## Angular's jqLite\n * jqLite provides only the following jQuery methods:\n *\n * - [`addClass()`](http://api.jquery.com/addClass/)\n * - [`after()`](http://api.jquery.com/after/)\n * - [`append()`](http://api.jquery.com/append/)\n * - [`attr()`](http://api.jquery.com/attr/)\n * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData\n * - [`children()`](http://api.jquery.com/children/) - Does not support selectors\n * - [`clone()`](http://api.jquery.com/clone/)\n * - [`contents()`](http://api.jquery.com/contents/)\n * - [`css()`](http://api.jquery.com/css/)\n * - [`data()`](http://api.jquery.com/data/)\n * - [`empty()`](http://api.jquery.com/empty/)\n * - [`eq()`](http://api.jquery.com/eq/)\n * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name\n * - [`hasClass()`](http://api.jquery.com/hasClass/)\n * - [`html()`](http://api.jquery.com/html/)\n * - [`next()`](http://api.jquery.com/next/) - Does not support selectors\n * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData\n * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors\n * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors\n * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors\n * - [`prepend()`](http://api.jquery.com/prepend/)\n * - [`prop()`](http://api.jquery.com/prop/)\n * - [`ready()`](http://api.jquery.com/ready/)\n * - [`remove()`](http://api.jquery.com/remove/)\n * - [`removeAttr()`](http://api.jquery.com/removeAttr/)\n * - [`removeClass()`](http://api.jquery.com/removeClass/)\n * - [`removeData()`](http://api.jquery.com/removeData/)\n * - [`replaceWith()`](http://api.jquery.com/replaceWith/)\n * - [`text()`](http://api.jquery.com/text/)\n * - [`toggleClass()`](http://api.jquery.com/toggleClass/)\n * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.\n * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces\n * - [`val()`](http://api.jquery.com/val/)\n * - [`wrap()`](http://api.jquery.com/wrap/)\n *\n * ## jQuery/jqLite Extras\n * Angular also provides the following additional methods and events to both jQuery and jqLite:\n *\n * ### Events\n * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event\n *    on all DOM nodes being removed.  This can be used to clean up any 3rd party bindings to the DOM\n *    element before it is removed.\n *\n * ### Methods\n * - `controller(name)` - retrieves the controller of the current element or its parent. By default\n *   retrieves controller associated with the `ngController` directive. If `name` is provided as\n *   camelCase directive name, then the controller for this directive will be retrieved (e.g.\n *   `'ngModel'`).\n * - `injector()` - retrieves the injector of the current element or its parent.\n * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current\n *   element or its parent.\n * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the\n *   current element. This getter should be used only on elements that contain a directive which starts a new isolate\n *   scope. Calling `scope()` on this element always returns the original non-isolate scope.\n * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top\n *   parent element is reached.\n *\n * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.\n * @returns {Object} jQuery object.\n */\n\nJQLite.expando = 'ng339';\n\nvar jqCache = JQLite.cache = {},\n    jqId = 1,\n    addEventListenerFn = (window.document.addEventListener\n      ? function(element, type, fn) {element.addEventListener(type, fn, false);}\n      : function(element, type, fn) {element.attachEvent('on' + type, fn);}),\n    removeEventListenerFn = (window.document.removeEventListener\n      ? function(element, type, fn) {element.removeEventListener(type, fn, false); }\n      : function(element, type, fn) {element.detachEvent('on' + type, fn); });\n\n/*\n * !!! This is an undocumented \"private\" function !!!\n */\nvar jqData = JQLite._data = function(node) {\n  //jQuery always returns an object on cache miss\n  return this.cache[node[this.expando]] || {};\n};\n\nfunction jqNextId() { return ++jqId; }\n\n\nvar SPECIAL_CHARS_REGEXP = /([\\:\\-\\_]+(.))/g;\nvar MOZ_HACK_REGEXP = /^moz([A-Z])/;\nvar jqLiteMinErr = minErr('jqLite');\n\n/**\n * Converts snake_case to camelCase.\n * Also there is special case for Moz prefix starting with upper case letter.\n * @param name Name to normalize\n */\nfunction camelCase(name) {\n  return name.\n    replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {\n      return offset ? letter.toUpperCase() : letter;\n    }).\n    replace(MOZ_HACK_REGEXP, 'Moz$1');\n}\n\n/////////////////////////////////////////////\n// jQuery mutation patch\n//\n// In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a\n// $destroy event on all DOM nodes being removed.\n//\n/////////////////////////////////////////////\n\nfunction jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) {\n  var originalJqFn = jQuery.fn[name];\n  originalJqFn = originalJqFn.$original || originalJqFn;\n  removePatch.$original = originalJqFn;\n  jQuery.fn[name] = removePatch;\n\n  function removePatch(param) {\n    // jshint -W040\n    var list = filterElems && param ? [this.filter(param)] : [this],\n        fireEvent = dispatchThis,\n        set, setIndex, setLength,\n        element, childIndex, childLength, children;\n\n    if (!getterIfNoArguments || param != null) {\n      while(list.length) {\n        set = list.shift();\n        for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) {\n          element = jqLite(set[setIndex]);\n          if (fireEvent) {\n            element.triggerHandler('$destroy');\n          } else {\n            fireEvent = !fireEvent;\n          }\n          for(childIndex = 0, childLength = (children = element.children()).length;\n              childIndex < childLength;\n              childIndex++) {\n            list.push(jQuery(children[childIndex]));\n          }\n        }\n      }\n    }\n    return originalJqFn.apply(this, arguments);\n  }\n}\n\nvar SINGLE_TAG_REGEXP = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/;\nvar HTML_REGEXP = /<|&#?\\w+;/;\nvar TAG_NAME_REGEXP = /<([\\w:]+)/;\nvar XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/gi;\n\nvar wrapMap = {\n  'option': [1, '<select multiple=\"multiple\">', '</select>'],\n\n  'thead': [1, '<table>', '</table>'],\n  'col': [2, '<table><colgroup>', '</colgroup></table>'],\n  'tr': [2, '<table><tbody>', '</tbody></table>'],\n  'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],\n  '_default': [0, \"\", \"\"]\n};\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\nfunction jqLiteIsTextNode(html) {\n  return !HTML_REGEXP.test(html);\n}\n\nfunction jqLiteBuildFragment(html, context) {\n  var elem, tmp, tag, wrap,\n      fragment = context.createDocumentFragment(),\n      nodes = [], i, j, jj;\n\n  if (jqLiteIsTextNode(html)) {\n    // Convert non-html into a text node\n    nodes.push(context.createTextNode(html));\n  } else {\n    tmp = fragment.appendChild(context.createElement('div'));\n    // Convert html into DOM nodes\n    tag = (TAG_NAME_REGEXP.exec(html) || [\"\", \"\"])[1].toLowerCase();\n    wrap = wrapMap[tag] || wrapMap._default;\n    tmp.innerHTML = '<div>&#160;</div>' +\n      wrap[1] + html.replace(XHTML_TAG_REGEXP, \"<$1></$2>\") + wrap[2];\n    tmp.removeChild(tmp.firstChild);\n\n    // Descend through wrappers to the right content\n    i = wrap[0];\n    while (i--) {\n      tmp = tmp.lastChild;\n    }\n\n    for (j=0, jj=tmp.childNodes.length; j<jj; ++j) nodes.push(tmp.childNodes[j]);\n\n    tmp = fragment.firstChild;\n    tmp.textContent = \"\";\n  }\n\n  // Remove wrapper from fragment\n  fragment.textContent = \"\";\n  fragment.innerHTML = \"\"; // Clear inner HTML\n  return nodes;\n}\n\nfunction jqLiteParseHTML(html, context) {\n  context = context || document;\n  var parsed;\n\n  if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {\n    return [context.createElement(parsed[1])];\n  }\n\n  return jqLiteBuildFragment(html, context);\n}\n\n/////////////////////////////////////////////\nfunction JQLite(element) {\n  if (element instanceof JQLite) {\n    return element;\n  }\n  if (isString(element)) {\n    element = trim(element);\n  }\n  if (!(this instanceof JQLite)) {\n    if (isString(element) && element.charAt(0) != '<') {\n      throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');\n    }\n    return new JQLite(element);\n  }\n\n  if (isString(element)) {\n    jqLiteAddNodes(this, jqLiteParseHTML(element));\n    var fragment = jqLite(document.createDocumentFragment());\n    fragment.append(this);\n  } else {\n    jqLiteAddNodes(this, element);\n  }\n}\n\nfunction jqLiteClone(element) {\n  return element.cloneNode(true);\n}\n\nfunction jqLiteDealoc(element){\n  jqLiteRemoveData(element);\n  for ( var i = 0, children = element.childNodes || []; i < children.length; i++) {\n    jqLiteDealoc(children[i]);\n  }\n}\n\nfunction jqLiteOff(element, type, fn, unsupported) {\n  if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');\n\n  var events = jqLiteExpandoStore(element, 'events'),\n      handle = jqLiteExpandoStore(element, 'handle');\n\n  if (!handle) return; //no listeners registered\n\n  if (isUndefined(type)) {\n    forEach(events, function(eventHandler, type) {\n      removeEventListenerFn(element, type, eventHandler);\n      delete events[type];\n    });\n  } else {\n    forEach(type.split(' '), function(type) {\n      if (isUndefined(fn)) {\n        removeEventListenerFn(element, type, events[type]);\n        delete events[type];\n      } else {\n        arrayRemove(events[type] || [], fn);\n      }\n    });\n  }\n}\n\nfunction jqLiteRemoveData(element, name) {\n  var expandoId = element.ng339,\n      expandoStore = jqCache[expandoId];\n\n  if (expandoStore) {\n    if (name) {\n      delete jqCache[expandoId].data[name];\n      return;\n    }\n\n    if (expandoStore.handle) {\n      expandoStore.events.$destroy && expandoStore.handle({}, '$destroy');\n      jqLiteOff(element);\n    }\n    delete jqCache[expandoId];\n    element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it\n  }\n}\n\nfunction jqLiteExpandoStore(element, key, value) {\n  var expandoId = element.ng339,\n      expandoStore = jqCache[expandoId || -1];\n\n  if (isDefined(value)) {\n    if (!expandoStore) {\n      element.ng339 = expandoId = jqNextId();\n      expandoStore = jqCache[expandoId] = {};\n    }\n    expandoStore[key] = value;\n  } else {\n    return expandoStore && expandoStore[key];\n  }\n}\n\nfunction jqLiteData(element, key, value) {\n  var data = jqLiteExpandoStore(element, 'data'),\n      isSetter = isDefined(value),\n      keyDefined = !isSetter && isDefined(key),\n      isSimpleGetter = keyDefined && !isObject(key);\n\n  if (!data && !isSimpleGetter) {\n    jqLiteExpandoStore(element, 'data', data = {});\n  }\n\n  if (isSetter) {\n    data[key] = value;\n  } else {\n    if (keyDefined) {\n      if (isSimpleGetter) {\n        // don't create data in this case.\n        return data && data[key];\n      } else {\n        extend(data, key);\n      }\n    } else {\n      return data;\n    }\n  }\n}\n\nfunction jqLiteHasClass(element, selector) {\n  if (!element.getAttribute) return false;\n  return ((\" \" + (element.getAttribute('class') || '') + \" \").replace(/[\\n\\t]/g, \" \").\n      indexOf( \" \" + selector + \" \" ) > -1);\n}\n\nfunction jqLiteRemoveClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    forEach(cssClasses.split(' '), function(cssClass) {\n      element.setAttribute('class', trim(\n          (\" \" + (element.getAttribute('class') || '') + \" \")\n          .replace(/[\\n\\t]/g, \" \")\n          .replace(\" \" + trim(cssClass) + \" \", \" \"))\n      );\n    });\n  }\n}\n\nfunction jqLiteAddClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')\n                            .replace(/[\\n\\t]/g, \" \");\n\n    forEach(cssClasses.split(' '), function(cssClass) {\n      cssClass = trim(cssClass);\n      if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n        existingClasses += cssClass + ' ';\n      }\n    });\n\n    element.setAttribute('class', trim(existingClasses));\n  }\n}\n\nfunction jqLiteAddNodes(root, elements) {\n  if (elements) {\n    elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements))\n      ? elements\n      : [ elements ];\n    for(var i=0; i < elements.length; i++) {\n      root.push(elements[i]);\n    }\n  }\n}\n\nfunction jqLiteController(element, name) {\n  return jqLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller');\n}\n\nfunction jqLiteInheritedData(element, name, value) {\n  // if element is the document object work with the html element instead\n  // this makes $(document).scope() possible\n  if(element.nodeType == 9) {\n    element = element.documentElement;\n  }\n  var names = isArray(name) ? name : [name];\n\n  while (element) {\n    for (var i = 0, ii = names.length; i < ii; i++) {\n      if ((value = jqLite.data(element, names[i])) !== undefined) return value;\n    }\n\n    // If dealing with a document fragment node with a host element, and no parent, use the host\n    // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM\n    // to lookup parent controllers.\n    element = element.parentNode || (element.nodeType === 11 && element.host);\n  }\n}\n\nfunction jqLiteEmpty(element) {\n  for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {\n    jqLiteDealoc(childNodes[i]);\n  }\n  while (element.firstChild) {\n    element.removeChild(element.firstChild);\n  }\n}\n\n//////////////////////////////////////////\n// Functions which are declared directly.\n//////////////////////////////////////////\nvar JQLitePrototype = JQLite.prototype = {\n  ready: function(fn) {\n    var fired = false;\n\n    function trigger() {\n      if (fired) return;\n      fired = true;\n      fn();\n    }\n\n    // check if document already is loaded\n    if (document.readyState === 'complete'){\n      setTimeout(trigger);\n    } else {\n      this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9\n      // we can not use jqLite since we are not done loading and jQuery could be loaded later.\n      // jshint -W064\n      JQLite(window).on('load', trigger); // fallback to window.onload for others\n      // jshint +W064\n    }\n  },\n  toString: function() {\n    var value = [];\n    forEach(this, function(e){ value.push('' + e);});\n    return '[' + value.join(', ') + ']';\n  },\n\n  eq: function(index) {\n      return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);\n  },\n\n  length: 0,\n  push: push,\n  sort: [].sort,\n  splice: [].splice\n};\n\n//////////////////////////////////////////\n// Functions iterating getter/setters.\n// these functions return self on setter and\n// value on get.\n//////////////////////////////////////////\nvar BOOLEAN_ATTR = {};\nforEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {\n  BOOLEAN_ATTR[lowercase(value)] = value;\n});\nvar BOOLEAN_ELEMENTS = {};\nforEach('input,select,option,textarea,button,form,details'.split(','), function(value) {\n  BOOLEAN_ELEMENTS[uppercase(value)] = true;\n});\n\nfunction getBooleanAttrName(element, name) {\n  // check dom last since we will most likely fail on name\n  var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];\n\n  // booleanAttr is here twice to minimize DOM access\n  return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr;\n}\n\nforEach({\n  data: jqLiteData,\n  removeData: jqLiteRemoveData\n}, function(fn, name) {\n  JQLite[name] = fn;\n});\n\nforEach({\n  data: jqLiteData,\n  inheritedData: jqLiteInheritedData,\n\n  scope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);\n  },\n\n  isolateScope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');\n  },\n\n  controller: jqLiteController,\n\n  injector: function(element) {\n    return jqLiteInheritedData(element, '$injector');\n  },\n\n  removeAttr: function(element,name) {\n    element.removeAttribute(name);\n  },\n\n  hasClass: jqLiteHasClass,\n\n  css: function(element, name, value) {\n    name = camelCase(name);\n\n    if (isDefined(value)) {\n      element.style[name] = value;\n    } else {\n      var val;\n\n      if (msie <= 8) {\n        // this is some IE specific weirdness that jQuery 1.6.4 does not sure why\n        val = element.currentStyle && element.currentStyle[name];\n        if (val === '') val = 'auto';\n      }\n\n      val = val || element.style[name];\n\n      if (msie <= 8) {\n        // jquery weirdness :-/\n        val = (val === '') ? undefined : val;\n      }\n\n      return  val;\n    }\n  },\n\n  attr: function(element, name, value){\n    var lowercasedName = lowercase(name);\n    if (BOOLEAN_ATTR[lowercasedName]) {\n      if (isDefined(value)) {\n        if (!!value) {\n          element[name] = true;\n          element.setAttribute(name, lowercasedName);\n        } else {\n          element[name] = false;\n          element.removeAttribute(lowercasedName);\n        }\n      } else {\n        return (element[name] ||\n                 (element.attributes.getNamedItem(name)|| noop).specified)\n               ? lowercasedName\n               : undefined;\n      }\n    } else if (isDefined(value)) {\n      element.setAttribute(name, value);\n    } else if (element.getAttribute) {\n      // the extra argument \"2\" is to get the right thing for a.href in IE, see jQuery code\n      // some elements (e.g. Document) don't have get attribute, so return undefined\n      var ret = element.getAttribute(name, 2);\n      // normalize non-existing attributes to undefined (as jQuery)\n      return ret === null ? undefined : ret;\n    }\n  },\n\n  prop: function(element, name, value) {\n    if (isDefined(value)) {\n      element[name] = value;\n    } else {\n      return element[name];\n    }\n  },\n\n  text: (function() {\n    var NODE_TYPE_TEXT_PROPERTY = [];\n    if (msie < 9) {\n      NODE_TYPE_TEXT_PROPERTY[1] = 'innerText';    /** Element **/\n      NODE_TYPE_TEXT_PROPERTY[3] = 'nodeValue';    /** Text **/\n    } else {\n      NODE_TYPE_TEXT_PROPERTY[1] =                 /** Element **/\n      NODE_TYPE_TEXT_PROPERTY[3] = 'textContent';  /** Text **/\n    }\n    getText.$dv = '';\n    return getText;\n\n    function getText(element, value) {\n      var textProp = NODE_TYPE_TEXT_PROPERTY[element.nodeType];\n      if (isUndefined(value)) {\n        return textProp ? element[textProp] : '';\n      }\n      element[textProp] = value;\n    }\n  })(),\n\n  val: function(element, value) {\n    if (isUndefined(value)) {\n      if (nodeName_(element) === 'SELECT' && element.multiple) {\n        var result = [];\n        forEach(element.options, function (option) {\n          if (option.selected) {\n            result.push(option.value || option.text);\n          }\n        });\n        return result.length === 0 ? null : result;\n      }\n      return element.value;\n    }\n    element.value = value;\n  },\n\n  html: function(element, value) {\n    if (isUndefined(value)) {\n      return element.innerHTML;\n    }\n    for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {\n      jqLiteDealoc(childNodes[i]);\n    }\n    element.innerHTML = value;\n  },\n\n  empty: jqLiteEmpty\n}, function(fn, name){\n  /**\n   * Properties: writes return selection, reads return first value\n   */\n  JQLite.prototype[name] = function(arg1, arg2) {\n    var i, key;\n    var nodeCount = this.length;\n\n    // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it\n    // in a way that survives minification.\n    // jqLiteEmpty takes no arguments but is a setter.\n    if (fn !== jqLiteEmpty &&\n        (((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined)) {\n      if (isObject(arg1)) {\n\n        // we are a write, but the object properties are the key/values\n        for (i = 0; i < nodeCount; i++) {\n          if (fn === jqLiteData) {\n            // data() takes the whole object in jQuery\n            fn(this[i], arg1);\n          } else {\n            for (key in arg1) {\n              fn(this[i], key, arg1[key]);\n            }\n          }\n        }\n        // return self for chaining\n        return this;\n      } else {\n        // we are a read, so read the first child.\n        // TODO: do we still need this?\n        var value = fn.$dv;\n        // Only if we have $dv do we iterate over all, otherwise it is just the first element.\n        var jj = (value === undefined) ? Math.min(nodeCount, 1) : nodeCount;\n        for (var j = 0; j < jj; j++) {\n          var nodeValue = fn(this[j], arg1, arg2);\n          value = value ? value + nodeValue : nodeValue;\n        }\n        return value;\n      }\n    } else {\n      // we are a write, so apply to all children\n      for (i = 0; i < nodeCount; i++) {\n        fn(this[i], arg1, arg2);\n      }\n      // return self for chaining\n      return this;\n    }\n  };\n});\n\nfunction createEventHandler(element, events) {\n  var eventHandler = function (event, type) {\n    if (!event.preventDefault) {\n      event.preventDefault = function() {\n        event.returnValue = false; //ie\n      };\n    }\n\n    if (!event.stopPropagation) {\n      event.stopPropagation = function() {\n        event.cancelBubble = true; //ie\n      };\n    }\n\n    if (!event.target) {\n      event.target = event.srcElement || document;\n    }\n\n    if (isUndefined(event.defaultPrevented)) {\n      var prevent = event.preventDefault;\n      event.preventDefault = function() {\n        event.defaultPrevented = true;\n        prevent.call(event);\n      };\n      event.defaultPrevented = false;\n    }\n\n    event.isDefaultPrevented = function() {\n      return event.defaultPrevented || event.returnValue === false;\n    };\n\n    // Copy event handlers in case event handlers array is modified during execution.\n    var eventHandlersCopy = shallowCopy(events[type || event.type] || []);\n\n    forEach(eventHandlersCopy, function(fn) {\n      fn.call(element, event);\n    });\n\n    // Remove monkey-patched methods (IE),\n    // as they would cause memory leaks in IE8.\n    if (msie <= 8) {\n      // IE7/8 does not allow to delete property on native object\n      event.preventDefault = null;\n      event.stopPropagation = null;\n      event.isDefaultPrevented = null;\n    } else {\n      // It shouldn't affect normal browsers (native methods are defined on prototype).\n      delete event.preventDefault;\n      delete event.stopPropagation;\n      delete event.isDefaultPrevented;\n    }\n  };\n  eventHandler.elem = element;\n  return eventHandler;\n}\n\n//////////////////////////////////////////\n// Functions iterating traversal.\n// These functions chain results into a single\n// selector.\n//////////////////////////////////////////\nforEach({\n  removeData: jqLiteRemoveData,\n\n  dealoc: jqLiteDealoc,\n\n  on: function onFn(element, type, fn, unsupported){\n    if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');\n\n    var events = jqLiteExpandoStore(element, 'events'),\n        handle = jqLiteExpandoStore(element, 'handle');\n\n    if (!events) jqLiteExpandoStore(element, 'events', events = {});\n    if (!handle) jqLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events));\n\n    forEach(type.split(' '), function(type){\n      var eventFns = events[type];\n\n      if (!eventFns) {\n        if (type == 'mouseenter' || type == 'mouseleave') {\n          var contains = document.body.contains || document.body.compareDocumentPosition ?\n          function( a, b ) {\n            // jshint bitwise: false\n            var adown = a.nodeType === 9 ? a.documentElement : a,\n            bup = b && b.parentNode;\n            return a === bup || !!( bup && bup.nodeType === 1 && (\n              adown.contains ?\n              adown.contains( bup ) :\n              a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n              ));\n            } :\n            function( a, b ) {\n              if ( b ) {\n                while ( (b = b.parentNode) ) {\n                  if ( b === a ) {\n                    return true;\n                  }\n                }\n              }\n              return false;\n            };\n\n          events[type] = [];\n\n          // Refer to jQuery's implementation of mouseenter & mouseleave\n          // Read about mouseenter and mouseleave:\n          // http://www.quirksmode.org/js/events_mouse.html#link8\n          var eventmap = { mouseleave : \"mouseout\", mouseenter : \"mouseover\"};\n\n          onFn(element, eventmap[type], function(event) {\n            var target = this, related = event.relatedTarget;\n            // For mousenter/leave call the handler if related is outside the target.\n            // NB: No relatedTarget if the mouse left/entered the browser window\n            if ( !related || (related !== target && !contains(target, related)) ){\n              handle(event, type);\n            }\n          });\n\n        } else {\n          addEventListenerFn(element, type, handle);\n          events[type] = [];\n        }\n        eventFns = events[type];\n      }\n      eventFns.push(fn);\n    });\n  },\n\n  off: jqLiteOff,\n\n  one: function(element, type, fn) {\n    element = jqLite(element);\n\n    //add the listener twice so that when it is called\n    //you can remove the original function and still be\n    //able to call element.off(ev, fn) normally\n    element.on(type, function onFn() {\n      element.off(type, fn);\n      element.off(type, onFn);\n    });\n    element.on(type, fn);\n  },\n\n  replaceWith: function(element, replaceNode) {\n    var index, parent = element.parentNode;\n    jqLiteDealoc(element);\n    forEach(new JQLite(replaceNode), function(node){\n      if (index) {\n        parent.insertBefore(node, index.nextSibling);\n      } else {\n        parent.replaceChild(node, element);\n      }\n      index = node;\n    });\n  },\n\n  children: function(element) {\n    var children = [];\n    forEach(element.childNodes, function(element){\n      if (element.nodeType === 1)\n        children.push(element);\n    });\n    return children;\n  },\n\n  contents: function(element) {\n    return element.contentDocument || element.childNodes || [];\n  },\n\n  append: function(element, node) {\n    forEach(new JQLite(node), function(child){\n      if (element.nodeType === 1 || element.nodeType === 11) {\n        element.appendChild(child);\n      }\n    });\n  },\n\n  prepend: function(element, node) {\n    if (element.nodeType === 1) {\n      var index = element.firstChild;\n      forEach(new JQLite(node), function(child){\n        element.insertBefore(child, index);\n      });\n    }\n  },\n\n  wrap: function(element, wrapNode) {\n    wrapNode = jqLite(wrapNode)[0];\n    var parent = element.parentNode;\n    if (parent) {\n      parent.replaceChild(wrapNode, element);\n    }\n    wrapNode.appendChild(element);\n  },\n\n  remove: function(element) {\n    jqLiteDealoc(element);\n    var parent = element.parentNode;\n    if (parent) parent.removeChild(element);\n  },\n\n  after: function(element, newElement) {\n    var index = element, parent = element.parentNode;\n    forEach(new JQLite(newElement), function(node){\n      parent.insertBefore(node, index.nextSibling);\n      index = node;\n    });\n  },\n\n  addClass: jqLiteAddClass,\n  removeClass: jqLiteRemoveClass,\n\n  toggleClass: function(element, selector, condition) {\n    if (selector) {\n      forEach(selector.split(' '), function(className){\n        var classCondition = condition;\n        if (isUndefined(classCondition)) {\n          classCondition = !jqLiteHasClass(element, className);\n        }\n        (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);\n      });\n    }\n  },\n\n  parent: function(element) {\n    var parent = element.parentNode;\n    return parent && parent.nodeType !== 11 ? parent : null;\n  },\n\n  next: function(element) {\n    if (element.nextElementSibling) {\n      return element.nextElementSibling;\n    }\n\n    // IE8 doesn't have nextElementSibling\n    var elm = element.nextSibling;\n    while (elm != null && elm.nodeType !== 1) {\n      elm = elm.nextSibling;\n    }\n    return elm;\n  },\n\n  find: function(element, selector) {\n    if (element.getElementsByTagName) {\n      return element.getElementsByTagName(selector);\n    } else {\n      return [];\n    }\n  },\n\n  clone: jqLiteClone,\n\n  triggerHandler: function(element, event, extraParameters) {\n\n    var dummyEvent, eventFnsCopy, handlerArgs;\n    var eventName = event.type || event;\n    var eventFns = (jqLiteExpandoStore(element, 'events') || {})[eventName];\n\n    if (eventFns) {\n\n      // Create a dummy event to pass to the handlers\n      dummyEvent = {\n        preventDefault: function() { this.defaultPrevented = true; },\n        isDefaultPrevented: function() { return this.defaultPrevented === true; },\n        stopPropagation: noop,\n        type: eventName,\n        target: element\n      };\n\n      // If a custom event was provided then extend our dummy event with it\n      if (event.type) {\n        dummyEvent = extend(dummyEvent, event);\n      }\n\n      // Copy event handlers in case event handlers array is modified during execution.\n      eventFnsCopy = shallowCopy(eventFns);\n      handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];\n\n      forEach(eventFnsCopy, function(fn) {\n        fn.apply(element, handlerArgs);\n      });\n\n    }\n  }\n}, function(fn, name){\n  /**\n   * chaining functions\n   */\n  JQLite.prototype[name] = function(arg1, arg2, arg3) {\n    var value;\n    for(var i=0; i < this.length; i++) {\n      if (isUndefined(value)) {\n        value = fn(this[i], arg1, arg2, arg3);\n        if (isDefined(value)) {\n          // any function which returns a value needs to be wrapped\n          value = jqLite(value);\n        }\n      } else {\n        jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));\n      }\n    }\n    return isDefined(value) ? value : this;\n  };\n\n  // bind legacy bind/unbind to on/off\n  JQLite.prototype.bind = JQLite.prototype.on;\n  JQLite.prototype.unbind = JQLite.prototype.off;\n});\n\n/**\n * Computes a hash of an 'obj'.\n * Hash of a:\n *  string is string\n *  number is number as string\n *  object is either result of calling $$hashKey function on the object or uniquely generated id,\n *         that is also assigned to the $$hashKey property of the object.\n *\n * @param obj\n * @returns {string} hash string such that the same input will have the same hash string.\n *         The resulting string key is in 'type:hashKey' format.\n */\nfunction hashKey(obj, nextUidFn) {\n  var objType = typeof obj,\n      key;\n\n  if (objType == 'function' || (objType == 'object' && obj !== null)) {\n    if (typeof (key = obj.$$hashKey) == 'function') {\n      // must invoke on object to keep the right this\n      key = obj.$$hashKey();\n    } else if (key === undefined) {\n      key = obj.$$hashKey = (nextUidFn || nextUid)();\n    }\n  } else {\n    key = obj;\n  }\n\n  return objType + ':' + key;\n}\n\n/**\n * HashMap which can use objects as keys\n */\nfunction HashMap(array, isolatedUid) {\n  if (isolatedUid) {\n    var uid = 0;\n    this.nextUid = function() {\n      return ++uid;\n    };\n  }\n  forEach(array, this.put, this);\n}\nHashMap.prototype = {\n  /**\n   * Store key value pair\n   * @param key key to store can be any type\n   * @param value value to store can be any type\n   */\n  put: function(key, value) {\n    this[hashKey(key, this.nextUid)] = value;\n  },\n\n  /**\n   * @param key\n   * @returns {Object} the value for the key\n   */\n  get: function(key) {\n    return this[hashKey(key, this.nextUid)];\n  },\n\n  /**\n   * Remove the key/value pair\n   * @param key\n   */\n  remove: function(key) {\n    var value = this[key = hashKey(key, this.nextUid)];\n    delete this[key];\n    return value;\n  }\n};\n\n/**\n * @ngdoc function\n * @module ng\n * @name angular.injector\n * @kind function\n *\n * @description\n * Creates an injector function that can be used for retrieving services as well as for\n * dependency injection (see {@link guide/di dependency injection}).\n *\n\n * @param {Array.<string|Function>} modules A list of module functions or their aliases. See\n *        {@link angular.module}. The `ng` module must be explicitly added.\n * @returns {function()} Injector function. See {@link auto.$injector $injector}.\n *\n * @example\n * Typical usage\n * ```js\n *   // create an injector\n *   var $injector = angular.injector(['ng']);\n *\n *   // use the injector to kick off your application\n *   // use the type inference to auto inject arguments, or use implicit injection\n *   $injector.invoke(function($rootScope, $compile, $document){\n *     $compile($document)($rootScope);\n *     $rootScope.$digest();\n *   });\n * ```\n *\n * Sometimes you want to get access to the injector of a currently running Angular app\n * from outside Angular. Perhaps, you want to inject and compile some markup after the\n * application has been bootstrapped. You can do this using the extra `injector()` added\n * to JQuery/jqLite elements. See {@link angular.element}.\n *\n * *This is fairly rare but could be the case if a third party library is injecting the\n * markup.*\n *\n * In the following example a new block of HTML containing a `ng-controller`\n * directive is added to the end of the document body by JQuery. We then compile and link\n * it into the current AngularJS scope.\n *\n * ```js\n * var $div = $('<div ng-controller=\"MyCtrl\">{{content.label}}</div>');\n * $(document.body).append($div);\n *\n * angular.element(document).injector().invoke(function($compile) {\n *   var scope = angular.element($div).scope();\n *   $compile($div)(scope);\n * });\n * ```\n */\n\n\n/**\n * @ngdoc module\n * @name auto\n * @description\n *\n * Implicit module which gets automatically added to each {@link auto.$injector $injector}.\n */\n\nvar FN_ARGS = /^function\\s*[^\\(]*\\(\\s*([^\\)]*)\\)/m;\nvar FN_ARG_SPLIT = /,/;\nvar FN_ARG = /^\\s*(_?)(\\S+?)\\1\\s*$/;\nvar STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nvar $injectorMinErr = minErr('$injector');\nfunction annotate(fn) {\n  var $inject,\n      fnText,\n      argDecl,\n      last;\n\n  if (typeof fn === 'function') {\n    if (!($inject = fn.$inject)) {\n      $inject = [];\n      if (fn.length) {\n        fnText = fn.toString().replace(STRIP_COMMENTS, '');\n        argDecl = fnText.match(FN_ARGS);\n        forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){\n          arg.replace(FN_ARG, function(all, underscore, name){\n            $inject.push(name);\n          });\n        });\n      }\n      fn.$inject = $inject;\n    }\n  } else if (isArray(fn)) {\n    last = fn.length - 1;\n    assertArgFn(fn[last], 'fn');\n    $inject = fn.slice(0, last);\n  } else {\n    assertArgFn(fn, 'fn', true);\n  }\n  return $inject;\n}\n\n///////////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $injector\n * @kind function\n *\n * @description\n *\n * `$injector` is used to retrieve object instances as defined by\n * {@link auto.$provide provider}, instantiate types, invoke methods,\n * and load modules.\n *\n * The following always holds true:\n *\n * ```js\n *   var $injector = angular.injector();\n *   expect($injector.get('$injector')).toBe($injector);\n *   expect($injector.invoke(function($injector){\n *     return $injector;\n *   }).toBe($injector);\n * ```\n *\n * # Injection Function Annotation\n *\n * JavaScript does not have annotations, and annotations are needed for dependency injection. The\n * following are all valid ways of annotating function with injection arguments and are equivalent.\n *\n * ```js\n *   // inferred (only works if code not minified/obfuscated)\n *   $injector.invoke(function(serviceA){});\n *\n *   // annotated\n *   function explicit(serviceA) {};\n *   explicit.$inject = ['serviceA'];\n *   $injector.invoke(explicit);\n *\n *   // inline\n *   $injector.invoke(['serviceA', function(serviceA){}]);\n * ```\n *\n * ## Inference\n *\n * In JavaScript calling `toString()` on a function returns the function definition. The definition\n * can then be parsed and the function arguments can be extracted. *NOTE:* This does not work with\n * minification, and obfuscation tools since these tools change the argument names.\n *\n * ## `$inject` Annotation\n * By adding an `$inject` property onto a function the injection parameters can be specified.\n *\n * ## Inline\n * As an array of injection names, where the last item in the array is the function to call.\n */\n\n/**\n * @ngdoc method\n * @name $injector#get\n *\n * @description\n * Return an instance of the service.\n *\n * @param {string} name The name of the instance to retrieve.\n * @return {*} The instance.\n */\n\n/**\n * @ngdoc method\n * @name $injector#invoke\n *\n * @description\n * Invoke the method and supply the method arguments from the `$injector`.\n *\n * @param {!Function} fn The function to invoke. Function parameters are injected according to the\n *   {@link guide/di $inject Annotation} rules.\n * @param {Object=} self The `this` for the invoked method.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n *                         object first, before the `$injector` is consulted.\n * @returns {*} the value returned by the invoked `fn` function.\n */\n\n/**\n * @ngdoc method\n * @name $injector#has\n *\n * @description\n * Allows the user to query if the particular service exists.\n *\n * @param {string} Name of the service to query.\n * @returns {boolean} returns true if injector has given service.\n */\n\n/**\n * @ngdoc method\n * @name $injector#instantiate\n * @description\n * Create a new instance of JS type. The method takes a constructor function, invokes the new\n * operator, and supplies all of the arguments to the constructor function as specified by the\n * constructor annotation.\n *\n * @param {Function} Type Annotated constructor function.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n * object first, before the `$injector` is consulted.\n * @returns {Object} new instance of `Type`.\n */\n\n/**\n * @ngdoc method\n * @name $injector#annotate\n *\n * @description\n * Returns an array of service names which the function is requesting for injection. This API is\n * used by the injector to determine which services need to be injected into the function when the\n * function is invoked. There are three ways in which the function can be annotated with the needed\n * dependencies.\n *\n * # Argument names\n *\n * The simplest form is to extract the dependencies from the arguments of the function. This is done\n * by converting the function into a string using `toString()` method and extracting the argument\n * names.\n * ```js\n *   // Given\n *   function MyController($scope, $route) {\n *     // ...\n *   }\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * This method does not work with code minification / obfuscation. For this reason the following\n * annotation strategies are supported.\n *\n * # The `$inject` property\n *\n * If a function has an `$inject` property and its value is an array of strings, then the strings\n * represent names of services to be injected into the function.\n * ```js\n *   // Given\n *   var MyController = function(obfuscatedScope, obfuscatedRoute) {\n *     // ...\n *   }\n *   // Define function dependencies\n *   MyController['$inject'] = ['$scope', '$route'];\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * # The array notation\n *\n * It is often desirable to inline Injected functions and that's when setting the `$inject` property\n * is very inconvenient. In these situations using the array notation to specify the dependencies in\n * a way that survives minification is a better choice:\n *\n * ```js\n *   // We wish to write this (not minification / obfuscation safe)\n *   injector.invoke(function($compile, $rootScope) {\n *     // ...\n *   });\n *\n *   // We are forced to write break inlining\n *   var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {\n *     // ...\n *   };\n *   tmpFn.$inject = ['$compile', '$rootScope'];\n *   injector.invoke(tmpFn);\n *\n *   // To better support inline function the inline annotation is supported\n *   injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {\n *     // ...\n *   }]);\n *\n *   // Therefore\n *   expect(injector.annotate(\n *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])\n *    ).toEqual(['$compile', '$rootScope']);\n * ```\n *\n * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to\n * be retrieved as described above.\n *\n * @returns {Array.<string>} The names of the services which the function requires.\n */\n\n\n\n\n/**\n * @ngdoc service\n * @name $provide\n *\n * @description\n *\n * The {@link auto.$provide $provide} service has a number of methods for registering components\n * with the {@link auto.$injector $injector}. Many of these functions are also exposed on\n * {@link angular.Module}.\n *\n * An Angular **service** is a singleton object created by a **service factory**.  These **service\n * factories** are functions which, in turn, are created by a **service provider**.\n * The **service providers** are constructor functions. When instantiated they must contain a\n * property called `$get`, which holds the **service factory** function.\n *\n * When you request a service, the {@link auto.$injector $injector} is responsible for finding the\n * correct **service provider**, instantiating it and then calling its `$get` **service factory**\n * function to get the instance of the **service**.\n *\n * Often services have no configuration options and there is no need to add methods to the service\n * provider.  The provider will be no more than a constructor function with a `$get` property. For\n * these cases the {@link auto.$provide $provide} service has additional helper methods to register\n * services without specifying a provider.\n *\n * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the\n *     {@link auto.$injector $injector}\n * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by\n *     providers and services.\n * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by\n *     services, not providers.\n * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,\n *     that will be wrapped in a **service provider** object, whose `$get` property will contain the\n *     given factory function.\n * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`\n *     that will be wrapped in a **service provider** object, whose `$get` property will instantiate\n *      a new object using the given constructor function.\n *\n * See the individual methods for more information and examples.\n */\n\n/**\n * @ngdoc method\n * @name $provide#provider\n * @description\n *\n * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions\n * are constructor functions, whose instances are responsible for \"providing\" a factory for a\n * service.\n *\n * Service provider names start with the name of the service they provide followed by `Provider`.\n * For example, the {@link ng.$log $log} service has a provider called\n * {@link ng.$logProvider $logProvider}.\n *\n * Service provider objects can have additional methods which allow configuration of the provider\n * and its service. Importantly, you can configure what kind of service is created by the `$get`\n * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a\n * method {@link ng.$logProvider#debugEnabled debugEnabled}\n * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the\n * console or not.\n *\n * @param {string} name The name of the instance. NOTE: the provider will be available under `name +\n                        'Provider'` key.\n * @param {(Object|function())} provider If the provider is:\n *\n *   - `Object`: then it should have a `$get` method. The `$get` method will be invoked using\n *     {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.\n *   - `Constructor`: a new instance of the provider will be created using\n *     {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.\n *\n * @returns {Object} registered provider instance\n\n * @example\n *\n * The following example shows how to create a simple event tracking service and register it using\n * {@link auto.$provide#provider $provide.provider()}.\n *\n * ```js\n *  // Define the eventTracker provider\n *  function EventTrackerProvider() {\n *    var trackingUrl = '/track';\n *\n *    // A provider method for configuring where the tracked events should been saved\n *    this.setTrackingUrl = function(url) {\n *      trackingUrl = url;\n *    };\n *\n *    // The service factory function\n *    this.$get = ['$http', function($http) {\n *      var trackedEvents = {};\n *      return {\n *        // Call this to track an event\n *        event: function(event) {\n *          var count = trackedEvents[event] || 0;\n *          count += 1;\n *          trackedEvents[event] = count;\n *          return count;\n *        },\n *        // Call this to save the tracked events to the trackingUrl\n *        save: function() {\n *          $http.post(trackingUrl, trackedEvents);\n *        }\n *      };\n *    }];\n *  }\n *\n *  describe('eventTracker', function() {\n *    var postSpy;\n *\n *    beforeEach(module(function($provide) {\n *      // Register the eventTracker provider\n *      $provide.provider('eventTracker', EventTrackerProvider);\n *    }));\n *\n *    beforeEach(module(function(eventTrackerProvider) {\n *      // Configure eventTracker provider\n *      eventTrackerProvider.setTrackingUrl('/custom-track');\n *    }));\n *\n *    it('tracks events', inject(function(eventTracker) {\n *      expect(eventTracker.event('login')).toEqual(1);\n *      expect(eventTracker.event('login')).toEqual(2);\n *    }));\n *\n *    it('saves to the tracking url', inject(function(eventTracker, $http) {\n *      postSpy = spyOn($http, 'post');\n *      eventTracker.event('login');\n *      eventTracker.save();\n *      expect(postSpy).toHaveBeenCalled();\n *      expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');\n *      expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');\n *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });\n *    }));\n *  });\n * ```\n */\n\n/**\n * @ngdoc method\n * @name $provide#factory\n * @description\n *\n * Register a **service factory**, which will be called to return the service instance.\n * This is short for registering a service where its provider consists of only a `$get` property,\n * which is the given service factory function.\n * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to\n * configure your service in a provider.\n *\n * @param {string} name The name of the instance.\n * @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand\n *                            for `$provide.provider(name, {$get: $getFn})`.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service\n * ```js\n *   $provide.factory('ping', ['$http', function($http) {\n *     return function ping() {\n *       return $http.send('/ping');\n *     };\n *   }]);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#service\n * @description\n *\n * Register a **service constructor**, which will be invoked with `new` to create the service\n * instance.\n * This is short for registering a service where its provider's `$get` property is the service\n * constructor function that will be used to instantiate the service instance.\n *\n * You should use {@link auto.$provide#service $provide.service(class)} if you define your service\n * as a type/class.\n *\n * @param {string} name The name of the instance.\n * @param {Function} constructor A class (constructor function) that will be instantiated.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service using\n * {@link auto.$provide#service $provide.service(class)}.\n * ```js\n *   var Ping = function($http) {\n *     this.$http = $http;\n *   };\n *\n *   Ping.$inject = ['$http'];\n *\n *   Ping.prototype.send = function() {\n *     return this.$http.get('/ping');\n *   };\n *   $provide.service('ping', Ping);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping.send();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#value\n * @description\n *\n * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a\n * number, an array, an object or a function.  This is short for registering a service where its\n * provider's `$get` property is a factory function that takes no arguments and returns the **value\n * service**.\n *\n * Value services are similar to constant services, except that they cannot be injected into a\n * module configuration function (see {@link angular.Module#config}) but they can be overridden by\n * an Angular\n * {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the instance.\n * @param {*} value The value.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here are some examples of creating value services.\n * ```js\n *   $provide.value('ADMIN_USER', 'admin');\n *\n *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });\n *\n *   $provide.value('halfOf', function(value) {\n *     return value / 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#constant\n * @description\n *\n * Register a **constant service**, such as a string, a number, an array, an object or a function,\n * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be\n * injected into a module configuration function (see {@link angular.Module#config}) and it cannot\n * be overridden by an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the constant.\n * @param {*} value The constant value.\n * @returns {Object} registered instance\n *\n * @example\n * Here a some examples of creating constants:\n * ```js\n *   $provide.constant('SHARD_HEIGHT', 306);\n *\n *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);\n *\n *   $provide.constant('double', function(value) {\n *     return value * 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#decorator\n * @description\n *\n * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator\n * intercepts the creation of a service, allowing it to override or modify the behaviour of the\n * service. The object returned by the decorator may be the original service, or a new service\n * object which replaces or wraps and delegates to the original service.\n *\n * @param {string} name The name of the service to decorate.\n * @param {function()} decorator This function will be invoked when the service needs to be\n *    instantiated and should return the decorated service instance. The function is called using\n *    the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.\n *    Local injection arguments:\n *\n *    * `$delegate` - The original service instance, which can be monkey patched, configured,\n *      decorated or delegated to.\n *\n * @example\n * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting\n * calls to {@link ng.$log#error $log.warn()}.\n * ```js\n *   $provide.decorator('$log', ['$delegate', function($delegate) {\n *     $delegate.warn = $delegate.error;\n *     return $delegate;\n *   }]);\n * ```\n */\n\n\nfunction createInjector(modulesToLoad) {\n  var INSTANTIATING = {},\n      providerSuffix = 'Provider',\n      path = [],\n      loadedModules = new HashMap([], true),\n      providerCache = {\n        $provide: {\n            provider: supportObject(provider),\n            factory: supportObject(factory),\n            service: supportObject(service),\n            value: supportObject(value),\n            constant: supportObject(constant),\n            decorator: decorator\n          }\n      },\n      providerInjector = (providerCache.$injector =\n          createInternalInjector(providerCache, function() {\n            throw $injectorMinErr('unpr', \"Unknown provider: {0}\", path.join(' <- '));\n          })),\n      instanceCache = {},\n      instanceInjector = (instanceCache.$injector =\n          createInternalInjector(instanceCache, function(servicename) {\n            var provider = providerInjector.get(servicename + providerSuffix);\n            return instanceInjector.invoke(provider.$get, provider);\n          }));\n\n\n  forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); });\n\n  return instanceInjector;\n\n  ////////////////////////////////////\n  // $provider\n  ////////////////////////////////////\n\n  function supportObject(delegate) {\n    return function(key, value) {\n      if (isObject(key)) {\n        forEach(key, reverseParams(delegate));\n      } else {\n        return delegate(key, value);\n      }\n    };\n  }\n\n  function provider(name, provider_) {\n    assertNotHasOwnProperty(name, 'service');\n    if (isFunction(provider_) || isArray(provider_)) {\n      provider_ = providerInjector.instantiate(provider_);\n    }\n    if (!provider_.$get) {\n      throw $injectorMinErr('pget', \"Provider '{0}' must define $get factory method.\", name);\n    }\n    return providerCache[name + providerSuffix] = provider_;\n  }\n\n  function factory(name, factoryFn) { return provider(name, { $get: factoryFn }); }\n\n  function service(name, constructor) {\n    return factory(name, ['$injector', function($injector) {\n      return $injector.instantiate(constructor);\n    }]);\n  }\n\n  function value(name, val) { return factory(name, valueFn(val)); }\n\n  function constant(name, value) {\n    assertNotHasOwnProperty(name, 'constant');\n    providerCache[name] = value;\n    instanceCache[name] = value;\n  }\n\n  function decorator(serviceName, decorFn) {\n    var origProvider = providerInjector.get(serviceName + providerSuffix),\n        orig$get = origProvider.$get;\n\n    origProvider.$get = function() {\n      var origInstance = instanceInjector.invoke(orig$get, origProvider);\n      return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});\n    };\n  }\n\n  ////////////////////////////////////\n  // Module Loading\n  ////////////////////////////////////\n  function loadModules(modulesToLoad){\n    var runBlocks = [], moduleFn, invokeQueue, i, ii;\n    forEach(modulesToLoad, function(module) {\n      if (loadedModules.get(module)) return;\n      loadedModules.put(module, true);\n\n      try {\n        if (isString(module)) {\n          moduleFn = angularModule(module);\n          runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);\n\n          for(invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {\n            var invokeArgs = invokeQueue[i],\n                provider = providerInjector.get(invokeArgs[0]);\n\n            provider[invokeArgs[1]].apply(provider, invokeArgs[2]);\n          }\n        } else if (isFunction(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else if (isArray(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else {\n          assertArgFn(module, 'module');\n        }\n      } catch (e) {\n        if (isArray(module)) {\n          module = module[module.length - 1];\n        }\n        if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {\n          // Safari & FF's stack traces don't contain error.message content\n          // unlike those of Chrome and IE\n          // So if stack doesn't contain message, we create a new string that contains both.\n          // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.\n          /* jshint -W022 */\n          e = e.message + '\\n' + e.stack;\n        }\n        throw $injectorMinErr('modulerr', \"Failed to instantiate module {0} due to:\\n{1}\",\n                  module, e.stack || e.message || e);\n      }\n    });\n    return runBlocks;\n  }\n\n  ////////////////////////////////////\n  // internal Injector\n  ////////////////////////////////////\n\n  function createInternalInjector(cache, factory) {\n\n    function getService(serviceName) {\n      if (cache.hasOwnProperty(serviceName)) {\n        if (cache[serviceName] === INSTANTIATING) {\n          throw $injectorMinErr('cdep', 'Circular dependency found: {0}',\n                    serviceName + ' <- ' + path.join(' <- '));\n        }\n        return cache[serviceName];\n      } else {\n        try {\n          path.unshift(serviceName);\n          cache[serviceName] = INSTANTIATING;\n          return cache[serviceName] = factory(serviceName);\n        } catch (err) {\n          if (cache[serviceName] === INSTANTIATING) {\n            delete cache[serviceName];\n          }\n          throw err;\n        } finally {\n          path.shift();\n        }\n      }\n    }\n\n    function invoke(fn, self, locals){\n      var args = [],\n          $inject = annotate(fn),\n          length, i,\n          key;\n\n      for(i = 0, length = $inject.length; i < length; i++) {\n        key = $inject[i];\n        if (typeof key !== 'string') {\n          throw $injectorMinErr('itkn',\n                  'Incorrect injection token! Expected service name as string, got {0}', key);\n        }\n        args.push(\n          locals && locals.hasOwnProperty(key)\n          ? locals[key]\n          : getService(key)\n        );\n      }\n      if (isArray(fn)) {\n        fn = fn[length];\n      }\n\n      // http://jsperf.com/angularjs-invoke-apply-vs-switch\n      // #5388\n      return fn.apply(self, args);\n    }\n\n    function instantiate(Type, locals) {\n      var Constructor = function() {},\n          instance, returnedValue;\n\n      // Check if Type is annotated and use just the given function at n-1 as parameter\n      // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);\n      Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;\n      instance = new Constructor();\n      returnedValue = invoke(Type, instance, locals);\n\n      return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance;\n    }\n\n    return {\n      invoke: invoke,\n      instantiate: instantiate,\n      get: getService,\n      annotate: annotate,\n      has: function(name) {\n        return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);\n      }\n    };\n  }\n}\n\n/**\n * @ngdoc service\n * @name $anchorScroll\n * @kind function\n * @requires $window\n * @requires $location\n * @requires $rootScope\n *\n * @description\n * When called, it checks current value of `$location.hash()` and scrolls to the related element,\n * according to rules specified in\n * [Html5 spec](http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document).\n *\n * It also watches the `$location.hash()` and scrolls whenever it changes to match any anchor.\n * This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <div id=\"scrollArea\" ng-controller=\"ScrollCtrl\">\n         <a ng-click=\"gotoBottom()\">Go to bottom</a>\n         <a id=\"bottom\"></a> You're at the bottom!\n       </div>\n     </file>\n     <file name=\"script.js\">\n       function ScrollCtrl($scope, $location, $anchorScroll) {\n         $scope.gotoBottom = function (){\n           // set the location.hash to the id of\n           // the element you wish to scroll to.\n           $location.hash('bottom');\n\n           // call $anchorScroll()\n           $anchorScroll();\n         };\n       }\n     </file>\n     <file name=\"style.css\">\n       #scrollArea {\n         height: 350px;\n         overflow: auto;\n       }\n\n       #bottom {\n         display: block;\n         margin-top: 2000px;\n       }\n     </file>\n   </example>\n */\nfunction $AnchorScrollProvider() {\n\n  var autoScrollingEnabled = true;\n\n  this.disableAutoScrolling = function() {\n    autoScrollingEnabled = false;\n  };\n\n  this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {\n    var document = $window.document;\n\n    // helper function to get first anchor from a NodeList\n    // can't use filter.filter, as it accepts only instances of Array\n    // and IE can't convert NodeList to an array using [].slice\n    // TODO(vojta): use filter if we change it to accept lists as well\n    function getFirstAnchor(list) {\n      var result = null;\n      forEach(list, function(element) {\n        if (!result && lowercase(element.nodeName) === 'a') result = element;\n      });\n      return result;\n    }\n\n    function scroll() {\n      var hash = $location.hash(), elm;\n\n      // empty hash, scroll to the top of the page\n      if (!hash) $window.scrollTo(0, 0);\n\n      // element with given id\n      else if ((elm = document.getElementById(hash))) elm.scrollIntoView();\n\n      // first anchor with given name :-D\n      else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();\n\n      // no element and hash == 'top', scroll to the top of the page\n      else if (hash === 'top') $window.scrollTo(0, 0);\n    }\n\n    // does not scroll when user clicks on anchor link that is currently on\n    // (no url change, no $location.hash() change), browser native does scroll\n    if (autoScrollingEnabled) {\n      $rootScope.$watch(function autoScrollWatch() {return $location.hash();},\n        function autoScrollWatchAction() {\n          $rootScope.$evalAsync(scroll);\n        });\n    }\n\n    return scroll;\n  }];\n}\n\nvar $animateMinErr = minErr('$animate');\n\n/**\n * @ngdoc provider\n * @name $animateProvider\n *\n * @description\n * Default implementation of $animate that doesn't perform any animations, instead just\n * synchronously performs DOM\n * updates and calls done() callbacks.\n *\n * In order to enable animations the ngAnimate module has to be loaded.\n *\n * To see the functional implementation check out src/ngAnimate/animate.js\n */\nvar $AnimateProvider = ['$provide', function($provide) {\n\n\n  this.$$selectors = {};\n\n\n  /**\n   * @ngdoc method\n   * @name $animateProvider#register\n   *\n   * @description\n   * Registers a new injectable animation factory function. The factory function produces the\n   * animation object which contains callback functions for each event that is expected to be\n   * animated.\n   *\n   *   * `eventFn`: `function(Element, doneFunction)` The element to animate, the `doneFunction`\n   *   must be called once the element animation is complete. If a function is returned then the\n   *   animation service will use this function to cancel the animation whenever a cancel event is\n   *   triggered.\n   *\n   *\n   * ```js\n   *   return {\n     *     eventFn : function(element, done) {\n     *       //code to run the animation\n     *       //once complete, then run done()\n     *       return function cancellationFunction() {\n     *         //code to cancel the animation\n     *       }\n     *     }\n     *   }\n   * ```\n   *\n   * @param {string} name The name of the animation.\n   * @param {Function} factory The factory function that will be executed to return the animation\n   *                           object.\n   */\n  this.register = function(name, factory) {\n    var key = name + '-animation';\n    if (name && name.charAt(0) != '.') throw $animateMinErr('notcsel',\n        \"Expecting class selector starting with '.' got '{0}'.\", name);\n    this.$$selectors[name.substr(1)] = key;\n    $provide.factory(key, factory);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $animateProvider#classNameFilter\n   *\n   * @description\n   * Sets and/or returns the CSS class regular expression that is checked when performing\n   * an animation. Upon bootstrap the classNameFilter value is not set at all and will\n   * therefore enable $animate to attempt to perform an animation on any element.\n   * When setting the classNameFilter value, animations will only be performed on elements\n   * that successfully match the filter expression. This in turn can boost performance\n   * for low-powered devices as well as applications containing a lot of structural operations.\n   * @param {RegExp=} expression The className expression which will be checked against all animations\n   * @return {RegExp} The current CSS className expression value. If null then there is no expression value\n   */\n  this.classNameFilter = function(expression) {\n    if(arguments.length === 1) {\n      this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;\n    }\n    return this.$$classNameFilter;\n  };\n\n  this.$get = ['$timeout', '$$asyncCallback', function($timeout, $$asyncCallback) {\n\n    function async(fn) {\n      fn && $$asyncCallback(fn);\n    }\n\n    /**\n     *\n     * @ngdoc service\n     * @name $animate\n     * @description The $animate service provides rudimentary DOM manipulation functions to\n     * insert, remove and move elements within the DOM, as well as adding and removing classes.\n     * This service is the core service used by the ngAnimate $animator service which provides\n     * high-level animation hooks for CSS and JavaScript.\n     *\n     * $animate is available in the AngularJS core, however, the ngAnimate module must be included\n     * to enable full out animation support. Otherwise, $animate will only perform simple DOM\n     * manipulation operations.\n     *\n     * To learn more about enabling animation support, click here to visit the {@link ngAnimate\n     * ngAnimate module page} as well as the {@link ngAnimate.$animate ngAnimate $animate service\n     * page}.\n     */\n    return {\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#enter\n       * @kind function\n       * @description Inserts the element into the DOM either after the `after` element or within\n       *   the `parent` element. Once complete, the done() callback will be fired (if provided).\n       * @param {DOMElement} element the element which will be inserted into the DOM\n       * @param {DOMElement} parent the parent element which will append the element as\n       *   a child (if the after element is not present)\n       * @param {DOMElement} after the sibling element which will append the element\n       *   after itself\n       * @param {Function=} done callback function that will be called after the element has been\n       *   inserted into the DOM\n       */\n      enter : function(element, parent, after, done) {\n        if (after) {\n          after.after(element);\n        } else {\n          if (!parent || !parent[0]) {\n            parent = after.parent();\n          }\n          parent.append(element);\n        }\n        async(done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#leave\n       * @kind function\n       * @description Removes the element from the DOM. Once complete, the done() callback will be\n       *   fired (if provided).\n       * @param {DOMElement} element the element which will be removed from the DOM\n       * @param {Function=} done callback function that will be called after the element has been\n       *   removed from the DOM\n       */\n      leave : function(element, done) {\n        element.remove();\n        async(done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#move\n       * @kind function\n       * @description Moves the position of the provided element within the DOM to be placed\n       * either after the `after` element or inside of the `parent` element. Once complete, the\n       * done() callback will be fired (if provided).\n       *\n       * @param {DOMElement} element the element which will be moved around within the\n       *   DOM\n       * @param {DOMElement} parent the parent element where the element will be\n       *   inserted into (if the after element is not present)\n       * @param {DOMElement} after the sibling element where the element will be\n       *   positioned next to\n       * @param {Function=} done the callback function (if provided) that will be fired after the\n       *   element has been moved to its new position\n       */\n      move : function(element, parent, after, done) {\n        // Do not remove element before insert. Removing will cause data associated with the\n        // element to be dropped. Insert will implicitly do the remove.\n        this.enter(element, parent, after, done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#addClass\n       * @kind function\n       * @description Adds the provided className CSS class value to the provided element. Once\n       * complete, the done() callback will be fired (if provided).\n       * @param {DOMElement} element the element which will have the className value\n       *   added to it\n       * @param {string} className the CSS class which will be added to the element\n       * @param {Function=} done the callback function (if provided) that will be fired after the\n       *   className value has been added to the element\n       */\n      addClass : function(element, className, done) {\n        className = isString(className) ?\n                      className :\n                      isArray(className) ? className.join(' ') : '';\n        forEach(element, function (element) {\n          jqLiteAddClass(element, className);\n        });\n        async(done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#removeClass\n       * @kind function\n       * @description Removes the provided className CSS class value from the provided element.\n       * Once complete, the done() callback will be fired (if provided).\n       * @param {DOMElement} element the element which will have the className value\n       *   removed from it\n       * @param {string} className the CSS class which will be removed from the element\n       * @param {Function=} done the callback function (if provided) that will be fired after the\n       *   className value has been removed from the element\n       */\n      removeClass : function(element, className, done) {\n        className = isString(className) ?\n                      className :\n                      isArray(className) ? className.join(' ') : '';\n        forEach(element, function (element) {\n          jqLiteRemoveClass(element, className);\n        });\n        async(done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#setClass\n       * @kind function\n       * @description Adds and/or removes the given CSS classes to and from the element.\n       * Once complete, the done() callback will be fired (if provided).\n       * @param {DOMElement} element the element which will have its CSS classes changed\n       *   removed from it\n       * @param {string} add the CSS classes which will be added to the element\n       * @param {string} remove the CSS class which will be removed from the element\n       * @param {Function=} done the callback function (if provided) that will be fired after the\n       *   CSS classes have been set on the element\n       */\n      setClass : function(element, add, remove, done) {\n        forEach(element, function (element) {\n          jqLiteAddClass(element, add);\n          jqLiteRemoveClass(element, remove);\n        });\n        async(done);\n      },\n\n      enabled : noop\n    };\n  }];\n}];\n\nfunction $$AsyncCallbackProvider(){\n  this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) {\n    return $$rAF.supported\n      ? function(fn) { return $$rAF(fn); }\n      : function(fn) {\n        return $timeout(fn, 0, false);\n      };\n  }];\n}\n\n/**\n * ! This is a private undocumented service !\n *\n * @name $browser\n * @requires $log\n * @description\n * This object has two goals:\n *\n * - hide all the global state in the browser caused by the window object\n * - abstract away all the browser specific features and inconsistencies\n *\n * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`\n * service, which can be used for convenient testing of the application without the interaction with\n * the real browser apis.\n */\n/**\n * @param {object} window The global window object.\n * @param {object} document jQuery wrapped document.\n * @param {function()} XHR XMLHttpRequest constructor.\n * @param {object} $log console.log or an object with the same interface.\n * @param {object} $sniffer $sniffer service\n */\nfunction Browser(window, document, $log, $sniffer) {\n  var self = this,\n      rawDocument = document[0],\n      location = window.location,\n      history = window.history,\n      setTimeout = window.setTimeout,\n      clearTimeout = window.clearTimeout,\n      pendingDeferIds = {};\n\n  self.isMock = false;\n\n  var outstandingRequestCount = 0;\n  var outstandingRequestCallbacks = [];\n\n  // TODO(vojta): remove this temporary api\n  self.$$completeOutstandingRequest = completeOutstandingRequest;\n  self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };\n\n  /**\n   * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`\n   * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.\n   */\n  function completeOutstandingRequest(fn) {\n    try {\n      fn.apply(null, sliceArgs(arguments, 1));\n    } finally {\n      outstandingRequestCount--;\n      if (outstandingRequestCount === 0) {\n        while(outstandingRequestCallbacks.length) {\n          try {\n            outstandingRequestCallbacks.pop()();\n          } catch (e) {\n            $log.error(e);\n          }\n        }\n      }\n    }\n  }\n\n  /**\n   * @private\n   * Note: this method is used only by scenario runner\n   * TODO(vojta): prefix this method with $$ ?\n   * @param {function()} callback Function that will be called when no outstanding request\n   */\n  self.notifyWhenNoOutstandingRequests = function(callback) {\n    // force browser to execute all pollFns - this is needed so that cookies and other pollers fire\n    // at some deterministic time in respect to the test runner's actions. Leaving things up to the\n    // regular poller would result in flaky tests.\n    forEach(pollFns, function(pollFn){ pollFn(); });\n\n    if (outstandingRequestCount === 0) {\n      callback();\n    } else {\n      outstandingRequestCallbacks.push(callback);\n    }\n  };\n\n  //////////////////////////////////////////////////////////////\n  // Poll Watcher API\n  //////////////////////////////////////////////////////////////\n  var pollFns = [],\n      pollTimeout;\n\n  /**\n   * @name $browser#addPollFn\n   *\n   * @param {function()} fn Poll function to add\n   *\n   * @description\n   * Adds a function to the list of functions that poller periodically executes,\n   * and starts polling if not started yet.\n   *\n   * @returns {function()} the added function\n   */\n  self.addPollFn = function(fn) {\n    if (isUndefined(pollTimeout)) startPoller(100, setTimeout);\n    pollFns.push(fn);\n    return fn;\n  };\n\n  /**\n   * @param {number} interval How often should browser call poll functions (ms)\n   * @param {function()} setTimeout Reference to a real or fake `setTimeout` function.\n   *\n   * @description\n   * Configures the poller to run in the specified intervals, using the specified\n   * setTimeout fn and kicks it off.\n   */\n  function startPoller(interval, setTimeout) {\n    (function check() {\n      forEach(pollFns, function(pollFn){ pollFn(); });\n      pollTimeout = setTimeout(check, interval);\n    })();\n  }\n\n  //////////////////////////////////////////////////////////////\n  // URL API\n  //////////////////////////////////////////////////////////////\n\n  var lastBrowserUrl = location.href,\n      baseElement = document.find('base'),\n      newLocation = null;\n\n  /**\n   * @name $browser#url\n   *\n   * @description\n   * GETTER:\n   * Without any argument, this method just returns current value of location.href.\n   *\n   * SETTER:\n   * With at least one argument, this method sets url to new value.\n   * If html5 history api supported, pushState/replaceState is used, otherwise\n   * location.href/location.replace is used.\n   * Returns its own instance to allow chaining\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to change url.\n   *\n   * @param {string} url New url (when used as setter)\n   * @param {boolean=} replace Should new url replace current history record ?\n   */\n  self.url = function(url, replace) {\n    // Android Browser BFCache causes location, history reference to become stale.\n    if (location !== window.location) location = window.location;\n    if (history !== window.history) history = window.history;\n\n    // setter\n    if (url) {\n      if (lastBrowserUrl == url) return;\n      lastBrowserUrl = url;\n      if ($sniffer.history) {\n        if (replace) history.replaceState(null, '', url);\n        else {\n          history.pushState(null, '', url);\n          // Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462\n          baseElement.attr('href', baseElement.attr('href'));\n        }\n      } else {\n        newLocation = url;\n        if (replace) {\n          location.replace(url);\n        } else {\n          location.href = url;\n        }\n      }\n      return self;\n    // getter\n    } else {\n      // - newLocation is a workaround for an IE7-9 issue with location.replace and location.href\n      //   methods not updating location.href synchronously.\n      // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172\n      return newLocation || location.href.replace(/%27/g,\"'\");\n    }\n  };\n\n  var urlChangeListeners = [],\n      urlChangeInit = false;\n\n  function fireUrlChange() {\n    newLocation = null;\n    if (lastBrowserUrl == self.url()) return;\n\n    lastBrowserUrl = self.url();\n    forEach(urlChangeListeners, function(listener) {\n      listener(self.url());\n    });\n  }\n\n  /**\n   * @name $browser#onUrlChange\n   *\n   * @description\n   * Register callback function that will be called, when url changes.\n   *\n   * It's only called when the url is changed from outside of angular:\n   * - user types different url into address bar\n   * - user clicks on history (forward/back) button\n   * - user clicks on a link\n   *\n   * It's not called when url is changed by $browser.url() method\n   *\n   * The listener gets called with new url as parameter.\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to monitor url changes in angular apps.\n   *\n   * @param {function(string)} listener Listener function to be called when url changes.\n   * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.\n   */\n  self.onUrlChange = function(callback) {\n    // TODO(vojta): refactor to use node's syntax for events\n    if (!urlChangeInit) {\n      // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)\n      // don't fire popstate when user change the address bar and don't fire hashchange when url\n      // changed by push/replaceState\n\n      // html5 history api - popstate event\n      if ($sniffer.history) jqLite(window).on('popstate', fireUrlChange);\n      // hashchange event\n      if ($sniffer.hashchange) jqLite(window).on('hashchange', fireUrlChange);\n      // polling\n      else self.addPollFn(fireUrlChange);\n\n      urlChangeInit = true;\n    }\n\n    urlChangeListeners.push(callback);\n    return callback;\n  };\n\n  /**\n   * Checks whether the url has changed outside of Angular.\n   * Needs to be exported to be able to check for changes that have been done in sync,\n   * as hashchange/popstate events fire in async.\n   */\n  self.$$checkUrlChange = fireUrlChange;\n\n  //////////////////////////////////////////////////////////////\n  // Misc API\n  //////////////////////////////////////////////////////////////\n\n  /**\n   * @name $browser#baseHref\n   *\n   * @description\n   * Returns current <base href>\n   * (always relative - without domain)\n   *\n   * @returns {string} The current base href\n   */\n  self.baseHref = function() {\n    var href = baseElement.attr('href');\n    return href ? href.replace(/^(https?\\:)?\\/\\/[^\\/]*/, '') : '';\n  };\n\n  //////////////////////////////////////////////////////////////\n  // Cookies API\n  //////////////////////////////////////////////////////////////\n  var lastCookies = {};\n  var lastCookieString = '';\n  var cookiePath = self.baseHref();\n\n  /**\n   * @name $browser#cookies\n   *\n   * @param {string=} name Cookie name\n   * @param {string=} value Cookie value\n   *\n   * @description\n   * The cookies method provides a 'private' low level access to browser cookies.\n   * It is not meant to be used directly, use the $cookie service instead.\n   *\n   * The return values vary depending on the arguments that the method was called with as follows:\n   *\n   * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify\n   *   it\n   * - cookies(name, value) -> set name to value, if value is undefined delete the cookie\n   * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that\n   *   way)\n   *\n   * @returns {Object} Hash of all cookies (if called without any parameter)\n   */\n  self.cookies = function(name, value) {\n    /* global escape: false, unescape: false */\n    var cookieLength, cookieArray, cookie, i, index;\n\n    if (name) {\n      if (value === undefined) {\n        rawDocument.cookie = escape(name) + \"=;path=\" + cookiePath +\n                                \";expires=Thu, 01 Jan 1970 00:00:00 GMT\";\n      } else {\n        if (isString(value)) {\n          cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) +\n                                ';path=' + cookiePath).length + 1;\n\n          // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:\n          // - 300 cookies\n          // - 20 cookies per unique domain\n          // - 4096 bytes per cookie\n          if (cookieLength > 4096) {\n            $log.warn(\"Cookie '\"+ name +\n              \"' possibly not set or overflowed because it was too large (\"+\n              cookieLength + \" > 4096 bytes)!\");\n          }\n        }\n      }\n    } else {\n      if (rawDocument.cookie !== lastCookieString) {\n        lastCookieString = rawDocument.cookie;\n        cookieArray = lastCookieString.split(\"; \");\n        lastCookies = {};\n\n        for (i = 0; i < cookieArray.length; i++) {\n          cookie = cookieArray[i];\n          index = cookie.indexOf('=');\n          if (index > 0) { //ignore nameless cookies\n            name = unescape(cookie.substring(0, index));\n            // the first value that is seen for a cookie is the most\n            // specific one.  values for the same cookie name that\n            // follow are for less specific paths.\n            if (lastCookies[name] === undefined) {\n              lastCookies[name] = unescape(cookie.substring(index + 1));\n            }\n          }\n        }\n      }\n      return lastCookies;\n    }\n  };\n\n\n  /**\n   * @name $browser#defer\n   * @param {function()} fn A function, who's execution should be deferred.\n   * @param {number=} [delay=0] of milliseconds to defer the function execution.\n   * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.\n   *\n   * @description\n   * Executes a fn asynchronously via `setTimeout(fn, delay)`.\n   *\n   * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using\n   * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed\n   * via `$browser.defer.flush()`.\n   *\n   */\n  self.defer = function(fn, delay) {\n    var timeoutId;\n    outstandingRequestCount++;\n    timeoutId = setTimeout(function() {\n      delete pendingDeferIds[timeoutId];\n      completeOutstandingRequest(fn);\n    }, delay || 0);\n    pendingDeferIds[timeoutId] = true;\n    return timeoutId;\n  };\n\n\n  /**\n   * @name $browser#defer.cancel\n   *\n   * @description\n   * Cancels a deferred task identified with `deferId`.\n   *\n   * @param {*} deferId Token returned by the `$browser.defer` function.\n   * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n   *                    canceled.\n   */\n  self.defer.cancel = function(deferId) {\n    if (pendingDeferIds[deferId]) {\n      delete pendingDeferIds[deferId];\n      clearTimeout(deferId);\n      completeOutstandingRequest(noop);\n      return true;\n    }\n    return false;\n  };\n\n}\n\nfunction $BrowserProvider(){\n  this.$get = ['$window', '$log', '$sniffer', '$document',\n      function( $window,   $log,   $sniffer,   $document){\n        return new Browser($window, $document, $log, $sniffer);\n      }];\n}\n\n/**\n * @ngdoc service\n * @name $cacheFactory\n *\n * @description\n * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to\n * them.\n *\n * ```js\n *\n *  var cache = $cacheFactory('cacheId');\n *  expect($cacheFactory.get('cacheId')).toBe(cache);\n *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();\n *\n *  cache.put(\"key\", \"value\");\n *  cache.put(\"another key\", \"another value\");\n *\n *  // We've specified no options on creation\n *  expect(cache.info()).toEqual({id: 'cacheId', size: 2});\n *\n * ```\n *\n *\n * @param {string} cacheId Name or id of the newly created cache.\n * @param {object=} options Options object that specifies the cache behavior. Properties:\n *\n *   - `{number=}` `capacity` — turns the cache into LRU cache.\n *\n * @returns {object} Newly created cache object with the following set of methods:\n *\n * - `{object}` `info()` — Returns id, size, and options of cache.\n * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns\n *   it.\n * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.\n * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.\n * - `{void}` `removeAll()` — Removes all cached values.\n * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.\n *\n * @example\n   <example module=\"cacheExampleApp\">\n     <file name=\"index.html\">\n       <div ng-controller=\"CacheController\">\n         <input ng-model=\"newCacheKey\" placeholder=\"Key\">\n         <input ng-model=\"newCacheValue\" placeholder=\"Value\">\n         <button ng-click=\"put(newCacheKey, newCacheValue)\">Cache</button>\n\n         <p ng-if=\"keys.length\">Cached Values</p>\n         <div ng-repeat=\"key in keys\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"cache.get(key)\"></b>\n         </div>\n\n         <p>Cache Info</p>\n         <div ng-repeat=\"(key, value) in cache.info()\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"value\"></b>\n         </div>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('cacheExampleApp', []).\n         controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {\n           $scope.keys = [];\n           $scope.cache = $cacheFactory('cacheId');\n           $scope.put = function(key, value) {\n             if ($scope.cache.get(key) === undefined) {\n               $scope.keys.push(key);\n             }\n             $scope.cache.put(key, value === undefined ? null : value);\n           };\n         }]);\n     </file>\n     <file name=\"style.css\">\n       p {\n         margin: 10px 0 3px;\n       }\n     </file>\n   </example>\n */\nfunction $CacheFactoryProvider() {\n\n  this.$get = function() {\n    var caches = {};\n\n    function cacheFactory(cacheId, options) {\n      if (cacheId in caches) {\n        throw minErr('$cacheFactory')('iid', \"CacheId '{0}' is already taken!\", cacheId);\n      }\n\n      var size = 0,\n          stats = extend({}, options, {id: cacheId}),\n          data = {},\n          capacity = (options && options.capacity) || Number.MAX_VALUE,\n          lruHash = {},\n          freshEnd = null,\n          staleEnd = null;\n\n      /**\n       * @ngdoc type\n       * @name $cacheFactory.Cache\n       *\n       * @description\n       * A cache object used to store and retrieve data, primarily used by\n       * {@link $http $http} and the {@link ng.directive:script script} directive to cache\n       * templates and other data.\n       *\n       * ```js\n       *  angular.module('superCache')\n       *    .factory('superCache', ['$cacheFactory', function($cacheFactory) {\n       *      return $cacheFactory('super-cache');\n       *    }]);\n       * ```\n       *\n       * Example test:\n       *\n       * ```js\n       *  it('should behave like a cache', inject(function(superCache) {\n       *    superCache.put('key', 'value');\n       *    superCache.put('another key', 'another value');\n       *\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 2\n       *    });\n       *\n       *    superCache.remove('another key');\n       *    expect(superCache.get('another key')).toBeUndefined();\n       *\n       *    superCache.removeAll();\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 0\n       *    });\n       *  }));\n       * ```\n       */\n      return caches[cacheId] = {\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#put\n         * @kind function\n         *\n         * @description\n         * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be\n         * retrieved later, and incrementing the size of the cache if the key was not already\n         * present in the cache. If behaving like an LRU cache, it will also remove stale\n         * entries from the set.\n         *\n         * It will not insert undefined values into the cache.\n         *\n         * @param {string} key the key under which the cached data is stored.\n         * @param {*} value the value to store alongside the key. If it is undefined, the key\n         *    will not be stored.\n         * @returns {*} the value stored.\n         */\n        put: function(key, value) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key] || (lruHash[key] = {key: key});\n\n            refresh(lruEntry);\n          }\n\n          if (isUndefined(value)) return;\n          if (!(key in data)) size++;\n          data[key] = value;\n\n          if (size > capacity) {\n            this.remove(staleEnd.key);\n          }\n\n          return value;\n        },\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#get\n         * @kind function\n         *\n         * @description\n         * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the data to be retrieved\n         * @returns {*} the value stored.\n         */\n        get: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            refresh(lruEntry);\n          }\n\n          return data[key];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#remove\n         * @kind function\n         *\n         * @description\n         * Removes an entry from the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the entry to be removed\n         */\n        remove: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            if (lruEntry == freshEnd) freshEnd = lruEntry.p;\n            if (lruEntry == staleEnd) staleEnd = lruEntry.n;\n            link(lruEntry.n,lruEntry.p);\n\n            delete lruHash[key];\n          }\n\n          delete data[key];\n          size--;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#removeAll\n         * @kind function\n         *\n         * @description\n         * Clears the cache object of any entries.\n         */\n        removeAll: function() {\n          data = {};\n          size = 0;\n          lruHash = {};\n          freshEnd = staleEnd = null;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#destroy\n         * @kind function\n         *\n         * @description\n         * Destroys the {@link $cacheFactory.Cache Cache} object entirely,\n         * removing it from the {@link $cacheFactory $cacheFactory} set.\n         */\n        destroy: function() {\n          data = null;\n          stats = null;\n          lruHash = null;\n          delete caches[cacheId];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#info\n         * @kind function\n         *\n         * @description\n         * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.\n         *\n         * @returns {object} an object with the following properties:\n         *   <ul>\n         *     <li>**id**: the id of the cache instance</li>\n         *     <li>**size**: the number of entries kept in the cache instance</li>\n         *     <li>**...**: any additional properties from the options object when creating the\n         *       cache.</li>\n         *   </ul>\n         */\n        info: function() {\n          return extend({}, stats, {size: size});\n        }\n      };\n\n\n      /**\n       * makes the `entry` the freshEnd of the LRU linked list\n       */\n      function refresh(entry) {\n        if (entry != freshEnd) {\n          if (!staleEnd) {\n            staleEnd = entry;\n          } else if (staleEnd == entry) {\n            staleEnd = entry.n;\n          }\n\n          link(entry.n, entry.p);\n          link(entry, freshEnd);\n          freshEnd = entry;\n          freshEnd.n = null;\n        }\n      }\n\n\n      /**\n       * bidirectionally links two entries of the LRU linked list\n       */\n      function link(nextEntry, prevEntry) {\n        if (nextEntry != prevEntry) {\n          if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify\n          if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify\n        }\n      }\n    }\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#info\n   *\n   * @description\n   * Get information about all the caches that have been created\n   *\n   * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`\n   */\n    cacheFactory.info = function() {\n      var info = {};\n      forEach(caches, function(cache, cacheId) {\n        info[cacheId] = cache.info();\n      });\n      return info;\n    };\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#get\n   *\n   * @description\n   * Get access to a cache object by the `cacheId` used when it was created.\n   *\n   * @param {string} cacheId Name or id of a cache to access.\n   * @returns {object} Cache object identified by the cacheId or undefined if no such cache.\n   */\n    cacheFactory.get = function(cacheId) {\n      return caches[cacheId];\n    };\n\n\n    return cacheFactory;\n  };\n}\n\n/**\n * @ngdoc service\n * @name $templateCache\n *\n * @description\n * The first time a template is used, it is loaded in the template cache for quick retrieval. You\n * can load templates directly into the cache in a `script` tag, or by consuming the\n * `$templateCache` service directly.\n *\n * Adding via the `script` tag:\n *\n * ```html\n *   <script type=\"text/ng-template\" id=\"templateId.html\">\n *     <p>This is the content of the template</p>\n *   </script>\n * ```\n *\n * **Note:** the `script` tag containing the template does not need to be included in the `head` of\n * the document, but it must be below the `ng-app` definition.\n *\n * Adding via the $templateCache service:\n *\n * ```js\n * var myApp = angular.module('myApp', []);\n * myApp.run(function($templateCache) {\n *   $templateCache.put('templateId.html', 'This is the content of the template');\n * });\n * ```\n *\n * To retrieve the template later, simply use it in your HTML:\n * ```html\n * <div ng-include=\" 'templateId.html' \"></div>\n * ```\n *\n * or get it via Javascript:\n * ```js\n * $templateCache.get('templateId.html')\n * ```\n *\n * See {@link ng.$cacheFactory $cacheFactory}.\n *\n */\nfunction $TemplateCacheProvider() {\n  this.$get = ['$cacheFactory', function($cacheFactory) {\n    return $cacheFactory('templates');\n  }];\n}\n\n/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!\n *\n * DOM-related variables:\n *\n * - \"node\" - DOM Node\n * - \"element\" - DOM Element or Node\n * - \"$node\" or \"$element\" - jqLite-wrapped node or element\n *\n *\n * Compiler related stuff:\n *\n * - \"linkFn\" - linking fn of a single directive\n * - \"nodeLinkFn\" - function that aggregates all linking fns for a particular node\n * - \"childLinkFn\" -  function that aggregates all linking fns for child nodes of a particular node\n * - \"compositeLinkFn\" - function that aggregates all linking fns for a compilation root (nodeList)\n */\n\n\n/**\n * @ngdoc service\n * @name $compile\n * @kind function\n *\n * @description\n * Compiles an HTML string or DOM into a template and produces a template function, which\n * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.\n *\n * The compilation is a process of walking the DOM tree and matching DOM elements to\n * {@link ng.$compileProvider#directive directives}.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** This document is an in-depth reference of all directive options.\n * For a gentle introduction to directives with examples of common use cases,\n * see the {@link guide/directive directive guide}.\n * </div>\n *\n * ## Comprehensive Directive API\n *\n * There are many different options for a directive.\n *\n * The difference resides in the return value of the factory function.\n * You can either return a \"Directive Definition Object\" (see below) that defines the directive properties,\n * or just the `postLink` function (all other properties will have the default values).\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's recommended to use the \"directive definition object\" form.\n * </div>\n *\n * Here's an example directive declared with a Directive Definition Object:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       priority: 0,\n *       template: '<div></div>', // or // function(tElement, tAttrs) { ... },\n *       // or\n *       // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },\n *       transclude: false,\n *       restrict: 'A',\n *       scope: false,\n *       controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },\n *       controllerAs: 'stringAlias',\n *       require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],\n *       compile: function compile(tElement, tAttrs, transclude) {\n *         return {\n *           pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *           post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *         }\n *         // or\n *         // return function postLink( ... ) { ... }\n *       },\n *       // or\n *       // link: {\n *       //  pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *       //  post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *       // }\n *       // or\n *       // link: function postLink( ... ) { ... }\n *     };\n *     return directiveDefinitionObject;\n *   });\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Any unspecified options will use the default value. You can see the default values below.\n * </div>\n *\n * Therefore the above can be simplified as:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       link: function postLink(scope, iElement, iAttrs) { ... }\n *     };\n *     return directiveDefinitionObject;\n *     // or\n *     // return function postLink(scope, iElement, iAttrs) { ... }\n *   });\n * ```\n *\n *\n *\n * ### Directive Definition Object\n *\n * The directive definition object provides instructions to the {@link ng.$compile\n * compiler}. The attributes are:\n *\n * #### `priority`\n * When there are multiple directives defined on a single DOM element, sometimes it\n * is necessary to specify the order in which the directives are applied. The `priority` is used\n * to sort the directives before their `compile` functions get called. Priority is defined as a\n * number. Directives with greater numerical `priority` are compiled first. Pre-link functions\n * are also run in priority order, but post-link functions are run in reverse order. The order\n * of directives with the same priority is undefined. The default priority is `0`.\n *\n * #### `terminal`\n * If set to true then the current `priority` will be the last set of directives\n * which will execute (any directives at the current priority will still execute\n * as the order of execution on same `priority` is undefined).\n *\n * #### `scope`\n * **If set to `true`,** then a new scope will be created for this directive. If multiple directives on the\n * same element request a new scope, only one new scope is created. The new scope rule does not\n * apply for the root of the template since the root of the template always gets a new scope.\n *\n * **If set to `{}` (object hash),** then a new \"isolate\" scope is created. The 'isolate' scope differs from\n * normal scope in that it does not prototypically inherit from the parent scope. This is useful\n * when creating reusable components, which should not accidentally read or modify data in the\n * parent scope.\n *\n * The 'isolate' scope takes an object hash which defines a set of local scope properties\n * derived from the parent scope. These local properties are useful for aliasing values for\n * templates. Locals definition is a hash of local scope property to its source:\n *\n * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is\n *   always a string since DOM attributes are strings. If no `attr` name is specified  then the\n *   attribute name is assumed to be the same as the local name.\n *   Given `<widget my-attr=\"hello {{name}}\">` and widget definition\n *   of `scope: { localName:'@myAttr' }`, then widget scope property `localName` will reflect\n *   the interpolated value of `hello {{name}}`. As the `name` attribute changes so will the\n *   `localName` property on the widget scope. The `name` is read from the parent scope (not\n *   component scope).\n *\n * * `=` or `=attr` - set up bi-directional binding between a local scope property and the\n *   parent scope property of name defined via the value of the `attr` attribute. If no `attr`\n *   name is specified then the attribute name is assumed to be the same as the local name.\n *   Given `<widget my-attr=\"parentModel\">` and widget definition of\n *   `scope: { localModel:'=myAttr' }`, then widget scope property `localModel` will reflect the\n *   value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected\n *   in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent\n *   scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You\n *   can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional.\n *\n * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope.\n *   If no `attr` name is specified then the attribute name is assumed to be the same as the\n *   local name. Given `<widget my-attr=\"count = count + value\">` and widget definition of\n *   `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to\n *   a function wrapper for the `count = count + value` expression. Often it's desirable to\n *   pass data from the isolated scope via an expression to the parent scope, this can be\n *   done by passing a map of local variable names and values into the expression wrapper fn.\n *   For example, if the expression is `increment(amount)` then we can specify the amount value\n *   by calling the `localFn` as `localFn({amount: 22})`.\n *\n *\n *\n * #### `controller`\n * Controller constructor function. The controller is instantiated before the\n * pre-linking phase and it is shared with other directives (see\n * `require` attribute). This allows the directives to communicate with each other and augment\n * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:\n *\n * * `$scope` - Current scope associated with the element\n * * `$element` - Current element\n * * `$attrs` - Current attributes object for the element\n * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope.\n *    The scope can be overridden by an optional first argument.\n *   `function([scope], cloneLinkingFn)`.\n *\n *\n * #### `require`\n * Require another directive and inject its controller as the fourth argument to the linking function. The\n * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the\n * injected argument will be an array in corresponding order. If no such directive can be\n * found, or if the directive does not have a controller, then an error is raised. The name can be prefixed with:\n *\n * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.\n * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.\n * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.\n * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass\n *   `null` to the `link` fn if not found.\n *\n *\n * #### `controllerAs`\n * Controller alias at the directive scope. An alias for the controller so it\n * can be referenced at the directive template. The directive needs to define a scope for this\n * configuration to be used. Useful in the case when directive is used as component.\n *\n *\n * #### `restrict`\n * String of subset of `EACM` which restricts the directive to a specific directive\n * declaration style. If omitted, the default (attributes only) is used.\n *\n * * `E` - Element name: `<my-directive></my-directive>`\n * * `A` - Attribute (default): `<div my-directive=\"exp\"></div>`\n * * `C` - Class: `<div class=\"my-directive: exp;\"></div>`\n * * `M` - Comment: `<!-- directive: my-directive exp -->`\n *\n *\n * #### `template`\n * HTML markup that may:\n * * Replace the contents of the directive's element (default).\n * * Replace the directive's element itself (if `replace` is true - DEPRECATED).\n * * Wrap the contents of the directive's element (if `transclude` is true).\n *\n * Value may be:\n *\n * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.\n * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`\n *   function api below) and returns a string value.\n *\n *\n * #### `templateUrl`\n * Same as `template` but the template is loaded from the specified URL. Because\n * the template loading is asynchronous the compilation/linking is suspended until the template\n * is loaded.\n *\n * You can specify `templateUrl` as a string representing the URL or as a function which takes two\n * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns\n * a string value representing the url.  In either case, the template URL is passed through {@link\n * api/ng.$sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.\n *\n *\n * #### `replace` ([*DEPRECATED*!], will be removed in next major release)\n * specify what the template should replace. Defaults to `false`.\n *\n * * `true` - the template will replace the directive's element.\n * * `false` - the template will replace the contents of the directive's element.\n *\n * The replacement process migrates all of the attributes / classes from the old element to the new\n * one. See the {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive\n * Directives Guide} for an example.\n *\n * #### `transclude`\n * compile the content of the element and make it available to the directive.\n * Typically used with {@link ng.directive:ngTransclude\n * ngTransclude}. The advantage of transclusion is that the linking function receives a\n * transclusion function which is pre-bound to the correct scope. In a typical setup the widget\n * creates an `isolate` scope, but the transclusion is not a child, but a sibling of the `isolate`\n * scope. This makes it possible for the widget to have private state, and the transclusion to\n * be bound to the parent (pre-`isolate`) scope.\n *\n * * `true` - transclude the content of the directive.\n * * `'element'` - transclude the whole element including any directives defined at lower priority.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** When testing an element transclude directive you must not place the directive at the root of the\n * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives\n * Testing Transclusion Directives}.\n * </div>\n *\n * #### `compile`\n *\n * ```js\n *   function compile(tElement, tAttrs, transclude) { ... }\n * ```\n *\n * The compile function deals with transforming the template DOM. Since most directives do not do\n * template transformation, it is not used often. The compile function takes the following arguments:\n *\n *   * `tElement` - template element - The element where the directive has been declared. It is\n *     safe to do template transformation on the element and child elements only.\n *\n *   * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared\n *     between all directive compile functions.\n *\n *   * `transclude` -  [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`\n *\n * <div class=\"alert alert-warning\">\n * **Note:** The template instance and the link instance may be different objects if the template has\n * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that\n * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration\n * should be done in a linking function rather than in a compile function.\n * </div>\n\n * <div class=\"alert alert-warning\">\n * **Note:** The compile function cannot handle directives that recursively use themselves in their\n * own templates or compile functions. Compiling these directives results in an infinite loop and a\n * stack overflow errors.\n *\n * This can be avoided by manually using $compile in the postLink function to imperatively compile\n * a directive's template instead of relying on automatic template compilation via `template` or\n * `templateUrl` declaration or manual compilation inside the compile function.\n * </div>\n *\n * <div class=\"alert alert-error\">\n * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it\n *   e.g. does not know about the right outer scope. Please use the transclude function that is passed\n *   to the link function instead.\n * </div>\n\n * A compile function can have a return value which can be either a function or an object.\n *\n * * returning a (post-link) function - is equivalent to registering the linking function via the\n *   `link` property of the config object when the compile function is empty.\n *\n * * returning an object with function(s) registered via `pre` and `post` properties - allows you to\n *   control when a linking function should be called during the linking phase. See info about\n *   pre-linking and post-linking functions below.\n *\n *\n * #### `link`\n * This property is used only if the `compile` property is not defined.\n *\n * ```js\n *   function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }\n * ```\n *\n * The link function is responsible for registering DOM listeners as well as updating the DOM. It is\n * executed after the template has been cloned. This is where most of the directive logic will be\n * put.\n *\n *   * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the\n *     directive for registering {@link ng.$rootScope.Scope#$watch watches}.\n *\n *   * `iElement` - instance element - The element where the directive is to be used. It is safe to\n *     manipulate the children of the element only in `postLink` function since the children have\n *     already been linked.\n *\n *   * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared\n *     between all directive linking functions.\n *\n *   * `controller` - a controller instance - A controller instance if at least one directive on the\n *     element defines a controller. The controller is shared among all the directives, which allows\n *     the directives to use the controllers as a communication channel.\n *\n *   * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.\n *     The scope can be overridden by an optional first argument. This is the same as the `$transclude`\n *     parameter of directive controllers.\n *     `function([scope], cloneLinkingFn)`.\n *\n *\n * #### Pre-linking function\n *\n * Executed before the child elements are linked. Not safe to do DOM transformation since the\n * compiler linking function will fail to locate the correct elements for linking.\n *\n * #### Post-linking function\n *\n * Executed after the child elements are linked. It is safe to do DOM transformation in the post-linking function.\n *\n * <a name=\"Attributes\"></a>\n * ### Attributes\n *\n * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the\n * `link()` or `compile()` functions. It has a variety of uses.\n *\n * accessing *Normalized attribute names:*\n * Directives like 'ngBind' can be expressed in many ways: 'ng:bind', `data-ng-bind`, or 'x-ng-bind'.\n * the attributes object allows for normalized access to\n *   the attributes.\n *\n * * *Directive inter-communication:* All directives share the same instance of the attributes\n *   object which allows the directives to use the attributes object as inter directive\n *   communication.\n *\n * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object\n *   allowing other directives to read the interpolated value.\n *\n * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes\n *   that contain interpolation (e.g. `src=\"{{bar}}\"`). Not only is this very efficient but it's also\n *   the only way to easily get the actual value because during the linking phase the interpolation\n *   hasn't been evaluated yet and so the value is at this time set to `undefined`.\n *\n * ```js\n * function linkingFn(scope, elm, attrs, ctrl) {\n *   // get the attribute value\n *   console.log(attrs.ngModel);\n *\n *   // change the attribute\n *   attrs.$set('ngModel', 'new value');\n *\n *   // observe changes to interpolated attribute\n *   attrs.$observe('ngModel', function(value) {\n *     console.log('ngModel has changed value to ' + value);\n *   });\n * }\n * ```\n *\n * Below is an example using `$compileProvider`.\n *\n * <div class=\"alert alert-warning\">\n * **Note**: Typically directives are registered with `module.directive`. The example below is\n * to illustrate how `$compile` works.\n * </div>\n *\n <example module=\"compileExample\">\n   <file name=\"index.html\">\n    <script>\n      angular.module('compileExample', [], function($compileProvider) {\n        // configure new 'compile' directive by passing a directive\n        // factory function. The factory function injects the '$compile'\n        $compileProvider.directive('compile', function($compile) {\n          // directive factory creates a link function\n          return function(scope, element, attrs) {\n            scope.$watch(\n              function(scope) {\n                 // watch the 'compile' expression for changes\n                return scope.$eval(attrs.compile);\n              },\n              function(value) {\n                // when the 'compile' expression changes\n                // assign it into the current DOM\n                element.html(value);\n\n                // compile the new DOM and link it to the current\n                // scope.\n                // NOTE: we only compile .childNodes so that\n                // we don't get into infinite loop compiling ourselves\n                $compile(element.contents())(scope);\n              }\n            );\n          };\n        });\n      })\n      .controller('GreeterController', ['$scope', function($scope) {\n        $scope.name = 'Angular';\n        $scope.html = 'Hello {{name}}';\n      }]);\n    </script>\n    <div ng-controller=\"GreeterController\">\n      <input ng-model=\"name\"> <br>\n      <textarea ng-model=\"html\"></textarea> <br>\n      <div compile=\"html\"></div>\n    </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should auto compile', function() {\n       var textarea = $('textarea');\n       var output = $('div[compile]');\n       // The initial state reads 'Hello Angular'.\n       expect(output.getText()).toBe('Hello Angular');\n       textarea.clear();\n       textarea.sendKeys('{{name}}!');\n       expect(output.getText()).toBe('Angular!');\n     });\n   </file>\n </example>\n\n *\n *\n * @param {string|DOMElement} element Element or HTML string to compile into a template function.\n * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives.\n * @param {number} maxPriority only apply directives lower than given priority (Only effects the\n *                 root element(s), not their children)\n * @returns {function(scope, cloneAttachFn=)} a link function which is used to bind template\n * (a DOM element/tree) to a scope. Where:\n *\n *  * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.\n *  * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the\n *  `template` and call the `cloneAttachFn` function allowing the caller to attach the\n *  cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is\n *  called as: <br> `cloneAttachFn(clonedElement, scope)` where:\n *\n *      * `clonedElement` - is a clone of the original `element` passed into the compiler.\n *      * `scope` - is the current scope with which the linking function is working with.\n *\n * Calling the linking function returns the element of the template. It is either the original\n * element passed in, or the clone of the element if the `cloneAttachFn` is provided.\n *\n * After linking the view is not updated until after a call to $digest which typically is done by\n * Angular automatically.\n *\n * If you need access to the bound view, there are two ways to do it:\n *\n * - If you are not asking the linking function to clone the template, create the DOM element(s)\n *   before you send them to the compiler and keep this reference around.\n *   ```js\n *     var element = $compile('<p>{{total}}</p>')(scope);\n *   ```\n *\n * - if on the other hand, you need the element to be cloned, the view reference from the original\n *   example would not point to the clone, but rather to the original template that was cloned. In\n *   this case, you can access the clone via the cloneAttachFn:\n *   ```js\n *     var templateElement = angular.element('<p>{{total}}</p>'),\n *         scope = ....;\n *\n *     var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {\n *       //attach the clone to DOM document at the right place\n *     });\n *\n *     //now we have reference to the cloned DOM via `clonedElement`\n *   ```\n *\n *\n * For information on how the compiler works, see the\n * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.\n */\n\nvar $compileMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $compileProvider\n * @kind function\n *\n * @description\n */\n$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];\nfunction $CompileProvider($provide, $$sanitizeUriProvider) {\n  var hasDirectives = {},\n      Suffix = 'Directive',\n      COMMENT_DIRECTIVE_REGEXP = /^\\s*directive\\:\\s*([\\d\\w_\\-]+)\\s+(.*)$/,\n      CLASS_DIRECTIVE_REGEXP = /(([\\d\\w_\\-]+)(?:\\:([^;]+))?;?)/;\n\n  // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes\n  // The assumption is that future DOM event attribute names will begin with\n  // 'on' and be composed of only English letters.\n  var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#directive\n   * @kind function\n   *\n   * @description\n   * Register a new directive with the compiler.\n   *\n   * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which\n   *    will match as <code>ng-bind</code>), or an object map of directives where the keys are the\n   *    names and the values are the factories.\n   * @param {Function|Array} directiveFactory An injectable directive factory function. See\n   *    {@link guide/directive} for more info.\n   * @returns {ng.$compileProvider} Self for chaining.\n   */\n   this.directive = function registerDirective(name, directiveFactory) {\n    assertNotHasOwnProperty(name, 'directive');\n    if (isString(name)) {\n      assertArg(directiveFactory, 'directiveFactory');\n      if (!hasDirectives.hasOwnProperty(name)) {\n        hasDirectives[name] = [];\n        $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',\n          function($injector, $exceptionHandler) {\n            var directives = [];\n            forEach(hasDirectives[name], function(directiveFactory, index) {\n              try {\n                var directive = $injector.invoke(directiveFactory);\n                if (isFunction(directive)) {\n                  directive = { compile: valueFn(directive) };\n                } else if (!directive.compile && directive.link) {\n                  directive.compile = valueFn(directive.link);\n                }\n                directive.priority = directive.priority || 0;\n                directive.index = index;\n                directive.name = directive.name || name;\n                directive.require = directive.require || (directive.controller && directive.name);\n                directive.restrict = directive.restrict || 'A';\n                directives.push(directive);\n              } catch (e) {\n                $exceptionHandler(e);\n              }\n            });\n            return directives;\n          }]);\n      }\n      hasDirectives[name].push(directiveFactory);\n    } else {\n      forEach(name, reverseParams(registerDirective));\n    }\n    return this;\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#aHrefSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.aHrefSanitizationWhitelist();\n    }\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#imgSrcSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();\n    }\n  };\n\n  this.$get = [\n            '$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',\n            '$controller', '$rootScope', '$document', '$sce', '$animate', '$$sanitizeUri',\n    function($injector,   $interpolate,   $exceptionHandler,   $http,   $templateCache,   $parse,\n             $controller,   $rootScope,   $document,   $sce,   $animate,   $$sanitizeUri) {\n\n    var Attributes = function(element, attr) {\n      this.$$element = element;\n      this.$attr = attr || {};\n    };\n\n    Attributes.prototype = {\n      $normalize: directiveNormalize,\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$addClass\n       * @kind function\n       *\n       * @description\n       * Adds the CSS class value specified by the classVal parameter to the element. If animations\n       * are enabled then an animation will be triggered for the class addition.\n       *\n       * @param {string} classVal The className value that will be added to the element\n       */\n      $addClass : function(classVal) {\n        if(classVal && classVal.length > 0) {\n          $animate.addClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$removeClass\n       * @kind function\n       *\n       * @description\n       * Removes the CSS class value specified by the classVal parameter from the element. If\n       * animations are enabled then an animation will be triggered for the class removal.\n       *\n       * @param {string} classVal The className value that will be removed from the element\n       */\n      $removeClass : function(classVal) {\n        if(classVal && classVal.length > 0) {\n          $animate.removeClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$updateClass\n       * @kind function\n       *\n       * @description\n       * Adds and removes the appropriate CSS class values to the element based on the difference\n       * between the new and old CSS class values (specified as newClasses and oldClasses).\n       *\n       * @param {string} newClasses The current CSS className value\n       * @param {string} oldClasses The former CSS className value\n       */\n      $updateClass : function(newClasses, oldClasses) {\n        var toAdd = tokenDifference(newClasses, oldClasses);\n        var toRemove = tokenDifference(oldClasses, newClasses);\n\n        if(toAdd.length === 0) {\n          $animate.removeClass(this.$$element, toRemove);\n        } else if(toRemove.length === 0) {\n          $animate.addClass(this.$$element, toAdd);\n        } else {\n          $animate.setClass(this.$$element, toAdd, toRemove);\n        }\n      },\n\n      /**\n       * Set a normalized attribute on the element in a way such that all directives\n       * can share the attribute. This function properly handles boolean attributes.\n       * @param {string} key Normalized key. (ie ngAttribute)\n       * @param {string|boolean} value The value to set. If `null` attribute will be deleted.\n       * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.\n       *     Defaults to true.\n       * @param {string=} attrName Optional none normalized name. Defaults to key.\n       */\n      $set: function(key, value, writeAttr, attrName) {\n        // TODO: decide whether or not to throw an error if \"class\"\n        //is set through this function since it may cause $updateClass to\n        //become unstable.\n\n        var booleanKey = getBooleanAttrName(this.$$element[0], key),\n            normalizedVal,\n            nodeName;\n\n        if (booleanKey) {\n          this.$$element.prop(key, value);\n          attrName = booleanKey;\n        }\n\n        this[key] = value;\n\n        // translate normalized key to actual key\n        if (attrName) {\n          this.$attr[key] = attrName;\n        } else {\n          attrName = this.$attr[key];\n          if (!attrName) {\n            this.$attr[key] = attrName = snake_case(key, '-');\n          }\n        }\n\n        nodeName = nodeName_(this.$$element);\n\n        // sanitize a[href] and img[src] values\n        if ((nodeName === 'A' && key === 'href') ||\n            (nodeName === 'IMG' && key === 'src')) {\n          this[key] = value = $$sanitizeUri(value, key === 'src');\n        }\n\n        if (writeAttr !== false) {\n          if (value === null || value === undefined) {\n            this.$$element.removeAttr(attrName);\n          } else {\n            this.$$element.attr(attrName, value);\n          }\n        }\n\n        // fire observers\n        var $$observers = this.$$observers;\n        $$observers && forEach($$observers[key], function(fn) {\n          try {\n            fn(value);\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        });\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$observe\n       * @kind function\n       *\n       * @description\n       * Observes an interpolated attribute.\n       *\n       * The observer function will be invoked once during the next `$digest` following\n       * compilation. The observer is then invoked whenever the interpolated value\n       * changes.\n       *\n       * @param {string} key Normalized key. (ie ngAttribute) .\n       * @param {function(interpolatedValue)} fn Function that will be called whenever\n                the interpolated value of the attribute changes.\n       *        See the {@link guide/directive#Attributes Directives} guide for more info.\n       * @returns {function()} the `fn` parameter.\n       */\n      $observe: function(key, fn) {\n        var attrs = this,\n            $$observers = (attrs.$$observers || (attrs.$$observers = {})),\n            listeners = ($$observers[key] || ($$observers[key] = []));\n\n        listeners.push(fn);\n        $rootScope.$evalAsync(function() {\n          if (!listeners.$$inter) {\n            // no one registered attribute interpolation function, so lets call it manually\n            fn(attrs[key]);\n          }\n        });\n        return fn;\n      }\n    };\n\n    var startSymbol = $interpolate.startSymbol(),\n        endSymbol = $interpolate.endSymbol(),\n        denormalizeTemplate = (startSymbol == '{{' || endSymbol  == '}}')\n            ? identity\n            : function denormalizeTemplate(template) {\n              return template.replace(/\\{\\{/g, startSymbol).replace(/}}/g, endSymbol);\n        },\n        NG_ATTR_BINDING = /^ngAttr[A-Z]/;\n\n\n    return compile;\n\n    //================================\n\n    function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,\n                        previousCompileContext) {\n      if (!($compileNodes instanceof jqLite)) {\n        // jquery always rewraps, whereas we need to preserve the original selector so that we can\n        // modify it.\n        $compileNodes = jqLite($compileNodes);\n      }\n      // We can not compile top level text elements since text nodes can be merged and we will\n      // not be able to attach scope data to them, so we will wrap them in <span>\n      forEach($compileNodes, function(node, index){\n        if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\\S+/) /* non-empty */ ) {\n          $compileNodes[index] = node = jqLite(node).wrap('<span></span>').parent()[0];\n        }\n      });\n      var compositeLinkFn =\n              compileNodes($compileNodes, transcludeFn, $compileNodes,\n                           maxPriority, ignoreDirective, previousCompileContext);\n      safeAddClass($compileNodes, 'ng-scope');\n      return function publicLinkFn(scope, cloneConnectFn, transcludeControllers, parentBoundTranscludeFn){\n        assertArg(scope, 'scope');\n        // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart\n        // and sometimes changes the structure of the DOM.\n        var $linkNode = cloneConnectFn\n          ? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!\n          : $compileNodes;\n\n        forEach(transcludeControllers, function(instance, name) {\n          $linkNode.data('$' + name + 'Controller', instance);\n        });\n\n        // Attach scope only to non-text nodes.\n        for(var i = 0, ii = $linkNode.length; i<ii; i++) {\n          var node = $linkNode[i],\n              nodeType = node.nodeType;\n          if (nodeType === 1 /* element */ || nodeType === 9 /* document */) {\n            $linkNode.eq(i).data('$scope', scope);\n          }\n        }\n\n        if (cloneConnectFn) cloneConnectFn($linkNode, scope);\n        if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);\n        return $linkNode;\n      };\n    }\n\n    function safeAddClass($element, className) {\n      try {\n        $element.addClass(className);\n      } catch(e) {\n        // ignore, since it means that we are trying to set class on\n        // SVG element, where class name is read-only.\n      }\n    }\n\n    /**\n     * Compile function matches each node in nodeList against the directives. Once all directives\n     * for a particular node are collected their compile functions are executed. The compile\n     * functions return values - the linking functions - are combined into a composite linking\n     * function, which is the a linking function for the node.\n     *\n     * @param {NodeList} nodeList an array of nodes or NodeList to compile\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *        scope argument is auto-generated to the new child of the transcluded parent scope.\n     * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then\n     *        the rootElement must be set the jqLite collection of the compile root. This is\n     *        needed so that the jqLite collection items can be replaced with widgets.\n     * @param {number=} maxPriority Max directive priority.\n     * @returns {Function} A composite linking function of all of the matched directives or null.\n     */\n    function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,\n                            previousCompileContext) {\n      var linkFns = [],\n          attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound;\n\n      for (var i = 0; i < nodeList.length; i++) {\n        attrs = new Attributes();\n\n        // we must always refer to nodeList[i] since the nodes can be replaced underneath us.\n        directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,\n                                        ignoreDirective);\n\n        nodeLinkFn = (directives.length)\n            ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,\n                                      null, [], [], previousCompileContext)\n            : null;\n\n        if (nodeLinkFn && nodeLinkFn.scope) {\n          safeAddClass(attrs.$$element, 'ng-scope');\n        }\n\n        childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||\n                      !(childNodes = nodeList[i].childNodes) ||\n                      !childNodes.length)\n            ? null\n            : compileNodes(childNodes,\n                 nodeLinkFn ? (\n                  (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)\n                     && nodeLinkFn.transclude) : transcludeFn);\n\n        linkFns.push(nodeLinkFn, childLinkFn);\n        linkFnFound = linkFnFound || nodeLinkFn || childLinkFn;\n        //use the previous context only for the first element in the virtual group\n        previousCompileContext = null;\n      }\n\n      // return a linking function if we have found anything, null otherwise\n      return linkFnFound ? compositeLinkFn : null;\n\n      function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {\n        var nodeLinkFn, childLinkFn, node, childScope, i, ii, n, childBoundTranscludeFn;\n\n        // copy nodeList so that linking doesn't break due to live list updates.\n        var nodeListLength = nodeList.length,\n            stableNodeList = new Array(nodeListLength);\n        for (i = 0; i < nodeListLength; i++) {\n          stableNodeList[i] = nodeList[i];\n        }\n\n        for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) {\n          node = stableNodeList[n];\n          nodeLinkFn = linkFns[i++];\n          childLinkFn = linkFns[i++];\n\n          if (nodeLinkFn) {\n            if (nodeLinkFn.scope) {\n              childScope = scope.$new();\n              jqLite.data(node, '$scope', childScope);\n            } else {\n              childScope = scope;\n            }\n\n            if ( nodeLinkFn.transcludeOnThisElement ) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, nodeLinkFn.transclude, parentBoundTranscludeFn);\n\n            } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {\n              childBoundTranscludeFn = parentBoundTranscludeFn;\n\n            } else if (!parentBoundTranscludeFn && transcludeFn) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);\n\n            } else {\n              childBoundTranscludeFn = null;\n            }\n\n            nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);\n\n          } else if (childLinkFn) {\n            childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);\n          }\n        }\n      }\n    }\n\n    function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {\n\n      var boundTranscludeFn = function(transcludedScope, cloneFn, controllers) {\n        var scopeCreated = false;\n\n        if (!transcludedScope) {\n          transcludedScope = scope.$new();\n          transcludedScope.$$transcluded = true;\n          scopeCreated = true;\n        }\n\n        var clone = transcludeFn(transcludedScope, cloneFn, controllers, previousBoundTranscludeFn);\n        if (scopeCreated) {\n          clone.on('$destroy', function() { transcludedScope.$destroy(); });\n        }\n        return clone;\n      };\n\n      return boundTranscludeFn;\n    }\n\n    /**\n     * Looks for directives on the given node and adds them to the directive collection which is\n     * sorted.\n     *\n     * @param node Node to search.\n     * @param directives An array to which the directives are added to. This array is sorted before\n     *        the function returns.\n     * @param attrs The shared attrs object which is used to populate the normalized attributes.\n     * @param {number=} maxPriority Max directive priority.\n     */\n    function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {\n      var nodeType = node.nodeType,\n          attrsMap = attrs.$attr,\n          match,\n          className;\n\n      switch(nodeType) {\n        case 1: /* Element */\n          // use the node name: <directive>\n          addDirective(directives,\n              directiveNormalize(nodeName_(node).toLowerCase()), 'E', maxPriority, ignoreDirective);\n\n          // iterate over the attributes\n          for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,\n                   j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {\n            var attrStartName = false;\n            var attrEndName = false;\n\n            attr = nAttrs[j];\n            if (!msie || msie >= 8 || attr.specified) {\n              name = attr.name;\n              value = trim(attr.value);\n\n              // support ngAttr attribute binding\n              ngAttrName = directiveNormalize(name);\n              if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {\n                name = snake_case(ngAttrName.substr(6), '-');\n              }\n\n              var directiveNName = ngAttrName.replace(/(Start|End)$/, '');\n              if (ngAttrName === directiveNName + 'Start') {\n                attrStartName = name;\n                attrEndName = name.substr(0, name.length - 5) + 'end';\n                name = name.substr(0, name.length - 6);\n              }\n\n              nName = directiveNormalize(name.toLowerCase());\n              attrsMap[nName] = name;\n              if (isNgAttr || !attrs.hasOwnProperty(nName)) {\n                  attrs[nName] = value;\n                  if (getBooleanAttrName(node, nName)) {\n                    attrs[nName] = true; // presence means true\n                  }\n              }\n              addAttrInterpolateDirective(node, directives, value, nName);\n              addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,\n                            attrEndName);\n            }\n          }\n\n          // use class as directive\n          className = node.className;\n          if (isString(className) && className !== '') {\n            while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {\n              nName = directiveNormalize(match[2]);\n              if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[3]);\n              }\n              className = className.substr(match.index + match[0].length);\n            }\n          }\n          break;\n        case 3: /* Text Node */\n          addTextInterpolateDirective(directives, node.nodeValue);\n          break;\n        case 8: /* Comment */\n          try {\n            match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);\n            if (match) {\n              nName = directiveNormalize(match[1]);\n              if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[2]);\n              }\n            }\n          } catch (e) {\n            // turns out that under some circumstances IE9 throws errors when one attempts to read\n            // comment's node value.\n            // Just ignore it and continue. (Can't seem to reproduce in test case.)\n          }\n          break;\n      }\n\n      directives.sort(byPriority);\n      return directives;\n    }\n\n    /**\n     * Given a node with an directive-start it collects all of the siblings until it finds\n     * directive-end.\n     * @param node\n     * @param attrStart\n     * @param attrEnd\n     * @returns {*}\n     */\n    function groupScan(node, attrStart, attrEnd) {\n      var nodes = [];\n      var depth = 0;\n      if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {\n        var startNode = node;\n        do {\n          if (!node) {\n            throw $compileMinErr('uterdir',\n                      \"Unterminated attribute, found '{0}' but no matching '{1}' found.\",\n                      attrStart, attrEnd);\n          }\n          if (node.nodeType == 1 /** Element **/) {\n            if (node.hasAttribute(attrStart)) depth++;\n            if (node.hasAttribute(attrEnd)) depth--;\n          }\n          nodes.push(node);\n          node = node.nextSibling;\n        } while (depth > 0);\n      } else {\n        nodes.push(node);\n      }\n\n      return jqLite(nodes);\n    }\n\n    /**\n     * Wrapper for linking function which converts normal linking function into a grouped\n     * linking function.\n     * @param linkFn\n     * @param attrStart\n     * @param attrEnd\n     * @returns {Function}\n     */\n    function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {\n      return function(scope, element, attrs, controllers, transcludeFn) {\n        element = groupScan(element[0], attrStart, attrEnd);\n        return linkFn(scope, element, attrs, controllers, transcludeFn);\n      };\n    }\n\n    /**\n     * Once the directives have been collected, their compile functions are executed. This method\n     * is responsible for inlining directive templates as well as terminating the application\n     * of the directives if the terminal directive has been reached.\n     *\n     * @param {Array} directives Array of collected directives to execute their compile function.\n     *        this needs to be pre-sorted by priority order.\n     * @param {Node} compileNode The raw DOM node to apply the compile functions to\n     * @param {Object} templateAttrs The shared attribute function\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *                                                  scope argument is auto-generated to the new\n     *                                                  child of the transcluded parent scope.\n     * @param {JQLite} jqCollection If we are working on the root of the compile tree then this\n     *                              argument has the root jqLite array so that we can replace nodes\n     *                              on it.\n     * @param {Object=} originalReplaceDirective An optional directive that will be ignored when\n     *                                           compiling the transclusion.\n     * @param {Array.<Function>} preLinkFns\n     * @param {Array.<Function>} postLinkFns\n     * @param {Object} previousCompileContext Context used for previous compilation of the current\n     *                                        node\n     * @returns {Function} linkFn\n     */\n    function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,\n                                   jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,\n                                   previousCompileContext) {\n      previousCompileContext = previousCompileContext || {};\n\n      var terminalPriority = -Number.MAX_VALUE,\n          newScopeDirective,\n          controllerDirectives = previousCompileContext.controllerDirectives,\n          newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,\n          templateDirective = previousCompileContext.templateDirective,\n          nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,\n          hasTranscludeDirective = false,\n          hasTemplate = false,\n          hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,\n          $compileNode = templateAttrs.$$element = jqLite(compileNode),\n          directive,\n          directiveName,\n          $template,\n          replaceDirective = originalReplaceDirective,\n          childTranscludeFn = transcludeFn,\n          linkFn,\n          directiveValue;\n\n      // executes all directives on the current element\n      for(var i = 0, ii = directives.length; i < ii; i++) {\n        directive = directives[i];\n        var attrStart = directive.$$start;\n        var attrEnd = directive.$$end;\n\n        // collect multiblock sections\n        if (attrStart) {\n          $compileNode = groupScan(compileNode, attrStart, attrEnd);\n        }\n        $template = undefined;\n\n        if (terminalPriority > directive.priority) {\n          break; // prevent further processing of directives\n        }\n\n        if (directiveValue = directive.scope) {\n          newScopeDirective = newScopeDirective || directive;\n\n          // skip the check for directives with async templates, we'll check the derived sync\n          // directive when the template arrives\n          if (!directive.templateUrl) {\n            assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,\n                              $compileNode);\n            if (isObject(directiveValue)) {\n              newIsolateScopeDirective = directive;\n            }\n          }\n        }\n\n        directiveName = directive.name;\n\n        if (!directive.templateUrl && directive.controller) {\n          directiveValue = directive.controller;\n          controllerDirectives = controllerDirectives || {};\n          assertNoDuplicate(\"'\" + directiveName + \"' controller\",\n              controllerDirectives[directiveName], directive, $compileNode);\n          controllerDirectives[directiveName] = directive;\n        }\n\n        if (directiveValue = directive.transclude) {\n          hasTranscludeDirective = true;\n\n          // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.\n          // This option should only be used by directives that know how to safely handle element transclusion,\n          // where the transcluded nodes are added or replaced after linking.\n          if (!directive.$$tlb) {\n            assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);\n            nonTlbTranscludeDirective = directive;\n          }\n\n          if (directiveValue == 'element') {\n            hasElementTranscludeDirective = true;\n            terminalPriority = directive.priority;\n            $template = $compileNode;\n            $compileNode = templateAttrs.$$element =\n                jqLite(document.createComment(' ' + directiveName + ': ' +\n                                              templateAttrs[directiveName] + ' '));\n            compileNode = $compileNode[0];\n            replaceWith(jqCollection, sliceArgs($template), compileNode);\n\n            childTranscludeFn = compile($template, transcludeFn, terminalPriority,\n                                        replaceDirective && replaceDirective.name, {\n                                          // Don't pass in:\n                                          // - controllerDirectives - otherwise we'll create duplicates controllers\n                                          // - newIsolateScopeDirective or templateDirective - combining templates with\n                                          //   element transclusion doesn't make sense.\n                                          //\n                                          // We need only nonTlbTranscludeDirective so that we prevent putting transclusion\n                                          // on the same element more than once.\n                                          nonTlbTranscludeDirective: nonTlbTranscludeDirective\n                                        });\n          } else {\n            $template = jqLite(jqLiteClone(compileNode)).contents();\n            $compileNode.empty(); // clear contents\n            childTranscludeFn = compile($template, transcludeFn);\n          }\n        }\n\n        if (directive.template) {\n          hasTemplate = true;\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          directiveValue = (isFunction(directive.template))\n              ? directive.template($compileNode, templateAttrs)\n              : directive.template;\n\n          directiveValue = denormalizeTemplate(directiveValue);\n\n          if (directive.replace) {\n            replaceDirective = directive;\n            if (jqLiteIsTextNode(directiveValue)) {\n              $template = [];\n            } else {\n              $template = jqLite(trim(directiveValue));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== 1) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  directiveName, '');\n            }\n\n            replaceWith(jqCollection, $compileNode, compileNode);\n\n            var newTemplateAttrs = {$attr: {}};\n\n            // combine directives from the original node and from the template:\n            // - take the array of directives for this element\n            // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)\n            // - collect directives from the template and sort them by priority\n            // - combine directives as: processed + template + unprocessed\n            var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);\n            var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));\n\n            if (newIsolateScopeDirective) {\n              markDirectivesAsIsolate(templateDirectives);\n            }\n            directives = directives.concat(templateDirectives).concat(unprocessedDirectives);\n            mergeTemplateAttributes(templateAttrs, newTemplateAttrs);\n\n            ii = directives.length;\n          } else {\n            $compileNode.html(directiveValue);\n          }\n        }\n\n        if (directive.templateUrl) {\n          hasTemplate = true;\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          if (directive.replace) {\n            replaceDirective = directive;\n          }\n\n          nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,\n              templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {\n                controllerDirectives: controllerDirectives,\n                newIsolateScopeDirective: newIsolateScopeDirective,\n                templateDirective: templateDirective,\n                nonTlbTranscludeDirective: nonTlbTranscludeDirective\n              });\n          ii = directives.length;\n        } else if (directive.compile) {\n          try {\n            linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);\n            if (isFunction(linkFn)) {\n              addLinkFns(null, linkFn, attrStart, attrEnd);\n            } else if (linkFn) {\n              addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);\n            }\n          } catch (e) {\n            $exceptionHandler(e, startingTag($compileNode));\n          }\n        }\n\n        if (directive.terminal) {\n          nodeLinkFn.terminal = true;\n          terminalPriority = Math.max(terminalPriority, directive.priority);\n        }\n\n      }\n\n      nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;\n      nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;\n      nodeLinkFn.templateOnThisElement = hasTemplate;\n      nodeLinkFn.transclude = childTranscludeFn;\n\n      previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;\n\n      // might be normal or delayed nodeLinkFn depending on if templateUrl is present\n      return nodeLinkFn;\n\n      ////////////////////\n\n      function addLinkFns(pre, post, attrStart, attrEnd) {\n        if (pre) {\n          if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);\n          pre.require = directive.require;\n          pre.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            pre = cloneAndAnnotateFn(pre, {isolateScope: true});\n          }\n          preLinkFns.push(pre);\n        }\n        if (post) {\n          if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);\n          post.require = directive.require;\n          post.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            post = cloneAndAnnotateFn(post, {isolateScope: true});\n          }\n          postLinkFns.push(post);\n        }\n      }\n\n\n      function getControllers(directiveName, require, $element, elementControllers) {\n        var value, retrievalMethod = 'data', optional = false;\n        if (isString(require)) {\n          while((value = require.charAt(0)) == '^' || value == '?') {\n            require = require.substr(1);\n            if (value == '^') {\n              retrievalMethod = 'inheritedData';\n            }\n            optional = optional || value == '?';\n          }\n          value = null;\n\n          if (elementControllers && retrievalMethod === 'data') {\n            value = elementControllers[require];\n          }\n          value = value || $element[retrievalMethod]('$' + require + 'Controller');\n\n          if (!value && !optional) {\n            throw $compileMinErr('ctreq',\n                \"Controller '{0}', required by directive '{1}', can't be found!\",\n                require, directiveName);\n          }\n          return value;\n        } else if (isArray(require)) {\n          value = [];\n          forEach(require, function(require) {\n            value.push(getControllers(directiveName, require, $element, elementControllers));\n          });\n        }\n        return value;\n      }\n\n\n      function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {\n        var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;\n\n        attrs = (compileNode === linkNode)\n          ? templateAttrs\n          : shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));\n        $element = attrs.$$element;\n\n        if (newIsolateScopeDirective) {\n          var LOCAL_REGEXP = /^\\s*([@=&])(\\??)\\s*(\\w*)\\s*$/;\n\n          isolateScope = scope.$new(true);\n\n          if (templateDirective && (templateDirective === newIsolateScopeDirective ||\n              templateDirective === newIsolateScopeDirective.$$originalDirective)) {\n            $element.data('$isolateScope', isolateScope);\n          } else {\n            $element.data('$isolateScopeNoTemplate', isolateScope);\n          }\n\n\n\n          safeAddClass($element, 'ng-isolate-scope');\n\n          forEach(newIsolateScopeDirective.scope, function(definition, scopeName) {\n            var match = definition.match(LOCAL_REGEXP) || [],\n                attrName = match[3] || scopeName,\n                optional = (match[2] == '?'),\n                mode = match[1], // @, =, or &\n                lastValue,\n                parentGet, parentSet, compare;\n\n            isolateScope.$$isolateBindings[scopeName] = mode + attrName;\n\n            switch (mode) {\n\n              case '@':\n                attrs.$observe(attrName, function(value) {\n                  isolateScope[scopeName] = value;\n                });\n                attrs.$$observers[attrName].$$scope = scope;\n                if( attrs[attrName] ) {\n                  // If the attribute has been provided then we trigger an interpolation to ensure\n                  // the value is there for use in the link fn\n                  isolateScope[scopeName] = $interpolate(attrs[attrName])(scope);\n                }\n                break;\n\n              case '=':\n                if (optional && !attrs[attrName]) {\n                  return;\n                }\n                parentGet = $parse(attrs[attrName]);\n                if (parentGet.literal) {\n                  compare = equals;\n                } else {\n                  compare = function(a,b) { return a === b || (a !== a && b !== b); };\n                }\n                parentSet = parentGet.assign || function() {\n                  // reset the change, or we will throw this exception on every $digest\n                  lastValue = isolateScope[scopeName] = parentGet(scope);\n                  throw $compileMinErr('nonassign',\n                      \"Expression '{0}' used with directive '{1}' is non-assignable!\",\n                      attrs[attrName], newIsolateScopeDirective.name);\n                };\n                lastValue = isolateScope[scopeName] = parentGet(scope);\n                isolateScope.$watch(function parentValueWatch() {\n                  var parentValue = parentGet(scope);\n                  if (!compare(parentValue, isolateScope[scopeName])) {\n                    // we are out of sync and need to copy\n                    if (!compare(parentValue, lastValue)) {\n                      // parent changed and it has precedence\n                      isolateScope[scopeName] = parentValue;\n                    } else {\n                      // if the parent can be assigned then do so\n                      parentSet(scope, parentValue = isolateScope[scopeName]);\n                    }\n                  }\n                  return lastValue = parentValue;\n                }, null, parentGet.literal);\n                break;\n\n              case '&':\n                parentGet = $parse(attrs[attrName]);\n                isolateScope[scopeName] = function(locals) {\n                  return parentGet(scope, locals);\n                };\n                break;\n\n              default:\n                throw $compileMinErr('iscp',\n                    \"Invalid isolate scope definition for directive '{0}'.\" +\n                    \" Definition: {... {1}: '{2}' ...}\",\n                    newIsolateScopeDirective.name, scopeName, definition);\n            }\n          });\n        }\n        transcludeFn = boundTranscludeFn && controllersBoundTransclude;\n        if (controllerDirectives) {\n          forEach(controllerDirectives, function(directive) {\n            var locals = {\n              $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,\n              $element: $element,\n              $attrs: attrs,\n              $transclude: transcludeFn\n            }, controllerInstance;\n\n            controller = directive.controller;\n            if (controller == '@') {\n              controller = attrs[directive.name];\n            }\n\n            controllerInstance = $controller(controller, locals);\n            // For directives with element transclusion the element is a comment,\n            // but jQuery .data doesn't support attaching data to comment nodes as it's hard to\n            // clean up (http://bugs.jquery.com/ticket/8335).\n            // Instead, we save the controllers for the element in a local hash and attach to .data\n            // later, once we have the actual element.\n            elementControllers[directive.name] = controllerInstance;\n            if (!hasElementTranscludeDirective) {\n              $element.data('$' + directive.name + 'Controller', controllerInstance);\n            }\n\n            if (directive.controllerAs) {\n              locals.$scope[directive.controllerAs] = controllerInstance;\n            }\n          });\n        }\n\n        // PRELINKING\n        for(i = 0, ii = preLinkFns.length; i < ii; i++) {\n          try {\n            linkFn = preLinkFns[i];\n            linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,\n                linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn);\n          } catch (e) {\n            $exceptionHandler(e, startingTag($element));\n          }\n        }\n\n        // RECURSION\n        // We only pass the isolate scope, if the isolate directive has a template,\n        // otherwise the child elements do not belong to the isolate directive.\n        var scopeToChild = scope;\n        if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {\n          scopeToChild = isolateScope;\n        }\n        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);\n\n        // POSTLINKING\n        for(i = postLinkFns.length - 1; i >= 0; i--) {\n          try {\n            linkFn = postLinkFns[i];\n            linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,\n                linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn);\n          } catch (e) {\n            $exceptionHandler(e, startingTag($element));\n          }\n        }\n\n        // This is the function that is injected as `$transclude`.\n        function controllersBoundTransclude(scope, cloneAttachFn) {\n          var transcludeControllers;\n\n          // no scope passed\n          if (arguments.length < 2) {\n            cloneAttachFn = scope;\n            scope = undefined;\n          }\n\n          if (hasElementTranscludeDirective) {\n            transcludeControllers = elementControllers;\n          }\n\n          return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers);\n        }\n      }\n    }\n\n    function markDirectivesAsIsolate(directives) {\n      // mark all directives as needing isolate scope.\n      for (var j = 0, jj = directives.length; j < jj; j++) {\n        directives[j] = inherit(directives[j], {$$isolateScope: true});\n      }\n    }\n\n    /**\n     * looks up the directive and decorates it with exception handling and proper parameters. We\n     * call this the boundDirective.\n     *\n     * @param {string} name name of the directive to look up.\n     * @param {string} location The directive must be found in specific format.\n     *   String containing any of theses characters:\n     *\n     *   * `E`: element name\n     *   * `A': attribute\n     *   * `C`: class\n     *   * `M`: comment\n     * @returns {boolean} true if directive was added.\n     */\n    function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,\n                          endAttrName) {\n      if (name === ignoreDirective) return null;\n      var match = null;\n      if (hasDirectives.hasOwnProperty(name)) {\n        for(var directive, directives = $injector.get(name + Suffix),\n            i = 0, ii = directives.length; i<ii; i++) {\n          try {\n            directive = directives[i];\n            if ( (maxPriority === undefined || maxPriority > directive.priority) &&\n                 directive.restrict.indexOf(location) != -1) {\n              if (startAttrName) {\n                directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});\n              }\n              tDirectives.push(directive);\n              match = directive;\n            }\n          } catch(e) { $exceptionHandler(e); }\n        }\n      }\n      return match;\n    }\n\n\n    /**\n     * When the element is replaced with HTML template then the new attributes\n     * on the template need to be merged with the existing attributes in the DOM.\n     * The desired effect is to have both of the attributes present.\n     *\n     * @param {object} dst destination attributes (original DOM)\n     * @param {object} src source attributes (from the directive template)\n     */\n    function mergeTemplateAttributes(dst, src) {\n      var srcAttr = src.$attr,\n          dstAttr = dst.$attr,\n          $element = dst.$$element;\n\n      // reapply the old attributes to the new element\n      forEach(dst, function(value, key) {\n        if (key.charAt(0) != '$') {\n          if (src[key] && src[key] !== value) {\n            value += (key === 'style' ? ';' : ' ') + src[key];\n          }\n          dst.$set(key, value, true, srcAttr[key]);\n        }\n      });\n\n      // copy the new attributes on the old attrs object\n      forEach(src, function(value, key) {\n        if (key == 'class') {\n          safeAddClass($element, value);\n          dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;\n        } else if (key == 'style') {\n          $element.attr('style', $element.attr('style') + ';' + value);\n          dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;\n          // `dst` will never contain hasOwnProperty as DOM parser won't let it.\n          // You will get an \"InvalidCharacterError: DOM Exception 5\" error if you\n          // have an attribute like \"has-own-property\" or \"data-has-own-property\", etc.\n        } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {\n          dst[key] = value;\n          dstAttr[key] = srcAttr[key];\n        }\n      });\n    }\n\n\n    function compileTemplateUrl(directives, $compileNode, tAttrs,\n        $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {\n      var linkQueue = [],\n          afterTemplateNodeLinkFn,\n          afterTemplateChildLinkFn,\n          beforeTemplateCompileNode = $compileNode[0],\n          origAsyncDirective = directives.shift(),\n          // The fact that we have to copy and patch the directive seems wrong!\n          derivedSyncDirective = extend({}, origAsyncDirective, {\n            templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective\n          }),\n          templateUrl = (isFunction(origAsyncDirective.templateUrl))\n              ? origAsyncDirective.templateUrl($compileNode, tAttrs)\n              : origAsyncDirective.templateUrl;\n\n      $compileNode.empty();\n\n      $http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}).\n        success(function(content) {\n          var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;\n\n          content = denormalizeTemplate(content);\n\n          if (origAsyncDirective.replace) {\n            if (jqLiteIsTextNode(content)) {\n              $template = [];\n            } else {\n              $template = jqLite(trim(content));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== 1) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  origAsyncDirective.name, templateUrl);\n            }\n\n            tempTemplateAttrs = {$attr: {}};\n            replaceWith($rootElement, $compileNode, compileNode);\n            var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);\n\n            if (isObject(origAsyncDirective.scope)) {\n              markDirectivesAsIsolate(templateDirectives);\n            }\n            directives = templateDirectives.concat(directives);\n            mergeTemplateAttributes(tAttrs, tempTemplateAttrs);\n          } else {\n            compileNode = beforeTemplateCompileNode;\n            $compileNode.html(content);\n          }\n\n          directives.unshift(derivedSyncDirective);\n\n          afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,\n              childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,\n              previousCompileContext);\n          forEach($rootElement, function(node, i) {\n            if (node == compileNode) {\n              $rootElement[i] = $compileNode[0];\n            }\n          });\n          afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);\n\n          while(linkQueue.length) {\n            var scope = linkQueue.shift(),\n                beforeTemplateLinkNode = linkQueue.shift(),\n                linkRootElement = linkQueue.shift(),\n                boundTranscludeFn = linkQueue.shift(),\n                linkNode = $compileNode[0];\n\n            if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {\n              var oldClasses = beforeTemplateLinkNode.className;\n\n              if (!(previousCompileContext.hasElementTranscludeDirective &&\n                  origAsyncDirective.replace)) {\n                // it was cloned therefore we have to clone as well.\n                linkNode = jqLiteClone(compileNode);\n              }\n\n              replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);\n\n              // Copy in CSS classes from original node\n              safeAddClass(jqLite(linkNode), oldClasses);\n            }\n            if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n            } else {\n              childBoundTranscludeFn = boundTranscludeFn;\n            }\n            afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,\n              childBoundTranscludeFn);\n          }\n          linkQueue = null;\n        }).\n        error(function(response, code, headers, config) {\n          throw $compileMinErr('tpload', 'Failed to load template: {0}', config.url);\n        });\n\n      return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {\n        var childBoundTranscludeFn = boundTranscludeFn;\n        if (linkQueue) {\n          linkQueue.push(scope);\n          linkQueue.push(node);\n          linkQueue.push(rootElement);\n          linkQueue.push(childBoundTranscludeFn);\n        } else {\n          if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n            childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n          }\n          afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);\n        }\n      };\n    }\n\n\n    /**\n     * Sorting function for bound directives.\n     */\n    function byPriority(a, b) {\n      var diff = b.priority - a.priority;\n      if (diff !== 0) return diff;\n      if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;\n      return a.index - b.index;\n    }\n\n\n    function assertNoDuplicate(what, previousDirective, directive, element) {\n      if (previousDirective) {\n        throw $compileMinErr('multidir', 'Multiple directives [{0}, {1}] asking for {2} on: {3}',\n            previousDirective.name, directive.name, what, startingTag(element));\n      }\n    }\n\n\n      function addTextInterpolateDirective(directives, text) {\n        var interpolateFn = $interpolate(text, true);\n        if (interpolateFn) {\n          directives.push({\n            priority: 0,\n            compile: function textInterpolateCompileFn(templateNode) {\n              // when transcluding a template that has bindings in the root\n              // then we don't have a parent and should do this in the linkFn\n              var parent = templateNode.parent(), hasCompileParent = parent.length;\n              if (hasCompileParent) safeAddClass(templateNode.parent(), 'ng-binding');\n\n              return function textInterpolateLinkFn(scope, node) {\n                var parent = node.parent(),\n                  bindings = parent.data('$binding') || [];\n                bindings.push(interpolateFn);\n                parent.data('$binding', bindings);\n                if (!hasCompileParent) safeAddClass(parent, 'ng-binding');\n                scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {\n                  node[0].nodeValue = value;\n                });\n              };\n            }\n          });\n        }\n      }\n\n\n    function getTrustedContext(node, attrNormalizedName) {\n      if (attrNormalizedName == \"srcdoc\") {\n        return $sce.HTML;\n      }\n      var tag = nodeName_(node);\n      // maction[xlink:href] can source SVG.  It's not limited to <maction>.\n      if (attrNormalizedName == \"xlinkHref\" ||\n          (tag == \"FORM\" && attrNormalizedName == \"action\") ||\n          (tag != \"IMG\" && (attrNormalizedName == \"src\" ||\n                            attrNormalizedName == \"ngSrc\"))) {\n        return $sce.RESOURCE_URL;\n      }\n    }\n\n\n    function addAttrInterpolateDirective(node, directives, value, name) {\n      var interpolateFn = $interpolate(value, true);\n\n      // no interpolation found -> ignore\n      if (!interpolateFn) return;\n\n\n      if (name === \"multiple\" && nodeName_(node) === \"SELECT\") {\n        throw $compileMinErr(\"selmulti\",\n            \"Binding to the 'multiple' attribute is not supported. Element: {0}\",\n            startingTag(node));\n      }\n\n      directives.push({\n        priority: 100,\n        compile: function() {\n            return {\n              pre: function attrInterpolatePreLinkFn(scope, element, attr) {\n                var $$observers = (attr.$$observers || (attr.$$observers = {}));\n\n                if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {\n                  throw $compileMinErr('nodomevents',\n                      \"Interpolations for HTML DOM event attributes are disallowed.  Please use the \" +\n                          \"ng- versions (such as ng-click instead of onclick) instead.\");\n                }\n\n                // we need to interpolate again, in case the attribute value has been updated\n                // (e.g. by another directive's compile function)\n                interpolateFn = $interpolate(attr[name], true, getTrustedContext(node, name));\n\n                // if attribute was updated so that there is no interpolation going on we don't want to\n                // register any observers\n                if (!interpolateFn) return;\n\n                // TODO(i): this should likely be attr.$set(name, iterpolateFn(scope) so that we reset the\n                // actual attr value\n                attr[name] = interpolateFn(scope);\n                ($$observers[name] || ($$observers[name] = [])).$$inter = true;\n                (attr.$$observers && attr.$$observers[name].$$scope || scope).\n                  $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {\n                    //special case for class attribute addition + removal\n                    //so that class changes can tap into the animation\n                    //hooks provided by the $animate service. Be sure to\n                    //skip animations when the first digest occurs (when\n                    //both the new and the old values are the same) since\n                    //the CSS classes are the non-interpolated values\n                    if(name === 'class' && newValue != oldValue) {\n                      attr.$updateClass(newValue, oldValue);\n                    } else {\n                      attr.$set(name, newValue);\n                    }\n                  });\n              }\n            };\n          }\n      });\n    }\n\n\n    /**\n     * This is a special jqLite.replaceWith, which can replace items which\n     * have no parents, provided that the containing jqLite collection is provided.\n     *\n     * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes\n     *                               in the root of the tree.\n     * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep\n     *                                  the shell, but replace its DOM node reference.\n     * @param {Node} newNode The new DOM node.\n     */\n    function replaceWith($rootElement, elementsToRemove, newNode) {\n      var firstElementToRemove = elementsToRemove[0],\n          removeCount = elementsToRemove.length,\n          parent = firstElementToRemove.parentNode,\n          i, ii;\n\n      if ($rootElement) {\n        for(i = 0, ii = $rootElement.length; i < ii; i++) {\n          if ($rootElement[i] == firstElementToRemove) {\n            $rootElement[i++] = newNode;\n            for (var j = i, j2 = j + removeCount - 1,\n                     jj = $rootElement.length;\n                 j < jj; j++, j2++) {\n              if (j2 < jj) {\n                $rootElement[j] = $rootElement[j2];\n              } else {\n                delete $rootElement[j];\n              }\n            }\n            $rootElement.length -= removeCount - 1;\n            break;\n          }\n        }\n      }\n\n      if (parent) {\n        parent.replaceChild(newNode, firstElementToRemove);\n      }\n      var fragment = document.createDocumentFragment();\n      fragment.appendChild(firstElementToRemove);\n      newNode[jqLite.expando] = firstElementToRemove[jqLite.expando];\n      for (var k = 1, kk = elementsToRemove.length; k < kk; k++) {\n        var element = elementsToRemove[k];\n        jqLite(element).remove(); // must do this way to clean up expando\n        fragment.appendChild(element);\n        delete elementsToRemove[k];\n      }\n\n      elementsToRemove[0] = newNode;\n      elementsToRemove.length = 1;\n    }\n\n\n    function cloneAndAnnotateFn(fn, annotation) {\n      return extend(function() { return fn.apply(null, arguments); }, fn, annotation);\n    }\n  }];\n}\n\nvar PREFIX_REGEXP = /^(x[\\:\\-_]|data[\\:\\-_])/i;\n/**\n * Converts all accepted directives format into proper directive name.\n * All of these will become 'myDirective':\n *   my:Directive\n *   my-directive\n *   x-my-directive\n *   data-my:directive\n *\n * Also there is special case for Moz prefix starting with upper case letter.\n * @param name Name to normalize\n */\nfunction directiveNormalize(name) {\n  return camelCase(name.replace(PREFIX_REGEXP, ''));\n}\n\n/**\n * @ngdoc type\n * @name $compile.directive.Attributes\n *\n * @description\n * A shared object between directive compile / linking functions which contains normalized DOM\n * element attributes. The values reflect current binding state `{{ }}`. The normalization is\n * needed since all of these are treated as equivalent in Angular:\n *\n * ```\n *    <span ng:bind=\"a\" ng-bind=\"a\" data-ng-bind=\"a\" x-ng-bind=\"a\">\n * ```\n */\n\n/**\n * @ngdoc property\n * @name $compile.directive.Attributes#$attr\n *\n * @description\n * A map of DOM element attribute names to the normalized name. This is\n * needed to do reverse lookup from normalized name back to actual name.\n */\n\n\n/**\n * @ngdoc method\n * @name $compile.directive.Attributes#$set\n * @kind function\n *\n * @description\n * Set DOM element attribute value.\n *\n *\n * @param {string} name Normalized element attribute name of the property to modify. The name is\n *          reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}\n *          property to the original name.\n * @param {string} value Value to set the attribute to. The value can be an interpolated string.\n */\n\n\n\n/**\n * Closure compiler type information\n */\n\nfunction nodesetLinkingFn(\n  /* angular.Scope */ scope,\n  /* NodeList */ nodeList,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n){}\n\nfunction directiveLinkingFn(\n  /* nodesetLinkingFn */ nodesetLinkingFn,\n  /* angular.Scope */ scope,\n  /* Node */ node,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n){}\n\nfunction tokenDifference(str1, str2) {\n  var values = '',\n      tokens1 = str1.split(/\\s+/),\n      tokens2 = str2.split(/\\s+/);\n\n  outer:\n  for(var i = 0; i < tokens1.length; i++) {\n    var token = tokens1[i];\n    for(var j = 0; j < tokens2.length; j++) {\n      if(token == tokens2[j]) continue outer;\n    }\n    values += (values.length > 0 ? ' ' : '') + token;\n  }\n  return values;\n}\n\n/**\n * @ngdoc provider\n * @name $controllerProvider\n * @description\n * The {@link ng.$controller $controller service} is used by Angular to create new\n * controllers.\n *\n * This provider allows controller registration via the\n * {@link ng.$controllerProvider#register register} method.\n */\nfunction $ControllerProvider() {\n  var controllers = {},\n      CNTRL_REG = /^(\\S+)(\\s+as\\s+(\\w+))?$/;\n\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#register\n   * @param {string|Object} name Controller name, or an object map of controllers where the keys are\n   *    the names and the values are the constructors.\n   * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI\n   *    annotations in the array notation).\n   */\n  this.register = function(name, constructor) {\n    assertNotHasOwnProperty(name, 'controller');\n    if (isObject(name)) {\n      extend(controllers, name);\n    } else {\n      controllers[name] = constructor;\n    }\n  };\n\n\n  this.$get = ['$injector', '$window', function($injector, $window) {\n\n    /**\n     * @ngdoc service\n     * @name $controller\n     * @requires $injector\n     *\n     * @param {Function|string} constructor If called with a function then it's considered to be the\n     *    controller constructor function. Otherwise it's considered to be a string which is used\n     *    to retrieve the controller constructor using the following steps:\n     *\n     *    * check if a controller with given name is registered via `$controllerProvider`\n     *    * check if evaluating the string on the current scope returns a constructor\n     *    * check `window[constructor]` on the global `window` object\n     *\n     * @param {Object} locals Injection locals for Controller.\n     * @return {Object} Instance of given controller.\n     *\n     * @description\n     * `$controller` service is responsible for instantiating controllers.\n     *\n     * It's just a simple call to {@link auto.$injector $injector}, but extracted into\n     * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).\n     */\n    return function(expression, locals) {\n      var instance, match, constructor, identifier;\n\n      if(isString(expression)) {\n        match = expression.match(CNTRL_REG),\n        constructor = match[1],\n        identifier = match[3];\n        expression = controllers.hasOwnProperty(constructor)\n            ? controllers[constructor]\n            : getter(locals.$scope, constructor, true) || getter($window, constructor, true);\n\n        assertArgFn(expression, constructor, true);\n      }\n\n      instance = $injector.instantiate(expression, locals);\n\n      if (identifier) {\n        if (!(locals && typeof locals.$scope === 'object')) {\n          throw minErr('$controller')('noscp',\n              \"Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.\",\n              constructor || expression.name, identifier);\n        }\n\n        locals.$scope[identifier] = instance;\n      }\n\n      return instance;\n    };\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $document\n * @requires $window\n *\n * @description\n * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.\n *\n * @example\n   <example module=\"documentExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <p>$document title: <b ng-bind=\"title\"></b></p>\n         <p>window.document title: <b ng-bind=\"windowTitle\"></b></p>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('documentExample', [])\n         .controller('ExampleController', ['$scope', '$document', function($scope, $document) {\n           $scope.title = $document[0].title;\n           $scope.windowTitle = angular.element(window.document)[0].title;\n         }]);\n     </file>\n   </example>\n */\nfunction $DocumentProvider(){\n  this.$get = ['$window', function(window){\n    return jqLite(window.document);\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $exceptionHandler\n * @requires ng.$log\n *\n * @description\n * Any uncaught exception in angular expressions is delegated to this service.\n * The default implementation simply delegates to `$log.error` which logs it into\n * the browser console.\n *\n * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by\n * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.\n *\n * ## Example:\n *\n * ```js\n *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {\n *     return function (exception, cause) {\n *       exception.message += ' (caused by \"' + cause + '\")';\n *       throw exception;\n *     };\n *   });\n * ```\n *\n * This example will override the normal action of `$exceptionHandler`, to make angular\n * exceptions fail hard when they happen, instead of just logging to the console.\n *\n * @param {Error} exception Exception associated with the error.\n * @param {string=} cause optional information about the context in which\n *       the error was thrown.\n *\n */\nfunction $ExceptionHandlerProvider() {\n  this.$get = ['$log', function($log) {\n    return function(exception, cause) {\n      $log.error.apply($log, arguments);\n    };\n  }];\n}\n\n/**\n * Parse headers into key value object\n *\n * @param {string} headers Raw headers as a string\n * @returns {Object} Parsed headers as key value object\n */\nfunction parseHeaders(headers) {\n  var parsed = {}, key, val, i;\n\n  if (!headers) return parsed;\n\n  forEach(headers.split('\\n'), function(line) {\n    i = line.indexOf(':');\n    key = lowercase(trim(line.substr(0, i)));\n    val = trim(line.substr(i + 1));\n\n    if (key) {\n      parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n    }\n  });\n\n  return parsed;\n}\n\n\n/**\n * Returns a function that provides access to parsed headers.\n *\n * Headers are lazy parsed when first requested.\n * @see parseHeaders\n *\n * @param {(string|Object)} headers Headers to provide access to.\n * @returns {function(string=)} Returns a getter function which if called with:\n *\n *   - if called with single an argument returns a single header value or null\n *   - if called with no arguments returns an object containing all headers.\n */\nfunction headersGetter(headers) {\n  var headersObj = isObject(headers) ? headers : undefined;\n\n  return function(name) {\n    if (!headersObj) headersObj =  parseHeaders(headers);\n\n    if (name) {\n      return headersObj[lowercase(name)] || null;\n    }\n\n    return headersObj;\n  };\n}\n\n\n/**\n * Chain all given functions\n *\n * This function is used for both request and response transforming\n *\n * @param {*} data Data to transform.\n * @param {function(string=)} headers Http headers getter fn.\n * @param {(Function|Array.<Function>)} fns Function or an array of functions.\n * @returns {*} Transformed data.\n */\nfunction transformData(data, headers, fns) {\n  if (isFunction(fns))\n    return fns(data, headers);\n\n  forEach(fns, function(fn) {\n    data = fn(data, headers);\n  });\n\n  return data;\n}\n\n\nfunction isSuccess(status) {\n  return 200 <= status && status < 300;\n}\n\n\n/**\n * @ngdoc provider\n * @name $httpProvider\n * @description\n * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.\n * */\nfunction $HttpProvider() {\n  var JSON_START = /^\\s*(\\[|\\{[^\\{])/,\n      JSON_END = /[\\}\\]]\\s*$/,\n      PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/,\n      CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'};\n\n  /**\n   * @ngdoc property\n   * @name $httpProvider#defaults\n   * @description\n   *\n   * Object containing default values for all {@link ng.$http $http} requests.\n   *\n   * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.\n   * Defaults value is `'XSRF-TOKEN'`.\n   *\n   * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the\n   * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.\n   *\n   * - **`defaults.headers`** - {Object} - Default headers for all $http requests.\n   * Refer to {@link ng.$http#setting-http-headers $http} for documentation on\n   * setting default headers.\n   *     - **`defaults.headers.common`**\n   *     - **`defaults.headers.post`**\n   *     - **`defaults.headers.put`**\n   *     - **`defaults.headers.patch`**\n   **/\n  var defaults = this.defaults = {\n    // transform incoming response data\n    transformResponse: [function(data) {\n      if (isString(data)) {\n        // strip json vulnerability protection prefix\n        data = data.replace(PROTECTION_PREFIX, '');\n        if (JSON_START.test(data) && JSON_END.test(data))\n          data = fromJson(data);\n      }\n      return data;\n    }],\n\n    // transform outgoing request data\n    transformRequest: [function(d) {\n      return isObject(d) && !isFile(d) && !isBlob(d) ? toJson(d) : d;\n    }],\n\n    // default headers\n    headers: {\n      common: {\n        'Accept': 'application/json, text/plain, */*'\n      },\n      post:   shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      put:    shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      patch:  shallowCopy(CONTENT_TYPE_APPLICATION_JSON)\n    },\n\n    xsrfCookieName: 'XSRF-TOKEN',\n    xsrfHeaderName: 'X-XSRF-TOKEN'\n  };\n\n  /**\n   * Are ordered by request, i.e. they are applied in the same order as the\n   * array, on request, but reverse order, on response.\n   */\n  var interceptorFactories = this.interceptors = [];\n\n  /**\n   * For historical reasons, response interceptors are ordered by the order in which\n   * they are applied to the response. (This is the opposite of interceptorFactories)\n   */\n  var responseInterceptorFactories = this.responseInterceptors = [];\n\n  this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector',\n      function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {\n\n    var defaultCache = $cacheFactory('$http');\n\n    /**\n     * Interceptors stored in reverse order. Inner interceptors before outer interceptors.\n     * The reversal is needed so that we can build up the interception chain around the\n     * server request.\n     */\n    var reversedInterceptors = [];\n\n    forEach(interceptorFactories, function(interceptorFactory) {\n      reversedInterceptors.unshift(isString(interceptorFactory)\n          ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));\n    });\n\n    forEach(responseInterceptorFactories, function(interceptorFactory, index) {\n      var responseFn = isString(interceptorFactory)\n          ? $injector.get(interceptorFactory)\n          : $injector.invoke(interceptorFactory);\n\n      /**\n       * Response interceptors go before \"around\" interceptors (no real reason, just\n       * had to pick one.) But they are already reversed, so we can't use unshift, hence\n       * the splice.\n       */\n      reversedInterceptors.splice(index, 0, {\n        response: function(response) {\n          return responseFn($q.when(response));\n        },\n        responseError: function(response) {\n          return responseFn($q.reject(response));\n        }\n      });\n    });\n\n\n    /**\n     * @ngdoc service\n     * @kind function\n     * @name $http\n     * @requires ng.$httpBackend\n     * @requires $cacheFactory\n     * @requires $rootScope\n     * @requires $q\n     * @requires $injector\n     *\n     * @description\n     * The `$http` service is a core Angular service that facilitates communication with the remote\n     * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)\n     * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).\n     *\n     * For unit testing applications that use `$http` service, see\n     * {@link ngMock.$httpBackend $httpBackend mock}.\n     *\n     * For a higher level of abstraction, please check out the {@link ngResource.$resource\n     * $resource} service.\n     *\n     * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by\n     * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage\n     * it is important to familiarize yourself with these APIs and the guarantees they provide.\n     *\n     *\n     * # General usage\n     * The `$http` service is a function which takes a single argument — a configuration object —\n     * that is used to generate an HTTP request and returns  a {@link ng.$q promise}\n     * with two $http specific methods: `success` and `error`.\n     *\n     * ```js\n     *   $http({method: 'GET', url: '/someUrl'}).\n     *     success(function(data, status, headers, config) {\n     *       // this callback will be called asynchronously\n     *       // when the response is available\n     *     }).\n     *     error(function(data, status, headers, config) {\n     *       // called asynchronously if an error occurs\n     *       // or server returns response with an error status.\n     *     });\n     * ```\n     *\n     * Since the returned value of calling the $http function is a `promise`, you can also use\n     * the `then` method to register callbacks, and these callbacks will receive a single argument –\n     * an object representing the response. See the API signature and type info below for more\n     * details.\n     *\n     * A response status code between 200 and 299 is considered a success status and\n     * will result in the success callback being called. Note that if the response is a redirect,\n     * XMLHttpRequest will transparently follow it, meaning that the error callback will not be\n     * called for such responses.\n     *\n     * # Writing Unit Tests that use $http\n     * When unit testing (using {@link ngMock ngMock}), it is necessary to call\n     * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending\n     * request using trained responses.\n     *\n     * ```\n     * $httpBackend.expectGET(...);\n     * $http.get(...);\n     * $httpBackend.flush();\n     * ```\n     *\n     * # Shortcut methods\n     *\n     * Shortcut methods are also available. All shortcut methods require passing in the URL, and\n     * request data must be passed in for POST/PUT requests.\n     *\n     * ```js\n     *   $http.get('/someUrl').success(successCallback);\n     *   $http.post('/someUrl', data).success(successCallback);\n     * ```\n     *\n     * Complete list of shortcut methods:\n     *\n     * - {@link ng.$http#get $http.get}\n     * - {@link ng.$http#head $http.head}\n     * - {@link ng.$http#post $http.post}\n     * - {@link ng.$http#put $http.put}\n     * - {@link ng.$http#delete $http.delete}\n     * - {@link ng.$http#jsonp $http.jsonp}\n     * - {@link ng.$http#patch $http.patch}\n     *\n     *\n     * # Setting HTTP Headers\n     *\n     * The $http service will automatically add certain HTTP headers to all requests. These defaults\n     * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration\n     * object, which currently contains this default configuration:\n     *\n     * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):\n     *   - `Accept: application/json, text/plain, * / *`\n     * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)\n     *   - `Content-Type: application/json`\n     * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)\n     *   - `Content-Type: application/json`\n     *\n     * To add or overwrite these defaults, simply add or remove a property from these configuration\n     * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object\n     * with the lowercased HTTP method name as the key, e.g.\n     * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }.\n     *\n     * The defaults can also be set at runtime via the `$http.defaults` object in the same\n     * fashion. For example:\n     *\n     * ```\n     * module.run(function($http) {\n     *   $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'\n     * });\n     * ```\n     *\n     * In addition, you can supply a `headers` property in the config object passed when\n     * calling `$http(config)`, which overrides the defaults without changing them globally.\n     *\n     *\n     * # Transforming Requests and Responses\n     *\n     * Both requests and responses can be transformed using transform functions. By default, Angular\n     * applies these transformations:\n     *\n     * Request transformations:\n     *\n     * - If the `data` property of the request configuration object contains an object, serialize it\n     *   into JSON format.\n     *\n     * Response transformations:\n     *\n     *  - If XSRF prefix is detected, strip it (see Security Considerations section below).\n     *  - If JSON response is detected, deserialize it using a JSON parser.\n     *\n     * To globally augment or override the default transforms, modify the\n     * `$httpProvider.defaults.transformRequest` and `$httpProvider.defaults.transformResponse`\n     * properties. These properties are by default an array of transform functions, which allows you\n     * to `push` or `unshift` a new transformation function into the transformation chain. You can\n     * also decide to completely override any default transformations by assigning your\n     * transformation functions to these properties directly without the array wrapper.  These defaults\n     * are again available on the $http factory at run-time, which may be useful if you have run-time\n     * services you wish to be involved in your transformations.\n     *\n     * Similarly, to locally override the request/response transforms, augment the\n     * `transformRequest` and/or `transformResponse` properties of the configuration object passed\n     * into `$http`.\n     *\n     *\n     * # Caching\n     *\n     * To enable caching, set the request configuration `cache` property to `true` (to use default\n     * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).\n     * When the cache is enabled, `$http` stores the response from the server in the specified\n     * cache. The next time the same request is made, the response is served from the cache without\n     * sending a request to the server.\n     *\n     * Note that even if the response is served from cache, delivery of the data is asynchronous in\n     * the same way that real requests are.\n     *\n     * If there are multiple GET requests for the same URL that should be cached using the same\n     * cache, but the cache is not populated yet, only one request to the server will be made and\n     * the remaining requests will be fulfilled using the response from the first request.\n     *\n     * You can change the default cache to a new object (built with\n     * {@link ng.$cacheFactory `$cacheFactory`}) by updating the\n     * {@link ng.$http#properties_defaults `$http.defaults.cache`} property. All requests who set\n     * their `cache` property to `true` will now use this cache object.\n     *\n     * If you set the default cache to `false` then only requests that specify their own custom\n     * cache object will be cached.\n     *\n     * # Interceptors\n     *\n     * Before you start creating interceptors, be sure to understand the\n     * {@link ng.$q $q and deferred/promise APIs}.\n     *\n     * For purposes of global error handling, authentication, or any kind of synchronous or\n     * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be\n     * able to intercept requests before they are handed to the server and\n     * responses before they are handed over to the application code that\n     * initiated these requests. The interceptors leverage the {@link ng.$q\n     * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.\n     *\n     * The interceptors are service factories that are registered with the `$httpProvider` by\n     * adding them to the `$httpProvider.interceptors` array. The factory is called and\n     * injected with dependencies (if specified) and returns the interceptor.\n     *\n     * There are two kinds of interceptors (and two kinds of rejection interceptors):\n     *\n     *   * `request`: interceptors get called with a http `config` object. The function is free to\n     *     modify the `config` object or create a new one. The function needs to return the `config`\n     *     object directly, or a promise containing the `config` or a new `config` object.\n     *   * `requestError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *   * `response`: interceptors get called with http `response` object. The function is free to\n     *     modify the `response` object or create a new one. The function needs to return the `response`\n     *     object directly, or as a promise containing the `response` or a new `response` object.\n     *   * `responseError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *\n     *\n     * ```js\n     *   // register the interceptor as a service\n     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {\n     *     return {\n     *       // optional method\n     *       'request': function(config) {\n     *         // do something on success\n     *         return config;\n     *       },\n     *\n     *       // optional method\n     *      'requestError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       },\n     *\n     *\n     *\n     *       // optional method\n     *       'response': function(response) {\n     *         // do something on success\n     *         return response;\n     *       },\n     *\n     *       // optional method\n     *      'responseError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       }\n     *     };\n     *   });\n     *\n     *   $httpProvider.interceptors.push('myHttpInterceptor');\n     *\n     *\n     *   // alternatively, register the interceptor via an anonymous factory\n     *   $httpProvider.interceptors.push(function($q, dependency1, dependency2) {\n     *     return {\n     *      'request': function(config) {\n     *          // same as above\n     *       },\n     *\n     *       'response': function(response) {\n     *          // same as above\n     *       }\n     *     };\n     *   });\n     * ```\n     *\n     * # Response interceptors (DEPRECATED)\n     *\n     * Before you start creating interceptors, be sure to understand the\n     * {@link ng.$q $q and deferred/promise APIs}.\n     *\n     * For purposes of global error handling, authentication or any kind of synchronous or\n     * asynchronous preprocessing of received responses, it is desirable to be able to intercept\n     * responses for http requests before they are handed over to the application code that\n     * initiated these requests. The response interceptors leverage the {@link ng.$q\n     * promise apis} to fulfil this need for both synchronous and asynchronous preprocessing.\n     *\n     * The interceptors are service factories that are registered with the $httpProvider by\n     * adding them to the `$httpProvider.responseInterceptors` array. The factory is called and\n     * injected with dependencies (if specified) and returns the interceptor  — a function that\n     * takes a {@link ng.$q promise} and returns the original or a new promise.\n     *\n     * ```js\n     *   // register the interceptor as a service\n     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {\n     *     return function(promise) {\n     *       return promise.then(function(response) {\n     *         // do something on success\n     *         return response;\n     *       }, function(response) {\n     *         // do something on error\n     *         if (canRecover(response)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(response);\n     *       });\n     *     }\n     *   });\n     *\n     *   $httpProvider.responseInterceptors.push('myHttpInterceptor');\n     *\n     *\n     *   // register the interceptor via an anonymous factory\n     *   $httpProvider.responseInterceptors.push(function($q, dependency1, dependency2) {\n     *     return function(promise) {\n     *       // same as above\n     *     }\n     *   });\n     * ```\n     *\n     *\n     * # Security Considerations\n     *\n     * When designing web applications, consider security threats from:\n     *\n     * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)\n     *\n     * Both server and the client must cooperate in order to eliminate these threats. Angular comes\n     * pre-configured with strategies that address these issues, but for this to work backend server\n     * cooperation is required.\n     *\n     * ## JSON Vulnerability Protection\n     *\n     * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * allows third party website to turn your JSON resource URL into\n     * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To\n     * counter this your server can prefix all JSON requests with following string `\")]}',\\n\"`.\n     * Angular will automatically strip the prefix before processing it as JSON.\n     *\n     * For example if your server needs to return:\n     * ```js\n     * ['one','two']\n     * ```\n     *\n     * which is vulnerable to attack, your server can return:\n     * ```js\n     * )]}',\n     * ['one','two']\n     * ```\n     *\n     * Angular will strip the prefix, before processing the JSON.\n     *\n     *\n     * ## Cross Site Request Forgery (XSRF) Protection\n     *\n     * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is a technique by which\n     * an unauthorized site can gain your user's private data. Angular provides a mechanism\n     * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie\n     * (by default, `XSRF-TOKEN`) and sets it as an HTTP header (`X-XSRF-TOKEN`). Since only\n     * JavaScript that runs on your domain could read the cookie, your server can be assured that\n     * the XHR came from JavaScript running on your domain. The header will not be set for\n     * cross-domain requests.\n     *\n     * To take advantage of this, your server needs to set a token in a JavaScript readable session\n     * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the\n     * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure\n     * that only JavaScript running on your domain could have sent the request. The token must be\n     * unique for each user and must be verifiable by the server (to prevent the JavaScript from\n     * making up its own tokens). We recommend that the token is a digest of your site's\n     * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)\n     * for added security.\n     *\n     * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName\n     * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,\n     * or the per-request config object.\n     *\n     *\n     * @param {object} config Object describing the request to be made and how it should be\n     *    processed. The object has following properties:\n     *\n     *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)\n     *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.\n     *    - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned\n     *      to `?key1=value1&key2=value2` after the url. If the value is not a string, it will be\n     *      JSONified.\n     *    - **data** – `{string|Object}` – Data to be sent as the request message data.\n     *    - **headers** – `{Object}` – Map of strings or functions which return strings representing\n     *      HTTP headers to send to the server. If the return value of a function is null, the\n     *      header will not be sent.\n     *    - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.\n     *    - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.\n     *    - **transformRequest** –\n     *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      request body and headers and returns its transformed (typically serialized) version.\n     *    - **transformResponse** –\n     *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      response body and headers and returns its transformed (typically deserialized) version.\n     *    - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the\n     *      GET request, otherwise if a cache instance built with\n     *      {@link ng.$cacheFactory $cacheFactory}, this cache will be used for\n     *      caching.\n     *    - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}\n     *      that should abort the request when resolved.\n     *    - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the\n     *      XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)\n     *      for more information.\n     *    - **responseType** - `{string}` - see\n     *      [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).\n     *\n     * @returns {HttpPromise} Returns a {@link ng.$q promise} object with the\n     *   standard `then` method and two http specific methods: `success` and `error`. The `then`\n     *   method takes two arguments a success and an error callback which will be called with a\n     *   response object. The `success` and `error` methods take a single argument - a function that\n     *   will be called when the request succeeds or fails respectively. The arguments passed into\n     *   these functions are destructured representation of the response object passed into the\n     *   `then` method. The response object has these properties:\n     *\n     *   - **data** – `{string|Object}` – The response body transformed with the transform\n     *     functions.\n     *   - **status** – `{number}` – HTTP status code of the response.\n     *   - **headers** – `{function([headerName])}` – Header getter function.\n     *   - **config** – `{Object}` – The configuration object that was used to generate the request.\n     *   - **statusText** – `{string}` – HTTP status text of the response.\n     *\n     * @property {Array.<Object>} pendingRequests Array of config objects for currently pending\n     *   requests. This is primarily meant to be used for debugging purposes.\n     *\n     *\n     * @example\n<example module=\"httpExample\">\n<file name=\"index.html\">\n  <div ng-controller=\"FetchController\">\n    <select ng-model=\"method\">\n      <option>GET</option>\n      <option>JSONP</option>\n    </select>\n    <input type=\"text\" ng-model=\"url\" size=\"80\"/>\n    <button id=\"fetchbtn\" ng-click=\"fetch()\">fetch</button><br>\n    <button id=\"samplegetbtn\" ng-click=\"updateModel('GET', 'http-hello.html')\">Sample GET</button>\n    <button id=\"samplejsonpbtn\"\n      ng-click=\"updateModel('JSONP',\n                    'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')\">\n      Sample JSONP\n    </button>\n    <button id=\"invalidjsonpbtn\"\n      ng-click=\"updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')\">\n        Invalid JSONP\n      </button>\n    <pre>http status code: {{status}}</pre>\n    <pre>http response data: {{data}}</pre>\n  </div>\n</file>\n<file name=\"script.js\">\n  angular.module('httpExample', [])\n    .controller('FetchController', ['$scope', '$http', '$templateCache',\n      function($scope, $http, $templateCache) {\n        $scope.method = 'GET';\n        $scope.url = 'http-hello.html';\n\n        $scope.fetch = function() {\n          $scope.code = null;\n          $scope.response = null;\n\n          $http({method: $scope.method, url: $scope.url, cache: $templateCache}).\n            success(function(data, status) {\n              $scope.status = status;\n              $scope.data = data;\n            }).\n            error(function(data, status) {\n              $scope.data = data || \"Request failed\";\n              $scope.status = status;\n          });\n        };\n\n        $scope.updateModel = function(method, url) {\n          $scope.method = method;\n          $scope.url = url;\n        };\n      }]);\n</file>\n<file name=\"http-hello.html\">\n  Hello, $http!\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  var status = element(by.binding('status'));\n  var data = element(by.binding('data'));\n  var fetchBtn = element(by.id('fetchbtn'));\n  var sampleGetBtn = element(by.id('samplegetbtn'));\n  var sampleJsonpBtn = element(by.id('samplejsonpbtn'));\n  var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));\n\n  it('should make an xhr GET request', function() {\n    sampleGetBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('200');\n    expect(data.getText()).toMatch(/Hello, \\$http!/);\n  });\n\n  it('should make a JSONP request to angularjs.org', function() {\n    sampleJsonpBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('200');\n    expect(data.getText()).toMatch(/Super Hero!/);\n  });\n\n  it('should make JSONP request to invalid URL and invoke the error handler',\n      function() {\n    invalidJsonpBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('0');\n    expect(data.getText()).toMatch('Request failed');\n  });\n</file>\n</example>\n     */\n    function $http(requestConfig) {\n      var config = {\n        method: 'get',\n        transformRequest: defaults.transformRequest,\n        transformResponse: defaults.transformResponse\n      };\n      var headers = mergeHeaders(requestConfig);\n\n      extend(config, requestConfig);\n      config.headers = headers;\n      config.method = uppercase(config.method);\n\n      var serverRequest = function(config) {\n        headers = config.headers;\n        var reqData = transformData(config.data, headersGetter(headers), config.transformRequest);\n\n        // strip content-type if data is undefined\n        if (isUndefined(reqData)) {\n          forEach(headers, function(value, header) {\n            if (lowercase(header) === 'content-type') {\n                delete headers[header];\n            }\n          });\n        }\n\n        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {\n          config.withCredentials = defaults.withCredentials;\n        }\n\n        // send request\n        return sendReq(config, reqData, headers).then(transformResponse, transformResponse);\n      };\n\n      var chain = [serverRequest, undefined];\n      var promise = $q.when(config);\n\n      // apply interceptors\n      forEach(reversedInterceptors, function(interceptor) {\n        if (interceptor.request || interceptor.requestError) {\n          chain.unshift(interceptor.request, interceptor.requestError);\n        }\n        if (interceptor.response || interceptor.responseError) {\n          chain.push(interceptor.response, interceptor.responseError);\n        }\n      });\n\n      while(chain.length) {\n        var thenFn = chain.shift();\n        var rejectFn = chain.shift();\n\n        promise = promise.then(thenFn, rejectFn);\n      }\n\n      promise.success = function(fn) {\n        promise.then(function(response) {\n          fn(response.data, response.status, response.headers, config);\n        });\n        return promise;\n      };\n\n      promise.error = function(fn) {\n        promise.then(null, function(response) {\n          fn(response.data, response.status, response.headers, config);\n        });\n        return promise;\n      };\n\n      return promise;\n\n      function transformResponse(response) {\n        // make a copy since the response must be cacheable\n        var resp = extend({}, response, {\n          data: transformData(response.data, response.headers, config.transformResponse)\n        });\n        return (isSuccess(response.status))\n          ? resp\n          : $q.reject(resp);\n      }\n\n      function mergeHeaders(config) {\n        var defHeaders = defaults.headers,\n            reqHeaders = extend({}, config.headers),\n            defHeaderName, lowercaseDefHeaderName, reqHeaderName;\n\n        defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);\n\n        // using for-in instead of forEach to avoid unecessary iteration after header has been found\n        defaultHeadersIteration:\n        for (defHeaderName in defHeaders) {\n          lowercaseDefHeaderName = lowercase(defHeaderName);\n\n          for (reqHeaderName in reqHeaders) {\n            if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {\n              continue defaultHeadersIteration;\n            }\n          }\n\n          reqHeaders[defHeaderName] = defHeaders[defHeaderName];\n        }\n\n        // execute if header value is a function for merged headers\n        execHeaders(reqHeaders);\n        return reqHeaders;\n\n        function execHeaders(headers) {\n          var headerContent;\n\n          forEach(headers, function(headerFn, header) {\n            if (isFunction(headerFn)) {\n              headerContent = headerFn();\n              if (headerContent != null) {\n                headers[header] = headerContent;\n              } else {\n                delete headers[header];\n              }\n            }\n          });\n        }\n      }\n    }\n\n    $http.pendingRequests = [];\n\n    /**\n     * @ngdoc method\n     * @name $http#get\n     *\n     * @description\n     * Shortcut method to perform `GET` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#delete\n     *\n     * @description\n     * Shortcut method to perform `DELETE` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#head\n     *\n     * @description\n     * Shortcut method to perform `HEAD` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#jsonp\n     *\n     * @description\n     * Shortcut method to perform `JSONP` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request.\n     *                     The name of the callback should be the string `JSON_CALLBACK`.\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n    createShortMethods('get', 'delete', 'head', 'jsonp');\n\n    /**\n     * @ngdoc method\n     * @name $http#post\n     *\n     * @description\n     * Shortcut method to perform `POST` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#put\n     *\n     * @description\n     * Shortcut method to perform `PUT` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n    createShortMethodsWithData('post', 'put');\n\n        /**\n         * @ngdoc property\n         * @name $http#defaults\n         *\n         * @description\n         * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of\n         * default headers, withCredentials as well as request and response transformations.\n         *\n         * See \"Setting HTTP Headers\" and \"Transforming Requests and Responses\" sections above.\n         */\n    $http.defaults = defaults;\n\n\n    return $http;\n\n\n    function createShortMethods(names) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, config) {\n          return $http(extend(config || {}, {\n            method: name,\n            url: url\n          }));\n        };\n      });\n    }\n\n\n    function createShortMethodsWithData(name) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, data, config) {\n          return $http(extend(config || {}, {\n            method: name,\n            url: url,\n            data: data\n          }));\n        };\n      });\n    }\n\n\n    /**\n     * Makes the request.\n     *\n     * !!! ACCESSES CLOSURE VARS:\n     * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests\n     */\n    function sendReq(config, reqData, reqHeaders) {\n      var deferred = $q.defer(),\n          promise = deferred.promise,\n          cache,\n          cachedResp,\n          url = buildUrl(config.url, config.params);\n\n      $http.pendingRequests.push(config);\n      promise.then(removePendingReq, removePendingReq);\n\n\n      if ((config.cache || defaults.cache) && config.cache !== false &&\n          (config.method === 'GET' || config.method === 'JSONP')) {\n        cache = isObject(config.cache) ? config.cache\n              : isObject(defaults.cache) ? defaults.cache\n              : defaultCache;\n      }\n\n      if (cache) {\n        cachedResp = cache.get(url);\n        if (isDefined(cachedResp)) {\n          if (isPromiseLike(cachedResp)) {\n            // cached request has already been sent, but there is no response yet\n            cachedResp.then(removePendingReq, removePendingReq);\n            return cachedResp;\n          } else {\n            // serving from cache\n            if (isArray(cachedResp)) {\n              resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);\n            } else {\n              resolvePromise(cachedResp, 200, {}, 'OK');\n            }\n          }\n        } else {\n          // put the promise for the non-transformed response into cache as a placeholder\n          cache.put(url, promise);\n        }\n      }\n\n\n      // if we won't have the response in cache, set the xsrf headers and\n      // send the request to the backend\n      if (isUndefined(cachedResp)) {\n        var xsrfValue = urlIsSameOrigin(config.url)\n            ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName]\n            : undefined;\n        if (xsrfValue) {\n          reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;\n        }\n\n        $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,\n            config.withCredentials, config.responseType);\n      }\n\n      return promise;\n\n\n      /**\n       * Callback registered to $httpBackend():\n       *  - caches the response if desired\n       *  - resolves the raw $http promise\n       *  - calls $apply\n       */\n      function done(status, response, headersString, statusText) {\n        if (cache) {\n          if (isSuccess(status)) {\n            cache.put(url, [status, response, parseHeaders(headersString), statusText]);\n          } else {\n            // remove promise from the cache\n            cache.remove(url);\n          }\n        }\n\n        resolvePromise(response, status, headersString, statusText);\n        if (!$rootScope.$$phase) $rootScope.$apply();\n      }\n\n\n      /**\n       * Resolves the raw $http promise.\n       */\n      function resolvePromise(response, status, headers, statusText) {\n        // normalize internal statuses to 0\n        status = Math.max(status, 0);\n\n        (isSuccess(status) ? deferred.resolve : deferred.reject)({\n          data: response,\n          status: status,\n          headers: headersGetter(headers),\n          config: config,\n          statusText : statusText\n        });\n      }\n\n\n      function removePendingReq() {\n        var idx = indexOf($http.pendingRequests, config);\n        if (idx !== -1) $http.pendingRequests.splice(idx, 1);\n      }\n    }\n\n\n    function buildUrl(url, params) {\n      if (!params) return url;\n      var parts = [];\n      forEachSorted(params, function(value, key) {\n        if (value === null || isUndefined(value)) return;\n        if (!isArray(value)) value = [value];\n\n        forEach(value, function(v) {\n          if (isObject(v)) {\n            if (isDate(v)){\n              v = v.toISOString();\n            } else {\n              v = toJson(v);\n            }\n          }\n          parts.push(encodeUriQuery(key) + '=' +\n                     encodeUriQuery(v));\n        });\n      });\n      if(parts.length > 0) {\n        url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');\n      }\n      return url;\n    }\n  }];\n}\n\nfunction createXhr(method) {\n    //if IE and the method is not RFC2616 compliant, or if XMLHttpRequest\n    //is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest\n    //if it is available\n    if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||\n      !window.XMLHttpRequest)) {\n      return new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n    } else if (window.XMLHttpRequest) {\n      return new window.XMLHttpRequest();\n    }\n\n    throw minErr('$httpBackend')('noxhr', \"This browser does not support XMLHttpRequest.\");\n}\n\n/**\n * @ngdoc service\n * @name $httpBackend\n * @requires $window\n * @requires $document\n *\n * @description\n * HTTP backend used by the {@link ng.$http service} that delegates to\n * XMLHttpRequest object or JSONP and deals with browser incompatibilities.\n *\n * You should never need to use this service directly, instead use the higher-level abstractions:\n * {@link ng.$http $http} or {@link ngResource.$resource $resource}.\n *\n * During testing this implementation is swapped with {@link ngMock.$httpBackend mock\n * $httpBackend} which can be trained with responses.\n */\nfunction $HttpBackendProvider() {\n  this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) {\n    return createHttpBackend($browser, createXhr, $browser.defer, $window.angular.callbacks, $document[0]);\n  }];\n}\n\nfunction createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {\n  var ABORTED = -1;\n\n  // TODO(vojta): fix the signature\n  return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {\n    var status;\n    $browser.$$incOutstandingRequestCount();\n    url = url || $browser.url();\n\n    if (lowercase(method) == 'jsonp') {\n      var callbackId = '_' + (callbacks.counter++).toString(36);\n      callbacks[callbackId] = function(data) {\n        callbacks[callbackId].data = data;\n        callbacks[callbackId].called = true;\n      };\n\n      var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),\n          callbackId, function(status, text) {\n        completeRequest(callback, status, callbacks[callbackId].data, \"\", text);\n        callbacks[callbackId] = noop;\n      });\n    } else {\n\n      var xhr = createXhr(method);\n\n      xhr.open(method, url, true);\n      forEach(headers, function(value, key) {\n        if (isDefined(value)) {\n            xhr.setRequestHeader(key, value);\n        }\n      });\n\n      // In IE6 and 7, this might be called synchronously when xhr.send below is called and the\n      // response is in the cache. the promise api will ensure that to the app code the api is\n      // always async\n      xhr.onreadystatechange = function() {\n        // onreadystatechange might get called multiple times with readyState === 4 on mobile webkit caused by\n        // xhrs that are resolved while the app is in the background (see #5426).\n        // since calling completeRequest sets the `xhr` variable to null, we just check if it's not null before\n        // continuing\n        //\n        // we can't set xhr.onreadystatechange to undefined or delete it because that breaks IE8 (method=PATCH) and\n        // Safari respectively.\n        if (xhr && xhr.readyState == 4) {\n          var responseHeaders = null,\n              response = null,\n              statusText = '';\n\n          if(status !== ABORTED) {\n            responseHeaders = xhr.getAllResponseHeaders();\n\n            // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n            // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n            response = ('response' in xhr) ? xhr.response : xhr.responseText;\n          }\n\n          // Accessing statusText on an aborted xhr object will\n          // throw an 'c00c023f error' in IE9 and lower, don't touch it.\n          if (!(status === ABORTED && msie < 10)) {\n            statusText = xhr.statusText;\n          }\n\n          completeRequest(callback,\n              status || xhr.status,\n              response,\n              responseHeaders,\n              statusText);\n        }\n      };\n\n      if (withCredentials) {\n        xhr.withCredentials = true;\n      }\n\n      if (responseType) {\n        try {\n          xhr.responseType = responseType;\n        } catch (e) {\n          // WebKit added support for the json responseType value on 09/03/2013\n          // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are\n          // known to throw when setting the value \"json\" as the response type. Other older\n          // browsers implementing the responseType\n          //\n          // The json response type can be ignored if not supported, because JSON payloads are\n          // parsed on the client-side regardless.\n          if (responseType !== 'json') {\n            throw e;\n          }\n        }\n      }\n\n      xhr.send(post || null);\n    }\n\n    if (timeout > 0) {\n      var timeoutId = $browserDefer(timeoutRequest, timeout);\n    } else if (isPromiseLike(timeout)) {\n      timeout.then(timeoutRequest);\n    }\n\n\n    function timeoutRequest() {\n      status = ABORTED;\n      jsonpDone && jsonpDone();\n      xhr && xhr.abort();\n    }\n\n    function completeRequest(callback, status, response, headersString, statusText) {\n      // cancel timeout and subsequent timeout promise resolution\n      timeoutId && $browserDefer.cancel(timeoutId);\n      jsonpDone = xhr = null;\n\n      // fix status code when it is 0 (0 status is undocumented).\n      // Occurs when accessing file resources or on Android 4.1 stock browser\n      // while retrieving files from application cache.\n      if (status === 0) {\n        status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;\n      }\n\n      // normalize IE bug (http://bugs.jquery.com/ticket/1450)\n      status = status === 1223 ? 204 : status;\n      statusText = statusText || '';\n\n      callback(status, response, headersString, statusText);\n      $browser.$$completeOutstandingRequest(noop);\n    }\n  };\n\n  function jsonpReq(url, callbackId, done) {\n    // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:\n    // - fetches local scripts via XHR and evals them\n    // - adds and immediately removes script elements from the document\n    var script = rawDocument.createElement('script'), callback = null;\n    script.type = \"text/javascript\";\n    script.src = url;\n    script.async = true;\n\n    callback = function(event) {\n      removeEventListenerFn(script, \"load\", callback);\n      removeEventListenerFn(script, \"error\", callback);\n      rawDocument.body.removeChild(script);\n      script = null;\n      var status = -1;\n      var text = \"unknown\";\n\n      if (event) {\n        if (event.type === \"load\" && !callbacks[callbackId].called) {\n          event = { type: \"error\" };\n        }\n        text = event.type;\n        status = event.type === \"error\" ? 404 : 200;\n      }\n\n      if (done) {\n        done(status, text);\n      }\n    };\n\n    addEventListenerFn(script, \"load\", callback);\n    addEventListenerFn(script, \"error\", callback);\n\n    if (msie <= 8) {\n      script.onreadystatechange = function() {\n        if (isString(script.readyState) && /loaded|complete/.test(script.readyState)) {\n          script.onreadystatechange = null;\n          callback({\n            type: 'load'\n          });\n        }\n      };\n    }\n\n    rawDocument.body.appendChild(script);\n    return callback;\n  }\n}\n\nvar $interpolateMinErr = minErr('$interpolate');\n\n/**\n * @ngdoc provider\n * @name $interpolateProvider\n * @kind function\n *\n * @description\n *\n * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.\n *\n * @example\n<example module=\"customInterpolationApp\">\n<file name=\"index.html\">\n<script>\n  var customInterpolationApp = angular.module('customInterpolationApp', []);\n\n  customInterpolationApp.config(function($interpolateProvider) {\n    $interpolateProvider.startSymbol('//');\n    $interpolateProvider.endSymbol('//');\n  });\n\n\n  customInterpolationApp.controller('DemoController', function() {\n      this.label = \"This binding is brought you by // interpolation symbols.\";\n  });\n</script>\n<div ng-app=\"App\" ng-controller=\"DemoController as demo\">\n    //demo.label//\n</div>\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  it('should interpolate binding with custom symbols', function() {\n    expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');\n  });\n</file>\n</example>\n */\nfunction $InterpolateProvider() {\n  var startSymbol = '{{';\n  var endSymbol = '}}';\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#startSymbol\n   * @description\n   * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.\n   *\n   * @param {string=} value new value to set the starting symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.startSymbol = function(value){\n    if (value) {\n      startSymbol = value;\n      return this;\n    } else {\n      return startSymbol;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#endSymbol\n   * @description\n   * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n   *\n   * @param {string=} value new value to set the ending symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.endSymbol = function(value){\n    if (value) {\n      endSymbol = value;\n      return this;\n    } else {\n      return endSymbol;\n    }\n  };\n\n\n  this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {\n    var startSymbolLength = startSymbol.length,\n        endSymbolLength = endSymbol.length;\n\n    /**\n     * @ngdoc service\n     * @name $interpolate\n     * @kind function\n     *\n     * @requires $parse\n     * @requires $sce\n     *\n     * @description\n     *\n     * Compiles a string with markup into an interpolation function. This service is used by the\n     * HTML {@link ng.$compile $compile} service for data binding. See\n     * {@link ng.$interpolateProvider $interpolateProvider} for configuring the\n     * interpolation markup.\n     *\n     *\n     * ```js\n     *   var $interpolate = ...; // injected\n     *   var exp = $interpolate('Hello {{name | uppercase}}!');\n     *   expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!');\n     * ```\n     *\n     *\n     * @param {string} text The text with markup to interpolate.\n     * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have\n     *    embedded expression in order to return an interpolation function. Strings with no\n     *    embedded expression will return null for the interpolation function.\n     * @param {string=} trustedContext when provided, the returned function passes the interpolated\n     *    result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,\n     *    trustedContext)} before returning it.  Refer to the {@link ng.$sce $sce} service that\n     *    provides Strict Contextual Escaping for details.\n     * @returns {function(context)} an interpolation function which is used to compute the\n     *    interpolated string. The function has these parameters:\n     *\n     *    * `context`: an object against which any expressions embedded in the strings are evaluated\n     *      against.\n     *\n     */\n    function $interpolate(text, mustHaveExpression, trustedContext) {\n      var startIndex,\n          endIndex,\n          index = 0,\n          parts = [],\n          length = text.length,\n          hasInterpolation = false,\n          fn,\n          exp,\n          concat = [];\n\n      while(index < length) {\n        if ( ((startIndex = text.indexOf(startSymbol, index)) != -1) &&\n             ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1) ) {\n          (index != startIndex) && parts.push(text.substring(index, startIndex));\n          parts.push(fn = $parse(exp = text.substring(startIndex + startSymbolLength, endIndex)));\n          fn.exp = exp;\n          index = endIndex + endSymbolLength;\n          hasInterpolation = true;\n        } else {\n          // we did not find anything, so we have to add the remainder to the parts array\n          (index != length) && parts.push(text.substring(index));\n          index = length;\n        }\n      }\n\n      if (!(length = parts.length)) {\n        // we added, nothing, must have been an empty string.\n        parts.push('');\n        length = 1;\n      }\n\n      // Concatenating expressions makes it hard to reason about whether some combination of\n      // concatenated values are unsafe to use and could easily lead to XSS.  By requiring that a\n      // single expression be used for iframe[src], object[src], etc., we ensure that the value\n      // that's used is assigned or constructed by some JS code somewhere that is more testable or\n      // make it obvious that you bound the value to some user controlled value.  This helps reduce\n      // the load when auditing for XSS issues.\n      if (trustedContext && parts.length > 1) {\n          throw $interpolateMinErr('noconcat',\n              \"Error while interpolating: {0}\\nStrict Contextual Escaping disallows \" +\n              \"interpolations that concatenate multiple expressions when a trusted value is \" +\n              \"required.  See http://docs.angularjs.org/api/ng.$sce\", text);\n      }\n\n      if (!mustHaveExpression  || hasInterpolation) {\n        concat.length = length;\n        fn = function(context) {\n          try {\n            for(var i = 0, ii = length, part; i<ii; i++) {\n              if (typeof (part = parts[i]) == 'function') {\n                part = part(context);\n                if (trustedContext) {\n                  part = $sce.getTrusted(trustedContext, part);\n                } else {\n                  part = $sce.valueOf(part);\n                }\n                if (part == null) { // null || undefined\n                  part = '';\n                } else {\n                  switch (typeof part) {\n                    case 'string':\n                    {\n                      break;\n                    }\n                    case 'number':\n                    {\n                      part = '' + part;\n                      break;\n                    }\n                    default:\n                    {\n                      part = toJson(part);\n                    }\n                  }\n                }\n              }\n              concat[i] = part;\n            }\n            return concat.join('');\n          }\n          catch(err) {\n            var newErr = $interpolateMinErr('interr', \"Can't interpolate: {0}\\n{1}\", text,\n                err.toString());\n            $exceptionHandler(newErr);\n          }\n        };\n        fn.exp = text;\n        fn.parts = parts;\n        return fn;\n      }\n    }\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#startSymbol\n     * @description\n     * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.\n     *\n     * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change\n     * the symbol.\n     *\n     * @returns {string} start symbol.\n     */\n    $interpolate.startSymbol = function() {\n      return startSymbol;\n    };\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#endSymbol\n     * @description\n     * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n     *\n     * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change\n     * the symbol.\n     *\n     * @returns {string} end symbol.\n     */\n    $interpolate.endSymbol = function() {\n      return endSymbol;\n    };\n\n    return $interpolate;\n  }];\n}\n\nfunction $IntervalProvider() {\n  this.$get = ['$rootScope', '$window', '$q',\n       function($rootScope,   $window,   $q) {\n    var intervals = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $interval\n      *\n      * @description\n      * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`\n      * milliseconds.\n      *\n      * The return value of registering an interval function is a promise. This promise will be\n      * notified upon each tick of the interval, and will be resolved after `count` iterations, or\n      * run indefinitely if `count` is not defined. The value of the notification will be the\n      * number of iterations that have run.\n      * To cancel an interval, call `$interval.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to\n      * move forward by `millis` milliseconds and trigger any functions scheduled to run in that\n      * time.\n      *\n      * <div class=\"alert alert-warning\">\n      * **Note**: Intervals created by this service must be explicitly destroyed when you are finished\n      * with them.  In particular they are not automatically destroyed when a controller's scope or a\n      * directive's element are destroyed.\n      * You should take this into consideration and make sure to always cancel the interval at the\n      * appropriate moment.  See the example below for more details on how and when to do this.\n      * </div>\n      *\n      * @param {function()} fn A function that should be called repeatedly.\n      * @param {number} delay Number of milliseconds between each function call.\n      * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat\n      *   indefinitely.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @returns {promise} A promise which will be notified on each iteration.\n      *\n      * @example\n      * <example module=\"intervalExample\">\n      * <file name=\"index.html\">\n      *   <script>\n      *     angular.module('intervalExample', [])\n      *       .controller('ExampleController', ['$scope', '$interval',\n      *         function($scope, $interval) {\n      *           $scope.format = 'M/d/yy h:mm:ss a';\n      *           $scope.blood_1 = 100;\n      *           $scope.blood_2 = 120;\n      *\n      *           var stop;\n      *           $scope.fight = function() {\n      *             // Don't start a new fight if we are already fighting\n      *             if ( angular.isDefined(stop) ) return;\n      *\n      *           stop = $interval(function() {\n      *             if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {\n      *               $scope.blood_1 = $scope.blood_1 - 3;\n      *               $scope.blood_2 = $scope.blood_2 - 4;\n      *             } else {\n      *               $scope.stopFight();\n      *             }\n      *           }, 100);\n      *         };\n      *\n      *         $scope.stopFight = function() {\n      *           if (angular.isDefined(stop)) {\n      *             $interval.cancel(stop);\n      *             stop = undefined;\n      *           }\n      *         };\n      *\n      *         $scope.resetFight = function() {\n      *           $scope.blood_1 = 100;\n      *           $scope.blood_2 = 120;\n      *         };\n      *\n      *         $scope.$on('$destroy', function() {\n      *           // Make sure that the interval is destroyed too\n      *           $scope.stopFight();\n      *         });\n      *       }])\n      *       // Register the 'myCurrentTime' directive factory method.\n      *       // We inject $interval and dateFilter service since the factory method is DI.\n      *       .directive('myCurrentTime', ['$interval', 'dateFilter',\n      *         function($interval, dateFilter) {\n      *           // return the directive link function. (compile function not needed)\n      *           return function(scope, element, attrs) {\n      *             var format,  // date format\n      *                 stopTime; // so that we can cancel the time updates\n      *\n      *             // used to update the UI\n      *             function updateTime() {\n      *               element.text(dateFilter(new Date(), format));\n      *             }\n      *\n      *             // watch the expression, and update the UI on change.\n      *             scope.$watch(attrs.myCurrentTime, function(value) {\n      *               format = value;\n      *               updateTime();\n      *             });\n      *\n      *             stopTime = $interval(updateTime, 1000);\n      *\n      *             // listen on DOM destroy (removal) event, and cancel the next UI update\n      *             // to prevent updating time after the DOM element was removed.\n      *             element.bind('$destroy', function() {\n      *               $interval.cancel(stopTime);\n      *             });\n      *           }\n      *         }]);\n      *   </script>\n      *\n      *   <div>\n      *     <div ng-controller=\"ExampleController\">\n      *       Date format: <input ng-model=\"format\"> <hr/>\n      *       Current time is: <span my-current-time=\"format\"></span>\n      *       <hr/>\n      *       Blood 1 : <font color='red'>{{blood_1}}</font>\n      *       Blood 2 : <font color='red'>{{blood_2}}</font>\n      *       <button type=\"button\" data-ng-click=\"fight()\">Fight</button>\n      *       <button type=\"button\" data-ng-click=\"stopFight()\">StopFight</button>\n      *       <button type=\"button\" data-ng-click=\"resetFight()\">resetFight</button>\n      *     </div>\n      *   </div>\n      *\n      * </file>\n      * </example>\n      */\n    function interval(fn, delay, count, invokeApply) {\n      var setInterval = $window.setInterval,\n          clearInterval = $window.clearInterval,\n          deferred = $q.defer(),\n          promise = deferred.promise,\n          iteration = 0,\n          skipApply = (isDefined(invokeApply) && !invokeApply);\n\n      count = isDefined(count) ? count : 0;\n\n      promise.then(null, null, fn);\n\n      promise.$$intervalId = setInterval(function tick() {\n        deferred.notify(iteration++);\n\n        if (count > 0 && iteration >= count) {\n          deferred.resolve(iteration);\n          clearInterval(promise.$$intervalId);\n          delete intervals[promise.$$intervalId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n\n      }, delay);\n\n      intervals[promise.$$intervalId] = deferred;\n\n      return promise;\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $interval#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`.\n      *\n      * @param {promise} promise returned by the `$interval` function.\n      * @returns {boolean} Returns `true` if the task was successfully canceled.\n      */\n    interval.cancel = function(promise) {\n      if (promise && promise.$$intervalId in intervals) {\n        intervals[promise.$$intervalId].reject('canceled');\n        $window.clearInterval(promise.$$intervalId);\n        delete intervals[promise.$$intervalId];\n        return true;\n      }\n      return false;\n    };\n\n    return interval;\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $locale\n *\n * @description\n * $locale service provides localization rules for various Angular components. As of right now the\n * only public api is:\n *\n * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)\n */\nfunction $LocaleProvider(){\n  this.$get = function() {\n    return {\n      id: 'en-us',\n\n      NUMBER_FORMATS: {\n        DECIMAL_SEP: '.',\n        GROUP_SEP: ',',\n        PATTERNS: [\n          { // Decimal Pattern\n            minInt: 1,\n            minFrac: 0,\n            maxFrac: 3,\n            posPre: '',\n            posSuf: '',\n            negPre: '-',\n            negSuf: '',\n            gSize: 3,\n            lgSize: 3\n          },{ //Currency Pattern\n            minInt: 1,\n            minFrac: 2,\n            maxFrac: 2,\n            posPre: '\\u00A4',\n            posSuf: '',\n            negPre: '(\\u00A4',\n            negSuf: ')',\n            gSize: 3,\n            lgSize: 3\n          }\n        ],\n        CURRENCY_SYM: '$'\n      },\n\n      DATETIME_FORMATS: {\n        MONTH:\n            'January,February,March,April,May,June,July,August,September,October,November,December'\n            .split(','),\n        SHORTMONTH:  'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),\n        DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),\n        SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),\n        AMPMS: ['AM','PM'],\n        medium: 'MMM d, y h:mm:ss a',\n        short: 'M/d/yy h:mm a',\n        fullDate: 'EEEE, MMMM d, y',\n        longDate: 'MMMM d, y',\n        mediumDate: 'MMM d, y',\n        shortDate: 'M/d/yy',\n        mediumTime: 'h:mm:ss a',\n        shortTime: 'h:mm a'\n      },\n\n      pluralCat: function(num) {\n        if (num === 1) {\n          return 'one';\n        }\n        return 'other';\n      }\n    };\n  };\n}\n\nvar PATH_MATCH = /^([^\\?#]*)(\\?([^#]*))?(#(.*))?$/,\n    DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};\nvar $locationMinErr = minErr('$location');\n\n\n/**\n * Encode path using encodeUriSegment, ignoring forward slashes\n *\n * @param {string} path Path to encode\n * @returns {string}\n */\nfunction encodePath(path) {\n  var segments = path.split('/'),\n      i = segments.length;\n\n  while (i--) {\n    segments[i] = encodeUriSegment(segments[i]);\n  }\n\n  return segments.join('/');\n}\n\nfunction parseAbsoluteUrl(absoluteUrl, locationObj, appBase) {\n  var parsedUrl = urlResolve(absoluteUrl, appBase);\n\n  locationObj.$$protocol = parsedUrl.protocol;\n  locationObj.$$host = parsedUrl.hostname;\n  locationObj.$$port = int(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;\n}\n\n\nfunction parseAppUrl(relativeUrl, locationObj, appBase) {\n  var prefixed = (relativeUrl.charAt(0) !== '/');\n  if (prefixed) {\n    relativeUrl = '/' + relativeUrl;\n  }\n  var match = urlResolve(relativeUrl, appBase);\n  locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?\n      match.pathname.substring(1) : match.pathname);\n  locationObj.$$search = parseKeyValue(match.search);\n  locationObj.$$hash = decodeURIComponent(match.hash);\n\n  // make sure path starts with '/';\n  if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {\n    locationObj.$$path = '/' + locationObj.$$path;\n  }\n}\n\n\n/**\n *\n * @param {string} begin\n * @param {string} whole\n * @returns {string} returns text from whole after begin or undefined if it does not begin with\n *                   expected string.\n */\nfunction beginsWith(begin, whole) {\n  if (whole.indexOf(begin) === 0) {\n    return whole.substr(begin.length);\n  }\n}\n\n\nfunction stripHash(url) {\n  var index = url.indexOf('#');\n  return index == -1 ? url : url.substr(0, index);\n}\n\n\nfunction stripFile(url) {\n  return url.substr(0, stripHash(url).lastIndexOf('/') + 1);\n}\n\n/* return the server only (scheme://host:port) */\nfunction serverBase(url) {\n  return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));\n}\n\n\n/**\n * LocationHtml5Url represents an url\n * This object is exposed as $location service when HTML5 mode is enabled and supported\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} basePrefix url path prefix\n */\nfunction LocationHtml5Url(appBase, basePrefix) {\n  this.$$html5 = true;\n  basePrefix = basePrefix || '';\n  var appBaseNoFile = stripFile(appBase);\n  parseAbsoluteUrl(appBase, this, appBase);\n\n\n  /**\n   * Parse given html5 (regular) url string into properties\n   * @param {string} newAbsoluteUrl HTML5 url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var pathUrl = beginsWith(appBaseNoFile, url);\n    if (!isString(pathUrl)) {\n      throw $locationMinErr('ipthprfx', 'Invalid url \"{0}\", missing path prefix \"{1}\".', url,\n          appBaseNoFile);\n    }\n\n    parseAppUrl(pathUrl, this, appBase);\n\n    if (!this.$$path) {\n      this.$$path = '/';\n    }\n\n    this.$$compose();\n  };\n\n  /**\n   * Compose url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'\n  };\n\n  this.$$rewrite = function(url) {\n    var appUrl, prevAppUrl;\n\n    if ( (appUrl = beginsWith(appBase, url)) !== undefined ) {\n      prevAppUrl = appUrl;\n      if ( (appUrl = beginsWith(basePrefix, appUrl)) !== undefined ) {\n        return appBaseNoFile + (beginsWith('/', appUrl) || appUrl);\n      } else {\n        return appBase + prevAppUrl;\n      }\n    } else if ( (appUrl = beginsWith(appBaseNoFile, url)) !== undefined ) {\n      return appBaseNoFile + appUrl;\n    } else if (appBaseNoFile == url + '/') {\n      return appBaseNoFile;\n    }\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when developer doesn't opt into html5 mode.\n * It also serves as the base class for html5 mode fallback on legacy browsers.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangUrl(appBase, hashPrefix) {\n  var appBaseNoFile = stripFile(appBase);\n\n  parseAbsoluteUrl(appBase, this, appBase);\n\n\n  /**\n   * Parse given hashbang url into properties\n   * @param {string} url Hashbang url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);\n    var withoutHashUrl = withoutBaseUrl.charAt(0) == '#'\n        ? beginsWith(hashPrefix, withoutBaseUrl)\n        : (this.$$html5)\n          ? withoutBaseUrl\n          : '';\n\n    if (!isString(withoutHashUrl)) {\n      throw $locationMinErr('ihshprfx', 'Invalid url \"{0}\", missing hash prefix \"{1}\".', url,\n          hashPrefix);\n    }\n    parseAppUrl(withoutHashUrl, this, appBase);\n\n    this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);\n\n    this.$$compose();\n\n    /*\n     * In Windows, on an anchor node on documents loaded from\n     * the filesystem, the browser will return a pathname\n     * prefixed with the drive name ('/C:/path') when a\n     * pathname without a drive is set:\n     *  * a.setAttribute('href', '/foo')\n     *   * a.pathname === '/C:/foo' //true\n     *\n     * Inside of Angular, we're always using pathnames that\n     * do not include drive names for routing.\n     */\n    function removeWindowsDriveName (path, url, base) {\n      /*\n      Matches paths for file protocol on windows,\n      such as /C:/foo/bar, and captures only /foo/bar.\n      */\n      var windowsFilePathExp = /^\\/[A-Z]:(\\/.*)/;\n\n      var firstPathSegmentMatch;\n\n      //Get the relative path from the input URL.\n      if (url.indexOf(base) === 0) {\n        url = url.replace(base, '');\n      }\n\n      // The input URL intentionally contains a first path segment that ends with a colon.\n      if (windowsFilePathExp.exec(url)) {\n        return path;\n      }\n\n      firstPathSegmentMatch = windowsFilePathExp.exec(path);\n      return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;\n    }\n  };\n\n  /**\n   * Compose hashbang url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');\n  };\n\n  this.$$rewrite = function(url) {\n    if(stripHash(appBase) == stripHash(url)) {\n      return url;\n    }\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when html5 history api is enabled but the browser\n * does not support it.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangInHtml5Url(appBase, hashPrefix) {\n  this.$$html5 = true;\n  LocationHashbangUrl.apply(this, arguments);\n\n  var appBaseNoFile = stripFile(appBase);\n\n  this.$$rewrite = function(url) {\n    var appUrl;\n\n    if ( appBase == stripHash(url) ) {\n      return url;\n    } else if ( (appUrl = beginsWith(appBaseNoFile, url)) ) {\n      return appBase + hashPrefix + appUrl;\n    } else if ( appBaseNoFile === url + '/') {\n      return appBaseNoFile;\n    }\n  };\n\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    // include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#'\n    this.$$absUrl = appBase + hashPrefix + this.$$url;\n  };\n\n}\n\n\nLocationHashbangInHtml5Url.prototype =\n  LocationHashbangUrl.prototype =\n  LocationHtml5Url.prototype = {\n\n  /**\n   * Are we in html5 mode?\n   * @private\n   */\n  $$html5: false,\n\n  /**\n   * Has any change been replacing ?\n   * @private\n   */\n  $$replace: false,\n\n  /**\n   * @ngdoc method\n   * @name $location#absUrl\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return full url representation with all segments encoded according to rules specified in\n   * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).\n   *\n   * @return {string} full url\n   */\n  absUrl: locationGetter('$$absUrl'),\n\n  /**\n   * @ngdoc method\n   * @name $location#url\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return url (e.g. `/path?a=b#hash`) when called without any parameter.\n   *\n   * Change path, search and hash, when called with parameter and return `$location`.\n   *\n   * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)\n   * @return {string} url\n   */\n  url: function(url) {\n    if (isUndefined(url))\n      return this.$$url;\n\n    var match = PATH_MATCH.exec(url);\n    if (match[1]) this.path(decodeURIComponent(match[1]));\n    if (match[2] || match[1]) this.search(match[3] || '');\n    this.hash(match[5] || '');\n\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#protocol\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return protocol of current url.\n   *\n   * @return {string} protocol of current url\n   */\n  protocol: locationGetter('$$protocol'),\n\n  /**\n   * @ngdoc method\n   * @name $location#host\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return host of current url.\n   *\n   * @return {string} host of current url.\n   */\n  host: locationGetter('$$host'),\n\n  /**\n   * @ngdoc method\n   * @name $location#port\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return port of current url.\n   *\n   * @return {Number} port\n   */\n  port: locationGetter('$$port'),\n\n  /**\n   * @ngdoc method\n   * @name $location#path\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return path of current url when called without any parameter.\n   *\n   * Change path when called with parameter and return `$location`.\n   *\n   * Note: Path should always begin with forward slash (/), this method will add the forward slash\n   * if it is missing.\n   *\n   * @param {(string|number)=} path New path\n   * @return {string} path\n   */\n  path: locationGetterSetter('$$path', function(path) {\n    path = path ? path.toString() : '';\n    return path.charAt(0) == '/' ? path : '/' + path;\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#search\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return search part (as object) of current url when called without any parameter.\n   *\n   * Change search part when called with parameter and return `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var searchObject = $location.search();\n   * // => {foo: 'bar', baz: 'xoxo'}\n   *\n   *\n   * // set foo to 'yipee'\n   * $location.search('foo', 'yipee');\n   * // => $location\n   * ```\n   *\n   * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or\n   * hash object.\n   *\n   * When called with a single argument the method acts as a setter, setting the `search` component\n   * of `$location` to the specified value.\n   *\n   * If the argument is a hash object containing an array of values, these values will be encoded\n   * as duplicate search parameters in the url.\n   *\n   * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`\n   * will override only a single search property.\n   *\n   * If `paramValue` is an array, it will override the property of the `search` component of\n   * `$location` specified via the first argument.\n   *\n   * If `paramValue` is `null`, the property specified via the first argument will be deleted.\n   *\n   * If `paramValue` is `true`, the property specified via the first argument will be added with no\n   * value nor trailing equal sign.\n   *\n   * @return {Object} If called with no arguments returns the parsed `search` object. If called with\n   * one or more arguments returns `$location` object itself.\n   */\n  search: function(search, paramValue) {\n    switch (arguments.length) {\n      case 0:\n        return this.$$search;\n      case 1:\n        if (isString(search) || isNumber(search)) {\n          search = search.toString();\n          this.$$search = parseKeyValue(search);\n        } else if (isObject(search)) {\n          // remove object undefined or null properties\n          forEach(search, function(value, key) {\n            if (value == null) delete search[key];\n          });\n\n          this.$$search = search;\n        } else {\n          throw $locationMinErr('isrcharg',\n              'The first argument of the `$location#search()` call must be a string or an object.');\n        }\n        break;\n      default:\n        if (isUndefined(paramValue) || paramValue === null) {\n          delete this.$$search[search];\n        } else {\n          this.$$search[search] = paramValue;\n        }\n    }\n\n    this.$$compose();\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#hash\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return hash fragment when called without any parameter.\n   *\n   * Change hash fragment when called with parameter and return `$location`.\n   *\n   * @param {(string|number)=} hash New hash fragment\n   * @return {string} hash\n   */\n  hash: locationGetterSetter('$$hash', function(hash) {\n    return hash ? hash.toString() : '';\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#replace\n   *\n   * @description\n   * If called, all changes to $location during current `$digest` will be replacing current history\n   * record, instead of adding new one.\n   */\n  replace: function() {\n    this.$$replace = true;\n    return this;\n  }\n};\n\nfunction locationGetter(property) {\n  return function() {\n    return this[property];\n  };\n}\n\n\nfunction locationGetterSetter(property, preprocess) {\n  return function(value) {\n    if (isUndefined(value))\n      return this[property];\n\n    this[property] = preprocess(value);\n    this.$$compose();\n\n    return this;\n  };\n}\n\n\n/**\n * @ngdoc service\n * @name $location\n *\n * @requires $rootElement\n *\n * @description\n * The $location service parses the URL in the browser address bar (based on the\n * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL\n * available to your application. Changes to the URL in the address bar are reflected into\n * $location service and changes to $location are reflected into the browser address bar.\n *\n * **The $location service:**\n *\n * - Exposes the current URL in the browser address bar, so you can\n *   - Watch and observe the URL.\n *   - Change the URL.\n * - Synchronizes the URL with the browser when the user\n *   - Changes the address bar.\n *   - Clicks the back or forward button (or clicks a History link).\n *   - Clicks on a link.\n * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).\n *\n * For more information see {@link guide/$location Developer Guide: Using $location}\n */\n\n/**\n * @ngdoc provider\n * @name $locationProvider\n * @description\n * Use the `$locationProvider` to configure how the application deep linking paths are stored.\n */\nfunction $LocationProvider(){\n  var hashPrefix = '',\n      html5Mode = false;\n\n  /**\n   * @ngdoc method\n   * @name $locationProvider#hashPrefix\n   * @description\n   * @param {string=} prefix Prefix for hash part (containing path and search)\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.hashPrefix = function(prefix) {\n    if (isDefined(prefix)) {\n      hashPrefix = prefix;\n      return this;\n    } else {\n      return hashPrefix;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $locationProvider#html5Mode\n   * @description\n   * @param {boolean=} mode Use HTML5 strategy if available.\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.html5Mode = function(mode) {\n    if (isDefined(mode)) {\n      html5Mode = mode;\n      return this;\n    } else {\n      return html5Mode;\n    }\n  };\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeStart\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted before a URL will change. This change can be prevented by calling\n   * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more\n   * details about event object. Upon successful change\n   * {@link ng.$location#events_$locationChangeSuccess $locationChangeSuccess} is fired.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   */\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeSuccess\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted after a URL was changed.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   */\n\n  this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement',\n      function( $rootScope,   $browser,   $sniffer,   $rootElement) {\n    var $location,\n        LocationMode,\n        baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''\n        initialUrl = $browser.url(),\n        appBase;\n\n    if (html5Mode) {\n      appBase = serverBase(initialUrl) + (baseHref || '/');\n      LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;\n    } else {\n      appBase = stripHash(initialUrl);\n      LocationMode = LocationHashbangUrl;\n    }\n    $location = new LocationMode(appBase, '#' + hashPrefix);\n    $location.$$parse($location.$$rewrite(initialUrl));\n\n    var IGNORE_URI_REGEXP = /^\\s*(javascript|mailto):/i;\n\n    $rootElement.on('click', function(event) {\n      // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)\n      // currently we open nice url link and redirect then\n\n      if (event.ctrlKey || event.metaKey || event.which == 2) return;\n\n      var elm = jqLite(event.target);\n\n      // traverse the DOM up to find first A tag\n      while (lowercase(elm[0].nodeName) !== 'a') {\n        // ignore rewriting if no A tag (reached root element, or no parent - removed from document)\n        if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;\n      }\n\n      var absHref = elm.prop('href');\n\n      if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {\n        // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during\n        // an animation.\n        absHref = urlResolve(absHref.animVal).href;\n      }\n\n      // Ignore when url is started with javascript: or mailto:\n      if (IGNORE_URI_REGEXP.test(absHref)) return;\n\n      // Make relative links work in HTML5 mode for legacy browsers (or at least IE8 & 9)\n      // The href should be a regular url e.g. /link/somewhere or link/somewhere or ../somewhere or\n      // somewhere#anchor or http://example.com/somewhere\n      if (LocationMode === LocationHashbangInHtml5Url) {\n        // get the actual href attribute - see\n        // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx\n        var href = elm.attr('href') || elm.attr('xlink:href');\n\n        if (href && href.indexOf('://') < 0) {         // Ignore absolute URLs\n          var prefix = '#' + hashPrefix;\n          if (href[0] == '/') {\n            // absolute path - replace old path\n            absHref = appBase + prefix + href;\n          } else if (href[0] == '#') {\n            // local anchor\n            absHref = appBase + prefix + ($location.path() || '/') + href;\n          } else {\n            // relative path - join with current path\n            var stack = $location.path().split(\"/\"),\n              parts = href.split(\"/\");\n            if (stack.length === 2 && !stack[1]) stack.length = 1;\n            for (var i=0; i<parts.length; i++) {\n              if (parts[i] == \".\")\n                continue;\n              else if (parts[i] == \"..\")\n                stack.pop();\n              else if (parts[i].length)\n                stack.push(parts[i]);\n            }\n            absHref = appBase + prefix + stack.join('/');\n          }\n        }\n      }\n\n      var rewrittenUrl = $location.$$rewrite(absHref);\n\n      if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) {\n        event.preventDefault();\n        if (rewrittenUrl != $browser.url()) {\n          // update location manually\n          $location.$$parse(rewrittenUrl);\n          $rootScope.$apply();\n          // hack to work around FF6 bug 684208 when scenario runner clicks on links\n          window.angular['ff-684208-preventDefault'] = true;\n        }\n      }\n    });\n\n\n    // rewrite hashbang url <> html5 url\n    if ($location.absUrl() != initialUrl) {\n      $browser.url($location.absUrl(), true);\n    }\n\n    // update $location when $browser url changes\n    $browser.onUrlChange(function(newUrl) {\n      if ($location.absUrl() != newUrl) {\n        $rootScope.$evalAsync(function() {\n          var oldUrl = $location.absUrl();\n\n          $location.$$parse(newUrl);\n          if ($rootScope.$broadcast('$locationChangeStart', newUrl,\n                                    oldUrl).defaultPrevented) {\n            $location.$$parse(oldUrl);\n            $browser.url(oldUrl);\n          } else {\n            afterLocationChange(oldUrl);\n          }\n        });\n        if (!$rootScope.$$phase) $rootScope.$digest();\n      }\n    });\n\n    // update browser\n    var changeCounter = 0;\n    $rootScope.$watch(function $locationWatch() {\n      var oldUrl = $browser.url();\n      var currentReplace = $location.$$replace;\n\n      if (!changeCounter || oldUrl != $location.absUrl()) {\n        changeCounter++;\n        $rootScope.$evalAsync(function() {\n          if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl).\n              defaultPrevented) {\n            $location.$$parse(oldUrl);\n          } else {\n            $browser.url($location.absUrl(), currentReplace);\n            afterLocationChange(oldUrl);\n          }\n        });\n      }\n      $location.$$replace = false;\n\n      return changeCounter;\n    });\n\n    return $location;\n\n    function afterLocationChange(oldUrl) {\n      $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl);\n    }\n}];\n}\n\n/**\n * @ngdoc service\n * @name $log\n * @requires $window\n *\n * @description\n * Simple service for logging. Default implementation safely writes the message\n * into the browser's console (if present).\n *\n * The main purpose of this service is to simplify debugging and troubleshooting.\n *\n * The default is to log `debug` messages. You can use\n * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.\n *\n * @example\n   <example module=\"logExample\">\n     <file name=\"script.js\">\n       angular.module('logExample', [])\n         .controller('LogController', ['$scope', '$log', function($scope, $log) {\n           $scope.$log = $log;\n           $scope.message = 'Hello World!';\n         }]);\n     </file>\n     <file name=\"index.html\">\n       <div ng-controller=\"LogController\">\n         <p>Reload this page with open console, enter text and hit the log button...</p>\n         Message:\n         <input type=\"text\" ng-model=\"message\"/>\n         <button ng-click=\"$log.log(message)\">log</button>\n         <button ng-click=\"$log.warn(message)\">warn</button>\n         <button ng-click=\"$log.info(message)\">info</button>\n         <button ng-click=\"$log.error(message)\">error</button>\n       </div>\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc provider\n * @name $logProvider\n * @description\n * Use the `$logProvider` to configure how the application logs messages\n */\nfunction $LogProvider(){\n  var debug = true,\n      self = this;\n\n  /**\n   * @ngdoc method\n   * @name $logProvider#debugEnabled\n   * @description\n   * @param {boolean=} flag enable or disable debug level messages\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.debugEnabled = function(flag) {\n    if (isDefined(flag)) {\n      debug = flag;\n    return this;\n    } else {\n      return debug;\n    }\n  };\n\n  this.$get = ['$window', function($window){\n    return {\n      /**\n       * @ngdoc method\n       * @name $log#log\n       *\n       * @description\n       * Write a log message\n       */\n      log: consoleLog('log'),\n\n      /**\n       * @ngdoc method\n       * @name $log#info\n       *\n       * @description\n       * Write an information message\n       */\n      info: consoleLog('info'),\n\n      /**\n       * @ngdoc method\n       * @name $log#warn\n       *\n       * @description\n       * Write a warning message\n       */\n      warn: consoleLog('warn'),\n\n      /**\n       * @ngdoc method\n       * @name $log#error\n       *\n       * @description\n       * Write an error message\n       */\n      error: consoleLog('error'),\n\n      /**\n       * @ngdoc method\n       * @name $log#debug\n       *\n       * @description\n       * Write a debug message\n       */\n      debug: (function () {\n        var fn = consoleLog('debug');\n\n        return function() {\n          if (debug) {\n            fn.apply(self, arguments);\n          }\n        };\n      }())\n    };\n\n    function formatError(arg) {\n      if (arg instanceof Error) {\n        if (arg.stack) {\n          arg = (arg.message && arg.stack.indexOf(arg.message) === -1)\n              ? 'Error: ' + arg.message + '\\n' + arg.stack\n              : arg.stack;\n        } else if (arg.sourceURL) {\n          arg = arg.message + '\\n' + arg.sourceURL + ':' + arg.line;\n        }\n      }\n      return arg;\n    }\n\n    function consoleLog(type) {\n      var console = $window.console || {},\n          logFn = console[type] || console.log || noop,\n          hasApply = false;\n\n      // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.\n      // The reason behind this is that console.log has type \"object\" in IE8...\n      try {\n        hasApply = !!logFn.apply;\n      } catch (e) {}\n\n      if (hasApply) {\n        return function() {\n          var args = [];\n          forEach(arguments, function(arg) {\n            args.push(formatError(arg));\n          });\n          return logFn.apply(console, args);\n        };\n      }\n\n      // we are IE which either doesn't have window.console => this is noop and we do nothing,\n      // or we are IE where console.log doesn't have apply so we log at least first 2 args\n      return function(arg1, arg2) {\n        logFn(arg1, arg2 == null ? '' : arg2);\n      };\n    }\n  }];\n}\n\nvar $parseMinErr = minErr('$parse');\nvar promiseWarningCache = {};\nvar promiseWarning;\n\n// Sandboxing Angular Expressions\n// ------------------------------\n// Angular expressions are generally considered safe because these expressions only have direct\n// access to $scope and locals. However, one can obtain the ability to execute arbitrary JS code by\n// obtaining a reference to native JS functions such as the Function constructor.\n//\n// As an example, consider the following Angular expression:\n//\n//   {}.toString.constructor('alert(\"evil JS code\")')\n//\n// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits\n// against the expression language, but not to prevent exploits that were enabled by exposing\n// sensitive JavaScript or browser apis on Scope. Exposing such objects on a Scope is never a good\n// practice and therefore we are not even trying to protect against interaction with an object\n// explicitly exposed in this way.\n//\n// In general, it is not possible to access a Window object from an angular expression unless a\n// window or some DOM object that has a reference to window is published onto a Scope.\n// Similarly we prevent invocations of function known to be dangerous, as well as assignments to\n// native objects.\n\n\nfunction ensureSafeMemberName(name, fullExpression) {\n  if (name === \"__defineGetter__\" || name === \"__defineSetter__\"\n      || name === \"__lookupGetter__\" || name === \"__lookupSetter__\"\n      || name === \"__proto__\") {\n    throw $parseMinErr('isecfld',\n        'Attempting to access a disallowed field in Angular expressions! '\n        +'Expression: {0}', fullExpression);\n  }\n  return name;\n}\n\nfunction ensureSafeObject(obj, fullExpression) {\n  // nifty check if obj is Function that is fast and works across iframes and other contexts\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n          'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isWindow(obj)\n        obj.document && obj.location && obj.alert && obj.setInterval) {\n      throw $parseMinErr('isecwindow',\n          'Referencing the Window in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isElement(obj)\n        obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {\n      throw $parseMinErr('isecdom',\n          'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// block Object so that we can't get hold of dangerous Object.* methods\n        obj === Object) {\n      throw $parseMinErr('isecobj',\n          'Referencing Object in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    }\n  }\n  return obj;\n}\n\nvar CALL = Function.prototype.call;\nvar APPLY = Function.prototype.apply;\nvar BIND = Function.prototype.bind;\n\nfunction ensureSafeFunction(obj, fullExpression) {\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n        'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n    } else if (obj === CALL || obj === APPLY || (BIND && obj === BIND)) {\n      throw $parseMinErr('isecff',\n        'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n    }\n  }\n}\n\nvar OPERATORS = {\n    /* jshint bitwise : false */\n    'null':function(){return null;},\n    'true':function(){return true;},\n    'false':function(){return false;},\n    undefined:noop,\n    '+':function(self, locals, a,b){\n      a=a(self, locals); b=b(self, locals);\n      if (isDefined(a)) {\n        if (isDefined(b)) {\n          return a + b;\n        }\n        return a;\n      }\n      return isDefined(b)?b:undefined;},\n    '-':function(self, locals, a,b){\n          a=a(self, locals); b=b(self, locals);\n          return (isDefined(a)?a:0)-(isDefined(b)?b:0);\n        },\n    '*':function(self, locals, a,b){return a(self, locals)*b(self, locals);},\n    '/':function(self, locals, a,b){return a(self, locals)/b(self, locals);},\n    '%':function(self, locals, a,b){return a(self, locals)%b(self, locals);},\n    '^':function(self, locals, a,b){return a(self, locals)^b(self, locals);},\n    '=':noop,\n    '===':function(self, locals, a, b){return a(self, locals)===b(self, locals);},\n    '!==':function(self, locals, a, b){return a(self, locals)!==b(self, locals);},\n    '==':function(self, locals, a,b){return a(self, locals)==b(self, locals);},\n    '!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);},\n    '<':function(self, locals, a,b){return a(self, locals)<b(self, locals);},\n    '>':function(self, locals, a,b){return a(self, locals)>b(self, locals);},\n    '<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);},\n    '>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);},\n    '&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);},\n    '||':function(self, locals, a,b){return a(self, locals)||b(self, locals);},\n    '&':function(self, locals, a,b){return a(self, locals)&b(self, locals);},\n//    '|':function(self, locals, a,b){return a|b;},\n    '|':function(self, locals, a,b){return b(self, locals)(self, locals, a(self, locals));},\n    '!':function(self, locals, a){return !a(self, locals);}\n};\n/* jshint bitwise: true */\nvar ESCAPE = {\"n\":\"\\n\", \"f\":\"\\f\", \"r\":\"\\r\", \"t\":\"\\t\", \"v\":\"\\v\", \"'\":\"'\", '\"':'\"'};\n\n\n/////////////////////////////////////////\n\n\n/**\n * @constructor\n */\nvar Lexer = function (options) {\n  this.options = options;\n};\n\nLexer.prototype = {\n  constructor: Lexer,\n\n  lex: function (text) {\n    this.text = text;\n\n    this.index = 0;\n    this.ch = undefined;\n    this.lastCh = ':'; // can start regexp\n\n    this.tokens = [];\n\n    while (this.index < this.text.length) {\n      this.ch = this.text.charAt(this.index);\n      if (this.is('\"\\'')) {\n        this.readString(this.ch);\n      } else if (this.isNumber(this.ch) || this.is('.') && this.isNumber(this.peek())) {\n        this.readNumber();\n      } else if (this.isIdent(this.ch)) {\n        this.readIdent();\n      } else if (this.is('(){}[].,;:?')) {\n        this.tokens.push({\n          index: this.index,\n          text: this.ch\n        });\n        this.index++;\n      } else if (this.isWhitespace(this.ch)) {\n        this.index++;\n        continue;\n      } else {\n        var ch2 = this.ch + this.peek();\n        var ch3 = ch2 + this.peek(2);\n        var fn = OPERATORS[this.ch];\n        var fn2 = OPERATORS[ch2];\n        var fn3 = OPERATORS[ch3];\n        if (fn3) {\n          this.tokens.push({index: this.index, text: ch3, fn: fn3});\n          this.index += 3;\n        } else if (fn2) {\n          this.tokens.push({index: this.index, text: ch2, fn: fn2});\n          this.index += 2;\n        } else if (fn) {\n          this.tokens.push({\n            index: this.index,\n            text: this.ch,\n            fn: fn\n          });\n          this.index += 1;\n        } else {\n          this.throwError('Unexpected next character ', this.index, this.index + 1);\n        }\n      }\n      this.lastCh = this.ch;\n    }\n    return this.tokens;\n  },\n\n  is: function(chars) {\n    return chars.indexOf(this.ch) !== -1;\n  },\n\n  was: function(chars) {\n    return chars.indexOf(this.lastCh) !== -1;\n  },\n\n  peek: function(i) {\n    var num = i || 1;\n    return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;\n  },\n\n  isNumber: function(ch) {\n    return ('0' <= ch && ch <= '9');\n  },\n\n  isWhitespace: function(ch) {\n    // IE treats non-breaking space as \\u00A0\n    return (ch === ' ' || ch === '\\r' || ch === '\\t' ||\n            ch === '\\n' || ch === '\\v' || ch === '\\u00A0');\n  },\n\n  isIdent: function(ch) {\n    return ('a' <= ch && ch <= 'z' ||\n            'A' <= ch && ch <= 'Z' ||\n            '_' === ch || ch === '$');\n  },\n\n  isExpOperator: function(ch) {\n    return (ch === '-' || ch === '+' || this.isNumber(ch));\n  },\n\n  throwError: function(error, start, end) {\n    end = end || this.index;\n    var colStr = (isDefined(start)\n            ? 's ' + start +  '-' + this.index + ' [' + this.text.substring(start, end) + ']'\n            : ' ' + end);\n    throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',\n        error, colStr, this.text);\n  },\n\n  readNumber: function() {\n    var number = '';\n    var start = this.index;\n    while (this.index < this.text.length) {\n      var ch = lowercase(this.text.charAt(this.index));\n      if (ch == '.' || this.isNumber(ch)) {\n        number += ch;\n      } else {\n        var peekCh = this.peek();\n        if (ch == 'e' && this.isExpOperator(peekCh)) {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            peekCh && this.isNumber(peekCh) &&\n            number.charAt(number.length - 1) == 'e') {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            (!peekCh || !this.isNumber(peekCh)) &&\n            number.charAt(number.length - 1) == 'e') {\n          this.throwError('Invalid exponent');\n        } else {\n          break;\n        }\n      }\n      this.index++;\n    }\n    number = 1 * number;\n    this.tokens.push({\n      index: start,\n      text: number,\n      literal: true,\n      constant: true,\n      fn: function() { return number; }\n    });\n  },\n\n  readIdent: function() {\n    var parser = this;\n\n    var ident = '';\n    var start = this.index;\n\n    var lastDot, peekIndex, methodName, ch;\n\n    while (this.index < this.text.length) {\n      ch = this.text.charAt(this.index);\n      if (ch === '.' || this.isIdent(ch) || this.isNumber(ch)) {\n        if (ch === '.') lastDot = this.index;\n        ident += ch;\n      } else {\n        break;\n      }\n      this.index++;\n    }\n\n    //check if this is not a method invocation and if it is back out to last dot\n    if (lastDot) {\n      peekIndex = this.index;\n      while (peekIndex < this.text.length) {\n        ch = this.text.charAt(peekIndex);\n        if (ch === '(') {\n          methodName = ident.substr(lastDot - start + 1);\n          ident = ident.substr(0, lastDot - start);\n          this.index = peekIndex;\n          break;\n        }\n        if (this.isWhitespace(ch)) {\n          peekIndex++;\n        } else {\n          break;\n        }\n      }\n    }\n\n\n    var token = {\n      index: start,\n      text: ident\n    };\n\n    // OPERATORS is our own object so we don't need to use special hasOwnPropertyFn\n    if (OPERATORS.hasOwnProperty(ident)) {\n      token.fn = OPERATORS[ident];\n      token.literal = true;\n      token.constant = true;\n    } else {\n      var getter = getterFn(ident, this.options, this.text);\n      token.fn = extend(function(self, locals) {\n        return (getter(self, locals));\n      }, {\n        assign: function(self, value) {\n          return setter(self, ident, value, parser.text, parser.options);\n        }\n      });\n    }\n\n    this.tokens.push(token);\n\n    if (methodName) {\n      this.tokens.push({\n        index:lastDot,\n        text: '.'\n      });\n      this.tokens.push({\n        index: lastDot + 1,\n        text: methodName\n      });\n    }\n  },\n\n  readString: function(quote) {\n    var start = this.index;\n    this.index++;\n    var string = '';\n    var rawString = quote;\n    var escape = false;\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      rawString += ch;\n      if (escape) {\n        if (ch === 'u') {\n          var hex = this.text.substring(this.index + 1, this.index + 5);\n          if (!hex.match(/[\\da-f]{4}/i))\n            this.throwError('Invalid unicode escape [\\\\u' + hex + ']');\n          this.index += 4;\n          string += String.fromCharCode(parseInt(hex, 16));\n        } else {\n          var rep = ESCAPE[ch];\n          string = string + (rep || ch);\n        }\n        escape = false;\n      } else if (ch === '\\\\') {\n        escape = true;\n      } else if (ch === quote) {\n        this.index++;\n        this.tokens.push({\n          index: start,\n          text: rawString,\n          string: string,\n          literal: true,\n          constant: true,\n          fn: function() { return string; }\n        });\n        return;\n      } else {\n        string += ch;\n      }\n      this.index++;\n    }\n    this.throwError('Unterminated quote', start);\n  }\n};\n\n\n/**\n * @constructor\n */\nvar Parser = function (lexer, $filter, options) {\n  this.lexer = lexer;\n  this.$filter = $filter;\n  this.options = options;\n};\n\nParser.ZERO = extend(function () {\n  return 0;\n}, {\n  constant: true\n});\n\nParser.prototype = {\n  constructor: Parser,\n\n  parse: function (text) {\n    this.text = text;\n\n    this.tokens = this.lexer.lex(text);\n\n    var value = this.statements();\n\n    if (this.tokens.length !== 0) {\n      this.throwError('is an unexpected token', this.tokens[0]);\n    }\n\n    value.literal = !!value.literal;\n    value.constant = !!value.constant;\n\n    return value;\n  },\n\n  primary: function () {\n    var primary;\n    if (this.expect('(')) {\n      primary = this.filterChain();\n      this.consume(')');\n    } else if (this.expect('[')) {\n      primary = this.arrayDeclaration();\n    } else if (this.expect('{')) {\n      primary = this.object();\n    } else {\n      var token = this.expect();\n      primary = token.fn;\n      if (!primary) {\n        this.throwError('not a primary expression', token);\n      }\n      primary.literal = !!token.literal;\n      primary.constant = !!token.constant;\n    }\n\n    var next, context;\n    while ((next = this.expect('(', '[', '.'))) {\n      if (next.text === '(') {\n        primary = this.functionCall(primary, context);\n        context = null;\n      } else if (next.text === '[') {\n        context = primary;\n        primary = this.objectIndex(primary);\n      } else if (next.text === '.') {\n        context = primary;\n        primary = this.fieldAccess(primary);\n      } else {\n        this.throwError('IMPOSSIBLE');\n      }\n    }\n    return primary;\n  },\n\n  throwError: function(msg, token) {\n    throw $parseMinErr('syntax',\n        'Syntax Error: Token \\'{0}\\' {1} at column {2} of the expression [{3}] starting at [{4}].',\n          token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));\n  },\n\n  peekToken: function() {\n    if (this.tokens.length === 0)\n      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n    return this.tokens[0];\n  },\n\n  peek: function(e1, e2, e3, e4) {\n    if (this.tokens.length > 0) {\n      var token = this.tokens[0];\n      var t = token.text;\n      if (t === e1 || t === e2 || t === e3 || t === e4 ||\n          (!e1 && !e2 && !e3 && !e4)) {\n        return token;\n      }\n    }\n    return false;\n  },\n\n  expect: function(e1, e2, e3, e4){\n    var token = this.peek(e1, e2, e3, e4);\n    if (token) {\n      this.tokens.shift();\n      return token;\n    }\n    return false;\n  },\n\n  consume: function(e1){\n    if (!this.expect(e1)) {\n      this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());\n    }\n  },\n\n  unaryFn: function(fn, right) {\n    return extend(function(self, locals) {\n      return fn(self, locals, right);\n    }, {\n      constant:right.constant\n    });\n  },\n\n  ternaryFn: function(left, middle, right){\n    return extend(function(self, locals){\n      return left(self, locals) ? middle(self, locals) : right(self, locals);\n    }, {\n      constant: left.constant && middle.constant && right.constant\n    });\n  },\n\n  binaryFn: function(left, fn, right) {\n    return extend(function(self, locals) {\n      return fn(self, locals, left, right);\n    }, {\n      constant:left.constant && right.constant\n    });\n  },\n\n  statements: function() {\n    var statements = [];\n    while (true) {\n      if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))\n        statements.push(this.filterChain());\n      if (!this.expect(';')) {\n        // optimize for the common case where there is only one statement.\n        // TODO(size): maybe we should not support multiple statements?\n        return (statements.length === 1)\n            ? statements[0]\n            : function(self, locals) {\n                var value;\n                for (var i = 0; i < statements.length; i++) {\n                  var statement = statements[i];\n                  if (statement) {\n                    value = statement(self, locals);\n                  }\n                }\n                return value;\n              };\n      }\n    }\n  },\n\n  filterChain: function() {\n    var left = this.expression();\n    var token;\n    while (true) {\n      if ((token = this.expect('|'))) {\n        left = this.binaryFn(left, token.fn, this.filter());\n      } else {\n        return left;\n      }\n    }\n  },\n\n  filter: function() {\n    var token = this.expect();\n    var fn = this.$filter(token.text);\n    var argsFn = [];\n    while (true) {\n      if ((token = this.expect(':'))) {\n        argsFn.push(this.expression());\n      } else {\n        var fnInvoke = function(self, locals, input) {\n          var args = [input];\n          for (var i = 0; i < argsFn.length; i++) {\n            args.push(argsFn[i](self, locals));\n          }\n          return fn.apply(self, args);\n        };\n        return function() {\n          return fnInvoke;\n        };\n      }\n    }\n  },\n\n  expression: function() {\n    return this.assignment();\n  },\n\n  assignment: function() {\n    var left = this.ternary();\n    var right;\n    var token;\n    if ((token = this.expect('='))) {\n      if (!left.assign) {\n        this.throwError('implies assignment but [' +\n            this.text.substring(0, token.index) + '] can not be assigned to', token);\n      }\n      right = this.ternary();\n      return function(scope, locals) {\n        return left.assign(scope, right(scope, locals), locals);\n      };\n    }\n    return left;\n  },\n\n  ternary: function() {\n    var left = this.logicalOR();\n    var middle;\n    var token;\n    if ((token = this.expect('?'))) {\n      middle = this.assignment();\n      if ((token = this.expect(':'))) {\n        return this.ternaryFn(left, middle, this.assignment());\n      } else {\n        this.throwError('expected :', token);\n      }\n    } else {\n      return left;\n    }\n  },\n\n  logicalOR: function() {\n    var left = this.logicalAND();\n    var token;\n    while (true) {\n      if ((token = this.expect('||'))) {\n        left = this.binaryFn(left, token.fn, this.logicalAND());\n      } else {\n        return left;\n      }\n    }\n  },\n\n  logicalAND: function() {\n    var left = this.equality();\n    var token;\n    if ((token = this.expect('&&'))) {\n      left = this.binaryFn(left, token.fn, this.logicalAND());\n    }\n    return left;\n  },\n\n  equality: function() {\n    var left = this.relational();\n    var token;\n    if ((token = this.expect('==','!=','===','!=='))) {\n      left = this.binaryFn(left, token.fn, this.equality());\n    }\n    return left;\n  },\n\n  relational: function() {\n    var left = this.additive();\n    var token;\n    if ((token = this.expect('<', '>', '<=', '>='))) {\n      left = this.binaryFn(left, token.fn, this.relational());\n    }\n    return left;\n  },\n\n  additive: function() {\n    var left = this.multiplicative();\n    var token;\n    while ((token = this.expect('+','-'))) {\n      left = this.binaryFn(left, token.fn, this.multiplicative());\n    }\n    return left;\n  },\n\n  multiplicative: function() {\n    var left = this.unary();\n    var token;\n    while ((token = this.expect('*','/','%'))) {\n      left = this.binaryFn(left, token.fn, this.unary());\n    }\n    return left;\n  },\n\n  unary: function() {\n    var token;\n    if (this.expect('+')) {\n      return this.primary();\n    } else if ((token = this.expect('-'))) {\n      return this.binaryFn(Parser.ZERO, token.fn, this.unary());\n    } else if ((token = this.expect('!'))) {\n      return this.unaryFn(token.fn, this.unary());\n    } else {\n      return this.primary();\n    }\n  },\n\n  fieldAccess: function(object) {\n    var parser = this;\n    var field = this.expect().text;\n    var getter = getterFn(field, this.options, this.text);\n\n    return extend(function(scope, locals, self) {\n      return getter(self || object(scope, locals));\n    }, {\n      assign: function(scope, value, locals) {\n        var o = object(scope, locals);\n        if (!o) object.assign(scope, o = {});\n        return setter(o, field, value, parser.text, parser.options);\n      }\n    });\n  },\n\n  objectIndex: function(obj) {\n    var parser = this;\n\n    var indexFn = this.expression();\n    this.consume(']');\n\n    return extend(function(self, locals) {\n      var o = obj(self, locals),\n          i = indexFn(self, locals),\n          v, p;\n\n      ensureSafeMemberName(i, parser.text);\n      if (!o) return undefined;\n      v = ensureSafeObject(o[i], parser.text);\n      if (v && v.then && parser.options.unwrapPromises) {\n        p = v;\n        if (!('$$v' in v)) {\n          p.$$v = undefined;\n          p.then(function(val) { p.$$v = val; });\n        }\n        v = v.$$v;\n      }\n      return v;\n    }, {\n      assign: function(self, value, locals) {\n        var key = ensureSafeMemberName(indexFn(self, locals), parser.text);\n        // prevent overwriting of Function.constructor which would break ensureSafeObject check\n        var o = ensureSafeObject(obj(self, locals), parser.text);\n        if (!o) obj.assign(self, o = {});\n        return o[key] = value;\n      }\n    });\n  },\n\n  functionCall: function(fn, contextGetter) {\n    var argsFn = [];\n    if (this.peekToken().text !== ')') {\n      do {\n        argsFn.push(this.expression());\n      } while (this.expect(','));\n    }\n    this.consume(')');\n\n    var parser = this;\n\n    return function(scope, locals) {\n      var args = [];\n      var context = contextGetter ? contextGetter(scope, locals) : scope;\n\n      for (var i = 0; i < argsFn.length; i++) {\n        args.push(ensureSafeObject(argsFn[i](scope, locals), parser.text));\n      }\n      var fnPtr = fn(scope, locals, context) || noop;\n\n      ensureSafeObject(context, parser.text);\n      ensureSafeFunction(fnPtr, parser.text);\n\n      // IE stupidity! (IE doesn't have apply for some native functions)\n      var v = fnPtr.apply\n            ? fnPtr.apply(context, args)\n            : fnPtr(args[0], args[1], args[2], args[3], args[4]);\n\n      return ensureSafeObject(v, parser.text);\n    };\n  },\n\n  // This is used with json array declaration\n  arrayDeclaration: function () {\n    var elementFns = [];\n    var allConstant = true;\n    if (this.peekToken().text !== ']') {\n      do {\n        if (this.peek(']')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        var elementFn = this.expression();\n        elementFns.push(elementFn);\n        if (!elementFn.constant) {\n          allConstant = false;\n        }\n      } while (this.expect(','));\n    }\n    this.consume(']');\n\n    return extend(function(self, locals) {\n      var array = [];\n      for (var i = 0; i < elementFns.length; i++) {\n        array.push(elementFns[i](self, locals));\n      }\n      return array;\n    }, {\n      literal: true,\n      constant: allConstant\n    });\n  },\n\n  object: function () {\n    var keyValues = [];\n    var allConstant = true;\n    if (this.peekToken().text !== '}') {\n      do {\n        if (this.peek('}')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        var token = this.expect(),\n        key = token.string || token.text;\n        this.consume(':');\n        var value = this.expression();\n        keyValues.push({key: key, value: value});\n        if (!value.constant) {\n          allConstant = false;\n        }\n      } while (this.expect(','));\n    }\n    this.consume('}');\n\n    return extend(function(self, locals) {\n      var object = {};\n      for (var i = 0; i < keyValues.length; i++) {\n        var keyValue = keyValues[i];\n        object[keyValue.key] = keyValue.value(self, locals);\n      }\n      return object;\n    }, {\n      literal: true,\n      constant: allConstant\n    });\n  }\n};\n\n\n//////////////////////////////////////////////////\n// Parser helper functions\n//////////////////////////////////////////////////\n\nfunction setter(obj, path, setValue, fullExp, options) {\n  ensureSafeObject(obj, fullExp);\n\n  //needed?\n  options = options || {};\n\n  var element = path.split('.'), key;\n  for (var i = 0; element.length > 1; i++) {\n    key = ensureSafeMemberName(element.shift(), fullExp);\n    var propertyObj = ensureSafeObject(obj[key], fullExp);\n    if (!propertyObj) {\n      propertyObj = {};\n      obj[key] = propertyObj;\n    }\n    obj = propertyObj;\n    if (obj.then && options.unwrapPromises) {\n      promiseWarning(fullExp);\n      if (!(\"$$v\" in obj)) {\n        (function(promise) {\n          promise.then(function(val) { promise.$$v = val; }); }\n        )(obj);\n      }\n      if (obj.$$v === undefined) {\n        obj.$$v = {};\n      }\n      obj = obj.$$v;\n    }\n  }\n  key = ensureSafeMemberName(element.shift(), fullExp);\n  ensureSafeObject(obj[key], fullExp);\n  obj[key] = setValue;\n  return setValue;\n}\n\nvar getterFnCache = {};\n\n/**\n * Implementation of the \"Black Hole\" variant from:\n * - http://jsperf.com/angularjs-parse-getter/4\n * - http://jsperf.com/path-evaluation-simplified/7\n */\nfunction cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {\n  ensureSafeMemberName(key0, fullExp);\n  ensureSafeMemberName(key1, fullExp);\n  ensureSafeMemberName(key2, fullExp);\n  ensureSafeMemberName(key3, fullExp);\n  ensureSafeMemberName(key4, fullExp);\n\n  return !options.unwrapPromises\n      ? function cspSafeGetter(scope, locals) {\n          var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope;\n\n          if (pathVal == null) return pathVal;\n          pathVal = pathVal[key0];\n\n          if (!key1) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key1];\n\n          if (!key2) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key2];\n\n          if (!key3) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key3];\n\n          if (!key4) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key4];\n\n          return pathVal;\n        }\n      : function cspSafePromiseEnabledGetter(scope, locals) {\n          var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope,\n              promise;\n\n          if (pathVal == null) return pathVal;\n\n          pathVal = pathVal[key0];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n\n          if (!key1) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key1];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n\n          if (!key2) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key2];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n\n          if (!key3) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key3];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n\n          if (!key4) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key4];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n          return pathVal;\n        };\n}\n\nfunction getterFn(path, options, fullExp) {\n  // Check whether the cache has this getter already.\n  // We can use hasOwnProperty directly on the cache because we ensure,\n  // see below, that the cache never stores a path called 'hasOwnProperty'\n  if (getterFnCache.hasOwnProperty(path)) {\n    return getterFnCache[path];\n  }\n\n  var pathKeys = path.split('.'),\n      pathKeysLength = pathKeys.length,\n      fn;\n\n  // http://jsperf.com/angularjs-parse-getter/6\n  if (options.csp) {\n    if (pathKeysLength < 6) {\n      fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,\n                          options);\n    } else {\n      fn = function(scope, locals) {\n        var i = 0, val;\n        do {\n          val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++],\n                                pathKeys[i++], fullExp, options)(scope, locals);\n\n          locals = undefined; // clear after first iteration\n          scope = val;\n        } while (i < pathKeysLength);\n        return val;\n      };\n    }\n  } else {\n    var code = 'var p;\\n';\n    forEach(pathKeys, function(key, index) {\n      ensureSafeMemberName(key, fullExp);\n      code += 'if(s == null) return undefined;\\n' +\n              's='+ (index\n                      // we simply dereference 's' on any .dot notation\n                      ? 's'\n                      // but if we are first then we check locals first, and if so read it first\n                      : '((k&&k.hasOwnProperty(\"' + key + '\"))?k:s)') + '[\"' + key + '\"]' + ';\\n' +\n              (options.unwrapPromises\n                ? 'if (s && s.then) {\\n' +\n                  ' pw(\"' + fullExp.replace(/([\"\\r\\n])/g, '\\\\$1') + '\");\\n' +\n                  ' if (!(\"$$v\" in s)) {\\n' +\n                    ' p=s;\\n' +\n                    ' p.$$v = undefined;\\n' +\n                    ' p.then(function(v) {p.$$v=v;});\\n' +\n                    '}\\n' +\n                  ' s=s.$$v\\n' +\n                '}\\n'\n                : '');\n    });\n    code += 'return s;';\n\n    /* jshint -W054 */\n    var evaledFnGetter = new Function('s', 'k', 'pw', code); // s=scope, k=locals, pw=promiseWarning\n    /* jshint +W054 */\n    evaledFnGetter.toString = valueFn(code);\n    fn = options.unwrapPromises ? function(scope, locals) {\n      return evaledFnGetter(scope, locals, promiseWarning);\n    } : evaledFnGetter;\n  }\n\n  // Only cache the value if it's not going to mess up the cache object\n  // This is more performant that using Object.prototype.hasOwnProperty.call\n  if (path !== 'hasOwnProperty') {\n    getterFnCache[path] = fn;\n  }\n  return fn;\n}\n\n///////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $parse\n * @kind function\n *\n * @description\n *\n * Converts Angular {@link guide/expression expression} into a function.\n *\n * ```js\n *   var getter = $parse('user.name');\n *   var setter = getter.assign;\n *   var context = {user:{name:'angular'}};\n *   var locals = {user:{name:'local'}};\n *\n *   expect(getter(context)).toEqual('angular');\n *   setter(context, 'newValue');\n *   expect(context.user.name).toEqual('newValue');\n *   expect(getter(context, locals)).toEqual('local');\n * ```\n *\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n *      are evaluated against (typically a scope object).\n *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n *      `context`.\n *\n *    The returned function also has the following properties:\n *      * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript\n *        literal.\n *      * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript\n *        constant literals.\n *      * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be\n *        set to a function to change its value on the given context.\n *\n */\n\n\n/**\n * @ngdoc provider\n * @name $parseProvider\n * @kind function\n *\n * @description\n * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}\n *  service.\n */\nfunction $ParseProvider() {\n  var cache = {};\n\n  var $parseOptions = {\n    csp: false,\n    unwrapPromises: false,\n    logPromiseWarnings: true\n  };\n\n\n  /**\n   * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future.\n   *\n   * @ngdoc method\n   * @name $parseProvider#unwrapPromises\n   * @description\n   *\n   * **This feature is deprecated, see deprecation notes below for more info**\n   *\n   * If set to true (default is false), $parse will unwrap promises automatically when a promise is\n   * found at any part of the expression. In other words, if set to true, the expression will always\n   * result in a non-promise value.\n   *\n   * While the promise is unresolved, it's treated as undefined, but once resolved and fulfilled,\n   * the fulfillment value is used in place of the promise while evaluating the expression.\n   *\n   * **Deprecation notice**\n   *\n   * This is a feature that didn't prove to be wildly useful or popular, primarily because of the\n   * dichotomy between data access in templates (accessed as raw values) and controller code\n   * (accessed as promises).\n   *\n   * In most code we ended up resolving promises manually in controllers anyway and thus unifying\n   * the model access there.\n   *\n   * Other downsides of automatic promise unwrapping:\n   *\n   * - when building components it's often desirable to receive the raw promises\n   * - adds complexity and slows down expression evaluation\n   * - makes expression code pre-generation unattractive due to the amount of code that needs to be\n   *   generated\n   * - makes IDE auto-completion and tool support hard\n   *\n   * **Warning Logs**\n   *\n   * If the unwrapping is enabled, Angular will log a warning about each expression that unwraps a\n   * promise (to reduce the noise, each expression is logged only once). To disable this logging use\n   * `$parseProvider.logPromiseWarnings(false)` api.\n   *\n   *\n   * @param {boolean=} value New value.\n   * @returns {boolean|self} Returns the current setting when used as getter and self if used as\n   *                         setter.\n   */\n  this.unwrapPromises = function(value) {\n    if (isDefined(value)) {\n      $parseOptions.unwrapPromises = !!value;\n      return this;\n    } else {\n      return $parseOptions.unwrapPromises;\n    }\n  };\n\n\n  /**\n   * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future.\n   *\n   * @ngdoc method\n   * @name $parseProvider#logPromiseWarnings\n   * @description\n   *\n   * Controls whether Angular should log a warning on any encounter of a promise in an expression.\n   *\n   * The default is set to `true`.\n   *\n   * This setting applies only if `$parseProvider.unwrapPromises` setting is set to true as well.\n   *\n   * @param {boolean=} value New value.\n   * @returns {boolean|self} Returns the current setting when used as getter and self if used as\n   *                         setter.\n   */\n this.logPromiseWarnings = function(value) {\n    if (isDefined(value)) {\n      $parseOptions.logPromiseWarnings = value;\n      return this;\n    } else {\n      return $parseOptions.logPromiseWarnings;\n    }\n  };\n\n\n  this.$get = ['$filter', '$sniffer', '$log', function($filter, $sniffer, $log) {\n    $parseOptions.csp = $sniffer.csp;\n\n    promiseWarning = function promiseWarningFn(fullExp) {\n      if (!$parseOptions.logPromiseWarnings || promiseWarningCache.hasOwnProperty(fullExp)) return;\n      promiseWarningCache[fullExp] = true;\n      $log.warn('[$parse] Promise found in the expression `' + fullExp + '`. ' +\n          'Automatic unwrapping of promises in Angular expressions is deprecated.');\n    };\n\n    return function(exp) {\n      var parsedExpression;\n\n      switch (typeof exp) {\n        case 'string':\n\n          if (cache.hasOwnProperty(exp)) {\n            return cache[exp];\n          }\n\n          var lexer = new Lexer($parseOptions);\n          var parser = new Parser(lexer, $filter, $parseOptions);\n          parsedExpression = parser.parse(exp);\n\n          if (exp !== 'hasOwnProperty') {\n            // Only cache the value if it's not going to mess up the cache object\n            // This is more performant that using Object.prototype.hasOwnProperty.call\n            cache[exp] = parsedExpression;\n          }\n\n          return parsedExpression;\n\n        case 'function':\n          return exp;\n\n        default:\n          return noop;\n      }\n    };\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $q\n * @requires $rootScope\n *\n * @description\n * A promise/deferred implementation inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).\n *\n * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an\n * interface for interacting with an object that represents the result of an action that is\n * performed asynchronously, and may or may not be finished at any given point in time.\n *\n * From the perspective of dealing with error handling, deferred and promise APIs are to\n * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.\n *\n * ```js\n *   // for the purpose of this example let's assume that variables `$q`, `scope` and `okToGreet`\n *   // are available in the current lexical scope (they could have been injected or passed in).\n *\n *   function asyncGreet(name) {\n *     var deferred = $q.defer();\n *\n *     setTimeout(function() {\n *       deferred.notify('About to greet ' + name + '.');\n *\n *       if (okToGreet(name)) {\n *         deferred.resolve('Hello, ' + name + '!');\n *       } else {\n *         deferred.reject('Greeting ' + name + ' is not allowed.');\n *       }\n *     }, 1000);\n *\n *     return deferred.promise;\n *   }\n *\n *   var promise = asyncGreet('Robin Hood');\n *   promise.then(function(greeting) {\n *     alert('Success: ' + greeting);\n *   }, function(reason) {\n *     alert('Failed: ' + reason);\n *   }, function(update) {\n *     alert('Got notification: ' + update);\n *   });\n * ```\n *\n * At first it might not be obvious why this extra complexity is worth the trouble. The payoff\n * comes in the way of guarantees that promise and deferred APIs make, see\n * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.\n *\n * Additionally the promise api allows for composition that is very hard to do with the\n * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.\n * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the\n * section on serial or parallel joining of promises.\n *\n *\n * # The Deferred API\n *\n * A new instance of deferred is constructed by calling `$q.defer()`.\n *\n * The purpose of the deferred object is to expose the associated Promise instance as well as APIs\n * that can be used for signaling the successful or unsuccessful completion, as well as the status\n * of the task.\n *\n * **Methods**\n *\n * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection\n *   constructed via `$q.reject`, the promise will be rejected instead.\n * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to\n *   resolving it with a rejection constructed via `$q.reject`.\n * - `notify(value)` - provides updates on the status of the promise's execution. This may be called\n *   multiple times before the promise is either resolved or rejected.\n *\n * **Properties**\n *\n * - promise – `{Promise}` – promise object associated with this deferred.\n *\n *\n * # The Promise API\n *\n * A new promise instance is created when a deferred instance is created and can be retrieved by\n * calling `deferred.promise`.\n *\n * The purpose of the promise object is to allow for interested parties to get access to the result\n * of the deferred task when it completes.\n *\n * **Methods**\n *\n * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or\n *   will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously\n *   as soon as the result is available. The callbacks are called with a single argument: the result\n *   or rejection reason. Additionally, the notify callback may be called zero or more times to\n *   provide a progress indication, before the promise is resolved or rejected.\n *\n *   This method *returns a new promise* which is resolved or rejected via the return value of the\n *   `successCallback`, `errorCallback`. It also notifies via the return value of the\n *   `notifyCallback` method. The promise can not be resolved or rejected from the notifyCallback\n *   method.\n *\n * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`\n *\n * - `finally(callback)` – allows you to observe either the fulfillment or rejection of a promise,\n *   but to do so without modifying the final value. This is useful to release resources or do some\n *   clean-up that needs to be done whether the promise was rejected or resolved. See the [full\n *   specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for\n *   more information.\n *\n *   Because `finally` is a reserved word in JavaScript and reserved keywords are not supported as\n *   property names by ES3, you'll need to invoke the method like `promise['finally'](callback)` to\n *   make your code IE8 and Android 2.x compatible.\n *\n * # Chaining promises\n *\n * Because calling the `then` method of a promise returns a new derived promise, it is easily\n * possible to create a chain of promises:\n *\n * ```js\n *   promiseB = promiseA.then(function(result) {\n *     return result + 1;\n *   });\n *\n *   // promiseB will be resolved immediately after promiseA is resolved and its value\n *   // will be the result of promiseA incremented by 1\n * ```\n *\n * It is possible to create chains of any length and since a promise can be resolved with another\n * promise (which will defer its resolution further), it is possible to pause/defer resolution of\n * the promises at any point in the chain. This makes it possible to implement powerful APIs like\n * $http's response interceptors.\n *\n *\n * # Differences between Kris Kowal's Q and $q\n *\n *  There are two main differences:\n *\n * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation\n *   mechanism in angular, which means faster propagation of resolution or rejection into your\n *   models and avoiding unnecessary browser repaints, which would result in flickering UI.\n * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains\n *   all the important functionality needed for common async tasks.\n *\n *  # Testing\n *\n *  ```js\n *    it('should simulate promise', inject(function($q, $rootScope) {\n *      var deferred = $q.defer();\n *      var promise = deferred.promise;\n *      var resolvedValue;\n *\n *      promise.then(function(value) { resolvedValue = value; });\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Simulate resolving of promise\n *      deferred.resolve(123);\n *      // Note that the 'then' function does not get called synchronously.\n *      // This is because we want the promise API to always be async, whether or not\n *      // it got called synchronously or asynchronously.\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Propagate promise resolution to 'then' functions using $apply().\n *      $rootScope.$apply();\n *      expect(resolvedValue).toEqual(123);\n *    }));\n *  ```\n */\nfunction $QProvider() {\n\n  this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {\n    return qFactory(function(callback) {\n      $rootScope.$evalAsync(callback);\n    }, $exceptionHandler);\n  }];\n}\n\n\n/**\n * Constructs a promise manager.\n *\n * @param {function(Function)} nextTick Function for executing functions in the next turn.\n * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for\n *     debugging purposes.\n * @returns {object} Promise manager.\n */\nfunction qFactory(nextTick, exceptionHandler) {\n\n  /**\n   * @ngdoc method\n   * @name $q#defer\n   * @kind function\n   *\n   * @description\n   * Creates a `Deferred` object which represents a task which will finish in the future.\n   *\n   * @returns {Deferred} Returns a new instance of deferred.\n   */\n  var defer = function() {\n    var pending = [],\n        value, deferred;\n\n    deferred = {\n\n      resolve: function(val) {\n        if (pending) {\n          var callbacks = pending;\n          pending = undefined;\n          value = ref(val);\n\n          if (callbacks.length) {\n            nextTick(function() {\n              var callback;\n              for (var i = 0, ii = callbacks.length; i < ii; i++) {\n                callback = callbacks[i];\n                value.then(callback[0], callback[1], callback[2]);\n              }\n            });\n          }\n        }\n      },\n\n\n      reject: function(reason) {\n        deferred.resolve(createInternalRejectedPromise(reason));\n      },\n\n\n      notify: function(progress) {\n        if (pending) {\n          var callbacks = pending;\n\n          if (pending.length) {\n            nextTick(function() {\n              var callback;\n              for (var i = 0, ii = callbacks.length; i < ii; i++) {\n                callback = callbacks[i];\n                callback[2](progress);\n              }\n            });\n          }\n        }\n      },\n\n\n      promise: {\n        then: function(callback, errback, progressback) {\n          var result = defer();\n\n          var wrappedCallback = function(value) {\n            try {\n              result.resolve((isFunction(callback) ? callback : defaultCallback)(value));\n            } catch(e) {\n              result.reject(e);\n              exceptionHandler(e);\n            }\n          };\n\n          var wrappedErrback = function(reason) {\n            try {\n              result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));\n            } catch(e) {\n              result.reject(e);\n              exceptionHandler(e);\n            }\n          };\n\n          var wrappedProgressback = function(progress) {\n            try {\n              result.notify((isFunction(progressback) ? progressback : defaultCallback)(progress));\n            } catch(e) {\n              exceptionHandler(e);\n            }\n          };\n\n          if (pending) {\n            pending.push([wrappedCallback, wrappedErrback, wrappedProgressback]);\n          } else {\n            value.then(wrappedCallback, wrappedErrback, wrappedProgressback);\n          }\n\n          return result.promise;\n        },\n\n        \"catch\": function(callback) {\n          return this.then(null, callback);\n        },\n\n        \"finally\": function(callback) {\n\n          function makePromise(value, resolved) {\n            var result = defer();\n            if (resolved) {\n              result.resolve(value);\n            } else {\n              result.reject(value);\n            }\n            return result.promise;\n          }\n\n          function handleCallback(value, isResolved) {\n            var callbackOutput = null;\n            try {\n              callbackOutput = (callback ||defaultCallback)();\n            } catch(e) {\n              return makePromise(e, false);\n            }\n            if (isPromiseLike(callbackOutput)) {\n              return callbackOutput.then(function() {\n                return makePromise(value, isResolved);\n              }, function(error) {\n                return makePromise(error, false);\n              });\n            } else {\n              return makePromise(value, isResolved);\n            }\n          }\n\n          return this.then(function(value) {\n            return handleCallback(value, true);\n          }, function(error) {\n            return handleCallback(error, false);\n          });\n        }\n      }\n    };\n\n    return deferred;\n  };\n\n\n  var ref = function(value) {\n    if (isPromiseLike(value)) return value;\n    return {\n      then: function(callback) {\n        var result = defer();\n        nextTick(function() {\n          result.resolve(callback(value));\n        });\n        return result.promise;\n      }\n    };\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $q#reject\n   * @kind function\n   *\n   * @description\n   * Creates a promise that is resolved as rejected with the specified `reason`. This api should be\n   * used to forward rejection in a chain of promises. If you are dealing with the last promise in\n   * a promise chain, you don't need to worry about it.\n   *\n   * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of\n   * `reject` as the `throw` keyword in JavaScript. This also means that if you \"catch\" an error via\n   * a promise error callback and you want to forward the error to the promise derived from the\n   * current promise, you have to \"rethrow\" the error by returning a rejection constructed via\n   * `reject`.\n   *\n   * ```js\n   *   promiseB = promiseA.then(function(result) {\n   *     // success: do something and resolve promiseB\n   *     //          with the old or a new result\n   *     return result;\n   *   }, function(reason) {\n   *     // error: handle the error if possible and\n   *     //        resolve promiseB with newPromiseOrValue,\n   *     //        otherwise forward the rejection to promiseB\n   *     if (canHandle(reason)) {\n   *      // handle the error and recover\n   *      return newPromiseOrValue;\n   *     }\n   *     return $q.reject(reason);\n   *   });\n   * ```\n   *\n   * @param {*} reason Constant, message, exception or an object representing the rejection reason.\n   * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.\n   */\n  var reject = function(reason) {\n    var result = defer();\n    result.reject(reason);\n    return result.promise;\n  };\n\n  var createInternalRejectedPromise = function(reason) {\n    return {\n      then: function(callback, errback) {\n        var result = defer();\n        nextTick(function() {\n          try {\n            result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));\n          } catch(e) {\n            result.reject(e);\n            exceptionHandler(e);\n          }\n        });\n        return result.promise;\n      }\n    };\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $q#when\n   * @kind function\n   *\n   * @description\n   * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.\n   * This is useful when you are dealing with an object that might or might not be a promise, or if\n   * the promise comes from a source that can't be trusted.\n   *\n   * @param {*} value Value or a promise\n   * @returns {Promise} Returns a promise of the passed value or promise\n   */\n  var when = function(value, callback, errback, progressback) {\n    var result = defer(),\n        done;\n\n    var wrappedCallback = function(value) {\n      try {\n        return (isFunction(callback) ? callback : defaultCallback)(value);\n      } catch (e) {\n        exceptionHandler(e);\n        return reject(e);\n      }\n    };\n\n    var wrappedErrback = function(reason) {\n      try {\n        return (isFunction(errback) ? errback : defaultErrback)(reason);\n      } catch (e) {\n        exceptionHandler(e);\n        return reject(e);\n      }\n    };\n\n    var wrappedProgressback = function(progress) {\n      try {\n        return (isFunction(progressback) ? progressback : defaultCallback)(progress);\n      } catch (e) {\n        exceptionHandler(e);\n      }\n    };\n\n    nextTick(function() {\n      ref(value).then(function(value) {\n        if (done) return;\n        done = true;\n        result.resolve(ref(value).then(wrappedCallback, wrappedErrback, wrappedProgressback));\n      }, function(reason) {\n        if (done) return;\n        done = true;\n        result.resolve(wrappedErrback(reason));\n      }, function(progress) {\n        if (done) return;\n        result.notify(wrappedProgressback(progress));\n      });\n    });\n\n    return result.promise;\n  };\n\n\n  function defaultCallback(value) {\n    return value;\n  }\n\n\n  function defaultErrback(reason) {\n    return reject(reason);\n  }\n\n\n  /**\n   * @ngdoc method\n   * @name $q#all\n   * @kind function\n   *\n   * @description\n   * Combines multiple promises into a single promise that is resolved when all of the input\n   * promises are resolved.\n   *\n   * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.\n   * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,\n   *   each value corresponding to the promise at the same index/key in the `promises` array/hash.\n   *   If any of the promises is resolved with a rejection, this resulting promise will be rejected\n   *   with the same rejection value.\n   */\n  function all(promises) {\n    var deferred = defer(),\n        counter = 0,\n        results = isArray(promises) ? [] : {};\n\n    forEach(promises, function(promise, key) {\n      counter++;\n      ref(promise).then(function(value) {\n        if (results.hasOwnProperty(key)) return;\n        results[key] = value;\n        if (!(--counter)) deferred.resolve(results);\n      }, function(reason) {\n        if (results.hasOwnProperty(key)) return;\n        deferred.reject(reason);\n      });\n    });\n\n    if (counter === 0) {\n      deferred.resolve(results);\n    }\n\n    return deferred.promise;\n  }\n\n  return {\n    defer: defer,\n    reject: reject,\n    when: when,\n    all: all\n  };\n}\n\nfunction $$RAFProvider(){ //rAF\n  this.$get = ['$window', '$timeout', function($window, $timeout) {\n    var requestAnimationFrame = $window.requestAnimationFrame ||\n                                $window.webkitRequestAnimationFrame ||\n                                $window.mozRequestAnimationFrame;\n\n    var cancelAnimationFrame = $window.cancelAnimationFrame ||\n                               $window.webkitCancelAnimationFrame ||\n                               $window.mozCancelAnimationFrame ||\n                               $window.webkitCancelRequestAnimationFrame;\n\n    var rafSupported = !!requestAnimationFrame;\n    var raf = rafSupported\n      ? function(fn) {\n          var id = requestAnimationFrame(fn);\n          return function() {\n            cancelAnimationFrame(id);\n          };\n        }\n      : function(fn) {\n          var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666\n          return function() {\n            $timeout.cancel(timer);\n          };\n        };\n\n    raf.supported = rafSupported;\n\n    return raf;\n  }];\n}\n\n/**\n * DESIGN NOTES\n *\n * The design decisions behind the scope are heavily favored for speed and memory consumption.\n *\n * The typical use of scope is to watch the expressions, which most of the time return the same\n * value as last time so we optimize the operation.\n *\n * Closures construction is expensive in terms of speed as well as memory:\n *   - No closures, instead use prototypical inheritance for API\n *   - Internal state needs to be stored on scope directly, which means that private state is\n *     exposed as $$____ properties\n *\n * Loop operations are optimized by using while(count--) { ... }\n *   - this means that in order to keep the same order of execution as addition we have to add\n *     items to the array at the beginning (unshift) instead of at the end (push)\n *\n * Child scopes are created and removed often\n *   - Using an array would be slow since inserts in middle are expensive so we use linked list\n *\n * There are few watches then a lot of observers. This is why you don't want the observer to be\n * implemented in the same way as watch. Watch requires return of initialization function which\n * are expensive to construct.\n */\n\n\n/**\n * @ngdoc provider\n * @name $rootScopeProvider\n * @description\n *\n * Provider for the $rootScope service.\n */\n\n/**\n * @ngdoc method\n * @name $rootScopeProvider#digestTtl\n * @description\n *\n * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and\n * assuming that the model is unstable.\n *\n * The current default is 10 iterations.\n *\n * In complex applications it's possible that the dependencies between `$watch`s will result in\n * several digest iterations. However if an application needs more than the default 10 digest\n * iterations for its model to stabilize then you should investigate what is causing the model to\n * continuously change during the digest.\n *\n * Increasing the TTL could have performance implications, so you should not change it without\n * proper justification.\n *\n * @param {number} limit The number of digest iterations.\n */\n\n\n/**\n * @ngdoc service\n * @name $rootScope\n * @description\n *\n * Every application has a single root {@link ng.$rootScope.Scope scope}.\n * All other scopes are descendant scopes of the root scope. Scopes provide separation\n * between the model and the view, via a mechanism for watching the model for changes.\n * They also provide an event emission/broadcast and subscription facility. See the\n * {@link guide/scope developer guide on scopes}.\n */\nfunction $RootScopeProvider(){\n  var TTL = 10;\n  var $rootScopeMinErr = minErr('$rootScope');\n  var lastDirtyWatch = null;\n\n  this.digestTtl = function(value) {\n    if (arguments.length) {\n      TTL = value;\n    }\n    return TTL;\n  };\n\n  this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',\n      function( $injector,   $exceptionHandler,   $parse,   $browser) {\n\n    /**\n     * @ngdoc type\n     * @name $rootScope.Scope\n     *\n     * @description\n     * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the\n     * {@link auto.$injector $injector}. Child scopes are created using the\n     * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when\n     * compiled HTML template is executed.)\n     *\n     * Here is a simple scope snippet to show how you can interact with the scope.\n     * ```html\n     * <file src=\"./test/ng/rootScopeSpec.js\" tag=\"docs1\" />\n     * ```\n     *\n     * # Inheritance\n     * A scope can inherit from a parent scope, as in this example:\n     * ```js\n         var parent = $rootScope;\n         var child = parent.$new();\n\n         parent.salutation = \"Hello\";\n         child.name = \"World\";\n         expect(child.salutation).toEqual('Hello');\n\n         child.salutation = \"Welcome\";\n         expect(child.salutation).toEqual('Welcome');\n         expect(parent.salutation).toEqual('Hello');\n     * ```\n     *\n     *\n     * @param {Object.<string, function()>=} providers Map of service factory which need to be\n     *                                       provided for the current scope. Defaults to {@link ng}.\n     * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should\n     *                              append/override services provided by `providers`. This is handy\n     *                              when unit-testing and having the need to override a default\n     *                              service.\n     * @returns {Object} Newly created scope.\n     *\n     */\n    function Scope() {\n      this.$id = nextUid();\n      this.$$phase = this.$parent = this.$$watchers =\n                     this.$$nextSibling = this.$$prevSibling =\n                     this.$$childHead = this.$$childTail = null;\n      this['this'] = this.$root =  this;\n      this.$$destroyed = false;\n      this.$$asyncQueue = [];\n      this.$$postDigestQueue = [];\n      this.$$listeners = {};\n      this.$$listenerCount = {};\n      this.$$isolateBindings = {};\n    }\n\n    /**\n     * @ngdoc property\n     * @name $rootScope.Scope#$id\n     *\n     * @description\n     * Unique scope ID (monotonically increasing) useful for debugging.\n     */\n\n     /**\n      * @ngdoc property\n      * @name $rootScope.Scope#$parent\n      *\n      * @description\n      * Reference to the parent scope.\n      */\n\n      /**\n       * @ngdoc property\n       * @name $rootScope.Scope#$root\n       *\n       * @description\n       * Reference to the root scope.\n       */\n\n    Scope.prototype = {\n      constructor: Scope,\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$new\n       * @kind function\n       *\n       * @description\n       * Creates a new child {@link ng.$rootScope.Scope scope}.\n       *\n       * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.\n       * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.\n       *\n       * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is\n       * desired for the scope and its child scopes to be permanently detached from the parent and\n       * thus stop participating in model change detection and listener notification by invoking.\n       *\n       * @param {boolean} isolate If true, then the scope does not prototypically inherit from the\n       *         parent scope. The scope is isolated, as it can not see parent scope properties.\n       *         When creating widgets, it is useful for the widget to not accidentally read parent\n       *         state.\n       *\n       * @returns {Object} The newly created child scope.\n       *\n       */\n      $new: function(isolate) {\n        var ChildScope,\n            child;\n\n        if (isolate) {\n          child = new Scope();\n          child.$root = this.$root;\n          // ensure that there is just one async queue per $rootScope and its children\n          child.$$asyncQueue = this.$$asyncQueue;\n          child.$$postDigestQueue = this.$$postDigestQueue;\n        } else {\n          // Only create a child scope class if somebody asks for one,\n          // but cache it to allow the VM to optimize lookups.\n          if (!this.$$childScopeClass) {\n            this.$$childScopeClass = function() {\n              this.$$watchers = this.$$nextSibling =\n                  this.$$childHead = this.$$childTail = null;\n              this.$$listeners = {};\n              this.$$listenerCount = {};\n              this.$id = nextUid();\n              this.$$childScopeClass = null;\n            };\n            this.$$childScopeClass.prototype = this;\n          }\n          child = new this.$$childScopeClass();\n        }\n        child['this'] = child;\n        child.$parent = this;\n        child.$$prevSibling = this.$$childTail;\n        if (this.$$childHead) {\n          this.$$childTail.$$nextSibling = child;\n          this.$$childTail = child;\n        } else {\n          this.$$childHead = this.$$childTail = child;\n        }\n        return child;\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watch\n       * @kind function\n       *\n       * @description\n       * Registers a `listener` callback to be executed whenever the `watchExpression` changes.\n       *\n       * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest\n       *   $digest()} and should return the value that will be watched. (Since\n       *   {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the\n       *   `watchExpression` can execute multiple times per\n       *   {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)\n       * - The `listener` is called only when the value from the current `watchExpression` and the\n       *   previous call to `watchExpression` are not equal (with the exception of the initial run,\n       *   see below). Inequality is determined according to reference inequality,\n       *   [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)\n       *    via the `!==` Javascript operator, unless `objectEquality == true`\n       *   (see next point)\n       * - When `objectEquality == true`, inequality of the `watchExpression` is determined\n       *   according to the {@link angular.equals} function. To save the value of the object for\n       *   later comparison, the {@link angular.copy} function is used. This therefore means that\n       *   watching complex objects will have adverse memory and performance implications.\n       * - The watch `listener` may change the model, which may trigger other `listener`s to fire.\n       *   This is achieved by rerunning the watchers until no changes are detected. The rerun\n       *   iteration limit is 10 to prevent an infinite loop deadlock.\n       *\n       *\n       * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,\n       * you can register a `watchExpression` function with no `listener`. (Since `watchExpression`\n       * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a\n       * change is detected, be prepared for multiple calls to your listener.)\n       *\n       * After a watcher is registered with the scope, the `listener` fn is called asynchronously\n       * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the\n       * watcher. In rare cases, this is undesirable because the listener is called when the result\n       * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you\n       * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the\n       * listener was called due to initialization.\n       *\n       * The example below contains an illustration of using a function as your $watch listener\n       *\n       *\n       * # Example\n       * ```js\n           // let's assume that scope was dependency injected as the $rootScope\n           var scope = $rootScope;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n\n\n\n           // Using a listener function\n           var food;\n           scope.foodCounter = 0;\n           expect(scope.foodCounter).toEqual(0);\n           scope.$watch(\n             // This is the listener function\n             function() { return food; },\n             // This is the change handler\n             function(newValue, oldValue) {\n               if ( newValue !== oldValue ) {\n                 // Only increment the counter if the value changed\n                 scope.foodCounter = scope.foodCounter + 1;\n               }\n             }\n           );\n           // No digest has been run so the counter will be zero\n           expect(scope.foodCounter).toEqual(0);\n\n           // Run the digest but since food has not changed count will still be zero\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(0);\n\n           // Update food and run digest.  Now the counter will increment\n           food = 'cheeseburger';\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(1);\n\n       * ```\n       *\n       *\n       *\n       * @param {(function()|string)} watchExpression Expression that is evaluated on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers\n       *    a call to the `listener`.\n       *\n       *    - `string`: Evaluated as {@link guide/expression expression}\n       *    - `function(scope)`: called with current `scope` as a parameter.\n       * @param {(function()|string)=} listener Callback called whenever the return value of\n       *   the `watchExpression` changes.\n       *\n       *    - `string`: Evaluated as {@link guide/expression expression}\n       *    - `function(newValue, oldValue, scope)`: called with current and previous values as\n       *      parameters.\n       *\n       * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of\n       *     comparing for reference equality.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $watch: function(watchExp, listener, objectEquality) {\n        var scope = this,\n            get = compileToFn(watchExp, 'watch'),\n            array = scope.$$watchers,\n            watcher = {\n              fn: listener,\n              last: initWatchVal,\n              get: get,\n              exp: watchExp,\n              eq: !!objectEquality\n            };\n\n        lastDirtyWatch = null;\n\n        // in the case user pass string, we need to compile it, do we really need this ?\n        if (!isFunction(listener)) {\n          var listenFn = compileToFn(listener || noop, 'listener');\n          watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);};\n        }\n\n        if (typeof watchExp == 'string' && get.constant) {\n          var originalFn = watcher.fn;\n          watcher.fn = function(newVal, oldVal, scope) {\n            originalFn.call(this, newVal, oldVal, scope);\n            arrayRemove(array, watcher);\n          };\n        }\n\n        if (!array) {\n          array = scope.$$watchers = [];\n        }\n        // we use unshift since we use a while loop in $digest for speed.\n        // the while loop reads in reverse order.\n        array.unshift(watcher);\n\n        return function deregisterWatch() {\n          arrayRemove(array, watcher);\n          lastDirtyWatch = null;\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watchCollection\n       * @kind function\n       *\n       * @description\n       * Shallow watches the properties of an object and fires whenever any of the properties change\n       * (for arrays, this implies watching the array items; for object maps, this implies watching\n       * the properties). If a change is detected, the `listener` callback is fired.\n       *\n       * - The `obj` collection is observed via standard $watch operation and is examined on every\n       *   call to $digest() to see if any items have been added, removed, or moved.\n       * - The `listener` is called whenever anything within the `obj` has changed. Examples include\n       *   adding, removing, and moving items belonging to an object or array.\n       *\n       *\n       * # Example\n       * ```js\n          $scope.names = ['igor', 'matias', 'misko', 'james'];\n          $scope.dataCount = 4;\n\n          $scope.$watchCollection('names', function(newNames, oldNames) {\n            $scope.dataCount = newNames.length;\n          });\n\n          expect($scope.dataCount).toEqual(4);\n          $scope.$digest();\n\n          //still at 4 ... no changes\n          expect($scope.dataCount).toEqual(4);\n\n          $scope.names.pop();\n          $scope.$digest();\n\n          //now there's been a change\n          expect($scope.dataCount).toEqual(3);\n       * ```\n       *\n       *\n       * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The\n       *    expression value should evaluate to an object or an array which is observed on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the\n       *    collection will trigger a call to the `listener`.\n       *\n       * @param {function(newCollection, oldCollection, scope)} listener a callback function called\n       *    when a change is detected.\n       *    - The `newCollection` object is the newly modified data obtained from the `obj` expression\n       *    - The `oldCollection` object is a copy of the former collection data.\n       *      Due to performance considerations, the`oldCollection` value is computed only if the\n       *      `listener` function declares two or more arguments.\n       *    - The `scope` argument refers to the current scope.\n       *\n       * @returns {function()} Returns a de-registration function for this listener. When the\n       *    de-registration function is executed, the internal watch operation is terminated.\n       */\n      $watchCollection: function(obj, listener) {\n        var self = this;\n        // the current value, updated on each dirty-check run\n        var newValue;\n        // a shallow copy of the newValue from the last dirty-check run,\n        // updated to match newValue during dirty-check run\n        var oldValue;\n        // a shallow copy of the newValue from when the last change happened\n        var veryOldValue;\n        // only track veryOldValue if the listener is asking for it\n        var trackVeryOldValue = (listener.length > 1);\n        var changeDetected = 0;\n        var objGetter = $parse(obj);\n        var internalArray = [];\n        var internalObject = {};\n        var initRun = true;\n        var oldLength = 0;\n\n        function $watchCollectionWatch() {\n          newValue = objGetter(self);\n          var newLength, key, bothNaN;\n\n          if (!isObject(newValue)) { // if primitive\n            if (oldValue !== newValue) {\n              oldValue = newValue;\n              changeDetected++;\n            }\n          } else if (isArrayLike(newValue)) {\n            if (oldValue !== internalArray) {\n              // we are transitioning from something which was not an array into array.\n              oldValue = internalArray;\n              oldLength = oldValue.length = 0;\n              changeDetected++;\n            }\n\n            newLength = newValue.length;\n\n            if (oldLength !== newLength) {\n              // if lengths do not match we need to trigger change notification\n              changeDetected++;\n              oldValue.length = oldLength = newLength;\n            }\n            // copy the items to oldValue and look for changes.\n            for (var i = 0; i < newLength; i++) {\n              bothNaN = (oldValue[i] !== oldValue[i]) &&\n                  (newValue[i] !== newValue[i]);\n              if (!bothNaN && (oldValue[i] !== newValue[i])) {\n                changeDetected++;\n                oldValue[i] = newValue[i];\n              }\n            }\n          } else {\n            if (oldValue !== internalObject) {\n              // we are transitioning from something which was not an object into object.\n              oldValue = internalObject = {};\n              oldLength = 0;\n              changeDetected++;\n            }\n            // copy the items to oldValue and look for changes.\n            newLength = 0;\n            for (key in newValue) {\n              if (newValue.hasOwnProperty(key)) {\n                newLength++;\n                if (oldValue.hasOwnProperty(key)) {\n                  bothNaN = (oldValue[key] !== oldValue[key]) &&\n                      (newValue[key] !== newValue[key]);\n                  if (!bothNaN && (oldValue[key] !== newValue[key])) {\n                    changeDetected++;\n                    oldValue[key] = newValue[key];\n                  }\n                } else {\n                  oldLength++;\n                  oldValue[key] = newValue[key];\n                  changeDetected++;\n                }\n              }\n            }\n            if (oldLength > newLength) {\n              // we used to have more keys, need to find them and destroy them.\n              changeDetected++;\n              for(key in oldValue) {\n                if (oldValue.hasOwnProperty(key) && !newValue.hasOwnProperty(key)) {\n                  oldLength--;\n                  delete oldValue[key];\n                }\n              }\n            }\n          }\n          return changeDetected;\n        }\n\n        function $watchCollectionAction() {\n          if (initRun) {\n            initRun = false;\n            listener(newValue, newValue, self);\n          } else {\n            listener(newValue, veryOldValue, self);\n          }\n\n          // make a copy for the next time a collection is changed\n          if (trackVeryOldValue) {\n            if (!isObject(newValue)) {\n              //primitive\n              veryOldValue = newValue;\n            } else if (isArrayLike(newValue)) {\n              veryOldValue = new Array(newValue.length);\n              for (var i = 0; i < newValue.length; i++) {\n                veryOldValue[i] = newValue[i];\n              }\n            } else { // if object\n              veryOldValue = {};\n              for (var key in newValue) {\n                if (hasOwnProperty.call(newValue, key)) {\n                  veryOldValue[key] = newValue[key];\n                }\n              }\n            }\n          }\n        }\n\n        return this.$watch($watchCollectionWatch, $watchCollectionAction);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$digest\n       * @kind function\n       *\n       * @description\n       * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and\n       * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change\n       * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}\n       * until no more listeners are firing. This means that it is possible to get into an infinite\n       * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of\n       * iterations exceeds 10.\n       *\n       * Usually, you don't call `$digest()` directly in\n       * {@link ng.directive:ngController controllers} or in\n       * {@link ng.$compileProvider#directive directives}.\n       * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within\n       * a {@link ng.$compileProvider#directive directives}), which will force a `$digest()`.\n       *\n       * If you want to be notified whenever `$digest()` is called,\n       * you can register a `watchExpression` function with\n       * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.\n       *\n       * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.\n       *\n       * # Example\n       * ```js\n           var scope = ...;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n       * ```\n       *\n       */\n      $digest: function() {\n        var watch, value, last,\n            watchers,\n            asyncQueue = this.$$asyncQueue,\n            postDigestQueue = this.$$postDigestQueue,\n            length,\n            dirty, ttl = TTL,\n            next, current, target = this,\n            watchLog = [],\n            logIdx, logMsg, asyncTask;\n\n        beginPhase('$digest');\n        // Check for changes to browser url that happened in sync before the call to $digest\n        $browser.$$checkUrlChange();\n\n        lastDirtyWatch = null;\n\n        do { // \"while dirty\" loop\n          dirty = false;\n          current = target;\n\n          while(asyncQueue.length) {\n            try {\n              asyncTask = asyncQueue.shift();\n              asyncTask.scope.$eval(asyncTask.expression);\n            } catch (e) {\n              clearPhase();\n              $exceptionHandler(e);\n            }\n            lastDirtyWatch = null;\n          }\n\n          traverseScopesLoop:\n          do { // \"traverse the scopes\" loop\n            if ((watchers = current.$$watchers)) {\n              // process our watches\n              length = watchers.length;\n              while (length--) {\n                try {\n                  watch = watchers[length];\n                  // Most common watches are on primitives, in which case we can short\n                  // circuit it with === operator, only when === fails do we use .equals\n                  if (watch) {\n                    if ((value = watch.get(current)) !== (last = watch.last) &&\n                        !(watch.eq\n                            ? equals(value, last)\n                            : (typeof value === 'number' && typeof last === 'number'\n                               && isNaN(value) && isNaN(last)))) {\n                      dirty = true;\n                      lastDirtyWatch = watch;\n                      watch.last = watch.eq ? copy(value, null) : value;\n                      watch.fn(value, ((last === initWatchVal) ? value : last), current);\n                      if (ttl < 5) {\n                        logIdx = 4 - ttl;\n                        if (!watchLog[logIdx]) watchLog[logIdx] = [];\n                        logMsg = (isFunction(watch.exp))\n                            ? 'fn: ' + (watch.exp.name || watch.exp.toString())\n                            : watch.exp;\n                        logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);\n                        watchLog[logIdx].push(logMsg);\n                      }\n                    } else if (watch === lastDirtyWatch) {\n                      // If the most recently dirty watcher is now clean, short circuit since the remaining watchers\n                      // have already been tested.\n                      dirty = false;\n                      break traverseScopesLoop;\n                    }\n                  }\n                } catch (e) {\n                  clearPhase();\n                  $exceptionHandler(e);\n                }\n              }\n            }\n\n            // Insanity Warning: scope depth-first traversal\n            // yes, this code is a bit crazy, but it works and we have tests to prove it!\n            // this piece should be kept in sync with the traversal in $broadcast\n            if (!(next = (current.$$childHead ||\n                (current !== target && current.$$nextSibling)))) {\n              while(current !== target && !(next = current.$$nextSibling)) {\n                current = current.$parent;\n              }\n            }\n          } while ((current = next));\n\n          // `break traverseScopesLoop;` takes us to here\n\n          if((dirty || asyncQueue.length) && !(ttl--)) {\n            clearPhase();\n            throw $rootScopeMinErr('infdig',\n                '{0} $digest() iterations reached. Aborting!\\n' +\n                'Watchers fired in the last 5 iterations: {1}',\n                TTL, toJson(watchLog));\n          }\n\n        } while (dirty || asyncQueue.length);\n\n        clearPhase();\n\n        while(postDigestQueue.length) {\n          try {\n            postDigestQueue.shift()();\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        }\n      },\n\n\n      /**\n       * @ngdoc event\n       * @name $rootScope.Scope#$destroy\n       * @eventType broadcast on scope being destroyed\n       *\n       * @description\n       * Broadcasted when a scope and its children are being destroyed.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$destroy\n       * @kind function\n       *\n       * @description\n       * Removes the current scope (and all of its children) from the parent scope. Removal implies\n       * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer\n       * propagate to the current scope and its children. Removal also implies that the current\n       * scope is eligible for garbage collection.\n       *\n       * The `$destroy()` is usually used by directives such as\n       * {@link ng.directive:ngRepeat ngRepeat} for managing the\n       * unrolling of the loop.\n       *\n       * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.\n       * Application code can register a `$destroy` event handler that will give it a chance to\n       * perform any necessary cleanup.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n      $destroy: function() {\n        // we can't destroy the root scope or a scope that has been already destroyed\n        if (this.$$destroyed) return;\n        var parent = this.$parent;\n\n        this.$broadcast('$destroy');\n        this.$$destroyed = true;\n        if (this === $rootScope) return;\n\n        forEach(this.$$listenerCount, bind(null, decrementListenerCount, this));\n\n        // sever all the references to parent scopes (after this cleanup, the current scope should\n        // not be retained by any of our references and should be eligible for garbage collection)\n        if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;\n        if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;\n        if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;\n        if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;\n\n\n        // All of the code below is bogus code that works around V8's memory leak via optimized code\n        // and inline caches.\n        //\n        // see:\n        // - https://code.google.com/p/v8/issues/detail?id=2073#c26\n        // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909\n        // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451\n\n        this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =\n            this.$$childTail = this.$root = null;\n\n        // don't reset these to null in case some async task tries to register a listener/watch/task\n        this.$$listeners = {};\n        this.$$watchers = this.$$asyncQueue = this.$$postDigestQueue = [];\n\n        // prevent NPEs since these methods have references to properties we nulled out\n        this.$destroy = this.$digest = this.$apply = noop;\n        this.$on = this.$watch = function() { return noop; };\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$eval\n       * @kind function\n       *\n       * @description\n       * Executes the `expression` on the current scope and returns the result. Any exceptions in\n       * the expression are propagated (uncaught). This is useful when evaluating Angular\n       * expressions.\n       *\n       * # Example\n       * ```js\n           var scope = ng.$rootScope.Scope();\n           scope.a = 1;\n           scope.b = 2;\n\n           expect(scope.$eval('a+b')).toEqual(3);\n           expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);\n       * ```\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in  {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n       * @returns {*} The result of evaluating the expression.\n       */\n      $eval: function(expr, locals) {\n        return $parse(expr)(this, locals);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$evalAsync\n       * @kind function\n       *\n       * @description\n       * Executes the expression on the current scope at a later point in time.\n       *\n       * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only\n       * that:\n       *\n       *   - it will execute after the function that scheduled the evaluation (preferably before DOM\n       *     rendering).\n       *   - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after\n       *     `expression` execution.\n       *\n       * Any exceptions from the execution of the expression are forwarded to the\n       * {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle\n       * will be scheduled. However, it is encouraged to always call code that changes the model\n       * from within an `$apply` call. That includes code evaluated via `$evalAsync`.\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       */\n      $evalAsync: function(expr) {\n        // if we are outside of an $digest loop and this is the first time we are scheduling async\n        // task also schedule async auto-flush\n        if (!$rootScope.$$phase && !$rootScope.$$asyncQueue.length) {\n          $browser.defer(function() {\n            if ($rootScope.$$asyncQueue.length) {\n              $rootScope.$digest();\n            }\n          });\n        }\n\n        this.$$asyncQueue.push({scope: this, expression: expr});\n      },\n\n      $$postDigest : function(fn) {\n        this.$$postDigestQueue.push(fn);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$apply\n       * @kind function\n       *\n       * @description\n       * `$apply()` is used to execute an expression in angular from outside of the angular\n       * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).\n       * Because we are calling into the angular framework we need to perform proper scope life\n       * cycle of {@link ng.$exceptionHandler exception handling},\n       * {@link ng.$rootScope.Scope#$digest executing watches}.\n       *\n       * ## Life cycle\n       *\n       * # Pseudo-Code of `$apply()`\n       * ```js\n           function $apply(expr) {\n             try {\n               return $eval(expr);\n             } catch (e) {\n               $exceptionHandler(e);\n             } finally {\n               $root.$digest();\n             }\n           }\n       * ```\n       *\n       *\n       * Scope's `$apply()` method transitions through the following stages:\n       *\n       * 1. The {@link guide/expression expression} is executed using the\n       *    {@link ng.$rootScope.Scope#$eval $eval()} method.\n       * 2. Any exceptions from the execution of the expression are forwarded to the\n       *    {@link ng.$exceptionHandler $exceptionHandler} service.\n       * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the\n       *    expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.\n       *\n       *\n       * @param {(string|function())=} exp An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with current `scope` parameter.\n       *\n       * @returns {*} The result of evaluating the expression.\n       */\n      $apply: function(expr) {\n        try {\n          beginPhase('$apply');\n          return this.$eval(expr);\n        } catch (e) {\n          $exceptionHandler(e);\n        } finally {\n          clearPhase();\n          try {\n            $rootScope.$digest();\n          } catch (e) {\n            $exceptionHandler(e);\n            throw e;\n          }\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$on\n       * @kind function\n       *\n       * @description\n       * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for\n       * discussion of event life cycle.\n       *\n       * The event listener function format is: `function(event, args...)`. The `event` object\n       * passed into the listener has the following attributes:\n       *\n       *   - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or\n       *     `$broadcast`-ed.\n       *   - `currentScope` - `{Scope}`: the current scope which is handling the event.\n       *   - `name` - `{string}`: name of the event.\n       *   - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel\n       *     further event propagation (available only for events that were `$emit`-ed).\n       *   - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag\n       *     to true.\n       *   - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.\n       *\n       * @param {string} name Event name to listen on.\n       * @param {function(event, ...args)} listener Function to call when the event is emitted.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $on: function(name, listener) {\n        var namedListeners = this.$$listeners[name];\n        if (!namedListeners) {\n          this.$$listeners[name] = namedListeners = [];\n        }\n        namedListeners.push(listener);\n\n        var current = this;\n        do {\n          if (!current.$$listenerCount[name]) {\n            current.$$listenerCount[name] = 0;\n          }\n          current.$$listenerCount[name]++;\n        } while ((current = current.$parent));\n\n        var self = this;\n        return function() {\n          namedListeners[indexOf(namedListeners, listener)] = null;\n          decrementListenerCount(self, 1, name);\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$emit\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` upwards through the scope hierarchy notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$emit` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event traverses upwards toward the root scope and calls all\n       * registered listeners along the way. The event will stop propagating if one of the listeners\n       * cancels it.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to emit.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).\n       */\n      $emit: function(name, args) {\n        var empty = [],\n            namedListeners,\n            scope = this,\n            stopPropagation = false,\n            event = {\n              name: name,\n              targetScope: scope,\n              stopPropagation: function() {stopPropagation = true;},\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            },\n            listenerArgs = concat([event], arguments, 1),\n            i, length;\n\n        do {\n          namedListeners = scope.$$listeners[name] || empty;\n          event.currentScope = scope;\n          for (i=0, length=namedListeners.length; i<length; i++) {\n\n            // if listeners were deregistered, defragment the array\n            if (!namedListeners[i]) {\n              namedListeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n            try {\n              //allow all listeners attached to the current scope to run\n              namedListeners[i].apply(null, listenerArgs);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n          }\n          //if any listener on the current scope stops propagation, prevent bubbling\n          if (stopPropagation) return event;\n          //traverse upwards\n          scope = scope.$parent;\n        } while (scope);\n\n        return event;\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$broadcast\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` downwards to all child scopes (and their children) notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$broadcast` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event propagates to all direct and indirect scopes of the current\n       * scope and calls all registered listeners along the way. The event cannot be canceled.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to broadcast.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}\n       */\n      $broadcast: function(name, args) {\n        var target = this,\n            current = target,\n            next = target,\n            event = {\n              name: name,\n              targetScope: target,\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            },\n            listenerArgs = concat([event], arguments, 1),\n            listeners, i, length;\n\n        //down while you can, then up and next sibling or up and next sibling until back at root\n        while ((current = next)) {\n          event.currentScope = current;\n          listeners = current.$$listeners[name] || [];\n          for (i=0, length = listeners.length; i<length; i++) {\n            // if listeners were deregistered, defragment the array\n            if (!listeners[i]) {\n              listeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n\n            try {\n              listeners[i].apply(null, listenerArgs);\n            } catch(e) {\n              $exceptionHandler(e);\n            }\n          }\n\n          // Insanity Warning: scope depth-first traversal\n          // yes, this code is a bit crazy, but it works and we have tests to prove it!\n          // this piece should be kept in sync with the traversal in $digest\n          // (though it differs due to having the extra check for $$listenerCount)\n          if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||\n              (current !== target && current.$$nextSibling)))) {\n            while(current !== target && !(next = current.$$nextSibling)) {\n              current = current.$parent;\n            }\n          }\n        }\n\n        return event;\n      }\n    };\n\n    var $rootScope = new Scope();\n\n    return $rootScope;\n\n\n    function beginPhase(phase) {\n      if ($rootScope.$$phase) {\n        throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);\n      }\n\n      $rootScope.$$phase = phase;\n    }\n\n    function clearPhase() {\n      $rootScope.$$phase = null;\n    }\n\n    function compileToFn(exp, name) {\n      var fn = $parse(exp);\n      assertArgFn(fn, name);\n      return fn;\n    }\n\n    function decrementListenerCount(current, count, name) {\n      do {\n        current.$$listenerCount[name] -= count;\n\n        if (current.$$listenerCount[name] === 0) {\n          delete current.$$listenerCount[name];\n        }\n      } while ((current = current.$parent));\n    }\n\n    /**\n     * function used as an initial value for watchers.\n     * because it's unique we can easily tell it apart from other values\n     */\n    function initWatchVal() {}\n  }];\n}\n\n/**\n * @description\n * Private service to sanitize uris for links and images. Used by $compile and $sanitize.\n */\nfunction $$SanitizeUriProvider() {\n  var aHrefSanitizationWhitelist = /^\\s*(https?|ftp|mailto|tel|file):/,\n    imgSrcSanitizationWhitelist = /^\\s*((https?|ftp|file):|data:image\\/)/;\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      aHrefSanitizationWhitelist = regexp;\n      return this;\n    }\n    return aHrefSanitizationWhitelist;\n  };\n\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      imgSrcSanitizationWhitelist = regexp;\n      return this;\n    }\n    return imgSrcSanitizationWhitelist;\n  };\n\n  this.$get = function() {\n    return function sanitizeUri(uri, isImage) {\n      var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;\n      var normalizedVal;\n      // NOTE: urlResolve() doesn't support IE < 8 so we don't sanitize for that case.\n      if (!msie || msie >= 8 ) {\n        normalizedVal = urlResolve(uri).href;\n        if (normalizedVal !== '' && !normalizedVal.match(regex)) {\n          return 'unsafe:'+normalizedVal;\n        }\n      }\n      return uri;\n    };\n  };\n}\n\nvar $sceMinErr = minErr('$sce');\n\nvar SCE_CONTEXTS = {\n  HTML: 'html',\n  CSS: 'css',\n  URL: 'url',\n  // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a\n  // url.  (e.g. ng-include, script src, templateUrl)\n  RESOURCE_URL: 'resourceUrl',\n  JS: 'js'\n};\n\n// Helper functions follow.\n\n// Copied from:\n// http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962\n// Prereq: s is a string.\nfunction escapeForRegexp(s) {\n  return s.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1').\n           replace(/\\x08/g, '\\\\x08');\n}\n\n\nfunction adjustMatcher(matcher) {\n  if (matcher === 'self') {\n    return matcher;\n  } else if (isString(matcher)) {\n    // Strings match exactly except for 2 wildcards - '*' and '**'.\n    // '*' matches any character except those from the set ':/.?&'.\n    // '**' matches any character (like .* in a RegExp).\n    // More than 2 *'s raises an error as it's ill defined.\n    if (matcher.indexOf('***') > -1) {\n      throw $sceMinErr('iwcard',\n          'Illegal sequence *** in string matcher.  String: {0}', matcher);\n    }\n    matcher = escapeForRegexp(matcher).\n                  replace('\\\\*\\\\*', '.*').\n                  replace('\\\\*', '[^:/.?&;]*');\n    return new RegExp('^' + matcher + '$');\n  } else if (isRegExp(matcher)) {\n    // The only other type of matcher allowed is a Regexp.\n    // Match entire URL / disallow partial matches.\n    // Flags are reset (i.e. no global, ignoreCase or multiline)\n    return new RegExp('^' + matcher.source + '$');\n  } else {\n    throw $sceMinErr('imatcher',\n        'Matchers may only be \"self\", string patterns or RegExp objects');\n  }\n}\n\n\nfunction adjustMatchers(matchers) {\n  var adjustedMatchers = [];\n  if (isDefined(matchers)) {\n    forEach(matchers, function(matcher) {\n      adjustedMatchers.push(adjustMatcher(matcher));\n    });\n  }\n  return adjustedMatchers;\n}\n\n\n/**\n * @ngdoc service\n * @name $sceDelegate\n * @kind function\n *\n * @description\n *\n * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict\n * Contextual Escaping (SCE)} services to AngularJS.\n *\n * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of\n * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS.  This is\n * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to\n * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things\n * work because `$sce` delegates to `$sceDelegate` for these operations.\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.\n *\n * The default instance of `$sceDelegate` should work out of the box with little pain.  While you\n * can override it completely to change the behavior of `$sce`, the common case would\n * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting\n * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as\n * templates.  Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist\n * $sceDelegateProvider.resourceUrlWhitelist} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n */\n\n/**\n * @ngdoc provider\n * @name $sceDelegateProvider\n * @description\n *\n * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate\n * $sceDelegate} service.  This allows one to get/set the whitelists and blacklists used to ensure\n * that the URLs used for sourcing Angular templates are safe.  Refer {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and\n * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n *\n * For the general details about this service in Angular, read the main page for {@link ng.$sce\n * Strict Contextual Escaping (SCE)}.\n *\n * **Example**:  Consider the following case. <a name=\"example\"></a>\n *\n * - your app is hosted at url `http://myapp.example.com/`\n * - but some of your templates are hosted on other domains you control such as\n *   `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.\n * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.\n *\n * Here is what a secure configuration for this scenario might look like:\n *\n * ```\n *  angular.module('myApp', []).config(function($sceDelegateProvider) {\n *    $sceDelegateProvider.resourceUrlWhitelist([\n *      // Allow same origin resource loads.\n *      'self',\n *      // Allow loading from our assets domain.  Notice the difference between * and **.\n *      'http://srv*.assets.example.com/**'\n *    ]);\n *\n *    // The blacklist overrides the whitelist so the open redirect here is blocked.\n *    $sceDelegateProvider.resourceUrlBlacklist([\n *      'http://myapp.example.com/clickThru**'\n *    ]);\n *  });\n * ```\n */\n\nfunction $SceDelegateProvider() {\n  this.SCE_CONTEXTS = SCE_CONTEXTS;\n\n  // Resource URLs can also be trusted by policy.\n  var resourceUrlWhitelist = ['self'],\n      resourceUrlBlacklist = [];\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlWhitelist\n   * @kind function\n   *\n   * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value\n   *     provided.  This must be an array or null.  A snapshot of this array is used so further\n   *     changes to the array are ignored.\n   *\n   *     Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *     allowed in this array.\n   *\n   *     Note: **an empty whitelist array will block all URLs**!\n   *\n   * @return {Array} the currently set whitelist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is `['self']` allowing only\n   * same origin resource requests.\n   *\n   * @description\n   * Sets/Gets the whitelist of trusted resource URLs.\n   */\n  this.resourceUrlWhitelist = function (value) {\n    if (arguments.length) {\n      resourceUrlWhitelist = adjustMatchers(value);\n    }\n    return resourceUrlWhitelist;\n  };\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlBlacklist\n   * @kind function\n   *\n   * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value\n   *     provided.  This must be an array or null.  A snapshot of this array is used so further\n   *     changes to the array are ignored.\n   *\n   *     Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *     allowed in this array.\n   *\n   *     The typical usage for the blacklist is to **block\n   *     [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as\n   *     these would otherwise be trusted but actually return content from the redirected domain.\n   *\n   *     Finally, **the blacklist overrides the whitelist** and has the final say.\n   *\n   * @return {Array} the currently set blacklist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there\n   * is no blacklist.)\n   *\n   * @description\n   * Sets/Gets the blacklist of trusted resource URLs.\n   */\n\n  this.resourceUrlBlacklist = function (value) {\n    if (arguments.length) {\n      resourceUrlBlacklist = adjustMatchers(value);\n    }\n    return resourceUrlBlacklist;\n  };\n\n  this.$get = ['$injector', function($injector) {\n\n    var htmlSanitizer = function htmlSanitizer(html) {\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    };\n\n    if ($injector.has('$sanitize')) {\n      htmlSanitizer = $injector.get('$sanitize');\n    }\n\n\n    function matchUrl(matcher, parsedUrl) {\n      if (matcher === 'self') {\n        return urlIsSameOrigin(parsedUrl);\n      } else {\n        // definitely a regex.  See adjustMatchers()\n        return !!matcher.exec(parsedUrl.href);\n      }\n    }\n\n    function isResourceUrlAllowedByPolicy(url) {\n      var parsedUrl = urlResolve(url.toString());\n      var i, n, allowed = false;\n      // Ensure that at least one item from the whitelist allows this url.\n      for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {\n        if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {\n          allowed = true;\n          break;\n        }\n      }\n      if (allowed) {\n        // Ensure that no item from the blacklist blocked this url.\n        for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {\n          if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {\n            allowed = false;\n            break;\n          }\n        }\n      }\n      return allowed;\n    }\n\n    function generateHolderType(Base) {\n      var holderType = function TrustedValueHolderType(trustedValue) {\n        this.$$unwrapTrustedValue = function() {\n          return trustedValue;\n        };\n      };\n      if (Base) {\n        holderType.prototype = new Base();\n      }\n      holderType.prototype.valueOf = function sceValueOf() {\n        return this.$$unwrapTrustedValue();\n      };\n      holderType.prototype.toString = function sceToString() {\n        return this.$$unwrapTrustedValue().toString();\n      };\n      return holderType;\n    }\n\n    var trustedValueHolderBase = generateHolderType(),\n        byType = {};\n\n    byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#trustAs\n     *\n     * @description\n     * Returns an object that is trusted by angular for use in specified strict\n     * contextual escaping contexts (such as ng-bind-html, ng-include, any src\n     * attribute interpolation, any dom event binding attribute interpolation\n     * such as for onclick,  etc.) that uses the provided value.\n     * See {@link ng.$sce $sce} for enabling strict contextual escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resourceUrl, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n    function trustAs(type, trustedValue) {\n      var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (!Constructor) {\n        throw $sceMinErr('icontext',\n            'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',\n            type, trustedValue);\n      }\n      if (trustedValue === null || trustedValue === undefined || trustedValue === '') {\n        return trustedValue;\n      }\n      // All the current contexts in SCE_CONTEXTS happen to be strings.  In order to avoid trusting\n      // mutable objects, we ensure here that the value passed in is actually a string.\n      if (typeof trustedValue !== 'string') {\n        throw $sceMinErr('itype',\n            'Attempted to trust a non-string value in a content requiring a string: Context: {0}',\n            type);\n      }\n      return new Constructor(trustedValue);\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#valueOf\n     *\n     * @description\n     * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs\n     * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.\n     *\n     * If the passed parameter is not a value that had been returned by {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.\n     *\n     * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}\n     *      call or anything else.\n     * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if `value` is the result of such a call.  Otherwise, returns\n     *     `value` unchanged.\n     */\n    function valueOf(maybeTrusted) {\n      if (maybeTrusted instanceof trustedValueHolderBase) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      } else {\n        return maybeTrusted;\n      }\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#getTrusted\n     *\n     * @description\n     * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and\n     * returns the originally supplied value if the queried context type is a supertype of the\n     * created type.  If this condition isn't satisfied, throws an exception.\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} call.\n     * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if valid in this context.  Otherwise, throws an exception.\n     */\n    function getTrusted(type, maybeTrusted) {\n      if (maybeTrusted === null || maybeTrusted === undefined || maybeTrusted === '') {\n        return maybeTrusted;\n      }\n      var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (constructor && maybeTrusted instanceof constructor) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      }\n      // If we get here, then we may only take one of two actions.\n      // 1. sanitize the value for the requested type, or\n      // 2. throw an exception.\n      if (type === SCE_CONTEXTS.RESOURCE_URL) {\n        if (isResourceUrlAllowedByPolicy(maybeTrusted)) {\n          return maybeTrusted;\n        } else {\n          throw $sceMinErr('insecurl',\n              'Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}',\n              maybeTrusted.toString());\n        }\n      } else if (type === SCE_CONTEXTS.HTML) {\n        return htmlSanitizer(maybeTrusted);\n      }\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    }\n\n    return { trustAs: trustAs,\n             getTrusted: getTrusted,\n             valueOf: valueOf };\n  }];\n}\n\n\n/**\n * @ngdoc provider\n * @name $sceProvider\n * @description\n *\n * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.\n * -   enable/disable Strict Contextual Escaping (SCE) in a module\n * -   override the default implementation with a custom delegate\n *\n * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.\n */\n\n/* jshint maxlen: false*/\n\n/**\n * @ngdoc service\n * @name $sce\n * @kind function\n *\n * @description\n *\n * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.\n *\n * # Strict Contextual Escaping\n *\n * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain\n * contexts to result in a value that is marked as safe to use for that context.  One example of\n * such a context is binding arbitrary html controlled by the user via `ng-bind-html`.  We refer\n * to these contexts as privileged or SCE contexts.\n *\n * As of version 1.2, Angular ships with SCE enabled by default.\n *\n * Note:  When enabled (the default), IE8 in quirks mode is not supported.  In this mode, IE8 allows\n * one to execute arbitrary javascript by the use of the expression() syntax.  Refer\n * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.\n * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`\n * to the top of your HTML document.\n *\n * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for\n * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.\n *\n * Here's an example of a binding in a privileged context:\n *\n * ```\n * <input ng-model=\"userHtml\">\n * <div ng-bind-html=\"userHtml\"></div>\n * ```\n *\n * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user.  With SCE\n * disabled, this application allows the user to render arbitrary HTML into the DIV.\n * In a more realistic example, one may be rendering user comments, blog articles, etc. via\n * bindings.  (HTML is just one example of a context where rendering user controlled input creates\n * security vulnerabilities.)\n *\n * For the case of HTML, you might use a library, either on the client side, or on the server side,\n * to sanitize unsafe HTML before binding to the value and rendering it in the document.\n *\n * How would you ensure that every place that used these types of bindings was bound to a value that\n * was sanitized by your library (or returned as safe for rendering by your server?)  How can you\n * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some\n * properties/fields and forgot to update the binding to the sanitized value?\n *\n * To be secure by default, you want to ensure that any such bindings are disallowed unless you can\n * determine that something explicitly says it's safe to use a value for binding in that\n * context.  You can then audit your code (a simple grep would do) to ensure that this is only done\n * for those values that you can easily tell are safe - because they were received from your server,\n * sanitized by your library, etc.  You can organize your codebase to help with this - perhaps\n * allowing only the files in a specific directory to do this.  Ensuring that the internal API\n * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.\n *\n * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}\n * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to\n * obtain values that will be accepted by SCE / privileged contexts.\n *\n *\n * ## How does it work?\n *\n * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted\n * $sce.getTrusted(context, value)} rather than to the value directly.  Directives use {@link\n * ng.$sce#parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the\n * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.\n *\n * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link\n * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}.  Here's the actual code (slightly\n * simplified):\n *\n * ```\n * var ngBindHtmlDirective = ['$sce', function($sce) {\n *   return function(scope, element, attr) {\n *     scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {\n *       element.html(value || '');\n *     });\n *   };\n * }];\n * ```\n *\n * ## Impact on loading templates\n *\n * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as\n * `templateUrl`'s specified by {@link guide/directive directives}.\n *\n * By default, Angular only loads templates from the same domain and protocol as the application\n * document.  This is done by calling {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on the template URL.  To load templates from other domains and/or\n * protocols, you may either either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist\n * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.\n *\n * *Please note*:\n * The browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy apply in addition to this and may further restrict whether the template is successfully\n * loaded.  This means that without the right CORS policy, loading templates from a different domain\n * won't work on all browsers.  Also, loading templates from `file://` URL does not work on some\n * browsers.\n *\n * ## This feels like too much overhead for the developer?\n *\n * It's important to remember that SCE only applies to interpolation expressions.\n *\n * If your expressions are constant literals, they're automatically trusted and you don't need to\n * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.\n * `<div ng-bind-html=\"'<b>implicitly trusted</b>'\"></div>`) just works.\n *\n * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them\n * through {@link ng.$sce#getTrusted $sce.getTrusted}.  SCE doesn't play a role here.\n *\n * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load\n * templates in `ng-include` from your application's domain without having to even know about SCE.\n * It blocks loading templates from other domains or loading templates over http from an https\n * served document.  You can change these by setting your own custom {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.\n *\n * This significantly reduces the overhead.  It is far easier to pay the small overhead and have an\n * application that's secure and can be audited to verify that with much more ease than bolting\n * security onto an application later.\n *\n * <a name=\"contexts\"></a>\n * ## What trusted context types are supported?\n *\n * | Context             | Notes          |\n * |---------------------|----------------|\n * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |\n * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently unused.  Feel free to use it in your own directives. |\n * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |\n * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |\n * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently unused.  Feel free to use it in your own directives. |\n *\n * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name=\"resourceUrlPatternItem\"></a>\n *\n *  Each element in these arrays must be one of the following:\n *\n *  - **'self'**\n *    - The special **string**, `'self'`, can be used to match against all URLs of the **same\n *      domain** as the application document using the **same protocol**.\n *  - **String** (except the special value `'self'`)\n *    - The string is matched against the full *normalized / absolute URL* of the resource\n *      being tested (substring matches are not good enough.)\n *    - There are exactly **two wildcard sequences** - `*` and `**`.  All other characters\n *      match themselves.\n *    - `*`: matches zero or more occurrences of any character other than one of the following 6\n *      characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'.  It's a useful wildcard for use\n *      in a whitelist.\n *    - `**`: matches zero or more occurrences of *any* character.  As such, it's not\n *      not appropriate to use in for a scheme, domain, etc. as it would match too much.  (e.g.\n *      http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might\n *      not have been the intention.)  Its usage at the very end of the path is ok.  (e.g.\n *      http://foo.example.com/templates/**).\n *  - **RegExp** (*see caveat below*)\n *    - *Caveat*:  While regular expressions are powerful and offer great flexibility,  their syntax\n *      (and all the inevitable escaping) makes them *harder to maintain*.  It's easy to\n *      accidentally introduce a bug when one updates a complex expression (imho, all regexes should\n *      have good test coverage.).  For instance, the use of `.` in the regex is correct only in a\n *      small number of cases.  A `.` character in the regex used when matching the scheme or a\n *      subdomain could be matched against a `:` or literal `.` that was likely not intended.   It\n *      is highly recommended to use the string patterns and only fall back to regular expressions\n *      if they as a last resort.\n *    - The regular expression must be an instance of RegExp (i.e. not a string.)  It is\n *      matched against the **entire** *normalized / absolute URL* of the resource being tested\n *      (even when the RegExp did not have the `^` and `$` codes.)  In addition, any flags\n *      present on the RegExp (such as multiline, global, ignoreCase) are ignored.\n *    - If you are generating your JavaScript from some other templating engine (not\n *      recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),\n *      remember to escape your regular expression (and be aware that you might need more than\n *      one level of escaping depending on your templating engine and the way you interpolated\n *      the value.)  Do make use of your platform's escaping mechanism as it might be good\n *      enough before coding your own.  e.g. Ruby has\n *      [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)\n *      and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).\n *      Javascript lacks a similar built in function for escaping.  Take a look at Google\n *      Closure library's [goog.string.regExpEscape(s)](\n *      http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.\n *\n * ## Show me an example using SCE.\n *\n * <example module=\"mySceApp\" deps=\"angular-sanitize.js\">\n * <file name=\"index.html\">\n *   <div ng-controller=\"myAppController as myCtrl\">\n *     <i ng-bind-html=\"myCtrl.explicitlyTrustedHtml\" id=\"explicitlyTrustedHtml\"></i><br><br>\n *     <b>User comments</b><br>\n *     By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when\n *     $sanitize is available.  If $sanitize isn't available, this results in an error instead of an\n *     exploit.\n *     <div class=\"well\">\n *       <div ng-repeat=\"userComment in myCtrl.userComments\">\n *         <b>{{userComment.name}}</b>:\n *         <span ng-bind-html=\"userComment.htmlComment\" class=\"htmlComment\"></span>\n *         <br>\n *       </div>\n *     </div>\n *   </div>\n * </file>\n *\n * <file name=\"script.js\">\n *   var mySceApp = angular.module('mySceApp', ['ngSanitize']);\n *\n *   mySceApp.controller(\"myAppController\", function myAppController($http, $templateCache, $sce) {\n *     var self = this;\n *     $http.get(\"test_data.json\", {cache: $templateCache}).success(function(userComments) {\n *       self.userComments = userComments;\n *     });\n *     self.explicitlyTrustedHtml = $sce.trustAsHtml(\n *         '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n *         'sanitization.&quot;\">Hover over this text.</span>');\n *   });\n * </file>\n *\n * <file name=\"test_data.json\">\n * [\n *   { \"name\": \"Alice\",\n *     \"htmlComment\":\n *         \"<span onmouseover='this.textContent=\\\"PWN3D!\\\"'>Is <i>anyone</i> reading this?</span>\"\n *   },\n *   { \"name\": \"Bob\",\n *     \"htmlComment\": \"<i>Yes!</i>  Am I the only other one?\"\n *   }\n * ]\n * </file>\n *\n * <file name=\"protractor.js\" type=\"protractor\">\n *   describe('SCE doc demo', function() {\n *     it('should sanitize untrusted values', function() {\n *       expect(element.all(by.css('.htmlComment')).first().getInnerHtml())\n *           .toBe('<span>Is <i>anyone</i> reading this?</span>');\n *     });\n *\n *     it('should NOT sanitize explicitly trusted values', function() {\n *       expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(\n *           '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n *           'sanitization.&quot;\">Hover over this text.</span>');\n *     });\n *   });\n * </file>\n * </example>\n *\n *\n *\n * ## Can I disable SCE completely?\n *\n * Yes, you can.  However, this is strongly discouraged.  SCE gives you a lot of security benefits\n * for little coding overhead.  It will be much harder to take an SCE disabled application and\n * either secure it on your own or enable SCE at a later stage.  It might make sense to disable SCE\n * for cases where you have a lot of existing code that was written before SCE was introduced and\n * you're migrating them a module at a time.\n *\n * That said, here's how you can completely disable SCE:\n *\n * ```\n * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {\n *   // Completely disable SCE.  For demonstration purposes only!\n *   // Do not use in new projects.\n *   $sceProvider.enabled(false);\n * });\n * ```\n *\n */\n/* jshint maxlen: 100 */\n\nfunction $SceProvider() {\n  var enabled = true;\n\n  /**\n   * @ngdoc method\n   * @name $sceProvider#enabled\n   * @kind function\n   *\n   * @param {boolean=} value If provided, then enables/disables SCE.\n   * @return {boolean} true if SCE is enabled, false otherwise.\n   *\n   * @description\n   * Enables/disables SCE and returns the current value.\n   */\n  this.enabled = function (value) {\n    if (arguments.length) {\n      enabled = !!value;\n    }\n    return enabled;\n  };\n\n\n  /* Design notes on the default implementation for SCE.\n   *\n   * The API contract for the SCE delegate\n   * -------------------------------------\n   * The SCE delegate object must provide the following 3 methods:\n   *\n   * - trustAs(contextEnum, value)\n   *     This method is used to tell the SCE service that the provided value is OK to use in the\n   *     contexts specified by contextEnum.  It must return an object that will be accepted by\n   *     getTrusted() for a compatible contextEnum and return this value.\n   *\n   * - valueOf(value)\n   *     For values that were not produced by trustAs(), return them as is.  For values that were\n   *     produced by trustAs(), return the corresponding input value to trustAs.  Basically, if\n   *     trustAs is wrapping the given values into some type, this operation unwraps it when given\n   *     such a value.\n   *\n   * - getTrusted(contextEnum, value)\n   *     This function should return the a value that is safe to use in the context specified by\n   *     contextEnum or throw and exception otherwise.\n   *\n   * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be\n   * opaque or wrapped in some holder object.  That happens to be an implementation detail.  For\n   * instance, an implementation could maintain a registry of all trusted objects by context.  In\n   * such a case, trustAs() would return the same object that was passed in.  getTrusted() would\n   * return the same object passed in if it was found in the registry under a compatible context or\n   * throw an exception otherwise.  An implementation might only wrap values some of the time based\n   * on some criteria.  getTrusted() might return a value and not throw an exception for special\n   * constants or objects even if not wrapped.  All such implementations fulfill this contract.\n   *\n   *\n   * A note on the inheritance model for SCE contexts\n   * ------------------------------------------------\n   * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types.  This\n   * is purely an implementation details.\n   *\n   * The contract is simply this:\n   *\n   *     getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)\n   *     will also succeed.\n   *\n   * Inheritance happens to capture this in a natural way.  In some future, we\n   * may not use inheritance anymore.  That is OK because no code outside of\n   * sce.js and sceSpecs.js would need to be aware of this detail.\n   */\n\n  this.$get = ['$parse', '$sniffer', '$sceDelegate', function(\n                $parse,   $sniffer,   $sceDelegate) {\n    // Prereq: Ensure that we're not running in IE8 quirks mode.  In that mode, IE allows\n    // the \"expression(javascript expression)\" syntax which is insecure.\n    if (enabled && $sniffer.msie && $sniffer.msieDocumentMode < 8) {\n      throw $sceMinErr('iequirks',\n        'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' +\n        'mode.  You can fix this by adding the text <!doctype html> to the top of your HTML ' +\n        'document.  See http://docs.angularjs.org/api/ng.$sce for more information.');\n    }\n\n    var sce = shallowCopy(SCE_CONTEXTS);\n\n    /**\n     * @ngdoc method\n     * @name $sce#isEnabled\n     * @kind function\n     *\n     * @return {Boolean} true if SCE is enabled, false otherwise.  If you want to set the value, you\n     * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.\n     *\n     * @description\n     * Returns a boolean indicating if SCE is enabled.\n     */\n    sce.isEnabled = function () {\n      return enabled;\n    };\n    sce.trustAs = $sceDelegate.trustAs;\n    sce.getTrusted = $sceDelegate.getTrusted;\n    sce.valueOf = $sceDelegate.valueOf;\n\n    if (!enabled) {\n      sce.trustAs = sce.getTrusted = function(type, value) { return value; };\n      sce.valueOf = identity;\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAs\n     *\n     * @description\n     * Converts Angular {@link guide/expression expression} into a function.  This is like {@link\n     * ng.$parse $parse} and is identical when the expression is a literal constant.  Otherwise, it\n     * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,\n     * *result*)}\n     *\n     * @param {string} type The kind of SCE context in which this result will be used.\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n    sce.parseAs = function sceParseAs(type, expr) {\n      var parsed = $parse(expr);\n      if (parsed.literal && parsed.constant) {\n        return parsed;\n      } else {\n        return function sceParseAsTrusted(self, locals) {\n          return sce.getTrusted(type, parsed(self, locals));\n        };\n      }\n    };\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAs\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.  As such,\n     * returns an object that is trusted by angular for use in specified strict contextual\n     * escaping contexts (such as ng-bind-html, ng-include, any src attribute\n     * interpolation, any dom event binding attribute interpolation such as for onclick,  etc.)\n     * that uses the provided value.  See * {@link ng.$sce $sce} for enabling strict contextual\n     * escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resource_url, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsHtml(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml\n     *     $sce.getTrustedHtml(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl\n     *     $sce.getTrustedUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl\n     *     $sce.getTrustedResourceUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the return\n     *     value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsJs(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs\n     *     $sce.getTrustedJs(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrusted\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}.  As such,\n     * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the\n     * originally supplied value if the queried context type is a supertype of the created type.\n     * If this condition isn't satisfied, throws an exception.\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}\n     *                         call.\n     * @returns {*} The value the was originally provided to\n     *              {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.\n     *              Otherwise, throws an exception.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedHtml(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedCss\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedCss(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sceDelegate.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedJs\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedJs(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsHtml(expression string)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.HTML, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsCss\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsCss(value)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.CSS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsUrl(value)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsResourceUrl(value)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsJs(value)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.JS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    // Shorthand delegations.\n    var parse = sce.parseAs,\n        getTrusted = sce.getTrusted,\n        trustAs = sce.trustAs;\n\n    forEach(SCE_CONTEXTS, function (enumValue, name) {\n      var lName = lowercase(name);\n      sce[camelCase(\"parse_as_\" + lName)] = function (expr) {\n        return parse(enumValue, expr);\n      };\n      sce[camelCase(\"get_trusted_\" + lName)] = function (value) {\n        return getTrusted(enumValue, value);\n      };\n      sce[camelCase(\"trust_as_\" + lName)] = function (value) {\n        return trustAs(enumValue, value);\n      };\n    });\n\n    return sce;\n  }];\n}\n\n/**\n * !!! This is an undocumented \"private\" service !!!\n *\n * @name $sniffer\n * @requires $window\n * @requires $document\n *\n * @property {boolean} history Does the browser support html5 history api ?\n * @property {boolean} hashchange Does the browser support hashchange event ?\n * @property {boolean} transitions Does the browser support CSS transition events ?\n * @property {boolean} animations Does the browser support CSS animation events ?\n *\n * @description\n * This is very simple implementation of testing browser's features.\n */\nfunction $SnifferProvider() {\n  this.$get = ['$window', '$document', function($window, $document) {\n    var eventSupport = {},\n        android =\n          int((/android (\\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),\n        boxee = /Boxee/i.test(($window.navigator || {}).userAgent),\n        document = $document[0] || {},\n        documentMode = document.documentMode,\n        vendorPrefix,\n        vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,\n        bodyStyle = document.body && document.body.style,\n        transitions = false,\n        animations = false,\n        match;\n\n    if (bodyStyle) {\n      for(var prop in bodyStyle) {\n        if(match = vendorRegex.exec(prop)) {\n          vendorPrefix = match[0];\n          vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);\n          break;\n        }\n      }\n\n      if(!vendorPrefix) {\n        vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';\n      }\n\n      transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));\n      animations  = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));\n\n      if (android && (!transitions||!animations)) {\n        transitions = isString(document.body.style.webkitTransition);\n        animations = isString(document.body.style.webkitAnimation);\n      }\n    }\n\n\n    return {\n      // Android has history.pushState, but it does not update location correctly\n      // so let's not use the history API at all.\n      // http://code.google.com/p/android/issues/detail?id=17471\n      // https://github.com/angular/angular.js/issues/904\n\n      // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has\n      // so let's not use the history API also\n      // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined\n      // jshint -W018\n      history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),\n      // jshint +W018\n      hashchange: 'onhashchange' in $window &&\n                  // IE8 compatible mode lies\n                  (!documentMode || documentMode > 7),\n      hasEvent: function(event) {\n        // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have\n        // it. In particular the event is not fired when backspace or delete key are pressed or\n        // when cut operation is performed.\n        if (event == 'input' && msie == 9) return false;\n\n        if (isUndefined(eventSupport[event])) {\n          var divElm = document.createElement('div');\n          eventSupport[event] = 'on' + event in divElm;\n        }\n\n        return eventSupport[event];\n      },\n      csp: csp(),\n      vendorPrefix: vendorPrefix,\n      transitions : transitions,\n      animations : animations,\n      android: android,\n      msie : msie,\n      msieDocumentMode: documentMode\n    };\n  }];\n}\n\nfunction $TimeoutProvider() {\n  this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler',\n       function($rootScope,   $browser,   $q,   $exceptionHandler) {\n    var deferreds = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $timeout\n      *\n      * @description\n      * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch\n      * block and delegates any exceptions to\n      * {@link ng.$exceptionHandler $exceptionHandler} service.\n      *\n      * The return value of registering a timeout function is a promise, which will be resolved when\n      * the timeout is reached and the timeout function is executed.\n      *\n      * To cancel a timeout request, call `$timeout.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to\n      * synchronously flush the queue of deferred functions.\n      *\n      * @param {function()} fn A function, whose execution should be delayed.\n      * @param {number=} [delay=0] Delay in milliseconds.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this\n      *   promise will be resolved with is the return value of the `fn` function.\n      *\n      */\n    function timeout(fn, delay, invokeApply) {\n      var deferred = $q.defer(),\n          promise = deferred.promise,\n          skipApply = (isDefined(invokeApply) && !invokeApply),\n          timeoutId;\n\n      timeoutId = $browser.defer(function() {\n        try {\n          deferred.resolve(fn());\n        } catch(e) {\n          deferred.reject(e);\n          $exceptionHandler(e);\n        }\n        finally {\n          delete deferreds[promise.$$timeoutId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n      }, delay);\n\n      promise.$$timeoutId = timeoutId;\n      deferreds[timeoutId] = deferred;\n\n      return promise;\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $timeout#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`. As a result of this, the promise will be\n      * resolved with a rejection.\n      *\n      * @param {Promise=} promise Promise returned by the `$timeout` function.\n      * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n      *   canceled.\n      */\n    timeout.cancel = function(promise) {\n      if (promise && promise.$$timeoutId in deferreds) {\n        deferreds[promise.$$timeoutId].reject('canceled');\n        delete deferreds[promise.$$timeoutId];\n        return $browser.defer.cancel(promise.$$timeoutId);\n      }\n      return false;\n    };\n\n    return timeout;\n  }];\n}\n\n// NOTE:  The usage of window and document instead of $window and $document here is\n// deliberate.  This service depends on the specific behavior of anchor nodes created by the\n// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and\n// cause us to break tests.  In addition, when the browser resolves a URL for XHR, it\n// doesn't know about mocked locations and resolves URLs to the real document - which is\n// exactly the behavior needed here.  There is little value is mocking these out for this\n// service.\nvar urlParsingNode = document.createElement(\"a\");\nvar originUrl = urlResolve(window.location.href, true);\n\n\n/**\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL.  Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL.  This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc.  See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers.  However, the parsed components will not be set if the URL assigned did not specify\n * them.  (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.)  We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again.  This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node.  (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729)  However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n *   http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n *   http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *   http://url.spec.whatwg.org/#urlutils\n *   https://github.com/angular/angular.js/pull/2902\n *   http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n *   | member name   | Description    |\n *   |---------------|----------------|\n *   | href          | A normalized version of the provided URL if it was not an absolute URL |\n *   | protocol      | The protocol including the trailing colon                              |\n *   | host          | The host and port (if the port is non-default) of the normalizedUrl    |\n *   | search        | The search params, minus the question mark                             |\n *   | hash          | The hash string, minus the hash symbol\n *   | hostname      | The hostname\n *   | port          | The port, without \":\"\n *   | pathname      | The pathname, beginning with \"/\"\n *\n */\nfunction urlResolve(url, base) {\n  var href = url;\n\n  if (msie) {\n    // Normalize before parse.  Refer Implementation Notes on why this is\n    // done in two steps on IE.\n    urlParsingNode.setAttribute(\"href\", href);\n    href = urlParsingNode.href;\n  }\n\n  urlParsingNode.setAttribute('href', href);\n\n  // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n  return {\n    href: urlParsingNode.href,\n    protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n    host: urlParsingNode.host,\n    search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n    hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n    hostname: urlParsingNode.hostname,\n    port: urlParsingNode.port,\n    pathname: (urlParsingNode.pathname.charAt(0) === '/')\n      ? urlParsingNode.pathname\n      : '/' + urlParsingNode.pathname\n  };\n}\n\n/**\n * Parse a request URL and determine whether this is a same-origin request as the application document.\n *\n * @param {string|object} requestUrl The url of the request as a string that will be resolved\n * or a parsed URL object.\n * @returns {boolean} Whether the request is for the same origin as the application document.\n */\nfunction urlIsSameOrigin(requestUrl) {\n  var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;\n  return (parsed.protocol === originUrl.protocol &&\n          parsed.host === originUrl.host);\n}\n\n/**\n * @ngdoc service\n * @name $window\n *\n * @description\n * A reference to the browser's `window` object. While `window`\n * is globally available in JavaScript, it causes testability problems, because\n * it is a global variable. In angular we always refer to it through the\n * `$window` service, so it may be overridden, removed or mocked for testing.\n *\n * Expressions, like the one defined for the `ngClick` directive in the example\n * below, are evaluated with respect to the current scope.  Therefore, there is\n * no risk of inadvertently coding in a dependency on a global value in such an\n * expression.\n *\n * @example\n   <example module=\"windowExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('windowExample', [])\n           .controller('ExampleController', ['$scope', '$window', function ($scope, $window) {\n             $scope.greeting = 'Hello, World!';\n             $scope.doGreeting = function(greeting) {\n               $window.alert(greeting);\n             };\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input type=\"text\" ng-model=\"greeting\" />\n         <button ng-click=\"doGreeting(greeting)\">ALERT</button>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n      it('should display the greeting in the input box', function() {\n       element(by.model('greeting')).sendKeys('Hello, E2E Tests');\n       // If we click the button it will block the test runner\n       // element(':button').click();\n      });\n     </file>\n   </example>\n */\nfunction $WindowProvider(){\n  this.$get = valueFn(window);\n}\n\n/* global currencyFilter: true,\n dateFilter: true,\n filterFilter: true,\n jsonFilter: true,\n limitToFilter: true,\n lowercaseFilter: true,\n numberFilter: true,\n orderByFilter: true,\n uppercaseFilter: true,\n */\n\n/**\n * @ngdoc provider\n * @name $filterProvider\n * @description\n *\n * Filters are just functions which transform input to an output. However filters need to be\n * Dependency Injected. To achieve this a filter definition consists of a factory function which is\n * annotated with dependencies and is responsible for creating a filter function.\n *\n * ```js\n *   // Filter registration\n *   function MyModule($provide, $filterProvider) {\n *     // create a service to demonstrate injection (not always needed)\n *     $provide.value('greet', function(name){\n *       return 'Hello ' + name + '!';\n *     });\n *\n *     // register a filter factory which uses the\n *     // greet service to demonstrate DI.\n *     $filterProvider.register('greet', function(greet){\n *       // return the filter function which uses the greet service\n *       // to generate salutation\n *       return function(text) {\n *         // filters need to be forgiving so check input validity\n *         return text && greet(text) || text;\n *       };\n *     });\n *   }\n * ```\n *\n * The filter function is registered with the `$injector` under the filter name suffix with\n * `Filter`.\n *\n * ```js\n *   it('should be the same instance', inject(\n *     function($filterProvider) {\n *       $filterProvider.register('reverse', function(){\n *         return ...;\n *       });\n *     },\n *     function($filter, reverseFilter) {\n *       expect($filter('reverse')).toBe(reverseFilter);\n *     });\n * ```\n *\n *\n * For more information about how angular filters work, and how to create your own filters, see\n * {@link guide/filter Filters} in the Angular Developer Guide.\n */\n\n/**\n * @ngdoc service\n * @name $filter\n * @kind function\n * @description\n * Filters are used for formatting data displayed to the user.\n *\n * The general syntax in templates is as follows:\n *\n *         {{ expression [| filter_name[:parameter_value] ... ] }}\n *\n * @param {String} name Name of the filter function to retrieve\n * @return {Function} the filter function\n * @example\n   <example name=\"$filter\" module=\"filterExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"MainCtrl\">\n        <h3>{{ originalText }}</h3>\n        <h3>{{ filteredText }}</h3>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n      angular.module('filterExample', [])\n      .controller('MainCtrl', function($scope, $filter) {\n        $scope.originalText = 'hello';\n        $scope.filteredText = $filter('uppercase')($scope.originalText);\n      });\n     </file>\n   </example>\n  */\n$FilterProvider.$inject = ['$provide'];\nfunction $FilterProvider($provide) {\n  var suffix = 'Filter';\n\n  /**\n   * @ngdoc method\n   * @name $filterProvider#register\n   * @param {string|Object} name Name of the filter function, or an object map of filters where\n   *    the keys are the filter names and the values are the filter factories.\n   * @returns {Object} Registered filter instance, or if a map of filters was provided then a map\n   *    of the registered filter instances.\n   */\n  function register(name, factory) {\n    if(isObject(name)) {\n      var filters = {};\n      forEach(name, function(filter, key) {\n        filters[key] = register(key, filter);\n      });\n      return filters;\n    } else {\n      return $provide.factory(name + suffix, factory);\n    }\n  }\n  this.register = register;\n\n  this.$get = ['$injector', function($injector) {\n    return function(name) {\n      return $injector.get(name + suffix);\n    };\n  }];\n\n  ////////////////////////////////////////\n\n  /* global\n    currencyFilter: false,\n    dateFilter: false,\n    filterFilter: false,\n    jsonFilter: false,\n    limitToFilter: false,\n    lowercaseFilter: false,\n    numberFilter: false,\n    orderByFilter: false,\n    uppercaseFilter: false,\n  */\n\n  register('currency', currencyFilter);\n  register('date', dateFilter);\n  register('filter', filterFilter);\n  register('json', jsonFilter);\n  register('limitTo', limitToFilter);\n  register('lowercase', lowercaseFilter);\n  register('number', numberFilter);\n  register('orderBy', orderByFilter);\n  register('uppercase', uppercaseFilter);\n}\n\n/**\n * @ngdoc filter\n * @name filter\n * @kind function\n *\n * @description\n * Selects a subset of items from `array` and returns it as a new array.\n *\n * @param {Array} array The source array.\n * @param {string|Object|function()} expression The predicate to be used for selecting items from\n *   `array`.\n *\n *   Can be one of:\n *\n *   - `string`: The string is evaluated as an expression and the resulting value is used for substring match against\n *     the contents of the `array`. All strings or objects with string properties in `array` that contain this string\n *     will be returned. The predicate can be negated by prefixing the string with `!`.\n *\n *   - `Object`: A pattern object can be used to filter specific properties on objects contained\n *     by `array`. For example `{name:\"M\", phone:\"1\"}` predicate will return an array of items\n *     which have property `name` containing \"M\" and property `phone` containing \"1\". A special\n *     property name `$` can be used (as in `{$:\"text\"}`) to accept a match against any\n *     property of the object. That's equivalent to the simple substring match with a `string`\n *     as described above. The predicate can be negated by prefixing the string with `!`.\n *     For Example `{name: \"!M\"}` predicate will return an array of items which have property `name`\n *     not containing \"M\".\n *\n *   - `function(value)`: A predicate function can be used to write arbitrary filters. The function is\n *     called for each element of `array`. The final result is an array of those elements that\n *     the predicate returned true for.\n *\n * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in\n *     determining if the expected value (from the filter expression) and actual value (from\n *     the object in the array) should be considered a match.\n *\n *   Can be one of:\n *\n *   - `function(actual, expected)`:\n *     The function will be given the object value and the predicate value to compare and\n *     should return true if the item should be included in filtered result.\n *\n *   - `true`: A shorthand for `function(actual, expected) { return angular.equals(expected, actual)}`.\n *     this is essentially strict comparison of expected and actual.\n *\n *   - `false|undefined`: A short hand for a function which will look for a substring match in case\n *     insensitive way.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <div ng-init=\"friends = [{name:'John', phone:'555-1276'},\n                                {name:'Mary', phone:'800-BIG-MARY'},\n                                {name:'Mike', phone:'555-4321'},\n                                {name:'Adam', phone:'555-5678'},\n                                {name:'Julie', phone:'555-8765'},\n                                {name:'Juliette', phone:'555-5678'}]\"></div>\n\n       Search: <input ng-model=\"searchText\">\n       <table id=\"searchTextResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friend in friends | filter:searchText\">\n           <td>{{friend.name}}</td>\n           <td>{{friend.phone}}</td>\n         </tr>\n       </table>\n       <hr>\n       Any: <input ng-model=\"search.$\"> <br>\n       Name only <input ng-model=\"search.name\"><br>\n       Phone only <input ng-model=\"search.phone\"><br>\n       Equality <input type=\"checkbox\" ng-model=\"strict\"><br>\n       <table id=\"searchObjResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friendObj in friends | filter:search:strict\">\n           <td>{{friendObj.name}}</td>\n           <td>{{friendObj.phone}}</td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var expectFriendNames = function(expectedNames, key) {\n         element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {\n           arr.forEach(function(wd, i) {\n             expect(wd.getText()).toMatch(expectedNames[i]);\n           });\n         });\n       };\n\n       it('should search across all fields when filtering with a string', function() {\n         var searchText = element(by.model('searchText'));\n         searchText.clear();\n         searchText.sendKeys('m');\n         expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');\n\n         searchText.clear();\n         searchText.sendKeys('76');\n         expectFriendNames(['John', 'Julie'], 'friend');\n       });\n\n       it('should search in specific fields when filtering with a predicate object', function() {\n         var searchAny = element(by.model('search.$'));\n         searchAny.clear();\n         searchAny.sendKeys('i');\n         expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');\n       });\n       it('should use a equal comparison when comparator is true', function() {\n         var searchName = element(by.model('search.name'));\n         var strict = element(by.model('strict'));\n         searchName.clear();\n         searchName.sendKeys('Julie');\n         strict.click();\n         expectFriendNames(['Julie'], 'friendObj');\n       });\n     </file>\n   </example>\n */\nfunction filterFilter() {\n  return function(array, expression, comparator) {\n    if (!isArray(array)) return array;\n\n    var comparatorType = typeof(comparator),\n        predicates = [];\n\n    predicates.check = function(value) {\n      for (var j = 0; j < predicates.length; j++) {\n        if(!predicates[j](value)) {\n          return false;\n        }\n      }\n      return true;\n    };\n\n    if (comparatorType !== 'function') {\n      if (comparatorType === 'boolean' && comparator) {\n        comparator = function(obj, text) {\n          return angular.equals(obj, text);\n        };\n      } else {\n        comparator = function(obj, text) {\n          if (obj && text && typeof obj === 'object' && typeof text === 'object') {\n            for (var objKey in obj) {\n              if (objKey.charAt(0) !== '$' && hasOwnProperty.call(obj, objKey) &&\n                  comparator(obj[objKey], text[objKey])) {\n                return true;\n              }\n            }\n            return false;\n          }\n          text = (''+text).toLowerCase();\n          return (''+obj).toLowerCase().indexOf(text) > -1;\n        };\n      }\n    }\n\n    var search = function(obj, text){\n      if (typeof text == 'string' && text.charAt(0) === '!') {\n        return !search(obj, text.substr(1));\n      }\n      switch (typeof obj) {\n        case \"boolean\":\n        case \"number\":\n        case \"string\":\n          return comparator(obj, text);\n        case \"object\":\n          switch (typeof text) {\n            case \"object\":\n              return comparator(obj, text);\n            default:\n              for ( var objKey in obj) {\n                if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) {\n                  return true;\n                }\n              }\n              break;\n          }\n          return false;\n        case \"array\":\n          for ( var i = 0; i < obj.length; i++) {\n            if (search(obj[i], text)) {\n              return true;\n            }\n          }\n          return false;\n        default:\n          return false;\n      }\n    };\n    switch (typeof expression) {\n      case \"boolean\":\n      case \"number\":\n      case \"string\":\n        // Set up expression object and fall through\n        expression = {$:expression};\n        // jshint -W086\n      case \"object\":\n        // jshint +W086\n        for (var key in expression) {\n          (function(path) {\n            if (typeof expression[path] === 'undefined') return;\n            predicates.push(function(value) {\n              return search(path == '$' ? value : (value && value[path]), expression[path]);\n            });\n          })(key);\n        }\n        break;\n      case 'function':\n        predicates.push(expression);\n        break;\n      default:\n        return array;\n    }\n    var filtered = [];\n    for ( var j = 0; j < array.length; j++) {\n      var value = array[j];\n      if (predicates.check(value)) {\n        filtered.push(value);\n      }\n    }\n    return filtered;\n  };\n}\n\n/**\n * @ngdoc filter\n * @name currency\n * @kind function\n *\n * @description\n * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default\n * symbol for current locale is used.\n *\n * @param {number} amount Input to filter.\n * @param {string=} symbol Currency symbol or identifier to be displayed.\n * @returns {string} Formatted number.\n *\n *\n * @example\n   <example module=\"currencyExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('currencyExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.amount = 1234.56;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input type=\"number\" ng-model=\"amount\"> <br>\n         default currency symbol ($): <span id=\"currency-default\">{{amount | currency}}</span><br>\n         custom currency identifier (USD$): <span>{{amount | currency:\"USD$\"}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should init with 1234.56', function() {\n         expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');\n         expect(element(by.binding('amount | currency:\"USD$\"')).getText()).toBe('USD$1,234.56');\n       });\n       it('should update', function() {\n         if (browser.params.browser == 'safari') {\n           // Safari does not understand the minus key. See\n           // https://github.com/angular/protractor/issues/481\n           return;\n         }\n         element(by.model('amount')).clear();\n         element(by.model('amount')).sendKeys('-1234');\n         expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)');\n         expect(element(by.binding('amount | currency:\"USD$\"')).getText()).toBe('(USD$1,234.00)');\n       });\n     </file>\n   </example>\n */\ncurrencyFilter.$inject = ['$locale'];\nfunction currencyFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(amount, currencySymbol){\n    if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM;\n    return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2).\n                replace(/\\u00A4/g, currencySymbol);\n  };\n}\n\n/**\n * @ngdoc filter\n * @name number\n * @kind function\n *\n * @description\n * Formats a number as text.\n *\n * If the input is not a number an empty string is returned.\n *\n * @param {number|string} number Number to format.\n * @param {(number|string)=} fractionSize Number of decimal places to round the number to.\n * If this is not provided then the fraction size is computed from the current locale's number\n * formatting pattern. In the case of the default locale, it will be 3.\n * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.\n *\n * @example\n   <example module=\"numberFilterExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('numberFilterExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.val = 1234.56789;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         Enter number: <input ng-model='val'><br>\n         Default formatting: <span id='number-default'>{{val | number}}</span><br>\n         No fractions: <span>{{val | number:0}}</span><br>\n         Negative number: <span>{{-val | number:4}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format numbers', function() {\n         expect(element(by.id('number-default')).getText()).toBe('1,234.568');\n         expect(element(by.binding('val | number:0')).getText()).toBe('1,235');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');\n       });\n\n       it('should update', function() {\n         element(by.model('val')).clear();\n         element(by.model('val')).sendKeys('3374.333');\n         expect(element(by.id('number-default')).getText()).toBe('3,374.333');\n         expect(element(by.binding('val | number:0')).getText()).toBe('3,374');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');\n      });\n     </file>\n   </example>\n */\n\n\nnumberFilter.$inject = ['$locale'];\nfunction numberFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(number, fractionSize) {\n    return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,\n      fractionSize);\n  };\n}\n\nvar DECIMAL_SEP = '.';\nfunction formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {\n  if (number == null || !isFinite(number) || isObject(number)) return '';\n\n  var isNegative = number < 0;\n  number = Math.abs(number);\n  var numStr = number + '',\n      formatedText = '',\n      parts = [];\n\n  var hasExponent = false;\n  if (numStr.indexOf('e') !== -1) {\n    var match = numStr.match(/([\\d\\.]+)e(-?)(\\d+)/);\n    if (match && match[2] == '-' && match[3] > fractionSize + 1) {\n      numStr = '0';\n      number = 0;\n    } else {\n      formatedText = numStr;\n      hasExponent = true;\n    }\n  }\n\n  if (!hasExponent) {\n    var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length;\n\n    // determine fractionSize if it is not specified\n    if (isUndefined(fractionSize)) {\n      fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac);\n    }\n\n    // safely round numbers in JS without hitting imprecisions of floating-point arithmetics\n    // inspired by:\n    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round\n    number = +(Math.round(+(number.toString() + 'e' + fractionSize)).toString() + 'e' + -fractionSize);\n\n    if (number === 0) {\n      isNegative = false;\n    }\n\n    var fraction = ('' + number).split(DECIMAL_SEP);\n    var whole = fraction[0];\n    fraction = fraction[1] || '';\n\n    var i, pos = 0,\n        lgroup = pattern.lgSize,\n        group = pattern.gSize;\n\n    if (whole.length >= (lgroup + group)) {\n      pos = whole.length - lgroup;\n      for (i = 0; i < pos; i++) {\n        if ((pos - i)%group === 0 && i !== 0) {\n          formatedText += groupSep;\n        }\n        formatedText += whole.charAt(i);\n      }\n    }\n\n    for (i = pos; i < whole.length; i++) {\n      if ((whole.length - i)%lgroup === 0 && i !== 0) {\n        formatedText += groupSep;\n      }\n      formatedText += whole.charAt(i);\n    }\n\n    // format fraction part.\n    while(fraction.length < fractionSize) {\n      fraction += '0';\n    }\n\n    if (fractionSize && fractionSize !== \"0\") formatedText += decimalSep + fraction.substr(0, fractionSize);\n  } else {\n\n    if (fractionSize > 0 && number > -1 && number < 1) {\n      formatedText = number.toFixed(fractionSize);\n    }\n  }\n\n  parts.push(isNegative ? pattern.negPre : pattern.posPre);\n  parts.push(formatedText);\n  parts.push(isNegative ? pattern.negSuf : pattern.posSuf);\n  return parts.join('');\n}\n\nfunction padNumber(num, digits, trim) {\n  var neg = '';\n  if (num < 0) {\n    neg =  '-';\n    num = -num;\n  }\n  num = '' + num;\n  while(num.length < digits) num = '0' + num;\n  if (trim)\n    num = num.substr(num.length - digits);\n  return neg + num;\n}\n\n\nfunction dateGetter(name, size, offset, trim) {\n  offset = offset || 0;\n  return function(date) {\n    var value = date['get' + name]();\n    if (offset > 0 || value > -offset)\n      value += offset;\n    if (value === 0 && offset == -12 ) value = 12;\n    return padNumber(value, size, trim);\n  };\n}\n\nfunction dateStrGetter(name, shortForm) {\n  return function(date, formats) {\n    var value = date['get' + name]();\n    var get = uppercase(shortForm ? ('SHORT' + name) : name);\n\n    return formats[get][value];\n  };\n}\n\nfunction timeZoneGetter(date) {\n  var zone = -1 * date.getTimezoneOffset();\n  var paddedZone = (zone >= 0) ? \"+\" : \"\";\n\n  paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +\n                padNumber(Math.abs(zone % 60), 2);\n\n  return paddedZone;\n}\n\nfunction ampmGetter(date, formats) {\n  return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];\n}\n\nvar DATE_FORMATS = {\n  yyyy: dateGetter('FullYear', 4),\n    yy: dateGetter('FullYear', 2, 0, true),\n     y: dateGetter('FullYear', 1),\n  MMMM: dateStrGetter('Month'),\n   MMM: dateStrGetter('Month', true),\n    MM: dateGetter('Month', 2, 1),\n     M: dateGetter('Month', 1, 1),\n    dd: dateGetter('Date', 2),\n     d: dateGetter('Date', 1),\n    HH: dateGetter('Hours', 2),\n     H: dateGetter('Hours', 1),\n    hh: dateGetter('Hours', 2, -12),\n     h: dateGetter('Hours', 1, -12),\n    mm: dateGetter('Minutes', 2),\n     m: dateGetter('Minutes', 1),\n    ss: dateGetter('Seconds', 2),\n     s: dateGetter('Seconds', 1),\n     // while ISO 8601 requires fractions to be prefixed with `.` or `,`\n     // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions\n   sss: dateGetter('Milliseconds', 3),\n  EEEE: dateStrGetter('Day'),\n   EEE: dateStrGetter('Day', true),\n     a: ampmGetter,\n     Z: timeZoneGetter\n};\n\nvar DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,\n    NUMBER_STRING = /^\\-?\\d+$/;\n\n/**\n * @ngdoc filter\n * @name date\n * @kind function\n *\n * @description\n *   Formats `date` to a string based on the requested `format`.\n *\n *   `format` string can be composed of the following elements:\n *\n *   * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)\n *   * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)\n *   * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)\n *   * `'MMMM'`: Month in year (January-December)\n *   * `'MMM'`: Month in year (Jan-Dec)\n *   * `'MM'`: Month in year, padded (01-12)\n *   * `'M'`: Month in year (1-12)\n *   * `'dd'`: Day in month, padded (01-31)\n *   * `'d'`: Day in month (1-31)\n *   * `'EEEE'`: Day in Week,(Sunday-Saturday)\n *   * `'EEE'`: Day in Week, (Sun-Sat)\n *   * `'HH'`: Hour in day, padded (00-23)\n *   * `'H'`: Hour in day (0-23)\n *   * `'hh'`: Hour in am/pm, padded (01-12)\n *   * `'h'`: Hour in am/pm, (1-12)\n *   * `'mm'`: Minute in hour, padded (00-59)\n *   * `'m'`: Minute in hour (0-59)\n *   * `'ss'`: Second in minute, padded (00-59)\n *   * `'s'`: Second in minute (0-59)\n *   * `'.sss' or ',sss'`: Millisecond in second, padded (000-999)\n *   * `'a'`: am/pm marker\n *   * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)\n *\n *   `format` string can also be one of the following predefined\n *   {@link guide/i18n localizable formats}:\n *\n *   * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale\n *     (e.g. Sep 3, 2010 12:05:08 pm)\n *   * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US  locale (e.g. 9/3/10 12:05 pm)\n *   * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US  locale\n *     (e.g. Friday, September 3, 2010)\n *   * `'longDate'`: equivalent to `'MMMM d, y'` for en_US  locale (e.g. September 3, 2010)\n *   * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US  locale (e.g. Sep 3, 2010)\n *   * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)\n *   * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm)\n *   * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm)\n *\n *   `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.\n *   `\"h 'in the morning'\"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence\n *   (e.g. `\"h 'o''clock'\"`).\n *\n * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or\n *    number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its\n *    shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is\n *    specified in the string input, the time is considered to be in the local timezone.\n * @param {string=} format Formatting rules (see Description). If not specified,\n *    `mediumDate` is used.\n * @returns {string} Formatted string or the input if input is not recognized as date/millis.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:\n           <span>{{1288323623006 | date:'medium'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:\n          <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:\n          <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:\"MM/dd/yyyy 'at' h:mma\"}}</span>:\n          <span>{{'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"}}</span><br>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format date', function() {\n         expect(element(by.binding(\"1288323623006 | date:'medium'\")).getText()).\n            toMatch(/Oct 2\\d, 2010 \\d{1,2}:\\d{2}:\\d{2} (AM|PM)/);\n         expect(element(by.binding(\"1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'\")).getText()).\n            toMatch(/2010\\-10\\-2\\d \\d{2}:\\d{2}:\\d{2} (\\-|\\+)?\\d{4}/);\n         expect(element(by.binding(\"'1288323623006' | date:'MM/dd/yyyy @ h:mma'\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 @ \\d{1,2}:\\d{2}(AM|PM)/);\n         expect(element(by.binding(\"'1288323623006' | date:\\\"MM/dd/yyyy 'at' h:mma\\\"\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 at \\d{1,2}:\\d{2}(AM|PM)/);\n       });\n     </file>\n   </example>\n */\ndateFilter.$inject = ['$locale'];\nfunction dateFilter($locale) {\n\n\n  var R_ISO8601_STR = /^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?)?$/;\n                     // 1        2       3         4          5          6          7          8  9     10      11\n  function jsonStringToDate(string) {\n    var match;\n    if (match = string.match(R_ISO8601_STR)) {\n      var date = new Date(0),\n          tzHour = 0,\n          tzMin  = 0,\n          dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,\n          timeSetter = match[8] ? date.setUTCHours : date.setHours;\n\n      if (match[9]) {\n        tzHour = int(match[9] + match[10]);\n        tzMin = int(match[9] + match[11]);\n      }\n      dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3]));\n      var h = int(match[4]||0) - tzHour;\n      var m = int(match[5]||0) - tzMin;\n      var s = int(match[6]||0);\n      var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000);\n      timeSetter.call(date, h, m, s, ms);\n      return date;\n    }\n    return string;\n  }\n\n\n  return function(date, format) {\n    var text = '',\n        parts = [],\n        fn, match;\n\n    format = format || 'mediumDate';\n    format = $locale.DATETIME_FORMATS[format] || format;\n    if (isString(date)) {\n      date = NUMBER_STRING.test(date) ? int(date) : jsonStringToDate(date);\n    }\n\n    if (isNumber(date)) {\n      date = new Date(date);\n    }\n\n    if (!isDate(date)) {\n      return date;\n    }\n\n    while(format) {\n      match = DATE_FORMATS_SPLIT.exec(format);\n      if (match) {\n        parts = concat(parts, match, 1);\n        format = parts.pop();\n      } else {\n        parts.push(format);\n        format = null;\n      }\n    }\n\n    forEach(parts, function(value){\n      fn = DATE_FORMATS[value];\n      text += fn ? fn(date, $locale.DATETIME_FORMATS)\n                 : value.replace(/(^'|'$)/g, '').replace(/''/g, \"'\");\n    });\n\n    return text;\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name json\n * @kind function\n *\n * @description\n *   Allows you to convert a JavaScript object into JSON string.\n *\n *   This filter is mostly useful for debugging. When using the double curly {{value}} notation\n *   the binding is automatically converted to JSON.\n *\n * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.\n * @returns {string} JSON string.\n *\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <pre>{{ {'name':'value'} | json }}</pre>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should jsonify filtered objects', function() {\n         expect(element(by.binding(\"{'name':'value'}\")).getText()).toMatch(/\\{\\n  \"name\": ?\"value\"\\n}/);\n       });\n     </file>\n   </example>\n *\n */\nfunction jsonFilter() {\n  return function(object) {\n    return toJson(object, true);\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name lowercase\n * @kind function\n * @description\n * Converts string to lowercase.\n * @see angular.lowercase\n */\nvar lowercaseFilter = valueFn(lowercase);\n\n\n/**\n * @ngdoc filter\n * @name uppercase\n * @kind function\n * @description\n * Converts string to uppercase.\n * @see angular.uppercase\n */\nvar uppercaseFilter = valueFn(uppercase);\n\n/**\n * @ngdoc filter\n * @name limitTo\n * @kind function\n *\n * @description\n * Creates a new array or string containing only a specified number of elements. The elements\n * are taken from either the beginning or the end of the source array or string, as specified by\n * the value and sign (positive or negative) of `limit`.\n *\n * @param {Array|string} input Source array or string to be limited.\n * @param {string|number} limit The length of the returned array or string. If the `limit` number\n *     is positive, `limit` number of items from the beginning of the source array/string are copied.\n *     If the number is negative, `limit` number  of items from the end of the source array/string\n *     are copied. The `limit` will be trimmed if it exceeds `array.length`\n * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array\n *     had less than `limit` elements.\n *\n * @example\n   <example module=\"limitToExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('limitToExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.numbers = [1,2,3,4,5,6,7,8,9];\n             $scope.letters = \"abcdefghi\";\n             $scope.numLimit = 3;\n             $scope.letterLimit = 3;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         Limit {{numbers}} to: <input type=\"integer\" ng-model=\"numLimit\">\n         <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>\n         Limit {{letters}} to: <input type=\"integer\" ng-model=\"letterLimit\">\n         <p>Output letters: {{ letters | limitTo:letterLimit }}</p>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var numLimitInput = element(by.model('numLimit'));\n       var letterLimitInput = element(by.model('letterLimit'));\n       var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));\n       var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));\n\n       it('should limit the number array to first three items', function() {\n         expect(numLimitInput.getAttribute('value')).toBe('3');\n         expect(letterLimitInput.getAttribute('value')).toBe('3');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abc');\n       });\n\n       it('should update the output when -3 is entered', function() {\n         numLimitInput.clear();\n         numLimitInput.sendKeys('-3');\n         letterLimitInput.clear();\n         letterLimitInput.sendKeys('-3');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');\n         expect(limitedLetters.getText()).toEqual('Output letters: ghi');\n       });\n\n       it('should not exceed the maximum size of input array', function() {\n         numLimitInput.clear();\n         numLimitInput.sendKeys('100');\n         letterLimitInput.clear();\n         letterLimitInput.sendKeys('100');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');\n       });\n     </file>\n   </example>\n */\nfunction limitToFilter(){\n  return function(input, limit) {\n    if (!isArray(input) && !isString(input)) return input;\n\n    if (Math.abs(Number(limit)) === Infinity) {\n      limit = Number(limit);\n    } else {\n      limit = int(limit);\n    }\n\n    if (isString(input)) {\n      //NaN check on limit\n      if (limit) {\n        return limit >= 0 ? input.slice(0, limit) : input.slice(limit, input.length);\n      } else {\n        return \"\";\n      }\n    }\n\n    var out = [],\n      i, n;\n\n    // if abs(limit) exceeds maximum length, trim it\n    if (limit > input.length)\n      limit = input.length;\n    else if (limit < -input.length)\n      limit = -input.length;\n\n    if (limit > 0) {\n      i = 0;\n      n = limit;\n    } else {\n      i = input.length + limit;\n      n = input.length;\n    }\n\n    for (; i<n; i++) {\n      out.push(input[i]);\n    }\n\n    return out;\n  };\n}\n\n/**\n * @ngdoc filter\n * @name orderBy\n * @kind function\n *\n * @description\n * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically\n * for strings and numerically for numbers. Note: if you notice numbers are not being sorted\n * correctly, make sure they are actually being saved as numbers and not strings.\n *\n * @param {Array} array The array to sort.\n * @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be\n *    used by the comparator to determine the order of elements.\n *\n *    Can be one of:\n *\n *    - `function`: Getter function. The result of this function will be sorted using the\n *      `<`, `=`, `>` operator.\n *    - `string`: An Angular expression. The result of this expression is used to compare elements\n *      (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by\n *      3 first characters of a property called `name`). The result of a constant expression\n *      is interpreted as a property name to be used in comparisons (for example `\"special name\"`\n *      to sort object by the value of their `special name` property). An expression can be\n *      optionally prefixed with `+` or `-` to control ascending or descending sort order\n *      (for example, `+name` or `-name`).\n *    - `Array`: An array of function or string predicates. The first predicate in the array\n *      is used for sorting, but when two items are equivalent, the next predicate is used.\n *\n * @param {boolean=} reverse Reverse the order of the array.\n * @returns {Array} Sorted copy of the source array.\n *\n * @example\n   <example module=\"orderByExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('orderByExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.friends =\n                 [{name:'John', phone:'555-1212', age:10},\n                  {name:'Mary', phone:'555-9876', age:19},\n                  {name:'Mike', phone:'555-4321', age:21},\n                  {name:'Adam', phone:'555-5678', age:35},\n                  {name:'Julie', phone:'555-8765', age:29}];\n             $scope.predicate = '-age';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n         <hr/>\n         [ <a href=\"\" ng-click=\"predicate=''\">unsorted</a> ]\n         <table class=\"friend\">\n           <tr>\n             <th><a href=\"\" ng-click=\"predicate = 'name'; reverse=false\">Name</a>\n                 (<a href=\"\" ng-click=\"predicate = '-name'; reverse=false\">^</a>)</th>\n             <th><a href=\"\" ng-click=\"predicate = 'phone'; reverse=!reverse\">Phone Number</a></th>\n             <th><a href=\"\" ng-click=\"predicate = 'age'; reverse=!reverse\">Age</a></th>\n           </tr>\n           <tr ng-repeat=\"friend in friends | orderBy:predicate:reverse\">\n             <td>{{friend.name}}</td>\n             <td>{{friend.phone}}</td>\n             <td>{{friend.age}}</td>\n           </tr>\n         </table>\n       </div>\n     </file>\n   </example>\n *\n * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the\n * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the\n * desired parameters.\n *\n * Example:\n *\n * @example\n  <example module=\"orderByExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <table class=\"friend\">\n          <tr>\n            <th><a href=\"\" ng-click=\"reverse=false;order('name', false)\">Name</a>\n              (<a href=\"\" ng-click=\"order('-name',false)\">^</a>)</th>\n            <th><a href=\"\" ng-click=\"reverse=!reverse;order('phone', reverse)\">Phone Number</a></th>\n            <th><a href=\"\" ng-click=\"reverse=!reverse;order('age',reverse)\">Age</a></th>\n          </tr>\n          <tr ng-repeat=\"friend in friends\">\n            <td>{{friend.name}}</td>\n            <td>{{friend.phone}}</td>\n            <td>{{friend.age}}</td>\n          </tr>\n        </table>\n      </div>\n    </file>\n\n    <file name=\"script.js\">\n      angular.module('orderByExample', [])\n        .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {\n          var orderBy = $filter('orderBy');\n          $scope.friends = [\n            { name: 'John',    phone: '555-1212',    age: 10 },\n            { name: 'Mary',    phone: '555-9876',    age: 19 },\n            { name: 'Mike',    phone: '555-4321',    age: 21 },\n            { name: 'Adam',    phone: '555-5678',    age: 35 },\n            { name: 'Julie',   phone: '555-8765',    age: 29 }\n          ];\n          $scope.order = function(predicate, reverse) {\n            $scope.friends = orderBy($scope.friends, predicate, reverse);\n          };\n          $scope.order('-age',false);\n        }]);\n    </file>\n</example>\n */\norderByFilter.$inject = ['$parse'];\nfunction orderByFilter($parse){\n  return function(array, sortPredicate, reverseOrder) {\n    if (!(isArrayLike(array))) return array;\n    if (!sortPredicate) return array;\n    sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];\n    sortPredicate = map(sortPredicate, function(predicate){\n      var descending = false, get = predicate || identity;\n      if (isString(predicate)) {\n        if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {\n          descending = predicate.charAt(0) == '-';\n          predicate = predicate.substring(1);\n        }\n        get = $parse(predicate);\n        if (get.constant) {\n          var key = get();\n          return reverseComparator(function(a,b) {\n            return compare(a[key], b[key]);\n          }, descending);\n        }\n      }\n      return reverseComparator(function(a,b){\n        return compare(get(a),get(b));\n      }, descending);\n    });\n    var arrayCopy = [];\n    for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }\n    return arrayCopy.sort(reverseComparator(comparator, reverseOrder));\n\n    function comparator(o1, o2){\n      for ( var i = 0; i < sortPredicate.length; i++) {\n        var comp = sortPredicate[i](o1, o2);\n        if (comp !== 0) return comp;\n      }\n      return 0;\n    }\n    function reverseComparator(comp, descending) {\n      return toBoolean(descending)\n          ? function(a,b){return comp(b,a);}\n          : comp;\n    }\n    function compare(v1, v2){\n      var t1 = typeof v1;\n      var t2 = typeof v2;\n      if (t1 == t2) {\n        if (isDate(v1) && isDate(v2)) {\n          v1 = v1.valueOf();\n          v2 = v2.valueOf();\n        }\n        if (t1 == \"string\") {\n           v1 = v1.toLowerCase();\n           v2 = v2.toLowerCase();\n        }\n        if (v1 === v2) return 0;\n        return v1 < v2 ? -1 : 1;\n      } else {\n        return t1 < t2 ? -1 : 1;\n      }\n    }\n  };\n}\n\nfunction ngDirective(directive) {\n  if (isFunction(directive)) {\n    directive = {\n      link: directive\n    };\n  }\n  directive.restrict = directive.restrict || 'AC';\n  return valueFn(directive);\n}\n\n/**\n * @ngdoc directive\n * @name a\n * @restrict E\n *\n * @description\n * Modifies the default behavior of the html A tag so that the default action is prevented when\n * the href attribute is empty.\n *\n * This change permits the easy creation of action links with the `ngClick` directive\n * without changing the location or causing page reloads, e.g.:\n * `<a href=\"\" ng-click=\"list.addItem()\">Add Item</a>`\n */\nvar htmlAnchorDirective = valueFn({\n  restrict: 'E',\n  compile: function(element, attr) {\n\n    if (msie <= 8) {\n\n      // turn <a href ng-click=\"..\">link</a> into a stylable link in IE\n      // but only if it doesn't have name attribute, in which case it's an anchor\n      if (!attr.href && !attr.name) {\n        attr.$set('href', '');\n      }\n\n      // add a comment node to anchors to workaround IE bug that causes element content to be reset\n      // to new attribute content if attribute is updated with value containing @ and element also\n      // contains value with @\n      // see issue #1949\n      element.append(document.createComment('IE fix'));\n    }\n\n    if (!attr.href && !attr.xlinkHref && !attr.name) {\n      return function(scope, element) {\n        // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n        var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?\n                   'xlink:href' : 'href';\n        element.on('click', function(event){\n          // if we have no href url, then don't navigate anywhere.\n          if (!element.attr(href)) {\n            event.preventDefault();\n          }\n        });\n      };\n    }\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngHref\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in an href attribute will\n * make the link go to the wrong URL if the user clicks it before\n * Angular has a chance to replace the `{{hash}}` markup with its\n * value. Until Angular replaces the markup the link will be broken\n * and will most likely return a 404 error.\n *\n * The `ngHref` directive solves this problem.\n *\n * The wrong way to write it:\n * ```html\n * <a href=\"http://www.gravatar.com/avatar/{{hash}}\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <a ng-href=\"http://www.gravatar.com/avatar/{{hash}}\"/>\n * ```\n *\n * @element A\n * @param {template} ngHref any string which can contain `{{}}` markup.\n *\n * @example\n * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes\n * in links and their different behaviors:\n    <example>\n      <file name=\"index.html\">\n        <input ng-model=\"value\" /><br />\n        <a id=\"link-1\" href ng-click=\"value = 1\">link 1</a> (link, don't reload)<br />\n        <a id=\"link-2\" href=\"\" ng-click=\"value = 2\">link 2</a> (link, don't reload)<br />\n        <a id=\"link-3\" ng-href=\"/{{'123'}}\">link 3</a> (link, reload!)<br />\n        <a id=\"link-4\" href=\"\" name=\"xx\" ng-click=\"value = 4\">anchor</a> (link, don't reload)<br />\n        <a id=\"link-5\" name=\"xxx\" ng-click=\"value = 5\">anchor</a> (no link)<br />\n        <a id=\"link-6\" ng-href=\"{{value}}\">link</a> (link, change location)\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should execute ng-click but not reload when href without value', function() {\n          element(by.id('link-1')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('1');\n          expect(element(by.id('link-1')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when href empty string', function() {\n          element(by.id('link-2')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('2');\n          expect(element(by.id('link-2')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click and change url when ng-href specified', function() {\n          expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\\/123$/);\n\n          element(by.id('link-3')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/123$/);\n            });\n          }, 5000, 'page should navigate to /123');\n        });\n\n        xit('should execute ng-click but not reload when href empty string and name specified', function() {\n          element(by.id('link-4')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('4');\n          expect(element(by.id('link-4')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when no href but name specified', function() {\n          element(by.id('link-5')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('5');\n          expect(element(by.id('link-5')).getAttribute('href')).toBe(null);\n        });\n\n        it('should only change url when only ng-href', function() {\n          element(by.model('value')).clear();\n          element(by.model('value')).sendKeys('6');\n          expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\\/6$/);\n\n          element(by.id('link-6')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/6$/);\n            });\n          }, 5000, 'page should navigate to /6');\n        });\n      </file>\n    </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngSrc\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `src` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrc` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img src=\"http://www.gravatar.com/avatar/{{hash}}\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-src=\"http://www.gravatar.com/avatar/{{hash}}\"/>\n * ```\n *\n * @element IMG\n * @param {template} ngSrc any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngSrcset\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrcset` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\"/>\n * ```\n *\n * @element IMG\n * @param {template} ngSrcset any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngDisabled\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * We shouldn't do this, because it will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:\n * ```html\n * <div ng-init=\"scope = { isDisabled: false }\">\n *  <button disabled=\"{{scope.isDisabled}}\">Disabled</button>\n * </div>\n * ```\n *\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as disabled. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngDisabled` directive solves this problem for the `disabled` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        Click me to toggle: <input type=\"checkbox\" ng-model=\"checked\"><br/>\n        <button ng-model=\"button\" ng-disabled=\"checked\">Button</button>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle button', function() {\n          expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,\n *     then special attribute \"disabled\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngChecked\n * @restrict A\n * @priority 100\n *\n * @description\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as checked. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngChecked` directive solves this problem for the `checked` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n * @example\n    <example>\n      <file name=\"index.html\">\n        Check me to check both: <input type=\"checkbox\" ng-model=\"master\"><br/>\n        <input id=\"checkSlave\" type=\"checkbox\" ng-checked=\"master\">\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should check both checkBoxes', function() {\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();\n          element(by.model('master')).click();\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,\n *     then special attribute \"checked\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngReadonly\n * @restrict A\n * @priority 100\n *\n * @description\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as readonly. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngReadonly` directive solves this problem for the `readonly` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n * @example\n    <example>\n      <file name=\"index.html\">\n        Check me to make text readonly: <input type=\"checkbox\" ng-model=\"checked\"><br/>\n        <input type=\"text\" ng-readonly=\"checked\" value=\"I'm Angular\"/>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle readonly attr', function() {\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,\n *     then special attribute \"readonly\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSelected\n * @restrict A\n * @priority 100\n *\n * @description\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as selected. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngSelected` directive solves this problem for the `selected` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        Check me to select: <input type=\"checkbox\" ng-model=\"selected\"><br/>\n        <select>\n          <option>Hello!</option>\n          <option id=\"greet\" ng-selected=\"selected\">Greetings!</option>\n        </select>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should select Greetings!', function() {\n          expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();\n          element(by.model('selected')).click();\n          expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element OPTION\n * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,\n *     then special attribute \"selected\" will be set on the element\n */\n\n/**\n * @ngdoc directive\n * @name ngOpen\n * @restrict A\n * @priority 100\n *\n * @description\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as open. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngOpen` directive solves this problem for the `open` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n * @example\n     <example>\n       <file name=\"index.html\">\n         Check me check multiple: <input type=\"checkbox\" ng-model=\"open\"><br/>\n         <details id=\"details\" ng-open=\"open\">\n            <summary>Show/Hide me</summary>\n         </details>\n       </file>\n       <file name=\"protractor.js\" type=\"protractor\">\n         it('should toggle open', function() {\n           expect(element(by.id('details')).getAttribute('open')).toBeFalsy();\n           element(by.model('open')).click();\n           expect(element(by.id('details')).getAttribute('open')).toBeTruthy();\n         });\n       </file>\n     </example>\n *\n * @element DETAILS\n * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,\n *     then special attribute \"open\" will be set on the element\n */\n\nvar ngAttributeAliasDirectives = {};\n\n\n// boolean attrs are evaluated\nforEach(BOOLEAN_ATTR, function(propName, attrName) {\n  // binding to multiple is not supported\n  if (propName == \"multiple\") return;\n\n  var normalized = directiveNormalize('ng-' + attrName);\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      priority: 100,\n      link: function(scope, element, attr) {\n        scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {\n          attr.$set(attrName, !!value);\n        });\n      }\n    };\n  };\n});\n\n\n// ng-src, ng-srcset, ng-href are interpolated\nforEach(['src', 'srcset', 'href'], function(attrName) {\n  var normalized = directiveNormalize('ng-' + attrName);\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      priority: 99, // it needs to run after the attributes are interpolated\n      link: function(scope, element, attr) {\n        var propName = attrName,\n            name = attrName;\n\n        if (attrName === 'href' &&\n            toString.call(element.prop('href')) === '[object SVGAnimatedString]') {\n          name = 'xlinkHref';\n          attr.$attr[name] = 'xlink:href';\n          propName = null;\n        }\n\n        attr.$observe(normalized, function(value) {\n          if (!value) {\n            if (attrName === 'href') {\n              attr.$set(name, null);\n            }\n            return;\n          }\n\n          attr.$set(name, value);\n\n          // on IE, if \"ng:src\" directive declaration is used and \"src\" attribute doesn't exist\n          // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need\n          // to set the property as well to achieve the desired effect.\n          // we use attr[attrName] value since $set can sanitize the url.\n          if (msie && propName) element.prop(propName, attr[name]);\n        });\n      }\n    };\n  };\n});\n\n/* global -nullFormCtrl */\nvar nullFormCtrl = {\n  $addControl: noop,\n  $removeControl: noop,\n  $setValidity: noop,\n  $setDirty: noop,\n  $setPristine: noop\n};\n\n/**\n * @ngdoc type\n * @name form.FormController\n *\n * @property {boolean} $pristine True if user has not interacted with the form yet.\n * @property {boolean} $dirty True if user has already interacted with the form.\n * @property {boolean} $valid True if all of the containing forms and controls are valid.\n * @property {boolean} $invalid True if at least one containing control or form is invalid.\n *\n * @property {Object} $error Is an object hash, containing references to all invalid controls or\n *  forms, where:\n *\n *  - keys are validation tokens (error names),\n *  - values are arrays of controls or forms that are invalid for given error name.\n *\n *\n *  Built-in validation tokens:\n *\n *  - `email`\n *  - `max`\n *  - `maxlength`\n *  - `min`\n *  - `minlength`\n *  - `number`\n *  - `pattern`\n *  - `required`\n *  - `url`\n *\n * @description\n * `FormController` keeps track of all its controls and nested forms as well as the state of them,\n * such as being valid/invalid or dirty/pristine.\n *\n * Each {@link ng.directive:form form} directive creates an instance\n * of `FormController`.\n *\n */\n//asks for $scope to fool the BC controller module\nFormController.$inject = ['$element', '$attrs', '$scope', '$animate'];\nfunction FormController(element, attrs, $scope, $animate) {\n  var form = this,\n      parentForm = element.parent().controller('form') || nullFormCtrl,\n      invalidCount = 0, // used to easily determine if we are valid\n      errors = form.$error = {},\n      controls = [];\n\n  // init state\n  form.$name = attrs.name || attrs.ngForm;\n  form.$dirty = false;\n  form.$pristine = true;\n  form.$valid = true;\n  form.$invalid = false;\n\n  parentForm.$addControl(form);\n\n  // Setup initial state of the control\n  element.addClass(PRISTINE_CLASS);\n  toggleValidCss(true);\n\n  // convenience method for easy toggling of classes\n  function toggleValidCss(isValid, validationErrorKey) {\n    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';\n    $animate.setClass(element,\n      (isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey,\n      (isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey);\n  }\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$addControl\n   *\n   * @description\n   * Register a control with the form.\n   *\n   * Input elements using ngModelController do this automatically when they are linked.\n   */\n  form.$addControl = function(control) {\n    // Breaking change - before, inputs whose name was \"hasOwnProperty\" were quietly ignored\n    // and not added to the scope.  Now we throw an error.\n    assertNotHasOwnProperty(control.$name, 'input');\n    controls.push(control);\n\n    if (control.$name) {\n      form[control.$name] = control;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$removeControl\n   *\n   * @description\n   * Deregister a control from the form.\n   *\n   * Input elements using ngModelController do this automatically when they are destroyed.\n   */\n  form.$removeControl = function(control) {\n    if (control.$name && form[control.$name] === control) {\n      delete form[control.$name];\n    }\n    forEach(errors, function(queue, validationToken) {\n      form.$setValidity(validationToken, true, control);\n    });\n\n    arrayRemove(controls, control);\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setValidity\n   *\n   * @description\n   * Sets the validity of a form control.\n   *\n   * This method will also propagate to parent forms.\n   */\n  form.$setValidity = function(validationToken, isValid, control) {\n    var queue = errors[validationToken];\n\n    if (isValid) {\n      if (queue) {\n        arrayRemove(queue, control);\n        if (!queue.length) {\n          invalidCount--;\n          if (!invalidCount) {\n            toggleValidCss(isValid);\n            form.$valid = true;\n            form.$invalid = false;\n          }\n          errors[validationToken] = false;\n          toggleValidCss(true, validationToken);\n          parentForm.$setValidity(validationToken, true, form);\n        }\n      }\n\n    } else {\n      if (!invalidCount) {\n        toggleValidCss(isValid);\n      }\n      if (queue) {\n        if (includes(queue, control)) return;\n      } else {\n        errors[validationToken] = queue = [];\n        invalidCount++;\n        toggleValidCss(false, validationToken);\n        parentForm.$setValidity(validationToken, false, form);\n      }\n      queue.push(control);\n\n      form.$valid = false;\n      form.$invalid = true;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setDirty\n   *\n   * @description\n   * Sets the form to a dirty state.\n   *\n   * This method can be called to add the 'ng-dirty' class and set the form to a dirty\n   * state (ng-dirty class). This method will also propagate to parent forms.\n   */\n  form.$setDirty = function() {\n    $animate.removeClass(element, PRISTINE_CLASS);\n    $animate.addClass(element, DIRTY_CLASS);\n    form.$dirty = true;\n    form.$pristine = false;\n    parentForm.$setDirty();\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setPristine\n   *\n   * @description\n   * Sets the form to its pristine state.\n   *\n   * This method can be called to remove the 'ng-dirty' class and set the form to its pristine\n   * state (ng-pristine class). This method will also propagate to all the controls contained\n   * in this form.\n   *\n   * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after\n   * saving or resetting it.\n   */\n  form.$setPristine = function () {\n    $animate.removeClass(element, DIRTY_CLASS);\n    $animate.addClass(element, PRISTINE_CLASS);\n    form.$dirty = false;\n    form.$pristine = true;\n    forEach(controls, function(control) {\n      control.$setPristine();\n    });\n  };\n}\n\n\n/**\n * @ngdoc directive\n * @name ngForm\n * @restrict EAC\n *\n * @description\n * Nestable alias of {@link ng.directive:form `form`} directive. HTML\n * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a\n * sub-group of controls needs to be determined.\n *\n * Note: the purpose of `ngForm` is to group controls,\n * but not to be a replacement for the `<form>` tag with all of its capabilities\n * (e.g. posting to the server, ...).\n *\n * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n *\n */\n\n /**\n * @ngdoc directive\n * @name form\n * @restrict E\n *\n * @description\n * Directive that instantiates\n * {@link form.FormController FormController}.\n *\n * If the `name` attribute is specified, the form controller is published onto the current scope under\n * this name.\n *\n * # Alias: {@link ng.directive:ngForm `ngForm`}\n *\n * In Angular forms can be nested. This means that the outer form is valid when all of the child\n * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so\n * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to\n * `<form>` but can be nested.  This allows you to have nested forms, which is very useful when\n * using Angular validation directives in forms that are dynamically generated using the\n * {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name`\n * attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an\n * `ngForm` directive and nest these in an outer `form` element.\n *\n *\n * # CSS classes\n *  - `ng-valid` is set if the form is valid.\n *  - `ng-invalid` is set if the form is invalid.\n *  - `ng-pristine` is set if the form is pristine.\n *  - `ng-dirty` is set if the form is dirty.\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n *\n * # Submitting a form and preventing the default action\n *\n * Since the role of forms in client-side Angular applications is different than in classical\n * roundtrip apps, it is desirable for the browser not to translate the form submission into a full\n * page reload that sends the data to the server. Instead some javascript logic should be triggered\n * to handle the form submission in an application-specific way.\n *\n * For this reason, Angular prevents the default action (form submission to the server) unless the\n * `<form>` element has an `action` attribute specified.\n *\n * You can use one of the following two ways to specify what javascript method should be called when\n * a form is submitted:\n *\n * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element\n * - {@link ng.directive:ngClick ngClick} directive on the first\n  *  button or input field of type submit (input[type=submit])\n *\n * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}\n * or {@link ng.directive:ngClick ngClick} directives.\n * This is because of the following form submission rules in the HTML specification:\n *\n * - If a form has only one input field then hitting enter in this field triggers form submit\n * (`ngSubmit`)\n * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter\n * doesn't trigger submit\n * - if a form has one or more input fields and one or more buttons or input[type=submit] then\n * hitting enter in any of the input fields will trigger the click handler on the *first* button or\n * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)\n *\n *\n * ## Animation Hooks\n *\n * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.\n * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any\n * other validations that are performed within the form. Animations in ngForm are similar to how\n * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well\n * as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style a form element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-form {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-form.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n    <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"formExample\">\n      <file name=\"index.html\">\n       <script>\n         angular.module('formExample', [])\n           .controller('FormController', ['$scope', function($scope) {\n             $scope.userType = 'guest';\n           }]);\n       </script>\n       <style>\n        .my-form {\n          -webkit-transition:all linear 0.5s;\n          transition:all linear 0.5s;\n          background: transparent;\n        }\n        .my-form.ng-invalid {\n          background: red;\n        }\n       </style>\n       <form name=\"myForm\" ng-controller=\"FormController\" class=\"my-form\">\n         userType: <input name=\"input\" ng-model=\"userType\" required>\n         <span class=\"error\" ng-show=\"myForm.input.$error.required\">Required!</span><br>\n         <tt>userType = {{userType}}</tt><br>\n         <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>\n         <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should initialize to model', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n\n          expect(userType.getText()).toContain('guest');\n          expect(valid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var userInput = element(by.model('userType'));\n\n          userInput.clear();\n          userInput.sendKeys('');\n\n          expect(userType.getText()).toEqual('userType =');\n          expect(valid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n *\n * @param {string=} name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n */\nvar formDirectiveFactory = function(isNgForm) {\n  return ['$timeout', function($timeout) {\n    var formDirective = {\n      name: 'form',\n      restrict: isNgForm ? 'EAC' : 'E',\n      controller: FormController,\n      compile: function() {\n        return {\n          pre: function(scope, formElement, attr, controller) {\n            if (!attr.action) {\n              // we can't use jq events because if a form is destroyed during submission the default\n              // action is not prevented. see #1238\n              //\n              // IE 9 is not affected because it doesn't fire a submit event and try to do a full\n              // page reload if the form was destroyed by submission of the form via a click handler\n              // on a button in the form. Looks like an IE9 specific bug.\n              var preventDefaultListener = function(event) {\n                event.preventDefault\n                  ? event.preventDefault()\n                  : event.returnValue = false; // IE\n              };\n\n              addEventListenerFn(formElement[0], 'submit', preventDefaultListener);\n\n              // unregister the preventDefault listener so that we don't not leak memory but in a\n              // way that will achieve the prevention of the default action.\n              formElement.on('$destroy', function() {\n                $timeout(function() {\n                  removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);\n                }, 0, false);\n              });\n            }\n\n            var parentFormCtrl = formElement.parent().controller('form'),\n                alias = attr.name || attr.ngForm;\n\n            if (alias) {\n              setter(scope, alias, controller, alias);\n            }\n            if (parentFormCtrl) {\n              formElement.on('$destroy', function() {\n                parentFormCtrl.$removeControl(controller);\n                if (alias) {\n                  setter(scope, alias, undefined, alias);\n                }\n                extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards\n              });\n            }\n          }\n        };\n      }\n    };\n\n    return formDirective;\n  }];\n};\n\nvar formDirective = formDirectiveFactory();\nvar ngFormDirective = formDirectiveFactory(true);\n\n/* global VALID_CLASS: true,\n    INVALID_CLASS: true,\n    PRISTINE_CLASS: true,\n    DIRTY_CLASS: true\n*/\n\nvar URL_REGEXP = /^(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?$/;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;\nvar NUMBER_REGEXP = /^\\s*(\\-|\\+)?(\\d+|(\\d*(\\.\\d*)))\\s*$/;\n\nvar inputType = {\n\n  /**\n   * @ngdoc input\n   * @name input[text]\n   *\n   * @description\n   * Standard HTML text input with angular data binding, inherited by most of the `input` elements.\n   *\n   * *NOTE* Not every feature offered is available for all input types.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Adds `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n   *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n   *    patterns defined as scope expressions.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n   *    This parameter is ignored for input[type=password] controls, which will never trim the\n   *    input.\n   *\n   * @example\n      <example name=\"text-input-directive\" module=\"textInputExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('textInputExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.text = 'guest';\n               $scope.word = /^\\s*\\w*\\s*$/;\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           Single word: <input type=\"text\" name=\"input\" ng-model=\"text\"\n                               ng-pattern=\"word\" required ng-trim=\"false\">\n           <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n             Required!</span>\n           <span class=\"error\" ng-show=\"myForm.input.$error.pattern\">\n             Single word only!</span>\n\n           <tt>text = {{text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('guest');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if multi word', function() {\n            input.clear();\n            input.sendKeys('hello world');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'text': textInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[number]\n   *\n   * @description\n   * Text input with number validation and transformation. Sets the `number` validation\n   * error if not a valid number.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n   *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n   *    patterns defined as scope expressions.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"number-input-directive\" module=\"numberExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('numberExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.value = 12;\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           Number: <input type=\"number\" name=\"input\" ng-model=\"value\"\n                          min=\"0\" max=\"99\" required>\n           <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n             Required!</span>\n           <span class=\"error\" ng-show=\"myForm.input.$error.number\">\n             Not valid number!</span>\n           <tt>value = {{value}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var value = element(by.binding('value'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('value'));\n\n          it('should initialize to model', function() {\n            expect(value.getText()).toContain('12');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if over max', function() {\n            input.clear();\n            input.sendKeys('123');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'number': numberInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[url]\n   *\n   * @description\n   * Text input with URL validation. Sets the `url` validation error key if the content is not a\n   * valid URL.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n   *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n   *    patterns defined as scope expressions.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"url-input-directive\" module=\"urlExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('urlExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.text = 'http://google.com';\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           URL: <input type=\"url\" name=\"input\" ng-model=\"text\" required>\n           <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n             Required!</span>\n           <span class=\"error\" ng-show=\"myForm.input.$error.url\">\n             Not valid url!</span>\n           <tt>text = {{text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n           <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('http://google.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not url', function() {\n            input.clear();\n            input.sendKeys('box');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'url': urlInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[email]\n   *\n   * @description\n   * Text input with email validation. Sets the `email` validation error key if not a valid email\n   * address.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n   *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n   *    patterns defined as scope expressions.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"email-input-directive\" module=\"emailExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('emailExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.text = 'me@example.com';\n             }]);\n         </script>\n           <form name=\"myForm\" ng-controller=\"ExampleController\">\n             Email: <input type=\"email\" name=\"input\" ng-model=\"text\" required>\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.email\">\n               Not valid email!</span>\n             <tt>text = {{text}}</tt><br/>\n             <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n             <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n             <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n             <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n             <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>\n           </form>\n         </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('me@example.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not email', function() {\n            input.clear();\n            input.sendKeys('xxx');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'email': emailInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[radio]\n   *\n   * @description\n   * HTML radio button.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string} value The value to which the expression should be set when selected.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {string} ngValue Angular expression which sets the value to which the expression should\n   *    be set when selected.\n   *\n   * @example\n      <example name=\"radio-input-directive\" module=\"radioExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('radioExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.color = 'blue';\n               $scope.specialValue = {\n                 \"id\": \"12345\",\n                 \"value\": \"green\"\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <input type=\"radio\" ng-model=\"color\" value=\"red\">  Red <br/>\n           <input type=\"radio\" ng-model=\"color\" ng-value=\"specialValue\"> Green <br/>\n           <input type=\"radio\" ng-model=\"color\" value=\"blue\"> Blue <br/>\n           <tt>color = {{color | json}}</tt><br/>\n          </form>\n          Note that `ng-value=\"specialValue\"` sets radio item's value to be the value of `$scope.specialValue`.\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var color = element(by.binding('color'));\n\n            expect(color.getText()).toContain('blue');\n\n            element.all(by.model('color')).get(0).click();\n\n            expect(color.getText()).toContain('red');\n          });\n        </file>\n      </example>\n   */\n  'radio': radioInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[checkbox]\n   *\n   * @description\n   * HTML checkbox.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} ngTrueValue The value to which the expression should be set when selected.\n   * @param {string=} ngFalseValue The value to which the expression should be set when not selected.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"checkbox-input-directive\" module=\"checkboxExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('checkboxExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.value1 = true;\n               $scope.value2 = 'YES'\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           Value1: <input type=\"checkbox\" ng-model=\"value1\"> <br/>\n           Value2: <input type=\"checkbox\" ng-model=\"value2\"\n                          ng-true-value=\"YES\" ng-false-value=\"NO\"> <br/>\n           <tt>value1 = {{value1}}</tt><br/>\n           <tt>value2 = {{value2}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var value1 = element(by.binding('value1'));\n            var value2 = element(by.binding('value2'));\n\n            expect(value1.getText()).toContain('true');\n            expect(value2.getText()).toContain('YES');\n\n            element(by.model('value1')).click();\n            element(by.model('value2')).click();\n\n            expect(value1.getText()).toContain('false');\n            expect(value2.getText()).toContain('NO');\n          });\n        </file>\n      </example>\n   */\n  'checkbox': checkboxInputType,\n\n  'hidden': noop,\n  'button': noop,\n  'submit': noop,\n  'reset': noop,\n  'file': noop\n};\n\n// A helper function to call $setValidity and return the value / undefined,\n// a pattern that is repeated a lot in the input validation logic.\nfunction validate(ctrl, validatorName, validity, value){\n  ctrl.$setValidity(validatorName, validity);\n  return validity ? value : undefined;\n}\n\nfunction testFlags(validity, flags) {\n  var i, flag;\n  if (flags) {\n    for (i=0; i<flags.length; ++i) {\n      flag = flags[i];\n      if (validity[flag]) {\n        return true;\n      }\n    }\n  }\n  return false;\n}\n\n// Pass validity so that behaviour can be mocked easier.\nfunction addNativeHtml5Validators(ctrl, validatorName, badFlags, ignoreFlags, validity) {\n  if (isObject(validity)) {\n    ctrl.$$hasNativeValidators = true;\n    var validator = function(value) {\n      // Don't overwrite previous validation, don't consider valueMissing to apply (ng-required can\n      // perform the required validation)\n      if (!ctrl.$error[validatorName] &&\n          !testFlags(validity, ignoreFlags) &&\n          testFlags(validity, badFlags)) {\n        ctrl.$setValidity(validatorName, false);\n        return;\n      }\n      return value;\n    };\n    ctrl.$parsers.push(validator);\n  }\n}\n\nfunction textInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  var validity = element.prop(VALIDITY_STATE_PROPERTY);\n  var placeholder = element[0].placeholder, noevent = {};\n  var type = lowercase(element[0].type);\n  ctrl.$$validityState = validity;\n\n  // In composition mode, users are still inputing intermediate text buffer,\n  // hold the listener until composition is done.\n  // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent\n  if (!$sniffer.android) {\n    var composing = false;\n\n    element.on('compositionstart', function(data) {\n      composing = true;\n    });\n\n    element.on('compositionend', function() {\n      composing = false;\n      listener();\n    });\n  }\n\n  var listener = function(ev) {\n    if (composing) return;\n    var value = element.val();\n\n    // IE (11 and under) seem to emit an 'input' event if the placeholder value changes.\n    // We don't want to dirty the value when this happens, so we abort here. Unfortunately,\n    // IE also sends input events for other non-input-related things, (such as focusing on a\n    // form control), so this change is not entirely enough to solve this.\n    if (msie && (ev || noevent).type === 'input' && element[0].placeholder !== placeholder) {\n      placeholder = element[0].placeholder;\n      return;\n    }\n\n    // By default we will trim the value\n    // If the attribute ng-trim exists we will avoid trimming\n    // If input type is 'password', the value is never trimmed\n    if (type !== 'password' && (toBoolean(attr.ngTrim || 'T'))) {\n      value = trim(value);\n    }\n\n    // If a control is suffering from bad input, browsers discard its value, so it may be\n    // necessary to revalidate even if the control's value is the same empty value twice in\n    // a row.\n    var revalidate = validity && ctrl.$$hasNativeValidators;\n    if (ctrl.$viewValue !== value || (value === '' && revalidate)) {\n      if (scope.$root.$$phase) {\n        ctrl.$setViewValue(value);\n      } else {\n        scope.$apply(function() {\n          ctrl.$setViewValue(value);\n        });\n      }\n    }\n  };\n\n  // if the browser does support \"input\" event, we are fine - except on IE9 which doesn't fire the\n  // input event on backspace, delete or cut\n  if ($sniffer.hasEvent('input')) {\n    element.on('input', listener);\n  } else {\n    var timeout;\n\n    var deferListener = function() {\n      if (!timeout) {\n        timeout = $browser.defer(function() {\n          listener();\n          timeout = null;\n        });\n      }\n    };\n\n    element.on('keydown', function(event) {\n      var key = event.keyCode;\n\n      // ignore\n      //    command            modifiers                   arrows\n      if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;\n\n      deferListener();\n    });\n\n    // if user modifies input value using context menu in IE, we need \"paste\" and \"cut\" events to catch it\n    if ($sniffer.hasEvent('paste')) {\n      element.on('paste cut', deferListener);\n    }\n  }\n\n  // if user paste into input using mouse on older browser\n  // or form autocomplete on newer browser, we need \"change\" event to catch it\n  element.on('change', listener);\n\n  ctrl.$render = function() {\n    element.val(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);\n  };\n\n  // pattern validator\n  var pattern = attr.ngPattern,\n      patternValidator,\n      match;\n\n  if (pattern) {\n    var validateRegex = function(regexp, value) {\n      return validate(ctrl, 'pattern', ctrl.$isEmpty(value) || regexp.test(value), value);\n    };\n    match = pattern.match(/^\\/(.*)\\/([gim]*)$/);\n    if (match) {\n      pattern = new RegExp(match[1], match[2]);\n      patternValidator = function(value) {\n        return validateRegex(pattern, value);\n      };\n    } else {\n      patternValidator = function(value) {\n        var patternObj = scope.$eval(pattern);\n\n        if (!patternObj || !patternObj.test) {\n          throw minErr('ngPattern')('noregexp',\n            'Expected {0} to be a RegExp but was {1}. Element: {2}', pattern,\n            patternObj, startingTag(element));\n        }\n        return validateRegex(patternObj, value);\n      };\n    }\n\n    ctrl.$formatters.push(patternValidator);\n    ctrl.$parsers.push(patternValidator);\n  }\n\n  // min length validator\n  if (attr.ngMinlength) {\n    var minlength = int(attr.ngMinlength);\n    var minLengthValidator = function(value) {\n      return validate(ctrl, 'minlength', ctrl.$isEmpty(value) || value.length >= minlength, value);\n    };\n\n    ctrl.$parsers.push(minLengthValidator);\n    ctrl.$formatters.push(minLengthValidator);\n  }\n\n  // max length validator\n  if (attr.ngMaxlength) {\n    var maxlength = int(attr.ngMaxlength);\n    var maxLengthValidator = function(value) {\n      return validate(ctrl, 'maxlength', ctrl.$isEmpty(value) || value.length <= maxlength, value);\n    };\n\n    ctrl.$parsers.push(maxLengthValidator);\n    ctrl.$formatters.push(maxLengthValidator);\n  }\n}\n\nvar numberBadFlags = ['badInput'];\n\nfunction numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  textInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  ctrl.$parsers.push(function(value) {\n    var empty = ctrl.$isEmpty(value);\n    if (empty || NUMBER_REGEXP.test(value)) {\n      ctrl.$setValidity('number', true);\n      return value === '' ? null : (empty ? value : parseFloat(value));\n    } else {\n      ctrl.$setValidity('number', false);\n      return undefined;\n    }\n  });\n\n  addNativeHtml5Validators(ctrl, 'number', numberBadFlags, null, ctrl.$$validityState);\n\n  ctrl.$formatters.push(function(value) {\n    return ctrl.$isEmpty(value) ? '' : '' + value;\n  });\n\n  if (attr.min) {\n    var minValidator = function(value) {\n      var min = parseFloat(attr.min);\n      return validate(ctrl, 'min', ctrl.$isEmpty(value) || value >= min, value);\n    };\n\n    ctrl.$parsers.push(minValidator);\n    ctrl.$formatters.push(minValidator);\n  }\n\n  if (attr.max) {\n    var maxValidator = function(value) {\n      var max = parseFloat(attr.max);\n      return validate(ctrl, 'max', ctrl.$isEmpty(value) || value <= max, value);\n    };\n\n    ctrl.$parsers.push(maxValidator);\n    ctrl.$formatters.push(maxValidator);\n  }\n\n  ctrl.$formatters.push(function(value) {\n    return validate(ctrl, 'number', ctrl.$isEmpty(value) || isNumber(value), value);\n  });\n}\n\nfunction urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  textInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  var urlValidator = function(value) {\n    return validate(ctrl, 'url', ctrl.$isEmpty(value) || URL_REGEXP.test(value), value);\n  };\n\n  ctrl.$formatters.push(urlValidator);\n  ctrl.$parsers.push(urlValidator);\n}\n\nfunction emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  textInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  var emailValidator = function(value) {\n    return validate(ctrl, 'email', ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value), value);\n  };\n\n  ctrl.$formatters.push(emailValidator);\n  ctrl.$parsers.push(emailValidator);\n}\n\nfunction radioInputType(scope, element, attr, ctrl) {\n  // make the name unique, if not defined\n  if (isUndefined(attr.name)) {\n    element.attr('name', nextUid());\n  }\n\n  element.on('click', function() {\n    if (element[0].checked) {\n      scope.$apply(function() {\n        ctrl.$setViewValue(attr.value);\n      });\n    }\n  });\n\n  ctrl.$render = function() {\n    var value = attr.value;\n    element[0].checked = (value == ctrl.$viewValue);\n  };\n\n  attr.$observe('value', ctrl.$render);\n}\n\nfunction checkboxInputType(scope, element, attr, ctrl) {\n  var trueValue = attr.ngTrueValue,\n      falseValue = attr.ngFalseValue;\n\n  if (!isString(trueValue)) trueValue = true;\n  if (!isString(falseValue)) falseValue = false;\n\n  element.on('click', function() {\n    scope.$apply(function() {\n      ctrl.$setViewValue(element[0].checked);\n    });\n  });\n\n  ctrl.$render = function() {\n    element[0].checked = ctrl.$viewValue;\n  };\n\n  // Override the standard `$isEmpty` because a value of `false` means empty in a checkbox.\n  ctrl.$isEmpty = function(value) {\n    return value !== trueValue;\n  };\n\n  ctrl.$formatters.push(function(value) {\n    return value === trueValue;\n  });\n\n  ctrl.$parsers.push(function(value) {\n    return value ? trueValue : falseValue;\n  });\n}\n\n\n/**\n * @ngdoc directive\n * @name textarea\n * @restrict E\n *\n * @description\n * HTML textarea element control with angular data-binding. The data-binding and validation\n * properties of this element are exactly the same as those of the\n * {@link ng.directive:input input element}.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength.\n * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n *    patterns defined as scope expressions.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n */\n\n\n/**\n * @ngdoc directive\n * @name input\n * @restrict E\n *\n * @description\n * HTML input element control with angular data-binding. Input control follows HTML5 input types\n * and polyfills the HTML5 validation behavior for older browsers.\n *\n * *NOTE* Not every feature offered is available for all input types.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {boolean=} ngRequired Sets `required` attribute if set to true\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength.\n * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n *    patterns defined as scope expressions.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n *    This parameter is ignored for input[type=password] controls, which will never trim the\n *    input.\n *\n * @example\n    <example name=\"input-directive\" module=\"inputExample\">\n      <file name=\"index.html\">\n       <script>\n          angular.module('inputExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.user = {name: 'guest', last: 'visitor'};\n            }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <form name=\"myForm\">\n           User name: <input type=\"text\" name=\"userName\" ng-model=\"user.name\" required>\n           <span class=\"error\" ng-show=\"myForm.userName.$error.required\">\n             Required!</span><br>\n           Last name: <input type=\"text\" name=\"lastName\" ng-model=\"user.last\"\n             ng-minlength=\"3\" ng-maxlength=\"10\">\n           <span class=\"error\" ng-show=\"myForm.lastName.$error.minlength\">\n             Too short!</span>\n           <span class=\"error\" ng-show=\"myForm.lastName.$error.maxlength\">\n             Too long!</span><br>\n         </form>\n         <hr>\n         <tt>user = {{user}}</tt><br/>\n         <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br>\n         <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br>\n         <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br>\n         <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>\n         <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br>\n         <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br>\n       </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var user = element(by.binding('{{user}}'));\n        var userNameValid = element(by.binding('myForm.userName.$valid'));\n        var lastNameValid = element(by.binding('myForm.lastName.$valid'));\n        var lastNameError = element(by.binding('myForm.lastName.$error'));\n        var formValid = element(by.binding('myForm.$valid'));\n        var userNameInput = element(by.model('user.name'));\n        var userLastInput = element(by.model('user.last'));\n\n        it('should initialize to model', function() {\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty when required', function() {\n          userNameInput.clear();\n          userNameInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('false');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be valid if empty when min length is set', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"\"}');\n          expect(lastNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if less than required min length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('xx');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('minlength');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be invalid if longer than max length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('some ridiculously long name');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('maxlength');\n          expect(formValid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n */\nvar inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) {\n  return {\n    restrict: 'E',\n    require: '?ngModel',\n    link: function(scope, element, attr, ctrl) {\n      if (ctrl) {\n        (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrl, $sniffer,\n                                                            $browser);\n      }\n    }\n  };\n}];\n\nvar VALID_CLASS = 'ng-valid',\n    INVALID_CLASS = 'ng-invalid',\n    PRISTINE_CLASS = 'ng-pristine',\n    DIRTY_CLASS = 'ng-dirty';\n\n/**\n * @ngdoc type\n * @name ngModel.NgModelController\n *\n * @property {string} $viewValue Actual string value in the view.\n * @property {*} $modelValue The value in the model, that the control is bound to.\n * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever\n       the control reads value from the DOM.  Each function is called, in turn, passing the value\n       through to the next. The last return value is used to populate the model.\n       Used to sanitize / convert the value as well as validation. For validation,\n       the parsers should update the validity state using\n       {@link ngModel.NgModelController#$setValidity $setValidity()},\n       and return `undefined` for invalid values.\n\n *\n * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever\n       the model value changes. Each function is called, in turn, passing the value through to the\n       next. Used to format / convert values for display in the control and validation.\n * ```js\n * function formatter(value) {\n *   if (value) {\n *     return value.toUpperCase();\n *   }\n * }\n * ngModel.$formatters.push(formatter);\n * ```\n *\n * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the\n *     view value has changed. It is called with no arguments, and its return value is ignored.\n *     This can be used in place of additional $watches against the model value.\n *\n * @property {Object} $error An object hash with all errors as keys.\n *\n * @property {boolean} $pristine True if user has not interacted with the control yet.\n * @property {boolean} $dirty True if user has already interacted with the control.\n * @property {boolean} $valid True if there is no error.\n * @property {boolean} $invalid True if at least one error on the control.\n *\n * @description\n *\n * `NgModelController` provides API for the `ng-model` directive. The controller contains\n * services for data-binding, validation, CSS updates, and value formatting and parsing. It\n * purposefully does not contain any logic which deals with DOM rendering or listening to\n * DOM events. Such DOM related logic should be provided by other directives which make use of\n * `NgModelController` for data-binding.\n *\n * ## Custom Control Example\n * This example shows how to use `NgModelController` with a custom control to achieve\n * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)\n * collaborate together to achieve the desired result.\n *\n * Note that `contenteditable` is an HTML5 attribute, which tells the browser to let the element\n * contents be edited in place by the user.  This will not work on older browsers.\n *\n * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}\n * module to automatically remove \"bad\" content like inline event listener (e.g. `<span onclick=\"...\">`).\n * However, as we are using `$sce` the model can still decide to to provide unsafe content if it marks\n * that content using the `$sce` service.\n *\n * <example name=\"NgModelController\" module=\"customControl\" deps=\"angular-sanitize.js\">\n    <file name=\"style.css\">\n      [contenteditable] {\n        border: 1px solid black;\n        background-color: white;\n        min-height: 20px;\n      }\n\n      .ng-invalid {\n        border: 1px solid red;\n      }\n\n    </file>\n    <file name=\"script.js\">\n      angular.module('customControl', ['ngSanitize']).\n        directive('contenteditable', ['$sce', function($sce) {\n          return {\n            restrict: 'A', // only activate on element attribute\n            require: '?ngModel', // get a hold of NgModelController\n            link: function(scope, element, attrs, ngModel) {\n              if(!ngModel) return; // do nothing if no ng-model\n\n              // Specify how UI should be updated\n              ngModel.$render = function() {\n                element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));\n              };\n\n              // Listen for change events to enable binding\n              element.on('blur keyup change', function() {\n                scope.$apply(read);\n              });\n              read(); // initialize\n\n              // Write data to the model\n              function read() {\n                var html = element.html();\n                // When we clear the content editable the browser leaves a <br> behind\n                // If strip-br attribute is provided then we strip this out\n                if( attrs.stripBr && html == '<br>' ) {\n                  html = '';\n                }\n                ngModel.$setViewValue(html);\n              }\n            }\n          };\n        }]);\n    </file>\n    <file name=\"index.html\">\n      <form name=\"myForm\">\n       <div contenteditable\n            name=\"myWidget\" ng-model=\"userContent\"\n            strip-br=\"true\"\n            required>Change me!</div>\n        <span ng-show=\"myForm.myWidget.$error.required\">Required!</span>\n       <hr>\n       <textarea ng-model=\"userContent\"></textarea>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n    it('should data-bind and become invalid', function() {\n      if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {\n        // SafariDriver can't handle contenteditable\n        // and Firefox driver can't clear contenteditables very well\n        return;\n      }\n      var contentEditable = element(by.css('[contenteditable]'));\n      var content = 'Change me!';\n\n      expect(contentEditable.getText()).toEqual(content);\n\n      contentEditable.clear();\n      contentEditable.sendKeys(protractor.Key.BACK_SPACE);\n      expect(contentEditable.getText()).toEqual('');\n      expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);\n    });\n    </file>\n * </example>\n *\n *\n */\nvar NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate',\n    function($scope, $exceptionHandler, $attr, $element, $parse, $animate) {\n  this.$viewValue = Number.NaN;\n  this.$modelValue = Number.NaN;\n  this.$parsers = [];\n  this.$formatters = [];\n  this.$viewChangeListeners = [];\n  this.$pristine = true;\n  this.$dirty = false;\n  this.$valid = true;\n  this.$invalid = false;\n  this.$name = $attr.name;\n\n  var ngModelGet = $parse($attr.ngModel),\n      ngModelSet = ngModelGet.assign;\n\n  if (!ngModelSet) {\n    throw minErr('ngModel')('nonassign', \"Expression '{0}' is non-assignable. Element: {1}\",\n        $attr.ngModel, startingTag($element));\n  }\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$render\n   *\n   * @description\n   * Called when the view needs to be updated. It is expected that the user of the ng-model\n   * directive will implement this method.\n   */\n  this.$render = noop;\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$isEmpty\n   *\n   * @description\n   * This is called when we need to determine if the value of the input is empty.\n   *\n   * For instance, the required directive does this to work out if the input has data or not.\n   * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.\n   *\n   * You can override this for input directives whose concept of being empty is different to the\n   * default. The `checkboxInputType` directive does this because in its case a value of `false`\n   * implies empty.\n   *\n   * @param {*} value Reference to check.\n   * @returns {boolean} True if `value` is empty.\n   */\n  this.$isEmpty = function(value) {\n    return isUndefined(value) || value === '' || value === null || value !== value;\n  };\n\n  var parentForm = $element.inheritedData('$formController') || nullFormCtrl,\n      invalidCount = 0, // used to easily determine if we are valid\n      $error = this.$error = {}; // keep invalid keys here\n\n\n  // Setup initial state of the control\n  $element.addClass(PRISTINE_CLASS);\n  toggleValidCss(true);\n\n  // convenience method for easy toggling of classes\n  function toggleValidCss(isValid, validationErrorKey) {\n    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';\n    $animate.removeClass($element, (isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey);\n    $animate.addClass($element, (isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);\n  }\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setValidity\n   *\n   * @description\n   * Change the validity state, and notifies the form when the control changes validity. (i.e. it\n   * does not notify form if given validator is already marked as invalid).\n   *\n   * This method should be called by validators - i.e. the parser or formatter functions.\n   *\n   * @param {string} validationErrorKey Name of the validator. the `validationErrorKey` will assign\n   *        to `$error[validationErrorKey]=!isValid` so that it is available for data-binding.\n   *        The `validationErrorKey` should be in camelCase and will get converted into dash-case\n   *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`\n   *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .\n   * @param {boolean} isValid Whether the current state is valid (true) or invalid (false).\n   */\n  this.$setValidity = function(validationErrorKey, isValid) {\n    // Purposeful use of ! here to cast isValid to boolean in case it is undefined\n    // jshint -W018\n    if ($error[validationErrorKey] === !isValid) return;\n    // jshint +W018\n\n    if (isValid) {\n      if ($error[validationErrorKey]) invalidCount--;\n      if (!invalidCount) {\n        toggleValidCss(true);\n        this.$valid = true;\n        this.$invalid = false;\n      }\n    } else {\n      toggleValidCss(false);\n      this.$invalid = true;\n      this.$valid = false;\n      invalidCount++;\n    }\n\n    $error[validationErrorKey] = !isValid;\n    toggleValidCss(isValid, validationErrorKey);\n\n    parentForm.$setValidity(validationErrorKey, isValid, this);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setPristine\n   *\n   * @description\n   * Sets the control to its pristine state.\n   *\n   * This method can be called to remove the 'ng-dirty' class and set the control to its pristine\n   * state (ng-pristine class).\n   */\n  this.$setPristine = function () {\n    this.$dirty = false;\n    this.$pristine = true;\n    $animate.removeClass($element, DIRTY_CLASS);\n    $animate.addClass($element, PRISTINE_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setViewValue\n   *\n   * @description\n   * Update the view value.\n   *\n   * This method should be called when the view value changes, typically from within a DOM event handler.\n   * For example {@link ng.directive:input input} and\n   * {@link ng.directive:select select} directives call it.\n   *\n   * It will update the $viewValue, then pass this value through each of the functions in `$parsers`,\n   * which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to\n   * `$modelValue` and the **expression** specified in the `ng-model` attribute.\n   *\n   * Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.\n   *\n   * Note that calling this function does not trigger a `$digest`.\n   *\n   * @param {string} value Value from the view.\n   */\n  this.$setViewValue = function(value) {\n    this.$viewValue = value;\n\n    // change to dirty\n    if (this.$pristine) {\n      this.$dirty = true;\n      this.$pristine = false;\n      $animate.removeClass($element, PRISTINE_CLASS);\n      $animate.addClass($element, DIRTY_CLASS);\n      parentForm.$setDirty();\n    }\n\n    forEach(this.$parsers, function(fn) {\n      value = fn(value);\n    });\n\n    if (this.$modelValue !== value) {\n      this.$modelValue = value;\n      ngModelSet($scope, value);\n      forEach(this.$viewChangeListeners, function(listener) {\n        try {\n          listener();\n        } catch(e) {\n          $exceptionHandler(e);\n        }\n      });\n    }\n  };\n\n  // model -> value\n  var ctrl = this;\n\n  $scope.$watch(function ngModelWatch() {\n    var value = ngModelGet($scope);\n\n    // if scope model value and ngModel value are out of sync\n    if (ctrl.$modelValue !== value) {\n\n      var formatters = ctrl.$formatters,\n          idx = formatters.length;\n\n      ctrl.$modelValue = value;\n      while(idx--) {\n        value = formatters[idx](value);\n      }\n\n      if (ctrl.$viewValue !== value) {\n        ctrl.$viewValue = value;\n        ctrl.$render();\n      }\n    }\n\n    return value;\n  });\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngModel\n *\n * @element input\n *\n * @description\n * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a\n * property on the scope using {@link ngModel.NgModelController NgModelController},\n * which is created and exposed by this directive.\n *\n * `ngModel` is responsible for:\n *\n * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`\n *   require.\n * - Providing validation behavior (i.e. required, number, email, url).\n * - Keeping the state of the control (valid/invalid, dirty/pristine, validation errors).\n * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`) including animations.\n * - Registering the control with its parent {@link ng.directive:form form}.\n *\n * Note: `ngModel` will try to bind to the property given by evaluating the expression on the\n * current scope. If the property doesn't already exist on this scope, it will be created\n * implicitly and added to the scope.\n *\n * For best practices on using `ngModel`, see:\n *\n *  - [https://github.com/angular/angular.js/wiki/Understanding-Scopes]\n *\n * For basic examples, how to use `ngModel`, see:\n *\n *  - {@link ng.directive:input input}\n *    - {@link input[text] text}\n *    - {@link input[checkbox] checkbox}\n *    - {@link input[radio] radio}\n *    - {@link input[number] number}\n *    - {@link input[email] email}\n *    - {@link input[url] url}\n *  - {@link ng.directive:select select}\n *  - {@link ng.directive:textarea textarea}\n *\n * # CSS classes\n * The following CSS classes are added and removed on the associated input/select/textarea element\n * depending on the validity of the model.\n *\n *  - `ng-valid` is set if the model is valid.\n *  - `ng-invalid` is set if the model is invalid.\n *  - `ng-pristine` is set if the model is pristine.\n *  - `ng-dirty` is set if the model is dirty.\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n * ## Animation Hooks\n *\n * Animations within models are triggered when any of the associated CSS classes are added and removed\n * on the input element which is attached to the model. These classes are: `.ng-pristine`, `.ng-dirty`,\n * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.\n * The animations that are triggered within ngModel are similar to how they work in ngClass and\n * animations can be hooked into using CSS transitions, keyframes as well as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style an input element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-input {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-input.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n * <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"inputExample\">\n     <file name=\"index.html\">\n       <script>\n        angular.module('inputExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.val = '1';\n          }]);\n       </script>\n       <style>\n         .my-input {\n           -webkit-transition:all linear 0.5s;\n           transition:all linear 0.5s;\n           background: transparent;\n         }\n         .my-input.ng-invalid {\n           color:white;\n           background: red;\n         }\n       </style>\n       Update input to see transitions when valid/invalid.\n       Integer is a valid value.\n       <form name=\"testForm\" ng-controller=\"ExampleController\">\n         <input ng-model=\"val\" ng-pattern=\"/^\\d+$/\" name=\"anim\" class=\"my-input\" />\n       </form>\n     </file>\n * </example>\n */\nvar ngModelDirective = function() {\n  return {\n    require: ['ngModel', '^?form'],\n    controller: NgModelController,\n    link: function(scope, element, attr, ctrls) {\n      // notify others, especially parent forms\n\n      var modelCtrl = ctrls[0],\n          formCtrl = ctrls[1] || nullFormCtrl;\n\n      formCtrl.$addControl(modelCtrl);\n\n      scope.$on('$destroy', function() {\n        formCtrl.$removeControl(modelCtrl);\n      });\n    }\n  };\n};\n\n\n/**\n * @ngdoc directive\n * @name ngChange\n *\n * @description\n * Evaluate the given expression when the user changes the input.\n * The expression is evaluated immediately, unlike the JavaScript onchange event\n * which only triggers at the end of a change (usually, when the user leaves the\n * form element or presses the return key).\n * The expression is not evaluated when the value change is coming from the model.\n *\n * Note, this directive requires `ngModel` to be present.\n *\n * @element input\n * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change\n * in input value.\n *\n * @example\n * <example name=\"ngChange-directive\" module=\"changeExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('changeExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.counter = 0;\n *           $scope.change = function() {\n *             $scope.counter++;\n *           };\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <input type=\"checkbox\" ng-model=\"confirmed\" ng-change=\"change()\" id=\"ng-change-example1\" />\n *       <input type=\"checkbox\" ng-model=\"confirmed\" id=\"ng-change-example2\" />\n *       <label for=\"ng-change-example2\">Confirmed</label><br />\n *       <tt>debug = {{confirmed}}</tt><br/>\n *       <tt>counter = {{counter}}</tt><br/>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     var counter = element(by.binding('counter'));\n *     var debug = element(by.binding('confirmed'));\n *\n *     it('should evaluate the expression if changing from view', function() {\n *       expect(counter.getText()).toContain('0');\n *\n *       element(by.id('ng-change-example1')).click();\n *\n *       expect(counter.getText()).toContain('1');\n *       expect(debug.getText()).toContain('true');\n *     });\n *\n *     it('should not evaluate the expression if changing from model', function() {\n *       element(by.id('ng-change-example2')).click();\n\n *       expect(counter.getText()).toContain('0');\n *       expect(debug.getText()).toContain('true');\n *     });\n *   </file>\n * </example>\n */\nvar ngChangeDirective = valueFn({\n  require: 'ngModel',\n  link: function(scope, element, attr, ctrl) {\n    ctrl.$viewChangeListeners.push(function() {\n      scope.$eval(attr.ngChange);\n    });\n  }\n});\n\n\nvar requiredDirective = function() {\n  return {\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n      attr.required = true; // force truthy in case we are on non input element\n\n      var validator = function(value) {\n        if (attr.required && ctrl.$isEmpty(value)) {\n          ctrl.$setValidity('required', false);\n          return;\n        } else {\n          ctrl.$setValidity('required', true);\n          return value;\n        }\n      };\n\n      ctrl.$formatters.push(validator);\n      ctrl.$parsers.unshift(validator);\n\n      attr.$observe('required', function() {\n        validator(ctrl.$viewValue);\n      });\n    }\n  };\n};\n\n\n/**\n * @ngdoc directive\n * @name ngList\n *\n * @description\n * Text input that converts between a delimited string and an array of strings. The delimiter\n * can be a fixed string (by default a comma) or a regular expression.\n *\n * @element input\n * @param {string=} ngList optional delimiter that should be used to split the value. If\n *   specified in form `/something/` then the value will be converted into a regular expression.\n *\n * @example\n    <example name=\"ngList-directive\" module=\"listExample\">\n      <file name=\"index.html\">\n       <script>\n         angular.module('listExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.names = ['igor', 'misko', 'vojta'];\n           }]);\n       </script>\n       <form name=\"myForm\" ng-controller=\"ExampleController\">\n         List: <input name=\"namesInput\" ng-model=\"names\" ng-list required>\n         <span class=\"error\" ng-show=\"myForm.namesInput.$error.required\">\n           Required!</span>\n         <br>\n         <tt>names = {{names}}</tt><br/>\n         <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>\n         <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var listInput = element(by.model('names'));\n        var names = element(by.binding('{{names}}'));\n        var valid = element(by.binding('myForm.namesInput.$valid'));\n        var error = element(by.css('span.error'));\n\n        it('should initialize to model', function() {\n          expect(names.getText()).toContain('[\"igor\",\"misko\",\"vojta\"]');\n          expect(valid.getText()).toContain('true');\n          expect(error.getCssValue('display')).toBe('none');\n        });\n\n        it('should be invalid if empty', function() {\n          listInput.clear();\n          listInput.sendKeys('');\n\n          expect(names.getText()).toContain('');\n          expect(valid.getText()).toContain('false');\n          expect(error.getCssValue('display')).not.toBe('none');        });\n      </file>\n    </example>\n */\nvar ngListDirective = function() {\n  return {\n    require: 'ngModel',\n    link: function(scope, element, attr, ctrl) {\n      var match = /\\/(.*)\\//.exec(attr.ngList),\n          separator = match && new RegExp(match[1]) || attr.ngList || ',';\n\n      var parse = function(viewValue) {\n        // If the viewValue is invalid (say required but empty) it will be `undefined`\n        if (isUndefined(viewValue)) return;\n\n        var list = [];\n\n        if (viewValue) {\n          forEach(viewValue.split(separator), function(value) {\n            if (value) list.push(trim(value));\n          });\n        }\n\n        return list;\n      };\n\n      ctrl.$parsers.push(parse);\n      ctrl.$formatters.push(function(value) {\n        if (isArray(value)) {\n          return value.join(', ');\n        }\n\n        return undefined;\n      });\n\n      // Override the standard $isEmpty because an empty array means the input is empty.\n      ctrl.$isEmpty = function(value) {\n        return !value || !value.length;\n      };\n    }\n  };\n};\n\n\nvar CONSTANT_VALUE_REGEXP = /^(true|false|\\d+)$/;\n/**\n * @ngdoc directive\n * @name ngValue\n *\n * @description\n * Binds the given expression to the value of `input[select]` or `input[radio]`, so\n * that when the element is selected, the `ngModel` of that element is set to the\n * bound value.\n *\n * `ngValue` is useful when dynamically generating lists of radio buttons using `ng-repeat`, as\n * shown below.\n *\n * @element input\n * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute\n *   of the `input` element\n *\n * @example\n    <example name=\"ngValue-directive\" module=\"valueExample\">\n      <file name=\"index.html\">\n       <script>\n          angular.module('valueExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.names = ['pizza', 'unicorns', 'robots'];\n              $scope.my = { favorite: 'unicorns' };\n            }]);\n       </script>\n        <form ng-controller=\"ExampleController\">\n          <h2>Which is your favorite?</h2>\n            <label ng-repeat=\"name in names\" for=\"{{name}}\">\n              {{name}}\n              <input type=\"radio\"\n                     ng-model=\"my.favorite\"\n                     ng-value=\"name\"\n                     id=\"{{name}}\"\n                     name=\"favorite\">\n            </label>\n          <div>You chose {{my.favorite}}</div>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var favorite = element(by.binding('my.favorite'));\n\n        it('should initialize to model', function() {\n          expect(favorite.getText()).toContain('unicorns');\n        });\n        it('should bind the values to the inputs', function() {\n          element.all(by.model('my.favorite')).get(0).click();\n          expect(favorite.getText()).toContain('pizza');\n        });\n      </file>\n    </example>\n */\nvar ngValueDirective = function() {\n  return {\n    priority: 100,\n    compile: function(tpl, tplAttr) {\n      if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {\n        return function ngValueConstantLink(scope, elm, attr) {\n          attr.$set('value', scope.$eval(attr.ngValue));\n        };\n      } else {\n        return function ngValueLink(scope, elm, attr) {\n          scope.$watch(attr.ngValue, function valueWatchAction(value) {\n            attr.$set('value', value);\n          });\n        };\n      }\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngBind\n * @restrict AC\n *\n * @description\n * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element\n * with the value of a given expression, and to update the text content when the value of that\n * expression changes.\n *\n * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like\n * `{{ expression }}` which is similar but less verbose.\n *\n * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily\n * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an\n * element attribute, it makes the bindings invisible to the user while the page is loading.\n *\n * An alternative solution to this problem would be using the\n * {@link ng.directive:ngCloak ngCloak} directive.\n *\n *\n * @element ANY\n * @param {expression} ngBind {@link guide/expression Expression} to evaluate.\n *\n * @example\n * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.\n   <example module=\"bindExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('bindExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.name = 'Whirled';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         Enter name: <input type=\"text\" ng-model=\"name\"><br>\n         Hello <span ng-bind=\"name\"></span>!\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var nameInput = element(by.model('name'));\n\n         expect(element(by.binding('name')).getText()).toBe('Whirled');\n         nameInput.clear();\n         nameInput.sendKeys('world');\n         expect(element(by.binding('name')).getText()).toBe('world');\n       });\n     </file>\n   </example>\n */\nvar ngBindDirective = ngDirective({\n  compile: function(templateElement) {\n    templateElement.addClass('ng-binding');\n    return function (scope, element, attr) {\n      element.data('$binding', attr.ngBind);\n      scope.$watch(attr.ngBind, function ngBindWatchAction(value) {\n        // We are purposefully using == here rather than === because we want to\n        // catch when value is \"null or undefined\"\n        // jshint -W041\n        element.text(value == undefined ? '' : value);\n      });\n    };\n  }\n});\n\n\n/**\n * @ngdoc directive\n * @name ngBindTemplate\n *\n * @description\n * The `ngBindTemplate` directive specifies that the element\n * text content should be replaced with the interpolation of the template\n * in the `ngBindTemplate` attribute.\n * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`\n * expressions. This directive is needed since some HTML elements\n * (such as TITLE and OPTION) cannot contain SPAN elements.\n *\n * @element ANY\n * @param {string} ngBindTemplate template of form\n *   <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.\n *\n * @example\n * Try it here: enter text in text box and watch the greeting change.\n   <example module=\"bindExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('bindExample', [])\n           .controller('ExampleController', ['$scope', function ($scope) {\n             $scope.salutation = 'Hello';\n             $scope.name = 'World';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n        Salutation: <input type=\"text\" ng-model=\"salutation\"><br>\n        Name: <input type=\"text\" ng-model=\"name\"><br>\n        <pre ng-bind-template=\"{{salutation}} {{name}}!\"></pre>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var salutationElem = element(by.binding('salutation'));\n         var salutationInput = element(by.model('salutation'));\n         var nameInput = element(by.model('name'));\n\n         expect(salutationElem.getText()).toBe('Hello World!');\n\n         salutationInput.clear();\n         salutationInput.sendKeys('Greetings');\n         nameInput.clear();\n         nameInput.sendKeys('user');\n\n         expect(salutationElem.getText()).toBe('Greetings user!');\n       });\n     </file>\n   </example>\n */\nvar ngBindTemplateDirective = ['$interpolate', function($interpolate) {\n  return function(scope, element, attr) {\n    // TODO: move this to scenario runner\n    var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));\n    element.addClass('ng-binding').data('$binding', interpolateFn);\n    attr.$observe('ngBindTemplate', function(value) {\n      element.text(value);\n    });\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindHtml\n *\n * @description\n * Creates a binding that will innerHTML the result of evaluating the `expression` into the current\n * element in a secure way.  By default, the innerHTML-ed content will be sanitized using the {@link\n * ngSanitize.$sanitize $sanitize} service.  To utilize this functionality, ensure that `$sanitize`\n * is available, for example, by including {@link ngSanitize} in your module's dependencies (not in\n * core Angular.)  You may also bypass sanitization for values you know are safe. To do so, bind to\n * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}.  See the example\n * under {@link ng.$sce#Example Strict Contextual Escaping (SCE)}.\n *\n * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you\n * will have an exception (instead of an exploit.)\n *\n * @element ANY\n * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.\n *\n * @example\n\n   <example module=\"bindHtmlExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n        <p ng-bind-html=\"myHTML\"></p>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n       angular.module('bindHtmlExample', ['ngSanitize'])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.myHTML =\n              'I am an <code>HTML</code>string with ' +\n              '<a href=\"#\">links!</a> and other <em>stuff</em>';\n         }]);\n     </file>\n\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind-html', function() {\n         expect(element(by.binding('myHTML')).getText()).toBe(\n             'I am an HTMLstring with links! and other stuff');\n       });\n     </file>\n   </example>\n */\nvar ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {\n  return {\n    compile: function (tElement) {\n      tElement.addClass('ng-binding');\n\n      return function (scope, element, attr) {\n        element.data('$binding', attr.ngBindHtml);\n\n        var parsed = $parse(attr.ngBindHtml);\n\n        function getStringValue() {\n          return (parsed(scope) || '').toString();\n        }\n\n        scope.$watch(getStringValue, function ngBindHtmlWatchAction(value) {\n          element.html($sce.getTrustedHtml(parsed(scope)) || '');\n        });\n      };\n    }\n  };\n}];\n\nfunction classDirective(name, selector) {\n  name = 'ngClass' + name;\n  return ['$animate', function($animate) {\n    return {\n      restrict: 'AC',\n      link: function(scope, element, attr) {\n        var oldVal;\n\n        scope.$watch(attr[name], ngClassWatchAction, true);\n\n        attr.$observe('class', function(value) {\n          ngClassWatchAction(scope.$eval(attr[name]));\n        });\n\n\n        if (name !== 'ngClass') {\n          scope.$watch('$index', function($index, old$index) {\n            // jshint bitwise: false\n            var mod = $index & 1;\n            if (mod !== (old$index & 1)) {\n              var classes = arrayClasses(scope.$eval(attr[name]));\n              mod === selector ?\n                addClasses(classes) :\n                removeClasses(classes);\n            }\n          });\n        }\n\n        function addClasses(classes) {\n          var newClasses = digestClassCounts(classes, 1);\n          attr.$addClass(newClasses);\n        }\n\n        function removeClasses(classes) {\n          var newClasses = digestClassCounts(classes, -1);\n          attr.$removeClass(newClasses);\n        }\n\n        function digestClassCounts (classes, count) {\n          var classCounts = element.data('$classCounts') || {};\n          var classesToUpdate = [];\n          forEach(classes, function (className) {\n            if (count > 0 || classCounts[className]) {\n              classCounts[className] = (classCounts[className] || 0) + count;\n              if (classCounts[className] === +(count > 0)) {\n                classesToUpdate.push(className);\n              }\n            }\n          });\n          element.data('$classCounts', classCounts);\n          return classesToUpdate.join(' ');\n        }\n\n        function updateClasses (oldClasses, newClasses) {\n          var toAdd = arrayDifference(newClasses, oldClasses);\n          var toRemove = arrayDifference(oldClasses, newClasses);\n          toRemove = digestClassCounts(toRemove, -1);\n          toAdd = digestClassCounts(toAdd, 1);\n\n          if (toAdd.length === 0) {\n            $animate.removeClass(element, toRemove);\n          } else if (toRemove.length === 0) {\n            $animate.addClass(element, toAdd);\n          } else {\n            $animate.setClass(element, toAdd, toRemove);\n          }\n        }\n\n        function ngClassWatchAction(newVal) {\n          if (selector === true || scope.$index % 2 === selector) {\n            var newClasses = arrayClasses(newVal || []);\n            if (!oldVal) {\n              addClasses(newClasses);\n            } else if (!equals(newVal,oldVal)) {\n              var oldClasses = arrayClasses(oldVal);\n              updateClasses(oldClasses, newClasses);\n            }\n          }\n          oldVal = shallowCopy(newVal);\n        }\n      }\n    };\n\n    function arrayDifference(tokens1, tokens2) {\n      var values = [];\n\n      outer:\n      for(var i = 0; i < tokens1.length; i++) {\n        var token = tokens1[i];\n        for(var j = 0; j < tokens2.length; j++) {\n          if(token == tokens2[j]) continue outer;\n        }\n        values.push(token);\n      }\n      return values;\n    }\n\n    function arrayClasses (classVal) {\n      if (isArray(classVal)) {\n        return classVal;\n      } else if (isString(classVal)) {\n        return classVal.split(' ');\n      } else if (isObject(classVal)) {\n        var classes = [], i = 0;\n        forEach(classVal, function(v, k) {\n          if (v) {\n            classes = classes.concat(k.split(' '));\n          }\n        });\n        return classes;\n      }\n      return classVal;\n    }\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ngClass\n * @restrict AC\n *\n * @description\n * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding\n * an expression that represents all classes to be added.\n *\n * The directive operates in three different ways, depending on which of three types the expression\n * evaluates to:\n *\n * 1. If the expression evaluates to a string, the string should be one or more space-delimited class\n * names.\n *\n * 2. If the expression evaluates to an array, each element of the array should be a string that is\n * one or more space-delimited class names.\n *\n * 3. If the expression evaluates to an object, then for each key-value pair of the\n * object with a truthy value the corresponding key is used as a class name.\n *\n * The directive won't add duplicate classes if a particular class was already set.\n *\n * When the expression changes, the previously added classes are removed and only then the\n * new classes are added.\n *\n * @animations\n * add - happens just before the class is applied to the element\n * remove - happens just before the class is removed from the element\n *\n * @element ANY\n * @param {expression} ngClass {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class\n *   names, an array, or a map of class names to boolean values. In the case of a map, the\n *   names of the properties whose values are truthy will be added as css classes to the\n *   element.\n *\n * @example Example that demonstrates basic bindings via ngClass directive.\n   <example>\n     <file name=\"index.html\">\n       <p ng-class=\"{strike: deleted, bold: important, red: error}\">Map Syntax Example</p>\n       <input type=\"checkbox\" ng-model=\"deleted\"> deleted (apply \"strike\" class)<br>\n       <input type=\"checkbox\" ng-model=\"important\"> important (apply \"bold\" class)<br>\n       <input type=\"checkbox\" ng-model=\"error\"> error (apply \"red\" class)\n       <hr>\n       <p ng-class=\"style\">Using String Syntax</p>\n       <input type=\"text\" ng-model=\"style\" placeholder=\"Type: bold strike red\">\n       <hr>\n       <p ng-class=\"[style1, style2, style3]\">Using Array Syntax</p>\n       <input ng-model=\"style1\" placeholder=\"Type: bold, strike or red\"><br>\n       <input ng-model=\"style2\" placeholder=\"Type: bold, strike or red\"><br>\n       <input ng-model=\"style3\" placeholder=\"Type: bold, strike or red\"><br>\n     </file>\n     <file name=\"style.css\">\n       .strike {\n         text-decoration: line-through;\n       }\n       .bold {\n           font-weight: bold;\n       }\n       .red {\n           color: red;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var ps = element.all(by.css('p'));\n\n       it('should let you toggle the class', function() {\n\n         expect(ps.first().getAttribute('class')).not.toMatch(/bold/);\n         expect(ps.first().getAttribute('class')).not.toMatch(/red/);\n\n         element(by.model('important')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/bold/);\n\n         element(by.model('error')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/red/);\n       });\n\n       it('should let you toggle string example', function() {\n         expect(ps.get(1).getAttribute('class')).toBe('');\n         element(by.model('style')).clear();\n         element(by.model('style')).sendKeys('red');\n         expect(ps.get(1).getAttribute('class')).toBe('red');\n       });\n\n       it('array example should have 3 classes', function() {\n         expect(ps.last().getAttribute('class')).toBe('');\n         element(by.model('style1')).sendKeys('bold');\n         element(by.model('style2')).sendKeys('strike');\n         element(by.model('style3')).sendKeys('red');\n         expect(ps.last().getAttribute('class')).toBe('bold strike red');\n       });\n     </file>\n   </example>\n\n   ## Animations\n\n   The example below demonstrates how to perform animations using ngClass.\n\n   <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n     <file name=\"index.html\">\n      <input id=\"setbtn\" type=\"button\" value=\"set\" ng-click=\"myVar='my-class'\">\n      <input id=\"clearbtn\" type=\"button\" value=\"clear\" ng-click=\"myVar=''\">\n      <br>\n      <span class=\"base-class\" ng-class=\"myVar\">Sample Text</span>\n     </file>\n     <file name=\"style.css\">\n       .base-class {\n         -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n         transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n       }\n\n       .base-class.my-class {\n         color: red;\n         font-size:3em;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class', function() {\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n\n         element(by.id('setbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).\n           toMatch(/my-class/);\n\n         element(by.id('clearbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n       });\n     </file>\n   </example>\n\n\n   ## ngClass and pre-existing CSS3 Transitions/Animations\n   The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.\n   Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder\n   any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure\n   to view the step by step details of {@link ngAnimate.$animate#addclass $animate.addClass} and\n   {@link ngAnimate.$animate#removeclass $animate.removeClass}.\n */\nvar ngClassDirective = classDirective('', true);\n\n/**\n * @ngdoc directive\n * @name ngClassOdd\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}}\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassOddDirective = classDirective('Odd', 0);\n\n/**\n * @ngdoc directive\n * @name ngClassEven\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The\n *   result of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}} &nbsp; &nbsp; &nbsp;\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassEvenDirective = classDirective('Even', 1);\n\n/**\n * @ngdoc directive\n * @name ngCloak\n * @restrict AC\n *\n * @description\n * The `ngCloak` directive is used to prevent the Angular html template from being briefly\n * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this\n * directive to avoid the undesirable flicker effect caused by the html template display.\n *\n * The directive can be applied to the `<body>` element, but the preferred usage is to apply\n * multiple `ngCloak` directives to small portions of the page to permit progressive rendering\n * of the browser view.\n *\n * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and\n * `angular.min.js`.\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```css\n * [ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {\n *   display: none !important;\n * }\n * ```\n *\n * When this css rule is loaded by the browser, all html elements (including their children) that\n * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive\n * during the compilation of the template it deletes the `ngCloak` element attribute, making\n * the compiled element visible.\n *\n * For the best result, the `angular.js` script must be loaded in the head section of the html\n * document; alternatively, the css rule above must be included in the external stylesheet of the\n * application.\n *\n * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they\n * cannot match the `[ng\\:cloak]` selector. To work around this limitation, you must add the css\n * class `ng-cloak` in addition to the `ngCloak` directive as shown in the example below.\n *\n * @element ANY\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <div id=\"template1\" ng-cloak>{{ 'hello' }}</div>\n        <div id=\"template2\" ng-cloak class=\"ng-cloak\">{{ 'hello IE7' }}</div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should remove the template directive and css class', function() {\n         expect($('#template1').getAttribute('ng-cloak')).\n           toBeNull();\n         expect($('#template2').getAttribute('ng-cloak')).\n           toBeNull();\n       });\n     </file>\n   </example>\n *\n */\nvar ngCloakDirective = ngDirective({\n  compile: function(element, attr) {\n    attr.$set('ngCloak', undefined);\n    element.removeClass('ng-cloak');\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngController\n *\n * @description\n * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular\n * supports the principles behind the Model-View-Controller design pattern.\n *\n * MVC components in angular:\n *\n * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties\n *   are accessed through bindings.\n * * View — The template (HTML with data bindings) that is rendered into the View.\n * * Controller — The `ngController` directive specifies a Controller class; the class contains business\n *   logic behind the application to decorate the scope with functions and values\n *\n * Note that you can also attach controllers to the DOM by declaring it in a route definition\n * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller\n * again using `ng-controller` in the template itself.  This will cause the controller to be attached\n * and executed twice.\n *\n * @element ANY\n * @scope\n * @param {expression} ngController Name of a globally accessible constructor function or an\n *     {@link guide/expression expression} that on the current scope evaluates to a\n *     constructor function. The controller instance can be published into a scope property\n *     by specifying `as propertyName`.\n *\n * @example\n * Here is a simple form for editing user contact information. Adding, removing, clearing, and\n * greeting are methods declared on the controller (see source tab). These methods can\n * easily be called from the angular markup. Any changes to the data are automatically reflected\n * in the View without the need for a manual update.\n *\n * Two different declaration styles are included below:\n *\n * * one binds methods and properties directly onto the controller using `this`:\n * `ng-controller=\"SettingsController1 as settings\"`\n * * one injects `$scope` into the controller:\n * `ng-controller=\"SettingsController2\"`\n *\n * The second option is more common in the Angular community, and is generally used in boilerplates\n * and in this guide. However, there are advantages to binding properties directly to the controller\n * and avoiding scope.\n *\n * * Using `controller as` makes it obvious which controller you are accessing in the template when\n * multiple controllers apply to an element.\n * * If you are writing your controllers as classes you have easier access to the properties and\n * methods, which will appear on the scope, from inside the controller code.\n * * Since there is always a `.` in the bindings, you don't have to worry about prototypal\n * inheritance masking primitives.\n *\n * This example demonstrates the `controller as` syntax.\n *\n * <example name=\"ngControllerAs\" module=\"controllerAsExample\">\n *   <file name=\"index.html\">\n *    <div id=\"ctrl-as-exmpl\" ng-controller=\"SettingsController1 as settings\">\n *      Name: <input type=\"text\" ng-model=\"settings.name\"/>\n *      [ <a href=\"\" ng-click=\"settings.greet()\">greet</a> ]<br/>\n *      Contact:\n *      <ul>\n *        <li ng-repeat=\"contact in settings.contacts\">\n *          <select ng-model=\"contact.type\">\n *             <option>phone</option>\n *             <option>email</option>\n *          </select>\n *          <input type=\"text\" ng-model=\"contact.value\"/>\n *          [ <a href=\"\" ng-click=\"settings.clearContact(contact)\">clear</a>\n *          | <a href=\"\" ng-click=\"settings.removeContact(contact)\">X</a> ]\n *        </li>\n *        <li>[ <a href=\"\" ng-click=\"settings.addContact()\">add</a> ]</li>\n *     </ul>\n *    </div>\n *   </file>\n *   <file name=\"app.js\">\n *    angular.module('controllerAsExample', [])\n *      .controller('SettingsController1', SettingsController1);\n *\n *    function SettingsController1() {\n *      this.name = \"John Smith\";\n *      this.contacts = [\n *        {type: 'phone', value: '408 555 1212'},\n *        {type: 'email', value: 'john.smith@example.org'} ];\n *    }\n *\n *    SettingsController1.prototype.greet = function() {\n *      alert(this.name);\n *    };\n *\n *    SettingsController1.prototype.addContact = function() {\n *      this.contacts.push({type: 'email', value: 'yourname@example.org'});\n *    };\n *\n *    SettingsController1.prototype.removeContact = function(contactToRemove) {\n *     var index = this.contacts.indexOf(contactToRemove);\n *      this.contacts.splice(index, 1);\n *    };\n *\n *    SettingsController1.prototype.clearContact = function(contact) {\n *      contact.type = 'phone';\n *      contact.value = '';\n *    };\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it('should check controller as', function() {\n *       var container = element(by.id('ctrl-as-exmpl'));\n *         expect(container.element(by.model('settings.name'))\n *           .getAttribute('value')).toBe('John Smith');\n *\n *       var firstRepeat =\n *           container.element(by.repeater('contact in settings.contacts').row(0));\n *       var secondRepeat =\n *           container.element(by.repeater('contact in settings.contacts').row(1));\n *\n *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('408 555 1212');\n *\n *       expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('john.smith@example.org');\n *\n *       firstRepeat.element(by.linkText('clear')).click();\n *\n *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('');\n *\n *       container.element(by.linkText('add')).click();\n *\n *       expect(container.element(by.repeater('contact in settings.contacts').row(2))\n *           .element(by.model('contact.value'))\n *           .getAttribute('value'))\n *           .toBe('yourname@example.org');\n *     });\n *   </file>\n * </example>\n *\n * This example demonstrates the \"attach to `$scope`\" style of controller.\n *\n * <example name=\"ngController\" module=\"controllerExample\">\n *  <file name=\"index.html\">\n *   <div id=\"ctrl-exmpl\" ng-controller=\"SettingsController2\">\n *     Name: <input type=\"text\" ng-model=\"name\"/>\n *     [ <a href=\"\" ng-click=\"greet()\">greet</a> ]<br/>\n *     Contact:\n *     <ul>\n *       <li ng-repeat=\"contact in contacts\">\n *         <select ng-model=\"contact.type\">\n *            <option>phone</option>\n *            <option>email</option>\n *         </select>\n *         <input type=\"text\" ng-model=\"contact.value\"/>\n *         [ <a href=\"\" ng-click=\"clearContact(contact)\">clear</a>\n *         | <a href=\"\" ng-click=\"removeContact(contact)\">X</a> ]\n *       </li>\n *       <li>[ <a href=\"\" ng-click=\"addContact()\">add</a> ]</li>\n *    </ul>\n *   </div>\n *  </file>\n *  <file name=\"app.js\">\n *   angular.module('controllerExample', [])\n *     .controller('SettingsController2', ['$scope', SettingsController2]);\n *\n *   function SettingsController2($scope) {\n *     $scope.name = \"John Smith\";\n *     $scope.contacts = [\n *       {type:'phone', value:'408 555 1212'},\n *       {type:'email', value:'john.smith@example.org'} ];\n *\n *     $scope.greet = function() {\n *       alert($scope.name);\n *     };\n *\n *     $scope.addContact = function() {\n *       $scope.contacts.push({type:'email', value:'yourname@example.org'});\n *     };\n *\n *     $scope.removeContact = function(contactToRemove) {\n *       var index = $scope.contacts.indexOf(contactToRemove);\n *       $scope.contacts.splice(index, 1);\n *     };\n *\n *     $scope.clearContact = function(contact) {\n *       contact.type = 'phone';\n *       contact.value = '';\n *     };\n *   }\n *  </file>\n *  <file name=\"protractor.js\" type=\"protractor\">\n *    it('should check controller', function() {\n *      var container = element(by.id('ctrl-exmpl'));\n *\n *      expect(container.element(by.model('name'))\n *          .getAttribute('value')).toBe('John Smith');\n *\n *      var firstRepeat =\n *          container.element(by.repeater('contact in contacts').row(0));\n *      var secondRepeat =\n *          container.element(by.repeater('contact in contacts').row(1));\n *\n *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('408 555 1212');\n *      expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('john.smith@example.org');\n *\n *      firstRepeat.element(by.linkText('clear')).click();\n *\n *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('');\n *\n *      container.element(by.linkText('add')).click();\n *\n *      expect(container.element(by.repeater('contact in contacts').row(2))\n *          .element(by.model('contact.value'))\n *          .getAttribute('value'))\n *          .toBe('yourname@example.org');\n *    });\n *  </file>\n *</example>\n\n */\nvar ngControllerDirective = [function() {\n  return {\n    scope: true,\n    controller: '@',\n    priority: 500\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngCsp\n *\n * @element html\n * @description\n * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.\n *\n * This is necessary when developing things like Google Chrome Extensions.\n *\n * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).\n * For Angular to be CSP compatible there are only two things that we need to do differently:\n *\n * - don't use `Function` constructor to generate optimized value getters\n * - don't inject custom stylesheet into the document\n *\n * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp`\n * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will\n * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will\n * be raised.\n *\n * CSP forbids JavaScript to inline stylesheet rules. In non CSP mode Angular automatically\n * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}).\n * To make those directives work in CSP mode, include the `angular-csp.css` manually.\n *\n * Angular tries to autodetect if CSP is active and automatically turn on the CSP-safe mode. This\n * autodetection however triggers a CSP error to be logged in the console:\n *\n * ```\n * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of\n * script in the following Content Security Policy directive: \"default-src 'self'\". Note that\n * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.\n * ```\n *\n * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`\n * directive on the root element of the application or on the `angular.js` script tag, whichever\n * appears first in the html document.\n *\n * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*\n *\n * @example\n * This example shows how to apply the `ngCsp` directive to the `html` tag.\n   ```html\n     <!doctype html>\n     <html ng-app ng-csp>\n     ...\n     ...\n     </html>\n   ```\n */\n\n// ngCsp is not implemented as a proper directive any more, because we need it be processed while we\n// bootstrap the system (before $parse is instantiated), for this reason we just have\n// the csp.isActive() fn that looks for ng-csp attribute anywhere in the current doc\n\n/**\n * @ngdoc directive\n * @name ngClick\n *\n * @description\n * The ngClick directive allows you to specify custom behavior when\n * an element is clicked.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon\n * click. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-click=\"count = count + 1\" ng-init=\"count=0\">\n        Increment\n      </button>\n      <span>\n        count: {{count}}\n      <span>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-click', function() {\n         expect(element(by.binding('count')).getText()).toMatch('0');\n         element(by.css('button')).click();\n         expect(element(by.binding('count')).getText()).toMatch('1');\n       });\n     </file>\n   </example>\n */\n/*\n * A directive that allows creation of custom onclick handlers that are defined as angular\n * expressions and are compiled and executed within the current scope.\n *\n * Events that are handled via these handler are always configured not to propagate further.\n */\nvar ngEventDirectives = {};\n\n// For events that might fire synchronously during DOM manipulation\n// we need to execute their event handlers asynchronously using $evalAsync,\n// so that they are not executed in an inconsistent state.\nvar forceAsyncEvents = {\n  'blur': true,\n  'focus': true\n};\nforEach(\n  'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),\n  function(name) {\n    var directiveName = directiveNormalize('ng-' + name);\n    ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {\n      return {\n        compile: function($element, attr) {\n          var fn = $parse(attr[directiveName]);\n          return function ngEventHandler(scope, element) {\n            var eventName = lowercase(name);\n            element.on(eventName, function(event) {\n              var callback = function() {\n                fn(scope, {$event:event});\n              };\n              if (forceAsyncEvents[eventName] && $rootScope.$$phase) {\n                scope.$evalAsync(callback);\n              } else {\n                scope.$apply(callback);\n              }\n            });\n          };\n        }\n      };\n    }];\n  }\n);\n\n/**\n * @ngdoc directive\n * @name ngDblclick\n *\n * @description\n * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon\n * a dblclick. (The Event object is available as `$event`)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-dblclick=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on double click)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousedown\n *\n * @description\n * The ngMousedown directive allows you to specify custom behavior on mousedown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon\n * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousedown=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse down)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseup\n *\n * @description\n * Specify custom behavior on mouseup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon\n * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseup=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse up)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngMouseover\n *\n * @description\n * Specify custom behavior on mouseover event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon\n * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseover=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse is over)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseenter\n *\n * @description\n * Specify custom behavior on mouseenter event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon\n * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseenter=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse enters)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseleave\n *\n * @description\n * Specify custom behavior on mouseleave event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon\n * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseleave=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse leaves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousemove\n *\n * @description\n * Specify custom behavior on mousemove event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon\n * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousemove=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse moves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeydown\n *\n * @description\n * Specify custom behavior on keydown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon\n * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keydown=\"count = count + 1\" ng-init=\"count=0\">\n      key down count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeyup\n *\n * @description\n * Specify custom behavior on keyup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon\n * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <p>Typing in the input box below updates the key count</p>\n       <input ng-keyup=\"count = count + 1\" ng-init=\"count=0\"> key up count: {{count}}\n\n       <p>Typing in the input box below updates the keycode</p>\n       <input ng-keyup=\"event=$event\">\n       <p>event keyCode: {{ event.keyCode }}</p>\n       <p>event altKey: {{ event.altKey }}</p>\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeypress\n *\n * @description\n * Specify custom behavior on keypress event.\n *\n * @element ANY\n * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon\n * keypress. ({@link guide/expression#-event- Event object is available as `$event`}\n * and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keypress=\"count = count + 1\" ng-init=\"count=0\">\n      key press count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSubmit\n *\n * @description\n * Enables binding angular expressions to onsubmit events.\n *\n * Additionally it prevents the default action (which for form means sending the request to the\n * server and reloading the current page), but only if the form does not contain `action`,\n * `data-action`, or `x-action` attributes.\n *\n * <div class=\"alert alert-warning\">\n * **Warning:** Be careful not to cause \"double-submission\" by using both the `ngClick` and\n * `ngSubmit` handlers together. See the\n * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}\n * for a detailed discussion of when `ngSubmit` may be triggered.\n * </div>\n *\n * @element form\n * @priority 0\n * @param {expression} ngSubmit {@link guide/expression Expression} to eval.\n * ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example module=\"submitExample\">\n     <file name=\"index.html\">\n      <script>\n        angular.module('submitExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.list = [];\n            $scope.text = 'hello';\n            $scope.submit = function() {\n              if ($scope.text) {\n                $scope.list.push(this.text);\n                $scope.text = '';\n              }\n            };\n          }]);\n      </script>\n      <form ng-submit=\"submit()\" ng-controller=\"ExampleController\">\n        Enter text and hit enter:\n        <input type=\"text\" ng-model=\"text\" name=\"text\" />\n        <input type=\"submit\" id=\"submit\" value=\"Submit\" />\n        <pre>list={{list}}</pre>\n      </form>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-submit', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n         expect(element(by.model('text')).getAttribute('value')).toBe('');\n       });\n       it('should ignore empty strings', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n        });\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngFocus\n *\n * @description\n * Specify custom behavior on focus event.\n *\n * Note: As the `focus` event is executed synchronously when calling `input.focus()`\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon\n * focus. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngBlur\n *\n * @description\n * Specify custom behavior on blur event.\n *\n * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when\n * an element has lost focus.\n *\n * Note: As the `blur` event is executed synchronously also during DOM manipulations\n * (e.g. removing a focussed input),\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon\n * blur. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngCopy\n *\n * @description\n * Specify custom behavior on copy event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon\n * copy. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-copy=\"copied=true\" ng-init=\"copied=false; value='copy me'\" ng-model=\"value\">\n      copied: {{copied}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngCut\n *\n * @description\n * Specify custom behavior on cut event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon\n * cut. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-cut=\"cut=true\" ng-init=\"cut=false; value='cut me'\" ng-model=\"value\">\n      cut: {{cut}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngPaste\n *\n * @description\n * Specify custom behavior on paste event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon\n * paste. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-paste=\"paste=true\" ng-init=\"paste=false\" placeholder='paste here'>\n      pasted: {{paste}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngIf\n * @restrict A\n *\n * @description\n * The `ngIf` directive removes or recreates a portion of the DOM tree based on an\n * {expression}. If the expression assigned to `ngIf` evaluates to a false\n * value then the element is removed from the DOM, otherwise a clone of the\n * element is reinserted into the DOM.\n *\n * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the\n * element in the DOM rather than changing its visibility via the `display` css property.  A common\n * case when this difference is significant is when using css selectors that rely on an element's\n * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.\n *\n * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope\n * is created when the element is restored.  The scope created within `ngIf` inherits from\n * its parent scope using\n * [prototypal inheritance](https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance).\n * An important implication of this is if `ngModel` is used within `ngIf` to bind to\n * a javascript primitive defined in the parent scope. In this case any modifications made to the\n * variable within the child scope will override (hide) the value in the parent scope.\n *\n * Also, `ngIf` recreates elements using their compiled state. An example of this behavior\n * is if an element's class attribute is directly modified after it's compiled, using something like\n * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element\n * the added class will be lost because the original compiled state is used to regenerate the element.\n *\n * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`\n * and `leave` effects.\n *\n * @animations\n * enter - happens just after the ngIf contents change and a new DOM element is created and injected into the ngIf container\n * leave - happens just before the ngIf contents are removed from the DOM\n *\n * @element ANY\n * @scope\n * @priority 600\n * @param {expression} ngIf If the {@link guide/expression expression} is falsy then\n *     the element is removed from the DOM tree. If it is truthy a copy of the compiled\n *     element is added to the DOM tree.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\" ng-init=\"checked=true\" /><br/>\n      Show when checked:\n      <span ng-if=\"checked\" class=\"animate-if\">\n        I'm removed when the checkbox is unchecked.\n      </span>\n    </file>\n    <file name=\"animations.css\">\n      .animate-if {\n        background:white;\n        border:1px solid black;\n        padding:10px;\n      }\n\n      .animate-if.ng-enter, .animate-if.ng-leave {\n        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n      }\n\n      .animate-if.ng-enter,\n      .animate-if.ng-leave.ng-leave-active {\n        opacity:0;\n      }\n\n      .animate-if.ng-leave,\n      .animate-if.ng-enter.ng-enter-active {\n        opacity:1;\n      }\n    </file>\n  </example>\n */\nvar ngIfDirective = ['$animate', function($animate) {\n  return {\n    transclude: 'element',\n    priority: 600,\n    terminal: true,\n    restrict: 'A',\n    $$tlb: true,\n    link: function ($scope, $element, $attr, ctrl, $transclude) {\n        var block, childScope, previousElements;\n        $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {\n\n          if (toBoolean(value)) {\n            if (!childScope) {\n              childScope = $scope.$new();\n              $transclude(childScope, function (clone) {\n                clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block = {\n                  clone: clone\n                };\n                $animate.enter(clone, $element.parent(), $element);\n              });\n            }\n          } else {\n            if(previousElements) {\n              previousElements.remove();\n              previousElements = null;\n            }\n            if(childScope) {\n              childScope.$destroy();\n              childScope = null;\n            }\n            if(block) {\n              previousElements = getBlockElements(block.clone);\n              $animate.leave(previousElements, function() {\n                previousElements = null;\n              });\n              block = null;\n            }\n          }\n        });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngInclude\n * @restrict ECA\n *\n * @description\n * Fetches, compiles and includes an external HTML fragment.\n *\n * By default, the template URL is restricted to the same domain and protocol as the\n * application document. This is done by calling {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols\n * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or\n * [wrap them](ng.$sce#trustAsResourceUrl) as trusted values. Refer to Angular's {@link\n * ng.$sce Strict Contextual Escaping}.\n *\n * In addition, the browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy may further restrict whether the template is successfully loaded.\n * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`\n * access on some browsers.\n *\n * @animations\n * enter - animation is used to bring new content into the browser.\n * leave - animation is used to animate existing content away.\n *\n * The enter and leave animation occur concurrently.\n *\n * @scope\n * @priority 400\n *\n * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,\n *                 make sure you wrap it in **single** quotes, e.g. `src=\"'myPartialTemplate.html'\"`.\n * @param {string=} onload Expression to evaluate when a new partial is loaded.\n *\n * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll\n *                  $anchorScroll} to scroll the viewport after the content is loaded.\n *\n *                  - If the attribute is not set, disable scrolling.\n *                  - If the attribute is set without value, enable scrolling.\n *                  - Otherwise enable scrolling only if the expression evaluates to truthy value.\n *\n * @example\n  <example module=\"includeExample\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n     <div ng-controller=\"ExampleController\">\n       <select ng-model=\"template\" ng-options=\"t.name for t in templates\">\n        <option value=\"\">(blank)</option>\n       </select>\n       url of the template: <tt>{{template.url}}</tt>\n       <hr/>\n       <div class=\"slide-animate-container\">\n         <div class=\"slide-animate\" ng-include=\"template.url\"></div>\n       </div>\n     </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('includeExample', ['ngAnimate'])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.templates =\n            [ { name: 'template1.html', url: 'template1.html'},\n              { name: 'template2.html', url: 'template2.html'} ];\n          $scope.template = $scope.templates[0];\n        }]);\n     </file>\n    <file name=\"template1.html\">\n      Content of template1.html\n    </file>\n    <file name=\"template2.html\">\n      Content of template2.html\n    </file>\n    <file name=\"animations.css\">\n      .slide-animate-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .slide-animate {\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter, .slide-animate.ng-leave {\n        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n        display:block;\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter {\n        top:-50px;\n      }\n      .slide-animate.ng-enter.ng-enter-active {\n        top:0;\n      }\n\n      .slide-animate.ng-leave {\n        top:0;\n      }\n      .slide-animate.ng-leave.ng-leave-active {\n        top:50px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var templateSelect = element(by.model('template'));\n      var includeElem = element(by.css('[ng-include]'));\n\n      it('should load template1.html', function() {\n        expect(includeElem.getText()).toMatch(/Content of template1.html/);\n      });\n\n      it('should load template2.html', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          // See https://github.com/angular/protractor/issues/480\n          return;\n        }\n        templateSelect.click();\n        templateSelect.all(by.css('option')).get(2).click();\n        expect(includeElem.getText()).toMatch(/Content of template2.html/);\n      });\n\n      it('should change to blank', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          return;\n        }\n        templateSelect.click();\n        templateSelect.all(by.css('option')).get(0).click();\n        expect(includeElem.isPresent()).toBe(false);\n      });\n    </file>\n  </example>\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentRequested\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted every time the ngInclude content is requested.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentLoaded\n * @eventType emit on the current ngInclude scope\n * @description\n * Emitted every time the ngInclude content is reloaded.\n */\nvar ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$animate', '$sce',\n                  function($http,   $templateCache,   $anchorScroll,   $animate,   $sce) {\n  return {\n    restrict: 'ECA',\n    priority: 400,\n    terminal: true,\n    transclude: 'element',\n    controller: angular.noop,\n    compile: function(element, attr) {\n      var srcExp = attr.ngInclude || attr.src,\n          onloadExp = attr.onload || '',\n          autoScrollExp = attr.autoscroll;\n\n      return function(scope, $element, $attr, ctrl, $transclude) {\n        var changeCounter = 0,\n            currentScope,\n            previousElement,\n            currentElement;\n\n        var cleanupLastIncludeContent = function() {\n          if(previousElement) {\n            previousElement.remove();\n            previousElement = null;\n          }\n          if(currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n          if(currentElement) {\n            $animate.leave(currentElement, function() {\n              previousElement = null;\n            });\n            previousElement = currentElement;\n            currentElement = null;\n          }\n        };\n\n        scope.$watch($sce.parseAsResourceUrl(srcExp), function ngIncludeWatchAction(src) {\n          var afterAnimation = function() {\n            if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {\n              $anchorScroll();\n            }\n          };\n          var thisChangeId = ++changeCounter;\n\n          if (src) {\n            $http.get(src, {cache: $templateCache}).success(function(response) {\n              if (thisChangeId !== changeCounter) return;\n              var newScope = scope.$new();\n              ctrl.template = response;\n\n              // Note: This will also link all children of ng-include that were contained in the original\n              // html. If that content contains controllers, ... they could pollute/change the scope.\n              // However, using ng-include on an element with additional content does not make sense...\n              // Note: We can't remove them in the cloneAttchFn of $transclude as that\n              // function is called before linking the content, which would apply child\n              // directives to non existing elements.\n              var clone = $transclude(newScope, function(clone) {\n                cleanupLastIncludeContent();\n                $animate.enter(clone, null, $element, afterAnimation);\n              });\n\n              currentScope = newScope;\n              currentElement = clone;\n\n              currentScope.$emit('$includeContentLoaded');\n              scope.$eval(onloadExp);\n            }).error(function() {\n              if (thisChangeId === changeCounter) cleanupLastIncludeContent();\n            });\n            scope.$emit('$includeContentRequested');\n          } else {\n            cleanupLastIncludeContent();\n            ctrl.template = null;\n          }\n        });\n      };\n    }\n  };\n}];\n\n// This directive is called during the $transclude call of the first `ngInclude` directive.\n// It will replace and compile the content of the element with the loaded template.\n// We need this directive so that the element content is already filled when\n// the link function of another directive on the same element as ngInclude\n// is called.\nvar ngIncludeFillContentDirective = ['$compile',\n  function($compile) {\n    return {\n      restrict: 'ECA',\n      priority: -400,\n      require: 'ngInclude',\n      link: function(scope, $element, $attr, ctrl) {\n        $element.html(ctrl.template);\n        $compile($element.contents())(scope);\n      }\n    };\n  }];\n\n/**\n * @ngdoc directive\n * @name ngInit\n * @restrict AC\n *\n * @description\n * The `ngInit` directive allows you to evaluate an expression in the\n * current scope.\n *\n * <div class=\"alert alert-error\">\n * The only appropriate use of `ngInit` is for aliasing special properties of\n * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you\n * should use {@link guide/controller controllers} rather than `ngInit`\n * to initialize values on a scope.\n * </div>\n * <div class=\"alert alert-warning\">\n * **Note**: If you have assignment in `ngInit` along with {@link ng.$filter `$filter`}, make\n * sure you have parenthesis for correct precedence:\n * <pre class=\"prettyprint\">\n *   <div ng-init=\"test1 = (data | orderBy:'name')\"></div>\n * </pre>\n * </div>\n *\n * @priority 450\n *\n * @element ANY\n * @param {expression} ngInit {@link guide/expression Expression} to eval.\n *\n * @example\n   <example module=\"initExample\">\n     <file name=\"index.html\">\n   <script>\n     angular.module('initExample', [])\n       .controller('ExampleController', ['$scope', function($scope) {\n         $scope.list = [['a', 'b'], ['c', 'd']];\n       }]);\n   </script>\n   <div ng-controller=\"ExampleController\">\n     <div ng-repeat=\"innerList in list\" ng-init=\"outerIndex = $index\">\n       <div ng-repeat=\"value in innerList\" ng-init=\"innerIndex = $index\">\n          <span class=\"example-init\">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>\n       </div>\n     </div>\n   </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should alias index positions', function() {\n         var elements = element.all(by.css('.example-init'));\n         expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');\n         expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');\n         expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');\n         expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');\n       });\n     </file>\n   </example>\n */\nvar ngInitDirective = ngDirective({\n  priority: 450,\n  compile: function() {\n    return {\n      pre: function(scope, element, attrs) {\n        scope.$eval(attrs.ngInit);\n      }\n    };\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngNonBindable\n * @restrict AC\n * @priority 1000\n *\n * @description\n * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current\n * DOM element. This is useful if the element contains what appears to be Angular directives and\n * bindings but which should be ignored by Angular. This could be the case if you have a site that\n * displays snippets of code, for instance.\n *\n * @element ANY\n *\n * @example\n * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,\n * but the one wrapped in `ngNonBindable` is left alone.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <div>Normal: {{1 + 2}}</div>\n        <div ng-non-bindable>Ignored: {{1 + 2}}</div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-non-bindable', function() {\n         expect(element(by.binding('1 + 2')).getText()).toContain('3');\n         expect(element.all(by.css('div')).last().getText()).toMatch(/1 \\+ 2/);\n       });\n      </file>\n    </example>\n */\nvar ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });\n\n/**\n * @ngdoc directive\n * @name ngPluralize\n * @restrict EA\n *\n * @description\n * `ngPluralize` is a directive that displays messages according to en-US localization rules.\n * These rules are bundled with angular.js, but can be overridden\n * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive\n * by specifying the mappings between\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * and the strings to be displayed.\n *\n * # Plural categories and explicit number rules\n * There are two\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * in Angular's default en-US locale: \"one\" and \"other\".\n *\n * While a plural category may match many numbers (for example, in en-US locale, \"other\" can match\n * any number that is not 1), an explicit number rule can only match one number. For example, the\n * explicit number rule for \"3\" matches the number 3. There are examples of plural categories\n * and explicit number rules throughout the rest of this documentation.\n *\n * # Configuring ngPluralize\n * You configure ngPluralize by providing 2 attributes: `count` and `when`.\n * You can also provide an optional attribute, `offset`.\n *\n * The value of the `count` attribute can be either a string or an {@link guide/expression\n * Angular expression}; these are evaluated on the current scope for its bound value.\n *\n * The `when` attribute specifies the mappings between plural categories and the actual\n * string to be displayed. The value of the attribute should be a JSON object.\n *\n * The following example shows how to configure ngPluralize:\n *\n * ```html\n * <ng-pluralize count=\"personCount\"\n                 when=\"{'0': 'Nobody is viewing.',\n *                      'one': '1 person is viewing.',\n *                      'other': '{} people are viewing.'}\">\n * </ng-pluralize>\n *```\n *\n * In the example, `\"0: Nobody is viewing.\"` is an explicit number rule. If you did not\n * specify this rule, 0 would be matched to the \"other\" category and \"0 people are viewing\"\n * would be shown instead of \"Nobody is viewing\". You can specify an explicit number rule for\n * other numbers, for example 12, so that instead of showing \"12 people are viewing\", you can\n * show \"a dozen people are viewing\".\n *\n * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted\n * into pluralized strings. In the previous example, Angular will replace `{}` with\n * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder\n * for <span ng-non-bindable>{{numberExpression}}</span>.\n *\n * # Configuring ngPluralize with offset\n * The `offset` attribute allows further customization of pluralized text, which can result in\n * a better user experience. For example, instead of the message \"4 people are viewing this document\",\n * you might display \"John, Kate and 2 others are viewing this document\".\n * The offset attribute allows you to offset a number by any desired value.\n * Let's take a look at an example:\n *\n * ```html\n * <ng-pluralize count=\"personCount\" offset=2\n *               when=\"{'0': 'Nobody is viewing.',\n *                      '1': '{{person1}} is viewing.',\n *                      '2': '{{person1}} and {{person2}} are viewing.',\n *                      'one': '{{person1}}, {{person2}} and one other person are viewing.',\n *                      'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n * </ng-pluralize>\n * ```\n *\n * Notice that we are still using two plural categories(one, other), but we added\n * three explicit number rules 0, 1 and 2.\n * When one person, perhaps John, views the document, \"John is viewing\" will be shown.\n * When three people view the document, no explicit number rule is found, so\n * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.\n * In this case, plural category 'one' is matched and \"John, Mary and one other person are viewing\"\n * is shown.\n *\n * Note that when you specify offsets, you must provide explicit number rules for\n * numbers from 0 up to and including the offset. If you use an offset of 3, for example,\n * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for\n * plural categories \"one\" and \"other\".\n *\n * @param {string|expression} count The variable to be bound to.\n * @param {string} when The mapping between plural category to its corresponding strings.\n * @param {number=} offset Offset to deduct from the total number.\n *\n * @example\n    <example module=\"pluralizeExample\">\n      <file name=\"index.html\">\n        <script>\n          angular.module('pluralizeExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.person1 = 'Igor';\n              $scope.person2 = 'Misko';\n              $scope.personCount = 1;\n            }]);\n        </script>\n        <div ng-controller=\"ExampleController\">\n          Person 1:<input type=\"text\" ng-model=\"person1\" value=\"Igor\" /><br/>\n          Person 2:<input type=\"text\" ng-model=\"person2\" value=\"Misko\" /><br/>\n          Number of People:<input type=\"text\" ng-model=\"personCount\" value=\"1\" /><br/>\n\n          <!--- Example with simple pluralization rules for en locale --->\n          Without Offset:\n          <ng-pluralize count=\"personCount\"\n                        when=\"{'0': 'Nobody is viewing.',\n                               'one': '1 person is viewing.',\n                               'other': '{} people are viewing.'}\">\n          </ng-pluralize><br>\n\n          <!--- Example with offset --->\n          With Offset(2):\n          <ng-pluralize count=\"personCount\" offset=2\n                        when=\"{'0': 'Nobody is viewing.',\n                               '1': '{{person1}} is viewing.',\n                               '2': '{{person1}} and {{person2}} are viewing.',\n                               'one': '{{person1}}, {{person2}} and one other person are viewing.',\n                               'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n          </ng-pluralize>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should show correct pluralized string', function() {\n          var withoutOffset = element.all(by.css('ng-pluralize')).get(0);\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var countInput = element(by.model('personCount'));\n\n          expect(withoutOffset.getText()).toEqual('1 person is viewing.');\n          expect(withOffset.getText()).toEqual('Igor is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('0');\n\n          expect(withoutOffset.getText()).toEqual('Nobody is viewing.');\n          expect(withOffset.getText()).toEqual('Nobody is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('2');\n\n          expect(withoutOffset.getText()).toEqual('2 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('3');\n\n          expect(withoutOffset.getText()).toEqual('3 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('4');\n\n          expect(withoutOffset.getText()).toEqual('4 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');\n        });\n        it('should show data-bound names', function() {\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var personCount = element(by.model('personCount'));\n          var person1 = element(by.model('person1'));\n          var person2 = element(by.model('person2'));\n          personCount.clear();\n          personCount.sendKeys('4');\n          person1.clear();\n          person1.sendKeys('Di');\n          person2.clear();\n          person2.sendKeys('Vojta');\n          expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');\n        });\n      </file>\n    </example>\n */\nvar ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) {\n  var BRACE = /{}/g;\n  return {\n    restrict: 'EA',\n    link: function(scope, element, attr) {\n      var numberExp = attr.count,\n          whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs\n          offset = attr.offset || 0,\n          whens = scope.$eval(whenExp) || {},\n          whensExpFns = {},\n          startSymbol = $interpolate.startSymbol(),\n          endSymbol = $interpolate.endSymbol(),\n          isWhen = /^when(Minus)?(.+)$/;\n\n      forEach(attr, function(expression, attributeName) {\n        if (isWhen.test(attributeName)) {\n          whens[lowercase(attributeName.replace('when', '').replace('Minus', '-'))] =\n            element.attr(attr.$attr[attributeName]);\n        }\n      });\n      forEach(whens, function(expression, key) {\n        whensExpFns[key] =\n          $interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +\n            offset + endSymbol));\n      });\n\n      scope.$watch(function ngPluralizeWatch() {\n        var value = parseFloat(scope.$eval(numberExp));\n\n        if (!isNaN(value)) {\n          //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise,\n          //check it against pluralization rules in $locale service\n          if (!(value in whens)) value = $locale.pluralCat(value - offset);\n           return whensExpFns[value](scope, element, true);\n        } else {\n          return '';\n        }\n      }, function ngPluralizeWatchAction(newVal) {\n        element.text(newVal);\n      });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngRepeat\n *\n * @description\n * The `ngRepeat` directive instantiates a template once per item from a collection. Each template\n * instance gets its own scope, where the given loop variable is set to the current collection item,\n * and `$index` is set to the item index or key.\n *\n * Special properties are exposed on the local scope of each template instance, including:\n *\n * | Variable  | Type            | Details                                                                     |\n * |-----------|-----------------|-----------------------------------------------------------------------------|\n * | `$index`  | {@type number}  | iterator offset of the repeated element (0..length-1)                       |\n * | `$first`  | {@type boolean} | true if the repeated element is first in the iterator.                      |\n * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |\n * | `$last`   | {@type boolean} | true if the repeated element is last in the iterator.                       |\n * | `$even`   | {@type boolean} | true if the iterator position `$index` is even (otherwise false).           |\n * | `$odd`    | {@type boolean} | true if the iterator position `$index` is odd (otherwise false).            |\n *\n * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.\n * This may be useful when, for instance, nesting ngRepeats.\n *\n * # Special repeat start and end points\n * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending\n * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.\n * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)\n * up to and including the ending HTML tag where **ng-repeat-end** is placed.\n *\n * The example below makes use of this feature:\n * ```html\n *   <header ng-repeat-start=\"item in items\">\n *     Header {{ item }}\n *   </header>\n *   <div class=\"body\">\n *     Body {{ item }}\n *   </div>\n *   <footer ng-repeat-end>\n *     Footer {{ item }}\n *   </footer>\n * ```\n *\n * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:\n * ```html\n *   <header>\n *     Header A\n *   </header>\n *   <div class=\"body\">\n *     Body A\n *   </div>\n *   <footer>\n *     Footer A\n *   </footer>\n *   <header>\n *     Header B\n *   </header>\n *   <div class=\"body\">\n *     Body B\n *   </div>\n *   <footer>\n *     Footer B\n *   </footer>\n * ```\n *\n * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such\n * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).\n *\n * @animations\n * **.enter** - when a new item is added to the list or when an item is revealed after a filter\n *\n * **.leave** - when an item is removed from the list or when an item is filtered out\n *\n * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered\n *\n * @element ANY\n * @scope\n * @priority 1000\n * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These\n *   formats are currently supported:\n *\n *   * `variable in expression` – where variable is the user defined loop variable and `expression`\n *     is a scope expression giving the collection to enumerate.\n *\n *     For example: `album in artist.albums`.\n *\n *   * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,\n *     and `expression` is the scope expression giving the collection to enumerate.\n *\n *     For example: `(name, age) in {'adam':10, 'amalie':12}`.\n *\n *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking function\n *     which can be used to associate the objects in the collection with the DOM elements. If no tracking function\n *     is specified the ng-repeat associates elements by identity in the collection. It is an error to have\n *     more than one tracking function to resolve to the same key. (This would mean that two distinct objects are\n *     mapped to the same DOM element, which is not possible.)  Filters should be applied to the expression,\n *     before specifying a tracking expression.\n *\n *     For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements\n *     will be associated by item identity in the array.\n *\n *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique\n *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements\n *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM\n *     element in the same way in the DOM.\n *\n *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this\n *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`\n *     property is same.\n *\n *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter\n *     to items in conjunction with a tracking expression.\n *\n * @example\n * This example initializes the scope to a list of names and\n * then uses `ngRepeat` to display every person:\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-init=\"friends = [\n        {name:'John', age:25, gender:'boy'},\n        {name:'Jessie', age:30, gender:'girl'},\n        {name:'Johanna', age:28, gender:'girl'},\n        {name:'Joy', age:15, gender:'girl'},\n        {name:'Mary', age:28, gender:'girl'},\n        {name:'Peter', age:95, gender:'boy'},\n        {name:'Sebastian', age:50, gender:'boy'},\n        {name:'Erika', age:27, gender:'girl'},\n        {name:'Patrick', age:40, gender:'boy'},\n        {name:'Samantha', age:60, gender:'girl'}\n      ]\">\n        I have {{friends.length}} friends. They are:\n        <input type=\"search\" ng-model=\"q\" placeholder=\"filter friends...\" />\n        <ul class=\"example-animate-container\">\n          <li class=\"animate-repeat\" ng-repeat=\"friend in friends | filter:q\">\n            [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.\n          </li>\n        </ul>\n      </div>\n    </file>\n    <file name=\"animations.css\">\n      .example-animate-container {\n        background:white;\n        border:1px solid black;\n        list-style:none;\n        margin:0;\n        padding:0 10px;\n      }\n\n      .animate-repeat {\n        line-height:40px;\n        list-style:none;\n        box-sizing:border-box;\n      }\n\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter,\n      .animate-repeat.ng-leave {\n        -webkit-transition:all linear 0.5s;\n        transition:all linear 0.5s;\n      }\n\n      .animate-repeat.ng-leave.ng-leave-active,\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter {\n        opacity:0;\n        max-height:0;\n      }\n\n      .animate-repeat.ng-leave,\n      .animate-repeat.ng-move.ng-move-active,\n      .animate-repeat.ng-enter.ng-enter-active {\n        opacity:1;\n        max-height:40px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var friends = element.all(by.repeater('friend in friends'));\n\n      it('should render initial data set', function() {\n        expect(friends.count()).toBe(10);\n        expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');\n        expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');\n        expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');\n        expect(element(by.binding('friends.length')).getText())\n            .toMatch(\"I have 10 friends. They are:\");\n      });\n\n       it('should update repeater when filter predicate changes', function() {\n         expect(friends.count()).toBe(10);\n\n         element(by.model('q')).sendKeys('ma');\n\n         expect(friends.count()).toBe(2);\n         expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');\n         expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');\n       });\n      </file>\n    </example>\n */\nvar ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {\n  var NG_REMOVED = '$$NG_REMOVED';\n  var ngRepeatMinErr = minErr('ngRepeat');\n  return {\n    transclude: 'element',\n    priority: 1000,\n    terminal: true,\n    $$tlb: true,\n    link: function($scope, $element, $attr, ctrl, $transclude){\n        var expression = $attr.ngRepeat;\n        var match = expression.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/),\n          trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn,\n          lhs, rhs, valueIdentifier, keyIdentifier,\n          hashFnLocals = {$id: hashKey};\n\n        if (!match) {\n          throw ngRepeatMinErr('iexp', \"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.\",\n            expression);\n        }\n\n        lhs = match[1];\n        rhs = match[2];\n        trackByExp = match[3];\n\n        if (trackByExp) {\n          trackByExpGetter = $parse(trackByExp);\n          trackByIdExpFn = function(key, value, index) {\n            // assign key, value, and $index to the locals so that they can be used in hash functions\n            if (keyIdentifier) hashFnLocals[keyIdentifier] = key;\n            hashFnLocals[valueIdentifier] = value;\n            hashFnLocals.$index = index;\n            return trackByExpGetter($scope, hashFnLocals);\n          };\n        } else {\n          trackByIdArrayFn = function(key, value) {\n            return hashKey(value);\n          };\n          trackByIdObjFn = function(key) {\n            return key;\n          };\n        }\n\n        match = lhs.match(/^(?:([\\$\\w]+)|\\(([\\$\\w]+)\\s*,\\s*([\\$\\w]+)\\))$/);\n        if (!match) {\n          throw ngRepeatMinErr('iidexp', \"'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.\",\n                                                                    lhs);\n        }\n        valueIdentifier = match[3] || match[1];\n        keyIdentifier = match[2];\n\n        // Store a list of elements from previous run. This is a hash where key is the item from the\n        // iterator, and the value is objects with following properties.\n        //   - scope: bound scope\n        //   - element: previous element.\n        //   - index: position\n        var lastBlockMap = {};\n\n        //watch props\n        $scope.$watchCollection(rhs, function ngRepeatAction(collection){\n          var index, length,\n              previousNode = $element[0],     // current position of the node\n              nextNode,\n              // Same as lastBlockMap but it has the current state. It will become the\n              // lastBlockMap on the next iteration.\n              nextBlockMap = {},\n              arrayLength,\n              childScope,\n              key, value, // key/value of iteration\n              trackById,\n              trackByIdFn,\n              collectionKeys,\n              block,       // last object information {scope, element, id}\n              nextBlockOrder = [],\n              elementsToRemove;\n\n\n          if (isArrayLike(collection)) {\n            collectionKeys = collection;\n            trackByIdFn = trackByIdExpFn || trackByIdArrayFn;\n          } else {\n            trackByIdFn = trackByIdExpFn || trackByIdObjFn;\n            // if object, extract keys, sort them and use to determine order of iteration over obj props\n            collectionKeys = [];\n            for (key in collection) {\n              if (collection.hasOwnProperty(key) && key.charAt(0) != '$') {\n                collectionKeys.push(key);\n              }\n            }\n            collectionKeys.sort();\n          }\n\n          arrayLength = collectionKeys.length;\n\n          // locate existing items\n          length = nextBlockOrder.length = collectionKeys.length;\n          for(index = 0; index < length; index++) {\n           key = (collection === collectionKeys) ? index : collectionKeys[index];\n           value = collection[key];\n           trackById = trackByIdFn(key, value, index);\n           assertNotHasOwnProperty(trackById, '`track by` id');\n           if(lastBlockMap.hasOwnProperty(trackById)) {\n             block = lastBlockMap[trackById];\n             delete lastBlockMap[trackById];\n             nextBlockMap[trackById] = block;\n             nextBlockOrder[index] = block;\n           } else if (nextBlockMap.hasOwnProperty(trackById)) {\n             // restore lastBlockMap\n             forEach(nextBlockOrder, function(block) {\n               if (block && block.scope) lastBlockMap[block.id] = block;\n             });\n             // This is a duplicate and we need to throw an error\n             throw ngRepeatMinErr('dupes',\n                  \"Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}\",\n                  expression, trackById, toJson(value));\n           } else {\n             // new never before seen block\n             nextBlockOrder[index] = { id: trackById };\n             nextBlockMap[trackById] = false;\n           }\n         }\n\n          // remove existing items\n          for (key in lastBlockMap) {\n            // lastBlockMap is our own object so we don't need to use special hasOwnPropertyFn\n            if (lastBlockMap.hasOwnProperty(key)) {\n              block = lastBlockMap[key];\n              elementsToRemove = getBlockElements(block.clone);\n              $animate.leave(elementsToRemove);\n              forEach(elementsToRemove, function(element) { element[NG_REMOVED] = true; });\n              block.scope.$destroy();\n            }\n          }\n\n          // we are not using forEach for perf reasons (trying to avoid #call)\n          for (index = 0, length = collectionKeys.length; index < length; index++) {\n            key = (collection === collectionKeys) ? index : collectionKeys[index];\n            value = collection[key];\n            block = nextBlockOrder[index];\n            if (nextBlockOrder[index - 1]) previousNode = getBlockEnd(nextBlockOrder[index - 1]);\n\n            if (block.scope) {\n              // if we have already seen this object, then we need to reuse the\n              // associated scope/element\n              childScope = block.scope;\n\n              nextNode = previousNode;\n              do {\n                nextNode = nextNode.nextSibling;\n              } while(nextNode && nextNode[NG_REMOVED]);\n\n              if (getBlockStart(block) != nextNode) {\n                // existing item which got moved\n                $animate.move(getBlockElements(block.clone), null, jqLite(previousNode));\n              }\n              previousNode = getBlockEnd(block);\n            } else {\n              // new item which we don't know about\n              childScope = $scope.$new();\n            }\n\n            childScope[valueIdentifier] = value;\n            if (keyIdentifier) childScope[keyIdentifier] = key;\n            childScope.$index = index;\n            childScope.$first = (index === 0);\n            childScope.$last = (index === (arrayLength - 1));\n            childScope.$middle = !(childScope.$first || childScope.$last);\n            // jshint bitwise: false\n            childScope.$odd = !(childScope.$even = (index&1) === 0);\n            // jshint bitwise: true\n\n            if (!block.scope) {\n              $transclude(childScope, function(clone) {\n                clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' ');\n                $animate.enter(clone, null, jqLite(previousNode));\n                previousNode = clone;\n                block.scope = childScope;\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block.clone = clone;\n                nextBlockMap[block.id] = block;\n              });\n            }\n          }\n          lastBlockMap = nextBlockMap;\n        });\n    }\n  };\n\n  function getBlockStart(block) {\n    return block.clone[0];\n  }\n\n  function getBlockEnd(block) {\n    return block.clone[block.clone.length - 1];\n  }\n}];\n\n/**\n * @ngdoc directive\n * @name ngShow\n *\n * @description\n * The `ngShow` directive shows or hides the given HTML element based on the expression\n * provided to the ngShow attribute. The element is shown or hidden by removing or adding\n * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is visible) -->\n * <div ng-show=\"myValue\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is hidden) -->\n * <div ng-show=\"myValue\" class=\"ng-hide\"></div>\n * ```\n *\n * When the ngShow expression evaluates to false then the ng-hide CSS class is added to the class attribute\n * on the element causing it to become hidden. When true, the ng-hide CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Here is a list of values that ngShow will consider as a falsy value (case insensitive):<br />\n * \"f\" / \"0\" / \"false\" / \"no\" / \"n\" / \"[]\"\n * </div>\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding .ng-hide\n *\n * By default, the `.ng-hide` class will style the element with `display:none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class in CSS:\n *\n * ```css\n * .ng-hide {\n *   //this is just another form of hiding an element\n *   display:block!important;\n *   position:absolute;\n *   top:-9999px;\n *   left:-9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with ngShow\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass except that\n * you must also include the !important flag to override the display property\n * so that you can perform an animation when the element is hidden during the time of the animation.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   transition:0.5s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.2.17 (and 1.3.0-beta.11), there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * addClass: .ng-hide - happens after the ngShow expression evaluates to a truthy value and the just before contents are set to visible\n * removeClass: .ng-hide - happens after the ngShow expression evaluates to a non truthy value and just before the contents are set to hidden\n *\n * @element ANY\n * @param {expression} ngShow If the {@link guide/expression expression} is truthy\n *     then the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-show\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-show\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-show {\n        -webkit-transition:all linear 0.5s;\n        transition:all linear 0.5s;\n        line-height:20px;\n        opacity:1;\n        padding:10px;\n        border:1px solid black;\n        background:white;\n      }\n\n      .animate-show.ng-hide {\n        line-height:0;\n        opacity:0;\n        padding:0 10px;\n      }\n\n      .check-element {\n        padding:10px;\n        border:1px solid black;\n        background:white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngShowDirective = ['$animate', function($animate) {\n  return function(scope, element, attr) {\n    scope.$watch(attr.ngShow, function ngShowWatchAction(value){\n      $animate[toBoolean(value) ? 'removeClass' : 'addClass'](element, 'ng-hide');\n    });\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngHide\n *\n * @description\n * The `ngHide` directive shows or hides the given HTML element based on the expression\n * provided to the ngHide attribute. The element is shown or hidden by removing or adding\n * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is hidden) -->\n * <div ng-hide=\"myValue\" class=\"ng-hide\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is visible) -->\n * <div ng-hide=\"myValue\"></div>\n * ```\n *\n * When the ngHide expression evaluates to true then the .ng-hide CSS class is added to the class attribute\n * on the element causing it to become hidden. When false, the ng-hide CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Here is a list of values that ngHide will consider as a falsy value (case insensitive):<br />\n * \"f\" / \"0\" / \"false\" / \"no\" / \"n\" / \"[]\"\n * </div>\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding .ng-hide\n *\n * By default, the `.ng-hide` class will style the element with `display:none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class in CSS:\n *\n * ```css\n * .ng-hide {\n *   //this is just another form of hiding an element\n *   display:block!important;\n *   position:absolute;\n *   top:-9999px;\n *   left:-9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with ngHide\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`\n * CSS class is added and removed for you instead of your own CSS class.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   transition:0.5s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.2.17 (and 1.3.0-beta.11), there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * removeClass: .ng-hide - happens after the ngHide expression evaluates to a truthy value and just before the contents are set to hidden\n * addClass: .ng-hide - happens after the ngHide expression evaluates to a non truthy value and just before the contents are set to visible\n *\n * @element ANY\n * @param {expression} ngHide If the {@link guide/expression expression} is truthy then\n *     the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-hide\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-hide\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-hide {\n        -webkit-transition:all linear 0.5s;\n        transition:all linear 0.5s;\n        line-height:20px;\n        opacity:1;\n        padding:10px;\n        border:1px solid black;\n        background:white;\n      }\n\n      .animate-hide.ng-hide {\n        line-height:0;\n        opacity:0;\n        padding:0 10px;\n      }\n\n      .check-element {\n        padding:10px;\n        border:1px solid black;\n        background:white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngHideDirective = ['$animate', function($animate) {\n  return function(scope, element, attr) {\n    scope.$watch(attr.ngHide, function ngHideWatchAction(value){\n      $animate[toBoolean(value) ? 'addClass' : 'removeClass'](element, 'ng-hide');\n    });\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngStyle\n * @restrict AC\n *\n * @description\n * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.\n *\n * @element ANY\n * @param {expression} ngStyle\n *\n * {@link guide/expression Expression} which evals to an\n * object whose keys are CSS style names and values are corresponding values for those CSS\n * keys.\n *\n * Since some CSS style names are not valid keys for an object, they must be quoted.\n * See the 'background-color' style in the example below.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <input type=\"button\" value=\"set color\" ng-click=\"myStyle={color:'red'}\">\n        <input type=\"button\" value=\"set background\" ng-click=\"myStyle={'background-color':'blue'}\">\n        <input type=\"button\" value=\"clear\" ng-click=\"myStyle={}\">\n        <br/>\n        <span ng-style=\"myStyle\">Sample Text</span>\n        <pre>myStyle={{myStyle}}</pre>\n     </file>\n     <file name=\"style.css\">\n       span {\n         color: black;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var colorSpan = element(by.css('span'));\n\n       it('should check ng-style', function() {\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n         element(by.css('input[value=\\'set color\\']')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');\n         element(by.css('input[value=clear]')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n       });\n     </file>\n   </example>\n */\nvar ngStyleDirective = ngDirective(function(scope, element, attr) {\n  scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {\n    if (oldStyles && (newStyles !== oldStyles)) {\n      forEach(oldStyles, function(val, style) { element.css(style, '');});\n    }\n    if (newStyles) element.css(newStyles);\n  }, true);\n});\n\n/**\n * @ngdoc directive\n * @name ngSwitch\n * @restrict EA\n *\n * @description\n * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.\n * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location\n * as specified in the template.\n *\n * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it\n * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element\n * matches the value obtained from the evaluated expression. In other words, you define a container element\n * (where you place the directive), place an expression on the **`on=\"...\"` attribute**\n * (or the **`ng-switch=\"...\"` attribute**), define any inner elements inside of the directive and place\n * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on\n * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default\n * attribute is displayed.\n *\n * <div class=\"alert alert-info\">\n * Be aware that the attribute values to match against cannot be expressions. They are interpreted\n * as literal string values to match against.\n * For example, **`ng-switch-when=\"someVal\"`** will match against the string `\"someVal\"` not against the\n * value of the expression `$scope.someVal`.\n * </div>\n\n * @animations\n * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container\n * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM\n *\n * @usage\n *\n * ```\n * <ANY ng-switch=\"expression\">\n *   <ANY ng-switch-when=\"matchValue1\">...</ANY>\n *   <ANY ng-switch-when=\"matchValue2\">...</ANY>\n *   <ANY ng-switch-default>...</ANY>\n * </ANY>\n * ```\n *\n *\n * @scope\n * @priority 800\n * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.\n * On child elements add:\n *\n * * `ngSwitchWhen`: the case statement to match against. If match then this\n *   case will be displayed. If the same match appears multiple times, all the\n *   elements will be displayed.\n * * `ngSwitchDefault`: the default case when no other case match. If there\n *   are multiple default cases, all of them will be displayed when no other\n *   case match.\n *\n *\n * @example\n  <example module=\"switchExample\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <select ng-model=\"selection\" ng-options=\"item for item in items\">\n        </select>\n        <tt>selection={{selection}}</tt>\n        <hr/>\n        <div class=\"animate-switch-container\"\n          ng-switch on=\"selection\">\n            <div class=\"animate-switch\" ng-switch-when=\"settings\">Settings Div</div>\n            <div class=\"animate-switch\" ng-switch-when=\"home\">Home Span</div>\n            <div class=\"animate-switch\" ng-switch-default>default</div>\n        </div>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('switchExample', ['ngAnimate'])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.items = ['settings', 'home', 'other'];\n          $scope.selection = $scope.items[0];\n        }]);\n    </file>\n    <file name=\"animations.css\">\n      .animate-switch-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .animate-switch {\n        padding:10px;\n      }\n\n      .animate-switch.ng-animate {\n        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n      }\n\n      .animate-switch.ng-leave.ng-leave-active,\n      .animate-switch.ng-enter {\n        top:-50px;\n      }\n      .animate-switch.ng-leave,\n      .animate-switch.ng-enter.ng-enter-active {\n        top:0;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var switchElem = element(by.css('[ng-switch]'));\n      var select = element(by.model('selection'));\n\n      it('should start in settings', function() {\n        expect(switchElem.getText()).toMatch(/Settings Div/);\n      });\n      it('should change to home', function() {\n        select.all(by.css('option')).get(1).click();\n        expect(switchElem.getText()).toMatch(/Home Span/);\n      });\n      it('should select default', function() {\n        select.all(by.css('option')).get(2).click();\n        expect(switchElem.getText()).toMatch(/default/);\n      });\n    </file>\n  </example>\n */\nvar ngSwitchDirective = ['$animate', function($animate) {\n  return {\n    restrict: 'EA',\n    require: 'ngSwitch',\n\n    // asks for $scope to fool the BC controller module\n    controller: ['$scope', function ngSwitchController() {\n     this.cases = {};\n    }],\n    link: function(scope, element, attr, ngSwitchController) {\n      var watchExpr = attr.ngSwitch || attr.on,\n          selectedTranscludes = [],\n          selectedElements = [],\n          previousElements = [],\n          selectedScopes = [];\n\n      scope.$watch(watchExpr, function ngSwitchWatchAction(value) {\n        var i, ii;\n        for (i = 0, ii = previousElements.length; i < ii; ++i) {\n          previousElements[i].remove();\n        }\n        previousElements.length = 0;\n\n        for (i = 0, ii = selectedScopes.length; i < ii; ++i) {\n          var selected = selectedElements[i];\n          selectedScopes[i].$destroy();\n          previousElements[i] = selected;\n          $animate.leave(selected, function() {\n            previousElements.splice(i, 1);\n          });\n        }\n\n        selectedElements.length = 0;\n        selectedScopes.length = 0;\n\n        if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {\n          scope.$eval(attr.change);\n          forEach(selectedTranscludes, function(selectedTransclude) {\n            var selectedScope = scope.$new();\n            selectedScopes.push(selectedScope);\n            selectedTransclude.transclude(selectedScope, function(caseElement) {\n              var anchor = selectedTransclude.element;\n\n              selectedElements.push(caseElement);\n              $animate.enter(caseElement, anchor.parent(), anchor);\n            });\n          });\n        }\n      });\n    }\n  };\n}];\n\nvar ngSwitchWhenDirective = ngDirective({\n  transclude: 'element',\n  priority: 800,\n  require: '^ngSwitch',\n  link: function(scope, element, attrs, ctrl, $transclude) {\n    ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);\n    ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });\n  }\n});\n\nvar ngSwitchDefaultDirective = ngDirective({\n  transclude: 'element',\n  priority: 800,\n  require: '^ngSwitch',\n  link: function(scope, element, attr, ctrl, $transclude) {\n    ctrl.cases['?'] = (ctrl.cases['?'] || []);\n    ctrl.cases['?'].push({ transclude: $transclude, element: element });\n   }\n});\n\n/**\n * @ngdoc directive\n * @name ngTransclude\n * @restrict AC\n *\n * @description\n * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.\n *\n * Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted.\n *\n * @element ANY\n *\n * @example\n   <example module=\"transcludeExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('transcludeExample', [])\n          .directive('pane', function(){\n             return {\n               restrict: 'E',\n               transclude: true,\n               scope: { title:'@' },\n               template: '<div style=\"border: 1px solid black;\">' +\n                           '<div style=\"background-color: gray\">{{title}}</div>' +\n                           '<div ng-transclude></div>' +\n                         '</div>'\n             };\n         })\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.title = 'Lorem Ipsum';\n           $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n         }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input ng-model=\"title\"><br>\n         <textarea ng-model=\"text\"></textarea> <br/>\n         <pane title=\"{{title}}\">{{text}}</pane>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n        it('should have transcluded', function() {\n          var titleElement = element(by.model('title'));\n          titleElement.clear();\n          titleElement.sendKeys('TITLE');\n          var textElement = element(by.model('text'));\n          textElement.clear();\n          textElement.sendKeys('TEXT');\n          expect(element(by.binding('title')).getText()).toEqual('TITLE');\n          expect(element(by.binding('text')).getText()).toEqual('TEXT');\n        });\n     </file>\n   </example>\n *\n */\nvar ngTranscludeDirective = ngDirective({\n  link: function($scope, $element, $attrs, controller, $transclude) {\n    if (!$transclude) {\n      throw minErr('ngTransclude')('orphan',\n       'Illegal use of ngTransclude directive in the template! ' +\n       'No parent directive that requires a transclusion found. ' +\n       'Element: {0}',\n       startingTag($element));\n    }\n\n    $transclude(function(clone) {\n      $element.empty();\n      $element.append(clone);\n    });\n  }\n});\n\n/**\n * @ngdoc directive\n * @name script\n * @restrict E\n *\n * @description\n * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the\n * template can be used by {@link ng.directive:ngInclude `ngInclude`},\n * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the\n * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be\n * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.\n *\n * @param {string} type Must be set to `'text/ng-template'`.\n * @param {string} id Cache name of the template.\n *\n * @example\n  <example>\n    <file name=\"index.html\">\n      <script type=\"text/ng-template\" id=\"/tpl.html\">\n        Content of the template.\n      </script>\n\n      <a ng-click=\"currentTpl='/tpl.html'\" id=\"tpl-link\">Load inlined template</a>\n      <div id=\"tpl-content\" ng-include src=\"currentTpl\"></div>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      it('should load template defined inside script tag', function() {\n        element(by.css('#tpl-link')).click();\n        expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);\n      });\n    </file>\n  </example>\n */\nvar scriptDirective = ['$templateCache', function($templateCache) {\n  return {\n    restrict: 'E',\n    terminal: true,\n    compile: function(element, attr) {\n      if (attr.type == 'text/ng-template') {\n        var templateUrl = attr.id,\n            // IE is not consistent, in scripts we have to read .text but in other nodes we have to read .textContent\n            text = element[0].text;\n\n        $templateCache.put(templateUrl, text);\n      }\n    }\n  };\n}];\n\nvar ngOptionsMinErr = minErr('ngOptions');\n/**\n * @ngdoc directive\n * @name select\n * @restrict E\n *\n * @description\n * HTML `SELECT` element with angular data-binding.\n *\n * # `ngOptions`\n *\n * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`\n * elements for the `<select>` element using the array or object obtained by evaluating the\n * `ngOptions` comprehension_expression.\n *\n * When an item in the `<select>` menu is selected, the array element or object property\n * represented by the selected option will be bound to the model identified by the `ngModel`\n * directive.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `ngModel` compares by reference, not value. This is important when binding to an\n * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/).\n * </div>\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `ngOptions` provides an iterator facility for the `<option>` element which should be used instead\n * of {@link ng.directive:ngRepeat ngRepeat} when you want the\n * `select` model to be bound to a non-string value. This is because an option element can only\n * be bound to string values at present.\n * </div>\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required The control is considered valid only if value is entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {comprehension_expression=} ngOptions in one of the following forms:\n *\n *   * for array data sources:\n *     * `label` **`for`** `value` **`in`** `array`\n *     * `select` **`as`** `label` **`for`** `value` **`in`** `array`\n *     * `label`  **`group by`** `group` **`for`** `value` **`in`** `array`\n *     * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n *   * for object data sources:\n *     * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`group by`** `group`\n *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *\n * Where:\n *\n *   * `array` / `object`: an expression which evaluates to an array / object to iterate over.\n *   * `value`: local variable which will refer to each item in the `array` or each property value\n *      of `object` during iteration.\n *   * `key`: local variable which will refer to a property name in `object` during iteration.\n *   * `label`: The result of this expression will be the label for `<option>` element. The\n *     `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).\n *   * `select`: The result of this expression will be bound to the model of the parent `<select>`\n *      element. If not specified, `select` expression will default to `value`.\n *   * `group`: The result of this expression will be used to group options using the `<optgroup>`\n *      DOM element.\n *   * `trackexpr`: Used when working with an array of objects. The result of this expression will be\n *      used to identify the objects in the array. The `trackexpr` will most likely refer to the\n *     `value` variable (e.g. `value.propertyName`).\n *\n * @example\n    <example module=\"selectExample\">\n      <file name=\"index.html\">\n        <script>\n        angular.module('selectExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.colors = [\n              {name:'black', shade:'dark'},\n              {name:'white', shade:'light'},\n              {name:'red', shade:'dark'},\n              {name:'blue', shade:'dark'},\n              {name:'yellow', shade:'light'}\n            ];\n            $scope.myColor = $scope.colors[2]; // red\n          }]);\n        </script>\n        <div ng-controller=\"ExampleController\">\n          <ul>\n            <li ng-repeat=\"color in colors\">\n              Name: <input ng-model=\"color.name\">\n              [<a href ng-click=\"colors.splice($index, 1)\">X</a>]\n            </li>\n            <li>\n              [<a href ng-click=\"colors.push({})\">add</a>]\n            </li>\n          </ul>\n          <hr/>\n          Color (null not allowed):\n          <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\"></select><br>\n\n          Color (null allowed):\n          <span  class=\"nullable\">\n            <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\">\n              <option value=\"\">-- choose color --</option>\n            </select>\n          </span><br/>\n\n          Color grouped by shade:\n          <select ng-model=\"myColor\" ng-options=\"color.name group by color.shade for color in colors\">\n          </select><br/>\n\n\n          Select <a href ng-click=\"myColor = { name:'not in list', shade: 'other' }\">bogus</a>.<br>\n          <hr/>\n          Currently selected: {{ {selected_color:myColor}  }}\n          <div style=\"border:solid 1px black; height:20px\"\n               ng-style=\"{'background-color':myColor.name}\">\n          </div>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n         it('should check ng-options', function() {\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');\n           element.all(by.model('myColor')).first().click();\n           element.all(by.css('select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');\n           element(by.css('.nullable select[ng-model=\"myColor\"]')).click();\n           element.all(by.css('.nullable select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');\n         });\n      </file>\n    </example>\n */\n\nvar ngOptionsDirective = valueFn({ terminal: true });\n// jshint maxlen: false\nvar selectDirective = ['$compile', '$parse', function($compile,   $parse) {\n                         //000011111111110000000000022222222220000000000000000000003333333333000000000000004444444444444440000000005555555555555550000000666666666666666000000000000000777777777700000000000000000008888888888\n  var NG_OPTIONS_REGEXP = /^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+group\\s+by\\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]+?))?$/,\n      nullModelCtrl = {$setViewValue: noop};\n// jshint maxlen: 100\n\n  return {\n    restrict: 'E',\n    require: ['select', '?ngModel'],\n    controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {\n      var self = this,\n          optionsMap = {},\n          ngModelCtrl = nullModelCtrl,\n          nullOption,\n          unknownOption;\n\n\n      self.databound = $attrs.ngModel;\n\n\n      self.init = function(ngModelCtrl_, nullOption_, unknownOption_) {\n        ngModelCtrl = ngModelCtrl_;\n        nullOption = nullOption_;\n        unknownOption = unknownOption_;\n      };\n\n\n      self.addOption = function(value) {\n        assertNotHasOwnProperty(value, '\"option value\"');\n        optionsMap[value] = true;\n\n        if (ngModelCtrl.$viewValue == value) {\n          $element.val(value);\n          if (unknownOption.parent()) unknownOption.remove();\n        }\n      };\n\n\n      self.removeOption = function(value) {\n        if (this.hasOption(value)) {\n          delete optionsMap[value];\n          if (ngModelCtrl.$viewValue == value) {\n            this.renderUnknownOption(value);\n          }\n        }\n      };\n\n\n      self.renderUnknownOption = function(val) {\n        var unknownVal = '? ' + hashKey(val) + ' ?';\n        unknownOption.val(unknownVal);\n        $element.prepend(unknownOption);\n        $element.val(unknownVal);\n        unknownOption.prop('selected', true); // needed for IE\n      };\n\n\n      self.hasOption = function(value) {\n        return optionsMap.hasOwnProperty(value);\n      };\n\n      $scope.$on('$destroy', function() {\n        // disable unknown option so that we don't do work when the whole select is being destroyed\n        self.renderUnknownOption = noop;\n      });\n    }],\n\n    link: function(scope, element, attr, ctrls) {\n      // if ngModel is not defined, we don't need to do anything\n      if (!ctrls[1]) return;\n\n      var selectCtrl = ctrls[0],\n          ngModelCtrl = ctrls[1],\n          multiple = attr.multiple,\n          optionsExp = attr.ngOptions,\n          nullOption = false, // if false, user will not be able to select it (used by ngOptions)\n          emptyOption,\n          // we can't just jqLite('<option>') since jqLite is not smart enough\n          // to create it in <select> and IE barfs otherwise.\n          optionTemplate = jqLite(document.createElement('option')),\n          optGroupTemplate =jqLite(document.createElement('optgroup')),\n          unknownOption = optionTemplate.clone();\n\n      // find \"null\" option\n      for(var i = 0, children = element.children(), ii = children.length; i < ii; i++) {\n        if (children[i].value === '') {\n          emptyOption = nullOption = children.eq(i);\n          break;\n        }\n      }\n\n      selectCtrl.init(ngModelCtrl, nullOption, unknownOption);\n\n      // required validator\n      if (multiple) {\n        ngModelCtrl.$isEmpty = function(value) {\n          return !value || value.length === 0;\n        };\n      }\n\n      if (optionsExp) setupAsOptions(scope, element, ngModelCtrl);\n      else if (multiple) setupAsMultiple(scope, element, ngModelCtrl);\n      else setupAsSingle(scope, element, ngModelCtrl, selectCtrl);\n\n\n      ////////////////////////////\n\n\n\n      function setupAsSingle(scope, selectElement, ngModelCtrl, selectCtrl) {\n        ngModelCtrl.$render = function() {\n          var viewValue = ngModelCtrl.$viewValue;\n\n          if (selectCtrl.hasOption(viewValue)) {\n            if (unknownOption.parent()) unknownOption.remove();\n            selectElement.val(viewValue);\n            if (viewValue === '') emptyOption.prop('selected', true); // to make IE9 happy\n          } else {\n            if (isUndefined(viewValue) && emptyOption) {\n              selectElement.val('');\n            } else {\n              selectCtrl.renderUnknownOption(viewValue);\n            }\n          }\n        };\n\n        selectElement.on('change', function() {\n          scope.$apply(function() {\n            if (unknownOption.parent()) unknownOption.remove();\n            ngModelCtrl.$setViewValue(selectElement.val());\n          });\n        });\n      }\n\n      function setupAsMultiple(scope, selectElement, ctrl) {\n        var lastView;\n        ctrl.$render = function() {\n          var items = new HashMap(ctrl.$viewValue);\n          forEach(selectElement.find('option'), function(option) {\n            option.selected = isDefined(items.get(option.value));\n          });\n        };\n\n        // we have to do it on each watch since ngModel watches reference, but\n        // we need to work of an array, so we need to see if anything was inserted/removed\n        scope.$watch(function selectMultipleWatch() {\n          if (!equals(lastView, ctrl.$viewValue)) {\n            lastView = shallowCopy(ctrl.$viewValue);\n            ctrl.$render();\n          }\n        });\n\n        selectElement.on('change', function() {\n          scope.$apply(function() {\n            var array = [];\n            forEach(selectElement.find('option'), function(option) {\n              if (option.selected) {\n                array.push(option.value);\n              }\n            });\n            ctrl.$setViewValue(array);\n          });\n        });\n      }\n\n      function setupAsOptions(scope, selectElement, ctrl) {\n        var match;\n\n        if (!(match = optionsExp.match(NG_OPTIONS_REGEXP))) {\n          throw ngOptionsMinErr('iexp',\n            \"Expected expression in form of \" +\n            \"'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'\" +\n            \" but got '{0}'. Element: {1}\",\n            optionsExp, startingTag(selectElement));\n        }\n\n        var displayFn = $parse(match[2] || match[1]),\n            valueName = match[4] || match[6],\n            keyName = match[5],\n            groupByFn = $parse(match[3] || ''),\n            valueFn = $parse(match[2] ? match[1] : valueName),\n            valuesFn = $parse(match[7]),\n            track = match[8],\n            trackFn = track ? $parse(match[8]) : null,\n            // This is an array of array of existing option groups in DOM.\n            // We try to reuse these if possible\n            // - optionGroupsCache[0] is the options with no option group\n            // - optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element\n            optionGroupsCache = [[{element: selectElement, label:''}]];\n\n        if (nullOption) {\n          // compile the element since there might be bindings in it\n          $compile(nullOption)(scope);\n\n          // remove the class, which is added automatically because we recompile the element and it\n          // becomes the compilation root\n          nullOption.removeClass('ng-scope');\n\n          // we need to remove it before calling selectElement.empty() because otherwise IE will\n          // remove the label from the element. wtf?\n          nullOption.remove();\n        }\n\n        // clear contents, we'll add what's needed based on the model\n        selectElement.empty();\n\n        selectElement.on('change', function() {\n          scope.$apply(function() {\n            var optionGroup,\n                collection = valuesFn(scope) || [],\n                locals = {},\n                key, value, optionElement, index, groupIndex, length, groupLength, trackIndex;\n\n            if (multiple) {\n              value = [];\n              for (groupIndex = 0, groupLength = optionGroupsCache.length;\n                   groupIndex < groupLength;\n                   groupIndex++) {\n                // list of options for that group. (first item has the parent)\n                optionGroup = optionGroupsCache[groupIndex];\n\n                for(index = 1, length = optionGroup.length; index < length; index++) {\n                  if ((optionElement = optionGroup[index].element)[0].selected) {\n                    key = optionElement.val();\n                    if (keyName) locals[keyName] = key;\n                    if (trackFn) {\n                      for (trackIndex = 0; trackIndex < collection.length; trackIndex++) {\n                        locals[valueName] = collection[trackIndex];\n                        if (trackFn(scope, locals) == key) break;\n                      }\n                    } else {\n                      locals[valueName] = collection[key];\n                    }\n                    value.push(valueFn(scope, locals));\n                  }\n                }\n              }\n            } else {\n              key = selectElement.val();\n              if (key == '?') {\n                value = undefined;\n              } else if (key === ''){\n                value = null;\n              } else {\n                if (trackFn) {\n                  for (trackIndex = 0; trackIndex < collection.length; trackIndex++) {\n                    locals[valueName] = collection[trackIndex];\n                    if (trackFn(scope, locals) == key) {\n                      value = valueFn(scope, locals);\n                      break;\n                    }\n                  }\n                } else {\n                  locals[valueName] = collection[key];\n                  if (keyName) locals[keyName] = key;\n                  value = valueFn(scope, locals);\n                }\n              }\n            }\n            ctrl.$setViewValue(value);\n            render();\n          });\n        });\n\n        ctrl.$render = render;\n\n        scope.$watchCollection(valuesFn, render);\n        if ( multiple ) {\n          scope.$watchCollection(function() { return ctrl.$modelValue; }, render);\n        }\n\n        function getSelectedSet() {\n          var selectedSet = false;\n          if (multiple) {\n            var modelValue = ctrl.$modelValue;\n            if (trackFn && isArray(modelValue)) {\n              selectedSet = new HashMap([]);\n              var locals = {};\n              for (var trackIndex = 0; trackIndex < modelValue.length; trackIndex++) {\n                locals[valueName] = modelValue[trackIndex];\n                selectedSet.put(trackFn(scope, locals), modelValue[trackIndex]);\n              }\n            } else {\n              selectedSet = new HashMap(modelValue);\n            }\n          }\n          return selectedSet;\n        }\n\n\n        function render() {\n              // Temporary location for the option groups before we render them\n          var optionGroups = {'':[]},\n              optionGroupNames = [''],\n              optionGroupName,\n              optionGroup,\n              option,\n              existingParent, existingOptions, existingOption,\n              modelValue = ctrl.$modelValue,\n              values = valuesFn(scope) || [],\n              keys = keyName ? sortedKeys(values) : values,\n              key,\n              groupLength, length,\n              groupIndex, index,\n              locals = {},\n              selected,\n              selectedSet = getSelectedSet(),\n              lastElement,\n              element,\n              label;\n\n\n          // We now build up the list of options we need (we merge later)\n          for (index = 0; length = keys.length, index < length; index++) {\n\n            key = index;\n            if (keyName) {\n              key = keys[index];\n              if ( key.charAt(0) === '$' ) continue;\n              locals[keyName] = key;\n            }\n\n            locals[valueName] = values[key];\n\n            optionGroupName = groupByFn(scope, locals) || '';\n            if (!(optionGroup = optionGroups[optionGroupName])) {\n              optionGroup = optionGroups[optionGroupName] = [];\n              optionGroupNames.push(optionGroupName);\n            }\n            if (multiple) {\n              selected = isDefined(\n                selectedSet.remove(trackFn ? trackFn(scope, locals) : valueFn(scope, locals))\n              );\n            } else {\n              if (trackFn) {\n                var modelCast = {};\n                modelCast[valueName] = modelValue;\n                selected = trackFn(scope, modelCast) === trackFn(scope, locals);\n              } else {\n                selected = modelValue === valueFn(scope, locals);\n              }\n              selectedSet = selectedSet || selected; // see if at least one item is selected\n            }\n            label = displayFn(scope, locals); // what will be seen by the user\n\n            // doing displayFn(scope, locals) || '' overwrites zero values\n            label = isDefined(label) ? label : '';\n            optionGroup.push({\n              // either the index into array or key from object\n              id: trackFn ? trackFn(scope, locals) : (keyName ? keys[index] : index),\n              label: label,\n              selected: selected                   // determine if we should be selected\n            });\n          }\n          if (!multiple) {\n            if (nullOption || modelValue === null) {\n              // insert null option if we have a placeholder, or the model is null\n              optionGroups[''].unshift({id:'', label:'', selected:!selectedSet});\n            } else if (!selectedSet) {\n              // option could not be found, we have to insert the undefined item\n              optionGroups[''].unshift({id:'?', label:'', selected:true});\n            }\n          }\n\n          // Now we need to update the list of DOM nodes to match the optionGroups we computed above\n          for (groupIndex = 0, groupLength = optionGroupNames.length;\n               groupIndex < groupLength;\n               groupIndex++) {\n            // current option group name or '' if no group\n            optionGroupName = optionGroupNames[groupIndex];\n\n            // list of options for that group. (first item has the parent)\n            optionGroup = optionGroups[optionGroupName];\n\n            if (optionGroupsCache.length <= groupIndex) {\n              // we need to grow the optionGroups\n              existingParent = {\n                element: optGroupTemplate.clone().attr('label', optionGroupName),\n                label: optionGroup.label\n              };\n              existingOptions = [existingParent];\n              optionGroupsCache.push(existingOptions);\n              selectElement.append(existingParent.element);\n            } else {\n              existingOptions = optionGroupsCache[groupIndex];\n              existingParent = existingOptions[0];  // either SELECT (no group) or OPTGROUP element\n\n              // update the OPTGROUP label if not the same.\n              if (existingParent.label != optionGroupName) {\n                existingParent.element.attr('label', existingParent.label = optionGroupName);\n              }\n            }\n\n            lastElement = null;  // start at the beginning\n            for(index = 0, length = optionGroup.length; index < length; index++) {\n              option = optionGroup[index];\n              if ((existingOption = existingOptions[index+1])) {\n                // reuse elements\n                lastElement = existingOption.element;\n                if (existingOption.label !== option.label) {\n                  lastElement.text(existingOption.label = option.label);\n                }\n                if (existingOption.id !== option.id) {\n                  lastElement.val(existingOption.id = option.id);\n                }\n                // lastElement.prop('selected') provided by jQuery has side-effects\n                if (lastElement[0].selected !== option.selected) {\n                  lastElement.prop('selected', (existingOption.selected = option.selected));\n                  if (msie) {\n                    // See #7692\n                    // The selected item wouldn't visually update on IE without this.\n                    // Tested on Win7: IE9, IE10 and IE11. Future IEs should be tested as well\n                    lastElement.prop('selected', existingOption.selected);\n                  }\n                }\n              } else {\n                // grow elements\n\n                // if it's a null option\n                if (option.id === '' && nullOption) {\n                  // put back the pre-compiled element\n                  element = nullOption;\n                } else {\n                  // jQuery(v1.4.2) Bug: We should be able to chain the method calls, but\n                  // in this version of jQuery on some browser the .text() returns a string\n                  // rather then the element.\n                  (element = optionTemplate.clone())\n                      .val(option.id)\n                      .prop('selected', option.selected)\n                      .attr('selected', option.selected)\n                      .text(option.label);\n                }\n\n                existingOptions.push(existingOption = {\n                    element: element,\n                    label: option.label,\n                    id: option.id,\n                    selected: option.selected\n                });\n                if (lastElement) {\n                  lastElement.after(element);\n                } else {\n                  existingParent.element.append(element);\n                }\n                lastElement = element;\n              }\n            }\n            // remove any excessive OPTIONs in a group\n            index++; // increment since the existingOptions[0] is parent element not OPTION\n            while(existingOptions.length > index) {\n              existingOptions.pop().element.remove();\n            }\n          }\n          // remove any excessive OPTGROUPs from select\n          while(optionGroupsCache.length > groupIndex) {\n            optionGroupsCache.pop()[0].element.remove();\n          }\n        }\n      }\n    }\n  };\n}];\n\nvar optionDirective = ['$interpolate', function($interpolate) {\n  var nullSelectCtrl = {\n    addOption: noop,\n    removeOption: noop\n  };\n\n  return {\n    restrict: 'E',\n    priority: 100,\n    compile: function(element, attr) {\n      if (isUndefined(attr.value)) {\n        var interpolateFn = $interpolate(element.text(), true);\n        if (!interpolateFn) {\n          attr.$set('value', element.text());\n        }\n      }\n\n      return function (scope, element, attr) {\n        var selectCtrlName = '$selectController',\n            parent = element.parent(),\n            selectCtrl = parent.data(selectCtrlName) ||\n              parent.parent().data(selectCtrlName); // in case we are in optgroup\n\n        if (selectCtrl && selectCtrl.databound) {\n          // For some reason Opera defaults to true and if not overridden this messes up the repeater.\n          // We don't want the view to drive the initialization of the model anyway.\n          element.prop('selected', false);\n        } else {\n          selectCtrl = nullSelectCtrl;\n        }\n\n        if (interpolateFn) {\n          scope.$watch(interpolateFn, function interpolateWatchAction(newVal, oldVal) {\n            attr.$set('value', newVal);\n            if (newVal !== oldVal) selectCtrl.removeOption(oldVal);\n            selectCtrl.addOption(newVal);\n          });\n        } else {\n          selectCtrl.addOption(attr.value);\n        }\n\n        element.on('$destroy', function() {\n          selectCtrl.removeOption(attr.value);\n        });\n      };\n    }\n  };\n}];\n\nvar styleDirective = valueFn({\n  restrict: 'E',\n  terminal: true\n});\n\n  if (window.angular.bootstrap) {\n    //AngularJS is already loaded, so we can return here...\n    console.log('WARNING: Tried to load angular more than once.');\n    return;\n  }\n\n  //try to bind to jquery now so that one can write angular.element().read()\n  //but we will rebind on bootstrap again.\n  bindJQuery();\n\n  publishExternalAPI(angular);\n\n  jqLite(document).ready(function() {\n    angularInit(document, bootstrap);\n  });\n\n})(window, document);\n\n!window.angular.$$csp() && window.angular.element(document).find('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{display:none !important;}ng\\\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}.ng-hide-add-active,.ng-hide-remove{display:block!important;}</style>');"
  },
  {
    "path": "www/lib/angular/bower.json",
    "content": "{\n  \"name\": \"angular\",\n  \"version\": \"1.2.24\",\n  \"main\": \"./angular.js\",\n  \"dependencies\": {\n  }\n}\n"
  },
  {
    "path": "www/lib/angular-animate/.bower.json",
    "content": "{\n  \"name\": \"angular-animate\",\n  \"version\": \"1.2.24\",\n  \"main\": \"./angular-animate.js\",\n  \"dependencies\": {\n    \"angular\": \"1.2.24\"\n  },\n  \"homepage\": \"https://github.com/angular/bower-angular-animate\",\n  \"_release\": \"1.2.24\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.2.24\",\n    \"commit\": \"953019049bd1f4a90888c7b92328eb307a1290b5\"\n  },\n  \"_source\": \"git://github.com/angular/bower-angular-animate.git\",\n  \"_target\": \"~1.2.17\",\n  \"_originalSource\": \"angular-animate\"\n}"
  },
  {
    "path": "www/lib/angular-animate/README.md",
    "content": "# bower-angular-animate\n\nThis repo is for distribution on `bower`. The source for this module is in the\n[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngAnimate).\nPlease file issues and pull requests against that repo.\n\n## Install\n\nInstall with `bower`:\n\n```shell\nbower install angular-animate\n```\n\nAdd a `<script>` to your `index.html`:\n\n```html\n<script src=\"/bower_components/angular-animate/angular-animate.js\"></script>\n```\n\nAnd add `ngAnimate` as a dependency for your app:\n\n```javascript\nangular.module('myApp', ['ngAnimate']);\n```\n\n## Documentation\n\nDocumentation is available on the\n[AngularJS docs site](http://docs.angularjs.org/api/ngAnimate).\n\n## License\n\nThe MIT License\n\nCopyright (c) 2010-2012 Google, Inc. http://angularjs.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "www/lib/angular-animate/angular-animate.js",
    "content": "/**\n * @license AngularJS v1.2.24\n * (c) 2010-2014 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* jshint maxlen: false */\n\n/**\n * @ngdoc module\n * @name ngAnimate\n * @description\n *\n * # ngAnimate\n *\n * The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives.\n *\n *\n * <div doc-module-components=\"ngAnimate\"></div>\n *\n * # Usage\n *\n * To see animations in action, all that is required is to define the appropriate CSS classes\n * or to register a JavaScript animation via the myModule.animation() function. The directives that support animation automatically are:\n * `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation\n * by using the `$animate` service.\n *\n * Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives:\n *\n * | Directive                                                 | Supported Animations                               |\n * |---------------------------------------------------------- |----------------------------------------------------|\n * | {@link ng.directive:ngRepeat#usage_animations ngRepeat}         | enter, leave and move                              |\n * | {@link ngRoute.directive:ngView#usage_animations ngView}        | enter and leave                                    |\n * | {@link ng.directive:ngInclude#usage_animations ngInclude}       | enter and leave                                    |\n * | {@link ng.directive:ngSwitch#usage_animations ngSwitch}         | enter and leave                                    |\n * | {@link ng.directive:ngIf#usage_animations ngIf}                 | enter and leave                                    |\n * | {@link ng.directive:ngClass#usage_animations ngClass}           | add and remove                                     |\n * | {@link ng.directive:ngShow#usage_animations ngShow & ngHide}    | add and remove (the ng-hide class value)           |\n * | {@link ng.directive:form#usage_animations form}                 | add and remove (dirty, pristine, valid, invalid & all other validations)                |\n * | {@link ng.directive:ngModel#usage_animations ngModel}           | add and remove (dirty, pristine, valid, invalid & all other validations)                |\n *\n * You can find out more information about animations upon visiting each directive page.\n *\n * Below is an example of how to apply animations to a directive that supports animation hooks:\n *\n * ```html\n * <style type=\"text/css\">\n * .slide.ng-enter, .slide.ng-leave {\n *   -webkit-transition:0.5s linear all;\n *   transition:0.5s linear all;\n * }\n *\n * .slide.ng-enter { }        /&#42; starting animations for enter &#42;/\n * .slide.ng-enter.ng-enter-active { } /&#42; terminal animations for enter &#42;/\n * .slide.ng-leave { }        /&#42; starting animations for leave &#42;/\n * .slide.ng-leave.ng-leave-active { } /&#42; terminal animations for leave &#42;/\n * </style>\n *\n * <!--\n * the animate service will automatically add .ng-enter and .ng-leave to the element\n * to trigger the CSS transition/animations\n * -->\n * <ANY class=\"slide\" ng-include=\"...\"></ANY>\n * ```\n *\n * Keep in mind that, by default, if an animation is running, any child elements cannot be animated\n * until the parent element's animation has completed. This blocking feature can be overridden by\n * placing the `ng-animate-children` attribute on a parent container tag.\n *\n * ```html\n * <div class=\"slide-animation\" ng-if=\"on\" ng-animate-children>\n *   <div class=\"fade-animation\" ng-if=\"on\">\n *     <div class=\"explode-animation\" ng-if=\"on\">\n *        ...\n *     </div>\n *   </div>\n * </div>\n * ```\n *\n * When the `on` expression value changes and an animation is triggered then each of the elements within\n * will all animate without the block being applied to child elements.\n *\n * <h2>CSS-defined Animations</h2>\n * The animate service will automatically apply two CSS classes to the animated element and these two CSS classes\n * are designed to contain the start and end CSS styling. Both CSS transitions and keyframe animations are supported\n * and can be used to play along with this naming structure.\n *\n * The following code below demonstrates how to perform animations using **CSS transitions** with Angular:\n *\n * ```html\n * <style type=\"text/css\">\n * /&#42;\n *  The animate class is apart of the element and the ng-enter class\n *  is attached to the element once the enter animation event is triggered\n * &#42;/\n * .reveal-animation.ng-enter {\n *  -webkit-transition: 1s linear all; /&#42; Safari/Chrome &#42;/\n *  transition: 1s linear all; /&#42; All other modern browsers and IE10+ &#42;/\n *\n *  /&#42; The animation preparation code &#42;/\n *  opacity: 0;\n * }\n *\n * /&#42;\n *  Keep in mind that you want to combine both CSS\n *  classes together to avoid any CSS-specificity\n *  conflicts\n * &#42;/\n * .reveal-animation.ng-enter.ng-enter-active {\n *  /&#42; The animation code itself &#42;/\n *  opacity: 1;\n * }\n * </style>\n *\n * <div class=\"view-container\">\n *   <div ng-view class=\"reveal-animation\"></div>\n * </div>\n * ```\n *\n * The following code below demonstrates how to perform animations using **CSS animations** with Angular:\n *\n * ```html\n * <style type=\"text/css\">\n * .reveal-animation.ng-enter {\n *   -webkit-animation: enter_sequence 1s linear; /&#42; Safari/Chrome &#42;/\n *   animation: enter_sequence 1s linear; /&#42; IE10+ and Future Browsers &#42;/\n * }\n * @-webkit-keyframes enter_sequence {\n *   from { opacity:0; }\n *   to { opacity:1; }\n * }\n * @keyframes enter_sequence {\n *   from { opacity:0; }\n *   to { opacity:1; }\n * }\n * </style>\n *\n * <div class=\"view-container\">\n *   <div ng-view class=\"reveal-animation\"></div>\n * </div>\n * ```\n *\n * Both CSS3 animations and transitions can be used together and the animate service will figure out the correct duration and delay timing.\n *\n * Upon DOM mutation, the event class is added first (something like `ng-enter`), then the browser prepares itself to add\n * the active class (in this case `ng-enter-active`) which then triggers the animation. The animation module will automatically\n * detect the CSS code to determine when the animation ends. Once the animation is over then both CSS classes will be\n * removed from the DOM. If a browser does not support CSS transitions or CSS animations then the animation will start and end\n * immediately resulting in a DOM element that is at its final state. This final state is when the DOM element\n * has no CSS transition/animation classes applied to it.\n *\n * <h3>CSS Staggering Animations</h3>\n * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a\n * curtain-like effect. The ngAnimate module, as of 1.2.0, supports staggering animations and the stagger effect can be\n * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for\n * the animation. The style property expected within the stagger class can either be a **transition-delay** or an\n * **animation-delay** property (or both if your animation contains both transitions and keyframe animations).\n *\n * ```css\n * .my-animation.ng-enter {\n *   /&#42; standard transition code &#42;/\n *   -webkit-transition: 1s linear all;\n *   transition: 1s linear all;\n *   opacity:0;\n * }\n * .my-animation.ng-enter-stagger {\n *   /&#42; this will have a 100ms delay between each successive leave animation &#42;/\n *   -webkit-transition-delay: 0.1s;\n *   transition-delay: 0.1s;\n *\n *   /&#42; in case the stagger doesn't work then these two values\n *    must be set to 0 to avoid an accidental CSS inheritance &#42;/\n *   -webkit-transition-duration: 0s;\n *   transition-duration: 0s;\n * }\n * .my-animation.ng-enter.ng-enter-active {\n *   /&#42; standard transition styles &#42;/\n *   opacity:1;\n * }\n * ```\n *\n * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations\n * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this\n * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation\n * will also be reset if more than 10ms has passed after the last animation has been fired.\n *\n * The following code will issue the **ng-leave-stagger** event on the element provided:\n *\n * ```js\n * var kids = parent.children();\n *\n * $animate.leave(kids[0]); //stagger index=0\n * $animate.leave(kids[1]); //stagger index=1\n * $animate.leave(kids[2]); //stagger index=2\n * $animate.leave(kids[3]); //stagger index=3\n * $animate.leave(kids[4]); //stagger index=4\n *\n * $timeout(function() {\n *   //stagger has reset itself\n *   $animate.leave(kids[5]); //stagger index=0\n *   $animate.leave(kids[6]); //stagger index=1\n * }, 100, false);\n * ```\n *\n * Stagger animations are currently only supported within CSS-defined animations.\n *\n * <h2>JavaScript-defined Animations</h2>\n * In the event that you do not want to use CSS3 transitions or CSS3 animations or if you wish to offer animations on browsers that do not\n * yet support CSS transitions/animations, then you can make use of JavaScript animations defined inside of your AngularJS module.\n *\n * ```js\n * //!annotate=\"YourApp\" Your AngularJS Module|Replace this or ngModule with the module that you used to define your application.\n * var ngModule = angular.module('YourApp', ['ngAnimate']);\n * ngModule.animation('.my-crazy-animation', function() {\n *   return {\n *     enter: function(element, done) {\n *       //run the animation here and call done when the animation is complete\n *       return function(cancelled) {\n *         //this (optional) function will be called when the animation\n *         //completes or when the animation is cancelled (the cancelled\n *         //flag will be set to true if cancelled).\n *       };\n *     },\n *     leave: function(element, done) { },\n *     move: function(element, done) { },\n *\n *     //animation that can be triggered before the class is added\n *     beforeAddClass: function(element, className, done) { },\n *\n *     //animation that can be triggered after the class is added\n *     addClass: function(element, className, done) { },\n *\n *     //animation that can be triggered before the class is removed\n *     beforeRemoveClass: function(element, className, done) { },\n *\n *     //animation that can be triggered after the class is removed\n *     removeClass: function(element, className, done) { }\n *   };\n * });\n * ```\n *\n * JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run\n * a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits\n * the element's CSS class attribute value and then run the matching animation event function (if found).\n * In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function will\n * be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported).\n *\n * Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned.\n * As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run,\n * and the JavaScript animation is found, then the enter callback will handle that animation (in addition to the CSS keyframe animation\n * or transition code that is defined via a stylesheet).\n *\n */\n\nangular.module('ngAnimate', ['ng'])\n\n  /**\n   * @ngdoc provider\n   * @name $animateProvider\n   * @description\n   *\n   * The `$animateProvider` allows developers to register JavaScript animation event handlers directly inside of a module.\n   * When an animation is triggered, the $animate service will query the $animate service to find any animations that match\n   * the provided name value.\n   *\n   * Requires the {@link ngAnimate `ngAnimate`} module to be installed.\n   *\n   * Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.\n   *\n   */\n  .directive('ngAnimateChildren', function() {\n    var NG_ANIMATE_CHILDREN = '$$ngAnimateChildren';\n    return function(scope, element, attrs) {\n      var val = attrs.ngAnimateChildren;\n      if(angular.isString(val) && val.length === 0) { //empty attribute\n        element.data(NG_ANIMATE_CHILDREN, true);\n      } else {\n        scope.$watch(val, function(value) {\n          element.data(NG_ANIMATE_CHILDREN, !!value);\n        });\n      }\n    };\n  })\n\n  //this private service is only used within CSS-enabled animations\n  //IE8 + IE9 do not support rAF natively, but that is fine since they\n  //also don't support transitions and keyframes which means that the code\n  //below will never be used by the two browsers.\n  .factory('$$animateReflow', ['$$rAF', '$document', function($$rAF, $document) {\n    var bod = $document[0].body;\n    return function(fn) {\n      //the returned function acts as the cancellation function\n      return $$rAF(function() {\n        //the line below will force the browser to perform a repaint\n        //so that all the animated elements within the animation frame\n        //will be properly updated and drawn on screen. This is\n        //required to perform multi-class CSS based animations with\n        //Firefox. DO NOT REMOVE THIS LINE.\n        var a = bod.offsetWidth + 1;\n        fn();\n      });\n    };\n  }])\n\n  .config(['$provide', '$animateProvider', function($provide, $animateProvider) {\n    var noop = angular.noop;\n    var forEach = angular.forEach;\n    var selectors = $animateProvider.$$selectors;\n\n    var ELEMENT_NODE = 1;\n    var NG_ANIMATE_STATE = '$$ngAnimateState';\n    var NG_ANIMATE_CHILDREN = '$$ngAnimateChildren';\n    var NG_ANIMATE_CLASS_NAME = 'ng-animate';\n    var rootAnimateState = {running: true};\n\n    function extractElementNode(element) {\n      for(var i = 0; i < element.length; i++) {\n        var elm = element[i];\n        if(elm.nodeType == ELEMENT_NODE) {\n          return elm;\n        }\n      }\n    }\n\n    function prepareElement(element) {\n      return element && angular.element(element);\n    }\n\n    function stripCommentsFromElement(element) {\n      return angular.element(extractElementNode(element));\n    }\n\n    function isMatchingElement(elm1, elm2) {\n      return extractElementNode(elm1) == extractElementNode(elm2);\n    }\n\n    $provide.decorator('$animate', ['$delegate', '$injector', '$sniffer', '$rootElement', '$$asyncCallback', '$rootScope', '$document',\n                            function($delegate,   $injector,   $sniffer,   $rootElement,   $$asyncCallback,    $rootScope,   $document) {\n\n      var globalAnimationCounter = 0;\n      $rootElement.data(NG_ANIMATE_STATE, rootAnimateState);\n\n      // disable animations during bootstrap, but once we bootstrapped, wait again\n      // for another digest until enabling animations. The reason why we digest twice\n      // is because all structural animations (enter, leave and move) all perform a\n      // post digest operation before animating. If we only wait for a single digest\n      // to pass then the structural animation would render its animation on page load.\n      // (which is what we're trying to avoid when the application first boots up.)\n      $rootScope.$$postDigest(function() {\n        $rootScope.$$postDigest(function() {\n          rootAnimateState.running = false;\n        });\n      });\n\n      var classNameFilter = $animateProvider.classNameFilter();\n      var isAnimatableClassName = !classNameFilter\n              ? function() { return true; }\n              : function(className) {\n                return classNameFilter.test(className);\n              };\n\n      function blockElementAnimations(element) {\n        var data = element.data(NG_ANIMATE_STATE) || {};\n        data.running = true;\n        element.data(NG_ANIMATE_STATE, data);\n      }\n\n      function lookup(name) {\n        if (name) {\n          var matches = [],\n              flagMap = {},\n              classes = name.substr(1).split('.');\n\n          //the empty string value is the default animation\n          //operation which performs CSS transition and keyframe\n          //animations sniffing. This is always included for each\n          //element animation procedure if the browser supports\n          //transitions and/or keyframe animations. The default\n          //animation is added to the top of the list to prevent\n          //any previous animations from affecting the element styling\n          //prior to the element being animated.\n          if ($sniffer.transitions || $sniffer.animations) {\n            matches.push($injector.get(selectors['']));\n          }\n\n          for(var i=0; i < classes.length; i++) {\n            var klass = classes[i],\n                selectorFactoryName = selectors[klass];\n            if(selectorFactoryName && !flagMap[klass]) {\n              matches.push($injector.get(selectorFactoryName));\n              flagMap[klass] = true;\n            }\n          }\n          return matches;\n        }\n      }\n\n      function animationRunner(element, animationEvent, className) {\n        //transcluded directives may sometimes fire an animation using only comment nodes\n        //best to catch this early on to prevent any animation operations from occurring\n        var node = element[0];\n        if(!node) {\n          return;\n        }\n\n        var isSetClassOperation = animationEvent == 'setClass';\n        var isClassBased = isSetClassOperation ||\n                           animationEvent == 'addClass' ||\n                           animationEvent == 'removeClass';\n\n        var classNameAdd, classNameRemove;\n        if(angular.isArray(className)) {\n          classNameAdd = className[0];\n          classNameRemove = className[1];\n          className = classNameAdd + ' ' + classNameRemove;\n        }\n\n        var currentClassName = element.attr('class');\n        var classes = currentClassName + ' ' + className;\n        if(!isAnimatableClassName(classes)) {\n          return;\n        }\n\n        var beforeComplete = noop,\n            beforeCancel = [],\n            before = [],\n            afterComplete = noop,\n            afterCancel = [],\n            after = [];\n\n        var animationLookup = (' ' + classes).replace(/\\s+/g,'.');\n        forEach(lookup(animationLookup), function(animationFactory) {\n          var created = registerAnimation(animationFactory, animationEvent);\n          if(!created && isSetClassOperation) {\n            registerAnimation(animationFactory, 'addClass');\n            registerAnimation(animationFactory, 'removeClass');\n          }\n        });\n\n        function registerAnimation(animationFactory, event) {\n          var afterFn = animationFactory[event];\n          var beforeFn = animationFactory['before' + event.charAt(0).toUpperCase() + event.substr(1)];\n          if(afterFn || beforeFn) {\n            if(event == 'leave') {\n              beforeFn = afterFn;\n              //when set as null then animation knows to skip this phase\n              afterFn = null;\n            }\n            after.push({\n              event : event, fn : afterFn\n            });\n            before.push({\n              event : event, fn : beforeFn\n            });\n            return true;\n          }\n        }\n\n        function run(fns, cancellations, allCompleteFn) {\n          var animations = [];\n          forEach(fns, function(animation) {\n            animation.fn && animations.push(animation);\n          });\n\n          var count = 0;\n          function afterAnimationComplete(index) {\n            if(cancellations) {\n              (cancellations[index] || noop)();\n              if(++count < animations.length) return;\n              cancellations = null;\n            }\n            allCompleteFn();\n          }\n\n          //The code below adds directly to the array in order to work with\n          //both sync and async animations. Sync animations are when the done()\n          //operation is called right away. DO NOT REFACTOR!\n          forEach(animations, function(animation, index) {\n            var progress = function() {\n              afterAnimationComplete(index);\n            };\n            switch(animation.event) {\n              case 'setClass':\n                cancellations.push(animation.fn(element, classNameAdd, classNameRemove, progress));\n                break;\n              case 'addClass':\n                cancellations.push(animation.fn(element, classNameAdd || className,     progress));\n                break;\n              case 'removeClass':\n                cancellations.push(animation.fn(element, classNameRemove || className,  progress));\n                break;\n              default:\n                cancellations.push(animation.fn(element, progress));\n                break;\n            }\n          });\n\n          if(cancellations && cancellations.length === 0) {\n            allCompleteFn();\n          }\n        }\n\n        return {\n          node : node,\n          event : animationEvent,\n          className : className,\n          isClassBased : isClassBased,\n          isSetClassOperation : isSetClassOperation,\n          before : function(allCompleteFn) {\n            beforeComplete = allCompleteFn;\n            run(before, beforeCancel, function() {\n              beforeComplete = noop;\n              allCompleteFn();\n            });\n          },\n          after : function(allCompleteFn) {\n            afterComplete = allCompleteFn;\n            run(after, afterCancel, function() {\n              afterComplete = noop;\n              allCompleteFn();\n            });\n          },\n          cancel : function() {\n            if(beforeCancel) {\n              forEach(beforeCancel, function(cancelFn) {\n                (cancelFn || noop)(true);\n              });\n              beforeComplete(true);\n            }\n            if(afterCancel) {\n              forEach(afterCancel, function(cancelFn) {\n                (cancelFn || noop)(true);\n              });\n              afterComplete(true);\n            }\n          }\n        };\n      }\n\n      /**\n       * @ngdoc service\n       * @name $animate\n       * @kind function\n       *\n       * @description\n       * The `$animate` service provides animation detection support while performing DOM operations (enter, leave and move) as well as during addClass and removeClass operations.\n       * When any of these operations are run, the $animate service\n       * will examine any JavaScript-defined animations (which are defined by using the $animateProvider provider object)\n       * as well as any CSS-defined animations against the CSS classes present on the element once the DOM operation is run.\n       *\n       * The `$animate` service is used behind the scenes with pre-existing directives and animation with these directives\n       * will work out of the box without any extra configuration.\n       *\n       * Requires the {@link ngAnimate `ngAnimate`} module to be installed.\n       *\n       * Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.\n       *\n       */\n      return {\n        /**\n         * @ngdoc method\n         * @name $animate#enter\n         * @kind function\n         *\n         * @description\n         * Appends the element to the parentElement element that resides in the document and then runs the enter animation. Once\n         * the animation is started, the following CSS classes will be present on the element for the duration of the animation:\n         *\n         * Below is a breakdown of each step that occurs during enter animation:\n         *\n         * | Animation Step                                                                               | What the element class attribute looks like |\n         * |----------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.enter(...) is called                                                             | class=\"my-animation\"                        |\n         * | 2. element is inserted into the parentElement element or beside the afterElement element     | class=\"my-animation\"                        |\n         * | 3. $animate runs any JavaScript-defined animations on the element                            | class=\"my-animation ng-animate\"             |\n         * | 4. the .ng-enter class is added to the element                                               | class=\"my-animation ng-animate ng-enter\"    |\n         * | 5. $animate scans the element styles to get the CSS transition/animation duration and delay  | class=\"my-animation ng-animate ng-enter\"    |\n         * | 6. $animate waits for 10ms (this performs a reflow)                                          | class=\"my-animation ng-animate ng-enter\"    |\n         * | 7. the .ng-enter-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active ng-enter ng-enter-active\" |\n         * | 8. $animate waits for X milliseconds for the animation to complete                           | class=\"my-animation ng-animate ng-animate-active ng-enter ng-enter-active\" |\n         * | 9. The animation ends and all generated CSS classes are removed from the element             | class=\"my-animation\"                        |\n         * | 10. The doneCallback() callback is fired (if provided)                                       | class=\"my-animation\"                        |\n         *\n         * @param {DOMElement} element the element that will be the focus of the enter animation\n         * @param {DOMElement} parentElement the parent element of the element that will be the focus of the enter animation\n         * @param {DOMElement} afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        enter : function(element, parentElement, afterElement, doneCallback) {\n          element = angular.element(element);\n          parentElement = prepareElement(parentElement);\n          afterElement = prepareElement(afterElement);\n\n          blockElementAnimations(element);\n          $delegate.enter(element, parentElement, afterElement);\n          $rootScope.$$postDigest(function() {\n            element = stripCommentsFromElement(element);\n            performAnimation('enter', 'ng-enter', element, parentElement, afterElement, noop, doneCallback);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#leave\n         * @kind function\n         *\n         * @description\n         * Runs the leave animation operation and, upon completion, removes the element from the DOM. Once\n         * the animation is started, the following CSS classes will be added for the duration of the animation:\n         *\n         * Below is a breakdown of each step that occurs during leave animation:\n         *\n         * | Animation Step                                                                               | What the element class attribute looks like |\n         * |----------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.leave(...) is called                                                             | class=\"my-animation\"                        |\n         * | 2. $animate runs any JavaScript-defined animations on the element                            | class=\"my-animation ng-animate\"             |\n         * | 3. the .ng-leave class is added to the element                                               | class=\"my-animation ng-animate ng-leave\"    |\n         * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay  | class=\"my-animation ng-animate ng-leave\"    |\n         * | 5. $animate waits for 10ms (this performs a reflow)                                          | class=\"my-animation ng-animate ng-leave\"    |\n         * | 6. the .ng-leave-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active ng-leave ng-leave-active\" |\n         * | 7. $animate waits for X milliseconds for the animation to complete                           | class=\"my-animation ng-animate ng-animate-active ng-leave ng-leave-active\" |\n         * | 8. The animation ends and all generated CSS classes are removed from the element             | class=\"my-animation\"                        |\n         * | 9. The element is removed from the DOM                                                       | ...                                         |\n         * | 10. The doneCallback() callback is fired (if provided)                                       | ...                                         |\n         *\n         * @param {DOMElement} element the element that will be the focus of the leave animation\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        leave : function(element, doneCallback) {\n          element = angular.element(element);\n          cancelChildAnimations(element);\n          blockElementAnimations(element);\n          $rootScope.$$postDigest(function() {\n            performAnimation('leave', 'ng-leave', stripCommentsFromElement(element), null, null, function() {\n              $delegate.leave(element);\n            }, doneCallback);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#move\n         * @kind function\n         *\n         * @description\n         * Fires the move DOM operation. Just before the animation starts, the animate service will either append it into the parentElement container or\n         * add the element directly after the afterElement element if present. Then the move animation will be run. Once\n         * the animation is started, the following CSS classes will be added for the duration of the animation:\n         *\n         * Below is a breakdown of each step that occurs during move animation:\n         *\n         * | Animation Step                                                                               | What the element class attribute looks like |\n         * |----------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.move(...) is called                                                              | class=\"my-animation\"                        |\n         * | 2. element is moved into the parentElement element or beside the afterElement element        | class=\"my-animation\"                        |\n         * | 3. $animate runs any JavaScript-defined animations on the element                            | class=\"my-animation ng-animate\"             |\n         * | 4. the .ng-move class is added to the element                                                | class=\"my-animation ng-animate ng-move\"     |\n         * | 5. $animate scans the element styles to get the CSS transition/animation duration and delay  | class=\"my-animation ng-animate ng-move\"     |\n         * | 6. $animate waits for 10ms (this performs a reflow)                                          | class=\"my-animation ng-animate ng-move\"     |\n         * | 7. the .ng-move-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active ng-move ng-move-active\" |\n         * | 8. $animate waits for X milliseconds for the animation to complete                           | class=\"my-animation ng-animate ng-animate-active ng-move ng-move-active\" |\n         * | 9. The animation ends and all generated CSS classes are removed from the element             | class=\"my-animation\"                        |\n         * | 10. The doneCallback() callback is fired (if provided)                                       | class=\"my-animation\"                        |\n         *\n         * @param {DOMElement} element the element that will be the focus of the move animation\n         * @param {DOMElement} parentElement the parentElement element of the element that will be the focus of the move animation\n         * @param {DOMElement} afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        move : function(element, parentElement, afterElement, doneCallback) {\n          element = angular.element(element);\n          parentElement = prepareElement(parentElement);\n          afterElement = prepareElement(afterElement);\n\n          cancelChildAnimations(element);\n          blockElementAnimations(element);\n          $delegate.move(element, parentElement, afterElement);\n          $rootScope.$$postDigest(function() {\n            element = stripCommentsFromElement(element);\n            performAnimation('move', 'ng-move', element, parentElement, afterElement, noop, doneCallback);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#addClass\n         *\n         * @description\n         * Triggers a custom animation event based off the className variable and then attaches the className value to the element as a CSS class.\n         * Unlike the other animation methods, the animate service will suffix the className value with {@type -add} in order to provide\n         * the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if no CSS transitions\n         * or keyframes are defined on the -add or base CSS class).\n         *\n         * Below is a breakdown of each step that occurs during addClass animation:\n         *\n         * | Animation Step                                                                                 | What the element class attribute looks like |\n         * |------------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.addClass(element, 'super') is called                                               | class=\"my-animation\"                        |\n         * | 2. $animate runs any JavaScript-defined animations on the element                              | class=\"my-animation ng-animate\"             |\n         * | 3. the .super-add class are added to the element                                               | class=\"my-animation ng-animate super-add\"   |\n         * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay    | class=\"my-animation ng-animate super-add\"   |\n         * | 5. $animate waits for 10ms (this performs a reflow)                                            | class=\"my-animation ng-animate super-add\"   |\n         * | 6. the .super, .super-add-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active super super-add super-add-active\"          |\n         * | 7. $animate waits for X milliseconds for the animation to complete                             | class=\"my-animation super super-add super-add-active\"  |\n         * | 8. The animation ends and all generated CSS classes are removed from the element               | class=\"my-animation super\"                  |\n         * | 9. The super class is kept on the element                                                      | class=\"my-animation super\"                  |\n         * | 10. The doneCallback() callback is fired (if provided)                                         | class=\"my-animation super\"                  |\n         *\n         * @param {DOMElement} element the element that will be animated\n         * @param {string} className the CSS class that will be added to the element and then animated\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        addClass : function(element, className, doneCallback) {\n          element = angular.element(element);\n          element = stripCommentsFromElement(element);\n          performAnimation('addClass', className, element, null, null, function() {\n            $delegate.addClass(element, className);\n          }, doneCallback);\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#removeClass\n         *\n         * @description\n         * Triggers a custom animation event based off the className variable and then removes the CSS class provided by the className value\n         * from the element. Unlike the other animation methods, the animate service will suffix the className value with {@type -remove} in\n         * order to provide the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if\n         * no CSS transitions or keyframes are defined on the -remove or base CSS classes).\n         *\n         * Below is a breakdown of each step that occurs during removeClass animation:\n         *\n         * | Animation Step                                                                                | What the element class attribute looks like     |\n         * |-----------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.removeClass(element, 'super') is called                                           | class=\"my-animation super\"                  |\n         * | 2. $animate runs any JavaScript-defined animations on the element                             | class=\"my-animation super ng-animate\"       |\n         * | 3. the .super-remove class are added to the element                                           | class=\"my-animation super ng-animate super-remove\"|\n         * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay   | class=\"my-animation super ng-animate super-remove\"   |\n         * | 5. $animate waits for 10ms (this performs a reflow)                                           | class=\"my-animation super ng-animate super-remove\"   |\n         * | 6. the .super-remove-active and .ng-animate-active classes are added and .super is removed (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active super-remove super-remove-active\"          |\n         * | 7. $animate waits for X milliseconds for the animation to complete                            | class=\"my-animation ng-animate ng-animate-active super-remove super-remove-active\"   |\n         * | 8. The animation ends and all generated CSS classes are removed from the element              | class=\"my-animation\"                        |\n         * | 9. The doneCallback() callback is fired (if provided)                                         | class=\"my-animation\"                        |\n         *\n         *\n         * @param {DOMElement} element the element that will be animated\n         * @param {string} className the CSS class that will be animated and then removed from the element\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        removeClass : function(element, className, doneCallback) {\n          element = angular.element(element);\n          element = stripCommentsFromElement(element);\n          performAnimation('removeClass', className, element, null, null, function() {\n            $delegate.removeClass(element, className);\n          }, doneCallback);\n        },\n\n          /**\n           *\n           * @ngdoc function\n           * @name $animate#setClass\n           * @function\n           * @description Adds and/or removes the given CSS classes to and from the element.\n           * Once complete, the done() callback will be fired (if provided).\n           * @param {DOMElement} element the element which will its CSS classes changed\n           *   removed from it\n           * @param {string} add the CSS classes which will be added to the element\n           * @param {string} remove the CSS class which will be removed from the element\n           * @param {Function=} done the callback function (if provided) that will be fired after the\n           *   CSS classes have been set on the element\n           */\n        setClass : function(element, add, remove, doneCallback) {\n          element = angular.element(element);\n          element = stripCommentsFromElement(element);\n          performAnimation('setClass', [add, remove], element, null, null, function() {\n            $delegate.setClass(element, add, remove);\n          }, doneCallback);\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#enabled\n         * @kind function\n         *\n         * @param {boolean=} value If provided then set the animation on or off.\n         * @param {DOMElement=} element If provided then the element will be used to represent the enable/disable operation\n         * @return {boolean} Current animation state.\n         *\n         * @description\n         * Globally enables/disables animations.\n         *\n        */\n        enabled : function(value, element) {\n          switch(arguments.length) {\n            case 2:\n              if(value) {\n                cleanup(element);\n              } else {\n                var data = element.data(NG_ANIMATE_STATE) || {};\n                data.disabled = true;\n                element.data(NG_ANIMATE_STATE, data);\n              }\n            break;\n\n            case 1:\n              rootAnimateState.disabled = !value;\n            break;\n\n            default:\n              value = !rootAnimateState.disabled;\n            break;\n          }\n          return !!value;\n         }\n      };\n\n      /*\n        all animations call this shared animation triggering function internally.\n        The animationEvent variable refers to the JavaScript animation event that will be triggered\n        and the className value is the name of the animation that will be applied within the\n        CSS code. Element, parentElement and afterElement are provided DOM elements for the animation\n        and the onComplete callback will be fired once the animation is fully complete.\n      */\n      function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) {\n\n        var runner = animationRunner(element, animationEvent, className);\n        if(!runner) {\n          fireDOMOperation();\n          fireBeforeCallbackAsync();\n          fireAfterCallbackAsync();\n          closeAnimation();\n          return;\n        }\n\n        className = runner.className;\n        var elementEvents = angular.element._data(runner.node);\n        elementEvents = elementEvents && elementEvents.events;\n\n        if (!parentElement) {\n          parentElement = afterElement ? afterElement.parent() : element.parent();\n        }\n\n        var ngAnimateState  = element.data(NG_ANIMATE_STATE) || {};\n        var runningAnimations     = ngAnimateState.active || {};\n        var totalActiveAnimations = ngAnimateState.totalActive || 0;\n        var lastAnimation         = ngAnimateState.last;\n\n        //only allow animations if the currently running animation is not structural\n        //or if there is no animation running at all\n        var skipAnimations;\n        if (runner.isClassBased) {\n          skipAnimations = ngAnimateState.running ||\n                           ngAnimateState.disabled ||\n                           (lastAnimation && !lastAnimation.isClassBased);\n        }\n\n        //skip the animation if animations are disabled, a parent is already being animated,\n        //the element is not currently attached to the document body or then completely close\n        //the animation if any matching animations are not found at all.\n        //NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case an animation was found.\n        if (skipAnimations || animationsDisabled(element, parentElement)) {\n          fireDOMOperation();\n          fireBeforeCallbackAsync();\n          fireAfterCallbackAsync();\n          closeAnimation();\n          return;\n        }\n\n        var skipAnimation = false;\n        if(totalActiveAnimations > 0) {\n          var animationsToCancel = [];\n          if(!runner.isClassBased) {\n            if(animationEvent == 'leave' && runningAnimations['ng-leave']) {\n              skipAnimation = true;\n            } else {\n              //cancel all animations when a structural animation takes place\n              for(var klass in runningAnimations) {\n                animationsToCancel.push(runningAnimations[klass]);\n                cleanup(element, klass);\n              }\n              runningAnimations = {};\n              totalActiveAnimations = 0;\n            }\n          } else if(lastAnimation.event == 'setClass') {\n            animationsToCancel.push(lastAnimation);\n            cleanup(element, className);\n          }\n          else if(runningAnimations[className]) {\n            var current = runningAnimations[className];\n            if(current.event == animationEvent) {\n              skipAnimation = true;\n            } else {\n              animationsToCancel.push(current);\n              cleanup(element, className);\n            }\n          }\n\n          if(animationsToCancel.length > 0) {\n            forEach(animationsToCancel, function(operation) {\n              operation.cancel();\n            });\n          }\n        }\n\n        if(runner.isClassBased && !runner.isSetClassOperation && !skipAnimation) {\n          skipAnimation = (animationEvent == 'addClass') == element.hasClass(className); //opposite of XOR\n        }\n\n        if(skipAnimation) {\n          fireDOMOperation();\n          fireBeforeCallbackAsync();\n          fireAfterCallbackAsync();\n          fireDoneCallbackAsync();\n          return;\n        }\n\n        if(animationEvent == 'leave') {\n          //there's no need to ever remove the listener since the element\n          //will be removed (destroyed) after the leave animation ends or\n          //is cancelled midway\n          element.one('$destroy', function(e) {\n            var element = angular.element(this);\n            var state = element.data(NG_ANIMATE_STATE);\n            if(state) {\n              var activeLeaveAnimation = state.active['ng-leave'];\n              if(activeLeaveAnimation) {\n                activeLeaveAnimation.cancel();\n                cleanup(element, 'ng-leave');\n              }\n            }\n          });\n        }\n\n        //the ng-animate class does nothing, but it's here to allow for\n        //parent animations to find and cancel child animations when needed\n        element.addClass(NG_ANIMATE_CLASS_NAME);\n\n        var localAnimationCount = globalAnimationCounter++;\n        totalActiveAnimations++;\n        runningAnimations[className] = runner;\n\n        element.data(NG_ANIMATE_STATE, {\n          last : runner,\n          active : runningAnimations,\n          index : localAnimationCount,\n          totalActive : totalActiveAnimations\n        });\n\n        //first we run the before animations and when all of those are complete\n        //then we perform the DOM operation and run the next set of animations\n        fireBeforeCallbackAsync();\n        runner.before(function(cancelled) {\n          var data = element.data(NG_ANIMATE_STATE);\n          cancelled = cancelled ||\n                        !data || !data.active[className] ||\n                        (runner.isClassBased && data.active[className].event != animationEvent);\n\n          fireDOMOperation();\n          if(cancelled === true) {\n            closeAnimation();\n          } else {\n            fireAfterCallbackAsync();\n            runner.after(closeAnimation);\n          }\n        });\n\n        function fireDOMCallback(animationPhase) {\n          var eventName = '$animate:' + animationPhase;\n          if(elementEvents && elementEvents[eventName] && elementEvents[eventName].length > 0) {\n            $$asyncCallback(function() {\n              element.triggerHandler(eventName, {\n                event : animationEvent,\n                className : className\n              });\n            });\n          }\n        }\n\n        function fireBeforeCallbackAsync() {\n          fireDOMCallback('before');\n        }\n\n        function fireAfterCallbackAsync() {\n          fireDOMCallback('after');\n        }\n\n        function fireDoneCallbackAsync() {\n          fireDOMCallback('close');\n          if(doneCallback) {\n            $$asyncCallback(function() {\n              doneCallback();\n            });\n          }\n        }\n\n        //it is less complicated to use a flag than managing and canceling\n        //timeouts containing multiple callbacks.\n        function fireDOMOperation() {\n          if(!fireDOMOperation.hasBeenRun) {\n            fireDOMOperation.hasBeenRun = true;\n            domOperation();\n          }\n        }\n\n        function closeAnimation() {\n          if(!closeAnimation.hasBeenRun) {\n            closeAnimation.hasBeenRun = true;\n            var data = element.data(NG_ANIMATE_STATE);\n            if(data) {\n              /* only structural animations wait for reflow before removing an\n                 animation, but class-based animations don't. An example of this\n                 failing would be when a parent HTML tag has a ng-class attribute\n                 causing ALL directives below to skip animations during the digest */\n              if(runner && runner.isClassBased) {\n                cleanup(element, className);\n              } else {\n                $$asyncCallback(function() {\n                  var data = element.data(NG_ANIMATE_STATE) || {};\n                  if(localAnimationCount == data.index) {\n                    cleanup(element, className, animationEvent);\n                  }\n                });\n                element.data(NG_ANIMATE_STATE, data);\n              }\n            }\n            fireDoneCallbackAsync();\n          }\n        }\n      }\n\n      function cancelChildAnimations(element) {\n        var node = extractElementNode(element);\n        if (node) {\n          var nodes = angular.isFunction(node.getElementsByClassName) ?\n            node.getElementsByClassName(NG_ANIMATE_CLASS_NAME) :\n            node.querySelectorAll('.' + NG_ANIMATE_CLASS_NAME);\n          forEach(nodes, function(element) {\n            element = angular.element(element);\n            var data = element.data(NG_ANIMATE_STATE);\n            if(data && data.active) {\n              forEach(data.active, function(runner) {\n                runner.cancel();\n              });\n            }\n          });\n        }\n      }\n\n      function cleanup(element, className) {\n        if(isMatchingElement(element, $rootElement)) {\n          if(!rootAnimateState.disabled) {\n            rootAnimateState.running = false;\n            rootAnimateState.structural = false;\n          }\n        } else if(className) {\n          var data = element.data(NG_ANIMATE_STATE) || {};\n\n          var removeAnimations = className === true;\n          if(!removeAnimations && data.active && data.active[className]) {\n            data.totalActive--;\n            delete data.active[className];\n          }\n\n          if(removeAnimations || !data.totalActive) {\n            element.removeClass(NG_ANIMATE_CLASS_NAME);\n            element.removeData(NG_ANIMATE_STATE);\n          }\n        }\n      }\n\n      function animationsDisabled(element, parentElement) {\n        if (rootAnimateState.disabled) {\n          return true;\n        }\n\n        if (isMatchingElement(element, $rootElement)) {\n          return rootAnimateState.running;\n        }\n\n        var allowChildAnimations, parentRunningAnimation, hasParent;\n        do {\n          //the element did not reach the root element which means that it\n          //is not apart of the DOM. Therefore there is no reason to do\n          //any animations on it\n          if (parentElement.length === 0) break;\n\n          var isRoot = isMatchingElement(parentElement, $rootElement);\n          var state = isRoot ? rootAnimateState : (parentElement.data(NG_ANIMATE_STATE) || {});\n          if (state.disabled) {\n            return true;\n          }\n\n          //no matter what, for an animation to work it must reach the root element\n          //this implies that the element is attached to the DOM when the animation is run\n          if (isRoot) {\n            hasParent = true;\n          }\n\n          //once a flag is found that is strictly false then everything before\n          //it will be discarded and all child animations will be restricted\n          if (allowChildAnimations !== false) {\n            var animateChildrenFlag = parentElement.data(NG_ANIMATE_CHILDREN);\n            if(angular.isDefined(animateChildrenFlag)) {\n              allowChildAnimations = animateChildrenFlag;\n            }\n          }\n\n          parentRunningAnimation = parentRunningAnimation ||\n                                   state.running ||\n                                   (state.last && !state.last.isClassBased);\n        }\n        while(parentElement = parentElement.parent());\n\n        return !hasParent || (!allowChildAnimations && parentRunningAnimation);\n      }\n    }]);\n\n    $animateProvider.register('', ['$window', '$sniffer', '$timeout', '$$animateReflow',\n                           function($window,   $sniffer,   $timeout,   $$animateReflow) {\n      // Detect proper transitionend/animationend event names.\n      var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;\n\n      // If unprefixed events are not supported but webkit-prefixed are, use the latter.\n      // Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.\n      // Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`\n      // but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.\n      // Register both events in case `window.onanimationend` is not supported because of that,\n      // do the same for `transitionend` as Safari is likely to exhibit similar behavior.\n      // Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit\n      // therefore there is no reason to test anymore for other vendor prefixes: http://caniuse.com/#search=transition\n      if (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {\n        CSS_PREFIX = '-webkit-';\n        TRANSITION_PROP = 'WebkitTransition';\n        TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';\n      } else {\n        TRANSITION_PROP = 'transition';\n        TRANSITIONEND_EVENT = 'transitionend';\n      }\n\n      if (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {\n        CSS_PREFIX = '-webkit-';\n        ANIMATION_PROP = 'WebkitAnimation';\n        ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';\n      } else {\n        ANIMATION_PROP = 'animation';\n        ANIMATIONEND_EVENT = 'animationend';\n      }\n\n      var DURATION_KEY = 'Duration';\n      var PROPERTY_KEY = 'Property';\n      var DELAY_KEY = 'Delay';\n      var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';\n      var NG_ANIMATE_PARENT_KEY = '$$ngAnimateKey';\n      var NG_ANIMATE_CSS_DATA_KEY = '$$ngAnimateCSS3Data';\n      var NG_ANIMATE_BLOCK_CLASS_NAME = 'ng-animate-block-transitions';\n      var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;\n      var CLOSING_TIME_BUFFER = 1.5;\n      var ONE_SECOND = 1000;\n\n      var lookupCache = {};\n      var parentCounter = 0;\n      var animationReflowQueue = [];\n      var cancelAnimationReflow;\n      function afterReflow(element, callback) {\n        if(cancelAnimationReflow) {\n          cancelAnimationReflow();\n        }\n        animationReflowQueue.push(callback);\n        cancelAnimationReflow = $$animateReflow(function() {\n          forEach(animationReflowQueue, function(fn) {\n            fn();\n          });\n\n          animationReflowQueue = [];\n          cancelAnimationReflow = null;\n          lookupCache = {};\n        });\n      }\n\n      var closingTimer = null;\n      var closingTimestamp = 0;\n      var animationElementQueue = [];\n      function animationCloseHandler(element, totalTime) {\n        var node = extractElementNode(element);\n        element = angular.element(node);\n\n        //this item will be garbage collected by the closing\n        //animation timeout\n        animationElementQueue.push(element);\n\n        //but it may not need to cancel out the existing timeout\n        //if the timestamp is less than the previous one\n        var futureTimestamp = Date.now() + totalTime;\n        if(futureTimestamp <= closingTimestamp) {\n          return;\n        }\n\n        $timeout.cancel(closingTimer);\n\n        closingTimestamp = futureTimestamp;\n        closingTimer = $timeout(function() {\n          closeAllAnimations(animationElementQueue);\n          animationElementQueue = [];\n        }, totalTime, false);\n      }\n\n      function closeAllAnimations(elements) {\n        forEach(elements, function(element) {\n          var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);\n          if(elementData) {\n            (elementData.closeAnimationFn || noop)();\n          }\n        });\n      }\n\n      function getElementAnimationDetails(element, cacheKey) {\n        var data = cacheKey ? lookupCache[cacheKey] : null;\n        if(!data) {\n          var transitionDuration = 0;\n          var transitionDelay = 0;\n          var animationDuration = 0;\n          var animationDelay = 0;\n          var transitionDelayStyle;\n          var animationDelayStyle;\n          var transitionDurationStyle;\n          var transitionPropertyStyle;\n\n          //we want all the styles defined before and after\n          forEach(element, function(element) {\n            if (element.nodeType == ELEMENT_NODE) {\n              var elementStyles = $window.getComputedStyle(element) || {};\n\n              transitionDurationStyle = elementStyles[TRANSITION_PROP + DURATION_KEY];\n\n              transitionDuration = Math.max(parseMaxTime(transitionDurationStyle), transitionDuration);\n\n              transitionPropertyStyle = elementStyles[TRANSITION_PROP + PROPERTY_KEY];\n\n              transitionDelayStyle = elementStyles[TRANSITION_PROP + DELAY_KEY];\n\n              transitionDelay  = Math.max(parseMaxTime(transitionDelayStyle), transitionDelay);\n\n              animationDelayStyle = elementStyles[ANIMATION_PROP + DELAY_KEY];\n\n              animationDelay   = Math.max(parseMaxTime(animationDelayStyle), animationDelay);\n\n              var aDuration  = parseMaxTime(elementStyles[ANIMATION_PROP + DURATION_KEY]);\n\n              if(aDuration > 0) {\n                aDuration *= parseInt(elementStyles[ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY], 10) || 1;\n              }\n\n              animationDuration = Math.max(aDuration, animationDuration);\n            }\n          });\n          data = {\n            total : 0,\n            transitionPropertyStyle: transitionPropertyStyle,\n            transitionDurationStyle: transitionDurationStyle,\n            transitionDelayStyle: transitionDelayStyle,\n            transitionDelay: transitionDelay,\n            transitionDuration: transitionDuration,\n            animationDelayStyle: animationDelayStyle,\n            animationDelay: animationDelay,\n            animationDuration: animationDuration\n          };\n          if(cacheKey) {\n            lookupCache[cacheKey] = data;\n          }\n        }\n        return data;\n      }\n\n      function parseMaxTime(str) {\n        var maxValue = 0;\n        var values = angular.isString(str) ?\n          str.split(/\\s*,\\s*/) :\n          [];\n        forEach(values, function(value) {\n          maxValue = Math.max(parseFloat(value) || 0, maxValue);\n        });\n        return maxValue;\n      }\n\n      function getCacheKey(element) {\n        var parentElement = element.parent();\n        var parentID = parentElement.data(NG_ANIMATE_PARENT_KEY);\n        if(!parentID) {\n          parentElement.data(NG_ANIMATE_PARENT_KEY, ++parentCounter);\n          parentID = parentCounter;\n        }\n        return parentID + '-' + extractElementNode(element).getAttribute('class');\n      }\n\n      function animateSetup(animationEvent, element, className, calculationDecorator) {\n        var cacheKey = getCacheKey(element);\n        var eventCacheKey = cacheKey + ' ' + className;\n        var itemIndex = lookupCache[eventCacheKey] ? ++lookupCache[eventCacheKey].total : 0;\n\n        var stagger = {};\n        if(itemIndex > 0) {\n          var staggerClassName = className + '-stagger';\n          var staggerCacheKey = cacheKey + ' ' + staggerClassName;\n          var applyClasses = !lookupCache[staggerCacheKey];\n\n          applyClasses && element.addClass(staggerClassName);\n\n          stagger = getElementAnimationDetails(element, staggerCacheKey);\n\n          applyClasses && element.removeClass(staggerClassName);\n        }\n\n        /* the animation itself may need to add/remove special CSS classes\n         * before calculating the anmation styles */\n        calculationDecorator = calculationDecorator ||\n                               function(fn) { return fn(); };\n\n        element.addClass(className);\n\n        var formerData = element.data(NG_ANIMATE_CSS_DATA_KEY) || {};\n\n        var timings = calculationDecorator(function() {\n          return getElementAnimationDetails(element, eventCacheKey);\n        });\n\n        var transitionDuration = timings.transitionDuration;\n        var animationDuration = timings.animationDuration;\n        if(transitionDuration === 0 && animationDuration === 0) {\n          element.removeClass(className);\n          return false;\n        }\n\n        element.data(NG_ANIMATE_CSS_DATA_KEY, {\n          running : formerData.running || 0,\n          itemIndex : itemIndex,\n          stagger : stagger,\n          timings : timings,\n          closeAnimationFn : noop\n        });\n\n        //temporarily disable the transition so that the enter styles\n        //don't animate twice (this is here to avoid a bug in Chrome/FF).\n        var isCurrentlyAnimating = formerData.running > 0 || animationEvent == 'setClass';\n        if(transitionDuration > 0) {\n          blockTransitions(element, className, isCurrentlyAnimating);\n        }\n\n        //staggering keyframe animations work by adjusting the `animation-delay` CSS property\n        //on the given element, however, the delay value can only calculated after the reflow\n        //since by that time $animate knows how many elements are being animated. Therefore,\n        //until the reflow occurs the element needs to be blocked (where the keyframe animation\n        //is set to `none 0s`). This blocking mechanism should only be set for when a stagger\n        //animation is detected and when the element item index is greater than 0.\n        if(animationDuration > 0 && stagger.animationDelay > 0 && stagger.animationDuration === 0) {\n          blockKeyframeAnimations(element);\n        }\n\n        return true;\n      }\n\n      function isStructuralAnimation(className) {\n        return className == 'ng-enter' || className == 'ng-move' || className == 'ng-leave';\n      }\n\n      function blockTransitions(element, className, isAnimating) {\n        if(isStructuralAnimation(className) || !isAnimating) {\n          extractElementNode(element).style[TRANSITION_PROP + PROPERTY_KEY] = 'none';\n        } else {\n          element.addClass(NG_ANIMATE_BLOCK_CLASS_NAME);\n        }\n      }\n\n      function blockKeyframeAnimations(element) {\n        extractElementNode(element).style[ANIMATION_PROP] = 'none 0s';\n      }\n\n      function unblockTransitions(element, className) {\n        var prop = TRANSITION_PROP + PROPERTY_KEY;\n        var node = extractElementNode(element);\n        if(node.style[prop] && node.style[prop].length > 0) {\n          node.style[prop] = '';\n        }\n        element.removeClass(NG_ANIMATE_BLOCK_CLASS_NAME);\n      }\n\n      function unblockKeyframeAnimations(element) {\n        var prop = ANIMATION_PROP;\n        var node = extractElementNode(element);\n        if(node.style[prop] && node.style[prop].length > 0) {\n          node.style[prop] = '';\n        }\n      }\n\n      function animateRun(animationEvent, element, className, activeAnimationComplete) {\n        var node = extractElementNode(element);\n        var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);\n        if(node.getAttribute('class').indexOf(className) == -1 || !elementData) {\n          activeAnimationComplete();\n          return;\n        }\n\n        var activeClassName = '';\n        forEach(className.split(' '), function(klass, i) {\n          activeClassName += (i > 0 ? ' ' : '') + klass + '-active';\n        });\n\n        var stagger = elementData.stagger;\n        var timings = elementData.timings;\n        var itemIndex = elementData.itemIndex;\n        var maxDuration = Math.max(timings.transitionDuration, timings.animationDuration);\n        var maxDelay = Math.max(timings.transitionDelay, timings.animationDelay);\n        var maxDelayTime = maxDelay * ONE_SECOND;\n\n        var startTime = Date.now();\n        var css3AnimationEvents = ANIMATIONEND_EVENT + ' ' + TRANSITIONEND_EVENT;\n\n        var style = '', appliedStyles = [];\n        if(timings.transitionDuration > 0) {\n          var propertyStyle = timings.transitionPropertyStyle;\n          if(propertyStyle.indexOf('all') == -1) {\n            style += CSS_PREFIX + 'transition-property: ' + propertyStyle + ';';\n            style += CSS_PREFIX + 'transition-duration: ' + timings.transitionDurationStyle + ';';\n            appliedStyles.push(CSS_PREFIX + 'transition-property');\n            appliedStyles.push(CSS_PREFIX + 'transition-duration');\n          }\n        }\n\n        if(itemIndex > 0) {\n          if(stagger.transitionDelay > 0 && stagger.transitionDuration === 0) {\n            var delayStyle = timings.transitionDelayStyle;\n            style += CSS_PREFIX + 'transition-delay: ' +\n                     prepareStaggerDelay(delayStyle, stagger.transitionDelay, itemIndex) + '; ';\n            appliedStyles.push(CSS_PREFIX + 'transition-delay');\n          }\n\n          if(stagger.animationDelay > 0 && stagger.animationDuration === 0) {\n            style += CSS_PREFIX + 'animation-delay: ' +\n                     prepareStaggerDelay(timings.animationDelayStyle, stagger.animationDelay, itemIndex) + '; ';\n            appliedStyles.push(CSS_PREFIX + 'animation-delay');\n          }\n        }\n\n        if(appliedStyles.length > 0) {\n          //the element being animated may sometimes contain comment nodes in\n          //the jqLite object, so we're safe to use a single variable to house\n          //the styles since there is always only one element being animated\n          var oldStyle = node.getAttribute('style') || '';\n          node.setAttribute('style', oldStyle + '; ' + style);\n        }\n\n        element.on(css3AnimationEvents, onAnimationProgress);\n        element.addClass(activeClassName);\n        elementData.closeAnimationFn = function() {\n          onEnd();\n          activeAnimationComplete();\n        };\n\n        var staggerTime       = itemIndex * (Math.max(stagger.animationDelay, stagger.transitionDelay) || 0);\n        var animationTime     = (maxDelay + maxDuration) * CLOSING_TIME_BUFFER;\n        var totalTime         = (staggerTime + animationTime) * ONE_SECOND;\n\n        elementData.running++;\n        animationCloseHandler(element, totalTime);\n        return onEnd;\n\n        // This will automatically be called by $animate so\n        // there is no need to attach this internally to the\n        // timeout done method.\n        function onEnd(cancelled) {\n          element.off(css3AnimationEvents, onAnimationProgress);\n          element.removeClass(activeClassName);\n          animateClose(element, className);\n          var node = extractElementNode(element);\n          for (var i in appliedStyles) {\n            node.style.removeProperty(appliedStyles[i]);\n          }\n        }\n\n        function onAnimationProgress(event) {\n          event.stopPropagation();\n          var ev = event.originalEvent || event;\n          var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();\n\n          /* Firefox (or possibly just Gecko) likes to not round values up\n           * when a ms measurement is used for the animation */\n          var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));\n\n          /* $manualTimeStamp is a mocked timeStamp value which is set\n           * within browserTrigger(). This is only here so that tests can\n           * mock animations properly. Real events fallback to event.timeStamp,\n           * or, if they don't, then a timeStamp is automatically created for them.\n           * We're checking to see if the timeStamp surpasses the expected delay,\n           * but we're using elapsedTime instead of the timeStamp on the 2nd\n           * pre-condition since animations sometimes close off early */\n          if(Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {\n            activeAnimationComplete();\n          }\n        }\n      }\n\n      function prepareStaggerDelay(delayStyle, staggerDelay, index) {\n        var style = '';\n        forEach(delayStyle.split(','), function(val, i) {\n          style += (i > 0 ? ',' : '') +\n                   (index * staggerDelay + parseInt(val, 10)) + 's';\n        });\n        return style;\n      }\n\n      function animateBefore(animationEvent, element, className, calculationDecorator) {\n        if(animateSetup(animationEvent, element, className, calculationDecorator)) {\n          return function(cancelled) {\n            cancelled && animateClose(element, className);\n          };\n        }\n      }\n\n      function animateAfter(animationEvent, element, className, afterAnimationComplete) {\n        if(element.data(NG_ANIMATE_CSS_DATA_KEY)) {\n          return animateRun(animationEvent, element, className, afterAnimationComplete);\n        } else {\n          animateClose(element, className);\n          afterAnimationComplete();\n        }\n      }\n\n      function animate(animationEvent, element, className, animationComplete) {\n        //If the animateSetup function doesn't bother returning a\n        //cancellation function then it means that there is no animation\n        //to perform at all\n        var preReflowCancellation = animateBefore(animationEvent, element, className);\n        if(!preReflowCancellation) {\n          animationComplete();\n          return;\n        }\n\n        //There are two cancellation functions: one is before the first\n        //reflow animation and the second is during the active state\n        //animation. The first function will take care of removing the\n        //data from the element which will not make the 2nd animation\n        //happen in the first place\n        var cancel = preReflowCancellation;\n        afterReflow(element, function() {\n          unblockTransitions(element, className);\n          unblockKeyframeAnimations(element);\n          //once the reflow is complete then we point cancel to\n          //the new cancellation function which will remove all of the\n          //animation properties from the active animation\n          cancel = animateAfter(animationEvent, element, className, animationComplete);\n        });\n\n        return function(cancelled) {\n          (cancel || noop)(cancelled);\n        };\n      }\n\n      function animateClose(element, className) {\n        element.removeClass(className);\n        var data = element.data(NG_ANIMATE_CSS_DATA_KEY);\n        if(data) {\n          if(data.running) {\n            data.running--;\n          }\n          if(!data.running || data.running === 0) {\n            element.removeData(NG_ANIMATE_CSS_DATA_KEY);\n          }\n        }\n      }\n\n      return {\n        enter : function(element, animationCompleted) {\n          return animate('enter', element, 'ng-enter', animationCompleted);\n        },\n\n        leave : function(element, animationCompleted) {\n          return animate('leave', element, 'ng-leave', animationCompleted);\n        },\n\n        move : function(element, animationCompleted) {\n          return animate('move', element, 'ng-move', animationCompleted);\n        },\n\n        beforeSetClass : function(element, add, remove, animationCompleted) {\n          var className = suffixClasses(remove, '-remove') + ' ' +\n                          suffixClasses(add, '-add');\n          var cancellationMethod = animateBefore('setClass', element, className, function(fn) {\n            /* when classes are removed from an element then the transition style\n             * that is applied is the transition defined on the element without the\n             * CSS class being there. This is how CSS3 functions outside of ngAnimate.\n             * http://plnkr.co/edit/j8OzgTNxHTb4n3zLyjGW?p=preview */\n            var klass = element.attr('class');\n            element.removeClass(remove);\n            element.addClass(add);\n            var timings = fn();\n            element.attr('class', klass);\n            return timings;\n          });\n\n          if(cancellationMethod) {\n            afterReflow(element, function() {\n              unblockTransitions(element, className);\n              unblockKeyframeAnimations(element);\n              animationCompleted();\n            });\n            return cancellationMethod;\n          }\n          animationCompleted();\n        },\n\n        beforeAddClass : function(element, className, animationCompleted) {\n          var cancellationMethod = animateBefore('addClass', element, suffixClasses(className, '-add'), function(fn) {\n\n            /* when a CSS class is added to an element then the transition style that\n             * is applied is the transition defined on the element when the CSS class\n             * is added at the time of the animation. This is how CSS3 functions\n             * outside of ngAnimate. */\n            element.addClass(className);\n            var timings = fn();\n            element.removeClass(className);\n            return timings;\n          });\n\n          if(cancellationMethod) {\n            afterReflow(element, function() {\n              unblockTransitions(element, className);\n              unblockKeyframeAnimations(element);\n              animationCompleted();\n            });\n            return cancellationMethod;\n          }\n          animationCompleted();\n        },\n\n        setClass : function(element, add, remove, animationCompleted) {\n          remove = suffixClasses(remove, '-remove');\n          add = suffixClasses(add, '-add');\n          var className = remove + ' ' + add;\n          return animateAfter('setClass', element, className, animationCompleted);\n        },\n\n        addClass : function(element, className, animationCompleted) {\n          return animateAfter('addClass', element, suffixClasses(className, '-add'), animationCompleted);\n        },\n\n        beforeRemoveClass : function(element, className, animationCompleted) {\n          var cancellationMethod = animateBefore('removeClass', element, suffixClasses(className, '-remove'), function(fn) {\n            /* when classes are removed from an element then the transition style\n             * that is applied is the transition defined on the element without the\n             * CSS class being there. This is how CSS3 functions outside of ngAnimate.\n             * http://plnkr.co/edit/j8OzgTNxHTb4n3zLyjGW?p=preview */\n            var klass = element.attr('class');\n            element.removeClass(className);\n            var timings = fn();\n            element.attr('class', klass);\n            return timings;\n          });\n\n          if(cancellationMethod) {\n            afterReflow(element, function() {\n              unblockTransitions(element, className);\n              unblockKeyframeAnimations(element);\n              animationCompleted();\n            });\n            return cancellationMethod;\n          }\n          animationCompleted();\n        },\n\n        removeClass : function(element, className, animationCompleted) {\n          return animateAfter('removeClass', element, suffixClasses(className, '-remove'), animationCompleted);\n        }\n      };\n\n      function suffixClasses(classes, suffix) {\n        var className = '';\n        classes = angular.isArray(classes) ? classes : classes.split(/\\s+/);\n        forEach(classes, function(klass, i) {\n          if(klass && klass.length > 0) {\n            className += (i > 0 ? ' ' : '') + klass + suffix;\n          }\n        });\n        return className;\n      }\n    }]);\n  }]);\n\n\n})(window, window.angular);\n"
  },
  {
    "path": "www/lib/angular-animate/bower.json",
    "content": "{\n  \"name\": \"angular-animate\",\n  \"version\": \"1.2.24\",\n  \"main\": \"./angular-animate.js\",\n  \"dependencies\": {\n    \"angular\": \"1.2.24\"\n  }\n}\n"
  },
  {
    "path": "www/lib/angular-sanitize/.bower.json",
    "content": "{\n  \"name\": \"angular-sanitize\",\n  \"version\": \"1.2.24\",\n  \"main\": \"./angular-sanitize.js\",\n  \"dependencies\": {\n    \"angular\": \"1.2.24\"\n  },\n  \"homepage\": \"https://github.com/angular/bower-angular-sanitize\",\n  \"_release\": \"1.2.24\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.2.24\",\n    \"commit\": \"0cf487e8e13ff5d61388ed7359bed7386724385e\"\n  },\n  \"_source\": \"git://github.com/angular/bower-angular-sanitize.git\",\n  \"_target\": \"~1.2.17\",\n  \"_originalSource\": \"angular-sanitize\"\n}"
  },
  {
    "path": "www/lib/angular-sanitize/README.md",
    "content": "# bower-angular-sanitize\n\nThis repo is for distribution on `bower`. The source for this module is in the\n[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngSanitize).\nPlease file issues and pull requests against that repo.\n\n## Install\n\nInstall with `bower`:\n\n```shell\nbower install angular-sanitize\n```\n\nAdd a `<script>` to your `index.html`:\n\n```html\n<script src=\"/bower_components/angular-sanitize/angular-sanitize.js\"></script>\n```\n\nAnd add `ngSanitize` as a dependency for your app:\n\n```javascript\nangular.module('myApp', ['ngSanitize']);\n```\n\n## Documentation\n\nDocumentation is available on the\n[AngularJS docs site](http://docs.angularjs.org/api/ngSanitize).\n\n## License\n\nThe MIT License\n\nCopyright (c) 2010-2012 Google, Inc. http://angularjs.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "www/lib/angular-sanitize/angular-sanitize.js",
    "content": "/**\n * @license AngularJS v1.2.24\n * (c) 2010-2014 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\nvar $sanitizeMinErr = angular.$$minErr('$sanitize');\n\n/**\n * @ngdoc module\n * @name ngSanitize\n * @description\n *\n * # ngSanitize\n *\n * The `ngSanitize` module provides functionality to sanitize HTML.\n *\n *\n * <div doc-module-components=\"ngSanitize\"></div>\n *\n * See {@link ngSanitize.$sanitize `$sanitize`} for usage.\n */\n\n/*\n * HTML Parser By Misko Hevery (misko@hevery.com)\n * based on:  HTML Parser By John Resig (ejohn.org)\n * Original code by Erik Arvidsson, Mozilla Public License\n * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js\n *\n * // Use like so:\n * htmlParser(htmlString, {\n *     start: function(tag, attrs, unary) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * });\n *\n */\n\n\n/**\n * @ngdoc service\n * @name $sanitize\n * @kind function\n *\n * @description\n *   The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are\n *   then serialized back to properly escaped html string. This means that no unsafe input can make\n *   it into the returned string, however, since our parser is more strict than a typical browser\n *   parser, it's possible that some obscure input, which would be recognized as valid HTML by a\n *   browser, won't make it through the sanitizer.\n *   The whitelist is configured using the functions `aHrefSanitizationWhitelist` and\n *   `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.\n *\n * @param {string} html Html input.\n * @returns {string} Sanitized html.\n *\n * @example\n   <example module=\"sanitizeExample\" deps=\"angular-sanitize.js\">\n   <file name=\"index.html\">\n     <script>\n         angular.module('sanitizeExample', ['ngSanitize'])\n           .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {\n             $scope.snippet =\n               '<p style=\"color:blue\">an html\\n' +\n               '<em onmouseover=\"this.textContent=\\'PWN3D!\\'\">click here</em>\\n' +\n               'snippet</p>';\n             $scope.deliberatelyTrustDangerousSnippet = function() {\n               return $sce.trustAsHtml($scope.snippet);\n             };\n           }]);\n     </script>\n     <div ng-controller=\"ExampleController\">\n        Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <td>Directive</td>\n           <td>How</td>\n           <td>Source</td>\n           <td>Rendered</td>\n         </tr>\n         <tr id=\"bind-html-with-sanitize\">\n           <td>ng-bind-html</td>\n           <td>Automatically uses $sanitize</td>\n           <td><pre>&lt;div ng-bind-html=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind-html=\"snippet\"></div></td>\n         </tr>\n         <tr id=\"bind-html-with-trust\">\n           <td>ng-bind-html</td>\n           <td>Bypass $sanitize by explicitly trusting the dangerous value</td>\n           <td>\n           <pre>&lt;div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"&gt;\n&lt;/div&gt;</pre>\n           </td>\n           <td><div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"></div></td>\n         </tr>\n         <tr id=\"bind-default\">\n           <td>ng-bind</td>\n           <td>Automatically escapes</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n       </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should sanitize the html snippet by default', function() {\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('<p>an html\\n<em>click here</em>\\nsnippet</p>');\n     });\n\n     it('should inline raw snippet if bound to a trusted value', function() {\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).\n         toBe(\"<p style=\\\"color:blue\\\">an html\\n\" +\n              \"<em onmouseover=\\\"this.textContent='PWN3D!'\\\">click here</em>\\n\" +\n              \"snippet</p>\");\n     });\n\n     it('should escape snippet without any filter', function() {\n       expect(element(by.css('#bind-default div')).getInnerHtml()).\n         toBe(\"&lt;p style=\\\"color:blue\\\"&gt;an html\\n\" +\n              \"&lt;em onmouseover=\\\"this.textContent='PWN3D!'\\\"&gt;click here&lt;/em&gt;\\n\" +\n              \"snippet&lt;/p&gt;\");\n     });\n\n     it('should update', function() {\n       element(by.model('snippet')).clear();\n       element(by.model('snippet')).sendKeys('new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('new <b>text</b>');\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(\n         'new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(\n         \"new &lt;b onclick=\\\"alert(1)\\\"&gt;text&lt;/b&gt;\");\n     });\n   </file>\n   </example>\n */\nfunction $SanitizeProvider() {\n  this.$get = ['$$sanitizeUri', function($$sanitizeUri) {\n    return function(html) {\n      var buf = [];\n      htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {\n        return !/^unsafe/.test($$sanitizeUri(uri, isImage));\n      }));\n      return buf.join('');\n    };\n  }];\n}\n\nfunction sanitizeText(chars) {\n  var buf = [];\n  var writer = htmlSanitizeWriter(buf, angular.noop);\n  writer.chars(chars);\n  return buf.join('');\n}\n\n\n// Regular Expressions for parsing tags and attributes\nvar START_TAG_REGEXP =\n       /^<((?:[a-zA-Z])[\\w:-]*)((?:\\s+[\\w:-]+(?:\\s*=\\s*(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)*)\\s*(\\/?)\\s*(>?)/,\n  END_TAG_REGEXP = /^<\\/\\s*([\\w:-]+)[^>]*>/,\n  ATTR_REGEXP = /([\\w:-]+)(?:\\s*=\\s*(?:(?:\"((?:[^\"])*)\")|(?:'((?:[^'])*)')|([^>\\s]+)))?/g,\n  BEGIN_TAG_REGEXP = /^</,\n  BEGING_END_TAGE_REGEXP = /^<\\//,\n  COMMENT_REGEXP = /<!--(.*?)-->/g,\n  DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i,\n  CDATA_REGEXP = /<!\\[CDATA\\[(.*?)]]>/g,\n  SURROGATE_PAIR_REGEXP = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\n  // Match everything outside of normal chars and \" (quote character)\n  NON_ALPHANUMERIC_REGEXP = /([^\\#-~| |!])/g;\n\n\n// Good source of info about elements and attributes\n// http://dev.w3.org/html5/spec/Overview.html#semantics\n// http://simon.html5.org/html-elements\n\n// Safe Void Elements - HTML5\n// http://dev.w3.org/html5/spec/Overview.html#void-elements\nvar voidElements = makeMap(\"area,br,col,hr,img,wbr\");\n\n// Elements that you can, intentionally, leave open (and which close themselves)\n// http://dev.w3.org/html5/spec/Overview.html#optional-tags\nvar optionalEndTagBlockElements = makeMap(\"colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr\"),\n    optionalEndTagInlineElements = makeMap(\"rp,rt\"),\n    optionalEndTagElements = angular.extend({},\n                                            optionalEndTagInlineElements,\n                                            optionalEndTagBlockElements);\n\n// Safe Block Elements - HTML5\nvar blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap(\"address,article,\" +\n        \"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,\" +\n        \"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul\"));\n\n// Inline Elements - HTML5\nvar inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap(\"a,abbr,acronym,b,\" +\n        \"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,\" +\n        \"samp,small,span,strike,strong,sub,sup,time,tt,u,var\"));\n\n\n// Special Elements (can contain anything)\nvar specialElements = makeMap(\"script,style\");\n\nvar validElements = angular.extend({},\n                                   voidElements,\n                                   blockElements,\n                                   inlineElements,\n                                   optionalEndTagElements);\n\n//Attributes that have href and hence need to be sanitized\nvar uriAttrs = makeMap(\"background,cite,href,longdesc,src,usemap\");\nvar validAttrs = angular.extend({}, uriAttrs, makeMap(\n    'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+\n    'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+\n    'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+\n    'scope,scrolling,shape,size,span,start,summary,target,title,type,'+\n    'valign,value,vspace,width'));\n\nfunction makeMap(str) {\n  var obj = {}, items = str.split(','), i;\n  for (i = 0; i < items.length; i++) obj[items[i]] = true;\n  return obj;\n}\n\n\n/**\n * @example\n * htmlParser(htmlString, {\n *     start: function(tag, attrs, unary) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * });\n *\n * @param {string} html string\n * @param {object} handler\n */\nfunction htmlParser( html, handler ) {\n  if (typeof html !== 'string') {\n    if (html === null || typeof html === 'undefined') {\n      html = '';\n    } else {\n      html = '' + html;\n    }\n  }\n  var index, chars, match, stack = [], last = html, text;\n  stack.last = function() { return stack[ stack.length - 1 ]; };\n\n  while ( html ) {\n    text = '';\n    chars = true;\n\n    // Make sure we're not in a script or style element\n    if ( !stack.last() || !specialElements[ stack.last() ] ) {\n\n      // Comment\n      if ( html.indexOf(\"<!--\") === 0 ) {\n        // comments containing -- are not allowed unless they terminate the comment\n        index = html.indexOf(\"--\", 4);\n\n        if ( index >= 0 && html.lastIndexOf(\"-->\", index) === index) {\n          if (handler.comment) handler.comment( html.substring( 4, index ) );\n          html = html.substring( index + 3 );\n          chars = false;\n        }\n      // DOCTYPE\n      } else if ( DOCTYPE_REGEXP.test(html) ) {\n        match = html.match( DOCTYPE_REGEXP );\n\n        if ( match ) {\n          html = html.replace( match[0], '');\n          chars = false;\n        }\n      // end tag\n      } else if ( BEGING_END_TAGE_REGEXP.test(html) ) {\n        match = html.match( END_TAG_REGEXP );\n\n        if ( match ) {\n          html = html.substring( match[0].length );\n          match[0].replace( END_TAG_REGEXP, parseEndTag );\n          chars = false;\n        }\n\n      // start tag\n      } else if ( BEGIN_TAG_REGEXP.test(html) ) {\n        match = html.match( START_TAG_REGEXP );\n\n        if ( match ) {\n          // We only have a valid start-tag if there is a '>'.\n          if ( match[4] ) {\n            html = html.substring( match[0].length );\n            match[0].replace( START_TAG_REGEXP, parseStartTag );\n          }\n          chars = false;\n        } else {\n          // no ending tag found --- this piece should be encoded as an entity.\n          text += '<';\n          html = html.substring(1);\n        }\n      }\n\n      if ( chars ) {\n        index = html.indexOf(\"<\");\n\n        text += index < 0 ? html : html.substring( 0, index );\n        html = index < 0 ? \"\" : html.substring( index );\n\n        if (handler.chars) handler.chars( decodeEntities(text) );\n      }\n\n    } else {\n      html = html.replace(new RegExp(\"(.*)<\\\\s*\\\\/\\\\s*\" + stack.last() + \"[^>]*>\", 'i'),\n        function(all, text){\n          text = text.replace(COMMENT_REGEXP, \"$1\").replace(CDATA_REGEXP, \"$1\");\n\n          if (handler.chars) handler.chars( decodeEntities(text) );\n\n          return \"\";\n      });\n\n      parseEndTag( \"\", stack.last() );\n    }\n\n    if ( html == last ) {\n      throw $sanitizeMinErr('badparse', \"The sanitizer was unable to parse the following block \" +\n                                        \"of html: {0}\", html);\n    }\n    last = html;\n  }\n\n  // Clean up any remaining tags\n  parseEndTag();\n\n  function parseStartTag( tag, tagName, rest, unary ) {\n    tagName = angular.lowercase(tagName);\n    if ( blockElements[ tagName ] ) {\n      while ( stack.last() && inlineElements[ stack.last() ] ) {\n        parseEndTag( \"\", stack.last() );\n      }\n    }\n\n    if ( optionalEndTagElements[ tagName ] && stack.last() == tagName ) {\n      parseEndTag( \"\", tagName );\n    }\n\n    unary = voidElements[ tagName ] || !!unary;\n\n    if ( !unary )\n      stack.push( tagName );\n\n    var attrs = {};\n\n    rest.replace(ATTR_REGEXP,\n      function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {\n        var value = doubleQuotedValue\n          || singleQuotedValue\n          || unquotedValue\n          || '';\n\n        attrs[name] = decodeEntities(value);\n    });\n    if (handler.start) handler.start( tagName, attrs, unary );\n  }\n\n  function parseEndTag( tag, tagName ) {\n    var pos = 0, i;\n    tagName = angular.lowercase(tagName);\n    if ( tagName )\n      // Find the closest opened tag of the same type\n      for ( pos = stack.length - 1; pos >= 0; pos-- )\n        if ( stack[ pos ] == tagName )\n          break;\n\n    if ( pos >= 0 ) {\n      // Close all the open elements, up the stack\n      for ( i = stack.length - 1; i >= pos; i-- )\n        if (handler.end) handler.end( stack[ i ] );\n\n      // Remove the open elements from the stack\n      stack.length = pos;\n    }\n  }\n}\n\nvar hiddenPre=document.createElement(\"pre\");\nvar spaceRe = /^(\\s*)([\\s\\S]*?)(\\s*)$/;\n/**\n * decodes all entities into regular string\n * @param value\n * @returns {string} A string with decoded entities.\n */\nfunction decodeEntities(value) {\n  if (!value) { return ''; }\n\n  // Note: IE8 does not preserve spaces at the start/end of innerHTML\n  // so we must capture them and reattach them afterward\n  var parts = spaceRe.exec(value);\n  var spaceBefore = parts[1];\n  var spaceAfter = parts[3];\n  var content = parts[2];\n  if (content) {\n    hiddenPre.innerHTML=content.replace(/</g,\"&lt;\");\n    // innerText depends on styling as it doesn't display hidden elements.\n    // Therefore, it's better to use textContent not to cause unnecessary\n    // reflows. However, IE<9 don't support textContent so the innerText\n    // fallback is necessary.\n    content = 'textContent' in hiddenPre ?\n      hiddenPre.textContent : hiddenPre.innerText;\n  }\n  return spaceBefore + content + spaceAfter;\n}\n\n/**\n * Escapes all potentially dangerous characters, so that the\n * resulting string can be safely inserted into attribute or\n * element text.\n * @param value\n * @returns {string} escaped text\n */\nfunction encodeEntities(value) {\n  return value.\n    replace(/&/g, '&amp;').\n    replace(SURROGATE_PAIR_REGEXP, function (value) {\n      var hi = value.charCodeAt(0);\n      var low = value.charCodeAt(1);\n      return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';\n    }).\n    replace(NON_ALPHANUMERIC_REGEXP, function(value){\n      return '&#' + value.charCodeAt(0) + ';';\n    }).\n    replace(/</g, '&lt;').\n    replace(/>/g, '&gt;');\n}\n\n/**\n * create an HTML/XML writer which writes to buffer\n * @param {Array} buf use buf.jain('') to get out sanitized html string\n * @returns {object} in the form of {\n *     start: function(tag, attrs, unary) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * }\n */\nfunction htmlSanitizeWriter(buf, uriValidator){\n  var ignore = false;\n  var out = angular.bind(buf, buf.push);\n  return {\n    start: function(tag, attrs, unary){\n      tag = angular.lowercase(tag);\n      if (!ignore && specialElements[tag]) {\n        ignore = tag;\n      }\n      if (!ignore && validElements[tag] === true) {\n        out('<');\n        out(tag);\n        angular.forEach(attrs, function(value, key){\n          var lkey=angular.lowercase(key);\n          var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');\n          if (validAttrs[lkey] === true &&\n            (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {\n            out(' ');\n            out(key);\n            out('=\"');\n            out(encodeEntities(value));\n            out('\"');\n          }\n        });\n        out(unary ? '/>' : '>');\n      }\n    },\n    end: function(tag){\n        tag = angular.lowercase(tag);\n        if (!ignore && validElements[tag] === true) {\n          out('</');\n          out(tag);\n          out('>');\n        }\n        if (tag == ignore) {\n          ignore = false;\n        }\n      },\n    chars: function(chars){\n        if (!ignore) {\n          out(encodeEntities(chars));\n        }\n      }\n  };\n}\n\n\n// define ngSanitize module and register $sanitize service\nangular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);\n\n/* global sanitizeText: false */\n\n/**\n * @ngdoc filter\n * @name linky\n * @kind function\n *\n * @description\n * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and\n * plain email address links.\n *\n * Requires the {@link ngSanitize `ngSanitize`} module to be installed.\n *\n * @param {string} text Input text.\n * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in.\n * @returns {string} Html-linkified text.\n *\n * @usage\n   <span ng-bind-html=\"linky_expression | linky\"></span>\n *\n * @example\n   <example module=\"linkyExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('linkyExample', ['ngSanitize'])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.snippet =\n               'Pretty text with some links:\\n'+\n               'http://angularjs.org/,\\n'+\n               'mailto:us@somewhere.org,\\n'+\n               'another@somewhere.org,\\n'+\n               'and one more: ftp://127.0.0.1/.';\n             $scope.snippetWithTarget = 'http://angularjs.org/';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n       Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <td>Filter</td>\n           <td>Source</td>\n           <td>Rendered</td>\n         </tr>\n         <tr id=\"linky-filter\">\n           <td>linky filter</td>\n           <td>\n             <pre>&lt;div ng-bind-html=\"snippet | linky\"&gt;<br>&lt;/div&gt;</pre>\n           </td>\n           <td>\n             <div ng-bind-html=\"snippet | linky\"></div>\n           </td>\n         </tr>\n         <tr id=\"linky-target\">\n          <td>linky target</td>\n          <td>\n            <pre>&lt;div ng-bind-html=\"snippetWithTarget | linky:'_blank'\"&gt;<br>&lt;/div&gt;</pre>\n          </td>\n          <td>\n            <div ng-bind-html=\"snippetWithTarget | linky:'_blank'\"></div>\n          </td>\n         </tr>\n         <tr id=\"escaped-html\">\n           <td>no filter</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should linkify the snippet with urls', function() {\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);\n       });\n\n       it('should not linkify snippet without the linky filter', function() {\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);\n       });\n\n       it('should update', function() {\n         element(by.model('snippet')).clear();\n         element(by.model('snippet')).sendKeys('new http://link.');\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('new http://link.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())\n             .toBe('new http://link.');\n       });\n\n       it('should work with the target property', function() {\n        expect(element(by.id('linky-target')).\n            element(by.binding(\"snippetWithTarget | linky:'_blank'\")).getText()).\n            toBe('http://angularjs.org/');\n        expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');\n       });\n     </file>\n   </example>\n */\nangular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {\n  var LINKY_URL_REGEXP =\n        /((ftp|https?):\\/\\/|(mailto:)?[A-Za-z0-9._%+-]+@)\\S*[^\\s.;,(){}<>\"]/,\n      MAILTO_REGEXP = /^mailto:/;\n\n  return function(text, target) {\n    if (!text) return text;\n    var match;\n    var raw = text;\n    var html = [];\n    var url;\n    var i;\n    while ((match = raw.match(LINKY_URL_REGEXP))) {\n      // We can not end in these as they are sometimes found at the end of the sentence\n      url = match[0];\n      // if we did not match ftp/http/mailto then assume mailto\n      if (match[2] == match[3]) url = 'mailto:' + url;\n      i = match.index;\n      addText(raw.substr(0, i));\n      addLink(url, match[0].replace(MAILTO_REGEXP, ''));\n      raw = raw.substring(i + match[0].length);\n    }\n    addText(raw);\n    return $sanitize(html.join(''));\n\n    function addText(text) {\n      if (!text) {\n        return;\n      }\n      html.push(sanitizeText(text));\n    }\n\n    function addLink(url, text) {\n      html.push('<a ');\n      if (angular.isDefined(target)) {\n        html.push('target=\"');\n        html.push(target);\n        html.push('\" ');\n      }\n      html.push('href=\"');\n      html.push(url);\n      html.push('\">');\n      addText(text);\n      html.push('</a>');\n    }\n  };\n}]);\n\n\n})(window, window.angular);\n"
  },
  {
    "path": "www/lib/angular-sanitize/bower.json",
    "content": "{\n  \"name\": \"angular-sanitize\",\n  \"version\": \"1.2.24\",\n  \"main\": \"./angular-sanitize.js\",\n  \"dependencies\": {\n    \"angular\": \"1.2.24\"\n  }\n}\n"
  },
  {
    "path": "www/lib/angular-ui-router/.bower.json",
    "content": "{\n  \"name\": \"angular-ui-router\",\n  \"version\": \"0.2.10\",\n  \"main\": \"./release/angular-ui-router.js\",\n  \"dependencies\": {\n    \"angular\": \">= 1.0.8\"\n  },\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"component.json\",\n    \"package.json\",\n    \"lib\",\n    \"config\",\n    \"sample\",\n    \"test\",\n    \"tests\",\n    \"ngdoc_assets\",\n    \"Gruntfile.js\",\n    \"files.js\"\n  ],\n  \"homepage\": \"https://github.com/angular-ui/ui-router\",\n  \"_release\": \"0.2.10\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"0.2.10\",\n    \"commit\": \"4f509d6393452c933aa5908939d0a17e47b59388\"\n  },\n  \"_source\": \"git://github.com/angular-ui/ui-router.git\",\n  \"_target\": \"0.2.10\",\n  \"_originalSource\": \"angular-ui-router\"\n}"
  },
  {
    "path": "www/lib/angular-ui-router/CHANGELOG.md",
    "content": "<a name=\"v0.2.8\"></a>\n### v0.2.8 (2014-01-16)\n\n\n#### Bug Fixes\n\n* **$state:** allow null to be passed as 'params' param ([094dc30e](https://github.com/angular-ui/ui-router/commit/094dc30e883e1bd14e50a475553bafeaade3b178))\n* **$state.go:** param inheritance shouldn't inherit from siblings ([aea872e0](https://github.com/angular-ui/ui-router/commit/aea872e0b983cb433436ce5875df10c838fccedb))\n* **uiSrefActive:** annotate controller injection ([85921422](https://github.com/angular-ui/ui-router/commit/85921422ff7fb0effed358136426d616cce3d583), closes [#671](https://github.com/angular-ui/ui-router/issues/671))\n* **uiView:**\n  * autoscroll tests pass on 1.2.4 & 1.1.5 ([86eacac0](https://github.com/angular-ui/ui-router/commit/86eacac09ca5e9000bd3b9c7ba6e2cc95d883a3a))\n  * don't animate initial load ([83b6634d](https://github.com/angular-ui/ui-router/commit/83b6634d27942ca74766b2b1244a7fc52c5643d9))\n  * test pass against 1.0.8 and 1.2.4 ([a402415a](https://github.com/angular-ui/ui-router/commit/a402415a2a28b360c43b9fe8f4f54c540f6c33de))\n  * it should autoscroll when expr is missing. ([8bb9e27a](https://github.com/angular-ui/ui-router/commit/8bb9e27a2986725f45daf44c4c9f846385095aff))\n\n\n#### Features\n\n* **uiSref:** add target attribute behaviour ([c12bf9a5](https://github.com/angular-ui/ui-router/commit/c12bf9a520d30d70294e3d82de7661900f8e394e))\n* **uiView:**\n  * merge autoscroll expression test. ([b89e0f87](https://github.com/angular-ui/ui-router/commit/b89e0f871d5cc35c10925ede986c10684d5c9252))\n  * cache and test autoscroll expression ([ee262282](https://github.com/angular-ui/ui-router/commit/ee2622828c2ce83807f006a459ac4e11406d9258))\n\n"
  },
  {
    "path": "www/lib/angular-ui-router/LICENSE",
    "content": "The MIT License\n\nCopyright (c) 2014 The AngularUI Team, Karsten Sperling\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "www/lib/angular-ui-router/README.md",
    "content": "# AngularUI Router &nbsp;[![Build Status](https://travis-ci.org/angular-ui/ui-router.png?branch=master)](https://travis-ci.org/angular-ui/ui-router)\n\n#### The de-facto solution to flexible routing with nested views\n---\n**[Download 0.2.10](http://angular-ui.github.io/ui-router/release/angular-ui-router.js)** (or **[Minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js)**) **|**\n**[Learn](#resources) |**\n**[API](http://angular-ui.github.io/ui-router/site) |**\n**[Discuss](https://groups.google.com/forum/#!categories/angular-ui/router) |**\n**[Get Help](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) |**\n**[Report an Issue](#report-an-issue) |**\n**[Contribute](#contribute)**\n\n---\n\nAngularUI Router is a routing framework for [AngularJS](http://angularjs.org), which allows you to organize the\nparts of your interface into a [*state machine*](https://en.wikipedia.org/wiki/Finite-state_machine). Unlike the\n[`$route` service](http://docs.angularjs.org/api/ngRoute.$route) in Angular core, which is organized around URL\nroutes, UI-Router is organized around [*states*](https://github.com/angular-ui/ui-router/blob/master/sample/states.js#L28-L269),\nwhich may optionally have routes, as well as other behavior, attached.\n\nStates are bound to *named*, *nested* and *parallel views*, allowing you to powerfully manage your application's interface.\n\n-\n**Note:** *UI-Router is under active development. As such, while this library is well-tested, the API may change. Consider using it in production applications only if you're comfortable following a changelog and updating your usage accordingly.*\n\n\n## Get Started\n\n**(1)** Get UI-Router in one of 4 ways:\n - clone & [build](#developing) this repository\n - [download the release](http://angular-ui.github.io/ui-router/release/angular-ui-router.js) (or [minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js))\n - via **[Bower](http://bower.io/)**: by running `$ bower install angular-ui-router` from your console\n - or via **[Component](https://github.com/component/component)**: by running `$ component install angular-ui/ui-router` from your console\n\n**(2)** Include `angular-ui-router.js` (or `angular-ui-router.min.js`) in your `index.html`, after including Angular itself (For Component users: ignore this step)\n\n**(3)** Add `'ui.router'` to your main module's list of dependencies (For Component users: replace `'ui.router'` with `require('angular-ui-router')`)\n\nWhen you're done, your setup should look similar to the following:\n\n>\n```html\n<!doctype html>\n<html ng-app=\"myApp\">\n<head>\n    <script src=\"//ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js\"></script>\n    <script src=\"js/angular-ui-router.min.js\"></script>\n    <script>\n        var myApp = angular.module('myApp', ['ui.router']);\n        // For Component users, it should look like this:\n        // var myApp = angular.module('myApp', [require('angular-ui-router')]);\n    </script>\n    ...\n</head>\n<body>\n    ...\n</body>\n</html>\n```\n\n### Nested States & Views\n\nThe majority of UI-Router's power is in its ability to nest states & views.\n\n**(1)** First, follow the [setup](#get-started) instructions detailed above.\n\n**(2)** Then, add a [`ui-view` directive](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-view) to the `<body />` of your app.\n\n>\n```html\n<!-- index.html -->\n<body>\n    <div ui-view></div>\n    <!-- We'll also add some navigation: -->\n    <a ui-sref=\"state1\">State 1</a>\n    <a ui-sref=\"state2\">State 2</a>\n</body>\n```\n\n**(3)** You'll notice we also added some links with [`ui-sref` directives](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref). In addition to managing state transitions, this directive auto-generates the `href` attribute of the `<a />` element it's attached to, if the corresponding state has a URL. Next we'll add some templates. These will plug into the `ui-view` within `index.html`. Notice that they have their own `ui-view` as well! That is the key to nesting states and views.\n\n>\n```html\n<!-- partials/state1.html -->\n<h1>State 1</h1>\n<hr/>\n<a ui-sref=\"state1.list\">Show List</a>\n<div ui-view></div>\n```\n```html\n<!-- partials/state2.html -->\n<h1>State 2</h1>\n<hr/>\n<a ui-sref=\"state2.list\">Show List</a>\n<div ui-view></div>\n```\n\n**(4)** Next, we'll add some child templates. *These* will get plugged into the `ui-view` of their parent state templates.\n\n>\n```html\n<!-- partials/state1.list.html -->\n<h3>List of State 1 Items</h3>\n<ul>\n  <li ng-repeat=\"item in items\">{{ item }}</li>\n</ul>\n```\n\n>\n```html\n<!-- partials/state2.list.html -->\n<h3>List of State 2 Things</h3>\n<ul>\n  <li ng-repeat=\"thing in things\">{{ thing }}</li>\n</ul>\n```\n\n**(5)** Finally, we'll wire it all up with `$stateProvider`. Set up your states in the module config, as in the following:\n\n\n>\n```javascript\nmyApp.config(function($stateProvider, $urlRouterProvider) {\n  //\n  // For any unmatched url, redirect to /state1\n  $urlRouterProvider.otherwise(\"/state1\");\n  //\n  // Now set up the states\n  $stateProvider\n    .state('state1', {\n      url: \"/state1\",\n      templateUrl: \"partials/state1.html\"\n    })\n    .state('state1.list', {\n      url: \"/list\",\n      templateUrl: \"partials/state1.list.html\",\n      controller: function($scope) {\n        $scope.items = [\"A\", \"List\", \"Of\", \"Items\"];\n      }\n    })\n    .state('state2', {\n      url: \"/state2\",\n      templateUrl: \"partials/state2.html\"\n    })\n    .state('state2.list', {\n      url: \"/list\",\n        templateUrl: \"partials/state2.list.html\",\n        controller: function($scope) {\n          $scope.things = [\"A\", \"Set\", \"Of\", \"Things\"];\n        }\n      })\n    });\n```\n\n**(6)** See this quick start example in action.\n>**[Go to Quick Start Plunker for Nested States & Views](http://plnkr.co/edit/u18KQc?p=preview)**\n\n**(7)** This only scratches the surface\n>**[Dive Deeper!](https://github.com/angular-ui/ui-router/wiki)**\n\n\n### Multiple & Named Views\n\nAnother great feature is the ability to have multiple `ui-view`s view per template.\n\n**Pro Tip:** *While multiple parallel views are a powerful feature, you'll often be able to manage your\ninterfaces more effectively by nesting your views, and pairing those views with nested states.*\n\n**(1)** Follow the [setup](#get-started) instructions detailed above.\n\n**(2)** Add one or more `ui-view` to your app, give them names.\n>\n```html\n<!-- index.html -->\n<body>\n    <div ui-view=\"viewA\"></div>\n    <div ui-view=\"viewB\"></div>\n    <!-- Also a way to navigate -->\n    <a ui-sref=\"route1\">Route 1</a>\n    <a ui-sref=\"route2\">Route 2</a>\n</body>\n```\n\n**(3)** Set up your states in the module config:\n>\n```javascript\nmyApp.config(function($stateProvider) {\n  $stateProvider\n    .state('index', {\n      url: \"\",\n      views: {\n        \"viewA\": { template: \"index.viewA\" },\n        \"viewB\": { template: \"index.viewB\" }\n      }\n    })\n    .state('route1', {\n      url: \"/route1\",\n      views: {\n        \"viewA\": { template: \"route1.viewA\" },\n        \"viewB\": { template: \"route1.viewB\" }\n      }\n    })\n    .state('route2', {\n      url: \"/route2\",\n      views: {\n        \"viewA\": { template: \"route2.viewA\" },\n        \"viewB\": { template: \"route2.viewB\" }\n      }\n    })\n});\n```\n\n**(4)** See this quick start example in action.\n>**[Go to Quick Start Plunker for Multiple & Named Views](http://plnkr.co/edit/SDOcGS?p=preview)**\n\n\n## Resources\n\n* [In-Depth Guide](https://github.com/angular-ui/ui-router/wiki)\n* [API Reference](http://angular-ui.github.io/ui-router/site)\n* [Sample App](http://angular-ui.github.com/ui-router/sample/) ([Source](https://github.com/angular-ui/ui-router/tree/gh-pages/sample))\n* [FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions)\n* [Introduction Video](https://egghead.io/lessons/angularjs-introduction-ui-router)\n* [Slides comparing ngRoute to ui-router](http://slid.es/timkindberg/ui-router#/)\n\n## Report an Issue\n\nHelp us make UI-Router better! If you think you might have found a bug, or some other weirdness, start by making sure\nit hasn't already been reported. You can [search through existing issues](https://github.com/angular-ui/ui-router/search?q=wat%3F&type=Issues)\nto see if someone's reported one similar to yours.\n\nIf not, then [create a plunkr](http://plnkr.co/edit/u18KQc?p=preview) that demonstrates the problem (try to use as little code\nas possible: the more minimalist, the faster we can debug it).\n\nNext, [create a new issue](https://github.com/angular-ui/ui-router/issues/new) that briefly explains the problem,\nand provides a bit of background as to the circumstances that triggered it. Don't forget to include the link to\nthat plunkr you created!\n\n**Note**: If you're unsure how a feature is used, or are encountering some unexpected behavior that you aren't sure\nis a bug, it's best to talk it out in the\n[Google Group](https://groups.google.com/forum/#!categories/angular-ui/router) or on\n[StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) before reporting it. This\nkeeps development streamlined, and helps us focus on building great software.\n\nPlease keep in mind that the issue tracker is for *issues*. Please do *not* post an issue if you need help or support. Instead, see one of the above-mentioned forums or [IRC](irc://irc.freenode.net/#angularjs).\n\n\n## Contribute\n\n**(1)** See the **[Developing](#developing)** section below, to get the development version of UI-Router up and running on your local machine.\n\n**(2)** Check out the [roadmap](https://github.com/angular-ui/ui-router/issues/milestones) to see where the project is headed, and if your feature idea fits with where we're headed.\n\n**(3)** If you're not sure, [open an RFC](https://github.com/angular-ui/ui-router/issues/new?title=RFC:%20My%20idea) to get some feedback on your idea.\n\n**(4)** Finally, commit some code and open a pull request. Code & commits should abide by the following rules:\n\n- *Always* have test coverage for new features (or regression tests for bug fixes), and *never* break existing tests\n- Commits should represent one logical change each; if a feature goes through multiple iterations, squash your commits down to one\n- Make sure to follow the [Angular commit message format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format) so your change will appear in the changelog of the next release.\n- Changes should always respect the coding style of the project\n\n\n\n## Developing\n\nUI-Router uses <code>grunt >= 0.4.x</code>. Make sure to upgrade your environment and read the\n[Migration Guide](http://gruntjs.com/upgrading-from-0.3-to-0.4).\n\nDependencies for building from source and running tests:\n\n* [grunt-cli](https://github.com/gruntjs/grunt-cli) - run: `$ npm install -g grunt-cli`\n* Then, install the development dependencies by running `$ npm install` from the project directory\n\nThere are a number of targets in the gruntfile that are used to generating different builds:\n\n* `grunt`: Perform a normal build, runs jshint and karma tests\n* `grunt build`: Perform a normal build\n* `grunt dist`: Perform a clean build and generate documentation\n* `grunt dev`: Run dev server (sample app) and watch for changes, builds and runs karma tests on changes.\n"
  },
  {
    "path": "www/lib/angular-ui-router/bower.json",
    "content": "{\n  \"name\": \"angular-ui-router\",\n  \"version\": \"0.2.10\",\n  \"main\": \"./release/angular-ui-router.js\",\n  \"dependencies\": {\n    \"angular\": \">= 1.0.8\"\n  },\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"component.json\",\n    \"package.json\",\n    \"lib\",\n    \"config\",\n    \"sample\",\n    \"test\",\n    \"tests\",\n    \"ngdoc_assets\",\n    \"Gruntfile.js\",\n    \"files.js\"\n  ]\n}\n"
  },
  {
    "path": "www/lib/angular-ui-router/release/angular-ui-router.js",
    "content": "/**\n * State-based routing for AngularJS\n * @version v0.2.10\n * @link http://angular-ui.github.com/\n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n\n/* commonjs package manager support (eg componentjs) */\nif (typeof module !== \"undefined\" && typeof exports !== \"undefined\" && module.exports === exports){\n  module.exports = 'ui.router';\n}\n\n(function (window, angular, undefined) {\n/*jshint globalstrict:true*/\n/*global angular:false*/\n'use strict';\n\nvar isDefined = angular.isDefined,\n    isFunction = angular.isFunction,\n    isString = angular.isString,\n    isObject = angular.isObject,\n    isArray = angular.isArray,\n    forEach = angular.forEach,\n    extend = angular.extend,\n    copy = angular.copy;\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, { prototype: parent }))(), extra);\n}\n\nfunction merge(dst) {\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        if (!dst.hasOwnProperty(key)) dst[key] = value;\n      });\n    }\n  });\n  return dst;\n}\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nfunction ancestors(first, second) {\n  var path = [];\n\n  for (var n in first.path) {\n    if (first.path[n] !== second.path[n]) break;\n    path.push(first.path[n]);\n  }\n  return path;\n}\n\n/**\n * IE8-safe wrapper for `Object.keys()`.\n *\n * @param {Object} object A JavaScript object.\n * @return {Array} Returns the keys of the object as an array.\n */\nfunction keys(object) {\n  if (Object.keys) {\n    return Object.keys(object);\n  }\n  var result = [];\n\n  angular.forEach(object, function(val, key) {\n    result.push(key);\n  });\n  return result;\n}\n\n/**\n * IE8-safe wrapper for `Array.prototype.indexOf()`.\n *\n * @param {Array} array A JavaScript array.\n * @param {*} value A value to search the array for.\n * @return {Number} Returns the array index value of `value`, or `-1` if not present.\n */\nfunction arraySearch(array, value) {\n  if (Array.prototype.indexOf) {\n    return array.indexOf(value, Number(arguments[2]) || 0);\n  }\n  var len = array.length >>> 0, from = Number(arguments[2]) || 0;\n  from = (from < 0) ? Math.ceil(from) : Math.floor(from);\n\n  if (from < 0) from += len;\n\n  for (; from < len; from++) {\n    if (from in array && array[from] === value) return from;\n  }\n  return -1;\n}\n\n/**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} currentParams The value of the current state parameters ($stateParams).\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\nfunction inheritParams(currentParams, newParams, $current, $to) {\n  var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];\n\n  for (var i in parents) {\n    if (!parents[i].params || !parents[i].params.length) continue;\n    parentParams = parents[i].params;\n\n    for (var j in parentParams) {\n      if (arraySearch(inheritList, parentParams[j]) >= 0) continue;\n      inheritList.push(parentParams[j]);\n      inherited[parentParams[j]] = currentParams[parentParams[j]];\n    }\n  }\n  return extend({}, inherited, newParams);\n}\n\n/**\n * Normalizes a set of values to string or `null`, filtering them by a list of keys.\n *\n * @param {Array} keys The list of keys to normalize/return.\n * @param {Object} values An object hash of values to normalize.\n * @return {Object} Returns an object hash of normalized string values.\n */\nfunction normalize(keys, values) {\n  var normalized = {};\n\n  forEach(keys, function (name) {\n    var value = values[name];\n    normalized[name] = (value != null) ? String(value) : null;\n  });\n  return normalized;\n}\n\n/**\n * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.\n *\n * @param {Object} a The first object.\n * @param {Object} b The second object.\n * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,\n *                     it defaults to the list of keys in `a`.\n * @return {Boolean} Returns `true` if the keys match, otherwise `false`.\n */\nfunction equalForKeys(a, b, keys) {\n  if (!keys) {\n    keys = [];\n    for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility\n  }\n\n  for (var i=0; i<keys.length; i++) {\n    var k = keys[i];\n    if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized\n  }\n  return true;\n}\n\n/**\n * Returns the subset of an object, based on a list of keys.\n *\n * @param {Array} keys\n * @param {Object} values\n * @return {Boolean} Returns a subset of `values`.\n */\nfunction filterByKeys(keys, values) {\n  var filtered = {};\n\n  forEach(keys, function (name) {\n    filtered[name] = values[name];\n  });\n  return filtered;\n}\n/**\n * @ngdoc overview\n * @name ui.router.util\n *\n * @description\n * # ui.router.util sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n *\n */\nangular.module('ui.router.util', ['ng']);\n\n/**\n * @ngdoc overview\n * @name ui.router.router\n * \n * @requires ui.router.util\n *\n * @description\n * # ui.router.router sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n */\nangular.module('ui.router.router', ['ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router.state\n * \n * @requires ui.router.router\n * @requires ui.router.util\n *\n * @description\n * # ui.router.state sub-module\n *\n * This module is a dependency of the main ui.router module. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n * \n */\nangular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router\n *\n * @requires ui.router.state\n *\n * @description\n * # ui.router\n * \n * ## The main module for ui.router \n * There are several sub-modules included with the ui.router module, however only this module is needed\n * as a dependency within your angular app. The other modules are for organization purposes. \n *\n * The modules are:\n * * ui.router - the main \"umbrella\" module\n * * ui.router.router - \n * \n * *You'll need to include **only** this module as the dependency within your angular app.*\n * \n * <pre>\n * <!doctype html>\n * <html ng-app=\"myApp\">\n * <head>\n *   <script src=\"js/angular.js\"></script>\n *   <!-- Include the ui-router script -->\n *   <script src=\"js/angular-ui-router.min.js\"></script>\n *   <script>\n *     // ...and add 'ui.router' as a dependency\n *     var myApp = angular.module('myApp', ['ui.router']);\n *   </script>\n * </head>\n * <body>\n * </body>\n * </html>\n * </pre>\n */\nangular.module('ui.router', ['ui.router.state']);\n\nangular.module('ui.router.compat', ['ui.router']);\n\n/**\n * @ngdoc object\n * @name ui.router.util.$resolve\n *\n * @requires $q\n * @requires $injector\n *\n * @description\n * Manages resolution of (acyclic) graphs of promises.\n */\n$Resolve.$inject = ['$q', '$injector'];\nfunction $Resolve(  $q,    $injector) {\n  \n  var VISIT_IN_PROGRESS = 1,\n      VISIT_DONE = 2,\n      NOTHING = {},\n      NO_DEPENDENCIES = [],\n      NO_LOCALS = NOTHING,\n      NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });\n  \n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#study\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Studies a set of invocables that are likely to be used multiple times.\n   * <pre>\n   * $resolve.study(invocables)(locals, parent, self)\n   * </pre>\n   * is equivalent to\n   * <pre>\n   * $resolve.resolve(invocables, locals, parent, self)\n   * </pre>\n   * but the former is more efficient (in fact `resolve` just calls `study` \n   * internally).\n   *\n   * @param {object} invocables Invocable objects\n   * @return {function} a function to pass in locals, parent and self\n   */\n  this.study = function (invocables) {\n    if (!isObject(invocables)) throw new Error(\"'invocables' must be an object\");\n    \n    // Perform a topological sort of invocables to build an ordered plan\n    var plan = [], cycle = [], visited = {};\n    function visit(value, key) {\n      if (visited[key] === VISIT_DONE) return;\n      \n      cycle.push(key);\n      if (visited[key] === VISIT_IN_PROGRESS) {\n        cycle.splice(0, cycle.indexOf(key));\n        throw new Error(\"Cyclic dependency: \" + cycle.join(\" -> \"));\n      }\n      visited[key] = VISIT_IN_PROGRESS;\n      \n      if (isString(value)) {\n        plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);\n      } else {\n        var params = $injector.annotate(value);\n        forEach(params, function (param) {\n          if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);\n        });\n        plan.push(key, value, params);\n      }\n      \n      cycle.pop();\n      visited[key] = VISIT_DONE;\n    }\n    forEach(invocables, visit);\n    invocables = cycle = visited = null; // plan is all that's required\n    \n    function isResolve(value) {\n      return isObject(value) && value.then && value.$$promises;\n    }\n    \n    return function (locals, parent, self) {\n      if (isResolve(locals) && self === undefined) {\n        self = parent; parent = locals; locals = null;\n      }\n      if (!locals) locals = NO_LOCALS;\n      else if (!isObject(locals)) {\n        throw new Error(\"'locals' must be an object\");\n      }       \n      if (!parent) parent = NO_PARENT;\n      else if (!isResolve(parent)) {\n        throw new Error(\"'parent' must be a promise returned by $resolve.resolve()\");\n      }\n      \n      // To complete the overall resolution, we have to wait for the parent\n      // promise and for the promise for each invokable in our plan.\n      var resolution = $q.defer(),\n          result = resolution.promise,\n          promises = result.$$promises = {},\n          values = extend({}, locals),\n          wait = 1 + plan.length/3,\n          merged = false;\n          \n      function done() {\n        // Merge parent values we haven't got yet and publish our own $$values\n        if (!--wait) {\n          if (!merged) merge(values, parent.$$values); \n          result.$$values = values;\n          result.$$promises = true; // keep for isResolve()\n          resolution.resolve(values);\n        }\n      }\n      \n      function fail(reason) {\n        result.$$failure = reason;\n        resolution.reject(reason);\n      }\n      \n      // Short-circuit if parent has already failed\n      if (isDefined(parent.$$failure)) {\n        fail(parent.$$failure);\n        return result;\n      }\n      \n      // Merge parent values if the parent has already resolved, or merge\n      // parent promises and wait if the parent resolve is still in progress.\n      if (parent.$$values) {\n        merged = merge(values, parent.$$values);\n        done();\n      } else {\n        extend(promises, parent.$$promises);\n        parent.then(done, fail);\n      }\n      \n      // Process each invocable in the plan, but ignore any where a local of the same name exists.\n      for (var i=0, ii=plan.length; i<ii; i+=3) {\n        if (locals.hasOwnProperty(plan[i])) done();\n        else invoke(plan[i], plan[i+1], plan[i+2]);\n      }\n      \n      function invoke(key, invocable, params) {\n        // Create a deferred for this invocation. Failures will propagate to the resolution as well.\n        var invocation = $q.defer(), waitParams = 0;\n        function onfailure(reason) {\n          invocation.reject(reason);\n          fail(reason);\n        }\n        // Wait for any parameter that we have a promise for (either from parent or from this\n        // resolve; in that case study() will have made sure it's ordered before us in the plan).\n        forEach(params, function (dep) {\n          if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {\n            waitParams++;\n            promises[dep].then(function (result) {\n              values[dep] = result;\n              if (!(--waitParams)) proceed();\n            }, onfailure);\n          }\n        });\n        if (!waitParams) proceed();\n        function proceed() {\n          if (isDefined(result.$$failure)) return;\n          try {\n            invocation.resolve($injector.invoke(invocable, self, values));\n            invocation.promise.then(function (result) {\n              values[key] = result;\n              done();\n            }, onfailure);\n          } catch (e) {\n            onfailure(e);\n          }\n        }\n        // Publish promise synchronously; invocations further down in the plan may depend on it.\n        promises[key] = invocation.promise;\n      }\n      \n      return result;\n    };\n  };\n  \n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#resolve\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Resolves a set of invocables. An invocable is a function to be invoked via \n   * `$injector.invoke()`, and can have an arbitrary number of dependencies. \n   * An invocable can either return a value directly,\n   * or a `$q` promise. If a promise is returned it will be resolved and the \n   * resulting value will be used instead. Dependencies of invocables are resolved \n   * (in this order of precedence)\n   *\n   * - from the specified `locals`\n   * - from another invocable that is part of this `$resolve` call\n   * - from an invocable that is inherited from a `parent` call to `$resolve` \n   *   (or recursively\n   * - from any ancestor `$resolve` of that parent).\n   *\n   * The return value of `$resolve` is a promise for an object that contains \n   * (in this order of precedence)\n   *\n   * - any `locals` (if specified)\n   * - the resolved return values of all injectables\n   * - any values inherited from a `parent` call to `$resolve` (if specified)\n   *\n   * The promise will resolve after the `parent` promise (if any) and all promises \n   * returned by injectables have been resolved. If any invocable \n   * (or `$injector.invoke`) throws an exception, or if a promise returned by an \n   * invocable is rejected, the `$resolve` promise is immediately rejected with the \n   * same error. A rejection of a `parent` promise (if specified) will likewise be \n   * propagated immediately. Once the `$resolve` promise has been rejected, no \n   * further invocables will be called.\n   * \n   * Cyclic dependencies between invocables are not permitted and will caues `$resolve`\n   * to throw an error. As a special case, an injectable can depend on a parameter \n   * with the same name as the injectable, which will be fulfilled from the `parent` \n   * injectable of the same name. This allows inherited values to be decorated. \n   * Note that in this case any other injectable in the same `$resolve` with the same\n   * dependency would see the decorated value, not the inherited value.\n   *\n   * Note that missing dependencies -- unlike cyclic dependencies -- will cause an \n   * (asynchronous) rejection of the `$resolve` promise rather than a (synchronous) \n   * exception.\n   *\n   * Invocables are invoked eagerly as soon as all dependencies are available. \n   * This is true even for dependencies inherited from a `parent` call to `$resolve`.\n   *\n   * As a special case, an invocable can be a string, in which case it is taken to \n   * be a service name to be passed to `$injector.get()`. This is supported primarily \n   * for backwards-compatibility with the `resolve` property of `$routeProvider` \n   * routes.\n   *\n   * @param {object} invocables functions to invoke or \n   * `$injector` services to fetch.\n   * @param {object} locals  values to make available to the injectables\n   * @param {object} parent  a promise returned by another call to `$resolve`.\n   * @param {object} self  the `this` for the invoked methods\n   * @return {object} Promise for an object that contains the resolved return value\n   * of all invocables, as well as any inherited and local values.\n   */\n  this.resolve = function (invocables, locals, parent, self) {\n    return this.study(invocables)(locals, parent, self);\n  };\n}\n\nangular.module('ui.router.util').service('$resolve', $Resolve);\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$templateFactory\n *\n * @requires $http\n * @requires $templateCache\n * @requires $injector\n *\n * @description\n * Service. Manages loading of templates.\n */\n$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];\nfunction $TemplateFactory(  $http,   $templateCache,   $injector) {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromConfig\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a configuration object. \n   *\n   * @param {object} config Configuration object for which to load a template. \n   * The following properties are search in the specified order, and the first one \n   * that is defined is used to create the template:\n   *\n   * @param {string|object} config.template html string template or function to \n   * load via {@link ui.router.util.$templateFactory#fromString fromString}.\n   * @param {string|object} config.templateUrl url to load or a function returning \n   * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.\n   * @param {Function} config.templateProvider function to invoke via \n   * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.\n   * @param {object} params  Parameters to pass to the template function.\n   * @param {object} locals Locals to pass to `invoke` if the template is loaded \n   * via a `templateProvider`. Defaults to `{ params: params }`.\n   *\n   * @return {string|object}  The template html as a string, or a promise for \n   * that string,or `null` if no template is configured.\n   */\n  this.fromConfig = function (config, params, locals) {\n    return (\n      isDefined(config.template) ? this.fromString(config.template, params) :\n      isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :\n      isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :\n      null\n    );\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromString\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a string or a function returning a string.\n   *\n   * @param {string|object} template html template as a string or function that \n   * returns an html template as a string.\n   * @param {object} params Parameters to pass to the template function.\n   *\n   * @return {string|object} The template html as a string, or a promise for that \n   * string.\n   */\n  this.fromString = function (template, params) {\n    return isFunction(template) ? template(params) : template;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   * \n   * @description\n   * Loads a template from the a URL via `$http` and `$templateCache`.\n   *\n   * @param {string|Function} url url of the template to load, or a function \n   * that returns a url.\n   * @param {Object} params Parameters to pass to the url function.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromUrl = function (url, params) {\n    if (isFunction(url)) url = url(params);\n    if (url == null) return null;\n    else return $http\n        .get(url, { cache: $templateCache })\n        .then(function(response) { return response.data; });\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template by invoking an injectable provider function.\n   *\n   * @param {Function} provider Function to invoke via `$injector.invoke`\n   * @param {Object} params Parameters for the template.\n   * @param {Object} locals Locals to pass to `invoke`. Defaults to \n   * `{ params: params }`.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromProvider = function (provider, params, locals) {\n    return $injector.invoke(provider, null, locals || { params: params });\n  };\n}\n\nangular.module('ui.router.util').service('$templateFactory', $TemplateFactory);\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:UrlMatcher\n *\n * @description\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL. A URL pattern consists of a path pattern, optionally followed by '?' and a list\n * of search parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by {@link ui.router.util.type:UrlMatcher#methods_exec exec}.\n * \n * Path parameter placeholders can be specified using simple colon/catch-all syntax or curly brace\n * syntax, which optionally allows a regular expression for the parameter to be specified:\n *\n * * `':'` name - colon placeholder\n * * `'*'` name - catch-all placeholder\n * * `'{' name '}'` - curly placeholder\n * * `'{' name ':' regexp '}'` - curly placeholder with regexp. Should the regexp itself contain\n *   curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters). For colon \n * placeholders or curly placeholders without an explicit regexp, a path parameter matches any\n * number of characters other than '/'. For catch-all placeholders the path parameter matches\n * any number of characters.\n * \n * Examples:\n * \n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n *   trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n *   '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n *   parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n *   path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n *\n * @param {string} pattern  the pattern to compile into a matcher.\n *\n * @property {string} prefix  A static prefix of this pattern. The matcher guarantees that any\n *   URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns\n *   non-null) will start with this prefix.\n *\n * @property {string} source  The pattern that was passed into the contructor\n *\n * @property {string} sourcePath  The path portion of the source property\n *\n * @property {string} sourceSearch  The search portion of the source property\n *\n * @property {string} regex  The constructed regex that will be used to match against the url when \n *   it is time to determine which url will match.\n *\n * @returns {Object}  New UrlMatcher object\n */\nfunction UrlMatcher(pattern) {\n\n  // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n  //   '*' name\n  //   ':' name\n  //   '{' name '}'\n  //   '{' name ':' regexp '}'\n  // The regular expression is somewhat complicated due to the need to allow curly braces\n  // inside the regular expression. The placeholder regexp breaks down as follows:\n  //    ([:*])(\\w+)               classic placeholder ($1 / $2)\n  //    \\{(\\w+)(?:\\:( ... ))?\\}   curly brace placeholder ($3) with optional regexp ... ($4)\n  //    (?: ... | ... | ... )+    the regexp consists of any number of atoms, an atom being either\n  //    [^{}\\\\]+                  - anything other than curly braces or backslash\n  //    \\\\.                       - a backslash escape\n  //    \\{(?:[^{}\\\\]+|\\\\.)*\\}     - a matched set of curly braces containing other atoms\n  var placeholder = /([:*])(\\w+)|\\{(\\w+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      names = {}, compiled = '^', last = 0, m,\n      segments = this.segments = [],\n      params = this.params = [];\n\n  function addParameter(id) {\n    if (!/^\\w+(-+\\w+)*$/.test(id)) throw new Error(\"Invalid parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    if (names[id]) throw new Error(\"Duplicate parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    names[id] = true;\n    params.push(id);\n  }\n\n  function quoteRegExp(string) {\n    return string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n  }\n\n  this.source = pattern;\n\n  // Split into static segments separated by path parameter placeholders.\n  // The number of segments is always 1 more than the number of parameters.\n  var id, regexp, segment;\n  while ((m = placeholder.exec(pattern))) {\n    id = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null\n    regexp = m[4] || (m[1] == '*' ? '.*' : '[^/]*');\n    segment = pattern.substring(last, m.index);\n    if (segment.indexOf('?') >= 0) break; // we're into the search part\n    compiled += quoteRegExp(segment) + '(' + regexp + ')';\n    addParameter(id);\n    segments.push(segment);\n    last = placeholder.lastIndex;\n  }\n  segment = pattern.substring(last);\n\n  // Find any search parameter names and remove them from the last segment\n  var i = segment.indexOf('?');\n  if (i >= 0) {\n    var search = this.sourceSearch = segment.substring(i);\n    segment = segment.substring(0, i);\n    this.sourcePath = pattern.substring(0, last+i);\n\n    // Allow parameters to be separated by '?' as well as '&' to make concat() easier\n    forEach(search.substring(1).split(/[&?]/), addParameter);\n  } else {\n    this.sourcePath = pattern;\n    this.sourceSearch = '';\n  }\n\n  compiled += quoteRegExp(segment) + '$';\n  segments.push(segment);\n  this.regexp = new RegExp(compiled);\n  this.prefix = segments[0];\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#concat\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns a new matcher for a pattern constructed by appending the path part and adding the\n * search parameters of the specified pattern to this pattern. The current pattern is not\n * modified. This can be understood as creating a pattern for URLs that are relative to (or\n * suffixes of) the current pattern.\n *\n * @example\n * The following two matchers are equivalent:\n * ```\n * new UrlMatcher('/user/{id}?q').concat('/details?date');\n * new UrlMatcher('/user/{id}/details?q&date');\n * ```\n *\n * @param {string} pattern  The pattern to append.\n * @returns {ui.router.util.type:UrlMatcher}  A matcher for the concatenated pattern.\n */\nUrlMatcher.prototype.concat = function (pattern) {\n  // Because order of search parameters is irrelevant, we can add our own search\n  // parameters to the end of the new pattern. Parse the new pattern by itself\n  // and then join the bits together, but it's much easier to do this on a string level.\n  return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch);\n};\n\nUrlMatcher.prototype.toString = function () {\n  return this.source;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#exec\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Tests the specified path against this matcher, and returns an object containing the captured\n * parameter values, or null if the path does not match. The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `searchParams`. This means that search parameters are always treated\n * as optional.\n *\n * @example\n * ```\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { x:'1', q:'hello' });\n * // returns { id:'bob', q:'hello', r:null }\n * ```\n *\n * @param {string} path  The URL path to match, e.g. `$location.path()`.\n * @param {Object} searchParams  URL search parameters, e.g. `$location.search()`.\n * @returns {Object}  The captured parameter values.\n */\nUrlMatcher.prototype.exec = function (path, searchParams) {\n  var m = this.regexp.exec(path);\n  if (!m) return null;\n\n  var params = this.params, nTotal = params.length,\n    nPath = this.segments.length-1,\n    values = {}, i;\n\n  if (nPath !== m.length - 1) throw new Error(\"Unbalanced capture group in route '\" + this.source + \"'\");\n\n  for (i=0; i<nPath; i++) values[params[i]] = m[i+1];\n  for (/**/; i<nTotal; i++) values[params[i]] = searchParams[params[i]];\n\n  return values;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#parameters\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns the names of all path and search parameters of this pattern in an unspecified order.\n * \n * @returns {Array.<string>}  An array of parameter names. Must be treated as read-only. If the\n *    pattern has no parameters, an empty array is returned.\n */\nUrlMatcher.prototype.parameters = function () {\n  return this.params;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#format\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters. Null values for path parameters are\n * treated as empty strings.\n *\n * @example\n * ```\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param {Object} values  the values to substitute for the parameters in this pattern.\n * @returns {string}  the formatted URL (path and optionally search part).\n */\nUrlMatcher.prototype.format = function (values) {\n  var segments = this.segments, params = this.params;\n  if (!values) return segments.join('');\n\n  var nPath = segments.length-1, nTotal = params.length,\n    result = segments[0], i, search, value;\n\n  for (i=0; i<nPath; i++) {\n    value = values[params[i]];\n    // TODO: Maybe we should throw on null here? It's not really good style to use '' and null interchangeabley\n    if (value != null) result += encodeURIComponent(value);\n    result += segments[i+1];\n  }\n  for (/**/; i<nTotal; i++) {\n    value = values[params[i]];\n    if (value != null) {\n      result += (search ? '&' : '?') + params[i] + '=' + encodeURIComponent(value);\n      search = true;\n    }\n  }\n\n  return result;\n};\n\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$urlMatcherFactory\n *\n * @description\n * Factory for {@link ui.router.util.type:UrlMatcher} instances. The factory is also available to providers\n * under the name `$urlMatcherFactoryProvider`.\n */\nfunction $UrlMatcherFactory() {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#compile\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Creates a {@link ui.router.util.type:UrlMatcher} for the specified pattern.\n   *   \n   * @param {string} pattern  The URL pattern.\n   * @returns {ui.router.util.type:UrlMatcher}  The UrlMatcher.\n   */\n  this.compile = function (pattern) {\n    return new UrlMatcher(pattern);\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#isMatcher\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Returns true if the specified object is a UrlMatcher, or false otherwise.\n   *\n   * @param {Object} object  The object to perform the type check against.\n   * @returns {Boolean}  Returns `true` if the object has the following functions: `exec`, `format`, and `concat`.\n   */\n  this.isMatcher = function (o) {\n    return isObject(o) && isFunction(o.exec) && isFunction(o.format) && isFunction(o.concat);\n  };\n  \n  /* No need to document $get, since it returns this */\n  this.$get = function () {\n    return this;\n  };\n}\n\n// Register as a provider so it's available to other providers\nangular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory);\n\n/**\n * @ngdoc object\n * @name ui.router.router.$urlRouterProvider\n *\n * @requires ui.router.util.$urlMatcherFactoryProvider\n *\n * @description\n * `$urlRouterProvider` has the responsibility of watching `$location`. \n * When `$location` changes it runs through a list of rules one by one until a \n * match is found. `$urlRouterProvider` is used behind the scenes anytime you specify \n * a url in a state configuration. All urls are compiled into a UrlMatcher object.\n *\n * There are several methods on `$urlRouterProvider` that make it useful to use directly\n * in your module config.\n */\n$UrlRouterProvider.$inject = ['$urlMatcherFactoryProvider'];\nfunction $UrlRouterProvider(  $urlMatcherFactory) {\n  var rules = [], \n      otherwise = null;\n\n  // Returns a string that is a prefix of all strings matching the RegExp\n  function regExpPrefix(re) {\n    var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n    return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n  }\n\n  // Interpolates matched values into a String.replace()-style pattern\n  function interpolate(pattern, match) {\n    return pattern.replace(/\\$(\\$|\\d{1,2})/, function (m, what) {\n      return match[what === '$' ? 0 : Number(what)];\n    });\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#rule\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines rules that are used by `$urlRouterProvider to find matches for\n   * specific URLs.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {object} rule Handler function that takes `$injector` and `$location`\n   * services as arguments. You can use them to return a valid path as a string.\n   *\n   * @return {object} $urlRouterProvider - $urlRouterProvider instance\n   */\n  this.rule =\n    function (rule) {\n      if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n      rules.push(rule);\n      return this;\n    };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouterProvider#otherwise\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines a path that is used when an invalied route is requested.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     ...\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} rule The url path you want to redirect to or a function \n   * rule that returns the url path. The function version is passed two params: \n   * `$injector` and `$location` services.\n   *\n   * @return {object} $urlRouterProvider - $urlRouterProvider instance\n   */\n  this.otherwise =\n    function (rule) {\n      if (isString(rule)) {\n        var redirect = rule;\n        rule = function () { return redirect; };\n      }\n      else if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n      otherwise = rule;\n      return this;\n    };\n\n\n  function handleIfMatch($injector, handler, match) {\n    if (!match) return false;\n    var result = $injector.invoke(handler, handler, { $match: match });\n    return isDefined(result) ? result : true;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#when\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Registers a handler for a given url matching. if handle is a string, it is\n   * treated as a redirect, and is interpolated according to the syyntax of match\n   * (i.e. like String.replace() for RegExp, or like a UrlMatcher pattern otherwise).\n   *\n   * If the handler is a function, it is injectable. It gets invoked if `$location`\n   * matches. You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} what The incoming path that you want to redirect.\n   * @param {string|object} handler The path you want to redirect your user to.\n   */\n  this.when =\n    function (what, handler) {\n      var redirect, handlerIsString = isString(handler);\n      if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n      if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n        throw new Error(\"invalid 'handler' in when()\");\n\n      var strategies = {\n        matcher: function (what, handler) {\n          if (handlerIsString) {\n            redirect = $urlMatcherFactory.compile(handler);\n            handler = ['$match', function ($match) { return redirect.format($match); }];\n          }\n          return extend(function ($injector, $location) {\n            return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n          }, {\n            prefix: isString(what.prefix) ? what.prefix : ''\n          });\n        },\n        regex: function (what, handler) {\n          if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n          if (handlerIsString) {\n            redirect = handler;\n            handler = ['$match', function ($match) { return interpolate(redirect, $match); }];\n          }\n          return extend(function ($injector, $location) {\n            return handleIfMatch($injector, handler, what.exec($location.path()));\n          }, {\n            prefix: regExpPrefix(what)\n          });\n        }\n      };\n\n      var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };\n\n      for (var n in check) {\n        if (check[n]) {\n          return this.rule(strategies[n](what, handler));\n        }\n      }\n\n      throw new Error(\"invalid 'what' in when()\");\n    };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouter\n   *\n   * @requires $location\n   * @requires $rootScope\n   * @requires $injector\n   *\n   * @description\n   *\n   */\n  this.$get =\n    [        '$location', '$rootScope', '$injector',\n    function ($location,   $rootScope,   $injector) {\n      // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree\n      function update(evt) {\n        if (evt && evt.defaultPrevented) return;\n        function check(rule) {\n          var handled = rule($injector, $location);\n          if (handled) {\n            if (isString(handled)) $location.replace().url(handled);\n            return true;\n          }\n          return false;\n        }\n        var n=rules.length, i;\n        for (i=0; i<n; i++) {\n          if (check(rules[i])) return;\n        }\n        // always check otherwise last to allow dynamic updates to the set of rules\n        if (otherwise) check(otherwise);\n      }\n\n      $rootScope.$on('$locationChangeSuccess', update);\n\n      return {\n        /**\n         * @ngdoc function\n         * @name ui.router.router.$urlRouter#sync\n         * @methodOf ui.router.router.$urlRouter\n         *\n         * @description\n         * Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.\n         * This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event, \n         * perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed \n         * with the transition by calling `$urlRouter.sync()`.\n         *\n         * @example\n         * <pre>\n         * angular.module('app', ['ui.router']);\n         *   .run(function($rootScope, $urlRouter) {\n         *     $rootScope.$on('$locationChangeSuccess', function(evt) {\n         *       // Halt state change from even starting\n         *       evt.preventDefault();\n         *       // Perform custom logic\n         *       var meetsRequirement = ...\n         *       // Continue with the update and state transition if logic allows\n         *       if (meetsRequirement) $urlRouter.sync();\n         *     });\n         * });\n         * </pre>\n         */\n        sync: function () {\n          update();\n        }\n      };\n    }];\n}\n\nangular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$stateProvider\n *\n * @requires ui.router.router.$urlRouterProvider\n * @requires ui.router.util.$urlMatcherFactoryProvider\n * @requires $locationProvider\n *\n * @description\n * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\n$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider', '$locationProvider'];\nfunction $StateProvider(   $urlRouterProvider,   $urlMatcherFactory,           $locationProvider) {\n\n  var root, states = {}, $state, queue = {}, abstractKey = 'abstract';\n\n  // Builds state properties from definition passed to registerState()\n  var stateBuilder = {\n\n    // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.\n    // state.children = [];\n    // if (parent) parent.children.push(state);\n    parent: function(state) {\n      if (isDefined(state.parent) && state.parent) return findState(state.parent);\n      // regex matches any valid composite state name\n      // would match \"contact.list\" but not \"contacts\"\n      var compositeName = /^(.+)\\.[^.]+$/.exec(state.name);\n      return compositeName ? findState(compositeName[1]) : root;\n    },\n\n    // inherit 'data' from parent and override by own values (if any)\n    data: function(state) {\n      if (state.parent && state.parent.data) {\n        state.data = state.self.data = extend({}, state.parent.data, state.data);\n      }\n      return state.data;\n    },\n\n    // Build a URLMatcher if necessary, either via a relative or absolute URL\n    url: function(state) {\n      var url = state.url;\n\n      if (isString(url)) {\n        if (url.charAt(0) == '^') {\n          return $urlMatcherFactory.compile(url.substring(1));\n        }\n        return (state.parent.navigable || root).url.concat(url);\n      }\n\n      if ($urlMatcherFactory.isMatcher(url) || url == null) {\n        return url;\n      }\n      throw new Error(\"Invalid url '\" + url + \"' in state '\" + state + \"'\");\n    },\n\n    // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n    navigable: function(state) {\n      return state.url ? state : (state.parent ? state.parent.navigable : null);\n    },\n\n    // Derive parameters for this state and ensure they're a super-set of parent's parameters\n    params: function(state) {\n      if (!state.params) {\n        return state.url ? state.url.parameters() : state.parent.params;\n      }\n      if (!isArray(state.params)) throw new Error(\"Invalid params in state '\" + state + \"'\");\n      if (state.url) throw new Error(\"Both params and url specicified in state '\" + state + \"'\");\n      return state.params;\n    },\n\n    // If there is no explicit multi-view configuration, make one up so we don't have\n    // to handle both cases in the view directive later. Note that having an explicit\n    // 'views' property will mean the default unnamed view properties are ignored. This\n    // is also a good time to resolve view names to absolute names, so everything is a\n    // straight lookup at link time.\n    views: function(state) {\n      var views = {};\n\n      forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {\n        if (name.indexOf('@') < 0) name += '@' + state.parent.name;\n        views[name] = view;\n      });\n      return views;\n    },\n\n    ownParams: function(state) {\n      if (!state.parent) {\n        return state.params;\n      }\n      var paramNames = {}; forEach(state.params, function (p) { paramNames[p] = true; });\n\n      forEach(state.parent.params, function (p) {\n        if (!paramNames[p]) {\n          throw new Error(\"Missing required parameter '\" + p + \"' in state '\" + state.name + \"'\");\n        }\n        paramNames[p] = false;\n      });\n      var ownParams = [];\n\n      forEach(paramNames, function (own, p) {\n        if (own) ownParams.push(p);\n      });\n      return ownParams;\n    },\n\n    // Keep a full path from the root down to this state as this is needed for state activation.\n    path: function(state) {\n      return state.parent ? state.parent.path.concat(state) : []; // exclude root from path\n    },\n\n    // Speed up $state.contains() as it's used a lot\n    includes: function(state) {\n      var includes = state.parent ? extend({}, state.parent.includes) : {};\n      includes[state.name] = true;\n      return includes;\n    },\n\n    $delegates: {}\n  };\n\n  function isRelative(stateName) {\n    return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n  }\n\n  function findState(stateOrName, base) {\n    var isStr = isString(stateOrName),\n        name  = isStr ? stateOrName : stateOrName.name,\n        path  = isRelative(name);\n\n    if (path) {\n      if (!base) throw new Error(\"No reference point given for path '\"  + name + \"'\");\n      var rel = name.split(\".\"), i = 0, pathLength = rel.length, current = base;\n\n      for (; i < pathLength; i++) {\n        if (rel[i] === \"\" && i === 0) {\n          current = base;\n          continue;\n        }\n        if (rel[i] === \"^\") {\n          if (!current.parent) throw new Error(\"Path '\" + name + \"' not valid for state '\" + base.name + \"'\");\n          current = current.parent;\n          continue;\n        }\n        break;\n      }\n      rel = rel.slice(i).join(\".\");\n      name = current.name + (current.name && rel ? \".\" : \"\") + rel;\n    }\n    var state = states[name];\n\n    if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n      return state;\n    }\n    return undefined;\n  }\n\n  function queueState(parentName, state) {\n    if (!queue[parentName]) {\n      queue[parentName] = [];\n    }\n    queue[parentName].push(state);\n  }\n\n  function registerState(state) {\n    // Wrap a new object around the state so we can store our private details easily.\n    state = inherit(state, {\n      self: state,\n      resolve: state.resolve || {},\n      toString: function() { return this.name; }\n    });\n\n    var name = state.name;\n    if (!isString(name) || name.indexOf('@') >= 0) throw new Error(\"State must have a valid name\");\n    if (states.hasOwnProperty(name)) throw new Error(\"State '\" + name + \"'' is already defined\");\n\n    // Get parent name\n    var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))\n        : (isString(state.parent)) ? state.parent\n        : '';\n\n    // If parent is not registered yet, add state to queue and register later\n    if (parentName && !states[parentName]) {\n      return queueState(parentName, state.self);\n    }\n\n    for (var key in stateBuilder) {\n      if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);\n    }\n    states[name] = state;\n\n    // Register the state in the global state list and with $urlRouter if necessary.\n    if (!state[abstractKey] && state.url) {\n      $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {\n        if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {\n          $state.transitionTo(state, $match, { location: false });\n        }\n      }]);\n    }\n\n    // Register any queued children\n    if (queue[name]) {\n      for (var i = 0; i < queue[name].length; i++) {\n        registerState(queue[name][i]);\n      }\n    }\n\n    return state;\n  }\n\n  // Checks text to see if it looks like a glob.\n  function isGlob (text) {\n    return text.indexOf('*') > -1;\n  }\n\n  // Returns true if glob matches current $state name.\n  function doesStateMatchGlob (glob) {\n    var globSegments = glob.split('.'),\n        segments = $state.$current.name.split('.');\n\n    //match greedy starts\n    if (globSegments[0] === '**') {\n       segments = segments.slice(segments.indexOf(globSegments[1]));\n       segments.unshift('**');\n    }\n    //match greedy ends\n    if (globSegments[globSegments.length - 1] === '**') {\n       segments.splice(segments.indexOf(globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);\n       segments.push('**');\n    }\n\n    if (globSegments.length != segments.length) {\n      return false;\n    }\n\n    //match single stars\n    for (var i = 0, l = globSegments.length; i < l; i++) {\n      if (globSegments[i] === '*') {\n        segments[i] = '*';\n      }\n    }\n\n    return segments.join('') === globSegments.join('');\n  }\n\n\n  // Implicit root state that is always active\n  root = registerState({\n    name: '',\n    url: '^',\n    views: null,\n    'abstract': true\n  });\n  root.navigable = null;\n\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#decorator\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Allows you to extend (carefully) or override (at your own peril) the \n   * `stateBuilder` object used internally by `$stateProvider`. This can be used \n   * to add custom functionality to ui-router, for example inferring templateUrl \n   * based on the state name.\n   *\n   * When passing only a name, it returns the current (original or decorated) builder\n   * function that matches `name`.\n   *\n   * The builder functions that can be decorated are listed below. Though not all\n   * necessarily have a good use case for decoration, that is up to you to decide.\n   *\n   * In addition, users can attach custom decorators, which will generate new \n   * properties within the state's internal definition. There is currently no clear \n   * use-case for this beyond accessing internal states (i.e. $state.$current), \n   * however, expect this to become increasingly relevant as we introduce additional \n   * meta-programming features.\n   *\n   * **Warning**: Decorators should not be interdependent because the order of \n   * execution of the builder functions in non-deterministic. Builder functions \n   * should only be dependent on the state definition object and super function.\n   *\n   *\n   * Existing builder functions and current return values:\n   *\n   * - **parent** `{object}` - returns the parent state object.\n   * - **data** `{object}` - returns state data, including any inherited data that is not\n   *   overridden by own values (if any).\n   * - **url** `{object}` - returns a {link ui.router.util.type:UrlMatcher} or null.\n   * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is \n   *   navigable).\n   * - **params** `{object}` - returns an array of state params that are ensured to \n   *   be a super-set of parent's params.\n   * - **views** `{object}` - returns a views object where each key is an absolute view \n   *   name (i.e. \"viewName@stateName\") and each value is the config object \n   *   (template, controller) for the view. Even when you don't use the views object \n   *   explicitly on a state config, one is still created for you internally.\n   *   So by decorating this builder function you have access to decorating template \n   *   and controller properties.\n   * - **ownParams** `{object}` - returns an array of params that belong to the state, \n   *   not including any params defined by ancestor states.\n   * - **path** `{string}` - returns the full path from the root down to this state. \n   *   Needed for state activation.\n   * - **includes** `{object}` - returns an object that includes every state that \n   *   would pass a '$state.includes()' test.\n   *\n   * @example\n   * <pre>\n   * // Override the internal 'views' builder with a function that takes the state\n   * // definition, and a reference to the internal function being overridden:\n   * $stateProvider.decorator('views', function ($state, parent) {\n   *   var result = {},\n   *       views = parent(state);\n   *\n   *   angular.forEach(view, function (config, name) {\n   *     var autoName = (state.name + '.' + name).replace('.', '/');\n   *     config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n   *     result[name] = config;\n   *   });\n   *   return result;\n   * });\n   *\n   * $stateProvider.state('home', {\n   *   views: {\n   *     'contact.list': { controller: 'ListController' },\n   *     'contact.item': { controller: 'ItemController' }\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * $state.go('home');\n   * // Auto-populates list and item views with /partials/home/contact/list.html,\n   * // and /partials/home/contact/item.html, respectively.\n   * </pre>\n   *\n   * @param {string} name The name of the builder function to decorate. \n   * @param {object} func A function that is responsible for decorating the original \n   * builder function. The function receives two parameters:\n   *\n   *   - `{object}` - state - The state config object.\n   *   - `{object}` - super - The original builder function.\n   *\n   * @return {object} $stateProvider - $stateProvider instance\n   */\n  this.decorator = decorator;\n  function decorator(name, func) {\n    /*jshint validthis: true */\n    if (isString(name) && !isDefined(func)) {\n      return stateBuilder[name];\n    }\n    if (!isFunction(func) || !isString(name)) {\n      return this;\n    }\n    if (stateBuilder[name] && !stateBuilder.$delegates[name]) {\n      stateBuilder.$delegates[name] = stateBuilder[name];\n    }\n    stateBuilder[name] = func;\n    return this;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#state\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Registers a state configuration under a given state name. The stateConfig object\n   * has the following acceptable properties.\n   *\n   * <a id='template'></a>\n   *\n   * - **`template`** - {string|function=} - html template as a string or a function that returns\n   *   an html template as a string which should be used by the uiView directives. This property \n   *   takes precedence over templateUrl.\n   *   \n   *   If `template` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <a id='templateUrl'></a>\n   *\n   * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html \n   *   template that should be used by uiView.\n   *   \n   *   If `templateUrl` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by \n   *     applying the current state\n   *\n   * <a id='templateProvider'></a>\n   *\n   * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n   *   string.\n   *\n   * <a id='controller'></a>\n   *\n   * - **`controller`** - {string|function=} -  Controller fn that should be associated with newly \n   *   related scope or the name of a registered controller if passed as a string.\n   *\n   * <a id='controllerProvider'></a>\n   *\n   * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n   *   the actual controller or string.\n   *\n   * <a id='controllerAs'></a>\n   * \n   * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be \n   *   published to scope under the controllerAs name.\n   *\n   * <a id='resolve'></a>\n   *\n   * - **`resolve`** - {object.&lt;string, function&gt;=} - An optional map of dependencies which \n   *   should be injected into the controller. If any of these dependencies are promises, \n   *   the router will wait for them all to be resolved or one to be rejected before the \n   *   controller is instantiated. If all the promises are resolved successfully, the values \n   *   of the resolved promises are injected and $stateChangeSuccess event is fired. If any \n   *   of the promises are rejected the $stateChangeError event is fired. The map object is:\n   *   \n   *   - key - {string}: name of dependency to be injected into controller\n   *   - factory - {string|function}: If string then it is alias for service. Otherwise if function, \n   *     it is injected and return value it treated as dependency. If result is a promise, it is \n   *     resolved before its value is injected into controller.\n   *\n   * <a id='url'></a>\n   *\n   * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n   *   transitioned to, the `$stateParams` service will be populated with any \n   *   parameters that were passed.\n   *\n   * <a id='params'></a>\n   *\n   * - **`params`** - {object=} - An array of parameter names or regular expressions. Only \n   *   use this within a state if you are not using url. Otherwise you can specify your\n   *   parameters within the url. When a state is navigated or transitioned to, the \n   *   $stateParams service will be populated with any parameters that were passed.\n   *\n   * <a id='views'></a>\n   *\n   * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n   *   manually/explicitly.\n   *\n   * <a id='abstract'></a>\n   *\n   * - **`abstract`** - {boolean=} - An abstract state will never be directly activated, \n   *   but can provide inherited properties to its common children states.\n   *\n   * <a id='onEnter'></a>\n   *\n   * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n   *   to trigger an action or dispatch an event, such as opening a dialog.\n   *\n   * <a id='onExit'></a>\n   *\n   * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n   *   trigger an action or dispatch an event, such as opening a dialog.\n   *\n   * <a id='reloadOnSearch'></a>\n   *\n   * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state \n   *   just because a search/query parameter has changed (via $location.search() or $location.hash()). \n   *   Useful for when you'd like to modify $location.search() without triggering a reload.\n   *\n   * <a id='data'></a>\n   *\n   * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n   *\n   * @example\n   * <pre>\n   * // Some state name examples\n   *\n   * // stateName can be a single top-level name (must be unique).\n   * $stateProvider.state(\"home\", {});\n   *\n   * // Or it can be a nested state name. This state is a child of the \n   * // above \"home\" state.\n   * $stateProvider.state(\"home.newest\", {});\n   *\n   * // Nest states as deeply as needed.\n   * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n   *\n   * // state() returns $stateProvider, so you can chain state declarations.\n   * $stateProvider\n   *   .state(\"home\", {})\n   *   .state(\"about\", {})\n   *   .state(\"contacts\", {});\n   * </pre>\n   *\n   * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\". \n   * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n   * @param {object} definition State configuration object.\n   */\n  this.state = state;\n  function state(name, definition) {\n    /*jshint validthis: true */\n    if (isObject(name)) definition = name;\n    else definition.name = name;\n    registerState(definition);\n    return this;\n  }\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$state\n   *\n   * @requires $rootScope\n   * @requires $q\n   * @requires ui.router.state.$view\n   * @requires $injector\n   * @requires ui.router.util.$resolve\n   * @requires ui.router.state.$stateParams\n   *\n   * @property {object} params A param object, e.g. {sectionId: section.id)}, that \n   * you'd like to test against the current active state.\n   * @property {object} current A reference to the state's config object. However \n   * you passed it in. Useful for accessing custom data.\n   * @property {object} transition Currently pending transition. A promise that'll \n   * resolve or reject.\n   *\n   * @description\n   * `$state` service is responsible for representing states as well as transitioning\n   * between them. It also provides interfaces to ask for current state or even states\n   * you're coming from.\n   */\n  // $urlRouter is injected just to ensure it gets instantiated\n  this.$get = $get;\n  $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$location', '$urlRouter', '$browser'];\n  function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $location,   $urlRouter,   $browser) {\n\n    var TransitionSuperseded = $q.reject(new Error('transition superseded'));\n    var TransitionPrevented = $q.reject(new Error('transition prevented'));\n    var TransitionAborted = $q.reject(new Error('transition aborted'));\n    var TransitionFailed = $q.reject(new Error('transition failed'));\n    var currentLocation = $location.url();\n    var baseHref = $browser.baseHref();\n\n    function syncUrl() {\n      if ($location.url() !== currentLocation) {\n        $location.url(currentLocation);\n        $location.replace();\n      }\n    }\n\n    root.locals = { resolve: null, globals: { $stateParams: {} } };\n    $state = {\n      params: {},\n      current: root.self,\n      $current: root,\n      transition: null\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#reload\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method that force reloads the current state. All resolves are re-resolved, events are not re-fired, \n     * and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon).\n     *\n     * @example\n     * <pre>\n     * var app angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.reload = function(){\n     *     $state.reload();\n     *   }\n     * });\n     * </pre>\n     *\n     * `reload()` is just an alias for:\n     * <pre>\n     * $state.transitionTo($state.current, $stateParams, { \n     *   reload: true, inherit: false, notify: false \n     * });\n     * </pre>\n     */\n    $state.reload = function reload() {\n      $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: false });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#go\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Convenience method for transitioning to a new state. `$state.go` calls \n     * `$state.transitionTo` internally but automatically sets options to \n     * `{ location: true, inherit: true, relative: $state.$current, notify: true }`. \n     * This allows you to easily use an absolute or relative to path and specify \n     * only the parameters you'd like to update (while letting unspecified parameters \n     * inherit from the currently active ancestor states).\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.go('contact.detail');\n     *   };\n     * });\n     * </pre>\n     * <img src='../ngdoc_assets/StateGoExamples.png'/>\n     *\n     * @param {string} to Absolute state name or relative state path. Some examples:\n     *\n     * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n     * - `$state.go('^')` - will go to a parent state\n     * - `$state.go('^.sibling')` - will go to a sibling state\n     * - `$state.go('.child.grandchild')` - will go to grandchild state\n     *\n     * @param {object=} params A map of the parameters that will be sent to the state, \n     * will populate $stateParams. Any parameters that are not specified will be inherited from currently \n     * defined parameters. This allows, for example, going to a sibling state that shares parameters\n     * specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.\n     * transitioning to a sibling will get you the parameters for all parents, transitioning to a child\n     * will get you all current parameters, etc.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition.\n     *\n     * Possible success values:\n     *\n     * - $state.current\n     *\n     * <br/>Possible rejection values:\n     *\n     * - 'transition superseded' - when a newer transition has been started after this one\n     * - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener\n     * - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or\n     *   when a `$stateNotFound` `event.retry` promise errors.\n     * - 'transition failed' - when a state has been unsuccessfully found after 2 tries.\n     * - *resolve error* - when an error has occurred with a `resolve`\n     *\n     */\n    $state.go = function go(to, params, options) {\n      return this.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#transitionTo\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}\n     * uses `transitionTo` internally. `$state.go` is recommended in most situations.\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.transitionTo('contact.detail');\n     *   };\n     * });\n     * </pre>\n     *\n     * @param {string} to State name.\n     * @param {object=} toParams A map of the parameters that will be sent to the state,\n     * will populate $stateParams.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.transitionTo = function transitionTo(to, toParams, options) {\n      toParams = toParams || {};\n      options = extend({\n        location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false\n      }, options || {});\n\n      var from = $state.$current, fromParams = $state.params, fromPath = from.path;\n      var evt, toState = findState(to, options.relative);\n\n      if (!isDefined(toState)) {\n        // Broadcast not found event and abort the transition if prevented\n        var redirect = { to: to, toParams: toParams, options: options };\n\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateNotFound\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when a requested state **cannot be found** using the provided state name during transition.\n         * The event is broadcast allowing any handlers a single chance to deal with the error (usually by\n         * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,\n         * you can see its three properties in the example. You can use `event.preventDefault()` to abort the\n         * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.\n         * @param {State} fromState Current state object.\n         * @param {Object} fromParams Current state params.\n         *\n         * @example\n         *\n         * <pre>\n         * // somewhere, assume lazy.state has not been defined\n         * $state.go(\"lazy.state\", {a:1, b:2}, {inherit:false});\n         *\n         * // somewhere else\n         * $scope.$on('$stateNotFound',\n         * function(event, unfoundState, fromState, fromParams){\n         *     console.log(unfoundState.to); // \"lazy.state\"\n         *     console.log(unfoundState.toParams); // {a:1, b:2}\n         *     console.log(unfoundState.options); // {inherit:false} + default options\n         * })\n         * </pre>\n         */\n        evt = $rootScope.$broadcast('$stateNotFound', redirect, from.self, fromParams);\n        if (evt.defaultPrevented) {\n          syncUrl();\n          return TransitionAborted;\n        }\n\n        // Allow the handler to return a promise to defer state lookup retry\n        if (evt.retry) {\n          if (options.$retry) {\n            syncUrl();\n            return TransitionFailed;\n          }\n          var retryTransition = $state.transition = $q.when(evt.retry);\n          retryTransition.then(function() {\n            if (retryTransition !== $state.transition) return TransitionSuperseded;\n            redirect.options.$retry = true;\n            return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);\n          }, function() {\n            return TransitionAborted;\n          });\n          syncUrl();\n          return retryTransition;\n        }\n\n        // Always retry once if the $stateNotFound was not prevented\n        // (handles either redirect changed or state lazy-definition)\n        to = redirect.to;\n        toParams = redirect.toParams;\n        options = redirect.options;\n        toState = findState(to, options.relative);\n        if (!isDefined(toState)) {\n          if (options.relative) throw new Error(\"Could not resolve '\" + to + \"' from state '\" + options.relative + \"'\");\n          throw new Error(\"No such state '\" + to + \"'\");\n        }\n      }\n      if (toState[abstractKey]) throw new Error(\"Cannot transition to abstract state '\" + to + \"'\");\n      if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);\n      to = toState;\n\n      var toPath = to.path;\n\n      // Starting from the root of the path, keep all levels that haven't changed\n      var keep, state, locals = root.locals, toLocals = [];\n      for (keep = 0, state = toPath[keep];\n           state && state === fromPath[keep] && equalForKeys(toParams, fromParams, state.ownParams) && !options.reload;\n           keep++, state = toPath[keep]) {\n        locals = toLocals[keep] = state.locals;\n      }\n\n      // If we're going to the same state and all locals are kept, we've got nothing to do.\n      // But clear 'transition', as we still want to cancel any other pending transitions.\n      // TODO: We may not want to bump 'transition' if we're called from a location change that we've initiated ourselves,\n      // because we might accidentally abort a legitimate transition initiated from code?\n      if (shouldTriggerReload(to, from, locals, options) ) {\n        if ( to.self.reloadOnSearch !== false )\n          syncUrl();\n        $state.transition = null;\n        return $q.when($state.current);\n      }\n\n      // Normalize/filter parameters before we pass them to event handlers etc.\n      toParams = normalize(to.params, toParams || {});\n\n      // Broadcast start event and cancel the transition if requested\n      if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeStart\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when the state transition **begins**. You can use `event.preventDefault()`\n         * to prevent the transition from happening and then the transition promise will be\n         * rejected with a `'transition prevented'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         *\n         * @example\n         *\n         * <pre>\n         * $rootScope.$on('$stateChangeStart',\n         * function(event, toState, toParams, fromState, fromParams){\n         *     event.preventDefault();\n         *     // transitionTo() promise will be rejected with\n         *     // a 'transition prevented' error\n         * })\n         * </pre>\n         */\n        evt = $rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams);\n        if (evt.defaultPrevented) {\n          syncUrl();\n          return TransitionPrevented;\n        }\n      }\n\n      // Resolve locals for the remaining states, but don't update any global state just\n      // yet -- if anything fails to resolve the current state needs to remain untouched.\n      // We also set up an inheritance chain for the locals here. This allows the view directive\n      // to quickly look up the correct definition for each view in the current state. Even\n      // though we create the locals object itself outside resolveState(), it is initially\n      // empty and gets filled asynchronously. We need to keep track of the promise for the\n      // (fully resolved) current locals, and pass this down the chain.\n      var resolved = $q.when(locals);\n      for (var l=keep; l<toPath.length; l++, state=toPath[l]) {\n        locals = toLocals[l] = inherit(locals);\n        resolved = resolveState(state, toParams, state===to, resolved, locals);\n      }\n\n      // Once everything is resolved, we are ready to perform the actual transition\n      // and return a promise for the new state. We also keep track of what the\n      // current promise is, so that we can detect overlapping transitions and\n      // keep only the outcome of the last transition.\n      var transition = $state.transition = resolved.then(function () {\n        var l, entering, exiting;\n\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Exit 'from' states not kept\n        for (l=fromPath.length-1; l>=keep; l--) {\n          exiting = fromPath[l];\n          if (exiting.self.onExit) {\n            $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);\n          }\n          exiting.locals = null;\n        }\n\n        // Enter 'to' states not kept\n        for (l=keep; l<toPath.length; l++) {\n          entering = toPath[l];\n          entering.locals = toLocals[l];\n          if (entering.self.onEnter) {\n            $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);\n          }\n        }\n\n        // Run it again, to catch any transitions in callbacks\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Update globals in $state\n        $state.$current = to;\n        $state.current = to.self;\n        $state.params = toParams;\n        copy($state.params, $stateParams);\n        $state.transition = null;\n\n        // Update $location\n        var toNav = to.navigable;\n        if (options.location && toNav) {\n          $location.url(toNav.url.format(toNav.locals.globals.$stateParams));\n\n          if (options.location === 'replace') {\n            $location.replace();\n          }\n        }\n\n        if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeSuccess\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired once the state transition is **complete**.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         */\n          $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);\n        }\n        currentLocation = $location.url();\n\n        return $state.current;\n      }, function (error) {\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        $state.transition = null;\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeError\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when an **error occurs** during transition. It's important to note that if you\n         * have any errors in your resolve functions (javascript errors, non-existent services, etc)\n         * they will not throw traditionally. You must listen for this $stateChangeError event to\n         * catch **ALL** errors.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         * @param {Error} error The resolve error object.\n         */\n        $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);\n        syncUrl();\n\n        return $q.reject(error);\n      });\n\n      return transition;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#is\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Similar to {@link ui.router.state.$state#methods_includes $state.includes},\n     * but only checks for the full state name. If params is supplied then it will be \n     * tested for strict equality against the current active params object, so all params \n     * must match with none missing and no extras.\n     *\n     * @example\n     * <pre>\n     * $state.is('contact.details.item'); // returns true\n     * $state.is(contactDetailItemStateObject); // returns true\n     *\n     * // everything else would return false\n     * </pre>\n     *\n     * @param {string|object} stateName The state name or state object you'd like to check.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like \n     * to test against the current active state.\n     * @returns {boolean} Returns true if it is the state.\n     */\n    $state.is = function is(stateOrName, params) {\n      var state = findState(stateOrName);\n\n      if (!isDefined(state)) {\n        return undefined;\n      }\n\n      if ($state.$current !== state) {\n        return false;\n      }\n\n      return isDefined(params) && params !== null ? angular.equals($stateParams, params) : true;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#includes\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method to determine if the current active state is equal to or is the child of the \n     * state stateName. If any params are passed then they will be tested for a match as well.\n     * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * $state.includes(\"contacts\"); // returns true\n     * $state.includes(\"contacts.details\"); // returns true\n     * $state.includes(\"contacts.details.item\"); // returns true\n     * $state.includes(\"contacts.list\"); // returns false\n     * $state.includes(\"about\"); // returns false\n     * </pre>\n     *\n     * @description\n     * Basic globing patterns will also work.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item.url';\n     *\n     * $state.includes(\"*.details.*.*\"); // returns true\n     * $state.includes(\"*.details.**\"); // returns true\n     * $state.includes(\"**.item.**\"); // returns true\n     * $state.includes(\"*.details.item.url\"); // returns true\n     * $state.includes(\"*.details.*.url\"); // returns true\n     * $state.includes(\"*.details.*\"); // returns false\n     * $state.includes(\"item.**\"); // returns false\n     * </pre>\n     *\n     * @param {string} stateOrName A partial name to be searched for within the current state name.\n     * @param {object} params A param object, e.g. `{sectionId: section.id}`, \n     * that you'd like to test against the current active state.\n     * @returns {boolean} Returns true if it does include the state\n     */\n\n    $state.includes = function includes(stateOrName, params) {\n      if (isString(stateOrName) && isGlob(stateOrName)) {\n        if (doesStateMatchGlob(stateOrName)) {\n          stateOrName = $state.$current.name;\n        } else {\n          return false;\n        }\n      }\n\n      var state = findState(stateOrName);\n      if (!isDefined(state)) {\n        return undefined;\n      }\n\n      if (!isDefined($state.$current.includes[state.name])) {\n        return false;\n      }\n\n      var validParams = true;\n      angular.forEach(params, function(value, key) {\n        if (!isDefined($stateParams[key]) || $stateParams[key] !== value) {\n          validParams = false;\n        }\n      });\n      return validParams;\n    };\n\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#href\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A url generation method that returns the compiled url for the given state populated with the given params.\n     *\n     * @example\n     * <pre>\n     * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name or state object you'd like to generate a url from.\n     * @param {object=} params An object of parameter values to fill the state's required parameters.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`lossy`** - {boolean=true} -  If true, and if there is no url associated with the state provided in the\n     *    first parameter, then the constructed href url will be built from the first navigable ancestor (aka\n     *    ancestor with a valid url).\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n     * \n     * @returns {string} compiled state url\n     */\n    $state.href = function href(stateOrName, params, options) {\n      options = extend({ lossy: true, inherit: false, absolute: false, relative: $state.$current }, options || {});\n      var state = findState(stateOrName, options.relative);\n      if (!isDefined(state)) return null;\n\n      params = inheritParams($stateParams, params || {}, $state.$current, state);\n      var nav = (state && options.lossy) ? state.navigable : state;\n      var url = (nav && nav.url) ? nav.url.format(normalize(state.params, params || {})) : null;\n      if (!$locationProvider.html5Mode() && url) {\n        url = \"#\" + $locationProvider.hashPrefix() + url;\n      }\n\n      if (baseHref !== '/') {\n        if ($locationProvider.html5Mode()) {\n          url = baseHref.slice(0, -1) + url;\n        } else if (options.absolute){\n          url = baseHref.slice(1) + url;\n        }\n      }\n\n      if (options.absolute && url) {\n        url = $location.protocol() + '://' + \n              $location.host() + \n              ($location.port() == 80 || $location.port() == 443 ? '' : ':' + $location.port()) + \n              (!$locationProvider.html5Mode() && url ? '/' : '') + \n              url;\n      }\n      return url;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#get\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Returns the state configuration object for any specific state or all states.\n     *\n     * @param {string|object=} stateOrName If provided, will only get the config for\n     * the requested state. If not provided, returns an array of ALL state configs.\n     * @returns {object|array} State configuration object or array of all objects.\n     */\n    $state.get = function (stateOrName, context) {\n      if (!isDefined(stateOrName)) {\n        var list = [];\n        forEach(states, function(state) { list.push(state.self); });\n        return list;\n      }\n      var state = findState(stateOrName, context);\n      return (state && state.self) ? state.self : null;\n    };\n\n    function resolveState(state, params, paramsAreFiltered, inherited, dst) {\n      // Make a restricted $stateParams with only the parameters that apply to this state if\n      // necessary. In addition to being available to the controller and onEnter/onExit callbacks,\n      // we also need $stateParams to be available for any $injector calls we make during the\n      // dependency resolution process.\n      var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params, params);\n      var locals = { $stateParams: $stateParams };\n\n      // Resolve 'global' dependencies for the state, i.e. those not specific to a view.\n      // We're also including $stateParams in this; that way the parameters are restricted\n      // to the set that should be visible to the state, and are independent of when we update\n      // the global $state and $stateParams values.\n      dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);\n      var promises = [ dst.resolve.then(function (globals) {\n        dst.globals = globals;\n      }) ];\n      if (inherited) promises.push(inherited);\n\n      // Resolve template and dependencies for all views.\n      forEach(state.views, function (view, name) {\n        var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});\n        injectables.$template = [ function () {\n          return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: false }) || '';\n        }];\n\n        promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) {\n          // References to the controller (only instantiated at link time)\n          if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {\n            var injectLocals = angular.extend({}, injectables, locals);\n            result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);\n          } else {\n            result.$$controller = view.controller;\n          }\n          // Provide access to the state itself for internal use\n          result.$$state = state;\n          result.$$controllerAs = view.controllerAs;\n          dst[name] = result;\n        }));\n      });\n\n      // Wait for all the promises and then return the activation object\n      return $q.all(promises).then(function (values) {\n        return dst;\n      });\n    }\n\n    return $state;\n  }\n\n  function shouldTriggerReload(to, from, locals, options) {\n    if ( to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false)) ) {\n      return true;\n    }\n  }\n}\n\nangular.module('ui.router.state')\n  .value('$stateParams', {})\n  .provider('$state', $StateProvider);\n\n\n$ViewProvider.$inject = [];\nfunction $ViewProvider() {\n\n  this.$get = $get;\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$view\n   *\n   * @requires ui.router.util.$templateFactory\n   * @requires $rootScope\n   *\n   * @description\n   *\n   */\n  $get.$inject = ['$rootScope', '$templateFactory'];\n  function $get(   $rootScope,   $templateFactory) {\n    return {\n      // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })\n      /**\n       * @ngdoc function\n       * @name ui.router.state.$view#load\n       * @methodOf ui.router.state.$view\n       *\n       * @description\n       *\n       * @param {string} name name\n       * @param {object} options option object.\n       */\n      load: function load(name, options) {\n        var result, defaults = {\n          template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}\n        };\n        options = extend(defaults, options);\n\n        if (options.view) {\n          result = $templateFactory.fromConfig(options.view, options.params, options.locals);\n        }\n        if (result && options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$viewContentLoading\n         * @eventOf ui.router.state.$view\n         * @eventType broadcast on root scope\n         * @description\n         *\n         * Fired once the view **begins loading**, *before* the DOM is rendered.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} viewConfig The view config properties (template, controller, etc).\n         *\n         * @example\n         *\n         * <pre>\n         * $scope.$on('$viewContentLoading',\n         * function(event, viewConfig){\n         *     // Access to all the view config properties.\n         *     // and one special property 'targetView'\n         *     // viewConfig.targetView\n         * });\n         * </pre>\n         */\n          $rootScope.$broadcast('$viewContentLoading', options);\n        }\n        return result;\n      }\n    };\n  }\n}\n\nangular.module('ui.router.state').provider('$view', $ViewProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$uiViewScrollProvider\n *\n * @description\n * Provider that returns the {@link ui.router.state.$uiViewScroll} service function.\n */\nfunction $ViewScrollProvider() {\n\n  var useAnchorScroll = false;\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll\n   * @methodOf ui.router.state.$uiViewScrollProvider\n   *\n   * @description\n   * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for\n   * scrolling based on the url anchor.\n   */\n  this.useAnchorScroll = function () {\n    useAnchorScroll = true;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$uiViewScroll\n   *\n   * @requires $anchorScroll\n   * @requires $timeout\n   *\n   * @description\n   * When called with a jqLite element, it scrolls the element into view (after a\n   * `$timeout` so the DOM has time to refresh).\n   *\n   * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n   * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.\n   */\n  this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {\n    if (useAnchorScroll) {\n      return $anchorScroll;\n    }\n\n    return function ($element) {\n      $timeout(function () {\n        $element[0].scrollIntoView();\n      }, 0, false);\n    };\n  }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-view\n *\n * @requires ui.router.state.$state\n * @requires $compile\n * @requires $controller\n * @requires $injector\n * @requires ui.router.state.$uiViewScroll\n * @requires $document\n *\n * @restrict ECA\n *\n * @description\n * The ui-view directive tells $state where to place your templates.\n *\n * @param {string=} ui-view A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states.\n *\n * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window\n * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll\n * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you\n * scroll ui-view elements into view when they are populated during a state activation.\n *\n * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*\n *\n * @param {string=} onload Expression to evaluate whenever the view updates.\n * \n * @example\n * A view can be unnamed or named. \n * <pre>\n * <!-- Unnamed -->\n * <div ui-view></div> \n * \n * <!-- Named -->\n * <div ui-view=\"viewName\"></div>\n * </pre>\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a \n * single view and it is unnamed then you can populate it like so:\n * <pre>\n * <div ui-view></div> \n * $stateProvider.state(\"home\", {\n *   template: \"<h1>HELLO!</h1>\"\n * })\n * </pre>\n * \n * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}\n * config property, by name, in this case an empty name:\n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * But typically you'll only use the views property if you name your view or have more than one view \n * in the same template. There's not really a compelling reason to name a view if its the only one, \n * but you could if you wanted, like so:\n * <pre>\n * <div ui-view=\"main\"></div>\n * </pre> \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"main\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * Really though, you'll use views to set up multiple views:\n * <pre>\n * <div ui-view></div>\n * <div ui-view=\"chart\"></div> \n * <div ui-view=\"data\"></div> \n * </pre>\n * \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     },\n *     \"chart\": {\n *       template: \"<chart_thing/>\"\n *     },\n *     \"data\": {\n *       template: \"<data_thing/>\"\n *     }\n *   }    \n * })\n * </pre>\n *\n * Examples for `autoscroll`:\n *\n * <pre>\n * <!-- If autoscroll present with no expression,\n *      then scroll ui-view into view -->\n * <ui-view autoscroll/>\n *\n * <!-- If autoscroll present with valid expression,\n *      then scroll ui-view into view if expression evaluates to true -->\n * <ui-view autoscroll='true'/>\n * <ui-view autoscroll='false'/>\n * <ui-view autoscroll='scopeVariable'/>\n * </pre>\n */\n$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll'];\nfunction $ViewDirective(   $state,   $injector,   $uiViewScroll) {\n\n  function getService() {\n    return ($injector.has) ? function(service) {\n      return $injector.has(service) ? $injector.get(service) : null;\n    } : function(service) {\n      try {\n        return $injector.get(service);\n      } catch (e) {\n        return null;\n      }\n    };\n  }\n\n  var service = getService(),\n      $animator = service('$animator'),\n      $animate = service('$animate');\n\n  // Returns a set of DOM manipulation functions based on which Angular version\n  // it should use\n  function getRenderer(attrs, scope) {\n    var statics = function() {\n      return {\n        enter: function (element, target, cb) { target.after(element); cb(); },\n        leave: function (element, cb) { element.remove(); cb(); }\n      };\n    };\n\n    if ($animate) {\n      return {\n        enter: function(element, target, cb) { $animate.enter(element, null, target, cb); },\n        leave: function(element, cb) { $animate.leave(element, cb); }\n      };\n    }\n\n    if ($animator) {\n      var animate = $animator && $animator(scope, attrs);\n\n      return {\n        enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },\n        leave: function(element, cb) { animate.leave(element); cb(); }\n      };\n    }\n\n    return statics();\n  }\n\n  var directive = {\n    restrict: 'ECA',\n    terminal: true,\n    priority: 400,\n    transclude: 'element',\n    compile: function (tElement, tAttrs, $transclude) {\n      return function (scope, $element, attrs) {\n        var previousEl, currentEl, currentScope, latestLocals,\n            onloadExp     = attrs.onload || '',\n            autoScrollExp = attrs.autoscroll,\n            renderer      = getRenderer(attrs, scope);\n\n        scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        updateView(true);\n\n        function cleanupLastView() {\n          if (previousEl) {\n            previousEl.remove();\n            previousEl = null;\n          }\n\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n\n          if (currentEl) {\n            renderer.leave(currentEl, function() {\n              previousEl = null;\n            });\n\n            previousEl = currentEl;\n            currentEl = null;\n          }\n        }\n\n        function updateView(firstTime) {\n          var newScope        = scope.$new(),\n              name            = currentEl && currentEl.data('$uiViewName'),\n              previousLocals  = name && $state.$current && $state.$current.locals[name];\n\n          if (!firstTime && previousLocals === latestLocals) return; // nothing to do\n\n          var clone = $transclude(newScope, function(clone) {\n            renderer.enter(clone, $element, function onUiViewEnter() {\n              if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n                $uiViewScroll(clone);\n              }\n            });\n            cleanupLastView();\n          });\n\n          latestLocals = $state.$current.locals[clone.data('$uiViewName')];\n\n          currentEl = clone;\n          currentScope = newScope;\n          /**\n           * @ngdoc event\n           * @name ui.router.state.directive:ui-view#$viewContentLoaded\n           * @eventOf ui.router.state.directive:ui-view\n           * @eventType emits on ui-view directive scope\n           * @description           *\n           * Fired once the view is **loaded**, *after* the DOM is rendered.\n           *\n           * @param {Object} event Event object.\n           */\n          currentScope.$emit('$viewContentLoaded');\n          currentScope.$eval(onloadExp);\n        }\n      };\n    }\n  };\n\n  return directive;\n}\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state'];\nfunction $ViewDirectiveFill ($compile, $controller, $state) {\n  return {\n    restrict: 'ECA',\n    priority: -400,\n    compile: function (tElement) {\n      var initial = tElement.html();\n      return function (scope, $element, attrs) {\n        var name      = attrs.uiView || attrs.name || '',\n            inherited = $element.inheritedData('$uiView');\n\n        if (name.indexOf('@') < 0) {\n          name = name + '@' + (inherited ? inherited.state.name : '');\n        }\n\n        $element.data('$uiViewName', name);\n\n        var current = $state.$current,\n            locals  = current && current.locals[name];\n\n        if (! locals) {\n          return;\n        }\n\n        $element.data('$uiView', { name: name, state: locals.$$state });\n        $element.html(locals.$template ? locals.$template : initial);\n\n        var link = $compile($element.contents());\n\n        if (locals.$$controller) {\n          locals.$scope = scope;\n          var controller = $controller(locals.$$controller, locals);\n          if (locals.$$controllerAs) {\n            scope[locals.$$controllerAs] = controller;\n          }\n          $element.data('$ngControllerController', controller);\n          $element.children().data('$ngControllerController', controller);\n        }\n\n        link(scope);\n      };\n    }\n  };\n}\n\nangular.module('ui.router.state').directive('uiView', $ViewDirective);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n\nfunction parseStateRef(ref) {\n  var parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n  if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n  return { state: parsed[1], paramExpr: parsed[3] || null };\n}\n\nfunction stateContext(el) {\n  var stateData = el.parent().inheritedData('$uiView');\n\n  if (stateData && stateData.state && stateData.state.name) {\n    return stateData.state;\n  }\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref\n *\n * @requires ui.router.state.$state\n * @requires $timeout\n *\n * @restrict A\n *\n * @description\n * A directive that binds a link (`<a>` tag) to a state. If the state has an associated \n * URL, the directive will automatically generate & update the `href` attribute via \n * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking \n * the link will trigger a state transition with optional parameters. \n *\n * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be \n * handled natively by the browser.\n *\n * You can also use relative state paths within ui-sref, just like the relative \n * paths passed to `$state.go()`. You just need to be aware that the path is relative\n * to the state that the link lives in, in other words the state that loaded the \n * template containing the link.\n *\n * You can specify options to pass to {@link ui.router.state.$state#go $state.go()}\n * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,\n * and `reload`.\n *\n * @example\n * Here's an example of how you'd use ui-sref and how it would compile. If you have the \n * following template:\n * <pre>\n * <a ui-sref=\"home\">Home</a> | <a ui-sref=\"about\">About</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a ui-sref=\"contacts.detail({ id: contact.id })\">{{ contact.name }}</a>\n *     </li>\n * </ul>\n * </pre>\n * \n * Then the compiled html would be (assuming Html5Mode is off):\n * <pre>\n * <a href=\"#/home\" ui-sref=\"home\">Home</a> | <a href=\"#/about\" ui-sref=\"about\">About</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/1\" ui-sref=\"contacts.detail({ id: contact.id })\">Joe</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/2\" ui-sref=\"contacts.detail({ id: contact.id })\">Alice</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/3\" ui-sref=\"contacts.detail({ id: contact.id })\">Bob</a>\n *     </li>\n * </ul>\n *\n * <a ui-sref=\"home\" ui-sref-opts=\"{reload: true}\">Home</a>\n * </pre>\n *\n * @param {string} ui-sref 'stateName' can be any valid absolute or relative state\n * @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}\n */\n$StateRefDirective.$inject = ['$state', '$timeout'];\nfunction $StateRefDirective($state, $timeout) {\n  var allowedOptions = ['location', 'inherit', 'reload'];\n\n  return {\n    restrict: 'A',\n    require: '?^uiSrefActive',\n    link: function(scope, element, attrs, uiSrefActive) {\n      var ref = parseStateRef(attrs.uiSref);\n      var params = null, url = null, base = stateContext(element) || $state.$current;\n      var isForm = element[0].nodeName === \"FORM\";\n      var attr = isForm ? \"action\" : \"href\", nav = true;\n\n      var options = {\n        relative: base\n      };\n      var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};\n      angular.forEach(allowedOptions, function(option) {\n        if (option in optionsOverride) {\n          options[option] = optionsOverride[option];\n        }\n      });\n\n      var update = function(newVal) {\n        if (newVal) params = newVal;\n        if (!nav) return;\n\n        var newHref = $state.href(ref.state, params, options);\n\n        if (uiSrefActive) {\n          uiSrefActive.$$setStateInfo(ref.state, params);\n        }\n        if (!newHref) {\n          nav = false;\n          return false;\n        }\n        element[0][attr] = newHref;\n      };\n\n      if (ref.paramExpr) {\n        scope.$watch(ref.paramExpr, function(newVal, oldVal) {\n          if (newVal !== params) update(newVal);\n        }, true);\n        params = scope.$eval(ref.paramExpr);\n      }\n      update();\n\n      if (isForm) return;\n\n      element.bind(\"click\", function(e) {\n        var button = e.which || e.button;\n        if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {\n          // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n          $timeout(function() {\n            $state.go(ref.state, params, options);\n          });\n          e.preventDefault();\n        }\n      });\n    }\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * A directive working alongside ui-sref to add classes to an element when the \n * related ui-sref directive's state is active, and removing them when it is inactive.\n * The primary use-case is to simplify the special appearance of navigation menus \n * relying on `ui-sref`, by having the \"active\" state's menu button appear different,\n * distinguishing it from the inactive menu items.\n *\n * @example\n * Given the following template:\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item\">\n *     <a href ui-sref=\"app.user({user: 'bilbobaggins'})\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n * \n * When the app state is \"app.user\", and contains the state parameter \"user\" with value \"bilbobaggins\", \n * the resulting HTML will appear as (note the 'active' class):\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item active\">\n *     <a ui-sref=\"app.user({user: 'bilbobaggins'})\" href=\"/users/bilbobaggins\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n * \n * The class name is interpolated **once** during the directives link time (any further changes to the \n * interpolated value are ignored). \n * \n * Multiple classes may be specified in a space-separated format:\n * <pre>\n * <ul>\n *   <li ui-sref-active='class1 class2 class3'>\n *     <a ui-sref=\"app.user\">link</a>\n *   </li>\n * </ul>\n * </pre>\n */\n$StateActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];\nfunction $StateActiveDirective($state, $stateParams, $interpolate) {\n  return {\n    restrict: \"A\",\n    controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {\n      var state, params, activeClass;\n\n      // There probably isn't much point in $observing this\n      activeClass = $interpolate($attrs.uiSrefActive || '', false)($scope);\n\n      // Allow uiSref to communicate with uiSrefActive\n      this.$$setStateInfo = function(newState, newParams) {\n        state = $state.get(newState, stateContext($element));\n        params = newParams;\n        update();\n      };\n\n      $scope.$on('$stateChangeSuccess', update);\n\n      // Update route state\n      function update() {\n        if ($state.$current.self === state && matchesParams()) {\n          $element.addClass(activeClass);\n        } else {\n          $element.removeClass(activeClass);\n        }\n      }\n\n      function matchesParams() {\n        return !params || equalForKeys(params, $stateParams);\n      }\n    }]\n  };\n}\n\nangular.module('ui.router.state')\n  .directive('uiSref', $StateRefDirective)\n  .directive('uiSrefActive', $StateActiveDirective);\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:isState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_is $state.is(\"stateName\")}.\n */\n$IsStateFilter.$inject = ['$state'];\nfunction $IsStateFilter($state) {\n  return function(state) {\n    return $state.is(state);\n  };\n}\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:includedByState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.\n */\n$IncludedByStateFilter.$inject = ['$state'];\nfunction $IncludedByStateFilter($state) {\n  return function(state) {\n    return $state.includes(state);\n  };\n}\n\nangular.module('ui.router.state')\n  .filter('isState', $IsStateFilter)\n  .filter('includedByState', $IncludedByStateFilter);\n\n/*\n * @ngdoc object\n * @name ui.router.compat.$routeProvider\n *\n * @requires ui.router.state.$stateProvider\n * @requires ui.router.router.$urlRouterProvider\n *\n * @description\n * `$routeProvider` of the `ui.router.compat` module overwrites the existing\n * `routeProvider` from the core. This is done to provide compatibility between\n * the UI Router and the core router.\n *\n * It also provides a `when()` method to register routes that map to certain urls.\n * Behind the scenes it actually delegates either to \n * {@link ui.router.router.$urlRouterProvider $urlRouterProvider} or to the \n * {@link ui.router.state.$stateProvider $stateProvider} to postprocess the given \n * router definition object.\n */\n$RouteProvider.$inject = ['$stateProvider', '$urlRouterProvider'];\nfunction $RouteProvider(  $stateProvider,    $urlRouterProvider) {\n\n  var routes = [];\n\n  onEnterRoute.$inject = ['$$state'];\n  function onEnterRoute(   $$state) {\n    /*jshint validthis: true */\n    this.locals = $$state.locals.globals;\n    this.params = this.locals.$stateParams;\n  }\n\n  function onExitRoute() {\n    /*jshint validthis: true */\n    this.locals = null;\n    this.params = null;\n  }\n\n  this.when = when;\n  /*\n   * @ngdoc function\n   * @name ui.router.compat.$routeProvider#when\n   * @methodOf ui.router.compat.$routeProvider\n   *\n   * @description\n   * Registers a route with a given route definition object. The route definition\n   * object has the same interface the angular core route definition object has.\n   * \n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.compat']);\n   *\n   * app.config(function ($routeProvider) {\n   *   $routeProvider.when('home', {\n   *     controller: function () { ... },\n   *     templateUrl: 'path/to/template'\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string} url URL as string\n   * @param {object} route Route definition object\n   *\n   * @return {object} $routeProvider - $routeProvider instance\n   */\n  function when(url, route) {\n    /*jshint validthis: true */\n    if (route.redirectTo != null) {\n      // Redirect, configure directly on $urlRouterProvider\n      var redirect = route.redirectTo, handler;\n      if (isString(redirect)) {\n        handler = redirect; // leave $urlRouterProvider to handle\n      } else if (isFunction(redirect)) {\n        // Adapt to $urlRouterProvider API\n        handler = function (params, $location) {\n          return redirect(params, $location.path(), $location.search());\n        };\n      } else {\n        throw new Error(\"Invalid 'redirectTo' in when()\");\n      }\n      $urlRouterProvider.when(url, handler);\n    } else {\n      // Regular route, configure as state\n      $stateProvider.state(inherit(route, {\n        parent: null,\n        name: 'route:' + encodeURIComponent(url),\n        url: url,\n        onEnter: onEnterRoute,\n        onExit: onExitRoute\n      }));\n    }\n    routes.push(route);\n    return this;\n  }\n\n  /*\n   * @ngdoc object\n   * @name ui.router.compat.$route\n   *\n   * @requires ui.router.state.$state\n   * @requires $rootScope\n   * @requires $routeParams\n   *\n   * @property {object} routes - Array of registered routes.\n   * @property {object} params - Current route params as object.\n   * @property {string} current - Name of the current route.\n   *\n   * @description\n   * The `$route` service provides interfaces to access defined routes. It also let's\n   * you access route params through `$routeParams` service, so you have fully\n   * control over all the stuff you would actually get from angular's core `$route`\n   * service.\n   */\n  this.$get = $get;\n  $get.$inject = ['$state', '$rootScope', '$routeParams'];\n  function $get(   $state,   $rootScope,   $routeParams) {\n\n    var $route = {\n      routes: routes,\n      params: $routeParams,\n      current: undefined\n    };\n\n    function stateAsRoute(state) {\n      return (state.name !== '') ? state : undefined;\n    }\n\n    $rootScope.$on('$stateChangeStart', function (ev, to, toParams, from, fromParams) {\n      $rootScope.$broadcast('$routeChangeStart', stateAsRoute(to), stateAsRoute(from));\n    });\n\n    $rootScope.$on('$stateChangeSuccess', function (ev, to, toParams, from, fromParams) {\n      $route.current = stateAsRoute(to);\n      $rootScope.$broadcast('$routeChangeSuccess', stateAsRoute(to), stateAsRoute(from));\n      copy(toParams, $route.params);\n    });\n\n    $rootScope.$on('$stateChangeError', function (ev, to, toParams, from, fromParams, error) {\n      $rootScope.$broadcast('$routeChangeError', stateAsRoute(to), stateAsRoute(from), error);\n    });\n\n    return $route;\n  }\n}\n\nangular.module('ui.router.compat')\n  .provider('$route', $RouteProvider)\n  .directive('ngView', $ViewDirective);\n})(window, window.angular);"
  },
  {
    "path": "www/lib/angular-ui-router/src/common.js",
    "content": "/*jshint globalstrict:true*/\n/*global angular:false*/\n'use strict';\n\nvar isDefined = angular.isDefined,\n    isFunction = angular.isFunction,\n    isString = angular.isString,\n    isObject = angular.isObject,\n    isArray = angular.isArray,\n    forEach = angular.forEach,\n    extend = angular.extend,\n    copy = angular.copy;\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, { prototype: parent }))(), extra);\n}\n\nfunction merge(dst) {\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        if (!dst.hasOwnProperty(key)) dst[key] = value;\n      });\n    }\n  });\n  return dst;\n}\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nfunction ancestors(first, second) {\n  var path = [];\n\n  for (var n in first.path) {\n    if (first.path[n] !== second.path[n]) break;\n    path.push(first.path[n]);\n  }\n  return path;\n}\n\n/**\n * IE8-safe wrapper for `Object.keys()`.\n *\n * @param {Object} object A JavaScript object.\n * @return {Array} Returns the keys of the object as an array.\n */\nfunction keys(object) {\n  if (Object.keys) {\n    return Object.keys(object);\n  }\n  var result = [];\n\n  angular.forEach(object, function(val, key) {\n    result.push(key);\n  });\n  return result;\n}\n\n/**\n * IE8-safe wrapper for `Array.prototype.indexOf()`.\n *\n * @param {Array} array A JavaScript array.\n * @param {*} value A value to search the array for.\n * @return {Number} Returns the array index value of `value`, or `-1` if not present.\n */\nfunction arraySearch(array, value) {\n  if (Array.prototype.indexOf) {\n    return array.indexOf(value, Number(arguments[2]) || 0);\n  }\n  var len = array.length >>> 0, from = Number(arguments[2]) || 0;\n  from = (from < 0) ? Math.ceil(from) : Math.floor(from);\n\n  if (from < 0) from += len;\n\n  for (; from < len; from++) {\n    if (from in array && array[from] === value) return from;\n  }\n  return -1;\n}\n\n/**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} currentParams The value of the current state parameters ($stateParams).\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\nfunction inheritParams(currentParams, newParams, $current, $to) {\n  var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];\n\n  for (var i in parents) {\n    if (!parents[i].params || !parents[i].params.length) continue;\n    parentParams = parents[i].params;\n\n    for (var j in parentParams) {\n      if (arraySearch(inheritList, parentParams[j]) >= 0) continue;\n      inheritList.push(parentParams[j]);\n      inherited[parentParams[j]] = currentParams[parentParams[j]];\n    }\n  }\n  return extend({}, inherited, newParams);\n}\n\n/**\n * Normalizes a set of values to string or `null`, filtering them by a list of keys.\n *\n * @param {Array} keys The list of keys to normalize/return.\n * @param {Object} values An object hash of values to normalize.\n * @return {Object} Returns an object hash of normalized string values.\n */\nfunction normalize(keys, values) {\n  var normalized = {};\n\n  forEach(keys, function (name) {\n    var value = values[name];\n    normalized[name] = (value != null) ? String(value) : null;\n  });\n  return normalized;\n}\n\n/**\n * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.\n *\n * @param {Object} a The first object.\n * @param {Object} b The second object.\n * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,\n *                     it defaults to the list of keys in `a`.\n * @return {Boolean} Returns `true` if the keys match, otherwise `false`.\n */\nfunction equalForKeys(a, b, keys) {\n  if (!keys) {\n    keys = [];\n    for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility\n  }\n\n  for (var i=0; i<keys.length; i++) {\n    var k = keys[i];\n    if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized\n  }\n  return true;\n}\n\n/**\n * Returns the subset of an object, based on a list of keys.\n *\n * @param {Array} keys\n * @param {Object} values\n * @return {Boolean} Returns a subset of `values`.\n */\nfunction filterByKeys(keys, values) {\n  var filtered = {};\n\n  forEach(keys, function (name) {\n    filtered[name] = values[name];\n  });\n  return filtered;\n}\n/**\n * @ngdoc overview\n * @name ui.router.util\n *\n * @description\n * # ui.router.util sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n *\n */\nangular.module('ui.router.util', ['ng']);\n\n/**\n * @ngdoc overview\n * @name ui.router.router\n * \n * @requires ui.router.util\n *\n * @description\n * # ui.router.router sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n */\nangular.module('ui.router.router', ['ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router.state\n * \n * @requires ui.router.router\n * @requires ui.router.util\n *\n * @description\n * # ui.router.state sub-module\n *\n * This module is a dependency of the main ui.router module. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n * \n */\nangular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router\n *\n * @requires ui.router.state\n *\n * @description\n * # ui.router\n * \n * ## The main module for ui.router \n * There are several sub-modules included with the ui.router module, however only this module is needed\n * as a dependency within your angular app. The other modules are for organization purposes. \n *\n * The modules are:\n * * ui.router - the main \"umbrella\" module\n * * ui.router.router - \n * \n * *You'll need to include **only** this module as the dependency within your angular app.*\n * \n * <pre>\n * <!doctype html>\n * <html ng-app=\"myApp\">\n * <head>\n *   <script src=\"js/angular.js\"></script>\n *   <!-- Include the ui-router script -->\n *   <script src=\"js/angular-ui-router.min.js\"></script>\n *   <script>\n *     // ...and add 'ui.router' as a dependency\n *     var myApp = angular.module('myApp', ['ui.router']);\n *   </script>\n * </head>\n * <body>\n * </body>\n * </html>\n * </pre>\n */\nangular.module('ui.router', ['ui.router.state']);\n\nangular.module('ui.router.compat', ['ui.router']);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/compat.js",
    "content": "/*\n * @ngdoc object\n * @name ui.router.compat.$routeProvider\n *\n * @requires ui.router.state.$stateProvider\n * @requires ui.router.router.$urlRouterProvider\n *\n * @description\n * `$routeProvider` of the `ui.router.compat` module overwrites the existing\n * `routeProvider` from the core. This is done to provide compatibility between\n * the UI Router and the core router.\n *\n * It also provides a `when()` method to register routes that map to certain urls.\n * Behind the scenes it actually delegates either to \n * {@link ui.router.router.$urlRouterProvider $urlRouterProvider} or to the \n * {@link ui.router.state.$stateProvider $stateProvider} to postprocess the given \n * router definition object.\n */\n$RouteProvider.$inject = ['$stateProvider', '$urlRouterProvider'];\nfunction $RouteProvider(  $stateProvider,    $urlRouterProvider) {\n\n  var routes = [];\n\n  onEnterRoute.$inject = ['$$state'];\n  function onEnterRoute(   $$state) {\n    /*jshint validthis: true */\n    this.locals = $$state.locals.globals;\n    this.params = this.locals.$stateParams;\n  }\n\n  function onExitRoute() {\n    /*jshint validthis: true */\n    this.locals = null;\n    this.params = null;\n  }\n\n  this.when = when;\n  /*\n   * @ngdoc function\n   * @name ui.router.compat.$routeProvider#when\n   * @methodOf ui.router.compat.$routeProvider\n   *\n   * @description\n   * Registers a route with a given route definition object. The route definition\n   * object has the same interface the angular core route definition object has.\n   * \n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.compat']);\n   *\n   * app.config(function ($routeProvider) {\n   *   $routeProvider.when('home', {\n   *     controller: function () { ... },\n   *     templateUrl: 'path/to/template'\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string} url URL as string\n   * @param {object} route Route definition object\n   *\n   * @return {object} $routeProvider - $routeProvider instance\n   */\n  function when(url, route) {\n    /*jshint validthis: true */\n    if (route.redirectTo != null) {\n      // Redirect, configure directly on $urlRouterProvider\n      var redirect = route.redirectTo, handler;\n      if (isString(redirect)) {\n        handler = redirect; // leave $urlRouterProvider to handle\n      } else if (isFunction(redirect)) {\n        // Adapt to $urlRouterProvider API\n        handler = function (params, $location) {\n          return redirect(params, $location.path(), $location.search());\n        };\n      } else {\n        throw new Error(\"Invalid 'redirectTo' in when()\");\n      }\n      $urlRouterProvider.when(url, handler);\n    } else {\n      // Regular route, configure as state\n      $stateProvider.state(inherit(route, {\n        parent: null,\n        name: 'route:' + encodeURIComponent(url),\n        url: url,\n        onEnter: onEnterRoute,\n        onExit: onExitRoute\n      }));\n    }\n    routes.push(route);\n    return this;\n  }\n\n  /*\n   * @ngdoc object\n   * @name ui.router.compat.$route\n   *\n   * @requires ui.router.state.$state\n   * @requires $rootScope\n   * @requires $routeParams\n   *\n   * @property {object} routes - Array of registered routes.\n   * @property {object} params - Current route params as object.\n   * @property {string} current - Name of the current route.\n   *\n   * @description\n   * The `$route` service provides interfaces to access defined routes. It also let's\n   * you access route params through `$routeParams` service, so you have fully\n   * control over all the stuff you would actually get from angular's core `$route`\n   * service.\n   */\n  this.$get = $get;\n  $get.$inject = ['$state', '$rootScope', '$routeParams'];\n  function $get(   $state,   $rootScope,   $routeParams) {\n\n    var $route = {\n      routes: routes,\n      params: $routeParams,\n      current: undefined\n    };\n\n    function stateAsRoute(state) {\n      return (state.name !== '') ? state : undefined;\n    }\n\n    $rootScope.$on('$stateChangeStart', function (ev, to, toParams, from, fromParams) {\n      $rootScope.$broadcast('$routeChangeStart', stateAsRoute(to), stateAsRoute(from));\n    });\n\n    $rootScope.$on('$stateChangeSuccess', function (ev, to, toParams, from, fromParams) {\n      $route.current = stateAsRoute(to);\n      $rootScope.$broadcast('$routeChangeSuccess', stateAsRoute(to), stateAsRoute(from));\n      copy(toParams, $route.params);\n    });\n\n    $rootScope.$on('$stateChangeError', function (ev, to, toParams, from, fromParams, error) {\n      $rootScope.$broadcast('$routeChangeError', stateAsRoute(to), stateAsRoute(from), error);\n    });\n\n    return $route;\n  }\n}\n\nangular.module('ui.router.compat')\n  .provider('$route', $RouteProvider)\n  .directive('ngView', $ViewDirective);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/resolve.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.util.$resolve\n *\n * @requires $q\n * @requires $injector\n *\n * @description\n * Manages resolution of (acyclic) graphs of promises.\n */\n$Resolve.$inject = ['$q', '$injector'];\nfunction $Resolve(  $q,    $injector) {\n  \n  var VISIT_IN_PROGRESS = 1,\n      VISIT_DONE = 2,\n      NOTHING = {},\n      NO_DEPENDENCIES = [],\n      NO_LOCALS = NOTHING,\n      NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });\n  \n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#study\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Studies a set of invocables that are likely to be used multiple times.\n   * <pre>\n   * $resolve.study(invocables)(locals, parent, self)\n   * </pre>\n   * is equivalent to\n   * <pre>\n   * $resolve.resolve(invocables, locals, parent, self)\n   * </pre>\n   * but the former is more efficient (in fact `resolve` just calls `study` \n   * internally).\n   *\n   * @param {object} invocables Invocable objects\n   * @return {function} a function to pass in locals, parent and self\n   */\n  this.study = function (invocables) {\n    if (!isObject(invocables)) throw new Error(\"'invocables' must be an object\");\n    \n    // Perform a topological sort of invocables to build an ordered plan\n    var plan = [], cycle = [], visited = {};\n    function visit(value, key) {\n      if (visited[key] === VISIT_DONE) return;\n      \n      cycle.push(key);\n      if (visited[key] === VISIT_IN_PROGRESS) {\n        cycle.splice(0, cycle.indexOf(key));\n        throw new Error(\"Cyclic dependency: \" + cycle.join(\" -> \"));\n      }\n      visited[key] = VISIT_IN_PROGRESS;\n      \n      if (isString(value)) {\n        plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);\n      } else {\n        var params = $injector.annotate(value);\n        forEach(params, function (param) {\n          if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);\n        });\n        plan.push(key, value, params);\n      }\n      \n      cycle.pop();\n      visited[key] = VISIT_DONE;\n    }\n    forEach(invocables, visit);\n    invocables = cycle = visited = null; // plan is all that's required\n    \n    function isResolve(value) {\n      return isObject(value) && value.then && value.$$promises;\n    }\n    \n    return function (locals, parent, self) {\n      if (isResolve(locals) && self === undefined) {\n        self = parent; parent = locals; locals = null;\n      }\n      if (!locals) locals = NO_LOCALS;\n      else if (!isObject(locals)) {\n        throw new Error(\"'locals' must be an object\");\n      }       \n      if (!parent) parent = NO_PARENT;\n      else if (!isResolve(parent)) {\n        throw new Error(\"'parent' must be a promise returned by $resolve.resolve()\");\n      }\n      \n      // To complete the overall resolution, we have to wait for the parent\n      // promise and for the promise for each invokable in our plan.\n      var resolution = $q.defer(),\n          result = resolution.promise,\n          promises = result.$$promises = {},\n          values = extend({}, locals),\n          wait = 1 + plan.length/3,\n          merged = false;\n          \n      function done() {\n        // Merge parent values we haven't got yet and publish our own $$values\n        if (!--wait) {\n          if (!merged) merge(values, parent.$$values); \n          result.$$values = values;\n          result.$$promises = true; // keep for isResolve()\n          resolution.resolve(values);\n        }\n      }\n      \n      function fail(reason) {\n        result.$$failure = reason;\n        resolution.reject(reason);\n      }\n      \n      // Short-circuit if parent has already failed\n      if (isDefined(parent.$$failure)) {\n        fail(parent.$$failure);\n        return result;\n      }\n      \n      // Merge parent values if the parent has already resolved, or merge\n      // parent promises and wait if the parent resolve is still in progress.\n      if (parent.$$values) {\n        merged = merge(values, parent.$$values);\n        done();\n      } else {\n        extend(promises, parent.$$promises);\n        parent.then(done, fail);\n      }\n      \n      // Process each invocable in the plan, but ignore any where a local of the same name exists.\n      for (var i=0, ii=plan.length; i<ii; i+=3) {\n        if (locals.hasOwnProperty(plan[i])) done();\n        else invoke(plan[i], plan[i+1], plan[i+2]);\n      }\n      \n      function invoke(key, invocable, params) {\n        // Create a deferred for this invocation. Failures will propagate to the resolution as well.\n        var invocation = $q.defer(), waitParams = 0;\n        function onfailure(reason) {\n          invocation.reject(reason);\n          fail(reason);\n        }\n        // Wait for any parameter that we have a promise for (either from parent or from this\n        // resolve; in that case study() will have made sure it's ordered before us in the plan).\n        forEach(params, function (dep) {\n          if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {\n            waitParams++;\n            promises[dep].then(function (result) {\n              values[dep] = result;\n              if (!(--waitParams)) proceed();\n            }, onfailure);\n          }\n        });\n        if (!waitParams) proceed();\n        function proceed() {\n          if (isDefined(result.$$failure)) return;\n          try {\n            invocation.resolve($injector.invoke(invocable, self, values));\n            invocation.promise.then(function (result) {\n              values[key] = result;\n              done();\n            }, onfailure);\n          } catch (e) {\n            onfailure(e);\n          }\n        }\n        // Publish promise synchronously; invocations further down in the plan may depend on it.\n        promises[key] = invocation.promise;\n      }\n      \n      return result;\n    };\n  };\n  \n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#resolve\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Resolves a set of invocables. An invocable is a function to be invoked via \n   * `$injector.invoke()`, and can have an arbitrary number of dependencies. \n   * An invocable can either return a value directly,\n   * or a `$q` promise. If a promise is returned it will be resolved and the \n   * resulting value will be used instead. Dependencies of invocables are resolved \n   * (in this order of precedence)\n   *\n   * - from the specified `locals`\n   * - from another invocable that is part of this `$resolve` call\n   * - from an invocable that is inherited from a `parent` call to `$resolve` \n   *   (or recursively\n   * - from any ancestor `$resolve` of that parent).\n   *\n   * The return value of `$resolve` is a promise for an object that contains \n   * (in this order of precedence)\n   *\n   * - any `locals` (if specified)\n   * - the resolved return values of all injectables\n   * - any values inherited from a `parent` call to `$resolve` (if specified)\n   *\n   * The promise will resolve after the `parent` promise (if any) and all promises \n   * returned by injectables have been resolved. If any invocable \n   * (or `$injector.invoke`) throws an exception, or if a promise returned by an \n   * invocable is rejected, the `$resolve` promise is immediately rejected with the \n   * same error. A rejection of a `parent` promise (if specified) will likewise be \n   * propagated immediately. Once the `$resolve` promise has been rejected, no \n   * further invocables will be called.\n   * \n   * Cyclic dependencies between invocables are not permitted and will caues `$resolve`\n   * to throw an error. As a special case, an injectable can depend on a parameter \n   * with the same name as the injectable, which will be fulfilled from the `parent` \n   * injectable of the same name. This allows inherited values to be decorated. \n   * Note that in this case any other injectable in the same `$resolve` with the same\n   * dependency would see the decorated value, not the inherited value.\n   *\n   * Note that missing dependencies -- unlike cyclic dependencies -- will cause an \n   * (asynchronous) rejection of the `$resolve` promise rather than a (synchronous) \n   * exception.\n   *\n   * Invocables are invoked eagerly as soon as all dependencies are available. \n   * This is true even for dependencies inherited from a `parent` call to `$resolve`.\n   *\n   * As a special case, an invocable can be a string, in which case it is taken to \n   * be a service name to be passed to `$injector.get()`. This is supported primarily \n   * for backwards-compatibility with the `resolve` property of `$routeProvider` \n   * routes.\n   *\n   * @param {object} invocables functions to invoke or \n   * `$injector` services to fetch.\n   * @param {object} locals  values to make available to the injectables\n   * @param {object} parent  a promise returned by another call to `$resolve`.\n   * @param {object} self  the `this` for the invoked methods\n   * @return {object} Promise for an object that contains the resolved return value\n   * of all invocables, as well as any inherited and local values.\n   */\n  this.resolve = function (invocables, locals, parent, self) {\n    return this.study(invocables)(locals, parent, self);\n  };\n}\n\nangular.module('ui.router.util').service('$resolve', $Resolve);\n\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/state.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.state.$stateProvider\n *\n * @requires ui.router.router.$urlRouterProvider\n * @requires ui.router.util.$urlMatcherFactoryProvider\n * @requires $locationProvider\n *\n * @description\n * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\n$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider', '$locationProvider'];\nfunction $StateProvider(   $urlRouterProvider,   $urlMatcherFactory,           $locationProvider) {\n\n  var root, states = {}, $state, queue = {}, abstractKey = 'abstract';\n\n  // Builds state properties from definition passed to registerState()\n  var stateBuilder = {\n\n    // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.\n    // state.children = [];\n    // if (parent) parent.children.push(state);\n    parent: function(state) {\n      if (isDefined(state.parent) && state.parent) return findState(state.parent);\n      // regex matches any valid composite state name\n      // would match \"contact.list\" but not \"contacts\"\n      var compositeName = /^(.+)\\.[^.]+$/.exec(state.name);\n      return compositeName ? findState(compositeName[1]) : root;\n    },\n\n    // inherit 'data' from parent and override by own values (if any)\n    data: function(state) {\n      if (state.parent && state.parent.data) {\n        state.data = state.self.data = extend({}, state.parent.data, state.data);\n      }\n      return state.data;\n    },\n\n    // Build a URLMatcher if necessary, either via a relative or absolute URL\n    url: function(state) {\n      var url = state.url;\n\n      if (isString(url)) {\n        if (url.charAt(0) == '^') {\n          return $urlMatcherFactory.compile(url.substring(1));\n        }\n        return (state.parent.navigable || root).url.concat(url);\n      }\n\n      if ($urlMatcherFactory.isMatcher(url) || url == null) {\n        return url;\n      }\n      throw new Error(\"Invalid url '\" + url + \"' in state '\" + state + \"'\");\n    },\n\n    // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n    navigable: function(state) {\n      return state.url ? state : (state.parent ? state.parent.navigable : null);\n    },\n\n    // Derive parameters for this state and ensure they're a super-set of parent's parameters\n    params: function(state) {\n      if (!state.params) {\n        return state.url ? state.url.parameters() : state.parent.params;\n      }\n      if (!isArray(state.params)) throw new Error(\"Invalid params in state '\" + state + \"'\");\n      if (state.url) throw new Error(\"Both params and url specicified in state '\" + state + \"'\");\n      return state.params;\n    },\n\n    // If there is no explicit multi-view configuration, make one up so we don't have\n    // to handle both cases in the view directive later. Note that having an explicit\n    // 'views' property will mean the default unnamed view properties are ignored. This\n    // is also a good time to resolve view names to absolute names, so everything is a\n    // straight lookup at link time.\n    views: function(state) {\n      var views = {};\n\n      forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {\n        if (name.indexOf('@') < 0) name += '@' + state.parent.name;\n        views[name] = view;\n      });\n      return views;\n    },\n\n    ownParams: function(state) {\n      if (!state.parent) {\n        return state.params;\n      }\n      var paramNames = {}; forEach(state.params, function (p) { paramNames[p] = true; });\n\n      forEach(state.parent.params, function (p) {\n        if (!paramNames[p]) {\n          throw new Error(\"Missing required parameter '\" + p + \"' in state '\" + state.name + \"'\");\n        }\n        paramNames[p] = false;\n      });\n      var ownParams = [];\n\n      forEach(paramNames, function (own, p) {\n        if (own) ownParams.push(p);\n      });\n      return ownParams;\n    },\n\n    // Keep a full path from the root down to this state as this is needed for state activation.\n    path: function(state) {\n      return state.parent ? state.parent.path.concat(state) : []; // exclude root from path\n    },\n\n    // Speed up $state.contains() as it's used a lot\n    includes: function(state) {\n      var includes = state.parent ? extend({}, state.parent.includes) : {};\n      includes[state.name] = true;\n      return includes;\n    },\n\n    $delegates: {}\n  };\n\n  function isRelative(stateName) {\n    return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n  }\n\n  function findState(stateOrName, base) {\n    var isStr = isString(stateOrName),\n        name  = isStr ? stateOrName : stateOrName.name,\n        path  = isRelative(name);\n\n    if (path) {\n      if (!base) throw new Error(\"No reference point given for path '\"  + name + \"'\");\n      var rel = name.split(\".\"), i = 0, pathLength = rel.length, current = base;\n\n      for (; i < pathLength; i++) {\n        if (rel[i] === \"\" && i === 0) {\n          current = base;\n          continue;\n        }\n        if (rel[i] === \"^\") {\n          if (!current.parent) throw new Error(\"Path '\" + name + \"' not valid for state '\" + base.name + \"'\");\n          current = current.parent;\n          continue;\n        }\n        break;\n      }\n      rel = rel.slice(i).join(\".\");\n      name = current.name + (current.name && rel ? \".\" : \"\") + rel;\n    }\n    var state = states[name];\n\n    if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n      return state;\n    }\n    return undefined;\n  }\n\n  function queueState(parentName, state) {\n    if (!queue[parentName]) {\n      queue[parentName] = [];\n    }\n    queue[parentName].push(state);\n  }\n\n  function registerState(state) {\n    // Wrap a new object around the state so we can store our private details easily.\n    state = inherit(state, {\n      self: state,\n      resolve: state.resolve || {},\n      toString: function() { return this.name; }\n    });\n\n    var name = state.name;\n    if (!isString(name) || name.indexOf('@') >= 0) throw new Error(\"State must have a valid name\");\n    if (states.hasOwnProperty(name)) throw new Error(\"State '\" + name + \"'' is already defined\");\n\n    // Get parent name\n    var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))\n        : (isString(state.parent)) ? state.parent\n        : '';\n\n    // If parent is not registered yet, add state to queue and register later\n    if (parentName && !states[parentName]) {\n      return queueState(parentName, state.self);\n    }\n\n    for (var key in stateBuilder) {\n      if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);\n    }\n    states[name] = state;\n\n    // Register the state in the global state list and with $urlRouter if necessary.\n    if (!state[abstractKey] && state.url) {\n      $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {\n        if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {\n          $state.transitionTo(state, $match, { location: false });\n        }\n      }]);\n    }\n\n    // Register any queued children\n    if (queue[name]) {\n      for (var i = 0; i < queue[name].length; i++) {\n        registerState(queue[name][i]);\n      }\n    }\n\n    return state;\n  }\n\n  // Checks text to see if it looks like a glob.\n  function isGlob (text) {\n    return text.indexOf('*') > -1;\n  }\n\n  // Returns true if glob matches current $state name.\n  function doesStateMatchGlob (glob) {\n    var globSegments = glob.split('.'),\n        segments = $state.$current.name.split('.');\n\n    //match greedy starts\n    if (globSegments[0] === '**') {\n       segments = segments.slice(segments.indexOf(globSegments[1]));\n       segments.unshift('**');\n    }\n    //match greedy ends\n    if (globSegments[globSegments.length - 1] === '**') {\n       segments.splice(segments.indexOf(globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);\n       segments.push('**');\n    }\n\n    if (globSegments.length != segments.length) {\n      return false;\n    }\n\n    //match single stars\n    for (var i = 0, l = globSegments.length; i < l; i++) {\n      if (globSegments[i] === '*') {\n        segments[i] = '*';\n      }\n    }\n\n    return segments.join('') === globSegments.join('');\n  }\n\n\n  // Implicit root state that is always active\n  root = registerState({\n    name: '',\n    url: '^',\n    views: null,\n    'abstract': true\n  });\n  root.navigable = null;\n\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#decorator\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Allows you to extend (carefully) or override (at your own peril) the \n   * `stateBuilder` object used internally by `$stateProvider`. This can be used \n   * to add custom functionality to ui-router, for example inferring templateUrl \n   * based on the state name.\n   *\n   * When passing only a name, it returns the current (original or decorated) builder\n   * function that matches `name`.\n   *\n   * The builder functions that can be decorated are listed below. Though not all\n   * necessarily have a good use case for decoration, that is up to you to decide.\n   *\n   * In addition, users can attach custom decorators, which will generate new \n   * properties within the state's internal definition. There is currently no clear \n   * use-case for this beyond accessing internal states (i.e. $state.$current), \n   * however, expect this to become increasingly relevant as we introduce additional \n   * meta-programming features.\n   *\n   * **Warning**: Decorators should not be interdependent because the order of \n   * execution of the builder functions in non-deterministic. Builder functions \n   * should only be dependent on the state definition object and super function.\n   *\n   *\n   * Existing builder functions and current return values:\n   *\n   * - **parent** `{object}` - returns the parent state object.\n   * - **data** `{object}` - returns state data, including any inherited data that is not\n   *   overridden by own values (if any).\n   * - **url** `{object}` - returns a {link ui.router.util.type:UrlMatcher} or null.\n   * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is \n   *   navigable).\n   * - **params** `{object}` - returns an array of state params that are ensured to \n   *   be a super-set of parent's params.\n   * - **views** `{object}` - returns a views object where each key is an absolute view \n   *   name (i.e. \"viewName@stateName\") and each value is the config object \n   *   (template, controller) for the view. Even when you don't use the views object \n   *   explicitly on a state config, one is still created for you internally.\n   *   So by decorating this builder function you have access to decorating template \n   *   and controller properties.\n   * - **ownParams** `{object}` - returns an array of params that belong to the state, \n   *   not including any params defined by ancestor states.\n   * - **path** `{string}` - returns the full path from the root down to this state. \n   *   Needed for state activation.\n   * - **includes** `{object}` - returns an object that includes every state that \n   *   would pass a '$state.includes()' test.\n   *\n   * @example\n   * <pre>\n   * // Override the internal 'views' builder with a function that takes the state\n   * // definition, and a reference to the internal function being overridden:\n   * $stateProvider.decorator('views', function ($state, parent) {\n   *   var result = {},\n   *       views = parent(state);\n   *\n   *   angular.forEach(view, function (config, name) {\n   *     var autoName = (state.name + '.' + name).replace('.', '/');\n   *     config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n   *     result[name] = config;\n   *   });\n   *   return result;\n   * });\n   *\n   * $stateProvider.state('home', {\n   *   views: {\n   *     'contact.list': { controller: 'ListController' },\n   *     'contact.item': { controller: 'ItemController' }\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * $state.go('home');\n   * // Auto-populates list and item views with /partials/home/contact/list.html,\n   * // and /partials/home/contact/item.html, respectively.\n   * </pre>\n   *\n   * @param {string} name The name of the builder function to decorate. \n   * @param {object} func A function that is responsible for decorating the original \n   * builder function. The function receives two parameters:\n   *\n   *   - `{object}` - state - The state config object.\n   *   - `{object}` - super - The original builder function.\n   *\n   * @return {object} $stateProvider - $stateProvider instance\n   */\n  this.decorator = decorator;\n  function decorator(name, func) {\n    /*jshint validthis: true */\n    if (isString(name) && !isDefined(func)) {\n      return stateBuilder[name];\n    }\n    if (!isFunction(func) || !isString(name)) {\n      return this;\n    }\n    if (stateBuilder[name] && !stateBuilder.$delegates[name]) {\n      stateBuilder.$delegates[name] = stateBuilder[name];\n    }\n    stateBuilder[name] = func;\n    return this;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#state\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Registers a state configuration under a given state name. The stateConfig object\n   * has the following acceptable properties.\n   *\n   * <a id='template'></a>\n   *\n   * - **`template`** - {string|function=} - html template as a string or a function that returns\n   *   an html template as a string which should be used by the uiView directives. This property \n   *   takes precedence over templateUrl.\n   *   \n   *   If `template` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <a id='templateUrl'></a>\n   *\n   * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html \n   *   template that should be used by uiView.\n   *   \n   *   If `templateUrl` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by \n   *     applying the current state\n   *\n   * <a id='templateProvider'></a>\n   *\n   * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n   *   string.\n   *\n   * <a id='controller'></a>\n   *\n   * - **`controller`** - {string|function=} -  Controller fn that should be associated with newly \n   *   related scope or the name of a registered controller if passed as a string.\n   *\n   * <a id='controllerProvider'></a>\n   *\n   * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n   *   the actual controller or string.\n   *\n   * <a id='controllerAs'></a>\n   * \n   * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be \n   *   published to scope under the controllerAs name.\n   *\n   * <a id='resolve'></a>\n   *\n   * - **`resolve`** - {object.&lt;string, function&gt;=} - An optional map of dependencies which \n   *   should be injected into the controller. If any of these dependencies are promises, \n   *   the router will wait for them all to be resolved or one to be rejected before the \n   *   controller is instantiated. If all the promises are resolved successfully, the values \n   *   of the resolved promises are injected and $stateChangeSuccess event is fired. If any \n   *   of the promises are rejected the $stateChangeError event is fired. The map object is:\n   *   \n   *   - key - {string}: name of dependency to be injected into controller\n   *   - factory - {string|function}: If string then it is alias for service. Otherwise if function, \n   *     it is injected and return value it treated as dependency. If result is a promise, it is \n   *     resolved before its value is injected into controller.\n   *\n   * <a id='url'></a>\n   *\n   * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n   *   transitioned to, the `$stateParams` service will be populated with any \n   *   parameters that were passed.\n   *\n   * <a id='params'></a>\n   *\n   * - **`params`** - {object=} - An array of parameter names or regular expressions. Only \n   *   use this within a state if you are not using url. Otherwise you can specify your\n   *   parameters within the url. When a state is navigated or transitioned to, the \n   *   $stateParams service will be populated with any parameters that were passed.\n   *\n   * <a id='views'></a>\n   *\n   * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n   *   manually/explicitly.\n   *\n   * <a id='abstract'></a>\n   *\n   * - **`abstract`** - {boolean=} - An abstract state will never be directly activated, \n   *   but can provide inherited properties to its common children states.\n   *\n   * <a id='onEnter'></a>\n   *\n   * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n   *   to trigger an action or dispatch an event, such as opening a dialog.\n   *\n   * <a id='onExit'></a>\n   *\n   * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n   *   trigger an action or dispatch an event, such as opening a dialog.\n   *\n   * <a id='reloadOnSearch'></a>\n   *\n   * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state \n   *   just because a search/query parameter has changed (via $location.search() or $location.hash()). \n   *   Useful for when you'd like to modify $location.search() without triggering a reload.\n   *\n   * <a id='data'></a>\n   *\n   * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n   *\n   * @example\n   * <pre>\n   * // Some state name examples\n   *\n   * // stateName can be a single top-level name (must be unique).\n   * $stateProvider.state(\"home\", {});\n   *\n   * // Or it can be a nested state name. This state is a child of the \n   * // above \"home\" state.\n   * $stateProvider.state(\"home.newest\", {});\n   *\n   * // Nest states as deeply as needed.\n   * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n   *\n   * // state() returns $stateProvider, so you can chain state declarations.\n   * $stateProvider\n   *   .state(\"home\", {})\n   *   .state(\"about\", {})\n   *   .state(\"contacts\", {});\n   * </pre>\n   *\n   * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\". \n   * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n   * @param {object} definition State configuration object.\n   */\n  this.state = state;\n  function state(name, definition) {\n    /*jshint validthis: true */\n    if (isObject(name)) definition = name;\n    else definition.name = name;\n    registerState(definition);\n    return this;\n  }\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$state\n   *\n   * @requires $rootScope\n   * @requires $q\n   * @requires ui.router.state.$view\n   * @requires $injector\n   * @requires ui.router.util.$resolve\n   * @requires ui.router.state.$stateParams\n   *\n   * @property {object} params A param object, e.g. {sectionId: section.id)}, that \n   * you'd like to test against the current active state.\n   * @property {object} current A reference to the state's config object. However \n   * you passed it in. Useful for accessing custom data.\n   * @property {object} transition Currently pending transition. A promise that'll \n   * resolve or reject.\n   *\n   * @description\n   * `$state` service is responsible for representing states as well as transitioning\n   * between them. It also provides interfaces to ask for current state or even states\n   * you're coming from.\n   */\n  // $urlRouter is injected just to ensure it gets instantiated\n  this.$get = $get;\n  $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$location', '$urlRouter', '$browser'];\n  function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $location,   $urlRouter,   $browser) {\n\n    var TransitionSuperseded = $q.reject(new Error('transition superseded'));\n    var TransitionPrevented = $q.reject(new Error('transition prevented'));\n    var TransitionAborted = $q.reject(new Error('transition aborted'));\n    var TransitionFailed = $q.reject(new Error('transition failed'));\n    var currentLocation = $location.url();\n    var baseHref = $browser.baseHref();\n\n    function syncUrl() {\n      if ($location.url() !== currentLocation) {\n        $location.url(currentLocation);\n        $location.replace();\n      }\n    }\n\n    root.locals = { resolve: null, globals: { $stateParams: {} } };\n    $state = {\n      params: {},\n      current: root.self,\n      $current: root,\n      transition: null\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#reload\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method that force reloads the current state. All resolves are re-resolved, events are not re-fired, \n     * and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon).\n     *\n     * @example\n     * <pre>\n     * var app angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.reload = function(){\n     *     $state.reload();\n     *   }\n     * });\n     * </pre>\n     *\n     * `reload()` is just an alias for:\n     * <pre>\n     * $state.transitionTo($state.current, $stateParams, { \n     *   reload: true, inherit: false, notify: false \n     * });\n     * </pre>\n     */\n    $state.reload = function reload() {\n      $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: false });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#go\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Convenience method for transitioning to a new state. `$state.go` calls \n     * `$state.transitionTo` internally but automatically sets options to \n     * `{ location: true, inherit: true, relative: $state.$current, notify: true }`. \n     * This allows you to easily use an absolute or relative to path and specify \n     * only the parameters you'd like to update (while letting unspecified parameters \n     * inherit from the currently active ancestor states).\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.go('contact.detail');\n     *   };\n     * });\n     * </pre>\n     * <img src='../ngdoc_assets/StateGoExamples.png'/>\n     *\n     * @param {string} to Absolute state name or relative state path. Some examples:\n     *\n     * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n     * - `$state.go('^')` - will go to a parent state\n     * - `$state.go('^.sibling')` - will go to a sibling state\n     * - `$state.go('.child.grandchild')` - will go to grandchild state\n     *\n     * @param {object=} params A map of the parameters that will be sent to the state, \n     * will populate $stateParams. Any parameters that are not specified will be inherited from currently \n     * defined parameters. This allows, for example, going to a sibling state that shares parameters\n     * specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.\n     * transitioning to a sibling will get you the parameters for all parents, transitioning to a child\n     * will get you all current parameters, etc.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition.\n     *\n     * Possible success values:\n     *\n     * - $state.current\n     *\n     * <br/>Possible rejection values:\n     *\n     * - 'transition superseded' - when a newer transition has been started after this one\n     * - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener\n     * - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or\n     *   when a `$stateNotFound` `event.retry` promise errors.\n     * - 'transition failed' - when a state has been unsuccessfully found after 2 tries.\n     * - *resolve error* - when an error has occurred with a `resolve`\n     *\n     */\n    $state.go = function go(to, params, options) {\n      return this.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#transitionTo\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}\n     * uses `transitionTo` internally. `$state.go` is recommended in most situations.\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.transitionTo('contact.detail');\n     *   };\n     * });\n     * </pre>\n     *\n     * @param {string} to State name.\n     * @param {object=} toParams A map of the parameters that will be sent to the state,\n     * will populate $stateParams.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.transitionTo = function transitionTo(to, toParams, options) {\n      toParams = toParams || {};\n      options = extend({\n        location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false\n      }, options || {});\n\n      var from = $state.$current, fromParams = $state.params, fromPath = from.path;\n      var evt, toState = findState(to, options.relative);\n\n      if (!isDefined(toState)) {\n        // Broadcast not found event and abort the transition if prevented\n        var redirect = { to: to, toParams: toParams, options: options };\n\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateNotFound\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when a requested state **cannot be found** using the provided state name during transition.\n         * The event is broadcast allowing any handlers a single chance to deal with the error (usually by\n         * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,\n         * you can see its three properties in the example. You can use `event.preventDefault()` to abort the\n         * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.\n         * @param {State} fromState Current state object.\n         * @param {Object} fromParams Current state params.\n         *\n         * @example\n         *\n         * <pre>\n         * // somewhere, assume lazy.state has not been defined\n         * $state.go(\"lazy.state\", {a:1, b:2}, {inherit:false});\n         *\n         * // somewhere else\n         * $scope.$on('$stateNotFound',\n         * function(event, unfoundState, fromState, fromParams){\n         *     console.log(unfoundState.to); // \"lazy.state\"\n         *     console.log(unfoundState.toParams); // {a:1, b:2}\n         *     console.log(unfoundState.options); // {inherit:false} + default options\n         * })\n         * </pre>\n         */\n        evt = $rootScope.$broadcast('$stateNotFound', redirect, from.self, fromParams);\n        if (evt.defaultPrevented) {\n          syncUrl();\n          return TransitionAborted;\n        }\n\n        // Allow the handler to return a promise to defer state lookup retry\n        if (evt.retry) {\n          if (options.$retry) {\n            syncUrl();\n            return TransitionFailed;\n          }\n          var retryTransition = $state.transition = $q.when(evt.retry);\n          retryTransition.then(function() {\n            if (retryTransition !== $state.transition) return TransitionSuperseded;\n            redirect.options.$retry = true;\n            return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);\n          }, function() {\n            return TransitionAborted;\n          });\n          syncUrl();\n          return retryTransition;\n        }\n\n        // Always retry once if the $stateNotFound was not prevented\n        // (handles either redirect changed or state lazy-definition)\n        to = redirect.to;\n        toParams = redirect.toParams;\n        options = redirect.options;\n        toState = findState(to, options.relative);\n        if (!isDefined(toState)) {\n          if (options.relative) throw new Error(\"Could not resolve '\" + to + \"' from state '\" + options.relative + \"'\");\n          throw new Error(\"No such state '\" + to + \"'\");\n        }\n      }\n      if (toState[abstractKey]) throw new Error(\"Cannot transition to abstract state '\" + to + \"'\");\n      if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);\n      to = toState;\n\n      var toPath = to.path;\n\n      // Starting from the root of the path, keep all levels that haven't changed\n      var keep, state, locals = root.locals, toLocals = [];\n      for (keep = 0, state = toPath[keep];\n           state && state === fromPath[keep] && equalForKeys(toParams, fromParams, state.ownParams) && !options.reload;\n           keep++, state = toPath[keep]) {\n        locals = toLocals[keep] = state.locals;\n      }\n\n      // If we're going to the same state and all locals are kept, we've got nothing to do.\n      // But clear 'transition', as we still want to cancel any other pending transitions.\n      // TODO: We may not want to bump 'transition' if we're called from a location change that we've initiated ourselves,\n      // because we might accidentally abort a legitimate transition initiated from code?\n      if (shouldTriggerReload(to, from, locals, options) ) {\n        if ( to.self.reloadOnSearch !== false )\n          syncUrl();\n        $state.transition = null;\n        return $q.when($state.current);\n      }\n\n      // Normalize/filter parameters before we pass them to event handlers etc.\n      toParams = normalize(to.params, toParams || {});\n\n      // Broadcast start event and cancel the transition if requested\n      if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeStart\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when the state transition **begins**. You can use `event.preventDefault()`\n         * to prevent the transition from happening and then the transition promise will be\n         * rejected with a `'transition prevented'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         *\n         * @example\n         *\n         * <pre>\n         * $rootScope.$on('$stateChangeStart',\n         * function(event, toState, toParams, fromState, fromParams){\n         *     event.preventDefault();\n         *     // transitionTo() promise will be rejected with\n         *     // a 'transition prevented' error\n         * })\n         * </pre>\n         */\n        evt = $rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams);\n        if (evt.defaultPrevented) {\n          syncUrl();\n          return TransitionPrevented;\n        }\n      }\n\n      // Resolve locals for the remaining states, but don't update any global state just\n      // yet -- if anything fails to resolve the current state needs to remain untouched.\n      // We also set up an inheritance chain for the locals here. This allows the view directive\n      // to quickly look up the correct definition for each view in the current state. Even\n      // though we create the locals object itself outside resolveState(), it is initially\n      // empty and gets filled asynchronously. We need to keep track of the promise for the\n      // (fully resolved) current locals, and pass this down the chain.\n      var resolved = $q.when(locals);\n      for (var l=keep; l<toPath.length; l++, state=toPath[l]) {\n        locals = toLocals[l] = inherit(locals);\n        resolved = resolveState(state, toParams, state===to, resolved, locals);\n      }\n\n      // Once everything is resolved, we are ready to perform the actual transition\n      // and return a promise for the new state. We also keep track of what the\n      // current promise is, so that we can detect overlapping transitions and\n      // keep only the outcome of the last transition.\n      var transition = $state.transition = resolved.then(function () {\n        var l, entering, exiting;\n\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Exit 'from' states not kept\n        for (l=fromPath.length-1; l>=keep; l--) {\n          exiting = fromPath[l];\n          if (exiting.self.onExit) {\n            $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);\n          }\n          exiting.locals = null;\n        }\n\n        // Enter 'to' states not kept\n        for (l=keep; l<toPath.length; l++) {\n          entering = toPath[l];\n          entering.locals = toLocals[l];\n          if (entering.self.onEnter) {\n            $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);\n          }\n        }\n\n        // Run it again, to catch any transitions in callbacks\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Update globals in $state\n        $state.$current = to;\n        $state.current = to.self;\n        $state.params = toParams;\n        copy($state.params, $stateParams);\n        $state.transition = null;\n\n        // Update $location\n        var toNav = to.navigable;\n        if (options.location && toNav) {\n          $location.url(toNav.url.format(toNav.locals.globals.$stateParams));\n\n          if (options.location === 'replace') {\n            $location.replace();\n          }\n        }\n\n        if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeSuccess\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired once the state transition is **complete**.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         */\n          $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);\n        }\n        currentLocation = $location.url();\n\n        return $state.current;\n      }, function (error) {\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        $state.transition = null;\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeError\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when an **error occurs** during transition. It's important to note that if you\n         * have any errors in your resolve functions (javascript errors, non-existent services, etc)\n         * they will not throw traditionally. You must listen for this $stateChangeError event to\n         * catch **ALL** errors.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         * @param {Error} error The resolve error object.\n         */\n        $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);\n        syncUrl();\n\n        return $q.reject(error);\n      });\n\n      return transition;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#is\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Similar to {@link ui.router.state.$state#methods_includes $state.includes},\n     * but only checks for the full state name. If params is supplied then it will be \n     * tested for strict equality against the current active params object, so all params \n     * must match with none missing and no extras.\n     *\n     * @example\n     * <pre>\n     * $state.is('contact.details.item'); // returns true\n     * $state.is(contactDetailItemStateObject); // returns true\n     *\n     * // everything else would return false\n     * </pre>\n     *\n     * @param {string|object} stateName The state name or state object you'd like to check.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like \n     * to test against the current active state.\n     * @returns {boolean} Returns true if it is the state.\n     */\n    $state.is = function is(stateOrName, params) {\n      var state = findState(stateOrName);\n\n      if (!isDefined(state)) {\n        return undefined;\n      }\n\n      if ($state.$current !== state) {\n        return false;\n      }\n\n      return isDefined(params) && params !== null ? angular.equals($stateParams, params) : true;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#includes\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method to determine if the current active state is equal to or is the child of the \n     * state stateName. If any params are passed then they will be tested for a match as well.\n     * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * $state.includes(\"contacts\"); // returns true\n     * $state.includes(\"contacts.details\"); // returns true\n     * $state.includes(\"contacts.details.item\"); // returns true\n     * $state.includes(\"contacts.list\"); // returns false\n     * $state.includes(\"about\"); // returns false\n     * </pre>\n     *\n     * @description\n     * Basic globing patterns will also work.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item.url';\n     *\n     * $state.includes(\"*.details.*.*\"); // returns true\n     * $state.includes(\"*.details.**\"); // returns true\n     * $state.includes(\"**.item.**\"); // returns true\n     * $state.includes(\"*.details.item.url\"); // returns true\n     * $state.includes(\"*.details.*.url\"); // returns true\n     * $state.includes(\"*.details.*\"); // returns false\n     * $state.includes(\"item.**\"); // returns false\n     * </pre>\n     *\n     * @param {string} stateOrName A partial name to be searched for within the current state name.\n     * @param {object} params A param object, e.g. `{sectionId: section.id}`, \n     * that you'd like to test against the current active state.\n     * @returns {boolean} Returns true if it does include the state\n     */\n\n    $state.includes = function includes(stateOrName, params) {\n      if (isString(stateOrName) && isGlob(stateOrName)) {\n        if (doesStateMatchGlob(stateOrName)) {\n          stateOrName = $state.$current.name;\n        } else {\n          return false;\n        }\n      }\n\n      var state = findState(stateOrName);\n      if (!isDefined(state)) {\n        return undefined;\n      }\n\n      if (!isDefined($state.$current.includes[state.name])) {\n        return false;\n      }\n\n      var validParams = true;\n      angular.forEach(params, function(value, key) {\n        if (!isDefined($stateParams[key]) || $stateParams[key] !== value) {\n          validParams = false;\n        }\n      });\n      return validParams;\n    };\n\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#href\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A url generation method that returns the compiled url for the given state populated with the given params.\n     *\n     * @example\n     * <pre>\n     * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name or state object you'd like to generate a url from.\n     * @param {object=} params An object of parameter values to fill the state's required parameters.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`lossy`** - {boolean=true} -  If true, and if there is no url associated with the state provided in the\n     *    first parameter, then the constructed href url will be built from the first navigable ancestor (aka\n     *    ancestor with a valid url).\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n     * \n     * @returns {string} compiled state url\n     */\n    $state.href = function href(stateOrName, params, options) {\n      options = extend({ lossy: true, inherit: false, absolute: false, relative: $state.$current }, options || {});\n      var state = findState(stateOrName, options.relative);\n      if (!isDefined(state)) return null;\n\n      params = inheritParams($stateParams, params || {}, $state.$current, state);\n      var nav = (state && options.lossy) ? state.navigable : state;\n      var url = (nav && nav.url) ? nav.url.format(normalize(state.params, params || {})) : null;\n      if (!$locationProvider.html5Mode() && url) {\n        url = \"#\" + $locationProvider.hashPrefix() + url;\n      }\n\n      if (baseHref !== '/') {\n        if ($locationProvider.html5Mode()) {\n          url = baseHref.slice(0, -1) + url;\n        } else if (options.absolute){\n          url = baseHref.slice(1) + url;\n        }\n      }\n\n      if (options.absolute && url) {\n        url = $location.protocol() + '://' + \n              $location.host() + \n              ($location.port() == 80 || $location.port() == 443 ? '' : ':' + $location.port()) + \n              (!$locationProvider.html5Mode() && url ? '/' : '') + \n              url;\n      }\n      return url;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#get\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Returns the state configuration object for any specific state or all states.\n     *\n     * @param {string|object=} stateOrName If provided, will only get the config for\n     * the requested state. If not provided, returns an array of ALL state configs.\n     * @returns {object|array} State configuration object or array of all objects.\n     */\n    $state.get = function (stateOrName, context) {\n      if (!isDefined(stateOrName)) {\n        var list = [];\n        forEach(states, function(state) { list.push(state.self); });\n        return list;\n      }\n      var state = findState(stateOrName, context);\n      return (state && state.self) ? state.self : null;\n    };\n\n    function resolveState(state, params, paramsAreFiltered, inherited, dst) {\n      // Make a restricted $stateParams with only the parameters that apply to this state if\n      // necessary. In addition to being available to the controller and onEnter/onExit callbacks,\n      // we also need $stateParams to be available for any $injector calls we make during the\n      // dependency resolution process.\n      var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params, params);\n      var locals = { $stateParams: $stateParams };\n\n      // Resolve 'global' dependencies for the state, i.e. those not specific to a view.\n      // We're also including $stateParams in this; that way the parameters are restricted\n      // to the set that should be visible to the state, and are independent of when we update\n      // the global $state and $stateParams values.\n      dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);\n      var promises = [ dst.resolve.then(function (globals) {\n        dst.globals = globals;\n      }) ];\n      if (inherited) promises.push(inherited);\n\n      // Resolve template and dependencies for all views.\n      forEach(state.views, function (view, name) {\n        var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});\n        injectables.$template = [ function () {\n          return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: false }) || '';\n        }];\n\n        promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) {\n          // References to the controller (only instantiated at link time)\n          if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {\n            var injectLocals = angular.extend({}, injectables, locals);\n            result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);\n          } else {\n            result.$$controller = view.controller;\n          }\n          // Provide access to the state itself for internal use\n          result.$$state = state;\n          result.$$controllerAs = view.controllerAs;\n          dst[name] = result;\n        }));\n      });\n\n      // Wait for all the promises and then return the activation object\n      return $q.all(promises).then(function (values) {\n        return dst;\n      });\n    }\n\n    return $state;\n  }\n\n  function shouldTriggerReload(to, from, locals, options) {\n    if ( to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false)) ) {\n      return true;\n    }\n  }\n}\n\nangular.module('ui.router.state')\n  .value('$stateParams', {})\n  .provider('$state', $StateProvider);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/stateDirectives.js",
    "content": "function parseStateRef(ref) {\n  var parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n  if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n  return { state: parsed[1], paramExpr: parsed[3] || null };\n}\n\nfunction stateContext(el) {\n  var stateData = el.parent().inheritedData('$uiView');\n\n  if (stateData && stateData.state && stateData.state.name) {\n    return stateData.state;\n  }\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref\n *\n * @requires ui.router.state.$state\n * @requires $timeout\n *\n * @restrict A\n *\n * @description\n * A directive that binds a link (`<a>` tag) to a state. If the state has an associated \n * URL, the directive will automatically generate & update the `href` attribute via \n * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking \n * the link will trigger a state transition with optional parameters. \n *\n * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be \n * handled natively by the browser.\n *\n * You can also use relative state paths within ui-sref, just like the relative \n * paths passed to `$state.go()`. You just need to be aware that the path is relative\n * to the state that the link lives in, in other words the state that loaded the \n * template containing the link.\n *\n * You can specify options to pass to {@link ui.router.state.$state#go $state.go()}\n * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,\n * and `reload`.\n *\n * @example\n * Here's an example of how you'd use ui-sref and how it would compile. If you have the \n * following template:\n * <pre>\n * <a ui-sref=\"home\">Home</a> | <a ui-sref=\"about\">About</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a ui-sref=\"contacts.detail({ id: contact.id })\">{{ contact.name }}</a>\n *     </li>\n * </ul>\n * </pre>\n * \n * Then the compiled html would be (assuming Html5Mode is off):\n * <pre>\n * <a href=\"#/home\" ui-sref=\"home\">Home</a> | <a href=\"#/about\" ui-sref=\"about\">About</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/1\" ui-sref=\"contacts.detail({ id: contact.id })\">Joe</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/2\" ui-sref=\"contacts.detail({ id: contact.id })\">Alice</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/3\" ui-sref=\"contacts.detail({ id: contact.id })\">Bob</a>\n *     </li>\n * </ul>\n *\n * <a ui-sref=\"home\" ui-sref-opts=\"{reload: true}\">Home</a>\n * </pre>\n *\n * @param {string} ui-sref 'stateName' can be any valid absolute or relative state\n * @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}\n */\n$StateRefDirective.$inject = ['$state', '$timeout'];\nfunction $StateRefDirective($state, $timeout) {\n  var allowedOptions = ['location', 'inherit', 'reload'];\n\n  return {\n    restrict: 'A',\n    require: '?^uiSrefActive',\n    link: function(scope, element, attrs, uiSrefActive) {\n      var ref = parseStateRef(attrs.uiSref);\n      var params = null, url = null, base = stateContext(element) || $state.$current;\n      var isForm = element[0].nodeName === \"FORM\";\n      var attr = isForm ? \"action\" : \"href\", nav = true;\n\n      var options = {\n        relative: base\n      };\n      var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};\n      angular.forEach(allowedOptions, function(option) {\n        if (option in optionsOverride) {\n          options[option] = optionsOverride[option];\n        }\n      });\n\n      var update = function(newVal) {\n        if (newVal) params = newVal;\n        if (!nav) return;\n\n        var newHref = $state.href(ref.state, params, options);\n\n        if (uiSrefActive) {\n          uiSrefActive.$$setStateInfo(ref.state, params);\n        }\n        if (!newHref) {\n          nav = false;\n          return false;\n        }\n        element[0][attr] = newHref;\n      };\n\n      if (ref.paramExpr) {\n        scope.$watch(ref.paramExpr, function(newVal, oldVal) {\n          if (newVal !== params) update(newVal);\n        }, true);\n        params = scope.$eval(ref.paramExpr);\n      }\n      update();\n\n      if (isForm) return;\n\n      element.bind(\"click\", function(e) {\n        var button = e.which || e.button;\n        if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {\n          // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n          $timeout(function() {\n            $state.go(ref.state, params, options);\n          });\n          e.preventDefault();\n        }\n      });\n    }\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * A directive working alongside ui-sref to add classes to an element when the \n * related ui-sref directive's state is active, and removing them when it is inactive.\n * The primary use-case is to simplify the special appearance of navigation menus \n * relying on `ui-sref`, by having the \"active\" state's menu button appear different,\n * distinguishing it from the inactive menu items.\n *\n * @example\n * Given the following template:\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item\">\n *     <a href ui-sref=\"app.user({user: 'bilbobaggins'})\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n * \n * When the app state is \"app.user\", and contains the state parameter \"user\" with value \"bilbobaggins\", \n * the resulting HTML will appear as (note the 'active' class):\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item active\">\n *     <a ui-sref=\"app.user({user: 'bilbobaggins'})\" href=\"/users/bilbobaggins\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n * \n * The class name is interpolated **once** during the directives link time (any further changes to the \n * interpolated value are ignored). \n * \n * Multiple classes may be specified in a space-separated format:\n * <pre>\n * <ul>\n *   <li ui-sref-active='class1 class2 class3'>\n *     <a ui-sref=\"app.user\">link</a>\n *   </li>\n * </ul>\n * </pre>\n */\n$StateActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];\nfunction $StateActiveDirective($state, $stateParams, $interpolate) {\n  return {\n    restrict: \"A\",\n    controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {\n      var state, params, activeClass;\n\n      // There probably isn't much point in $observing this\n      activeClass = $interpolate($attrs.uiSrefActive || '', false)($scope);\n\n      // Allow uiSref to communicate with uiSrefActive\n      this.$$setStateInfo = function(newState, newParams) {\n        state = $state.get(newState, stateContext($element));\n        params = newParams;\n        update();\n      };\n\n      $scope.$on('$stateChangeSuccess', update);\n\n      // Update route state\n      function update() {\n        if ($state.$current.self === state && matchesParams()) {\n          $element.addClass(activeClass);\n        } else {\n          $element.removeClass(activeClass);\n        }\n      }\n\n      function matchesParams() {\n        return !params || equalForKeys(params, $stateParams);\n      }\n    }]\n  };\n}\n\nangular.module('ui.router.state')\n  .directive('uiSref', $StateRefDirective)\n  .directive('uiSrefActive', $StateActiveDirective);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/stateFilters.js",
    "content": "/**\n * @ngdoc filter\n * @name ui.router.state.filter:isState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_is $state.is(\"stateName\")}.\n */\n$IsStateFilter.$inject = ['$state'];\nfunction $IsStateFilter($state) {\n  return function(state) {\n    return $state.is(state);\n  };\n}\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:includedByState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.\n */\n$IncludedByStateFilter.$inject = ['$state'];\nfunction $IncludedByStateFilter($state) {\n  return function(state) {\n    return $state.includes(state);\n  };\n}\n\nangular.module('ui.router.state')\n  .filter('isState', $IsStateFilter)\n  .filter('includedByState', $IncludedByStateFilter);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/templateFactory.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.util.$templateFactory\n *\n * @requires $http\n * @requires $templateCache\n * @requires $injector\n *\n * @description\n * Service. Manages loading of templates.\n */\n$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];\nfunction $TemplateFactory(  $http,   $templateCache,   $injector) {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromConfig\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a configuration object. \n   *\n   * @param {object} config Configuration object for which to load a template. \n   * The following properties are search in the specified order, and the first one \n   * that is defined is used to create the template:\n   *\n   * @param {string|object} config.template html string template or function to \n   * load via {@link ui.router.util.$templateFactory#fromString fromString}.\n   * @param {string|object} config.templateUrl url to load or a function returning \n   * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.\n   * @param {Function} config.templateProvider function to invoke via \n   * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.\n   * @param {object} params  Parameters to pass to the template function.\n   * @param {object} locals Locals to pass to `invoke` if the template is loaded \n   * via a `templateProvider`. Defaults to `{ params: params }`.\n   *\n   * @return {string|object}  The template html as a string, or a promise for \n   * that string,or `null` if no template is configured.\n   */\n  this.fromConfig = function (config, params, locals) {\n    return (\n      isDefined(config.template) ? this.fromString(config.template, params) :\n      isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :\n      isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :\n      null\n    );\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromString\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a string or a function returning a string.\n   *\n   * @param {string|object} template html template as a string or function that \n   * returns an html template as a string.\n   * @param {object} params Parameters to pass to the template function.\n   *\n   * @return {string|object} The template html as a string, or a promise for that \n   * string.\n   */\n  this.fromString = function (template, params) {\n    return isFunction(template) ? template(params) : template;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   * \n   * @description\n   * Loads a template from the a URL via `$http` and `$templateCache`.\n   *\n   * @param {string|Function} url url of the template to load, or a function \n   * that returns a url.\n   * @param {Object} params Parameters to pass to the url function.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromUrl = function (url, params) {\n    if (isFunction(url)) url = url(params);\n    if (url == null) return null;\n    else return $http\n        .get(url, { cache: $templateCache })\n        .then(function(response) { return response.data; });\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template by invoking an injectable provider function.\n   *\n   * @param {Function} provider Function to invoke via `$injector.invoke`\n   * @param {Object} params Parameters for the template.\n   * @param {Object} locals Locals to pass to `invoke`. Defaults to \n   * `{ params: params }`.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromProvider = function (provider, params, locals) {\n    return $injector.invoke(provider, null, locals || { params: params });\n  };\n}\n\nangular.module('ui.router.util').service('$templateFactory', $TemplateFactory);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/urlMatcherFactory.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.util.type:UrlMatcher\n *\n * @description\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL. A URL pattern consists of a path pattern, optionally followed by '?' and a list\n * of search parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by {@link ui.router.util.type:UrlMatcher#methods_exec exec}.\n * \n * Path parameter placeholders can be specified using simple colon/catch-all syntax or curly brace\n * syntax, which optionally allows a regular expression for the parameter to be specified:\n *\n * * `':'` name - colon placeholder\n * * `'*'` name - catch-all placeholder\n * * `'{' name '}'` - curly placeholder\n * * `'{' name ':' regexp '}'` - curly placeholder with regexp. Should the regexp itself contain\n *   curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters). For colon \n * placeholders or curly placeholders without an explicit regexp, a path parameter matches any\n * number of characters other than '/'. For catch-all placeholders the path parameter matches\n * any number of characters.\n * \n * Examples:\n * \n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n *   trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n *   '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n *   parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n *   path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n *\n * @param {string} pattern  the pattern to compile into a matcher.\n * @param {bool} caseInsensitiveMatch true if url matching should be case insensitive, otherwise false, the default value (for backward compatibility) is false.\n *\n * @property {string} prefix  A static prefix of this pattern. The matcher guarantees that any\n *   URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns\n *   non-null) will start with this prefix.\n *\n * @property {string} source  The pattern that was passed into the contructor\n *\n * @property {string} sourcePath  The path portion of the source property\n *\n * @property {string} sourceSearch  The search portion of the source property\n *\n * @property {string} regex  The constructed regex that will be used to match against the url when \n *   it is time to determine which url will match.\n *\n * @returns {Object}  New UrlMatcher object\n */\nfunction UrlMatcher(pattern, caseInsensitiveMatch) {\n\n  // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n  //   '*' name\n  //   ':' name\n  //   '{' name '}'\n  //   '{' name ':' regexp '}'\n  // The regular expression is somewhat complicated due to the need to allow curly braces\n  // inside the regular expression. The placeholder regexp breaks down as follows:\n  //    ([:*])(\\w+)               classic placeholder ($1 / $2)\n  //    \\{(\\w+)(?:\\:( ... ))?\\}   curly brace placeholder ($3) with optional regexp ... ($4)\n  //    (?: ... | ... | ... )+    the regexp consists of any number of atoms, an atom being either\n  //    [^{}\\\\]+                  - anything other than curly braces or backslash\n  //    \\\\.                       - a backslash escape\n  //    \\{(?:[^{}\\\\]+|\\\\.)*\\}     - a matched set of curly braces containing other atoms\n  var placeholder = /([:*])(\\w+)|\\{(\\w+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      names = {}, compiled = '^', last = 0, m,\n      segments = this.segments = [],\n      params = this.params = [];\n\n  function addParameter(id) {\n    if (!/^\\w+(-+\\w+)*$/.test(id)) throw new Error(\"Invalid parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    if (names[id]) throw new Error(\"Duplicate parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    names[id] = true;\n    params.push(id);\n  }\n\n  function quoteRegExp(string) {\n    return string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n  }\n\n  this.source = pattern;\n\n  // Split into static segments separated by path parameter placeholders.\n  // The number of segments is always 1 more than the number of parameters.\n  var id, regexp, segment;\n  while ((m = placeholder.exec(pattern))) {\n    id = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null\n    regexp = m[4] || (m[1] == '*' ? '.*' : '[^/]*');\n    segment = pattern.substring(last, m.index);\n    if (segment.indexOf('?') >= 0) break; // we're into the search part\n    compiled += quoteRegExp(segment) + '(' + regexp + ')';\n    addParameter(id);\n    segments.push(segment);\n    last = placeholder.lastIndex;\n  }\n  segment = pattern.substring(last);\n\n  // Find any search parameter names and remove them from the last segment\n  var i = segment.indexOf('?');\n  if (i >= 0) {\n    var search = this.sourceSearch = segment.substring(i);\n    segment = segment.substring(0, i);\n    this.sourcePath = pattern.substring(0, last+i);\n\n    // Allow parameters to be separated by '?' as well as '&' to make concat() easier\n    forEach(search.substring(1).split(/[&?]/), addParameter);\n  } else {\n    this.sourcePath = pattern;\n    this.sourceSearch = '';\n  }\n\n  compiled += quoteRegExp(segment) + '$';\n  segments.push(segment);\n  if(caseInsensitiveMatch){\n    this.regexp = new RegExp(compiled, 'i');\n  }else{\n    this.regexp = new RegExp(compiled);\t\n  }\n  \n  this.prefix = segments[0];\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#concat\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns a new matcher for a pattern constructed by appending the path part and adding the\n * search parameters of the specified pattern to this pattern. The current pattern is not\n * modified. This can be understood as creating a pattern for URLs that are relative to (or\n * suffixes of) the current pattern.\n *\n * @example\n * The following two matchers are equivalent:\n * ```\n * new UrlMatcher('/user/{id}?q').concat('/details?date');\n * new UrlMatcher('/user/{id}/details?q&date');\n * ```\n *\n * @param {string} pattern  The pattern to append.\n * @returns {ui.router.util.type:UrlMatcher}  A matcher for the concatenated pattern.\n */\nUrlMatcher.prototype.concat = function (pattern) {\n  // Because order of search parameters is irrelevant, we can add our own search\n  // parameters to the end of the new pattern. Parse the new pattern by itself\n  // and then join the bits together, but it's much easier to do this on a string level.\n  return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch);\n};\n\nUrlMatcher.prototype.toString = function () {\n  return this.source;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#exec\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Tests the specified path against this matcher, and returns an object containing the captured\n * parameter values, or null if the path does not match. The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `searchParams`. This means that search parameters are always treated\n * as optional.\n *\n * @example\n * ```\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { x:'1', q:'hello' });\n * // returns { id:'bob', q:'hello', r:null }\n * ```\n *\n * @param {string} path  The URL path to match, e.g. `$location.path()`.\n * @param {Object} searchParams  URL search parameters, e.g. `$location.search()`.\n * @returns {Object}  The captured parameter values.\n */\nUrlMatcher.prototype.exec = function (path, searchParams) {\n  var m = this.regexp.exec(path);\n  if (!m) return null;\n\n  var params = this.params, nTotal = params.length,\n    nPath = this.segments.length-1,\n    values = {}, i;\n\n  if (nPath !== m.length - 1) throw new Error(\"Unbalanced capture group in route '\" + this.source + \"'\");\n\n  for (i=0; i<nPath; i++) values[params[i]] = m[i+1];\n  for (/**/; i<nTotal; i++) values[params[i]] = searchParams[params[i]];\n\n  return values;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#parameters\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns the names of all path and search parameters of this pattern in an unspecified order.\n * \n * @returns {Array.<string>}  An array of parameter names. Must be treated as read-only. If the\n *    pattern has no parameters, an empty array is returned.\n */\nUrlMatcher.prototype.parameters = function () {\n  return this.params;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#format\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters. Null values for path parameters are\n * treated as empty strings.\n *\n * @example\n * ```\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param {Object} values  the values to substitute for the parameters in this pattern.\n * @returns {string}  the formatted URL (path and optionally search part).\n */\nUrlMatcher.prototype.format = function (values) {\n  var segments = this.segments, params = this.params;\n  if (!values) return segments.join('');\n\n  var nPath = segments.length-1, nTotal = params.length,\n    result = segments[0], i, search, value;\n\n  for (i=0; i<nPath; i++) {\n    value = values[params[i]];\n    // TODO: Maybe we should throw on null here? It's not really good style to use '' and null interchangeabley\n    if (value != null) result += encodeURIComponent(value);\n    result += segments[i+1];\n  }\n  for (/**/; i<nTotal; i++) {\n    value = values[params[i]];\n    if (value != null) {\n      result += (search ? '&' : '?') + params[i] + '=' + encodeURIComponent(value);\n      search = true;\n    }\n  }\n\n  return result;\n};\n\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$urlMatcherFactory\n *\n * @description\n * Factory for {@link ui.router.util.type:UrlMatcher} instances. The factory is also available to providers\n * under the name `$urlMatcherFactoryProvider`.\n */\nfunction $UrlMatcherFactory() {\n\n  var useCaseInsensitiveMatch = false;\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#caseInsensitiveMatch\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Define if url matching should be case sensistive, the default behavior, or not.\n   *   \n   * @param {bool} value false to match URL in a case sensitive manner; otherwise true;\n   */\n  this.caseInsensitiveMatch = function(value){\n    useCaseInsensitiveMatch = value;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#compile\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Creates a {@link ui.router.util.type:UrlMatcher} for the specified pattern.\n   *   \n   * @param {string} pattern  The URL pattern.\n   * @returns {ui.router.util.type:UrlMatcher}  The UrlMatcher.\n   */\n  this.compile = function (pattern) {\n    return new UrlMatcher(pattern, useCaseInsensitiveMatch);\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#isMatcher\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Returns true if the specified object is a UrlMatcher, or false otherwise.\n   *\n   * @param {Object} object  The object to perform the type check against.\n   * @returns {Boolean}  Returns `true` if the object has the following functions: `exec`, `format`, and `concat`.\n   */\n  this.isMatcher = function (o) {\n    return isObject(o) && isFunction(o.exec) && isFunction(o.format) && isFunction(o.concat);\n  };\n  \n  /* No need to document $get, since it returns this */\n  this.$get = function () {\n    return this;\n  };\n}\n\n// Register as a provider so it's available to other providers\nangular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/urlRouter.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.router.$urlRouterProvider\n *\n * @requires ui.router.util.$urlMatcherFactoryProvider\n *\n * @description\n * `$urlRouterProvider` has the responsibility of watching `$location`. \n * When `$location` changes it runs through a list of rules one by one until a \n * match is found. `$urlRouterProvider` is used behind the scenes anytime you specify \n * a url in a state configuration. All urls are compiled into a UrlMatcher object.\n *\n * There are several methods on `$urlRouterProvider` that make it useful to use directly\n * in your module config.\n */\n$UrlRouterProvider.$inject = ['$urlMatcherFactoryProvider'];\nfunction $UrlRouterProvider(  $urlMatcherFactory) {\n  var rules = [], \n      otherwise = null;\n\n  // Returns a string that is a prefix of all strings matching the RegExp\n  function regExpPrefix(re) {\n    var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n    return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n  }\n\n  // Interpolates matched values into a String.replace()-style pattern\n  function interpolate(pattern, match) {\n    return pattern.replace(/\\$(\\$|\\d{1,2})/, function (m, what) {\n      return match[what === '$' ? 0 : Number(what)];\n    });\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#rule\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines rules that are used by `$urlRouterProvider to find matches for\n   * specific URLs.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {object} rule Handler function that takes `$injector` and `$location`\n   * services as arguments. You can use them to return a valid path as a string.\n   *\n   * @return {object} $urlRouterProvider - $urlRouterProvider instance\n   */\n  this.rule =\n    function (rule) {\n      if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n      rules.push(rule);\n      return this;\n    };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouterProvider#otherwise\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines a path that is used when an invalied route is requested.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     ...\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} rule The url path you want to redirect to or a function \n   * rule that returns the url path. The function version is passed two params: \n   * `$injector` and `$location` services.\n   *\n   * @return {object} $urlRouterProvider - $urlRouterProvider instance\n   */\n  this.otherwise =\n    function (rule) {\n      if (isString(rule)) {\n        var redirect = rule;\n        rule = function () { return redirect; };\n      }\n      else if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n      otherwise = rule;\n      return this;\n    };\n\n\n  function handleIfMatch($injector, handler, match) {\n    if (!match) return false;\n    var result = $injector.invoke(handler, handler, { $match: match });\n    return isDefined(result) ? result : true;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#when\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Registers a handler for a given url matching. if handle is a string, it is\n   * treated as a redirect, and is interpolated according to the syyntax of match\n   * (i.e. like String.replace() for RegExp, or like a UrlMatcher pattern otherwise).\n   *\n   * If the handler is a function, it is injectable. It gets invoked if `$location`\n   * matches. You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} what The incoming path that you want to redirect.\n   * @param {string|object} handler The path you want to redirect your user to.\n   */\n  this.when =\n    function (what, handler) {\n      var redirect, handlerIsString = isString(handler);\n      if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n      if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n        throw new Error(\"invalid 'handler' in when()\");\n\n      var strategies = {\n        matcher: function (what, handler) {\n          if (handlerIsString) {\n            redirect = $urlMatcherFactory.compile(handler);\n            handler = ['$match', function ($match) { return redirect.format($match); }];\n          }\n          return extend(function ($injector, $location) {\n            return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n          }, {\n            prefix: isString(what.prefix) ? what.prefix : ''\n          });\n        },\n        regex: function (what, handler) {\n          if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n          if (handlerIsString) {\n            redirect = handler;\n            handler = ['$match', function ($match) { return interpolate(redirect, $match); }];\n          }\n          return extend(function ($injector, $location) {\n            return handleIfMatch($injector, handler, what.exec($location.path()));\n          }, {\n            prefix: regExpPrefix(what)\n          });\n        }\n      };\n\n      var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };\n\n      for (var n in check) {\n        if (check[n]) {\n          return this.rule(strategies[n](what, handler));\n        }\n      }\n\n      throw new Error(\"invalid 'what' in when()\");\n    };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouter\n   *\n   * @requires $location\n   * @requires $rootScope\n   * @requires $injector\n   *\n   * @description\n   *\n   */\n  this.$get =\n    [        '$location', '$rootScope', '$injector',\n    function ($location,   $rootScope,   $injector) {\n      // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree\n      function update(evt) {\n        if (evt && evt.defaultPrevented) return;\n        function check(rule) {\n          var handled = rule($injector, $location);\n          if (handled) {\n            if (isString(handled)) $location.replace().url(handled);\n            return true;\n          }\n          return false;\n        }\n        var n=rules.length, i;\n        for (i=0; i<n; i++) {\n          if (check(rules[i])) return;\n        }\n        // always check otherwise last to allow dynamic updates to the set of rules\n        if (otherwise) check(otherwise);\n      }\n\n      $rootScope.$on('$locationChangeSuccess', update);\n\n      return {\n        /**\n         * @ngdoc function\n         * @name ui.router.router.$urlRouter#sync\n         * @methodOf ui.router.router.$urlRouter\n         *\n         * @description\n         * Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.\n         * This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event, \n         * perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed \n         * with the transition by calling `$urlRouter.sync()`.\n         *\n         * @example\n         * <pre>\n         * angular.module('app', ['ui.router']);\n         *   .run(function($rootScope, $urlRouter) {\n         *     $rootScope.$on('$locationChangeSuccess', function(evt) {\n         *       // Halt state change from even starting\n         *       evt.preventDefault();\n         *       // Perform custom logic\n         *       var meetsRequirement = ...\n         *       // Continue with the update and state transition if logic allows\n         *       if (meetsRequirement) $urlRouter.sync();\n         *     });\n         * });\n         * </pre>\n         */\n        sync: function () {\n          update();\n        }\n      };\n    }];\n}\n\nangular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/view.js",
    "content": "\n$ViewProvider.$inject = [];\nfunction $ViewProvider() {\n\n  this.$get = $get;\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$view\n   *\n   * @requires ui.router.util.$templateFactory\n   * @requires $rootScope\n   *\n   * @description\n   *\n   */\n  $get.$inject = ['$rootScope', '$templateFactory'];\n  function $get(   $rootScope,   $templateFactory) {\n    return {\n      // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })\n      /**\n       * @ngdoc function\n       * @name ui.router.state.$view#load\n       * @methodOf ui.router.state.$view\n       *\n       * @description\n       *\n       * @param {string} name name\n       * @param {object} options option object.\n       */\n      load: function load(name, options) {\n        var result, defaults = {\n          template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}\n        };\n        options = extend(defaults, options);\n\n        if (options.view) {\n          result = $templateFactory.fromConfig(options.view, options.params, options.locals);\n        }\n        if (result && options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$viewContentLoading\n         * @eventOf ui.router.state.$view\n         * @eventType broadcast on root scope\n         * @description\n         *\n         * Fired once the view **begins loading**, *before* the DOM is rendered.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} viewConfig The view config properties (template, controller, etc).\n         *\n         * @example\n         *\n         * <pre>\n         * $scope.$on('$viewContentLoading',\n         * function(event, viewConfig){\n         *     // Access to all the view config properties.\n         *     // and one special property 'targetView'\n         *     // viewConfig.targetView\n         * });\n         * </pre>\n         */\n          $rootScope.$broadcast('$viewContentLoading', options);\n        }\n        return result;\n      }\n    };\n  }\n}\n\nangular.module('ui.router.state').provider('$view', $ViewProvider);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/viewDirective.js",
    "content": "/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-view\n *\n * @requires ui.router.state.$state\n * @requires $compile\n * @requires $controller\n * @requires $injector\n * @requires ui.router.state.$uiViewScroll\n * @requires $document\n *\n * @restrict ECA\n *\n * @description\n * The ui-view directive tells $state where to place your templates.\n *\n * @param {string=} ui-view A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states.\n *\n * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window\n * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll\n * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you\n * scroll ui-view elements into view when they are populated during a state activation.\n *\n * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*\n *\n * @param {string=} onload Expression to evaluate whenever the view updates.\n * \n * @example\n * A view can be unnamed or named. \n * <pre>\n * <!-- Unnamed -->\n * <div ui-view></div> \n * \n * <!-- Named -->\n * <div ui-view=\"viewName\"></div>\n * </pre>\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a \n * single view and it is unnamed then you can populate it like so:\n * <pre>\n * <div ui-view></div> \n * $stateProvider.state(\"home\", {\n *   template: \"<h1>HELLO!</h1>\"\n * })\n * </pre>\n * \n * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}\n * config property, by name, in this case an empty name:\n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * But typically you'll only use the views property if you name your view or have more than one view \n * in the same template. There's not really a compelling reason to name a view if its the only one, \n * but you could if you wanted, like so:\n * <pre>\n * <div ui-view=\"main\"></div>\n * </pre> \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"main\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * Really though, you'll use views to set up multiple views:\n * <pre>\n * <div ui-view></div>\n * <div ui-view=\"chart\"></div> \n * <div ui-view=\"data\"></div> \n * </pre>\n * \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     },\n *     \"chart\": {\n *       template: \"<chart_thing/>\"\n *     },\n *     \"data\": {\n *       template: \"<data_thing/>\"\n *     }\n *   }    \n * })\n * </pre>\n *\n * Examples for `autoscroll`:\n *\n * <pre>\n * <!-- If autoscroll present with no expression,\n *      then scroll ui-view into view -->\n * <ui-view autoscroll/>\n *\n * <!-- If autoscroll present with valid expression,\n *      then scroll ui-view into view if expression evaluates to true -->\n * <ui-view autoscroll='true'/>\n * <ui-view autoscroll='false'/>\n * <ui-view autoscroll='scopeVariable'/>\n * </pre>\n */\n$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll'];\nfunction $ViewDirective(   $state,   $injector,   $uiViewScroll) {\n\n  function getService() {\n    return ($injector.has) ? function(service) {\n      return $injector.has(service) ? $injector.get(service) : null;\n    } : function(service) {\n      try {\n        return $injector.get(service);\n      } catch (e) {\n        return null;\n      }\n    };\n  }\n\n  var service = getService(),\n      $animator = service('$animator'),\n      $animate = service('$animate');\n\n  // Returns a set of DOM manipulation functions based on which Angular version\n  // it should use\n  function getRenderer(attrs, scope) {\n    var statics = function() {\n      return {\n        enter: function (element, target, cb) { target.after(element); cb(); },\n        leave: function (element, cb) { element.remove(); cb(); }\n      };\n    };\n\n    if ($animate) {\n      return {\n        enter: function(element, target, cb) { $animate.enter(element, null, target, cb); },\n        leave: function(element, cb) { $animate.leave(element, cb); }\n      };\n    }\n\n    if ($animator) {\n      var animate = $animator && $animator(scope, attrs);\n\n      return {\n        enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },\n        leave: function(element, cb) { animate.leave(element); cb(); }\n      };\n    }\n\n    return statics();\n  }\n\n  var directive = {\n    restrict: 'ECA',\n    terminal: true,\n    priority: 400,\n    transclude: 'element',\n    compile: function (tElement, tAttrs, $transclude) {\n      return function (scope, $element, attrs) {\n        var previousEl, currentEl, currentScope, latestLocals,\n            onloadExp     = attrs.onload || '',\n            autoScrollExp = attrs.autoscroll,\n            renderer      = getRenderer(attrs, scope);\n\n        scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        updateView(true);\n\n        function cleanupLastView() {\n          if (previousEl) {\n            previousEl.remove();\n            previousEl = null;\n          }\n\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n\n          if (currentEl) {\n            renderer.leave(currentEl, function() {\n              previousEl = null;\n            });\n\n            previousEl = currentEl;\n            currentEl = null;\n          }\n        }\n\n        function updateView(firstTime) {\n          var newScope        = scope.$new(),\n              name            = currentEl && currentEl.data('$uiViewName'),\n              previousLocals  = name && $state.$current && $state.$current.locals[name];\n\n          if (!firstTime && previousLocals === latestLocals) return; // nothing to do\n\n          var clone = $transclude(newScope, function(clone) {\n            renderer.enter(clone, $element, function onUiViewEnter() {\n              if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n                $uiViewScroll(clone);\n              }\n            });\n            cleanupLastView();\n          });\n\n          latestLocals = $state.$current.locals[clone.data('$uiViewName')];\n\n          currentEl = clone;\n          currentScope = newScope;\n          /**\n           * @ngdoc event\n           * @name ui.router.state.directive:ui-view#$viewContentLoaded\n           * @eventOf ui.router.state.directive:ui-view\n           * @eventType emits on ui-view directive scope\n           * @description           *\n           * Fired once the view is **loaded**, *after* the DOM is rendered.\n           *\n           * @param {Object} event Event object.\n           */\n          currentScope.$emit('$viewContentLoaded');\n          currentScope.$eval(onloadExp);\n        }\n      };\n    }\n  };\n\n  return directive;\n}\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state'];\nfunction $ViewDirectiveFill ($compile, $controller, $state) {\n  return {\n    restrict: 'ECA',\n    priority: -400,\n    compile: function (tElement) {\n      var initial = tElement.html();\n      return function (scope, $element, attrs) {\n        var name      = attrs.uiView || attrs.name || '',\n            inherited = $element.inheritedData('$uiView');\n\n        if (name.indexOf('@') < 0) {\n          name = name + '@' + (inherited ? inherited.state.name : '');\n        }\n\n        $element.data('$uiViewName', name);\n\n        var current = $state.$current,\n            locals  = current && current.locals[name];\n\n        if (! locals) {\n          return;\n        }\n\n        $element.data('$uiView', { name: name, state: locals.$$state });\n        $element.html(locals.$template ? locals.$template : initial);\n\n        var link = $compile($element.contents());\n\n        if (locals.$$controller) {\n          locals.$scope = scope;\n          var controller = $controller(locals.$$controller, locals);\n          if (locals.$$controllerAs) {\n            scope[locals.$$controllerAs] = controller;\n          }\n          $element.data('$ngControllerController', controller);\n          $element.children().data('$ngControllerController', controller);\n        }\n\n        link(scope);\n      };\n    }\n  };\n}\n\nangular.module('ui.router.state').directive('uiView', $ViewDirective);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n"
  },
  {
    "path": "www/lib/angular-ui-router/src/viewScroll.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.state.$uiViewScrollProvider\n *\n * @description\n * Provider that returns the {@link ui.router.state.$uiViewScroll} service function.\n */\nfunction $ViewScrollProvider() {\n\n  var useAnchorScroll = false;\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll\n   * @methodOf ui.router.state.$uiViewScrollProvider\n   *\n   * @description\n   * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for\n   * scrolling based on the url anchor.\n   */\n  this.useAnchorScroll = function () {\n    useAnchorScroll = true;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$uiViewScroll\n   *\n   * @requires $anchorScroll\n   * @requires $timeout\n   *\n   * @description\n   * When called with a jqLite element, it scrolls the element into view (after a\n   * `$timeout` so the DOM has time to refresh).\n   *\n   * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n   * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.\n   */\n  this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {\n    if (useAnchorScroll) {\n      return $anchorScroll;\n    }\n\n    return function ($element) {\n      $timeout(function () {\n        $element[0].scrollIntoView();\n      }, 0, false);\n    };\n  }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n"
  },
  {
    "path": "www/lib/angularfire/.bower.json",
    "content": "{\n  \"name\": \"angularfire\",\n  \"description\": \"The officially supported AngularJS binding for Firebase\",\n  \"version\": \"0.8.2\",\n  \"authors\": [\n    \"Firebase <support@firebase.com> (https://www.firebase.com/)\"\n  ],\n  \"homepage\": \"https://github.com/firebase/angularfire\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/firebase/angularfire.git\"\n  },\n  \"license\": \"MIT\",\n  \"keywords\": [\n    \"angular\",\n    \"angularjs\",\n    \"firebase\",\n    \"realtime\"\n  ],\n  \"main\": \"dist/angularfire.min.js\",\n  \"ignore\": [\n    \"**/.*\",\n    \"src\",\n    \"tests\",\n    \"node_modules\",\n    \"bower_components\",\n    \"firebase.json\",\n    \"package.json\",\n    \"Gruntfile.js\",\n    \"changelog.txt\"\n  ],\n  \"dependencies\": {\n    \"angular\": \"1.2.x || 1.3.x\",\n    \"firebase\": \"1.0.x\",\n    \"firebase-simple-login\": \"1.6.x\",\n    \"mockfirebase\": \"~0.2.9\"\n  },\n  \"devDependencies\": {\n    \"lodash\": \"~2.4.1\",\n    \"angular-mocks\": \"~1.2.18\"\n  },\n  \"_release\": \"0.8.2\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v0.8.2\",\n    \"commit\": \"e1345a96b6299fa23850403e5af2119ab4f62fb1\"\n  },\n  \"_source\": \"git://github.com/firebase/angularFire.git\",\n  \"_target\": \"~0.8.2\",\n  \"_originalSource\": \"angularfire\",\n  \"_direct\": true\n}"
  },
  {
    "path": "www/lib/angularfire/README.md",
    "content": "\n# AngularFire\n\n[![Build Status](https://travis-ci.org/firebase/angularfire.svg?branch=master)](https://travis-ci.org/firebase/angularfire)\n[![Coverage Status](https://img.shields.io/coveralls/firebase/angularfire.svg)](https://coveralls.io/r/firebase/angularfire)\n[![Version](https://badge.fury.io/gh/firebase%2Fangularfire.svg)](http://badge.fury.io/gh/firebase%2Fangularfire)\n\nAngularFire is the officially supported [AngularJS](http://angularjs.org/) binding for\n[Firebase](http://www.firebase.com/?utm_medium=web&utm_source=angularfire). Firebase is a full\nbackend so you don't need servers to build your Angular app. AngularFire provides you with the\n`$firebase` service which allows you to easily keep your `$scope` variables in sync with your\nFirebase backend.\n\n\n## Downloading AngularFire\n\nIn order to use AngularFire in your project, you need to include the following files in your HTML:\n\n```html\n<!-- AngularJS -->\n<script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js\"></script>\n\n<!-- Firebase -->\n<script src=\"https://cdn.firebase.com/js/client/1.0.21/firebase.js\"></script>\n\n<!-- AngularFire -->\n<script src=\"https://cdn.firebase.com/libs/angularfire/0.8.0/angularfire.min.js\"></script>\n```\n\nUse the URL above to download both the minified and non-minified versions of AngularFire from the\nFirebase CDN. You can also download them from the\n[releases page of this GitHub repository](https://github.com/firebase/angularfire/releases).\n[Firebase](https://www.firebase.com/docs/web/quickstart.html?utm_medium=web&utm_source=angularfire) and\n[Angular](https://angularjs.org/) can be downloaded directly from their respective websites.\n\nYou can also install AngularFire via Bower and its dependencies will be downloaded automatically:\n\n```bash\n$ bower install angularfire --save\n```\n\nOnce you've included AngularFire and its dependencies into your project, you will have access to\nthe `$firebase` service.\n\nYou can also start hacking on AngularFire in a matter of seconds on\n[Nitrous.IO](https://www.nitrous.io/?utm_source=github.com&utm_campaign=angularfire&utm_medium=hackonnitrous):\n\n[![Hack firebase/angularfire on\nNitrous.IO](https://d3o0mnbgv6k92a.cloudfront.net/assets/hack-l-v1-3cc067e71372f6045e1949af9d96095b.png)](https://www.nitrous.io/hack_button?source=embed&runtime=nodejs&repo=firebase%2Fangularfire&file_to_open=README.md)\n\n\n## Getting Started with Firebase\n\nAngularFire requires Firebase in order to sync data. You can\n[sign up here](https://www.firebase.com/signup/?utm_medium=web&utm_source=angularfire) for a free\naccount.\n\n\n## Documentation\n\nThe Firebase docs have a [quickstart](https://www.firebase.com/docs/web/bindings/angular/quickstart.html?utm_medium=web&utm_source=angularfire),\n[guide](https://www.firebase.com/docs/web/bindings/angular/guide.html?utm_medium=web&utm_source=angularfire),\nand [full API reference](https://www.firebase.com/docs/web/bindings/angular/api.html?utm_medium=web&utm_source=angularfire)\nfor AngularFire.\n\nWe also have a [tutorial](https://www.firebase.com/tutorial/#tutorial/angular/0?utm_medium=web&utm_source=angularfire)\nto help you get started with AngularFire.\n\nJoin our [Firebase + Angular Google Group](https://groups.google.com/forum/#!forum/firebase-angular)\nto ask questions, provide feedback, and share apps you've built with AngularFire.\n\n\n## Contributing\n\nIf you'd like to contribute to AngularFire, you'll need to run the following commands to get your\nenvironment set up:\n\n```bash\n$ git clone https://github.com/firebase/angularfire.git\n$ cd angularfire            # go to the angularfire directory\n$ npm install -g grunt-cli  # globally install grunt task runner\n$ npm install -g bower      # globally install Bower package manager\n$ npm install               # install local npm build / test dependencies\n$ bower install             # install local JavaScript dependencies\n$ grunt install             # install Selenium server for end-to-end tests\n$ grunt watch               # watch for source file changes\n```\n\n`grunt watch` will watch for changes in the `/src/` directory and lint, concatenate, and minify the\nsource files when a change occurs. The output files - `angularfire.js` and `angularfire.min.js` -\nare written to the `/dist/` directory. `grunt watch` will also re-run the unit tests every time you\nupdate any source files.\n\nYou can run the entire test suite via the command line using `grunt test`. To only run the unit\ntests, run `grunt test:unit`. To only run the end-to-end [Protractor](https://github.com/angular/protractor/)\ntests, run `grunt test:e2e`.\n\nIn addition to the automated test suite, there is an additional manual test suite that ensures that\nthe `$firebaseSimpleLogin` service is working properly with the authentication providers. These tests\ncan be run with `grunt test:manual`. Note that you must click \"Close this window\", login to Twitter,\netc. when prompted in order for these tests to complete successfully.\n"
  },
  {
    "path": "www/lib/angularfire/bower.json",
    "content": "{\n  \"name\": \"angularfire\",\n  \"description\": \"The officially supported AngularJS binding for Firebase\",\n  \"version\": \"0.0.0\",\n  \"authors\": [\n    \"Firebase <support@firebase.com> (https://www.firebase.com/)\"\n  ],\n  \"homepage\": \"https://github.com/firebase/angularfire\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/firebase/angularfire.git\"\n  },\n  \"license\": \"MIT\",\n  \"keywords\": [\n    \"angular\",\n    \"angularjs\",\n    \"firebase\",\n    \"realtime\"\n  ],\n  \"main\": \"dist/angularfire.min.js\",\n  \"ignore\": [\n    \"**/.*\",\n    \"src\",\n    \"tests\",\n    \"node_modules\",\n    \"bower_components\",\n    \"firebase.json\",\n    \"package.json\",\n    \"Gruntfile.js\",\n    \"changelog.txt\"\n  ],\n  \"dependencies\": {\n    \"angular\": \"1.2.x || 1.3.x\",\n    \"firebase\": \"1.0.x\",\n    \"firebase-simple-login\": \"1.6.x\",\n    \"mockfirebase\": \"~0.2.9\"\n  },\n  \"devDependencies\": {\n    \"lodash\": \"~2.4.1\",\n    \"angular-mocks\": \"~1.2.18\"\n  }\n}\n"
  },
  {
    "path": "www/lib/angularfire/dist/angularfire.js",
    "content": "/*!\n * AngularFire is the officially supported AngularJS binding for Firebase. Firebase\n * is a full backend so you don't need servers to build your Angular app. AngularFire\n * provides you with the $firebase service which allows you to easily keep your $scope\n * variables in sync with your Firebase backend.\n *\n * AngularFire 0.0.0\n * https://github.com/firebase/angularfire/\n * Date: 08/28/2014\n * License: MIT\n */\n(function(exports) {\n  \"use strict\";\n\n// Define the `firebase` module under which all AngularFire\n// services will live.\n  angular.module(\"firebase\", [])\n    //todo use $window\n    .value(\"Firebase\", exports.Firebase)\n\n    // used in conjunction with firebaseUtils.debounce function, this is the\n    // amount of time we will wait for additional records before triggering\n    // Angular's digest scope to dirty check and re-render DOM elements. A\n    // larger number here significantly improves performance when working with\n    // big data sets that are frequently changing in the DOM, but delays the\n    // speed at which each record is rendered in real-time. A number less than\n    // 100ms will usually be optimal.\n    .value('firebaseBatchDelay', 50 /* milliseconds */);\n\n})(window);\n(function() {\n  'use strict';\n  /**\n   * Creates and maintains a synchronized list of data. This constructor should not be\n   * manually invoked. Instead, one should create a $firebase object and call $asArray\n   * on it:  <code>$firebase( firebaseRef ).$asArray()</code>;\n   *\n   * Internally, the $firebase object depends on this class to provide 5 methods, which it invokes\n   * to notify the array whenever a change has been made at the server:\n   *    $$added - called whenever a child_added event occurs\n   *    $$updated - called whenever a child_changed event occurs\n   *    $$moved - called whenever a child_moved event occurs\n   *    $$removed - called whenever a child_removed event occurs\n   *    $$error - called when listeners are canceled due to a security error\n   *\n   * Instead of directly modifying this class, one should generally use the $extendFactory\n   * method to add or change how methods behave:\n   *\n   * <pre><code>\n   * var NewFactory = $FirebaseArray.$extendFactory({\n   *    // add a new method to the prototype\n   *    foo: function() { return 'bar'; },\n   *\n   *    // change how records are created\n   *    $$added: function(snap) {\n   *       var rec = new Widget(snap);\n   *       this._process('child_added', rec);\n   *    }\n   * });\n   * </code></pre>\n   *\n   * And then the new factory can be used by passing it as an argument:\n   * <code>$firebase( firebaseRef, {arrayFactory: NewFactory}).$asArray();</code>\n   */\n  angular.module('firebase').factory('$FirebaseArray', [\"$log\", \"$firebaseUtils\",\n    function($log, $firebaseUtils) {\n      /**\n       * This constructor should probably never be called manually. It is used internally by\n       * <code>$firebase.$asArray()</code>.\n       *\n       * @param $firebase\n       * @param {Function} destroyFn invoking this will cancel all event listeners and stop\n       *                   notifications from being delivered to $$added, $$updated, $$moved, and $$removed\n       * @param readyPromise resolved when the initial data downloaded from Firebase\n       * @returns {Array}\n       * @constructor\n       */\n      function FirebaseArray($firebase, destroyFn, readyPromise) {\n        var self = this;\n        this._observers = [];\n        this.$list = [];\n        this._inst = $firebase;\n        this._promise = readyPromise;\n        this._destroyFn = destroyFn;\n\n        // Array.isArray will not work on objects which extend the Array class.\n        // So instead of extending the Array class, we just return an actual array.\n        // However, it's still possible to extend FirebaseArray and have the public methods\n        // appear on the array object. We do this by iterating the prototype and binding\n        // any method that is not prefixed with an underscore onto the final array.\n        $firebaseUtils.getPublicMethods(self, function(fn, key) {\n          self.$list[key] = fn.bind(self);\n        });\n\n        return this.$list;\n      }\n\n      FirebaseArray.prototype = {\n        /**\n         * Create a new record with a unique ID and add it to the end of the array.\n         * This should be used instead of Array.prototype.push, since those changes will not be\n         * synchronized with the server.\n         *\n         * Any value, including a primitive, can be added in this way. Note that when the record\n         * is created, the primitive value would be stored in $value (records are always objects\n         * by default).\n         *\n         * Returns a future which is resolved when the data has successfully saved to the server.\n         * The resolve callback will be passed a Firebase ref representing the new data element.\n         *\n         * @param data\n         * @returns a promise resolved after data is added\n         */\n        $add: function(data) {\n          this._assertNotDestroyed('$add');\n          return this.$inst().$push($firebaseUtils.toJSON(data));\n        },\n\n        /**\n         * Pass either an item in the array or the index of an item and it will be saved back\n         * to Firebase. While the array is read-only and its structure should not be changed,\n         * it is okay to modify properties on the objects it contains and then save those back\n         * individually.\n         *\n         * Returns a future which is resolved when the data has successfully saved to the server.\n         * The resolve callback will be passed a Firebase ref representing the saved element.\n         * If passed an invalid index or an object which is not a record in this array,\n         * the promise will be rejected.\n         *\n         * @param {int|object} indexOrItem\n         * @returns a promise resolved after data is saved\n         */\n        $save: function(indexOrItem) {\n          this._assertNotDestroyed('$save');\n          var self = this;\n          var item = self._resolveItem(indexOrItem);\n          var key = self.$keyAt(item);\n          if( key !== null ) {\n            return self.$inst().$set(key, $firebaseUtils.toJSON(item))\n              .then(function(ref) {\n                self._notify('child_changed', key);\n                return ref;\n              });\n          }\n          else {\n            return $firebaseUtils.reject('Invalid record; could determine its key: '+indexOrItem);\n          }\n        },\n\n        /**\n         * Pass either an existing item in this array or the index of that item and it will\n         * be removed both locally and in Firebase. This should be used in place of\n         * Array.prototype.splice for removing items out of the array, as calling splice\n         * will not update the value on the server.\n         *\n         * Returns a future which is resolved when the data has successfully removed from the\n         * server. The resolve callback will be passed a Firebase ref representing the deleted\n         * element. If passed an invalid index or an object which is not a record in this array,\n         * the promise will be rejected.\n         *\n         * @param {int|object} indexOrItem\n         * @returns a promise which resolves after data is removed\n         */\n        $remove: function(indexOrItem) {\n          this._assertNotDestroyed('$remove');\n          var key = this.$keyAt(indexOrItem);\n          if( key !== null ) {\n            return this.$inst().$remove(key);\n          }\n          else {\n            return $firebaseUtils.reject('Invalid record; could not find key: '+indexOrItem);\n          }\n        },\n\n        /**\n         * Given an item in this array or the index of an item in the array, this returns the\n         * Firebase key (record.$id) for that record. If passed an invalid key or an item which\n         * does not exist in this array, it will return null.\n         *\n         * @param {int|object} indexOrItem\n         * @returns {null|string}\n         */\n        $keyAt: function(indexOrItem) {\n          var item = this._resolveItem(indexOrItem);\n          return this._getKey(item);\n        },\n\n        /**\n         * The inverse of $keyAt, this method takes a Firebase key (record.$id) and returns the\n         * index in the array where that record is stored. If the record is not in the array,\n         * this method returns -1.\n         *\n         * @param {String} key\n         * @returns {int} -1 if not found\n         */\n        $indexFor: function(key) {\n          var self = this;\n          // todo optimize and/or cache these? they wouldn't need to be perfect\n          return this.$list.findIndex(function(rec) { return self._getKey(rec) === key; });\n        },\n\n        /**\n         * The loaded method is invoked after the initial batch of data arrives from the server.\n         * When this resolves, all data which existed prior to calling $asArray() is now cached\n         * locally in the array.\n         *\n         * As a shortcut is also possible to pass resolve/reject methods directly into this\n         * method just as they would be passed to .then()\n         *\n         * @param {Function} [resolve]\n         * @param {Function} [reject]\n         * @returns a promise\n         */\n        $loaded: function(resolve, reject) {\n          var promise = this._promise;\n          if( arguments.length ) {\n            promise = promise.then.call(promise, resolve, reject);\n          }\n          return promise;\n        },\n\n        /**\n         * @returns the original $firebase object used to create this object.\n         */\n        $inst: function() { return this._inst; },\n\n        /**\n         * Listeners passed into this method are notified whenever a new change (add, updated,\n         * move, remove) is received from the server. Each invocation is sent an object\n         * containing <code>{ type: 'added|updated|moved|removed', key: 'key_of_item_affected'}</code>\n         *\n         * Additionally, added and moved events receive a prevChild parameter, containing the\n         * key of the item before this one in the array.\n         *\n         * This method returns a function which can be invoked to stop observing events.\n         *\n         * @param {Function} cb\n         * @param {Object} [context]\n         * @returns {Function} used to stop observing\n         */\n        $watch: function(cb, context) {\n          var list = this._observers;\n          list.push([cb, context]);\n          // an off function for cancelling the listener\n          return function() {\n            var i = list.findIndex(function(parts) {\n              return parts[0] === cb && parts[1] === context;\n            });\n            if( i > -1 ) {\n              list.splice(i, 1);\n            }\n          };\n        },\n\n        /**\n         * Informs $firebase to stop sending events and clears memory being used\n         * by this array (delete's its local content).\n         */\n        $destroy: function(err) {\n          if( !this._isDestroyed ) {\n            this._isDestroyed = true;\n            this.$list.length = 0;\n            $log.debug('destroy called for FirebaseArray: '+this.$inst().$ref().toString());\n            this._destroyFn(err);\n          }\n        },\n\n        /**\n         * Returns the record for a given Firebase key (record.$id). If the record is not found\n         * then returns null.\n         *\n         * @param {string} key\n         * @returns {Object|null} a record in this array\n         */\n        $getRecord: function(key) {\n          var i = this.$indexFor(key);\n          return i > -1? this.$list[i] : null;\n        },\n\n        /**\n         * Called by $firebase to inform the array when a new item has been added at the server.\n         * This method must exist on any array factory used by $firebase.\n         *\n         * @param snap\n         * @param {string} prevChild\n         */\n        $$added: function(snap, prevChild) {\n          // check to make sure record does not exist\n          var i = this.$indexFor(snap.name());\n          if( i === -1 ) {\n            // parse data and create record\n            var rec = snap.val();\n            if( !angular.isObject(rec) ) {\n              rec = { $value: rec };\n            }\n            rec.$id = snap.name();\n            rec.$priority = snap.getPriority();\n            $firebaseUtils.applyDefaults(rec, this.$$defaults);\n\n            // add it to array and send notifications\n            this._process('child_added', rec, prevChild);\n          }\n        },\n\n        /**\n         * Called by $firebase whenever an item is removed at the server.\n         * This method must exist on any arrayFactory passed into $firebase\n         *\n         * @param snap\n         */\n        $$removed: function(snap) {\n          var rec = this.$getRecord(snap.name());\n          if( angular.isObject(rec) ) {\n            this._process('child_removed', rec);\n          }\n        },\n\n        /**\n         * Called by $firebase whenever an item is changed at the server.\n         * This method must exist on any arrayFactory passed into $firebase\n         *\n         * @param snap\n         */\n        $$updated: function(snap) {\n          var rec = this.$getRecord(snap.name());\n          if( angular.isObject(rec) ) {\n            // apply changes to the record\n            var changed = $firebaseUtils.updateRec(rec, snap);\n            $firebaseUtils.applyDefaults(rec, this.$$defaults);\n            if( changed ) {\n              this._process('child_changed', rec);\n            }\n          }\n        },\n\n        /**\n         * Called by $firebase whenever an item changes order (moves) on the server.\n         * This method must exist on any arrayFactory passed into $firebase\n         *\n         * @param snap\n         * @param {string} prevChild\n         */\n        $$moved: function(snap, prevChild) {\n          var rec = this.$getRecord(snap.name());\n          if( angular.isObject(rec) ) {\n            rec.$priority = snap.getPriority();\n            this._process('child_moved', rec, prevChild);\n          }\n        },\n\n        /**\n         * Called whenever a security error or other problem causes the listeners to become\n         * invalid. This is generally an unrecoverable error.\n         * @param {Object} err which will have a `code` property and possibly a `message`\n         */\n        $$error: function(err) {\n          $log.error(err);\n          this.$destroy(err);\n        },\n\n        /**\n         * Returns ID for a given record\n         * @param {object} rec\n         * @returns {string||null}\n         * @private\n         */\n        _getKey: function(rec) {\n          return angular.isObject(rec)? rec.$id : null;\n        },\n\n        /**\n         * Handles placement of recs in the array, sending notifications,\n         * and other internals.\n         *\n         * @param {string} event one of child_added, child_removed, child_moved, or child_changed\n         * @param {object} rec\n         * @param {string} [prevChild]\n         * @private\n         */\n        _process: function(event, rec, prevChild) {\n          var key = this._getKey(rec);\n          var changed = false;\n          var pos;\n          switch(event) {\n            case 'child_added':\n              pos = this.$indexFor(key);\n              break;\n            case 'child_moved':\n              pos = this.$indexFor(key);\n              this._spliceOut(key);\n              break;\n            case 'child_removed':\n              // remove record from the array\n              changed = this._spliceOut(key) !== null;\n              break;\n            case 'child_changed':\n              changed = true;\n              break;\n            default:\n              // nothing to do\n          }\n          if( angular.isDefined(pos) ) {\n            // add it to the array\n            changed = this._addAfter(rec, prevChild) !== pos;\n          }\n          if( changed ) {\n            // send notifications to anybody monitoring $watch\n            this._notify(event, key, prevChild);\n          }\n          return changed;\n        },\n\n        /**\n         * Used to trigger notifications for listeners registered using $watch\n         * @param {string} event\n         * @param {string} key\n         * @param {string} [prevChild]\n         * @private\n         */\n        _notify: function(event, key, prevChild) {\n          var eventData = {event: event, key: key};\n          if( angular.isDefined(prevChild) ) {\n            eventData.prevChild = prevChild;\n          }\n          angular.forEach(this._observers, function(parts) {\n            parts[0].call(parts[1], eventData);\n          });\n        },\n\n        /**\n         * Used to insert a new record into the array at a specific position. If prevChild is\n         * null, is inserted first, if prevChild is not found, it is inserted last, otherwise,\n         * it goes immediately after prevChild.\n         *\n         * @param {object} rec\n         * @param {string|null} prevChild\n         * @private\n         */\n        _addAfter: function(rec, prevChild) {\n          var i;\n          if( prevChild === null ) {\n            i = 0;\n          }\n          else {\n            i = this.$indexFor(prevChild)+1;\n            if( i === 0 ) { i = this.$list.length; }\n          }\n          this.$list.splice(i, 0, rec);\n          return i;\n        },\n\n        /**\n         * Removes a record from the array by calling splice. If the item is found\n         * this method returns it. Otherwise, this method returns null.\n         *\n         * @param {string} key\n         * @returns {object|null}\n         * @private\n         */\n        _spliceOut: function(key) {\n          var i = this.$indexFor(key);\n          if( i > -1 ) {\n            return this.$list.splice(i, 1)[0];\n          }\n          return null;\n        },\n\n        /**\n         * Resolves a variable which may contain an integer or an item that exists in this array.\n         * Returns the item or null if it does not exist.\n         *\n         * @param indexOrItem\n         * @returns {*}\n         * @private\n         */\n        _resolveItem: function(indexOrItem) {\n          var list = this.$list;\n          if( angular.isNumber(indexOrItem) && indexOrItem >= 0 && list.length >= indexOrItem ) {\n            return list[indexOrItem];\n          }\n          else if( angular.isObject(indexOrItem) ) {\n            var i = list.length;\n            while(i--) {\n              if( list[i] === indexOrItem ) {\n                return indexOrItem;\n              }\n            }\n          }\n          return null;\n        },\n\n        /**\n         * Throws an error if $destroy has been called. Should be used for any function\n         * which tries to write data back to $firebase.\n         * @param {string} method\n         * @private\n         */\n        _assertNotDestroyed: function(method) {\n          if( this._isDestroyed ) {\n            throw new Error('Cannot call ' + method + ' method on a destroyed $FirebaseArray object');\n          }\n        }\n      };\n\n      /**\n       * This method allows FirebaseArray to be copied into a new factory. Methods passed into this\n       * function will be added onto the array's prototype. They can override existing methods as\n       * well.\n       *\n       * In addition to passing additional methods, it is also possible to pass in a class function.\n       * The prototype on that class function will be preserved, and it will inherit from\n       * FirebaseArray. It's also possible to do both, passing a class to inherit and additional\n       * methods to add onto the prototype.\n       *\n       * Once a factory is obtained by this method, it can be passed into $firebase as the\n       * `arrayFactory` parameter:\n       * <pre><code>\n       * var MyFactory = $FirebaseArray.$extendFactory({\n       *    // add a method onto the prototype that sums all items in the array\n       *    getSum: function() {\n       *       var ct = 0;\n       *       angular.forEach(this.$list, function(rec) { ct += rec.x; });\n        *      return ct;\n       *    }\n       * });\n       *\n       * // use our new factory in place of $FirebaseArray\n       * var list = $firebase(ref, {arrayFactory: MyFactory}).$asArray();\n       * </code></pre>\n       *\n       * @param {Function} [ChildClass] a child class which should inherit FirebaseArray\n       * @param {Object} [methods] a list of functions to add onto the prototype\n       * @returns {Function} a new factory suitable for use with $firebase\n       */\n      FirebaseArray.$extendFactory = function(ChildClass, methods) {\n        if( arguments.length === 1 && angular.isObject(ChildClass) ) {\n          methods = ChildClass;\n          ChildClass = function() { return FirebaseArray.apply(this, arguments); };\n        }\n        return $firebaseUtils.inherit(ChildClass, FirebaseArray, methods);\n      };\n\n      return FirebaseArray;\n    }\n  ]);\n})();\n(function() {\n  'use strict';\n  /**\n   * Creates and maintains a synchronized boject. This constructor should not be\n   * manually invoked. Instead, one should create a $firebase object and call $asObject\n   * on it:  <code>$firebase( firebaseRef ).$asObject()</code>;\n   *\n   * Internally, the $firebase object depends on this class to provide 2 methods, which it invokes\n   * to notify the object whenever a change has been made at the server:\n   *    $$updated - called whenever a change occurs (a value event from Firebase)\n   *    $$error - called when listeners are canceled due to a security error\n   *\n   * Instead of directly modifying this class, one should generally use the $extendFactory\n   * method to add or change how methods behave:\n   *\n   * <pre><code>\n   * var NewFactory = $FirebaseObject.$extendFactory({\n   *    // add a new method to the prototype\n   *    foo: function() { return 'bar'; },\n   * });\n   * </code></pre>\n   *\n   * And then the new factory can be used by passing it as an argument:\n   * <code>$firebase( firebaseRef, {objectFactory: NewFactory}).$asObject();</code>\n   */\n  angular.module('firebase').factory('$FirebaseObject', [\n    '$parse', '$firebaseUtils', '$log', '$interval',\n    function($parse, $firebaseUtils, $log, $interval) {\n      /**\n       * This constructor should probably never be called manually. It is used internally by\n       * <code>$firebase.$asObject()</code>.\n       *\n       * @param $firebase\n       * @param {Function} destroyFn invoking this will cancel all event listeners and stop\n       *                   notifications from being delivered to $$updated and $$error\n       * @param readyPromise resolved when the initial data downloaded from Firebase\n       * @returns {FirebaseObject}\n       * @constructor\n       */\n      function FirebaseObject($firebase, destroyFn, readyPromise) {\n        // These are private config props and functions used internally\n        // they are collected here to reduce clutter in console.log and forEach\n        this.$$conf = {\n          promise: readyPromise,\n          inst: $firebase,\n          binding: new ThreeWayBinding(this),\n          destroyFn: destroyFn,\n          listeners: []\n        };\n\n        // this bit of magic makes $$conf non-enumerable and non-configurable\n        // and non-writable (its properties are still writable but the ref cannot be replaced)\n        // we declare it above so the IDE can relax\n        Object.defineProperty(this, '$$conf', {\n          value: this.$$conf\n        });\n\n        this.$id = $firebase.$ref().ref().name();\n        this.$priority = null;\n\n        $firebaseUtils.applyDefaults(this, this.$$defaults);\n      }\n\n      FirebaseObject.prototype = {\n        /**\n         * Saves all data on the FirebaseObject back to Firebase.\n         * @returns a promise which will resolve after the save is completed.\n         */\n        $save: function () {\n          var self = this;\n          return self.$inst().$set($firebaseUtils.toJSON(self))\n            .then(function(ref) {\n              self.$$notify();\n              return ref;\n            });\n        },\n\n        /**\n         * The loaded method is invoked after the initial batch of data arrives from the server.\n         * When this resolves, all data which existed prior to calling $asObject() is now cached\n         * locally in the object.\n         *\n         * As a shortcut is also possible to pass resolve/reject methods directly into this\n         * method just as they would be passed to .then()\n         *\n         * @param {Function} resolve\n         * @param {Function} reject\n         * @returns a promise which resolves after initial data is downloaded from Firebase\n         */\n        $loaded: function(resolve, reject) {\n          var promise = this.$$conf.promise;\n          if (arguments.length) {\n            // allow this method to be called just like .then\n            // by passing any arguments on to .then\n            promise = promise.then.call(promise, resolve, reject);\n          }\n          return promise;\n        },\n\n        /**\n         * @returns the original $firebase object used to create this object.\n         */\n        $inst: function () {\n          return this.$$conf.inst;\n        },\n\n        /**\n         * Creates a 3-way data sync between this object, the Firebase server, and a\n         * scope variable. This means that any changes made to the scope variable are\n         * pushed to Firebase, and vice versa.\n         *\n         * If scope emits a $destroy event, the binding is automatically severed. Otherwise,\n         * it is possible to unbind the scope variable by using the `unbind` function\n         * passed into the resolve method.\n         *\n         * Can only be bound to one scope variable at a time. If a second is attempted,\n         * the promise will be rejected with an error.\n         *\n         * @param {object} scope\n         * @param {string} varName\n         * @returns a promise which resolves to an unbind method after data is set in scope\n         */\n        $bindTo: function (scope, varName) {\n          var self = this;\n          return self.$loaded().then(function () {\n            return self.$$conf.binding.bindTo(scope, varName);\n          });\n        },\n\n        /**\n         * Listeners passed into this method are notified whenever a new change is received\n         * from the server. Each invocation is sent an object containing\n         * <code>{ type: 'updated', key: 'my_firebase_id' }</code>\n         *\n         * This method returns an unbind function that can be used to detach the listener.\n         *\n         * @param {Function} cb\n         * @param {Object} [context]\n         * @returns {Function} invoke to stop observing events\n         */\n        $watch: function (cb, context) {\n          var list = this.$$conf.listeners;\n          list.push([cb, context]);\n          // an off function for cancelling the listener\n          return function () {\n            var i = list.findIndex(function (parts) {\n              return parts[0] === cb && parts[1] === context;\n            });\n            if (i > -1) {\n              list.splice(i, 1);\n            }\n          };\n        },\n\n        /**\n         * Informs $firebase to stop sending events and clears memory being used\n         * by this object (delete's its local content).\n         */\n        $destroy: function (err) {\n          var self = this;\n          if (!self.$isDestroyed) {\n            self.$isDestroyed = true;\n            self.$$conf.binding.destroy();\n            $firebaseUtils.each(self, function (v, k) {\n              delete self[k];\n            });\n            self.$$conf.destroyFn(err);\n          }\n        },\n\n        /**\n         * Called by $firebase whenever an item is changed at the server.\n         * This method must exist on any objectFactory passed into $firebase.\n         *\n         * @param snap\n         */\n        $$updated: function (snap) {\n          // applies new data to this object\n          var changed = $firebaseUtils.updateRec(this, snap);\n          $firebaseUtils.applyDefaults(this, this.$$defaults);\n          if( changed ) {\n            // notifies $watch listeners and\n            // updates $scope if bound to a variable\n            this.$$notify();\n          }\n        },\n\n        /**\n         * Called whenever a security error or other problem causes the listeners to become\n         * invalid. This is generally an unrecoverable error.\n         * @param {Object} err which will have a `code` property and possibly a `message`\n         */\n        $$error: function (err) {\n          // prints an error to the console (via Angular's logger)\n          $log.error(err);\n          // frees memory and cancels any remaining listeners\n          this.$destroy(err);\n        },\n\n        /**\n         * Called internally by $bindTo when data is changed in $scope.\n         * Should apply updates to this record but should not call\n         * notify().\n         */\n        $$scopeUpdated: function(newData) {\n          // we use a one-directional loop to avoid feedback with 3-way bindings\n          // since set() is applied locally anyway, this is still performant\n          return this.$inst().$set($firebaseUtils.toJSON(newData));\n        },\n\n        /**\n         * Updates any bound scope variables and notifies listeners registered\n         * with $watch any time there is a change to data\n         */\n        $$notify: function() {\n          var self = this, list = this.$$conf.listeners.slice();\n          // be sure to do this after setting up data and init state\n          angular.forEach(list, function (parts) {\n            parts[0].call(parts[1], {event: 'value', key: self.$id});\n          });\n        },\n\n        /**\n         * Overrides how Angular.forEach iterates records on this object so that only\n         * fields stored in Firebase are part of the iteration. To include meta fields like\n         * $id and $priority in the iteration, utilize for(key in obj) instead.\n         */\n        forEach: function(iterator, context) {\n          return $firebaseUtils.each(this, iterator, context);\n        }\n      };\n\n      /**\n       * This method allows FirebaseObject to be copied into a new factory. Methods passed into this\n       * function will be added onto the object's prototype. They can override existing methods as\n       * well.\n       *\n       * In addition to passing additional methods, it is also possible to pass in a class function.\n       * The prototype on that class function will be preserved, and it will inherit from\n       * FirebaseObject. It's also possible to do both, passing a class to inherit and additional\n       * methods to add onto the prototype.\n       *\n       * Once a factory is obtained by this method, it can be passed into $firebase as the\n       * `objectFactory` parameter:\n       *\n       * <pre><code>\n       * var MyFactory = $FirebaseObject.$extendFactory({\n       *    // add a method onto the prototype that prints a greeting\n       *    getGreeting: function() {\n       *       return 'Hello ' + this.first_name + ' ' + this.last_name + '!';\n       *    }\n       * });\n       *\n       * // use our new factory in place of $FirebaseObject\n       * var obj = $firebase(ref, {objectFactory: MyFactory}).$asObject();\n       * </code></pre>\n       *\n       * @param {Function} [ChildClass] a child class which should inherit FirebaseObject\n       * @param {Object} [methods] a list of functions to add onto the prototype\n       * @returns {Function} a new factory suitable for use with $firebase\n       */\n      FirebaseObject.$extendFactory = function(ChildClass, methods) {\n        if( arguments.length === 1 && angular.isObject(ChildClass) ) {\n          methods = ChildClass;\n          ChildClass = function() { FirebaseObject.apply(this, arguments); };\n        }\n        return $firebaseUtils.inherit(ChildClass, FirebaseObject, methods);\n      };\n\n      /**\n       * Creates a three-way data binding on a scope variable.\n       *\n       * @param {FirebaseObject} rec\n       * @returns {*}\n       * @constructor\n       */\n      function ThreeWayBinding(rec) {\n        this.subs = [];\n        this.scope = null;\n        this.name = null;\n        this.rec = rec;\n      }\n\n      ThreeWayBinding.prototype = {\n        assertNotBound: function(varName) {\n          if( this.scope ) {\n            var msg = 'Cannot bind to ' + varName + ' because this instance is already bound to ' +\n              this.name + '; one binding per instance ' +\n              '(call unbind method or create another $firebase instance)';\n            $log.error(msg);\n            return $firebaseUtils.reject(msg);\n          }\n        },\n\n        bindTo: function(scope, varName) {\n          function _bind(self) {\n            var sending = false;\n            var parsed = $parse(varName);\n            var rec = self.rec;\n            self.scope = scope;\n            self.varName = varName;\n\n            function equals(rec) {\n              var parsed = getScope();\n              var newData = $firebaseUtils.scopeData(rec);\n              return angular.equals(parsed, newData) &&\n                parsed.$priority === rec.$priority &&\n                parsed.$value === rec.$value;\n            }\n\n            function getScope() {\n              return $firebaseUtils.scopeData(parsed(scope));\n            }\n\n            function setScope(rec) {\n              parsed.assign(scope, $firebaseUtils.scopeData(rec));\n            }\n\n            var scopeUpdated = function() {\n              var send = $firebaseUtils.debounce(function() {\n                rec.$$scopeUpdated(getScope())\n                  ['finally'](function() { sending = false; });\n              }, 50, 500);\n              if( !equals(rec) ) {\n                sending = true;\n                send();\n              }\n            };\n\n            var recUpdated = function() {\n              if( !sending && !equals(rec) ) {\n                setScope(rec);\n              }\n            };\n\n            // $watch will not check any vars prefixed with $, so we\n            // manually check $priority and $value using this method\n            function checkMetaVars() {\n              var dat = parsed(scope);\n              if( dat.$value !== rec.$value || dat.$priority !== rec.$priority ) {\n                scopeUpdated();\n              }\n            }\n\n            // Okay, so this magic hack is um... magic. It increments a\n            // variable every 50 seconds (counterKey) so that whenever $digest\n            // is run, the variable will be dirty. This allows us to determine\n            // when $digest is invoked, manually check the meta vars, and\n            // manually invoke our watcher if the $ prefixed data has changed\n            (function() {\n              // create a counter and store it in scope\n              var counterKey = '_firebaseCounterForVar'+varName;\n              scope[counterKey] = 0;\n              // update the counter every 51ms\n              // why 51? because it must be greater than scopeUpdated's debounce\n              // or protractor has a conniption\n              var to = $interval(function() {\n                scope[counterKey]++;\n              }, 51, 0, false);\n              // watch the counter for changes (which means $digest ran)\n              self.subs.push(scope.$watch(counterKey, checkMetaVars));\n              // cancel our interval and clear var from scope if unbound\n              self.subs.push(function() {\n                $interval.cancel(to);\n                delete scope[counterKey];\n              });\n            })();\n\n            setScope(rec);\n            self.subs.push(scope.$on('$destroy', self.unbind.bind(self)));\n\n            // monitor scope for any changes\n            self.subs.push(scope.$watch(varName, scopeUpdated, true));\n\n            // monitor the object for changes\n            self.subs.push(rec.$watch(recUpdated));\n\n            return self.unbind.bind(self);\n          }\n\n          return this.assertNotBound(varName) || _bind(this);\n        },\n\n        unbind: function() {\n          if( this.scope ) {\n            angular.forEach(this.subs, function(unbind) {\n              unbind();\n            });\n            this.subs = [];\n            this.scope = null;\n            this.name = null;\n          }\n        },\n\n        destroy: function() {\n          this.unbind();\n          this.rec = null;\n        }\n      };\n\n      return FirebaseObject;\n    }\n  ]);\n})();\n(function() {\n  'use strict';\n\n  angular.module(\"firebase\")\n\n    // The factory returns an object containing the value of the data at\n    // the Firebase location provided, as well as several methods. It\n    // takes one or two arguments:\n    //\n    //   * `ref`: A Firebase reference. Queries or limits may be applied.\n    //   * `config`: An object containing any of the advanced config options explained in API docs\n    .factory(\"$firebase\", [ \"$firebaseUtils\", \"$firebaseConfig\",\n      function ($firebaseUtils, $firebaseConfig) {\n        function AngularFire(ref, config) {\n          // make the new keyword optional\n          if (!(this instanceof AngularFire)) {\n            return new AngularFire(ref, config);\n          }\n          this._config = $firebaseConfig(config);\n          this._ref = ref;\n          this._arraySync = null;\n          this._objectSync = null;\n          this._assertValidConfig(ref, this._config);\n        }\n\n        AngularFire.prototype = {\n          $ref: function () {\n            return this._ref;\n          },\n\n          $push: function (data) {\n            var def = $firebaseUtils.defer();\n            var ref = this._ref.ref().push();\n            var done = this._handle(def, ref);\n            if (arguments.length > 0) {\n              ref.set(data, done);\n            }\n            else {\n              done();\n            }\n            return def.promise;\n          },\n\n          $set: function (key, data) {\n            var ref = this._ref;\n            var def = $firebaseUtils.defer();\n            if (arguments.length > 1) {\n              ref = ref.ref().child(key);\n            }\n            else {\n              data = key;\n            }\n            if( angular.isFunction(ref.set) || !angular.isObject(data) ) {\n              // this is not a query, just do a flat set\n              ref.ref().set(data, this._handle(def, ref));\n            }\n            else {\n              var dataCopy = angular.extend({}, data);\n              // this is a query, so we will replace all the elements\n              // of this query with the value provided, but not blow away\n              // the entire Firebase path\n              ref.once('value', function(snap) {\n                snap.forEach(function(ss) {\n                  if( !dataCopy.hasOwnProperty(ss.name()) ) {\n                    dataCopy[ss.name()] = null;\n                  }\n                });\n                ref.ref().update(dataCopy, this._handle(def, ref));\n              }, this);\n            }\n            return def.promise;\n          },\n\n          $remove: function (key) {\n            var ref = this._ref, self = this, promise;\n            var def = $firebaseUtils.defer();\n            if (arguments.length > 0) {\n              ref = ref.ref().child(key);\n            }\n            if( angular.isFunction(ref.remove) ) {\n              // self is not a query, just do a flat remove\n              ref.remove(self._handle(def, ref));\n              promise = def.promise;\n            }\n            else {\n              var promises = [];\n              // self is a query so let's only remove the\n              // items in the query and not the entire path\n              ref.once('value', function(snap) {\n                snap.forEach(function(ss) {\n                  var d = $firebaseUtils.defer();\n                  promises.push(d);\n                  ss.ref().remove(self._handle(d, ss.ref()));\n                }, self);\n              });\n              promise = $firebaseUtils.allPromises(promises)\n                .then(function() {\n                  return ref;\n                });\n            }\n            return promise;\n          },\n\n          $update: function (key, data) {\n            var ref = this._ref.ref();\n            var def = $firebaseUtils.defer();\n            if (arguments.length > 1) {\n              ref = ref.child(key);\n            }\n            else {\n              data = key;\n            }\n            ref.update(data, this._handle(def, ref));\n            return def.promise;\n          },\n\n          $transaction: function (key, valueFn, applyLocally) {\n            var ref = this._ref.ref();\n            if( angular.isFunction(key) ) {\n              applyLocally = valueFn;\n              valueFn = key;\n            }\n            else {\n              ref = ref.child(key);\n            }\n            applyLocally = !!applyLocally;\n\n            var def = $firebaseUtils.defer();\n            ref.transaction(valueFn, function(err, committed, snap) {\n               if( err ) {\n                 def.reject(err);\n               }\n               else {\n                 def.resolve(committed? snap : null);\n               }\n            }, applyLocally);\n            return def.promise;\n          },\n\n          $asObject: function () {\n            if (!this._objectSync || this._objectSync.isDestroyed) {\n              this._objectSync = new SyncObject(this, this._config.objectFactory);\n            }\n            return this._objectSync.getObject();\n          },\n\n          $asArray: function () {\n            if (!this._arraySync || this._arraySync.isDestroyed) {\n              this._arraySync = new SyncArray(this, this._config.arrayFactory);\n            }\n            return this._arraySync.getArray();\n          },\n\n          _handle: function (def) {\n            var args = Array.prototype.slice.call(arguments, 1);\n            return function (err) {\n              if (err) {\n                def.reject(err);\n              }\n              else {\n                def.resolve.apply(def, args);\n              }\n            };\n          },\n\n          _assertValidConfig: function (ref, cnf) {\n            $firebaseUtils.assertValidRef(ref, 'Must pass a valid Firebase reference ' +\n              'to $firebase (not a string or URL)');\n            if (!angular.isFunction(cnf.arrayFactory)) {\n              throw new Error('config.arrayFactory must be a valid function');\n            }\n            if (!angular.isFunction(cnf.objectFactory)) {\n              throw new Error('config.objectFactory must be a valid function');\n            }\n          }\n        };\n\n        function SyncArray($inst, ArrayFactory) {\n          function destroy(err) {\n            self.isDestroyed = true;\n            var ref = $inst.$ref();\n            ref.off('child_added', created);\n            ref.off('child_moved', moved);\n            ref.off('child_changed', updated);\n            ref.off('child_removed', removed);\n            array = null;\n            resolve(err||'destroyed');\n          }\n\n          function init() {\n            var ref = $inst.$ref();\n\n            // listen for changes at the Firebase instance\n            ref.on('child_added', created, error);\n            ref.on('child_moved', moved, error);\n            ref.on('child_changed', updated, error);\n            ref.on('child_removed', removed, error);\n\n            // determine when initial load is completed\n            ref.once('value', function() { resolve(null); }, resolve);\n          }\n\n          // call resolve(), do not call this directly\n          function _resolveFn(err) {\n            if( def ) {\n              if( err ) { def.reject(err); }\n              else { def.resolve(array); }\n              def = null;\n            }\n          }\n\n          function assertArray(arr) {\n            if( !angular.isArray(arr) ) {\n              var type = Object.prototype.toString.call(arr);\n              throw new Error('arrayFactory must return a valid array that passes ' +\n                'angular.isArray and Array.isArray, but received \"' + type + '\"');\n            }\n          }\n\n          var def     = $firebaseUtils.defer();\n          var array   = new ArrayFactory($inst, destroy, def.promise);\n          var batch   = $firebaseUtils.batch();\n          var created = batch(array.$$added, array);\n          var updated = batch(array.$$updated, array);\n          var moved   = batch(array.$$moved, array);\n          var removed = batch(array.$$removed, array);\n          var error   = batch(array.$$error, array);\n          var resolve = batch(_resolveFn);\n\n          var self = this;\n          self.isDestroyed = false;\n          self.getArray = function() { return array; };\n\n          assertArray(array);\n          init();\n        }\n\n        function SyncObject($inst, ObjectFactory) {\n          function destroy(err) {\n            self.isDestroyed = true;\n            ref.off('value', applyUpdate);\n            obj = null;\n            resolve(err||'destroyed');\n          }\n\n          function init() {\n            ref.on('value', applyUpdate, error);\n            ref.once('value', function() { resolve(null); }, resolve);\n          }\n\n          // call resolve(); do not call this directly\n          function _resolveFn(err) {\n            if( def ) {\n              if( err ) { def.reject(err); }\n              else { def.resolve(obj); }\n              def = null;\n            }\n          }\n\n          var def = $firebaseUtils.defer();\n          var obj = new ObjectFactory($inst, destroy, def.promise);\n          var ref = $inst.$ref();\n          var batch = $firebaseUtils.batch();\n          var applyUpdate = batch(obj.$$updated, obj);\n          var error = batch(obj.$$error, obj);\n          var resolve = batch(_resolveFn);\n\n          var self = this;\n          self.isDestroyed = false;\n          self.getObject = function() { return obj; };\n          init();\n        }\n\n        return AngularFire;\n      }\n    ]);\n})();\n/* istanbul ignore next */\n(function() {\n  'use strict';\n  var AngularFireAuth;\n\n  // Defines the `$firebaseSimpleLogin` service that provides simple\n  // user authentication support for AngularFire.\n  angular.module(\"firebase\").factory(\"$firebaseSimpleLogin\", [\n    \"$q\", \"$timeout\", \"$rootScope\", function($q, $t, $rs) {\n      // The factory returns an object containing the authentication state\n      // of the current user. This service takes one argument:\n      //\n      //   * `ref`     : A Firebase reference.\n      //\n      // The returned object has the following properties:\n      //\n      //  * `user`: Set to \"null\" if the user is currently logged out. This\n      //    value will be changed to an object when the user successfully logs\n      //    in. This object will contain details of the logged in user. The\n      //    exact properties will vary based on the method used to login, but\n      //    will at a minimum contain the `id` and `provider` properties.\n      //\n      // The returned object will also have the following methods available:\n      // $login(), $logout(), $createUser(), $changePassword(), $removeUser(),\n      // and $getCurrentUser().\n      return function(ref) {\n        var auth = new AngularFireAuth($q, $t, $rs, ref);\n        return auth.construct();\n      };\n    }\n  ]);\n\n  AngularFireAuth = function($q, $t, $rs, ref) {\n    this._q = $q;\n    this._timeout = $t;\n    this._rootScope = $rs;\n    this._loginDeferred = null;\n    this._getCurrentUserDeferred = [];\n    this._currentUserData = undefined;\n\n    if (typeof ref == \"string\") {\n      throw new Error(\"Please provide a Firebase reference instead \" +\n        \"of a URL, eg: new Firebase(url)\");\n    }\n    this._fRef = ref;\n  };\n\n  AngularFireAuth.prototype = {\n    construct: function() {\n      var object = {\n        user: null,\n        $login: this.login.bind(this),\n        $logout: this.logout.bind(this),\n        $createUser: this.createUser.bind(this),\n        $changePassword: this.changePassword.bind(this),\n        $removeUser: this.removeUser.bind(this),\n        $getCurrentUser: this.getCurrentUser.bind(this),\n        $sendPasswordResetEmail: this.sendPasswordResetEmail.bind(this)\n      };\n      this._object = object;\n\n      // Initialize Simple Login.\n      if (!window.FirebaseSimpleLogin) {\n        var err = new Error(\"FirebaseSimpleLogin is undefined. \" +\n          \"Did you forget to include firebase-simple-login.js?\");\n        this._rootScope.$broadcast(\"$firebaseSimpleLogin:error\", err);\n        throw err;\n      }\n\n      var client = new FirebaseSimpleLogin(this._fRef,\n        this._onLoginEvent.bind(this));\n      this._authClient = client;\n      return this._object;\n    },\n\n    // The login method takes a provider (for Simple Login) and authenticates\n    // the Firebase reference with which the service was initialized. This\n    // method returns a promise, which will be resolved when the login succeeds\n    // (and rejected when an error occurs).\n    login: function(provider, options) {\n      var deferred = this._q.defer();\n      var self = this;\n\n      // To avoid the promise from being fulfilled by our initial login state,\n      // make sure we have it before triggering the login and creating a new\n      // promise.\n      this.getCurrentUser().then(function() {\n        self._loginDeferred = deferred;\n        self._authClient.login(provider, options);\n      });\n\n      return deferred.promise;\n    },\n\n    // Unauthenticate the Firebase reference.\n    logout: function() {\n      // Tell the simple login client to log us out.\n      this._authClient.logout();\n\n      // Forget who we were, so that any getCurrentUser calls will wait for\n      // another user event.\n      delete this._currentUserData;\n    },\n\n    // Creates a user for Firebase Simple Login. Function 'cb' receives an\n    // error as the first argument and a Simple Login user object as the second\n    // argument. Note that this function only creates the user, if you wish to\n    // log in as the newly created user, call $login() after the promise for\n    // this method has been fulfilled.\n    createUser: function(email, password) {\n      var self = this;\n      var deferred = this._q.defer();\n\n      self._authClient.createUser(email, password, function(err, user) {\n        if (err) {\n          self._rootScope.$broadcast(\"$firebaseSimpleLogin:error\", err);\n          deferred.reject(err);\n        } else {\n          deferred.resolve(user);\n        }\n      });\n\n      return deferred.promise;\n    },\n\n    // Changes the password for a Firebase Simple Login user. Take an email,\n    // old password and new password as three mandatory arguments. Returns a\n    // promise.\n    changePassword: function(email, oldPassword, newPassword) {\n      var self = this;\n      var deferred = this._q.defer();\n\n      self._authClient.changePassword(email, oldPassword, newPassword,\n        function(err) {\n          if (err) {\n            self._rootScope.$broadcast(\"$firebaseSimpleLogin:error\", err);\n            deferred.reject(err);\n          } else {\n            deferred.resolve();\n          }\n        }\n      );\n\n      return deferred.promise;\n    },\n\n    // Gets a promise for the current user info.\n    getCurrentUser: function() {\n      var self = this;\n      var deferred = this._q.defer();\n\n      if (self._currentUserData !== undefined) {\n        deferred.resolve(self._currentUserData);\n      } else {\n        self._getCurrentUserDeferred.push(deferred);\n      }\n\n      return deferred.promise;\n    },\n\n    // Remove a user for the listed email address. Returns a promise.\n    removeUser: function(email, password) {\n      var self = this;\n      var deferred = this._q.defer();\n\n      self._authClient.removeUser(email, password, function(err) {\n        if (err) {\n          self._rootScope.$broadcast(\"$firebaseSimpleLogin:error\", err);\n          deferred.reject(err);\n        } else {\n          deferred.resolve();\n        }\n      });\n\n      return deferred.promise;\n    },\n\n    // Send a password reset email to the user for an email + password account.\n    sendPasswordResetEmail: function(email) {\n      var self = this;\n      var deferred = this._q.defer();\n\n      self._authClient.sendPasswordResetEmail(email, function(err) {\n        if (err) {\n          self._rootScope.$broadcast(\"$firebaseSimpleLogin:error\", err);\n          deferred.reject(err);\n        } else {\n          deferred.resolve();\n        }\n      });\n\n      return deferred.promise;\n    },\n\n    // Internal callback for any Simple Login event.\n    _onLoginEvent: function(err, user) {\n      // HACK -- calls to logout() trigger events even if we're not logged in,\n      // making us get extra events. Throw them away. This should be fixed by\n      // changing Simple Login so that its callbacks refer directly to the\n      // action that caused them.\n      if (this._currentUserData === user && err === null) {\n        return;\n      }\n\n      var self = this;\n      if (err) {\n        if (self._loginDeferred) {\n          self._loginDeferred.reject(err);\n          self._loginDeferred = null;\n        }\n        self._rootScope.$broadcast(\"$firebaseSimpleLogin:error\", err);\n      } else {\n        this._currentUserData = user;\n\n        self._timeout(function() {\n          self._object.user = user;\n          if (user) {\n            self._rootScope.$broadcast(\"$firebaseSimpleLogin:login\", user);\n          } else {\n            self._rootScope.$broadcast(\"$firebaseSimpleLogin:logout\");\n          }\n          if (self._loginDeferred) {\n            self._loginDeferred.resolve(user);\n            self._loginDeferred = null;\n          }\n          while (self._getCurrentUserDeferred.length > 0) {\n            var def = self._getCurrentUserDeferred.pop();\n            def.resolve(user);\n          }\n        });\n      }\n    }\n  };\n})();\n'use strict';\n\n// Shim Array.indexOf for IE compatibility.\nif (!Array.prototype.indexOf) {\n  Array.prototype.indexOf = function (searchElement, fromIndex) {\n    if (this === undefined || this === null) {\n      throw new TypeError(\"'this' is null or not defined\");\n    }\n    // Hack to convert object.length to a UInt32\n    // jshint -W016\n    var length = this.length >>> 0;\n    fromIndex = +fromIndex || 0;\n    // jshint +W016\n\n    if (Math.abs(fromIndex) === Infinity) {\n      fromIndex = 0;\n    }\n\n    if (fromIndex < 0) {\n      fromIndex += length;\n      if (fromIndex < 0) {\n        fromIndex = 0;\n      }\n    }\n\n    for (;fromIndex < length; fromIndex++) {\n      if (this[fromIndex] === searchElement) {\n        return fromIndex;\n      }\n    }\n\n    return -1;\n  };\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind\nif (!Function.prototype.bind) {\n  Function.prototype.bind = function (oThis) {\n    if (typeof this !== \"function\") {\n      // closest thing possible to the ECMAScript 5\n      // internal IsCallable function\n      throw new TypeError(\"Function.prototype.bind - what is trying to be bound is not callable\");\n    }\n\n    var aArgs = Array.prototype.slice.call(arguments, 1),\n      fToBind = this,\n      fNOP = function () {},\n      fBound = function () {\n        return fToBind.apply(this instanceof fNOP && oThis\n            ? this\n            : oThis,\n          aArgs.concat(Array.prototype.slice.call(arguments)));\n      };\n\n    fNOP.prototype = this.prototype;\n    fBound.prototype = new fNOP();\n\n    return fBound;\n  };\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex\nif (!Array.prototype.findIndex) {\n  Object.defineProperty(Array.prototype, 'findIndex', {\n    enumerable: false,\n    configurable: true,\n    writable: true,\n    value: function(predicate) {\n      if (this == null) {\n        throw new TypeError('Array.prototype.find called on null or undefined');\n      }\n      if (typeof predicate !== 'function') {\n        throw new TypeError('predicate must be a function');\n      }\n      var list = Object(this);\n      var length = list.length >>> 0;\n      var thisArg = arguments[1];\n      var value;\n\n      for (var i = 0; i < length; i++) {\n        if (i in list) {\n          value = list[i];\n          if (predicate.call(thisArg, value, i, list)) {\n            return i;\n          }\n        }\n      }\n      return -1;\n    }\n  });\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create\nif (typeof Object.create != 'function') {\n  (function () {\n    var F = function () {};\n    Object.create = function (o) {\n      if (arguments.length > 1) {\n        throw new Error('Second argument not supported');\n      }\n      if (o === null) {\n        throw new Error('Cannot set a null [[Prototype]]');\n      }\n      if (typeof o != 'object') {\n        throw new TypeError('Argument must be an object');\n      }\n      F.prototype = o;\n      return new F();\n    };\n  })();\n}\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\nif (!Object.keys) {\n  Object.keys = (function () {\n    'use strict';\n    var hasOwnProperty = Object.prototype.hasOwnProperty,\n      hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\n      dontEnums = [\n        'toString',\n        'toLocaleString',\n        'valueOf',\n        'hasOwnProperty',\n        'isPrototypeOf',\n        'propertyIsEnumerable',\n        'constructor'\n      ],\n      dontEnumsLength = dontEnums.length;\n\n    return function (obj) {\n      if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n        throw new TypeError('Object.keys called on non-object');\n      }\n\n      var result = [], prop, i;\n\n      for (prop in obj) {\n        if (hasOwnProperty.call(obj, prop)) {\n          result.push(prop);\n        }\n      }\n\n      if (hasDontEnumBug) {\n        for (i = 0; i < dontEnumsLength; i++) {\n          if (hasOwnProperty.call(obj, dontEnums[i])) {\n            result.push(dontEnums[i]);\n          }\n        }\n      }\n      return result;\n    };\n  }());\n}\n\n// http://ejohn.org/blog/objectgetprototypeof/\nif ( typeof Object.getPrototypeOf !== \"function\" ) {\n  if ( typeof \"test\".__proto__ === \"object\" ) {\n    Object.getPrototypeOf = function(object){\n      return object.__proto__;\n    };\n  } else {\n    Object.getPrototypeOf = function(object){\n      // May break if the constructor has been tampered with\n      return object.constructor.prototype;\n    };\n  }\n}\n\n(function() {\n  'use strict';\n\n  angular.module('firebase')\n    .factory('$firebaseConfig', [\"$FirebaseArray\", \"$FirebaseObject\", \"$injector\",\n      function($FirebaseArray, $FirebaseObject, $injector) {\n        return function(configOpts) {\n          // make a copy we can modify\n          var opts = angular.extend({}, configOpts);\n          // look up factories if passed as string names\n          if( typeof opts.objectFactory === 'string' ) {\n            opts.objectFactory = $injector.get(opts.objectFactory);\n          }\n          if( typeof opts.arrayFactory === 'string' ) {\n            opts.arrayFactory = $injector.get(opts.arrayFactory);\n          }\n          // extend defaults and return\n          return angular.extend({\n            arrayFactory: $FirebaseArray,\n            objectFactory: $FirebaseObject\n          }, opts);\n        };\n      }\n    ])\n\n    .factory('$firebaseUtils', [\"$q\", \"$timeout\", \"firebaseBatchDelay\",\n      function($q, $timeout, firebaseBatchDelay) {\n        var utils = {\n          /**\n           * Returns a function which, each time it is invoked, will pause for `wait`\n           * milliseconds before invoking the original `fn` instance. If another\n           * request is received in that time, it resets `wait` up until `maxWait` is\n           * reached.\n           *\n           * Unlike a debounce function, once wait is received, all items that have been\n           * queued will be invoked (not just once per execution). It is acceptable to use 0,\n           * which means to batch all synchronously queued items.\n           *\n           * The batch function actually returns a wrap function that should be called on each\n           * method that is to be batched.\n           *\n           * <pre><code>\n           *   var total = 0;\n           *   var batchWrapper = batch(10, 100);\n           *   var fn1 = batchWrapper(function(x) { return total += x; });\n           *   var fn2 = batchWrapper(function() { console.log(total); });\n           *   fn1(10);\n           *   fn2();\n           *   fn1(10);\n           *   fn2();\n           *   console.log(total); // 0 (nothing invoked yet)\n           *   // after 10ms will log \"10\" and then \"20\"\n           * </pre></code>\n           *\n           * @param {int} wait number of milliseconds to pause before sending out after each invocation\n           * @param {int} maxWait max milliseconds to wait before sending out, defaults to wait * 10 or 100\n           * @returns {Function}\n           */\n          batch: function(wait, maxWait) {\n            wait = typeof('wait') === 'number'? wait : firebaseBatchDelay;\n            if( !maxWait ) { maxWait = wait*10 || 100; }\n            var queue = [];\n            var start;\n            var cancelTimer;\n\n            // returns `fn` wrapped in a function that queues up each call event to be\n            // invoked later inside fo runNow()\n            function createBatchFn(fn, context) {\n               if( typeof(fn) !== 'function' ) {\n                 throw new Error('Must provide a function to be batched. Got '+fn);\n               }\n               return function() {\n                 var args = Array.prototype.slice.call(arguments, 0);\n                 queue.push([fn, context, args]);\n                 resetTimer();\n               };\n            }\n\n            // clears the current wait timer and creates a new one\n            // however, if maxWait is exceeded, calles runNow() immediately\n            function resetTimer() {\n              if( cancelTimer ) {\n                cancelTimer();\n                cancelTimer = null;\n              }\n              if( start && Date.now() - start > maxWait ) {\n                utils.compile(runNow);\n              }\n              else {\n                if( !start ) { start = Date.now(); }\n                cancelTimer = utils.wait(runNow, wait);\n              }\n            }\n\n            // Clears the queue and invokes all of the functions awaiting notification\n            function runNow() {\n              cancelTimer = null;\n              start = null;\n              var copyList = queue.slice(0);\n              queue = [];\n              angular.forEach(copyList, function(parts) {\n                parts[0].apply(parts[1], parts[2]);\n              });\n            }\n\n            return createBatchFn;\n          },\n\n          /**\n           * A rudimentary debounce method\n           * @param {function} fn the function to debounce\n           * @param {object} [ctx] the `this` context to set in fn\n           * @param {int} wait number of milliseconds to pause before sending out after each invocation\n           * @param {int} [maxWait] max milliseconds to wait before sending out, defaults to wait * 10 or 100\n           */\n          debounce: function(fn, ctx, wait, maxWait) {\n            var start, cancelTimer, args;\n            if( typeof(ctx) === 'number' ) {\n              maxWait = wait;\n              wait = ctx;\n              ctx = null;\n            }\n\n            if( typeof wait !== 'number' ) {\n              throw new Error('Must provide a valid integer for wait. Try 0 for a default');\n            }\n            if( typeof(fn) !== 'function' ) {\n              throw new Error('Must provide a valid function to debounce');\n            }\n            if( !maxWait ) { maxWait = wait*10 || 100; }\n\n            // clears the current wait timer and creates a new one\n            // however, if maxWait is exceeded, calles runNow() immediately\n            function resetTimer() {\n              if( cancelTimer ) {\n                cancelTimer();\n                cancelTimer = null;\n              }\n              if( start && Date.now() - start > maxWait ) {\n                utils.compile(runNow);\n              }\n              else {\n                if( !start ) { start = Date.now(); }\n                cancelTimer = utils.wait(runNow, wait);\n              }\n            }\n\n            // Clears the queue and invokes all of the functions awaiting notification\n            function runNow() {\n              cancelTimer = null;\n              start = null;\n              fn.apply(ctx, args);\n            }\n\n            function debounced() {\n              args = Array.prototype.slice.call(arguments, 0);\n              resetTimer();\n            }\n            debounced.running = function() {\n              return start > 0;\n            };\n\n            return debounced;\n          },\n\n          assertValidRef: function(ref, msg) {\n            if( !angular.isObject(ref) ||\n              typeof(ref.ref) !== 'function' ||\n              typeof(ref.ref().transaction) !== 'function' ) {\n              throw new Error(msg || 'Invalid Firebase reference');\n            }\n          },\n\n          // http://stackoverflow.com/questions/7509831/alternative-for-the-deprecated-proto\n          // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create\n          inherit: function(ChildClass, ParentClass, methods) {\n            var childMethods = ChildClass.prototype;\n            ChildClass.prototype = Object.create(ParentClass.prototype);\n            ChildClass.prototype.constructor = ChildClass; // restoring proper constructor for child class\n            angular.forEach(Object.keys(childMethods), function(k) {\n              ChildClass.prototype[k] = childMethods[k];\n            });\n            if( angular.isObject(methods) ) {\n              angular.extend(ChildClass.prototype, methods);\n            }\n            return ChildClass;\n          },\n\n          getPrototypeMethods: function(inst, iterator, context) {\n            var methods = {};\n            var objProto = Object.getPrototypeOf({});\n            var proto = angular.isFunction(inst) && angular.isObject(inst.prototype)?\n              inst.prototype : Object.getPrototypeOf(inst);\n            while(proto && proto !== objProto) {\n              for (var key in proto) {\n                // we only invoke each key once; if a super is overridden it's skipped here\n                if (proto.hasOwnProperty(key) && !methods.hasOwnProperty(key)) {\n                  methods[key] = true;\n                  iterator.call(context, proto[key], key, proto);\n                }\n              }\n              proto = Object.getPrototypeOf(proto);\n            }\n          },\n\n          getPublicMethods: function(inst, iterator, context) {\n            utils.getPrototypeMethods(inst, function(m, k) {\n              if( typeof(m) === 'function' && k.charAt(0) !== '_' ) {\n                iterator.call(context, m, k);\n              }\n            });\n          },\n\n          defer: function() {\n            return $q.defer();\n          },\n\n          reject: function(msg) {\n            var def = utils.defer();\n            def.reject(msg);\n            return def.promise;\n          },\n\n          resolve: function() {\n            var def = utils.defer();\n            def.resolve.apply(def, arguments);\n            return def.promise;\n          },\n\n          wait: function(fn, wait) {\n            var to = $timeout(fn, wait||0);\n            return function() {\n              if( to ) {\n                $timeout.cancel(to);\n                to = null;\n              }\n            };\n          },\n\n          compile: function(fn) {\n            return $timeout(fn||function() {});\n          },\n\n          deepCopy: function(obj) {\n            if( !angular.isObject(obj) ) { return obj; }\n            var newCopy = angular.isArray(obj) ? obj.slice() : angular.extend({}, obj);\n            for (var key in newCopy) {\n              if (newCopy.hasOwnProperty(key)) {\n                if (angular.isObject(newCopy[key])) {\n                  newCopy[key] = utils.deepCopy(newCopy[key]);\n                }\n              }\n            }\n            return newCopy;\n          },\n\n          trimKeys: function(dest, source) {\n            utils.each(dest, function(v,k) {\n              if( !source.hasOwnProperty(k) ) {\n                delete dest[k];\n              }\n            });\n          },\n\n          extendData: function(dest, source) {\n            utils.each(source, function(v,k) {\n              dest[k] = utils.deepCopy(v);\n            });\n            return dest;\n          },\n\n          scopeData: function(dataOrRec) {\n            var data = {\n              $id: dataOrRec.$id,\n              $priority: dataOrRec.$priority\n            };\n            if( dataOrRec.hasOwnProperty('$value') ) {\n              data.$value = dataOrRec.$value;\n            }\n            return utils.extendData(data, dataOrRec);\n          },\n\n          updateRec: function(rec, snap) {\n            var data = snap.val();\n            var oldData = angular.extend({}, rec);\n\n            // deal with primitives\n            if( !angular.isObject(data) ) {\n              rec.$value = data;\n              data = {};\n            }\n            else {\n              delete rec.$value;\n            }\n\n            // apply changes: remove old keys, insert new data, set priority\n            utils.trimKeys(rec, data);\n            angular.extend(rec, data);\n            rec.$priority = snap.getPriority();\n\n            return !angular.equals(oldData, rec) ||\n              oldData.$value !== rec.$value ||\n              oldData.$priority !== rec.$priority;\n          },\n\n          applyDefaults: function(rec, defaults) {\n            if( angular.isObject(defaults) ) {\n              angular.forEach(defaults, function(v,k) {\n                if( !rec.hasOwnProperty(k) ) {\n                  rec[k] = v;\n                }\n              });\n            }\n            return rec;\n          },\n\n          dataKeys: function(obj) {\n            var out = [];\n            utils.each(obj, function(v,k) {\n              out.push(k);\n            });\n            return out;\n          },\n\n          each: function(obj, iterator, context) {\n            if(angular.isObject(obj)) {\n              for (var k in obj) {\n                if (obj.hasOwnProperty(k)) {\n                  var c = k.charAt(0);\n                  if( c !== '_' && c !== '$' && c !== '.' ) {\n                    iterator.call(context, obj[k], k, obj);\n                  }\n                }\n              }\n            }\n            else if(angular.isArray(obj)) {\n              for(var i = 0, len = obj.length; i < len; i++) {\n                iterator.call(context, obj[i], i, obj);\n              }\n            }\n            return obj;\n          },\n\n          /**\n           * A utility for converting records to JSON objects\n           * which we can save into Firebase. It asserts valid\n           * keys and strips off any items prefixed with $.\n           *\n           * If the rec passed into this method has a toJSON()\n           * method, that will be used in place of the custom\n           * functionality here.\n           *\n           * @param rec\n           * @returns {*}\n           */\n          toJSON: function(rec) {\n            var dat;\n            if( !angular.isObject(rec) ) {\n              rec = {$value: rec};\n            }\n            if (angular.isFunction(rec.toJSON)) {\n              dat = rec.toJSON();\n            }\n            else {\n              dat = {};\n              utils.each(rec, function (v, k) {\n                dat[k] = stripDollarPrefixedKeys(v);\n              });\n            }\n            if( angular.isDefined(rec.$value) && Object.keys(dat).length === 0 && rec.$value !== null ) {\n              dat['.value'] = rec.$value;\n            }\n            if( angular.isDefined(rec.$priority) && Object.keys(dat).length > 0 && rec.$priority !== null ) {\n              dat['.priority'] = rec.$priority;\n            }\n            angular.forEach(dat, function(v,k) {\n              if (k.match(/[.$\\[\\]#\\/]/) && k !== '.value' && k !== '.priority' ) {\n                throw new Error('Invalid key ' + k + ' (cannot contain .$[]#)');\n              }\n              else if( angular.isUndefined(v) ) {\n                throw new Error('Key '+k+' was undefined. Cannot pass undefined in JSON. Use null instead.');\n              }\n            });\n            return dat;\n          },\n          batchDelay: firebaseBatchDelay,\n          allPromises: $q.all.bind($q)\n        };\n\n        return utils;\n      }\n    ]);\n\n    function stripDollarPrefixedKeys(data) {\n      if( !angular.isObject(data) ) { return data; }\n      var out = angular.isArray(data)? [] : {};\n      angular.forEach(data, function(v,k) {\n        if(typeof k !== 'string' || k.charAt(0) !== '$') {\n          out[k] = stripDollarPrefixedKeys(v);\n        }\n      });\n      return out;\n    }\n})();"
  },
  {
    "path": "www/lib/collide/.bower.json",
    "content": "{\n  \"name\": \"collide\",\n  \"version\": \"1.0.0-beta.1\",\n  \"main\": \"collide.js\",\n  \"ignore\": [\n    \"src\"\n  ],\n  \"dependencies\": {},\n  \"homepage\": \"https://github.com/driftyco/collide\",\n  \"_release\": \"1.0.0-beta.1\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.0.0-beta.1\",\n    \"commit\": \"bbc4a1c2b160181d4115c2c7369ae82243cbb475\"\n  },\n  \"_source\": \"git://github.com/driftyco/collide.git\",\n  \"_target\": \"1.0.0-beta.1\",\n  \"_originalSource\": \"collide\"\n}"
  },
  {
    "path": "www/lib/collide/.gitignore",
    "content": "# Logs\nlogs\n*.log\n\n# Runtime data\npids\n*.pid\n*.seed\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Compiled binary addons (http://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directory\n# Commenting this out is preferred by some people, see\n# https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git\nnode_modules\nbower_components\n\n# Users Environment Variables\n.lock-wscript\n\n# Built files\ndist\n"
  },
  {
    "path": "www/lib/collide/README.md",
    "content": "Collide\n--------\n\nCollide is a powerful yet simple javascript animation engine for web and hybrid mobile apps, inspired by [Facebook Pop](https://github.com/facebook/pop), built by the [Ionic Framework](http://ionicframework.com/) team.\n\nAnimations in Collide have more power and control than CSS animations or transitions, all without sacrificing performance.\n\nCollide allows the user to pause, play, reverse, repeat, and skip to any part of an animation at any time, and has support for non-cubic bezier curves, enabling powerful Physics animations (Springs, Gravity, and Velocity) without the complexity of a full-fledged physics engine.\n\nWe built Collide because we wanted to give Ionic developers the power to build complicated animation and gesture driven mobile apps with HTML5 and Javascript, something that wasn't possible before.\n\nCollide solves the problems with CSS animations using a simple Javascript animation engine and API. It also provides a tweening API similar to WebAnimations, and allows the developer to hook into every frame for full control over the behavior of the animation.\n\nComing Soon:\n\n- Animation decay. Set a velocity on an animation and let it decelerate to a certain point.\n\n### Development\n\n- `npm install`\n- `npm install -g browserify`\n- `npm run test` runs jasmine-node tests. `npm run autotest` will watch and test\n- `npm run build`\n- Generated file `dist/collide.js` is require/CommonJS/window friendly. If you include it, it will be included as `window.collide`.\n- Note: the `collide.js` found in project root is only updated on release. The built version in dist is not added to git and should be used while developing.\n\n### API\n\n**This is in flux, better documentation coming after API is stable**\n\n```js\nvar animator = collide.animator({\n  // 'linear|ease|ease-in|ease-out|ease-in-out|cubic-bezer(x1,y1,x2,y2)',\n  // or function(t, duration),\n  // or a dynamics configuration (see below)\n  easing: 'ease-in-out', \n  duration: 1000,\n  percent: 0,\n  reverse: false\n});\n\n// Actions, all of these return `this` and are chainable\n// .on('step' callback is given a 'percent', 0-1, as argument (for springs it could be outside 0-1 range)\n// .on('stop' callback is given a boolean, wasCompleted\nanimator.on(/step|destroy|start|stop|complete/, function() {})\nanimator.once(...) //same event types\nanimator.off(...) //works like jquery.off\nanimator.stop(); //stop/pause at current position\nanimator.start(); //start from current position\nanimator.restrart(); //start over\nanimator.destroy(); //unbind all events & deallocate\n\nanimator.isRunning(); //boolean getter\n\n//These are getters and setters.\n//No arguments is a getter, argument is a chainable setter.\nanimator.percent(newPercent); //0-1\nanimator.duration(duration); //milliseconds\nanimator.reverse(isReverse);\nanimator.easing(easing); //setter, string|function(t,duration)|dynamicsConfiguration.\n// Dynamics configuration looks like this one of these:\n// animator.easing({\n//   type: 'spring',\n//   frequency: 15,\n//   friction: 200,\n//   initialForce: false\n// });\n// animator.easing({\n//   type: 'gravity',\n//   frequency: 15,\n//   friction: 200,\n//   initialForce: false\n// });\n\n```\n\n### Examples\n\nSee test.html.\n\n```js\nvar animator = collide.animator({\n  duration: 1000,\n  easing: 'ease-in-out'\n})\n  .on('step', function(v) {\n    //Have the element spring over 400px\n    myElement.css('webkitTransform', 'translateX(' + (v*400) + 'px)');\n  })\n  .start();\n```\n"
  },
  {
    "path": "www/lib/collide/bower.json",
    "content": "{\n  \"name\": \"collide\",\n  \"version\": \"1.0.0-beta.1\",\n  \"main\": \"collide.js\",\n  \"ignore\": [\n    \"src\"\n  ],\n  \"dependencies\": {}\n}\n"
  },
  {
    "path": "www/lib/collide/collide.js",
    "content": "!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.collide=e()}}(function(){var define,module,exports;return (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);throw new Error(\"Cannot find module '\"+o+\"'\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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(_dereq_,module,exports){\n(function (process){\n// Generated by CoffeeScript 1.6.3\n(function() {\n  var getNanoSeconds, hrtime, loadTime;\n\n  if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n    module.exports = function() {\n      return performance.now();\n    };\n  } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n    module.exports = function() {\n      return (getNanoSeconds() - loadTime) / 1e6;\n    };\n    hrtime = process.hrtime;\n    getNanoSeconds = function() {\n      var hr;\n      hr = hrtime();\n      return hr[0] * 1e9 + hr[1];\n    };\n    loadTime = getNanoSeconds();\n  } else if (Date.now) {\n    module.exports = function() {\n      return Date.now() - loadTime;\n    };\n    loadTime = Date.now();\n  } else {\n    module.exports = function() {\n      return new Date().getTime() - loadTime;\n    };\n    loadTime = new Date().getTime();\n  }\n\n}).call(this);\n\n/*\n//@ sourceMappingURL=performance-now.map\n*/\n\n}).call(this,_dereq_(\"qhDIRT\"))\n},{\"qhDIRT\":13}],2:[function(_dereq_,module,exports){\nvar now = _dereq_('performance-now')\n  , global = typeof window === 'undefined' ? {} : window\n  , vendors = ['moz', 'webkit']\n  , suffix = 'AnimationFrame'\n  , raf = global['request' + suffix]\n  , caf = global['cancel' + suffix] || global['cancelRequest' + suffix]\n\nfor(var i = 0; i < vendors.length && !raf; i++) {\n  raf = global[vendors[i] + 'Request' + suffix]\n  caf = global[vendors[i] + 'Cancel' + suffix]\n      || global[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n  var last = 0\n    , id = 0\n    , queue = []\n    , frameDuration = 1000 / 60\n\n  raf = function(callback) {\n    if(queue.length === 0) {\n      var _now = now()\n        , next = Math.max(0, frameDuration - (_now - last))\n      last = next + _now\n      setTimeout(function() {\n        var cp = queue.slice(0)\n        // Clear queue here to prevent\n        // callbacks from appending listeners\n        // to the current frame's queue\n        queue.length = 0\n        for (var i = 0; i < cp.length; i++) {\n          if (!cp[i].cancelled) {\n            cp[i].callback(last)\n          }\n        }\n      }, next)\n    }\n    queue.push({\n      handle: ++id,\n      callback: callback,\n      cancelled: false\n    })\n    return id\n  }\n\n  caf = function(handle) {\n    for(var i = 0; i < queue.length; i++) {\n      if(queue[i].handle === handle) {\n        queue[i].cancelled = true\n      }\n    }\n  }\n}\n\nmodule.exports = function() {\n  // Wrap in a new function to prevent\n  // `cancel` potentially being assigned\n  // to the native rAF function\n  return raf.apply(global, arguments)\n}\nmodule.exports.cancel = function() {\n  caf.apply(global, arguments)\n}\n\n},{\"performance-now\":3}],3:[function(_dereq_,module,exports){\nmodule.exports=_dereq_(1)\n},{\"qhDIRT\":13}],4:[function(_dereq_,module,exports){\n\n// Interpolation disabled for now\n// var interpolate = require('./core/interpolate');\n// var cssFeature = require('feature/css');\n\nvar timeline = _dereq_('./core/timeline');\nvar dynamics = _dereq_('./core/dynamics');\nvar easingFunctions = _dereq_('./core/easing-functions');\n\nvar uid = _dereq_('./util/uid');\nvar EventEmitter = _dereq_('./util/simple-emitter');\n\nfunction clamp(min, n, max) { return Math.max(min, Math.min(n, max)); }\n\nmodule.exports = Animator;\n\nfunction Animator(opts) {\n  //if `new` keyword isn't provided, do it for user\n  if (!(this instanceof Animator)) {\n    return new Animator(opts);\n  }\n\n  opts = opts || {};\n\n  //Private state goes in this._\n  this._ = {\n    id: uid(),\n    percent: 0,\n    duration: 500,\n    isReverse: false\n  };\n\n  var emitter = this._.emitter = new EventEmitter();\n  this._.onDestroy = function() {\n    emitter.emit('destroy');\n  };\n  this._.onStop = function(wasCompleted) {\n    emitter.emit('stop', wasCompleted);\n    wasCompleted && emitter.emit('complete');\n  };\n  this._.onStart = function() {\n    emitter.emit('start');\n  };\n  this._.onStep = function(v) {\n    emitter.emit('step', v);\n  };\n\n  opts.duration && this.duration(opts.duration);\n  opts.percent && this.percent(opts.percent);\n  opts.easing && this.easing(opts.easing);\n  opts.reverse && this.reverse(opts.reverse);\n}\n\nAnimator.prototype = {\n\n  reverse: function(reverse) {\n    if (arguments.length) {\n      this._.isReverse = !!reverse;\n      return this;\n    }\n    return this._.isReverse;\n  },\n\n  easing: function(easing) {\n    var type = typeof easing;\n    if (arguments.length) {\n      if (type === 'function' || type === 'string' || type === 'object') {\n        this._.easing = figureOutEasing(easing);\n      }\n      return this;\n    }\n    return this._.easing;\n  },\n\n  percent: function(percent) {\n    if (arguments.length) {\n      if (typeof percent === 'number') {\n        this._.percent = clamp(0, percent, 1);\n      }\n      if (!this.isRunning()) {\n        this._.onStep(this._getValueForPercent(this._.percent));\n      }\n      return this;\n    }\n    return this._.percent;\n  },\n\n  duration: function(duration) {\n    if (arguments.length) {\n      if (typeof duration === 'number' && duration > 0) {\n        this._.duration = duration;\n      }\n      return this;\n    }\n    return this._.duration;\n  },\n\n  /**\n   * Interpolation is disabled for now.\n   */\n  // addInterpolation: function(el, startingStyles, endingStyles) {\n  //   var interpolators;\n  //   if (arguments.length) {\n  //     syncStyles(startingStyles, endingStyles, window.getComputedStyle(el));\n  //     interpolators = makePropertyInterpolators(startingStyles, endingStyles);\n\n  //     this.on('step', setStyles);\n  //     return function unbind() {\n  //       this.off('step', setStyles);\n  //     };\n  //   }\n  //   function setStyles(v) {\n  //     for (var property in interpolators) {\n  //       el.style[property] = interpolators[property](v);\n  //     }\n  //   }\n  // },\n\n  isRunning: function() { \n    return !!this._.isRunning; \n  },\n\n  promise: function() {\n    var self = this;\n    return {\n      then: function(cb) {\n        self.once('stop', cb);\n      }\n    };\n  },\n\n  on: function(eventType, listener) {\n    this._.emitter.on(eventType, listener);\n    return this;\n  },\n  once: function(eventType, listener) {\n    this._.emitter.once(eventType, listener);\n    return this;\n  },\n  off: function(eventType, listener) {\n    this._.emitter.off(eventType, listener);\n    return this;\n  },\n\n  destroy: function() {\n    this.stop();\n    this._.onDestroy();\n    this.off();\n    return this;\n  },\n\n  stop: function() {\n    if (!this._.isRunning) return;\n\n    this._.isRunning = false;\n    timeline.animationStopped(this);\n\n    this._.onStop(this._isComplete());\n    return this;\n  },\n\n  restart: function(immediate) {\n    if (this._.isRunning) return;\n\n    this._.percent = this._getStartPercent();\n\n    return this.start(!!immediate);\n  },\n\n  start: function(immediate) {\n    if (this._.isRunning) return;\n\n    if (immediate) {\n      this._.onStep(this._getValueForPercent(this._.percent));\n    } else {\n      this._.isStarting = true;\n    }\n\n    this._.isRunning = true;\n    timeline.animationStarted(this);\n\n    this._.onStart();\n    return this;\n  },\n\n  _isComplete: function() {\n    return !this._.isRunning && \n      this._.percent === this._getEndPercent();\n  },\n  _getEndPercent: function() {\n    return this._.isReverse ? 0 : 1;\n  },\n  _getStartPercent: function() {\n    return this._.isReverse ? 1 : 0;\n  },\n\n  _getValueForPercent: function(percent) {\n    if (this._.easing) {\n      return this._.easing(percent, this._.duration);\n    }\n    return percent;\n  },\n\n  _tick: function(deltaT) {\n    var state = this._;\n\n    //First tick, don't up the percent\n    if (state.isStarting) {\n      state.isStarting = false;\n    } else if (state.isReverse) {\n      state.percent = Math.max(0, state.percent - (deltaT / state.duration));\n    } else {\n      state.percent = Math.min(1, state.percent + (deltaT / state.duration));\n    }\n    \n    state.onStep(this._getValueForPercent(state.percent));\n\n    if (state.percent === this._getEndPercent()) {\n      this.stop();\n    }\n  },\n\n};\n\nfunction figureOutEasing(easing) {\n  if (typeof easing === 'object') {\n    var dynamicType = typeof easing.type === 'string' &&\n      easing.type.toLowerCase().trim();\n\n    if (!dynamics[dynamicType]) {\n      throw new Error(\n        'Invalid easing dynamics object type \"' + easing.type + '\". ' +\n        'Available dynamics types: ' + Object.keys(dynamics).join(', ') + '.'\n      );\n    }\n    return dynamics[dynamicType](easing);\n\n  } else if (typeof easing === 'string') {\n    easing = easing.toLowerCase().trim();\n    \n    if (easing.indexOf('cubic-bezier(') === 0) {\n      var parts = easing\n        .replace('cubic-bezier(', '')\n        .replace(')', '')\n        .split(',')\n        .map(function(v) {\n          return v.trim();\n        });\n      return easingFunctions['cubic-bezier'](parts[0], parts[1], parts[2], parts[3]);\n    } else {\n      var fn = easingFunctions[easing];\n      if (!fn) {\n        throw new Error(\n          'Invalid easing function \"' + easing + '\". ' +\n          'Available easing functions: ' + Object.keys(easingFunctions).join(', ') + '.'\n        );\n      }\n      return easingFunctions[easing]();\n    }\n  } else if (typeof easing === 'function') {\n    return easing;\n  }\n}\n\n// /*\n//  * Tweening helpers\n//  */\n// function syncStyles(startingStyles, endingStyles, computedStyle) {\n//   var property;\n//   for (property in startingStyles) {\n//     if (!endingStyles.hasOwnProperty(property)) {\n//       delete startingStyles[property];\n//     }\n//   }\n//   for (property in endingStyles) {\n//     if (!startingStyles.hasOwnProperty(property)) {\n//       startingStyles[property] = computedStyle[vendorizePropertyName(property)];\n//     }\n//   }\n// }\n\n// function makePropertyInterpolators(startingStyles, endingStyles) {\n//   var interpolators = {};\n//   var property;\n//   for (property in startingStyles) {\n//     interpolators[vendorizePropertyName(property)] = interpolate.propertyInterpolator(\n//       property, startingStyles[property], endingStyles[property]\n//     );\n//   }\n//   return interpolators;\n// }\n\n// var transformProperty;\n// function vendorizePropertyName(property) {\n//   if (property === 'transform') {\n//     //Set transformProperty lazily, to be sure DOM has loaded already when using it\n//     return transformProperty || \n//       (transformProperty = cssFeature('transform').property);\n//   } else {\n//     return property;\n//   }\n// }\n\n},{\"./core/dynamics\":6,\"./core/easing-functions\":7,\"./core/timeline\":8,\"./util/simple-emitter\":11,\"./util/uid\":12}],5:[function(_dereq_,module,exports){\n/*\n * Copyright (C) 2008 Apple Inc. All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// http://www.w3.org/TR/css3-transitions/#transition-easing-function\nmodule.exports =  {\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  linear: unitBezier(0.0, 0.0, 1.0, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  ease: unitBezier(0.25, 0.1, 0.25, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeIn: unitBezier(0.42, 0, 1.0, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeOut: unitBezier(0, 0, 0.58, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeInOut: unitBezier(0.42, 0, 0.58, 1.0),\n\n  /*\n   * @param p1x {number} X component of control point 1\n   * @param p1y {number} Y component of control point 1\n   * @param p2x {number} X component of control point 2\n   * @param p2y {number} Y component of control point 2\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  cubicBezier: function(p1x, p1y, p2x, p2y) {\n    return unitBezier(p1x, p1y, p2x, p2y);\n  }\n};\n\nfunction B1(t) { return t*t*t; }\nfunction B2(t) { return 3*t*t*(1-t); }\nfunction B3(t) { return 3*t*(1-t)*(1-t); }\nfunction B4(t) { return (1-t)*(1-t)*(1-t); }\n\n/*\n * JavaScript port of Webkit implementation of CSS cubic-bezier(p1x.p1y,p2x,p2y) by http://mck.me\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h\n */\n\n/*\n * Duration value to use when one is not specified (400ms is a common value).\n * @const\n * @type {number}\n */\nvar DEFAULT_DURATION = 400;//ms\n\n/*\n * The epsilon value we pass to UnitBezier::solve given that the animation is going to run over |dur| seconds.\n * The longer the animation, the more precision we need in the easing function result to avoid ugly discontinuities.\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/page/animation/AnimationBase.cpp\n */\nfunction solveEpsilon(duration) {\n  return 1.0 / (200.0 * duration);\n}\n\n/*\n * Defines a cubic-bezier curve given the middle two control points.\n * NOTE: first and last control points are implicitly (0,0) and (1,1).\n * @param p1x {number} X component of control point 1\n * @param p1y {number} Y component of control point 1\n * @param p2x {number} X component of control point 2\n * @param p2y {number} Y component of control point 2\n */\nfunction unitBezier(p1x, p1y, p2x, p2y) {\n\n  // private members --------------------------------------------\n\n  // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n\n  /*\n   * X component of Bezier coefficient C\n   * @const\n   * @type {number}\n   */\n  var cx = 3.0 * p1x;\n\n  /*\n   * X component of Bezier coefficient B\n   * @const\n   * @type {number}\n   */\n  var bx = 3.0 * (p2x - p1x) - cx;\n\n  /*\n   * X component of Bezier coefficient A\n   * @const\n   * @type {number}\n   */\n  var ax = 1.0 - cx -bx;\n\n  /*\n   * Y component of Bezier coefficient C\n   * @const\n   * @type {number}\n   */\n  var cy = 3.0 * p1y;\n\n  /*\n   * Y component of Bezier coefficient B\n   * @const\n   * @type {number}\n   */\n  var by = 3.0 * (p2y - p1y) - cy;\n\n  /*\n   * Y component of Bezier coefficient A\n   * @const\n   * @type {number}\n   */\n  var ay = 1.0 - cy - by;\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveX = function(t) {\n    // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n    return ((ax * t + bx) * t + cx) * t;\n  };\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveY = function(t) {\n    return ((ay * t + by) * t + cy) * t;\n  };\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveDerivativeX = function(t) {\n    return (3.0 * ax * t + 2.0 * bx) * t + cx;\n  };\n\n  /*\n   * Given an x value, find a parametric value it came from.\n   * @param x {number} value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param epsilon {number} accuracy limit of t for the given x\n   * @return {number} the t value corresponding to x\n   */\n  var solveCurveX = function(x, epsilon) {\n    var t0;\n    var t1;\n    var t2;\n    var x2;\n    var d2;\n    var i;\n\n    // First try a few iterations of Newton's method -- normally very fast.\n    for (t2 = x, i = 0; i < 8; i++) {\n      x2 = sampleCurveX(t2) - x;\n      if (Math.abs (x2) < epsilon) {\n        return t2;\n      }\n      d2 = sampleCurveDerivativeX(t2);\n      if (Math.abs(d2) < 1e-6) {\n        break;\n      }\n      t2 = t2 - x2 / d2;\n    }\n\n    // Fall back to the bisection method for reliability.\n    t0 = 0.0;\n    t1 = 1.0;\n    t2 = x;\n\n    if (t2 < t0) {\n      return t0;\n    }\n    if (t2 > t1) {\n      return t1;\n    }\n\n    while (t0 < t1) {\n      x2 = sampleCurveX(t2);\n      if (Math.abs(x2 - x) < epsilon) {\n        return t2;\n      }\n      if (x > x2) {\n        t0 = t2;\n      } else {\n        t1 = t2;\n      }\n      t2 = (t1 - t0) * 0.5 + t0;\n    }\n\n    // Failure.\n    return t2;\n  };\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param epsilon {number} the accuracy of t for the given x\n   * @return {number} the y value along the bezier curve\n   */\n  var solve = function(x, epsilon) {\n    return sampleCurveY(solveCurveX(x, epsilon));\n  };\n\n  // public interface --------------------------------------------\n\n  /*\n   * Find the y of the cubic-bezier for a given x with accuracy determined by the animation duration.\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  return function(x, duration) {\n    return solve(x, solveEpsilon(+duration || DEFAULT_DURATION));\n  };\n}\n\n\n},{}],6:[function(_dereq_,module,exports){\n/**\n * A HUGE thank you to dynamics.js which inspired these dynamics simulations.\n * https://github.com/michaelvillar/dynamics.js\n *\n * Also licensed under MIT\n */\n\nvar extend = _dereq_('../util/extend');\n\nmodule.exports = {\n  spring: dynamicsSpring,\n  gravity: dynamicsGravity\n};\n\nvar springDefaults = {\n  frequency: 15,\n  friction: 200,\n  anticipationStrength: 0,\n  anticipationSize: 0\n};\nfunction dynamicsSpring(opts) {\n  opts = extend({}, springDefaults, opts || {});\n\n  return function at(t, duration) {\n    var A, At, a, angle, b, decal, frequency, friction, frictionT, s, v, y0, yS,\n    _opts = opts;\n    frequency = Math.max(1, opts.frequency);\n    friction = Math.pow(20, opts.friction / 100);\n    s = opts.anticipationSize / 100;\n    decal = Math.max(0, s);\n    frictionT = (t / (1 - s)) - (s / (1 - s));\n    if (t < s) {\n      A = function(t) {\n        var M, a, b, x0, x1;\n        M = 0.8;\n        x0 = s / (1 - s);\n        x1 = 0;\n        b = (x0 - (M * x1)) / (x0 - x1);\n        a = (M - b) / x0;\n        return (a * t * _opts.anticipationStrength / 100) + b;\n      };\n      yS = (s / (1 - s)) - (s / (1 - s));\n      y0 = (0 / (1 - s)) - (s / (1 - s));\n      b = Math.acos(1 / A(yS));\n      a = (Math.acos(1 / A(y0)) - b) / (frequency * (-s));\n    } else {\n      A = function(t) {\n        return Math.pow(friction / 10, -t) * (1 - t);\n      };\n      b = 0;\n      a = 1;\n    }\n    At = A(frictionT);\n    angle = frequency * (t - s) * a + b;\n    v = 1 - (At * Math.cos(angle));\n    //return [t, v, At, frictionT, angle];\n    return v;\n  };\n}\n\nvar gravityDefaults = {\n  bounce: 40,\n  gravity: 1000,\n  initialForce: false\n};\nfunction dynamicsGravity(opts) {\n  opts = extend({}, gravityDefaults, opts || {});\n  var curves = [];\n\n  init();\n\n  return at;\n\n  function length() {\n    var L, b, bounce, curve, gravity;\n    bounce = Math.min(opts.bounce / 100, 80);\n    gravity = opts.gravity / 100;\n    b = Math.sqrt(2 / gravity);\n    curve = {\n      a: -b,\n      b: b,\n      H: 1\n    };\n    if (opts.initialForce) {\n      curve.a = 0;\n      curve.b = curve.b * 2;\n    }\n    while (curve.H > 0.001) {\n      L = curve.b - curve.a;\n      curve = {\n        a: curve.b,\n        b: curve.b + L * bounce,\n        H: curve.H * bounce * bounce\n      };\n    }\n    return curve.b;\n  }\n\n  function init() {\n    var L, b, bounce, curve, gravity, _results;\n\n    L = length();\n    gravity = (opts.gravity / 100) * L * L;\n    bounce = Math.min(opts.bounce / 100, 80);\n    b = Math.sqrt(2 / gravity);\n    curves = [];\n    curve = {\n      a: -b,\n      b: b,\n      H: 1\n    };\n    if (opts.initialForce) {\n      curve.a = 0;\n      curve.b = curve.b * 2;\n    }\n    curves.push(curve);\n    _results = [];\n    while (curve.b < 1 && curve.H > 0.001) {\n      L = curve.b - curve.a;\n      curve = {\n        a: curve.b,\n        b: curve.b + L * bounce,\n        H: curve.H * bounce * bounce\n      };\n      _results.push(curves.push(curve));\n    }\n    return _results;\n  }\n\n  function calculateCurve(a, b, H, t){\n    var L, c, t2;\n    L = b - a;\n    t2 = (2 / L) * t - 1 - (a * 2 / L);\n    c = t2 * t2 * H - H + 1;\n    if (opts.initialForce) {\n      c = 1 - c;\n    }\n    return c;\n  }\n\n  function at(t, duration) {\n    var bounce, curve, gravity, i, v;\n    bounce = opts.bounce / 100;\n    gravity = opts.gravity;\n    i = 0;\n    curve = curves[i];\n    while (!(t >= curve.a && t <= curve.b)) {\n      i += 1;\n      curve = curves[i];\n      if (!curve) {\n        break;\n      }\n    }\n    if (!curve) {\n      v = opts.initialForce ? 0 : 1;\n    } else {\n      v = calculateCurve(curve.a, curve.b, curve.H, t);\n    }\n    //return [t, v];\n    return v;\n  }\n\n};\n\n},{\"../util/extend\":10}],7:[function(_dereq_,module,exports){\nvar dynamics = _dereq_('./dynamics');\nvar bezier = _dereq_('./bezier');\n\nmodule.exports = {\n  'linear': function() {\n    return function(t, duration) {\n      return bezier.linear(t, duration);\n    };\n  },\n  'ease': function() {\n    return function(t, duration) {\n      return bezier.ease(t, duration);\n    };\n  },\n  'ease-in': function() {\n    return function(t, duration) {\n      return bezier.easeIn(t, duration);\n    };\n  },\n  'ease-out': function() {\n    return function(t, duration) {\n      return bezier.easeOut(t, duration);\n    };\n  },\n  'ease-in-out': function() {\n    return function(t, duration) {\n      return bezier.easeInOut(t, duration);\n    };\n  },\n  'cubic-bezier': function(x1, y1, x2, y2, duration) {\n    var bz = bezier.cubicBezier(x1, y1, x2, y2);//, t, duration);\n    return function(t, duration) {\n      return bz(t, duration);\n    };\n  }\n};\n\n},{\"./bezier\":5,\"./dynamics\":6}],8:[function(_dereq_,module,exports){\n\nvar raf = _dereq_('raf');\nvar time = _dereq_('performance-now');\n\nvar self = module.exports = {\n  _running: {},\n\n  animationStarted: function(instance) {\n    self._running[instance._.id] = instance;\n\n    if (!self.isTicking) {\n      self.tick();\n    }\n  },\n\n  animationStopped: function(instance) {\n    delete self._running[instance._.id];\n    self.maybeStopTicking();\n  },\n\n  tick: function() {\n    var lastFrame = time();\n\n    self.isTicking = true;\n    self._rafId = raf(step);\n\n    function step() {\n      self._rafId = raf(step);\n\n      // Get current time\n      var now = time();\n      var deltaT = now - lastFrame;\n\n      for (var animationId in self._running) {\n        self._running[animationId]._tick(deltaT);\n      }\n\n      lastFrame = now;\n    }\n  },\n\n  maybeStopTicking: function() {\n    if (self.isTicking && !Object.keys(self._running).length) {\n      raf.cancel(self._rafId);\n      self.isTicking = false;\n    }\n  },\n\n};\n\n\n},{\"performance-now\":1,\"raf\":2}],9:[function(_dereq_,module,exports){\nmodule.exports = {\n  animator: _dereq_('./animator')\n};\n\n},{\"./animator\":4}],10:[function(_dereq_,module,exports){\n\n/*\n * There really is no tiny minimal extend() on npm to find,\n * so we just use our own.\n */\n\nmodule.exports = function extend(obj) {\n   var args = Array.prototype.slice.call(arguments, 1);\n   for(var i = 0; i < args.length; i++) {\n     var source = args[i];\n     if (source) {\n       for (var prop in source) {\n         obj[prop] = source[prop];\n       }\n     }\n   }\n   return obj;\n};\n\n},{}],11:[function(_dereq_,module,exports){\n\n// All we want is an eventEmitter that doesn't use #call or #apply,\n// by expecting 0-1 arguments. \n// We couldn't find this on npm, so we make our own.\n\nmodule.exports = SimpleEventEmitter;\n\nfunction SimpleEventEmitter() {\n}\n\nSimpleEventEmitter.prototype = {\n  listeners: [],\n  on: function(eventType, fn) {\n    if (typeof fn !== 'function') return;\n    this.listeners[eventType] || (this.listeners[eventType] = []);\n    this.listeners[eventType].push(fn);\n  },\n  once: function(eventType, fn) {\n    var self = this;\n    function onceFn() {\n      self.off(eventType, fn);\n      self.off(eventType, onceFn);\n    }\n    this.on(eventType, fn);\n    this.on(eventType, onceFn);\n  },\n  // Built-in limitation: we only expect 0-1 arguments\n  // This is to save as much perf as possible when sending\n  // events every frame.\n  emit: function(eventType, eventArg) {\n    var listeners = this.listeners[eventType] || [];\n    var i = 0;\n    var len = listeners.length;\n    if (arguments.length === 2) {\n      for (i; i < len; i++) listeners[i] && listeners[i](eventArg);\n    } else {\n      for (i; i < len; i++) listeners[i] && listeners[i]();\n    }\n  },\n  off: function(eventType, fnToRemove) {\n    if (!eventType) {\n      //Remove all listeners\n      for (var type in this.listeners) {\n        this.off(type);\n      }\n    } else  {\n      var listeners = this.listeners[eventType];\n      if (listeners) {\n        if (!fnToRemove) {\n          listeners.length = 0;\n        } else {\n          var index = listeners.indexOf(fnToRemove);\n          listeners.splice(index, 1);\n        }\n      }\n    }\n  } \n};\n\n},{}],12:[function(_dereq_,module,exports){\n\n/**\n * nextUid() from angular.js\n * License MIT\n * http://github.com/angular/angular.js\n *\n * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric\n * characters such as '012ABC'. The reason why we are not using simply a number counter is that\n * the number string gets longer over time, and it can also overflow, where as the nextId\n * will grow much slower, it is a string, and it will never overflow.\n *\n * @returns an unique alpha-numeric string\n */\nvar uid = [];\n\nmodule.exports = function nextUid() {\n  var index = uid.length;\n  var digit;\n\n  while(index) {\n    index--;\n    digit = uid[index].charCodeAt(0);\n    if (digit == 57 /*'9'*/) {\n      uid[index] = 'A';\n      return uid.join('');\n    }\n    if (digit == 90  /*'Z'*/) {\n      uid[index] = '0';\n    } else {\n      uid[index] = String.fromCharCode(digit + 1);\n      return uid.join('');\n    }\n  }\n  uid.unshift('0');\n  return uid.join('');\n};\n\n},{}],13:[function(_dereq_,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\n\nprocess.nextTick = (function () {\n    var canSetImmediate = typeof window !== 'undefined'\n    && window.setImmediate;\n    var canPost = typeof window !== 'undefined'\n    && window.postMessage && window.addEventListener\n    ;\n\n    if (canSetImmediate) {\n        return function (f) { return window.setImmediate(f) };\n    }\n\n    if (canPost) {\n        var queue = [];\n        window.addEventListener('message', function (ev) {\n            var source = ev.source;\n            if ((source === window || source === null) && ev.data === 'process-tick') {\n                ev.stopPropagation();\n                if (queue.length > 0) {\n                    var fn = queue.shift();\n                    fn();\n                }\n            }\n        }, true);\n\n        return function nextTick(fn) {\n            queue.push(fn);\n            window.postMessage('process-tick', '*');\n        };\n    }\n\n    return function nextTick(fn) {\n        setTimeout(fn, 0);\n    };\n})();\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n}\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\n\n},{}]},{},[9])\n(9)\n});"
  },
  {
    "path": "www/lib/collide/package.json",
    "content": "{\n  \"name\": \"collide\",\n  \"version\": \"0.0.4\",\n  \"main\": \"collide.js\",\n  \"scripts\": {\n    \"build\": \"mkdir -p dist && browserify src/index.js -s collide > dist/collide.js\",\n    \"test\": \"node_modules/.bin/jasmine-node test --color\",\n    \"autotest\": \"node_modules/.bin/jasmine-node test --watch src --autotest --color\"\n  },\n  \"dependencies\": {\n    \"raf\": \"^2.0.1\",\n    \"feature\": \"^0.1.4\",\n    \"performance-now\": \"^0.1.3\"\n  },\n  \"devDependencies\": {\n    \"jasmine-node\": \"^1.14.5\",\n    \"proxyquire\": \"^1.0.1\"\n  }\n}\n"
  },
  {
    "path": "www/lib/collide/test/animator.spec.js",
    "content": "var easings = require('../src/core/easing-functions');\nvar dynamics = require('../src/core/dynamics');\n\nvar cssFeature = jasmine.createSpy('cssFeature').andReturn('vendorTransform');\nvar timeline = {\n  animationStarted: jasmine.createSpy(),\n  animationStopped: jasmine.createSpy()\n};\n\nvar proxyquire = require('proxyquire');\nvar Animator = proxyquire('../src/animator', {\n  './core/timeline': timeline\n});\n\ndescribe('animator', function() {\n\n  beforeEach(function() {\n    timeline.animationStarted.reset();\n    timeline.animationStopped.reset();\n  });\n\n  it('.duration() should set/get duration', function() {\n    var animator = new Animator({\n      duration: 333\n    });\n    expect(animator.duration()).toBe(333);\n    animator.duration(-1);\n    expect(animator.duration()).toBe(333);\n    animator.duration('not a number');\n    expect(animator.duration()).toBe(333);\n    animator.duration(222);\n    expect(animator.duration()).toBe(222);\n  });\n\n  it('.reverse() should set/get reverse direction', function() {\n    var animator = new Animator({\n      reverse: true\n    });\n    expect(animator.reverse()).toBe(true);\n    animator.reverse(false);\n    expect(animator.reverse()).toBe(false);\n  });\n\n  it('.easing() shoould set/get easing curve or dynamics type', function() {\n    var animator = new Animator({\n      easing: 'ease-in-out'\n    });\n    expect(animator.easing()(1)).toEqual(easings['ease-in-out']()(1, 100));\n\n    animator.easing('cubic-bezier(0.1,0.2,0.3,0.4)');\n    expect(animator.easing()(1, 100)).toEqual(\n      easings['cubic-bezier'](0.1,0.2,0.3,0.4)(1,100)\n    );\n\n    animator.easing({\n      type: 'spring'\n    });\n    expect(animator.easing()(1, 100)).toEqual(dynamics.spring()(1,100));\n  });\n\n  it('.percent() shoold set/get percent', function() {\n    var animator = new Animator({\n      percent: 0.5\n    });\n    expect(animator.percent()).toBe(0.5);\n    animator.percent('not a number');\n    expect(animator.percent()).toBe(0.5);\n    animator.percent(2);\n    expect(animator.percent()).toBe(1);\n    animator.percent(-1);\n    expect(animator.percent()).toBe(0);\n    animator.percent(0.333);\n    expect(animator.percent()).toBe(0.333);\n  });\n\n  it('isRunning()', function() {\n    var animator = new Animator();\n    expect(animator.isRunning()).toBe(false);\n    animator.start();\n    expect(animator.isRunning()).toBe(true);\n  });\n\n  it('.percent() should step if not running', function() {\n    var animator = new Animator();\n    var stepSpy = jasmine.createSpy('step');\n    animator.on('step', stepSpy);\n    animator.percent(0);\n    expect(stepSpy).toHaveBeenCalledWith(0);\n\n    stepSpy.reset();\n    animator.start();\n    animator.percent(0.5);\n    expect(stepSpy).not.toHaveBeenCalled();\n  });\n\n  it('.promise() should resolve once when the animation stops', function() {\n    jasmine.Clock.useMock();\n    var animator = new Animator();\n    var thenSpy = jasmine.createSpy('then');\n    animator.promise().then(thenSpy);\n    expect(thenSpy).not.toHaveBeenCalled();\n    animator.start();\n    animator.stop();\n    expect(thenSpy).toHaveBeenCalledWith(false);\n  });\n\n  it('.destroy() should remove all listeners', function() {\n    var animator = new Animator();\n    var destroySpy = jasmine.createSpy('destroy');\n    var stopSpy = jasmine.createSpy('stop');\n    animator.on('destroy', destroySpy);\n    animator.on('stop', stopSpy);\n    spyOn(animator, 'off');\n    animator.start();\n    animator.destroy();\n    expect(destroySpy).toHaveBeenCalled();\n    expect(stopSpy).toHaveBeenCalledWith(false);\n    expect(animator.off).toHaveBeenCalledWith();\n  });\n\n  it('.stop() should emit stop event, tell timeline, & stop isRunning', function() {\n    var animator = new Animator();\n    var stopSpy = jasmine.createSpy('stop');\n    var completeSpy = jasmine.createSpy('complete');\n    animator.on('stop', stopSpy);\n    animator.on('complete', completeSpy);\n    animator._.isRunning = true;\n    animator.stop();\n    expect(timeline.animationStopped).toHaveBeenCalledWith(animator);\n    expect(stopSpy).toHaveBeenCalledWith(false);\n    expect(completeSpy).not.toHaveBeenCalledWith();\n    expect(animator.isRunning()).toBe(false);\n\n    stopSpy.reset();\n    spyOn(animator, '_isComplete').andReturn(true);\n    animator._.isRunning = true;\n    animator.stop();\n    //We DID complete this time, we're at 1 percent\n    expect(stopSpy).toHaveBeenCalledWith(true);\n    expect(completeSpy).toHaveBeenCalledWith();\n  });\n\n  it('.restart() should set startPercent then start', function() {\n    var animator = new Animator({\n      percent: 0.3\n    });\n    spyOn(animator, 'start');\n    expect(animator.percent()).toBe(0.3);\n    animator.restart();\n    expect(animator.percent()).toBe(0);\n    expect(animator.start).toHaveBeenCalledWith(false);\n  });\n\n  describe('.start()', function() {\n    it('should start running and call animationStarted and emit event', function() {\n      var animator = new Animator();\n      var startSpy = jasmine.createSpy('start');\n      animator.on('start', startSpy);\n      animator.start();\n      expect(startSpy).toHaveBeenCalled();\n      expect(animator.isRunning()).toBe(true);\n      expect(timeline.animationStarted).toHaveBeenCalledWith(animator);\n    });\n\n    it('should startImmediately with parameter or isStarting', function() {\n      var animator = new Animator();\n      var stepSpy = jasmine.createSpy('step');\n      animator.on('step', stepSpy);\n      animator.start(true);\n      expect(stepSpy).toHaveBeenCalledWith(0);\n\n      animator.stop();\n      stepSpy.reset();\n      \n      animator.start();\n      expect(stepSpy).not.toHaveBeenCalled();\n      expect(animator._.isStarting).toBe(true);\n    });\n  });\n\n  describe('._tick()', function() {\n    it('should add percent for forward, subtract for reverse, max 0/1', function() {\n      var animator = new Animator({\n        duration: 1000,\n        percent: 0\n      });\n      animator._tick(100);\n      expect(animator.percent()).toBe(0.1);\n      animator._tick(1000);\n      expect(animator.percent()).toBe(1);\n      animator.reverse(true);\n      animator._tick(50);\n      expect(animator.percent()).toBe(0.95);\n      animator._tick(1000);\n      expect(animator.percent()).toBe(0);\n    });\n\n    it('if isStarting, it shouldn\\'t up percent and should step', function() {\n      var animator = new Animator({\n        duration: 1000\n      });\n      var stepSpy = jasmine.createSpy('step');\n      animator.on('step', stepSpy);\n      animator.start();\n\n      animator._tick(200);\n      expect(animator.percent()).toBe(0);\n      expect(stepSpy).toHaveBeenCalledWith(0);\n\n      animator._tick(200);\n      expect(stepSpy).toHaveBeenCalledWith(0);\n      expect(animator.percent()).toBe(0.2);\n      expect(stepSpy).toHaveBeenCalledWith(0.2);\n    });\n\n    it('should step with the easing value', function() {\n      var animator = new Animator({\n        easing: 'ease',\n        duration: 1000\n      });\n      var stepSpy = jasmine.createSpy('step');\n      animator.on('step', stepSpy);\n      animator._tick(200);\n      expect(stepSpy).toHaveBeenCalledWith(easings.ease()(0.2, 1000));\n    });\n\n    it('should stop at end percent', function() {\n      var animator = new Animator({\n        duration: 1000\n      });\n      spyOn(animator, 'stop');\n      animator._tick(1000);\n      expect(animator.stop).toHaveBeenCalled();\n    });\n\n  });\n});\n"
  },
  {
    "path": "www/lib/collide/test/core/timeline.spec.js",
    "content": "\nvar lastRafId;\nvar nextRafCb;\nfunction mockRaf(cb) {\n  nextRafCb = cb;\n  return lastRafId++;\n}\nmockRaf.cancel = jasmine.createSpy('rafCancel');\n\nvar nextTime = 0;\nfunction mockTime() {\n  return nextTime;\n}\n\nvar proxyquire = require('proxyquire');\nvar timeline = proxyquire('../../src/core/timeline', {\n  'raf': mockRaf,\n  'performance-now': mockTime\n});\n\ndescribe('timeline', function() {\n\n  beforeEach(function() {\n    lastRafId = 0;\n    nextRafCb = null;\n    nextTime = 0;\n  });\n\n  it('starting animation should start ticking only on first animation', function() {\n    spyOn(timeline, 'tick').andCallThrough();\n    timeline.animationStarted({ _: { id: 0 } });\n    expect(timeline.tick).toHaveBeenCalled();\n    expect(timeline.isTicking).toBe(true);\n\n    timeline.tick.reset();\n    timeline.animationStarted({ _: { id: 1 } });\n    expect(timeline.tick).not.toHaveBeenCalled();\n  });\n\n  it('stopping animation should maybeStopTicking', function() {\n    spyOn(timeline, 'maybeStopTicking');\n    timeline.animationStopped({ _: { id: 0 } });\n    expect(timeline.maybeStopTicking).toHaveBeenCalled();\n  });\n\n  it('maybeStopTicking should stop ticking if no animations left', function() {\n    timeline._running = { 1: true };\n    timeline.isTicking = true;\n    timeline._rafId = 0;\n    timeline.maybeStopTicking();\n    expect(mockRaf.cancel).not.toHaveBeenCalled();\n\n    timeline._running = {};\n    timeline.maybeStopTicking();\n    expect(mockRaf.cancel).toHaveBeenCalledWith(timeline._rafId);\n  });\n\n  it('tick() should step every frame, and tick running with deltaT', function() {\n    var tickSpy = jasmine.createSpy('tick');\n    timeline._running = {\n      0: { _tick: tickSpy }\n    };\n    nextTime = 0;\n    timeline.tick();\n    expect(tickSpy).not.toHaveBeenCalled();\n\n    nextTime = 100;\n    nextRafCb();\n    expect(tickSpy).toHaveBeenCalledWith(100);\n\n    nextTime = 149;\n    nextRafCb();\n    expect(tickSpy).toHaveBeenCalledWith(49);\n  });\n});\n"
  },
  {
    "path": "www/lib/collide/test/util/simple-emitter.spec.js",
    "content": "var Emitter = require('../../src/util/simple-emitter');\n\ndescribe('SimpleEmitter', function() {\n\n  it('should on() and emit()', function() {\n    var receive = jasmine.createSpy('receive');\n    var emitter = new Emitter();\n    emitter.on('send', receive);\n    emitter.emit('send');\n    expect(receive).toHaveBeenCalledWith();\n\n    receive.reset();\n    emitter.emit('send', 1);\n    expect(receive).toHaveBeenCalledWith(1);\n  });\n\n  it('should on() and off()', function() {\n    var receive = jasmine.createSpy('receive');\n    var emitter = new Emitter();\n    emitter.on('send', receive);\n\n    emitter.emit('send');\n    expect(receive).toHaveBeenCalledWith();\n\n    emitter.off('send', receive);\n    receive.reset();\n    emitter.emit('send');\n    expect(receive).not.toHaveBeenCalled();\n  });\n\n  it('should on() and off() with multiple listeners', function() {\n    var receive = jasmine.createSpy('receive');\n    var receive2 = jasmine.createSpy('receive2');\n    var emitter = new Emitter();\n    emitter.on('send', receive);\n    emitter.on('send', receive2);\n    emitter.emit('send', 2);\n\n    expect(receive).toHaveBeenCalledWith(2);\n    expect(receive2).toHaveBeenCalledWith(2);\n\n    emitter.off('send', receive2);\n    receive.reset();\n    receive2.reset();\n\n    emitter.emit('send');\n    expect(receive).toHaveBeenCalledWith();\n    expect(receive2).not.toHaveBeenCalled();\n  });\n\n  it('should once()', function() {\n    var receive = jasmine.createSpy('receive');\n    var emitter = new Emitter();\n    emitter.once('send', receive);\n    emitter.emit('send');\n    expect(receive).toHaveBeenCalledWith();\n    receive.reset();\n    emitter.emit('send');\n    expect(receive).not.toHaveBeenCalled();\n  });\n\n  it('should off() all events for a type', function() {\n    var receive = jasmine.createSpy('receive');\n    var receive2 = jasmine.createSpy('receive2');\n    var emitter = new Emitter();\n    emitter.on('send', receive);\n    emitter.on('send', receive2);\n    emitter.off('send');\n\n    emitter.emit('send');\n    expect(receive).not.toHaveBeenCalledWith();\n    expect(receive2).not.toHaveBeenCalled();\n  });\n\n  it('should off() all events', function() {\n    var receive = jasmine.createSpy('receive');\n    var receive2 = jasmine.createSpy('receive2');\n    var emitter = new Emitter();\n    emitter.on('send1', receive);\n    emitter.on('send2', receive2);\n    emitter.off();\n\n    emitter.emit('send1');\n    emitter.emit('send2');\n\n    expect(receive).not.toHaveBeenCalledWith();\n    expect(receive2).not.toHaveBeenCalled();\n  });\n\n});\n"
  },
  {
    "path": "www/lib/collide/test.html",
    "content": "<!DOCTYPE html>\n<html ng-app=\"myApp\">\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n    <title></title>\n\n    <meta name=\"viewport\" content=\"initial-scale=1, maximum-scale=1, user-scalable=no\" />\n    <script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.js\"></script>\n    <script src=\"dist/collide.js\"></script>\n    <style>\n      .box {\n        position: absolute;\n        width: 100px;\n        height: 100px;\n        background-color: black;\n      }\n      #draggable {\n        top: 200px;\n      }\n      #opts {\n        position: absolute;\n        top: 200px;\n        left: 10px;\n      }\n    </style>\n\n  </head>\n\n  <body>\n\n    <div ng-controller=\"MyCtrl\">\n      <div class=\"box\"></div>\n      <!-- <div class=\"box\" id=\"draggable\"></div> -->\n      <div id=\"opts\">\n        <label>\n          Duration:\n          <input type=\"number\" ng-model=\"anim.duration\">\n        </label>\n        <label>\n          Repeat\n          <input type=\"number\" ng-model=\"anim.repeat\">\n        </label>\n        <br>\n        <label>\n          Delay\n          <input type=\"number\" ng-model=\"anim.delay\">\n        </label>\n        <br>\n        <label>\n          Auto reverse\n          <input type=\"checkbox\" ng-model=\"anim.autoReverse\">\n        </label>\n        <br>\n        <label>\n          Reverse\n          <input type=\"checkbox\" ng-model=\"anim.reverse\">\n        </label>\n        <br>\n        <button ng-click=\"do(v)\" ng-repeat=\"v in fns\">{{v}}</button>\n        <button ng-click=\"do('spring')\">Spring</button>\n        <button ng-click=\"do('gravity')\">Gravity</button>\n        <p>\n        <input type=\"text\" ng-model=\"anim.bx1\">\n        <input type=\"text\" ng-model=\"anim.by1\">\n        <input type=\"text\" ng-model=\"anim.bx2\">\n        <input type=\"text\" ng-model=\"anim.by2\">\n        <button ng-click=\"do('cubic-bezier')\">cubic-bezier</button>\n        </p>\n        <p>\n          <button ng-click=\"toggle()\">Toggle Pause/Play</button>\n          <button ng-click=\"currentAnimation.percent(0.3)\">Go to 30%</button>\n        </p>\n      </div>\n      {{animationResult}}\n    </div>\n\n    <script>\n      angular.module('myApp', [])\n      .controller('MyCtrl', function($scope) {\n\n        $scope.fns = [\n          'linear',\n          'ease',\n          'ease-in',\n          'ease-out',\n          'ease-in-out'\n        ];\n        $scope.anim = {\n          duration: 1000,\n          bx1: 0.17,\n          by1: 0.67,\n          bx2: 0.83,\n          by2: 0.67,\n          direction: 'normal'\n        };\n\n        $scope.toggle = function() {\n          if (!$scope.currentAnimation) return;\n          if ($scope.currentAnimation.isRunning()) {\n            $scope.currentAnimation.stop();\n          } else {\n            $scope.currentAnimation.start();\n          }\n        };\n        var el = angular.element(document.querySelector('.box'));\n        $scope.do = function(fn) {\n          if(fn == 'cubic-bezier') {\n            fn = 'cubic-bezier(' +\n                $scope.anim.bx1 + ',' +\n                $scope.anim.by1 + ',' +\n                $scope.anim.bx2 + ',' +\n                $scope.anim.by2 + ')';\n          }\n          var config = angular.extend({\n            name: 'fadeIn',\n            duration: 1500,\n            delay: 500,\n            autoReverse: false,\n            repeat: 0,\n            easing: fn,\n          }, $scope.anim);\n\n          if(fn == 'spring') {\n            angular.extend(config, {\n              easing: {\n                type: 'spring',\n                frequency: 15,\n                friction: 200,\n                initialForce: false\n              }\n            });\n          } else if (fn == 'gravity') {\n            angular.extend(config, {\n              easing: {\n                type: 'gravity',\n                frequency: 15,\n                friction: 200,\n                initialForce: false\n              }\n            });\n          }\n\n          $scope.currentAnimation = collide.animator(config);\n          $scope.currentAnimation\n            .on('step', function(v) {\n              el[0].style.webkitTransform = 'translate3d(' + (v * 180) + 'px, 0,0)';\n            })\n            .on('stop', console.log.bind(console, 'onStop. didFinish?'))\n            .on('start', console.log.bind(console, 'onStart'))\n            .start();\n        }\n      });\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "www/lib/firebase/.bower.json",
    "content": "{\n  \"name\": \"firebase\",\n  \"version\": \"1.0.21\",\n  \"homepage\": \"https://firebase.com\",\n  \"authors\": [\n    \"Firebase <operations@firebase.com>\"\n  ],\n  \"description\": \"Firebase Web Client\",\n  \"main\": \"firebase.js\",\n  \"keywords\": [\n    \"Firebase\",\n    \"synchronization\",\n    \"real-time\",\n    \"websocket\"\n  ],\n  \"license\": \"MIT\",\n  \"private\": false,\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"test\",\n    \"tests\"\n  ],\n  \"_release\": \"1.0.21\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.0.21\",\n    \"commit\": \"e7feeb9b49eb9794cc57de423919816259a45d5f\"\n  },\n  \"_source\": \"git://github.com/firebase/firebase-bower.git\",\n  \"_target\": \"1.0.x\",\n  \"_originalSource\": \"firebase\"\n}"
  },
  {
    "path": "www/lib/firebase/LICENSE",
    "content": "Copyright © 2014 Firebase <opensource@firebase.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "www/lib/firebase/README.md",
    "content": "firebase-bower\n==============\n\nFirebase Bower\n"
  },
  {
    "path": "www/lib/firebase/bower.json",
    "content": "{\n  \"name\": \"firebase\",\n  \"version\": \"1.0.21\",\n  \"homepage\": \"https://firebase.com\",\n  \"authors\": [\n    \"Firebase <operations@firebase.com>\"\n  ],\n  \"description\": \"Firebase Web Client\",\n  \"main\": \"firebase.js\",\n  \"keywords\": [\n    \"Firebase\",\n    \"synchronization\",\n    \"real-time\",\n    \"websocket\"\n  ],\n  \"license\": \"MIT\",\n  \"private\": false,\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"test\",\n    \"tests\"\n  ]\n}"
  },
  {
    "path": "www/lib/firebase/firebase-debug.js",
    "content": "/* Firebase v1.0.21 */ var CLOSURE_NO_DEPS = true; var COMPILED = false;\nvar goog = goog || {};\ngoog.global = this;\ngoog.global.CLOSURE_UNCOMPILED_DEFINES;\ngoog.global.CLOSURE_DEFINES;\ngoog.isDef = function(val) {\n  return val !== void 0;\n};\ngoog.exportPath_ = function(name, opt_object, opt_objectToExportTo) {\n  var parts = name.split(\".\");\n  var cur = opt_objectToExportTo || goog.global;\n  if (!(parts[0] in cur) && cur.execScript) {\n    cur.execScript(\"var \" + parts[0]);\n  }\n  for (var part;parts.length && (part = parts.shift());) {\n    if (!parts.length && goog.isDef(opt_object)) {\n      cur[part] = opt_object;\n    } else {\n      if (cur[part]) {\n        cur = cur[part];\n      } else {\n        cur = cur[part] = {};\n      }\n    }\n  }\n};\ngoog.define = function(name, defaultValue) {\n  var value = defaultValue;\n  if (!COMPILED) {\n    if (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, name)) {\n      value = goog.global.CLOSURE_UNCOMPILED_DEFINES[name];\n    } else {\n      if (goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, name)) {\n        value = goog.global.CLOSURE_DEFINES[name];\n      }\n    }\n  }\n  goog.exportPath_(name, value);\n};\ngoog.DEBUG = true;\ngoog.define(\"goog.LOCALE\", \"en\");\ngoog.define(\"goog.TRUSTED_SITE\", true);\ngoog.define(\"goog.STRICT_MODE_COMPATIBLE\", false);\ngoog.provide = function(name) {\n  if (!COMPILED) {\n    if (goog.isProvided_(name)) {\n      throw Error('Namespace \"' + name + '\" already declared.');\n    }\n    delete goog.implicitNamespaces_[name];\n    var namespace = name;\n    while (namespace = namespace.substring(0, namespace.lastIndexOf(\".\"))) {\n      if (goog.getObjectByName(namespace)) {\n        break;\n      }\n      goog.implicitNamespaces_[namespace] = true;\n    }\n  }\n  goog.exportPath_(name);\n};\ngoog.setTestOnly = function(opt_message) {\n  if (COMPILED && !goog.DEBUG) {\n    opt_message = opt_message || \"\";\n    throw Error(\"Importing test-only code into non-debug environment\" + opt_message ? \": \" + opt_message : \".\");\n  }\n};\ngoog.forwardDeclare = function(name) {\n};\nif (!COMPILED) {\n  goog.isProvided_ = function(name) {\n    return!goog.implicitNamespaces_[name] && goog.isDefAndNotNull(goog.getObjectByName(name));\n  };\n  goog.implicitNamespaces_ = {};\n}\ngoog.getObjectByName = function(name, opt_obj) {\n  var parts = name.split(\".\");\n  var cur = opt_obj || goog.global;\n  for (var part;part = parts.shift();) {\n    if (goog.isDefAndNotNull(cur[part])) {\n      cur = cur[part];\n    } else {\n      return null;\n    }\n  }\n  return cur;\n};\ngoog.globalize = function(obj, opt_global) {\n  var global = opt_global || goog.global;\n  for (var x in obj) {\n    global[x] = obj[x];\n  }\n};\ngoog.addDependency = function(relPath, provides, requires) {\n  if (goog.DEPENDENCIES_ENABLED) {\n    var provide, require;\n    var path = relPath.replace(/\\\\/g, \"/\");\n    var deps = goog.dependencies_;\n    for (var i = 0;provide = provides[i];i++) {\n      deps.nameToPath[provide] = path;\n      if (!(path in deps.pathToNames)) {\n        deps.pathToNames[path] = {};\n      }\n      deps.pathToNames[path][provide] = true;\n    }\n    for (var j = 0;require = requires[j];j++) {\n      if (!(path in deps.requires)) {\n        deps.requires[path] = {};\n      }\n      deps.requires[path][require] = true;\n    }\n  }\n};\ngoog.define(\"goog.ENABLE_DEBUG_LOADER\", true);\ngoog.require = function(name) {\n  if (!COMPILED) {\n    if (goog.isProvided_(name)) {\n      return;\n    }\n    if (goog.ENABLE_DEBUG_LOADER) {\n      var path = goog.getPathFromDeps_(name);\n      if (path) {\n        goog.included_[path] = true;\n        goog.writeScripts_();\n        return;\n      }\n    }\n    var errorMessage = \"goog.require could not find: \" + name;\n    if (goog.global.console) {\n      goog.global.console[\"error\"](errorMessage);\n    }\n    throw Error(errorMessage);\n  }\n};\ngoog.basePath = \"\";\ngoog.global.CLOSURE_BASE_PATH;\ngoog.global.CLOSURE_NO_DEPS;\ngoog.global.CLOSURE_IMPORT_SCRIPT;\ngoog.nullFunction = function() {\n};\ngoog.identityFunction = function(opt_returnValue, var_args) {\n  return opt_returnValue;\n};\ngoog.abstractMethod = function() {\n  throw Error(\"unimplemented abstract method\");\n};\ngoog.addSingletonGetter = function(ctor) {\n  ctor.getInstance = function() {\n    if (ctor.instance_) {\n      return ctor.instance_;\n    }\n    if (goog.DEBUG) {\n      goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor;\n    }\n    return ctor.instance_ = new ctor;\n  };\n};\ngoog.instantiatedSingletons_ = [];\ngoog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;\nif (goog.DEPENDENCIES_ENABLED) {\n  goog.included_ = {};\n  goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}};\n  goog.inHtmlDocument_ = function() {\n    var doc = goog.global.document;\n    return typeof doc != \"undefined\" && \"write\" in doc;\n  };\n  goog.findBasePath_ = function() {\n    if (goog.global.CLOSURE_BASE_PATH) {\n      goog.basePath = goog.global.CLOSURE_BASE_PATH;\n      return;\n    } else {\n      if (!goog.inHtmlDocument_()) {\n        return;\n      }\n    }\n    var doc = goog.global.document;\n    var scripts = doc.getElementsByTagName(\"script\");\n    for (var i = scripts.length - 1;i >= 0;--i) {\n      var src = scripts[i].src;\n      var qmark = src.lastIndexOf(\"?\");\n      var l = qmark == -1 ? src.length : qmark;\n      if (src.substr(l - 7, 7) == \"base.js\") {\n        goog.basePath = src.substr(0, l - 7);\n        return;\n      }\n    }\n  };\n  goog.importScript_ = function(src) {\n    var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;\n    if (!goog.dependencies_.written[src] && importScript(src)) {\n      goog.dependencies_.written[src] = true;\n    }\n  };\n  goog.writeScriptTag_ = function(src) {\n    if (goog.inHtmlDocument_()) {\n      var doc = goog.global.document;\n      if (doc.readyState == \"complete\") {\n        var isDeps = /\\bdeps.js$/.test(src);\n        if (isDeps) {\n          return false;\n        } else {\n          throw Error('Cannot write \"' + src + '\" after document load');\n        }\n      }\n      doc.write('<script type=\"text/javascript\" src=\"' + src + '\"></' + \"script>\");\n      return true;\n    } else {\n      return false;\n    }\n  };\n  goog.writeScripts_ = function() {\n    var scripts = [];\n    var seenScript = {};\n    var deps = goog.dependencies_;\n    function visitNode(path) {\n      if (path in deps.written) {\n        return;\n      }\n      if (path in deps.visited) {\n        if (!(path in seenScript)) {\n          seenScript[path] = true;\n          scripts.push(path);\n        }\n        return;\n      }\n      deps.visited[path] = true;\n      if (path in deps.requires) {\n        for (var requireName in deps.requires[path]) {\n          if (!goog.isProvided_(requireName)) {\n            if (requireName in deps.nameToPath) {\n              visitNode(deps.nameToPath[requireName]);\n            } else {\n              throw Error(\"Undefined nameToPath for \" + requireName);\n            }\n          }\n        }\n      }\n      if (!(path in seenScript)) {\n        seenScript[path] = true;\n        scripts.push(path);\n      }\n    }\n    for (var path in goog.included_) {\n      if (!deps.written[path]) {\n        visitNode(path);\n      }\n    }\n    for (var i = 0;i < scripts.length;i++) {\n      if (scripts[i]) {\n        goog.importScript_(goog.basePath + scripts[i]);\n      } else {\n        throw Error(\"Undefined script input\");\n      }\n    }\n  };\n  goog.getPathFromDeps_ = function(rule) {\n    if (rule in goog.dependencies_.nameToPath) {\n      return goog.dependencies_.nameToPath[rule];\n    } else {\n      return null;\n    }\n  };\n  goog.findBasePath_();\n  if (!goog.global.CLOSURE_NO_DEPS) {\n    goog.importScript_(goog.basePath + \"deps.js\");\n  }\n}\ngoog.typeOf = function(value) {\n  var s = typeof value;\n  if (s == \"object\") {\n    if (value) {\n      if (value instanceof Array) {\n        return \"array\";\n      } else {\n        if (value instanceof Object) {\n          return s;\n        }\n      }\n      var className = Object.prototype.toString.call((value));\n      if (className == \"[object Window]\") {\n        return \"object\";\n      }\n      if (className == \"[object Array]\" || typeof value.length == \"number\" && typeof value.splice != \"undefined\" && typeof value.propertyIsEnumerable != \"undefined\" && !value.propertyIsEnumerable(\"splice\")) {\n        return \"array\";\n      }\n      if (className == \"[object Function]\" || typeof value.call != \"undefined\" && typeof value.propertyIsEnumerable != \"undefined\" && !value.propertyIsEnumerable(\"call\")) {\n        return \"function\";\n      }\n    } else {\n      return \"null\";\n    }\n  } else {\n    if (s == \"function\" && typeof value.call == \"undefined\") {\n      return \"object\";\n    }\n  }\n  return s;\n};\ngoog.isNull = function(val) {\n  return val === null;\n};\ngoog.isDefAndNotNull = function(val) {\n  return val != null;\n};\ngoog.isArray = function(val) {\n  return goog.typeOf(val) == \"array\";\n};\ngoog.isArrayLike = function(val) {\n  var type = goog.typeOf(val);\n  return type == \"array\" || type == \"object\" && typeof val.length == \"number\";\n};\ngoog.isDateLike = function(val) {\n  return goog.isObject(val) && typeof val.getFullYear == \"function\";\n};\ngoog.isString = function(val) {\n  return typeof val == \"string\";\n};\ngoog.isBoolean = function(val) {\n  return typeof val == \"boolean\";\n};\ngoog.isNumber = function(val) {\n  return typeof val == \"number\";\n};\ngoog.isFunction = function(val) {\n  return goog.typeOf(val) == \"function\";\n};\ngoog.isObject = function(val) {\n  var type = typeof val;\n  return type == \"object\" && val != null || type == \"function\";\n};\ngoog.getUid = function(obj) {\n  return obj[goog.UID_PROPERTY_] || (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_);\n};\ngoog.hasUid = function(obj) {\n  return!!obj[goog.UID_PROPERTY_];\n};\ngoog.removeUid = function(obj) {\n  if (\"removeAttribute\" in obj) {\n    obj.removeAttribute(goog.UID_PROPERTY_);\n  }\n  try {\n    delete obj[goog.UID_PROPERTY_];\n  } catch (ex) {\n  }\n};\ngoog.UID_PROPERTY_ = \"closure_uid_\" + (Math.random() * 1E9 >>> 0);\ngoog.uidCounter_ = 0;\ngoog.getHashCode = goog.getUid;\ngoog.removeHashCode = goog.removeUid;\ngoog.cloneObject = function(obj) {\n  var type = goog.typeOf(obj);\n  if (type == \"object\" || type == \"array\") {\n    if (obj.clone) {\n      return obj.clone();\n    }\n    var clone = type == \"array\" ? [] : {};\n    for (var key in obj) {\n      clone[key] = goog.cloneObject(obj[key]);\n    }\n    return clone;\n  }\n  return obj;\n};\ngoog.bindNative_ = function(fn, selfObj, var_args) {\n  return(fn.call.apply(fn.bind, arguments));\n};\ngoog.bindJs_ = function(fn, selfObj, var_args) {\n  if (!fn) {\n    throw new Error;\n  }\n  if (arguments.length > 2) {\n    var boundArgs = Array.prototype.slice.call(arguments, 2);\n    return function() {\n      var newArgs = Array.prototype.slice.call(arguments);\n      Array.prototype.unshift.apply(newArgs, boundArgs);\n      return fn.apply(selfObj, newArgs);\n    };\n  } else {\n    return function() {\n      return fn.apply(selfObj, arguments);\n    };\n  }\n};\ngoog.bind = function(fn, selfObj, var_args) {\n  if (Function.prototype.bind && Function.prototype.bind.toString().indexOf(\"native code\") != -1) {\n    goog.bind = goog.bindNative_;\n  } else {\n    goog.bind = goog.bindJs_;\n  }\n  return goog.bind.apply(null, arguments);\n};\ngoog.partial = function(fn, var_args) {\n  var args = Array.prototype.slice.call(arguments, 1);\n  return function() {\n    var newArgs = args.slice();\n    newArgs.push.apply(newArgs, arguments);\n    return fn.apply(this, newArgs);\n  };\n};\ngoog.mixin = function(target, source) {\n  for (var x in source) {\n    target[x] = source[x];\n  }\n};\ngoog.now = goog.TRUSTED_SITE && Date.now || function() {\n  return+new Date;\n};\ngoog.globalEval = function(script) {\n  if (goog.global.execScript) {\n    goog.global.execScript(script, \"JavaScript\");\n  } else {\n    if (goog.global.eval) {\n      if (goog.evalWorksForGlobals_ == null) {\n        goog.global.eval(\"var _et_ = 1;\");\n        if (typeof goog.global[\"_et_\"] != \"undefined\") {\n          delete goog.global[\"_et_\"];\n          goog.evalWorksForGlobals_ = true;\n        } else {\n          goog.evalWorksForGlobals_ = false;\n        }\n      }\n      if (goog.evalWorksForGlobals_) {\n        goog.global.eval(script);\n      } else {\n        var doc = goog.global.document;\n        var scriptElt = doc.createElement(\"script\");\n        scriptElt.type = \"text/javascript\";\n        scriptElt.defer = false;\n        scriptElt.appendChild(doc.createTextNode(script));\n        doc.body.appendChild(scriptElt);\n        doc.body.removeChild(scriptElt);\n      }\n    } else {\n      throw Error(\"goog.globalEval not available\");\n    }\n  }\n};\ngoog.evalWorksForGlobals_ = null;\ngoog.cssNameMapping_;\ngoog.cssNameMappingStyle_;\ngoog.getCssName = function(className, opt_modifier) {\n  var getMapping = function(cssName) {\n    return goog.cssNameMapping_[cssName] || cssName;\n  };\n  var renameByParts = function(cssName) {\n    var parts = cssName.split(\"-\");\n    var mapped = [];\n    for (var i = 0;i < parts.length;i++) {\n      mapped.push(getMapping(parts[i]));\n    }\n    return mapped.join(\"-\");\n  };\n  var rename;\n  if (goog.cssNameMapping_) {\n    rename = goog.cssNameMappingStyle_ == \"BY_WHOLE\" ? getMapping : renameByParts;\n  } else {\n    rename = function(a) {\n      return a;\n    };\n  }\n  if (opt_modifier) {\n    return className + \"-\" + rename(opt_modifier);\n  } else {\n    return rename(className);\n  }\n};\ngoog.setCssNameMapping = function(mapping, opt_style) {\n  goog.cssNameMapping_ = mapping;\n  goog.cssNameMappingStyle_ = opt_style;\n};\ngoog.global.CLOSURE_CSS_NAME_MAPPING;\nif (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) {\n  goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING;\n}\ngoog.getMsg = function(str, opt_values) {\n  var values = opt_values || {};\n  for (var key in values) {\n    var value = (\"\" + values[key]).replace(/\\$/g, \"$$$$\");\n    str = str.replace(new RegExp(\"\\\\{\\\\$\" + key + \"\\\\}\", \"gi\"), value);\n  }\n  return str;\n};\ngoog.getMsgWithFallback = function(a, b) {\n  return a;\n};\ngoog.exportSymbol = function(publicPath, object, opt_objectToExportTo) {\n  goog.exportPath_(publicPath, object, opt_objectToExportTo);\n};\ngoog.exportProperty = function(object, publicName, symbol) {\n  object[publicName] = symbol;\n};\ngoog.inherits = function(childCtor, parentCtor) {\n  function tempCtor() {\n  }\n  tempCtor.prototype = parentCtor.prototype;\n  childCtor.superClass_ = parentCtor.prototype;\n  childCtor.prototype = new tempCtor;\n  childCtor.prototype.constructor = childCtor;\n  childCtor.base = function(me, methodName, var_args) {\n    var args = Array.prototype.slice.call(arguments, 2);\n    return parentCtor.prototype[methodName].apply(me, args);\n  };\n};\ngoog.base = function(me, opt_methodName, var_args) {\n  var caller = arguments.callee.caller;\n  if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !caller) {\n    throw Error(\"arguments.caller not defined.  goog.base() cannot be used \" + \"with strict mode code. See \" + \"http://www.ecma-international.org/ecma-262/5.1/#sec-C\");\n  }\n  if (caller.superClass_) {\n    return caller.superClass_.constructor.apply(me, Array.prototype.slice.call(arguments, 1));\n  }\n  var args = Array.prototype.slice.call(arguments, 2);\n  var foundCaller = false;\n  for (var ctor = me.constructor;ctor;ctor = ctor.superClass_ && ctor.superClass_.constructor) {\n    if (ctor.prototype[opt_methodName] === caller) {\n      foundCaller = true;\n    } else {\n      if (foundCaller) {\n        return ctor.prototype[opt_methodName].apply(me, args);\n      }\n    }\n  }\n  if (me[opt_methodName] === caller) {\n    return me.constructor.prototype[opt_methodName].apply(me, args);\n  } else {\n    throw Error(\"goog.base called from a method of one name \" + \"to a method of a different name\");\n  }\n};\ngoog.scope = function(fn) {\n  fn.call(goog.global);\n};\nif (!COMPILED) {\n  goog.global[\"COMPILED\"] = COMPILED;\n}\n;goog.provide(\"goog.json\");\ngoog.provide(\"goog.json.Replacer\");\ngoog.provide(\"goog.json.Reviver\");\ngoog.provide(\"goog.json.Serializer\");\ngoog.define(\"goog.json.USE_NATIVE_JSON\", false);\ngoog.json.isValid_ = function(s) {\n  if (/^\\s*$/.test(s)) {\n    return false;\n  }\n  var backslashesRe = /\\\\[\"\\\\\\/bfnrtu]/g;\n  var simpleValuesRe = /\"[^\"\\\\\\n\\r\\u2028\\u2029\\x00-\\x08\\x0a-\\x1f]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g;\n  var openBracketsRe = /(?:^|:|,)(?:[\\s\\u2028\\u2029]*\\[)+/g;\n  var remainderRe = /^[\\],:{}\\s\\u2028\\u2029]*$/;\n  return remainderRe.test(s.replace(backslashesRe, \"@\").replace(simpleValuesRe, \"]\").replace(openBracketsRe, \"\"));\n};\ngoog.json.parse = goog.json.USE_NATIVE_JSON ? (goog.global[\"JSON\"][\"parse\"]) : function(s) {\n  var o = String(s);\n  if (goog.json.isValid_(o)) {\n    try {\n      return(eval(\"(\" + o + \")\"));\n    } catch (ex) {\n    }\n  }\n  throw Error(\"Invalid JSON string: \" + o);\n};\ngoog.json.unsafeParse = goog.json.USE_NATIVE_JSON ? (goog.global[\"JSON\"][\"parse\"]) : function(s) {\n  return(eval(\"(\" + s + \")\"));\n};\ngoog.json.Replacer;\ngoog.json.Reviver;\ngoog.json.serialize = goog.json.USE_NATIVE_JSON ? (goog.global[\"JSON\"][\"stringify\"]) : function(object, opt_replacer) {\n  return(new goog.json.Serializer(opt_replacer)).serialize(object);\n};\ngoog.json.Serializer = function(opt_replacer) {\n  this.replacer_ = opt_replacer;\n};\ngoog.json.Serializer.prototype.serialize = function(object) {\n  var sb = [];\n  this.serializeInternal(object, sb);\n  return sb.join(\"\");\n};\ngoog.json.Serializer.prototype.serializeInternal = function(object, sb) {\n  switch(typeof object) {\n    case \"string\":\n      this.serializeString_((object), sb);\n      break;\n    case \"number\":\n      this.serializeNumber_((object), sb);\n      break;\n    case \"boolean\":\n      sb.push(object);\n      break;\n    case \"undefined\":\n      sb.push(\"null\");\n      break;\n    case \"object\":\n      if (object == null) {\n        sb.push(\"null\");\n        break;\n      }\n      if (goog.isArray(object)) {\n        this.serializeArray((object), sb);\n        break;\n      }\n      this.serializeObject_((object), sb);\n      break;\n    case \"function\":\n      break;\n    default:\n      throw Error(\"Unknown type: \" + typeof object);;\n  }\n};\ngoog.json.Serializer.charToJsonCharCache_ = {'\"':'\\\\\"', \"\\\\\":\"\\\\\\\\\", \"/\":\"\\\\/\", \"\\b\":\"\\\\b\", \"\\f\":\"\\\\f\", \"\\n\":\"\\\\n\", \"\\r\":\"\\\\r\", \"\\t\":\"\\\\t\", \"\\x0B\":\"\\\\u000b\"};\ngoog.json.Serializer.charsToReplace_ = /\\uffff/.test(\"\\uffff\") ? /[\\\\\\\"\\x00-\\x1f\\x7f-\\uffff]/g : /[\\\\\\\"\\x00-\\x1f\\x7f-\\xff]/g;\ngoog.json.Serializer.prototype.serializeString_ = function(s, sb) {\n  sb.push('\"', s.replace(goog.json.Serializer.charsToReplace_, function(c) {\n    if (c in goog.json.Serializer.charToJsonCharCache_) {\n      return goog.json.Serializer.charToJsonCharCache_[c];\n    }\n    var cc = c.charCodeAt(0);\n    var rv = \"\\\\u\";\n    if (cc < 16) {\n      rv += \"000\";\n    } else {\n      if (cc < 256) {\n        rv += \"00\";\n      } else {\n        if (cc < 4096) {\n          rv += \"0\";\n        }\n      }\n    }\n    return goog.json.Serializer.charToJsonCharCache_[c] = rv + cc.toString(16);\n  }), '\"');\n};\ngoog.json.Serializer.prototype.serializeNumber_ = function(n, sb) {\n  sb.push(isFinite(n) && !isNaN(n) ? n : \"null\");\n};\ngoog.json.Serializer.prototype.serializeArray = function(arr, sb) {\n  var l = arr.length;\n  sb.push(\"[\");\n  var sep = \"\";\n  for (var i = 0;i < l;i++) {\n    sb.push(sep);\n    var value = arr[i];\n    this.serializeInternal(this.replacer_ ? this.replacer_.call(arr, String(i), value) : value, sb);\n    sep = \",\";\n  }\n  sb.push(\"]\");\n};\ngoog.json.Serializer.prototype.serializeObject_ = function(obj, sb) {\n  sb.push(\"{\");\n  var sep = \"\";\n  for (var key in obj) {\n    if (Object.prototype.hasOwnProperty.call(obj, key)) {\n      var value = obj[key];\n      if (typeof value != \"function\") {\n        sb.push(sep);\n        this.serializeString_(key, sb);\n        sb.push(\":\");\n        this.serializeInternal(this.replacer_ ? this.replacer_.call(obj, key, value) : value, sb);\n        sep = \",\";\n      }\n    }\n  }\n  sb.push(\"}\");\n};\ngoog.provide(\"fb.util.json\");\ngoog.require(\"goog.json\");\nfb.util.json.eval = function(str) {\n  if (typeof JSON !== \"undefined\" && goog.isDef(JSON.parse)) {\n    return JSON.parse(str);\n  } else {\n    return goog.json.parse(str);\n  }\n};\nfb.util.json.stringify = function(data) {\n  if (typeof JSON !== \"undefined\" && goog.isDef(JSON.stringify)) {\n    return JSON.stringify(data);\n  } else {\n    return goog.json.serialize(data);\n  }\n};\ngoog.provide(\"fb.util.utf8\");\nfb.util.utf8.stringToByteArray = function(str) {\n  var out = [], p = 0;\n  for (var i = 0;i < str.length;i++) {\n    var c = str.charCodeAt(i);\n    if (c >= 55296 && c <= 56319) {\n      var high = c - 55296;\n      i++;\n      fb.core.util.assert(i < str.length, \"Surrogate pair missing trail surrogate.\");\n      var low = str.charCodeAt(i) - 56320;\n      c = 65536 + (high << 10) + low;\n    }\n    if (c < 128) {\n      out[p++] = c;\n    } else {\n      if (c < 2048) {\n        out[p++] = c >> 6 | 192;\n        out[p++] = c & 63 | 128;\n      } else {\n        if (c < 65536) {\n          out[p++] = c >> 12 | 224;\n          out[p++] = c >> 6 & 63 | 128;\n          out[p++] = c & 63 | 128;\n        } else {\n          out[p++] = c >> 18 | 240;\n          out[p++] = c >> 12 & 63 | 128;\n          out[p++] = c >> 6 & 63 | 128;\n          out[p++] = c & 63 | 128;\n        }\n      }\n    }\n  }\n  return out;\n};\nfb.util.utf8.stringLength = function(str) {\n  var p = 0;\n  for (var i = 0;i < str.length;i++) {\n    var c = str.charCodeAt(i);\n    if (c < 128) {\n      p++;\n    } else {\n      if (c < 2048) {\n        p += 2;\n      } else {\n        if (c >= 55296 && c <= 56319) {\n          p += 4;\n          i++;\n        } else {\n          p += 3;\n        }\n      }\n    }\n  }\n  return p;\n};\ngoog.provide(\"fb.util.validation\");\nfb.util.validation.validateArgCount = function(fnName, minCount, maxCount, argCount) {\n  var argError;\n  if (argCount < minCount) {\n    argError = \"at least \" + minCount;\n  } else {\n    if (argCount > maxCount) {\n      argError = maxCount === 0 ? \"none\" : \"no more than \" + maxCount;\n    }\n  }\n  if (argError) {\n    var error = fnName + \" failed: Was called with \" + argCount + (argCount === 1 ? \" argument.\" : \" arguments.\") + \" Expects \" + argError + \".\";\n    throw new Error(error);\n  }\n};\nfb.util.validation.errorPrefix = function(fnName, argumentNumber, optional) {\n  var argName = \"\";\n  switch(argumentNumber) {\n    case 1:\n      argName = optional ? \"first\" : \"First\";\n      break;\n    case 2:\n      argName = optional ? \"second\" : \"Second\";\n      break;\n    case 3:\n      argName = optional ? \"third\" : \"Third\";\n      break;\n    case 4:\n      argName = optional ? \"fourth\" : \"Fourth\";\n      break;\n    default:\n      fb.core.util.validation.assert(false, \"errorPrefix_ called with argumentNumber > 4.  Need to update it?\");\n  }\n  var error = fnName + \" failed: \";\n  error += argName + \" argument \";\n  return error;\n};\nfb.util.validation.validateNamespace = function(fnName, argumentNumber, namespace, optional) {\n  if (optional && !goog.isDef(namespace)) {\n    return;\n  }\n  if (!goog.isString(namespace)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + \"must be a valid firebase namespace.\");\n  }\n};\nfb.util.validation.validateCallback = function(fnName, argumentNumber, callback, optional) {\n  if (optional && !goog.isDef(callback)) {\n    return;\n  }\n  if (!goog.isFunction(callback)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + \"must be a valid function.\");\n  }\n};\nfb.util.validation.validateString = function(fnName, argumentNumber, string, optional) {\n  if (optional && !goog.isDef(string)) {\n    return;\n  }\n  if (!goog.isString(string)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + \"must be a valid string.\");\n  }\n};\nfb.util.validation.validateContextObject = function(fnName, argumentNumber, context, optional) {\n  if (optional && !goog.isDef(context)) {\n    return;\n  }\n  if (!goog.isObject(context) || context === null) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + \"must be a valid context object.\");\n  }\n};\ngoog.provide(\"fb.util.obj\");\nfb.util.obj.contains = function(obj, key) {\n  return Object.prototype.hasOwnProperty.call(obj, key);\n};\nfb.util.obj.get = function(obj, key) {\n  if (Object.prototype.hasOwnProperty.call(obj, key)) {\n    return obj[key];\n  }\n};\ngoog.provide(\"fb.core.util.validation\");\ngoog.require(\"fb.util.obj\");\ngoog.require(\"fb.util.utf8\");\ngoog.require(\"fb.util.validation\");\nfb.core.util.validation.INVALID_KEY_REGEX_ = /[\\[\\].#$\\/\\u0000-\\u001F\\u007F]/;\nfb.core.util.validation.INVALID_PATH_REGEX_ = /[\\[\\].#$\\u0000-\\u001F\\u007F]/;\nfb.core.util.validation.MAX_LEAF_SIZE_ = 10 * 1024 * 1024;\nfb.core.util.validation.MAX_DEPTH_SIZE_ = 1E3;\nfb.core.util.validation.isValidKey = function(key) {\n  return goog.isString(key) && key.length !== 0 && !fb.core.util.validation.INVALID_KEY_REGEX_.test(key);\n};\nfb.core.util.validation.isValidPathString = function(pathString) {\n  return goog.isString(pathString) && pathString.length !== 0 && !fb.core.util.validation.INVALID_PATH_REGEX_.test(pathString);\n};\nfb.core.util.validation.isValidRootPathString = function(pathString) {\n  if (pathString) {\n    pathString = pathString.replace(/^\\/*\\.info(\\/|$)/, \"/\");\n  }\n  return fb.core.util.validation.isValidPathString(pathString);\n};\nfb.core.util.validation.validateFirebaseDataArg = function(fnName, argumentNumber, data, optional) {\n  if (optional && !goog.isDef(data)) {\n    return;\n  }\n  fb.core.util.validation.validateFirebaseData(fb.util.validation.errorPrefix(fnName, argumentNumber, optional), data);\n};\nfb.core.util.validation.validateFirebaseData = function(errorPrefix, data, depth, opt_path) {\n  if (!depth) {\n    depth = 0;\n  }\n  var path = opt_path || [];\n  if (!goog.isDef(data)) {\n    throw new Error(errorPrefix + \"contains undefined\" + fb.core.util.validation.pathLocation_(path));\n  }\n  if (goog.isFunction(data)) {\n    throw new Error(errorPrefix + \"contains a function\" + fb.core.util.validation.pathLocation_(path) + \" with contents: \" + data.toString());\n  }\n  if (fb.core.util.isInvalidJSONNumber(data)) {\n    throw new Error(errorPrefix + \"contains \" + data.toString() + fb.core.util.validation.pathLocation_(path));\n  }\n  if (depth > fb.core.util.validation.MAX_DEPTH_SIZE_) {\n    throw new TypeError(errorPrefix + \"contains a cyclic object value (\" + path.slice(0, 100).join(\".\") + \"...)\");\n  }\n  if (goog.isString(data) && data.length > fb.core.util.validation.MAX_LEAF_SIZE_ / 3 && fb.util.utf8.stringToByteArray(data).length > fb.core.util.validation.MAX_LEAF_SIZE_) {\n    throw new Error(errorPrefix + \"contains a string greater than \" + fb.core.util.validation.MAX_LEAF_SIZE_ + \" utf8 bytes\" + fb.core.util.validation.pathLocation_(path) + \" ('\" + data.substring(0, 50) + \"...')\");\n  }\n  if (goog.isObject(data)) {\n    for (var key in data) {\n      if (fb.util.obj.contains(data, key)) {\n        var value = data[key];\n        if (key !== \".priority\" && key !== \".value\" && key !== \".sv\" && !fb.core.util.validation.isValidKey(key)) {\n          throw new Error(errorPrefix + \" contains an invalid key (\" + key + \")\" + fb.core.util.validation.pathLocation_(path) + '.  Keys must be non-empty strings and can\\'t contain \".\", \"#\", \"$\", \"/\", \"[\", or \"]\"');\n        }\n        path.push(key);\n        fb.core.util.validation.validateFirebaseData(errorPrefix, value, depth + 1, path);\n        path.pop();\n      }\n    }\n  }\n};\nfb.core.util.validation.pathLocation_ = function(path) {\n  if (path.length == 0) {\n    return \"\";\n  } else {\n    return \" in property '\" + path.join(\".\") + \"'\";\n  }\n};\nfb.core.util.validation.validateFirebaseObjectDataArg = function(fnName, argumentNumber, data, optional) {\n  if (optional && !goog.isDef(data)) {\n    return;\n  }\n  if (!goog.isObject(data) || goog.isArray(data)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + \" must be an Object containing \" + \"the children to replace.\");\n  }\n  fb.core.util.validation.validateFirebaseDataArg(fnName, argumentNumber, data, optional);\n};\nfb.core.util.validation.validatePriority = function(fnName, argumentNumber, priority, optional) {\n  if (optional && !goog.isDef(priority)) {\n    return;\n  }\n  if (priority !== null && !goog.isNumber(priority) && !goog.isString(priority) && !(goog.isObject(priority) && fb.util.obj.contains(priority, \".sv\"))) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + \"must be a valid firebase priority \" + \"(a string, number, or null).\");\n  }\n};\nfb.core.util.validation.validateEventType = function(fnName, argumentNumber, eventType, optional) {\n  if (optional && !goog.isDef(eventType)) {\n    return;\n  }\n  switch(eventType) {\n    case \"value\":\n    ;\n    case \"child_added\":\n    ;\n    case \"child_removed\":\n    ;\n    case \"child_changed\":\n    ;\n    case \"child_moved\":\n      break;\n    default:\n      throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + 'must be a valid event type: \"value\", \"child_added\", \"child_removed\", \"child_changed\", or \"child_moved\".');;\n  }\n};\nfb.core.util.validation.validateKey = function(fnName, argumentNumber, key, optional) {\n  if (optional && !goog.isDef(key)) {\n    return;\n  }\n  if (!fb.core.util.validation.isValidKey(key)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + 'was an invalid key: \"' + key + '\".  Firebase keys must be non-empty strings and can\\'t contain \".\", \"#\", \"$\", \"/\", \"[\", or \"]\").');\n  }\n};\nfb.core.util.validation.validatePathString = function(fnName, argumentNumber, pathString, optional) {\n  if (optional && !goog.isDef(pathString)) {\n    return;\n  }\n  if (!fb.core.util.validation.isValidPathString(pathString)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + 'was an invalid path: \"' + pathString + '\". Paths must be non-empty strings and can\\'t contain \".\", \"#\", \"$\", \"[\", or \"]\"');\n  }\n};\nfb.core.util.validation.validateRootPathString = function(fnName, argumentNumber, pathString, optional) {\n  if (pathString) {\n    pathString = pathString.replace(/^\\/*\\.info(\\/|$)/, \"/\");\n  }\n  fb.core.util.validation.validatePathString(fnName, argumentNumber, pathString, optional);\n};\nfb.core.util.validation.validateWritablePath = function(fnName, path) {\n  if (path.getFront() === \".info\") {\n    throw new Error(fnName + \" failed: Can't modify data under /.info/\");\n  }\n};\nfb.core.util.validation.validateUrl = function(fnName, argumentNumber, parsedUrl) {\n  var pathString = parsedUrl.path.toString();\n  if (!goog.isString(parsedUrl.repoInfo.host) || parsedUrl.repoInfo.host.length === 0 || !fb.core.util.validation.isValidKey(parsedUrl.repoInfo.namespace) || pathString.length !== 0 && !fb.core.util.validation.isValidRootPathString(pathString)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, false) + \"must be a valid firebase URL and \" + 'the path can\\'t contain \".\", \"#\", \"$\", \"[\", or \"]\".');\n  }\n};\nfb.core.util.validation.validateCredential = function(fnName, argumentNumber, cred, optional) {\n  if (optional && !goog.isDef(cred)) {\n    return;\n  }\n  if (!goog.isString(cred)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + \"must be a valid credential (a string).\");\n  }\n};\nfb.core.util.validation.validateBoolean = function(fnName, argumentNumber, bool, optional) {\n  if (optional && !goog.isDef(bool)) {\n    return;\n  }\n  if (!goog.isBoolean(bool)) {\n    throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + \"must be a boolean.\");\n  }\n};\ngoog.provide(\"fb.api.Query\");\ngoog.require(\"fb.core.util.validation\");\ngoog.require(\"fb.util.json\");\nfb.api.Query = function(repo, path, opt_limit, opt_startPriority, opt_startName, opt_endPriority, opt_endName) {\n  this.repo = repo;\n  this.path = path;\n  this.itemLimit = opt_limit;\n  this.startPriority = opt_startPriority;\n  this.startName = opt_startName;\n  this.endPriority = opt_endPriority;\n  this.endName = opt_endName;\n  if (goog.isDef(this.startPriority) && goog.isDef(this.endPriority) && goog.isDef(this.itemLimit)) {\n    throw \"Query: Can't combine startAt(), endAt(), and limit().\";\n  }\n};\nfb.api.Query.prototype.ref = function() {\n  fb.util.validation.validateArgCount(\"Query.ref\", 0, 0, arguments.length);\n  return new Firebase(this.repo, this.path);\n};\ngoog.exportProperty(fb.api.Query.prototype, \"ref\", fb.api.Query.prototype.ref);\nfb.api.Query.prototype.on = function(eventType, callback) {\n  fb.util.validation.validateArgCount(\"Query.on\", 2, 4, arguments.length);\n  fb.core.util.validation.validateEventType(\"Query.on\", 1, eventType, false);\n  fb.util.validation.validateCallback(\"Query.on\", 2, callback, false);\n  var ret = this.getCancelAndContextArgs_(\"Query.on\", arguments[2], arguments[3]);\n  this.repo.addEventCallbackForQuery(this, eventType, callback, ret.cancel, ret.context);\n  return callback;\n};\ngoog.exportProperty(fb.api.Query.prototype, \"on\", fb.api.Query.prototype.on);\nfb.api.Query.prototype.off = function(eventType, callback, opt_context) {\n  fb.util.validation.validateArgCount(\"Query.off\", 0, 3, arguments.length);\n  fb.core.util.validation.validateEventType(\"Query.off\", 1, eventType, true);\n  fb.util.validation.validateCallback(\"Query.off\", 2, callback, true);\n  fb.util.validation.validateContextObject(\"Query.off\", 3, opt_context, true);\n  this.repo.removeEventCallbackForQuery(this, eventType, callback, opt_context);\n};\ngoog.exportProperty(fb.api.Query.prototype, \"off\", fb.api.Query.prototype.off);\nfb.api.Query.prototype.once = function(eventType, userCallback) {\n  fb.util.validation.validateArgCount(\"Query.once\", 2, 4, arguments.length);\n  fb.core.util.validation.validateEventType(\"Query.once\", 1, eventType, false);\n  fb.util.validation.validateCallback(\"Query.once\", 2, userCallback, false);\n  var ret = this.getCancelAndContextArgs_(\"Query.once\", arguments[2], arguments[3]);\n  var self = this, firstCall = true;\n  var onceCallback = function(snapshot) {\n    if (firstCall) {\n      firstCall = false;\n      self.off(eventType, onceCallback);\n      goog.bind(userCallback, ret.context)(snapshot);\n    }\n  };\n  this.on(eventType, onceCallback, function(err) {\n    self.off(eventType, onceCallback);\n    if (ret.cancel) {\n      goog.bind(ret.cancel, ret.context)(err);\n    }\n  });\n};\ngoog.exportProperty(fb.api.Query.prototype, \"once\", fb.api.Query.prototype.once);\nfb.api.Query.prototype.limit = function(limit) {\n  fb.util.validation.validateArgCount(\"Query.limit\", 1, 1, arguments.length);\n  if (!goog.isNumber(limit) || Math.floor(limit) !== limit || limit <= 0) {\n    throw \"Query.limit: First argument must be a positive integer.\";\n  }\n  return new fb.api.Query(this.repo, this.path, limit, this.startPriority, this.startName, this.endPriority, this.endName);\n};\ngoog.exportProperty(fb.api.Query.prototype, \"limit\", fb.api.Query.prototype.limit);\nfb.api.Query.prototype.startAt = function(priority, name) {\n  fb.util.validation.validateArgCount(\"Query.startAt\", 0, 2, arguments.length);\n  fb.core.util.validation.validatePriority(\"Query.startAt\", 1, priority, true);\n  fb.core.util.validation.validateKey(\"Query.startAt\", 2, name, true);\n  if (!goog.isDef(priority)) {\n    priority = null;\n    name = null;\n  }\n  return new fb.api.Query(this.repo, this.path, this.itemLimit, priority, name, this.endPriority, this.endName);\n};\ngoog.exportProperty(fb.api.Query.prototype, \"startAt\", fb.api.Query.prototype.startAt);\nfb.api.Query.prototype.endAt = function(priority, name) {\n  fb.util.validation.validateArgCount(\"Query.endAt\", 0, 2, arguments.length);\n  fb.core.util.validation.validatePriority(\"Query.endAt\", 1, priority, true);\n  fb.core.util.validation.validateKey(\"Query.endAt\", 2, name, true);\n  return new fb.api.Query(this.repo, this.path, this.itemLimit, this.startPriority, this.startName, priority, name);\n};\ngoog.exportProperty(fb.api.Query.prototype, \"endAt\", fb.api.Query.prototype.endAt);\nfb.api.Query.prototype.equalTo = function(priority, name) {\n  fb.util.validation.validateArgCount(\"Query.equalTo\", 1, 2, arguments.length);\n  fb.core.util.validation.validatePriority(\"Query.equalTo\", 1, priority, false);\n  fb.core.util.validation.validateKey(\"Query.equalTo\", 2, name, true);\n  return this.startAt(priority, name).endAt(priority, name);\n};\ngoog.exportProperty(fb.api.Query.prototype, \"equalTo\", fb.api.Query.prototype.equalTo);\nfb.api.Query.prototype.queryObject = function() {\n  var obj = {};\n  if (goog.isDef(this.startPriority)) {\n    obj[\"sp\"] = this.startPriority;\n  }\n  if (goog.isDef(this.startName)) {\n    obj[\"sn\"] = this.startName;\n  }\n  if (goog.isDef(this.endPriority)) {\n    obj[\"ep\"] = this.endPriority;\n  }\n  if (goog.isDef(this.endName)) {\n    obj[\"en\"] = this.endName;\n  }\n  if (goog.isDef(this.itemLimit)) {\n    obj[\"l\"] = this.itemLimit;\n  }\n  if (goog.isDef(this.startPriority) && goog.isDef(this.startName) && this.startPriority === null && this.startName === null) {\n    obj[\"vf\"] = \"l\";\n  }\n  return obj;\n};\nfb.api.Query.prototype.queryIdentifier = function() {\n  var obj = this.queryObject();\n  var id = fb.core.util.ObjectToUniqueKey(obj);\n  return id === \"{}\" ? \"default\" : id;\n};\nfb.api.Query.prototype.getCancelAndContextArgs_ = function(fnName, opt_first, opt_second) {\n  var ret = {};\n  if (opt_first && opt_second) {\n    ret.cancel = opt_first;\n    fb.util.validation.validateCallback(fnName, 3, ret.cancel, true);\n    ret.context = opt_second;\n    fb.util.validation.validateContextObject(fnName, 4, ret.context, true);\n  } else {\n    if (opt_first) {\n      if (typeof opt_first === \"object\" && opt_first !== null) {\n        ret.context = opt_first;\n      } else {\n        if (typeof opt_first === \"function\") {\n          ret.cancel = opt_first;\n        } else {\n          throw new Error(fb.util.validation.errorPrefix_(fnName, 3, true) + \"must either be a cancel callback or a context object.\");\n        }\n      }\n    }\n  }\n  return ret;\n};\ngoog.provide(\"fb.core.util.Path\");\nfb.core.util.Path = function(pathOrString, maybePieceNum) {\n  if (arguments.length == 1) {\n    this.pieces_ = pathOrString.split(\"/\");\n    var copyTo = 0;\n    for (var i = 0;i < this.pieces_.length;i++) {\n      if (this.pieces_[i].length > 0) {\n        this.pieces_[copyTo] = this.pieces_[i];\n        copyTo++;\n      }\n    }\n    this.pieces_.length = copyTo;\n    this.pieceNum_ = 0;\n  } else {\n    this.pieces_ = pathOrString;\n    this.pieceNum_ = maybePieceNum;\n  }\n};\nfb.core.util.Path.prototype.getFront = function() {\n  if (this.pieceNum_ >= this.pieces_.length) {\n    return null;\n  }\n  return this.pieces_[this.pieceNum_];\n};\nfb.core.util.Path.prototype.popFront = function() {\n  var pieceNum = this.pieceNum_;\n  if (pieceNum < this.pieces_.length) {\n    pieceNum++;\n  }\n  return new fb.core.util.Path(this.pieces_, pieceNum);\n};\nfb.core.util.Path.prototype.getBack = function() {\n  if (this.pieceNum_ < this.pieces_.length) {\n    return this.pieces_[this.pieces_.length - 1];\n  }\n  return null;\n};\nfb.core.util.Path.prototype.toString = function() {\n  var pathString = \"\";\n  for (var i = this.pieceNum_;i < this.pieces_.length;i++) {\n    if (this.pieces_[i] !== \"\") {\n      pathString += \"/\" + this.pieces_[i];\n    }\n  }\n  return pathString || \"/\";\n};\nfb.core.util.Path.prototype.parent = function() {\n  if (this.pieceNum_ >= this.pieces_.length) {\n    return null;\n  }\n  var pieces = [];\n  for (var i = this.pieceNum_;i < this.pieces_.length - 1;i++) {\n    pieces.push(this.pieces_[i]);\n  }\n  return new fb.core.util.Path(pieces, 0);\n};\nfb.core.util.Path.prototype.child = function(childPathObj) {\n  var pieces = [];\n  for (var i = this.pieceNum_;i < this.pieces_.length;i++) {\n    pieces.push(this.pieces_[i]);\n  }\n  if (childPathObj instanceof fb.core.util.Path) {\n    for (i = childPathObj.pieceNum_;i < childPathObj.pieces_.length;i++) {\n      pieces.push(childPathObj.pieces_[i]);\n    }\n  } else {\n    var childPieces = childPathObj.split(\"/\");\n    for (i = 0;i < childPieces.length;i++) {\n      if (childPieces[i].length > 0) {\n        pieces.push(childPieces[i]);\n      }\n    }\n  }\n  return new fb.core.util.Path(pieces, 0);\n};\nfb.core.util.Path.prototype.isEmpty = function() {\n  return this.pieceNum_ >= this.pieces_.length;\n};\nfb.core.util.Path.prototype.length = function() {\n  return this.pieces_.length - this.pieceNum_;\n};\nfb.core.util.Path.RelativePath = function(outerPath, innerPath) {\n  var outer = outerPath.getFront(), inner = innerPath.getFront();\n  if (outer === null) {\n    return innerPath;\n  } else {\n    if (outer === inner) {\n      return fb.core.util.Path.RelativePath(outerPath.popFront(), innerPath.popFront());\n    } else {\n      throw \"INTERNAL ERROR: innerPath (\" + innerPath + \") is not within \" + \"outerPath (\" + outerPath + \")\";\n    }\n  }\n};\nfb.core.util.Path.prototype.contains = function(other) {\n  var i = this.pieceNum_;\n  var j = other.pieceNum_;\n  if (this.length() > other.length()) {\n    return false;\n  }\n  while (i < this.pieces_.length) {\n    if (this.pieces_[i] !== other.pieces_[j]) {\n      return false;\n    }\n    ++i;\n    ++j;\n  }\n  return true;\n};\ngoog.provide(\"fb.core.util.Tree\");\ngoog.require(\"fb.core.util.Path\");\ngoog.require(\"fb.util.obj\");\nfb.core.util.TreeNode = function() {\n  this.children = {};\n  this.childCount = 0;\n  this.value = null;\n};\nfb.core.util.Tree = function(opt_name, opt_parent, opt_node) {\n  this.name_ = opt_name ? opt_name : \"\";\n  this.parent_ = opt_parent ? opt_parent : null;\n  this.node_ = opt_node ? opt_node : new fb.core.util.TreeNode;\n};\nfb.core.util.Tree.prototype.subTree = function(pathObj) {\n  var path = pathObj instanceof fb.core.util.Path ? pathObj : new fb.core.util.Path(pathObj);\n  var child = this, next;\n  while ((next = path.getFront()) !== null) {\n    var childNode = fb.util.obj.get(child.node_.children, next) || new fb.core.util.TreeNode;\n    child = new fb.core.util.Tree(next, child, childNode);\n    path = path.popFront();\n  }\n  return child;\n};\nfb.core.util.Tree.prototype.getValue = function() {\n  return this.node_.value;\n};\nfb.core.util.Tree.prototype.setValue = function(value) {\n  fb.core.util.assert(typeof value !== \"undefined\", \"Cannot set value to undefined\");\n  this.node_.value = value;\n  this.updateParents_();\n};\nfb.core.util.Tree.prototype.clear = function() {\n  this.node_.value = null;\n  this.node_.children = {};\n  this.node_.childCount = 0;\n  this.updateParents_();\n};\nfb.core.util.Tree.prototype.hasChildren = function() {\n  return this.node_.childCount > 0;\n};\nfb.core.util.Tree.prototype.isEmpty = function() {\n  return this.getValue() === null && !this.hasChildren();\n};\nfb.core.util.Tree.prototype.forEachChild = function(action) {\n  for (var child in this.node_.children) {\n    action(new fb.core.util.Tree(child, this, this.node_.children[child]));\n  }\n};\nfb.core.util.Tree.prototype.forEachDescendant = function(action, opt_includeSelf, opt_childrenFirst) {\n  if (opt_includeSelf && !opt_childrenFirst) {\n    action(this);\n  }\n  this.forEachChild(function(child) {\n    child.forEachDescendant(action, true, opt_childrenFirst);\n  });\n  if (opt_includeSelf && opt_childrenFirst) {\n    action(this);\n  }\n};\nfb.core.util.Tree.prototype.forEachAncestor = function(action, opt_includeSelf) {\n  var node = opt_includeSelf ? this : this.parent();\n  while (node !== null) {\n    if (action(node)) {\n      return true;\n    }\n    node = node.parent();\n  }\n  return false;\n};\nfb.core.util.Tree.prototype.forEachImmediateDescendantWithValue = function(action) {\n  this.forEachChild(function(child) {\n    if (child.getValue() !== null) {\n      action(child);\n    } else {\n      child.forEachImmediateDescendantWithValue(action);\n    }\n  });\n};\nfb.core.util.Tree.prototype.path = function() {\n  return new fb.core.util.Path(this.parent_ === null ? this.name_ : this.parent_.path() + \"/\" + this.name_);\n};\nfb.core.util.Tree.prototype.name = function() {\n  return this.name_;\n};\nfb.core.util.Tree.prototype.parent = function() {\n  return this.parent_;\n};\nfb.core.util.Tree.prototype.updateParents_ = function() {\n  if (this.parent_ !== null) {\n    this.parent_.updateChild_(this.name_, this);\n  }\n};\nfb.core.util.Tree.prototype.updateChild_ = function(childName, child) {\n  var childEmpty = child.isEmpty();\n  var childExists = fb.util.obj.contains(this.node_.children, childName);\n  if (childEmpty && childExists) {\n    delete this.node_.children[childName];\n    this.node_.childCount--;\n    this.updateParents_();\n  } else {\n    if (!childEmpty && !childExists) {\n      this.node_.children[childName] = child.node_;\n      this.node_.childCount++;\n      this.updateParents_();\n    }\n  }\n};\ngoog.provide(\"fb.core.util.SortedMap\");\nfb.Comparator;\nfb.core.util.SortedMap = function(opt_comparator, opt_root) {\n  this.comparator_ = opt_comparator ? opt_comparator : fb.core.util.SortedMap.STANDARD_COMPARATOR_;\n  this.root_ = opt_root ? opt_root : fb.core.util.SortedMap.EMPTY_NODE_;\n};\nfb.core.util.SortedMap.STANDARD_COMPARATOR_ = function(elem1, elem2) {\n  if (elem1 < elem2) {\n    return-1;\n  } else {\n    if (elem1 > elem2) {\n      return 1;\n    } else {\n      return 0;\n    }\n  }\n};\nfb.core.util.SortedMap.prototype.insert = function(key, value) {\n  return new fb.core.util.SortedMap(this.comparator_, this.root_.insert(key, value, this.comparator_).copy(null, null, fb.LLRBNode.BLACK, null, null));\n};\nfb.core.util.SortedMap.prototype.remove = function(key) {\n  return new fb.core.util.SortedMap(this.comparator_, this.root_.remove(key, this.comparator_).copy(null, null, fb.LLRBNode.BLACK, null, null));\n};\nfb.core.util.SortedMap.prototype.get = function(key) {\n  var cmp;\n  var node = this.root_;\n  while (!node.isEmpty()) {\n    cmp = this.comparator_(key, node.key);\n    if (cmp === 0) {\n      return node.value;\n    } else {\n      if (cmp < 0) {\n        node = node.left;\n      } else {\n        if (cmp > 0) {\n          node = node.right;\n        }\n      }\n    }\n  }\n  return null;\n};\nfb.core.util.SortedMap.prototype.getPredecessorKey = function(key) {\n  var cmp, node = this.root_, rightParent = null;\n  while (!node.isEmpty()) {\n    cmp = this.comparator_(key, node.key);\n    if (cmp === 0) {\n      if (!node.left.isEmpty()) {\n        node = node.left;\n        while (!node.right.isEmpty()) {\n          node = node.right;\n        }\n        return node.key;\n      } else {\n        if (rightParent) {\n          return rightParent.key;\n        } else {\n          return null;\n        }\n      }\n    } else {\n      if (cmp < 0) {\n        node = node.left;\n      } else {\n        if (cmp > 0) {\n          rightParent = node;\n          node = node.right;\n        }\n      }\n    }\n  }\n  throw new Error(\"Attempted to find predecessor key for a nonexistent key.  What gives?\");\n};\nfb.core.util.SortedMap.prototype.isEmpty = function() {\n  return this.root_.isEmpty();\n};\nfb.core.util.SortedMap.prototype.count = function() {\n  return this.root_.count();\n};\nfb.core.util.SortedMap.prototype.minKey = function() {\n  return this.root_.minKey();\n};\nfb.core.util.SortedMap.prototype.maxKey = function() {\n  return this.root_.maxKey();\n};\nfb.core.util.SortedMap.prototype.inorderTraversal = function(action) {\n  return this.root_.inorderTraversal(action);\n};\nfb.core.util.SortedMap.prototype.reverseTraversal = function(action) {\n  return this.root_.reverseTraversal(action);\n};\nfb.core.util.SortedMap.prototype.getIterator = function(opt_resultGenerator) {\n  return new fb.core.util.SortedMapIterator(this.root_, opt_resultGenerator);\n};\nfb.core.util.SortedMapIterator = function(node, opt_resultGenerator) {\n  this.resultGenerator_ = opt_resultGenerator;\n  this.nodeStack_ = [];\n  while (!node.isEmpty()) {\n    this.nodeStack_.push(node);\n    node = node.left;\n  }\n};\nfb.core.util.SortedMapIterator.prototype.getNext = function() {\n  if (this.nodeStack_.length === 0) {\n    return null;\n  }\n  var node = this.nodeStack_.pop(), result;\n  if (this.resultGenerator_) {\n    result = this.resultGenerator_(node.key, node.value);\n  } else {\n    result = {key:node.key, value:node.value};\n  }\n  node = node.right;\n  while (!node.isEmpty()) {\n    this.nodeStack_.push(node);\n    node = node.left;\n  }\n  return result;\n};\nfb.LLRBNode = function(key, value, color, left, right) {\n  this.key = key;\n  this.value = value;\n  this.color = color != null ? color : fb.LLRBNode.RED;\n  this.left = left != null ? left : fb.core.util.SortedMap.EMPTY_NODE_;\n  this.right = right != null ? right : fb.core.util.SortedMap.EMPTY_NODE_;\n};\nfb.LLRBNode.RED = true;\nfb.LLRBNode.BLACK = false;\nfb.LLRBNode.prototype.copy = function(key, value, color, left, right) {\n  return new fb.LLRBNode(key != null ? key : this.key, value != null ? value : this.value, color != null ? color : this.color, left != null ? left : this.left, right != null ? right : this.right);\n};\nfb.LLRBNode.prototype.count = function() {\n  return this.left.count() + 1 + this.right.count();\n};\nfb.LLRBNode.prototype.isEmpty = function() {\n  return false;\n};\nfb.LLRBNode.prototype.inorderTraversal = function(action) {\n  return this.left.inorderTraversal(action) || action(this.key, this.value) || this.right.inorderTraversal(action);\n};\nfb.LLRBNode.prototype.reverseTraversal = function(action) {\n  return this.right.reverseTraversal(action) || action(this.key, this.value) || this.left.reverseTraversal(action);\n};\nfb.LLRBNode.prototype.min_ = function() {\n  if (this.left.isEmpty()) {\n    return this;\n  } else {\n    return this.left.min_();\n  }\n};\nfb.LLRBNode.prototype.minKey = function() {\n  return this.min_().key;\n};\nfb.LLRBNode.prototype.maxKey = function() {\n  if (this.right.isEmpty()) {\n    return this.key;\n  } else {\n    return this.right.maxKey();\n  }\n};\nfb.LLRBNode.prototype.insert = function(key, value, comparator) {\n  var cmp, n;\n  n = this;\n  cmp = comparator(key, n.key);\n  if (cmp < 0) {\n    n = n.copy(null, null, null, n.left.insert(key, value, comparator), null);\n  } else {\n    if (cmp === 0) {\n      n = n.copy(null, value, null, null, null);\n    } else {\n      n = n.copy(null, null, null, null, n.right.insert(key, value, comparator));\n    }\n  }\n  return n.fixUp_();\n};\nfb.LLRBNode.prototype.removeMin_ = function() {\n  var n;\n  if (this.left.isEmpty()) {\n    return fb.core.util.SortedMap.EMPTY_NODE_;\n  }\n  n = this;\n  if (!n.left.isRed_() && !n.left.left.isRed_()) {\n    n = n.moveRedLeft_();\n  }\n  n = n.copy(null, null, null, n.left.removeMin_(), null);\n  return n.fixUp_();\n};\nfb.LLRBNode.prototype.remove = function(key, comparator) {\n  var n, smallest;\n  n = this;\n  if (comparator(key, n.key) < 0) {\n    if (!n.left.isEmpty() && !n.left.isRed_() && !n.left.left.isRed_()) {\n      n = n.moveRedLeft_();\n    }\n    n = n.copy(null, null, null, n.left.remove(key, comparator), null);\n  } else {\n    if (n.left.isRed_()) {\n      n = n.rotateRight_();\n    }\n    if (!n.right.isEmpty() && !n.right.isRed_() && !n.right.left.isRed_()) {\n      n = n.moveRedRight_();\n    }\n    if (comparator(key, n.key) === 0) {\n      if (n.right.isEmpty()) {\n        return fb.core.util.SortedMap.EMPTY_NODE_;\n      } else {\n        smallest = n.right.min_();\n        n = n.copy(smallest.key, smallest.value, null, null, n.right.removeMin_());\n      }\n    }\n    n = n.copy(null, null, null, null, n.right.remove(key, comparator));\n  }\n  return n.fixUp_();\n};\nfb.LLRBNode.prototype.isRed_ = function() {\n  return this.color;\n};\nfb.LLRBNode.prototype.fixUp_ = function() {\n  var n = this;\n  if (n.right.isRed_() && !n.left.isRed_()) {\n    n = n.rotateLeft_();\n  }\n  if (n.left.isRed_() && n.left.left.isRed_()) {\n    n = n.rotateRight_();\n  }\n  if (n.left.isRed_() && n.right.isRed_()) {\n    n = n.colorFlip_();\n  }\n  return n;\n};\nfb.LLRBNode.prototype.moveRedLeft_ = function() {\n  var n = this.colorFlip_();\n  if (n.right.left.isRed_()) {\n    n = n.copy(null, null, null, null, n.right.rotateRight_());\n    n = n.rotateLeft_();\n    n = n.colorFlip_();\n  }\n  return n;\n};\nfb.LLRBNode.prototype.moveRedRight_ = function() {\n  var n = this.colorFlip_();\n  if (n.left.left.isRed_()) {\n    n = n.rotateRight_();\n    n = n.colorFlip_();\n  }\n  return n;\n};\nfb.LLRBNode.prototype.rotateLeft_ = function() {\n  var nl;\n  nl = this.copy(null, null, fb.LLRBNode.RED, null, this.right.left);\n  return this.right.copy(null, null, this.color, nl, null);\n};\nfb.LLRBNode.prototype.rotateRight_ = function() {\n  var nr;\n  nr = this.copy(null, null, fb.LLRBNode.RED, this.left.right, null);\n  return this.left.copy(null, null, this.color, null, nr);\n};\nfb.LLRBNode.prototype.colorFlip_ = function() {\n  var left, right;\n  left = this.left.copy(null, null, !this.left.color, null, null);\n  right = this.right.copy(null, null, !this.right.color, null, null);\n  return this.copy(null, null, !this.color, left, right);\n};\nfb.LLRBNode.prototype.checkMaxDepth_ = function() {\n  var blackDepth;\n  blackDepth = this.check_();\n  if (Math.pow(2, blackDepth) <= this.count() + 1) {\n    return true;\n  } else {\n    return false;\n  }\n};\nfb.LLRBNode.prototype.check_ = function() {\n  var blackDepth;\n  if (this.isRed_() && this.left.isRed_()) {\n    throw new Error(\"Red node has red child(\" + this.key + \",\" + this.value + \")\");\n  }\n  if (this.right.isRed_()) {\n    throw new Error(\"Right child of (\" + this.key + \",\" + this.value + \") is red\");\n  }\n  blackDepth = this.left.check_();\n  if (blackDepth !== this.right.check_()) {\n    throw new Error(\"Black depths differ\");\n  } else {\n    return blackDepth + (this.isRed_() ? 0 : 1);\n  }\n};\nfb.LLRBEmptyNode = function() {\n};\nfb.LLRBEmptyNode.prototype.copy = function() {\n  return this;\n};\nfb.LLRBEmptyNode.prototype.insert = function(key, value, comparator) {\n  return new fb.LLRBNode(key, value, null);\n};\nfb.LLRBEmptyNode.prototype.remove = function(key, comparator) {\n  return this;\n};\nfb.LLRBEmptyNode.prototype.count = function() {\n  return 0;\n};\nfb.LLRBEmptyNode.prototype.isEmpty = function() {\n  return true;\n};\nfb.LLRBEmptyNode.prototype.inorderTraversal = function(action) {\n  return false;\n};\nfb.LLRBEmptyNode.prototype.reverseTraversal = function(action) {\n  return false;\n};\nfb.LLRBEmptyNode.prototype.minKey = function() {\n  return null;\n};\nfb.LLRBEmptyNode.prototype.maxKey = function() {\n  return null;\n};\nfb.LLRBEmptyNode.prototype.check_ = function() {\n  return 0;\n};\nfb.LLRBEmptyNode.prototype.isRed_ = function() {\n  return false;\n};\nfb.core.util.SortedMap.EMPTY_NODE_ = new fb.LLRBEmptyNode;\ngoog.provide(\"fb.core.storage.DOMStorageWrapper\");\ngoog.require(\"fb.util.obj\");\ngoog.scope(function() {\n  fb.core.storage.DOMStorageWrapper = function(domStorage) {\n    this.domStorage_ = domStorage;\n    this.prefix_ = \"firebase:\";\n  };\n  var DOMStorageWrapper = fb.core.storage.DOMStorageWrapper;\n  DOMStorageWrapper.prototype.set = function(key, value) {\n    if (value == null) {\n      this.domStorage_.removeItem(this.prefixedName_(key));\n    } else {\n      this.domStorage_.setItem(this.prefixedName_(key), fb.util.json.stringify(value));\n    }\n  };\n  DOMStorageWrapper.prototype.get = function(key) {\n    var storedVal = this.domStorage_.getItem(this.prefixedName_(key));\n    if (storedVal == null) {\n      return null;\n    } else {\n      return fb.util.json.eval(storedVal);\n    }\n  };\n  DOMStorageWrapper.prototype.remove = function(key) {\n    this.domStorage_.removeItem(this.prefixedName_(key));\n  };\n  DOMStorageWrapper.prototype.isInMemoryStorage = false;\n  DOMStorageWrapper.prototype.prefixedName_ = function(name) {\n    return this.prefix_ + name;\n  };\n});\ngoog.provide(\"fb.core.storage.MemoryStorage\");\ngoog.require(\"fb.util.obj\");\ngoog.scope(function() {\n  var obj = fb.util.obj;\n  fb.core.storage.MemoryStorage = function() {\n    this.cache_ = {};\n  };\n  var MemoryStorage = fb.core.storage.MemoryStorage;\n  MemoryStorage.prototype.set = function(key, value) {\n    if (value == null) {\n      delete this.cache_[key];\n    } else {\n      this.cache_[key] = value;\n    }\n  };\n  MemoryStorage.prototype.get = function(key) {\n    if (obj.contains(this.cache_, key)) {\n      return this.cache_[key];\n    }\n    return null;\n  };\n  MemoryStorage.prototype.remove = function(key) {\n    delete this.cache_[key];\n  };\n  MemoryStorage.prototype.isInMemoryStorage = true;\n});\ngoog.provide(\"fb.core.storage\");\ngoog.require(\"fb.core.storage.DOMStorageWrapper\");\ngoog.require(\"fb.core.storage.MemoryStorage\");\nfb.core.storage.createStoragefor = function(domStorageName) {\n  try {\n    if (typeof window !== \"undefined\" && typeof window[domStorageName] !== \"undefined\") {\n      var domStorage = window[domStorageName];\n      domStorage.setItem(\"firebase:sentinel\", \"cache\");\n      domStorage.removeItem(\"firebase:sentinel\");\n      return new fb.core.storage.DOMStorageWrapper(domStorage);\n    }\n  } catch (e) {\n  }\n  return new fb.core.storage.MemoryStorage;\n};\nfb.core.storage.PersistentStorage = fb.core.storage.createStoragefor(\"localStorage\");\nfb.core.storage.SessionStorage = fb.core.storage.createStoragefor(\"sessionStorage\");\ngoog.provide(\"fb.core.RepoInfo\");\ngoog.require(\"fb.core.storage\");\nfb.core.RepoInfo = function(host, secure, namespace, webSocketOnly) {\n  this.host = host.toLowerCase();\n  this.domain = this.host.substr(this.host.indexOf(\".\") + 1);\n  this.secure = secure;\n  this.namespace = namespace;\n  this.webSocketOnly = webSocketOnly;\n  this.internalHost = fb.core.storage.PersistentStorage.get(\"host:\" + host) || this.host;\n};\nfb.core.RepoInfo.prototype.needsQueryParam = function() {\n  return this.host !== this.internalHost;\n};\nfb.core.RepoInfo.prototype.isCacheableHost = function() {\n  return this.internalHost.substr(0, 2) === \"s-\";\n};\nfb.core.RepoInfo.prototype.isDemoHost = function() {\n  return this.domain === \"firebaseio-demo.com\";\n};\nfb.core.RepoInfo.prototype.updateHost = function(newHost) {\n  if (newHost !== this.internalHost) {\n    this.internalHost = newHost;\n    if (this.isCacheableHost()) {\n      fb.core.storage.PersistentStorage.set(\"host:\" + this.host, this.internalHost);\n    }\n  }\n};\nfb.core.RepoInfo.prototype.toString = function() {\n  return(this.secure ? \"https://\" : \"http://\") + this.host;\n};\ngoog.provide(\"fb.constants\");\nvar NODE_CLIENT = false;\nvar CLIENT_VERSION = \"0.0.0\";\ngoog.provide(\"sjcl\");\n\"use strict\";\nsjcl = {cipher:{}, hash:{}, keyexchange:{}, mode:{}, misc:{}, codec:{}, exception:{corrupt:function(a) {\n  this.toString = function() {\n    return \"CORRUPT: \" + this.message;\n  };\n  this.message = a;\n}, invalid:function(a) {\n  this.toString = function() {\n    return \"INVALID: \" + this.message;\n  };\n  this.message = a;\n}, bug:function(a) {\n  this.toString = function() {\n    return \"BUG: \" + this.message;\n  };\n  this.message = a;\n}, notReady:function(a) {\n  this.toString = function() {\n    return \"NOT READY: \" + this.message;\n  };\n  this.message = a;\n}}};\nsjcl.bitArray = {bitSlice:function(a, b, c) {\n  a = sjcl.bitArray.e(a.slice(b / 32), 32 - (b & 31)).slice(1);\n  return void 0 === c ? a : sjcl.bitArray.clamp(a, c - b);\n}, extract:function(a, b, c) {\n  var d = Math.floor(-b - c & 31);\n  return((b + c - 1 ^ b) & -32 ? a[b / 32 | 0] << 32 - d ^ a[b / 32 + 1 | 0] >>> d : a[b / 32 | 0] >>> d) & (1 << c) - 1;\n}, concat:function(a, b) {\n  if (0 === a.length || 0 === b.length) {\n    return a.concat(b);\n  }\n  var c = a[a.length - 1], d = sjcl.bitArray.getPartial(c);\n  return 32 === d ? a.concat(b) : sjcl.bitArray.e(b, d, c | 0, a.slice(0, a.length - 1));\n}, bitLength:function(a) {\n  var b = a.length;\n  return 0 === b ? 0 : 32 * (b - 1) + sjcl.bitArray.getPartial(a[b - 1]);\n}, clamp:function(a, b) {\n  if (32 * a.length < b) {\n    return a;\n  }\n  a = a.slice(0, Math.ceil(b / 32));\n  var c = a.length;\n  b &= 31;\n  0 < c && b && (a[c - 1] = sjcl.bitArray.partial(b, a[c - 1] & 2147483648 >> b - 1, 1));\n  return a;\n}, partial:function(a, b, c) {\n  return 32 === a ? b : (c ? b | 0 : b << 32 - a) + 1099511627776 * a;\n}, getPartial:function(a) {\n  return Math.round(a / 1099511627776) || 32;\n}, equal:function(a, b) {\n  if (sjcl.bitArray.bitLength(a) !== sjcl.bitArray.bitLength(b)) {\n    return!1;\n  }\n  var c = 0, d;\n  for (d = 0;d < a.length;d++) {\n    c |= a[d] ^ b[d];\n  }\n  return 0 === c;\n}, e:function(a, b, c, d) {\n  var e;\n  e = 0;\n  for (void 0 === d && (d = []);32 <= b;b -= 32) {\n    d.push(c), c = 0;\n  }\n  if (0 === b) {\n    return d.concat(a);\n  }\n  for (e = 0;e < a.length;e++) {\n    d.push(c | a[e] >>> b), c = a[e] << 32 - b;\n  }\n  e = a.length ? a[a.length - 1] : 0;\n  a = sjcl.bitArray.getPartial(e);\n  d.push(sjcl.bitArray.partial(b + a & 31, 32 < b + a ? c : d.pop(), 1));\n  return d;\n}, h:function(a, b) {\n  return[a[0] ^ b[0], a[1] ^ b[1], a[2] ^ b[2], a[3] ^ b[3]];\n}, byteswapM:function(a) {\n  var b, c;\n  for (b = 0;b < a.length;++b) {\n    c = a[b], a[b] = c >>> 24 | c >>> 8 & 65280 | (c & 65280) << 8 | c << 24;\n  }\n  return a;\n}};\nsjcl.codec.utf8String = {fromBits:function(a) {\n  var b = \"\", c = sjcl.bitArray.bitLength(a), d, e;\n  for (d = 0;d < c / 8;d++) {\n    0 === (d & 3) && (e = a[d / 4]), b += String.fromCharCode(e >>> 24), e <<= 8;\n  }\n  return decodeURIComponent(escape(b));\n}, toBits:function(a) {\n  a = unescape(encodeURIComponent(a));\n  var b = [], c, d = 0;\n  for (c = 0;c < a.length;c++) {\n    d = d << 8 | a.charCodeAt(c), 3 === (c & 3) && (b.push(d), d = 0);\n  }\n  c & 3 && b.push(sjcl.bitArray.partial(8 * (c & 3), d));\n  return b;\n}};\nsjcl.codec.base64 = {d:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\", fromBits:function(a, b, c) {\n  var d = \"\", e = 0, g = sjcl.codec.base64.d, f = 0, h = sjcl.bitArray.bitLength(a);\n  c && (g = g.substr(0, 62) + \"-_\");\n  for (c = 0;6 * d.length < h;) {\n    d += g.charAt((f ^ a[c] >>> e) >>> 26), 6 > e ? (f = a[c] << 6 - e, e += 26, c++) : (f <<= 6, e -= 6);\n  }\n  for (;d.length & 3 && !b;) {\n    d += \"=\";\n  }\n  return d;\n}, toBits:function(a, b) {\n  a = a.replace(/\\s|=/g, \"\");\n  var c = [], d, e = 0, g = sjcl.codec.base64.d, f = 0, h;\n  b && (g = g.substr(0, 62) + \"-_\");\n  for (d = 0;d < a.length;d++) {\n    h = g.indexOf(a.charAt(d));\n    if (0 > h) {\n      throw new sjcl.exception.invalid(\"this isn't base64!\");\n    }\n    26 < e ? (e -= 26, c.push(f ^ h >>> e), f = h << 32 - e) : (e += 6, f ^= h << 32 - e);\n  }\n  e & 56 && c.push(sjcl.bitArray.partial(e & 56, f, 1));\n  return c;\n}};\nsjcl.codec.base64url = {fromBits:function(a) {\n  return sjcl.codec.base64.fromBits(a, 1, 1);\n}, toBits:function(a) {\n  return sjcl.codec.base64.toBits(a, 1);\n}};\nsjcl.hash.sha1 = function(a) {\n  a ? (this.c = a.c.slice(0), this.b = a.b.slice(0), this.a = a.a) : this.reset();\n};\nsjcl.hash.sha1.hash = function(a) {\n  return(new sjcl.hash.sha1).update(a).finalize();\n};\nsjcl.hash.sha1.prototype = {blockSize:512, reset:function() {\n  this.c = this.f.slice(0);\n  this.b = [];\n  this.a = 0;\n  return this;\n}, update:function(a) {\n  \"string\" === typeof a && (a = sjcl.codec.utf8String.toBits(a));\n  var b, c = this.b = sjcl.bitArray.concat(this.b, a);\n  b = this.a;\n  a = this.a = b + sjcl.bitArray.bitLength(a);\n  for (b = this.blockSize + b & -this.blockSize;b <= a;b += this.blockSize) {\n    n(this, c.splice(0, 16));\n  }\n  return this;\n}, finalize:function() {\n  var a, b = this.b, c = this.c, b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1, 1)]);\n  for (a = b.length + 2;a & 15;a++) {\n    b.push(0);\n  }\n  b.push(Math.floor(this.a / 4294967296));\n  for (b.push(this.a | 0);b.length;) {\n    n(this, b.splice(0, 16));\n  }\n  this.reset();\n  return c;\n}, f:[1732584193, 4023233417, 2562383102, 271733878, 3285377520], g:[1518500249, 1859775393, 2400959708, 3395469782]};\nfunction n(a, b) {\n  var c, d, e, g, f, h, m, l = b.slice(0), k = a.c;\n  e = k[0];\n  g = k[1];\n  f = k[2];\n  h = k[3];\n  m = k[4];\n  for (c = 0;79 >= c;c++) {\n    16 <= c && (l[c] = (l[c - 3] ^ l[c - 8] ^ l[c - 14] ^ l[c - 16]) << 1 | (l[c - 3] ^ l[c - 8] ^ l[c - 14] ^ l[c - 16]) >>> 31), d = 19 >= c ? g & f | ~g & h : 39 >= c ? g ^ f ^ h : 59 >= c ? g & f | g & h | f & h : 79 >= c ? g ^ f ^ h : void 0, d = (e << 5 | e >>> 27) + d + m + l[c] + a.g[Math.floor(c / 20)] | 0, m = h, h = f, f = g << 30 | g >>> 2, g = e, e = d;\n  }\n  k[0] = k[0] + e | 0;\n  k[1] = k[1] + g | 0;\n  k[2] = k[2] + f | 0;\n  k[3] = k[3] + h | 0;\n  k[4] = k[4] + m | 0;\n}\n;goog.provide(\"goog.dom.NodeType\");\ngoog.dom.NodeType = {ELEMENT:1, ATTRIBUTE:2, TEXT:3, CDATA_SECTION:4, ENTITY_REFERENCE:5, ENTITY:6, PROCESSING_INSTRUCTION:7, COMMENT:8, DOCUMENT:9, DOCUMENT_TYPE:10, DOCUMENT_FRAGMENT:11, NOTATION:12};\ngoog.provide(\"goog.debug.Error\");\ngoog.debug.Error = function(opt_msg) {\n  if (Error.captureStackTrace) {\n    Error.captureStackTrace(this, goog.debug.Error);\n  } else {\n    var stack = (new Error).stack;\n    if (stack) {\n      this.stack = stack;\n    }\n  }\n  if (opt_msg) {\n    this.message = String(opt_msg);\n  }\n};\ngoog.inherits(goog.debug.Error, Error);\ngoog.debug.Error.prototype.name = \"CustomError\";\ngoog.provide(\"goog.string\");\ngoog.provide(\"goog.string.Unicode\");\ngoog.define(\"goog.string.DETECT_DOUBLE_ESCAPING\", false);\ngoog.string.Unicode = {NBSP:\"\\u00a0\"};\ngoog.string.startsWith = function(str, prefix) {\n  return str.lastIndexOf(prefix, 0) == 0;\n};\ngoog.string.endsWith = function(str, suffix) {\n  var l = str.length - suffix.length;\n  return l >= 0 && str.indexOf(suffix, l) == l;\n};\ngoog.string.caseInsensitiveStartsWith = function(str, prefix) {\n  return goog.string.caseInsensitiveCompare(prefix, str.substr(0, prefix.length)) == 0;\n};\ngoog.string.caseInsensitiveEndsWith = function(str, suffix) {\n  return goog.string.caseInsensitiveCompare(suffix, str.substr(str.length - suffix.length, suffix.length)) == 0;\n};\ngoog.string.caseInsensitiveEquals = function(str1, str2) {\n  return str1.toLowerCase() == str2.toLowerCase();\n};\ngoog.string.subs = function(str, var_args) {\n  var splitParts = str.split(\"%s\");\n  var returnString = \"\";\n  var subsArguments = Array.prototype.slice.call(arguments, 1);\n  while (subsArguments.length && splitParts.length > 1) {\n    returnString += splitParts.shift() + subsArguments.shift();\n  }\n  return returnString + splitParts.join(\"%s\");\n};\ngoog.string.collapseWhitespace = function(str) {\n  return str.replace(/[\\s\\xa0]+/g, \" \").replace(/^\\s+|\\s+$/g, \"\");\n};\ngoog.string.isEmpty = function(str) {\n  return/^[\\s\\xa0]*$/.test(str);\n};\ngoog.string.isEmptySafe = function(str) {\n  return goog.string.isEmpty(goog.string.makeSafe(str));\n};\ngoog.string.isBreakingWhitespace = function(str) {\n  return!/[^\\t\\n\\r ]/.test(str);\n};\ngoog.string.isAlpha = function(str) {\n  return!/[^a-zA-Z]/.test(str);\n};\ngoog.string.isNumeric = function(str) {\n  return!/[^0-9]/.test(str);\n};\ngoog.string.isAlphaNumeric = function(str) {\n  return!/[^a-zA-Z0-9]/.test(str);\n};\ngoog.string.isSpace = function(ch) {\n  return ch == \" \";\n};\ngoog.string.isUnicodeChar = function(ch) {\n  return ch.length == 1 && ch >= \" \" && ch <= \"~\" || ch >= \"\\u0080\" && ch <= \"\\ufffd\";\n};\ngoog.string.stripNewlines = function(str) {\n  return str.replace(/(\\r\\n|\\r|\\n)+/g, \" \");\n};\ngoog.string.canonicalizeNewlines = function(str) {\n  return str.replace(/(\\r\\n|\\r|\\n)/g, \"\\n\");\n};\ngoog.string.normalizeWhitespace = function(str) {\n  return str.replace(/\\xa0|\\s/g, \" \");\n};\ngoog.string.normalizeSpaces = function(str) {\n  return str.replace(/\\xa0|[ \\t]+/g, \" \");\n};\ngoog.string.collapseBreakingSpaces = function(str) {\n  return str.replace(/[\\t\\r\\n ]+/g, \" \").replace(/^[\\t\\r\\n ]+|[\\t\\r\\n ]+$/g, \"\");\n};\ngoog.string.trim = function(str) {\n  return str.replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g, \"\");\n};\ngoog.string.trimLeft = function(str) {\n  return str.replace(/^[\\s\\xa0]+/, \"\");\n};\ngoog.string.trimRight = function(str) {\n  return str.replace(/[\\s\\xa0]+$/, \"\");\n};\ngoog.string.caseInsensitiveCompare = function(str1, str2) {\n  var test1 = String(str1).toLowerCase();\n  var test2 = String(str2).toLowerCase();\n  if (test1 < test2) {\n    return-1;\n  } else {\n    if (test1 == test2) {\n      return 0;\n    } else {\n      return 1;\n    }\n  }\n};\ngoog.string.numerateCompareRegExp_ = /(\\.\\d+)|(\\d+)|(\\D+)/g;\ngoog.string.numerateCompare = function(str1, str2) {\n  if (str1 == str2) {\n    return 0;\n  }\n  if (!str1) {\n    return-1;\n  }\n  if (!str2) {\n    return 1;\n  }\n  var tokens1 = str1.toLowerCase().match(goog.string.numerateCompareRegExp_);\n  var tokens2 = str2.toLowerCase().match(goog.string.numerateCompareRegExp_);\n  var count = Math.min(tokens1.length, tokens2.length);\n  for (var i = 0;i < count;i++) {\n    var a = tokens1[i];\n    var b = tokens2[i];\n    if (a != b) {\n      var num1 = parseInt(a, 10);\n      if (!isNaN(num1)) {\n        var num2 = parseInt(b, 10);\n        if (!isNaN(num2) && num1 - num2) {\n          return num1 - num2;\n        }\n      }\n      return a < b ? -1 : 1;\n    }\n  }\n  if (tokens1.length != tokens2.length) {\n    return tokens1.length - tokens2.length;\n  }\n  return str1 < str2 ? -1 : 1;\n};\ngoog.string.urlEncode = function(str) {\n  return encodeURIComponent(String(str));\n};\ngoog.string.urlDecode = function(str) {\n  return decodeURIComponent(str.replace(/\\+/g, \" \"));\n};\ngoog.string.newLineToBr = function(str, opt_xml) {\n  return str.replace(/(\\r\\n|\\r|\\n)/g, opt_xml ? \"<br />\" : \"<br>\");\n};\ngoog.string.htmlEscape = function(str, opt_isLikelyToContainHtmlChars) {\n  if (opt_isLikelyToContainHtmlChars) {\n    str = str.replace(goog.string.AMP_RE_, \"&amp;\").replace(goog.string.LT_RE_, \"&lt;\").replace(goog.string.GT_RE_, \"&gt;\").replace(goog.string.QUOT_RE_, \"&quot;\").replace(goog.string.SINGLE_QUOTE_RE_, \"&#39;\").replace(goog.string.NULL_RE_, \"&#0;\");\n    if (goog.string.DETECT_DOUBLE_ESCAPING) {\n      str = str.replace(goog.string.E_RE_, \"&#101;\");\n    }\n    return str;\n  } else {\n    if (!goog.string.ALL_RE_.test(str)) {\n      return str;\n    }\n    if (str.indexOf(\"&\") != -1) {\n      str = str.replace(goog.string.AMP_RE_, \"&amp;\");\n    }\n    if (str.indexOf(\"<\") != -1) {\n      str = str.replace(goog.string.LT_RE_, \"&lt;\");\n    }\n    if (str.indexOf(\">\") != -1) {\n      str = str.replace(goog.string.GT_RE_, \"&gt;\");\n    }\n    if (str.indexOf('\"') != -1) {\n      str = str.replace(goog.string.QUOT_RE_, \"&quot;\");\n    }\n    if (str.indexOf(\"'\") != -1) {\n      str = str.replace(goog.string.SINGLE_QUOTE_RE_, \"&#39;\");\n    }\n    if (str.indexOf(\"\\x00\") != -1) {\n      str = str.replace(goog.string.NULL_RE_, \"&#0;\");\n    }\n    if (goog.string.DETECT_DOUBLE_ESCAPING && str.indexOf(\"e\") != -1) {\n      str = str.replace(goog.string.E_RE_, \"&#101;\");\n    }\n    return str;\n  }\n};\ngoog.string.AMP_RE_ = /&/g;\ngoog.string.LT_RE_ = /</g;\ngoog.string.GT_RE_ = />/g;\ngoog.string.QUOT_RE_ = /\"/g;\ngoog.string.SINGLE_QUOTE_RE_ = /'/g;\ngoog.string.NULL_RE_ = /\\x00/g;\ngoog.string.E_RE_ = /e/g;\ngoog.string.ALL_RE_ = goog.string.DETECT_DOUBLE_ESCAPING ? /[\\x00&<>\"'e]/ : /[\\x00&<>\"']/;\ngoog.string.unescapeEntities = function(str) {\n  if (goog.string.contains(str, \"&\")) {\n    if (\"document\" in goog.global) {\n      return goog.string.unescapeEntitiesUsingDom_(str);\n    } else {\n      return goog.string.unescapePureXmlEntities_(str);\n    }\n  }\n  return str;\n};\ngoog.string.unescapeEntitiesWithDocument = function(str, document) {\n  if (goog.string.contains(str, \"&\")) {\n    return goog.string.unescapeEntitiesUsingDom_(str, document);\n  }\n  return str;\n};\ngoog.string.unescapeEntitiesUsingDom_ = function(str, opt_document) {\n  var seen = {\"&amp;\":\"&\", \"&lt;\":\"<\", \"&gt;\":\">\", \"&quot;\":'\"'};\n  var div;\n  if (opt_document) {\n    div = opt_document.createElement(\"div\");\n  } else {\n    div = goog.global.document.createElement(\"div\");\n  }\n  return str.replace(goog.string.HTML_ENTITY_PATTERN_, function(s, entity) {\n    var value = seen[s];\n    if (value) {\n      return value;\n    }\n    if (entity.charAt(0) == \"#\") {\n      var n = Number(\"0\" + entity.substr(1));\n      if (!isNaN(n)) {\n        value = String.fromCharCode(n);\n      }\n    }\n    if (!value) {\n      div.innerHTML = s + \" \";\n      value = div.firstChild.nodeValue.slice(0, -1);\n    }\n    return seen[s] = value;\n  });\n};\ngoog.string.unescapePureXmlEntities_ = function(str) {\n  return str.replace(/&([^;]+);/g, function(s, entity) {\n    switch(entity) {\n      case \"amp\":\n        return \"&\";\n      case \"lt\":\n        return \"<\";\n      case \"gt\":\n        return \">\";\n      case \"quot\":\n        return'\"';\n      default:\n        if (entity.charAt(0) == \"#\") {\n          var n = Number(\"0\" + entity.substr(1));\n          if (!isNaN(n)) {\n            return String.fromCharCode(n);\n          }\n        }\n        return s;\n    }\n  });\n};\ngoog.string.HTML_ENTITY_PATTERN_ = /&([^;\\s<&]+);?/g;\ngoog.string.whitespaceEscape = function(str, opt_xml) {\n  return goog.string.newLineToBr(str.replace(/  /g, \" &#160;\"), opt_xml);\n};\ngoog.string.preserveSpaces = function(str) {\n  return str.replace(/(^|[\\n ]) /g, \"$1\" + goog.string.Unicode.NBSP);\n};\ngoog.string.stripQuotes = function(str, quoteChars) {\n  var length = quoteChars.length;\n  for (var i = 0;i < length;i++) {\n    var quoteChar = length == 1 ? quoteChars : quoteChars.charAt(i);\n    if (str.charAt(0) == quoteChar && str.charAt(str.length - 1) == quoteChar) {\n      return str.substring(1, str.length - 1);\n    }\n  }\n  return str;\n};\ngoog.string.truncate = function(str, chars, opt_protectEscapedCharacters) {\n  if (opt_protectEscapedCharacters) {\n    str = goog.string.unescapeEntities(str);\n  }\n  if (str.length > chars) {\n    str = str.substring(0, chars - 3) + \"...\";\n  }\n  if (opt_protectEscapedCharacters) {\n    str = goog.string.htmlEscape(str);\n  }\n  return str;\n};\ngoog.string.truncateMiddle = function(str, chars, opt_protectEscapedCharacters, opt_trailingChars) {\n  if (opt_protectEscapedCharacters) {\n    str = goog.string.unescapeEntities(str);\n  }\n  if (opt_trailingChars && str.length > chars) {\n    if (opt_trailingChars > chars) {\n      opt_trailingChars = chars;\n    }\n    var endPoint = str.length - opt_trailingChars;\n    var startPoint = chars - opt_trailingChars;\n    str = str.substring(0, startPoint) + \"...\" + str.substring(endPoint);\n  } else {\n    if (str.length > chars) {\n      var half = Math.floor(chars / 2);\n      var endPos = str.length - half;\n      half += chars % 2;\n      str = str.substring(0, half) + \"...\" + str.substring(endPos);\n    }\n  }\n  if (opt_protectEscapedCharacters) {\n    str = goog.string.htmlEscape(str);\n  }\n  return str;\n};\ngoog.string.specialEscapeChars_ = {\"\\x00\":\"\\\\0\", \"\\b\":\"\\\\b\", \"\\f\":\"\\\\f\", \"\\n\":\"\\\\n\", \"\\r\":\"\\\\r\", \"\\t\":\"\\\\t\", \"\\x0B\":\"\\\\x0B\", '\"':'\\\\\"', \"\\\\\":\"\\\\\\\\\"};\ngoog.string.jsEscapeCache_ = {\"'\":\"\\\\'\"};\ngoog.string.quote = function(s) {\n  s = String(s);\n  if (s.quote) {\n    return s.quote();\n  } else {\n    var sb = ['\"'];\n    for (var i = 0;i < s.length;i++) {\n      var ch = s.charAt(i);\n      var cc = ch.charCodeAt(0);\n      sb[i + 1] = goog.string.specialEscapeChars_[ch] || (cc > 31 && cc < 127 ? ch : goog.string.escapeChar(ch));\n    }\n    sb.push('\"');\n    return sb.join(\"\");\n  }\n};\ngoog.string.escapeString = function(str) {\n  var sb = [];\n  for (var i = 0;i < str.length;i++) {\n    sb[i] = goog.string.escapeChar(str.charAt(i));\n  }\n  return sb.join(\"\");\n};\ngoog.string.escapeChar = function(c) {\n  if (c in goog.string.jsEscapeCache_) {\n    return goog.string.jsEscapeCache_[c];\n  }\n  if (c in goog.string.specialEscapeChars_) {\n    return goog.string.jsEscapeCache_[c] = goog.string.specialEscapeChars_[c];\n  }\n  var rv = c;\n  var cc = c.charCodeAt(0);\n  if (cc > 31 && cc < 127) {\n    rv = c;\n  } else {\n    if (cc < 256) {\n      rv = \"\\\\x\";\n      if (cc < 16 || cc > 256) {\n        rv += \"0\";\n      }\n    } else {\n      rv = \"\\\\u\";\n      if (cc < 4096) {\n        rv += \"0\";\n      }\n    }\n    rv += cc.toString(16).toUpperCase();\n  }\n  return goog.string.jsEscapeCache_[c] = rv;\n};\ngoog.string.toMap = function(s) {\n  var rv = {};\n  for (var i = 0;i < s.length;i++) {\n    rv[s.charAt(i)] = true;\n  }\n  return rv;\n};\ngoog.string.contains = function(str, subString) {\n  return str.indexOf(subString) != -1;\n};\ngoog.string.caseInsensitiveContains = function(str, subString) {\n  return goog.string.contains(str.toLowerCase(), subString.toLowerCase());\n};\ngoog.string.countOf = function(s, ss) {\n  return s && ss ? s.split(ss).length - 1 : 0;\n};\ngoog.string.removeAt = function(s, index, stringLength) {\n  var resultStr = s;\n  if (index >= 0 && index < s.length && stringLength > 0) {\n    resultStr = s.substr(0, index) + s.substr(index + stringLength, s.length - index - stringLength);\n  }\n  return resultStr;\n};\ngoog.string.remove = function(s, ss) {\n  var re = new RegExp(goog.string.regExpEscape(ss), \"\");\n  return s.replace(re, \"\");\n};\ngoog.string.removeAll = function(s, ss) {\n  var re = new RegExp(goog.string.regExpEscape(ss), \"g\");\n  return s.replace(re, \"\");\n};\ngoog.string.regExpEscape = function(s) {\n  return String(s).replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, \"\\\\$1\").replace(/\\x08/g, \"\\\\x08\");\n};\ngoog.string.repeat = function(string, length) {\n  return(new Array(length + 1)).join(string);\n};\ngoog.string.padNumber = function(num, length, opt_precision) {\n  var s = goog.isDef(opt_precision) ? num.toFixed(opt_precision) : String(num);\n  var index = s.indexOf(\".\");\n  if (index == -1) {\n    index = s.length;\n  }\n  return goog.string.repeat(\"0\", Math.max(0, length - index)) + s;\n};\ngoog.string.makeSafe = function(obj) {\n  return obj == null ? \"\" : String(obj);\n};\ngoog.string.buildString = function(var_args) {\n  return Array.prototype.join.call(arguments, \"\");\n};\ngoog.string.getRandomString = function() {\n  var x = 2147483648;\n  return Math.floor(Math.random() * x).toString(36) + Math.abs(Math.floor(Math.random() * x) ^ goog.now()).toString(36);\n};\ngoog.string.compareVersions = function(version1, version2) {\n  var order = 0;\n  var v1Subs = goog.string.trim(String(version1)).split(\".\");\n  var v2Subs = goog.string.trim(String(version2)).split(\".\");\n  var subCount = Math.max(v1Subs.length, v2Subs.length);\n  for (var subIdx = 0;order == 0 && subIdx < subCount;subIdx++) {\n    var v1Sub = v1Subs[subIdx] || \"\";\n    var v2Sub = v2Subs[subIdx] || \"\";\n    var v1CompParser = new RegExp(\"(\\\\d*)(\\\\D*)\", \"g\");\n    var v2CompParser = new RegExp(\"(\\\\d*)(\\\\D*)\", \"g\");\n    do {\n      var v1Comp = v1CompParser.exec(v1Sub) || [\"\", \"\", \"\"];\n      var v2Comp = v2CompParser.exec(v2Sub) || [\"\", \"\", \"\"];\n      if (v1Comp[0].length == 0 && v2Comp[0].length == 0) {\n        break;\n      }\n      var v1CompNum = v1Comp[1].length == 0 ? 0 : parseInt(v1Comp[1], 10);\n      var v2CompNum = v2Comp[1].length == 0 ? 0 : parseInt(v2Comp[1], 10);\n      order = goog.string.compareElements_(v1CompNum, v2CompNum) || goog.string.compareElements_(v1Comp[2].length == 0, v2Comp[2].length == 0) || goog.string.compareElements_(v1Comp[2], v2Comp[2]);\n    } while (order == 0);\n  }\n  return order;\n};\ngoog.string.compareElements_ = function(left, right) {\n  if (left < right) {\n    return-1;\n  } else {\n    if (left > right) {\n      return 1;\n    }\n  }\n  return 0;\n};\ngoog.string.HASHCODE_MAX_ = 4294967296;\ngoog.string.hashCode = function(str) {\n  var result = 0;\n  for (var i = 0;i < str.length;++i) {\n    result = 31 * result + str.charCodeAt(i);\n    result %= goog.string.HASHCODE_MAX_;\n  }\n  return result;\n};\ngoog.string.uniqueStringCounter_ = Math.random() * 2147483648 | 0;\ngoog.string.createUniqueString = function() {\n  return \"goog_\" + goog.string.uniqueStringCounter_++;\n};\ngoog.string.toNumber = function(str) {\n  var num = Number(str);\n  if (num == 0 && goog.string.isEmpty(str)) {\n    return NaN;\n  }\n  return num;\n};\ngoog.string.isLowerCamelCase = function(str) {\n  return/^[a-z]+([A-Z][a-z]*)*$/.test(str);\n};\ngoog.string.isUpperCamelCase = function(str) {\n  return/^([A-Z][a-z]*)+$/.test(str);\n};\ngoog.string.toCamelCase = function(str) {\n  return String(str).replace(/\\-([a-z])/g, function(all, match) {\n    return match.toUpperCase();\n  });\n};\ngoog.string.toSelectorCase = function(str) {\n  return String(str).replace(/([A-Z])/g, \"-$1\").toLowerCase();\n};\ngoog.string.toTitleCase = function(str, opt_delimiters) {\n  var delimiters = goog.isString(opt_delimiters) ? goog.string.regExpEscape(opt_delimiters) : \"\\\\s\";\n  delimiters = delimiters ? \"|[\" + delimiters + \"]+\" : \"\";\n  var regexp = new RegExp(\"(^\" + delimiters + \")([a-z])\", \"g\");\n  return str.replace(regexp, function(all, p1, p2) {\n    return p1 + p2.toUpperCase();\n  });\n};\ngoog.string.parseInt = function(value) {\n  if (isFinite(value)) {\n    value = String(value);\n  }\n  if (goog.isString(value)) {\n    return/^\\s*-?0x/i.test(value) ? parseInt(value, 16) : parseInt(value, 10);\n  }\n  return NaN;\n};\ngoog.string.splitLimit = function(str, separator, limit) {\n  var parts = str.split(separator);\n  var returnVal = [];\n  while (limit > 0 && parts.length) {\n    returnVal.push(parts.shift());\n    limit--;\n  }\n  if (parts.length) {\n    returnVal.push(parts.join(separator));\n  }\n  return returnVal;\n};\ngoog.provide(\"goog.asserts\");\ngoog.provide(\"goog.asserts.AssertionError\");\ngoog.require(\"goog.debug.Error\");\ngoog.require(\"goog.dom.NodeType\");\ngoog.require(\"goog.string\");\ngoog.define(\"goog.asserts.ENABLE_ASSERTS\", goog.DEBUG);\ngoog.asserts.AssertionError = function(messagePattern, messageArgs) {\n  messageArgs.unshift(messagePattern);\n  goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs));\n  messageArgs.shift();\n  this.messagePattern = messagePattern;\n};\ngoog.inherits(goog.asserts.AssertionError, goog.debug.Error);\ngoog.asserts.AssertionError.prototype.name = \"AssertionError\";\ngoog.asserts.doAssertFailure_ = function(defaultMessage, defaultArgs, givenMessage, givenArgs) {\n  var message = \"Assertion failed\";\n  if (givenMessage) {\n    message += \": \" + givenMessage;\n    var args = givenArgs;\n  } else {\n    if (defaultMessage) {\n      message += \": \" + defaultMessage;\n      args = defaultArgs;\n    }\n  }\n  throw new goog.asserts.AssertionError(\"\" + message, args || []);\n};\ngoog.asserts.assert = function(condition, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && !condition) {\n    goog.asserts.doAssertFailure_(\"\", null, opt_message, Array.prototype.slice.call(arguments, 2));\n  }\n  return condition;\n};\ngoog.asserts.fail = function(opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS) {\n    throw new goog.asserts.AssertionError(\"Failure\" + (opt_message ? \": \" + opt_message : \"\"), Array.prototype.slice.call(arguments, 1));\n  }\n};\ngoog.asserts.assertNumber = function(value, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value)) {\n    goog.asserts.doAssertFailure_(\"Expected number but got %s: %s.\", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));\n  }\n  return(value);\n};\ngoog.asserts.assertString = function(value, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && !goog.isString(value)) {\n    goog.asserts.doAssertFailure_(\"Expected string but got %s: %s.\", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));\n  }\n  return(value);\n};\ngoog.asserts.assertFunction = function(value, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value)) {\n    goog.asserts.doAssertFailure_(\"Expected function but got %s: %s.\", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));\n  }\n  return(value);\n};\ngoog.asserts.assertObject = function(value, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) {\n    goog.asserts.doAssertFailure_(\"Expected object but got %s: %s.\", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));\n  }\n  return(value);\n};\ngoog.asserts.assertArray = function(value, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && !goog.isArray(value)) {\n    goog.asserts.doAssertFailure_(\"Expected array but got %s: %s.\", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));\n  }\n  return(value);\n};\ngoog.asserts.assertBoolean = function(value, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value)) {\n    goog.asserts.doAssertFailure_(\"Expected boolean but got %s: %s.\", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));\n  }\n  return(value);\n};\ngoog.asserts.assertElement = function(value, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && (!goog.isObject(value) || value.nodeType != goog.dom.NodeType.ELEMENT)) {\n    goog.asserts.doAssertFailure_(\"Expected Element but got %s: %s.\", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));\n  }\n  return(value);\n};\ngoog.asserts.assertInstanceof = function(value, type, opt_message, var_args) {\n  if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) {\n    goog.asserts.doAssertFailure_(\"instanceof check failed.\", null, opt_message, Array.prototype.slice.call(arguments, 3));\n  }\n  return value;\n};\ngoog.asserts.assertObjectPrototypeIsIntact = function() {\n  for (var key in Object.prototype) {\n    goog.asserts.fail(key + \" should not be enumerable in Object.prototype.\");\n  }\n};\ngoog.provide(\"goog.array\");\ngoog.provide(\"goog.array.ArrayLike\");\ngoog.require(\"goog.asserts\");\ngoog.define(\"goog.NATIVE_ARRAY_PROTOTYPES\", goog.TRUSTED_SITE);\ngoog.define(\"goog.array.ASSUME_NATIVE_FUNCTIONS\", false);\ngoog.array.ArrayLike;\ngoog.array.peek = function(array) {\n  return array[array.length - 1];\n};\ngoog.array.last = goog.array.peek;\ngoog.array.ARRAY_PROTOTYPE_ = Array.prototype;\ngoog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.indexOf) ? function(arr, obj, opt_fromIndex) {\n  goog.asserts.assert(arr.length != null);\n  return goog.array.ARRAY_PROTOTYPE_.indexOf.call(arr, obj, opt_fromIndex);\n} : function(arr, obj, opt_fromIndex) {\n  var fromIndex = opt_fromIndex == null ? 0 : opt_fromIndex < 0 ? Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex;\n  if (goog.isString(arr)) {\n    if (!goog.isString(obj) || obj.length != 1) {\n      return-1;\n    }\n    return arr.indexOf(obj, fromIndex);\n  }\n  for (var i = fromIndex;i < arr.length;i++) {\n    if (i in arr && arr[i] === obj) {\n      return i;\n    }\n  }\n  return-1;\n};\ngoog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.lastIndexOf) ? function(arr, obj, opt_fromIndex) {\n  goog.asserts.assert(arr.length != null);\n  var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;\n  return goog.array.ARRAY_PROTOTYPE_.lastIndexOf.call(arr, obj, fromIndex);\n} : function(arr, obj, opt_fromIndex) {\n  var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;\n  if (fromIndex < 0) {\n    fromIndex = Math.max(0, arr.length + fromIndex);\n  }\n  if (goog.isString(arr)) {\n    if (!goog.isString(obj) || obj.length != 1) {\n      return-1;\n    }\n    return arr.lastIndexOf(obj, fromIndex);\n  }\n  for (var i = fromIndex;i >= 0;i--) {\n    if (i in arr && arr[i] === obj) {\n      return i;\n    }\n  }\n  return-1;\n};\ngoog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.forEach) ? function(arr, f, opt_obj) {\n  goog.asserts.assert(arr.length != null);\n  goog.array.ARRAY_PROTOTYPE_.forEach.call(arr, f, opt_obj);\n} : function(arr, f, opt_obj) {\n  var l = arr.length;\n  var arr2 = goog.isString(arr) ? arr.split(\"\") : arr;\n  for (var i = 0;i < l;i++) {\n    if (i in arr2) {\n      f.call(opt_obj, arr2[i], i, arr);\n    }\n  }\n};\ngoog.array.forEachRight = function(arr, f, opt_obj) {\n  var l = arr.length;\n  var arr2 = goog.isString(arr) ? arr.split(\"\") : arr;\n  for (var i = l - 1;i >= 0;--i) {\n    if (i in arr2) {\n      f.call(opt_obj, arr2[i], i, arr);\n    }\n  }\n};\ngoog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.filter) ? function(arr, f, opt_obj) {\n  goog.asserts.assert(arr.length != null);\n  return goog.array.ARRAY_PROTOTYPE_.filter.call(arr, f, opt_obj);\n} : function(arr, f, opt_obj) {\n  var l = arr.length;\n  var res = [];\n  var resLength = 0;\n  var arr2 = goog.isString(arr) ? arr.split(\"\") : arr;\n  for (var i = 0;i < l;i++) {\n    if (i in arr2) {\n      var val = arr2[i];\n      if (f.call(opt_obj, val, i, arr)) {\n        res[resLength++] = val;\n      }\n    }\n  }\n  return res;\n};\ngoog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.map) ? function(arr, f, opt_obj) {\n  goog.asserts.assert(arr.length != null);\n  return goog.array.ARRAY_PROTOTYPE_.map.call(arr, f, opt_obj);\n} : function(arr, f, opt_obj) {\n  var l = arr.length;\n  var res = new Array(l);\n  var arr2 = goog.isString(arr) ? arr.split(\"\") : arr;\n  for (var i = 0;i < l;i++) {\n    if (i in arr2) {\n      res[i] = f.call(opt_obj, arr2[i], i, arr);\n    }\n  }\n  return res;\n};\ngoog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.reduce) ? function(arr, f, val, opt_obj) {\n  goog.asserts.assert(arr.length != null);\n  if (opt_obj) {\n    f = goog.bind(f, opt_obj);\n  }\n  return goog.array.ARRAY_PROTOTYPE_.reduce.call(arr, f, val);\n} : function(arr, f, val, opt_obj) {\n  var rval = val;\n  goog.array.forEach(arr, function(val, index) {\n    rval = f.call(opt_obj, rval, val, index, arr);\n  });\n  return rval;\n};\ngoog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.reduceRight) ? function(arr, f, val, opt_obj) {\n  goog.asserts.assert(arr.length != null);\n  if (opt_obj) {\n    f = goog.bind(f, opt_obj);\n  }\n  return goog.array.ARRAY_PROTOTYPE_.reduceRight.call(arr, f, val);\n} : function(arr, f, val, opt_obj) {\n  var rval = val;\n  goog.array.forEachRight(arr, function(val, index) {\n    rval = f.call(opt_obj, rval, val, index, arr);\n  });\n  return rval;\n};\ngoog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.some) ? function(arr, f, opt_obj) {\n  goog.asserts.assert(arr.length != null);\n  return goog.array.ARRAY_PROTOTYPE_.some.call(arr, f, opt_obj);\n} : function(arr, f, opt_obj) {\n  var l = arr.length;\n  var arr2 = goog.isString(arr) ? arr.split(\"\") : arr;\n  for (var i = 0;i < l;i++) {\n    if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {\n      return true;\n    }\n  }\n  return false;\n};\ngoog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || goog.array.ARRAY_PROTOTYPE_.every) ? function(arr, f, opt_obj) {\n  goog.asserts.assert(arr.length != null);\n  return goog.array.ARRAY_PROTOTYPE_.every.call(arr, f, opt_obj);\n} : function(arr, f, opt_obj) {\n  var l = arr.length;\n  var arr2 = goog.isString(arr) ? arr.split(\"\") : arr;\n  for (var i = 0;i < l;i++) {\n    if (i in arr2 && !f.call(opt_obj, arr2[i], i, arr)) {\n      return false;\n    }\n  }\n  return true;\n};\ngoog.array.count = function(arr, f, opt_obj) {\n  var count = 0;\n  goog.array.forEach(arr, function(element, index, arr) {\n    if (f.call(opt_obj, element, index, arr)) {\n      ++count;\n    }\n  }, opt_obj);\n  return count;\n};\ngoog.array.find = function(arr, f, opt_obj) {\n  var i = goog.array.findIndex(arr, f, opt_obj);\n  return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];\n};\ngoog.array.findIndex = function(arr, f, opt_obj) {\n  var l = arr.length;\n  var arr2 = goog.isString(arr) ? arr.split(\"\") : arr;\n  for (var i = 0;i < l;i++) {\n    if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {\n      return i;\n    }\n  }\n  return-1;\n};\ngoog.array.findRight = function(arr, f, opt_obj) {\n  var i = goog.array.findIndexRight(arr, f, opt_obj);\n  return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];\n};\ngoog.array.findIndexRight = function(arr, f, opt_obj) {\n  var l = arr.length;\n  var arr2 = goog.isString(arr) ? arr.split(\"\") : arr;\n  for (var i = l - 1;i >= 0;i--) {\n    if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {\n      return i;\n    }\n  }\n  return-1;\n};\ngoog.array.contains = function(arr, obj) {\n  return goog.array.indexOf(arr, obj) >= 0;\n};\ngoog.array.isEmpty = function(arr) {\n  return arr.length == 0;\n};\ngoog.array.clear = function(arr) {\n  if (!goog.isArray(arr)) {\n    for (var i = arr.length - 1;i >= 0;i--) {\n      delete arr[i];\n    }\n  }\n  arr.length = 0;\n};\ngoog.array.insert = function(arr, obj) {\n  if (!goog.array.contains(arr, obj)) {\n    arr.push(obj);\n  }\n};\ngoog.array.insertAt = function(arr, obj, opt_i) {\n  goog.array.splice(arr, opt_i, 0, obj);\n};\ngoog.array.insertArrayAt = function(arr, elementsToAdd, opt_i) {\n  goog.partial(goog.array.splice, arr, opt_i, 0).apply(null, elementsToAdd);\n};\ngoog.array.insertBefore = function(arr, obj, opt_obj2) {\n  var i;\n  if (arguments.length == 2 || (i = goog.array.indexOf(arr, opt_obj2)) < 0) {\n    arr.push(obj);\n  } else {\n    goog.array.insertAt(arr, obj, i);\n  }\n};\ngoog.array.remove = function(arr, obj) {\n  var i = goog.array.indexOf(arr, obj);\n  var rv;\n  if (rv = i >= 0) {\n    goog.array.removeAt(arr, i);\n  }\n  return rv;\n};\ngoog.array.removeAt = function(arr, i) {\n  goog.asserts.assert(arr.length != null);\n  return goog.array.ARRAY_PROTOTYPE_.splice.call(arr, i, 1).length == 1;\n};\ngoog.array.removeIf = function(arr, f, opt_obj) {\n  var i = goog.array.findIndex(arr, f, opt_obj);\n  if (i >= 0) {\n    goog.array.removeAt(arr, i);\n    return true;\n  }\n  return false;\n};\ngoog.array.concat = function(var_args) {\n  return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_, arguments);\n};\ngoog.array.join = function(var_args) {\n  return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_, arguments);\n};\ngoog.array.toArray = function(object) {\n  var length = object.length;\n  if (length > 0) {\n    var rv = new Array(length);\n    for (var i = 0;i < length;i++) {\n      rv[i] = object[i];\n    }\n    return rv;\n  }\n  return[];\n};\ngoog.array.clone = goog.array.toArray;\ngoog.array.extend = function(arr1, var_args) {\n  for (var i = 1;i < arguments.length;i++) {\n    var arr2 = arguments[i];\n    var isArrayLike;\n    if (goog.isArray(arr2) || (isArrayLike = goog.isArrayLike(arr2)) && Object.prototype.hasOwnProperty.call(arr2, \"callee\")) {\n      arr1.push.apply(arr1, arr2);\n    } else {\n      if (isArrayLike) {\n        var len1 = arr1.length;\n        var len2 = arr2.length;\n        for (var j = 0;j < len2;j++) {\n          arr1[len1 + j] = arr2[j];\n        }\n      } else {\n        arr1.push(arr2);\n      }\n    }\n  }\n};\ngoog.array.splice = function(arr, index, howMany, var_args) {\n  goog.asserts.assert(arr.length != null);\n  return goog.array.ARRAY_PROTOTYPE_.splice.apply(arr, goog.array.slice(arguments, 1));\n};\ngoog.array.slice = function(arr, start, opt_end) {\n  goog.asserts.assert(arr.length != null);\n  if (arguments.length <= 2) {\n    return goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start);\n  } else {\n    return goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start, opt_end);\n  }\n};\ngoog.array.removeDuplicates = function(arr, opt_rv, opt_hashFn) {\n  var returnArray = opt_rv || arr;\n  var defaultHashFn = function(item) {\n    return goog.isObject(current) ? \"o\" + goog.getUid(current) : (typeof current).charAt(0) + current;\n  };\n  var hashFn = opt_hashFn || defaultHashFn;\n  var seen = {}, cursorInsert = 0, cursorRead = 0;\n  while (cursorRead < arr.length) {\n    var current = arr[cursorRead++];\n    var key = hashFn(current);\n    if (!Object.prototype.hasOwnProperty.call(seen, key)) {\n      seen[key] = true;\n      returnArray[cursorInsert++] = current;\n    }\n  }\n  returnArray.length = cursorInsert;\n};\ngoog.array.binarySearch = function(arr, target, opt_compareFn) {\n  return goog.array.binarySearch_(arr, opt_compareFn || goog.array.defaultCompare, false, target);\n};\ngoog.array.binarySelect = function(arr, evaluator, opt_obj) {\n  return goog.array.binarySearch_(arr, evaluator, true, undefined, opt_obj);\n};\ngoog.array.binarySearch_ = function(arr, compareFn, isEvaluator, opt_target, opt_selfObj) {\n  var left = 0;\n  var right = arr.length;\n  var found;\n  while (left < right) {\n    var middle = left + right >> 1;\n    var compareResult;\n    if (isEvaluator) {\n      compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr);\n    } else {\n      compareResult = compareFn(opt_target, arr[middle]);\n    }\n    if (compareResult > 0) {\n      left = middle + 1;\n    } else {\n      right = middle;\n      found = !compareResult;\n    }\n  }\n  return found ? left : ~left;\n};\ngoog.array.sort = function(arr, opt_compareFn) {\n  arr.sort(opt_compareFn || goog.array.defaultCompare);\n};\ngoog.array.stableSort = function(arr, opt_compareFn) {\n  for (var i = 0;i < arr.length;i++) {\n    arr[i] = {index:i, value:arr[i]};\n  }\n  var valueCompareFn = opt_compareFn || goog.array.defaultCompare;\n  function stableCompareFn(obj1, obj2) {\n    return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index;\n  }\n  goog.array.sort(arr, stableCompareFn);\n  for (var i = 0;i < arr.length;i++) {\n    arr[i] = arr[i].value;\n  }\n};\ngoog.array.sortObjectsByKey = function(arr, key, opt_compareFn) {\n  var compare = opt_compareFn || goog.array.defaultCompare;\n  goog.array.sort(arr, function(a, b) {\n    return compare(a[key], b[key]);\n  });\n};\ngoog.array.isSorted = function(arr, opt_compareFn, opt_strict) {\n  var compare = opt_compareFn || goog.array.defaultCompare;\n  for (var i = 1;i < arr.length;i++) {\n    var compareResult = compare(arr[i - 1], arr[i]);\n    if (compareResult > 0 || compareResult == 0 && opt_strict) {\n      return false;\n    }\n  }\n  return true;\n};\ngoog.array.equals = function(arr1, arr2, opt_equalsFn) {\n  if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) || arr1.length != arr2.length) {\n    return false;\n  }\n  var l = arr1.length;\n  var equalsFn = opt_equalsFn || goog.array.defaultCompareEquality;\n  for (var i = 0;i < l;i++) {\n    if (!equalsFn(arr1[i], arr2[i])) {\n      return false;\n    }\n  }\n  return true;\n};\ngoog.array.compare3 = function(arr1, arr2, opt_compareFn) {\n  var compare = opt_compareFn || goog.array.defaultCompare;\n  var l = Math.min(arr1.length, arr2.length);\n  for (var i = 0;i < l;i++) {\n    var result = compare(arr1[i], arr2[i]);\n    if (result != 0) {\n      return result;\n    }\n  }\n  return goog.array.defaultCompare(arr1.length, arr2.length);\n};\ngoog.array.defaultCompare = function(a, b) {\n  return a > b ? 1 : a < b ? -1 : 0;\n};\ngoog.array.defaultCompareEquality = function(a, b) {\n  return a === b;\n};\ngoog.array.binaryInsert = function(array, value, opt_compareFn) {\n  var index = goog.array.binarySearch(array, value, opt_compareFn);\n  if (index < 0) {\n    goog.array.insertAt(array, value, -(index + 1));\n    return true;\n  }\n  return false;\n};\ngoog.array.binaryRemove = function(array, value, opt_compareFn) {\n  var index = goog.array.binarySearch(array, value, opt_compareFn);\n  return index >= 0 ? goog.array.removeAt(array, index) : false;\n};\ngoog.array.bucket = function(array, sorter, opt_obj) {\n  var buckets = {};\n  for (var i = 0;i < array.length;i++) {\n    var value = array[i];\n    var key = sorter.call(opt_obj, value, i, array);\n    if (goog.isDef(key)) {\n      var bucket = buckets[key] || (buckets[key] = []);\n      bucket.push(value);\n    }\n  }\n  return buckets;\n};\ngoog.array.toObject = function(arr, keyFunc, opt_obj) {\n  var ret = {};\n  goog.array.forEach(arr, function(element, index) {\n    ret[keyFunc.call(opt_obj, element, index, arr)] = element;\n  });\n  return ret;\n};\ngoog.array.range = function(startOrEnd, opt_end, opt_step) {\n  var array = [];\n  var start = 0;\n  var end = startOrEnd;\n  var step = opt_step || 1;\n  if (opt_end !== undefined) {\n    start = startOrEnd;\n    end = opt_end;\n  }\n  if (step * (end - start) < 0) {\n    return[];\n  }\n  if (step > 0) {\n    for (var i = start;i < end;i += step) {\n      array.push(i);\n    }\n  } else {\n    for (var i = start;i > end;i += step) {\n      array.push(i);\n    }\n  }\n  return array;\n};\ngoog.array.repeat = function(value, n) {\n  var array = [];\n  for (var i = 0;i < n;i++) {\n    array[i] = value;\n  }\n  return array;\n};\ngoog.array.flatten = function(var_args) {\n  var result = [];\n  for (var i = 0;i < arguments.length;i++) {\n    var element = arguments[i];\n    if (goog.isArray(element)) {\n      result.push.apply(result, goog.array.flatten.apply(null, element));\n    } else {\n      result.push(element);\n    }\n  }\n  return result;\n};\ngoog.array.rotate = function(array, n) {\n  goog.asserts.assert(array.length != null);\n  if (array.length) {\n    n %= array.length;\n    if (n > 0) {\n      goog.array.ARRAY_PROTOTYPE_.unshift.apply(array, array.splice(-n, n));\n    } else {\n      if (n < 0) {\n        goog.array.ARRAY_PROTOTYPE_.push.apply(array, array.splice(0, -n));\n      }\n    }\n  }\n  return array;\n};\ngoog.array.moveItem = function(arr, fromIndex, toIndex) {\n  goog.asserts.assert(fromIndex >= 0 && fromIndex < arr.length);\n  goog.asserts.assert(toIndex >= 0 && toIndex < arr.length);\n  var removedItems = goog.array.ARRAY_PROTOTYPE_.splice.call(arr, fromIndex, 1);\n  goog.array.ARRAY_PROTOTYPE_.splice.call(arr, toIndex, 0, removedItems[0]);\n};\ngoog.array.zip = function(var_args) {\n  if (!arguments.length) {\n    return[];\n  }\n  var result = [];\n  for (var i = 0;true;i++) {\n    var value = [];\n    for (var j = 0;j < arguments.length;j++) {\n      var arr = arguments[j];\n      if (i >= arr.length) {\n        return result;\n      }\n      value.push(arr[i]);\n    }\n    result.push(value);\n  }\n};\ngoog.array.shuffle = function(arr, opt_randFn) {\n  var randFn = opt_randFn || Math.random;\n  for (var i = arr.length - 1;i > 0;i--) {\n    var j = Math.floor(randFn() * (i + 1));\n    var tmp = arr[i];\n    arr[i] = arr[j];\n    arr[j] = tmp;\n  }\n};\ngoog.provide(\"goog.crypt\");\ngoog.require(\"goog.array\");\ngoog.require(\"goog.asserts\");\ngoog.crypt.stringToByteArray = function(str) {\n  var output = [], p = 0;\n  for (var i = 0;i < str.length;i++) {\n    var c = str.charCodeAt(i);\n    while (c > 255) {\n      output[p++] = c & 255;\n      c >>= 8;\n    }\n    output[p++] = c;\n  }\n  return output;\n};\ngoog.crypt.byteArrayToString = function(bytes) {\n  var CHUNK_SIZE = 8192;\n  if (bytes.length < CHUNK_SIZE) {\n    return String.fromCharCode.apply(null, bytes);\n  }\n  var str = \"\";\n  for (var i = 0;i < bytes.length;i += CHUNK_SIZE) {\n    var chunk = goog.array.slice(bytes, i, i + CHUNK_SIZE);\n    str += String.fromCharCode.apply(null, chunk);\n  }\n  return str;\n};\ngoog.crypt.byteArrayToHex = function(array) {\n  return goog.array.map(array, function(numByte) {\n    var hexByte = numByte.toString(16);\n    return hexByte.length > 1 ? hexByte : \"0\" + hexByte;\n  }).join(\"\");\n};\ngoog.crypt.hexToByteArray = function(hexString) {\n  goog.asserts.assert(hexString.length % 2 == 0, \"Key string length must be multiple of 2\");\n  var arr = [];\n  for (var i = 0;i < hexString.length;i += 2) {\n    arr.push(parseInt(hexString.substring(i, i + 2), 16));\n  }\n  return arr;\n};\ngoog.crypt.stringToUtf8ByteArray = function(str) {\n  str = str.replace(/\\r\\n/g, \"\\n\");\n  var out = [], p = 0;\n  for (var i = 0;i < str.length;i++) {\n    var c = str.charCodeAt(i);\n    if (c < 128) {\n      out[p++] = c;\n    } else {\n      if (c < 2048) {\n        out[p++] = c >> 6 | 192;\n        out[p++] = c & 63 | 128;\n      } else {\n        out[p++] = c >> 12 | 224;\n        out[p++] = c >> 6 & 63 | 128;\n        out[p++] = c & 63 | 128;\n      }\n    }\n  }\n  return out;\n};\ngoog.crypt.utf8ByteArrayToString = function(bytes) {\n  var out = [], pos = 0, c = 0;\n  while (pos < bytes.length) {\n    var c1 = bytes[pos++];\n    if (c1 < 128) {\n      out[c++] = String.fromCharCode(c1);\n    } else {\n      if (c1 > 191 && c1 < 224) {\n        var c2 = bytes[pos++];\n        out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63);\n      } else {\n        var c2 = bytes[pos++];\n        var c3 = bytes[pos++];\n        out[c++] = String.fromCharCode((c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63);\n      }\n    }\n  }\n  return out.join(\"\");\n};\ngoog.crypt.xorByteArray = function(bytes1, bytes2) {\n  goog.asserts.assert(bytes1.length == bytes2.length, \"XOR array lengths must match\");\n  var result = [];\n  for (var i = 0;i < bytes1.length;i++) {\n    result.push(bytes1[i] ^ bytes2[i]);\n  }\n  return result;\n};\ngoog.provide(\"goog.labs.userAgent.util\");\ngoog.require(\"goog.string\");\ngoog.labs.userAgent.util.getNativeUserAgentString_ = function() {\n  var navigator = goog.labs.userAgent.util.getNavigator_();\n  if (navigator) {\n    var userAgent = navigator.userAgent;\n    if (userAgent) {\n      return userAgent;\n    }\n  }\n  return \"\";\n};\ngoog.labs.userAgent.util.getNavigator_ = function() {\n  return goog.global.navigator;\n};\ngoog.labs.userAgent.util.userAgent_ = goog.labs.userAgent.util.getNativeUserAgentString_();\ngoog.labs.userAgent.util.setUserAgent = function(opt_userAgent) {\n  goog.labs.userAgent.util.userAgent_ = opt_userAgent || goog.labs.userAgent.util.getNativeUserAgentString_();\n};\ngoog.labs.userAgent.util.getUserAgent = function() {\n  return goog.labs.userAgent.util.userAgent_;\n};\ngoog.labs.userAgent.util.matchUserAgent = function(str) {\n  var userAgent = goog.labs.userAgent.util.getUserAgent();\n  return goog.string.contains(userAgent, str);\n};\ngoog.labs.userAgent.util.matchUserAgentIgnoreCase = function(str) {\n  var userAgent = goog.labs.userAgent.util.getUserAgent();\n  return goog.string.caseInsensitiveContains(userAgent, str);\n};\ngoog.labs.userAgent.util.extractVersionTuples = function(userAgent) {\n  var versionRegExp = new RegExp(\"(\\\\w[\\\\w ]+)\" + \"/\" + \"([^\\\\s]+)\" + \"\\\\s*\" + \"(?:\\\\((.*?)\\\\))?\", \"g\");\n  var data = [];\n  var match;\n  while (match = versionRegExp.exec(userAgent)) {\n    data.push([match[1], match[2], match[3] || undefined]);\n  }\n  return data;\n};\ngoog.provide(\"goog.labs.userAgent.browser\");\ngoog.require(\"goog.array\");\ngoog.require(\"goog.asserts\");\ngoog.require(\"goog.labs.userAgent.util\");\ngoog.require(\"goog.string\");\ngoog.labs.userAgent.browser.matchOpera_ = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Opera\") || goog.labs.userAgent.util.matchUserAgent(\"OPR\");\n};\ngoog.labs.userAgent.browser.matchIE_ = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Trident\") || goog.labs.userAgent.util.matchUserAgent(\"MSIE\");\n};\ngoog.labs.userAgent.browser.matchFirefox_ = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Firefox\");\n};\ngoog.labs.userAgent.browser.matchSafari_ = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Safari\") && !goog.labs.userAgent.util.matchUserAgent(\"Chrome\") && !goog.labs.userAgent.util.matchUserAgent(\"CriOS\") && !goog.labs.userAgent.util.matchUserAgent(\"Android\");\n};\ngoog.labs.userAgent.browser.matchChrome_ = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Chrome\") || goog.labs.userAgent.util.matchUserAgent(\"CriOS\");\n};\ngoog.labs.userAgent.browser.matchAndroidBrowser_ = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Android\") && !goog.labs.userAgent.util.matchUserAgent(\"Chrome\") && !goog.labs.userAgent.util.matchUserAgent(\"CriOS\");\n};\ngoog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_;\ngoog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_;\ngoog.labs.userAgent.browser.isFirefox = goog.labs.userAgent.browser.matchFirefox_;\ngoog.labs.userAgent.browser.isSafari = goog.labs.userAgent.browser.matchSafari_;\ngoog.labs.userAgent.browser.isChrome = goog.labs.userAgent.browser.matchChrome_;\ngoog.labs.userAgent.browser.isAndroidBrowser = goog.labs.userAgent.browser.matchAndroidBrowser_;\ngoog.labs.userAgent.browser.isSilk = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Silk\");\n};\ngoog.labs.userAgent.browser.getVersion = function() {\n  var userAgentString = goog.labs.userAgent.util.getUserAgent();\n  if (goog.labs.userAgent.browser.isIE()) {\n    return goog.labs.userAgent.browser.getIEVersion_(userAgentString);\n  }\n  if (goog.labs.userAgent.browser.isOpera()) {\n    return goog.labs.userAgent.browser.getOperaVersion_(userAgentString);\n  }\n  var versionTuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString);\n  return goog.labs.userAgent.browser.getVersionFromTuples_(versionTuples);\n};\ngoog.labs.userAgent.browser.isVersionOrHigher = function(version) {\n  return goog.string.compareVersions(goog.labs.userAgent.browser.getVersion(), version) >= 0;\n};\ngoog.labs.userAgent.browser.getIEVersion_ = function(userAgent) {\n  var rv = /rv: *([\\d\\.]*)/.exec(userAgent);\n  if (rv && rv[1]) {\n    return rv[1];\n  }\n  var version = \"\";\n  var msie = /MSIE +([\\d\\.]+)/.exec(userAgent);\n  if (msie && msie[1]) {\n    var tridentVersion = /Trident\\/(\\d.\\d)/.exec(userAgent);\n    if (msie[1] == \"7.0\") {\n      if (tridentVersion && tridentVersion[1]) {\n        switch(tridentVersion[1]) {\n          case \"4.0\":\n            version = \"8.0\";\n            break;\n          case \"5.0\":\n            version = \"9.0\";\n            break;\n          case \"6.0\":\n            version = \"10.0\";\n            break;\n          case \"7.0\":\n            version = \"11.0\";\n            break;\n        }\n      } else {\n        version = \"7.0\";\n      }\n    } else {\n      version = msie[1];\n    }\n  }\n  return version;\n};\ngoog.labs.userAgent.browser.getOperaVersion_ = function(userAgent) {\n  var versionTuples = goog.labs.userAgent.util.extractVersionTuples(userAgent);\n  var lastTuple = goog.array.peek(versionTuples);\n  if (lastTuple[0] == \"OPR\" && lastTuple[1]) {\n    return lastTuple[1];\n  }\n  return goog.labs.userAgent.browser.getVersionFromTuples_(versionTuples);\n};\ngoog.labs.userAgent.browser.getVersionFromTuples_ = function(versionTuples) {\n  goog.asserts.assert(versionTuples.length > 2, \"Couldn't extract version tuple from user agent string\");\n  return versionTuples[2] && versionTuples[2][1] ? versionTuples[2][1] : \"\";\n};\ngoog.provide(\"goog.labs.userAgent.engine\");\ngoog.require(\"goog.array\");\ngoog.require(\"goog.labs.userAgent.util\");\ngoog.require(\"goog.string\");\ngoog.labs.userAgent.engine.isPresto = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Presto\");\n};\ngoog.labs.userAgent.engine.isTrident = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Trident\") || goog.labs.userAgent.util.matchUserAgent(\"MSIE\");\n};\ngoog.labs.userAgent.engine.isWebKit = function() {\n  return goog.labs.userAgent.util.matchUserAgentIgnoreCase(\"WebKit\");\n};\ngoog.labs.userAgent.engine.isGecko = function() {\n  return goog.labs.userAgent.util.matchUserAgent(\"Gecko\") && !goog.labs.userAgent.engine.isWebKit() && !goog.labs.userAgent.engine.isTrident();\n};\ngoog.labs.userAgent.engine.getVersion = function() {\n  var userAgentString = goog.labs.userAgent.util.getUserAgent();\n  if (userAgentString) {\n    var tuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString);\n    var engineTuple = tuples[1];\n    if (engineTuple) {\n      if (engineTuple[0] == \"Gecko\") {\n        return goog.labs.userAgent.engine.getVersionForKey_(tuples, \"Firefox\");\n      }\n      return engineTuple[1];\n    }\n    var browserTuple = tuples[0];\n    var info;\n    if (browserTuple && (info = browserTuple[2])) {\n      var match = /Trident\\/([^\\s;]+)/.exec(info);\n      if (match) {\n        return match[1];\n      }\n    }\n  }\n  return \"\";\n};\ngoog.labs.userAgent.engine.isVersionOrHigher = function(version) {\n  return goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(), version) >= 0;\n};\ngoog.labs.userAgent.engine.getVersionForKey_ = function(tuples, key) {\n  var pair = goog.array.find(tuples, function(pair) {\n    return key == pair[0];\n  });\n  return pair && pair[1] || \"\";\n};\ngoog.provide(\"goog.userAgent\");\ngoog.require(\"goog.labs.userAgent.browser\");\ngoog.require(\"goog.labs.userAgent.engine\");\ngoog.require(\"goog.labs.userAgent.util\");\ngoog.require(\"goog.string\");\ngoog.define(\"goog.userAgent.ASSUME_IE\", false);\ngoog.define(\"goog.userAgent.ASSUME_GECKO\", false);\ngoog.define(\"goog.userAgent.ASSUME_WEBKIT\", false);\ngoog.define(\"goog.userAgent.ASSUME_MOBILE_WEBKIT\", false);\ngoog.define(\"goog.userAgent.ASSUME_OPERA\", false);\ngoog.define(\"goog.userAgent.ASSUME_ANY_VERSION\", false);\ngoog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_GECKO || goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_OPERA;\ngoog.userAgent.getUserAgentString = function() {\n  return goog.labs.userAgent.util.getUserAgent();\n};\ngoog.userAgent.getNavigator = function() {\n  return goog.global[\"navigator\"] || null;\n};\ngoog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_OPERA : goog.labs.userAgent.browser.isOpera();\ngoog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_IE : goog.labs.userAgent.browser.isIE();\ngoog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_GECKO : goog.labs.userAgent.engine.isGecko();\ngoog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : goog.labs.userAgent.engine.isWebKit();\ngoog.userAgent.isMobile_ = function() {\n  return goog.userAgent.WEBKIT && goog.labs.userAgent.util.matchUserAgent(\"Mobile\");\n};\ngoog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.isMobile_();\ngoog.userAgent.SAFARI = goog.userAgent.WEBKIT;\ngoog.userAgent.determinePlatform_ = function() {\n  var navigator = goog.userAgent.getNavigator();\n  return navigator && navigator.platform || \"\";\n};\ngoog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();\ngoog.define(\"goog.userAgent.ASSUME_MAC\", false);\ngoog.define(\"goog.userAgent.ASSUME_WINDOWS\", false);\ngoog.define(\"goog.userAgent.ASSUME_LINUX\", false);\ngoog.define(\"goog.userAgent.ASSUME_X11\", false);\ngoog.define(\"goog.userAgent.ASSUME_ANDROID\", false);\ngoog.define(\"goog.userAgent.ASSUME_IPHONE\", false);\ngoog.define(\"goog.userAgent.ASSUME_IPAD\", false);\ngoog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX || goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID || goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD;\ngoog.userAgent.initPlatform_ = function() {\n  goog.userAgent.detectedMac_ = goog.string.contains(goog.userAgent.PLATFORM, \"Mac\");\n  goog.userAgent.detectedWindows_ = goog.string.contains(goog.userAgent.PLATFORM, \"Win\");\n  goog.userAgent.detectedLinux_ = goog.string.contains(goog.userAgent.PLATFORM, \"Linux\");\n  goog.userAgent.detectedX11_ = !!goog.userAgent.getNavigator() && goog.string.contains(goog.userAgent.getNavigator()[\"appVersion\"] || \"\", \"X11\");\n  var ua = goog.userAgent.getUserAgentString();\n  goog.userAgent.detectedAndroid_ = !!ua && goog.string.contains(ua, \"Android\");\n  goog.userAgent.detectedIPhone_ = !!ua && goog.string.contains(ua, \"iPhone\");\n  goog.userAgent.detectedIPad_ = !!ua && goog.string.contains(ua, \"iPad\");\n};\nif (!goog.userAgent.PLATFORM_KNOWN_) {\n  goog.userAgent.initPlatform_();\n}\ngoog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_MAC : goog.userAgent.detectedMac_;\ngoog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_WINDOWS : goog.userAgent.detectedWindows_;\ngoog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_LINUX : goog.userAgent.detectedLinux_;\ngoog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_X11 : goog.userAgent.detectedX11_;\ngoog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_ANDROID : goog.userAgent.detectedAndroid_;\ngoog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE : goog.userAgent.detectedIPhone_;\ngoog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPAD : goog.userAgent.detectedIPad_;\ngoog.userAgent.determineVersion_ = function() {\n  var version = \"\", re;\n  if (goog.userAgent.OPERA && goog.global[\"opera\"]) {\n    var operaVersion = goog.global[\"opera\"].version;\n    return goog.isFunction(operaVersion) ? operaVersion() : operaVersion;\n  }\n  if (goog.userAgent.GECKO) {\n    re = /rv\\:([^\\);]+)(\\)|;)/;\n  } else {\n    if (goog.userAgent.IE) {\n      re = /\\b(?:MSIE|rv)[: ]([^\\);]+)(\\)|;)/;\n    } else {\n      if (goog.userAgent.WEBKIT) {\n        re = /WebKit\\/(\\S+)/;\n      }\n    }\n  }\n  if (re) {\n    var arr = re.exec(goog.userAgent.getUserAgentString());\n    version = arr ? arr[1] : \"\";\n  }\n  if (goog.userAgent.IE) {\n    var docMode = goog.userAgent.getDocumentMode_();\n    if (docMode > parseFloat(version)) {\n      return String(docMode);\n    }\n  }\n  return version;\n};\ngoog.userAgent.getDocumentMode_ = function() {\n  var doc = goog.global[\"document\"];\n  return doc ? doc[\"documentMode\"] : undefined;\n};\ngoog.userAgent.VERSION = goog.userAgent.determineVersion_();\ngoog.userAgent.compare = function(v1, v2) {\n  return goog.string.compareVersions(v1, v2);\n};\ngoog.userAgent.isVersionOrHigherCache_ = {};\ngoog.userAgent.isVersionOrHigher = function(version) {\n  return goog.userAgent.ASSUME_ANY_VERSION || goog.userAgent.isVersionOrHigherCache_[version] || (goog.userAgent.isVersionOrHigherCache_[version] = goog.string.compareVersions(goog.userAgent.VERSION, version) >= 0);\n};\ngoog.userAgent.isVersion = goog.userAgent.isVersionOrHigher;\ngoog.userAgent.isDocumentModeOrHigher = function(documentMode) {\n  return goog.userAgent.IE && goog.userAgent.DOCUMENT_MODE >= documentMode;\n};\ngoog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher;\ngoog.userAgent.DOCUMENT_MODE = function() {\n  var doc = goog.global[\"document\"];\n  if (!doc || !goog.userAgent.IE) {\n    return undefined;\n  }\n  var mode = goog.userAgent.getDocumentMode_();\n  return mode || (doc[\"compatMode\"] == \"CSS1Compat\" ? parseInt(goog.userAgent.VERSION, 10) : 5);\n}();\ngoog.provide(\"goog.crypt.base64\");\ngoog.require(\"goog.crypt\");\ngoog.require(\"goog.userAgent\");\ngoog.crypt.base64.byteToCharMap_ = null;\ngoog.crypt.base64.charToByteMap_ = null;\ngoog.crypt.base64.byteToCharMapWebSafe_ = null;\ngoog.crypt.base64.charToByteMapWebSafe_ = null;\ngoog.crypt.base64.ENCODED_VALS_BASE = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" + \"abcdefghijklmnopqrstuvwxyz\" + \"0123456789\";\ngoog.crypt.base64.ENCODED_VALS = goog.crypt.base64.ENCODED_VALS_BASE + \"+/=\";\ngoog.crypt.base64.ENCODED_VALS_WEBSAFE = goog.crypt.base64.ENCODED_VALS_BASE + \"-_.\";\ngoog.crypt.base64.HAS_NATIVE_SUPPORT = goog.userAgent.GECKO || goog.userAgent.WEBKIT || goog.userAgent.OPERA || typeof goog.global.atob == \"function\";\ngoog.crypt.base64.encodeByteArray = function(input, opt_webSafe) {\n  if (!goog.isArrayLike(input)) {\n    throw Error(\"encodeByteArray takes an array as a parameter\");\n  }\n  goog.crypt.base64.init_();\n  var byteToCharMap = opt_webSafe ? goog.crypt.base64.byteToCharMapWebSafe_ : goog.crypt.base64.byteToCharMap_;\n  var output = [];\n  for (var i = 0;i < input.length;i += 3) {\n    var byte1 = input[i];\n    var haveByte2 = i + 1 < input.length;\n    var byte2 = haveByte2 ? input[i + 1] : 0;\n    var haveByte3 = i + 2 < input.length;\n    var byte3 = haveByte3 ? input[i + 2] : 0;\n    var outByte1 = byte1 >> 2;\n    var outByte2 = (byte1 & 3) << 4 | byte2 >> 4;\n    var outByte3 = (byte2 & 15) << 2 | byte3 >> 6;\n    var outByte4 = byte3 & 63;\n    if (!haveByte3) {\n      outByte4 = 64;\n      if (!haveByte2) {\n        outByte3 = 64;\n      }\n    }\n    output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]);\n  }\n  return output.join(\"\");\n};\ngoog.crypt.base64.encodeString = function(input, opt_webSafe) {\n  if (goog.crypt.base64.HAS_NATIVE_SUPPORT && !opt_webSafe) {\n    return goog.global.btoa(input);\n  }\n  return goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(input), opt_webSafe);\n};\ngoog.crypt.base64.decodeString = function(input, opt_webSafe) {\n  if (goog.crypt.base64.HAS_NATIVE_SUPPORT && !opt_webSafe) {\n    return goog.global.atob(input);\n  }\n  return goog.crypt.byteArrayToString(goog.crypt.base64.decodeStringToByteArray(input, opt_webSafe));\n};\ngoog.crypt.base64.decodeStringToByteArray = function(input, opt_webSafe) {\n  goog.crypt.base64.init_();\n  var charToByteMap = opt_webSafe ? goog.crypt.base64.charToByteMapWebSafe_ : goog.crypt.base64.charToByteMap_;\n  var output = [];\n  for (var i = 0;i < input.length;) {\n    var byte1 = charToByteMap[input.charAt(i++)];\n    var haveByte2 = i < input.length;\n    var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0;\n    ++i;\n    var haveByte3 = i < input.length;\n    var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64;\n    ++i;\n    var haveByte4 = i < input.length;\n    var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64;\n    ++i;\n    if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) {\n      throw Error();\n    }\n    var outByte1 = byte1 << 2 | byte2 >> 4;\n    output.push(outByte1);\n    if (byte3 != 64) {\n      var outByte2 = byte2 << 4 & 240 | byte3 >> 2;\n      output.push(outByte2);\n      if (byte4 != 64) {\n        var outByte3 = byte3 << 6 & 192 | byte4;\n        output.push(outByte3);\n      }\n    }\n  }\n  return output;\n};\ngoog.crypt.base64.init_ = function() {\n  if (!goog.crypt.base64.byteToCharMap_) {\n    goog.crypt.base64.byteToCharMap_ = {};\n    goog.crypt.base64.charToByteMap_ = {};\n    goog.crypt.base64.byteToCharMapWebSafe_ = {};\n    goog.crypt.base64.charToByteMapWebSafe_ = {};\n    for (var i = 0;i < goog.crypt.base64.ENCODED_VALS.length;i++) {\n      goog.crypt.base64.byteToCharMap_[i] = goog.crypt.base64.ENCODED_VALS.charAt(i);\n      goog.crypt.base64.charToByteMap_[goog.crypt.base64.byteToCharMap_[i]] = i;\n      goog.crypt.base64.byteToCharMapWebSafe_[i] = goog.crypt.base64.ENCODED_VALS_WEBSAFE.charAt(i);\n      goog.crypt.base64.charToByteMapWebSafe_[goog.crypt.base64.byteToCharMapWebSafe_[i]] = i;\n    }\n  }\n};\ngoog.provide(\"fb.core.util\");\ngoog.require(\"fb.constants\");\ngoog.require(\"fb.core.RepoInfo\");\ngoog.require(\"fb.core.storage\");\ngoog.require(\"fb.util.json\");\ngoog.require(\"goog.crypt.base64\");\ngoog.require(\"sjcl\");\nfb.core.util.LUIDGenerator = function() {\n  var id = 1;\n  return function() {\n    return id++;\n  };\n}();\nfb.core.util.assert = function(assertion, message) {\n  if (!assertion) {\n    throw new Error(\"Firebase INTERNAL ASSERT FAILED:\" + message);\n  }\n};\nfb.core.util.assertWeak = function(assertion, message) {\n  if (!assertion) {\n    fb.core.util.error(message);\n  }\n};\nfb.core.util.base64Encode = function(str) {\n  var utf8Bytes = fb.util.utf8.stringToByteArray(str);\n  return goog.crypt.base64.encodeByteArray(utf8Bytes, true);\n};\nfb.core.util.base64DecodeIfNativeSupport = function(str) {\n  try {\n    if (NODE_CLIENT) {\n      return(new Buffer(str, \"base64\")).toString(\"utf8\");\n    } else {\n      if (typeof atob !== \"undefined\") {\n        return atob(str);\n      }\n    }\n  } catch (e) {\n    fb.core.util.log(\"base64DecodeIfNativeSupport failed: \", e);\n  }\n  return null;\n};\nfb.core.util.sha1 = function(str) {\n  return sjcl.codec.base64.fromBits(sjcl.hash.sha1.hash(str));\n};\nfb.core.util.buildLogMessage_ = function(var_args) {\n  var message = \"\";\n  for (var i = 0;i < arguments.length;i++) {\n    if (goog.isArrayLike(arguments[i])) {\n      message += fb.core.util.buildLogMessage_.apply(null, arguments[i]);\n    } else {\n      if (typeof arguments[i] === \"object\") {\n        message += fb.util.json.stringify(arguments[i]);\n      } else {\n        message += arguments[i];\n      }\n    }\n    message += \" \";\n  }\n  return message;\n};\nfb.core.util.logger = null;\nfb.core.util.firstLog_ = true;\nfb.core.util.log = function(var_args) {\n  if (fb.core.util.firstLog_ === true) {\n    fb.core.util.firstLog_ = false;\n    if (fb.core.util.logger === null && fb.core.storage.SessionStorage.get(\"logging_enabled\") === true) {\n      Firebase.enableLogging(true);\n    }\n  }\n  if (fb.core.util.logger) {\n    var message = fb.core.util.buildLogMessage_.apply(null, arguments);\n    fb.core.util.logger(message);\n  }\n};\nfb.core.util.logWrapper = function(prefix) {\n  return function() {\n    fb.core.util.log(prefix, arguments);\n  };\n};\nfb.core.util.error = function(var_args) {\n  if (typeof console !== \"undefined\") {\n    var message = \"FIREBASE INTERNAL ERROR: \" + fb.core.util.buildLogMessage_.apply(null, arguments);\n    if (typeof console.error !== \"undefined\") {\n      console.error(message);\n    } else {\n      console.log(message);\n    }\n  }\n};\nfb.core.util.fatal = function(var_args) {\n  var message = fb.core.util.buildLogMessage_.apply(null, arguments);\n  throw new Error(\"FIREBASE FATAL ERROR: \" + message);\n};\nfb.core.util.warn = function(var_args) {\n  if (typeof console !== \"undefined\") {\n    var message = \"FIREBASE WARNING: \" + fb.core.util.buildLogMessage_.apply(null, arguments);\n    if (typeof console.warn !== \"undefined\") {\n      console.warn(message);\n    } else {\n      console.log(message);\n    }\n  }\n};\nfb.core.util.warnIfPageIsSecure = function() {\n  if (typeof window !== \"undefined\" && window.location && window.location.protocol && window.location.protocol.indexOf(\"https:\") !== -1) {\n    fb.core.util.warn(\"Insecure Firebase access from a secure page. Please use https in calls to new Firebase().\");\n  }\n};\nfb.core.util.parseURL = function(dataURL) {\n  var host = \"\", namespace = \"\", secure = true, pathString = \"\";\n  if (goog.isString(dataURL)) {\n    var colonInd = dataURL.indexOf(\"//\");\n    if (colonInd >= 0) {\n      var scheme = dataURL.substring(0, colonInd - 1);\n      dataURL = dataURL.substring(colonInd + 2);\n    }\n    var slashInd = dataURL.indexOf(\"/\");\n    if (slashInd === -1) {\n      slashInd = dataURL.length;\n    }\n    host = dataURL.substring(0, slashInd);\n    dataURL = dataURL.substring(slashInd + 1);\n    var parts = host.split(\".\");\n    if (parts.length == 3) {\n      colonInd = parts[2].indexOf(\":\");\n      if (colonInd >= 0) {\n        secure = scheme === \"https\" || scheme === \"wss\";\n      } else {\n        secure = true;\n      }\n      var domain = parts[1];\n      if (domain === \"firebase\") {\n        fb.core.util.fatal(host + \" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead\");\n      } else {\n        namespace = parts[0];\n        pathString = fb.core.util.decodePath(\"/\" + dataURL);\n      }\n      namespace = namespace.toLowerCase();\n    } else {\n      fb.core.util.fatal(\"Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com\");\n    }\n  }\n  if (!secure) {\n    fb.core.util.warnIfPageIsSecure();\n  }\n  var webSocketOnly = scheme === \"ws\" || scheme === \"wss\";\n  return{repoInfo:new fb.core.RepoInfo(host, secure, namespace, webSocketOnly), path:new fb.core.util.Path(pathString)};\n};\nfb.core.util.decodePath = function(pathString) {\n  var pathStringDecoded = \"\";\n  var pieces = pathString.split(\"/\");\n  for (var i = 0;i < pieces.length;i++) {\n    if (pieces[i].length > 0) {\n      var piece = pieces[i];\n      try {\n        piece = goog.string.urlDecode(piece);\n      } catch (e) {\n      }\n      pathStringDecoded += \"/\" + piece;\n    }\n  }\n  return pathStringDecoded;\n};\nfb.core.util.isInvalidJSONNumber = function(data) {\n  return goog.isNumber(data) && (data != data || data == Number.POSITIVE_INFINITY || data == Number.NEGATIVE_INFINITY);\n};\nfb.core.util.executeWhenDOMReady = function(fn) {\n  if (NODE_CLIENT || document.readyState === \"complete\") {\n    fn();\n  } else {\n    var called = false;\n    var wrappedFn = function() {\n      if (!document.body) {\n        setTimeout(wrappedFn, Math.floor(10));\n        return;\n      }\n      if (!called) {\n        called = true;\n        fn();\n      }\n    };\n    if (document.addEventListener) {\n      document.addEventListener(\"DOMContentLoaded\", wrappedFn, false);\n      window.addEventListener(\"load\", wrappedFn, false);\n    } else {\n      if (document.attachEvent) {\n        document.attachEvent(\"onreadystatechange\", function() {\n          if (document.readyState === \"complete\") {\n            wrappedFn();\n          }\n        });\n        window.attachEvent(\"onload\", wrappedFn);\n      }\n    }\n  }\n};\nfb.core.util.priorityCompare = function(a, b) {\n  if (a !== b) {\n    if (a === null) {\n      return-1;\n    } else {\n      if (b === null) {\n        return 1;\n      }\n    }\n    if (typeof a !== typeof b) {\n      return typeof a === \"number\" ? -1 : 1;\n    } else {\n      return a > b ? 1 : -1;\n    }\n  }\n  return 0;\n};\nfb.core.util.nameCompare = function(a, b) {\n  if (a === b) {\n    return 0;\n  } else {\n    var aAsInt = fb.core.util.tryParseInt(a), bAsInt = fb.core.util.tryParseInt(b);\n    if (aAsInt !== null) {\n      if (bAsInt !== null) {\n        return aAsInt - bAsInt == 0 ? a.length - b.length : aAsInt - bAsInt;\n      } else {\n        return-1;\n      }\n    } else {\n      if (bAsInt !== null) {\n        return 1;\n      } else {\n        return a < b ? -1 : 1;\n      }\n    }\n  }\n};\nfb.core.util.requireKey = function(key, obj) {\n  if (obj && key in obj) {\n    return obj[key];\n  } else {\n    throw new Error(\"Missing required key (\" + key + \") in object: \" + fb.util.json.stringify(obj));\n  }\n};\nfb.core.util.ObjectToUniqueKey = function(obj) {\n  if (typeof obj !== \"object\" || obj === null) {\n    return fb.util.json.stringify(obj);\n  }\n  var keys = [];\n  for (var k in obj) {\n    keys.push(k);\n  }\n  keys.sort();\n  var key = \"{\";\n  for (var i = 0;i < keys.length;i++) {\n    if (i !== 0) {\n      key += \",\";\n    }\n    key += fb.util.json.stringify(keys[i]);\n    key += \":\";\n    key += fb.core.util.ObjectToUniqueKey(obj[keys[i]]);\n  }\n  key += \"}\";\n  return key;\n};\nfb.core.util.splitStringBySize = function(str, segsize) {\n  if (str.length <= segsize) {\n    return[str];\n  }\n  var dataSegs = [];\n  for (var c = 0;c < str.length;c += segsize) {\n    if (c + segsize > str) {\n      dataSegs.push(str.substring(c, str.length));\n    } else {\n      dataSegs.push(str.substring(c, c + segsize));\n    }\n  }\n  return dataSegs;\n};\nfb.core.util.each = function(obj, fn) {\n  if (goog.isArray(obj)) {\n    for (var i = 0;i < obj.length;++i) {\n      fn(i, obj[i]);\n    }\n  } else {\n    goog.object.forEach(obj, fn);\n  }\n};\nfb.core.util.bindCallback = function(callback, opt_context) {\n  return opt_context ? goog.bind(callback, opt_context) : callback;\n};\nfb.core.util.doubleToIEEE754String = function(v) {\n  fb.core.util.assert(!fb.core.util.isInvalidJSONNumber(v), \"Invalid JSON number\");\n  var ebits = 11, fbits = 52;\n  var bias = (1 << ebits - 1) - 1, s, e, f, ln, i, bits, str, bytes;\n  if (v === 0) {\n    e = 0;\n    f = 0;\n    s = 1 / v === -Infinity ? 1 : 0;\n  } else {\n    s = v < 0;\n    v = Math.abs(v);\n    if (v >= Math.pow(2, 1 - bias)) {\n      ln = Math.min(Math.floor(Math.log(v) / Math.LN2), bias);\n      e = ln + bias;\n      f = Math.round(v * Math.pow(2, fbits - ln) - Math.pow(2, fbits));\n    } else {\n      e = 0;\n      f = Math.round(v / Math.pow(2, 1 - bias - fbits));\n    }\n  }\n  bits = [];\n  for (i = fbits;i;i -= 1) {\n    bits.push(f % 2 ? 1 : 0);\n    f = Math.floor(f / 2);\n  }\n  for (i = ebits;i;i -= 1) {\n    bits.push(e % 2 ? 1 : 0);\n    e = Math.floor(e / 2);\n  }\n  bits.push(s ? 1 : 0);\n  bits.reverse();\n  str = bits.join(\"\");\n  var hexByteString = \"\";\n  for (i = 0;i < 64;i += 8) {\n    var hexByte = parseInt(str.substr(i, 8), 2).toString(16);\n    if (hexByte.length === 1) {\n      hexByte = \"0\" + hexByte;\n    }\n    hexByteString = hexByteString + hexByte;\n  }\n  return hexByteString.toLowerCase();\n};\nfb.core.util.isChromeExtensionContentScript = function() {\n  return!!(typeof window === \"object\" && window[\"chrome\"] && window[\"chrome\"][\"extension\"] && !/^chrome/.test(window.location.href));\n};\nfb.core.util.isWindowsStoreApp = function() {\n  return typeof Windows === \"object\" && typeof Windows.UI === \"object\";\n};\nfb.core.util.errorForServerCode = function(code) {\n  var reason = \"Unknown Error\";\n  if (code === \"too_big\") {\n    reason = \"The data requested exceeds the maximum size that can be accessed with a single request.\";\n  } else {\n    if (code == \"permission_denied\") {\n      reason = \"Client doesn't have permission to access the desired data.\";\n    } else {\n      if (code == \"unavailable\") {\n        reason = \"The service is unavailable\";\n      }\n    }\n  }\n  var error = new Error(code + \": \" + reason);\n  error.code = code.toUpperCase();\n  return error;\n};\nfb.core.util.INTEGER_REGEXP_ = new RegExp(\"^-?\\\\d{1,10}$\");\nfb.core.util.tryParseInt = function(str) {\n  if (fb.core.util.INTEGER_REGEXP_.test(str)) {\n    var intVal = Number(str);\n    if (intVal >= -2147483648 && intVal <= 2147483647) {\n      return intVal;\n    }\n  }\n  return null;\n};\nfb.core.util.exceptionGuard = function(fn) {\n  try {\n    fn();\n  } catch (e) {\n    setTimeout(function() {\n      throw e;\n    }, Math.floor(0));\n  }\n};\ngoog.provide(\"fb.core.snap.LeafNode\");\ngoog.require(\"fb.core.util\");\nfb.core.snap.LeafNode = function(value, opt_priority) {\n  this.value_ = value;\n  fb.core.util.assert(this.value_ !== null, \"LeafNode shouldn't be created with null value.\");\n  this.priority_ = typeof opt_priority !== \"undefined\" ? opt_priority : null;\n};\nfb.core.snap.LeafNode.prototype.isLeafNode = function() {\n  return true;\n};\nfb.core.snap.LeafNode.prototype.getPriority = function() {\n  return this.priority_;\n};\nfb.core.snap.LeafNode.prototype.updatePriority = function(newPriority) {\n  return new fb.core.snap.LeafNode(this.value_, newPriority);\n};\nfb.core.snap.LeafNode.prototype.updateValue = function(newValue) {\n  return new fb.core.snap.LeafNode(newValue, this.priority_);\n};\nfb.core.snap.LeafNode.prototype.getImmediateChild = function(childName) {\n  return fb.core.snap.EMPTY_NODE;\n};\nfb.core.snap.LeafNode.prototype.getChild = function(path) {\n  return path.getFront() === null ? this : fb.core.snap.EMPTY_NODE;\n};\nfb.core.snap.LeafNode.prototype.getPredecessorChildName = function(childName, childNode) {\n  return null;\n};\nfb.core.snap.LeafNode.prototype.updateImmediateChild = function(childName, newChildNode) {\n  return(new fb.core.snap.ChildrenNode).updateImmediateChild(childName, newChildNode).updatePriority(this.priority_);\n};\nfb.core.snap.LeafNode.prototype.updateChild = function(path, newChildNode) {\n  var front = path.getFront();\n  if (front === null) {\n    return newChildNode;\n  }\n  return this.updateImmediateChild(front, fb.core.snap.EMPTY_NODE.updateChild(path.popFront(), newChildNode));\n};\nfb.core.snap.LeafNode.prototype.isEmpty = function() {\n  return false;\n};\nfb.core.snap.LeafNode.prototype.numChildren = function() {\n  return 0;\n};\nfb.core.snap.LeafNode.prototype.val = function(opt_exportFormat) {\n  if (opt_exportFormat && this.getPriority() !== null) {\n    return{\".value\":this.getValue(), \".priority\":this.getPriority()};\n  } else {\n    return this.getValue();\n  }\n};\nfb.core.snap.LeafNode.prototype.hash = function() {\n  var toHash = \"\";\n  if (this.getPriority() !== null) {\n    toHash += \"priority:\" + fb.core.snap.priorityHashText(this.getPriority()) + \":\";\n  }\n  var type = typeof this.value_;\n  toHash += type + \":\";\n  if (type === \"number\") {\n    toHash += fb.core.util.doubleToIEEE754String((this.value_));\n  } else {\n    toHash += this.value_;\n  }\n  return fb.core.util.sha1(toHash);\n};\nfb.core.snap.LeafNode.prototype.getValue = function() {\n  return this.value_;\n};\nif (goog.DEBUG) {\n  fb.core.snap.LeafNode.prototype.toString = function() {\n    if (typeof this.value_ === \"string\") {\n      return(this.value_);\n    } else {\n      return'\"' + this.value_ + '\"';\n    }\n  };\n}\n;goog.provide(\"fb.core.snap.comparators\");\nfb.core.snap.NAME_AND_PRIORITY_COMPARATOR = function(left, right) {\n  return fb.core.util.priorityCompare(left.priority, right.priority) || fb.core.util.nameCompare(left.name, right.name);\n};\nfb.core.snap.NAME_ONLY_COMPARATOR = function(left, right) {\n  return fb.core.util.nameCompare(left.name, right.name);\n};\nfb.core.snap.NAME_COMPARATOR = function(left, right) {\n  return fb.core.util.nameCompare(left, right);\n};\ngoog.provide(\"fb.core.snap.ChildrenNode\");\ngoog.require(\"fb.core.snap.comparators\");\ngoog.require(\"fb.core.util\");\ngoog.require(\"fb.core.util.SortedMap\");\nfb.core.snap.ChildrenNode = function(opt_children, opt_priority) {\n  this.children_ = opt_children || new fb.core.util.SortedMap(fb.core.snap.NAME_COMPARATOR);\n  this.priority_ = typeof opt_priority !== \"undefined\" ? opt_priority : null;\n};\nfb.core.snap.ChildrenNode.prototype.isLeafNode = function() {\n  return false;\n};\nfb.core.snap.ChildrenNode.prototype.getPriority = function() {\n  return this.priority_;\n};\nfb.core.snap.ChildrenNode.prototype.updatePriority = function(newPriority) {\n  return new fb.core.snap.ChildrenNode(this.children_, newPriority);\n};\nfb.core.snap.ChildrenNode.prototype.updateValue = function(newValue) {\n  return new fb.core.snap.LeafNode(newValue, this.priority_);\n};\nfb.core.snap.ChildrenNode.prototype.updateImmediateChild = function(childName, newChildNode) {\n  var newChildren = this.children_.remove(childName);\n  if (newChildNode && newChildNode.isEmpty()) {\n    newChildNode = null;\n  }\n  if (newChildNode !== null) {\n    newChildren = newChildren.insert(childName, newChildNode);\n  }\n  if (newChildNode && newChildNode.getPriority() !== null) {\n    return new fb.core.snap.SortedChildrenNode(newChildren, null, this.priority_);\n  } else {\n    return new fb.core.snap.ChildrenNode(newChildren, this.priority_);\n  }\n};\nfb.core.snap.ChildrenNode.prototype.updateChild = function(path, newChildNode) {\n  var front = path.getFront();\n  if (front === null) {\n    return newChildNode;\n  }\n  var newImmediateChild = this.getImmediateChild(front).updateChild(path.popFront(), newChildNode);\n  return this.updateImmediateChild(front, newImmediateChild);\n};\nfb.core.snap.ChildrenNode.prototype.isEmpty = function() {\n  return this.children_.isEmpty();\n};\nfb.core.snap.ChildrenNode.prototype.numChildren = function() {\n  return this.children_.count();\n};\nfb.core.snap.ChildrenNode.INTEGER_REGEXP_ = /^\\d+$/;\nfb.core.snap.ChildrenNode.prototype.val = function(opt_exportFormat) {\n  if (this.isEmpty()) {\n    return null;\n  }\n  var obj = {};\n  var numKeys = 0, maxKey = 0, allIntegerKeys = true;\n  this.forEachChild(function(key, childNode) {\n    obj[key] = childNode.val(opt_exportFormat);\n    numKeys++;\n    if (allIntegerKeys && fb.core.snap.ChildrenNode.INTEGER_REGEXP_.test(key)) {\n      maxKey = Math.max(maxKey, Number(key));\n    } else {\n      allIntegerKeys = false;\n    }\n  });\n  if (!opt_exportFormat && allIntegerKeys && maxKey < 2 * numKeys) {\n    var array = [];\n    for (var key in obj) {\n      array[key] = obj[key];\n    }\n    return array;\n  } else {\n    if (opt_exportFormat && this.getPriority() !== null) {\n      obj[\".priority\"] = this.getPriority();\n    }\n    return obj;\n  }\n};\nfb.core.snap.ChildrenNode.prototype.hash = function() {\n  var toHash = \"\";\n  if (this.getPriority() !== null) {\n    toHash += \"priority:\" + fb.core.snap.priorityHashText(this.getPriority()) + \":\";\n  }\n  this.forEachChild(function(key, childNode) {\n    var childHash = childNode.hash();\n    if (childHash !== \"\") {\n      toHash += \":\" + key + \":\" + childHash;\n    }\n  });\n  return toHash === \"\" ? \"\" : fb.core.util.sha1(toHash);\n};\nfb.core.snap.ChildrenNode.prototype.getImmediateChild = function(childName) {\n  var child = this.children_.get(childName);\n  return child === null ? fb.core.snap.EMPTY_NODE : child;\n};\nfb.core.snap.ChildrenNode.prototype.getChild = function(path) {\n  var front = path.getFront();\n  if (front === null) {\n    return this;\n  }\n  return this.getImmediateChild(front).getChild(path.popFront());\n};\nfb.core.snap.ChildrenNode.prototype.getPredecessorChildName = function(childName, childNode) {\n  return this.children_.getPredecessorKey(childName);\n};\nfb.core.snap.ChildrenNode.prototype.getFirstChildName = function() {\n  return this.children_.minKey();\n};\nfb.core.snap.ChildrenNode.prototype.getLastChildName = function() {\n  return this.children_.maxKey();\n};\nfb.core.snap.ChildrenNode.prototype.forEachChild = function(action) {\n  return this.children_.inorderTraversal(action);\n};\nfb.core.snap.ChildrenNode.prototype.forEachChildReverse = function(action) {\n  return this.children_.reverseTraversal(action);\n};\nfb.core.snap.ChildrenNode.prototype.getIterator = function() {\n  return this.children_.getIterator();\n};\nif (goog.DEBUG) {\n  fb.core.snap.ChildrenNode.prototype.toString = function() {\n    var s = \"{\";\n    var first = true;\n    this.forEachChild(function(key, value) {\n      if (first) {\n        first = false;\n      } else {\n        s += \", \";\n      }\n      s += '\"' + key + '\" : ' + value.toString();\n    });\n    s += \"}\";\n    return s;\n  };\n}\nfb.core.snap.EMPTY_NODE = new fb.core.snap.ChildrenNode;\ngoog.provide(\"fb.core.snap.SortedChildrenNode\");\ngoog.require(\"fb.core.snap.comparators\");\ngoog.require(\"fb.core.util.SortedMap\");\nfb.core.snap.SortedChildrenNode = function(children, sortedChildren, opt_priority) {\n  fb.core.snap.ChildrenNode.call(this, children, opt_priority);\n  if (sortedChildren === null) {\n    sortedChildren = new fb.core.util.SortedMap(fb.core.snap.NAME_AND_PRIORITY_COMPARATOR);\n    children.inorderTraversal(function(name, node) {\n      sortedChildren = sortedChildren.insert({name:name, priority:node.getPriority()}, node);\n    });\n  }\n  this.sortedChildren_ = sortedChildren;\n};\ngoog.inherits(fb.core.snap.SortedChildrenNode, fb.core.snap.ChildrenNode);\nfb.core.snap.SortedChildrenNode.prototype.updateImmediateChild = function(childName, newChildNode) {\n  var oldChildNode = this.getImmediateChild(childName);\n  var newChildren = this.children_, newSortedChildren = this.sortedChildren_;\n  if (oldChildNode !== null) {\n    newChildren = newChildren.remove(childName);\n    newSortedChildren = newSortedChildren.remove({name:childName, priority:oldChildNode.getPriority()});\n  }\n  if (newChildNode && newChildNode.isEmpty()) {\n    newChildNode = null;\n  }\n  if (newChildNode !== null) {\n    newChildren = newChildren.insert(childName, newChildNode);\n    newSortedChildren = newSortedChildren.insert({name:childName, priority:newChildNode.getPriority()}, newChildNode);\n  }\n  return new fb.core.snap.SortedChildrenNode(newChildren, newSortedChildren, this.getPriority());\n};\nfb.core.snap.SortedChildrenNode.prototype.getPredecessorChildName = function(childName, childNode) {\n  var pred = this.sortedChildren_.getPredecessorKey({name:childName, priority:childNode.getPriority()});\n  return pred ? pred.name : null;\n};\nfb.core.snap.SortedChildrenNode.prototype.forEachChild = function(action) {\n  return this.sortedChildren_.inorderTraversal(function(key, value) {\n    return action(key.name, value);\n  });\n};\nfb.core.snap.SortedChildrenNode.prototype.forEachChildReverse = function(action) {\n  return this.sortedChildren_.reverseTraversal(function(key, value) {\n    return action(key.name, value);\n  });\n};\nfb.core.snap.SortedChildrenNode.prototype.getIterator = function() {\n  return this.sortedChildren_.getIterator(function(key, value) {\n    return{key:key.name, value:value};\n  });\n};\nfb.core.snap.SortedChildrenNode.prototype.getFirstChildName = function() {\n  return this.sortedChildren_.isEmpty() ? null : this.sortedChildren_.minKey().name;\n};\nfb.core.snap.SortedChildrenNode.prototype.getLastChildName = function() {\n  return this.sortedChildren_.isEmpty() ? null : this.sortedChildren_.maxKey().name;\n};\ngoog.provide(\"fb.core.snap\");\ngoog.require(\"fb.core.snap.ChildrenNode\");\ngoog.require(\"fb.core.snap.LeafNode\");\ngoog.require(\"fb.core.snap.SortedChildrenNode\");\nvar USE_HINZE = true;\nfb.core.snap.NodeFromJSON = function(json, opt_priority) {\n  if (json === null) {\n    return fb.core.snap.EMPTY_NODE;\n  }\n  var priority = null;\n  if (typeof json === \"object\" && \".priority\" in json) {\n    priority = json[\".priority\"];\n  } else {\n    if (typeof opt_priority !== \"undefined\") {\n      priority = opt_priority;\n    }\n  }\n  fb.core.util.assert(priority === null || typeof priority === \"string\" || typeof priority === \"number\" || typeof priority === \"object\" && \".sv\" in priority, \"Invalid priority type found: \" + typeof priority);\n  if (typeof json === \"object\" && \".value\" in json && json[\".value\"] !== null) {\n    json = json[\".value\"];\n  }\n  if (typeof json !== \"object\" || \".sv\" in json) {\n    var jsonLeaf = (json);\n    return new fb.core.snap.LeafNode(jsonLeaf, priority);\n  }\n  if (!(json instanceof Array) && USE_HINZE) {\n    var children = [];\n    var childData = {};\n    var childrenHavePriority = false;\n    var hinzeJsonObj = (json);\n    fb.core.util.each(hinzeJsonObj, function(child, key) {\n      if (typeof key !== \"string\" || key.substring(0, 1) !== \".\") {\n        var childNode = fb.core.snap.NodeFromJSON(hinzeJsonObj[key]);\n        if (!childNode.isEmpty()) {\n          childrenHavePriority = childrenHavePriority || childNode.getPriority() !== null;\n          children.push({name:key, priority:childNode.getPriority()});\n          childData[key] = childNode;\n        }\n      }\n    });\n    var childSet = fb.core.snap.buildChildSet(children, childData, false);\n    if (childrenHavePriority) {\n      var sortedChildSet = fb.core.snap.buildChildSet(children, childData, true);\n      return new fb.core.snap.SortedChildrenNode(childSet, sortedChildSet, priority);\n    } else {\n      return new fb.core.snap.ChildrenNode(childSet, priority);\n    }\n  } else {\n    var node = fb.core.snap.EMPTY_NODE;\n    var jsonObj = (json);\n    goog.object.forEach(jsonObj, function(childData, key) {\n      if (fb.util.obj.contains(jsonObj, key)) {\n        if (key.substring(0, 1) !== \".\") {\n          var childNode = fb.core.snap.NodeFromJSON(childData);\n          if (childNode.isLeafNode() || !childNode.isEmpty()) {\n            node = node.updateImmediateChild(key, childNode);\n          }\n        }\n      }\n    });\n    return node.updatePriority(priority);\n  }\n};\nvar LOG_2 = Math.log(2);\nfb.core.snap.Base12Num = function(length) {\n  var logBase2 = function(num) {\n    return parseInt(Math.log(num) / LOG_2, 10);\n  };\n  var bitMask = function(bits) {\n    return parseInt(Array(bits + 1).join(\"1\"), 2);\n  };\n  this.count = logBase2(length + 1);\n  this.current_ = this.count - 1;\n  var mask = bitMask(this.count);\n  this.bits_ = length + 1 & mask;\n};\nfb.core.snap.Base12Num.prototype.nextBitIsOne = function() {\n  var result = !(this.bits_ & 1 << this.current_);\n  this.current_--;\n  return result;\n};\nfb.core.snap.buildChildSet = function(childList, childData, usePriority) {\n  var cmp = usePriority ? fb.core.snap.NAME_AND_PRIORITY_COMPARATOR : fb.core.snap.NAME_ONLY_COMPARATOR;\n  childList.sort(cmp);\n  var buildBalancedTree = function(low, high) {\n    var length = high - low;\n    if (length == 0) {\n      return null;\n    } else {\n      if (length == 1) {\n        var name = childList[low].name;\n        var key = usePriority ? childList[low] : name;\n        return new fb.LLRBNode(key, childData[name], fb.LLRBNode.BLACK, null, null);\n      } else {\n        var middle = parseInt(length / 2, 10) + low;\n        var left = buildBalancedTree(low, middle);\n        var right = buildBalancedTree(middle + 1, high);\n        name = childList[middle].name;\n        key = usePriority ? childList[middle] : name;\n        return new fb.LLRBNode(key, childData[name], fb.LLRBNode.BLACK, left, right);\n      }\n    }\n  };\n  var buildFrom12Array = function(base12) {\n    var node = null;\n    var root = null;\n    var index = childList.length;\n    var buildPennant = function(chunkSize, color) {\n      var low = index - chunkSize;\n      var high = index;\n      index -= chunkSize;\n      var childTree = buildBalancedTree(low + 1, high);\n      var pennantName = childList[low].name;\n      var key = usePriority ? childList[low] : pennantName;\n      attachPennant(new fb.LLRBNode(key, childData[pennantName], color, null, childTree));\n    };\n    var attachPennant = function(pennant) {\n      if (node) {\n        node.left = pennant;\n        node = pennant;\n      } else {\n        root = pennant;\n        node = pennant;\n      }\n    };\n    for (var i = 0;i < base12.count;++i) {\n      var isOne = base12.nextBitIsOne();\n      var chunkSize = Math.pow(2, base12.count - (i + 1));\n      if (isOne) {\n        buildPennant(chunkSize, fb.LLRBNode.BLACK);\n      } else {\n        buildPennant(chunkSize, fb.LLRBNode.BLACK);\n        buildPennant(chunkSize, fb.LLRBNode.RED);\n      }\n    }\n    return root;\n  };\n  var base12 = new fb.core.snap.Base12Num(childList.length);\n  var root = buildFrom12Array(base12);\n  cmp = usePriority ? fb.core.snap.NAME_AND_PRIORITY_COMPARATOR : fb.core.snap.NAME_COMPARATOR;\n  if (root !== null) {\n    return new fb.core.util.SortedMap(cmp, root);\n  } else {\n    return new fb.core.util.SortedMap(cmp);\n  }\n};\nfb.core.snap.priorityHashText = function(priority) {\n  if (typeof priority === \"number\") {\n    return \"number:\" + fb.core.util.doubleToIEEE754String(priority);\n  } else {\n    return \"string:\" + priority;\n  }\n};\ngoog.provide(\"fb.api.DataSnapshot\");\ngoog.require(\"fb.core.snap\");\ngoog.require(\"fb.core.util.SortedMap\");\ngoog.require(\"fb.core.util.validation\");\nfb.api.DataSnapshot = function(node, ref) {\n  this.node_ = node;\n  this.ref_ = ref;\n};\nfb.api.DataSnapshot.prototype.val = function() {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.val\", 0, 0, arguments.length);\n  return this.node_.val();\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"val\", fb.api.DataSnapshot.prototype.val);\nfb.api.DataSnapshot.prototype.exportVal = function() {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.exportVal\", 0, 0, arguments.length);\n  return this.node_.val(true);\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"exportVal\", fb.api.DataSnapshot.prototype.exportVal);\nfb.api.DataSnapshot.prototype.child = function(childPathString) {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.child\", 0, 1, arguments.length);\n  if (goog.isNumber(childPathString)) {\n    childPathString = String(childPathString);\n  }\n  fb.core.util.validation.validatePathString(\"Firebase.DataSnapshot.child\", 1, childPathString, false);\n  var childPath = new fb.core.util.Path(childPathString);\n  var childRef = this.ref_.child(childPath);\n  return new fb.api.DataSnapshot(this.node_.getChild(childPath), childRef);\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"child\", fb.api.DataSnapshot.prototype.child);\nfb.api.DataSnapshot.prototype.hasChild = function(childPathString) {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.hasChild\", 1, 1, arguments.length);\n  fb.core.util.validation.validatePathString(\"Firebase.DataSnapshot.hasChild\", 1, childPathString, false);\n  var childPath = new fb.core.util.Path(childPathString);\n  return!this.node_.getChild(childPath).isEmpty();\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"hasChild\", fb.api.DataSnapshot.prototype.hasChild);\nfb.api.DataSnapshot.prototype.getPriority = function() {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.getPriority\", 0, 0, arguments.length);\n  return this.node_.getPriority();\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"getPriority\", fb.api.DataSnapshot.prototype.getPriority);\nfb.api.DataSnapshot.prototype.forEach = function(action) {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.forEach\", 1, 1, arguments.length);\n  fb.util.validation.validateCallback(\"Firebase.DataSnapshot.forEach\", 1, action, false);\n  if (this.node_.isLeafNode()) {\n    return false;\n  }\n  var self = this;\n  return this.node_.forEachChild(function(key, node) {\n    return action(new fb.api.DataSnapshot(node, self.ref_.child(key)));\n  });\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"forEach\", fb.api.DataSnapshot.prototype.forEach);\nfb.api.DataSnapshot.prototype.hasChildren = function() {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.hasChildren\", 0, 0, arguments.length);\n  if (this.node_.isLeafNode()) {\n    return false;\n  } else {\n    return!this.node_.isEmpty();\n  }\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"hasChildren\", fb.api.DataSnapshot.prototype.hasChildren);\nfb.api.DataSnapshot.prototype.name = function() {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.name\", 0, 0, arguments.length);\n  return this.ref_.name();\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"name\", fb.api.DataSnapshot.prototype.name);\nfb.api.DataSnapshot.prototype.numChildren = function() {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.numChildren\", 0, 0, arguments.length);\n  return this.node_.numChildren();\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"numChildren\", fb.api.DataSnapshot.prototype.numChildren);\nfb.api.DataSnapshot.prototype.ref = function() {\n  fb.util.validation.validateArgCount(\"Firebase.DataSnapshot.ref\", 0, 0, arguments.length);\n  return this.ref_;\n};\ngoog.exportProperty(fb.api.DataSnapshot.prototype, \"ref\", fb.api.DataSnapshot.prototype.ref);\ngoog.provide(\"fb.core.util.EventEmitter\");\ngoog.require(\"fb.core.util\");\nfb.core.util.EventEmitter = function(allowedEvents) {\n  fb.core.util.assert(goog.isArray(allowedEvents) && allowedEvents.length > 0, \"Requires a non-empty array\");\n  this.allowedEvents_ = allowedEvents;\n  this.listeners_ = {};\n};\nfb.core.util.EventEmitter.prototype.getInitialEvent = goog.abstractMethod;\nfb.core.util.EventEmitter.prototype.trigger = function(eventType, var_args) {\n  var listeners = this.listeners_[eventType] || [];\n  for (var i = 0;i < listeners.length;i++) {\n    listeners[i].callback.apply(listeners[i].context, Array.prototype.slice.call(arguments, 1));\n  }\n};\nfb.core.util.EventEmitter.prototype.on = function(eventType, callback, context) {\n  this.validateEventType_(eventType);\n  this.listeners_[eventType] = this.listeners_[eventType] || [];\n  this.listeners_[eventType].push({callback:callback, context:context});\n  var eventData = this.getInitialEvent(eventType);\n  if (eventData) {\n    callback.apply(context, eventData);\n  }\n};\nfb.core.util.EventEmitter.prototype.off = function(eventType, callback, context) {\n  this.validateEventType_(eventType);\n  var listeners = this.listeners_[eventType] || [];\n  for (var i = 0;i < listeners.length;i++) {\n    if (listeners[i].callback === callback && (!context || context === listeners[i].context)) {\n      listeners.splice(i, 1);\n      return;\n    }\n  }\n};\nfb.core.util.EventEmitter.prototype.validateEventType_ = function(eventType) {\n  fb.core.util.assert(goog.array.find(this.allowedEvents_, function(et) {\n    return et === eventType;\n  }), \"Unknown event: \" + eventType);\n};\ngoog.provide(\"fb.core.util.VisibilityMonitor\");\ngoog.require(\"fb.core.util.EventEmitter\");\nfb.core.util.VisibilityMonitor = function() {\n  fb.core.util.EventEmitter.call(this, [\"visible\"]);\n  var hidden, visibilityChange;\n  if (typeof document !== \"undefined\" && typeof document.addEventListener !== \"undefined\") {\n    if (typeof document[\"hidden\"] !== \"undefined\") {\n      visibilityChange = \"visibilitychange\";\n      hidden = \"hidden\";\n    } else {\n      if (typeof document[\"mozHidden\"] !== \"undefined\") {\n        visibilityChange = \"mozvisibilitychange\";\n        hidden = \"mozHidden\";\n      } else {\n        if (typeof document[\"msHidden\"] !== \"undefined\") {\n          visibilityChange = \"msvisibilitychange\";\n          hidden = \"msHidden\";\n        } else {\n          if (typeof document[\"webkitHidden\"] !== \"undefined\") {\n            visibilityChange = \"webkitvisibilitychange\";\n            hidden = \"webkitHidden\";\n          }\n        }\n      }\n    }\n  }\n  this.visible_ = true;\n  if (visibilityChange) {\n    var self = this;\n    document.addEventListener(visibilityChange, function() {\n      var visible = !document[hidden];\n      if (visible !== self.visible_) {\n        self.visible_ = visible;\n        self.trigger(\"visible\", visible);\n      }\n    }, false);\n  }\n};\ngoog.inherits(fb.core.util.VisibilityMonitor, fb.core.util.EventEmitter);\ngoog.addSingletonGetter(fb.core.util.VisibilityMonitor);\nfb.core.util.VisibilityMonitor.prototype.getInitialEvent = function(eventType) {\n  fb.core.util.assert(eventType === \"visible\", \"Unknown event type: \" + eventType);\n  return[this.visible_];\n};\ngoog.provide(\"fb.core.util.OnlineMonitor\");\ngoog.require(\"fb.core.util.EventEmitter\");\nfb.core.util.OnlineMonitor = function() {\n  fb.core.util.EventEmitter.call(this, [\"online\"]);\n  this.online_ = true;\n  if (typeof window !== \"undefined\" && typeof window.addEventListener !== \"undefined\") {\n    var self = this;\n    window.addEventListener(\"online\", function() {\n      if (!self.online_) {\n        self.trigger(\"online\", true);\n      }\n      self.online_ = true;\n    }, false);\n    window.addEventListener(\"offline\", function() {\n      if (self.online_) {\n        self.trigger(\"online\", false);\n      }\n      self.online_ = false;\n    }, false);\n  }\n};\ngoog.inherits(fb.core.util.OnlineMonitor, fb.core.util.EventEmitter);\ngoog.addSingletonGetter(fb.core.util.OnlineMonitor);\nfb.core.util.OnlineMonitor.prototype.getInitialEvent = function(eventType) {\n  fb.core.util.assert(eventType === \"online\", \"Unknown event type: \" + eventType);\n  return[this.online_];\n};\ngoog.provide(\"fb.realtime.Constants\");\nfb.realtime.Constants = {PROTOCOL_VERSION:\"5\", VERSION_PARAM:\"v\", SESSION_PARAM:\"s\"};\ngoog.provide(\"fb.realtime.Transport\");\ngoog.require(\"fb.core.RepoInfo\");\nfb.realtime.Transport = function(connId, repoInfo, sessionId) {\n};\nfb.realtime.Transport.prototype.open = function(onMessage, onDisconnect) {\n};\nfb.realtime.Transport.prototype.start = function() {\n};\nfb.realtime.Transport.prototype.close = function() {\n};\nfb.realtime.Transport.prototype.send = function(data) {\n};\nfb.realtime.Transport.prototype.bytesReceived;\nfb.realtime.Transport.prototype.bytesSent;\ngoog.provide(\"fb.core.util.NodePatches\");\n(function() {\n  if (NODE_CLIENT) {\n    var version = process[\"version\"];\n    if (version === \"v0.10.22\" || version === \"v0.10.23\" || version === \"v0.10.24\") {\n      var Writable = require(\"_stream_writable\");\n      Writable[\"prototype\"][\"write\"] = function(chunk, encoding, cb) {\n        var state = this[\"_writableState\"];\n        var ret = false;\n        if (typeof encoding === \"function\") {\n          cb = encoding;\n          encoding = null;\n        }\n        if (Buffer[\"isBuffer\"](chunk)) {\n          encoding = \"buffer\";\n        } else {\n          if (!encoding) {\n            encoding = state[\"defaultEncoding\"];\n          }\n        }\n        if (typeof cb !== \"function\") {\n          cb = function() {\n          };\n        }\n        if (state[\"ended\"]) {\n          writeAfterEnd(this, state, cb);\n        } else {\n          if (validChunk(this, state, chunk, cb)) {\n            ret = writeOrBuffer(this, state, chunk, encoding, cb);\n          }\n        }\n        return ret;\n      };\n      function writeAfterEnd(stream, state, cb) {\n        var er = new Error(\"write after end\");\n        stream[\"emit\"](\"error\", er);\n        process[\"nextTick\"](function() {\n          cb(er);\n        });\n      }\n      function validChunk(stream, state, chunk, cb) {\n        var valid = true;\n        if (!Buffer[\"isBuffer\"](chunk) && \"string\" !== typeof chunk && chunk !== null && chunk !== undefined && !state[\"objectMode\"]) {\n          var er = new TypeError(\"Invalid non-string/buffer chunk\");\n          stream[\"emit\"](\"error\", er);\n          process[\"nextTick\"](function() {\n            cb(er);\n          });\n          valid = false;\n        }\n        return valid;\n      }\n      function writeOrBuffer(stream, state, chunk, encoding, cb) {\n        chunk = decodeChunk(state, chunk, encoding);\n        if (Buffer[\"isBuffer\"](chunk)) {\n          encoding = \"buffer\";\n        }\n        var len = state[\"objectMode\"] ? 1 : chunk[\"length\"];\n        state[\"length\"] += len;\n        var ret = state[\"length\"] < state[\"highWaterMark\"];\n        if (!ret) {\n          state[\"needDrain\"] = true;\n        }\n        if (state[\"writing\"]) {\n          state[\"buffer\"][\"push\"](new WriteReq(chunk, encoding, cb));\n        } else {\n          doWrite(stream, state, len, chunk, encoding, cb);\n        }\n        return ret;\n      }\n      function decodeChunk(state, chunk, encoding) {\n        if (!state[\"objectMode\"] && state[\"decodeStrings\"] !== false && typeof chunk === \"string\") {\n          chunk = new Buffer(chunk, encoding);\n        }\n        return chunk;\n      }\n      function WriteReq(chunk, encoding, cb) {\n        this[\"chunk\"] = chunk;\n        this[\"encoding\"] = encoding;\n        this[\"callback\"] = cb;\n      }\n      function doWrite(stream, state, len, chunk, encoding, cb) {\n        state[\"writelen\"] = len;\n        state[\"writecb\"] = cb;\n        state[\"writing\"] = true;\n        state[\"sync\"] = true;\n        stream[\"_write\"](chunk, encoding, state[\"onwrite\"]);\n        state[\"sync\"] = false;\n      }\n      var Duplex = require(\"_stream_duplex\");\n      Duplex[\"prototype\"][\"write\"] = Writable[\"prototype\"][\"write\"];\n    }\n  }\n})();\ngoog.provide(\"goog.object\");\ngoog.object.forEach = function(obj, f, opt_obj) {\n  for (var key in obj) {\n    f.call(opt_obj, obj[key], key, obj);\n  }\n};\ngoog.object.filter = function(obj, f, opt_obj) {\n  var res = {};\n  for (var key in obj) {\n    if (f.call(opt_obj, obj[key], key, obj)) {\n      res[key] = obj[key];\n    }\n  }\n  return res;\n};\ngoog.object.map = function(obj, f, opt_obj) {\n  var res = {};\n  for (var key in obj) {\n    res[key] = f.call(opt_obj, obj[key], key, obj);\n  }\n  return res;\n};\ngoog.object.some = function(obj, f, opt_obj) {\n  for (var key in obj) {\n    if (f.call(opt_obj, obj[key], key, obj)) {\n      return true;\n    }\n  }\n  return false;\n};\ngoog.object.every = function(obj, f, opt_obj) {\n  for (var key in obj) {\n    if (!f.call(opt_obj, obj[key], key, obj)) {\n      return false;\n    }\n  }\n  return true;\n};\ngoog.object.getCount = function(obj) {\n  var rv = 0;\n  for (var key in obj) {\n    rv++;\n  }\n  return rv;\n};\ngoog.object.getAnyKey = function(obj) {\n  for (var key in obj) {\n    return key;\n  }\n};\ngoog.object.getAnyValue = function(obj) {\n  for (var key in obj) {\n    return obj[key];\n  }\n};\ngoog.object.contains = function(obj, val) {\n  return goog.object.containsValue(obj, val);\n};\ngoog.object.getValues = function(obj) {\n  var res = [];\n  var i = 0;\n  for (var key in obj) {\n    res[i++] = obj[key];\n  }\n  return res;\n};\ngoog.object.getKeys = function(obj) {\n  var res = [];\n  var i = 0;\n  for (var key in obj) {\n    res[i++] = key;\n  }\n  return res;\n};\ngoog.object.getValueByKeys = function(obj, var_args) {\n  var isArrayLike = goog.isArrayLike(var_args);\n  var keys = isArrayLike ? var_args : arguments;\n  for (var i = isArrayLike ? 0 : 1;i < keys.length;i++) {\n    obj = obj[keys[i]];\n    if (!goog.isDef(obj)) {\n      break;\n    }\n  }\n  return obj;\n};\ngoog.object.containsKey = function(obj, key) {\n  return key in obj;\n};\ngoog.object.containsValue = function(obj, val) {\n  for (var key in obj) {\n    if (obj[key] == val) {\n      return true;\n    }\n  }\n  return false;\n};\ngoog.object.findKey = function(obj, f, opt_this) {\n  for (var key in obj) {\n    if (f.call(opt_this, obj[key], key, obj)) {\n      return key;\n    }\n  }\n  return undefined;\n};\ngoog.object.findValue = function(obj, f, opt_this) {\n  var key = goog.object.findKey(obj, f, opt_this);\n  return key && obj[key];\n};\ngoog.object.isEmpty = function(obj) {\n  for (var key in obj) {\n    return false;\n  }\n  return true;\n};\ngoog.object.clear = function(obj) {\n  for (var i in obj) {\n    delete obj[i];\n  }\n};\ngoog.object.remove = function(obj, key) {\n  var rv;\n  if (rv = key in obj) {\n    delete obj[key];\n  }\n  return rv;\n};\ngoog.object.add = function(obj, key, val) {\n  if (key in obj) {\n    throw Error('The object already contains the key \"' + key + '\"');\n  }\n  goog.object.set(obj, key, val);\n};\ngoog.object.get = function(obj, key, opt_val) {\n  if (key in obj) {\n    return obj[key];\n  }\n  return opt_val;\n};\ngoog.object.set = function(obj, key, value) {\n  obj[key] = value;\n};\ngoog.object.setIfUndefined = function(obj, key, value) {\n  return key in obj ? obj[key] : obj[key] = value;\n};\ngoog.object.clone = function(obj) {\n  var res = {};\n  for (var key in obj) {\n    res[key] = obj[key];\n  }\n  return res;\n};\ngoog.object.unsafeClone = function(obj) {\n  var type = goog.typeOf(obj);\n  if (type == \"object\" || type == \"array\") {\n    if (obj.clone) {\n      return obj.clone();\n    }\n    var clone = type == \"array\" ? [] : {};\n    for (var key in obj) {\n      clone[key] = goog.object.unsafeClone(obj[key]);\n    }\n    return clone;\n  }\n  return obj;\n};\ngoog.object.transpose = function(obj) {\n  var transposed = {};\n  for (var key in obj) {\n    transposed[obj[key]] = key;\n  }\n  return transposed;\n};\ngoog.object.PROTOTYPE_FIELDS_ = [\"constructor\", \"hasOwnProperty\", \"isPrototypeOf\", \"propertyIsEnumerable\", \"toLocaleString\", \"toString\", \"valueOf\"];\ngoog.object.extend = function(target, var_args) {\n  var key, source;\n  for (var i = 1;i < arguments.length;i++) {\n    source = arguments[i];\n    for (key in source) {\n      target[key] = source[key];\n    }\n    for (var j = 0;j < goog.object.PROTOTYPE_FIELDS_.length;j++) {\n      key = goog.object.PROTOTYPE_FIELDS_[j];\n      if (Object.prototype.hasOwnProperty.call(source, key)) {\n        target[key] = source[key];\n      }\n    }\n  }\n};\ngoog.object.create = function(var_args) {\n  var argLength = arguments.length;\n  if (argLength == 1 && goog.isArray(arguments[0])) {\n    return goog.object.create.apply(null, arguments[0]);\n  }\n  if (argLength % 2) {\n    throw Error(\"Uneven number of arguments\");\n  }\n  var rv = {};\n  for (var i = 0;i < argLength;i += 2) {\n    rv[arguments[i]] = arguments[i + 1];\n  }\n  return rv;\n};\ngoog.object.createSet = function(var_args) {\n  var argLength = arguments.length;\n  if (argLength == 1 && goog.isArray(arguments[0])) {\n    return goog.object.createSet.apply(null, arguments[0]);\n  }\n  var rv = {};\n  for (var i = 0;i < argLength;i++) {\n    rv[arguments[i]] = true;\n  }\n  return rv;\n};\ngoog.object.createImmutableView = function(obj) {\n  var result = obj;\n  if (Object.isFrozen && !Object.isFrozen(obj)) {\n    result = Object.create(obj);\n    Object.freeze(result);\n  }\n  return result;\n};\ngoog.object.isImmutableView = function(obj) {\n  return!!Object.isFrozen && Object.isFrozen(obj);\n};\ngoog.provide(\"fb.core.stats.StatsCollection\");\ngoog.require(\"fb.util.obj\");\ngoog.require(\"goog.array\");\ngoog.require(\"goog.object\");\nfb.core.stats.StatsCollection = function() {\n  this.counters_ = {};\n};\nfb.core.stats.StatsCollection.prototype.incrementCounter = function(name, amount) {\n  if (!goog.isDef(amount)) {\n    amount = 1;\n  }\n  if (!fb.util.obj.contains(this.counters_, name)) {\n    this.counters_[name] = 0;\n  }\n  this.counters_[name] += amount;\n};\nfb.core.stats.StatsCollection.prototype.get = function() {\n  return goog.object.clone(this.counters_);\n};\ngoog.provide(\"fb.core.stats.StatsListener\");\nfb.core.stats.StatsListener = function(collection) {\n  this.collection_ = collection;\n  this.last_ = null;\n};\nfb.core.stats.StatsListener.prototype.get = function() {\n  var newStats = this.collection_.get();\n  var delta = goog.object.clone(newStats);\n  if (this.last_) {\n    for (var stat in this.last_) {\n      delta[stat] = delta[stat] - this.last_[stat];\n    }\n  }\n  this.last_ = newStats;\n  return delta;\n};\ngoog.provide(\"fb.core.stats.StatsReporter\");\nvar FIRST_STATS_MIN_TIME = 10 * 1E3;\nvar FIRST_STATS_MAX_TIME = 30 * 1E3;\nvar REPORT_STATS_INTERVAL = 5 * 60 * 1E3;\nfb.core.stats.StatsReporter = function(collection, connection) {\n  this.statsToReport_ = {};\n  this.statsListener_ = new fb.core.stats.StatsListener(collection);\n  this.connection_ = connection;\n  var timeout = FIRST_STATS_MIN_TIME + (FIRST_STATS_MAX_TIME - FIRST_STATS_MIN_TIME) * Math.random();\n  setTimeout(goog.bind(this.reportStats_, this), Math.floor(timeout));\n};\nfb.core.stats.StatsReporter.prototype.includeStat = function(stat) {\n  this.statsToReport_[stat] = true;\n};\nfb.core.stats.StatsReporter.prototype.reportStats_ = function() {\n  var stats = this.statsListener_.get();\n  var reportedStats = {};\n  var haveStatsToReport = false;\n  for (var stat in stats) {\n    if (stats[stat] > 0 && fb.util.obj.contains(this.statsToReport_, stat)) {\n      reportedStats[stat] = stats[stat];\n      haveStatsToReport = true;\n    }\n  }\n  if (haveStatsToReport) {\n    this.connection_.reportStats(reportedStats);\n  }\n  setTimeout(goog.bind(this.reportStats_, this), Math.floor(Math.random() * 2 * REPORT_STATS_INTERVAL));\n};\ngoog.provide(\"fb.core.stats.StatsManager\");\ngoog.require(\"fb.core.stats.StatsCollection\");\ngoog.require(\"fb.core.stats.StatsListener\");\ngoog.require(\"fb.core.stats.StatsReporter\");\nfb.core.stats.StatsManager = {};\nfb.core.stats.StatsManager.collections_ = {};\nfb.core.stats.StatsManager.reporters_ = {};\nfb.core.stats.StatsManager.getCollection = function(repoInfo) {\n  var hashString = repoInfo.toString();\n  if (!fb.core.stats.StatsManager.collections_[hashString]) {\n    fb.core.stats.StatsManager.collections_[hashString] = new fb.core.stats.StatsCollection;\n  }\n  return fb.core.stats.StatsManager.collections_[hashString];\n};\nfb.core.stats.StatsManager.getOrCreateReporter = function(repoInfo, creatorFunction) {\n  var hashString = repoInfo.toString();\n  if (!fb.core.stats.StatsManager.reporters_[hashString]) {\n    fb.core.stats.StatsManager.reporters_[hashString] = creatorFunction();\n  }\n  return fb.core.stats.StatsManager.reporters_[hashString];\n};\ngoog.provide(\"fb.realtime.WebSocketConnection\");\ngoog.require(\"fb.constants\");\ngoog.require(\"fb.core.stats.StatsManager\");\ngoog.require(\"fb.core.storage\");\ngoog.require(\"fb.core.util\");\ngoog.require(\"fb.realtime.Constants\");\ngoog.require(\"fb.realtime.Transport\");\ngoog.require(\"fb.util.json\");\nvar WEBSOCKET_MAX_FRAME_SIZE = 16384;\nvar WEBSOCKET_KEEPALIVE_INTERVAL = 45E3;\nfb.WebSocket = null;\nif (NODE_CLIENT) {\n  goog.require(\"fb.core.util.NodePatches\");\n  fb.WebSocket = require(\"faye-websocket\")[\"Client\"];\n} else {\n  if (typeof MozWebSocket !== \"undefined\") {\n    fb.WebSocket = MozWebSocket;\n  } else {\n    if (typeof WebSocket !== \"undefined\") {\n      fb.WebSocket = WebSocket;\n    }\n  }\n}\nfb.realtime.WebSocketConnection = function(connId, repoInfo, sessionId) {\n  this.connId = connId;\n  this.log_ = fb.core.util.logWrapper(this.connId);\n  this.keepaliveTimer = null;\n  this.frames = null;\n  this.totalFrames = 0;\n  this.bytesSent = 0;\n  this.bytesReceived = 0;\n  this.stats_ = fb.core.stats.StatsManager.getCollection(repoInfo);\n  this.connURL = (repoInfo.secure ? \"wss://\" : \"ws://\") + repoInfo.internalHost + \"/.ws?\" + fb.realtime.Constants.VERSION_PARAM + \"=\" + fb.realtime.Constants.PROTOCOL_VERSION;\n  if (repoInfo.needsQueryParam()) {\n    this.connURL = this.connURL + \"&ns=\" + repoInfo.namespace;\n  }\n  if (sessionId) {\n    this.connURL = this.connURL + \"&\" + fb.realtime.Constants.SESSION_PARAM + \"=\" + sessionId;\n  }\n};\nfb.realtime.WebSocketConnection.prototype.open = function(onMess, onDisconn) {\n  this.onDisconnect = onDisconn;\n  this.onMessage = onMess;\n  this.log_(\"Websocket connecting to \" + this.connURL);\n  this.mySock = new fb.WebSocket(this.connURL);\n  this.everConnected_ = false;\n  fb.core.storage.PersistentStorage.set(\"previous_websocket_failure\", true);\n  var self = this;\n  this.mySock.onopen = function() {\n    self.log_(\"Websocket connected.\");\n    self.everConnected_ = true;\n  };\n  this.mySock.onclose = function() {\n    self.log_(\"Websocket connection was disconnected.\");\n    self.mySock = null;\n    self.onClosed_();\n  };\n  this.mySock.onmessage = function(m) {\n    self.handleIncomingFrame(m);\n  };\n  this.mySock.onerror = function(e) {\n    self.log_(\"WebSocket error.  Closing connection.\");\n    var error = e.message || e.data;\n    if (error) {\n      self.log_(error);\n    }\n    self.onClosed_();\n  };\n};\nfb.realtime.WebSocketConnection.prototype.start = function() {\n};\nfb.realtime.WebSocketConnection.forceDisallow = function() {\n  fb.realtime.WebSocketConnection.forceDisallow_ = true;\n};\nfb.realtime.WebSocketConnection[\"isAvailable\"] = function() {\n  var isOldAndroid = false;\n  if (typeof navigator !== \"undefined\" && navigator.userAgent) {\n    var oldAndroidRegex = /Android ([0-9]{0,}\\.[0-9]{0,})/;\n    var oldAndroidMatch = navigator.userAgent.match(oldAndroidRegex);\n    if (oldAndroidMatch && oldAndroidMatch.length > 1) {\n      if (parseFloat(oldAndroidMatch[1]) < 4.4) {\n        isOldAndroid = true;\n      }\n    }\n  }\n  return!isOldAndroid && fb.WebSocket !== null && !fb.realtime.WebSocketConnection.forceDisallow_;\n};\nfb.realtime.WebSocketConnection[\"responsesRequiredToBeHealthy\"] = 2;\nfb.realtime.WebSocketConnection[\"healthyTimeout\"] = 3E4;\nfb.realtime.WebSocketConnection.previouslyFailed = function() {\n  return fb.core.storage.PersistentStorage.isInMemoryStorage || fb.core.storage.PersistentStorage.get(\"previous_websocket_failure\") === true;\n};\nfb.realtime.WebSocketConnection.prototype.markConnectionHealthy = function() {\n  fb.core.storage.PersistentStorage.remove(\"previous_websocket_failure\");\n};\nfb.realtime.WebSocketConnection.prototype.appendFrame_ = function(data) {\n  this.frames.push(data);\n  if (this.frames.length == this.totalFrames) {\n    var fullMess = this.frames.join(\"\");\n    this.frames = null;\n    var jsonMess = fb.util.json.eval(fullMess);\n    this.onMessage(jsonMess);\n  }\n};\nfb.realtime.WebSocketConnection.prototype.handleNewFrameCount_ = function(frameCount) {\n  this.totalFrames = frameCount;\n  this.frames = [];\n};\nfb.realtime.WebSocketConnection.prototype.extractFrameCount_ = function(data) {\n  fb.core.util.assert(this.frames === null, \"We already have a frame buffer\");\n  if (data.length <= 6) {\n    var frameCount = Number(data);\n    if (!isNaN(frameCount)) {\n      this.handleNewFrameCount_(frameCount);\n      return null;\n    }\n  }\n  this.handleNewFrameCount_(1);\n  return data;\n};\nfb.realtime.WebSocketConnection.prototype.handleIncomingFrame = function(mess) {\n  if (this.mySock === null) {\n    return;\n  }\n  var data = mess[\"data\"];\n  this.bytesReceived += data.length;\n  this.stats_.incrementCounter(\"bytes_received\", data.length);\n  this.resetKeepAlive();\n  if (this.frames !== null) {\n    this.appendFrame_(data);\n  } else {\n    var remainingData = this.extractFrameCount_(data);\n    if (remainingData !== null) {\n      this.appendFrame_(remainingData);\n    }\n  }\n};\nfb.realtime.WebSocketConnection.prototype.send = function(data) {\n  this.resetKeepAlive();\n  var dataStr = fb.util.json.stringify(data);\n  this.bytesSent += dataStr.length;\n  this.stats_.incrementCounter(\"bytes_sent\", dataStr.length);\n  var dataSegs = fb.core.util.splitStringBySize(dataStr, WEBSOCKET_MAX_FRAME_SIZE);\n  if (dataSegs.length > 1) {\n    this.mySock.send(String(dataSegs.length));\n  }\n  for (var i = 0;i < dataSegs.length;i++) {\n    this.mySock.send(dataSegs[i]);\n  }\n};\nfb.realtime.WebSocketConnection.prototype.shutdown_ = function() {\n  this.isClosed_ = true;\n  if (this.keepaliveTimer) {\n    clearInterval(this.keepaliveTimer);\n    this.keepaliveTimer = null;\n  }\n  if (this.mySock) {\n    this.mySock.close();\n    this.mySock = null;\n  }\n};\nfb.realtime.WebSocketConnection.prototype.onClosed_ = function() {\n  if (!this.isClosed_) {\n    this.log_(\"WebSocket is closing itself\");\n    this.shutdown_();\n    if (this.onDisconnect) {\n      this.onDisconnect(this.everConnected_);\n      this.onDisconnect = null;\n    }\n  }\n};\nfb.realtime.WebSocketConnection.prototype.close = function() {\n  if (!this.isClosed_) {\n    this.log_(\"WebSocket is being closed\");\n    this.shutdown_();\n  }\n};\nfb.realtime.WebSocketConnection.prototype.resetKeepAlive = function() {\n  var self = this;\n  clearInterval(this.keepaliveTimer);\n  this.keepaliveTimer = setInterval(function() {\n    if (self.mySock) {\n      self.mySock.send(\"0\");\n    }\n    self.resetKeepAlive();\n  }, Math.floor(WEBSOCKET_KEEPALIVE_INTERVAL));\n};\ngoog.provide(\"fb.realtime.polling.PacketReceiver\");\nfb.realtime.polling.PacketReceiver = function(onMessage) {\n  this.onMessage_ = onMessage;\n  this.pendingResponses = [];\n  this.currentResponseNum = 0;\n  this.closeAfterResponse = -1;\n  this.onClose = null;\n};\nfb.realtime.polling.PacketReceiver.prototype.closeAfter = function(responseNum, callback) {\n  this.closeAfterResponse = responseNum;\n  this.onClose = callback;\n  if (this.closeAfterResponse < this.currentResponseNum) {\n    this.onClose();\n    this.onClose = null;\n  }\n};\nfb.realtime.polling.PacketReceiver.prototype.handleResponse = function(requestNum, data) {\n  this.pendingResponses[requestNum] = data;\n  while (this.pendingResponses[this.currentResponseNum]) {\n    var toProcess = this.pendingResponses[this.currentResponseNum];\n    delete this.pendingResponses[this.currentResponseNum];\n    for (var i = 0;i < toProcess.length;++i) {\n      if (toProcess[i]) {\n        var self = this;\n        fb.core.util.exceptionGuard(function() {\n          self.onMessage_(toProcess[i]);\n        });\n      }\n    }\n    if (this.currentResponseNum === this.closeAfterResponse) {\n      if (this.onClose) {\n        clearTimeout(this.onClose);\n        this.onClose();\n        this.onClose = null;\n      }\n      break;\n    }\n    this.currentResponseNum++;\n  }\n};\ngoog.provide(\"fb.core.util.CountedSet\");\ngoog.require(\"fb.core.util\");\ngoog.require(\"goog.object\");\nfb.core.util.CountedSet = function() {\n  this.set = {};\n};\nfb.core.util.CountedSet.prototype.add = function(item, val) {\n  this.set[item] = val !== null ? val : true;\n};\nfb.core.util.CountedSet.prototype.contains = function(key) {\n  return fb.util.obj.contains(this.set, key);\n};\nfb.core.util.CountedSet.prototype.get = function(item) {\n  return this.contains(item) ? this.set[item] : undefined;\n};\nfb.core.util.CountedSet.prototype.remove = function(item) {\n  delete this.set[item];\n};\nfb.core.util.CountedSet.prototype.clear = function() {\n  this.set = {};\n};\nfb.core.util.CountedSet.prototype.isEmpty = function() {\n  return goog.object.isEmpty(this.set);\n};\nfb.core.util.CountedSet.prototype.count = function() {\n  return goog.object.getCount(this.set);\n};\nfb.core.util.CountedSet.prototype.each = function(fn) {\n  goog.object.forEach(this.set, function(v, k) {\n    fn(k, v);\n  });\n};\nfb.core.util.CountedSet.prototype.keys = function() {\n  var keys = [];\n  goog.object.forEach(this.set, function(v, k) {\n    keys.push(k);\n  });\n  return keys;\n};\ngoog.provide(\"fb.realtime.BrowserPollConnection\");\ngoog.require(\"fb.constants\");\ngoog.require(\"fb.core.stats.StatsManager\");\ngoog.require(\"fb.core.util\");\ngoog.require(\"fb.core.util.CountedSet\");\ngoog.require(\"fb.realtime.Constants\");\ngoog.require(\"fb.realtime.Transport\");\ngoog.require(\"fb.realtime.polling.PacketReceiver\");\ngoog.require(\"fb.util.json\");\nvar FIREBASE_LONGPOLL_START_PARAM = \"start\";\nvar FIREBASE_LONGPOLL_CLOSE_COMMAND = \"close\";\nvar FIREBASE_LONGPOLL_COMMAND_CB_NAME = \"pLPCommand\";\nvar FIREBASE_LONGPOLL_DATA_CB_NAME = \"pRTLPCB\";\nvar FIREBASE_LONGPOLL_ID_PARAM = \"id\";\nvar FIREBASE_LONGPOLL_PW_PARAM = \"pw\";\nvar FIREBASE_LONGPOLL_SERIAL_PARAM = \"ser\";\nvar FIREBASE_LONGPOLL_CALLBACK_ID_PARAM = \"cb\";\nvar FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM = \"seg\";\nvar FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET = \"ts\";\nvar FIREBASE_LONGPOLL_DATA_PARAM = \"d\";\nvar FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM = \"disconn\";\nvar FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM = \"dframe\";\nvar MAX_URL_DATA_SIZE = 1870;\nvar SEG_HEADER_SIZE = 30;\nvar MAX_PAYLOAD_SIZE = MAX_URL_DATA_SIZE - SEG_HEADER_SIZE;\nvar KEEPALIVE_REQUEST_INTERVAL = 25E3;\nvar LP_CONNECT_TIMEOUT = 3E4;\nfb.realtime.BrowserPollConnection = function(connId, repoInfo, sessionId) {\n  this.connId = connId;\n  this.log_ = fb.core.util.logWrapper(connId);\n  this.repoInfo = repoInfo;\n  this.bytesSent = 0;\n  this.bytesReceived = 0;\n  this.stats_ = fb.core.stats.StatsManager.getCollection(repoInfo);\n  this.sessionId = sessionId;\n  this.everConnected_ = false;\n  this.urlFn = function(params) {\n    if (repoInfo.needsQueryParam()) {\n      params[\"ns\"] = repoInfo.namespace;\n    }\n    var pairs = [];\n    for (var k in params) {\n      if (params.hasOwnProperty(k)) {\n        pairs.push(k + \"=\" + params[k]);\n      }\n    }\n    return(repoInfo.secure ? \"https://\" : \"http://\") + repoInfo.internalHost + \"/.lp?\" + pairs.join(\"&\");\n  };\n};\nfb.realtime.BrowserPollConnection.prototype.open = function(onMessage, onDisconnect) {\n  this.curSegmentNum = 0;\n  this.onDisconnect_ = onDisconnect;\n  this.myPacketOrderer = new fb.realtime.polling.PacketReceiver(onMessage);\n  this.isClosed_ = false;\n  var self = this;\n  this.connectTimeoutTimer_ = setTimeout(function() {\n    self.log_(\"Timed out trying to connect.\");\n    self.onClosed_();\n    self.connectTimeoutTimer_ = null;\n  }, Math.floor(LP_CONNECT_TIMEOUT));\n  fb.core.util.executeWhenDOMReady(function() {\n    if (self.isClosed_) {\n      return;\n    }\n    self.scriptTagHolder = new FirebaseIFrameScriptHolder(function(command, arg1, arg2, arg3, arg4) {\n      self.incrementIncomingBytes_(arguments);\n      if (!self.scriptTagHolder) {\n        return;\n      }\n      if (self.connectTimeoutTimer_) {\n        clearTimeout(self.connectTimeoutTimer_);\n        self.connectTimeoutTimer_ = null;\n      }\n      self.everConnected_ = true;\n      if (command == FIREBASE_LONGPOLL_START_PARAM) {\n        self.id = arg1;\n        self.password = arg2;\n      } else {\n        if (command === FIREBASE_LONGPOLL_CLOSE_COMMAND) {\n          if (arg1) {\n            self.scriptTagHolder.sendNewPolls = false;\n            self.myPacketOrderer.closeAfter(arg1, function() {\n              self.onClosed_();\n            });\n          } else {\n            self.onClosed_();\n          }\n        } else {\n          throw new Error(\"Unrecognized command received: \" + command);\n        }\n      }\n    }, function(pN, data) {\n      self.incrementIncomingBytes_(arguments);\n      self.myPacketOrderer.handleResponse(pN, data);\n    }, function() {\n      self.onClosed_();\n    }, self.urlFn);\n    var urlParams = {};\n    urlParams[FIREBASE_LONGPOLL_START_PARAM] = \"t\";\n    urlParams[FIREBASE_LONGPOLL_SERIAL_PARAM] = Math.floor(Math.random() * 1E8);\n    if (self.scriptTagHolder.uniqueCallbackIdentifier) {\n      urlParams[FIREBASE_LONGPOLL_CALLBACK_ID_PARAM] = self.scriptTagHolder.uniqueCallbackIdentifier;\n    }\n    urlParams[fb.realtime.Constants.VERSION_PARAM] = fb.realtime.Constants.PROTOCOL_VERSION;\n    if (self.sessionId) {\n      urlParams[fb.realtime.Constants.SESSION_PARAM] = self.sessionId;\n    }\n    var connectURL = self.urlFn(urlParams);\n    self.log_(\"Connecting via long-poll to \" + connectURL);\n    self.scriptTagHolder.addTag(connectURL, function() {\n    });\n  });\n};\nfb.realtime.BrowserPollConnection.prototype.start = function() {\n  this.scriptTagHolder.startLongPoll(this.id, this.password);\n  this.addDisconnectPingFrame(this.id, this.password);\n};\nfb.realtime.BrowserPollConnection.forceAllow = function() {\n  fb.realtime.BrowserPollConnection.forceAllow_ = true;\n};\nfb.realtime.BrowserPollConnection.forceDisallow = function() {\n  fb.realtime.BrowserPollConnection.forceDisallow_ = true;\n};\nfb.realtime.BrowserPollConnection[\"isAvailable\"] = function() {\n  return!fb.realtime.BrowserPollConnection.forceDisallow_ && !fb.core.util.isChromeExtensionContentScript() && !fb.core.util.isWindowsStoreApp() && (fb.realtime.BrowserPollConnection.forceAllow_ || !NODE_CLIENT);\n};\nfb.realtime.BrowserPollConnection.prototype.markConnectionHealthy = function() {\n};\nfb.realtime.BrowserPollConnection.prototype.shutdown_ = function() {\n  this.isClosed_ = true;\n  if (this.scriptTagHolder) {\n    this.scriptTagHolder.close();\n    this.scriptTagHolder = null;\n  }\n  if (this.myDisconnFrame) {\n    document.body.removeChild(this.myDisconnFrame);\n    this.myDisconnFrame = null;\n  }\n  if (this.connectTimeoutTimer_) {\n    clearTimeout(this.connectTimeoutTimer_);\n    this.connectTimeoutTimer_ = null;\n  }\n};\nfb.realtime.BrowserPollConnection.prototype.onClosed_ = function() {\n  if (!this.isClosed_) {\n    this.log_(\"Longpoll is closing itself\");\n    this.shutdown_();\n    if (this.onDisconnect_) {\n      this.onDisconnect_(this.everConnected_);\n      this.onDisconnect_ = null;\n    }\n  }\n};\nfb.realtime.BrowserPollConnection.prototype.close = function() {\n  if (!this.isClosed_) {\n    this.log_(\"Longpoll is being closed.\");\n    this.shutdown_();\n  }\n};\nfb.realtime.BrowserPollConnection.prototype.send = function(data) {\n  var dataStr = fb.util.json.stringify(data);\n  this.bytesSent += dataStr.length;\n  this.stats_.incrementCounter(\"bytes_sent\", dataStr.length);\n  var base64data = fb.core.util.base64Encode(dataStr);\n  var dataSegs = fb.core.util.splitStringBySize(base64data, MAX_PAYLOAD_SIZE);\n  for (var i = 0;i < dataSegs.length;i++) {\n    this.scriptTagHolder.enqueueSegment(this.curSegmentNum, dataSegs.length, dataSegs[i]);\n    this.curSegmentNum++;\n  }\n};\nfb.realtime.BrowserPollConnection.prototype.addDisconnectPingFrame = function(id, pw) {\n  if (NODE_CLIENT) {\n    return;\n  }\n  this.myDisconnFrame = document.createElement(\"iframe\");\n  var urlParams = {};\n  urlParams[FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM] = \"t\";\n  urlParams[FIREBASE_LONGPOLL_ID_PARAM] = id;\n  urlParams[FIREBASE_LONGPOLL_PW_PARAM] = pw;\n  this.myDisconnFrame.src = this.urlFn(urlParams);\n  this.myDisconnFrame.style.display = \"none\";\n  document.body.appendChild(this.myDisconnFrame);\n};\nfb.realtime.BrowserPollConnection.prototype.incrementIncomingBytes_ = function(args) {\n  var bytesReceived = fb.util.json.stringify(args).length;\n  this.bytesReceived += bytesReceived;\n  this.stats_.incrementCounter(\"bytes_received\", bytesReceived);\n};\nfunction FirebaseIFrameScriptHolder(commandCB, onMessageCB, onDisconnectCB, urlFn) {\n  this.urlFn = urlFn;\n  this.onDisconnect = onDisconnectCB;\n  this.outstandingRequests = new fb.core.util.CountedSet;\n  this.pendingSegs = [];\n  this.currentSerial = Math.floor(Math.random() * 1E8);\n  this.sendNewPolls = true;\n  if (!NODE_CLIENT) {\n    this.uniqueCallbackIdentifier = fb.core.util.LUIDGenerator();\n    window[FIREBASE_LONGPOLL_COMMAND_CB_NAME + this.uniqueCallbackIdentifier] = commandCB;\n    window[FIREBASE_LONGPOLL_DATA_CB_NAME + this.uniqueCallbackIdentifier] = onMessageCB;\n    this.myIFrame = this.createIFrame_();\n    var script = \"\";\n    if (this.myIFrame.src && this.myIFrame.src.substr(0, \"javascript:\".length) === \"javascript:\") {\n      var currentDomain = document.domain;\n      script = '<script>document.domain=\"' + currentDomain + '\";\\x3c/script>';\n    }\n    var iframeContents = \"<html><body>\" + script + \"</body></html>\";\n    try {\n      this.myIFrame.doc.open();\n      this.myIFrame.doc.write(iframeContents);\n      this.myIFrame.doc.close();\n    } catch (e) {\n      fb.core.util.log(\"frame writing exception\");\n      if (e.stack) {\n        fb.core.util.log(e.stack);\n      }\n      fb.core.util.log(e);\n    }\n  } else {\n    this.commandCB = commandCB;\n    this.onMessageCB = onMessageCB;\n  }\n}\nFirebaseIFrameScriptHolder.prototype.createIFrame_ = function() {\n  var iframe = document.createElement(\"iframe\");\n  iframe.style.display = \"none\";\n  if (document.body) {\n    document.body.appendChild(iframe);\n    try {\n      var a = iframe.contentWindow.document;\n      if (!a) {\n        fb.core.util.log(\"No IE domain setting required\");\n      }\n    } catch (e) {\n      var domain = document.domain;\n      iframe.src = \"javascript:void((function(){document.open();document.domain='\" + domain + \"';document.close();})())\";\n    }\n  } else {\n    throw \"Document body has not initialized. Wait to initialize Firebase until after the document is ready.\";\n  }\n  if (iframe.contentDocument) {\n    iframe.doc = iframe.contentDocument;\n  } else {\n    if (iframe.contentWindow) {\n      iframe.doc = iframe.contentWindow.document;\n    } else {\n      if (iframe.document) {\n        iframe.doc = iframe.document;\n      }\n    }\n  }\n  return iframe;\n};\nFirebaseIFrameScriptHolder.prototype.close = function() {\n  this.alive = false;\n  if (this.myIFrame) {\n    this.myIFrame.doc.body.innerHTML = \"\";\n    var self = this;\n    setTimeout(function() {\n      if (self.myIFrame !== null) {\n        document.body.removeChild(self.myIFrame);\n        self.myIFrame = null;\n      }\n    }, Math.floor(0));\n  }\n  if (NODE_CLIENT && this.myID) {\n    var urlParams = {};\n    urlParams[FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM] = \"t\";\n    urlParams[FIREBASE_LONGPOLL_ID_PARAM] = this.myID;\n    urlParams[FIREBASE_LONGPOLL_PW_PARAM] = this.myPW;\n    var theURL = this.urlFn(urlParams);\n    FirebaseIFrameScriptHolder.nodeRestRequest(theURL);\n  }\n  var onDisconnect = this.onDisconnect;\n  if (onDisconnect) {\n    this.onDisconnect = null;\n    onDisconnect();\n  }\n};\nFirebaseIFrameScriptHolder.prototype.startLongPoll = function(id, pw) {\n  this.myID = id;\n  this.myPW = pw;\n  this.alive = true;\n  while (this.newRequest_()) {\n  }\n};\nFirebaseIFrameScriptHolder.prototype.newRequest_ = function() {\n  if (this.alive && this.sendNewPolls && this.outstandingRequests.count() < (this.pendingSegs.length > 0 ? 2 : 1)) {\n    this.currentSerial++;\n    var urlParams = {};\n    urlParams[FIREBASE_LONGPOLL_ID_PARAM] = this.myID;\n    urlParams[FIREBASE_LONGPOLL_PW_PARAM] = this.myPW;\n    urlParams[FIREBASE_LONGPOLL_SERIAL_PARAM] = this.currentSerial;\n    var theURL = this.urlFn(urlParams);\n    var curDataString = \"\";\n    var i = 0;\n    while (this.pendingSegs.length > 0) {\n      var nextSeg = this.pendingSegs[0];\n      if (nextSeg.d.length + SEG_HEADER_SIZE + curDataString.length <= MAX_URL_DATA_SIZE) {\n        var theSeg = this.pendingSegs.shift();\n        curDataString = curDataString + \"&\" + FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM + i + \"=\" + theSeg.seg + \"&\" + FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET + i + \"=\" + theSeg.ts + \"&\" + FIREBASE_LONGPOLL_DATA_PARAM + i + \"=\" + theSeg.d;\n        i++;\n      } else {\n        break;\n      }\n    }\n    theURL = theURL + curDataString;\n    this.addLongPollTag_(theURL, this.currentSerial);\n    return true;\n  } else {\n    return false;\n  }\n};\nFirebaseIFrameScriptHolder.prototype.enqueueSegment = function(segnum, totalsegs, data) {\n  this.pendingSegs.push({seg:segnum, ts:totalsegs, d:data});\n  if (this.alive) {\n    this.newRequest_();\n  }\n};\nFirebaseIFrameScriptHolder.prototype.addLongPollTag_ = function(url, serial) {\n  var self = this;\n  self.outstandingRequests.add(serial);\n  var doNewRequest = function() {\n    self.outstandingRequests.remove(serial);\n    self.newRequest_();\n  };\n  var keepaliveTimeout = setTimeout(doNewRequest, Math.floor(KEEPALIVE_REQUEST_INTERVAL));\n  var readyStateCB = function() {\n    clearTimeout(keepaliveTimeout);\n    doNewRequest();\n  };\n  this.addTag(url, readyStateCB);\n};\nFirebaseIFrameScriptHolder.prototype.addTag = function(url, loadCB) {\n  if (NODE_CLIENT) {\n    this.doNodeLongPoll(url, loadCB);\n  } else {\n    var self = this;\n    setTimeout(function() {\n      try {\n        if (!self.sendNewPolls) {\n          return;\n        }\n        var newScript = self.myIFrame.doc.createElement(\"script\");\n        newScript.type = \"text/javascript\";\n        newScript.async = true;\n        newScript.src = url;\n        newScript.onload = newScript.onreadystatechange = function() {\n          var rstate = newScript.readyState;\n          if (!rstate || rstate === \"loaded\" || rstate === \"complete\") {\n            newScript.onload = newScript.onreadystatechange = null;\n            if (newScript.parentNode) {\n              newScript.parentNode.removeChild(newScript);\n            }\n            loadCB();\n          }\n        };\n        newScript.onerror = function() {\n          fb.core.util.log(\"Long-poll script failed to load: \" + url);\n          self.sendNewPolls = false;\n          self.close();\n        };\n        self.myIFrame.doc.body.appendChild(newScript);\n      } catch (e) {\n      }\n    }, Math.floor(1));\n  }\n};\nif (typeof NODE_CLIENT !== \"undefined\" && NODE_CLIENT) {\n  FirebaseIFrameScriptHolder.request = null;\n  FirebaseIFrameScriptHolder.nodeRestRequest = function(req, onComplete) {\n    if (!FirebaseIFrameScriptHolder.request) {\n      FirebaseIFrameScriptHolder.request = (require(\"request\"));\n    }\n    FirebaseIFrameScriptHolder.request(req, function(error, response, body) {\n      if (error) {\n        throw \"Rest request for \" + req.url + \" failed.\";\n      }\n      if (onComplete) {\n        onComplete(body);\n      }\n    });\n  };\n  FirebaseIFrameScriptHolder.prototype.doNodeLongPoll = function(url, loadCB) {\n    var self = this;\n    FirebaseIFrameScriptHolder.nodeRestRequest({url:url, forever:true}, function(body) {\n      self.evalBody(body);\n      loadCB();\n    });\n  };\n  FirebaseIFrameScriptHolder.prototype.evalBody = function(body) {\n    eval(\"var jsonpCB = function(\" + FIREBASE_LONGPOLL_COMMAND_CB_NAME + \", \" + FIREBASE_LONGPOLL_DATA_CB_NAME + \") {\" + body + \"}\");\n    jsonpCB(this.commandCB, this.onMessageCB);\n  };\n}\n;goog.require(\"fb.constants\");\ngoog.require(\"fb.realtime.BrowserPollConnection\");\ngoog.require(\"fb.realtime.Transport\");\ngoog.provide(\"fb.realtime.TransportManager\");\ngoog.require(\"fb.realtime.WebSocketConnection\");\nfb.realtime.TransportManager = function(repoInfo) {\n  this.initTransports_(repoInfo);\n};\nfb.realtime.TransportManager.ALL_TRANSPORTS = [fb.realtime.BrowserPollConnection, fb.realtime.WebSocketConnection];\nfb.realtime.TransportManager.prototype.initTransports_ = function(repoInfo) {\n  var isWebSocketsAvailable = fb.realtime.WebSocketConnection && fb.realtime.WebSocketConnection[\"isAvailable\"]();\n  var isSkipPollConnection = isWebSocketsAvailable && !fb.realtime.WebSocketConnection.previouslyFailed();\n  if (repoInfo.webSocketOnly) {\n    if (!isWebSocketsAvailable) {\n      fb.core.util.warn(\"wss:// URL used, but browser isn't known to support websockets.  Trying anyway.\");\n    }\n    isSkipPollConnection = true;\n  }\n  if (isSkipPollConnection) {\n    this.transports_ = [fb.realtime.WebSocketConnection];\n  } else {\n    var transports = this.transports_ = [];\n    fb.core.util.each(fb.realtime.TransportManager.ALL_TRANSPORTS, function(i, transport) {\n      if (transport && transport[\"isAvailable\"]()) {\n        transports.push(transport);\n      }\n    });\n  }\n};\nfb.realtime.TransportManager.prototype.initialTransport = function() {\n  if (this.transports_.length > 0) {\n    return this.transports_[0];\n  } else {\n    throw new Error(\"No transports available\");\n  }\n};\nfb.realtime.TransportManager.prototype.upgradeTransport = function() {\n  if (this.transports_.length > 1) {\n    return this.transports_[1];\n  } else {\n    return null;\n  }\n};\ngoog.provide(\"fb.realtime.Connection\");\ngoog.require(\"fb.core.storage\");\ngoog.require(\"fb.core.util\");\ngoog.require(\"fb.realtime.Constants\");\ngoog.require(\"fb.realtime.TransportManager\");\nvar UPGRADE_TIMEOUT = 6E4;\nvar DELAY_BEFORE_SENDING_EXTRA_REQUESTS = 5E3;\nvar BYTES_SENT_HEALTHY_OVERRIDE = 10 * 1024;\nvar BYTES_RECEIVED_HEALTHY_OVERRIDE = 100 * 1024;\nvar REALTIME_STATE_CONNECTING = 0;\nvar REALTIME_STATE_CONNECTED = 1;\nvar REALTIME_STATE_DISCONNECTED = 2;\nvar MESSAGE_TYPE = \"t\";\nvar MESSAGE_DATA = \"d\";\nvar CONTROL_SHUTDOWN = \"s\";\nvar CONTROL_RESET = \"r\";\nvar CONTROL_ERROR = \"e\";\nvar CONTROL_PONG = \"o\";\nvar SWITCH_ACK = \"a\";\nvar END_TRANSMISSION = \"n\";\nvar PING = \"p\";\nvar SERVER_HELLO = \"h\";\nfb.realtime.Connection = function(connId, repoInfo, onMessage, onReady, onDisconnect, onKill) {\n  this.id = connId;\n  this.log_ = fb.core.util.logWrapper(\"c:\" + this.id + \":\");\n  this.onMessage_ = onMessage;\n  this.onReady_ = onReady;\n  this.onDisconnect_ = onDisconnect;\n  this.onKill_ = onKill;\n  this.repoInfo_ = repoInfo;\n  this.pendingDataMessages = [];\n  this.connectionCount = 0;\n  this.transportManager_ = new fb.realtime.TransportManager(repoInfo);\n  this.state_ = REALTIME_STATE_CONNECTING;\n  this.log_(\"Connection created\");\n  this.start_();\n};\nfb.realtime.Connection.prototype.start_ = function() {\n  var conn = this.transportManager_.initialTransport();\n  this.conn_ = new conn(this.nextTransportId_(), this.repoInfo_);\n  this.primaryResponsesRequired_ = conn[\"responsesRequiredToBeHealthy\"] || 0;\n  var onMessageReceived = this.connReceiver_(this.conn_);\n  var onConnectionLost = this.disconnReceiver_(this.conn_);\n  this.tx_ = this.conn_;\n  this.rx_ = this.conn_;\n  this.secondaryConn_ = null;\n  this.isHealthy_ = false;\n  var self = this;\n  setTimeout(function() {\n    self.conn_ && self.conn_.open(onMessageReceived, onConnectionLost);\n  }, Math.floor(0));\n  var healthyTimeout_ms = conn[\"healthyTimeout\"] || 0;\n  if (healthyTimeout_ms > 0) {\n    this.healthyTimeout_ = setTimeout(function() {\n      self.healthyTimeout_ = null;\n      if (!self.isHealthy_) {\n        if (self.conn_ && self.conn_.bytesReceived > BYTES_RECEIVED_HEALTHY_OVERRIDE) {\n          self.log_(\"Connection exceeded healthy timeout but has received \" + self.conn_.bytesReceived + \" bytes.  Marking connection healthy.\");\n          self.isHealthy_ = true;\n          self.conn_.markConnectionHealthy();\n        } else {\n          if (self.conn_ && self.conn_.bytesSent > BYTES_SENT_HEALTHY_OVERRIDE) {\n            self.log_(\"Connection exceeded healthy timeout but has sent \" + self.conn_.bytesSent + \" bytes.  Leaving connection alive.\");\n          } else {\n            self.log_(\"Closing unhealthy connection after timeout.\");\n            self.close();\n          }\n        }\n      }\n    }, Math.floor(healthyTimeout_ms));\n  }\n};\nfb.realtime.Connection.prototype.nextTransportId_ = function() {\n  return \"c:\" + this.id + \":\" + this.connectionCount++;\n};\nfb.realtime.Connection.prototype.disconnReceiver_ = function(conn) {\n  var self = this;\n  return function(everConnected) {\n    if (conn === self.conn_) {\n      self.onConnectionLost_(everConnected);\n    } else {\n      if (conn === self.secondaryConn_) {\n        self.log_(\"Secondary connection lost.\");\n        self.onSecondaryConnectionLost_();\n      } else {\n        self.log_(\"closing an old connection\");\n      }\n    }\n  };\n};\nfb.realtime.Connection.prototype.connReceiver_ = function(conn) {\n  var self = this;\n  return function(message) {\n    if (self.state_ != REALTIME_STATE_DISCONNECTED) {\n      if (conn === self.rx_) {\n        self.onPrimaryMessageReceived_(message);\n      } else {\n        if (conn === self.secondaryConn_) {\n          self.onSecondaryMessageReceived_(message);\n        } else {\n          self.log_(\"message on old connection\");\n        }\n      }\n    }\n  };\n};\nfb.realtime.Connection.prototype.sendRequest = function(dataMsg) {\n  var msg = {\"t\":\"d\", \"d\":dataMsg};\n  this.sendData_(msg);\n};\nfb.realtime.Connection.prototype.tryCleanupConnection = function() {\n  if (this.tx_ === this.secondaryConn_ && this.rx_ === this.secondaryConn_) {\n    this.log_(\"cleaning up and promoting a connection: \" + this.secondaryConn_.connId);\n    this.conn_ = this.secondaryConn_;\n    this.secondaryConn_ = null;\n  }\n};\nfb.realtime.Connection.prototype.onSecondaryControl_ = function(controlData) {\n  if (MESSAGE_TYPE in controlData) {\n    var cmd = controlData[MESSAGE_TYPE];\n    if (cmd === SWITCH_ACK) {\n      this.upgradeIfSecondaryHealthy_();\n    } else {\n      if (cmd === CONTROL_RESET) {\n        this.log_(\"Got a reset on secondary, closing it\");\n        this.secondaryConn_.close();\n        if (this.tx_ === this.secondaryConn_ || this.rx_ === this.secondaryConn_) {\n          this.close();\n        }\n      } else {\n        if (cmd === CONTROL_PONG) {\n          this.log_(\"got pong on secondary.\");\n          this.secondaryResponsesRequired_--;\n          this.upgradeIfSecondaryHealthy_();\n        }\n      }\n    }\n  }\n};\nfb.realtime.Connection.prototype.onSecondaryMessageReceived_ = function(parsedData) {\n  var layer = fb.core.util.requireKey(\"t\", parsedData);\n  var data = fb.core.util.requireKey(\"d\", parsedData);\n  if (layer == \"c\") {\n    this.onSecondaryControl_(data);\n  } else {\n    if (layer == \"d\") {\n      this.pendingDataMessages.push(data);\n    } else {\n      throw new Error(\"Unknown protocol layer: \" + layer);\n    }\n  }\n};\nfb.realtime.Connection.prototype.upgradeIfSecondaryHealthy_ = function() {\n  if (this.secondaryResponsesRequired_ <= 0) {\n    this.log_(\"Secondary connection is healthy.\");\n    this.isHealthy_ = true;\n    this.secondaryConn_.markConnectionHealthy();\n    this.proceedWithUpgrade_();\n  } else {\n    this.log_(\"sending ping on secondary.\");\n    this.secondaryConn_.send({\"t\":\"c\", \"d\":{\"t\":PING, \"d\":{}}});\n  }\n};\nfb.realtime.Connection.prototype.proceedWithUpgrade_ = function() {\n  this.secondaryConn_.start();\n  this.log_(\"sending client ack on secondary\");\n  this.secondaryConn_.send({\"t\":\"c\", \"d\":{\"t\":SWITCH_ACK, \"d\":{}}});\n  this.log_(\"Ending transmission on primary\");\n  this.conn_.send({\"t\":\"c\", \"d\":{\"t\":END_TRANSMISSION, \"d\":{}}});\n  this.tx_ = this.secondaryConn_;\n  this.tryCleanupConnection();\n};\nfb.realtime.Connection.prototype.onPrimaryMessageReceived_ = function(parsedData) {\n  var layer = fb.core.util.requireKey(\"t\", parsedData);\n  var data = fb.core.util.requireKey(\"d\", parsedData);\n  if (layer == \"c\") {\n    this.onControl_(data);\n  } else {\n    if (layer == \"d\") {\n      this.onDataMessage_(data);\n    }\n  }\n};\nfb.realtime.Connection.prototype.onDataMessage_ = function(message) {\n  this.onPrimaryResponse_();\n  this.onMessage_(message);\n};\nfb.realtime.Connection.prototype.onPrimaryResponse_ = function() {\n  if (!this.isHealthy_) {\n    this.primaryResponsesRequired_--;\n    if (this.primaryResponsesRequired_ <= 0) {\n      this.log_(\"Primary connection is healthy.\");\n      this.isHealthy_ = true;\n      this.conn_.markConnectionHealthy();\n    }\n  }\n};\nfb.realtime.Connection.prototype.onControl_ = function(controlData) {\n  var cmd = fb.core.util.requireKey(MESSAGE_TYPE, controlData);\n  if (MESSAGE_DATA in controlData) {\n    var payload = controlData[MESSAGE_DATA];\n    if (cmd === SERVER_HELLO) {\n      this.onHandshake_(payload);\n    } else {\n      if (cmd === END_TRANSMISSION) {\n        this.log_(\"recvd end transmission on primary\");\n        this.rx_ = this.secondaryConn_;\n        for (var i = 0;i < this.pendingDataMessages.length;++i) {\n          this.onDataMessage_(this.pendingDataMessages[i]);\n        }\n        this.pendingDataMessages = [];\n        this.tryCleanupConnection();\n      } else {\n        if (cmd === CONTROL_SHUTDOWN) {\n          this.onConnectionShutdown_(payload);\n        } else {\n          if (cmd === CONTROL_RESET) {\n            this.onReset_(payload);\n          } else {\n            if (cmd === CONTROL_ERROR) {\n              fb.core.util.error(\"Server Error: \" + payload);\n            } else {\n              if (cmd === CONTROL_PONG) {\n                this.log_(\"got pong on primary.\");\n                this.onPrimaryResponse_();\n                this.sendPingOnPrimaryIfNecessary_();\n              } else {\n                fb.core.util.error(\"Unknown control packet command: \" + cmd);\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n};\nfb.realtime.Connection.prototype.onHandshake_ = function(handshake) {\n  var timestamp = handshake[\"ts\"];\n  var version = handshake[\"v\"];\n  var host = handshake[\"h\"];\n  this.sessionId = handshake[\"s\"];\n  this.repoInfo_.updateHost(host);\n  if (this.state_ == REALTIME_STATE_CONNECTING) {\n    this.conn_.start();\n    this.onConnectionEstablished_(this.conn_, timestamp);\n    if (fb.realtime.Constants.PROTOCOL_VERSION !== version) {\n      fb.core.util.warn(\"Protocol version mismatch detected\");\n    }\n    this.tryStartUpgrade_();\n  }\n};\nfb.realtime.Connection.prototype.tryStartUpgrade_ = function() {\n  var conn = this.transportManager_.upgradeTransport();\n  if (conn) {\n    this.startUpgrade_(conn);\n  }\n};\nfb.realtime.Connection.prototype.startUpgrade_ = function(conn) {\n  this.secondaryConn_ = new conn(this.nextTransportId_(), this.repoInfo_, this.sessionId);\n  this.secondaryResponsesRequired_ = conn[\"responsesRequiredToBeHealthy\"] || 0;\n  var onMessage = this.connReceiver_(this.secondaryConn_);\n  var onDisconnect = this.disconnReceiver_(this.secondaryConn_);\n  this.secondaryConn_.open(onMessage, onDisconnect);\n  var self = this;\n  setTimeout(function() {\n    if (self.secondaryConn_) {\n      self.log_(\"Timed out trying to upgrade.\");\n      self.secondaryConn_.close();\n    }\n  }, Math.floor(UPGRADE_TIMEOUT));\n};\nfb.realtime.Connection.prototype.onReset_ = function(host) {\n  this.log_(\"Reset packet received.  New host: \" + host);\n  this.repoInfo_.updateHost(host);\n  if (this.state_ === REALTIME_STATE_CONNECTED) {\n    this.close();\n  } else {\n    this.closeConnections_();\n    this.start_();\n  }\n};\nfb.realtime.Connection.prototype.onConnectionEstablished_ = function(conn, timestamp) {\n  this.log_(\"Realtime connection established.\");\n  this.conn_ = conn;\n  this.state_ = REALTIME_STATE_CONNECTED;\n  if (this.onReady_) {\n    this.onReady_(timestamp);\n    this.onReady_ = null;\n  }\n  var self = this;\n  if (this.primaryResponsesRequired_ === 0) {\n    this.log_(\"Primary connection is healthy.\");\n    this.isHealthy_ = true;\n  } else {\n    setTimeout(function() {\n      self.sendPingOnPrimaryIfNecessary_();\n    }, Math.floor(DELAY_BEFORE_SENDING_EXTRA_REQUESTS));\n  }\n};\nfb.realtime.Connection.prototype.sendPingOnPrimaryIfNecessary_ = function() {\n  if (!this.isHealthy_ && this.state_ === REALTIME_STATE_CONNECTED) {\n    this.log_(\"sending ping on primary.\");\n    this.sendData_({\"t\":\"c\", \"d\":{\"t\":PING, \"d\":{}}});\n  }\n};\nfb.realtime.Connection.prototype.onSecondaryConnectionLost_ = function() {\n  var conn = this.secondaryConn_;\n  this.secondaryConn_ = null;\n  if (this.tx_ === conn || this.rx_ === conn) {\n    this.close();\n  }\n};\nfb.realtime.Connection.prototype.onConnectionLost_ = function(everConnected) {\n  this.conn_ = null;\n  if (!everConnected && this.state_ === REALTIME_STATE_CONNECTING) {\n    this.log_(\"Realtime connection failed.\");\n    if (this.repoInfo_.isCacheableHost()) {\n      fb.core.storage.PersistentStorage.remove(\"host:\" + this.repoInfo_.host);\n      this.repoInfo_.internalHost = this.repoInfo_.host;\n    }\n  } else {\n    if (this.state_ === REALTIME_STATE_CONNECTED) {\n      this.log_(\"Realtime connection lost.\");\n    }\n  }\n  this.close();\n};\nfb.realtime.Connection.prototype.onConnectionShutdown_ = function(reason) {\n  this.log_(\"Connection shutdown command received. Shutting down...\");\n  if (this.onKill_) {\n    this.onKill_(reason);\n    this.onKill_ = null;\n  }\n  this.onDisconnect_ = null;\n  this.close();\n};\nfb.realtime.Connection.prototype.sendData_ = function(data) {\n  if (this.state_ !== REALTIME_STATE_CONNECTED) {\n    throw \"Connection is not connected\";\n  } else {\n    this.tx_.send(data);\n  }\n};\nfb.realtime.Connection.prototype.close = function() {\n  if (this.state_ !== REALTIME_STATE_DISCONNECTED) {\n    this.log_(\"Closing realtime connection.\");\n    this.state_ = REALTIME_STATE_DISCONNECTED;\n    this.closeConnections_();\n    if (this.onDisconnect_) {\n      this.onDisconnect_();\n      this.onDisconnect_ = null;\n    }\n  }\n};\nfb.realtime.Connection.prototype.closeConnections_ = function() {\n  this.log_(\"Shutting down all connections\");\n  if (this.conn_) {\n    this.conn_.close();\n    this.conn_ = null;\n  }\n  if (this.secondaryConn_) {\n    this.secondaryConn_.close();\n    this.secondaryConn_ = null;\n  }\n  if (this.healthyTimeout_) {\n    clearTimeout(this.healthyTimeout_);\n    this.healthyTimeout_ = null;\n  }\n};\ngoog.provide(\"fb.core.PersistentConnection\");\ngoog.require(\"fb.core.util.OnlineMonitor\");\ngoog.require(\"fb.core.util.VisibilityMonitor\");\ngoog.require(\"fb.realtime.Connection\");\ngoog.require(\"fb.util.json\");\nvar RECONNECT_MIN_DELAY = 1E3;\nvar RECONNECT_MAX_DELAY_DEFAULT = 60 * 5 * 1E3;\nvar RECONNECT_MAX_DELAY_FOR_ADMINS = 30 * 1E3;\nvar RECONNECT_DELAY_MULTIPLIER = 1.3;\nvar RECONNECT_DELAY_RESET_TIMEOUT = 3E4;\nfb.core.PersistentConnection = function(repoInfo, onDataUpdate, onConnectStatus, onAuthStatus, onServerInfoUpdate, getServerDataHashForPath) {\n  this.id = fb.core.PersistentConnection.nextPersistentConnectionId_++;\n  this.log_ = fb.core.util.logWrapper(\"p:\" + this.id + \":\");\n  this.shouldReconnect_ = true;\n  this.listens_ = {};\n  this.outstandingPuts_ = [];\n  this.outstandingPutCount_ = 0;\n  this.onDisconnectRequestQueue_ = [];\n  this.connected_ = false;\n  this.reconnectDelay_ = RECONNECT_MIN_DELAY;\n  this.maxReconnectDelay_ = RECONNECT_MAX_DELAY_DEFAULT;\n  this.onDataUpdate_ = onDataUpdate || goog.nullFunction;\n  this.onConnectStatus_ = onConnectStatus || goog.nullFunction;\n  this.onAuthStatus_ = onAuthStatus || goog.nullFunction;\n  this.onServerInfoUpdate_ = onServerInfoUpdate || goog.nullFunction;\n  this.getServerDataHashForPath_ = getServerDataHashForPath || goog.nullFunction;\n  this.repoInfo_ = repoInfo;\n  this.securityDebugCallback_ = null;\n  this.requestCBHash_ = {};\n  this.requestNumber_ = 0;\n  this.lastConnectionAttemptTime_ = null;\n  this.lastConnectionEstablishedTime_ = null;\n  this.scheduleConnect_(0);\n  fb.core.util.VisibilityMonitor.getInstance().on(\"visible\", this.onVisible_, this);\n  if (repoInfo.host.indexOf(\"fblocal\") === -1) {\n    fb.core.util.OnlineMonitor.getInstance().on(\"online\", this.onOnline_, this);\n  }\n};\nfb.core.PersistentConnection.nextPersistentConnectionId_ = 0;\nfb.core.PersistentConnection.nextConnectionId_ = 0;\nfb.core.PersistentConnection.prototype.sendRequest_ = function(action, body, onResponse) {\n  var curReqNum = ++this.requestNumber_;\n  var msg = {\"r\":curReqNum, \"a\":action, \"b\":body};\n  this.log_(fb.util.json.stringify(msg));\n  fb.core.util.assert(this.connected_, \"sendRequest_ call when we're not connected not allowed.\");\n  this.realtime_.sendRequest(msg);\n  if (onResponse) {\n    this.requestCBHash_[curReqNum] = onResponse;\n  }\n};\nfb.core.PersistentConnection.prototype.listen = function(queryMap, onComplete) {\n  var queryId = queryMap.toString();\n  var pathString = queryMap.path().toString();\n  this.listens_[pathString] = this.listens_[pathString] || {};\n  fb.core.util.assert(!this.listens_[pathString][queryId], \"listen() called twice for same path/queryId.\");\n  this.listens_[pathString][queryId] = {queries:queryMap.queries(), onComplete:onComplete};\n  if (this.connected_) {\n    this.sendListen_(pathString, queryId, queryMap.queries(), onComplete);\n  }\n};\nfb.core.PersistentConnection.prototype.sendListen_ = function(pathString, queryId, queries, onComplete) {\n  var self = this;\n  this.log_(\"Listen on \" + pathString + \" for \" + queryId);\n  var req = {\"p\":pathString};\n  var queriesObj = goog.array.map(queries, function(q) {\n    return q.queryObject();\n  });\n  if (queryId !== \"{}\") {\n    req[\"q\"] = queriesObj;\n  }\n  req[\"h\"] = this.getServerDataHashForPath_(pathString);\n  this.sendRequest_(\"l\", req, function(message) {\n    self.log_(\"listen response\", message);\n    var status = message[\"s\"];\n    if (status !== \"ok\") {\n      self.removeListen_(pathString, queryId);\n    }\n    if (onComplete) {\n      onComplete(status);\n    }\n  });\n};\nfb.core.PersistentConnection.prototype.auth = function(cred, callback, cancelCallback) {\n  this.credential_ = {cred:cred, firstRequestSent:false, callback:callback, cancelCallback:cancelCallback};\n  this.log_(\"Authenticating using credential: \" + this.credential_);\n  this.tryAuth();\n  this.reduceReconnectDelayIfAdminCredential_(cred);\n};\nfb.core.PersistentConnection.prototype.reduceReconnectDelayIfAdminCredential_ = function(credential) {\n  var isFirebaseSecret = credential.length == 40;\n  if (isFirebaseSecret || this.isAdminAuthToken_(credential)) {\n    this.log_(\"Admin auth credential detected.  Reducing max reconnect time.\");\n    this.maxReconnectDelay_ = RECONNECT_MAX_DELAY_FOR_ADMINS;\n  }\n};\nfb.core.PersistentConnection.prototype.isAdminAuthToken_ = function(credential) {\n  var claims;\n  try {\n    var parts = credential.split(\".\");\n    if (parts.length !== 3) {\n      return false;\n    }\n    var claimsString = fb.core.util.base64DecodeIfNativeSupport(parts[1]);\n    if (claimsString !== null) {\n      claims = fb.util.json.eval(claimsString);\n    }\n  } catch (e) {\n    fb.core.util.log(\"isAdminAuthToken_ failed\", e);\n  }\n  return typeof claims === \"object\" && fb.util.obj.get(claims, \"admin\") === true;\n};\nfb.core.PersistentConnection.prototype.unauth = function(onComplete) {\n  delete this.credential_;\n  this.onAuthStatus_(false);\n  if (this.connected_) {\n    this.sendRequest_(\"unauth\", {}, function(result) {\n      var status = result[\"s\"];\n      var errorReason = result[\"d\"];\n      onComplete(status, errorReason);\n    });\n  }\n};\nfb.core.PersistentConnection.prototype.tryAuth = function() {\n  var authdata = this.credential_;\n  var self = this;\n  if (this.connected_ && authdata) {\n    var requestData = {\"cred\":authdata.cred};\n    this.sendRequest_(\"auth\", requestData, function(res) {\n      var status = res[\"s\"];\n      var data = res[\"d\"] || \"error\";\n      if (status !== \"ok\" && self.credential_ === authdata) {\n        delete self.credential_;\n      }\n      self.onAuthStatus_(status === \"ok\");\n      if (!authdata.firstRequestSent) {\n        authdata.firstRequestSent = true;\n        if (authdata.callback) {\n          authdata.callback(status, data);\n        }\n      } else {\n        if (status !== \"ok\" && authdata.cancelCallback) {\n          authdata.cancelCallback(status, data);\n        }\n      }\n    });\n  }\n};\nfb.core.PersistentConnection.prototype.unlisten = function(path, queryId, queries) {\n  var pathString = path.toString();\n  var listen = this.removeListen_(pathString, queryId);\n  if (listen && this.connected_) {\n    this.sendUnlisten_(pathString, queryId, queries);\n  }\n};\nfb.core.PersistentConnection.prototype.sendUnlisten_ = function(pathString, queryId, queryObjs) {\n  this.log_(\"Unlisten on \" + pathString + \" for \" + queryId);\n  var self = this;\n  var req = {\"p\":pathString};\n  var queries = goog.array.map(queryObjs, function(q) {\n    return q.queryObject();\n  });\n  if (queryId !== \"{}\") {\n    req[\"q\"] = queries;\n  }\n  this.sendRequest_(\"u\", req);\n};\nfb.core.PersistentConnection.prototype.onDisconnectPut = function(pathString, data, opt_onComplete) {\n  if (this.connected_) {\n    this.sendOnDisconnect_(\"o\", pathString, data, opt_onComplete);\n  } else {\n    this.onDisconnectRequestQueue_.push({pathString:pathString, action:\"o\", data:data, onComplete:opt_onComplete});\n  }\n};\nfb.core.PersistentConnection.prototype.onDisconnectMerge = function(pathString, data, opt_onComplete) {\n  if (this.connected_) {\n    this.sendOnDisconnect_(\"om\", pathString, data, opt_onComplete);\n  } else {\n    this.onDisconnectRequestQueue_.push({pathString:pathString, action:\"om\", data:data, onComplete:opt_onComplete});\n  }\n};\nfb.core.PersistentConnection.prototype.onDisconnectCancel = function(pathString, opt_onComplete) {\n  if (this.connected_) {\n    this.sendOnDisconnect_(\"oc\", pathString, null, opt_onComplete);\n  } else {\n    this.onDisconnectRequestQueue_.push({pathString:pathString, action:\"oc\", data:null, onComplete:opt_onComplete});\n  }\n};\nfb.core.PersistentConnection.prototype.sendOnDisconnect_ = function(action, pathString, data, opt_onComplete) {\n  var self = this;\n  var request = {\"p\":pathString, \"d\":data};\n  self.log_(\"onDisconnect \" + action, request);\n  this.sendRequest_(action, request, function(response) {\n    if (opt_onComplete) {\n      setTimeout(function() {\n        opt_onComplete(response[\"s\"], response[\"d\"]);\n      }, Math.floor(0));\n    }\n  });\n};\nfb.core.PersistentConnection.prototype.put = function(pathString, data, opt_onComplete, opt_hash) {\n  this.putInternal(\"p\", pathString, data, opt_onComplete, opt_hash);\n};\nfb.core.PersistentConnection.prototype.merge = function(pathString, data, opt_onComplete, opt_hash) {\n  this.putInternal(\"m\", pathString, data, opt_onComplete, opt_hash);\n};\nfb.core.PersistentConnection.prototype.putInternal = function(action, pathString, data, opt_onComplete, opt_hash) {\n  var request = {\"p\":pathString, \"d\":data};\n  if (goog.isDef(opt_hash)) {\n    request[\"h\"] = opt_hash;\n  }\n  this.outstandingPuts_.push({action:action, request:request, onComplete:opt_onComplete});\n  this.outstandingPutCount_++;\n  var index = this.outstandingPuts_.length - 1;\n  if (this.connected_) {\n    this.sendPut_(index);\n  }\n};\nfb.core.PersistentConnection.prototype.sendPut_ = function(index) {\n  var self = this;\n  var action = this.outstandingPuts_[index].action;\n  var request = this.outstandingPuts_[index].request;\n  var onComplete = this.outstandingPuts_[index].onComplete;\n  this.outstandingPuts_[index].queued = this.connected_;\n  this.sendRequest_(action, request, function(message) {\n    self.log_(action + \" response\", message);\n    delete self.outstandingPuts_[index];\n    self.outstandingPutCount_--;\n    if (self.outstandingPutCount_ === 0) {\n      self.outstandingPuts_ = [];\n    }\n    if (onComplete) {\n      onComplete(message[\"s\"], message[\"d\"]);\n    }\n  });\n};\nfb.core.PersistentConnection.prototype.reportStats = function(stats) {\n  if (this.connected_) {\n    var request = {\"c\":stats};\n    this.log_(\"reportStats\", request);\n    this.sendRequest_(\"s\", request);\n  }\n};\nfb.core.PersistentConnection.prototype.onDataMessage_ = function(message) {\n  if (\"r\" in message) {\n    this.log_(\"from server: \" + fb.util.json.stringify(message));\n    var reqNum = message[\"r\"];\n    var onResponse = this.requestCBHash_[reqNum];\n    if (onResponse) {\n      delete this.requestCBHash_[reqNum];\n      onResponse(message[\"b\"]);\n    }\n  } else {\n    if (\"error\" in message) {\n      throw \"A server-side error has occurred: \" + message[\"error\"];\n    } else {\n      if (\"a\" in message) {\n        this.onDataPush_(message[\"a\"], message[\"b\"]);\n      }\n    }\n  }\n};\nfb.core.PersistentConnection.prototype.onDataPush_ = function(action, body) {\n  this.log_(\"handleServerMessage\", action, body);\n  if (action === \"d\") {\n    this.onDataUpdate_(body[\"p\"], body[\"d\"], false);\n  } else {\n    if (action === \"m\") {\n      this.onDataUpdate_(body[\"p\"], body[\"d\"], true);\n    } else {\n      if (action === \"c\") {\n        this.onListenRevoked_(body[\"p\"], body[\"q\"]);\n      } else {\n        if (action === \"ac\") {\n          this.onAuthRevoked_(body[\"s\"], body[\"d\"]);\n        } else {\n          if (action === \"sd\") {\n            this.onSecurityDebugPacket_(body);\n          } else {\n            fb.core.util.error(\"Unrecognized action received from server: \" + fb.util.json.stringify(action) + \"\\nAre you using the latest client?\");\n          }\n        }\n      }\n    }\n  }\n};\nfb.core.PersistentConnection.prototype.onReady_ = function(timestamp) {\n  this.log_(\"connection ready\");\n  this.connected_ = true;\n  this.lastConnectionEstablishedTime_ = (new Date).getTime();\n  this.handleTimestamp_(timestamp);\n  this.restoreState_();\n  this.onConnectStatus_(true);\n};\nfb.core.PersistentConnection.prototype.scheduleConnect_ = function(timeout) {\n  fb.core.util.assert(!this.realtime_, \"Scheduling a connect when we're already connected/ing?\");\n  if (this.establishConnectionTimer_) {\n    clearTimeout(this.establishConnectionTimer_);\n  }\n  var self = this;\n  this.establishConnectionTimer_ = setTimeout(function() {\n    self.establishConnectionTimer_ = null;\n    self.establishConnection_();\n  }, Math.floor(timeout));\n};\nfb.core.PersistentConnection.prototype.onVisible_ = function(visible) {\n  if (visible && !this.visible_ && this.reconnectDelay_ === this.maxReconnectDelay_) {\n    this.log_(\"Window became visible.  Reducing delay.\");\n    this.reconnectDelay_ = RECONNECT_MIN_DELAY;\n    if (!this.realtime_) {\n      this.scheduleConnect_(0);\n    }\n  }\n  this.visible_ = visible;\n};\nfb.core.PersistentConnection.prototype.onOnline_ = function(online) {\n  if (online) {\n    this.log_(\"Browser went online.  Reconnecting.\");\n    this.reconnectDelay_ = RECONNECT_MIN_DELAY;\n    this.shouldReconnect_ = true;\n    if (!this.realtime_) {\n      this.scheduleConnect_(0);\n    }\n  } else {\n    this.log_(\"Browser went offline.  Killing connection; don't reconnect.\");\n    this.shouldReconnect_ = false;\n    if (this.realtime_) {\n      this.realtime_.close();\n    }\n  }\n};\nfb.core.PersistentConnection.prototype.onRealtimeDisconnect_ = function() {\n  this.log_(\"data client disconnected\");\n  this.connected_ = false;\n  this.realtime_ = null;\n  this.cancelSentTransactions_();\n  if (!this.shouldReconnect_) {\n    for (var cbInd in this.requestCBHash_) {\n      delete this.requestCBHash_[cbInd];\n    }\n  } else {\n    if (!this.visible_) {\n      this.log_(\"Window isn't visible.  Delaying reconnect.\");\n      this.reconnectDelay_ = this.maxReconnectDelay_;\n      this.lastConnectionAttemptTime_ = (new Date).getTime();\n    } else {\n      if (this.lastConnectionEstablishedTime_) {\n        var timeSinceLastConnectSucceeded = (new Date).getTime() - this.lastConnectionEstablishedTime_;\n        if (timeSinceLastConnectSucceeded > RECONNECT_DELAY_RESET_TIMEOUT) {\n          this.reconnectDelay_ = RECONNECT_MIN_DELAY;\n        }\n        this.lastConnectionEstablishedTime_ = null;\n      }\n    }\n    var timeSinceLastConnectAttempt = (new Date).getTime() - this.lastConnectionAttemptTime_;\n    var reconnectDelay = Math.max(0, this.reconnectDelay_ - timeSinceLastConnectAttempt);\n    reconnectDelay = Math.random() * reconnectDelay;\n    this.log_(\"Trying to reconnect in \" + reconnectDelay + \"ms\");\n    this.scheduleConnect_(reconnectDelay);\n    this.reconnectDelay_ = Math.min(this.maxReconnectDelay_, this.reconnectDelay_ * RECONNECT_DELAY_MULTIPLIER);\n  }\n  this.onConnectStatus_(false);\n};\nfb.core.PersistentConnection.prototype.establishConnection_ = function() {\n  if (this.shouldReconnect_) {\n    this.log_(\"Making a connection attempt\");\n    this.lastConnectionAttemptTime_ = (new Date).getTime();\n    this.lastConnectionEstablishedTime_ = null;\n    var onDataMessage = goog.bind(this.onDataMessage_, this);\n    var onReady = goog.bind(this.onReady_, this);\n    var onDisconnect = goog.bind(this.onRealtimeDisconnect_, this);\n    var connId = this.id + \":\" + fb.core.PersistentConnection.nextConnectionId_++;\n    var self = this;\n    this.realtime_ = new fb.realtime.Connection(connId, this.repoInfo_, onDataMessage, onReady, onDisconnect, function(reason) {\n      fb.core.util.warn(reason + \" (\" + self.repoInfo_.toString() + \")\");\n      self.shouldReconnect_ = false;\n    });\n  }\n};\nfb.core.PersistentConnection.prototype.interrupt = function() {\n  this.shouldReconnect_ = false;\n  if (this.realtime_) {\n    this.realtime_.close();\n  } else {\n    if (this.establishConnectionTimer_) {\n      clearTimeout(this.establishConnectionTimer_);\n      this.establishConnectionTimer_ = null;\n    }\n    if (this.connected_) {\n      this.onRealtimeDisconnect_();\n    }\n  }\n};\nfb.core.PersistentConnection.prototype.resume = function() {\n  this.shouldReconnect_ = true;\n  this.reconnectDelay_ = RECONNECT_MIN_DELAY;\n  if (!this.connected_) {\n    this.scheduleConnect_(0);\n  }\n};\nfb.core.PersistentConnection.prototype.handleTimestamp_ = function(timestamp) {\n  var delta = timestamp - (new Date).getTime();\n  this.onServerInfoUpdate_({\"serverTimeOffset\":delta});\n};\nfb.core.PersistentConnection.prototype.cancelSentTransactions_ = function() {\n  for (var i = 0;i < this.outstandingPuts_.length;i++) {\n    var put = this.outstandingPuts_[i];\n    if (put && \"h\" in put.request && put.queued) {\n      if (put.onComplete) {\n        put.onComplete(\"disconnect\");\n      }\n      delete this.outstandingPuts_[i];\n      this.outstandingPutCount_--;\n    }\n  }\n  if (this.outstandingPutCount_ === 0) {\n    this.outstandingPuts_ = [];\n  }\n};\nfb.core.PersistentConnection.prototype.onListenRevoked_ = function(pathString, opt_query) {\n  var queryId;\n  if (!opt_query) {\n    queryId = \"{}\";\n  } else {\n    queryId = goog.array.map(opt_query, function(q) {\n      return fb.core.util.ObjectToUniqueKey(q);\n    }).join(\"$\");\n  }\n  var listen = this.removeListen_(pathString, queryId);\n  if (listen && listen.onComplete) {\n    listen.onComplete(\"permission_denied\");\n  }\n};\nfb.core.PersistentConnection.prototype.removeListen_ = function(pathString, queryId) {\n  var normalizedPathString = (new fb.core.util.Path(pathString)).toString();\n  if (!queryId) {\n    queryId = \"{}\";\n  }\n  var listen = this.listens_[normalizedPathString][queryId];\n  delete this.listens_[normalizedPathString][queryId];\n  return listen;\n};\nfb.core.PersistentConnection.prototype.onAuthRevoked_ = function(statusCode, explanation) {\n  var cred = this.credential_;\n  delete this.credential_;\n  if (cred && cred.cancelCallback) {\n    cred.cancelCallback(statusCode, explanation);\n  }\n  this.onAuthStatus_(false);\n};\nfb.core.PersistentConnection.prototype.onSecurityDebugPacket_ = function(body) {\n  if (this.securityDebugCallback_) {\n    this.securityDebugCallback_(body);\n  } else {\n    if (\"msg\" in body && typeof console !== \"undefined\") {\n      console.log(\"FIREBASE: \" + body[\"msg\"].replace(\"\\n\", \"\\nFIREBASE: \"));\n    }\n  }\n};\nfb.core.PersistentConnection.prototype.restoreState_ = function() {\n  this.tryAuth();\n  for (var pathString in this.listens_) {\n    for (var queryId in this.listens_[pathString]) {\n      var listen = this.listens_[pathString][queryId];\n      this.sendListen_(pathString, queryId, listen.queries, listen.onComplete);\n    }\n  }\n  for (var i = 0;i < this.outstandingPuts_.length;i++) {\n    if (this.outstandingPuts_[i]) {\n      this.sendPut_(i);\n    }\n  }\n  while (this.onDisconnectRequestQueue_.length) {\n    var request = this.onDisconnectRequestQueue_.shift();\n    this.sendOnDisconnect_(request.action, request.pathString, request.data, request.onComplete);\n  }\n};\ngoog.provide(\"fb.core.snap.Node\");\nfb.core.snap.Node = function() {\n};\nfb.core.snap.Node.prototype.isLeafNode;\nfb.core.snap.Node.prototype.getPriority;\nfb.core.snap.Node.prototype.updatePriority;\nfb.core.snap.Node.prototype.updateValue;\nfb.core.snap.Node.prototype.getImmediateChild;\nfb.core.snap.Node.prototype.getChild;\nfb.core.snap.Node.prototype.getPredecessorChildName;\nfb.core.snap.Node.prototype.updateImmediateChild;\nfb.core.snap.Node.prototype.updateChild;\nfb.core.snap.Node.prototype.isEmpty;\nfb.core.snap.Node.prototype.numChildren;\nfb.core.snap.Node.prototype.val;\nfb.core.snap.Node.prototype.hash;\ngoog.provide(\"fb.core.SparseSnapshotTree\");\ngoog.require(\"fb.core.snap.Node\");\ngoog.require(\"fb.core.util.CountedSet\");\ngoog.require(\"fb.core.util.Path\");\nfb.core.SparseSnapshotTree = function() {\n  this.value_ = null;\n  this.children_ = null;\n};\nfb.core.SparseSnapshotTree.prototype.find = function(path) {\n  if (this.value_ != null) {\n    return this.value_.getChild(path);\n  } else {\n    if (!path.isEmpty() && this.children_ != null) {\n      var childKey = path.getFront();\n      path = path.popFront();\n      if (this.children_.contains(childKey)) {\n        var childTree = this.children_.get(childKey);\n        return childTree.find(path);\n      } else {\n        return null;\n      }\n    } else {\n      return null;\n    }\n  }\n};\nfb.core.SparseSnapshotTree.prototype.remember = function(path, data) {\n  if (path.isEmpty()) {\n    this.value_ = data;\n    this.children_ = null;\n  } else {\n    if (this.value_ !== null) {\n      this.value_ = this.value_.updateChild(path, data);\n    } else {\n      if (this.children_ == null) {\n        this.children_ = new fb.core.util.CountedSet;\n      }\n      var childKey = path.getFront();\n      if (!this.children_.contains(childKey)) {\n        this.children_.add(childKey, new fb.core.SparseSnapshotTree);\n      }\n      var child = this.children_.get(childKey);\n      path = path.popFront();\n      child.remember(path, data);\n    }\n  }\n};\nfb.core.SparseSnapshotTree.prototype.forget = function(path) {\n  if (path.isEmpty()) {\n    this.value_ = null;\n    this.children_ = null;\n    return true;\n  } else {\n    if (this.value_ !== null) {\n      if (this.value_.isLeafNode()) {\n        return false;\n      } else {\n        var value = this.value_;\n        this.value_ = null;\n        var self = this;\n        value.forEachChild(function(key, tree) {\n          self.remember(new fb.core.util.Path(key), tree);\n        });\n        return this.forget(path);\n      }\n    } else {\n      if (this.children_ !== null) {\n        var childKey = path.getFront();\n        path = path.popFront();\n        if (this.children_.contains(childKey)) {\n          var safeToRemove = this.children_.get(childKey).forget(path);\n          if (safeToRemove) {\n            this.children_.remove(childKey);\n          }\n        }\n        if (this.children_.isEmpty()) {\n          this.children_ = null;\n          return true;\n        } else {\n          return false;\n        }\n      } else {\n        return true;\n      }\n    }\n  }\n};\nfb.core.SparseSnapshotTree.prototype.forEachTree = function(prefixPath, func) {\n  if (this.value_ !== null) {\n    func(prefixPath, this.value_);\n  } else {\n    this.forEachChild(function(key, tree) {\n      var path = new fb.core.util.Path(prefixPath.toString() + \"/\" + key);\n      tree.forEachTree(path, func);\n    });\n  }\n};\nfb.core.SparseSnapshotTree.prototype.forEachChild = function(func) {\n  if (this.children_ !== null) {\n    this.children_.each(function(key, tree) {\n      func(key, tree);\n    });\n  }\n};\ngoog.provide(\"fb.core.SnapshotHolder\");\nfb.core.SnapshotHolder = function() {\n  this.rootNode_ = fb.core.snap.EMPTY_NODE;\n};\nfb.core.SnapshotHolder.prototype.getNode = function(path) {\n  return this.rootNode_.getChild(path);\n};\nfb.core.SnapshotHolder.prototype.updateSnapshot = function(path, newSnapshotNode) {\n  this.rootNode_ = this.rootNode_.updateChild(path, newSnapshotNode);\n};\nif (goog.DEBUG) {\n  fb.core.SnapshotHolder.prototype.toString = function() {\n    return this.rootNode_.toString();\n  };\n}\n;goog.provide(\"fb.core.FirebaseData\");\ngoog.require(\"fb.core.SnapshotHolder\");\nfb.core.FirebaseData = function() {\n  this.serverData = new fb.core.SnapshotHolder;\n  this.mergedData = new fb.core.SnapshotHolder;\n  this.visibleData = new fb.core.SnapshotHolder;\n  this.pendingPuts = new fb.core.util.Tree;\n};\nfb.core.FirebaseData.prototype.updateServerData = function(path, serverNode) {\n  this.serverData.updateSnapshot(path, serverNode);\n  return this.mergeServerAndPendingData(path);\n};\nfb.core.FirebaseData.prototype.mergeServerAndPendingData = function(path) {\n  var serverNode = this.serverData.getNode(path);\n  var mergedNode = this.mergedData.getNode(path);\n  var pendingPuts = this.pendingPuts.subTree(path);\n  var hiddenBySet = false;\n  var tempSet = pendingPuts;\n  while (tempSet !== null) {\n    if (tempSet.getValue() !== null) {\n      hiddenBySet = true;\n      break;\n    }\n    tempSet = tempSet.parent();\n  }\n  if (hiddenBySet) {\n    return false;\n  }\n  var newMergedNode = fb.core.FirebaseData.mergeSnapshotNodes_(serverNode, mergedNode, pendingPuts);\n  if (newMergedNode !== mergedNode) {\n    this.mergedData.updateSnapshot(path, newMergedNode);\n    return true;\n  }\n  return false;\n};\nfb.core.FirebaseData.mergeSnapshotNodes_ = function(serverNode, pendingNode, pendingPuts) {\n  if (pendingPuts.isEmpty()) {\n    return serverNode;\n  }\n  if (pendingPuts.getValue() !== null) {\n    return pendingNode;\n  }\n  serverNode = serverNode || fb.core.snap.EMPTY_NODE;\n  pendingPuts.forEachChild(function(node) {\n    var childName = node.name();\n    var serverChild = serverNode.getImmediateChild(childName);\n    var pendingChild = pendingNode.getImmediateChild(childName);\n    var pendingPutsChild = pendingPuts.subTree(childName);\n    var mergedChild = fb.core.FirebaseData.mergeSnapshotNodes_(serverChild, pendingChild, pendingPutsChild);\n    serverNode = serverNode.updateImmediateChild(childName, mergedChild);\n  });\n  return serverNode;\n};\nfb.core.FirebaseData.prototype.set = function(path, toSave) {\n  var self = this;\n  var setIds = [];\n  goog.array.forEach(toSave, function(update) {\n    var path = update.path;\n    var node = update.node;\n    var setId = fb.core.util.LUIDGenerator();\n    self.pendingPuts.subTree(path).setValue(setId);\n    self.mergedData.updateSnapshot(path, node);\n    setIds.push({path:path, setId:setId});\n  });\n  return setIds;\n};\nfb.core.FirebaseData.prototype.setCompleted = function(setIds) {\n  var self = this;\n  goog.array.forEach(setIds, function(setData) {\n    var setId = setData.setId;\n    var path = setData.path;\n    var pendingPutTree = self.pendingPuts.subTree(path);\n    var pendingPut = pendingPutTree.getValue();\n    fb.core.util.assert(pendingPut !== null, \"pendingPut should not be null.\");\n    if (pendingPut === setId) {\n      pendingPutTree.setValue(null);\n    }\n  });\n};\nfb.core.FirebaseData.prototype.forgetPath = function(path, lowerBounds) {\n  var childSnapshots = [];\n  for (var i = 0;i < lowerBounds.length;++i) {\n    childSnapshots[i] = this.serverData.getNode(lowerBounds[i]);\n  }\n  this.serverData.updateSnapshot(path, fb.core.snap.EMPTY_NODE);\n  for (i = 0;i < lowerBounds.length;++i) {\n    this.serverData.updateSnapshot(lowerBounds[i], childSnapshots[i]);\n  }\n  return this.mergeServerAndPendingData(path);\n};\ngoog.provide(\"fb.core.util.ServerValues\");\nfb.core.util.ServerValues.generateWithValues = function(values) {\n  values = values || {};\n  values[\"timestamp\"] = values[\"timestamp\"] || (new Date).getTime();\n  return values;\n};\nfb.core.util.ServerValues.resolveDeferredValue = function(value, serverValues) {\n  if (!value || typeof value !== \"object\") {\n    return(value);\n  } else {\n    fb.core.util.assert(\".sv\" in value, \"Unexpected leaf node or priority contents\");\n    return serverValues[value[\".sv\"]];\n  }\n};\nfb.core.util.ServerValues.resolveDeferredValueTree = function(tree, serverValues) {\n  var resolvedTree = new fb.core.SparseSnapshotTree;\n  tree.forEachTree(new fb.core.util.Path(\"\"), function(path, node) {\n    resolvedTree.remember(path, fb.core.util.ServerValues.resolveDeferredValueSnapshot(node, serverValues));\n  });\n  return resolvedTree;\n};\nfb.core.util.ServerValues.resolveDeferredValueSnapshot = function(node, serverValues) {\n  var priority = fb.core.util.ServerValues.resolveDeferredValue(node.getPriority(), serverValues), newNode;\n  if (node.isLeafNode()) {\n    var value = fb.core.util.ServerValues.resolveDeferredValue(node.getValue(), serverValues);\n    if (value !== node.getValue() || priority !== node.getPriority()) {\n      return new fb.core.snap.LeafNode(value, priority);\n    } else {\n      return node;\n    }\n  } else {\n    newNode = node;\n    if (priority !== node.getPriority()) {\n      newNode = newNode.updatePriority(priority);\n    }\n    node.forEachChild(function(childName, childNode) {\n      var newChildNode = fb.core.util.ServerValues.resolveDeferredValueSnapshot(childNode, serverValues);\n      if (newChildNode !== childNode) {\n        newNode = newNode.updateImmediateChild(childName, newChildNode);\n      }\n    });\n    return newNode;\n  }\n};\ngoog.provide(\"fb.core.view.EventQueue\");\nfb.core.view.EventQueue = function() {\n  this.events = [];\n};\nfb.core.view.EventQueue.prototype.queueEvents = function(eventDataList) {\n  if (eventDataList.length === 0) {\n    return;\n  }\n  for (var i = 0;i < eventDataList.length;i++) {\n    this.events.push(eventDataList[i]);\n  }\n};\nfb.core.view.EventQueue.prototype.raiseQueuedEvents = function() {\n  for (var i = 0;i < this.events.length;i++) {\n    if (this.events[i]) {\n      var eventData = this.events[i];\n      this.events[i] = null;\n      this.raiseEvent_(eventData);\n    }\n  }\n  this.events = [];\n};\nfb.core.view.EventQueue.prototype.raiseEvent_ = function(eventData) {\n  var callback = eventData.callback;\n  var snapshot = eventData.snapshot;\n  var prevName = eventData.prevName;\n  fb.core.util.exceptionGuard(function() {\n    callback(snapshot, prevName);\n  });\n};\ngoog.provide(\"fb.core.view.Change\");\nfb.core.view.Change = function(type, snapshotNode, childName, prevChildName) {\n  this.type = type;\n  this.snapshotNode = snapshotNode;\n  this.childName = childName;\n  this.prevName = prevChildName;\n};\nfb.core.view.Change.CHILD_ADDED = \"child_added\";\nfb.core.view.Change.CHILD_REMOVED = \"child_removed\";\nfb.core.view.Change.CHILD_CHANGED = \"child_changed\";\nfb.core.view.Change.CHILD_MOVED = \"child_moved\";\nfb.core.view.Change.VALUE = \"value\";\ngoog.provide(\"fb.core.view.ViewBase\");\ngoog.require(\"fb.core.view.Change\");\ngoog.require(\"fb.core.view.EventQueue\");\nfb.core.view.ViewBase = function(query) {\n  this.query_ = query;\n  this.callbacks_ = [];\n  this.eventQueue_ = new fb.core.view.EventQueue;\n};\nfb.core.view.ViewBase.prototype.getQuery = function() {\n  return this.query_;\n};\nfb.core.view.ViewBase.prototype.addEventCallback = function(eventType, callback, opt_cancelCallback, opt_context) {\n  this.callbacks_.push({type:eventType, callback:callback, cancel:opt_cancelCallback, context:opt_context});\n  var eventDataList = [];\n  var changes = this.generateChangesForSnapshot(this.snapshotNode_);\n  if (this.isComplete_) {\n    changes.push(new fb.core.view.Change(\"value\", this.snapshotNode_));\n  }\n  for (var i = 0;i < changes.length;i++) {\n    if (changes[i].type === eventType) {\n      var firebaseRef = new Firebase(this.query_.repo, this.query_.path);\n      if (changes[i].childName) {\n        firebaseRef = firebaseRef.child(changes[i].childName);\n      }\n      eventDataList.push({callback:fb.core.util.bindCallback(callback, opt_context), snapshot:new fb.api.DataSnapshot(changes[i].snapshotNode, firebaseRef), prevName:changes[i].prevName});\n    }\n  }\n  this.eventQueue_.queueEvents(eventDataList);\n};\nfb.core.view.ViewBase.prototype.removeEventCallback = function(opt_eventType, opt_callback, opt_context) {\n  var found = false;\n  for (var i = this.callbacks_.length - 1;i >= 0;i--) {\n    var cbObject = this.callbacks_[i];\n    if ((!opt_eventType || cbObject.type === opt_eventType) && (!opt_callback || cbObject.callback === opt_callback) && (!opt_context || cbObject.context === opt_context)) {\n      this.callbacks_.splice(i, 1);\n      found = true;\n      if (opt_eventType && opt_callback) {\n        break;\n      }\n    }\n  }\n  return found;\n};\nfb.core.view.ViewBase.prototype.hasCallbacks = function() {\n  return this.callbacks_.length > 0;\n};\nfb.core.view.ViewBase.prototype.processChanges = function(newSnapshotNode, changes) {\n  changes = this.processChanges_(newSnapshotNode, changes);\n  if (changes != null) {\n    this.queueEventsForChanges_(changes);\n  }\n};\nfb.core.view.ViewBase.prototype.raiseCancelEvents = function(error) {\n  for (var i = 0;i < this.callbacks_.length;i++) {\n    var cbObj = this.callbacks_[i];\n    if (cbObj.cancel) {\n      fb.core.util.bindCallback(cbObj.cancel, cbObj.context)(error);\n    }\n  }\n};\nfb.core.view.ViewBase.prototype.queueEventsForChanges_ = function(changes) {\n  var eventDataList = [];\n  for (var i = 0;i < changes.length;i++) {\n    var event = changes[i], logData = event.type;\n    var firebaseRef = new Firebase(this.query_.repo, this.query_.path);\n    if (changes[i].childName) {\n      firebaseRef = firebaseRef.child(changes[i].childName);\n    }\n    var snapshot = new fb.api.DataSnapshot(changes[i].snapshotNode, firebaseRef);\n    if (event.type === \"value\" && !snapshot.hasChildren()) {\n      logData += \"(\" + snapshot.val() + \")\";\n    } else {\n      if (event.type !== \"value\") {\n        logData += \" \" + snapshot.name();\n      }\n    }\n    fb.core.util.log(this.query_.repo.connection_.id + \": event:\" + this.query_.path + \":\" + this.query_.queryIdentifier() + \":\" + logData);\n    for (var j = 0;j < this.callbacks_.length;j++) {\n      var cbObj = this.callbacks_[j];\n      if (changes[i].type === cbObj.type) {\n        eventDataList.push({callback:fb.core.util.bindCallback(cbObj.callback, cbObj.context), snapshot:snapshot, prevName:event.prevName});\n      }\n    }\n  }\n  this.eventQueue_.queueEvents(eventDataList);\n};\nfb.core.view.ViewBase.prototype.raiseQueuedEvents = function() {\n  this.eventQueue_.raiseQueuedEvents();\n};\nfb.core.view.ViewBase.prototype.generateChangesForSnapshot = function(snapshotNode) {\n  var events = [];\n  if (!snapshotNode.isLeafNode()) {\n    var prevName = null;\n    snapshotNode.forEachChild(function(name, childNode) {\n      events.push(new fb.core.view.Change(fb.core.view.Change.CHILD_ADDED, childNode, name, prevName));\n      prevName = name;\n    });\n  }\n  return events;\n};\nfb.core.view.ViewBase.prototype.isComplete = function() {\n  return this.isComplete_;\n};\nfb.core.view.ViewBase.prototype.markComplete = function() {\n  if (!this.isComplete_) {\n    this.isComplete_ = true;\n    this.queueEventsForChanges_([new fb.core.view.Change(\"value\", this.snapshotNode_)]);\n  }\n};\nfb.core.view.ViewBase.prototype.processChanges_ = goog.abstractMethod;\nfb.core.view.ViewBase.prototype.getChildRelevance = goog.abstractMethod;\ngoog.provide(\"fb.core.view.DefaultView\");\ngoog.require(\"fb.core.view.ViewBase\");\nfb.core.view.DefaultView = function(query, snapshotNode) {\n  fb.core.view.ViewBase.call(this, query);\n  this.snapshotNode_ = snapshotNode;\n};\ngoog.inherits(fb.core.view.DefaultView, fb.core.view.ViewBase);\nfb.core.view.DefaultView.prototype.processChanges_ = function(snapshotNode, changes) {\n  this.snapshotNode_ = snapshotNode;\n  if (this.isComplete_ && changes != null) {\n    changes.push(new fb.core.view.Change(\"value\", this.snapshotNode_));\n  }\n  return changes;\n};\nfb.core.view.DefaultView.prototype.getChildRelevance = function(path, newNode, serverData) {\n  return{};\n};\ngoog.provide(\"fb.core.view.SnapshotDiffer\");\ngoog.require(\"fb.util.obj\");\nfb.core.view.SnapshotDiffer = function(diffMaskTree, onDiffCallback) {\n  this.diffMaskTree_ = diffMaskTree;\n  this.onDiffCallback_ = onDiffCallback;\n};\nfb.core.view.SnapshotDiffer.Diff = function(oldRootNode, newRootNode, path, diffMaskTree, onDiffCallback) {\n  var oldNode = oldRootNode.getChild(path), newNode = newRootNode.getChild(path);\n  var snapshotDiffer = new fb.core.view.SnapshotDiffer(diffMaskTree, onDiffCallback);\n  var changed = snapshotDiffer.diffRecursive_(path, oldNode, newNode);\n  var moved = !oldNode.isEmpty() && !newNode.isEmpty() && oldNode.getPriority() !== newNode.getPriority();\n  if (changed || moved) {\n    snapshotDiffer.propagateDiffUpward_(path, oldRootNode, newRootNode, changed, moved);\n  }\n};\nfb.core.view.SnapshotDiffer.prototype.propagateDiffUpward_ = function(path, oldRootNode, newRootNode, changed, moved) {\n  while (path.parent() !== null) {\n    var oldNode = oldRootNode.getChild(path);\n    var newNode = newRootNode.getChild(path);\n    var parentPath = path.parent();\n    if (!this.diffMaskTree_ || this.diffMaskTree_.subTree(parentPath).getValue()) {\n      var newParentSnapshotNode = newRootNode.getChild(parentPath);\n      var events = [];\n      var nodeName = path.getBack(), prevName;\n      if (oldNode.isEmpty()) {\n        prevName = newParentSnapshotNode.getPredecessorChildName(nodeName, newNode);\n        events.push(new fb.core.view.Change(\"child_added\", newNode, nodeName, prevName));\n      } else {\n        if (newNode.isEmpty()) {\n          events.push(new fb.core.view.Change(\"child_removed\", oldNode, nodeName));\n        } else {\n          prevName = newParentSnapshotNode.getPredecessorChildName(nodeName, newNode);\n          if (moved) {\n            events.push(new fb.core.view.Change(\"child_moved\", newNode, nodeName, prevName));\n          }\n          if (changed) {\n            events.push(new fb.core.view.Change(\"child_changed\", newNode, nodeName, prevName));\n          }\n        }\n      }\n      this.onDiffCallback_(parentPath, newParentSnapshotNode, events);\n    }\n    if (moved) {\n      moved = false;\n      changed = true;\n    }\n    path = parentPath;\n  }\n};\nfb.core.view.SnapshotDiffer.prototype.diffRecursive_ = function(path, oldNode, newNode) {\n  var changed;\n  var events = [];\n  if (oldNode === newNode) {\n    changed = false;\n  } else {\n    if (oldNode.isLeafNode() && newNode.isLeafNode()) {\n      changed = oldNode.getValue() !== newNode.getValue();\n    } else {\n      if (oldNode.isLeafNode()) {\n        this.diffChildrenRecursive_(path, fb.core.snap.EMPTY_NODE, newNode, events);\n        changed = true;\n      } else {\n        if (newNode.isLeafNode()) {\n          this.diffChildrenRecursive_(path, oldNode, fb.core.snap.EMPTY_NODE, events);\n          changed = true;\n        } else {\n          changed = this.diffChildrenRecursive_(path, oldNode, newNode, events);\n        }\n      }\n    }\n  }\n  if (changed) {\n    this.onDiffCallback_(path, newNode, events);\n  } else {\n    if (oldNode.getPriority() !== newNode.getPriority()) {\n      this.onDiffCallback_(path, newNode, null);\n    }\n  }\n  return changed;\n};\nfb.core.view.SnapshotDiffer.prototype.diffChildrenRecursive_ = function(path, oldNode, newNode, events) {\n  var changed = false;\n  var shouldDiff = !this.diffMaskTree_ || !this.diffMaskTree_.subTree(path).isEmpty();\n  var addedChildList = [], removedChildList = [], movedChildList = [], changedChildList = [];\n  var addedChildMap = {}, removedChildMap = {};\n  var oldIterator, newIterator, oldChild, newChild, childPath, prevChildName, childChanged;\n  oldIterator = oldNode.getIterator();\n  oldChild = oldIterator.getNext();\n  newIterator = newNode.getIterator();\n  newChild = newIterator.getNext();\n  while (oldChild !== null || newChild !== null) {\n    var comparison = this.compareChildren_(oldChild, newChild);\n    if (comparison < 0) {\n      var addedIndex = fb.util.obj.get(addedChildMap, oldChild.key);\n      if (goog.isDef(addedIndex)) {\n        movedChildList.push({from:oldChild, to:addedChildList[addedIndex]});\n        addedChildList[addedIndex] = null;\n      } else {\n        removedChildMap[oldChild.key] = removedChildList.length;\n        removedChildList.push(oldChild);\n      }\n      changed = true;\n      oldChild = oldIterator.getNext();\n    } else {\n      if (comparison > 0) {\n        var removedIndex = fb.util.obj.get(removedChildMap, newChild.key);\n        if (goog.isDef(removedIndex)) {\n          movedChildList.push({from:removedChildList[removedIndex], to:newChild});\n          removedChildList[removedIndex] = null;\n        } else {\n          addedChildMap[newChild.key] = addedChildList.length;\n          addedChildList.push(newChild);\n        }\n        changed = true;\n        newChild = newIterator.getNext();\n      } else {\n        childPath = path.child(newChild.key);\n        childChanged = this.diffRecursive_(childPath, oldChild.value, newChild.value);\n        if (childChanged) {\n          changedChildList.push(newChild);\n          changed = true;\n        }\n        if (oldChild.value.getPriority() !== newChild.value.getPriority()) {\n          movedChildList.push({from:oldChild, to:newChild});\n          changed = true;\n        }\n        oldChild = oldIterator.getNext();\n        newChild = newIterator.getNext();\n      }\n    }\n    if (!shouldDiff && changed) {\n      return true;\n    }\n  }\n  for (var i = 0;i < removedChildList.length;i++) {\n    var removedChild = removedChildList[i];\n    if (removedChild) {\n      childPath = path.child(removedChild.key);\n      this.diffRecursive_(childPath, removedChild.value, fb.core.snap.EMPTY_NODE);\n      events.push(new fb.core.view.Change(\"child_removed\", removedChild.value, removedChild.key));\n    }\n  }\n  for (i = 0;i < addedChildList.length;i++) {\n    var addedChild = addedChildList[i];\n    if (addedChild) {\n      childPath = path.child(addedChild.key);\n      prevChildName = newNode.getPredecessorChildName(addedChild.key, addedChild.value);\n      this.diffRecursive_(childPath, fb.core.snap.EMPTY_NODE, addedChild.value);\n      events.push(new fb.core.view.Change(\"child_added\", addedChild.value, addedChild.key, prevChildName));\n    }\n  }\n  for (i = 0;i < movedChildList.length;i++) {\n    var fromChild = movedChildList[i].from, toChild = movedChildList[i].to;\n    childPath = path.child(toChild.key);\n    prevChildName = newNode.getPredecessorChildName(toChild.key, toChild.value);\n    events.push(new fb.core.view.Change(\"child_moved\", toChild.value, toChild.key, prevChildName));\n    childChanged = this.diffRecursive_(childPath, fromChild.value, toChild.value);\n    if (childChanged) {\n      changedChildList.push(toChild);\n    }\n  }\n  for (i = 0;i < changedChildList.length;i++) {\n    var changedChild = changedChildList[i];\n    prevChildName = newNode.getPredecessorChildName(changedChild.key, changedChild.value);\n    events.push(new fb.core.view.Change(\"child_changed\", changedChild.value, changedChild.key, prevChildName));\n  }\n  return changed;\n};\nfb.core.view.SnapshotDiffer.prototype.compareChildren_ = function(a, b) {\n  if (a === null) {\n    return 1;\n  } else {\n    if (b === null) {\n      return-1;\n    } else {\n      if (a.key === b.key) {\n        return 0;\n      } else {\n        return fb.core.snap.NAME_AND_PRIORITY_COMPARATOR({name:a.key, priority:a.value.getPriority()}, {name:b.key, priority:b.value.getPriority()});\n      }\n    }\n  }\n};\ngoog.provide(\"fb.core.view.QueryMap\");\ngoog.require(\"fb.core.util.CountedSet\");\nfb.core.view.QueryMap = function() {\n  this.stopListener_ = null;\n  this.path_ = null;\n  fb.core.util.CountedSet.call(this);\n};\ngoog.inherits(fb.core.view.QueryMap, fb.core.util.CountedSet);\nfb.core.view.QueryMap.prototype.setActive = function(onDeactivate) {\n  this.stopListener_ = onDeactivate;\n};\nfb.core.view.QueryMap.prototype.isActive = function() {\n  return this.stopListener_ != null;\n};\nfb.core.view.QueryMap.prototype.setView = function(queryId, view) {\n  this.add(queryId, view);\n  if (!this.path_) {\n    this.path_ = view.getQuery().path;\n  }\n};\nfb.core.view.QueryMap.prototype.deactivate = function() {\n  this.stopListener_ && this.stopListener_();\n  this.stopListener_ = null;\n};\nfb.core.view.QueryMap.prototype.removeStopListener = function() {\n  var result = this.stopListener_;\n  this.stopListener_ = null;\n  return result;\n};\nfb.core.view.QueryMap.prototype.hasDefaultQuery = function() {\n  return this.contains(\"default\");\n};\nfb.core.view.QueryMap.prototype.hasActiveDefaultQuery = function() {\n  return this.stopListener_ != null && this.hasDefaultQuery();\n};\nfb.core.view.QueryMap.prototype.defaultView = function() {\n  if (this.hasDefaultQuery()) {\n    return this.get(\"default\");\n  } else {\n    return null;\n  }\n};\nfb.core.view.QueryMap.prototype.path = function() {\n  return this.path_;\n};\nfb.core.view.QueryMap.prototype.toString = function() {\n  return goog.array.map(this.keys(), function(k) {\n    if (k === \"default\") {\n      return \"{}\";\n    }\n    return k;\n  }).join(\"$\");\n};\nfb.core.view.QueryMap.prototype.queries = function() {\n  var queries = [];\n  this.each(function(queryId, view) {\n    queries.push(view.getQuery());\n  });\n  return queries;\n};\ngoog.provide(\"fb.core.view.QueryView\");\ngoog.require(\"fb.core.view.ViewBase\");\ngoog.require(\"fb.util.obj\");\nfb.core.view.QueryView = function(query, snapshotNode) {\n  fb.core.view.ViewBase.call(this, query);\n  this.snapshotNode_ = fb.core.snap.EMPTY_NODE;\n  this.processChanges_(snapshotNode, this.generateChangesForSnapshot(snapshotNode));\n};\ngoog.inherits(fb.core.view.QueryView, fb.core.view.ViewBase);\nfb.core.view.QueryView.prototype.processChanges_ = function(snapshotNode, changes) {\n  if (changes === null) {\n    return changes;\n  }\n  var constraints = [], query = this.query_;\n  if (goog.isDef(query.startPriority)) {\n    if (goog.isDef(query.startName) && query.startName != null) {\n      constraints.push(function(name, priority) {\n        var priorityDiff = fb.core.util.priorityCompare(priority, query.startPriority);\n        return priorityDiff > 0 || priorityDiff === 0 && fb.core.util.nameCompare(name, query.startName) >= 0;\n      });\n    } else {\n      constraints.push(function(name, priority) {\n        return fb.core.util.priorityCompare(priority, query.startPriority) >= 0;\n      });\n    }\n  }\n  if (goog.isDef(query.endPriority)) {\n    if (goog.isDef(query.endName)) {\n      constraints.push(function(name, priority) {\n        var priorityDiff = fb.core.util.priorityCompare(priority, query.endPriority);\n        return priorityDiff < 0 || priorityDiff === 0 && fb.core.util.nameCompare(name, query.endName) <= 0;\n      });\n    } else {\n      constraints.push(function(name, priority) {\n        return fb.core.util.priorityCompare(priority, query.endPriority) <= 0;\n      });\n    }\n  }\n  var limitEndName = null, limitStartName = null;\n  if (goog.isDef(this.query_.itemLimit)) {\n    if (goog.isDef(this.query_.startPriority)) {\n      limitEndName = this.getLimitName_(snapshotNode, constraints, this.query_.itemLimit, false);\n      if (limitEndName) {\n        var endPriority = snapshotNode.getImmediateChild(limitEndName).getPriority();\n        constraints.push(function(name, priority) {\n          var priorityDiff = fb.core.util.priorityCompare(priority, endPriority);\n          return priorityDiff < 0 || priorityDiff === 0 && fb.core.util.nameCompare(name, limitEndName) <= 0;\n        });\n      }\n    } else {\n      limitStartName = this.getLimitName_(snapshotNode, constraints, this.query_.itemLimit, true);\n      if (limitStartName) {\n        var startPriority = snapshotNode.getImmediateChild(limitStartName).getPriority();\n        constraints.push(function(name, priority) {\n          var priorityDiff = fb.core.util.priorityCompare(priority, startPriority);\n          return priorityDiff > 0 || priorityDiff === 0 && fb.core.util.nameCompare(name, limitStartName) >= 0;\n        });\n      }\n    }\n  }\n  var filteredChanges = [];\n  var addedChildren = [], movedChildren = [], changedChildren = [];\n  for (var i = 0;i < changes.length;i++) {\n    var type = changes[i].type;\n    var childName = changes[i].childName, childNode = changes[i].snapshotNode;\n    switch(type) {\n      case fb.core.view.Change.CHILD_ADDED:\n        if (this.meetsConstraints_(constraints, childName, childNode)) {\n          this.snapshotNode_ = this.snapshotNode_.updateImmediateChild(childName, childNode);\n          addedChildren.push(changes[i]);\n        }\n        break;\n      case fb.core.view.Change.CHILD_REMOVED:\n        if (!this.snapshotNode_.getImmediateChild(childName).isEmpty()) {\n          this.snapshotNode_ = this.snapshotNode_.updateImmediateChild(childName, null);\n          filteredChanges.push(changes[i]);\n        }\n        break;\n      case fb.core.view.Change.CHILD_CHANGED:\n        if (!this.snapshotNode_.getImmediateChild(childName).isEmpty() && this.meetsConstraints_(constraints, childName, childNode)) {\n          this.snapshotNode_ = this.snapshotNode_.updateImmediateChild(childName, childNode);\n          changedChildren.push(changes[i]);\n        }\n        break;\n      case fb.core.view.Change.CHILD_MOVED:\n        var wasVisible = !this.snapshotNode_.getImmediateChild(childName).isEmpty();\n        var isNowVisible = this.meetsConstraints_(constraints, childName, childNode);\n        if (wasVisible) {\n          if (isNowVisible) {\n            this.snapshotNode_ = this.snapshotNode_.updateImmediateChild(childName, childNode);\n            movedChildren.push(changes[i]);\n          } else {\n            filteredChanges.push(new fb.core.view.Change(\"child_removed\", this.snapshotNode_.getImmediateChild(childName), childName));\n            this.snapshotNode_ = this.snapshotNode_.updateImmediateChild(childName, null);\n          }\n        } else {\n          if (isNowVisible) {\n            this.snapshotNode_ = this.snapshotNode_.updateImmediateChild(childName, childNode);\n            addedChildren.push(changes[i]);\n          }\n        }\n        break;\n    }\n  }\n  var startDeletingAt = limitEndName || limitStartName;\n  if (startDeletingAt) {\n    var reverse = limitStartName !== null;\n    var startAddingAt = reverse ? this.snapshotNode_.getFirstChildName() : this.snapshotNode_.getLastChildName();\n    var traversal = reverse ? snapshotNode.forEachChildReverse : snapshotNode.forEachChild;\n    var deleting = false;\n    var adding = false;\n    var self = this;\n    traversal.call(snapshotNode, function(name, node) {\n      if (!adding && startAddingAt === null) {\n        adding = true;\n      }\n      if (adding && deleting) {\n        return true;\n      }\n      if (deleting) {\n        filteredChanges.push(new fb.core.view.Change(\"child_removed\", self.snapshotNode_.getImmediateChild(name), name));\n        self.snapshotNode_ = self.snapshotNode_.updateImmediateChild(name, null);\n      } else {\n        if (adding) {\n          addedChildren.push(new fb.core.view.Change(\"child_added\", node, name));\n          self.snapshotNode_ = self.snapshotNode_.updateImmediateChild(name, node);\n        }\n      }\n      if (startAddingAt === name) {\n        adding = true;\n      }\n      if (name === startDeletingAt) {\n        deleting = true;\n      }\n    });\n  }\n  for (i = 0;i < addedChildren.length;i++) {\n    var item = addedChildren[i];\n    var prevName = this.snapshotNode_.getPredecessorChildName(item.childName, item.snapshotNode);\n    filteredChanges.push(new fb.core.view.Change(\"child_added\", item.snapshotNode, item.childName, prevName));\n  }\n  for (i = 0;i < movedChildren.length;i++) {\n    item = movedChildren[i];\n    prevName = this.snapshotNode_.getPredecessorChildName(item.childName, item.snapshotNode);\n    filteredChanges.push(new fb.core.view.Change(\"child_moved\", item.snapshotNode, item.childName, prevName));\n  }\n  for (i = 0;i < changedChildren.length;i++) {\n    item = changedChildren[i];\n    prevName = this.snapshotNode_.getPredecessorChildName(item.childName, item.snapshotNode);\n    filteredChanges.push(new fb.core.view.Change(\"child_changed\", item.snapshotNode, item.childName, prevName));\n  }\n  if (this.isComplete_ && filteredChanges.length > 0) {\n    filteredChanges.push(new fb.core.view.Change(\"value\", this.snapshotNode_));\n  }\n  return filteredChanges;\n};\nfb.core.view.QueryView.prototype.getLimitName_ = function(snapshotNode, constraints, limit, reverse) {\n  if (snapshotNode.isLeafNode()) {\n    return null;\n  }\n  var forEachChild = reverse ? snapshotNode.forEachChildReverse : snapshotNode.forEachChild;\n  var self = this, lastChild = null;\n  forEachChild.call(snapshotNode, function(childName, child) {\n    if (self.meetsConstraints_(constraints, childName, child)) {\n      lastChild = childName;\n      limit--;\n      if (limit === 0) {\n        return true;\n      }\n    }\n  });\n  return lastChild;\n};\nfb.core.view.QueryView.prototype.meetsConstraints_ = function(constraints, childName, child) {\n  for (var i = 0;i < constraints.length;i++) {\n    if (!constraints[i](childName, child.getPriority())) {\n      return false;\n    }\n  }\n  return true;\n};\nfb.core.view.QueryView.prototype.hasChild = function(childName) {\n  return this.snapshotNode_.getImmediateChild(childName) !== fb.core.snap.EMPTY_NODE;\n};\nfb.core.view.QueryView.ENTERING_VIEW = 1;\nfb.core.view.QueryView.LEAVING_VIEW = 2;\nfb.core.view.QueryView.IN_VIEW = 3;\nfb.core.view.QueryView.OUT_OF_VIEW = 4;\nfb.core.view.QueryView.prototype.getChildRelevance = function(path, newNode, serverData) {\n  var childView = {};\n  if (!this.snapshotNode_.isLeafNode()) {\n    this.snapshotNode_.forEachChild(function(childName) {\n      childView[childName] = fb.core.view.QueryView.IN_VIEW;\n    });\n  }\n  var snapshotCopy = this.snapshotNode_;\n  var queryRoot = serverData.getNode(new fb.core.util.Path(\"\"));\n  var diffMask = new fb.core.util.Tree;\n  var queryPath = this.query_.path;\n  var querySubTree = diffMask.subTree(queryPath);\n  querySubTree.setValue(true);\n  var newSnap = fb.core.snap.EMPTY_NODE.updateChild(path, newNode);\n  var self = this;\n  var onDiff = function(path, snap, changes) {\n    if (changes !== null && path.toString() === self.query_.path.toString()) {\n      self.processChanges_(snap, changes);\n    }\n  };\n  fb.core.view.SnapshotDiffer.Diff(queryRoot, newSnap, path, diffMask, onDiff);\n  if (!this.snapshotNode_.isLeafNode()) {\n    this.snapshotNode_.forEachChild(function(childName) {\n      if (!fb.util.obj.contains(childView, childName)) {\n        childView[childName] = fb.core.view.QueryView.ENTERING_VIEW;\n      }\n    });\n    goog.object.forEach(childView, function(childState, childName) {\n      if (self.snapshotNode_.getImmediateChild(childName).isEmpty()) {\n        childView[childName] = fb.core.view.QueryView.LEAVING_VIEW;\n      }\n    });\n  } else {\n    goog.object.forEach(childView, function(childState, childName) {\n      childView[childName] = fb.core.view.QueryView.LEAVING_VIEW;\n    });\n  }\n  this.snapshotNode_ = snapshotCopy;\n  return childView;\n};\ngoog.provide(\"fb.core.ViewManager\");\ngoog.require(\"fb.core.util\");\ngoog.require(\"fb.core.view.DefaultView\");\ngoog.require(\"fb.core.view.QueryMap\");\ngoog.require(\"fb.core.view.QueryView\");\ngoog.require(\"fb.core.view.SnapshotDiffer\");\ngoog.require(\"fb.util.obj\");\nfb.core.ViewManager = function(connection, data) {\n  this.connection_ = connection;\n  this.data_ = data;\n  this.oldDataNode_ = data.rootNode_;\n  this.viewsTree_ = new fb.core.util.Tree;\n};\nfb.core.ViewManager.prototype.addEventCallbackForQuery = function(query, eventType, callback, opt_cancelCallback, opt_context) {\n  var path = query.path;\n  var viewsNode = this.viewsTree_.subTree(path);\n  var queryMap = viewsNode.getValue();\n  if (queryMap === null) {\n    queryMap = new fb.core.view.QueryMap;\n    viewsNode.setValue(queryMap);\n  } else {\n    fb.core.util.assert(!queryMap.isEmpty(), \"We shouldn't be storing empty QueryMaps\");\n  }\n  var queryId = query.queryIdentifier();\n  if (!queryMap.contains(queryId)) {\n    var snapNode = this.data_.rootNode_.getChild(path);\n    var view = this.createView_(query, snapNode);\n    this.ensureListening_(viewsNode, queryMap, queryId, view);\n    view.addEventCallback(eventType, callback, opt_cancelCallback, opt_context);\n    var isComplete = this.viewsTree_.subTree(path).forEachAncestor(function(viewsNode) {\n      if (viewsNode.getValue() && viewsNode.getValue().defaultView() && viewsNode.getValue().defaultView().isComplete()) {\n        return true;\n      }\n    }, true);\n    isComplete = isComplete || this.connection_ === null && !this.data_.getNode(path).isEmpty();\n    if (isComplete) {\n      view.markComplete();\n    }\n    view.raiseQueuedEvents();\n  } else {\n    var view = queryMap.get(queryId);\n    view.addEventCallback(eventType, callback, opt_cancelCallback, opt_context);\n    view.raiseQueuedEvents();\n  }\n};\nfb.core.ViewManager.prototype.removeCallbackForQuery_ = function(queryMap, queryId, eventType, callback, ctx) {\n  var view = queryMap.get(queryId);\n  var found = view && view.removeEventCallback(eventType, callback, ctx) && !view.hasCallbacks();\n  if (found) {\n    queryMap.remove(queryId);\n  }\n  return found;\n};\nfb.core.ViewManager.prototype.doRemoveQueries_ = function(queryMap, query, eventType, callback, ctx) {\n  var queryId = query ? query.queryIdentifier() : null;\n  var foundQueryIds = [];\n  if (queryId && queryId !== \"default\") {\n    if (this.removeCallbackForQuery_(queryMap, queryId, eventType, callback, ctx)) {\n      foundQueryIds.push(queryId);\n    }\n  } else {\n    var self = this;\n    goog.array.forEach(queryMap.keys(), function(qId) {\n      if (self.removeCallbackForQuery_(queryMap, qId, eventType, callback, ctx)) {\n        foundQueryIds.push(qId);\n      }\n    });\n  }\n  return foundQueryIds;\n};\nfb.core.ViewManager.prototype.removeEventCallbackForQuery = function(query, eventType, opt_callback, opt_context) {\n  var path = query.path;\n  var viewsNode = this.viewsTree_.subTree(path);\n  var queryMap = viewsNode.getValue();\n  if (queryMap === null) {\n    return null;\n  }\n  return this.removeQueries_(queryMap, query, eventType, opt_callback, opt_context);\n};\nfb.core.ViewManager.prototype.removeQueries_ = function(queryMap, query, eventType, callback, ctx) {\n  var path = queryMap.path();\n  var viewsNode = this.viewsTree_.subTree(path);\n  var foundQueryIds = this.doRemoveQueries_(queryMap, query, eventType, callback, ctx);\n  if (queryMap.isEmpty()) {\n    viewsNode.setValue(null);\n  }\n  var activeAncestor = this.hasActiveAncestor(viewsNode);\n  if (foundQueryIds.length > 0 && !activeAncestor) {\n    var child = viewsNode;\n    var parent = viewsNode.parent();\n    var found = false;\n    while (!found && parent) {\n      var parentQueryMap = parent.getValue();\n      if (parentQueryMap) {\n        fb.core.util.assert(!parentQueryMap.hasActiveDefaultQuery());\n        var pathSegment = child.name();\n        var relevant = false;\n        parentQueryMap.each(function(queryId, view) {\n          relevant = view.hasChild(pathSegment) || relevant;\n        });\n        if (relevant) {\n          found = true;\n        }\n      }\n      child = parent;\n      parent = parent.parent();\n    }\n    var newListenerPaths = null;\n    if (!queryMap.hasActiveDefaultQuery()) {\n      var stopListener = queryMap.removeStopListener();\n      newListenerPaths = this.collectListeners_(viewsNode, true);\n      stopListener && stopListener();\n    }\n    return found ? null : newListenerPaths;\n  } else {\n    return null;\n  }\n};\nfb.core.ViewManager.prototype.markQueriesComplete = function(path, includeSelf) {\n  var viewsNode = this.viewsTree_.subTree(path);\n  viewsNode.forEachDescendant(function(descendant) {\n    var queryMap = descendant.getValue();\n    if (queryMap) {\n      queryMap.each(function(queryId, view) {\n        view.markComplete();\n      });\n    }\n  }, includeSelf, true);\n};\nfb.core.ViewManager.prototype.raiseEventsForChange = function(changePath, completeQueryPaths) {\n  var self = this;\n  var oldNode = this.oldDataNode_;\n  var newNode = this.data_.rootNode_;\n  this.oldDataNode_ = newNode;\n  var path2Complete = {};\n  for (var i = 0;i < completeQueryPaths.length;i++) {\n    path2Complete[completeQueryPaths[i].toString()] = true;\n  }\n  var shouldMarkComplete = function(path) {\n    do {\n      if (path2Complete[path.toString()]) {\n        return true;\n      }\n      path = path.parent();\n    } while (path !== null);\n    return false;\n  };\n  var onDiff = function(path, snapNode, changes) {\n    if (changePath.contains(path)) {\n      var markQueriesComplete = shouldMarkComplete(path);\n      if (markQueriesComplete) {\n        self.markQueriesComplete(path, false);\n      }\n      self.processChanges(path, snapNode, changes);\n      if (markQueriesComplete) {\n        self.markQueriesComplete(path, true);\n      }\n    } else {\n      self.processChanges(path, snapNode, changes);\n    }\n  };\n  fb.core.view.SnapshotDiffer.Diff(oldNode, newNode, changePath, this.viewsTree_, onDiff);\n  if (shouldMarkComplete(changePath)) {\n    this.markQueriesComplete(changePath, true);\n  }\n  this.raiseQueuedEvents_(changePath);\n};\nfb.core.ViewManager.prototype.raiseQueuedEvents_ = function(path) {\n  var viewsNode = this.viewsTree_.subTree(path);\n  viewsNode.forEachDescendant(function(descendant) {\n    var queryMap = descendant.getValue();\n    if (queryMap) {\n      queryMap.each(function(queryId, view) {\n        view.raiseQueuedEvents();\n      });\n    }\n  }, true, true);\n  viewsNode.forEachAncestor(function(ancestor) {\n    var queryMap = ancestor.getValue();\n    if (queryMap) {\n      queryMap.each(function(queryId, view) {\n        view.raiseQueuedEvents();\n      });\n    }\n  }, false);\n};\nfb.core.ViewManager.prototype.processChanges = function(path, snapNode, changes) {\n  var queryMap = this.viewsTree_.subTree(path).getValue();\n  if (queryMap === null) {\n    return;\n  }\n  queryMap.each(function(queryId, view) {\n    view.processChanges(snapNode, changes);\n  });\n};\nfb.core.ViewManager.prototype.hasActiveAncestor = function(viewNode) {\n  return viewNode.forEachAncestor(function(node) {\n    return node.getValue() && node.getValue().hasActiveDefaultQuery();\n  });\n};\nfb.core.ViewManager.prototype.ensureListening_ = function(viewNode, queryMap, queryId, view) {\n  if (queryMap.hasActiveDefaultQuery() || this.hasActiveAncestor(viewNode)) {\n    queryMap.setView(queryId, view);\n  } else {\n    var currentId;\n    var currentQueries;\n    if (!queryMap.isEmpty()) {\n      currentId = queryMap.toString();\n      currentQueries = queryMap.queries();\n    }\n    queryMap.setView(queryId, view);\n    queryMap.setActive(this.startListening(queryMap));\n    if (currentId && currentQueries) {\n      this.connection_.unlisten(queryMap.path(), currentId, currentQueries);\n    }\n  }\n  if (queryMap.hasActiveDefaultQuery()) {\n    viewNode.forEachDescendant(function(node) {\n      var childQueryMap = node.getValue();\n      childQueryMap && childQueryMap.deactivate();\n    });\n  }\n};\nfb.core.ViewManager.prototype.collectListeners_ = function(viewsNode, startListeners) {\n  var newListenerPaths = [];\n  var self = this;\n  var collectRecursive = function(node) {\n    var queryMap = node.getValue();\n    if (queryMap && queryMap.hasDefaultQuery()) {\n      newListenerPaths.push(queryMap.path());\n      if (startListeners && !queryMap.isActive()) {\n        queryMap.setActive(self.startListening(queryMap));\n      }\n    } else {\n      if (startListeners && queryMap) {\n        if (!queryMap.isActive()) {\n          queryMap.setActive(self.startListening(queryMap));\n        }\n        var childSet = {};\n        queryMap.each(function(queryId, view) {\n          view.snapshotNode_.forEachChild(function(childName, child) {\n            if (!fb.util.obj.contains(childSet, childName)) {\n              childSet[childName] = true;\n              var newPath = queryMap.path().child(childName);\n              newListenerPaths.push(newPath);\n            }\n          });\n        });\n      }\n      node.forEachChild(collectRecursive);\n    }\n  };\n  collectRecursive(viewsNode);\n  return newListenerPaths;\n};\nfb.core.ViewManager.prototype.startListening = function(queryMap) {\n  if (this.connection_) {\n    var self = this;\n    var connection = this.connection_, path = queryMap.path(), qid = queryMap.toString(), queries = queryMap.queries();\n    var listenCanceled;\n    var cancelListen = function() {\n      listenCanceled = true;\n      connection.unlisten(path, qid, queries);\n    };\n    var qids = queryMap.keys();\n    var isDefault = queryMap.hasDefaultQuery();\n    this.connection_.listen(queryMap, function(status) {\n      if (status !== \"ok\") {\n        var error = fb.core.util.errorForServerCode(status);\n        fb.core.util.warn(\"on() or once() for \" + queryMap.path().toString() + \" failed: \" + error.toString());\n        self.raiseCancelEventsForQuery_(queryMap, error);\n      } else {\n        if (!listenCanceled) {\n          if (isDefault) {\n            self.markQueriesComplete(queryMap.path(), true);\n          } else {\n            goog.array.forEach(qids, function(qid) {\n              var view = queryMap.get(qid);\n              view && view.markComplete();\n            });\n          }\n          self.raiseQueuedEvents_(queryMap.path());\n        }\n      }\n    });\n    return cancelListen;\n  } else {\n    return goog.nullFunction;\n  }\n};\nfb.core.ViewManager.prototype.raiseCancelEventsForQuery_ = function(queryMap, error) {\n  if (!queryMap) {\n    return;\n  }\n  queryMap.each(function(queryId, view) {\n    view.raiseCancelEvents(error);\n  });\n  this.removeQueries_(queryMap);\n};\nfb.core.ViewManager.prototype.createView_ = function(query, snapNode) {\n  if (query.queryIdentifier() === \"default\") {\n    return new fb.core.view.DefaultView(query, snapNode);\n  } else {\n    return new fb.core.view.QueryView(query, snapNode);\n  }\n};\nfb.core.ViewManager.prototype.getChildRelevance = function(path, queryMap, newNode, mergedData) {\n  var childRelevance = {};\n  var updateChildRelevance = function(newRelevances) {\n    goog.object.forEach(newRelevances, function(viewState, childName) {\n      if (viewState === fb.core.view.QueryView.IN_VIEW) {\n        childRelevance[childName] = fb.core.view.QueryView.IN_VIEW;\n      } else {\n        var oldViewState = fb.util.obj.get(childRelevance, childName) || viewState;\n        if (oldViewState === viewState) {\n          childRelevance[childName] = viewState;\n        } else {\n          childRelevance[childName] = fb.core.view.QueryView.IN_VIEW;\n        }\n      }\n    });\n  };\n  queryMap.each(function(queryId, view) {\n    updateChildRelevance(view.getChildRelevance(path, newNode, mergedData));\n  });\n  if (!newNode.isLeafNode()) {\n    newNode.forEachChild(function(childName) {\n      if (!fb.util.obj.contains(childRelevance, childName)) {\n        childRelevance[childName] = fb.core.view.QueryView.OUT_OF_VIEW;\n      }\n    });\n  }\n  return childRelevance;\n};\nfb.core.ViewManager.prototype.getAncestorUpdate = function(path, newNode, mergedData) {\n  var childTree = this.viewsTree_.subTree(path);\n  var parentTree = childTree.parent();\n  var prunedUpdates = [];\n  while (parentTree !== null) {\n    var parentQueryMap = parentTree.getValue();\n    if (parentQueryMap !== null) {\n      if (parentQueryMap.hasDefaultQuery()) {\n        return[{path:path, node:newNode}];\n      } else {\n        var childRelevance = this.getChildRelevance(path, parentQueryMap, newNode, mergedData);\n        var viewState = fb.util.obj.get(childRelevance, childTree.name());\n        if (viewState === fb.core.view.QueryView.IN_VIEW || viewState === fb.core.view.QueryView.ENTERING_VIEW) {\n          return[{path:path, node:newNode}];\n        } else {\n          if (viewState === fb.core.view.QueryView.LEAVING_VIEW) {\n            prunedUpdates.push({path:path, node:fb.core.snap.EMPTY_NODE});\n          } else {\n          }\n        }\n      }\n    }\n    childTree = parentTree;\n    parentTree = parentTree.parent();\n  }\n  return prunedUpdates;\n};\nfb.core.ViewManager.prototype.pruneNonDefaultQuery = function(queryMap, viewNode, newNode, mergedData) {\n  var path = queryMap.path();\n  var childRelevance = this.getChildRelevance(path, queryMap, newNode, mergedData);\n  var constructed = fb.core.snap.EMPTY_NODE;\n  var childListeners = [];\n  var self = this;\n  goog.object.forEach(childRelevance, function(viewState, childName) {\n    var childPath = new fb.core.util.Path(childName);\n    if (viewState === fb.core.view.QueryView.IN_VIEW || viewState === fb.core.view.QueryView.ENTERING_VIEW) {\n      constructed = constructed.updateImmediateChild(childName, newNode.getChild(childPath));\n    } else {\n      if (viewState === fb.core.view.QueryView.LEAVING_VIEW) {\n        childListeners.push({path:path.child(childName), node:fb.core.snap.EMPTY_NODE});\n        childListeners = childListeners.concat(self.pruneObjectToListeners_(newNode.getChild(childPath), viewNode.subTree(childPath), mergedData));\n      } else {\n        childListeners = childListeners.concat(self.pruneObjectToListeners_(newNode.getChild(childPath), viewNode.subTree(childPath), mergedData));\n      }\n    }\n  });\n  return[{path:path, node:constructed}].concat(childListeners);\n};\nfb.core.ViewManager.prototype.pruneUpdateNode = function(path, newNode, mergedData) {\n  var ancestorUpdates = this.getAncestorUpdate(path, newNode, mergedData);\n  if (ancestorUpdates.length == 1) {\n    if (!ancestorUpdates[0].node.isEmpty() || newNode.isEmpty()) {\n      return ancestorUpdates;\n    }\n  }\n  var updateRoot = this.viewsTree_.subTree(path);\n  var queryMap = updateRoot.getValue();\n  if (queryMap !== null) {\n    if (queryMap.hasDefaultQuery()) {\n      ancestorUpdates.push({path:path, node:newNode});\n    } else {\n      ancestorUpdates = ancestorUpdates.concat(this.pruneNonDefaultQuery(queryMap, updateRoot, newNode, mergedData));\n    }\n  } else {\n    ancestorUpdates = ancestorUpdates.concat(this.pruneObjectToListeners_(newNode, updateRoot, mergedData));\n  }\n  return ancestorUpdates;\n};\nfb.core.ViewManager.prototype.pruneObjectToListeners_ = function(node, subTree, mergedData) {\n  var queryMap = subTree.getValue();\n  if (queryMap !== null) {\n    if (queryMap.hasDefaultQuery()) {\n      return[{path:subTree.path(), node:node}];\n    } else {\n      return this.pruneNonDefaultQuery(queryMap, subTree, node, mergedData);\n    }\n  } else {\n    var snapshots = [];\n    var self = this;\n    subTree.forEachChild(function(childTree) {\n      if (node.isLeafNode()) {\n        var childNode = fb.core.snap.EMPTY_NODE\n      } else {\n        childNode = node.getImmediateChild(childTree.name());\n      }\n      var childSnaps = self.pruneObjectToListeners_(childNode, childTree, mergedData);\n      snapshots = snapshots.concat(childSnaps);\n    });\n    return snapshots;\n  }\n};\ngoog.provide(\"fb.core.Repo\");\ngoog.require(\"fb.core.FirebaseData\");\ngoog.require(\"fb.api.DataSnapshot\");\ngoog.require(\"fb.core.FirebaseData\");\ngoog.require(\"fb.core.PersistentConnection\");\ngoog.require(\"fb.core.SparseSnapshotTree\");\ngoog.require(\"fb.core.ViewManager\");\ngoog.require(\"fb.core.stats.StatsCollection\");\ngoog.require(\"fb.core.stats.StatsListener\");\ngoog.require(\"fb.core.stats.StatsManager\");\ngoog.require(\"fb.core.stats.StatsReporter\");\ngoog.require(\"fb.core.util.ServerValues\");\ngoog.require(\"fb.core.util.Tree\");\ngoog.require(\"fb.util.json\");\ngoog.require(\"goog.string\");\nfb.core.Repo = function(repoInfo) {\n  this.repoInfo_ = repoInfo;\n  this.stats_ = fb.core.stats.StatsManager.getCollection(repoInfo);\n  this.connection_ = new fb.core.PersistentConnection(this.repoInfo_, goog.bind(this.onDataUpdate_, this), goog.bind(this.onConnectStatus_, this), goog.bind(this.onAuthStatus_, this), goog.bind(this.onServerInfoUpdate_, this), goog.bind(this.getServerDataHashForPath_, this));\n  this.statsReporter_ = fb.core.stats.StatsManager.getOrCreateReporter(repoInfo, goog.bind(function() {\n    return new fb.core.stats.StatsReporter(this.stats_, this.connection_);\n  }, this));\n  this.transactions_init_();\n  this.data_ = new fb.core.FirebaseData;\n  this.viewManager_ = new fb.core.ViewManager(this.connection_, this.data_.visibleData);\n  this.infoData_ = new fb.core.SnapshotHolder;\n  this.infoViewManager_ = new fb.core.ViewManager(null, this.infoData_);\n  this.updateInfo_(\"connected\", false);\n  this.updateInfo_(\"authenticated\", false);\n  this.onDisconnect_ = new fb.core.SparseSnapshotTree;\n  this.dataUpdateCount = 0;\n};\nfb.core.Repo.prototype.toString = function() {\n  return(this.repoInfo_.secure ? \"https://\" : \"http://\") + this.repoInfo_.host;\n};\nfb.core.Repo.prototype.name = function() {\n  return this.repoInfo_.namespace;\n};\nfb.core.Repo.prototype.serverTime = function() {\n  var offsetNode = this.infoData_.getNode(new fb.core.util.Path(\".info/serverTimeOffset\"));\n  var offset = offsetNode.val() || 0;\n  return(new Date).getTime() + offset;\n};\nfb.core.Repo.prototype.generateServerValues = function() {\n  return fb.core.util.ServerValues.generateWithValues({\"timestamp\":this.serverTime()});\n};\nfb.core.Repo.prototype.onDataUpdate_ = function(pathString, data, isMerge) {\n  this.dataUpdateCount++;\n  if (this.interceptServerDataCallback_) {\n    data = this.interceptServerDataCallback_(pathString, data);\n  }\n  var path, newNode;\n  var completePaths = [];\n  if (pathString.length >= 9 && pathString.lastIndexOf(\".priority\") === pathString.length - 9) {\n    path = new fb.core.util.Path(pathString.substring(0, pathString.length - 9));\n    newNode = this.data_.serverData.getNode(path).updatePriority(data);\n    completePaths.push(path);\n  } else {\n    if (isMerge) {\n      path = new fb.core.util.Path(pathString);\n      newNode = this.data_.serverData.getNode(path);\n      goog.object.forEach(data, function(childData, childName) {\n        var childPath = new fb.core.util.Path(childName);\n        if (childName === \".priority\") {\n          newNode = newNode.updatePriority(childData);\n        } else {\n          newNode = newNode.updateChild(childPath, fb.core.snap.NodeFromJSON(childData));\n          completePaths.push(path.child(childName));\n        }\n      });\n    } else {\n      path = new fb.core.util.Path(pathString);\n      newNode = fb.core.snap.NodeFromJSON(data);\n      completePaths.push(path);\n    }\n  }\n  var prunedNodes = this.viewManager_.pruneUpdateNode(path, newNode, this.data_.mergedData, isMerge ? data : null);\n  var changed = false;\n  for (var i = 0;i < prunedNodes.length;++i) {\n    var node = prunedNodes[i];\n    changed = this.data_.updateServerData(node.path, node.node) || changed;\n  }\n  if (changed) {\n    path = this.rerunTransactionsAndUpdateVisibleData_(path);\n  }\n  this.viewManager_.raiseEventsForChange(path, completePaths);\n};\nfb.core.Repo.prototype.interceptServerData_ = function(callback) {\n  this.interceptServerDataCallback_ = callback;\n};\nfb.core.Repo.prototype.onConnectStatus_ = function(connectStatus) {\n  this.updateInfo_(\"connected\", connectStatus);\n  if (connectStatus === false) {\n    this.runOnDisconnectEvents_();\n  }\n};\nfb.core.Repo.prototype.onServerInfoUpdate_ = function(updates) {\n  var self = this;\n  fb.core.util.each(updates, function(value, key) {\n    self.updateInfo_(key, value);\n  });\n};\nfb.core.Repo.prototype.getServerDataHashForPath_ = function(pathString) {\n  var path = new fb.core.util.Path(pathString);\n  return this.data_.serverData.getNode(path).hash();\n};\nfb.core.Repo.prototype.onAuthStatus_ = function(authStatus) {\n  this.updateInfo_(\"authenticated\", authStatus);\n};\nfb.core.Repo.prototype.updateInfo_ = function(pathString, value) {\n  var path = new fb.core.util.Path(\"/.info/\" + pathString);\n  this.infoData_.updateSnapshot(path, fb.core.snap.NodeFromJSON(value));\n  this.infoViewManager_.raiseEventsForChange(path, [path]);\n};\nfb.core.Repo.prototype.auth = function(cred, onComplete, onCancel) {\n  if (this.repoInfo_.isDemoHost()) {\n    fb.core.util.warn(\"FirebaseRef.auth() not supported on demo (*.firebaseio-demo.com) Firebases. Please use on production (*.firebaseio.com) Firebases only.\");\n  }\n  var self = this;\n  this.connection_.auth(cred, function(status, data) {\n    self.callOnCompleteCallback(onComplete, status, data);\n  }, function(cancelStatus, cancelReason) {\n    fb.core.util.warn(\"auth() was canceled: \" + cancelReason);\n    if (onCancel) {\n      var err = new Error(cancelReason);\n      err.code = cancelStatus.toUpperCase();\n      onCancel(err);\n    }\n  });\n};\nfb.core.Repo.prototype.unauth = function(onComplete) {\n  var self = this;\n  this.connection_.unauth(function(status, errorReason) {\n    self.callOnCompleteCallback(onComplete, status, errorReason);\n  });\n};\nfb.core.Repo.prototype.setWithPriority = function(path, newVal, newPriority, onComplete) {\n  this.log_(\"set\", {path:path.toString(), value:newVal, priority:newPriority});\n  var serverValues = this.generateServerValues();\n  var newNodeUnresolved = fb.core.snap.NodeFromJSON(newVal, newPriority);\n  var newNode = fb.core.util.ServerValues.resolveDeferredValueSnapshot(newNodeUnresolved, serverValues);\n  var prunedNodes = this.viewManager_.pruneUpdateNode(path, newNode, this.data_.mergedData, null);\n  var setIds = this.data_.set(path, prunedNodes);\n  var self = this;\n  this.connection_.put(path.toString(), newNodeUnresolved.val(true), function(status, errorReason) {\n    var success = status === \"ok\";\n    if (!success) {\n      fb.core.util.warn(\"set at \" + path + \" failed: \" + status);\n    }\n    self.data_.setCompleted(setIds);\n    self.data_.mergeServerAndPendingData(path);\n    var affectedPath = self.rerunTransactionsAndUpdateVisibleData_(path);\n    self.viewManager_.raiseEventsForChange(affectedPath, []);\n    self.callOnCompleteCallback(onComplete, status, errorReason);\n  });\n  var affectedPath = this.abortTransactions_(path);\n  this.rerunTransactionsAndUpdateVisibleData_(affectedPath);\n  this.viewManager_.raiseEventsForChange(affectedPath, [path]);\n};\nfb.core.Repo.prototype.update = function(path, childrenToMerge, onComplete) {\n  this.log_(\"update\", {path:path.toString(), value:childrenToMerge});\n  var updatedNode = this.data_.visibleData.getNode(path);\n  var empty = true;\n  var completePaths = [];\n  var serverValues = this.generateServerValues();\n  var setIds = [];\n  for (var childName in childrenToMerge) {\n    empty = false;\n    var newChildNodeUnresolved = fb.core.snap.NodeFromJSON(childrenToMerge[childName]);\n    var newChildNode = fb.core.util.ServerValues.resolveDeferredValueSnapshot(newChildNodeUnresolved, serverValues);\n    updatedNode = updatedNode.updateImmediateChild(childName, newChildNode);\n    var childPath = path.child(childName);\n    completePaths.push(childPath);\n    var prunedNodes = this.viewManager_.pruneUpdateNode(childPath, newChildNode, this.data_.mergedData, null);\n    setIds = setIds.concat(this.data_.set(path, prunedNodes));\n  }\n  if (empty) {\n    fb.core.util.log(\"update() called with empty data.  Don't do anything.\");\n    this.callOnCompleteCallback(onComplete, \"ok\");\n    return;\n  }\n  var self = this;\n  this.connection_.merge(path.toString(), childrenToMerge, function(status, errorReason) {\n    var success = status === \"ok\";\n    if (!success) {\n      fb.core.util.warn(\"update at \" + path + \" failed: \" + status);\n    }\n    self.data_.setCompleted(setIds);\n    self.data_.mergeServerAndPendingData(path);\n    var affectedPath = self.rerunTransactionsAndUpdateVisibleData_(path);\n    self.viewManager_.raiseEventsForChange(affectedPath, []);\n    self.callOnCompleteCallback(onComplete, status, errorReason);\n  });\n  var affectedPath = this.abortTransactions_(path);\n  this.rerunTransactionsAndUpdateVisibleData_(affectedPath);\n  self.viewManager_.raiseEventsForChange(affectedPath, completePaths);\n};\nfb.core.Repo.prototype.setPriority = function(path, priority, opt_onComplete) {\n  this.log_(\"setPriority\", {path:path.toString(), priority:priority});\n  var serverValues = this.generateServerValues();\n  var resolvedPriority = fb.core.util.ServerValues.resolveDeferredValue(priority, serverValues);\n  var newNode = this.data_.mergedData.getNode(path).updatePriority(resolvedPriority);\n  var prunedNodes = this.viewManager_.pruneUpdateNode(path, newNode, this.data_.mergedData, null);\n  var setIds = this.data_.set(path, prunedNodes);\n  var self = this;\n  this.connection_.put(path.toString() + \"/.priority\", priority, function(status, errorReason) {\n    if (status === \"permission_denied\") {\n      fb.core.util.warn(\"setPriority at \" + path + \" failed: \" + status);\n    }\n    self.data_.setCompleted(setIds);\n    self.data_.mergeServerAndPendingData(path);\n    var affectedPath = self.rerunTransactionsAndUpdateVisibleData_(path);\n    self.viewManager_.raiseEventsForChange(affectedPath, []);\n    self.callOnCompleteCallback(opt_onComplete, status, errorReason);\n  });\n  var affectedPath = this.rerunTransactionsAndUpdateVisibleData_(path);\n  self.viewManager_.raiseEventsForChange(affectedPath, []);\n};\nfb.core.Repo.prototype.runOnDisconnectEvents_ = function() {\n  this.log_(\"onDisconnectEvents\");\n  var self = this;\n  var setIds = [];\n  var serverValues = this.generateServerValues();\n  var resolvedOnDisconnectTree = fb.core.util.ServerValues.resolveDeferredValueTree(this.onDisconnect_, serverValues);\n  resolvedOnDisconnectTree.forEachTree(new fb.core.util.Path(\"\"), function(path, subtree) {\n    var prunedNodes = self.viewManager_.pruneUpdateNode(path, subtree, self.data_.mergedData, null);\n    setIds.push.apply(setIds, self.data_.set(path, prunedNodes));\n    var affectedPath = self.abortTransactions_(path);\n    self.rerunTransactionsAndUpdateVisibleData_(affectedPath);\n    self.viewManager_.raiseEventsForChange(affectedPath, [path]);\n  });\n  this.data_.setCompleted(setIds);\n  this.onDisconnect_ = new fb.core.SparseSnapshotTree;\n};\nfb.core.Repo.prototype.onDisconnectCancel = function(path, onComplete) {\n  var self = this;\n  this.connection_.onDisconnectCancel(path.toString(), function(status, errorReason) {\n    if (status === \"ok\") {\n      self.onDisconnect_.forget(path);\n    }\n    self.callOnCompleteCallback(onComplete, status, errorReason);\n  });\n};\nfb.core.Repo.prototype.onDisconnectSet = function(path, value, onComplete) {\n  var self = this;\n  var newNode = fb.core.snap.NodeFromJSON(value);\n  this.connection_.onDisconnectPut(path.toString(), newNode.val(true), function(status, errorReason) {\n    if (status === \"ok\") {\n      self.onDisconnect_.remember(path, newNode);\n    }\n    self.callOnCompleteCallback(onComplete, status, errorReason);\n  });\n};\nfb.core.Repo.prototype.onDisconnectSetWithPriority = function(path, value, priority, onComplete) {\n  var self = this;\n  var newNode = fb.core.snap.NodeFromJSON(value, priority);\n  this.connection_.onDisconnectPut(path.toString(), newNode.val(true), function(status, errorReason) {\n    if (status === \"ok\") {\n      self.onDisconnect_.remember(path, newNode);\n    }\n    self.callOnCompleteCallback(onComplete, status, errorReason);\n  });\n};\nfb.core.Repo.prototype.onDisconnectUpdate = function(path, childrenToMerge, onComplete) {\n  var empty = true;\n  for (var childName in childrenToMerge) {\n    empty = false;\n  }\n  if (empty) {\n    fb.core.util.log(\"onDisconnect().update() called with empty data.  Don't do anything.\");\n    this.callOnCompleteCallback(onComplete, \"ok\");\n    return;\n  }\n  var self = this;\n  this.connection_.onDisconnectMerge(path.toString(), childrenToMerge, function(status, errorReason) {\n    if (status === \"ok\") {\n      for (var childName in childrenToMerge) {\n        var newChildNode = fb.core.snap.NodeFromJSON(childrenToMerge[childName]);\n        self.onDisconnect_.remember(path.child(childName), newChildNode);\n      }\n    }\n    self.callOnCompleteCallback(onComplete, status, errorReason);\n  });\n};\nfb.core.Repo.prototype.logOnDisconnectDeprecatedSignature = function() {\n  this.stats_.incrementCounter(\"deprecated_on_disconnect\");\n  this.statsReporter_.includeStat(\"deprecated_on_disconnect\");\n};\nfb.core.Repo.prototype.addEventCallbackForQuery = function(query, eventType, callback, opt_cancelCallback, opt_context) {\n  if (query.path.getFront() === \".info\") {\n    this.infoViewManager_.addEventCallbackForQuery(query, eventType, callback, opt_cancelCallback, opt_context);\n  } else {\n    this.viewManager_.addEventCallbackForQuery(query, eventType, callback, opt_cancelCallback, opt_context);\n  }\n};\nfb.core.Repo.prototype.removeEventCallbackForQuery = function(query, opt_eventType, opt_callback, opt_context) {\n  if (query.path.getFront() === \".info\") {\n    this.infoViewManager_.removeEventCallbackForQuery(query, opt_eventType, opt_callback, opt_context);\n  } else {\n    var lowerBounds = this.viewManager_.removeEventCallbackForQuery(query, opt_eventType, opt_callback, opt_context);\n    if (lowerBounds !== null) {\n      var changed = this.data_.forgetPath(query.path, lowerBounds);\n      if (changed) {\n        fb.core.util.assert(this.data_.visibleData.rootNode_ === this.viewManager_.oldDataNode_, \"We should have raised any outstanding events by now.  Else, we'll blow them away.\");\n        this.data_.visibleData.updateSnapshot(query.path, this.data_.mergedData.getNode(query.path));\n        this.viewManager_.oldDataNode_ = this.data_.visibleData.rootNode_;\n      }\n    }\n  }\n};\nfb.core.Repo.prototype.interrupt = function() {\n  this.connection_.interrupt();\n};\nfb.core.Repo.prototype.resume = function() {\n  this.connection_.resume();\n};\nfb.core.Repo.prototype.stats = function(showDelta) {\n  if (typeof console === \"undefined\") {\n    return;\n  }\n  var stats;\n  if (showDelta) {\n    if (!this.statsListener_) {\n      this.statsListener_ = new fb.core.stats.StatsListener(this.stats_);\n    }\n    stats = this.statsListener_.get();\n  } else {\n    stats = this.stats_.get();\n  }\n  var longestName = goog.array.reduce(goog.object.getKeys(stats), function(previousValue, currentValue, index, array) {\n    return Math.max(currentValue.length, previousValue);\n  }, 0);\n  for (var stat in stats) {\n    var value = stats[stat];\n    for (var i = stat.length;i < longestName + 2;i++) {\n      stat += \" \";\n    }\n    console.log(stat + value);\n  }\n};\nfb.core.Repo.prototype.statsIncrementCounter = function(metric) {\n  this.stats_.incrementCounter(metric);\n  this.statsReporter_.includeStat(metric);\n};\nfb.core.Repo.prototype.log_ = function() {\n  fb.core.util.log(\"r:\" + this.connection_.id + \":\", arguments);\n};\nfb.core.Repo.prototype.callOnCompleteCallback = function(callback, status, data) {\n  if (callback) {\n    fb.core.util.exceptionGuard(function() {\n      if (status == \"ok\") {\n        callback(null, data);\n      } else {\n        var code = (status || \"error\").toUpperCase();\n        var message = code;\n        if (data) {\n          message += \": \" + data;\n        }\n        var error = new Error(message);\n        error.code = code;\n        callback(error);\n      }\n    });\n  }\n};\ngoog.provide(\"fb.core.Repo_transaction\");\ngoog.require(\"fb.core.Repo\");\nfb.core.TransactionStatus = {RUN:1, SENT:2, COMPLETED:3, SENT_NEEDS_ABORT:4, NEEDS_ABORT:5};\nfb.core.MAX_TRANSACTION_RETRIES_ = 25;\nfb.core.Repo.prototype.transactions_init_ = function() {\n  this.transactionQueueTree_ = new fb.core.util.Tree;\n  this.transactionResultData_ = new fb.core.SnapshotHolder;\n};\nfb.core.Repo.prototype.startTransaction = function(path, transactionUpdate, onComplete, applyLocally) {\n  this.log_(\"transaction on \" + path);\n  var valueCallback = function() {\n  };\n  var watchRef = new Firebase(this, path);\n  watchRef.on(\"value\", valueCallback);\n  var unwatcher = function() {\n    watchRef.off(\"value\", valueCallback);\n  };\n  var transaction = {path:path, update:transactionUpdate, onComplete:onComplete, status:null, order:fb.core.util.LUIDGenerator(), applyLocally:applyLocally, retryCount:0, unwatcher:unwatcher, abortReason:null};\n  this.pruneResultData_();\n  var newVal = transaction.update(this.transactionResultData_.getNode(path).val());\n  if (!goog.isDef(newVal)) {\n    transaction.unwatcher();\n    if (transaction.onComplete) {\n      var snapshot = this.getSnapshot_(path);\n      transaction.onComplete(null, false, snapshot);\n    }\n  } else {\n    fb.core.util.validation.validateFirebaseData(\"transaction failed: Data returned \", newVal);\n    transaction.status = fb.core.TransactionStatus.RUN;\n    var queueNode = this.transactionQueueTree_.subTree(path);\n    var nodeQueue = queueNode.getValue() || [];\n    nodeQueue.push(transaction);\n    queueNode.setValue(nodeQueue);\n    var priorityForNode;\n    if (typeof newVal === \"object\" && newVal !== null && fb.util.obj.contains(newVal, \".priority\")) {\n      priorityForNode = newVal[\".priority\"];\n    } else {\n      var currentNode = this.data_.mergedData.getNode(path);\n      priorityForNode = currentNode.getPriority();\n    }\n    var serverValues = this.generateServerValues();\n    var newNodeUnresolved = fb.core.snap.NodeFromJSON(newVal, priorityForNode);\n    var newNode = fb.core.util.ServerValues.resolveDeferredValueSnapshot(newNodeUnresolved, serverValues);\n    this.transactionResultData_.updateSnapshot(path, newNode);\n    if (transaction.applyLocally) {\n      this.data_.visibleData.updateSnapshot(path, newNode);\n      this.viewManager_.raiseEventsForChange(path, [path]);\n    }\n    this.sendReadyTransactions_();\n  }\n};\nfb.core.Repo.prototype.sendReadyTransactions_ = function(opt_node) {\n  var node = opt_node || this.transactionQueueTree_;\n  if (!opt_node) {\n    this.pruneCompletedTransactionsBelowNode_(node);\n  }\n  if (node.getValue() !== null) {\n    var queue = this.buildTransactionQueue_(node);\n    fb.core.util.assert(queue.length > 0);\n    var allRun = goog.array.every(queue, function(transaction) {\n      return transaction.status === fb.core.TransactionStatus.RUN;\n    });\n    if (allRun) {\n      this.sendTransactionQueue_(node.path(), queue);\n    }\n  } else {\n    if (node.hasChildren()) {\n      var self = this;\n      node.forEachChild(function(childNode) {\n        self.sendReadyTransactions_(childNode);\n      });\n    }\n  }\n};\nfb.core.Repo.prototype.sendTransactionQueue_ = function(path, queue) {\n  for (var i = 0;i < queue.length;i++) {\n    fb.core.util.assert(queue[i].status === fb.core.TransactionStatus.RUN, \"tryToSendTransactionQueue_: items in queue should all be run.\");\n    queue[i].status = fb.core.TransactionStatus.SENT;\n    queue[i].retryCount++;\n  }\n  var beforeHash = this.data_.mergedData.getNode(path).hash();\n  this.data_.mergedData.updateSnapshot(path, this.data_.visibleData.getNode(path));\n  var dataToSend = this.transactionResultData_.getNode(path).val(true);\n  var putId = fb.core.util.LUIDGenerator();\n  var paths = this.pathsWithLocallyAppliedChanges(queue);\n  for (i = 0;i < paths.length;i++) {\n    this.data_.pendingPuts.subTree(paths[i]).setValue(putId);\n  }\n  var self = this;\n  this.connection_.put(path.toString(), dataToSend, function(status) {\n    self.log_(\"transaction put response\", {path:path.toString(), status:status});\n    for (i = 0;i < paths.length;i++) {\n      var pendingPutTree = self.data_.pendingPuts.subTree(paths[i]);\n      var pendingPut = pendingPutTree.getValue();\n      fb.core.util.assert(pendingPut !== null, \"sendTransactionQueue_: pendingPut should not be null.\");\n      if (pendingPut === putId) {\n        pendingPutTree.setValue(null);\n        self.data_.mergedData.updateSnapshot(paths[i], self.data_.serverData.getNode(paths[i]));\n      }\n    }\n    if (status === \"ok\") {\n      var callbacks = [];\n      for (i = 0;i < queue.length;i++) {\n        queue[i].status = fb.core.TransactionStatus.COMPLETED;\n        if (queue[i].onComplete) {\n          var snapshot = self.getSnapshot_(queue[i].path);\n          callbacks.push(goog.bind(queue[i].onComplete, null, null, true, snapshot));\n        }\n        queue[i].unwatcher();\n      }\n      self.pruneCompletedTransactionsBelowNode_(self.transactionQueueTree_.subTree(path));\n      self.sendReadyTransactions_();\n      for (i = 0;i < callbacks.length;i++) {\n        fb.core.util.exceptionGuard(callbacks[i]);\n      }\n    } else {\n      if (status === \"datastale\") {\n        for (i = 0;i < queue.length;i++) {\n          if (queue[i].status === fb.core.TransactionStatus.SENT_NEEDS_ABORT) {\n            queue[i].status = fb.core.TransactionStatus.NEEDS_ABORT;\n          } else {\n            queue[i].status = fb.core.TransactionStatus.RUN;\n          }\n        }\n      } else {\n        fb.core.util.warn(\"transaction at \" + path + \" failed: \" + status);\n        for (i = 0;i < queue.length;i++) {\n          queue[i].status = fb.core.TransactionStatus.NEEDS_ABORT;\n          queue[i].abortReason = status;\n        }\n      }\n      var affectedPath = self.rerunTransactionsAndUpdateVisibleData_(path);\n      self.viewManager_.raiseEventsForChange(affectedPath, [path]);\n    }\n  }, beforeHash);\n};\nfb.core.Repo.prototype.pathsWithLocallyAppliedChanges = function(queue) {\n  var pathSet = {};\n  for (var i = 0;i < queue.length;i++) {\n    if (queue[i].applyLocally) {\n      pathSet[queue[i].path.toString()] = queue[i].path;\n    }\n  }\n  var paths = [];\n  for (var path in pathSet) {\n    paths.push(pathSet[path]);\n  }\n  return paths;\n};\nfb.core.Repo.prototype.rerunTransactionsAndUpdateVisibleData_ = function(changedPath) {\n  var rootMostTransactionNode = this.getAncestorTransactionNode_(changedPath);\n  var path = rootMostTransactionNode.path();\n  var queue = this.buildTransactionQueue_(rootMostTransactionNode);\n  this.rerunTransactionQueue_(queue, path);\n  return path;\n};\nfb.core.Repo.prototype.rerunTransactionQueue_ = function(queue, path) {\n  this.data_.visibleData.updateSnapshot(path, this.data_.mergedData.getNode(path));\n  this.transactionResultData_.updateSnapshot(path, this.data_.mergedData.getNode(path));\n  if (queue.length === 0) {\n    return;\n  }\n  var resultNode = this.data_.visibleData.getNode(path);\n  var dataToRaiseEventsForNode = resultNode;\n  var callbacks = [];\n  for (var i = 0;i < queue.length;i++) {\n    var relativePath = fb.core.util.Path.RelativePath(path, queue[i].path);\n    var abortTransaction = false, abortReason;\n    fb.core.util.assert(relativePath !== null, \"rerunTransactionsUnderNode_: relativePath should not be null.\");\n    if (queue[i].status === fb.core.TransactionStatus.NEEDS_ABORT) {\n      abortTransaction = true;\n      abortReason = queue[i].abortReason;\n    } else {\n      if (queue[i].status === fb.core.TransactionStatus.RUN) {\n        if (queue[i].retryCount >= fb.core.MAX_TRANSACTION_RETRIES_) {\n          abortTransaction = true;\n          abortReason = \"maxretry\";\n        } else {\n          var currentNode = resultNode.getChild(relativePath);\n          var newData = queue[i].update(currentNode.val());\n          if (goog.isDef(newData)) {\n            fb.core.util.validation.validateFirebaseData(\"transaction failed: Data returned \", newData);\n            var newDataNode = fb.core.snap.NodeFromJSON(newData);\n            var hasExplicitPriority = typeof newData === \"object\" && newData != null && fb.util.obj.contains(newData, \".priority\");\n            if (!hasExplicitPriority) {\n              newDataNode = newDataNode.updatePriority(currentNode.getPriority());\n            }\n            resultNode = resultNode.updateChild(relativePath, newDataNode);\n            if (queue[i].applyLocally) {\n              dataToRaiseEventsForNode = dataToRaiseEventsForNode.updateChild(relativePath, newDataNode);\n            }\n          } else {\n            abortTransaction = true;\n            abortReason = \"nodata\";\n          }\n        }\n      }\n    }\n    if (abortTransaction) {\n      queue[i].status = fb.core.TransactionStatus.COMPLETED;\n      (function(unwatcher) {\n        setTimeout(unwatcher, Math.floor(0));\n      })(queue[i].unwatcher);\n      if (queue[i].onComplete) {\n        var ref = new Firebase(this, queue[i].path);\n        var snapshot = new fb.api.DataSnapshot(resultNode.getChild(relativePath), ref);\n        if (abortReason === \"nodata\") {\n          callbacks.push(goog.bind(queue[i].onComplete, null, null, false, snapshot));\n        } else {\n          callbacks.push(goog.bind(queue[i].onComplete, null, new Error(abortReason), false, snapshot));\n        }\n      }\n    }\n  }\n  this.transactionResultData_.updateSnapshot(path, resultNode);\n  this.data_.visibleData.updateSnapshot(path, dataToRaiseEventsForNode);\n  this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);\n  for (i = 0;i < callbacks.length;i++) {\n    fb.core.util.exceptionGuard(callbacks[i]);\n  }\n  this.sendReadyTransactions_();\n};\nfb.core.Repo.prototype.getAncestorTransactionNode_ = function(path) {\n  var front;\n  var transactionNode = this.transactionQueueTree_;\n  while ((front = path.getFront()) !== null && transactionNode.getValue() === null) {\n    transactionNode = transactionNode.subTree(front);\n    path = path.popFront();\n  }\n  return transactionNode;\n};\nfb.core.Repo.prototype.buildTransactionQueue_ = function(transactionNode) {\n  var transactionQueue = [];\n  this.aggregateTransactionQueuesForNode_(transactionNode, transactionQueue);\n  transactionQueue.sort(function(a, b) {\n    return a.order - b.order;\n  });\n  return transactionQueue;\n};\nfb.core.Repo.prototype.aggregateTransactionQueuesForNode_ = function(node, queue) {\n  var nodeQueue = node.getValue();\n  if (nodeQueue !== null) {\n    for (var i = 0;i < nodeQueue.length;i++) {\n      queue.push(nodeQueue[i]);\n    }\n  }\n  var self = this;\n  node.forEachChild(function(child) {\n    self.aggregateTransactionQueuesForNode_(child, queue);\n  });\n};\nfb.core.Repo.prototype.pruneCompletedTransactionsBelowNode_ = function(node) {\n  var queue = node.getValue();\n  if (queue) {\n    var to = 0;\n    for (var from = 0;from < queue.length;from++) {\n      if (queue[from].status !== fb.core.TransactionStatus.COMPLETED) {\n        queue[to] = queue[from];\n        to++;\n      }\n    }\n    queue.length = to;\n    node.setValue(queue.length > 0 ? queue : null);\n  }\n  var self = this;\n  node.forEachChild(function(childNode) {\n    self.pruneCompletedTransactionsBelowNode_(childNode);\n  });\n};\nfb.core.Repo.prototype.abortTransactions_ = function(path) {\n  var affectedPath = this.getAncestorTransactionNode_(path).path();\n  var transactionNode = this.transactionQueueTree_.subTree(path);\n  var self = this;\n  transactionNode.forEachAncestor(function(node) {\n    self.abortTransactionsOnNode_(node);\n  });\n  this.abortTransactionsOnNode_(transactionNode);\n  transactionNode.forEachDescendant(function(node) {\n    self.abortTransactionsOnNode_(node);\n  });\n  return affectedPath;\n};\nfb.core.Repo.prototype.abortTransactionsOnNode_ = function(node) {\n  var queue = node.getValue();\n  if (queue !== null) {\n    var callbacks = [];\n    var lastSent = -1;\n    for (var i = 0;i < queue.length;i++) {\n      if (queue[i].status === fb.core.TransactionStatus.SENT_NEEDS_ABORT) {\n      } else {\n        if (queue[i].status === fb.core.TransactionStatus.SENT) {\n          fb.core.util.assert(lastSent === i - 1, \"All SENT items should be at beginning of queue.\");\n          lastSent = i;\n          queue[i].status = fb.core.TransactionStatus.SENT_NEEDS_ABORT;\n          queue[i].abortReason = \"set\";\n        } else {\n          fb.core.util.assert(queue[i].status === fb.core.TransactionStatus.RUN);\n          queue[i].unwatcher();\n          if (queue[i].onComplete) {\n            var snapshot = null;\n            callbacks.push(goog.bind(queue[i].onComplete, null, new Error(\"set\"), false, snapshot));\n          }\n        }\n      }\n    }\n    if (lastSent === -1) {\n      node.setValue(null);\n    } else {\n      queue.length = lastSent + 1;\n    }\n    for (i = 0;i < callbacks.length;i++) {\n      fb.core.util.exceptionGuard(callbacks[i]);\n    }\n  }\n};\nfb.core.Repo.prototype.getSnapshot_ = function(path) {\n  var snapshotRef = new Firebase(this, path);\n  return new fb.api.DataSnapshot(this.transactionResultData_.getNode(path), snapshotRef);\n};\nfb.core.Repo.prototype.pruneResultData_ = function() {\n  this.transactionResultData_.rootNode_ = this.pruneResultDataHelper_(this.transactionResultData_.rootNode_, this.data_.mergedData.rootNode_, this.transactionQueueTree_);\n};\nfb.core.Repo.prototype.pruneResultDataHelper_ = function(resultDataNode, mergedDataNode, transactionTree) {\n  var self = this;\n  if (transactionTree.isEmpty()) {\n    return mergedDataNode;\n  } else {\n    if (transactionTree.getValue() != null) {\n      return resultDataNode;\n    } else {\n      var newResultDataNode = mergedDataNode;\n      transactionTree.forEachChild(function(childTransactionNode) {\n        var childName = childTransactionNode.name();\n        var childPath = new fb.core.util.Path(childName);\n        var prunedChildNode = self.pruneResultDataHelper_(resultDataNode.getChild(childPath), mergedDataNode.getChild(childPath), childTransactionNode);\n        newResultDataNode = newResultDataNode.updateImmediateChild(childName, prunedChildNode);\n      });\n      return newResultDataNode;\n    }\n  }\n};\ngoog.provide(\"fb.core.RepoManager\");\ngoog.require(\"fb.core.Repo\");\ngoog.require(\"fb.core.Repo_transaction\");\ngoog.require(\"fb.util.obj\");\nfb.core.RepoManager = function() {\n  this.repos_ = {};\n};\ngoog.addSingletonGetter(fb.core.RepoManager);\nfb.core.RepoManager.prototype.interrupt = function() {\n  for (var repo in this.repos_) {\n    this.repos_[repo].interrupt();\n  }\n};\ngoog.exportProperty(fb.core.RepoManager.prototype, \"interrupt\", fb.core.RepoManager.prototype.interrupt);\nfb.core.RepoManager.prototype.resume = function() {\n  for (var repo in this.repos_) {\n    this.repos_[repo].resume();\n  }\n};\ngoog.exportProperty(fb.core.RepoManager.prototype, \"resume\", fb.core.RepoManager.prototype.resume);\nfb.core.RepoManager.prototype.getRepo = function(repoInfo) {\n  var repoHashString = repoInfo.toString();\n  var repo = fb.util.obj.get(this.repos_, repoHashString);\n  if (!repo) {\n    repo = new fb.core.Repo(repoInfo);\n    this.repos_[repoHashString] = repo;\n  }\n  return repo;\n};\ngoog.provide(\"fb.api.INTERNAL\");\ngoog.require(\"fb.core.PersistentConnection\");\ngoog.require(\"fb.realtime.Connection\");\nfb.api.INTERNAL = {};\nfb.api.INTERNAL.hijackHash = function(newHash) {\n  var oldChildrenHash = fb.core.snap.ChildrenNode.prototype.hash;\n  fb.core.snap.ChildrenNode.prototype.hash = newHash;\n  var oldLeafHash = fb.core.snap.LeafNode.prototype.hash;\n  fb.core.snap.LeafNode.prototype.hash = newHash;\n  return function() {\n    fb.core.snap.ChildrenNode.prototype.hash = oldChildrenHash;\n    fb.core.snap.LeafNode.prototype.hash = oldLeafHash;\n  };\n};\ngoog.exportProperty(fb.api.INTERNAL, \"hijackHash\", fb.api.INTERNAL.hijackHash);\nfb.api.INTERNAL.queryIdentifier = function(query) {\n  return query.queryIdentifier();\n};\ngoog.exportProperty(fb.api.INTERNAL, \"queryIdentifier\", fb.api.INTERNAL.queryIdentifier);\nfb.api.INTERNAL.listens = function(firebaseRef) {\n  return firebaseRef.repo.connection_.listens_;\n};\ngoog.exportProperty(fb.api.INTERNAL, \"listens\", fb.api.INTERNAL.listens);\nfb.api.INTERNAL.refConnection = function(firebaseRef) {\n  return firebaseRef.repo.connection_.realtime_;\n};\ngoog.exportProperty(fb.api.INTERNAL, \"refConnection\", fb.api.INTERNAL.refConnection);\nfb.api.INTERNAL.DataConnection = fb.core.PersistentConnection;\ngoog.exportProperty(fb.api.INTERNAL, \"DataConnection\", fb.api.INTERNAL.DataConnection);\ngoog.exportProperty(fb.core.PersistentConnection.prototype, \"sendRequest\", fb.core.PersistentConnection.prototype.sendRequest_);\ngoog.exportProperty(fb.core.PersistentConnection.prototype, \"interrupt\", fb.core.PersistentConnection.prototype.interrupt);\nfb.api.INTERNAL.RealTimeConnection = fb.realtime.Connection;\ngoog.exportProperty(fb.api.INTERNAL, \"RealTimeConnection\", fb.api.INTERNAL.RealTimeConnection);\ngoog.exportProperty(fb.realtime.Connection.prototype, \"sendRequest\", fb.realtime.Connection.prototype.sendRequest);\ngoog.exportProperty(fb.realtime.Connection.prototype, \"close\", fb.realtime.Connection.prototype.close);\nfb.api.INTERNAL.ConnectionTarget = fb.core.RepoInfo;\ngoog.exportProperty(fb.api.INTERNAL, \"ConnectionTarget\", fb.api.INTERNAL.ConnectionTarget);\nfb.api.INTERNAL.forceLongPolling = function() {\n  fb.realtime.WebSocketConnection.forceDisallow();\n  fb.realtime.BrowserPollConnection.forceAllow();\n};\ngoog.exportProperty(fb.api.INTERNAL, \"forceLongPolling\", fb.api.INTERNAL.forceLongPolling);\nfb.api.INTERNAL.forceWebSockets = function() {\n  fb.realtime.BrowserPollConnection.forceDisallow();\n};\ngoog.exportProperty(fb.api.INTERNAL, \"forceWebSockets\", fb.api.INTERNAL.forceWebSockets);\nfb.api.INTERNAL.setSecurityDebugCallback = function(ref, callback) {\n  ref.repo.connection_.securityDebugCallback_ = callback;\n};\ngoog.exportProperty(fb.api.INTERNAL, \"setSecurityDebugCallback\", fb.api.INTERNAL.setSecurityDebugCallback);\nfb.api.INTERNAL.stats = function(ref, showDelta) {\n  ref.repo.stats(showDelta);\n};\ngoog.exportProperty(fb.api.INTERNAL, \"stats\", fb.api.INTERNAL.stats);\nfb.api.INTERNAL.statsIncrementCounter = function(ref, metric) {\n  ref.repo.statsIncrementCounter(metric);\n};\ngoog.exportProperty(fb.api.INTERNAL, \"statsIncrementCounter\", fb.api.INTERNAL.statsIncrementCounter);\nfb.api.INTERNAL.dataUpdateCount = function(ref) {\n  return ref.repo.dataUpdateCount;\n};\ngoog.exportProperty(fb.api.INTERNAL, \"dataUpdateCount\", fb.api.INTERNAL.dataUpdateCount);\nfb.api.INTERNAL.interceptServerData = function(ref, callback) {\n  return ref.repo.interceptServerData_(callback);\n};\ngoog.exportProperty(fb.api.INTERNAL, \"interceptServerData\", fb.api.INTERNAL.interceptServerData);\ngoog.provide(\"fb.api.OnDisconnect\");\ngoog.require(\"fb.constants\");\ngoog.require(\"fb.core.Repo\");\ngoog.require(\"fb.core.util.validation\");\ngoog.require(\"fb.util.validation\");\nfb.api.OnDisconnect = function(repo, path, name) {\n  this.repo_ = repo;\n  this.path_ = path;\n  this.name_ = name;\n};\nfb.api.OnDisconnect.prototype.cancel = function(opt_onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.onDisconnect().cancel\", 0, 1, arguments.length);\n  fb.util.validation.validateCallback(\"Firebase.onDisconnect().cancel\", 1, opt_onComplete, true);\n  this.repo_.onDisconnectCancel(this.path_, opt_onComplete);\n};\ngoog.exportProperty(fb.api.OnDisconnect.prototype, \"cancel\", fb.api.OnDisconnect.prototype.cancel);\nfb.api.OnDisconnect.prototype.remove = function(opt_onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.onDisconnect().remove\", 0, 1, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.onDisconnect().remove\", this.path_);\n  fb.util.validation.validateCallback(\"Firebase.onDisconnect().remove\", 1, opt_onComplete, true);\n  this.repo_.onDisconnectSet(this.path_, null, opt_onComplete);\n};\ngoog.exportProperty(fb.api.OnDisconnect.prototype, \"remove\", fb.api.OnDisconnect.prototype.remove);\nfb.api.OnDisconnect.prototype.set = function(value, opt_onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.onDisconnect().set\", 1, 2, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.onDisconnect().set\", this.path_);\n  fb.core.util.validation.validateFirebaseDataArg(\"Firebase.onDisconnect().set\", 1, value, false);\n  fb.util.validation.validateCallback(\"Firebase.onDisconnect().set\", 2, opt_onComplete, true);\n  this.repo_.onDisconnectSet(this.path_, value, opt_onComplete);\n};\ngoog.exportProperty(fb.api.OnDisconnect.prototype, \"set\", fb.api.OnDisconnect.prototype.set);\nfb.api.OnDisconnect.prototype.setWithPriority = function(value, priority, opt_onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.onDisconnect().setWithPriority\", 2, 3, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.onDisconnect().setWithPriority\", this.path_);\n  fb.core.util.validation.validateFirebaseDataArg(\"Firebase.onDisconnect().setWithPriority\", 1, value, false);\n  fb.core.util.validation.validatePriority(\"Firebase.onDisconnect().setWithPriority\", 2, priority, false);\n  fb.util.validation.validateCallback(\"Firebase.onDisconnect().setWithPriority\", 3, opt_onComplete, true);\n  if (this.name_ === \".length\" || this.name_ === \".keys\") {\n    throw \"Firebase.onDisconnect().setWithPriority failed: \" + this.name_ + \" is a read-only object.\";\n  }\n  this.repo_.onDisconnectSetWithPriority(this.path_, value, priority, opt_onComplete);\n};\ngoog.exportProperty(fb.api.OnDisconnect.prototype, \"setWithPriority\", fb.api.OnDisconnect.prototype.setWithPriority);\nfb.api.OnDisconnect.prototype.update = function(objectToMerge, opt_onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.onDisconnect().update\", 1, 2, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.onDisconnect().update\", this.path_);\n  if (goog.isArray(objectToMerge)) {\n    var newObjectToMerge = {};\n    for (var i = 0;i < objectToMerge.length;++i) {\n      newObjectToMerge[\"\" + i] = objectToMerge[i];\n    }\n    objectToMerge = newObjectToMerge;\n    fb.core.util.warn(\"Passing an Array to Firebase.onDisconnect().update() is deprecated. Use set() if you want to overwrite the \" + \"existing data, or an Object with integer keys if you really do want to only update some of the children.\");\n  }\n  fb.core.util.validation.validateFirebaseObjectDataArg(\"Firebase.onDisconnect().update\", 1, objectToMerge, false);\n  fb.util.validation.validateCallback(\"Firebase.onDisconnect().update\", 2, opt_onComplete, true);\n  this.repo_.onDisconnectUpdate(this.path_, objectToMerge, opt_onComplete);\n};\ngoog.exportProperty(fb.api.OnDisconnect.prototype, \"update\", fb.api.OnDisconnect.prototype.update);\ngoog.provide(\"fb.core.util.NextPushId\");\ngoog.require(\"fb.core.util\");\nfb.core.util.NextPushId = function() {\n  var PUSH_CHARS = \"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\";\n  var lastPushTime = 0;\n  var lastRandChars = [];\n  return function(now) {\n    var duplicateTime = now === lastPushTime;\n    lastPushTime = now;\n    var timeStampChars = new Array(8);\n    for (var i = 7;i >= 0;i--) {\n      timeStampChars[i] = PUSH_CHARS.charAt(now % 64);\n      now = Math.floor(now / 64);\n    }\n    fb.core.util.assert(now === 0, \"Cannot push at time == 0\");\n    var id = timeStampChars.join(\"\");\n    if (!duplicateTime) {\n      for (i = 0;i < 12;i++) {\n        lastRandChars[i] = Math.floor(Math.random() * 64);\n      }\n    } else {\n      for (i = 11;i >= 0 && lastRandChars[i] === 63;i--) {\n        lastRandChars[i] = 0;\n      }\n      lastRandChars[i]++;\n    }\n    for (i = 0;i < 12;i++) {\n      id += PUSH_CHARS.charAt(lastRandChars[i]);\n    }\n    fb.core.util.assert(id.length === 20, \"NextPushId: Length should be 20.\");\n    return id;\n  };\n}();\ngoog.provide(\"Firebase\");\ngoog.require(\"fb.api.INTERNAL\");\ngoog.require(\"fb.api.OnDisconnect\");\ngoog.require(\"fb.api.Query\");\ngoog.require(\"fb.constants\");\ngoog.require(\"fb.core.Repo\");\ngoog.require(\"fb.core.RepoManager\");\ngoog.require(\"fb.core.storage\");\ngoog.require(\"fb.core.util\");\ngoog.require(\"fb.core.util.NextPushId\");\ngoog.require(\"fb.core.util.validation\");\ngoog.require(\"goog.string\");\nFirebase = function(urlOrRepo, pathOrContext) {\n  var repo, path;\n  if (urlOrRepo instanceof fb.core.Repo) {\n    repo = urlOrRepo;\n    path = pathOrContext;\n  } else {\n    fb.util.validation.validateArgCount(\"new Firebase\", 1, 2, arguments.length);\n    var parsedUrl = fb.core.util.parseURL(arguments[0]);\n    fb.core.util.validation.validateUrl(\"new Firebase\", 1, parsedUrl);\n    if (pathOrContext) {\n      if (pathOrContext instanceof fb.core.RepoManager) {\n        var repoManager = (pathOrContext)\n      } else {\n        throw new Error(\"Expected a valid Firebase.Context for second argument to new Firebase()\");\n      }\n    } else {\n      repoManager = fb.core.RepoManager.getInstance();\n    }\n    repo = repoManager.getRepo(parsedUrl.repoInfo);\n    path = parsedUrl.path;\n  }\n  fb.api.Query.call(this, repo, path);\n};\ngoog.inherits(Firebase, fb.api.Query);\nif (NODE_CLIENT) {\n  module[\"exports\"] = Firebase;\n}\nFirebase.prototype.name = function() {\n  fb.util.validation.validateArgCount(\"Firebase.name\", 0, 0, arguments.length);\n  if (this.path.isEmpty()) {\n    return null;\n  } else {\n    return this.path.getBack();\n  }\n};\nFirebase.prototype.child = function(pathString) {\n  fb.util.validation.validateArgCount(\"Firebase.child\", 1, 1, arguments.length);\n  if (goog.isNumber(pathString)) {\n    pathString = String(pathString);\n  } else {\n    if (!(pathString instanceof fb.core.util.Path)) {\n      if (this.path.getFront() === null) {\n        fb.core.util.validation.validateRootPathString(\"Firebase.child\", 1, pathString, false);\n      } else {\n        fb.core.util.validation.validatePathString(\"Firebase.child\", 1, pathString, false);\n      }\n    }\n  }\n  return new Firebase(this.repo, this.path.child(pathString));\n};\nFirebase.prototype.parent = function() {\n  fb.util.validation.validateArgCount(\"Firebase.parent\", 0, 0, arguments.length);\n  var parentPath = this.path.parent();\n  return parentPath === null ? null : new Firebase(this.repo, parentPath);\n};\nFirebase.prototype.root = function() {\n  fb.util.validation.validateArgCount(\"Firebase.ref\", 0, 0, arguments.length);\n  var ref = this;\n  while (ref.parent() !== null) {\n    ref = ref.parent();\n  }\n  return ref;\n};\nFirebase.prototype.toString = function() {\n  fb.util.validation.validateArgCount(\"Firebase.toString\", 0, 0, arguments.length);\n  if (this.parent() === null) {\n    return this.repo.toString();\n  } else {\n    return this.parent().toString() + \"/\" + goog.string.urlEncode(this.name());\n  }\n};\nFirebase.prototype.set = function(newVal, onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.set\", 1, 2, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.set\", this.path);\n  fb.core.util.validation.validateFirebaseDataArg(\"Firebase.set\", 1, newVal, false);\n  fb.util.validation.validateCallback(\"Firebase.set\", 2, onComplete, true);\n  this.repo.setWithPriority(this.path, newVal, null, onComplete);\n};\nFirebase.prototype.update = function(objectToMerge, onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.update\", 1, 2, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.update\", this.path);\n  if (goog.isArray(objectToMerge)) {\n    var newObjectToMerge = {};\n    for (var i = 0;i < objectToMerge.length;++i) {\n      newObjectToMerge[\"\" + i] = objectToMerge[i];\n    }\n    objectToMerge = newObjectToMerge;\n    fb.core.util.warn(\"Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or \" + \"an Object with integer keys if you really do want to only update some of the children.\");\n  }\n  fb.core.util.validation.validateFirebaseObjectDataArg(\"Firebase.update\", 1, objectToMerge, false);\n  fb.util.validation.validateCallback(\"Firebase.update\", 2, onComplete, true);\n  if (fb.util.obj.contains(objectToMerge, \".priority\")) {\n    throw new Error(\"update() does not currently support updating .priority.\");\n  }\n  this.repo.update(this.path, objectToMerge, onComplete);\n};\nFirebase.prototype.setWithPriority = function(newVal, newPriority, onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.setWithPriority\", 2, 3, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.setWithPriority\", this.path);\n  fb.core.util.validation.validateFirebaseDataArg(\"Firebase.setWithPriority\", 1, newVal, false);\n  fb.core.util.validation.validatePriority(\"Firebase.setWithPriority\", 2, newPriority, false);\n  fb.util.validation.validateCallback(\"Firebase.setWithPriority\", 3, onComplete, true);\n  if (this.name() === \".length\" || this.name() === \".keys\") {\n    throw \"Firebase.setWithPriority failed: \" + this.name() + \" is a read-only object.\";\n  }\n  this.repo.setWithPriority(this.path, newVal, newPriority, onComplete);\n};\nFirebase.prototype.remove = function(onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.remove\", 0, 1, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.remove\", this.path);\n  fb.util.validation.validateCallback(\"Firebase.remove\", 1, onComplete, true);\n  this.set(null, onComplete);\n};\nFirebase.prototype.transaction = function(transactionUpdate, onComplete, applyLocally) {\n  fb.util.validation.validateArgCount(\"Firebase.transaction\", 1, 3, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.transaction\", this.path);\n  fb.util.validation.validateCallback(\"Firebase.transaction\", 1, transactionUpdate, false);\n  fb.util.validation.validateCallback(\"Firebase.transaction\", 2, onComplete, true);\n  fb.core.util.validation.validateBoolean(\"Firebase.transaction\", 3, applyLocally, true);\n  if (this.name() === \".length\" || this.name() === \".keys\") {\n    throw \"Firebase.transaction failed: \" + this.name() + \" is a read-only object.\";\n  }\n  if (typeof applyLocally === \"undefined\") {\n    applyLocally = true;\n  }\n  this.repo.startTransaction(this.path, transactionUpdate, onComplete, applyLocally);\n};\nFirebase.prototype.setPriority = function(priority, opt_onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.setPriority\", 1, 2, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.setPriority\", this.path);\n  fb.core.util.validation.validatePriority(\"Firebase.setPriority\", 1, priority, false);\n  fb.util.validation.validateCallback(\"Firebase.setPriority\", 2, opt_onComplete, true);\n  this.repo.setPriority(this.path, priority, opt_onComplete);\n};\nFirebase.prototype.push = function(value, onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.push\", 0, 2, arguments.length);\n  fb.core.util.validation.validateWritablePath(\"Firebase.push\", this.path);\n  fb.core.util.validation.validateFirebaseDataArg(\"Firebase.push\", 1, value, true);\n  fb.util.validation.validateCallback(\"Firebase.push\", 2, onComplete, true);\n  var now = this.repo.serverTime();\n  var name = fb.core.util.NextPushId(now);\n  var pushedRef = this.child(name);\n  if (typeof value !== \"undefined\" && value !== null) {\n    pushedRef.set(value, onComplete);\n  }\n  return pushedRef;\n};\nFirebase.prototype.onDisconnect = function() {\n  return new fb.api.OnDisconnect(this.repo, this.path, this.name());\n};\nFirebase.prototype.removeOnDisconnect = function() {\n  fb.core.util.warn(\"FirebaseRef.removeOnDisconnect() being deprecated. \" + \"Please use FirebaseRef.onDisconnect().remove() instead.\");\n  this.onDisconnect().remove();\n  this.repo.logOnDisconnectDeprecatedSignature();\n};\nFirebase.prototype.setOnDisconnect = function(value) {\n  fb.core.util.warn(\"FirebaseRef.setOnDisconnect(value) being deprecated. \" + \"Please use FirebaseRef.onDisconnect().set(value) instead.\");\n  this.onDisconnect().set(value);\n  this.repo.logOnDisconnectDeprecatedSignature();\n};\nFirebase.prototype.auth = function(cred, onComplete, onCancel) {\n  fb.util.validation.validateArgCount(\"Firebase.auth\", 1, 3, arguments.length);\n  fb.core.util.validation.validateCredential(\"Firebase.auth\", 1, cred, false);\n  fb.util.validation.validateCallback(\"Firebase.auth\", 2, onComplete, true);\n  fb.util.validation.validateCallback(\"Firebase.auth\", 3, onComplete, true);\n  this.repo.auth(cred, onComplete, onCancel);\n};\nFirebase.prototype.unauth = function(onComplete) {\n  fb.util.validation.validateArgCount(\"Firebase.unauth\", 0, 1, arguments.length);\n  fb.util.validation.validateCallback(\"Firebase.unauth\", 1, onComplete, true);\n  this.repo.unauth(onComplete);\n};\nFirebase.goOffline = function() {\n  fb.util.validation.validateArgCount(\"Firebase.goOffline\", 0, 0, arguments.length);\n  fb.core.RepoManager.getInstance().interrupt();\n};\nFirebase.goOnline = function() {\n  fb.util.validation.validateArgCount(\"Firebase.goOnline\", 0, 0, arguments.length);\n  fb.core.RepoManager.getInstance().resume();\n};\nFirebase.enableLogging = function(logger, persistent) {\n  fb.core.util.assert(!persistent || (logger === true || logger === false), \"Can't turn on custom loggers persistently.\");\n  if (logger === true) {\n    if (typeof console !== \"undefined\") {\n      if (typeof console.log === \"function\") {\n        fb.core.util.logger = goog.bind(console.log, console);\n      } else {\n        if (typeof console.log === \"object\") {\n          fb.core.util.logger = function(message) {\n            console.log(message);\n          };\n        }\n      }\n    }\n    if (persistent) {\n      fb.core.storage.SessionStorage.set(\"logging_enabled\", true);\n    }\n  } else {\n    if (logger) {\n      fb.core.util.logger = logger;\n    } else {\n      fb.core.util.logger = null;\n      fb.core.storage.SessionStorage.remove(\"logging_enabled\");\n    }\n  }\n};\nFirebase.ServerValue = {\"TIMESTAMP\":{\".sv\":\"timestamp\"}};\nFirebase.SDK_VERSION = CLIENT_VERSION;\nFirebase.INTERNAL = fb.api.INTERNAL;\nFirebase.Context = fb.core.RepoManager;\n; Firebase.SDK_VERSION='1.0.21';\n"
  },
  {
    "path": "www/lib/firebase/firebase.js",
    "content": "/* Firebase v1.0.21 */ (function() {var h,aa=this;function n(a){return void 0!==a}function ba(){}function ca(a){a.sb=function(){return a.md?a.md:a.md=new a}}\nfunction da(a){var b=typeof a;if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[object Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";\nelse if(\"function\"==b&&\"undefined\"==typeof a.call)return\"object\";return b}function ea(a){return\"array\"==da(a)}function fa(a){var b=da(a);return\"array\"==b||\"object\"==b&&\"number\"==typeof a.length}function q(a){return\"string\"==typeof a}function ga(a){return\"number\"==typeof a}function ha(a){var b=typeof a;return\"object\"==b&&null!=a||\"function\"==b}function ia(a,b,c){return a.call.apply(a.bind,arguments)}\nfunction ja(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function r(a,b,c){r=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf(\"native code\")?ia:ja;return r.apply(null,arguments)}\nfunction ka(a,b){function c(){}c.prototype=b.prototype;a.me=b.prototype;a.prototype=new c;a.ke=function(a,c,f){return b.prototype[c].apply(a,Array.prototype.slice.call(arguments,2))}};function la(a){a=String(a);if(/^\\s*$/.test(a)?0:/^[\\],:{}\\s\\u2028\\u2029]*$/.test(a.replace(/\\\\[\"\\\\\\/bfnrtu]/g,\"@\").replace(/\"[^\"\\\\\\n\\r\\u2028\\u2029\\x00-\\x08\\x0a-\\x1f]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,\"]\").replace(/(?:^|:|,)(?:[\\s\\u2028\\u2029]*\\[)+/g,\"\")))try{return eval(\"(\"+a+\")\")}catch(b){}throw Error(\"Invalid JSON string: \"+a);}function ma(){this.pc=void 0}\nfunction na(a,b,c){switch(typeof b){case \"string\":oa(b,c);break;case \"number\":c.push(isFinite(b)&&!isNaN(b)?b:\"null\");break;case \"boolean\":c.push(b);break;case \"undefined\":c.push(\"null\");break;case \"object\":if(null==b){c.push(\"null\");break}if(ea(b)){var d=b.length;c.push(\"[\");for(var e=\"\",f=0;f<d;f++)c.push(e),e=b[f],na(a,a.pc?a.pc.call(b,String(f),e):e,c),e=\",\";c.push(\"]\");break}c.push(\"{\");d=\"\";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],\"function\"!=typeof e&&(c.push(d),oa(f,c),\nc.push(\":\"),na(a,a.pc?a.pc.call(b,f,e):e,c),d=\",\"));c.push(\"}\");break;case \"function\":break;default:throw Error(\"Unknown type: \"+typeof b);}}var pa={'\"':'\\\\\"',\"\\\\\":\"\\\\\\\\\",\"/\":\"\\\\/\",\"\\b\":\"\\\\b\",\"\\f\":\"\\\\f\",\"\\n\":\"\\\\n\",\"\\r\":\"\\\\r\",\"\\t\":\"\\\\t\",\"\\x0B\":\"\\\\u000b\"},qa=/\\uffff/.test(\"\\uffff\")?/[\\\\\\\"\\x00-\\x1f\\x7f-\\uffff]/g:/[\\\\\\\"\\x00-\\x1f\\x7f-\\xff]/g;\nfunction oa(a,b){b.push('\"',a.replace(qa,function(a){if(a in pa)return pa[a];var b=a.charCodeAt(0),e=\"\\\\u\";16>b?e+=\"000\":256>b?e+=\"00\":4096>b&&(e+=\"0\");return pa[a]=e+b.toString(16)}),'\"')};function ra(a){return\"undefined\"!==typeof JSON&&n(JSON.parse)?JSON.parse(a):la(a)}function u(a){if(\"undefined\"!==typeof JSON&&n(JSON.stringify))a=JSON.stringify(a);else{var b=[];na(new ma,a,b);a=b.join(\"\")}return a};function sa(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);55296<=e&&56319>=e&&(e-=55296,d++,v(d<a.length,\"Surrogate pair missing trail surrogate.\"),e=65536+(e<<10)+(a.charCodeAt(d)-56320));128>e?b[c++]=e:(2048>e?b[c++]=e>>6|192:(65536>e?b[c++]=e>>12|224:(b[c++]=e>>18|240,b[c++]=e>>12&63|128),b[c++]=e>>6&63|128),b[c++]=e&63|128)}return b};var ta={};function x(a,b,c,d){var e;d<b?e=\"at least \"+b:d>c&&(e=0===c?\"none\":\"no more than \"+c);if(e)throw Error(a+\" failed: Was called with \"+d+(1===d?\" argument.\":\" arguments.\")+\" Expects \"+e+\".\");}\nfunction y(a,b,c){var d=\"\";switch(b){case 1:d=c?\"first\":\"First\";break;case 2:d=c?\"second\":\"Second\";break;case 3:d=c?\"third\":\"Third\";break;case 4:d=c?\"fourth\":\"Fourth\";break;default:ua.assert(!1,\"errorPrefix_ called with argumentNumber > 4.  Need to update it?\")}return a=a+\" failed: \"+(d+\" argument \")}function z(a,b,c,d){if((!d||n(c))&&\"function\"!=da(c))throw Error(y(a,b,d)+\"must be a valid function.\");}\nfunction va(a,b,c){if(n(c)&&(!ha(c)||null===c))throw Error(y(a,b,!0)+\"must be a valid context object.\");};function A(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function wa(a,b){if(Object.prototype.hasOwnProperty.call(a,b))return a[b]};var ua={},xa=/[\\[\\].#$\\/\\u0000-\\u001F\\u007F]/,ya=/[\\[\\].#$\\u0000-\\u001F\\u007F]/;function za(a){return q(a)&&0!==a.length&&!xa.test(a)}function Aa(a,b,c){c&&!n(b)||Ba(y(a,1,c),b)}\nfunction Ba(a,b,c,d){c||(c=0);d=d||[];if(!n(b))throw Error(a+\"contains undefined\"+Ca(d));if(\"function\"==da(b))throw Error(a+\"contains a function\"+Ca(d)+\" with contents: \"+b.toString());if(Da(b))throw Error(a+\"contains \"+b.toString()+Ca(d));if(1E3<c)throw new TypeError(a+\"contains a cyclic object value (\"+d.slice(0,100).join(\".\")+\"...)\");if(q(b)&&b.length>10485760/3&&10485760<sa(b).length)throw Error(a+\"contains a string greater than 10485760 utf8 bytes\"+Ca(d)+\" ('\"+b.substring(0,50)+\"...')\");if(ha(b))for(var e in b)if(A(b,\ne)){var f=b[e];if(\".priority\"!==e&&\".value\"!==e&&\".sv\"!==e&&!za(e))throw Error(a+\" contains an invalid key (\"+e+\")\"+Ca(d)+'.  Keys must be non-empty strings and can\\'t contain \".\", \"#\", \"$\", \"/\", \"[\", or \"]\"');d.push(e);Ba(a,f,c+1,d);d.pop()}}function Ca(a){return 0==a.length?\"\":\" in property '\"+a.join(\".\")+\"'\"}function Ea(a,b){if(!ha(b)||ea(b))throw Error(y(a,1,!1)+\" must be an Object containing the children to replace.\");Aa(a,b,!1)}\nfunction Fa(a,b,c,d){if(!(d&&!n(c)||null===c||ga(c)||q(c)||ha(c)&&A(c,\".sv\")))throw Error(y(a,b,d)+\"must be a valid firebase priority (a string, number, or null).\");}function Ga(a,b,c){if(!c||n(b))switch(b){case \"value\":case \"child_added\":case \"child_removed\":case \"child_changed\":case \"child_moved\":break;default:throw Error(y(a,1,c)+'must be a valid event type: \"value\", \"child_added\", \"child_removed\", \"child_changed\", or \"child_moved\".');}}\nfunction Ha(a,b){if(n(b)&&!za(b))throw Error(y(a,2,!0)+'was an invalid key: \"'+b+'\".  Firebase keys must be non-empty strings and can\\'t contain \".\", \"#\", \"$\", \"/\", \"[\", or \"]\").');}function Ia(a,b){if(!q(b)||0===b.length||ya.test(b))throw Error(y(a,1,!1)+'was an invalid path: \"'+b+'\". Paths must be non-empty strings and can\\'t contain \".\", \"#\", \"$\", \"[\", or \"]\"');}function B(a,b){if(\".info\"===C(b))throw Error(a+\" failed: Can't modify data under /.info/\");};function D(a,b,c,d,e,f,g){this.m=a;this.path=b;this.Ca=c;this.da=d;this.wa=e;this.Aa=f;this.Ya=g;if(n(this.da)&&n(this.Aa)&&n(this.Ca))throw\"Query: Can't combine startAt(), endAt(), and limit().\";}D.prototype.Uc=function(){x(\"Query.ref\",0,0,arguments.length);return new E(this.m,this.path)};D.prototype.ref=D.prototype.Uc;\nD.prototype.fb=function(a,b){x(\"Query.on\",2,4,arguments.length);Ga(\"Query.on\",a,!1);z(\"Query.on\",2,b,!1);var c=Ja(\"Query.on\",arguments[2],arguments[3]);this.m.Sb(this,a,b,c.cancel,c.Y);return b};D.prototype.on=D.prototype.fb;D.prototype.zb=function(a,b,c){x(\"Query.off\",0,3,arguments.length);Ga(\"Query.off\",a,!0);z(\"Query.off\",2,b,!0);va(\"Query.off\",3,c);this.m.oc(this,a,b,c)};D.prototype.off=D.prototype.zb;\nD.prototype.Zd=function(a,b){function c(g){f&&(f=!1,e.zb(a,c),b.call(d.Y,g))}x(\"Query.once\",2,4,arguments.length);Ga(\"Query.once\",a,!1);z(\"Query.once\",2,b,!1);var d=Ja(\"Query.once\",arguments[2],arguments[3]),e=this,f=!0;this.fb(a,c,function(b){e.zb(a,c);d.cancel&&d.cancel.call(d.Y,b)})};D.prototype.once=D.prototype.Zd;\nD.prototype.Sd=function(a){x(\"Query.limit\",1,1,arguments.length);if(!ga(a)||Math.floor(a)!==a||0>=a)throw\"Query.limit: First argument must be a positive integer.\";return new D(this.m,this.path,a,this.da,this.wa,this.Aa,this.Ya)};D.prototype.limit=D.prototype.Sd;D.prototype.Ad=function(a,b){x(\"Query.startAt\",0,2,arguments.length);Fa(\"Query.startAt\",1,a,!0);Ha(\"Query.startAt\",b);n(a)||(b=a=null);return new D(this.m,this.path,this.Ca,a,b,this.Aa,this.Ya)};D.prototype.startAt=D.prototype.Ad;\nD.prototype.gd=function(a,b){x(\"Query.endAt\",0,2,arguments.length);Fa(\"Query.endAt\",1,a,!0);Ha(\"Query.endAt\",b);return new D(this.m,this.path,this.Ca,this.da,this.wa,a,b)};D.prototype.endAt=D.prototype.gd;D.prototype.Kd=function(a,b){x(\"Query.equalTo\",1,2,arguments.length);Fa(\"Query.equalTo\",1,a,!1);Ha(\"Query.equalTo\",b);return this.Ad(a,b).gd(a,b)};D.prototype.equalTo=D.prototype.Kd;\nfunction Ka(a){var b={};n(a.da)&&(b.sp=a.da);n(a.wa)&&(b.sn=a.wa);n(a.Aa)&&(b.ep=a.Aa);n(a.Ya)&&(b.en=a.Ya);n(a.Ca)&&(b.l=a.Ca);n(a.da)&&n(a.wa)&&null===a.da&&null===a.wa&&(b.vf=\"l\");return b}D.prototype.Qa=function(){var a=La(Ka(this));return\"{}\"===a?\"default\":a};\nfunction Ja(a,b,c){var d={};if(b&&c)d.cancel=b,z(a,3,d.cancel,!0),d.Y=c,va(a,4,d.Y);else if(b)if(\"object\"===typeof b&&null!==b)d.Y=b;else if(\"function\"===typeof b)d.cancel=b;else throw Error(ta.le(a,3,!0)+\"must either be a cancel callback or a context object.\");return d};function F(a,b){if(1==arguments.length){this.o=a.split(\"/\");for(var c=0,d=0;d<this.o.length;d++)0<this.o[d].length&&(this.o[c]=this.o[d],c++);this.o.length=c;this.U=0}else this.o=a,this.U=b}function C(a){return a.U>=a.o.length?null:a.o[a.U]}function Ma(a){var b=a.U;b<a.o.length&&b++;return new F(a.o,b)}function Na(a){return a.U<a.o.length?a.o[a.o.length-1]:null}h=F.prototype;h.toString=function(){for(var a=\"\",b=this.U;b<this.o.length;b++)\"\"!==this.o[b]&&(a+=\"/\"+this.o[b]);return a||\"/\"};\nh.parent=function(){if(this.U>=this.o.length)return null;for(var a=[],b=this.U;b<this.o.length-1;b++)a.push(this.o[b]);return new F(a,0)};h.G=function(a){for(var b=[],c=this.U;c<this.o.length;c++)b.push(this.o[c]);if(a instanceof F)for(c=a.U;c<a.o.length;c++)b.push(a.o[c]);else for(a=a.split(\"/\"),c=0;c<a.length;c++)0<a[c].length&&b.push(a[c]);return new F(b,0)};h.f=function(){return this.U>=this.o.length};h.length=function(){return this.o.length-this.U};\nfunction Oa(a,b){var c=C(a);if(null===c)return b;if(c===C(b))return Oa(Ma(a),Ma(b));throw\"INTERNAL ERROR: innerPath (\"+b+\") is not within outerPath (\"+a+\")\";}h.contains=function(a){var b=this.U,c=a.U;if(this.length()>a.length())return!1;for(;b<this.o.length;){if(this.o[b]!==a.o[c])return!1;++b;++c}return!0};function Pa(){this.children={};this.Ac=0;this.value=null}function Qa(a,b,c){this.Da=a?a:\"\";this.Fb=b?b:null;this.C=c?c:new Pa}function I(a,b){for(var c=b instanceof F?b:new F(b),d=a,e;null!==(e=C(c));)d=new Qa(e,d,wa(d.C.children,e)||new Pa),c=Ma(c);return d}h=Qa.prototype;h.j=function(){return this.C.value};function J(a,b){v(\"undefined\"!==typeof b,\"Cannot set value to undefined\");a.C.value=b;Ra(a)}h.tb=function(){return 0<this.C.Ac};h.f=function(){return null===this.j()&&!this.tb()};\nh.A=function(a){for(var b in this.C.children)a(new Qa(b,this,this.C.children[b]))};function Sa(a,b,c,d){c&&!d&&b(a);a.A(function(a){Sa(a,b,!0,d)});c&&d&&b(a)}function Ta(a,b,c){for(a=c?a:a.parent();null!==a;){if(b(a))return!0;a=a.parent()}return!1}h.path=function(){return new F(null===this.Fb?this.Da:this.Fb.path()+\"/\"+this.Da)};h.name=function(){return this.Da};h.parent=function(){return this.Fb};\nfunction Ra(a){if(null!==a.Fb){var b=a.Fb,c=a.Da,d=a.f(),e=A(b.C.children,c);d&&e?(delete b.C.children[c],b.C.Ac--,Ra(b)):d||e||(b.C.children[c]=a.C,b.C.Ac++,Ra(b))}};function Ua(a,b){this.Va=a?a:Va;this.ca=b?b:Wa}function Va(a,b){return a<b?-1:a>b?1:0}h=Ua.prototype;h.qa=function(a,b){return new Ua(this.Va,this.ca.qa(a,b,this.Va).J(null,null,!1,null,null))};h.remove=function(a){return new Ua(this.Va,this.ca.remove(a,this.Va).J(null,null,!1,null,null))};h.get=function(a){for(var b,c=this.ca;!c.f();){b=this.Va(a,c.key);if(0===b)return c.value;0>b?c=c.left:0<b&&(c=c.right)}return null};\nfunction Xa(a,b){for(var c,d=a.ca,e=null;!d.f();){c=a.Va(b,d.key);if(0===c){if(d.left.f())return e?e.key:null;for(d=d.left;!d.right.f();)d=d.right;return d.key}0>c?d=d.left:0<c&&(e=d,d=d.right)}throw Error(\"Attempted to find predecessor key for a nonexistent key.  What gives?\");}h.f=function(){return this.ca.f()};h.count=function(){return this.ca.count()};h.yb=function(){return this.ca.yb()};h.bb=function(){return this.ca.bb()};h.Ba=function(a){return this.ca.Ba(a)};h.Ra=function(a){return this.ca.Ra(a)};\nh.ab=function(a){return new Ya(this.ca,a)};function Ya(a,b){this.vd=b;for(this.cc=[];!a.f();)this.cc.push(a),a=a.left}function Za(a){if(0===a.cc.length)return null;var b=a.cc.pop(),c;c=a.vd?a.vd(b.key,b.value):{key:b.key,value:b.value};for(b=b.right;!b.f();)a.cc.push(b),b=b.left;return c}function $a(a,b,c,d,e){this.key=a;this.value=b;this.color=null!=c?c:!0;this.left=null!=d?d:Wa;this.right=null!=e?e:Wa}h=$a.prototype;\nh.J=function(a,b,c,d,e){return new $a(null!=a?a:this.key,null!=b?b:this.value,null!=c?c:this.color,null!=d?d:this.left,null!=e?e:this.right)};h.count=function(){return this.left.count()+1+this.right.count()};h.f=function(){return!1};h.Ba=function(a){return this.left.Ba(a)||a(this.key,this.value)||this.right.Ba(a)};h.Ra=function(a){return this.right.Ra(a)||a(this.key,this.value)||this.left.Ra(a)};function cb(a){return a.left.f()?a:cb(a.left)}h.yb=function(){return cb(this).key};\nh.bb=function(){return this.right.f()?this.key:this.right.bb()};h.qa=function(a,b,c){var d,e;e=this;d=c(a,e.key);e=0>d?e.J(null,null,null,e.left.qa(a,b,c),null):0===d?e.J(null,b,null,null,null):e.J(null,null,null,null,e.right.qa(a,b,c));return db(e)};function eb(a){if(a.left.f())return Wa;a.left.P()||a.left.left.P()||(a=fb(a));a=a.J(null,null,null,eb(a.left),null);return db(a)}\nh.remove=function(a,b){var c,d;c=this;if(0>b(a,c.key))c.left.f()||c.left.P()||c.left.left.P()||(c=fb(c)),c=c.J(null,null,null,c.left.remove(a,b),null);else{c.left.P()&&(c=gb(c));c.right.f()||c.right.P()||c.right.left.P()||(c=hb(c),c.left.left.P()&&(c=gb(c),c=hb(c)));if(0===b(a,c.key)){if(c.right.f())return Wa;d=cb(c.right);c=c.J(d.key,d.value,null,null,eb(c.right))}c=c.J(null,null,null,null,c.right.remove(a,b))}return db(c)};h.P=function(){return this.color};\nfunction db(a){a.right.P()&&!a.left.P()&&(a=ib(a));a.left.P()&&a.left.left.P()&&(a=gb(a));a.left.P()&&a.right.P()&&(a=hb(a));return a}function fb(a){a=hb(a);a.right.left.P()&&(a=a.J(null,null,null,null,gb(a.right)),a=ib(a),a=hb(a));return a}function ib(a){return a.right.J(null,null,a.color,a.J(null,null,!0,null,a.right.left),null)}function gb(a){return a.left.J(null,null,a.color,null,a.J(null,null,!0,a.left.right,null))}\nfunction hb(a){return a.J(null,null,!a.color,a.left.J(null,null,!a.left.color,null,null),a.right.J(null,null,!a.right.color,null,null))}function jb(){}h=jb.prototype;h.J=function(){return this};h.qa=function(a,b){return new $a(a,b,null)};h.remove=function(){return this};h.count=function(){return 0};h.f=function(){return!0};h.Ba=function(){return!1};h.Ra=function(){return!1};h.yb=function(){return null};h.bb=function(){return null};h.P=function(){return!1};var Wa=new jb;function kb(a){this.Xb=a;this.kc=\"firebase:\"}kb.prototype.set=function(a,b){null==b?this.Xb.removeItem(this.kc+a):this.Xb.setItem(this.kc+a,u(b))};kb.prototype.get=function(a){a=this.Xb.getItem(this.kc+a);return null==a?null:ra(a)};kb.prototype.remove=function(a){this.Xb.removeItem(this.kc+a)};kb.prototype.od=!1;function lb(){this.ob={}}lb.prototype.set=function(a,b){null==b?delete this.ob[a]:this.ob[a]=b};lb.prototype.get=function(a){return A(this.ob,a)?this.ob[a]:null};lb.prototype.remove=function(a){delete this.ob[a]};lb.prototype.od=!0;function mb(a){try{if(\"undefined\"!==typeof window&&\"undefined\"!==typeof window[a]){var b=window[a];b.setItem(\"firebase:sentinel\",\"cache\");b.removeItem(\"firebase:sentinel\");return new kb(b)}}catch(c){}return new lb}var nb=mb(\"localStorage\"),ob=mb(\"sessionStorage\");function pb(a,b,c,d){this.host=a.toLowerCase();this.domain=this.host.substr(this.host.indexOf(\".\")+1);this.qc=b;this.bc=c;this.ie=d;this.ga=nb.get(\"host:\"+a)||this.host}function qb(a,b){b!==a.ga&&(a.ga=b,\"s-\"===a.ga.substr(0,2)&&nb.set(\"host:\"+a.host,a.ga))}pb.prototype.toString=function(){return(this.qc?\"https://\":\"http://\")+this.host};\"use strict\";function rb(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=Math.round(c/1099511627776)||32,e;if(32===d)e=a.concat(b);else{e=b;var c=c|0,f=a.slice(0,a.length-1),g;for(void 0===f&&(f=[]);32<=d;d-=32)f.push(c),c=0;if(0===d)e=f.concat(e);else{for(g=0;g<e.length;g++)f.push(c|e[g]>>>d),c=e[g]<<32-d;g=e.length?e[e.length-1]:0;e=Math.round(g/1099511627776)||32;f.push(sb(d+e&31,32<d+e?c:f.pop(),1));e=f}}return e}\nfunction tb(a){var b=a.length;return 0===b?0:32*(b-1)+(Math.round(a[b-1]/1099511627776)||32)}function sb(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+1099511627776*a}function ub(a){var b,c=\"\",d=0,e=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",f=0,g=tb(a);b&&(e=e.substr(0,62)+\"-_\");for(b=0;6*c.length<g;)c+=e.charAt((f^a[b]>>>d)>>>26),6>d?(f=a[b]<<6-d,d+=26,b++):(f<<=6,d-=6);for(;c.length&3;)c+=\"=\";return c}\nfunction vb(a){a?(this.Tb=a.Tb.slice(0),this.nb=a.nb.slice(0),this.Ua=a.Ua):this.reset()}function wb(a){a=(new vb).update(a);var b,c=a.nb,d=a.Tb,c=rb(c,[sb(1,1)]);for(b=c.length+2;b&15;b++)c.push(0);c.push(Math.floor(a.Ua/4294967296));for(c.push(a.Ua|0);c.length;)xb(a,c.splice(0,16));a.reset();return d}\nvb.prototype={zc:512,reset:function(){this.Tb=this.Md.slice(0);this.nb=[];this.Ua=0;return this},update:function(a){if(\"string\"===typeof a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3===(c&3)&&(b.push(d),d=0);c&3&&b.push(sb(8*(c&3),d));a=b}c=this.nb=rb(this.nb,a);b=this.Ua;a=this.Ua=b+tb(a);for(b=this.zc+b&-this.zc;b<=a;b+=this.zc)xb(this,c.splice(0,16));return this},Md:[1732584193,4023233417,2562383102,271733878,3285377520],Pd:[1518500249,1859775393,\n2400959708,3395469782]};function xb(a,b){var c,d,e,f,g,k,l,m=b.slice(0),p=a.Tb;e=p[0];f=p[1];g=p[2];k=p[3];l=p[4];for(c=0;79>=c;c++)16<=c&&(m[c]=(m[c-3]^m[c-8]^m[c-14]^m[c-16])<<1|(m[c-3]^m[c-8]^m[c-14]^m[c-16])>>>31),d=19>=c?f&g|~f&k:39>=c?f^g^k:59>=c?f&g|f&k|g&k:79>=c?f^g^k:void 0,d=(e<<5|e>>>27)+d+l+m[c]+a.Pd[Math.floor(c/20)]|0,l=k,k=g,g=f<<30|f>>>2,f=e,e=d;p[0]=p[0]+e|0;p[1]=p[1]+f|0;p[2]=p[2]+g|0;p[3]=p[3]+k|0;p[4]=p[4]+l|0};var yb=Array.prototype,zb=yb.forEach?function(a,b,c){yb.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(\"\"):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Ab=yb.map?function(a,b,c){return yb.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=q(a)?a.split(\"\"):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Bb=yb.reduce?function(a,b,c,d){d&&(b=r(b,d));return yb.reduce.call(a,b,c)}:function(a,b,c,d){var e=c;zb(a,function(c,g){e=b.call(d,e,c,g,a)});return e},\nCb=yb.every?function(a,b,c){return yb.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(\"\"):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};function Db(a,b){var c;a:{c=a.length;for(var d=q(a)?a.split(\"\"):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a)){c=e;break a}c=-1}return 0>c?null:q(a)?a.charAt(c):a[c]};var Eb;a:{var Fb=aa.navigator;if(Fb){var Gb=Fb.userAgent;if(Gb){Eb=Gb;break a}}Eb=\"\"}function Hb(a){return-1!=Eb.indexOf(a)};var Ib=Hb(\"Opera\")||Hb(\"OPR\"),Jb=Hb(\"Trident\")||Hb(\"MSIE\"),Kb=Hb(\"Gecko\")&&-1==Eb.toLowerCase().indexOf(\"webkit\")&&!(Hb(\"Trident\")||Hb(\"MSIE\")),Lb=-1!=Eb.toLowerCase().indexOf(\"webkit\");(function(){var a=\"\",b;if(Ib&&aa.opera)return a=aa.opera.version,\"function\"==da(a)?a():a;Kb?b=/rv\\:([^\\);]+)(\\)|;)/:Jb?b=/\\b(?:MSIE|rv)[: ]([^\\);]+)(\\)|;)/:Lb&&(b=/WebKit\\/(\\S+)/);b&&(a=(a=b.exec(Eb))?a[1]:\"\");return Jb&&(b=(b=aa.document)?b.documentMode:void 0,b>parseFloat(a))?String(b):a})();var Mb=null,Nb=null;var Ob=function(){var a=1;return function(){return a++}}();function v(a,b){if(!a)throw Error(\"Firebase INTERNAL ASSERT FAILED:\"+b);}function Pb(a){for(var b=\"\",c=0;c<arguments.length;c++)b=fa(arguments[c])?b+Pb.apply(null,arguments[c]):\"object\"===typeof arguments[c]?b+u(arguments[c]):b+arguments[c],b+=\" \";return b}var Qb=null,Rb=!0;function K(a){!0===Rb&&(Rb=!1,null===Qb&&!0===ob.get(\"logging_enabled\")&&Sb(!0));if(Qb){var b=Pb.apply(null,arguments);Qb(b)}}\nfunction Tb(a){return function(){K(a,arguments)}}function Ub(a){if(\"undefined\"!==typeof console){var b=\"FIREBASE INTERNAL ERROR: \"+Pb.apply(null,arguments);\"undefined\"!==typeof console.error?console.error(b):console.log(b)}}function Vb(a){var b=Pb.apply(null,arguments);throw Error(\"FIREBASE FATAL ERROR: \"+b);}function L(a){if(\"undefined\"!==typeof console){var b=\"FIREBASE WARNING: \"+Pb.apply(null,arguments);\"undefined\"!==typeof console.warn?console.warn(b):console.log(b)}}\nfunction Da(a){return ga(a)&&(a!=a||a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY)}function Wb(a){if(\"complete\"===document.readyState)a();else{var b=!1,c=function(){document.body?b||(b=!0,a()):setTimeout(c,Math.floor(10))};document.addEventListener?(document.addEventListener(\"DOMContentLoaded\",c,!1),window.addEventListener(\"load\",c,!1)):document.attachEvent&&(document.attachEvent(\"onreadystatechange\",function(){\"complete\"===document.readyState&&c()}),window.attachEvent(\"onload\",c))}}\nfunction Xb(a,b){return a!==b?null===a?-1:null===b?1:typeof a!==typeof b?\"number\"===typeof a?-1:1:a>b?1:-1:0}function Yb(a,b){if(a===b)return 0;var c=Zb(a),d=Zb(b);return null!==c?null!==d?0==c-d?a.length-b.length:c-d:-1:null!==d?1:a<b?-1:1}function $b(a,b){if(b&&a in b)return b[a];throw Error(\"Missing required key (\"+a+\") in object: \"+u(b));}\nfunction La(a){if(\"object\"!==typeof a||null===a)return u(a);var b=[],c;for(c in a)b.push(c);b.sort();c=\"{\";for(var d=0;d<b.length;d++)0!==d&&(c+=\",\"),c+=u(b[d]),c+=\":\",c+=La(a[b[d]]);return c+\"}\"}function ac(a,b){if(a.length<=b)return[a];for(var c=[],d=0;d<a.length;d+=b)d+b>a?c.push(a.substring(d,a.length)):c.push(a.substring(d,d+b));return c}function bc(a,b){if(ea(a))for(var c=0;c<a.length;++c)b(c,a[c]);else cc(a,b)}function dc(a,b){return b?r(a,b):a}\nfunction ec(a){v(!Da(a),\"Invalid JSON number\");var b,c,d,e;0===a?(d=c=0,b=-Infinity===1/a?1:0):(b=0>a,a=Math.abs(a),a>=Math.pow(2,-1022)?(d=Math.min(Math.floor(Math.log(a)/Math.LN2),1023),c=d+1023,d=Math.round(a*Math.pow(2,52-d)-Math.pow(2,52))):(c=0,d=Math.round(a/Math.pow(2,-1074))));e=[];for(a=52;a;a-=1)e.push(d%2?1:0),d=Math.floor(d/2);for(a=11;a;a-=1)e.push(c%2?1:0),c=Math.floor(c/2);e.push(b?1:0);e.reverse();b=e.join(\"\");c=\"\";for(a=0;64>a;a+=8)d=parseInt(b.substr(a,8),2).toString(16),1===d.length&&\n(d=\"0\"+d),c+=d;return c.toLowerCase()}function fc(a){var b=\"Unknown Error\";\"too_big\"===a?b=\"The data requested exceeds the maximum size that can be accessed with a single request.\":\"permission_denied\"==a?b=\"Client doesn't have permission to access the desired data.\":\"unavailable\"==a&&(b=\"The service is unavailable\");b=Error(a+\": \"+b);b.code=a.toUpperCase();return b}var gc=/^-?\\d{1,10}$/;function Zb(a){return gc.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}\nfunction ic(a){try{a()}catch(b){setTimeout(function(){throw b;},Math.floor(0))}};function jc(a,b){this.F=a;v(null!==this.F,\"LeafNode shouldn't be created with null value.\");this.gb=\"undefined\"!==typeof b?b:null}h=jc.prototype;h.O=function(){return!0};h.k=function(){return this.gb};h.Ga=function(a){return new jc(this.F,a)};h.N=function(){return M};h.K=function(a){return null===C(a)?this:M};h.fa=function(){return null};h.H=function(a,b){return(new N).H(a,b).Ga(this.gb)};h.ya=function(a,b){var c=C(a);return null===c?b:this.H(c,M.ya(Ma(a),b))};h.f=function(){return!1};h.dc=function(){return 0};\nh.V=function(a){return a&&null!==this.k()?{\".value\":this.j(),\".priority\":this.k()}:this.j()};h.hash=function(){var a=\"\";null!==this.k()&&(a+=\"priority:\"+kc(this.k())+\":\");var b=typeof this.F,a=a+(b+\":\"),a=\"number\"===b?a+ec(this.F):a+this.F;return ub(wb(a))};h.j=function(){return this.F};h.toString=function(){return\"string\"===typeof this.F?this.F:'\"'+this.F+'\"'};function lc(a,b){return Xb(a.ja,b.ja)||Yb(a.name,b.name)}function mc(a,b){return Yb(a.name,b.name)}function nc(a,b){return Yb(a,b)};function N(a,b){this.n=a||new Ua(nc);this.gb=\"undefined\"!==typeof b?b:null}h=N.prototype;h.O=function(){return!1};h.k=function(){return this.gb};h.Ga=function(a){return new N(this.n,a)};h.H=function(a,b){var c=this.n.remove(a);b&&b.f()&&(b=null);null!==b&&(c=c.qa(a,b));return b&&null!==b.k()?new oc(c,null,this.gb):new N(c,this.gb)};h.ya=function(a,b){var c=C(a);if(null===c)return b;var d=this.N(c).ya(Ma(a),b);return this.H(c,d)};h.f=function(){return this.n.f()};h.dc=function(){return this.n.count()};\nvar pc=/^\\d+$/;h=N.prototype;h.V=function(a){if(this.f())return null;var b={},c=0,d=0,e=!0;this.A(function(f,g){b[f]=g.V(a);c++;e&&pc.test(f)?d=Math.max(d,Number(f)):e=!1});if(!a&&e&&d<2*c){var f=[],g;for(g in b)f[g]=b[g];return f}a&&null!==this.k()&&(b[\".priority\"]=this.k());return b};h.hash=function(){var a=\"\";null!==this.k()&&(a+=\"priority:\"+kc(this.k())+\":\");this.A(function(b,c){var d=c.hash();\"\"!==d&&(a+=\":\"+b+\":\"+d)});return\"\"===a?\"\":ub(wb(a))};\nh.N=function(a){a=this.n.get(a);return null===a?M:a};h.K=function(a){var b=C(a);return null===b?this:this.N(b).K(Ma(a))};h.fa=function(a){return Xa(this.n,a)};h.jd=function(){return this.n.yb()};h.ld=function(){return this.n.bb()};h.A=function(a){return this.n.Ba(a)};h.Fc=function(a){return this.n.Ra(a)};h.ab=function(){return this.n.ab()};h.toString=function(){var a=\"{\",b=!0;this.A(function(c,d){b?b=!1:a+=\", \";a+='\"'+c+'\" : '+d.toString()});return a+=\"}\"};var M=new N;function oc(a,b,c){N.call(this,a,c);null===b&&(b=new Ua(lc),a.Ba(function(a,c){b=b.qa({name:a,ja:c.k()},c)}));this.va=b}ka(oc,N);h=oc.prototype;h.H=function(a,b){var c=this.N(a),d=this.n,e=this.va;null!==c&&(d=d.remove(a),e=e.remove({name:a,ja:c.k()}));b&&b.f()&&(b=null);null!==b&&(d=d.qa(a,b),e=e.qa({name:a,ja:b.k()},b));return new oc(d,e,this.k())};h.fa=function(a,b){var c=Xa(this.va,{name:a,ja:b.k()});return c?c.name:null};h.A=function(a){return this.va.Ba(function(b,c){return a(b.name,c)})};\nh.Fc=function(a){return this.va.Ra(function(b,c){return a(b.name,c)})};h.ab=function(){return this.va.ab(function(a,b){return{key:a.name,value:b}})};h.jd=function(){return this.va.f()?null:this.va.yb().name};h.ld=function(){return this.va.f()?null:this.va.bb().name};function O(a,b){if(null===a)return M;var c=null;\"object\"===typeof a&&\".priority\"in a?c=a[\".priority\"]:\"undefined\"!==typeof b&&(c=b);v(null===c||\"string\"===typeof c||\"number\"===typeof c||\"object\"===typeof c&&\".sv\"in c,\"Invalid priority type found: \"+typeof c);\"object\"===typeof a&&\".value\"in a&&null!==a[\".value\"]&&(a=a[\".value\"]);if(\"object\"!==typeof a||\".sv\"in a)return new jc(a,c);if(a instanceof Array){var d=M,e=a;cc(e,function(a,b){if(A(e,b)&&\".\"!==b.substring(0,1)){var c=O(a);if(c.O()||!c.f())d=\nd.H(b,c)}});return d.Ga(c)}var f=[],g={},k=!1,l=a;bc(l,function(a,b){if(\"string\"!==typeof b||\".\"!==b.substring(0,1)){var c=O(l[b]);c.f()||(k=k||null!==c.k(),f.push({name:b,ja:c.k()}),g[b]=c)}});var m=qc(f,g,!1);if(k){var p=qc(f,g,!0);return new oc(m,p,c)}return new N(m,c)}var rc=Math.log(2);function sc(a){this.count=parseInt(Math.log(a+1)/rc,10);this.ed=this.count-1;this.Hd=a+1&parseInt(Array(this.count+1).join(\"1\"),2)}function tc(a){var b=!(a.Hd&1<<a.ed);a.ed--;return b}\nfunction qc(a,b,c){function d(e,f){var l=f-e;if(0==l)return null;if(1==l){var l=a[e].name,m=c?a[e]:l;return new $a(m,b[l],!1,null,null)}var m=parseInt(l/2,10)+e,p=d(e,m),t=d(m+1,f),l=a[m].name,m=c?a[m]:l;return new $a(m,b[l],!1,p,t)}var e=c?lc:mc;a.sort(e);var f=function(e){function f(e,g){var k=p-e,t=p;p-=e;var s=a[k].name,k=new $a(c?a[k]:s,b[s],g,null,d(k+1,t));l?l.left=k:m=k;l=k}for(var l=null,m=null,p=a.length,t=0;t<e.count;++t){var s=tc(e),w=Math.pow(2,e.count-(t+1));s?f(w,!1):(f(w,!1),f(w,!0))}return m}(new sc(a.length)),\ne=c?lc:nc;return null!==f?new Ua(e,f):new Ua(e)}function kc(a){return\"number\"===typeof a?\"number:\"+ec(a):\"string:\"+a};function P(a,b){this.C=a;this.nc=b}P.prototype.V=function(){x(\"Firebase.DataSnapshot.val\",0,0,arguments.length);return this.C.V()};P.prototype.val=P.prototype.V;P.prototype.Ld=function(){x(\"Firebase.DataSnapshot.exportVal\",0,0,arguments.length);return this.C.V(!0)};P.prototype.exportVal=P.prototype.Ld;P.prototype.G=function(a){x(\"Firebase.DataSnapshot.child\",0,1,arguments.length);ga(a)&&(a=String(a));Ia(\"Firebase.DataSnapshot.child\",a);var b=new F(a),c=this.nc.G(b);return new P(this.C.K(b),c)};\nP.prototype.child=P.prototype.G;P.prototype.Ic=function(a){x(\"Firebase.DataSnapshot.hasChild\",1,1,arguments.length);Ia(\"Firebase.DataSnapshot.hasChild\",a);var b=new F(a);return!this.C.K(b).f()};P.prototype.hasChild=P.prototype.Ic;P.prototype.k=function(){x(\"Firebase.DataSnapshot.getPriority\",0,0,arguments.length);return this.C.k()};P.prototype.getPriority=P.prototype.k;\nP.prototype.forEach=function(a){x(\"Firebase.DataSnapshot.forEach\",1,1,arguments.length);z(\"Firebase.DataSnapshot.forEach\",1,a,!1);if(this.C.O())return!1;var b=this;return this.C.A(function(c,d){return a(new P(d,b.nc.G(c)))})};P.prototype.forEach=P.prototype.forEach;P.prototype.tb=function(){x(\"Firebase.DataSnapshot.hasChildren\",0,0,arguments.length);return this.C.O()?!1:!this.C.f()};P.prototype.hasChildren=P.prototype.tb;\nP.prototype.name=function(){x(\"Firebase.DataSnapshot.name\",0,0,arguments.length);return this.nc.name()};P.prototype.name=P.prototype.name;P.prototype.dc=function(){x(\"Firebase.DataSnapshot.numChildren\",0,0,arguments.length);return this.C.dc()};P.prototype.numChildren=P.prototype.dc;P.prototype.Uc=function(){x(\"Firebase.DataSnapshot.ref\",0,0,arguments.length);return this.nc};P.prototype.ref=P.prototype.Uc;function uc(a){v(ea(a)&&0<a.length,\"Requires a non-empty array\");this.Gd=a;this.xb={}}uc.prototype.bd=function(a,b){for(var c=this.xb[a]||[],d=0;d<c.length;d++)c[d].aa.apply(c[d].Y,Array.prototype.slice.call(arguments,1))};uc.prototype.fb=function(a,b,c){vc(this,a);this.xb[a]=this.xb[a]||[];this.xb[a].push({aa:b,Y:c});(a=this.kd(a))&&b.apply(c,a)};uc.prototype.zb=function(a,b,c){vc(this,a);a=this.xb[a]||[];for(var d=0;d<a.length;d++)if(a[d].aa===b&&(!c||c===a[d].Y)){a.splice(d,1);break}};\nfunction vc(a,b){v(Db(a.Gd,function(a){return a===b}),\"Unknown event: \"+b)};function wc(){uc.call(this,[\"visible\"]);var a,b;\"undefined\"!==typeof document&&\"undefined\"!==typeof document.addEventListener&&(\"undefined\"!==typeof document.hidden?(b=\"visibilitychange\",a=\"hidden\"):\"undefined\"!==typeof document.mozHidden?(b=\"mozvisibilitychange\",a=\"mozHidden\"):\"undefined\"!==typeof document.msHidden?(b=\"msvisibilitychange\",a=\"msHidden\"):\"undefined\"!==typeof document.webkitHidden&&(b=\"webkitvisibilitychange\",a=\"webkitHidden\"));this.lb=!0;if(b){var c=this;document.addEventListener(b,\nfunction(){var b=!document[a];b!==c.lb&&(c.lb=b,c.bd(\"visible\",b))},!1)}}ka(wc,uc);ca(wc);wc.prototype.kd=function(a){v(\"visible\"===a,\"Unknown event type: \"+a);return[this.lb]};function xc(){uc.call(this,[\"online\"]);this.Db=!0;if(\"undefined\"!==typeof window&&\"undefined\"!==typeof window.addEventListener){var a=this;window.addEventListener(\"online\",function(){a.Db||a.bd(\"online\",!0);a.Db=!0},!1);window.addEventListener(\"offline\",function(){a.Db&&a.bd(\"online\",!1);a.Db=!1},!1)}}ka(xc,uc);ca(xc);xc.prototype.kd=function(a){v(\"online\"===a,\"Unknown event type: \"+a);return[this.Db]};function cc(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function yc(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function zc(a){var b={},c;for(c in a)b[c]=a[c];return b};function Ac(){this.pb={}}function Bc(a,b,c){n(c)||(c=1);A(a.pb,b)||(a.pb[b]=0);a.pb[b]+=c}Ac.prototype.get=function(){return zc(this.pb)};function Cc(a){this.Id=a;this.Zb=null}Cc.prototype.get=function(){var a=this.Id.get(),b=zc(a);if(this.Zb)for(var c in this.Zb)b[c]-=this.Zb[c];this.Zb=a;return b};function Dc(a,b){this.Zc={};this.tc=new Cc(a);this.u=b;var c=1E4+2E4*Math.random();setTimeout(r(this.td,this),Math.floor(c))}Dc.prototype.td=function(){var a=this.tc.get(),b={},c=!1,d;for(d in a)0<a[d]&&A(this.Zc,d)&&(b[d]=a[d],c=!0);c&&(a=this.u,a.R&&(b={c:b},a.e(\"reportStats\",b),a.Ea(\"s\",b)));setTimeout(r(this.td,this),Math.floor(6E5*Math.random()))};var Ec={},Fc={};function Gc(a){a=a.toString();Ec[a]||(Ec[a]=new Ac);return Ec[a]}function Hc(a,b){var c=a.toString();Fc[c]||(Fc[c]=b());return Fc[c]};var Ic=null;\"undefined\"!==typeof MozWebSocket?Ic=MozWebSocket:\"undefined\"!==typeof WebSocket&&(Ic=WebSocket);function Q(a,b,c){this.Cc=a;this.e=Tb(this.Cc);this.frames=this.vb=null;this.Ha=this.Ia=this.ad=0;this.ea=Gc(b);this.Wa=(b.qc?\"wss://\":\"ws://\")+b.ga+\"/.ws?v=5\";b.host!==b.ga&&(this.Wa=this.Wa+\"&ns=\"+b.bc);c&&(this.Wa=this.Wa+\"&s=\"+c)}var Jc;\nQ.prototype.open=function(a,b){this.ia=b;this.Wd=a;this.e(\"Websocket connecting to \"+this.Wa);this.W=new Ic(this.Wa);this.qb=!1;nb.set(\"previous_websocket_failure\",!0);var c=this;this.W.onopen=function(){c.e(\"Websocket connected.\");c.qb=!0};this.W.onclose=function(){c.e(\"Websocket connection was disconnected.\");c.W=null;c.Pa()};this.W.onmessage=function(a){if(null!==c.W)if(a=a.data,c.Ha+=a.length,Bc(c.ea,\"bytes_received\",a.length),Kc(c),null!==c.frames)Lc(c,a);else{a:{v(null===c.frames,\"We already have a frame buffer\");\nif(6>=a.length){var b=Number(a);if(!isNaN(b)){c.ad=b;c.frames=[];a=null;break a}}c.ad=1;c.frames=[]}null!==a&&Lc(c,a)}};this.W.onerror=function(a){c.e(\"WebSocket error.  Closing connection.\");(a=a.message||a.data)&&c.e(a);c.Pa()}};Q.prototype.start=function(){};Q.isAvailable=function(){var a=!1;if(\"undefined\"!==typeof navigator&&navigator.userAgent){var b=navigator.userAgent.match(/Android ([0-9]{0,}\\.[0-9]{0,})/);b&&1<b.length&&4.4>parseFloat(b[1])&&(a=!0)}return!a&&null!==Ic&&!Jc};\nQ.responsesRequiredToBeHealthy=2;Q.healthyTimeout=3E4;h=Q.prototype;h.$b=function(){nb.remove(\"previous_websocket_failure\")};function Lc(a,b){a.frames.push(b);if(a.frames.length==a.ad){var c=a.frames.join(\"\");a.frames=null;c=ra(c);a.Wd(c)}}h.send=function(a){Kc(this);a=u(a);this.Ia+=a.length;Bc(this.ea,\"bytes_sent\",a.length);a=ac(a,16384);1<a.length&&this.W.send(String(a.length));for(var b=0;b<a.length;b++)this.W.send(a[b])};\nh.Nb=function(){this.Ma=!0;this.vb&&(clearInterval(this.vb),this.vb=null);this.W&&(this.W.close(),this.W=null)};h.Pa=function(){this.Ma||(this.e(\"WebSocket is closing itself\"),this.Nb(),this.ia&&(this.ia(this.qb),this.ia=null))};h.close=function(){this.Ma||(this.e(\"WebSocket is being closed\"),this.Nb())};function Kc(a){clearInterval(a.vb);a.vb=setInterval(function(){a.W&&a.W.send(\"0\");Kc(a)},Math.floor(45E3))};function Mc(a){this.Pc=a;this.jc=[];this.Xa=0;this.Bc=-1;this.Oa=null}function Nc(a,b,c){a.Bc=b;a.Oa=c;a.Bc<a.Xa&&(a.Oa(),a.Oa=null)}function Oc(a,b,c){for(a.jc[b]=c;a.jc[a.Xa];){var d=a.jc[a.Xa];delete a.jc[a.Xa];for(var e=0;e<d.length;++e)if(d[e]){var f=a;ic(function(){f.Pc(d[e])})}if(a.Xa===a.Bc){a.Oa&&(clearTimeout(a.Oa),a.Oa(),a.Oa=null);break}a.Xa++}};function Pc(){this.set={}}h=Pc.prototype;h.add=function(a,b){this.set[a]=null!==b?b:!0};h.contains=function(a){return A(this.set,a)};h.get=function(a){return this.contains(a)?this.set[a]:void 0};h.remove=function(a){delete this.set[a]};h.f=function(){var a;a:{a=this.set;for(var b in a){a=!1;break a}a=!0}return a};h.count=function(){var a=this.set,b=0,c;for(c in a)b++;return b};function R(a,b){cc(a.set,function(a,d){b(d,a)})}h.keys=function(){var a=[];cc(this.set,function(b,c){a.push(c)});return a};function Qc(a,b,c){this.Cc=a;this.e=Tb(a);this.Ha=this.Ia=0;this.ea=Gc(b);this.sc=c;this.qb=!1;this.Rb=function(a){b.host!==b.ga&&(a.ns=b.bc);var c=[],f;for(f in a)a.hasOwnProperty(f)&&c.push(f+\"=\"+a[f]);return(b.qc?\"https://\":\"http://\")+b.ga+\"/.lp?\"+c.join(\"&\")}}var Rc,Sc;\nQc.prototype.open=function(a,b){this.dd=0;this.S=b;this.pd=new Mc(a);this.Ma=!1;var c=this;this.Ja=setTimeout(function(){c.e(\"Timed out trying to connect.\");c.Pa();c.Ja=null},Math.floor(3E4));Wb(function(){if(!c.Ma){c.la=new Tc(function(a,b,d,k,l){Uc(c,arguments);if(c.la)if(c.Ja&&(clearTimeout(c.Ja),c.Ja=null),c.qb=!0,\"start\"==a)c.id=b,c.sd=d;else if(\"close\"===a)b?(c.la.rc=!1,Nc(c.pd,b,function(){c.Pa()})):c.Pa();else throw Error(\"Unrecognized command received: \"+a);},function(a,b){Uc(c,arguments);\nOc(c.pd,a,b)},function(){c.Pa()},c.Rb);var a={start:\"t\"};a.ser=Math.floor(1E8*Math.random());c.la.uc&&(a.cb=c.la.uc);a.v=\"5\";c.sc&&(a.s=c.sc);a=c.Rb(a);c.e(\"Connecting via long-poll to \"+a);Vc(c.la,a,function(){})}})};Qc.prototype.start=function(){var a=this.la,b=this.sd;a.Ud=this.id;a.Vd=b;for(a.xc=!0;Wc(a););a=this.id;b=this.sd;this.eb=document.createElement(\"iframe\");var c={dframe:\"t\"};c.id=a;c.pw=b;this.eb.src=this.Rb(c);this.eb.style.display=\"none\";document.body.appendChild(this.eb)};\nQc.isAvailable=function(){return!Sc&&!(\"object\"===typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&!(\"object\"===typeof Windows&&\"object\"===typeof Windows.je)&&(Rc||!0)};h=Qc.prototype;h.$b=function(){};h.Nb=function(){this.Ma=!0;this.la&&(this.la.close(),this.la=null);this.eb&&(document.body.removeChild(this.eb),this.eb=null);this.Ja&&(clearTimeout(this.Ja),this.Ja=null)};\nh.Pa=function(){this.Ma||(this.e(\"Longpoll is closing itself\"),this.Nb(),this.S&&(this.S(this.qb),this.S=null))};h.close=function(){this.Ma||(this.e(\"Longpoll is being closed.\"),this.Nb())};\nh.send=function(a){a=u(a);this.Ia+=a.length;Bc(this.ea,\"bytes_sent\",a.length);a=sa(a);if(!fa(a))throw Error(\"encodeByteArray takes an array as a parameter\");if(!Mb){Mb={};Nb={};for(var b=0;65>b;b++)Mb[b]=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\".charAt(b),Nb[b]=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.\".charAt(b)}for(var b=Nb,c=[],d=0;d<a.length;d+=3){var e=a[d],f=d+1<a.length,g=f?a[d+1]:0,k=d+2<a.length,l=k?a[d+2]:0,m=e>>2,e=(e&3)<<4|g>>4,g=(g&15)<<\n2|l>>6,l=l&63;k||(l=64,f||(g=64));c.push(b[m],b[e],b[g],b[l])}a=ac(c.join(\"\"),1840);for(b=0;b<a.length;b++)c=this.la,c.Hb.push({de:this.dd,he:a.length,fd:a[b]}),c.xc&&Wc(c),this.dd++};function Uc(a,b){var c=u(b).length;a.Ha+=c;Bc(a.ea,\"bytes_received\",c)}\nfunction Tc(a,b,c,d){this.Rb=d;this.ia=c;this.Rc=new Pc;this.Hb=[];this.Dc=Math.floor(1E8*Math.random());this.rc=!0;this.uc=Ob();window[\"pLPCommand\"+this.uc]=a;window[\"pRTLPCB\"+this.uc]=b;a=document.createElement(\"iframe\");a.style.display=\"none\";if(document.body){document.body.appendChild(a);try{a.contentWindow.document||K(\"No IE domain setting required\")}catch(e){a.src=\"javascript:void((function(){document.open();document.domain='\"+document.domain+\"';document.close();})())\"}}else throw\"Document body has not initialized. Wait to initialize Firebase until after the document is ready.\";\na.contentDocument?a.za=a.contentDocument:a.contentWindow?a.za=a.contentWindow.document:a.document&&(a.za=a.document);this.Z=a;a=\"\";this.Z.src&&\"javascript:\"===this.Z.src.substr(0,11)&&(a='<script>document.domain=\"'+document.domain+'\";\\x3c/script>');a=\"<html><body>\"+a+\"</body></html>\";try{this.Z.za.open(),this.Z.za.write(a),this.Z.za.close()}catch(f){K(\"frame writing exception\"),f.stack&&K(f.stack),K(f)}}\nTc.prototype.close=function(){this.xc=!1;if(this.Z){this.Z.za.body.innerHTML=\"\";var a=this;setTimeout(function(){null!==a.Z&&(document.body.removeChild(a.Z),a.Z=null)},Math.floor(0))}var b=this.ia;b&&(this.ia=null,b())};\nfunction Wc(a){if(a.xc&&a.rc&&a.Rc.count()<(0<a.Hb.length?2:1)){a.Dc++;var b={};b.id=a.Ud;b.pw=a.Vd;b.ser=a.Dc;for(var b=a.Rb(b),c=\"\",d=0;0<a.Hb.length;)if(1870>=a.Hb[0].fd.length+30+c.length){var e=a.Hb.shift(),c=c+\"&seg\"+d+\"=\"+e.de+\"&ts\"+d+\"=\"+e.he+\"&d\"+d+\"=\"+e.fd;d++}else break;Zc(a,b+c,a.Dc);return!0}return!1}function Zc(a,b,c){function d(){a.Rc.remove(c);Wc(a)}a.Rc.add(c);var e=setTimeout(d,Math.floor(25E3));Vc(a,b,function(){clearTimeout(e);d()})}\nfunction Vc(a,b,c){setTimeout(function(){try{if(a.rc){var d=a.Z.za.createElement(\"script\");d.type=\"text/javascript\";d.async=!0;d.src=b;d.onload=d.onreadystatechange=function(){var a=d.readyState;a&&\"loaded\"!==a&&\"complete\"!==a||(d.onload=d.onreadystatechange=null,d.parentNode&&d.parentNode.removeChild(d),c())};d.onerror=function(){K(\"Long-poll script failed to load: \"+b);a.rc=!1;a.close()};a.Z.za.body.appendChild(d)}}catch(e){}},Math.floor(1))};function $c(a){ad(this,a)}var bd=[Qc,Q];function ad(a,b){var c=Q&&Q.isAvailable(),d=c&&!(nb.od||!0===nb.get(\"previous_websocket_failure\"));b.ie&&(c||L(\"wss:// URL used, but browser isn't known to support websockets.  Trying anyway.\"),d=!0);if(d)a.Ob=[Q];else{var e=a.Ob=[];bc(bd,function(a,b){b&&b.isAvailable()&&e.push(b)})}}function cd(a){if(0<a.Ob.length)return a.Ob[0];throw Error(\"No transports available\");};function dd(a,b,c,d,e,f){this.id=a;this.e=Tb(\"c:\"+this.id+\":\");this.Pc=c;this.Cb=d;this.S=e;this.Oc=f;this.M=b;this.ic=[];this.cd=0;this.Cd=new $c(b);this.ma=0;this.e(\"Connection created\");ed(this)}\nfunction ed(a){var b=cd(a.Cd);a.B=new b(\"c:\"+a.id+\":\"+a.cd++,a.M);a.Tc=b.responsesRequiredToBeHealthy||0;var c=fd(a,a.B),d=gd(a,a.B);a.Pb=a.B;a.Mb=a.B;a.w=null;a.Na=!1;setTimeout(function(){a.B&&a.B.open(c,d)},Math.floor(0));b=b.healthyTimeout||0;0<b&&(a.Yb=setTimeout(function(){a.Yb=null;a.Na||(a.B&&102400<a.B.Ha?(a.e(\"Connection exceeded healthy timeout but has received \"+a.B.Ha+\" bytes.  Marking connection healthy.\"),a.Na=!0,a.B.$b()):a.B&&10240<a.B.Ia?a.e(\"Connection exceeded healthy timeout but has sent \"+\na.B.Ia+\" bytes.  Leaving connection alive.\"):(a.e(\"Closing unhealthy connection after timeout.\"),a.close()))},Math.floor(b)))}function gd(a,b){return function(c){b===a.B?(a.B=null,c||0!==a.ma?1===a.ma&&a.e(\"Realtime connection lost.\"):(a.e(\"Realtime connection failed.\"),\"s-\"===a.M.ga.substr(0,2)&&(nb.remove(\"host:\"+a.M.host),a.M.ga=a.M.host)),a.close()):b===a.w?(a.e(\"Secondary connection lost.\"),c=a.w,a.w=null,a.Pb!==c&&a.Mb!==c||a.close()):a.e(\"closing an old connection\")}}\nfunction fd(a,b){return function(c){if(2!=a.ma)if(b===a.Mb){var d=$b(\"t\",c);c=$b(\"d\",c);if(\"c\"==d){if(d=$b(\"t\",c),\"d\"in c)if(c=c.d,\"h\"===d){var d=c.ts,e=c.v,f=c.h;a.sc=c.s;qb(a.M,f);0==a.ma&&(a.B.start(),hd(a,a.B,d),\"5\"!==e&&L(\"Protocol version mismatch detected\"),c=a.Cd,(c=1<c.Ob.length?c.Ob[1]:null)&&id(a,c))}else if(\"n\"===d){a.e(\"recvd end transmission on primary\");a.Mb=a.w;for(c=0;c<a.ic.length;++c)a.gc(a.ic[c]);a.ic=[];jd(a)}else\"s\"===d?(a.e(\"Connection shutdown command received. Shutting down...\"),\na.Oc&&(a.Oc(c),a.Oc=null),a.S=null,a.close()):\"r\"===d?(a.e(\"Reset packet received.  New host: \"+c),qb(a.M,c),1===a.ma?a.close():(kd(a),ed(a))):\"e\"===d?Ub(\"Server Error: \"+c):\"o\"===d?(a.e(\"got pong on primary.\"),ld(a),md(a)):Ub(\"Unknown control packet command: \"+d)}else\"d\"==d&&a.gc(c)}else if(b===a.w)if(d=$b(\"t\",c),c=$b(\"d\",c),\"c\"==d)\"t\"in c&&(c=c.t,\"a\"===c?nd(a):\"r\"===c?(a.e(\"Got a reset on secondary, closing it\"),a.w.close(),a.Pb!==a.w&&a.Mb!==a.w||a.close()):\"o\"===c&&(a.e(\"got pong on secondary.\"),\na.xd--,nd(a)));else if(\"d\"==d)a.ic.push(c);else throw Error(\"Unknown protocol layer: \"+d);else a.e(\"message on old connection\")}}dd.prototype.yd=function(a){od(this,{t:\"d\",d:a})};function jd(a){a.Pb===a.w&&a.Mb===a.w&&(a.e(\"cleaning up and promoting a connection: \"+a.w.Cc),a.B=a.w,a.w=null)}\nfunction nd(a){0>=a.xd?(a.e(\"Secondary connection is healthy.\"),a.Na=!0,a.w.$b(),a.w.start(),a.e(\"sending client ack on secondary\"),a.w.send({t:\"c\",d:{t:\"a\",d:{}}}),a.e(\"Ending transmission on primary\"),a.B.send({t:\"c\",d:{t:\"n\",d:{}}}),a.Pb=a.w,jd(a)):(a.e(\"sending ping on secondary.\"),a.w.send({t:\"c\",d:{t:\"p\",d:{}}}))}dd.prototype.gc=function(a){ld(this);this.Pc(a)};function ld(a){a.Na||(a.Tc--,0>=a.Tc&&(a.e(\"Primary connection is healthy.\"),a.Na=!0,a.B.$b()))}\nfunction id(a,b){a.w=new b(\"c:\"+a.id+\":\"+a.cd++,a.M,a.sc);a.xd=b.responsesRequiredToBeHealthy||0;a.w.open(fd(a,a.w),gd(a,a.w));setTimeout(function(){a.w&&(a.e(\"Timed out trying to upgrade.\"),a.w.close())},Math.floor(6E4))}function hd(a,b,c){a.e(\"Realtime connection established.\");a.B=b;a.ma=1;a.Cb&&(a.Cb(c),a.Cb=null);0===a.Tc?(a.e(\"Primary connection is healthy.\"),a.Na=!0):setTimeout(function(){md(a)},Math.floor(5E3))}\nfunction md(a){a.Na||1!==a.ma||(a.e(\"sending ping on primary.\"),od(a,{t:\"c\",d:{t:\"p\",d:{}}}))}function od(a,b){if(1!==a.ma)throw\"Connection is not connected\";a.Pb.send(b)}dd.prototype.close=function(){2!==this.ma&&(this.e(\"Closing realtime connection.\"),this.ma=2,kd(this),this.S&&(this.S(),this.S=null))};function kd(a){a.e(\"Shutting down all connections\");a.B&&(a.B.close(),a.B=null);a.w&&(a.w.close(),a.w=null);a.Yb&&(clearTimeout(a.Yb),a.Yb=null)};function pd(a,b,c,d,e,f){this.id=qd++;this.e=Tb(\"p:\"+this.id+\":\");this.Sa=!0;this.ha={};this.T=[];this.Eb=0;this.Bb=[];this.R=!1;this.sa=1E3;this.ac=3E5;this.hc=b||ba;this.fc=c||ba;this.Ab=d||ba;this.Qc=e||ba;this.Hc=f||ba;this.M=a;this.Vc=null;this.Lb={};this.ce=0;this.wb=this.Lc=null;rd(this,0);wc.sb().fb(\"visible\",this.Yd,this);-1===a.host.indexOf(\"fblocal\")&&xc.sb().fb(\"online\",this.Xd,this)}var qd=0,sd=0;h=pd.prototype;\nh.Ea=function(a,b,c){var d=++this.ce;a={r:d,a:a,b:b};this.e(u(a));v(this.R,\"sendRequest_ call when we're not connected not allowed.\");this.ka.yd(a);c&&(this.Lb[d]=c)};function td(a,b,c){var d=b.toString(),e=b.path().toString();a.ha[e]=a.ha[e]||{};v(!a.ha[e][d],\"listen() called twice for same path/queryId.\");a.ha[e][d]={hb:b.hb(),D:c};a.R&&ud(a,e,d,b.hb(),c)}\nfunction ud(a,b,c,d,e){a.e(\"Listen on \"+b+\" for \"+c);var f={p:b};d=Ab(d,function(a){return Ka(a)});\"{}\"!==c&&(f.q=d);f.h=a.Hc(b);a.Ea(\"l\",f,function(d){a.e(\"listen response\",d);d=d.s;\"ok\"!==d&&vd(a,b,c);e&&e(d)})}\nh.mb=function(a,b,c){this.Ka={Jd:a,hd:!1,aa:b,Ub:c};this.e(\"Authenticating using credential: \"+this.Ka);wd(this);if(!(b=40==a.length))a:{var d;try{var e=a.split(\".\");if(3!==e.length){b=!1;break a}var f;b:{try{if(\"undefined\"!==typeof atob){f=atob(e[1]);break b}}catch(g){K(\"base64DecodeIfNativeSupport failed: \",g)}f=null}null!==f&&(d=ra(f))}catch(k){K(\"isAdminAuthToken_ failed\",k)}b=\"object\"===typeof d&&!0===wa(d,\"admin\")}b&&(this.e(\"Admin auth credential detected.  Reducing max reconnect time.\"),this.ac=\n3E4)};h.Qb=function(a){delete this.Ka;this.Ab(!1);this.R&&this.Ea(\"unauth\",{},function(b){a(b.s,b.d)})};function wd(a){var b=a.Ka;a.R&&b&&a.Ea(\"auth\",{cred:b.Jd},function(c){var d=c.s;c=c.d||\"error\";\"ok\"!==d&&a.Ka===b&&delete a.Ka;a.Ab(\"ok\"===d);b.hd?\"ok\"!==d&&b.Ub&&b.Ub(d,c):(b.hd=!0,b.aa&&b.aa(d,c))})}function xd(a,b,c,d){b=b.toString();vd(a,b,c)&&a.R&&yd(a,b,c,d)}function yd(a,b,c,d){a.e(\"Unlisten on \"+b+\" for \"+c);b={p:b};d=Ab(d,function(a){return Ka(a)});\"{}\"!==c&&(b.q=d);a.Ea(\"u\",b)}\nfunction zd(a,b,c,d){a.R?Ad(a,\"o\",b,c,d):a.Bb.push({Sc:b,action:\"o\",data:c,D:d})}function Bd(a,b,c,d){a.R?Ad(a,\"om\",b,c,d):a.Bb.push({Sc:b,action:\"om\",data:c,D:d})}h.Nc=function(a,b){this.R?Ad(this,\"oc\",a,null,b):this.Bb.push({Sc:a,action:\"oc\",data:null,D:b})};function Ad(a,b,c,d,e){c={p:c,d:d};a.e(\"onDisconnect \"+b,c);a.Ea(b,c,function(a){e&&setTimeout(function(){e(a.s,a.d)},Math.floor(0))})}h.put=function(a,b,c,d){Cd(this,\"p\",a,b,c,d)};function Dd(a,b,c,d){Cd(a,\"m\",b,c,d,void 0)}\nfunction Cd(a,b,c,d,e,f){c={p:c,d:d};n(f)&&(c.h=f);a.T.push({action:b,ud:c,D:e});a.Eb++;b=a.T.length-1;a.R&&Ed(a,b)}function Ed(a,b){var c=a.T[b].action,d=a.T[b].ud,e=a.T[b].D;a.T[b].$d=a.R;a.Ea(c,d,function(d){a.e(c+\" response\",d);delete a.T[b];a.Eb--;0===a.Eb&&(a.T=[]);e&&e(d.s,d.d)})}\nh.gc=function(a){if(\"r\"in a){this.e(\"from server: \"+u(a));var b=a.r,c=this.Lb[b];c&&(delete this.Lb[b],c(a.b))}else{if(\"error\"in a)throw\"A server-side error has occurred: \"+a.error;\"a\"in a&&(b=a.a,c=a.b,this.e(\"handleServerMessage\",b,c),\"d\"===b?this.hc(c.p,c.d,!1):\"m\"===b?this.hc(c.p,c.d,!0):\"c\"===b?Fd(this,c.p,c.q):\"ac\"===b?(a=c.s,b=c.d,c=this.Ka,delete this.Ka,c&&c.Ub&&c.Ub(a,b),this.Ab(!1)):\"sd\"===b?this.Vc?this.Vc(c):\"msg\"in c&&\"undefined\"!==typeof console&&console.log(\"FIREBASE: \"+c.msg.replace(\"\\n\",\n\"\\nFIREBASE: \")):Ub(\"Unrecognized action received from server: \"+u(b)+\"\\nAre you using the latest client?\"))}};h.Cb=function(a){this.e(\"connection ready\");this.R=!0;this.wb=(new Date).getTime();this.Qc({serverTimeOffset:a-(new Date).getTime()});wd(this);for(var b in this.ha)for(var c in this.ha[b])a=this.ha[b][c],ud(this,b,c,a.hb,a.D);for(b=0;b<this.T.length;b++)this.T[b]&&Ed(this,b);for(;this.Bb.length;)b=this.Bb.shift(),Ad(this,b.action,b.Sc,b.data,b.D);this.fc(!0)};\nfunction rd(a,b){v(!a.ka,\"Scheduling a connect when we're already connected/ing?\");a.Za&&clearTimeout(a.Za);a.Za=setTimeout(function(){a.Za=null;Gd(a)},Math.floor(b))}h.Yd=function(a){a&&!this.lb&&this.sa===this.ac&&(this.e(\"Window became visible.  Reducing delay.\"),this.sa=1E3,this.ka||rd(this,0));this.lb=a};\nh.Xd=function(a){a?(this.e(\"Browser went online.  Reconnecting.\"),this.sa=1E3,this.Sa=!0,this.ka||rd(this,0)):(this.e(\"Browser went offline.  Killing connection; don't reconnect.\"),this.Sa=!1,this.ka&&this.ka.close())};\nh.qd=function(){this.e(\"data client disconnected\");this.R=!1;this.ka=null;for(var a=0;a<this.T.length;a++){var b=this.T[a];b&&\"h\"in b.ud&&b.$d&&(b.D&&b.D(\"disconnect\"),delete this.T[a],this.Eb--)}0===this.Eb&&(this.T=[]);if(this.Sa)this.lb?this.wb&&(3E4<(new Date).getTime()-this.wb&&(this.sa=1E3),this.wb=null):(this.e(\"Window isn't visible.  Delaying reconnect.\"),this.sa=this.ac,this.Lc=(new Date).getTime()),a=Math.max(0,this.sa-((new Date).getTime()-this.Lc)),a*=Math.random(),this.e(\"Trying to reconnect in \"+\na+\"ms\"),rd(this,a),this.sa=Math.min(this.ac,1.3*this.sa);else for(var c in this.Lb)delete this.Lb[c];this.fc(!1)};function Gd(a){if(a.Sa){a.e(\"Making a connection attempt\");a.Lc=(new Date).getTime();a.wb=null;var b=r(a.gc,a),c=r(a.Cb,a),d=r(a.qd,a),e=a.id+\":\"+sd++;a.ka=new dd(e,a.M,b,c,d,function(b){L(b+\" (\"+a.M.toString()+\")\");a.Sa=!1})}}h.La=function(){this.Sa=!1;this.ka?this.ka.close():(this.Za&&(clearTimeout(this.Za),this.Za=null),this.R&&this.qd())};\nh.jb=function(){this.Sa=!0;this.sa=1E3;this.R||rd(this,0)};function Fd(a,b,c){c=c?Ab(c,function(a){return La(a)}).join(\"$\"):\"{}\";(a=vd(a,b,c))&&a.D&&a.D(\"permission_denied\")}function vd(a,b,c){b=(new F(b)).toString();c||(c=\"{}\");var d=a.ha[b][c];delete a.ha[b][c];return d};function Hd(){this.n=this.F=null}function Id(a,b,c){if(b.f())a.F=c,a.n=null;else if(null!==a.F)a.F=a.F.ya(b,c);else{null==a.n&&(a.n=new Pc);var d=C(b);a.n.contains(d)||a.n.add(d,new Hd);a=a.n.get(d);b=Ma(b);Id(a,b,c)}}function Jd(a,b){if(b.f())return a.F=null,a.n=null,!0;if(null!==a.F){if(a.F.O())return!1;var c=a.F;a.F=null;c.A(function(b,c){Id(a,new F(b),c)});return Jd(a,b)}return null!==a.n?(c=C(b),b=Ma(b),a.n.contains(c)&&Jd(a.n.get(c),b)&&a.n.remove(c),a.n.f()?(a.n=null,!0):!1):!0}\nfunction Kd(a,b,c){null!==a.F?c(b,a.F):a.A(function(a,e){var f=new F(b.toString()+\"/\"+a);Kd(e,f,c)})}Hd.prototype.A=function(a){null!==this.n&&R(this.n,function(b,c){a(b,c)})};function Ld(){this.$=M}function S(a,b){return a.$.K(b)}function T(a,b,c){a.$=a.$.ya(b,c)}Ld.prototype.toString=function(){return this.$.toString()};function Md(){this.ta=new Ld;this.L=new Ld;this.oa=new Ld;this.Gb=new Qa}function Nd(a,b,c){T(a.ta,b,c);return Od(a,b)}function Od(a,b){for(var c=S(a.ta,b),d=S(a.L,b),e=I(a.Gb,b),f=!1,g=e;null!==g;){if(null!==g.j()){f=!0;break}g=g.parent()}if(f)return!1;c=Pd(c,d,e);return c!==d?(T(a.L,b,c),!0):!1}function Pd(a,b,c){if(c.f())return a;if(null!==c.j())return b;a=a||M;c.A(function(d){d=d.name();var e=a.N(d),f=b.N(d),g=I(c,d),e=Pd(e,f,g);a=a.H(d,e)});return a}\nMd.prototype.set=function(a,b){var c=this,d=[];zb(b,function(a){var b=a.path;a=a.ra;var g=Ob();J(I(c.Gb,b),g);T(c.L,b,a);d.push({path:b,ee:g})});return d};function Qd(a,b){zb(b,function(b){var d=b.ee;b=I(a.Gb,b.path);var e=b.j();v(null!==e,\"pendingPut should not be null.\");e===d&&J(b,null)})};function Rd(a,b){return a&&\"object\"===typeof a?(v(\".sv\"in a,\"Unexpected leaf node or priority contents\"),b[a[\".sv\"]]):a}function Sd(a,b){var c=new Hd;Kd(a,new F(\"\"),function(a,e){Id(c,a,Td(e,b))});return c}function Td(a,b){var c=Rd(a.k(),b),d;if(a.O()){var e=Rd(a.j(),b);return e!==a.j()||c!==a.k()?new jc(e,c):a}d=a;c!==a.k()&&(d=d.Ga(c));a.A(function(a,c){var e=Td(c,b);e!==c&&(d=d.H(a,e))});return d};function Ud(){this.$a=[]}function Vd(a,b){if(0!==b.length)for(var c=0;c<b.length;c++)a.$a.push(b[c])}Ud.prototype.Jb=function(){for(var a=0;a<this.$a.length;a++)if(this.$a[a]){var b=this.$a[a];this.$a[a]=null;Wd(b)}this.$a=[]};function Wd(a){var b=a.aa,c=a.zd,d=a.Ib;ic(function(){b(c,d)})};function U(a,b,c,d){this.type=a;this.ua=b;this.ba=c;this.Ib=d};function Xd(a){this.Q=a;this.pa=[];this.Ec=new Ud}function Yd(a,b,c,d,e){a.pa.push({type:b,aa:c,cancel:d,Y:e});d=[];var f=Zd(a.i);a.ub&&f.push(new U(\"value\",a.i));for(var g=0;g<f.length;g++)if(f[g].type===b){var k=new E(a.Q.m,a.Q.path);f[g].ba&&(k=k.G(f[g].ba));d.push({aa:dc(c,e),zd:new P(f[g].ua,k),Ib:f[g].Ib})}Vd(a.Ec,d)}Xd.prototype.lc=function(a,b){b=this.mc(a,b);null!=b&&$d(this,b)};\nfunction $d(a,b){for(var c=[],d=0;d<b.length;d++){var e=b[d],f=e.type,g=new E(a.Q.m,a.Q.path);b[d].ba&&(g=g.G(b[d].ba));g=new P(b[d].ua,g);\"value\"!==e.type||g.tb()?\"value\"!==e.type&&(f+=\" \"+g.name()):f+=\"(\"+g.V()+\")\";K(a.Q.m.u.id+\": event:\"+a.Q.path+\":\"+a.Q.Qa()+\":\"+f);for(f=0;f<a.pa.length;f++){var k=a.pa[f];b[d].type===k.type&&c.push({aa:dc(k.aa,k.Y),zd:g,Ib:e.Ib})}}Vd(a.Ec,c)}Xd.prototype.Jb=function(){this.Ec.Jb()};\nfunction Zd(a){var b=[];if(!a.O()){var c=null;a.A(function(a,e){b.push(new U(\"child_added\",e,a,c));c=a})}return b}function ae(a){a.ub||(a.ub=!0,$d(a,[new U(\"value\",a.i)]))};function be(a,b){Xd.call(this,a);this.i=b}ka(be,Xd);be.prototype.mc=function(a,b){this.i=a;this.ub&&null!=b&&b.push(new U(\"value\",this.i));return b};be.prototype.rb=function(){return{}};function ce(a,b){this.Wb=a;this.Mc=b}function de(a,b,c,d,e){var f=a.K(c),g=b.K(c);d=new ce(d,e);e=ee(d,c,f,g);g=!f.f()&&!g.f()&&f.k()!==g.k();if(e||g)for(f=c,c=e;null!==f.parent();){var k=a.K(f);e=b.K(f);var l=f.parent();if(!d.Wb||I(d.Wb,l).j()){var m=b.K(l),p=[],f=Na(f);k.f()?(k=m.fa(f,e),p.push(new U(\"child_added\",e,f,k))):e.f()?p.push(new U(\"child_removed\",k,f)):(k=m.fa(f,e),g&&p.push(new U(\"child_moved\",e,f,k)),c&&p.push(new U(\"child_changed\",e,f,k)));d.Mc(l,m,p)}g&&(g=!1,c=!0);f=l}}\nfunction ee(a,b,c,d){var e,f=[];c===d?e=!1:c.O()&&d.O()?e=c.j()!==d.j():c.O()?(fe(a,b,M,d,f),e=!0):d.O()?(fe(a,b,c,M,f),e=!0):e=fe(a,b,c,d,f);e?a.Mc(b,d,f):c.k()!==d.k()&&a.Mc(b,d,null);return e}\nfunction fe(a,b,c,d,e){var f=!1,g=!a.Wb||!I(a.Wb,b).f(),k=[],l=[],m=[],p=[],t={},s={},w,V,G,H;w=c.ab();G=Za(w);V=d.ab();for(H=Za(V);null!==G||null!==H;){c=H;c=null===G?1:null===c?-1:G.key===c.key?0:lc({name:G.key,ja:G.value.k()},{name:c.key,ja:c.value.k()});if(0>c)f=wa(t,G.key),n(f)?(m.push({Gc:G,$c:k[f]}),k[f]=null):(s[G.key]=l.length,l.push(G)),f=!0,G=Za(w);else{if(0<c)f=wa(s,H.key),n(f)?(m.push({Gc:l[f],$c:H}),l[f]=null):(t[H.key]=k.length,k.push(H)),f=!0;else{c=b.G(H.key);if(c=ee(a,c,G.value,\nH.value))p.push(H),f=!0;G.value.k()!==H.value.k()&&(m.push({Gc:G,$c:H}),f=!0);G=Za(w)}H=Za(V)}if(!g&&f)return!0}for(g=0;g<l.length;g++)if(t=l[g])c=b.G(t.key),ee(a,c,t.value,M),e.push(new U(\"child_removed\",t.value,t.key));for(g=0;g<k.length;g++)if(t=k[g])c=b.G(t.key),l=d.fa(t.key,t.value),ee(a,c,M,t.value),e.push(new U(\"child_added\",t.value,t.key,l));for(g=0;g<m.length;g++)t=m[g].Gc,k=m[g].$c,c=b.G(k.key),l=d.fa(k.key,k.value),e.push(new U(\"child_moved\",k.value,k.key,l)),(c=ee(a,c,t.value,k.value))&&\np.push(k);for(g=0;g<p.length;g++)a=p[g],l=d.fa(a.key,a.value),e.push(new U(\"child_changed\",a.value,a.key,l));return f};function ge(){this.X=this.xa=null;this.set={}}ka(ge,Pc);h=ge.prototype;h.setActive=function(a){this.xa=a};function he(a,b,c){a.add(b,c);a.X||(a.X=c.Q.path)}function ie(a){var b=a.xa;a.xa=null;return b}function je(a){return a.contains(\"default\")}function ke(a){return null!=a.xa&&je(a)}h.defaultView=function(){return je(this)?this.get(\"default\"):null};h.path=function(){return this.X};h.toString=function(){return Ab(this.keys(),function(a){return\"default\"===a?\"{}\":a}).join(\"$\")};\nh.hb=function(){var a=[];R(this,function(b,c){a.push(c.Q)});return a};function le(a,b){Xd.call(this,a);this.i=M;this.mc(b,Zd(b))}ka(le,Xd);\nle.prototype.mc=function(a,b){if(null===b)return b;var c=[],d=this.Q;n(d.da)&&(n(d.wa)&&null!=d.wa?c.push(function(a,b){var c=Xb(b,d.da);return 0<c||0===c&&0<=Yb(a,d.wa)}):c.push(function(a,b){return 0<=Xb(b,d.da)}));n(d.Aa)&&(n(d.Ya)?c.push(function(a,b){var c=Xb(b,d.Aa);return 0>c||0===c&&0>=Yb(a,d.Ya)}):c.push(function(a,b){return 0>=Xb(b,d.Aa)}));var e=null,f=null;if(n(this.Q.Ca))if(n(this.Q.da)){if(e=me(a,c,this.Q.Ca,!1)){var g=a.N(e).k();c.push(function(a,b){var c=Xb(b,g);return 0>c||0===c&&\n0>=Yb(a,e)})}}else if(f=me(a,c,this.Q.Ca,!0)){var k=a.N(f).k();c.push(function(a,b){var c=Xb(b,k);return 0<c||0===c&&0<=Yb(a,f)})}for(var l=[],m=[],p=[],t=[],s=0;s<b.length;s++){var w=b[s].ba,V=b[s].ua;switch(b[s].type){case \"child_added\":ne(c,w,V)&&(this.i=this.i.H(w,V),m.push(b[s]));break;case \"child_removed\":this.i.N(w).f()||(this.i=this.i.H(w,null),l.push(b[s]));break;case \"child_changed\":!this.i.N(w).f()&&ne(c,w,V)&&(this.i=this.i.H(w,V),t.push(b[s]));break;case \"child_moved\":var G=!this.i.N(w).f(),\nH=ne(c,w,V);G?H?(this.i=this.i.H(w,V),p.push(b[s])):(l.push(new U(\"child_removed\",this.i.N(w),w)),this.i=this.i.H(w,null)):H&&(this.i=this.i.H(w,V),m.push(b[s]))}}var Xc=e||f;if(Xc){var Yc=(s=null!==f)?this.i.jd():this.i.ld(),hc=!1,ab=!1,bb=this;(s?a.Fc:a.A).call(a,function(a,b){ab||null!==Yc||(ab=!0);if(ab&&hc)return!0;hc?(l.push(new U(\"child_removed\",bb.i.N(a),a)),bb.i=bb.i.H(a,null)):ab&&(m.push(new U(\"child_added\",b,a)),bb.i=bb.i.H(a,b));Yc===a&&(ab=!0);a===Xc&&(hc=!0)})}for(s=0;s<m.length;s++)c=\nm[s],w=this.i.fa(c.ba,c.ua),l.push(new U(\"child_added\",c.ua,c.ba,w));for(s=0;s<p.length;s++)c=p[s],w=this.i.fa(c.ba,c.ua),l.push(new U(\"child_moved\",c.ua,c.ba,w));for(s=0;s<t.length;s++)c=t[s],w=this.i.fa(c.ba,c.ua),l.push(new U(\"child_changed\",c.ua,c.ba,w));this.ub&&0<l.length&&l.push(new U(\"value\",this.i));return l};function me(a,b,c,d){if(a.O())return null;var e=null;(d?a.Fc:a.A).call(a,function(a,d){if(ne(b,a,d)&&(e=a,c--,0===c))return!0});return e}\nfunction ne(a,b,c){for(var d=0;d<a.length;d++)if(!a[d](b,c.k()))return!1;return!0}le.prototype.Ic=function(a){return this.i.N(a)!==M};\nle.prototype.rb=function(a,b,c){var d={};this.i.O()||this.i.A(function(a){d[a]=3});var e=this.i;c=S(c,new F(\"\"));var f=new Qa;J(I(f,this.Q.path),!0);b=M.ya(a,b);var g=this;de(c,b,a,f,function(a,b,c){null!==c&&a.toString()===g.Q.path.toString()&&g.mc(b,c)});this.i.O()?cc(d,function(a,b){d[b]=2}):(this.i.A(function(a){A(d,a)||(d[a]=1)}),cc(d,function(a,b){g.i.N(b).f()&&(d[b]=2)}));this.i=e;return d};function oe(a,b){this.u=a;this.g=b;this.ec=b.$;this.na=new Qa}oe.prototype.Sb=function(a,b,c,d,e){var f=a.path,g=I(this.na,f),k=g.j();null===k?(k=new ge,J(g,k)):v(!k.f(),\"We shouldn't be storing empty QueryMaps\");var l=a.Qa();if(k.contains(l))a=k.get(l),Yd(a,b,c,d,e);else{var m=this.g.$.K(f);a=pe(a,m);qe(this,g,k,l,a);Yd(a,b,c,d,e);(b=(b=Ta(I(this.na,f),function(a){var b;if(b=a.j()&&a.j().defaultView())b=a.j().defaultView().ub;if(b)return!0},!0))||null===this.u&&!S(this.g,f).f())&&ae(a)}a.Jb()};\nfunction re(a,b,c,d,e){var f=a.get(b),g;if(g=f){g=!1;for(var k=f.pa.length-1;0<=k;k--){var l=f.pa[k];if(!(c&&l.type!==c||d&&l.aa!==d||e&&l.Y!==e)&&(f.pa.splice(k,1),g=!0,c&&d))break}}(c=g&&!(0<f.pa.length))&&a.remove(b);return c}function se(a,b,c,d,e){b=b?b.Qa():null;var f=[];b&&\"default\"!==b?re(a,b,c,d,e)&&f.push(b):zb(a.keys(),function(b){re(a,b,c,d,e)&&f.push(b)});return f}oe.prototype.oc=function(a,b,c,d){var e=I(this.na,a.path).j();return null===e?null:te(this,e,a,b,c,d)};\nfunction te(a,b,c,d,e,f){var g=b.path(),g=I(a.na,g);c=se(b,c,d,e,f);b.f()&&J(g,null);d=ue(g);if(0<c.length&&!d){d=g;e=g.parent();for(c=!1;!c&&e;){if(f=e.j()){v(!ke(f));var k=d.name(),l=!1;R(f,function(a,b){l=b.Ic(k)||l});l&&(c=!0)}d=e;e=e.parent()}d=null;ke(b)||(b=ie(b),d=ve(a,g),b&&b());return c?null:d}return null}function we(a,b,c){Sa(I(a.na,b),function(a){(a=a.j())&&R(a,function(a,b){ae(b)})},c,!0)}\nfunction W(a,b,c){function d(a){do{if(g[a.toString()])return!0;a=a.parent()}while(null!==a);return!1}var e=a.ec,f=a.g.$;a.ec=f;for(var g={},k=0;k<c.length;k++)g[c[k].toString()]=!0;de(e,f,b,a.na,function(c,e,f){if(b.contains(c)){var g=d(c);g&&we(a,c,!1);a.lc(c,e,f);g&&we(a,c,!0)}else a.lc(c,e,f)});d(b)&&we(a,b,!0);xe(a,b)}function xe(a,b){var c=I(a.na,b);Sa(c,function(a){(a=a.j())&&R(a,function(a,b){b.Jb()})},!0,!0);Ta(c,function(a){(a=a.j())&&R(a,function(a,b){b.Jb()})},!1)}\noe.prototype.lc=function(a,b,c){a=I(this.na,a).j();null!==a&&R(a,function(a,e){e.lc(b,c)})};function ue(a){return Ta(a,function(a){return a.j()&&ke(a.j())})}function qe(a,b,c,d,e){if(ke(c)||ue(b))he(c,d,e);else{var f,g;c.f()||(f=c.toString(),g=c.hb());he(c,d,e);c.setActive(ye(a,c));f&&g&&xd(a.u,c.path(),f,g)}ke(c)&&Sa(b,function(a){if(a=a.j())a.xa&&a.xa(),a.xa=null})}\nfunction ve(a,b){function c(b){var f=b.j();if(f&&je(f))d.push(f.path()),null==f.xa&&f.setActive(ye(a,f));else{if(f){null!=f.xa||f.setActive(ye(a,f));var g={};R(f,function(a,b){b.i.A(function(a){A(g,a)||(g[a]=!0,a=f.path().G(a),d.push(a))})})}b.A(c)}}var d=[];c(b);return d}\nfunction ye(a,b){if(a.u){var c=a.u,d=b.path(),e=b.toString(),f=b.hb(),g,k=b.keys(),l=je(b);td(a.u,b,function(c){\"ok\"!==c?(c=fc(c),L(\"on() or once() for \"+b.path().toString()+\" failed: \"+c.toString()),ze(a,b,c)):g||(l?we(a,b.path(),!0):zb(k,function(a){(a=b.get(a))&&ae(a)}),xe(a,b.path()))});return function(){g=!0;xd(c,d,e,f)}}return ba}function ze(a,b,c){b&&(R(b,function(a,b){for(var f=0;f<b.pa.length;f++){var g=b.pa[f];g.cancel&&dc(g.cancel,g.Y)(c)}}),te(a,b))}\nfunction pe(a,b){return\"default\"===a.Qa()?new be(a,b):new le(a,b)}oe.prototype.rb=function(a,b,c,d){function e(a){cc(a,function(a,b){f[b]=3===a?3:(wa(f,b)||a)===a?a:3})}var f={};R(b,function(b,f){e(f.rb(a,c,d))});c.O()||c.A(function(a){A(f,a)||(f[a]=4)});return f};function Ae(a,b,c,d,e){var f=b.path();b=a.rb(f,b,d,e);var g=M,k=[];cc(b,function(b,m){var p=new F(m);3===b||1===b?g=g.H(m,d.K(p)):(2===b&&k.push({path:f.G(m),ra:M}),k=k.concat(Be(a,d.K(p),I(c,p),e)))});return[{path:f,ra:g}].concat(k)}\nfunction Ce(a,b,c,d){var e;a:{var f=I(a.na,b);e=f.parent();for(var g=[];null!==e;){var k=e.j();if(null!==k){if(je(k)){e=[{path:b,ra:c}];break a}k=a.rb(b,k,c,d);f=wa(k,f.name());if(3===f||1===f){e=[{path:b,ra:c}];break a}2===f&&g.push({path:b,ra:M})}f=e;e=e.parent()}e=g}if(1==e.length&&(!e[0].ra.f()||c.f()))return e;g=I(a.na,b);f=g.j();null!==f?je(f)?e.push({path:b,ra:c}):e=e.concat(Ae(a,f,g,c,d)):e=e.concat(Be(a,c,g,d));return e}\nfunction Be(a,b,c,d){var e=c.j();if(null!==e)return je(e)?[{path:c.path(),ra:b}]:Ae(a,e,c,b,d);var f=[];c.A(function(c){var e=b.O()?M:b.N(c.name());c=Be(a,e,c,d);f=f.concat(c)});return f};function De(a){this.M=a;this.ea=Gc(a);this.u=new pd(this.M,r(this.hc,this),r(this.fc,this),r(this.Ab,this),r(this.Qc,this),r(this.Hc,this));this.Bd=Hc(a,r(function(){return new Dc(this.ea,this.u)},this));this.Ta=new Qa;this.Fa=new Ld;this.g=new Md;this.I=new oe(this.u,this.g.oa);this.Jc=new Ld;this.Kc=new oe(null,this.Jc);Ee(this,\"connected\",!1);Ee(this,\"authenticated\",!1);this.S=new Hd;this.Vb=0}h=De.prototype;h.toString=function(){return(this.M.qc?\"https://\":\"http://\")+this.M.host};h.name=function(){return this.M.bc};\nfunction Fe(a){a=S(a.Jc,new F(\".info/serverTimeOffset\")).V()||0;return(new Date).getTime()+a}function Ge(a){a=a={timestamp:Fe(a)};a.timestamp=a.timestamp||(new Date).getTime();return a}\nh.hc=function(a,b,c){this.Vb++;this.nd&&(b=this.nd(a,b));var d,e,f=[];9<=a.length&&a.lastIndexOf(\".priority\")===a.length-9?(d=new F(a.substring(0,a.length-9)),e=S(this.g.ta,d).Ga(b),f.push(d)):c?(d=new F(a),e=S(this.g.ta,d),cc(b,function(a,b){var c=new F(b);\".priority\"===b?e=e.Ga(a):(e=e.ya(c,O(a)),f.push(d.G(b)))})):(d=new F(a),e=O(b),f.push(d));a=Ce(this.I,d,e,this.g.L);b=!1;for(c=0;c<a.length;++c){var g=a[c];b=Nd(this.g,g.path,g.ra)||b}b&&(d=He(this,d));W(this.I,d,f)};\nh.fc=function(a){Ee(this,\"connected\",a);!1===a&&Ie(this)};h.Qc=function(a){var b=this;bc(a,function(a,d){Ee(b,d,a)})};h.Hc=function(a){a=new F(a);return S(this.g.ta,a).hash()};h.Ab=function(a){Ee(this,\"authenticated\",a)};function Ee(a,b,c){b=new F(\"/.info/\"+b);T(a.Jc,b,O(c));W(a.Kc,b,[b])}\nh.mb=function(a,b,c){\"firebaseio-demo.com\"===this.M.domain&&L(\"FirebaseRef.auth() not supported on demo (*.firebaseio-demo.com) Firebases. Please use on production (*.firebaseio.com) Firebases only.\");this.u.mb(a,function(a,c){X(b,a,c)},function(a,b){L(\"auth() was canceled: \"+b);if(c){var f=Error(b);f.code=a.toUpperCase();c(f)}})};h.Qb=function(a){this.u.Qb(function(b,c){X(a,b,c)})};\nh.kb=function(a,b,c,d){this.e(\"set\",{path:a.toString(),value:b,ja:c});var e=Ge(this);b=O(b,c);var e=Td(b,e),e=Ce(this.I,a,e,this.g.L),f=this.g.set(a,e),g=this;this.u.put(a.toString(),b.V(!0),function(b,c){\"ok\"!==b&&L(\"set at \"+a+\" failed: \"+b);Qd(g.g,f);Od(g.g,a);var e=He(g,a);W(g.I,e,[]);X(d,b,c)});e=Je(this,a);He(this,e);W(this.I,e,[a])};\nh.update=function(a,b,c){this.e(\"update\",{path:a.toString(),value:b});var d=S(this.g.oa,a),e=!0,f=[],g=Ge(this),k=[],l;for(l in b){var e=!1,m=O(b[l]),m=Td(m,g),d=d.H(l,m),p=a.G(l);f.push(p);m=Ce(this.I,p,m,this.g.L);k=k.concat(this.g.set(a,m))}if(e)K(\"update() called with empty data.  Don't do anything.\"),X(c,\"ok\");else{var t=this;Dd(this.u,a.toString(),b,function(b,d){\"ok\"!==b&&L(\"update at \"+a+\" failed: \"+b);Qd(t.g,k);Od(t.g,a);var e=He(t,a);W(t.I,e,[]);X(c,b,d)});b=Je(this,a);He(this,b);W(t.I,\nb,f)}};h.Wc=function(a,b,c){this.e(\"setPriority\",{path:a.toString(),ja:b});var d=Ge(this),d=Rd(b,d),d=S(this.g.L,a).Ga(d),d=Ce(this.I,a,d,this.g.L),e=this.g.set(a,d),f=this;this.u.put(a.toString()+\"/.priority\",b,function(b,d){\"permission_denied\"===b&&L(\"setPriority at \"+a+\" failed: \"+b);Qd(f.g,e);Od(f.g,a);var l=He(f,a);W(f.I,l,[]);X(c,b,d)});b=He(this,a);W(f.I,b,[])};\nfunction Ie(a){a.e(\"onDisconnectEvents\");var b=[],c=Ge(a);Kd(Sd(a.S,c),new F(\"\"),function(c,e){var f=Ce(a.I,c,e,a.g.L);b.push.apply(b,a.g.set(c,f));f=Je(a,c);He(a,f);W(a.I,f,[c])});Qd(a.g,b);a.S=new Hd}h.Nc=function(a,b){var c=this;this.u.Nc(a.toString(),function(d,e){\"ok\"===d&&Jd(c.S,a);X(b,d,e)})};function Ke(a,b,c,d){var e=O(c);zd(a.u,b.toString(),e.V(!0),function(c,g){\"ok\"===c&&Id(a.S,b,e);X(d,c,g)})}\nfunction Le(a,b,c,d,e){var f=O(c,d);zd(a.u,b.toString(),f.V(!0),function(c,d){\"ok\"===c&&Id(a.S,b,f);X(e,c,d)})}function Me(a,b,c,d){var e=!0,f;for(f in c)e=!1;e?(K(\"onDisconnect().update() called with empty data.  Don't do anything.\"),X(d,\"ok\")):Bd(a.u,b.toString(),c,function(e,f){if(\"ok\"===e)for(var l in c){var m=O(c[l]);Id(a.S,b.G(l),m)}X(d,e,f)})}function Ne(a){Bc(a.ea,\"deprecated_on_disconnect\");a.Bd.Zc.deprecated_on_disconnect=!0}\nh.Sb=function(a,b,c,d,e){\".info\"===C(a.path)?this.Kc.Sb(a,b,c,d,e):this.I.Sb(a,b,c,d,e)};h.oc=function(a,b,c,d){if(\".info\"===C(a.path))this.Kc.oc(a,b,c,d);else{b=this.I.oc(a,b,c,d);if(c=null!==b){c=this.g;d=a.path;for(var e=[],f=0;f<b.length;++f)e[f]=S(c.ta,b[f]);T(c.ta,d,M);for(f=0;f<b.length;++f)T(c.ta,b[f],e[f]);c=Od(c,d)}c&&(v(this.g.oa.$===this.I.ec,\"We should have raised any outstanding events by now.  Else, we'll blow them away.\"),T(this.g.oa,a.path,S(this.g.L,a.path)),this.I.ec=this.g.oa.$)}};\nh.La=function(){this.u.La()};h.jb=function(){this.u.jb()};h.Xc=function(a){if(\"undefined\"!==typeof console){a?(this.tc||(this.tc=new Cc(this.ea)),a=this.tc.get()):a=this.ea.get();var b=Bb(yc(a),function(a,b){return Math.max(b.length,a)},0),c;for(c in a){for(var d=a[c],e=c.length;e<b+2;e++)c+=\" \";console.log(c+d)}}};h.Yc=function(a){Bc(this.ea,a);this.Bd.Zc[a]=!0};h.e=function(){K(\"r:\"+this.u.id+\":\",arguments)};\nfunction X(a,b,c){a&&ic(function(){if(\"ok\"==b)a(null,c);else{var d=(b||\"error\").toUpperCase(),e=d;c&&(e+=\": \"+c);e=Error(e);e.code=d;a(e)}})};function Oe(a,b,c,d,e){function f(){}a.e(\"transaction on \"+b);var g=new E(a,b);g.fb(\"value\",f);c={path:b,update:c,D:d,status:null,rd:Ob(),yc:e,wd:0,vc:function(){g.zb(\"value\",f)},wc:null};a.Fa.$=Pe(a,a.Fa.$,a.g.L.$,a.Ta);d=c.update(S(a.Fa,b).V());if(n(d)){Ba(\"transaction failed: Data returned \",d);c.status=1;e=I(a.Ta,b);var k=e.j()||[];k.push(c);J(e,k);k=\"object\"===typeof d&&null!==d&&A(d,\".priority\")?d[\".priority\"]:S(a.g.L,b).k();e=Ge(a);d=O(d,k);d=Td(d,e);T(a.Fa,b,d);c.yc&&(T(a.g.oa,b,d),W(a.I,\nb,[b]));Qe(a)}else c.vc(),c.D&&(a=Re(a,b),c.D(null,!1,a))}function Qe(a,b){var c=b||a.Ta;b||Se(a,c);if(null!==c.j()){var d=Te(a,c);v(0<d.length);Cb(d,function(a){return 1===a.status})&&Ue(a,c.path(),d)}else c.tb()&&c.A(function(b){Qe(a,b)})}\nfunction Ue(a,b,c){for(var d=0;d<c.length;d++)v(1===c[d].status,\"tryToSendTransactionQueue_: items in queue should all be run.\"),c[d].status=2,c[d].wd++;var e=S(a.g.L,b).hash();T(a.g.L,b,S(a.g.oa,b));for(var f=S(a.Fa,b).V(!0),g=Ob(),k=Ve(c),d=0;d<k.length;d++)J(I(a.g.Gb,k[d]),g);a.u.put(b.toString(),f,function(e){a.e(\"transaction put response\",{path:b.toString(),status:e});for(d=0;d<k.length;d++){var f=I(a.g.Gb,k[d]),p=f.j();v(null!==p,\"sendTransactionQueue_: pendingPut should not be null.\");p===\ng&&(J(f,null),T(a.g.L,k[d],S(a.g.ta,k[d])))}if(\"ok\"===e){e=[];for(d=0;d<c.length;d++)c[d].status=3,c[d].D&&(f=Re(a,c[d].path),e.push(r(c[d].D,null,null,!0,f))),c[d].vc();Se(a,I(a.Ta,b));Qe(a);for(d=0;d<e.length;d++)ic(e[d])}else{if(\"datastale\"===e)for(d=0;d<c.length;d++)c[d].status=4===c[d].status?5:1;else for(L(\"transaction at \"+b+\" failed: \"+e),d=0;d<c.length;d++)c[d].status=5,c[d].wc=e;e=He(a,b);W(a.I,e,[b])}},e)}\nfunction Ve(a){for(var b={},c=0;c<a.length;c++)a[c].yc&&(b[a[c].path.toString()]=a[c].path);a=[];for(var d in b)a.push(b[d]);return a}\nfunction He(a,b){var c=We(a,b),d=c.path(),c=Te(a,c);T(a.g.oa,d,S(a.g.L,d));T(a.Fa,d,S(a.g.L,d));if(0!==c.length){for(var e=S(a.g.oa,d),f=e,g=[],k=0;k<c.length;k++){var l=Oa(d,c[k].path),m=!1,p;v(null!==l,\"rerunTransactionsUnderNode_: relativePath should not be null.\");if(5===c[k].status)m=!0,p=c[k].wc;else if(1===c[k].status)if(25<=c[k].wd)m=!0,p=\"maxretry\";else{var t=e.K(l),s=c[k].update(t.V());if(n(s)){Ba(\"transaction failed: Data returned \",s);var w=O(s);\"object\"===typeof s&&null!=s&&A(s,\".priority\")||\n(w=w.Ga(t.k()));e=e.ya(l,w);c[k].yc&&(f=f.ya(l,w))}else m=!0,p=\"nodata\"}m&&(c[k].status=3,setTimeout(c[k].vc,Math.floor(0)),c[k].D&&(m=new E(a,c[k].path),l=new P(e.K(l),m),\"nodata\"===p?g.push(r(c[k].D,null,null,!1,l)):g.push(r(c[k].D,null,Error(p),!1,l))))}T(a.Fa,d,e);T(a.g.oa,d,f);Se(a,a.Ta);for(k=0;k<g.length;k++)ic(g[k]);Qe(a)}return d}function We(a,b){for(var c,d=a.Ta;null!==(c=C(b))&&null===d.j();)d=I(d,c),b=Ma(b);return d}\nfunction Te(a,b){var c=[];Xe(a,b,c);c.sort(function(a,b){return a.rd-b.rd});return c}function Xe(a,b,c){var d=b.j();if(null!==d)for(var e=0;e<d.length;e++)c.push(d[e]);b.A(function(b){Xe(a,b,c)})}function Se(a,b){var c=b.j();if(c){for(var d=0,e=0;e<c.length;e++)3!==c[e].status&&(c[d]=c[e],d++);c.length=d;J(b,0<c.length?c:null)}b.A(function(b){Se(a,b)})}function Je(a,b){var c=We(a,b).path(),d=I(a.Ta,b);Ta(d,function(a){Ye(a)});Ye(d);Sa(d,function(a){Ye(a)});return c}\nfunction Ye(a){var b=a.j();if(null!==b){for(var c=[],d=-1,e=0;e<b.length;e++)4!==b[e].status&&(2===b[e].status?(v(d===e-1,\"All SENT items should be at beginning of queue.\"),d=e,b[e].status=4,b[e].wc=\"set\"):(v(1===b[e].status),b[e].vc(),b[e].D&&c.push(r(b[e].D,null,Error(\"set\"),!1,null))));-1===d?J(a,null):b.length=d+1;for(e=0;e<c.length;e++)ic(c[e])}}function Re(a,b){var c=new E(a,b);return new P(S(a.Fa,b),c)}\nfunction Pe(a,b,c,d){if(d.f())return c;if(null!=d.j())return b;var e=c;d.A(function(d){var g=d.name(),k=new F(g);d=Pe(a,b.K(k),c.K(k),d);e=e.H(g,d)});return e};function Y(){this.ib={}}ca(Y);Y.prototype.La=function(){for(var a in this.ib)this.ib[a].La()};Y.prototype.interrupt=Y.prototype.La;Y.prototype.jb=function(){for(var a in this.ib)this.ib[a].jb()};Y.prototype.resume=Y.prototype.jb;var Z={Qd:function(a){var b=N.prototype.hash;N.prototype.hash=a;var c=jc.prototype.hash;jc.prototype.hash=a;return function(){N.prototype.hash=b;jc.prototype.hash=c}}};Z.hijackHash=Z.Qd;Z.Qa=function(a){return a.Qa()};Z.queryIdentifier=Z.Qa;Z.Td=function(a){return a.m.u.ha};Z.listens=Z.Td;Z.ae=function(a){return a.m.u.ka};Z.refConnection=Z.ae;Z.Ed=pd;Z.DataConnection=Z.Ed;pd.prototype.sendRequest=pd.prototype.Ea;pd.prototype.interrupt=pd.prototype.La;Z.Fd=dd;Z.RealTimeConnection=Z.Fd;\ndd.prototype.sendRequest=dd.prototype.yd;dd.prototype.close=dd.prototype.close;Z.Dd=pb;Z.ConnectionTarget=Z.Dd;Z.Nd=function(){Rc=Jc=!0};Z.forceLongPolling=Z.Nd;Z.Od=function(){Sc=!0};Z.forceWebSockets=Z.Od;Z.ge=function(a,b){a.m.u.Vc=b};Z.setSecurityDebugCallback=Z.ge;Z.Xc=function(a,b){a.m.Xc(b)};Z.stats=Z.Xc;Z.Yc=function(a,b){a.m.Yc(b)};Z.statsIncrementCounter=Z.Yc;Z.Vb=function(a){return a.m.Vb};Z.dataUpdateCount=Z.Vb;Z.Rd=function(a,b){a.m.nd=b};Z.interceptServerData=Z.Rd;function $(a,b,c){this.Kb=a;this.X=b;this.Da=c}$.prototype.cancel=function(a){x(\"Firebase.onDisconnect().cancel\",0,1,arguments.length);z(\"Firebase.onDisconnect().cancel\",1,a,!0);this.Kb.Nc(this.X,a)};$.prototype.cancel=$.prototype.cancel;$.prototype.remove=function(a){x(\"Firebase.onDisconnect().remove\",0,1,arguments.length);B(\"Firebase.onDisconnect().remove\",this.X);z(\"Firebase.onDisconnect().remove\",1,a,!0);Ke(this.Kb,this.X,null,a)};$.prototype.remove=$.prototype.remove;\n$.prototype.set=function(a,b){x(\"Firebase.onDisconnect().set\",1,2,arguments.length);B(\"Firebase.onDisconnect().set\",this.X);Aa(\"Firebase.onDisconnect().set\",a,!1);z(\"Firebase.onDisconnect().set\",2,b,!0);Ke(this.Kb,this.X,a,b)};$.prototype.set=$.prototype.set;\n$.prototype.kb=function(a,b,c){x(\"Firebase.onDisconnect().setWithPriority\",2,3,arguments.length);B(\"Firebase.onDisconnect().setWithPriority\",this.X);Aa(\"Firebase.onDisconnect().setWithPriority\",a,!1);Fa(\"Firebase.onDisconnect().setWithPriority\",2,b,!1);z(\"Firebase.onDisconnect().setWithPriority\",3,c,!0);if(\".length\"===this.Da||\".keys\"===this.Da)throw\"Firebase.onDisconnect().setWithPriority failed: \"+this.Da+\" is a read-only object.\";Le(this.Kb,this.X,a,b,c)};$.prototype.setWithPriority=$.prototype.kb;\n$.prototype.update=function(a,b){x(\"Firebase.onDisconnect().update\",1,2,arguments.length);B(\"Firebase.onDisconnect().update\",this.X);if(ea(a)){for(var c={},d=0;d<a.length;++d)c[\"\"+d]=a[d];a=c;L(\"Passing an Array to Firebase.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.\")}Ea(\"Firebase.onDisconnect().update\",a);z(\"Firebase.onDisconnect().update\",2,b,!0);Me(this.Kb,\nthis.X,a,b)};$.prototype.update=$.prototype.update;var Ze=function(){var a=0,b=[];return function(c){var d=c===a;a=c;for(var e=Array(8),f=7;0<=f;f--)e[f]=\"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\".charAt(c%64),c=Math.floor(c/64);v(0===c,\"Cannot push at time == 0\");c=e.join(\"\");if(d){for(f=11;0<=f&&63===b[f];f--)b[f]=0;b[f]++}else for(f=0;12>f;f++)b[f]=Math.floor(64*Math.random());for(f=0;12>f;f++)c+=\"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\".charAt(b[f]);v(20===c.length,\"NextPushId: Length should be 20.\");\nreturn c}}();function E(a,b){var c,d;if(a instanceof De)c=a,d=b;else{x(\"new Firebase\",1,2,arguments.length);var e=arguments[0];d=c=\"\";var f=!0,g=\"\";if(q(e)){var k=e.indexOf(\"//\");if(0<=k)var l=e.substring(0,k-1),e=e.substring(k+2);k=e.indexOf(\"/\");-1===k&&(k=e.length);c=e.substring(0,k);var e=e.substring(k+1),m=c.split(\".\");if(3==m.length){k=m[2].indexOf(\":\");f=0<=k?\"https\"===l||\"wss\"===l:!0;if(\"firebase\"===m[1])Vb(c+\" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead\");else for(d=m[0],\ng=\"\",e=(\"/\"+e).split(\"/\"),k=0;k<e.length;k++)if(0<e[k].length){m=e[k];try{m=decodeURIComponent(m.replace(/\\+/g,\" \"))}catch(p){}g+=\"/\"+m}d=d.toLowerCase()}else Vb(\"Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com\")}f||\"undefined\"!==typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf(\"https:\")&&L(\"Insecure Firebase access from a secure page. Please use https in calls to new Firebase().\");c=new pb(c,f,d,\"ws\"===l||\"wss\"===l);d=new F(g);\nf=d.toString();!(l=!q(c.host)||0===c.host.length||!za(c.bc))&&(l=0!==f.length)&&(f&&(f=f.replace(/^\\/*\\.info(\\/|$)/,\"/\")),l=!(q(f)&&0!==f.length&&!ya.test(f)));if(l)throw Error(y(\"new Firebase\",1,!1)+'must be a valid firebase URL and the path can\\'t contain \".\", \"#\", \"$\", \"[\", or \"]\".');if(b)if(b instanceof Y)f=b;else throw Error(\"Expected a valid Firebase.Context for second argument to new Firebase()\");else f=Y.sb();l=c.toString();e=wa(f.ib,l);e||(e=new De(c),f.ib[l]=e);c=e}D.call(this,c,d)}\nka(E,D);var $e=E,af=[\"Firebase\"],bf=aa;af[0]in bf||!bf.execScript||bf.execScript(\"var \"+af[0]);for(var cf;af.length&&(cf=af.shift());)!af.length&&n($e)?bf[cf]=$e:bf=bf[cf]?bf[cf]:bf[cf]={};E.prototype.name=function(){x(\"Firebase.name\",0,0,arguments.length);return this.path.f()?null:Na(this.path)};E.prototype.name=E.prototype.name;\nE.prototype.G=function(a){x(\"Firebase.child\",1,1,arguments.length);if(ga(a))a=String(a);else if(!(a instanceof F))if(null===C(this.path)){var b=a;b&&(b=b.replace(/^\\/*\\.info(\\/|$)/,\"/\"));Ia(\"Firebase.child\",b)}else Ia(\"Firebase.child\",a);return new E(this.m,this.path.G(a))};E.prototype.child=E.prototype.G;E.prototype.parent=function(){x(\"Firebase.parent\",0,0,arguments.length);var a=this.path.parent();return null===a?null:new E(this.m,a)};E.prototype.parent=E.prototype.parent;\nE.prototype.root=function(){x(\"Firebase.ref\",0,0,arguments.length);for(var a=this;null!==a.parent();)a=a.parent();return a};E.prototype.root=E.prototype.root;E.prototype.toString=function(){x(\"Firebase.toString\",0,0,arguments.length);var a;if(null===this.parent())a=this.m.toString();else{a=this.parent().toString()+\"/\";var b=this.name();a+=encodeURIComponent(String(b))}return a};E.prototype.toString=E.prototype.toString;\nE.prototype.set=function(a,b){x(\"Firebase.set\",1,2,arguments.length);B(\"Firebase.set\",this.path);Aa(\"Firebase.set\",a,!1);z(\"Firebase.set\",2,b,!0);this.m.kb(this.path,a,null,b)};E.prototype.set=E.prototype.set;\nE.prototype.update=function(a,b){x(\"Firebase.update\",1,2,arguments.length);B(\"Firebase.update\",this.path);if(ea(a)){for(var c={},d=0;d<a.length;++d)c[\"\"+d]=a[d];a=c;L(\"Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.\")}Ea(\"Firebase.update\",a);z(\"Firebase.update\",2,b,!0);if(A(a,\".priority\"))throw Error(\"update() does not currently support updating .priority.\");\nthis.m.update(this.path,a,b)};E.prototype.update=E.prototype.update;E.prototype.kb=function(a,b,c){x(\"Firebase.setWithPriority\",2,3,arguments.length);B(\"Firebase.setWithPriority\",this.path);Aa(\"Firebase.setWithPriority\",a,!1);Fa(\"Firebase.setWithPriority\",2,b,!1);z(\"Firebase.setWithPriority\",3,c,!0);if(\".length\"===this.name()||\".keys\"===this.name())throw\"Firebase.setWithPriority failed: \"+this.name()+\" is a read-only object.\";this.m.kb(this.path,a,b,c)};E.prototype.setWithPriority=E.prototype.kb;\nE.prototype.remove=function(a){x(\"Firebase.remove\",0,1,arguments.length);B(\"Firebase.remove\",this.path);z(\"Firebase.remove\",1,a,!0);this.set(null,a)};E.prototype.remove=E.prototype.remove;\nE.prototype.transaction=function(a,b,c){x(\"Firebase.transaction\",1,3,arguments.length);B(\"Firebase.transaction\",this.path);z(\"Firebase.transaction\",1,a,!1);z(\"Firebase.transaction\",2,b,!0);if(n(c)&&\"boolean\"!=typeof c)throw Error(y(\"Firebase.transaction\",3,!0)+\"must be a boolean.\");if(\".length\"===this.name()||\".keys\"===this.name())throw\"Firebase.transaction failed: \"+this.name()+\" is a read-only object.\";\"undefined\"===typeof c&&(c=!0);Oe(this.m,this.path,a,b,c)};E.prototype.transaction=E.prototype.transaction;\nE.prototype.Wc=function(a,b){x(\"Firebase.setPriority\",1,2,arguments.length);B(\"Firebase.setPriority\",this.path);Fa(\"Firebase.setPriority\",1,a,!1);z(\"Firebase.setPriority\",2,b,!0);this.m.Wc(this.path,a,b)};E.prototype.setPriority=E.prototype.Wc;E.prototype.push=function(a,b){x(\"Firebase.push\",0,2,arguments.length);B(\"Firebase.push\",this.path);Aa(\"Firebase.push\",a,!0);z(\"Firebase.push\",2,b,!0);var c=Fe(this.m),c=Ze(c),c=this.G(c);\"undefined\"!==typeof a&&null!==a&&c.set(a,b);return c};\nE.prototype.push=E.prototype.push;E.prototype.ia=function(){return new $(this.m,this.path,this.name())};E.prototype.onDisconnect=E.prototype.ia;E.prototype.be=function(){L(\"FirebaseRef.removeOnDisconnect() being deprecated. Please use FirebaseRef.onDisconnect().remove() instead.\");this.ia().remove();Ne(this.m)};E.prototype.removeOnDisconnect=E.prototype.be;\nE.prototype.fe=function(a){L(\"FirebaseRef.setOnDisconnect(value) being deprecated. Please use FirebaseRef.onDisconnect().set(value) instead.\");this.ia().set(a);Ne(this.m)};E.prototype.setOnDisconnect=E.prototype.fe;E.prototype.mb=function(a,b,c){x(\"Firebase.auth\",1,3,arguments.length);if(!q(a))throw Error(y(\"Firebase.auth\",1,!1)+\"must be a valid credential (a string).\");z(\"Firebase.auth\",2,b,!0);z(\"Firebase.auth\",3,b,!0);this.m.mb(a,b,c)};E.prototype.auth=E.prototype.mb;\nE.prototype.Qb=function(a){x(\"Firebase.unauth\",0,1,arguments.length);z(\"Firebase.unauth\",1,a,!0);this.m.Qb(a)};E.prototype.unauth=E.prototype.Qb;E.goOffline=function(){x(\"Firebase.goOffline\",0,0,arguments.length);Y.sb().La()};E.goOnline=function(){x(\"Firebase.goOnline\",0,0,arguments.length);Y.sb().jb()};\nfunction Sb(a,b){v(!b||!0===a||!1===a,\"Can't turn on custom loggers persistently.\");!0===a?(\"undefined\"!==typeof console&&(\"function\"===typeof console.log?Qb=r(console.log,console):\"object\"===typeof console.log&&(Qb=function(a){console.log(a)})),b&&ob.set(\"logging_enabled\",!0)):a?Qb=a:(Qb=null,ob.remove(\"logging_enabled\"))}E.enableLogging=Sb;E.ServerValue={TIMESTAMP:{\".sv\":\"timestamp\"}};E.SDK_VERSION=\"1.0.21\";E.INTERNAL=Z;E.Context=Y;})();\n"
  },
  {
    "path": "www/lib/firebase-simple-login/.bower.json",
    "content": "{\n  \"name\": \"firebase-simple-login\",\n  \"description\": \"Firebase Simple Login web client\",\n  \"version\": \"1.6.3\",\n  \"authors\": [\n    \"Firebase <support@firebase.com> (https://www.firebase.com/)\"\n  ],\n  \"homepage\": \"https://github.com/firebase/firebase-simple-login/\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/firebase/firebase-simple-login.git\"\n  },\n  \"license\": \"MIT\",\n  \"keywords\": [\n    \"login\",\n    \"email\",\n    \"password\",\n    \"realtime\",\n    \"Firebase\",\n    \"websocket\",\n    \"authentication\",\n    \"synchronization\"\n  ],\n  \"main\": \"firebase-simple-login.js\",\n  \"ignore\": [\n    \"**/.*\",\n    \"js/\",\n    \"lib/\",\n    \"node_modules/\",\n    \"bower_components/\",\n    \"firebase-simple-login-java/\",\n    \"firebase-simple-login-objc/\",\n    \"bower.json\",\n    \"release.sh\",\n    \"Gruntfile.js\",\n    \"package.json\",\n    \"CONTRIBUTING.md\"\n  ],\n  \"dependencies\": {\n    \"firebase\": \"1.0.x\"\n  },\n  \"devDependencies\": {\n    \"jasmine\": \"2.0.x\",\n    \"jquery\": \"2.1.x\"\n  },\n  \"_release\": \"1.6.3\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.6.3\",\n    \"commit\": \"ca9b28c20fb1308788d164b6032e8eae532dba32\"\n  },\n  \"_source\": \"git://github.com/firebase/firebase-simple-login.git\",\n  \"_target\": \"1.6.x\",\n  \"_originalSource\": \"firebase-simple-login\"\n}"
  },
  {
    "path": "www/lib/firebase-simple-login/CHANGELOG.md",
    "content": "v1.6.3\n-------------\nRelease Date: 2014-08-15\n\n  * The callback argument for `createUser()`, `changePassword()`, `sendPasswordResetEmail()`, and `removeUser()` is now optional.\n  * Fixed issue where we accidentally formatted error messages twice resulting in wrong error messages.\n  * Fixed bug where we assumed a script tag existed for the JSONP transport.\n  * Removed `displayName` from the anonymous authentication user payload.\n\nv1.6.2\n-------------\nRelease Date: 2014-07-18\n\n  * Fixed bug in PhoneGap, Trigger.io, and Windows Metro transports which caused response payloads with an \"&\" in them to be improperly handled, resulting in an \"UNKNOWN ERROR\".\n\nv1.6.1\n-------------\nRelease Date: 2014-06-20\n\n  * Add (internal) option to keep pop-up window alive after communicating reply to opener.\n  * Fixed issue where we accidentally formatted error messages twice resulting in wrong error messages.\n\nv1.6.0\n-------------\nRelease Date: 2014-06-12\n\n  * NOTE: This update modifies the Firebase Simple Login persistence, so updating to this version will have the effect\n          of blowing away your users' existing, persisted sessions.\n  * Remove dependency on cookies / SJCL to better support the PhoneGap / Cordova environments.\n  * Increase the PhoneGap / Cordova InAppBrowser timeout from 40 to 120 seconds (thanks @VishalRJoshi).\n\nv1.5.0\n-------------\nRelease Date: 2014-06-02\n\n  * Persona provider officially removed\n\nv1.4.1\n-------------\nRelease Date: 2014-04-29\n\n  * Add Persona provider deprecation warning (will be removed on 2014-06-02)\n\nv1.4.0\n-------------\nRelease Date: 2014-04-17\n\n  * Fixes issue with cross-domain XHR in IE9\n  * Return Promises/A+ standards-compliant promises (using RSVP) from all asynchronous login / user management methods\n  * Expose `FirebaseSimpleLogin.VERSION` attribute in the client for programmatic detection\n\nv1.3.2\n-------------\nRelease Date: 2014-03-30\n\n  * Fixes issue with session persistence ([#22](https://github.com/firebase/firebase-simple-login/issues/22))\n\nv1.3.1\n-------------\nRelease Date: 2014-03-29\n\n  * Add support for `isTemporaryPassword` flag when logging in using the email / password provider ([#17](https://github.com/firebase/firebase-simple-login/issues/17))\n  * Reduce filesize by using a custom XHR integration ([#13](https://github.com/firebase/firebase-simple-login/issues/13))\n\nv1.3.0\n-------------\nRelease Date: 2014-02-28\n\n  * Add support for Google / Google+ authentication ([#1](https://github.com/firebase/firebase-simple-login/issues/1))\n  * Enable automatic redirect-based OAuth for iOS standalone apps, Chrome on iOS, and the Twitter / Facebook iOS preview panes ([#7](https://github.com/firebase/firebase-simple-login/issues/7))\n  * Enable optional redirect-based OAuth via the `preferRedirect: true` flag for all OAuth-based `.login(...)` methods  ([#10](https://github.com/firebase/firebase-simple-login/issues/10))\n  * Support extra options for Mozilla Persona login ([#8](https://github.com/firebase/firebase-simple-login/issues/8))\n\nv1.2.5\n-------------\nRelease Date: 2014-02-05\n\n* Fix bug impacting persisting sessions across page refreshes\n\nv1.2.4\n-------------\nRelease Date: 2014-02-05\n\n* Adds support for Windows Metro applications via WebAuthenticationBroker\n\nv1.2.3\n-------------\nRelease Date: 2014-01-27\n\n* Fix intermittent eventing issues with multiple clients on a single page\n\nv1.2.2\n-------------\nRelease Date: 2014-01-24\n\n* Fix [#5 - sessionLengthDays not used when setting the session in attemptAuth](https://github.com/firebase/firebase-simple-login/issues/5)\n\nv1.2.1\n-------------\nRelease Date: 2014-01-19\n\n* Fix [#4 - Persona not working](https://github.com/firebase/firebase-simple-login/pull/4)\n\nv1.2.0\n-------------\nRelease Date: 2014-01-15\n\n  * Add support for password resets (see [https://www.firebase.com/docs/javascript/simplelogin/sendpasswordresetemail.html](https://www.firebase.com/docs/javascript/simplelogin/sendpasswordresetemail.html))\n"
  },
  {
    "path": "www/lib/firebase-simple-login/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright © 2014 Firebase <opensource@firebase.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
  },
  {
    "path": "www/lib/firebase-simple-login/README.md",
    "content": "# Firebase Simple Login - Web Client\n\n[![GitHub version](https://badge.fury.io/gh/firebase%2Ffirebase-simple-login.svg)](http://badge.fury.io/gh/firebase%2Ffirebase-simple-login)\n[![Build Status](https://api.travis-ci.org/firebase/firebase-simple-login.svg?branch=master)](https://travis-ci.org/firebase/firebase-simple-login)\n[![Dependency Status](https://gemnasium.com/firebase/firebase-simple-login.png)](https://gemnasium.com/firebase/firebase-simple-login)\n\nFirebase Simple Login is a simple, easy-to-use authentication service built on top of\n[Firebase Custom Login](https://www.firebase.com/docs/web/guide/simple-login/custom.html),\nallowing you to authenticate users without any server-side code.\n\nFirebase Simple Login offers several types of authentication: email/password, anonymous, and\nthird-party integration with Facebook, GitHub, Google, and Twitter. It allows you to authenticate\nyour users without having to manually store authentication credentials or run a server.\n\n\n## Installation\n\nIn order to use Firebase Simple Login in your project, you need to include the following files\nin your HTML:\n\n```html\n<!-- Firebase -->\n<script src=\"https://cdn.firebase.com/js/client/1.0.18/firebase.js\"></script>\n\n<!-- Firebase Simple Login -->\n<script src=\"https://cdn.firebase.com/js/simple-login/1.6.3/firebase-simple-login.js\"></script>\n```\n\nUse the URL above to download both the minified (`firebase-simple-login.js`) and non-minified\n(`firebase-simple-login-debug.js`) versions of Firebase Simple Login from the Firebase CDN.\n\nThe only dependency is the Firebase web client, which is also available on the Firebase CDN\nusing the above URL. Alternatively, you can download the latest client version from the\n[Firebase developer documentation](https://www.firebase.com/docs/web/).\n\nYou can also install Firebase Simple Login via Bower and its dependencies will be downloaded\nautomatically:\n\n```bash\n$ bower install firebase-simple-login --save\n```\n\n## Getting Started with Firebase\n\nFirebase Simple Login requires Firebase in order to authenticate your users. You can\n[sign up here for a free account](https://www.firebase.com/signup/).\n\n\n## Documentation & API Reference\n\nYou can read through [the complete documentation](https://www.firebase.com/docs/web/guide/user-auth.html)\nas well as [the full API reference](https://www.firebase.com/docs/web/api/firebasesimplelogin/)\nin the Firebase developer documentation.\n\n\n## Configuration\n\nBefore adding authentication to your application, you need enable the authentication providers\nyou want to use. You can do this from the \"Simple Login\" tab in your Firebase's Dashboard, at\n`https://<YOUR-FIREBASE>.firebaseio.com`. From there you can enable/disable authentication\nproviders, setup OAuth credentials, and configure valid OAuth request origins.\n\nOur developer documentation contains more information about how to\n[configure each of the authentication providers](https://www.firebase.com/docs/web/guide/user-auth.html#section-providers).\n\n\n## Usage\n\nStart monitoring user authentication state in your application by instantiating\nthe Firebase Simple Login client with a Firebase reference and a callback.\n\nThis `function(error, user)` callback will be invoked once after instantiation,\nand again every time the user's authentication state changes:\n\n```javascript\nvar ref = new Firebase('https://<YOUR-FIREBASE>.firebaseio.com');\nvar auth = new FirebaseSimpleLogin(ref, function(error, user) {\n  if (error) {\n    console.log('Authentication error: ', error);\n  } else if (user) {\n    console.log('User ' + user.id + ' authenticated via the ' + user.provider + ' provider!');\n  } else {\n    console.log(\"User is logged out.\")\n  }\n});\n```\n\nIf the user is logged out, try authenticating using the provider of your choice:\n\n```javascript\nauth.login('<provider>'); // 'password', 'anonymous', 'facebook', 'github', etc.\n```\n\nYou can read through [the complete documentation](https://www.firebase.com/docs/web/guide/user-auth.html)\nas well as [the full API reference](https://www.firebase.com/docs/web/api/firebasesimplelogin/)\nin the Firebase developer documentation.\n\n\n## Contributing\n\nFirebase Simple Login is an open-source project and we welcome contributions to the library.\nPlease read the [Contribution Guidelines](./CONTRIBUTING.md) in addition to following the steps\nbelow.\n\nIf you'd like to contribute to Firebase Simple Login, you'll need to run the following commands\nto get your environment set up:\n\n```bash\n$ git clone https://github.com/firebase/firebase-simple-login.git\n$ cd firebase-simple-login           # go to the firebase-simple-login directory\n$ git submodule update --init lib/   # update the Google Closure library submodule\n$ npm install -g grunt-cli           # globally install gulp task runner\n$ npm install -g bower               # globally install Bower package manager\n$ npm install -g phantomjs           # globally install PhantomJS test framework\n$ npm install -g casperjs            # globally install CasperJS test framework\n$ npm install                        # install local npm build / test dependencies\n$ bower install                      # install local JavaScript dependencies\n```\n\nThe source files are located at `/js/src/simple-login/`. Once you've made a change in one of\nthose files, run `grunt build` to generate the distribution files `firebase-simple-login.js`\nand `firebase-simple-login-debug.js` which can be found at the root of this repository.\n\nYou can run the test suite via the command line by running `grunt test`. This will run both\nthe Jasmine and Casper test suites. If you just want to run one, use `grunt test:jasmine` or\n`grunt test:casper`.\n\nYou can also run the Jasmine test suite from within the browser. You first need to spin up a\nlocal server:\n\n```bash\n$ python -m SimpleHTTPServer 7070\n```\n\nThen, navigate to `http://localhost:7070/js/test/jasmine/index.html` and the test suite will\nstart automatically.\n"
  },
  {
    "path": "www/lib/firebase-simple-login/firebase-simple-login-debug.js",
    "content": "var COMPILED = false;\nvar goog = goog || {};\ngoog.global = this;\ngoog.global.CLOSURE_DEFINES;\ngoog.exportPath_ = function(name, opt_object, opt_objectToExportTo) {\n  var parts = name.split(\".\");\n  var cur = opt_objectToExportTo || goog.global;\n  if (!(parts[0] in cur) && cur.execScript) {\n    cur.execScript(\"var \" + parts[0]);\n  }\n  for (var part;parts.length && (part = parts.shift());) {\n    if (!parts.length && opt_object !== undefined) {\n      cur[part] = opt_object;\n    } else {\n      if (cur[part]) {\n        cur = cur[part];\n      } else {\n        cur = cur[part] = {};\n      }\n    }\n  }\n};\ngoog.define = function(name, defaultValue) {\n  var value = defaultValue;\n  if (!COMPILED) {\n    if (goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, name)) {\n      value = goog.global.CLOSURE_DEFINES[name];\n    }\n  }\n  goog.exportPath_(name, value);\n};\ngoog.DEBUG = true;\ngoog.define(\"goog.LOCALE\", \"en\");\ngoog.define(\"goog.TRUSTED_SITE\", true);\ngoog.provide = function(name) {\n  if (!COMPILED) {\n    if (goog.isProvided_(name)) {\n      throw Error('Namespace \"' + name + '\" already declared.');\n    }\n    delete goog.implicitNamespaces_[name];\n    var namespace = name;\n    while (namespace = namespace.substring(0, namespace.lastIndexOf(\".\"))) {\n      if (goog.getObjectByName(namespace)) {\n        break;\n      }\n      goog.implicitNamespaces_[namespace] = true;\n    }\n  }\n  goog.exportPath_(name);\n};\ngoog.setTestOnly = function(opt_message) {\n  if (COMPILED && !goog.DEBUG) {\n    opt_message = opt_message || \"\";\n    throw Error(\"Importing test-only code into non-debug environment\" + opt_message ? \": \" + opt_message : \".\");\n  }\n};\ngoog.forwardDeclare = function(name) {\n};\nif (!COMPILED) {\n  goog.isProvided_ = function(name) {\n    return!goog.implicitNamespaces_[name] && goog.isDefAndNotNull(goog.getObjectByName(name));\n  };\n  goog.implicitNamespaces_ = {};\n}\ngoog.getObjectByName = function(name, opt_obj) {\n  var parts = name.split(\".\");\n  var cur = opt_obj || goog.global;\n  for (var part;part = parts.shift();) {\n    if (goog.isDefAndNotNull(cur[part])) {\n      cur = cur[part];\n    } else {\n      return null;\n    }\n  }\n  return cur;\n};\ngoog.globalize = function(obj, opt_global) {\n  var global = opt_global || goog.global;\n  for (var x in obj) {\n    global[x] = obj[x];\n  }\n};\ngoog.addDependency = function(relPath, provides, requires) {\n  if (goog.DEPENDENCIES_ENABLED) {\n    var provide, require;\n    var path = relPath.replace(/\\\\/g, \"/\");\n    var deps = goog.dependencies_;\n    for (var i = 0;provide = provides[i];i++) {\n      deps.nameToPath[provide] = path;\n      if (!(path in deps.pathToNames)) {\n        deps.pathToNames[path] = {};\n      }\n      deps.pathToNames[path][provide] = true;\n    }\n    for (var j = 0;require = requires[j];j++) {\n      if (!(path in deps.requires)) {\n        deps.requires[path] = {};\n      }\n      deps.requires[path][require] = true;\n    }\n  }\n};\ngoog.define(\"goog.ENABLE_DEBUG_LOADER\", true);\ngoog.require = function(name) {\n  if (!COMPILED) {\n    if (goog.isProvided_(name)) {\n      return;\n    }\n    if (goog.ENABLE_DEBUG_LOADER) {\n      var path = goog.getPathFromDeps_(name);\n      if (path) {\n        goog.included_[path] = true;\n        goog.writeScripts_();\n        return;\n      }\n    }\n    var errorMessage = \"goog.require could not find: \" + name;\n    if (goog.global.console) {\n      goog.global.console[\"error\"](errorMessage);\n    }\n    throw Error(errorMessage);\n  }\n};\ngoog.basePath = \"\";\ngoog.global.CLOSURE_BASE_PATH;\ngoog.global.CLOSURE_NO_DEPS;\ngoog.global.CLOSURE_IMPORT_SCRIPT;\ngoog.nullFunction = function() {\n};\ngoog.identityFunction = function(opt_returnValue, var_args) {\n  return opt_returnValue;\n};\ngoog.abstractMethod = function() {\n  throw Error(\"unimplemented abstract method\");\n};\ngoog.addSingletonGetter = function(ctor) {\n  ctor.getInstance = function() {\n    if (ctor.instance_) {\n      return ctor.instance_;\n    }\n    if (goog.DEBUG) {\n      goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor;\n    }\n    return ctor.instance_ = new ctor;\n  };\n};\ngoog.instantiatedSingletons_ = [];\ngoog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;\nif (goog.DEPENDENCIES_ENABLED) {\n  goog.included_ = {};\n  goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}};\n  goog.inHtmlDocument_ = function() {\n    var doc = goog.global.document;\n    return typeof doc != \"undefined\" && \"write\" in doc;\n  };\n  goog.findBasePath_ = function() {\n    if (goog.global.CLOSURE_BASE_PATH) {\n      goog.basePath = goog.global.CLOSURE_BASE_PATH;\n      return;\n    } else {\n      if (!goog.inHtmlDocument_()) {\n        return;\n      }\n    }\n    var doc = goog.global.document;\n    var scripts = doc.getElementsByTagName(\"script\");\n    for (var i = scripts.length - 1;i >= 0;--i) {\n      var src = scripts[i].src;\n      var qmark = src.lastIndexOf(\"?\");\n      var l = qmark == -1 ? src.length : qmark;\n      if (src.substr(l - 7, 7) == \"base.js\") {\n        goog.basePath = src.substr(0, l - 7);\n        return;\n      }\n    }\n  };\n  goog.importScript_ = function(src) {\n    var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;\n    if (!goog.dependencies_.written[src] && importScript(src)) {\n      goog.dependencies_.written[src] = true;\n    }\n  };\n  goog.writeScriptTag_ = function(src) {\n    if (goog.inHtmlDocument_()) {\n      var doc = goog.global.document;\n      if (doc.readyState == \"complete\") {\n        var isDeps = /\\bdeps.js$/.test(src);\n        if (isDeps) {\n          return false;\n        } else {\n          throw Error('Cannot write \"' + src + '\" after document load');\n        }\n      }\n      doc.write('<script type=\"text/javascript\" src=\"' + src + '\"></' + \"script>\");\n      return true;\n    } else {\n      return false;\n    }\n  };\n  goog.writeScripts_ = function() {\n    var scripts = [];\n    var seenScript = {};\n    var deps = goog.dependencies_;\n    function visitNode(path) {\n      if (path in deps.written) {\n        return;\n      }\n      if (path in deps.visited) {\n        if (!(path in seenScript)) {\n          seenScript[path] = true;\n          scripts.push(path);\n        }\n        return;\n      }\n      deps.visited[path] = true;\n      if (path in deps.requires) {\n        for (var requireName in deps.requires[path]) {\n          if (!goog.isProvided_(requireName)) {\n            if (requireName in deps.nameToPath) {\n              visitNode(deps.nameToPath[requireName]);\n            } else {\n              throw Error(\"Undefined nameToPath for \" + requireName);\n            }\n          }\n        }\n      }\n      if (!(path in seenScript)) {\n        seenScript[path] = true;\n        scripts.push(path);\n      }\n    }\n    for (var path in goog.included_) {\n      if (!deps.written[path]) {\n        visitNode(path);\n      }\n    }\n    for (var i = 0;i < scripts.length;i++) {\n      if (scripts[i]) {\n        goog.importScript_(goog.basePath + scripts[i]);\n      } else {\n        throw Error(\"Undefined script input\");\n      }\n    }\n  };\n  goog.getPathFromDeps_ = function(rule) {\n    if (rule in goog.dependencies_.nameToPath) {\n      return goog.dependencies_.nameToPath[rule];\n    } else {\n      return null;\n    }\n  };\n  goog.findBasePath_();\n  if (!goog.global.CLOSURE_NO_DEPS) {\n    goog.importScript_(goog.basePath + \"deps.js\");\n  }\n}\ngoog.typeOf = function(value) {\n  var s = typeof value;\n  if (s == \"object\") {\n    if (value) {\n      if (value instanceof Array) {\n        return \"array\";\n      } else {\n        if (value instanceof Object) {\n          return s;\n        }\n      }\n      var className = Object.prototype.toString.call((value));\n      if (className == \"[object Window]\") {\n        return \"object\";\n      }\n      if (className == \"[object Array]\" || typeof value.length == \"number\" && (typeof value.splice != \"undefined\" && (typeof value.propertyIsEnumerable != \"undefined\" && !value.propertyIsEnumerable(\"splice\")))) {\n        return \"array\";\n      }\n      if (className == \"[object Function]\" || typeof value.call != \"undefined\" && (typeof value.propertyIsEnumerable != \"undefined\" && !value.propertyIsEnumerable(\"call\"))) {\n        return \"function\";\n      }\n    } else {\n      return \"null\";\n    }\n  } else {\n    if (s == \"function\" && typeof value.call == \"undefined\") {\n      return \"object\";\n    }\n  }\n  return s;\n};\ngoog.isDef = function(val) {\n  return val !== undefined;\n};\ngoog.isNull = function(val) {\n  return val === null;\n};\ngoog.isDefAndNotNull = function(val) {\n  return val != null;\n};\ngoog.isArray = function(val) {\n  return goog.typeOf(val) == \"array\";\n};\ngoog.isArrayLike = function(val) {\n  var type = goog.typeOf(val);\n  return type == \"array\" || type == \"object\" && typeof val.length == \"number\";\n};\ngoog.isDateLike = function(val) {\n  return goog.isObject(val) && typeof val.getFullYear == \"function\";\n};\ngoog.isString = function(val) {\n  return typeof val == \"string\";\n};\ngoog.isBoolean = function(val) {\n  return typeof val == \"boolean\";\n};\ngoog.isNumber = function(val) {\n  return typeof val == \"number\";\n};\ngoog.isFunction = function(val) {\n  return goog.typeOf(val) == \"function\";\n};\ngoog.isObject = function(val) {\n  var type = typeof val;\n  return type == \"object\" && val != null || type == \"function\";\n};\ngoog.getUid = function(obj) {\n  return obj[goog.UID_PROPERTY_] || (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_);\n};\ngoog.hasUid = function(obj) {\n  return!!obj[goog.UID_PROPERTY_];\n};\ngoog.removeUid = function(obj) {\n  if (\"removeAttribute\" in obj) {\n    obj.removeAttribute(goog.UID_PROPERTY_);\n  }\n  try {\n    delete obj[goog.UID_PROPERTY_];\n  } catch (ex) {\n  }\n};\ngoog.UID_PROPERTY_ = \"closure_uid_\" + (Math.random() * 1E9 >>> 0);\ngoog.uidCounter_ = 0;\ngoog.getHashCode = goog.getUid;\ngoog.removeHashCode = goog.removeUid;\ngoog.cloneObject = function(obj) {\n  var type = goog.typeOf(obj);\n  if (type == \"object\" || type == \"array\") {\n    if (obj.clone) {\n      return obj.clone();\n    }\n    var clone = type == \"array\" ? [] : {};\n    for (var key in obj) {\n      clone[key] = goog.cloneObject(obj[key]);\n    }\n    return clone;\n  }\n  return obj;\n};\ngoog.bindNative_ = function(fn, selfObj, var_args) {\n  return(fn.call.apply(fn.bind, arguments));\n};\ngoog.bindJs_ = function(fn, selfObj, var_args) {\n  if (!fn) {\n    throw new Error;\n  }\n  if (arguments.length > 2) {\n    var boundArgs = Array.prototype.slice.call(arguments, 2);\n    return function() {\n      var newArgs = Array.prototype.slice.call(arguments);\n      Array.prototype.unshift.apply(newArgs, boundArgs);\n      return fn.apply(selfObj, newArgs);\n    };\n  } else {\n    return function() {\n      return fn.apply(selfObj, arguments);\n    };\n  }\n};\ngoog.bind = function(fn, selfObj, var_args) {\n  if (Function.prototype.bind && Function.prototype.bind.toString().indexOf(\"native code\") != -1) {\n    goog.bind = goog.bindNative_;\n  } else {\n    goog.bind = goog.bindJs_;\n  }\n  return goog.bind.apply(null, arguments);\n};\ngoog.partial = function(fn, var_args) {\n  var args = Array.prototype.slice.call(arguments, 1);\n  return function() {\n    var newArgs = args.slice();\n    newArgs.push.apply(newArgs, arguments);\n    return fn.apply(this, newArgs);\n  };\n};\ngoog.mixin = function(target, source) {\n  for (var x in source) {\n    target[x] = source[x];\n  }\n};\ngoog.now = goog.TRUSTED_SITE && Date.now || function() {\n  return+new Date;\n};\ngoog.globalEval = function(script) {\n  if (goog.global.execScript) {\n    goog.global.execScript(script, \"JavaScript\");\n  } else {\n    if (goog.global.eval) {\n      if (goog.evalWorksForGlobals_ == null) {\n        goog.global.eval(\"var _et_ = 1;\");\n        if (typeof goog.global[\"_et_\"] != \"undefined\") {\n          delete goog.global[\"_et_\"];\n          goog.evalWorksForGlobals_ = true;\n        } else {\n          goog.evalWorksForGlobals_ = false;\n        }\n      }\n      if (goog.evalWorksForGlobals_) {\n        goog.global.eval(script);\n      } else {\n        var doc = goog.global.document;\n        var scriptElt = doc.createElement(\"script\");\n        scriptElt.type = \"text/javascript\";\n        scriptElt.defer = false;\n        scriptElt.appendChild(doc.createTextNode(script));\n        doc.body.appendChild(scriptElt);\n        doc.body.removeChild(scriptElt);\n      }\n    } else {\n      throw Error(\"goog.globalEval not available\");\n    }\n  }\n};\ngoog.evalWorksForGlobals_ = null;\ngoog.cssNameMapping_;\ngoog.cssNameMappingStyle_;\ngoog.getCssName = function(className, opt_modifier) {\n  var getMapping = function(cssName) {\n    return goog.cssNameMapping_[cssName] || cssName;\n  };\n  var renameByParts = function(cssName) {\n    var parts = cssName.split(\"-\");\n    var mapped = [];\n    for (var i = 0;i < parts.length;i++) {\n      mapped.push(getMapping(parts[i]));\n    }\n    return mapped.join(\"-\");\n  };\n  var rename;\n  if (goog.cssNameMapping_) {\n    rename = goog.cssNameMappingStyle_ == \"BY_WHOLE\" ? getMapping : renameByParts;\n  } else {\n    rename = function(a) {\n      return a;\n    };\n  }\n  if (opt_modifier) {\n    return className + \"-\" + rename(opt_modifier);\n  } else {\n    return rename(className);\n  }\n};\ngoog.setCssNameMapping = function(mapping, opt_style) {\n  goog.cssNameMapping_ = mapping;\n  goog.cssNameMappingStyle_ = opt_style;\n};\ngoog.global.CLOSURE_CSS_NAME_MAPPING;\nif (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) {\n  goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING;\n}\ngoog.getMsg = function(str, opt_values) {\n  var values = opt_values || {};\n  for (var key in values) {\n    var value = (\"\" + values[key]).replace(/\\$/g, \"$$$$\");\n    str = str.replace(new RegExp(\"\\\\{\\\\$\" + key + \"\\\\}\", \"gi\"), value);\n  }\n  return str;\n};\ngoog.getMsgWithFallback = function(a, b) {\n  return a;\n};\ngoog.exportSymbol = function(publicPath, object, opt_objectToExportTo) {\n  goog.exportPath_(publicPath, object, opt_objectToExportTo);\n};\ngoog.exportProperty = function(object, publicName, symbol) {\n  object[publicName] = symbol;\n};\ngoog.inherits = function(childCtor, parentCtor) {\n  function tempCtor() {\n  }\n  tempCtor.prototype = parentCtor.prototype;\n  childCtor.superClass_ = parentCtor.prototype;\n  childCtor.prototype = new tempCtor;\n  childCtor.prototype.constructor = childCtor;\n  childCtor.base = function(me, methodName, var_args) {\n    var args = Array.prototype.slice.call(arguments, 2);\n    return parentCtor.prototype[methodName].apply(me, args);\n  };\n};\ngoog.base = function(me, opt_methodName, var_args) {\n  var caller = arguments.callee.caller;\n  if (goog.DEBUG) {\n    if (!caller) {\n      throw Error(\"arguments.caller not defined.  goog.base() expects not \" + \"to be running in strict mode. See \" + \"http://www.ecma-international.org/ecma-262/5.1/#sec-C\");\n    }\n  }\n  if (caller.superClass_) {\n    return caller.superClass_.constructor.apply(me, Array.prototype.slice.call(arguments, 1));\n  }\n  var args = Array.prototype.slice.call(arguments, 2);\n  var foundCaller = false;\n  for (var ctor = me.constructor;ctor;ctor = ctor.superClass_ && ctor.superClass_.constructor) {\n    if (ctor.prototype[opt_methodName] === caller) {\n      foundCaller = true;\n    } else {\n      if (foundCaller) {\n        return ctor.prototype[opt_methodName].apply(me, args);\n      }\n    }\n  }\n  if (me[opt_methodName] === caller) {\n    return me.constructor.prototype[opt_methodName].apply(me, args);\n  } else {\n    throw Error(\"goog.base called from a method of one name \" + \"to a method of a different name\");\n  }\n};\ngoog.scope = function(fn) {\n  fn.call(goog.global);\n};\ngoog.provide(\"fb.simplelogin.Vars\");\ngoog.provide(\"fb.simplelogin.Vars_\");\nfb.simplelogin.Vars_ = function() {\n  this.apiHost = \"https://auth.firebase.com\";\n};\nfb.simplelogin.Vars_.prototype.setApiHost = function(apiHost) {\n  this.apiHost = apiHost;\n};\nfb.simplelogin.Vars_.prototype.getApiHost = function() {\n  return this.apiHost;\n};\nfb.simplelogin.Vars = new fb.simplelogin.Vars_;\ngoog.provide(\"goog.json\");\ngoog.provide(\"goog.json.Replacer\");\ngoog.provide(\"goog.json.Reviver\");\ngoog.provide(\"goog.json.Serializer\");\ngoog.define(\"goog.json.USE_NATIVE_JSON\", false);\ngoog.json.isValid_ = function(s) {\n  if (/^\\s*$/.test(s)) {\n    return false;\n  }\n  var backslashesRe = /\\\\[\"\\\\\\/bfnrtu]/g;\n  var simpleValuesRe = /\"[^\"\\\\\\n\\r\\u2028\\u2029\\x00-\\x08\\x0a-\\x1f]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g;\n  var openBracketsRe = /(?:^|:|,)(?:[\\s\\u2028\\u2029]*\\[)+/g;\n  var remainderRe = /^[\\],:{}\\s\\u2028\\u2029]*$/;\n  return remainderRe.test(s.replace(backslashesRe, \"@\").replace(simpleValuesRe, \"]\").replace(openBracketsRe, \"\"));\n};\ngoog.json.parse = goog.json.USE_NATIVE_JSON ? (goog.global[\"JSON\"][\"parse\"]) : function(s) {\n  var o = String(s);\n  if (goog.json.isValid_(o)) {\n    try {\n      return(eval(\"(\" + o + \")\"));\n    } catch (ex) {\n    }\n  }\n  throw Error(\"Invalid JSON string: \" + o);\n};\ngoog.json.unsafeParse = goog.json.USE_NATIVE_JSON ? (goog.global[\"JSON\"][\"parse\"]) : function(s) {\n  return(eval(\"(\" + s + \")\"));\n};\ngoog.json.Replacer;\ngoog.json.Reviver;\ngoog.json.serialize = goog.json.USE_NATIVE_JSON ? (goog.global[\"JSON\"][\"stringify\"]) : function(object, opt_replacer) {\n  return(new goog.json.Serializer(opt_replacer)).serialize(object);\n};\ngoog.json.Serializer = function(opt_replacer) {\n  this.replacer_ = opt_replacer;\n};\ngoog.json.Serializer.prototype.serialize = function(object) {\n  var sb = [];\n  this.serialize_(object, sb);\n  return sb.join(\"\");\n};\ngoog.json.Serializer.prototype.serialize_ = function(object, sb) {\n  switch(typeof object) {\n    case \"string\":\n      this.serializeString_((object), sb);\n      break;\n    case \"number\":\n      this.serializeNumber_((object), sb);\n      break;\n    case \"boolean\":\n      sb.push(object);\n      break;\n    case \"undefined\":\n      sb.push(\"null\");\n      break;\n    case \"object\":\n      if (object == null) {\n        sb.push(\"null\");\n        break;\n      }\n      if (goog.isArray(object)) {\n        this.serializeArray((object), sb);\n        break;\n      }\n      this.serializeObject_((object), sb);\n      break;\n    case \"function\":\n      break;\n    default:\n      throw Error(\"Unknown type: \" + typeof object);;\n  }\n};\ngoog.json.Serializer.charToJsonCharCache_ = {'\"':'\\\\\"', \"\\\\\":\"\\\\\\\\\", \"/\":\"\\\\/\", \"\\b\":\"\\\\b\", \"\\f\":\"\\\\f\", \"\\n\":\"\\\\n\", \"\\r\":\"\\\\r\", \"\\t\":\"\\\\t\", \"\\x0B\":\"\\\\u000b\"};\ngoog.json.Serializer.charsToReplace_ = /\\uffff/.test(\"\\uffff\") ? /[\\\\\\\"\\x00-\\x1f\\x7f-\\uffff]/g : /[\\\\\\\"\\x00-\\x1f\\x7f-\\xff]/g;\ngoog.json.Serializer.prototype.serializeString_ = function(s, sb) {\n  sb.push('\"', s.replace(goog.json.Serializer.charsToReplace_, function(c) {\n    if (c in goog.json.Serializer.charToJsonCharCache_) {\n      return goog.json.Serializer.charToJsonCharCache_[c];\n    }\n    var cc = c.charCodeAt(0);\n    var rv = \"\\\\u\";\n    if (cc < 16) {\n      rv += \"000\";\n    } else {\n      if (cc < 256) {\n        rv += \"00\";\n      } else {\n        if (cc < 4096) {\n          rv += \"0\";\n        }\n      }\n    }\n    return goog.json.Serializer.charToJsonCharCache_[c] = rv + cc.toString(16);\n  }), '\"');\n};\ngoog.json.Serializer.prototype.serializeNumber_ = function(n, sb) {\n  sb.push(isFinite(n) && !isNaN(n) ? n : \"null\");\n};\ngoog.json.Serializer.prototype.serializeArray = function(arr, sb) {\n  var l = arr.length;\n  sb.push(\"[\");\n  var sep = \"\";\n  for (var i = 0;i < l;i++) {\n    sb.push(sep);\n    var value = arr[i];\n    this.serialize_(this.replacer_ ? this.replacer_.call(arr, String(i), value) : value, sb);\n    sep = \",\";\n  }\n  sb.push(\"]\");\n};\ngoog.json.Serializer.prototype.serializeObject_ = function(obj, sb) {\n  sb.push(\"{\");\n  var sep = \"\";\n  for (var key in obj) {\n    if (Object.prototype.hasOwnProperty.call(obj, key)) {\n      var value = obj[key];\n      if (typeof value != \"function\") {\n        sb.push(sep);\n        this.serializeString_(key, sb);\n        sb.push(\":\");\n        this.serialize_(this.replacer_ ? this.replacer_.call(obj, key, value) : value, sb);\n        sep = \",\";\n      }\n    }\n  }\n  sb.push(\"}\");\n};\ngoog.provide(\"fb.simplelogin.util.json\");\ngoog.require(\"goog.json\");\nfb.simplelogin.util.json.parse = function(str) {\n  if (typeof JSON !== \"undefined\" && goog.isDef(JSON.parse)) {\n    return JSON.parse(str);\n  } else {\n    return goog.json.parse(str);\n  }\n};\nfb.simplelogin.util.json.stringify = function(data) {\n  if (typeof JSON !== \"undefined\" && goog.isDef(JSON.stringify)) {\n    return JSON.stringify(data);\n  } else {\n    return goog.json.serialize(data);\n  }\n};\ngoog.provide(\"fb.simplelogin.transports.Transport\");\nfb.simplelogin.Transport = function() {\n};\nfb.simplelogin.Transport.prototype.open = function(url, options, onComplete) {\n};\ngoog.provide(\"fb.simplelogin.transports.Popup\");\ngoog.require(\"fb.simplelogin.transports.Transport\");\nfb.simplelogin.Popup = function() {\n};\nfb.simplelogin.Popup.prototype.open = function(url, options, onComplete) {\n};\ngoog.provide(\"fb.simplelogin.util.misc\");\ngoog.require(\"goog.json\");\nfb.simplelogin.util.misc.parseUrl = function(url) {\n  var a = document.createElement(\"a\");\n  a.href = url;\n  return{protocol:a.protocol.replace(\":\", \"\"), host:a.hostname, port:a.port, query:a.search, params:fb.simplelogin.util.misc.parseQuerystring(a.search), hash:a.hash.replace(\"#\", \"\"), path:a.pathname.replace(/^([^\\/])/, \"/$1\")};\n};\nfb.simplelogin.util.misc.parseQuerystring = function(str) {\n  var obj = {};\n  var tokens = str.replace(/^\\?/, \"\").split(\"&\");\n  for (var i = 0;i < tokens.length;i++) {\n    if (tokens[i]) {\n      var key = tokens[i].split(\"=\");\n      obj[key[0]] = key[1];\n    }\n  }\n  return obj;\n};\nfb.simplelogin.util.misc.parseSubdomain = function(url) {\n  var subdomain = \"\";\n  try {\n    var obj = fb.simplelogin.util.misc.parseUrl(url);\n    var tokens = obj.host.split(\".\");\n    if (tokens.length > 2) {\n      subdomain = tokens.slice(0, -2).join(\".\");\n    }\n  } catch (e) {\n  }\n  return subdomain;\n};\nfb.simplelogin.util.misc.warn = function(message) {\n  if (typeof console !== \"undefined\") {\n    if (typeof console.warn !== \"undefined\") {\n      console.warn(message);\n    } else {\n      console.log(message);\n    }\n  }\n};\ngoog.provide(\"fb.simplelogin.transports.CordovaInAppBrowser\");\ngoog.provide(\"fb.simplelogin.transports.CordovaInAppBrowser_\");\ngoog.require(\"fb.simplelogin.transports.Popup\");\ngoog.require(\"fb.simplelogin.Vars\");\ngoog.require(\"fb.simplelogin.util.json\");\ngoog.require(\"fb.simplelogin.util.misc\");\nvar popupTimeout = 12E4;\nfb.simplelogin.transports.CordovaInAppBrowser_ = function() {\n};\nfb.simplelogin.transports.CordovaInAppBrowser_.prototype.open = function(url, options, onComplete) {\n  callbackInvoked = false;\n  var callbackHandler = function() {\n    var args = Array.prototype.slice.apply(arguments);\n    if (!callbackInvoked) {\n      callbackInvoked = true;\n      onComplete.apply(null, args);\n    }\n  };\n  var windowRef = window[\"open\"](url + \"&transport=internal-redirect-hash\", \"blank\", \"location=no\");\n  windowRef.addEventListener(\"loadstop\", function(event) {\n    var result;\n    if (event && event[\"url\"]) {\n      var urlObj = fb.simplelogin.util.misc.parseUrl(event[\"url\"]);\n      if (urlObj[\"path\"] !== \"/blank/page.html\") {\n        return;\n      }\n      windowRef.close();\n      try {\n        var urlHashEncoded = fb.simplelogin.util.misc.parseQuerystring(urlObj[\"hash\"]);\n        var temporaryResult = {};\n        for (var key in urlHashEncoded) {\n          temporaryResult[key] = fb.simplelogin.util.json.parse(decodeURIComponent(urlHashEncoded[key]));\n        }\n        result = temporaryResult;\n      } catch (e) {\n      }\n      if (result && (result[\"token\"] && result[\"user\"])) {\n        callbackHandler(null, result);\n      } else {\n        if (result && result[\"error\"]) {\n          callbackHandler(result[\"error\"]);\n        } else {\n          callbackHandler({code:\"RESPONSE_PAYLOAD_ERROR\", message:\"Unable to parse response payload for PhoneGap.\"});\n        }\n      }\n    }\n  });\n  windowRef.addEventListener(\"exit\", function(event) {\n    callbackHandler({code:\"USER_DENIED\", message:\"User cancelled the authentication request.\"});\n  });\n  setTimeout(function() {\n    if (windowRef && windowRef[\"close\"]) {\n      windowRef[\"close\"]();\n    }\n  }, popupTimeout);\n};\nfb.simplelogin.transports.CordovaInAppBrowser = new fb.simplelogin.transports.CordovaInAppBrowser_;\ngoog.provide(\"fb.simplelogin.Errors\");\nvar messagePrefix = \"FirebaseSimpleLogin: \";\nvar errors = {\"UNKNOWN_ERROR\":\"An unknown error occurred.\", \"INVALID_EMAIL\":\"Invalid email specified.\", \"INVALID_PASSWORD\":\"Invalid password specified.\", \"USER_DENIED\":\"User cancelled the authentication request.\", \"RESPONSE_PAYLOAD_ERROR\":\"Unable to parse response payload.\", \"TRIGGER_IO_TABS\":'The \"forge.tabs\" module required when using Firebase Simple Login and                               Trigger.io. Without this module included and enabled, login attempts to                               OAuth authentication providers will not be able to complete.'};\nfb.simplelogin.Errors.format = function(errorCode, errorMessage) {\n  var code, message, data = {}, args = arguments;\n  if (args.length === 2) {\n    code = args[0];\n    message = args[1];\n  } else {\n    if (args.length === 1) {\n      if (typeof args[0] === \"object\" && (args[0].code && args[0].message)) {\n        if (args[0].message.indexOf(messagePrefix) === 0) {\n          return args[0];\n        }\n        code = args[0].code;\n        message = args[0].message;\n        data = args[0].data;\n      } else {\n        if (typeof args[0] === \"string\") {\n          code = args[0];\n          message = errors[code];\n        }\n      }\n    } else {\n      code = \"UNKNOWN_ERROR\";\n      message = errors[code];\n    }\n  }\n  var error = new Error(messagePrefix + message);\n  error.code = code;\n  if (data) {\n    error.data = data;\n  }\n  return error;\n};\ngoog.provide(\"fb.simplelogin.transports.WinChan\");\ngoog.require(\"fb.simplelogin.transports.Transport\");\ngoog.require(\"fb.simplelogin.Vars\");\ngoog.require(\"fb.simplelogin.util.json\");\nvar RELAY_FRAME_NAME = \"__winchan_relay_frame\";\nvar CLOSE_CMD = \"die\";\nfunction addListener(w, event, cb) {\n  if (w[\"attachEvent\"]) {\n    w[\"attachEvent\"](\"on\" + event, cb);\n  } else {\n    if (w[\"addEventListener\"]) {\n      w[\"addEventListener\"](event, cb, false);\n    }\n  }\n}\nfunction removeListener(w, event, cb) {\n  if (w[\"detachEvent\"]) {\n    w[\"detachEvent\"](\"on\" + event, cb);\n  } else {\n    if (w[\"removeEventListener\"]) {\n      w[\"removeEventListener\"](event, cb, false);\n    }\n  }\n}\nfunction extractOrigin(url) {\n  if (!/^https?:\\/\\//.test(url)) {\n    url = window.location.href;\n  }\n  var m = /^(https?:\\/\\/[\\-_a-zA-Z\\.0-9:]+)/.exec(url);\n  if (m) {\n    return m[1];\n  }\n  return url;\n}\nfunction findRelay() {\n  var loc = window.location;\n  var frames = window.opener.frames;\n  var origin = loc.protocol + \"//\" + loc.host;\n  for (var i = frames.length - 1;i >= 0;i--) {\n    try {\n      if (frames[i].location.href.indexOf(origin) === 0 && frames[i].name === RELAY_FRAME_NAME) {\n        return frames[i];\n      }\n    } catch (e) {\n    }\n  }\n  return;\n}\nvar isInternetExplorer = function() {\n  var re, match, rv = -1;\n  var ua = navigator[\"userAgent\"];\n  if (navigator[\"appName\"] === \"Microsoft Internet Explorer\") {\n    re = /MSIE ([0-9]{1,}[\\.0-9]{0,})/;\n    match = ua.match(re);\n    if (match && match.length > 1) {\n      rv = parseFloat(match[1]);\n    }\n  } else {\n    if (ua.indexOf(\"Trident\") > -1) {\n      re = /rv:([0-9]{2,2}[\\.0-9]{0,})/;\n      match = ua.match(re);\n      if (match && match.length > 1) {\n        rv = parseFloat(match[1]);\n      }\n    }\n  }\n  return rv >= 8;\n}();\nfb.simplelogin.transports.WinChan_ = function() {\n};\nfb.simplelogin.transports.WinChan_.prototype.open = function(url, opts, cb) {\n  if (!cb) {\n    throw \"missing required callback argument\";\n  }\n  opts.url = url;\n  var err;\n  if (!opts.url) {\n    err = \"missing required 'url' parameter\";\n  }\n  if (!opts.relay_url) {\n    err = \"missing required 'relay_url' parameter\";\n  }\n  if (err) {\n    setTimeout(function() {\n      cb(err);\n    }, 0);\n  }\n  if (!opts.window_name) {\n    opts.window_name = null;\n  }\n  if (!opts.window_features || fb.simplelogin.util.env.isFennec()) {\n    opts.window_features = undefined;\n  }\n  var iframe;\n  var origin = extractOrigin(opts.url);\n  if (origin !== extractOrigin(opts.relay_url)) {\n    return setTimeout(function() {\n      cb(\"invalid arguments: origin of url and relay_url must match\");\n    }, 0);\n  }\n  var messageTarget;\n  if (isInternetExplorer) {\n    iframe = document.createElement(\"iframe\");\n    iframe.setAttribute(\"src\", opts.relay_url);\n    iframe.style.display = \"none\";\n    iframe.setAttribute(\"name\", RELAY_FRAME_NAME);\n    document.body.appendChild(iframe);\n    messageTarget = iframe.contentWindow;\n  }\n  var w = window.open(opts.url, opts.window_name, opts.window_features);\n  if (!messageTarget) {\n    messageTarget = w;\n  }\n  var closeInterval = setInterval(function() {\n    if (w && w.closed) {\n      cleanup();\n      if (cb) {\n        cb(\"unknown closed window\");\n        cb = null;\n      }\n    }\n  }, 500);\n  var req = fb.simplelogin.util.json.stringify({a:\"request\", d:opts.params});\n  function cleanup() {\n    if (iframe) {\n      document.body.removeChild(iframe);\n    }\n    iframe = undefined;\n    if (closeInterval) {\n      closeInterval = clearInterval(closeInterval);\n    }\n    removeListener(window, \"message\", onMessage);\n    removeListener(window, \"unload\", cleanup);\n    if (w) {\n      try {\n        w.close();\n      } catch (securityViolation) {\n        messageTarget.postMessage(CLOSE_CMD, origin);\n      }\n    }\n    w = messageTarget = undefined;\n  }\n  addListener(window, \"unload\", cleanup);\n  function onMessage(e) {\n    if (e.origin !== origin) {\n      return;\n    }\n    try {\n      var d = fb.simplelogin.util.json.parse(e.data);\n      if (d.a === \"ready\") {\n        messageTarget.postMessage(req, origin);\n      } else {\n        if (d.a === \"error\") {\n          cleanup();\n          if (cb) {\n            cb(d.d);\n            cb = null;\n          }\n        } else {\n          if (d.a === \"response\") {\n            cleanup();\n            if (cb) {\n              cb(null, d.d);\n              cb = null;\n            }\n          }\n        }\n      }\n    } catch (err) {\n    }\n  }\n  addListener(window, \"message\", onMessage);\n  return{close:cleanup, focus:function() {\n    if (w) {\n      try {\n        w.focus();\n      } catch (e) {\n      }\n    }\n  }};\n};\nfb.simplelogin.transports.WinChan_.prototype.onOpen = function(cb) {\n  var o = \"*\";\n  var msgTarget = isInternetExplorer ? findRelay() : window.opener;\n  var autoClose = true;\n  if (!msgTarget) {\n    throw \"can't find relay frame\";\n  }\n  function doPost(msg) {\n    msg = fb.simplelogin.util.json.stringify(msg);\n    if (isInternetExplorer) {\n      msgTarget.doPost(msg, o);\n    } else {\n      msgTarget.postMessage(msg, o);\n    }\n  }\n  function onMessage(e) {\n    var d;\n    try {\n      d = fb.simplelogin.util.json.parse(e.data);\n    } catch (err) {\n    }\n    if (!d || d.a !== \"request\") {\n      return;\n    }\n    removeListener(window, \"message\", onMessage);\n    o = e.origin;\n    if (cb) {\n      setTimeout(function() {\n        cb(o, d.d, function(r, forceKeepWindowOpen) {\n          autoClose = !forceKeepWindowOpen;\n          cb = undefined;\n          doPost({a:\"response\", d:r});\n        });\n      }, 0);\n    }\n  }\n  function onDie(e) {\n    if (autoClose && e.data === CLOSE_CMD) {\n      try {\n        window.close();\n      } catch (o_O) {\n      }\n    }\n  }\n  addListener(isInternetExplorer ? msgTarget : window, \"message\", onMessage);\n  addListener(isInternetExplorer ? msgTarget : window, \"message\", onDie);\n  try {\n    doPost({a:\"ready\"});\n  } catch (e) {\n    addListener(msgTarget, \"load\", function(e) {\n      doPost({a:\"ready\"});\n    });\n  }\n  var onUnload = function() {\n    try {\n      removeListener(isInternetExplorer ? msgTarget : window, \"message\", onDie);\n    } catch (ohWell) {\n    }\n    if (cb) {\n      doPost({a:\"error\", d:\"client closed window\"});\n    }\n    cb = undefined;\n    try {\n      window.close();\n    } catch (e) {\n    }\n  };\n  addListener(window, \"unload\", onUnload);\n  return{detach:function() {\n    removeListener(window, \"unload\", onUnload);\n  }};\n};\nfb.simplelogin.transports.WinChan_.prototype.isAvailable = function() {\n  return fb.simplelogin.util.json && (fb.simplelogin.util.json.parse && (fb.simplelogin.util.json.stringify && window.postMessage));\n};\nfb.simplelogin.transports.WinChan = new fb.simplelogin.transports.WinChan_;\ngoog.provide(\"fb.simplelogin.transports.TriggerIoTab\");\ngoog.provide(\"fb.simplelogin.transports.TriggerIoTab_\");\ngoog.require(\"fb.simplelogin.transports.Popup\");\ngoog.require(\"fb.simplelogin.Vars\");\ngoog.require(\"fb.simplelogin.util.json\");\ngoog.require(\"fb.simplelogin.util.misc\");\nfb.simplelogin.transports.TriggerIoTab_ = function() {\n};\nfb.simplelogin.transports.TriggerIoTab_.prototype.open = function(url, options, onComplete) {\n  var Forge, Tabs;\n  try {\n    Forge = window[\"forge\"];\n    Tabs = Forge[\"tabs\"];\n  } catch (err) {\n    return onComplete({code:\"TRIGGER_IO_TABS\", message:'\"forge.tabs\" module required when using Firebase Simple Login and Trigger.io'});\n  }\n  callbackInvoked = false;\n  var callbackHandler = function() {\n    var args = Array.prototype.slice.apply(arguments);\n    if (!callbackInvoked) {\n      callbackInvoked = true;\n      onComplete.apply(null, args);\n    }\n  };\n  forge.tabs.openWithOptions({url:url + \"&transport=internal-redirect-hash\", pattern:fb.simplelogin.Vars.getApiHost() + \"/blank/page*\"}, function(data) {\n    var result;\n    if (data && data[\"url\"]) {\n      try {\n        var urlObj = fb.simplelogin.util.misc.parseUrl(data[\"url\"]);\n        var urlHashEncoded = fb.simplelogin.util.misc.parseQuerystring(urlObj[\"hash\"]);\n        var temporaryResult = {};\n        for (var key in urlHashEncoded) {\n          temporaryResult[key] = fb.simplelogin.util.json.parse(decodeURIComponent(urlHashEncoded[key]));\n        }\n        result = temporaryResult;\n      } catch (e) {\n      }\n    }\n    if (result && (result[\"token\"] && result[\"user\"])) {\n      callbackHandler(null, result);\n    } else {\n      if (result && result[\"error\"]) {\n        callbackHandler(result[\"error\"]);\n      } else {\n        callbackHandler({code:\"RESPONSE_PAYLOAD_ERROR\", message:\"Unable to parse response payload for Trigger.io.\"});\n      }\n    }\n  }, function(err) {\n    callbackHandler({code:\"UNKNOWN_ERROR\", message:\"An unknown error occurred for Trigger.io.\"});\n  });\n};\nfb.simplelogin.transports.TriggerIoTab = new fb.simplelogin.transports.TriggerIoTab_;\ngoog.provide(\"fb.simplelogin.util.RSVP\");\nvar b, c;\n!function() {\n  var a = {}, d = {};\n  b = function(b, c, d) {\n    a[b] = {deps:c, callback:d};\n  }, c = function(b) {\n    function e(a) {\n      if (\".\" !== a.charAt(0)) {\n        return a;\n      }\n      for (var c = a.split(\"/\"), d = b.split(\"/\").slice(0, -1), e = 0, f = c.length;f > e;e++) {\n        var g = c[e];\n        if (\"..\" === g) {\n          d.pop();\n        } else {\n          if (\".\" === g) {\n            continue;\n          }\n          d.push(g);\n        }\n      }\n      return d.join(\"/\");\n    }\n    if (d[b]) {\n      return d[b];\n    }\n    if (d[b] = {}, !a[b]) {\n      throw new Error(\"Could not find module \" + b);\n    }\n    for (var f, g = a[b], h = g.deps, i = g.callback, j = [], k = 0, l = h.length;l > k;k++) {\n      j.push(\"exports\" === h[k] ? f = {} : c(e(h[k])));\n    }\n    var m = i.apply(this, j);\n    return d[b] = f || m;\n  }, c.entries = a;\n}(), b(\"rsvp/all-settled\", [\"./promise\", \"./utils\", \"exports\"], function(a, b, c) {\n  function d(a) {\n    return{state:\"fulfilled\", value:a};\n  }\n  function e(a) {\n    return{state:\"rejected\", reason:a};\n  }\n  var f = a[\"default\"], g = b.isArray, h = b.isNonThenable;\n  c[\"default\"] = function(a, b) {\n    return new f(function(b) {\n      function c(a) {\n        return function(b) {\n          j(a, d(b));\n        };\n      }\n      function i(a) {\n        return function(b) {\n          j(a, e(b));\n        };\n      }\n      function j(a, c) {\n        m[a] = c, 0 === --l && b(m);\n      }\n      if (!g(a)) {\n        throw new TypeError(\"You must pass an array to allSettled.\");\n      }\n      var k, l = a.length;\n      if (0 === l) {\n        return void b([]);\n      }\n      for (var m = new Array(l), n = 0;n < a.length;n++) {\n        k = a[n], h(k) ? j(n, d(k)) : f.resolve(k).then(c(n), i(n));\n      }\n    }, b);\n  };\n}), b(\"rsvp/all\", [\"./promise\", \"exports\"], function(a, b) {\n  var c = a[\"default\"];\n  b[\"default\"] = function(a, b) {\n    return c.all(a, b);\n  };\n}), b(\"rsvp/asap\", [\"exports\"], function(a) {\n  function b() {\n    return function() {\n      process.nextTick(e);\n    };\n  }\n  function c() {\n    var a = 0, b = new h(e), c = document.createTextNode(\"\");\n    return b.observe(c, {characterData:!0}), function() {\n      c.data = a = ++a % 2;\n    };\n  }\n  function d() {\n    return function() {\n      setTimeout(e, 1);\n    };\n  }\n  function e() {\n    for (var a = 0;a < i.length;a++) {\n      var b = i[a], c = b[0], d = b[1];\n      c(d);\n    }\n    i.length = 0;\n  }\n  a[\"default\"] = function(a, b) {\n    var c = i.push([a, b]);\n    1 === c && f();\n  };\n  var f, g = \"undefined\" != typeof window ? window : {}, h = g.MutationObserver || g.WebKitMutationObserver, i = [];\n  f = \"undefined\" != typeof process && \"[object process]\" === {}.toString.call(process) ? b() : h ? c() : d();\n}), b(\"rsvp/config\", [\"./events\", \"exports\"], function(a, b) {\n  function c(a, b) {\n    return \"onerror\" === a ? void e.on(\"error\", b) : 2 !== arguments.length ? e[a] : void(e[a] = b);\n  }\n  var d = a[\"default\"], e = {instrument:!1};\n  d.mixin(e), b.config = e, b.configure = c;\n}), b(\"rsvp/defer\", [\"./promise\", \"exports\"], function(a, b) {\n  var c = a[\"default\"];\n  b[\"default\"] = function(a) {\n    var b = {};\n    return b.promise = new c(function(a, c) {\n      b.resolve = a, b.reject = c;\n    }, a), b;\n  };\n}), b(\"rsvp/events\", [\"exports\"], function(a) {\n  function b(a, b) {\n    for (var c = 0, d = a.length;d > c;c++) {\n      if (a[c] === b) {\n        return c;\n      }\n    }\n    return-1;\n  }\n  function c(a) {\n    var b = a._promiseCallbacks;\n    return b || (b = a._promiseCallbacks = {}), b;\n  }\n  a[\"default\"] = {mixin:function(a) {\n    return a.on = this.on, a.off = this.off, a.trigger = this.trigger, a._promiseCallbacks = void 0, a;\n  }, on:function(a, d) {\n    var e, f = c(this);\n    e = f[a], e || (e = f[a] = []), -1 === b(e, d) && e.push(d);\n  }, off:function(a, d) {\n    var e, f, g = c(this);\n    return d ? (e = g[a], f = b(e, d), void(-1 !== f && e.splice(f, 1))) : void(g[a] = []);\n  }, trigger:function(a, b) {\n    var d, e, f = c(this);\n    if (d = f[a]) {\n      for (var g = 0;g < d.length;g++) {\n        (e = d[g])(b);\n      }\n    }\n  }};\n}), b(\"rsvp/filter\", [\"./promise\", \"./utils\", \"exports\"], function(a, b, c) {\n  var d = a[\"default\"], e = b.isFunction;\n  c[\"default\"] = function(a, b, c) {\n    return d.all(a, c).then(function(a) {\n      if (!e(b)) {\n        throw new TypeError(\"You must pass a function as filter's second argument.\");\n      }\n      for (var f = a.length, g = new Array(f), h = 0;f > h;h++) {\n        g[h] = b(a[h]);\n      }\n      return d.all(g, c).then(function(b) {\n        for (var c = new Array(f), d = 0, e = 0;f > e;e++) {\n          b[e] === !0 && (c[d] = a[e], d++);\n        }\n        return c.length = d, c;\n      });\n    });\n  };\n}), b(\"rsvp/hash-settled\", [\"./promise\", \"./utils\", \"exports\"], function(a, b, c) {\n  function d(a) {\n    return{state:\"fulfilled\", value:a};\n  }\n  function e(a) {\n    return{state:\"rejected\", reason:a};\n  }\n  var f = a[\"default\"], g = b.isNonThenable, h = b.keysOf;\n  c[\"default\"] = function(a) {\n    return new f(function(b) {\n      function c(a) {\n        return function(b) {\n          j(a, d(b));\n        };\n      }\n      function i(a) {\n        return function(b) {\n          j(a, e(b));\n        };\n      }\n      function j(a, c) {\n        m[a] = c, 0 === --o && b(m);\n      }\n      var k, l, m = {}, n = h(a), o = n.length;\n      if (0 === o) {\n        return void b(m);\n      }\n      for (var p = 0;p < n.length;p++) {\n        l = n[p], k = a[l], g(k) ? j(l, d(k)) : f.resolve(k).then(c(l), i(l));\n      }\n    });\n  };\n}), b(\"rsvp/hash\", [\"./promise\", \"./utils\", \"exports\"], function(a, b, c) {\n  var d = a[\"default\"], e = b.isNonThenable, f = b.keysOf;\n  c[\"default\"] = function(a) {\n    return new d(function(b, c) {\n      function g(a) {\n        return function(c) {\n          k[a] = c, 0 === --m && b(k);\n        };\n      }\n      function h(a) {\n        m = 0, c(a);\n      }\n      var i, j, k = {}, l = f(a), m = l.length;\n      if (0 === m) {\n        return void b(k);\n      }\n      for (var n = 0;n < l.length;n++) {\n        j = l[n], i = a[j], e(i) ? (k[j] = i, 0 === --m && b(k)) : d.resolve(i).then(g(j), h);\n      }\n    });\n  };\n}), b(\"rsvp/instrument\", [\"./config\", \"./utils\", \"exports\"], function(a, b, c) {\n  var d = a.config, e = b.now;\n  c[\"default\"] = function(a, b, c) {\n    try {\n      d.trigger(a, {guid:b._guidKey + b._id, eventName:a, detail:b._detail, childGuid:c && b._guidKey + c._id, label:b._label, timeStamp:e(), stack:(new Error(b._label)).stack});\n    } catch (f) {\n      setTimeout(function() {\n        throw f;\n      }, 0);\n    }\n  };\n}), b(\"rsvp/map\", [\"./promise\", \"./utils\", \"exports\"], function(a, b, c) {\n  var d = a[\"default\"], e = (b.isArray, b.isFunction);\n  c[\"default\"] = function(a, b, c) {\n    return d.all(a, c).then(function(a) {\n      if (!e(b)) {\n        throw new TypeError(\"You must pass a function as map's second argument.\");\n      }\n      for (var f = a.length, g = new Array(f), h = 0;f > h;h++) {\n        g[h] = b(a[h]);\n      }\n      return d.all(g, c);\n    });\n  };\n}), b(\"rsvp/node\", [\"./promise\", \"./utils\", \"exports\"], function(a, b, c) {\n  var d = a[\"default\"], e = b.isArray;\n  c[\"default\"] = function(a, b) {\n    function c() {\n      for (var c = arguments.length, e = new Array(c), h = 0;c > h;h++) {\n        e[h] = arguments[h];\n      }\n      var i;\n      return f || (g || !b) ? i = this : (console.warn('Deprecation: RSVP.denodeify() doesn\\'t allow setting the \"this\" binding anymore. Use yourFunction.bind(yourThis) instead.'), i = b), d.all(e).then(function(c) {\n        function e(d, e) {\n          function h() {\n            for (var a = arguments.length, c = new Array(a), h = 0;a > h;h++) {\n              c[h] = arguments[h];\n            }\n            var i = c[0], j = c[1];\n            if (i) {\n              e(i);\n            } else {\n              if (f) {\n                d(c.slice(1));\n              } else {\n                if (g) {\n                  var k, l, m = {}, n = c.slice(1);\n                  for (l = 0;l < b.length;l++) {\n                    k = b[l], m[k] = n[l];\n                  }\n                  d(m);\n                } else {\n                  d(j);\n                }\n              }\n            }\n          }\n          c.push(h), a.apply(i, c);\n        }\n        return new d(e);\n      });\n    }\n    var f = b === !0, g = e(b);\n    return c.__proto__ = a, c;\n  };\n}), b(\"rsvp/promise\", [\"./config\", \"./events\", \"./instrument\", \"./utils\", \"./promise/cast\", \"./promise/all\", \"./promise/race\", \"./promise/resolve\", \"./promise/reject\", \"exports\"], function(a, b, c, d, e, f, g, h, i, j) {\n  function k() {\n  }\n  function l(a, b) {\n    if (!z(a)) {\n      throw new TypeError(\"You must pass a resolver function as the first argument to the promise constructor\");\n    }\n    if (!(this instanceof l)) {\n      throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n    }\n    this._id = H++, this._label = b, this._subscribers = [], w.instrument && x(\"created\", this), k !== a && m(a, this);\n  }\n  function m(a, b) {\n    function c(a) {\n      r(b, a);\n    }\n    function d(a) {\n      t(b, a);\n    }\n    try {\n      a(c, d);\n    } catch (e) {\n      d(e);\n    }\n  }\n  function n(a, b, c, d) {\n    var e = a._subscribers, f = e.length;\n    e[f] = b, e[f + K] = c, e[f + L] = d;\n  }\n  function o(a, b) {\n    var c, d, e = a._subscribers, f = a._detail;\n    w.instrument && x(b === K ? \"fulfilled\" : \"rejected\", a);\n    for (var g = 0;g < e.length;g += 3) {\n      c = e[g], d = e[g + b], p(b, c, d, f);\n    }\n    a._subscribers = null;\n  }\n  function p(a, b, c, d) {\n    var e, f, g, h, i = z(c);\n    if (i) {\n      try {\n        e = c(d), g = !0;\n      } catch (j) {\n        h = !0, f = j;\n      }\n    } else {\n      e = d, g = !0;\n    }\n    q(b, e) || (i && g ? r(b, e) : h ? t(b, f) : a === K ? r(b, e) : a === L && t(b, e));\n  }\n  function q(a, b) {\n    var c, d = null;\n    try {\n      if (a === b) {\n        throw new TypeError(\"A promises callback cannot return that same promise.\");\n      }\n      if (y(b) && (d = b.then, z(d))) {\n        return d.call(b, function(d) {\n          return c ? !0 : (c = !0, void(b !== d ? r(a, d) : s(a, d)));\n        }, function(b) {\n          return c ? !0 : (c = !0, void t(a, b));\n        }, \"Settle: \" + (a._label || \" unknown promise\")), !0;\n      }\n    } catch (e) {\n      return c ? !0 : (t(a, e), !0);\n    }\n    return!1;\n  }\n  function r(a, b) {\n    a === b ? s(a, b) : q(a, b) || s(a, b);\n  }\n  function s(a, b) {\n    a._state === I && (a._state = J, a._detail = b, w.async(u, a));\n  }\n  function t(a, b) {\n    a._state === I && (a._state = J, a._detail = b, w.async(v, a));\n  }\n  function u(a) {\n    o(a, a._state = K);\n  }\n  function v(a) {\n    a._onerror && a._onerror(a._detail), o(a, a._state = L);\n  }\n  var w = a.config, x = (b[\"default\"], c[\"default\"]), y = d.objectOrFunction, z = d.isFunction, A = d.now, B = e[\"default\"], C = f[\"default\"], D = g[\"default\"], E = h[\"default\"], F = i[\"default\"], G = \"rsvp_\" + A() + \"-\", H = 0;\n  j[\"default\"] = l, l.cast = B, l.all = C, l.race = D, l.resolve = E, l.reject = F;\n  var I = void 0, J = 0, K = 1, L = 2;\n  l.prototype = {constructor:l, _id:void 0, _guidKey:G, _label:void 0, _state:void 0, _detail:void 0, _subscribers:void 0, _onerror:function(a) {\n    w.trigger(\"error\", a);\n  }, then:function(a, b, c) {\n    var d = this;\n    this._onerror = null;\n    var e = new this.constructor(k, c);\n    if (this._state) {\n      var f = arguments;\n      w.async(function() {\n        p(d._state, e, f[d._state - 1], d._detail);\n      });\n    } else {\n      n(this, e, a, b);\n    }\n    return w.instrument && x(\"chained\", d, e), e;\n  }, \"catch\":function(a, b) {\n    return this.then(null, a, b);\n  }, \"finally\":function(a, b) {\n    var c = this.constructor;\n    return this.then(function(b) {\n      return c.resolve(a()).then(function() {\n        return b;\n      });\n    }, function(b) {\n      return c.resolve(a()).then(function() {\n        throw b;\n      });\n    }, b);\n  }};\n}), b(\"rsvp/promise/all\", [\"../utils\", \"exports\"], function(a, b) {\n  var c = a.isArray, d = a.isNonThenable;\n  b[\"default\"] = function(a, b) {\n    var e = this;\n    return new e(function(b, f) {\n      function g(a) {\n        return function(c) {\n          k[a] = c, 0 === --j && b(k);\n        };\n      }\n      function h(a) {\n        j = 0, f(a);\n      }\n      if (!c(a)) {\n        throw new TypeError(\"You must pass an array to all.\");\n      }\n      var i, j = a.length, k = new Array(j);\n      if (0 === j) {\n        return void b(k);\n      }\n      for (var l = 0;l < a.length;l++) {\n        i = a[l], d(i) ? (k[l] = i, 0 === --j && b(k)) : e.resolve(i).then(g(l), h);\n      }\n    }, b);\n  };\n}), b(\"rsvp/promise/cast\", [\"exports\"], function(a) {\n  a[\"default\"] = function(a, b) {\n    var c = this;\n    return a && (\"object\" == typeof a && a.constructor === c) ? a : new c(function(b) {\n      b(a);\n    }, b);\n  };\n}), b(\"rsvp/promise/race\", [\"../utils\", \"exports\"], function(a, b) {\n  var c = a.isArray, d = (a.isFunction, a.isNonThenable);\n  b[\"default\"] = function(a, b) {\n    var e, f = this;\n    return new f(function(b, g) {\n      function h(a) {\n        j && (j = !1, b(a));\n      }\n      function i(a) {\n        j && (j = !1, g(a));\n      }\n      if (!c(a)) {\n        throw new TypeError(\"You must pass an array to race.\");\n      }\n      for (var j = !0, k = 0;k < a.length;k++) {\n        if (e = a[k], d(e)) {\n          return j = !1, void b(e);\n        }\n        f.resolve(e).then(h, i);\n      }\n    }, b);\n  };\n}), b(\"rsvp/promise/reject\", [\"exports\"], function(a) {\n  a[\"default\"] = function(a, b) {\n    var c = this;\n    return new c(function(b, c) {\n      c(a);\n    }, b);\n  };\n}), b(\"rsvp/promise/resolve\", [\"exports\"], function(a) {\n  a[\"default\"] = function(a, b) {\n    var c = this;\n    return a && (\"object\" == typeof a && a.constructor === c) ? a : new c(function(b) {\n      b(a);\n    }, b);\n  };\n}), b(\"rsvp/race\", [\"./promise\", \"exports\"], function(a, b) {\n  var c = a[\"default\"];\n  b[\"default\"] = function(a, b) {\n    return c.race(a, b);\n  };\n}), b(\"rsvp/reject\", [\"./promise\", \"exports\"], function(a, b) {\n  var c = a[\"default\"];\n  b[\"default\"] = function(a, b) {\n    return c.reject(a, b);\n  };\n}), b(\"rsvp/resolve\", [\"./promise\", \"exports\"], function(a, b) {\n  var c = a[\"default\"];\n  b[\"default\"] = function(a, b) {\n    return c.resolve(a, b);\n  };\n}), b(\"rsvp/rethrow\", [\"exports\"], function(a) {\n  a[\"default\"] = function(a) {\n    throw setTimeout(function() {\n      throw a;\n    }), a;\n  };\n}), b(\"rsvp/utils\", [\"exports\"], function(a) {\n  function b(a) {\n    return \"function\" == typeof a || \"object\" == typeof a && null !== a;\n  }\n  function c(a) {\n    return \"function\" == typeof a;\n  }\n  function d(a) {\n    return!b(a);\n  }\n  a.objectOrFunction = b, a.isFunction = c, a.isNonThenable = d;\n  var e;\n  e = Array.isArray ? Array.isArray : function(a) {\n    return \"[object Array]\" === Object.prototype.toString.call(a);\n  };\n  var f = e;\n  a.isArray = f;\n  var g = Date.now || function() {\n    return(new Date).getTime();\n  };\n  a.now = g;\n  var h = Object.keys || function(a) {\n    var b = [];\n    for (var c in a) {\n      b.push(c);\n    }\n    return b;\n  };\n  a.keysOf = h;\n}), b(\"rsvp\", [\"./rsvp/promise\", \"./rsvp/events\", \"./rsvp/node\", \"./rsvp/all\", \"./rsvp/all-settled\", \"./rsvp/race\", \"./rsvp/hash\", \"./rsvp/hash-settled\", \"./rsvp/rethrow\", \"./rsvp/defer\", \"./rsvp/config\", \"./rsvp/map\", \"./rsvp/resolve\", \"./rsvp/reject\", \"./rsvp/filter\", \"./rsvp/asap\", \"exports\"], function(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) {\n  function r(a, b) {\n    E.async(a, b);\n  }\n  function s() {\n    E.on.apply(E, arguments);\n  }\n  function t() {\n    E.off.apply(E, arguments);\n  }\n  var u = a[\"default\"], v = b[\"default\"], w = c[\"default\"], x = d[\"default\"], y = e[\"default\"], z = f[\"default\"], A = g[\"default\"], B = h[\"default\"], C = i[\"default\"], D = j[\"default\"], E = k.config, F = k.configure, G = l[\"default\"], H = m[\"default\"], I = n[\"default\"], J = o[\"default\"], K = p[\"default\"];\n  if (E.async = K, \"undefined\" != typeof window && \"object\" == typeof window.__PROMISE_INSTRUMENTATION__) {\n    var L = window.__PROMISE_INSTRUMENTATION__;\n    F(\"instrument\", !0);\n    for (var M in L) {\n      L.hasOwnProperty(M) && s(M, L[M]);\n    }\n  }\n  q.Promise = u, q.EventTarget = v, q.all = x, q.allSettled = y, q.race = z, q.hash = A, q.hashSettled = B, q.rethrow = C, q.defer = D, q.denodeify = w, q.configure = F, q.on = s, q.off = t, q.resolve = H, q.reject = I, q.async = r, q.map = G, q.filter = J;\n});\nfb.simplelogin.util.RSVP = c(\"rsvp\");\ngoog.provide(\"fb.simplelogin.util.env\");\nfb.simplelogin.util.env.hasLocalStorage = function(str) {\n  try {\n    if (localStorage) {\n      localStorage.setItem(\"firebase-sentinel\", \"test\");\n      var result = localStorage.getItem(\"firebase-sentinel\");\n      localStorage.removeItem(\"firebase-sentinel\");\n      return result === \"test\";\n    }\n  } catch (e) {\n  }\n  return false;\n};\nfb.simplelogin.util.env.hasSessionStorage = function(str) {\n  try {\n    if (sessionStorage) {\n      sessionStorage.setItem(\"firebase-sentinel\", \"test\");\n      var result = sessionStorage.getItem(\"firebase-sentinel\");\n      sessionStorage.removeItem(\"firebase-sentinel\");\n      return result === \"test\";\n    }\n  } catch (e) {\n  }\n  return false;\n};\nfb.simplelogin.util.env.isMobileCordovaInAppBrowser = function() {\n  return(window[\"cordova\"] || (window[\"CordovaInAppBrowser\"] || window[\"phonegap\"])) && /ios|iphone|ipod|ipad|android/i.test(navigator.userAgent);\n};\nfb.simplelogin.util.env.isMobileTriggerIoTab = function() {\n  return window[\"forge\"] && /ios|iphone|ipod|ipad|android/i.test(navigator.userAgent);\n};\nfb.simplelogin.util.env.isWindowsMetro = function() {\n  return!!window[\"Windows\"] && /^ms-appx:/.test(location.href);\n};\nfb.simplelogin.util.env.isChromeiOS = function() {\n  return!!navigator.userAgent.match(/CriOS/);\n};\nfb.simplelogin.util.env.isTwitteriOS = function() {\n  return!!navigator.userAgent.match(/Twitter for iPhone/);\n};\nfb.simplelogin.util.env.isFacebookiOS = function() {\n  return!!navigator.userAgent.match(/FBAN\\/FBIOS/);\n};\nfb.simplelogin.util.env.isWindowsPhone = function() {\n  return!!navigator.userAgent.match(/Windows Phone/);\n};\nfb.simplelogin.util.env.isStandaloneiOS = function() {\n  return!!window.navigator.standalone;\n};\nfb.simplelogin.util.env.isPhantomJS = function() {\n  return!!navigator.userAgent.match(/PhantomJS/);\n};\nfb.simplelogin.util.env.isIeLT10 = function() {\n  var re, match, rv = -1;\n  var ua = navigator[\"userAgent\"];\n  if (navigator[\"appName\"] === \"Microsoft Internet Explorer\") {\n    re = /MSIE ([0-9]{1,}[\\.0-9]{0,})/;\n    match = ua.match(re);\n    if (match && match.length > 1) {\n      rv = parseFloat(match[1]);\n    }\n    if (rv < 10) {\n      return true;\n    }\n  }\n  return false;\n};\nfb.simplelogin.util.env.isFennec = function() {\n  try {\n    var userAgent = navigator[\"userAgent\"];\n    return userAgent.indexOf(\"Fennec/\") != -1 || userAgent.indexOf(\"Firefox/\") != -1 && userAgent.indexOf(\"Android\") != -1;\n  } catch (e) {\n  }\n  return false;\n};\ngoog.provide(\"fb.simplelogin.transports.XHR\");\ngoog.provide(\"fb.simplelogin.transports.XHR_\");\ngoog.require(\"fb.simplelogin.transports.Transport\");\ngoog.require(\"fb.simplelogin.Vars\");\ngoog.require(\"fb.simplelogin.util.json\");\nfb.simplelogin.transports.XHR_ = function() {\n};\nfb.simplelogin.transports.XHR_.prototype.open = function(url, data, onComplete) {\n  var self = this;\n  var options = {contentType:\"application/json\"};\n  var xhr = new XMLHttpRequest, method = (options.method || \"GET\").toUpperCase(), contentType = options.contentType || \"application/x-www-form-urlencoded\", callbackInvoked = false, key;\n  var callbackHandler = function() {\n    if (!callbackInvoked && xhr.readyState === 4) {\n      callbackInvoked = true;\n      var data, error;\n      try {\n        data = fb.simplelogin.util.json.parse(xhr.responseText);\n        error = data[\"error\"] || null;\n        delete data[\"error\"];\n      } catch (e) {\n      }\n      return onComplete && onComplete(error, data);\n    }\n  };\n  xhr.onreadystatechange = callbackHandler;\n  if (data) {\n    if (method === \"GET\") {\n      if (url.indexOf(\"?\") === -1) {\n        url += \"?\";\n      }\n      url += this.formatQueryString(data);\n      data = null;\n    } else {\n      if (contentType === \"application/json\") {\n        data = fb.simplelogin.util.json.stringify(data);\n      }\n      if (contentType === \"application/x-www-form-urlencoded\") {\n        data = this.formatQueryString(data);\n      }\n    }\n  }\n  xhr.open(method, url, true);\n  var headers = {\"X-Requested-With\":\"XMLHttpRequest\", \"Accept\":\"application/json;text/plain\", \"Content-Type\":contentType};\n  options.headers = options.headers || {};\n  for (key in options.headers) {\n    headers[key] = options.headers[key];\n  }\n  for (key in headers) {\n    xhr.setRequestHeader(key, headers[key]);\n  }\n  xhr.send(data);\n};\nfb.simplelogin.transports.XHR_.prototype.isAvailable = function() {\n  return window[\"XMLHttpRequest\"] && (typeof window[\"XMLHttpRequest\"] === \"function\" && !fb.simplelogin.util.env.isIeLT10());\n};\nfb.simplelogin.transports.XHR_.prototype.formatQueryString = function(data) {\n  if (!data) {\n    return \"\";\n  }\n  var tokens = [];\n  for (var key in data) {\n    tokens.push(encodeURIComponent(key) + \"=\" + encodeURIComponent(data[key]));\n  }\n  return tokens.join(\"&\");\n};\nfb.simplelogin.transports.XHR = new fb.simplelogin.transports.XHR_;\ngoog.provide(\"fb.simplelogin.util.validation\");\nvar VALID_EMAIL_REGEX_ = /^([a-zA-Z0-9_\\.\\-\\+])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,6})+$/;\nfb.simplelogin.util.validation.validateArgCount = function(fnName, minCount, maxCount, argCount) {\n  var argError;\n  if (argCount < minCount) {\n    argError = \"at least \" + minCount;\n  } else {\n    if (argCount > maxCount) {\n      argError = maxCount === 0 ? \"none\" : \"no more than \" + maxCount;\n    }\n  }\n  if (argError) {\n    var error = fnName + \" failed: Was called with \" + argCount + (argCount === 1 ? \" argument.\" : \" arguments.\") + \" Expects \" + argError + \".\";\n    throw new Error(error);\n  }\n};\nfb.simplelogin.util.validation.isValidEmail = function(email) {\n  return goog.isString(email) && VALID_EMAIL_REGEX_.test(email);\n};\nfb.simplelogin.util.validation.isValidPassword = function(password) {\n  return goog.isString(password);\n};\nfb.simplelogin.util.validation.isValidNamespace = function(namespace) {\n  return goog.isString(namespace);\n};\nfb.simplelogin.util.validation.errorPrefix_ = function(fnName, argumentNumber, optional) {\n  var argName = \"\";\n  switch(argumentNumber) {\n    case 1:\n      argName = optional ? \"first\" : \"First\";\n      break;\n    case 2:\n      argName = optional ? \"second\" : \"Second\";\n      break;\n    case 3:\n      argName = optional ? \"third\" : \"Third\";\n      break;\n    case 4:\n      argName = optional ? \"fourth\" : \"Fourth\";\n      break;\n    default:\n      fb.core.util.validation.assert(false, \"errorPrefix_ called with argumentNumber > 4.  Need to update it?\");\n  }\n  var error = fnName + \" failed: \";\n  error += argName + \" argument \";\n  return error;\n};\nfb.simplelogin.util.validation.validateNamespace = function(fnName, argumentNumber, namespace, optional) {\n  if (optional && !goog.isDef(namespace)) {\n    return;\n  }\n  if (!goog.isString(namespace)) {\n    throw new Error(fb.simplelogin.util.validation.errorPrefix_(fnName, argumentNumber, optional) + \"must be a valid firebase namespace.\");\n  }\n};\nfb.simplelogin.util.validation.validateCallback = function(fnName, argumentNumber, callback, optional) {\n  if (optional && !goog.isDef(callback)) {\n    return;\n  }\n  if (!goog.isFunction(callback)) {\n    throw new Error(fb.simplelogin.util.validation.errorPrefix_(fnName, argumentNumber, optional) + \"must be a valid function.\");\n  }\n};\nfb.simplelogin.util.validation.validateString = function(fnName, argumentNumber, string, optional) {\n  if (optional && !goog.isDef(string)) {\n    return;\n  }\n  if (!goog.isString(string)) {\n    throw new Error(fb.simplelogin.util.validation.errorPrefix_(fnName, argumentNumber, optional) + \"must be a valid string.\");\n  }\n};\nfb.simplelogin.util.validation.validateContextObject = function(fnName, argumentNumber, context, optional) {\n  if (optional && !goog.isDef(context)) {\n    return;\n  }\n  if (!goog.isObject(context) || context === null) {\n    throw new Error(fb.simplelogin.util.validation.errorPrefix_(fnName, argumentNumber, optional) + \"must be a valid context object.\");\n  }\n};\ngoog.provide(\"fb.simplelogin.transports.JSONP\");\ngoog.provide(\"fb.simplelogin.transports.JSONP_\");\ngoog.require(\"fb.simplelogin.transports.Transport\");\ngoog.require(\"fb.simplelogin.Vars\");\ngoog.require(\"fb.simplelogin.util.json\");\nvar CALLBACK_NAMESPACE = \"_FirebaseSimpleLoginJSONP\";\nfb.simplelogin.transports.JSONP_ = function() {\n  window[CALLBACK_NAMESPACE] = window[CALLBACK_NAMESPACE] || {};\n};\nfb.simplelogin.transports.JSONP_.prototype.open = function(url, options, onComplete) {\n  url += /\\?/.test(url) ? \"\" : \"?\";\n  url += \"&transport=jsonp\";\n  for (var param in options) {\n    url += \"&\" + encodeURIComponent(param) + \"=\" + encodeURIComponent(options[param]);\n  }\n  var callbackId = this.generateRequestId_();\n  url += \"&callback=\" + encodeURIComponent(CALLBACK_NAMESPACE + \".\" + callbackId);\n  this.registerCallback_(callbackId, onComplete);\n  this.writeScriptTag_(callbackId, url, onComplete);\n};\nfb.simplelogin.transports.JSONP_.prototype.generateRequestId_ = function() {\n  return \"_FirebaseJSONP\" + (new Date).getTime() + Math.floor(Math.random() * 100);\n};\nfb.simplelogin.transports.JSONP_.prototype.registerCallback_ = function(id, callback) {\n  var self = this;\n  window[CALLBACK_NAMESPACE][id] = function(result) {\n    var error = result[\"error\"] || null;\n    delete result[\"error\"];\n    callback(error, result);\n    self.removeCallback_(id);\n  };\n};\nfb.simplelogin.transports.JSONP_.prototype.removeCallback_ = function(id) {\n  setTimeout(function() {\n    delete window[CALLBACK_NAMESPACE][id];\n    var el = document.getElementById(id);\n    if (el) {\n      el.parentNode.removeChild(el);\n    }\n  }, 0);\n};\nfb.simplelogin.transports.JSONP_.prototype.writeScriptTag_ = function(id, url, cb) {\n  var self = this;\n  setTimeout(function() {\n    try {\n      var js = document.createElement(\"script\");\n      js.type = \"text/javascript\";\n      js.id = id;\n      js.async = true;\n      js.src = url;\n      js.onerror = function() {\n        var el = document.getElementById(id);\n        if (el !== null) {\n          el.parentNode.removeChild(el);\n        }\n        cb && cb(self.formatError_({code:\"SERVER_ERROR\", message:\"An unknown server error occurred.\"}));\n      };\n      document.getElementsByTagName(\"head\")[0].appendChild(js);\n    } catch (e) {\n      cb && cb(self.formatError_({code:\"SERVER_ERROR\", message:\"An unknown server error occurred.\"}));\n    }\n  }, 0);\n};\nfb.simplelogin.transports.JSONP_.prototype.formatError_ = function(error) {\n  var errorObj;\n  if (!error) {\n    errorObj = new Error;\n    errorObj.code = \"UNKNOWN_ERROR\";\n  } else {\n    errorObj = new Error(error.message);\n    errorObj.code = error.code || \"UNKNOWN_ERROR\";\n  }\n  return errorObj;\n};\nfb.simplelogin.transports.JSONP = new fb.simplelogin.transports.JSONP_;\ngoog.provide(\"fb.simplelogin.providers.Password\");\ngoog.provide(\"fb.simplelogin.providers.Password_\");\ngoog.require(\"fb.simplelogin.Vars\");\ngoog.require(\"fb.simplelogin.util.validation\");\ngoog.require(\"fb.simplelogin.Errors\");\ngoog.require(\"fb.simplelogin.transports.JSONP\");\ngoog.require(\"fb.simplelogin.transports.XHR\");\nfb.simplelogin.providers.Password_ = function() {\n};\nfb.simplelogin.providers.Password_.prototype.getTransport_ = function() {\n  if (fb.simplelogin.transports.XHR.isAvailable()) {\n    return fb.simplelogin.transports.XHR;\n  } else {\n    return fb.simplelogin.transports.JSONP;\n  }\n};\nfb.simplelogin.providers.Password_.prototype.login = function(data, onComplete) {\n  var url = fb.simplelogin.Vars.getApiHost() + \"/auth/firebase\";\n  if (!fb.simplelogin.util.validation.isValidNamespace(data[\"firebase\"])) {\n    return onComplete && onComplete(\"INVALID_FIREBASE\");\n  }\n  this.getTransport_().open(url, data, onComplete);\n};\nfb.simplelogin.providers.Password_.prototype.createUser = function(data, onComplete) {\n  var url = fb.simplelogin.Vars.getApiHost() + \"/auth/firebase/create\";\n  if (!fb.simplelogin.util.validation.isValidNamespace(data[\"firebase\"])) {\n    return onComplete && onComplete(\"INVALID_FIREBASE\");\n  }\n  if (!fb.simplelogin.util.validation.isValidEmail(data[\"email\"])) {\n    return onComplete && onComplete(\"INVALID_EMAIL\");\n  }\n  if (!fb.simplelogin.util.validation.isValidPassword(data[\"password\"])) {\n    return onComplete && onComplete(\"INVALID_PASSWORD\");\n  }\n  this.getTransport_().open(url, data, onComplete);\n};\nfb.simplelogin.providers.Password_.prototype.changePassword = function(data, onComplete) {\n  var url = fb.simplelogin.Vars.getApiHost() + \"/auth/firebase/update\";\n  if (!fb.simplelogin.util.validation.isValidNamespace(data[\"firebase\"])) {\n    return onComplete && onComplete(\"INVALID_FIREBASE\");\n  }\n  if (!fb.simplelogin.util.validation.isValidEmail(data[\"email\"])) {\n    return onComplete && onComplete(\"INVALID_EMAIL\");\n  }\n  if (!fb.simplelogin.util.validation.isValidPassword(data[\"newPassword\"])) {\n    return onComplete && onComplete(\"INVALID_PASSWORD\");\n  }\n  this.getTransport_().open(url, data, onComplete);\n};\nfb.simplelogin.providers.Password_.prototype.removeUser = function(data, onComplete) {\n  var url = fb.simplelogin.Vars.getApiHost() + \"/auth/firebase/remove\";\n  if (!fb.simplelogin.util.validation.isValidNamespace(data[\"firebase\"])) {\n    return onComplete && onComplete(\"INVALID_FIREBASE\");\n  }\n  if (!fb.simplelogin.util.validation.isValidEmail(data[\"email\"])) {\n    return onComplete && onComplete(\"INVALID_EMAIL\");\n  }\n  if (!fb.simplelogin.util.validation.isValidPassword(data[\"password\"])) {\n    return onComplete && onComplete(\"INVALID_PASSWORD\");\n  }\n  this.getTransport_().open(url, data, onComplete);\n};\nfb.simplelogin.providers.Password_.prototype.sendPasswordResetEmail = function(data, onComplete) {\n  var url = fb.simplelogin.Vars.getApiHost() + \"/auth/firebase/reset_password\";\n  if (!fb.simplelogin.util.validation.isValidNamespace(data[\"firebase\"])) {\n    return onComplete && onComplete(\"INVALID_FIREBASE\");\n  }\n  if (!fb.simplelogin.util.validation.isValidEmail(data[\"email\"])) {\n    return onComplete && onComplete(\"INVALID_EMAIL\");\n  }\n  this.getTransport_().open(url, data, onComplete);\n};\nfb.simplelogin.providers.Password = new fb.simplelogin.providers.Password_;\ngoog.provide(\"fb.simplelogin.transports.WindowsMetroAuthBroker\");\ngoog.provide(\"fb.simplelogin.transports.WindowsMetroAuthBroker_\");\ngoog.require(\"fb.simplelogin.transports.Popup\");\ngoog.require(\"fb.simplelogin.Vars\");\ngoog.require(\"fb.simplelogin.util.json\");\ngoog.require(\"fb.simplelogin.util.misc\");\nfb.simplelogin.transports.WindowsMetroAuthBroker_ = function() {\n};\nfb.simplelogin.transports.WindowsMetroAuthBroker_.prototype.open = function(url, options, onComplete) {\n  var Uri, WebAuthenticationOptions, WebAuthenticationBroker, authenticateAsync, callbackInvoked, callbackHandler;\n  try {\n    Uri = window[\"Windows\"][\"Foundation\"][\"Uri\"];\n    WebAuthenticationOptions = window[\"Windows\"][\"Security\"][\"Authentication\"][\"Web\"][\"WebAuthenticationOptions\"];\n    WebAuthenticationBroker = window[\"Windows\"][\"Security\"][\"Authentication\"][\"Web\"][\"WebAuthenticationBroker\"];\n    authenticateAsync = WebAuthenticationBroker[\"authenticateAsync\"];\n  } catch (err) {\n    return onComplete({code:\"WINDOWS_METRO\", message:'\"Windows.Security.Authentication.Web.WebAuthenticationBroker\" required when using Firebase Simple Login in Windows Metro context'});\n  }\n  callbackInvoked = false;\n  var callbackHandler = function() {\n    var args = Array.prototype.slice.apply(arguments);\n    if (!callbackInvoked) {\n      callbackInvoked = true;\n      onComplete.apply(null, args);\n    }\n  };\n  var startUri = new Uri(url + \"&transport=internal-redirect-hash\");\n  var endUri = new Uri(fb.simplelogin.Vars.getApiHost() + \"/blank/page.html\");\n  authenticateAsync(WebAuthenticationOptions[\"none\"], startUri, endUri).done(function(data) {\n    var result;\n    if (data && data[\"responseData\"]) {\n      try {\n        var urlObj = fb.simplelogin.util.misc.parseUrl(data[\"responseData\"]);\n        var urlHashEncoded = fb.simplelogin.util.misc.parseQuerystring(urlObj[\"hash\"]);\n        var temporaryResult = {};\n        for (var key in urlHashEncoded) {\n          temporaryResult[key] = fb.simplelogin.util.json.parse(decodeURIComponent(urlHashEncoded[key]));\n        }\n        result = temporaryResult;\n      } catch (e) {\n      }\n    }\n    if (result && (result[\"token\"] && result[\"user\"])) {\n      callbackHandler(null, result);\n    } else {\n      if (result && result[\"error\"]) {\n        callbackHandler(result[\"error\"]);\n      } else {\n        callbackHandler({code:\"RESPONSE_PAYLOAD_ERROR\", message:\"Unable to parse response payload for Windows.\"});\n      }\n    }\n  }, function(err) {\n    callbackHandler({code:\"UNKNOWN_ERROR\", message:\"An unknown error occurred for Windows.\"});\n  });\n};\nfb.simplelogin.transports.WindowsMetroAuthBroker = new fb.simplelogin.transports.WindowsMetroAuthBroker_;\ngoog.provide(\"goog.string\");\ngoog.provide(\"goog.string.Unicode\");\ngoog.string.Unicode = {NBSP:\"\\u00a0\"};\ngoog.string.startsWith = function(str, prefix) {\n  return str.lastIndexOf(prefix, 0) == 0;\n};\ngoog.string.endsWith = function(str, suffix) {\n  var l = str.length - suffix.length;\n  return l >= 0 && str.indexOf(suffix, l) == l;\n};\ngoog.string.caseInsensitiveStartsWith = function(str, prefix) {\n  return goog.string.caseInsensitiveCompare(prefix, str.substr(0, prefix.length)) == 0;\n};\ngoog.string.caseInsensitiveEndsWith = function(str, suffix) {\n  return goog.string.caseInsensitiveCompare(suffix, str.substr(str.length - suffix.length, suffix.length)) == 0;\n};\ngoog.string.caseInsensitiveEquals = function(str1, str2) {\n  return str1.toLowerCase() == str2.toLowerCase();\n};\ngoog.string.subs = function(str, var_args) {\n  var splitParts = str.split(\"%s\");\n  var returnString = \"\";\n  var subsArguments = Array.prototype.slice.call(arguments, 1);\n  while (subsArguments.length && splitParts.length > 1) {\n    returnString += splitParts.shift() + subsArguments.shift();\n  }\n  return returnString + splitParts.join(\"%s\");\n};\ngoog.string.collapseWhitespace = function(str) {\n  return str.replace(/[\\s\\xa0]+/g, \" \").replace(/^\\s+|\\s+$/g, \"\");\n};\ngoog.string.isEmpty = function(str) {\n  return/^[\\s\\xa0]*$/.test(str);\n};\ngoog.string.isEmptySafe = function(str) {\n  return goog.string.isEmpty(goog.string.makeSafe(str));\n};\ngoog.string.isBreakingWhitespace = function(str) {\n  return!/[^\\t\\n\\r ]/.test(str);\n};\ngoog.string.isAlpha = function(str) {\n  return!/[^a-zA-Z]/.test(str);\n};\ngoog.string.isNumeric = function(str) {\n  return!/[^0-9]/.test(str);\n};\ngoog.string.isAlphaNumeric = function(str) {\n  return!/[^a-zA-Z0-9]/.test(str);\n};\ngoog.string.isSpace = function(ch) {\n  return ch == \" \";\n};\ngoog.string.isUnicodeChar = function(ch) {\n  return ch.length == 1 && (ch >= \" \" && ch <= \"~\") || ch >= \"\\u0080\" && ch <= \"\\ufffd\";\n};\ngoog.string.stripNewlines = function(str) {\n  return str.replace(/(\\r\\n|\\r|\\n)+/g, \" \");\n};\ngoog.string.canonicalizeNewlines = function(str) {\n  return str.replace(/(\\r\\n|\\r|\\n)/g, \"\\n\");\n};\ngoog.string.normalizeWhitespace = function(str) {\n  return str.replace(/\\xa0|\\s/g, \" \");\n};\ngoog.string.normalizeSpaces = function(str) {\n  return str.replace(/\\xa0|[ \\t]+/g, \" \");\n};\ngoog.string.collapseBreakingSpaces = function(str) {\n  return str.replace(/[\\t\\r\\n ]+/g, \" \").replace(/^[\\t\\r\\n ]+|[\\t\\r\\n ]+$/g, \"\");\n};\ngoog.string.trim = function(str) {\n  return str.replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g, \"\");\n};\ngoog.string.trimLeft = function(str) {\n  return str.replace(/^[\\s\\xa0]+/, \"\");\n};\ngoog.string.trimRight = function(str) {\n  return str.replace(/[\\s\\xa0]+$/, \"\");\n};\ngoog.string.caseInsensitiveCompare = function(str1, str2) {\n  var test1 = String(str1).toLowerCase();\n  var test2 = String(str2).toLowerCase();\n  if (test1 < test2) {\n    return-1;\n  } else {\n    if (test1 == test2) {\n      return 0;\n    } else {\n      return 1;\n    }\n  }\n};\ngoog.string.numerateCompareRegExp_ = /(\\.\\d+)|(\\d+)|(\\D+)/g;\ngoog.string.numerateCompare = function(str1, str2) {\n  if (str1 == str2) {\n    return 0;\n  }\n  if (!str1) {\n    return-1;\n  }\n  if (!str2) {\n    return 1;\n  }\n  var tokens1 = str1.toLowerCase().match(goog.string.numerateCompareRegExp_);\n  var tokens2 = str2.toLowerCase().match(goog.string.numerateCompareRegExp_);\n  var count = Math.min(tokens1.length, tokens2.length);\n  for (var i = 0;i < count;i++) {\n    var a = tokens1[i];\n    var b = tokens2[i];\n    if (a != b) {\n      var num1 = parseInt(a, 10);\n      if (!isNaN(num1)) {\n        var num2 = parseInt(b, 10);\n        if (!isNaN(num2) && num1 - num2) {\n          return num1 - num2;\n        }\n      }\n      return a < b ? -1 : 1;\n    }\n  }\n  if (tokens1.length != tokens2.length) {\n    return tokens1.length - tokens2.length;\n  }\n  return str1 < str2 ? -1 : 1;\n};\ngoog.string.urlEncode = function(str) {\n  return encodeURIComponent(String(str));\n};\ngoog.string.urlDecode = function(str) {\n  return decodeURIComponent(str.replace(/\\+/g, \" \"));\n};\ngoog.string.newLineToBr = function(str, opt_xml) {\n  return str.replace(/(\\r\\n|\\r|\\n)/g, opt_xml ? \"<br />\" : \"<br>\");\n};\ngoog.string.htmlEscape = function(str, opt_isLikelyToContainHtmlChars) {\n  if (opt_isLikelyToContainHtmlChars) {\n    return str.replace(goog.string.amperRe_, \"&amp;\").replace(goog.string.ltRe_, \"&lt;\").replace(goog.string.gtRe_, \"&gt;\").replace(goog.string.quotRe_, \"&quot;\").replace(goog.string.singleQuoteRe_, \"&#39;\");\n  } else {\n    if (!goog.string.allRe_.test(str)) {\n      return str;\n    }\n    if (str.indexOf(\"&\") != -1) {\n      str = str.replace(goog.string.amperRe_, \"&amp;\");\n    }\n    if (str.indexOf(\"<\") != -1) {\n      str = str.replace(goog.string.ltRe_, \"&lt;\");\n    }\n    if (str.indexOf(\">\") != -1) {\n      str = str.replace(goog.string.gtRe_, \"&gt;\");\n    }\n    if (str.indexOf('\"') != -1) {\n      str = str.replace(goog.string.quotRe_, \"&quot;\");\n    }\n    if (str.indexOf(\"'\") != -1) {\n      str = str.replace(goog.string.singleQuoteRe_, \"&#39;\");\n    }\n    return str;\n  }\n};\ngoog.string.amperRe_ = /&/g;\ngoog.string.ltRe_ = /</g;\ngoog.string.gtRe_ = />/g;\ngoog.string.quotRe_ = /\"/g;\ngoog.string.singleQuoteRe_ = /'/g;\ngoog.string.allRe_ = /[&<>\"']/;\ngoog.string.unescapeEntities = function(str) {\n  if (goog.string.contains(str, \"&\")) {\n    if (\"document\" in goog.global) {\n      return goog.string.unescapeEntitiesUsingDom_(str);\n    } else {\n      return goog.string.unescapePureXmlEntities_(str);\n    }\n  }\n  return str;\n};\ngoog.string.unescapeEntitiesWithDocument = function(str, document) {\n  if (goog.string.contains(str, \"&\")) {\n    return goog.string.unescapeEntitiesUsingDom_(str, document);\n  }\n  return str;\n};\ngoog.string.unescapeEntitiesUsingDom_ = function(str, opt_document) {\n  var seen = {\"&amp;\":\"&\", \"&lt;\":\"<\", \"&gt;\":\">\", \"&quot;\":'\"'};\n  var div;\n  if (opt_document) {\n    div = opt_document.createElement(\"div\");\n  } else {\n    div = document.createElement(\"div\");\n  }\n  return str.replace(goog.string.HTML_ENTITY_PATTERN_, function(s, entity) {\n    var value = seen[s];\n    if (value) {\n      return value;\n    }\n    if (entity.charAt(0) == \"#\") {\n      var n = Number(\"0\" + entity.substr(1));\n      if (!isNaN(n)) {\n        value = String.fromCharCode(n);\n      }\n    }\n    if (!value) {\n      div.innerHTML = s + \" \";\n      value = div.firstChild.nodeValue.slice(0, -1);\n    }\n    return seen[s] = value;\n  });\n};\ngoog.string.unescapePureXmlEntities_ = function(str) {\n  return str.replace(/&([^;]+);/g, function(s, entity) {\n    switch(entity) {\n      case \"amp\":\n        return \"&\";\n      case \"lt\":\n        return \"<\";\n      case \"gt\":\n        return \">\";\n      case \"quot\":\n        return'\"';\n      default:\n        if (entity.charAt(0) == \"#\") {\n          var n = Number(\"0\" + entity.substr(1));\n          if (!isNaN(n)) {\n            return String.fromCharCode(n);\n          }\n        }\n        return s;\n    }\n  });\n};\ngoog.string.HTML_ENTITY_PATTERN_ = /&([^;\\s<&]+);?/g;\ngoog.string.whitespaceEscape = function(str, opt_xml) {\n  return goog.string.newLineToBr(str.replace(/  /g, \" &#160;\"), opt_xml);\n};\ngoog.string.stripQuotes = function(str, quoteChars) {\n  var length = quoteChars.length;\n  for (var i = 0;i < length;i++) {\n    var quoteChar = length == 1 ? quoteChars : quoteChars.charAt(i);\n    if (str.charAt(0) == quoteChar && str.charAt(str.length - 1) == quoteChar) {\n      return str.substring(1, str.length - 1);\n    }\n  }\n  return str;\n};\ngoog.string.truncate = function(str, chars, opt_protectEscapedCharacters) {\n  if (opt_protectEscapedCharacters) {\n    str = goog.string.unescapeEntities(str);\n  }\n  if (str.length > chars) {\n    str = str.substring(0, chars - 3) + \"...\";\n  }\n  if (opt_protectEscapedCharacters) {\n    str = goog.string.htmlEscape(str);\n  }\n  return str;\n};\ngoog.string.truncateMiddle = function(str, chars, opt_protectEscapedCharacters, opt_trailingChars) {\n  if (opt_protectEscapedCharacters) {\n    str = goog.string.unescapeEntities(str);\n  }\n  if (opt_trailingChars && str.length > chars) {\n    if (opt_trailingChars > chars) {\n      opt_trailingChars = chars;\n    }\n    var endPoint = str.length - opt_trailingChars;\n    var startPoint = chars - opt_trailingChars;\n    str = str.substring(0, startPoint) + \"...\" + str.substring(endPoint);\n  } else {\n    if (str.length > chars) {\n      var half = Math.floor(chars / 2);\n      var endPos = str.length - half;\n      half += chars % 2;\n      str = str.substring(0, half) + \"...\" + str.substring(endPos);\n    }\n  }\n  if (opt_protectEscapedCharacters) {\n    str = goog.string.htmlEscape(str);\n  }\n  return str;\n};\ngoog.string.specialEscapeChars_ = {\"\\x00\":\"\\\\0\", \"\\b\":\"\\\\b\", \"\\f\":\"\\\\f\", \"\\n\":\"\\\\n\", \"\\r\":\"\\\\r\", \"\\t\":\"\\\\t\", \"\\x0B\":\"\\\\x0B\", '\"':'\\\\\"', \"\\\\\":\"\\\\\\\\\"};\ngoog.string.jsEscapeCache_ = {\"'\":\"\\\\'\"};\ngoog.string.quote = function(s) {\n  s = String(s);\n  if (s.quote) {\n    return s.quote();\n  } else {\n    var sb = ['\"'];\n    for (var i = 0;i < s.length;i++) {\n      var ch = s.charAt(i);\n      var cc = ch.charCodeAt(0);\n      sb[i + 1] = goog.string.specialEscapeChars_[ch] || (cc > 31 && cc < 127 ? ch : goog.string.escapeChar(ch));\n    }\n    sb.push('\"');\n    return sb.join(\"\");\n  }\n};\ngoog.string.escapeString = function(str) {\n  var sb = [];\n  for (var i = 0;i < str.length;i++) {\n    sb[i] = goog.string.escapeChar(str.charAt(i));\n  }\n  return sb.join(\"\");\n};\ngoog.string.escapeChar = function(c) {\n  if (c in goog.string.jsEscapeCache_) {\n    return goog.string.jsEscapeCache_[c];\n  }\n  if (c in goog.string.specialEscapeChars_) {\n    return goog.string.jsEscapeCache_[c] = goog.string.specialEscapeChars_[c];\n  }\n  var rv = c;\n  var cc = c.charCodeAt(0);\n  if (cc > 31 && cc < 127) {\n    rv = c;\n  } else {\n    if (cc < 256) {\n      rv = \"\\\\x\";\n      if (cc < 16 || cc > 256) {\n        rv += \"0\";\n      }\n    } else {\n      rv = \"\\\\u\";\n      if (cc < 4096) {\n        rv += \"0\";\n      }\n    }\n    rv += cc.toString(16).toUpperCase();\n  }\n  return goog.string.jsEscapeCache_[c] = rv;\n};\ngoog.string.toMap = function(s) {\n  var rv = {};\n  for (var i = 0;i < s.length;i++) {\n    rv[s.charAt(i)] = true;\n  }\n  return rv;\n};\ngoog.string.contains = function(s, ss) {\n  return s.indexOf(ss) != -1;\n};\ngoog.string.countOf = function(s, ss) {\n  return s && ss ? s.split(ss).length - 1 : 0;\n};\ngoog.string.removeAt = function(s, index, stringLength) {\n  var resultStr = s;\n  if (index >= 0 && (index < s.length && stringLength > 0)) {\n    resultStr = s.substr(0, index) + s.substr(index + stringLength, s.length - index - stringLength);\n  }\n  return resultStr;\n};\ngoog.string.remove = function(s, ss) {\n  var re = new RegExp(goog.string.regExpEscape(ss), \"\");\n  return s.replace(re, \"\");\n};\ngoog.string.removeAll = function(s, ss) {\n  var re = new RegExp(goog.string.regExpEscape(ss), \"g\");\n  return s.replace(re, \"\");\n};\ngoog.string.regExpEscape = function(s) {\n  return String(s).replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, \"\\\\$1\").replace(/\\x08/g, \"\\\\x08\");\n};\ngoog.string.repeat = function(string, length) {\n  return(new Array(length + 1)).join(string);\n};\ngoog.string.padNumber = function(num, length, opt_precision) {\n  var s = goog.isDef(opt_precision) ? num.toFixed(opt_precision) : String(num);\n  var index = s.indexOf(\".\");\n  if (index == -1) {\n    index = s.length;\n  }\n  return goog.string.repeat(\"0\", Math.max(0, length - index)) + s;\n};\ngoog.string.makeSafe = function(obj) {\n  return obj == null ? \"\" : String(obj);\n};\ngoog.string.buildString = function(var_args) {\n  return Array.prototype.join.call(arguments, \"\");\n};\ngoog.string.getRandomString = function() {\n  var x = 2147483648;\n  return Math.floor(Math.random() * x).toString(36) + Math.abs(Math.floor(Math.random() * x) ^ goog.now()).toString(36);\n};\ngoog.string.compareVersions = function(version1, version2) {\n  var order = 0;\n  var v1Subs = goog.string.trim(String(version1)).split(\".\");\n  var v2Subs = goog.string.trim(String(version2)).split(\".\");\n  var subCount = Math.max(v1Subs.length, v2Subs.length);\n  for (var subIdx = 0;order == 0 && subIdx < subCount;subIdx++) {\n    var v1Sub = v1Subs[subIdx] || \"\";\n    var v2Sub = v2Subs[subIdx] || \"\";\n    var v1CompParser = new RegExp(\"(\\\\d*)(\\\\D*)\", \"g\");\n    var v2CompParser = new RegExp(\"(\\\\d*)(\\\\D*)\", \"g\");\n    do {\n      var v1Comp = v1CompParser.exec(v1Sub) || [\"\", \"\", \"\"];\n      var v2Comp = v2CompParser.exec(v2Sub) || [\"\", \"\", \"\"];\n      if (v1Comp[0].length == 0 && v2Comp[0].length == 0) {\n        break;\n      }\n      var v1CompNum = v1Comp[1].length == 0 ? 0 : parseInt(v1Comp[1], 10);\n      var v2CompNum = v2Comp[1].length == 0 ? 0 : parseInt(v2Comp[1], 10);\n      order = goog.string.compareElements_(v1CompNum, v2CompNum) || (goog.string.compareElements_(v1Comp[2].length == 0, v2Comp[2].length == 0) || goog.string.compareElements_(v1Comp[2], v2Comp[2]));\n    } while (order == 0);\n  }\n  return order;\n};\ngoog.string.compareElements_ = function(left, right) {\n  if (left < right) {\n    return-1;\n  } else {\n    if (left > right) {\n      return 1;\n    }\n  }\n  return 0;\n};\ngoog.string.HASHCODE_MAX_ = 4294967296;\ngoog.string.hashCode = function(str) {\n  var result = 0;\n  for (var i = 0;i < str.length;++i) {\n    result = 31 * result + str.charCodeAt(i);\n    result %= goog.string.HASHCODE_MAX_;\n  }\n  return result;\n};\ngoog.string.uniqueStringCounter_ = Math.random() * 2147483648 | 0;\ngoog.string.createUniqueString = function() {\n  return \"goog_\" + goog.string.uniqueStringCounter_++;\n};\ngoog.string.toNumber = function(str) {\n  var num = Number(str);\n  if (num == 0 && goog.string.isEmpty(str)) {\n    return NaN;\n  }\n  return num;\n};\ngoog.string.isLowerCamelCase = function(str) {\n  return/^[a-z]+([A-Z][a-z]*)*$/.test(str);\n};\ngoog.string.isUpperCamelCase = function(str) {\n  return/^([A-Z][a-z]*)+$/.test(str);\n};\ngoog.string.toCamelCase = function(str) {\n  return String(str).replace(/\\-([a-z])/g, function(all, match) {\n    return match.toUpperCase();\n  });\n};\ngoog.string.toSelectorCase = function(str) {\n  return String(str).replace(/([A-Z])/g, \"-$1\").toLowerCase();\n};\ngoog.string.toTitleCase = function(str, opt_delimiters) {\n  var delimiters = goog.isString(opt_delimiters) ? goog.string.regExpEscape(opt_delimiters) : \"\\\\s\";\n  delimiters = delimiters ? \"|[\" + delimiters + \"]+\" : \"\";\n  var regexp = new RegExp(\"(^\" + delimiters + \")([a-z])\", \"g\");\n  return str.replace(regexp, function(all, p1, p2) {\n    return p1 + p2.toUpperCase();\n  });\n};\ngoog.string.parseInt = function(value) {\n  if (isFinite(value)) {\n    value = String(value);\n  }\n  if (goog.isString(value)) {\n    return/^\\s*-?0x/i.test(value) ? parseInt(value, 16) : parseInt(value, 10);\n  }\n  return NaN;\n};\ngoog.string.splitLimit = function(str, separator, limit) {\n  var parts = str.split(separator);\n  var returnVal = [];\n  while (limit > 0 && parts.length) {\n    returnVal.push(parts.shift());\n    limit--;\n  }\n  if (parts.length) {\n    returnVal.push(parts.join(separator));\n  }\n  return returnVal;\n};\ngoog.provide(\"fb.simplelogin.SessionStore\");\ngoog.provide(\"fb.simplelogin.SessionStore_\");\ngoog.require(\"fb.simplelogin.util.env\");\nvar sessionPersistentStorageKey = \"firebaseSession\";\nvar hasLocalStorage = fb.simplelogin.util.env.hasLocalStorage();\nfb.simplelogin.SessionStore_ = function() {\n};\nfb.simplelogin.SessionStore_.prototype.set = function(session, opt_sessionLengthDays) {\n  if (!hasLocalStorage) {\n    return;\n  }\n  try {\n    localStorage.setItem(sessionPersistentStorageKey, fb.simplelogin.util.json.stringify(session));\n  } catch (e) {\n  }\n};\nfb.simplelogin.SessionStore_.prototype.get = function() {\n  if (!hasLocalStorage) {\n    return;\n  }\n  try {\n    var payload = localStorage.getItem(sessionPersistentStorageKey);\n    if (payload) {\n      var session = fb.simplelogin.util.json.parse(payload);\n      return session;\n    }\n  } catch (e) {\n  }\n  return null;\n};\nfb.simplelogin.SessionStore_.prototype.clear = function() {\n  if (!hasLocalStorage) {\n    return;\n  }\n  localStorage.removeItem(sessionPersistentStorageKey);\n};\nfb.simplelogin.SessionStore = new fb.simplelogin.SessionStore_;\ngoog.provide(\"fb.simplelogin.client\");\ngoog.require(\"fb.simplelogin.util.env\");\ngoog.require(\"fb.simplelogin.util.json\");\ngoog.require(\"fb.simplelogin.util.RSVP\");\ngoog.require(\"fb.simplelogin.util.validation\");\ngoog.require(\"fb.simplelogin.Vars\");\ngoog.require(\"fb.simplelogin.Errors\");\ngoog.require(\"fb.simplelogin.SessionStore\");\ngoog.require(\"fb.simplelogin.providers.Password\");\ngoog.require(\"fb.simplelogin.transports.JSONP\");\ngoog.require(\"fb.simplelogin.transports.CordovaInAppBrowser\");\ngoog.require(\"fb.simplelogin.transports.TriggerIoTab\");\ngoog.require(\"fb.simplelogin.transports.WinChan\");\ngoog.require(\"fb.simplelogin.transports.WindowsMetroAuthBroker\");\ngoog.require(\"goog.string\");\nvar CLIENT_VERSION = \"1.6.3\";\nfb.simplelogin.client = function(ref, callback, context, apiHost) {\n  var self = this;\n  this.mRef = ref;\n  this.mNamespace = fb.simplelogin.util.misc.parseSubdomain(ref.toString());\n  this.sessionLengthDays = null;\n  var globalNamespace = \"_FirebaseSimpleLogin\";\n  window[globalNamespace] = window[globalNamespace] || {};\n  window[globalNamespace][\"callbacks\"] = window[globalNamespace][\"callbacks\"] || [];\n  window[globalNamespace][\"callbacks\"].push({\"cb\":callback, \"ctx\":context});\n  var warnTestingLocally = window.location.protocol === \"file:\" && (!fb.simplelogin.util.env.isPhantomJS() && !fb.simplelogin.util.env.isMobileCordovaInAppBrowser());\n  if (warnTestingLocally) {\n    var message = \"FirebaseSimpleLogin(): Due to browser security restrictions, \" + \"loading applications via `file://*` URLs will prevent popup-based authentication \" + \"providers from working properly. When testing locally, you'll need to run a \" + \"barebones webserver on your machine rather than loading your test files via \" + \"`file://*`. The easiest way to run a barebones server on your local machine is to \" + \"`cd` to the root directory of your code and run `python -m SimpleHTTPServer`, \" + \n    \"which will allow you to access your content via `http://127.0.0.1:8000/*`.\";\n    fb.simplelogin.util.misc.warn(message);\n  }\n  if (apiHost) {\n    fb.simplelogin.Vars.setApiHost(apiHost);\n  }\n  function asyncInvokeCallback(func, error, user) {\n    setTimeout(function() {\n      func(error, user);\n    }, 0);\n  }\n  this.mLoginStateChange = function(error, user) {\n    var callbacks = window[globalNamespace][\"callbacks\"] || [];\n    var args = Array.prototype.slice.apply(arguments);\n    for (var ix = 0;ix < callbacks.length;ix++) {\n      var cb = callbacks[ix];\n      var invokeCallback = !!error || typeof cb.user === \"undefined\";\n      if (!invokeCallback) {\n        var oldAuthToken, newAuthToken;\n        if (cb.user && cb.user.firebaseAuthToken) {\n          oldAuthToken = cb.user.firebaseAuthToken;\n        }\n        if (user && user.firebaseAuthToken) {\n          newAuthToken = user.firebaseAuthToken;\n        }\n        invokeCallback = (oldAuthToken || newAuthToken) && oldAuthToken !== newAuthToken;\n      }\n      window[globalNamespace][\"callbacks\"][ix][\"user\"] = user || null;\n      if (invokeCallback) {\n        asyncInvokeCallback(goog.bind(cb.cb, cb.ctx), error, user);\n      }\n    }\n  };\n  this.resumeSession();\n};\nfb.simplelogin.client.prototype.setApiHost = function(apiHost) {\n  fb.simplelogin.Vars.setApiHost(apiHost);\n};\nfb.simplelogin.client.prototype.resumeSession = function() {\n  var self = this;\n  var session, requestId, error;\n  try {\n    requestId = sessionStorage.getItem(\"firebaseRequestId\");\n    sessionStorage.removeItem(\"firebaseRequestId\");\n  } catch (e) {\n  }\n  if (requestId) {\n    var transport = fb.simplelogin.transports.JSONP;\n    if (fb.simplelogin.transports.XHR.isAvailable()) {\n      transport = fb.simplelogin.transports.XHR;\n    }\n    transport.open(fb.simplelogin.Vars.getApiHost() + \"/auth/session\", {\"requestId\":requestId, \"firebase\":self.mNamespace}, function(error, response) {\n      if (response && (response.token && response.user)) {\n        self.attemptAuth(response.token, response.user, true);\n      } else {\n        if (error) {\n          fb.simplelogin.SessionStore.clear();\n          self.mLoginStateChange(error);\n        } else {\n          fb.simplelogin.SessionStore.clear();\n          self.mLoginStateChange(null, null);\n        }\n      }\n    });\n  } else {\n    session = fb.simplelogin.SessionStore.get();\n    if (session && (session.token && session.user)) {\n      self.attemptAuth(session.token, session.user, false);\n    } else {\n      self.mLoginStateChange(null, null);\n    }\n  }\n};\nfb.simplelogin.client.prototype.attemptAuth = function(token, user, saveSession, resolveCb, rejectCb) {\n  var self = this;\n  this.mRef[\"auth\"](token, function(error, dummy) {\n    if (!error) {\n      if (saveSession) {\n        fb.simplelogin.SessionStore.set({token:token, user:user, sessionKey:user[\"sessionKey\"]}, self.sessionLengthDays);\n      }\n      if (typeof dummy == \"function\") {\n        dummy();\n      }\n      delete user[\"sessionKey\"];\n      user[\"firebaseAuthToken\"] = token;\n      self.mLoginStateChange(null, user);\n      if (resolveCb) {\n        resolveCb(user);\n      }\n    } else {\n      fb.simplelogin.SessionStore.clear();\n      self.mLoginStateChange(null, null);\n      if (rejectCb) {\n        rejectCb();\n      }\n    }\n  }, function(error) {\n    fb.simplelogin.SessionStore.clear();\n    self.mLoginStateChange(null, null);\n    if (rejectCb) {\n      rejectCb();\n    }\n  });\n};\nfb.simplelogin.client.prototype.login = function() {\n  var methodId = \"FirebaseSimpleLogin.login()\";\n  fb.simplelogin.util.validation.validateString(methodId, 1, arguments[0], false);\n  fb.simplelogin.util.validation.validateArgCount(methodId, 1, 2, arguments.length);\n  var provider = arguments[0].toLowerCase(), options = arguments[1] || {};\n  this.sessionLengthDays = options.rememberMe ? 30 : null;\n  switch(provider) {\n    case \"anonymous\":\n      return this.loginAnonymously(options);\n    case \"facebook-token\":\n      return this.loginWithFacebookToken(options);\n    case \"github\":\n      return this.loginWithGithub(options);\n    case \"google-token\":\n      return this.loginWithGoogleToken(options);\n    case \"password\":\n      return this.loginWithPassword(options);\n    case \"twitter-token\":\n      return this.loginWithTwitterToken(options);\n    case \"facebook\":\n      if (options[\"access_token\"]) {\n        return this.loginWithFacebookToken(options);\n      }\n      return this.loginWithFacebook(options);\n    case \"google\":\n      if (options[\"access_token\"]) {\n        return this.loginWithGoogleToken(options);\n      }\n      return this.loginWithGoogle(options);\n    case \"twitter\":\n      if (options[\"oauth_token\"] && options[\"oauth_token_secret\"]) {\n        return this.loginWithTwitterToken(options);\n      }\n      return this.loginWithTwitter(options);\n    default:\n      throw new Error(\"FirebaseSimpleLogin.login(\" + provider + \") failed: unrecognized authentication provider\");;\n  }\n};\nfb.simplelogin.client.prototype.loginAnonymously = function(options) {\n  var self = this, provider = \"anonymous\";\n  var promise = new fb.simplelogin.util.RSVP.Promise(function(resolve, reject) {\n    options.firebase = self.mNamespace;\n    options.v = CLIENT_VERSION;\n    fb.simplelogin.transports.JSONP.open(fb.simplelogin.Vars.getApiHost() + \"/auth/anonymous\", options, function(error, response) {\n      if (error || !response[\"token\"]) {\n        var errorObj = fb.simplelogin.Errors.format(error);\n        self.mLoginStateChange(errorObj, null);\n        reject(errorObj);\n      } else {\n        var token = response[\"token\"];\n        var user = response[\"user\"];\n        self.attemptAuth(token, user, true, resolve, reject);\n      }\n    });\n  });\n  return promise;\n};\nfb.simplelogin.client.prototype.loginWithPassword = function(options) {\n  var self = this;\n  var promise = new fb.simplelogin.util.RSVP.Promise(function(resolve, reject) {\n    options.firebase = self.mNamespace;\n    options.v = CLIENT_VERSION;\n    fb.simplelogin.providers.Password.login(options, function(error, response) {\n      if (error || !response[\"token\"]) {\n        var errorObj = fb.simplelogin.Errors.format(error);\n        self.mLoginStateChange(errorObj, null);\n        reject(errorObj);\n      } else {\n        var token = response[\"token\"];\n        var user = response[\"user\"];\n        self.attemptAuth(token, user, true, resolve, reject);\n      }\n    });\n  });\n  return promise;\n};\nfb.simplelogin.client.prototype.loginWithGithub = function(options) {\n  options[\"height\"] = 850;\n  options[\"width\"] = 950;\n  return this.loginViaOAuth(\"github\", options);\n};\nfb.simplelogin.client.prototype.loginWithGoogle = function(options) {\n  options[\"height\"] = 650;\n  options[\"width\"] = 575;\n  return this.loginViaOAuth(\"google\", options);\n};\nfb.simplelogin.client.prototype.loginWithFacebook = function(options) {\n  options[\"height\"] = 400;\n  options[\"width\"] = 535;\n  return this.loginViaOAuth(\"facebook\", options);\n};\nfb.simplelogin.client.prototype.loginWithTwitter = function(options) {\n  return this.loginViaOAuth(\"twitter\", options);\n};\nfb.simplelogin.client.prototype.loginWithFacebookToken = function(options) {\n  return this.loginViaToken(\"facebook\", options);\n};\nfb.simplelogin.client.prototype.loginWithGoogleToken = function(options) {\n  return this.loginViaToken(\"google\", options);\n};\nfb.simplelogin.client.prototype.loginWithTwitterToken = function(options) {\n  return this.loginViaToken(\"twitter\", options);\n};\nfb.simplelogin.client.prototype.logout = function() {\n  fb.simplelogin.SessionStore.clear();\n  this.mRef[\"unauth\"]();\n  this.mLoginStateChange(null, null);\n};\nfb.simplelogin.client.prototype.loginViaToken = function(provider, options, cb) {\n  options = options || {};\n  options.v = CLIENT_VERSION;\n  var self = this, url = fb.simplelogin.Vars.getApiHost() + \"/auth/\" + provider + \"/token?firebase=\" + self.mNamespace;\n  var promise = new fb.simplelogin.util.RSVP.Promise(function(resolve, reject) {\n    fb.simplelogin.transports.JSONP.open(url, options, function(error, res) {\n      if (error || (!res[\"token\"] || !res[\"user\"])) {\n        var errorObj = fb.simplelogin.Errors.format(error);\n        self.mLoginStateChange(errorObj);\n        reject(errorObj);\n      } else {\n        var token = res[\"token\"];\n        var user = res[\"user\"];\n        self.attemptAuth(token, user, true, resolve, reject);\n      }\n    });\n  });\n  return promise;\n};\nfb.simplelogin.client.prototype.loginViaOAuth = function(provider, options, cb) {\n  options = options || {};\n  var self = this;\n  var url = fb.simplelogin.Vars.getApiHost() + \"/auth/\" + provider + \"?firebase=\" + self.mNamespace;\n  if (options[\"scope\"]) {\n    url += \"&scope=\" + options[\"scope\"];\n  }\n  url += \"&v=\" + encodeURIComponent(CLIENT_VERSION);\n  var window_features = {\"menubar\":0, \"location\":0, \"resizable\":0, \"scrollbars\":1, \"status\":0, \"dialog\":1, \"width\":700, \"height\":375};\n  if (options[\"height\"]) {\n    window_features[\"height\"] = options[\"height\"];\n    delete options[\"height\"];\n  }\n  if (options[\"width\"]) {\n    window_features[\"width\"] = options[\"width\"];\n    delete options[\"width\"];\n  }\n  var environment = function() {\n    if (fb.simplelogin.util.env.isMobileCordovaInAppBrowser()) {\n      return \"mobile-phonegap\";\n    } else {\n      if (fb.simplelogin.util.env.isMobileTriggerIoTab()) {\n        return \"mobile-triggerio\";\n      } else {\n        if (fb.simplelogin.util.env.isWindowsMetro()) {\n          return \"windows-metro\";\n        } else {\n          return \"desktop\";\n        }\n      }\n    }\n  }();\n  var transport;\n  if (environment === \"desktop\") {\n    transport = fb.simplelogin.transports.WinChan;\n    var window_features_arr = [];\n    for (var key in window_features) {\n      window_features_arr.push(key + \"=\" + window_features[key]);\n    }\n    options.url += \"&transport=winchan\";\n    options.relay_url = fb.simplelogin.Vars.getApiHost() + \"/auth/channel\";\n    options.window_features = window_features_arr.join(\",\");\n  } else {\n    if (environment === \"mobile-phonegap\") {\n      transport = fb.simplelogin.transports.CordovaInAppBrowser;\n    } else {\n      if (environment === \"mobile-triggerio\") {\n        transport = fb.simplelogin.transports.TriggerIoTab;\n      } else {\n        if (environment === \"windows-metro\") {\n          transport = fb.simplelogin.transports.WindowsMetroAuthBroker;\n        }\n      }\n    }\n  }\n  if (options.preferRedirect || (fb.simplelogin.util.env.isChromeiOS() || (fb.simplelogin.util.env.isWindowsPhone() || (fb.simplelogin.util.env.isStandaloneiOS() || (fb.simplelogin.util.env.isTwitteriOS() || fb.simplelogin.util.env.isFacebookiOS()))))) {\n    var requestId = goog.string.getRandomString() + goog.string.getRandomString();\n    try {\n      sessionStorage.setItem(\"firebaseRequestId\", requestId);\n    } catch (e) {\n    }\n    url += \"&requestId=\" + requestId + \"&fb_redirect_uri=\" + encodeURIComponent(window.location.href);\n    window.location = url;\n    return;\n  }\n  var promise = new fb.simplelogin.util.RSVP.Promise(function(resolve, reject) {\n    transport.open(url, options, function(error, res) {\n      if (res && (res.token && res.user)) {\n        self.attemptAuth(res.token, res.user, true, resolve, reject);\n      } else {\n        var errorObj = error || {code:\"UNKNOWN_ERROR\", message:\"An unknown error occurred.\"};\n        if (error === \"unknown closed window\") {\n          errorObj = {code:\"USER_DENIED\", message:\"User cancelled the authentication request.\"};\n        } else {\n          if (res && res.error) {\n            errorObj = res.error;\n          }\n        }\n        errorObj = fb.simplelogin.Errors.format(errorObj);\n        self.mLoginStateChange(errorObj);\n        reject(errorObj);\n      }\n    });\n  });\n  return promise;\n};\nfb.simplelogin.client.prototype.manageFirebaseUsers = function(method, data, cb) {\n  data[\"firebase\"] = this.mNamespace;\n  var promise = new fb.simplelogin.util.RSVP.Promise(function(resolve, reject) {\n    fb.simplelogin.providers.Password[method](data, function(error, result) {\n      if (error) {\n        var errorObj = fb.simplelogin.Errors.format(error);\n        reject(errorObj);\n        return cb && cb(errorObj, null);\n      } else {\n        resolve(result);\n        return cb && cb(null, result);\n      }\n    });\n  });\n  return promise;\n};\nfb.simplelogin.client.prototype.createUser = function(email, password, cb) {\n  return this.manageFirebaseUsers(\"createUser\", {\"email\":email, \"password\":password}, cb);\n};\nfb.simplelogin.client.prototype.changePassword = function(email, oldPassword, newPassword, cb) {\n  return this.manageFirebaseUsers(\"changePassword\", {\"email\":email, \"oldPassword\":oldPassword, \"newPassword\":newPassword}, function(error) {\n    return cb && cb(error);\n  });\n};\nfb.simplelogin.client.prototype.removeUser = function(email, password, cb) {\n  return this.manageFirebaseUsers(\"removeUser\", {\"email\":email, \"password\":password}, function(error) {\n    return cb && cb(error);\n  });\n};\nfb.simplelogin.client.prototype.sendPasswordResetEmail = function(email, cb) {\n  return this.manageFirebaseUsers(\"sendPasswordResetEmail\", {\"email\":email}, function(error) {\n    return cb && cb(error);\n  });\n};\nfb.simplelogin.client.onOpen = function(cb) {\n  fb.simplelogin.transports.WinChan.onOpen(cb);\n};\nfb.simplelogin.client.VERSION = function() {\n  return CLIENT_VERSION;\n};\ngoog.provide(\"FirebaseSimpleLogin\");\ngoog.require(\"fb.simplelogin.client\");\ngoog.require(\"fb.simplelogin.util.validation\");\nFirebaseSimpleLogin = function(ref, cb, context, apiHost) {\n  var method = \"new FirebaseSimpleLogin\";\n  fb.simplelogin.util.validation.validateArgCount(method, 1, 4, arguments.length);\n  fb.simplelogin.util.validation.validateCallback(method, 2, cb, false);\n  if (goog.isString(ref)) {\n    throw new Error(\"new FirebaseSimpleLogin(): Oops, it looks like you passed a string \" + \"instead of a Firebase reference (i.e. new Firebase(<firebaseURL>)).\");\n  }\n  var firebase = fb.simplelogin.util.misc.parseSubdomain(ref.toString());\n  if (!goog.isString(firebase)) {\n    throw new Error(\"new FirebaseSimpleLogin(): First argument must be a valid Firebase \" + \"reference (i.e. new Firebase(<firebaseURL>)).\");\n  }\n  var client_ = new fb.simplelogin.client(ref, cb, context, apiHost);\n  return{\"setApiHost\":function(apiHost) {\n    var method = \"FirebaseSimpleLogin.setApiHost\";\n    fb.simplelogin.util.validation.validateArgCount(method, 1, 1, arguments.length);\n    return client_.setApiHost(apiHost);\n  }, \"login\":function() {\n    return client_.login.apply(client_, arguments);\n  }, \"logout\":function() {\n    var methodId = \"FirebaseSimpleLogin.logout\";\n    fb.simplelogin.util.validation.validateArgCount(methodId, 0, 0, arguments.length);\n    return client_.logout();\n  }, \"createUser\":function(email, password, cb) {\n    var method = \"FirebaseSimpleLogin.createUser\";\n    fb.simplelogin.util.validation.validateArgCount(method, 2, 3, arguments.length);\n    fb.simplelogin.util.validation.validateCallback(method, 3, cb, true);\n    return client_.createUser(email, password, cb);\n  }, \"changePassword\":function(email, oldPassword, newPassword, cb) {\n    var method = \"FirebaseSimpleLogin.changePassword\";\n    fb.simplelogin.util.validation.validateArgCount(method, 3, 4, arguments.length);\n    fb.simplelogin.util.validation.validateCallback(method, 4, cb, true);\n    return client_.changePassword(email, oldPassword, newPassword, cb);\n  }, \"removeUser\":function(email, password, cb) {\n    var method = \"FirebaseSimpleLogin.removeUser\";\n    fb.simplelogin.util.validation.validateArgCount(method, 2, 3, arguments.length);\n    fb.simplelogin.util.validation.validateCallback(method, 3, cb, true);\n    return client_.removeUser(email, password, cb);\n  }, \"sendPasswordResetEmail\":function(email, cb) {\n    var method = \"FirebaseSimpleLogin.sendPasswordResetEmail\";\n    fb.simplelogin.util.validation.validateArgCount(method, 1, 2, arguments.length);\n    fb.simplelogin.util.validation.validateCallback(method, 2, cb, true);\n    return client_.sendPasswordResetEmail(email, cb);\n  }};\n};\nFirebaseSimpleLogin.onOpen = function(cb) {\n  fb.simplelogin.client.onOpen(cb);\n};\nFirebaseSimpleLogin.VERSION = fb.simplelogin.client.VERSION();\n\n"
  },
  {
    "path": "www/lib/firebase-simple-login/firebase-simple-login.js",
    "content": "(function() {var COMPILED=!0,goog=goog||{};goog.global=this;goog.exportPath_=function(a,d,e){a=a.split(\".\");e=e||goog.global;a[0]in e||!e.execScript||e.execScript(\"var \"+a[0]);for(var f;a.length&&(f=a.shift());)a.length||void 0===d?e=e[f]?e[f]:e[f]={}:e[f]=d};goog.define=function(a,d){var e=d;COMPILED||goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,a)&&(e=goog.global.CLOSURE_DEFINES[a]);goog.exportPath_(a,e)};goog.DEBUG=!0;goog.LOCALE=\"en\";goog.TRUSTED_SITE=!0;\ngoog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace \"'+a+'\" already declared.');delete goog.implicitNamespaces_[a];for(var d=a;(d=d.substring(0,d.lastIndexOf(\".\")))&&!goog.getObjectByName(d);)goog.implicitNamespaces_[d]=!0}goog.exportPath_(a)};goog.setTestOnly=function(a){if(COMPILED&&!goog.DEBUG)throw a=a||\"\",Error(\"Importing test-only code into non-debug environment\"+a?\": \"+a:\".\");};goog.forwardDeclare=function(a){};\nCOMPILED||(goog.isProvided_=function(a){return!goog.implicitNamespaces_[a]&&goog.isDefAndNotNull(goog.getObjectByName(a))},goog.implicitNamespaces_={});goog.getObjectByName=function(a,d){for(var e=a.split(\".\"),f=d||goog.global,g;g=e.shift();)if(goog.isDefAndNotNull(f[g]))f=f[g];else return null;return f};goog.globalize=function(a,d){var e=d||goog.global,f;for(f in a)e[f]=a[f]};\ngoog.addDependency=function(a,d,e){if(goog.DEPENDENCIES_ENABLED){var f;a=a.replace(/\\\\/g,\"/\");for(var g=goog.dependencies_,h=0;f=d[h];h++)g.nameToPath[f]=a,a in g.pathToNames||(g.pathToNames[a]={}),g.pathToNames[a][f]=!0;for(f=0;d=e[f];f++)a in g.requires||(g.requires[a]={}),g.requires[a][d]=!0}};goog.ENABLE_DEBUG_LOADER=!0;\ngoog.require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LOADER){var d=goog.getPathFromDeps_(a);if(d){goog.included_[d]=!0;goog.writeScripts_();return}}a=\"goog.require could not find: \"+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}};goog.basePath=\"\";goog.nullFunction=function(){};goog.identityFunction=function(a,d){return a};goog.abstractMethod=function(){throw Error(\"unimplemented abstract method\");};\ngoog.addSingletonGetter=function(a){a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER;\ngoog.DEPENDENCIES_ENABLED&&(goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return\"undefined\"!=typeof a&&\"write\"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName(\"script\"),d=a.length-1;0<=d;--d){var e=a[d].src,f=e.lastIndexOf(\"?\"),f=-1==f?e.length:\nf;if(\"base.js\"==e.substr(f-7,7)){goog.basePath=e.substr(0,f-7);break}}},goog.importScript_=function(a){var d=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[a]&&d(a)&&(goog.dependencies_.written[a]=!0)},goog.writeScriptTag_=function(a){if(goog.inHtmlDocument_()){var d=goog.global.document;if(\"complete\"==d.readyState){if(/\\bdeps.js$/.test(a))return!1;throw Error('Cannot write \"'+a+'\" after document load');}d.write('<script type=\"text/javascript\" src=\"'+a+'\">\\x3c/script>');\nreturn!0}return!1},goog.writeScripts_=function(){function a(g){if(!(g in f.written)){if(!(g in f.visited)&&(f.visited[g]=!0,g in f.requires))for(var k in f.requires[g])if(!goog.isProvided_(k))if(k in f.nameToPath)a(f.nameToPath[k]);else throw Error(\"Undefined nameToPath for \"+k);g in e||(e[g]=!0,d.push(g))}}var d=[],e={},f=goog.dependencies_,g;for(g in goog.included_)f.written[g]||a(g);for(g=0;g<d.length;g++)if(d[g])goog.importScript_(goog.basePath+d[g]);else throw Error(\"Undefined script input\");\n},goog.getPathFromDeps_=function(a){return a in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[a]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+\"deps.js\"));\ngoog.typeOf=function(a){var d=typeof a;if(\"object\"==d)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return d;var e=Object.prototype.toString.call(a);if(\"[object Window]\"==e)return\"object\";if(\"[object Array]\"==e||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==e||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";\nelse if(\"function\"==d&&\"undefined\"==typeof a.call)return\"object\";return d};goog.isDef=function(a){return void 0!==a};goog.isNull=function(a){return null===a};goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return\"array\"==goog.typeOf(a)};goog.isArrayLike=function(a){var d=goog.typeOf(a);return\"array\"==d||\"object\"==d&&\"number\"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&\"function\"==typeof a.getFullYear};goog.isString=function(a){return\"string\"==typeof a};\ngoog.isBoolean=function(a){return\"boolean\"==typeof a};goog.isNumber=function(a){return\"number\"==typeof a};goog.isFunction=function(a){return\"function\"==goog.typeOf(a)};goog.isObject=function(a){var d=typeof a;return\"object\"==d&&null!=a||\"function\"==d};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.hasUid=function(a){return!!a[goog.UID_PROPERTY_]};goog.removeUid=function(a){\"removeAttribute\"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(d){}};\ngoog.UID_PROPERTY_=\"closure_uid_\"+(1E9*Math.random()>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var d=goog.typeOf(a);if(\"object\"==d||\"array\"==d){if(a.clone)return a.clone();var d=\"array\"==d?[]:{},e;for(e in a)d[e]=goog.cloneObject(a[e]);return d}return a};goog.bindNative_=function(a,d,e){return a.call.apply(a.bind,arguments)};\ngoog.bindJs_=function(a,d,e){if(!a)throw Error();if(2<arguments.length){var f=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(e,f);return a.apply(d,e)}}return function(){return a.apply(d,arguments)}};goog.bind=function(a,d,e){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf(\"native code\")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_;return goog.bind.apply(null,arguments)};\ngoog.partial=function(a,d){var e=Array.prototype.slice.call(arguments,1);return function(){var d=e.slice();d.push.apply(d,arguments);return a.apply(this,d)}};goog.mixin=function(a,d){for(var e in d)a[e]=d[e]};goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date};\ngoog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,\"JavaScript\");else if(goog.global.eval)if(null==goog.evalWorksForGlobals_&&(goog.global.eval(\"var _et_ = 1;\"),\"undefined\"!=typeof goog.global._et_?(delete goog.global._et_,goog.evalWorksForGlobals_=!0):goog.evalWorksForGlobals_=!1),goog.evalWorksForGlobals_)goog.global.eval(a);else{var d=goog.global.document,e=d.createElement(\"script\");e.type=\"text/javascript\";e.defer=!1;e.appendChild(d.createTextNode(a));d.body.appendChild(e);\nd.body.removeChild(e)}else throw Error(\"goog.globalEval not available\");};goog.evalWorksForGlobals_=null;goog.getCssName=function(a,d){var e=function(a){return goog.cssNameMapping_[a]||a},f=function(a){a=a.split(\"-\");for(var d=[],f=0;f<a.length;f++)d.push(e(a[f]));return d.join(\"-\")},f=goog.cssNameMapping_?\"BY_WHOLE\"==goog.cssNameMappingStyle_?e:f:function(a){return a};return d?a+\"-\"+f(d):f(a)};goog.setCssNameMapping=function(a,d){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=d};\n!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING);goog.getMsg=function(a,d){var e=d||{},f;for(f in e){var g=(\"\"+e[f]).replace(/\\$/g,\"$$$$\");a=a.replace(RegExp(\"\\\\{\\\\$\"+f+\"\\\\}\",\"gi\"),g)}return a};goog.getMsgWithFallback=function(a,d){return a};goog.exportSymbol=function(a,d,e){goog.exportPath_(a,d,e)};goog.exportProperty=function(a,d,e){a[d]=e};\ngoog.inherits=function(a,d){function e(){}e.prototype=d.prototype;a.superClass_=d.prototype;a.prototype=new e;a.prototype.constructor=a;a.base=function(a,e,h){var k=Array.prototype.slice.call(arguments,2);return d.prototype[e].apply(a,k)}};\ngoog.base=function(a,d,e){var f=arguments.callee.caller;if(goog.DEBUG&&!f)throw Error(\"arguments.caller not defined.  goog.base() expects not to be running in strict mode. See http://www.ecma-international.org/ecma-262/5.1/#sec-C\");if(f.superClass_)return f.superClass_.constructor.apply(a,Array.prototype.slice.call(arguments,1));for(var g=Array.prototype.slice.call(arguments,2),h=!1,k=a.constructor;k;k=k.superClass_&&k.superClass_.constructor)if(k.prototype[d]===f)h=!0;else if(h)return k.prototype[d].apply(a,\ng);if(a[d]===f)return a.constructor.prototype[d].apply(a,g);throw Error(\"goog.base called from a method of one name to a method of a different name\");};goog.scope=function(a){a.call(goog.global)};var fb={simplelogin:{}};fb.simplelogin.Vars_=function(){this.apiHost=\"https://auth.firebase.com\"};fb.simplelogin.Vars_.prototype.setApiHost=function(a){this.apiHost=a};fb.simplelogin.Vars_.prototype.getApiHost=function(){return this.apiHost};fb.simplelogin.Vars=new fb.simplelogin.Vars_;goog.json={};goog.json.USE_NATIVE_JSON=!1;goog.json.isValid_=function(a){return/^\\s*$/.test(a)?!1:/^[\\],:{}\\s\\u2028\\u2029]*$/.test(a.replace(/\\\\[\"\\\\\\/bfnrtu]/g,\"@\").replace(/\"[^\"\\\\\\n\\r\\u2028\\u2029\\x00-\\x08\\x0a-\\x1f]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,\"]\").replace(/(?:^|:|,)(?:[\\s\\u2028\\u2029]*\\[)+/g,\"\"))};\ngoog.json.parse=goog.json.USE_NATIVE_JSON?goog.global.JSON.parse:function(a){a=String(a);if(goog.json.isValid_(a))try{return eval(\"(\"+a+\")\")}catch(d){}throw Error(\"Invalid JSON string: \"+a);};goog.json.unsafeParse=goog.json.USE_NATIVE_JSON?goog.global.JSON.parse:function(a){return eval(\"(\"+a+\")\")};goog.json.serialize=goog.json.USE_NATIVE_JSON?goog.global.JSON.stringify:function(a,d){return(new goog.json.Serializer(d)).serialize(a)};goog.json.Serializer=function(a){this.replacer_=a};\ngoog.json.Serializer.prototype.serialize=function(a){var d=[];this.serialize_(a,d);return d.join(\"\")};\ngoog.json.Serializer.prototype.serialize_=function(a,d){switch(typeof a){case \"string\":this.serializeString_(a,d);break;case \"number\":this.serializeNumber_(a,d);break;case \"boolean\":d.push(a);break;case \"undefined\":d.push(\"null\");break;case \"object\":if(null==a){d.push(\"null\");break}if(goog.isArray(a)){this.serializeArray(a,d);break}this.serializeObject_(a,d);break;case \"function\":break;default:throw Error(\"Unknown type: \"+typeof a);}};\ngoog.json.Serializer.charToJsonCharCache_={'\"':'\\\\\"',\"\\\\\":\"\\\\\\\\\",\"/\":\"\\\\/\",\"\\b\":\"\\\\b\",\"\\f\":\"\\\\f\",\"\\n\":\"\\\\n\",\"\\r\":\"\\\\r\",\"\\t\":\"\\\\t\",\"\\x0B\":\"\\\\u000b\"};goog.json.Serializer.charsToReplace_=/\\uffff/.test(\"\\uffff\")?/[\\\\\\\"\\x00-\\x1f\\x7f-\\uffff]/g:/[\\\\\\\"\\x00-\\x1f\\x7f-\\xff]/g;\ngoog.json.Serializer.prototype.serializeString_=function(a,d){d.push('\"',a.replace(goog.json.Serializer.charsToReplace_,function(a){if(a in goog.json.Serializer.charToJsonCharCache_)return goog.json.Serializer.charToJsonCharCache_[a];var d=a.charCodeAt(0),g=\"\\\\u\";16>d?g+=\"000\":256>d?g+=\"00\":4096>d&&(g+=\"0\");return goog.json.Serializer.charToJsonCharCache_[a]=g+d.toString(16)}),'\"')};goog.json.Serializer.prototype.serializeNumber_=function(a,d){d.push(isFinite(a)&&!isNaN(a)?a:\"null\")};\ngoog.json.Serializer.prototype.serializeArray=function(a,d){var e=a.length;d.push(\"[\");for(var f=\"\",g=0;g<e;g++)d.push(f),f=a[g],this.serialize_(this.replacer_?this.replacer_.call(a,String(g),f):f,d),f=\",\";d.push(\"]\")};\ngoog.json.Serializer.prototype.serializeObject_=function(a,d){d.push(\"{\");var e=\"\",f;for(f in a)if(Object.prototype.hasOwnProperty.call(a,f)){var g=a[f];\"function\"!=typeof g&&(d.push(e),this.serializeString_(f,d),d.push(\":\"),this.serialize_(this.replacer_?this.replacer_.call(a,f,g):g,d),e=\",\")}d.push(\"}\")};fb.simplelogin.util={};fb.simplelogin.util.json={};fb.simplelogin.util.json.parse=function(a){return\"undefined\"!==typeof JSON&&goog.isDef(JSON.parse)?JSON.parse(a):goog.json.parse(a)};fb.simplelogin.util.json.stringify=function(a){return\"undefined\"!==typeof JSON&&goog.isDef(JSON.stringify)?JSON.stringify(a):goog.json.serialize(a)};fb.simplelogin.transports={};fb.simplelogin.transports.Transport={};fb.simplelogin.Transport=function(){};fb.simplelogin.Transport.prototype.open=function(a,d,e){};fb.simplelogin.transports.Popup={};fb.simplelogin.Popup=function(){};fb.simplelogin.Popup.prototype.open=function(a,d,e){};fb.simplelogin.util.misc={};fb.simplelogin.util.misc.parseUrl=function(a){var d=document.createElement(\"a\");d.href=a;return{protocol:d.protocol.replace(\":\",\"\"),host:d.hostname,port:d.port,query:d.search,params:fb.simplelogin.util.misc.parseQuerystring(d.search),hash:d.hash.replace(\"#\",\"\"),path:d.pathname.replace(/^([^\\/])/,\"/$1\")}};fb.simplelogin.util.misc.parseQuerystring=function(a){var d={};a=a.replace(/^\\?/,\"\").split(\"&\");for(var e=0;e<a.length;e++)if(a[e]){var f=a[e].split(\"=\");d[f[0]]=f[1]}return d};\nfb.simplelogin.util.misc.parseSubdomain=function(a){var d=\"\";try{var e=fb.simplelogin.util.misc.parseUrl(a).host.split(\".\");2<e.length&&(d=e.slice(0,-2).join(\".\"))}catch(f){}return d};fb.simplelogin.util.misc.warn=function(a){\"undefined\"!==typeof console&&(\"undefined\"!==typeof console.warn?console.warn(a):console.log(a))};var popupTimeout=12E4;fb.simplelogin.transports.CordovaInAppBrowser_=function(){};\nfb.simplelogin.transports.CordovaInAppBrowser_.prototype.open=function(a,d,e){callbackInvoked=!1;var f=function(){var a=Array.prototype.slice.apply(arguments);callbackInvoked||(callbackInvoked=!0,e.apply(null,a))},g=window.open(a+\"&transport=internal-redirect-hash\",\"blank\",\"location=no\");g.addEventListener(\"loadstop\",function(a){var d;if(a&&a.url&&(a=fb.simplelogin.util.misc.parseUrl(a.url),\"/blank/page.html\"===a.path)){g.close();try{var e=fb.simplelogin.util.misc.parseQuerystring(a.hash);a={};for(var n in e)a[n]=\nfb.simplelogin.util.json.parse(decodeURIComponent(e[n]));d=a}catch(q){}d&&d.token&&d.user?f(null,d):d&&d.error?f(d.error):f({code:\"RESPONSE_PAYLOAD_ERROR\",message:\"Unable to parse response payload for PhoneGap.\"})}});g.addEventListener(\"exit\",function(a){f({code:\"USER_DENIED\",message:\"User cancelled the authentication request.\"})});setTimeout(function(){g&&g.close&&g.close()},popupTimeout)};fb.simplelogin.transports.CordovaInAppBrowser=new fb.simplelogin.transports.CordovaInAppBrowser_;fb.simplelogin.Errors={};var messagePrefix=\"FirebaseSimpleLogin: \",errors={UNKNOWN_ERROR:\"An unknown error occurred.\",INVALID_EMAIL:\"Invalid email specified.\",INVALID_PASSWORD:\"Invalid password specified.\",USER_DENIED:\"User cancelled the authentication request.\",RESPONSE_PAYLOAD_ERROR:\"Unable to parse response payload.\",TRIGGER_IO_TABS:'The \"forge.tabs\" module required when using Firebase Simple Login and                               Trigger.io. Without this module included and enabled, login attempts to                               OAuth authentication providers will not be able to complete.'};\nfb.simplelogin.Errors.format=function(a,d){var e,f,g={},h=arguments;if(2===h.length)e=h[0],f=h[1];else if(1===h.length)if(\"object\"===typeof h[0]&&h[0].code&&h[0].message){if(0===h[0].message.indexOf(messagePrefix))return h[0];e=h[0].code;f=h[0].message;g=h[0].data}else\"string\"===typeof h[0]&&(e=h[0],f=errors[e]);else e=\"UNKNOWN_ERROR\",f=errors[e];f=Error(messagePrefix+f);f.code=e;g&&(f.data=g);return f};var RELAY_FRAME_NAME=\"__winchan_relay_frame\",CLOSE_CMD=\"die\";function addListener(a,d,e){a.attachEvent?a.attachEvent(\"on\"+d,e):a.addEventListener&&a.addEventListener(d,e,!1)}function removeListener(a,d,e){a.detachEvent?a.detachEvent(\"on\"+d,e):a.removeEventListener&&a.removeEventListener(d,e,!1)}function extractOrigin(a){/^https?:\\/\\//.test(a)||(a=window.location.href);var d=/^(https?:\\/\\/[\\-_a-zA-Z\\.0-9:]+)/.exec(a);return d?d[1]:a}\nfunction findRelay(){for(var a=window.location,d=window.opener.frames,a=a.protocol+\"//\"+a.host,e=d.length-1;0<=e;e--)try{if(0===d[e].location.href.indexOf(a)&&d[e].name===RELAY_FRAME_NAME)return d[e]}catch(f){}}\nvar isInternetExplorer=function(){var a,d=-1,e=navigator.userAgent;\"Microsoft Internet Explorer\"===navigator.appName?(a=/MSIE ([0-9]{1,}[\\.0-9]{0,})/,(a=e.match(a))&&1<a.length&&(d=parseFloat(a[1]))):-1<e.indexOf(\"Trident\")&&(a=/rv:([0-9]{2,2}[\\.0-9]{0,})/,(a=e.match(a))&&1<a.length&&(d=parseFloat(a[1])));return 8<=d}();fb.simplelogin.transports.WinChan_=function(){};\nfb.simplelogin.transports.WinChan_.prototype.open=function(a,d,e){function f(){k&&document.body.removeChild(k);k=void 0;s&&(s=clearInterval(s));removeListener(window,\"message\",g);removeListener(window,\"unload\",f);if(q)try{q.close()}catch(a){n.postMessage(CLOSE_CMD,l)}q=n=void 0}function g(a){if(a.origin===l)try{var d=fb.simplelogin.util.json.parse(a.data);\"ready\"===d.a?n.postMessage(m,l):\"error\"===d.a?(f(),e&&(e(d.d),e=null)):\"response\"===d.a&&(f(),e&&(e(null,d.d),e=null))}catch(g){}}if(!e)throw\"missing required callback argument\";\nd.url=a;var h;d.url||(h=\"missing required 'url' parameter\");d.relay_url||(h=\"missing required 'relay_url' parameter\");h&&setTimeout(function(){e(h)},0);d.window_name||(d.window_name=null);if(!d.window_features||fb.simplelogin.util.env.isFennec())d.window_features=void 0;var k,l=extractOrigin(d.url);if(l!==extractOrigin(d.relay_url))return setTimeout(function(){e(\"invalid arguments: origin of url and relay_url must match\")},0);var n;isInternetExplorer&&(k=document.createElement(\"iframe\"),k.setAttribute(\"src\",\nd.relay_url),k.style.display=\"none\",k.setAttribute(\"name\",RELAY_FRAME_NAME),document.body.appendChild(k),n=k.contentWindow);var q=window.open(d.url,d.window_name,d.window_features);n||(n=q);var s=setInterval(function(){q&&q.closed&&(f(),e&&(e(\"unknown closed window\"),e=null))},500),m=fb.simplelogin.util.json.stringify({a:\"request\",d:d.params});addListener(window,\"unload\",f);addListener(window,\"message\",g);return{close:f,focus:function(){if(q)try{q.focus()}catch(a){}}}};\ngoog.exportSymbol(\"fb.simplelogin.transports.WinChan_.prototype.open\",fb.simplelogin.transports.WinChan_.prototype.open);\nfb.simplelogin.transports.WinChan_.prototype.onOpen=function(a){function d(a){a=fb.simplelogin.util.json.stringify(a);isInternetExplorer?h.doPost(a,g):h.postMessage(a,g)}function e(f){var h;try{h=fb.simplelogin.util.json.parse(f.data)}catch(n){}h&&\"request\"===h.a&&(removeListener(window,\"message\",e),g=f.origin,a&&setTimeout(function(){a(g,h.d,function(e,f){k=!f;a=void 0;d({a:\"response\",d:e})})},0))}function f(a){if(k&&a.data===CLOSE_CMD)try{window.close()}catch(d){}}var g=\"*\",h=isInternetExplorer?\nfindRelay():window.opener,k=!0;if(!h)throw\"can't find relay frame\";addListener(isInternetExplorer?h:window,\"message\",e);addListener(isInternetExplorer?h:window,\"message\",f);try{d({a:\"ready\"})}catch(l){addListener(h,\"load\",function(a){d({a:\"ready\"})})}var n=function(){try{removeListener(isInternetExplorer?h:window,\"message\",f)}catch(e){}a&&d({a:\"error\",d:\"client closed window\"});a=void 0;try{window.close()}catch(g){}};addListener(window,\"unload\",n);return{detach:function(){removeListener(window,\"unload\",\nn)}}};goog.exportSymbol(\"fb.simplelogin.transports.WinChan_.prototype.onOpen\",fb.simplelogin.transports.WinChan_.prototype.onOpen);fb.simplelogin.transports.WinChan_.prototype.isAvailable=function(){return fb.simplelogin.util.json&&fb.simplelogin.util.json.parse&&fb.simplelogin.util.json.stringify&&window.postMessage};fb.simplelogin.transports.WinChan=new fb.simplelogin.transports.WinChan_;fb.simplelogin.transports.TriggerIoTab_=function(){};\nfb.simplelogin.transports.TriggerIoTab_.prototype.open=function(a,d,e){callbackInvoked=!1;var f=function(){var a=Array.prototype.slice.apply(arguments);callbackInvoked||(callbackInvoked=!0,e.apply(null,a))};forge.tabs.openWithOptions({url:a+\"&transport=internal-redirect-hash\",pattern:fb.simplelogin.Vars.getApiHost()+\"/blank/page*\"},function(a){var d;if(a&&a.url)try{var e=fb.simplelogin.util.misc.parseUrl(a.url),l=fb.simplelogin.util.misc.parseQuerystring(e.hash);a={};for(var n in l)a[n]=fb.simplelogin.util.json.parse(decodeURIComponent(l[n]));\nd=a}catch(q){}d&&d.token&&d.user?f(null,d):d&&d.error?f(d.error):f({code:\"RESPONSE_PAYLOAD_ERROR\",message:\"Unable to parse response payload for Trigger.io.\"})},function(a){f({code:\"UNKNOWN_ERROR\",message:\"An unknown error occurred for Trigger.io.\"})})};fb.simplelogin.transports.TriggerIoTab=new fb.simplelogin.transports.TriggerIoTab_;var b,c;\n!function(){var a={},d={};b=function(d,f,g){a[d]={deps:f,callback:g}};c=function(e){function f(a){if(\".\"!==a.charAt(0))return a;a=a.split(\"/\");for(var d=e.split(\"/\").slice(0,-1),f=0,g=a.length;g>f;f++){var k=a[f];\"..\"===k?d.pop():\".\"!==k&&d.push(k)}return d.join(\"/\")}if(d[e])return d[e];if(d[e]={},!a[e])throw Error(\"Could not find module \"+e);for(var g,h=a[e],k=h.deps,h=h.callback,l=[],n=0,q=k.length;q>n;n++)l.push(\"exports\"===k[n]?g={}:c(f(k[n])));k=h.apply(this,l);return d[e]=g||k};c.entries=a}();\nb(\"rsvp/all-settled\",[\"./promise\",\"./utils\",\"exports\"],function(a,d,e){var f=a[\"default\"],g=d.isArray,h=d.isNonThenable;e[\"default\"]=function(a,d){return new f(function(d){function e(a){return function(d){m(a,{state:\"fulfilled\",value:d})}}function l(a){return function(d){m(a,{state:\"rejected\",reason:d})}}function m(a,e){u[a]=e;0===--r&&d(u)}if(!g(a))throw new TypeError(\"You must pass an array to allSettled.\");var p,r=a.length;if(0===r)return void d([]);for(var u=Array(r),v=0;v<a.length;v++)p=a[v],\nh(p)?m(v,{state:\"fulfilled\",value:p}):f.resolve(p).then(e(v),l(v))},d)}});b(\"rsvp/all\",[\"./promise\",\"exports\"],function(a,d){var e=a[\"default\"];d[\"default\"]=function(a,d){return e.all(a,d)}});\nb(\"rsvp/asap\",[\"exports\"],function(a){function d(){return function(){process.nextTick(g)}}function e(){var a=0,d=new k(g),e=document.createTextNode(\"\");return d.observe(e,{characterData:!0}),function(){e.data=a=++a%2}}function f(){return function(){setTimeout(g,1)}}function g(){for(var a=0;a<l.length;a++){var d=l[a];(0,d[0])(d[1])}l.length=0}a[\"default\"]=function(a,d){1===l.push([a,d])&&h()};var h;a=\"undefined\"!=typeof window?window:{};var k=a.MutationObserver||a.WebKitMutationObserver,l=[];h=\"undefined\"!=\ntypeof process&&\"[object process]\"==={}.toString.call(process)?d():k?e():f()});b(\"rsvp/config\",[\"./events\",\"exports\"],function(a,d){var e={instrument:!1};a[\"default\"].mixin(e);d.config=e;d.configure=function(a,d){return\"onerror\"===a?void e.on(\"error\",d):2!==arguments.length?e[a]:void(e[a]=d)}});b(\"rsvp/defer\",[\"./promise\",\"exports\"],function(a,d){var e=a[\"default\"];d[\"default\"]=function(a){var d={};return d.promise=new e(function(a,e){d.resolve=a;d.reject=e},a),d}});\nb(\"rsvp/events\",[\"exports\"],function(a){function d(a,d){for(var e=0,k=a.length;k>e;e++)if(a[e]===d)return e;return-1}function e(a){var d=a._promiseCallbacks;return d||(d=a._promiseCallbacks={}),d}a[\"default\"]={mixin:function(a){return a.on=this.on,a.off=this.off,a.trigger=this.trigger,a._promiseCallbacks=void 0,a},on:function(a,g){var h,k=e(this);(h=k[a])||(h=k[a]=[]);-1===d(h,g)&&h.push(g)},off:function(a,g){var h,k,l=e(this);return g?(h=l[a],k=d(h,g),void(-1!==k&&h.splice(k,1))):void(l[a]=[])},\ntrigger:function(a,d){var h;if(h=e(this)[a])for(var k=0;k<h.length;k++)(0,h[k])(d)}}});\nb(\"rsvp/filter\",[\"./promise\",\"./utils\",\"exports\"],function(a,d,e){var f=a[\"default\"],g=d.isFunction;e[\"default\"]=function(a,d,e){return f.all(a,e).then(function(a){if(!g(d))throw new TypeError(\"You must pass a function as filter's second argument.\");for(var h=a.length,s=Array(h),m=0;h>m;m++)s[m]=d(a[m]);return f.all(s,e).then(function(d){for(var e=Array(h),f=0,g=0;h>g;g++)!0===d[g]&&(e[f]=a[g],f++);return e.length=f,e})})}});\nb(\"rsvp/hash-settled\",[\"./promise\",\"./utils\",\"exports\"],function(a,d,e){var f=a[\"default\"],g=d.isNonThenable,h=d.keysOf;e[\"default\"]=function(a){return new f(function(d){function e(a){return function(d){s(a,{state:\"fulfilled\",value:d})}}function q(a){return function(d){s(a,{state:\"rejected\",reason:d})}}function s(a,e){r[a]=e;0===--v&&d(r)}var m,p,r={},u=h(a),v=u.length;if(0===v)return void d(r);for(var t=0;t<u.length;t++)p=u[t],m=a[p],g(m)?s(p,{state:\"fulfilled\",value:m}):f.resolve(m).then(e(p),q(p))})}});\nb(\"rsvp/hash\",[\"./promise\",\"./utils\",\"exports\"],function(a,d,e){var f=a[\"default\"],g=d.isNonThenable,h=d.keysOf;e[\"default\"]=function(a){return new f(function(d,e){function q(a){return function(e){r[a]=e;0===--v&&d(r)}}function s(a){v=0;e(a)}var m,p,r={},u=h(a),v=u.length;if(0===v)return void d(r);for(var t=0;t<u.length;t++)p=u[t],m=a[p],g(m)?(r[p]=m,0===--v&&d(r)):f.resolve(m).then(q(p),s)})}});\nb(\"rsvp/instrument\",[\"./config\",\"./utils\",\"exports\"],function(a,d,e){var f=a.config,g=d.now;e[\"default\"]=function(a,d,e){try{f.trigger(a,{guid:d._guidKey+d._id,eventName:a,detail:d._detail,childGuid:e&&d._guidKey+e._id,label:d._label,timeStamp:g(),stack:Error(d._label).stack})}catch(n){setTimeout(function(){throw n;},0)}}});\nb(\"rsvp/map\",[\"./promise\",\"./utils\",\"exports\"],function(a,d,e){var f=a[\"default\"],g=(d.isArray,d.isFunction);e[\"default\"]=function(a,d,e){return f.all(a,e).then(function(a){if(!g(d))throw new TypeError(\"You must pass a function as map's second argument.\");for(var h=a.length,s=Array(h),m=0;h>m;m++)s[m]=d(a[m]);return f.all(s,e)})}});\nb(\"rsvp/node\",[\"./promise\",\"./utils\",\"exports\"],function(a,d,e){var f=a[\"default\"],g=d.isArray;e[\"default\"]=function(a,d){function e(){for(var g=arguments.length,m=Array(g),l=0;g>l;l++)m[l]=arguments[l];var r;return n||q||!d?r=this:(console.warn('Deprecation: RSVP.denodeify() doesn\\'t allow setting the \"this\" binding anymore. Use yourFunction.bind(yourThis) instead.'),r=d),f.all(m).then(function(e){return new f(function(f,g){e.push(function(){for(var a=arguments.length,e=Array(a),h=0;a>h;h++)e[h]=\narguments[h];a=e[0];h=e[1];if(a)g(a);else if(n)f(e.slice(1));else if(q){for(var a={},l=e.slice(1),h=0;h<d.length;h++)e=d[h],a[e]=l[h];f(a)}else f(h)});a.apply(r,e)})})}var n=!0===d,q=g(d);return e.__proto__=a,e}});\nb(\"rsvp/promise\",\"./config ./events ./instrument ./utils ./promise/cast ./promise/all ./promise/race ./promise/resolve ./promise/reject exports\".split(\" \"),function(a,d,e,f,g,h,k,l,n,q){function s(){}function m(a,d){if(!B(a))throw new TypeError(\"You must pass a resolver function as the first argument to the promise constructor\");if(!(this instanceof m))throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");this._id=\nH++;this._label=d;this._subscribers=[];z.instrument&&C(\"created\",this);s!==a&&p(a,this)}function p(a,d){function e(a){y(d,a)}function f(a){x(d,a)}try{a(e,f)}catch(g){f(g)}}function r(a,d,e,f){a=a._subscribers;var g=a.length;a[g]=d;a[g+A]=e;a[g+D]=f}function u(a,d){var e,f,g=a._subscribers,h=a._detail;z.instrument&&C(d===A?\"fulfilled\":\"rejected\",a);for(var k=0;k<g.length;k+=3)e=g[k],f=g[k+d],v(d,e,f,h);a._subscribers=null}function v(a,d,e,f){var g,h,k,l,m=B(e);if(m)try{g=e(f),k=!0}catch(n){l=!0,h=\nn}else g=f,k=!0;t(d,g)||(m&&k?y(d,g):l?x(d,h):a===A?y(d,g):a===D&&x(d,g))}function t(a,d){var e,f=null;try{if(a===d)throw new TypeError(\"A promises callback cannot return that same promise.\");if(I(d)&&(f=d.then,B(f)))return f.call(d,function(f){return e?!0:(e=!0,void(d!==f?y(a,f):w(a,f)))},function(d){return e?!0:(e=!0,void x(a,d))},\"Settle: \"+(a._label||\" unknown promise\")),!0}catch(g){return e?!0:(x(a,g),!0)}return!1}function y(a,d){a===d?w(a,d):t(a,d)||w(a,d)}function w(a,d){a._state===E&&(a._state=\nF,a._detail=d,z.async(G,a))}function x(a,d){a._state===E&&(a._state=F,a._detail=d,z.async(J,a))}function G(a){u(a,a._state=A)}function J(a){a._onerror&&a._onerror(a._detail);u(a,a._state=D)}var z=a.config,C=(d[\"default\"],e[\"default\"]),I=f.objectOrFunction,B=f.isFunction;a=f.now;g=g[\"default\"];h=h[\"default\"];k=k[\"default\"];l=l[\"default\"];n=n[\"default\"];a=\"rsvp_\"+a()+\"-\";var H=0;q[\"default\"]=m;m.cast=g;m.all=h;m.race=k;m.resolve=l;m.reject=n;var E=void 0,F=0,A=1,D=2;m.prototype={constructor:m,_id:void 0,\n_guidKey:a,_label:void 0,_state:void 0,_detail:void 0,_subscribers:void 0,_onerror:function(a){z.trigger(\"error\",a)},then:function(a,d,e){var f=this;this._onerror=null;var g=new this.constructor(s,e);if(this._state){var h=arguments;z.async(function(){v(f._state,g,h[f._state-1],f._detail)})}else r(this,g,a,d);return z.instrument&&C(\"chained\",f,g),g},\"catch\":function(a,d){return this.then(null,a,d)},\"finally\":function(a,d){var e=this.constructor;return this.then(function(d){return e.resolve(a()).then(function(){return d})},\nfunction(d){return e.resolve(a()).then(function(){throw d;})},d)}}});\nb(\"rsvp/promise/all\",[\"../utils\",\"exports\"],function(a,d){var e=a.isArray,f=a.isNonThenable;d[\"default\"]=function(a,d){var k=this;return new k(function(d,h){function q(a){return function(e){r[a]=e;0===--p&&d(r)}}function s(a){p=0;h(a)}if(!e(a))throw new TypeError(\"You must pass an array to all.\");var m,p=a.length,r=Array(p);if(0===p)return void d(r);for(var u=0;u<a.length;u++)m=a[u],f(m)?(r[u]=m,0===--p&&d(r)):k.resolve(m).then(q(u),s)},d)}});\nb(\"rsvp/promise/cast\",[\"exports\"],function(a){a[\"default\"]=function(a,e){return a&&\"object\"==typeof a&&a.constructor===this?a:new this(function(e){e(a)},e)}});\nb(\"rsvp/promise/race\",[\"../utils\",\"exports\"],function(a,d){var e=a.isArray,f=(a.isFunction,a.isNonThenable);d[\"default\"]=function(a,d){var k,l=this;return new l(function(d,h){function s(a){p&&(p=!1,d(a))}function m(a){p&&(p=!1,h(a))}if(!e(a))throw new TypeError(\"You must pass an array to race.\");for(var p=!0,r=0;r<a.length;r++){if(k=a[r],f(k))return p=!1,void d(k);l.resolve(k).then(s,m)}},d)}});\nb(\"rsvp/promise/reject\",[\"exports\"],function(a){a[\"default\"]=function(a,e){return new this(function(e,g){g(a)},e)}});b(\"rsvp/promise/resolve\",[\"exports\"],function(a){a[\"default\"]=function(a,e){return a&&\"object\"==typeof a&&a.constructor===this?a:new this(function(e){e(a)},e)}});b(\"rsvp/race\",[\"./promise\",\"exports\"],function(a,d){var e=a[\"default\"];d[\"default\"]=function(a,d){return e.race(a,d)}});\nb(\"rsvp/reject\",[\"./promise\",\"exports\"],function(a,d){var e=a[\"default\"];d[\"default\"]=function(a,d){return e.reject(a,d)}});b(\"rsvp/resolve\",[\"./promise\",\"exports\"],function(a,d){var e=a[\"default\"];d[\"default\"]=function(a,d){return e.resolve(a,d)}});b(\"rsvp/rethrow\",[\"exports\"],function(a){a[\"default\"]=function(a){throw setTimeout(function(){throw a;}),a;}});\nb(\"rsvp/utils\",[\"exports\"],function(a){function d(a){return\"function\"==typeof a||\"object\"==typeof a&&null!==a}a.objectOrFunction=d;a.isFunction=function(a){return\"function\"==typeof a};a.isNonThenable=function(a){return!d(a)};a.isArray=Array.isArray?Array.isArray:function(a){return\"[object Array]\"===Object.prototype.toString.call(a)};a.now=Date.now||function(){return(new Date).getTime()};a.keysOf=Object.keys||function(a){var d=[],g;for(g in a)d.push(g);return d}});\nb(\"rsvp\",\"./rsvp/promise ./rsvp/events ./rsvp/node ./rsvp/all ./rsvp/all-settled ./rsvp/race ./rsvp/hash ./rsvp/hash-settled ./rsvp/rethrow ./rsvp/defer ./rsvp/config ./rsvp/map ./rsvp/resolve ./rsvp/reject ./rsvp/filter ./rsvp/asap exports\".split(\" \"),function(a,d,e,f,g,h,k,l,n,q,s,m,p,r,u,v,t){function y(){w.on.apply(w,arguments)}a=a[\"default\"];d=d[\"default\"];e=e[\"default\"];f=f[\"default\"];g=g[\"default\"];h=h[\"default\"];k=k[\"default\"];l=l[\"default\"];n=n[\"default\"];q=q[\"default\"];var w=s.config;s=\ns.configure;m=m[\"default\"];p=p[\"default\"];r=r[\"default\"];u=u[\"default\"];if(w.async=v[\"default\"],\"undefined\"!=typeof window&&\"object\"==typeof window.__PROMISE_INSTRUMENTATION__){v=window.__PROMISE_INSTRUMENTATION__;s(\"instrument\",!0);for(var x in v)v.hasOwnProperty(x)&&y(x,v[x])}t.Promise=a;t.EventTarget=d;t.all=f;t.allSettled=g;t.race=h;t.hash=k;t.hashSettled=l;t.rethrow=n;t.defer=q;t.denodeify=e;t.configure=s;t.on=y;t.off=function(){w.off.apply(w,arguments)};t.resolve=p;t.reject=r;t.async=function(a,\nd){w.async(a,d)};t.map=m;t.filter=u});fb.simplelogin.util.RSVP=c(\"rsvp\");fb.simplelogin.util.env={};fb.simplelogin.util.env.hasLocalStorage=function(a){try{if(localStorage){localStorage.setItem(\"firebase-sentinel\",\"test\");var d=localStorage.getItem(\"firebase-sentinel\");localStorage.removeItem(\"firebase-sentinel\");return\"test\"===d}}catch(e){}return!1};\nfb.simplelogin.util.env.hasSessionStorage=function(a){try{if(sessionStorage){sessionStorage.setItem(\"firebase-sentinel\",\"test\");var d=sessionStorage.getItem(\"firebase-sentinel\");sessionStorage.removeItem(\"firebase-sentinel\");return\"test\"===d}}catch(e){}return!1};fb.simplelogin.util.env.isMobileCordovaInAppBrowser=function(){return(window.cordova||window.CordovaInAppBrowser||window.phonegap)&&/ios|iphone|ipod|ipad|android/i.test(navigator.userAgent)};\nfb.simplelogin.util.env.isMobileTriggerIoTab=function(){return window.forge&&/ios|iphone|ipod|ipad|android/i.test(navigator.userAgent)};fb.simplelogin.util.env.isWindowsMetro=function(){return!!window.Windows&&/^ms-appx:/.test(location.href)};fb.simplelogin.util.env.isChromeiOS=function(){return!!navigator.userAgent.match(/CriOS/)};fb.simplelogin.util.env.isTwitteriOS=function(){return!!navigator.userAgent.match(/Twitter for iPhone/)};fb.simplelogin.util.env.isFacebookiOS=function(){return!!navigator.userAgent.match(/FBAN\\/FBIOS/)};\nfb.simplelogin.util.env.isWindowsPhone=function(){return!!navigator.userAgent.match(/Windows Phone/)};fb.simplelogin.util.env.isStandaloneiOS=function(){return!!window.navigator.standalone};fb.simplelogin.util.env.isPhantomJS=function(){return!!navigator.userAgent.match(/PhantomJS/)};\nfb.simplelogin.util.env.isIeLT10=function(){var a,d=-1,e=navigator.userAgent;return\"Microsoft Internet Explorer\"===navigator.appName&&(a=/MSIE ([0-9]{1,}[\\.0-9]{0,})/,(a=e.match(a))&&1<a.length&&(d=parseFloat(a[1])),10>d)?!0:!1};fb.simplelogin.util.env.isFennec=function(){try{var a=navigator.userAgent;return-1!=a.indexOf(\"Fennec/\")||-1!=a.indexOf(\"Firefox/\")&&-1!=a.indexOf(\"Android\")}catch(d){}return!1};fb.simplelogin.transports.XHR_=function(){};\nfb.simplelogin.transports.XHR_.prototype.open=function(a,d,e){var f={contentType:\"application/json\"},g=new XMLHttpRequest,h=(f.method||\"GET\").toUpperCase(),k=f.contentType||\"application/x-www-form-urlencoded\",l=!1,n;g.onreadystatechange=function(){if(!l&&4===g.readyState){l=!0;var a,d;try{a=fb.simplelogin.util.json.parse(g.responseText),d=a.error||null,delete a.error}catch(f){}return e&&e(d,a)}};d&&(\"GET\"===h?(-1===a.indexOf(\"?\")&&(a+=\"?\"),a+=this.formatQueryString(d),d=null):(\"application/json\"===\nk&&(d=fb.simplelogin.util.json.stringify(d)),\"application/x-www-form-urlencoded\"===k&&(d=this.formatQueryString(d))));g.open(h,a,!0);a={\"X-Requested-With\":\"XMLHttpRequest\",Accept:\"application/json;text/plain\",\"Content-Type\":k};f.headers=f.headers||{};for(n in f.headers)a[n]=f.headers[n];for(n in a)g.setRequestHeader(n,a[n]);g.send(d)};fb.simplelogin.transports.XHR_.prototype.isAvailable=function(){return window.XMLHttpRequest&&\"function\"===typeof window.XMLHttpRequest&&!fb.simplelogin.util.env.isIeLT10()};\nfb.simplelogin.transports.XHR_.prototype.formatQueryString=function(a){if(!a)return\"\";var d=[],e;for(e in a)d.push(encodeURIComponent(e)+\"=\"+encodeURIComponent(a[e]));return d.join(\"&\")};fb.simplelogin.transports.XHR=new fb.simplelogin.transports.XHR_;fb.simplelogin.util.validation={};var VALID_EMAIL_REGEX_=/^([a-zA-Z0-9_\\.\\-\\+])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,6})+$/;fb.simplelogin.util.validation.validateArgCount=function(a,d,e,f){var g;f<d?g=\"at least \"+d:f>e&&(g=0===e?\"none\":\"no more than \"+e);if(g)throw Error(a+\" failed: Was called with \"+f+(1===f?\" argument.\":\" arguments.\")+\" Expects \"+g+\".\");};fb.simplelogin.util.validation.isValidEmail=function(a){return goog.isString(a)&&VALID_EMAIL_REGEX_.test(a)};\nfb.simplelogin.util.validation.isValidPassword=function(a){return goog.isString(a)};fb.simplelogin.util.validation.isValidNamespace=function(a){return goog.isString(a)};\nfb.simplelogin.util.validation.errorPrefix_=function(a,d,e){var f=\"\";switch(d){case 1:f=e?\"first\":\"First\";break;case 2:f=e?\"second\":\"Second\";break;case 3:f=e?\"third\":\"Third\";break;case 4:f=e?\"fourth\":\"Fourth\";break;default:fb.core.util.validation.assert(!1,\"errorPrefix_ called with argumentNumber > 4.  Need to update it?\")}return a=a+\" failed: \"+(f+\" argument \")};\nfb.simplelogin.util.validation.validateNamespace=function(a,d,e,f){if((!f||goog.isDef(e))&&!goog.isString(e))throw Error(fb.simplelogin.util.validation.errorPrefix_(a,d,f)+\"must be a valid firebase namespace.\");};fb.simplelogin.util.validation.validateCallback=function(a,d,e,f){if((!f||goog.isDef(e))&&!goog.isFunction(e))throw Error(fb.simplelogin.util.validation.errorPrefix_(a,d,f)+\"must be a valid function.\");};\nfb.simplelogin.util.validation.validateString=function(a,d,e,f){if((!f||goog.isDef(e))&&!goog.isString(e))throw Error(fb.simplelogin.util.validation.errorPrefix_(a,d,f)+\"must be a valid string.\");};fb.simplelogin.util.validation.validateContextObject=function(a,d,e,f){if(!f||goog.isDef(e))if(!goog.isObject(e)||null===e)throw Error(fb.simplelogin.util.validation.errorPrefix_(a,d,f)+\"must be a valid context object.\");};var CALLBACK_NAMESPACE=\"_FirebaseSimpleLoginJSONP\";fb.simplelogin.transports.JSONP_=function(){window[CALLBACK_NAMESPACE]=window[CALLBACK_NAMESPACE]||{}};fb.simplelogin.transports.JSONP_.prototype.open=function(a,d,e){a+=/\\?/.test(a)?\"\":\"?\";a+=\"&transport=jsonp\";for(var f in d)a+=\"&\"+encodeURIComponent(f)+\"=\"+encodeURIComponent(d[f]);d=this.generateRequestId_();a+=\"&callback=\"+encodeURIComponent(CALLBACK_NAMESPACE+\".\"+d);this.registerCallback_(d,e);this.writeScriptTag_(d,a,e)};\nfb.simplelogin.transports.JSONP_.prototype.generateRequestId_=function(){return\"_FirebaseJSONP\"+(new Date).getTime()+Math.floor(100*Math.random())};fb.simplelogin.transports.JSONP_.prototype.registerCallback_=function(a,d){var e=this;window[CALLBACK_NAMESPACE][a]=function(f){var g=f.error||null;delete f.error;d(g,f);e.removeCallback_(a)}};\nfb.simplelogin.transports.JSONP_.prototype.removeCallback_=function(a){setTimeout(function(){delete window[CALLBACK_NAMESPACE][a];var d=document.getElementById(a);d&&d.parentNode.removeChild(d)},0)};\nfb.simplelogin.transports.JSONP_.prototype.writeScriptTag_=function(a,d,e){var f=this;setTimeout(function(){try{var g=document.createElement(\"script\");g.type=\"text/javascript\";g.id=a;g.async=!0;g.src=d;g.onerror=function(){var d=document.getElementById(a);null!==d&&d.parentNode.removeChild(d);e&&e(f.formatError_({code:\"SERVER_ERROR\",message:\"An unknown server error occurred.\"}))};document.getElementsByTagName(\"head\")[0].appendChild(g)}catch(h){e&&e(f.formatError_({code:\"SERVER_ERROR\",message:\"An unknown server error occurred.\"}))}},\n0)};fb.simplelogin.transports.JSONP_.prototype.formatError_=function(a){var d;a?(d=Error(a.message),d.code=a.code||\"UNKNOWN_ERROR\"):(d=Error(),d.code=\"UNKNOWN_ERROR\");return d};fb.simplelogin.transports.JSONP=new fb.simplelogin.transports.JSONP_;fb.simplelogin.providers={};fb.simplelogin.providers.Password_=function(){};fb.simplelogin.providers.Password_.prototype.getTransport_=function(){return fb.simplelogin.transports.XHR.isAvailable()?fb.simplelogin.transports.XHR:fb.simplelogin.transports.JSONP};\nfb.simplelogin.providers.Password_.prototype.login=function(a,d){var e=fb.simplelogin.Vars.getApiHost()+\"/auth/firebase\";if(!fb.simplelogin.util.validation.isValidNamespace(a.firebase))return d&&d(\"INVALID_FIREBASE\");this.getTransport_().open(e,a,d)};\nfb.simplelogin.providers.Password_.prototype.createUser=function(a,d){var e=fb.simplelogin.Vars.getApiHost()+\"/auth/firebase/create\";if(!fb.simplelogin.util.validation.isValidNamespace(a.firebase))return d&&d(\"INVALID_FIREBASE\");if(!fb.simplelogin.util.validation.isValidEmail(a.email))return d&&d(\"INVALID_EMAIL\");if(!fb.simplelogin.util.validation.isValidPassword(a.password))return d&&d(\"INVALID_PASSWORD\");this.getTransport_().open(e,a,d)};\nfb.simplelogin.providers.Password_.prototype.changePassword=function(a,d){var e=fb.simplelogin.Vars.getApiHost()+\"/auth/firebase/update\";if(!fb.simplelogin.util.validation.isValidNamespace(a.firebase))return d&&d(\"INVALID_FIREBASE\");if(!fb.simplelogin.util.validation.isValidEmail(a.email))return d&&d(\"INVALID_EMAIL\");if(!fb.simplelogin.util.validation.isValidPassword(a.newPassword))return d&&d(\"INVALID_PASSWORD\");this.getTransport_().open(e,a,d)};\nfb.simplelogin.providers.Password_.prototype.removeUser=function(a,d){var e=fb.simplelogin.Vars.getApiHost()+\"/auth/firebase/remove\";if(!fb.simplelogin.util.validation.isValidNamespace(a.firebase))return d&&d(\"INVALID_FIREBASE\");if(!fb.simplelogin.util.validation.isValidEmail(a.email))return d&&d(\"INVALID_EMAIL\");if(!fb.simplelogin.util.validation.isValidPassword(a.password))return d&&d(\"INVALID_PASSWORD\");this.getTransport_().open(e,a,d)};\nfb.simplelogin.providers.Password_.prototype.sendPasswordResetEmail=function(a,d){var e=fb.simplelogin.Vars.getApiHost()+\"/auth/firebase/reset_password\";if(!fb.simplelogin.util.validation.isValidNamespace(a.firebase))return d&&d(\"INVALID_FIREBASE\");if(!fb.simplelogin.util.validation.isValidEmail(a.email))return d&&d(\"INVALID_EMAIL\");this.getTransport_().open(e,a,d)};fb.simplelogin.providers.Password=new fb.simplelogin.providers.Password_;fb.simplelogin.transports.WindowsMetroAuthBroker_=function(){};\nfb.simplelogin.transports.WindowsMetroAuthBroker_.prototype.open=function(a,d,e){var f,g,h,k,l,n;try{f=window.Windows.Foundation.Uri,g=window.Windows.Security.Authentication.Web.WebAuthenticationOptions,h=window.Windows.Security.Authentication.Web.WebAuthenticationBroker,k=h.authenticateAsync}catch(q){return e({code:\"WINDOWS_METRO\",message:'\"Windows.Security.Authentication.Web.WebAuthenticationBroker\" required when using Firebase Simple Login in Windows Metro context'})}l=!1;n=function(){var a=Array.prototype.slice.apply(arguments);\nl||(l=!0,e.apply(null,a))};a=new f(a+\"&transport=internal-redirect-hash\");f=new f(fb.simplelogin.Vars.getApiHost()+\"/blank/page.html\");k(g.none,a,f).done(function(a){var d;if(a&&a.responseData)try{var e=fb.simplelogin.util.misc.parseUrl(a.responseData),f=fb.simplelogin.util.misc.parseQuerystring(e.hash);a={};for(var g in f)a[g]=fb.simplelogin.util.json.parse(decodeURIComponent(f[g]));d=a}catch(h){}d&&d.token&&d.user?n(null,d):d&&d.error?n(d.error):n({code:\"RESPONSE_PAYLOAD_ERROR\",message:\"Unable to parse response payload for Windows.\"})},\nfunction(a){n({code:\"UNKNOWN_ERROR\",message:\"An unknown error occurred for Windows.\"})})};fb.simplelogin.transports.WindowsMetroAuthBroker=new fb.simplelogin.transports.WindowsMetroAuthBroker_;goog.string={};goog.string.Unicode={NBSP:\"\\u00a0\"};goog.string.startsWith=function(a,d){return 0==a.lastIndexOf(d,0)};goog.string.endsWith=function(a,d){var e=a.length-d.length;return 0<=e&&a.indexOf(d,e)==e};goog.string.caseInsensitiveStartsWith=function(a,d){return 0==goog.string.caseInsensitiveCompare(d,a.substr(0,d.length))};goog.string.caseInsensitiveEndsWith=function(a,d){return 0==goog.string.caseInsensitiveCompare(d,a.substr(a.length-d.length,d.length))};\ngoog.string.caseInsensitiveEquals=function(a,d){return a.toLowerCase()==d.toLowerCase()};goog.string.subs=function(a,d){for(var e=a.split(\"%s\"),f=\"\",g=Array.prototype.slice.call(arguments,1);g.length&&1<e.length;)f+=e.shift()+g.shift();return f+e.join(\"%s\")};goog.string.collapseWhitespace=function(a){return a.replace(/[\\s\\xa0]+/g,\" \").replace(/^\\s+|\\s+$/g,\"\")};goog.string.isEmpty=function(a){return/^[\\s\\xa0]*$/.test(a)};goog.string.isEmptySafe=function(a){return goog.string.isEmpty(goog.string.makeSafe(a))};\ngoog.string.isBreakingWhitespace=function(a){return!/[^\\t\\n\\r ]/.test(a)};goog.string.isAlpha=function(a){return!/[^a-zA-Z]/.test(a)};goog.string.isNumeric=function(a){return!/[^0-9]/.test(a)};goog.string.isAlphaNumeric=function(a){return!/[^a-zA-Z0-9]/.test(a)};goog.string.isSpace=function(a){return\" \"==a};goog.string.isUnicodeChar=function(a){return 1==a.length&&\" \"<=a&&\"~\">=a||\"\\u0080\"<=a&&\"\\ufffd\">=a};goog.string.stripNewlines=function(a){return a.replace(/(\\r\\n|\\r|\\n)+/g,\" \")};\ngoog.string.canonicalizeNewlines=function(a){return a.replace(/(\\r\\n|\\r|\\n)/g,\"\\n\")};goog.string.normalizeWhitespace=function(a){return a.replace(/\\xa0|\\s/g,\" \")};goog.string.normalizeSpaces=function(a){return a.replace(/\\xa0|[ \\t]+/g,\" \")};goog.string.collapseBreakingSpaces=function(a){return a.replace(/[\\t\\r\\n ]+/g,\" \").replace(/^[\\t\\r\\n ]+|[\\t\\r\\n ]+$/g,\"\")};goog.string.trim=function(a){return a.replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g,\"\")};\ngoog.string.trimLeft=function(a){return a.replace(/^[\\s\\xa0]+/,\"\")};goog.string.trimRight=function(a){return a.replace(/[\\s\\xa0]+$/,\"\")};goog.string.caseInsensitiveCompare=function(a,d){var e=String(a).toLowerCase(),f=String(d).toLowerCase();return e<f?-1:e==f?0:1};goog.string.numerateCompareRegExp_=/(\\.\\d+)|(\\d+)|(\\D+)/g;\ngoog.string.numerateCompare=function(a,d){if(a==d)return 0;if(!a)return-1;if(!d)return 1;for(var e=a.toLowerCase().match(goog.string.numerateCompareRegExp_),f=d.toLowerCase().match(goog.string.numerateCompareRegExp_),g=Math.min(e.length,f.length),h=0;h<g;h++){var k=e[h],l=f[h];if(k!=l)return e=parseInt(k,10),!isNaN(e)&&(f=parseInt(l,10),!isNaN(f)&&e-f)?e-f:k<l?-1:1}return e.length!=f.length?e.length-f.length:a<d?-1:1};goog.string.urlEncode=function(a){return encodeURIComponent(String(a))};\ngoog.string.urlDecode=function(a){return decodeURIComponent(a.replace(/\\+/g,\" \"))};goog.string.newLineToBr=function(a,d){return a.replace(/(\\r\\n|\\r|\\n)/g,d?\"<br />\":\"<br>\")};\ngoog.string.htmlEscape=function(a,d){if(d)return a.replace(goog.string.amperRe_,\"&amp;\").replace(goog.string.ltRe_,\"&lt;\").replace(goog.string.gtRe_,\"&gt;\").replace(goog.string.quotRe_,\"&quot;\").replace(goog.string.singleQuoteRe_,\"&#39;\");if(!goog.string.allRe_.test(a))return a;-1!=a.indexOf(\"&\")&&(a=a.replace(goog.string.amperRe_,\"&amp;\"));-1!=a.indexOf(\"<\")&&(a=a.replace(goog.string.ltRe_,\"&lt;\"));-1!=a.indexOf(\">\")&&(a=a.replace(goog.string.gtRe_,\"&gt;\"));-1!=a.indexOf('\"')&&(a=a.replace(goog.string.quotRe_,\n\"&quot;\"));-1!=a.indexOf(\"'\")&&(a=a.replace(goog.string.singleQuoteRe_,\"&#39;\"));return a};goog.string.amperRe_=/&/g;goog.string.ltRe_=/</g;goog.string.gtRe_=/>/g;goog.string.quotRe_=/\"/g;goog.string.singleQuoteRe_=/'/g;goog.string.allRe_=/[&<>\"']/;goog.string.unescapeEntities=function(a){return goog.string.contains(a,\"&\")?\"document\"in goog.global?goog.string.unescapeEntitiesUsingDom_(a):goog.string.unescapePureXmlEntities_(a):a};\ngoog.string.unescapeEntitiesWithDocument=function(a,d){return goog.string.contains(a,\"&\")?goog.string.unescapeEntitiesUsingDom_(a,d):a};\ngoog.string.unescapeEntitiesUsingDom_=function(a,d){var e={\"&amp;\":\"&\",\"&lt;\":\"<\",\"&gt;\":\">\",\"&quot;\":'\"'},f;f=d?d.createElement(\"div\"):document.createElement(\"div\");return a.replace(goog.string.HTML_ENTITY_PATTERN_,function(a,d){var k=e[a];if(k)return k;if(\"#\"==d.charAt(0)){var l=Number(\"0\"+d.substr(1));isNaN(l)||(k=String.fromCharCode(l))}k||(f.innerHTML=a+\" \",k=f.firstChild.nodeValue.slice(0,-1));return e[a]=k})};\ngoog.string.unescapePureXmlEntities_=function(a){return a.replace(/&([^;]+);/g,function(a,e){switch(e){case \"amp\":return\"&\";case \"lt\":return\"<\";case \"gt\":return\">\";case \"quot\":return'\"';default:if(\"#\"==e.charAt(0)){var f=Number(\"0\"+e.substr(1));if(!isNaN(f))return String.fromCharCode(f)}return a}})};goog.string.HTML_ENTITY_PATTERN_=/&([^;\\s<&]+);?/g;goog.string.whitespaceEscape=function(a,d){return goog.string.newLineToBr(a.replace(/  /g,\" &#160;\"),d)};\ngoog.string.stripQuotes=function(a,d){for(var e=d.length,f=0;f<e;f++){var g=1==e?d:d.charAt(f);if(a.charAt(0)==g&&a.charAt(a.length-1)==g)return a.substring(1,a.length-1)}return a};goog.string.truncate=function(a,d,e){e&&(a=goog.string.unescapeEntities(a));a.length>d&&(a=a.substring(0,d-3)+\"...\");e&&(a=goog.string.htmlEscape(a));return a};\ngoog.string.truncateMiddle=function(a,d,e,f){e&&(a=goog.string.unescapeEntities(a));if(f&&a.length>d){f>d&&(f=d);var g=a.length-f;a=a.substring(0,d-f)+\"...\"+a.substring(g)}else a.length>d&&(f=Math.floor(d/2),g=a.length-f,a=a.substring(0,f+d%2)+\"...\"+a.substring(g));e&&(a=goog.string.htmlEscape(a));return a};goog.string.specialEscapeChars_={\"\\x00\":\"\\\\0\",\"\\b\":\"\\\\b\",\"\\f\":\"\\\\f\",\"\\n\":\"\\\\n\",\"\\r\":\"\\\\r\",\"\\t\":\"\\\\t\",\"\\x0B\":\"\\\\x0B\",'\"':'\\\\\"',\"\\\\\":\"\\\\\\\\\"};goog.string.jsEscapeCache_={\"'\":\"\\\\'\"};\ngoog.string.quote=function(a){a=String(a);if(a.quote)return a.quote();for(var d=['\"'],e=0;e<a.length;e++){var f=a.charAt(e),g=f.charCodeAt(0);d[e+1]=goog.string.specialEscapeChars_[f]||(31<g&&127>g?f:goog.string.escapeChar(f))}d.push('\"');return d.join(\"\")};goog.string.escapeString=function(a){for(var d=[],e=0;e<a.length;e++)d[e]=goog.string.escapeChar(a.charAt(e));return d.join(\"\")};\ngoog.string.escapeChar=function(a){if(a in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[a];if(a in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[a]=goog.string.specialEscapeChars_[a];var d=a,e=a.charCodeAt(0);if(31<e&&127>e)d=a;else{if(256>e){if(d=\"\\\\x\",16>e||256<e)d+=\"0\"}else d=\"\\\\u\",4096>e&&(d+=\"0\");d+=e.toString(16).toUpperCase()}return goog.string.jsEscapeCache_[a]=d};goog.string.toMap=function(a){for(var d={},e=0;e<a.length;e++)d[a.charAt(e)]=!0;return d};\ngoog.string.contains=function(a,d){return-1!=a.indexOf(d)};goog.string.countOf=function(a,d){return a&&d?a.split(d).length-1:0};goog.string.removeAt=function(a,d,e){var f=a;0<=d&&d<a.length&&0<e&&(f=a.substr(0,d)+a.substr(d+e,a.length-d-e));return f};goog.string.remove=function(a,d){var e=RegExp(goog.string.regExpEscape(d),\"\");return a.replace(e,\"\")};goog.string.removeAll=function(a,d){var e=RegExp(goog.string.regExpEscape(d),\"g\");return a.replace(e,\"\")};\ngoog.string.regExpEscape=function(a){return String(a).replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g,\"\\\\$1\").replace(/\\x08/g,\"\\\\x08\")};goog.string.repeat=function(a,d){return Array(d+1).join(a)};goog.string.padNumber=function(a,d,e){a=goog.isDef(e)?a.toFixed(e):String(a);e=a.indexOf(\".\");-1==e&&(e=a.length);return goog.string.repeat(\"0\",Math.max(0,d-e))+a};goog.string.makeSafe=function(a){return null==a?\"\":String(a)};goog.string.buildString=function(a){return Array.prototype.join.call(arguments,\"\")};\ngoog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)};\ngoog.string.compareVersions=function(a,d){for(var e=0,f=goog.string.trim(String(a)).split(\".\"),g=goog.string.trim(String(d)).split(\".\"),h=Math.max(f.length,g.length),k=0;0==e&&k<h;k++){var l=f[k]||\"\",n=g[k]||\"\",q=RegExp(\"(\\\\d*)(\\\\D*)\",\"g\"),s=RegExp(\"(\\\\d*)(\\\\D*)\",\"g\");do{var m=q.exec(l)||[\"\",\"\",\"\"],p=s.exec(n)||[\"\",\"\",\"\"];if(0==m[0].length&&0==p[0].length)break;var e=0==m[1].length?0:parseInt(m[1],10),r=0==p[1].length?0:parseInt(p[1],10),e=goog.string.compareElements_(e,r)||goog.string.compareElements_(0==\nm[2].length,0==p[2].length)||goog.string.compareElements_(m[2],p[2])}while(0==e)}return e};goog.string.compareElements_=function(a,d){return a<d?-1:a>d?1:0};goog.string.HASHCODE_MAX_=4294967296;goog.string.hashCode=function(a){for(var d=0,e=0;e<a.length;++e)d=31*d+a.charCodeAt(e),d%=goog.string.HASHCODE_MAX_;return d};goog.string.uniqueStringCounter_=2147483648*Math.random()|0;goog.string.createUniqueString=function(){return\"goog_\"+goog.string.uniqueStringCounter_++};\ngoog.string.toNumber=function(a){var d=Number(a);return 0==d&&goog.string.isEmpty(a)?NaN:d};goog.string.isLowerCamelCase=function(a){return/^[a-z]+([A-Z][a-z]*)*$/.test(a)};goog.string.isUpperCamelCase=function(a){return/^([A-Z][a-z]*)+$/.test(a)};goog.string.toCamelCase=function(a){return String(a).replace(/\\-([a-z])/g,function(a,e){return e.toUpperCase()})};goog.string.toSelectorCase=function(a){return String(a).replace(/([A-Z])/g,\"-$1\").toLowerCase()};\ngoog.string.toTitleCase=function(a,d){var e=goog.isString(d)?goog.string.regExpEscape(d):\"\\\\s\";return a.replace(RegExp(\"(^\"+(e?\"|[\"+e+\"]+\":\"\")+\")([a-z])\",\"g\"),function(a,d,e){return d+e.toUpperCase()})};goog.string.parseInt=function(a){isFinite(a)&&(a=String(a));return goog.isString(a)?/^\\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN};goog.string.splitLimit=function(a,d,e){a=a.split(d);for(var f=[];0<e&&a.length;)f.push(a.shift()),e--;a.length&&f.push(a.join(d));return f};var sessionPersistentStorageKey=\"firebaseSession\",hasLocalStorage=fb.simplelogin.util.env.hasLocalStorage();fb.simplelogin.SessionStore_=function(){};fb.simplelogin.SessionStore_.prototype.set=function(a,d){if(hasLocalStorage)try{localStorage.setItem(sessionPersistentStorageKey,fb.simplelogin.util.json.stringify(a))}catch(e){}};fb.simplelogin.SessionStore_.prototype.get=function(){if(hasLocalStorage){try{var a=localStorage.getItem(sessionPersistentStorageKey);if(a)return fb.simplelogin.util.json.parse(a)}catch(d){}return null}};\nfb.simplelogin.SessionStore_.prototype.clear=function(){hasLocalStorage&&localStorage.removeItem(sessionPersistentStorageKey)};fb.simplelogin.SessionStore=new fb.simplelogin.SessionStore_;var CLIENT_VERSION=\"1.6.3\";\nfb.simplelogin.client=function(a,d,e,f){function g(a,d,e){setTimeout(function(){a(d,e)},0)}this.mRef=a;this.mNamespace=fb.simplelogin.util.misc.parseSubdomain(a.toString());this.sessionLengthDays=null;window._FirebaseSimpleLogin=window._FirebaseSimpleLogin||{};window._FirebaseSimpleLogin.callbacks=window._FirebaseSimpleLogin.callbacks||[];window._FirebaseSimpleLogin.callbacks.push({cb:d,ctx:e});\"file:\"!==window.location.protocol||fb.simplelogin.util.env.isPhantomJS()||fb.simplelogin.util.env.isMobileCordovaInAppBrowser()||fb.simplelogin.util.misc.warn(\"FirebaseSimpleLogin(): Due to browser security restrictions, loading applications via `file://*` URLs will prevent popup-based authentication providers from working properly. When testing locally, you'll need to run a barebones webserver on your machine rather than loading your test files via `file://*`. The easiest way to run a barebones server on your local machine is to `cd` to the root directory of your code and run `python -m SimpleHTTPServer`, which will allow you to access your content via `http://127.0.0.1:8000/*`.\");\nf&&fb.simplelogin.Vars.setApiHost(f);this.mLoginStateChange=function(a,d){var e=window._FirebaseSimpleLogin.callbacks||[];Array.prototype.slice.apply(arguments);for(var f=0;f<e.length;f++){var q=e[f],s=!!a||\"undefined\"===typeof q.user;if(!s){var m,p;q.user&&q.user.firebaseAuthToken&&(m=q.user.firebaseAuthToken);d&&d.firebaseAuthToken&&(p=d.firebaseAuthToken);s=(m||p)&&m!==p}window._FirebaseSimpleLogin.callbacks[f].user=d||null;s&&g(goog.bind(q.cb,q.ctx),a,d)}};this.resumeSession()};\nfb.simplelogin.client.prototype.setApiHost=function(a){fb.simplelogin.Vars.setApiHost(a)};goog.exportSymbol(\"fb.simplelogin.client.prototype.setApiHost\",fb.simplelogin.client.prototype.setApiHost);\nfb.simplelogin.client.prototype.resumeSession=function(){var a=this,d;try{d=sessionStorage.getItem(\"firebaseRequestId\"),sessionStorage.removeItem(\"firebaseRequestId\")}catch(e){}if(d){var f=fb.simplelogin.transports.JSONP;fb.simplelogin.transports.XHR.isAvailable()&&(f=fb.simplelogin.transports.XHR);f.open(fb.simplelogin.Vars.getApiHost()+\"/auth/session\",{requestId:d,firebase:a.mNamespace},function(d,e){e&&e.token&&e.user?a.attemptAuth(e.token,e.user,!0):d?(fb.simplelogin.SessionStore.clear(),a.mLoginStateChange(d)):\n(fb.simplelogin.SessionStore.clear(),a.mLoginStateChange(null,null))})}else(d=fb.simplelogin.SessionStore.get())&&d.token&&d.user?a.attemptAuth(d.token,d.user,!1):a.mLoginStateChange(null,null)};\nfb.simplelogin.client.prototype.attemptAuth=function(a,d,e,f,g){var h=this;this.mRef.auth(a,function(k,l){k?(fb.simplelogin.SessionStore.clear(),h.mLoginStateChange(null,null),g&&g()):(e&&fb.simplelogin.SessionStore.set({token:a,user:d,sessionKey:d.sessionKey},h.sessionLengthDays),\"function\"==typeof l&&l(),delete d.sessionKey,d.firebaseAuthToken=a,h.mLoginStateChange(null,d),f&&f(d))},function(a){fb.simplelogin.SessionStore.clear();h.mLoginStateChange(null,null);g&&g()})};\nfb.simplelogin.client.prototype.login=function(){fb.simplelogin.util.validation.validateString(\"FirebaseSimpleLogin.login()\",1,arguments[0],!1);fb.simplelogin.util.validation.validateArgCount(\"FirebaseSimpleLogin.login()\",1,2,arguments.length);var a=arguments[0].toLowerCase(),d=arguments[1]||{};this.sessionLengthDays=d.rememberMe?30:null;switch(a){case \"anonymous\":return this.loginAnonymously(d);case \"facebook-token\":return this.loginWithFacebookToken(d);case \"github\":return this.loginWithGithub(d);\ncase \"google-token\":return this.loginWithGoogleToken(d);case \"password\":return this.loginWithPassword(d);case \"twitter-token\":return this.loginWithTwitterToken(d);case \"facebook\":return d.access_token?this.loginWithFacebookToken(d):this.loginWithFacebook(d);case \"google\":return d.access_token?this.loginWithGoogleToken(d):this.loginWithGoogle(d);case \"twitter\":return d.oauth_token&&d.oauth_token_secret?this.loginWithTwitterToken(d):this.loginWithTwitter(d);default:throw Error(\"FirebaseSimpleLogin.login(\"+\na+\") failed: unrecognized authentication provider\");}};goog.exportSymbol(\"fb.simplelogin.client.prototype.login\",fb.simplelogin.client.prototype.login);\nfb.simplelogin.client.prototype.loginAnonymously=function(a){var d=this;return new fb.simplelogin.util.RSVP.Promise(function(e,f){a.firebase=d.mNamespace;a.v=CLIENT_VERSION;fb.simplelogin.transports.JSONP.open(fb.simplelogin.Vars.getApiHost()+\"/auth/anonymous\",a,function(a,h){if(a||!h.token){var k=fb.simplelogin.Errors.format(a);d.mLoginStateChange(k,null);f(k)}else d.attemptAuth(h.token,h.user,!0,e,f)})})};\nfb.simplelogin.client.prototype.loginWithPassword=function(a){var d=this;return new fb.simplelogin.util.RSVP.Promise(function(e,f){a.firebase=d.mNamespace;a.v=CLIENT_VERSION;fb.simplelogin.providers.Password.login(a,function(a,h){if(a||!h.token){var k=fb.simplelogin.Errors.format(a);d.mLoginStateChange(k,null);f(k)}else d.attemptAuth(h.token,h.user,!0,e,f)})})};fb.simplelogin.client.prototype.loginWithGithub=function(a){a.height=850;a.width=950;return this.loginViaOAuth(\"github\",a)};\nfb.simplelogin.client.prototype.loginWithGoogle=function(a){a.height=650;a.width=575;return this.loginViaOAuth(\"google\",a)};fb.simplelogin.client.prototype.loginWithFacebook=function(a){a.height=400;a.width=535;return this.loginViaOAuth(\"facebook\",a)};fb.simplelogin.client.prototype.loginWithTwitter=function(a){return this.loginViaOAuth(\"twitter\",a)};fb.simplelogin.client.prototype.loginWithFacebookToken=function(a){return this.loginViaToken(\"facebook\",a)};\nfb.simplelogin.client.prototype.loginWithGoogleToken=function(a){return this.loginViaToken(\"google\",a)};fb.simplelogin.client.prototype.loginWithTwitterToken=function(a){return this.loginViaToken(\"twitter\",a)};fb.simplelogin.client.prototype.logout=function(){fb.simplelogin.SessionStore.clear();this.mRef.unauth();this.mLoginStateChange(null,null)};goog.exportSymbol(\"fb.simplelogin.client.prototype.logout\",fb.simplelogin.client.prototype.logout);\nfb.simplelogin.client.prototype.loginViaToken=function(a,d,e){d=d||{};d.v=CLIENT_VERSION;var f=this,g=fb.simplelogin.Vars.getApiHost()+\"/auth/\"+a+\"/token?firebase=\"+f.mNamespace;return new fb.simplelogin.util.RSVP.Promise(function(a,e){fb.simplelogin.transports.JSONP.open(g,d,function(d,g){if(!d&&g.token&&g.user)f.attemptAuth(g.token,g.user,!0,a,e);else{var q=fb.simplelogin.Errors.format(d);f.mLoginStateChange(q);e(q)}})})};\nfb.simplelogin.client.prototype.loginViaOAuth=function(a,d,e){d=d||{};var f=this,g=fb.simplelogin.Vars.getApiHost()+\"/auth/\"+a+\"?firebase=\"+f.mNamespace;d.scope&&(g+=\"&scope=\"+d.scope);g+=\"&v=\"+encodeURIComponent(CLIENT_VERSION);a={menubar:0,location:0,resizable:0,scrollbars:1,status:0,dialog:1,width:700,height:375};d.height&&(a.height=d.height,delete d.height);d.width&&(a.width=d.width,delete d.width);e=fb.simplelogin.util.env.isMobileCordovaInAppBrowser()?\"mobile-phonegap\":fb.simplelogin.util.env.isMobileTriggerIoTab()?\n\"mobile-triggerio\":fb.simplelogin.util.env.isWindowsMetro()?\"windows-metro\":\"desktop\";var h;if(\"desktop\"===e){h=fb.simplelogin.transports.WinChan;e=[];for(var k in a)e.push(k+\"=\"+a[k]);d.url+=\"&transport=winchan\";d.relay_url=fb.simplelogin.Vars.getApiHost()+\"/auth/channel\";d.window_features=e.join(\",\")}else\"mobile-phonegap\"===e?h=fb.simplelogin.transports.CordovaInAppBrowser:\"mobile-triggerio\"===e?h=fb.simplelogin.transports.TriggerIoTab:\"windows-metro\"===e&&(h=fb.simplelogin.transports.WindowsMetroAuthBroker);\nif(d.preferRedirect||fb.simplelogin.util.env.isChromeiOS()||fb.simplelogin.util.env.isWindowsPhone()||fb.simplelogin.util.env.isStandaloneiOS()||fb.simplelogin.util.env.isTwitteriOS()||fb.simplelogin.util.env.isFacebookiOS()){k=goog.string.getRandomString()+goog.string.getRandomString();try{sessionStorage.setItem(\"firebaseRequestId\",k)}catch(l){}g+=\"&requestId=\"+k+\"&fb_redirect_uri=\"+encodeURIComponent(window.location.href);window.location=g}else return new fb.simplelogin.util.RSVP.Promise(function(a,\ne){h.open(g,d,function(d,g){if(g&&g.token&&g.user)f.attemptAuth(g.token,g.user,!0,a,e);else{var h=d||{code:\"UNKNOWN_ERROR\",message:\"An unknown error occurred.\"};\"unknown closed window\"===d?h={code:\"USER_DENIED\",message:\"User cancelled the authentication request.\"}:g&&g.error&&(h=g.error);h=fb.simplelogin.Errors.format(h);f.mLoginStateChange(h);e(h)}})})};\nfb.simplelogin.client.prototype.manageFirebaseUsers=function(a,d,e){d.firebase=this.mNamespace;return new fb.simplelogin.util.RSVP.Promise(function(f,g){fb.simplelogin.providers.Password[a](d,function(a,d){if(a){var l=fb.simplelogin.Errors.format(a);g(l);return e&&e(l,null)}f(d);return e&&e(null,d)})})};fb.simplelogin.client.prototype.createUser=function(a,d,e){return this.manageFirebaseUsers(\"createUser\",{email:a,password:d},e)};goog.exportSymbol(\"fb.simplelogin.client.prototype.createUser\",fb.simplelogin.client.prototype.createUser);\nfb.simplelogin.client.prototype.changePassword=function(a,d,e,f){return this.manageFirebaseUsers(\"changePassword\",{email:a,oldPassword:d,newPassword:e},function(a){return f&&f(a)})};goog.exportSymbol(\"fb.simplelogin.client.prototype.changePassword\",fb.simplelogin.client.prototype.changePassword);fb.simplelogin.client.prototype.removeUser=function(a,d,e){return this.manageFirebaseUsers(\"removeUser\",{email:a,password:d},function(a){return e&&e(a)})};\ngoog.exportSymbol(\"fb.simplelogin.client.prototype.removeUser\",fb.simplelogin.client.prototype.removeUser);fb.simplelogin.client.prototype.sendPasswordResetEmail=function(a,d){return this.manageFirebaseUsers(\"sendPasswordResetEmail\",{email:a},function(a){return d&&d(a)})};goog.exportSymbol(\"fb.simplelogin.client.prototype.sendPasswordResetEmail\",fb.simplelogin.client.prototype.sendPasswordResetEmail);fb.simplelogin.client.onOpen=function(a){fb.simplelogin.transports.WinChan.onOpen(a)};\ngoog.exportSymbol(\"fb.simplelogin.client.onOpen\",fb.simplelogin.client.onOpen);fb.simplelogin.client.VERSION=function(){return CLIENT_VERSION};goog.exportSymbol(\"fb.simplelogin.client.VERSION\",fb.simplelogin.client.VERSION);var FirebaseSimpleLogin=function(a,d,e,f){fb.simplelogin.util.validation.validateArgCount(\"new FirebaseSimpleLogin\",1,4,arguments.length);fb.simplelogin.util.validation.validateCallback(\"new FirebaseSimpleLogin\",2,d,!1);if(goog.isString(a))throw Error(\"new FirebaseSimpleLogin(): Oops, it looks like you passed a string instead of a Firebase reference (i.e. new Firebase(<firebaseURL>)).\");var g=fb.simplelogin.util.misc.parseSubdomain(a.toString());if(!goog.isString(g))throw Error(\"new FirebaseSimpleLogin(): First argument must be a valid Firebase reference (i.e. new Firebase(<firebaseURL>)).\");\nvar h=new fb.simplelogin.client(a,d,e,f);return{setApiHost:function(a){fb.simplelogin.util.validation.validateArgCount(\"FirebaseSimpleLogin.setApiHost\",1,1,arguments.length);return h.setApiHost(a)},login:function(){return h.login.apply(h,arguments)},logout:function(){fb.simplelogin.util.validation.validateArgCount(\"FirebaseSimpleLogin.logout\",0,0,arguments.length);return h.logout()},createUser:function(a,d,e){fb.simplelogin.util.validation.validateArgCount(\"FirebaseSimpleLogin.createUser\",2,3,arguments.length);\nfb.simplelogin.util.validation.validateCallback(\"FirebaseSimpleLogin.createUser\",3,e,!0);return h.createUser(a,d,e)},changePassword:function(a,d,e,f){fb.simplelogin.util.validation.validateArgCount(\"FirebaseSimpleLogin.changePassword\",3,4,arguments.length);fb.simplelogin.util.validation.validateCallback(\"FirebaseSimpleLogin.changePassword\",4,f,!0);return h.changePassword(a,d,e,f)},removeUser:function(a,d,e){fb.simplelogin.util.validation.validateArgCount(\"FirebaseSimpleLogin.removeUser\",2,3,arguments.length);\nfb.simplelogin.util.validation.validateCallback(\"FirebaseSimpleLogin.removeUser\",3,e,!0);return h.removeUser(a,d,e)},sendPasswordResetEmail:function(a,d){fb.simplelogin.util.validation.validateArgCount(\"FirebaseSimpleLogin.sendPasswordResetEmail\",1,2,arguments.length);fb.simplelogin.util.validation.validateCallback(\"FirebaseSimpleLogin.sendPasswordResetEmail\",2,d,!0);return h.sendPasswordResetEmail(a,d)}}};goog.exportSymbol(\"FirebaseSimpleLogin\",FirebaseSimpleLogin);FirebaseSimpleLogin.onOpen=function(a){fb.simplelogin.client.onOpen(a)};\ngoog.exportProperty(FirebaseSimpleLogin,\"onOpen\",FirebaseSimpleLogin.onOpen);FirebaseSimpleLogin.VERSION=fb.simplelogin.client.VERSION();})();\n"
  },
  {
    "path": "www/lib/ionic/.bower.json",
    "content": "{\n  \"name\": \"ionic\",\n  \"version\": \"1.0.0-beta.12\",\n  \"codename\": \"krypton-koala\",\n  \"homepage\": \"https://github.com/driftyco/ionic\",\n  \"authors\": [\n    \"Max Lynch <max@drifty.com>\",\n    \"Adam Bradley <adam@drifty.com>\",\n    \"Ben Sperry <ben@drifty.com>\"\n  ],\n  \"description\": \"Advanced HTML5 hybrid mobile app development framework.\",\n  \"main\": [\n    \"css/ionic.css\",\n    \"fonts/*\",\n    \"js/ionic.js\",\n    \"js/ionic-angular.js\"\n  ],\n  \"keywords\": [\n    \"mobile\",\n    \"html5\",\n    \"ionic\",\n    \"cordova\",\n    \"phonegap\",\n    \"trigger\",\n    \"triggerio\",\n    \"angularjs\",\n    \"angular\"\n  ],\n  \"license\": \"MIT\",\n  \"private\": false,\n  \"dependencies\": {\n    \"angular\": \"~1.2.17\",\n    \"angular-animate\": \"~1.2.17\",\n    \"angular-sanitize\": \"~1.2.17\",\n    \"angular-ui-router\": \"0.2.10\",\n    \"collide\": \"1.0.0-beta.1\"\n  },\n  \"_release\": \"1.0.0-beta.12\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.0.0-beta.12\",\n    \"commit\": \"e1fee0fbab52f6137c1d3da74a94d56e19fbaa6f\"\n  },\n  \"_source\": \"git://github.com/driftyco/ionic-bower.git\",\n  \"_target\": \"1.0.0-beta.12\",\n  \"_originalSource\": \"driftyco/ionic-bower\"\n}"
  },
  {
    "path": "www/lib/ionic/README.md",
    "content": "# ionic-bower\n\nBower repository for [Ionic Framework](http://github.com/driftyco/ionic)\n\n### Usage\n\nInclude `js/ionic.bundle.js` to get ionic and all of its dependencies.\n\nAlternatively, include the individual ionic files with the dependencies separately.\n\n### Versions\n\nTo install the latest stable version, `bower install driftyco/ionic-bower`\n\nTo install the latest nightly release, `bower install driftyco/ionic-bower#master`\n"
  },
  {
    "path": "www/lib/ionic/bower.json",
    "content": "{\n  \"name\": \"ionic\",\n  \"version\": \"1.0.0-beta.12\",\n  \"codename\": \"krypton-koala\",\n  \"homepage\": \"https://github.com/driftyco/ionic\",\n  \"authors\": [\n    \"Max Lynch <max@drifty.com>\",\n    \"Adam Bradley <adam@drifty.com>\",\n    \"Ben Sperry <ben@drifty.com>\"\n  ],\n  \"description\": \"Advanced HTML5 hybrid mobile app development framework.\",\n  \"main\": [\n    \"css/ionic.css\",\n    \"fonts/*\",\n    \"js/ionic.js\",\n    \"js/ionic-angular.js\"\n  ],\n  \"keywords\": [\n    \"mobile\",\n    \"html5\",\n    \"ionic\",\n    \"cordova\",\n    \"phonegap\",\n    \"trigger\",\n    \"triggerio\",\n    \"angularjs\",\n    \"angular\"\n  ],\n  \"license\": \"MIT\",\n  \"private\": false,\n  \"dependencies\": {\n    \"angular\": \"~1.2.17\",\n    \"angular-animate\": \"~1.2.17\",\n    \"angular-sanitize\": \"~1.2.17\",\n    \"angular-ui-router\": \"0.2.10\",\n    \"collide\": \"1.0.0-beta.1\"\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/css/ionic.css",
    "content": "/*!\n * Copyright 2014 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.0.0-beta.12\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n/*!\n  Ionicons, v1.5.2\n  Created by Ben Sperry for the Ionic Framework, http://ionicons.com/\n  https://twitter.com/benjsperry  https://twitter.com/ionicframework\n  MIT License: https://github.com/driftyco/ionicons\n*/\n@font-face {\n  font-family: \"Ionicons\";\n  src: url(\"../fonts/ionicons.eot?v=1.5.2\");\n  src: url(\"../fonts/ionicons.eot?v=1.5.2#iefix\") format(\"embedded-opentype\"), url(\"../fonts/ionicons.ttf?v=1.5.2\") format(\"truetype\"), url(\"../fonts/ionicons.woff?v=1.5.2\") format(\"woff\"), url(\"../fonts/ionicons.svg?v=1.5.2#Ionicons\") format(\"svg\");\n  font-weight: normal;\n  font-style: normal; }\n\n.ion, .ion-loading-a, .ion-loading-b, .ion-loading-c, .ion-loading-d, .ion-looping, .ion-refreshing, .ion-ios7-reloading, .ionicons, .ion-alert:before, .ion-alert-circled:before, .ion-android-add:before, .ion-android-add-contact:before, .ion-android-alarm:before, .ion-android-archive:before, .ion-android-arrow-back:before, .ion-android-arrow-down-left:before, .ion-android-arrow-down-right:before, .ion-android-arrow-forward:before, .ion-android-arrow-up-left:before, .ion-android-arrow-up-right:before, .ion-android-battery:before, .ion-android-book:before, .ion-android-calendar:before, .ion-android-call:before, .ion-android-camera:before, .ion-android-chat:before, .ion-android-checkmark:before, .ion-android-clock:before, .ion-android-close:before, .ion-android-contact:before, .ion-android-contacts:before, .ion-android-data:before, .ion-android-developer:before, .ion-android-display:before, .ion-android-download:before, .ion-android-drawer:before, .ion-android-dropdown:before, .ion-android-earth:before, .ion-android-folder:before, .ion-android-forums:before, .ion-android-friends:before, .ion-android-hand:before, .ion-android-image:before, .ion-android-inbox:before, .ion-android-information:before, .ion-android-keypad:before, .ion-android-lightbulb:before, .ion-android-locate:before, .ion-android-location:before, .ion-android-mail:before, .ion-android-microphone:before, .ion-android-mixer:before, .ion-android-more:before, .ion-android-note:before, .ion-android-playstore:before, .ion-android-printer:before, .ion-android-promotion:before, .ion-android-reminder:before, .ion-android-remove:before, .ion-android-search:before, .ion-android-send:before, .ion-android-settings:before, .ion-android-share:before, .ion-android-social:before, .ion-android-social-user:before, .ion-android-sort:before, .ion-android-stair-drawer:before, .ion-android-star:before, .ion-android-stopwatch:before, .ion-android-storage:before, .ion-android-system-back:before, .ion-android-system-home:before, .ion-android-system-windows:before, .ion-android-timer:before, .ion-android-trash:before, .ion-android-user-menu:before, .ion-android-volume:before, .ion-android-wifi:before, .ion-aperture:before, .ion-archive:before, .ion-arrow-down-a:before, .ion-arrow-down-b:before, .ion-arrow-down-c:before, .ion-arrow-expand:before, .ion-arrow-graph-down-left:before, .ion-arrow-graph-down-right:before, .ion-arrow-graph-up-left:before, .ion-arrow-graph-up-right:before, .ion-arrow-left-a:before, .ion-arrow-left-b:before, .ion-arrow-left-c:before, .ion-arrow-move:before, .ion-arrow-resize:before, .ion-arrow-return-left:before, .ion-arrow-return-right:before, .ion-arrow-right-a:before, .ion-arrow-right-b:before, .ion-arrow-right-c:before, .ion-arrow-shrink:before, .ion-arrow-swap:before, .ion-arrow-up-a:before, .ion-arrow-up-b:before, .ion-arrow-up-c:before, .ion-asterisk:before, .ion-at:before, .ion-bag:before, .ion-battery-charging:before, .ion-battery-empty:before, .ion-battery-full:before, .ion-battery-half:before, .ion-battery-low:before, .ion-beaker:before, .ion-beer:before, .ion-bluetooth:before, .ion-bonfire:before, .ion-bookmark:before, .ion-briefcase:before, .ion-bug:before, .ion-calculator:before, .ion-calendar:before, .ion-camera:before, .ion-card:before, .ion-cash:before, .ion-chatbox:before, .ion-chatbox-working:before, .ion-chatboxes:before, .ion-chatbubble:before, .ion-chatbubble-working:before, .ion-chatbubbles:before, .ion-checkmark:before, .ion-checkmark-circled:before, .ion-checkmark-round:before, .ion-chevron-down:before, .ion-chevron-left:before, .ion-chevron-right:before, .ion-chevron-up:before, .ion-clipboard:before, .ion-clock:before, .ion-close:before, .ion-close-circled:before, .ion-close-round:before, .ion-closed-captioning:before, .ion-cloud:before, .ion-code:before, .ion-code-download:before, .ion-code-working:before, .ion-coffee:before, .ion-compass:before, .ion-compose:before, .ion-connection-bars:before, .ion-contrast:before, .ion-cube:before, .ion-disc:before, .ion-document:before, .ion-document-text:before, .ion-drag:before, .ion-earth:before, .ion-edit:before, .ion-egg:before, .ion-eject:before, .ion-email:before, .ion-eye:before, .ion-eye-disabled:before, .ion-female:before, .ion-filing:before, .ion-film-marker:before, .ion-fireball:before, .ion-flag:before, .ion-flame:before, .ion-flash:before, .ion-flash-off:before, .ion-flask:before, .ion-folder:before, .ion-fork:before, .ion-fork-repo:before, .ion-forward:before, .ion-funnel:before, .ion-game-controller-a:before, .ion-game-controller-b:before, .ion-gear-a:before, .ion-gear-b:before, .ion-grid:before, .ion-hammer:before, .ion-happy:before, .ion-headphone:before, .ion-heart:before, .ion-heart-broken:before, .ion-help:before, .ion-help-buoy:before, .ion-help-circled:before, .ion-home:before, .ion-icecream:before, .ion-icon-social-google-plus:before, .ion-icon-social-google-plus-outline:before, .ion-image:before, .ion-images:before, .ion-information:before, .ion-information-circled:before, .ion-ionic:before, .ion-ios7-alarm:before, .ion-ios7-alarm-outline:before, .ion-ios7-albums:before, .ion-ios7-albums-outline:before, .ion-ios7-americanfootball:before, .ion-ios7-americanfootball-outline:before, .ion-ios7-analytics:before, .ion-ios7-analytics-outline:before, .ion-ios7-arrow-back:before, .ion-ios7-arrow-down:before, .ion-ios7-arrow-forward:before, .ion-ios7-arrow-left:before, .ion-ios7-arrow-right:before, .ion-ios7-arrow-thin-down:before, .ion-ios7-arrow-thin-left:before, .ion-ios7-arrow-thin-right:before, .ion-ios7-arrow-thin-up:before, .ion-ios7-arrow-up:before, .ion-ios7-at:before, .ion-ios7-at-outline:before, .ion-ios7-barcode:before, .ion-ios7-barcode-outline:before, .ion-ios7-baseball:before, .ion-ios7-baseball-outline:before, .ion-ios7-basketball:before, .ion-ios7-basketball-outline:before, .ion-ios7-bell:before, .ion-ios7-bell-outline:before, .ion-ios7-bolt:before, .ion-ios7-bolt-outline:before, .ion-ios7-bookmarks:before, .ion-ios7-bookmarks-outline:before, .ion-ios7-box:before, .ion-ios7-box-outline:before, .ion-ios7-briefcase:before, .ion-ios7-briefcase-outline:before, .ion-ios7-browsers:before, .ion-ios7-browsers-outline:before, .ion-ios7-calculator:before, .ion-ios7-calculator-outline:before, .ion-ios7-calendar:before, .ion-ios7-calendar-outline:before, .ion-ios7-camera:before, .ion-ios7-camera-outline:before, .ion-ios7-cart:before, .ion-ios7-cart-outline:before, .ion-ios7-chatboxes:before, .ion-ios7-chatboxes-outline:before, .ion-ios7-chatbubble:before, .ion-ios7-chatbubble-outline:before, .ion-ios7-checkmark:before, .ion-ios7-checkmark-empty:before, .ion-ios7-checkmark-outline:before, .ion-ios7-circle-filled:before, .ion-ios7-circle-outline:before, .ion-ios7-clock:before, .ion-ios7-clock-outline:before, .ion-ios7-close:before, .ion-ios7-close-empty:before, .ion-ios7-close-outline:before, .ion-ios7-cloud:before, .ion-ios7-cloud-download:before, .ion-ios7-cloud-download-outline:before, .ion-ios7-cloud-outline:before, .ion-ios7-cloud-upload:before, .ion-ios7-cloud-upload-outline:before, .ion-ios7-cloudy:before, .ion-ios7-cloudy-night:before, .ion-ios7-cloudy-night-outline:before, .ion-ios7-cloudy-outline:before, .ion-ios7-cog:before, .ion-ios7-cog-outline:before, .ion-ios7-compose:before, .ion-ios7-compose-outline:before, .ion-ios7-contact:before, .ion-ios7-contact-outline:before, .ion-ios7-copy:before, .ion-ios7-copy-outline:before, .ion-ios7-download:before, .ion-ios7-download-outline:before, .ion-ios7-drag:before, .ion-ios7-email:before, .ion-ios7-email-outline:before, .ion-ios7-expand:before, .ion-ios7-eye:before, .ion-ios7-eye-outline:before, .ion-ios7-fastforward:before, .ion-ios7-fastforward-outline:before, .ion-ios7-filing:before, .ion-ios7-filing-outline:before, .ion-ios7-film:before, .ion-ios7-film-outline:before, .ion-ios7-flag:before, .ion-ios7-flag-outline:before, .ion-ios7-folder:before, .ion-ios7-folder-outline:before, .ion-ios7-football:before, .ion-ios7-football-outline:before, .ion-ios7-gear:before, .ion-ios7-gear-outline:before, .ion-ios7-glasses:before, .ion-ios7-glasses-outline:before, .ion-ios7-heart:before, .ion-ios7-heart-outline:before, .ion-ios7-help:before, .ion-ios7-help-empty:before, .ion-ios7-help-outline:before, .ion-ios7-home:before, .ion-ios7-home-outline:before, .ion-ios7-infinite:before, .ion-ios7-infinite-outline:before, .ion-ios7-information:before, .ion-ios7-information-empty:before, .ion-ios7-information-outline:before, .ion-ios7-ionic-outline:before, .ion-ios7-keypad:before, .ion-ios7-keypad-outline:before, .ion-ios7-lightbulb:before, .ion-ios7-lightbulb-outline:before, .ion-ios7-location:before, .ion-ios7-location-outline:before, .ion-ios7-locked:before, .ion-ios7-locked-outline:before, .ion-ios7-loop:before, .ion-ios7-loop-strong:before, .ion-ios7-medkit:before, .ion-ios7-medkit-outline:before, .ion-ios7-mic:before, .ion-ios7-mic-off:before, .ion-ios7-mic-outline:before, .ion-ios7-minus:before, .ion-ios7-minus-empty:before, .ion-ios7-minus-outline:before, .ion-ios7-monitor:before, .ion-ios7-monitor-outline:before, .ion-ios7-moon:before, .ion-ios7-moon-outline:before, .ion-ios7-more:before, .ion-ios7-more-outline:before, .ion-ios7-musical-note:before, .ion-ios7-musical-notes:before, .ion-ios7-navigate:before, .ion-ios7-navigate-outline:before, .ion-ios7-paper:before, .ion-ios7-paper-outline:before, .ion-ios7-paperplane:before, .ion-ios7-paperplane-outline:before, .ion-ios7-partlysunny:before, .ion-ios7-partlysunny-outline:before, .ion-ios7-pause:before, .ion-ios7-pause-outline:before, .ion-ios7-paw:before, .ion-ios7-paw-outline:before, .ion-ios7-people:before, .ion-ios7-people-outline:before, .ion-ios7-person:before, .ion-ios7-person-outline:before, .ion-ios7-personadd:before, .ion-ios7-personadd-outline:before, .ion-ios7-photos:before, .ion-ios7-photos-outline:before, .ion-ios7-pie:before, .ion-ios7-pie-outline:before, .ion-ios7-play:before, .ion-ios7-play-outline:before, .ion-ios7-plus:before, .ion-ios7-plus-empty:before, .ion-ios7-plus-outline:before, .ion-ios7-pricetag:before, .ion-ios7-pricetag-outline:before, .ion-ios7-pricetags:before, .ion-ios7-pricetags-outline:before, .ion-ios7-printer:before, .ion-ios7-printer-outline:before, .ion-ios7-pulse:before, .ion-ios7-pulse-strong:before, .ion-ios7-rainy:before, .ion-ios7-rainy-outline:before, .ion-ios7-recording:before, .ion-ios7-recording-outline:before, .ion-ios7-redo:before, .ion-ios7-redo-outline:before, .ion-ios7-refresh:before, .ion-ios7-refresh-empty:before, .ion-ios7-refresh-outline:before, .ion-ios7-reload:before, .ion-ios7-reloading:before, .ion-ios7-reverse-camera:before, .ion-ios7-reverse-camera-outline:before, .ion-ios7-rewind:before, .ion-ios7-rewind-outline:before, .ion-ios7-search:before, .ion-ios7-search-strong:before, .ion-ios7-settings:before, .ion-ios7-settings-strong:before, .ion-ios7-shrink:before, .ion-ios7-skipbackward:before, .ion-ios7-skipbackward-outline:before, .ion-ios7-skipforward:before, .ion-ios7-skipforward-outline:before, .ion-ios7-snowy:before, .ion-ios7-speedometer:before, .ion-ios7-speedometer-outline:before, .ion-ios7-star:before, .ion-ios7-star-half:before, .ion-ios7-star-outline:before, .ion-ios7-stopwatch:before, .ion-ios7-stopwatch-outline:before, .ion-ios7-sunny:before, .ion-ios7-sunny-outline:before, .ion-ios7-telephone:before, .ion-ios7-telephone-outline:before, .ion-ios7-tennisball:before, .ion-ios7-tennisball-outline:before, .ion-ios7-thunderstorm:before, .ion-ios7-thunderstorm-outline:before, .ion-ios7-time:before, .ion-ios7-time-outline:before, .ion-ios7-timer:before, .ion-ios7-timer-outline:before, .ion-ios7-toggle:before, .ion-ios7-toggle-outline:before, .ion-ios7-trash:before, .ion-ios7-trash-outline:before, .ion-ios7-undo:before, .ion-ios7-undo-outline:before, .ion-ios7-unlocked:before, .ion-ios7-unlocked-outline:before, .ion-ios7-upload:before, .ion-ios7-upload-outline:before, .ion-ios7-videocam:before, .ion-ios7-videocam-outline:before, .ion-ios7-volume-high:before, .ion-ios7-volume-low:before, .ion-ios7-wineglass:before, .ion-ios7-wineglass-outline:before, .ion-ios7-world:before, .ion-ios7-world-outline:before, .ion-ipad:before, .ion-iphone:before, .ion-ipod:before, .ion-jet:before, .ion-key:before, .ion-knife:before, .ion-laptop:before, .ion-leaf:before, .ion-levels:before, .ion-lightbulb:before, .ion-link:before, .ion-load-a:before, .ion-loading-a:before, .ion-load-b:before, .ion-loading-b:before, .ion-load-c:before, .ion-loading-c:before, .ion-load-d:before, .ion-loading-d:before, .ion-location:before, .ion-locked:before, .ion-log-in:before, .ion-log-out:before, .ion-loop:before, .ion-looping:before, .ion-magnet:before, .ion-male:before, .ion-man:before, .ion-map:before, .ion-medkit:before, .ion-merge:before, .ion-mic-a:before, .ion-mic-b:before, .ion-mic-c:before, .ion-minus:before, .ion-minus-circled:before, .ion-minus-round:before, .ion-model-s:before, .ion-monitor:before, .ion-more:before, .ion-mouse:before, .ion-music-note:before, .ion-navicon:before, .ion-navicon-round:before, .ion-navigate:before, .ion-network:before, .ion-no-smoking:before, .ion-nuclear:before, .ion-outlet:before, .ion-paper-airplane:before, .ion-paperclip:before, .ion-pause:before, .ion-person:before, .ion-person-add:before, .ion-person-stalker:before, .ion-pie-graph:before, .ion-pin:before, .ion-pinpoint:before, .ion-pizza:before, .ion-plane:before, .ion-planet:before, .ion-play:before, .ion-playstation:before, .ion-plus:before, .ion-plus-circled:before, .ion-plus-round:before, .ion-podium:before, .ion-pound:before, .ion-power:before, .ion-pricetag:before, .ion-pricetags:before, .ion-printer:before, .ion-pull-request:before, .ion-qr-scanner:before, .ion-quote:before, .ion-radio-waves:before, .ion-record:before, .ion-refresh:before, .ion-refreshing:before, .ion-reply:before, .ion-reply-all:before, .ion-ribbon-a:before, .ion-ribbon-b:before, .ion-sad:before, .ion-scissors:before, .ion-search:before, .ion-settings:before, .ion-share:before, .ion-shuffle:before, .ion-skip-backward:before, .ion-skip-forward:before, .ion-social-android:before, .ion-social-android-outline:before, .ion-social-apple:before, .ion-social-apple-outline:before, .ion-social-bitcoin:before, .ion-social-bitcoin-outline:before, .ion-social-buffer:before, .ion-social-buffer-outline:before, .ion-social-designernews:before, .ion-social-designernews-outline:before, .ion-social-dribbble:before, .ion-social-dribbble-outline:before, .ion-social-dropbox:before, .ion-social-dropbox-outline:before, .ion-social-facebook:before, .ion-social-facebook-outline:before, .ion-social-foursquare:before, .ion-social-foursquare-outline:before, .ion-social-freebsd-devil:before, .ion-social-github:before, .ion-social-github-outline:before, .ion-social-google:before, .ion-social-google-outline:before, .ion-social-googleplus:before, .ion-social-googleplus-outline:before, .ion-social-hackernews:before, .ion-social-hackernews-outline:before, .ion-social-instagram:before, .ion-social-instagram-outline:before, .ion-social-linkedin:before, .ion-social-linkedin-outline:before, .ion-social-pinterest:before, .ion-social-pinterest-outline:before, .ion-social-reddit:before, .ion-social-reddit-outline:before, .ion-social-rss:before, .ion-social-rss-outline:before, .ion-social-skype:before, .ion-social-skype-outline:before, .ion-social-tumblr:before, .ion-social-tumblr-outline:before, .ion-social-tux:before, .ion-social-twitter:before, .ion-social-twitter-outline:before, .ion-social-usd:before, .ion-social-usd-outline:before, .ion-social-vimeo:before, .ion-social-vimeo-outline:before, .ion-social-windows:before, .ion-social-windows-outline:before, .ion-social-wordpress:before, .ion-social-wordpress-outline:before, .ion-social-yahoo:before, .ion-social-yahoo-outline:before, .ion-social-youtube:before, .ion-social-youtube-outline:before, .ion-speakerphone:before, .ion-speedometer:before, .ion-spoon:before, .ion-star:before, .ion-stats-bars:before, .ion-steam:before, .ion-stop:before, .ion-thermometer:before, .ion-thumbsdown:before, .ion-thumbsup:before, .ion-toggle:before, .ion-toggle-filled:before, .ion-trash-a:before, .ion-trash-b:before, .ion-trophy:before, .ion-umbrella:before, .ion-university:before, .ion-unlocked:before, .ion-upload:before, .ion-usb:before, .ion-videocamera:before, .ion-volume-high:before, .ion-volume-low:before, .ion-volume-medium:before, .ion-volume-mute:before, .ion-wand:before, .ion-waterdrop:before, .ion-wifi:before, .ion-wineglass:before, .ion-woman:before, .ion-wrench:before, .ion-xbox:before {\n  display: inline-block;\n  font-family: \"Ionicons\";\n  speak: none;\n  font-style: normal;\n  font-weight: normal;\n  font-variant: normal;\n  text-transform: none;\n  text-rendering: auto;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale; }\n\n.ion-spin, .ion-loading-a, .ion-loading-b, .ion-loading-c, .ion-loading-d, .ion-looping, .ion-refreshing, .ion-ios7-reloading {\n  -webkit-animation: spin 1s infinite linear;\n  -moz-animation: spin 1s infinite linear;\n  -o-animation: spin 1s infinite linear;\n  animation: spin 1s infinite linear; }\n\n@-moz-keyframes spin {\n  0% {\n    -moz-transform: rotate(0deg); }\n\n  100% {\n    -moz-transform: rotate(359deg); } }\n\n@-webkit-keyframes spin {\n  0% {\n    -webkit-transform: rotate(0deg); }\n\n  100% {\n    -webkit-transform: rotate(359deg); } }\n\n@-o-keyframes spin {\n  0% {\n    -o-transform: rotate(0deg); }\n\n  100% {\n    -o-transform: rotate(359deg); } }\n\n@-ms-keyframes spin {\n  0% {\n    -ms-transform: rotate(0deg); }\n\n  100% {\n    -ms-transform: rotate(359deg); } }\n\n@keyframes spin {\n  0% {\n    transform: rotate(0deg); }\n\n  100% {\n    transform: rotate(359deg); } }\n\n.ion-loading-a {\n  -webkit-animation-timing-function: steps(8, start);\n  -moz-animation-timing-function: steps(8, start);\n  animation-timing-function: steps(8, start); }\n\n.ion-alert:before {\n  content: \"\\f101\"; }\n\n.ion-alert-circled:before {\n  content: \"\\f100\"; }\n\n.ion-android-add:before {\n  content: \"\\f2c7\"; }\n\n.ion-android-add-contact:before {\n  content: \"\\f2c6\"; }\n\n.ion-android-alarm:before {\n  content: \"\\f2c8\"; }\n\n.ion-android-archive:before {\n  content: \"\\f2c9\"; }\n\n.ion-android-arrow-back:before {\n  content: \"\\f2ca\"; }\n\n.ion-android-arrow-down-left:before {\n  content: \"\\f2cb\"; }\n\n.ion-android-arrow-down-right:before {\n  content: \"\\f2cc\"; }\n\n.ion-android-arrow-forward:before {\n  content: \"\\f30f\"; }\n\n.ion-android-arrow-up-left:before {\n  content: \"\\f2cd\"; }\n\n.ion-android-arrow-up-right:before {\n  content: \"\\f2ce\"; }\n\n.ion-android-battery:before {\n  content: \"\\f2cf\"; }\n\n.ion-android-book:before {\n  content: \"\\f2d0\"; }\n\n.ion-android-calendar:before {\n  content: \"\\f2d1\"; }\n\n.ion-android-call:before {\n  content: \"\\f2d2\"; }\n\n.ion-android-camera:before {\n  content: \"\\f2d3\"; }\n\n.ion-android-chat:before {\n  content: \"\\f2d4\"; }\n\n.ion-android-checkmark:before {\n  content: \"\\f2d5\"; }\n\n.ion-android-clock:before {\n  content: \"\\f2d6\"; }\n\n.ion-android-close:before {\n  content: \"\\f2d7\"; }\n\n.ion-android-contact:before {\n  content: \"\\f2d8\"; }\n\n.ion-android-contacts:before {\n  content: \"\\f2d9\"; }\n\n.ion-android-data:before {\n  content: \"\\f2da\"; }\n\n.ion-android-developer:before {\n  content: \"\\f2db\"; }\n\n.ion-android-display:before {\n  content: \"\\f2dc\"; }\n\n.ion-android-download:before {\n  content: \"\\f2dd\"; }\n\n.ion-android-drawer:before {\n  content: \"\\f310\"; }\n\n.ion-android-dropdown:before {\n  content: \"\\f2de\"; }\n\n.ion-android-earth:before {\n  content: \"\\f2df\"; }\n\n.ion-android-folder:before {\n  content: \"\\f2e0\"; }\n\n.ion-android-forums:before {\n  content: \"\\f2e1\"; }\n\n.ion-android-friends:before {\n  content: \"\\f2e2\"; }\n\n.ion-android-hand:before {\n  content: \"\\f2e3\"; }\n\n.ion-android-image:before {\n  content: \"\\f2e4\"; }\n\n.ion-android-inbox:before {\n  content: \"\\f2e5\"; }\n\n.ion-android-information:before {\n  content: \"\\f2e6\"; }\n\n.ion-android-keypad:before {\n  content: \"\\f2e7\"; }\n\n.ion-android-lightbulb:before {\n  content: \"\\f2e8\"; }\n\n.ion-android-locate:before {\n  content: \"\\f2e9\"; }\n\n.ion-android-location:before {\n  content: \"\\f2ea\"; }\n\n.ion-android-mail:before {\n  content: \"\\f2eb\"; }\n\n.ion-android-microphone:before {\n  content: \"\\f2ec\"; }\n\n.ion-android-mixer:before {\n  content: \"\\f2ed\"; }\n\n.ion-android-more:before {\n  content: \"\\f2ee\"; }\n\n.ion-android-note:before {\n  content: \"\\f2ef\"; }\n\n.ion-android-playstore:before {\n  content: \"\\f2f0\"; }\n\n.ion-android-printer:before {\n  content: \"\\f2f1\"; }\n\n.ion-android-promotion:before {\n  content: \"\\f2f2\"; }\n\n.ion-android-reminder:before {\n  content: \"\\f2f3\"; }\n\n.ion-android-remove:before {\n  content: \"\\f2f4\"; }\n\n.ion-android-search:before {\n  content: \"\\f2f5\"; }\n\n.ion-android-send:before {\n  content: \"\\f2f6\"; }\n\n.ion-android-settings:before {\n  content: \"\\f2f7\"; }\n\n.ion-android-share:before {\n  content: \"\\f2f8\"; }\n\n.ion-android-social:before {\n  content: \"\\f2fa\"; }\n\n.ion-android-social-user:before {\n  content: \"\\f2f9\"; }\n\n.ion-android-sort:before {\n  content: \"\\f2fb\"; }\n\n.ion-android-stair-drawer:before {\n  content: \"\\f311\"; }\n\n.ion-android-star:before {\n  content: \"\\f2fc\"; }\n\n.ion-android-stopwatch:before {\n  content: \"\\f2fd\"; }\n\n.ion-android-storage:before {\n  content: \"\\f2fe\"; }\n\n.ion-android-system-back:before {\n  content: \"\\f2ff\"; }\n\n.ion-android-system-home:before {\n  content: \"\\f300\"; }\n\n.ion-android-system-windows:before {\n  content: \"\\f301\"; }\n\n.ion-android-timer:before {\n  content: \"\\f302\"; }\n\n.ion-android-trash:before {\n  content: \"\\f303\"; }\n\n.ion-android-user-menu:before {\n  content: \"\\f312\"; }\n\n.ion-android-volume:before {\n  content: \"\\f304\"; }\n\n.ion-android-wifi:before {\n  content: \"\\f305\"; }\n\n.ion-aperture:before {\n  content: \"\\f313\"; }\n\n.ion-archive:before {\n  content: \"\\f102\"; }\n\n.ion-arrow-down-a:before {\n  content: \"\\f103\"; }\n\n.ion-arrow-down-b:before {\n  content: \"\\f104\"; }\n\n.ion-arrow-down-c:before {\n  content: \"\\f105\"; }\n\n.ion-arrow-expand:before {\n  content: \"\\f25e\"; }\n\n.ion-arrow-graph-down-left:before {\n  content: \"\\f25f\"; }\n\n.ion-arrow-graph-down-right:before {\n  content: \"\\f260\"; }\n\n.ion-arrow-graph-up-left:before {\n  content: \"\\f261\"; }\n\n.ion-arrow-graph-up-right:before {\n  content: \"\\f262\"; }\n\n.ion-arrow-left-a:before {\n  content: \"\\f106\"; }\n\n.ion-arrow-left-b:before {\n  content: \"\\f107\"; }\n\n.ion-arrow-left-c:before {\n  content: \"\\f108\"; }\n\n.ion-arrow-move:before {\n  content: \"\\f263\"; }\n\n.ion-arrow-resize:before {\n  content: \"\\f264\"; }\n\n.ion-arrow-return-left:before {\n  content: \"\\f265\"; }\n\n.ion-arrow-return-right:before {\n  content: \"\\f266\"; }\n\n.ion-arrow-right-a:before {\n  content: \"\\f109\"; }\n\n.ion-arrow-right-b:before {\n  content: \"\\f10a\"; }\n\n.ion-arrow-right-c:before {\n  content: \"\\f10b\"; }\n\n.ion-arrow-shrink:before {\n  content: \"\\f267\"; }\n\n.ion-arrow-swap:before {\n  content: \"\\f268\"; }\n\n.ion-arrow-up-a:before {\n  content: \"\\f10c\"; }\n\n.ion-arrow-up-b:before {\n  content: \"\\f10d\"; }\n\n.ion-arrow-up-c:before {\n  content: \"\\f10e\"; }\n\n.ion-asterisk:before {\n  content: \"\\f314\"; }\n\n.ion-at:before {\n  content: \"\\f10f\"; }\n\n.ion-bag:before {\n  content: \"\\f110\"; }\n\n.ion-battery-charging:before {\n  content: \"\\f111\"; }\n\n.ion-battery-empty:before {\n  content: \"\\f112\"; }\n\n.ion-battery-full:before {\n  content: \"\\f113\"; }\n\n.ion-battery-half:before {\n  content: \"\\f114\"; }\n\n.ion-battery-low:before {\n  content: \"\\f115\"; }\n\n.ion-beaker:before {\n  content: \"\\f269\"; }\n\n.ion-beer:before {\n  content: \"\\f26a\"; }\n\n.ion-bluetooth:before {\n  content: \"\\f116\"; }\n\n.ion-bonfire:before {\n  content: \"\\f315\"; }\n\n.ion-bookmark:before {\n  content: \"\\f26b\"; }\n\n.ion-briefcase:before {\n  content: \"\\f26c\"; }\n\n.ion-bug:before {\n  content: \"\\f2be\"; }\n\n.ion-calculator:before {\n  content: \"\\f26d\"; }\n\n.ion-calendar:before {\n  content: \"\\f117\"; }\n\n.ion-camera:before {\n  content: \"\\f118\"; }\n\n.ion-card:before {\n  content: \"\\f119\"; }\n\n.ion-cash:before {\n  content: \"\\f316\"; }\n\n.ion-chatbox:before {\n  content: \"\\f11b\"; }\n\n.ion-chatbox-working:before {\n  content: \"\\f11a\"; }\n\n.ion-chatboxes:before {\n  content: \"\\f11c\"; }\n\n.ion-chatbubble:before {\n  content: \"\\f11e\"; }\n\n.ion-chatbubble-working:before {\n  content: \"\\f11d\"; }\n\n.ion-chatbubbles:before {\n  content: \"\\f11f\"; }\n\n.ion-checkmark:before {\n  content: \"\\f122\"; }\n\n.ion-checkmark-circled:before {\n  content: \"\\f120\"; }\n\n.ion-checkmark-round:before {\n  content: \"\\f121\"; }\n\n.ion-chevron-down:before {\n  content: \"\\f123\"; }\n\n.ion-chevron-left:before {\n  content: \"\\f124\"; }\n\n.ion-chevron-right:before {\n  content: \"\\f125\"; }\n\n.ion-chevron-up:before {\n  content: \"\\f126\"; }\n\n.ion-clipboard:before {\n  content: \"\\f127\"; }\n\n.ion-clock:before {\n  content: \"\\f26e\"; }\n\n.ion-close:before {\n  content: \"\\f12a\"; }\n\n.ion-close-circled:before {\n  content: \"\\f128\"; }\n\n.ion-close-round:before {\n  content: \"\\f129\"; }\n\n.ion-closed-captioning:before {\n  content: \"\\f317\"; }\n\n.ion-cloud:before {\n  content: \"\\f12b\"; }\n\n.ion-code:before {\n  content: \"\\f271\"; }\n\n.ion-code-download:before {\n  content: \"\\f26f\"; }\n\n.ion-code-working:before {\n  content: \"\\f270\"; }\n\n.ion-coffee:before {\n  content: \"\\f272\"; }\n\n.ion-compass:before {\n  content: \"\\f273\"; }\n\n.ion-compose:before {\n  content: \"\\f12c\"; }\n\n.ion-connection-bars:before {\n  content: \"\\f274\"; }\n\n.ion-contrast:before {\n  content: \"\\f275\"; }\n\n.ion-cube:before {\n  content: \"\\f318\"; }\n\n.ion-disc:before {\n  content: \"\\f12d\"; }\n\n.ion-document:before {\n  content: \"\\f12f\"; }\n\n.ion-document-text:before {\n  content: \"\\f12e\"; }\n\n.ion-drag:before {\n  content: \"\\f130\"; }\n\n.ion-earth:before {\n  content: \"\\f276\"; }\n\n.ion-edit:before {\n  content: \"\\f2bf\"; }\n\n.ion-egg:before {\n  content: \"\\f277\"; }\n\n.ion-eject:before {\n  content: \"\\f131\"; }\n\n.ion-email:before {\n  content: \"\\f132\"; }\n\n.ion-eye:before {\n  content: \"\\f133\"; }\n\n.ion-eye-disabled:before {\n  content: \"\\f306\"; }\n\n.ion-female:before {\n  content: \"\\f278\"; }\n\n.ion-filing:before {\n  content: \"\\f134\"; }\n\n.ion-film-marker:before {\n  content: \"\\f135\"; }\n\n.ion-fireball:before {\n  content: \"\\f319\"; }\n\n.ion-flag:before {\n  content: \"\\f279\"; }\n\n.ion-flame:before {\n  content: \"\\f31a\"; }\n\n.ion-flash:before {\n  content: \"\\f137\"; }\n\n.ion-flash-off:before {\n  content: \"\\f136\"; }\n\n.ion-flask:before {\n  content: \"\\f138\"; }\n\n.ion-folder:before {\n  content: \"\\f139\"; }\n\n.ion-fork:before {\n  content: \"\\f27a\"; }\n\n.ion-fork-repo:before {\n  content: \"\\f2c0\"; }\n\n.ion-forward:before {\n  content: \"\\f13a\"; }\n\n.ion-funnel:before {\n  content: \"\\f31b\"; }\n\n.ion-game-controller-a:before {\n  content: \"\\f13b\"; }\n\n.ion-game-controller-b:before {\n  content: \"\\f13c\"; }\n\n.ion-gear-a:before {\n  content: \"\\f13d\"; }\n\n.ion-gear-b:before {\n  content: \"\\f13e\"; }\n\n.ion-grid:before {\n  content: \"\\f13f\"; }\n\n.ion-hammer:before {\n  content: \"\\f27b\"; }\n\n.ion-happy:before {\n  content: \"\\f31c\"; }\n\n.ion-headphone:before {\n  content: \"\\f140\"; }\n\n.ion-heart:before {\n  content: \"\\f141\"; }\n\n.ion-heart-broken:before {\n  content: \"\\f31d\"; }\n\n.ion-help:before {\n  content: \"\\f143\"; }\n\n.ion-help-buoy:before {\n  content: \"\\f27c\"; }\n\n.ion-help-circled:before {\n  content: \"\\f142\"; }\n\n.ion-home:before {\n  content: \"\\f144\"; }\n\n.ion-icecream:before {\n  content: \"\\f27d\"; }\n\n.ion-icon-social-google-plus:before {\n  content: \"\\f146\"; }\n\n.ion-icon-social-google-plus-outline:before {\n  content: \"\\f145\"; }\n\n.ion-image:before {\n  content: \"\\f147\"; }\n\n.ion-images:before {\n  content: \"\\f148\"; }\n\n.ion-information:before {\n  content: \"\\f14a\"; }\n\n.ion-information-circled:before {\n  content: \"\\f149\"; }\n\n.ion-ionic:before {\n  content: \"\\f14b\"; }\n\n.ion-ios7-alarm:before {\n  content: \"\\f14d\"; }\n\n.ion-ios7-alarm-outline:before {\n  content: \"\\f14c\"; }\n\n.ion-ios7-albums:before {\n  content: \"\\f14f\"; }\n\n.ion-ios7-albums-outline:before {\n  content: \"\\f14e\"; }\n\n.ion-ios7-americanfootball:before {\n  content: \"\\f31f\"; }\n\n.ion-ios7-americanfootball-outline:before {\n  content: \"\\f31e\"; }\n\n.ion-ios7-analytics:before {\n  content: \"\\f321\"; }\n\n.ion-ios7-analytics-outline:before {\n  content: \"\\f320\"; }\n\n.ion-ios7-arrow-back:before {\n  content: \"\\f150\"; }\n\n.ion-ios7-arrow-down:before {\n  content: \"\\f151\"; }\n\n.ion-ios7-arrow-forward:before {\n  content: \"\\f152\"; }\n\n.ion-ios7-arrow-left:before {\n  content: \"\\f153\"; }\n\n.ion-ios7-arrow-right:before {\n  content: \"\\f154\"; }\n\n.ion-ios7-arrow-thin-down:before {\n  content: \"\\f27e\"; }\n\n.ion-ios7-arrow-thin-left:before {\n  content: \"\\f27f\"; }\n\n.ion-ios7-arrow-thin-right:before {\n  content: \"\\f280\"; }\n\n.ion-ios7-arrow-thin-up:before {\n  content: \"\\f281\"; }\n\n.ion-ios7-arrow-up:before {\n  content: \"\\f155\"; }\n\n.ion-ios7-at:before {\n  content: \"\\f157\"; }\n\n.ion-ios7-at-outline:before {\n  content: \"\\f156\"; }\n\n.ion-ios7-barcode:before {\n  content: \"\\f323\"; }\n\n.ion-ios7-barcode-outline:before {\n  content: \"\\f322\"; }\n\n.ion-ios7-baseball:before {\n  content: \"\\f325\"; }\n\n.ion-ios7-baseball-outline:before {\n  content: \"\\f324\"; }\n\n.ion-ios7-basketball:before {\n  content: \"\\f327\"; }\n\n.ion-ios7-basketball-outline:before {\n  content: \"\\f326\"; }\n\n.ion-ios7-bell:before {\n  content: \"\\f159\"; }\n\n.ion-ios7-bell-outline:before {\n  content: \"\\f158\"; }\n\n.ion-ios7-bolt:before {\n  content: \"\\f15b\"; }\n\n.ion-ios7-bolt-outline:before {\n  content: \"\\f15a\"; }\n\n.ion-ios7-bookmarks:before {\n  content: \"\\f15d\"; }\n\n.ion-ios7-bookmarks-outline:before {\n  content: \"\\f15c\"; }\n\n.ion-ios7-box:before {\n  content: \"\\f15f\"; }\n\n.ion-ios7-box-outline:before {\n  content: \"\\f15e\"; }\n\n.ion-ios7-briefcase:before {\n  content: \"\\f283\"; }\n\n.ion-ios7-briefcase-outline:before {\n  content: \"\\f282\"; }\n\n.ion-ios7-browsers:before {\n  content: \"\\f161\"; }\n\n.ion-ios7-browsers-outline:before {\n  content: \"\\f160\"; }\n\n.ion-ios7-calculator:before {\n  content: \"\\f285\"; }\n\n.ion-ios7-calculator-outline:before {\n  content: \"\\f284\"; }\n\n.ion-ios7-calendar:before {\n  content: \"\\f163\"; }\n\n.ion-ios7-calendar-outline:before {\n  content: \"\\f162\"; }\n\n.ion-ios7-camera:before {\n  content: \"\\f165\"; }\n\n.ion-ios7-camera-outline:before {\n  content: \"\\f164\"; }\n\n.ion-ios7-cart:before {\n  content: \"\\f167\"; }\n\n.ion-ios7-cart-outline:before {\n  content: \"\\f166\"; }\n\n.ion-ios7-chatboxes:before {\n  content: \"\\f169\"; }\n\n.ion-ios7-chatboxes-outline:before {\n  content: \"\\f168\"; }\n\n.ion-ios7-chatbubble:before {\n  content: \"\\f16b\"; }\n\n.ion-ios7-chatbubble-outline:before {\n  content: \"\\f16a\"; }\n\n.ion-ios7-checkmark:before {\n  content: \"\\f16e\"; }\n\n.ion-ios7-checkmark-empty:before {\n  content: \"\\f16c\"; }\n\n.ion-ios7-checkmark-outline:before {\n  content: \"\\f16d\"; }\n\n.ion-ios7-circle-filled:before {\n  content: \"\\f16f\"; }\n\n.ion-ios7-circle-outline:before {\n  content: \"\\f170\"; }\n\n.ion-ios7-clock:before {\n  content: \"\\f172\"; }\n\n.ion-ios7-clock-outline:before {\n  content: \"\\f171\"; }\n\n.ion-ios7-close:before {\n  content: \"\\f2bc\"; }\n\n.ion-ios7-close-empty:before {\n  content: \"\\f2bd\"; }\n\n.ion-ios7-close-outline:before {\n  content: \"\\f2bb\"; }\n\n.ion-ios7-cloud:before {\n  content: \"\\f178\"; }\n\n.ion-ios7-cloud-download:before {\n  content: \"\\f174\"; }\n\n.ion-ios7-cloud-download-outline:before {\n  content: \"\\f173\"; }\n\n.ion-ios7-cloud-outline:before {\n  content: \"\\f175\"; }\n\n.ion-ios7-cloud-upload:before {\n  content: \"\\f177\"; }\n\n.ion-ios7-cloud-upload-outline:before {\n  content: \"\\f176\"; }\n\n.ion-ios7-cloudy:before {\n  content: \"\\f17a\"; }\n\n.ion-ios7-cloudy-night:before {\n  content: \"\\f308\"; }\n\n.ion-ios7-cloudy-night-outline:before {\n  content: \"\\f307\"; }\n\n.ion-ios7-cloudy-outline:before {\n  content: \"\\f179\"; }\n\n.ion-ios7-cog:before {\n  content: \"\\f17c\"; }\n\n.ion-ios7-cog-outline:before {\n  content: \"\\f17b\"; }\n\n.ion-ios7-compose:before {\n  content: \"\\f17e\"; }\n\n.ion-ios7-compose-outline:before {\n  content: \"\\f17d\"; }\n\n.ion-ios7-contact:before {\n  content: \"\\f180\"; }\n\n.ion-ios7-contact-outline:before {\n  content: \"\\f17f\"; }\n\n.ion-ios7-copy:before {\n  content: \"\\f182\"; }\n\n.ion-ios7-copy-outline:before {\n  content: \"\\f181\"; }\n\n.ion-ios7-download:before {\n  content: \"\\f184\"; }\n\n.ion-ios7-download-outline:before {\n  content: \"\\f183\"; }\n\n.ion-ios7-drag:before {\n  content: \"\\f185\"; }\n\n.ion-ios7-email:before {\n  content: \"\\f187\"; }\n\n.ion-ios7-email-outline:before {\n  content: \"\\f186\"; }\n\n.ion-ios7-expand:before {\n  content: \"\\f30d\"; }\n\n.ion-ios7-eye:before {\n  content: \"\\f189\"; }\n\n.ion-ios7-eye-outline:before {\n  content: \"\\f188\"; }\n\n.ion-ios7-fastforward:before {\n  content: \"\\f18b\"; }\n\n.ion-ios7-fastforward-outline:before {\n  content: \"\\f18a\"; }\n\n.ion-ios7-filing:before {\n  content: \"\\f18d\"; }\n\n.ion-ios7-filing-outline:before {\n  content: \"\\f18c\"; }\n\n.ion-ios7-film:before {\n  content: \"\\f18f\"; }\n\n.ion-ios7-film-outline:before {\n  content: \"\\f18e\"; }\n\n.ion-ios7-flag:before {\n  content: \"\\f191\"; }\n\n.ion-ios7-flag-outline:before {\n  content: \"\\f190\"; }\n\n.ion-ios7-folder:before {\n  content: \"\\f193\"; }\n\n.ion-ios7-folder-outline:before {\n  content: \"\\f192\"; }\n\n.ion-ios7-football:before {\n  content: \"\\f329\"; }\n\n.ion-ios7-football-outline:before {\n  content: \"\\f328\"; }\n\n.ion-ios7-gear:before {\n  content: \"\\f195\"; }\n\n.ion-ios7-gear-outline:before {\n  content: \"\\f194\"; }\n\n.ion-ios7-glasses:before {\n  content: \"\\f197\"; }\n\n.ion-ios7-glasses-outline:before {\n  content: \"\\f196\"; }\n\n.ion-ios7-heart:before {\n  content: \"\\f199\"; }\n\n.ion-ios7-heart-outline:before {\n  content: \"\\f198\"; }\n\n.ion-ios7-help:before {\n  content: \"\\f19c\"; }\n\n.ion-ios7-help-empty:before {\n  content: \"\\f19a\"; }\n\n.ion-ios7-help-outline:before {\n  content: \"\\f19b\"; }\n\n.ion-ios7-home:before {\n  content: \"\\f32b\"; }\n\n.ion-ios7-home-outline:before {\n  content: \"\\f32a\"; }\n\n.ion-ios7-infinite:before {\n  content: \"\\f19e\"; }\n\n.ion-ios7-infinite-outline:before {\n  content: \"\\f19d\"; }\n\n.ion-ios7-information:before {\n  content: \"\\f1a1\"; }\n\n.ion-ios7-information-empty:before {\n  content: \"\\f19f\"; }\n\n.ion-ios7-information-outline:before {\n  content: \"\\f1a0\"; }\n\n.ion-ios7-ionic-outline:before {\n  content: \"\\f1a2\"; }\n\n.ion-ios7-keypad:before {\n  content: \"\\f1a4\"; }\n\n.ion-ios7-keypad-outline:before {\n  content: \"\\f1a3\"; }\n\n.ion-ios7-lightbulb:before {\n  content: \"\\f287\"; }\n\n.ion-ios7-lightbulb-outline:before {\n  content: \"\\f286\"; }\n\n.ion-ios7-location:before {\n  content: \"\\f1a6\"; }\n\n.ion-ios7-location-outline:before {\n  content: \"\\f1a5\"; }\n\n.ion-ios7-locked:before {\n  content: \"\\f1a8\"; }\n\n.ion-ios7-locked-outline:before {\n  content: \"\\f1a7\"; }\n\n.ion-ios7-loop:before {\n  content: \"\\f32d\"; }\n\n.ion-ios7-loop-strong:before {\n  content: \"\\f32c\"; }\n\n.ion-ios7-medkit:before {\n  content: \"\\f289\"; }\n\n.ion-ios7-medkit-outline:before {\n  content: \"\\f288\"; }\n\n.ion-ios7-mic:before {\n  content: \"\\f1ab\"; }\n\n.ion-ios7-mic-off:before {\n  content: \"\\f1a9\"; }\n\n.ion-ios7-mic-outline:before {\n  content: \"\\f1aa\"; }\n\n.ion-ios7-minus:before {\n  content: \"\\f1ae\"; }\n\n.ion-ios7-minus-empty:before {\n  content: \"\\f1ac\"; }\n\n.ion-ios7-minus-outline:before {\n  content: \"\\f1ad\"; }\n\n.ion-ios7-monitor:before {\n  content: \"\\f1b0\"; }\n\n.ion-ios7-monitor-outline:before {\n  content: \"\\f1af\"; }\n\n.ion-ios7-moon:before {\n  content: \"\\f1b2\"; }\n\n.ion-ios7-moon-outline:before {\n  content: \"\\f1b1\"; }\n\n.ion-ios7-more:before {\n  content: \"\\f1b4\"; }\n\n.ion-ios7-more-outline:before {\n  content: \"\\f1b3\"; }\n\n.ion-ios7-musical-note:before {\n  content: \"\\f1b5\"; }\n\n.ion-ios7-musical-notes:before {\n  content: \"\\f1b6\"; }\n\n.ion-ios7-navigate:before {\n  content: \"\\f1b8\"; }\n\n.ion-ios7-navigate-outline:before {\n  content: \"\\f1b7\"; }\n\n.ion-ios7-paper:before {\n  content: \"\\f32f\"; }\n\n.ion-ios7-paper-outline:before {\n  content: \"\\f32e\"; }\n\n.ion-ios7-paperplane:before {\n  content: \"\\f1ba\"; }\n\n.ion-ios7-paperplane-outline:before {\n  content: \"\\f1b9\"; }\n\n.ion-ios7-partlysunny:before {\n  content: \"\\f1bc\"; }\n\n.ion-ios7-partlysunny-outline:before {\n  content: \"\\f1bb\"; }\n\n.ion-ios7-pause:before {\n  content: \"\\f1be\"; }\n\n.ion-ios7-pause-outline:before {\n  content: \"\\f1bd\"; }\n\n.ion-ios7-paw:before {\n  content: \"\\f331\"; }\n\n.ion-ios7-paw-outline:before {\n  content: \"\\f330\"; }\n\n.ion-ios7-people:before {\n  content: \"\\f1c0\"; }\n\n.ion-ios7-people-outline:before {\n  content: \"\\f1bf\"; }\n\n.ion-ios7-person:before {\n  content: \"\\f1c2\"; }\n\n.ion-ios7-person-outline:before {\n  content: \"\\f1c1\"; }\n\n.ion-ios7-personadd:before {\n  content: \"\\f1c4\"; }\n\n.ion-ios7-personadd-outline:before {\n  content: \"\\f1c3\"; }\n\n.ion-ios7-photos:before {\n  content: \"\\f1c6\"; }\n\n.ion-ios7-photos-outline:before {\n  content: \"\\f1c5\"; }\n\n.ion-ios7-pie:before {\n  content: \"\\f28b\"; }\n\n.ion-ios7-pie-outline:before {\n  content: \"\\f28a\"; }\n\n.ion-ios7-play:before {\n  content: \"\\f1c8\"; }\n\n.ion-ios7-play-outline:before {\n  content: \"\\f1c7\"; }\n\n.ion-ios7-plus:before {\n  content: \"\\f1cb\"; }\n\n.ion-ios7-plus-empty:before {\n  content: \"\\f1c9\"; }\n\n.ion-ios7-plus-outline:before {\n  content: \"\\f1ca\"; }\n\n.ion-ios7-pricetag:before {\n  content: \"\\f28d\"; }\n\n.ion-ios7-pricetag-outline:before {\n  content: \"\\f28c\"; }\n\n.ion-ios7-pricetags:before {\n  content: \"\\f333\"; }\n\n.ion-ios7-pricetags-outline:before {\n  content: \"\\f332\"; }\n\n.ion-ios7-printer:before {\n  content: \"\\f1cd\"; }\n\n.ion-ios7-printer-outline:before {\n  content: \"\\f1cc\"; }\n\n.ion-ios7-pulse:before {\n  content: \"\\f335\"; }\n\n.ion-ios7-pulse-strong:before {\n  content: \"\\f334\"; }\n\n.ion-ios7-rainy:before {\n  content: \"\\f1cf\"; }\n\n.ion-ios7-rainy-outline:before {\n  content: \"\\f1ce\"; }\n\n.ion-ios7-recording:before {\n  content: \"\\f1d1\"; }\n\n.ion-ios7-recording-outline:before {\n  content: \"\\f1d0\"; }\n\n.ion-ios7-redo:before {\n  content: \"\\f1d3\"; }\n\n.ion-ios7-redo-outline:before {\n  content: \"\\f1d2\"; }\n\n.ion-ios7-refresh:before {\n  content: \"\\f1d6\"; }\n\n.ion-ios7-refresh-empty:before {\n  content: \"\\f1d4\"; }\n\n.ion-ios7-refresh-outline:before {\n  content: \"\\f1d5\"; }\n\n.ion-ios7-reload:before, .ion-ios7-reloading:before {\n  content: \"\\f28e\"; }\n\n.ion-ios7-reverse-camera:before {\n  content: \"\\f337\"; }\n\n.ion-ios7-reverse-camera-outline:before {\n  content: \"\\f336\"; }\n\n.ion-ios7-rewind:before {\n  content: \"\\f1d8\"; }\n\n.ion-ios7-rewind-outline:before {\n  content: \"\\f1d7\"; }\n\n.ion-ios7-search:before {\n  content: \"\\f1da\"; }\n\n.ion-ios7-search-strong:before {\n  content: \"\\f1d9\"; }\n\n.ion-ios7-settings:before {\n  content: \"\\f339\"; }\n\n.ion-ios7-settings-strong:before {\n  content: \"\\f338\"; }\n\n.ion-ios7-shrink:before {\n  content: \"\\f30e\"; }\n\n.ion-ios7-skipbackward:before {\n  content: \"\\f1dc\"; }\n\n.ion-ios7-skipbackward-outline:before {\n  content: \"\\f1db\"; }\n\n.ion-ios7-skipforward:before {\n  content: \"\\f1de\"; }\n\n.ion-ios7-skipforward-outline:before {\n  content: \"\\f1dd\"; }\n\n.ion-ios7-snowy:before {\n  content: \"\\f309\"; }\n\n.ion-ios7-speedometer:before {\n  content: \"\\f290\"; }\n\n.ion-ios7-speedometer-outline:before {\n  content: \"\\f28f\"; }\n\n.ion-ios7-star:before {\n  content: \"\\f1e0\"; }\n\n.ion-ios7-star-half:before {\n  content: \"\\f33a\"; }\n\n.ion-ios7-star-outline:before {\n  content: \"\\f1df\"; }\n\n.ion-ios7-stopwatch:before {\n  content: \"\\f1e2\"; }\n\n.ion-ios7-stopwatch-outline:before {\n  content: \"\\f1e1\"; }\n\n.ion-ios7-sunny:before {\n  content: \"\\f1e4\"; }\n\n.ion-ios7-sunny-outline:before {\n  content: \"\\f1e3\"; }\n\n.ion-ios7-telephone:before {\n  content: \"\\f1e6\"; }\n\n.ion-ios7-telephone-outline:before {\n  content: \"\\f1e5\"; }\n\n.ion-ios7-tennisball:before {\n  content: \"\\f33c\"; }\n\n.ion-ios7-tennisball-outline:before {\n  content: \"\\f33b\"; }\n\n.ion-ios7-thunderstorm:before {\n  content: \"\\f1e8\"; }\n\n.ion-ios7-thunderstorm-outline:before {\n  content: \"\\f1e7\"; }\n\n.ion-ios7-time:before {\n  content: \"\\f292\"; }\n\n.ion-ios7-time-outline:before {\n  content: \"\\f291\"; }\n\n.ion-ios7-timer:before {\n  content: \"\\f1ea\"; }\n\n.ion-ios7-timer-outline:before {\n  content: \"\\f1e9\"; }\n\n.ion-ios7-toggle:before {\n  content: \"\\f33e\"; }\n\n.ion-ios7-toggle-outline:before {\n  content: \"\\f33d\"; }\n\n.ion-ios7-trash:before {\n  content: \"\\f1ec\"; }\n\n.ion-ios7-trash-outline:before {\n  content: \"\\f1eb\"; }\n\n.ion-ios7-undo:before {\n  content: \"\\f1ee\"; }\n\n.ion-ios7-undo-outline:before {\n  content: \"\\f1ed\"; }\n\n.ion-ios7-unlocked:before {\n  content: \"\\f1f0\"; }\n\n.ion-ios7-unlocked-outline:before {\n  content: \"\\f1ef\"; }\n\n.ion-ios7-upload:before {\n  content: \"\\f1f2\"; }\n\n.ion-ios7-upload-outline:before {\n  content: \"\\f1f1\"; }\n\n.ion-ios7-videocam:before {\n  content: \"\\f1f4\"; }\n\n.ion-ios7-videocam-outline:before {\n  content: \"\\f1f3\"; }\n\n.ion-ios7-volume-high:before {\n  content: \"\\f1f5\"; }\n\n.ion-ios7-volume-low:before {\n  content: \"\\f1f6\"; }\n\n.ion-ios7-wineglass:before {\n  content: \"\\f294\"; }\n\n.ion-ios7-wineglass-outline:before {\n  content: \"\\f293\"; }\n\n.ion-ios7-world:before {\n  content: \"\\f1f8\"; }\n\n.ion-ios7-world-outline:before {\n  content: \"\\f1f7\"; }\n\n.ion-ipad:before {\n  content: \"\\f1f9\"; }\n\n.ion-iphone:before {\n  content: \"\\f1fa\"; }\n\n.ion-ipod:before {\n  content: \"\\f1fb\"; }\n\n.ion-jet:before {\n  content: \"\\f295\"; }\n\n.ion-key:before {\n  content: \"\\f296\"; }\n\n.ion-knife:before {\n  content: \"\\f297\"; }\n\n.ion-laptop:before {\n  content: \"\\f1fc\"; }\n\n.ion-leaf:before {\n  content: \"\\f1fd\"; }\n\n.ion-levels:before {\n  content: \"\\f298\"; }\n\n.ion-lightbulb:before {\n  content: \"\\f299\"; }\n\n.ion-link:before {\n  content: \"\\f1fe\"; }\n\n.ion-load-a:before, .ion-loading-a:before {\n  content: \"\\f29a\"; }\n\n.ion-load-b:before, .ion-loading-b:before {\n  content: \"\\f29b\"; }\n\n.ion-load-c:before, .ion-loading-c:before {\n  content: \"\\f29c\"; }\n\n.ion-load-d:before, .ion-loading-d:before {\n  content: \"\\f29d\"; }\n\n.ion-location:before {\n  content: \"\\f1ff\"; }\n\n.ion-locked:before {\n  content: \"\\f200\"; }\n\n.ion-log-in:before {\n  content: \"\\f29e\"; }\n\n.ion-log-out:before {\n  content: \"\\f29f\"; }\n\n.ion-loop:before, .ion-looping:before {\n  content: \"\\f201\"; }\n\n.ion-magnet:before {\n  content: \"\\f2a0\"; }\n\n.ion-male:before {\n  content: \"\\f2a1\"; }\n\n.ion-man:before {\n  content: \"\\f202\"; }\n\n.ion-map:before {\n  content: \"\\f203\"; }\n\n.ion-medkit:before {\n  content: \"\\f2a2\"; }\n\n.ion-merge:before {\n  content: \"\\f33f\"; }\n\n.ion-mic-a:before {\n  content: \"\\f204\"; }\n\n.ion-mic-b:before {\n  content: \"\\f205\"; }\n\n.ion-mic-c:before {\n  content: \"\\f206\"; }\n\n.ion-minus:before {\n  content: \"\\f209\"; }\n\n.ion-minus-circled:before {\n  content: \"\\f207\"; }\n\n.ion-minus-round:before {\n  content: \"\\f208\"; }\n\n.ion-model-s:before {\n  content: \"\\f2c1\"; }\n\n.ion-monitor:before {\n  content: \"\\f20a\"; }\n\n.ion-more:before {\n  content: \"\\f20b\"; }\n\n.ion-mouse:before {\n  content: \"\\f340\"; }\n\n.ion-music-note:before {\n  content: \"\\f20c\"; }\n\n.ion-navicon:before {\n  content: \"\\f20e\"; }\n\n.ion-navicon-round:before {\n  content: \"\\f20d\"; }\n\n.ion-navigate:before {\n  content: \"\\f2a3\"; }\n\n.ion-network:before {\n  content: \"\\f341\"; }\n\n.ion-no-smoking:before {\n  content: \"\\f2c2\"; }\n\n.ion-nuclear:before {\n  content: \"\\f2a4\"; }\n\n.ion-outlet:before {\n  content: \"\\f342\"; }\n\n.ion-paper-airplane:before {\n  content: \"\\f2c3\"; }\n\n.ion-paperclip:before {\n  content: \"\\f20f\"; }\n\n.ion-pause:before {\n  content: \"\\f210\"; }\n\n.ion-person:before {\n  content: \"\\f213\"; }\n\n.ion-person-add:before {\n  content: \"\\f211\"; }\n\n.ion-person-stalker:before {\n  content: \"\\f212\"; }\n\n.ion-pie-graph:before {\n  content: \"\\f2a5\"; }\n\n.ion-pin:before {\n  content: \"\\f2a6\"; }\n\n.ion-pinpoint:before {\n  content: \"\\f2a7\"; }\n\n.ion-pizza:before {\n  content: \"\\f2a8\"; }\n\n.ion-plane:before {\n  content: \"\\f214\"; }\n\n.ion-planet:before {\n  content: \"\\f343\"; }\n\n.ion-play:before {\n  content: \"\\f215\"; }\n\n.ion-playstation:before {\n  content: \"\\f30a\"; }\n\n.ion-plus:before {\n  content: \"\\f218\"; }\n\n.ion-plus-circled:before {\n  content: \"\\f216\"; }\n\n.ion-plus-round:before {\n  content: \"\\f217\"; }\n\n.ion-podium:before {\n  content: \"\\f344\"; }\n\n.ion-pound:before {\n  content: \"\\f219\"; }\n\n.ion-power:before {\n  content: \"\\f2a9\"; }\n\n.ion-pricetag:before {\n  content: \"\\f2aa\"; }\n\n.ion-pricetags:before {\n  content: \"\\f2ab\"; }\n\n.ion-printer:before {\n  content: \"\\f21a\"; }\n\n.ion-pull-request:before {\n  content: \"\\f345\"; }\n\n.ion-qr-scanner:before {\n  content: \"\\f346\"; }\n\n.ion-quote:before {\n  content: \"\\f347\"; }\n\n.ion-radio-waves:before {\n  content: \"\\f2ac\"; }\n\n.ion-record:before {\n  content: \"\\f21b\"; }\n\n.ion-refresh:before, .ion-refreshing:before {\n  content: \"\\f21c\"; }\n\n.ion-reply:before {\n  content: \"\\f21e\"; }\n\n.ion-reply-all:before {\n  content: \"\\f21d\"; }\n\n.ion-ribbon-a:before {\n  content: \"\\f348\"; }\n\n.ion-ribbon-b:before {\n  content: \"\\f349\"; }\n\n.ion-sad:before {\n  content: \"\\f34a\"; }\n\n.ion-scissors:before {\n  content: \"\\f34b\"; }\n\n.ion-search:before {\n  content: \"\\f21f\"; }\n\n.ion-settings:before {\n  content: \"\\f2ad\"; }\n\n.ion-share:before {\n  content: \"\\f220\"; }\n\n.ion-shuffle:before {\n  content: \"\\f221\"; }\n\n.ion-skip-backward:before {\n  content: \"\\f222\"; }\n\n.ion-skip-forward:before {\n  content: \"\\f223\"; }\n\n.ion-social-android:before {\n  content: \"\\f225\"; }\n\n.ion-social-android-outline:before {\n  content: \"\\f224\"; }\n\n.ion-social-apple:before {\n  content: \"\\f227\"; }\n\n.ion-social-apple-outline:before {\n  content: \"\\f226\"; }\n\n.ion-social-bitcoin:before {\n  content: \"\\f2af\"; }\n\n.ion-social-bitcoin-outline:before {\n  content: \"\\f2ae\"; }\n\n.ion-social-buffer:before {\n  content: \"\\f229\"; }\n\n.ion-social-buffer-outline:before {\n  content: \"\\f228\"; }\n\n.ion-social-designernews:before {\n  content: \"\\f22b\"; }\n\n.ion-social-designernews-outline:before {\n  content: \"\\f22a\"; }\n\n.ion-social-dribbble:before {\n  content: \"\\f22d\"; }\n\n.ion-social-dribbble-outline:before {\n  content: \"\\f22c\"; }\n\n.ion-social-dropbox:before {\n  content: \"\\f22f\"; }\n\n.ion-social-dropbox-outline:before {\n  content: \"\\f22e\"; }\n\n.ion-social-facebook:before {\n  content: \"\\f231\"; }\n\n.ion-social-facebook-outline:before {\n  content: \"\\f230\"; }\n\n.ion-social-foursquare:before {\n  content: \"\\f34d\"; }\n\n.ion-social-foursquare-outline:before {\n  content: \"\\f34c\"; }\n\n.ion-social-freebsd-devil:before {\n  content: \"\\f2c4\"; }\n\n.ion-social-github:before {\n  content: \"\\f233\"; }\n\n.ion-social-github-outline:before {\n  content: \"\\f232\"; }\n\n.ion-social-google:before {\n  content: \"\\f34f\"; }\n\n.ion-social-google-outline:before {\n  content: \"\\f34e\"; }\n\n.ion-social-googleplus:before {\n  content: \"\\f235\"; }\n\n.ion-social-googleplus-outline:before {\n  content: \"\\f234\"; }\n\n.ion-social-hackernews:before {\n  content: \"\\f237\"; }\n\n.ion-social-hackernews-outline:before {\n  content: \"\\f236\"; }\n\n.ion-social-instagram:before {\n  content: \"\\f351\"; }\n\n.ion-social-instagram-outline:before {\n  content: \"\\f350\"; }\n\n.ion-social-linkedin:before {\n  content: \"\\f239\"; }\n\n.ion-social-linkedin-outline:before {\n  content: \"\\f238\"; }\n\n.ion-social-pinterest:before {\n  content: \"\\f2b1\"; }\n\n.ion-social-pinterest-outline:before {\n  content: \"\\f2b0\"; }\n\n.ion-social-reddit:before {\n  content: \"\\f23b\"; }\n\n.ion-social-reddit-outline:before {\n  content: \"\\f23a\"; }\n\n.ion-social-rss:before {\n  content: \"\\f23d\"; }\n\n.ion-social-rss-outline:before {\n  content: \"\\f23c\"; }\n\n.ion-social-skype:before {\n  content: \"\\f23f\"; }\n\n.ion-social-skype-outline:before {\n  content: \"\\f23e\"; }\n\n.ion-social-tumblr:before {\n  content: \"\\f241\"; }\n\n.ion-social-tumblr-outline:before {\n  content: \"\\f240\"; }\n\n.ion-social-tux:before {\n  content: \"\\f2c5\"; }\n\n.ion-social-twitter:before {\n  content: \"\\f243\"; }\n\n.ion-social-twitter-outline:before {\n  content: \"\\f242\"; }\n\n.ion-social-usd:before {\n  content: \"\\f353\"; }\n\n.ion-social-usd-outline:before {\n  content: \"\\f352\"; }\n\n.ion-social-vimeo:before {\n  content: \"\\f245\"; }\n\n.ion-social-vimeo-outline:before {\n  content: \"\\f244\"; }\n\n.ion-social-windows:before {\n  content: \"\\f247\"; }\n\n.ion-social-windows-outline:before {\n  content: \"\\f246\"; }\n\n.ion-social-wordpress:before {\n  content: \"\\f249\"; }\n\n.ion-social-wordpress-outline:before {\n  content: \"\\f248\"; }\n\n.ion-social-yahoo:before {\n  content: \"\\f24b\"; }\n\n.ion-social-yahoo-outline:before {\n  content: \"\\f24a\"; }\n\n.ion-social-youtube:before {\n  content: \"\\f24d\"; }\n\n.ion-social-youtube-outline:before {\n  content: \"\\f24c\"; }\n\n.ion-speakerphone:before {\n  content: \"\\f2b2\"; }\n\n.ion-speedometer:before {\n  content: \"\\f2b3\"; }\n\n.ion-spoon:before {\n  content: \"\\f2b4\"; }\n\n.ion-star:before {\n  content: \"\\f24e\"; }\n\n.ion-stats-bars:before {\n  content: \"\\f2b5\"; }\n\n.ion-steam:before {\n  content: \"\\f30b\"; }\n\n.ion-stop:before {\n  content: \"\\f24f\"; }\n\n.ion-thermometer:before {\n  content: \"\\f2b6\"; }\n\n.ion-thumbsdown:before {\n  content: \"\\f250\"; }\n\n.ion-thumbsup:before {\n  content: \"\\f251\"; }\n\n.ion-toggle:before {\n  content: \"\\f355\"; }\n\n.ion-toggle-filled:before {\n  content: \"\\f354\"; }\n\n.ion-trash-a:before {\n  content: \"\\f252\"; }\n\n.ion-trash-b:before {\n  content: \"\\f253\"; }\n\n.ion-trophy:before {\n  content: \"\\f356\"; }\n\n.ion-umbrella:before {\n  content: \"\\f2b7\"; }\n\n.ion-university:before {\n  content: \"\\f357\"; }\n\n.ion-unlocked:before {\n  content: \"\\f254\"; }\n\n.ion-upload:before {\n  content: \"\\f255\"; }\n\n.ion-usb:before {\n  content: \"\\f2b8\"; }\n\n.ion-videocamera:before {\n  content: \"\\f256\"; }\n\n.ion-volume-high:before {\n  content: \"\\f257\"; }\n\n.ion-volume-low:before {\n  content: \"\\f258\"; }\n\n.ion-volume-medium:before {\n  content: \"\\f259\"; }\n\n.ion-volume-mute:before {\n  content: \"\\f25a\"; }\n\n.ion-wand:before {\n  content: \"\\f358\"; }\n\n.ion-waterdrop:before {\n  content: \"\\f25b\"; }\n\n.ion-wifi:before {\n  content: \"\\f25c\"; }\n\n.ion-wineglass:before {\n  content: \"\\f2b9\"; }\n\n.ion-woman:before {\n  content: \"\\f25d\"; }\n\n.ion-wrench:before {\n  content: \"\\f2ba\"; }\n\n.ion-xbox:before {\n  content: \"\\f30c\"; }\n\n/**\n * Resets\n * --------------------------------------------------\n * Adapted from normalize.css and some reset.css. We don't care even one\n * bit about old IE, so we don't need any hacks for that in here.\n *\n * There are probably other things we could remove here, as well.\n *\n * normalize.css v2.1.2 | MIT License | git.io/normalize\n\n * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)\n * http://cssreset.com\n */\nhtml, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, i, u, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, fieldset, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {\n  margin: 0;\n  padding: 0;\n  border: 0;\n  vertical-align: baseline;\n  font: inherit;\n  font-size: 100%; }\n\nol, ul {\n  list-style: none; }\n\nblockquote, q {\n  quotes: none; }\n\nblockquote:before, blockquote:after, q:before, q:after {\n  content: '';\n  content: none; }\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\naudio:not([controls]) {\n  display: none;\n  height: 0; }\n\n/**\n * Hide the `template` element in IE, Safari, and Firefox < 22.\n */\n[hidden], template {\n  display: none; }\n\nscript {\n  display: none !important; }\n\n/* ==========================================================================\n   Base\n   ========================================================================== */\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n *  user zoom.\n */\nhtml {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  font-family: sans-serif;\n  /* 1 */\n  -webkit-text-size-adjust: 100%;\n  -ms-text-size-adjust: 100%;\n  /* 2 */\n  -webkit-text-size-adjust: 100%;\n  /* 2 */ }\n\n/**\n * Remove default margin.\n */\nbody {\n  margin: 0;\n  line-height: 1; }\n\n/**\n * Remove default outlines.\n */\na, button, :focus, a:focus, button:focus, a:active, a:hover {\n  outline: 0; }\n\n/* *\n * Remove tap highlight color\n */\na {\n  -webkit-user-drag: none;\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n  -webkit-tap-highlight-color: transparent; }\n  a[href]:hover {\n    cursor: pointer; }\n\n/* ==========================================================================\n   Typography\n   ========================================================================== */\n/**\n * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.\n */\nb, strong {\n  font-weight: bold; }\n\n/**\n * Address styling not present in Safari 5 and Chrome.\n */\ndfn {\n  font-style: italic; }\n\n/**\n * Address differences between Firefox and other browsers.\n */\nhr {\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  height: 0; }\n\n/**\n * Correct font family set oddly in Safari 5 and Chrome.\n */\ncode, kbd, pre, samp {\n  font-size: 1em;\n  font-family: monospace, serif; }\n\n/**\n * Improve readability of pre-formatted text in all browsers.\n */\npre {\n  white-space: pre-wrap; }\n\n/**\n * Set consistent quote types.\n */\nq {\n  quotes: \"\\201C\" \"\\201D\" \"\\2018\" \"\\2019\"; }\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\nsmall {\n  font-size: 80%; }\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\nsub, sup {\n  position: relative;\n  vertical-align: baseline;\n  font-size: 75%;\n  line-height: 0; }\n\nsup {\n  top: -0.5em; }\n\nsub {\n  bottom: -0.25em; }\n\n/**\n * Define consistent border, margin, and padding.\n */\nfieldset {\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n  border: 1px solid #c0c0c0; }\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\nlegend {\n  padding: 0;\n  /* 2 */\n  border: 0;\n  /* 1 */ }\n\n/**\n * 1. Correct font family not being inherited in all browsers.\n * 2. Correct font size not being inherited in all browsers.\n * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n * 4. Remove any default :focus styles\n * 5. Make sure webkit font smoothing is being inherited\n * 6. Remove default gradient in Android Firefox / FirefoxOS\n */\nbutton, input, select, textarea {\n  margin: 0;\n  /* 3 */\n  font-size: 100%;\n  /* 2 */\n  font-family: inherit;\n  /* 1 */\n  outline-offset: 0;\n  /* 4 */\n  outline-style: none;\n  /* 4 */\n  outline-width: 0;\n  /* 4 */\n  -webkit-font-smoothing: inherit;\n  /* 5 */\n  background-image: none;\n  /* 6 */ }\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `importnt` in\n * the UA stylesheet.\n */\nbutton, input {\n  line-height: normal; }\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.\n * Correct `select` style inheritance in Firefox 4+ and Opera.\n */\nbutton, select {\n  text-transform: none; }\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n *  and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n *  `input` and others.\n */\nbutton, html input[type=\"button\"], input[type=\"reset\"], input[type=\"submit\"] {\n  cursor: pointer;\n  /* 3 */\n  -webkit-appearance: button;\n  /* 2 */ }\n\n/**\n * Re-set default cursor for disabled elements.\n */\nbutton[disabled], html input[disabled] {\n  cursor: default; }\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n *  (include `-moz` to future-proof).\n */\ninput[type=\"search\"] {\n  -webkit-box-sizing: content-box;\n  /* 2 */\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  -webkit-appearance: textfield;\n  /* 1 */ }\n\n/**\n * Remove inner padding and search cancel button in Safari 5 and Chrome\n * on OS X.\n */\ninput[type=\"search\"]::-webkit-search-cancel-button, input[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none; }\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\nbutton::-moz-focus-inner, input::-moz-focus-inner {\n  padding: 0;\n  border: 0; }\n\n/**\n * 1. Remove default vertical scrollbar in IE 8/9.\n * 2. Improve readability and alignment in all browsers.\n */\ntextarea {\n  overflow: auto;\n  /* 1 */\n  vertical-align: top;\n  /* 2 */ }\n\nimg {\n  -webkit-user-drag: none; }\n\n/* ==========================================================================\n   Tables\n   ========================================================================== */\n/**\n * Remove most spacing between table cells.\n */\ntable {\n  border-spacing: 0;\n  border-collapse: collapse; }\n\n/**\n * Scaffolding\n * --------------------------------------------------\n */\n*, *:before, *:after {\n  -webkit-box-sizing: border-box;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box; }\n\nhtml {\n  overflow: hidden;\n  -ms-touch-action: pan-y;\n  touch-action: pan-y; }\n\nbody, .ionic-body {\n  -webkit-touch-callout: none;\n  -webkit-font-smoothing: antialiased;\n  font-smoothing: antialiased;\n  -webkit-text-size-adjust: none;\n  -moz-text-size-adjust: none;\n  text-size-adjust: none;\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n  -webkit-tap-highlight-color: transparent;\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n  margin: 0;\n  padding: 0;\n  color: #000;\n  word-wrap: break-word;\n  font-size: 14px;\n  font-family: \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n  line-height: 20px;\n  text-rendering: optimizeLegibility;\n  -webkit-backface-visibility: hidden;\n  -webkit-user-drag: none; }\n\nbody.grade-b, body.grade-c {\n  text-rendering: auto; }\n\n.content {\n  position: relative; }\n\n.scroll-content {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n  margin-top: -1px;\n  padding-top: 1px;\n  width: auto;\n  height: auto; }\n\n.scroll-content-false, .menu .scroll-content.scroll-content-false {\n  z-index: 11; }\n\n.scroll-view {\n  position: relative;\n  display: block;\n  overflow: hidden;\n  margin-top: -1px; }\n\n/**\n * Scroll is the scroll view component available for complex and custom\n * scroll view functionality.\n */\n.scroll {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  -webkit-touch-callout: none;\n  -webkit-text-size-adjust: none;\n  -moz-text-size-adjust: none;\n  text-size-adjust: none;\n  -webkit-transform-origin: left top;\n  -moz-transform-origin: left top;\n  transform-origin: left top; }\n\n::-webkit-scrollbar {\n  display: none; }\n\n.scroll-bar {\n  position: absolute;\n  z-index: 9999; }\n\n.ng-animate .scroll-bar {\n  visibility: hidden; }\n\n.scroll-bar-h {\n  right: 2px;\n  bottom: 3px;\n  left: 2px;\n  height: 3px; }\n  .scroll-bar-h .scroll-bar-indicator {\n    height: 100%; }\n\n.scroll-bar-v {\n  top: 2px;\n  right: 3px;\n  bottom: 2px;\n  width: 3px; }\n  .scroll-bar-v .scroll-bar-indicator {\n    width: 100%; }\n\n.scroll-bar-indicator {\n  position: absolute;\n  border-radius: 4px;\n  background: rgba(0, 0, 0, 0.3);\n  opacity: 1; }\n  .scroll-bar-indicator.scroll-bar-fade-out {\n    -webkit-transition: opacity 0.3s linear;\n    -moz-transition: opacity 0.3s linear;\n    transition: opacity 0.3s linear;\n    opacity: 0; }\n\n.grade-b .scroll-bar-indicator, .grade-c .scroll-bar-indicator {\n  border-radius: 0;\n  background: #aaa; }\n  .grade-b .scroll-bar-indicator.scroll-bar-fade-out, .grade-c .scroll-bar-indicator.scroll-bar-fade-out {\n    -webkit-transition: none;\n    -moz-transition: none;\n    transition: none; }\n\n@keyframes refresh-spin {\n  0% {\n    transform: translate3d(0, 0, 0) rotate(0); }\n\n  100% {\n    transform: translate3d(0, 0, 0) rotate(-180deg); } }\n\n@-webkit-keyframes refresh-spin {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(0); }\n\n  100% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(-180deg); } }\n\n@keyframes refresh-spin-back {\n  0% {\n    transform: translate3d(0, 0, 0) rotate(-180deg); }\n\n  100% {\n    transform: translate3d(0, 0, 0) rotate(0); } }\n\n@-webkit-keyframes refresh-spin-back {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(-180deg); }\n\n  100% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(0); } }\n\n.scroll-refresher {\n  position: absolute;\n  top: -60px;\n  right: 0;\n  left: 0;\n  overflow: hidden;\n  margin: auto;\n  height: 60px; }\n  .scroll-refresher .ionic-refresher-content {\n    position: absolute;\n    bottom: 15px;\n    left: 0;\n    width: 100%;\n    color: #666666;\n    text-align: center;\n    font-size: 30px; }\n    .scroll-refresher .ionic-refresher-content .text-refreshing, .scroll-refresher .ionic-refresher-content .text-pulling {\n      font-size: 16px;\n      line-height: 16px; }\n    .scroll-refresher .ionic-refresher-content.ionic-refresher-with-text {\n      bottom: 10px; }\n  .scroll-refresher .icon-refreshing, .scroll-refresher .icon-pulling {\n    width: 100%;\n    -webkit-backface-visibility: hidden;\n    -webkit-transform-style: preserve-3d;\n    backface-visibility: hidden;\n    transform-style: preserve-3d; }\n  .scroll-refresher .icon-pulling {\n    -webkit-animation-name: refresh-spin-back;\n    -moz-animation-name: refresh-spin-back;\n    animation-name: refresh-spin-back;\n    -webkit-animation-duration: 200ms;\n    -moz-animation-duration: 200ms;\n    animation-duration: 200ms;\n    -webkit-animation-timing-function: linear;\n    -moz-animation-timing-function: linear;\n    animation-timing-function: linear;\n    -webkit-animation-fill-mode: none;\n    -moz-animation-fill-mode: none;\n    animation-fill-mode: none;\n    -webkit-transform: translate3d(0, 0, 0) rotate(0deg);\n    transform: translate3d(0, 0, 0) rotate(0deg); }\n  .scroll-refresher .icon-refreshing, .scroll-refresher .text-refreshing {\n    display: none; }\n  .scroll-refresher .icon-refreshing {\n    -webkit-animation-duration: 1.5s;\n    -moz-animation-duration: 1.5s;\n    animation-duration: 1.5s; }\n  .scroll-refresher.active .icon-pulling {\n    -webkit-animation-name: refresh-spin;\n    -moz-animation-name: refresh-spin;\n    animation-name: refresh-spin;\n    -webkit-transform: translate3d(0, 0, 0) rotate(-180deg);\n    transform: translate3d(0, 0, 0) rotate(-180deg); }\n  .scroll-refresher.active.refreshing .icon-pulling, .scroll-refresher.active.refreshing .text-pulling {\n    display: none; }\n  .scroll-refresher.active.refreshing .icon-refreshing, .scroll-refresher.active.refreshing .text-refreshing {\n    display: block; }\n\nion-infinite-scroll {\n  height: 60px;\n  width: 100%;\n  opacity: 0;\n  display: block;\n  -webkit-transition: opacity 0.25s;\n  -moz-transition: opacity 0.25s;\n  transition: opacity 0.25s;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: row;\n  -moz-flex-direction: row;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center; }\n  ion-infinite-scroll .icon {\n    color: #666666;\n    font-size: 30px;\n    color: #666666; }\n  ion-infinite-scroll.active {\n    opacity: 1; }\n\n.overflow-scroll {\n  overflow-x: hidden;\n  overflow-y: scroll;\n  -webkit-overflow-scrolling: touch;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  position: absolute; }\n  .overflow-scroll .scroll {\n    position: static;\n    height: 100%;\n    -webkit-transform: translate3d(0, 0, 0); }\n\n/* If you change these, change platform.scss as well */\n.has-header {\n  top: 44px; }\n\n.no-header {\n  top: 0; }\n\n.has-subheader {\n  top: 88px; }\n\n.has-tabs-top {\n  top: 93px; }\n\n.has-header.has-subheader.has-tabs-top {\n  top: 137px; }\n\n.has-footer {\n  bottom: 44px; }\n\n.has-subfooter {\n  bottom: 88px; }\n\n.has-tabs, .bar-footer.has-tabs {\n  bottom: 49px; }\n\n.has-footer.has-tabs {\n  bottom: 93px; }\n\n.pane {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  z-index: 1; }\n\n.view {\n  z-index: 1; }\n\n.pane, .view {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background-color: #fff;\n  overflow: hidden; }\n\nion-nav-view {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background-color: #000; }\n\n/**\n * Typography\n * --------------------------------------------------\n */\np {\n  margin: 0 0 10px; }\n\nsmall {\n  font-size: 85%; }\n\ncite {\n  font-style: normal; }\n\n.text-left {\n  text-align: left; }\n\n.text-right {\n  text-align: right; }\n\n.text-center {\n  text-align: center; }\n\nh1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {\n  color: #000;\n  font-weight: 500;\n  font-family: \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n  line-height: 1.2; }\n  h1 small, h2 small, h3 small, h4 small, h5 small, h6 small, .h1 small, .h2 small, .h3 small, .h4 small, .h5 small, .h6 small {\n    font-weight: normal;\n    line-height: 1; }\n\nh1, .h1, h2, .h2, h3, .h3 {\n  margin-top: 20px;\n  margin-bottom: 10px; }\n  h1:first-child, .h1:first-child, h2:first-child, .h2:first-child, h3:first-child, .h3:first-child {\n    margin-top: 0; }\n  h1 + h1, h1 + .h1, h1 + h2, h1 + .h2, h1 + h3, h1 + .h3, .h1 + h1, .h1 + .h1, .h1 + h2, .h1 + .h2, .h1 + h3, .h1 + .h3, h2 + h1, h2 + .h1, h2 + h2, h2 + .h2, h2 + h3, h2 + .h3, .h2 + h1, .h2 + .h1, .h2 + h2, .h2 + .h2, .h2 + h3, .h2 + .h3, h3 + h1, h3 + .h1, h3 + h2, h3 + .h2, h3 + h3, h3 + .h3, .h3 + h1, .h3 + .h1, .h3 + h2, .h3 + .h2, .h3 + h3, .h3 + .h3 {\n    margin-top: 10px; }\n\nh4, .h4, h5, .h5, h6, .h6 {\n  margin-top: 10px;\n  margin-bottom: 10px; }\n\nh1, .h1 {\n  font-size: 36px; }\n\nh2, .h2 {\n  font-size: 30px; }\n\nh3, .h3 {\n  font-size: 24px; }\n\nh4, .h4 {\n  font-size: 18px; }\n\nh5, .h5 {\n  font-size: 14px; }\n\nh6, .h6 {\n  font-size: 12px; }\n\nh1 small, .h1 small {\n  font-size: 24px; }\n\nh2 small, .h2 small {\n  font-size: 18px; }\n\nh3 small, .h3 small, h4 small, .h4 small {\n  font-size: 14px; }\n\ndl {\n  margin-bottom: 20px; }\n\ndt, dd {\n  line-height: 1.42857; }\n\ndt {\n  font-weight: bold; }\n\nblockquote {\n  margin: 0 0 20px;\n  padding: 10px 20px;\n  border-left: 5px solid gray; }\n  blockquote p {\n    font-weight: 300;\n    font-size: 17.5px;\n    line-height: 1.25; }\n  blockquote p:last-child {\n    margin-bottom: 0; }\n  blockquote small {\n    display: block;\n    line-height: 1.42857; }\n    blockquote small:before {\n      content: '\\2014 \\00A0'; }\n\nq:before, q:after, blockquote:before, blockquote:after {\n  content: \"\"; }\n\naddress {\n  display: block;\n  margin-bottom: 20px;\n  font-style: normal;\n  line-height: 1.42857; }\n\na.subdued {\n  padding-right: 10px;\n  color: #888;\n  text-decoration: none; }\n  a.subdued:hover {\n    text-decoration: none; }\n  a.subdued:last-child {\n    padding-right: 0; }\n\n/**\n * Action Sheets\n * --------------------------------------------------\n */\n.action-sheet-backdrop {\n  -webkit-transition: background-color 300ms ease-in-out;\n  -moz-transition: background-color 300ms ease-in-out;\n  transition: background-color 300ms ease-in-out;\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 11;\n  width: 100%;\n  height: 100%;\n  background-color: rgba(0, 0, 0, 0); }\n  .action-sheet-backdrop.active {\n    background-color: rgba(0, 0, 0, 0.5); }\n\n.action-sheet-wrapper {\n  -webkit-transform: translate3d(0, 100%, 0);\n  -moz-transform: translate3d(0, 100%, 0);\n  transform: translate3d(0, 100%, 0);\n  -webkit-transition: all ease-in-out 300ms;\n  -moz-transition: all ease-in-out 300ms;\n  transition: all ease-in-out 300ms;\n  position: absolute;\n  bottom: 0;\n  width: 100%; }\n\n.action-sheet-up {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n\n.action-sheet {\n  margin-left: 15px;\n  margin-right: 15px;\n  width: auto;\n  z-index: 11;\n  overflow: hidden; }\n  .action-sheet .button {\n    display: block;\n    padding: 1px;\n    width: 100%;\n    border-radius: 0;\n    background-color: transparent;\n    color: #4a87ee;\n    font-size: 18px; }\n    .action-sheet .button.destructive {\n      color: #ef4e3a; }\n\n.action-sheet-title {\n  padding: 10px;\n  color: #666666;\n  text-align: center;\n  font-size: 12px; }\n\n.action-sheet-group {\n  margin-bottom: 5px;\n  border-radius: 3px 3px 3px 3px;\n  background-color: #fff; }\n  .action-sheet-group .button {\n    border-width: 1px 0px 0px 0px;\n    border-radius: 0; }\n    .action-sheet-group .button.active {\n      background-color: transparent;\n      color: inherit; }\n  .action-sheet-group .button:first-child:last-child {\n    border-width: 0; }\n\n.action-sheet-open {\n  pointer-events: none; }\n  .action-sheet-open.modal-open .modal {\n    pointer-events: none; }\n  .action-sheet-open .action-sheet-backdrop {\n    pointer-events: auto; }\n\n.backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 11;\n  width: 100%;\n  height: 100%;\n  background-color: rgba(0, 0, 0, 0.4);\n  visibility: hidden;\n  opacity: 0;\n  -webkit-transition: 0.1s opacity linear;\n  -moz-transition: 0.1s opacity linear;\n  transition: 0.1s opacity linear; }\n  .backdrop.visible {\n    visibility: visible; }\n  .backdrop.active {\n    opacity: 1; }\n\n/**\n * Bar (Headers and Footers)\n * --------------------------------------------------\n */\n.bar {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  position: absolute;\n  right: 0;\n  left: 0;\n  z-index: 10;\n  box-sizing: border-box;\n  padding: 5px;\n  width: 100%;\n  height: 44px;\n  border-width: 0;\n  border-style: solid;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid #ddd;\n  background-color: white;\n  /* border-width: 1px will actually create 2 device pixels on retina */\n  /* this nifty trick sets an actual 1px border on hi-res displays */\n  background-size: 0; }\n  @media (min--moz-device-pixel-ratio: 1.5), (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx) {\n    .bar {\n      border: none;\n      background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n      background-position: bottom;\n      background-size: 100% 1px;\n      background-repeat: no-repeat; } }\n  .bar.bar-clear {\n    border: none;\n    background: none;\n    color: #fff; }\n    .bar.bar-clear .button {\n      color: #fff; }\n    .bar.bar-clear .title {\n      color: #fff; }\n  .bar.item-input-inset .item-input-wrapper {\n    margin-top: -1px; }\n    .bar.item-input-inset .item-input-wrapper input {\n      padding-left: 8px;\n      width: 94%;\n      height: 28px;\n      background: transparent; }\n  .bar.bar-light {\n    border-color: #ddd;\n    background-color: white;\n    background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n    color: #444; }\n    .bar.bar-light .title {\n      color: #444; }\n    .bar.bar-light.bar-footer {\n      background-image: linear-gradient(180deg, #ddd, #ddd 50%, transparent 50%); }\n  .bar.bar-stable {\n    border-color: #b2b2b2;\n    background-color: #f8f8f8;\n    background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n    color: #444; }\n    .bar.bar-stable .title {\n      color: #444; }\n    .bar.bar-stable.bar-footer {\n      background-image: linear-gradient(180deg, #b2b2b2, #b2b2b2 50%, transparent 50%); }\n  .bar.bar-positive {\n    border-color: #145fd7;\n    background-color: #4a87ee;\n    background-image: linear-gradient(0deg, #145fd7, #145fd7 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-positive .title {\n      color: #fff; }\n    .bar.bar-positive.bar-footer {\n      background-image: linear-gradient(180deg, #145fd7, #145fd7 50%, transparent 50%); }\n  .bar.bar-calm {\n    border-color: #1aacc3;\n    background-color: #43cee6;\n    background-image: linear-gradient(0deg, #1aacc3, #1aacc3 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-calm .title {\n      color: #fff; }\n    .bar.bar-calm.bar-footer {\n      background-image: linear-gradient(180deg, #1aacc3, #1aacc3 50%, transparent 50%); }\n  .bar.bar-assertive {\n    border-color: #cc2311;\n    background-color: #ef4e3a;\n    background-image: linear-gradient(0deg, #cc2311, #cc2311 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-assertive .title {\n      color: #fff; }\n    .bar.bar-assertive.bar-footer {\n      background-image: linear-gradient(180deg, #cc2311, #cc2311 50%, transparent 50%); }\n  .bar.bar-balanced {\n    border-color: #498f24;\n    background-color: #66cc33;\n    background-image: linear-gradient(0deg, #498f24, #498f24 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-balanced .title {\n      color: #fff; }\n    .bar.bar-balanced.bar-footer {\n      background-image: linear-gradient(180deg, #498f24, #145fd7 50%, transparent 50%); }\n  .bar.bar-energized {\n    border-color: #d39211;\n    background-color: #f0b840;\n    background-image: linear-gradient(0deg, #d39211, #d39211 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-energized .title {\n      color: #fff; }\n    .bar.bar-energized.bar-footer {\n      background-image: linear-gradient(180deg, #d39211, #d39211 50%, transparent 50%); }\n  .bar.bar-royal {\n    border-color: #552bdf;\n    background-color: #8a6de9;\n    background-image: linear-gradient(0deg, #552bdf, #552bdf 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-royal .title {\n      color: #fff; }\n    .bar.bar-royal.bar-footer {\n      background-image: linear-gradient(180deg, #552bdf, #552bdf 50%, transparent 50%); }\n  .bar.bar-dark {\n    border-color: #111;\n    background-color: #444444;\n    background-image: linear-gradient(0deg, #111, #111 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-dark .title {\n      color: #fff; }\n    .bar.bar-dark.bar-footer {\n      background-image: linear-gradient(180deg, #111, #111 50%, transparent 50%); }\n  .bar .title {\n    position: absolute;\n    top: 0;\n    right: 0;\n    left: 0;\n    z-index: 0;\n    overflow: hidden;\n    margin: 0 10px;\n    min-width: 30px;\n    height: 43px;\n    text-align: center;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n    font-size: 17px;\n    line-height: 44px; }\n    .bar .title.title-left {\n      text-align: left; }\n    .bar .title.title-right {\n      text-align: right; }\n  .bar .title a {\n    color: inherit; }\n  .bar .button {\n    z-index: 1;\n    padding: 0 8px;\n    min-width: initial;\n    min-height: 31px;\n    font-weight: 400;\n    font-size: 13px;\n    line-height: 32px; }\n    .bar .button.button-icon:before, .bar .button .icon:before, .bar .button.icon:before, .bar .button.icon-left:before, .bar .button.icon-right:before {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-size: 20px;\n      line-height: 32px; }\n    .bar .button.button-icon {\n      font-size: 17px; }\n      .bar .button.button-icon .icon:before, .bar .button.button-icon:before, .bar .button.button-icon.icon-left:before, .bar .button.button-icon.icon-right:before {\n        vertical-align: top;\n        font-size: 32px;\n        line-height: 32px; }\n    .bar .button.button-clear {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-weight: 300;\n      font-size: 17px; }\n      .bar .button.button-clear .icon:before, .bar .button.button-clear.icon:before, .bar .button.button-clear.icon-left:before, .bar .button.button-clear.icon-right:before {\n        font-size: 32px;\n        line-height: 32px; }\n    .bar .button.back-button {\n      padding: 0;\n      opacity: 0.8; }\n      .bar .button.back-button .back-button-title {\n        display: inline-block;\n        vertical-align: middle;\n        margin-left: 4px; }\n    .bar .button.back-button.active, .bar .button.back-button.activated {\n      opacity: 1; }\n  .bar .button-bar > .button, .bar .buttons > .button {\n    min-height: 31px;\n    line-height: 32px; }\n  .bar .button-bar + .button, .bar .button + .button-bar {\n    margin-left: 5px; }\n  .bar .buttons, .bar .buttons.left-buttons, .bar .buttons.right-buttons {\n    display: inherit; }\n  .bar .buttons span {\n    display: inline-flex; }\n  .bar .title + .button:last-child, .bar > .button + .button:last-child, .bar > .button.pull-right, .bar .buttons.pull-right, .bar .title + .buttons {\n    position: absolute;\n    top: 5px;\n    right: 5px;\n    bottom: 5px; }\n\n.bar-light .button {\n  border-color: #ddd;\n  background-color: white;\n  color: #444; }\n  .bar-light .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .bar-light .button.active, .bar-light .button.activated {\n    border-color: #ccc;\n    background-color: #fafafa;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-light .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #444;\n    font-size: 17px; }\n  .bar-light .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-stable .button {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  color: #444; }\n  .bar-stable .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .bar-stable .button.active, .bar-stable .button.activated {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-stable .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #444;\n    font-size: 17px; }\n  .bar-stable .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-positive .button {\n  border-color: #145fd7;\n  background-color: #4a87ee;\n  color: #fff; }\n  .bar-positive .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-positive .button.active, .bar-positive .button.activated {\n    border-color: #145fd7;\n    background-color: #145fd7;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-positive .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-positive .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-calm .button {\n  border-color: #1aacc3;\n  background-color: #43cee6;\n  color: #fff; }\n  .bar-calm .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-calm .button.active, .bar-calm .button.activated {\n    border-color: #1aacc3;\n    background-color: #1aacc3;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-calm .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-calm .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-assertive .button {\n  border-color: #cc2311;\n  background-color: #ef4e3a;\n  color: #fff; }\n  .bar-assertive .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-assertive .button.active, .bar-assertive .button.activated {\n    border-color: #cc2311;\n    background-color: #cc2311;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-assertive .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-assertive .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-balanced .button {\n  border-color: #498f24;\n  background-color: #66cc33;\n  color: #fff; }\n  .bar-balanced .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-balanced .button.active, .bar-balanced .button.activated {\n    border-color: #498f24;\n    background-color: #498f24;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-balanced .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-balanced .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-energized .button {\n  border-color: #d39211;\n  background-color: #f0b840;\n  color: #fff; }\n  .bar-energized .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-energized .button.active, .bar-energized .button.activated {\n    border-color: #d39211;\n    background-color: #d39211;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-energized .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-energized .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-royal .button {\n  border-color: #552bdf;\n  background-color: #8a6de9;\n  color: #fff; }\n  .bar-royal .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-royal .button.active, .bar-royal .button.activated {\n    border-color: #552bdf;\n    background-color: #552bdf;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-royal .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-royal .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-dark .button {\n  border-color: #111;\n  background-color: #444444;\n  color: #fff; }\n  .bar-dark .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-dark .button.active, .bar-dark .button.activated {\n    border-color: #000;\n    background-color: #262626;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .bar-dark .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-dark .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-header {\n  top: 0;\n  border-top-width: 0;\n  border-bottom-width: 1px; }\n  .bar-header.has-tabs-top {\n    border-bottom-width: 0px; }\n\n.bar-footer {\n  bottom: 0;\n  border-top-width: 1px;\n  border-bottom-width: 0;\n  background-position: top; }\n  .bar-footer.item-input-inset {\n    position: absolute; }\n\n.bar-tabs {\n  padding: 0; }\n\n.bar-subheader {\n  top: 44px;\n  display: block; }\n\n.bar-subfooter {\n  bottom: 44px;\n  display: block; }\n\n/**\n * Tabs\n * --------------------------------------------------\n * A navigation bar with any number of tab items supported.\n */\n.tabs {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: horizontal;\n  -moz-flex-direction: horizontal;\n  -ms-flex-direction: horizontal;\n  flex-direction: horizontal;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n  color: #444;\n  position: absolute;\n  bottom: 0;\n  z-index: 5;\n  width: 100%;\n  height: 49px;\n  border-style: solid;\n  border-top-width: 1px;\n  background-size: 0;\n  line-height: 49px; }\n  .tabs .tab-item .badge {\n    background-color: #444;\n    color: #f8f8f8; }\n  @media (min--moz-device-pixel-ratio: 1.5), (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx) {\n    .tabs {\n      padding-top: 2px;\n      border-top: none !important;\n      border-bottom: none;\n      background-position: top;\n      background-size: 100% 1px;\n      background-repeat: no-repeat; } }\n\n/* Allow parent element of tabs to define color, or just the tab itself */\n.tabs-light > .tabs, .tabs.tabs-light {\n  border-color: #ddd;\n  background-color: #fff;\n  background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n  color: #444; }\n  .tabs-light > .tabs .tab-item .badge, .tabs.tabs-light .tab-item .badge {\n    background-color: #444;\n    color: #fff; }\n\n.tabs-stable > .tabs, .tabs.tabs-stable {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n  color: #444; }\n  .tabs-stable > .tabs .tab-item .badge, .tabs.tabs-stable .tab-item .badge {\n    background-color: #444;\n    color: #f8f8f8; }\n\n.tabs-positive > .tabs, .tabs.tabs-positive {\n  border-color: #145fd7;\n  background-color: #4a87ee;\n  background-image: linear-gradient(0deg, #145fd7, #145fd7 50%, transparent 50%);\n  color: #fff; }\n  .tabs-positive > .tabs .tab-item .badge, .tabs.tabs-positive .tab-item .badge {\n    background-color: #fff;\n    color: #4a87ee; }\n\n.tabs-calm > .tabs, .tabs.tabs-calm {\n  border-color: #1aacc3;\n  background-color: #43cee6;\n  background-image: linear-gradient(0deg, #1aacc3, #1aacc3 50%, transparent 50%);\n  color: #fff; }\n  .tabs-calm > .tabs .tab-item .badge, .tabs.tabs-calm .tab-item .badge {\n    background-color: #fff;\n    color: #43cee6; }\n\n.tabs-assertive > .tabs, .tabs.tabs-assertive {\n  border-color: #cc2311;\n  background-color: #ef4e3a;\n  background-image: linear-gradient(0deg, #cc2311, #cc2311 50%, transparent 50%);\n  color: #fff; }\n  .tabs-assertive > .tabs .tab-item .badge, .tabs.tabs-assertive .tab-item .badge {\n    background-color: #fff;\n    color: #ef4e3a; }\n\n.tabs-balanced > .tabs, .tabs.tabs-balanced {\n  border-color: #498f24;\n  background-color: #66cc33;\n  background-image: linear-gradient(0deg, #498f24, #498f24 50%, transparent 50%);\n  color: #fff; }\n  .tabs-balanced > .tabs .tab-item .badge, .tabs.tabs-balanced .tab-item .badge {\n    background-color: #fff;\n    color: #66cc33; }\n\n.tabs-energized > .tabs, .tabs.tabs-energized {\n  border-color: #d39211;\n  background-color: #f0b840;\n  background-image: linear-gradient(0deg, #d39211, #d39211 50%, transparent 50%);\n  color: #fff; }\n  .tabs-energized > .tabs .tab-item .badge, .tabs.tabs-energized .tab-item .badge {\n    background-color: #fff;\n    color: #f0b840; }\n\n.tabs-royal > .tabs, .tabs.tabs-royal {\n  border-color: #552bdf;\n  background-color: #8a6de9;\n  background-image: linear-gradient(0deg, #552bdf, #552bdf 50%, transparent 50%);\n  color: #fff; }\n  .tabs-royal > .tabs .tab-item .badge, .tabs.tabs-royal .tab-item .badge {\n    background-color: #fff;\n    color: #8a6de9; }\n\n.tabs-dark > .tabs, .tabs.tabs-dark {\n  border-color: #111;\n  background-color: #444;\n  background-image: linear-gradient(0deg, #111, #111 50%, transparent 50%);\n  color: #fff; }\n  .tabs-dark > .tabs .tab-item .badge, .tabs.tabs-dark .tab-item .badge {\n    background-color: #fff;\n    color: #444; }\n\n.tabs-striped .tabs {\n  background-color: white;\n  background-image: none;\n  border: none;\n  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.15);\n  padding-top: 2px; }\n.tabs-striped.tabs-light .tabs {\n  background-color: #444; }\n.tabs-striped.tabs-light .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-light .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-light .tab-item.tab-item-active, .tabs-striped.tabs-light .tab-item.active, .tabs-striped.tabs-light .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n    .tabs-striped.tabs-light .tab-item.tab-item-active .badge, .tabs-striped.tabs-light .tab-item.active .badge, .tabs-striped.tabs-light .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-stable .tabs {\n  background-color: #444; }\n.tabs-striped.tabs-stable .tab-item {\n  color: rgba(248, 248, 248, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-stable .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-stable .tab-item.tab-item-active, .tabs-striped.tabs-stable .tab-item.active, .tabs-striped.tabs-stable .tab-item.activated {\n    margin-top: -2px;\n    color: #f8f8f8;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #f8f8f8; }\n    .tabs-striped.tabs-stable .tab-item.tab-item-active .badge, .tabs-striped.tabs-stable .tab-item.active .badge, .tabs-striped.tabs-stable .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-positive .tabs {\n  background-color: #fff; }\n.tabs-striped.tabs-positive .tab-item {\n  color: rgba(74, 135, 238, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-positive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-positive .tab-item.tab-item-active, .tabs-striped.tabs-positive .tab-item.active, .tabs-striped.tabs-positive .tab-item.activated {\n    margin-top: -2px;\n    color: #4a87ee;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #4a87ee; }\n    .tabs-striped.tabs-positive .tab-item.tab-item-active .badge, .tabs-striped.tabs-positive .tab-item.active .badge, .tabs-striped.tabs-positive .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-calm .tabs {\n  background-color: #fff; }\n.tabs-striped.tabs-calm .tab-item {\n  color: rgba(67, 206, 230, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-calm .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-calm .tab-item.tab-item-active, .tabs-striped.tabs-calm .tab-item.active, .tabs-striped.tabs-calm .tab-item.activated {\n    margin-top: -2px;\n    color: #43cee6;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #43cee6; }\n    .tabs-striped.tabs-calm .tab-item.tab-item-active .badge, .tabs-striped.tabs-calm .tab-item.active .badge, .tabs-striped.tabs-calm .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-assertive .tabs {\n  background-color: #fff; }\n.tabs-striped.tabs-assertive .tab-item {\n  color: rgba(239, 78, 58, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-assertive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-assertive .tab-item.tab-item-active, .tabs-striped.tabs-assertive .tab-item.active, .tabs-striped.tabs-assertive .tab-item.activated {\n    margin-top: -2px;\n    color: #ef4e3a;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #ef4e3a; }\n    .tabs-striped.tabs-assertive .tab-item.tab-item-active .badge, .tabs-striped.tabs-assertive .tab-item.active .badge, .tabs-striped.tabs-assertive .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-balanced .tabs {\n  background-color: #fff; }\n.tabs-striped.tabs-balanced .tab-item {\n  color: rgba(102, 204, 51, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-balanced .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-balanced .tab-item.tab-item-active, .tabs-striped.tabs-balanced .tab-item.active, .tabs-striped.tabs-balanced .tab-item.activated {\n    margin-top: -2px;\n    color: #66cc33;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #66cc33; }\n    .tabs-striped.tabs-balanced .tab-item.tab-item-active .badge, .tabs-striped.tabs-balanced .tab-item.active .badge, .tabs-striped.tabs-balanced .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-energized .tabs {\n  background-color: #fff; }\n.tabs-striped.tabs-energized .tab-item {\n  color: rgba(240, 184, 64, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-energized .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-energized .tab-item.tab-item-active, .tabs-striped.tabs-energized .tab-item.active, .tabs-striped.tabs-energized .tab-item.activated {\n    margin-top: -2px;\n    color: #f0b840;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #f0b840; }\n    .tabs-striped.tabs-energized .tab-item.tab-item-active .badge, .tabs-striped.tabs-energized .tab-item.active .badge, .tabs-striped.tabs-energized .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-royal .tabs {\n  background-color: #fff; }\n.tabs-striped.tabs-royal .tab-item {\n  color: rgba(138, 109, 233, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-royal .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-royal .tab-item.tab-item-active, .tabs-striped.tabs-royal .tab-item.active, .tabs-striped.tabs-royal .tab-item.activated {\n    margin-top: -2px;\n    color: #8a6de9;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #8a6de9; }\n    .tabs-striped.tabs-royal .tab-item.tab-item-active .badge, .tabs-striped.tabs-royal .tab-item.active .badge, .tabs-striped.tabs-royal .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-dark .tabs {\n  background-color: #fff; }\n.tabs-striped.tabs-dark .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-dark .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-dark .tab-item.tab-item-active, .tabs-striped.tabs-dark .tab-item.active, .tabs-striped.tabs-dark .tab-item.activated {\n    margin-top: -2px;\n    color: #444;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #444; }\n    .tabs-striped.tabs-dark .tab-item.tab-item-active .badge, .tabs-striped.tabs-dark .tab-item.active .badge, .tabs-striped.tabs-dark .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n.tabs-striped.tabs-background-light .tabs {\n  background-color: #fff; }\n.tabs-striped.tabs-background-stable .tabs {\n  background-color: #f8f8f8; }\n.tabs-striped.tabs-background-positive .tabs {\n  background-color: #4a87ee; }\n.tabs-striped.tabs-background-calm .tabs {\n  background-color: #43cee6; }\n.tabs-striped.tabs-background-assertive .tabs {\n  background-color: #ef4e3a; }\n.tabs-striped.tabs-background-balanced .tabs {\n  background-color: #66cc33; }\n.tabs-striped.tabs-background-energized .tabs {\n  background-color: #f0b840; }\n.tabs-striped.tabs-background-royal .tabs {\n  background-color: #8a6de9; }\n.tabs-striped.tabs-background-dark .tabs {\n  background-color: #444; }\n.tabs-striped.tabs-color-light .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-light .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-light .tab-item.tab-item-active, .tabs-striped.tabs-color-light .tab-item.active, .tabs-striped.tabs-color-light .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border: 0 solid #fff;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-light .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-light .tab-item.active .badge, .tabs-striped.tabs-color-light .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-color-stable .tab-item {\n  color: rgba(248, 248, 248, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-stable .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-stable .tab-item.tab-item-active, .tabs-striped.tabs-color-stable .tab-item.active, .tabs-striped.tabs-color-stable .tab-item.activated {\n    margin-top: -2px;\n    color: #f8f8f8;\n    border: 0 solid #f8f8f8;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-stable .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-stable .tab-item.active .badge, .tabs-striped.tabs-color-stable .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-color-positive .tab-item {\n  color: rgba(74, 135, 238, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-positive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-positive .tab-item.tab-item-active, .tabs-striped.tabs-color-positive .tab-item.active, .tabs-striped.tabs-color-positive .tab-item.activated {\n    margin-top: -2px;\n    color: #4a87ee;\n    border: 0 solid #4a87ee;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-positive .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-positive .tab-item.active .badge, .tabs-striped.tabs-color-positive .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-color-calm .tab-item {\n  color: rgba(67, 206, 230, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-calm .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-calm .tab-item.tab-item-active, .tabs-striped.tabs-color-calm .tab-item.active, .tabs-striped.tabs-color-calm .tab-item.activated {\n    margin-top: -2px;\n    color: #43cee6;\n    border: 0 solid #43cee6;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-calm .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-calm .tab-item.active .badge, .tabs-striped.tabs-color-calm .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-color-assertive .tab-item {\n  color: rgba(239, 78, 58, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-assertive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-assertive .tab-item.tab-item-active, .tabs-striped.tabs-color-assertive .tab-item.active, .tabs-striped.tabs-color-assertive .tab-item.activated {\n    margin-top: -2px;\n    color: #ef4e3a;\n    border: 0 solid #ef4e3a;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-assertive .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-assertive .tab-item.active .badge, .tabs-striped.tabs-color-assertive .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-color-balanced .tab-item {\n  color: rgba(102, 204, 51, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-balanced .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-balanced .tab-item.tab-item-active, .tabs-striped.tabs-color-balanced .tab-item.active, .tabs-striped.tabs-color-balanced .tab-item.activated {\n    margin-top: -2px;\n    color: #66cc33;\n    border: 0 solid #66cc33;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-balanced .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-balanced .tab-item.active .badge, .tabs-striped.tabs-color-balanced .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-color-energized .tab-item {\n  color: rgba(240, 184, 64, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-energized .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-energized .tab-item.tab-item-active, .tabs-striped.tabs-color-energized .tab-item.active, .tabs-striped.tabs-color-energized .tab-item.activated {\n    margin-top: -2px;\n    color: #f0b840;\n    border: 0 solid #f0b840;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-energized .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-energized .tab-item.active .badge, .tabs-striped.tabs-color-energized .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-color-royal .tab-item {\n  color: rgba(138, 109, 233, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-royal .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-royal .tab-item.tab-item-active, .tabs-striped.tabs-color-royal .tab-item.active, .tabs-striped.tabs-color-royal .tab-item.activated {\n    margin-top: -2px;\n    color: #8a6de9;\n    border: 0 solid #8a6de9;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-royal .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-royal .tab-item.active .badge, .tabs-striped.tabs-color-royal .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n.tabs-striped.tabs-color-dark .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-dark .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-dark .tab-item.tab-item-active, .tabs-striped.tabs-color-dark .tab-item.active, .tabs-striped.tabs-color-dark .tab-item.activated {\n    margin-top: -2px;\n    color: #444;\n    border: 0 solid #444;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-dark .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-dark .tab-item.active .badge, .tabs-striped.tabs-color-dark .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-top.tabs-striped {\n  padding-bottom: 0; }\n  .tabs-top.tabs-striped .tab-item {\n    background: transparent;\n    -webkit-transition: all 0.1s ease;\n    -moz-transition: all 0.1s ease;\n    -ms-transition: all 0.1s ease;\n    -o-transition: all 0.1s ease;\n    transition: all 0.1s ease; }\n    .tabs-top.tabs-striped .tab-item.tab-item-active, .tabs-top.tabs-striped .tab-item.active, .tabs-top.tabs-striped .tab-item.activated {\n      margin-top: 0;\n      margin-bottom: -2px;\n      border-width: 0px 0px 2px 0px !important;\n      border-style: solid; }\n    .tabs-top.tabs-striped .tab-item .badge {\n      -webkit-transition: all 0.2s ease;\n      -moz-transition: all 0.2s ease;\n      -ms-transition: all 0.2s ease;\n      -o-transition: all 0.2s ease;\n      transition: all 0.2s ease; }\n\n/* Allow parent element to have tabs-top */\n/* If you change this, change platform.scss as well */\n.tabs-top > .tabs, .tabs.tabs-top {\n  top: 44px;\n  padding-top: 0;\n  background-position: bottom; }\n  .tabs-top > .tabs .tab-item.tab-item-active .badge, .tabs-top > .tabs .tab-item.active .badge, .tabs-top > .tabs .tab-item.activated .badge, .tabs.tabs-top .tab-item.tab-item-active .badge, .tabs.tabs-top .tab-item.active .badge, .tabs.tabs-top .tab-item.activated .badge {\n    top: 4%; }\n\n.tabs-top ~ .bar-header {\n  border-bottom-width: 0; }\n\n.tab-item {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  overflow: hidden;\n  max-width: 150px;\n  height: 100%;\n  color: inherit;\n  text-align: center;\n  text-decoration: none;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  font-weight: 400;\n  font-size: 14px;\n  font-family: \"Helvetica Neue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n  opacity: 0.7; }\n  .tab-item:hover {\n    cursor: pointer; }\n  .tab-item.tab-hidden {\n    display: none; }\n\n.tabs-item-hide > .tabs, .tabs.tabs-item-hide {\n  display: none; }\n\n.tabs-icon-top > .tabs .tab-item, .tabs-icon-top.tabs .tab-item, .tabs-icon-bottom > .tabs .tab-item, .tabs-icon-bottom.tabs .tab-item {\n  font-size: 12px;\n  line-height: 14px; }\n\n.tab-item .icon {\n  display: block;\n  margin: 0 auto;\n  height: 32px;\n  font-size: 32px; }\n\n.tabs-icon-left.tabs .tab-item, .tabs-icon-left > .tabs .tab-item, .tabs-icon-right.tabs .tab-item, .tabs-icon-right > .tabs .tab-item {\n  font-size: 12px; }\n  .tabs-icon-left.tabs .tab-item .icon, .tabs-icon-left > .tabs .tab-item .icon, .tabs-icon-right.tabs .tab-item .icon, .tabs-icon-right > .tabs .tab-item .icon {\n    display: inline-block;\n    vertical-align: top;\n    margin-top: -0.1em; }\n    .tabs-icon-left.tabs .tab-item .icon:before, .tabs-icon-left > .tabs .tab-item .icon:before, .tabs-icon-right.tabs .tab-item .icon:before, .tabs-icon-right > .tabs .tab-item .icon:before {\n      font-size: 24px;\n      line-height: 49px; }\n\n.tabs-icon-left > .tabs .tab-item .icon, .tabs-icon-left.tabs .tab-item .icon {\n  padding-right: 3px; }\n\n.tabs-icon-right > .tabs .tab-item .icon, .tabs-icon-right.tabs .tab-item .icon {\n  padding-left: 3px; }\n\n.tabs-icon-only > .tabs .icon, .tabs-icon-only.tabs .icon {\n  line-height: inherit; }\n\n.tab-item.has-badge {\n  position: relative; }\n\n.tab-item .badge {\n  position: absolute;\n  top: 4%;\n  right: 33%;\n  right: calc(50% - 26px);\n  padding: 1px 6px;\n  height: auto;\n  font-size: 12px;\n  line-height: 16px; }\n\n/* Navigational tab */\n/* Active state for tab */\n.tab-item.tab-item-active, .tab-item.active, .tab-item.activated {\n  opacity: 1; }\n  .tab-item.tab-item-active.tab-item-light, .tab-item.active.tab-item-light, .tab-item.activated.tab-item-light {\n    color: #fff; }\n  .tab-item.tab-item-active.tab-item-stable, .tab-item.active.tab-item-stable, .tab-item.activated.tab-item-stable {\n    color: #f8f8f8; }\n  .tab-item.tab-item-active.tab-item-positive, .tab-item.active.tab-item-positive, .tab-item.activated.tab-item-positive {\n    color: #4a87ee; }\n  .tab-item.tab-item-active.tab-item-calm, .tab-item.active.tab-item-calm, .tab-item.activated.tab-item-calm {\n    color: #43cee6; }\n  .tab-item.tab-item-active.tab-item-assertive, .tab-item.active.tab-item-assertive, .tab-item.activated.tab-item-assertive {\n    color: #ef4e3a; }\n  .tab-item.tab-item-active.tab-item-balanced, .tab-item.active.tab-item-balanced, .tab-item.activated.tab-item-balanced {\n    color: #66cc33; }\n  .tab-item.tab-item-active.tab-item-energized, .tab-item.active.tab-item-energized, .tab-item.activated.tab-item-energized {\n    color: #f0b840; }\n  .tab-item.tab-item-active.tab-item-royal, .tab-item.active.tab-item-royal, .tab-item.activated.tab-item-royal {\n    color: #8a6de9; }\n  .tab-item.tab-item-active.tab-item-dark, .tab-item.active.tab-item-dark, .tab-item.activated.tab-item-dark {\n    color: #444; }\n\n.item.tabs {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  padding: 0; }\n  .item.tabs .icon:before {\n    position: relative; }\n\n.tab-item.disabled, .tab-item[disabled] {\n  opacity: 0.4;\n  cursor: default;\n  pointer-events: none; }\n\n/** Platform styles **/\n.tab-item.tab-item-android {\n  border-top: 2px solid inherit; }\n\n/**\n * Menus\n * --------------------------------------------------\n * Side panel structure\n */\n.menu {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  z-index: 0;\n  overflow: hidden;\n  min-height: 100%;\n  max-height: 100%;\n  width: 275px;\n  background-color: #fff; }\n  .menu .scroll-content {\n    z-index: 10; }\n  .menu .bar-header {\n    z-index: 11; }\n\n.menu-content {\n  -webkit-transform: none;\n  -moz-transform: none;\n  transform: none;\n  box-shadow: -1px 0px 2px rgba(0, 0, 0, 0.2), 1px 0px 2px rgba(0, 0, 0, 0.2); }\n\n.menu-open .menu-content .pane, .menu-open .menu-content .scroll-content {\n  pointer-events: none; }\n\n.grade-b .menu-content, .grade-c .menu-content {\n  -webkit-box-sizing: content-box;\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  right: -1px;\n  left: -1px;\n  border-right: 1px solid #ccc;\n  border-left: 1px solid #ccc;\n  box-shadow: none; }\n\n.menu-left {\n  left: 0; }\n\n.menu-right {\n  right: 0; }\n\n.aside-open.aside-resizing .menu-right {\n  display: none; }\n\n.menu-animated {\n  -webkit-transition: -webkit-transform 200ms ease;\n  -moz-transition: -moz-transform 200ms ease;\n  transition: transform 200ms ease; }\n\n/**\n * Modals\n * --------------------------------------------------\n * Modals are independent windows that slide in from off-screen.\n */\n.modal-backdrop {\n  -webkit-transition: background-color 300ms ease-in-out;\n  -moz-transition: background-color 300ms ease-in-out;\n  transition: background-color 300ms ease-in-out;\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 10;\n  width: 100%;\n  height: 100%;\n  background-color: rgba(0, 0, 0, 0); }\n  .modal-backdrop.active {\n    background-color: rgba(0, 0, 0, 0.5); }\n\n.modal {\n  display: block;\n  position: absolute;\n  top: 0;\n  z-index: 10;\n  overflow: hidden;\n  min-height: 100%;\n  width: 100%;\n  background-color: #fff; }\n\n@media (min-width: 680px) {\n  .modal {\n    top: 20%;\n    right: 20%;\n    bottom: 20%;\n    left: 20%;\n    overflow: visible;\n    min-height: 240px;\n    width: 60%; }\n  .modal.ng-leave-active {\n    bottom: 0; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .bar-header:not(.bar-subheader) {\n    height: 44px; }\n    .platform-ios.platform-cordova .modal-wrapper .modal .bar-header:not(.bar-subheader) > * {\n      margin-top: 0; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .tabs-top > .tabs, .platform-ios.platform-cordova .modal-wrapper .modal .tabs.tabs-top {\n    top: 44px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-header, .platform-ios.platform-cordova .modal-wrapper .modal .bar-subheader {\n    top: 44px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-subheader {\n    top: 88px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-tabs-top {\n    top: 93px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-header.has-subheader.has-tabs-top {\n    top: 137px; } }\n\n.modal-open {\n  pointer-events: none; }\n  .modal-open .modal, .modal-open .modal-backdrop {\n    pointer-events: auto; }\n  .modal-open.loading-active .modal, .modal-open.loading-active .modal-backdrop {\n    pointer-events: none; }\n\n/**\n * Popovers\n * --------------------------------------------------\n * Popovers are independent views which float over content\n */\n.popover-backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 10;\n  width: 100%;\n  height: 100%;\n  background-color: rgba(0, 0, 0, 0); }\n  .popover-backdrop.active {\n    background-color: rgba(0, 0, 0, 0.1); }\n\n.popover {\n  position: absolute;\n  top: 25%;\n  left: 50%;\n  z-index: 10;\n  display: block;\n  margin-left: -110px;\n  height: 280px;\n  width: 220px;\n  background-color: #fff;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n  opacity: 0; }\n  .popover .item:first-child {\n    border-top: 0; }\n  .popover .item:last-child {\n    border-bottom: 0; }\n  .popover.popover-top {\n    margin-top: 12px; }\n  .popover.popover-bottom {\n    margin-top: -12px; }\n\n.popover, .popover .bar-header {\n  border-radius: 2px; }\n\n.popover .scroll-content {\n  z-index: 1;\n  margin: 2px 0; }\n\n.popover .bar-header {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0; }\n\n.popover .has-header {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0; }\n\n.popover-arrow {\n  display: none; }\n\n.platform-ios .popover {\n  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08); }\n.platform-ios .popover, .platform-ios .popover .bar-header {\n  border-radius: 10px; }\n.platform-ios .popover .scroll-content {\n  margin: 8px 0;\n  border-radius: 10px; }\n.platform-ios .popover .scroll-content.has-header {\n  margin-top: 0; }\n.platform-ios .popover-arrow {\n  position: absolute;\n  display: block;\n  width: 30px;\n  height: 19px;\n  overflow: hidden; }\n  .platform-ios .popover-arrow:after {\n    position: absolute;\n    top: 12px;\n    left: 5px;\n    width: 20px;\n    height: 20px;\n    background-color: #fff;\n    border-radius: 3px;\n    content: '';\n    -webkit-transform: rotate(-45deg);\n    -moz-transform: rotate(-45deg);\n    transform: rotate(-45deg); }\n.platform-ios .popover-top .popover-arrow {\n  top: -17px; }\n.platform-ios .popover-bottom .popover-arrow {\n  bottom: -10px; }\n  .platform-ios .popover-bottom .popover-arrow:after {\n    top: -6px; }\n\n.platform-android .popover {\n  background-color: #fafafa;\n  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }\n  .platform-android .popover .item {\n    border-color: #fafafa;\n    background-color: #fafafa;\n    color: #4d4d4d; }\n  .platform-android .popover.popover-top {\n    margin-top: -32px; }\n  .platform-android .popover.popover-bottom {\n    margin-top: 32px; }\n.platform-android .popover-backdrop, .platform-android .popover-backdrop.active {\n  background-color: transparent; }\n\n.popover-open {\n  pointer-events: none; }\n  .popover-open .popover, .popover-open .popover-backdrop {\n    pointer-events: auto; }\n  .popover-open.loading-active .popover, .popover-open.loading-active .popover-backdrop {\n    pointer-events: none; }\n\n@media (min-width: 680px) {\n  .popover {\n    width: 360px; } }\n\n/**\n * Popups\n * --------------------------------------------------\n */\n.popup-container {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  right: 0;\n  background: rgba(0, 0, 0, 0);\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  z-index: 12;\n  visibility: hidden; }\n  .popup-container.popup-showing {\n    visibility: visible; }\n  .popup-container.popup-hidden .popup {\n    -webkit-animation-name: scaleOut;\n    -moz-animation-name: scaleOut;\n    animation-name: scaleOut;\n    -webkit-animation-duration: 0.1s;\n    -moz-animation-duration: 0.1s;\n    animation-duration: 0.1s;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .popup-container.active .popup {\n    -webkit-animation-name: superScaleIn;\n    -moz-animation-name: superScaleIn;\n    animation-name: superScaleIn;\n    -webkit-animation-duration: 0.2s;\n    -moz-animation-duration: 0.2s;\n    animation-duration: 0.2s;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .popup-container .popup {\n    width: 250px;\n    max-width: 100%;\n    max-height: 90%;\n    border-radius: 0px;\n    background-color: rgba(255, 255, 255, 0.9);\n    display: -webkit-box;\n    display: -webkit-flex;\n    display: -moz-box;\n    display: -moz-flex;\n    display: -ms-flexbox;\n    display: flex;\n    -webkit-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -moz-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n\n.popup-head {\n  padding: 15px 0px;\n  border-bottom: 1px solid #eee;\n  text-align: center; }\n\n.popup-title {\n  margin: 0;\n  padding: 0;\n  font-size: 15px; }\n\n.popup-sub-title {\n  margin: 5px 0 0 0;\n  padding: 0;\n  font-weight: normal;\n  font-size: 11px; }\n\n.popup-body {\n  padding: 10px;\n  overflow: scroll; }\n\n.popup-buttons {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: row;\n  -moz-flex-direction: row;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  padding: 10px;\n  min-height: 65px; }\n  .popup-buttons .button {\n    -webkit-box-flex: 1;\n    -webkit-flex: 1;\n    -moz-box-flex: 1;\n    -moz-flex: 1;\n    -ms-flex: 1;\n    flex: 1;\n    min-height: 45px;\n    border-radius: 2px;\n    line-height: 20px;\n    margin-right: 5px; }\n    .popup-buttons .button:last-child {\n      margin-right: 0px; }\n\n.popup-open {\n  pointer-events: none; }\n  .popup-open.modal-open .modal {\n    pointer-events: none; }\n  .popup-open .popup-backdrop, .popup-open .popup {\n    pointer-events: auto; }\n\n/**\n * Loading\n * --------------------------------------------------\n */\n.loading-container {\n  position: absolute;\n  left: 0;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  z-index: 13;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  -webkit-transition: 0.2s opacity linear;\n  -moz-transition: 0.2s opacity linear;\n  transition: 0.2s opacity linear;\n  visibility: hidden;\n  opacity: 0; }\n  .loading-container.visible {\n    visibility: visible; }\n  .loading-container.active {\n    opacity: 1; }\n  .loading-container .loading {\n    padding: 20px;\n    border-radius: 5px;\n    background-color: rgba(0, 0, 0, 0.7);\n    color: #fff;\n    text-align: center;\n    text-overflow: ellipsis;\n    font-size: 15px; }\n    .loading-container .loading h1, .loading-container .loading h2, .loading-container .loading h3, .loading-container .loading h4, .loading-container .loading h5, .loading-container .loading h6 {\n      color: #fff; }\n\n/**\n * Items\n * --------------------------------------------------\n */\n.item {\n  border-color: #ddd;\n  background-color: #fff;\n  color: #444;\n  position: relative;\n  z-index: 2;\n  display: block;\n  margin: -1px;\n  padding: 16px;\n  border-width: 1px;\n  border-style: solid;\n  font-size: 16px; }\n  .item h2 {\n    margin: 0 0 4px 0;\n    font-size: 16px; }\n  .item h3 {\n    margin: 0 0 4px 0;\n    font-size: 14px; }\n  .item h4 {\n    margin: 0 0 4px 0;\n    font-size: 12px; }\n  .item h5, .item h6 {\n    margin: 0 0 3px 0;\n    font-size: 10px; }\n  .item p {\n    color: #666;\n    font-size: 14px; }\n  .item h1:last-child, .item h2:last-child, .item h3:last-child, .item h4:last-child, .item h5:last-child, .item h6:last-child, .item p:last-child {\n    margin-bottom: 0; }\n  .item .badge {\n    display: -webkit-box;\n    display: -webkit-flex;\n    display: -moz-box;\n    display: -moz-flex;\n    display: -ms-flexbox;\n    display: flex;\n    position: absolute;\n    top: 16px;\n    right: 32px; }\n  .item.item-button-right .badge {\n    right: 67px; }\n  .item.item-divider .badge {\n    top: 8px; }\n  .item .badge + .badge {\n    margin-right: 5px; }\n  .item.item-light {\n    border-color: #ddd;\n    background-color: #fff;\n    color: #444; }\n  .item.item-stable {\n    border-color: #b2b2b2;\n    background-color: #f8f8f8;\n    color: #444; }\n  .item.item-positive {\n    border-color: #145fd7;\n    background-color: #4a87ee;\n    color: #fff; }\n  .item.item-calm {\n    border-color: #1aacc3;\n    background-color: #43cee6;\n    color: #fff; }\n  .item.item-assertive {\n    border-color: #cc2311;\n    background-color: #ef4e3a;\n    color: #fff; }\n  .item.item-balanced {\n    border-color: #498f24;\n    background-color: #66cc33;\n    color: #fff; }\n  .item.item-energized {\n    border-color: #d39211;\n    background-color: #f0b840;\n    color: #fff; }\n  .item.item-royal {\n    border-color: #552bdf;\n    background-color: #8a6de9;\n    color: #fff; }\n  .item.item-dark {\n    border-color: #111;\n    background-color: #444;\n    color: #fff; }\n  .item[ng-click]:hover {\n    cursor: pointer; }\n\n.item.active, .item.activated, .item-complex.active .item-content, .item-complex.activated .item-content, .item .item-content.active, .item .item-content.activated {\n  border-color: #ccc;\n  background-color: #D9D9D9; }\n  .item.active.item-light, .item.activated.item-light, .item-complex.active .item-content.item-light, .item-complex.activated .item-content.item-light, .item .item-content.active.item-light, .item .item-content.activated.item-light {\n    border-color: #ccc;\n    background-color: #fafafa; }\n  .item.active.item-stable, .item.activated.item-stable, .item-complex.active .item-content.item-stable, .item-complex.activated .item-content.item-stable, .item .item-content.active.item-stable, .item .item-content.activated.item-stable {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n  .item.active.item-positive, .item.activated.item-positive, .item-complex.active .item-content.item-positive, .item-complex.activated .item-content.item-positive, .item .item-content.active.item-positive, .item .item-content.activated.item-positive {\n    border-color: #145fd7;\n    background-color: #145fd7; }\n  .item.active.item-calm, .item.activated.item-calm, .item-complex.active .item-content.item-calm, .item-complex.activated .item-content.item-calm, .item .item-content.active.item-calm, .item .item-content.activated.item-calm {\n    border-color: #1aacc3;\n    background-color: #1aacc3; }\n  .item.active.item-assertive, .item.activated.item-assertive, .item-complex.active .item-content.item-assertive, .item-complex.activated .item-content.item-assertive, .item .item-content.active.item-assertive, .item .item-content.activated.item-assertive {\n    border-color: #cc2311;\n    background-color: #cc2311; }\n  .item.active.item-balanced, .item.activated.item-balanced, .item-complex.active .item-content.item-balanced, .item-complex.activated .item-content.item-balanced, .item .item-content.active.item-balanced, .item .item-content.activated.item-balanced {\n    border-color: #498f24;\n    background-color: #498f24; }\n  .item.active.item-energized, .item.activated.item-energized, .item-complex.active .item-content.item-energized, .item-complex.activated .item-content.item-energized, .item .item-content.active.item-energized, .item .item-content.activated.item-energized {\n    border-color: #d39211;\n    background-color: #d39211; }\n  .item.active.item-royal, .item.activated.item-royal, .item-complex.active .item-content.item-royal, .item-complex.activated .item-content.item-royal, .item .item-content.active.item-royal, .item .item-content.activated.item-royal {\n    border-color: #552bdf;\n    background-color: #552bdf; }\n  .item.active.item-dark, .item.activated.item-dark, .item-complex.active .item-content.item-dark, .item-complex.activated .item-content.item-dark, .item .item-content.active.item-dark, .item .item-content.activated.item-dark {\n    border-color: #000;\n    background-color: #262626; }\n\n.item, .item h1, .item h2, .item h3, .item h4, .item h5, .item h6, .item p, .item-content, .item-content h1, .item-content h2, .item-content h3, .item-content h4, .item-content h5, .item-content h6, .item-content p {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap; }\n\na.item {\n  color: inherit;\n  text-decoration: none; }\n  a.item:hover, a.item:focus {\n    text-decoration: none; }\n\n/**\n * Complex Items\n * --------------------------------------------------\n * Adding .item-complex allows the .item to be slidable and\n * have options underneath the button, but also requires an\n * additional .item-content element inside .item.\n * Basically .item-complex removes any default settings which\n * .item added, so that .item-content looks them as just .item.\n */\n.item-complex, a.item.item-complex, button.item.item-complex {\n  padding: 0; }\n\n.item-complex .item-content, .item-radio .item-content {\n  position: relative;\n  z-index: 2;\n  padding: 16px 49px 16px 16px;\n  border: none;\n  background-color: white; }\n\na.item-content {\n  display: block;\n  color: inherit;\n  text-decoration: none; }\n\n.item-text-wrap .item, .item-text-wrap .item-content, .item-text-wrap, .item-text-wrap h1, .item-text-wrap h2, .item-text-wrap h3, .item-text-wrap h4, .item-text-wrap h5, .item-text-wrap h6, .item-text-wrap p, .item-complex.item-text-wrap .item-content, .item-body h1, .item-body h2, .item-body h3, .item-body h4, .item-body h5, .item-body h6, .item-body p {\n  overflow: visible;\n  white-space: normal; }\n\n.item-complex.item-text-wrap, .item-complex.item-text-wrap h1, .item-complex.item-text-wrap h2, .item-complex.item-text-wrap h3, .item-complex.item-text-wrap h4, .item-complex.item-text-wrap h5, .item-complex.item-text-wrap h6, .item-complex.item-text-wrap p {\n  overflow: visible;\n  white-space: normal; }\n\n.item-complex.item-light > .item-content {\n  border-color: #ddd;\n  background-color: #fff;\n  color: #444; }\n  .item-complex.item-light > .item-content.active, .item-complex.item-light > .item-content:active {\n    border-color: #ccc;\n    background-color: #fafafa; }\n.item-complex.item-stable > .item-content {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  color: #444; }\n  .item-complex.item-stable > .item-content.active, .item-complex.item-stable > .item-content:active {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n.item-complex.item-positive > .item-content {\n  border-color: #145fd7;\n  background-color: #4a87ee;\n  color: #fff; }\n  .item-complex.item-positive > .item-content.active, .item-complex.item-positive > .item-content:active {\n    border-color: #145fd7;\n    background-color: #145fd7; }\n.item-complex.item-calm > .item-content {\n  border-color: #1aacc3;\n  background-color: #43cee6;\n  color: #fff; }\n  .item-complex.item-calm > .item-content.active, .item-complex.item-calm > .item-content:active {\n    border-color: #1aacc3;\n    background-color: #1aacc3; }\n.item-complex.item-assertive > .item-content {\n  border-color: #cc2311;\n  background-color: #ef4e3a;\n  color: #fff; }\n  .item-complex.item-assertive > .item-content.active, .item-complex.item-assertive > .item-content:active {\n    border-color: #cc2311;\n    background-color: #cc2311; }\n.item-complex.item-balanced > .item-content {\n  border-color: #498f24;\n  background-color: #66cc33;\n  color: #fff; }\n  .item-complex.item-balanced > .item-content.active, .item-complex.item-balanced > .item-content:active {\n    border-color: #498f24;\n    background-color: #498f24; }\n.item-complex.item-energized > .item-content {\n  border-color: #d39211;\n  background-color: #f0b840;\n  color: #fff; }\n  .item-complex.item-energized > .item-content.active, .item-complex.item-energized > .item-content:active {\n    border-color: #d39211;\n    background-color: #d39211; }\n.item-complex.item-royal > .item-content {\n  border-color: #552bdf;\n  background-color: #8a6de9;\n  color: #fff; }\n  .item-complex.item-royal > .item-content.active, .item-complex.item-royal > .item-content:active {\n    border-color: #552bdf;\n    background-color: #552bdf; }\n.item-complex.item-dark > .item-content {\n  border-color: #111;\n  background-color: #444;\n  color: #fff; }\n  .item-complex.item-dark > .item-content.active, .item-complex.item-dark > .item-content:active {\n    border-color: #000;\n    background-color: #262626; }\n\n/**\n * Item Icons\n * --------------------------------------------------\n */\n.item-icon-left .icon, .item-icon-right .icon {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 0;\n  height: 100%;\n  font-size: 32px; }\n  .item-icon-left .icon:before, .item-icon-right .icon:before {\n    display: block;\n    width: 32px;\n    text-align: center; }\n\n.item .fill-icon {\n  min-width: 30px;\n  min-height: 30px;\n  font-size: 28px; }\n\n.item-icon-left {\n  padding-left: 54px; }\n  .item-icon-left .icon {\n    left: 11px; }\n\n.item-complex.item-icon-left {\n  padding-left: 0; }\n  .item-complex.item-icon-left .item-content {\n    padding-left: 54px; }\n\n.item-icon-right {\n  padding-right: 54px; }\n  .item-icon-right .icon {\n    right: 11px; }\n\n.item-complex.item-icon-right {\n  padding-right: 0; }\n  .item-complex.item-icon-right .item-content {\n    padding-right: 54px; }\n\n.item-icon-left.item-icon-right .icon:first-child {\n  right: auto; }\n\n.item-icon-left.item-icon-right .icon:last-child, .item-icon-left .item-delete .icon {\n  left: auto; }\n\n.item-icon-left .icon-accessory, .item-icon-right .icon-accessory {\n  color: #ccc;\n  font-size: 16px; }\n\n.item-icon-left .icon-accessory {\n  left: 3px; }\n\n.item-icon-right .icon-accessory {\n  right: 3px; }\n\n/**\n * Item Button\n * --------------------------------------------------\n * An item button is a child button inside an .item (not the entire .item)\n */\n.item-button-left {\n  padding-left: 72px; }\n\n.item-button-left > .button, .item-button-left .item-content > .button {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 8px;\n  left: 11px;\n  min-width: 34px;\n  min-height: 34px;\n  font-size: 18px;\n  line-height: 32px; }\n  .item-button-left > .button .icon:before, .item-button-left .item-content > .button .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: 31px; }\n  .item-button-left > .button > .button, .item-button-left .item-content > .button > .button {\n    margin: 0px 2px;\n    min-height: 34px;\n    font-size: 18px;\n    line-height: 32px; }\n\n.item-button-right, a.item.item-button-right, button.item.item-button-right {\n  padding-right: 80px; }\n\n.item-button-right > .button, .item-button-right .item-content > .button, .item-button-right > .buttons, .item-button-right .item-content > .buttons {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 8px;\n  right: 16px;\n  min-width: 34px;\n  min-height: 34px;\n  font-size: 18px;\n  line-height: 32px; }\n  .item-button-right > .button .icon:before, .item-button-right .item-content > .button .icon:before, .item-button-right > .buttons .icon:before, .item-button-right .item-content > .buttons .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: 31px; }\n  .item-button-right > .button > .button, .item-button-right .item-content > .button > .button, .item-button-right > .buttons > .button, .item-button-right .item-content > .buttons > .button {\n    margin: 0px 2px;\n    min-width: 34px;\n    min-height: 34px;\n    font-size: 18px;\n    line-height: 32px; }\n\n.item-avatar, .item-avatar .item-content, .item-avatar-left, .item-avatar-left .item-content {\n  padding-left: 72px;\n  min-height: 72px; }\n  .item-avatar > img:first-child, .item-avatar .item-image, .item-avatar .item-content > img:first-child, .item-avatar .item-content .item-image, .item-avatar-left > img:first-child, .item-avatar-left .item-image, .item-avatar-left .item-content > img:first-child, .item-avatar-left .item-content .item-image {\n    position: absolute;\n    top: 16px;\n    left: 16px;\n    max-width: 40px;\n    max-height: 40px;\n    width: 100%;\n    border-radius: 4px; }\n\n.item-avatar-right, .item-avatar-right .item-content {\n  padding-right: 72px;\n  min-height: 72px; }\n  .item-avatar-right > img:first-child, .item-avatar-right .item-image, .item-avatar-right .item-content > img:first-child, .item-avatar-right .item-content .item-image {\n    position: absolute;\n    top: 16px;\n    right: 16px;\n    max-width: 40px;\n    max-height: 40px;\n    width: 100%;\n    border-radius: 4px; }\n\n.item-thumbnail-left, .item-thumbnail-left .item-content {\n  padding-left: 106px;\n  min-height: 100px; }\n  .item-thumbnail-left > img:first-child, .item-thumbnail-left .item-image, .item-thumbnail-left .item-content > img:first-child, .item-thumbnail-left .item-content .item-image {\n    position: absolute;\n    top: 10px;\n    left: 10px;\n    max-width: 80px;\n    max-height: 80px;\n    width: 100%; }\n\n.item-avatar.item-complex, .item-avatar-left.item-complex, .item-thumbnail-left.item-complex {\n  padding-left: 0; }\n\n.item-thumbnail-right, .item-thumbnail-right .item-content {\n  padding-right: 106px;\n  min-height: 100px; }\n  .item-thumbnail-right > img:first-child, .item-thumbnail-right .item-image, .item-thumbnail-right .item-content > img:first-child, .item-thumbnail-right .item-content .item-image {\n    position: absolute;\n    top: 10px;\n    right: 10px;\n    max-width: 80px;\n    max-height: 80px;\n    width: 100%; }\n\n.item-avatar-right.item-complex, .item-thumbnail-right.item-complex {\n  padding-right: 0; }\n\n.item-image {\n  padding: 0;\n  text-align: center; }\n  .item-image img:first-child, .item-image .list-img {\n    width: 100%;\n    vertical-align: middle; }\n\n.item-body {\n  overflow: auto;\n  padding: 16px;\n  text-overflow: inherit;\n  white-space: normal; }\n  .item-body h1, .item-body h2, .item-body h3, .item-body h4, .item-body h5, .item-body h6, .item-body p {\n    margin-top: 16px;\n    margin-bottom: 16px; }\n\n.item-divider {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  min-height: 30px;\n  background-color: #f5f5f5;\n  color: #222;\n  font-weight: bold; }\n\n.item-note {\n  float: right;\n  color: #aaa;\n  font-size: 14px; }\n\n.item-left-editable .item-content, .item-right-editable .item-content {\n  -webkit-transition-duration: 250ms;\n  -moz-transition-duration: 250ms;\n  transition-duration: 250ms;\n  -webkit-transition-timing-function: ease-in-out;\n  -moz-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  -webkit-transition-property: -webkit-transform;\n  -moz-transition-property: -moz-transform;\n  transition-property: transform; }\n\n.list-left-editing .item-left-editable .item-content, .item-left-editing.item-left-editable .item-content {\n  -webkit-transform: translate3d(50px, 0, 0);\n  -moz-transform: translate3d(50px, 0, 0);\n  transform: translate3d(50px, 0, 0); }\n\n.list-right-editing .item-right-editable .item-content, .item-right-editing.item-right-editable .item-content {\n  -webkit-transform: translate3d(-50px, 0, 0);\n  -moz-transform: translate3d(-50px, 0, 0);\n  transform: translate3d(-50px, 0, 0); }\n\n.item-left-edit {\n  -webkit-transition: all ease-in-out 125ms;\n  -moz-transition: all ease-in-out 125ms;\n  transition: all ease-in-out 125ms;\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 0;\n  width: 50px;\n  height: 100%;\n  line-height: 100%;\n  display: none;\n  opacity: 0;\n  -webkit-transform: translate3d(-21px, 0, 0);\n  -moz-transform: translate3d(-21px, 0, 0);\n  transform: translate3d(-21px, 0, 0); }\n  .item-left-edit .button {\n    height: 100%; }\n    .item-left-edit .button.icon {\n      display: -webkit-box;\n      display: -webkit-flex;\n      display: -moz-box;\n      display: -moz-flex;\n      display: -ms-flexbox;\n      display: flex;\n      -webkit-box-align: center;\n      -ms-flex-align: center;\n      -webkit-align-items: center;\n      -moz-align-items: center;\n      align-items: center;\n      position: absolute;\n      top: 0;\n      height: 100%; }\n  .item-left-edit.visible {\n    display: block; }\n    .item-left-edit.visible.active {\n      opacity: 1;\n      -webkit-transform: translate3d(8px, 0, 0);\n      -moz-transform: translate3d(8px, 0, 0);\n      transform: translate3d(8px, 0, 0); }\n\n.list-left-editing .item-left-edit {\n  -webkit-transition-delay: 125ms;\n  -moz-transition-delay: 125ms;\n  transition-delay: 125ms; }\n\n.item-delete .button.icon {\n  color: #ef4e3a;\n  font-size: 24px; }\n  .item-delete .button.icon:hover {\n    opacity: 0.7; }\n\n.item-right-edit {\n  -webkit-transition: all ease-in-out 125ms;\n  -moz-transition: all ease-in-out 125ms;\n  transition: all ease-in-out 125ms;\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 0;\n  width: 75px;\n  height: 100%;\n  background: inherit;\n  padding-left: 20px;\n  display: none;\n  opacity: 0;\n  -webkit-transform: translate3d(25px, 0, 0);\n  -moz-transform: translate3d(25px, 0, 0);\n  transform: translate3d(25px, 0, 0); }\n  .item-right-edit .button {\n    min-width: 50px;\n    height: 100%; }\n    .item-right-edit .button.icon {\n      display: -webkit-box;\n      display: -webkit-flex;\n      display: -moz-box;\n      display: -moz-flex;\n      display: -ms-flexbox;\n      display: flex;\n      -webkit-box-align: center;\n      -ms-flex-align: center;\n      -webkit-align-items: center;\n      -moz-align-items: center;\n      align-items: center;\n      position: absolute;\n      top: 0;\n      height: 100%;\n      font-size: 32px; }\n  .item-right-edit.visible {\n    display: block;\n    z-index: 3; }\n    .item-right-edit.visible.active {\n      opacity: 1;\n      -webkit-transform: translate3d(0, 0, 0);\n      -moz-transform: translate3d(0, 0, 0);\n      transform: translate3d(0, 0, 0); }\n\n.list-right-editing .item-right-edit {\n  -webkit-transition-delay: 125ms;\n  -moz-transition-delay: 125ms;\n  transition-delay: 125ms; }\n\n.item-reorder .button.icon {\n  color: #444;\n  font-size: 32px; }\n\n.item-reordering {\n  position: absolute;\n  left: 0;\n  top: 0;\n  z-index: 9;\n  width: 100%;\n  box-shadow: 0px 0px 10px 0px #aaa; }\n  .item-reordering .item-reorder {\n    z-index: 1; }\n\n.item-placeholder {\n  opacity: 0.7; }\n\n/**\n * The hidden right-side buttons that can be exposed under a list item\n * with dragging.\n */\n.item-options {\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 1;\n  height: 100%; }\n  .item-options .button {\n    height: 100%;\n    border: none;\n    border-radius: 0; }\n\n/**\n * Lists\n * --------------------------------------------------\n */\n.list {\n  position: relative;\n  padding-top: 1px;\n  padding-bottom: 1px;\n  padding-left: 0;\n  margin-bottom: 20px; }\n\n.list:last-child {\n  margin-bottom: 0px; }\n  .list:last-child.card {\n    margin-bottom: 40px; }\n\n/**\n * List Header\n * --------------------------------------------------\n */\n.list-header {\n  margin-top: 20px;\n  padding: 5px 15px;\n  background-color: transparent;\n  color: #222;\n  font-weight: bold; }\n\n.card.list .list-item {\n  padding-right: 1px;\n  padding-left: 1px; }\n\n/**\n * Cards and Inset Lists\n * --------------------------------------------------\n * A card and list-inset are close to the same thing, except a card as a box shadow.\n */\n.card, .list-inset {\n  overflow: hidden;\n  margin: 20px 10px;\n  border-radius: 2px;\n  background-color: #fff; }\n\n.card {\n  padding-top: 1px;\n  padding-bottom: 1px;\n  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }\n\n.padding .card, .padding .list-inset {\n  margin-left: 0;\n  margin-right: 0; }\n\n.card .item:first-child, .list-inset .item:first-child, .padding > .list .item:first-child {\n  border-top-left-radius: 2px;\n  border-top-right-radius: 2px; }\n  .card .item:first-child .item-content, .list-inset .item:first-child .item-content, .padding > .list .item:first-child .item-content {\n    border-top-left-radius: 2px;\n    border-top-right-radius: 2px; }\n.card .item:last-child, .list-inset .item:last-child, .padding > .list .item:last-child {\n  border-bottom-right-radius: 2px;\n  border-bottom-left-radius: 2px; }\n  .card .item:last-child .item-content, .list-inset .item:last-child .item-content, .padding > .list .item:last-child .item-content {\n    border-bottom-right-radius: 2px;\n    border-bottom-left-radius: 2px; }\n\n.card .item:last-child, .list-inset .item:last-child {\n  margin-bottom: -1px; }\n\n.card .item, .list-inset .item, .padding > .list .item, .padding-horizontal > .list .item {\n  margin-right: 0;\n  margin-left: 0; }\n  .card .item.item-input input, .list-inset .item.item-input input, .padding > .list .item.item-input input, .padding-horizontal > .list .item.item-input input {\n    padding-right: 44px; }\n\n.padding-left > .list .item {\n  margin-left: 0; }\n\n.padding-right > .list .item {\n  margin-right: 0; }\n\n/**\n * Badges\n * --------------------------------------------------\n */\n.badge {\n  background-color: transparent;\n  color: #AAAAAA;\n  z-index: 1;\n  display: inline-block;\n  padding: 3px 8px;\n  min-width: 10px;\n  border-radius: 10px;\n  vertical-align: baseline;\n  text-align: center;\n  white-space: nowrap;\n  font-weight: bold;\n  font-size: 14px;\n  line-height: 16px; }\n  .badge:empty {\n    display: none; }\n\n.tabs .tab-item .badge.badge-light, .badge.badge-light {\n  background-color: #fff;\n  color: #444; }\n.tabs .tab-item .badge.badge-stable, .badge.badge-stable {\n  background-color: #f8f8f8;\n  color: #444; }\n.tabs .tab-item .badge.badge-positive, .badge.badge-positive {\n  background-color: #4a87ee;\n  color: #fff; }\n.tabs .tab-item .badge.badge-calm, .badge.badge-calm {\n  background-color: #43cee6;\n  color: #fff; }\n.tabs .tab-item .badge.badge-assertive, .badge.badge-assertive {\n  background-color: #ef4e3a;\n  color: #fff; }\n.tabs .tab-item .badge.badge-balanced, .badge.badge-balanced {\n  background-color: #66cc33;\n  color: #fff; }\n.tabs .tab-item .badge.badge-energized, .badge.badge-energized {\n  background-color: #f0b840;\n  color: #fff; }\n.tabs .tab-item .badge.badge-royal, .badge.badge-royal {\n  background-color: #8a6de9;\n  color: #fff; }\n.tabs .tab-item .badge.badge-dark, .badge.badge-dark {\n  background-color: #444;\n  color: #fff; }\n\n.button .badge {\n  position: relative;\n  top: -1px; }\n\n/**\n * Slide Box\n * --------------------------------------------------\n */\n.slider {\n  position: relative;\n  visibility: hidden;\n  overflow: hidden; }\n\n.slider-slides {\n  position: relative;\n  height: 100%; }\n\n.slider-slide {\n  position: relative;\n  display: block;\n  float: left;\n  width: 100%;\n  height: 100%;\n  vertical-align: top; }\n\n.slider-slide-image > img {\n  width: 100%; }\n\n.slider-pager {\n  position: absolute;\n  bottom: 20px;\n  z-index: 1;\n  width: 100%;\n  height: 15px;\n  text-align: center; }\n  .slider-pager .slider-pager-page {\n    display: inline-block;\n    margin: 0px 3px;\n    width: 15px;\n    color: #000;\n    text-decoration: none;\n    opacity: 0.3; }\n    .slider-pager .slider-pager-page.active {\n      -webkit-transition: opacity 0.4s ease-in;\n      -moz-transition: opacity 0.4s ease-in;\n      transition: opacity 0.4s ease-in;\n      opacity: 1; }\n\n/**\n * Forms\n * --------------------------------------------------\n */\nform {\n  margin: 0 0 1.42857; }\n\nlegend {\n  display: block;\n  margin-bottom: 1.42857;\n  padding: 0;\n  width: 100%;\n  border: 1px solid #ddd;\n  color: #444;\n  font-size: 21px;\n  line-height: 2.85714; }\n  legend small {\n    color: #f8f8f8;\n    font-size: 1.07143; }\n\nlabel, input, button, select, textarea {\n  font-weight: normal;\n  font-size: 14px;\n  line-height: 1.42857; }\n\ninput, button, select, textarea {\n  font-family: \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif; }\n\n.item-input {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: relative;\n  overflow: hidden;\n  padding: 6px 0 5px 16px; }\n  .item-input input {\n    -webkit-border-radius: 0;\n    -moz-border-radius: 0;\n    border-radius: 0;\n    -webkit-box-flex: 1;\n    -webkit-flex: 1 0 220px;\n    -moz-box-flex: 1;\n    -moz-flex: 1 0 220px;\n    -ms-flex: 1 0 220px;\n    flex: 1 0 220px;\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none;\n    margin: 0;\n    padding-right: 24px;\n    background-color: transparent; }\n  .item-input .button .icon {\n    -webkit-box-flex: 0;\n    -webkit-flex: 0 0 24px;\n    -moz-box-flex: 0;\n    -moz-flex: 0 0 24px;\n    -ms-flex: 0 0 24px;\n    flex: 0 0 24px;\n    position: static;\n    display: inline-block;\n    height: auto;\n    text-align: center;\n    font-size: 16px; }\n  .item-input .button-bar {\n    -webkit-border-radius: 0;\n    -moz-border-radius: 0;\n    border-radius: 0;\n    -webkit-box-flex: 1;\n    -webkit-flex: 1 0 220px;\n    -moz-box-flex: 1;\n    -moz-flex: 1 0 220px;\n    -ms-flex: 1 0 220px;\n    flex: 1 0 220px;\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none; }\n  .item-input .icon {\n    min-width: 14px; }\n\n.item-input-inset {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: relative;\n  overflow: hidden;\n  padding: 10.66667px; }\n\n.item-input-wrapper {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-flex: 1;\n  -webkit-flex: 1 0;\n  -moz-box-flex: 1;\n  -moz-flex: 1 0;\n  -ms-flex: 1 0;\n  flex: 1 0;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  -webkit-border-radius: 4px;\n  -moz-border-radius: 4px;\n  border-radius: 4px;\n  padding-right: 8px;\n  padding-left: 8px;\n  background: #eee; }\n\n.item-input-inset .item-input-wrapper input {\n  padding-left: 4px;\n  height: 29px;\n  background: transparent;\n  line-height: 18px; }\n\n.item-input-wrapper ~ .button {\n  margin-left: 10.66667px; }\n\n.input-label {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1 0 100px;\n  -moz-box-flex: 1;\n  -moz-flex: 1 0 100px;\n  -ms-flex: 1 0 100px;\n  flex: 1 0 100px;\n  display: table;\n  padding: 7px 10px 7px 0px;\n  max-width: 200px;\n  width: 35%;\n  color: #444;\n  font-size: 16px; }\n\n.placeholder-icon {\n  color: #aaa; }\n  .placeholder-icon:first-child {\n    padding-right: 6px; }\n  .placeholder-icon:last-child {\n    padding-left: 6px; }\n\n.item-stacked-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none; }\n  .item-stacked-label .input-label, .item-stacked-label .icon {\n    display: inline-block;\n    padding: 4px 0 0 0px;\n    vertical-align: middle; }\n\n.item-stacked-label input, .item-stacked-label textarea {\n  -webkit-border-radius: 2px;\n  -moz-border-radius: 2px;\n  border-radius: 2px;\n  padding: 4px 8px 3px 0;\n  border: none;\n  background-color: #fff; }\n\n.item-stacked-label input {\n  overflow: hidden;\n  height: 46px; }\n\n.item-floating-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none; }\n  .item-floating-label .input-label {\n    position: relative;\n    padding: 5px 0 0 0;\n    opacity: 0;\n    top: 10px;\n    -webkit-transition: opacity 0.15s ease-in, top 0.2s linear;\n    -moz-transition: opacity 0.15s ease-in, top 0.2s linear;\n    transition: opacity 0.15s ease-in, top 0.2s linear; }\n    .item-floating-label .input-label.has-input {\n      opacity: 1;\n      top: 0;\n      -webkit-transition: opacity 0.15s ease-in, top 0.2s linear;\n      -moz-transition: opacity 0.15s ease-in, top 0.2s linear;\n      transition: opacity 0.15s ease-in, top 0.2s linear; }\n\ntextarea, input[type=\"text\"], input[type=\"password\"], input[type=\"datetime\"], input[type=\"datetime-local\"], input[type=\"date\"], input[type=\"month\"], input[type=\"time\"], input[type=\"week\"], input[type=\"number\"], input[type=\"email\"], input[type=\"url\"], input[type=\"search\"], input[type=\"tel\"], input[type=\"color\"] {\n  display: block;\n  padding-top: 2px;\n  padding-left: 0;\n  height: 34px;\n  color: #111;\n  vertical-align: middle;\n  font-size: 14px;\n  line-height: 16px; }\n\n.platform-ios input[type=\"datetime-local\"], .platform-ios input[type=\"date\"], .platform-ios input[type=\"month\"], .platform-ios input[type=\"time\"], .platform-ios input[type=\"week\"], .platform-android input[type=\"datetime-local\"], .platform-android input[type=\"date\"], .platform-android input[type=\"month\"], .platform-android input[type=\"time\"], .platform-android input[type=\"week\"] {\n  padding-top: 8px; }\n\ninput, textarea {\n  width: 100%; }\n\ntextarea {\n  padding-left: 0; }\n  textarea::-moz-placeholder {\n    /* Firefox 19+ */\n    color: #aaaaaa; }\n  textarea:-ms-input-placeholder {\n    color: #aaaaaa; }\n  textarea::-webkit-input-placeholder {\n    color: #aaaaaa;\n    text-indent: -3px; }\n\ntextarea {\n  height: auto; }\n\ntextarea, input[type=\"text\"], input[type=\"password\"], input[type=\"datetime\"], input[type=\"datetime-local\"], input[type=\"date\"], input[type=\"month\"], input[type=\"time\"], input[type=\"week\"], input[type=\"number\"], input[type=\"email\"], input[type=\"url\"], input[type=\"search\"], input[type=\"tel\"], input[type=\"color\"] {\n  border: 0; }\n\ninput[type=\"radio\"], input[type=\"checkbox\"] {\n  margin: 0;\n  line-height: normal; }\n\ninput[type=\"file\"], input[type=\"image\"], input[type=\"submit\"], input[type=\"reset\"], input[type=\"button\"], input[type=\"radio\"], input[type=\"checkbox\"] {\n  width: auto; }\n\ninput[type=\"file\"] {\n  line-height: 34px; }\n\n.previous-input-focus, .cloned-text-input + input, .cloned-text-input + textarea {\n  position: absolute !important;\n  left: -9999px;\n  width: 200px; }\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n  /* Firefox 19+ */\n  color: #aaaaaa; }\ninput:-ms-input-placeholder, textarea:-ms-input-placeholder {\n  color: #aaaaaa; }\ninput::-webkit-input-placeholder, textarea::-webkit-input-placeholder {\n  color: #aaaaaa;\n  text-indent: 0; }\n\ninput[disabled], select[disabled], textarea[disabled], input[readonly]:not(.cloned-text-input), textarea[readonly]:not(.cloned-text-input), select[readonly] {\n  background-color: #f8f8f8;\n  cursor: not-allowed; }\n\ninput[type=\"radio\"][disabled], input[type=\"checkbox\"][disabled], input[type=\"radio\"][readonly], input[type=\"checkbox\"][readonly] {\n  background-color: transparent; }\n\n/**\n * Checkbox\n * --------------------------------------------------\n */\n.checkbox {\n  position: relative;\n  display: inline-block;\n  padding: 7px 7px;\n  cursor: pointer; }\n  .checkbox input:before, .checkbox .checkbox-icon:before {\n    border-color: #4a87ee; }\n  .checkbox input:checked:before, .checkbox input:checked + .checkbox-icon:before {\n    background: #4a87ee; }\n\n.checkbox-light input:before, .checkbox-light .checkbox-icon:before {\n  border-color: #ddd; }\n.checkbox-light input:checked:before, .checkbox-light input:checked + .checkbox-icon:before {\n  background: #ddd; }\n\n.checkbox-stable input:before, .checkbox-stable .checkbox-icon:before {\n  border-color: #b2b2b2; }\n.checkbox-stable input:checked:before, .checkbox-stable input:checked + .checkbox-icon:before {\n  background: #b2b2b2; }\n\n.checkbox-positive input:before, .checkbox-positive .checkbox-icon:before {\n  border-color: #4a87ee; }\n.checkbox-positive input:checked:before, .checkbox-positive input:checked + .checkbox-icon:before {\n  background: #4a87ee; }\n\n.checkbox-calm input:before, .checkbox-calm .checkbox-icon:before {\n  border-color: #43cee6; }\n.checkbox-calm input:checked:before, .checkbox-calm input:checked + .checkbox-icon:before {\n  background: #43cee6; }\n\n.checkbox-assertive input:before, .checkbox-assertive .checkbox-icon:before {\n  border-color: #ef4e3a; }\n.checkbox-assertive input:checked:before, .checkbox-assertive input:checked + .checkbox-icon:before {\n  background: #ef4e3a; }\n\n.checkbox-balanced input:before, .checkbox-balanced .checkbox-icon:before {\n  border-color: #66cc33; }\n.checkbox-balanced input:checked:before, .checkbox-balanced input:checked + .checkbox-icon:before {\n  background: #66cc33; }\n\n.checkbox-energized input:before, .checkbox-energized .checkbox-icon:before {\n  border-color: #f0b840; }\n.checkbox-energized input:checked:before, .checkbox-energized input:checked + .checkbox-icon:before {\n  background: #f0b840; }\n\n.checkbox-royal input:before, .checkbox-royal .checkbox-icon:before {\n  border-color: #8a6de9; }\n.checkbox-royal input:checked:before, .checkbox-royal input:checked + .checkbox-icon:before {\n  background: #8a6de9; }\n\n.checkbox-dark input:before, .checkbox-dark .checkbox-icon:before {\n  border-color: #444; }\n.checkbox-dark input:checked:before, .checkbox-dark input:checked + .checkbox-icon:before {\n  background: #444; }\n\n.checkbox input:disabled:before, .checkbox input:disabled + .checkbox-icon:before {\n  border-color: #ddd; }\n\n.checkbox input:disabled:checked:before, .checkbox input:disabled:checked + .checkbox-icon:before {\n  background: #ddd; }\n\n.checkbox.checkbox-input-hidden input {\n  display: none !important; }\n\n.checkbox input, .checkbox-icon {\n  position: relative;\n  width: 28px;\n  height: 28px;\n  display: block;\n  border: 0;\n  background: transparent;\n  cursor: pointer;\n  -webkit-appearance: none; }\n  .checkbox input:before, .checkbox-icon:before {\n    display: table;\n    width: 100%;\n    height: 100%;\n    border-width: 1px;\n    border-style: solid;\n    border-radius: 28px;\n    background: #fff;\n    content: ' ';\n    transition: background-color 20ms ease-in-out; }\n\n.checkbox input:checked:before, input:checked + .checkbox-icon:before {\n  border-width: 2px; }\n\n.checkbox input:after, .checkbox-icon:after {\n  -webkit-transition: opacity 0.05s ease-in-out;\n  -moz-transition: opacity 0.05s ease-in-out;\n  transition: opacity 0.05s ease-in-out;\n  -webkit-transform: rotate(-45deg);\n  -moz-transform: rotate(-45deg);\n  transform: rotate(-45deg);\n  position: absolute;\n  top: 30%;\n  left: 26%;\n  display: table;\n  width: 15px;\n  height: 10.33333px;\n  border: 3px solid #fff;\n  border-top: 0;\n  border-right: 0;\n  content: ' ';\n  opacity: 0; }\n\n.grade-c .checkbox input:after, .grade-c .checkbox-icon:after {\n  -webkit-transform: rotate(0);\n  -moz-transform: rotate(0);\n  transform: rotate(0);\n  top: 3px;\n  left: 4px;\n  border: none;\n  color: #fff;\n  content: '\\2713';\n  font-weight: bold;\n  font-size: 20px; }\n\n.checkbox input:checked:after, input:checked + .checkbox-icon:after {\n  opacity: 1; }\n\n.item-checkbox {\n  padding-left: 60px; }\n  .item-checkbox.active {\n    box-shadow: none; }\n\n.item-checkbox .checkbox {\n  position: absolute;\n  top: 50%;\n  right: 8px;\n  left: 8px;\n  z-index: 3;\n  margin-top: -21px; }\n\n.item-checkbox.item-checkbox-right {\n  padding-right: 60px;\n  padding-left: 16px; }\n\n.item-checkbox-right .checkbox input, .item-checkbox-right .checkbox-icon {\n  float: right; }\n\n/**\n * Toggle\n * --------------------------------------------------\n */\n.item-toggle {\n  pointer-events: none; }\n\n.toggle {\n  position: relative;\n  display: inline-block;\n  pointer-events: auto;\n  margin: -5px;\n  padding: 5px; }\n  .toggle input:checked + .track {\n    border-color: #4a87ee;\n    background-color: #4a87ee; }\n  .toggle.dragging .handle {\n    background-color: #f2f2f2 !important; }\n  .toggle.toggle-light input:checked + .track {\n    border-color: #ddd;\n    background-color: #ddd; }\n  .toggle.toggle-stable input:checked + .track {\n    border-color: #b2b2b2;\n    background-color: #b2b2b2; }\n  .toggle.toggle-positive input:checked + .track {\n    border-color: #4a87ee;\n    background-color: #4a87ee; }\n  .toggle.toggle-calm input:checked + .track {\n    border-color: #43cee6;\n    background-color: #43cee6; }\n  .toggle.toggle-assertive input:checked + .track {\n    border-color: #ef4e3a;\n    background-color: #ef4e3a; }\n  .toggle.toggle-balanced input:checked + .track {\n    border-color: #66cc33;\n    background-color: #66cc33; }\n  .toggle.toggle-energized input:checked + .track {\n    border-color: #f0b840;\n    background-color: #f0b840; }\n  .toggle.toggle-royal input:checked + .track {\n    border-color: #8a6de9;\n    background-color: #8a6de9; }\n  .toggle.toggle-dark input:checked + .track {\n    border-color: #444;\n    background-color: #444; }\n\n.toggle input {\n  display: none; }\n\n/* the track appearance when the toggle is \"off\" */\n.toggle .track {\n  -webkit-transition-timing-function: ease-in-out;\n  -moz-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  -webkit-transition-duration: 0.2s;\n  -moz-transition-duration: 0.2s;\n  transition-duration: 0.2s;\n  -webkit-transition-property: background-color, border;\n  -moz-transition-property: background-color, border;\n  transition-property: background-color, border;\n  display: inline-block;\n  box-sizing: border-box;\n  width: 54px;\n  height: 32px;\n  border: solid 2px #E5E5E5;\n  border-radius: 20px;\n  background-color: #E5E5E5;\n  content: ' ';\n  cursor: pointer;\n  pointer-events: none; }\n\n/* Fix to avoid background color bleeding */\n/* (occured on (at least) Android 4.2, Asus MeMO Pad HD7 ME173X) */\n.platform-android4_2 .toggle .track {\n  -webkit-background-clip: padding-box; }\n\n/* the handle (circle) thats inside the toggle's track area */\n/* also the handle's appearance when it is \"off\" */\n.toggle .handle {\n  -webkit-transition: 0.2s ease-in-out;\n  -moz-transition: 0.2s ease-in-out;\n  transition: 0.2s ease-in-out;\n  position: absolute;\n  display: block;\n  width: 28px;\n  height: 28px;\n  border-radius: 28px;\n  background-color: #fff;\n  top: 7px;\n  left: 7px; }\n  .toggle .handle:before {\n    position: absolute;\n    top: -4px;\n    left: -22px;\n    padding: 19px 35px;\n    content: \" \"; }\n\n.toggle input:checked + .track .handle {\n  -webkit-transform: translate3d(22px, 0, 0);\n  -moz-transform: translate3d(22px, 0, 0);\n  transform: translate3d(22px, 0, 0);\n  background-color: #fff; }\n\n.item-toggle.active {\n  box-shadow: none; }\n\n.item-toggle, .item-toggle.item-complex .item-content {\n  padding-right: 102px; }\n\n.item-toggle.item-complex {\n  padding-right: 0; }\n\n.item-toggle .toggle {\n  position: absolute;\n  top: 8px;\n  right: 16px;\n  z-index: 3; }\n\n.toggle input:disabled + .track {\n  opacity: 0.6; }\n\n/**\n * Radio Button Inputs\n * --------------------------------------------------\n */\n.item-radio {\n  padding: 0; }\n  .item-radio:hover {\n    cursor: pointer; }\n\n.item-radio .item-content {\n  /* give some room to the right for the checkmark icon */\n  padding-right: 64px; }\n\n.item-radio .radio-icon {\n  /* checkmark icon will be hidden by default */\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 3;\n  visibility: hidden;\n  padding: 14px;\n  height: 100%;\n  font-size: 24px; }\n\n.item-radio input {\n  /* hide any radio button inputs elements (the ugly circles) */\n  position: absolute;\n  left: -9999px; }\n  .item-radio input:checked ~ .item-content {\n    /* style the item content when its checked */\n    background: #f7f7f7; }\n  .item-radio input:checked ~ .radio-icon {\n    /* show the checkmark icon when its checked */\n    visibility: visible; }\n\n.platform-android.grade-b .item-radio, .platform-android.grade-c .item-radio {\n  -webkit-animation: androidCheckedbugfix infinite 1s; }\n\n@-webkit-keyframes androidCheckedbugfix {\n  from {\n    padding: 0; }\n\n  to {\n    padding: 0; } }\n\n/**\n * Range\n * --------------------------------------------------\n */\ninput[type=\"range\"] {\n  display: inline-block;\n  overflow: hidden;\n  margin-top: 5px;\n  margin-bottom: 5px;\n  padding-right: 2px;\n  padding-left: 1px;\n  width: auto;\n  height: 35px;\n  outline: none;\n  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ccc), color-stop(100%, #ccc));\n  background: linear-gradient(to right, #ccc 0%, #ccc 100%);\n  background-position: center;\n  background-size: 99% 4px;\n  background-repeat: no-repeat;\n  -webkit-appearance: none; }\n  input[type=\"range\"]::-webkit-slider-thumb {\n    position: relative;\n    width: 20px;\n    height: 20px;\n    border-radius: 10px;\n    background-color: #fff;\n    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5), 1px 3px 5px rgba(0, 0, 0, 0.25);\n    cursor: pointer;\n    -webkit-appearance: none; }\n  input[type=\"range\"]::-webkit-slider-thumb:before {\n    /* what creates the colorful line on the left side of the slider */\n    position: absolute;\n    top: 8px;\n    left: -2001px;\n    width: 2000px;\n    height: 4px;\n    background: #444;\n    content: ' '; }\n  input[type=\"range\"]::-webkit-slider-thumb:after {\n    /* create a larger (but hidden) hit area */\n    position: absolute;\n    top: -20px;\n    left: -20px;\n    padding: 30px;\n    content: ' '; }\n\n.range {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  padding: 2px 11px; }\n  .range.range-light input::-webkit-slider-thumb:before {\n    background: #ddd; }\n  .range.range-stable input::-webkit-slider-thumb:before {\n    background: #b2b2b2; }\n  .range.range-positive input::-webkit-slider-thumb:before {\n    background: #4a87ee; }\n  .range.range-calm input::-webkit-slider-thumb:before {\n    background: #43cee6; }\n  .range.range-balanced input::-webkit-slider-thumb:before {\n    background: #66cc33; }\n  .range.range-assertive input::-webkit-slider-thumb:before {\n    background: #ef4e3a; }\n  .range.range-energized input::-webkit-slider-thumb:before {\n    background: #f0b840; }\n  .range.range-royal input::-webkit-slider-thumb:before {\n    background: #8a6de9; }\n  .range.range-dark input::-webkit-slider-thumb:before {\n    background: #444; }\n\n.range .icon {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0;\n  -moz-box-flex: 0;\n  -moz-flex: 0;\n  -ms-flex: 0;\n  flex: 0;\n  display: block;\n  min-width: 24px;\n  text-align: center;\n  font-size: 24px; }\n\n.range input {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  margin-right: 10px;\n  margin-left: 10px; }\n\n.range-label {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 auto;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 auto;\n  -ms-flex: 0 0 auto;\n  flex: 0 0 auto;\n  display: block;\n  white-space: nowrap; }\n\n.range-label:first-child {\n  padding-left: 5px; }\n\n.range input + .range-label {\n  padding-right: 5px;\n  padding-left: 0; }\n\n/**\n * Select\n * --------------------------------------------------\n */\n.item-select {\n  position: relative; }\n  .item-select select {\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none;\n    position: absolute;\n    top: 0;\n    right: 0;\n    padding: 14px 48px 16px 16px;\n    max-width: 65%;\n    border: none;\n    background: #fff;\n    color: #333;\n    text-indent: 0.01px;\n    text-overflow: '';\n    white-space: nowrap;\n    font-size: 14px;\n    cursor: pointer;\n    direction: rtl; }\n  .item-select select::-ms-expand {\n    display: none; }\n  .item-select option {\n    direction: ltr; }\n  .item-select:after {\n    position: absolute;\n    top: 50%;\n    right: 16px;\n    margin-top: -3px;\n    width: 0;\n    height: 0;\n    border-top: 5px solid;\n    border-right: 5px solid rgba(0, 0, 0, 0);\n    border-left: 5px solid rgba(0, 0, 0, 0);\n    color: #999;\n    content: \"\";\n    pointer-events: none; }\n  .item-select.item-light select {\n    background: #fff;\n    color: #444; }\n  .item-select.item-stable select {\n    background: #f8f8f8;\n    color: #444; }\n  .item-select.item-stable:after, .item-select.item-stable .input-label {\n    color: #656565; }\n  .item-select.item-positive select {\n    background: #4a87ee;\n    color: #fff; }\n  .item-select.item-positive:after, .item-select.item-positive .input-label {\n    color: #fff; }\n  .item-select.item-calm select {\n    background: #43cee6;\n    color: #fff; }\n  .item-select.item-calm:after, .item-select.item-calm .input-label {\n    color: #fff; }\n  .item-select.item-assertive select {\n    background: #ef4e3a;\n    color: #fff; }\n  .item-select.item-assertive:after, .item-select.item-assertive .input-label {\n    color: #fff; }\n  .item-select.item-balanced select {\n    background: #66cc33;\n    color: #fff; }\n  .item-select.item-balanced:after, .item-select.item-balanced .input-label {\n    color: #fff; }\n  .item-select.item-energized select {\n    background: #f0b840;\n    color: #fff; }\n  .item-select.item-energized:after, .item-select.item-energized .input-label {\n    color: #fff; }\n  .item-select.item-royal select {\n    background: #8a6de9;\n    color: #fff; }\n  .item-select.item-royal:after, .item-select.item-royal .input-label {\n    color: #fff; }\n  .item-select.item-dark select {\n    background: #444;\n    color: #fff; }\n  .item-select.item-dark:after, .item-select.item-dark .input-label {\n    color: #fff; }\n\nselect[multiple], select[size] {\n  height: auto; }\n\n/**\n * Progress\n * --------------------------------------------------\n */\nprogress {\n  display: block;\n  margin: 15px auto;\n  width: 100%; }\n\n/**\n * Buttons\n * --------------------------------------------------\n */\n.button {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  color: #444;\n  position: relative;\n  display: inline-block;\n  margin: 0;\n  padding: 0 12px;\n  min-width: 52px;\n  min-height: 47px;\n  border-width: 1px;\n  border-style: solid;\n  border-radius: 2px;\n  vertical-align: top;\n  text-align: center;\n  text-overflow: ellipsis;\n  font-size: 16px;\n  line-height: 42px;\n  cursor: pointer; }\n  .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .button.active, .button.activated {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5;\n    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n  .button:after {\n    position: absolute;\n    top: -6px;\n    right: -6px;\n    bottom: -6px;\n    left: -6px;\n    content: ' '; }\n  .button .icon {\n    vertical-align: top;\n    pointer-events: none; }\n  .button .icon:before, .button.icon:before, .button.icon-left:before, .button.icon-right:before {\n    display: inline-block;\n    padding: 0 0 1px 0;\n    vertical-align: inherit;\n    font-size: 24px;\n    line-height: 41px;\n    pointer-events: none; }\n  .button.icon-left:before {\n    float: left;\n    padding-right: 0.2em;\n    padding-left: 0; }\n  .button.icon-right:before {\n    float: right;\n    padding-right: 0;\n    padding-left: 0.2em; }\n  .button.button-block, .button.button-full {\n    margin-top: 10px;\n    margin-bottom: 10px; }\n  .button.button-light {\n    border-color: #ddd;\n    background-color: #fff;\n    color: #444; }\n    .button.button-light:hover {\n      color: #444;\n      text-decoration: none; }\n    .button.button-light.active, .button.button-light.activated {\n      border-color: #ccc;\n      background-color: #fafafa;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-light.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #ddd; }\n    .button.button-light.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-light.button-outline {\n      border-color: #ddd;\n      background: transparent;\n      color: #ddd; }\n      .button.button-light.button-outline.active, .button.button-light.button-outline.activated {\n        background-color: #ddd;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-stable {\n    border-color: #b2b2b2;\n    background-color: #f8f8f8;\n    color: #444; }\n    .button.button-stable:hover {\n      color: #444;\n      text-decoration: none; }\n    .button.button-stable.active, .button.button-stable.activated {\n      border-color: #a2a2a2;\n      background-color: #e5e5e5;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-stable.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #b2b2b2; }\n    .button.button-stable.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-stable.button-outline {\n      border-color: #b2b2b2;\n      background: transparent;\n      color: #b2b2b2; }\n      .button.button-stable.button-outline.active, .button.button-stable.button-outline.activated {\n        background-color: #b2b2b2;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-positive {\n    border-color: #145fd7;\n    background-color: #4a87ee;\n    color: #fff; }\n    .button.button-positive:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-positive.active, .button.button-positive.activated {\n      border-color: #145fd7;\n      background-color: #145fd7;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-positive.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #4a87ee; }\n    .button.button-positive.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-positive.button-outline {\n      border-color: #4a87ee;\n      background: transparent;\n      color: #4a87ee; }\n      .button.button-positive.button-outline.active, .button.button-positive.button-outline.activated {\n        background-color: #4a87ee;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-calm {\n    border-color: #1aacc3;\n    background-color: #43cee6;\n    color: #fff; }\n    .button.button-calm:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-calm.active, .button.button-calm.activated {\n      border-color: #1aacc3;\n      background-color: #1aacc3;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-calm.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #43cee6; }\n    .button.button-calm.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-calm.button-outline {\n      border-color: #43cee6;\n      background: transparent;\n      color: #43cee6; }\n      .button.button-calm.button-outline.active, .button.button-calm.button-outline.activated {\n        background-color: #43cee6;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-assertive {\n    border-color: #cc2311;\n    background-color: #ef4e3a;\n    color: #fff; }\n    .button.button-assertive:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-assertive.active, .button.button-assertive.activated {\n      border-color: #cc2311;\n      background-color: #cc2311;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-assertive.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #ef4e3a; }\n    .button.button-assertive.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-assertive.button-outline {\n      border-color: #ef4e3a;\n      background: transparent;\n      color: #ef4e3a; }\n      .button.button-assertive.button-outline.active, .button.button-assertive.button-outline.activated {\n        background-color: #ef4e3a;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-balanced {\n    border-color: #498f24;\n    background-color: #66cc33;\n    color: #fff; }\n    .button.button-balanced:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-balanced.active, .button.button-balanced.activated {\n      border-color: #498f24;\n      background-color: #498f24;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-balanced.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #66cc33; }\n    .button.button-balanced.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-balanced.button-outline {\n      border-color: #66cc33;\n      background: transparent;\n      color: #66cc33; }\n      .button.button-balanced.button-outline.active, .button.button-balanced.button-outline.activated {\n        background-color: #66cc33;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-energized {\n    border-color: #d39211;\n    background-color: #f0b840;\n    color: #fff; }\n    .button.button-energized:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-energized.active, .button.button-energized.activated {\n      border-color: #d39211;\n      background-color: #d39211;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-energized.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #f0b840; }\n    .button.button-energized.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-energized.button-outline {\n      border-color: #f0b840;\n      background: transparent;\n      color: #f0b840; }\n      .button.button-energized.button-outline.active, .button.button-energized.button-outline.activated {\n        background-color: #f0b840;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-royal {\n    border-color: #552bdf;\n    background-color: #8a6de9;\n    color: #fff; }\n    .button.button-royal:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-royal.active, .button.button-royal.activated {\n      border-color: #552bdf;\n      background-color: #552bdf;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-royal.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #8a6de9; }\n    .button.button-royal.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-royal.button-outline {\n      border-color: #8a6de9;\n      background: transparent;\n      color: #8a6de9; }\n      .button.button-royal.button-outline.active, .button.button-royal.button-outline.activated {\n        background-color: #8a6de9;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-dark {\n    border-color: #111;\n    background-color: #444;\n    color: #fff; }\n    .button.button-dark:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-dark.active, .button.button-dark.activated {\n      border-color: #000;\n      background-color: #262626;\n      box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }\n    .button.button-dark.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #444; }\n    .button.button-dark.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-dark.button-outline {\n      border-color: #444;\n      background: transparent;\n      color: #444; }\n      .button.button-dark.button-outline.active, .button.button-dark.button-outline.activated {\n        background-color: #444;\n        box-shadow: none;\n        color: #fff; }\n\n.button-small {\n  padding: 2px 4px 1px;\n  min-width: 28px;\n  min-height: 30px;\n  font-size: 12px;\n  line-height: 26px; }\n  .button-small .icon:before, .button-small.icon:before, .button-small.icon-left:before, .button-small.icon-right:before {\n    font-size: 16px;\n    line-height: 19px;\n    margin-top: 3px; }\n\n.button-large {\n  padding: 0 16px;\n  min-width: 68px;\n  min-height: 59px;\n  font-size: 20px;\n  line-height: 53px; }\n  .button-large .icon:before, .button-large.icon:before, .button-large.icon-left:before, .button-large.icon-right:before {\n    padding-bottom: 2px;\n    font-size: 32px;\n    line-height: 51px; }\n\n.button-icon {\n  -webkit-transition: opacity 0.1s;\n  -moz-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  padding: 0 6px;\n  min-width: initial;\n  border-color: transparent;\n  background: none; }\n  .button-icon.button.active, .button-icon.button.activated {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    opacity: 0.3; }\n  .button-icon .icon:before, .button-icon.icon:before {\n    font-size: 32px; }\n\n.button-clear {\n  -webkit-transition: opacity 0.1s;\n  -moz-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  padding: 0 6px;\n  max-height: 42px;\n  border-color: transparent;\n  background: none;\n  box-shadow: none; }\n  .button-clear.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #b2b2b2; }\n  .button-clear.button-icon {\n    border-color: transparent;\n    background: none; }\n  .button-clear.active, .button-clear.activated {\n    opacity: 0.3; }\n\n.button-outline {\n  -webkit-transition: opacity 0.1s;\n  -moz-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  background: none;\n  box-shadow: none; }\n  .button-outline.button-outline {\n    border-color: #b2b2b2;\n    background: transparent;\n    color: #b2b2b2; }\n    .button-outline.button-outline.active, .button-outline.button-outline.activated {\n      background-color: #b2b2b2;\n      box-shadow: none;\n      color: #fff; }\n\n.padding > .button.button-block:first-child {\n  margin-top: 0; }\n\n.button-block {\n  display: block;\n  clear: both; }\n  .button-block:after {\n    clear: both; }\n\n.button-full, .button-full > .button {\n  display: block;\n  margin-right: 0;\n  margin-left: 0;\n  border-right-width: 0;\n  border-left-width: 0;\n  border-radius: 0; }\n\nbutton.button-block, button.button-full, .button-full > button.button, input.button.button-block {\n  width: 100%; }\n\na.button {\n  text-decoration: none; }\n  a.button .icon:before, a.button.icon:before, a.button.icon-left:before, a.button.icon-right:before {\n    margin-top: 2px; }\n\n.button.disabled, .button[disabled] {\n  opacity: 0.4;\n  cursor: default !important;\n  pointer-events: none; }\n\n/**\n * Button Bar\n * --------------------------------------------------\n */\n.button-bar {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  width: 100%; }\n  .button-bar.button-bar-inline {\n    display: block;\n    width: auto;\n    *zoom: 1; }\n    .button-bar.button-bar-inline:before, .button-bar.button-bar-inline:after {\n      display: table;\n      content: \"\";\n      line-height: 0; }\n    .button-bar.button-bar-inline:after {\n      clear: both; }\n    .button-bar.button-bar-inline > .button {\n      width: auto;\n      display: inline-block;\n      float: left; }\n\n.button-bar > .button {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  overflow: hidden;\n  padding: 0 16px;\n  width: 0;\n  border-width: 1px 0px 1px 1px;\n  border-radius: 0;\n  text-align: center;\n  text-overflow: ellipsis;\n  white-space: nowrap; }\n  .button-bar > .button:before, .button-bar > .button .icon:before {\n    line-height: 44px; }\n  .button-bar > .button:first-child {\n    border-radius: 2px 0px 0px 2px; }\n  .button-bar > .button:last-child {\n    border-right-width: 1px;\n    border-radius: 0px 2px 2px 0px; }\n\n/**\n * Animations\n * --------------------------------------------------\n * The animations in this file are \"simple\" - not too complex\n * and pretty easy on performance. They can be overidden\n * and enhanced easily.\n */\n/**\n * Keyframes\n * --------------------------------------------------\n */\n@-webkit-keyframes slideInUp {\n  0% {\n    -webkit-transform: translate3d(0, 100%, 0); }\n\n  100% {\n    -webkit-transform: translate3d(0, 0, 0); } }\n\n@-moz-keyframes slideInUp {\n  0% {\n    -moz-transform: translate3d(0, 100%, 0); }\n\n  100% {\n    -moz-transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInUp {\n  0% {\n    transform: translate3d(0, 100%, 0); }\n\n  100% {\n    transform: translate3d(0, 0, 0); } }\n\n@-webkit-keyframes slideOutUp {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0); }\n\n  100% {\n    -webkit-transform: translate3d(0, 100%, 0); } }\n\n@-moz-keyframes slideOutUp {\n  0% {\n    -moz-transform: translate3d(0, 0, 0); }\n\n  100% {\n    -moz-transform: translate3d(0, 100%, 0); } }\n\n@keyframes slideOutUp {\n  0% {\n    transform: translate3d(0, 0, 0); }\n\n  100% {\n    transform: translate3d(0, 100%, 0); } }\n\n@-webkit-keyframes slideInFromLeft {\n  from {\n    -webkit-transform: translate3d(-100%, 0, 0); }\n\n  to {\n    -webkit-transform: translate3d(0, 0, 0); } }\n\n@-moz-keyframes slideInFromLeft {\n  from {\n    -moz-transform: translateX(-100%); }\n\n  to {\n    -moz-transform: translateX(0); } }\n\n@keyframes slideInFromLeft {\n  from {\n    transform: translateX(-100%); }\n\n  to {\n    transform: translateX(0); } }\n\n@-webkit-keyframes slideInFromRight {\n  from {\n    -webkit-transform: translate3d(100%, 0, 0); }\n\n  to {\n    -webkit-transform: translate3d(0, 0, 0); } }\n\n@-moz-keyframes slideInFromRight {\n  from {\n    -moz-transform: translateX(100%); }\n\n  to {\n    -moz-transform: translateX(0); } }\n\n@keyframes slideInFromRight {\n  from {\n    transform: translateX(100%); }\n\n  to {\n    transform: translateX(0); } }\n\n@-webkit-keyframes slideOutToLeft {\n  from {\n    -webkit-transform: translate3d(0, 0, 0); }\n\n  to {\n    -webkit-transform: translate3d(-100%, 0, 0); } }\n\n@-moz-keyframes slideOutToLeft {\n  from {\n    -moz-transform: translateX(0); }\n\n  to {\n    -moz-transform: translateX(-100%); } }\n\n@keyframes slideOutToLeft {\n  from {\n    transform: translateX(0); }\n\n  to {\n    transform: translateX(-100%); } }\n\n@-webkit-keyframes slideOutToRight {\n  from {\n    -webkit-transform: translate3d(0, 0, 0); }\n\n  to {\n    -webkit-transform: translate3d(100%, 0, 0); } }\n\n@-moz-keyframes slideOutToRight {\n  from {\n    -moz-transform: translateX(0); }\n\n  to {\n    -moz-transform: translateX(100%); } }\n\n@keyframes slideOutToRight {\n  from {\n    transform: translateX(0); }\n\n  to {\n    transform: translateX(100%); } }\n\n@-webkit-keyframes fadeOut {\n  from {\n    opacity: 1; }\n\n  to {\n    opacity: 0; } }\n\n@-moz-keyframes fadeOut {\n  from {\n    opacity: 1; }\n\n  to {\n    opacity: 0; } }\n\n@keyframes fadeOut {\n  from {\n    opacity: 1; }\n\n  to {\n    opacity: 0; } }\n\n@-webkit-keyframes fadeIn {\n  from {\n    opacity: 0; }\n\n  to {\n    opacity: 1; } }\n\n@-moz-keyframes fadeIn {\n  from {\n    opacity: 0; }\n\n  to {\n    opacity: 1; } }\n\n@keyframes fadeIn {\n  from {\n    opacity: 0; }\n\n  to {\n    opacity: 1; } }\n\n@-webkit-keyframes fadeInHalf {\n  from {\n    background-color: rgba(0, 0, 0, 0); }\n\n  to {\n    background-color: rgba(0, 0, 0, 0.5); } }\n\n@-moz-keyframes fadeInHalf {\n  from {\n    background-color: rgba(0, 0, 0, 0); }\n\n  to {\n    background-color: rgba(0, 0, 0, 0.5); } }\n\n@keyframes fadeInHalf {\n  from {\n    background-color: rgba(0, 0, 0, 0); }\n\n  to {\n    background-color: rgba(0, 0, 0, 0.5); } }\n\n@-webkit-keyframes fadeOutHalf {\n  from {\n    background-color: rgba(0, 0, 0, 0.5); }\n\n  to {\n    background-color: rgba(0, 0, 0, 0); } }\n\n@-moz-keyframes fadeOutHalf {\n  from {\n    background-color: rgba(0, 0, 0, 0.5); }\n\n  to {\n    background-color: rgba(0, 0, 0, 0); } }\n\n@keyframes fadeOutHalf {\n  from {\n    background-color: rgba(0, 0, 0, 0.5); }\n\n  to {\n    background-color: rgba(0, 0, 0, 0); } }\n\n@-webkit-keyframes scaleOut {\n  from {\n    -webkit-transform: scale(1);\n    opacity: 1; }\n\n  to {\n    -webkit-transform: scale(0.8);\n    opacity: 0; } }\n\n@-moz-keyframes scaleOut {\n  from {\n    -moz-transform: scale(1);\n    opacity: 1; }\n\n  to {\n    -moz-transform: scale(0.8);\n    opacity: 0; } }\n\n@keyframes scaleOut {\n  from {\n    transform: scale(1);\n    opacity: 1; }\n\n  to {\n    transform: scale(0.8);\n    opacity: 0; } }\n\n@-webkit-keyframes scaleIn {\n  from {\n    -webkit-transform: scale(0); }\n\n  to {\n    -webkit-transform: scale(1); } }\n\n@-moz-keyframes scaleIn {\n  from {\n    -moz-transform: scale(0); }\n\n  to {\n    -moz-transform: scale(1); } }\n\n@keyframes scaleIn {\n  from {\n    transform: scale(0); }\n\n  to {\n    transform: scale(1); } }\n\n@-webkit-keyframes superScaleIn {\n  from {\n    -webkit-transform: scale(1.2);\n    opacity: 0; }\n\n  to {\n    -webkit-transform: scale(1);\n    opacity: 1; } }\n\n@-moz-keyframes superScaleIn {\n  from {\n    -moz-transform: scale(1.2);\n    opacity: 0; }\n\n  to {\n    -moz-transform: scale(1);\n    opacity: 1; } }\n\n@keyframes superScaleIn {\n  from {\n    transform: scale(1.2);\n    opacity: 0; }\n\n  to {\n    transform: scale(1);\n    opacity: 1; } }\n\n@-webkit-keyframes spin {\n  100% {\n    -webkit-transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n  100% {\n    -moz-transform: rotate(360deg); } }\n\n@keyframes spin {\n  100% {\n    transform: rotate(360deg); } }\n\n.no-animation > .ng-enter, .no-animation.ng-enter, .no-animation > .ng-leave, .no-animation.ng-leave {\n  -webkit-transition: none;\n  -moz-transition: none;\n  transition: none; }\n\n.noop-animation > .ng-enter, .noop-animation.ng-enter, .noop-animation > .ng-leave, .noop-animation.ng-leave {\n  -webkit-transition: all cubic-bezier(0.25, 0.46, 0.45, 0.94) 250ms;\n  -moz-transition: all cubic-bezier(0.25, 0.46, 0.45, 0.94) 250ms;\n  transition: all cubic-bezier(0.25, 0.46, 0.45, 0.94) 250ms;\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0; }\n\n.ng-animate .pane {\n  position: absolute; }\n\n/**\n * Slide Left-Right, and Right-Left, each with the reserve\n * --------------------------------------------------\n * NEW content slides IN from the RIGHT, OLD slides OUT to the LEFT\n * Reverse: NEW content slides IN from the LEFT, OLD slides OUT to the RIGHT\n */\n.slide-left-right > .ng-enter, .slide-left-right.ng-enter, .slide-left-right > .ng-leave, .slide-left-right.ng-leave, .slide-right-left.reverse > .ng-enter, .slide-right-left.reverse.ng-enter, .slide-right-left.reverse > .ng-leave, .slide-right-left.reverse.ng-leave {\n  -webkit-transition: all ease-in-out 250ms;\n  -moz-transition: all ease-in-out 250ms;\n  transition: all ease-in-out 250ms;\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0; }\n.slide-left-right > .ng-enter, .slide-left-right.ng-enter, .slide-right-left.reverse > .ng-enter, .slide-right-left.reverse.ng-enter {\n  /* NEW content placed far RIGHT BEFORE it slides IN from the RIGHT */\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0); }\n.slide-left-right > .ng-enter.ng-enter-active, .slide-left-right.ng-enter.ng-enter-active, .slide-right-left.reverse > .ng-enter.ng-enter-active, .slide-right-left.reverse.ng-enter.ng-enter-active {\n  /* NEW content ACTIVELY sliding IN from the RIGHT */\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n.slide-left-right > .ng-leave.ng-leave-active, .slide-left-right.ng-leave.ng-leave-active, .slide-right-left.reverse > .ng-leave.ng-leave-active, .slide-right-left.reverse.ng-leave.ng-leave-active {\n  /* OLD content ACTIVELY sliding OUT to the LEFT */\n  -webkit-transform: translate3d(-100%, 0, 0);\n  -moz-transform: translate3d(-100%, 0, 0);\n  transform: translate3d(-100%, 0, 0); }\n\n.slide-left-right.reverse > .ng-enter, .slide-left-right.reverse.ng-enter, .slide-left-right.reverse > .ng-leave, .slide-left-right.reverse.ng-leave, .slide-right-left > .ng-enter, .slide-right-left.ng-enter, .slide-right-left > .ng-leave, .slide-right-left.ng-leave {\n  -webkit-transition: all ease-in-out 250ms;\n  -moz-transition: all ease-in-out 250ms;\n  transition: all ease-in-out 250ms;\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0; }\n.slide-left-right.reverse > .ng-enter, .slide-left-right.reverse.ng-enter, .slide-right-left > .ng-enter, .slide-right-left.ng-enter {\n  /* NEW content placed far LEFT BEFORE it slides IN from the LEFT */\n  -webkit-transform: translate3d(-100%, 0, 0);\n  -moz-transform: translate3d(-100%, 0, 0);\n  transform: translate3d(-100%, 0, 0); }\n.slide-left-right.reverse > .ng-enter.ng-enter-active, .slide-left-right.reverse.ng-enter.ng-enter-active, .slide-right-left > .ng-enter.ng-enter-active, .slide-right-left.ng-enter.ng-enter-active {\n  /* NEW content ACTIVELY sliding IN from the LEFT */\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n.slide-left-right.reverse > .ng-leave.ng-leave-active, .slide-left-right.reverse.ng-leave.ng-leave-active, .slide-right-left > .ng-leave.ng-leave-active, .slide-right-left.ng-leave.ng-leave-active {\n  /* OLD content ACTIVELY sliding OUT to the RIGHT */\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0); }\n\n/**\n * iOS style slide left to right\n * --------------------------------------------------\n */\n/*\n$ios-transition-box-shadow-start: -200px 0px 200px rgba(0,0,0,0), -5px 0px 5px rgba(0,0,0,0.01);\n$ios-transition-box-shadow-end: -200px 0px 200px rgba(0,0,0,0.15), -5px 0px 5px rgba(0,0,0,0.18);\n*/\n.slide-ios > .ng-enter, .slide-ios.ng-enter, .slide-ios > .ng-leave, .slide-ios.ng-leave, .slide-left-right-ios7 > .ng-enter, .slide-left-right-ios7.ng-enter, .slide-left-right-ios7 > .ng-leave, .slide-left-right-ios7.ng-leave, .slide-right-left-ios7.reverse > .ng-enter, .slide-right-left-ios7.reverse.ng-enter, .slide-right-left-ios7.reverse > .ng-leave, .slide-right-left-ios7.reverse.ng-leave {\n  -webkit-transition: all cubic-bezier(0.4, 0.6, 0.2, 1) 400ms;\n  -moz-transition: all cubic-bezier(0.4, 0.6, 0.2, 1) 400ms;\n  transition: all cubic-bezier(0.4, 0.6, 0.2, 1) 400ms;\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  width: auto;\n  border-right: none;\n  border-left: none; }\n  .slide-ios > .ng-enter:not(.bar), .slide-ios.ng-enter:not(.bar), .slide-ios > .ng-leave:not(.bar), .slide-ios.ng-leave:not(.bar), .slide-left-right-ios7 > .ng-enter:not(.bar), .slide-left-right-ios7.ng-enter:not(.bar), .slide-left-right-ios7 > .ng-leave:not(.bar), .slide-left-right-ios7.ng-leave:not(.bar), .slide-right-left-ios7.reverse > .ng-enter:not(.bar), .slide-right-left-ios7.reverse.ng-enter:not(.bar), .slide-right-left-ios7.reverse > .ng-leave:not(.bar), .slide-right-left-ios7.reverse.ng-leave:not(.bar) {\n    border-right: none;\n    border-left: none; }\n.slide-ios > .ng-enter, .slide-ios.ng-enter, .slide-left-right-ios7 > .ng-enter, .slide-left-right-ios7.ng-enter, .slide-right-left-ios7.reverse > .ng-enter, .slide-right-left-ios7.reverse.ng-enter {\n  /* NEW content placed far RIGHT BEFORE it slides IN from the RIGHT */\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0); }\n.slide-ios > .ng-leave, .slide-ios.ng-leave, .slide-left-right-ios7 > .ng-leave, .slide-left-right-ios7.ng-leave, .slide-right-left-ios7.reverse > .ng-leave, .slide-right-left-ios7.reverse.ng-leave {\n  z-index: 1; }\n.slide-ios > .ng-enter.ng-enter-active, .slide-ios.ng-enter.ng-enter-active, .slide-left-right-ios7 > .ng-enter.ng-enter-active, .slide-left-right-ios7.ng-enter.ng-enter-active, .slide-right-left-ios7.reverse > .ng-enter.ng-enter-active, .slide-right-left-ios7.reverse.ng-enter.ng-enter-active {\n  /* NEW content ACTIVELY sliding IN from the RIGHT */\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n.slide-ios > .ng-leave.ng-leave-active, .slide-ios.ng-leave.ng-leave-active, .slide-left-right-ios7 > .ng-leave.ng-leave-active, .slide-left-right-ios7.ng-leave.ng-leave-active, .slide-right-left-ios7.reverse > .ng-leave.ng-leave-active, .slide-right-left-ios7.reverse.ng-leave.ng-leave-active {\n  /* OLD content ACTIVELY sliding OUT to the LEFT */\n  -webkit-transform: translate3d(-20%, 0, 0);\n  -moz-transform: translate3d(-20%, 0, 0);\n  transform: translate3d(-20%, 0, 0); }\n\n.slide-ios.reverse > .ng-enter, .slide-ios.reverse.ng-enter, .slide-ios.reverse > .ng-leave, .slide-ios.reverse.ng-leave, .slide-left-right-ios7.reverse > .ng-enter, .slide-left-right-ios7.reverse.ng-enter, .slide-left-right-ios7.reverse > .ng-leave, .slide-left-right-ios7.reverse.ng-leave, .slide-right-left-ios7 > .ng-enter, .slide-right-left-ios7.ng-enter, .slide-right-left-ios7 > .ng-leave, .slide-right-left-ios7.ng-leave {\n  -webkit-transition: all cubic-bezier(0.4, 0.6, 0.2, 1) 400ms;\n  -moz-transition: all cubic-bezier(0.4, 0.6, 0.2, 1) 400ms;\n  transition: all cubic-bezier(0.4, 0.6, 0.2, 1) 400ms;\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  width: auto;\n  border-right: none;\n  border-left: none; }\n.slide-ios.reverse > .ng-enter, .slide-ios.reverse.ng-enter, .slide-left-right-ios7.reverse > .ng-enter, .slide-left-right-ios7.reverse.ng-enter, .slide-right-left-ios7 > .ng-enter, .slide-right-left-ios7.ng-enter {\n  /* NEW content placed far LEFT BEFORE it slides IN from the LEFT */\n  -webkit-transform: translate3d(-20%, 0, 0);\n  -moz-transform: translate3d(-20%, 0, 0);\n  transform: translate3d(-20%, 0, 0); }\n.slide-ios.reverse > .ng-leave, .slide-ios.reverse.ng-leave, .slide-left-right-ios7.reverse > .ng-leave, .slide-left-right-ios7.reverse.ng-leave, .slide-right-left-ios7 > .ng-leave, .slide-right-left-ios7.ng-leave {\n  z-index: 2; }\n.slide-ios.reverse > .ng-enter.ng-enter-active, .slide-ios.reverse.ng-enter.ng-enter-active, .slide-left-right-ios7.reverse > .ng-enter.ng-enter-active, .slide-left-right-ios7.reverse.ng-enter.ng-enter-active, .slide-right-left-ios7 > .ng-enter.ng-enter-active, .slide-right-left-ios7.ng-enter.ng-enter-active {\n  /* NEW content ACTIVELY sliding IN from the LEFT */\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n.slide-ios.reverse > .ng-leave.ng-leave-active, .slide-ios.reverse.ng-leave.ng-leave-active, .slide-left-right-ios7.reverse > .ng-leave.ng-leave-active, .slide-left-right-ios7.reverse.ng-leave.ng-leave-active, .slide-right-left-ios7 > .ng-leave.ng-leave-active, .slide-right-left-ios7.ng-leave.ng-leave-active {\n  /* OLD content ACTIVELY sliding OUT to the RIGHT */\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0); }\n\n/**\n * iPad doesn't like box shadows\n */\n.grade-a .slide-ios > .ng-enter:not(.platform-ipad), .grade-a .slide-ios.ng-enter:not(.platform-ipad), .grade-a .slide-left-right-ios7 > .ng-enter:not(.platform-ipad), .grade-a .slide-left-right-ios7.ng-enter:not(.platform-ipad), .grade-a .slide-right-left-ios7.reverse > .ng-enter:not(.platform-ipad), .grade-a .slide-right-left-ios7.reverse.ng-enter:not(.platform-ipad) {\n  box-shadow: none; }\n.grade-a .slide-ios > .ng-enter.ng-enter-active:not(.platform-ipad), .grade-a .slide-ios.ng-enter.ng-enter-active:not(.platform-ipad), .grade-a .slide-left-right-ios7 > .ng-enter.ng-enter-active:not(.platform-ipad), .grade-a .slide-left-right-ios7.ng-enter.ng-enter-active:not(.platform-ipad), .grade-a .slide-right-left-ios7.reverse > .ng-enter.ng-enter-active:not(.platform-ipad), .grade-a .slide-right-left-ios7.reverse.ng-enter.ng-enter-active:not(.platform-ipad) {\n  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.5); }\n.grade-a .slide-ios > .ng-leave, .grade-a .slide-ios.ng-leave, .grade-a .slide-left-right-ios7 > .ng-leave, .grade-a .slide-left-right-ios7.ng-leave, .grade-a .slide-right-left-ios7.reverse > .ng-leave, .grade-a .slide-right-left-ios7.reverse.ng-leave {\n  opacity: 1; }\n.grade-a .slide-ios > .ng-leave.ng-leave-active, .grade-a .slide-ios.ng-leave.ng-leave-active, .grade-a .slide-left-right-ios7 > .ng-leave.ng-leave-active, .grade-a .slide-left-right-ios7.ng-leave.ng-leave-active, .grade-a .slide-right-left-ios7.reverse > .ng-leave.ng-leave-active, .grade-a .slide-right-left-ios7.reverse.ng-leave.ng-leave-active {\n  opacity: 0.9; }\n.grade-a .slide-ios.reverse > .ng-enter, .grade-a .slide-ios.reverse.ng-enter, .grade-a .slide-left-right-ios7.reverse > .ng-enter, .grade-a .slide-left-right-ios7.reverse.ng-enter, .grade-a .slide-right-left-ios7 > .ng-enter, .grade-a .slide-right-left-ios7.ng-enter {\n  opacity: 0.9; }\n.grade-a .slide-ios.reverse > .ng-enter.ng-enter-active, .grade-a .slide-ios.reverse.ng-enter.ng-enter-active, .grade-a .slide-left-right-ios7.reverse > .ng-enter.ng-enter-active, .grade-a .slide-left-right-ios7.reverse.ng-enter.ng-enter-active, .grade-a .slide-right-left-ios7 > .ng-enter.ng-enter-active, .grade-a .slide-right-left-ios7.ng-enter.ng-enter-active {\n  opacity: 1; }\n.grade-a .slide-ios.reverse > .ng-leave, .grade-a .slide-ios.reverse.ng-leave, .grade-a .slide-left-right-ios7.reverse > .ng-leave, .grade-a .slide-left-right-ios7.reverse.ng-leave, .grade-a .slide-right-left-ios7 > .ng-leave, .grade-a .slide-right-left-ios7.ng-leave {\n  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.5);\n  opacity: 1; }\n.grade-a .slide-ios.reverse > .ng-leave.ng-leave-active, .grade-a .slide-ios.reverse.ng-leave.ng-leave-active, .grade-a .slide-left-right-ios7.reverse > .ng-leave.ng-leave-active, .grade-a .slide-left-right-ios7.reverse.ng-leave.ng-leave-active, .grade-a .slide-right-left-ios7 > .ng-leave.ng-leave-active, .grade-a .slide-right-left-ios7.ng-leave.ng-leave-active {\n  box-shadow: none; }\n\n.slide-full > .ng-enter, .slide-full.ng-enter, .slide-full > .ng-leave, .slide-full.ng-leave {\n  -webkit-transition: all ease-in-out 400ms;\n  -moz-transition: all ease-in-out 400ms;\n  transition: all ease-in-out 400ms;\n  position: absolute;\n  top: 0;\n  right: -1px;\n  bottom: 0;\n  left: -1px;\n  width: auto;\n  border-right: none;\n  border-left: none; }\n  .slide-full > .ng-enter:not(.bar), .slide-full.ng-enter:not(.bar), .slide-full > .ng-leave:not(.bar), .slide-full.ng-leave:not(.bar) {\n    border-right: none;\n    border-left: none; }\n.slide-full > .ng-enter, .slide-full.ng-enter {\n  /* NEW content placed far RIGHT BEFORE it slides IN from the RIGHT */\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0); }\n.slide-full > .ng-leave, .slide-full.ng-leave {\n  z-index: 1; }\n.slide-full > .ng-enter.ng-enter-active, .slide-full.ng-enter.ng-enter-active {\n  /* NEW content ACTIVELY sliding IN from the RIGHT */\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n.slide-full > .ng-leave.ng-leave-active, .slide-full.ng-leave.ng-leave-active {\n  /* OLD content ACTIVELY sliding OUT to the LEFT */\n  -webkit-transform: translate3d(-100%, 0, 0);\n  -moz-transform: translate3d(-100%, 0, 0);\n  transform: translate3d(-100%, 0, 0); }\n\n.slide-full.reverse > .ng-enter, .slide-full.reverse.ng-enter, .slide-full.reverse > .ng-leave, .slide-full.reverse.ng-leave {\n  -webkit-transition: all ease-in-out 400ms;\n  -moz-transition: all ease-in-out 400ms;\n  transition: all ease-in-out 400ms;\n  position: absolute;\n  top: 0;\n  right: -1px;\n  bottom: 0;\n  left: -1px;\n  width: auto;\n  border-right: none;\n  border-left: none; }\n.slide-full.reverse > .ng-enter, .slide-full.reverse.ng-enter {\n  /* NEW content placed far LEFT BEFORE it slides IN from the LEFT */\n  -webkit-transform: translate3d(-100%, 0, 0);\n  -moz-transform: translate3d(-100%, 0, 0);\n  transform: translate3d(-100%, 0, 0); }\n.slide-full.reverse > .ng-leave, .slide-full.reverse.ng-leave {\n  z-index: 2; }\n.slide-full.reverse > .ng-enter.ng-enter-active, .slide-full.reverse.ng-enter.ng-enter-active {\n  /* NEW content ACTIVELY sliding IN from the LEFT */\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n.slide-full.reverse > .ng-leave.ng-leave-active, .slide-full.reverse.ng-leave.ng-leave-active {\n  /* OLD content ACTIVELY sliding OUT to the RIGHT */\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0); }\n\n.fade-explode.reverse > .ng-enter, .fade-explode.reverse.ng-enter, .fade-explode.reverse > .ng-leave, .fade-explode.reverse.ng-leave {\n  -webkit-transition: all ease-out 300ms;\n  -moz-transition: all ease-out 300ms;\n  transition: all ease-out 300ms;\n  position: absolute;\n  top: 0;\n  right: -1px;\n  bottom: 0;\n  left: -1px;\n  width: auto; }\n  .fade-explode.reverse > .ng-enter:not(.bar), .fade-explode.reverse.ng-enter:not(.bar), .fade-explode.reverse > .ng-leave:not(.bar), .fade-explode.reverse.ng-leave:not(.bar) {\n    border-right: 1px solid #ddd;\n    border-left: 1px solid #ddd; }\n.fade-explode.reverse > .ng-enter, .fade-explode.reverse.ng-enter {\n  /* NEW content placed far LEFT BEFORE it slides IN from the LEFT */\n  -webkit-transform: scale(0.95);\n  -moz-transform: scale(0.95);\n  transform: scale(0.95);\n  opacity: 0;\n  z-index: 1; }\n.fade-explode.reverse > .ng-leave, .fade-explode.reverse.ng-leave {\n  -webkit-transform: scale(1);\n  -moz-transform: scale(1);\n  transform: scale(1);\n  opacity: 1;\n  z-index: 2; }\n.fade-explode.reverse > .ng-enter.ng-enter-active, .fade-explode.reverse.ng-enter.ng-enter-active {\n  -webkit-transform: scale(1);\n  -moz-transform: scale(1);\n  transform: scale(1);\n  opacity: 1; }\n.fade-explode.reverse > .ng-leave.ng-leave-active, .fade-explode.reverse.ng-leave.ng-leave-active {\n  -webkit-transform: scale(1.6);\n  -moz-transform: scale(1.6);\n  transform: scale(1.6);\n  opacity: 0; }\n\n/**\n * Android style \"pop in\" with fade and scale\n */\n.fade-implode > .ng-enter, .fade-implode.ng-enter, .fade-implode > .ng-leave, .fade-implode.ng-leave {\n  -webkit-transition: all ease-out 200ms;\n  -moz-transition: all ease-out 200ms;\n  transition: all ease-out 200ms;\n  position: absolute;\n  top: 0;\n  right: -1px;\n  bottom: 0;\n  left: -1px;\n  width: auto; }\n  .fade-implode > .ng-enter:not(.bar), .fade-implode.ng-enter:not(.bar), .fade-implode > .ng-leave:not(.bar), .fade-implode.ng-leave:not(.bar) {\n    border-right: 1px solid #ddd;\n    border-left: 1px solid #ddd; }\n.fade-implode > .ng-enter, .fade-implode.ng-enter {\n  /* NEW content placed far RIGHT BEFORE it slides IN from the RIGHT */\n  -webkit-transform: scale(0.8);\n  -moz-transform: scale(0.8);\n  transform: scale(0.8);\n  opacity: 0;\n  z-index: 2; }\n.fade-implode > .ng-leave, .fade-implode.ng-leave {\n  z-index: 1; }\n.fade-implode > .ng-enter.ng-enter-active, .fade-implode.ng-enter.ng-enter-active {\n  /* NEW content */\n  -webkit-transform: scale(1);\n  -moz-transform: scale(1);\n  transform: scale(1);\n  opacity: 1; }\n\n.fade-implode.reverse > .ng-enter, .fade-implode.reverse.ng-enter, .fade-implode.reverse > .ng-leave, .fade-implode.reverse.ng-leave {\n  -webkit-transition: all ease-out 200ms;\n  -moz-transition: all ease-out 200ms;\n  transition: all ease-out 200ms;\n  position: absolute;\n  top: 0;\n  right: -1px;\n  bottom: 0;\n  left: -1px;\n  width: auto;\n  border-right: 1px solid #ddd;\n  border-left: 1px solid #ddd; }\n.fade-implode.reverse > .ng-enter, .fade-implode.reverse.ng-enter {\n  -webkit-transform: scale(1);\n  -moz-transform: scale(1);\n  transform: scale(1);\n  opacity: 1;\n  z-index: 1; }\n.fade-implode.reverse > .ng-leave, .fade-implode.reverse.ng-leave {\n  -webkit-transform: scale(1);\n  -moz-transform: scale(1);\n  transform: scale(1);\n  opacity: 1;\n  z-index: 2; }\n.fade-implode.reverse > .ng-enter.ng-enter-active, .fade-implode.reverse.ng-enter.ng-enter-active {\n  opacity: 1; }\n.fade-implode.reverse > .ng-leave.ng-leave-active, .fade-implode.reverse.ng-leave.ng-leave-active {\n  -webkit-transform: scale(0.8);\n  -moz-transform: scale(0.8);\n  transform: scale(0.8);\n  opacity: 0; }\n\n/**\n * Simple slide-in animation\n */\n.slide-in-left {\n  -webkit-transform: translate3d(0%, 0, 0);\n  -moz-transform: translate3d(0%, 0, 0);\n  transform: translate3d(0%, 0, 0); }\n  .slide-in-left.ng-enter, .slide-in-left > .ng-enter {\n    -webkit-animation-name: slideInFromLeft;\n    -moz-animation-name: slideInFromLeft;\n    animation-name: slideInFromLeft;\n    -webkit-animation-duration: 250ms;\n    -moz-animation-duration: 250ms;\n    animation-duration: 250ms;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .slide-in-left.ng-leave, .slide-in-left > .ng-leave {\n    -webkit-animation-name: slideOutToLeft;\n    -moz-animation-name: slideOutToLeft;\n    animation-name: slideOutToLeft;\n    -webkit-animation-duration: 250ms;\n    -moz-animation-duration: 250ms;\n    animation-duration: 250ms;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n\n.slide-in-left-add {\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0);\n  -webkit-animation-duration: 250ms;\n  -moz-animation-duration: 250ms;\n  animation-duration: 250ms;\n  -webkit-animation-timing-function: ease-in-out;\n  -moz-animation-timing-function: ease-in-out;\n  animation-timing-function: ease-in-out;\n  -webkit-animation-fill-mode: both;\n  -moz-animation-fill-mode: both;\n  animation-fill-mode: both; }\n\n.slide-in-left-add-active {\n  -webkit-animation-name: slideInFromLeft;\n  -moz-animation-name: slideInFromLeft;\n  animation-name: slideInFromLeft; }\n\n.slide-out-left {\n  -webkit-transform: translate3d(-100%, 0, 0);\n  -moz-transform: translate3d(-100%, 0, 0);\n  transform: translate3d(-100%, 0, 0); }\n  .slide-out-left.ng-enter, .slide-out-left > .ng-enter {\n    -webkit-animation-name: slideOutToLeft;\n    -moz-animation-name: slideOutToLeft;\n    animation-name: slideOutToLeft;\n    -webkit-animation-duration: 250ms;\n    -moz-animation-duration: 250ms;\n    animation-duration: 250ms;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .slide-out-left.ng-leave, .slide-out-left > .ng-leave {\n    -webkit-animation-name: slideOutToLeft;\n    -moz-animation-name: slideOutToLeft;\n    animation-name: slideOutToLeft;\n    -webkit-animation-duration: 250ms;\n    -moz-animation-duration: 250ms;\n    animation-duration: 250ms;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n\n.slide-out-left-add {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  -webkit-animation-duration: 250ms;\n  -moz-animation-duration: 250ms;\n  animation-duration: 250ms;\n  -webkit-animation-timing-function: ease-in-out;\n  -moz-animation-timing-function: ease-in-out;\n  animation-timing-function: ease-in-out;\n  -webkit-animation-fill-mode: both;\n  -moz-animation-fill-mode: both;\n  animation-fill-mode: both; }\n\n.slide-out-left-add-active {\n  -webkit-animation-name: slideOutToLeft;\n  -moz-animation-name: slideOutToLeft;\n  animation-name: slideOutToLeft; }\n\n.slide-in-right {\n  -webkit-transform: translate3d(0%, 0, 0);\n  -moz-transform: translate3d(0%, 0, 0);\n  transform: translate3d(0%, 0, 0); }\n  .slide-in-right.ng-enter, .slide-in-right > .ng-enter {\n    -webkit-animation-name: slideInFromRight;\n    -moz-animation-name: slideInFromRight;\n    animation-name: slideInFromRight;\n    -webkit-animation-duration: 250ms;\n    -moz-animation-duration: 250ms;\n    animation-duration: 250ms;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .slide-in-right.ng-leave, .slide-in-right > .ng-leave {\n    -webkit-animation-name: slideOutToRight;\n    -moz-animation-name: slideOutToRight;\n    animation-name: slideOutToRight;\n    -webkit-animation-duration: 250ms;\n    -moz-animation-duration: 250ms;\n    animation-duration: 250ms;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n\n.slide-in-right-add {\n  -webkit-transform: translate3d(-100%, 0, 0);\n  -moz-transform: translate3d(-100%, 0, 0);\n  transform: translate3d(-100%, 0, 0);\n  -webkit-animation-duration: 250ms;\n  -moz-animation-duration: 250ms;\n  animation-duration: 250ms;\n  -webkit-animation-timing-function: ease-in-out;\n  -moz-animation-timing-function: ease-in-out;\n  animation-timing-function: ease-in-out;\n  -webkit-animation-fill-mode: both;\n  -moz-animation-fill-mode: both;\n  animation-fill-mode: both; }\n\n.slide-in-right-add-active {\n  -webkit-animation-name: slideInFromRight;\n  -moz-animation-name: slideInFromRight;\n  animation-name: slideInFromRight; }\n\n.slide-out-right {\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0); }\n  .slide-out-right.ng-enter, .slide-out-right > .ng-enter {\n    -webkit-animation-name: slideOutToRight;\n    -moz-animation-name: slideOutToRight;\n    animation-name: slideOutToRight;\n    -webkit-animation-duration: 250ms;\n    -moz-animation-duration: 250ms;\n    animation-duration: 250ms;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .slide-out-right.ng-leave, .slide-out-right > .ng-leave {\n    -webkit-animation-name: slideOutToRight;\n    -moz-animation-name: slideOutToRight;\n    animation-name: slideOutToRight;\n    -webkit-animation-duration: 250ms;\n    -moz-animation-duration: 250ms;\n    animation-duration: 250ms;\n    -webkit-animation-timing-function: ease-in-out;\n    -moz-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    -moz-animation-fill-mode: both;\n    animation-fill-mode: both; }\n\n.slide-out-right-add {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  -webkit-animation-duration: 250ms;\n  -moz-animation-duration: 250ms;\n  animation-duration: 250ms;\n  -webkit-animation-timing-function: ease-in-out;\n  -moz-animation-timing-function: ease-in-out;\n  animation-timing-function: ease-in-out;\n  -webkit-animation-fill-mode: both;\n  -moz-animation-fill-mode: both;\n  animation-fill-mode: both; }\n\n.slide-out-right-add-active {\n  -webkit-animation-name: slideOutToRight;\n  -moz-animation-name: slideOutToRight;\n  animation-name: slideOutToRight; }\n\n/**\n * Slide up from the bottom, used for modals\n * --------------------------------------------------\n */\n.slide-in-up {\n  -webkit-transform: translate3d(0, 100%, 0);\n  -moz-transform: translate3d(0, 100%, 0);\n  transform: translate3d(0, 100%, 0); }\n\n.slide-in-up.ng-enter, .slide-in-up > .ng-enter {\n  -webkit-transition: all cubic-bezier(0.1, 0.7, 0.1, 1) 400ms;\n  -moz-transition: all cubic-bezier(0.1, 0.7, 0.1, 1) 400ms;\n  transition: all cubic-bezier(0.1, 0.7, 0.1, 1) 400ms; }\n\n.slide-in-up.ng-enter-active, .slide-in-up > .ng-enter-active {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n\n.slide-in-up.ng-leave, .slide-in-up > .ng-leave {\n  -webkit-transition: all ease-in-out 250ms;\n  -moz-transition: all ease-in-out 250ms;\n  transition: all ease-in-out 250ms; }\n\n.fade-in {\n  -webkit-animation: fadeOut 0.3s;\n  -moz-animation: fadeOut 0.3s;\n  animation: fadeOut 0.3s; }\n  .fade-in.active {\n    -webkit-animation: fadeIn 0.3s;\n    -moz-animation: fadeIn 0.3s;\n    animation: fadeIn 0.3s; }\n\n.fade-in-not-out.ng-enter, .fade-in-not-out .ng-enter {\n  -webkit-animation: fadeIn 0.3s;\n  -moz-animation: fadeIn 0.3s;\n  animation: fadeIn 0.3s;\n  position: relative; }\n.fade-in-not-out.ng-leave, .fade-in-not-out .ng-leave {\n  display: none; }\n\n/**\n * Some component specific animations\n */\n.nav-title-slide-ios:not(.no-animation) .button.back-button, .nav-title-slide-ios7:not(.no-animation) .button.back-button {\n  -webkit-transition: all 400ms;\n  -moz-transition: all 400ms;\n  transition: all 400ms;\n  -webkit-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  -moz-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  -webkit-transform: translate3d(0%, 0, 0);\n  -moz-transform: translate3d(0%, 0, 0);\n  transform: translate3d(0%, 0, 0);\n  opacity: 1; }\n  .nav-title-slide-ios:not(.no-animation) .button.back-button.active, .nav-title-slide-ios:not(.no-animation) .button.back-button.activated, .nav-title-slide-ios7:not(.no-animation) .button.back-button.active, .nav-title-slide-ios7:not(.no-animation) .button.back-button.activated {\n    opacity: 0.5; }\n  .nav-title-slide-ios:not(.no-animation) .button.back-button.ng-hide, .nav-title-slide-ios7:not(.no-animation) .button.back-button.ng-hide {\n    opacity: 0;\n    -webkit-transform: translate3d(30%, 0, 0);\n    -moz-transform: translate3d(30%, 0, 0);\n    transform: translate3d(30%, 0, 0); }\n  .nav-title-slide-ios:not(.no-animation) .button.back-button.ng-hide-add, .nav-title-slide-ios:not(.no-animation) .button.back-button.ng-hide-remove, .nav-title-slide-ios7:not(.no-animation) .button.back-button.ng-hide-add, .nav-title-slide-ios7:not(.no-animation) .button.back-button.ng-hide-remove {\n    display: block !important; }\n  .nav-title-slide-ios:not(.no-animation) .button.back-button.ng-hide-add, .nav-title-slide-ios7:not(.no-animation) .button.back-button.ng-hide-add {\n    position: absolute; }\n.nav-title-slide-ios > .ng-enter, .nav-title-slide-ios.ng-enter, .nav-title-slide-ios > .ng-leave, .nav-title-slide-ios.ng-leave, .nav-title-slide-ios7 > .ng-enter, .nav-title-slide-ios7.ng-enter, .nav-title-slide-ios7 > .ng-leave, .nav-title-slide-ios7.ng-leave {\n  -webkit-transition: all 400ms;\n  -moz-transition: all 400ms;\n  transition: all 400ms;\n  -webkit-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  -moz-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  opacity: 1; }\n.nav-title-slide-ios > .ng-enter, .nav-title-slide-ios.ng-enter, .nav-title-slide-ios7 > .ng-enter, .nav-title-slide-ios7.ng-enter {\n  -webkit-transform: translate3d(30%, 0, 0);\n  -moz-transform: translate3d(30%, 0, 0);\n  transform: translate3d(30%, 0, 0);\n  opacity: 0; }\n  .nav-title-slide-ios > .ng-enter.title, .nav-title-slide-ios.ng-enter.title, .nav-title-slide-ios7 > .ng-enter.title, .nav-title-slide-ios7.ng-enter.title {\n    -webkit-transform: translate3d(100%, 0, 0);\n    -moz-transform: translate3d(100%, 0, 0);\n    transform: translate3d(100%, 0, 0); }\n.nav-title-slide-ios > .ng-enter.ng-enter-active, .nav-title-slide-ios.ng-enter.ng-enter-active, .nav-title-slide-ios7 > .ng-enter.ng-enter-active, .nav-title-slide-ios7.ng-enter.ng-enter-active {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  opacity: 1; }\n.nav-title-slide-ios > .ng-leave.ng-leave-active, .nav-title-slide-ios.ng-leave.ng-leave-active, .nav-title-slide-ios7 > .ng-leave.ng-leave-active, .nav-title-slide-ios7.ng-leave.ng-leave-active {\n  -webkit-transform: translate3d(-30%, 0, 0);\n  -moz-transform: translate3d(-30%, 0, 0);\n  transform: translate3d(-30%, 0, 0);\n  opacity: 0; }\n.nav-title-slide-ios.reverse > .ng-enter, .nav-title-slide-ios.reverse.ng-enter, .nav-title-slide-ios.reverse > .ng-leave, .nav-title-slide-ios.reverse.ng-leave, .nav-title-slide-ios7.reverse > .ng-enter, .nav-title-slide-ios7.reverse.ng-enter, .nav-title-slide-ios7.reverse > .ng-leave, .nav-title-slide-ios7.reverse.ng-leave {\n  -webkit-transition: all 400ms;\n  -moz-transition: all 400ms;\n  transition: all 400ms;\n  -webkit-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  -moz-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  opacity: 1; }\n.nav-title-slide-ios.reverse > .ng-enter, .nav-title-slide-ios.reverse.ng-enter, .nav-title-slide-ios7.reverse > .ng-enter, .nav-title-slide-ios7.reverse.ng-enter {\n  -webkit-transform: translate3d(-30%, 0, 0);\n  -moz-transform: translate3d(-30%, 0, 0);\n  transform: translate3d(-30%, 0, 0);\n  opacity: 0; }\n.nav-title-slide-ios.reverse > .ng-enter.ng-enter-active, .nav-title-slide-ios.reverse.ng-enter.ng-enter-active, .nav-title-slide-ios7.reverse > .ng-enter.ng-enter-active, .nav-title-slide-ios7.reverse.ng-enter.ng-enter-active {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  opacity: 1; }\n.nav-title-slide-ios.reverse > .ng-leave.ng-leave-active, .nav-title-slide-ios.reverse.ng-leave.ng-leave-active, .nav-title-slide-ios7.reverse > .ng-leave.ng-leave-active, .nav-title-slide-ios7.reverse.ng-leave.ng-leave-active {\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0);\n  opacity: 0; }\n\n/**\n * Some component specific animations\n */\n.nav-title-slide-full:not(.no-animation) .button.back-button {\n  -webkit-transition: all 400ms;\n  -moz-transition: all 400ms;\n  transition: all 400ms;\n  -webkit-transition-timing-function: ease-in-out;\n  -moz-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  -webkit-transform: translate3d(0%, 0, 0);\n  -moz-transform: translate3d(0%, 0, 0);\n  transform: translate3d(0%, 0, 0);\n  opacity: 1; }\n  .nav-title-slide-full:not(.no-animation) .button.back-button.active, .nav-title-slide-full:not(.no-animation) .button.back-button.activated {\n    opacity: 0.5; }\n  .nav-title-slide-full:not(.no-animation) .button.back-button.ng-hide {\n    opacity: 0;\n    -webkit-transform: translate3d(30%, 0, 0);\n    -moz-transform: translate3d(30%, 0, 0);\n    transform: translate3d(30%, 0, 0); }\n  .nav-title-slide-full:not(.no-animation) .button.back-button.ng-hide-add, .nav-title-slide-full:not(.no-animation) .button.back-button.ng-hide-remove {\n    display: block !important; }\n  .nav-title-slide-full:not(.no-animation) .button.back-button.ng-hide-add {\n    position: absolute; }\n.nav-title-slide-full > .ng-enter, .nav-title-slide-full.ng-enter, .nav-title-slide-full > .ng-leave, .nav-title-slide-full.ng-leave {\n  -webkit-transition: all 400ms;\n  -moz-transition: all 400ms;\n  transition: all 400ms;\n  -webkit-transition-timing-function: ease-in-out;\n  -moz-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  opacity: 1; }\n.nav-title-slide-full > .ng-enter, .nav-title-slide-full.ng-enter {\n  -webkit-transform: translate3d(30%, 0, 0);\n  -moz-transform: translate3d(30%, 0, 0);\n  transform: translate3d(30%, 0, 0);\n  opacity: 0; }\n  .nav-title-slide-full > .ng-enter.title, .nav-title-slide-full.ng-enter.title {\n    -webkit-transform: translate3d(100%, 0, 0);\n    -moz-transform: translate3d(100%, 0, 0);\n    transform: translate3d(100%, 0, 0); }\n.nav-title-slide-full > .ng-enter.ng-enter-active, .nav-title-slide-full.ng-enter.ng-enter-active {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  opacity: 1; }\n.nav-title-slide-full > .ng-leave.ng-leave-active, .nav-title-slide-full.ng-leave.ng-leave-active {\n  -webkit-transform: translate3d(-30%, 0, 0);\n  -moz-transform: translate3d(-30%, 0, 0);\n  transform: translate3d(-30%, 0, 0);\n  opacity: 0; }\n.nav-title-slide-full.reverse > .ng-enter, .nav-title-slide-full.reverse.ng-enter, .nav-title-slide-full.reverse > .ng-leave, .nav-title-slide-full.reverse.ng-leave {\n  -webkit-transition: all 400ms;\n  -moz-transition: all 400ms;\n  transition: all 400ms;\n  -webkit-transition-timing-function: ease-in-out;\n  -moz-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  opacity: 1; }\n.nav-title-slide-full.reverse > .ng-enter, .nav-title-slide-full.reverse.ng-enter {\n  -webkit-transform: translate3d(-30%, 0, 0);\n  -moz-transform: translate3d(-30%, 0, 0);\n  transform: translate3d(-30%, 0, 0);\n  opacity: 0; }\n.nav-title-slide-full.reverse > .ng-enter.ng-enter-active, .nav-title-slide-full.reverse.ng-enter.ng-enter-active {\n  -webkit-transform: translate3d(0, 0, 0);\n  -moz-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  opacity: 1; }\n.nav-title-slide-full.reverse > .ng-leave.ng-leave-active, .nav-title-slide-full.reverse.ng-leave.ng-leave-active {\n  -webkit-transform: translate3d(100%, 0, 0);\n  -moz-transform: translate3d(100%, 0, 0);\n  transform: translate3d(100%, 0, 0);\n  opacity: 0; }\n\n.nav-title-android:not(.no-animation) .button.back-button {\n  -webkit-transition: all 200ms;\n  -moz-transition: all 200ms;\n  transition: all 200ms;\n  -webkit-transition-timing-function: linear;\n  -moz-transition-timing-function: linear;\n  transition-timing-function: linear;\n  opacity: 1; }\n  .nav-title-android:not(.no-animation) .button.back-button.ng-hide {\n    opacity: 0; }\n  .nav-title-android:not(.no-animation) .button.back-button.ng-hide-add, .nav-title-android:not(.no-animation) .button.back-button.ng-hide-remove {\n    display: block !important; }\n  .nav-title-android:not(.no-animation) .button.back-button.ng-hide-add {\n    position: absolute; }\n.nav-title-android > .ng-enter, .nav-title-android.ng-enter, .nav-title-android > .ng-leave, .nav-title-android.ng-leave {\n  -webkit-transition: all 200ms;\n  -moz-transition: all 200ms;\n  transition: all 200ms;\n  -webkit-transition-timing-function: linear;\n  -moz-transition-timing-function: linear;\n  transition-timing-function: linear; }\n.nav-title-android > .ng-enter, .nav-title-android.ng-enter {\n  opacity: 0; }\n.nav-title-android > .ng-enter.ng-enter-active, .nav-title-android.ng-enter.ng-enter-active {\n  opacity: 1; }\n.nav-title-android > .ng-leave.ng-leave-active, .nav-title-android.ng-leave.ng-leave-active {\n  opacity: 0; }\n\n/**\n * Grid\n * --------------------------------------------------\n * Using flexbox for the grid, inspired by Philip Walton:\n * http://philipwalton.github.io/solved-by-flexbox/demos/grids/\n * By default each .col within a .row will evenly take up\n * available width, and the height of each .col with take\n * up the height of the tallest .col in the same .row.\n */\n.row {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  padding: 5px;\n  width: 100%; }\n\n.row-wrap {\n  -webkit-flex-wrap: wrap;\n  -moz-flex-wrap: wrap;\n  -ms-flex-wrap: wrap;\n  flex-wrap: wrap; }\n\n.row + .row {\n  margin-top: -5px;\n  padding-top: 0; }\n\n.col {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  padding: 5px;\n  width: 100%; }\n\n/* Vertically Align Columns */\n/* .row-* vertically aligns every .col in the .row */\n.row-top {\n  -webkit-box-align: start;\n  -ms-flex-align: start;\n  -webkit-align-items: flex-start;\n  -moz-align-items: flex-start;\n  align-items: flex-start; }\n\n.row-bottom {\n  -webkit-box-align: end;\n  -ms-flex-align: end;\n  -webkit-align-items: flex-end;\n  -moz-align-items: flex-end;\n  align-items: flex-end; }\n\n.row-center {\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center; }\n\n.row-stretch {\n  -webkit-box-align: stretch;\n  -ms-flex-align: stretch;\n  -webkit-align-items: stretch;\n  -moz-align-items: stretch;\n  align-items: stretch; }\n\n.row-baseline {\n  -webkit-box-align: baseline;\n  -ms-flex-align: baseline;\n  -webkit-align-items: baseline;\n  -moz-align-items: baseline;\n  align-items: baseline; }\n\n/* .col-* vertically aligns an individual .col */\n.col-top {\n  -webkit-align-self: flex-start;\n  -moz-align-self: flex-start;\n  -ms-flex-item-align: start;\n  align-self: flex-start; }\n\n.col-bottom {\n  -webkit-align-self: flex-end;\n  -moz-align-self: flex-end;\n  -ms-flex-item-align: end;\n  align-self: flex-end; }\n\n.col-center {\n  -webkit-align-self: center;\n  -moz-align-self: center;\n  -ms-flex-item-align: center;\n  align-self: center; }\n\n/* Column Offsets */\n.col-offset-10 {\n  margin-left: 10%; }\n\n.col-offset-20 {\n  margin-left: 20%; }\n\n.col-offset-25 {\n  margin-left: 25%; }\n\n.col-offset-33, .col-offset-34 {\n  margin-left: 33.3333%; }\n\n.col-offset-50 {\n  margin-left: 50%; }\n\n.col-offset-66, .col-offset-67 {\n  margin-left: 66.6666%; }\n\n.col-offset-75 {\n  margin-left: 75%; }\n\n.col-offset-80 {\n  margin-left: 80%; }\n\n.col-offset-90 {\n  margin-left: 90%; }\n\n/* Explicit Column Percent Sizes */\n/* By default each grid column will evenly distribute */\n/* across the grid. However, you can specify individual */\n/* columns to take up a certain size of the available area */\n.col-10 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 10%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 10%;\n  -ms-flex: 0 0 10%;\n  flex: 0 0 10%;\n  max-width: 10%; }\n\n.col-20 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 20%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 20%;\n  -ms-flex: 0 0 20%;\n  flex: 0 0 20%;\n  max-width: 20%; }\n\n.col-25 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 25%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 25%;\n  -ms-flex: 0 0 25%;\n  flex: 0 0 25%;\n  max-width: 25%; }\n\n.col-33, .col-34 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 33.3333%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 33.3333%;\n  -ms-flex: 0 0 33.3333%;\n  flex: 0 0 33.3333%;\n  max-width: 33.3333%; }\n\n.col-50 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 50%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 50%;\n  -ms-flex: 0 0 50%;\n  flex: 0 0 50%;\n  max-width: 50%; }\n\n.col-66, .col-67 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 66.6666%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 66.6666%;\n  -ms-flex: 0 0 66.6666%;\n  flex: 0 0 66.6666%;\n  max-width: 66.6666%; }\n\n.col-75 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 75%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 75%;\n  -ms-flex: 0 0 75%;\n  flex: 0 0 75%;\n  max-width: 75%; }\n\n.col-80 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 80%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 80%;\n  -ms-flex: 0 0 80%;\n  flex: 0 0 80%;\n  max-width: 80%; }\n\n.col-90 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 90%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 90%;\n  -ms-flex: 0 0 90%;\n  flex: 0 0 90%;\n  max-width: 90%; }\n\n/* Responsive Grid Classes */\n/* Adding a class of responsive-X to a row */\n/* will trigger the flex-direction to */\n/* change to column and add some margin */\n/* to any columns in the row for clearity */\n@media (max-width: 567px) {\n  .responsive-sm {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-sm .col, .responsive-sm .col-10, .responsive-sm .col-20, .responsive-sm .col-25, .responsive-sm .col-33, .responsive-sm .col-34, .responsive-sm .col-50, .responsive-sm .col-66, .responsive-sm .col-67, .responsive-sm .col-75, .responsive-sm .col-80, .responsive-sm .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n@media (max-width: 767px) {\n  .responsive-md {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-md .col, .responsive-md .col-10, .responsive-md .col-20, .responsive-md .col-25, .responsive-md .col-33, .responsive-md .col-34, .responsive-md .col-50, .responsive-md .col-66, .responsive-md .col-67, .responsive-md .col-75, .responsive-md .col-80, .responsive-md .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n@media (max-width: 1023px) {\n  .responsive-lg {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-lg .col, .responsive-lg .col-10, .responsive-lg .col-20, .responsive-lg .col-25, .responsive-lg .col-33, .responsive-lg .col-34, .responsive-lg .col-50, .responsive-lg .col-66, .responsive-lg .col-67, .responsive-lg .col-75, .responsive-lg .col-80, .responsive-lg .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n/**\n * Utility Classes\n * --------------------------------------------------\n */\n.hide {\n  display: none; }\n\n.opacity-hide {\n  opacity: 0; }\n\n.grade-b .opacity-hide, .grade-c .opacity-hide {\n  opacity: 1;\n  display: none; }\n\n.show {\n  display: block; }\n\n.opacity-show {\n  opacity: 1; }\n\n.invisible {\n  visibility: hidden; }\n\n.keyboard-open .hide-on-keyboard-open {\n  display: none; }\n\n.keyboard-open .tabs.hide-on-keyboard-open + .pane .has-tabs, .keyboard-open .bar-footer.hide-on-keyboard-open + .pane .has-footer {\n  bottom: 0; }\n\n.inline {\n  display: inline-block; }\n\n.disable-pointer-events {\n  pointer-events: none; }\n\n.enable-pointer-events {\n  pointer-events: auto; }\n\n.disable-user-behavior {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  -webkit-touch-callout: none;\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n  -webkit-tap-highlight-color: transparent;\n  -webkit-user-drag: none;\n  -ms-touch-action: none;\n  -ms-content-zooming: none; }\n\n.click-block {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 99999;\n  width: 100%;\n  height: 100%;\n  background: transparent; }\n\n.no-resize {\n  resize: none; }\n\n.block {\n  display: block;\n  clear: both; }\n  .block:after {\n    display: block;\n    visibility: hidden;\n    clear: both;\n    height: 0;\n    content: \".\"; }\n\n.full-image {\n  width: 100%; }\n\n.clearfix {\n  *zoom: 1; }\n  .clearfix:before, .clearfix:after {\n    display: table;\n    content: \"\";\n    line-height: 0; }\n  .clearfix:after {\n    clear: both; }\n\n/**\n * Content Padding\n * --------------------------------------------------\n */\n.padding {\n  padding: 10px; }\n\n.padding-top, .padding-vertical {\n  padding-top: 10px; }\n\n.padding-right, .padding-horizontal {\n  padding-right: 10px; }\n\n.padding-bottom, .padding-vertical {\n  padding-bottom: 10px; }\n\n.padding-left, .padding-horizontal {\n  padding-left: 10px; }\n\n/**\n * Rounded\n * --------------------------------------------------\n */\n.rounded {\n  border-radius: 4px; }\n\n/**\n * Utility Colors\n * --------------------------------------------------\n * Utility colors are added to help set a naming convention. You'll\n * notice we purposely do not use words like \"red\" or \"blue\", but\n * instead have colors which represent an emotion or generic theme.\n */\n.light, a.light {\n  color: #fff; }\n\n.light-bg {\n  background-color: #fff; }\n\n.light-border {\n  border-color: #ddd; }\n\n.stable, a.stable {\n  color: #f8f8f8; }\n\n.stable-bg {\n  background-color: #f8f8f8; }\n\n.stable-border {\n  border-color: #b2b2b2; }\n\n.positive, a.positive {\n  color: #4a87ee; }\n\n.positive-bg {\n  background-color: #4a87ee; }\n\n.positive-border {\n  border-color: #145fd7; }\n\n.calm, a.calm {\n  color: #43cee6; }\n\n.calm-bg {\n  background-color: #43cee6; }\n\n.calm-border {\n  border-color: #1aacc3; }\n\n.assertive, a.assertive {\n  color: #ef4e3a; }\n\n.assertive-bg {\n  background-color: #ef4e3a; }\n\n.assertive-border {\n  border-color: #cc2311; }\n\n.balanced, a.balanced {\n  color: #66cc33; }\n\n.balanced-bg {\n  background-color: #66cc33; }\n\n.balanced-border {\n  border-color: #498f24; }\n\n.energized, a.energized {\n  color: #f0b840; }\n\n.energized-bg {\n  background-color: #f0b840; }\n\n.energized-border {\n  border-color: #d39211; }\n\n.royal, a.royal {\n  color: #8a6de9; }\n\n.royal-bg {\n  background-color: #8a6de9; }\n\n.royal-border {\n  border-color: #552bdf; }\n\n.dark, a.dark {\n  color: #444; }\n\n.dark-bg {\n  background-color: #444; }\n\n.dark-border {\n  border-color: #111; }\n\n/**\n * Platform\n * --------------------------------------------------\n * Platform specific tweaks\n */\n/**\n * Apply roboto font\n */\n.roboto {\n  font-family: \"Roboto\", \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif; }\n  .roboto input {\n    font-family: \"Roboto\", \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif; }\n\n/*\n.platform-android {\n\n\n  .bar {\n    padding: 0;\n\n    line-height: 40px;\n\n    .button {\n      line-height: 40px;\n    }\n\n    .button-icon:before {\n      font-size: 24px;\n    }\n  }\n\n  .back-button {\n    &.button-icon:before {\n      line-height: 40px;\n    }\n    margin-left: -3px;\n    padding: 0px 2px !important;\n    &.ion-android-arrow-back:before {\n      font-size: 12px;\n    }\n\n    &.back-button.active,\n    &.back-button.activated {\n      background-color: rgba(0,0,0,0.1);\n    }\n  }\n\n  .item-divider {\n    background: none;\n    border-top-width: 0;\n    border-bottom-width: 2px;\n    text-transform: uppercase;\n    margin-top: 10px;\n    font-size: 14px;\n  }\n  .item {\n    border-left-width: 0;\n    border-right-width: 0;\n  }\n\n  .item-divider ~ .item:not(.item-divider) {\n    border-bottom-width: 0;\n  }\n\n  .back-button:not(.ng-hide) + .left-buttons + .title {\n    // Don't allow normal titles in this mode\n    display: none;\n  }\n\n  .bar .title {\n    text-align: left;\n    font-weight: normal;\n  }\n\n  font-family: 'Roboto';\n\n  h1, h2, h3, h4, h5 {\n    font-family: 'Roboto', $font-family-base;\n  }\n\n  .tab-item {\n    font-family: 'Roboto', $font-family-base;\n  }\n\n\n  input, button, select, textarea {\n    font-family: 'Roboto', $font-family-base;\n  }\n  */\n.platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader) {\n  height: 64px; }\n  .platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader).item-input-inset .item-input-wrapper {\n    margin-top: 19px !important; }\n  .platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader) > * {\n    margin-top: 20px; }\n.platform-ios.platform-cordova:not(.fullscreen) .tabs-top > .tabs, .platform-ios.platform-cordova:not(.fullscreen) .tabs.tabs-top {\n  top: 64px; }\n.platform-ios.platform-cordova:not(.fullscreen) .has-header, .platform-ios.platform-cordova:not(.fullscreen) .bar-subheader {\n  top: 64px; }\n.platform-ios.platform-cordova:not(.fullscreen) .has-subheader {\n  top: 108px; }\n.platform-ios.platform-cordova:not(.fullscreen) .has-tabs-top {\n  top: 113px; }\n.platform-ios.platform-cordova:not(.fullscreen) .has-header.has-subheader.has-tabs-top {\n  top: 157px; }\n.platform-ios.platform-cordova.status-bar-hide {\n  margin-bottom: 20px; }\n\n@media (orientation: landscape) {\n  .platform-ios.platform-browser.platform-ipad {\n    position: fixed; } }\n\n.platform-c:not(.enable-transitions) * {\n  -webkit-transition: none !important;\n  transition: none !important; }\n"
  },
  {
    "path": "www/lib/ionic/js/ionic-angular.js",
    "content": "/*!\n * Copyright 2014 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.0.0-beta.12\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n\n(function() {\n/*\n * deprecated.js\n * https://github.com/wearefractal/deprecated/\n * Copyright (c) 2014 Fractal <contact@wearefractal.com>\n * License MIT\n */\n//Interval object\nvar deprecated = {\n  method: function(msg, log, fn) {\n    var called = false;\n    return function deprecatedMethod(){\n      if (!called) {\n        called = true;\n        log(msg);\n      }\n      return fn.apply(this, arguments);\n    };\n  },\n\n  field: function(msg, log, parent, field, val) {\n    var called = false;\n    var getter = function(){\n      if (!called) {\n        called = true;\n        log(msg);\n      }\n      return val;\n    };\n    var setter = function(v) {\n      if (!called) {\n        called = true;\n        log(msg);\n      }\n      val = v;\n      return v;\n    };\n    Object.defineProperty(parent, field, {\n      get: getter,\n      set: setter,\n      enumerable: true\n    });\n    return;\n  }\n};\n\n\nvar IonicModule = angular.module('ionic', ['ngAnimate', 'ngSanitize', 'ui.router']),\n  extend = angular.extend,\n  forEach = angular.forEach,\n  isDefined = angular.isDefined,\n  isString = angular.isString,\n  jqLite = angular.element;\n\n\n/**\n * @ngdoc service\n * @name $ionicActionSheet\n * @module ionic\n * @description\n * The Action Sheet is a slide-up pane that lets the user choose from a set of options.\n * Dangerous options are highlighted in red and made obvious.\n *\n * There are easy ways to cancel out of the action sheet, such as tapping the backdrop or even\n * hitting escape on the keyboard for desktop testing.\n *\n * ![Action Sheet](http://ionicframework.com.s3.amazonaws.com/docs/controllers/actionSheet.gif)\n *\n * @usage\n * To trigger an Action Sheet in your code, use the $ionicActionSheet service in your angular controllers:\n *\n * ```js\n * angular.module('mySuperApp', ['ionic'])\n * .controller(function($scope, $ionicActionSheet, $timeout) {\n *\n *  // Triggered on a button click, or some other target\n *  $scope.show = function() {\n *\n *    // Show the action sheet\n *    var hideSheet = $ionicActionSheet.show({\n *      buttons: [\n *        { text: '<b>Share</b> This' },\n *        { text: 'Move' }\n *      ],\n *      destructiveText: 'Delete',\n *      titleText: 'Modify your album',\n *      cancelText: 'Cancel',\n *      cancel: function() {\n          // add cancel code..\n        },\n *      buttonClicked: function(index) {\n *        return true;\n *      }\n *    });\n *\n *    // For example's sake, hide the sheet after two seconds\n *    $timeout(function() {\n *      hideSheet();\n *    }, 2000);\n *\n *  };\n * });\n * ```\n *\n */\nIonicModule\n.factory('$ionicActionSheet', [\n  '$rootScope',\n  '$compile',\n  '$animate',\n  '$timeout',\n  '$ionicTemplateLoader',\n  '$ionicPlatform',\n  '$ionicBody',\nfunction($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicPlatform, $ionicBody) {\n\n  return {\n    show: actionSheet\n  };\n\n  /**\n   * @ngdoc method\n   * @name $ionicActionSheet#show\n   * @description\n   * Load and return a new action sheet.\n   *\n   * A new isolated scope will be created for the\n   * action sheet and the new element will be appended into the body.\n   *\n   * @param {object} options The options for this ActionSheet. Properties:\n   *\n   *  - `[Object]` `buttons` Which buttons to show.  Each button is an object with a `text` field.\n   *  - `{string}` `titleText` The title to show on the action sheet.\n   *  - `{string=}` `cancelText` the text for a 'cancel' button on the action sheet.\n   *  - `{string=}` `destructiveText` The text for a 'danger' on the action sheet.\n   *  - `{function=}` `cancel` Called if the cancel button is pressed, the backdrop is tapped or\n   *     the hardware back button is pressed.\n   *  - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked,\n   *     with the index of the button that was clicked and the button object. Return true to close\n   *     the action sheet, or false to keep it opened.\n   *  - `{function=}` `destructiveButtonClicked` Called when the destructive button is clicked.\n   *     Return true to close the action sheet, or false to keep it opened.\n   *  -  `{boolean=}` `cancelOnStateChange` Whether to cancel the actionSheet when navigating\n   *     to a new state.  Default true.\n   *\n   * @returns {function} `hideSheet` A function which, when called, hides & cancels the action sheet.\n   */\n  function actionSheet(opts) {\n    var scope = $rootScope.$new(true);\n\n    angular.extend(scope, {\n      cancel: angular.noop,\n      destructiveButtonClicked: angular.noop,\n      buttonClicked: angular.noop,\n      $deregisterBackButton: angular.noop,\n      buttons: [],\n      cancelOnStateChange: true\n    }, opts || {});\n\n\n    // Compile the template\n    var element = scope.element = $compile('<ion-action-sheet buttons=\"buttons\"></ion-action-sheet>')(scope);\n\n    // Grab the sheet element for animation\n    var sheetEl = jqLite(element[0].querySelector('.action-sheet-wrapper'));\n\n    var stateChangeListenDone = scope.cancelOnStateChange ?\n      $rootScope.$on('$stateChangeSuccess', function() { scope.cancel(); }) :\n      angular.noop;\n\n    // removes the actionSheet from the screen\n    scope.removeSheet = function(done) {\n      if (scope.removed) return;\n\n      scope.removed = true;\n      sheetEl.removeClass('action-sheet-up');\n      $ionicBody.removeClass('action-sheet-open');\n      scope.$deregisterBackButton();\n      stateChangeListenDone();\n\n      $animate.removeClass(element, 'active', function() {\n        scope.$destroy();\n        element.remove();\n        // scope.cancel.$scope is defined near the bottom\n        scope.cancel.$scope = null;\n        (done || angular.noop)();\n      });\n    };\n\n    scope.showSheet = function(done) {\n      if (scope.removed) return;\n\n      $ionicBody.append(element)\n                .addClass('action-sheet-open');\n\n      $animate.addClass(element, 'active', function() {\n        if (scope.removed) return;\n        (done || angular.noop)();\n      });\n      $timeout(function(){\n        if (scope.removed) return;\n        sheetEl.addClass('action-sheet-up');\n      }, 20, false);\n    };\n\n    // registerBackButtonAction returns a callback to deregister the action\n    scope.$deregisterBackButton = $ionicPlatform.registerBackButtonAction(\n      function() {\n        $timeout(scope.cancel);\n      },\n      PLATFORM_BACK_BUTTON_PRIORITY_ACTION_SHEET\n    );\n\n    // called when the user presses the cancel button\n    scope.cancel = function() {\n      // after the animation is out, call the cancel callback\n      scope.removeSheet(opts.cancel);\n    };\n\n    scope.buttonClicked = function(index) {\n      // Check if the button click event returned true, which means\n      // we can close the action sheet\n      if (opts.buttonClicked(index, opts.buttons[index]) === true) {\n        scope.removeSheet();\n      }\n    };\n\n    scope.destructiveButtonClicked = function() {\n      // Check if the destructive button click event returned true, which means\n      // we can close the action sheet\n      if (opts.destructiveButtonClicked() === true) {\n        scope.removeSheet();\n      }\n    };\n\n    scope.showSheet();\n\n    // Expose the scope on $ionicActionSheet's return value for the sake\n    // of testing it.\n    scope.cancel.$scope = scope;\n\n    return scope.cancel;\n  }\n}]);\n\n\njqLite.prototype.addClass = function(cssClasses) {\n  var x, y, cssClass, el, splitClasses, existingClasses;\n  if (cssClasses && cssClasses != 'ng-scope' && cssClasses != 'ng-isolate-scope') {\n    for(x=0; x<this.length; x++) {\n      el = this[x];\n      if(el.setAttribute) {\n\n        if(cssClasses.indexOf(' ') < 0 && el.classList.add) {\n          el.classList.add(cssClasses);\n        } else {\n          existingClasses = (' ' + (el.getAttribute('class') || '') + ' ')\n            .replace(/[\\n\\t]/g, \" \");\n          splitClasses = cssClasses.split(' ');\n\n          for (y=0; y<splitClasses.length; y++) {\n            cssClass = splitClasses[y].trim();\n            if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n              existingClasses += cssClass + ' ';\n            }\n          }\n          el.setAttribute('class', existingClasses.trim());\n        }\n      }\n    }\n  }\n  return this;\n};\n\njqLite.prototype.removeClass = function(cssClasses) {\n  var x, y, splitClasses, cssClass, el;\n  if (cssClasses) {\n    for(x=0; x<this.length; x++) {\n      el = this[x];\n      if(el.getAttribute) {\n        if(cssClasses.indexOf(' ') < 0 && el.classList.remove) {\n          el.classList.remove(cssClasses);\n        } else {\n          splitClasses = cssClasses.split(' ');\n\n          for (y=0; y<splitClasses.length; y++) {\n            cssClass = splitClasses[y];\n            el.setAttribute('class', (\n                (\" \" + (el.getAttribute('class') || '') + \" \")\n                .replace(/[\\n\\t]/g, \" \")\n                .replace(\" \" + cssClass.trim() + \" \", \" \")).trim()\n            );\n          }\n        }\n      }\n    }\n  }\n  return this;\n};\n\n/**\n * @ngdoc service\n * @name $ionicBackdrop\n * @module ionic\n * @description\n * Shows and hides a backdrop over the UI.  Appears behind popups, loading,\n * and other overlays.\n *\n * Often, multiple UI components require a backdrop, but only one backdrop is\n * ever needed in the DOM at a time.\n *\n * Therefore, each component that requires the backdrop to be shown calls\n * `$ionicBackdrop.retain()` when it wants the backdrop, then `$ionicBackdrop.release()`\n * when it is done with the backdrop.\n *\n * For each time `retain` is called, the backdrop will be shown until `release` is called.\n *\n * For example, if `retain` is called three times, the backdrop will be shown until `release`\n * is called three times.\n *\n * @usage\n *\n * ```js\n * function MyController($scope, $ionicBackdrop, $timeout) {\n *   //Show a backdrop for one second\n *   $scope.action = function() {\n *     $ionicBackdrop.retain();\n *     $timeout(function() {\n *       $ionicBackdrop.release();\n *     }, 1000);\n *   };\n * }\n * ```\n */\nIonicModule\n.factory('$ionicBackdrop', [\n  '$document', '$timeout',\nfunction($document, $timeout) {\n\n  var el = jqLite('<div class=\"backdrop\">');\n  var backdropHolds = 0;\n\n  $document[0].body.appendChild(el[0]);\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicBackdrop#retain\n     * @description Retains the backdrop.\n     */\n    retain: retain,\n    /**\n     * @ngdoc method\n     * @name $ionicBackdrop#release\n     * @description\n     * Releases the backdrop.\n     */\n    release: release,\n\n    getElement: getElement,\n\n    // exposed for testing\n    _element: el\n  };\n\n  function retain() {\n    if ( (++backdropHolds) === 1 ) {\n      el.addClass('visible');\n      ionic.requestAnimationFrame(function() {\n        backdropHolds && el.addClass('active');\n      });\n    }\n  }\n  function release() {\n    if ( (--backdropHolds) === 0 ) {\n      el.removeClass('active');\n      $timeout(function() {\n        !backdropHolds && el.removeClass('visible');\n      }, 400, false);\n    }\n  }\n\n  function getElement() {\n    return el;\n  }\n\n}]);\n\n/**\n * @private\n */\nIonicModule\n.factory('$ionicBind', ['$parse', '$interpolate', function($parse, $interpolate) {\n  var LOCAL_REGEXP = /^\\s*([@=&])(\\??)\\s*(\\w*)\\s*$/;\n  return function(scope, attrs, bindDefinition) {\n    forEach(bindDefinition || {}, function (definition, scopeName) {\n      //Adapted from angular.js $compile\n      var match = definition.match(LOCAL_REGEXP) || [],\n        attrName = match[3] || scopeName,\n        mode = match[1], // @, =, or &\n        parentGet,\n        unwatch;\n\n      switch(mode) {\n        case '@':\n          if (!attrs[attrName]) {\n            return;\n          }\n          attrs.$observe(attrName, function(value) {\n            scope[scopeName] = value;\n          });\n          // we trigger an interpolation to ensure\n          // the value is there for use immediately\n          if (attrs[attrName]) {\n            scope[scopeName] = $interpolate(attrs[attrName])(scope);\n          }\n          break;\n\n        case '=':\n          if (!attrs[attrName]) {\n            return;\n          }\n          unwatch = scope.$watch(attrs[attrName], function(value) {\n            scope[scopeName] = value;\n          });\n          //Destroy parent scope watcher when this scope is destroyed\n          scope.$on('$destroy', unwatch);\n          break;\n\n        case '&':\n          /* jshint -W044 */\n          if (attrs[attrName] && attrs[attrName].match(RegExp(scopeName + '\\(.*?\\)'))) {\n            throw new Error('& expression binding \"' + scopeName + '\" looks like it will recursively call \"' +\n                          attrs[attrName] + '\" and cause a stack overflow! Please choose a different scopeName.');\n          }\n          parentGet = $parse(attrs[attrName]);\n          scope[scopeName] = function(locals) {\n            return parentGet(scope, locals);\n          };\n          break;\n      }\n    });\n  };\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicBody\n * @module ionic\n * @description An angular utility service to easily and efficiently\n * add and remove CSS classes from the document's body element.\n */\nIonicModule\n.factory('$ionicBody', ['$document', function($document) {\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicBody#add\n     * @description Add a class to the document's body element.\n     * @param {string} class Each argument will be added to the body element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    addClass: function() {\n      for(var x=0; x<arguments.length; x++) {\n        $document[0].body.classList.add(arguments[x]);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#removeClass\n     * @description Remove a class from the document's body element.\n     * @param {string} class Each argument will be removed from the body element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    removeClass: function() {\n      for(var x=0; x<arguments.length; x++) {\n        $document[0].body.classList.remove(arguments[x]);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#enableClass\n     * @description Similar to the `add` method, except the first parameter accepts a boolean\n     * value determining if the class should be added or removed. Rather than writing user code,\n     * such as \"if true then add the class, else then remove the class\", this method can be\n     * given a true or false value which reduces redundant code.\n     * @param {boolean} shouldEnableClass A true/false value if the class should be added or removed.\n     * @param {string} class Each remaining argument would be added or removed depending on\n     * the first argument.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    enableClass: function(shouldEnableClass) {\n      var args = Array.prototype.slice.call(arguments).slice(1);\n      if(shouldEnableClass) {\n        this.addClass.apply(this, args);\n      } else {\n        this.removeClass.apply(this, args);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#append\n     * @description Append a child to the document's body.\n     * @param {element} element The element to be appended to the body. The passed in element\n     * can be either a jqLite element, or a DOM element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    append: function(ele) {\n      $document[0].body.appendChild( ele.length ? ele[0] : ele );\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#get\n     * @description Get the document's body element.\n     * @returns {element} Returns the document's body element.\n     */\n    get: function() {\n      return $document[0].body;\n    }\n  };\n}]);\n\nIonicModule\n.factory('$ionicClickBlock', [\n  '$document',\n  '$ionicBody',\n  '$timeout',\nfunction($document, $ionicBody, $timeout) {\n  var cb = $document[0].createElement('div');\n  cb.className = 'click-block';\n  return {\n    show: function() {\n      if(cb.parentElement) {\n        cb.classList.remove('hide');\n      } else {\n        $ionicBody.append(cb);\n      }\n      $timeout(function(){\n        cb.classList.add('hide');\n      }, 500);\n    },\n    hide: function() {\n      cb.classList.add('hide');\n    }\n  };\n}]);\n\nIonicModule\n.factory('$collectionDataSource', [\n  '$cacheFactory',\n  '$parse',\n  '$rootScope',\nfunction($cacheFactory, $parse, $rootScope) {\n  function hideWithTransform(element) {\n    element.css(ionic.CSS.TRANSFORM, 'translate3d(-2000px,-2000px,0)');\n  }\n\n  function CollectionRepeatDataSource(options) {\n    var self = this;\n    this.scope = options.scope;\n    this.transcludeFn = options.transcludeFn;\n    this.transcludeParent = options.transcludeParent;\n    this.element = options.element;\n\n    this.keyExpr = options.keyExpr;\n    this.listExpr = options.listExpr;\n    this.trackByExpr = options.trackByExpr;\n\n    this.heightGetter = options.heightGetter;\n    this.widthGetter = options.widthGetter;\n\n    this.dimensions = [];\n    this.data = [];\n\n    this.attachedItems = {};\n    this.BACKUP_ITEMS_LENGTH = 20;\n    this.backupItemsArray = [];\n  }\n  CollectionRepeatDataSource.prototype = {\n    setup: function() {\n      if (this.isSetup) return;\n      this.isSetup = true;\n      for (var i = 0; i < this.BACKUP_ITEMS_LENGTH; i++) {\n        this.detachItem(this.createItem());\n      }\n    },\n    destroy: function() {\n      this.dimensions.length = 0;\n      this.data = null;\n      this.backupItemsArray.length = 0;\n      this.attachedItems = {};\n    },\n    calculateDataDimensions: function() {\n      var locals = {};\n      this.dimensions = this.data.map(function(value, index) {\n        locals[this.keyExpr] = value;\n        locals.$index = index;\n        return {\n          width: this.widthGetter(this.scope, locals),\n          height: this.heightGetter(this.scope, locals)\n        };\n      }, this);\n      this.dimensions = this.beforeSiblings.concat(this.dimensions).concat(this.afterSiblings);\n      this.dataStartIndex = this.beforeSiblings.length;\n    },\n    createItem: function() {\n      var item = {};\n\n      item.scope = this.scope.$new();\n      this.transcludeFn(item.scope, function(clone) {\n        clone.css('position', 'absolute');\n        item.element = clone;\n      });\n      this.transcludeParent.append(item.element);\n\n      return item;\n    },\n    getItem: function(index) {\n      if ( (item = this.attachedItems[index]) ) {\n        //do nothing, the item is good\n      } else if ( (item = this.backupItemsArray.pop()) ) {\n        reconnectScope(item.scope);\n      } else {\n        item = this.createItem();\n      }\n      return item;\n    },\n    attachItemAtIndex: function(index) {\n      if (index < this.dataStartIndex) {\n        return this.beforeSiblings[index];\n      }\n      // Subtract so we start at the beginning of this.data, after\n      // this.beforeSiblings.\n      index -= this.dataStartIndex;\n\n      if (index > this.data.length - 1) {\n        return this.afterSiblings[index - this.dataStartIndex];\n      }\n\n      var item = this.getItem(index);\n      var value = this.data[index];\n\n      if (item.index !== index || item.scope[this.keyExpr] !== value) {\n        item.index = item.scope.$index = index;\n        item.scope[this.keyExpr] = value;\n        item.scope.$first = (index === 0);\n        item.scope.$last = (index === (this.getLength() - 1));\n        item.scope.$middle = !(item.scope.$first || item.scope.$last);\n        item.scope.$odd = !(item.scope.$even = (index&1) === 0);\n\n        //We changed the scope, so digest if needed\n        if (!$rootScope.$$phase) {\n          item.scope.$digest();\n        }\n      }\n      this.attachedItems[index] = item;\n\n      return item;\n    },\n    destroyItem: function(item) {\n      item.element.remove();\n      item.scope.$destroy();\n      item.scope = null;\n      item.element = null;\n    },\n    detachItem: function(item) {\n      delete this.attachedItems[item.index];\n\n      //If it's an outside item, only hide it. These items aren't part of collection\n      //repeat's list, only sit outside\n      if (item.isOutside) {\n        hideWithTransform(item.element);\n      // If we are at the limit of backup items, just get rid of the this element\n      } else if (this.backupItemsArray.length >= this.BACKUP_ITEMS_LENGTH) {\n        this.destroyItem(item);\n      // Otherwise, add it to our backup items\n      } else {\n        this.backupItemsArray.push(item);\n        hideWithTransform(item.element);\n        //Don't .$destroy(), just stop watchers and events firing\n        disconnectScope(item.scope);\n      }\n\n    },\n    getLength: function() {\n      return this.dimensions && this.dimensions.length || 0;\n    },\n    setData: function(value, beforeSiblings, afterSiblings) {\n      this.data = value || [];\n      this.beforeSiblings = beforeSiblings || [];\n      this.afterSiblings = afterSiblings || [];\n      this.calculateDataDimensions();\n\n      this.afterSiblings.forEach(function(item) {\n        item.element.css({position: 'absolute', top: '0', left: '0' });\n        hideWithTransform(item.element);\n      });\n    },\n  };\n\n  return CollectionRepeatDataSource;\n}]);\n\nfunction disconnectScope(scope) {\n  if (scope.$root === scope) {\n    return; // we can't disconnect the root node;\n  }\n  var parent = scope.$parent;\n  scope.$$disconnected = true;\n  // See Scope.$destroy\n  if (parent.$$childHead === scope) {\n    parent.$$childHead = scope.$$nextSibling;\n  }\n  if (parent.$$childTail === scope) {\n    parent.$$childTail = scope.$$prevSibling;\n  }\n  if (scope.$$prevSibling) {\n    scope.$$prevSibling.$$nextSibling = scope.$$nextSibling;\n  }\n  if (scope.$$nextSibling) {\n    scope.$$nextSibling.$$prevSibling = scope.$$prevSibling;\n  }\n  scope.$$nextSibling = scope.$$prevSibling = null;\n}\n\nfunction reconnectScope(scope) {\n  if (scope.$root === scope) {\n    return; // we can't disconnect the root node;\n  }\n  if (!scope.$$disconnected) {\n    return;\n  }\n  var parent = scope.$parent;\n  scope.$$disconnected = false;\n  // See Scope.$new for this logic...\n  scope.$$prevSibling = parent.$$childTail;\n  if (parent.$$childHead) {\n    parent.$$childTail.$$nextSibling = scope;\n    parent.$$childTail = scope;\n  } else {\n    parent.$$childHead = parent.$$childTail = scope;\n  }\n}\n\n\nIonicModule\n.factory('$collectionRepeatManager', [\n  '$rootScope',\n  '$timeout',\nfunction($rootScope, $timeout) {\n  /**\n   * Vocabulary: \"primary\" and \"secondary\" size/direction/position mean\n   * \"y\" and \"x\" for vertical scrolling, or \"x\" and \"y\" for horizontal scrolling.\n   */\n  function CollectionRepeatManager(options) {\n    var self = this;\n    this.dataSource = options.dataSource;\n    this.element = options.element;\n    this.scrollView = options.scrollView;\n\n    this.isVertical = !!this.scrollView.options.scrollingY;\n    this.renderedItems = {};\n    this.dimensions = [];\n    this.setCurrentIndex(0);\n\n    //Override scrollview's render callback\n    this.scrollView.__$callback = this.scrollView.__callback;\n    this.scrollView.__callback = angular.bind(this, this.renderScroll);\n\n    function getViewportSize() { return self.viewportSize; }\n    //Set getters and setters to match whether this scrollview is vertical or not\n    if (this.isVertical) {\n      this.scrollView.options.getContentHeight = getViewportSize;\n\n      this.scrollValue = function() {\n        return this.scrollView.__scrollTop;\n      };\n      this.scrollMaxValue = function() {\n        return this.scrollView.__maxScrollTop;\n      };\n      this.scrollSize = function() {\n        return this.scrollView.__clientHeight;\n      };\n      this.secondaryScrollSize = function() {\n        return this.scrollView.__clientWidth;\n      };\n      this.transformString = function(y, x) {\n        return 'translate3d('+x+'px,'+y+'px,0)';\n      };\n      this.primaryDimension = function(dim) {\n        return dim.height;\n      };\n      this.secondaryDimension = function(dim) {\n        return dim.width;\n      };\n    } else {\n      this.scrollView.options.getContentWidth = getViewportSize;\n\n      this.scrollValue = function() {\n        return this.scrollView.__scrollLeft;\n      };\n      this.scrollMaxValue = function() {\n        return this.scrollView.__maxScrollLeft;\n      };\n      this.scrollSize = function() {\n        return this.scrollView.__clientWidth;\n      };\n      this.secondaryScrollSize = function() {\n        return this.scrollView.__clientHeight;\n      };\n      this.transformString = function(x, y) {\n        return 'translate3d('+x+'px,'+y+'px,0)';\n      };\n      this.primaryDimension = function(dim) {\n        return dim.width;\n      };\n      this.secondaryDimension = function(dim) {\n        return dim.height;\n      };\n    }\n  }\n\n  CollectionRepeatManager.prototype = {\n    destroy: function() {\n      this.renderedItems = {};\n      this.render = angular.noop;\n      this.calculateDimensions = angular.noop;\n      this.dimensions = [];\n    },\n\n    /*\n     * Pre-calculate the position of all items in the data list.\n     * Do this using the provided width and height (primarySize and secondarySize)\n     * provided by the dataSource.\n     */\n    calculateDimensions: function() {\n      /*\n       * For the sake of explanations below, we're going to pretend we are scrolling\n       * vertically: Items are laid out with primarySize being height,\n       * secondarySize being width.\n       */\n      var primaryPos = 0;\n      var secondaryPos = 0;\n      var secondaryScrollSize = this.secondaryScrollSize();\n      var previousItem;\n\n      this.dataSource.beforeSiblings && this.dataSource.beforeSiblings.forEach(calculateSize, this);\n      var beforeSize = primaryPos + (previousItem ? previousItem.primarySize : 0);\n\n      primaryPos = secondaryPos = 0;\n      previousItem = null;\n\n      var dimensions = this.dataSource.dimensions.map(calculateSize, this);\n      var totalSize = primaryPos + (previousItem ? previousItem.primarySize : 0);\n\n      return {\n        beforeSize: beforeSize,\n        totalSize: totalSize,\n        dimensions: dimensions\n      };\n\n      function calculateSize(dim) {\n\n        //Each dimension is an object {width: Number, height: Number} provided by\n        //the dataSource\n        var rect = {\n          //Get the height out of the dimension object\n          primarySize: this.primaryDimension(dim),\n          //Max out the item's width to the width of the scrollview\n          secondarySize: Math.min(this.secondaryDimension(dim), secondaryScrollSize)\n        };\n\n        //If this isn't the first item\n        if (previousItem) {\n          //Move the item's x position over by the width of the previous item\n          secondaryPos += previousItem.secondarySize;\n          //If the y position is the same as the previous item and\n          //the x position is bigger than the scroller's width\n          if (previousItem.primaryPos === primaryPos &&\n              secondaryPos + rect.secondarySize > secondaryScrollSize) {\n            //Then go to the next row, with x position 0\n            secondaryPos = 0;\n            primaryPos += previousItem.primarySize;\n          }\n        }\n\n        rect.primaryPos = primaryPos;\n        rect.secondaryPos = secondaryPos;\n\n        previousItem = rect;\n        return rect;\n      }\n    },\n    resize: function() {\n      var result = this.calculateDimensions();\n      this.dimensions = result.dimensions;\n      this.viewportSize = result.totalSize;\n      this.beforeSize = result.beforeSize;\n      this.setCurrentIndex(0);\n      this.render(true);\n      this.dataSource.setup();\n    },\n    /*\n     * setCurrentIndex sets the index in the list that matches the scroller's position.\n     * Also save the position in the scroller for next and previous items (if they exist)\n     */\n    setCurrentIndex: function(index, height) {\n      var currentPos = (this.dimensions[index] || {}).primaryPos || 0;\n      this.currentIndex = index;\n\n      this.hasPrevIndex = index > 0;\n      if (this.hasPrevIndex) {\n        this.previousPos = Math.max(\n          currentPos - this.dimensions[index - 1].primarySize,\n          this.dimensions[index - 1].primaryPos\n        );\n      }\n      this.hasNextIndex = index + 1 < this.dataSource.getLength();\n      if (this.hasNextIndex) {\n        this.nextPos = Math.min(\n          currentPos + this.dimensions[index + 1].primarySize,\n          this.dimensions[index + 1].primaryPos\n        );\n      }\n    },\n    /**\n     * override the scroller's render callback to check if we need to\n     * re-render our collection\n     */\n    renderScroll: ionic.animationFrameThrottle(function(transformLeft, transformTop, zoom, wasResize) {\n      if (this.isVertical) {\n        this.renderIfNeeded(transformTop);\n      } else {\n        this.renderIfNeeded(transformLeft);\n      }\n      return this.scrollView.__$callback(transformLeft, transformTop, zoom, wasResize);\n    }),\n\n    renderIfNeeded: function(scrollPos) {\n      if ((this.hasNextIndex && scrollPos >= this.nextPos) ||\n          (this.hasPrevIndex && scrollPos < this.previousPos)) {\n           // Math.abs(transformPos - this.lastRenderScrollValue) > 100) {\n        this.render();\n      }\n    },\n    /*\n     * getIndexForScrollValue: Given the most recent data index and a new scrollValue,\n     * find the data index that matches that scrollValue.\n     *\n     * Strategy (if we are scrolling down): keep going forward in the dimensions list,\n     * starting at the given index, until an item with height matching the new scrollValue\n     * is found.\n     *\n     * This is a while loop. In the worst case it will have to go through the whole list\n     * (eg to scroll from top to bottom).  The most common case is to scroll\n     * down 1-3 items at a time.\n     *\n     * While this is not as efficient as it could be, optimizing it gives no noticeable\n     * benefit.  We would have to use a new memory-intensive data structure for dimensions\n     * to fully optimize it.\n     */\n    getIndexForScrollValue: function(i, scrollValue) {\n      var rect;\n      //Scrolling up\n      if (scrollValue <= this.dimensions[i].primaryPos) {\n        while ( (rect = this.dimensions[i - 1]) && rect.primaryPos > scrollValue) {\n          i--;\n        }\n      //Scrolling down\n      } else {\n        while ( (rect = this.dimensions[i + 1]) && rect.primaryPos < scrollValue) {\n          i++;\n        }\n      }\n      return i;\n    },\n    /*\n     * render: Figure out the scroll position, the index matching it, and then tell\n     * the data source to render the correct items into the DOM.\n     */\n    render: function(shouldRedrawAll) {\n      var self = this;\n      var i;\n      var isOutOfBounds = ( this.currentIndex >= this.dataSource.getLength() );\n      // We want to remove all the items and redraw everything if we're out of bounds\n      // or a flag is passed in.\n      if (isOutOfBounds || shouldRedrawAll) {\n        for (i in this.renderedItems) {\n          this.removeItem(i);\n        }\n        // Just don't render anything if we're out of bounds\n        if (isOutOfBounds) return;\n      }\n\n      var rect;\n      var scrollValue = this.scrollValue();\n      // Scroll size = how many pixels are visible in the scroller at one time\n      var scrollSize = this.scrollSize();\n      // We take the current scroll value and add it to the scrollSize to get\n      // what scrollValue the current visible scroll area ends at.\n      var scrollSizeEnd = scrollSize + scrollValue;\n      // Get the new start index for scrolling, based on the current scrollValue and\n      // the most recent known index\n      var startIndex = this.getIndexForScrollValue(this.currentIndex, scrollValue);\n\n      // If we aren't on the first item, add one row of items before so that when the user is\n      // scrolling up he sees the previous item\n      var renderStartIndex = Math.max(startIndex - 1, 0);\n      // Keep adding items to the 'extra row above' until we get to a new row.\n      // This is for the case where there are multiple items on one row above\n      // the current item; we want to keep adding items above until\n      // a new row is reached.\n      while (renderStartIndex > 0 &&\n         (rect = this.dimensions[renderStartIndex]) &&\n         rect.primaryPos === this.dimensions[startIndex - 1].primaryPos) {\n        renderStartIndex--;\n      }\n\n      // Keep rendering items, adding them until we are past the end of the visible scroll area\n      i = renderStartIndex;\n      while ((rect = this.dimensions[i]) && (rect.primaryPos - rect.primarySize < scrollSizeEnd)) {\n        doRender(i, rect);\n        i++;\n      }\n\n      // Render two extra items at the end as a buffer\n      if (self.dimensions[i]) {\n        doRender(i, self.dimensions[i]);\n        i++;\n      }\n      if (self.dimensions[i]) {\n        doRender(i, self.dimensions[i]);\n      }\n      var renderEndIndex = i;\n\n      // Remove any items that were rendered and aren't visible anymore\n      for (var renderIndex in this.renderedItems) {\n        if (renderIndex < renderStartIndex || renderIndex > renderEndIndex) {\n          this.removeItem(renderIndex);\n        }\n      }\n\n      this.setCurrentIndex(startIndex);\n\n      function doRender(dataIndex, rect) {\n        if (dataIndex < self.dataSource.dataStartIndex) {\n          // do nothing\n        } else {\n          self.renderItem(dataIndex, rect.primaryPos - self.beforeSize, rect.secondaryPos);\n        }\n      }\n    },\n    renderItem: function(dataIndex, primaryPos, secondaryPos) {\n      // Attach an item, and set its transform position to the required value\n      var item = this.dataSource.attachItemAtIndex(dataIndex);\n      void 0;\n      if (item && item.element) {\n        if (item.primaryPos !== primaryPos || item.secondaryPos !== secondaryPos) {\n          item.element.css(ionic.CSS.TRANSFORM, this.transformString(\n            primaryPos, secondaryPos\n          ));\n          item.primaryPos = primaryPos;\n          item.secondaryPos = secondaryPos;\n        }\n        // Save the item in rendered items\n        this.renderedItems[dataIndex] = item;\n      } else {\n        // If an item at this index doesn't exist anymore, be sure to delete\n        // it from rendered items\n        delete this.renderedItems[dataIndex];\n      }\n    },\n    removeItem: function(dataIndex) {\n      // Detach a given item\n      var item = this.renderedItems[dataIndex];\n      if (item) {\n        item.primaryPos = item.secondaryPos = null;\n        this.dataSource.detachItem(item);\n        delete this.renderedItems[dataIndex];\n      }\n    }\n  };\n\n  return CollectionRepeatManager;\n}]);\n\n\nfunction delegateService(methodNames) {\n  return ['$log', function($log) {\n    var delegate = this;\n\n    var instances = this._instances = [];\n    this._registerInstance = function(instance, handle) {\n      instance.$$delegateHandle = handle;\n      instances.push(instance);\n\n      return function deregister() {\n        var index = instances.indexOf(instance);\n        if (index !== -1) {\n          instances.splice(index, 1);\n        }\n      };\n    };\n\n    this.$getByHandle = function(handle) {\n      if (!handle) {\n        return delegate;\n      }\n      return new InstanceForHandle(handle);\n    };\n\n    /*\n     * Creates a new object that will have all the methodNames given,\n     * and call them on the given the controller instance matching given\n     * handle.\n     * The reason we don't just let $getByHandle return the controller instance\n     * itself is that the controller instance might not exist yet.\n     *\n     * We want people to be able to do\n     * `var instance = $ionicScrollDelegate.$getByHandle('foo')` on controller\n     * instantiation, but on controller instantiation a child directive\n     * may not have been compiled yet!\n     *\n     * So this is our way of solving this problem: we create an object\n     * that will only try to fetch the controller with given handle\n     * once the methods are actually called.\n     */\n    function InstanceForHandle(handle) {\n      this.handle = handle;\n    }\n    methodNames.forEach(function(methodName) {\n      InstanceForHandle.prototype[methodName] = function() {\n        var handle = this.handle;\n        var args = arguments;\n        var matchingInstancesFound = 0;\n        var finalResult;\n        var result;\n\n        //This logic is repeated below; we could factor some of it out to a function\n        //but don't because it lets this method be more performant (one loop versus 2)\n        instances.forEach(function(instance) {\n          if (instance.$$delegateHandle === handle) {\n            matchingInstancesFound++;\n            result = instance[methodName].apply(instance, args);\n            //Only return the value from the first call\n            if (matchingInstancesFound === 1) {\n              finalResult = result;\n            }\n          }\n        });\n\n        if (!matchingInstancesFound) {\n          return $log.warn(\n            'Delegate for handle \"'+this.handle+'\" could not find a ' +\n            'corresponding element with delegate-handle=\"'+this.handle+'\"! ' +\n            methodName + '() was not called!\\n' +\n            'Possible cause: If you are calling ' + methodName + '() immediately, and ' +\n            'your element with delegate-handle=\"' + this.handle + '\" is a child of your ' +\n            'controller, then your element may not be compiled yet. Put a $timeout ' +\n            'around your call to ' + methodName + '() and try again.'\n          );\n        }\n\n        return finalResult;\n      };\n      delegate[methodName] = function() {\n        var args = arguments;\n        var finalResult;\n        var result;\n\n        //This logic is repeated above\n        instances.forEach(function(instance, index) {\n          result = instance[methodName].apply(instance, args);\n          //Only return the value from the first call\n          if (index === 0) {\n            finalResult = result;\n          }\n        });\n\n        return finalResult;\n      };\n\n      function callMethod(instancesToUse, methodName, args) {\n        var finalResult;\n        var result;\n        instancesToUse.forEach(function(instance, index) {\n          result = instance[methodName].apply(instance, args);\n          //Make it so the first result is the one returned\n          if (index === 0) {\n            finalResult = result;\n          }\n        });\n        return finalResult;\n      }\n    });\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $ionicGesture\n * @module ionic\n * @description An angular service exposing ionic\n * {@link ionic.utility:ionic.EventController}'s gestures.\n */\nIonicModule\n.factory('$ionicGesture', [function() {\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicGesture#on\n     * @description Add an event listener for a gesture on an element. See {@link ionic.utility:ionic.EventController#onGesture}.\n     * @param {string} eventType The gesture event to listen for.\n     * @param {function(e)} callback The function to call when the gesture\n     * happens.\n     * @param {element} $element The angular element to listen for the event on.\n     * @returns {ionic.Gesture} The gesture object (use this to remove the gesture later on).\n     */\n    on: function(eventType, cb, $element, options) {\n      return window.ionic.onGesture(eventType, cb, $element[0], options);\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicGesture#off\n     * @description Remove an event listener for a gesture on an element. See {@link ionic.utility:ionic.EventController#offGesture}.\n     * @param {ionic.Gesture} gesture The gesture that should be removed.\n     * @param {string} eventType The gesture event to remove the listener for.\n     * @param {function(e)} callback The listener to remove.\n     */\n    off: function(gesture, eventType, cb) {\n      return window.ionic.offGesture(gesture, eventType, cb);\n    }\n  };\n}]);\n\n/**\n * @ngdoc provider\n * @name $ionicConfigProvider\n * @module ionic\n * @description $ionicConfigProvider can be used during the configuration phase of your app\n * to change how Ionic works.\n *\n * @usage\n * ```js\n * var myApp = angular.module('reallyCoolApp', ['ionic']);\n *\n * myApp.config(function($ionicConfigProvider) {\n *   $ionicConfigProvider.prefetchTemplates(false);\n * });\n * ```\n */\nIonicModule\n.provider('$ionicConfig', function() {\n\n  var provider = this;\n  var config = {\n    prefetchTemplates: true\n  };\n\n  /**\n   * @ngdoc method\n   * @name $ionicConfigProvider#prefetchTemplates\n   * @description Set whether Ionic should prefetch all templateUrls defined in\n   * $stateProvider.state. Default true. If set to false, the user will have to wait\n   * for a template to be fetched the first time he/she is going to a a new page.\n   * @param shouldPrefetch Whether Ionic should prefetch templateUrls defined in\n   * `$stateProvider.state()`. Default true.\n   * @returns {boolean} Whether Ionic will prefetch templateUrls defined in $stateProvider.state.\n   */\n  this.prefetchTemplates = function(newValue) {\n    if (arguments.length) {\n      config.prefetchTemplates = newValue;\n    }\n    return config.prefetchTemplates;\n  };\n\n  // private: Service definition for internal Ionic use\n  /**\n   * @ngdoc service\n   * @name $ionicConfig\n   * @module ionic\n   * @private\n   */\n  this.$get = function() {\n    return config;\n  };\n});\n\n\nvar LOADING_TPL =\n  '<div class=\"loading-container\">' +\n    '<div class=\"loading\">' +\n    '</div>' +\n  '</div>';\n\nvar LOADING_HIDE_DEPRECATED = '$ionicLoading instance.hide() has been deprecated. Use $ionicLoading.hide().';\nvar LOADING_SHOW_DEPRECATED = '$ionicLoading instance.show() has been deprecated. Use $ionicLoading.show().';\nvar LOADING_SET_DEPRECATED = '$ionicLoading instance.setContent() has been deprecated. Use $ionicLoading.show({ template: \\'my content\\' }).';\n\n/**\n * @ngdoc service\n * @name $ionicLoading\n * @module ionic\n * @description\n * An overlay that can be used to indicate activity while blocking user\n * interaction.\n *\n * @usage\n * ```js\n * angular.module('LoadingApp', ['ionic'])\n * .controller('LoadingCtrl', function($scope, $ionicLoading) {\n *   $scope.show = function() {\n *     $ionicLoading.show({\n *       template: 'Loading...'\n *     });\n *   };\n *   $scope.hide = function(){\n *     $ionicLoading.hide();\n *   };\n * });\n * ```\n */\n/**\n * @ngdoc object\n * @name $ionicLoadingConfig\n * @module ionic\n * @description\n * Set the default options to be passed to the {@link ionic.service:$ionicLoading} service.\n *\n * @usage\n * ```js\n * var app = angular.module('myApp', ['ionic'])\n * app.constant('$ionicLoadingConfig', {\n *   template: 'Default Loading Template...'\n * });\n * app.controller('AppCtrl', function($scope, $ionicLoading) {\n *   $scope.showLoading = function() {\n *     $ionicLoading.show(); //options default to values in $ionicLoadingConfig\n *   };\n * });\n * ```\n */\nIonicModule\n.constant('$ionicLoadingConfig', {\n  template: '<i class=\"ion-loading-d\"></i>'\n})\n.factory('$ionicLoading', [\n  '$ionicLoadingConfig',\n  '$ionicBody',\n  '$ionicTemplateLoader',\n  '$ionicBackdrop',\n  '$timeout',\n  '$q',\n  '$log',\n  '$compile',\n  '$ionicPlatform',\nfunction($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $compile, $ionicPlatform) {\n\n  var loaderInstance;\n  //default values\n  var deregisterBackAction = angular.noop;\n  var loadingShowDelay = $q.when();\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicLoading#show\n     * @description Shows a loading indicator. If the indicator is already shown,\n     * it will set the options given and keep the indicator shown.\n     * @param {object} opts The options for the loading indicator. Available properties:\n     *  - `{string=}` `template` The html content of the indicator.\n     *  - `{string=}` `templateUrl` The url of an html template to load as the content of the indicator.\n     *  - `{boolean=}` `noBackdrop` Whether to hide the backdrop. By default it will be shown.\n     *  - `{number=}` `delay` How many milliseconds to delay showing the indicator. By default there is no delay.\n     *  - `{number=}` `duration` How many milliseconds to wait until automatically\n     *  hiding the indicator. By default, the indicator will be shown until `.hide()` is called.\n     */\n    show: showLoader,\n    /**\n     * @ngdoc method\n     * @name $ionicLoading#hide\n     * @description Hides the loading indicator, if shown.\n     */\n    hide: hideLoader,\n    /**\n     * @private for testing\n     */\n    _getLoader: getLoader\n  };\n\n  function getLoader() {\n    if (!loaderInstance) {\n      loaderInstance = $ionicTemplateLoader.compile({\n        template: LOADING_TPL,\n        appendTo: $ionicBody.get()\n      })\n      .then(function(loader) {\n        var self = loader;\n\n        loader.show = function(options) {\n          var templatePromise = options.templateUrl ?\n            $ionicTemplateLoader.load(options.templateUrl) :\n            //options.content: deprecated\n            $q.when(options.template || options.content || '');\n\n\n          if (!this.isShown) {\n            //options.showBackdrop: deprecated\n            this.hasBackdrop = !options.noBackdrop && options.showBackdrop !== false;\n            if (this.hasBackdrop) {\n              $ionicBackdrop.retain();\n              $ionicBackdrop.getElement().addClass('backdrop-loading');\n            }\n          }\n\n          if (options.duration) {\n            $timeout.cancel(this.durationTimeout);\n            this.durationTimeout = $timeout(\n              angular.bind(this, this.hide),\n              +options.duration\n            );\n          }\n\n          templatePromise.then(function(html) {\n            if (html) {\n              var loading = self.element.children();\n              loading.html(html);\n              $compile(loading.contents())(self.scope);\n            }\n\n            //Don't show until template changes\n            if (self.isShown) {\n              self.element.addClass('visible');\n              ionic.requestAnimationFrame(function() {\n                if(self.isShown) {\n                  self.element.addClass('active');\n                  $ionicBody.addClass('loading-active');\n                }\n              });\n            }\n          });\n\n          this.isShown = true;\n        };\n        loader.hide = function() {\n          if (this.isShown) {\n            if (this.hasBackdrop) {\n              $ionicBackdrop.release();\n              $ionicBackdrop.getElement().removeClass('backdrop-loading');\n            }\n            self.element.removeClass('active');\n            $ionicBody.removeClass('loading-active');\n            setTimeout(function() {\n              !self.isShown && self.element.removeClass('visible');\n            }, 200);\n          }\n          $timeout.cancel(this.durationTimeout);\n          this.isShown = false;\n        };\n\n        return loader;\n      });\n    }\n    return loaderInstance;\n  }\n\n  function showLoader(options) {\n    options = extend($ionicLoadingConfig || {}, options || {});\n    var delay = options.delay || options.showDelay || 0;\n\n    //If loading.show() was called previously, cancel it and show with our new options\n    loadingShowDelay && $timeout.cancel(loadingShowDelay);\n    loadingShowDelay = $timeout(angular.noop, delay);\n\n    loadingShowDelay.then(getLoader).then(function(loader) {\n      deregisterBackAction();\n      //Disable hardware back button while loading\n      deregisterBackAction = $ionicPlatform.registerBackButtonAction(\n        angular.noop,\n        PLATFORM_BACK_BUTTON_PRIORITY_LOADING\n      );\n      return loader.show(options);\n    });\n\n    return {\n      hide: deprecated.method(LOADING_HIDE_DEPRECATED, $log.error, hideLoader),\n      show: deprecated.method(LOADING_SHOW_DEPRECATED, $log.error, function() {\n        showLoader(options);\n      }),\n      setContent: deprecated.method(LOADING_SET_DEPRECATED, $log.error, function(content) {\n        getLoader().then(function(loader) {\n          loader.show({ template: content });\n        });\n      })\n    };\n  }\n\n  function hideLoader() {\n    deregisterBackAction();\n    $timeout.cancel(loadingShowDelay);\n    getLoader().then(function(loader) {\n      loader.hide();\n    });\n  }\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicModal\n * @module ionic\n * @description\n *\n * Related: {@link ionic.controller:ionicModal ionicModal controller}.\n *\n * The Modal is a content pane that can go over the user's main view\n * temporarily.  Usually used for making a choice or editing an item.\n *\n * Put the content of the modal inside of an `<ion-modal-view>` element.\n *\n * Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating\n * scope, passing in itself as an event argument. Both the modal.removed and modal.hidden events are\n * called when the modal is removed.\n *\n * @usage\n * ```html\n * <script id=\"my-modal.html\" type=\"text/ng-template\">\n *   <ion-modal-view>\n *     <ion-header-bar>\n *       <h1 class=\"title\">My Modal title</h1>\n *     </ion-header-bar>\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-modal-view>\n * </script>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $ionicModal) {\n *   $ionicModal.fromTemplateUrl('my-modal.html', {\n *     scope: $scope,\n *     animation: 'slide-in-up'\n *   }).then(function(modal) {\n *     $scope.modal = modal;\n *   });\n *   $scope.openModal = function() {\n *     $scope.modal.show();\n *   };\n *   $scope.closeModal = function() {\n *     $scope.modal.hide();\n *   };\n *   //Cleanup the modal when we're done with it!\n *   $scope.$on('$destroy', function() {\n *     $scope.modal.remove();\n *   });\n *   // Execute action on hide modal\n *   $scope.$on('modal.hidden', function() {\n *     // Execute action\n *   });\n *   // Execute action on remove modal\n *   $scope.$on('modal.removed', function() {\n *     // Execute action\n *   });\n * });\n * ```\n */\nIonicModule\n.factory('$ionicModal', [\n  '$rootScope',\n  '$ionicBody',\n  '$compile',\n  '$timeout',\n  '$ionicPlatform',\n  '$ionicTemplateLoader',\n  '$q',\n  '$log',\nfunction($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTemplateLoader, $q, $log) {\n\n  /**\n   * @ngdoc controller\n   * @name ionicModal\n   * @module ionic\n   * @description\n   * Instantiated by the {@link ionic.service:$ionicModal} service.\n   *\n   * Be sure to call [remove()](#remove) when you are done with each modal\n   * to clean it up and avoid memory leaks.\n   *\n   * Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating\n   * scope, passing in itself as an event argument. Note: both modal.removed and modal.hidden are\n   * called when the modal is removed.\n   */\n  var ModalView = ionic.views.Modal.inherit({\n    /**\n     * @ngdoc method\n     * @name ionicModal#initialize\n     * @description Creates a new modal controller instance.\n     * @param {object} options An options object with the following properties:\n     *  - `{object=}` `scope` The scope to be a child of.\n     *    Default: creates a child of $rootScope.\n     *  - `{string=}` `animation` The animation to show & hide with.\n     *    Default: 'slide-in-up'\n     *  - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of\n     *    the modal when shown.  Default: false.\n     *  - `{boolean=}` `backdropClickToClose` Whether to close the modal on clicking the backdrop.\n     *    Default: true.\n     *  - `{boolean=}` `hardwareBackButtonClose` Whether the modal can be closed using the hardware\n     *    back button on Android and similar devices.  Default: true.\n     */\n    initialize: function(opts) {\n      ionic.views.Modal.prototype.initialize.call(this, opts);\n      this.animation = opts.animation || 'slide-in-up';\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#show\n     * @description Show this modal instance.\n     * @returns {promise} A promise which is resolved when the modal is finished animating in.\n     */\n    show: function(target) {\n      var self = this;\n\n      if(self.scope.$$destroyed) {\n        $log.error('Cannot call ' +  self.viewType + '.show() after remove(). Please create a new ' +  self.viewType + ' instance.');\n        return;\n      }\n\n      var modalEl = jqLite(self.modalEl);\n\n      self.el.classList.remove('hide');\n      $timeout(function(){\n        $ionicBody.addClass(self.viewType + '-open');\n      }, 400);\n\n      if(!self.el.parentElement) {\n        modalEl.addClass(self.animation);\n        $ionicBody.append(self.el);\n      }\n\n      if(target && self.positionView) {\n        self.positionView(target, modalEl);\n      }\n\n      modalEl.addClass('ng-enter active')\n             .removeClass('ng-leave ng-leave-active');\n\n      self._isShown = true;\n      self._deregisterBackButton = $ionicPlatform.registerBackButtonAction(\n        self.hardwareBackButtonClose ? angular.bind(self, self.hide) : angular.noop,\n        PLATFORM_BACK_BUTTON_PRIORITY_MODAL\n      );\n\n      self._isOpenPromise = $q.defer();\n\n      ionic.views.Modal.prototype.show.call(self);\n\n      $timeout(function(){\n        modalEl.addClass('ng-enter-active');\n        ionic.trigger('resize');\n        self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.shown', self);\n        self.el.classList.add('active');\n      }, 20);\n\n      return $timeout(function() {\n        //After animating in, allow hide on backdrop click\n        self.$el.on('click', function(e) {\n          if (self.backdropClickToClose && e.target === self.el) {\n            self.hide();\n          }\n        });\n      }, 400);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#hide\n     * @description Hide this modal instance.\n     * @returns {promise} A promise which is resolved when the modal is finished animating out.\n     */\n    hide: function() {\n      var self = this;\n      var modalEl = jqLite(self.modalEl);\n\n      self.el.classList.remove('active');\n      modalEl.addClass('ng-leave');\n\n      $timeout(function(){\n        modalEl.addClass('ng-leave-active')\n               .removeClass('ng-enter ng-enter-active active');\n      }, 20);\n\n      self.$el.off('click');\n      self._isShown = false;\n      self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.hidden', self);\n      self._deregisterBackButton && self._deregisterBackButton();\n\n      ionic.views.Modal.prototype.hide.call(self);\n\n      return $timeout(function(){\n        $ionicBody.removeClass(self.viewType + '-open');\n        self.el.classList.add('hide');\n      }, self.hideDelay || 320);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#remove\n     * @description Remove this modal instance from the DOM and clean up.\n     * @returns {promise} A promise which is resolved when the modal is finished animating out.\n     */\n    remove: function() {\n      var self = this;\n      self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.removed', self);\n\n      return self.hide().then(function() {\n        self.scope.$destroy();\n        self.$el.remove();\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#isShown\n     * @returns boolean Whether this modal is currently shown.\n     */\n    isShown: function() {\n      return !!this._isShown;\n    }\n  });\n\n  var createModal = function(templateString, options) {\n    // Create a new scope for the modal\n    var scope = options.scope && options.scope.$new() || $rootScope.$new(true);\n\n    options.viewType = options.viewType || 'modal';\n\n    extend(scope, {\n      $hasHeader: false,\n      $hasSubheader: false,\n      $hasFooter: false,\n      $hasSubfooter: false,\n      $hasTabs: false,\n      $hasTabsTop: false\n    });\n\n    // Compile the template\n    var element = $compile('<ion-' + options.viewType + '>' + templateString + '</ion-' + options.viewType + '>')(scope);\n\n    options.$el = element;\n    options.el = element[0];\n    options.modalEl = options.el.querySelector('.' + options.viewType);\n    var modal = new ModalView(options);\n\n    modal.scope = scope;\n\n    // If this wasn't a defined scope, we can assign the viewType to the isolated scope\n    // we created\n    if(!options.scope) {\n      scope[ options.viewType ] = modal;\n    }\n\n    return modal;\n  };\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicModal#fromTemplate\n     * @param {string} templateString The template string to use as the modal's\n     * content.\n     * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method.\n     * @returns {object} An instance of an {@link ionic.controller:ionicModal}\n     * controller.\n     */\n    fromTemplate: function(templateString, options) {\n      var modal = createModal(templateString, options || {});\n      return modal;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicModal#fromTemplateUrl\n     * @param {string} templateUrl The url to load the template from.\n     * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method.\n     * options object.\n     * @returns {promise} A promise that will be resolved with an instance of\n     * an {@link ionic.controller:ionicModal} controller.\n     */\n    fromTemplateUrl: function(url, options, _) {\n      var cb;\n      //Deprecated: allow a callback as second parameter. Now we return a promise.\n      if (angular.isFunction(options)) {\n        cb = options;\n        options = _;\n      }\n      return $ionicTemplateLoader.load(url).then(function(templateString) {\n        var modal = createModal(templateString, options || {});\n        cb && cb(modal);\n        return modal;\n      });\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicNavBarDelegate\n * @module ionic\n * @description\n * Delegate for controlling the {@link ionic.directive:ionNavBar} directive.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-nav-bar>\n *     <button ng-click=\"setNavTitle('banana')\">\n *       Set title to banana!\n *     </button>\n *   </ion-nav-bar>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicNavBarDelegate) {\n *   $scope.setNavTitle = function(title) {\n *     $ionicNavBarDelegate.setTitle(title);\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicNavBarDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#back\n   * @description Goes back in the view history.\n   * @param {DOMEvent=} event The event object (eg from a tap event)\n   */\n  'back',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#align\n   * @description Aligns the title with the buttons in a given direction.\n   * @param {string=} direction The direction to the align the title text towards.\n   * Available: 'left', 'right', 'center'. Default: 'center'.\n   */\n  'align',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#showBackButton\n   * @description\n   * Set/get whether the {@link ionic.directive:ionNavBackButton} is shown\n   * (if it exists).\n   * @param {boolean=} show Whether to show the back button.\n   * @returns {boolean} Whether the back button is shown.\n   */\n  'showBackButton',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#showBar\n   * @description\n   * Set/get whether the {@link ionic.directive:ionNavBar} is shown.\n   * @param {boolean} show Whether to show the bar.\n   * @returns {boolean} Whether the bar is shown.\n   */\n  'showBar',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#setTitle\n   * @description\n   * Set the title for the {@link ionic.directive:ionNavBar}.\n   * @param {string} title The new title to show.\n   */\n  'setTitle',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#changeTitle\n   * @description\n   * Change the title, transitioning the new title in and the old one out in a given direction.\n   * @param {string} title The new title to show.\n   * @param {string} direction The direction to transition the new title in.\n   * Available: 'forward', 'back'.\n   */\n  'changeTitle',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#getTitle\n   * @returns {string} The current title of the navbar.\n   */\n  'getTitle',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#getPreviousTitle\n   * @returns {string} The previous title of the navbar.\n   */\n  'getPreviousTitle'\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * navBars with delegate-handle matching the given handle.\n   *\n   * Example: `$ionicNavBarDelegate.$getByHandle('myHandle').setTitle('newTitle')`\n   */\n]));\n\nvar PLATFORM_BACK_BUTTON_PRIORITY_VIEW = 100;\nvar PLATFORM_BACK_BUTTON_PRIORITY_SIDE_MENU = 150;\nvar PLATFORM_BACK_BUTTON_PRIORITY_MODAL = 200;\nvar PLATFORM_BACK_BUTTON_PRIORITY_ACTION_SHEET = 300;\nvar PLATFORM_BACK_BUTTON_PRIORITY_POPUP = 400;\nvar PLATFORM_BACK_BUTTON_PRIORITY_LOADING = 500;\n\nfunction componentConfig(defaults) {\n  defaults.$get = function() { return defaults; };\n  return defaults;\n}\n\nIonicModule\n.constant('$ionicPlatformDefaults', {\n  'ios': {\n    '$ionicNavBarConfig': {\n      transition: 'nav-title-slide-ios',//nav-title-slide-ios7',\n      alignTitle: 'center',\n      backButtonIcon: 'ion-ios7-arrow-back'\n    },\n    '$ionicNavViewConfig': {\n      //transition: 'slide-left-right-ios'\n      transition: 'slide-ios'\n    },\n    '$ionicTabsConfig': {\n      type: '',\n      position: ''\n    }\n  },\n  'android': {\n    '$ionicNavBarConfig': {\n      transition: 'nav-title-slide-full',\n      alignTitle: 'center',\n      backButtonIcon: 'ion-ios7-arrow-back'\n    },\n    '$ionicNavViewConfig': {\n      transition: 'slide-full'\n    },\n    '$ionicTabsConfig': {\n      type: 'tabs-striped',\n      position: ''\n    }\n  }\n});\n\n\nIonicModule.config([\n  '$ionicPlatformDefaults',\n\n  '$injector',\n\nfunction($ionicPlatformDefaults, $injector) {\n  var platform = ionic.Platform.platform();\n\n  var applyConfig = function(platformDefaults) {\n    forEach(platformDefaults, function(defaults, constantName) {\n      extend($injector.get(constantName), defaults);\n    });\n  };\n\n  switch(platform) {\n    case 'ios':\n      applyConfig($ionicPlatformDefaults.ios);\n      break;\n    case 'android':\n      applyConfig($ionicPlatformDefaults.android);\n      break;\n  }\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicPlatform\n * @module ionic\n * @description\n * An angular abstraction of {@link ionic.utility:ionic.Platform}.\n *\n * Used to detect the current platform, as well as do things like override the\n * Android back button in PhoneGap/Cordova.\n */\nIonicModule\n.provider('$ionicPlatform', function() {\n  return {\n    $get: ['$q', '$rootScope', function($q, $rootScope) {\n      var self = {\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#onHardwareBackButton\n         * @description\n         * Some platforms have a hardware back button, so this is one way to\n         * bind to it.\n         * @param {function} callback the callback to trigger when this event occurs\n         */\n        onHardwareBackButton: function(cb) {\n          ionic.Platform.ready(function() {\n            document.addEventListener('backbutton', cb, false);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#offHardwareBackButton\n         * @description\n         * Remove an event listener for the backbutton.\n         * @param {function} callback The listener function that was\n         * originally bound.\n         */\n        offHardwareBackButton: function(fn) {\n          ionic.Platform.ready(function() {\n            document.removeEventListener('backbutton', fn);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#registerBackButtonAction\n         * @description\n         * Register a hardware back button action. Only one action will execute\n         * when the back button is clicked, so this method decides which of\n         * the registered back button actions has the highest priority.\n         *\n         * For example, if an actionsheet is showing, the back button should\n         * close the actionsheet, but it should not also go back a page view\n         * or close a modal which may be open.\n         *\n         * @param {function} callback Called when the back button is pressed,\n         * if this listener is the highest priority.\n         * @param {number} priority Only the highest priority will execute.\n         * @param {*=} actionId The id to assign this action. Default: a\n         * random unique id.\n         * @returns {function} A function that, when called, will deregister\n         * this backButtonAction.\n         */\n        $backButtonActions: {},\n        registerBackButtonAction: function(fn, priority, actionId) {\n\n          if(!self._hasBackButtonHandler) {\n            // add a back button listener if one hasn't been setup yet\n            self.$backButtonActions = {};\n            self.onHardwareBackButton(self.hardwareBackButtonClick);\n            self._hasBackButtonHandler = true;\n          }\n\n          var action = {\n            id: (actionId ? actionId : ionic.Utils.nextUid()),\n            priority: (priority ? priority : 0),\n            fn: fn\n          };\n          self.$backButtonActions[action.id] = action;\n\n          // return a function to de-register this back button action\n          return function() {\n            delete self.$backButtonActions[action.id];\n          };\n        },\n\n        /**\n         * @private\n         */\n        hardwareBackButtonClick: function(e){\n          // loop through all the registered back button actions\n          // and only run the last one of the highest priority\n          var priorityAction, actionId;\n          for(actionId in self.$backButtonActions) {\n            if(!priorityAction || self.$backButtonActions[actionId].priority >= priorityAction.priority) {\n              priorityAction = self.$backButtonActions[actionId];\n            }\n          }\n          if(priorityAction) {\n            priorityAction.fn(e);\n            return priorityAction;\n          }\n        },\n\n        is: function(type) {\n          return ionic.Platform.is(type);\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#ready\n         * @description\n         * Trigger a callback once the device is ready,\n         * or immediately if the device is already ready.\n         * @param {function=} callback The function to call.\n         * @returns {promise} A promise which is resolved when the device is ready.\n         */\n        ready: function(cb) {\n          var q = $q.defer();\n\n          ionic.Platform.ready(function(){\n            q.resolve();\n            cb && cb();\n          });\n\n          return q.promise;\n        }\n      };\n      return self;\n    }]\n  };\n\n});\n\n\n/**\n * @ngdoc service\n * @name $ionicPopover\n * @module ionic\n * @description\n *\n * Related: {@link ionic.controller:ionicPopover ionicPopover controller}.\n *\n * The Popover is a view that floats above an app’s content. Popovers provide an\n * easy way to present or gather information from the user and are\n * commonly used in the following situations:\n *\n * - Show more info about the current view\n * - Select a commonly used tool or configuration\n * - Present a list of actions to perform inside one of your views\n *\n * Put the content of the popover inside of an `<ion-popover-view>` element.\n *\n * @usage\n * ```html\n * <p>\n *   <button ng-click=\"openPopover($event)\">Open Popover</button>\n * </p>\n *\n * <script id=\"my-popover.html\" type=\"text/ng-template\">\n *   <ion-popover-view>\n *     <ion-header-bar>\n *       <h1 class=\"title\">My Popover Title</h1>\n *     </ion-header-bar>\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-popover-view>\n * </script>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $ionicPopover) {\n *   $ionicPopover.fromTemplateUrl('my-popover.html', {\n *     scope: $scope,\n *   }).then(function(popover) {\n *     $scope.popover = popover;\n *   });\n *   $scope.openPopover = function($event) {\n *     $scope.popover.show($event);\n *   };\n *   $scope.closePopover = function() {\n *     $scope.popover.hide();\n *   };\n *   //Cleanup the popover when we're done with it!\n *   $scope.$on('$destroy', function() {\n *     $scope.popover.remove();\n *   });\n *   // Execute action on hide popover\n *   $scope.$on('popover.hidden', function() {\n *     // Execute action\n *   });\n *   // Execute action on remove popover\n *   $scope.$on('popover.removed', function() {\n *     // Execute action\n *   });\n * });\n * ```\n */\n\n\nIonicModule\n.factory('$ionicPopover', ['$ionicModal', '$ionicPosition', '$document', '$window',\nfunction($ionicModal, $ionicPosition, $document, $window) {\n\n  var POPOVER_BODY_PADDING = 6;\n\n  var POPOVER_OPTIONS = {\n    viewType: 'popover',\n    hideDelay: 1,\n    animation: 'none',\n    positionView: positionView\n  };\n\n  function positionView(target, popoverEle) {\n    var targetEle = angular.element(target.target || target);\n    var buttonOffset = $ionicPosition.offset( targetEle );\n    var popoverWidth = popoverEle.prop('offsetWidth');\n    var popoverHeight = popoverEle.prop('offsetHeight');\n    var bodyWidth = $document[0].body.clientWidth;\n    // clientHeight doesn't work on all platforms for body\n    var bodyHeight = $window.innerHeight;\n\n    var popoverCSS = {\n      left: buttonOffset.left + buttonOffset.width / 2 - popoverWidth / 2\n    };\n    var arrowEle = jqLite(popoverEle[0].querySelector('.popover-arrow'));\n\n    if (popoverCSS.left < POPOVER_BODY_PADDING) {\n      popoverCSS.left = POPOVER_BODY_PADDING;\n    } else if(popoverCSS.left + popoverWidth + POPOVER_BODY_PADDING > bodyWidth) {\n      popoverCSS.left = bodyWidth - popoverWidth - POPOVER_BODY_PADDING;\n    }\n\n    // If the popover when popped down stretches past bottom of screen,\n    // make it pop up\n    if (buttonOffset.top + buttonOffset.height + popoverHeight > bodyHeight) {\n      popoverCSS.top = buttonOffset.top - popoverHeight;\n      popoverEle.removeClass('popover-top').addClass('popover-bottom');\n    } else {\n      popoverCSS.top = buttonOffset.top + buttonOffset.height;\n      popoverEle.removeClass('popover-bottom').addClass('popover-top');\n    }\n\n    arrowEle.css({\n      left: buttonOffset.left + buttonOffset.width / 2 -\n        arrowEle.prop('offsetWidth') / 2 - popoverCSS.left + 'px'\n    });\n\n    popoverEle.css({\n      top: popoverCSS.top + 'px',\n      left: popoverCSS.left + 'px',\n      marginLeft: '0',\n      opacity: '1'\n    });\n\n  }\n\n  /**\n   * @ngdoc controller\n   * @name ionicPopover\n   * @module ionic\n   * @description\n   * Instantiated by the {@link ionic.service:$ionicPopover} service.\n   *\n   * Be sure to call [remove()](#remove) when you are done with each popover\n   * to clean it up and avoid memory leaks.\n   *\n   * Note: a popover will broadcast 'popover.shown', 'popover.hidden', and 'popover.removed' events from its originating\n   * scope, passing in itself as an event argument. Both the popover.removed and popover.hidden events are\n   * called when the popover is removed.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#initialize\n   * @description Creates a new popover controller instance.\n   * @param {object} options An options object with the following properties:\n   *  - `{object=}` `scope` The scope to be a child of.\n   *    Default: creates a child of $rootScope.\n   *  - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of\n   *    the popover when shown.  Default: false.\n   *  - `{boolean=}` `backdropClickToClose` Whether to close the popover on clicking the backdrop.\n   *    Default: true.\n   *  - `{boolean=}` `hardwareBackButtonClose` Whether the popover can be closed using the hardware\n   *    back button on Android and similar devices.  Default: true.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#show\n   * @description Show this popover instance.\n   * @param {$event} $event The $event or target element which the popover should align\n   * itself next to.\n   * @returns {promise} A promise which is resolved when the popover is finished animating in.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#hide\n   * @description Hide this popover instance.\n   * @returns {promise} A promise which is resolved when the popover is finished animating out.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#remove\n   * @description Remove this popover instance from the DOM and clean up.\n   * @returns {promise} A promise which is resolved when the popover is finished animating out.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#isShown\n   * @returns boolean Whether this popover is currently shown.\n   */\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicPopover#fromTemplate\n     * @param {string} templateString The template string to use as the popovers's\n     * content.\n     * @param {object} options Options to be passed to the initialize method.\n     * @returns {object} An instance of an {@link ionic.controller:ionicPopover}\n     * controller ($ionicPopover is built on top of $ionicPopover).\n     */\n    fromTemplate: function(templateString, options) {\n      return $ionicModal.fromTemplate(templateString, ionic.Utils.extend(options || {}, POPOVER_OPTIONS) );\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicPopover#fromTemplateUrl\n     * @param {string} templateUrl The url to load the template from.\n     * @param {object} options Options to be passed to the initialize method.\n     * @returns {promise} A promise that will be resolved with an instance of\n     * an {@link ionic.controller:ionicPopover} controller ($ionicPopover is built on top of $ionicPopover).\n     */\n    fromTemplateUrl: function(url, options, _) {\n      return $ionicModal.fromTemplateUrl(url, options, ionic.Utils.extend(options || {}, POPOVER_OPTIONS) );\n    }\n  };\n\n}]);\n\n\nvar POPUP_TPL =\n  '<div class=\"popup-container\">' +\n    '<div class=\"popup\">' +\n      '<div class=\"popup-head\">' +\n        '<h3 class=\"popup-title\" ng-bind-html=\"title\"></h3>' +\n        '<h5 class=\"popup-sub-title\" ng-bind-html=\"subTitle\" ng-if=\"subTitle\"></h5>' +\n      '</div>' +\n      '<div class=\"popup-body\">' +\n      '</div>' +\n      '<div class=\"popup-buttons\">' +\n        '<button ng-repeat=\"button in buttons\" ng-click=\"$buttonTapped(button, $event)\" class=\"button\" ng-class=\"button.type || \\'button-default\\'\" ng-bind-html=\"button.text\"></button>' +\n      '</div>' +\n    '</div>' +\n  '</div>';\n\n/**\n * @ngdoc service\n * @name $ionicPopup\n * @module ionic\n * @restrict E\n * @codepen zkmhJ\n * @description\n *\n * The Ionic Popup service allows programmatically creating and showing popup\n * windows that require the user to respond in order to continue.\n *\n * The popup system has support for more flexible versions of the built in `alert()`, `prompt()`,\n * and `confirm()` functions that users are used to, in addition to allowing popups with completely\n * custom content and look.\n *\n * An input can be given an `autofocus` attribute so it automatically receives focus when\n * the popup first shows. However, depending on certain use-cases this can cause issues with\n * the tap/click system, which is why Ionic prefers using the `autofocus` attribute as\n * an opt-in feature and not the default.\n *\n * @usage\n * A few basic examples, see below for details about all of the options available.\n *\n * ```js\n *angular.module('mySuperApp', ['ionic'])\n *.controller('PopupCtrl',function($scope, $ionicPopup, $timeout) {\n *\n * // Triggered on a button click, or some other target\n * $scope.showPopup = function() {\n *   $scope.data = {}\n *\n *   // An elaborate, custom popup\n *   var myPopup = $ionicPopup.show({\n *     template: '<input type=\"password\" ng-model=\"data.wifi\">',\n *     title: 'Enter Wi-Fi Password',\n *     subTitle: 'Please use normal things',\n *     scope: $scope,\n *     buttons: [\n *       { text: 'Cancel' },\n *       {\n *         text: '<b>Save</b>',\n *         type: 'button-positive',\n *         onTap: function(e) {\n *           if (!$scope.data.wifi) {\n *             //don't allow the user to close unless he enters wifi password\n *             e.preventDefault();\n *           } else {\n *             return $scope.data.wifi;\n *           }\n *         }\n *       },\n *     ]\n *   });\n *   myPopup.then(function(res) {\n *     console.log('Tapped!', res);\n *   });\n *   $timeout(function() {\n *      myPopup.close(); //close the popup after 3 seconds for some reason\n *   }, 3000);\n *  };\n *  // A confirm dialog\n *  $scope.showConfirm = function() {\n *    var confirmPopup = $ionicPopup.confirm({\n *      title: 'Consume Ice Cream',\n *      template: 'Are you sure you want to eat this ice cream?'\n *    });\n *    confirmPopup.then(function(res) {\n *      if(res) {\n *        console.log('You are sure');\n *      } else {\n *        console.log('You are not sure');\n *      }\n *    });\n *  };\n *\n *  // An alert dialog\n *  $scope.showAlert = function() {\n *    var alertPopup = $ionicPopup.alert({\n *      title: 'Don\\'t eat that!',\n *      template: 'It might taste good'\n *    });\n *    alertPopup.then(function(res) {\n *      console.log('Thank you for not eating my delicious ice cream cone');\n *    });\n *  };\n *});\n *```\n */\n\nIonicModule\n.factory('$ionicPopup', [\n  '$ionicTemplateLoader',\n  '$ionicBackdrop',\n  '$q',\n  '$timeout',\n  '$rootScope',\n  '$ionicBody',\n  '$compile',\n  '$ionicPlatform',\nfunction($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicBody, $compile, $ionicPlatform) {\n  //TODO allow this to be configured\n  var config = {\n    stackPushDelay: 75\n  };\n  var popupStack = [];\n  var $ionicPopup = {\n    /**\n     * @ngdoc method\n     * @description\n     * Show a complex popup. This is the master show function for all popups.\n     *\n     * A complex popup has a `buttons` array, with each button having a `text` and `type`\n     * field, in addition to an `onTap` function.  The `onTap` function, called when\n     * the correspondingbutton on the popup is tapped, will by default close the popup\n     * and resolve the popup promise with its return value.  If you wish to prevent the\n     * default and keep the popup open on button tap, call `event.preventDefault()` on the\n     * passed in tap event.  Details below.\n     *\n     * @name $ionicPopup#show\n     * @param {object} options The options for the new popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   scope: null, // Scope (optional). A scope to link to the popup content.\n     *   buttons: [{ //Array[Object] (optional). Buttons to place in the popup footer.\n     *     text: 'Cancel',\n     *     type: 'button-default',\n     *     onTap: function(e) {\n     *       // e.preventDefault() will stop the popup from closing when tapped.\n     *       e.preventDefault();\n     *     }\n     *   }, {\n     *     text: 'OK',\n     *     type: 'button-positive',\n     *     onTap: function(e) {\n     *       // Returning a value will cause the promise to resolve with the given value.\n     *       return scope.data.response;\n     *     }\n     *   }]\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has an additional\n     * `close` function, which can be used to programmatically close the popup.\n     */\n    show: showPopup,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#alert\n     * @description Show a simple alert popup with a message and one button that the user can\n     * tap to close the popup.\n     *\n     * @param {object} options The options for showing the alert, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   okText: '', // String (default: 'OK'). The text of the OK button.\n     *   okType: '', // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    alert: showAlert,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#confirm\n     * @description\n     * Show a simple confirm popup with a Cancel and OK button.\n     *\n     * Resolves the promise with true if the user presses the OK button, and false if the\n     * user presses the Cancel button.\n     *\n     * @param {object} options The options for showing the confirm popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.\n     *   cancelType: '', // String (default: 'button-default'). The type of the Cancel button.\n     *   okText: '', // String (default: 'OK'). The text of the OK button.\n     *   okType: '', // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    confirm: showConfirm,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#prompt\n     * @description Show a simple prompt popup, which has an input, OK button, and Cancel button.\n     * Resolves the promise with the value of the input if the user presses OK, and with undefined\n     * if the user presses Cancel.\n     *\n     * ```javascript\n     *  $ionicPopup.prompt({\n     *    title: 'Password Check',\n     *    template: 'Enter your secret password',\n     *    inputType: 'password',\n     *    inputPlaceholder: 'Your password'\n     *  }).then(function(res) {\n     *    console.log('Your password is', res);\n     *  });\n     * ```\n     * @param {object} options The options for showing the prompt popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   inputType: // String (default: 'text'). The type of input to use\n     *   inputPlaceholder: // String (default: ''). A placeholder to use for the input.\n     *   cancelText: // String (default: 'Cancel'. The text of the Cancel button.\n     *   cancelType: // String (default: 'button-default'). The type of the Cancel button.\n     *   okText: // String (default: 'OK'). The text of the OK button.\n     *   okType: // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    prompt: showPrompt,\n    /**\n     * @private for testing\n     */\n    _createPopup: createPopup,\n    _popupStack: popupStack\n  };\n\n  return $ionicPopup;\n\n  function createPopup(options) {\n    options = extend({\n      scope: null,\n      title: '',\n      buttons: [],\n    }, options || {});\n\n    var popupPromise = $ionicTemplateLoader.compile({\n      template: POPUP_TPL,\n      scope: options.scope && options.scope.$new(),\n      appendTo: $ionicBody.get()\n    });\n    var contentPromise = options.templateUrl ?\n      $ionicTemplateLoader.load(options.templateUrl) :\n      $q.when(options.template || options.content || '');\n\n    return $q.all([popupPromise, contentPromise])\n    .then(function(results) {\n      var self = results[0];\n      var content = results[1];\n      var responseDeferred = $q.defer();\n\n      self.responseDeferred = responseDeferred;\n\n      //Can't ng-bind-html for popup-body because it can be insecure html\n      //(eg an input in case of prompt)\n      var body = jqLite(self.element[0].querySelector('.popup-body'));\n      if (content) {\n        body.html(content);\n        $compile(body.contents())(self.scope);\n      } else {\n        body.remove();\n      }\n\n      extend(self.scope, {\n        title: options.title,\n        buttons: options.buttons,\n        subTitle: options.subTitle,\n        $buttonTapped: function(button, event) {\n          var result = (button.onTap || angular.noop)(event);\n          event = event.originalEvent || event; //jquery events\n\n          if (!event.defaultPrevented) {\n            responseDeferred.resolve(result);\n          }\n        }\n      });\n\n      self.show = function() {\n        if (self.isShown) return;\n\n        self.isShown = true;\n        ionic.requestAnimationFrame(function() {\n          //if hidden while waiting for raf, don't show\n          if (!self.isShown) return;\n\n          self.element.removeClass('popup-hidden');\n          self.element.addClass('popup-showing active');\n          focusInput(self.element);\n        });\n      };\n      self.hide = function(callback) {\n        callback = callback || angular.noop;\n        if (!self.isShown) return callback();\n\n        self.isShown = false;\n        self.element.removeClass('active');\n        self.element.addClass('popup-hidden');\n        $timeout(callback, 250);\n      };\n      self.remove = function() {\n        if (self.removed) return;\n\n        self.hide(function() {\n          self.element.remove();\n          self.scope.$destroy();\n        });\n\n        self.removed = true;\n      };\n\n      return self;\n    });\n  }\n\n  function onHardwareBackButton(e) {\n    popupStack[0] && popupStack[0].responseDeferred.resolve();\n  }\n\n  function showPopup(options) {\n    var popupPromise = $ionicPopup._createPopup(options);\n    var previousPopup = popupStack[0];\n\n    if (previousPopup) {\n      previousPopup.hide();\n    }\n\n    var resultPromise = $timeout(angular.noop, previousPopup ? config.stackPushDelay : 0)\n    .then(function() { return popupPromise; })\n    .then(function(popup) {\n      if (!previousPopup) {\n        //Add popup-open & backdrop if this is first popup\n        $ionicBody.addClass('popup-open');\n        $ionicBackdrop.retain();\n        //only show the backdrop on the first popup\n        $ionicPopup._backButtonActionDone = $ionicPlatform.registerBackButtonAction(\n          onHardwareBackButton,\n          PLATFORM_BACK_BUTTON_PRIORITY_POPUP\n        );\n      }\n      popupStack.unshift(popup);\n      popup.show();\n\n      //DEPRECATED: notify the promise with an object with a close method\n      popup.responseDeferred.notify({\n        close: resultPromise.close\n      });\n\n      return popup.responseDeferred.promise.then(function(result) {\n        var index = popupStack.indexOf(popup);\n        if (index !== -1) {\n          popupStack.splice(index, 1);\n        }\n        popup.remove();\n\n        var previousPopup = popupStack[0];\n        if (previousPopup) {\n          previousPopup.show();\n        } else {\n          //Remove popup-open & backdrop if this is last popup\n          $ionicBody.removeClass('popup-open');\n          $ionicBackdrop.release();\n          ($ionicPopup._backButtonActionDone || angular.noop)();\n        }\n        return result;\n      });\n    });\n\n    function close(result) {\n      popupPromise.then(function(popup) {\n        if (!popup.removed) {\n          popup.responseDeferred.resolve(result);\n        }\n      });\n    }\n    resultPromise.close = close;\n\n    return resultPromise;\n  }\n\n  function focusInput(element) {\n    var focusOn = element[0].querySelector('[autofocus]');\n    if (focusOn) {\n      focusOn.focus();\n    }\n  }\n\n  function showAlert(opts) {\n    return showPopup( extend({\n      buttons: [{\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function(e) {\n          return true;\n        }\n      }]\n    }, opts || {}) );\n  }\n\n  function showConfirm(opts) {\n    return showPopup( extend({\n      buttons: [{\n        text: opts.cancelText || 'Cancel' ,\n        type: opts.cancelType || 'button-default',\n        onTap: function(e) { return false; }\n      }, {\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function(e) { return true; }\n      }]\n    }, opts || {}) );\n  }\n\n  function showPrompt(opts) {\n    var scope = $rootScope.$new(true);\n    scope.data = {};\n    var text = '';\n    if(opts.template && /<[a-z][\\s\\S]*>/i.test(opts.template) === false){\n      text = '<span>'+opts.template+'</span>';\n      delete opts.template;\n    }\n    return showPopup( extend({\n      template: text+'<input ng-model=\"data.response\" type=\"' + (opts.inputType || 'text') +\n        '\" placeholder=\"' + (opts.inputPlaceholder || '') + '\">',\n      scope: scope,\n      buttons: [{\n        text: opts.cancelText || 'Cancel',\n        type: opts.cancelType|| 'button-default',\n        onTap: function(e) {}\n      }, {\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function(e) {\n          return scope.data.response || '';\n        }\n      }]\n    }, opts || {}) );\n  }\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicPosition\n * @module ionic\n * @description\n * A set of utility methods that can be use to retrieve position of DOM elements.\n * It is meant to be used where we need to absolute-position DOM elements in\n * relation to other, existing elements (this is the case for tooltips, popovers, etc.).\n *\n * Adapted from [AngularUI Bootstrap](https://github.com/angular-ui/bootstrap/blob/master/src/position/position.js),\n * ([license](https://github.com/angular-ui/bootstrap/blob/master/LICENSE))\n */\nIonicModule\n.factory('$ionicPosition', ['$document', '$window', function ($document, $window) {\n\n  function getStyle(el, cssprop) {\n    if (el.currentStyle) { //IE\n      return el.currentStyle[cssprop];\n    } else if ($window.getComputedStyle) {\n      return $window.getComputedStyle(el)[cssprop];\n    }\n    // finally try and get inline style\n    return el.style[cssprop];\n  }\n\n  /**\n   * Checks if a given element is statically positioned\n   * @param element - raw DOM element\n   */\n  function isStaticPositioned(element) {\n    return (getStyle(element, 'position') || 'static' ) === 'static';\n  }\n\n  /**\n   * returns the closest, non-statically positioned parentOffset of a given element\n   * @param element\n   */\n  var parentOffsetEl = function (element) {\n    var docDomEl = $document[0];\n    var offsetParent = element.offsetParent || docDomEl;\n    while (offsetParent && offsetParent !== docDomEl && isStaticPositioned(offsetParent) ) {\n      offsetParent = offsetParent.offsetParent;\n    }\n    return offsetParent || docDomEl;\n  };\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicPosition#position\n     * @description Get the current coordinates of the element, relative to the offset parent.\n     * Read-only equivalent of [jQuery's position function](http://api.jquery.com/position/).\n     * @param {element} element The element to get the position of.\n     * @returns {object} Returns an object containing the properties top, left, width and height.\n     */\n    position: function (element) {\n      var elBCR = this.offset(element);\n      var offsetParentBCR = { top: 0, left: 0 };\n      var offsetParentEl = parentOffsetEl(element[0]);\n      if (offsetParentEl != $document[0]) {\n        offsetParentBCR = this.offset(angular.element(offsetParentEl));\n        offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop;\n        offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft;\n      }\n\n      var boundingClientRect = element[0].getBoundingClientRect();\n      return {\n        width: boundingClientRect.width || element.prop('offsetWidth'),\n        height: boundingClientRect.height || element.prop('offsetHeight'),\n        top: elBCR.top - offsetParentBCR.top,\n        left: elBCR.left - offsetParentBCR.left\n      };\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicPosition#offset\n     * @description Get the current coordinates of the element, relative to the document.\n     * Read-only equivalent of [jQuery's offset function](http://api.jquery.com/offset/).\n     * @param {element} element The element to get the offset of.\n     * @returns {object} Returns an object containing the properties top, left, width and height.\n     */\n    offset: function (element) {\n      var boundingClientRect = element[0].getBoundingClientRect();\n      return {\n        width: boundingClientRect.width || element.prop('offsetWidth'),\n        height: boundingClientRect.height || element.prop('offsetHeight'),\n        top: boundingClientRect.top + ($window.pageYOffset || $document[0].documentElement.scrollTop),\n        left: boundingClientRect.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft)\n      };\n    }\n\n  };\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicScrollDelegate\n * @module ionic\n * @description\n * Delegate for controlling scrollViews (created by\n * {@link ionic.directive:ionContent} and\n * {@link ionic.directive:ionScroll} directives).\n *\n * Methods called directly on the $ionicScrollDelegate service will control all scroll\n * views.  Use the {@link ionic.service:$ionicScrollDelegate#$getByHandle $getByHandle}\n * method to control specific scrollViews.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-content>\n *     <button ng-click=\"scrollTop()\">Scroll to Top!</button>\n *   </ion-content>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicScrollDelegate) {\n *   $scope.scrollTop = function() {\n *     $ionicScrollDelegate.scrollTop();\n *   };\n * }\n * ```\n *\n * Example of advanced usage, with two scroll areas using `delegate-handle`\n * for fine control.\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-content delegate-handle=\"mainScroll\">\n *     <button ng-click=\"scrollMainToTop()\">\n *       Scroll content to top!\n *     </button>\n *     <ion-scroll delegate-handle=\"small\" style=\"height: 100px;\">\n *       <button ng-click=\"scrollSmallToTop()\">\n *         Scroll small area to top!\n *       </button>\n *     </ion-scroll>\n *   </ion-content>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicScrollDelegate) {\n *   $scope.scrollMainToTop = function() {\n *     $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop();\n *   };\n *   $scope.scrollSmallToTop = function() {\n *     $ionicScrollDelegate.$getByHandle('small').scrollTop();\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicScrollDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#resize\n   * @description Tell the scrollView to recalculate the size of its container.\n   */\n  'resize',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollTop\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollTop',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollBottom\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollBottom',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollTo\n   * @param {number} left The x-value to scroll to.\n   * @param {number} top The y-value to scroll to.\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollTo',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollBy\n   * @param {number} left The x-offset to scroll by.\n   * @param {number} top The y-offset to scroll by.\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollBy',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#zoomTo\n   * @param {number} level Level to zoom to.\n   * @param {boolean=} animate Whether to animate the zoom.\n   * @param {number=} originLeft Zoom in at given left coordinate.\n   * @param {number=} originTop Zoom in at given top coordinate.\n   */\n  'zoomTo',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#zoomBy\n   * @param {number} factor The factor to zoom by.\n   * @param {boolean=} animate Whether to animate the zoom.\n   * @param {number=} originLeft Zoom in at given left coordinate.\n   * @param {number=} originTop Zoom in at given top coordinate.\n   */\n  'zoomBy',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#getScrollPosition\n   * @returns {object} The scroll position of this view, with the following properties:\n   *  - `{number}` `left` The distance the user has scrolled from the left (starts at 0).\n   *  - `{number}` `top` The distance the user has scrolled from the top (starts at 0).\n   */\n  'getScrollPosition',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#anchorScroll\n   * @description Tell the scrollView to scroll to the element with an id\n   * matching window.location.hash.\n   *\n   * If no matching element is found, it will scroll to top.\n   *\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'anchorScroll',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#getScrollView\n   * @returns {object} The scrollView associated with this delegate.\n   */\n  'getScrollView',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#rememberScrollPosition\n   * @description\n   * Will make it so, when this scrollView is destroyed (user leaves the page),\n   * the last scroll position the page was on will be saved, indexed by the\n   * given id.\n   *\n   * Note: for pages associated with a view under an ion-nav-view,\n   * rememberScrollPosition automatically saves their scroll.\n   *\n   * Related methods: scrollToRememberedPosition, forgetScrollPosition (below).\n   *\n   * In the following example, the scroll position of the ion-scroll element\n   * will persist, even when the user changes the toggle switch.\n   *\n   * ```html\n   * <ion-toggle ng-model=\"shouldShowScrollView\"></ion-toggle>\n   * <ion-scroll delegate-handle=\"myScroll\" ng-if=\"shouldShowScrollView\">\n   *   <div ng-controller=\"ScrollCtrl\">\n   *     <ion-list>\n   *       {% raw %}<ion-item ng-repeat=\"i in items\">{{i}}</ion-item>{% endraw %}\n   *     </ion-list>\n   *   </div>\n   * </ion-scroll>\n   * ```\n   * ```js\n   * function ScrollCtrl($scope, $ionicScrollDelegate) {\n   *   var delegate = $ionicScrollDelegate.$getByHandle('myScroll');\n   *\n   *   // Put any unique ID here.  The point of this is: every time the controller is recreated\n   *   // we want to load the correct remembered scroll values.\n   *   delegate.rememberScrollPosition('my-scroll-id');\n   *   delegate.scrollToRememberedPosition();\n   *   $scope.items = [];\n   *   for (var i=0; i<100; i++) {\n   *     $scope.items.push(i);\n   *   }\n   * }\n   * ```\n   *\n   * @param {string} id The id to remember the scroll position of this\n   * scrollView by.\n   */\n  'rememberScrollPosition',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#forgetScrollPosition\n   * @description\n   * Stop remembering the scroll position for this scrollView.\n   */\n  'forgetScrollPosition',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollToRememberedPosition\n   * @description\n   * If this scrollView has an id associated with its scroll position,\n   * (through calling rememberScrollPosition), and that position is remembered,\n   * load the position and scroll to it.\n   * @param {boolean=} shouldAnimate Whether to animate the scroll.\n   */\n  'scrollToRememberedPosition'\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * scrollViews with `delegate-handle` matching the given handle.\n   *\n   * Example: `$ionicScrollDelegate.$getByHandle('my-handle').scrollTop();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicSideMenuDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionSideMenus} directive.\n *\n * Methods called directly on the $ionicSideMenuDelegate service will control all side\n * menus.  Use the {@link ionic.service:$ionicSideMenuDelegate#$getByHandle $getByHandle}\n * method to control specific ionSideMenus instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-side-menus>\n *     <ion-side-menu-content>\n *       Content!\n *       <button ng-click=\"toggleLeftSideMenu()\">\n *         Toggle Left Side Menu\n *       </button>\n *     </ion-side-menu-content>\n *     <ion-side-menu side=\"left\">\n *       Left Menu!\n *     <ion-side-menu>\n *   </ion-side-menus>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicSideMenuDelegate) {\n *   $scope.toggleLeftSideMenu = function() {\n *     $ionicSideMenuDelegate.toggleLeft();\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicSideMenuDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#toggleLeft\n   * @description Toggle the left side menu (if it exists).\n   * @param {boolean=} isOpen Whether to open or close the menu.\n   * Default: Toggles the menu.\n   */\n  'toggleLeft',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#toggleRight\n   * @description Toggle the right side menu (if it exists).\n   * @param {boolean=} isOpen Whether to open or close the menu.\n   * Default: Toggles the menu.\n   */\n  'toggleRight',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#getOpenRatio\n   * @description Gets the ratio of open amount over menu width. For example, a\n   * menu of width 100 that is opened by 50 pixels is 50% opened, and would return\n   * a ratio of 0.5.\n   *\n   * @returns {float} 0 if nothing is open, between 0 and 1 if left menu is\n   * opened/opening, and between 0 and -1 if right menu is opened/opening.\n   */\n  'getOpenRatio',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpen\n   * @returns {boolean} Whether either the left or right menu is currently opened.\n   */\n  'isOpen',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpenLeft\n   * @returns {boolean} Whether the left menu is currently opened.\n   */\n  'isOpenLeft',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpenRight\n   * @returns {boolean} Whether the right menu is currently opened.\n   */\n  'isOpenRight',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#canDragContent\n   * @param {boolean=} canDrag Set whether the content can or cannot be dragged to open\n   * side menus.\n   * @returns {boolean} Whether the content can be dragged to open side menus.\n   */\n  'canDragContent',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#edgeDragThreshold\n   * @param {boolean|number=} value Set whether the content drag can only start if it is below a certain threshold distance from the edge of the screen. Accepts three different values:\n   *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.\n   *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.\n   *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.\n   * @returns {boolean} Whether the drag can start only from within the edge of screen threshold.\n   */\n  'edgeDragThreshold',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionSideMenus} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicSideMenuDelegate.$getByHandle('my-handle').toggleLeft();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicSlideBoxDelegate\n * @module ionic\n * @description\n * Delegate that controls the {@link ionic.directive:ionSlideBox} directive.\n *\n * Methods called directly on the $ionicSlideBoxDelegate service will control all slide boxes.  Use the {@link ionic.service:$ionicSlideBoxDelegate#$getByHandle $getByHandle}\n * method to control specific slide box instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-slide-box>\n *     <ion-slide>\n *       <div class=\"box blue\">\n *         <button ng-click=\"nextSlide()\">Next slide!</button>\n *       </div>\n *     </ion-slide>\n *     <ion-slide>\n *       <div class=\"box red\">\n *         Slide 2!\n *       </div>\n *     </ion-slide>\n *   </ion-slide-box>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicSlideBoxDelegate) {\n *   $scope.nextSlide = function() {\n *     $ionicSlideBoxDelegate.next();\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicSlideBoxDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#update\n   * @description\n   * Update the slidebox (for example if using Angular with ng-repeat,\n   * resize it for the elements inside).\n   */\n  'update',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#slide\n   * @param {number} to The index to slide to.\n   * @param {number=} speed The number of milliseconds for the change to take.\n   */\n  'slide',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#enableSlide\n   * @param {boolean=} shouldEnable Whether to enable sliding the slidebox.\n   * @returns {boolean} Whether sliding is enabled.\n   */\n  'enableSlide',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#previous\n   * @description Go to the previous slide. Wraps around if at the beginning.\n   */\n  'previous',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#next\n   * @description Go to the next slide. Wraps around if at the end.\n   */\n  'next',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#stop\n   * @description Stop sliding. The slideBox will not move again until\n   * explicitly told to do so.\n   */\n  'stop',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#start\n   * @description Start sliding again if the slideBox was stopped. \n   */\n  'start',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#currentIndex\n   * @returns number The index of the current slide.\n   */\n  'currentIndex',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#slidesCount\n   * @returns number The number of slides there are currently.\n   */\n  'slidesCount'\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionSlideBox} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicSlideBoxDelegate.$getByHandle('my-handle').stop();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicTabsDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionTabs} directive.\n *\n * Methods called directly on the $ionicTabsDelegate service will control all ionTabs\n * directives. Use the {@link ionic.service:$ionicTabsDelegate#$getByHandle $getByHandle}\n * method to control specific ionTabs instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-tabs>\n *\n *     <ion-tab title=\"Tab 1\">\n *       Hello tab 1!\n *       <button ng-click=\"selectTabWithIndex(1)\">Select tab 2!</button>\n *     </ion-tab>\n *     <ion-tab title=\"Tab 2\">Hello tab 2!</ion-tab>\n *\n *   </ion-tabs>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicTabsDelegate) {\n *   $scope.selectTabWithIndex = function(index) {\n *     $ionicTabsDelegate.select(index);\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicTabsDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#select\n   * @description Select the tab matching the given index.\n   *\n   * @param {number} index Index of the tab to select.\n   */\n  'select',\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#selectedIndex\n   * @returns `number` The index of the selected tab, or -1.\n   */\n  'selectedIndex'\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionTabs} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicTabsDelegate.$getByHandle('my-handle').select(0);`\n   */\n]));\n\n\n// closure to keep things neat\n(function() {\n  var templatesToCache = [];\n\n/**\n * @ngdoc service\n * @name $ionicTemplateCache\n * @module ionic\n * @description A service that preemptively caches template files to eliminate transition flicker and boost performance.\n * @usage\n * State templates are cached automatically, but you can optionally cache other templates.\n *\n * ```js\n * $ionicTemplateCache('myNgIncludeTemplate.html');\n * ```\n *\n * Optionally disable all preemptive caching with the `$ionicConfigProvider` or individual states by setting `prefetchTemplate`\n * in the `$state` definition\n *\n * ```js\n *   angular.module('myApp', ['ionic'])\n *   .config(function($stateProvider, $ionicConfigProvider) {\n *\n *     // disable preemptive template caching globally\n *     $ionicConfigProvider.prefetchTemplates(false);\n *\n *     // disable individual states\n *     $stateProvider\n *       .state('tabs', {\n *         url: \"/tab\",\n *         abstract: true,\n *         prefetchTemplate: false,\n *         templateUrl: \"tabs-templates/tabs.html\"\n *       })\n *       .state('tabs.home', {\n *         url: \"/home\",\n *         views: {\n *           'home-tab': {\n *             prefetchTemplate: false,\n *             templateUrl: \"tabs-templates/home.html\",\n *             controller: 'HomeTabCtrl'\n *           }\n *         }\n *       });\n *   });\n * ```\n */\nIonicModule\n.factory('$ionicTemplateCache', [\n'$http',\n'$templateCache',\n'$timeout',\n'$ionicConfig',\nfunction($http, $templateCache, $timeout, $ionicConfig) {\n  var toCache = templatesToCache,\n      hasRun = false;\n\n  function $ionicTemplateCache(templates){\n    if(toCache.length > 500) return false;\n    if(typeof templates === 'undefined')return run();\n    if(isString(templates))templates = [templates];\n    forEach(templates, function(template){\n      toCache.push(template);\n    });\n    // is this is being called after the initial IonicModule.run()\n    if(hasRun) run();\n  }\n\n  // run through methods - internal method\n  var run = function(){\n    if($ionicConfig.prefetchTemplates === false)return;\n    //console.log('prefetching', toCache);\n    //for testing\n    $ionicTemplateCache._runCount++;\n\n    hasRun = true;\n    // ignore if race condition already zeroed out array\n    if(toCache.length === 0)return;\n    //console.log(toCache);\n    var i = 0;\n    while ( i < 5 && (template = toCache.pop()) ) {\n      // note that inline templates are ignored by this request\n      if (isString(template)) $http.get(template, { cache: $templateCache });\n      i++;\n    }\n    // only preload 5 templates a second\n    if(toCache.length)$timeout(function(){run();}, 1000);\n  };\n\n  // exposing for testing\n  $ionicTemplateCache._runCount = 0;\n  // default method\n  return $ionicTemplateCache;\n}])\n\n// Intercepts the $stateprovider.state() command to look for templateUrls that can be cached\n.config([\n'$stateProvider',\n'$ionicConfigProvider',\nfunction($stateProvider, $ionicConfigProvider) {\n  var stateProviderState = $stateProvider.state;\n  $stateProvider.state = function(stateName, definition) {\n    // don't even bother if it's disabled. note, another config may run after this, so it's not a catch-all\n    if($ionicConfigProvider.prefetchTemplates() !== false){\n      var enabled = definition.prefetchTemplate !== false;\n      if(enabled && isString(definition.templateUrl))templatesToCache.push(definition.templateUrl);\n      if(angular.isObject(definition.views)){\n        for (var key in definition.views){\n          enabled = definition.views[key].prefetchTemplate !== false;\n          if(enabled && isString(definition.views[key].templateUrl)) templatesToCache.push(definition.views[key].templateUrl);\n        }\n      }\n    }\n    return stateProviderState.call($stateProvider, stateName, definition);\n  };\n}])\n\n// process the templateUrls collected by the $stateProvider, adding them to the cache\n.run([\n'$ionicTemplateCache',\nfunction($ionicTemplateCache) {\n  $ionicTemplateCache();\n}]);\n\n})();\n\nIonicModule\n.factory('$ionicTemplateLoader', [\n  '$compile',\n  '$controller',\n  '$http',\n  '$q',\n  '$rootScope',\n  '$templateCache',\nfunction($compile, $controller, $http, $q, $rootScope, $templateCache) {\n\n  return {\n    load: fetchTemplate,\n    compile: loadAndCompile\n  };\n\n  function fetchTemplate(url) {\n    return $http.get(url, {cache: $templateCache})\n    .then(function(response) {\n      return response.data && response.data.trim();\n    });\n  }\n\n  function loadAndCompile(options) {\n    options = extend({\n      template: '',\n      templateUrl: '',\n      scope: null,\n      controller: null,\n      locals: {},\n      appendTo: null\n    }, options || {});\n\n    var templatePromise = options.templateUrl ?\n      this.load(options.templateUrl) :\n      $q.when(options.template);\n\n    return templatePromise.then(function(template) {\n      var controller;\n      var scope = options.scope || $rootScope.$new();\n\n      //Incase template doesn't have just one root element, do this\n      var element = jqLite('<div>').html(template).contents();\n\n      if (options.controller) {\n        controller = $controller(\n          options.controller,\n          extend(options.locals, {\n            $scope: scope\n          })\n        );\n        element.children().data('$ngControllerController', controller);\n      }\n      if (options.appendTo) {\n        jqLite(options.appendTo).append(element);\n      }\n\n      $compile(element)(scope);\n\n      return {\n        element: element,\n        scope: scope\n      };\n    });\n  }\n\n}]);\n\n/**\n * @private\n * TODO document\n */\nIonicModule\n.run([\n  '$rootScope',\n  '$state',\n  '$location',\n  '$document',\n  '$animate',\n  '$ionicPlatform',\n  '$ionicViewService',\nfunction($rootScope, $state, $location, $document, $animate, $ionicPlatform, $ionicViewService) {\n\n  // init the variables that keep track of the view history\n  $rootScope.$viewHistory = {\n    histories: { root: { historyId: 'root', parentHistoryId: null, stack: [], cursor: -1 } },\n    views: {},\n    backView: null,\n    forwardView: null,\n    currentView: null,\n    disabledRegistrableTagNames: []\n  };\n\n  // set that these directives should not animate when transitioning\n  // to it. Instead, the children <tab> directives would animate\n  if ($ionicViewService.disableRegisterByTagName) {\n    $ionicViewService.disableRegisterByTagName('ion-tabs');\n    $ionicViewService.disableRegisterByTagName('ion-side-menus');\n  }\n\n  $rootScope.$on('viewState.changeHistory', function(e, data) {\n    if(!data) return;\n\n    var hist = (data.historyId ? $rootScope.$viewHistory.histories[ data.historyId ] : null );\n    if(hist && hist.cursor > -1 && hist.cursor < hist.stack.length) {\n      // the history they're going to already exists\n      // go to it's last view in its stack\n      var view = hist.stack[ hist.cursor ];\n      return view.go(data);\n    }\n\n    // this history does not have a URL, but it does have a uiSref\n    // figure out its URL from the uiSref\n    if(!data.url && data.uiSref) {\n      data.url = $state.href(data.uiSref);\n    }\n\n    if(data.url) {\n      // don't let it start with a #, messes with $location.url()\n      if(data.url.indexOf('#') === 0) {\n        data.url = data.url.replace('#', '');\n      }\n      if(data.url !== $location.url()) {\n        // we've got a good URL, ready GO!\n        $location.url(data.url);\n      }\n    }\n  });\n\n  // Set the document title when a new view is shown\n  $rootScope.$on('viewState.viewEnter', function(e, data) {\n    if(data && data.title) {\n      $document[0].title = data.title;\n    }\n  });\n\n  // Triggered when devices with a hardware back button (Android) is clicked by the user\n  // This is a Cordova/Phonegap platform specifc method\n  function onHardwareBackButton(e) {\n    if($rootScope.$viewHistory.backView) {\n      // there is a back view, go to it\n      $rootScope.$viewHistory.backView.go();\n    } else {\n      // there is no back view, so close the app instead\n      ionic.Platform.exitApp();\n    }\n    e.preventDefault();\n    return false;\n  }\n  $ionicPlatform.registerBackButtonAction(\n    onHardwareBackButton,\n    PLATFORM_BACK_BUTTON_PRIORITY_VIEW\n  );\n\n}])\n\n.factory('$ionicViewService', [\n  '$rootScope',\n  '$state',\n  '$location',\n  '$window',\n  '$injector',\n  '$animate',\n  '$ionicNavViewConfig',\n  '$ionicClickBlock',\nfunction($rootScope, $state, $location, $window, $injector, $animate, $ionicNavViewConfig, $ionicClickBlock) {\n\n  var View = function(){};\n  View.prototype.initialize = function(data) {\n    if(data) {\n      for(var name in data) this[name] = data[name];\n      return this;\n    }\n    return null;\n  };\n  View.prototype.go = function() {\n\n    if(this.stateName) {\n      return $state.go(this.stateName, this.stateParams);\n    }\n\n    if(this.url && this.url !== $location.url()) {\n\n      if($rootScope.$viewHistory.backView === this) {\n        return $window.history.go(-1);\n      } else if($rootScope.$viewHistory.forwardView === this) {\n        return $window.history.go(1);\n      }\n\n      $location.url(this.url);\n      return;\n    }\n\n    return null;\n  };\n  View.prototype.destroy = function() {\n    if(this.scope) {\n      this.scope.$destroy && this.scope.$destroy();\n      this.scope = null;\n    }\n  };\n\n  function createViewId(stateId) {\n    return ionic.Utils.nextUid();\n  }\n\n  return {\n\n    register: function(containerScope, element) {\n\n      var viewHistory = $rootScope.$viewHistory,\n          currentStateId = this.getCurrentStateId(),\n          hist = this._getHistory(containerScope),\n          currentView = viewHistory.currentView,\n          backView = viewHistory.backView,\n          forwardView = viewHistory.forwardView,\n          nextViewOptions = this.nextViewOptions(),\n          rsp = {\n            viewId: null,\n            navAction: null,\n            navDirection: null,\n            historyId: hist.historyId\n          };\n\n      if(element && !this.isTagNameRegistrable(element)) {\n        // first check to see if this element can even be registered as a view.\n        // Certain tags are only containers for views, but are not views themselves.\n        // For example, the <ion-tabs> directive contains a <ion-tab> and the <ion-tab> is the\n        // view, but the <ion-tabs> directive itself should not be registered as a view.\n        rsp.navAction = 'disabledByTagName';\n        return rsp;\n      }\n\n      if(currentView &&\n         currentView.stateId === currentStateId &&\n         currentView.historyId === hist.historyId) {\n        // do nothing if its the same stateId in the same history\n        rsp.navAction = 'noChange';\n        return rsp;\n      }\n\n      if(viewHistory.forcedNav) {\n        // we've previously set exactly what to do\n        ionic.Utils.extend(rsp, viewHistory.forcedNav);\n        $rootScope.$viewHistory.forcedNav = null;\n\n      } else if(backView && backView.stateId === currentStateId) {\n        // they went back one, set the old current view as a forward view\n        rsp.viewId = backView.viewId;\n        rsp.navAction = 'moveBack';\n        rsp.viewId = backView.viewId;\n        if(backView.historyId === currentView.historyId) {\n          // went back in the same history\n          rsp.navDirection = 'back';\n        }\n\n      } else if(forwardView && forwardView.stateId === currentStateId) {\n        // they went to the forward one, set the forward view to no longer a forward view\n        rsp.viewId = forwardView.viewId;\n        rsp.navAction = 'moveForward';\n        if(forwardView.historyId === currentView.historyId) {\n          rsp.navDirection = 'forward';\n        }\n\n        var parentHistory = this._getParentHistoryObj(containerScope);\n        if(forwardView.historyId && parentHistory.scope) {\n          // if a history has already been created by the forward view then make sure it stays the same\n          parentHistory.scope.$historyId = forwardView.historyId;\n          rsp.historyId = forwardView.historyId;\n        }\n\n      } else if(currentView && currentView.historyId !== hist.historyId &&\n                hist.cursor > -1 && hist.stack.length > 0 && hist.cursor < hist.stack.length &&\n                hist.stack[hist.cursor].stateId === currentStateId) {\n        // they just changed to a different history and the history already has views in it\n        rsp.viewId = hist.stack[hist.cursor].viewId;\n        rsp.navAction = 'moveBack';\n\n      } else {\n\n        // set a new unique viewId\n        rsp.viewId = createViewId(currentStateId);\n\n        if(currentView) {\n          // set the forward view if there is a current view (ie: if its not the first view)\n          currentView.forwardViewId = rsp.viewId;\n\n          // its only moving forward if its in the same history\n          if(hist.historyId === currentView.historyId) {\n            rsp.navDirection = 'forward';\n          }\n          rsp.navAction = 'newView';\n\n          // check if there is a new forward view\n          if(forwardView && currentView.stateId !== forwardView.stateId) {\n            // they navigated to a new view but the stack already has a forward view\n            // since its a new view remove any forwards that existed\n            var forwardsHistory = this._getHistoryById(forwardView.historyId);\n            if(forwardsHistory) {\n              // the forward has a history\n              for(var x=forwardsHistory.stack.length - 1; x >= forwardView.index; x--) {\n                // starting from the end destroy all forwards in this history from this point\n                forwardsHistory.stack[x].destroy();\n                forwardsHistory.stack.splice(x);\n              }\n            }\n          }\n\n        } else {\n          // there's no current view, so this must be the initial view\n          rsp.navAction = 'initialView';\n        }\n\n        // add the new view\n        viewHistory.views[rsp.viewId] = this.createView({\n          viewId: rsp.viewId,\n          index: hist.stack.length,\n          historyId: hist.historyId,\n          backViewId: (currentView && currentView.viewId ? currentView.viewId : null),\n          forwardViewId: null,\n          stateId: currentStateId,\n          stateName: this.getCurrentStateName(),\n          stateParams: this.getCurrentStateParams(),\n          url: $location.url(),\n        });\n\n        if (rsp.navAction == 'moveBack') {\n          //moveBack(from, to);\n          $rootScope.$emit('$viewHistory.viewBack', currentView.viewId, rsp.viewId);\n        }\n\n        // add the new view to this history's stack\n        hist.stack.push(viewHistory.views[rsp.viewId]);\n      }\n\n      if(nextViewOptions) {\n        if(nextViewOptions.disableAnimate) rsp.navDirection = null;\n        if(nextViewOptions.disableBack) viewHistory.views[rsp.viewId].backViewId = null;\n        this.nextViewOptions(null);\n      }\n\n      this.setNavViews(rsp.viewId);\n\n      hist.cursor = viewHistory.currentView.index;\n\n      return rsp;\n    },\n\n    setNavViews: function(viewId) {\n      var viewHistory = $rootScope.$viewHistory;\n\n      viewHistory.currentView = this._getViewById(viewId);\n      viewHistory.backView = this._getBackView(viewHistory.currentView);\n      viewHistory.forwardView = this._getForwardView(viewHistory.currentView);\n\n      $rootScope.$broadcast('$viewHistory.historyChange', {\n        showBack: (viewHistory.backView && viewHistory.backView.historyId === viewHistory.currentView.historyId)\n      });\n    },\n\n    registerHistory: function(scope) {\n      scope.$historyId = ionic.Utils.nextUid();\n    },\n\n    createView: function(data) {\n      var newView = new View();\n      return newView.initialize(data);\n    },\n\n    getCurrentView: function() {\n      return $rootScope.$viewHistory.currentView;\n    },\n\n    getBackView: function() {\n      return $rootScope.$viewHistory.backView;\n    },\n\n    getForwardView: function() {\n      return $rootScope.$viewHistory.forwardView;\n    },\n\n    getNavDirection: function() {\n      return $rootScope.$viewHistory.navDirection;\n    },\n\n    getCurrentStateName: function() {\n      return ($state && $state.current ? $state.current.name : null);\n    },\n\n    isCurrentStateNavView: function(navView) {\n      return ($state &&\n              $state.current &&\n              $state.current.views &&\n              $state.current.views[navView] ? true : false);\n    },\n\n    getCurrentStateParams: function() {\n      var rtn;\n      if ($state && $state.params) {\n        for(var key in $state.params) {\n          if($state.params.hasOwnProperty(key)) {\n            rtn = rtn || {};\n            rtn[key] = $state.params[key];\n          }\n        }\n      }\n      return rtn;\n    },\n\n    getCurrentStateId: function() {\n      var id;\n      if($state && $state.current && $state.current.name) {\n        id = $state.current.name;\n        if($state.params) {\n          for(var key in $state.params) {\n            if($state.params.hasOwnProperty(key) && $state.params[key]) {\n              id += \"_\" + key + \"=\" + $state.params[key];\n            }\n          }\n        }\n        return id;\n      }\n      // if something goes wrong make sure its got a unique stateId\n      return ionic.Utils.nextUid();\n    },\n\n    goToHistoryRoot: function(historyId) {\n      if(historyId) {\n        var hist = $rootScope.$viewHistory.histories[ historyId ];\n        if(hist && hist.stack.length) {\n          if($rootScope.$viewHistory.currentView && $rootScope.$viewHistory.currentView.viewId === hist.stack[0].viewId) {\n            return;\n          }\n          $rootScope.$viewHistory.forcedNav = {\n            viewId: hist.stack[0].viewId,\n            navAction: 'moveBack',\n            navDirection: 'back'\n          };\n          hist.stack[0].go();\n        }\n      }\n    },\n\n    _getViewById: function(viewId) {\n      return (viewId ? $rootScope.$viewHistory.views[ viewId ] : null );\n    },\n\n    _getBackView: function(view) {\n      return (view ? this._getViewById(view.backViewId) : null );\n    },\n\n    _getForwardView: function(view) {\n      return (view ? this._getViewById(view.forwardViewId) : null );\n    },\n\n    _getHistoryById: function(historyId) {\n      return (historyId ? $rootScope.$viewHistory.histories[ historyId ] : null );\n    },\n\n    _getHistory: function(scope) {\n      var histObj = this._getParentHistoryObj(scope);\n\n      if( !$rootScope.$viewHistory.histories[ histObj.historyId ] ) {\n        // this history object exists in parent scope, but doesn't\n        // exist in the history data yet\n        $rootScope.$viewHistory.histories[ histObj.historyId ] = {\n          historyId: histObj.historyId,\n          parentHistoryId: this._getParentHistoryObj(histObj.scope.$parent).historyId,\n          stack: [],\n          cursor: -1\n        };\n      }\n\n      return $rootScope.$viewHistory.histories[ histObj.historyId ];\n    },\n\n    _getParentHistoryObj: function(scope) {\n      var parentScope = scope;\n      while(parentScope) {\n        if(parentScope.hasOwnProperty('$historyId')) {\n          // this parent scope has a historyId\n          return { historyId: parentScope.$historyId, scope: parentScope };\n        }\n        // nothing found keep climbing up\n        parentScope = parentScope.$parent;\n      }\n      // no history for for the parent, use the root\n      return { historyId: 'root', scope: $rootScope };\n    },\n\n    nextViewOptions: function(opts) {\n      if(arguments.length) {\n        this._nextOpts = opts;\n      } else {\n        return this._nextOpts;\n      }\n    },\n\n    getRenderer: function(navViewElement, navViewAttrs, navViewScope) {\n      var service = this;\n      var registerData;\n      var doAnimation;\n\n      // climb up the DOM and see which animation classname to use, if any\n      var animationClass = getParentAnimationClass(navViewElement[0]);\n\n      function getParentAnimationClass(el) {\n        var className = '';\n        while(!className && el) {\n          className = el.getAttribute('animation');\n          el = el.parentElement;\n        }\n\n        // If they don't have an animation set explicitly, use the value in the config\n        if(!className) {\n          return $ionicNavViewConfig.transition;\n        }\n\n        return className;\n      }\n\n      function setAnimationClass() {\n        // add the animation CSS class we're gonna use to transition between views\n        if (animationClass) {\n          navViewElement[0].classList.add(animationClass);\n        }\n\n        if(registerData.navDirection === 'back') {\n          // animate like we're moving backward\n          navViewElement[0].classList.add('reverse');\n        } else {\n          // defaults to animate forward\n          // make sure the reverse class isn't already added\n          navViewElement[0].classList.remove('reverse');\n        }\n      }\n\n      return function(shouldAnimate) {\n\n        return {\n\n          enter: function(element) {\n\n            if(doAnimation && shouldAnimate) {\n              // enter with an animation\n              setAnimationClass();\n\n              element.addClass('ng-enter');\n              $ionicClickBlock.show();\n\n              $animate.enter(element, navViewElement, null, function() {\n                $ionicClickBlock.hide();\n                if (animationClass) {\n                  navViewElement[0].classList.remove(animationClass);\n                }\n              });\n              return;\n            } else if(!doAnimation) {\n              $ionicClickBlock.hide();\n            }\n\n            // no animation\n            navViewElement.append(element);\n          },\n\n          leave: function() {\n            var element = navViewElement.contents();\n\n            if(doAnimation && shouldAnimate) {\n              // leave with an animation\n              setAnimationClass();\n\n              $animate.leave(element, function() {\n                element.remove();\n              });\n              return;\n            }\n\n            // no animation\n            element.remove();\n          },\n\n          register: function(element) {\n            // register a new view\n            registerData = service.register(navViewScope, element);\n            doAnimation = (animationClass !== null && registerData.navDirection !== null);\n            return registerData;\n          }\n\n        };\n      };\n    },\n\n    disableRegisterByTagName: function(tagName) {\n      // not every element should animate betwee transitions\n      // For example, the <ion-tabs> directive should not animate when it enters,\n      // but instead the <ion-tabs> directve would just show, and its children\n      // <ion-tab> directives would do the animating, but <ion-tabs> itself is not a view\n      $rootScope.$viewHistory.disabledRegistrableTagNames.push(tagName.toUpperCase());\n    },\n\n    isTagNameRegistrable: function(element) {\n      // check if this element has a tagName (at its root, not recursively)\n      // that shouldn't be animated, like <ion-tabs> or <ion-side-menu>\n      var x, y, disabledTags = $rootScope.$viewHistory.disabledRegistrableTagNames;\n      for(x=0; x<element.length; x++) {\n        if(element[x].nodeType !== 1) continue;\n        for(y=0; y<disabledTags.length; y++) {\n          if(element[x].tagName === disabledTags[y]) {\n            return false;\n          }\n        }\n      }\n      return true;\n    },\n\n    clearHistory: function() {\n      var\n      histories = $rootScope.$viewHistory.histories,\n      currentView = $rootScope.$viewHistory.currentView;\n\n      if(histories) {\n        for(var historyId in histories) {\n\n          if(histories[historyId].stack) {\n            histories[historyId].stack = [];\n            histories[historyId].cursor = -1;\n          }\n\n          if(currentView && currentView.historyId === historyId) {\n            currentView.backViewId = null;\n            currentView.forwardViewId = null;\n            histories[historyId].stack.push(currentView);\n          } else if(histories[historyId].destroy) {\n            histories[historyId].destroy();\n          }\n\n        }\n      }\n\n      for(var viewId in $rootScope.$viewHistory.views) {\n        if(viewId !== currentView.viewId) {\n          delete $rootScope.$viewHistory.views[viewId];\n        }\n      }\n\n      if(currentView) {\n        this.setNavViews(currentView.viewId);\n      }\n    }\n\n  };\n\n}]);\n\n/**\n * @private\n */\nIonicModule.config([\n  '$provide',\nfunction($provide) {\n  function $LocationDecorator($location, $timeout) {\n\n    $location.__hash = $location.hash;\n    //Fix: when window.location.hash is set, the scrollable area\n    //found nearest to body's scrollTop is set to scroll to an element\n    //with that ID.\n    $location.hash = function(value) {\n      if (angular.isDefined(value)) {\n        $timeout(function() {\n          var scroll = document.querySelector('.scroll-content');\n          if (scroll)\n            scroll.scrollTop = 0;\n        }, 0, false);\n      }\n      return $location.__hash(value);\n    };\n\n    return $location;\n  }\n\n  $provide.decorator('$location', ['$delegate', '$timeout', $LocationDecorator]);\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicListDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionList} directive.\n *\n * Methods called directly on the $ionicListDelegate service will control all lists.\n * Use the {@link ionic.service:$ionicListDelegate#$getByHandle $getByHandle}\n * method to control specific ionList instances.\n *\n * @usage\n *\n * ````html\n * <ion-content ng-controller=\"MyCtrl\">\n *   <button class=\"button\" ng-click=\"showDeleteButtons()\"></button>\n *   <ion-list>\n *     <ion-item ng-repeat=\"i in items\">\n *       {% raw %}Hello, {{i}}!{% endraw %}\n *       <ion-delete-button class=\"ion-minus-circled\"></ion-delete-button>\n *     </ion-item>\n *   </ion-list>\n * </ion-content>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicListDelegate) {\n *   $scope.showDeleteButtons = function() {\n *     $ionicListDelegate.showDelete(true);\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicListDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#showReorder\n   * @param {boolean=} showReorder Set whether or not this list is showing its reorder buttons.\n   * @returns {boolean} Whether the reorder buttons are shown.\n   */\n  'showReorder',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#showDelete\n   * @param {boolean=} showDelete Set whether or not this list is showing its delete buttons.\n   * @returns {boolean} Whether the delete buttons are shown.\n   */\n  'showDelete',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#canSwipeItems\n   * @param {boolean=} canSwipeItems Set whether or not this list is able to swipe to show\n   * option buttons.\n   * @returns {boolean} Whether the list is able to swipe to show option buttons.\n   */\n  'canSwipeItems',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#closeOptionButtons\n   * @description Closes any option buttons on the list that are swiped open.\n   */\n  'closeOptionButtons',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionList} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicListDelegate.$getByHandle('my-handle').showReorder(true);`\n   */\n]))\n\n.controller('$ionicList', [\n  '$scope',\n  '$attrs',\n  '$parse',\n  '$ionicListDelegate',\nfunction($scope, $attrs, $parse, $ionicListDelegate) {\n\n  var isSwipeable = true;\n  var isReorderShown = false;\n  var isDeleteShown = false;\n\n  var deregisterInstance = $ionicListDelegate._registerInstance(this, $attrs.delegateHandle);\n  $scope.$on('$destroy', deregisterInstance);\n\n  this.showReorder = function(show) {\n    if (arguments.length) {\n      isReorderShown = !!show;\n    }\n    return isReorderShown;\n  };\n\n  this.showDelete = function(show) {\n    if (arguments.length) {\n      isDeleteShown = !!show;\n    }\n    return isDeleteShown;\n  };\n\n  this.canSwipeItems = function(can) {\n    if (arguments.length) {\n      isSwipeable = !!can;\n    }\n    return isSwipeable;\n  };\n\n  this.closeOptionButtons = function() {\n    this.listView && this.listView.clearDragEffects();\n  };\n}]);\n\nIonicModule\n.controller('$ionicNavBar', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$ionicViewService',\n  '$animate',\n  '$compile',\n  '$ionicNavBarDelegate',\nfunction($scope, $element, $attrs, $ionicViewService, $animate, $compile, $ionicNavBarDelegate) {\n  //Let the parent know about our controller too so that children of\n  //sibling content elements can know about us\n  $element.parent().data('$ionNavBarController', this);\n\n  var deregisterInstance = $ionicNavBarDelegate._registerInstance(this, $attrs.delegateHandle);\n\n  $scope.$on('$destroy', deregisterInstance);\n\n  $scope.$on('$viewHistory.historyChange', function(e, data) {\n    backIsShown = !!data.showBack;\n  });\n\n  var self = this;\n\n  this.leftButtonsElement = jqLite(\n    $element[0].querySelector('.buttons.left-buttons')\n  );\n  this.rightButtonsElement = jqLite(\n    $element[0].querySelector('.buttons.right-buttons')\n  );\n\n  this.back = function() {\n    var backView = $ionicViewService.getBackView();\n    backView && backView.go();\n    return false;\n  };\n\n  this.align = function(direction) {\n    this._headerBarView.align(direction);\n  };\n\n  this.showBackButton = function(show) {\n    if (arguments.length) {\n      $scope.backButtonShown = !!show;\n    }\n    return !!($scope.hasBackButton && $scope.backButtonShown);\n  };\n\n  this.showBar = function(show) {\n    if (arguments.length) {\n      $scope.isInvisible = !show;\n      $scope.$parent.$hasHeader = !!show;\n    }\n    return !$scope.isInvisible;\n  };\n\n  this.setTitle = function(title) {\n    if ($scope.title === title) {\n      return;\n    }\n    $scope.oldTitle = $scope.title;\n    $scope.title = title || '';\n  };\n\n  this.changeTitle = function(title, direction) {\n    if ($scope.title === title) {\n      // if we're not animating the title, but the back button becomes invisible\n      if(typeof backIsShown != 'undefined' && !backIsShown && $scope.backButtonShown){\n        jqLite($element[0].querySelector('.back-button')).addClass('ng-hide');\n      }\n      return false;\n    }\n    this.setTitle(title);\n    $scope.isReverse = direction == 'back';\n    $scope.shouldAnimate = !!direction;\n\n    if (!$scope.shouldAnimate) {\n      //We're done!\n      this._headerBarView.align();\n    } else {\n      this._animateTitles();\n    }\n    return true;\n  };\n\n  this.getTitle = function() {\n    return $scope.title || '';\n  };\n\n  this.getPreviousTitle = function() {\n    return $scope.oldTitle || '';\n  };\n\n  /**\n   * Exposed for testing\n   */\n  this._animateTitles = function() {\n    var oldTitleEl, newTitleEl, currentTitles;\n\n    //If we have any title right now\n    //(or more than one, they could be transitioning on switch),\n    //replace the first one with an oldTitle element\n    currentTitles = $element[0].querySelectorAll('.title');\n    if (currentTitles.length) {\n      oldTitleEl = $compile('<h1 class=\"title\" ng-bind-html=\"oldTitle\"></h1>')($scope);\n      jqLite(currentTitles[0]).replaceWith(oldTitleEl);\n    }\n    //Compile new title\n    newTitleEl = $compile('<h1 class=\"title invisible\" ng-bind-html=\"title\"></h1>')($scope);\n\n    //Animate in on next frame\n    ionic.requestAnimationFrame(function() {\n\n      oldTitleEl && $animate.leave(jqLite(oldTitleEl));\n\n      var insert = oldTitleEl && jqLite(oldTitleEl) || null;\n      $animate.enter(newTitleEl, $element, insert, function() {\n        self._headerBarView.align();\n      });\n\n      //Cleanup any old titles leftover (besides the one we already did replaceWith on)\n      forEach(currentTitles, function(el) {\n        if (el && el.parentNode) {\n          //Use .remove() to cleanup things like .data()\n          jqLite(el).remove();\n        }\n      });\n\n      //$apply so bindings fire\n      $scope.$digest();\n\n      //Stop flicker of new title on ios7\n      ionic.requestAnimationFrame(function() {\n        newTitleEl[0].classList.remove('invisible');\n      });\n    });\n  };\n}]);\n\n\n/**\n * @private\n */\nIonicModule\n\n.factory('$$scrollValueCache', function() {\n  return {};\n})\n\n.controller('$ionicScroll', [\n  '$scope',\n  'scrollViewOptions',\n  '$timeout',\n  '$window',\n  '$$scrollValueCache',\n  '$location',\n  '$rootScope',\n  '$document',\n  '$ionicScrollDelegate',\nfunction($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $location, $rootScope, $document, $ionicScrollDelegate) {\n\n  var self = this;\n  // for testing\n  this.__timeout = $timeout;\n\n  this._scrollViewOptions = scrollViewOptions; //for testing\n\n  var element = this.element = scrollViewOptions.el;\n  var $element = this.$element = jqLite(element);\n  var scrollView = this.scrollView = new ionic.views.Scroll(scrollViewOptions);\n\n  //Attach self to element as a controller so other directives can require this controller\n  //through `require: '$ionicScroll'\n  //Also attach to parent so that sibling elements can require this\n  ($element.parent().length ? $element.parent() : $element)\n    .data('$$ionicScrollController', this);\n\n  var deregisterInstance = $ionicScrollDelegate._registerInstance(\n    this, scrollViewOptions.delegateHandle\n  );\n\n  if (!angular.isDefined(scrollViewOptions.bouncing)) {\n    ionic.Platform.ready(function() {\n      scrollView.options.bouncing = true;\n\n      if(ionic.Platform.isAndroid()) {\n        // No bouncing by default on Android\n        scrollView.options.bouncing = false;\n        // Faster scroll decel\n        scrollView.options.deceleration = 0.95;\n      } else {\n      }\n    });\n  }\n\n  var resize = angular.bind(scrollView, scrollView.resize);\n  ionic.on('resize', resize, $window);\n\n  // set by rootScope listener if needed\n  var backListenDone = angular.noop;\n  var viewContentLoaded = angular.noop;\n\n  var scrollFunc = function(e) {\n    var detail = (e.originalEvent || e).detail || {};\n    $scope.$onScroll && $scope.$onScroll({\n      event: e,\n      scrollTop: detail.scrollTop || 0,\n      scrollLeft: detail.scrollLeft || 0\n    });\n  };\n\n  $element.on('scroll', scrollFunc );\n\n  $scope.$on('$destroy', function() {\n    deregisterInstance();\n    scrollView.__cleanup();\n    ionic.off('resize', resize, $window);\n    $window.removeEventListener('resize', resize);\n    viewContentLoaded();\n    backListenDone();\n    if (self._rememberScrollId) {\n      $$scrollValueCache[self._rememberScrollId] = scrollView.getValues();\n    }\n    scrollViewOptions = null;\n    self._scrollViewOptions = null;\n    self.element = null;\n    $element.off('scroll', scrollFunc);\n    $element = null;\n    self.$element = null;\n    self.scrollView = null;\n    scrollView = null;\n  });\n\n  viewContentLoaded = $scope.$on('$viewContentLoaded', function(e, historyData) {\n    //only the top-most scroll area under a view should remember that view's\n    //scroll position\n    if (e.defaultPrevented) { return; }\n    e.preventDefault();\n\n    var viewId = historyData && historyData.viewId || $scope.$historyId;\n    if (viewId) {\n      $timeout(function() {\n        self.rememberScrollPosition(viewId);\n        self.scrollToRememberedPosition();\n\n        backListenDone = $rootScope.$on('$viewHistory.viewBack', function(e, fromViewId, toViewId) {\n          //When going back from this view, forget its saved scroll position\n          if (viewId === fromViewId) {\n            self.forgetScrollPosition();\n          }\n        });\n      }, 0, false);\n    }\n  });\n\n  $timeout(function() {\n    scrollView.run();\n  });\n\n  this._rememberScrollId = null;\n\n  this.getScrollView = function() {\n    return this.scrollView;\n  };\n\n  this.getScrollPosition = function() {\n    return this.scrollView.getValues();\n  };\n\n  this.resize = function() {\n    return $timeout(resize).then(function() {\n      $element.triggerHandler('scroll.resize');\n    });\n  };\n\n  this.scrollTop = function(shouldAnimate) {\n    this.resize().then(function() {\n      scrollView.scrollTo(0, 0, !!shouldAnimate);\n    });\n  };\n\n  this.scrollBottom = function(shouldAnimate) {\n    this.resize().then(function() {\n      var max = scrollView.getScrollMax();\n      scrollView.scrollTo(max.left, max.top, !!shouldAnimate);\n    });\n  };\n\n  this.scrollTo = function(left, top, shouldAnimate) {\n    this.resize().then(function() {\n      scrollView.scrollTo(left, top, !!shouldAnimate);\n    });\n  };\n\n  this.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) {\n    this.resize().then(function() {\n      scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop);\n    });\n  };\n\n  this.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) {\n    this.resize().then(function() {\n      scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop);\n    });\n  };\n\n  this.scrollBy = function(left, top, shouldAnimate) {\n    this.resize().then(function() {\n      scrollView.scrollBy(left, top, !!shouldAnimate);\n    });\n  };\n\n  this.anchorScroll = function(shouldAnimate) {\n    this.resize().then(function() {\n      var hash = $location.hash();\n      var elm = hash && $document[0].getElementById(hash);\n      if (!(hash && elm)) {\n        scrollView.scrollTo(0,0, !!shouldAnimate);\n        return;\n      }\n      var curElm = elm;\n      var scrollLeft = 0, scrollTop = 0, levelsClimbed = 0;\n      do {\n        if(curElm !== null)scrollLeft += curElm.offsetLeft;\n        if(curElm !== null)scrollTop += curElm.offsetTop;\n        curElm = curElm.offsetParent;\n        levelsClimbed++;\n      } while (curElm.attributes != self.element.attributes && curElm.offsetParent);\n      scrollView.scrollTo(scrollLeft, scrollTop, !!shouldAnimate);\n    });\n  };\n\n  this.rememberScrollPosition = function(id) {\n    if (!id) {\n      throw new Error(\"Must supply an id to remember the scroll by!\");\n    }\n    this._rememberScrollId = id;\n  };\n  this.forgetScrollPosition = function() {\n    delete $$scrollValueCache[this._rememberScrollId];\n    this._rememberScrollId = null;\n  };\n  this.scrollToRememberedPosition = function(shouldAnimate) {\n    var values = $$scrollValueCache[this._rememberScrollId];\n    if (values) {\n      this.resize().then(function() {\n        scrollView.scrollTo(+values.left, +values.top, shouldAnimate);\n      });\n    }\n  };\n\n  /**\n   * @private\n   */\n  this._setRefresher = function(refresherScope, refresherElement) {\n    var refresher = this.refresher = refresherElement;\n    var refresherHeight = self.refresher.clientHeight || 0;\n    scrollView.activatePullToRefresh(refresherHeight, function() {\n      // activateCallback\n      refresher.classList.add('active');\n      refresherScope.$onPulling();\n    }, function() {\n      // deactivateCallback\n      $timeout(function(){\n        refresher.classList.remove('active');\n        refresher.classList.remove('refreshing');\n        refresher.classList.add('invisible');\n      },300);\n    }, function() {\n      // startCallback\n      refresher.classList.add('refreshing');\n      refresherScope.$onRefresh();\n    },function(){\n      // showCallback\n      refresher.classList.remove('invisible');\n    },function(){\n      // hideCallback\n      refresher.classList.add('invisible');\n    });\n  };\n}]);\n\n\nIonicModule\n.controller('$ionicSideMenus', [\n  '$scope',\n  '$attrs',\n  '$ionicSideMenuDelegate',\n  '$ionicPlatform',\n  '$ionicBody',\nfunction($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody) {\n  var self = this;\n  var rightShowing, leftShowing, isDragging;\n  var startX, lastX, offsetX, isAsideExposed;\n\n  self.$scope = $scope;\n\n  self.initialize = function(options) {\n    self.left = options.left;\n    self.right = options.right;\n    self.setContent(options.content);\n    self.dragThresholdX = options.dragThresholdX || 10;\n  };\n\n  /**\n   * Set the content view controller if not passed in the constructor options.\n   *\n   * @param {object} content\n   */\n  self.setContent = function(content) {\n    if(content) {\n      self.content = content;\n\n      self.content.onDrag = function(e) {\n        self._handleDrag(e);\n      };\n\n      self.content.endDrag = function(e) {\n        self._endDrag(e);\n      };\n    }\n  };\n\n  self.isOpenLeft = function() {\n    return self.getOpenAmount() > 0;\n  };\n\n  self.isOpenRight = function() {\n    return self.getOpenAmount() < 0;\n  };\n\n  /**\n   * Toggle the left menu to open 100%\n   */\n  self.toggleLeft = function(shouldOpen) {\n    var openAmount = self.getOpenAmount();\n    if (arguments.length === 0) {\n      shouldOpen = openAmount <= 0;\n    }\n    self.content.enableAnimation();\n    if(!shouldOpen) {\n      self.openPercentage(0);\n    } else {\n      self.openPercentage(100);\n    }\n  };\n\n  /**\n   * Toggle the right menu to open 100%\n   */\n  self.toggleRight = function(shouldOpen) {\n    var openAmount = self.getOpenAmount();\n    if (arguments.length === 0) {\n      shouldOpen = openAmount >= 0;\n    }\n    self.content.enableAnimation();\n    if(!shouldOpen) {\n      self.openPercentage(0);\n    } else {\n      self.openPercentage(-100);\n    }\n  };\n\n  /**\n   * Close all menus.\n   */\n  self.close = function() {\n    self.openPercentage(0);\n  };\n\n  /**\n   * @return {float} The amount the side menu is open, either positive or negative for left (positive), or right (negative)\n   */\n  self.getOpenAmount = function() {\n    return self.content && self.content.getTranslateX() || 0;\n  };\n\n  /**\n   * @return {float} The ratio of open amount over menu width. For example, a\n   * menu of width 100 open 50 pixels would be open 50% or a ratio of 0.5. Value is negative\n   * for right menu.\n   */\n  self.getOpenRatio = function() {\n    var amount = self.getOpenAmount();\n    if(amount >= 0) {\n      return amount / self.left.width;\n    }\n    return amount / self.right.width;\n  };\n\n  self.isOpen = function() {\n    return self.getOpenAmount() !== 0;\n  };\n\n  /**\n   * @return {float} The percentage of open amount over menu width. For example, a\n   * menu of width 100 open 50 pixels would be open 50%. Value is negative\n   * for right menu.\n   */\n  self.getOpenPercentage = function() {\n    return self.getOpenRatio() * 100;\n  };\n\n  /**\n   * Open the menu with a given percentage amount.\n   * @param {float} percentage The percentage (positive or negative for left/right) to open the menu.\n   */\n  self.openPercentage = function(percentage) {\n    var p = percentage / 100;\n\n    if(self.left && percentage >= 0) {\n      self.openAmount(self.left.width * p);\n    } else if(self.right && percentage < 0) {\n      var maxRight = self.right.width;\n      self.openAmount(self.right.width * p);\n    }\n\n    // add the CSS class \"menu-open\" if the percentage does not\n    // equal 0, otherwise remove the class from the body element\n    $ionicBody.enableClass( (percentage !== 0), 'menu-open');\n  };\n\n  /**\n   * Open the menu the given pixel amount.\n   * @param {float} amount the pixel amount to open the menu. Positive value for left menu,\n   * negative value for right menu (only one menu will be visible at a time).\n   */\n  self.openAmount = function(amount) {\n    var maxLeft = self.left && self.left.width || 0;\n    var maxRight = self.right && self.right.width || 0;\n\n    // Check if we can move to that side, depending if the left/right panel is enabled\n    if(!(self.left && self.left.isEnabled) && amount > 0) {\n      self.content.setTranslateX(0);\n      return;\n    }\n\n    if(!(self.right && self.right.isEnabled) && amount < 0) {\n      self.content.setTranslateX(0);\n      return;\n    }\n\n    if(leftShowing && amount > maxLeft) {\n      self.content.setTranslateX(maxLeft);\n      return;\n    }\n\n    if(rightShowing && amount < -maxRight) {\n      self.content.setTranslateX(-maxRight);\n      return;\n    }\n\n    self.content.setTranslateX(amount);\n\n    if(amount >= 0) {\n      leftShowing = true;\n      rightShowing = false;\n\n      if(amount > 0) {\n        // Push the z-index of the right menu down\n        self.right && self.right.pushDown && self.right.pushDown();\n        // Bring the z-index of the left menu up\n        self.left && self.left.bringUp && self.left.bringUp();\n      }\n    } else {\n      rightShowing = true;\n      leftShowing = false;\n\n      // Bring the z-index of the right menu up\n      self.right && self.right.bringUp && self.right.bringUp();\n      // Push the z-index of the left menu down\n      self.left && self.left.pushDown && self.left.pushDown();\n    }\n  };\n\n  /**\n   * Given an event object, find the final resting position of this side\n   * menu. For example, if the user \"throws\" the content to the right and\n   * releases the touch, the left menu should snap open (animated, of course).\n   *\n   * @param {Event} e the gesture event to use for snapping\n   */\n  self.snapToRest = function(e) {\n    // We want to animate at the end of this\n    self.content.enableAnimation();\n    isDragging = false;\n\n    // Check how much the panel is open after the drag, and\n    // what the drag velocity is\n    var ratio = self.getOpenRatio();\n\n    if(ratio === 0) {\n      // Just to be safe\n      self.openPercentage(0);\n      return;\n    }\n\n    var velocityThreshold = 0.3;\n    var velocityX = e.gesture.velocityX;\n    var direction = e.gesture.direction;\n\n    // Going right, less than half, too slow (snap back)\n    if(ratio > 0 && ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) {\n      self.openPercentage(0);\n    }\n\n    // Going left, more than half, too slow (snap back)\n    else if(ratio > 0.5 && direction == 'left' && velocityX < velocityThreshold) {\n      self.openPercentage(100);\n    }\n\n    // Going left, less than half, too slow (snap back)\n    else if(ratio < 0 && ratio > -0.5 && direction == 'left' && velocityX < velocityThreshold) {\n      self.openPercentage(0);\n    }\n\n    // Going right, more than half, too slow (snap back)\n    else if(ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) {\n      self.openPercentage(-100);\n    }\n\n    // Going right, more than half, or quickly (snap open)\n    else if(direction == 'right' && ratio >= 0 && (ratio >= 0.5 || velocityX > velocityThreshold)) {\n      self.openPercentage(100);\n    }\n\n    // Going left, more than half, or quickly (span open)\n    else if(direction == 'left' && ratio <= 0 && (ratio <= -0.5 || velocityX > velocityThreshold)) {\n      self.openPercentage(-100);\n    }\n\n    // Snap back for safety\n    else {\n      self.openPercentage(0);\n    }\n  };\n\n  self.isAsideExposed = function() {\n    return !!isAsideExposed;\n  };\n\n  self.exposeAside = function(shouldExposeAside) {\n    isAsideExposed = shouldExposeAside;\n\n    // set the left marget width if it should be exposed\n    // otherwise set false so there's no left margin\n    self.content.setMarginLeft( isAsideExposed ? self.left.width : 0 );\n\n    self.$scope.$emit('$ionicExposeAside', isAsideExposed);\n  };\n\n  self.activeAsideResizing = function(isResizing) {\n    $ionicBody.enableClass(isResizing, 'aside-resizing');\n  };\n\n  // End a drag with the given event\n  self._endDrag = function(e) {\n    if(isAsideExposed) return;\n\n    if(isDragging) {\n      self.snapToRest(e);\n    }\n    startX = null;\n    lastX = null;\n    offsetX = null;\n  };\n\n  // Handle a drag event\n  self._handleDrag = function(e) {\n    if(isAsideExposed) return;\n\n    // If we don't have start coords, grab and store them\n    if(!startX) {\n      startX = e.gesture.touches[0].pageX;\n      lastX = startX;\n    } else {\n      // Grab the current tap coords\n      lastX = e.gesture.touches[0].pageX;\n    }\n\n    // Calculate difference from the tap points\n    if(!isDragging && Math.abs(lastX - startX) > self.dragThresholdX) {\n      // if the difference is greater than threshold, start dragging using the current\n      // point as the starting point\n      startX = lastX;\n\n      isDragging = true;\n      // Initialize dragging\n      self.content.disableAnimation();\n      offsetX = self.getOpenAmount();\n    }\n\n    if(isDragging) {\n      self.openAmount(offsetX + (lastX - startX));\n    }\n  };\n\n  self.canDragContent = function(canDrag) {\n    if (arguments.length) {\n      $scope.dragContent = !!canDrag;\n    }\n    return $scope.dragContent;\n  };\n\n  self.edgeThreshold = 25;\n  self.edgeThresholdEnabled = false;\n  self.edgeDragThreshold = function(value) {\n    if (arguments.length) {\n      if (angular.isNumber(value) && value > 0) {\n        self.edgeThreshold = value;\n        self.edgeThresholdEnabled = true;\n      } else {\n        self.edgeThresholdEnabled = !!value;\n      }\n    }\n    return self.edgeThresholdEnabled;\n  };\n\n  self.isDraggableTarget = function(e) {\n    //Only restrict edge when sidemenu is closed and restriction is enabled\n    var shouldOnlyAllowEdgeDrag = self.edgeThresholdEnabled && !self.isOpen();\n    var startX = e.gesture.startEvent && e.gesture.startEvent.center &&\n      e.gesture.startEvent.center.pageX;\n\n    var dragIsWithinBounds = !shouldOnlyAllowEdgeDrag ||\n      startX <= self.edgeThreshold ||\n      startX >= self.content.offsetWidth - self.edgeThreshold;\n\n    return ($scope.dragContent || self.isOpen()) &&\n           dragIsWithinBounds &&\n           !e.gesture.srcEvent.defaultPrevented &&\n           !e.target.tagName.match(/input|textarea|select|object|embed/i) &&\n           !e.target.isContentEditable &&\n           !(e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll') == 'true');\n  };\n\n  $scope.sideMenuContentTranslateX = 0;\n\n  var deregisterBackButtonAction = angular.noop;\n  var closeSideMenu = angular.bind(self, self.close);\n\n  $scope.$watch(function() {\n    return self.getOpenAmount() !== 0;\n  }, function(isOpen) {\n    deregisterBackButtonAction();\n    if (isOpen) {\n      deregisterBackButtonAction = $ionicPlatform.registerBackButtonAction(\n        closeSideMenu,\n        PLATFORM_BACK_BUTTON_PRIORITY_SIDE_MENU\n      );\n    }\n  });\n\n  var deregisterInstance = $ionicSideMenuDelegate._registerInstance(\n    self, $attrs.delegateHandle\n  );\n\n  $scope.$on('$destroy', function() {\n    deregisterInstance();\n    deregisterBackButtonAction();\n  });\n\n  self.initialize({\n    left: { width: 275 },\n    right: { width: 275 }\n  });\n\n}]);\n\nIonicModule\n.controller('$ionicTab', [\n  '$scope',\n  '$ionicViewService',\n  '$attrs',\n  '$location',\n  '$state',\nfunction($scope, $ionicViewService, $attrs, $location, $state) {\n  this.$scope = $scope;\n\n  //All of these exposed for testing\n  this.hrefMatchesState = function() {\n    return $attrs.href && $location.path().indexOf(\n      $attrs.href.replace(/^#/, '').replace(/\\/$/, '')\n    ) === 0;\n  };\n  this.srefMatchesState = function() {\n    return $attrs.uiSref && $state.includes( $attrs.uiSref.split('(')[0] );\n  };\n  this.navNameMatchesState = function() {\n    return this.navViewName && $ionicViewService.isCurrentStateNavView(this.navViewName);\n  };\n\n  this.tabMatchesState = function() {\n    return this.hrefMatchesState() || this.srefMatchesState() || this.navNameMatchesState();\n  };\n}]);\n\nIonicModule\n.controller('$ionicTabs', [\n  '$scope',\n  '$ionicViewService',\n  '$element',\nfunction($scope, $ionicViewService, $element) {\n  var _selectedTab = null;\n  var self = this;\n  self.tabs = [];\n\n  self.selectedIndex = function() {\n    return self.tabs.indexOf(_selectedTab);\n  };\n  self.selectedTab = function() {\n    return _selectedTab;\n  };\n\n  self.add = function(tab) {\n    $ionicViewService.registerHistory(tab);\n    self.tabs.push(tab);\n    if(self.tabs.length === 1) {\n      self.select(tab);\n    }\n  };\n\n  self.remove = function(tab) {\n    var tabIndex = self.tabs.indexOf(tab);\n    if (tabIndex === -1) {\n      return;\n    }\n    //Use a field like '$tabSelected' so developers won't accidentally set it in controllers etc\n    if (tab.$tabSelected) {\n      self.deselect(tab);\n      //Try to select a new tab if we're removing a tab\n      if (self.tabs.length === 1) {\n        //do nothing if there are no other tabs to select\n      } else {\n        //Select previous tab if it's the last tab, else select next tab\n        var newTabIndex = tabIndex === self.tabs.length - 1 ? tabIndex - 1 : tabIndex + 1;\n        self.select(self.tabs[newTabIndex]);\n      }\n    }\n    self.tabs.splice(tabIndex, 1);\n  };\n\n  self.deselect = function(tab) {\n    if (tab.$tabSelected) {\n      _selectedTab = null;\n      tab.$tabSelected = false;\n      (tab.onDeselect || angular.noop)();\n    }\n  };\n\n  self.select = function(tab, shouldEmitEvent) {\n    var tabIndex;\n    if (angular.isNumber(tab)) {\n      tabIndex = tab;\n      tab = self.tabs[tabIndex];\n    } else {\n      tabIndex = self.tabs.indexOf(tab);\n    }\n\n    if (arguments.length === 1) {\n      shouldEmitEvent = !!(tab.navViewName || tab.uiSref);\n    }\n\n    if (_selectedTab && _selectedTab.$historyId == tab.$historyId) {\n      if (shouldEmitEvent) {\n        $ionicViewService.goToHistoryRoot(tab.$historyId);\n      }\n    } else {\n      forEach(self.tabs, function(tab) {\n        self.deselect(tab);\n      });\n\n      _selectedTab = tab;\n      //Use a funny name like $tabSelected so the developer doesn't overwrite the var in a child scope\n      tab.$tabSelected = true;\n      (tab.onSelect || angular.noop)();\n\n      if (shouldEmitEvent) {\n        var viewData = {\n          type: 'tab',\n          tabIndex: tabIndex,\n          historyId: tab.$historyId,\n          navViewName: tab.navViewName,\n          hasNavView: !!tab.navViewName,\n          title: tab.title,\n          url: tab.href,\n          uiSref: tab.uiSref\n        };\n        $scope.$emit('viewState.changeHistory', viewData);\n      }\n    }\n  };\n}]);\n\n\n/*\n * We don't document the ionActionSheet directive, we instead document\n * the $ionicActionSheet service\n */\nIonicModule\n.directive('ionActionSheet', ['$document', function($document) {\n  return {\n    restrict: 'E',\n    scope: true,\n    replace: true,\n    link: function($scope, $element){\n      var keyUp = function(e) {\n        if(e.which == 27) {\n          $scope.cancel();\n          $scope.$apply();\n        }\n      };\n\n      var backdropClick = function(e) {\n        if(e.target == $element[0]) {\n          $scope.cancel();\n          $scope.$apply();\n        }\n      };\n      $scope.$on('$destroy', function() {\n        $element.remove();\n        $document.unbind('keyup', keyUp);\n      });\n\n      $document.bind('keyup', keyUp);\n      $element.bind('click', backdropClick);\n    },\n    template: '<div class=\"action-sheet-backdrop\">' +\n                '<div class=\"action-sheet-wrapper\">' +\n                  '<div class=\"action-sheet\">' +\n                    '<div class=\"action-sheet-group\">' +\n                      '<div class=\"action-sheet-title\" ng-if=\"titleText\" ng-bind-html=\"titleText\"></div>' +\n                      '<button class=\"button\" ng-click=\"buttonClicked($index)\" ng-repeat=\"button in buttons\" ng-bind-html=\"button.text\"></button>' +\n                    '</div>' +\n                    '<div class=\"action-sheet-group\" ng-if=\"destructiveText\">' +\n                      '<button class=\"button destructive\" ng-click=\"destructiveButtonClicked()\" ng-bind-html=\"destructiveText\"></button>' +\n                    '</div>' +\n                    '<div class=\"action-sheet-group\" ng-if=\"cancelText\">' +\n                      '<button class=\"button\" ng-click=\"cancel()\" ng-bind-html=\"cancelText\"></button>' +\n                    '</div>' +\n                  '</div>' +\n                '</div>' +\n              '</div>'\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionCheckbox\n * @module ionic\n * @restrict E\n * @codepen hqcju\n * @description\n * The checkbox is no different than the HTML checkbox input, except it's styled differently.\n *\n * The checkbox behaves like any [AngularJS checkbox](http://docs.angularjs.org/api/ng/input/input[checkbox]).\n *\n * @usage\n * ```html\n * <ion-checkbox ng-model=\"isChecked\">Checkbox Label</ion-checkbox>\n * ```\n */\n\nIonicModule\n.directive('ionCheckbox', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<label class=\"item item-checkbox\">' +\n        '<div class=\"checkbox checkbox-input-hidden disable-pointer-events\">' +\n          '<input type=\"checkbox\">' +\n          '<i class=\"checkbox-icon\"></i>' +\n        '</div>' +\n        '<div class=\"item-content disable-pointer-events\" ng-transclude></div>' +\n      '</label>',\n    compile: function(element, attr) {\n      var input = element.find('input');\n      forEach({\n        'name': attr.name,\n        'ng-value': attr.ngValue,\n        'ng-model': attr.ngModel,\n        'ng-checked': attr.ngChecked,\n        'ng-disabled': attr.ngDisabled,\n        'ng-true-value': attr.ngTrueValue,\n        'ng-false-value': attr.ngFalseValue,\n        'ng-change': attr.ngChange\n      }, function(value, name) {\n        if (isDefined(value)) {\n          input.attr(name, value);\n        }\n      });\n    }\n\n  };\n});\n\n/**\n * @ngdoc directive\n * @module ionic\n * @name collectionRepeat\n * @restrict A\n * @codepen mFygh\n * @description\n * `collection-repeat` is a directive that allows you to render lists with\n * thousands of items in them, and experience little to no performance penalty.\n *\n * Demo:\n *\n * The directive renders onto the screen only the items that should be currently visible.\n * So if you have 1,000 items in your list but only ten fit on your screen,\n * collection-repeat will only render into the DOM the ten that are in the current\n * scroll position.\n *\n * Here are a few things to keep in mind while using collection-repeat:\n *\n * 1. The data supplied to collection-repeat must be an array.\n * 2. You must explicitly tell the directive what size your items will be in the DOM, using directive attributes.\n * Pixel amounts or percentages are allowed (see below).\n * 3. The elements rendered will be absolutely positioned: be sure to let your CSS work with\n * this (see below).\n * 4. Each collection-repeat list will take up all of its parent scrollView's space.\n * If you wish to have multiple lists on one page, put each list within its own\n * {@link ionic.directive:ionScroll ionScroll} container.\n * 5. You should not use the ng-show and ng-hide directives on your ion-content/ion-scroll elements that\n * have a collection-repeat inside.  ng-show and ng-hide apply the `display: none` css rule to the content's\n * style, causing the scrollView to read the width and height of the content as 0.  Resultingly,\n * collection-repeat will render elements that have just been un-hidden incorrectly.\n *\n *\n * @usage\n *\n * #### Basic Usage (single rows of items)\n *\n * Notice two things here: we use ng-style to set the height of the item to match\n * what the repeater thinks our item height is.  Additionally, we add a css rule\n * to make our item stretch to fit the full screen (since it will be absolutely\n * positioned).\n *\n * ```html\n * <ion-content ng-controller=\"ContentCtrl\">\n *   <div class=\"list\">\n *     <div class=\"item my-item\"\n *       collection-repeat=\"item in items\"\n *       collection-item-width=\"'100%'\"\n *       collection-item-height=\"getItemHeight(item, $index)\"\n *       ng-style=\"{height: getItemHeight(item, $index)}\">\n *       {% raw %}{{item}}{% endraw %}\n *     </div>\n *   </div>\n * </div>\n * ```\n * ```js\n * function ContentCtrl($scope) {\n *   $scope.items = [];\n *   for (var i = 0; i < 1000; i++) {\n *     $scope.items.push('Item ' + i);\n *   }\n *\n *   $scope.getItemHeight = function(item, index) {\n *     //Make evenly indexed items be 10px taller, for the sake of example\n *     return (index % 2) === 0 ? 50 : 60;\n *   };\n * }\n * ```\n * ```css\n * .my-item {\n *   left: 0;\n *   right: 0;\n * }\n * ```\n *\n * #### Grid Usage (three items per row)\n *\n * ```html\n * <ion-content>\n *   <div class=\"item item-avatar my-image-item\"\n *     collection-repeat=\"image in images\"\n *     collection-item-width=\"'33%'\"\n *     collection-item-height=\"'33%'\">\n *     <img ng-src=\"{{image.src}}\">\n *   </div>\n * </ion-content>\n * ```\n * Percentage of total visible list dimensions. This example shows a 3 by 3 matrix that fits on the screen (3 rows and 3 colums). Note that dimensions are used in the creation of the element and therefore a measurement of the item cannnot be used as an input dimension.\n * ```css\n * .my-image-item img {\n *   height: 33%;\n *   width: 33%;\n * }\n * ```\n *\n * @param {expression} collection-repeat The expression indicating how to enumerate a collection. These\n *   formats are currently supported:\n *\n *   * `variable in expression` – where variable is the user defined loop variable and `expression`\n *     is a scope expression giving the collection to enumerate.\n *\n *     For example: `album in artist.albums`.\n *\n *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking function\n *     which can be used to associate the objects in the collection with the DOM elements. If no tracking function\n *     is specified the collection-repeat associates elements by identity in the collection. It is an error to have\n *     more than one tracking function to resolve to the same key. (This would mean that two distinct objects are\n *     mapped to the same DOM element, which is not possible.)  Filters should be applied to the expression,\n *     before specifying a tracking expression.\n *\n *     For example: `item in items` is equivalent to `item in items track by $id(item)'. This implies that the DOM elements\n *     will be associated by item identity in the array.\n *\n *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique\n *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements\n *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM\n *     element in the same way in the DOM.\n *\n *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this\n *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`\n *     property is same.\n *\n *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter\n *     to items in conjunction with a tracking expression.\n *\n * @param {expression} collection-item-width The width of the repeated element.  Can be a number (in pixels) or a percentage.\n * @param {expression} collection-item-height The height of the repeated element.  Can be a number (in pixels), or a percentage.\n *\n */\nvar COLLECTION_REPEAT_SCROLLVIEW_XY_ERROR = \"Cannot create a collection-repeat within a scrollView that is scrollable on both x and y axis.  Choose either x direction or y direction.\";\nvar COLLECTION_REPEAT_ATTR_HEIGHT_ERROR = \"collection-repeat expected attribute collection-item-height to be a an expression that returns a number (in pixels) or percentage.\";\nvar COLLECTION_REPEAT_ATTR_WIDTH_ERROR = \"collection-repeat expected attribute collection-item-width to be a an expression that returns a number (in pixels) or percentage.\";\nvar COLLECTION_REPEAT_ATTR_REPEAT_ERROR = \"collection-repeat expected expression in form of '_item_ in _collection_[ track by _id_]' but got '%'\";\n\nIonicModule\n.directive('collectionRepeat', [\n  '$collectionRepeatManager',\n  '$collectionDataSource',\n  '$parse',\nfunction($collectionRepeatManager, $collectionDataSource, $parse) {\n  return {\n    priority: 1000,\n    transclude: 'element',\n    terminal: true,\n    $$tlb: true,\n    require: '^$ionicScroll',\n    controller: [function(){}],\n    link: function($scope, $element, $attr, scrollCtrl, $transclude) {\n      var wrap = jqLite('<div style=\"position:relative;\">');\n      $element.parent()[0].insertBefore(wrap[0], $element[0]);\n      wrap.append($element);\n\n      var scrollView = scrollCtrl.scrollView;\n      if (scrollView.options.scrollingX && scrollView.options.scrollingY) {\n        throw new Error(COLLECTION_REPEAT_SCROLLVIEW_XY_ERROR);\n      }\n\n      var isVertical = !!scrollView.options.scrollingY;\n      if (isVertical && !$attr.collectionItemHeight) {\n        throw new Error(COLLECTION_REPEAT_ATTR_HEIGHT_ERROR);\n      } else if (!isVertical && !$attr.collectionItemWidth) {\n        throw new Error(COLLECTION_REPEAT_ATTR_WIDTH_ERROR);\n      }\n\n      var heightParsed = $parse($attr.collectionItemHeight || '\"100%\"');\n      var widthParsed = $parse($attr.collectionItemWidth || '\"100%\"');\n\n      var heightGetter = function(scope, locals) {\n        var result = heightParsed(scope, locals);\n        if (isString(result) && result.indexOf('%') > -1) {\n          return Math.floor(parseInt(result, 10) / 100 * scrollView.__clientHeight);\n        }\n        return result;\n      };\n      var widthGetter = function(scope, locals) {\n        var result = widthParsed(scope, locals);\n        if (isString(result) && result.indexOf('%') > -1) {\n          return Math.floor(parseInt(result, 10) / 100 * scrollView.__clientWidth);\n        }\n        return result;\n      };\n\n      var match = $attr.collectionRepeat.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n      if (!match) {\n        throw new Error(COLLECTION_REPEAT_ATTR_REPEAT_ERROR\n                        .replace('%', $attr.collectionRepeat));\n      }\n      var keyExpr = match[1];\n      var listExpr = match[2];\n      var trackByExpr = match[3];\n\n      var dataSource = new $collectionDataSource({\n        scope: $scope,\n        transcludeFn: $transclude,\n        transcludeParent: $element.parent(),\n        keyExpr: keyExpr,\n        listExpr: listExpr,\n        trackByExpr: trackByExpr,\n        heightGetter: heightGetter,\n        widthGetter: widthGetter\n      });\n      var collectionRepeatManager = new $collectionRepeatManager({\n        dataSource: dataSource,\n        element: scrollCtrl.$element,\n        scrollView: scrollCtrl.scrollView,\n      });\n\n      $scope.$watchCollection(listExpr, function(value) {\n        if (value && !angular.isArray(value)) {\n          throw new Error(\"collection-repeat expects an array to repeat over, but instead got '\" + typeof value + \"'.\");\n        }\n        rerender(value);\n      });\n\n      // Find every sibling before and after the repeated items, and pass them\n      // to the dataSource\n      var scrollViewContent = scrollCtrl.scrollView.__content;\n      function rerender(value) {\n        var beforeSiblings = [];\n        var afterSiblings = [];\n        var before = true;\n\n        forEach(scrollViewContent.children, function(node, i) {\n          if ( ionic.DomUtil.elementIsDescendant($element[0], node, scrollViewContent) ) {\n            before = false;\n          } else {\n            if (node.hasAttribute('collection-repeat-ignore')) return;\n            var width = node.offsetWidth;\n            var height = node.offsetHeight;\n            if (width && height) {\n              var element = jqLite(node);\n              (before ? beforeSiblings : afterSiblings).push({\n                width: node.offsetWidth,\n                height: node.offsetHeight,\n                element: element,\n                scope: element.isolateScope() || element.scope(),\n                isOutside: true\n              });\n            }\n          }\n        });\n\n        scrollView.resize();\n        dataSource.setData(value, beforeSiblings, afterSiblings);\n        collectionRepeatManager.resize();\n      }\n      function rerenderOnResize() {\n        rerender($scope.$eval(listExpr));\n      }\n\n      scrollCtrl.$element.on('scroll.resize', rerenderOnResize);\n      ionic.on('resize', rerenderOnResize, window);\n\n      $scope.$on('$destroy', function() {\n        collectionRepeatManager.destroy();\n        dataSource.destroy();\n        ionic.off('resize', rerenderOnResize, window);\n      });\n    }\n  };\n}])\n.directive({\n  ngSrc: collectionRepeatSrcDirective('ngSrc', 'src'),\n  ngSrcset: collectionRepeatSrcDirective('ngSrcset', 'srcset'),\n  ngHref: collectionRepeatSrcDirective('ngHref', 'href')\n});\n\n// Fix for #1674\n// Problem: if an ngSrc or ngHref expression evaluates to a falsy value, it will\n// not erase the previous truthy value of the href.\n// In collectionRepeat, we re-use elements from before. So if the ngHref expression\n// evaluates to truthy for item 1 and then falsy for item 2, if an element changes\n// from representing item 1 to representing item 2, item 2 will still have\n// item 1's href value.\n// Solution:  erase the href or src attribute if ngHref/ngSrc are falsy.\nfunction collectionRepeatSrcDirective(ngAttrName, attrName) {\n  return [function() {\n    return {\n      priority: '99', // it needs to run after the attributes are interpolated\n      link: function(scope, element, attr) {\n        attr.$observe(ngAttrName, function(value) {\n          if (!value) {\n            element[0].removeAttribute(attrName);\n          }\n        });\n      }\n    };\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ionContent\n * @module ionic\n * @delegate ionic.service:$ionicScrollDelegate\n * @restrict E\n *\n * @description\n * The ionContent directive provides an easy to use content area that can be configured\n * to use Ionic's custom Scroll View, or the built in overflow scrolling of the browser.\n *\n * While we recommend using the custom Scroll features in Ionic in most cases, sometimes\n * (for performance reasons) only the browser's native overflow scrolling will suffice,\n * and so we've made it easy to toggle between the Ionic scroll implementation and\n * overflow scrolling.\n *\n * You can implement pull-to-refresh with the {@link ionic.directive:ionRefresher}\n * directive, and infinite scrolling with the {@link ionic.directive:ionInfiniteScroll}\n * directive.\n *\n * Be aware that this directive gets its own child scope. If you do not understand why this\n * is important, you can read [https://docs.angularjs.org/guide/scope](https://docs.angularjs.org/guide/scope).\n *\n * @param {string=} delegate-handle The handle used to identify this scrollView\n * with {@link ionic.service:$ionicScrollDelegate}.\n * @param {string=} direction Which way to scroll. 'x' or 'y' or 'xy'. Default 'y'.\n * @param {boolean=} locking Whether to lock scrolling in one direction at a time. Useful to set to false when zoomed in or scrolling in two directions. Default true.\n * @param {boolean=} padding Whether to add padding to the content.\n * of the content.  Defaults to true on iOS, false on Android.\n * @param {boolean=} scroll Whether to allow scrolling of content.  Defaults to true.\n * @param {boolean=} overflow-scroll Whether to use overflow-scrolling instead of\n * Ionic scroll.\n * @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.\n * @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.\n * @param {string=} start-y Initial vertical scroll position. Default 0.\n * of the content.  Defaults to true on iOS, false on Android.\n * @param {expression=} on-scroll Expression to evaluate when the content is scrolled.\n * @param {expression=} on-scroll-complete Expression to evaluate when a scroll action completes.\n * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges\n * of the content.  Defaults to true on iOS, false on Android.\n */\nIonicModule\n.directive('ionContent', [\n  '$timeout',\n  '$controller',\n  '$ionicBind',\nfunction($timeout, $controller, $ionicBind) {\n  return {\n    restrict: 'E',\n    require: '^?ionNavView',\n    scope: true,\n    priority: 800,\n    compile: function(element, attr) {\n      var innerElement;\n\n      element.addClass('scroll-content ionic-scroll');\n\n      if (attr.scroll != 'false') {\n        //We cannot use normal transclude here because it breaks element.data()\n        //inheritance on compile\n        innerElement = jqLite('<div class=\"scroll\"></div>');\n        innerElement.append(element.contents());\n        element.append(innerElement);\n      } else {\n        element.addClass('scroll-content-false');\n      }\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, navViewCtrl) {\n        var parentScope = $scope.$parent;\n        $scope.$watch(function() {\n          return (parentScope.$hasHeader ? ' has-header' : '')  +\n            (parentScope.$hasSubheader ? ' has-subheader' : '') +\n            (parentScope.$hasFooter ? ' has-footer' : '') +\n            (parentScope.$hasSubfooter ? ' has-subfooter' : '') +\n            (parentScope.$hasTabs ? ' has-tabs' : '') +\n            (parentScope.$hasTabsTop ? ' has-tabs-top' : '');\n        }, function(className, oldClassName) {\n          $element.removeClass(oldClassName);\n          $element.addClass(className);\n        });\n\n        //Only this ionContent should use these variables from parent scopes\n        $scope.$hasHeader = $scope.$hasSubheader =\n          $scope.$hasFooter = $scope.$hasSubfooter =\n          $scope.$hasTabs = $scope.$hasTabsTop =\n          false;\n        $ionicBind($scope, $attr, {\n          $onScroll: '&onScroll',\n          $onScrollComplete: '&onScrollComplete',\n          hasBouncing: '@',\n          padding: '@',\n          direction: '@',\n          scrollbarX: '@',\n          scrollbarY: '@',\n          startX: '@',\n          startY: '@',\n          scrollEventInterval: '@'\n        });\n        $scope.direction = $scope.direction || 'y';\n\n        if (angular.isDefined($attr.padding)) {\n          $scope.$watch($attr.padding, function(newVal) {\n              (innerElement || $element).toggleClass('padding', !!newVal);\n          });\n        }\n\n        if ($attr.scroll === \"false\") {\n          //do nothing\n        } else if(attr.overflowScroll === \"true\") {\n          $element.addClass('overflow-scroll');\n        } else {\n          var scrollViewOptions = {\n            el: $element[0],\n            delegateHandle: attr.delegateHandle,\n            locking: (attr.locking || 'true') === 'true',\n            bouncing: $scope.$eval($scope.hasBouncing),\n            startX: $scope.$eval($scope.startX) || 0,\n            startY: $scope.$eval($scope.startY) || 0,\n            scrollbarX: $scope.$eval($scope.scrollbarX) !== false,\n            scrollbarY: $scope.$eval($scope.scrollbarY) !== false,\n            scrollingX: $scope.direction.indexOf('x') >= 0,\n            scrollingY: $scope.direction.indexOf('y') >= 0,\n            scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 10,\n            scrollingComplete: function() {\n              $scope.$onScrollComplete({\n                scrollTop: this.__scrollTop,\n                scrollLeft: this.__scrollLeft\n              });\n            }\n          };\n          $controller('$ionicScroll', {\n            $scope: $scope,\n            scrollViewOptions: scrollViewOptions\n          });\n\n          $scope.$on('$destroy', function() {\n            scrollViewOptions.scrollingComplete = angular.noop;\n            delete scrollViewOptions.el;\n            innerElement = null;\n            $element = null;\n            attr.$$element = null;\n          });\n        }\n\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name exposeAsideWhen\n * @module ionic\n * @restrict A\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * It is common for a tablet application to hide a menu when in portrait mode, but to show the\n * same menu on the left side when the tablet is in landscape mode. The `exposeAsideWhen` attribute\n * directive can be used to accomplish a similar interface.\n *\n * By default, side menus are hidden underneath its side menu content, and can be opened by either\n * swiping the content left or right, or toggling a button to show the side menu. However, by adding the\n * `exposeAsideWhen` attribute directive to an {@link ionic.directive:ionSideMenu} element directive,\n * a side menu can be given instructions on \"when\" the menu should be exposed (always viewable). For\n * example, the `expose-aside-when=\"large\"` attribute will keep the side menu hidden when the viewport's\n * width is less than `768px`, but when the viewport's width is `768px` or greater, the menu will then\n * always be shown and can no longer be opened or closed like it could when it was hidden for smaller\n * viewports.\n *\n * Using `large` as the attribute's value is a shortcut value to `(min-width:768px)` since it is\n * the most common use-case. However, for added flexibility, any valid media query could be added\n * as the value, such as `(min-width:600px)` or even multiple queries such as\n * `(min-width:750px) and (max-width:1200px)`.\n\n * @usage\n * ```html\n * <ion-side-menus>\n *   <!-- Center content -->\n *   <ion-side-menu-content>\n *   </ion-side-menu-content>\n *\n *   <!-- Left menu -->\n *   <ion-side-menu expose-aside-when=\"large\">\n *   </ion-side-menu>\n * </ion-side-menus>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n */\nIonicModule\n.directive('exposeAsideWhen', ['$window', function($window) {\n  return {\n    restrict: 'A',\n    require: '^ionSideMenus',\n    link: function($scope, $element, $attr, sideMenuCtrl) {\n\n      function checkAsideExpose() {\n        var mq = $attr.exposeAsideWhen == 'large' ? '(min-width:768px)' : $attr.exposeAsideWhen;\n        sideMenuCtrl.exposeAside( $window.matchMedia(mq).matches );\n        sideMenuCtrl.activeAsideResizing(false);\n      }\n\n      function onResize() {\n        sideMenuCtrl.activeAsideResizing(true);\n        debouncedCheck();\n      }\n\n      var debouncedCheck = ionic.debounce(function() {\n        $scope.$apply(function(){\n          checkAsideExpose();\n        });\n      }, 300, false);\n\n      checkAsideExpose();\n\n      ionic.on('resize', onResize, $window);\n\n      $scope.$on('$destroy', function(){\n        ionic.off('resize', onResize, $window);\n      });\n\n    }\n  };\n}]);\n\n\nvar GESTURE_DIRECTIVES = 'onHold onTap onTouch onRelease onDrag onDragUp onDragRight onDragDown onDragLeft onSwipe onSwipeUp onSwipeRight onSwipeDown onSwipeLeft'.split(' ');\n\nGESTURE_DIRECTIVES.forEach(function(name) {\n  IonicModule.directive(name, gestureDirective(name));\n});\n\n\n/**\n * @ngdoc directive\n * @name onHold\n * @module ionic\n * @restrict A\n *\n * @description\n * Touch stays at the same location for 500ms.\n *\n * @usage\n * ```html\n * <button on-hold=\"onHold()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onTap\n * @module ionic\n * @restrict A\n *\n * @description\n * Quick touch at a location. If the duration of the touch goes\n * longer than 250ms it is no longer a tap gesture.\n *\n * @usage\n * ```html\n * <button on-tap=\"onTap()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onTouch\n * @module ionic\n * @restrict A\n *\n * @description\n * Called immediately when the user first begins a touch. This\n * gesture does not wait for a touchend/mouseup.\n *\n * @usage\n * ```html\n * <button on-touch=\"onTouch()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onRelease\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the user ends a touch.\n *\n * @usage\n * ```html\n * <button on-release=\"onRelease()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDrag\n * @module ionic\n * @restrict A\n *\n * @description\n * Move with one touch around on the page. Blocking the scrolling when\n * moving left and right is a good practice. When all the drag events are\n * blocking you disable scrolling on that area.\n *\n * @usage\n * ```html\n * <button on-drag=\"onDrag()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragUp\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged up.\n *\n * @usage\n * ```html\n * <button on-drag-up=\"onDragUp()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragRight\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged to the right.\n *\n * @usage\n * ```html\n * <button on-drag-right=\"onDragRight()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragDown\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged down.\n *\n * @usage\n * ```html\n * <button on-drag-down=\"onDragDown()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragLeft\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged to the left.\n *\n * @usage\n * ```html\n * <button on-drag-left=\"onDragLeft()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipe\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity in any direction.\n *\n * @usage\n * ```html\n * <button on-swipe=\"onSwipe()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeUp\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving up.\n *\n * @usage\n * ```html\n * <button on-swipe-up=\"onSwipeUp()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeRight\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving to the right.\n *\n * @usage\n * ```html\n * <button on-swipe-right=\"onSwipeRight()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeDown\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving down.\n *\n * @usage\n * ```html\n * <button on-swipe-down=\"onSwipeDown()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeLeft\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving to the left.\n *\n * @usage\n * ```html\n * <button on-swipe-left=\"onSwipeLeft()\" class=\"button\">Test</button>\n * ```\n */\n\n\nfunction gestureDirective(directiveName) {\n  return ['$ionicGesture', '$parse', function($ionicGesture, $parse) {\n    var eventType = directiveName.substr(2).toLowerCase();\n\n    return function(scope, element, attr) {\n      var fn = $parse( attr[directiveName] );\n\n      var listener = function(ev) {\n        scope.$apply(function() {\n          fn(scope, {\n            $event: ev\n          });\n        });\n      };\n\n      var gesture = $ionicGesture.on(eventType, listener, element);\n\n      scope.$on('$destroy', function() {\n        $ionicGesture.off(gesture, eventType, listener);\n      });\n    };\n  }];\n}\n\n\nIonicModule\n.directive('ionNavBar', tapScrollToTopDirective())\n.directive('ionHeaderBar', tapScrollToTopDirective())\n\n/**\n * @ngdoc directive\n * @name ionHeaderBar\n * @module ionic\n * @restrict E\n *\n * @description\n * Adds a fixed header bar above some content.\n *\n * Can also be a subheader (lower down) if the 'bar-subheader' class is applied.\n * See [the header CSS docs](/docs/components/#subheader).\n *\n * Note: If you use ionHeaderBar in combination with ng-if, the surrounding content\n * will not align correctly.  This will be fixed soon.\n *\n * @param {string=} align-title Where to align the title. \n * Available: 'left', 'right', or 'center'.  Defaults to 'center'.\n * @param {boolean=} no-tap-scroll By default, the header bar will scroll the\n * content to the top when tapped.  Set no-tap-scroll to true to disable this \n * behavior.\n * Available: true or false.  Defaults to false.\n *\n * @usage\n * ```html\n * <ion-header-bar align-title=\"left\" class=\"bar-positive\">\n *   <div class=\"buttons\">\n *     <button class=\"button\" ng-click=\"doSomething()\">Left Button</button>\n *   </div>\n *   <h1 class=\"title\">Title!</h1>\n *   <div class=\"buttons\">\n *     <button class=\"button\">Right Button</button>\n *   </div>\n * </ion-header-bar>\n * <ion-content>\n *   Some content!\n * </ion-content>\n * ```\n */\n.directive('ionHeaderBar', headerFooterBarDirective(true))\n\n/**\n * @ngdoc directive\n * @name ionFooterBar\n * @module ionic\n * @restrict E\n *\n * @description\n * Adds a fixed footer bar below some content.\n *\n * Can also be a subfooter (higher up) if the 'bar-subfooter' class is applied.\n * See [the footer CSS docs](/docs/components/#footer).\n *\n * Note: If you use ionFooterBar in combination with ng-if, the surrounding content\n * will not align correctly.  This will be fixed soon.\n *\n * @param {string=} align-title Where to align the title.\n * Available: 'left', 'right', or 'center'.  Defaults to 'center'.\n *\n * @usage\n * ```html\n * <ion-content>\n *   Some content!\n * </ion-content>\n * <ion-footer-bar align-title=\"left\" class=\"bar-assertive\">\n *   <div class=\"buttons\">\n *     <button class=\"button\">Left Button</button>\n *   </div>\n *   <h1 class=\"title\">Title!</h1>\n *   <div class=\"buttons\" ng-click=\"doSomething()\">\n *     <button class=\"button\">Right Button</button>\n *   </div>\n * </ion-footer-bar>\n * ```\n */\n.directive('ionFooterBar', headerFooterBarDirective(false));\n\nfunction tapScrollToTopDirective() {\n  return ['$ionicScrollDelegate', function($ionicScrollDelegate) {\n    return {\n      restrict: 'E',\n      link: function($scope, $element, $attr) {\n        if ($attr.noTapScroll == 'true') {\n          return;\n        }\n        ionic.on('tap', onTap, $element[0]);\n        $scope.$on('$destroy', function() {\n          ionic.off('tap', onTap, $element[0]);\n        });\n\n        function onTap(e) {\n          var depth = 3;\n          var current = e.target;\n          //Don't scroll to top in certain cases\n          while (depth-- && current) {\n            if (current.classList.contains('button') ||\n                current.tagName.match(/input|textarea|select/i) ||\n                current.isContentEditable) {\n              return;\n            }\n            current = current.parentNode;\n          }\n          var touch = e.gesture && e.gesture.touches[0] || e.detail.touches[0];\n          var bounds = $element[0].getBoundingClientRect();\n          if (ionic.DomUtil.rectContains(\n            touch.pageX, touch.pageY,\n            bounds.left, bounds.top - 20,\n            bounds.left + bounds.width, bounds.top + bounds.height\n          )) {\n            $ionicScrollDelegate.scrollTop(true);\n          }\n        }\n      }\n    };\n  }];\n}\n\nfunction headerFooterBarDirective(isHeader) {\n  return [function() {\n    return {\n      restrict: 'E',\n      compile: function($element, $attr) {\n        $element.addClass(isHeader ? 'bar bar-header' : 'bar bar-footer');\n        var parent = $element[0].parentNode;\n        if(parent.querySelector('.tabs-top'))$element.addClass('has-tabs-top');\n        return { pre: prelink };\n        function prelink($scope, $element, $attr) {\n          var hb = new ionic.views.HeaderBar({\n            el: $element[0],\n            alignTitle: $attr.alignTitle || 'center'\n          });\n\n          var el = $element[0];\n\n          if (isHeader) {\n            $scope.$watch(function() { return el.className; }, function(value) {\n              var isShown = value.indexOf('ng-hide') === -1;\n              var isSubheader = value.indexOf('bar-subheader') !== -1;\n              $scope.$hasHeader = isShown && !isSubheader;\n              $scope.$hasSubheader = isShown && isSubheader;\n            });\n            $scope.$on('$destroy', function() {\n              delete $scope.$hasHeader;\n              delete $scope.$hasSubheader;\n            });\n          } else {\n            $scope.$watch(function() { return el.className; }, function(value) {\n              var isShown = value.indexOf('ng-hide') === -1;\n              var isSubfooter = value.indexOf('bar-subfooter') !== -1;\n              $scope.$hasFooter = isShown && !isSubfooter;\n              $scope.$hasSubfooter = isShown && isSubfooter;\n            });\n            $scope.$on('$destroy', function() {\n              delete $scope.$hasFooter;\n              delete $scope.$hasSubfooter;\n            });\n            $scope.$watch('$hasTabs', function(val) {\n              $element.toggleClass('has-tabs', !!val);\n            });\n          }\n        }\n      }\n    };\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ionInfiniteScroll\n * @module ionic\n * @parent ionic.directive:ionContent, ionic.directive:ionScroll\n * @restrict E\n *\n * @description\n * The ionInfiniteScroll directive allows you to call a function whenever\n * the user gets to the bottom of the page or near the bottom of the page.\n *\n * The expression you pass in for `on-infinite` is called when the user scrolls\n * greater than `distance` away from the bottom of the content.  Once `on-infinite`\n * is done loading new data, it should broadcast the `scroll.infiniteScrollComplete`\n * event from your controller (see below example).\n *\n * @param {expression} on-infinite What to call when the scroller reaches the\n * bottom.\n * @param {string=} distance The distance from the bottom that the scroll must\n * reach to trigger the on-infinite expression. Default: 1%.\n * @param {string=} icon The icon to show while loading. Default: 'ion-loading-d'.\n *\n * @usage\n * ```html\n * <ion-content ng-controller=\"MyController\">\n *   <ion-list>\n *   ....\n *   ....\n *   </ion-list>\n *\n *   <ion-infinite-scroll\n *     on-infinite=\"loadMore()\"\n *     distance=\"1%\">\n *   </ion-infinite-scroll>\n * </ion-content>\n * ```\n * ```js\n * function MyController($scope, $http) {\n *   $scope.items = [];\n *   $scope.loadMore = function() {\n *     $http.get('/more-items').success(function(items) {\n *       useItems(items);\n *       $scope.$broadcast('scroll.infiniteScrollComplete');\n *     });\n *   };\n *\n *   $scope.$on('stateChangeSuccess', function() {\n *     $scope.loadMore();\n *   });\n * }\n * ```\n *\n * An easy to way to stop infinite scroll once there is no more data to load\n * is to use angular's `ng-if` directive:\n *\n * ```html\n * <ion-infinite-scroll\n *   ng-if=\"moreDataCanBeLoaded()\"\n *   icon=\"ion-loading-c\"\n *   on-infinite=\"loadMoreData()\">\n * </ion-infinite-scroll>\n * ```\n */\nIonicModule\n.directive('ionInfiniteScroll', ['$timeout', function($timeout) {\n  function calculateMaxValue(distance, maximum, isPercent) {\n    return isPercent ?\n      maximum * (1 - parseFloat(distance,10) / 100) :\n      maximum - parseFloat(distance, 10);\n  }\n  return {\n    restrict: 'E',\n    require: ['^$ionicScroll', 'ionInfiniteScroll'],\n    template: '<i class=\"icon {{icon()}} icon-refreshing\"></i>',\n    scope: true,\n    controller: ['$scope', '$attrs', function($scope, $attrs) {\n      this.isLoading = false;\n      this.scrollView = null; //given by link function\n      this.getMaxScroll = function() {\n        var distance = ($attrs.distance || '2.5%').trim();\n        var isPercent = distance.indexOf('%') !== -1;\n        var maxValues = this.scrollView.getScrollMax();\n        return {\n          left: this.scrollView.options.scrollingX ?\n            calculateMaxValue(distance, maxValues.left, isPercent) :\n            -1,\n          top: this.scrollView.options.scrollingY ?\n            calculateMaxValue(distance, maxValues.top, isPercent) :\n            -1\n        };\n      };\n    }],\n    link: function($scope, $element, $attrs, ctrls) {\n      var scrollCtrl = ctrls[0];\n      var infiniteScrollCtrl = ctrls[1];\n      var scrollView = infiniteScrollCtrl.scrollView = scrollCtrl.scrollView;\n\n      $scope.icon = function() {\n        return angular.isDefined($attrs.icon) ? $attrs.icon : 'ion-loading-d';\n      };\n\n      var onInfinite = function() {\n        $element[0].classList.add('active');\n        infiniteScrollCtrl.isLoading = true;\n        $scope.$parent && $scope.$parent.$apply($attrs.onInfinite || '');\n      };\n\n      var finishInfiniteScroll = function() {\n        $element[0].classList.remove('active');\n        $timeout(function() {\n          scrollView.resize();\n          checkBounds();\n        }, 0, false);\n        infiniteScrollCtrl.isLoading = false;\n      };\n\n      $scope.$on('scroll.infiniteScrollComplete', function() {\n        finishInfiniteScroll();\n      });\n\n      $scope.$on('$destroy', function() {\n        scrollCtrl.$element.off('scroll', checkBounds);\n      });\n\n      var checkBounds = ionic.animationFrameThrottle(checkInfiniteBounds);\n\n      //Check bounds on start, after scrollView is fully rendered\n      setTimeout(checkBounds);\n      scrollCtrl.$element.on('scroll', checkBounds);\n\n      function checkInfiniteBounds() {\n        if (infiniteScrollCtrl.isLoading) return;\n\n        var scrollValues = scrollView.getValues();\n        var maxScroll = infiniteScrollCtrl.getMaxScroll();\n\n        if ((maxScroll.left !== -1 && scrollValues.left >= maxScroll.left) ||\n            (maxScroll.top !== -1 && scrollValues.top >= maxScroll.top)) {\n          onInfinite();\n        }\n      }\n    }\n  };\n}]);\n\nvar ITEM_TPL_CONTENT_ANCHOR =\n  '<a class=\"item-content\" ng-href=\"{{$href()}}\" target=\"{{$target()}}\"></a>';\nvar ITEM_TPL_CONTENT =\n  '<div class=\"item-content\"></div>';\n/**\n* @ngdoc directive\n* @name ionItem\n* @parent ionic.directive:ionList\n* @module ionic\n* @restrict E\n* Creates a list-item that can easily be swiped,\n* deleted, reordered, edited, and more.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* Can be assigned any item class name. See the\n* [list CSS documentation](/docs/components/#list).\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-item>Hello!</ion-item>\n*   <ion-item href=\"#/detail\">\n*     Link to detail page\n*   <ion-item>\n* </ion-list>\n* ```\n*/\nIonicModule\n.directive('ionItem', [\n  '$animate',\n  '$compile',\nfunction($animate, $compile) {\n  return {\n    restrict: 'E',\n    controller: ['$scope', '$element', function($scope, $element) {\n      this.$scope = $scope;\n      this.$element = $element;\n    }],\n    scope: true,\n    compile: function($element, $attrs) {\n      var isAnchor = angular.isDefined($attrs.href) ||\n        angular.isDefined($attrs.ngHref) ||\n        angular.isDefined($attrs.uiSref);\n      var isComplexItem = isAnchor ||\n        //Lame way of testing, but we have to know at compile what to do with the element\n        /ion-(delete|option|reorder)-button/i.test($element.html());\n\n        if (isComplexItem) {\n          var innerElement = jqLite(isAnchor ? ITEM_TPL_CONTENT_ANCHOR : ITEM_TPL_CONTENT);\n          innerElement.append($element.contents());\n\n          $element.append(innerElement);\n          $element.addClass('item item-complex');\n        } else {\n          $element.addClass('item');\n        }\n\n        return function link($scope, $element, $attrs) {\n          $scope.$href = function() {\n            return $attrs.href || $attrs.ngHref;\n          };\n          $scope.$target = function() {\n            return $attrs.target || '_self';\n          };\n        };\n    }\n  };\n}]);\n\nvar ITEM_TPL_DELETE_BUTTON =\n  '<div class=\"item-left-edit item-delete enable-pointer-events\">' +\n  '</div>';\n/**\n* @ngdoc directive\n* @name ionDeleteButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates a delete button inside a list item, that is visible when the\n* {@link ionic.directive:ionList ionList parent's} `show-delete` evaluates to true or\n* `$ionicListDelegate.showDelete(true)` is called.\n*\n* Takes any ionicon as a class.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* @usage\n*\n* ```html\n* <ion-list show-delete=\"shouldShowDelete\">\n*   <ion-item>\n*     <ion-delete-button class=\"ion-minus-circled\"></ion-delete-button>\n*     Hello, list item!\n*   </ion-item>\n* </ion-list>\n* <ion-toggle ng-model=\"shouldShowDelete\">\n*   Show Delete?\n* </ion-toggle>\n* ```\n*/\nIonicModule\n.directive('ionDeleteButton', ['$animate', function($animate) {\n  return {\n    restrict: 'E',\n    require: ['^ionItem', '^?ionList'],\n    //Run before anything else, so we can move it before other directives process\n    //its location (eg ngIf relies on the location of the directive in the dom)\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      //Add the classes we need during the compile phase, so that they stay\n      //even if something else like ngIf removes the element and re-addss it\n      $attr.$set('class', ($attr['class'] || '') + ' button icon button-icon', true);\n      return function($scope, $element, $attr, ctrls) {\n        var itemCtrl = ctrls[0];\n        var listCtrl = ctrls[1];\n        var container = jqLite(ITEM_TPL_DELETE_BUTTON);\n        container.append($element);\n        itemCtrl.$element.append(container).addClass('item-left-editable');\n\n        if (listCtrl && listCtrl.showDelete()) {\n          container.addClass('visible active');\n        }\n      };\n    }\n  };\n}]);\n\n\nIonicModule\n.directive('itemFloatingLabel', function() {\n  return {\n    restrict: 'C',\n    link: function(scope, element) {\n      var el = element[0];\n      var input = el.querySelector('input, textarea');\n      var inputLabel = el.querySelector('.input-label');\n\n      if ( !input || !inputLabel ) return;\n\n      var onInput = function() {\n        if ( input.value ) {\n          inputLabel.classList.add('has-input');\n        } else {\n          inputLabel.classList.remove('has-input');\n        }\n      };\n\n      input.addEventListener('input', onInput);\n\n      var ngModelCtrl = angular.element(input).controller('ngModel');\n      if ( ngModelCtrl ) {\n        ngModelCtrl.$render = function() {\n          input.value = ngModelCtrl.$viewValue || '';\n          onInput();\n        };\n      }\n\n      scope.$on('$destroy', function() {\n        input.removeEventListener('input', onInput);\n      });\n    }\n  };\n});\n\nvar ITEM_TPL_OPTION_BUTTONS =\n  '<div class=\"item-options invisible\">' +\n  '</div>';\n/**\n* @ngdoc directive\n* @name ionOptionButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates an option button inside a list item, that is visible when the item is swiped\n* to the left by the user.  Swiped open option buttons can be hidden with\n* {@link ionic.service:$ionicListDelegate#closeOptionButtons $ionicListDelegate#closeOptionButtons}.\n*\n* Can be assigned any button class.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-item>\n*     I love kittens!\n*     <ion-option-button class=\"button-positive\">Share</ion-option-button>\n*     <ion-option-button class=\"button-assertive\">Edit</ion-option-button>\n*   </ion-item>\n* </ion-list>\n* ```\n*/\nIonicModule\n.directive('ionOptionButton', ['$compile', function($compile) {\n  function stopPropagation(e) {\n    e.stopPropagation();\n  }\n  return {\n    restrict: 'E',\n    require: '^ionItem',\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      $attr.$set('class', ($attr['class'] || '') + ' button', true);\n      return function($scope, $element, $attr, itemCtrl) {\n        if (!itemCtrl.optionsContainer) {\n          itemCtrl.optionsContainer = jqLite(ITEM_TPL_OPTION_BUTTONS);\n          itemCtrl.$element.append(itemCtrl.optionsContainer);\n        }\n        itemCtrl.optionsContainer.append($element);\n\n        //Don't bubble click up to main .item\n        $element.on('click', stopPropagation);\n      };\n    }\n  };\n}]);\n\nvar ITEM_TPL_REORDER_BUTTON =\n  '<div data-prevent-scroll=\"true\" class=\"item-right-edit item-reorder enable-pointer-events\">' +\n  '</div>';\n\n/**\n* @ngdoc directive\n* @name ionReorderButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates a reorder button inside a list item, that is visible when the\n* {@link ionic.directive:ionList ionList parent's} `show-reorder` evaluates to true or\n* `$ionicListDelegate.showReorder(true)` is called.\n*\n* Can be dragged to reorder items in the list. Takes any ionicon class.\n*\n* Note: Reordering works best when used with `ng-repeat`.  Be sure that all `ion-item` children of an `ion-list` are part of the same `ng-repeat` expression.\n*\n* When an item reorder is complete, the expression given in the `on-reorder` attribute is called. The `on-reorder` expression is given two locals that can be used: `$fromIndex` and `$toIndex`.  See below for an example.\n*\n* Look at {@link ionic.directive:ionList} for more examples.\n*\n* @usage\n*\n* ```html\n* <ion-list ng-controller=\"MyCtrl\" show-reorder=\"true\">\n*   <ion-item ng-repeat=\"item in items\">\n*     Item {{item}}\n*     <ion-reorder-button class=\"ion-navicon\"\n*                         on-reorder=\"moveItem(item, $fromIndex, $toIndex)\">\n*     </ion-reorder-button>\n*   </ion-item>\n* </ion-list>\n* ```\n* ```js\n* function MyCtrl($scope) {\n*   $scope.items = [1, 2, 3, 4];\n*   $scope.moveItem = function(item, fromIndex, toIndex) {\n*     //Move the item in the array\n*     $scope.items.splice(fromIndex, 1);\n*     $scope.items.splice(toIndex, 0, item);\n*   };\n* }\n* ```\n*\n* @param {expression=} on-reorder Expression to call when an item is reordered.\n* Parameters given: $fromIndex, $toIndex.\n*/\nIonicModule\n.directive('ionReorderButton', ['$animate', '$parse', function($animate, $parse) {\n  return {\n    restrict: 'E',\n    require: ['^ionItem', '^?ionList'],\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      $attr.$set('class', ($attr['class'] || '') + ' button icon button-icon', true);\n      $element[0].setAttribute('data-prevent-scroll', true);\n      return function($scope, $element, $attr, ctrls) {\n        var itemCtrl = ctrls[0];\n        var listCtrl = ctrls[1];\n        var onReorderFn = $parse($attr.onReorder);\n\n        $scope.$onReorder = function(oldIndex, newIndex) {\n          onReorderFn($scope, {\n            $fromIndex: oldIndex,\n            $toIndex: newIndex\n          });\n        };\n\n        // prevent clicks from bubbling up to the item\n        if(!$attr.ngClick && !$attr.onClick && !$attr.onclick){\n          $element[0].onclick = function(e){e.stopPropagation(); return false;};\n        }\n\n        var container = jqLite(ITEM_TPL_REORDER_BUTTON);\n        container.append($element);\n        itemCtrl.$element.append(container).addClass('item-right-editable');\n\n        if (listCtrl && listCtrl.showReorder()) {\n          container.addClass('visible active');\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name keyboardAttach\n * @module ionic\n * @restrict A\n *\n * @description\n * keyboard-attach is an attribute directive which will cause an element to float above\n * the keyboard when the keyboard shows. Currently only supports the\n * [ion-footer-bar]({{ page.versionHref }}/api/directive/ionFooterBar/) directive.\n *\n * ### Notes\n * - This directive requires the\n * [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard).\n * - On Android not in fullscreen mode, i.e. you have\n *   `<preference name=\"Fullscreen\" value=\"false\" />` or no preference in your `config.xml` file,\n *   this directive is unnecessary since it is the default behavior.\n * - On iOS, if there is an input in your footer, you will need to set\n *   `cordova.plugins.Keyboard.disableScroll(true)`.\n *\n * @usage\n *\n * ```html\n *  <ion-footer-bar align-title=\"left\" keyboard-attach class=\"bar-assertive\">\n *    <h1 class=\"title\">Title!</h1>\n *  </ion-footer-bar>\n * ```\n */\n\nIonicModule\n.directive('keyboardAttach', function() {\n  return function(scope, element, attrs) {\n    ionic.on('native.keyboardshow', onShow, window);\n    ionic.on('native.keyboardhide', onHide, window);\n\n    //deprecated\n    ionic.on('native.showkeyboard', onShow, window);\n    ionic.on('native.hidekeyboard', onHide, window);\n\n\n    var scrollCtrl;\n\n    function onShow(e) {\n      if (ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen) {\n        return;\n      }\n\n      //for testing\n      var keyboardHeight = e.keyboardHeight || e.detail.keyboardHeight;\n      element.css('bottom', keyboardHeight + \"px\");\n      scrollCtrl = element.controller('$ionicScroll');\n      if ( scrollCtrl ) {\n        scrollCtrl.scrollView.__container.style.bottom = keyboardHeight + keyboardAttachGetClientHeight(element[0]) + \"px\";\n      }\n    }\n\n    function onHide() {\n      if (ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen) {\n        return;\n      }\n\n      element.css('bottom', '');\n      if ( scrollCtrl ) {\n        scrollCtrl.scrollView.__container.style.bottom = '';\n      }\n    }\n\n    scope.$on('$destroy', function() {\n      ionic.off('native.keyboardshow', onShow, window);\n      ionic.off('native.keyboardhide', onHide, window);\n\n      //deprecated\n      ionic.off('native.showkeyboard', onShow, window);\n      ionic.off('native.hidekeyboard', onHide, window);\n    });\n  };\n});\n\nfunction keyboardAttachGetClientHeight(element) {\n  return element.clientHeight;\n}\n\n/**\n* @ngdoc directive\n* @name ionList\n* @module ionic\n* @delegate ionic.service:$ionicListDelegate\n* @codepen JsHjf\n* @restrict E\n* @description\n* The List is a widely used interface element in almost any mobile app, and can include\n* content ranging from basic text all the way to buttons, toggles, icons, and thumbnails.\n*\n* Both the list, which contains items, and the list items themselves can be any HTML\n* element. The containing element requires the `list` class and each list item requires\n* the `item` class.\n*\n* However, using the ionList and ionItem directives make it easy to support various\n* interaction modes such as swipe to edit, drag to reorder, and removing items.\n*\n* Related: {@link ionic.directive:ionItem}, {@link ionic.directive:ionOptionButton}\n* {@link ionic.directive:ionReorderButton}, {@link ionic.directive:ionDeleteButton}, [`list CSS documentation`](/docs/components/#list).\n*\n* @usage\n*\n* Basic Usage:\n*\n* ```html\n* <ion-list>\n*   <ion-item ng-repeat=\"item in items\">\n*     {% raw %}Hello, {{item}}!{% endraw %}\n*   </ion-item>\n* </ion-list>\n* ```\n*\n* Advanced Usage: Thumbnails, Delete buttons, Reordering, Swiping\n*\n* ```html\n* <ion-list ng-controller=\"MyCtrl\"\n*           show-delete=\"shouldShowDelete\"\n*           show-reorder=\"shouldShowReorder\"\n*           can-swipe=\"listCanSwipe\">\n*   <ion-item ng-repeat=\"item in items\"\n*             class=\"item-thumbnail-left\">\n*\n*     {% raw %}<img ng-src=\"{{item.img}}\">\n*     <h2>{{item.title}}</h2>\n*     <p>{{item.description}}</p>{% endraw %}\n*     <ion-option-button class=\"button-positive\"\n*                        ng-click=\"share(item)\">\n*       Share\n*     </ion-option-button>\n*     <ion-option-button class=\"button-info\"\n*                        ng-click=\"edit(item)\">\n*       Edit\n*     </ion-option-button>\n*     <ion-delete-button class=\"ion-minus-circled\"\n*                        ng-click=\"items.splice($index, 1)\">\n*     </ion-delete-button>\n*     <ion-reorder-button class=\"ion-navicon\"\n*                         on-reorder=\"reorderItem(item, $fromIndex, $toIndex)\">\n*     </ion-reorder-button>\n*\n*   </ion-item>\n* </ion-list>\n* ```\n*\n* @param {string=} delegate-handle The handle used to identify this list with\n* {@link ionic.service:$ionicListDelegate}.\n* @param type {string=} The type of list to use (for example, list-inset for an inset list)\n* @param show-delete {boolean=} Whether the delete buttons for the items in the list are\n* currently shown or hidden.\n* @param show-reorder {boolean=} Whether the reorder buttons for the items in the list are\n* currently shown or hidden.\n* @param can-swipe {boolean=} Whether the items in the list are allowed to be swiped to reveal\n* option buttons. Default: true.\n*/\nIonicModule\n.directive('ionList', [\n  '$animate',\n  '$timeout',\nfunction($animate, $timeout) {\n  return {\n    restrict: 'E',\n    require: ['ionList', '^?$ionicScroll'],\n    controller: '$ionicList',\n    compile: function($element, $attr) {\n      var listEl = jqLite('<div class=\"list\">')\n      .append( $element.contents() )\n      .addClass($attr.type);\n      $element.append(listEl);\n\n      return function($scope, $element, $attrs, ctrls) {\n        var listCtrl = ctrls[0];\n        var scrollCtrl = ctrls[1];\n\n        //Wait for child elements to render...\n        $timeout(init);\n\n        function init() {\n          var listView = listCtrl.listView = new ionic.views.ListView({\n            el: $element[0],\n            listEl: $element.children()[0],\n            scrollEl: scrollCtrl && scrollCtrl.element,\n            scrollView: scrollCtrl && scrollCtrl.scrollView,\n            onReorder: function(el, oldIndex, newIndex) {\n              var itemScope = jqLite(el).scope();\n              if (itemScope && itemScope.$onReorder) {\n                //Make sure onReorder is called in apply cycle,\n                //but also make sure it has no conflicts by doing\n                //$evalAsync\n                $timeout(function() {\n                  itemScope.$onReorder(oldIndex, newIndex);\n                });\n              }\n            },\n            canSwipe: function() {\n              return listCtrl.canSwipeItems();\n            }\n          });\n\n          if (isDefined($attr.canSwipe)) {\n            $scope.$watch('!!(' + $attr.canSwipe + ')', function(value) {\n              listCtrl.canSwipeItems(value);\n            });\n          }\n          if (isDefined($attr.showDelete)) {\n            $scope.$watch('!!(' + $attr.showDelete + ')', function(value) {\n              listCtrl.showDelete(value);\n            });\n          }\n          if (isDefined($attr.showReorder)) {\n            $scope.$watch('!!(' + $attr.showReorder + ')', function(value) {\n              listCtrl.showReorder(value);\n            });\n          }\n\n          $scope.$watch(function() {\n            return listCtrl.showDelete();\n          }, function(isShown, wasShown) {\n            //Only use isShown=false if it was already shown\n            if (!isShown && !wasShown) { return; }\n\n            if (isShown) listCtrl.closeOptionButtons();\n            listCtrl.canSwipeItems(!isShown);\n\n            $element.children().toggleClass('list-left-editing', isShown);\n            $element.toggleClass('disable-pointer-events', isShown);\n\n            var deleteButton = jqLite($element[0].getElementsByClassName('item-delete'));\n            setButtonShown(deleteButton, listCtrl.showDelete);\n          });\n\n          $scope.$watch(function() {\n            return listCtrl.showReorder();\n          }, function(isShown, wasShown) {\n            //Only use isShown=false if it was already shown\n            if (!isShown && !wasShown) { return; }\n\n            if (isShown) listCtrl.closeOptionButtons();\n            listCtrl.canSwipeItems(!isShown);\n\n            $element.children().toggleClass('list-right-editing', isShown);\n            $element.toggleClass('disable-pointer-events', isShown);\n\n            var reorderButton = jqLite($element[0].getElementsByClassName('item-reorder'));\n            setButtonShown(reorderButton, listCtrl.showReorder);\n          });\n\n          function setButtonShown(el, shown) {\n            shown() && el.addClass('visible') || el.removeClass('active');\n            ionic.requestAnimationFrame(function() {\n              shown() && el.addClass('active') || el.removeClass('invisible');\n            });\n          }\n        }\n\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name menuClose\n * @module ionic\n * @restrict AC\n *\n * @description\n * Closes a side menu which is currently opened.\n *\n * @usage\n * Below is an example of a link within a side menu. Tapping this link would\n * automatically close the currently opened menu.\n *\n * ```html\n * <a menu-close href=\"#/home\" class=\"item\">Home</a>\n * ```\n */\nIonicModule\n.directive('menuClose', ['$ionicViewService', function($ionicViewService) {\n  return {\n    restrict: 'AC',\n    require: '^ionSideMenus',\n    link: function($scope, $element, $attr, sideMenuCtrl) {\n      $element.bind('click', function(){\n        sideMenuCtrl.close();\n      });\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name menuToggle\n * @module ionic\n * @restrict AC\n *\n * @description\n * Toggle a side menu on the given side\n *\n * @usage\n * Below is an example of a link within a nav bar. Tapping this link would\n * automatically open the given side menu\n *\n * ```html\n * <ion-view>\n *   <ion-nav-buttons side=\"left\">\n *    <button menu-toggle=\"left\" class=\"button button-icon icon ion-navicon\"></button>\n *   </ion-nav-buttons>\n *  ...\n * </ion-view>\n * ```\n */\nIonicModule\n.directive('menuToggle', ['$ionicViewService', function($ionicViewService) {\n  return {\n    restrict: 'AC',\n    require: '^ionSideMenus',\n    link: function($scope, $element, $attr, sideMenuCtrl) {\n      var side = $attr.menuToggle || 'left';\n      $element.bind('click', function(){\n        if(side === 'left') {\n          sideMenuCtrl.toggleLeft();\n        } else if(side === 'right') {\n          sideMenuCtrl.toggleRight();\n        }\n      });\n    }\n  };\n}]);\n\n\n/*\n * We don't document the ionModal directive, we instead document\n * the $ionicModal service\n */\nIonicModule\n.directive('ionModal', [function() {\n  return {\n    restrict: 'E',\n    transclude: true,\n    replace: true,\n    controller: [function(){}],\n    template: '<div class=\"modal-backdrop\">' +\n                '<div class=\"modal-wrapper\" ng-transclude></div>' +\n                '</div>'\n  };\n}]);\n\nIonicModule\n.directive('ionModalView', function() {\n  return {\n    restrict: 'E',\n    compile: function(element, attr) {\n      element.addClass('modal');\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionNavBackButton\n * @module ionic\n * @restrict E\n * @parent ionNavBar\n * @description\n * Creates a back button inside an {@link ionic.directive:ionNavBar}.\n *\n * Will show up when the user is able to go back in the current navigation stack.\n *\n * By default, will go back when clicked.  If you wish for more advanced behavior, see the\n * examples below.\n *\n * @usage\n *\n * With default click action:\n *\n * ```html\n * <ion-nav-bar>\n *   <ion-nav-back-button class=\"button-clear\">\n *     <i class=\"ion-arrow-left-c\"></i> Back\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n *\n * With custom click action, using {@link ionic.service:$ionicNavBarDelegate}:\n *\n * ```html\n * <ion-nav-bar ng-controller=\"MyCtrl\">\n *   <ion-nav-back-button class=\"button-clear\"\n *     ng-click=\"goBack()\">\n *     <i class=\"ion-arrow-left-c\"></i> Back\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicNavBarDelegate) {\n *   $scope.goBack = function() {\n *     $ionicNavBarDelegate.back();\n *   };\n * }\n * ```\n *\n * Displaying the previous title on the back button, again using\n * {@link ionic.service:$ionicNavBarDelegate}.\n *\n * ```html\n * <ion-nav-bar ng-controller=\"MyCtrl\">\n *   <ion-nav-back-button class=\"button-icon\">\n *     <i class=\"icon ion-arrow-left-c\"></i>{% raw %}{{getPreviousTitle() || 'Back'}}{% endraw %}\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicNavBarDelegate) {\n *   $scope.getPreviousTitle = function() {\n *     return $ionicNavBarDelegate.getPreviousTitle();\n *   };\n * }\n * ```\n */\nIonicModule\n.directive('ionNavBackButton', [\n  '$animate',\n  '$rootScope',\n  '$sanitize',\n  '$ionicNavBarConfig',\n  '$ionicNgClick',\nfunction($animate, $rootScope, $sanitize, $ionicNavBarConfig, $ionicNgClick) {\n  var backIsShown = false;\n  //If the current viewstate does not allow a back button,\n  //always hide it.\n  $rootScope.$on('$viewHistory.historyChange', function(e, data) {\n    backIsShown = !!data.showBack;\n  });\n  return {\n    restrict: 'E',\n    require: '^ionNavBar',\n    compile: function(tElement, tAttrs) {\n      tElement.addClass('button back-button ng-hide');\n\n      var hasIconChild = !!(tElement.html() || '').match(/class=.*?ion-/);\n\n      return function($scope, $element, $attr, navBarCtrl) {\n\n        // Add a default back button icon based on the nav config, unless one is set\n        if (!hasIconChild && $element[0].className.indexOf('ion-') === -1) {\n          $element.addClass($ionicNavBarConfig.backButtonIcon);\n        }\n\n        //Default to ngClick going back, but don't override a custom one\n        if (!isDefined($attr.ngClick)) {\n          $ionicNgClick($scope, $element, navBarCtrl.back);\n        }\n\n        //Make sure both that a backButton is allowed in the first place,\n        //and that it is shown by the current view.\n        $scope.$watch(function() {\n          if(isDefined($attr.fromTitle)) {\n            $element[0].innerHTML = '<span class=\"back-button-title\">' + $sanitize($scope.oldTitle) + '</span>';\n          }\n          return !!(backIsShown && $scope.backButtonShown);\n        }, ionic.animationFrameThrottle(function(show) {\n          if (show) $animate.removeClass($element, 'ng-hide');\n          else $animate.addClass($element, 'ng-hide');\n        }));\n      };\n    }\n  };\n}]);\n\n\nIonicModule.constant('$ionicNavBarConfig', {\n  transition: 'nav-title-slide-ios7',\n  alignTitle: 'center',\n  backButtonIcon: 'ion-ios7-arrow-back'\n});\n\n/**\n * @ngdoc directive\n * @name ionNavBar\n * @module ionic\n * @delegate ionic.service:$ionicNavBarDelegate\n * @restrict E\n *\n * @description\n * If we have an {@link ionic.directive:ionNavView} directive, we can also create an\n * `<ion-nav-bar>`, which will create a topbar that updates as the application state changes.\n *\n * We can add a back button by putting an {@link ionic.directive:ionNavBackButton} inside.\n *\n * We can add buttons depending on the currently visible view using\n * {@link ionic.directive:ionNavButtons}.\n *\n * Add an [animation class](/docs/components#animations) to the element via the\n * `animation` attribute to enable animated changing of titles \n * (recommended: 'nav-title-slide-ios7').\n *\n * Note that the ion-nav-bar element will only work correctly if your content has an\n * ionView around it.\n *\n * @usage\n *\n * ```html\n * <body ng-app=\"starter\">\n *   <!-- The nav bar that will be updated as we navigate -->\n *   <ion-nav-bar class=\"bar-positive\" animation=\"nav-title-slide-ios7\">\n *   </ion-nav-bar>\n *\n *   <!-- where the initial view template will be rendered -->\n *   <ion-nav-view>\n *     <ion-view>\n *       <ion-content>Hello!</ion-content>\n *     </ion-view>\n *   </ion-nav-view>\n * </body>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this navBar\n * with {@link ionic.service:$ionicNavBarDelegate}.\n * @param align-title {string=} Where to align the title of the navbar.\n * Available: 'left', 'right', 'center'. Defaults to 'center'.\n * @param {boolean=} no-tap-scroll By default, the navbar will scroll the content\n * to the top when tapped.  Set no-tap-scroll to true to disable this behavior.\n *\n * </table><br/>\n *\n * ### Alternative Usage\n *\n * Alternatively, you may put ion-nav-bar inside of each individual view's ion-view element.\n * This will allow you to have the whole navbar, not just its contents, transition every view change.\n *\n * This is similar to using a header bar inside your ion-view, except it will have all the power of a navbar.\n *\n * If you do this, simply put nav buttons inside the navbar itself; do not use `<ion-nav-buttons>`.\n *\n *\n * ```html\n * <ion-view title=\"myTitle\">\n *   <ion-nav-bar class=\"bar-positive\">\n *     <ion-nav-back-button>\n *       Back\n *     </ion-nav-back-button>\n *     <div class=\"buttons right-buttons\">\n *       <button class=\"button\">\n *         Right Button\n *       </button>\n *     </div>\n *   </ion-nav-bar>\n * </ion-view>\n * ```\n */\nIonicModule\n.directive('ionNavBar', [\n  '$ionicViewService',\n  '$rootScope',\n  '$animate',\n  '$compile',\n  '$ionicNavBarConfig',\nfunction($ionicViewService, $rootScope, $animate, $compile, $ionicNavBarConfig) {\n\n  return {\n    restrict: 'E',\n    controller: '$ionicNavBar',\n    scope: true,\n    compile: function(tElement, tAttrs) {\n      //We cannot transclude here because it breaks element.data() inheritance on compile\n      tElement\n        .addClass('bar bar-header nav-bar')\n        .append(\n          '<div class=\"buttons left-buttons\"> ' +\n          '</div>' +\n          '<h1 ng-bind-html=\"title\" class=\"title\"></h1>' +\n          '<div class=\"buttons right-buttons\"> ' +\n          '</div>'\n        );\n\n      if (isDefined(tAttrs.animation)) {\n        tElement.addClass(tAttrs.animation);\n      } else {\n        tElement.addClass($ionicNavBarConfig.transition);\n      }\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, navBarCtrl) {\n        navBarCtrl._headerBarView = new ionic.views.HeaderBar({\n          el: $element[0],\n          alignTitle: $attr.alignTitle || $ionicNavBarConfig.alignTitle || 'center'\n        });\n\n        //defaults\n        $scope.backButtonShown = false;\n        $scope.shouldAnimate = true;\n        $scope.isReverse = false;\n        $scope.isInvisible = true;\n\n        $scope.$on('$destroy', function() {\n          $scope.$parent.$hasHeader = false;\n        });\n\n        $scope.$watch(function() {\n          return ($scope.isReverse ? ' reverse' : '') +\n            ($scope.isInvisible ? ' invisible' : '') +\n            (!$scope.shouldAnimate ? ' no-animation' : '');\n        }, function(className, oldClassName) {\n          $element.removeClass(oldClassName);\n          $element.addClass(className);\n        });\n\n      }\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionNavButtons\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n * Use ionNavButtons to set the buttons on your {@link ionic.directive:ionNavBar}\n * from within an {@link ionic.directive:ionView}.\n *\n * Any buttons you declare will be placed onto the navbar's corresponding side,\n * and then destroyed when the user leaves their parent view.\n *\n * @usage\n * ```html\n * <ion-nav-bar>\n * </ion-nav-bar>\n * <ion-nav-view>\n *   <ion-view>\n *     <ion-nav-buttons side=\"left\">\n *       <button class=\"button\" ng-click=\"doSomething()\">\n *         I'm a button on the left of the navbar!\n *       </button>\n *     </ion-nav-buttons>\n *     <ion-content>\n *       Some super content here!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n * @param {string} side The side to place the buttons on in the parent\n * {@link ionic.directive:ionNavBar}. Available: 'left' or 'right'.\n */\nIonicModule\n.directive('ionNavButtons', ['$compile', '$animate', function($compile, $animate) {\n  return {\n    require: '^ionNavBar',\n    restrict: 'E',\n    compile: function($element, $attrs) {\n      var content = $element.contents().remove();\n      return function($scope, $element, $attrs, navBarCtrl) {\n        var navElement = $attrs.side === 'right' ?\n          navBarCtrl.rightButtonsElement :\n          navBarCtrl.leftButtonsElement;\n\n        //Put all of our inside buttons into their own span,\n        //so we can remove them all when this element dies -\n        //even if the buttons have changed through an ng-repeat or the like,\n        //we just remove their div parent and they are gone.\n        var buttons = jqLite('<span>').append(content);\n\n        //Compile buttons inside content so they have access to everything\n        //something inside content does (eg parent ionicScroll)\n        $element.append(buttons);\n        $compile(buttons)($scope);\n\n        //Append buttons to navbar\n        ionic.requestAnimationFrame(function() {\n          //If the scope is destroyed before raf runs, be sure not to enter\n          if (!$scope.$$destroyed) {\n            $animate.enter(buttons, navElement);\n          }\n        });\n\n        //When our ion-nav-buttons container is destroyed,\n        //destroy everything in the navbar\n        $scope.$on('$destroy', function() {\n          $animate.leave(buttons);\n        });\n\n        // The original element is just a completely empty <ion-nav-buttons> element.\n        // make it invisible just to be sure it doesn't change any layout\n        $element.css('display', 'none');\n      };\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name navClear\n * @module ionic\n * @restrict AC\n *\n * @description\n * nav-clear is an attribute directive which should be used with an element that changes\n * the view on click, for example an `<a href>` or a `<button ui-sref>`.\n *\n * nav-clear will cause the given element, when clicked, to disable the next view transition.\n * This directive is useful, for example, for links within a sideMenu.\n *\n * @usage\n * Below is a link in a side menu, with the nav-clear directive added to it.\n * Tapping this link will disable any animations that would normally occur\n * between views.\n *\n * ```html\n * <a nav-clear menu-close href=\"#/home\" class=\"item\">Home</a>\n * ```\n */\nIonicModule\n.directive('navClear', [\n  '$ionicViewService',\n  '$state',\n  '$location',\n  '$window',\n  '$rootScope',\nfunction($ionicViewService, $location, $state, $window, $rootScope) {\n  $rootScope.$on('$stateChangeError', function() {\n    $ionicViewService.nextViewOptions(null);\n  });\n  return {\n    priority: 100,\n    restrict: 'AC',\n    compile: function($element) {\n      return { pre: prelink };\n      function prelink($scope, $element, $attrs) {\n        var unregisterListener;\n        function listenForStateChange() {\n          unregisterListener = $scope.$on('$stateChangeStart', function() {\n            $ionicViewService.nextViewOptions({\n              disableAnimate: true,\n              disableBack: true\n            });\n            unregisterListener();\n          });\n          $window.setTimeout(unregisterListener, 300);\n        }\n\n        $element.on('click', listenForStateChange);\n      }\n    }\n  };\n}]);\n\nIonicModule.constant('$ionicNavViewConfig', {\n  transition: 'slide-left-right-ios7'\n});\n\n/**\n * @ngdoc directive\n * @name ionNavView\n * @module ionic\n * @restrict E\n * @codepen odqCz\n *\n * @description\n * As a user navigates throughout your app, Ionic is able to keep track of their\n * navigation history. By knowing their history, transitions between views\n * correctly slide either left or right, or no transition at all. An additional\n * benefit to Ionic's navigation system is its ability to manage multiple\n * histories.\n *\n * Ionic uses the AngularUI Router module so app interfaces can be organized\n * into various \"states\". Like Angular's core $route service, URLs can be used\n * to control the views. However, the AngularUI Router provides a more powerful\n * state manager in that states are bound to named, nested, and parallel views,\n * allowing more than one template to be rendered on the same page.\n * Additionally, each state is not required to be bound to a URL, and data can\n * be pushed to each state which allows much flexibility.\n *\n * The ionNavView directive is used to render templates in your application. Each template\n * is part of a state. States are usually mapped to a url, and are defined programatically\n * using angular-ui-router (see [their docs](https://github.com/angular-ui/ui-router/wiki),\n * and remember to replace ui-view with ion-nav-view in examples).\n *\n * @usage\n * In this example, we will create a navigation view that contains our different states for the app.\n *\n * To do this, in our markup we use ionNavView top level directive. To display a header bar we use\n * the {@link ionic.directive:ionNavBar} directive that updates as we navigate through the\n * navigation stack.\n *\n * You can use any [animation class](/docs/components#animations) on the navView's `animation` attribute\n * to have its pages animate.\n *\n * Recommended for page transitions: 'slide-left-right', 'slide-left-right-ios7', 'slide-in-up'.\n *\n * ```html\n * <ion-nav-bar></ion-nav-bar>\n * <ion-nav-view animation=\"slide-left-right\">\n *   <!-- Center content -->\n * </ion-nav-view>\n * ```\n *\n * Next, we need to setup our states that will be rendered.\n *\n * ```js\n * var app = angular.module('myApp', ['ionic']);\n * app.config(function($stateProvider) {\n *   $stateProvider\n *   .state('index', {\n *     url: '/',\n *     templateUrl: 'home.html'\n *   })\n *   .state('music', {\n *     url: '/music',\n *     templateUrl: 'music.html'\n *   });\n * });\n * ```\n * Then on app start, $stateProvider will look at the url, see it matches the index state,\n * and then try to load home.html into the `<ion-nav-view>`.\n *\n * Pages are loaded by the URLs given. One simple way to create templates in Angular is to put\n * them directly into your HTML file and use the `<script type=\"text/ng-template\">` syntax.\n * So here is one way to put home.html into our app:\n *\n * ```html\n * <script id=\"home\" type=\"text/ng-template\">\n *   <!-- The title of the ion-view will be shown on the navbar -->\n *   <ion-view title=\"'Home'\">\n *     <ion-content ng-controller=\"HomeCtrl\">\n *       <!-- The content of the page -->\n *       <a href=\"#/music\">Go to music page!</a>\n *     </ion-content>\n *   </ion-view>\n * </script>\n * ```\n *\n * This is good to do because the template will be cached for very fast loading, instead of\n * having to fetch them from the network.\n *\n * Please visit [AngularUI Router's docs](https://github.com/angular-ui/ui-router/wiki) for\n * more info. Below is a great video by the AngularUI Router guys that may help to explain\n * how it all works:\n *\n * <iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/dqJRoh8MnBo\"\n * frameborder=\"0\" allowfullscreen></iframe>\n *\n * @param {string=} name A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states. For more\n * information, see ui-router's [ui-view documentation](http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.directive:ui-view).\n */\nIonicModule\n.directive('ionNavView', [\n  '$ionicViewService',\n  '$state',\n  '$compile',\n  '$controller',\n  '$animate',\nfunction( $ionicViewService,   $state,   $compile,   $controller,   $animate) {\n  // IONIC's fork of Angular UI Router, v0.2.7\n  // the navView handles registering views in the history, which animation to use, and which\n  var viewIsUpdating = false;\n\n  var directive = {\n    restrict: 'E',\n    terminal: true,\n    priority: 2000,\n    transclude: true,\n    controller: function(){},\n    compile: function (element, attr, transclude) {\n      return function(scope, element, attr, navViewCtrl) {\n        var viewScope, viewLocals,\n          name = attr[directive.name] || attr.name || '',\n          onloadExp = attr.onload || '',\n          initialView = transclude(scope);\n\n        // Put back the compiled initial view\n        element.append(initialView);\n\n        // Find the details of the parent view directive (if any) and use it\n        // to derive our own qualified view name, then hang our own details\n        // off the DOM so child directives can find it.\n        var parent = element.parent().inheritedData('$uiView');\n        if (name.indexOf('@') < 0) name  = name + '@' + ((parent && parent.state) ? parent.state.name : '');\n        var view = { name: name, state: null };\n        element.data('$uiView', view);\n\n        var eventHook = function() {\n          if (viewIsUpdating) return;\n          viewIsUpdating = true;\n\n          try { updateView(true); } catch (e) {\n            viewIsUpdating = false;\n            throw e;\n          }\n          viewIsUpdating = false;\n        };\n\n        scope.$on('$stateChangeSuccess', eventHook);\n        // scope.$on('$viewContentLoading', eventHook);\n        updateView(false);\n\n        function updateView(doAnimate) {\n          //===false because $animate.enabled() is a noop without angular-animate included\n          if ($animate.enabled() === false) {\n            doAnimate = false;\n          }\n\n          var locals = $state.$current && $state.$current.locals[name];\n          if (locals === viewLocals) return; // nothing to do\n          var renderer = $ionicViewService.getRenderer(element, attr, scope);\n\n          // Destroy previous view scope\n          if (viewScope) {\n            viewScope.$destroy();\n            viewScope = null;\n          }\n\n          if (!locals) {\n            viewLocals = null;\n            view.state = null;\n\n            // Restore the initial view\n            return element.append(initialView);\n          }\n\n          var newElement = jqLite('<div></div>').html(locals.$template).contents();\n          var viewRegisterData = renderer().register(newElement);\n\n          // Remove existing content\n          renderer(doAnimate).leave();\n\n          viewLocals = locals;\n          view.state = locals.$$state;\n\n          renderer(doAnimate).enter(newElement);\n\n          var link = $compile(newElement);\n          viewScope = scope.$new();\n\n          viewScope.$navDirection = viewRegisterData.navDirection;\n\n          if (locals.$$controller) {\n            locals.$scope = viewScope;\n            var controller = $controller(locals.$$controller, locals);\n            element.children().data('$ngControllerController', controller);\n          }\n          link(viewScope);\n\n          var viewHistoryData = $ionicViewService._getViewById(viewRegisterData.viewId) || {};\n          viewScope.$broadcast('$viewContentLoaded', viewHistoryData);\n\n          if (onloadExp) viewScope.$eval(onloadExp);\n\n          newElement = null;\n        }\n      };\n    }\n  };\n  return directive;\n}]);\n\n\nIonicModule\n\n.config(['$provide', function($provide) {\n  $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {\n    // drop the default ngClick directive\n    $delegate.shift();\n    return $delegate;\n  }]);\n}])\n\n/**\n * @private\n */\n.factory('$ionicNgClick', ['$parse', function($parse) {\n  return function(scope, element, clickExpr) {\n    var clickHandler = angular.isFunction(clickExpr) ?\n      clickExpr :\n      $parse(clickExpr);\n\n    element.on('click', function(event) {\n      scope.$apply(function() {\n        clickHandler(scope, {$event: (event)});\n      });\n    });\n\n    // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click\n    // something else nearby.\n    element.onclick = function(event) { };\n  };\n}])\n\n.directive('ngClick', ['$ionicNgClick', function($ionicNgClick) {\n  return function(scope, element, attr) {\n    $ionicNgClick(scope, element, attr.ngClick);\n  };\n}])\n\n.directive('ionStopEvent', function () {\n  return {\n    restrict: 'A',\n    link: function (scope, element, attr) {\n      element.bind(attr.ionStopEvent, eventStopPropagation);\n    }\n  };\n});\nfunction eventStopPropagation(e) {\n  e.stopPropagation();\n}\n\n\n/**\n * @ngdoc directive\n * @name ionPane\n * @module ionic\n * @restrict E\n *\n * @description A simple container that fits content, with no side effects.  Adds the 'pane' class to the element.\n */\nIonicModule\n.directive('ionPane', function() {\n  return {\n    restrict: 'E',\n    link: function(scope, element, attr) {\n      element.addClass('pane');\n    }\n  };\n});\n\n/*\n * We don't document the ionPopover directive, we instead document\n * the $ionicPopover service\n */\nIonicModule\n.directive('ionPopover', [function() {\n  return {\n    restrict: 'E',\n    transclude: true,\n    replace: true,\n    controller: [function(){}],\n    template: '<div class=\"popover-backdrop\">' +\n                '<div class=\"popover-wrapper\" ng-transclude></div>' +\n              '</div>'\n  };\n}]);\n\nIonicModule\n.directive('ionPopoverView', function() {\n  return {\n    restrict: 'E',\n    compile: function(element) {\n      element.append( angular.element('<div class=\"popover-arrow\"></div>') );\n      element.addClass('popover');\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionRadio\n * @module ionic\n * @restrict E\n * @codepen saoBG\n * @description\n * The radio directive is no different than the HTML radio input, except it's styled differently.\n *\n * Radio behaves like any [AngularJS radio](http://docs.angularjs.org/api/ng/input/input[radio]).\n *\n * @usage\n * ```html\n * <ion-radio ng-model=\"choice\" ng-value=\"'A'\">Choose A</ion-radio>\n * <ion-radio ng-model=\"choice\" ng-value=\"'B'\">Choose B</ion-radio>\n * <ion-radio ng-model=\"choice\" ng-value=\"'C'\">Choose C</ion-radio>\n * ```\n * \n * @param {string=} name The name of the radio input.\n * @param {expression=} value The value of the radio input.\n * @param {boolean=} disabled The state of the radio input.\n * @param {string=} icon The icon to use when the radio input is selected.\n * @param {expression=} ng-value Angular equivalent of the value attribute.\n * @param {expression=} ng-model The angular model for the radio input.\n * @param {boolean=} ng-disabled Angular equivalent of the disabled attribute.\n * @param {expression=} ng-change Triggers given expression when radio input's model changes\n */\nIonicModule\n.directive('ionRadio', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<label class=\"item item-radio\">' +\n        '<input type=\"radio\" name=\"radio-group\">' +\n        '<div class=\"item-content disable-pointer-events\" ng-transclude></div>' +\n        '<i class=\"radio-icon disable-pointer-events icon ion-checkmark\"></i>' +\n      '</label>',\n\n    compile: function(element, attr) {\n      if(attr.icon) element.children().eq(2).removeClass('ion-checkmark').addClass(attr.icon);\n      var input = element.find('input');\n      forEach({\n          'name': attr.name,\n          'value': attr.value,\n          'disabled': attr.disabled,\n          'ng-value': attr.ngValue,\n          'ng-model': attr.ngModel,\n          'ng-disabled': attr.ngDisabled,\n          'ng-change': attr.ngChange\n      }, function(value, name) {\n        if (isDefined(value)) {\n            input.attr(name, value);\n          }\n      });\n\n      return function(scope, element, attr) {\n        scope.getValue = function() {\n          return scope.ngValue || attr.value;\n        };\n      };\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionRefresher\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionContent, ionic.directive:ionScroll\n * @description\n * Allows you to add pull-to-refresh to a scrollView.\n *\n * Place it as the first child of your {@link ionic.directive:ionContent} or\n * {@link ionic.directive:ionScroll} element.\n *\n * When refreshing is complete, $broadcast the 'scroll.refreshComplete' event\n * from your controller.\n *\n * @usage\n *\n * ```html\n * <ion-content ng-controller=\"MyController\">\n *   <ion-refresher\n *     pulling-text=\"Pull to refresh...\"\n *     on-refresh=\"doRefresh()\">\n *   </ion-refresher>\n *   <ion-list>\n *     <ion-item ng-repeat=\"item in items\"></ion-item>\n *   </ion-list>\n * </ion-content>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $http) {\n *   $scope.items = [1,2,3];\n *   $scope.doRefresh = function() {\n *     $http.get('/new-items')\n *      .success(function(newItems) {\n *        $scope.items = newItems;\n *      })\n *      .finally(function() {\n *        // Stop the ion-refresher from spinning\n *        $scope.$broadcast('scroll.refreshComplete');\n *      });\n *   };\n * });\n * ```\n *\n * @param {expression=} on-refresh Called when the user pulls down enough and lets go\n * of the refresher.\n * @param {expression=} on-pulling Called when the user starts to pull down\n * on the refresher.\n * @param {string=} pulling-icon The icon to display while the user is pulling down.\n * Default: 'ion-arrow-down-c'.\n * @param {string=} pulling-text The text to display while the user is pulling down.\n * @param {string=} refreshing-icon The icon to display after user lets go of the\n * refresher.\n * @param {string=} refreshing-text The text to display after the user lets go of\n * the refresher.\n *\n */\nIonicModule\n.directive('ionRefresher', ['$ionicBind', function($ionicBind) {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '^$ionicScroll',\n    template:\n    '<div class=\"scroll-refresher\" collection-repeat-ignore>' +\n      '<div class=\"ionic-refresher-content\" ' +\n      'ng-class=\"{\\'ionic-refresher-with-text\\': pullingText || refreshingText}\">' +\n        '<div class=\"icon-pulling\">' +\n          '<i class=\"icon {{pullingIcon}}\"></i>' +\n        '</div>' +\n        '<div class=\"text-pulling\" ng-bind-html=\"pullingText\"></div>' +\n        '<i class=\"icon {{refreshingIcon}} icon-refreshing\"></i>' +\n        '<div class=\"text-refreshing\" ng-bind-html=\"refreshingText\"></div>' +\n      '</div>' +\n    '</div>',\n    compile: function($element, $attrs) {\n      if (angular.isUndefined($attrs.pullingIcon)) {\n        $attrs.$set('pullingIcon', 'ion-arrow-down-c');\n      }\n      if (angular.isUndefined($attrs.refreshingIcon)) {\n        $attrs.$set('refreshingIcon', 'ion-loading-d');\n      }\n      return function($scope, $element, $attrs, scrollCtrl) {\n        $ionicBind($scope, $attrs, {\n          pullingIcon: '@',\n          pullingText: '@',\n          refreshingIcon: '@',\n          refreshingText: '@',\n          $onRefresh: '&onRefresh',\n          $onPulling: '&onPulling'\n        });\n\n        scrollCtrl._setRefresher($scope, $element[0]);\n        $scope.$on('scroll.refreshComplete', function() {\n          $scope.$evalAsync(function() {\n            scrollCtrl.scrollView.finishPullToRefresh();\n          });\n        });\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionScroll\n * @module ionic\n * @delegate ionic.service:$ionicScrollDelegate\n * @codepen mwFuh\n * @restrict E\n *\n * @description\n * Creates a scrollable container for all content inside.\n *\n * @usage\n *\n * Basic usage:\n *\n * ```html\n * <ion-scroll zooming=\"true\" direction=\"xy\" style=\"width: 500px; height: 500px\">\n *   <div style=\"width: 5000px; height: 5000px; background: url('https://upload.wikimedia.org/wikipedia/commons/a/ad/Europe_geological_map-en.jpg') repeat\"></div>\n *  </ion-scroll>\n * ```\n *\n * Note that it's important to set the height of the scroll box as well as the height of the inner\n * content to enable scrolling. This makes it possible to have full control over scrollable areas.\n *\n * If you'd just like to have a center content scrolling area, use {@link ionic.directive:ionContent} instead.\n *\n * @param {string=} delegate-handle The handle used to identify this scrollView\n * with {@link ionic.service:$ionicScrollDelegate}.\n * @param {string=} direction Which way to scroll. 'x' or 'y' or 'xy'. Default 'y'.\n * @param {boolean=} locking Whether to lock scrolling in one direction at a time. Useful to set to false when zoomed in or scrolling in two directions. Default true.\n * @param {boolean=} paging Whether to scroll with paging.\n * @param {expression=} on-refresh Called on pull-to-refresh, triggered by an {@link ionic.directive:ionRefresher}.\n * @param {expression=} on-scroll Called whenever the user scrolls.\n * @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.\n * @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.\n * @param {boolean=} zooming Whether to support pinch-to-zoom\n * @param {integer=} min-zoom The smallest zoom amount allowed (default is 0.5)\n * @param {integer=} max-zoom The largest zoom amount allowed (default is 3)\n * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges\n * of the content.  Defaults to true on iOS, false on Android.\n */\nIonicModule\n.directive('ionScroll', [\n  '$timeout',\n  '$controller',\n  '$ionicBind',\nfunction($timeout, $controller, $ionicBind) {\n  return {\n    restrict: 'E',\n    scope: true,\n    controller: function() {},\n    compile: function(element, attr) {\n      element.addClass('scroll-view ionic-scroll');\n\n      //We cannot transclude here because it breaks element.data() inheritance on compile\n      var innerElement = jqLite('<div class=\"scroll\"></div>');\n      innerElement.append(element.contents());\n      element.append(innerElement);\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr) {\n        var scrollView, scrollCtrl;\n\n        $ionicBind($scope, $attr, {\n          direction: '@',\n          paging: '@',\n          $onScroll: '&onScroll',\n          scroll: '@',\n          scrollbarX: '@',\n          scrollbarY: '@',\n          zooming: '@',\n          minZoom: '@',\n          maxZoom: '@'\n        });\n        $scope.direction = $scope.direction || 'y';\n\n        if (angular.isDefined($attr.padding)) {\n          $scope.$watch($attr.padding, function(newVal) {\n            innerElement.toggleClass('padding', !!newVal);\n          });\n        }\n        if($scope.$eval($scope.paging) === true) {\n          innerElement.addClass('scroll-paging');\n        }\n\n        if(!$scope.direction) { $scope.direction = 'y'; }\n        var isPaging = $scope.$eval($scope.paging) === true;\n\n        var scrollViewOptions= {\n          el: $element[0],\n          delegateHandle: $attr.delegateHandle,\n          locking: ($attr.locking || 'true') === 'true',\n          bouncing: $scope.$eval($attr.hasBouncing),\n          paging: isPaging,\n          scrollbarX: $scope.$eval($scope.scrollbarX) !== false,\n          scrollbarY: $scope.$eval($scope.scrollbarY) !== false,\n          scrollingX: $scope.direction.indexOf('x') >= 0,\n          scrollingY: $scope.direction.indexOf('y') >= 0,\n          zooming: $scope.$eval($scope.zooming) === true,\n          maxZoom: $scope.$eval($scope.maxZoom) || 3,\n          minZoom: $scope.$eval($scope.minZoom) || 0.5\n        };\n        if (isPaging) {\n          scrollViewOptions.speedMultiplier = 0.8;\n          scrollViewOptions.bouncing = false;\n        }\n\n        scrollCtrl = $controller('$ionicScroll', {\n          $scope: $scope,\n          scrollViewOptions: scrollViewOptions\n        });\n        scrollView = $scope.$parent.scrollView = scrollCtrl.scrollView;\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionSideMenu\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * A container for a side menu, sibling to an {@link ionic.directive:ionSideMenuContent} directive.\n *\n * @usage\n * ```html\n * <ion-side-menu\n *   side=\"left\"\n *   width=\"myWidthValue + 20\"\n *   is-enabled=\"shouldLeftSideMenuBeEnabled()\">\n * </ion-side-menu>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n *\n * @param {string} side Which side the side menu is currently on.  Allowed values: 'left' or 'right'.\n * @param {boolean=} is-enabled Whether this side menu is enabled.\n * @param {number=} width How many pixels wide the side menu should be.  Defaults to 275.\n */\nIonicModule\n.directive('ionSideMenu', function() {\n  return {\n    restrict: 'E',\n    require: '^ionSideMenus',\n    scope: true,\n    compile: function(element, attr) {\n      angular.isUndefined(attr.isEnabled) && attr.$set('isEnabled', 'true');\n      angular.isUndefined(attr.width) && attr.$set('width', '275');\n\n      element.addClass('menu menu-' + attr.side);\n\n      return function($scope, $element, $attr, sideMenuCtrl) {\n        $scope.side = $attr.side || 'left';\n\n        var sideMenu = sideMenuCtrl[$scope.side] = new ionic.views.SideMenu({\n          width: 275,\n          el: $element[0],\n          isEnabled: true\n        });\n\n        $scope.$watch($attr.width, function(val) {\n          var numberVal = +val;\n          if (numberVal && numberVal == val) {\n            sideMenu.setWidth(+val);\n          }\n        });\n        $scope.$watch($attr.isEnabled, function(val) {\n          sideMenu.setIsEnabled(!!val);\n        });\n      };\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionSideMenuContent\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * A container for the main visible content, sibling to one or more\n * {@link ionic.directive:ionSideMenu} directives.\n *\n * @usage\n * ```html\n * <ion-side-menu-content\n *   edge-drag-threshold=\"true\"\n *   drag-content=\"true\">\n * </ion-side-menu-content>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n *\n * @param {boolean=} drag-content Whether the content can be dragged. Default true.\n * @param {boolean|number=} edge-drag-threshold Whether the content drag can only start if it is below a certain threshold distance from the edge of the screen.  Default false. Accepts three types of values:\n   *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.\n   *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.\n   *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.\n *\n */\nIonicModule\n.directive('ionSideMenuContent', [\n  '$timeout',\n  '$ionicGesture',\n  '$window',\nfunction($timeout, $ionicGesture, $window) {\n\n  return {\n    restrict: 'EA', //DEPRECATED 'A'\n    require: '^ionSideMenus',\n    scope: true,\n    compile: function(element, attr) {\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, sideMenuCtrl) {\n        var startCoord = null;\n        var primaryScrollAxis = null;\n\n        $element.addClass('menu-content pane');\n\n        if (isDefined(attr.dragContent)) {\n          $scope.$watch(attr.dragContent, function(value) {\n            sideMenuCtrl.canDragContent(value);\n          });\n        } else {\n          sideMenuCtrl.canDragContent(true);\n        }\n\n        if (isDefined(attr.edgeDragThreshold)) {\n          $scope.$watch(attr.edgeDragThreshold, function(value) {\n            sideMenuCtrl.edgeDragThreshold(value);\n          });\n        }\n\n        // Listen for taps on the content to close the menu\n        function onContentTap(gestureEvt) {\n          if(sideMenuCtrl.getOpenAmount() !== 0) {\n            sideMenuCtrl.close();\n            gestureEvt.gesture.srcEvent.preventDefault();\n            startCoord = null;\n            primaryScrollAxis = null;\n          } else if(!startCoord) {\n            startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n          }\n        }\n\n        function onDragX(e) {\n          if(!sideMenuCtrl.isDraggableTarget(e)) return;\n\n          if( getPrimaryScrollAxis(e) == 'x') {\n            sideMenuCtrl._handleDrag(e);\n            e.gesture.srcEvent.preventDefault();\n          }\n        }\n\n        function onDragY(e) {\n          if( getPrimaryScrollAxis(e) == 'x' ) {\n            e.gesture.srcEvent.preventDefault();\n          }\n        }\n\n        function onDragRelease(e) {\n          sideMenuCtrl._endDrag(e);\n          startCoord = null;\n          primaryScrollAxis = null;\n        }\n\n        function getPrimaryScrollAxis(gestureEvt) {\n          // gets whether the user is primarily scrolling on the X or Y\n          // If a majority of the drag has been on the Y since the start of\n          // the drag, but the X has moved a little bit, it's still a Y drag\n\n          if(primaryScrollAxis) {\n            // we already figured out which way they're scrolling\n            return primaryScrollAxis;\n          }\n\n          if(gestureEvt && gestureEvt.gesture) {\n\n            if(!startCoord) {\n              // get the starting point\n              startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n\n            } else {\n              // we already have a starting point, figure out which direction they're going\n              var endCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n\n              var xDistance = Math.abs(endCoord.x - startCoord.x);\n              var yDistance = Math.abs(endCoord.y - startCoord.y);\n\n              var scrollAxis = ( xDistance < yDistance ? 'y' : 'x' );\n\n              if( Math.max(xDistance, yDistance) > 30 ) {\n                // ok, we pretty much know which way they're going\n                // let's lock it in\n                primaryScrollAxis = scrollAxis;\n              }\n\n              return scrollAxis;\n            }\n          }\n          return 'x';\n        }\n\n        var content = {\n          element: element[0],\n          onDrag: function(e) {},\n          endDrag: function(e) {},\n          getTranslateX: function() {\n            return $scope.sideMenuContentTranslateX || 0;\n          },\n          setTranslateX: ionic.animationFrameThrottle(function(amount) {\n            var xTransform = content.offsetX + amount;\n            $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + xTransform + 'px,0,0)';\n            $timeout(function() {\n              $scope.sideMenuContentTranslateX = amount;\n            });\n          }),\n          setMarginLeft: ionic.animationFrameThrottle(function(amount) {\n            if(amount) {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amount + 'px,0,0)';\n              $element[0].style.width = ($window.innerWidth - amount) + 'px';\n              content.offsetX = amount;\n            } else {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n              $element[0].style.width = '';\n              content.offsetX = 0;\n            }\n          }),\n          enableAnimation: function() {\n            $scope.animationEnabled = true;\n            $element[0].classList.add('menu-animated');\n          },\n          disableAnimation: function() {\n            $scope.animationEnabled = false;\n            $element[0].classList.remove('menu-animated');\n          },\n          offsetX: 0\n        };\n\n        sideMenuCtrl.setContent(content);\n\n        // add gesture handlers\n        var gestureOpts = { stop_browser_behavior: false };\n        var contentTapGesture = $ionicGesture.on('tap', onContentTap, $element, gestureOpts);\n        var dragRightGesture = $ionicGesture.on('dragright', onDragX, $element, gestureOpts);\n        var dragLeftGesture = $ionicGesture.on('dragleft', onDragX, $element, gestureOpts);\n        var dragUpGesture = $ionicGesture.on('dragup', onDragY, $element, gestureOpts);\n        var dragDownGesture = $ionicGesture.on('dragdown', onDragY, $element, gestureOpts);\n        var releaseGesture = $ionicGesture.on('release', onDragRelease, $element, gestureOpts);\n\n        // Cleanup\n        $scope.$on('$destroy', function() {\n          $ionicGesture.off(dragLeftGesture, 'dragleft', onDragX);\n          $ionicGesture.off(dragRightGesture, 'dragright', onDragX);\n          $ionicGesture.off(dragUpGesture, 'dragup', onDragY);\n          $ionicGesture.off(dragDownGesture, 'dragdown', onDragY);\n          $ionicGesture.off(releaseGesture, 'release', onDragRelease);\n          $ionicGesture.off(contentTapGesture, 'tap', onContentTap);\n        });\n      }\n    }\n  };\n}]);\n\nIonicModule\n\n/**\n * @ngdoc directive\n * @name ionSideMenus\n * @module ionic\n * @delegate ionic.service:$ionicSideMenuDelegate\n * @restrict E\n *\n * @description\n * A container element for side menu(s) and the main content. Allows the left\n * and/or right side menu to be toggled by dragging the main content area side\n * to side.\n *\n * To automatically close an opened menu you can add the {@link ionic.directive:menuClose}\n * attribute directive. Including the `menu-close` attribute is usually added to\n * links and buttons within `ion-side-menu` content, so that when the element is\n * clicked then the opened side menu will automatically close.\n *\n * By default, side menus are hidden underneath its side menu content, and can be opened by\n * either swiping the content left or right, or toggling a button to show the side menu. However,\n * by adding the {@link ionic.directive:exposeAsideWhen} attribute directive to an\n * {@link ionic.directive:ionSideMenu} element directive, a side menu can be given instructions\n * on \"when\" the menu should be exposed (always viewable).\n *\n * ![Side Menu](http://ionicframework.com.s3.amazonaws.com/docs/controllers/sidemenu.gif)\n *\n * For more information on side menus, check out:\n *\n * - {@link ionic.directive:ionSideMenuContent}\n * - {@link ionic.directive:ionSideMenu}\n * - {@link ionic.directive:menuClose}\n * - {@link ionic.directive:exposeAsideWhen}\n *\n * @usage\n * To use side menus, add an `<ion-side-menus>` parent element,\n * an `<ion-side-menu-content>` for the center content,\n * and one or more `<ion-side-menu>` directives.\n *\n * ```html\n * <ion-side-menus>\n *   <!-- Center content -->\n *   <ion-side-menu-content ng-controller=\"ContentController\">\n *   </ion-side-menu-content>\n *\n *   <!-- Left menu -->\n *   <ion-side-menu side=\"left\">\n *   </ion-side-menu>\n *\n *   <!-- Right menu -->\n *   <ion-side-menu side=\"right\">\n *   </ion-side-menu>\n * </ion-side-menus>\n * ```\n * ```js\n * function ContentController($scope, $ionicSideMenuDelegate) {\n *   $scope.toggleLeft = function() {\n *     $ionicSideMenuDelegate.toggleLeft();\n *   };\n * }\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this side menu\n * with {@link ionic.service:$ionicSideMenuDelegate}.\n *\n */\n.directive('ionSideMenus', ['$ionicBody', function($ionicBody) {\n  return {\n    restrict: 'ECA',\n    controller: '$ionicSideMenus',\n    compile: function(element, attr) {\n      attr.$set('class', (attr['class'] || '') + ' view');\n\n      return { pre: prelink };\n      function prelink($scope) {\n\n        $scope.$on('$ionicExposeAside', function(evt, isAsideExposed){\n          if(!$scope.$exposeAside) $scope.$exposeAside = {};\n          $scope.$exposeAside.active = isAsideExposed;\n          $ionicBody.enableClass(isAsideExposed, 'aside-open');\n        });\n\n        $scope.$on('$destroy', function(){\n          $ionicBody.removeClass('menu-open', 'aside-open');\n        });\n\n      }\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionSlideBox\n * @module ionic\n * @delegate ionic.service:$ionicSlideBoxDelegate\n * @restrict E\n * @description\n * The Slide Box is a multi-page container where each page can be swiped or dragged between:\n *\n * ![SlideBox](http://ionicframework.com.s3.amazonaws.com/docs/controllers/slideBox.gif)\n *\n * @usage\n * ```html\n * <ion-slide-box on-slide-changed=\"slideHasChanged($index)\">\n *   <ion-slide>\n *     <div class=\"box blue\"><h1>BLUE</h1></div>\n *   </ion-slide>\n *   <ion-slide>\n *     <div class=\"box yellow\"><h1>YELLOW</h1></div>\n *   </ion-slide>\n *   <ion-slide>\n *     <div class=\"box pink\"><h1>PINK</h1></div>\n *   </ion-slide>\n * </ion-slide-box>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this slideBox\n * with {@link ionic.service:$ionicSlideBoxDelegate}.\n * @param {boolean=} does-continue Whether the slide box should loop.\n * @param {boolean=} auto-play Whether the slide box should automatically slide. Default true if does-continue is true.\n * @param {number=} slide-interval How many milliseconds to wait to change slides (if does-continue is true). Defaults to 4000.\n * @param {boolean=} show-pager Whether a pager should be shown for this slide box.\n * @param {expression=} pager-click Expression to call when a pager is clicked (if show-pager is true). Is passed the 'index' variable.\n * @param {expression=} on-slide-changed Expression called whenever the slide is changed.  Is passed an '$index' variable.\n * @param {expression=} active-slide Model to bind the current slide to.\n */\nIonicModule\n.directive('ionSlideBox', [\n  '$timeout',\n  '$compile',\n  '$ionicSlideBoxDelegate',\nfunction($timeout, $compile, $ionicSlideBoxDelegate) {\n  return {\n    restrict: 'E',\n    replace: true,\n    transclude: true,\n    scope: {\n      autoPlay: '=',\n      doesContinue: '@',\n      slideInterval: '@',\n      showPager: '@',\n      pagerClick: '&',\n      disableScroll: '@',\n      onSlideChanged: '&',\n      activeSlide: '=?'\n    },\n    controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {\n      var _this = this;\n\n      var continuous = $scope.$eval($scope.doesContinue) === true;\n      var shouldAutoPlay = isDefined($attrs.autoPlay) ? !!$scope.autoPlay : false;\n      var slideInterval = shouldAutoPlay ? $scope.$eval($scope.slideInterval) || 4000 : 0;\n\n      var slider = new ionic.views.Slider({\n        el: $element[0],\n        auto: slideInterval,\n        continuous: continuous,\n        startSlide: $scope.activeSlide,\n        slidesChanged: function() {\n          $scope.currentSlide = slider.currentIndex();\n\n          // Try to trigger a digest\n          $timeout(function() {});\n        },\n        callback: function(slideIndex) {\n          $scope.currentSlide = slideIndex;\n          $scope.onSlideChanged({ index: $scope.currentSlide, $index: $scope.currentSlide});\n          $scope.$parent.$broadcast('slideBox.slideChanged', slideIndex);\n          $scope.activeSlide = slideIndex;\n          // Try to trigger a digest\n          $timeout(function() {});\n        }\n      });\n\n      slider.enableSlide($scope.$eval($attrs.disableScroll) !== true);\n\n      $scope.$watch('activeSlide', function(nv) {\n        if(angular.isDefined(nv)){\n          slider.slide(nv);\n        }\n      });\n\n      $scope.$on('slideBox.nextSlide', function() {\n        slider.next();\n      });\n\n      $scope.$on('slideBox.prevSlide', function() {\n        slider.prev();\n      });\n\n      $scope.$on('slideBox.setSlide', function(e, index) {\n        slider.slide(index);\n      });\n\n      //Exposed for testing\n      this.__slider = slider;\n\n      var deregisterInstance = $ionicSlideBoxDelegate._registerInstance(slider, $attrs.delegateHandle);\n      $scope.$on('$destroy', deregisterInstance);\n\n      this.slidesCount = function() {\n        return slider.slidesCount();\n      };\n\n      this.onPagerClick = function(index) {\n        void 0;\n        $scope.pagerClick({index: index});\n      };\n\n      $timeout(function() {\n        slider.load();\n      });\n    }],\n    template: '<div class=\"slider\">' +\n      '<div class=\"slider-slides\" ng-transclude>' +\n      '</div>' +\n    '</div>',\n\n    link: function($scope, $element, $attr, slideBoxCtrl) {\n      // If the pager should show, append it to the slide box\n      if($scope.$eval($scope.showPager) !== false) {\n        var childScope = $scope.$new();\n        var pager = jqLite('<ion-pager></ion-pager>');\n        $element.append(pager);\n        $compile(pager)(childScope);\n      }\n    }\n  };\n}])\n.directive('ionSlide', function() {\n  return {\n    restrict: 'E',\n    require: '^ionSlideBox',\n    compile: function(element, attr) {\n      element.addClass('slider-slide');\n      return function($scope, $element, $attr) {\n      };\n    },\n  };\n})\n\n.directive('ionPager', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '^ionSlideBox',\n    template: '<div class=\"slider-pager\"><span class=\"slider-pager-page\" ng-repeat=\"slide in numSlides() track by $index\" ng-class=\"{active: $index == currentSlide}\" ng-click=\"pagerClick($index)\"><i class=\"icon ion-record\"></i></span></div>',\n    link: function($scope, $element, $attr, slideBox) {\n      var selectPage = function(index) {\n        var children = $element[0].children;\n        var length = children.length;\n        for(var i = 0; i < length; i++) {\n          if(i == index) {\n            children[i].classList.add('active');\n          } else {\n            children[i].classList.remove('active');\n          }\n        }\n      };\n\n      $scope.pagerClick = function(index) {\n        slideBox.onPagerClick(index);\n      };\n\n      $scope.numSlides = function() {\n        return new Array(slideBox.slidesCount());\n      };\n\n      $scope.$watch('currentSlide', function(v) {\n        selectPage(v);\n      });\n    }\n  };\n\n});\n\nIonicModule.constant('$ionicTabConfig', {\n  type: ''\n});\n\n/**\n * @ngdoc directive\n * @name ionTab\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionTabs\n *\n * @description\n * Contains a tab's content.  The content only exists while the given tab is selected.\n *\n * Each ionTab has its own view history.\n *\n * @usage\n * ```html\n * <ion-tab\n *   title=\"Tab!\"\n *   icon=\"my-icon\"\n *   href=\"#/tab/tab-link\"\n *   on-select=\"onTabSelected()\"\n *   on-deselect=\"onTabDeselected()\">\n * </ion-tab>\n * ```\n * For a complete, working tab bar example, see the {@link ionic.directive:ionTabs} documentation.\n *\n * @param {string} title The title of the tab.\n * @param {string=} href The link that this tab will navigate to when tapped.\n * @param {string=} icon The icon of the tab. If given, this will become the default for icon-on and icon-off.\n * @param {string=} icon-on The icon of the tab while it is selected.\n * @param {string=} icon-off The icon of the tab while it is not selected.\n * @param {expression=} badge The badge to put on this tab (usually a number).\n * @param {expression=} badge-style The style of badge to put on this tab (eg tabs-positive).\n * @param {expression=} on-select Called when this tab is selected.\n * @param {expression=} on-deselect Called when this tab is deselected.\n * @param {expression=} ng-click By default, the tab will be selected on click. If ngClick is set, it will not.  You can explicitly switch tabs using {@link ionic.service:$ionicTabsDelegate#select $ionicTabsDelegate.select()}.\n */\nIonicModule\n.directive('ionTab', [\n  '$rootScope',\n  '$animate',\n  '$ionicBind',\n  '$compile',\nfunction($rootScope, $animate, $ionicBind, $compile) {\n\n  //Returns ' key=\"value\"' if value exists\n  function attrStr(k,v) {\n    return angular.isDefined(v) ? ' ' + k + '=\"' + v + '\"' : '';\n  }\n  return {\n    restrict: 'E',\n    require: ['^ionTabs', 'ionTab'],\n    replace: true,\n    controller: '$ionicTab',\n    scope: true,\n    compile: function(element, attr) {\n\n      //We create the tabNavTemplate in the compile phase so that the\n      //attributes we pass down won't be interpolated yet - we want\n      //to pass down the 'raw' versions of the attributes\n      var tabNavTemplate = '<ion-tab-nav' +\n        attrStr('ng-click', attr.ngClick) +\n        attrStr('title', attr.title) +\n        attrStr('icon', attr.icon) +\n        attrStr('icon-on', attr.iconOn) +\n        attrStr('icon-off', attr.iconOff) +\n        attrStr('badge', attr.badge) +\n        attrStr('badge-style', attr.badgeStyle) +\n        attrStr('hidden', attr.hidden) +\n        attrStr('class', attr['class']) +\n        '></ion-tab-nav>';\n\n      //Remove the contents of the element so we can compile them later, if tab is selected\n      //We don't use regular transclusion because it breaks element inheritance\n      var tabContent = jqLite('<div class=\"pane\">')\n        .append( element.contents().remove() );\n\n      return function link($scope, $element, $attr, ctrls) {\n        var childScope;\n        var childElement;\n        var tabsCtrl = ctrls[0];\n        var tabCtrl = ctrls[1];\n\n        var navView = tabContent[0].querySelector('ion-nav-view') ||\n          tabContent[0].querySelector('data-ion-nav-view');\n        var navViewName = navView && navView.getAttribute('name');\n\n        $ionicBind($scope, $attr, {\n          animate: '=',\n          onSelect: '&',\n          onDeselect: '&',\n          title: '@',\n          uiSref: '@',\n          href: '@',\n        });\n\n        tabsCtrl.add($scope);\n        $scope.$on('$destroy', function() {\n          tabsCtrl.remove($scope);\n          tabNavElement.isolateScope().$destroy();\n          tabNavElement.remove();\n        });\n\n        //Remove title attribute so browser-tooltip does not apear\n        $element[0].removeAttribute('title');\n\n        if (navViewName) {\n          tabCtrl.navViewName = $scope.navViewName = navViewName;\n        }\n        $scope.$on('$stateChangeSuccess', selectIfMatchesState);\n        selectIfMatchesState();\n        function selectIfMatchesState() {\n          if (tabCtrl.tabMatchesState()) {\n            tabsCtrl.select($scope, false);\n          }\n        }\n\n        var tabNavElement = jqLite(tabNavTemplate);\n        tabNavElement.data('$ionTabsController', tabsCtrl);\n        tabNavElement.data('$ionTabController', tabCtrl);\n        tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope));\n\n        $scope.$watch('$tabSelected', function(value) {\n          childScope && childScope.$destroy();\n          childScope = null;\n          childElement && $animate.leave(childElement);\n          childElement = null;\n          if (value) {\n            childScope = $scope.$new();\n            childElement = tabContent.clone();\n            $animate.enter(childElement, tabsCtrl.$element);\n            $compile(childElement)(childScope);\n          }\n        });\n\n      };\n    }\n  };\n}]);\n\nIonicModule\n.directive('ionTabNav', [function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: ['^ionTabs', '^ionTab'],\n    template:\n    '<a ng-class=\"{\\'tab-item-active\\': isTabActive(), \\'has-badge\\':badge, \\'tab-hidden\\':isHidden()}\" ' +\n      ' class=\"tab-item\">' +\n      '<span class=\"badge {{badgeStyle}}\" ng-if=\"badge\">{{badge}}</span>' +\n      '<i class=\"icon {{getIconOn()}}\" ng-if=\"getIconOn() && isTabActive()\"></i>' +\n      '<i class=\"icon {{getIconOff()}}\" ng-if=\"getIconOff() && !isTabActive()\"></i>' +\n      '<span class=\"tab-title\" ng-bind-html=\"title\"></span>' +\n    '</a>',\n    scope: {\n      title: '@',\n      icon: '@',\n      iconOn: '@',\n      iconOff: '@',\n      badge: '=',\n      hidden: '@',\n      badgeStyle: '@',\n      'class': '@'\n    },\n    compile: function(element, attr, transclude) {\n      return function link($scope, $element, $attrs, ctrls) {\n        var tabsCtrl = ctrls[0],\n          tabCtrl = ctrls[1];\n\n        //Remove title attribute so browser-tooltip does not apear\n        $element[0].removeAttribute('title');\n\n        $scope.selectTab = function(e) {\n          e.preventDefault();\n          tabsCtrl.select(tabCtrl.$scope, true);\n        };\n        if (!$attrs.ngClick) {\n          $element.on('click', function(event) {\n            $scope.$apply(function() {\n              $scope.selectTab(event);\n            });\n          });\n        }\n\n        $scope.isHidden = function() {\n          if($attrs.hidden === 'true' || $attrs.hidden === true)return true;\n          return false;\n        };\n\n        $scope.getIconOn = function() {\n          return $scope.iconOn || $scope.icon;\n        };\n        $scope.getIconOff = function() {\n          return $scope.iconOff || $scope.icon;\n        };\n\n        $scope.isTabActive = function() {\n          return tabsCtrl.selectedTab() === tabCtrl.$scope;\n        };\n      };\n    }\n  };\n}]);\n\nIonicModule.constant('$ionicTabsConfig', {\n  position: '',\n  type: ''\n});\n\n/**\n * @ngdoc directive\n * @name ionTabs\n * @module ionic\n * @delegate ionic.service:$ionicTabsDelegate\n * @restrict E\n * @codepen KbrzJ\n *\n * @description\n * Powers a multi-tabbed interface with a Tab Bar and a set of \"pages\" that can be tabbed\n * through.\n *\n * Assign any [tabs class](/docs/components#tabs) or\n * [animation class](/docs/components#animation) to the element to define\n * its look and feel.\n *\n * See the {@link ionic.directive:ionTab} directive's documentation for more details on\n * individual tabs.\n *\n * Note: do not place ion-tabs inside of an ion-content element; it has been known to cause a\n * certain CSS bug.\n *\n * @usage\n * ```html\n * <ion-tabs class=\"tabs-positive tabs-icon-only\">\n *\n *   <ion-tab title=\"Home\" icon-on=\"ion-ios7-filing\" icon-off=\"ion-ios7-filing-outline\">\n *     <!-- Tab 1 content -->\n *   </ion-tab>\n *\n *   <ion-tab title=\"About\" icon-on=\"ion-ios7-clock\" icon-off=\"ion-ios7-clock-outline\">\n *     <!-- Tab 2 content -->\n *   </ion-tab>\n *\n *   <ion-tab title=\"Settings\" icon-on=\"ion-ios7-gear\" icon-off=\"ion-ios7-gear-outline\">\n *     <!-- Tab 3 content -->\n *   </ion-tab>\n *\n * </ion-tabs>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify these tabs\n * with {@link ionic.service:$ionicTabsDelegate}.\n */\n\nIonicModule\n.directive('ionTabs', [\n  '$ionicViewService', \n  '$ionicTabsDelegate', \n  '$ionicTabsConfig', \nfunction($ionicViewService, $ionicTabsDelegate, $ionicTabsConfig) {\n  return {\n    restrict: 'E',\n    scope: true,\n    controller: '$ionicTabs',\n    compile: function(element, attr) {\n      element.addClass('view');\n      //We cannot use regular transclude here because it breaks element.data()\n      //inheritance on compile\n      var innerElement = jqLite('<div class=\"tabs\"></div>');\n      innerElement.append(element.contents());\n      element.append(innerElement);\n      element.addClass($ionicTabsConfig.position);\n      element.addClass($ionicTabsConfig.type);\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, tabsCtrl) {\n        var deregisterInstance = $ionicTabsDelegate._registerInstance(\n          tabsCtrl, $attr.delegateHandle\n        );\n\n        $scope.$on('$destroy', deregisterInstance);\n\n        tabsCtrl.$scope = $scope;\n        tabsCtrl.$element = $element;\n        tabsCtrl.$tabsElement = jqLite($element[0].querySelector('.tabs'));\n\n        var el = $element[0];\n        $scope.$watch(function() { return el.className; }, function(value) {\n          var isTabsTop = value.indexOf('tabs-top') !== -1;\n          var isHidden = value.indexOf('tabs-item-hide') !== -1;\n          $scope.$hasTabs = !isTabsTop && !isHidden;\n          $scope.$hasTabsTop = isTabsTop && !isHidden;\n        });\n        $scope.$on('$destroy', function() {\n          delete $scope.$hasTabs;\n          delete $scope.$hasTabsTop;\n        });\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionToggle\n * @module ionic\n * @codepen tfAzj\n * @restrict E\n *\n * @description\n * A toggle is an animated switch which binds a given model to a boolean.\n *\n * Allows dragging of the switch's nub.\n *\n * The toggle behaves like any [AngularJS checkbox](http://docs.angularjs.org/api/ng/input/input[checkbox]) otherwise.\n *\n * @param toggle-class {string=} Sets the CSS class on the inner `label.toggle` element created by the directive.\n *\n * @usage\n * Below is an example of a toggle directive which is wired up to the `airplaneMode` model\n * and has the `toggle-calm` CSS class assigned to the inner element.\n *\n * ```html\n * <ion-toggle ng-model=\"airplaneMode\" toggle-class=\"toggle-calm\">Airplane Mode</ion-toggle>\n * ```\n */\nIonicModule\n.directive('ionToggle', [\n  '$ionicGesture',\n  '$timeout',\nfunction($ionicGesture, $timeout) {\n\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<div class=\"item item-toggle\">' +\n        '<div ng-transclude></div>' +\n        '<label class=\"toggle\">' +\n          '<input type=\"checkbox\">' +\n          '<div class=\"track\">' +\n            '<div class=\"handle\"></div>' +\n          '</div>' +\n        '</label>' +\n      '</div>',\n\n    compile: function(element, attr) {\n      var input = element.find('input');\n      forEach({\n        'name': attr.name,\n        'ng-value': attr.ngValue,\n        'ng-model': attr.ngModel,\n        'ng-checked': attr.ngChecked,\n        'ng-disabled': attr.ngDisabled,\n        'ng-true-value': attr.ngTrueValue,\n        'ng-false-value': attr.ngFalseValue,\n        'ng-change': attr.ngChange\n      }, function(value, name) {\n        if (isDefined(value)) {\n          input.attr(name, value);\n        }\n      });\n\n      if(attr.toggleClass) {\n        element[0].getElementsByTagName('label')[0].classList.add(attr.toggleClass);\n      }\n\n      return function($scope, $element, $attr) {\n         var el, checkbox, track, handle;\n\n         el = $element[0].getElementsByTagName('label')[0];\n         checkbox = el.children[0];\n         track = el.children[1];\n         handle = track.children[0];\n\n         var ngModelController = jqLite(checkbox).controller('ngModel');\n\n         $scope.toggle = new ionic.views.Toggle({\n           el: el,\n           track: track,\n           checkbox: checkbox,\n           handle: handle,\n           onChange: function() {\n             if(checkbox.checked) {\n               ngModelController.$setViewValue(true);\n             } else {\n               ngModelController.$setViewValue(false);\n             }\n             $scope.$apply();\n           }\n         });\n\n         $scope.$on('$destroy', function() {\n           $scope.toggle.destroy();\n         });\n      };\n    }\n\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionView\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n * A container for content, used to tell a parent {@link ionic.directive:ionNavBar}\n * about the current view.\n *\n * @usage\n * Below is an example where our page will load with a navbar containing \"My Page\" as the title.\n *\n * ```html\n * <ion-nav-bar></ion-nav-bar>\n * <ion-nav-view class=\"slide-left-right\">\n *   <ion-view title=\"My Page\">\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n * @param {string=} title The title to display on the parent {@link ionic.directive:ionNavBar}.\n * @param {boolean=} hide-back-button Whether to hide the back button on the parent\n * {@link ionic.directive:ionNavBar} by default.\n * @param {boolean=} hide-nav-bar Whether to hide the parent\n * {@link ionic.directive:ionNavBar} by default.\n */\nIonicModule\n.directive('ionView', ['$ionicViewService', '$rootScope', '$animate',\n           function( $ionicViewService,   $rootScope,   $animate) {\n  return {\n    restrict: 'EA',\n    priority: 1000,\n    require: ['^?ionNavBar', '^?ionModal'],\n    compile: function(tElement, tAttrs, transclude) {\n      tElement.addClass('pane');\n      tElement[0].removeAttribute('title');\n\n      return function link($scope, $element, $attr, ctrls) {\n        var navBarCtrl = ctrls[0];\n        var modalCtrl = ctrls[1];\n\n        //Don't use the ionView if we're inside a modal or there's no navbar\n        if (!navBarCtrl || modalCtrl) {\n          return;\n        }\n\n        if (angular.isDefined($attr.title)) {\n\n          var initialTitle = $attr.title;\n          navBarCtrl.changeTitle(initialTitle, $scope.$navDirection);\n\n          // watch for changes in the title, don't set initial value as changeTitle does that\n          $attr.$observe('title', function(val, oldVal) {\n            navBarCtrl.setTitle(val);\n          });\n        }\n\n        var hideBackAttr = angular.isDefined($attr.hideBackButton) ?\n          $attr.hideBackButton :\n          'false';\n        $scope.$watch(hideBackAttr, function(value) {\n          // Should we hide a back button when this tab is shown\n          navBarCtrl.showBackButton(!value);\n        });\n\n        var hideNavAttr = angular.isDefined($attr.hideNavBar) ?\n          $attr.hideNavBar :\n          'false';\n        $scope.$watch(hideNavAttr, function(value) {\n          // Should the nav bar be hidden for this view or not?\n          navBarCtrl.showBar(!value);\n        });\n\n      };\n    }\n  };\n}]);\n\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.collide=e()}}(function(){var define,module,exports;return (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);throw new Error(\"Cannot find module '\"+o+\"'\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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(_dereq_,module,exports){\n(function (process){\n// Generated by CoffeeScript 1.6.3\n(function() {\n  var getNanoSeconds, hrtime, loadTime;\n\n  if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n    module.exports = function() {\n      return performance.now();\n    };\n  } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n    module.exports = function() {\n      return (getNanoSeconds() - loadTime) / 1e6;\n    };\n    hrtime = process.hrtime;\n    getNanoSeconds = function() {\n      var hr;\n      hr = hrtime();\n      return hr[0] * 1e9 + hr[1];\n    };\n    loadTime = getNanoSeconds();\n  } else if (Date.now) {\n    module.exports = function() {\n      return Date.now() - loadTime;\n    };\n    loadTime = Date.now();\n  } else {\n    module.exports = function() {\n      return new Date().getTime() - loadTime;\n    };\n    loadTime = new Date().getTime();\n  }\n\n}).call(this);\n\n/*\n//@ sourceMappingURL=performance-now.map\n*/\n\n}).call(this,_dereq_(\"qhDIRT\"))\n},{\"qhDIRT\":13}],2:[function(_dereq_,module,exports){\nvar now = _dereq_('performance-now')\n  , global = typeof window === 'undefined' ? {} : window\n  , vendors = ['moz', 'webkit']\n  , suffix = 'AnimationFrame'\n  , raf = global['request' + suffix]\n  , caf = global['cancel' + suffix] || global['cancelRequest' + suffix]\n\nfor(var i = 0; i < vendors.length && !raf; i++) {\n  raf = global[vendors[i] + 'Request' + suffix]\n  caf = global[vendors[i] + 'Cancel' + suffix]\n      || global[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n  var last = 0\n    , id = 0\n    , queue = []\n    , frameDuration = 1000 / 60\n\n  raf = function(callback) {\n    if(queue.length === 0) {\n      var _now = now()\n        , next = Math.max(0, frameDuration - (_now - last))\n      last = next + _now\n      setTimeout(function() {\n        var cp = queue.slice(0)\n        // Clear queue here to prevent\n        // callbacks from appending listeners\n        // to the current frame's queue\n        queue.length = 0\n        for (var i = 0; i < cp.length; i++) {\n          if (!cp[i].cancelled) {\n            cp[i].callback(last)\n          }\n        }\n      }, next)\n    }\n    queue.push({\n      handle: ++id,\n      callback: callback,\n      cancelled: false\n    })\n    return id\n  }\n\n  caf = function(handle) {\n    for(var i = 0; i < queue.length; i++) {\n      if(queue[i].handle === handle) {\n        queue[i].cancelled = true\n      }\n    }\n  }\n}\n\nmodule.exports = function() {\n  // Wrap in a new function to prevent\n  // `cancel` potentially being assigned\n  // to the native rAF function\n  return raf.apply(global, arguments)\n}\nmodule.exports.cancel = function() {\n  caf.apply(global, arguments)\n}\n\n},{\"performance-now\":3}],3:[function(_dereq_,module,exports){\nmodule.exports=_dereq_(1)\n},{\"qhDIRT\":13}],4:[function(_dereq_,module,exports){\n\n// Interpolation disabled for now\n// var interpolate = require('./core/interpolate');\n// var cssFeature = require('feature/css');\n\nvar timeline = _dereq_('./core/timeline');\nvar dynamics = _dereq_('./core/dynamics');\nvar easingFunctions = _dereq_('./core/easing-functions');\n\nvar uid = _dereq_('./util/uid');\nvar EventEmitter = _dereq_('./util/simple-emitter');\n\nfunction clamp(min, n, max) { return Math.max(min, Math.min(n, max)); }\n\nmodule.exports = Animator;\n\nfunction Animator(opts) {\n  //if `new` keyword isn't provided, do it for user\n  if (!(this instanceof Animator)) {\n    return new Animator(opts);\n  }\n\n  opts = opts || {};\n\n  //Private state goes in this._\n  this._ = {\n    id: uid(),\n    percent: 0,\n    duration: 500,\n    isReverse: false\n  };\n\n  var emitter = this._.emitter = new EventEmitter();\n  this._.onDestroy = function() {\n    emitter.emit('destroy');\n  };\n  this._.onStop = function(wasCompleted) {\n    emitter.emit('stop', wasCompleted);\n    wasCompleted && emitter.emit('complete');\n  };\n  this._.onStart = function() {\n    emitter.emit('start');\n  };\n  this._.onStep = function(v) {\n    emitter.emit('step', v);\n  };\n\n  opts.duration && this.duration(opts.duration);\n  opts.percent && this.percent(opts.percent);\n  opts.easing && this.easing(opts.easing);\n  opts.reverse && this.reverse(opts.reverse);\n}\n\nAnimator.prototype = {\n\n  reverse: function(reverse) {\n    if (arguments.length) {\n      this._.isReverse = !!reverse;\n      return this;\n    }\n    return this._.isReverse;\n  },\n\n  easing: function(easing) {\n    var type = typeof easing;\n    if (arguments.length) {\n      if (type === 'function' || type === 'string' || type === 'object') {\n        this._.easing = figureOutEasing(easing);\n      }\n      return this;\n    }\n    return this._.easing;\n  },\n\n  percent: function(percent) {\n    if (arguments.length) {\n      if (typeof percent === 'number') {\n        this._.percent = clamp(0, percent, 1);\n      }\n      if (!this.isRunning()) {\n        this._.onStep(this._getValueForPercent(this._.percent));\n      }\n      return this;\n    }\n    return this._.percent;\n  },\n\n  duration: function(duration) {\n    if (arguments.length) {\n      if (typeof duration === 'number' && duration > 0) {\n        this._.duration = duration;\n      }\n      return this;\n    }\n    return this._.duration;\n  },\n\n  /**\n   * Interpolation is disabled for now.\n   */\n  // addInterpolation: function(el, startingStyles, endingStyles) {\n  //   var interpolators;\n  //   if (arguments.length) {\n  //     syncStyles(startingStyles, endingStyles, window.getComputedStyle(el));\n  //     interpolators = makePropertyInterpolators(startingStyles, endingStyles);\n\n  //     this.on('step', setStyles);\n  //     return function unbind() {\n  //       this.off('step', setStyles);\n  //     };\n  //   }\n  //   function setStyles(v) {\n  //     for (var property in interpolators) {\n  //       el.style[property] = interpolators[property](v);\n  //     }\n  //   }\n  // },\n\n  isRunning: function() { \n    return !!this._.isRunning; \n  },\n\n  promise: function() {\n    var self = this;\n    return {\n      then: function(cb) {\n        self.once('stop', cb);\n      }\n    };\n  },\n\n  on: function(eventType, listener) {\n    this._.emitter.on(eventType, listener);\n    return this;\n  },\n  once: function(eventType, listener) {\n    this._.emitter.once(eventType, listener);\n    return this;\n  },\n  off: function(eventType, listener) {\n    this._.emitter.off(eventType, listener);\n    return this;\n  },\n\n  destroy: function() {\n    this.stop();\n    this._.onDestroy();\n    this.off();\n    return this;\n  },\n\n  stop: function() {\n    if (!this._.isRunning) return;\n\n    this._.isRunning = false;\n    timeline.animationStopped(this);\n\n    this._.onStop(this._isComplete());\n    return this;\n  },\n\n  restart: function(immediate) {\n    if (this._.isRunning) return;\n\n    this._.percent = this._getStartPercent();\n\n    return this.start(!!immediate);\n  },\n\n  start: function(immediate) {\n    if (this._.isRunning) return;\n\n    if (immediate) {\n      this._.onStep(this._getValueForPercent(this._.percent));\n    } else {\n      this._.isStarting = true;\n    }\n\n    this._.isRunning = true;\n    timeline.animationStarted(this);\n\n    this._.onStart();\n    return this;\n  },\n\n  _isComplete: function() {\n    return !this._.isRunning && \n      this._.percent === this._getEndPercent();\n  },\n  _getEndPercent: function() {\n    return this._.isReverse ? 0 : 1;\n  },\n  _getStartPercent: function() {\n    return this._.isReverse ? 1 : 0;\n  },\n\n  _getValueForPercent: function(percent) {\n    if (this._.easing) {\n      return this._.easing(percent, this._.duration);\n    }\n    return percent;\n  },\n\n  _tick: function(deltaT) {\n    var state = this._;\n\n    //First tick, don't up the percent\n    if (state.isStarting) {\n      state.isStarting = false;\n    } else if (state.isReverse) {\n      state.percent = Math.max(0, state.percent - (deltaT / state.duration));\n    } else {\n      state.percent = Math.min(1, state.percent + (deltaT / state.duration));\n    }\n    \n    state.onStep(this._getValueForPercent(state.percent));\n\n    if (state.percent === this._getEndPercent()) {\n      this.stop();\n    }\n  },\n\n};\n\nfunction figureOutEasing(easing) {\n  if (typeof easing === 'object') {\n    var dynamicType = typeof easing.type === 'string' &&\n      easing.type.toLowerCase().trim();\n\n    if (!dynamics[dynamicType]) {\n      throw new Error(\n        'Invalid easing dynamics object type \"' + easing.type + '\". ' +\n        'Available dynamics types: ' + Object.keys(dynamics).join(', ') + '.'\n      );\n    }\n    return dynamics[dynamicType](easing);\n\n  } else if (typeof easing === 'string') {\n    easing = easing.toLowerCase().trim();\n    \n    if (easing.indexOf('cubic-bezier(') === 0) {\n      var parts = easing\n        .replace('cubic-bezier(', '')\n        .replace(')', '')\n        .split(',')\n        .map(function(v) {\n          return v.trim();\n        });\n      return easingFunctions['cubic-bezier'](parts[0], parts[1], parts[2], parts[3]);\n    } else {\n      var fn = easingFunctions[easing];\n      if (!fn) {\n        throw new Error(\n          'Invalid easing function \"' + easing + '\". ' +\n          'Available easing functions: ' + Object.keys(easingFunctions).join(', ') + '.'\n        );\n      }\n      return easingFunctions[easing]();\n    }\n  } else if (typeof easing === 'function') {\n    return easing;\n  }\n}\n\n// /*\n//  * Tweening helpers\n//  */\n// function syncStyles(startingStyles, endingStyles, computedStyle) {\n//   var property;\n//   for (property in startingStyles) {\n//     if (!endingStyles.hasOwnProperty(property)) {\n//       delete startingStyles[property];\n//     }\n//   }\n//   for (property in endingStyles) {\n//     if (!startingStyles.hasOwnProperty(property)) {\n//       startingStyles[property] = computedStyle[vendorizePropertyName(property)];\n//     }\n//   }\n// }\n\n// function makePropertyInterpolators(startingStyles, endingStyles) {\n//   var interpolators = {};\n//   var property;\n//   for (property in startingStyles) {\n//     interpolators[vendorizePropertyName(property)] = interpolate.propertyInterpolator(\n//       property, startingStyles[property], endingStyles[property]\n//     );\n//   }\n//   return interpolators;\n// }\n\n// var transformProperty;\n// function vendorizePropertyName(property) {\n//   if (property === 'transform') {\n//     //Set transformProperty lazily, to be sure DOM has loaded already when using it\n//     return transformProperty || \n//       (transformProperty = cssFeature('transform').property);\n//   } else {\n//     return property;\n//   }\n// }\n\n},{\"./core/dynamics\":6,\"./core/easing-functions\":7,\"./core/timeline\":8,\"./util/simple-emitter\":11,\"./util/uid\":12}],5:[function(_dereq_,module,exports){\n/*\n * Copyright (C) 2008 Apple Inc. All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// http://www.w3.org/TR/css3-transitions/#transition-easing-function\nmodule.exports =  {\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  linear: unitBezier(0.0, 0.0, 1.0, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  ease: unitBezier(0.25, 0.1, 0.25, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeIn: unitBezier(0.42, 0, 1.0, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeOut: unitBezier(0, 0, 0.58, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeInOut: unitBezier(0.42, 0, 0.58, 1.0),\n\n  /*\n   * @param p1x {number} X component of control point 1\n   * @param p1y {number} Y component of control point 1\n   * @param p2x {number} X component of control point 2\n   * @param p2y {number} Y component of control point 2\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  cubicBezier: function(p1x, p1y, p2x, p2y) {\n    return unitBezier(p1x, p1y, p2x, p2y);\n  }\n};\n\nfunction B1(t) { return t*t*t; }\nfunction B2(t) { return 3*t*t*(1-t); }\nfunction B3(t) { return 3*t*(1-t)*(1-t); }\nfunction B4(t) { return (1-t)*(1-t)*(1-t); }\n\n/*\n * JavaScript port of Webkit implementation of CSS cubic-bezier(p1x.p1y,p2x,p2y) by http://mck.me\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h\n */\n\n/*\n * Duration value to use when one is not specified (400ms is a common value).\n * @const\n * @type {number}\n */\nvar DEFAULT_DURATION = 400;//ms\n\n/*\n * The epsilon value we pass to UnitBezier::solve given that the animation is going to run over |dur| seconds.\n * The longer the animation, the more precision we need in the easing function result to avoid ugly discontinuities.\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/page/animation/AnimationBase.cpp\n */\nfunction solveEpsilon(duration) {\n  return 1.0 / (200.0 * duration);\n}\n\n/*\n * Defines a cubic-bezier curve given the middle two control points.\n * NOTE: first and last control points are implicitly (0,0) and (1,1).\n * @param p1x {number} X component of control point 1\n * @param p1y {number} Y component of control point 1\n * @param p2x {number} X component of control point 2\n * @param p2y {number} Y component of control point 2\n */\nfunction unitBezier(p1x, p1y, p2x, p2y) {\n\n  // private members --------------------------------------------\n\n  // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n\n  /*\n   * X component of Bezier coefficient C\n   * @const\n   * @type {number}\n   */\n  var cx = 3.0 * p1x;\n\n  /*\n   * X component of Bezier coefficient B\n   * @const\n   * @type {number}\n   */\n  var bx = 3.0 * (p2x - p1x) - cx;\n\n  /*\n   * X component of Bezier coefficient A\n   * @const\n   * @type {number}\n   */\n  var ax = 1.0 - cx -bx;\n\n  /*\n   * Y component of Bezier coefficient C\n   * @const\n   * @type {number}\n   */\n  var cy = 3.0 * p1y;\n\n  /*\n   * Y component of Bezier coefficient B\n   * @const\n   * @type {number}\n   */\n  var by = 3.0 * (p2y - p1y) - cy;\n\n  /*\n   * Y component of Bezier coefficient A\n   * @const\n   * @type {number}\n   */\n  var ay = 1.0 - cy - by;\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveX = function(t) {\n    // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n    return ((ax * t + bx) * t + cx) * t;\n  };\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveY = function(t) {\n    return ((ay * t + by) * t + cy) * t;\n  };\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveDerivativeX = function(t) {\n    return (3.0 * ax * t + 2.0 * bx) * t + cx;\n  };\n\n  /*\n   * Given an x value, find a parametric value it came from.\n   * @param x {number} value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param epsilon {number} accuracy limit of t for the given x\n   * @return {number} the t value corresponding to x\n   */\n  var solveCurveX = function(x, epsilon) {\n    var t0;\n    var t1;\n    var t2;\n    var x2;\n    var d2;\n    var i;\n\n    // First try a few iterations of Newton's method -- normally very fast.\n    for (t2 = x, i = 0; i < 8; i++) {\n      x2 = sampleCurveX(t2) - x;\n      if (Math.abs (x2) < epsilon) {\n        return t2;\n      }\n      d2 = sampleCurveDerivativeX(t2);\n      if (Math.abs(d2) < 1e-6) {\n        break;\n      }\n      t2 = t2 - x2 / d2;\n    }\n\n    // Fall back to the bisection method for reliability.\n    t0 = 0.0;\n    t1 = 1.0;\n    t2 = x;\n\n    if (t2 < t0) {\n      return t0;\n    }\n    if (t2 > t1) {\n      return t1;\n    }\n\n    while (t0 < t1) {\n      x2 = sampleCurveX(t2);\n      if (Math.abs(x2 - x) < epsilon) {\n        return t2;\n      }\n      if (x > x2) {\n        t0 = t2;\n      } else {\n        t1 = t2;\n      }\n      t2 = (t1 - t0) * 0.5 + t0;\n    }\n\n    // Failure.\n    return t2;\n  };\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param epsilon {number} the accuracy of t for the given x\n   * @return {number} the y value along the bezier curve\n   */\n  var solve = function(x, epsilon) {\n    return sampleCurveY(solveCurveX(x, epsilon));\n  };\n\n  // public interface --------------------------------------------\n\n  /*\n   * Find the y of the cubic-bezier for a given x with accuracy determined by the animation duration.\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  return function(x, duration) {\n    return solve(x, solveEpsilon(+duration || DEFAULT_DURATION));\n  };\n}\n\n\n},{}],6:[function(_dereq_,module,exports){\n/**\n * A HUGE thank you to dynamics.js which inspired these dynamics simulations.\n * https://github.com/michaelvillar/dynamics.js\n *\n * Also licensed under MIT\n */\n\nvar extend = _dereq_('../util/extend');\n\nmodule.exports = {\n  spring: dynamicsSpring,\n  gravity: dynamicsGravity\n};\n\nvar springDefaults = {\n  frequency: 15,\n  friction: 200,\n  anticipationStrength: 0,\n  anticipationSize: 0\n};\nfunction dynamicsSpring(opts) {\n  opts = extend({}, springDefaults, opts || {});\n\n  return function at(t, duration) {\n    var A, At, a, angle, b, decal, frequency, friction, frictionT, s, v, y0, yS,\n    _opts = opts;\n    frequency = Math.max(1, opts.frequency);\n    friction = Math.pow(20, opts.friction / 100);\n    s = opts.anticipationSize / 100;\n    decal = Math.max(0, s);\n    frictionT = (t / (1 - s)) - (s / (1 - s));\n    if (t < s) {\n      A = function(t) {\n        var M, a, b, x0, x1;\n        M = 0.8;\n        x0 = s / (1 - s);\n        x1 = 0;\n        b = (x0 - (M * x1)) / (x0 - x1);\n        a = (M - b) / x0;\n        return (a * t * _opts.anticipationStrength / 100) + b;\n      };\n      yS = (s / (1 - s)) - (s / (1 - s));\n      y0 = (0 / (1 - s)) - (s / (1 - s));\n      b = Math.acos(1 / A(yS));\n      a = (Math.acos(1 / A(y0)) - b) / (frequency * (-s));\n    } else {\n      A = function(t) {\n        return Math.pow(friction / 10, -t) * (1 - t);\n      };\n      b = 0;\n      a = 1;\n    }\n    At = A(frictionT);\n    angle = frequency * (t - s) * a + b;\n    v = 1 - (At * Math.cos(angle));\n    //return [t, v, At, frictionT, angle];\n    return v;\n  };\n}\n\nvar gravityDefaults = {\n  bounce: 40,\n  gravity: 1000,\n  initialForce: false\n};\nfunction dynamicsGravity(opts) {\n  opts = extend({}, gravityDefaults, opts || {});\n  var curves = [];\n\n  init();\n\n  return at;\n\n  function length() {\n    var L, b, bounce, curve, gravity;\n    bounce = Math.min(opts.bounce / 100, 80);\n    gravity = opts.gravity / 100;\n    b = Math.sqrt(2 / gravity);\n    curve = {\n      a: -b,\n      b: b,\n      H: 1\n    };\n    if (opts.initialForce) {\n      curve.a = 0;\n      curve.b = curve.b * 2;\n    }\n    while (curve.H > 0.001) {\n      L = curve.b - curve.a;\n      curve = {\n        a: curve.b,\n        b: curve.b + L * bounce,\n        H: curve.H * bounce * bounce\n      };\n    }\n    return curve.b;\n  }\n\n  function init() {\n    var L, b, bounce, curve, gravity, _results;\n\n    L = length();\n    gravity = (opts.gravity / 100) * L * L;\n    bounce = Math.min(opts.bounce / 100, 80);\n    b = Math.sqrt(2 / gravity);\n    curves = [];\n    curve = {\n      a: -b,\n      b: b,\n      H: 1\n    };\n    if (opts.initialForce) {\n      curve.a = 0;\n      curve.b = curve.b * 2;\n    }\n    curves.push(curve);\n    _results = [];\n    while (curve.b < 1 && curve.H > 0.001) {\n      L = curve.b - curve.a;\n      curve = {\n        a: curve.b,\n        b: curve.b + L * bounce,\n        H: curve.H * bounce * bounce\n      };\n      _results.push(curves.push(curve));\n    }\n    return _results;\n  }\n\n  function calculateCurve(a, b, H, t){\n    var L, c, t2;\n    L = b - a;\n    t2 = (2 / L) * t - 1 - (a * 2 / L);\n    c = t2 * t2 * H - H + 1;\n    if (opts.initialForce) {\n      c = 1 - c;\n    }\n    return c;\n  }\n\n  function at(t, duration) {\n    var bounce, curve, gravity, i, v;\n    bounce = opts.bounce / 100;\n    gravity = opts.gravity;\n    i = 0;\n    curve = curves[i];\n    while (!(t >= curve.a && t <= curve.b)) {\n      i += 1;\n      curve = curves[i];\n      if (!curve) {\n        break;\n      }\n    }\n    if (!curve) {\n      v = opts.initialForce ? 0 : 1;\n    } else {\n      v = calculateCurve(curve.a, curve.b, curve.H, t);\n    }\n    //return [t, v];\n    return v;\n  }\n\n};\n\n},{\"../util/extend\":10}],7:[function(_dereq_,module,exports){\nvar dynamics = _dereq_('./dynamics');\nvar bezier = _dereq_('./bezier');\n\nmodule.exports = {\n  'linear': function() {\n    return function(t, duration) {\n      return bezier.linear(t, duration);\n    };\n  },\n  'ease': function() {\n    return function(t, duration) {\n      return bezier.ease(t, duration);\n    };\n  },\n  'ease-in': function() {\n    return function(t, duration) {\n      return bezier.easeIn(t, duration);\n    };\n  },\n  'ease-out': function() {\n    return function(t, duration) {\n      return bezier.easeOut(t, duration);\n    };\n  },\n  'ease-in-out': function() {\n    return function(t, duration) {\n      return bezier.easeInOut(t, duration);\n    };\n  },\n  'cubic-bezier': function(x1, y1, x2, y2, duration) {\n    var bz = bezier.cubicBezier(x1, y1, x2, y2);//, t, duration);\n    return function(t, duration) {\n      return bz(t, duration);\n    };\n  }\n};\n\n},{\"./bezier\":5,\"./dynamics\":6}],8:[function(_dereq_,module,exports){\n\nvar raf = _dereq_('raf');\nvar time = _dereq_('performance-now');\n\nvar self = module.exports = {\n  _running: {},\n\n  animationStarted: function(instance) {\n    self._running[instance._.id] = instance;\n\n    if (!self.isTicking) {\n      self.tick();\n    }\n  },\n\n  animationStopped: function(instance) {\n    delete self._running[instance._.id];\n    self.maybeStopTicking();\n  },\n\n  tick: function() {\n    var lastFrame = time();\n\n    self.isTicking = true;\n    self._rafId = raf(step);\n\n    function step() {\n      self._rafId = raf(step);\n\n      // Get current time\n      var now = time();\n      var deltaT = now - lastFrame;\n\n      for (var animationId in self._running) {\n        self._running[animationId]._tick(deltaT);\n      }\n\n      lastFrame = now;\n    }\n  },\n\n  maybeStopTicking: function() {\n    if (self.isTicking && !Object.keys(self._running).length) {\n      raf.cancel(self._rafId);\n      self.isTicking = false;\n    }\n  },\n\n};\n\n\n},{\"performance-now\":1,\"raf\":2}],9:[function(_dereq_,module,exports){\nmodule.exports = {\n  animator: _dereq_('./animator')\n};\n\n},{\"./animator\":4}],10:[function(_dereq_,module,exports){\n\n/*\n * There really is no tiny minimal extend() on npm to find,\n * so we just use our own.\n */\n\nmodule.exports = function extend(obj) {\n   var args = Array.prototype.slice.call(arguments, 1);\n   for(var i = 0; i < args.length; i++) {\n     var source = args[i];\n     if (source) {\n       for (var prop in source) {\n         obj[prop] = source[prop];\n       }\n     }\n   }\n   return obj;\n};\n\n},{}],11:[function(_dereq_,module,exports){\n\n// All we want is an eventEmitter that doesn't use #call or #apply,\n// by expecting 0-1 arguments. \n// We couldn't find this on npm, so we make our own.\n\nmodule.exports = SimpleEventEmitter;\n\nfunction SimpleEventEmitter() {\n}\n\nSimpleEventEmitter.prototype = {\n  listeners: [],\n  on: function(eventType, fn) {\n    if (typeof fn !== 'function') return;\n    this.listeners[eventType] || (this.listeners[eventType] = []);\n    this.listeners[eventType].push(fn);\n  },\n  once: function(eventType, fn) {\n    var self = this;\n    function onceFn() {\n      self.off(eventType, fn);\n      self.off(eventType, onceFn);\n    }\n    this.on(eventType, fn);\n    this.on(eventType, onceFn);\n  },\n  // Built-in limitation: we only expect 0-1 arguments\n  // This is to save as much perf as possible when sending\n  // events every frame.\n  emit: function(eventType, eventArg) {\n    var listeners = this.listeners[eventType] || [];\n    var i = 0;\n    var len = listeners.length;\n    if (arguments.length === 2) {\n      for (i; i < len; i++) listeners[i] && listeners[i](eventArg);\n    } else {\n      for (i; i < len; i++) listeners[i] && listeners[i]();\n    }\n  },\n  off: function(eventType, fnToRemove) {\n    if (!eventType) {\n      //Remove all listeners\n      for (var type in this.listeners) {\n        this.off(type);\n      }\n    } else  {\n      var listeners = this.listeners[eventType];\n      if (listeners) {\n        if (!fnToRemove) {\n          listeners.length = 0;\n        } else {\n          var index = listeners.indexOf(fnToRemove);\n          listeners.splice(index, 1);\n        }\n      }\n    }\n  } \n};\n\n},{}],12:[function(_dereq_,module,exports){\n\n/**\n * nextUid() from angular.js\n * License MIT\n * http://github.com/angular/angular.js\n *\n * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric\n * characters such as '012ABC'. The reason why we are not using simply a number counter is that\n * the number string gets longer over time, and it can also overflow, where as the nextId\n * will grow much slower, it is a string, and it will never overflow.\n *\n * @returns an unique alpha-numeric string\n */\nvar uid = [];\n\nmodule.exports = function nextUid() {\n  var index = uid.length;\n  var digit;\n\n  while(index) {\n    index--;\n    digit = uid[index].charCodeAt(0);\n    if (digit == 57 /*'9'*/) {\n      uid[index] = 'A';\n      return uid.join('');\n    }\n    if (digit == 90  /*'Z'*/) {\n      uid[index] = '0';\n    } else {\n      uid[index] = String.fromCharCode(digit + 1);\n      return uid.join('');\n    }\n  }\n  uid.unshift('0');\n  return uid.join('');\n};\n\n},{}],13:[function(_dereq_,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\n\nprocess.nextTick = (function () {\n    var canSetImmediate = typeof window !== 'undefined'\n    && window.setImmediate;\n    var canPost = typeof window !== 'undefined'\n    && window.postMessage && window.addEventListener\n    ;\n\n    if (canSetImmediate) {\n        return function (f) { return window.setImmediate(f) };\n    }\n\n    if (canPost) {\n        var queue = [];\n        window.addEventListener('message', function (ev) {\n            var source = ev.source;\n            if ((source === window || source === null) && ev.data === 'process-tick') {\n                ev.stopPropagation();\n                if (queue.length > 0) {\n                    var fn = queue.shift();\n                    fn();\n                }\n            }\n        }, true);\n\n        return function nextTick(fn) {\n            queue.push(fn);\n            window.postMessage('process-tick', '*');\n        };\n    }\n\n    return function nextTick(fn) {\n        setTimeout(fn, 0);\n    };\n})();\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n}\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\n\n},{}]},{},[9])\n(9)\n});\n})();"
  },
  {
    "path": "www/lib/ionic/js/ionic.bundle.js",
    "content": "/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/*!\n * Copyright 2014 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.0.0-beta.12\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n\n(function() {\n\n// Create global ionic obj and its namespaces\n// build processes may have already created an ionic obj\nwindow.ionic = window.ionic || {};\nwindow.ionic.views = {};\nwindow.ionic.version = '1.0.0-beta.12';\n\n(function(window, document, ionic) {\n\n  var readyCallbacks = [];\n  var isDomReady = false;\n\n  function domReady() {\n    isDomReady = true;\n    for(var x=0; x<readyCallbacks.length; x++) {\n      ionic.requestAnimationFrame(readyCallbacks[x]);\n    }\n    readyCallbacks = [];\n    document.removeEventListener('DOMContentLoaded', domReady);\n  }\n  document.addEventListener('DOMContentLoaded', domReady);\n\n  // From the man himself, Mr. Paul Irish.\n  // The requestAnimationFrame polyfill\n  // Put it on window just to preserve its context\n  // without having to use .call\n  window._rAF = (function(){\n    return  window.requestAnimationFrame       ||\n            window.webkitRequestAnimationFrame ||\n            window.mozRequestAnimationFrame    ||\n            function( callback ){\n              window.setTimeout(callback, 16);\n            };\n  })();\n\n  var cancelAnimationFrame = window.cancelAnimationFrame ||\n    window.webkitCancelAnimationFrame ||\n    window.mozCancelAnimationFrame ||\n    window.webkitCancelRequestAnimationFrame;\n\n  /**\n  * @ngdoc utility\n  * @name ionic.DomUtil\n  * @module ionic\n  */\n  ionic.DomUtil = {\n    //Call with proper context\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#requestAnimationFrame\n     * @alias ionic.requestAnimationFrame\n     * @description Calls [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame), or a polyfill if not available.\n     * @param {function} callback The function to call when the next frame\n     * happens.\n     */\n    requestAnimationFrame: function(cb) {\n      return window._rAF(cb);\n    },\n\n    cancelAnimationFrame: function(requestId) {\n      cancelAnimationFrame(requestId);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#animationFrameThrottle\n     * @alias ionic.animationFrameThrottle\n     * @description\n     * When given a callback, if that callback is called 100 times between\n     * animation frames, adding Throttle will make it only run the last of\n     * the 100 calls.\n     *\n     * @param {function} callback a function which will be throttled to\n     * requestAnimationFrame\n     * @returns {function} A function which will then call the passed in callback.\n     * The passed in callback will receive the context the returned function is\n     * called with.\n     */\n    animationFrameThrottle: function(cb) {\n      var args, isQueued, context;\n      return function() {\n        args = arguments;\n        context = this;\n        if (!isQueued) {\n          isQueued = true;\n          ionic.requestAnimationFrame(function() {\n            cb.apply(context, args);\n            isQueued = false;\n          });\n        }\n      };\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getPositionInParent\n     * @description\n     * Find an element's scroll offset within its container.\n     * @param {DOMElement} element The element to find the offset of.\n     * @returns {object} A position object with the following properties:\n     *   - `{number}` `left` The left offset of the element.\n     *   - `{number}` `top` The top offset of the element.\n     */\n    getPositionInParent: function(el) {\n      return {\n        left: el.offsetLeft,\n        top: el.offsetTop\n      };\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#ready\n     * @description\n     * Call a function when the DOM is ready, or if it is already ready\n     * call the function immediately.\n     * @param {function} callback The function to be called.\n     */\n    ready: function(cb) {\n      if(isDomReady || document.readyState === \"complete\") {\n        ionic.requestAnimationFrame(cb);\n      } else {\n        readyCallbacks.push(cb);\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getTextBounds\n     * @description\n     * Get a rect representing the bounds of the given textNode.\n     * @param {DOMElement} textNode The textNode to find the bounds of.\n     * @returns {object} An object representing the bounds of the node. Properties:\n     *   - `{number}` `left` The left position of the textNode.\n     *   - `{number}` `right` The right position of the textNode.\n     *   - `{number}` `top` The top position of the textNode.\n     *   - `{number}` `bottom` The bottom position of the textNode.\n     *   - `{number}` `width` The width of the textNode.\n     *   - `{number}` `height` The height of the textNode.\n     */\n    getTextBounds: function(textNode) {\n      if(document.createRange) {\n        var range = document.createRange();\n        range.selectNodeContents(textNode);\n        if(range.getBoundingClientRect) {\n          var rect = range.getBoundingClientRect();\n          if(rect) {\n            var sx = window.scrollX;\n            var sy = window.scrollY;\n\n            return {\n              top: rect.top + sy,\n              left: rect.left + sx,\n              right: rect.left + sx + rect.width,\n              bottom: rect.top + sy + rect.height,\n              width: rect.width,\n              height: rect.height\n            };\n          }\n        }\n      }\n      return null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getChildIndex\n     * @description\n     * Get the first index of a child node within the given element of the\n     * specified type.\n     * @param {DOMElement} element The element to find the index of.\n     * @param {string} type The nodeName to match children of element against.\n     * @returns {number} The index, or -1, of a child with nodeName matching type.\n     */\n    getChildIndex: function(element, type) {\n      if(type) {\n        var ch = element.parentNode.children;\n        var c;\n        for(var i = 0, k = 0, j = ch.length; i < j; i++) {\n          c = ch[i];\n          if(c.nodeName && c.nodeName.toLowerCase() == type) {\n            if(c == element) {\n              return k;\n            }\n            k++;\n          }\n        }\n      }\n      return Array.prototype.slice.call(element.parentNode.children).indexOf(element);\n    },\n\n    /**\n     * @private\n     */\n    swapNodes: function(src, dest) {\n      dest.parentNode.insertBefore(src, dest);\n    },\n\n    elementIsDescendant: function(el, parent, stopAt) {\n      var current = el;\n      do {\n        if (current === parent) return true;\n        current = current.parentNode;\n      } while (current && current !== stopAt);\n      return false;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getParentWithClass\n     * @param {DOMElement} element\n     * @param {string} className\n     * @returns {DOMElement} The closest parent of element matching the\n     * className, or null.\n     */\n    getParentWithClass: function(e, className, depth) {\n      depth = depth || 10;\n      while(e.parentNode && depth--) {\n        if(e.parentNode.classList && e.parentNode.classList.contains(className)) {\n          return e.parentNode;\n        }\n        e = e.parentNode;\n      }\n      return null;\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getParentOrSelfWithClass\n     * @param {DOMElement} element\n     * @param {string} className\n     * @returns {DOMElement} The closest parent or self matching the\n     * className, or null.\n     */\n    getParentOrSelfWithClass: function(e, className, depth) {\n      depth = depth || 10;\n      while(e && depth--) {\n        if(e.classList && e.classList.contains(className)) {\n          return e;\n        }\n        e = e.parentNode;\n      }\n      return null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#rectContains\n     * @param {number} x\n     * @param {number} y\n     * @param {number} x1\n     * @param {number} y1\n     * @param {number} x2\n     * @param {number} y2\n     * @returns {boolean} Whether {x,y} fits within the rectangle defined by\n     * {x1,y1,x2,y2}.\n     */\n    rectContains: function(x, y, x1, y1, x2, y2) {\n      if(x < x1 || x > x2) return false;\n      if(y < y1 || y > y2) return false;\n      return true;\n    }\n  };\n\n  //Shortcuts\n  ionic.requestAnimationFrame = ionic.DomUtil.requestAnimationFrame;\n  ionic.cancelAnimationFrame = ionic.DomUtil.cancelAnimationFrame;\n  ionic.animationFrameThrottle = ionic.DomUtil.animationFrameThrottle;\n})(window, document, ionic);\n\n/**\n * ion-events.js\n *\n * Author: Max Lynch <max@drifty.com>\n *\n * Framework events handles various mobile browser events, and\n * detects special events like tap/swipe/etc. and emits them\n * as custom events that can be used in an app.\n *\n * Portions lovingly adapted from github.com/maker/ratchet and github.com/alexgibson/tap.js - thanks guys!\n */\n\n(function(ionic) {\n\n  // Custom event polyfill\n  ionic.CustomEvent = (function() {\n    if( typeof window.CustomEvent === 'function' ) return CustomEvent;\n\n    var customEvent = function(event, params) {\n      var evt;\n      params = params || {\n        bubbles: false,\n        cancelable: false,\n        detail: undefined\n      };\n      try {\n        evt = document.createEvent(\"CustomEvent\");\n        evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n      } catch (error) {\n        // fallback for browsers that don't support createEvent('CustomEvent')\n        evt = document.createEvent(\"Event\");\n        for (var param in params) {\n          evt[param] = params[param];\n        }\n        evt.initEvent(event, params.bubbles, params.cancelable);\n      }\n      return evt;\n    };\n    customEvent.prototype = window.Event.prototype;\n    return customEvent;\n  })();\n\n\n  /**\n   * @ngdoc utility\n   * @name ionic.EventController\n   * @module ionic\n   */\n  ionic.EventController = {\n    VIRTUALIZED_EVENTS: ['tap', 'swipe', 'swiperight', 'swipeleft', 'drag', 'hold', 'release'],\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#trigger\n     * @alias ionic.trigger\n     * @param {string} eventType The event to trigger.\n     * @param {object} data The data for the event. Hint: pass in\n     * `{target: targetElement}`\n     * @param {boolean=} bubbles Whether the event should bubble up the DOM.\n     * @param {boolean=} cancelable Whether the event should be cancelable.\n     */\n    // Trigger a new event\n    trigger: function(eventType, data, bubbles, cancelable) {\n      var event = new ionic.CustomEvent(eventType, {\n        detail: data,\n        bubbles: !!bubbles,\n        cancelable: !!cancelable\n      });\n\n      // Make sure to trigger the event on the given target, or dispatch it from\n      // the window if we don't have an event target\n      data && data.target && data.target.dispatchEvent && data.target.dispatchEvent(event) || window.dispatchEvent(event);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#on\n     * @alias ionic.on\n     * @description Listen to an event on an element.\n     * @param {string} type The event to listen for.\n     * @param {function} callback The listener to be called.\n     * @param {DOMElement} element The element to listen for the event on.\n     */\n    on: function(type, callback, element) {\n      var e = element || window;\n\n      // Bind a gesture if it's a virtual event\n      for(var i = 0, j = this.VIRTUALIZED_EVENTS.length; i < j; i++) {\n        if(type == this.VIRTUALIZED_EVENTS[i]) {\n          var gesture = new ionic.Gesture(element);\n          gesture.on(type, callback);\n          return gesture;\n        }\n      }\n\n      // Otherwise bind a normal event\n      e.addEventListener(type, callback);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#off\n     * @alias ionic.off\n     * @description Remove an event listener.\n     * @param {string} type\n     * @param {function} callback\n     * @param {DOMElement} element\n     */\n    off: function(type, callback, element) {\n      element.removeEventListener(type, callback);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#onGesture\n     * @alias ionic.onGesture\n     * @description Add an event listener for a gesture on an element.\n     *\n     * Available eventTypes (from [hammer.js](http://eightmedia.github.io/hammer.js/)):\n     *\n     * `hold`, `tap`, `doubletap`, `drag`, `dragstart`, `dragend`, `dragup`, `dragdown`, <br/>\n     * `dragleft`, `dragright`, `swipe`, `swipeup`, `swipedown`, `swipeleft`, `swiperight`, <br/>\n     * `transform`, `transformstart`, `transformend`, `rotate`, `pinch`, `pinchin`, `pinchout`, </br>\n     * `touch`, `release`\n     *\n     * @param {string} eventType The gesture event to listen for.\n     * @param {function(e)} callback The function to call when the gesture\n     * happens.\n     * @param {DOMElement} element The angular element to listen for the event on.\n     */\n    onGesture: function(type, callback, element, options) {\n      var gesture = new ionic.Gesture(element, options);\n      gesture.on(type, callback);\n      return gesture;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#offGesture\n     * @alias ionic.offGesture\n     * @description Remove an event listener for a gesture on an element.\n     * @param {string} eventType The gesture event.\n     * @param {function(e)} callback The listener that was added earlier.\n     * @param {DOMElement} element The element the listener was added on.\n     */\n    offGesture: function(gesture, type, callback) {\n      gesture.off(type, callback);\n    },\n\n    handlePopState: function(event) {}\n  };\n\n\n  // Map some convenient top-level functions for event handling\n  ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); };\n  ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); };\n  ionic.trigger = ionic.EventController.trigger;//function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); };\n  ionic.onGesture = function() { return ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); };\n  ionic.offGesture = function() { return ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); };\n\n})(window.ionic);\n\n/**\n  * Simple gesture controllers with some common gestures that emit\n  * gesture events.\n  *\n  * Ported from github.com/EightMedia/hammer.js Gestures - thanks!\n  */\n(function(ionic) {\n\n  /**\n   * ionic.Gestures\n   * use this to create instances\n   * @param   {HTMLElement}   element\n   * @param   {Object}        options\n   * @returns {ionic.Gestures.Instance}\n   * @constructor\n   */\n  ionic.Gesture = function(element, options) {\n    return new ionic.Gestures.Instance(element, options || {});\n  };\n\n  ionic.Gestures = {};\n\n  // default settings\n  ionic.Gestures.defaults = {\n    // add css to the element to prevent the browser from doing\n    // its native behavior. this doesnt prevent the scrolling,\n    // but cancels the contextmenu, tap highlighting etc\n    // set to false to disable this\n    stop_browser_behavior: 'disable-user-behavior'\n  };\n\n  // detect touchevents\n  ionic.Gestures.HAS_POINTEREVENTS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled;\n  ionic.Gestures.HAS_TOUCHEVENTS = ('ontouchstart' in window);\n\n  // dont use mouseevents on mobile devices\n  ionic.Gestures.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i;\n  ionic.Gestures.NO_MOUSEEVENTS = ionic.Gestures.HAS_TOUCHEVENTS && window.navigator.userAgent.match(ionic.Gestures.MOBILE_REGEX);\n\n  // eventtypes per touchevent (start, move, end)\n  // are filled by ionic.Gestures.event.determineEventTypes on setup\n  ionic.Gestures.EVENT_TYPES = {};\n\n  // direction defines\n  ionic.Gestures.DIRECTION_DOWN = 'down';\n  ionic.Gestures.DIRECTION_LEFT = 'left';\n  ionic.Gestures.DIRECTION_UP = 'up';\n  ionic.Gestures.DIRECTION_RIGHT = 'right';\n\n  // pointer type\n  ionic.Gestures.POINTER_MOUSE = 'mouse';\n  ionic.Gestures.POINTER_TOUCH = 'touch';\n  ionic.Gestures.POINTER_PEN = 'pen';\n\n  // touch event defines\n  ionic.Gestures.EVENT_START = 'start';\n  ionic.Gestures.EVENT_MOVE = 'move';\n  ionic.Gestures.EVENT_END = 'end';\n\n  // hammer document where the base events are added at\n  ionic.Gestures.DOCUMENT = window.document;\n\n  // plugins namespace\n  ionic.Gestures.plugins = {};\n\n  // if the window events are set...\n  ionic.Gestures.READY = false;\n\n  /**\n   * setup events to detect gestures on the document\n   */\n  function setup() {\n    if(ionic.Gestures.READY) {\n      return;\n    }\n\n    // find what eventtypes we add listeners to\n    ionic.Gestures.event.determineEventTypes();\n\n    // Register all gestures inside ionic.Gestures.gestures\n    for(var name in ionic.Gestures.gestures) {\n      if(ionic.Gestures.gestures.hasOwnProperty(name)) {\n        ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);\n      }\n    }\n\n    // Add touch events on the document\n    ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_MOVE, ionic.Gestures.detection.detect);\n    ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_END, ionic.Gestures.detection.detect);\n\n    // ionic.Gestures is ready...!\n    ionic.Gestures.READY = true;\n  }\n\n  /**\n   * create new hammer instance\n   * all methods should return the instance itself, so it is chainable.\n   * @param   {HTMLElement}       element\n   * @param   {Object}            [options={}]\n   * @returns {ionic.Gestures.Instance}\n   * @name Gesture.Instance\n   * @constructor\n   */\n  ionic.Gestures.Instance = function(element, options) {\n    var self = this;\n\n    // A null element was passed into the instance, which means\n    // whatever lookup was done to find this element failed to find it\n    // so we can't listen for events on it.\n    if(element === null) {\n      void 0;\n      return;\n    }\n\n    // setup ionic.GesturesJS window events and register all gestures\n    // this also sets up the default options\n    setup();\n\n    this.element = element;\n\n    // start/stop detection option\n    this.enabled = true;\n\n    // merge options\n    this.options = ionic.Gestures.utils.extend(\n        ionic.Gestures.utils.extend({}, ionic.Gestures.defaults),\n        options || {});\n\n    // add some css to the element to prevent the browser from doing its native behavoir\n    if(this.options.stop_browser_behavior) {\n      ionic.Gestures.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);\n    }\n\n    // start detection on touchstart\n    ionic.Gestures.event.onTouch(element, ionic.Gestures.EVENT_START, function(ev) {\n      if(self.enabled) {\n        ionic.Gestures.detection.startDetect(self, ev);\n      }\n    });\n\n    // return instance\n    return this;\n  };\n\n\n  ionic.Gestures.Instance.prototype = {\n    /**\n     * bind events to the instance\n     * @param   {String}      gesture\n     * @param   {Function}    handler\n     * @returns {ionic.Gestures.Instance}\n     */\n    on: function onEvent(gesture, handler){\n      var gestures = gesture.split(' ');\n      for(var t=0; t<gestures.length; t++) {\n        this.element.addEventListener(gestures[t], handler, false);\n      }\n      return this;\n    },\n\n\n    /**\n     * unbind events to the instance\n     * @param   {String}      gesture\n     * @param   {Function}    handler\n     * @returns {ionic.Gestures.Instance}\n     */\n    off: function offEvent(gesture, handler){\n      var gestures = gesture.split(' ');\n      for(var t=0; t<gestures.length; t++) {\n        this.element.removeEventListener(gestures[t], handler, false);\n      }\n      return this;\n    },\n\n\n    /**\n     * trigger gesture event\n     * @param   {String}      gesture\n     * @param   {Object}      eventData\n     * @returns {ionic.Gestures.Instance}\n     */\n    trigger: function triggerEvent(gesture, eventData){\n      // create DOM event\n      var event = ionic.Gestures.DOCUMENT.createEvent('Event');\n      event.initEvent(gesture, true, true);\n      event.gesture = eventData;\n\n      // trigger on the target if it is in the instance element,\n      // this is for event delegation tricks\n      var element = this.element;\n      if(ionic.Gestures.utils.hasParent(eventData.target, element)) {\n        element = eventData.target;\n      }\n\n      element.dispatchEvent(event);\n      return this;\n    },\n\n\n    /**\n     * enable of disable hammer.js detection\n     * @param   {Boolean}   state\n     * @returns {ionic.Gestures.Instance}\n     */\n    enable: function enable(state) {\n      this.enabled = state;\n      return this;\n    }\n  };\n\n  /**\n   * this holds the last move event,\n   * used to fix empty touchend issue\n   * see the onTouch event for an explanation\n   * type {Object}\n   */\n  var last_move_event = null;\n\n\n  /**\n   * when the mouse is hold down, this is true\n   * type {Boolean}\n   */\n  var enable_detect = false;\n\n\n  /**\n   * when touch events have been fired, this is true\n   * type {Boolean}\n   */\n  var touch_triggered = false;\n\n\n  ionic.Gestures.event = {\n    /**\n     * simple addEventListener\n     * @param   {HTMLElement}   element\n     * @param   {String}        type\n     * @param   {Function}      handler\n     */\n    bindDom: function(element, type, handler) {\n      var types = type.split(' ');\n      for(var t=0; t<types.length; t++) {\n        element.addEventListener(types[t], handler, false);\n      }\n    },\n\n\n    /**\n     * touch events with mouse fallback\n     * @param   {HTMLElement}   element\n     * @param   {String}        eventType        like ionic.Gestures.EVENT_MOVE\n     * @param   {Function}      handler\n     */\n    onTouch: function onTouch(element, eventType, handler) {\n      var self = this;\n\n      this.bindDom(element, ionic.Gestures.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {\n        var sourceEventType = ev.type.toLowerCase();\n\n        // onmouseup, but when touchend has been fired we do nothing.\n        // this is for touchdevices which also fire a mouseup on touchend\n        if(sourceEventType.match(/mouse/) && touch_triggered) {\n          return;\n        }\n\n        // mousebutton must be down or a touch event\n        else if( sourceEventType.match(/touch/) ||   // touch events are always on screen\n          sourceEventType.match(/pointerdown/) || // pointerevents touch\n          (sourceEventType.match(/mouse/) && ev.which === 1)   // mouse is pressed\n          ){\n            enable_detect = true;\n          }\n\n        // mouse isn't pressed\n        else if(sourceEventType.match(/mouse/) && ev.which !== 1) {\n          enable_detect = false;\n        }\n\n\n        // we are in a touch event, set the touch triggered bool to true,\n        // this for the conflicts that may occur on ios and android\n        if(sourceEventType.match(/touch|pointer/)) {\n          touch_triggered = true;\n        }\n\n        // count the total touches on the screen\n        var count_touches = 0;\n\n        // when touch has been triggered in this detection session\n        // and we are now handling a mouse event, we stop that to prevent conflicts\n        if(enable_detect) {\n          // update pointerevent\n          if(ionic.Gestures.HAS_POINTEREVENTS && eventType != ionic.Gestures.EVENT_END) {\n            count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);\n          }\n          // touch\n          else if(sourceEventType.match(/touch/)) {\n            count_touches = ev.touches.length;\n          }\n          // mouse\n          else if(!touch_triggered) {\n            count_touches = sourceEventType.match(/up/) ? 0 : 1;\n          }\n\n          // if we are in a end event, but when we remove one touch and\n          // we still have enough, set eventType to move\n          if(count_touches > 0 && eventType == ionic.Gestures.EVENT_END) {\n            eventType = ionic.Gestures.EVENT_MOVE;\n          }\n          // no touches, force the end event\n          else if(!count_touches) {\n            eventType = ionic.Gestures.EVENT_END;\n          }\n\n          // store the last move event\n          if(count_touches || last_move_event === null) {\n            last_move_event = ev;\n          }\n\n          // trigger the handler\n          handler.call(ionic.Gestures.detection, self.collectEventData(element, eventType, self.getTouchList(last_move_event, eventType), ev));\n\n          // remove pointerevent from list\n          if(ionic.Gestures.HAS_POINTEREVENTS && eventType == ionic.Gestures.EVENT_END) {\n            count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);\n          }\n        }\n\n        //debug(sourceEventType +\" \"+ eventType);\n\n        // on the end we reset everything\n        if(!count_touches) {\n          last_move_event = null;\n          enable_detect = false;\n          touch_triggered = false;\n          ionic.Gestures.PointerEvent.reset();\n        }\n      });\n    },\n\n\n    /**\n     * we have different events for each device/browser\n     * determine what we need and set them in the ionic.Gestures.EVENT_TYPES constant\n     */\n    determineEventTypes: function determineEventTypes() {\n      // determine the eventtype we want to set\n      var types;\n\n      // pointerEvents magic\n      if(ionic.Gestures.HAS_POINTEREVENTS) {\n        types = ionic.Gestures.PointerEvent.getEvents();\n      }\n      // on Android, iOS, blackberry, windows mobile we dont want any mouseevents\n      else if(ionic.Gestures.NO_MOUSEEVENTS) {\n        types = [\n          'touchstart',\n          'touchmove',\n          'touchend touchcancel'];\n      }\n      // for non pointer events browsers and mixed browsers,\n      // like chrome on windows8 touch laptop\n      else {\n        types = [\n          'touchstart mousedown',\n          'touchmove mousemove',\n          'touchend touchcancel mouseup'];\n      }\n\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_START]  = types[0];\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_MOVE]   = types[1];\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_END]    = types[2];\n    },\n\n\n    /**\n     * create touchlist depending on the event\n     * @param   {Object}    ev\n     * @param   {String}    eventType   used by the fakemultitouch plugin\n     */\n    getTouchList: function getTouchList(ev/*, eventType*/) {\n      // get the fake pointerEvent touchlist\n      if(ionic.Gestures.HAS_POINTEREVENTS) {\n        return ionic.Gestures.PointerEvent.getTouchList();\n      }\n      // get the touchlist\n      else if(ev.touches) {\n        return ev.touches;\n      }\n      // make fake touchlist from mouse position\n      else {\n        ev.identifier = 1;\n        return [ev];\n      }\n    },\n\n\n    /**\n     * collect event data for ionic.Gestures js\n     * @param   {HTMLElement}   element\n     * @param   {String}        eventType        like ionic.Gestures.EVENT_MOVE\n     * @param   {Object}        eventData\n     */\n    collectEventData: function collectEventData(element, eventType, touches, ev) {\n\n      // find out pointerType\n      var pointerType = ionic.Gestures.POINTER_TOUCH;\n      if(ev.type.match(/mouse/) || ionic.Gestures.PointerEvent.matchType(ionic.Gestures.POINTER_MOUSE, ev)) {\n        pointerType = ionic.Gestures.POINTER_MOUSE;\n      }\n\n      return {\n        center      : ionic.Gestures.utils.getCenter(touches),\n                    timeStamp   : new Date().getTime(),\n                    target      : ev.target,\n                    touches     : touches,\n                    eventType   : eventType,\n                    pointerType : pointerType,\n                    srcEvent    : ev,\n\n                    /**\n                     * prevent the browser default actions\n                     * mostly used to disable scrolling of the browser\n                     */\n                    preventDefault: function() {\n                      if(this.srcEvent.preventManipulation) {\n                        this.srcEvent.preventManipulation();\n                      }\n\n                      if(this.srcEvent.preventDefault) {\n                        //this.srcEvent.preventDefault();\n                      }\n                    },\n\n                    /**\n                     * stop bubbling the event up to its parents\n                     */\n                    stopPropagation: function() {\n                      this.srcEvent.stopPropagation();\n                    },\n\n                    /**\n                     * immediately stop gesture detection\n                     * might be useful after a swipe was detected\n                     * @return {*}\n                     */\n                    stopDetect: function() {\n                      return ionic.Gestures.detection.stopDetect();\n                    }\n      };\n    }\n  };\n\n  ionic.Gestures.PointerEvent = {\n    /**\n     * holds all pointers\n     * type {Object}\n     */\n    pointers: {},\n\n    /**\n     * get a list of pointers\n     * @returns {Array}     touchlist\n     */\n    getTouchList: function() {\n      var self = this;\n      var touchlist = [];\n\n      // we can use forEach since pointerEvents only is in IE10\n      Object.keys(self.pointers).sort().forEach(function(id) {\n        touchlist.push(self.pointers[id]);\n      });\n      return touchlist;\n    },\n\n    /**\n     * update the position of a pointer\n     * @param   {String}   type             ionic.Gestures.EVENT_END\n     * @param   {Object}   pointerEvent\n     */\n    updatePointer: function(type, pointerEvent) {\n      if(type == ionic.Gestures.EVENT_END) {\n        this.pointers = {};\n      }\n      else {\n        pointerEvent.identifier = pointerEvent.pointerId;\n        this.pointers[pointerEvent.pointerId] = pointerEvent;\n      }\n\n      return Object.keys(this.pointers).length;\n    },\n\n    /**\n     * check if ev matches pointertype\n     * @param   {String}        pointerType     ionic.Gestures.POINTER_MOUSE\n     * @param   {PointerEvent}  ev\n     */\n    matchType: function(pointerType, ev) {\n      if(!ev.pointerType) {\n        return false;\n      }\n\n      var types = {};\n      types[ionic.Gestures.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == ionic.Gestures.POINTER_MOUSE);\n      types[ionic.Gestures.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == ionic.Gestures.POINTER_TOUCH);\n      types[ionic.Gestures.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == ionic.Gestures.POINTER_PEN);\n      return types[pointerType];\n    },\n\n\n    /**\n     * get events\n     */\n    getEvents: function() {\n      return [\n        'pointerdown MSPointerDown',\n      'pointermove MSPointerMove',\n      'pointerup pointercancel MSPointerUp MSPointerCancel'\n        ];\n    },\n\n    /**\n     * reset the list\n     */\n    reset: function() {\n      this.pointers = {};\n    }\n  };\n\n\n  ionic.Gestures.utils = {\n    /**\n     * extend method,\n     * also used for cloning when dest is an empty object\n     * @param   {Object}    dest\n     * @param   {Object}    src\n     * @param\t{Boolean}\tmerge\t\tdo a merge\n     * @returns {Object}    dest\n     */\n    extend: function extend(dest, src, merge) {\n      for (var key in src) {\n        if(dest[key] !== undefined && merge) {\n          continue;\n        }\n        dest[key] = src[key];\n      }\n      return dest;\n    },\n\n\n    /**\n     * find if a node is in the given parent\n     * used for event delegation tricks\n     * @param   {HTMLElement}   node\n     * @param   {HTMLElement}   parent\n     * @returns {boolean}       has_parent\n     */\n    hasParent: function(node, parent) {\n      while(node){\n        if(node == parent) {\n          return true;\n        }\n        node = node.parentNode;\n      }\n      return false;\n    },\n\n\n    /**\n     * get the center of all the touches\n     * @param   {Array}     touches\n     * @returns {Object}    center\n     */\n    getCenter: function getCenter(touches) {\n      var valuesX = [], valuesY = [];\n\n      for(var t= 0,len=touches.length; t<len; t++) {\n        valuesX.push(touches[t].pageX);\n        valuesY.push(touches[t].pageY);\n      }\n\n      return {\n        pageX: ((Math.min.apply(Math, valuesX) + Math.max.apply(Math, valuesX)) / 2),\n          pageY: ((Math.min.apply(Math, valuesY) + Math.max.apply(Math, valuesY)) / 2)\n      };\n    },\n\n\n    /**\n     * calculate the velocity between two points\n     * @param   {Number}    delta_time\n     * @param   {Number}    delta_x\n     * @param   {Number}    delta_y\n     * @returns {Object}    velocity\n     */\n    getVelocity: function getVelocity(delta_time, delta_x, delta_y) {\n      return {\n        x: Math.abs(delta_x / delta_time) || 0,\n        y: Math.abs(delta_y / delta_time) || 0\n      };\n    },\n\n\n    /**\n     * calculate the angle between two coordinates\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {Number}    angle\n     */\n    getAngle: function getAngle(touch1, touch2) {\n      var y = touch2.pageY - touch1.pageY,\n      x = touch2.pageX - touch1.pageX;\n      return Math.atan2(y, x) * 180 / Math.PI;\n    },\n\n\n    /**\n     * angle to direction define\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {String}    direction constant, like ionic.Gestures.DIRECTION_LEFT\n     */\n    getDirection: function getDirection(touch1, touch2) {\n      var x = Math.abs(touch1.pageX - touch2.pageX),\n      y = Math.abs(touch1.pageY - touch2.pageY);\n\n      if(x >= y) {\n        return touch1.pageX - touch2.pageX > 0 ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;\n      }\n      else {\n        return touch1.pageY - touch2.pageY > 0 ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;\n      }\n    },\n\n\n    /**\n     * calculate the distance between two touches\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {Number}    distance\n     */\n    getDistance: function getDistance(touch1, touch2) {\n      var x = touch2.pageX - touch1.pageX,\n      y = touch2.pageY - touch1.pageY;\n      return Math.sqrt((x*x) + (y*y));\n    },\n\n\n    /**\n     * calculate the scale factor between two touchLists (fingers)\n     * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n     * @param   {Array}     start\n     * @param   {Array}     end\n     * @returns {Number}    scale\n     */\n    getScale: function getScale(start, end) {\n      // need two fingers...\n      if(start.length >= 2 && end.length >= 2) {\n        return this.getDistance(end[0], end[1]) /\n          this.getDistance(start[0], start[1]);\n      }\n      return 1;\n    },\n\n\n    /**\n     * calculate the rotation degrees between two touchLists (fingers)\n     * @param   {Array}     start\n     * @param   {Array}     end\n     * @returns {Number}    rotation\n     */\n    getRotation: function getRotation(start, end) {\n      // need two fingers\n      if(start.length >= 2 && end.length >= 2) {\n        return this.getAngle(end[1], end[0]) -\n          this.getAngle(start[1], start[0]);\n      }\n      return 0;\n    },\n\n\n    /**\n     * boolean if the direction is vertical\n     * @param    {String}    direction\n     * @returns  {Boolean}   is_vertical\n     */\n    isVertical: function isVertical(direction) {\n      return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);\n    },\n\n\n    /**\n     * stop browser default behavior with css class\n     * @param   {HtmlElement}   element\n     * @param   {Object}        css_class\n     */\n    stopDefaultBrowserBehavior: function stopDefaultBrowserBehavior(element, css_class) {\n      // changed from making many style changes to just adding a preset classname\n      // less DOM manipulations, less code, and easier to control in the CSS side of things\n      // hammer.js doesn't come with CSS, but ionic does, which is why we prefer this method\n      if(element && element.classList) {\n        element.classList.add(css_class);\n        element.onselectstart = function() {\n          return false;\n        };\n      }\n    }\n  };\n\n\n  ionic.Gestures.detection = {\n    // contains all registred ionic.Gestures.gestures in the correct order\n    gestures: [],\n\n    // data of the current ionic.Gestures.gesture detection session\n    current: null,\n\n    // the previous ionic.Gestures.gesture session data\n    // is a full clone of the previous gesture.current object\n    previous: null,\n\n    // when this becomes true, no gestures are fired\n    stopped: false,\n\n\n    /**\n     * start ionic.Gestures.gesture detection\n     * @param   {ionic.Gestures.Instance}   inst\n     * @param   {Object}            eventData\n     */\n    startDetect: function startDetect(inst, eventData) {\n      // already busy with a ionic.Gestures.gesture detection on an element\n      if(this.current) {\n        return;\n      }\n\n      this.stopped = false;\n\n      this.current = {\n        inst        : inst, // reference to ionic.GesturesInstance we're working for\n        startEvent  : ionic.Gestures.utils.extend({}, eventData), // start eventData for distances, timing etc\n        lastEvent   : false, // last eventData\n        name        : '' // current gesture we're in/detected, can be 'tap', 'hold' etc\n      };\n\n      this.detect(eventData);\n    },\n\n\n    /**\n     * ionic.Gestures.gesture detection\n     * @param   {Object}    eventData\n     */\n    detect: function detect(eventData) {\n      if(!this.current || this.stopped) {\n        return;\n      }\n\n      // extend event data with calculations about scale, distance etc\n      eventData = this.extendEventData(eventData);\n\n      // instance options\n      var inst_options = this.current.inst.options;\n\n      // call ionic.Gestures.gesture handlers\n      for(var g=0,len=this.gestures.length; g<len; g++) {\n        var gesture = this.gestures[g];\n\n        // only when the instance options have enabled this gesture\n        if(!this.stopped && inst_options[gesture.name] !== false) {\n          // if a handler returns false, we stop with the detection\n          if(gesture.handler.call(gesture, eventData, this.current.inst) === false) {\n            this.stopDetect();\n            break;\n          }\n        }\n      }\n\n      // store as previous event event\n      if(this.current) {\n        this.current.lastEvent = eventData;\n      }\n\n      // endevent, but not the last touch, so dont stop\n      if(eventData.eventType == ionic.Gestures.EVENT_END && !eventData.touches.length-1) {\n        this.stopDetect();\n      }\n\n      return eventData;\n    },\n\n\n    /**\n     * clear the ionic.Gestures.gesture vars\n     * this is called on endDetect, but can also be used when a final ionic.Gestures.gesture has been detected\n     * to stop other ionic.Gestures.gestures from being fired\n     */\n    stopDetect: function stopDetect() {\n      // clone current data to the store as the previous gesture\n      // used for the double tap gesture, since this is an other gesture detect session\n      this.previous = ionic.Gestures.utils.extend({}, this.current);\n\n      // reset the current\n      this.current = null;\n\n      // stopped!\n      this.stopped = true;\n    },\n\n\n    /**\n     * extend eventData for ionic.Gestures.gestures\n     * @param   {Object}   ev\n     * @returns {Object}   ev\n     */\n    extendEventData: function extendEventData(ev) {\n      var startEv = this.current.startEvent;\n\n      // if the touches change, set the new touches over the startEvent touches\n      // this because touchevents don't have all the touches on touchstart, or the\n      // user must place his fingers at the EXACT same time on the screen, which is not realistic\n      // but, sometimes it happens that both fingers are touching at the EXACT same time\n      if(startEv && (ev.touches.length != startEv.touches.length || ev.touches === startEv.touches)) {\n        // extend 1 level deep to get the touchlist with the touch objects\n        startEv.touches = [];\n        for(var i=0,len=ev.touches.length; i<len; i++) {\n          startEv.touches.push(ionic.Gestures.utils.extend({}, ev.touches[i]));\n        }\n      }\n\n      var delta_time = ev.timeStamp - startEv.timeStamp,\n          delta_x = ev.center.pageX - startEv.center.pageX,\n          delta_y = ev.center.pageY - startEv.center.pageY,\n          velocity = ionic.Gestures.utils.getVelocity(delta_time, delta_x, delta_y);\n\n      ionic.Gestures.utils.extend(ev, {\n        deltaTime   : delta_time,\n\n        deltaX      : delta_x,\n        deltaY      : delta_y,\n\n        velocityX   : velocity.x,\n        velocityY   : velocity.y,\n\n        distance    : ionic.Gestures.utils.getDistance(startEv.center, ev.center),\n        angle       : ionic.Gestures.utils.getAngle(startEv.center, ev.center),\n        direction   : ionic.Gestures.utils.getDirection(startEv.center, ev.center),\n\n        scale       : ionic.Gestures.utils.getScale(startEv.touches, ev.touches),\n        rotation    : ionic.Gestures.utils.getRotation(startEv.touches, ev.touches),\n\n        startEvent  : startEv\n      });\n\n      return ev;\n    },\n\n\n    /**\n     * register new gesture\n     * @param   {Object}    gesture object, see gestures.js for documentation\n     * @returns {Array}     gestures\n     */\n    register: function register(gesture) {\n      // add an enable gesture options if there is no given\n      var options = gesture.defaults || {};\n      if(options[gesture.name] === undefined) {\n        options[gesture.name] = true;\n      }\n\n      // extend ionic.Gestures default options with the ionic.Gestures.gesture options\n      ionic.Gestures.utils.extend(ionic.Gestures.defaults, options, true);\n\n      // set its index\n      gesture.index = gesture.index || 1000;\n\n      // add ionic.Gestures.gesture to the list\n      this.gestures.push(gesture);\n\n      // sort the list by index\n      this.gestures.sort(function(a, b) {\n        if (a.index < b.index) {\n          return -1;\n        }\n        if (a.index > b.index) {\n          return 1;\n        }\n        return 0;\n      });\n\n      return this.gestures;\n    }\n  };\n\n\n  ionic.Gestures.gestures = ionic.Gestures.gestures || {};\n\n  /**\n   * Custom gestures\n   * ==============================\n   *\n   * Gesture object\n   * --------------------\n   * The object structure of a gesture:\n   *\n   * { name: 'mygesture',\n   *   index: 1337,\n   *   defaults: {\n   *     mygesture_option: true\n   *   }\n   *   handler: function(type, ev, inst) {\n   *     // trigger gesture event\n   *     inst.trigger(this.name, ev);\n   *   }\n   * }\n\n   * @param   {String}    name\n   * this should be the name of the gesture, lowercase\n   * it is also being used to disable/enable the gesture per instance config.\n   *\n   * @param   {Number}    [index=1000]\n   * the index of the gesture, where it is going to be in the stack of gestures detection\n   * like when you build an gesture that depends on the drag gesture, it is a good\n   * idea to place it after the index of the drag gesture.\n   *\n   * @param   {Object}    [defaults={}]\n   * the default settings of the gesture. these are added to the instance settings,\n   * and can be overruled per instance. you can also add the name of the gesture,\n   * but this is also added by default (and set to true).\n   *\n   * @param   {Function}  handler\n   * this handles the gesture detection of your custom gesture and receives the\n   * following arguments:\n   *\n   *      @param  {Object}    eventData\n   *      event data containing the following properties:\n   *          timeStamp   {Number}        time the event occurred\n   *          target      {HTMLElement}   target element\n   *          touches     {Array}         touches (fingers, pointers, mouse) on the screen\n   *          pointerType {String}        kind of pointer that was used. matches ionic.Gestures.POINTER_MOUSE|TOUCH\n   *          center      {Object}        center position of the touches. contains pageX and pageY\n   *          deltaTime   {Number}        the total time of the touches in the screen\n   *          deltaX      {Number}        the delta on x axis we haved moved\n   *          deltaY      {Number}        the delta on y axis we haved moved\n   *          velocityX   {Number}        the velocity on the x\n   *          velocityY   {Number}        the velocity on y\n   *          angle       {Number}        the angle we are moving\n   *          direction   {String}        the direction we are moving. matches ionic.Gestures.DIRECTION_UP|DOWN|LEFT|RIGHT\n   *          distance    {Number}        the distance we haved moved\n   *          scale       {Number}        scaling of the touches, needs 2 touches\n   *          rotation    {Number}        rotation of the touches, needs 2 touches *\n   *          eventType   {String}        matches ionic.Gestures.EVENT_START|MOVE|END\n   *          srcEvent    {Object}        the source event, like TouchStart or MouseDown *\n   *          startEvent  {Object}        contains the same properties as above,\n   *                                      but from the first touch. this is used to calculate\n   *                                      distances, deltaTime, scaling etc\n   *\n   *      @param  {ionic.Gestures.Instance}    inst\n   *      the instance we are doing the detection for. you can get the options from\n   *      the inst.options object and trigger the gesture event by calling inst.trigger\n   *\n   *\n   * Handle gestures\n   * --------------------\n   * inside the handler you can get/set ionic.Gestures.detectionic.current. This is the current\n   * detection sessionic. It has the following properties\n   *      @param  {String}    name\n   *      contains the name of the gesture we have detected. it has not a real function,\n   *      only to check in other gestures if something is detected.\n   *      like in the drag gesture we set it to 'drag' and in the swipe gesture we can\n   *      check if the current gesture is 'drag' by accessing ionic.Gestures.detectionic.current.name\n   *\n   *      readonly\n   *      @param  {ionic.Gestures.Instance}    inst\n   *      the instance we do the detection for\n   *\n   *      readonly\n   *      @param  {Object}    startEvent\n   *      contains the properties of the first gesture detection in this sessionic.\n   *      Used for calculations about timing, distance, etc.\n   *\n   *      readonly\n   *      @param  {Object}    lastEvent\n   *      contains all the properties of the last gesture detect in this sessionic.\n   *\n   * after the gesture detection session has been completed (user has released the screen)\n   * the ionic.Gestures.detectionic.current object is copied into ionic.Gestures.detectionic.previous,\n   * this is usefull for gestures like doubletap, where you need to know if the\n   * previous gesture was a tap\n   *\n   * options that have been set by the instance can be received by calling inst.options\n   *\n   * You can trigger a gesture event by calling inst.trigger(\"mygesture\", event).\n   * The first param is the name of your gesture, the second the event argument\n   *\n   *\n   * Register gestures\n   * --------------------\n   * When an gesture is added to the ionic.Gestures.gestures object, it is auto registered\n   * at the setup of the first ionic.Gestures instance. You can also call ionic.Gestures.detectionic.register\n   * manually and pass your gesture object as a param\n   *\n   */\n\n  /**\n   * Hold\n   * Touch stays at the same place for x time\n   * events  hold\n   */\n  ionic.Gestures.gestures.Hold = {\n    name: 'hold',\n    index: 10,\n    defaults: {\n      hold_timeout\t: 500,\n      hold_threshold\t: 1\n    },\n    timer: null,\n    handler: function holdGesture(ev, inst) {\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          // clear any running timers\n          clearTimeout(this.timer);\n\n          // set the gesture so we can check in the timeout if it still is\n          ionic.Gestures.detection.current.name = this.name;\n\n          // set timer and if after the timeout it still is hold,\n          // we trigger the hold event\n          this.timer = setTimeout(function() {\n            if(ionic.Gestures.detection.current.name == 'hold') {\n              ionic.tap.cancelClick();\n              inst.trigger('hold', ev);\n            }\n          }, inst.options.hold_timeout);\n          break;\n\n          // when you move or end we clear the timer\n        case ionic.Gestures.EVENT_MOVE:\n          if(ev.distance > inst.options.hold_threshold) {\n            clearTimeout(this.timer);\n          }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          clearTimeout(this.timer);\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Tap/DoubleTap\n   * Quick touch at a place or double at the same place\n   * events  tap, doubletap\n   */\n  ionic.Gestures.gestures.Tap = {\n    name: 'tap',\n    index: 100,\n    defaults: {\n      tap_max_touchtime\t: 250,\n      tap_max_distance\t: 10,\n      tap_always\t\t\t: true,\n      doubletap_distance\t: 20,\n      doubletap_interval\t: 300\n    },\n    handler: function tapGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END && ev.srcEvent.type != 'touchcancel') {\n        // previous gesture, for the double tap since these are two different gesture detections\n        var prev = ionic.Gestures.detection.previous,\n        did_doubletap = false;\n\n        // when the touchtime is higher then the max touch time\n        // or when the moving distance is too much\n        if(ev.deltaTime > inst.options.tap_max_touchtime ||\n            ev.distance > inst.options.tap_max_distance) {\n              return;\n            }\n\n        // check if double tap\n        if(prev && prev.name == 'tap' &&\n            (ev.timeStamp - prev.lastEvent.timeStamp) < inst.options.doubletap_interval &&\n            ev.distance < inst.options.doubletap_distance) {\n              inst.trigger('doubletap', ev);\n              did_doubletap = true;\n            }\n\n        // do a single tap\n        if(!did_doubletap || inst.options.tap_always) {\n          ionic.Gestures.detection.current.name = 'tap';\n          inst.trigger('tap', ev);\n        }\n      }\n    }\n  };\n\n\n  /**\n   * Swipe\n   * triggers swipe events when the end velocity is above the threshold\n   * events  swipe, swipeleft, swiperight, swipeup, swipedown\n   */\n  ionic.Gestures.gestures.Swipe = {\n    name: 'swipe',\n    index: 40,\n    defaults: {\n      // set 0 for unlimited, but this can conflict with transform\n      swipe_max_touches  : 1,\n      swipe_velocity     : 0.7\n    },\n    handler: function swipeGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END) {\n        // max touches\n        if(inst.options.swipe_max_touches > 0 &&\n            ev.touches.length > inst.options.swipe_max_touches) {\n              return;\n            }\n\n        // when the distance we moved is too small we skip this gesture\n        // or we can be already in dragging\n        if(ev.velocityX > inst.options.swipe_velocity ||\n            ev.velocityY > inst.options.swipe_velocity) {\n              // trigger swipe events\n              inst.trigger(this.name, ev);\n              inst.trigger(this.name + ev.direction, ev);\n            }\n      }\n    }\n  };\n\n\n  /**\n   * Drag\n   * Move with x fingers (default 1) around on the page. Blocking the scrolling when\n   * moving left and right is a good practice. When all the drag events are blocking\n   * you disable scrolling on that area.\n   * events  drag, drapleft, dragright, dragup, dragdown\n   */\n  ionic.Gestures.gestures.Drag = {\n    name: 'drag',\n    index: 50,\n    defaults: {\n      drag_min_distance : 10,\n      // Set correct_for_drag_min_distance to true to make the starting point of the drag\n      // be calculated from where the drag was triggered, not from where the touch started.\n      // Useful to avoid a jerk-starting drag, which can make fine-adjustments\n      // through dragging difficult, and be visually unappealing.\n      correct_for_drag_min_distance : true,\n      // set 0 for unlimited, but this can conflict with transform\n      drag_max_touches  : 1,\n      // prevent default browser behavior when dragging occurs\n      // be careful with it, it makes the element a blocking element\n      // when you are using the drag gesture, it is a good practice to set this true\n      drag_block_horizontal   : true,\n      drag_block_vertical     : true,\n      // drag_lock_to_axis keeps the drag gesture on the axis that it started on,\n      // It disallows vertical directions if the initial direction was horizontal, and vice versa.\n      drag_lock_to_axis       : false,\n      // drag lock only kicks in when distance > drag_lock_min_distance\n      // This way, locking occurs only when the distance has become large enough to reliably determine the direction\n      drag_lock_min_distance : 25\n    },\n    triggered: false,\n    handler: function dragGesture(ev, inst) {\n      // current gesture isnt drag, but dragged is true\n      // this means an other gesture is busy. now call dragend\n      if(ionic.Gestures.detection.current.name != this.name && this.triggered) {\n        inst.trigger(this.name +'end', ev);\n        this.triggered = false;\n        return;\n      }\n\n      // max touches\n      if(inst.options.drag_max_touches > 0 &&\n          ev.touches.length > inst.options.drag_max_touches) {\n            return;\n          }\n\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          this.triggered = false;\n          break;\n\n        case ionic.Gestures.EVENT_MOVE:\n          // when the distance we moved is too small we skip this gesture\n          // or we can be already in dragging\n          if(ev.distance < inst.options.drag_min_distance &&\n              ionic.Gestures.detection.current.name != this.name) {\n                return;\n              }\n\n          // we are dragging!\n          if(ionic.Gestures.detection.current.name != this.name) {\n            ionic.Gestures.detection.current.name = this.name;\n            if (inst.options.correct_for_drag_min_distance) {\n              // When a drag is triggered, set the event center to drag_min_distance pixels from the original event center.\n              // Without this correction, the dragged distance would jumpstart at drag_min_distance pixels instead of at 0.\n              // It might be useful to save the original start point somewhere\n              var factor = Math.abs(inst.options.drag_min_distance/ev.distance);\n              ionic.Gestures.detection.current.startEvent.center.pageX += ev.deltaX * factor;\n              ionic.Gestures.detection.current.startEvent.center.pageY += ev.deltaY * factor;\n\n              // recalculate event data using new start point\n              ev = ionic.Gestures.detection.extendEventData(ev);\n            }\n          }\n\n          // lock drag to axis?\n          if(ionic.Gestures.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance<=ev.distance)) {\n            ev.drag_locked_to_axis = true;\n          }\n          var last_direction = ionic.Gestures.detection.current.lastEvent.direction;\n          if(ev.drag_locked_to_axis && last_direction !== ev.direction) {\n            // keep direction on the axis that the drag gesture started on\n            if(ionic.Gestures.utils.isVertical(last_direction)) {\n              ev.direction = (ev.deltaY < 0) ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;\n            }\n            else {\n              ev.direction = (ev.deltaX < 0) ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;\n            }\n          }\n\n          // first time, trigger dragstart event\n          if(!this.triggered) {\n            inst.trigger(this.name +'start', ev);\n            this.triggered = true;\n          }\n\n          // trigger normal event\n          inst.trigger(this.name, ev);\n\n          // direction event, like dragdown\n          inst.trigger(this.name + ev.direction, ev);\n\n          // block the browser events\n          if( (inst.options.drag_block_vertical && ionic.Gestures.utils.isVertical(ev.direction)) ||\n              (inst.options.drag_block_horizontal && !ionic.Gestures.utils.isVertical(ev.direction))) {\n                ev.preventDefault();\n              }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          // trigger dragend\n          if(this.triggered) {\n            inst.trigger(this.name +'end', ev);\n          }\n\n          this.triggered = false;\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Transform\n   * User want to scale or rotate with 2 fingers\n   * events  transform, pinch, pinchin, pinchout, rotate\n   */\n  ionic.Gestures.gestures.Transform = {\n    name: 'transform',\n    index: 45,\n    defaults: {\n      // factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1\n      transform_min_scale     : 0.01,\n      // rotation in degrees\n      transform_min_rotation  : 1,\n      // prevent default browser behavior when two touches are on the screen\n      // but it makes the element a blocking element\n      // when you are using the transform gesture, it is a good practice to set this true\n      transform_always_block  : false\n    },\n    triggered: false,\n    handler: function transformGesture(ev, inst) {\n      // current gesture isnt drag, but dragged is true\n      // this means an other gesture is busy. now call dragend\n      if(ionic.Gestures.detection.current.name != this.name && this.triggered) {\n        inst.trigger(this.name +'end', ev);\n        this.triggered = false;\n        return;\n      }\n\n      // atleast multitouch\n      if(ev.touches.length < 2) {\n        return;\n      }\n\n      // prevent default when two fingers are on the screen\n      if(inst.options.transform_always_block) {\n        ev.preventDefault();\n      }\n\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          this.triggered = false;\n          break;\n\n        case ionic.Gestures.EVENT_MOVE:\n          var scale_threshold = Math.abs(1-ev.scale);\n          var rotation_threshold = Math.abs(ev.rotation);\n\n          // when the distance we moved is too small we skip this gesture\n          // or we can be already in dragging\n          if(scale_threshold < inst.options.transform_min_scale &&\n              rotation_threshold < inst.options.transform_min_rotation) {\n                return;\n              }\n\n          // we are transforming!\n          ionic.Gestures.detection.current.name = this.name;\n\n          // first time, trigger dragstart event\n          if(!this.triggered) {\n            inst.trigger(this.name +'start', ev);\n            this.triggered = true;\n          }\n\n          inst.trigger(this.name, ev); // basic transform event\n\n          // trigger rotate event\n          if(rotation_threshold > inst.options.transform_min_rotation) {\n            inst.trigger('rotate', ev);\n          }\n\n          // trigger pinch event\n          if(scale_threshold > inst.options.transform_min_scale) {\n            inst.trigger('pinch', ev);\n            inst.trigger('pinch'+ ((ev.scale < 1) ? 'in' : 'out'), ev);\n          }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          // trigger dragend\n          if(this.triggered) {\n            inst.trigger(this.name +'end', ev);\n          }\n\n          this.triggered = false;\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Touch\n   * Called as first, tells the user has touched the screen\n   * events  touch\n   */\n  ionic.Gestures.gestures.Touch = {\n    name: 'touch',\n    index: -Infinity,\n    defaults: {\n      // call preventDefault at touchstart, and makes the element blocking by\n      // disabling the scrolling of the page, but it improves gestures like\n      // transforming and dragging.\n      // be careful with using this, it can be very annoying for users to be stuck\n      // on the page\n      prevent_default: false,\n\n      // disable mouse events, so only touch (or pen!) input triggers events\n      prevent_mouseevents: false\n    },\n    handler: function touchGesture(ev, inst) {\n      if(inst.options.prevent_mouseevents && ev.pointerType == ionic.Gestures.POINTER_MOUSE) {\n        ev.stopDetect();\n        return;\n      }\n\n      if(inst.options.prevent_default) {\n        ev.preventDefault();\n      }\n\n      if(ev.eventType ==  ionic.Gestures.EVENT_START) {\n        inst.trigger(this.name, ev);\n      }\n    }\n  };\n\n\n  /**\n   * Release\n   * Called as last, tells the user has released the screen\n   * events  release\n   */\n  ionic.Gestures.gestures.Release = {\n    name: 'release',\n    index: Infinity,\n    handler: function releaseGesture(ev, inst) {\n      if(ev.eventType ==  ionic.Gestures.EVENT_END) {\n        inst.trigger(this.name, ev);\n      }\n    }\n  };\n})(window.ionic);\n\n(function(window, document, ionic) {\n\n  var IOS = 'ios';\n  var ANDROID = 'android';\n  var WINDOWS_PHONE = 'windowsphone';\n\n  /**\n   * @ngdoc utility\n   * @name ionic.Platform\n   * @module ionic\n   */\n  ionic.Platform = {\n\n    // Put navigator on platform so it can be mocked and set\n    // the browser does not allow window.navigator to be set\n    navigator: window.navigator,\n\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#isReady\n     * @returns {boolean} Whether the device is ready.\n     */\n    isReady: false,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#isFullScreen\n     * @returns {boolean} Whether the device is fullscreen.\n     */\n    isFullScreen: false,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#platforms\n     * @returns {Array(string)} An array of all platforms found.\n     */\n    platforms: null,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#grade\n     * @returns {string} What grade the current platform is.\n     */\n    grade: null,\n    ua: navigator.userAgent,\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#ready\n     * @description\n     * Trigger a callback once the device is ready, or immediately\n     * if the device is already ready. This method can be run from\n     * anywhere and does not need to be wrapped by any additonal methods.\n     * When the app is within a WebView (Cordova), it'll fire\n     * the callback once the device is ready. If the app is within\n     * a web browser, it'll fire the callback after `window.load`.\n     * Please remember that Cordova features (Camera, FileSystem, etc) still\n     * will not work in a web browser.\n     * @param {function} callback The function to call.\n     */\n    ready: function(cb) {\n      // run through tasks to complete now that the device is ready\n      if(this.isReady) {\n        cb();\n      } else {\n        // the platform isn't ready yet, add it to this array\n        // which will be called once the platform is ready\n        readyCallbacks.push(cb);\n      }\n    },\n\n    /**\n     * @private\n     */\n    detect: function() {\n      ionic.Platform._checkPlatforms();\n\n      ionic.requestAnimationFrame(function(){\n        // only add to the body class if we got platform info\n        for(var i = 0; i < ionic.Platform.platforms.length; i++) {\n          document.body.classList.add('platform-' + ionic.Platform.platforms[i]);\n        }\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#setGrade\n     * @description Set the grade of the device: 'a', 'b', or 'c'. 'a' is the best\n     * (most css features enabled), 'c' is the worst.  By default, sets the grade\n     * depending on the current device.\n     * @param {string} grade The new grade to set.\n     */\n    setGrade: function(grade) {\n      var oldGrade = this.grade;\n      this.grade = grade;\n      ionic.requestAnimationFrame(function() {\n        if (oldGrade) {\n          document.body.classList.remove('grade-' + oldGrade);\n        }\n        document.body.classList.add('grade-' + grade);\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#device\n     * @description Return the current device (given by cordova).\n     * @returns {object} The device object.\n     */\n    device: function() {\n      return window.device || {};\n    },\n\n    _checkPlatforms: function(platforms) {\n      this.platforms = [];\n      var grade = 'a';\n\n      if(this.isWebView()) {\n        this.platforms.push('webview');\n        this.platforms.push('cordova');\n      } else {\n        this.platforms.push('browser');\n      }\n      if(this.isIPad()) this.platforms.push('ipad');\n\n      var platform = this.platform();\n      if(platform) {\n        this.platforms.push(platform);\n\n        var version = this.version();\n        if(version) {\n          var v = version.toString();\n          if(v.indexOf('.') > 0) {\n            v = v.replace('.', '_');\n          } else {\n            v += '_0';\n          }\n          this.platforms.push(platform + v.split('_')[0]);\n          this.platforms.push(platform + v);\n\n          if(this.isAndroid() && version < 4.4) {\n            grade = (version < 4 ? 'c' : 'b');\n          } else if(this.isWindowsPhone()) {\n            grade = 'b';\n          }\n        }\n      }\n\n      this.setGrade(grade);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isWebView\n     * @returns {boolean} Check if we are running within a WebView (such as Cordova).\n     */\n    isWebView: function() {\n      return !(!window.cordova && !window.PhoneGap && !window.phonegap);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isIPad\n     * @returns {boolean} Whether we are running on iPad.\n     */\n    isIPad: function() {\n      if( /iPad/i.test(ionic.Platform.navigator.platform) ) {\n        return true;\n      }\n      return /iPad/i.test(this.ua);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isIOS\n     * @returns {boolean} Whether we are running on iOS.\n     */\n    isIOS: function() {\n      return this.is(IOS);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isAndroid\n     * @returns {boolean} Whether we are running on Android.\n     */\n    isAndroid: function() {\n      return this.is(ANDROID);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isWindowsPhone\n     * @returns {boolean} Whether we are running on Windows Phone.\n     */\n    isWindowsPhone: function() {\n      return this.is(WINDOWS_PHONE);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#platform\n     * @returns {string} The name of the current platform.\n     */\n    platform: function() {\n      // singleton to get the platform name\n      if(platformName === null) this.setPlatform(this.device().platform);\n      return platformName;\n    },\n\n    /**\n     * @private\n     */\n    setPlatform: function(n) {\n      if(typeof n != 'undefined' && n !== null && n.length) {\n        platformName = n.toLowerCase();\n      } else if(this.ua.indexOf('Android') > 0) {\n        platformName = ANDROID;\n      } else if(this.ua.indexOf('iPhone') > -1 || this.ua.indexOf('iPad') > -1 || this.ua.indexOf('iPod') > -1) {\n        platformName = IOS;\n      } else if(this.ua.indexOf('Windows Phone') > -1) {\n        platformName = WINDOWS_PHONE;\n      } else {\n        platformName = ionic.Platform.navigator.platform && navigator.platform.toLowerCase().split(' ')[0] || '';\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#version\n     * @returns {string} The version of the current device platform.\n     */\n    version: function() {\n      // singleton to get the platform version\n      if(platformVersion === null) this.setVersion(this.device().version);\n      return platformVersion;\n    },\n\n    /**\n     * @private\n     */\n    setVersion: function(v) {\n      if(typeof v != 'undefined' && v !== null) {\n        v = v.split('.');\n        v = parseFloat(v[0] + '.' + (v.length > 1 ? v[1] : 0));\n        if(!isNaN(v)) {\n          platformVersion = v;\n          return;\n        }\n      }\n\n      platformVersion = 0;\n\n      // fallback to user-agent checking\n      var pName = this.platform();\n      var versionMatch = {\n        'android': /Android (\\d+).(\\d+)?/,\n        'ios': /OS (\\d+)_(\\d+)?/,\n        'windowsphone': /Windows Phone (\\d+).(\\d+)?/\n      };\n      if(versionMatch[pName]) {\n        v = this.ua.match( versionMatch[pName] );\n        if(v &&  v.length > 2) {\n          platformVersion = parseFloat( v[1] + '.' + v[2] );\n        }\n      }\n    },\n\n    // Check if the platform is the one detected by cordova\n    is: function(type) {\n      type = type.toLowerCase();\n      // check if it has an array of platforms\n      if(this.platforms) {\n        for(var x = 0; x < this.platforms.length; x++) {\n          if(this.platforms[x] === type) return true;\n        }\n      }\n      // exact match\n      var pName = this.platform();\n      if(pName) {\n        return pName === type.toLowerCase();\n      }\n\n      // A quick hack for to check userAgent\n      return this.ua.toLowerCase().indexOf(type) >= 0;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#exitApp\n     * @description Exit the app.\n     */\n    exitApp: function() {\n      this.ready(function(){\n        navigator.app && navigator.app.exitApp && navigator.app.exitApp();\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#showStatusBar\n     * @description Shows or hides the device status bar (in Cordova).\n     * @param {boolean} shouldShow Whether or not to show the status bar.\n     */\n    showStatusBar: function(val) {\n      // Only useful when run within cordova\n      this._showStatusBar = val;\n      this.ready(function(){\n        // run this only when or if the platform (cordova) is ready\n        ionic.requestAnimationFrame(function(){\n          if(ionic.Platform._showStatusBar) {\n            // they do not want it to be full screen\n            window.StatusBar && window.StatusBar.show();\n            document.body.classList.remove('status-bar-hide');\n          } else {\n            // it should be full screen\n            window.StatusBar && window.StatusBar.hide();\n            document.body.classList.add('status-bar-hide');\n          }\n        });\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#fullScreen\n     * @description\n     * Sets whether the app is fullscreen or not (in Cordova).\n     * @param {boolean=} showFullScreen Whether or not to set the app to fullscreen. Defaults to true.\n     * @param {boolean=} showStatusBar Whether or not to show the device's status bar. Defaults to false.\n     */\n    fullScreen: function(showFullScreen, showStatusBar) {\n      // showFullScreen: default is true if no param provided\n      this.isFullScreen = (showFullScreen !== false);\n\n      // add/remove the fullscreen classname to the body\n      ionic.DomUtil.ready(function(){\n        // run this only when or if the DOM is ready\n        ionic.requestAnimationFrame(function(){\n          // fixing pane height before we adjust this\n          panes = document.getElementsByClassName('pane');\n          for(var i = 0;i<panes.length;i++){\n            panes[i].style.height = panes[i].offsetHeight+\"px\";\n          }\n          if(ionic.Platform.isFullScreen) {\n            document.body.classList.add('fullscreen');\n          } else {\n            document.body.classList.remove('fullscreen');\n          }\n        });\n        // showStatusBar: default is false if no param provided\n        ionic.Platform.showStatusBar( (showStatusBar === true) );\n      });\n    }\n\n  };\n\n  var platformName = null, // just the name, like iOS or Android\n  platformVersion = null, // a float of the major and minor, like 7.1\n  readyCallbacks = [];\n\n  // setup listeners to know when the device is ready to go\n  function onWindowLoad() {\n    if(ionic.Platform.isWebView()) {\n      // the window and scripts are fully loaded, and a cordova/phonegap\n      // object exists then let's listen for the deviceready\n      document.addEventListener(\"deviceready\", onPlatformReady, false);\n    } else {\n      // the window and scripts are fully loaded, but the window object doesn't have the\n      // cordova/phonegap object, so its just a browser, not a webview wrapped w/ cordova\n      onPlatformReady();\n    }\n    window.removeEventListener(\"load\", onWindowLoad, false);\n  }\n  window.addEventListener(\"load\", onWindowLoad, false);\n\n  function onPlatformReady() {\n    // the device is all set to go, init our own stuff then fire off our event\n    ionic.Platform.isReady = true;\n    ionic.Platform.detect();\n    for(var x=0; x<readyCallbacks.length; x++) {\n      // fire off all the callbacks that were added before the platform was ready\n      readyCallbacks[x]();\n    }\n    readyCallbacks = [];\n    ionic.trigger('platformready', { target: document });\n\n    ionic.requestAnimationFrame(function(){\n      document.body.classList.add('platform-ready');\n    });\n  }\n\n})(this, document, ionic);\n\n(function(document, ionic) {\n  'use strict';\n\n  // Ionic CSS polyfills\n  ionic.CSS = {};\n\n  (function() {\n\n    // transform\n    var i, keys = ['webkitTransform', 'transform', '-webkit-transform', 'webkit-transform',\n                   '-moz-transform', 'moz-transform', 'MozTransform', 'mozTransform', 'msTransform'];\n\n    for(i = 0; i < keys.length; i++) {\n      if(document.documentElement.style[keys[i]] !== undefined) {\n        ionic.CSS.TRANSFORM = keys[i];\n        break;\n      }\n    }\n\n    // transition\n    keys = ['webkitTransition', 'mozTransition', 'msTransition', 'transition'];\n    for(i = 0; i < keys.length; i++) {\n      if(document.documentElement.style[keys[i]] !== undefined) {\n        ionic.CSS.TRANSITION = keys[i];\n        break;\n      }\n    }\n\n  })();\n\n  // classList polyfill for them older Androids\n  // https://gist.github.com/devongovett/1381839\n  if (!(\"classList\" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') {\n    Object.defineProperty(HTMLElement.prototype, 'classList', {\n      get: function() {\n        var self = this;\n        function update(fn) {\n          return function() {\n            var x, classes = self.className.split(/\\s+/);\n\n            for(x=0; x<arguments.length; x++) {\n              fn(classes, classes.indexOf(arguments[x]), arguments[x]);\n            }\n\n            self.className = classes.join(\" \");\n          };\n        }\n\n        return {\n          add: update(function(classes, index, value) {\n            ~index || classes.push(value);\n          }),\n\n          remove: update(function(classes, index) {\n            ~index && classes.splice(index, 1);\n          }),\n\n          toggle: update(function(classes, index, value) {\n            ~index ? classes.splice(index, 1) : classes.push(value);\n          }),\n\n          contains: function(value) {\n            return !!~self.className.split(/\\s+/).indexOf(value);\n          },\n\n          item: function(i) {\n            return self.className.split(/\\s+/)[i] || null;\n          }\n        };\n\n      }\n    });\n  }\n\n})(document, ionic);\n\n\n/**\n * @ngdoc page\n * @name tap\n * @module ionic\n * @description\n * On touch devices such as a phone or tablet, some browsers implement a 300ms delay between\n * the time the user stops touching the display and the moment the browser executes the\n * click. This delay was initially introduced so the browser can know whether the user wants to\n * double-tap to zoom in on the webpage.  Basically, the browser waits roughly 300ms to see if\n * the user is double-tapping, or just tapping on the display once.\n *\n * Out of the box, Ionic automatically removes the 300ms delay in order to make Ionic apps\n * feel more \"native\" like. Resultingly, other solutions such as\n * [fastclick](https://github.com/ftlabs/fastclick) and Angular's\n * [ngTouch](https://docs.angularjs.org/api/ngTouch) should not be included, to avoid conflicts.\n *\n * Some browsers already remove the delay with certain settings, such as the CSS property\n * `touch-events: none` or with specific meta tag viewport values. However, each of these\n * browsers still handle clicks differently, such as when to fire off or cancel the event\n * (like scrolling when the target is a button, or holding a button down).\n * For browsers that already remove the 300ms delay, consider Ionic's tap system as a way to\n * normalize how clicks are handled across the various devices so there's an expected response\n * no matter what the device, platform or version. Additionally, Ionic will prevent\n * ghostclicks which even browsers that remove the delay still experience.\n *\n * In some cases, third-party libraries may also be working with touch events which can interfere\n * with the tap system. For example, mapping libraries like Google or Leaflet Maps often implement\n * a touch detection system which conflicts with Ionic's tap system.\n *\n * ### Disabling the tap system\n *\n * To disable the tap for an element and all of its children elements,\n * add the attribute `data-tap-disabled=\"true\"`.\n *\n * ```html\n * <div data-tap-disabled=\"true\">\n *     <div id=\"google-map\"></div>\n * </div>\n * ```\n *\n * ### Additional Notes:\n *\n * - Ionic tap  works with Ionic's JavaScript scrolling\n * - Elements can come and go from the DOM and Ionic tap doesn't keep adding and removing\n *   listeners\n * - No \"tap delay\" after the first \"tap\" (you can tap as fast as you want, they all click)\n * - Minimal events listeners, only being added to document\n * - Correct focus in/out on each input type (select, textearea, range) on each platform/device\n * - Shows and hides virtual keyboard correctly for each platform/device\n * - Works with labels surrounding inputs\n * - Does not fire off a click if the user moves the pointer too far\n * - Adds and removes an 'activated' css class\n * - Multiple [unit tests](https://github.com/driftyco/ionic/blob/master/test/unit/utils/tap.unit.js) for each scenario\n *\n */\n/*\n\n IONIC TAP\n ---------------\n - Both touch and mouse events are added to the document.body on DOM ready\n - If a touch event happens, it does not use mouse event listeners\n - On touchend, if the distance between start and end was small, trigger a click\n - In the triggered click event, add a 'isIonicTap' property\n - The triggered click receives the same x,y coordinates as as the end event\n - On document.body click listener (with useCapture=true), only allow clicks with 'isIonicTap'\n - Triggering clicks with mouse events work the same as touch, except with mousedown/mouseup\n - Tapping inputs is disabled during scrolling\n*/\n\nvar tapDoc; // the element which the listeners are on (document.body)\nvar tapActiveEle; // the element which is active (probably has focus)\nvar tapEnabledTouchEvents;\nvar tapMouseResetTimer;\nvar tapPointerMoved;\nvar tapPointerStart;\nvar tapTouchFocusedInput;\nvar tapLastTouchTarget;\nvar tapTouchMoveListener = 'touchmove';\n\n// how much the coordinates can be off between start/end, but still a click\nvar TAP_RELEASE_TOLERANCE = 6; // default tolerance\nvar TAP_RELEASE_BUTTON_TOLERANCE = 50; // button elements should have a larger tolerance\n\nvar tapEventListeners = {\n  'click': tapClickGateKeeper,\n\n  'mousedown': tapMouseDown,\n  'mouseup': tapMouseUp,\n  'mousemove': tapMouseMove,\n\n  'touchstart': tapTouchStart,\n  'touchend': tapTouchEnd,\n  'touchcancel': tapTouchCancel,\n  'touchmove': tapTouchMove,\n\n  'pointerdown': tapTouchStart,\n  'pointerup': tapTouchEnd,\n  'pointercancel': tapTouchCancel,\n  'pointermove': tapTouchMove,\n\n  'MSPointerDown': tapTouchStart,\n  'MSPointerUp': tapTouchEnd,\n  'MSPointerCancel': tapTouchCancel,\n  'MSPointerMove': tapTouchMove,\n\n  'focusin': tapFocusIn,\n  'focusout': tapFocusOut\n};\n\nionic.tap = {\n\n  register: function(ele) {\n    tapDoc = ele;\n\n    tapEventListener('click', true, true);\n    tapEventListener('mouseup');\n    tapEventListener('mousedown');\n\n    if( window.navigator.pointerEnabled ) {\n      tapEventListener('pointerdown');\n      tapEventListener('pointerup');\n      tapEventListener('pointcancel');\n      tapTouchMoveListener = 'pointermove';\n\n    } else if (window.navigator.msPointerEnabled) {\n      tapEventListener('MSPointerDown');\n      tapEventListener('MSPointerUp');\n      tapEventListener('MSPointerCancel');\n      tapTouchMoveListener = 'MSPointerMove';\n\n    } else {\n      tapEventListener('touchstart');\n      tapEventListener('touchend');\n      tapEventListener('touchcancel');\n    }\n\n    tapEventListener('focusin');\n    tapEventListener('focusout');\n\n    return function() {\n      for(var type in tapEventListeners) {\n        tapEventListener(type, false);\n      }\n      tapDoc = null;\n      tapActiveEle = null;\n      tapEnabledTouchEvents = false;\n      tapPointerMoved = false;\n      tapPointerStart = null;\n    };\n  },\n\n  ignoreScrollStart: function(e) {\n    return (e.defaultPrevented) ||  // defaultPrevented has been assigned by another component handling the event\n           (/^(file|range)$/i).test(e.target.type) ||\n           (e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll')) == 'true' || // manually set within an elements attributes\n           (!!(/^(object|embed)$/i).test(e.target.tagName)) ||  // flash/movie/object touches should not try to scroll\n           ionic.tap.isElementTapDisabled(e.target); // check if this element, or an ancestor, has `data-tap-disabled` attribute\n  },\n\n  isTextInput: function(ele) {\n    return !!ele &&\n           (ele.tagName == 'TEXTAREA' ||\n            ele.contentEditable === 'true' ||\n            (ele.tagName == 'INPUT' && !(/^(radio|checkbox|range|file|submit|reset)$/i).test(ele.type)) );\n  },\n\n  isDateInput: function(ele) {\n    return !!ele &&\n            (ele.tagName == 'INPUT' && (/^(date|time|datetime-local|month|week)$/i).test(ele.type));\n  },\n\n  isLabelWithTextInput: function(ele) {\n    var container = tapContainingElement(ele, false);\n\n    return !!container &&\n           ionic.tap.isTextInput( tapTargetElement( container ) );\n  },\n\n  containsOrIsTextInput: function(ele) {\n    return ionic.tap.isTextInput(ele) || ionic.tap.isLabelWithTextInput(ele);\n  },\n\n  cloneFocusedInput: function(container, scrollIntance) {\n    if(ionic.tap.hasCheckedClone) return;\n    ionic.tap.hasCheckedClone = true;\n\n    ionic.requestAnimationFrame(function(){\n      var focusInput = container.querySelector(':focus');\n      if( ionic.tap.isTextInput(focusInput) ) {\n        var clonedInput = focusInput.parentElement.querySelector('.cloned-text-input');\n        if(!clonedInput) {\n          clonedInput = document.createElement(focusInput.tagName);\n          clonedInput.placeholder = focusInput.placeholder;\n          clonedInput.type = focusInput.type;\n          clonedInput.value = focusInput.value;\n          clonedInput.style = focusInput.style;\n          clonedInput.className = focusInput.className;\n          clonedInput.classList.add('cloned-text-input');\n          clonedInput.readOnly = true;\n          if (focusInput.isContentEditable) {\n            clonedInput.contentEditable = focusInput.contentEditable;\n            clonedInput.innerHTML = focusInput.innerHTML;\n          }\n          focusInput.parentElement.insertBefore(clonedInput, focusInput);\n          focusInput.style.top = focusInput.offsetTop;\n          focusInput.classList.add('previous-input-focus');\n        }\n      }\n    });\n  },\n\n  hasCheckedClone: false,\n\n  removeClonedInputs: function(container, scrollIntance) {\n    ionic.tap.hasCheckedClone = false;\n\n    ionic.requestAnimationFrame(function(){\n      var clonedInputs = container.querySelectorAll('.cloned-text-input');\n      var previousInputFocus = container.querySelectorAll('.previous-input-focus');\n      var x;\n\n      for(x=0; x<clonedInputs.length; x++) {\n        clonedInputs[x].parentElement.removeChild( clonedInputs[x] );\n      }\n\n      for(x=0; x<previousInputFocus.length; x++) {\n        previousInputFocus[x].classList.remove('previous-input-focus');\n        previousInputFocus[x].style.top = '';\n        previousInputFocus[x].focus();\n      }\n    });\n  },\n\n  requiresNativeClick: function(ele) {\n    if(!ele || ele.disabled || (/^(file|range)$/i).test(ele.type) || (/^(object|video)$/i).test(ele.tagName) || ionic.tap.isLabelContainingFileInput(ele) ) {\n      return true;\n    }\n    return ionic.tap.isElementTapDisabled(ele);\n  },\n\n  isLabelContainingFileInput: function(ele) {\n    var lbl = tapContainingElement(ele);\n    if(lbl.tagName !== 'LABEL') return false;\n    var fileInput = lbl.querySelector('input[type=file]');\n    if(fileInput && fileInput.disabled === false) return true;\n    return false;\n  },\n\n  isElementTapDisabled: function(ele) {\n    if(ele && ele.nodeType === 1) {\n      var element = ele;\n      while(element) {\n        if( (element.dataset ? element.dataset.tapDisabled : element.getAttribute('data-tap-disabled')) == 'true' ) {\n          return true;\n        }\n        element = element.parentElement;\n      }\n    }\n    return false;\n  },\n\n  setTolerance: function(releaseTolerance, releaseButtonTolerance) {\n    TAP_RELEASE_TOLERANCE = releaseTolerance;\n    TAP_RELEASE_BUTTON_TOLERANCE = releaseButtonTolerance;\n  },\n\n  cancelClick: function() {\n    // used to cancel any simulated clicks which may happen on a touchend/mouseup\n    // gestures uses this method within its tap and hold events\n    tapPointerMoved = true;\n  },\n\n  pointerCoord: function(event) {\n    // This method can get coordinates for both a mouse click\n    // or a touch depending on the given event\n    var c = { x:0, y:0 };\n    if(event) {\n      var touches = event.touches && event.touches.length ? event.touches : [event];\n      var e = (event.changedTouches && event.changedTouches[0]) || touches[0];\n      if(e) {\n        c.x = e.clientX || e.pageX || 0;\n        c.y = e.clientY || e.pageY || 0;\n      }\n    }\n    return c;\n  }\n\n};\n\nfunction tapEventListener(type, enable, useCapture) {\n  if(enable !== false) {\n    tapDoc.addEventListener(type, tapEventListeners[type], useCapture);\n  } else {\n    tapDoc.removeEventListener(type, tapEventListeners[type]);\n  }\n}\n\nfunction tapClick(e) {\n  // simulate a normal click by running the element's click method then focus on it\n  var container = tapContainingElement(e.target);\n  var ele = tapTargetElement(container);\n\n  if( ionic.tap.requiresNativeClick(ele) || tapPointerMoved ) return false;\n\n  var c = ionic.tap.pointerCoord(e);\n\n  void 0;\n  triggerMouseEvent('click', ele, c.x, c.y);\n\n  // if it's an input, focus in on the target, otherwise blur\n  tapHandleFocus(ele);\n}\n\nfunction triggerMouseEvent(type, ele, x, y) {\n  // using initMouseEvent instead of MouseEvent for our Android friends\n  var clickEvent = document.createEvent(\"MouseEvents\");\n  clickEvent.initMouseEvent(type, true, true, window, 1, 0, 0, x, y, false, false, false, false, 0, null);\n  clickEvent.isIonicTap = true;\n  ele.dispatchEvent(clickEvent);\n}\n\nfunction tapClickGateKeeper(e) {\n  if(e.target.type == 'submit' && e.detail === 0) {\n    // do not prevent click if it came from an \"Enter\" or \"Go\" keypress submit\n    return;\n  }\n\n  // do not allow through any click events that were not created by ionic.tap\n  if( (ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target) ) ||\n      (!e.isIonicTap && !ionic.tap.requiresNativeClick(e.target)) ) {\n    void 0;\n    e.stopPropagation();\n\n    if( !ionic.tap.isLabelWithTextInput(e.target) ) {\n      // labels clicks from native should not preventDefault othersize keyboard will not show on input focus\n      e.preventDefault();\n    }\n    return false;\n  }\n}\n\n// MOUSE\nfunction tapMouseDown(e) {\n  if(e.isIonicTap || tapIgnoreEvent(e)) return;\n\n  if(tapEnabledTouchEvents) {\n    void 0;\n    e.stopPropagation();\n\n    if( (!ionic.tap.isTextInput(e.target) || tapLastTouchTarget !== e.target) && !(/^(select|option)$/i).test(e.target.tagName) ) {\n      // If you preventDefault on a text input then you cannot move its text caret/cursor.\n      // Allow through only the text input default. However, without preventDefault on an\n      // input the 300ms delay can change focus on inputs after the keyboard shows up.\n      // The focusin event handles the chance of focus changing after the keyboard shows.\n      e.preventDefault();\n    }\n\n    return false;\n  }\n\n  tapPointerMoved = false;\n  tapPointerStart = ionic.tap.pointerCoord(e);\n\n  tapEventListener('mousemove');\n  ionic.activator.start(e);\n}\n\nfunction tapMouseUp(e) {\n  if(tapEnabledTouchEvents) {\n    e.stopPropagation();\n    e.preventDefault();\n    return false;\n  }\n\n  if( tapIgnoreEvent(e) || (/^(select|option)$/i).test(e.target.tagName) ) return false;\n\n  if( !tapHasPointerMoved(e) ) {\n    tapClick(e);\n  }\n  tapEventListener('mousemove', false);\n  ionic.activator.end();\n  tapPointerMoved = false;\n}\n\nfunction tapMouseMove(e) {\n  if( tapHasPointerMoved(e) ) {\n    tapEventListener('mousemove', false);\n    ionic.activator.end();\n    tapPointerMoved = true;\n    return false;\n  }\n}\n\n\n// TOUCH\nfunction tapTouchStart(e) {\n  if( tapIgnoreEvent(e) ) return;\n\n  tapPointerMoved = false;\n\n  tapEnableTouchEvents();\n  tapPointerStart = ionic.tap.pointerCoord(e);\n\n  tapEventListener(tapTouchMoveListener);\n  ionic.activator.start(e);\n\n  if( ionic.Platform.isIOS() && ionic.tap.isLabelWithTextInput(e.target) ) {\n    // if the tapped element is a label, which has a child input\n    // then preventDefault so iOS doesn't ugly auto scroll to the input\n    // but do not prevent default on Android or else you cannot move the text caret\n    // and do not prevent default on Android or else no virtual keyboard shows up\n\n    var textInput = tapTargetElement( tapContainingElement(e.target) );\n    if( textInput !== tapActiveEle ) {\n      // don't preventDefault on an already focused input or else iOS's text caret isn't usable\n      e.preventDefault();\n    }\n  }\n}\n\nfunction tapTouchEnd(e) {\n  if( tapIgnoreEvent(e) ) return;\n\n  tapEnableTouchEvents();\n  if( !tapHasPointerMoved(e) ) {\n    tapClick(e);\n\n    if( (/^(select|option)$/i).test(e.target.tagName) ) {\n      e.preventDefault();\n    }\n  }\n\n  tapLastTouchTarget = e.target;\n  tapTouchCancel();\n}\n\nfunction tapTouchMove(e) {\n  if( tapHasPointerMoved(e) ) {\n    tapPointerMoved = true;\n    tapEventListener(tapTouchMoveListener, false);\n    ionic.activator.end();\n    return false;\n  }\n}\n\nfunction tapTouchCancel(e) {\n  tapEventListener(tapTouchMoveListener, false);\n  ionic.activator.end();\n  tapPointerMoved = false;\n}\n\nfunction tapEnableTouchEvents() {\n  tapEnabledTouchEvents = true;\n  clearTimeout(tapMouseResetTimer);\n  tapMouseResetTimer = setTimeout(function(){\n    tapEnabledTouchEvents = false;\n  }, 2000);\n}\n\nfunction tapIgnoreEvent(e) {\n  if(e.isTapHandled) return true;\n  e.isTapHandled = true;\n\n  if( ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target) ) {\n    e.preventDefault();\n    return true;\n  }\n}\n\nfunction tapHandleFocus(ele) {\n  tapTouchFocusedInput = null;\n\n  var triggerFocusIn = false;\n\n  if(ele.tagName == 'SELECT') {\n    // trick to force Android options to show up\n    triggerMouseEvent('mousedown', ele, 0, 0);\n    ele.focus && ele.focus();\n    triggerFocusIn = true;\n\n  } else if(tapActiveElement() === ele) {\n    // already is the active element and has focus\n    triggerFocusIn = true;\n\n  } else if( (/^(input|textarea)$/i).test(ele.tagName) || ele.isContentEditable ) {\n    triggerFocusIn = true;\n    ele.focus && ele.focus();\n    ele.value = ele.value;\n    if( tapEnabledTouchEvents ) {\n      tapTouchFocusedInput = ele;\n    }\n\n  } else {\n    tapFocusOutActive();\n  }\n\n  if(triggerFocusIn) {\n    tapActiveElement(ele);\n    ionic.trigger('ionic.focusin', {\n      target: ele\n    }, true);\n  }\n}\n\nfunction tapFocusOutActive() {\n  var ele = tapActiveElement();\n  if(ele && ((/^(input|textarea|select)$/i).test(ele.tagName) || ele.isContentEditable) ) {\n    void 0;\n    ele.blur();\n  }\n  tapActiveElement(null);\n}\n\nfunction tapFocusIn(e) {\n  // Because a text input doesn't preventDefault (so the caret still works) there's a chance\n  // that it's mousedown event 300ms later will change the focus to another element after\n  // the keyboard shows up.\n\n  if( tapEnabledTouchEvents &&\n      ionic.tap.isTextInput( tapActiveElement() ) &&\n      ionic.tap.isTextInput(tapTouchFocusedInput) &&\n      tapTouchFocusedInput !== e.target ) {\n\n    // 1) The pointer is from touch events\n    // 2) There is an active element which is a text input\n    // 3) A text input was just set to be focused on by a touch event\n    // 4) A new focus has been set, however the target isn't the one the touch event wanted\n    void 0;\n    tapTouchFocusedInput.focus();\n    tapTouchFocusedInput = null;\n  }\n  ionic.scroll.isScrolling = false;\n}\n\nfunction tapFocusOut() {\n  tapActiveElement(null);\n}\n\nfunction tapActiveElement(ele) {\n  if(arguments.length) {\n    tapActiveEle = ele;\n  }\n  return tapActiveEle || document.activeElement;\n}\n\nfunction tapHasPointerMoved(endEvent) {\n  if(!endEvent || endEvent.target.nodeType !== 1 || !tapPointerStart || ( tapPointerStart.x === 0 && tapPointerStart.y === 0 )) {\n    return false;\n  }\n  var endCoordinates = ionic.tap.pointerCoord(endEvent);\n\n  var hasClassList = !!(endEvent.target.classList && endEvent.target.classList.contains);\n  var releaseTolerance = hasClassList & endEvent.target.classList.contains('button') ?\n    TAP_RELEASE_BUTTON_TOLERANCE :\n    TAP_RELEASE_TOLERANCE;\n\n  return Math.abs(tapPointerStart.x - endCoordinates.x) > releaseTolerance ||\n         Math.abs(tapPointerStart.y - endCoordinates.y) > releaseTolerance;\n}\n\nfunction tapContainingElement(ele, allowSelf) {\n  var climbEle = ele;\n  for(var x=0; x<6; x++) {\n    if(!climbEle) break;\n    if(climbEle.tagName === 'LABEL') return climbEle;\n    climbEle = climbEle.parentElement;\n  }\n  if(allowSelf !== false) return ele;\n}\n\nfunction tapTargetElement(ele) {\n  if(ele && ele.tagName === 'LABEL') {\n    if(ele.control) return ele.control;\n\n    // older devices do not support the \"control\" property\n    if(ele.querySelector) {\n      var control = ele.querySelector('input,textarea,select');\n      if(control) return control;\n    }\n  }\n  return ele;\n}\n\nionic.DomUtil.ready(function(){\n  var ng = typeof angular !== 'undefined' ? angular : null;\n  //do nothing for e2e tests\n  if (!ng || (ng && !ng.scenario)) {\n    ionic.tap.register(document);\n  }\n});\n\n(function(document, ionic) {\n  'use strict';\n\n  var queueElements = {};   // elements that should get an active state in XX milliseconds\n  var activeElements = {};  // elements that are currently active\n  var keyId = 0;            // a counter for unique keys for the above ojects\n  var ACTIVATED_CLASS = 'activated';\n\n  ionic.activator = {\n\n    start: function(e) {\n      var self = this;\n\n      // when an element is touched/clicked, it climbs up a few\n      // parents to see if it is an .item or .button element\n      ionic.requestAnimationFrame(function(){\n        if ( ionic.tap.requiresNativeClick(e.target) ) return;\n        var ele = e.target;\n        var eleToActivate;\n\n        for(var x=0; x<6; x++) {\n          if(!ele || ele.nodeType !== 1) break;\n          if(eleToActivate && ele.classList.contains('item')) {\n            eleToActivate = ele;\n            break;\n          }\n          if( ele.tagName == 'A' || ele.tagName == 'BUTTON' || ele.hasAttribute('ng-click') ) {\n            eleToActivate = ele;\n            break;\n          }\n          if( ele.classList.contains('button') ) {\n            eleToActivate = ele;\n            break;\n          }\n          // no sense climbing past these\n          if(ele.classList.contains('pane') || ele.tagName == 'BODY' || ele.tagName == 'ION-CONTENT'){\n            break;\n          }\n          ele = ele.parentElement;\n        }\n\n        if(eleToActivate) {\n          // queue that this element should be set to active\n          queueElements[keyId] = eleToActivate;\n\n          // in XX milliseconds, set the queued elements to active\n          if(e.type === 'touchstart') {\n            self._activateTimeout = setTimeout(activateElements, 80);\n          } else {\n            ionic.requestAnimationFrame(activateElements);\n          }\n\n          keyId = (keyId > 19 ? 0 : keyId + 1);\n        }\n\n      });\n    },\n\n    end: function() {\n      // clear out any active/queued elements after XX milliseconds\n      clearTimeout(this._activateTimeout);\n      setTimeout(clear, 200);\n    }\n\n  };\n\n  function clear() {\n    // clear out any elements that are queued to be set to active\n    queueElements = {};\n\n    // in the next frame, remove the active class from all active elements\n    ionic.requestAnimationFrame(deactivateElements);\n  }\n\n  function activateElements() {\n    // activate all elements in the queue\n    for(var key in queueElements) {\n      if(queueElements[key]) {\n        queueElements[key].classList.add(ACTIVATED_CLASS);\n        activeElements[key] = queueElements[key];\n      }\n    }\n    queueElements = {};\n  }\n\n  function deactivateElements() {\n    for(var key in activeElements) {\n      if(activeElements[key]) {\n        activeElements[key].classList.remove(ACTIVATED_CLASS);\n        delete activeElements[key];\n      }\n    }\n  }\n\n})(document, ionic);\n\n(function(ionic) {\n\n  /* for nextUid() function below */\n  var uid = ['0','0','0'];\n\n  /**\n   * Various utilities used throughout Ionic\n   *\n   * Some of these are adopted from underscore.js and backbone.js, both also MIT licensed.\n   */\n  ionic.Utils = {\n\n    arrayMove: function (arr, old_index, new_index) {\n      if (new_index >= arr.length) {\n        var k = new_index - arr.length;\n        while ((k--) + 1) {\n          arr.push(undefined);\n        }\n      }\n      arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);\n      return arr;\n    },\n\n    /**\n     * Return a function that will be called with the given context\n     */\n    proxy: function(func, context) {\n      var args = Array.prototype.slice.call(arguments, 2);\n      return function() {\n        return func.apply(context, args.concat(Array.prototype.slice.call(arguments)));\n      };\n    },\n\n    /**\n     * Only call a function once in the given interval.\n     *\n     * @param func {Function} the function to call\n     * @param wait {int} how long to wait before/after to allow function calls\n     * @param immediate {boolean} whether to call immediately or after the wait interval\n     */\n     debounce: function(func, wait, immediate) {\n      var timeout, args, context, timestamp, result;\n      return function() {\n        context = this;\n        args = arguments;\n        timestamp = new Date();\n        var later = function() {\n          var last = (new Date()) - timestamp;\n          if (last < wait) {\n            timeout = setTimeout(later, wait - last);\n          } else {\n            timeout = null;\n            if (!immediate) result = func.apply(context, args);\n          }\n        };\n        var callNow = immediate && !timeout;\n        if (!timeout) {\n          timeout = setTimeout(later, wait);\n        }\n        if (callNow) result = func.apply(context, args);\n        return result;\n      };\n    },\n\n    /**\n     * Throttle the given fun, only allowing it to be\n     * called at most every `wait` ms.\n     */\n    throttle: function(func, wait, options) {\n      var context, args, result;\n      var timeout = null;\n      var previous = 0;\n      options || (options = {});\n      var later = function() {\n        previous = options.leading === false ? 0 : Date.now();\n        timeout = null;\n        result = func.apply(context, args);\n      };\n      return function() {\n        var now = Date.now();\n        if (!previous && options.leading === false) previous = now;\n        var remaining = wait - (now - previous);\n        context = this;\n        args = arguments;\n        if (remaining <= 0) {\n          clearTimeout(timeout);\n          timeout = null;\n          previous = now;\n          result = func.apply(context, args);\n        } else if (!timeout && options.trailing !== false) {\n          timeout = setTimeout(later, remaining);\n        }\n        return result;\n      };\n    },\n     // Borrowed from Backbone.js's extend\n     // Helper function to correctly set up the prototype chain, for subclasses.\n     // Similar to `goog.inherits`, but uses a hash of prototype properties and\n     // class properties to be extended.\n    inherit: function(protoProps, staticProps) {\n      var parent = this;\n      var child;\n\n      // The constructor function for the new subclass is either defined by you\n      // (the \"constructor\" property in your `extend` definition), or defaulted\n      // by us to simply call the parent's constructor.\n      if (protoProps && protoProps.hasOwnProperty('constructor')) {\n        child = protoProps.constructor;\n      } else {\n        child = function(){ return parent.apply(this, arguments); };\n      }\n\n      // Add static properties to the constructor function, if supplied.\n      ionic.extend(child, parent, staticProps);\n\n      // Set the prototype chain to inherit from `parent`, without calling\n      // `parent`'s constructor function.\n      var Surrogate = function(){ this.constructor = child; };\n      Surrogate.prototype = parent.prototype;\n      child.prototype = new Surrogate();\n\n      // Add prototype properties (instance properties) to the subclass,\n      // if supplied.\n      if (protoProps) ionic.extend(child.prototype, protoProps);\n\n      // Set a convenience property in case the parent's prototype is needed\n      // later.\n      child.__super__ = parent.prototype;\n\n      return child;\n    },\n\n    // Extend adapted from Underscore.js\n    extend: function(obj) {\n       var args = Array.prototype.slice.call(arguments, 1);\n       for(var i = 0; i < args.length; i++) {\n         var source = args[i];\n         if (source) {\n           for (var prop in source) {\n             obj[prop] = source[prop];\n           }\n         }\n       }\n       return obj;\n    },\n\n    /**\n     * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric\n     * characters such as '012ABC'. The reason why we are not using simply a number counter is that\n     * the number string gets longer over time, and it can also overflow, where as the nextId\n     * will grow much slower, it is a string, and it will never overflow.\n     *\n     * @returns an unique alpha-numeric string\n     */\n    nextUid: function() {\n      var index = uid.length;\n      var digit;\n\n      while(index) {\n        index--;\n        digit = uid[index].charCodeAt(0);\n        if (digit == 57 /*'9'*/) {\n          uid[index] = 'A';\n          return uid.join('');\n        }\n        if (digit == 90  /*'Z'*/) {\n          uid[index] = '0';\n        } else {\n          uid[index] = String.fromCharCode(digit + 1);\n          return uid.join('');\n        }\n      }\n      uid.unshift('0');\n      return uid.join('');\n    }\n  };\n\n  // Bind a few of the most useful functions to the ionic scope\n  ionic.inherit = ionic.Utils.inherit;\n  ionic.extend = ionic.Utils.extend;\n  ionic.throttle = ionic.Utils.throttle;\n  ionic.proxy = ionic.Utils.proxy;\n  ionic.debounce = ionic.Utils.debounce;\n\n})(window.ionic);\n\n/**\n * @ngdoc page\n * @name keyboard\n * @module ionic\n * @description\n * On both Android and iOS, Ionic will attempt to prevent the keyboard from\n * obscuring inputs and focusable elements when it appears by scrolling them\n * into view.  In order for this to work, any focusable elements must be within\n * a [Scroll View](http://ionicframework.com/docs/api/directive/ionScroll/)\n * or a directive such as [Content](http://ionicframework.com/docs/api/directive/ionContent/)\n * that has a Scroll View.\n *\n * It will also attempt to prevent the native overflow scrolling on focus,\n * which can cause layout issues such as pushing headers up and out of view.\n *\n * The keyboard fixes work best in conjunction with the\n * [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard),\n * although it will perform reasonably well without.  However, if you are using\n * Cordova there is no reason not to use the plugin.\n *\n * ### Hide when keyboard shows\n *\n * To hide an element when the keyboard is open, add the class `hide-on-keyboard-open`.\n *\n * ```html\n * <div class=\"hide-on-keyboard-open\">\n *   <div id=\"google-map\"></div>\n * </div>\n * ```\n * ----------\n *\n * ### Plugin Usage\n * Information on using the plugin can be found at\n * [https://github.com/driftyco/ionic-plugins-keyboard](https://github.com/driftyco/ionic-plugins-keyboard).\n *\n * ----------\n *\n * ### Android Notes\n * - If your app is running in fullscreen, i.e. you have\n *   `<preference name=\"Fullscreen\" value=\"true\" />` in your `config.xml` file\n *   you will need to set `ionic.Platform.isFullScreen = true` manually.\n *\n * - You can configure the behavior of the web view when the keyboard shows by setting\n *   [android:windowSoftInputMode](http://developer.android.com/reference/android/R.attr.html#windowSoftInputMode)\n *   to either `adjustPan`, `adjustResize` or `adjustNothing` in your app's\n *   activity in `AndroidManifest.xml`. `adjustResize` is the recommended setting\n *   for Ionic, but if for some reason you do use `adjustPan` you will need to\n *   set `ionic.Platform.isFullScreen = true`.\n *\n *   ```xml\n *   <activity android:windowSoftInputMode=\"adjustResize\">\n *\n *   ```\n *\n * ### iOS Notes\n * - If the content of your app (including the header) is being pushed up and\n *   out of view on input focus, try setting `cordova.plugins.Keyboard.disableScroll(true)`.\n *   This does **not** disable scrolling in the Ionic scroll view, rather it\n *   disables the native overflow scrolling that happens automatically as a\n *   result of focusing on inputs below the keyboard.\n *\n */\n\nvar keyboardViewportHeight = getViewportHeight();\nvar keyboardIsOpen;\nvar keyboardActiveElement;\nvar keyboardFocusOutTimer;\nvar keyboardFocusInTimer;\nvar keyboardLastShow = 0;\n\nvar KEYBOARD_OPEN_CSS = 'keyboard-open';\nvar SCROLL_CONTAINER_CSS = 'scroll';\n\nionic.keyboard = {\n  isOpen: false,\n  height: null,\n  landscape: false,\n};\n\nfunction keyboardInit() {\n  if( keyboardHasPlugin() ) {\n    window.addEventListener('native.keyboardshow', keyboardNativeShow);\n    window.addEventListener('native.keyboardhide', keyboardFocusOut);\n\n    //deprecated\n    window.addEventListener('native.showkeyboard', keyboardNativeShow);\n    window.addEventListener('native.hidekeyboard', keyboardFocusOut);\n\n  } else {\n    document.body.addEventListener('focusout', keyboardFocusOut);\n  }\n\n  document.body.addEventListener('ionic.focusin', keyboardBrowserFocusIn);\n  document.body.addEventListener('focusin', keyboardBrowserFocusIn);\n\n  document.body.addEventListener('orientationchange', keyboardOrientationChange);\n\n  if (window.navigator.msPointerEnabled) {\n    document.removeEventListener(\"MSPointerDown\", keyboardInit);\n  } else {\n    document.removeEventListener('touchstart', keyboardInit);\n  }\n}\n\nfunction keyboardNativeShow(e) {\n  clearTimeout(keyboardFocusOutTimer);\n  ionic.keyboard.height = e.keyboardHeight;\n}\n\nfunction keyboardBrowserFocusIn(e) {\n  if( !e.target || !ionic.tap.isTextInput(e.target) || ionic.tap.isDateInput(e.target) || !keyboardIsWithinScroll(e.target) ) return;\n\n  document.addEventListener('keydown', keyboardOnKeyDown, false);\n\n  document.body.scrollTop = 0;\n  document.body.querySelector('.scroll-content').scrollTop = 0;\n\n  keyboardActiveElement = e.target;\n\n  keyboardSetShow(e);\n}\n\nfunction keyboardSetShow(e) {\n  clearTimeout(keyboardFocusInTimer);\n  clearTimeout(keyboardFocusOutTimer);\n\n  keyboardFocusInTimer = setTimeout(function(){\n    if ( keyboardLastShow + 350 > Date.now() ) return;\n    keyboardLastShow = Date.now();\n    var keyboardHeight;\n    var elementBounds = keyboardActiveElement.getBoundingClientRect();\n    var count = 0;\n\n    var pollKeyboardHeight = setInterval(function(){\n\n      keyboardHeight = keyboardGetHeight();\n      if (count > 10){\n        clearInterval(pollKeyboardHeight);\n        //waited long enough, just guess\n        keyboardHeight = 275;\n      }\n      if (keyboardHeight){\n        keyboardShow(e.target, elementBounds.top, elementBounds.bottom, keyboardViewportHeight, keyboardHeight);\n        clearInterval(pollKeyboardHeight);\n      }\n      count++;\n\n    }, 100);\n  }, 32);\n}\n\nfunction keyboardShow(element, elementTop, elementBottom, viewportHeight, keyboardHeight) {\n  var details = {\n    target: element,\n    elementTop: Math.round(elementTop),\n    elementBottom: Math.round(elementBottom),\n    keyboardHeight: keyboardHeight,\n    viewportHeight: viewportHeight\n  };\n\n  details.hasPlugin = keyboardHasPlugin();\n\n  details.contentHeight = viewportHeight - keyboardHeight;\n\n  void 0;\n\n  // figure out if the element is under the keyboard\n  details.isElementUnderKeyboard = (details.elementBottom > details.contentHeight);\n\n  ionic.keyboard.isOpen = true;\n\n  // send event so the scroll view adjusts\n  keyboardActiveElement = element;\n  ionic.trigger('scrollChildIntoView', details, true);\n\n  ionic.requestAnimationFrame(function(){\n    document.body.classList.add(KEYBOARD_OPEN_CSS);\n  });\n\n  // any showing part of the document that isn't within the scroll the user\n  // could touchmove and cause some ugly changes to the app, so disable\n  // any touchmove events while the keyboard is open using e.preventDefault()\n  if (window.navigator.msPointerEnabled) {\n    document.addEventListener(\"MSPointerMove\", keyboardPreventDefault, false);\n  } else {\n    document.addEventListener('touchmove', keyboardPreventDefault, false);\n  }\n\n  return details;\n}\n\nfunction keyboardFocusOut(e) {\n  clearTimeout(keyboardFocusOutTimer);\n\n  keyboardFocusOutTimer = setTimeout(keyboardHide, 350);\n}\n\nfunction keyboardHide() {\n  void 0;\n  ionic.keyboard.isOpen = false;\n\n  ionic.trigger('resetScrollView', {\n    target: keyboardActiveElement\n  }, true);\n\n  ionic.requestAnimationFrame(function(){\n    document.body.classList.remove(KEYBOARD_OPEN_CSS);\n  });\n\n  // the keyboard is gone now, remove the touchmove that disables native scroll\n  if (window.navigator.msPointerEnabled) {\n    document.removeEventListener(\"MSPointerMove\", keyboardPreventDefault);\n  } else {\n    document.removeEventListener('touchmove', keyboardPreventDefault);\n  }\n  document.removeEventListener('keydown', keyboardOnKeyDown);\n}\n\nfunction keyboardUpdateViewportHeight() {\n  if( getViewportHeight() > keyboardViewportHeight ) {\n    keyboardViewportHeight = getViewportHeight();\n  }\n}\n\nfunction keyboardOnKeyDown(e) {\n  if( ionic.scroll.isScrolling ) {\n    keyboardPreventDefault(e);\n  }\n}\n\nfunction keyboardPreventDefault(e) {\n  if( e.target.tagName !== 'TEXTAREA' ) {\n    e.preventDefault();\n  }\n}\n\nfunction keyboardOrientationChange() {\n  var updatedViewportHeight = getViewportHeight();\n\n  //too slow, have to wait for updated height\n  if (updatedViewportHeight === keyboardViewportHeight){\n    var count = 0;\n    var pollViewportHeight = setInterval(function(){\n      //give up\n      if (count > 10){\n        clearInterval(pollViewportHeight);\n      }\n\n      updatedViewportHeight = getViewportHeight();\n\n      if (updatedViewportHeight !== keyboardViewportHeight){\n        if (updatedViewportHeight < keyboardViewportHeight){\n          ionic.keyboard.landscape = true;\n        } else {\n          ionic.keyboard.landscape = false;\n        }\n        keyboardViewportHeight = updatedViewportHeight;\n        clearInterval(pollViewportHeight);\n      }\n      count++;\n\n    }, 50);\n  } else {\n    keyboardViewportHeight = updatedViewportHeight;\n  }\n}\n\nfunction keyboardGetHeight() {\n  // check if we are already have a keyboard height from the plugin\n  if ( ionic.keyboard.height ) {\n    return ionic.keyboard.height;\n  }\n\n  if ( ionic.Platform.isAndroid() ){\n    //should be using the plugin, no way to know how big the keyboard is, so guess\n    if ( ionic.Platform.isFullScreen ){\n      return 275;\n    }\n    //otherwise, wait for the screen to resize\n    if ( getViewportHeight() < keyboardViewportHeight ){\n      return keyboardViewportHeight - getViewportHeight();\n    } else {\n      return 0;\n    }\n  }\n\n  // fallback for when its the webview without the plugin\n  // or for just the standard web browser\n  if( ionic.Platform.isIOS() ) {\n    if ( ionic.keyboard.landscape ){\n      return 206;\n    }\n\n    if (!ionic.Platform.isWebView()){\n      return 216;\n    }\n\n    return 260;\n  }\n\n  // safe guess\n  return 275;\n}\n\nfunction getViewportHeight() {\n  return window.innerHeight || screen.height;\n}\n\nfunction keyboardIsWithinScroll(ele) {\n  while(ele) {\n    if(ele.classList.contains(SCROLL_CONTAINER_CSS)) {\n      return true;\n    }\n    ele = ele.parentElement;\n  }\n  return false;\n}\n\nfunction keyboardHasPlugin() {\n  return !!(window.cordova && cordova.plugins && cordova.plugins.Keyboard);\n}\n\nionic.Platform.ready(function() {\n  keyboardUpdateViewportHeight();\n\n  // Android sometimes reports bad innerHeight on window.load\n  // try it again in a lil bit to play it safe\n  setTimeout(keyboardUpdateViewportHeight, 999);\n\n  // only initialize the adjustments for the virtual keyboard\n  // if a touchstart event happens\n  if (window.navigator.msPointerEnabled) {\n    document.addEventListener(\"MSPointerDown\", keyboardInit, false);\n  } else {\n    document.addEventListener('touchstart', keyboardInit, false);\n  }\n});\n\n\n\nvar viewportTag;\nvar viewportProperties = {};\n\nionic.viewport = {\n  orientation: function() {\n    // 0 = Portrait\n    // 90 = Landscape\n    // not using window.orientation because each device has a different implementation\n    return (window.innerWidth > window.innerHeight ? 90 : 0);\n  }\n};\n\nfunction viewportLoadTag() {\n  var x;\n\n  for(x=0; x<document.head.children.length; x++) {\n    if(document.head.children[x].name == 'viewport') {\n      viewportTag = document.head.children[x];\n      break;\n    }\n  }\n\n  if(viewportTag) {\n    var props = viewportTag.content.toLowerCase().replace(/\\s+/g, '').split(',');\n    var keyValue;\n    for(x=0; x<props.length; x++) {\n      if(props[x]) {\n        keyValue = props[x].split('=');\n        viewportProperties[ keyValue[0] ] = (keyValue.length > 1 ? keyValue[1] : '_');\n      }\n    }\n    viewportUpdate();\n  }\n}\n\nfunction viewportUpdate() {\n  // unit tests in viewport.unit.js\n\n  var initWidth = viewportProperties.width;\n  var initHeight = viewportProperties.height;\n  var p = ionic.Platform;\n  var version = p.version();\n  var DEVICE_WIDTH = 'device-width';\n  var DEVICE_HEIGHT = 'device-height';\n  var orientation = ionic.viewport.orientation();\n\n  // Most times we're removing the height and adding the width\n  // So this is the default to start with, then modify per platform/version/oreintation\n  delete viewportProperties.height;\n  viewportProperties.width = DEVICE_WIDTH;\n\n  if( p.isIPad() ) {\n    // iPad\n\n    if( version > 7 ) {\n      // iPad >= 7.1\n      // https://issues.apache.org/jira/browse/CB-4323\n      delete viewportProperties.width;\n\n    } else {\n      // iPad <= 7.0\n\n      if( p.isWebView() ) {\n        // iPad <= 7.0 WebView\n\n        if( orientation == 90 ) {\n          // iPad <= 7.0 WebView Landscape\n          viewportProperties.height = '0';\n\n        } else if(version == 7) {\n          // iPad <= 7.0 WebView Portait\n          viewportProperties.height = DEVICE_HEIGHT;\n        }\n      } else {\n        // iPad <= 6.1 Browser\n        if(version < 7) {\n          viewportProperties.height = '0';\n        }\n      }\n    }\n\n  } else if( p.isIOS() ) {\n    // iPhone\n\n    if( p.isWebView() ) {\n      // iPhone WebView\n\n      if(version > 7) {\n        // iPhone >= 7.1 WebView\n        delete viewportProperties.width;\n\n      } else if(version < 7) {\n        // iPhone <= 6.1 WebView\n        // if height was set it needs to get removed with this hack for <= 6.1\n        if( initHeight ) viewportProperties.height = '0';\n\n      } else if(version == 7) {\n        //iPhone == 7.0 WebView\n        viewportProperties.height = DEVICE_HEIGHT;\n      }\n\n    } else {\n      // iPhone Browser\n\n      if (version < 7) {\n        // iPhone <= 6.1 Browser\n        // if height was set it needs to get removed with this hack for <= 6.1\n        if( initHeight ) viewportProperties.height = '0';\n      }\n    }\n\n  }\n\n  // only update the viewport tag if there was a change\n  if(initWidth !== viewportProperties.width || initHeight !== viewportProperties.height) {\n    viewportTagUpdate();\n  }\n}\n\nfunction viewportTagUpdate() {\n  var key, props = [];\n  for(key in viewportProperties) {\n    if( viewportProperties[key] ) {\n      props.push(key + (viewportProperties[key] == '_' ? '' : '=' + viewportProperties[key]) );\n    }\n  }\n\n  viewportTag.content = props.join(', ');\n}\n\nionic.Platform.ready(function() {\n  viewportLoadTag();\n\n  window.addEventListener(\"orientationchange\", function(){\n    setTimeout(viewportUpdate, 1000);\n  }, false);\n});\n\n(function(ionic) {\n'use strict';\n  ionic.views.View = function() {\n    this.initialize.apply(this, arguments);\n  };\n\n  ionic.views.View.inherit = ionic.inherit;\n\n  ionic.extend(ionic.views.View.prototype, {\n    initialize: function() {}\n  });\n\n})(window.ionic);\n\n/*\n * Scroller\n * http://github.com/zynga/scroller\n *\n * Copyright 2011, Zynga Inc.\n * Licensed under the MIT License.\n * https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt\n *\n * Based on the work of: Unify Project (unify-project.org)\n * http://unify-project.org\n * Copyright 2011, Deutsche Telekom AG\n * License: MIT + Apache (V2)\n */\n\n/* jshint eqnull: true */\n\n/**\n * Generic animation class with support for dropped frames both optional easing and duration.\n *\n * Optional duration is useful when the lifetime is defined by another condition than time\n * e.g. speed of an animating object, etc.\n *\n * Dropped frame logic allows to keep using the same updater logic independent from the actual\n * rendering. This eases a lot of cases where it might be pretty complex to break down a state\n * based on the pure time difference.\n */\nvar zyngaCore = { effect: {} };\n(function(global) {\n  var time = Date.now || function() {\n    return +new Date();\n  };\n  var desiredFrames = 60;\n  var millisecondsPerSecond = 1000;\n  var running = {};\n  var counter = 1;\n\n  zyngaCore.effect.Animate = {\n\n    /**\n     * A requestAnimationFrame wrapper / polyfill.\n     *\n     * @param callback {Function} The callback to be invoked before the next repaint.\n     * @param root {HTMLElement} The root element for the repaint\n     */\n    requestAnimationFrame: (function() {\n\n      // Check for request animation Frame support\n      var requestFrame = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || global.oRequestAnimationFrame;\n      var isNative = !!requestFrame;\n\n      if (requestFrame && !/requestAnimationFrame\\(\\)\\s*\\{\\s*\\[native code\\]\\s*\\}/i.test(requestFrame.toString())) {\n        isNative = false;\n      }\n\n      if (isNative) {\n        return function(callback, root) {\n          requestFrame(callback, root);\n        };\n      }\n\n      var TARGET_FPS = 60;\n      var requests = {};\n      var requestCount = 0;\n      var rafHandle = 1;\n      var intervalHandle = null;\n      var lastActive = +new Date();\n\n      return function(callback, root) {\n        var callbackHandle = rafHandle++;\n\n        // Store callback\n        requests[callbackHandle] = callback;\n        requestCount++;\n\n        // Create timeout at first request\n        if (intervalHandle === null) {\n\n          intervalHandle = setInterval(function() {\n\n            var time = +new Date();\n            var currentRequests = requests;\n\n            // Reset data structure before executing callbacks\n            requests = {};\n            requestCount = 0;\n\n            for(var key in currentRequests) {\n              if (currentRequests.hasOwnProperty(key)) {\n                currentRequests[key](time);\n                lastActive = time;\n              }\n            }\n\n            // Disable the timeout when nothing happens for a certain\n            // period of time\n            if (time - lastActive > 2500) {\n              clearInterval(intervalHandle);\n              intervalHandle = null;\n            }\n\n          }, 1000 / TARGET_FPS);\n        }\n\n        return callbackHandle;\n      };\n\n    })(),\n\n\n    /**\n     * Stops the given animation.\n     *\n     * @param id {Integer} Unique animation ID\n     * @return {Boolean} Whether the animation was stopped (aka, was running before)\n     */\n    stop: function(id) {\n      var cleared = running[id] != null;\n      if (cleared) {\n        running[id] = null;\n      }\n\n      return cleared;\n    },\n\n\n    /**\n     * Whether the given animation is still running.\n     *\n     * @param id {Integer} Unique animation ID\n     * @return {Boolean} Whether the animation is still running\n     */\n    isRunning: function(id) {\n      return running[id] != null;\n    },\n\n\n    /**\n     * Start the animation.\n     *\n     * @param stepCallback {Function} Pointer to function which is executed on every step.\n     *   Signature of the method should be `function(percent, now, virtual) { return continueWithAnimation; }`\n     * @param verifyCallback {Function} Executed before every animation step.\n     *   Signature of the method should be `function() { return continueWithAnimation; }`\n     * @param completedCallback {Function}\n     *   Signature of the method should be `function(droppedFrames, finishedAnimation) {}`\n     * @param duration {Integer} Milliseconds to run the animation\n     * @param easingMethod {Function} Pointer to easing function\n     *   Signature of the method should be `function(percent) { return modifiedValue; }`\n     * @param root {Element} Render root, when available. Used for internal\n     *   usage of requestAnimationFrame.\n     * @return {Integer} Identifier of animation. Can be used to stop it any time.\n     */\n    start: function(stepCallback, verifyCallback, completedCallback, duration, easingMethod, root) {\n\n      var start = time();\n      var lastFrame = start;\n      var percent = 0;\n      var dropCounter = 0;\n      var id = counter++;\n\n      if (!root) {\n        root = document.body;\n      }\n\n      // Compacting running db automatically every few new animations\n      if (id % 20 === 0) {\n        var newRunning = {};\n        for (var usedId in running) {\n          newRunning[usedId] = true;\n        }\n        running = newRunning;\n      }\n\n      // This is the internal step method which is called every few milliseconds\n      var step = function(virtual) {\n\n        // Normalize virtual value\n        var render = virtual !== true;\n\n        // Get current time\n        var now = time();\n\n        // Verification is executed before next animation step\n        if (!running[id] || (verifyCallback && !verifyCallback(id))) {\n\n          running[id] = null;\n          completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, false);\n          return;\n\n        }\n\n        // For the current rendering to apply let's update omitted steps in memory.\n        // This is important to bring internal state variables up-to-date with progress in time.\n        if (render) {\n\n          var droppedFrames = Math.round((now - lastFrame) / (millisecondsPerSecond / desiredFrames)) - 1;\n          for (var j = 0; j < Math.min(droppedFrames, 4); j++) {\n            step(true);\n            dropCounter++;\n          }\n\n        }\n\n        // Compute percent value\n        if (duration) {\n          percent = (now - start) / duration;\n          if (percent > 1) {\n            percent = 1;\n          }\n        }\n\n        // Execute step callback, then...\n        var value = easingMethod ? easingMethod(percent) : percent;\n        if ((stepCallback(value, now, render) === false || percent === 1) && render) {\n          running[id] = null;\n          completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, percent === 1 || duration == null);\n        } else if (render) {\n          lastFrame = now;\n          zyngaCore.effect.Animate.requestAnimationFrame(step, root);\n        }\n      };\n\n      // Mark as running\n      running[id] = true;\n\n      // Init first step\n      zyngaCore.effect.Animate.requestAnimationFrame(step, root);\n\n      // Return unique animation ID\n      return id;\n    }\n  };\n})(this);\n\n/*\n * Scroller\n * http://github.com/zynga/scroller\n *\n * Copyright 2011, Zynga Inc.\n * Licensed under the MIT License.\n * https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt\n *\n * Based on the work of: Unify Project (unify-project.org)\n * http://unify-project.org\n * Copyright 2011, Deutsche Telekom AG\n * License: MIT + Apache (V2)\n */\n\nvar Scroller;\n\n(function(ionic) {\n  var NOOP = function(){};\n\n  // Easing Equations (c) 2003 Robert Penner, all rights reserved.\n  // Open source under the BSD License.\n\n  /**\n   * @param pos {Number} position between 0 (start of effect) and 1 (end of effect)\n  **/\n  var easeOutCubic = function(pos) {\n    return (Math.pow((pos - 1), 3) + 1);\n  };\n\n  /**\n   * @param pos {Number} position between 0 (start of effect) and 1 (end of effect)\n  **/\n  var easeInOutCubic = function(pos) {\n    if ((pos /= 0.5) < 1) {\n      return 0.5 * Math.pow(pos, 3);\n    }\n\n    return 0.5 * (Math.pow((pos - 2), 3) + 2);\n  };\n\n\n/**\n * ionic.views.Scroll\n * A powerful scroll view with support for bouncing, pull to refresh, and paging.\n * @param   {Object}        options options for the scroll view\n * @class A scroll view system\n * @memberof ionic.views\n */\nionic.views.Scroll = ionic.views.View.inherit({\n  initialize: function(options) {\n    var self = this;\n\n    this.__container = options.el;\n    this.__content = options.el.firstElementChild;\n\n    //Remove any scrollTop attached to these elements; they are virtual scroll now\n    //This also stops on-load-scroll-to-window.location.hash that the browser does\n    setTimeout(function() {\n      if (self.__container && self.__content) {\n        self.__container.scrollTop = 0;\n        self.__content.scrollTop = 0;\n      }\n    });\n\n    this.options = {\n\n      /** Disable scrolling on x-axis by default */\n      scrollingX: false,\n      scrollbarX: true,\n\n      /** Enable scrolling on y-axis */\n      scrollingY: true,\n      scrollbarY: true,\n\n      startX: 0,\n      startY: 0,\n\n      /** The amount to dampen mousewheel events */\n      wheelDampen: 6,\n\n      /** The minimum size the scrollbars scale to while scrolling */\n      minScrollbarSizeX: 5,\n      minScrollbarSizeY: 5,\n\n      /** Scrollbar fading after scrolling */\n      scrollbarsFade: true,\n      scrollbarFadeDelay: 300,\n      /** The initial fade delay when the pane is resized or initialized */\n      scrollbarResizeFadeDelay: 1000,\n\n      /** Enable animations for deceleration, snap back, zooming and scrolling */\n      animating: true,\n\n      /** duration for animations triggered by scrollTo/zoomTo */\n      animationDuration: 250,\n\n      /** Enable bouncing (content can be slowly moved outside and jumps back after releasing) */\n      bouncing: true,\n\n      /** Enable locking to the main axis if user moves only slightly on one of them at start */\n      locking: true,\n\n      /** Enable pagination mode (switching between full page content panes) */\n      paging: false,\n\n      /** Enable snapping of content to a configured pixel grid */\n      snapping: false,\n\n      /** Enable zooming of content via API, fingers and mouse wheel */\n      zooming: false,\n\n      /** Minimum zoom level */\n      minZoom: 0.5,\n\n      /** Maximum zoom level */\n      maxZoom: 3,\n\n      /** Multiply or decrease scrolling speed **/\n      speedMultiplier: 1,\n\n      deceleration: 0.97,\n\n      /** Callback that is fired on the later of touch end or deceleration end,\n        provided that another scrolling action has not begun. Used to know\n        when to fade out a scrollbar. */\n      scrollingComplete: NOOP,\n\n      /** This configures the amount of change applied to deceleration when reaching boundaries  **/\n      penetrationDeceleration : 0.03,\n\n      /** This configures the amount of change applied to acceleration when reaching boundaries  **/\n      penetrationAcceleration : 0.08,\n\n      // The ms interval for triggering scroll events\n      scrollEventInterval: 10,\n\n      getContentWidth: function() {\n        return Math.max(self.__content.scrollWidth, self.__content.offsetWidth);\n      },\n      getContentHeight: function() {\n        return Math.max(self.__content.scrollHeight, self.__content.offsetHeight + (self.__content.offsetTop * 2));\n      }\n    };\n\n    for (var key in options) {\n      this.options[key] = options[key];\n    }\n\n    this.hintResize = ionic.debounce(function() {\n      self.resize();\n    }, 1000, true);\n\n    this.onScroll = function() {\n\n      if(!ionic.scroll.isScrolling) {\n        setTimeout(self.setScrollStart, 50);\n      } else {\n        clearTimeout(self.scrollTimer);\n        self.scrollTimer = setTimeout(self.setScrollStop, 80);\n      }\n\n    };\n\n    this.setScrollStart = function() {\n      ionic.scroll.isScrolling = Math.abs(ionic.scroll.lastTop - self.__scrollTop) > 1;\n      clearTimeout(self.scrollTimer);\n      self.scrollTimer = setTimeout(self.setScrollStop, 80);\n    };\n\n    this.setScrollStop = function() {\n      ionic.scroll.isScrolling = false;\n      ionic.scroll.lastTop = self.__scrollTop;\n    };\n\n    this.triggerScrollEvent = ionic.throttle(function() {\n      self.onScroll();\n      ionic.trigger('scroll', {\n        scrollTop: self.__scrollTop,\n        scrollLeft: self.__scrollLeft,\n        target: self.__container\n      });\n    }, this.options.scrollEventInterval);\n\n    this.triggerScrollEndEvent = function() {\n      ionic.trigger('scrollend', {\n        scrollTop: self.__scrollTop,\n        scrollLeft: self.__scrollLeft,\n        target: self.__container\n      });\n    };\n\n    this.__scrollLeft = this.options.startX;\n    this.__scrollTop = this.options.startY;\n\n    // Get the render update function, initialize event handlers,\n    // and calculate the size of the scroll container\n    this.__callback = this.getRenderFn();\n    this.__initEventHandlers();\n    this.__createScrollbars();\n\n  },\n\n  run: function() {\n    this.resize();\n\n    // Fade them out\n    this.__fadeScrollbars('out', this.options.scrollbarResizeFadeDelay);\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: STATUS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Whether only a single finger is used in touch handling */\n  __isSingleTouch: false,\n\n  /** Whether a touch event sequence is in progress */\n  __isTracking: false,\n\n  /** Whether a deceleration animation went to completion. */\n  __didDecelerationComplete: false,\n\n  /**\n   * Whether a gesture zoom/rotate event is in progress. Activates when\n   * a gesturestart event happens. This has higher priority than dragging.\n   */\n  __isGesturing: false,\n\n  /**\n   * Whether the user has moved by such a distance that we have enabled\n   * dragging mode. Hint: It's only enabled after some pixels of movement to\n   * not interrupt with clicks etc.\n   */\n  __isDragging: false,\n\n  /**\n   * Not touching and dragging anymore, and smoothly animating the\n   * touch sequence using deceleration.\n   */\n  __isDecelerating: false,\n\n  /**\n   * Smoothly animating the currently configured change\n   */\n  __isAnimating: false,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: DIMENSIONS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Available outer left position (from document perspective) */\n  __clientLeft: 0,\n\n  /** Available outer top position (from document perspective) */\n  __clientTop: 0,\n\n  /** Available outer width */\n  __clientWidth: 0,\n\n  /** Available outer height */\n  __clientHeight: 0,\n\n  /** Outer width of content */\n  __contentWidth: 0,\n\n  /** Outer height of content */\n  __contentHeight: 0,\n\n  /** Snapping width for content */\n  __snapWidth: 100,\n\n  /** Snapping height for content */\n  __snapHeight: 100,\n\n  /** Height to assign to refresh area */\n  __refreshHeight: null,\n\n  /** Whether the refresh process is enabled when the event is released now */\n  __refreshActive: false,\n\n  /** Callback to execute on activation. This is for signalling the user about a refresh is about to happen when he release */\n  __refreshActivate: null,\n\n  /** Callback to execute on deactivation. This is for signalling the user about the refresh being cancelled */\n  __refreshDeactivate: null,\n\n  /** Callback to execute to start the actual refresh. Call {@link #refreshFinish} when done */\n  __refreshStart: null,\n\n  /** Zoom level */\n  __zoomLevel: 1,\n\n  /** Scroll position on x-axis */\n  __scrollLeft: 0,\n\n  /** Scroll position on y-axis */\n  __scrollTop: 0,\n\n  /** Maximum allowed scroll position on x-axis */\n  __maxScrollLeft: 0,\n\n  /** Maximum allowed scroll position on y-axis */\n  __maxScrollTop: 0,\n\n  /* Scheduled left position (final position when animating) */\n  __scheduledLeft: 0,\n\n  /* Scheduled top position (final position when animating) */\n  __scheduledTop: 0,\n\n  /* Scheduled zoom level (final scale when animating) */\n  __scheduledZoom: 0,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: LAST POSITIONS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Left position of finger at start */\n  __lastTouchLeft: null,\n\n  /** Top position of finger at start */\n  __lastTouchTop: null,\n\n  /** Timestamp of last move of finger. Used to limit tracking range for deceleration speed. */\n  __lastTouchMove: null,\n\n  /** List of positions, uses three indexes for each state: left, top, timestamp */\n  __positions: null,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: DECELERATION SUPPORT\n  ---------------------------------------------------------------------------\n  */\n\n  /** Minimum left scroll position during deceleration */\n  __minDecelerationScrollLeft: null,\n\n  /** Minimum top scroll position during deceleration */\n  __minDecelerationScrollTop: null,\n\n  /** Maximum left scroll position during deceleration */\n  __maxDecelerationScrollLeft: null,\n\n  /** Maximum top scroll position during deceleration */\n  __maxDecelerationScrollTop: null,\n\n  /** Current factor to modify horizontal scroll position with on every step */\n  __decelerationVelocityX: null,\n\n  /** Current factor to modify vertical scroll position with on every step */\n  __decelerationVelocityY: null,\n\n\n  /** the browser-specific property to use for transforms */\n  __transformProperty: null,\n  __perspectiveProperty: null,\n\n  /** scrollbar indicators */\n  __indicatorX: null,\n  __indicatorY: null,\n\n  /** Timeout for scrollbar fading */\n  __scrollbarFadeTimeout: null,\n\n  /** whether we've tried to wait for size already */\n  __didWaitForSize: null,\n  __sizerTimeout: null,\n\n  __initEventHandlers: function() {\n    var self = this;\n\n    // Event Handler\n    var container = this.__container;\n\n    self.scrollChildIntoView = function(e) {\n\n      //distance from bottom of scrollview to top of viewport\n      var scrollBottomOffsetToTop;\n\n      if( !self.isScrolledIntoView ) {\n        // shrink scrollview so we can actually scroll if the input is hidden\n        // if it isn't shrink so we can scroll to inputs under the keyboard\n        if (ionic.Platform.isIOS() || ionic.Platform.isFullScreen){\n          // if there are things below the scroll view account for them and\n          // subtract them from the keyboard height when resizing\n          scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n          var scrollBottomOffsetToBottom = e.detail.viewportHeight - scrollBottomOffsetToTop;\n          var keyboardOffset = Math.max(0, e.detail.keyboardHeight - scrollBottomOffsetToBottom);\n          container.style.height = (container.clientHeight - keyboardOffset) + \"px\";\n          container.style.overflow = \"visible\";\n          //update scroll view\n          self.resize();\n        }\n        self.isScrolledIntoView = true;\n      }\n\n      //If the element is positioned under the keyboard...\n      if( e.detail.isElementUnderKeyboard ) {\n        var delay;\n        // Wait on android for web view to resize\n        if ( ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen ) {\n          // android y u resize so slow\n          if ( ionic.Platform.version() < 4.4) {\n            delay = 500;\n          } else {\n            // probably overkill for chrome\n            delay = 350;\n          }\n        } else {\n          delay = 80;\n        }\n\n        //Put element in middle of visible screen\n        //Wait for android to update view height and resize() to reset scroll position\n        ionic.scroll.isScrolling = true;\n        setTimeout(function(){\n          //middle of the scrollview, where we want to scroll to\n          var scrollMidpointOffset = container.clientHeight * 0.5;\n\n          scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n          //distance from top of focused element to the bottom of the scroll view\n          var elementTopOffsetToScrollBottom = e.detail.elementTop - scrollBottomOffsetToTop;\n\n          var scrollTop = elementTopOffsetToScrollBottom  + scrollMidpointOffset;\n\n          if (scrollTop > 0){\n            ionic.tap.cloneFocusedInput(container, self);\n            self.scrollBy(0, scrollTop, true);\n            self.onScroll();\n          }\n        }, delay);\n      }\n\n      //Only the first scrollView parent of the element that broadcasted this event\n      //(the active element that needs to be shown) should receive this event\n      e.stopPropagation();\n    };\n\n    self.resetScrollView = function(e) {\n      //return scrollview to original height once keyboard has hidden\n      self.isScrolledIntoView = false;\n      container.style.height = \"\";\n      container.style.overflow = \"\";\n      self.resize();\n      ionic.scroll.isScrolling = false;\n    };\n\n    //Broadcasted when keyboard is shown on some platforms.\n    //See js/utils/keyboard.js\n    container.addEventListener('scrollChildIntoView', self.scrollChildIntoView);\n    container.addEventListener('resetScrollView', self.resetScrollView);\n\n    function getEventTouches(e) {\n      return e.touches && e.touches.length ? e.touches : [{\n        pageX: e.pageX,\n        pageY: e.pageY\n      }];\n    }\n\n    self.touchStart = function(e) {\n      self.startCoordinates = ionic.tap.pointerCoord(e);\n\n      if ( ionic.tap.ignoreScrollStart(e) ) {\n        return;\n      }\n\n      self.__isDown = true;\n\n      if( ionic.tap.containsOrIsTextInput(e.target) || e.target.tagName === 'SELECT' ) {\n        // do not start if the target is a text input\n        // if there is a touchmove on this input, then we can start the scroll\n        self.__hasStarted = false;\n        return;\n      }\n\n      self.__isSelectable = true;\n      self.__enableScrollY = true;\n      self.__hasStarted = true;\n      self.doTouchStart(getEventTouches(e), e.timeStamp);\n      e.preventDefault();\n    };\n\n    self.touchMove = function(e) {\n      if(!self.__isDown ||\n        e.defaultPrevented ||\n        (e.target.tagName === 'TEXTAREA' && e.target.parentElement.querySelector(':focus')) ) {\n        return;\n      }\n\n      if( !self.__hasStarted && ( ionic.tap.containsOrIsTextInput(e.target) || e.target.tagName === 'SELECT' ) ) {\n        // the target is a text input and scroll has started\n        // since the text input doesn't start on touchStart, do it here\n        self.__hasStarted = true;\n        self.doTouchStart(getEventTouches(e), e.timeStamp);\n        e.preventDefault();\n        return;\n      }\n\n      if(self.startCoordinates) {\n        // we have start coordinates, so get this touch move's current coordinates\n        var currentCoordinates = ionic.tap.pointerCoord(e);\n\n        if( self.__isSelectable &&\n            ionic.tap.isTextInput(e.target) &&\n            Math.abs(self.startCoordinates.x - currentCoordinates.x) > 20 ) {\n          // user slid the text input's caret on its x axis, disable any future y scrolling\n          self.__enableScrollY = false;\n          self.__isSelectable = true;\n        }\n\n        if( self.__enableScrollY && Math.abs(self.startCoordinates.y - currentCoordinates.y) > 10 ) {\n          // user scrolled the entire view on the y axis\n          // disabled being able to select text on an input\n          // hide the input which has focus, and show a cloned one that doesn't have focus\n          self.__isSelectable = false;\n          ionic.tap.cloneFocusedInput(container, self);\n        }\n      }\n\n      self.doTouchMove(getEventTouches(e), e.timeStamp, e.scale);\n      self.__isDown = true;\n    };\n\n    self.touchEnd = function(e) {\n      if(!self.__isDown) return;\n\n      self.doTouchEnd(e.timeStamp);\n      self.__isDown = false;\n      self.__hasStarted = false;\n      self.__isSelectable = true;\n      self.__enableScrollY = true;\n\n      if( !self.__isDragging && !self.__isDecelerating && !self.__isAnimating ) {\n        ionic.tap.removeClonedInputs(container, self);\n      }\n    };\n\n    if ('ontouchstart' in window) {\n      // Touch Events\n      container.addEventListener(\"touchstart\", self.touchStart, false);\n      document.addEventListener(\"touchmove\", self.touchMove, false);\n      document.addEventListener(\"touchend\", self.touchEnd, false);\n      document.addEventListener(\"touchcancel\", self.touchEnd, false);\n\n    } else if (window.navigator.pointerEnabled) {\n      // Pointer Events\n      container.addEventListener(\"pointerdown\", self.touchStart, false);\n      document.addEventListener(\"pointermove\", self.touchMove, false);\n      document.addEventListener(\"pointerup\", self.touchEnd, false);\n      document.addEventListener(\"pointercancel\", self.touchEnd, false);\n\n    } else if (window.navigator.msPointerEnabled) {\n      // IE10, WP8 (Pointer Events)\n      container.addEventListener(\"MSPointerDown\", self.touchStart, false);\n      document.addEventListener(\"MSPointerMove\", self.touchMove, false);\n      document.addEventListener(\"MSPointerUp\", self.touchEnd, false);\n      document.addEventListener(\"MSPointerCancel\", self.touchEnd, false);\n\n    } else {\n      // Mouse Events\n      var mousedown = false;\n\n      self.mouseDown = function(e) {\n        if ( ionic.tap.ignoreScrollStart(e) || e.target.tagName === 'SELECT' ) {\n          return;\n        }\n        self.doTouchStart(getEventTouches(e), e.timeStamp);\n\n        if( !ionic.tap.isTextInput(e.target) ) {\n          e.preventDefault();\n        }\n        mousedown = true;\n      };\n\n      self.mouseMove = function(e) {\n        if (!mousedown || e.defaultPrevented) {\n          return;\n        }\n\n        self.doTouchMove(getEventTouches(e), e.timeStamp);\n\n        mousedown = true;\n      };\n\n      self.mouseUp = function(e) {\n        if (!mousedown) {\n          return;\n        }\n\n        self.doTouchEnd(e.timeStamp);\n\n        mousedown = false;\n      };\n\n      self.mouseWheel = ionic.animationFrameThrottle(function(e) {\n        var scrollParent = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'ionic-scroll');\n        if (scrollParent === self.__container) {\n\n          self.hintResize();\n          self.scrollBy(\n            e.wheelDeltaX/self.options.wheelDampen,\n            -e.wheelDeltaY/self.options.wheelDampen\n          );\n\n          self.__fadeScrollbars('in');\n          clearTimeout(self.__wheelHideBarTimeout);\n          self.__wheelHideBarTimeout = setTimeout(function() {\n            self.__fadeScrollbars('out');\n          }, 100);\n        }\n      });\n\n      container.addEventListener(\"mousedown\", self.mouseDown, false);\n      document.addEventListener(\"mousemove\", self.mouseMove, false);\n      document.addEventListener(\"mouseup\", self.mouseUp, false);\n      document.addEventListener('mousewheel', self.mouseWheel, false);\n    }\n  },\n\n  __cleanup: function() {\n    var container = this.__container;\n    var self = this;\n\n    container.removeEventListener('touchstart', self.touchStart);\n    document.removeEventListener('touchmove', self.touchMove);\n    document.removeEventListener('touchend', self.touchEnd);\n    document.removeEventListener('touchcancel', self.touchCancel);\n\n    container.removeEventListener(\"pointerdown\", self.touchStart);\n    document.removeEventListener(\"pointermove\", self.touchMove);\n    document.removeEventListener(\"pointerup\", self.touchEnd);\n    document.removeEventListener(\"pointercancel\", self.touchEnd);\n\n    container.removeEventListener(\"MSPointerDown\", self.touchStart);\n    document.removeEventListener(\"MSPointerMove\", self.touchMove);\n    document.removeEventListener(\"MSPointerUp\", self.touchEnd);\n    document.removeEventListener(\"MSPointerCancel\", self.touchEnd);\n\n    container.removeEventListener(\"mousedown\", self.mouseDown);\n    document.removeEventListener(\"mousemove\", self.mouseMove);\n    document.removeEventListener(\"mouseup\", self.mouseUp);\n    document.removeEventListener('mousewheel', self.mouseWheel);\n\n    container.removeEventListener('scrollChildIntoView', self.scrollChildIntoView);\n    container.removeEventListener('resetScrollView', self.resetScrollView);\n\n    ionic.tap.removeClonedInputs(container, self);\n\n    delete this.__container;\n    delete this.__content;\n    delete this.__indicatorX;\n    delete this.__indicatorY;\n    delete this.options.el;\n\n    this.__callback = this.scrollChildIntoView = this.resetScrollView = angular.noop;\n\n    this.mouseMove = this.mouseDown = this.mouseUp = this.mouseWheel =\n      this.touchStart = this.touchMove = this.touchEnd = this.touchCancel = angular.noop;\n\n    this.resize = this.scrollTo = this.zoomTo =\n      this.__scrollingComplete = angular.noop;\n    container = null;\n  },\n\n  /** Create a scroll bar div with the given direction **/\n  __createScrollbar: function(direction) {\n    var bar = document.createElement('div'),\n      indicator = document.createElement('div');\n\n    indicator.className = 'scroll-bar-indicator';\n\n    if(direction == 'h') {\n      bar.className = 'scroll-bar scroll-bar-h';\n    } else {\n      bar.className = 'scroll-bar scroll-bar-v';\n    }\n\n    bar.appendChild(indicator);\n    return bar;\n  },\n\n  __createScrollbars: function() {\n    var indicatorX, indicatorY;\n\n    if(this.options.scrollingX) {\n      indicatorX = {\n        el: this.__createScrollbar('h'),\n        sizeRatio: 1\n      };\n      indicatorX.indicator = indicatorX.el.children[0];\n\n      if(this.options.scrollbarX) {\n        this.__container.appendChild(indicatorX.el);\n      }\n      this.__indicatorX = indicatorX;\n    }\n\n    if(this.options.scrollingY) {\n      indicatorY = {\n        el: this.__createScrollbar('v'),\n        sizeRatio: 1\n      };\n      indicatorY.indicator = indicatorY.el.children[0];\n\n      if(this.options.scrollbarY) {\n        this.__container.appendChild(indicatorY.el);\n      }\n      this.__indicatorY = indicatorY;\n    }\n  },\n\n  __resizeScrollbars: function() {\n    var self = this;\n\n    // Update horiz bar\n    if(self.__indicatorX) {\n      var width = Math.max(Math.round(self.__clientWidth * self.__clientWidth / (self.__contentWidth)), 20);\n      if(width > self.__contentWidth) {\n        width = 0;\n      }\n      self.__indicatorX.size = width;\n      self.__indicatorX.minScale = this.options.minScrollbarSizeX / width;\n      self.__indicatorX.indicator.style.width = width + 'px';\n      self.__indicatorX.maxPos = self.__clientWidth - width;\n      self.__indicatorX.sizeRatio = self.__maxScrollLeft ? self.__indicatorX.maxPos / self.__maxScrollLeft : 1;\n    }\n\n    // Update vert bar\n    if(self.__indicatorY) {\n      var height = Math.max(Math.round(self.__clientHeight * self.__clientHeight / (self.__contentHeight)), 20);\n      if(height > self.__contentHeight) {\n        height = 0;\n      }\n      self.__indicatorY.size = height;\n      self.__indicatorY.minScale = this.options.minScrollbarSizeY / height;\n      self.__indicatorY.maxPos = self.__clientHeight - height;\n      self.__indicatorY.indicator.style.height = height + 'px';\n      self.__indicatorY.sizeRatio = self.__maxScrollTop ? self.__indicatorY.maxPos / self.__maxScrollTop : 1;\n    }\n  },\n\n  /**\n   * Move and scale the scrollbars as the page scrolls.\n   */\n  __repositionScrollbars: function() {\n    var self = this, width, heightScale,\n        widthDiff, heightDiff,\n        x, y,\n        xstop = 0, ystop = 0;\n\n    if(self.__indicatorX) {\n      // Handle the X scrollbar\n\n      // Don't go all the way to the right if we have a vertical scrollbar as well\n      if(self.__indicatorY) xstop = 10;\n\n      x = Math.round(self.__indicatorX.sizeRatio * self.__scrollLeft) || 0,\n\n      // The the difference between the last content X position, and our overscrolled one\n      widthDiff = self.__scrollLeft - (self.__maxScrollLeft - xstop);\n\n      if(self.__scrollLeft < 0) {\n\n        widthScale = Math.max(self.__indicatorX.minScale,\n            (self.__indicatorX.size - Math.abs(self.__scrollLeft)) / self.__indicatorX.size);\n\n        // Stay at left\n        x = 0;\n\n        // Make sure scale is transformed from the left/center origin point\n        self.__indicatorX.indicator.style[self.__transformOriginProperty] = 'left center';\n      } else if(widthDiff > 0) {\n\n        widthScale = Math.max(self.__indicatorX.minScale,\n            (self.__indicatorX.size - widthDiff) / self.__indicatorX.size);\n\n        // Stay at the furthest x for the scrollable viewport\n        x = self.__indicatorX.maxPos - xstop;\n\n        // Make sure scale is transformed from the right/center origin point\n        self.__indicatorX.indicator.style[self.__transformOriginProperty] = 'right center';\n\n      } else {\n\n        // Normal motion\n        x = Math.min(self.__maxScrollLeft, Math.max(0, x));\n        widthScale = 1;\n\n      }\n\n      self.__indicatorX.indicator.style[self.__transformProperty] = 'translate3d(' + x + 'px, 0, 0) scaleX(' + widthScale + ')';\n    }\n\n    if(self.__indicatorY) {\n\n      y = Math.round(self.__indicatorY.sizeRatio * self.__scrollTop) || 0;\n\n      // Don't go all the way to the right if we have a vertical scrollbar as well\n      if(self.__indicatorX) ystop = 10;\n\n      heightDiff = self.__scrollTop - (self.__maxScrollTop - ystop);\n\n      if(self.__scrollTop < 0) {\n\n        heightScale = Math.max(self.__indicatorY.minScale, (self.__indicatorY.size - Math.abs(self.__scrollTop)) / self.__indicatorY.size);\n\n        // Stay at top\n        y = 0;\n\n        // Make sure scale is transformed from the center/top origin point\n        self.__indicatorY.indicator.style[self.__transformOriginProperty] = 'center top';\n\n      } else if(heightDiff > 0) {\n\n        heightScale = Math.max(self.__indicatorY.minScale, (self.__indicatorY.size - heightDiff) / self.__indicatorY.size);\n\n        // Stay at bottom of scrollable viewport\n        y = self.__indicatorY.maxPos - ystop;\n\n        // Make sure scale is transformed from the center/bottom origin point\n        self.__indicatorY.indicator.style[self.__transformOriginProperty] = 'center bottom';\n\n      } else {\n\n        // Normal motion\n        y = Math.min(self.__maxScrollTop, Math.max(0, y));\n        heightScale = 1;\n\n      }\n\n      self.__indicatorY.indicator.style[self.__transformProperty] = 'translate3d(0,' + y + 'px, 0) scaleY(' + heightScale + ')';\n    }\n  },\n\n  __fadeScrollbars: function(direction, delay) {\n    var self = this;\n\n    if(!this.options.scrollbarsFade) {\n      return;\n    }\n\n    var className = 'scroll-bar-fade-out';\n\n    if(self.options.scrollbarsFade === true) {\n      clearTimeout(self.__scrollbarFadeTimeout);\n\n      if(direction == 'in') {\n        if(self.__indicatorX) { self.__indicatorX.indicator.classList.remove(className); }\n        if(self.__indicatorY) { self.__indicatorY.indicator.classList.remove(className); }\n      } else {\n        self.__scrollbarFadeTimeout = setTimeout(function() {\n          if(self.__indicatorX) { self.__indicatorX.indicator.classList.add(className); }\n          if(self.__indicatorY) { self.__indicatorY.indicator.classList.add(className); }\n        }, delay || self.options.scrollbarFadeDelay);\n      }\n    }\n  },\n\n  __scrollingComplete: function() {\n    var self = this;\n    self.options.scrollingComplete();\n    ionic.tap.removeClonedInputs(self.__container, self);\n\n    self.__fadeScrollbars('out');\n  },\n\n  resize: function() {\n    // Update Scroller dimensions for changed content\n    // Add padding to bottom of content\n    this.setDimensions(\n      this.__container.clientWidth,\n      this.__container.clientHeight,\n      this.options.getContentWidth(),\n      this.options.getContentHeight()\n    );\n  },\n  /*\n  ---------------------------------------------------------------------------\n    PUBLIC API\n  ---------------------------------------------------------------------------\n  */\n\n  getRenderFn: function() {\n    var self = this;\n\n    var content = this.__content;\n\n    var docStyle = document.documentElement.style;\n\n    var engine;\n    if ('MozAppearance' in docStyle) {\n      engine = 'gecko';\n    } else if ('WebkitAppearance' in docStyle) {\n      engine = 'webkit';\n    } else if (typeof navigator.cpuClass === 'string') {\n      engine = 'trident';\n    }\n\n    var vendorPrefix = {\n      trident: 'ms',\n      gecko: 'Moz',\n      webkit: 'Webkit',\n      presto: 'O'\n    }[engine];\n\n    var helperElem = document.createElement(\"div\");\n    var undef;\n\n    var perspectiveProperty = vendorPrefix + \"Perspective\";\n    var transformProperty = vendorPrefix + \"Transform\";\n    var transformOriginProperty = vendorPrefix + 'TransformOrigin';\n\n    self.__perspectiveProperty = transformProperty;\n    self.__transformProperty = transformProperty;\n    self.__transformOriginProperty = transformOriginProperty;\n\n    if (helperElem.style[perspectiveProperty] !== undef) {\n\n      return function(left, top, zoom, wasResize) {\n        content.style[transformProperty] = 'translate3d(' + (-left) + 'px,' + (-top) + 'px,0) scale(' + zoom + ')';\n        self.__repositionScrollbars();\n        if(!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    } else if (helperElem.style[transformProperty] !== undef) {\n\n      return function(left, top, zoom, wasResize) {\n        content.style[transformProperty] = 'translate(' + (-left) + 'px,' + (-top) + 'px) scale(' + zoom + ')';\n        self.__repositionScrollbars();\n        if(!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    } else {\n\n      return function(left, top, zoom, wasResize) {\n        content.style.marginLeft = left ? (-left/zoom) + 'px' : '';\n        content.style.marginTop = top ? (-top/zoom) + 'px' : '';\n        content.style.zoom = zoom || '';\n        self.__repositionScrollbars();\n        if(!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    }\n  },\n\n\n  /**\n   * Configures the dimensions of the client (outer) and content (inner) elements.\n   * Requires the available space for the outer element and the outer size of the inner element.\n   * All values which are falsy (null or zero etc.) are ignored and the old value is kept.\n   *\n   * @param clientWidth {Integer} Inner width of outer element\n   * @param clientHeight {Integer} Inner height of outer element\n   * @param contentWidth {Integer} Outer width of inner element\n   * @param contentHeight {Integer} Outer height of inner element\n   */\n  setDimensions: function(clientWidth, clientHeight, contentWidth, contentHeight) {\n    var self = this;\n\n    // Only update values which are defined\n    if (clientWidth === +clientWidth) {\n      self.__clientWidth = clientWidth;\n    }\n\n    if (clientHeight === +clientHeight) {\n      self.__clientHeight = clientHeight;\n    }\n\n    if (contentWidth === +contentWidth) {\n      self.__contentWidth = contentWidth;\n    }\n\n    if (contentHeight === +contentHeight) {\n      self.__contentHeight = contentHeight;\n    }\n\n    // Refresh maximums\n    self.__computeScrollMax();\n    self.__resizeScrollbars();\n\n    // Refresh scroll position\n    self.scrollTo(self.__scrollLeft, self.__scrollTop, true, null, true);\n\n  },\n\n\n  /**\n   * Sets the client coordinates in relation to the document.\n   *\n   * @param left {Integer} Left position of outer element\n   * @param top {Integer} Top position of outer element\n   */\n  setPosition: function(left, top) {\n\n    var self = this;\n\n    self.__clientLeft = left || 0;\n    self.__clientTop = top || 0;\n\n  },\n\n\n  /**\n   * Configures the snapping (when snapping is active)\n   *\n   * @param width {Integer} Snapping width\n   * @param height {Integer} Snapping height\n   */\n  setSnapSize: function(width, height) {\n\n    var self = this;\n\n    self.__snapWidth = width;\n    self.__snapHeight = height;\n\n  },\n\n\n  /**\n   * Activates pull-to-refresh. A special zone on the top of the list to start a list refresh whenever\n   * the user event is released during visibility of this zone. This was introduced by some apps on iOS like\n   * the official Twitter client.\n   *\n   * @param height {Integer} Height of pull-to-refresh zone on top of rendered list\n   * @param activateCallback {Function} Callback to execute on activation. This is for signalling the user about a refresh is about to happen when he release.\n   * @param deactivateCallback {Function} Callback to execute on deactivation. This is for signalling the user about the refresh being cancelled.\n   * @param startCallback {Function} Callback to execute to start the real async refresh action. Call {@link #finishPullToRefresh} after finish of refresh.\n   * @param showCallback {Function} Callback to execute when the refresher should be shown. This is for showing the refresher during a negative scrollTop.\n   * @param hideCallback {Function} Callback to execute when the refresher should be hidden. This is for hiding the refresher when it's behind the nav bar.\n   */\n  activatePullToRefresh: function(height, activateCallback, deactivateCallback, startCallback, showCallback, hideCallback) {\n\n    var self = this;\n\n    self.__refreshHeight = height;\n    self.__refreshActivate = activateCallback;\n    self.__refreshDeactivate = deactivateCallback;\n    self.__refreshStart = startCallback;\n    self.__refreshShow = showCallback;\n    self.__refreshHide = hideCallback;\n  },\n\n\n  /**\n   * Starts pull-to-refresh manually.\n   */\n  triggerPullToRefresh: function() {\n    // Use publish instead of scrollTo to allow scrolling to out of boundary position\n    // We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled\n    this.__publish(this.__scrollLeft, -this.__refreshHeight, this.__zoomLevel, true);\n\n    if (this.__refreshStart) {\n      this.__refreshStart();\n    }\n  },\n\n\n  /**\n   * Signalizes that pull-to-refresh is finished.\n   */\n  finishPullToRefresh: function() {\n\n    var self = this;\n\n    self.__refreshActive = false;\n    if (self.__refreshDeactivate) {\n      self.__refreshDeactivate();\n    }\n\n    self.scrollTo(self.__scrollLeft, self.__scrollTop, true);\n\n  },\n\n\n  /**\n   * Returns the scroll position and zooming values\n   *\n   * @return {Map} `left` and `top` scroll position and `zoom` level\n   */\n  getValues: function() {\n\n    var self = this;\n\n    return {\n      left: self.__scrollLeft,\n      top: self.__scrollTop,\n      zoom: self.__zoomLevel\n    };\n\n  },\n\n\n  /**\n   * Returns the maximum scroll values\n   *\n   * @return {Map} `left` and `top` maximum scroll values\n   */\n  getScrollMax: function() {\n\n    var self = this;\n\n    return {\n      left: self.__maxScrollLeft,\n      top: self.__maxScrollTop\n    };\n\n  },\n\n\n  /**\n   * Zooms to the given level. Supports optional animation. Zooms\n   * the center when no coordinates are given.\n   *\n   * @param level {Number} Level to zoom to\n   * @param animate {Boolean} Whether to use animation\n   * @param originLeft {Number} Zoom in at given left coordinate\n   * @param originTop {Number} Zoom in at given top coordinate\n   */\n  zoomTo: function(level, animate, originLeft, originTop) {\n\n    var self = this;\n\n    if (!self.options.zooming) {\n      throw new Error(\"Zooming is not enabled!\");\n    }\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n    }\n\n    var oldLevel = self.__zoomLevel;\n\n    // Normalize input origin to center of viewport if not defined\n    if (originLeft == null) {\n      originLeft = self.__clientWidth / 2;\n    }\n\n    if (originTop == null) {\n      originTop = self.__clientHeight / 2;\n    }\n\n    // Limit level according to configuration\n    level = Math.max(Math.min(level, self.options.maxZoom), self.options.minZoom);\n\n    // Recompute maximum values while temporary tweaking maximum scroll ranges\n    self.__computeScrollMax(level);\n\n    // Recompute left and top coordinates based on new zoom level\n    var left = ((originLeft + self.__scrollLeft) * level / oldLevel) - originLeft;\n    var top = ((originTop + self.__scrollTop) * level / oldLevel) - originTop;\n\n    // Limit x-axis\n    if (left > self.__maxScrollLeft) {\n      left = self.__maxScrollLeft;\n    } else if (left < 0) {\n      left = 0;\n    }\n\n    // Limit y-axis\n    if (top > self.__maxScrollTop) {\n      top = self.__maxScrollTop;\n    } else if (top < 0) {\n      top = 0;\n    }\n\n    // Push values out\n    self.__publish(left, top, level, animate);\n\n  },\n\n\n  /**\n   * Zooms the content by the given factor.\n   *\n   * @param factor {Number} Zoom by given factor\n   * @param animate {Boolean} Whether to use animation\n   * @param originLeft {Number} Zoom in at given left coordinate\n   * @param originTop {Number} Zoom in at given top coordinate\n   */\n  zoomBy: function(factor, animate, originLeft, originTop) {\n\n    var self = this;\n\n    self.zoomTo(self.__zoomLevel * factor, animate, originLeft, originTop);\n\n  },\n\n\n  /**\n   * Scrolls to the given position. Respect limitations and snapping automatically.\n   *\n   * @param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>\n   * @param top {Number} Vertical scroll position, keeps current if value is <code>null</code>\n   * @param animate {Boolean} Whether the scrolling should happen using an animation\n   * @param zoom {Number} Zoom level to go to\n   */\n  scrollTo: function(left, top, animate, zoom, wasResize) {\n    var self = this;\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n    }\n\n    // Correct coordinates based on new zoom level\n    if (zoom != null && zoom !== self.__zoomLevel) {\n\n      if (!self.options.zooming) {\n        throw new Error(\"Zooming is not enabled!\");\n      }\n\n      left *= zoom;\n      top *= zoom;\n\n      // Recompute maximum values while temporary tweaking maximum scroll ranges\n      self.__computeScrollMax(zoom);\n\n    } else {\n\n      // Keep zoom when not defined\n      zoom = self.__zoomLevel;\n\n    }\n\n    if (!self.options.scrollingX) {\n\n      left = self.__scrollLeft;\n\n    } else {\n\n      if (self.options.paging) {\n        left = Math.round(left / self.__clientWidth) * self.__clientWidth;\n      } else if (self.options.snapping) {\n        left = Math.round(left / self.__snapWidth) * self.__snapWidth;\n      }\n\n    }\n\n    if (!self.options.scrollingY) {\n\n      top = self.__scrollTop;\n\n    } else {\n\n      if (self.options.paging) {\n        top = Math.round(top / self.__clientHeight) * self.__clientHeight;\n      } else if (self.options.snapping) {\n        top = Math.round(top / self.__snapHeight) * self.__snapHeight;\n      }\n\n    }\n\n    // Limit for allowed ranges\n    left = Math.max(Math.min(self.__maxScrollLeft, left), 0);\n    top = Math.max(Math.min(self.__maxScrollTop, top), 0);\n\n    // Don't animate when no change detected, still call publish to make sure\n    // that rendered position is really in-sync with internal data\n    if (left === self.__scrollLeft && top === self.__scrollTop) {\n      animate = false;\n    }\n\n    // Publish new values\n    self.__publish(left, top, zoom, animate, wasResize);\n\n  },\n\n\n  /**\n   * Scroll by the given offset\n   *\n   * @param left {Number} Scroll x-axis by given offset\n   * @param top {Number} Scroll y-axis by given offset\n   * @param animate {Boolean} Whether to animate the given change\n   */\n  scrollBy: function(left, top, animate) {\n\n    var self = this;\n\n    var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft;\n    var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop;\n\n    self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate);\n\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    EVENT CALLBACKS\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Mouse wheel handler for zooming support\n   */\n  doMouseZoom: function(wheelDelta, timeStamp, pageX, pageY) {\n\n    var self = this;\n    var change = wheelDelta > 0 ? 0.97 : 1.03;\n\n    return self.zoomTo(self.__zoomLevel * change, false, pageX - self.__clientLeft, pageY - self.__clientTop);\n\n  },\n\n  /**\n   * Touch start handler for scrolling support\n   */\n  doTouchStart: function(touches, timeStamp) {\n    this.hintResize();\n\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Reset interruptedAnimation flag\n    self.__interruptedAnimation = true;\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n      self.__interruptedAnimation = true;\n    }\n\n    // Stop animation\n    if (self.__isAnimating) {\n      zyngaCore.effect.Animate.stop(self.__isAnimating);\n      self.__isAnimating = false;\n      self.__interruptedAnimation = true;\n    }\n\n    // Use center point when dealing with two fingers\n    var currentTouchLeft, currentTouchTop;\n    var isSingleTouch = touches.length === 1;\n    if (isSingleTouch) {\n      currentTouchLeft = touches[0].pageX;\n      currentTouchTop = touches[0].pageY;\n    } else {\n      currentTouchLeft = Math.abs(touches[0].pageX + touches[1].pageX) / 2;\n      currentTouchTop = Math.abs(touches[0].pageY + touches[1].pageY) / 2;\n    }\n\n    // Store initial positions\n    self.__initialTouchLeft = currentTouchLeft;\n    self.__initialTouchTop = currentTouchTop;\n\n    // Store initial touchList for scale calculation\n    self.__initialTouches = touches;\n\n    // Store current zoom level\n    self.__zoomLevelStart = self.__zoomLevel;\n\n    // Store initial touch positions\n    self.__lastTouchLeft = currentTouchLeft;\n    self.__lastTouchTop = currentTouchTop;\n\n    // Store initial move time stamp\n    self.__lastTouchMove = timeStamp;\n\n    // Reset initial scale\n    self.__lastScale = 1;\n\n    // Reset locking flags\n    self.__enableScrollX = !isSingleTouch && self.options.scrollingX;\n    self.__enableScrollY = !isSingleTouch && self.options.scrollingY;\n\n    // Reset tracking flag\n    self.__isTracking = true;\n\n    // Reset deceleration complete flag\n    self.__didDecelerationComplete = false;\n\n    // Dragging starts directly with two fingers, otherwise lazy with an offset\n    self.__isDragging = !isSingleTouch;\n\n    // Some features are disabled in multi touch scenarios\n    self.__isSingleTouch = isSingleTouch;\n\n    // Clearing data structure\n    self.__positions = [];\n\n  },\n\n\n  /**\n   * Touch move handler for scrolling support\n   */\n  doTouchMove: function(touches, timeStamp, scale) {\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Ignore event when tracking is not enabled (event might be outside of element)\n    if (!self.__isTracking) {\n      return;\n    }\n\n    var currentTouchLeft, currentTouchTop;\n\n    // Compute move based around of center of fingers\n    if (touches.length === 2) {\n      currentTouchLeft = Math.abs(touches[0].pageX + touches[1].pageX) / 2;\n      currentTouchTop = Math.abs(touches[0].pageY + touches[1].pageY) / 2;\n\n      // Calculate scale when not present and only when touches are used\n      if (!scale && self.options.zooming) {\n        scale = self.__getScale(self.__initialTouches, touches);\n      }\n    } else {\n      currentTouchLeft = touches[0].pageX;\n      currentTouchTop = touches[0].pageY;\n    }\n\n    var positions = self.__positions;\n\n    // Are we already is dragging mode?\n    if (self.__isDragging) {\n\n      // Compute move distance\n      var moveX = currentTouchLeft - self.__lastTouchLeft;\n      var moveY = currentTouchTop - self.__lastTouchTop;\n\n      // Read previous scroll position and zooming\n      var scrollLeft = self.__scrollLeft;\n      var scrollTop = self.__scrollTop;\n      var level = self.__zoomLevel;\n\n      // Work with scaling\n      if (scale != null && self.options.zooming) {\n\n        var oldLevel = level;\n\n        // Recompute level based on previous scale and new scale\n        level = level / self.__lastScale * scale;\n\n        // Limit level according to configuration\n        level = Math.max(Math.min(level, self.options.maxZoom), self.options.minZoom);\n\n        // Only do further compution when change happened\n        if (oldLevel !== level) {\n\n          // Compute relative event position to container\n          var currentTouchLeftRel = currentTouchLeft - self.__clientLeft;\n          var currentTouchTopRel = currentTouchTop - self.__clientTop;\n\n          // Recompute left and top coordinates based on new zoom level\n          scrollLeft = ((currentTouchLeftRel + scrollLeft) * level / oldLevel) - currentTouchLeftRel;\n          scrollTop = ((currentTouchTopRel + scrollTop) * level / oldLevel) - currentTouchTopRel;\n\n          // Recompute max scroll values\n          self.__computeScrollMax(level);\n\n        }\n      }\n\n      if (self.__enableScrollX) {\n\n        scrollLeft -= moveX * this.options.speedMultiplier;\n        var maxScrollLeft = self.__maxScrollLeft;\n\n        if (scrollLeft > maxScrollLeft || scrollLeft < 0) {\n\n          // Slow down on the edges\n          if (self.options.bouncing) {\n\n            scrollLeft += (moveX / 2  * this.options.speedMultiplier);\n\n          } else if (scrollLeft > maxScrollLeft) {\n\n            scrollLeft = maxScrollLeft;\n\n          } else {\n\n            scrollLeft = 0;\n\n          }\n        }\n      }\n\n      // Compute new vertical scroll position\n      if (self.__enableScrollY) {\n\n        scrollTop -= moveY * this.options.speedMultiplier;\n        var maxScrollTop = self.__maxScrollTop;\n\n        if (scrollTop > maxScrollTop || scrollTop < 0) {\n\n          // Slow down on the edges\n          if (self.options.bouncing || (self.__refreshHeight && scrollTop < 0)) {\n\n            scrollTop += (moveY / 2 * this.options.speedMultiplier);\n\n            // Support pull-to-refresh (only when only y is scrollable)\n            if (!self.__enableScrollX && self.__refreshHeight != null) {\n\n              // hide the refresher when it's behind the header bar in case of header transparency\n              if(scrollTop < 0){\n                self.__refreshHidden = false;\n                self.__refreshShow();\n              }else{\n                self.__refreshHide();\n                self.__refreshHidden = true;\n              }\n\n              if (!self.__refreshActive && scrollTop <= -self.__refreshHeight) {\n\n                self.__refreshActive = true;\n                if (self.__refreshActivate) {\n                  self.__refreshActivate();\n                }\n\n              } else if (self.__refreshActive && scrollTop > -self.__refreshHeight) {\n\n                self.__refreshActive = false;\n                if (self.__refreshDeactivate) {\n                  self.__refreshDeactivate();\n                }\n\n              }\n            }\n\n          } else if (scrollTop > maxScrollTop) {\n\n            scrollTop = maxScrollTop;\n\n          } else {\n\n            scrollTop = 0;\n\n          }\n        }else if(self.__refreshHeight && !self.__refreshHidden){\n          // if a positive scroll value and the refresher is still not hidden, hide it\n          self.__refreshHide();\n          self.__refreshHidden = true;\n        }\n      }\n\n      // Keep list from growing infinitely (holding min 10, max 20 measure points)\n      if (positions.length > 60) {\n        positions.splice(0, 30);\n      }\n\n      // Track scroll movement for decleration\n      positions.push(scrollLeft, scrollTop, timeStamp);\n\n      // Sync scroll position\n      self.__publish(scrollLeft, scrollTop, level);\n\n    // Otherwise figure out whether we are switching into dragging mode now.\n    } else {\n\n      var minimumTrackingForScroll = self.options.locking ? 3 : 0;\n      var minimumTrackingForDrag = 5;\n\n      var distanceX = Math.abs(currentTouchLeft - self.__initialTouchLeft);\n      var distanceY = Math.abs(currentTouchTop - self.__initialTouchTop);\n\n      self.__enableScrollX = self.options.scrollingX && distanceX >= minimumTrackingForScroll;\n      self.__enableScrollY = self.options.scrollingY && distanceY >= minimumTrackingForScroll;\n\n      positions.push(self.__scrollLeft, self.__scrollTop, timeStamp);\n\n      self.__isDragging = (self.__enableScrollX || self.__enableScrollY) && (distanceX >= minimumTrackingForDrag || distanceY >= minimumTrackingForDrag);\n      if (self.__isDragging) {\n        self.__interruptedAnimation = false;\n        self.__fadeScrollbars('in');\n      }\n\n    }\n\n    // Update last touch positions and time stamp for next event\n    self.__lastTouchLeft = currentTouchLeft;\n    self.__lastTouchTop = currentTouchTop;\n    self.__lastTouchMove = timeStamp;\n    self.__lastScale = scale;\n\n  },\n\n\n  /**\n   * Touch end handler for scrolling support\n   */\n  doTouchEnd: function(timeStamp) {\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Ignore event when tracking is not enabled (no touchstart event on element)\n    // This is required as this listener ('touchmove') sits on the document and not on the element itself.\n    if (!self.__isTracking) {\n      return;\n    }\n\n    // Not touching anymore (when two finger hit the screen there are two touch end events)\n    self.__isTracking = false;\n\n    // Be sure to reset the dragging flag now. Here we also detect whether\n    // the finger has moved fast enough to switch into a deceleration animation.\n    if (self.__isDragging) {\n\n      // Reset dragging flag\n      self.__isDragging = false;\n\n      // Start deceleration\n      // Verify that the last move detected was in some relevant time frame\n      if (self.__isSingleTouch && self.options.animating && (timeStamp - self.__lastTouchMove) <= 100) {\n\n        // Then figure out what the scroll position was about 100ms ago\n        var positions = self.__positions;\n        var endPos = positions.length - 1;\n        var startPos = endPos;\n\n        // Move pointer to position measured 100ms ago\n        for (var i = endPos; i > 0 && positions[i] > (self.__lastTouchMove - 100); i -= 3) {\n          startPos = i;\n        }\n\n        // If start and stop position is identical in a 100ms timeframe,\n        // we cannot compute any useful deceleration.\n        if (startPos !== endPos) {\n\n          // Compute relative movement between these two points\n          var timeOffset = positions[endPos] - positions[startPos];\n          var movedLeft = self.__scrollLeft - positions[startPos - 2];\n          var movedTop = self.__scrollTop - positions[startPos - 1];\n\n          // Based on 50ms compute the movement to apply for each render step\n          self.__decelerationVelocityX = movedLeft / timeOffset * (1000 / 60);\n          self.__decelerationVelocityY = movedTop / timeOffset * (1000 / 60);\n\n          // How much velocity is required to start the deceleration\n          var minVelocityToStartDeceleration = self.options.paging || self.options.snapping ? 4 : 1;\n\n          // Verify that we have enough velocity to start deceleration\n          if (Math.abs(self.__decelerationVelocityX) > minVelocityToStartDeceleration || Math.abs(self.__decelerationVelocityY) > minVelocityToStartDeceleration) {\n\n            // Deactivate pull-to-refresh when decelerating\n            if (!self.__refreshActive) {\n              self.__startDeceleration(timeStamp);\n            }\n          }\n        } else {\n          self.__scrollingComplete();\n        }\n      } else if ((timeStamp - self.__lastTouchMove) > 100) {\n        self.__scrollingComplete();\n      }\n    }\n\n    // If this was a slower move it is per default non decelerated, but this\n    // still means that we want snap back to the bounds which is done here.\n    // This is placed outside the condition above to improve edge case stability\n    // e.g. touchend fired without enabled dragging. This should normally do not\n    // have modified the scroll positions or even showed the scrollbars though.\n    if (!self.__isDecelerating) {\n\n      if (self.__refreshActive && self.__refreshStart) {\n\n        // Use publish instead of scrollTo to allow scrolling to out of boundary position\n        // We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled\n        self.__publish(self.__scrollLeft, -self.__refreshHeight, self.__zoomLevel, true);\n\n        if (self.__refreshStart) {\n          self.__refreshStart();\n        }\n\n      } else {\n\n        if (self.__interruptedAnimation || self.__isDragging) {\n          self.__scrollingComplete();\n        }\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, true, self.__zoomLevel);\n\n        // Directly signalize deactivation (nothing todo on refresh?)\n        if (self.__refreshActive) {\n\n          self.__refreshActive = false;\n          if (self.__refreshDeactivate) {\n            self.__refreshDeactivate();\n          }\n\n        }\n      }\n    }\n\n    // Fully cleanup list\n    self.__positions.length = 0;\n\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    PRIVATE API\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Applies the scroll position to the content element\n   *\n   * @param left {Number} Left scroll position\n   * @param top {Number} Top scroll position\n   * @param animate {Boolean} Whether animation should be used to move to the new coordinates\n   */\n  __publish: function(left, top, zoom, animate, wasResize) {\n\n    var self = this;\n\n    // Remember whether we had an animation, then we try to continue based on the current \"drive\" of the animation\n    var wasAnimating = self.__isAnimating;\n    if (wasAnimating) {\n      zyngaCore.effect.Animate.stop(wasAnimating);\n      self.__isAnimating = false;\n    }\n\n    if (animate && self.options.animating) {\n\n      // Keep scheduled positions for scrollBy/zoomBy functionality\n      self.__scheduledLeft = left;\n      self.__scheduledTop = top;\n      self.__scheduledZoom = zoom;\n\n      var oldLeft = self.__scrollLeft;\n      var oldTop = self.__scrollTop;\n      var oldZoom = self.__zoomLevel;\n\n      var diffLeft = left - oldLeft;\n      var diffTop = top - oldTop;\n      var diffZoom = zoom - oldZoom;\n\n      var step = function(percent, now, render) {\n\n        if (render) {\n\n          self.__scrollLeft = oldLeft + (diffLeft * percent);\n          self.__scrollTop = oldTop + (diffTop * percent);\n          self.__zoomLevel = oldZoom + (diffZoom * percent);\n\n          // Push values out\n          if (self.__callback) {\n            self.__callback(self.__scrollLeft, self.__scrollTop, self.__zoomLevel, wasResize);\n          }\n\n        }\n      };\n\n      var verify = function(id) {\n        return self.__isAnimating === id;\n      };\n\n      var completed = function(renderedFramesPerSecond, animationId, wasFinished) {\n        if (animationId === self.__isAnimating) {\n          self.__isAnimating = false;\n        }\n        if (self.__didDecelerationComplete || wasFinished) {\n          self.__scrollingComplete();\n        }\n\n        if (self.options.zooming) {\n          self.__computeScrollMax();\n        }\n      };\n\n      // When continuing based on previous animation we choose an ease-out animation instead of ease-in-out\n      self.__isAnimating = zyngaCore.effect.Animate.start(step, verify, completed, self.options.animationDuration, wasAnimating ? easeOutCubic : easeInOutCubic);\n\n    } else {\n\n      self.__scheduledLeft = self.__scrollLeft = left;\n      self.__scheduledTop = self.__scrollTop = top;\n      self.__scheduledZoom = self.__zoomLevel = zoom;\n\n      // Push values out\n      if (self.__callback) {\n        self.__callback(left, top, zoom, wasResize);\n      }\n\n      // Fix max scroll ranges\n      if (self.options.zooming) {\n        self.__computeScrollMax();\n      }\n    }\n  },\n\n\n  /**\n   * Recomputes scroll minimum values based on client dimensions and content dimensions.\n   */\n  __computeScrollMax: function(zoomLevel) {\n\n    var self = this;\n\n    if (zoomLevel == null) {\n      zoomLevel = self.__zoomLevel;\n    }\n\n    self.__maxScrollLeft = Math.max((self.__contentWidth * zoomLevel) - self.__clientWidth, 0);\n    self.__maxScrollTop = Math.max((self.__contentHeight * zoomLevel) - self.__clientHeight, 0);\n\n    if(!self.__didWaitForSize && !self.__maxScrollLeft && !self.__maxScrollTop) {\n      self.__didWaitForSize = true;\n      self.__waitForSize();\n    }\n  },\n\n\n  /**\n   * If the scroll view isn't sized correctly on start, wait until we have at least some size\n   */\n  __waitForSize: function() {\n\n    var self = this;\n\n    clearTimeout(self.__sizerTimeout);\n\n    var sizer = function() {\n      self.resize();\n\n      if((self.options.scrollingX && !self.__maxScrollLeft) || (self.options.scrollingY && !self.__maxScrollTop)) {\n        //self.__sizerTimeout = setTimeout(sizer, 1000);\n      }\n    };\n\n    sizer();\n    self.__sizerTimeout = setTimeout(sizer, 1000);\n  },\n\n  /*\n  ---------------------------------------------------------------------------\n    ANIMATION (DECELERATION) SUPPORT\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Called when a touch sequence end and the speed of the finger was high enough\n   * to switch into deceleration mode.\n   */\n  __startDeceleration: function(timeStamp) {\n\n    var self = this;\n\n    if (self.options.paging) {\n\n      var scrollLeft = Math.max(Math.min(self.__scrollLeft, self.__maxScrollLeft), 0);\n      var scrollTop = Math.max(Math.min(self.__scrollTop, self.__maxScrollTop), 0);\n      var clientWidth = self.__clientWidth;\n      var clientHeight = self.__clientHeight;\n\n      // We limit deceleration not to the min/max values of the allowed range, but to the size of the visible client area.\n      // Each page should have exactly the size of the client area.\n      self.__minDecelerationScrollLeft = Math.floor(scrollLeft / clientWidth) * clientWidth;\n      self.__minDecelerationScrollTop = Math.floor(scrollTop / clientHeight) * clientHeight;\n      self.__maxDecelerationScrollLeft = Math.ceil(scrollLeft / clientWidth) * clientWidth;\n      self.__maxDecelerationScrollTop = Math.ceil(scrollTop / clientHeight) * clientHeight;\n\n    } else {\n\n      self.__minDecelerationScrollLeft = 0;\n      self.__minDecelerationScrollTop = 0;\n      self.__maxDecelerationScrollLeft = self.__maxScrollLeft;\n      self.__maxDecelerationScrollTop = self.__maxScrollTop;\n\n    }\n\n    // Wrap class method\n    var step = function(percent, now, render) {\n      self.__stepThroughDeceleration(render);\n    };\n\n    // How much velocity is required to keep the deceleration running\n    self.__minVelocityToKeepDecelerating = self.options.snapping ? 4 : 0.1;\n\n    // Detect whether it's still worth to continue animating steps\n    // If we are already slow enough to not being user perceivable anymore, we stop the whole process here.\n    var verify = function() {\n      var shouldContinue = Math.abs(self.__decelerationVelocityX) >= self.__minVelocityToKeepDecelerating ||\n        Math.abs(self.__decelerationVelocityY) >= self.__minVelocityToKeepDecelerating;\n      if (!shouldContinue) {\n        self.__didDecelerationComplete = true;\n\n        //Make sure the scroll values are within the boundaries after a bounce,\n        //not below 0 or above maximum\n        if (self.options.bouncing) {\n          self.scrollTo(\n            Math.min( Math.max(self.__scrollLeft, 0), self.__maxScrollLeft ),\n            Math.min( Math.max(self.__scrollTop, 0), self.__maxScrollTop ),\n            false\n          );\n        }\n      }\n      return shouldContinue;\n    };\n\n    var completed = function(renderedFramesPerSecond, animationId, wasFinished) {\n      self.__isDecelerating = false;\n      if (self.__didDecelerationComplete) {\n        self.__scrollingComplete();\n      }\n\n      // Animate to grid when snapping is active, otherwise just fix out-of-boundary positions\n      if(self.options.paging) {\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, self.options.snapping);\n      }\n    };\n\n    // Start animation and switch on flag\n    self.__isDecelerating = zyngaCore.effect.Animate.start(step, verify, completed);\n\n  },\n\n\n  /**\n   * Called on every step of the animation\n   *\n   * @param inMemory {Boolean} Whether to not render the current step, but keep it in memory only. Used internally only!\n   */\n  __stepThroughDeceleration: function(render) {\n\n    var self = this;\n\n\n    //\n    // COMPUTE NEXT SCROLL POSITION\n    //\n\n    // Add deceleration to scroll position\n    var scrollLeft = self.__scrollLeft + self.__decelerationVelocityX;// * self.options.deceleration);\n    var scrollTop = self.__scrollTop + self.__decelerationVelocityY;// * self.options.deceleration);\n\n\n    //\n    // HARD LIMIT SCROLL POSITION FOR NON BOUNCING MODE\n    //\n\n    if (!self.options.bouncing) {\n\n      var scrollLeftFixed = Math.max(Math.min(self.__maxDecelerationScrollLeft, scrollLeft), self.__minDecelerationScrollLeft);\n      if (scrollLeftFixed !== scrollLeft) {\n        scrollLeft = scrollLeftFixed;\n        self.__decelerationVelocityX = 0;\n      }\n\n      var scrollTopFixed = Math.max(Math.min(self.__maxDecelerationScrollTop, scrollTop), self.__minDecelerationScrollTop);\n      if (scrollTopFixed !== scrollTop) {\n        scrollTop = scrollTopFixed;\n        self.__decelerationVelocityY = 0;\n      }\n\n    }\n\n\n    //\n    // UPDATE SCROLL POSITION\n    //\n\n    if (render) {\n\n      self.__publish(scrollLeft, scrollTop, self.__zoomLevel);\n\n    } else {\n\n      self.__scrollLeft = scrollLeft;\n      self.__scrollTop = scrollTop;\n\n    }\n\n\n    //\n    // SLOW DOWN\n    //\n\n    // Slow down velocity on every iteration\n    if (!self.options.paging) {\n\n      // This is the factor applied to every iteration of the animation\n      // to slow down the process. This should emulate natural behavior where\n      // objects slow down when the initiator of the movement is removed\n      var frictionFactor = self.options.deceleration;\n\n      self.__decelerationVelocityX *= frictionFactor;\n      self.__decelerationVelocityY *= frictionFactor;\n\n    }\n\n\n    //\n    // BOUNCING SUPPORT\n    //\n\n    if (self.options.bouncing) {\n\n      var scrollOutsideX = 0;\n      var scrollOutsideY = 0;\n\n      // This configures the amount of change applied to deceleration/acceleration when reaching boundaries\n      var penetrationDeceleration = self.options.penetrationDeceleration;\n      var penetrationAcceleration = self.options.penetrationAcceleration;\n\n      // Check limits\n      if (scrollLeft < self.__minDecelerationScrollLeft) {\n        scrollOutsideX = self.__minDecelerationScrollLeft - scrollLeft;\n      } else if (scrollLeft > self.__maxDecelerationScrollLeft) {\n        scrollOutsideX = self.__maxDecelerationScrollLeft - scrollLeft;\n      }\n\n      if (scrollTop < self.__minDecelerationScrollTop) {\n        scrollOutsideY = self.__minDecelerationScrollTop - scrollTop;\n      } else if (scrollTop > self.__maxDecelerationScrollTop) {\n        scrollOutsideY = self.__maxDecelerationScrollTop - scrollTop;\n      }\n\n      // Slow down until slow enough, then flip back to snap position\n      if (scrollOutsideX !== 0) {\n        var isHeadingOutwardsX = scrollOutsideX * self.__decelerationVelocityX <= self.__minDecelerationScrollLeft;\n        if (isHeadingOutwardsX) {\n          self.__decelerationVelocityX += scrollOutsideX * penetrationDeceleration;\n        }\n        var isStoppedX = Math.abs(self.__decelerationVelocityX) <= self.__minVelocityToKeepDecelerating;\n        //If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds\n        if (!isHeadingOutwardsX || isStoppedX) {\n          self.__decelerationVelocityX = scrollOutsideX * penetrationAcceleration;\n        }\n      }\n\n      if (scrollOutsideY !== 0) {\n        var isHeadingOutwardsY = scrollOutsideY * self.__decelerationVelocityY <= self.__minDecelerationScrollTop;\n        if (isHeadingOutwardsY) {\n          self.__decelerationVelocityY += scrollOutsideY * penetrationDeceleration;\n        }\n        var isStoppedY = Math.abs(self.__decelerationVelocityY) <= self.__minVelocityToKeepDecelerating;\n        //If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds\n        if (!isHeadingOutwardsY || isStoppedY) {\n          self.__decelerationVelocityY = scrollOutsideY * penetrationAcceleration;\n        }\n      }\n    }\n  },\n\n\n  /**\n   * calculate the distance between two touches\n   * @param   {Touch}     touch1\n   * @param   {Touch}     touch2\n   * @returns {Number}    distance\n   */\n  __getDistance: function getDistance(touch1, touch2) {\n    var x = touch2.pageX - touch1.pageX,\n    y = touch2.pageY - touch1.pageY;\n    return Math.sqrt((x*x) + (y*y));\n  },\n\n\n  /**\n   * calculate the scale factor between two touchLists (fingers)\n   * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n   * @param   {Array}     start\n   * @param   {Array}     end\n   * @returns {Number}    scale\n   */\n  __getScale: function getScale(start, end) {\n\n    var self = this;\n\n    // need two fingers...\n    if(start.length >= 2 && end.length >= 2) {\n      return self.__getDistance(end[0], end[1]) /\n        self.__getDistance(start[0], start[1]);\n    }\n    return 1;\n  }\n});\n\nionic.scroll = {\n  isScrolling: false,\n  lastTop: 0\n};\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.HeaderBar = ionic.views.View.inherit({\n    initialize: function(opts) {\n      this.el = opts.el;\n\n      ionic.extend(this, {\n        alignTitle: 'center'\n      }, opts);\n\n      this.align();\n    },\n\n    align: function(align) {\n\n      align || (align = this.alignTitle);\n\n      // Find the titleEl element\n      var titleEl = this.el.querySelector('.title');\n      if(!titleEl) {\n        return;\n      }\n\n      var self = this;\n      //We have to rAF here so all of the elements have time to initialize\n      ionic.requestAnimationFrame(function() {\n        var i, c, childSize;\n        var childNodes = self.el.childNodes;\n        var leftWidth = 0;\n        var rightWidth = 0;\n        var isCountingRightWidth = false;\n\n        // Compute how wide the left children are\n        // Skip all titles (there may still be two titles, one leaving the dom)\n        // Once we encounter a titleEl, realize we are now counting the right-buttons, not left\n        for(i = 0; i < childNodes.length; i++) {\n          c = childNodes[i];\n          if (c.tagName && c.tagName.toLowerCase() == 'h1') {\n            isCountingRightWidth = true;\n            continue;\n          }\n\n          childSize = null;\n          if(c.nodeType == 3) {\n            var bounds = ionic.DomUtil.getTextBounds(c);\n            if(bounds) {\n              childSize = bounds.width;\n            }\n          } else if(c.nodeType == 1) {\n            childSize = c.offsetWidth;\n          }\n          if(childSize) {\n            if (isCountingRightWidth) {\n              rightWidth += childSize;\n            } else {\n              leftWidth += childSize;\n            }\n          }\n        }\n\n        var margin = Math.max(leftWidth, rightWidth) + 10;\n\n        //Reset left and right before setting again\n        titleEl.style.left = titleEl.style.right = '';\n\n        // Size and align the header titleEl based on the sizes of the left and\n        // right children, and the desired alignment mode\n        if(align == 'center') {\n          if(margin > 10) {\n            titleEl.style.left = margin + 'px';\n            titleEl.style.right = margin + 'px';\n          }\n          if(titleEl.offsetWidth < titleEl.scrollWidth) {\n            if(rightWidth > 0) {\n              titleEl.style.right = (rightWidth + 5) + 'px';\n            }\n          }\n        } else if(align == 'left') {\n          titleEl.classList.add('title-left');\n          if(leftWidth > 0) {\n            titleEl.style.left = (leftWidth + 15) + 'px';\n          }\n        } else if(align == 'right') {\n          titleEl.classList.add('title-right');\n          if(rightWidth > 0) {\n            titleEl.style.right = (rightWidth + 15) + 'px';\n          }\n        }\n      });\n    }\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  var ITEM_CLASS = 'item';\n  var ITEM_CONTENT_CLASS = 'item-content';\n  var ITEM_SLIDING_CLASS = 'item-sliding';\n  var ITEM_OPTIONS_CLASS = 'item-options';\n  var ITEM_PLACEHOLDER_CLASS = 'item-placeholder';\n  var ITEM_REORDERING_CLASS = 'item-reordering';\n  var ITEM_REORDER_BTN_CLASS = 'item-reorder';\n\n  var DragOp = function() {};\n  DragOp.prototype = {\n    start: function(e) {\n    },\n    drag: function(e) {\n    },\n    end: function(e) {\n    },\n    isSameItem: function(item) {\n      return false;\n    }\n  };\n\n  var SlideDrag = function(opts) {\n    this.dragThresholdX = opts.dragThresholdX || 10;\n    this.el = opts.el;\n    this.canSwipe = opts.canSwipe;\n  };\n\n  SlideDrag.prototype = new DragOp();\n\n  SlideDrag.prototype.start = function(e) {\n    var content, buttons, offsetX, buttonsWidth;\n\n    if (!this.canSwipe()) {\n      return;\n    }\n\n    if(e.target.classList.contains(ITEM_CONTENT_CLASS)) {\n      content = e.target;\n    } else if(e.target.classList.contains(ITEM_CLASS)) {\n      content = e.target.querySelector('.' + ITEM_CONTENT_CLASS);\n    } else {\n      content = ionic.DomUtil.getParentWithClass(e.target, ITEM_CONTENT_CLASS);\n    }\n\n    // If we don't have a content area as one of our children (or ourselves), skip\n    if(!content) {\n      return;\n    }\n\n    // Make sure we aren't animating as we slide\n    content.classList.remove(ITEM_SLIDING_CLASS);\n\n    // Grab the starting X point for the item (for example, so we can tell whether it is open or closed to start)\n    offsetX = parseFloat(content.style[ionic.CSS.TRANSFORM].replace('translate3d(', '').split(',')[0]) || 0;\n\n    // Grab the buttons\n    buttons = content.parentNode.querySelector('.' + ITEM_OPTIONS_CLASS);\n    if(!buttons) {\n      return;\n    }\n    buttons.classList.remove('invisible');\n\n    buttonsWidth = buttons.offsetWidth;\n\n    this._currentDrag = {\n      buttons: buttons,\n      buttonsWidth: buttonsWidth,\n      content: content,\n      startOffsetX: offsetX\n    };\n  };\n\n  /**\n   * Check if this is the same item that was previously dragged.\n   */\n  SlideDrag.prototype.isSameItem = function(op) {\n    if(op._lastDrag && this._currentDrag) {\n      return this._currentDrag.content == op._lastDrag.content;\n    }\n    return false;\n  };\n\n  SlideDrag.prototype.clean = function(e) {\n    var lastDrag = this._lastDrag;\n\n    if(!lastDrag) return;\n\n    lastDrag.content.style[ionic.CSS.TRANSITION] = '';\n    lastDrag.content.style[ionic.CSS.TRANSFORM] = '';\n    ionic.requestAnimationFrame(function() {\n      setTimeout(function() {\n        lastDrag.buttons && lastDrag.buttons.classList.add('invisible');\n      }, 250);\n    });\n  };\n\n  SlideDrag.prototype.drag = ionic.animationFrameThrottle(function(e) {\n    var buttonsWidth;\n\n    // We really aren't dragging\n    if(!this._currentDrag) {\n      return;\n    }\n\n    // Check if we should start dragging. Check if we've dragged past the threshold,\n    // or we are starting from the open state.\n    if(!this._isDragging &&\n        ((Math.abs(e.gesture.deltaX) > this.dragThresholdX) ||\n        (Math.abs(this._currentDrag.startOffsetX) > 0)))\n    {\n      this._isDragging = true;\n    }\n\n    if(this._isDragging) {\n      buttonsWidth = this._currentDrag.buttonsWidth;\n\n      // Grab the new X point, capping it at zero\n      var newX = Math.min(0, this._currentDrag.startOffsetX + e.gesture.deltaX);\n\n      // If the new X position is past the buttons, we need to slow down the drag (rubber band style)\n      if(newX < -buttonsWidth) {\n        // Calculate the new X position, capped at the top of the buttons\n        newX = Math.min(-buttonsWidth, -buttonsWidth + (((e.gesture.deltaX + buttonsWidth) * 0.4)));\n      }\n\n      this._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + newX + 'px, 0, 0)';\n      this._currentDrag.content.style[ionic.CSS.TRANSITION] = 'none';\n    }\n  });\n\n  SlideDrag.prototype.end = function(e, doneCallback) {\n    var _this = this;\n\n    // There is no drag, just end immediately\n    if(!this._currentDrag) {\n      doneCallback && doneCallback();\n      return;\n    }\n\n    // If we are currently dragging, we want to snap back into place\n    // The final resting point X will be the width of the exposed buttons\n    var restingPoint = -this._currentDrag.buttonsWidth;\n\n    // Check if the drag didn't clear the buttons mid-point\n    // and we aren't moving fast enough to swipe open\n    if(e.gesture.deltaX > -(this._currentDrag.buttonsWidth/2)) {\n\n      // If we are going left but too slow, or going right, go back to resting\n      if(e.gesture.direction == \"left\" && Math.abs(e.gesture.velocityX) < 0.3) {\n        restingPoint = 0;\n      } else if(e.gesture.direction == \"right\") {\n        restingPoint = 0;\n      }\n\n    }\n\n    ionic.requestAnimationFrame(function() {\n      if(restingPoint === 0) {\n        _this._currentDrag.content.style[ionic.CSS.TRANSFORM] = '';\n        var buttons = _this._currentDrag.buttons;\n        setTimeout(function() {\n          buttons && buttons.classList.add('invisible');\n        }, 250);\n      } else {\n        _this._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + restingPoint + 'px, 0, 0)';\n      }\n      _this._currentDrag.content.style[ionic.CSS.TRANSITION] = '';\n\n\n      // Kill the current drag\n      _this._lastDrag = _this._currentDrag;\n      _this._currentDrag = null;\n\n      // We are done, notify caller\n      doneCallback && doneCallback();\n    });\n  };\n\n  var ReorderDrag = function(opts) {\n    this.dragThresholdY = opts.dragThresholdY || 0;\n    this.onReorder = opts.onReorder;\n    this.listEl = opts.listEl;\n    this.el = opts.el;\n    this.scrollEl = opts.scrollEl;\n    this.scrollView = opts.scrollView;\n    // Get the True Top of the list el http://www.quirksmode.org/js/findpos.html\n    this.listElTrueTop = 0;\n    if (this.listEl.offsetParent) {\n      var obj = this.listEl;\n      do {\n        this.listElTrueTop += obj.offsetTop;\n        obj = obj.offsetParent;\n      } while (obj);\n    }\n  };\n\n  ReorderDrag.prototype = new DragOp();\n\n  ReorderDrag.prototype._moveElement = function(e) {\n    var y = e.gesture.center.pageY +\n      this.scrollView.getValues().top -\n      (this._currentDrag.elementHeight / 2) -\n      this.listElTrueTop;\n    this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(0, '+y+'px, 0)';\n  };\n\n  ReorderDrag.prototype.start = function(e) {\n    var content;\n\n    var startIndex = ionic.DomUtil.getChildIndex(this.el, this.el.nodeName.toLowerCase());\n    var elementHeight = this.el.scrollHeight;\n    var placeholder = this.el.cloneNode(true);\n\n    placeholder.classList.add(ITEM_PLACEHOLDER_CLASS);\n\n    this.el.parentNode.insertBefore(placeholder, this.el);\n    this.el.classList.add(ITEM_REORDERING_CLASS);\n\n    this._currentDrag = {\n      elementHeight: elementHeight,\n      startIndex: startIndex,\n      placeholder: placeholder,\n      scrollHeight: scroll,\n      list: placeholder.parentNode\n    };\n\n    this._moveElement(e);\n  };\n\n  ReorderDrag.prototype.drag = ionic.animationFrameThrottle(function(e) {\n    // We really aren't dragging\n    var self = this;\n    if(!this._currentDrag) {\n      return;\n    }\n\n    var scrollY = 0;\n    var pageY = e.gesture.center.pageY;\n    var offset = this.listElTrueTop;\n\n    //If we have a scrollView, check scroll boundaries for dragged element and scroll if necessary\n    if (this.scrollView) {\n\n      var container = this.scrollView.__container;\n      scrollY = this.scrollView.getValues().top;\n\n      var containerTop = container.offsetTop;\n      var pixelsPastTop = containerTop - pageY + this._currentDrag.elementHeight/2;\n      var pixelsPastBottom = pageY + this._currentDrag.elementHeight/2 - containerTop - container.offsetHeight;\n\n      if (e.gesture.deltaY < 0 && pixelsPastTop > 0 && scrollY > 0) {\n        this.scrollView.scrollBy(null, -pixelsPastTop);\n        //Trigger another drag so the scrolling keeps going\n        ionic.requestAnimationFrame(function() {\n          self.drag(e);\n        });\n      }\n      if (e.gesture.deltaY > 0 && pixelsPastBottom > 0) {\n        if (scrollY < this.scrollView.getScrollMax().top) {\n          this.scrollView.scrollBy(null, pixelsPastBottom);\n          //Trigger another drag so the scrolling keeps going\n          ionic.requestAnimationFrame(function() {\n            self.drag(e);\n          });\n        }\n      }\n    }\n\n    // Check if we should start dragging. Check if we've dragged past the threshold,\n    // or we are starting from the open state.\n    if(!this._isDragging && Math.abs(e.gesture.deltaY) > this.dragThresholdY) {\n      this._isDragging = true;\n    }\n\n    if(this._isDragging) {\n      this._moveElement(e);\n\n      this._currentDrag.currentY = scrollY + pageY - offset;\n\n      // this._reorderItems();\n    }\n  });\n\n  // When an item is dragged, we need to reorder any items for sorting purposes\n  ReorderDrag.prototype._getReorderIndex = function() {\n    var self = this;\n    var placeholder = this._currentDrag.placeholder;\n    var siblings = Array.prototype.slice.call(this._currentDrag.placeholder.parentNode.children)\n      .filter(function(el) {\n        return el.nodeName === self.el.nodeName && el !== self.el;\n      });\n\n    var dragOffsetTop = this._currentDrag.currentY;\n    var el;\n    for (var i = 0, len = siblings.length; i < len; i++) {\n      el = siblings[i];\n      if (i === len - 1) {\n        if (dragOffsetTop > el.offsetTop) {\n          return i;\n        }\n      } else if (i === 0) {\n        if (dragOffsetTop < el.offsetTop + el.offsetHeight) {\n          return i;\n        }\n      } else if (dragOffsetTop > el.offsetTop - el.offsetHeight / 2 &&\n                 dragOffsetTop < el.offsetTop + el.offsetHeight) {\n        return i;\n      }\n    }\n    return this._currentDrag.startIndex;\n  };\n\n  ReorderDrag.prototype.end = function(e, doneCallback) {\n    if(!this._currentDrag) {\n      doneCallback && doneCallback();\n      return;\n    }\n\n    var placeholder = this._currentDrag.placeholder;\n    var finalIndex = this._getReorderIndex();\n\n    // Reposition the element\n    this.el.classList.remove(ITEM_REORDERING_CLASS);\n    this.el.style[ionic.CSS.TRANSFORM] = '';\n\n    placeholder.parentNode.insertBefore(this.el, placeholder);\n    placeholder.parentNode.removeChild(placeholder);\n\n    this.onReorder && this.onReorder(this.el, this._currentDrag.startIndex, finalIndex);\n\n    this._currentDrag = null;\n    doneCallback && doneCallback();\n  };\n\n\n\n  /**\n   * The ListView handles a list of items. It will process drag animations, edit mode,\n   * and other operations that are common on mobile lists or table views.\n   */\n  ionic.views.ListView = ionic.views.View.inherit({\n    initialize: function(opts) {\n      var _this = this;\n\n      opts = ionic.extend({\n        onReorder: function(el, oldIndex, newIndex) {},\n        virtualRemoveThreshold: -200,\n        virtualAddThreshold: 200,\n        canSwipe: function() {\n          return true;\n        }\n      }, opts);\n\n      ionic.extend(this, opts);\n\n      if(!this.itemHeight && this.listEl) {\n        this.itemHeight = this.listEl.children[0] && parseInt(this.listEl.children[0].style.height, 10);\n      }\n\n      //ionic.views.ListView.__super__.initialize.call(this, opts);\n\n      this.onRefresh = opts.onRefresh || function() {};\n      this.onRefreshOpening = opts.onRefreshOpening || function() {};\n      this.onRefreshHolding = opts.onRefreshHolding || function() {};\n\n      window.ionic.onGesture('release', function(e) {\n        _this._handleEndDrag(e);\n      }, this.el);\n\n      window.ionic.onGesture('drag', function(e) {\n        _this._handleDrag(e);\n      }, this.el);\n      // Start the drag states\n      this._initDrag();\n    },\n    /**\n     * Called to tell the list to stop refreshing. This is useful\n     * if you are refreshing the list and are done with refreshing.\n     */\n    stopRefreshing: function() {\n      var refresher = this.el.querySelector('.list-refresher');\n      refresher.style.height = '0px';\n    },\n\n    /**\n     * If we scrolled and have virtual mode enabled, compute the window\n     * of active elements in order to figure out the viewport to render.\n     */\n    didScroll: function(e) {\n      if(this.isVirtual) {\n        var itemHeight = this.itemHeight;\n\n        // TODO: This would be inaccurate if we are windowed\n        var totalItems = this.listEl.children.length;\n\n        // Grab the total height of the list\n        var scrollHeight = e.target.scrollHeight;\n\n        // Get the viewport height\n        var viewportHeight = this.el.parentNode.offsetHeight;\n\n        // scrollTop is the current scroll position\n        var scrollTop = e.scrollTop;\n\n        // High water is the pixel position of the first element to include (everything before\n        // that will be removed)\n        var highWater = Math.max(0, e.scrollTop + this.virtualRemoveThreshold);\n\n        // Low water is the pixel position of the last element to include (everything after\n        // that will be removed)\n        var lowWater = Math.min(scrollHeight, Math.abs(e.scrollTop) + viewportHeight + this.virtualAddThreshold);\n\n        // Compute how many items per viewport size can show\n        var itemsPerViewport = Math.floor((lowWater - highWater) / itemHeight);\n\n        // Get the first and last elements in the list based on how many can fit\n        // between the pixel range of lowWater and highWater\n        var first = parseInt(Math.abs(highWater / itemHeight), 10);\n        var last = parseInt(Math.abs(lowWater / itemHeight), 10);\n\n        // Get the items we need to remove\n        this._virtualItemsToRemove = Array.prototype.slice.call(this.listEl.children, 0, first);\n\n        // Grab the nodes we will be showing\n        var nodes = Array.prototype.slice.call(this.listEl.children, first, first + itemsPerViewport);\n\n        this.renderViewport && this.renderViewport(highWater, lowWater, first, last);\n      }\n    },\n\n    didStopScrolling: function(e) {\n      if(this.isVirtual) {\n        for(var i = 0; i < this._virtualItemsToRemove.length; i++) {\n          var el = this._virtualItemsToRemove[i];\n          //el.parentNode.removeChild(el);\n          this.didHideItem && this.didHideItem(i);\n        }\n        // Once scrolling stops, check if we need to remove old items\n\n      }\n    },\n\n    /**\n     * Clear any active drag effects on the list.\n     */\n    clearDragEffects: function() {\n      if(this._lastDragOp) {\n        this._lastDragOp.clean && this._lastDragOp.clean();\n        this._lastDragOp = null;\n      }\n    },\n\n    _initDrag: function() {\n      //ionic.views.ListView.__super__._initDrag.call(this);\n\n      // Store the last one\n      this._lastDragOp = this._dragOp;\n\n      this._dragOp = null;\n    },\n\n    // Return the list item from the given target\n    _getItem: function(target) {\n      while(target) {\n        if(target.classList && target.classList.contains(ITEM_CLASS)) {\n          return target;\n        }\n        target = target.parentNode;\n      }\n      return null;\n    },\n\n\n    _startDrag: function(e) {\n      var _this = this;\n\n      var didStart = false;\n\n      this._isDragging = false;\n\n      var lastDragOp = this._lastDragOp;\n      var item;\n\n      // Check if this is a reorder drag\n      if(ionic.DomUtil.getParentOrSelfWithClass(e.target, ITEM_REORDER_BTN_CLASS) && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {\n        item = this._getItem(e.target);\n\n        if(item) {\n          this._dragOp = new ReorderDrag({\n            listEl: this.el,\n            el: item,\n            scrollEl: this.scrollEl,\n            scrollView: this.scrollView,\n            onReorder: function(el, start, end) {\n              _this.onReorder && _this.onReorder(el, start, end);\n            }\n          });\n          this._dragOp.start(e);\n          e.preventDefault();\n        }\n      }\n\n      // Or check if this is a swipe to the side drag\n      else if(!this._didDragUpOrDown && (e.gesture.direction == 'left' || e.gesture.direction == 'right') && Math.abs(e.gesture.deltaX) > 5) {\n\n        // Make sure this is an item with buttons\n        item = this._getItem(e.target);\n        if(item && item.querySelector('.item-options')) {\n          this._dragOp = new SlideDrag({ el: this.el, canSwipe: this.canSwipe });\n          this._dragOp.start(e);\n          e.preventDefault();\n        }\n      }\n\n      // If we had a last drag operation and this is a new one on a different item, clean that last one\n      if(lastDragOp && this._dragOp && !this._dragOp.isSameItem(lastDragOp) && e.defaultPrevented) {\n        lastDragOp.clean && lastDragOp.clean();\n      }\n    },\n\n\n    _handleEndDrag: function(e) {\n      var _this = this;\n\n      this._didDragUpOrDown = false;\n\n      if(!this._dragOp) {\n        //ionic.views.ListView.__super__._handleEndDrag.call(this, e);\n        return;\n      }\n\n      this._dragOp.end(e, function() {\n        _this._initDrag();\n      });\n    },\n\n    /**\n     * Process the drag event to move the item to the left or right.\n     */\n    _handleDrag: function(e) {\n      var _this = this, content, buttons;\n\n      if(Math.abs(e.gesture.deltaY) > 5) {\n        this._didDragUpOrDown = true;\n      }\n\n      // If we get a drag event, make sure we aren't in another drag, then check if we should\n      // start one\n      if(!this.isDragging && !this._dragOp) {\n        this._startDrag(e);\n      }\n\n      // No drag still, pass it up\n      if(!this._dragOp) {\n        //ionic.views.ListView.__super__._handleDrag.call(this, e);\n        return;\n      }\n\n      e.gesture.srcEvent.preventDefault();\n      this._dragOp.drag(e);\n    }\n\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.Modal = ionic.views.View.inherit({\n    initialize: function(opts) {\n      opts = ionic.extend({\n        focusFirstInput: false,\n        unfocusOnHide: true,\n        focusFirstDelay: 600,\n        backdropClickToClose: true,\n        hardwareBackButtonClose: true,\n      }, opts);\n\n      ionic.extend(this, opts);\n\n      this.el = opts.el;\n    },\n    show: function() {\n      var self = this;\n\n      if(self.focusFirstInput) {\n        // Let any animations run first\n        window.setTimeout(function() {\n          var input = self.el.querySelector('input, textarea');\n          input && input.focus && input.focus();\n        }, self.focusFirstDelay);\n      }\n    },\n    hide: function() {\n      // Unfocus all elements\n      if(this.unfocusOnHide) {\n        var inputs = this.el.querySelectorAll('input, textarea');\n        // Let any animations run first\n        window.setTimeout(function() {\n          for(var i = 0; i < inputs.length; i++) {\n            inputs[i].blur && inputs[i].blur();\n          }\n        });\n      }\n    }\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  /**\n   * The side menu view handles one of the side menu's in a Side Menu Controller\n   * configuration.\n   * It takes a DOM reference to that side menu element.\n   */\n  ionic.views.SideMenu = ionic.views.View.inherit({\n    initialize: function(opts) {\n      this.el = opts.el;\n      this.isEnabled = (typeof opts.isEnabled === 'undefined') ? true : opts.isEnabled;\n      this.setWidth(opts.width);\n    },\n    getFullWidth: function() {\n      return this.width;\n    },\n    setWidth: function(width) {\n      this.width = width;\n      this.el.style.width = width + 'px';\n    },\n    setIsEnabled: function(isEnabled) {\n      this.isEnabled = isEnabled;\n    },\n    bringUp: function() {\n      if(this.el.style.zIndex !== '0') {\n        this.el.style.zIndex = '0';\n      }\n    },\n    pushDown: function() {\n      if(this.el.style.zIndex !== '-1') {\n        this.el.style.zIndex = '-1';\n      }\n    }\n  });\n\n  ionic.views.SideMenuContent = ionic.views.View.inherit({\n    initialize: function(opts) {\n      ionic.extend(this, {\n        animationClass: 'menu-animated',\n        onDrag: function(e) {},\n        onEndDrag: function(e) {}\n      }, opts);\n\n      ionic.onGesture('drag', ionic.proxy(this._onDrag, this), this.el);\n      ionic.onGesture('release', ionic.proxy(this._onEndDrag, this), this.el);\n    },\n    _onDrag: function(e) {\n      this.onDrag && this.onDrag(e);\n    },\n    _onEndDrag: function(e) {\n      this.onEndDrag && this.onEndDrag(e);\n    },\n    disableAnimation: function() {\n      this.el.classList.remove(this.animationClass);\n    },\n    enableAnimation: function() {\n      this.el.classList.add(this.animationClass);\n    },\n    getTranslateX: function() {\n      return parseFloat(this.el.style[ionic.CSS.TRANSFORM].replace('translate3d(', '').split(',')[0]);\n    },\n    setTranslateX: ionic.animationFrameThrottle(function(x) {\n      this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(' + x + 'px, 0, 0)';\n    })\n  });\n\n})(ionic);\n\n/*\n * Adapted from Swipe.js 2.0\n *\n * Brad Birdsall\n * Copyright 2013, MIT License\n *\n*/\n\n(function(ionic) {\n'use strict';\n\nionic.views.Slider = ionic.views.View.inherit({\n  initialize: function (options) {\n    var slider = this;\n\n    // utilities\n    var noop = function() {}; // simple no operation function\n    var offloadFn = function(fn) { setTimeout(fn || noop, 0); }; // offload a functions execution\n\n    // check browser capabilities\n    var browser = {\n      addEventListener: !!window.addEventListener,\n      touch: ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,\n      transitions: (function(temp) {\n        var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition'];\n        for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true;\n        return false;\n      })(document.createElement('swipe'))\n    };\n\n\n    var container = options.el;\n\n    // quit if no root element\n    if (!container) return;\n    var element = container.children[0];\n    var slides, slidePos, width, length;\n    options = options || {};\n    var index = parseInt(options.startSlide, 10) || 0;\n    var speed = options.speed || 300;\n    options.continuous = options.continuous !== undefined ? options.continuous : true;\n\n    function setup() {\n\n      // cache slides\n      slides = element.children;\n      length = slides.length;\n\n      // set continuous to false if only one slide\n      if (slides.length < 2) options.continuous = false;\n\n      //special case if two slides\n      if (browser.transitions && options.continuous && slides.length < 3) {\n        element.appendChild(slides[0].cloneNode(true));\n        element.appendChild(element.children[1].cloneNode(true));\n        slides = element.children;\n      }\n\n      // create an array to store current positions of each slide\n      slidePos = new Array(slides.length);\n\n      // determine width of each slide\n      width = container.offsetWidth || container.getBoundingClientRect().width;\n\n      element.style.width = (slides.length * width) + 'px';\n\n      // stack elements\n      var pos = slides.length;\n      while(pos--) {\n\n        var slide = slides[pos];\n\n        slide.style.width = width + 'px';\n        slide.setAttribute('data-index', pos);\n\n        if (browser.transitions) {\n          slide.style.left = (pos * -width) + 'px';\n          move(pos, index > pos ? -width : (index < pos ? width : 0), 0);\n        }\n\n      }\n\n      // reposition elements before and after index\n      if (options.continuous && browser.transitions) {\n        move(circle(index-1), -width, 0);\n        move(circle(index+1), width, 0);\n      }\n\n      if (!browser.transitions) element.style.left = (index * -width) + 'px';\n\n      container.style.visibility = 'visible';\n\n      options.slidesChanged && options.slidesChanged();\n    }\n\n    function prev() {\n\n      if (options.continuous) slide(index-1);\n      else if (index) slide(index-1);\n\n    }\n\n    function next() {\n\n      if (options.continuous) slide(index+1);\n      else if (index < slides.length - 1) slide(index+1);\n\n    }\n\n    function circle(index) {\n\n      // a simple positive modulo using slides.length\n      return (slides.length + (index % slides.length)) % slides.length;\n\n    }\n\n    function slide(to, slideSpeed) {\n\n      // do nothing if already on requested slide\n      if (index == to) return;\n\n      if (browser.transitions) {\n\n        var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward\n\n        // get the actual position of the slide\n        if (options.continuous) {\n          var natural_direction = direction;\n          direction = -slidePos[circle(to)] / width;\n\n          // if going forward but to < index, use to = slides.length + to\n          // if going backward but to > index, use to = -slides.length + to\n          if (direction !== natural_direction) to =  -direction * slides.length + to;\n\n        }\n\n        var diff = Math.abs(index-to) - 1;\n\n        // move all the slides between index and to in the right direction\n        while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0);\n\n        to = circle(to);\n\n        move(index, width * direction, slideSpeed || speed);\n        move(to, 0, slideSpeed || speed);\n\n        if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place\n\n      } else {\n\n        to = circle(to);\n        animate(index * -width, to * -width, slideSpeed || speed);\n        //no fallback for a circular continuous if the browser does not accept transitions\n      }\n\n      index = to;\n      offloadFn(options.callback && options.callback(index, slides[index]));\n    }\n\n    function move(index, dist, speed) {\n\n      translate(index, dist, speed);\n      slidePos[index] = dist;\n\n    }\n\n    function translate(index, dist, speed) {\n\n      var slide = slides[index];\n      var style = slide && slide.style;\n\n      if (!style) return;\n\n      style.webkitTransitionDuration =\n      style.MozTransitionDuration =\n      style.msTransitionDuration =\n      style.OTransitionDuration =\n      style.transitionDuration = speed + 'ms';\n\n      style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)';\n      style.msTransform =\n      style.MozTransform =\n      style.OTransform = 'translateX(' + dist + 'px)';\n\n    }\n\n    function animate(from, to, speed) {\n\n      // if not an animation, just reposition\n      if (!speed) {\n\n        element.style.left = to + 'px';\n        return;\n\n      }\n\n      var start = +new Date();\n\n      var timer = setInterval(function() {\n\n        var timeElap = +new Date() - start;\n\n        if (timeElap > speed) {\n\n          element.style.left = to + 'px';\n\n          if (delay) begin();\n\n          options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);\n\n          clearInterval(timer);\n          return;\n\n        }\n\n        element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px';\n\n      }, 4);\n\n    }\n\n    // setup auto slideshow\n    var delay = options.auto || 0;\n    var interval;\n\n    function begin() {\n\n      interval = setTimeout(next, delay);\n\n    }\n\n    function stop() {\n\n      delay = options.auto || 0;\n      clearTimeout(interval);\n\n    }\n\n\n    // setup initial vars\n    var start = {};\n    var delta = {};\n    var isScrolling;\n\n    // setup event capturing\n    var events = {\n\n      handleEvent: function(event) {\n        if(event.type == 'mousedown' || event.type == 'mouseup' || event.type == 'mousemove') {\n          event.touches = [{\n            pageX: event.pageX,\n            pageY: event.pageY\n          }];\n        }\n\n        switch (event.type) {\n          case 'mousedown': this.start(event); break;\n          case 'touchstart': this.start(event); break;\n          case 'touchmove': this.touchmove(event); break;\n          case 'mousemove': this.touchmove(event); break;\n          case 'touchend': offloadFn(this.end(event)); break;\n          case 'mouseup': offloadFn(this.end(event)); break;\n          case 'webkitTransitionEnd':\n          case 'msTransitionEnd':\n          case 'oTransitionEnd':\n          case 'otransitionend':\n          case 'transitionend': offloadFn(this.transitionEnd(event)); break;\n          case 'resize': offloadFn(setup); break;\n        }\n\n        if (options.stopPropagation) event.stopPropagation();\n\n      },\n      start: function(event) {\n\n        var touches = event.touches[0];\n\n        // measure start values\n        start = {\n\n          // get initial touch coords\n          x: touches.pageX,\n          y: touches.pageY,\n\n          // store time to determine touch duration\n          time: +new Date()\n\n        };\n\n        // used for testing first move event\n        isScrolling = undefined;\n\n        // reset delta and end measurements\n        delta = {};\n\n        // attach touchmove and touchend listeners\n        if(browser.touch) {\n          element.addEventListener('touchmove', this, false);\n          element.addEventListener('touchend', this, false);\n        } else {\n          element.addEventListener('mousemove', this, false);\n          element.addEventListener('mouseup', this, false);\n          document.addEventListener('mouseup', this, false);\n        }\n      },\n      touchmove: function(event) {\n\n        // ensure swiping with one touch and not pinching\n        // ensure sliding is enabled\n        if (event.touches.length > 1 ||\n            event.scale && event.scale !== 1 ||\n            slider.slideIsDisabled) {\n          return;\n        }\n\n        if (options.disableScroll) event.preventDefault();\n\n        var touches = event.touches[0];\n\n        // measure change in x and y\n        delta = {\n          x: touches.pageX - start.x,\n          y: touches.pageY - start.y\n        };\n\n        // determine if scrolling test has run - one time test\n        if ( typeof isScrolling == 'undefined') {\n          isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) );\n        }\n\n        // if user is not trying to scroll vertically\n        if (!isScrolling) {\n\n          // prevent native scrolling\n          event.preventDefault();\n\n          // stop slideshow\n          stop();\n\n          // increase resistance if first or last slide\n          if (options.continuous) { // we don't add resistance at the end\n\n            translate(circle(index-1), delta.x + slidePos[circle(index-1)], 0);\n            translate(index, delta.x + slidePos[index], 0);\n            translate(circle(index+1), delta.x + slidePos[circle(index+1)], 0);\n\n          } else {\n\n            delta.x =\n              delta.x /\n                ( (!index && delta.x > 0 ||         // if first slide and sliding left\n                  index == slides.length - 1 &&     // or if last slide and sliding right\n                  delta.x < 0                       // and if sliding at all\n                ) ?\n                ( Math.abs(delta.x) / width + 1 )      // determine resistance level\n                : 1 );                                 // no resistance if false\n\n            // translate 1:1\n            translate(index-1, delta.x + slidePos[index-1], 0);\n            translate(index, delta.x + slidePos[index], 0);\n            translate(index+1, delta.x + slidePos[index+1], 0);\n          }\n\n        }\n\n      },\n      end: function(event) {\n\n        // measure duration\n        var duration = +new Date() - start.time;\n\n        // determine if slide attempt triggers next/prev slide\n        var isValidSlide =\n              Number(duration) < 250 &&         // if slide duration is less than 250ms\n              Math.abs(delta.x) > 20 ||         // and if slide amt is greater than 20px\n              Math.abs(delta.x) > width/2;      // or if slide amt is greater than half the width\n\n        // determine if slide attempt is past start and end\n        var isPastBounds = (!index && delta.x > 0) ||      // if first slide and slide amt is greater than 0\n              (index == slides.length - 1 && delta.x < 0); // or if last slide and slide amt is less than 0\n\n        if (options.continuous) isPastBounds = false;\n\n        // determine direction of swipe (true:right, false:left)\n        var direction = delta.x < 0;\n\n        // if not scrolling vertically\n        if (!isScrolling) {\n\n          if (isValidSlide && !isPastBounds) {\n\n            if (direction) {\n\n              if (options.continuous) { // we need to get the next in this direction in place\n\n                move(circle(index-1), -width, 0);\n                move(circle(index+2), width, 0);\n\n              } else {\n                move(index-1, -width, 0);\n              }\n\n              move(index, slidePos[index]-width, speed);\n              move(circle(index+1), slidePos[circle(index+1)]-width, speed);\n              index = circle(index+1);\n\n            } else {\n              if (options.continuous) { // we need to get the next in this direction in place\n\n                move(circle(index+1), width, 0);\n                move(circle(index-2), -width, 0);\n\n              } else {\n                move(index+1, width, 0);\n              }\n\n              move(index, slidePos[index]+width, speed);\n              move(circle(index-1), slidePos[circle(index-1)]+width, speed);\n              index = circle(index-1);\n\n            }\n\n            options.callback && options.callback(index, slides[index]);\n\n          } else {\n\n            if (options.continuous) {\n\n              move(circle(index-1), -width, speed);\n              move(index, 0, speed);\n              move(circle(index+1), width, speed);\n\n            } else {\n\n              move(index-1, -width, speed);\n              move(index, 0, speed);\n              move(index+1, width, speed);\n            }\n\n          }\n\n        }\n\n        // kill touchmove and touchend event listeners until touchstart called again\n        if(browser.touch) {\n          element.removeEventListener('touchmove', events, false);\n          element.removeEventListener('touchend', events, false);\n        } else {\n          element.removeEventListener('mousemove', events, false);\n          element.removeEventListener('mouseup', events, false);\n          document.removeEventListener('mouseup', events, false);\n        }\n\n      },\n      transitionEnd: function(event) {\n\n        if (parseInt(event.target.getAttribute('data-index'), 10) == index) {\n\n          if (delay) begin();\n\n          options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);\n\n        }\n\n      }\n\n    };\n\n    // Public API\n    this.update = function() {\n      setTimeout(setup);\n    };\n    this.setup = function() {\n      setup();\n    };\n\n    this.enableSlide = function(shouldEnable) {\n      if (arguments.length) {\n        this.slideIsDisabled = !shouldEnable;\n      }\n      return !this.slideIsDisabled;\n    },\n    this.slide = function(to, speed) {\n      // cancel slideshow\n      stop();\n\n      slide(to, speed);\n    };\n\n    this.prev = this.previous = function() {\n      // cancel slideshow\n      stop();\n\n      prev();\n    };\n\n    this.next = function() {\n      // cancel slideshow\n      stop();\n\n      next();\n    };\n\n    this.stop = function() {\n      // cancel slideshow\n      stop();\n    };\n\n    this.start = function() {\n      begin();\n    };\n\n    this.currentIndex = function() {\n      // return current index position\n      return index;\n    };\n\n    this.slidesCount = function() {\n      // return total number of slides\n      return length;\n    };\n\n    this.kill = function() {\n      // cancel slideshow\n      stop();\n\n      // reset element\n      element.style.width = '';\n      element.style.left = '';\n\n      // reset slides\n      var pos = slides.length;\n      while(pos--) {\n\n        var slide = slides[pos];\n        slide.style.width = '';\n        slide.style.left = '';\n\n        if (browser.transitions) translate(pos, 0, 0);\n\n      }\n\n      // removed event listeners\n      if (browser.addEventListener) {\n\n        // remove current event listeners\n        element.removeEventListener('touchstart', events, false);\n        element.removeEventListener('webkitTransitionEnd', events, false);\n        element.removeEventListener('msTransitionEnd', events, false);\n        element.removeEventListener('oTransitionEnd', events, false);\n        element.removeEventListener('otransitionend', events, false);\n        element.removeEventListener('transitionend', events, false);\n        window.removeEventListener('resize', events, false);\n\n      }\n      else {\n\n        window.onresize = null;\n\n      }\n    };\n\n    this.load = function() {\n      // trigger setup\n      setup();\n\n      // start auto slideshow if applicable\n      if (delay) begin();\n\n\n      // add event listeners\n      if (browser.addEventListener) {\n\n        // set touchstart event on element\n        if (browser.touch) {\n          element.addEventListener('touchstart', events, false);\n        } else {\n          element.addEventListener('mousedown', events, false);\n        }\n\n        if (browser.transitions) {\n          element.addEventListener('webkitTransitionEnd', events, false);\n          element.addEventListener('msTransitionEnd', events, false);\n          element.addEventListener('oTransitionEnd', events, false);\n          element.addEventListener('otransitionend', events, false);\n          element.addEventListener('transitionend', events, false);\n        }\n\n        // set resize event on window\n        window.addEventListener('resize', events, false);\n\n      } else {\n\n        window.onresize = function () { setup(); }; // to play nice with old IE\n\n      }\n    };\n\n  }\n});\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.Toggle = ionic.views.View.inherit({\n    initialize: function(opts) {\n      var self = this;\n\n      this.el = opts.el;\n      this.checkbox = opts.checkbox;\n      this.track = opts.track;\n      this.handle = opts.handle;\n      this.openPercent = -1;\n      this.onChange = opts.onChange || function() {};\n\n      this.triggerThreshold = opts.triggerThreshold || 20;\n\n      this.dragStartHandler = function(e) {\n        self.dragStart(e);\n      };\n      this.dragHandler = function(e) {\n        self.drag(e);\n      };\n      this.holdHandler = function(e) {\n        self.hold(e);\n      };\n      this.releaseHandler = function(e) {\n        self.release(e);\n      };\n\n      this.dragStartGesture = ionic.onGesture('dragstart', this.dragStartHandler, this.el);\n      this.dragGesture = ionic.onGesture('drag', this.dragHandler, this.el);\n      this.dragHoldGesture = ionic.onGesture('hold', this.holdHandler, this.el);\n      this.dragReleaseGesture = ionic.onGesture('release', this.releaseHandler, this.el);\n    },\n\n    destroy: function() {\n      ionic.offGesture(this.dragStartGesture, 'dragstart', this.dragStartGesture);\n      ionic.offGesture(this.dragGesture, 'drag', this.dragGesture);\n      ionic.offGesture(this.dragHoldGesture, 'hold', this.holdHandler);\n      ionic.offGesture(this.dragReleaseGesture, 'release', this.releaseHandler);\n    },\n\n    tap: function(e) {\n      if(this.el.getAttribute('disabled') !== 'disabled') {\n        this.val( !this.checkbox.checked );\n      }\n    },\n\n    dragStart: function(e) {\n      if(this.checkbox.disabled) return;\n\n      this._dragInfo = {\n        width: this.el.offsetWidth,\n        left: this.el.offsetLeft,\n        right: this.el.offsetLeft + this.el.offsetWidth,\n        triggerX: this.el.offsetWidth / 2,\n        initialState: this.checkbox.checked\n      };\n\n      // Stop any parent dragging\n      e.gesture.srcEvent.preventDefault();\n\n      // Trigger hold styles\n      this.hold(e);\n    },\n\n    drag: function(e) {\n      var self = this;\n      if(!this._dragInfo) { return; }\n\n      // Stop any parent dragging\n      e.gesture.srcEvent.preventDefault();\n\n      ionic.requestAnimationFrame(function(amount) {\n        if (!self._dragInfo) { return; }\n\n        var slidePageLeft = self.track.offsetLeft + (self.handle.offsetWidth / 2);\n        var slidePageRight = self.track.offsetLeft + self.track.offsetWidth - (self.handle.offsetWidth / 2);\n        var dx = e.gesture.deltaX;\n\n        var px = e.gesture.touches[0].pageX - self._dragInfo.left;\n        var mx = self._dragInfo.width - self.triggerThreshold;\n\n        // The initial state was on, so \"tend towards\" on\n        if(self._dragInfo.initialState) {\n          if(px < self.triggerThreshold) {\n            self.setOpenPercent(0);\n          } else if(px > self._dragInfo.triggerX) {\n            self.setOpenPercent(100);\n          }\n        } else {\n          // The initial state was off, so \"tend towards\" off\n          if(px < self._dragInfo.triggerX) {\n            self.setOpenPercent(0);\n          } else if(px > mx) {\n            self.setOpenPercent(100);\n          }\n        }\n      });\n    },\n\n    endDrag: function(e) {\n      this._dragInfo = null;\n    },\n\n    hold: function(e) {\n      this.el.classList.add('dragging');\n    },\n    release: function(e) {\n      this.el.classList.remove('dragging');\n      this.endDrag(e);\n    },\n\n\n    setOpenPercent: function(openPercent) {\n      // only make a change if the new open percent has changed\n      if(this.openPercent < 0 || (openPercent < (this.openPercent - 3) || openPercent > (this.openPercent + 3) ) ) {\n        this.openPercent = openPercent;\n\n        if(openPercent === 0) {\n          this.val(false);\n        } else if(openPercent === 100) {\n          this.val(true);\n        } else {\n          var openPixel = Math.round( (openPercent / 100) * this.track.offsetWidth - (this.handle.offsetWidth) );\n          openPixel = (openPixel < 1 ? 0 : openPixel);\n          this.handle.style[ionic.CSS.TRANSFORM] = 'translate3d(' + openPixel + 'px,0,0)';\n        }\n      }\n    },\n\n    val: function(value) {\n      if(value === true || value === false) {\n        if(this.handle.style[ionic.CSS.TRANSFORM] !== \"\") {\n          this.handle.style[ionic.CSS.TRANSFORM] = \"\";\n        }\n        this.checkbox.checked = value;\n        this.openPercent = (value ? 100 : 0);\n        this.onChange && this.onChange();\n      }\n      return this.checkbox.checked;\n    }\n\n  });\n\n})(ionic);\n\n})();\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/**\n * @license AngularJS v1.2.17\n * (c) 2010-2014 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, document, undefined) {'use strict';\n\n/**\n * @description\n *\n * This object provides a utility for producing rich Error messages within\n * Angular. It can be called as follows:\n *\n * var exampleMinErr = minErr('example');\n * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);\n *\n * The above creates an instance of minErr in the example namespace. The\n * resulting error will have a namespaced error code of example.one.  The\n * resulting error will replace {0} with the value of foo, and {1} with the\n * value of bar. The object is not restricted in the number of arguments it can\n * take.\n *\n * If fewer arguments are specified than necessary for interpolation, the extra\n * interpolation markers will be preserved in the final string.\n *\n * Since data will be parsed statically during a build step, some restrictions\n * are applied with respect to how minErr instances are created and called.\n * Instances should have names of the form namespaceMinErr for a minErr created\n * using minErr('namespace') . Error codes, namespaces and template strings\n * should all be static strings, not variables or general expressions.\n *\n * @param {string} module The namespace to use for the new minErr instance.\n * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance\n */\n\nfunction minErr(module) {\n  return function () {\n    var code = arguments[0],\n      prefix = '[' + (module ? module + ':' : '') + code + '] ',\n      template = arguments[1],\n      templateArgs = arguments,\n      stringify = function (obj) {\n        if (typeof obj === 'function') {\n          return obj.toString().replace(/ \\{[\\s\\S]*$/, '');\n        } else if (typeof obj === 'undefined') {\n          return 'undefined';\n        } else if (typeof obj !== 'string') {\n          return JSON.stringify(obj);\n        }\n        return obj;\n      },\n      message, i;\n\n    message = prefix + template.replace(/\\{\\d+\\}/g, function (match) {\n      var index = +match.slice(1, -1), arg;\n\n      if (index + 2 < templateArgs.length) {\n        arg = templateArgs[index + 2];\n        if (typeof arg === 'function') {\n          return arg.toString().replace(/ ?\\{[\\s\\S]*$/, '');\n        } else if (typeof arg === 'undefined') {\n          return 'undefined';\n        } else if (typeof arg !== 'string') {\n          return toJson(arg);\n        }\n        return arg;\n      }\n      return match;\n    });\n\n    message = message + '\\nhttp://errors.angularjs.org/1.2.17/' +\n      (module ? module + '/' : '') + code;\n    for (i = 2; i < arguments.length; i++) {\n      message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +\n        encodeURIComponent(stringify(arguments[i]));\n    }\n\n    return new Error(message);\n  };\n}\n\n/* We need to tell jshint what variables are being exported */\n/* global\n    -angular,\n    -msie,\n    -jqLite,\n    -jQuery,\n    -slice,\n    -push,\n    -toString,\n    -ngMinErr,\n    -angularModule,\n    -nodeName_,\n    -uid,\n\n    -lowercase,\n    -uppercase,\n    -manualLowercase,\n    -manualUppercase,\n    -nodeName_,\n    -isArrayLike,\n    -forEach,\n    -sortedKeys,\n    -forEachSorted,\n    -reverseParams,\n    -nextUid,\n    -setHashKey,\n    -extend,\n    -int,\n    -inherit,\n    -noop,\n    -identity,\n    -valueFn,\n    -isUndefined,\n    -isDefined,\n    -isObject,\n    -isString,\n    -isNumber,\n    -isDate,\n    -isArray,\n    -isFunction,\n    -isRegExp,\n    -isWindow,\n    -isScope,\n    -isFile,\n    -isBlob,\n    -isBoolean,\n    -trim,\n    -isElement,\n    -makeMap,\n    -map,\n    -size,\n    -includes,\n    -indexOf,\n    -arrayRemove,\n    -isLeafNode,\n    -copy,\n    -shallowCopy,\n    -equals,\n    -csp,\n    -concat,\n    -sliceArgs,\n    -bind,\n    -toJsonReplacer,\n    -toJson,\n    -fromJson,\n    -toBoolean,\n    -startingTag,\n    -tryDecodeURIComponent,\n    -parseKeyValue,\n    -toKeyValue,\n    -encodeUriSegment,\n    -encodeUriQuery,\n    -angularInit,\n    -bootstrap,\n    -snake_case,\n    -bindJQuery,\n    -assertArg,\n    -assertArgFn,\n    -assertNotHasOwnProperty,\n    -getter,\n    -getBlockElements,\n    -hasOwnProperty,\n\n*/\n\n////////////////////////////////////\n\n/**\n * @ngdoc module\n * @name ng\n * @module ng\n * @description\n *\n * # ng (core module)\n * The ng module is loaded by default when an AngularJS application is started. The module itself\n * contains the essential components for an AngularJS application to function. The table below\n * lists a high level breakdown of each of the services/factories, filters, directives and testing\n * components available within this core module.\n *\n * <div doc-module-components=\"ng\"></div>\n */\n\n/**\n * @ngdoc function\n * @name angular.lowercase\n * @module ng\n * @kind function\n *\n * @description Converts the specified string to lowercase.\n * @param {string} string String to be converted to lowercase.\n * @returns {string} Lowercased string.\n */\nvar lowercase = function(string){return isString(string) ? string.toLowerCase() : string;};\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * @ngdoc function\n * @name angular.uppercase\n * @module ng\n * @kind function\n *\n * @description Converts the specified string to uppercase.\n * @param {string} string String to be converted to uppercase.\n * @returns {string} Uppercased string.\n */\nvar uppercase = function(string){return isString(string) ? string.toUpperCase() : string;};\n\n\nvar manualLowercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})\n      : s;\n};\nvar manualUppercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})\n      : s;\n};\n\n\n// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish\n// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods\n// with correct but slower alternatives.\nif ('i' !== 'I'.toLowerCase()) {\n  lowercase = manualLowercase;\n  uppercase = manualUppercase;\n}\n\n\nvar /** holds major version number for IE or NaN for real browsers */\n    msie,\n    jqLite,           // delay binding since jQuery could be loaded after us.\n    jQuery,           // delay binding\n    slice             = [].slice,\n    push              = [].push,\n    toString          = Object.prototype.toString,\n    ngMinErr          = minErr('ng'),\n\n    /** @name angular */\n    angular           = window.angular || (window.angular = {}),\n    angularModule,\n    nodeName_,\n    uid               = ['0', '0', '0'];\n\n/**\n * IE 11 changed the format of the UserAgent string.\n * See http://msdn.microsoft.com/en-us/library/ms537503.aspx\n */\nmsie = int((/msie (\\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);\nif (isNaN(msie)) {\n  msie = int((/trident\\/.*; rv:(\\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);\n}\n\n\n/**\n * @private\n * @param {*} obj\n * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,\n *                   String ...)\n */\nfunction isArrayLike(obj) {\n  if (obj == null || isWindow(obj)) {\n    return false;\n  }\n\n  var length = obj.length;\n\n  if (obj.nodeType === 1 && length) {\n    return true;\n  }\n\n  return isString(obj) || isArray(obj) || length === 0 ||\n         typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\n/**\n * @ngdoc function\n * @name angular.forEach\n * @module ng\n * @kind function\n *\n * @description\n * Invokes the `iterator` function once for each item in `obj` collection, which can be either an\n * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value`\n * is the value of an object property or an array element and `key` is the object property key or\n * array element index. Specifying a `context` for the function is optional.\n *\n * It is worth noting that `.forEach` does not iterate over inherited properties because it filters\n * using the `hasOwnProperty` method.\n *\n   ```js\n     var values = {name: 'misko', gender: 'male'};\n     var log = [];\n     angular.forEach(values, function(value, key) {\n       this.push(key + ': ' + value);\n     }, log);\n     expect(log).toEqual(['name: misko', 'gender: male']);\n   ```\n *\n * @param {Object|Array} obj Object to iterate over.\n * @param {Function} iterator Iterator function.\n * @param {Object=} context Object to become context (`this`) for the iterator function.\n * @returns {Object|Array} Reference to `obj`.\n */\nfunction forEach(obj, iterator, context) {\n  var key;\n  if (obj) {\n    if (isFunction(obj)) {\n      for (key in obj) {\n        // Need to check if hasOwnProperty exists,\n        // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n        if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n          iterator.call(context, obj[key], key);\n        }\n      }\n    } else if (obj.forEach && obj.forEach !== forEach) {\n      obj.forEach(iterator, context);\n    } else if (isArrayLike(obj)) {\n      for (key = 0; key < obj.length; key++)\n        iterator.call(context, obj[key], key);\n    } else {\n      for (key in obj) {\n        if (obj.hasOwnProperty(key)) {\n          iterator.call(context, obj[key], key);\n        }\n      }\n    }\n  }\n  return obj;\n}\n\nfunction sortedKeys(obj) {\n  var keys = [];\n  for (var key in obj) {\n    if (obj.hasOwnProperty(key)) {\n      keys.push(key);\n    }\n  }\n  return keys.sort();\n}\n\nfunction forEachSorted(obj, iterator, context) {\n  var keys = sortedKeys(obj);\n  for ( var i = 0; i < keys.length; i++) {\n    iterator.call(context, obj[keys[i]], keys[i]);\n  }\n  return keys;\n}\n\n\n/**\n * when using forEach the params are value, key, but it is often useful to have key, value.\n * @param {function(string, *)} iteratorFn\n * @returns {function(*, string)}\n */\nfunction reverseParams(iteratorFn) {\n  return function(value, key) { iteratorFn(key, value); };\n}\n\n/**\n * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric\n * characters such as '012ABC'. The reason why we are not using simply a number counter is that\n * the number string gets longer over time, and it can also overflow, where as the nextId\n * will grow much slower, it is a string, and it will never overflow.\n *\n * @returns {string} an unique alpha-numeric string\n */\nfunction nextUid() {\n  var index = uid.length;\n  var digit;\n\n  while(index) {\n    index--;\n    digit = uid[index].charCodeAt(0);\n    if (digit == 57 /*'9'*/) {\n      uid[index] = 'A';\n      return uid.join('');\n    }\n    if (digit == 90  /*'Z'*/) {\n      uid[index] = '0';\n    } else {\n      uid[index] = String.fromCharCode(digit + 1);\n      return uid.join('');\n    }\n  }\n  uid.unshift('0');\n  return uid.join('');\n}\n\n\n/**\n * Set or clear the hashkey for an object.\n * @param obj object\n * @param h the hashkey (!truthy to delete the hashkey)\n */\nfunction setHashKey(obj, h) {\n  if (h) {\n    obj.$$hashKey = h;\n  }\n  else {\n    delete obj.$$hashKey;\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.extend\n * @module ng\n * @kind function\n *\n * @description\n * Extends the destination object `dst` by copying all of the properties from the `src` object(s)\n * to `dst`. You can specify multiple `src` objects.\n *\n * @param {Object} dst Destination object.\n * @param {...Object} src Source object(s).\n * @returns {Object} Reference to `dst`.\n */\nfunction extend(dst) {\n  var h = dst.$$hashKey;\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        dst[key] = value;\n      });\n    }\n  });\n\n  setHashKey(dst,h);\n  return dst;\n}\n\nfunction int(str) {\n  return parseInt(str, 10);\n}\n\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, {prototype:parent}))(), extra);\n}\n\n/**\n * @ngdoc function\n * @name angular.noop\n * @module ng\n * @kind function\n *\n * @description\n * A function that performs no operations. This function can be useful when writing code in the\n * functional style.\n   ```js\n     function foo(callback) {\n       var result = calculateResult();\n       (callback || angular.noop)(result);\n     }\n   ```\n */\nfunction noop() {}\nnoop.$inject = [];\n\n\n/**\n * @ngdoc function\n * @name angular.identity\n * @module ng\n * @kind function\n *\n * @description\n * A function that returns its first argument. This function is useful when writing code in the\n * functional style.\n *\n   ```js\n     function transformer(transformationFn, value) {\n       return (transformationFn || angular.identity)(value);\n     };\n   ```\n */\nfunction identity($) {return $;}\nidentity.$inject = [];\n\n\nfunction valueFn(value) {return function() {return value;};}\n\n/**\n * @ngdoc function\n * @name angular.isUndefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is undefined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is undefined.\n */\nfunction isUndefined(value){return typeof value === 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is defined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is defined.\n */\nfunction isDefined(value){return typeof value !== 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isObject\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not\n * considered to be objects. Note that JavaScript arrays are objects.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Object` but not `null`.\n */\nfunction isObject(value){return value != null && typeof value === 'object';}\n\n\n/**\n * @ngdoc function\n * @name angular.isString\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `String`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `String`.\n */\nfunction isString(value){return typeof value === 'string';}\n\n\n/**\n * @ngdoc function\n * @name angular.isNumber\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Number`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Number`.\n */\nfunction isNumber(value){return typeof value === 'number';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDate\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a value is a date.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Date`.\n */\nfunction isDate(value) {\n  return toString.call(value) === '[object Date]';\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isArray\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Array`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Array`.\n */\nfunction isArray(value) {\n  return toString.call(value) === '[object Array]';\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isFunction\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Function`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Function`.\n */\nfunction isFunction(value){return typeof value === 'function';}\n\n\n/**\n * Determines if a value is a regular expression object.\n *\n * @private\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `RegExp`.\n */\nfunction isRegExp(value) {\n  return toString.call(value) === '[object RegExp]';\n}\n\n\n/**\n * Checks if `obj` is a window object.\n *\n * @private\n * @param {*} obj Object to check\n * @returns {boolean} True if `obj` is a window obj.\n */\nfunction isWindow(obj) {\n  return obj && obj.document && obj.location && obj.alert && obj.setInterval;\n}\n\n\nfunction isScope(obj) {\n  return obj && obj.$evalAsync && obj.$watch;\n}\n\n\nfunction isFile(obj) {\n  return toString.call(obj) === '[object File]';\n}\n\n\nfunction isBlob(obj) {\n  return toString.call(obj) === '[object Blob]';\n}\n\n\nfunction isBoolean(value) {\n  return typeof value === 'boolean';\n}\n\n\nvar trim = (function() {\n  // native trim is way faster: http://jsperf.com/angular-trim-test\n  // but IE doesn't have it... :-(\n  // TODO: we should move this into IE/ES5 polyfill\n  if (!String.prototype.trim) {\n    return function(value) {\n      return isString(value) ? value.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '') : value;\n    };\n  }\n  return function(value) {\n    return isString(value) ? value.trim() : value;\n  };\n})();\n\n\n/**\n * @ngdoc function\n * @name angular.isElement\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a DOM element (or wrapped jQuery element).\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).\n */\nfunction isElement(node) {\n  return !!(node &&\n    (node.nodeName  // we are a direct element\n    || (node.prop && node.attr && node.find)));  // we have an on and find method part of jQuery API\n}\n\n/**\n * @param str 'key1,key2,...'\n * @returns {object} in the form of {key1:true, key2:true, ...}\n */\nfunction makeMap(str) {\n  var obj = {}, items = str.split(\",\"), i;\n  for ( i = 0; i < items.length; i++ )\n    obj[ items[i] ] = true;\n  return obj;\n}\n\n\nif (msie < 9) {\n  nodeName_ = function(element) {\n    element = element.nodeName ? element : element[0];\n    return (element.scopeName && element.scopeName != 'HTML')\n      ? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName;\n  };\n} else {\n  nodeName_ = function(element) {\n    return element.nodeName ? element.nodeName : element[0].nodeName;\n  };\n}\n\n\nfunction map(obj, iterator, context) {\n  var results = [];\n  forEach(obj, function(value, index, list) {\n    results.push(iterator.call(context, value, index, list));\n  });\n  return results;\n}\n\n\n/**\n * @description\n * Determines the number of elements in an array, the number of properties an object has, or\n * the length of a string.\n *\n * Note: This function is used to augment the Object type in Angular expressions. See\n * {@link angular.Object} for more information about Angular arrays.\n *\n * @param {Object|Array|string} obj Object, array, or string to inspect.\n * @param {boolean} [ownPropsOnly=false] Count only \"own\" properties in an object\n * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array.\n */\nfunction size(obj, ownPropsOnly) {\n  var count = 0, key;\n\n  if (isArray(obj) || isString(obj)) {\n    return obj.length;\n  } else if (isObject(obj)) {\n    for (key in obj)\n      if (!ownPropsOnly || obj.hasOwnProperty(key))\n        count++;\n  }\n\n  return count;\n}\n\n\nfunction includes(array, obj) {\n  return indexOf(array, obj) != -1;\n}\n\nfunction indexOf(array, obj) {\n  if (array.indexOf) return array.indexOf(obj);\n\n  for (var i = 0; i < array.length; i++) {\n    if (obj === array[i]) return i;\n  }\n  return -1;\n}\n\nfunction arrayRemove(array, value) {\n  var index = indexOf(array, value);\n  if (index >=0)\n    array.splice(index, 1);\n  return value;\n}\n\nfunction isLeafNode (node) {\n  if (node) {\n    switch (node.nodeName) {\n    case \"OPTION\":\n    case \"PRE\":\n    case \"TITLE\":\n      return true;\n    }\n  }\n  return false;\n}\n\n/**\n * @ngdoc function\n * @name angular.copy\n * @module ng\n * @kind function\n *\n * @description\n * Creates a deep copy of `source`, which should be an object or an array.\n *\n * * If no destination is supplied, a copy of the object or array is created.\n * * If a destination is provided, all of its elements (for array) or properties (for objects)\n *   are deleted and then all elements/properties from the source are copied to it.\n * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.\n * * If `source` is identical to 'destination' an exception will be thrown.\n *\n * @param {*} source The source that will be used to make a copy.\n *                   Can be any type, including primitives, `null`, and `undefined`.\n * @param {(Object|Array)=} destination Destination into which the source is copied. If\n *     provided, must be of the same type as `source`.\n * @returns {*} The copy or updated `destination`, if `destination` was specified.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <div ng-controller=\"Controller\">\n <form novalidate class=\"simple-form\">\n Name: <input type=\"text\" ng-model=\"user.name\" /><br />\n E-mail: <input type=\"email\" ng-model=\"user.email\" /><br />\n Gender: <input type=\"radio\" ng-model=\"user.gender\" value=\"male\" />male\n <input type=\"radio\" ng-model=\"user.gender\" value=\"female\" />female<br />\n <button ng-click=\"reset()\">RESET</button>\n <button ng-click=\"update(user)\">SAVE</button>\n </form>\n <pre>form = {{user | json}}</pre>\n <pre>master = {{master | json}}</pre>\n </div>\n\n <script>\n function Controller($scope) {\n    $scope.master= {};\n\n    $scope.update = function(user) {\n      // Example with 1 argument\n      $scope.master= angular.copy(user);\n    };\n\n    $scope.reset = function() {\n      // Example with 2 arguments\n      angular.copy($scope.master, $scope.user);\n    };\n\n    $scope.reset();\n  }\n </script>\n </file>\n </example>\n */\nfunction copy(source, destination, stackSource, stackDest) {\n  if (isWindow(source) || isScope(source)) {\n    throw ngMinErr('cpws',\n      \"Can't copy! Making copies of Window or Scope instances is not supported.\");\n  }\n\n  if (!destination) {\n    destination = source;\n    if (source) {\n      if (isArray(source)) {\n        destination = copy(source, [], stackSource, stackDest);\n      } else if (isDate(source)) {\n        destination = new Date(source.getTime());\n      } else if (isRegExp(source)) {\n        destination = new RegExp(source.source);\n      } else if (isObject(source)) {\n        destination = copy(source, {}, stackSource, stackDest);\n      }\n    }\n  } else {\n    if (source === destination) throw ngMinErr('cpi',\n      \"Can't copy! Source and destination are identical.\");\n\n    stackSource = stackSource || [];\n    stackDest = stackDest || [];\n\n    if (isObject(source)) {\n      var index = indexOf(stackSource, source);\n      if (index !== -1) return stackDest[index];\n\n      stackSource.push(source);\n      stackDest.push(destination);\n    }\n\n    var result;\n    if (isArray(source)) {\n      destination.length = 0;\n      for ( var i = 0; i < source.length; i++) {\n        result = copy(source[i], null, stackSource, stackDest);\n        if (isObject(source[i])) {\n          stackSource.push(source[i]);\n          stackDest.push(result);\n        }\n        destination.push(result);\n      }\n    } else {\n      var h = destination.$$hashKey;\n      forEach(destination, function(value, key) {\n        delete destination[key];\n      });\n      for ( var key in source) {\n        result = copy(source[key], null, stackSource, stackDest);\n        if (isObject(source[key])) {\n          stackSource.push(source[key]);\n          stackDest.push(result);\n        }\n        destination[key] = result;\n      }\n      setHashKey(destination,h);\n    }\n\n  }\n  return destination;\n}\n\n/**\n * Creates a shallow copy of an object, an array or a primitive\n */\nfunction shallowCopy(src, dst) {\n  if (isArray(src)) {\n    dst = dst || [];\n\n    for ( var i = 0; i < src.length; i++) {\n      dst[i] = src[i];\n    }\n  } else if (isObject(src)) {\n    dst = dst || {};\n\n    for (var key in src) {\n      if (hasOwnProperty.call(src, key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {\n        dst[key] = src[key];\n      }\n    }\n  }\n\n  return dst || src;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.equals\n * @module ng\n * @kind function\n *\n * @description\n * Determines if two objects or two values are equivalent. Supports value types, regular\n * expressions, arrays and objects.\n *\n * Two objects or values are considered equivalent if at least one of the following is true:\n *\n * * Both objects or values pass `===` comparison.\n * * Both objects or values are of the same type and all of their properties are equal by\n *   comparing them with `angular.equals`.\n * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)\n * * Both values represent the same regular expression (In JavaScript,\n *   /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual\n *   representation matches).\n *\n * During a property comparison, properties of `function` type and properties with names\n * that begin with `$` are ignored.\n *\n * Scope and DOMWindow objects are being compared only by identify (`===`).\n *\n * @param {*} o1 Object or value to compare.\n * @param {*} o2 Object or value to compare.\n * @returns {boolean} True if arguments are equal.\n */\nfunction equals(o1, o2) {\n  if (o1 === o2) return true;\n  if (o1 === null || o2 === null) return false;\n  if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n  var t1 = typeof o1, t2 = typeof o2, length, key, keySet;\n  if (t1 == t2) {\n    if (t1 == 'object') {\n      if (isArray(o1)) {\n        if (!isArray(o2)) return false;\n        if ((length = o1.length) == o2.length) {\n          for(key=0; key<length; key++) {\n            if (!equals(o1[key], o2[key])) return false;\n          }\n          return true;\n        }\n      } else if (isDate(o1)) {\n        return isDate(o2) && o1.getTime() == o2.getTime();\n      } else if (isRegExp(o1) && isRegExp(o2)) {\n        return o1.toString() == o2.toString();\n      } else {\n        if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false;\n        keySet = {};\n        for(key in o1) {\n          if (key.charAt(0) === '$' || isFunction(o1[key])) continue;\n          if (!equals(o1[key], o2[key])) return false;\n          keySet[key] = true;\n        }\n        for(key in o2) {\n          if (!keySet.hasOwnProperty(key) &&\n              key.charAt(0) !== '$' &&\n              o2[key] !== undefined &&\n              !isFunction(o2[key])) return false;\n        }\n        return true;\n      }\n    }\n  }\n  return false;\n}\n\n\nfunction csp() {\n  return (document.securityPolicy && document.securityPolicy.isActive) ||\n      (document.querySelector &&\n      !!(document.querySelector('[ng-csp]') || document.querySelector('[data-ng-csp]')));\n}\n\n\nfunction concat(array1, array2, index) {\n  return array1.concat(slice.call(array2, index));\n}\n\nfunction sliceArgs(args, startIndex) {\n  return slice.call(args, startIndex || 0);\n}\n\n\n/* jshint -W101 */\n/**\n * @ngdoc function\n * @name angular.bind\n * @module ng\n * @kind function\n *\n * @description\n * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for\n * `fn`). You can supply optional `args` that are prebound to the function. This feature is also\n * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as\n * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).\n *\n * @param {Object} self Context which `fn` should be evaluated in.\n * @param {function()} fn Function to be bound.\n * @param {...*} args Optional arguments to be prebound to the `fn` function call.\n * @returns {function()} Function that wraps the `fn` with all the specified bindings.\n */\n/* jshint +W101 */\nfunction bind(self, fn) {\n  var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];\n  if (isFunction(fn) && !(fn instanceof RegExp)) {\n    return curryArgs.length\n      ? function() {\n          return arguments.length\n            ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0)))\n            : fn.apply(self, curryArgs);\n        }\n      : function() {\n          return arguments.length\n            ? fn.apply(self, arguments)\n            : fn.call(self);\n        };\n  } else {\n    // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)\n    return fn;\n  }\n}\n\n\nfunction toJsonReplacer(key, value) {\n  var val = value;\n\n  if (typeof key === 'string' && key.charAt(0) === '$') {\n    val = undefined;\n  } else if (isWindow(value)) {\n    val = '$WINDOW';\n  } else if (value &&  document === value) {\n    val = '$DOCUMENT';\n  } else if (isScope(value)) {\n    val = '$SCOPE';\n  }\n\n  return val;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.toJson\n * @module ng\n * @kind function\n *\n * @description\n * Serializes input into a JSON-formatted string. Properties with leading $ characters will be\n * stripped since angular uses this notation internally.\n *\n * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.\n * @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace.\n * @returns {string|undefined} JSON-ified string representing `obj`.\n */\nfunction toJson(obj, pretty) {\n  if (typeof obj === 'undefined') return undefined;\n  return JSON.stringify(obj, toJsonReplacer, pretty ? '  ' : null);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.fromJson\n * @module ng\n * @kind function\n *\n * @description\n * Deserializes a JSON string.\n *\n * @param {string} json JSON string to deserialize.\n * @returns {Object|Array|string|number} Deserialized thingy.\n */\nfunction fromJson(json) {\n  return isString(json)\n      ? JSON.parse(json)\n      : json;\n}\n\n\nfunction toBoolean(value) {\n  if (typeof value === 'function') {\n    value = true;\n  } else if (value && value.length !== 0) {\n    var v = lowercase(\"\" + value);\n    value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');\n  } else {\n    value = false;\n  }\n  return value;\n}\n\n/**\n * @returns {string} Returns the string representation of the element.\n */\nfunction startingTag(element) {\n  element = jqLite(element).clone();\n  try {\n    // turns out IE does not let you set .html() on elements which\n    // are not allowed to have children. So we just ignore it.\n    element.empty();\n  } catch(e) {}\n  // As Per DOM Standards\n  var TEXT_NODE = 3;\n  var elemHtml = jqLite('<div>').append(element).html();\n  try {\n    return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) :\n        elemHtml.\n          match(/^(<[^>]+>)/)[1].\n          replace(/^<([\\w\\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });\n  } catch(e) {\n    return lowercase(elemHtml);\n  }\n\n}\n\n\n/////////////////////////////////////////////////\n\n/**\n * Tries to decode the URI component without throwing an exception.\n *\n * @private\n * @param str value potential URI component to check.\n * @returns {boolean} True if `value` can be decoded\n * with the decodeURIComponent function.\n */\nfunction tryDecodeURIComponent(value) {\n  try {\n    return decodeURIComponent(value);\n  } catch(e) {\n    // Ignore any invalid uri component\n  }\n}\n\n\n/**\n * Parses an escaped url query string into key-value pairs.\n * @returns {Object.<string,boolean|Array>}\n */\nfunction parseKeyValue(/**string*/keyValue) {\n  var obj = {}, key_value, key;\n  forEach((keyValue || \"\").split('&'), function(keyValue) {\n    if ( keyValue ) {\n      key_value = keyValue.split('=');\n      key = tryDecodeURIComponent(key_value[0]);\n      if ( isDefined(key) ) {\n        var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;\n        if (!obj[key]) {\n          obj[key] = val;\n        } else if(isArray(obj[key])) {\n          obj[key].push(val);\n        } else {\n          obj[key] = [obj[key],val];\n        }\n      }\n    }\n  });\n  return obj;\n}\n\nfunction toKeyValue(obj) {\n  var parts = [];\n  forEach(obj, function(value, key) {\n    if (isArray(value)) {\n      forEach(value, function(arrayValue) {\n        parts.push(encodeUriQuery(key, true) +\n                   (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));\n      });\n    } else {\n    parts.push(encodeUriQuery(key, true) +\n               (value === true ? '' : '=' + encodeUriQuery(value, true)));\n    }\n  });\n  return parts.length ? parts.join('&') : '';\n}\n\n\n/**\n * We need our custom method because encodeURIComponent is too aggressive and doesn't follow\n * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path\n * segments:\n *    segment       = *pchar\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriSegment(val) {\n  return encodeUriQuery(val, true).\n             replace(/%26/gi, '&').\n             replace(/%3D/gi, '=').\n             replace(/%2B/gi, '+');\n}\n\n\n/**\n * This method is intended for encoding *key* or *value* parts of query component. We need a custom\n * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be\n * encoded per http://tools.ietf.org/html/rfc3986:\n *    query       = *( pchar / \"/\" / \"?\" )\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriQuery(val, pctEncodeSpaces) {\n  return encodeURIComponent(val).\n             replace(/%40/gi, '@').\n             replace(/%3A/gi, ':').\n             replace(/%24/g, '$').\n             replace(/%2C/gi, ',').\n             replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));\n}\n\n\n/**\n * @ngdoc directive\n * @name ngApp\n * @module ng\n *\n * @element ANY\n * @param {angular.Module} ngApp an optional application\n *   {@link angular.module module} name to load.\n *\n * @description\n *\n * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive\n * designates the **root element** of the application and is typically placed near the root element\n * of the page - e.g. on the `<body>` or `<html>` tags.\n *\n * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`\n * found in the document will be used to define the root element to auto-bootstrap as an\n * application. To run multiple applications in an HTML document you must manually bootstrap them using\n * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.\n *\n * You can specify an **AngularJS module** to be used as the root module for the application.  This\n * module will be loaded into the {@link auto.$injector} when the application is bootstrapped and\n * should contain the application code needed or have dependencies on other modules that will\n * contain the code. See {@link angular.module} for more information.\n *\n * In the example below if the `ngApp` directive were not placed on the `html` element then the\n * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`\n * would not be resolved to `3`.\n *\n * `ngApp` is the easiest, and most common, way to bootstrap an application.\n *\n <example module=\"ngAppDemo\">\n   <file name=\"index.html\">\n   <div ng-controller=\"ngAppDemoController\">\n     I can add: {{a}} + {{b}} =  {{ a+b }}\n   </div>\n   </file>\n   <file name=\"script.js\">\n   angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {\n     $scope.a = 1;\n     $scope.b = 2;\n   });\n   </file>\n </example>\n *\n */\nfunction angularInit(element, bootstrap) {\n  var elements = [element],\n      appElement,\n      module,\n      names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'],\n      NG_APP_CLASS_REGEXP = /\\sng[:\\-]app(:\\s*([\\w\\d_]+);?)?\\s/;\n\n  function append(element) {\n    element && elements.push(element);\n  }\n\n  forEach(names, function(name) {\n    names[name] = true;\n    append(document.getElementById(name));\n    name = name.replace(':', '\\\\:');\n    if (element.querySelectorAll) {\n      forEach(element.querySelectorAll('.' + name), append);\n      forEach(element.querySelectorAll('.' + name + '\\\\:'), append);\n      forEach(element.querySelectorAll('[' + name + ']'), append);\n    }\n  });\n\n  forEach(elements, function(element) {\n    if (!appElement) {\n      var className = ' ' + element.className + ' ';\n      var match = NG_APP_CLASS_REGEXP.exec(className);\n      if (match) {\n        appElement = element;\n        module = (match[2] || '').replace(/\\s+/g, ',');\n      } else {\n        forEach(element.attributes, function(attr) {\n          if (!appElement && names[attr.name]) {\n            appElement = element;\n            module = attr.value;\n          }\n        });\n      }\n    }\n  });\n  if (appElement) {\n    bootstrap(appElement, module ? [module] : []);\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.bootstrap\n * @module ng\n * @description\n * Use this function to manually start up angular application.\n *\n * See: {@link guide/bootstrap Bootstrap}\n *\n * Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually.\n * They must use {@link ng.directive:ngApp ngApp}.\n *\n * Angular will detect if it has been loaded into the browser more than once and only allow the\n * first loaded script to be bootstrapped and will report a warning to the browser console for\n * each of the subsequent scripts.   This prevents strange results in applications, where otherwise\n * multiple instances of Angular try to work on the DOM.\n *\n * <example name=\"multi-bootstrap\" module=\"multi-bootstrap\">\n * <file name=\"index.html\">\n * <script src=\"../../../angular.js\"></script>\n * <div ng-controller=\"BrokenTable\">\n *   <table>\n *   <tr>\n *     <th ng-repeat=\"heading in headings\">{{heading}}</th>\n *   </tr>\n *   <tr ng-repeat=\"filling in fillings\">\n *     <td ng-repeat=\"fill in filling\">{{fill}}</td>\n *   </tr>\n * </table>\n * </div>\n * </file>\n * <file name=\"controller.js\">\n * var app = angular.module('multi-bootstrap', [])\n *\n * .controller('BrokenTable', function($scope) {\n *     $scope.headings = ['One', 'Two', 'Three'];\n *     $scope.fillings = [[1, 2, 3], ['A', 'B', 'C'], [7, 8, 9]];\n * });\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should only insert one table cell for each item in $scope.fillings', function() {\n *  expect(element.all(by.css('td')).count())\n *      .toBe(9);\n * });\n * </file>\n * </example>\n *\n * @param {DOMElement} element DOM element which is the root of angular application.\n * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.\n *     Each item in the array should be the name of a predefined module or a (DI annotated)\n *     function that will be invoked by the injector as a run block.\n *     See: {@link angular.module modules}\n * @returns {auto.$injector} Returns the newly created injector for this app.\n */\nfunction bootstrap(element, modules) {\n  var doBootstrap = function() {\n    element = jqLite(element);\n\n    if (element.injector()) {\n      var tag = (element[0] === document) ? 'document' : startingTag(element);\n      throw ngMinErr('btstrpd', \"App Already Bootstrapped with this Element '{0}'\", tag);\n    }\n\n    modules = modules || [];\n    modules.unshift(['$provide', function($provide) {\n      $provide.value('$rootElement', element);\n    }]);\n    modules.unshift('ng');\n    var injector = createInjector(modules);\n    injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', '$animate',\n       function(scope, element, compile, injector, animate) {\n        scope.$apply(function() {\n          element.data('$injector', injector);\n          compile(element)(scope);\n        });\n      }]\n    );\n    return injector;\n  };\n\n  var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;\n\n  if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {\n    return doBootstrap();\n  }\n\n  window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');\n  angular.resumeBootstrap = function(extraModules) {\n    forEach(extraModules, function(module) {\n      modules.push(module);\n    });\n    doBootstrap();\n  };\n}\n\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nfunction snake_case(name, separator) {\n  separator = separator || '_';\n  return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n    return (pos ? separator : '') + letter.toLowerCase();\n  });\n}\n\nfunction bindJQuery() {\n  // bind to jQuery if present;\n  jQuery = window.jQuery;\n  // Use jQuery if it exists with proper functionality, otherwise default to us.\n  // Angular 1.2+ requires jQuery 1.7.1+ for on()/off() support.\n  if (jQuery && jQuery.fn.on) {\n    jqLite = jQuery;\n    extend(jQuery.fn, {\n      scope: JQLitePrototype.scope,\n      isolateScope: JQLitePrototype.isolateScope,\n      controller: JQLitePrototype.controller,\n      injector: JQLitePrototype.injector,\n      inheritedData: JQLitePrototype.inheritedData\n    });\n    // Method signature:\n    //     jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments)\n    jqLitePatchJQueryRemove('remove', true, true, false);\n    jqLitePatchJQueryRemove('empty', false, false, false);\n    jqLitePatchJQueryRemove('html', false, false, true);\n  } else {\n    jqLite = JQLite;\n  }\n  angular.element = jqLite;\n}\n\n/**\n * throw error if the argument is falsy.\n */\nfunction assertArg(arg, name, reason) {\n  if (!arg) {\n    throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n  }\n  return arg;\n}\n\nfunction assertArgFn(arg, name, acceptArrayAnnotation) {\n  if (acceptArrayAnnotation && isArray(arg)) {\n      arg = arg[arg.length - 1];\n  }\n\n  assertArg(isFunction(arg), name, 'not a function, got ' +\n      (arg && typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg));\n  return arg;\n}\n\n/**\n * throw error if the name given is hasOwnProperty\n * @param  {String} name    the name to test\n * @param  {String} context the context in which the name is used, such as module or directive\n */\nfunction assertNotHasOwnProperty(name, context) {\n  if (name === 'hasOwnProperty') {\n    throw ngMinErr('badname', \"hasOwnProperty is not a valid {0} name\", context);\n  }\n}\n\n/**\n * Return the value accessible from the object by path. Any undefined traversals are ignored\n * @param {Object} obj starting object\n * @param {String} path path to traverse\n * @param {boolean} [bindFnToScope=true]\n * @returns {Object} value as accessible by path\n */\n//TODO(misko): this function needs to be removed\nfunction getter(obj, path, bindFnToScope) {\n  if (!path) return obj;\n  var keys = path.split('.');\n  var key;\n  var lastInstance = obj;\n  var len = keys.length;\n\n  for (var i = 0; i < len; i++) {\n    key = keys[i];\n    if (obj) {\n      obj = (lastInstance = obj)[key];\n    }\n  }\n  if (!bindFnToScope && isFunction(obj)) {\n    return bind(lastInstance, obj);\n  }\n  return obj;\n}\n\n/**\n * Return the DOM siblings between the first and last node in the given array.\n * @param {Array} array like object\n * @returns {DOMElement} object containing the elements\n */\nfunction getBlockElements(nodes) {\n  var startNode = nodes[0],\n      endNode = nodes[nodes.length - 1];\n  if (startNode === endNode) {\n    return jqLite(startNode);\n  }\n\n  var element = startNode;\n  var elements = [element];\n\n  do {\n    element = element.nextSibling;\n    if (!element) break;\n    elements.push(element);\n  } while (element !== endNode);\n\n  return jqLite(elements);\n}\n\n/**\n * @ngdoc type\n * @name angular.Module\n * @module ng\n * @description\n *\n * Interface for configuring angular {@link angular.module modules}.\n */\n\nfunction setupModuleLoader(window) {\n\n  var $injectorMinErr = minErr('$injector');\n  var ngMinErr = minErr('ng');\n\n  function ensure(obj, name, factory) {\n    return obj[name] || (obj[name] = factory());\n  }\n\n  var angular = ensure(window, 'angular', Object);\n\n  // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap\n  angular.$$minErr = angular.$$minErr || minErr;\n\n  return ensure(angular, 'module', function() {\n    /** @type {Object.<string, angular.Module>} */\n    var modules = {};\n\n    /**\n     * @ngdoc function\n     * @name angular.module\n     * @module ng\n     * @description\n     *\n     * The `angular.module` is a global place for creating, registering and retrieving Angular\n     * modules.\n     * All modules (angular core or 3rd party) that should be available to an application must be\n     * registered using this mechanism.\n     *\n     * When passed two or more arguments, a new module is created.  If passed only one argument, an\n     * existing module (the name passed as the first argument to `module`) is retrieved.\n     *\n     *\n     * # Module\n     *\n     * A module is a collection of services, directives, filters, and configuration information.\n     * `angular.module` is used to configure the {@link auto.$injector $injector}.\n     *\n     * ```js\n     * // Create a new module\n     * var myModule = angular.module('myModule', []);\n     *\n     * // register a new service\n     * myModule.value('appName', 'MyCoolApp');\n     *\n     * // configure existing services inside initialization blocks.\n     * myModule.config(['$locationProvider', function($locationProvider) {\n     *   // Configure existing providers\n     *   $locationProvider.hashPrefix('!');\n     * }]);\n     * ```\n     *\n     * Then you can create an injector and load your modules like this:\n     *\n     * ```js\n     * var injector = angular.injector(['ng', 'myModule'])\n     * ```\n     *\n     * However it's more likely that you'll just use\n     * {@link ng.directive:ngApp ngApp} or\n     * {@link angular.bootstrap} to simplify this process for you.\n     *\n     * @param {!string} name The name of the module to create or retrieve.\n<<<<<* @param {!Array.<string>=} requires If specified then new module is being created. If\n>>>>>*        unspecified then the module is being retrieved for further configuration.\n     * @param {Function} configFn Optional configuration function for the module. Same as\n     *        {@link angular.Module#config Module#config()}.\n     * @returns {module} new module with the {@link angular.Module} api.\n     */\n    return function module(name, requires, configFn) {\n      var assertNotHasOwnProperty = function(name, context) {\n        if (name === 'hasOwnProperty') {\n          throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);\n        }\n      };\n\n      assertNotHasOwnProperty(name, 'module');\n      if (requires && modules.hasOwnProperty(name)) {\n        modules[name] = null;\n      }\n      return ensure(modules, name, function() {\n        if (!requires) {\n          throw $injectorMinErr('nomod', \"Module '{0}' is not available! You either misspelled \" +\n             \"the module name or forgot to load it. If registering a module ensure that you \" +\n             \"specify the dependencies as the second argument.\", name);\n        }\n\n        /** @type {!Array.<Array.<*>>} */\n        var invokeQueue = [];\n\n        /** @type {!Array.<Function>} */\n        var runBlocks = [];\n\n        var config = invokeLater('$injector', 'invoke');\n\n        /** @type {angular.Module} */\n        var moduleInstance = {\n          // Private state\n          _invokeQueue: invokeQueue,\n          _runBlocks: runBlocks,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#requires\n           * @module ng\n           * @returns {Array.<string>} List of module names which must be loaded before this module.\n           * @description\n           * Holds the list of modules which the injector will load before the current module is\n           * loaded.\n           */\n          requires: requires,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#name\n           * @module ng\n           * @returns {string} Name of the module.\n           * @description\n           */\n          name: name,\n\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#provider\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerType Construction function for creating new instance of the\n           *                                service.\n           * @description\n           * See {@link auto.$provide#provider $provide.provider()}.\n           */\n          provider: invokeLater('$provide', 'provider'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#factory\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerFunction Function for creating new instance of the service.\n           * @description\n           * See {@link auto.$provide#factory $provide.factory()}.\n           */\n          factory: invokeLater('$provide', 'factory'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#service\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} constructor A constructor function that will be instantiated.\n           * @description\n           * See {@link auto.$provide#service $provide.service()}.\n           */\n          service: invokeLater('$provide', 'service'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#value\n           * @module ng\n           * @param {string} name service name\n           * @param {*} object Service instance object.\n           * @description\n           * See {@link auto.$provide#value $provide.value()}.\n           */\n          value: invokeLater('$provide', 'value'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#constant\n           * @module ng\n           * @param {string} name constant name\n           * @param {*} object Constant value.\n           * @description\n           * Because the constant are fixed, they get applied before other provide methods.\n           * See {@link auto.$provide#constant $provide.constant()}.\n           */\n          constant: invokeLater('$provide', 'constant', 'unshift'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#animation\n           * @module ng\n           * @param {string} name animation name\n           * @param {Function} animationFactory Factory function for creating new instance of an\n           *                                    animation.\n           * @description\n           *\n           * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.\n           *\n           *\n           * Defines an animation hook that can be later used with\n           * {@link ngAnimate.$animate $animate} service and directives that use this service.\n           *\n           * ```js\n           * module.animation('.animation-name', function($inject1, $inject2) {\n           *   return {\n           *     eventName : function(element, done) {\n           *       //code to run the animation\n           *       //once complete, then run done()\n           *       return function cancellationFunction(element) {\n           *         //code to cancel the animation\n           *       }\n           *     }\n           *   }\n           * })\n           * ```\n           *\n           * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and\n           * {@link ngAnimate ngAnimate module} for more information.\n           */\n          animation: invokeLater('$animateProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#filter\n           * @module ng\n           * @param {string} name Filter name.\n           * @param {Function} filterFactory Factory function for creating new instance of filter.\n           * @description\n           * See {@link ng.$filterProvider#register $filterProvider.register()}.\n           */\n          filter: invokeLater('$filterProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#controller\n           * @module ng\n           * @param {string|Object} name Controller name, or an object map of controllers where the\n           *    keys are the names and the values are the constructors.\n           * @param {Function} constructor Controller constructor function.\n           * @description\n           * See {@link ng.$controllerProvider#register $controllerProvider.register()}.\n           */\n          controller: invokeLater('$controllerProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#directive\n           * @module ng\n           * @param {string|Object} name Directive name, or an object map of directives where the\n           *    keys are the names and the values are the factories.\n           * @param {Function} directiveFactory Factory function for creating new instance of\n           * directives.\n           * @description\n           * See {@link ng.$compileProvider#directive $compileProvider.directive()}.\n           */\n          directive: invokeLater('$compileProvider', 'directive'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#config\n           * @module ng\n           * @param {Function} configFn Execute this function on module load. Useful for service\n           *    configuration.\n           * @description\n           * Use this method to register work which needs to be performed on module loading.\n           * For more about how to configure services, see\n           * {@link providers#providers_provider-recipe Provider Recipe}.\n           */\n          config: config,\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#run\n           * @module ng\n           * @param {Function} initializationFn Execute this function after injector creation.\n           *    Useful for application initialization.\n           * @description\n           * Use this method to register work which should be performed when the injector is done\n           * loading all modules.\n           */\n          run: function(block) {\n            runBlocks.push(block);\n            return this;\n          }\n        };\n\n        if (configFn) {\n          config(configFn);\n        }\n\n        return  moduleInstance;\n\n        /**\n         * @param {string} provider\n         * @param {string} method\n         * @param {String=} insertMethod\n         * @returns {angular.Module}\n         */\n        function invokeLater(provider, method, insertMethod) {\n          return function() {\n            invokeQueue[insertMethod || 'push']([provider, method, arguments]);\n            return moduleInstance;\n          };\n        }\n      });\n    };\n  });\n\n}\n\n/* global\n    angularModule: true,\n    version: true,\n\n    $LocaleProvider,\n    $CompileProvider,\n\n    htmlAnchorDirective,\n    inputDirective,\n    inputDirective,\n    formDirective,\n    scriptDirective,\n    selectDirective,\n    styleDirective,\n    optionDirective,\n    ngBindDirective,\n    ngBindHtmlDirective,\n    ngBindTemplateDirective,\n    ngClassDirective,\n    ngClassEvenDirective,\n    ngClassOddDirective,\n    ngCspDirective,\n    ngCloakDirective,\n    ngControllerDirective,\n    ngFormDirective,\n    ngHideDirective,\n    ngIfDirective,\n    ngIncludeDirective,\n    ngIncludeFillContentDirective,\n    ngInitDirective,\n    ngNonBindableDirective,\n    ngPluralizeDirective,\n    ngRepeatDirective,\n    ngShowDirective,\n    ngStyleDirective,\n    ngSwitchDirective,\n    ngSwitchWhenDirective,\n    ngSwitchDefaultDirective,\n    ngOptionsDirective,\n    ngTranscludeDirective,\n    ngModelDirective,\n    ngListDirective,\n    ngChangeDirective,\n    requiredDirective,\n    requiredDirective,\n    ngValueDirective,\n    ngAttributeAliasDirectives,\n    ngEventDirectives,\n\n    $AnchorScrollProvider,\n    $AnimateProvider,\n    $BrowserProvider,\n    $CacheFactoryProvider,\n    $ControllerProvider,\n    $DocumentProvider,\n    $ExceptionHandlerProvider,\n    $FilterProvider,\n    $InterpolateProvider,\n    $IntervalProvider,\n    $HttpProvider,\n    $HttpBackendProvider,\n    $LocationProvider,\n    $LogProvider,\n    $ParseProvider,\n    $RootScopeProvider,\n    $QProvider,\n    $$SanitizeUriProvider,\n    $SceProvider,\n    $SceDelegateProvider,\n    $SnifferProvider,\n    $TemplateCacheProvider,\n    $TimeoutProvider,\n    $$RAFProvider,\n    $$AsyncCallbackProvider,\n    $WindowProvider\n*/\n\n\n/**\n * @ngdoc object\n * @name angular.version\n * @module ng\n * @description\n * An object that contains information about the current AngularJS version. This object has the\n * following properties:\n *\n * - `full` – `{string}` – Full version string, such as \"0.9.18\".\n * - `major` – `{number}` – Major version number, such as \"0\".\n * - `minor` – `{number}` – Minor version number, such as \"9\".\n * - `dot` – `{number}` – Dot version number, such as \"18\".\n * - `codeName` – `{string}` – Code name of the release, such as \"jiggling-armfat\".\n */\nvar version = {\n  full: '1.2.17',    // all of these placeholder strings will be replaced by grunt's\n  major: 1,    // package task\n  minor: 2,\n  dot: 17,\n  codeName: 'quantum-disentanglement'\n};\n\n\nfunction publishExternalAPI(angular){\n  extend(angular, {\n    'bootstrap': bootstrap,\n    'copy': copy,\n    'extend': extend,\n    'equals': equals,\n    'element': jqLite,\n    'forEach': forEach,\n    'injector': createInjector,\n    'noop':noop,\n    'bind':bind,\n    'toJson': toJson,\n    'fromJson': fromJson,\n    'identity':identity,\n    'isUndefined': isUndefined,\n    'isDefined': isDefined,\n    'isString': isString,\n    'isFunction': isFunction,\n    'isObject': isObject,\n    'isNumber': isNumber,\n    'isElement': isElement,\n    'isArray': isArray,\n    'version': version,\n    'isDate': isDate,\n    'lowercase': lowercase,\n    'uppercase': uppercase,\n    'callbacks': {counter: 0},\n    '$$minErr': minErr,\n    '$$csp': csp\n  });\n\n  angularModule = setupModuleLoader(window);\n  try {\n    angularModule('ngLocale');\n  } catch (e) {\n    angularModule('ngLocale', []).provider('$locale', $LocaleProvider);\n  }\n\n  angularModule('ng', ['ngLocale'], ['$provide',\n    function ngModule($provide) {\n      // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.\n      $provide.provider({\n        $$sanitizeUri: $$SanitizeUriProvider\n      });\n      $provide.provider('$compile', $CompileProvider).\n        directive({\n            a: htmlAnchorDirective,\n            input: inputDirective,\n            textarea: inputDirective,\n            form: formDirective,\n            script: scriptDirective,\n            select: selectDirective,\n            style: styleDirective,\n            option: optionDirective,\n            ngBind: ngBindDirective,\n            ngBindHtml: ngBindHtmlDirective,\n            ngBindTemplate: ngBindTemplateDirective,\n            ngClass: ngClassDirective,\n            ngClassEven: ngClassEvenDirective,\n            ngClassOdd: ngClassOddDirective,\n            ngCloak: ngCloakDirective,\n            ngController: ngControllerDirective,\n            ngForm: ngFormDirective,\n            ngHide: ngHideDirective,\n            ngIf: ngIfDirective,\n            ngInclude: ngIncludeDirective,\n            ngInit: ngInitDirective,\n            ngNonBindable: ngNonBindableDirective,\n            ngPluralize: ngPluralizeDirective,\n            ngRepeat: ngRepeatDirective,\n            ngShow: ngShowDirective,\n            ngStyle: ngStyleDirective,\n            ngSwitch: ngSwitchDirective,\n            ngSwitchWhen: ngSwitchWhenDirective,\n            ngSwitchDefault: ngSwitchDefaultDirective,\n            ngOptions: ngOptionsDirective,\n            ngTransclude: ngTranscludeDirective,\n            ngModel: ngModelDirective,\n            ngList: ngListDirective,\n            ngChange: ngChangeDirective,\n            required: requiredDirective,\n            ngRequired: requiredDirective,\n            ngValue: ngValueDirective\n        }).\n        directive({\n          ngInclude: ngIncludeFillContentDirective\n        }).\n        directive(ngAttributeAliasDirectives).\n        directive(ngEventDirectives);\n      $provide.provider({\n        $anchorScroll: $AnchorScrollProvider,\n        $animate: $AnimateProvider,\n        $browser: $BrowserProvider,\n        $cacheFactory: $CacheFactoryProvider,\n        $controller: $ControllerProvider,\n        $document: $DocumentProvider,\n        $exceptionHandler: $ExceptionHandlerProvider,\n        $filter: $FilterProvider,\n        $interpolate: $InterpolateProvider,\n        $interval: $IntervalProvider,\n        $http: $HttpProvider,\n        $httpBackend: $HttpBackendProvider,\n        $location: $LocationProvider,\n        $log: $LogProvider,\n        $parse: $ParseProvider,\n        $rootScope: $RootScopeProvider,\n        $q: $QProvider,\n        $sce: $SceProvider,\n        $sceDelegate: $SceDelegateProvider,\n        $sniffer: $SnifferProvider,\n        $templateCache: $TemplateCacheProvider,\n        $timeout: $TimeoutProvider,\n        $window: $WindowProvider,\n        $$rAF: $$RAFProvider,\n        $$asyncCallback : $$AsyncCallbackProvider\n      });\n    }\n  ]);\n}\n\n/* global\n\n  -JQLitePrototype,\n  -addEventListenerFn,\n  -removeEventListenerFn,\n  -BOOLEAN_ATTR\n*/\n\n//////////////////////////////////\n//JQLite\n//////////////////////////////////\n\n/**\n * @ngdoc function\n * @name angular.element\n * @module ng\n * @kind function\n *\n * @description\n * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.\n *\n * If jQuery is available, `angular.element` is an alias for the\n * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`\n * delegates to Angular's built-in subset of jQuery, called \"jQuery lite\" or \"jqLite.\"\n *\n * <div class=\"alert alert-success\">jqLite is a tiny, API-compatible subset of jQuery that allows\n * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most\n * commonly needed functionality with the goal of having a very small footprint.</div>\n *\n * To use jQuery, simply load it before `DOMContentLoaded` event fired.\n *\n * <div class=\"alert\">**Note:** all element references in Angular are always wrapped with jQuery or\n * jqLite; they are never raw DOM references.</div>\n *\n * ## Angular's jqLite\n * jqLite provides only the following jQuery methods:\n *\n * - [`addClass()`](http://api.jquery.com/addClass/)\n * - [`after()`](http://api.jquery.com/after/)\n * - [`append()`](http://api.jquery.com/append/)\n * - [`attr()`](http://api.jquery.com/attr/)\n * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData\n * - [`children()`](http://api.jquery.com/children/) - Does not support selectors\n * - [`clone()`](http://api.jquery.com/clone/)\n * - [`contents()`](http://api.jquery.com/contents/)\n * - [`css()`](http://api.jquery.com/css/)\n * - [`data()`](http://api.jquery.com/data/)\n * - [`empty()`](http://api.jquery.com/empty/)\n * - [`eq()`](http://api.jquery.com/eq/)\n * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name\n * - [`hasClass()`](http://api.jquery.com/hasClass/)\n * - [`html()`](http://api.jquery.com/html/)\n * - [`next()`](http://api.jquery.com/next/) - Does not support selectors\n * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData\n * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors\n * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors\n * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors\n * - [`prepend()`](http://api.jquery.com/prepend/)\n * - [`prop()`](http://api.jquery.com/prop/)\n * - [`ready()`](http://api.jquery.com/ready/)\n * - [`remove()`](http://api.jquery.com/remove/)\n * - [`removeAttr()`](http://api.jquery.com/removeAttr/)\n * - [`removeClass()`](http://api.jquery.com/removeClass/)\n * - [`removeData()`](http://api.jquery.com/removeData/)\n * - [`replaceWith()`](http://api.jquery.com/replaceWith/)\n * - [`text()`](http://api.jquery.com/text/)\n * - [`toggleClass()`](http://api.jquery.com/toggleClass/)\n * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.\n * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces\n * - [`val()`](http://api.jquery.com/val/)\n * - [`wrap()`](http://api.jquery.com/wrap/)\n *\n * ## jQuery/jqLite Extras\n * Angular also provides the following additional methods and events to both jQuery and jqLite:\n *\n * ### Events\n * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event\n *    on all DOM nodes being removed.  This can be used to clean up any 3rd party bindings to the DOM\n *    element before it is removed.\n *\n * ### Methods\n * - `controller(name)` - retrieves the controller of the current element or its parent. By default\n *   retrieves controller associated with the `ngController` directive. If `name` is provided as\n *   camelCase directive name, then the controller for this directive will be retrieved (e.g.\n *   `'ngModel'`).\n * - `injector()` - retrieves the injector of the current element or its parent.\n * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current\n *   element or its parent.\n * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the\n *   current element. This getter should be used only on elements that contain a directive which starts a new isolate\n *   scope. Calling `scope()` on this element always returns the original non-isolate scope.\n * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top\n *   parent element is reached.\n *\n * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.\n * @returns {Object} jQuery object.\n */\n\nvar jqCache = JQLite.cache = {},\n    jqName = JQLite.expando = 'ng' + new Date().getTime(),\n    jqId = 1,\n    addEventListenerFn = (window.document.addEventListener\n      ? function(element, type, fn) {element.addEventListener(type, fn, false);}\n      : function(element, type, fn) {element.attachEvent('on' + type, fn);}),\n    removeEventListenerFn = (window.document.removeEventListener\n      ? function(element, type, fn) {element.removeEventListener(type, fn, false); }\n      : function(element, type, fn) {element.detachEvent('on' + type, fn); });\n\n/*\n * !!! This is an undocumented \"private\" function !!!\n */\nvar jqData = JQLite._data = function(node) {\n  //jQuery always returns an object on cache miss\n  return this.cache[node[this.expando]] || {};\n};\n\nfunction jqNextId() { return ++jqId; }\n\n\nvar SPECIAL_CHARS_REGEXP = /([\\:\\-\\_]+(.))/g;\nvar MOZ_HACK_REGEXP = /^moz([A-Z])/;\nvar jqLiteMinErr = minErr('jqLite');\n\n/**\n * Converts snake_case to camelCase.\n * Also there is special case for Moz prefix starting with upper case letter.\n * @param name Name to normalize\n */\nfunction camelCase(name) {\n  return name.\n    replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {\n      return offset ? letter.toUpperCase() : letter;\n    }).\n    replace(MOZ_HACK_REGEXP, 'Moz$1');\n}\n\n/////////////////////////////////////////////\n// jQuery mutation patch\n//\n// In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a\n// $destroy event on all DOM nodes being removed.\n//\n/////////////////////////////////////////////\n\nfunction jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) {\n  var originalJqFn = jQuery.fn[name];\n  originalJqFn = originalJqFn.$original || originalJqFn;\n  removePatch.$original = originalJqFn;\n  jQuery.fn[name] = removePatch;\n\n  function removePatch(param) {\n    // jshint -W040\n    var list = filterElems && param ? [this.filter(param)] : [this],\n        fireEvent = dispatchThis,\n        set, setIndex, setLength,\n        element, childIndex, childLength, children;\n\n    if (!getterIfNoArguments || param != null) {\n      while(list.length) {\n        set = list.shift();\n        for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) {\n          element = jqLite(set[setIndex]);\n          if (fireEvent) {\n            element.triggerHandler('$destroy');\n          } else {\n            fireEvent = !fireEvent;\n          }\n          for(childIndex = 0, childLength = (children = element.children()).length;\n              childIndex < childLength;\n              childIndex++) {\n            list.push(jQuery(children[childIndex]));\n          }\n        }\n      }\n    }\n    return originalJqFn.apply(this, arguments);\n  }\n}\n\nvar SINGLE_TAG_REGEXP = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/;\nvar HTML_REGEXP = /<|&#?\\w+;/;\nvar TAG_NAME_REGEXP = /<([\\w:]+)/;\nvar XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/gi;\n\nvar wrapMap = {\n  'option': [1, '<select multiple=\"multiple\">', '</select>'],\n\n  'thead': [1, '<table>', '</table>'],\n  'col': [2, '<table><colgroup>', '</colgroup></table>'],\n  'tr': [2, '<table><tbody>', '</tbody></table>'],\n  'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],\n  '_default': [0, \"\", \"\"]\n};\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\nfunction jqLiteIsTextNode(html) {\n  return !HTML_REGEXP.test(html);\n}\n\nfunction jqLiteBuildFragment(html, context) {\n  var elem, tmp, tag, wrap,\n      fragment = context.createDocumentFragment(),\n      nodes = [], i, j, jj;\n\n  if (jqLiteIsTextNode(html)) {\n    // Convert non-html into a text node\n    nodes.push(context.createTextNode(html));\n  } else {\n    tmp = fragment.appendChild(context.createElement('div'));\n    // Convert html into DOM nodes\n    tag = (TAG_NAME_REGEXP.exec(html) || [\"\", \"\"])[1].toLowerCase();\n    wrap = wrapMap[tag] || wrapMap._default;\n    tmp.innerHTML = '<div>&#160;</div>' +\n      wrap[1] + html.replace(XHTML_TAG_REGEXP, \"<$1></$2>\") + wrap[2];\n    tmp.removeChild(tmp.firstChild);\n\n    // Descend through wrappers to the right content\n    i = wrap[0];\n    while (i--) {\n      tmp = tmp.lastChild;\n    }\n\n    for (j=0, jj=tmp.childNodes.length; j<jj; ++j) nodes.push(tmp.childNodes[j]);\n\n    tmp = fragment.firstChild;\n    tmp.textContent = \"\";\n  }\n\n  // Remove wrapper from fragment\n  fragment.textContent = \"\";\n  fragment.innerHTML = \"\"; // Clear inner HTML\n  return nodes;\n}\n\nfunction jqLiteParseHTML(html, context) {\n  context = context || document;\n  var parsed;\n\n  if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {\n    return [context.createElement(parsed[1])];\n  }\n\n  return jqLiteBuildFragment(html, context);\n}\n\n/////////////////////////////////////////////\nfunction JQLite(element) {\n  if (element instanceof JQLite) {\n    return element;\n  }\n  if (isString(element)) {\n    element = trim(element);\n  }\n  if (!(this instanceof JQLite)) {\n    if (isString(element) && element.charAt(0) != '<') {\n      throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');\n    }\n    return new JQLite(element);\n  }\n\n  if (isString(element)) {\n    jqLiteAddNodes(this, jqLiteParseHTML(element));\n    var fragment = jqLite(document.createDocumentFragment());\n    fragment.append(this);\n  } else {\n    jqLiteAddNodes(this, element);\n  }\n}\n\nfunction jqLiteClone(element) {\n  return element.cloneNode(true);\n}\n\nfunction jqLiteDealoc(element){\n  jqLiteRemoveData(element);\n  for ( var i = 0, children = element.childNodes || []; i < children.length; i++) {\n    jqLiteDealoc(children[i]);\n  }\n}\n\nfunction jqLiteOff(element, type, fn, unsupported) {\n  if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');\n\n  var events = jqLiteExpandoStore(element, 'events'),\n      handle = jqLiteExpandoStore(element, 'handle');\n\n  if (!handle) return; //no listeners registered\n\n  if (isUndefined(type)) {\n    forEach(events, function(eventHandler, type) {\n      removeEventListenerFn(element, type, eventHandler);\n      delete events[type];\n    });\n  } else {\n    forEach(type.split(' '), function(type) {\n      if (isUndefined(fn)) {\n        removeEventListenerFn(element, type, events[type]);\n        delete events[type];\n      } else {\n        arrayRemove(events[type] || [], fn);\n      }\n    });\n  }\n}\n\nfunction jqLiteRemoveData(element, name) {\n  var expandoId = element[jqName],\n      expandoStore = jqCache[expandoId];\n\n  if (expandoStore) {\n    if (name) {\n      delete jqCache[expandoId].data[name];\n      return;\n    }\n\n    if (expandoStore.handle) {\n      expandoStore.events.$destroy && expandoStore.handle({}, '$destroy');\n      jqLiteOff(element);\n    }\n    delete jqCache[expandoId];\n    element[jqName] = undefined; // ie does not allow deletion of attributes on elements.\n  }\n}\n\nfunction jqLiteExpandoStore(element, key, value) {\n  var expandoId = element[jqName],\n      expandoStore = jqCache[expandoId || -1];\n\n  if (isDefined(value)) {\n    if (!expandoStore) {\n      element[jqName] = expandoId = jqNextId();\n      expandoStore = jqCache[expandoId] = {};\n    }\n    expandoStore[key] = value;\n  } else {\n    return expandoStore && expandoStore[key];\n  }\n}\n\nfunction jqLiteData(element, key, value) {\n  var data = jqLiteExpandoStore(element, 'data'),\n      isSetter = isDefined(value),\n      keyDefined = !isSetter && isDefined(key),\n      isSimpleGetter = keyDefined && !isObject(key);\n\n  if (!data && !isSimpleGetter) {\n    jqLiteExpandoStore(element, 'data', data = {});\n  }\n\n  if (isSetter) {\n    data[key] = value;\n  } else {\n    if (keyDefined) {\n      if (isSimpleGetter) {\n        // don't create data in this case.\n        return data && data[key];\n      } else {\n        extend(data, key);\n      }\n    } else {\n      return data;\n    }\n  }\n}\n\nfunction jqLiteHasClass(element, selector) {\n  if (!element.getAttribute) return false;\n  return ((\" \" + (element.getAttribute('class') || '') + \" \").replace(/[\\n\\t]/g, \" \").\n      indexOf( \" \" + selector + \" \" ) > -1);\n}\n\nfunction jqLiteRemoveClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    forEach(cssClasses.split(' '), function(cssClass) {\n      element.setAttribute('class', trim(\n          (\" \" + (element.getAttribute('class') || '') + \" \")\n          .replace(/[\\n\\t]/g, \" \")\n          .replace(\" \" + trim(cssClass) + \" \", \" \"))\n      );\n    });\n  }\n}\n\nfunction jqLiteAddClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')\n                            .replace(/[\\n\\t]/g, \" \");\n\n    forEach(cssClasses.split(' '), function(cssClass) {\n      cssClass = trim(cssClass);\n      if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n        existingClasses += cssClass + ' ';\n      }\n    });\n\n    element.setAttribute('class', trim(existingClasses));\n  }\n}\n\nfunction jqLiteAddNodes(root, elements) {\n  if (elements) {\n    elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements))\n      ? elements\n      : [ elements ];\n    for(var i=0; i < elements.length; i++) {\n      root.push(elements[i]);\n    }\n  }\n}\n\nfunction jqLiteController(element, name) {\n  return jqLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller');\n}\n\nfunction jqLiteInheritedData(element, name, value) {\n  element = jqLite(element);\n\n  // if element is the document object work with the html element instead\n  // this makes $(document).scope() possible\n  if(element[0].nodeType == 9) {\n    element = element.find('html');\n  }\n  var names = isArray(name) ? name : [name];\n\n  while (element.length) {\n    var node = element[0];\n    for (var i = 0, ii = names.length; i < ii; i++) {\n      if ((value = element.data(names[i])) !== undefined) return value;\n    }\n\n    // If dealing with a document fragment node with a host element, and no parent, use the host\n    // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM\n    // to lookup parent controllers.\n    element = jqLite(node.parentNode || (node.nodeType === 11 && node.host));\n  }\n}\n\nfunction jqLiteEmpty(element) {\n  for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {\n    jqLiteDealoc(childNodes[i]);\n  }\n  while (element.firstChild) {\n    element.removeChild(element.firstChild);\n  }\n}\n\n//////////////////////////////////////////\n// Functions which are declared directly.\n//////////////////////////////////////////\nvar JQLitePrototype = JQLite.prototype = {\n  ready: function(fn) {\n    var fired = false;\n\n    function trigger() {\n      if (fired) return;\n      fired = true;\n      fn();\n    }\n\n    // check if document already is loaded\n    if (document.readyState === 'complete'){\n      setTimeout(trigger);\n    } else {\n      this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9\n      // we can not use jqLite since we are not done loading and jQuery could be loaded later.\n      // jshint -W064\n      JQLite(window).on('load', trigger); // fallback to window.onload for others\n      // jshint +W064\n    }\n  },\n  toString: function() {\n    var value = [];\n    forEach(this, function(e){ value.push('' + e);});\n    return '[' + value.join(', ') + ']';\n  },\n\n  eq: function(index) {\n      return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);\n  },\n\n  length: 0,\n  push: push,\n  sort: [].sort,\n  splice: [].splice\n};\n\n//////////////////////////////////////////\n// Functions iterating getter/setters.\n// these functions return self on setter and\n// value on get.\n//////////////////////////////////////////\nvar BOOLEAN_ATTR = {};\nforEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {\n  BOOLEAN_ATTR[lowercase(value)] = value;\n});\nvar BOOLEAN_ELEMENTS = {};\nforEach('input,select,option,textarea,button,form,details'.split(','), function(value) {\n  BOOLEAN_ELEMENTS[uppercase(value)] = true;\n});\n\nfunction getBooleanAttrName(element, name) {\n  // check dom last since we will most likely fail on name\n  var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];\n\n  // booleanAttr is here twice to minimize DOM access\n  return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr;\n}\n\nforEach({\n  data: jqLiteData,\n  inheritedData: jqLiteInheritedData,\n\n  scope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite(element).data('$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);\n  },\n\n  isolateScope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite(element).data('$isolateScope') || jqLite(element).data('$isolateScopeNoTemplate');\n  },\n\n  controller: jqLiteController,\n\n  injector: function(element) {\n    return jqLiteInheritedData(element, '$injector');\n  },\n\n  removeAttr: function(element,name) {\n    element.removeAttribute(name);\n  },\n\n  hasClass: jqLiteHasClass,\n\n  css: function(element, name, value) {\n    name = camelCase(name);\n\n    if (isDefined(value)) {\n      element.style[name] = value;\n    } else {\n      var val;\n\n      if (msie <= 8) {\n        // this is some IE specific weirdness that jQuery 1.6.4 does not sure why\n        val = element.currentStyle && element.currentStyle[name];\n        if (val === '') val = 'auto';\n      }\n\n      val = val || element.style[name];\n\n      if (msie <= 8) {\n        // jquery weirdness :-/\n        val = (val === '') ? undefined : val;\n      }\n\n      return  val;\n    }\n  },\n\n  attr: function(element, name, value){\n    var lowercasedName = lowercase(name);\n    if (BOOLEAN_ATTR[lowercasedName]) {\n      if (isDefined(value)) {\n        if (!!value) {\n          element[name] = true;\n          element.setAttribute(name, lowercasedName);\n        } else {\n          element[name] = false;\n          element.removeAttribute(lowercasedName);\n        }\n      } else {\n        return (element[name] ||\n                 (element.attributes.getNamedItem(name)|| noop).specified)\n               ? lowercasedName\n               : undefined;\n      }\n    } else if (isDefined(value)) {\n      element.setAttribute(name, value);\n    } else if (element.getAttribute) {\n      // the extra argument \"2\" is to get the right thing for a.href in IE, see jQuery code\n      // some elements (e.g. Document) don't have get attribute, so return undefined\n      var ret = element.getAttribute(name, 2);\n      // normalize non-existing attributes to undefined (as jQuery)\n      return ret === null ? undefined : ret;\n    }\n  },\n\n  prop: function(element, name, value) {\n    if (isDefined(value)) {\n      element[name] = value;\n    } else {\n      return element[name];\n    }\n  },\n\n  text: (function() {\n    var NODE_TYPE_TEXT_PROPERTY = [];\n    if (msie < 9) {\n      NODE_TYPE_TEXT_PROPERTY[1] = 'innerText';    /** Element **/\n      NODE_TYPE_TEXT_PROPERTY[3] = 'nodeValue';    /** Text **/\n    } else {\n      NODE_TYPE_TEXT_PROPERTY[1] =                 /** Element **/\n      NODE_TYPE_TEXT_PROPERTY[3] = 'textContent';  /** Text **/\n    }\n    getText.$dv = '';\n    return getText;\n\n    function getText(element, value) {\n      var textProp = NODE_TYPE_TEXT_PROPERTY[element.nodeType];\n      if (isUndefined(value)) {\n        return textProp ? element[textProp] : '';\n      }\n      element[textProp] = value;\n    }\n  })(),\n\n  val: function(element, value) {\n    if (isUndefined(value)) {\n      if (nodeName_(element) === 'SELECT' && element.multiple) {\n        var result = [];\n        forEach(element.options, function (option) {\n          if (option.selected) {\n            result.push(option.value || option.text);\n          }\n        });\n        return result.length === 0 ? null : result;\n      }\n      return element.value;\n    }\n    element.value = value;\n  },\n\n  html: function(element, value) {\n    if (isUndefined(value)) {\n      return element.innerHTML;\n    }\n    for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {\n      jqLiteDealoc(childNodes[i]);\n    }\n    element.innerHTML = value;\n  },\n\n  empty: jqLiteEmpty\n}, function(fn, name){\n  /**\n   * Properties: writes return selection, reads return first value\n   */\n  JQLite.prototype[name] = function(arg1, arg2) {\n    var i, key;\n\n    // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it\n    // in a way that survives minification.\n    // jqLiteEmpty takes no arguments but is a setter.\n    if (fn !== jqLiteEmpty &&\n        (((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined)) {\n      if (isObject(arg1)) {\n\n        // we are a write, but the object properties are the key/values\n        for (i = 0; i < this.length; i++) {\n          if (fn === jqLiteData) {\n            // data() takes the whole object in jQuery\n            fn(this[i], arg1);\n          } else {\n            for (key in arg1) {\n              fn(this[i], key, arg1[key]);\n            }\n          }\n        }\n        // return self for chaining\n        return this;\n      } else {\n        // we are a read, so read the first child.\n        var value = fn.$dv;\n        // Only if we have $dv do we iterate over all, otherwise it is just the first element.\n        var jj = (value === undefined) ? Math.min(this.length, 1) : this.length;\n        for (var j = 0; j < jj; j++) {\n          var nodeValue = fn(this[j], arg1, arg2);\n          value = value ? value + nodeValue : nodeValue;\n        }\n        return value;\n      }\n    } else {\n      // we are a write, so apply to all children\n      for (i = 0; i < this.length; i++) {\n        fn(this[i], arg1, arg2);\n      }\n      // return self for chaining\n      return this;\n    }\n  };\n});\n\nfunction createEventHandler(element, events) {\n  var eventHandler = function (event, type) {\n    if (!event.preventDefault) {\n      event.preventDefault = function() {\n        event.returnValue = false; //ie\n      };\n    }\n\n    if (!event.stopPropagation) {\n      event.stopPropagation = function() {\n        event.cancelBubble = true; //ie\n      };\n    }\n\n    if (!event.target) {\n      event.target = event.srcElement || document;\n    }\n\n    if (isUndefined(event.defaultPrevented)) {\n      var prevent = event.preventDefault;\n      event.preventDefault = function() {\n        event.defaultPrevented = true;\n        prevent.call(event);\n      };\n      event.defaultPrevented = false;\n    }\n\n    event.isDefaultPrevented = function() {\n      return event.defaultPrevented || event.returnValue === false;\n    };\n\n    // Copy event handlers in case event handlers array is modified during execution.\n    var eventHandlersCopy = shallowCopy(events[type || event.type] || []);\n\n    forEach(eventHandlersCopy, function(fn) {\n      fn.call(element, event);\n    });\n\n    // Remove monkey-patched methods (IE),\n    // as they would cause memory leaks in IE8.\n    if (msie <= 8) {\n      // IE7/8 does not allow to delete property on native object\n      event.preventDefault = null;\n      event.stopPropagation = null;\n      event.isDefaultPrevented = null;\n    } else {\n      // It shouldn't affect normal browsers (native methods are defined on prototype).\n      delete event.preventDefault;\n      delete event.stopPropagation;\n      delete event.isDefaultPrevented;\n    }\n  };\n  eventHandler.elem = element;\n  return eventHandler;\n}\n\n//////////////////////////////////////////\n// Functions iterating traversal.\n// These functions chain results into a single\n// selector.\n//////////////////////////////////////////\nforEach({\n  removeData: jqLiteRemoveData,\n\n  dealoc: jqLiteDealoc,\n\n  on: function onFn(element, type, fn, unsupported){\n    if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');\n\n    var events = jqLiteExpandoStore(element, 'events'),\n        handle = jqLiteExpandoStore(element, 'handle');\n\n    if (!events) jqLiteExpandoStore(element, 'events', events = {});\n    if (!handle) jqLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events));\n\n    forEach(type.split(' '), function(type){\n      var eventFns = events[type];\n\n      if (!eventFns) {\n        if (type == 'mouseenter' || type == 'mouseleave') {\n          var contains = document.body.contains || document.body.compareDocumentPosition ?\n          function( a, b ) {\n            // jshint bitwise: false\n            var adown = a.nodeType === 9 ? a.documentElement : a,\n            bup = b && b.parentNode;\n            return a === bup || !!( bup && bup.nodeType === 1 && (\n              adown.contains ?\n              adown.contains( bup ) :\n              a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n              ));\n            } :\n            function( a, b ) {\n              if ( b ) {\n                while ( (b = b.parentNode) ) {\n                  if ( b === a ) {\n                    return true;\n                  }\n                }\n              }\n              return false;\n            };\n\n          events[type] = [];\n\n          // Refer to jQuery's implementation of mouseenter & mouseleave\n          // Read about mouseenter and mouseleave:\n          // http://www.quirksmode.org/js/events_mouse.html#link8\n          var eventmap = { mouseleave : \"mouseout\", mouseenter : \"mouseover\"};\n\n          onFn(element, eventmap[type], function(event) {\n            var target = this, related = event.relatedTarget;\n            // For mousenter/leave call the handler if related is outside the target.\n            // NB: No relatedTarget if the mouse left/entered the browser window\n            if ( !related || (related !== target && !contains(target, related)) ){\n              handle(event, type);\n            }\n          });\n\n        } else {\n          addEventListenerFn(element, type, handle);\n          events[type] = [];\n        }\n        eventFns = events[type];\n      }\n      eventFns.push(fn);\n    });\n  },\n\n  off: jqLiteOff,\n\n  one: function(element, type, fn) {\n    element = jqLite(element);\n\n    //add the listener twice so that when it is called\n    //you can remove the original function and still be\n    //able to call element.off(ev, fn) normally\n    element.on(type, function onFn() {\n      element.off(type, fn);\n      element.off(type, onFn);\n    });\n    element.on(type, fn);\n  },\n\n  replaceWith: function(element, replaceNode) {\n    var index, parent = element.parentNode;\n    jqLiteDealoc(element);\n    forEach(new JQLite(replaceNode), function(node){\n      if (index) {\n        parent.insertBefore(node, index.nextSibling);\n      } else {\n        parent.replaceChild(node, element);\n      }\n      index = node;\n    });\n  },\n\n  children: function(element) {\n    var children = [];\n    forEach(element.childNodes, function(element){\n      if (element.nodeType === 1)\n        children.push(element);\n    });\n    return children;\n  },\n\n  contents: function(element) {\n    return element.contentDocument || element.childNodes || [];\n  },\n\n  append: function(element, node) {\n    forEach(new JQLite(node), function(child){\n      if (element.nodeType === 1 || element.nodeType === 11) {\n        element.appendChild(child);\n      }\n    });\n  },\n\n  prepend: function(element, node) {\n    if (element.nodeType === 1) {\n      var index = element.firstChild;\n      forEach(new JQLite(node), function(child){\n        element.insertBefore(child, index);\n      });\n    }\n  },\n\n  wrap: function(element, wrapNode) {\n    wrapNode = jqLite(wrapNode)[0];\n    var parent = element.parentNode;\n    if (parent) {\n      parent.replaceChild(wrapNode, element);\n    }\n    wrapNode.appendChild(element);\n  },\n\n  remove: function(element) {\n    jqLiteDealoc(element);\n    var parent = element.parentNode;\n    if (parent) parent.removeChild(element);\n  },\n\n  after: function(element, newElement) {\n    var index = element, parent = element.parentNode;\n    forEach(new JQLite(newElement), function(node){\n      parent.insertBefore(node, index.nextSibling);\n      index = node;\n    });\n  },\n\n  addClass: jqLiteAddClass,\n  removeClass: jqLiteRemoveClass,\n\n  toggleClass: function(element, selector, condition) {\n    if (selector) {\n      forEach(selector.split(' '), function(className){\n        var classCondition = condition;\n        if (isUndefined(classCondition)) {\n          classCondition = !jqLiteHasClass(element, className);\n        }\n        (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);\n      });\n    }\n  },\n\n  parent: function(element) {\n    var parent = element.parentNode;\n    return parent && parent.nodeType !== 11 ? parent : null;\n  },\n\n  next: function(element) {\n    if (element.nextElementSibling) {\n      return element.nextElementSibling;\n    }\n\n    // IE8 doesn't have nextElementSibling\n    var elm = element.nextSibling;\n    while (elm != null && elm.nodeType !== 1) {\n      elm = elm.nextSibling;\n    }\n    return elm;\n  },\n\n  find: function(element, selector) {\n    if (element.getElementsByTagName) {\n      return element.getElementsByTagName(selector);\n    } else {\n      return [];\n    }\n  },\n\n  clone: jqLiteClone,\n\n  triggerHandler: function(element, eventName, eventData) {\n    var eventFns = (jqLiteExpandoStore(element, 'events') || {})[eventName];\n\n    eventData = eventData || [];\n\n    var event = [{\n      preventDefault: noop,\n      stopPropagation: noop\n    }];\n\n    forEach(eventFns, function(fn) {\n      fn.apply(element, event.concat(eventData));\n    });\n  }\n}, function(fn, name){\n  /**\n   * chaining functions\n   */\n  JQLite.prototype[name] = function(arg1, arg2, arg3) {\n    var value;\n    for(var i=0; i < this.length; i++) {\n      if (isUndefined(value)) {\n        value = fn(this[i], arg1, arg2, arg3);\n        if (isDefined(value)) {\n          // any function which returns a value needs to be wrapped\n          value = jqLite(value);\n        }\n      } else {\n        jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));\n      }\n    }\n    return isDefined(value) ? value : this;\n  };\n\n  // bind legacy bind/unbind to on/off\n  JQLite.prototype.bind = JQLite.prototype.on;\n  JQLite.prototype.unbind = JQLite.prototype.off;\n});\n\n/**\n * Computes a hash of an 'obj'.\n * Hash of a:\n *  string is string\n *  number is number as string\n *  object is either result of calling $$hashKey function on the object or uniquely generated id,\n *         that is also assigned to the $$hashKey property of the object.\n *\n * @param obj\n * @returns {string} hash string such that the same input will have the same hash string.\n *         The resulting string key is in 'type:hashKey' format.\n */\nfunction hashKey(obj) {\n  var objType = typeof obj,\n      key;\n\n  if (objType == 'object' && obj !== null) {\n    if (typeof (key = obj.$$hashKey) == 'function') {\n      // must invoke on object to keep the right this\n      key = obj.$$hashKey();\n    } else if (key === undefined) {\n      key = obj.$$hashKey = nextUid();\n    }\n  } else {\n    key = obj;\n  }\n\n  return objType + ':' + key;\n}\n\n/**\n * HashMap which can use objects as keys\n */\nfunction HashMap(array){\n  forEach(array, this.put, this);\n}\nHashMap.prototype = {\n  /**\n   * Store key value pair\n   * @param key key to store can be any type\n   * @param value value to store can be any type\n   */\n  put: function(key, value) {\n    this[hashKey(key)] = value;\n  },\n\n  /**\n   * @param key\n   * @returns {Object} the value for the key\n   */\n  get: function(key) {\n    return this[hashKey(key)];\n  },\n\n  /**\n   * Remove the key/value pair\n   * @param key\n   */\n  remove: function(key) {\n    var value = this[key = hashKey(key)];\n    delete this[key];\n    return value;\n  }\n};\n\n/**\n * @ngdoc function\n * @module ng\n * @name angular.injector\n * @kind function\n *\n * @description\n * Creates an injector function that can be used for retrieving services as well as for\n * dependency injection (see {@link guide/di dependency injection}).\n *\n\n * @param {Array.<string|Function>} modules A list of module functions or their aliases. See\n *        {@link angular.module}. The `ng` module must be explicitly added.\n * @returns {function()} Injector function. See {@link auto.$injector $injector}.\n *\n * @example\n * Typical usage\n * ```js\n *   // create an injector\n *   var $injector = angular.injector(['ng']);\n *\n *   // use the injector to kick off your application\n *   // use the type inference to auto inject arguments, or use implicit injection\n *   $injector.invoke(function($rootScope, $compile, $document){\n *     $compile($document)($rootScope);\n *     $rootScope.$digest();\n *   });\n * ```\n *\n * Sometimes you want to get access to the injector of a currently running Angular app\n * from outside Angular. Perhaps, you want to inject and compile some markup after the\n * application has been bootstrapped. You can do this using the extra `injector()` added\n * to JQuery/jqLite elements. See {@link angular.element}.\n *\n * *This is fairly rare but could be the case if a third party library is injecting the\n * markup.*\n *\n * In the following example a new block of HTML containing a `ng-controller`\n * directive is added to the end of the document body by JQuery. We then compile and link\n * it into the current AngularJS scope.\n *\n * ```js\n * var $div = $('<div ng-controller=\"MyCtrl\">{{content.label}}</div>');\n * $(document.body).append($div);\n *\n * angular.element(document).injector().invoke(function($compile) {\n *   var scope = angular.element($div).scope();\n *   $compile($div)(scope);\n * });\n * ```\n */\n\n\n/**\n * @ngdoc module\n * @name auto\n * @description\n *\n * Implicit module which gets automatically added to each {@link auto.$injector $injector}.\n */\n\nvar FN_ARGS = /^function\\s*[^\\(]*\\(\\s*([^\\)]*)\\)/m;\nvar FN_ARG_SPLIT = /,/;\nvar FN_ARG = /^\\s*(_?)(\\S+?)\\1\\s*$/;\nvar STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nvar $injectorMinErr = minErr('$injector');\nfunction annotate(fn) {\n  var $inject,\n      fnText,\n      argDecl,\n      last;\n\n  if (typeof fn == 'function') {\n    if (!($inject = fn.$inject)) {\n      $inject = [];\n      if (fn.length) {\n        fnText = fn.toString().replace(STRIP_COMMENTS, '');\n        argDecl = fnText.match(FN_ARGS);\n        forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){\n          arg.replace(FN_ARG, function(all, underscore, name){\n            $inject.push(name);\n          });\n        });\n      }\n      fn.$inject = $inject;\n    }\n  } else if (isArray(fn)) {\n    last = fn.length - 1;\n    assertArgFn(fn[last], 'fn');\n    $inject = fn.slice(0, last);\n  } else {\n    assertArgFn(fn, 'fn', true);\n  }\n  return $inject;\n}\n\n///////////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $injector\n * @kind function\n *\n * @description\n *\n * `$injector` is used to retrieve object instances as defined by\n * {@link auto.$provide provider}, instantiate types, invoke methods,\n * and load modules.\n *\n * The following always holds true:\n *\n * ```js\n *   var $injector = angular.injector();\n *   expect($injector.get('$injector')).toBe($injector);\n *   expect($injector.invoke(function($injector){\n *     return $injector;\n *   }).toBe($injector);\n * ```\n *\n * # Injection Function Annotation\n *\n * JavaScript does not have annotations, and annotations are needed for dependency injection. The\n * following are all valid ways of annotating function with injection arguments and are equivalent.\n *\n * ```js\n *   // inferred (only works if code not minified/obfuscated)\n *   $injector.invoke(function(serviceA){});\n *\n *   // annotated\n *   function explicit(serviceA) {};\n *   explicit.$inject = ['serviceA'];\n *   $injector.invoke(explicit);\n *\n *   // inline\n *   $injector.invoke(['serviceA', function(serviceA){}]);\n * ```\n *\n * ## Inference\n *\n * In JavaScript calling `toString()` on a function returns the function definition. The definition\n * can then be parsed and the function arguments can be extracted. *NOTE:* This does not work with\n * minification, and obfuscation tools since these tools change the argument names.\n *\n * ## `$inject` Annotation\n * By adding an `$inject` property onto a function the injection parameters can be specified.\n *\n * ## Inline\n * As an array of injection names, where the last item in the array is the function to call.\n */\n\n/**\n * @ngdoc method\n * @name $injector#get\n *\n * @description\n * Return an instance of the service.\n *\n * @param {string} name The name of the instance to retrieve.\n * @return {*} The instance.\n */\n\n/**\n * @ngdoc method\n * @name $injector#invoke\n *\n * @description\n * Invoke the method and supply the method arguments from the `$injector`.\n *\n * @param {!Function} fn The function to invoke. Function parameters are injected according to the\n *   {@link guide/di $inject Annotation} rules.\n * @param {Object=} self The `this` for the invoked method.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n *                         object first, before the `$injector` is consulted.\n * @returns {*} the value returned by the invoked `fn` function.\n */\n\n/**\n * @ngdoc method\n * @name $injector#has\n *\n * @description\n * Allows the user to query if the particular service exists.\n *\n * @param {string} Name of the service to query.\n * @returns {boolean} returns true if injector has given service.\n */\n\n/**\n * @ngdoc method\n * @name $injector#instantiate\n * @description\n * Create a new instance of JS type. The method takes a constructor function, invokes the new\n * operator, and supplies all of the arguments to the constructor function as specified by the\n * constructor annotation.\n *\n * @param {Function} Type Annotated constructor function.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n * object first, before the `$injector` is consulted.\n * @returns {Object} new instance of `Type`.\n */\n\n/**\n * @ngdoc method\n * @name $injector#annotate\n *\n * @description\n * Returns an array of service names which the function is requesting for injection. This API is\n * used by the injector to determine which services need to be injected into the function when the\n * function is invoked. There are three ways in which the function can be annotated with the needed\n * dependencies.\n *\n * # Argument names\n *\n * The simplest form is to extract the dependencies from the arguments of the function. This is done\n * by converting the function into a string using `toString()` method and extracting the argument\n * names.\n * ```js\n *   // Given\n *   function MyController($scope, $route) {\n *     // ...\n *   }\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * This method does not work with code minification / obfuscation. For this reason the following\n * annotation strategies are supported.\n *\n * # The `$inject` property\n *\n * If a function has an `$inject` property and its value is an array of strings, then the strings\n * represent names of services to be injected into the function.\n * ```js\n *   // Given\n *   var MyController = function(obfuscatedScope, obfuscatedRoute) {\n *     // ...\n *   }\n *   // Define function dependencies\n *   MyController['$inject'] = ['$scope', '$route'];\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * # The array notation\n *\n * It is often desirable to inline Injected functions and that's when setting the `$inject` property\n * is very inconvenient. In these situations using the array notation to specify the dependencies in\n * a way that survives minification is a better choice:\n *\n * ```js\n *   // We wish to write this (not minification / obfuscation safe)\n *   injector.invoke(function($compile, $rootScope) {\n *     // ...\n *   });\n *\n *   // We are forced to write break inlining\n *   var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {\n *     // ...\n *   };\n *   tmpFn.$inject = ['$compile', '$rootScope'];\n *   injector.invoke(tmpFn);\n *\n *   // To better support inline function the inline annotation is supported\n *   injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {\n *     // ...\n *   }]);\n *\n *   // Therefore\n *   expect(injector.annotate(\n *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])\n *    ).toEqual(['$compile', '$rootScope']);\n * ```\n *\n * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to\n * be retrieved as described above.\n *\n * @returns {Array.<string>} The names of the services which the function requires.\n */\n\n\n\n\n/**\n * @ngdoc object\n * @name $provide\n *\n * @description\n *\n * The {@link auto.$provide $provide} service has a number of methods for registering components\n * with the {@link auto.$injector $injector}. Many of these functions are also exposed on\n * {@link angular.Module}.\n *\n * An Angular **service** is a singleton object created by a **service factory**.  These **service\n * factories** are functions which, in turn, are created by a **service provider**.\n * The **service providers** are constructor functions. When instantiated they must contain a\n * property called `$get`, which holds the **service factory** function.\n *\n * When you request a service, the {@link auto.$injector $injector} is responsible for finding the\n * correct **service provider**, instantiating it and then calling its `$get` **service factory**\n * function to get the instance of the **service**.\n *\n * Often services have no configuration options and there is no need to add methods to the service\n * provider.  The provider will be no more than a constructor function with a `$get` property. For\n * these cases the {@link auto.$provide $provide} service has additional helper methods to register\n * services without specifying a provider.\n *\n * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the\n *     {@link auto.$injector $injector}\n * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by\n *     providers and services.\n * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by\n *     services, not providers.\n * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,\n *     that will be wrapped in a **service provider** object, whose `$get` property will contain the\n *     given factory function.\n * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`\n *     that will be wrapped in a **service provider** object, whose `$get` property will instantiate\n *      a new object using the given constructor function.\n *\n * See the individual methods for more information and examples.\n */\n\n/**\n * @ngdoc method\n * @name $provide#provider\n * @description\n *\n * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions\n * are constructor functions, whose instances are responsible for \"providing\" a factory for a\n * service.\n *\n * Service provider names start with the name of the service they provide followed by `Provider`.\n * For example, the {@link ng.$log $log} service has a provider called\n * {@link ng.$logProvider $logProvider}.\n *\n * Service provider objects can have additional methods which allow configuration of the provider\n * and its service. Importantly, you can configure what kind of service is created by the `$get`\n * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a\n * method {@link ng.$logProvider#debugEnabled debugEnabled}\n * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the\n * console or not.\n *\n * @param {string} name The name of the instance. NOTE: the provider will be available under `name +\n                        'Provider'` key.\n * @param {(Object|function())} provider If the provider is:\n *\n *   - `Object`: then it should have a `$get` method. The `$get` method will be invoked using\n *     {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.\n *   - `Constructor`: a new instance of the provider will be created using\n *     {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.\n *\n * @returns {Object} registered provider instance\n\n * @example\n *\n * The following example shows how to create a simple event tracking service and register it using\n * {@link auto.$provide#provider $provide.provider()}.\n *\n * ```js\n *  // Define the eventTracker provider\n *  function EventTrackerProvider() {\n *    var trackingUrl = '/track';\n *\n *    // A provider method for configuring where the tracked events should been saved\n *    this.setTrackingUrl = function(url) {\n *      trackingUrl = url;\n *    };\n *\n *    // The service factory function\n *    this.$get = ['$http', function($http) {\n *      var trackedEvents = {};\n *      return {\n *        // Call this to track an event\n *        event: function(event) {\n *          var count = trackedEvents[event] || 0;\n *          count += 1;\n *          trackedEvents[event] = count;\n *          return count;\n *        },\n *        // Call this to save the tracked events to the trackingUrl\n *        save: function() {\n *          $http.post(trackingUrl, trackedEvents);\n *        }\n *      };\n *    }];\n *  }\n *\n *  describe('eventTracker', function() {\n *    var postSpy;\n *\n *    beforeEach(module(function($provide) {\n *      // Register the eventTracker provider\n *      $provide.provider('eventTracker', EventTrackerProvider);\n *    }));\n *\n *    beforeEach(module(function(eventTrackerProvider) {\n *      // Configure eventTracker provider\n *      eventTrackerProvider.setTrackingUrl('/custom-track');\n *    }));\n *\n *    it('tracks events', inject(function(eventTracker) {\n *      expect(eventTracker.event('login')).toEqual(1);\n *      expect(eventTracker.event('login')).toEqual(2);\n *    }));\n *\n *    it('saves to the tracking url', inject(function(eventTracker, $http) {\n *      postSpy = spyOn($http, 'post');\n *      eventTracker.event('login');\n *      eventTracker.save();\n *      expect(postSpy).toHaveBeenCalled();\n *      expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');\n *      expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');\n *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });\n *    }));\n *  });\n * ```\n */\n\n/**\n * @ngdoc method\n * @name $provide#factory\n * @description\n *\n * Register a **service factory**, which will be called to return the service instance.\n * This is short for registering a service where its provider consists of only a `$get` property,\n * which is the given service factory function.\n * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to\n * configure your service in a provider.\n *\n * @param {string} name The name of the instance.\n * @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand\n *                            for `$provide.provider(name, {$get: $getFn})`.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service\n * ```js\n *   $provide.factory('ping', ['$http', function($http) {\n *     return function ping() {\n *       return $http.send('/ping');\n *     };\n *   }]);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#service\n * @description\n *\n * Register a **service constructor**, which will be invoked with `new` to create the service\n * instance.\n * This is short for registering a service where its provider's `$get` property is the service\n * constructor function that will be used to instantiate the service instance.\n *\n * You should use {@link auto.$provide#service $provide.service(class)} if you define your service\n * as a type/class.\n *\n * @param {string} name The name of the instance.\n * @param {Function} constructor A class (constructor function) that will be instantiated.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service using\n * {@link auto.$provide#service $provide.service(class)}.\n * ```js\n *   var Ping = function($http) {\n *     this.$http = $http;\n *   };\n *\n *   Ping.$inject = ['$http'];\n *\n *   Ping.prototype.send = function() {\n *     return this.$http.get('/ping');\n *   };\n *   $provide.service('ping', Ping);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping.send();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#value\n * @description\n *\n * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a\n * number, an array, an object or a function.  This is short for registering a service where its\n * provider's `$get` property is a factory function that takes no arguments and returns the **value\n * service**.\n *\n * Value services are similar to constant services, except that they cannot be injected into a\n * module configuration function (see {@link angular.Module#config}) but they can be overridden by\n * an Angular\n * {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the instance.\n * @param {*} value The value.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here are some examples of creating value services.\n * ```js\n *   $provide.value('ADMIN_USER', 'admin');\n *\n *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });\n *\n *   $provide.value('halfOf', function(value) {\n *     return value / 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#constant\n * @description\n *\n * Register a **constant service**, such as a string, a number, an array, an object or a function,\n * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be\n * injected into a module configuration function (see {@link angular.Module#config}) and it cannot\n * be overridden by an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the constant.\n * @param {*} value The constant value.\n * @returns {Object} registered instance\n *\n * @example\n * Here a some examples of creating constants:\n * ```js\n *   $provide.constant('SHARD_HEIGHT', 306);\n *\n *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);\n *\n *   $provide.constant('double', function(value) {\n *     return value * 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#decorator\n * @description\n *\n * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator\n * intercepts the creation of a service, allowing it to override or modify the behaviour of the\n * service. The object returned by the decorator may be the original service, or a new service\n * object which replaces or wraps and delegates to the original service.\n *\n * @param {string} name The name of the service to decorate.\n * @param {function()} decorator This function will be invoked when the service needs to be\n *    instantiated and should return the decorated service instance. The function is called using\n *    the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.\n *    Local injection arguments:\n *\n *    * `$delegate` - The original service instance, which can be monkey patched, configured,\n *      decorated or delegated to.\n *\n * @example\n * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting\n * calls to {@link ng.$log#error $log.warn()}.\n * ```js\n *   $provide.decorator('$log', ['$delegate', function($delegate) {\n *     $delegate.warn = $delegate.error;\n *     return $delegate;\n *   }]);\n * ```\n */\n\n\nfunction createInjector(modulesToLoad) {\n  var INSTANTIATING = {},\n      providerSuffix = 'Provider',\n      path = [],\n      loadedModules = new HashMap(),\n      providerCache = {\n        $provide: {\n            provider: supportObject(provider),\n            factory: supportObject(factory),\n            service: supportObject(service),\n            value: supportObject(value),\n            constant: supportObject(constant),\n            decorator: decorator\n          }\n      },\n      providerInjector = (providerCache.$injector =\n          createInternalInjector(providerCache, function() {\n            throw $injectorMinErr('unpr', \"Unknown provider: {0}\", path.join(' <- '));\n          })),\n      instanceCache = {},\n      instanceInjector = (instanceCache.$injector =\n          createInternalInjector(instanceCache, function(servicename) {\n            var provider = providerInjector.get(servicename + providerSuffix);\n            return instanceInjector.invoke(provider.$get, provider);\n          }));\n\n\n  forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); });\n\n  return instanceInjector;\n\n  ////////////////////////////////////\n  // $provider\n  ////////////////////////////////////\n\n  function supportObject(delegate) {\n    return function(key, value) {\n      if (isObject(key)) {\n        forEach(key, reverseParams(delegate));\n      } else {\n        return delegate(key, value);\n      }\n    };\n  }\n\n  function provider(name, provider_) {\n    assertNotHasOwnProperty(name, 'service');\n    if (isFunction(provider_) || isArray(provider_)) {\n      provider_ = providerInjector.instantiate(provider_);\n    }\n    if (!provider_.$get) {\n      throw $injectorMinErr('pget', \"Provider '{0}' must define $get factory method.\", name);\n    }\n    return providerCache[name + providerSuffix] = provider_;\n  }\n\n  function factory(name, factoryFn) { return provider(name, { $get: factoryFn }); }\n\n  function service(name, constructor) {\n    return factory(name, ['$injector', function($injector) {\n      return $injector.instantiate(constructor);\n    }]);\n  }\n\n  function value(name, val) { return factory(name, valueFn(val)); }\n\n  function constant(name, value) {\n    assertNotHasOwnProperty(name, 'constant');\n    providerCache[name] = value;\n    instanceCache[name] = value;\n  }\n\n  function decorator(serviceName, decorFn) {\n    var origProvider = providerInjector.get(serviceName + providerSuffix),\n        orig$get = origProvider.$get;\n\n    origProvider.$get = function() {\n      var origInstance = instanceInjector.invoke(orig$get, origProvider);\n      return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});\n    };\n  }\n\n  ////////////////////////////////////\n  // Module Loading\n  ////////////////////////////////////\n  function loadModules(modulesToLoad){\n    var runBlocks = [], moduleFn, invokeQueue, i, ii;\n    forEach(modulesToLoad, function(module) {\n      if (loadedModules.get(module)) return;\n      loadedModules.put(module, true);\n\n      try {\n        if (isString(module)) {\n          moduleFn = angularModule(module);\n          runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);\n\n          for(invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {\n            var invokeArgs = invokeQueue[i],\n                provider = providerInjector.get(invokeArgs[0]);\n\n            provider[invokeArgs[1]].apply(provider, invokeArgs[2]);\n          }\n        } else if (isFunction(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else if (isArray(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else {\n          assertArgFn(module, 'module');\n        }\n      } catch (e) {\n        if (isArray(module)) {\n          module = module[module.length - 1];\n        }\n        if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {\n          // Safari & FF's stack traces don't contain error.message content\n          // unlike those of Chrome and IE\n          // So if stack doesn't contain message, we create a new string that contains both.\n          // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.\n          /* jshint -W022 */\n          e = e.message + '\\n' + e.stack;\n        }\n        throw $injectorMinErr('modulerr', \"Failed to instantiate module {0} due to:\\n{1}\",\n                  module, e.stack || e.message || e);\n      }\n    });\n    return runBlocks;\n  }\n\n  ////////////////////////////////////\n  // internal Injector\n  ////////////////////////////////////\n\n  function createInternalInjector(cache, factory) {\n\n    function getService(serviceName) {\n      if (cache.hasOwnProperty(serviceName)) {\n        if (cache[serviceName] === INSTANTIATING) {\n          throw $injectorMinErr('cdep', 'Circular dependency found: {0}', path.join(' <- '));\n        }\n        return cache[serviceName];\n      } else {\n        try {\n          path.unshift(serviceName);\n          cache[serviceName] = INSTANTIATING;\n          return cache[serviceName] = factory(serviceName);\n        } catch (err) {\n          if (cache[serviceName] === INSTANTIATING) {\n            delete cache[serviceName];\n          }\n          throw err;\n        } finally {\n          path.shift();\n        }\n      }\n    }\n\n    function invoke(fn, self, locals){\n      var args = [],\n          $inject = annotate(fn),\n          length, i,\n          key;\n\n      for(i = 0, length = $inject.length; i < length; i++) {\n        key = $inject[i];\n        if (typeof key !== 'string') {\n          throw $injectorMinErr('itkn',\n                  'Incorrect injection token! Expected service name as string, got {0}', key);\n        }\n        args.push(\n          locals && locals.hasOwnProperty(key)\n          ? locals[key]\n          : getService(key)\n        );\n      }\n      if (!fn.$inject) {\n        // this means that we must be an array.\n        fn = fn[length];\n      }\n\n      // http://jsperf.com/angularjs-invoke-apply-vs-switch\n      // #5388\n      return fn.apply(self, args);\n    }\n\n    function instantiate(Type, locals) {\n      var Constructor = function() {},\n          instance, returnedValue;\n\n      // Check if Type is annotated and use just the given function at n-1 as parameter\n      // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);\n      Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;\n      instance = new Constructor();\n      returnedValue = invoke(Type, instance, locals);\n\n      return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance;\n    }\n\n    return {\n      invoke: invoke,\n      instantiate: instantiate,\n      get: getService,\n      annotate: annotate,\n      has: function(name) {\n        return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);\n      }\n    };\n  }\n}\n\n/**\n * @ngdoc service\n * @name $anchorScroll\n * @kind function\n * @requires $window\n * @requires $location\n * @requires $rootScope\n *\n * @description\n * When called, it checks current value of `$location.hash()` and scrolls to the related element,\n * according to rules specified in\n * [Html5 spec](http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document).\n *\n * It also watches the `$location.hash()` and scrolls whenever it changes to match any anchor.\n * This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <div id=\"scrollArea\" ng-controller=\"ScrollCtrl\">\n         <a ng-click=\"gotoBottom()\">Go to bottom</a>\n         <a id=\"bottom\"></a> You're at the bottom!\n       </div>\n     </file>\n     <file name=\"script.js\">\n       function ScrollCtrl($scope, $location, $anchorScroll) {\n         $scope.gotoBottom = function (){\n           // set the location.hash to the id of\n           // the element you wish to scroll to.\n           $location.hash('bottom');\n\n           // call $anchorScroll()\n           $anchorScroll();\n         };\n       }\n     </file>\n     <file name=\"style.css\">\n       #scrollArea {\n         height: 350px;\n         overflow: auto;\n       }\n\n       #bottom {\n         display: block;\n         margin-top: 2000px;\n       }\n     </file>\n   </example>\n */\nfunction $AnchorScrollProvider() {\n\n  var autoScrollingEnabled = true;\n\n  this.disableAutoScrolling = function() {\n    autoScrollingEnabled = false;\n  };\n\n  this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {\n    var document = $window.document;\n\n    // helper function to get first anchor from a NodeList\n    // can't use filter.filter, as it accepts only instances of Array\n    // and IE can't convert NodeList to an array using [].slice\n    // TODO(vojta): use filter if we change it to accept lists as well\n    function getFirstAnchor(list) {\n      var result = null;\n      forEach(list, function(element) {\n        if (!result && lowercase(element.nodeName) === 'a') result = element;\n      });\n      return result;\n    }\n\n    function scroll() {\n      var hash = $location.hash(), elm;\n\n      // empty hash, scroll to the top of the page\n      if (!hash) $window.scrollTo(0, 0);\n\n      // element with given id\n      else if ((elm = document.getElementById(hash))) elm.scrollIntoView();\n\n      // first anchor with given name :-D\n      else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();\n\n      // no element and hash == 'top', scroll to the top of the page\n      else if (hash === 'top') $window.scrollTo(0, 0);\n    }\n\n    // does not scroll when user clicks on anchor link that is currently on\n    // (no url change, no $location.hash() change), browser native does scroll\n    if (autoScrollingEnabled) {\n      $rootScope.$watch(function autoScrollWatch() {return $location.hash();},\n        function autoScrollWatchAction() {\n          $rootScope.$evalAsync(scroll);\n        });\n    }\n\n    return scroll;\n  }];\n}\n\nvar $animateMinErr = minErr('$animate');\n\n/**\n * @ngdoc provider\n * @name $animateProvider\n *\n * @description\n * Default implementation of $animate that doesn't perform any animations, instead just\n * synchronously performs DOM\n * updates and calls done() callbacks.\n *\n * In order to enable animations the ngAnimate module has to be loaded.\n *\n * To see the functional implementation check out src/ngAnimate/animate.js\n */\nvar $AnimateProvider = ['$provide', function($provide) {\n\n\n  this.$$selectors = {};\n\n\n  /**\n   * @ngdoc method\n   * @name $animateProvider#register\n   *\n   * @description\n   * Registers a new injectable animation factory function. The factory function produces the\n   * animation object which contains callback functions for each event that is expected to be\n   * animated.\n   *\n   *   * `eventFn`: `function(Element, doneFunction)` The element to animate, the `doneFunction`\n   *   must be called once the element animation is complete. If a function is returned then the\n   *   animation service will use this function to cancel the animation whenever a cancel event is\n   *   triggered.\n   *\n   *\n   * ```js\n   *   return {\n     *     eventFn : function(element, done) {\n     *       //code to run the animation\n     *       //once complete, then run done()\n     *       return function cancellationFunction() {\n     *         //code to cancel the animation\n     *       }\n     *     }\n     *   }\n   * ```\n   *\n   * @param {string} name The name of the animation.\n   * @param {Function} factory The factory function that will be executed to return the animation\n   *                           object.\n   */\n  this.register = function(name, factory) {\n    var key = name + '-animation';\n    if (name && name.charAt(0) != '.') throw $animateMinErr('notcsel',\n        \"Expecting class selector starting with '.' got '{0}'.\", name);\n    this.$$selectors[name.substr(1)] = key;\n    $provide.factory(key, factory);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $animateProvider#classNameFilter\n   *\n   * @description\n   * Sets and/or returns the CSS class regular expression that is checked when performing\n   * an animation. Upon bootstrap the classNameFilter value is not set at all and will\n   * therefore enable $animate to attempt to perform an animation on any element.\n   * When setting the classNameFilter value, animations will only be performed on elements\n   * that successfully match the filter expression. This in turn can boost performance\n   * for low-powered devices as well as applications containing a lot of structural operations.\n   * @param {RegExp=} expression The className expression which will be checked against all animations\n   * @return {RegExp} The current CSS className expression value. If null then there is no expression value\n   */\n  this.classNameFilter = function(expression) {\n    if(arguments.length === 1) {\n      this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;\n    }\n    return this.$$classNameFilter;\n  };\n\n  this.$get = ['$timeout', '$$asyncCallback', function($timeout, $$asyncCallback) {\n\n    function async(fn) {\n      fn && $$asyncCallback(fn);\n    }\n\n    /**\n     *\n     * @ngdoc service\n     * @name $animate\n     * @description The $animate service provides rudimentary DOM manipulation functions to\n     * insert, remove and move elements within the DOM, as well as adding and removing classes.\n     * This service is the core service used by the ngAnimate $animator service which provides\n     * high-level animation hooks for CSS and JavaScript.\n     *\n     * $animate is available in the AngularJS core, however, the ngAnimate module must be included\n     * to enable full out animation support. Otherwise, $animate will only perform simple DOM\n     * manipulation operations.\n     *\n     * To learn more about enabling animation support, click here to visit the {@link ngAnimate\n     * ngAnimate module page} as well as the {@link ngAnimate.$animate ngAnimate $animate service\n     * page}.\n     */\n    return {\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#enter\n       * @kind function\n       * @description Inserts the element into the DOM either after the `after` element or within\n       *   the `parent` element. Once complete, the done() callback will be fired (if provided).\n       * @param {DOMElement} element the element which will be inserted into the DOM\n       * @param {DOMElement} parent the parent element which will append the element as\n       *   a child (if the after element is not present)\n       * @param {DOMElement} after the sibling element which will append the element\n       *   after itself\n       * @param {Function=} done callback function that will be called after the element has been\n       *   inserted into the DOM\n       */\n      enter : function(element, parent, after, done) {\n        if (after) {\n          after.after(element);\n        } else {\n          if (!parent || !parent[0]) {\n            parent = after.parent();\n          }\n          parent.append(element);\n        }\n        async(done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#leave\n       * @kind function\n       * @description Removes the element from the DOM. Once complete, the done() callback will be\n       *   fired (if provided).\n       * @param {DOMElement} element the element which will be removed from the DOM\n       * @param {Function=} done callback function that will be called after the element has been\n       *   removed from the DOM\n       */\n      leave : function(element, done) {\n        element.remove();\n        async(done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#move\n       * @kind function\n       * @description Moves the position of the provided element within the DOM to be placed\n       * either after the `after` element or inside of the `parent` element. Once complete, the\n       * done() callback will be fired (if provided).\n       *\n       * @param {DOMElement} element the element which will be moved around within the\n       *   DOM\n       * @param {DOMElement} parent the parent element where the element will be\n       *   inserted into (if the after element is not present)\n       * @param {DOMElement} after the sibling element where the element will be\n       *   positioned next to\n       * @param {Function=} done the callback function (if provided) that will be fired after the\n       *   element has been moved to its new position\n       */\n      move : function(element, parent, after, done) {\n        // Do not remove element before insert. Removing will cause data associated with the\n        // element to be dropped. Insert will implicitly do the remove.\n        this.enter(element, parent, after, done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#addClass\n       * @kind function\n       * @description Adds the provided className CSS class value to the provided element. Once\n       * complete, the done() callback will be fired (if provided).\n       * @param {DOMElement} element the element which will have the className value\n       *   added to it\n       * @param {string} className the CSS class which will be added to the element\n       * @param {Function=} done the callback function (if provided) that will be fired after the\n       *   className value has been added to the element\n       */\n      addClass : function(element, className, done) {\n        className = isString(className) ?\n                      className :\n                      isArray(className) ? className.join(' ') : '';\n        forEach(element, function (element) {\n          jqLiteAddClass(element, className);\n        });\n        async(done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#removeClass\n       * @kind function\n       * @description Removes the provided className CSS class value from the provided element.\n       * Once complete, the done() callback will be fired (if provided).\n       * @param {DOMElement} element the element which will have the className value\n       *   removed from it\n       * @param {string} className the CSS class which will be removed from the element\n       * @param {Function=} done the callback function (if provided) that will be fired after the\n       *   className value has been removed from the element\n       */\n      removeClass : function(element, className, done) {\n        className = isString(className) ?\n                      className :\n                      isArray(className) ? className.join(' ') : '';\n        forEach(element, function (element) {\n          jqLiteRemoveClass(element, className);\n        });\n        async(done);\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#setClass\n       * @kind function\n       * @description Adds and/or removes the given CSS classes to and from the element.\n       * Once complete, the done() callback will be fired (if provided).\n       * @param {DOMElement} element the element which will have its CSS classes changed\n       *   removed from it\n       * @param {string} add the CSS classes which will be added to the element\n       * @param {string} remove the CSS class which will be removed from the element\n       * @param {Function=} done the callback function (if provided) that will be fired after the\n       *   CSS classes have been set on the element\n       */\n      setClass : function(element, add, remove, done) {\n        forEach(element, function (element) {\n          jqLiteAddClass(element, add);\n          jqLiteRemoveClass(element, remove);\n        });\n        async(done);\n      },\n\n      enabled : noop\n    };\n  }];\n}];\n\nfunction $$AsyncCallbackProvider(){\n  this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) {\n    return $$rAF.supported\n      ? function(fn) { return $$rAF(fn); }\n      : function(fn) {\n        return $timeout(fn, 0, false);\n      };\n  }];\n}\n\n/**\n * ! This is a private undocumented service !\n *\n * @name $browser\n * @requires $log\n * @description\n * This object has two goals:\n *\n * - hide all the global state in the browser caused by the window object\n * - abstract away all the browser specific features and inconsistencies\n *\n * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`\n * service, which can be used for convenient testing of the application without the interaction with\n * the real browser apis.\n */\n/**\n * @param {object} window The global window object.\n * @param {object} document jQuery wrapped document.\n * @param {function()} XHR XMLHttpRequest constructor.\n * @param {object} $log console.log or an object with the same interface.\n * @param {object} $sniffer $sniffer service\n */\nfunction Browser(window, document, $log, $sniffer) {\n  var self = this,\n      rawDocument = document[0],\n      location = window.location,\n      history = window.history,\n      setTimeout = window.setTimeout,\n      clearTimeout = window.clearTimeout,\n      pendingDeferIds = {};\n\n  self.isMock = false;\n\n  var outstandingRequestCount = 0;\n  var outstandingRequestCallbacks = [];\n\n  // TODO(vojta): remove this temporary api\n  self.$$completeOutstandingRequest = completeOutstandingRequest;\n  self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };\n\n  /**\n   * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`\n   * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.\n   */\n  function completeOutstandingRequest(fn) {\n    try {\n      fn.apply(null, sliceArgs(arguments, 1));\n    } finally {\n      outstandingRequestCount--;\n      if (outstandingRequestCount === 0) {\n        while(outstandingRequestCallbacks.length) {\n          try {\n            outstandingRequestCallbacks.pop()();\n          } catch (e) {\n            $log.error(e);\n          }\n        }\n      }\n    }\n  }\n\n  /**\n   * @private\n   * Note: this method is used only by scenario runner\n   * TODO(vojta): prefix this method with $$ ?\n   * @param {function()} callback Function that will be called when no outstanding request\n   */\n  self.notifyWhenNoOutstandingRequests = function(callback) {\n    // force browser to execute all pollFns - this is needed so that cookies and other pollers fire\n    // at some deterministic time in respect to the test runner's actions. Leaving things up to the\n    // regular poller would result in flaky tests.\n    forEach(pollFns, function(pollFn){ pollFn(); });\n\n    if (outstandingRequestCount === 0) {\n      callback();\n    } else {\n      outstandingRequestCallbacks.push(callback);\n    }\n  };\n\n  //////////////////////////////////////////////////////////////\n  // Poll Watcher API\n  //////////////////////////////////////////////////////////////\n  var pollFns = [],\n      pollTimeout;\n\n  /**\n   * @name $browser#addPollFn\n   *\n   * @param {function()} fn Poll function to add\n   *\n   * @description\n   * Adds a function to the list of functions that poller periodically executes,\n   * and starts polling if not started yet.\n   *\n   * @returns {function()} the added function\n   */\n  self.addPollFn = function(fn) {\n    if (isUndefined(pollTimeout)) startPoller(100, setTimeout);\n    pollFns.push(fn);\n    return fn;\n  };\n\n  /**\n   * @param {number} interval How often should browser call poll functions (ms)\n   * @param {function()} setTimeout Reference to a real or fake `setTimeout` function.\n   *\n   * @description\n   * Configures the poller to run in the specified intervals, using the specified\n   * setTimeout fn and kicks it off.\n   */\n  function startPoller(interval, setTimeout) {\n    (function check() {\n      forEach(pollFns, function(pollFn){ pollFn(); });\n      pollTimeout = setTimeout(check, interval);\n    })();\n  }\n\n  //////////////////////////////////////////////////////////////\n  // URL API\n  //////////////////////////////////////////////////////////////\n\n  var lastBrowserUrl = location.href,\n      baseElement = document.find('base'),\n      newLocation = null;\n\n  /**\n   * @name $browser#url\n   *\n   * @description\n   * GETTER:\n   * Without any argument, this method just returns current value of location.href.\n   *\n   * SETTER:\n   * With at least one argument, this method sets url to new value.\n   * If html5 history api supported, pushState/replaceState is used, otherwise\n   * location.href/location.replace is used.\n   * Returns its own instance to allow chaining\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to change url.\n   *\n   * @param {string} url New url (when used as setter)\n   * @param {boolean=} replace Should new url replace current history record ?\n   */\n  self.url = function(url, replace) {\n    // Android Browser BFCache causes location, history reference to become stale.\n    if (location !== window.location) location = window.location;\n    if (history !== window.history) history = window.history;\n\n    // setter\n    if (url) {\n      if (lastBrowserUrl == url) return;\n      lastBrowserUrl = url;\n      if ($sniffer.history) {\n        if (replace) history.replaceState(null, '', url);\n        else {\n          history.pushState(null, '', url);\n          // Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462\n          baseElement.attr('href', baseElement.attr('href'));\n        }\n      } else {\n        newLocation = url;\n        if (replace) {\n          location.replace(url);\n        } else {\n          location.href = url;\n        }\n      }\n      return self;\n    // getter\n    } else {\n      // - newLocation is a workaround for an IE7-9 issue with location.replace and location.href\n      //   methods not updating location.href synchronously.\n      // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172\n      return newLocation || location.href.replace(/%27/g,\"'\");\n    }\n  };\n\n  var urlChangeListeners = [],\n      urlChangeInit = false;\n\n  function fireUrlChange() {\n    newLocation = null;\n    if (lastBrowserUrl == self.url()) return;\n\n    lastBrowserUrl = self.url();\n    forEach(urlChangeListeners, function(listener) {\n      listener(self.url());\n    });\n  }\n\n  /**\n   * @name $browser#onUrlChange\n   *\n   * @description\n   * Register callback function that will be called, when url changes.\n   *\n   * It's only called when the url is changed from outside of angular:\n   * - user types different url into address bar\n   * - user clicks on history (forward/back) button\n   * - user clicks on a link\n   *\n   * It's not called when url is changed by $browser.url() method\n   *\n   * The listener gets called with new url as parameter.\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to monitor url changes in angular apps.\n   *\n   * @param {function(string)} listener Listener function to be called when url changes.\n   * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.\n   */\n  self.onUrlChange = function(callback) {\n    // TODO(vojta): refactor to use node's syntax for events\n    if (!urlChangeInit) {\n      // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)\n      // don't fire popstate when user change the address bar and don't fire hashchange when url\n      // changed by push/replaceState\n\n      // html5 history api - popstate event\n      if ($sniffer.history) jqLite(window).on('popstate', fireUrlChange);\n      // hashchange event\n      if ($sniffer.hashchange) jqLite(window).on('hashchange', fireUrlChange);\n      // polling\n      else self.addPollFn(fireUrlChange);\n\n      urlChangeInit = true;\n    }\n\n    urlChangeListeners.push(callback);\n    return callback;\n  };\n\n  //////////////////////////////////////////////////////////////\n  // Misc API\n  //////////////////////////////////////////////////////////////\n\n  /**\n   * @name $browser#baseHref\n   *\n   * @description\n   * Returns current <base href>\n   * (always relative - without domain)\n   *\n   * @returns {string} The current base href\n   */\n  self.baseHref = function() {\n    var href = baseElement.attr('href');\n    return href ? href.replace(/^(https?\\:)?\\/\\/[^\\/]*/, '') : '';\n  };\n\n  //////////////////////////////////////////////////////////////\n  // Cookies API\n  //////////////////////////////////////////////////////////////\n  var lastCookies = {};\n  var lastCookieString = '';\n  var cookiePath = self.baseHref();\n\n  /**\n   * @name $browser#cookies\n   *\n   * @param {string=} name Cookie name\n   * @param {string=} value Cookie value\n   *\n   * @description\n   * The cookies method provides a 'private' low level access to browser cookies.\n   * It is not meant to be used directly, use the $cookie service instead.\n   *\n   * The return values vary depending on the arguments that the method was called with as follows:\n   *\n   * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify\n   *   it\n   * - cookies(name, value) -> set name to value, if value is undefined delete the cookie\n   * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that\n   *   way)\n   *\n   * @returns {Object} Hash of all cookies (if called without any parameter)\n   */\n  self.cookies = function(name, value) {\n    /* global escape: false, unescape: false */\n    var cookieLength, cookieArray, cookie, i, index;\n\n    if (name) {\n      if (value === undefined) {\n        rawDocument.cookie = escape(name) + \"=;path=\" + cookiePath +\n                                \";expires=Thu, 01 Jan 1970 00:00:00 GMT\";\n      } else {\n        if (isString(value)) {\n          cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) +\n                                ';path=' + cookiePath).length + 1;\n\n          // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:\n          // - 300 cookies\n          // - 20 cookies per unique domain\n          // - 4096 bytes per cookie\n          if (cookieLength > 4096) {\n            $log.warn(\"Cookie '\"+ name +\n              \"' possibly not set or overflowed because it was too large (\"+\n              cookieLength + \" > 4096 bytes)!\");\n          }\n        }\n      }\n    } else {\n      if (rawDocument.cookie !== lastCookieString) {\n        lastCookieString = rawDocument.cookie;\n        cookieArray = lastCookieString.split(\"; \");\n        lastCookies = {};\n\n        for (i = 0; i < cookieArray.length; i++) {\n          cookie = cookieArray[i];\n          index = cookie.indexOf('=');\n          if (index > 0) { //ignore nameless cookies\n            name = unescape(cookie.substring(0, index));\n            // the first value that is seen for a cookie is the most\n            // specific one.  values for the same cookie name that\n            // follow are for less specific paths.\n            if (lastCookies[name] === undefined) {\n              lastCookies[name] = unescape(cookie.substring(index + 1));\n            }\n          }\n        }\n      }\n      return lastCookies;\n    }\n  };\n\n\n  /**\n   * @name $browser#defer\n   * @param {function()} fn A function, who's execution should be deferred.\n   * @param {number=} [delay=0] of milliseconds to defer the function execution.\n   * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.\n   *\n   * @description\n   * Executes a fn asynchronously via `setTimeout(fn, delay)`.\n   *\n   * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using\n   * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed\n   * via `$browser.defer.flush()`.\n   *\n   */\n  self.defer = function(fn, delay) {\n    var timeoutId;\n    outstandingRequestCount++;\n    timeoutId = setTimeout(function() {\n      delete pendingDeferIds[timeoutId];\n      completeOutstandingRequest(fn);\n    }, delay || 0);\n    pendingDeferIds[timeoutId] = true;\n    return timeoutId;\n  };\n\n\n  /**\n   * @name $browser#defer.cancel\n   *\n   * @description\n   * Cancels a deferred task identified with `deferId`.\n   *\n   * @param {*} deferId Token returned by the `$browser.defer` function.\n   * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n   *                    canceled.\n   */\n  self.defer.cancel = function(deferId) {\n    if (pendingDeferIds[deferId]) {\n      delete pendingDeferIds[deferId];\n      clearTimeout(deferId);\n      completeOutstandingRequest(noop);\n      return true;\n    }\n    return false;\n  };\n\n}\n\nfunction $BrowserProvider(){\n  this.$get = ['$window', '$log', '$sniffer', '$document',\n      function( $window,   $log,   $sniffer,   $document){\n        return new Browser($window, $document, $log, $sniffer);\n      }];\n}\n\n/**\n * @ngdoc service\n * @name $cacheFactory\n *\n * @description\n * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to\n * them.\n *\n * ```js\n *\n *  var cache = $cacheFactory('cacheId');\n *  expect($cacheFactory.get('cacheId')).toBe(cache);\n *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();\n *\n *  cache.put(\"key\", \"value\");\n *  cache.put(\"another key\", \"another value\");\n *\n *  // We've specified no options on creation\n *  expect(cache.info()).toEqual({id: 'cacheId', size: 2});\n *\n * ```\n *\n *\n * @param {string} cacheId Name or id of the newly created cache.\n * @param {object=} options Options object that specifies the cache behavior. Properties:\n *\n *   - `{number=}` `capacity` — turns the cache into LRU cache.\n *\n * @returns {object} Newly created cache object with the following set of methods:\n *\n * - `{object}` `info()` — Returns id, size, and options of cache.\n * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns\n *   it.\n * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.\n * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.\n * - `{void}` `removeAll()` — Removes all cached values.\n * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.\n *\n * @example\n   <example module=\"cacheExampleApp\">\n     <file name=\"index.html\">\n       <div ng-controller=\"CacheController\">\n         <input ng-model=\"newCacheKey\" placeholder=\"Key\">\n         <input ng-model=\"newCacheValue\" placeholder=\"Value\">\n         <button ng-click=\"put(newCacheKey, newCacheValue)\">Cache</button>\n\n         <p ng-if=\"keys.length\">Cached Values</p>\n         <div ng-repeat=\"key in keys\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"cache.get(key)\"></b>\n         </div>\n\n         <p>Cache Info</p>\n         <div ng-repeat=\"(key, value) in cache.info()\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"value\"></b>\n         </div>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('cacheExampleApp', []).\n         controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {\n           $scope.keys = [];\n           $scope.cache = $cacheFactory('cacheId');\n           $scope.put = function(key, value) {\n             $scope.cache.put(key, value);\n             $scope.keys.push(key);\n           };\n         }]);\n     </file>\n     <file name=\"style.css\">\n       p {\n         margin: 10px 0 3px;\n       }\n     </file>\n   </example>\n */\nfunction $CacheFactoryProvider() {\n\n  this.$get = function() {\n    var caches = {};\n\n    function cacheFactory(cacheId, options) {\n      if (cacheId in caches) {\n        throw minErr('$cacheFactory')('iid', \"CacheId '{0}' is already taken!\", cacheId);\n      }\n\n      var size = 0,\n          stats = extend({}, options, {id: cacheId}),\n          data = {},\n          capacity = (options && options.capacity) || Number.MAX_VALUE,\n          lruHash = {},\n          freshEnd = null,\n          staleEnd = null;\n\n      /**\n       * @ngdoc type\n       * @name $cacheFactory.Cache\n       *\n       * @description\n       * A cache object used to store and retrieve data, primarily used by\n       * {@link $http $http} and the {@link ng.directive:script script} directive to cache\n       * templates and other data.\n       *\n       * ```js\n       *  angular.module('superCache')\n       *    .factory('superCache', ['$cacheFactory', function($cacheFactory) {\n       *      return $cacheFactory('super-cache');\n       *    }]);\n       * ```\n       *\n       * Example test:\n       *\n       * ```js\n       *  it('should behave like a cache', inject(function(superCache) {\n       *    superCache.put('key', 'value');\n       *    superCache.put('another key', 'another value');\n       *\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 2\n       *    });\n       *\n       *    superCache.remove('another key');\n       *    expect(superCache.get('another key')).toBeUndefined();\n       *\n       *    superCache.removeAll();\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 0\n       *    });\n       *  }));\n       * ```\n       */\n      return caches[cacheId] = {\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#put\n         * @kind function\n         *\n         * @description\n         * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be\n         * retrieved later, and incrementing the size of the cache if the key was not already\n         * present in the cache. If behaving like an LRU cache, it will also remove stale\n         * entries from the set.\n         *\n         * It will not insert undefined values into the cache.\n         *\n         * @param {string} key the key under which the cached data is stored.\n         * @param {*} value the value to store alongside the key. If it is undefined, the key\n         *    will not be stored.\n         * @returns {*} the value stored.\n         */\n        put: function(key, value) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key] || (lruHash[key] = {key: key});\n\n            refresh(lruEntry);\n          }\n\n          if (isUndefined(value)) return;\n          if (!(key in data)) size++;\n          data[key] = value;\n\n          if (size > capacity) {\n            this.remove(staleEnd.key);\n          }\n\n          return value;\n        },\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#get\n         * @kind function\n         *\n         * @description\n         * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the data to be retrieved\n         * @returns {*} the value stored.\n         */\n        get: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            refresh(lruEntry);\n          }\n\n          return data[key];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#remove\n         * @kind function\n         *\n         * @description\n         * Removes an entry from the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the entry to be removed\n         */\n        remove: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            if (lruEntry == freshEnd) freshEnd = lruEntry.p;\n            if (lruEntry == staleEnd) staleEnd = lruEntry.n;\n            link(lruEntry.n,lruEntry.p);\n\n            delete lruHash[key];\n          }\n\n          delete data[key];\n          size--;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#removeAll\n         * @kind function\n         *\n         * @description\n         * Clears the cache object of any entries.\n         */\n        removeAll: function() {\n          data = {};\n          size = 0;\n          lruHash = {};\n          freshEnd = staleEnd = null;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#destroy\n         * @kind function\n         *\n         * @description\n         * Destroys the {@link $cacheFactory.Cache Cache} object entirely,\n         * removing it from the {@link $cacheFactory $cacheFactory} set.\n         */\n        destroy: function() {\n          data = null;\n          stats = null;\n          lruHash = null;\n          delete caches[cacheId];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#info\n         * @kind function\n         *\n         * @description\n         * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.\n         *\n         * @returns {object} an object with the following properties:\n         *   <ul>\n         *     <li>**id**: the id of the cache instance</li>\n         *     <li>**size**: the number of entries kept in the cache instance</li>\n         *     <li>**...**: any additional properties from the options object when creating the\n         *       cache.</li>\n         *   </ul>\n         */\n        info: function() {\n          return extend({}, stats, {size: size});\n        }\n      };\n\n\n      /**\n       * makes the `entry` the freshEnd of the LRU linked list\n       */\n      function refresh(entry) {\n        if (entry != freshEnd) {\n          if (!staleEnd) {\n            staleEnd = entry;\n          } else if (staleEnd == entry) {\n            staleEnd = entry.n;\n          }\n\n          link(entry.n, entry.p);\n          link(entry, freshEnd);\n          freshEnd = entry;\n          freshEnd.n = null;\n        }\n      }\n\n\n      /**\n       * bidirectionally links two entries of the LRU linked list\n       */\n      function link(nextEntry, prevEntry) {\n        if (nextEntry != prevEntry) {\n          if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify\n          if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify\n        }\n      }\n    }\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#info\n   *\n   * @description\n   * Get information about all the caches that have been created\n   *\n   * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`\n   */\n    cacheFactory.info = function() {\n      var info = {};\n      forEach(caches, function(cache, cacheId) {\n        info[cacheId] = cache.info();\n      });\n      return info;\n    };\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#get\n   *\n   * @description\n   * Get access to a cache object by the `cacheId` used when it was created.\n   *\n   * @param {string} cacheId Name or id of a cache to access.\n   * @returns {object} Cache object identified by the cacheId or undefined if no such cache.\n   */\n    cacheFactory.get = function(cacheId) {\n      return caches[cacheId];\n    };\n\n\n    return cacheFactory;\n  };\n}\n\n/**\n * @ngdoc service\n * @name $templateCache\n *\n * @description\n * The first time a template is used, it is loaded in the template cache for quick retrieval. You\n * can load templates directly into the cache in a `script` tag, or by consuming the\n * `$templateCache` service directly.\n *\n * Adding via the `script` tag:\n *\n * ```html\n *   <script type=\"text/ng-template\" id=\"templateId.html\">\n *     <p>This is the content of the template</p>\n *   </script>\n * ```\n *\n * **Note:** the `script` tag containing the template does not need to be included in the `head` of\n * the document, but it must be below the `ng-app` definition.\n *\n * Adding via the $templateCache service:\n *\n * ```js\n * var myApp = angular.module('myApp', []);\n * myApp.run(function($templateCache) {\n *   $templateCache.put('templateId.html', 'This is the content of the template');\n * });\n * ```\n *\n * To retrieve the template later, simply use it in your HTML:\n * ```html\n * <div ng-include=\" 'templateId.html' \"></div>\n * ```\n *\n * or get it via Javascript:\n * ```js\n * $templateCache.get('templateId.html')\n * ```\n *\n * See {@link ng.$cacheFactory $cacheFactory}.\n *\n */\nfunction $TemplateCacheProvider() {\n  this.$get = ['$cacheFactory', function($cacheFactory) {\n    return $cacheFactory('templates');\n  }];\n}\n\n/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!\n *\n * DOM-related variables:\n *\n * - \"node\" - DOM Node\n * - \"element\" - DOM Element or Node\n * - \"$node\" or \"$element\" - jqLite-wrapped node or element\n *\n *\n * Compiler related stuff:\n *\n * - \"linkFn\" - linking fn of a single directive\n * - \"nodeLinkFn\" - function that aggregates all linking fns for a particular node\n * - \"childLinkFn\" -  function that aggregates all linking fns for child nodes of a particular node\n * - \"compositeLinkFn\" - function that aggregates all linking fns for a compilation root (nodeList)\n */\n\n\n/**\n * @ngdoc service\n * @name $compile\n * @kind function\n *\n * @description\n * Compiles an HTML string or DOM into a template and produces a template function, which\n * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.\n *\n * The compilation is a process of walking the DOM tree and matching DOM elements to\n * {@link ng.$compileProvider#directive directives}.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** This document is an in-depth reference of all directive options.\n * For a gentle introduction to directives with examples of common use cases,\n * see the {@link guide/directive directive guide}.\n * </div>\n *\n * ## Comprehensive Directive API\n *\n * There are many different options for a directive.\n *\n * The difference resides in the return value of the factory function.\n * You can either return a \"Directive Definition Object\" (see below) that defines the directive properties,\n * or just the `postLink` function (all other properties will have the default values).\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's recommended to use the \"directive definition object\" form.\n * </div>\n *\n * Here's an example directive declared with a Directive Definition Object:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       priority: 0,\n *       template: '<div></div>', // or // function(tElement, tAttrs) { ... },\n *       // or\n *       // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },\n *       transclude: false,\n *       restrict: 'A',\n *       scope: false,\n *       controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },\n *       controllerAs: 'stringAlias',\n *       require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],\n *       compile: function compile(tElement, tAttrs, transclude) {\n *         return {\n *           pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *           post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *         }\n *         // or\n *         // return function postLink( ... ) { ... }\n *       },\n *       // or\n *       // link: {\n *       //  pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *       //  post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *       // }\n *       // or\n *       // link: function postLink( ... ) { ... }\n *     };\n *     return directiveDefinitionObject;\n *   });\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Any unspecified options will use the default value. You can see the default values below.\n * </div>\n *\n * Therefore the above can be simplified as:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       link: function postLink(scope, iElement, iAttrs) { ... }\n *     };\n *     return directiveDefinitionObject;\n *     // or\n *     // return function postLink(scope, iElement, iAttrs) { ... }\n *   });\n * ```\n *\n *\n *\n * ### Directive Definition Object\n *\n * The directive definition object provides instructions to the {@link ng.$compile\n * compiler}. The attributes are:\n *\n * #### `priority`\n * When there are multiple directives defined on a single DOM element, sometimes it\n * is necessary to specify the order in which the directives are applied. The `priority` is used\n * to sort the directives before their `compile` functions get called. Priority is defined as a\n * number. Directives with greater numerical `priority` are compiled first. Pre-link functions\n * are also run in priority order, but post-link functions are run in reverse order. The order\n * of directives with the same priority is undefined. The default priority is `0`.\n *\n * #### `terminal`\n * If set to true then the current `priority` will be the last set of directives\n * which will execute (any directives at the current priority will still execute\n * as the order of execution on same `priority` is undefined).\n *\n * #### `scope`\n * **If set to `true`,** then a new scope will be created for this directive. If multiple directives on the\n * same element request a new scope, only one new scope is created. The new scope rule does not\n * apply for the root of the template since the root of the template always gets a new scope.\n *\n * **If set to `{}` (object hash),** then a new \"isolate\" scope is created. The 'isolate' scope differs from\n * normal scope in that it does not prototypically inherit from the parent scope. This is useful\n * when creating reusable components, which should not accidentally read or modify data in the\n * parent scope.\n *\n * The 'isolate' scope takes an object hash which defines a set of local scope properties\n * derived from the parent scope. These local properties are useful for aliasing values for\n * templates. Locals definition is a hash of local scope property to its source:\n *\n * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is\n *   always a string since DOM attributes are strings. If no `attr` name is specified  then the\n *   attribute name is assumed to be the same as the local name.\n *   Given `<widget my-attr=\"hello {{name}}\">` and widget definition\n *   of `scope: { localName:'@myAttr' }`, then widget scope property `localName` will reflect\n *   the interpolated value of `hello {{name}}`. As the `name` attribute changes so will the\n *   `localName` property on the widget scope. The `name` is read from the parent scope (not\n *   component scope).\n *\n * * `=` or `=attr` - set up bi-directional binding between a local scope property and the\n *   parent scope property of name defined via the value of the `attr` attribute. If no `attr`\n *   name is specified then the attribute name is assumed to be the same as the local name.\n *   Given `<widget my-attr=\"parentModel\">` and widget definition of\n *   `scope: { localModel:'=myAttr' }`, then widget scope property `localModel` will reflect the\n *   value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected\n *   in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent\n *   scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You\n *   can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional.\n *\n * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope.\n *   If no `attr` name is specified then the attribute name is assumed to be the same as the\n *   local name. Given `<widget my-attr=\"count = count + value\">` and widget definition of\n *   `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to\n *   a function wrapper for the `count = count + value` expression. Often it's desirable to\n *   pass data from the isolated scope via an expression and to the parent scope, this can be\n *   done by passing a map of local variable names and values into the expression wrapper fn.\n *   For example, if the expression is `increment(amount)` then we can specify the amount value\n *   by calling the `localFn` as `localFn({amount: 22})`.\n *\n *\n *\n * #### `controller`\n * Controller constructor function. The controller is instantiated before the\n * pre-linking phase and it is shared with other directives (see\n * `require` attribute). This allows the directives to communicate with each other and augment\n * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:\n *\n * * `$scope` - Current scope associated with the element\n * * `$element` - Current element\n * * `$attrs` - Current attributes object for the element\n * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope.\n *    The scope can be overridden by an optional first argument.\n *   `function([scope], cloneLinkingFn)`.\n *\n *\n * #### `require`\n * Require another directive and inject its controller as the fourth argument to the linking function. The\n * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the\n * injected argument will be an array in corresponding order. If no such directive can be\n * found, or if the directive does not have a controller, then an error is raised. The name can be prefixed with:\n *\n * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.\n * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.\n * * `^` - Locate the required controller by searching the element's parents. Throw an error if not found.\n * * `?^` - Attempt to locate the required controller by searching the element's parents or pass `null` to the\n *   `link` fn if not found.\n *\n *\n * #### `controllerAs`\n * Controller alias at the directive scope. An alias for the controller so it\n * can be referenced at the directive template. The directive needs to define a scope for this\n * configuration to be used. Useful in the case when directive is used as component.\n *\n *\n * #### `restrict`\n * String of subset of `EACM` which restricts the directive to a specific directive\n * declaration style. If omitted, the default (attributes only) is used.\n *\n * * `E` - Element name: `<my-directive></my-directive>`\n * * `A` - Attribute (default): `<div my-directive=\"exp\"></div>`\n * * `C` - Class: `<div class=\"my-directive: exp;\"></div>`\n * * `M` - Comment: `<!-- directive: my-directive exp -->`\n *\n *\n * #### `template`\n * replace the current element with the contents of the HTML. The replacement process\n * migrates all of the attributes / classes from the old element to the new one. See the\n * {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive\n * Directives Guide} for an example.\n *\n * You can specify `template` as a string representing the template or as a function which takes\n * two arguments `tElement` and `tAttrs` (described in the `compile` function api below) and\n * returns a string value representing the template.\n *\n *\n * #### `templateUrl`\n * Same as `template` but the template is loaded from the specified URL. Because\n * the template loading is asynchronous the compilation/linking is suspended until the template\n * is loaded.\n *\n * You can specify `templateUrl` as a string representing the URL or as a function which takes two\n * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns\n * a string value representing the url.  In either case, the template URL is passed through {@link\n * api/ng.$sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.\n *\n *\n * #### `replace` ([*DEPRECATED*!], will be removed in next major release)\n * specify where the template should be inserted. Defaults to `false`.\n *\n * * `true` - the template will replace the current element.\n * * `false` - the template will replace the contents of the current element.\n *\n *\n * #### `transclude`\n * compile the content of the element and make it available to the directive.\n * Typically used with {@link ng.directive:ngTransclude\n * ngTransclude}. The advantage of transclusion is that the linking function receives a\n * transclusion function which is pre-bound to the correct scope. In a typical setup the widget\n * creates an `isolate` scope, but the transclusion is not a child, but a sibling of the `isolate`\n * scope. This makes it possible for the widget to have private state, and the transclusion to\n * be bound to the parent (pre-`isolate`) scope.\n *\n * * `true` - transclude the content of the directive.\n * * `'element'` - transclude the whole element including any directives defined at lower priority.\n *\n *\n * #### `compile`\n *\n * ```js\n *   function compile(tElement, tAttrs, transclude) { ... }\n * ```\n *\n * The compile function deals with transforming the template DOM. Since most directives do not do\n * template transformation, it is not used often. The compile function takes the following arguments:\n *\n *   * `tElement` - template element - The element where the directive has been declared. It is\n *     safe to do template transformation on the element and child elements only.\n *\n *   * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared\n *     between all directive compile functions.\n *\n *   * `transclude` -  [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`\n *\n * <div class=\"alert alert-warning\">\n * **Note:** The template instance and the link instance may be different objects if the template has\n * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that\n * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration\n * should be done in a linking function rather than in a compile function.\n * </div>\n\n * <div class=\"alert alert-warning\">\n * **Note:** The compile function cannot handle directives that recursively use themselves in their\n * own templates or compile functions. Compiling these directives results in an infinite loop and a\n * stack overflow errors.\n *\n * This can be avoided by manually using $compile in the postLink function to imperatively compile\n * a directive's template instead of relying on automatic template compilation via `template` or\n * `templateUrl` declaration or manual compilation inside the compile function.\n * </div>\n *\n * <div class=\"alert alert-error\">\n * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it\n *   e.g. does not know about the right outer scope. Please use the transclude function that is passed\n *   to the link function instead.\n * </div>\n\n * A compile function can have a return value which can be either a function or an object.\n *\n * * returning a (post-link) function - is equivalent to registering the linking function via the\n *   `link` property of the config object when the compile function is empty.\n *\n * * returning an object with function(s) registered via `pre` and `post` properties - allows you to\n *   control when a linking function should be called during the linking phase. See info about\n *   pre-linking and post-linking functions below.\n *\n *\n * #### `link`\n * This property is used only if the `compile` property is not defined.\n *\n * ```js\n *   function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }\n * ```\n *\n * The link function is responsible for registering DOM listeners as well as updating the DOM. It is\n * executed after the template has been cloned. This is where most of the directive logic will be\n * put.\n *\n *   * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the\n *     directive for registering {@link ng.$rootScope.Scope#$watch watches}.\n *\n *   * `iElement` - instance element - The element where the directive is to be used. It is safe to\n *     manipulate the children of the element only in `postLink` function since the children have\n *     already been linked.\n *\n *   * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared\n *     between all directive linking functions.\n *\n *   * `controller` - a controller instance - A controller instance if at least one directive on the\n *     element defines a controller. The controller is shared among all the directives, which allows\n *     the directives to use the controllers as a communication channel.\n *\n *   * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.\n *     The scope can be overridden by an optional first argument. This is the same as the `$transclude`\n *     parameter of directive controllers.\n *     `function([scope], cloneLinkingFn)`.\n *\n *\n * #### Pre-linking function\n *\n * Executed before the child elements are linked. Not safe to do DOM transformation since the\n * compiler linking function will fail to locate the correct elements for linking.\n *\n * #### Post-linking function\n *\n * Executed after the child elements are linked. It is safe to do DOM transformation in the post-linking function.\n *\n * <a name=\"Attributes\"></a>\n * ### Attributes\n *\n * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the\n * `link()` or `compile()` functions. It has a variety of uses.\n *\n * accessing *Normalized attribute names:*\n * Directives like 'ngBind' can be expressed in many ways: 'ng:bind', `data-ng-bind`, or 'x-ng-bind'.\n * the attributes object allows for normalized access to\n *   the attributes.\n *\n * * *Directive inter-communication:* All directives share the same instance of the attributes\n *   object which allows the directives to use the attributes object as inter directive\n *   communication.\n *\n * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object\n *   allowing other directives to read the interpolated value.\n *\n * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes\n *   that contain interpolation (e.g. `src=\"{{bar}}\"`). Not only is this very efficient but it's also\n *   the only way to easily get the actual value because during the linking phase the interpolation\n *   hasn't been evaluated yet and so the value is at this time set to `undefined`.\n *\n * ```js\n * function linkingFn(scope, elm, attrs, ctrl) {\n *   // get the attribute value\n *   console.log(attrs.ngModel);\n *\n *   // change the attribute\n *   attrs.$set('ngModel', 'new value');\n *\n *   // observe changes to interpolated attribute\n *   attrs.$observe('ngModel', function(value) {\n *     console.log('ngModel has changed value to ' + value);\n *   });\n * }\n * ```\n *\n * Below is an example using `$compileProvider`.\n *\n * <div class=\"alert alert-warning\">\n * **Note**: Typically directives are registered with `module.directive`. The example below is\n * to illustrate how `$compile` works.\n * </div>\n *\n <example module=\"compile\">\n   <file name=\"index.html\">\n    <script>\n      angular.module('compile', [], function($compileProvider) {\n        // configure new 'compile' directive by passing a directive\n        // factory function. The factory function injects the '$compile'\n        $compileProvider.directive('compile', function($compile) {\n          // directive factory creates a link function\n          return function(scope, element, attrs) {\n            scope.$watch(\n              function(scope) {\n                 // watch the 'compile' expression for changes\n                return scope.$eval(attrs.compile);\n              },\n              function(value) {\n                // when the 'compile' expression changes\n                // assign it into the current DOM\n                element.html(value);\n\n                // compile the new DOM and link it to the current\n                // scope.\n                // NOTE: we only compile .childNodes so that\n                // we don't get into infinite loop compiling ourselves\n                $compile(element.contents())(scope);\n              }\n            );\n          };\n        })\n      });\n\n      function Ctrl($scope) {\n        $scope.name = 'Angular';\n        $scope.html = 'Hello {{name}}';\n      }\n    </script>\n    <div ng-controller=\"Ctrl\">\n      <input ng-model=\"name\"> <br>\n      <textarea ng-model=\"html\"></textarea> <br>\n      <div compile=\"html\"></div>\n    </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should auto compile', function() {\n       var textarea = $('textarea');\n       var output = $('div[compile]');\n       // The initial state reads 'Hello Angular'.\n       expect(output.getText()).toBe('Hello Angular');\n       textarea.clear();\n       textarea.sendKeys('{{name}}!');\n       expect(output.getText()).toBe('Angular!');\n     });\n   </file>\n </example>\n\n *\n *\n * @param {string|DOMElement} element Element or HTML string to compile into a template function.\n * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives.\n * @param {number} maxPriority only apply directives lower than given priority (Only effects the\n *                 root element(s), not their children)\n * @returns {function(scope, cloneAttachFn=)} a link function which is used to bind template\n * (a DOM element/tree) to a scope. Where:\n *\n *  * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.\n *  * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the\n *  `template` and call the `cloneAttachFn` function allowing the caller to attach the\n *  cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is\n *  called as: <br> `cloneAttachFn(clonedElement, scope)` where:\n *\n *      * `clonedElement` - is a clone of the original `element` passed into the compiler.\n *      * `scope` - is the current scope with which the linking function is working with.\n *\n * Calling the linking function returns the element of the template. It is either the original\n * element passed in, or the clone of the element if the `cloneAttachFn` is provided.\n *\n * After linking the view is not updated until after a call to $digest which typically is done by\n * Angular automatically.\n *\n * If you need access to the bound view, there are two ways to do it:\n *\n * - If you are not asking the linking function to clone the template, create the DOM element(s)\n *   before you send them to the compiler and keep this reference around.\n *   ```js\n *     var element = $compile('<p>{{total}}</p>')(scope);\n *   ```\n *\n * - if on the other hand, you need the element to be cloned, the view reference from the original\n *   example would not point to the clone, but rather to the original template that was cloned. In\n *   this case, you can access the clone via the cloneAttachFn:\n *   ```js\n *     var templateElement = angular.element('<p>{{total}}</p>'),\n *         scope = ....;\n *\n *     var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {\n *       //attach the clone to DOM document at the right place\n *     });\n *\n *     //now we have reference to the cloned DOM via `clonedElement`\n *   ```\n *\n *\n * For information on how the compiler works, see the\n * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.\n */\n\nvar $compileMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $compileProvider\n * @kind function\n *\n * @description\n */\n$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];\nfunction $CompileProvider($provide, $$sanitizeUriProvider) {\n  var hasDirectives = {},\n      Suffix = 'Directive',\n      COMMENT_DIRECTIVE_REGEXP = /^\\s*directive\\:\\s*([\\d\\w_\\-]+)\\s+(.*)$/,\n      CLASS_DIRECTIVE_REGEXP = /(([\\d\\w_\\-]+)(?:\\:([^;]+))?;?)/;\n\n  // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes\n  // The assumption is that future DOM event attribute names will begin with\n  // 'on' and be composed of only English letters.\n  var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#directive\n   * @kind function\n   *\n   * @description\n   * Register a new directive with the compiler.\n   *\n   * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which\n   *    will match as <code>ng-bind</code>), or an object map of directives where the keys are the\n   *    names and the values are the factories.\n   * @param {Function|Array} directiveFactory An injectable directive factory function. See\n   *    {@link guide/directive} for more info.\n   * @returns {ng.$compileProvider} Self for chaining.\n   */\n   this.directive = function registerDirective(name, directiveFactory) {\n    assertNotHasOwnProperty(name, 'directive');\n    if (isString(name)) {\n      assertArg(directiveFactory, 'directiveFactory');\n      if (!hasDirectives.hasOwnProperty(name)) {\n        hasDirectives[name] = [];\n        $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',\n          function($injector, $exceptionHandler) {\n            var directives = [];\n            forEach(hasDirectives[name], function(directiveFactory, index) {\n              try {\n                var directive = $injector.invoke(directiveFactory);\n                if (isFunction(directive)) {\n                  directive = { compile: valueFn(directive) };\n                } else if (!directive.compile && directive.link) {\n                  directive.compile = valueFn(directive.link);\n                }\n                directive.priority = directive.priority || 0;\n                directive.index = index;\n                directive.name = directive.name || name;\n                directive.require = directive.require || (directive.controller && directive.name);\n                directive.restrict = directive.restrict || 'A';\n                directives.push(directive);\n              } catch (e) {\n                $exceptionHandler(e);\n              }\n            });\n            return directives;\n          }]);\n      }\n      hasDirectives[name].push(directiveFactory);\n    } else {\n      forEach(name, reverseParams(registerDirective));\n    }\n    return this;\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#aHrefSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.aHrefSanitizationWhitelist();\n    }\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#imgSrcSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();\n    }\n  };\n\n  this.$get = [\n            '$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',\n            '$controller', '$rootScope', '$document', '$sce', '$animate', '$$sanitizeUri',\n    function($injector,   $interpolate,   $exceptionHandler,   $http,   $templateCache,   $parse,\n             $controller,   $rootScope,   $document,   $sce,   $animate,   $$sanitizeUri) {\n\n    var Attributes = function(element, attr) {\n      this.$$element = element;\n      this.$attr = attr || {};\n    };\n\n    Attributes.prototype = {\n      $normalize: directiveNormalize,\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$addClass\n       * @kind function\n       *\n       * @description\n       * Adds the CSS class value specified by the classVal parameter to the element. If animations\n       * are enabled then an animation will be triggered for the class addition.\n       *\n       * @param {string} classVal The className value that will be added to the element\n       */\n      $addClass : function(classVal) {\n        if(classVal && classVal.length > 0) {\n          $animate.addClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$removeClass\n       * @kind function\n       *\n       * @description\n       * Removes the CSS class value specified by the classVal parameter from the element. If\n       * animations are enabled then an animation will be triggered for the class removal.\n       *\n       * @param {string} classVal The className value that will be removed from the element\n       */\n      $removeClass : function(classVal) {\n        if(classVal && classVal.length > 0) {\n          $animate.removeClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$updateClass\n       * @kind function\n       *\n       * @description\n       * Adds and removes the appropriate CSS class values to the element based on the difference\n       * between the new and old CSS class values (specified as newClasses and oldClasses).\n       *\n       * @param {string} newClasses The current CSS className value\n       * @param {string} oldClasses The former CSS className value\n       */\n      $updateClass : function(newClasses, oldClasses) {\n        var toAdd = tokenDifference(newClasses, oldClasses);\n        var toRemove = tokenDifference(oldClasses, newClasses);\n\n        if(toAdd.length === 0) {\n          $animate.removeClass(this.$$element, toRemove);\n        } else if(toRemove.length === 0) {\n          $animate.addClass(this.$$element, toAdd);\n        } else {\n          $animate.setClass(this.$$element, toAdd, toRemove);\n        }\n      },\n\n      /**\n       * Set a normalized attribute on the element in a way such that all directives\n       * can share the attribute. This function properly handles boolean attributes.\n       * @param {string} key Normalized key. (ie ngAttribute)\n       * @param {string|boolean} value The value to set. If `null` attribute will be deleted.\n       * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.\n       *     Defaults to true.\n       * @param {string=} attrName Optional none normalized name. Defaults to key.\n       */\n      $set: function(key, value, writeAttr, attrName) {\n        // TODO: decide whether or not to throw an error if \"class\"\n        //is set through this function since it may cause $updateClass to\n        //become unstable.\n\n        var booleanKey = getBooleanAttrName(this.$$element[0], key),\n            normalizedVal,\n            nodeName;\n\n        if (booleanKey) {\n          this.$$element.prop(key, value);\n          attrName = booleanKey;\n        }\n\n        this[key] = value;\n\n        // translate normalized key to actual key\n        if (attrName) {\n          this.$attr[key] = attrName;\n        } else {\n          attrName = this.$attr[key];\n          if (!attrName) {\n            this.$attr[key] = attrName = snake_case(key, '-');\n          }\n        }\n\n        nodeName = nodeName_(this.$$element);\n\n        // sanitize a[href] and img[src] values\n        if ((nodeName === 'A' && key === 'href') ||\n            (nodeName === 'IMG' && key === 'src')) {\n          this[key] = value = $$sanitizeUri(value, key === 'src');\n        }\n\n        if (writeAttr !== false) {\n          if (value === null || value === undefined) {\n            this.$$element.removeAttr(attrName);\n          } else {\n            this.$$element.attr(attrName, value);\n          }\n        }\n\n        // fire observers\n        var $$observers = this.$$observers;\n        $$observers && forEach($$observers[key], function(fn) {\n          try {\n            fn(value);\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        });\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$observe\n       * @kind function\n       *\n       * @description\n       * Observes an interpolated attribute.\n       *\n       * The observer function will be invoked once during the next `$digest` following\n       * compilation. The observer is then invoked whenever the interpolated value\n       * changes.\n       *\n       * @param {string} key Normalized key. (ie ngAttribute) .\n       * @param {function(interpolatedValue)} fn Function that will be called whenever\n                the interpolated value of the attribute changes.\n       *        See the {@link guide/directive#Attributes Directives} guide for more info.\n       * @returns {function()} the `fn` parameter.\n       */\n      $observe: function(key, fn) {\n        var attrs = this,\n            $$observers = (attrs.$$observers || (attrs.$$observers = {})),\n            listeners = ($$observers[key] || ($$observers[key] = []));\n\n        listeners.push(fn);\n        $rootScope.$evalAsync(function() {\n          if (!listeners.$$inter) {\n            // no one registered attribute interpolation function, so lets call it manually\n            fn(attrs[key]);\n          }\n        });\n        return fn;\n      }\n    };\n\n    var startSymbol = $interpolate.startSymbol(),\n        endSymbol = $interpolate.endSymbol(),\n        denormalizeTemplate = (startSymbol == '{{' || endSymbol  == '}}')\n            ? identity\n            : function denormalizeTemplate(template) {\n              return template.replace(/\\{\\{/g, startSymbol).replace(/}}/g, endSymbol);\n        },\n        NG_ATTR_BINDING = /^ngAttr[A-Z]/;\n\n\n    return compile;\n\n    //================================\n\n    function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,\n                        previousCompileContext) {\n      if (!($compileNodes instanceof jqLite)) {\n        // jquery always rewraps, whereas we need to preserve the original selector so that we can\n        // modify it.\n        $compileNodes = jqLite($compileNodes);\n      }\n      // We can not compile top level text elements since text nodes can be merged and we will\n      // not be able to attach scope data to them, so we will wrap them in <span>\n      forEach($compileNodes, function(node, index){\n        if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\\S+/) /* non-empty */ ) {\n          $compileNodes[index] = node = jqLite(node).wrap('<span></span>').parent()[0];\n        }\n      });\n      var compositeLinkFn =\n              compileNodes($compileNodes, transcludeFn, $compileNodes,\n                           maxPriority, ignoreDirective, previousCompileContext);\n      safeAddClass($compileNodes, 'ng-scope');\n      return function publicLinkFn(scope, cloneConnectFn, transcludeControllers){\n        assertArg(scope, 'scope');\n        // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart\n        // and sometimes changes the structure of the DOM.\n        var $linkNode = cloneConnectFn\n          ? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!\n          : $compileNodes;\n\n        forEach(transcludeControllers, function(instance, name) {\n          $linkNode.data('$' + name + 'Controller', instance);\n        });\n\n        // Attach scope only to non-text nodes.\n        for(var i = 0, ii = $linkNode.length; i<ii; i++) {\n          var node = $linkNode[i],\n              nodeType = node.nodeType;\n          if (nodeType === 1 /* element */ || nodeType === 9 /* document */) {\n            $linkNode.eq(i).data('$scope', scope);\n          }\n        }\n\n        if (cloneConnectFn) cloneConnectFn($linkNode, scope);\n        if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode);\n        return $linkNode;\n      };\n    }\n\n    function safeAddClass($element, className) {\n      try {\n        $element.addClass(className);\n      } catch(e) {\n        // ignore, since it means that we are trying to set class on\n        // SVG element, where class name is read-only.\n      }\n    }\n\n    /**\n     * Compile function matches each node in nodeList against the directives. Once all directives\n     * for a particular node are collected their compile functions are executed. The compile\n     * functions return values - the linking functions - are combined into a composite linking\n     * function, which is the a linking function for the node.\n     *\n     * @param {NodeList} nodeList an array of nodes or NodeList to compile\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *        scope argument is auto-generated to the new child of the transcluded parent scope.\n     * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then\n     *        the rootElement must be set the jqLite collection of the compile root. This is\n     *        needed so that the jqLite collection items can be replaced with widgets.\n     * @param {number=} maxPriority Max directive priority.\n     * @returns {Function} A composite linking function of all of the matched directives or null.\n     */\n    function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,\n                            previousCompileContext) {\n      var linkFns = [],\n          attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound;\n\n      for (var i = 0; i < nodeList.length; i++) {\n        attrs = new Attributes();\n\n        // we must always refer to nodeList[i] since the nodes can be replaced underneath us.\n        directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,\n                                        ignoreDirective);\n\n        nodeLinkFn = (directives.length)\n            ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,\n                                      null, [], [], previousCompileContext)\n            : null;\n\n        if (nodeLinkFn && nodeLinkFn.scope) {\n          safeAddClass(jqLite(nodeList[i]), 'ng-scope');\n        }\n\n        childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||\n                      !(childNodes = nodeList[i].childNodes) ||\n                      !childNodes.length)\n            ? null\n            : compileNodes(childNodes,\n                 nodeLinkFn ? nodeLinkFn.transclude : transcludeFn);\n\n        linkFns.push(nodeLinkFn, childLinkFn);\n        linkFnFound = linkFnFound || nodeLinkFn || childLinkFn;\n        //use the previous context only for the first element in the virtual group\n        previousCompileContext = null;\n      }\n\n      // return a linking function if we have found anything, null otherwise\n      return linkFnFound ? compositeLinkFn : null;\n\n      function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) {\n        var nodeLinkFn, childLinkFn, node, $node, childScope, childTranscludeFn, i, ii, n;\n\n        // copy nodeList so that linking doesn't break due to live list updates.\n        var nodeListLength = nodeList.length,\n            stableNodeList = new Array(nodeListLength);\n        for (i = 0; i < nodeListLength; i++) {\n          stableNodeList[i] = nodeList[i];\n        }\n\n        for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) {\n          node = stableNodeList[n];\n          nodeLinkFn = linkFns[i++];\n          childLinkFn = linkFns[i++];\n          $node = jqLite(node);\n\n          if (nodeLinkFn) {\n            if (nodeLinkFn.scope) {\n              childScope = scope.$new();\n              $node.data('$scope', childScope);\n            } else {\n              childScope = scope;\n            }\n            childTranscludeFn = nodeLinkFn.transclude;\n            if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) {\n              nodeLinkFn(childLinkFn, childScope, node, $rootElement,\n                createBoundTranscludeFn(scope, childTranscludeFn || transcludeFn)\n              );\n            } else {\n              nodeLinkFn(childLinkFn, childScope, node, $rootElement, boundTranscludeFn);\n            }\n          } else if (childLinkFn) {\n            childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);\n          }\n        }\n      }\n    }\n\n    function createBoundTranscludeFn(scope, transcludeFn) {\n      return function boundTranscludeFn(transcludedScope, cloneFn, controllers) {\n        var scopeCreated = false;\n\n        if (!transcludedScope) {\n          transcludedScope = scope.$new();\n          transcludedScope.$$transcluded = true;\n          scopeCreated = true;\n        }\n\n        var clone = transcludeFn(transcludedScope, cloneFn, controllers);\n        if (scopeCreated) {\n          clone.on('$destroy', bind(transcludedScope, transcludedScope.$destroy));\n        }\n        return clone;\n      };\n    }\n\n    /**\n     * Looks for directives on the given node and adds them to the directive collection which is\n     * sorted.\n     *\n     * @param node Node to search.\n     * @param directives An array to which the directives are added to. This array is sorted before\n     *        the function returns.\n     * @param attrs The shared attrs object which is used to populate the normalized attributes.\n     * @param {number=} maxPriority Max directive priority.\n     */\n    function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {\n      var nodeType = node.nodeType,\n          attrsMap = attrs.$attr,\n          match,\n          className;\n\n      switch(nodeType) {\n        case 1: /* Element */\n          // use the node name: <directive>\n          addDirective(directives,\n              directiveNormalize(nodeName_(node).toLowerCase()), 'E', maxPriority, ignoreDirective);\n\n          // iterate over the attributes\n          for (var attr, name, nName, ngAttrName, value, nAttrs = node.attributes,\n                   j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {\n            var attrStartName = false;\n            var attrEndName = false;\n\n            attr = nAttrs[j];\n            if (!msie || msie >= 8 || attr.specified) {\n              name = attr.name;\n              // support ngAttr attribute binding\n              ngAttrName = directiveNormalize(name);\n              if (NG_ATTR_BINDING.test(ngAttrName)) {\n                name = snake_case(ngAttrName.substr(6), '-');\n              }\n\n              var directiveNName = ngAttrName.replace(/(Start|End)$/, '');\n              if (ngAttrName === directiveNName + 'Start') {\n                attrStartName = name;\n                attrEndName = name.substr(0, name.length - 5) + 'end';\n                name = name.substr(0, name.length - 6);\n              }\n\n              nName = directiveNormalize(name.toLowerCase());\n              attrsMap[nName] = name;\n              attrs[nName] = value = trim(attr.value);\n              if (getBooleanAttrName(node, nName)) {\n                attrs[nName] = true; // presence means true\n              }\n              addAttrInterpolateDirective(node, directives, value, nName);\n              addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,\n                            attrEndName);\n            }\n          }\n\n          // use class as directive\n          className = node.className;\n          if (isString(className) && className !== '') {\n            while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {\n              nName = directiveNormalize(match[2]);\n              if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[3]);\n              }\n              className = className.substr(match.index + match[0].length);\n            }\n          }\n          break;\n        case 3: /* Text Node */\n          addTextInterpolateDirective(directives, node.nodeValue);\n          break;\n        case 8: /* Comment */\n          try {\n            match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);\n            if (match) {\n              nName = directiveNormalize(match[1]);\n              if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[2]);\n              }\n            }\n          } catch (e) {\n            // turns out that under some circumstances IE9 throws errors when one attempts to read\n            // comment's node value.\n            // Just ignore it and continue. (Can't seem to reproduce in test case.)\n          }\n          break;\n      }\n\n      directives.sort(byPriority);\n      return directives;\n    }\n\n    /**\n     * Given a node with an directive-start it collects all of the siblings until it finds\n     * directive-end.\n     * @param node\n     * @param attrStart\n     * @param attrEnd\n     * @returns {*}\n     */\n    function groupScan(node, attrStart, attrEnd) {\n      var nodes = [];\n      var depth = 0;\n      if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {\n        var startNode = node;\n        do {\n          if (!node) {\n            throw $compileMinErr('uterdir',\n                      \"Unterminated attribute, found '{0}' but no matching '{1}' found.\",\n                      attrStart, attrEnd);\n          }\n          if (node.nodeType == 1 /** Element **/) {\n            if (node.hasAttribute(attrStart)) depth++;\n            if (node.hasAttribute(attrEnd)) depth--;\n          }\n          nodes.push(node);\n          node = node.nextSibling;\n        } while (depth > 0);\n      } else {\n        nodes.push(node);\n      }\n\n      return jqLite(nodes);\n    }\n\n    /**\n     * Wrapper for linking function which converts normal linking function into a grouped\n     * linking function.\n     * @param linkFn\n     * @param attrStart\n     * @param attrEnd\n     * @returns {Function}\n     */\n    function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {\n      return function(scope, element, attrs, controllers, transcludeFn) {\n        element = groupScan(element[0], attrStart, attrEnd);\n        return linkFn(scope, element, attrs, controllers, transcludeFn);\n      };\n    }\n\n    /**\n     * Once the directives have been collected, their compile functions are executed. This method\n     * is responsible for inlining directive templates as well as terminating the application\n     * of the directives if the terminal directive has been reached.\n     *\n     * @param {Array} directives Array of collected directives to execute their compile function.\n     *        this needs to be pre-sorted by priority order.\n     * @param {Node} compileNode The raw DOM node to apply the compile functions to\n     * @param {Object} templateAttrs The shared attribute function\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *                                                  scope argument is auto-generated to the new\n     *                                                  child of the transcluded parent scope.\n     * @param {JQLite} jqCollection If we are working on the root of the compile tree then this\n     *                              argument has the root jqLite array so that we can replace nodes\n     *                              on it.\n     * @param {Object=} originalReplaceDirective An optional directive that will be ignored when\n     *                                           compiling the transclusion.\n     * @param {Array.<Function>} preLinkFns\n     * @param {Array.<Function>} postLinkFns\n     * @param {Object} previousCompileContext Context used for previous compilation of the current\n     *                                        node\n     * @returns {Function} linkFn\n     */\n    function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,\n                                   jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,\n                                   previousCompileContext) {\n      previousCompileContext = previousCompileContext || {};\n\n      var terminalPriority = -Number.MAX_VALUE,\n          newScopeDirective,\n          controllerDirectives = previousCompileContext.controllerDirectives,\n          newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,\n          templateDirective = previousCompileContext.templateDirective,\n          nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,\n          hasTranscludeDirective = false,\n          hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,\n          $compileNode = templateAttrs.$$element = jqLite(compileNode),\n          directive,\n          directiveName,\n          $template,\n          replaceDirective = originalReplaceDirective,\n          childTranscludeFn = transcludeFn,\n          linkFn,\n          directiveValue;\n\n      // executes all directives on the current element\n      for(var i = 0, ii = directives.length; i < ii; i++) {\n        directive = directives[i];\n        var attrStart = directive.$$start;\n        var attrEnd = directive.$$end;\n\n        // collect multiblock sections\n        if (attrStart) {\n          $compileNode = groupScan(compileNode, attrStart, attrEnd);\n        }\n        $template = undefined;\n\n        if (terminalPriority > directive.priority) {\n          break; // prevent further processing of directives\n        }\n\n        if (directiveValue = directive.scope) {\n          newScopeDirective = newScopeDirective || directive;\n\n          // skip the check for directives with async templates, we'll check the derived sync\n          // directive when the template arrives\n          if (!directive.templateUrl) {\n            assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,\n                              $compileNode);\n            if (isObject(directiveValue)) {\n              newIsolateScopeDirective = directive;\n            }\n          }\n        }\n\n        directiveName = directive.name;\n\n        if (!directive.templateUrl && directive.controller) {\n          directiveValue = directive.controller;\n          controllerDirectives = controllerDirectives || {};\n          assertNoDuplicate(\"'\" + directiveName + \"' controller\",\n              controllerDirectives[directiveName], directive, $compileNode);\n          controllerDirectives[directiveName] = directive;\n        }\n\n        if (directiveValue = directive.transclude) {\n          hasTranscludeDirective = true;\n\n          // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.\n          // This option should only be used by directives that know how to safely handle element transclusion,\n          // where the transcluded nodes are added or replaced after linking.\n          if (!directive.$$tlb) {\n            assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);\n            nonTlbTranscludeDirective = directive;\n          }\n\n          if (directiveValue == 'element') {\n            hasElementTranscludeDirective = true;\n            terminalPriority = directive.priority;\n            $template = groupScan(compileNode, attrStart, attrEnd);\n            $compileNode = templateAttrs.$$element =\n                jqLite(document.createComment(' ' + directiveName + ': ' +\n                                              templateAttrs[directiveName] + ' '));\n            compileNode = $compileNode[0];\n            replaceWith(jqCollection, jqLite(sliceArgs($template)), compileNode);\n\n            childTranscludeFn = compile($template, transcludeFn, terminalPriority,\n                                        replaceDirective && replaceDirective.name, {\n                                          // Don't pass in:\n                                          // - controllerDirectives - otherwise we'll create duplicates controllers\n                                          // - newIsolateScopeDirective or templateDirective - combining templates with\n                                          //   element transclusion doesn't make sense.\n                                          //\n                                          // We need only nonTlbTranscludeDirective so that we prevent putting transclusion\n                                          // on the same element more than once.\n                                          nonTlbTranscludeDirective: nonTlbTranscludeDirective\n                                        });\n          } else {\n            $template = jqLite(jqLiteClone(compileNode)).contents();\n            $compileNode.empty(); // clear contents\n            childTranscludeFn = compile($template, transcludeFn);\n          }\n        }\n\n        if (directive.template) {\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          directiveValue = (isFunction(directive.template))\n              ? directive.template($compileNode, templateAttrs)\n              : directive.template;\n\n          directiveValue = denormalizeTemplate(directiveValue);\n\n          if (directive.replace) {\n            replaceDirective = directive;\n            if (jqLiteIsTextNode(directiveValue)) {\n              $template = [];\n            } else {\n              $template = jqLite(trim(directiveValue));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== 1) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  directiveName, '');\n            }\n\n            replaceWith(jqCollection, $compileNode, compileNode);\n\n            var newTemplateAttrs = {$attr: {}};\n\n            // combine directives from the original node and from the template:\n            // - take the array of directives for this element\n            // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)\n            // - collect directives from the template and sort them by priority\n            // - combine directives as: processed + template + unprocessed\n            var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);\n            var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));\n\n            if (newIsolateScopeDirective) {\n              markDirectivesAsIsolate(templateDirectives);\n            }\n            directives = directives.concat(templateDirectives).concat(unprocessedDirectives);\n            mergeTemplateAttributes(templateAttrs, newTemplateAttrs);\n\n            ii = directives.length;\n          } else {\n            $compileNode.html(directiveValue);\n          }\n        }\n\n        if (directive.templateUrl) {\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          if (directive.replace) {\n            replaceDirective = directive;\n          }\n\n          nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,\n              templateAttrs, jqCollection, childTranscludeFn, preLinkFns, postLinkFns, {\n                controllerDirectives: controllerDirectives,\n                newIsolateScopeDirective: newIsolateScopeDirective,\n                templateDirective: templateDirective,\n                nonTlbTranscludeDirective: nonTlbTranscludeDirective\n              });\n          ii = directives.length;\n        } else if (directive.compile) {\n          try {\n            linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);\n            if (isFunction(linkFn)) {\n              addLinkFns(null, linkFn, attrStart, attrEnd);\n            } else if (linkFn) {\n              addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);\n            }\n          } catch (e) {\n            $exceptionHandler(e, startingTag($compileNode));\n          }\n        }\n\n        if (directive.terminal) {\n          nodeLinkFn.terminal = true;\n          terminalPriority = Math.max(terminalPriority, directive.priority);\n        }\n\n      }\n\n      nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;\n      nodeLinkFn.transclude = hasTranscludeDirective && childTranscludeFn;\n      previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;\n\n      // might be normal or delayed nodeLinkFn depending on if templateUrl is present\n      return nodeLinkFn;\n\n      ////////////////////\n\n      function addLinkFns(pre, post, attrStart, attrEnd) {\n        if (pre) {\n          if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);\n          pre.require = directive.require;\n          pre.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            pre = cloneAndAnnotateFn(pre, {isolateScope: true});\n          }\n          preLinkFns.push(pre);\n        }\n        if (post) {\n          if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);\n          post.require = directive.require;\n          post.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            post = cloneAndAnnotateFn(post, {isolateScope: true});\n          }\n          postLinkFns.push(post);\n        }\n      }\n\n\n      function getControllers(directiveName, require, $element, elementControllers) {\n        var value, retrievalMethod = 'data', optional = false;\n        if (isString(require)) {\n          while((value = require.charAt(0)) == '^' || value == '?') {\n            require = require.substr(1);\n            if (value == '^') {\n              retrievalMethod = 'inheritedData';\n            }\n            optional = optional || value == '?';\n          }\n          value = null;\n\n          if (elementControllers && retrievalMethod === 'data') {\n            value = elementControllers[require];\n          }\n          value = value || $element[retrievalMethod]('$' + require + 'Controller');\n\n          if (!value && !optional) {\n            throw $compileMinErr('ctreq',\n                \"Controller '{0}', required by directive '{1}', can't be found!\",\n                require, directiveName);\n          }\n          return value;\n        } else if (isArray(require)) {\n          value = [];\n          forEach(require, function(require) {\n            value.push(getControllers(directiveName, require, $element, elementControllers));\n          });\n        }\n        return value;\n      }\n\n\n      function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {\n        var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;\n\n        if (compileNode === linkNode) {\n          attrs = templateAttrs;\n        } else {\n          attrs = shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));\n        }\n        $element = attrs.$$element;\n\n        if (newIsolateScopeDirective) {\n          var LOCAL_REGEXP = /^\\s*([@=&])(\\??)\\s*(\\w*)\\s*$/;\n          var $linkNode = jqLite(linkNode);\n\n          isolateScope = scope.$new(true);\n\n          if (templateDirective && (templateDirective === newIsolateScopeDirective ||\n              templateDirective === newIsolateScopeDirective.$$originalDirective)) {\n            $linkNode.data('$isolateScope', isolateScope) ;\n          } else {\n            $linkNode.data('$isolateScopeNoTemplate', isolateScope);\n          }\n\n\n\n          safeAddClass($linkNode, 'ng-isolate-scope');\n\n          forEach(newIsolateScopeDirective.scope, function(definition, scopeName) {\n            var match = definition.match(LOCAL_REGEXP) || [],\n                attrName = match[3] || scopeName,\n                optional = (match[2] == '?'),\n                mode = match[1], // @, =, or &\n                lastValue,\n                parentGet, parentSet, compare;\n\n            isolateScope.$$isolateBindings[scopeName] = mode + attrName;\n\n            switch (mode) {\n\n              case '@':\n                attrs.$observe(attrName, function(value) {\n                  isolateScope[scopeName] = value;\n                });\n                attrs.$$observers[attrName].$$scope = scope;\n                if( attrs[attrName] ) {\n                  // If the attribute has been provided then we trigger an interpolation to ensure\n                  // the value is there for use in the link fn\n                  isolateScope[scopeName] = $interpolate(attrs[attrName])(scope);\n                }\n                break;\n\n              case '=':\n                if (optional && !attrs[attrName]) {\n                  return;\n                }\n                parentGet = $parse(attrs[attrName]);\n                if (parentGet.literal) {\n                  compare = equals;\n                } else {\n                  compare = function(a,b) { return a === b; };\n                }\n                parentSet = parentGet.assign || function() {\n                  // reset the change, or we will throw this exception on every $digest\n                  lastValue = isolateScope[scopeName] = parentGet(scope);\n                  throw $compileMinErr('nonassign',\n                      \"Expression '{0}' used with directive '{1}' is non-assignable!\",\n                      attrs[attrName], newIsolateScopeDirective.name);\n                };\n                lastValue = isolateScope[scopeName] = parentGet(scope);\n                isolateScope.$watch(function parentValueWatch() {\n                  var parentValue = parentGet(scope);\n                  if (!compare(parentValue, isolateScope[scopeName])) {\n                    // we are out of sync and need to copy\n                    if (!compare(parentValue, lastValue)) {\n                      // parent changed and it has precedence\n                      isolateScope[scopeName] = parentValue;\n                    } else {\n                      // if the parent can be assigned then do so\n                      parentSet(scope, parentValue = isolateScope[scopeName]);\n                    }\n                  }\n                  return lastValue = parentValue;\n                }, null, parentGet.literal);\n                break;\n\n              case '&':\n                parentGet = $parse(attrs[attrName]);\n                isolateScope[scopeName] = function(locals) {\n                  return parentGet(scope, locals);\n                };\n                break;\n\n              default:\n                throw $compileMinErr('iscp',\n                    \"Invalid isolate scope definition for directive '{0}'.\" +\n                    \" Definition: {... {1}: '{2}' ...}\",\n                    newIsolateScopeDirective.name, scopeName, definition);\n            }\n          });\n        }\n        transcludeFn = boundTranscludeFn && controllersBoundTransclude;\n        if (controllerDirectives) {\n          forEach(controllerDirectives, function(directive) {\n            var locals = {\n              $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,\n              $element: $element,\n              $attrs: attrs,\n              $transclude: transcludeFn\n            }, controllerInstance;\n\n            controller = directive.controller;\n            if (controller == '@') {\n              controller = attrs[directive.name];\n            }\n\n            controllerInstance = $controller(controller, locals);\n            // For directives with element transclusion the element is a comment,\n            // but jQuery .data doesn't support attaching data to comment nodes as it's hard to\n            // clean up (http://bugs.jquery.com/ticket/8335).\n            // Instead, we save the controllers for the element in a local hash and attach to .data\n            // later, once we have the actual element.\n            elementControllers[directive.name] = controllerInstance;\n            if (!hasElementTranscludeDirective) {\n              $element.data('$' + directive.name + 'Controller', controllerInstance);\n            }\n\n            if (directive.controllerAs) {\n              locals.$scope[directive.controllerAs] = controllerInstance;\n            }\n          });\n        }\n\n        // PRELINKING\n        for(i = 0, ii = preLinkFns.length; i < ii; i++) {\n          try {\n            linkFn = preLinkFns[i];\n            linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,\n                linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn);\n          } catch (e) {\n            $exceptionHandler(e, startingTag($element));\n          }\n        }\n\n        // RECURSION\n        // We only pass the isolate scope, if the isolate directive has a template,\n        // otherwise the child elements do not belong to the isolate directive.\n        var scopeToChild = scope;\n        if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {\n          scopeToChild = isolateScope;\n        }\n        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);\n\n        // POSTLINKING\n        for(i = postLinkFns.length - 1; i >= 0; i--) {\n          try {\n            linkFn = postLinkFns[i];\n            linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,\n                linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn);\n          } catch (e) {\n            $exceptionHandler(e, startingTag($element));\n          }\n        }\n\n        // This is the function that is injected as `$transclude`.\n        function controllersBoundTransclude(scope, cloneAttachFn) {\n          var transcludeControllers;\n\n          // no scope passed\n          if (arguments.length < 2) {\n            cloneAttachFn = scope;\n            scope = undefined;\n          }\n\n          if (hasElementTranscludeDirective) {\n            transcludeControllers = elementControllers;\n          }\n\n          return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers);\n        }\n      }\n    }\n\n    function markDirectivesAsIsolate(directives) {\n      // mark all directives as needing isolate scope.\n      for (var j = 0, jj = directives.length; j < jj; j++) {\n        directives[j] = inherit(directives[j], {$$isolateScope: true});\n      }\n    }\n\n    /**\n     * looks up the directive and decorates it with exception handling and proper parameters. We\n     * call this the boundDirective.\n     *\n     * @param {string} name name of the directive to look up.\n     * @param {string} location The directive must be found in specific format.\n     *   String containing any of theses characters:\n     *\n     *   * `E`: element name\n     *   * `A': attribute\n     *   * `C`: class\n     *   * `M`: comment\n     * @returns {boolean} true if directive was added.\n     */\n    function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,\n                          endAttrName) {\n      if (name === ignoreDirective) return null;\n      var match = null;\n      if (hasDirectives.hasOwnProperty(name)) {\n        for(var directive, directives = $injector.get(name + Suffix),\n            i = 0, ii = directives.length; i<ii; i++) {\n          try {\n            directive = directives[i];\n            if ( (maxPriority === undefined || maxPriority > directive.priority) &&\n                 directive.restrict.indexOf(location) != -1) {\n              if (startAttrName) {\n                directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});\n              }\n              tDirectives.push(directive);\n              match = directive;\n            }\n          } catch(e) { $exceptionHandler(e); }\n        }\n      }\n      return match;\n    }\n\n\n    /**\n     * When the element is replaced with HTML template then the new attributes\n     * on the template need to be merged with the existing attributes in the DOM.\n     * The desired effect is to have both of the attributes present.\n     *\n     * @param {object} dst destination attributes (original DOM)\n     * @param {object} src source attributes (from the directive template)\n     */\n    function mergeTemplateAttributes(dst, src) {\n      var srcAttr = src.$attr,\n          dstAttr = dst.$attr,\n          $element = dst.$$element;\n\n      // reapply the old attributes to the new element\n      forEach(dst, function(value, key) {\n        if (key.charAt(0) != '$') {\n          if (src[key] && src[key] !== value) {\n            value += (key === 'style' ? ';' : ' ') + src[key];\n          }\n          dst.$set(key, value, true, srcAttr[key]);\n        }\n      });\n\n      // copy the new attributes on the old attrs object\n      forEach(src, function(value, key) {\n        if (key == 'class') {\n          safeAddClass($element, value);\n          dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;\n        } else if (key == 'style') {\n          $element.attr('style', $element.attr('style') + ';' + value);\n          dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;\n          // `dst` will never contain hasOwnProperty as DOM parser won't let it.\n          // You will get an \"InvalidCharacterError: DOM Exception 5\" error if you\n          // have an attribute like \"has-own-property\" or \"data-has-own-property\", etc.\n        } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {\n          dst[key] = value;\n          dstAttr[key] = srcAttr[key];\n        }\n      });\n    }\n\n\n    function compileTemplateUrl(directives, $compileNode, tAttrs,\n        $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {\n      var linkQueue = [],\n          afterTemplateNodeLinkFn,\n          afterTemplateChildLinkFn,\n          beforeTemplateCompileNode = $compileNode[0],\n          origAsyncDirective = directives.shift(),\n          // The fact that we have to copy and patch the directive seems wrong!\n          derivedSyncDirective = extend({}, origAsyncDirective, {\n            templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective\n          }),\n          templateUrl = (isFunction(origAsyncDirective.templateUrl))\n              ? origAsyncDirective.templateUrl($compileNode, tAttrs)\n              : origAsyncDirective.templateUrl;\n\n      $compileNode.empty();\n\n      $http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}).\n        success(function(content) {\n          var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;\n\n          content = denormalizeTemplate(content);\n\n          if (origAsyncDirective.replace) {\n            if (jqLiteIsTextNode(content)) {\n              $template = [];\n            } else {\n              $template = jqLite(trim(content));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== 1) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  origAsyncDirective.name, templateUrl);\n            }\n\n            tempTemplateAttrs = {$attr: {}};\n            replaceWith($rootElement, $compileNode, compileNode);\n            var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);\n\n            if (isObject(origAsyncDirective.scope)) {\n              markDirectivesAsIsolate(templateDirectives);\n            }\n            directives = templateDirectives.concat(directives);\n            mergeTemplateAttributes(tAttrs, tempTemplateAttrs);\n          } else {\n            compileNode = beforeTemplateCompileNode;\n            $compileNode.html(content);\n          }\n\n          directives.unshift(derivedSyncDirective);\n\n          afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,\n              childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,\n              previousCompileContext);\n          forEach($rootElement, function(node, i) {\n            if (node == compileNode) {\n              $rootElement[i] = $compileNode[0];\n            }\n          });\n          afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);\n\n\n          while(linkQueue.length) {\n            var scope = linkQueue.shift(),\n                beforeTemplateLinkNode = linkQueue.shift(),\n                linkRootElement = linkQueue.shift(),\n                boundTranscludeFn = linkQueue.shift(),\n                linkNode = $compileNode[0];\n\n            if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {\n              var oldClasses = beforeTemplateLinkNode.className;\n\n              if (!(previousCompileContext.hasElementTranscludeDirective &&\n                  origAsyncDirective.replace)) {\n                // it was cloned therefore we have to clone as well.\n                linkNode = jqLiteClone(compileNode);\n              }\n\n              replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);\n\n              // Copy in CSS classes from original node\n              safeAddClass(jqLite(linkNode), oldClasses);\n            }\n            if (afterTemplateNodeLinkFn.transclude) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude);\n            } else {\n              childBoundTranscludeFn = boundTranscludeFn;\n            }\n            afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,\n              childBoundTranscludeFn);\n          }\n          linkQueue = null;\n        }).\n        error(function(response, code, headers, config) {\n          throw $compileMinErr('tpload', 'Failed to load template: {0}', config.url);\n        });\n\n      return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {\n        if (linkQueue) {\n          linkQueue.push(scope);\n          linkQueue.push(node);\n          linkQueue.push(rootElement);\n          linkQueue.push(boundTranscludeFn);\n        } else {\n          afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, boundTranscludeFn);\n        }\n      };\n    }\n\n\n    /**\n     * Sorting function for bound directives.\n     */\n    function byPriority(a, b) {\n      var diff = b.priority - a.priority;\n      if (diff !== 0) return diff;\n      if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;\n      return a.index - b.index;\n    }\n\n\n    function assertNoDuplicate(what, previousDirective, directive, element) {\n      if (previousDirective) {\n        throw $compileMinErr('multidir', 'Multiple directives [{0}, {1}] asking for {2} on: {3}',\n            previousDirective.name, directive.name, what, startingTag(element));\n      }\n    }\n\n\n    function addTextInterpolateDirective(directives, text) {\n      var interpolateFn = $interpolate(text, true);\n      if (interpolateFn) {\n        directives.push({\n          priority: 0,\n          compile: valueFn(function textInterpolateLinkFn(scope, node) {\n            var parent = node.parent(),\n                bindings = parent.data('$binding') || [];\n            bindings.push(interpolateFn);\n            safeAddClass(parent.data('$binding', bindings), 'ng-binding');\n            scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {\n              node[0].nodeValue = value;\n            });\n          })\n        });\n      }\n    }\n\n\n    function getTrustedContext(node, attrNormalizedName) {\n      if (attrNormalizedName == \"srcdoc\") {\n        return $sce.HTML;\n      }\n      var tag = nodeName_(node);\n      // maction[xlink:href] can source SVG.  It's not limited to <maction>.\n      if (attrNormalizedName == \"xlinkHref\" ||\n          (tag == \"FORM\" && attrNormalizedName == \"action\") ||\n          (tag != \"IMG\" && (attrNormalizedName == \"src\" ||\n                            attrNormalizedName == \"ngSrc\"))) {\n        return $sce.RESOURCE_URL;\n      }\n    }\n\n\n    function addAttrInterpolateDirective(node, directives, value, name) {\n      var interpolateFn = $interpolate(value, true);\n\n      // no interpolation found -> ignore\n      if (!interpolateFn) return;\n\n\n      if (name === \"multiple\" && nodeName_(node) === \"SELECT\") {\n        throw $compileMinErr(\"selmulti\",\n            \"Binding to the 'multiple' attribute is not supported. Element: {0}\",\n            startingTag(node));\n      }\n\n      directives.push({\n        priority: 100,\n        compile: function() {\n            return {\n              pre: function attrInterpolatePreLinkFn(scope, element, attr) {\n                var $$observers = (attr.$$observers || (attr.$$observers = {}));\n\n                if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {\n                  throw $compileMinErr('nodomevents',\n                      \"Interpolations for HTML DOM event attributes are disallowed.  Please use the \" +\n                          \"ng- versions (such as ng-click instead of onclick) instead.\");\n                }\n\n                // we need to interpolate again, in case the attribute value has been updated\n                // (e.g. by another directive's compile function)\n                interpolateFn = $interpolate(attr[name], true, getTrustedContext(node, name));\n\n                // if attribute was updated so that there is no interpolation going on we don't want to\n                // register any observers\n                if (!interpolateFn) return;\n\n                // TODO(i): this should likely be attr.$set(name, iterpolateFn(scope) so that we reset the\n                // actual attr value\n                attr[name] = interpolateFn(scope);\n                ($$observers[name] || ($$observers[name] = [])).$$inter = true;\n                (attr.$$observers && attr.$$observers[name].$$scope || scope).\n                  $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {\n                    //special case for class attribute addition + removal\n                    //so that class changes can tap into the animation\n                    //hooks provided by the $animate service. Be sure to\n                    //skip animations when the first digest occurs (when\n                    //both the new and the old values are the same) since\n                    //the CSS classes are the non-interpolated values\n                    if(name === 'class' && newValue != oldValue) {\n                      attr.$updateClass(newValue, oldValue);\n                    } else {\n                      attr.$set(name, newValue);\n                    }\n                  });\n              }\n            };\n          }\n      });\n    }\n\n\n    /**\n     * This is a special jqLite.replaceWith, which can replace items which\n     * have no parents, provided that the containing jqLite collection is provided.\n     *\n     * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes\n     *                               in the root of the tree.\n     * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep\n     *                                  the shell, but replace its DOM node reference.\n     * @param {Node} newNode The new DOM node.\n     */\n    function replaceWith($rootElement, elementsToRemove, newNode) {\n      var firstElementToRemove = elementsToRemove[0],\n          removeCount = elementsToRemove.length,\n          parent = firstElementToRemove.parentNode,\n          i, ii;\n\n      if ($rootElement) {\n        for(i = 0, ii = $rootElement.length; i < ii; i++) {\n          if ($rootElement[i] == firstElementToRemove) {\n            $rootElement[i++] = newNode;\n            for (var j = i, j2 = j + removeCount - 1,\n                     jj = $rootElement.length;\n                 j < jj; j++, j2++) {\n              if (j2 < jj) {\n                $rootElement[j] = $rootElement[j2];\n              } else {\n                delete $rootElement[j];\n              }\n            }\n            $rootElement.length -= removeCount - 1;\n            break;\n          }\n        }\n      }\n\n      if (parent) {\n        parent.replaceChild(newNode, firstElementToRemove);\n      }\n      var fragment = document.createDocumentFragment();\n      fragment.appendChild(firstElementToRemove);\n      newNode[jqLite.expando] = firstElementToRemove[jqLite.expando];\n      for (var k = 1, kk = elementsToRemove.length; k < kk; k++) {\n        var element = elementsToRemove[k];\n        jqLite(element).remove(); // must do this way to clean up expando\n        fragment.appendChild(element);\n        delete elementsToRemove[k];\n      }\n\n      elementsToRemove[0] = newNode;\n      elementsToRemove.length = 1;\n    }\n\n\n    function cloneAndAnnotateFn(fn, annotation) {\n      return extend(function() { return fn.apply(null, arguments); }, fn, annotation);\n    }\n  }];\n}\n\nvar PREFIX_REGEXP = /^(x[\\:\\-_]|data[\\:\\-_])/i;\n/**\n * Converts all accepted directives format into proper directive name.\n * All of these will become 'myDirective':\n *   my:Directive\n *   my-directive\n *   x-my-directive\n *   data-my:directive\n *\n * Also there is special case for Moz prefix starting with upper case letter.\n * @param name Name to normalize\n */\nfunction directiveNormalize(name) {\n  return camelCase(name.replace(PREFIX_REGEXP, ''));\n}\n\n/**\n * @ngdoc type\n * @name $compile.directive.Attributes\n *\n * @description\n * A shared object between directive compile / linking functions which contains normalized DOM\n * element attributes. The values reflect current binding state `{{ }}`. The normalization is\n * needed since all of these are treated as equivalent in Angular:\n *\n * ```\n *    <span ng:bind=\"a\" ng-bind=\"a\" data-ng-bind=\"a\" x-ng-bind=\"a\">\n * ```\n */\n\n/**\n * @ngdoc property\n * @name $compile.directive.Attributes#$attr\n * @returns {object} A map of DOM element attribute names to the normalized name. This is\n *                   needed to do reverse lookup from normalized name back to actual name.\n */\n\n\n/**\n * @ngdoc method\n * @name $compile.directive.Attributes#$set\n * @kind function\n *\n * @description\n * Set DOM element attribute value.\n *\n *\n * @param {string} name Normalized element attribute name of the property to modify. The name is\n *          reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}\n *          property to the original name.\n * @param {string} value Value to set the attribute to. The value can be an interpolated string.\n */\n\n\n\n/**\n * Closure compiler type information\n */\n\nfunction nodesetLinkingFn(\n  /* angular.Scope */ scope,\n  /* NodeList */ nodeList,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n){}\n\nfunction directiveLinkingFn(\n  /* nodesetLinkingFn */ nodesetLinkingFn,\n  /* angular.Scope */ scope,\n  /* Node */ node,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n){}\n\nfunction tokenDifference(str1, str2) {\n  var values = '',\n      tokens1 = str1.split(/\\s+/),\n      tokens2 = str2.split(/\\s+/);\n\n  outer:\n  for(var i = 0; i < tokens1.length; i++) {\n    var token = tokens1[i];\n    for(var j = 0; j < tokens2.length; j++) {\n      if(token == tokens2[j]) continue outer;\n    }\n    values += (values.length > 0 ? ' ' : '') + token;\n  }\n  return values;\n}\n\n/**\n * @ngdoc provider\n * @name $controllerProvider\n * @description\n * The {@link ng.$controller $controller service} is used by Angular to create new\n * controllers.\n *\n * This provider allows controller registration via the\n * {@link ng.$controllerProvider#register register} method.\n */\nfunction $ControllerProvider() {\n  var controllers = {},\n      CNTRL_REG = /^(\\S+)(\\s+as\\s+(\\w+))?$/;\n\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#register\n   * @param {string|Object} name Controller name, or an object map of controllers where the keys are\n   *    the names and the values are the constructors.\n   * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI\n   *    annotations in the array notation).\n   */\n  this.register = function(name, constructor) {\n    assertNotHasOwnProperty(name, 'controller');\n    if (isObject(name)) {\n      extend(controllers, name);\n    } else {\n      controllers[name] = constructor;\n    }\n  };\n\n\n  this.$get = ['$injector', '$window', function($injector, $window) {\n\n    /**\n     * @ngdoc service\n     * @name $controller\n     * @requires $injector\n     *\n     * @param {Function|string} constructor If called with a function then it's considered to be the\n     *    controller constructor function. Otherwise it's considered to be a string which is used\n     *    to retrieve the controller constructor using the following steps:\n     *\n     *    * check if a controller with given name is registered via `$controllerProvider`\n     *    * check if evaluating the string on the current scope returns a constructor\n     *    * check `window[constructor]` on the global `window` object\n     *\n     * @param {Object} locals Injection locals for Controller.\n     * @return {Object} Instance of given controller.\n     *\n     * @description\n     * `$controller` service is responsible for instantiating controllers.\n     *\n     * It's just a simple call to {@link auto.$injector $injector}, but extracted into\n     * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).\n     */\n    return function(expression, locals) {\n      var instance, match, constructor, identifier;\n\n      if(isString(expression)) {\n        match = expression.match(CNTRL_REG),\n        constructor = match[1],\n        identifier = match[3];\n        expression = controllers.hasOwnProperty(constructor)\n            ? controllers[constructor]\n            : getter(locals.$scope, constructor, true) || getter($window, constructor, true);\n\n        assertArgFn(expression, constructor, true);\n      }\n\n      instance = $injector.instantiate(expression, locals);\n\n      if (identifier) {\n        if (!(locals && typeof locals.$scope == 'object')) {\n          throw minErr('$controller')('noscp',\n              \"Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.\",\n              constructor || expression.name, identifier);\n        }\n\n        locals.$scope[identifier] = instance;\n      }\n\n      return instance;\n    };\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $document\n * @requires $window\n *\n * @description\n * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <div ng-controller=\"MainCtrl\">\n         <p>$document title: <b ng-bind=\"title\"></b></p>\n         <p>window.document title: <b ng-bind=\"windowTitle\"></b></p>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       function MainCtrl($scope, $document) {\n         $scope.title = $document[0].title;\n         $scope.windowTitle = angular.element(window.document)[0].title;\n       }\n     </file>\n   </example>\n */\nfunction $DocumentProvider(){\n  this.$get = ['$window', function(window){\n    return jqLite(window.document);\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $exceptionHandler\n * @requires ng.$log\n *\n * @description\n * Any uncaught exception in angular expressions is delegated to this service.\n * The default implementation simply delegates to `$log.error` which logs it into\n * the browser console.\n *\n * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by\n * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.\n *\n * ## Example:\n *\n * ```js\n *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {\n *     return function (exception, cause) {\n *       exception.message += ' (caused by \"' + cause + '\")';\n *       throw exception;\n *     };\n *   });\n * ```\n *\n * This example will override the normal action of `$exceptionHandler`, to make angular\n * exceptions fail hard when they happen, instead of just logging to the console.\n *\n * @param {Error} exception Exception associated with the error.\n * @param {string=} cause optional information about the context in which\n *       the error was thrown.\n *\n */\nfunction $ExceptionHandlerProvider() {\n  this.$get = ['$log', function($log) {\n    return function(exception, cause) {\n      $log.error.apply($log, arguments);\n    };\n  }];\n}\n\n/**\n * Parse headers into key value object\n *\n * @param {string} headers Raw headers as a string\n * @returns {Object} Parsed headers as key value object\n */\nfunction parseHeaders(headers) {\n  var parsed = {}, key, val, i;\n\n  if (!headers) return parsed;\n\n  forEach(headers.split('\\n'), function(line) {\n    i = line.indexOf(':');\n    key = lowercase(trim(line.substr(0, i)));\n    val = trim(line.substr(i + 1));\n\n    if (key) {\n      if (parsed[key]) {\n        parsed[key] += ', ' + val;\n      } else {\n        parsed[key] = val;\n      }\n    }\n  });\n\n  return parsed;\n}\n\n\n/**\n * Returns a function that provides access to parsed headers.\n *\n * Headers are lazy parsed when first requested.\n * @see parseHeaders\n *\n * @param {(string|Object)} headers Headers to provide access to.\n * @returns {function(string=)} Returns a getter function which if called with:\n *\n *   - if called with single an argument returns a single header value or null\n *   - if called with no arguments returns an object containing all headers.\n */\nfunction headersGetter(headers) {\n  var headersObj = isObject(headers) ? headers : undefined;\n\n  return function(name) {\n    if (!headersObj) headersObj =  parseHeaders(headers);\n\n    if (name) {\n      return headersObj[lowercase(name)] || null;\n    }\n\n    return headersObj;\n  };\n}\n\n\n/**\n * Chain all given functions\n *\n * This function is used for both request and response transforming\n *\n * @param {*} data Data to transform.\n * @param {function(string=)} headers Http headers getter fn.\n * @param {(Function|Array.<Function>)} fns Function or an array of functions.\n * @returns {*} Transformed data.\n */\nfunction transformData(data, headers, fns) {\n  if (isFunction(fns))\n    return fns(data, headers);\n\n  forEach(fns, function(fn) {\n    data = fn(data, headers);\n  });\n\n  return data;\n}\n\n\nfunction isSuccess(status) {\n  return 200 <= status && status < 300;\n}\n\n\nfunction $HttpProvider() {\n  var JSON_START = /^\\s*(\\[|\\{[^\\{])/,\n      JSON_END = /[\\}\\]]\\s*$/,\n      PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/,\n      CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'};\n\n  var defaults = this.defaults = {\n    // transform incoming response data\n    transformResponse: [function(data) {\n      if (isString(data)) {\n        // strip json vulnerability protection prefix\n        data = data.replace(PROTECTION_PREFIX, '');\n        if (JSON_START.test(data) && JSON_END.test(data))\n          data = fromJson(data);\n      }\n      return data;\n    }],\n\n    // transform outgoing request data\n    transformRequest: [function(d) {\n      return isObject(d) && !isFile(d) && !isBlob(d) ? toJson(d) : d;\n    }],\n\n    // default headers\n    headers: {\n      common: {\n        'Accept': 'application/json, text/plain, */*'\n      },\n      post:   shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      put:    shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      patch:  shallowCopy(CONTENT_TYPE_APPLICATION_JSON)\n    },\n\n    xsrfCookieName: 'XSRF-TOKEN',\n    xsrfHeaderName: 'X-XSRF-TOKEN'\n  };\n\n  /**\n   * Are ordered by request, i.e. they are applied in the same order as the\n   * array, on request, but reverse order, on response.\n   */\n  var interceptorFactories = this.interceptors = [];\n\n  /**\n   * For historical reasons, response interceptors are ordered by the order in which\n   * they are applied to the response. (This is the opposite of interceptorFactories)\n   */\n  var responseInterceptorFactories = this.responseInterceptors = [];\n\n  this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector',\n      function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {\n\n    var defaultCache = $cacheFactory('$http');\n\n    /**\n     * Interceptors stored in reverse order. Inner interceptors before outer interceptors.\n     * The reversal is needed so that we can build up the interception chain around the\n     * server request.\n     */\n    var reversedInterceptors = [];\n\n    forEach(interceptorFactories, function(interceptorFactory) {\n      reversedInterceptors.unshift(isString(interceptorFactory)\n          ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));\n    });\n\n    forEach(responseInterceptorFactories, function(interceptorFactory, index) {\n      var responseFn = isString(interceptorFactory)\n          ? $injector.get(interceptorFactory)\n          : $injector.invoke(interceptorFactory);\n\n      /**\n       * Response interceptors go before \"around\" interceptors (no real reason, just\n       * had to pick one.) But they are already reversed, so we can't use unshift, hence\n       * the splice.\n       */\n      reversedInterceptors.splice(index, 0, {\n        response: function(response) {\n          return responseFn($q.when(response));\n        },\n        responseError: function(response) {\n          return responseFn($q.reject(response));\n        }\n      });\n    });\n\n\n    /**\n     * @ngdoc service\n     * @kind function\n     * @name $http\n     * @requires ng.$httpBackend\n     * @requires $cacheFactory\n     * @requires $rootScope\n     * @requires $q\n     * @requires $injector\n     *\n     * @description\n     * The `$http` service is a core Angular service that facilitates communication with the remote\n     * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)\n     * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).\n     *\n     * For unit testing applications that use `$http` service, see\n     * {@link ngMock.$httpBackend $httpBackend mock}.\n     *\n     * For a higher level of abstraction, please check out the {@link ngResource.$resource\n     * $resource} service.\n     *\n     * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by\n     * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage\n     * it is important to familiarize yourself with these APIs and the guarantees they provide.\n     *\n     *\n     * # General usage\n     * The `$http` service is a function which takes a single argument — a configuration object —\n     * that is used to generate an HTTP request and returns  a {@link ng.$q promise}\n     * with two $http specific methods: `success` and `error`.\n     *\n     * ```js\n     *   $http({method: 'GET', url: '/someUrl'}).\n     *     success(function(data, status, headers, config) {\n     *       // this callback will be called asynchronously\n     *       // when the response is available\n     *     }).\n     *     error(function(data, status, headers, config) {\n     *       // called asynchronously if an error occurs\n     *       // or server returns response with an error status.\n     *     });\n     * ```\n     *\n     * Since the returned value of calling the $http function is a `promise`, you can also use\n     * the `then` method to register callbacks, and these callbacks will receive a single argument –\n     * an object representing the response. See the API signature and type info below for more\n     * details.\n     *\n     * A response status code between 200 and 299 is considered a success status and\n     * will result in the success callback being called. Note that if the response is a redirect,\n     * XMLHttpRequest will transparently follow it, meaning that the error callback will not be\n     * called for such responses.\n     *\n     * # Writing Unit Tests that use $http\n     * When unit testing (using {@link ngMock ngMock}), it is necessary to call\n     * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending\n     * request using trained responses.\n     *\n     * ```\n     * $httpBackend.expectGET(...);\n     * $http.get(...);\n     * $httpBackend.flush();\n     * ```\n     *\n     * # Shortcut methods\n     *\n     * Shortcut methods are also available. All shortcut methods require passing in the URL, and\n     * request data must be passed in for POST/PUT requests.\n     *\n     * ```js\n     *   $http.get('/someUrl').success(successCallback);\n     *   $http.post('/someUrl', data).success(successCallback);\n     * ```\n     *\n     * Complete list of shortcut methods:\n     *\n     * - {@link ng.$http#get $http.get}\n     * - {@link ng.$http#head $http.head}\n     * - {@link ng.$http#post $http.post}\n     * - {@link ng.$http#put $http.put}\n     * - {@link ng.$http#delete $http.delete}\n     * - {@link ng.$http#jsonp $http.jsonp}\n     *\n     *\n     * # Setting HTTP Headers\n     *\n     * The $http service will automatically add certain HTTP headers to all requests. These defaults\n     * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration\n     * object, which currently contains this default configuration:\n     *\n     * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):\n     *   - `Accept: application/json, text/plain, * / *`\n     * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)\n     *   - `Content-Type: application/json`\n     * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)\n     *   - `Content-Type: application/json`\n     *\n     * To add or overwrite these defaults, simply add or remove a property from these configuration\n     * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object\n     * with the lowercased HTTP method name as the key, e.g.\n     * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }.\n     *\n     * The defaults can also be set at runtime via the `$http.defaults` object in the same\n     * fashion. For example:\n     *\n     * ```\n     * module.run(function($http) {\n     *   $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'\n     * });\n     * ```\n     *\n     * In addition, you can supply a `headers` property in the config object passed when\n     * calling `$http(config)`, which overrides the defaults without changing them globally.\n     *\n     *\n     * # Transforming Requests and Responses\n     *\n     * Both requests and responses can be transformed using transform functions. By default, Angular\n     * applies these transformations:\n     *\n     * Request transformations:\n     *\n     * - If the `data` property of the request configuration object contains an object, serialize it\n     *   into JSON format.\n     *\n     * Response transformations:\n     *\n     *  - If XSRF prefix is detected, strip it (see Security Considerations section below).\n     *  - If JSON response is detected, deserialize it using a JSON parser.\n     *\n     * To globally augment or override the default transforms, modify the\n     * `$httpProvider.defaults.transformRequest` and `$httpProvider.defaults.transformResponse`\n     * properties. These properties are by default an array of transform functions, which allows you\n     * to `push` or `unshift` a new transformation function into the transformation chain. You can\n     * also decide to completely override any default transformations by assigning your\n     * transformation functions to these properties directly without the array wrapper.  These defaults\n     * are again available on the $http factory at run-time, which may be useful if you have run-time\n     * services you wish to be involved in your transformations.\n     *\n     * Similarly, to locally override the request/response transforms, augment the\n     * `transformRequest` and/or `transformResponse` properties of the configuration object passed\n     * into `$http`.\n     *\n     *\n     * # Caching\n     *\n     * To enable caching, set the request configuration `cache` property to `true` (to use default\n     * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).\n     * When the cache is enabled, `$http` stores the response from the server in the specified\n     * cache. The next time the same request is made, the response is served from the cache without\n     * sending a request to the server.\n     *\n     * Note that even if the response is served from cache, delivery of the data is asynchronous in\n     * the same way that real requests are.\n     *\n     * If there are multiple GET requests for the same URL that should be cached using the same\n     * cache, but the cache is not populated yet, only one request to the server will be made and\n     * the remaining requests will be fulfilled using the response from the first request.\n     *\n     * You can change the default cache to a new object (built with\n     * {@link ng.$cacheFactory `$cacheFactory`}) by updating the\n     * {@link ng.$http#properties_defaults `$http.defaults.cache`} property. All requests who set\n     * their `cache` property to `true` will now use this cache object.\n     *\n     * If you set the default cache to `false` then only requests that specify their own custom\n     * cache object will be cached.\n     *\n     * # Interceptors\n     *\n     * Before you start creating interceptors, be sure to understand the\n     * {@link ng.$q $q and deferred/promise APIs}.\n     *\n     * For purposes of global error handling, authentication, or any kind of synchronous or\n     * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be\n     * able to intercept requests before they are handed to the server and\n     * responses before they are handed over to the application code that\n     * initiated these requests. The interceptors leverage the {@link ng.$q\n     * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.\n     *\n     * The interceptors are service factories that are registered with the `$httpProvider` by\n     * adding them to the `$httpProvider.interceptors` array. The factory is called and\n     * injected with dependencies (if specified) and returns the interceptor.\n     *\n     * There are two kinds of interceptors (and two kinds of rejection interceptors):\n     *\n     *   * `request`: interceptors get called with a http `config` object. The function is free to\n     *     modify the `config` object or create a new one. The function needs to return the `config`\n     *     object directly, or a promise containing the `config` or a new `config` object.\n     *   * `requestError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *   * `response`: interceptors get called with http `response` object. The function is free to\n     *     modify the `response` object or create a new one. The function needs to return the `response`\n     *     object directly, or as a promise containing the `response` or a new `response` object.\n     *   * `responseError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *\n     *\n     * ```js\n     *   // register the interceptor as a service\n     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {\n     *     return {\n     *       // optional method\n     *       'request': function(config) {\n     *         // do something on success\n     *         return config;\n     *       },\n     *\n     *       // optional method\n     *      'requestError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       },\n     *\n     *\n     *\n     *       // optional method\n     *       'response': function(response) {\n     *         // do something on success\n     *         return response;\n     *       },\n     *\n     *       // optional method\n     *      'responseError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       }\n     *     };\n     *   });\n     *\n     *   $httpProvider.interceptors.push('myHttpInterceptor');\n     *\n     *\n     *   // alternatively, register the interceptor via an anonymous factory\n     *   $httpProvider.interceptors.push(function($q, dependency1, dependency2) {\n     *     return {\n     *      'request': function(config) {\n     *          // same as above\n     *       },\n     *\n     *       'response': function(response) {\n     *          // same as above\n     *       }\n     *     };\n     *   });\n     * ```\n     *\n     * # Response interceptors (DEPRECATED)\n     *\n     * Before you start creating interceptors, be sure to understand the\n     * {@link ng.$q $q and deferred/promise APIs}.\n     *\n     * For purposes of global error handling, authentication or any kind of synchronous or\n     * asynchronous preprocessing of received responses, it is desirable to be able to intercept\n     * responses for http requests before they are handed over to the application code that\n     * initiated these requests. The response interceptors leverage the {@link ng.$q\n     * promise apis} to fulfil this need for both synchronous and asynchronous preprocessing.\n     *\n     * The interceptors are service factories that are registered with the $httpProvider by\n     * adding them to the `$httpProvider.responseInterceptors` array. The factory is called and\n     * injected with dependencies (if specified) and returns the interceptor  — a function that\n     * takes a {@link ng.$q promise} and returns the original or a new promise.\n     *\n     * ```js\n     *   // register the interceptor as a service\n     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {\n     *     return function(promise) {\n     *       return promise.then(function(response) {\n     *         // do something on success\n     *         return response;\n     *       }, function(response) {\n     *         // do something on error\n     *         if (canRecover(response)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(response);\n     *       });\n     *     }\n     *   });\n     *\n     *   $httpProvider.responseInterceptors.push('myHttpInterceptor');\n     *\n     *\n     *   // register the interceptor via an anonymous factory\n     *   $httpProvider.responseInterceptors.push(function($q, dependency1, dependency2) {\n     *     return function(promise) {\n     *       // same as above\n     *     }\n     *   });\n     * ```\n     *\n     *\n     * # Security Considerations\n     *\n     * When designing web applications, consider security threats from:\n     *\n     * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)\n     *\n     * Both server and the client must cooperate in order to eliminate these threats. Angular comes\n     * pre-configured with strategies that address these issues, but for this to work backend server\n     * cooperation is required.\n     *\n     * ## JSON Vulnerability Protection\n     *\n     * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * allows third party website to turn your JSON resource URL into\n     * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To\n     * counter this your server can prefix all JSON requests with following string `\")]}',\\n\"`.\n     * Angular will automatically strip the prefix before processing it as JSON.\n     *\n     * For example if your server needs to return:\n     * ```js\n     * ['one','two']\n     * ```\n     *\n     * which is vulnerable to attack, your server can return:\n     * ```js\n     * )]}',\n     * ['one','two']\n     * ```\n     *\n     * Angular will strip the prefix, before processing the JSON.\n     *\n     *\n     * ## Cross Site Request Forgery (XSRF) Protection\n     *\n     * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is a technique by which\n     * an unauthorized site can gain your user's private data. Angular provides a mechanism\n     * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie\n     * (by default, `XSRF-TOKEN`) and sets it as an HTTP header (`X-XSRF-TOKEN`). Since only\n     * JavaScript that runs on your domain could read the cookie, your server can be assured that\n     * the XHR came from JavaScript running on your domain. The header will not be set for\n     * cross-domain requests.\n     *\n     * To take advantage of this, your server needs to set a token in a JavaScript readable session\n     * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the\n     * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure\n     * that only JavaScript running on your domain could have sent the request. The token must be\n     * unique for each user and must be verifiable by the server (to prevent the JavaScript from\n     * making up its own tokens). We recommend that the token is a digest of your site's\n     * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography))\n     * for added security.\n     *\n     * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName\n     * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,\n     * or the per-request config object.\n     *\n     *\n     * @param {object} config Object describing the request to be made and how it should be\n     *    processed. The object has following properties:\n     *\n     *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)\n     *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.\n     *    - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned\n     *      to `?key1=value1&key2=value2` after the url. If the value is not a string, it will be\n     *      JSONified.\n     *    - **data** – `{string|Object}` – Data to be sent as the request message data.\n     *    - **headers** – `{Object}` – Map of strings or functions which return strings representing\n     *      HTTP headers to send to the server. If the return value of a function is null, the\n     *      header will not be sent.\n     *    - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.\n     *    - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.\n     *    - **transformRequest** –\n     *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      request body and headers and returns its transformed (typically serialized) version.\n     *    - **transformResponse** –\n     *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      response body and headers and returns its transformed (typically deserialized) version.\n     *    - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the\n     *      GET request, otherwise if a cache instance built with\n     *      {@link ng.$cacheFactory $cacheFactory}, this cache will be used for\n     *      caching.\n     *    - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}\n     *      that should abort the request when resolved.\n     *    - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the\n     *      XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5\n     *      for more information.\n     *    - **responseType** - `{string}` - see\n     *      [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).\n     *\n     * @returns {HttpPromise} Returns a {@link ng.$q promise} object with the\n     *   standard `then` method and two http specific methods: `success` and `error`. The `then`\n     *   method takes two arguments a success and an error callback which will be called with a\n     *   response object. The `success` and `error` methods take a single argument - a function that\n     *   will be called when the request succeeds or fails respectively. The arguments passed into\n     *   these functions are destructured representation of the response object passed into the\n     *   `then` method. The response object has these properties:\n     *\n     *   - **data** – `{string|Object}` – The response body transformed with the transform\n     *     functions.\n     *   - **status** – `{number}` – HTTP status code of the response.\n     *   - **headers** – `{function([headerName])}` – Header getter function.\n     *   - **config** – `{Object}` – The configuration object that was used to generate the request.\n     *   - **statusText** – `{string}` – HTTP status text of the response.\n     *\n     * @property {Array.<Object>} pendingRequests Array of config objects for currently pending\n     *   requests. This is primarily meant to be used for debugging purposes.\n     *\n     *\n     * @example\n<example>\n<file name=\"index.html\">\n  <div ng-controller=\"FetchCtrl\">\n    <select ng-model=\"method\">\n      <option>GET</option>\n      <option>JSONP</option>\n    </select>\n    <input type=\"text\" ng-model=\"url\" size=\"80\"/>\n    <button id=\"fetchbtn\" ng-click=\"fetch()\">fetch</button><br>\n    <button id=\"samplegetbtn\" ng-click=\"updateModel('GET', 'http-hello.html')\">Sample GET</button>\n    <button id=\"samplejsonpbtn\"\n      ng-click=\"updateModel('JSONP',\n                    'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')\">\n      Sample JSONP\n    </button>\n    <button id=\"invalidjsonpbtn\"\n      ng-click=\"updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')\">\n        Invalid JSONP\n      </button>\n    <pre>http status code: {{status}}</pre>\n    <pre>http response data: {{data}}</pre>\n  </div>\n</file>\n<file name=\"script.js\">\n  function FetchCtrl($scope, $http, $templateCache) {\n    $scope.method = 'GET';\n    $scope.url = 'http-hello.html';\n\n    $scope.fetch = function() {\n      $scope.code = null;\n      $scope.response = null;\n\n      $http({method: $scope.method, url: $scope.url, cache: $templateCache}).\n        success(function(data, status) {\n          $scope.status = status;\n          $scope.data = data;\n        }).\n        error(function(data, status) {\n          $scope.data = data || \"Request failed\";\n          $scope.status = status;\n      });\n    };\n\n    $scope.updateModel = function(method, url) {\n      $scope.method = method;\n      $scope.url = url;\n    };\n  }\n</file>\n<file name=\"http-hello.html\">\n  Hello, $http!\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  var status = element(by.binding('status'));\n  var data = element(by.binding('data'));\n  var fetchBtn = element(by.id('fetchbtn'));\n  var sampleGetBtn = element(by.id('samplegetbtn'));\n  var sampleJsonpBtn = element(by.id('samplejsonpbtn'));\n  var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));\n\n  it('should make an xhr GET request', function() {\n    sampleGetBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('200');\n    expect(data.getText()).toMatch(/Hello, \\$http!/);\n  });\n\n  it('should make a JSONP request to angularjs.org', function() {\n    sampleJsonpBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('200');\n    expect(data.getText()).toMatch(/Super Hero!/);\n  });\n\n  it('should make JSONP request to invalid URL and invoke the error handler',\n      function() {\n    invalidJsonpBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('0');\n    expect(data.getText()).toMatch('Request failed');\n  });\n</file>\n</example>\n     */\n    function $http(requestConfig) {\n      var config = {\n        method: 'get',\n        transformRequest: defaults.transformRequest,\n        transformResponse: defaults.transformResponse\n      };\n      var headers = mergeHeaders(requestConfig);\n\n      extend(config, requestConfig);\n      config.headers = headers;\n      config.method = uppercase(config.method);\n\n      var xsrfValue = urlIsSameOrigin(config.url)\n          ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName]\n          : undefined;\n      if (xsrfValue) {\n        headers[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;\n      }\n\n\n      var serverRequest = function(config) {\n        headers = config.headers;\n        var reqData = transformData(config.data, headersGetter(headers), config.transformRequest);\n\n        // strip content-type if data is undefined\n        if (isUndefined(config.data)) {\n          forEach(headers, function(value, header) {\n            if (lowercase(header) === 'content-type') {\n                delete headers[header];\n            }\n          });\n        }\n\n        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {\n          config.withCredentials = defaults.withCredentials;\n        }\n\n        // send request\n        return sendReq(config, reqData, headers).then(transformResponse, transformResponse);\n      };\n\n      var chain = [serverRequest, undefined];\n      var promise = $q.when(config);\n\n      // apply interceptors\n      forEach(reversedInterceptors, function(interceptor) {\n        if (interceptor.request || interceptor.requestError) {\n          chain.unshift(interceptor.request, interceptor.requestError);\n        }\n        if (interceptor.response || interceptor.responseError) {\n          chain.push(interceptor.response, interceptor.responseError);\n        }\n      });\n\n      while(chain.length) {\n        var thenFn = chain.shift();\n        var rejectFn = chain.shift();\n\n        promise = promise.then(thenFn, rejectFn);\n      }\n\n      promise.success = function(fn) {\n        promise.then(function(response) {\n          fn(response.data, response.status, response.headers, config);\n        });\n        return promise;\n      };\n\n      promise.error = function(fn) {\n        promise.then(null, function(response) {\n          fn(response.data, response.status, response.headers, config);\n        });\n        return promise;\n      };\n\n      return promise;\n\n      function transformResponse(response) {\n        // make a copy since the response must be cacheable\n        var resp = extend({}, response, {\n          data: transformData(response.data, response.headers, config.transformResponse)\n        });\n        return (isSuccess(response.status))\n          ? resp\n          : $q.reject(resp);\n      }\n\n      function mergeHeaders(config) {\n        var defHeaders = defaults.headers,\n            reqHeaders = extend({}, config.headers),\n            defHeaderName, lowercaseDefHeaderName, reqHeaderName;\n\n        defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);\n\n        // execute if header value is function\n        execHeaders(defHeaders);\n        execHeaders(reqHeaders);\n\n        // using for-in instead of forEach to avoid unecessary iteration after header has been found\n        defaultHeadersIteration:\n        for (defHeaderName in defHeaders) {\n          lowercaseDefHeaderName = lowercase(defHeaderName);\n\n          for (reqHeaderName in reqHeaders) {\n            if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {\n              continue defaultHeadersIteration;\n            }\n          }\n\n          reqHeaders[defHeaderName] = defHeaders[defHeaderName];\n        }\n\n        return reqHeaders;\n\n        function execHeaders(headers) {\n          var headerContent;\n\n          forEach(headers, function(headerFn, header) {\n            if (isFunction(headerFn)) {\n              headerContent = headerFn();\n              if (headerContent != null) {\n                headers[header] = headerContent;\n              } else {\n                delete headers[header];\n              }\n            }\n          });\n        }\n      }\n    }\n\n    $http.pendingRequests = [];\n\n    /**\n     * @ngdoc method\n     * @name $http#get\n     *\n     * @description\n     * Shortcut method to perform `GET` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#delete\n     *\n     * @description\n     * Shortcut method to perform `DELETE` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#head\n     *\n     * @description\n     * Shortcut method to perform `HEAD` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#jsonp\n     *\n     * @description\n     * Shortcut method to perform `JSONP` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request.\n     *                     Should contain `JSON_CALLBACK` string.\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n    createShortMethods('get', 'delete', 'head', 'jsonp');\n\n    /**\n     * @ngdoc method\n     * @name $http#post\n     *\n     * @description\n     * Shortcut method to perform `POST` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#put\n     *\n     * @description\n     * Shortcut method to perform `PUT` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n    createShortMethodsWithData('post', 'put');\n\n        /**\n         * @ngdoc property\n         * @name $http#defaults\n         *\n         * @description\n         * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of\n         * default headers, withCredentials as well as request and response transformations.\n         *\n         * See \"Setting HTTP Headers\" and \"Transforming Requests and Responses\" sections above.\n         */\n    $http.defaults = defaults;\n\n\n    return $http;\n\n\n    function createShortMethods(names) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, config) {\n          return $http(extend(config || {}, {\n            method: name,\n            url: url\n          }));\n        };\n      });\n    }\n\n\n    function createShortMethodsWithData(name) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, data, config) {\n          return $http(extend(config || {}, {\n            method: name,\n            url: url,\n            data: data\n          }));\n        };\n      });\n    }\n\n\n    /**\n     * Makes the request.\n     *\n     * !!! ACCESSES CLOSURE VARS:\n     * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests\n     */\n    function sendReq(config, reqData, reqHeaders) {\n      var deferred = $q.defer(),\n          promise = deferred.promise,\n          cache,\n          cachedResp,\n          url = buildUrl(config.url, config.params);\n\n      $http.pendingRequests.push(config);\n      promise.then(removePendingReq, removePendingReq);\n\n\n      if ((config.cache || defaults.cache) && config.cache !== false && config.method == 'GET') {\n        cache = isObject(config.cache) ? config.cache\n              : isObject(defaults.cache) ? defaults.cache\n              : defaultCache;\n      }\n\n      if (cache) {\n        cachedResp = cache.get(url);\n        if (isDefined(cachedResp)) {\n          if (cachedResp.then) {\n            // cached request has already been sent, but there is no response yet\n            cachedResp.then(removePendingReq, removePendingReq);\n            return cachedResp;\n          } else {\n            // serving from cache\n            if (isArray(cachedResp)) {\n              resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);\n            } else {\n              resolvePromise(cachedResp, 200, {}, 'OK');\n            }\n          }\n        } else {\n          // put the promise for the non-transformed response into cache as a placeholder\n          cache.put(url, promise);\n        }\n      }\n\n      // if we won't have the response in cache, send the request to the backend\n      if (isUndefined(cachedResp)) {\n        $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,\n            config.withCredentials, config.responseType);\n      }\n\n      return promise;\n\n\n      /**\n       * Callback registered to $httpBackend():\n       *  - caches the response if desired\n       *  - resolves the raw $http promise\n       *  - calls $apply\n       */\n      function done(status, response, headersString, statusText) {\n        if (cache) {\n          if (isSuccess(status)) {\n            cache.put(url, [status, response, parseHeaders(headersString), statusText]);\n          } else {\n            // remove promise from the cache\n            cache.remove(url);\n          }\n        }\n\n        resolvePromise(response, status, headersString, statusText);\n        if (!$rootScope.$$phase) $rootScope.$apply();\n      }\n\n\n      /**\n       * Resolves the raw $http promise.\n       */\n      function resolvePromise(response, status, headers, statusText) {\n        // normalize internal statuses to 0\n        status = Math.max(status, 0);\n\n        (isSuccess(status) ? deferred.resolve : deferred.reject)({\n          data: response,\n          status: status,\n          headers: headersGetter(headers),\n          config: config,\n          statusText : statusText\n        });\n      }\n\n\n      function removePendingReq() {\n        var idx = indexOf($http.pendingRequests, config);\n        if (idx !== -1) $http.pendingRequests.splice(idx, 1);\n      }\n    }\n\n\n    function buildUrl(url, params) {\n          if (!params) return url;\n          var parts = [];\n          forEachSorted(params, function(value, key) {\n            if (value === null || isUndefined(value)) return;\n            if (!isArray(value)) value = [value];\n\n            forEach(value, function(v) {\n              if (isObject(v)) {\n                v = toJson(v);\n              }\n              parts.push(encodeUriQuery(key) + '=' +\n                         encodeUriQuery(v));\n            });\n          });\n          if(parts.length > 0) {\n            url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');\n          }\n          return url;\n        }\n\n\n  }];\n}\n\nfunction createXhr(method) {\n    //if IE and the method is not RFC2616 compliant, or if XMLHttpRequest\n    //is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest\n    //if it is available\n    if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||\n      !window.XMLHttpRequest)) {\n      return new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n    } else if (window.XMLHttpRequest) {\n      return new window.XMLHttpRequest();\n    }\n\n    throw minErr('$httpBackend')('noxhr', \"This browser does not support XMLHttpRequest.\");\n}\n\n/**\n * @ngdoc service\n * @name $httpBackend\n * @requires $window\n * @requires $document\n *\n * @description\n * HTTP backend used by the {@link ng.$http service} that delegates to\n * XMLHttpRequest object or JSONP and deals with browser incompatibilities.\n *\n * You should never need to use this service directly, instead use the higher-level abstractions:\n * {@link ng.$http $http} or {@link ngResource.$resource $resource}.\n *\n * During testing this implementation is swapped with {@link ngMock.$httpBackend mock\n * $httpBackend} which can be trained with responses.\n */\nfunction $HttpBackendProvider() {\n  this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) {\n    return createHttpBackend($browser, createXhr, $browser.defer, $window.angular.callbacks, $document[0]);\n  }];\n}\n\nfunction createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {\n  var ABORTED = -1;\n\n  // TODO(vojta): fix the signature\n  return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {\n    var status;\n    $browser.$$incOutstandingRequestCount();\n    url = url || $browser.url();\n\n    if (lowercase(method) == 'jsonp') {\n      var callbackId = '_' + (callbacks.counter++).toString(36);\n      callbacks[callbackId] = function(data) {\n        callbacks[callbackId].data = data;\n        callbacks[callbackId].called = true;\n      };\n\n      var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),\n          callbackId, function(status, text) {\n        completeRequest(callback, status, callbacks[callbackId].data, \"\", text);\n        callbacks[callbackId] = noop;\n      });\n    } else {\n\n      var xhr = createXhr(method);\n\n      xhr.open(method, url, true);\n      forEach(headers, function(value, key) {\n        if (isDefined(value)) {\n            xhr.setRequestHeader(key, value);\n        }\n      });\n\n      // In IE6 and 7, this might be called synchronously when xhr.send below is called and the\n      // response is in the cache. the promise api will ensure that to the app code the api is\n      // always async\n      xhr.onreadystatechange = function() {\n        // onreadystatechange might get called multiple times with readyState === 4 on mobile webkit caused by\n        // xhrs that are resolved while the app is in the background (see #5426).\n        // since calling completeRequest sets the `xhr` variable to null, we just check if it's not null before\n        // continuing\n        //\n        // we can't set xhr.onreadystatechange to undefined or delete it because that breaks IE8 (method=PATCH) and\n        // Safari respectively.\n        if (xhr && xhr.readyState == 4) {\n          var responseHeaders = null,\n              response = null;\n\n          if(status !== ABORTED) {\n            responseHeaders = xhr.getAllResponseHeaders();\n\n            // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n            // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n            response = ('response' in xhr) ? xhr.response : xhr.responseText;\n          }\n\n          completeRequest(callback,\n              status || xhr.status,\n              response,\n              responseHeaders,\n              xhr.statusText || '');\n        }\n      };\n\n      if (withCredentials) {\n        xhr.withCredentials = true;\n      }\n\n      if (responseType) {\n        try {\n          xhr.responseType = responseType;\n        } catch (e) {\n          // WebKit added support for the json responseType value on 09/03/2013\n          // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are\n          // known to throw when setting the value \"json\" as the response type. Other older\n          // browsers implementing the responseType\n          //\n          // The json response type can be ignored if not supported, because JSON payloads are\n          // parsed on the client-side regardless.\n          if (responseType !== 'json') {\n            throw e;\n          }\n        }\n      }\n\n      xhr.send(post || null);\n    }\n\n    if (timeout > 0) {\n      var timeoutId = $browserDefer(timeoutRequest, timeout);\n    } else if (timeout && timeout.then) {\n      timeout.then(timeoutRequest);\n    }\n\n\n    function timeoutRequest() {\n      status = ABORTED;\n      jsonpDone && jsonpDone();\n      xhr && xhr.abort();\n    }\n\n    function completeRequest(callback, status, response, headersString, statusText) {\n      // cancel timeout and subsequent timeout promise resolution\n      timeoutId && $browserDefer.cancel(timeoutId);\n      jsonpDone = xhr = null;\n\n      // fix status code when it is 0 (0 status is undocumented).\n      // Occurs when accessing file resources or on Android 4.1 stock browser\n      // while retrieving files from application cache.\n      if (status === 0) {\n        status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;\n      }\n\n      // normalize IE bug (http://bugs.jquery.com/ticket/1450)\n      status = status === 1223 ? 204 : status;\n      statusText = statusText || '';\n\n      callback(status, response, headersString, statusText);\n      $browser.$$completeOutstandingRequest(noop);\n    }\n  };\n\n  function jsonpReq(url, callbackId, done) {\n    // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:\n    // - fetches local scripts via XHR and evals them\n    // - adds and immediately removes script elements from the document\n    var script = rawDocument.createElement('script'), callback = null;\n    script.type = \"text/javascript\";\n    script.src = url;\n    script.async = true;\n\n    callback = function(event) {\n      removeEventListenerFn(script, \"load\", callback);\n      removeEventListenerFn(script, \"error\", callback);\n      rawDocument.body.removeChild(script);\n      script = null;\n      var status = -1;\n      var text = \"unknown\";\n\n      if (event) {\n        if (event.type === \"load\" && !callbacks[callbackId].called) {\n          event = { type: \"error\" };\n        }\n        text = event.type;\n        status = event.type === \"error\" ? 404 : 200;\n      }\n\n      if (done) {\n        done(status, text);\n      }\n    };\n\n    addEventListenerFn(script, \"load\", callback);\n    addEventListenerFn(script, \"error\", callback);\n\n    if (msie <= 8) {\n      script.onreadystatechange = function() {\n        if (isString(script.readyState) && /loaded|complete/.test(script.readyState)) {\n          script.onreadystatechange = null;\n          callback({\n            type: 'load'\n          });\n        }\n      };\n    }\n\n    rawDocument.body.appendChild(script);\n    return callback;\n  }\n}\n\nvar $interpolateMinErr = minErr('$interpolate');\n\n/**\n * @ngdoc provider\n * @name $interpolateProvider\n * @kind function\n *\n * @description\n *\n * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.\n *\n * @example\n<example module=\"customInterpolationApp\">\n<file name=\"index.html\">\n<script>\n  var customInterpolationApp = angular.module('customInterpolationApp', []);\n\n  customInterpolationApp.config(function($interpolateProvider) {\n    $interpolateProvider.startSymbol('//');\n    $interpolateProvider.endSymbol('//');\n  });\n\n\n  customInterpolationApp.controller('DemoController', function() {\n      this.label = \"This binding is brought you by // interpolation symbols.\";\n  });\n</script>\n<div ng-app=\"App\" ng-controller=\"DemoController as demo\">\n    //demo.label//\n</div>\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  it('should interpolate binding with custom symbols', function() {\n    expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');\n  });\n</file>\n</example>\n */\nfunction $InterpolateProvider() {\n  var startSymbol = '{{';\n  var endSymbol = '}}';\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#startSymbol\n   * @description\n   * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.\n   *\n   * @param {string=} value new value to set the starting symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.startSymbol = function(value){\n    if (value) {\n      startSymbol = value;\n      return this;\n    } else {\n      return startSymbol;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#endSymbol\n   * @description\n   * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n   *\n   * @param {string=} value new value to set the ending symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.endSymbol = function(value){\n    if (value) {\n      endSymbol = value;\n      return this;\n    } else {\n      return endSymbol;\n    }\n  };\n\n\n  this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {\n    var startSymbolLength = startSymbol.length,\n        endSymbolLength = endSymbol.length;\n\n    /**\n     * @ngdoc service\n     * @name $interpolate\n     * @kind function\n     *\n     * @requires $parse\n     * @requires $sce\n     *\n     * @description\n     *\n     * Compiles a string with markup into an interpolation function. This service is used by the\n     * HTML {@link ng.$compile $compile} service for data binding. See\n     * {@link ng.$interpolateProvider $interpolateProvider} for configuring the\n     * interpolation markup.\n     *\n     *\n     * ```js\n     *   var $interpolate = ...; // injected\n     *   var exp = $interpolate('Hello {{name | uppercase}}!');\n     *   expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!');\n     * ```\n     *\n     *\n     * @param {string} text The text with markup to interpolate.\n     * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have\n     *    embedded expression in order to return an interpolation function. Strings with no\n     *    embedded expression will return null for the interpolation function.\n     * @param {string=} trustedContext when provided, the returned function passes the interpolated\n     *    result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,\n     *    trustedContext)} before returning it.  Refer to the {@link ng.$sce $sce} service that\n     *    provides Strict Contextual Escaping for details.\n     * @returns {function(context)} an interpolation function which is used to compute the\n     *    interpolated string. The function has these parameters:\n     *\n     *    * `context`: an object against which any expressions embedded in the strings are evaluated\n     *      against.\n     *\n     */\n    function $interpolate(text, mustHaveExpression, trustedContext) {\n      var startIndex,\n          endIndex,\n          index = 0,\n          parts = [],\n          length = text.length,\n          hasInterpolation = false,\n          fn,\n          exp,\n          concat = [];\n\n      while(index < length) {\n        if ( ((startIndex = text.indexOf(startSymbol, index)) != -1) &&\n             ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1) ) {\n          (index != startIndex) && parts.push(text.substring(index, startIndex));\n          parts.push(fn = $parse(exp = text.substring(startIndex + startSymbolLength, endIndex)));\n          fn.exp = exp;\n          index = endIndex + endSymbolLength;\n          hasInterpolation = true;\n        } else {\n          // we did not find anything, so we have to add the remainder to the parts array\n          (index != length) && parts.push(text.substring(index));\n          index = length;\n        }\n      }\n\n      if (!(length = parts.length)) {\n        // we added, nothing, must have been an empty string.\n        parts.push('');\n        length = 1;\n      }\n\n      // Concatenating expressions makes it hard to reason about whether some combination of\n      // concatenated values are unsafe to use and could easily lead to XSS.  By requiring that a\n      // single expression be used for iframe[src], object[src], etc., we ensure that the value\n      // that's used is assigned or constructed by some JS code somewhere that is more testable or\n      // make it obvious that you bound the value to some user controlled value.  This helps reduce\n      // the load when auditing for XSS issues.\n      if (trustedContext && parts.length > 1) {\n          throw $interpolateMinErr('noconcat',\n              \"Error while interpolating: {0}\\nStrict Contextual Escaping disallows \" +\n              \"interpolations that concatenate multiple expressions when a trusted value is \" +\n              \"required.  See http://docs.angularjs.org/api/ng.$sce\", text);\n      }\n\n      if (!mustHaveExpression  || hasInterpolation) {\n        concat.length = length;\n        fn = function(context) {\n          try {\n            for(var i = 0, ii = length, part; i<ii; i++) {\n              if (typeof (part = parts[i]) == 'function') {\n                part = part(context);\n                if (trustedContext) {\n                  part = $sce.getTrusted(trustedContext, part);\n                } else {\n                  part = $sce.valueOf(part);\n                }\n                if (part == null) { // null || undefined\n                  part = '';\n                } else {\n                  switch (typeof part) {\n                    case 'string':\n                    {\n                      break;\n                    }\n                    case 'number':\n                    {\n                      part = '' + part;\n                      break;\n                    }\n                    default:\n                    {\n                      part = toJson(part);\n                    }\n                  }\n                }\n              }\n              concat[i] = part;\n            }\n            return concat.join('');\n          }\n          catch(err) {\n            var newErr = $interpolateMinErr('interr', \"Can't interpolate: {0}\\n{1}\", text,\n                err.toString());\n            $exceptionHandler(newErr);\n          }\n        };\n        fn.exp = text;\n        fn.parts = parts;\n        return fn;\n      }\n    }\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#startSymbol\n     * @description\n     * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.\n     *\n     * Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change\n     * the symbol.\n     *\n     * @returns {string} start symbol.\n     */\n    $interpolate.startSymbol = function() {\n      return startSymbol;\n    };\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#endSymbol\n     * @description\n     * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n     *\n     * Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change\n     * the symbol.\n     *\n     * @returns {string} end symbol.\n     */\n    $interpolate.endSymbol = function() {\n      return endSymbol;\n    };\n\n    return $interpolate;\n  }];\n}\n\nfunction $IntervalProvider() {\n  this.$get = ['$rootScope', '$window', '$q',\n       function($rootScope,   $window,   $q) {\n    var intervals = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $interval\n      *\n      * @description\n      * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`\n      * milliseconds.\n      *\n      * The return value of registering an interval function is a promise. This promise will be\n      * notified upon each tick of the interval, and will be resolved after `count` iterations, or\n      * run indefinitely if `count` is not defined. The value of the notification will be the\n      * number of iterations that have run.\n      * To cancel an interval, call `$interval.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to\n      * move forward by `millis` milliseconds and trigger any functions scheduled to run in that\n      * time.\n      *\n      * <div class=\"alert alert-warning\">\n      * **Note**: Intervals created by this service must be explicitly destroyed when you are finished\n      * with them.  In particular they are not automatically destroyed when a controller's scope or a\n      * directive's element are destroyed.\n      * You should take this into consideration and make sure to always cancel the interval at the\n      * appropriate moment.  See the example below for more details on how and when to do this.\n      * </div>\n      *\n      * @param {function()} fn A function that should be called repeatedly.\n      * @param {number} delay Number of milliseconds between each function call.\n      * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat\n      *   indefinitely.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @returns {promise} A promise which will be notified on each iteration.\n      *\n      * @example\n      * <example module=\"time\">\n      *   <file name=\"index.html\">\n      *     <script>\n      *       function Ctrl2($scope,$interval) {\n      *         $scope.format = 'M/d/yy h:mm:ss a';\n      *         $scope.blood_1 = 100;\n      *         $scope.blood_2 = 120;\n      *\n      *         var stop;\n      *         $scope.fight = function() {\n      *           // Don't start a new fight if we are already fighting\n      *           if ( angular.isDefined(stop) ) return;\n      *\n      *           stop = $interval(function() {\n      *             if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {\n      *                 $scope.blood_1 = $scope.blood_1 - 3;\n      *                 $scope.blood_2 = $scope.blood_2 - 4;\n      *             } else {\n      *                 $scope.stopFight();\n      *             }\n      *           }, 100);\n      *         };\n      *\n      *         $scope.stopFight = function() {\n      *           if (angular.isDefined(stop)) {\n      *             $interval.cancel(stop);\n      *             stop = undefined;\n      *           }\n      *         };\n      *\n      *         $scope.resetFight = function() {\n      *           $scope.blood_1 = 100;\n      *           $scope.blood_2 = 120;\n      *         }\n      *\n      *         $scope.$on('$destroy', function() {\n      *           // Make sure that the interval is destroyed too\n      *           $scope.stopFight();\n      *         });\n      *       }\n      *\n      *       angular.module('time', [])\n      *         // Register the 'myCurrentTime' directive factory method.\n      *         // We inject $interval and dateFilter service since the factory method is DI.\n      *         .directive('myCurrentTime', function($interval, dateFilter) {\n      *           // return the directive link function. (compile function not needed)\n      *           return function(scope, element, attrs) {\n      *             var format,  // date format\n      *             stopTime; // so that we can cancel the time updates\n      *\n      *             // used to update the UI\n      *             function updateTime() {\n      *               element.text(dateFilter(new Date(), format));\n      *             }\n      *\n      *             // watch the expression, and update the UI on change.\n      *             scope.$watch(attrs.myCurrentTime, function(value) {\n      *               format = value;\n      *               updateTime();\n      *             });\n      *\n      *             stopTime = $interval(updateTime, 1000);\n      *\n      *             // listen on DOM destroy (removal) event, and cancel the next UI update\n      *             // to prevent updating time ofter the DOM element was removed.\n      *             element.bind('$destroy', function() {\n      *               $interval.cancel(stopTime);\n      *             });\n      *           }\n      *         });\n      *     </script>\n      *\n      *     <div>\n      *       <div ng-controller=\"Ctrl2\">\n      *         Date format: <input ng-model=\"format\"> <hr/>\n      *         Current time is: <span my-current-time=\"format\"></span>\n      *         <hr/>\n      *         Blood 1 : <font color='red'>{{blood_1}}</font>\n      *         Blood 2 : <font color='red'>{{blood_2}}</font>\n      *         <button type=\"button\" data-ng-click=\"fight()\">Fight</button>\n      *         <button type=\"button\" data-ng-click=\"stopFight()\">StopFight</button>\n      *         <button type=\"button\" data-ng-click=\"resetFight()\">resetFight</button>\n      *       </div>\n      *     </div>\n      *\n      *   </file>\n      * </example>\n      */\n    function interval(fn, delay, count, invokeApply) {\n      var setInterval = $window.setInterval,\n          clearInterval = $window.clearInterval,\n          deferred = $q.defer(),\n          promise = deferred.promise,\n          iteration = 0,\n          skipApply = (isDefined(invokeApply) && !invokeApply);\n\n      count = isDefined(count) ? count : 0;\n\n      promise.then(null, null, fn);\n\n      promise.$$intervalId = setInterval(function tick() {\n        deferred.notify(iteration++);\n\n        if (count > 0 && iteration >= count) {\n          deferred.resolve(iteration);\n          clearInterval(promise.$$intervalId);\n          delete intervals[promise.$$intervalId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n\n      }, delay);\n\n      intervals[promise.$$intervalId] = deferred;\n\n      return promise;\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $interval#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`.\n      *\n      * @param {promise} promise returned by the `$interval` function.\n      * @returns {boolean} Returns `true` if the task was successfully canceled.\n      */\n    interval.cancel = function(promise) {\n      if (promise && promise.$$intervalId in intervals) {\n        intervals[promise.$$intervalId].reject('canceled');\n        clearInterval(promise.$$intervalId);\n        delete intervals[promise.$$intervalId];\n        return true;\n      }\n      return false;\n    };\n\n    return interval;\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $locale\n *\n * @description\n * $locale service provides localization rules for various Angular components. As of right now the\n * only public api is:\n *\n * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)\n */\nfunction $LocaleProvider(){\n  this.$get = function() {\n    return {\n      id: 'en-us',\n\n      NUMBER_FORMATS: {\n        DECIMAL_SEP: '.',\n        GROUP_SEP: ',',\n        PATTERNS: [\n          { // Decimal Pattern\n            minInt: 1,\n            minFrac: 0,\n            maxFrac: 3,\n            posPre: '',\n            posSuf: '',\n            negPre: '-',\n            negSuf: '',\n            gSize: 3,\n            lgSize: 3\n          },{ //Currency Pattern\n            minInt: 1,\n            minFrac: 2,\n            maxFrac: 2,\n            posPre: '\\u00A4',\n            posSuf: '',\n            negPre: '(\\u00A4',\n            negSuf: ')',\n            gSize: 3,\n            lgSize: 3\n          }\n        ],\n        CURRENCY_SYM: '$'\n      },\n\n      DATETIME_FORMATS: {\n        MONTH:\n            'January,February,March,April,May,June,July,August,September,October,November,December'\n            .split(','),\n        SHORTMONTH:  'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),\n        DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),\n        SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),\n        AMPMS: ['AM','PM'],\n        medium: 'MMM d, y h:mm:ss a',\n        short: 'M/d/yy h:mm a',\n        fullDate: 'EEEE, MMMM d, y',\n        longDate: 'MMMM d, y',\n        mediumDate: 'MMM d, y',\n        shortDate: 'M/d/yy',\n        mediumTime: 'h:mm:ss a',\n        shortTime: 'h:mm a'\n      },\n\n      pluralCat: function(num) {\n        if (num === 1) {\n          return 'one';\n        }\n        return 'other';\n      }\n    };\n  };\n}\n\nvar PATH_MATCH = /^([^\\?#]*)(\\?([^#]*))?(#(.*))?$/,\n    DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};\nvar $locationMinErr = minErr('$location');\n\n\n/**\n * Encode path using encodeUriSegment, ignoring forward slashes\n *\n * @param {string} path Path to encode\n * @returns {string}\n */\nfunction encodePath(path) {\n  var segments = path.split('/'),\n      i = segments.length;\n\n  while (i--) {\n    segments[i] = encodeUriSegment(segments[i]);\n  }\n\n  return segments.join('/');\n}\n\nfunction parseAbsoluteUrl(absoluteUrl, locationObj, appBase) {\n  var parsedUrl = urlResolve(absoluteUrl, appBase);\n\n  locationObj.$$protocol = parsedUrl.protocol;\n  locationObj.$$host = parsedUrl.hostname;\n  locationObj.$$port = int(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;\n}\n\n\nfunction parseAppUrl(relativeUrl, locationObj, appBase) {\n  var prefixed = (relativeUrl.charAt(0) !== '/');\n  if (prefixed) {\n    relativeUrl = '/' + relativeUrl;\n  }\n  var match = urlResolve(relativeUrl, appBase);\n  locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?\n      match.pathname.substring(1) : match.pathname);\n  locationObj.$$search = parseKeyValue(match.search);\n  locationObj.$$hash = decodeURIComponent(match.hash);\n\n  // make sure path starts with '/';\n  if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {\n    locationObj.$$path = '/' + locationObj.$$path;\n  }\n}\n\n\n/**\n *\n * @param {string} begin\n * @param {string} whole\n * @returns {string} returns text from whole after begin or undefined if it does not begin with\n *                   expected string.\n */\nfunction beginsWith(begin, whole) {\n  if (whole.indexOf(begin) === 0) {\n    return whole.substr(begin.length);\n  }\n}\n\n\nfunction stripHash(url) {\n  var index = url.indexOf('#');\n  return index == -1 ? url : url.substr(0, index);\n}\n\n\nfunction stripFile(url) {\n  return url.substr(0, stripHash(url).lastIndexOf('/') + 1);\n}\n\n/* return the server only (scheme://host:port) */\nfunction serverBase(url) {\n  return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));\n}\n\n\n/**\n * LocationHtml5Url represents an url\n * This object is exposed as $location service when HTML5 mode is enabled and supported\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} basePrefix url path prefix\n */\nfunction LocationHtml5Url(appBase, basePrefix) {\n  this.$$html5 = true;\n  basePrefix = basePrefix || '';\n  var appBaseNoFile = stripFile(appBase);\n  parseAbsoluteUrl(appBase, this, appBase);\n\n\n  /**\n   * Parse given html5 (regular) url string into properties\n   * @param {string} newAbsoluteUrl HTML5 url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var pathUrl = beginsWith(appBaseNoFile, url);\n    if (!isString(pathUrl)) {\n      throw $locationMinErr('ipthprfx', 'Invalid url \"{0}\", missing path prefix \"{1}\".', url,\n          appBaseNoFile);\n    }\n\n    parseAppUrl(pathUrl, this, appBase);\n\n    if (!this.$$path) {\n      this.$$path = '/';\n    }\n\n    this.$$compose();\n  };\n\n  /**\n   * Compose url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'\n  };\n\n  this.$$rewrite = function(url) {\n    var appUrl, prevAppUrl;\n\n    if ( (appUrl = beginsWith(appBase, url)) !== undefined ) {\n      prevAppUrl = appUrl;\n      if ( (appUrl = beginsWith(basePrefix, appUrl)) !== undefined ) {\n        return appBaseNoFile + (beginsWith('/', appUrl) || appUrl);\n      } else {\n        return appBase + prevAppUrl;\n      }\n    } else if ( (appUrl = beginsWith(appBaseNoFile, url)) !== undefined ) {\n      return appBaseNoFile + appUrl;\n    } else if (appBaseNoFile == url + '/') {\n      return appBaseNoFile;\n    }\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when developer doesn't opt into html5 mode.\n * It also serves as the base class for html5 mode fallback on legacy browsers.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangUrl(appBase, hashPrefix) {\n  var appBaseNoFile = stripFile(appBase);\n\n  parseAbsoluteUrl(appBase, this, appBase);\n\n\n  /**\n   * Parse given hashbang url into properties\n   * @param {string} url Hashbang url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);\n    var withoutHashUrl = withoutBaseUrl.charAt(0) == '#'\n        ? beginsWith(hashPrefix, withoutBaseUrl)\n        : (this.$$html5)\n          ? withoutBaseUrl\n          : '';\n\n    if (!isString(withoutHashUrl)) {\n      throw $locationMinErr('ihshprfx', 'Invalid url \"{0}\", missing hash prefix \"{1}\".', url,\n          hashPrefix);\n    }\n    parseAppUrl(withoutHashUrl, this, appBase);\n\n    this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);\n\n    this.$$compose();\n\n    /*\n     * In Windows, on an anchor node on documents loaded from\n     * the filesystem, the browser will return a pathname\n     * prefixed with the drive name ('/C:/path') when a\n     * pathname without a drive is set:\n     *  * a.setAttribute('href', '/foo')\n     *   * a.pathname === '/C:/foo' //true\n     *\n     * Inside of Angular, we're always using pathnames that\n     * do not include drive names for routing.\n     */\n    function removeWindowsDriveName (path, url, base) {\n      /*\n      Matches paths for file protocol on windows,\n      such as /C:/foo/bar, and captures only /foo/bar.\n      */\n      var windowsFilePathExp = /^\\/[A-Z]:(\\/.*)/;\n\n      var firstPathSegmentMatch;\n\n      //Get the relative path from the input URL.\n      if (url.indexOf(base) === 0) {\n        url = url.replace(base, '');\n      }\n\n      // The input URL intentionally contains a first path segment that ends with a colon.\n      if (windowsFilePathExp.exec(url)) {\n        return path;\n      }\n\n      firstPathSegmentMatch = windowsFilePathExp.exec(path);\n      return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;\n    }\n  };\n\n  /**\n   * Compose hashbang url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');\n  };\n\n  this.$$rewrite = function(url) {\n    if(stripHash(appBase) == stripHash(url)) {\n      return url;\n    }\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when html5 history api is enabled but the browser\n * does not support it.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangInHtml5Url(appBase, hashPrefix) {\n  this.$$html5 = true;\n  LocationHashbangUrl.apply(this, arguments);\n\n  var appBaseNoFile = stripFile(appBase);\n\n  this.$$rewrite = function(url) {\n    var appUrl;\n\n    if ( appBase == stripHash(url) ) {\n      return url;\n    } else if ( (appUrl = beginsWith(appBaseNoFile, url)) ) {\n      return appBase + hashPrefix + appUrl;\n    } else if ( appBaseNoFile === url + '/') {\n      return appBaseNoFile;\n    }\n  };\n\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    // include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#'\n    this.$$absUrl = appBase + hashPrefix + this.$$url;\n  };\n\n}\n\n\nLocationHashbangInHtml5Url.prototype =\n  LocationHashbangUrl.prototype =\n  LocationHtml5Url.prototype = {\n\n  /**\n   * Are we in html5 mode?\n   * @private\n   */\n  $$html5: false,\n\n  /**\n   * Has any change been replacing ?\n   * @private\n   */\n  $$replace: false,\n\n  /**\n   * @ngdoc method\n   * @name $location#absUrl\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return full url representation with all segments encoded according to rules specified in\n   * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).\n   *\n   * @return {string} full url\n   */\n  absUrl: locationGetter('$$absUrl'),\n\n  /**\n   * @ngdoc method\n   * @name $location#url\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return url (e.g. `/path?a=b#hash`) when called without any parameter.\n   *\n   * Change path, search and hash, when called with parameter and return `$location`.\n   *\n   * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)\n   * @param {string=} replace The path that will be changed\n   * @return {string} url\n   */\n  url: function(url, replace) {\n    if (isUndefined(url))\n      return this.$$url;\n\n    var match = PATH_MATCH.exec(url);\n    if (match[1]) this.path(decodeURIComponent(match[1]));\n    if (match[2] || match[1]) this.search(match[3] || '');\n    this.hash(match[5] || '', replace);\n\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#protocol\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return protocol of current url.\n   *\n   * @return {string} protocol of current url\n   */\n  protocol: locationGetter('$$protocol'),\n\n  /**\n   * @ngdoc method\n   * @name $location#host\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return host of current url.\n   *\n   * @return {string} host of current url.\n   */\n  host: locationGetter('$$host'),\n\n  /**\n   * @ngdoc method\n   * @name $location#port\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return port of current url.\n   *\n   * @return {Number} port\n   */\n  port: locationGetter('$$port'),\n\n  /**\n   * @ngdoc method\n   * @name $location#path\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return path of current url when called without any parameter.\n   *\n   * Change path when called with parameter and return `$location`.\n   *\n   * Note: Path should always begin with forward slash (/), this method will add the forward slash\n   * if it is missing.\n   *\n   * @param {string=} path New path\n   * @return {string} path\n   */\n  path: locationGetterSetter('$$path', function(path) {\n    return path.charAt(0) == '/' ? path : '/' + path;\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#search\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return search part (as object) of current url when called without any parameter.\n   *\n   * Change search part when called with parameter and return `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var searchObject = $location.search();\n   * // => {foo: 'bar', baz: 'xoxo'}\n   *\n   *\n   * // set foo to 'yipee'\n   * $location.search('foo', 'yipee');\n   * // => $location\n   * ```\n   *\n   * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or\n   * hash object.\n   *\n   * When called with a single argument the method acts as a setter, setting the `search` component\n   * of `$location` to the specified value.\n   *\n   * If the argument is a hash object containing an array of values, these values will be encoded\n   * as duplicate search parameters in the url.\n   *\n   * @param {(string|Array<string>)=} paramValue If `search` is a string, then `paramValue` will\n   * override only a single search property.\n   *\n   * If `paramValue` is an array, it will override the property of the `search` component of\n   * `$location` specified via the first argument.\n   *\n   * If `paramValue` is `null`, the property specified via the first argument will be deleted.\n   *\n   * @return {Object} If called with no arguments returns the parsed `search` object. If called with\n   * one or more arguments returns `$location` object itself.\n   */\n  search: function(search, paramValue) {\n    switch (arguments.length) {\n      case 0:\n        return this.$$search;\n      case 1:\n        if (isString(search)) {\n          this.$$search = parseKeyValue(search);\n        } else if (isObject(search)) {\n          this.$$search = search;\n        } else {\n          throw $locationMinErr('isrcharg',\n              'The first argument of the `$location#search()` call must be a string or an object.');\n        }\n        break;\n      default:\n        if (isUndefined(paramValue) || paramValue === null) {\n          delete this.$$search[search];\n        } else {\n          this.$$search[search] = paramValue;\n        }\n    }\n\n    this.$$compose();\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#hash\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return hash fragment when called without any parameter.\n   *\n   * Change hash fragment when called with parameter and return `$location`.\n   *\n   * @param {string=} hash New hash fragment\n   * @return {string} hash\n   */\n  hash: locationGetterSetter('$$hash', identity),\n\n  /**\n   * @ngdoc method\n   * @name $location#replace\n   *\n   * @description\n   * If called, all changes to $location during current `$digest` will be replacing current history\n   * record, instead of adding new one.\n   */\n  replace: function() {\n    this.$$replace = true;\n    return this;\n  }\n};\n\nfunction locationGetter(property) {\n  return function() {\n    return this[property];\n  };\n}\n\n\nfunction locationGetterSetter(property, preprocess) {\n  return function(value) {\n    if (isUndefined(value))\n      return this[property];\n\n    this[property] = preprocess(value);\n    this.$$compose();\n\n    return this;\n  };\n}\n\n\n/**\n * @ngdoc service\n * @name $location\n *\n * @requires $rootElement\n *\n * @description\n * The $location service parses the URL in the browser address bar (based on the\n * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL\n * available to your application. Changes to the URL in the address bar are reflected into\n * $location service and changes to $location are reflected into the browser address bar.\n *\n * **The $location service:**\n *\n * - Exposes the current URL in the browser address bar, so you can\n *   - Watch and observe the URL.\n *   - Change the URL.\n * - Synchronizes the URL with the browser when the user\n *   - Changes the address bar.\n *   - Clicks the back or forward button (or clicks a History link).\n *   - Clicks on a link.\n * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).\n *\n * For more information see {@link guide/$location Developer Guide: Using $location}\n */\n\n/**\n * @ngdoc provider\n * @name $locationProvider\n * @description\n * Use the `$locationProvider` to configure how the application deep linking paths are stored.\n */\nfunction $LocationProvider(){\n  var hashPrefix = '',\n      html5Mode = false;\n\n  /**\n   * @ngdoc property\n   * @name $locationProvider#hashPrefix\n   * @description\n   * @param {string=} prefix Prefix for hash part (containing path and search)\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.hashPrefix = function(prefix) {\n    if (isDefined(prefix)) {\n      hashPrefix = prefix;\n      return this;\n    } else {\n      return hashPrefix;\n    }\n  };\n\n  /**\n   * @ngdoc property\n   * @name $locationProvider#html5Mode\n   * @description\n   * @param {boolean=} mode Use HTML5 strategy if available.\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.html5Mode = function(mode) {\n    if (isDefined(mode)) {\n      html5Mode = mode;\n      return this;\n    } else {\n      return html5Mode;\n    }\n  };\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeStart\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted before a URL will change. This change can be prevented by calling\n   * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more\n   * details about event object. Upon successful change\n   * {@link ng.$location#events_$locationChangeSuccess $locationChangeSuccess} is fired.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   */\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeSuccess\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted after a URL was changed.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   */\n\n  this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement',\n      function( $rootScope,   $browser,   $sniffer,   $rootElement) {\n    var $location,\n        LocationMode,\n        baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''\n        initialUrl = $browser.url(),\n        appBase;\n\n    if (html5Mode) {\n      appBase = serverBase(initialUrl) + (baseHref || '/');\n      LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;\n    } else {\n      appBase = stripHash(initialUrl);\n      LocationMode = LocationHashbangUrl;\n    }\n    $location = new LocationMode(appBase, '#' + hashPrefix);\n    $location.$$parse($location.$$rewrite(initialUrl));\n\n    $rootElement.on('click', function(event) {\n      // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)\n      // currently we open nice url link and redirect then\n\n      if (event.ctrlKey || event.metaKey || event.which == 2) return;\n\n      var elm = jqLite(event.target);\n\n      // traverse the DOM up to find first A tag\n      while (lowercase(elm[0].nodeName) !== 'a') {\n        // ignore rewriting if no A tag (reached root element, or no parent - removed from document)\n        if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;\n      }\n\n      var absHref = elm.prop('href');\n\n      if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {\n        // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during\n        // an animation.\n        absHref = urlResolve(absHref.animVal).href;\n      }\n\n      // Make relative links work in HTML5 mode for legacy browsers (or at least IE8 & 9)\n      // The href should be a regular url e.g. /link/somewhere or link/somewhere or ../somewhere or\n      // somewhere#anchor or http://example.com/somewhere\n      if (LocationMode === LocationHashbangInHtml5Url) {\n        // get the actual href attribute - see\n        // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx\n        var href = elm.attr('href') || elm.attr('xlink:href');\n\n        if (href.indexOf('://') < 0) {         // Ignore absolute URLs\n          var prefix = '#' + hashPrefix;\n          if (href[0] == '/') {\n            // absolute path - replace old path\n            absHref = appBase + prefix + href;\n          } else if (href[0] == '#') {\n            // local anchor\n            absHref = appBase + prefix + ($location.path() || '/') + href;\n          } else {\n            // relative path - join with current path\n            var stack = $location.path().split(\"/\"),\n              parts = href.split(\"/\");\n            for (var i=0; i<parts.length; i++) {\n              if (parts[i] == \".\")\n                continue;\n              else if (parts[i] == \"..\")\n                stack.pop();\n              else if (parts[i].length)\n                stack.push(parts[i]);\n            }\n            absHref = appBase + prefix + stack.join('/');\n          }\n        }\n      }\n\n      var rewrittenUrl = $location.$$rewrite(absHref);\n\n      if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) {\n        event.preventDefault();\n        if (rewrittenUrl != $browser.url()) {\n          // update location manually\n          $location.$$parse(rewrittenUrl);\n          $rootScope.$apply();\n          // hack to work around FF6 bug 684208 when scenario runner clicks on links\n          window.angular['ff-684208-preventDefault'] = true;\n        }\n      }\n    });\n\n\n    // rewrite hashbang url <> html5 url\n    if ($location.absUrl() != initialUrl) {\n      $browser.url($location.absUrl(), true);\n    }\n\n    // update $location when $browser url changes\n    $browser.onUrlChange(function(newUrl) {\n      if ($location.absUrl() != newUrl) {\n        $rootScope.$evalAsync(function() {\n          var oldUrl = $location.absUrl();\n\n          $location.$$parse(newUrl);\n          if ($rootScope.$broadcast('$locationChangeStart', newUrl,\n                                    oldUrl).defaultPrevented) {\n            $location.$$parse(oldUrl);\n            $browser.url(oldUrl);\n          } else {\n            afterLocationChange(oldUrl);\n          }\n        });\n        if (!$rootScope.$$phase) $rootScope.$digest();\n      }\n    });\n\n    // update browser\n    var changeCounter = 0;\n    $rootScope.$watch(function $locationWatch() {\n      var oldUrl = $browser.url();\n      var currentReplace = $location.$$replace;\n\n      if (!changeCounter || oldUrl != $location.absUrl()) {\n        changeCounter++;\n        $rootScope.$evalAsync(function() {\n          if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl).\n              defaultPrevented) {\n            $location.$$parse(oldUrl);\n          } else {\n            $browser.url($location.absUrl(), currentReplace);\n            afterLocationChange(oldUrl);\n          }\n        });\n      }\n      $location.$$replace = false;\n\n      return changeCounter;\n    });\n\n    return $location;\n\n    function afterLocationChange(oldUrl) {\n      $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl);\n    }\n}];\n}\n\n/**\n * @ngdoc service\n * @name $log\n * @requires $window\n *\n * @description\n * Simple service for logging. Default implementation safely writes the message\n * into the browser's console (if present).\n *\n * The main purpose of this service is to simplify debugging and troubleshooting.\n *\n * The default is to log `debug` messages. You can use\n * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.\n *\n * @example\n   <example>\n     <file name=\"script.js\">\n       function LogCtrl($scope, $log) {\n         $scope.$log = $log;\n         $scope.message = 'Hello World!';\n       }\n     </file>\n     <file name=\"index.html\">\n       <div ng-controller=\"LogCtrl\">\n         <p>Reload this page with open console, enter text and hit the log button...</p>\n         Message:\n         <input type=\"text\" ng-model=\"message\"/>\n         <button ng-click=\"$log.log(message)\">log</button>\n         <button ng-click=\"$log.warn(message)\">warn</button>\n         <button ng-click=\"$log.info(message)\">info</button>\n         <button ng-click=\"$log.error(message)\">error</button>\n       </div>\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc provider\n * @name $logProvider\n * @description\n * Use the `$logProvider` to configure how the application logs messages\n */\nfunction $LogProvider(){\n  var debug = true,\n      self = this;\n\n  /**\n   * @ngdoc property\n   * @name $logProvider#debugEnabled\n   * @description\n   * @param {boolean=} flag enable or disable debug level messages\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.debugEnabled = function(flag) {\n    if (isDefined(flag)) {\n      debug = flag;\n    return this;\n    } else {\n      return debug;\n    }\n  };\n\n  this.$get = ['$window', function($window){\n    return {\n      /**\n       * @ngdoc method\n       * @name $log#log\n       *\n       * @description\n       * Write a log message\n       */\n      log: consoleLog('log'),\n\n      /**\n       * @ngdoc method\n       * @name $log#info\n       *\n       * @description\n       * Write an information message\n       */\n      info: consoleLog('info'),\n\n      /**\n       * @ngdoc method\n       * @name $log#warn\n       *\n       * @description\n       * Write a warning message\n       */\n      warn: consoleLog('warn'),\n\n      /**\n       * @ngdoc method\n       * @name $log#error\n       *\n       * @description\n       * Write an error message\n       */\n      error: consoleLog('error'),\n\n      /**\n       * @ngdoc method\n       * @name $log#debug\n       *\n       * @description\n       * Write a debug message\n       */\n      debug: (function () {\n        var fn = consoleLog('debug');\n\n        return function() {\n          if (debug) {\n            fn.apply(self, arguments);\n          }\n        };\n      }())\n    };\n\n    function formatError(arg) {\n      if (arg instanceof Error) {\n        if (arg.stack) {\n          arg = (arg.message && arg.stack.indexOf(arg.message) === -1)\n              ? 'Error: ' + arg.message + '\\n' + arg.stack\n              : arg.stack;\n        } else if (arg.sourceURL) {\n          arg = arg.message + '\\n' + arg.sourceURL + ':' + arg.line;\n        }\n      }\n      return arg;\n    }\n\n    function consoleLog(type) {\n      var console = $window.console || {},\n          logFn = console[type] || console.log || noop,\n          hasApply = false;\n\n      // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.\n      // The reason behind this is that console.log has type \"object\" in IE8...\n      try {\n        hasApply = !!logFn.apply;\n      } catch (e) {}\n\n      if (hasApply) {\n        return function() {\n          var args = [];\n          forEach(arguments, function(arg) {\n            args.push(formatError(arg));\n          });\n          return logFn.apply(console, args);\n        };\n      }\n\n      // we are IE which either doesn't have window.console => this is noop and we do nothing,\n      // or we are IE where console.log doesn't have apply so we log at least first 2 args\n      return function(arg1, arg2) {\n        logFn(arg1, arg2 == null ? '' : arg2);\n      };\n    }\n  }];\n}\n\nvar $parseMinErr = minErr('$parse');\nvar promiseWarningCache = {};\nvar promiseWarning;\n\n// Sandboxing Angular Expressions\n// ------------------------------\n// Angular expressions are generally considered safe because these expressions only have direct\n// access to $scope and locals. However, one can obtain the ability to execute arbitrary JS code by\n// obtaining a reference to native JS functions such as the Function constructor.\n//\n// As an example, consider the following Angular expression:\n//\n//   {}.toString.constructor(alert(\"evil JS code\"))\n//\n// We want to prevent this type of access. For the sake of performance, during the lexing phase we\n// disallow any \"dotted\" access to any member named \"constructor\".\n//\n// For reflective calls (a[b]) we check that the value of the lookup is not the Function constructor\n// while evaluating the expression, which is a stronger but more expensive test. Since reflective\n// calls are expensive anyway, this is not such a big deal compared to static dereferencing.\n//\n// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits\n// against the expression language, but not to prevent exploits that were enabled by exposing\n// sensitive JavaScript or browser apis on Scope. Exposing such objects on a Scope is never a good\n// practice and therefore we are not even trying to protect against interaction with an object\n// explicitly exposed in this way.\n//\n// A developer could foil the name check by aliasing the Function constructor under a different\n// name on the scope.\n//\n// In general, it is not possible to access a Window object from an angular expression unless a\n// window or some DOM object that has a reference to window is published onto a Scope.\n\nfunction ensureSafeMemberName(name, fullExpression) {\n  if (name === \"constructor\") {\n    throw $parseMinErr('isecfld',\n        'Referencing \"constructor\" field in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n  }\n  return name;\n}\n\nfunction ensureSafeObject(obj, fullExpression) {\n  // nifty check if obj is Function that is fast and works across iframes and other contexts\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n          'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isWindow(obj)\n        obj.document && obj.location && obj.alert && obj.setInterval) {\n      throw $parseMinErr('isecwindow',\n          'Referencing the Window in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isElement(obj)\n        obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {\n      throw $parseMinErr('isecdom',\n          'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    }\n  }\n  return obj;\n}\n\nvar OPERATORS = {\n    /* jshint bitwise : false */\n    'null':function(){return null;},\n    'true':function(){return true;},\n    'false':function(){return false;},\n    undefined:noop,\n    '+':function(self, locals, a,b){\n      a=a(self, locals); b=b(self, locals);\n      if (isDefined(a)) {\n        if (isDefined(b)) {\n          return a + b;\n        }\n        return a;\n      }\n      return isDefined(b)?b:undefined;},\n    '-':function(self, locals, a,b){\n          a=a(self, locals); b=b(self, locals);\n          return (isDefined(a)?a:0)-(isDefined(b)?b:0);\n        },\n    '*':function(self, locals, a,b){return a(self, locals)*b(self, locals);},\n    '/':function(self, locals, a,b){return a(self, locals)/b(self, locals);},\n    '%':function(self, locals, a,b){return a(self, locals)%b(self, locals);},\n    '^':function(self, locals, a,b){return a(self, locals)^b(self, locals);},\n    '=':noop,\n    '===':function(self, locals, a, b){return a(self, locals)===b(self, locals);},\n    '!==':function(self, locals, a, b){return a(self, locals)!==b(self, locals);},\n    '==':function(self, locals, a,b){return a(self, locals)==b(self, locals);},\n    '!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);},\n    '<':function(self, locals, a,b){return a(self, locals)<b(self, locals);},\n    '>':function(self, locals, a,b){return a(self, locals)>b(self, locals);},\n    '<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);},\n    '>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);},\n    '&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);},\n    '||':function(self, locals, a,b){return a(self, locals)||b(self, locals);},\n    '&':function(self, locals, a,b){return a(self, locals)&b(self, locals);},\n//    '|':function(self, locals, a,b){return a|b;},\n    '|':function(self, locals, a,b){return b(self, locals)(self, locals, a(self, locals));},\n    '!':function(self, locals, a){return !a(self, locals);}\n};\n/* jshint bitwise: true */\nvar ESCAPE = {\"n\":\"\\n\", \"f\":\"\\f\", \"r\":\"\\r\", \"t\":\"\\t\", \"v\":\"\\v\", \"'\":\"'\", '\"':'\"'};\n\n\n/////////////////////////////////////////\n\n\n/**\n * @constructor\n */\nvar Lexer = function (options) {\n  this.options = options;\n};\n\nLexer.prototype = {\n  constructor: Lexer,\n\n  lex: function (text) {\n    this.text = text;\n\n    this.index = 0;\n    this.ch = undefined;\n    this.lastCh = ':'; // can start regexp\n\n    this.tokens = [];\n\n    while (this.index < this.text.length) {\n      this.ch = this.text.charAt(this.index);\n      if (this.is('\"\\'')) {\n        this.readString(this.ch);\n      } else if (this.isNumber(this.ch) || this.is('.') && this.isNumber(this.peek())) {\n        this.readNumber();\n      } else if (this.isIdent(this.ch)) {\n        this.readIdent();\n      } else if (this.is('(){}[].,;:?')) {\n        this.tokens.push({\n          index: this.index,\n          text: this.ch\n        });\n        this.index++;\n      } else if (this.isWhitespace(this.ch)) {\n        this.index++;\n        continue;\n      } else {\n        var ch2 = this.ch + this.peek();\n        var ch3 = ch2 + this.peek(2);\n        var fn = OPERATORS[this.ch];\n        var fn2 = OPERATORS[ch2];\n        var fn3 = OPERATORS[ch3];\n        if (fn3) {\n          this.tokens.push({index: this.index, text: ch3, fn: fn3});\n          this.index += 3;\n        } else if (fn2) {\n          this.tokens.push({index: this.index, text: ch2, fn: fn2});\n          this.index += 2;\n        } else if (fn) {\n          this.tokens.push({\n            index: this.index,\n            text: this.ch,\n            fn: fn\n          });\n          this.index += 1;\n        } else {\n          this.throwError('Unexpected next character ', this.index, this.index + 1);\n        }\n      }\n      this.lastCh = this.ch;\n    }\n    return this.tokens;\n  },\n\n  is: function(chars) {\n    return chars.indexOf(this.ch) !== -1;\n  },\n\n  was: function(chars) {\n    return chars.indexOf(this.lastCh) !== -1;\n  },\n\n  peek: function(i) {\n    var num = i || 1;\n    return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;\n  },\n\n  isNumber: function(ch) {\n    return ('0' <= ch && ch <= '9');\n  },\n\n  isWhitespace: function(ch) {\n    // IE treats non-breaking space as \\u00A0\n    return (ch === ' ' || ch === '\\r' || ch === '\\t' ||\n            ch === '\\n' || ch === '\\v' || ch === '\\u00A0');\n  },\n\n  isIdent: function(ch) {\n    return ('a' <= ch && ch <= 'z' ||\n            'A' <= ch && ch <= 'Z' ||\n            '_' === ch || ch === '$');\n  },\n\n  isExpOperator: function(ch) {\n    return (ch === '-' || ch === '+' || this.isNumber(ch));\n  },\n\n  throwError: function(error, start, end) {\n    end = end || this.index;\n    var colStr = (isDefined(start)\n            ? 's ' + start +  '-' + this.index + ' [' + this.text.substring(start, end) + ']'\n            : ' ' + end);\n    throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',\n        error, colStr, this.text);\n  },\n\n  readNumber: function() {\n    var number = '';\n    var start = this.index;\n    while (this.index < this.text.length) {\n      var ch = lowercase(this.text.charAt(this.index));\n      if (ch == '.' || this.isNumber(ch)) {\n        number += ch;\n      } else {\n        var peekCh = this.peek();\n        if (ch == 'e' && this.isExpOperator(peekCh)) {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            peekCh && this.isNumber(peekCh) &&\n            number.charAt(number.length - 1) == 'e') {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            (!peekCh || !this.isNumber(peekCh)) &&\n            number.charAt(number.length - 1) == 'e') {\n          this.throwError('Invalid exponent');\n        } else {\n          break;\n        }\n      }\n      this.index++;\n    }\n    number = 1 * number;\n    this.tokens.push({\n      index: start,\n      text: number,\n      literal: true,\n      constant: true,\n      fn: function() { return number; }\n    });\n  },\n\n  readIdent: function() {\n    var parser = this;\n\n    var ident = '';\n    var start = this.index;\n\n    var lastDot, peekIndex, methodName, ch;\n\n    while (this.index < this.text.length) {\n      ch = this.text.charAt(this.index);\n      if (ch === '.' || this.isIdent(ch) || this.isNumber(ch)) {\n        if (ch === '.') lastDot = this.index;\n        ident += ch;\n      } else {\n        break;\n      }\n      this.index++;\n    }\n\n    //check if this is not a method invocation and if it is back out to last dot\n    if (lastDot) {\n      peekIndex = this.index;\n      while (peekIndex < this.text.length) {\n        ch = this.text.charAt(peekIndex);\n        if (ch === '(') {\n          methodName = ident.substr(lastDot - start + 1);\n          ident = ident.substr(0, lastDot - start);\n          this.index = peekIndex;\n          break;\n        }\n        if (this.isWhitespace(ch)) {\n          peekIndex++;\n        } else {\n          break;\n        }\n      }\n    }\n\n\n    var token = {\n      index: start,\n      text: ident\n    };\n\n    // OPERATORS is our own object so we don't need to use special hasOwnPropertyFn\n    if (OPERATORS.hasOwnProperty(ident)) {\n      token.fn = OPERATORS[ident];\n      token.literal = true;\n      token.constant = true;\n    } else {\n      var getter = getterFn(ident, this.options, this.text);\n      token.fn = extend(function(self, locals) {\n        return (getter(self, locals));\n      }, {\n        assign: function(self, value) {\n          return setter(self, ident, value, parser.text, parser.options);\n        }\n      });\n    }\n\n    this.tokens.push(token);\n\n    if (methodName) {\n      this.tokens.push({\n        index:lastDot,\n        text: '.'\n      });\n      this.tokens.push({\n        index: lastDot + 1,\n        text: methodName\n      });\n    }\n  },\n\n  readString: function(quote) {\n    var start = this.index;\n    this.index++;\n    var string = '';\n    var rawString = quote;\n    var escape = false;\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      rawString += ch;\n      if (escape) {\n        if (ch === 'u') {\n          var hex = this.text.substring(this.index + 1, this.index + 5);\n          if (!hex.match(/[\\da-f]{4}/i))\n            this.throwError('Invalid unicode escape [\\\\u' + hex + ']');\n          this.index += 4;\n          string += String.fromCharCode(parseInt(hex, 16));\n        } else {\n          var rep = ESCAPE[ch];\n          if (rep) {\n            string += rep;\n          } else {\n            string += ch;\n          }\n        }\n        escape = false;\n      } else if (ch === '\\\\') {\n        escape = true;\n      } else if (ch === quote) {\n        this.index++;\n        this.tokens.push({\n          index: start,\n          text: rawString,\n          string: string,\n          literal: true,\n          constant: true,\n          fn: function() { return string; }\n        });\n        return;\n      } else {\n        string += ch;\n      }\n      this.index++;\n    }\n    this.throwError('Unterminated quote', start);\n  }\n};\n\n\n/**\n * @constructor\n */\nvar Parser = function (lexer, $filter, options) {\n  this.lexer = lexer;\n  this.$filter = $filter;\n  this.options = options;\n};\n\nParser.ZERO = extend(function () {\n  return 0;\n}, {\n  constant: true\n});\n\nParser.prototype = {\n  constructor: Parser,\n\n  parse: function (text) {\n    this.text = text;\n\n    this.tokens = this.lexer.lex(text);\n\n    var value = this.statements();\n\n    if (this.tokens.length !== 0) {\n      this.throwError('is an unexpected token', this.tokens[0]);\n    }\n\n    value.literal = !!value.literal;\n    value.constant = !!value.constant;\n\n    return value;\n  },\n\n  primary: function () {\n    var primary;\n    if (this.expect('(')) {\n      primary = this.filterChain();\n      this.consume(')');\n    } else if (this.expect('[')) {\n      primary = this.arrayDeclaration();\n    } else if (this.expect('{')) {\n      primary = this.object();\n    } else {\n      var token = this.expect();\n      primary = token.fn;\n      if (!primary) {\n        this.throwError('not a primary expression', token);\n      }\n      primary.literal = !!token.literal;\n      primary.constant = !!token.constant;\n    }\n\n    var next, context;\n    while ((next = this.expect('(', '[', '.'))) {\n      if (next.text === '(') {\n        primary = this.functionCall(primary, context);\n        context = null;\n      } else if (next.text === '[') {\n        context = primary;\n        primary = this.objectIndex(primary);\n      } else if (next.text === '.') {\n        context = primary;\n        primary = this.fieldAccess(primary);\n      } else {\n        this.throwError('IMPOSSIBLE');\n      }\n    }\n    return primary;\n  },\n\n  throwError: function(msg, token) {\n    throw $parseMinErr('syntax',\n        'Syntax Error: Token \\'{0}\\' {1} at column {2} of the expression [{3}] starting at [{4}].',\n          token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));\n  },\n\n  peekToken: function() {\n    if (this.tokens.length === 0)\n      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n    return this.tokens[0];\n  },\n\n  peek: function(e1, e2, e3, e4) {\n    if (this.tokens.length > 0) {\n      var token = this.tokens[0];\n      var t = token.text;\n      if (t === e1 || t === e2 || t === e3 || t === e4 ||\n          (!e1 && !e2 && !e3 && !e4)) {\n        return token;\n      }\n    }\n    return false;\n  },\n\n  expect: function(e1, e2, e3, e4){\n    var token = this.peek(e1, e2, e3, e4);\n    if (token) {\n      this.tokens.shift();\n      return token;\n    }\n    return false;\n  },\n\n  consume: function(e1){\n    if (!this.expect(e1)) {\n      this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());\n    }\n  },\n\n  unaryFn: function(fn, right) {\n    return extend(function(self, locals) {\n      return fn(self, locals, right);\n    }, {\n      constant:right.constant\n    });\n  },\n\n  ternaryFn: function(left, middle, right){\n    return extend(function(self, locals){\n      return left(self, locals) ? middle(self, locals) : right(self, locals);\n    }, {\n      constant: left.constant && middle.constant && right.constant\n    });\n  },\n\n  binaryFn: function(left, fn, right) {\n    return extend(function(self, locals) {\n      return fn(self, locals, left, right);\n    }, {\n      constant:left.constant && right.constant\n    });\n  },\n\n  statements: function() {\n    var statements = [];\n    while (true) {\n      if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))\n        statements.push(this.filterChain());\n      if (!this.expect(';')) {\n        // optimize for the common case where there is only one statement.\n        // TODO(size): maybe we should not support multiple statements?\n        return (statements.length === 1)\n            ? statements[0]\n            : function(self, locals) {\n                var value;\n                for (var i = 0; i < statements.length; i++) {\n                  var statement = statements[i];\n                  if (statement) {\n                    value = statement(self, locals);\n                  }\n                }\n                return value;\n              };\n      }\n    }\n  },\n\n  filterChain: function() {\n    var left = this.expression();\n    var token;\n    while (true) {\n      if ((token = this.expect('|'))) {\n        left = this.binaryFn(left, token.fn, this.filter());\n      } else {\n        return left;\n      }\n    }\n  },\n\n  filter: function() {\n    var token = this.expect();\n    var fn = this.$filter(token.text);\n    var argsFn = [];\n    while (true) {\n      if ((token = this.expect(':'))) {\n        argsFn.push(this.expression());\n      } else {\n        var fnInvoke = function(self, locals, input) {\n          var args = [input];\n          for (var i = 0; i < argsFn.length; i++) {\n            args.push(argsFn[i](self, locals));\n          }\n          return fn.apply(self, args);\n        };\n        return function() {\n          return fnInvoke;\n        };\n      }\n    }\n  },\n\n  expression: function() {\n    return this.assignment();\n  },\n\n  assignment: function() {\n    var left = this.ternary();\n    var right;\n    var token;\n    if ((token = this.expect('='))) {\n      if (!left.assign) {\n        this.throwError('implies assignment but [' +\n            this.text.substring(0, token.index) + '] can not be assigned to', token);\n      }\n      right = this.ternary();\n      return function(scope, locals) {\n        return left.assign(scope, right(scope, locals), locals);\n      };\n    }\n    return left;\n  },\n\n  ternary: function() {\n    var left = this.logicalOR();\n    var middle;\n    var token;\n    if ((token = this.expect('?'))) {\n      middle = this.ternary();\n      if ((token = this.expect(':'))) {\n        return this.ternaryFn(left, middle, this.ternary());\n      } else {\n        this.throwError('expected :', token);\n      }\n    } else {\n      return left;\n    }\n  },\n\n  logicalOR: function() {\n    var left = this.logicalAND();\n    var token;\n    while (true) {\n      if ((token = this.expect('||'))) {\n        left = this.binaryFn(left, token.fn, this.logicalAND());\n      } else {\n        return left;\n      }\n    }\n  },\n\n  logicalAND: function() {\n    var left = this.equality();\n    var token;\n    if ((token = this.expect('&&'))) {\n      left = this.binaryFn(left, token.fn, this.logicalAND());\n    }\n    return left;\n  },\n\n  equality: function() {\n    var left = this.relational();\n    var token;\n    if ((token = this.expect('==','!=','===','!=='))) {\n      left = this.binaryFn(left, token.fn, this.equality());\n    }\n    return left;\n  },\n\n  relational: function() {\n    var left = this.additive();\n    var token;\n    if ((token = this.expect('<', '>', '<=', '>='))) {\n      left = this.binaryFn(left, token.fn, this.relational());\n    }\n    return left;\n  },\n\n  additive: function() {\n    var left = this.multiplicative();\n    var token;\n    while ((token = this.expect('+','-'))) {\n      left = this.binaryFn(left, token.fn, this.multiplicative());\n    }\n    return left;\n  },\n\n  multiplicative: function() {\n    var left = this.unary();\n    var token;\n    while ((token = this.expect('*','/','%'))) {\n      left = this.binaryFn(left, token.fn, this.unary());\n    }\n    return left;\n  },\n\n  unary: function() {\n    var token;\n    if (this.expect('+')) {\n      return this.primary();\n    } else if ((token = this.expect('-'))) {\n      return this.binaryFn(Parser.ZERO, token.fn, this.unary());\n    } else if ((token = this.expect('!'))) {\n      return this.unaryFn(token.fn, this.unary());\n    } else {\n      return this.primary();\n    }\n  },\n\n  fieldAccess: function(object) {\n    var parser = this;\n    var field = this.expect().text;\n    var getter = getterFn(field, this.options, this.text);\n\n    return extend(function(scope, locals, self) {\n      return getter(self || object(scope, locals));\n    }, {\n      assign: function(scope, value, locals) {\n        return setter(object(scope, locals), field, value, parser.text, parser.options);\n      }\n    });\n  },\n\n  objectIndex: function(obj) {\n    var parser = this;\n\n    var indexFn = this.expression();\n    this.consume(']');\n\n    return extend(function(self, locals) {\n      var o = obj(self, locals),\n          i = indexFn(self, locals),\n          v, p;\n\n      if (!o) return undefined;\n      v = ensureSafeObject(o[i], parser.text);\n      if (v && v.then && parser.options.unwrapPromises) {\n        p = v;\n        if (!('$$v' in v)) {\n          p.$$v = undefined;\n          p.then(function(val) { p.$$v = val; });\n        }\n        v = v.$$v;\n      }\n      return v;\n    }, {\n      assign: function(self, value, locals) {\n        var key = indexFn(self, locals);\n        // prevent overwriting of Function.constructor which would break ensureSafeObject check\n        var safe = ensureSafeObject(obj(self, locals), parser.text);\n        return safe[key] = value;\n      }\n    });\n  },\n\n  functionCall: function(fn, contextGetter) {\n    var argsFn = [];\n    if (this.peekToken().text !== ')') {\n      do {\n        argsFn.push(this.expression());\n      } while (this.expect(','));\n    }\n    this.consume(')');\n\n    var parser = this;\n\n    return function(scope, locals) {\n      var args = [];\n      var context = contextGetter ? contextGetter(scope, locals) : scope;\n\n      for (var i = 0; i < argsFn.length; i++) {\n        args.push(argsFn[i](scope, locals));\n      }\n      var fnPtr = fn(scope, locals, context) || noop;\n\n      ensureSafeObject(context, parser.text);\n      ensureSafeObject(fnPtr, parser.text);\n\n      // IE stupidity! (IE doesn't have apply for some native functions)\n      var v = fnPtr.apply\n            ? fnPtr.apply(context, args)\n            : fnPtr(args[0], args[1], args[2], args[3], args[4]);\n\n      return ensureSafeObject(v, parser.text);\n    };\n  },\n\n  // This is used with json array declaration\n  arrayDeclaration: function () {\n    var elementFns = [];\n    var allConstant = true;\n    if (this.peekToken().text !== ']') {\n      do {\n        if (this.peek(']')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        var elementFn = this.expression();\n        elementFns.push(elementFn);\n        if (!elementFn.constant) {\n          allConstant = false;\n        }\n      } while (this.expect(','));\n    }\n    this.consume(']');\n\n    return extend(function(self, locals) {\n      var array = [];\n      for (var i = 0; i < elementFns.length; i++) {\n        array.push(elementFns[i](self, locals));\n      }\n      return array;\n    }, {\n      literal: true,\n      constant: allConstant\n    });\n  },\n\n  object: function () {\n    var keyValues = [];\n    var allConstant = true;\n    if (this.peekToken().text !== '}') {\n      do {\n        if (this.peek('}')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        var token = this.expect(),\n        key = token.string || token.text;\n        this.consume(':');\n        var value = this.expression();\n        keyValues.push({key: key, value: value});\n        if (!value.constant) {\n          allConstant = false;\n        }\n      } while (this.expect(','));\n    }\n    this.consume('}');\n\n    return extend(function(self, locals) {\n      var object = {};\n      for (var i = 0; i < keyValues.length; i++) {\n        var keyValue = keyValues[i];\n        object[keyValue.key] = keyValue.value(self, locals);\n      }\n      return object;\n    }, {\n      literal: true,\n      constant: allConstant\n    });\n  }\n};\n\n\n//////////////////////////////////////////////////\n// Parser helper functions\n//////////////////////////////////////////////////\n\nfunction setter(obj, path, setValue, fullExp, options) {\n  //needed?\n  options = options || {};\n\n  var element = path.split('.'), key;\n  for (var i = 0; element.length > 1; i++) {\n    key = ensureSafeMemberName(element.shift(), fullExp);\n    var propertyObj = obj[key];\n    if (!propertyObj) {\n      propertyObj = {};\n      obj[key] = propertyObj;\n    }\n    obj = propertyObj;\n    if (obj.then && options.unwrapPromises) {\n      promiseWarning(fullExp);\n      if (!(\"$$v\" in obj)) {\n        (function(promise) {\n          promise.then(function(val) { promise.$$v = val; }); }\n        )(obj);\n      }\n      if (obj.$$v === undefined) {\n        obj.$$v = {};\n      }\n      obj = obj.$$v;\n    }\n  }\n  key = ensureSafeMemberName(element.shift(), fullExp);\n  obj[key] = setValue;\n  return setValue;\n}\n\nvar getterFnCache = {};\n\n/**\n * Implementation of the \"Black Hole\" variant from:\n * - http://jsperf.com/angularjs-parse-getter/4\n * - http://jsperf.com/path-evaluation-simplified/7\n */\nfunction cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {\n  ensureSafeMemberName(key0, fullExp);\n  ensureSafeMemberName(key1, fullExp);\n  ensureSafeMemberName(key2, fullExp);\n  ensureSafeMemberName(key3, fullExp);\n  ensureSafeMemberName(key4, fullExp);\n\n  return !options.unwrapPromises\n      ? function cspSafeGetter(scope, locals) {\n          var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope;\n\n          if (pathVal == null) return pathVal;\n          pathVal = pathVal[key0];\n\n          if (!key1) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key1];\n\n          if (!key2) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key2];\n\n          if (!key3) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key3];\n\n          if (!key4) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key4];\n\n          return pathVal;\n        }\n      : function cspSafePromiseEnabledGetter(scope, locals) {\n          var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope,\n              promise;\n\n          if (pathVal == null) return pathVal;\n\n          pathVal = pathVal[key0];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n\n          if (!key1) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key1];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n\n          if (!key2) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key2];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n\n          if (!key3) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key3];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n\n          if (!key4) return pathVal;\n          if (pathVal == null) return undefined;\n          pathVal = pathVal[key4];\n          if (pathVal && pathVal.then) {\n            promiseWarning(fullExp);\n            if (!(\"$$v\" in pathVal)) {\n              promise = pathVal;\n              promise.$$v = undefined;\n              promise.then(function(val) { promise.$$v = val; });\n            }\n            pathVal = pathVal.$$v;\n          }\n          return pathVal;\n        };\n}\n\nfunction simpleGetterFn1(key0, fullExp) {\n  ensureSafeMemberName(key0, fullExp);\n\n  return function simpleGetterFn1(scope, locals) {\n    if (scope == null) return undefined;\n    return ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];\n  };\n}\n\nfunction simpleGetterFn2(key0, key1, fullExp) {\n  ensureSafeMemberName(key0, fullExp);\n  ensureSafeMemberName(key1, fullExp);\n\n  return function simpleGetterFn2(scope, locals) {\n    if (scope == null) return undefined;\n    scope = ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];\n    return scope == null ? undefined : scope[key1];\n  };\n}\n\nfunction getterFn(path, options, fullExp) {\n  // Check whether the cache has this getter already.\n  // We can use hasOwnProperty directly on the cache because we ensure,\n  // see below, that the cache never stores a path called 'hasOwnProperty'\n  if (getterFnCache.hasOwnProperty(path)) {\n    return getterFnCache[path];\n  }\n\n  var pathKeys = path.split('.'),\n      pathKeysLength = pathKeys.length,\n      fn;\n\n  // When we have only 1 or 2 tokens, use optimized special case closures.\n  // http://jsperf.com/angularjs-parse-getter/6\n  if (!options.unwrapPromises && pathKeysLength === 1) {\n    fn = simpleGetterFn1(pathKeys[0], fullExp);\n  } else if (!options.unwrapPromises && pathKeysLength === 2) {\n    fn = simpleGetterFn2(pathKeys[0], pathKeys[1], fullExp);\n  } else if (options.csp) {\n    if (pathKeysLength < 6) {\n      fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,\n                          options);\n    } else {\n      fn = function(scope, locals) {\n        var i = 0, val;\n        do {\n          val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++],\n                                pathKeys[i++], fullExp, options)(scope, locals);\n\n          locals = undefined; // clear after first iteration\n          scope = val;\n        } while (i < pathKeysLength);\n        return val;\n      };\n    }\n  } else {\n    var code = 'var p;\\n';\n    forEach(pathKeys, function(key, index) {\n      ensureSafeMemberName(key, fullExp);\n      code += 'if(s == null) return undefined;\\n' +\n              's='+ (index\n                      // we simply dereference 's' on any .dot notation\n                      ? 's'\n                      // but if we are first then we check locals first, and if so read it first\n                      : '((k&&k.hasOwnProperty(\"' + key + '\"))?k:s)') + '[\"' + key + '\"]' + ';\\n' +\n              (options.unwrapPromises\n                ? 'if (s && s.then) {\\n' +\n                  ' pw(\"' + fullExp.replace(/([\"\\r\\n])/g, '\\\\$1') + '\");\\n' +\n                  ' if (!(\"$$v\" in s)) {\\n' +\n                    ' p=s;\\n' +\n                    ' p.$$v = undefined;\\n' +\n                    ' p.then(function(v) {p.$$v=v;});\\n' +\n                    '}\\n' +\n                  ' s=s.$$v\\n' +\n                '}\\n'\n                : '');\n    });\n    code += 'return s;';\n\n    /* jshint -W054 */\n    var evaledFnGetter = new Function('s', 'k', 'pw', code); // s=scope, k=locals, pw=promiseWarning\n    /* jshint +W054 */\n    evaledFnGetter.toString = valueFn(code);\n    fn = options.unwrapPromises ? function(scope, locals) {\n      return evaledFnGetter(scope, locals, promiseWarning);\n    } : evaledFnGetter;\n  }\n\n  // Only cache the value if it's not going to mess up the cache object\n  // This is more performant that using Object.prototype.hasOwnProperty.call\n  if (path !== 'hasOwnProperty') {\n    getterFnCache[path] = fn;\n  }\n  return fn;\n}\n\n///////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $parse\n * @kind function\n *\n * @description\n *\n * Converts Angular {@link guide/expression expression} into a function.\n *\n * ```js\n *   var getter = $parse('user.name');\n *   var setter = getter.assign;\n *   var context = {user:{name:'angular'}};\n *   var locals = {user:{name:'local'}};\n *\n *   expect(getter(context)).toEqual('angular');\n *   setter(context, 'newValue');\n *   expect(context.user.name).toEqual('newValue');\n *   expect(getter(context, locals)).toEqual('local');\n * ```\n *\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n *      are evaluated against (typically a scope object).\n *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n *      `context`.\n *\n *    The returned function also has the following properties:\n *      * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript\n *        literal.\n *      * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript\n *        constant literals.\n *      * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be\n *        set to a function to change its value on the given context.\n *\n */\n\n\n/**\n * @ngdoc provider\n * @name $parseProvider\n * @kind function\n *\n * @description\n * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}\n *  service.\n */\nfunction $ParseProvider() {\n  var cache = {};\n\n  var $parseOptions = {\n    csp: false,\n    unwrapPromises: false,\n    logPromiseWarnings: true\n  };\n\n\n  /**\n   * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future.\n   *\n   * @ngdoc method\n   * @name $parseProvider#unwrapPromises\n   * @description\n   *\n   * **This feature is deprecated, see deprecation notes below for more info**\n   *\n   * If set to true (default is false), $parse will unwrap promises automatically when a promise is\n   * found at any part of the expression. In other words, if set to true, the expression will always\n   * result in a non-promise value.\n   *\n   * While the promise is unresolved, it's treated as undefined, but once resolved and fulfilled,\n   * the fulfillment value is used in place of the promise while evaluating the expression.\n   *\n   * **Deprecation notice**\n   *\n   * This is a feature that didn't prove to be wildly useful or popular, primarily because of the\n   * dichotomy between data access in templates (accessed as raw values) and controller code\n   * (accessed as promises).\n   *\n   * In most code we ended up resolving promises manually in controllers anyway and thus unifying\n   * the model access there.\n   *\n   * Other downsides of automatic promise unwrapping:\n   *\n   * - when building components it's often desirable to receive the raw promises\n   * - adds complexity and slows down expression evaluation\n   * - makes expression code pre-generation unattractive due to the amount of code that needs to be\n   *   generated\n   * - makes IDE auto-completion and tool support hard\n   *\n   * **Warning Logs**\n   *\n   * If the unwrapping is enabled, Angular will log a warning about each expression that unwraps a\n   * promise (to reduce the noise, each expression is logged only once). To disable this logging use\n   * `$parseProvider.logPromiseWarnings(false)` api.\n   *\n   *\n   * @param {boolean=} value New value.\n   * @returns {boolean|self} Returns the current setting when used as getter and self if used as\n   *                         setter.\n   */\n  this.unwrapPromises = function(value) {\n    if (isDefined(value)) {\n      $parseOptions.unwrapPromises = !!value;\n      return this;\n    } else {\n      return $parseOptions.unwrapPromises;\n    }\n  };\n\n\n  /**\n   * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future.\n   *\n   * @ngdoc method\n   * @name $parseProvider#logPromiseWarnings\n   * @description\n   *\n   * Controls whether Angular should log a warning on any encounter of a promise in an expression.\n   *\n   * The default is set to `true`.\n   *\n   * This setting applies only if `$parseProvider.unwrapPromises` setting is set to true as well.\n   *\n   * @param {boolean=} value New value.\n   * @returns {boolean|self} Returns the current setting when used as getter and self if used as\n   *                         setter.\n   */\n this.logPromiseWarnings = function(value) {\n    if (isDefined(value)) {\n      $parseOptions.logPromiseWarnings = value;\n      return this;\n    } else {\n      return $parseOptions.logPromiseWarnings;\n    }\n  };\n\n\n  this.$get = ['$filter', '$sniffer', '$log', function($filter, $sniffer, $log) {\n    $parseOptions.csp = $sniffer.csp;\n\n    promiseWarning = function promiseWarningFn(fullExp) {\n      if (!$parseOptions.logPromiseWarnings || promiseWarningCache.hasOwnProperty(fullExp)) return;\n      promiseWarningCache[fullExp] = true;\n      $log.warn('[$parse] Promise found in the expression `' + fullExp + '`. ' +\n          'Automatic unwrapping of promises in Angular expressions is deprecated.');\n    };\n\n    return function(exp) {\n      var parsedExpression;\n\n      switch (typeof exp) {\n        case 'string':\n\n          if (cache.hasOwnProperty(exp)) {\n            return cache[exp];\n          }\n\n          var lexer = new Lexer($parseOptions);\n          var parser = new Parser(lexer, $filter, $parseOptions);\n          parsedExpression = parser.parse(exp);\n\n          if (exp !== 'hasOwnProperty') {\n            // Only cache the value if it's not going to mess up the cache object\n            // This is more performant that using Object.prototype.hasOwnProperty.call\n            cache[exp] = parsedExpression;\n          }\n\n          return parsedExpression;\n\n        case 'function':\n          return exp;\n\n        default:\n          return noop;\n      }\n    };\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $q\n * @requires $rootScope\n *\n * @description\n * A promise/deferred implementation inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).\n *\n * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an\n * interface for interacting with an object that represents the result of an action that is\n * performed asynchronously, and may or may not be finished at any given point in time.\n *\n * From the perspective of dealing with error handling, deferred and promise APIs are to\n * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.\n *\n * ```js\n *   // for the purpose of this example let's assume that variables `$q`, `scope` and `okToGreet`\n *   // are available in the current lexical scope (they could have been injected or passed in).\n *\n *   function asyncGreet(name) {\n *     var deferred = $q.defer();\n *\n *     setTimeout(function() {\n *       // since this fn executes async in a future turn of the event loop, we need to wrap\n *       // our code into an $apply call so that the model changes are properly observed.\n *       scope.$apply(function() {\n *         deferred.notify('About to greet ' + name + '.');\n *\n *         if (okToGreet(name)) {\n *           deferred.resolve('Hello, ' + name + '!');\n *         } else {\n *           deferred.reject('Greeting ' + name + ' is not allowed.');\n *         }\n *       });\n *     }, 1000);\n *\n *     return deferred.promise;\n *   }\n *\n *   var promise = asyncGreet('Robin Hood');\n *   promise.then(function(greeting) {\n *     alert('Success: ' + greeting);\n *   }, function(reason) {\n *     alert('Failed: ' + reason);\n *   }, function(update) {\n *     alert('Got notification: ' + update);\n *   });\n * ```\n *\n * At first it might not be obvious why this extra complexity is worth the trouble. The payoff\n * comes in the way of guarantees that promise and deferred APIs make, see\n * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.\n *\n * Additionally the promise api allows for composition that is very hard to do with the\n * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.\n * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the\n * section on serial or parallel joining of promises.\n *\n *\n * # The Deferred API\n *\n * A new instance of deferred is constructed by calling `$q.defer()`.\n *\n * The purpose of the deferred object is to expose the associated Promise instance as well as APIs\n * that can be used for signaling the successful or unsuccessful completion, as well as the status\n * of the task.\n *\n * **Methods**\n *\n * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection\n *   constructed via `$q.reject`, the promise will be rejected instead.\n * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to\n *   resolving it with a rejection constructed via `$q.reject`.\n * - `notify(value)` - provides updates on the status of the promise's execution. This may be called\n *   multiple times before the promise is either resolved or rejected.\n *\n * **Properties**\n *\n * - promise – `{Promise}` – promise object associated with this deferred.\n *\n *\n * # The Promise API\n *\n * A new promise instance is created when a deferred instance is created and can be retrieved by\n * calling `deferred.promise`.\n *\n * The purpose of the promise object is to allow for interested parties to get access to the result\n * of the deferred task when it completes.\n *\n * **Methods**\n *\n * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or\n *   will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously\n *   as soon as the result is available. The callbacks are called with a single argument: the result\n *   or rejection reason. Additionally, the notify callback may be called zero or more times to\n *   provide a progress indication, before the promise is resolved or rejected.\n *\n *   This method *returns a new promise* which is resolved or rejected via the return value of the\n *   `successCallback`, `errorCallback`. It also notifies via the return value of the\n *   `notifyCallback` method. The promise can not be resolved or rejected from the notifyCallback\n *   method.\n *\n * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`\n *\n * - `finally(callback)` – allows you to observe either the fulfillment or rejection of a promise,\n *   but to do so without modifying the final value. This is useful to release resources or do some\n *   clean-up that needs to be done whether the promise was rejected or resolved. See the [full\n *   specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for\n *   more information.\n *\n *   Because `finally` is a reserved word in JavaScript and reserved keywords are not supported as\n *   property names by ES3, you'll need to invoke the method like `promise['finally'](callback)` to\n *   make your code IE8 and Android 2.x compatible.\n *\n * # Chaining promises\n *\n * Because calling the `then` method of a promise returns a new derived promise, it is easily\n * possible to create a chain of promises:\n *\n * ```js\n *   promiseB = promiseA.then(function(result) {\n *     return result + 1;\n *   });\n *\n *   // promiseB will be resolved immediately after promiseA is resolved and its value\n *   // will be the result of promiseA incremented by 1\n * ```\n *\n * It is possible to create chains of any length and since a promise can be resolved with another\n * promise (which will defer its resolution further), it is possible to pause/defer resolution of\n * the promises at any point in the chain. This makes it possible to implement powerful APIs like\n * $http's response interceptors.\n *\n *\n * # Differences between Kris Kowal's Q and $q\n *\n *  There are two main differences:\n *\n * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation\n *   mechanism in angular, which means faster propagation of resolution or rejection into your\n *   models and avoiding unnecessary browser repaints, which would result in flickering UI.\n * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains\n *   all the important functionality needed for common async tasks.\n *\n *  # Testing\n *\n *  ```js\n *    it('should simulate promise', inject(function($q, $rootScope) {\n *      var deferred = $q.defer();\n *      var promise = deferred.promise;\n *      var resolvedValue;\n *\n *      promise.then(function(value) { resolvedValue = value; });\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Simulate resolving of promise\n *      deferred.resolve(123);\n *      // Note that the 'then' function does not get called synchronously.\n *      // This is because we want the promise API to always be async, whether or not\n *      // it got called synchronously or asynchronously.\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Propagate promise resolution to 'then' functions using $apply().\n *      $rootScope.$apply();\n *      expect(resolvedValue).toEqual(123);\n *    }));\n *  ```\n */\nfunction $QProvider() {\n\n  this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {\n    return qFactory(function(callback) {\n      $rootScope.$evalAsync(callback);\n    }, $exceptionHandler);\n  }];\n}\n\n\n/**\n * Constructs a promise manager.\n *\n * @param {function(Function)} nextTick Function for executing functions in the next turn.\n * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for\n *     debugging purposes.\n * @returns {object} Promise manager.\n */\nfunction qFactory(nextTick, exceptionHandler) {\n\n  /**\n   * @ngdoc method\n   * @name $q#defer\n   * @kind function\n   *\n   * @description\n   * Creates a `Deferred` object which represents a task which will finish in the future.\n   *\n   * @returns {Deferred} Returns a new instance of deferred.\n   */\n  var defer = function() {\n    var pending = [],\n        value, deferred;\n\n    deferred = {\n\n      resolve: function(val) {\n        if (pending) {\n          var callbacks = pending;\n          pending = undefined;\n          value = ref(val);\n\n          if (callbacks.length) {\n            nextTick(function() {\n              var callback;\n              for (var i = 0, ii = callbacks.length; i < ii; i++) {\n                callback = callbacks[i];\n                value.then(callback[0], callback[1], callback[2]);\n              }\n            });\n          }\n        }\n      },\n\n\n      reject: function(reason) {\n        deferred.resolve(createInternalRejectedPromise(reason));\n      },\n\n\n      notify: function(progress) {\n        if (pending) {\n          var callbacks = pending;\n\n          if (pending.length) {\n            nextTick(function() {\n              var callback;\n              for (var i = 0, ii = callbacks.length; i < ii; i++) {\n                callback = callbacks[i];\n                callback[2](progress);\n              }\n            });\n          }\n        }\n      },\n\n\n      promise: {\n        then: function(callback, errback, progressback) {\n          var result = defer();\n\n          var wrappedCallback = function(value) {\n            try {\n              result.resolve((isFunction(callback) ? callback : defaultCallback)(value));\n            } catch(e) {\n              result.reject(e);\n              exceptionHandler(e);\n            }\n          };\n\n          var wrappedErrback = function(reason) {\n            try {\n              result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));\n            } catch(e) {\n              result.reject(e);\n              exceptionHandler(e);\n            }\n          };\n\n          var wrappedProgressback = function(progress) {\n            try {\n              result.notify((isFunction(progressback) ? progressback : defaultCallback)(progress));\n            } catch(e) {\n              exceptionHandler(e);\n            }\n          };\n\n          if (pending) {\n            pending.push([wrappedCallback, wrappedErrback, wrappedProgressback]);\n          } else {\n            value.then(wrappedCallback, wrappedErrback, wrappedProgressback);\n          }\n\n          return result.promise;\n        },\n\n        \"catch\": function(callback) {\n          return this.then(null, callback);\n        },\n\n        \"finally\": function(callback) {\n\n          function makePromise(value, resolved) {\n            var result = defer();\n            if (resolved) {\n              result.resolve(value);\n            } else {\n              result.reject(value);\n            }\n            return result.promise;\n          }\n\n          function handleCallback(value, isResolved) {\n            var callbackOutput = null;\n            try {\n              callbackOutput = (callback ||defaultCallback)();\n            } catch(e) {\n              return makePromise(e, false);\n            }\n            if (callbackOutput && isFunction(callbackOutput.then)) {\n              return callbackOutput.then(function() {\n                return makePromise(value, isResolved);\n              }, function(error) {\n                return makePromise(error, false);\n              });\n            } else {\n              return makePromise(value, isResolved);\n            }\n          }\n\n          return this.then(function(value) {\n            return handleCallback(value, true);\n          }, function(error) {\n            return handleCallback(error, false);\n          });\n        }\n      }\n    };\n\n    return deferred;\n  };\n\n\n  var ref = function(value) {\n    if (value && isFunction(value.then)) return value;\n    return {\n      then: function(callback) {\n        var result = defer();\n        nextTick(function() {\n          result.resolve(callback(value));\n        });\n        return result.promise;\n      }\n    };\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $q#reject\n   * @kind function\n   *\n   * @description\n   * Creates a promise that is resolved as rejected with the specified `reason`. This api should be\n   * used to forward rejection in a chain of promises. If you are dealing with the last promise in\n   * a promise chain, you don't need to worry about it.\n   *\n   * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of\n   * `reject` as the `throw` keyword in JavaScript. This also means that if you \"catch\" an error via\n   * a promise error callback and you want to forward the error to the promise derived from the\n   * current promise, you have to \"rethrow\" the error by returning a rejection constructed via\n   * `reject`.\n   *\n   * ```js\n   *   promiseB = promiseA.then(function(result) {\n   *     // success: do something and resolve promiseB\n   *     //          with the old or a new result\n   *     return result;\n   *   }, function(reason) {\n   *     // error: handle the error if possible and\n   *     //        resolve promiseB with newPromiseOrValue,\n   *     //        otherwise forward the rejection to promiseB\n   *     if (canHandle(reason)) {\n   *      // handle the error and recover\n   *      return newPromiseOrValue;\n   *     }\n   *     return $q.reject(reason);\n   *   });\n   * ```\n   *\n   * @param {*} reason Constant, message, exception or an object representing the rejection reason.\n   * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.\n   */\n  var reject = function(reason) {\n    var result = defer();\n    result.reject(reason);\n    return result.promise;\n  };\n\n  var createInternalRejectedPromise = function(reason) {\n    return {\n      then: function(callback, errback) {\n        var result = defer();\n        nextTick(function() {\n          try {\n            result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));\n          } catch(e) {\n            result.reject(e);\n            exceptionHandler(e);\n          }\n        });\n        return result.promise;\n      }\n    };\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $q#when\n   * @kind function\n   *\n   * @description\n   * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.\n   * This is useful when you are dealing with an object that might or might not be a promise, or if\n   * the promise comes from a source that can't be trusted.\n   *\n   * @param {*} value Value or a promise\n   * @returns {Promise} Returns a promise of the passed value or promise\n   */\n  var when = function(value, callback, errback, progressback) {\n    var result = defer(),\n        done;\n\n    var wrappedCallback = function(value) {\n      try {\n        return (isFunction(callback) ? callback : defaultCallback)(value);\n      } catch (e) {\n        exceptionHandler(e);\n        return reject(e);\n      }\n    };\n\n    var wrappedErrback = function(reason) {\n      try {\n        return (isFunction(errback) ? errback : defaultErrback)(reason);\n      } catch (e) {\n        exceptionHandler(e);\n        return reject(e);\n      }\n    };\n\n    var wrappedProgressback = function(progress) {\n      try {\n        return (isFunction(progressback) ? progressback : defaultCallback)(progress);\n      } catch (e) {\n        exceptionHandler(e);\n      }\n    };\n\n    nextTick(function() {\n      ref(value).then(function(value) {\n        if (done) return;\n        done = true;\n        result.resolve(ref(value).then(wrappedCallback, wrappedErrback, wrappedProgressback));\n      }, function(reason) {\n        if (done) return;\n        done = true;\n        result.resolve(wrappedErrback(reason));\n      }, function(progress) {\n        if (done) return;\n        result.notify(wrappedProgressback(progress));\n      });\n    });\n\n    return result.promise;\n  };\n\n\n  function defaultCallback(value) {\n    return value;\n  }\n\n\n  function defaultErrback(reason) {\n    return reject(reason);\n  }\n\n\n  /**\n   * @ngdoc method\n   * @name $q#all\n   * @kind function\n   *\n   * @description\n   * Combines multiple promises into a single promise that is resolved when all of the input\n   * promises are resolved.\n   *\n   * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.\n   * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,\n   *   each value corresponding to the promise at the same index/key in the `promises` array/hash.\n   *   If any of the promises is resolved with a rejection, this resulting promise will be rejected\n   *   with the same rejection value.\n   */\n  function all(promises) {\n    var deferred = defer(),\n        counter = 0,\n        results = isArray(promises) ? [] : {};\n\n    forEach(promises, function(promise, key) {\n      counter++;\n      ref(promise).then(function(value) {\n        if (results.hasOwnProperty(key)) return;\n        results[key] = value;\n        if (!(--counter)) deferred.resolve(results);\n      }, function(reason) {\n        if (results.hasOwnProperty(key)) return;\n        deferred.reject(reason);\n      });\n    });\n\n    if (counter === 0) {\n      deferred.resolve(results);\n    }\n\n    return deferred.promise;\n  }\n\n  return {\n    defer: defer,\n    reject: reject,\n    when: when,\n    all: all\n  };\n}\n\nfunction $$RAFProvider(){ //rAF\n  this.$get = ['$window', '$timeout', function($window, $timeout) {\n    var requestAnimationFrame = $window.requestAnimationFrame ||\n                                $window.webkitRequestAnimationFrame ||\n                                $window.mozRequestAnimationFrame;\n\n    var cancelAnimationFrame = $window.cancelAnimationFrame ||\n                               $window.webkitCancelAnimationFrame ||\n                               $window.mozCancelAnimationFrame ||\n                               $window.webkitCancelRequestAnimationFrame;\n\n    var rafSupported = !!requestAnimationFrame;\n    var raf = rafSupported\n      ? function(fn) {\n          var id = requestAnimationFrame(fn);\n          return function() {\n            cancelAnimationFrame(id);\n          };\n        }\n      : function(fn) {\n          var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666\n          return function() {\n            $timeout.cancel(timer);\n          };\n        };\n\n    raf.supported = rafSupported;\n\n    return raf;\n  }];\n}\n\n/**\n * DESIGN NOTES\n *\n * The design decisions behind the scope are heavily favored for speed and memory consumption.\n *\n * The typical use of scope is to watch the expressions, which most of the time return the same\n * value as last time so we optimize the operation.\n *\n * Closures construction is expensive in terms of speed as well as memory:\n *   - No closures, instead use prototypical inheritance for API\n *   - Internal state needs to be stored on scope directly, which means that private state is\n *     exposed as $$____ properties\n *\n * Loop operations are optimized by using while(count--) { ... }\n *   - this means that in order to keep the same order of execution as addition we have to add\n *     items to the array at the beginning (unshift) instead of at the end (push)\n *\n * Child scopes are created and removed often\n *   - Using an array would be slow since inserts in middle are expensive so we use linked list\n *\n * There are few watches then a lot of observers. This is why you don't want the observer to be\n * implemented in the same way as watch. Watch requires return of initialization function which\n * are expensive to construct.\n */\n\n\n/**\n * @ngdoc provider\n * @name $rootScopeProvider\n * @description\n *\n * Provider for the $rootScope service.\n */\n\n/**\n * @ngdoc method\n * @name $rootScopeProvider#digestTtl\n * @description\n *\n * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and\n * assuming that the model is unstable.\n *\n * The current default is 10 iterations.\n *\n * In complex applications it's possible that the dependencies between `$watch`s will result in\n * several digest iterations. However if an application needs more than the default 10 digest\n * iterations for its model to stabilize then you should investigate what is causing the model to\n * continuously change during the digest.\n *\n * Increasing the TTL could have performance implications, so you should not change it without\n * proper justification.\n *\n * @param {number} limit The number of digest iterations.\n */\n\n\n/**\n * @ngdoc service\n * @name $rootScope\n * @description\n *\n * Every application has a single root {@link ng.$rootScope.Scope scope}.\n * All other scopes are descendant scopes of the root scope. Scopes provide separation\n * between the model and the view, via a mechanism for watching the model for changes.\n * They also provide an event emission/broadcast and subscription facility. See the\n * {@link guide/scope developer guide on scopes}.\n */\nfunction $RootScopeProvider(){\n  var TTL = 10;\n  var $rootScopeMinErr = minErr('$rootScope');\n  var lastDirtyWatch = null;\n\n  this.digestTtl = function(value) {\n    if (arguments.length) {\n      TTL = value;\n    }\n    return TTL;\n  };\n\n  this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',\n      function( $injector,   $exceptionHandler,   $parse,   $browser) {\n\n    /**\n     * @ngdoc type\n     * @name $rootScope.Scope\n     *\n     * @description\n     * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the\n     * {@link auto.$injector $injector}. Child scopes are created using the\n     * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when\n     * compiled HTML template is executed.)\n     *\n     * Here is a simple scope snippet to show how you can interact with the scope.\n     * ```html\n     * <file src=\"./test/ng/rootScopeSpec.js\" tag=\"docs1\" />\n     * ```\n     *\n     * # Inheritance\n     * A scope can inherit from a parent scope, as in this example:\n     * ```js\n         var parent = $rootScope;\n         var child = parent.$new();\n\n         parent.salutation = \"Hello\";\n         child.name = \"World\";\n         expect(child.salutation).toEqual('Hello');\n\n         child.salutation = \"Welcome\";\n         expect(child.salutation).toEqual('Welcome');\n         expect(parent.salutation).toEqual('Hello');\n     * ```\n     *\n     *\n     * @param {Object.<string, function()>=} providers Map of service factory which need to be\n     *                                       provided for the current scope. Defaults to {@link ng}.\n     * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should\n     *                              append/override services provided by `providers`. This is handy\n     *                              when unit-testing and having the need to override a default\n     *                              service.\n     * @returns {Object} Newly created scope.\n     *\n     */\n    function Scope() {\n      this.$id = nextUid();\n      this.$$phase = this.$parent = this.$$watchers =\n                     this.$$nextSibling = this.$$prevSibling =\n                     this.$$childHead = this.$$childTail = null;\n      this['this'] = this.$root =  this;\n      this.$$destroyed = false;\n      this.$$asyncQueue = [];\n      this.$$postDigestQueue = [];\n      this.$$listeners = {};\n      this.$$listenerCount = {};\n      this.$$isolateBindings = {};\n    }\n\n    /**\n     * @ngdoc property\n     * @name $rootScope.Scope#$id\n     * @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for\n     *   debugging.\n     */\n\n\n    Scope.prototype = {\n      constructor: Scope,\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$new\n       * @kind function\n       *\n       * @description\n       * Creates a new child {@link ng.$rootScope.Scope scope}.\n       *\n       * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and\n       * {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the\n       * scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.\n       *\n       * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is\n       * desired for the scope and its child scopes to be permanently detached from the parent and\n       * thus stop participating in model change detection and listener notification by invoking.\n       *\n       * @param {boolean} isolate If true, then the scope does not prototypically inherit from the\n       *         parent scope. The scope is isolated, as it can not see parent scope properties.\n       *         When creating widgets, it is useful for the widget to not accidentally read parent\n       *         state.\n       *\n       * @returns {Object} The newly created child scope.\n       *\n       */\n      $new: function(isolate) {\n        var ChildScope,\n            child;\n\n        if (isolate) {\n          child = new Scope();\n          child.$root = this.$root;\n          // ensure that there is just one async queue per $rootScope and its children\n          child.$$asyncQueue = this.$$asyncQueue;\n          child.$$postDigestQueue = this.$$postDigestQueue;\n        } else {\n          // Only create a child scope class if somebody asks for one,\n          // but cache it to allow the VM to optimize lookups.\n          if (!this.$$childScopeClass) {\n            this.$$childScopeClass = function() {\n              this.$$watchers = this.$$nextSibling =\n                  this.$$childHead = this.$$childTail = null;\n              this.$$listeners = {};\n              this.$$listenerCount = {};\n              this.$id = nextUid();\n              this.$$childScopeClass = null;\n            };\n            this.$$childScopeClass.prototype = this;\n          }\n          child = new this.$$childScopeClass();\n        }\n        child['this'] = child;\n        child.$parent = this;\n        child.$$prevSibling = this.$$childTail;\n        if (this.$$childHead) {\n          this.$$childTail.$$nextSibling = child;\n          this.$$childTail = child;\n        } else {\n          this.$$childHead = this.$$childTail = child;\n        }\n        return child;\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watch\n       * @kind function\n       *\n       * @description\n       * Registers a `listener` callback to be executed whenever the `watchExpression` changes.\n       *\n       * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest\n       *   $digest()} and should return the value that will be watched. (Since\n       *   {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the\n       *   `watchExpression` can execute multiple times per\n       *   {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)\n       * - The `listener` is called only when the value from the current `watchExpression` and the\n       *   previous call to `watchExpression` are not equal (with the exception of the initial run,\n       *   see below). Inequality is determined according to reference inequality,\n       *   [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)\n       *    via the `!==` Javascript operator, unless `objectEquality == true`\n       *   (see next point)\n       * - When `objectEquality == true`, inequality of the `watchExpression` is determined\n       *   according to the {@link angular.equals} function. To save the value of the object for\n       *   later comparison, the {@link angular.copy} function is used. This therefore means that\n       *   watching complex objects will have adverse memory and performance implications.\n       * - The watch `listener` may change the model, which may trigger other `listener`s to fire.\n       *   This is achieved by rerunning the watchers until no changes are detected. The rerun\n       *   iteration limit is 10 to prevent an infinite loop deadlock.\n       *\n       *\n       * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,\n       * you can register a `watchExpression` function with no `listener`. (Since `watchExpression`\n       * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a\n       * change is detected, be prepared for multiple calls to your listener.)\n       *\n       * After a watcher is registered with the scope, the `listener` fn is called asynchronously\n       * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the\n       * watcher. In rare cases, this is undesirable because the listener is called when the result\n       * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you\n       * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the\n       * listener was called due to initialization.\n       *\n       * The example below contains an illustration of using a function as your $watch listener\n       *\n       *\n       * # Example\n       * ```js\n           // let's assume that scope was dependency injected as the $rootScope\n           var scope = $rootScope;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n\n\n\n           // Using a listener function\n           var food;\n           scope.foodCounter = 0;\n           expect(scope.foodCounter).toEqual(0);\n           scope.$watch(\n             // This is the listener function\n             function() { return food; },\n             // This is the change handler\n             function(newValue, oldValue) {\n               if ( newValue !== oldValue ) {\n                 // Only increment the counter if the value changed\n                 scope.foodCounter = scope.foodCounter + 1;\n               }\n             }\n           );\n           // No digest has been run so the counter will be zero\n           expect(scope.foodCounter).toEqual(0);\n\n           // Run the digest but since food has not changed count will still be zero\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(0);\n\n           // Update food and run digest.  Now the counter will increment\n           food = 'cheeseburger';\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(1);\n\n       * ```\n       *\n       *\n       *\n       * @param {(function()|string)} watchExpression Expression that is evaluated on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers\n       *    a call to the `listener`.\n       *\n       *    - `string`: Evaluated as {@link guide/expression expression}\n       *    - `function(scope)`: called with current `scope` as a parameter.\n       * @param {(function()|string)=} listener Callback called whenever the return value of\n       *   the `watchExpression` changes.\n       *\n       *    - `string`: Evaluated as {@link guide/expression expression}\n       *    - `function(newValue, oldValue, scope)`: called with current and previous values as\n       *      parameters.\n       *\n       * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of\n       *     comparing for reference equality.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $watch: function(watchExp, listener, objectEquality) {\n        var scope = this,\n            get = compileToFn(watchExp, 'watch'),\n            array = scope.$$watchers,\n            watcher = {\n              fn: listener,\n              last: initWatchVal,\n              get: get,\n              exp: watchExp,\n              eq: !!objectEquality\n            };\n\n        lastDirtyWatch = null;\n\n        // in the case user pass string, we need to compile it, do we really need this ?\n        if (!isFunction(listener)) {\n          var listenFn = compileToFn(listener || noop, 'listener');\n          watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);};\n        }\n\n        if (typeof watchExp == 'string' && get.constant) {\n          var originalFn = watcher.fn;\n          watcher.fn = function(newVal, oldVal, scope) {\n            originalFn.call(this, newVal, oldVal, scope);\n            arrayRemove(array, watcher);\n          };\n        }\n\n        if (!array) {\n          array = scope.$$watchers = [];\n        }\n        // we use unshift since we use a while loop in $digest for speed.\n        // the while loop reads in reverse order.\n        array.unshift(watcher);\n\n        return function deregisterWatch() {\n          arrayRemove(array, watcher);\n          lastDirtyWatch = null;\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watchCollection\n       * @kind function\n       *\n       * @description\n       * Shallow watches the properties of an object and fires whenever any of the properties change\n       * (for arrays, this implies watching the array items; for object maps, this implies watching\n       * the properties). If a change is detected, the `listener` callback is fired.\n       *\n       * - The `obj` collection is observed via standard $watch operation and is examined on every\n       *   call to $digest() to see if any items have been added, removed, or moved.\n       * - The `listener` is called whenever anything within the `obj` has changed. Examples include\n       *   adding, removing, and moving items belonging to an object or array.\n       *\n       *\n       * # Example\n       * ```js\n          $scope.names = ['igor', 'matias', 'misko', 'james'];\n          $scope.dataCount = 4;\n\n          $scope.$watchCollection('names', function(newNames, oldNames) {\n            $scope.dataCount = newNames.length;\n          });\n\n          expect($scope.dataCount).toEqual(4);\n          $scope.$digest();\n\n          //still at 4 ... no changes\n          expect($scope.dataCount).toEqual(4);\n\n          $scope.names.pop();\n          $scope.$digest();\n\n          //now there's been a change\n          expect($scope.dataCount).toEqual(3);\n       * ```\n       *\n       *\n       * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The\n       *    expression value should evaluate to an object or an array which is observed on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the\n       *    collection will trigger a call to the `listener`.\n       *\n       * @param {function(newCollection, oldCollection, scope)} listener a callback function called\n       *    when a change is detected.\n       *    - The `newCollection` object is the newly modified data obtained from the `obj` expression\n       *    - The `oldCollection` object is a copy of the former collection data.\n       *      Due to performance considerations, the`oldCollection` value is computed only if the\n       *      `listener` function declares two or more arguments.\n       *    - The `scope` argument refers to the current scope.\n       *\n       * @returns {function()} Returns a de-registration function for this listener. When the\n       *    de-registration function is executed, the internal watch operation is terminated.\n       */\n      $watchCollection: function(obj, listener) {\n        var self = this;\n        // the current value, updated on each dirty-check run\n        var newValue;\n        // a shallow copy of the newValue from the last dirty-check run,\n        // updated to match newValue during dirty-check run\n        var oldValue;\n        // a shallow copy of the newValue from when the last change happened\n        var veryOldValue;\n        // only track veryOldValue if the listener is asking for it\n        var trackVeryOldValue = (listener.length > 1);\n        var changeDetected = 0;\n        var objGetter = $parse(obj);\n        var internalArray = [];\n        var internalObject = {};\n        var initRun = true;\n        var oldLength = 0;\n\n        function $watchCollectionWatch() {\n          newValue = objGetter(self);\n          var newLength, key;\n\n          if (!isObject(newValue)) { // if primitive\n            if (oldValue !== newValue) {\n              oldValue = newValue;\n              changeDetected++;\n            }\n          } else if (isArrayLike(newValue)) {\n            if (oldValue !== internalArray) {\n              // we are transitioning from something which was not an array into array.\n              oldValue = internalArray;\n              oldLength = oldValue.length = 0;\n              changeDetected++;\n            }\n\n            newLength = newValue.length;\n\n            if (oldLength !== newLength) {\n              // if lengths do not match we need to trigger change notification\n              changeDetected++;\n              oldValue.length = oldLength = newLength;\n            }\n            // copy the items to oldValue and look for changes.\n            for (var i = 0; i < newLength; i++) {\n              var bothNaN = (oldValue[i] !== oldValue[i]) &&\n                  (newValue[i] !== newValue[i]);\n              if (!bothNaN && (oldValue[i] !== newValue[i])) {\n                changeDetected++;\n                oldValue[i] = newValue[i];\n              }\n            }\n          } else {\n            if (oldValue !== internalObject) {\n              // we are transitioning from something which was not an object into object.\n              oldValue = internalObject = {};\n              oldLength = 0;\n              changeDetected++;\n            }\n            // copy the items to oldValue and look for changes.\n            newLength = 0;\n            for (key in newValue) {\n              if (newValue.hasOwnProperty(key)) {\n                newLength++;\n                if (oldValue.hasOwnProperty(key)) {\n                  if (oldValue[key] !== newValue[key]) {\n                    changeDetected++;\n                    oldValue[key] = newValue[key];\n                  }\n                } else {\n                  oldLength++;\n                  oldValue[key] = newValue[key];\n                  changeDetected++;\n                }\n              }\n            }\n            if (oldLength > newLength) {\n              // we used to have more keys, need to find them and destroy them.\n              changeDetected++;\n              for(key in oldValue) {\n                if (oldValue.hasOwnProperty(key) && !newValue.hasOwnProperty(key)) {\n                  oldLength--;\n                  delete oldValue[key];\n                }\n              }\n            }\n          }\n          return changeDetected;\n        }\n\n        function $watchCollectionAction() {\n          if (initRun) {\n            initRun = false;\n            listener(newValue, newValue, self);\n          } else {\n            listener(newValue, veryOldValue, self);\n          }\n\n          // make a copy for the next time a collection is changed\n          if (trackVeryOldValue) {\n            if (!isObject(newValue)) {\n              //primitive\n              veryOldValue = newValue;\n            } else if (isArrayLike(newValue)) {\n              veryOldValue = new Array(newValue.length);\n              for (var i = 0; i < newValue.length; i++) {\n                veryOldValue[i] = newValue[i];\n              }\n            } else { // if object\n              veryOldValue = {};\n              for (var key in newValue) {\n                if (hasOwnProperty.call(newValue, key)) {\n                  veryOldValue[key] = newValue[key];\n                }\n              }\n            }\n          }\n        }\n\n        return this.$watch($watchCollectionWatch, $watchCollectionAction);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$digest\n       * @kind function\n       *\n       * @description\n       * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and\n       * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change\n       * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}\n       * until no more listeners are firing. This means that it is possible to get into an infinite\n       * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of\n       * iterations exceeds 10.\n       *\n       * Usually, you don't call `$digest()` directly in\n       * {@link ng.directive:ngController controllers} or in\n       * {@link ng.$compileProvider#directive directives}.\n       * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within\n       * a {@link ng.$compileProvider#directive directives}), which will force a `$digest()`.\n       *\n       * If you want to be notified whenever `$digest()` is called,\n       * you can register a `watchExpression` function with\n       * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.\n       *\n       * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.\n       *\n       * # Example\n       * ```js\n           var scope = ...;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n       * ```\n       *\n       */\n      $digest: function() {\n        var watch, value, last,\n            watchers,\n            asyncQueue = this.$$asyncQueue,\n            postDigestQueue = this.$$postDigestQueue,\n            length,\n            dirty, ttl = TTL,\n            next, current, target = this,\n            watchLog = [],\n            logIdx, logMsg, asyncTask;\n\n        beginPhase('$digest');\n\n        lastDirtyWatch = null;\n\n        do { // \"while dirty\" loop\n          dirty = false;\n          current = target;\n\n          while(asyncQueue.length) {\n            try {\n              asyncTask = asyncQueue.shift();\n              asyncTask.scope.$eval(asyncTask.expression);\n            } catch (e) {\n              clearPhase();\n              $exceptionHandler(e);\n            }\n            lastDirtyWatch = null;\n          }\n\n          traverseScopesLoop:\n          do { // \"traverse the scopes\" loop\n            if ((watchers = current.$$watchers)) {\n              // process our watches\n              length = watchers.length;\n              while (length--) {\n                try {\n                  watch = watchers[length];\n                  // Most common watches are on primitives, in which case we can short\n                  // circuit it with === operator, only when === fails do we use .equals\n                  if (watch) {\n                    if ((value = watch.get(current)) !== (last = watch.last) &&\n                        !(watch.eq\n                            ? equals(value, last)\n                            : (typeof value == 'number' && typeof last == 'number'\n                               && isNaN(value) && isNaN(last)))) {\n                      dirty = true;\n                      lastDirtyWatch = watch;\n                      watch.last = watch.eq ? copy(value, null) : value;\n                      watch.fn(value, ((last === initWatchVal) ? value : last), current);\n                      if (ttl < 5) {\n                        logIdx = 4 - ttl;\n                        if (!watchLog[logIdx]) watchLog[logIdx] = [];\n                        logMsg = (isFunction(watch.exp))\n                            ? 'fn: ' + (watch.exp.name || watch.exp.toString())\n                            : watch.exp;\n                        logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);\n                        watchLog[logIdx].push(logMsg);\n                      }\n                    } else if (watch === lastDirtyWatch) {\n                      // If the most recently dirty watcher is now clean, short circuit since the remaining watchers\n                      // have already been tested.\n                      dirty = false;\n                      break traverseScopesLoop;\n                    }\n                  }\n                } catch (e) {\n                  clearPhase();\n                  $exceptionHandler(e);\n                }\n              }\n            }\n\n            // Insanity Warning: scope depth-first traversal\n            // yes, this code is a bit crazy, but it works and we have tests to prove it!\n            // this piece should be kept in sync with the traversal in $broadcast\n            if (!(next = (current.$$childHead ||\n                (current !== target && current.$$nextSibling)))) {\n              while(current !== target && !(next = current.$$nextSibling)) {\n                current = current.$parent;\n              }\n            }\n          } while ((current = next));\n\n          // `break traverseScopesLoop;` takes us to here\n\n          if((dirty || asyncQueue.length) && !(ttl--)) {\n            clearPhase();\n            throw $rootScopeMinErr('infdig',\n                '{0} $digest() iterations reached. Aborting!\\n' +\n                'Watchers fired in the last 5 iterations: {1}',\n                TTL, toJson(watchLog));\n          }\n\n        } while (dirty || asyncQueue.length);\n\n        clearPhase();\n\n        while(postDigestQueue.length) {\n          try {\n            postDigestQueue.shift()();\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        }\n      },\n\n\n      /**\n       * @ngdoc event\n       * @name $rootScope.Scope#$destroy\n       * @eventType broadcast on scope being destroyed\n       *\n       * @description\n       * Broadcasted when a scope and its children are being destroyed.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$destroy\n       * @kind function\n       *\n       * @description\n       * Removes the current scope (and all of its children) from the parent scope. Removal implies\n       * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer\n       * propagate to the current scope and its children. Removal also implies that the current\n       * scope is eligible for garbage collection.\n       *\n       * The `$destroy()` is usually used by directives such as\n       * {@link ng.directive:ngRepeat ngRepeat} for managing the\n       * unrolling of the loop.\n       *\n       * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.\n       * Application code can register a `$destroy` event handler that will give it a chance to\n       * perform any necessary cleanup.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n      $destroy: function() {\n        // we can't destroy the root scope or a scope that has been already destroyed\n        if (this.$$destroyed) return;\n        var parent = this.$parent;\n\n        this.$broadcast('$destroy');\n        this.$$destroyed = true;\n        if (this === $rootScope) return;\n\n        forEach(this.$$listenerCount, bind(null, decrementListenerCount, this));\n\n        // sever all the references to parent scopes (after this cleanup, the current scope should\n        // not be retained by any of our references and should be eligible for garbage collection)\n        if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;\n        if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;\n        if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;\n        if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;\n\n\n        // All of the code below is bogus code that works around V8's memory leak via optimized code\n        // and inline caches.\n        //\n        // see:\n        // - https://code.google.com/p/v8/issues/detail?id=2073#c26\n        // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909\n        // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451\n\n        this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =\n            this.$$childTail = this.$root = null;\n\n        // don't reset these to null in case some async task tries to register a listener/watch/task\n        this.$$listeners = {};\n        this.$$watchers = this.$$asyncQueue = this.$$postDigestQueue = [];\n\n        // prevent NPEs since these methods have references to properties we nulled out\n        this.$destroy = this.$digest = this.$apply = noop;\n        this.$on = this.$watch = function() { return noop; };\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$eval\n       * @kind function\n       *\n       * @description\n       * Executes the `expression` on the current scope and returns the result. Any exceptions in\n       * the expression are propagated (uncaught). This is useful when evaluating Angular\n       * expressions.\n       *\n       * # Example\n       * ```js\n           var scope = ng.$rootScope.Scope();\n           scope.a = 1;\n           scope.b = 2;\n\n           expect(scope.$eval('a+b')).toEqual(3);\n           expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);\n       * ```\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in  {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n       * @returns {*} The result of evaluating the expression.\n       */\n      $eval: function(expr, locals) {\n        return $parse(expr)(this, locals);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$evalAsync\n       * @kind function\n       *\n       * @description\n       * Executes the expression on the current scope at a later point in time.\n       *\n       * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only\n       * that:\n       *\n       *   - it will execute after the function that scheduled the evaluation (preferably before DOM\n       *     rendering).\n       *   - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after\n       *     `expression` execution.\n       *\n       * Any exceptions from the execution of the expression are forwarded to the\n       * {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle\n       * will be scheduled. However, it is encouraged to always call code that changes the model\n       * from within an `$apply` call. That includes code evaluated via `$evalAsync`.\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       */\n      $evalAsync: function(expr) {\n        // if we are outside of an $digest loop and this is the first time we are scheduling async\n        // task also schedule async auto-flush\n        if (!$rootScope.$$phase && !$rootScope.$$asyncQueue.length) {\n          $browser.defer(function() {\n            if ($rootScope.$$asyncQueue.length) {\n              $rootScope.$digest();\n            }\n          });\n        }\n\n        this.$$asyncQueue.push({scope: this, expression: expr});\n      },\n\n      $$postDigest : function(fn) {\n        this.$$postDigestQueue.push(fn);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$apply\n       * @kind function\n       *\n       * @description\n       * `$apply()` is used to execute an expression in angular from outside of the angular\n       * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).\n       * Because we are calling into the angular framework we need to perform proper scope life\n       * cycle of {@link ng.$exceptionHandler exception handling},\n       * {@link ng.$rootScope.Scope#$digest executing watches}.\n       *\n       * ## Life cycle\n       *\n       * # Pseudo-Code of `$apply()`\n       * ```js\n           function $apply(expr) {\n             try {\n               return $eval(expr);\n             } catch (e) {\n               $exceptionHandler(e);\n             } finally {\n               $root.$digest();\n             }\n           }\n       * ```\n       *\n       *\n       * Scope's `$apply()` method transitions through the following stages:\n       *\n       * 1. The {@link guide/expression expression} is executed using the\n       *    {@link ng.$rootScope.Scope#$eval $eval()} method.\n       * 2. Any exceptions from the execution of the expression are forwarded to the\n       *    {@link ng.$exceptionHandler $exceptionHandler} service.\n       * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the\n       *    expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.\n       *\n       *\n       * @param {(string|function())=} exp An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with current `scope` parameter.\n       *\n       * @returns {*} The result of evaluating the expression.\n       */\n      $apply: function(expr) {\n        try {\n          beginPhase('$apply');\n          return this.$eval(expr);\n        } catch (e) {\n          $exceptionHandler(e);\n        } finally {\n          clearPhase();\n          try {\n            $rootScope.$digest();\n          } catch (e) {\n            $exceptionHandler(e);\n            throw e;\n          }\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$on\n       * @kind function\n       *\n       * @description\n       * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for\n       * discussion of event life cycle.\n       *\n       * The event listener function format is: `function(event, args...)`. The `event` object\n       * passed into the listener has the following attributes:\n       *\n       *   - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or\n       *     `$broadcast`-ed.\n       *   - `currentScope` - `{Scope}`: the current scope which is handling the event.\n       *   - `name` - `{string}`: name of the event.\n       *   - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel\n       *     further event propagation (available only for events that were `$emit`-ed).\n       *   - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag\n       *     to true.\n       *   - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.\n       *\n       * @param {string} name Event name to listen on.\n       * @param {function(event, ...args)} listener Function to call when the event is emitted.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $on: function(name, listener) {\n        var namedListeners = this.$$listeners[name];\n        if (!namedListeners) {\n          this.$$listeners[name] = namedListeners = [];\n        }\n        namedListeners.push(listener);\n\n        var current = this;\n        do {\n          if (!current.$$listenerCount[name]) {\n            current.$$listenerCount[name] = 0;\n          }\n          current.$$listenerCount[name]++;\n        } while ((current = current.$parent));\n\n        var self = this;\n        return function() {\n          namedListeners[indexOf(namedListeners, listener)] = null;\n          decrementListenerCount(self, 1, name);\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$emit\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` upwards through the scope hierarchy notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$emit` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event traverses upwards toward the root scope and calls all\n       * registered listeners along the way. The event will stop propagating if one of the listeners\n       * cancels it.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to emit.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).\n       */\n      $emit: function(name, args) {\n        var empty = [],\n            namedListeners,\n            scope = this,\n            stopPropagation = false,\n            event = {\n              name: name,\n              targetScope: scope,\n              stopPropagation: function() {stopPropagation = true;},\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            },\n            listenerArgs = concat([event], arguments, 1),\n            i, length;\n\n        do {\n          namedListeners = scope.$$listeners[name] || empty;\n          event.currentScope = scope;\n          for (i=0, length=namedListeners.length; i<length; i++) {\n\n            // if listeners were deregistered, defragment the array\n            if (!namedListeners[i]) {\n              namedListeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n            try {\n              //allow all listeners attached to the current scope to run\n              namedListeners[i].apply(null, listenerArgs);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n          }\n          //if any listener on the current scope stops propagation, prevent bubbling\n          if (stopPropagation) return event;\n          //traverse upwards\n          scope = scope.$parent;\n        } while (scope);\n\n        return event;\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$broadcast\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` downwards to all child scopes (and their children) notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$broadcast` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event propagates to all direct and indirect scopes of the current\n       * scope and calls all registered listeners along the way. The event cannot be canceled.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to broadcast.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}\n       */\n      $broadcast: function(name, args) {\n        var target = this,\n            current = target,\n            next = target,\n            event = {\n              name: name,\n              targetScope: target,\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            },\n            listenerArgs = concat([event], arguments, 1),\n            listeners, i, length;\n\n        //down while you can, then up and next sibling or up and next sibling until back at root\n        while ((current = next)) {\n          event.currentScope = current;\n          listeners = current.$$listeners[name] || [];\n          for (i=0, length = listeners.length; i<length; i++) {\n            // if listeners were deregistered, defragment the array\n            if (!listeners[i]) {\n              listeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n\n            try {\n              listeners[i].apply(null, listenerArgs);\n            } catch(e) {\n              $exceptionHandler(e);\n            }\n          }\n\n          // Insanity Warning: scope depth-first traversal\n          // yes, this code is a bit crazy, but it works and we have tests to prove it!\n          // this piece should be kept in sync with the traversal in $digest\n          // (though it differs due to having the extra check for $$listenerCount)\n          if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||\n              (current !== target && current.$$nextSibling)))) {\n            while(current !== target && !(next = current.$$nextSibling)) {\n              current = current.$parent;\n            }\n          }\n        }\n\n        return event;\n      }\n    };\n\n    var $rootScope = new Scope();\n\n    return $rootScope;\n\n\n    function beginPhase(phase) {\n      if ($rootScope.$$phase) {\n        throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);\n      }\n\n      $rootScope.$$phase = phase;\n    }\n\n    function clearPhase() {\n      $rootScope.$$phase = null;\n    }\n\n    function compileToFn(exp, name) {\n      var fn = $parse(exp);\n      assertArgFn(fn, name);\n      return fn;\n    }\n\n    function decrementListenerCount(current, count, name) {\n      do {\n        current.$$listenerCount[name] -= count;\n\n        if (current.$$listenerCount[name] === 0) {\n          delete current.$$listenerCount[name];\n        }\n      } while ((current = current.$parent));\n    }\n\n    /**\n     * function used as an initial value for watchers.\n     * because it's unique we can easily tell it apart from other values\n     */\n    function initWatchVal() {}\n  }];\n}\n\n/**\n * @description\n * Private service to sanitize uris for links and images. Used by $compile and $sanitize.\n */\nfunction $$SanitizeUriProvider() {\n  var aHrefSanitizationWhitelist = /^\\s*(https?|ftp|mailto|tel|file):/,\n    imgSrcSanitizationWhitelist = /^\\s*(https?|ftp|file):|data:image\\//;\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      aHrefSanitizationWhitelist = regexp;\n      return this;\n    }\n    return aHrefSanitizationWhitelist;\n  };\n\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      imgSrcSanitizationWhitelist = regexp;\n      return this;\n    }\n    return imgSrcSanitizationWhitelist;\n  };\n\n  this.$get = function() {\n    return function sanitizeUri(uri, isImage) {\n      var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;\n      var normalizedVal;\n      // NOTE: urlResolve() doesn't support IE < 8 so we don't sanitize for that case.\n      if (!msie || msie >= 8 ) {\n        normalizedVal = urlResolve(uri).href;\n        if (normalizedVal !== '' && !normalizedVal.match(regex)) {\n          return 'unsafe:'+normalizedVal;\n        }\n      }\n      return uri;\n    };\n  };\n}\n\nvar $sceMinErr = minErr('$sce');\n\nvar SCE_CONTEXTS = {\n  HTML: 'html',\n  CSS: 'css',\n  URL: 'url',\n  // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a\n  // url.  (e.g. ng-include, script src, templateUrl)\n  RESOURCE_URL: 'resourceUrl',\n  JS: 'js'\n};\n\n// Helper functions follow.\n\n// Copied from:\n// http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962\n// Prereq: s is a string.\nfunction escapeForRegexp(s) {\n  return s.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1').\n           replace(/\\x08/g, '\\\\x08');\n}\n\n\nfunction adjustMatcher(matcher) {\n  if (matcher === 'self') {\n    return matcher;\n  } else if (isString(matcher)) {\n    // Strings match exactly except for 2 wildcards - '*' and '**'.\n    // '*' matches any character except those from the set ':/.?&'.\n    // '**' matches any character (like .* in a RegExp).\n    // More than 2 *'s raises an error as it's ill defined.\n    if (matcher.indexOf('***') > -1) {\n      throw $sceMinErr('iwcard',\n          'Illegal sequence *** in string matcher.  String: {0}', matcher);\n    }\n    matcher = escapeForRegexp(matcher).\n                  replace('\\\\*\\\\*', '.*').\n                  replace('\\\\*', '[^:/.?&;]*');\n    return new RegExp('^' + matcher + '$');\n  } else if (isRegExp(matcher)) {\n    // The only other type of matcher allowed is a Regexp.\n    // Match entire URL / disallow partial matches.\n    // Flags are reset (i.e. no global, ignoreCase or multiline)\n    return new RegExp('^' + matcher.source + '$');\n  } else {\n    throw $sceMinErr('imatcher',\n        'Matchers may only be \"self\", string patterns or RegExp objects');\n  }\n}\n\n\nfunction adjustMatchers(matchers) {\n  var adjustedMatchers = [];\n  if (isDefined(matchers)) {\n    forEach(matchers, function(matcher) {\n      adjustedMatchers.push(adjustMatcher(matcher));\n    });\n  }\n  return adjustedMatchers;\n}\n\n\n/**\n * @ngdoc service\n * @name $sceDelegate\n * @kind function\n *\n * @description\n *\n * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict\n * Contextual Escaping (SCE)} services to AngularJS.\n *\n * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of\n * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS.  This is\n * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to\n * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things\n * work because `$sce` delegates to `$sceDelegate` for these operations.\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.\n *\n * The default instance of `$sceDelegate` should work out of the box with little pain.  While you\n * can override it completely to change the behavior of `$sce`, the common case would\n * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting\n * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as\n * templates.  Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist\n * $sceDelegateProvider.resourceUrlWhitelist} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n */\n\n/**\n * @ngdoc provider\n * @name $sceDelegateProvider\n * @description\n *\n * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate\n * $sceDelegate} service.  This allows one to get/set the whitelists and blacklists used to ensure\n * that the URLs used for sourcing Angular templates are safe.  Refer {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and\n * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n *\n * For the general details about this service in Angular, read the main page for {@link ng.$sce\n * Strict Contextual Escaping (SCE)}.\n *\n * **Example**:  Consider the following case. <a name=\"example\"></a>\n *\n * - your app is hosted at url `http://myapp.example.com/`\n * - but some of your templates are hosted on other domains you control such as\n *   `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.\n * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.\n *\n * Here is what a secure configuration for this scenario might look like:\n *\n * <pre class=\"prettyprint\">\n *    angular.module('myApp', []).config(function($sceDelegateProvider) {\n *      $sceDelegateProvider.resourceUrlWhitelist([\n *        // Allow same origin resource loads.\n *        'self',\n *        // Allow loading from our assets domain.  Notice the difference between * and **.\n *        'http://srv*.assets.example.com/**']);\n *\n *      // The blacklist overrides the whitelist so the open redirect here is blocked.\n *      $sceDelegateProvider.resourceUrlBlacklist([\n *        'http://myapp.example.com/clickThru**']);\n *      });\n * </pre>\n */\n\nfunction $SceDelegateProvider() {\n  this.SCE_CONTEXTS = SCE_CONTEXTS;\n\n  // Resource URLs can also be trusted by policy.\n  var resourceUrlWhitelist = ['self'],\n      resourceUrlBlacklist = [];\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlWhitelist\n   * @kind function\n   *\n   * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value\n   *     provided.  This must be an array or null.  A snapshot of this array is used so further\n   *     changes to the array are ignored.\n   *\n   *     Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *     allowed in this array.\n   *\n   *     Note: **an empty whitelist array will block all URLs**!\n   *\n   * @return {Array} the currently set whitelist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is `['self']` allowing only\n   * same origin resource requests.\n   *\n   * @description\n   * Sets/Gets the whitelist of trusted resource URLs.\n   */\n  this.resourceUrlWhitelist = function (value) {\n    if (arguments.length) {\n      resourceUrlWhitelist = adjustMatchers(value);\n    }\n    return resourceUrlWhitelist;\n  };\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlBlacklist\n   * @kind function\n   *\n   * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value\n   *     provided.  This must be an array or null.  A snapshot of this array is used so further\n   *     changes to the array are ignored.\n   *\n   *     Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *     allowed in this array.\n   *\n   *     The typical usage for the blacklist is to **block\n   *     [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as\n   *     these would otherwise be trusted but actually return content from the redirected domain.\n   *\n   *     Finally, **the blacklist overrides the whitelist** and has the final say.\n   *\n   * @return {Array} the currently set blacklist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there\n   * is no blacklist.)\n   *\n   * @description\n   * Sets/Gets the blacklist of trusted resource URLs.\n   */\n\n  this.resourceUrlBlacklist = function (value) {\n    if (arguments.length) {\n      resourceUrlBlacklist = adjustMatchers(value);\n    }\n    return resourceUrlBlacklist;\n  };\n\n  this.$get = ['$injector', function($injector) {\n\n    var htmlSanitizer = function htmlSanitizer(html) {\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    };\n\n    if ($injector.has('$sanitize')) {\n      htmlSanitizer = $injector.get('$sanitize');\n    }\n\n\n    function matchUrl(matcher, parsedUrl) {\n      if (matcher === 'self') {\n        return urlIsSameOrigin(parsedUrl);\n      } else {\n        // definitely a regex.  See adjustMatchers()\n        return !!matcher.exec(parsedUrl.href);\n      }\n    }\n\n    function isResourceUrlAllowedByPolicy(url) {\n      var parsedUrl = urlResolve(url.toString());\n      var i, n, allowed = false;\n      // Ensure that at least one item from the whitelist allows this url.\n      for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {\n        if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {\n          allowed = true;\n          break;\n        }\n      }\n      if (allowed) {\n        // Ensure that no item from the blacklist blocked this url.\n        for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {\n          if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {\n            allowed = false;\n            break;\n          }\n        }\n      }\n      return allowed;\n    }\n\n    function generateHolderType(Base) {\n      var holderType = function TrustedValueHolderType(trustedValue) {\n        this.$$unwrapTrustedValue = function() {\n          return trustedValue;\n        };\n      };\n      if (Base) {\n        holderType.prototype = new Base();\n      }\n      holderType.prototype.valueOf = function sceValueOf() {\n        return this.$$unwrapTrustedValue();\n      };\n      holderType.prototype.toString = function sceToString() {\n        return this.$$unwrapTrustedValue().toString();\n      };\n      return holderType;\n    }\n\n    var trustedValueHolderBase = generateHolderType(),\n        byType = {};\n\n    byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#trustAs\n     *\n     * @description\n     * Returns an object that is trusted by angular for use in specified strict\n     * contextual escaping contexts (such as ng-bind-html, ng-include, any src\n     * attribute interpolation, any dom event binding attribute interpolation\n     * such as for onclick,  etc.) that uses the provided value.\n     * See {@link ng.$sce $sce} for enabling strict contextual escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resourceUrl, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n    function trustAs(type, trustedValue) {\n      var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (!Constructor) {\n        throw $sceMinErr('icontext',\n            'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',\n            type, trustedValue);\n      }\n      if (trustedValue === null || trustedValue === undefined || trustedValue === '') {\n        return trustedValue;\n      }\n      // All the current contexts in SCE_CONTEXTS happen to be strings.  In order to avoid trusting\n      // mutable objects, we ensure here that the value passed in is actually a string.\n      if (typeof trustedValue !== 'string') {\n        throw $sceMinErr('itype',\n            'Attempted to trust a non-string value in a content requiring a string: Context: {0}',\n            type);\n      }\n      return new Constructor(trustedValue);\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#valueOf\n     *\n     * @description\n     * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs\n     * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.\n     *\n     * If the passed parameter is not a value that had been returned by {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.\n     *\n     * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}\n     *      call or anything else.\n     * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if `value` is the result of such a call.  Otherwise, returns\n     *     `value` unchanged.\n     */\n    function valueOf(maybeTrusted) {\n      if (maybeTrusted instanceof trustedValueHolderBase) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      } else {\n        return maybeTrusted;\n      }\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#getTrusted\n     *\n     * @description\n     * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and\n     * returns the originally supplied value if the queried context type is a supertype of the\n     * created type.  If this condition isn't satisfied, throws an exception.\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} call.\n     * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if valid in this context.  Otherwise, throws an exception.\n     */\n    function getTrusted(type, maybeTrusted) {\n      if (maybeTrusted === null || maybeTrusted === undefined || maybeTrusted === '') {\n        return maybeTrusted;\n      }\n      var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (constructor && maybeTrusted instanceof constructor) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      }\n      // If we get here, then we may only take one of two actions.\n      // 1. sanitize the value for the requested type, or\n      // 2. throw an exception.\n      if (type === SCE_CONTEXTS.RESOURCE_URL) {\n        if (isResourceUrlAllowedByPolicy(maybeTrusted)) {\n          return maybeTrusted;\n        } else {\n          throw $sceMinErr('insecurl',\n              'Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}',\n              maybeTrusted.toString());\n        }\n      } else if (type === SCE_CONTEXTS.HTML) {\n        return htmlSanitizer(maybeTrusted);\n      }\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    }\n\n    return { trustAs: trustAs,\n             getTrusted: getTrusted,\n             valueOf: valueOf };\n  }];\n}\n\n\n/**\n * @ngdoc provider\n * @name $sceProvider\n * @description\n *\n * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.\n * -   enable/disable Strict Contextual Escaping (SCE) in a module\n * -   override the default implementation with a custom delegate\n *\n * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.\n */\n\n/* jshint maxlen: false*/\n\n/**\n * @ngdoc service\n * @name $sce\n * @kind function\n *\n * @description\n *\n * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.\n *\n * # Strict Contextual Escaping\n *\n * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain\n * contexts to result in a value that is marked as safe to use for that context.  One example of\n * such a context is binding arbitrary html controlled by the user via `ng-bind-html`.  We refer\n * to these contexts as privileged or SCE contexts.\n *\n * As of version 1.2, Angular ships with SCE enabled by default.\n *\n * Note:  When enabled (the default), IE8 in quirks mode is not supported.  In this mode, IE8 allows\n * one to execute arbitrary javascript by the use of the expression() syntax.  Refer\n * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.\n * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`\n * to the top of your HTML document.\n *\n * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for\n * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.\n *\n * Here's an example of a binding in a privileged context:\n *\n * <pre class=\"prettyprint\">\n *     <input ng-model=\"userHtml\">\n *     <div ng-bind-html=\"userHtml\">\n * </pre>\n *\n * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user.  With SCE\n * disabled, this application allows the user to render arbitrary HTML into the DIV.\n * In a more realistic example, one may be rendering user comments, blog articles, etc. via\n * bindings.  (HTML is just one example of a context where rendering user controlled input creates\n * security vulnerabilities.)\n *\n * For the case of HTML, you might use a library, either on the client side, or on the server side,\n * to sanitize unsafe HTML before binding to the value and rendering it in the document.\n *\n * How would you ensure that every place that used these types of bindings was bound to a value that\n * was sanitized by your library (or returned as safe for rendering by your server?)  How can you\n * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some\n * properties/fields and forgot to update the binding to the sanitized value?\n *\n * To be secure by default, you want to ensure that any such bindings are disallowed unless you can\n * determine that something explicitly says it's safe to use a value for binding in that\n * context.  You can then audit your code (a simple grep would do) to ensure that this is only done\n * for those values that you can easily tell are safe - because they were received from your server,\n * sanitized by your library, etc.  You can organize your codebase to help with this - perhaps\n * allowing only the files in a specific directory to do this.  Ensuring that the internal API\n * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.\n *\n * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}\n * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to\n * obtain values that will be accepted by SCE / privileged contexts.\n *\n *\n * ## How does it work?\n *\n * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted\n * $sce.getTrusted(context, value)} rather than to the value directly.  Directives use {@link\n * ng.$sce#parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the\n * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.\n *\n * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link\n * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}.  Here's the actual code (slightly\n * simplified):\n *\n * <pre class=\"prettyprint\">\n *   var ngBindHtmlDirective = ['$sce', function($sce) {\n *     return function(scope, element, attr) {\n *       scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {\n *         element.html(value || '');\n *       });\n *     };\n *   }];\n * </pre>\n *\n * ## Impact on loading templates\n *\n * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as\n * `templateUrl`'s specified by {@link guide/directive directives}.\n *\n * By default, Angular only loads templates from the same domain and protocol as the application\n * document.  This is done by calling {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on the template URL.  To load templates from other domains and/or\n * protocols, you may either either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist\n * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.\n *\n * *Please note*:\n * The browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy apply in addition to this and may further restrict whether the template is successfully\n * loaded.  This means that without the right CORS policy, loading templates from a different domain\n * won't work on all browsers.  Also, loading templates from `file://` URL does not work on some\n * browsers.\n *\n * ## This feels like too much overhead for the developer?\n *\n * It's important to remember that SCE only applies to interpolation expressions.\n *\n * If your expressions are constant literals, they're automatically trusted and you don't need to\n * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.\n * `<div ng-bind-html=\"'<b>implicitly trusted</b>'\"></div>`) just works.\n *\n * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them\n * through {@link ng.$sce#getTrusted $sce.getTrusted}.  SCE doesn't play a role here.\n *\n * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load\n * templates in `ng-include` from your application's domain without having to even know about SCE.\n * It blocks loading templates from other domains or loading templates over http from an https\n * served document.  You can change these by setting your own custom {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.\n *\n * This significantly reduces the overhead.  It is far easier to pay the small overhead and have an\n * application that's secure and can be audited to verify that with much more ease than bolting\n * security onto an application later.\n *\n * <a name=\"contexts\"></a>\n * ## What trusted context types are supported?\n *\n * | Context             | Notes          |\n * |---------------------|----------------|\n * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |\n * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently unused.  Feel free to use it in your own directives. |\n * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |\n * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |\n * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently unused.  Feel free to use it in your own directives. |\n *\n * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name=\"resourceUrlPatternItem\"></a>\n *\n *  Each element in these arrays must be one of the following:\n *\n *  - **'self'**\n *    - The special **string**, `'self'`, can be used to match against all URLs of the **same\n *      domain** as the application document using the **same protocol**.\n *  - **String** (except the special value `'self'`)\n *    - The string is matched against the full *normalized / absolute URL* of the resource\n *      being tested (substring matches are not good enough.)\n *    - There are exactly **two wildcard sequences** - `*` and `**`.  All other characters\n *      match themselves.\n *    - `*`: matches zero or more occurrences of any character other than one of the following 6\n *      characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'.  It's a useful wildcard for use\n *      in a whitelist.\n *    - `**`: matches zero or more occurrences of *any* character.  As such, it's not\n *      not appropriate to use in for a scheme, domain, etc. as it would match too much.  (e.g.\n *      http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might\n *      not have been the intention.)  Its usage at the very end of the path is ok.  (e.g.\n *      http://foo.example.com/templates/**).\n *  - **RegExp** (*see caveat below*)\n *    - *Caveat*:  While regular expressions are powerful and offer great flexibility,  their syntax\n *      (and all the inevitable escaping) makes them *harder to maintain*.  It's easy to\n *      accidentally introduce a bug when one updates a complex expression (imho, all regexes should\n *      have good test coverage.).  For instance, the use of `.` in the regex is correct only in a\n *      small number of cases.  A `.` character in the regex used when matching the scheme or a\n *      subdomain could be matched against a `:` or literal `.` that was likely not intended.   It\n *      is highly recommended to use the string patterns and only fall back to regular expressions\n *      if they as a last resort.\n *    - The regular expression must be an instance of RegExp (i.e. not a string.)  It is\n *      matched against the **entire** *normalized / absolute URL* of the resource being tested\n *      (even when the RegExp did not have the `^` and `$` codes.)  In addition, any flags\n *      present on the RegExp (such as multiline, global, ignoreCase) are ignored.\n *    - If you are generating your JavaScript from some other templating engine (not\n *      recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),\n *      remember to escape your regular expression (and be aware that you might need more than\n *      one level of escaping depending on your templating engine and the way you interpolated\n *      the value.)  Do make use of your platform's escaping mechanism as it might be good\n *      enough before coding your own.  e.g. Ruby has\n *      [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)\n *      and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).\n *      Javascript lacks a similar built in function for escaping.  Take a look at Google\n *      Closure library's [goog.string.regExpEscape(s)](\n *      http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.\n *\n * ## Show me an example using SCE.\n *\n * @example\n<example module=\"mySceApp\" deps=\"angular-sanitize.js\">\n<file name=\"index.html\">\n  <div ng-controller=\"myAppController as myCtrl\">\n    <i ng-bind-html=\"myCtrl.explicitlyTrustedHtml\" id=\"explicitlyTrustedHtml\"></i><br><br>\n    <b>User comments</b><br>\n    By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when\n    $sanitize is available.  If $sanitize isn't available, this results in an error instead of an\n    exploit.\n    <div class=\"well\">\n      <div ng-repeat=\"userComment in myCtrl.userComments\">\n        <b>{{userComment.name}}</b>:\n        <span ng-bind-html=\"userComment.htmlComment\" class=\"htmlComment\"></span>\n        <br>\n      </div>\n    </div>\n  </div>\n</file>\n\n<file name=\"script.js\">\n  var mySceApp = angular.module('mySceApp', ['ngSanitize']);\n\n  mySceApp.controller(\"myAppController\", function myAppController($http, $templateCache, $sce) {\n    var self = this;\n    $http.get(\"test_data.json\", {cache: $templateCache}).success(function(userComments) {\n      self.userComments = userComments;\n    });\n    self.explicitlyTrustedHtml = $sce.trustAsHtml(\n        '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n        'sanitization.&quot;\">Hover over this text.</span>');\n  });\n</file>\n\n<file name=\"test_data.json\">\n[\n  { \"name\": \"Alice\",\n    \"htmlComment\":\n        \"<span onmouseover='this.textContent=\\\"PWN3D!\\\"'>Is <i>anyone</i> reading this?</span>\"\n  },\n  { \"name\": \"Bob\",\n    \"htmlComment\": \"<i>Yes!</i>  Am I the only other one?\"\n  }\n]\n</file>\n\n<file name=\"protractor.js\" type=\"protractor\">\n  describe('SCE doc demo', function() {\n    it('should sanitize untrusted values', function() {\n      expect(element(by.css('.htmlComment')).getInnerHtml())\n          .toBe('<span>Is <i>anyone</i> reading this?</span>');\n    });\n\n    it('should NOT sanitize explicitly trusted values', function() {\n      expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(\n          '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n          'sanitization.&quot;\">Hover over this text.</span>');\n    });\n  });\n</file>\n</example>\n *\n *\n *\n * ## Can I disable SCE completely?\n *\n * Yes, you can.  However, this is strongly discouraged.  SCE gives you a lot of security benefits\n * for little coding overhead.  It will be much harder to take an SCE disabled application and\n * either secure it on your own or enable SCE at a later stage.  It might make sense to disable SCE\n * for cases where you have a lot of existing code that was written before SCE was introduced and\n * you're migrating them a module at a time.\n *\n * That said, here's how you can completely disable SCE:\n *\n * <pre class=\"prettyprint\">\n *   angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {\n *     // Completely disable SCE.  For demonstration purposes only!\n *     // Do not use in new projects.\n *     $sceProvider.enabled(false);\n *   });\n * </pre>\n *\n */\n/* jshint maxlen: 100 */\n\nfunction $SceProvider() {\n  var enabled = true;\n\n  /**\n   * @ngdoc method\n   * @name $sceProvider#enabled\n   * @kind function\n   *\n   * @param {boolean=} value If provided, then enables/disables SCE.\n   * @return {boolean} true if SCE is enabled, false otherwise.\n   *\n   * @description\n   * Enables/disables SCE and returns the current value.\n   */\n  this.enabled = function (value) {\n    if (arguments.length) {\n      enabled = !!value;\n    }\n    return enabled;\n  };\n\n\n  /* Design notes on the default implementation for SCE.\n   *\n   * The API contract for the SCE delegate\n   * -------------------------------------\n   * The SCE delegate object must provide the following 3 methods:\n   *\n   * - trustAs(contextEnum, value)\n   *     This method is used to tell the SCE service that the provided value is OK to use in the\n   *     contexts specified by contextEnum.  It must return an object that will be accepted by\n   *     getTrusted() for a compatible contextEnum and return this value.\n   *\n   * - valueOf(value)\n   *     For values that were not produced by trustAs(), return them as is.  For values that were\n   *     produced by trustAs(), return the corresponding input value to trustAs.  Basically, if\n   *     trustAs is wrapping the given values into some type, this operation unwraps it when given\n   *     such a value.\n   *\n   * - getTrusted(contextEnum, value)\n   *     This function should return the a value that is safe to use in the context specified by\n   *     contextEnum or throw and exception otherwise.\n   *\n   * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be\n   * opaque or wrapped in some holder object.  That happens to be an implementation detail.  For\n   * instance, an implementation could maintain a registry of all trusted objects by context.  In\n   * such a case, trustAs() would return the same object that was passed in.  getTrusted() would\n   * return the same object passed in if it was found in the registry under a compatible context or\n   * throw an exception otherwise.  An implementation might only wrap values some of the time based\n   * on some criteria.  getTrusted() might return a value and not throw an exception for special\n   * constants or objects even if not wrapped.  All such implementations fulfill this contract.\n   *\n   *\n   * A note on the inheritance model for SCE contexts\n   * ------------------------------------------------\n   * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types.  This\n   * is purely an implementation details.\n   *\n   * The contract is simply this:\n   *\n   *     getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)\n   *     will also succeed.\n   *\n   * Inheritance happens to capture this in a natural way.  In some future, we\n   * may not use inheritance anymore.  That is OK because no code outside of\n   * sce.js and sceSpecs.js would need to be aware of this detail.\n   */\n\n  this.$get = ['$parse', '$sniffer', '$sceDelegate', function(\n                $parse,   $sniffer,   $sceDelegate) {\n    // Prereq: Ensure that we're not running in IE8 quirks mode.  In that mode, IE allows\n    // the \"expression(javascript expression)\" syntax which is insecure.\n    if (enabled && $sniffer.msie && $sniffer.msieDocumentMode < 8) {\n      throw $sceMinErr('iequirks',\n        'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' +\n        'mode.  You can fix this by adding the text <!doctype html> to the top of your HTML ' +\n        'document.  See http://docs.angularjs.org/api/ng.$sce for more information.');\n    }\n\n    var sce = shallowCopy(SCE_CONTEXTS);\n\n    /**\n     * @ngdoc method\n     * @name $sce#isEnabled\n     * @kind function\n     *\n     * @return {Boolean} true if SCE is enabled, false otherwise.  If you want to set the value, you\n     * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.\n     *\n     * @description\n     * Returns a boolean indicating if SCE is enabled.\n     */\n    sce.isEnabled = function () {\n      return enabled;\n    };\n    sce.trustAs = $sceDelegate.trustAs;\n    sce.getTrusted = $sceDelegate.getTrusted;\n    sce.valueOf = $sceDelegate.valueOf;\n\n    if (!enabled) {\n      sce.trustAs = sce.getTrusted = function(type, value) { return value; };\n      sce.valueOf = identity;\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sce#parse\n     *\n     * @description\n     * Converts Angular {@link guide/expression expression} into a function.  This is like {@link\n     * ng.$parse $parse} and is identical when the expression is a literal constant.  Otherwise, it\n     * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,\n     * *result*)}\n     *\n     * @param {string} type The kind of SCE context in which this result will be used.\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n    sce.parseAs = function sceParseAs(type, expr) {\n      var parsed = $parse(expr);\n      if (parsed.literal && parsed.constant) {\n        return parsed;\n      } else {\n        return function sceParseAsTrusted(self, locals) {\n          return sce.getTrusted(type, parsed(self, locals));\n        };\n      }\n    };\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAs\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.  As such,\n     * returns an object that is trusted by angular for use in specified strict contextual\n     * escaping contexts (such as ng-bind-html, ng-include, any src attribute\n     * interpolation, any dom event binding attribute interpolation such as for onclick,  etc.)\n     * that uses the provided value.  See * {@link ng.$sce $sce} for enabling strict contextual\n     * escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resource_url, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsHtml(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml\n     *     $sce.getTrustedHtml(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl\n     *     $sce.getTrustedUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl\n     *     $sce.getTrustedResourceUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the return\n     *     value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsJs(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs\n     *     $sce.getTrustedJs(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrusted\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}.  As such,\n     * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the\n     * originally supplied value if the queried context type is a supertype of the created type.\n     * If this condition isn't satisfied, throws an exception.\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}\n     *                         call.\n     * @returns {*} The value the was originally provided to\n     *              {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.\n     *              Otherwise, throws an exception.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedHtml(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedCss\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedCss(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sceDelegate.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedJs\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedJs(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsHtml(expression string)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.HTML, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsCss\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsCss(value)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.CSS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsUrl(value)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsResourceUrl(value)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsJs(value)` →\n     *     {@link ng.$sce#parse `$sce.parseAs($sce.JS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    // Shorthand delegations.\n    var parse = sce.parseAs,\n        getTrusted = sce.getTrusted,\n        trustAs = sce.trustAs;\n\n    forEach(SCE_CONTEXTS, function (enumValue, name) {\n      var lName = lowercase(name);\n      sce[camelCase(\"parse_as_\" + lName)] = function (expr) {\n        return parse(enumValue, expr);\n      };\n      sce[camelCase(\"get_trusted_\" + lName)] = function (value) {\n        return getTrusted(enumValue, value);\n      };\n      sce[camelCase(\"trust_as_\" + lName)] = function (value) {\n        return trustAs(enumValue, value);\n      };\n    });\n\n    return sce;\n  }];\n}\n\n/**\n * !!! This is an undocumented \"private\" service !!!\n *\n * @name $sniffer\n * @requires $window\n * @requires $document\n *\n * @property {boolean} history Does the browser support html5 history api ?\n * @property {boolean} hashchange Does the browser support hashchange event ?\n * @property {boolean} transitions Does the browser support CSS transition events ?\n * @property {boolean} animations Does the browser support CSS animation events ?\n *\n * @description\n * This is very simple implementation of testing browser's features.\n */\nfunction $SnifferProvider() {\n  this.$get = ['$window', '$document', function($window, $document) {\n    var eventSupport = {},\n        android =\n          int((/android (\\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),\n        boxee = /Boxee/i.test(($window.navigator || {}).userAgent),\n        document = $document[0] || {},\n        documentMode = document.documentMode,\n        vendorPrefix,\n        vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,\n        bodyStyle = document.body && document.body.style,\n        transitions = false,\n        animations = false,\n        match;\n\n    if (bodyStyle) {\n      for(var prop in bodyStyle) {\n        if(match = vendorRegex.exec(prop)) {\n          vendorPrefix = match[0];\n          vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);\n          break;\n        }\n      }\n\n      if(!vendorPrefix) {\n        vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';\n      }\n\n      transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));\n      animations  = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));\n\n      if (android && (!transitions||!animations)) {\n        transitions = isString(document.body.style.webkitTransition);\n        animations = isString(document.body.style.webkitAnimation);\n      }\n    }\n\n\n    return {\n      // Android has history.pushState, but it does not update location correctly\n      // so let's not use the history API at all.\n      // http://code.google.com/p/android/issues/detail?id=17471\n      // https://github.com/angular/angular.js/issues/904\n\n      // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has\n      // so let's not use the history API also\n      // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined\n      // jshint -W018\n      history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),\n      // jshint +W018\n      hashchange: 'onhashchange' in $window &&\n                  // IE8 compatible mode lies\n                  (!documentMode || documentMode > 7),\n      hasEvent: function(event) {\n        // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have\n        // it. In particular the event is not fired when backspace or delete key are pressed or\n        // when cut operation is performed.\n        if (event == 'input' && msie == 9) return false;\n\n        if (isUndefined(eventSupport[event])) {\n          var divElm = document.createElement('div');\n          eventSupport[event] = 'on' + event in divElm;\n        }\n\n        return eventSupport[event];\n      },\n      csp: csp(),\n      vendorPrefix: vendorPrefix,\n      transitions : transitions,\n      animations : animations,\n      android: android,\n      msie : msie,\n      msieDocumentMode: documentMode\n    };\n  }];\n}\n\nfunction $TimeoutProvider() {\n  this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler',\n       function($rootScope,   $browser,   $q,   $exceptionHandler) {\n    var deferreds = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $timeout\n      *\n      * @description\n      * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch\n      * block and delegates any exceptions to\n      * {@link ng.$exceptionHandler $exceptionHandler} service.\n      *\n      * The return value of registering a timeout function is a promise, which will be resolved when\n      * the timeout is reached and the timeout function is executed.\n      *\n      * To cancel a timeout request, call `$timeout.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to\n      * synchronously flush the queue of deferred functions.\n      *\n      * @param {function()} fn A function, whose execution should be delayed.\n      * @param {number=} [delay=0] Delay in milliseconds.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this\n      *   promise will be resolved with is the return value of the `fn` function.\n      *\n      */\n    function timeout(fn, delay, invokeApply) {\n      var deferred = $q.defer(),\n          promise = deferred.promise,\n          skipApply = (isDefined(invokeApply) && !invokeApply),\n          timeoutId;\n\n      timeoutId = $browser.defer(function() {\n        try {\n          deferred.resolve(fn());\n        } catch(e) {\n          deferred.reject(e);\n          $exceptionHandler(e);\n        }\n        finally {\n          delete deferreds[promise.$$timeoutId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n      }, delay);\n\n      promise.$$timeoutId = timeoutId;\n      deferreds[timeoutId] = deferred;\n\n      return promise;\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $timeout#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`. As a result of this, the promise will be\n      * resolved with a rejection.\n      *\n      * @param {Promise=} promise Promise returned by the `$timeout` function.\n      * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n      *   canceled.\n      */\n    timeout.cancel = function(promise) {\n      if (promise && promise.$$timeoutId in deferreds) {\n        deferreds[promise.$$timeoutId].reject('canceled');\n        delete deferreds[promise.$$timeoutId];\n        return $browser.defer.cancel(promise.$$timeoutId);\n      }\n      return false;\n    };\n\n    return timeout;\n  }];\n}\n\n// NOTE:  The usage of window and document instead of $window and $document here is\n// deliberate.  This service depends on the specific behavior of anchor nodes created by the\n// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and\n// cause us to break tests.  In addition, when the browser resolves a URL for XHR, it\n// doesn't know about mocked locations and resolves URLs to the real document - which is\n// exactly the behavior needed here.  There is little value is mocking these out for this\n// service.\nvar urlParsingNode = document.createElement(\"a\");\nvar originUrl = urlResolve(window.location.href, true);\n\n\n/**\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL.  Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL.  This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc.  See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers.  However, the parsed components will not be set if the URL assigned did not specify\n * them.  (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.)  We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again.  This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node.  (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729)  However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n *   http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n *   http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *   http://url.spec.whatwg.org/#urlutils\n *   https://github.com/angular/angular.js/pull/2902\n *   http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n *   | member name   | Description    |\n *   |---------------|----------------|\n *   | href          | A normalized version of the provided URL if it was not an absolute URL |\n *   | protocol      | The protocol including the trailing colon                              |\n *   | host          | The host and port (if the port is non-default) of the normalizedUrl    |\n *   | search        | The search params, minus the question mark                             |\n *   | hash          | The hash string, minus the hash symbol\n *   | hostname      | The hostname\n *   | port          | The port, without \":\"\n *   | pathname      | The pathname, beginning with \"/\"\n *\n */\nfunction urlResolve(url, base) {\n  var href = url;\n\n  if (msie) {\n    // Normalize before parse.  Refer Implementation Notes on why this is\n    // done in two steps on IE.\n    urlParsingNode.setAttribute(\"href\", href);\n    href = urlParsingNode.href;\n  }\n\n  urlParsingNode.setAttribute('href', href);\n\n  // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n  return {\n    href: urlParsingNode.href,\n    protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n    host: urlParsingNode.host,\n    search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n    hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n    hostname: urlParsingNode.hostname,\n    port: urlParsingNode.port,\n    pathname: (urlParsingNode.pathname.charAt(0) === '/')\n      ? urlParsingNode.pathname\n      : '/' + urlParsingNode.pathname\n  };\n}\n\n/**\n * Parse a request URL and determine whether this is a same-origin request as the application document.\n *\n * @param {string|object} requestUrl The url of the request as a string that will be resolved\n * or a parsed URL object.\n * @returns {boolean} Whether the request is for the same origin as the application document.\n */\nfunction urlIsSameOrigin(requestUrl) {\n  var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;\n  return (parsed.protocol === originUrl.protocol &&\n          parsed.host === originUrl.host);\n}\n\n/**\n * @ngdoc service\n * @name $window\n *\n * @description\n * A reference to the browser's `window` object. While `window`\n * is globally available in JavaScript, it causes testability problems, because\n * it is a global variable. In angular we always refer to it through the\n * `$window` service, so it may be overridden, removed or mocked for testing.\n *\n * Expressions, like the one defined for the `ngClick` directive in the example\n * below, are evaluated with respect to the current scope.  Therefore, there is\n * no risk of inadvertently coding in a dependency on a global value in such an\n * expression.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope, $window) {\n           $scope.greeting = 'Hello, World!';\n           $scope.doGreeting = function(greeting) {\n               $window.alert(greeting);\n           };\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n         <input type=\"text\" ng-model=\"greeting\" />\n         <button ng-click=\"doGreeting(greeting)\">ALERT</button>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n      it('should display the greeting in the input box', function() {\n       element(by.model('greeting')).sendKeys('Hello, E2E Tests');\n       // If we click the button it will block the test runner\n       // element(':button').click();\n      });\n     </file>\n   </example>\n */\nfunction $WindowProvider(){\n  this.$get = valueFn(window);\n}\n\n/**\n * @ngdoc provider\n * @name $filterProvider\n * @description\n *\n * Filters are just functions which transform input to an output. However filters need to be\n * Dependency Injected. To achieve this a filter definition consists of a factory function which is\n * annotated with dependencies and is responsible for creating a filter function.\n *\n * ```js\n *   // Filter registration\n *   function MyModule($provide, $filterProvider) {\n *     // create a service to demonstrate injection (not always needed)\n *     $provide.value('greet', function(name){\n *       return 'Hello ' + name + '!';\n *     });\n *\n *     // register a filter factory which uses the\n *     // greet service to demonstrate DI.\n *     $filterProvider.register('greet', function(greet){\n *       // return the filter function which uses the greet service\n *       // to generate salutation\n *       return function(text) {\n *         // filters need to be forgiving so check input validity\n *         return text && greet(text) || text;\n *       };\n *     });\n *   }\n * ```\n *\n * The filter function is registered with the `$injector` under the filter name suffix with\n * `Filter`.\n *\n * ```js\n *   it('should be the same instance', inject(\n *     function($filterProvider) {\n *       $filterProvider.register('reverse', function(){\n *         return ...;\n *       });\n *     },\n *     function($filter, reverseFilter) {\n *       expect($filter('reverse')).toBe(reverseFilter);\n *     });\n * ```\n *\n *\n * For more information about how angular filters work, and how to create your own filters, see\n * {@link guide/filter Filters} in the Angular Developer Guide.\n */\n/**\n * @ngdoc method\n * @name $filterProvider#register\n * @description\n * Register filter factory function.\n *\n * @param {String} name Name of the filter.\n * @param {Function} fn The filter factory function which is injectable.\n */\n\n\n/**\n * @ngdoc service\n * @name $filter\n * @kind function\n * @description\n * Filters are used for formatting data displayed to the user.\n *\n * The general syntax in templates is as follows:\n *\n *         {{ expression [| filter_name[:parameter_value] ... ] }}\n *\n * @param {String} name Name of the filter function to retrieve\n * @return {Function} the filter function\n * @example\n   <example name=\"$filter\" module=\"filterExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"MainCtrl\">\n        <h3>{{ originalText }}</h3>\n        <h3>{{ filteredText }}</h3>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n      angular.module('filterExample', [])\n      .controller('MainCtrl', function($scope, $filter) {\n        $scope.originalText = 'hello';\n        $scope.filteredText = $filter('uppercase')($scope.originalText);\n      });\n     </file>\n   </example>\n  */\n$FilterProvider.$inject = ['$provide'];\nfunction $FilterProvider($provide) {\n  var suffix = 'Filter';\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#register\n   * @param {string|Object} name Name of the filter function, or an object map of filters where\n   *    the keys are the filter names and the values are the filter factories.\n   * @returns {Object} Registered filter instance, or if a map of filters was provided then a map\n   *    of the registered filter instances.\n   */\n  function register(name, factory) {\n    if(isObject(name)) {\n      var filters = {};\n      forEach(name, function(filter, key) {\n        filters[key] = register(key, filter);\n      });\n      return filters;\n    } else {\n      return $provide.factory(name + suffix, factory);\n    }\n  }\n  this.register = register;\n\n  this.$get = ['$injector', function($injector) {\n    return function(name) {\n      return $injector.get(name + suffix);\n    };\n  }];\n\n  ////////////////////////////////////////\n\n  /* global\n    currencyFilter: false,\n    dateFilter: false,\n    filterFilter: false,\n    jsonFilter: false,\n    limitToFilter: false,\n    lowercaseFilter: false,\n    numberFilter: false,\n    orderByFilter: false,\n    uppercaseFilter: false,\n  */\n\n  register('currency', currencyFilter);\n  register('date', dateFilter);\n  register('filter', filterFilter);\n  register('json', jsonFilter);\n  register('limitTo', limitToFilter);\n  register('lowercase', lowercaseFilter);\n  register('number', numberFilter);\n  register('orderBy', orderByFilter);\n  register('uppercase', uppercaseFilter);\n}\n\n/**\n * @ngdoc filter\n * @name filter\n * @kind function\n *\n * @description\n * Selects a subset of items from `array` and returns it as a new array.\n *\n * @param {Array} array The source array.\n * @param {string|Object|function()} expression The predicate to be used for selecting items from\n *   `array`.\n *\n *   Can be one of:\n *\n *   - `string`: The string is evaluated as an expression and the resulting value is used for substring match against\n *     the contents of the `array`. All strings or objects with string properties in `array` that contain this string\n *     will be returned. The predicate can be negated by prefixing the string with `!`.\n *\n *   - `Object`: A pattern object can be used to filter specific properties on objects contained\n *     by `array`. For example `{name:\"M\", phone:\"1\"}` predicate will return an array of items\n *     which have property `name` containing \"M\" and property `phone` containing \"1\". A special\n *     property name `$` can be used (as in `{$:\"text\"}`) to accept a match against any\n *     property of the object. That's equivalent to the simple substring match with a `string`\n *     as described above.\n *\n *   - `function(value)`: A predicate function can be used to write arbitrary filters. The function is\n *     called for each element of `array`. The final result is an array of those elements that\n *     the predicate returned true for.\n *\n * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in\n *     determining if the expected value (from the filter expression) and actual value (from\n *     the object in the array) should be considered a match.\n *\n *   Can be one of:\n *\n *   - `function(actual, expected)`:\n *     The function will be given the object value and the predicate value to compare and\n *     should return true if the item should be included in filtered result.\n *\n *   - `true`: A shorthand for `function(actual, expected) { return angular.equals(expected, actual)}`.\n *     this is essentially strict comparison of expected and actual.\n *\n *   - `false|undefined`: A short hand for a function which will look for a substring match in case\n *     insensitive way.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <div ng-init=\"friends = [{name:'John', phone:'555-1276'},\n                                {name:'Mary', phone:'800-BIG-MARY'},\n                                {name:'Mike', phone:'555-4321'},\n                                {name:'Adam', phone:'555-5678'},\n                                {name:'Julie', phone:'555-8765'},\n                                {name:'Juliette', phone:'555-5678'}]\"></div>\n\n       Search: <input ng-model=\"searchText\">\n       <table id=\"searchTextResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friend in friends | filter:searchText\">\n           <td>{{friend.name}}</td>\n           <td>{{friend.phone}}</td>\n         </tr>\n       </table>\n       <hr>\n       Any: <input ng-model=\"search.$\"> <br>\n       Name only <input ng-model=\"search.name\"><br>\n       Phone only <input ng-model=\"search.phone\"><br>\n       Equality <input type=\"checkbox\" ng-model=\"strict\"><br>\n       <table id=\"searchObjResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friendObj in friends | filter:search:strict\">\n           <td>{{friendObj.name}}</td>\n           <td>{{friendObj.phone}}</td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var expectFriendNames = function(expectedNames, key) {\n         element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {\n           arr.forEach(function(wd, i) {\n             expect(wd.getText()).toMatch(expectedNames[i]);\n           });\n         });\n       };\n\n       it('should search across all fields when filtering with a string', function() {\n         var searchText = element(by.model('searchText'));\n         searchText.clear();\n         searchText.sendKeys('m');\n         expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');\n\n         searchText.clear();\n         searchText.sendKeys('76');\n         expectFriendNames(['John', 'Julie'], 'friend');\n       });\n\n       it('should search in specific fields when filtering with a predicate object', function() {\n         var searchAny = element(by.model('search.$'));\n         searchAny.clear();\n         searchAny.sendKeys('i');\n         expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');\n       });\n       it('should use a equal comparison when comparator is true', function() {\n         var searchName = element(by.model('search.name'));\n         var strict = element(by.model('strict'));\n         searchName.clear();\n         searchName.sendKeys('Julie');\n         strict.click();\n         expectFriendNames(['Julie'], 'friendObj');\n       });\n     </file>\n   </example>\n */\nfunction filterFilter() {\n  return function(array, expression, comparator) {\n    if (!isArray(array)) return array;\n\n    var comparatorType = typeof(comparator),\n        predicates = [];\n\n    predicates.check = function(value) {\n      for (var j = 0; j < predicates.length; j++) {\n        if(!predicates[j](value)) {\n          return false;\n        }\n      }\n      return true;\n    };\n\n    if (comparatorType !== 'function') {\n      if (comparatorType === 'boolean' && comparator) {\n        comparator = function(obj, text) {\n          return angular.equals(obj, text);\n        };\n      } else {\n        comparator = function(obj, text) {\n          if (obj && text && typeof obj === 'object' && typeof text === 'object') {\n            for (var objKey in obj) {\n              if (objKey.charAt(0) !== '$' && hasOwnProperty.call(obj, objKey) &&\n                  comparator(obj[objKey], text[objKey])) {\n                return true;\n              }\n            }\n            return false;\n          }\n          text = (''+text).toLowerCase();\n          return (''+obj).toLowerCase().indexOf(text) > -1;\n        };\n      }\n    }\n\n    var search = function(obj, text){\n      if (typeof text == 'string' && text.charAt(0) === '!') {\n        return !search(obj, text.substr(1));\n      }\n      switch (typeof obj) {\n        case \"boolean\":\n        case \"number\":\n        case \"string\":\n          return comparator(obj, text);\n        case \"object\":\n          switch (typeof text) {\n            case \"object\":\n              return comparator(obj, text);\n            default:\n              for ( var objKey in obj) {\n                if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) {\n                  return true;\n                }\n              }\n              break;\n          }\n          return false;\n        case \"array\":\n          for ( var i = 0; i < obj.length; i++) {\n            if (search(obj[i], text)) {\n              return true;\n            }\n          }\n          return false;\n        default:\n          return false;\n      }\n    };\n    switch (typeof expression) {\n      case \"boolean\":\n      case \"number\":\n      case \"string\":\n        // Set up expression object and fall through\n        expression = {$:expression};\n        // jshint -W086\n      case \"object\":\n        // jshint +W086\n        for (var key in expression) {\n          (function(path) {\n            if (typeof expression[path] == 'undefined') return;\n            predicates.push(function(value) {\n              return search(path == '$' ? value : (value && value[path]), expression[path]);\n            });\n          })(key);\n        }\n        break;\n      case 'function':\n        predicates.push(expression);\n        break;\n      default:\n        return array;\n    }\n    var filtered = [];\n    for ( var j = 0; j < array.length; j++) {\n      var value = array[j];\n      if (predicates.check(value)) {\n        filtered.push(value);\n      }\n    }\n    return filtered;\n  };\n}\n\n/**\n * @ngdoc filter\n * @name currency\n * @kind function\n *\n * @description\n * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default\n * symbol for current locale is used.\n *\n * @param {number} amount Input to filter.\n * @param {string=} symbol Currency symbol or identifier to be displayed.\n * @returns {string} Formatted number.\n *\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.amount = 1234.56;\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n         <input type=\"number\" ng-model=\"amount\"> <br>\n         default currency symbol ($): <span id=\"currency-default\">{{amount | currency}}</span><br>\n         custom currency identifier (USD$): <span>{{amount | currency:\"USD$\"}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should init with 1234.56', function() {\n         expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');\n         expect(element(by.binding('amount | currency:\"USD$\"')).getText()).toBe('USD$1,234.56');\n       });\n       it('should update', function() {\n         if (browser.params.browser == 'safari') {\n           // Safari does not understand the minus key. See\n           // https://github.com/angular/protractor/issues/481\n           return;\n         }\n         element(by.model('amount')).clear();\n         element(by.model('amount')).sendKeys('-1234');\n         expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)');\n         expect(element(by.binding('amount | currency:\"USD$\"')).getText()).toBe('(USD$1,234.00)');\n       });\n     </file>\n   </example>\n */\ncurrencyFilter.$inject = ['$locale'];\nfunction currencyFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(amount, currencySymbol){\n    if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM;\n    return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2).\n                replace(/\\u00A4/g, currencySymbol);\n  };\n}\n\n/**\n * @ngdoc filter\n * @name number\n * @kind function\n *\n * @description\n * Formats a number as text.\n *\n * If the input is not a number an empty string is returned.\n *\n * @param {number|string} number Number to format.\n * @param {(number|string)=} fractionSize Number of decimal places to round the number to.\n * If this is not provided then the fraction size is computed from the current locale's number\n * formatting pattern. In the case of the default locale, it will be 3.\n * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.val = 1234.56789;\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n         Enter number: <input ng-model='val'><br>\n         Default formatting: <span id='number-default'>{{val | number}}</span><br>\n         No fractions: <span>{{val | number:0}}</span><br>\n         Negative number: <span>{{-val | number:4}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format numbers', function() {\n         expect(element(by.id('number-default')).getText()).toBe('1,234.568');\n         expect(element(by.binding('val | number:0')).getText()).toBe('1,235');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');\n       });\n\n       it('should update', function() {\n         element(by.model('val')).clear();\n         element(by.model('val')).sendKeys('3374.333');\n         expect(element(by.id('number-default')).getText()).toBe('3,374.333');\n         expect(element(by.binding('val | number:0')).getText()).toBe('3,374');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');\n      });\n     </file>\n   </example>\n */\n\n\nnumberFilter.$inject = ['$locale'];\nfunction numberFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(number, fractionSize) {\n    return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,\n      fractionSize);\n  };\n}\n\nvar DECIMAL_SEP = '.';\nfunction formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {\n  if (number == null || !isFinite(number) || isObject(number)) return '';\n\n  var isNegative = number < 0;\n  number = Math.abs(number);\n  var numStr = number + '',\n      formatedText = '',\n      parts = [];\n\n  var hasExponent = false;\n  if (numStr.indexOf('e') !== -1) {\n    var match = numStr.match(/([\\d\\.]+)e(-?)(\\d+)/);\n    if (match && match[2] == '-' && match[3] > fractionSize + 1) {\n      numStr = '0';\n    } else {\n      formatedText = numStr;\n      hasExponent = true;\n    }\n  }\n\n  if (!hasExponent) {\n    var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length;\n\n    // determine fractionSize if it is not specified\n    if (isUndefined(fractionSize)) {\n      fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac);\n    }\n\n    var pow = Math.pow(10, fractionSize + 1);\n    number = Math.floor(number * pow + 5) / pow;\n    var fraction = ('' + number).split(DECIMAL_SEP);\n    var whole = fraction[0];\n    fraction = fraction[1] || '';\n\n    var i, pos = 0,\n        lgroup = pattern.lgSize,\n        group = pattern.gSize;\n\n    if (whole.length >= (lgroup + group)) {\n      pos = whole.length - lgroup;\n      for (i = 0; i < pos; i++) {\n        if ((pos - i)%group === 0 && i !== 0) {\n          formatedText += groupSep;\n        }\n        formatedText += whole.charAt(i);\n      }\n    }\n\n    for (i = pos; i < whole.length; i++) {\n      if ((whole.length - i)%lgroup === 0 && i !== 0) {\n        formatedText += groupSep;\n      }\n      formatedText += whole.charAt(i);\n    }\n\n    // format fraction part.\n    while(fraction.length < fractionSize) {\n      fraction += '0';\n    }\n\n    if (fractionSize && fractionSize !== \"0\") formatedText += decimalSep + fraction.substr(0, fractionSize);\n  } else {\n\n    if (fractionSize > 0 && number > -1 && number < 1) {\n      formatedText = number.toFixed(fractionSize);\n    }\n  }\n\n  parts.push(isNegative ? pattern.negPre : pattern.posPre);\n  parts.push(formatedText);\n  parts.push(isNegative ? pattern.negSuf : pattern.posSuf);\n  return parts.join('');\n}\n\nfunction padNumber(num, digits, trim) {\n  var neg = '';\n  if (num < 0) {\n    neg =  '-';\n    num = -num;\n  }\n  num = '' + num;\n  while(num.length < digits) num = '0' + num;\n  if (trim)\n    num = num.substr(num.length - digits);\n  return neg + num;\n}\n\n\nfunction dateGetter(name, size, offset, trim) {\n  offset = offset || 0;\n  return function(date) {\n    var value = date['get' + name]();\n    if (offset > 0 || value > -offset)\n      value += offset;\n    if (value === 0 && offset == -12 ) value = 12;\n    return padNumber(value, size, trim);\n  };\n}\n\nfunction dateStrGetter(name, shortForm) {\n  return function(date, formats) {\n    var value = date['get' + name]();\n    var get = uppercase(shortForm ? ('SHORT' + name) : name);\n\n    return formats[get][value];\n  };\n}\n\nfunction timeZoneGetter(date) {\n  var zone = -1 * date.getTimezoneOffset();\n  var paddedZone = (zone >= 0) ? \"+\" : \"\";\n\n  paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +\n                padNumber(Math.abs(zone % 60), 2);\n\n  return paddedZone;\n}\n\nfunction ampmGetter(date, formats) {\n  return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];\n}\n\nvar DATE_FORMATS = {\n  yyyy: dateGetter('FullYear', 4),\n    yy: dateGetter('FullYear', 2, 0, true),\n     y: dateGetter('FullYear', 1),\n  MMMM: dateStrGetter('Month'),\n   MMM: dateStrGetter('Month', true),\n    MM: dateGetter('Month', 2, 1),\n     M: dateGetter('Month', 1, 1),\n    dd: dateGetter('Date', 2),\n     d: dateGetter('Date', 1),\n    HH: dateGetter('Hours', 2),\n     H: dateGetter('Hours', 1),\n    hh: dateGetter('Hours', 2, -12),\n     h: dateGetter('Hours', 1, -12),\n    mm: dateGetter('Minutes', 2),\n     m: dateGetter('Minutes', 1),\n    ss: dateGetter('Seconds', 2),\n     s: dateGetter('Seconds', 1),\n     // while ISO 8601 requires fractions to be prefixed with `.` or `,`\n     // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions\n   sss: dateGetter('Milliseconds', 3),\n  EEEE: dateStrGetter('Day'),\n   EEE: dateStrGetter('Day', true),\n     a: ampmGetter,\n     Z: timeZoneGetter\n};\n\nvar DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,\n    NUMBER_STRING = /^\\-?\\d+$/;\n\n/**\n * @ngdoc filter\n * @name date\n * @kind function\n *\n * @description\n *   Formats `date` to a string based on the requested `format`.\n *\n *   `format` string can be composed of the following elements:\n *\n *   * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)\n *   * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)\n *   * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)\n *   * `'MMMM'`: Month in year (January-December)\n *   * `'MMM'`: Month in year (Jan-Dec)\n *   * `'MM'`: Month in year, padded (01-12)\n *   * `'M'`: Month in year (1-12)\n *   * `'dd'`: Day in month, padded (01-31)\n *   * `'d'`: Day in month (1-31)\n *   * `'EEEE'`: Day in Week,(Sunday-Saturday)\n *   * `'EEE'`: Day in Week, (Sun-Sat)\n *   * `'HH'`: Hour in day, padded (00-23)\n *   * `'H'`: Hour in day (0-23)\n *   * `'hh'`: Hour in am/pm, padded (01-12)\n *   * `'h'`: Hour in am/pm, (1-12)\n *   * `'mm'`: Minute in hour, padded (00-59)\n *   * `'m'`: Minute in hour (0-59)\n *   * `'ss'`: Second in minute, padded (00-59)\n *   * `'s'`: Second in minute (0-59)\n *   * `'.sss' or ',sss'`: Millisecond in second, padded (000-999)\n *   * `'a'`: am/pm marker\n *   * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)\n *\n *   `format` string can also be one of the following predefined\n *   {@link guide/i18n localizable formats}:\n *\n *   * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale\n *     (e.g. Sep 3, 2010 12:05:08 pm)\n *   * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US  locale (e.g. 9/3/10 12:05 pm)\n *   * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US  locale\n *     (e.g. Friday, September 3, 2010)\n *   * `'longDate'`: equivalent to `'MMMM d, y'` for en_US  locale (e.g. September 3, 2010)\n *   * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US  locale (e.g. Sep 3, 2010)\n *   * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)\n *   * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm)\n *   * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm)\n *\n *   `format` string can contain literal values. These need to be quoted with single quotes (e.g.\n *   `\"h 'in the morning'\"`). In order to output single quote, use two single quotes in a sequence\n *   (e.g. `\"h 'o''clock'\"`).\n *\n * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or\n *    number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and its\n *    shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is\n *    specified in the string input, the time is considered to be in the local timezone.\n * @param {string=} format Formatting rules (see Description). If not specified,\n *    `mediumDate` is used.\n * @returns {string} Formatted string or the input if input is not recognized as date/millis.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:\n           <span>{{1288323623006 | date:'medium'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:\n          <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:\n          <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format date', function() {\n         expect(element(by.binding(\"1288323623006 | date:'medium'\")).getText()).\n            toMatch(/Oct 2\\d, 2010 \\d{1,2}:\\d{2}:\\d{2} (AM|PM)/);\n         expect(element(by.binding(\"1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'\")).getText()).\n            toMatch(/2010\\-10\\-2\\d \\d{2}:\\d{2}:\\d{2} (\\-|\\+)?\\d{4}/);\n         expect(element(by.binding(\"'1288323623006' | date:'MM/dd/yyyy @ h:mma'\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 @ \\d{1,2}:\\d{2}(AM|PM)/);\n       });\n     </file>\n   </example>\n */\ndateFilter.$inject = ['$locale'];\nfunction dateFilter($locale) {\n\n\n  var R_ISO8601_STR = /^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?)?$/;\n                     // 1        2       3         4          5          6          7          8  9     10      11\n  function jsonStringToDate(string) {\n    var match;\n    if (match = string.match(R_ISO8601_STR)) {\n      var date = new Date(0),\n          tzHour = 0,\n          tzMin  = 0,\n          dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,\n          timeSetter = match[8] ? date.setUTCHours : date.setHours;\n\n      if (match[9]) {\n        tzHour = int(match[9] + match[10]);\n        tzMin = int(match[9] + match[11]);\n      }\n      dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3]));\n      var h = int(match[4]||0) - tzHour;\n      var m = int(match[5]||0) - tzMin;\n      var s = int(match[6]||0);\n      var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000);\n      timeSetter.call(date, h, m, s, ms);\n      return date;\n    }\n    return string;\n  }\n\n\n  return function(date, format) {\n    var text = '',\n        parts = [],\n        fn, match;\n\n    format = format || 'mediumDate';\n    format = $locale.DATETIME_FORMATS[format] || format;\n    if (isString(date)) {\n      if (NUMBER_STRING.test(date)) {\n        date = int(date);\n      } else {\n        date = jsonStringToDate(date);\n      }\n    }\n\n    if (isNumber(date)) {\n      date = new Date(date);\n    }\n\n    if (!isDate(date)) {\n      return date;\n    }\n\n    while(format) {\n      match = DATE_FORMATS_SPLIT.exec(format);\n      if (match) {\n        parts = concat(parts, match, 1);\n        format = parts.pop();\n      } else {\n        parts.push(format);\n        format = null;\n      }\n    }\n\n    forEach(parts, function(value){\n      fn = DATE_FORMATS[value];\n      text += fn ? fn(date, $locale.DATETIME_FORMATS)\n                 : value.replace(/(^'|'$)/g, '').replace(/''/g, \"'\");\n    });\n\n    return text;\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name json\n * @kind function\n *\n * @description\n *   Allows you to convert a JavaScript object into JSON string.\n *\n *   This filter is mostly useful for debugging. When using the double curly {{value}} notation\n *   the binding is automatically converted to JSON.\n *\n * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.\n * @returns {string} JSON string.\n *\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <pre>{{ {'name':'value'} | json }}</pre>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should jsonify filtered objects', function() {\n         expect(element(by.binding(\"{'name':'value'}\")).getText()).toMatch(/\\{\\n  \"name\": ?\"value\"\\n}/);\n       });\n     </file>\n   </example>\n *\n */\nfunction jsonFilter() {\n  return function(object) {\n    return toJson(object, true);\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name lowercase\n * @kind function\n * @description\n * Converts string to lowercase.\n * @see angular.lowercase\n */\nvar lowercaseFilter = valueFn(lowercase);\n\n\n/**\n * @ngdoc filter\n * @name uppercase\n * @kind function\n * @description\n * Converts string to uppercase.\n * @see angular.uppercase\n */\nvar uppercaseFilter = valueFn(uppercase);\n\n/**\n * @ngdoc filter\n * @name limitTo\n * @kind function\n *\n * @description\n * Creates a new array or string containing only a specified number of elements. The elements\n * are taken from either the beginning or the end of the source array or string, as specified by\n * the value and sign (positive or negative) of `limit`.\n *\n * @param {Array|string} input Source array or string to be limited.\n * @param {string|number} limit The length of the returned array or string. If the `limit` number\n *     is positive, `limit` number of items from the beginning of the source array/string are copied.\n *     If the number is negative, `limit` number  of items from the end of the source array/string\n *     are copied. The `limit` will be trimmed if it exceeds `array.length`\n * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array\n *     had less than `limit` elements.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.numbers = [1,2,3,4,5,6,7,8,9];\n           $scope.letters = \"abcdefghi\";\n           $scope.numLimit = 3;\n           $scope.letterLimit = 3;\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n         Limit {{numbers}} to: <input type=\"integer\" ng-model=\"numLimit\">\n         <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>\n         Limit {{letters}} to: <input type=\"integer\" ng-model=\"letterLimit\">\n         <p>Output letters: {{ letters | limitTo:letterLimit }}</p>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var numLimitInput = element(by.model('numLimit'));\n       var letterLimitInput = element(by.model('letterLimit'));\n       var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));\n       var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));\n\n       it('should limit the number array to first three items', function() {\n         expect(numLimitInput.getAttribute('value')).toBe('3');\n         expect(letterLimitInput.getAttribute('value')).toBe('3');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abc');\n       });\n\n       it('should update the output when -3 is entered', function() {\n         numLimitInput.clear();\n         numLimitInput.sendKeys('-3');\n         letterLimitInput.clear();\n         letterLimitInput.sendKeys('-3');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');\n         expect(limitedLetters.getText()).toEqual('Output letters: ghi');\n       });\n\n       it('should not exceed the maximum size of input array', function() {\n         numLimitInput.clear();\n         numLimitInput.sendKeys('100');\n         letterLimitInput.clear();\n         letterLimitInput.sendKeys('100');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');\n       });\n     </file>\n   </example>\n */\nfunction limitToFilter(){\n  return function(input, limit) {\n    if (!isArray(input) && !isString(input)) return input;\n\n    if (Math.abs(Number(limit)) === Infinity) {\n      limit = Number(limit);\n    } else {\n      limit = int(limit);\n    }\n\n    if (isString(input)) {\n      //NaN check on limit\n      if (limit) {\n        return limit >= 0 ? input.slice(0, limit) : input.slice(limit, input.length);\n      } else {\n        return \"\";\n      }\n    }\n\n    var out = [],\n      i, n;\n\n    // if abs(limit) exceeds maximum length, trim it\n    if (limit > input.length)\n      limit = input.length;\n    else if (limit < -input.length)\n      limit = -input.length;\n\n    if (limit > 0) {\n      i = 0;\n      n = limit;\n    } else {\n      i = input.length + limit;\n      n = input.length;\n    }\n\n    for (; i<n; i++) {\n      out.push(input[i]);\n    }\n\n    return out;\n  };\n}\n\n/**\n * @ngdoc filter\n * @name orderBy\n * @kind function\n *\n * @description\n * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically\n * for strings and numerically for numbers. Note: if you notice numbers are not being sorted\n * correctly, make sure they are actually being saved as numbers and not strings.\n *\n * @param {Array} array The array to sort.\n * @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be\n *    used by the comparator to determine the order of elements.\n *\n *    Can be one of:\n *\n *    - `function`: Getter function. The result of this function will be sorted using the\n *      `<`, `=`, `>` operator.\n *    - `string`: An Angular expression which evaluates to an object to order by, such as 'name'\n *      to sort by a property called 'name'. Optionally prefixed with `+` or `-` to control\n *      ascending or descending sort order (for example, +name or -name).\n *    - `Array`: An array of function or string predicates. The first predicate in the array\n *      is used for sorting, but when two items are equivalent, the next predicate is used.\n *\n * @param {boolean=} reverse Reverse the order of the array.\n * @returns {Array} Sorted copy of the source array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.friends =\n               [{name:'John', phone:'555-1212', age:10},\n                {name:'Mary', phone:'555-9876', age:19},\n                {name:'Mike', phone:'555-4321', age:21},\n                {name:'Adam', phone:'555-5678', age:35},\n                {name:'Julie', phone:'555-8765', age:29}]\n           $scope.predicate = '-age';\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n         <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n         <hr/>\n         [ <a href=\"\" ng-click=\"predicate=''\">unsorted</a> ]\n         <table class=\"friend\">\n           <tr>\n             <th><a href=\"\" ng-click=\"predicate = 'name'; reverse=false\">Name</a>\n                 (<a href=\"\" ng-click=\"predicate = '-name'; reverse=false\">^</a>)</th>\n             <th><a href=\"\" ng-click=\"predicate = 'phone'; reverse=!reverse\">Phone Number</a></th>\n             <th><a href=\"\" ng-click=\"predicate = 'age'; reverse=!reverse\">Age</a></th>\n           </tr>\n           <tr ng-repeat=\"friend in friends | orderBy:predicate:reverse\">\n             <td>{{friend.name}}</td>\n             <td>{{friend.phone}}</td>\n             <td>{{friend.age}}</td>\n           </tr>\n         </table>\n       </div>\n     </file>\n   </example>\n *\n * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the\n * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the\n * desired parameters.\n *\n * Example:\n *\n * @example\n  <example>\n    <file name=\"index.html\">\n      <div ng-controller=\"Ctrl\">\n        <table class=\"friend\">\n          <tr>\n            <th><a href=\"\" ng-click=\"reverse=false;order('name', false)\">Name</a>\n              (<a href=\"\" ng-click=\"order('-name',false)\">^</a>)</th>\n            <th><a href=\"\" ng-click=\"reverse=!reverse;order('phone', reverse)\">Phone Number</a></th>\n            <th><a href=\"\" ng-click=\"reverse=!reverse;order('age',reverse)\">Age</a></th>\n          </tr>\n          <tr ng-repeat=\"friend in friends\">\n            <td>{{friend.name}}</td>\n            <td>{{friend.phone}}</td>\n            <td>{{friend.age}}</td>\n          </tr>\n        </table>\n      </div>\n    </file>\n\n    <file name=\"script.js\">\n      function Ctrl($scope, $filter) {\n        var orderBy = $filter('orderBy');\n        $scope.friends = [\n          { name: 'John',    phone: '555-1212',    age: 10 },\n          { name: 'Mary',    phone: '555-9876',    age: 19 },\n          { name: 'Mike',    phone: '555-4321',    age: 21 },\n          { name: 'Adam',    phone: '555-5678',    age: 35 },\n          { name: 'Julie',   phone: '555-8765',    age: 29 }\n        ];\n\n        $scope.order = function(predicate, reverse) {\n          $scope.friends = orderBy($scope.friends, predicate, reverse);\n        };\n        $scope.order('-age',false);\n      }\n    </file>\n</example>\n */\norderByFilter.$inject = ['$parse'];\nfunction orderByFilter($parse){\n  return function(array, sortPredicate, reverseOrder) {\n    if (!isArray(array)) return array;\n    if (!sortPredicate) return array;\n    sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];\n    sortPredicate = map(sortPredicate, function(predicate){\n      var descending = false, get = predicate || identity;\n      if (isString(predicate)) {\n        if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {\n          descending = predicate.charAt(0) == '-';\n          predicate = predicate.substring(1);\n        }\n        get = $parse(predicate);\n        if (get.constant) {\n          var key = get();\n          return reverseComparator(function(a,b) {\n            return compare(a[key], b[key]);\n          }, descending);\n        }\n      }\n      return reverseComparator(function(a,b){\n        return compare(get(a),get(b));\n      }, descending);\n    });\n    var arrayCopy = [];\n    for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }\n    return arrayCopy.sort(reverseComparator(comparator, reverseOrder));\n\n    function comparator(o1, o2){\n      for ( var i = 0; i < sortPredicate.length; i++) {\n        var comp = sortPredicate[i](o1, o2);\n        if (comp !== 0) return comp;\n      }\n      return 0;\n    }\n    function reverseComparator(comp, descending) {\n      return toBoolean(descending)\n          ? function(a,b){return comp(b,a);}\n          : comp;\n    }\n    function compare(v1, v2){\n      var t1 = typeof v1;\n      var t2 = typeof v2;\n      if (t1 == t2) {\n        if (t1 == \"string\") {\n           v1 = v1.toLowerCase();\n           v2 = v2.toLowerCase();\n        }\n        if (v1 === v2) return 0;\n        return v1 < v2 ? -1 : 1;\n      } else {\n        return t1 < t2 ? -1 : 1;\n      }\n    }\n  };\n}\n\nfunction ngDirective(directive) {\n  if (isFunction(directive)) {\n    directive = {\n      link: directive\n    };\n  }\n  directive.restrict = directive.restrict || 'AC';\n  return valueFn(directive);\n}\n\n/**\n * @ngdoc directive\n * @name a\n * @restrict E\n *\n * @description\n * Modifies the default behavior of the html A tag so that the default action is prevented when\n * the href attribute is empty.\n *\n * This change permits the easy creation of action links with the `ngClick` directive\n * without changing the location or causing page reloads, e.g.:\n * `<a href=\"\" ng-click=\"list.addItem()\">Add Item</a>`\n */\nvar htmlAnchorDirective = valueFn({\n  restrict: 'E',\n  compile: function(element, attr) {\n\n    if (msie <= 8) {\n\n      // turn <a href ng-click=\"..\">link</a> into a stylable link in IE\n      // but only if it doesn't have name attribute, in which case it's an anchor\n      if (!attr.href && !attr.name) {\n        attr.$set('href', '');\n      }\n\n      // add a comment node to anchors to workaround IE bug that causes element content to be reset\n      // to new attribute content if attribute is updated with value containing @ and element also\n      // contains value with @\n      // see issue #1949\n      element.append(document.createComment('IE fix'));\n    }\n\n    if (!attr.href && !attr.xlinkHref && !attr.name) {\n      return function(scope, element) {\n        // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n        var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?\n                   'xlink:href' : 'href';\n        element.on('click', function(event){\n          // if we have no href url, then don't navigate anywhere.\n          if (!element.attr(href)) {\n            event.preventDefault();\n          }\n        });\n      };\n    }\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngHref\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in an href attribute will\n * make the link go to the wrong URL if the user clicks it before\n * Angular has a chance to replace the `{{hash}}` markup with its\n * value. Until Angular replaces the markup the link will be broken\n * and will most likely return a 404 error.\n *\n * The `ngHref` directive solves this problem.\n *\n * The wrong way to write it:\n * ```html\n * <a href=\"http://www.gravatar.com/avatar/{{hash}}\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <a ng-href=\"http://www.gravatar.com/avatar/{{hash}}\"/>\n * ```\n *\n * @element A\n * @param {template} ngHref any string which can contain `{{}}` markup.\n *\n * @example\n * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes\n * in links and their different behaviors:\n    <example>\n      <file name=\"index.html\">\n        <input ng-model=\"value\" /><br />\n        <a id=\"link-1\" href ng-click=\"value = 1\">link 1</a> (link, don't reload)<br />\n        <a id=\"link-2\" href=\"\" ng-click=\"value = 2\">link 2</a> (link, don't reload)<br />\n        <a id=\"link-3\" ng-href=\"/{{'123'}}\">link 3</a> (link, reload!)<br />\n        <a id=\"link-4\" href=\"\" name=\"xx\" ng-click=\"value = 4\">anchor</a> (link, don't reload)<br />\n        <a id=\"link-5\" name=\"xxx\" ng-click=\"value = 5\">anchor</a> (no link)<br />\n        <a id=\"link-6\" ng-href=\"{{value}}\">link</a> (link, change location)\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should execute ng-click but not reload when href without value', function() {\n          element(by.id('link-1')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('1');\n          expect(element(by.id('link-1')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when href empty string', function() {\n          element(by.id('link-2')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('2');\n          expect(element(by.id('link-2')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click and change url when ng-href specified', function() {\n          expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\\/123$/);\n\n          element(by.id('link-3')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/123$/);\n            });\n          }, 1000, 'page should navigate to /123');\n        });\n\n        xit('should execute ng-click but not reload when href empty string and name specified', function() {\n          element(by.id('link-4')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('4');\n          expect(element(by.id('link-4')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when no href but name specified', function() {\n          element(by.id('link-5')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('5');\n          expect(element(by.id('link-5')).getAttribute('href')).toBe(null);\n        });\n\n        it('should only change url when only ng-href', function() {\n          element(by.model('value')).clear();\n          element(by.model('value')).sendKeys('6');\n          expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\\/6$/);\n\n          element(by.id('link-6')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/6$/);\n            });\n          }, 1000, 'page should navigate to /6');\n        });\n      </file>\n    </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngSrc\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `src` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrc` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img src=\"http://www.gravatar.com/avatar/{{hash}}\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-src=\"http://www.gravatar.com/avatar/{{hash}}\"/>\n * ```\n *\n * @element IMG\n * @param {template} ngSrc any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngSrcset\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrcset` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\"/>\n * ```\n *\n * @element IMG\n * @param {template} ngSrcset any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngDisabled\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:\n * ```html\n * <div ng-init=\"scope = { isDisabled: false }\">\n *  <button disabled=\"{{scope.isDisabled}}\">Disabled</button>\n * </div>\n * ```\n *\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as disabled. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngDisabled` directive solves this problem for the `disabled` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        Click me to toggle: <input type=\"checkbox\" ng-model=\"checked\"><br/>\n        <button ng-model=\"button\" ng-disabled=\"checked\">Button</button>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle button', function() {\n          expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,\n *     then special attribute \"disabled\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngChecked\n * @restrict A\n * @priority 100\n *\n * @description\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as checked. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngChecked` directive solves this problem for the `checked` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n * @example\n    <example>\n      <file name=\"index.html\">\n        Check me to check both: <input type=\"checkbox\" ng-model=\"master\"><br/>\n        <input id=\"checkSlave\" type=\"checkbox\" ng-checked=\"master\">\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should check both checkBoxes', function() {\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();\n          element(by.model('master')).click();\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,\n *     then special attribute \"checked\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngReadonly\n * @restrict A\n * @priority 100\n *\n * @description\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as readonly. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngReadonly` directive solves this problem for the `readonly` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n * @example\n    <example>\n      <file name=\"index.html\">\n        Check me to make text readonly: <input type=\"checkbox\" ng-model=\"checked\"><br/>\n        <input type=\"text\" ng-readonly=\"checked\" value=\"I'm Angular\"/>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle readonly attr', function() {\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,\n *     then special attribute \"readonly\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSelected\n * @restrict A\n * @priority 100\n *\n * @description\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as selected. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngSelected` directive solves this problem for the `selected` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        Check me to select: <input type=\"checkbox\" ng-model=\"selected\"><br/>\n        <select>\n          <option>Hello!</option>\n          <option id=\"greet\" ng-selected=\"selected\">Greetings!</option>\n        </select>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should select Greetings!', function() {\n          expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();\n          element(by.model('selected')).click();\n          expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element OPTION\n * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,\n *     then special attribute \"selected\" will be set on the element\n */\n\n/**\n * @ngdoc directive\n * @name ngOpen\n * @restrict A\n * @priority 100\n *\n * @description\n * The HTML specification does not require browsers to preserve the values of boolean attributes\n * such as open. (Their presence means true and their absence means false.)\n * If we put an Angular interpolation expression into such an attribute then the\n * binding information would be lost when the browser removes the attribute.\n * The `ngOpen` directive solves this problem for the `open` attribute.\n * This complementary directive is not removed by the browser and so provides\n * a permanent reliable place to store the binding information.\n * @example\n     <example>\n       <file name=\"index.html\">\n         Check me check multiple: <input type=\"checkbox\" ng-model=\"open\"><br/>\n         <details id=\"details\" ng-open=\"open\">\n            <summary>Show/Hide me</summary>\n         </details>\n       </file>\n       <file name=\"protractor.js\" type=\"protractor\">\n         it('should toggle open', function() {\n           expect(element(by.id('details')).getAttribute('open')).toBeFalsy();\n           element(by.model('open')).click();\n           expect(element(by.id('details')).getAttribute('open')).toBeTruthy();\n         });\n       </file>\n     </example>\n *\n * @element DETAILS\n * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,\n *     then special attribute \"open\" will be set on the element\n */\n\nvar ngAttributeAliasDirectives = {};\n\n\n// boolean attrs are evaluated\nforEach(BOOLEAN_ATTR, function(propName, attrName) {\n  // binding to multiple is not supported\n  if (propName == \"multiple\") return;\n\n  var normalized = directiveNormalize('ng-' + attrName);\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      priority: 100,\n      link: function(scope, element, attr) {\n        scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {\n          attr.$set(attrName, !!value);\n        });\n      }\n    };\n  };\n});\n\n\n// ng-src, ng-srcset, ng-href are interpolated\nforEach(['src', 'srcset', 'href'], function(attrName) {\n  var normalized = directiveNormalize('ng-' + attrName);\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      priority: 99, // it needs to run after the attributes are interpolated\n      link: function(scope, element, attr) {\n        var propName = attrName,\n            name = attrName;\n\n        if (attrName === 'href' &&\n            toString.call(element.prop('href')) === '[object SVGAnimatedString]') {\n          name = 'xlinkHref';\n          attr.$attr[name] = 'xlink:href';\n          propName = null;\n        }\n\n        attr.$observe(normalized, function(value) {\n          if (!value)\n             return;\n\n          attr.$set(name, value);\n\n          // on IE, if \"ng:src\" directive declaration is used and \"src\" attribute doesn't exist\n          // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need\n          // to set the property as well to achieve the desired effect.\n          // we use attr[attrName] value since $set can sanitize the url.\n          if (msie && propName) element.prop(propName, attr[name]);\n        });\n      }\n    };\n  };\n});\n\n/* global -nullFormCtrl */\nvar nullFormCtrl = {\n  $addControl: noop,\n  $removeControl: noop,\n  $setValidity: noop,\n  $setDirty: noop,\n  $setPristine: noop\n};\n\n/**\n * @ngdoc type\n * @name form.FormController\n *\n * @property {boolean} $pristine True if user has not interacted with the form yet.\n * @property {boolean} $dirty True if user has already interacted with the form.\n * @property {boolean} $valid True if all of the containing forms and controls are valid.\n * @property {boolean} $invalid True if at least one containing control or form is invalid.\n *\n * @property {Object} $error Is an object hash, containing references to all invalid controls or\n *  forms, where:\n *\n *  - keys are validation tokens (error names),\n *  - values are arrays of controls or forms that are invalid for given error name.\n *\n *\n *  Built-in validation tokens:\n *\n *  - `email`\n *  - `max`\n *  - `maxlength`\n *  - `min`\n *  - `minlength`\n *  - `number`\n *  - `pattern`\n *  - `required`\n *  - `url`\n *\n * @description\n * `FormController` keeps track of all its controls and nested forms as well as the state of them,\n * such as being valid/invalid or dirty/pristine.\n *\n * Each {@link ng.directive:form form} directive creates an instance\n * of `FormController`.\n *\n */\n//asks for $scope to fool the BC controller module\nFormController.$inject = ['$element', '$attrs', '$scope', '$animate'];\nfunction FormController(element, attrs, $scope, $animate) {\n  var form = this,\n      parentForm = element.parent().controller('form') || nullFormCtrl,\n      invalidCount = 0, // used to easily determine if we are valid\n      errors = form.$error = {},\n      controls = [];\n\n  // init state\n  form.$name = attrs.name || attrs.ngForm;\n  form.$dirty = false;\n  form.$pristine = true;\n  form.$valid = true;\n  form.$invalid = false;\n\n  parentForm.$addControl(form);\n\n  // Setup initial state of the control\n  element.addClass(PRISTINE_CLASS);\n  toggleValidCss(true);\n\n  // convenience method for easy toggling of classes\n  function toggleValidCss(isValid, validationErrorKey) {\n    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';\n    $animate.removeClass(element, (isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey);\n    $animate.addClass(element, (isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);\n  }\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$addControl\n   *\n   * @description\n   * Register a control with the form.\n   *\n   * Input elements using ngModelController do this automatically when they are linked.\n   */\n  form.$addControl = function(control) {\n    // Breaking change - before, inputs whose name was \"hasOwnProperty\" were quietly ignored\n    // and not added to the scope.  Now we throw an error.\n    assertNotHasOwnProperty(control.$name, 'input');\n    controls.push(control);\n\n    if (control.$name) {\n      form[control.$name] = control;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$removeControl\n   *\n   * @description\n   * Deregister a control from the form.\n   *\n   * Input elements using ngModelController do this automatically when they are destroyed.\n   */\n  form.$removeControl = function(control) {\n    if (control.$name && form[control.$name] === control) {\n      delete form[control.$name];\n    }\n    forEach(errors, function(queue, validationToken) {\n      form.$setValidity(validationToken, true, control);\n    });\n\n    arrayRemove(controls, control);\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setValidity\n   *\n   * @description\n   * Sets the validity of a form control.\n   *\n   * This method will also propagate to parent forms.\n   */\n  form.$setValidity = function(validationToken, isValid, control) {\n    var queue = errors[validationToken];\n\n    if (isValid) {\n      if (queue) {\n        arrayRemove(queue, control);\n        if (!queue.length) {\n          invalidCount--;\n          if (!invalidCount) {\n            toggleValidCss(isValid);\n            form.$valid = true;\n            form.$invalid = false;\n          }\n          errors[validationToken] = false;\n          toggleValidCss(true, validationToken);\n          parentForm.$setValidity(validationToken, true, form);\n        }\n      }\n\n    } else {\n      if (!invalidCount) {\n        toggleValidCss(isValid);\n      }\n      if (queue) {\n        if (includes(queue, control)) return;\n      } else {\n        errors[validationToken] = queue = [];\n        invalidCount++;\n        toggleValidCss(false, validationToken);\n        parentForm.$setValidity(validationToken, false, form);\n      }\n      queue.push(control);\n\n      form.$valid = false;\n      form.$invalid = true;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setDirty\n   *\n   * @description\n   * Sets the form to a dirty state.\n   *\n   * This method can be called to add the 'ng-dirty' class and set the form to a dirty\n   * state (ng-dirty class). This method will also propagate to parent forms.\n   */\n  form.$setDirty = function() {\n    $animate.removeClass(element, PRISTINE_CLASS);\n    $animate.addClass(element, DIRTY_CLASS);\n    form.$dirty = true;\n    form.$pristine = false;\n    parentForm.$setDirty();\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setPristine\n   *\n   * @description\n   * Sets the form to its pristine state.\n   *\n   * This method can be called to remove the 'ng-dirty' class and set the form to its pristine\n   * state (ng-pristine class). This method will also propagate to all the controls contained\n   * in this form.\n   *\n   * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after\n   * saving or resetting it.\n   */\n  form.$setPristine = function () {\n    $animate.removeClass(element, DIRTY_CLASS);\n    $animate.addClass(element, PRISTINE_CLASS);\n    form.$dirty = false;\n    form.$pristine = true;\n    forEach(controls, function(control) {\n      control.$setPristine();\n    });\n  };\n}\n\n\n/**\n * @ngdoc directive\n * @name ngForm\n * @restrict EAC\n *\n * @description\n * Nestable alias of {@link ng.directive:form `form`} directive. HTML\n * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a\n * sub-group of controls needs to be determined.\n *\n * Note: the purpose of `ngForm` is to group controls,\n * but not to be a replacement for the `<form>` tag with all of its capabilities\n * (e.g. posting to the server, ...).\n *\n * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n *\n */\n\n /**\n * @ngdoc directive\n * @name form\n * @restrict E\n *\n * @description\n * Directive that instantiates\n * {@link form.FormController FormController}.\n *\n * If the `name` attribute is specified, the form controller is published onto the current scope under\n * this name.\n *\n * # Alias: {@link ng.directive:ngForm `ngForm`}\n *\n * In Angular forms can be nested. This means that the outer form is valid when all of the child\n * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so\n * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to\n * `<form>` but can be nested.  This allows you to have nested forms, which is very useful when\n * using Angular validation directives in forms that are dynamically generated using the\n * {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name`\n * attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an\n * `ngForm` directive and nest these in an outer `form` element.\n *\n *\n * # CSS classes\n *  - `ng-valid` is set if the form is valid.\n *  - `ng-invalid` is set if the form is invalid.\n *  - `ng-pristine` is set if the form is pristine.\n *  - `ng-dirty` is set if the form is dirty.\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n *\n * # Submitting a form and preventing the default action\n *\n * Since the role of forms in client-side Angular applications is different than in classical\n * roundtrip apps, it is desirable for the browser not to translate the form submission into a full\n * page reload that sends the data to the server. Instead some javascript logic should be triggered\n * to handle the form submission in an application-specific way.\n *\n * For this reason, Angular prevents the default action (form submission to the server) unless the\n * `<form>` element has an `action` attribute specified.\n *\n * You can use one of the following two ways to specify what javascript method should be called when\n * a form is submitted:\n *\n * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element\n * - {@link ng.directive:ngClick ngClick} directive on the first\n  *  button or input field of type submit (input[type=submit])\n *\n * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}\n * or {@link ng.directive:ngClick ngClick} directives.\n * This is because of the following form submission rules in the HTML specification:\n *\n * - If a form has only one input field then hitting enter in this field triggers form submit\n * (`ngSubmit`)\n * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter\n * doesn't trigger submit\n * - if a form has one or more input fields and one or more buttons or input[type=submit] then\n * hitting enter in any of the input fields will trigger the click handler on the *first* button or\n * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)\n *\n * @param {string=} name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n *\n * ## Animation Hooks\n *\n * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.\n * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any\n * other validations that are performed within the form. Animations in ngForm are similar to how\n * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well\n * as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style a form element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-form {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-form.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n    <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\">\n      <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.userType = 'guest';\n         }\n       </script>\n       <style>\n        .my-form {\n          -webkit-transition:all linear 0.5s;\n          transition:all linear 0.5s;\n          background: transparent;\n        }\n        .my-form.ng-invalid {\n          background: red;\n        }\n       </style>\n       <form name=\"myForm\" ng-controller=\"Ctrl\" class=\"my-form\">\n         userType: <input name=\"input\" ng-model=\"userType\" required>\n         <span class=\"error\" ng-show=\"myForm.input.$error.required\">Required!</span><br>\n         <tt>userType = {{userType}}</tt><br>\n         <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>\n         <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should initialize to model', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n\n          expect(userType.getText()).toContain('guest');\n          expect(valid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var userInput = element(by.model('userType'));\n\n          userInput.clear();\n          userInput.sendKeys('');\n\n          expect(userType.getText()).toEqual('userType =');\n          expect(valid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n *\n */\nvar formDirectiveFactory = function(isNgForm) {\n  return ['$timeout', function($timeout) {\n    var formDirective = {\n      name: 'form',\n      restrict: isNgForm ? 'EAC' : 'E',\n      controller: FormController,\n      compile: function() {\n        return {\n          pre: function(scope, formElement, attr, controller) {\n            if (!attr.action) {\n              // we can't use jq events because if a form is destroyed during submission the default\n              // action is not prevented. see #1238\n              //\n              // IE 9 is not affected because it doesn't fire a submit event and try to do a full\n              // page reload if the form was destroyed by submission of the form via a click handler\n              // on a button in the form. Looks like an IE9 specific bug.\n              var preventDefaultListener = function(event) {\n                event.preventDefault\n                  ? event.preventDefault()\n                  : event.returnValue = false; // IE\n              };\n\n              addEventListenerFn(formElement[0], 'submit', preventDefaultListener);\n\n              // unregister the preventDefault listener so that we don't not leak memory but in a\n              // way that will achieve the prevention of the default action.\n              formElement.on('$destroy', function() {\n                $timeout(function() {\n                  removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);\n                }, 0, false);\n              });\n            }\n\n            var parentFormCtrl = formElement.parent().controller('form'),\n                alias = attr.name || attr.ngForm;\n\n            if (alias) {\n              setter(scope, alias, controller, alias);\n            }\n            if (parentFormCtrl) {\n              formElement.on('$destroy', function() {\n                parentFormCtrl.$removeControl(controller);\n                if (alias) {\n                  setter(scope, alias, undefined, alias);\n                }\n                extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards\n              });\n            }\n          }\n        };\n      }\n    };\n\n    return formDirective;\n  }];\n};\n\nvar formDirective = formDirectiveFactory();\nvar ngFormDirective = formDirectiveFactory(true);\n\n/* global\n\n    -VALID_CLASS,\n    -INVALID_CLASS,\n    -PRISTINE_CLASS,\n    -DIRTY_CLASS\n*/\n\nvar URL_REGEXP = /^(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?$/;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\\.[a-z0-9-]+)*$/i;\nvar NUMBER_REGEXP = /^\\s*(\\-|\\+)?(\\d+|(\\d*(\\.\\d*)))\\s*$/;\n\nvar inputType = {\n\n  /**\n   * @ngdoc input\n   * @name input[text]\n   *\n   * @description\n   * Standard HTML text input with angular data binding.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Adds `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n   *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n   *    patterns defined as scope expressions.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n   *\n   * @example\n      <example name=\"text-input-directive\">\n        <file name=\"index.html\">\n         <script>\n           function Ctrl($scope) {\n             $scope.text = 'guest';\n             $scope.word = /^\\s*\\w*\\s*$/;\n           }\n         </script>\n         <form name=\"myForm\" ng-controller=\"Ctrl\">\n           Single word: <input type=\"text\" name=\"input\" ng-model=\"text\"\n                               ng-pattern=\"word\" required ng-trim=\"false\">\n           <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n             Required!</span>\n           <span class=\"error\" ng-show=\"myForm.input.$error.pattern\">\n             Single word only!</span>\n\n           <tt>text = {{text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('guest');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if multi word', function() {\n            input.clear();\n            input.sendKeys('hello world');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'text': textInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[number]\n   *\n   * @description\n   * Text input with number validation and transformation. Sets the `number` validation\n   * error if not a valid number.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n   *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n   *    patterns defined as scope expressions.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"number-input-directive\">\n        <file name=\"index.html\">\n         <script>\n           function Ctrl($scope) {\n             $scope.value = 12;\n           }\n         </script>\n         <form name=\"myForm\" ng-controller=\"Ctrl\">\n           Number: <input type=\"number\" name=\"input\" ng-model=\"value\"\n                          min=\"0\" max=\"99\" required>\n           <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n             Required!</span>\n           <span class=\"error\" ng-show=\"myForm.input.$error.number\">\n             Not valid number!</span>\n           <tt>value = {{value}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var value = element(by.binding('value'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('value'));\n\n          it('should initialize to model', function() {\n            expect(value.getText()).toContain('12');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if over max', function() {\n            input.clear();\n            input.sendKeys('123');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'number': numberInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[url]\n   *\n   * @description\n   * Text input with URL validation. Sets the `url` validation error key if the content is not a\n   * valid URL.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n   *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n   *    patterns defined as scope expressions.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"url-input-directive\">\n        <file name=\"index.html\">\n         <script>\n           function Ctrl($scope) {\n             $scope.text = 'http://google.com';\n           }\n         </script>\n         <form name=\"myForm\" ng-controller=\"Ctrl\">\n           URL: <input type=\"url\" name=\"input\" ng-model=\"text\" required>\n           <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n             Required!</span>\n           <span class=\"error\" ng-show=\"myForm.input.$error.url\">\n             Not valid url!</span>\n           <tt>text = {{text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n           <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('http://google.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not url', function() {\n            input.clear();\n            input.sendKeys('box');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'url': urlInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[email]\n   *\n   * @description\n   * Text input with email validation. Sets the `email` validation error key if not a valid email\n   * address.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n   *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n   *    patterns defined as scope expressions.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"email-input-directive\">\n        <file name=\"index.html\">\n         <script>\n           function Ctrl($scope) {\n             $scope.text = 'me@example.com';\n           }\n         </script>\n           <form name=\"myForm\" ng-controller=\"Ctrl\">\n             Email: <input type=\"email\" name=\"input\" ng-model=\"text\" required>\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.email\">\n               Not valid email!</span>\n             <tt>text = {{text}}</tt><br/>\n             <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n             <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n             <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n             <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n             <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>\n           </form>\n         </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('me@example.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not email', function() {\n            input.clear();\n            input.sendKeys('xxx');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'email': emailInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[radio]\n   *\n   * @description\n   * HTML radio button.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string} value The value to which the expression should be set when selected.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {string} ngValue Angular expression which sets the value to which the expression should\n   *    be set when selected.\n   *\n   * @example\n      <example name=\"radio-input-directive\">\n        <file name=\"index.html\">\n         <script>\n           function Ctrl($scope) {\n             $scope.color = 'blue';\n             $scope.specialValue = {\n               \"id\": \"12345\",\n               \"value\": \"green\"\n             };\n           }\n         </script>\n         <form name=\"myForm\" ng-controller=\"Ctrl\">\n           <input type=\"radio\" ng-model=\"color\" value=\"red\">  Red <br/>\n           <input type=\"radio\" ng-model=\"color\" ng-value=\"specialValue\"> Green <br/>\n           <input type=\"radio\" ng-model=\"color\" value=\"blue\"> Blue <br/>\n           <tt>color = {{color | json}}</tt><br/>\n          </form>\n          Note that `ng-value=\"specialValue\"` sets radio item's value to be the value of `$scope.specialValue`.\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var color = element(by.binding('color'));\n\n            expect(color.getText()).toContain('blue');\n\n            element.all(by.model('color')).get(0).click();\n\n            expect(color.getText()).toContain('red');\n          });\n        </file>\n      </example>\n   */\n  'radio': radioInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[checkbox]\n   *\n   * @description\n   * HTML checkbox.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} ngTrueValue The value to which the expression should be set when selected.\n   * @param {string=} ngFalseValue The value to which the expression should be set when not selected.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"checkbox-input-directive\">\n        <file name=\"index.html\">\n         <script>\n           function Ctrl($scope) {\n             $scope.value1 = true;\n             $scope.value2 = 'YES'\n           }\n         </script>\n         <form name=\"myForm\" ng-controller=\"Ctrl\">\n           Value1: <input type=\"checkbox\" ng-model=\"value1\"> <br/>\n           Value2: <input type=\"checkbox\" ng-model=\"value2\"\n                          ng-true-value=\"YES\" ng-false-value=\"NO\"> <br/>\n           <tt>value1 = {{value1}}</tt><br/>\n           <tt>value2 = {{value2}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var value1 = element(by.binding('value1'));\n            var value2 = element(by.binding('value2'));\n\n            expect(value1.getText()).toContain('true');\n            expect(value2.getText()).toContain('YES');\n\n            element(by.model('value1')).click();\n            element(by.model('value2')).click();\n\n            expect(value1.getText()).toContain('false');\n            expect(value2.getText()).toContain('NO');\n          });\n        </file>\n      </example>\n   */\n  'checkbox': checkboxInputType,\n\n  'hidden': noop,\n  'button': noop,\n  'submit': noop,\n  'reset': noop,\n  'file': noop\n};\n\n// A helper function to call $setValidity and return the value / undefined,\n// a pattern that is repeated a lot in the input validation logic.\nfunction validate(ctrl, validatorName, validity, value){\n  ctrl.$setValidity(validatorName, validity);\n  return validity ? value : undefined;\n}\n\n\nfunction addNativeHtml5Validators(ctrl, validatorName, element) {\n  var validity = element.prop('validity');\n  if (isObject(validity)) {\n    var validator = function(value) {\n      // Don't overwrite previous validation, don't consider valueMissing to apply (ng-required can\n      // perform the required validation)\n      if (!ctrl.$error[validatorName] && (validity.badInput || validity.customError ||\n          validity.typeMismatch) && !validity.valueMissing) {\n        ctrl.$setValidity(validatorName, false);\n        return;\n      }\n      return value;\n    };\n    ctrl.$parsers.push(validator);\n  }\n}\n\nfunction textInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  var validity = element.prop('validity');\n  var placeholder = element[0].placeholder, noevent = {};\n\n  // In composition mode, users are still inputing intermediate text buffer,\n  // hold the listener until composition is done.\n  // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent\n  if (!$sniffer.android) {\n    var composing = false;\n\n    element.on('compositionstart', function(data) {\n      composing = true;\n    });\n\n    element.on('compositionend', function() {\n      composing = false;\n      listener();\n    });\n  }\n\n  var listener = function(ev) {\n    if (composing) return;\n    var value = element.val();\n\n    // IE (11 and under) seem to emit an 'input' event if the placeholder value changes.\n    // We don't want to dirty the value when this happens, so we abort here. Unfortunately,\n    // IE also sends input events for other non-input-related things, (such as focusing on a\n    // form control), so this change is not entirely enough to solve this.\n    if (msie && (ev || noevent).type === 'input' && element[0].placeholder !== placeholder) {\n      placeholder = element[0].placeholder;\n      return;\n    }\n\n    // By default we will trim the value\n    // If the attribute ng-trim exists we will avoid trimming\n    // e.g. <input ng-model=\"foo\" ng-trim=\"false\">\n    if (toBoolean(attr.ngTrim || 'T')) {\n      value = trim(value);\n    }\n\n    if (ctrl.$viewValue !== value ||\n        // If the value is still empty/falsy, and there is no `required` error, run validators\n        // again. This enables HTML5 constraint validation errors to affect Angular validation\n        // even when the first character entered causes an error.\n        (validity && value === '' && !validity.valueMissing)) {\n      if (scope.$$phase) {\n        ctrl.$setViewValue(value);\n      } else {\n        scope.$apply(function() {\n          ctrl.$setViewValue(value);\n        });\n      }\n    }\n  };\n\n  // if the browser does support \"input\" event, we are fine - except on IE9 which doesn't fire the\n  // input event on backspace, delete or cut\n  if ($sniffer.hasEvent('input')) {\n    element.on('input', listener);\n  } else {\n    var timeout;\n\n    var deferListener = function() {\n      if (!timeout) {\n        timeout = $browser.defer(function() {\n          listener();\n          timeout = null;\n        });\n      }\n    };\n\n    element.on('keydown', function(event) {\n      var key = event.keyCode;\n\n      // ignore\n      //    command            modifiers                   arrows\n      if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;\n\n      deferListener();\n    });\n\n    // if user modifies input value using context menu in IE, we need \"paste\" and \"cut\" events to catch it\n    if ($sniffer.hasEvent('paste')) {\n      element.on('paste cut', deferListener);\n    }\n  }\n\n  // if user paste into input using mouse on older browser\n  // or form autocomplete on newer browser, we need \"change\" event to catch it\n  element.on('change', listener);\n\n  ctrl.$render = function() {\n    element.val(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);\n  };\n\n  // pattern validator\n  var pattern = attr.ngPattern,\n      patternValidator,\n      match;\n\n  if (pattern) {\n    var validateRegex = function(regexp, value) {\n      return validate(ctrl, 'pattern', ctrl.$isEmpty(value) || regexp.test(value), value);\n    };\n    match = pattern.match(/^\\/(.*)\\/([gim]*)$/);\n    if (match) {\n      pattern = new RegExp(match[1], match[2]);\n      patternValidator = function(value) {\n        return validateRegex(pattern, value);\n      };\n    } else {\n      patternValidator = function(value) {\n        var patternObj = scope.$eval(pattern);\n\n        if (!patternObj || !patternObj.test) {\n          throw minErr('ngPattern')('noregexp',\n            'Expected {0} to be a RegExp but was {1}. Element: {2}', pattern,\n            patternObj, startingTag(element));\n        }\n        return validateRegex(patternObj, value);\n      };\n    }\n\n    ctrl.$formatters.push(patternValidator);\n    ctrl.$parsers.push(patternValidator);\n  }\n\n  // min length validator\n  if (attr.ngMinlength) {\n    var minlength = int(attr.ngMinlength);\n    var minLengthValidator = function(value) {\n      return validate(ctrl, 'minlength', ctrl.$isEmpty(value) || value.length >= minlength, value);\n    };\n\n    ctrl.$parsers.push(minLengthValidator);\n    ctrl.$formatters.push(minLengthValidator);\n  }\n\n  // max length validator\n  if (attr.ngMaxlength) {\n    var maxlength = int(attr.ngMaxlength);\n    var maxLengthValidator = function(value) {\n      return validate(ctrl, 'maxlength', ctrl.$isEmpty(value) || value.length <= maxlength, value);\n    };\n\n    ctrl.$parsers.push(maxLengthValidator);\n    ctrl.$formatters.push(maxLengthValidator);\n  }\n}\n\nfunction numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  textInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  ctrl.$parsers.push(function(value) {\n    var empty = ctrl.$isEmpty(value);\n    if (empty || NUMBER_REGEXP.test(value)) {\n      ctrl.$setValidity('number', true);\n      return value === '' ? null : (empty ? value : parseFloat(value));\n    } else {\n      ctrl.$setValidity('number', false);\n      return undefined;\n    }\n  });\n\n  addNativeHtml5Validators(ctrl, 'number', element);\n\n  ctrl.$formatters.push(function(value) {\n    return ctrl.$isEmpty(value) ? '' : '' + value;\n  });\n\n  if (attr.min) {\n    var minValidator = function(value) {\n      var min = parseFloat(attr.min);\n      return validate(ctrl, 'min', ctrl.$isEmpty(value) || value >= min, value);\n    };\n\n    ctrl.$parsers.push(minValidator);\n    ctrl.$formatters.push(minValidator);\n  }\n\n  if (attr.max) {\n    var maxValidator = function(value) {\n      var max = parseFloat(attr.max);\n      return validate(ctrl, 'max', ctrl.$isEmpty(value) || value <= max, value);\n    };\n\n    ctrl.$parsers.push(maxValidator);\n    ctrl.$formatters.push(maxValidator);\n  }\n\n  ctrl.$formatters.push(function(value) {\n    return validate(ctrl, 'number', ctrl.$isEmpty(value) || isNumber(value), value);\n  });\n}\n\nfunction urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  textInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  var urlValidator = function(value) {\n    return validate(ctrl, 'url', ctrl.$isEmpty(value) || URL_REGEXP.test(value), value);\n  };\n\n  ctrl.$formatters.push(urlValidator);\n  ctrl.$parsers.push(urlValidator);\n}\n\nfunction emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  textInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  var emailValidator = function(value) {\n    return validate(ctrl, 'email', ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value), value);\n  };\n\n  ctrl.$formatters.push(emailValidator);\n  ctrl.$parsers.push(emailValidator);\n}\n\nfunction radioInputType(scope, element, attr, ctrl) {\n  // make the name unique, if not defined\n  if (isUndefined(attr.name)) {\n    element.attr('name', nextUid());\n  }\n\n  element.on('click', function() {\n    if (element[0].checked) {\n      scope.$apply(function() {\n        ctrl.$setViewValue(attr.value);\n      });\n    }\n  });\n\n  ctrl.$render = function() {\n    var value = attr.value;\n    element[0].checked = (value == ctrl.$viewValue);\n  };\n\n  attr.$observe('value', ctrl.$render);\n}\n\nfunction checkboxInputType(scope, element, attr, ctrl) {\n  var trueValue = attr.ngTrueValue,\n      falseValue = attr.ngFalseValue;\n\n  if (!isString(trueValue)) trueValue = true;\n  if (!isString(falseValue)) falseValue = false;\n\n  element.on('click', function() {\n    scope.$apply(function() {\n      ctrl.$setViewValue(element[0].checked);\n    });\n  });\n\n  ctrl.$render = function() {\n    element[0].checked = ctrl.$viewValue;\n  };\n\n  // Override the standard `$isEmpty` because a value of `false` means empty in a checkbox.\n  ctrl.$isEmpty = function(value) {\n    return value !== trueValue;\n  };\n\n  ctrl.$formatters.push(function(value) {\n    return value === trueValue;\n  });\n\n  ctrl.$parsers.push(function(value) {\n    return value ? trueValue : falseValue;\n  });\n}\n\n\n/**\n * @ngdoc directive\n * @name textarea\n * @restrict E\n *\n * @description\n * HTML textarea element control with angular data-binding. The data-binding and validation\n * properties of this element are exactly the same as those of the\n * {@link ng.directive:input input element}.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength.\n * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n *    patterns defined as scope expressions.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n */\n\n\n/**\n * @ngdoc directive\n * @name input\n * @restrict E\n *\n * @description\n * HTML input element control with angular data-binding. Input control follows HTML5 input types\n * and polyfills the HTML5 validation behavior for older browsers.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {boolean=} ngRequired Sets `required` attribute if set to true\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength.\n * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the\n *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for\n *    patterns defined as scope expressions.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n *\n * @example\n    <example name=\"input-directive\">\n      <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.user = {name: 'guest', last: 'visitor'};\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n         <form name=\"myForm\">\n           User name: <input type=\"text\" name=\"userName\" ng-model=\"user.name\" required>\n           <span class=\"error\" ng-show=\"myForm.userName.$error.required\">\n             Required!</span><br>\n           Last name: <input type=\"text\" name=\"lastName\" ng-model=\"user.last\"\n             ng-minlength=\"3\" ng-maxlength=\"10\">\n           <span class=\"error\" ng-show=\"myForm.lastName.$error.minlength\">\n             Too short!</span>\n           <span class=\"error\" ng-show=\"myForm.lastName.$error.maxlength\">\n             Too long!</span><br>\n         </form>\n         <hr>\n         <tt>user = {{user}}</tt><br/>\n         <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br>\n         <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br>\n         <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br>\n         <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>\n         <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br>\n         <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br>\n       </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var user = element(by.binding('{{user}}'));\n        var userNameValid = element(by.binding('myForm.userName.$valid'));\n        var lastNameValid = element(by.binding('myForm.lastName.$valid'));\n        var lastNameError = element(by.binding('myForm.lastName.$error'));\n        var formValid = element(by.binding('myForm.$valid'));\n        var userNameInput = element(by.model('user.name'));\n        var userLastInput = element(by.model('user.last'));\n\n        it('should initialize to model', function() {\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty when required', function() {\n          userNameInput.clear();\n          userNameInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('false');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be valid if empty when min length is set', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"\"}');\n          expect(lastNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if less than required min length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('xx');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('minlength');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be invalid if longer than max length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('some ridiculously long name');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('maxlength');\n          expect(formValid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n */\nvar inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) {\n  return {\n    restrict: 'E',\n    require: '?ngModel',\n    link: function(scope, element, attr, ctrl) {\n      if (ctrl) {\n        (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrl, $sniffer,\n                                                            $browser);\n      }\n    }\n  };\n}];\n\nvar VALID_CLASS = 'ng-valid',\n    INVALID_CLASS = 'ng-invalid',\n    PRISTINE_CLASS = 'ng-pristine',\n    DIRTY_CLASS = 'ng-dirty';\n\n/**\n * @ngdoc type\n * @name ngModel.NgModelController\n *\n * @property {string} $viewValue Actual string value in the view.\n * @property {*} $modelValue The value in the model, that the control is bound to.\n * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever\n       the control reads value from the DOM.  Each function is called, in turn, passing the value\n       through to the next. The last return value is used to populate the model.\n       Used to sanitize / convert the value as well as validation. For validation,\n       the parsers should update the validity state using\n       {@link ngModel.NgModelController#$setValidity $setValidity()},\n       and return `undefined` for invalid values.\n\n *\n * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever\n       the model value changes. Each function is called, in turn, passing the value through to the\n       next. Used to format / convert values for display in the control and validation.\n * ```js\n * function formatter(value) {\n *   if (value) {\n *     return value.toUpperCase();\n *   }\n * }\n * ngModel.$formatters.push(formatter);\n * ```\n *\n * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the\n *     view value has changed. It is called with no arguments, and its return value is ignored.\n *     This can be used in place of additional $watches against the model value.\n *\n * @property {Object} $error An object hash with all errors as keys.\n *\n * @property {boolean} $pristine True if user has not interacted with the control yet.\n * @property {boolean} $dirty True if user has already interacted with the control.\n * @property {boolean} $valid True if there is no error.\n * @property {boolean} $invalid True if at least one error on the control.\n *\n * @description\n *\n * `NgModelController` provides API for the `ng-model` directive. The controller contains\n * services for data-binding, validation, CSS updates, and value formatting and parsing. It\n * purposefully does not contain any logic which deals with DOM rendering or listening to\n * DOM events. Such DOM related logic should be provided by other directives which make use of\n * `NgModelController` for data-binding.\n *\n * ## Custom Control Example\n * This example shows how to use `NgModelController` with a custom control to achieve\n * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)\n * collaborate together to achieve the desired result.\n *\n * Note that `contenteditable` is an HTML5 attribute, which tells the browser to let the element\n * contents be edited in place by the user.  This will not work on older browsers.\n *\n * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}\n * module to automatically remove \"bad\" content like inline event listener (e.g. `<span onclick=\"...\">`).\n * However, as we are using `$sce` the model can still decide to to provide unsafe content if it marks\n * that content using the `$sce` service.\n *\n * <example name=\"NgModelController\" module=\"customControl\" deps=\"angular-sanitize.js\">\n    <file name=\"style.css\">\n      [contenteditable] {\n        border: 1px solid black;\n        background-color: white;\n        min-height: 20px;\n      }\n\n      .ng-invalid {\n        border: 1px solid red;\n      }\n\n    </file>\n    <file name=\"script.js\">\n      angular.module('customControl', ['ngSanitize']).\n        directive('contenteditable', ['$sce', function($sce) {\n          return {\n            restrict: 'A', // only activate on element attribute\n            require: '?ngModel', // get a hold of NgModelController\n            link: function(scope, element, attrs, ngModel) {\n              if(!ngModel) return; // do nothing if no ng-model\n\n              // Specify how UI should be updated\n              ngModel.$render = function() {\n                element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));\n              };\n\n              // Listen for change events to enable binding\n              element.on('blur keyup change', function() {\n                scope.$apply(read);\n              });\n              read(); // initialize\n\n              // Write data to the model\n              function read() {\n                var html = element.html();\n                // When we clear the content editable the browser leaves a <br> behind\n                // If strip-br attribute is provided then we strip this out\n                if( attrs.stripBr && html == '<br>' ) {\n                  html = '';\n                }\n                ngModel.$setViewValue(html);\n              }\n            }\n          };\n        }]);\n    </file>\n    <file name=\"index.html\">\n      <form name=\"myForm\">\n       <div contenteditable\n            name=\"myWidget\" ng-model=\"userContent\"\n            strip-br=\"true\"\n            required>Change me!</div>\n        <span ng-show=\"myForm.myWidget.$error.required\">Required!</span>\n       <hr>\n       <textarea ng-model=\"userContent\"></textarea>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n    it('should data-bind and become invalid', function() {\n      if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {\n        // SafariDriver can't handle contenteditable\n        // and Firefox driver can't clear contenteditables very well\n        return;\n      }\n      var contentEditable = element(by.css('[contenteditable]'));\n      var content = 'Change me!';\n\n      expect(contentEditable.getText()).toEqual(content);\n\n      contentEditable.clear();\n      contentEditable.sendKeys(protractor.Key.BACK_SPACE);\n      expect(contentEditable.getText()).toEqual('');\n      expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);\n    });\n    </file>\n * </example>\n *\n *\n */\nvar NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate',\n    function($scope, $exceptionHandler, $attr, $element, $parse, $animate) {\n  this.$viewValue = Number.NaN;\n  this.$modelValue = Number.NaN;\n  this.$parsers = [];\n  this.$formatters = [];\n  this.$viewChangeListeners = [];\n  this.$pristine = true;\n  this.$dirty = false;\n  this.$valid = true;\n  this.$invalid = false;\n  this.$name = $attr.name;\n\n  var ngModelGet = $parse($attr.ngModel),\n      ngModelSet = ngModelGet.assign;\n\n  if (!ngModelSet) {\n    throw minErr('ngModel')('nonassign', \"Expression '{0}' is non-assignable. Element: {1}\",\n        $attr.ngModel, startingTag($element));\n  }\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$render\n   *\n   * @description\n   * Called when the view needs to be updated. It is expected that the user of the ng-model\n   * directive will implement this method.\n   */\n  this.$render = noop;\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$isEmpty\n   *\n   * @description\n   * This is called when we need to determine if the value of the input is empty.\n   *\n   * For instance, the required directive does this to work out if the input has data or not.\n   * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.\n   *\n   * You can override this for input directives whose concept of being empty is different to the\n   * default. The `checkboxInputType` directive does this because in its case a value of `false`\n   * implies empty.\n   *\n   * @param {*} value Reference to check.\n   * @returns {boolean} True if `value` is empty.\n   */\n  this.$isEmpty = function(value) {\n    return isUndefined(value) || value === '' || value === null || value !== value;\n  };\n\n  var parentForm = $element.inheritedData('$formController') || nullFormCtrl,\n      invalidCount = 0, // used to easily determine if we are valid\n      $error = this.$error = {}; // keep invalid keys here\n\n\n  // Setup initial state of the control\n  $element.addClass(PRISTINE_CLASS);\n  toggleValidCss(true);\n\n  // convenience method for easy toggling of classes\n  function toggleValidCss(isValid, validationErrorKey) {\n    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';\n    $animate.removeClass($element, (isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey);\n    $animate.addClass($element, (isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);\n  }\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setValidity\n   *\n   * @description\n   * Change the validity state, and notifies the form when the control changes validity. (i.e. it\n   * does not notify form if given validator is already marked as invalid).\n   *\n   * This method should be called by validators - i.e. the parser or formatter functions.\n   *\n   * @param {string} validationErrorKey Name of the validator. the `validationErrorKey` will assign\n   *        to `$error[validationErrorKey]=isValid` so that it is available for data-binding.\n   *        The `validationErrorKey` should be in camelCase and will get converted into dash-case\n   *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`\n   *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .\n   * @param {boolean} isValid Whether the current state is valid (true) or invalid (false).\n   */\n  this.$setValidity = function(validationErrorKey, isValid) {\n    // Purposeful use of ! here to cast isValid to boolean in case it is undefined\n    // jshint -W018\n    if ($error[validationErrorKey] === !isValid) return;\n    // jshint +W018\n\n    if (isValid) {\n      if ($error[validationErrorKey]) invalidCount--;\n      if (!invalidCount) {\n        toggleValidCss(true);\n        this.$valid = true;\n        this.$invalid = false;\n      }\n    } else {\n      toggleValidCss(false);\n      this.$invalid = true;\n      this.$valid = false;\n      invalidCount++;\n    }\n\n    $error[validationErrorKey] = !isValid;\n    toggleValidCss(isValid, validationErrorKey);\n\n    parentForm.$setValidity(validationErrorKey, isValid, this);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setPristine\n   *\n   * @description\n   * Sets the control to its pristine state.\n   *\n   * This method can be called to remove the 'ng-dirty' class and set the control to its pristine\n   * state (ng-pristine class).\n   */\n  this.$setPristine = function () {\n    this.$dirty = false;\n    this.$pristine = true;\n    $animate.removeClass($element, DIRTY_CLASS);\n    $animate.addClass($element, PRISTINE_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setViewValue\n   *\n   * @description\n   * Update the view value.\n   *\n   * This method should be called when the view value changes, typically from within a DOM event handler.\n   * For example {@link ng.directive:input input} and\n   * {@link ng.directive:select select} directives call it.\n   *\n   * It will update the $viewValue, then pass this value through each of the functions in `$parsers`,\n   * which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to\n   * `$modelValue` and the **expression** specified in the `ng-model` attribute.\n   *\n   * Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.\n   *\n   * Note that calling this function does not trigger a `$digest`.\n   *\n   * @param {string} value Value from the view.\n   */\n  this.$setViewValue = function(value) {\n    this.$viewValue = value;\n\n    // change to dirty\n    if (this.$pristine) {\n      this.$dirty = true;\n      this.$pristine = false;\n      $animate.removeClass($element, PRISTINE_CLASS);\n      $animate.addClass($element, DIRTY_CLASS);\n      parentForm.$setDirty();\n    }\n\n    forEach(this.$parsers, function(fn) {\n      value = fn(value);\n    });\n\n    if (this.$modelValue !== value) {\n      this.$modelValue = value;\n      ngModelSet($scope, value);\n      forEach(this.$viewChangeListeners, function(listener) {\n        try {\n          listener();\n        } catch(e) {\n          $exceptionHandler(e);\n        }\n      });\n    }\n  };\n\n  // model -> value\n  var ctrl = this;\n\n  $scope.$watch(function ngModelWatch() {\n    var value = ngModelGet($scope);\n\n    // if scope model value and ngModel value are out of sync\n    if (ctrl.$modelValue !== value) {\n\n      var formatters = ctrl.$formatters,\n          idx = formatters.length;\n\n      ctrl.$modelValue = value;\n      while(idx--) {\n        value = formatters[idx](value);\n      }\n\n      if (ctrl.$viewValue !== value) {\n        ctrl.$viewValue = value;\n        ctrl.$render();\n      }\n    }\n\n    return value;\n  });\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngModel\n *\n * @element input\n *\n * @description\n * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a\n * property on the scope using {@link ngModel.NgModelController NgModelController},\n * which is created and exposed by this directive.\n *\n * `ngModel` is responsible for:\n *\n * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`\n *   require.\n * - Providing validation behavior (i.e. required, number, email, url).\n * - Keeping the state of the control (valid/invalid, dirty/pristine, validation errors).\n * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`) including animations.\n * - Registering the control with its parent {@link ng.directive:form form}.\n *\n * Note: `ngModel` will try to bind to the property given by evaluating the expression on the\n * current scope. If the property doesn't already exist on this scope, it will be created\n * implicitly and added to the scope.\n *\n * For best practices on using `ngModel`, see:\n *\n *  - [https://github.com/angular/angular.js/wiki/Understanding-Scopes]\n *\n * For basic examples, how to use `ngModel`, see:\n *\n *  - {@link ng.directive:input input}\n *    - {@link input[text] text}\n *    - {@link input[checkbox] checkbox}\n *    - {@link input[radio] radio}\n *    - {@link input[number] number}\n *    - {@link input[email] email}\n *    - {@link input[url] url}\n *  - {@link ng.directive:select select}\n *  - {@link ng.directive:textarea textarea}\n *\n * # CSS classes\n * The following CSS classes are added and removed on the associated input/select/textarea element\n * depending on the validity of the model.\n *\n *  - `ng-valid` is set if the model is valid.\n *  - `ng-invalid` is set if the model is invalid.\n *  - `ng-pristine` is set if the model is pristine.\n *  - `ng-dirty` is set if the model is dirty.\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n * ## Animation Hooks\n *\n * Animations within models are triggered when any of the associated CSS classes are added and removed\n * on the input element which is attached to the model. These classes are: `.ng-pristine`, `.ng-dirty`,\n * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.\n * The animations that are triggered within ngModel are similar to how they work in ngClass and\n * animations can be hooked into using CSS transitions, keyframes as well as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style an input element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-input {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-input.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n * <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\">\n     <file name=\"index.html\">\n       <script>\n        function Ctrl($scope) {\n          $scope.val = '1';\n        }\n       </script>\n       <style>\n         .my-input {\n           -webkit-transition:all linear 0.5s;\n           transition:all linear 0.5s;\n           background: transparent;\n         }\n         .my-input.ng-invalid {\n           color:white;\n           background: red;\n         }\n       </style>\n       Update input to see transitions when valid/invalid.\n       Integer is a valid value.\n       <form name=\"testForm\" ng-controller=\"Ctrl\">\n         <input ng-model=\"val\" ng-pattern=\"/^\\d+$/\" name=\"anim\" class=\"my-input\" />\n       </form>\n     </file>\n * </example>\n */\nvar ngModelDirective = function() {\n  return {\n    require: ['ngModel', '^?form'],\n    controller: NgModelController,\n    link: function(scope, element, attr, ctrls) {\n      // notify others, especially parent forms\n\n      var modelCtrl = ctrls[0],\n          formCtrl = ctrls[1] || nullFormCtrl;\n\n      formCtrl.$addControl(modelCtrl);\n\n      scope.$on('$destroy', function() {\n        formCtrl.$removeControl(modelCtrl);\n      });\n    }\n  };\n};\n\n\n/**\n * @ngdoc directive\n * @name ngChange\n *\n * @description\n * Evaluate the given expression when the user changes the input.\n * The expression is evaluated immediately, unlike the JavaScript onchange event\n * which only triggers at the end of a change (usually, when the user leaves the\n * form element or presses the return key).\n * The expression is not evaluated when the value change is coming from the model.\n *\n * Note, this directive requires `ngModel` to be present.\n *\n * @element input\n * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change\n * in input value.\n *\n * @example\n * <example name=\"ngChange-directive\">\n *   <file name=\"index.html\">\n *     <script>\n *       function Controller($scope) {\n *         $scope.counter = 0;\n *         $scope.change = function() {\n *           $scope.counter++;\n *         };\n *       }\n *     </script>\n *     <div ng-controller=\"Controller\">\n *       <input type=\"checkbox\" ng-model=\"confirmed\" ng-change=\"change()\" id=\"ng-change-example1\" />\n *       <input type=\"checkbox\" ng-model=\"confirmed\" id=\"ng-change-example2\" />\n *       <label for=\"ng-change-example2\">Confirmed</label><br />\n *       <tt>debug = {{confirmed}}</tt><br/>\n *       <tt>counter = {{counter}}</tt><br/>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     var counter = element(by.binding('counter'));\n *     var debug = element(by.binding('confirmed'));\n *\n *     it('should evaluate the expression if changing from view', function() {\n *       expect(counter.getText()).toContain('0');\n *\n *       element(by.id('ng-change-example1')).click();\n *\n *       expect(counter.getText()).toContain('1');\n *       expect(debug.getText()).toContain('true');\n *     });\n *\n *     it('should not evaluate the expression if changing from model', function() {\n *       element(by.id('ng-change-example2')).click();\n\n *       expect(counter.getText()).toContain('0');\n *       expect(debug.getText()).toContain('true');\n *     });\n *   </file>\n * </example>\n */\nvar ngChangeDirective = valueFn({\n  require: 'ngModel',\n  link: function(scope, element, attr, ctrl) {\n    ctrl.$viewChangeListeners.push(function() {\n      scope.$eval(attr.ngChange);\n    });\n  }\n});\n\n\nvar requiredDirective = function() {\n  return {\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n      attr.required = true; // force truthy in case we are on non input element\n\n      var validator = function(value) {\n        if (attr.required && ctrl.$isEmpty(value)) {\n          ctrl.$setValidity('required', false);\n          return;\n        } else {\n          ctrl.$setValidity('required', true);\n          return value;\n        }\n      };\n\n      ctrl.$formatters.push(validator);\n      ctrl.$parsers.unshift(validator);\n\n      attr.$observe('required', function() {\n        validator(ctrl.$viewValue);\n      });\n    }\n  };\n};\n\n\n/**\n * @ngdoc directive\n * @name ngList\n *\n * @description\n * Text input that converts between a delimited string and an array of strings. The delimiter\n * can be a fixed string (by default a comma) or a regular expression.\n *\n * @element input\n * @param {string=} ngList optional delimiter that should be used to split the value. If\n *   specified in form `/something/` then the value will be converted into a regular expression.\n *\n * @example\n    <example name=\"ngList-directive\">\n      <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.names = ['igor', 'misko', 'vojta'];\n         }\n       </script>\n       <form name=\"myForm\" ng-controller=\"Ctrl\">\n         List: <input name=\"namesInput\" ng-model=\"names\" ng-list required>\n         <span class=\"error\" ng-show=\"myForm.namesInput.$error.required\">\n           Required!</span>\n         <br>\n         <tt>names = {{names}}</tt><br/>\n         <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>\n         <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var listInput = element(by.model('names'));\n        var names = element(by.binding('{{names}}'));\n        var valid = element(by.binding('myForm.namesInput.$valid'));\n        var error = element(by.css('span.error'));\n\n        it('should initialize to model', function() {\n          expect(names.getText()).toContain('[\"igor\",\"misko\",\"vojta\"]');\n          expect(valid.getText()).toContain('true');\n          expect(error.getCssValue('display')).toBe('none');\n        });\n\n        it('should be invalid if empty', function() {\n          listInput.clear();\n          listInput.sendKeys('');\n\n          expect(names.getText()).toContain('');\n          expect(valid.getText()).toContain('false');\n          expect(error.getCssValue('display')).not.toBe('none');        });\n      </file>\n    </example>\n */\nvar ngListDirective = function() {\n  return {\n    require: 'ngModel',\n    link: function(scope, element, attr, ctrl) {\n      var match = /\\/(.*)\\//.exec(attr.ngList),\n          separator = match && new RegExp(match[1]) || attr.ngList || ',';\n\n      var parse = function(viewValue) {\n        // If the viewValue is invalid (say required but empty) it will be `undefined`\n        if (isUndefined(viewValue)) return;\n\n        var list = [];\n\n        if (viewValue) {\n          forEach(viewValue.split(separator), function(value) {\n            if (value) list.push(trim(value));\n          });\n        }\n\n        return list;\n      };\n\n      ctrl.$parsers.push(parse);\n      ctrl.$formatters.push(function(value) {\n        if (isArray(value)) {\n          return value.join(', ');\n        }\n\n        return undefined;\n      });\n\n      // Override the standard $isEmpty because an empty array means the input is empty.\n      ctrl.$isEmpty = function(value) {\n        return !value || !value.length;\n      };\n    }\n  };\n};\n\n\nvar CONSTANT_VALUE_REGEXP = /^(true|false|\\d+)$/;\n/**\n * @ngdoc directive\n * @name ngValue\n *\n * @description\n * Binds the given expression to the value of `input[select]` or `input[radio]`, so\n * that when the element is selected, the `ngModel` of that element is set to the\n * bound value.\n *\n * `ngValue` is useful when dynamically generating lists of radio buttons using `ng-repeat`, as\n * shown below.\n *\n * @element input\n * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute\n *   of the `input` element\n *\n * @example\n    <example name=\"ngValue-directive\">\n      <file name=\"index.html\">\n       <script>\n          function Ctrl($scope) {\n            $scope.names = ['pizza', 'unicorns', 'robots'];\n            $scope.my = { favorite: 'unicorns' };\n          }\n       </script>\n        <form ng-controller=\"Ctrl\">\n          <h2>Which is your favorite?</h2>\n            <label ng-repeat=\"name in names\" for=\"{{name}}\">\n              {{name}}\n              <input type=\"radio\"\n                     ng-model=\"my.favorite\"\n                     ng-value=\"name\"\n                     id=\"{{name}}\"\n                     name=\"favorite\">\n            </label>\n          <div>You chose {{my.favorite}}</div>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var favorite = element(by.binding('my.favorite'));\n\n        it('should initialize to model', function() {\n          expect(favorite.getText()).toContain('unicorns');\n        });\n        it('should bind the values to the inputs', function() {\n          element.all(by.model('my.favorite')).get(0).click();\n          expect(favorite.getText()).toContain('pizza');\n        });\n      </file>\n    </example>\n */\nvar ngValueDirective = function() {\n  return {\n    priority: 100,\n    compile: function(tpl, tplAttr) {\n      if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {\n        return function ngValueConstantLink(scope, elm, attr) {\n          attr.$set('value', scope.$eval(attr.ngValue));\n        };\n      } else {\n        return function ngValueLink(scope, elm, attr) {\n          scope.$watch(attr.ngValue, function valueWatchAction(value) {\n            attr.$set('value', value);\n          });\n        };\n      }\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngBind\n * @restrict AC\n *\n * @description\n * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element\n * with the value of a given expression, and to update the text content when the value of that\n * expression changes.\n *\n * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like\n * `{{ expression }}` which is similar but less verbose.\n *\n * It is preferable to use `ngBind` instead of `{{ expression }}` when a template is momentarily\n * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an\n * element attribute, it makes the bindings invisible to the user while the page is loading.\n *\n * An alternative solution to this problem would be using the\n * {@link ng.directive:ngCloak ngCloak} directive.\n *\n *\n * @element ANY\n * @param {expression} ngBind {@link guide/expression Expression} to evaluate.\n *\n * @example\n * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.\n   <example>\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.name = 'Whirled';\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n         Enter name: <input type=\"text\" ng-model=\"name\"><br>\n         Hello <span ng-bind=\"name\"></span>!\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var nameInput = element(by.model('name'));\n\n         expect(element(by.binding('name')).getText()).toBe('Whirled');\n         nameInput.clear();\n         nameInput.sendKeys('world');\n         expect(element(by.binding('name')).getText()).toBe('world');\n       });\n     </file>\n   </example>\n */\nvar ngBindDirective = ngDirective(function(scope, element, attr) {\n  element.addClass('ng-binding').data('$binding', attr.ngBind);\n  scope.$watch(attr.ngBind, function ngBindWatchAction(value) {\n    // We are purposefully using == here rather than === because we want to\n    // catch when value is \"null or undefined\"\n    // jshint -W041\n    element.text(value == undefined ? '' : value);\n  });\n});\n\n\n/**\n * @ngdoc directive\n * @name ngBindTemplate\n *\n * @description\n * The `ngBindTemplate` directive specifies that the element\n * text content should be replaced with the interpolation of the template\n * in the `ngBindTemplate` attribute.\n * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`\n * expressions. This directive is needed since some HTML elements\n * (such as TITLE and OPTION) cannot contain SPAN elements.\n *\n * @element ANY\n * @param {string} ngBindTemplate template of form\n *   <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.\n *\n * @example\n * Try it here: enter text in text box and watch the greeting change.\n   <example>\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.salutation = 'Hello';\n           $scope.name = 'World';\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n        Salutation: <input type=\"text\" ng-model=\"salutation\"><br>\n        Name: <input type=\"text\" ng-model=\"name\"><br>\n        <pre ng-bind-template=\"{{salutation}} {{name}}!\"></pre>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var salutationElem = element(by.binding('salutation'));\n         var salutationInput = element(by.model('salutation'));\n         var nameInput = element(by.model('name'));\n\n         expect(salutationElem.getText()).toBe('Hello World!');\n\n         salutationInput.clear();\n         salutationInput.sendKeys('Greetings');\n         nameInput.clear();\n         nameInput.sendKeys('user');\n\n         expect(salutationElem.getText()).toBe('Greetings user!');\n       });\n     </file>\n   </example>\n */\nvar ngBindTemplateDirective = ['$interpolate', function($interpolate) {\n  return function(scope, element, attr) {\n    // TODO: move this to scenario runner\n    var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));\n    element.addClass('ng-binding').data('$binding', interpolateFn);\n    attr.$observe('ngBindTemplate', function(value) {\n      element.text(value);\n    });\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindHtml\n *\n * @description\n * Creates a binding that will innerHTML the result of evaluating the `expression` into the current\n * element in a secure way.  By default, the innerHTML-ed content will be sanitized using the {@link\n * ngSanitize.$sanitize $sanitize} service.  To utilize this functionality, ensure that `$sanitize`\n * is available, for example, by including {@link ngSanitize} in your module's dependencies (not in\n * core Angular.)  You may also bypass sanitization for values you know are safe. To do so, bind to\n * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}.  See the example\n * under {@link ng.$sce#Example Strict Contextual Escaping (SCE)}.\n *\n * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you\n * will have an exception (instead of an exploit.)\n *\n * @element ANY\n * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.\n *\n * @example\n   Try it here: enter text in text box and watch the greeting change.\n\n   <example module=\"ngBindHtmlExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ngBindHtmlCtrl\">\n        <p ng-bind-html=\"myHTML\"></p>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n       angular.module('ngBindHtmlExample', ['ngSanitize'])\n\n       .controller('ngBindHtmlCtrl', ['$scope', function ngBindHtmlCtrl($scope) {\n         $scope.myHTML =\n            'I am an <code>HTML</code>string with <a href=\"#\">links!</a> and other <em>stuff</em>';\n       }]);\n     </file>\n\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind-html', function() {\n         expect(element(by.binding('myHTML')).getText()).toBe(\n             'I am an HTMLstring with links! and other stuff');\n       });\n     </file>\n   </example>\n */\nvar ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {\n  return function(scope, element, attr) {\n    element.addClass('ng-binding').data('$binding', attr.ngBindHtml);\n\n    var parsed = $parse(attr.ngBindHtml);\n    function getStringValue() { return (parsed(scope) || '').toString(); }\n\n    scope.$watch(getStringValue, function ngBindHtmlWatchAction(value) {\n      element.html($sce.getTrustedHtml(parsed(scope)) || '');\n    });\n  };\n}];\n\nfunction classDirective(name, selector) {\n  name = 'ngClass' + name;\n  return ['$animate', function($animate) {\n    return {\n      restrict: 'AC',\n      link: function(scope, element, attr) {\n        var oldVal;\n\n        scope.$watch(attr[name], ngClassWatchAction, true);\n\n        attr.$observe('class', function(value) {\n          ngClassWatchAction(scope.$eval(attr[name]));\n        });\n\n\n        if (name !== 'ngClass') {\n          scope.$watch('$index', function($index, old$index) {\n            // jshint bitwise: false\n            var mod = $index & 1;\n            if (mod !== (old$index & 1)) {\n              var classes = arrayClasses(scope.$eval(attr[name]));\n              mod === selector ?\n                addClasses(classes) :\n                removeClasses(classes);\n            }\n          });\n        }\n\n        function addClasses(classes) {\n          var newClasses = digestClassCounts(classes, 1);\n          attr.$addClass(newClasses);\n        }\n\n        function removeClasses(classes) {\n          var newClasses = digestClassCounts(classes, -1);\n          attr.$removeClass(newClasses);\n        }\n\n        function digestClassCounts (classes, count) {\n          var classCounts = element.data('$classCounts') || {};\n          var classesToUpdate = [];\n          forEach(classes, function (className) {\n            if (count > 0 || classCounts[className]) {\n              classCounts[className] = (classCounts[className] || 0) + count;\n              if (classCounts[className] === +(count > 0)) {\n                classesToUpdate.push(className);\n              }\n            }\n          });\n          element.data('$classCounts', classCounts);\n          return classesToUpdate.join(' ');\n        }\n\n        function updateClasses (oldClasses, newClasses) {\n          var toAdd = arrayDifference(newClasses, oldClasses);\n          var toRemove = arrayDifference(oldClasses, newClasses);\n          toRemove = digestClassCounts(toRemove, -1);\n          toAdd = digestClassCounts(toAdd, 1);\n\n          if (toAdd.length === 0) {\n            $animate.removeClass(element, toRemove);\n          } else if (toRemove.length === 0) {\n            $animate.addClass(element, toAdd);\n          } else {\n            $animate.setClass(element, toAdd, toRemove);\n          }\n        }\n\n        function ngClassWatchAction(newVal) {\n          if (selector === true || scope.$index % 2 === selector) {\n            var newClasses = arrayClasses(newVal || []);\n            if (!oldVal) {\n              addClasses(newClasses);\n            } else if (!equals(newVal,oldVal)) {\n              var oldClasses = arrayClasses(oldVal);\n              updateClasses(oldClasses, newClasses);\n            }\n          }\n          oldVal = shallowCopy(newVal);\n        }\n      }\n    };\n\n    function arrayDifference(tokens1, tokens2) {\n      var values = [];\n\n      outer:\n      for(var i = 0; i < tokens1.length; i++) {\n        var token = tokens1[i];\n        for(var j = 0; j < tokens2.length; j++) {\n          if(token == tokens2[j]) continue outer;\n        }\n        values.push(token);\n      }\n      return values;\n    }\n\n    function arrayClasses (classVal) {\n      if (isArray(classVal)) {\n        return classVal;\n      } else if (isString(classVal)) {\n        return classVal.split(' ');\n      } else if (isObject(classVal)) {\n        var classes = [], i = 0;\n        forEach(classVal, function(v, k) {\n          if (v) {\n            classes = classes.concat(k.split(' '));\n          }\n        });\n        return classes;\n      }\n      return classVal;\n    }\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ngClass\n * @restrict AC\n *\n * @description\n * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding\n * an expression that represents all classes to be added.\n *\n * The directive operates in three different ways, depending on which of three types the expression\n * evaluates to:\n *\n * 1. If the expression evaluates to a string, the string should be one or more space-delimited class\n * names.\n *\n * 2. If the expression evaluates to an array, each element of the array should be a string that is\n * one or more space-delimited class names.\n *\n * 3. If the expression evaluates to an object, then for each key-value pair of the\n * object with a truthy value the corresponding key is used as a class name.\n *\n * The directive won't add duplicate classes if a particular class was already set.\n *\n * When the expression changes, the previously added classes are removed and only then the\n * new classes are added.\n *\n * @animations\n * add - happens just before the class is applied to the element\n * remove - happens just before the class is removed from the element\n *\n * @element ANY\n * @param {expression} ngClass {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class\n *   names, an array, or a map of class names to boolean values. In the case of a map, the\n *   names of the properties whose values are truthy will be added as css classes to the\n *   element.\n *\n * @example Example that demonstrates basic bindings via ngClass directive.\n   <example>\n     <file name=\"index.html\">\n       <p ng-class=\"{strike: deleted, bold: important, red: error}\">Map Syntax Example</p>\n       <input type=\"checkbox\" ng-model=\"deleted\"> deleted (apply \"strike\" class)<br>\n       <input type=\"checkbox\" ng-model=\"important\"> important (apply \"bold\" class)<br>\n       <input type=\"checkbox\" ng-model=\"error\"> error (apply \"red\" class)\n       <hr>\n       <p ng-class=\"style\">Using String Syntax</p>\n       <input type=\"text\" ng-model=\"style\" placeholder=\"Type: bold strike red\">\n       <hr>\n       <p ng-class=\"[style1, style2, style3]\">Using Array Syntax</p>\n       <input ng-model=\"style1\" placeholder=\"Type: bold, strike or red\"><br>\n       <input ng-model=\"style2\" placeholder=\"Type: bold, strike or red\"><br>\n       <input ng-model=\"style3\" placeholder=\"Type: bold, strike or red\"><br>\n     </file>\n     <file name=\"style.css\">\n       .strike {\n         text-decoration: line-through;\n       }\n       .bold {\n           font-weight: bold;\n       }\n       .red {\n           color: red;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var ps = element.all(by.css('p'));\n\n       it('should let you toggle the class', function() {\n\n         expect(ps.first().getAttribute('class')).not.toMatch(/bold/);\n         expect(ps.first().getAttribute('class')).not.toMatch(/red/);\n\n         element(by.model('important')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/bold/);\n\n         element(by.model('error')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/red/);\n       });\n\n       it('should let you toggle string example', function() {\n         expect(ps.get(1).getAttribute('class')).toBe('');\n         element(by.model('style')).clear();\n         element(by.model('style')).sendKeys('red');\n         expect(ps.get(1).getAttribute('class')).toBe('red');\n       });\n\n       it('array example should have 3 classes', function() {\n         expect(ps.last().getAttribute('class')).toBe('');\n         element(by.model('style1')).sendKeys('bold');\n         element(by.model('style2')).sendKeys('strike');\n         element(by.model('style3')).sendKeys('red');\n         expect(ps.last().getAttribute('class')).toBe('bold strike red');\n       });\n     </file>\n   </example>\n\n   ## Animations\n\n   The example below demonstrates how to perform animations using ngClass.\n\n   <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n     <file name=\"index.html\">\n      <input id=\"setbtn\" type=\"button\" value=\"set\" ng-click=\"myVar='my-class'\">\n      <input id=\"clearbtn\" type=\"button\" value=\"clear\" ng-click=\"myVar=''\">\n      <br>\n      <span class=\"base-class\" ng-class=\"myVar\">Sample Text</span>\n     </file>\n     <file name=\"style.css\">\n       .base-class {\n         -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n         transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n       }\n\n       .base-class.my-class {\n         color: red;\n         font-size:3em;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class', function() {\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n\n         element(by.id('setbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).\n           toMatch(/my-class/);\n\n         element(by.id('clearbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n       });\n     </file>\n   </example>\n\n\n   ## ngClass and pre-existing CSS3 Transitions/Animations\n   The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.\n   Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder\n   any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure\n   to view the step by step details of {@link ngAnimate.$animate#addclass $animate.addClass} and\n   {@link ngAnimate.$animate#removeclass $animate.removeClass}.\n */\nvar ngClassDirective = classDirective('', true);\n\n/**\n * @ngdoc directive\n * @name ngClassOdd\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}}\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassOddDirective = classDirective('Odd', 0);\n\n/**\n * @ngdoc directive\n * @name ngClassEven\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The\n *   result of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}} &nbsp; &nbsp; &nbsp;\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassEvenDirective = classDirective('Even', 1);\n\n/**\n * @ngdoc directive\n * @name ngCloak\n * @restrict AC\n *\n * @description\n * The `ngCloak` directive is used to prevent the Angular html template from being briefly\n * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this\n * directive to avoid the undesirable flicker effect caused by the html template display.\n *\n * The directive can be applied to the `<body>` element, but the preferred usage is to apply\n * multiple `ngCloak` directives to small portions of the page to permit progressive rendering\n * of the browser view.\n *\n * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and\n * `angular.min.js`.\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```css\n * [ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {\n *   display: none !important;\n * }\n * ```\n *\n * When this css rule is loaded by the browser, all html elements (including their children) that\n * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive\n * during the compilation of the template it deletes the `ngCloak` element attribute, making\n * the compiled element visible.\n *\n * For the best result, the `angular.js` script must be loaded in the head section of the html\n * document; alternatively, the css rule above must be included in the external stylesheet of the\n * application.\n *\n * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they\n * cannot match the `[ng\\:cloak]` selector. To work around this limitation, you must add the css\n * class `ng-cloak` in addition to the `ngCloak` directive as shown in the example below.\n *\n * @element ANY\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <div id=\"template1\" ng-cloak>{{ 'hello' }}</div>\n        <div id=\"template2\" ng-cloak class=\"ng-cloak\">{{ 'hello IE7' }}</div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should remove the template directive and css class', function() {\n         expect($('#template1').getAttribute('ng-cloak')).\n           toBeNull();\n         expect($('#template2').getAttribute('ng-cloak')).\n           toBeNull();\n       });\n     </file>\n   </example>\n *\n */\nvar ngCloakDirective = ngDirective({\n  compile: function(element, attr) {\n    attr.$set('ngCloak', undefined);\n    element.removeClass('ng-cloak');\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngController\n *\n * @description\n * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular\n * supports the principles behind the Model-View-Controller design pattern.\n *\n * MVC components in angular:\n *\n * * Model — The Model is scope properties; scopes are attached to the DOM where scope properties\n *   are accessed through bindings.\n * * View — The template (HTML with data bindings) that is rendered into the View.\n * * Controller — The `ngController` directive specifies a Controller class; the class contains business\n *   logic behind the application to decorate the scope with functions and values\n *\n * Note that you can also attach controllers to the DOM by declaring it in a route definition\n * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller\n * again using `ng-controller` in the template itself.  This will cause the controller to be attached\n * and executed twice.\n *\n * @element ANY\n * @scope\n * @param {expression} ngController Name of a globally accessible constructor function or an\n *     {@link guide/expression expression} that on the current scope evaluates to a\n *     constructor function. The controller instance can be published into a scope property\n *     by specifying `as propertyName`.\n *\n * @example\n * Here is a simple form for editing user contact information. Adding, removing, clearing, and\n * greeting are methods declared on the controller (see source tab). These methods can\n * easily be called from the angular markup. Any changes to the data are automatically reflected\n * in the View without the need for a manual update.\n *\n * Two different declaration styles are included below:\n *\n * * one binds methods and properties directly onto the controller using `this`:\n * `ng-controller=\"SettingsController1 as settings\"`\n * * one injects `$scope` into the controller:\n * `ng-controller=\"SettingsController2\"`\n *\n * The second option is more common in the Angular community, and is generally used in boilerplates\n * and in this guide. However, there are advantages to binding properties directly to the controller\n * and avoiding scope.\n *\n * * Using `controller as` makes it obvious which controller you are accessing in the template when\n * multiple controllers apply to an element.\n * * If you are writing your controllers as classes you have easier access to the properties and\n * methods, which will appear on the scope, from inside the controller code.\n * * Since there is always a `.` in the bindings, you don't have to worry about prototypal\n * inheritance masking primitives.\n *\n * This example demonstrates the `controller as` syntax.\n *\n * <example name=\"ngControllerAs\">\n *   <file name=\"index.html\">\n *    <div id=\"ctrl-as-exmpl\" ng-controller=\"SettingsController1 as settings\">\n *      Name: <input type=\"text\" ng-model=\"settings.name\"/>\n *      [ <a href=\"\" ng-click=\"settings.greet()\">greet</a> ]<br/>\n *      Contact:\n *      <ul>\n *        <li ng-repeat=\"contact in settings.contacts\">\n *          <select ng-model=\"contact.type\">\n *             <option>phone</option>\n *             <option>email</option>\n *          </select>\n *          <input type=\"text\" ng-model=\"contact.value\"/>\n *          [ <a href=\"\" ng-click=\"settings.clearContact(contact)\">clear</a>\n *          | <a href=\"\" ng-click=\"settings.removeContact(contact)\">X</a> ]\n *        </li>\n *        <li>[ <a href=\"\" ng-click=\"settings.addContact()\">add</a> ]</li>\n *     </ul>\n *    </div>\n *   </file>\n *   <file name=\"app.js\">\n *    function SettingsController1() {\n *      this.name = \"John Smith\";\n *      this.contacts = [\n *        {type: 'phone', value: '408 555 1212'},\n *        {type: 'email', value: 'john.smith@example.org'} ];\n *    }\n *\n *    SettingsController1.prototype.greet = function() {\n *      alert(this.name);\n *    };\n *\n *    SettingsController1.prototype.addContact = function() {\n *      this.contacts.push({type: 'email', value: 'yourname@example.org'});\n *    };\n *\n *    SettingsController1.prototype.removeContact = function(contactToRemove) {\n *     var index = this.contacts.indexOf(contactToRemove);\n *      this.contacts.splice(index, 1);\n *    };\n *\n *    SettingsController1.prototype.clearContact = function(contact) {\n *      contact.type = 'phone';\n *      contact.value = '';\n *    };\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it('should check controller as', function() {\n *       var container = element(by.id('ctrl-as-exmpl'));\n *         expect(container.findElement(by.model('settings.name'))\n *           .getAttribute('value')).toBe('John Smith');\n *\n *       var firstRepeat =\n *           container.findElement(by.repeater('contact in settings.contacts').row(0));\n *       var secondRepeat =\n *           container.findElement(by.repeater('contact in settings.contacts').row(1));\n *\n *       expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))\n *           .toBe('408 555 1212');\n *\n *       expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))\n *           .toBe('john.smith@example.org');\n *\n *       firstRepeat.findElement(by.linkText('clear')).click();\n *\n *       expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))\n *           .toBe('');\n *\n *       container.findElement(by.linkText('add')).click();\n *\n *       expect(container.findElement(by.repeater('contact in settings.contacts').row(2))\n *           .findElement(by.model('contact.value'))\n *           .getAttribute('value'))\n *           .toBe('yourname@example.org');\n *     });\n *   </file>\n * </example>\n *\n * This example demonstrates the \"attach to `$scope`\" style of controller.\n *\n * <example name=\"ngController\">\n *  <file name=\"index.html\">\n *   <div id=\"ctrl-exmpl\" ng-controller=\"SettingsController2\">\n *     Name: <input type=\"text\" ng-model=\"name\"/>\n *     [ <a href=\"\" ng-click=\"greet()\">greet</a> ]<br/>\n *     Contact:\n *     <ul>\n *       <li ng-repeat=\"contact in contacts\">\n *         <select ng-model=\"contact.type\">\n *            <option>phone</option>\n *            <option>email</option>\n *         </select>\n *         <input type=\"text\" ng-model=\"contact.value\"/>\n *         [ <a href=\"\" ng-click=\"clearContact(contact)\">clear</a>\n *         | <a href=\"\" ng-click=\"removeContact(contact)\">X</a> ]\n *       </li>\n *       <li>[ <a href=\"\" ng-click=\"addContact()\">add</a> ]</li>\n *    </ul>\n *   </div>\n *  </file>\n *  <file name=\"app.js\">\n *   function SettingsController2($scope) {\n *     $scope.name = \"John Smith\";\n *     $scope.contacts = [\n *       {type:'phone', value:'408 555 1212'},\n *       {type:'email', value:'john.smith@example.org'} ];\n *\n *     $scope.greet = function() {\n *       alert($scope.name);\n *     };\n *\n *     $scope.addContact = function() {\n *       $scope.contacts.push({type:'email', value:'yourname@example.org'});\n *     };\n *\n *     $scope.removeContact = function(contactToRemove) {\n *       var index = $scope.contacts.indexOf(contactToRemove);\n *       $scope.contacts.splice(index, 1);\n *     };\n *\n *     $scope.clearContact = function(contact) {\n *       contact.type = 'phone';\n *       contact.value = '';\n *     };\n *   }\n *  </file>\n *  <file name=\"protractor.js\" type=\"protractor\">\n *    it('should check controller', function() {\n *      var container = element(by.id('ctrl-exmpl'));\n *\n *      expect(container.findElement(by.model('name'))\n *          .getAttribute('value')).toBe('John Smith');\n *\n *      var firstRepeat =\n *          container.findElement(by.repeater('contact in contacts').row(0));\n *      var secondRepeat =\n *          container.findElement(by.repeater('contact in contacts').row(1));\n *\n *      expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))\n *          .toBe('408 555 1212');\n *      expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))\n *          .toBe('john.smith@example.org');\n *\n *      firstRepeat.findElement(by.linkText('clear')).click();\n *\n *      expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))\n *          .toBe('');\n *\n *      container.findElement(by.linkText('add')).click();\n *\n *      expect(container.findElement(by.repeater('contact in contacts').row(2))\n *          .findElement(by.model('contact.value'))\n *          .getAttribute('value'))\n *          .toBe('yourname@example.org');\n *    });\n *  </file>\n *</example>\n\n */\nvar ngControllerDirective = [function() {\n  return {\n    scope: true,\n    controller: '@',\n    priority: 500\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngCsp\n *\n * @element html\n * @description\n * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.\n *\n * This is necessary when developing things like Google Chrome Extensions.\n *\n * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).\n * For us to be compatible, we just need to implement the \"getterFn\" in $parse without violating\n * any of these restrictions.\n *\n * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp`\n * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will\n * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will\n * be raised.\n *\n * CSP forbids JavaScript to inline stylesheet rules. In non CSP mode Angular automatically\n * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}).\n * To make those directives work in CSP mode, include the `angular-csp.css` manually.\n *\n * In order to use this feature put the `ngCsp` directive on the root element of the application.\n *\n * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*\n *\n * @example\n * This example shows how to apply the `ngCsp` directive to the `html` tag.\n   ```html\n     <!doctype html>\n     <html ng-app ng-csp>\n     ...\n     ...\n     </html>\n   ```\n */\n\n// ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap\n// the system (before $parse is instantiated), for this reason we just have a csp() fn that looks for ng-csp attribute\n// anywhere in the current doc\n\n/**\n * @ngdoc directive\n * @name ngClick\n *\n * @description\n * The ngClick directive allows you to specify custom behavior when\n * an element is clicked.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon\n * click. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-click=\"count = count + 1\" ng-init=\"count=0\">\n        Increment\n      </button>\n      count: {{count}}\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-click', function() {\n         expect(element(by.binding('count')).getText()).toMatch('0');\n         element(by.css('button')).click();\n         expect(element(by.binding('count')).getText()).toMatch('1');\n       });\n     </file>\n   </example>\n */\n/*\n * A directive that allows creation of custom onclick handlers that are defined as angular\n * expressions and are compiled and executed within the current scope.\n *\n * Events that are handled via these handler are always configured not to propagate further.\n */\nvar ngEventDirectives = {};\nforEach(\n  'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),\n  function(name) {\n    var directiveName = directiveNormalize('ng-' + name);\n    ngEventDirectives[directiveName] = ['$parse', function($parse) {\n      return {\n        compile: function($element, attr) {\n          var fn = $parse(attr[directiveName]);\n          return function(scope, element, attr) {\n            element.on(lowercase(name), function(event) {\n              scope.$apply(function() {\n                fn(scope, {$event:event});\n              });\n            });\n          };\n        }\n      };\n    }];\n  }\n);\n\n/**\n * @ngdoc directive\n * @name ngDblclick\n *\n * @description\n * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon\n * a dblclick. (The Event object is available as `$event`)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-dblclick=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on double click)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousedown\n *\n * @description\n * The ngMousedown directive allows you to specify custom behavior on mousedown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon\n * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousedown=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse down)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseup\n *\n * @description\n * Specify custom behavior on mouseup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon\n * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseup=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse up)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngMouseover\n *\n * @description\n * Specify custom behavior on mouseover event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon\n * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseover=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse is over)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseenter\n *\n * @description\n * Specify custom behavior on mouseenter event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon\n * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseenter=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse enters)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseleave\n *\n * @description\n * Specify custom behavior on mouseleave event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon\n * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseleave=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse leaves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousemove\n *\n * @description\n * Specify custom behavior on mousemove event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon\n * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousemove=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse moves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeydown\n *\n * @description\n * Specify custom behavior on keydown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon\n * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keydown=\"count = count + 1\" ng-init=\"count=0\">\n      key down count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeyup\n *\n * @description\n * Specify custom behavior on keyup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon\n * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <p>Typing in the input box below updates the key count</p>\n       <input ng-keyup=\"count = count + 1\" ng-init=\"count=0\"> key up count: {{count}}\n\n       <p>Typing in the input box below updates the keycode</p>\n       <input ng-keyup=\"event=$event\">\n       <p>event keyCode: {{ event.keyCode }}</p>\n       <p>event altKey: {{ event.altKey }}</p>\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeypress\n *\n * @description\n * Specify custom behavior on keypress event.\n *\n * @element ANY\n * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon\n * keypress. ({@link guide/expression#-event- Event object is available as `$event`}\n * and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keypress=\"count = count + 1\" ng-init=\"count=0\">\n      key press count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSubmit\n *\n * @description\n * Enables binding angular expressions to onsubmit events.\n *\n * Additionally it prevents the default action (which for form means sending the request to the\n * server and reloading the current page), but only if the form does not contain `action`,\n * `data-action`, or `x-action` attributes.\n *\n * @element form\n * @priority 0\n * @param {expression} ngSubmit {@link guide/expression Expression} to eval.\n * ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <script>\n        function Ctrl($scope) {\n          $scope.list = [];\n          $scope.text = 'hello';\n          $scope.submit = function() {\n            if ($scope.text) {\n              $scope.list.push(this.text);\n              $scope.text = '';\n            }\n          };\n        }\n      </script>\n      <form ng-submit=\"submit()\" ng-controller=\"Ctrl\">\n        Enter text and hit enter:\n        <input type=\"text\" ng-model=\"text\" name=\"text\" />\n        <input type=\"submit\" id=\"submit\" value=\"Submit\" />\n        <pre>list={{list}}</pre>\n      </form>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-submit', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n         expect(element(by.input('text')).getAttribute('value')).toBe('');\n       });\n       it('should ignore empty strings', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n        });\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngFocus\n *\n * @description\n * Specify custom behavior on focus event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon\n * focus. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngBlur\n *\n * @description\n * Specify custom behavior on blur event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon\n * blur. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngCopy\n *\n * @description\n * Specify custom behavior on copy event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon\n * copy. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-copy=\"copied=true\" ng-init=\"copied=false; value='copy me'\" ng-model=\"value\">\n      copied: {{copied}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngCut\n *\n * @description\n * Specify custom behavior on cut event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon\n * cut. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-cut=\"cut=true\" ng-init=\"cut=false; value='cut me'\" ng-model=\"value\">\n      cut: {{cut}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngPaste\n *\n * @description\n * Specify custom behavior on paste event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon\n * paste. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-paste=\"paste=true\" ng-init=\"paste=false\" placeholder='paste here'>\n      pasted: {{paste}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngIf\n * @restrict A\n *\n * @description\n * The `ngIf` directive removes or recreates a portion of the DOM tree based on an\n * {expression}. If the expression assigned to `ngIf` evaluates to a false\n * value then the element is removed from the DOM, otherwise a clone of the\n * element is reinserted into the DOM.\n *\n * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the\n * element in the DOM rather than changing its visibility via the `display` css property.  A common\n * case when this difference is significant is when using css selectors that rely on an element's\n * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.\n *\n * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope\n * is created when the element is restored.  The scope created within `ngIf` inherits from\n * its parent scope using\n * [prototypal inheritance](https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance).\n * An important implication of this is if `ngModel` is used within `ngIf` to bind to\n * a javascript primitive defined in the parent scope. In this case any modifications made to the\n * variable within the child scope will override (hide) the value in the parent scope.\n *\n * Also, `ngIf` recreates elements using their compiled state. An example of this behavior\n * is if an element's class attribute is directly modified after it's compiled, using something like\n * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element\n * the added class will be lost because the original compiled state is used to regenerate the element.\n *\n * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`\n * and `leave` effects.\n *\n * @animations\n * enter - happens just after the ngIf contents change and a new DOM element is created and injected into the ngIf container\n * leave - happens just before the ngIf contents are removed from the DOM\n *\n * @element ANY\n * @scope\n * @priority 600\n * @param {expression} ngIf If the {@link guide/expression expression} is falsy then\n *     the element is removed from the DOM tree. If it is truthy a copy of the compiled\n *     element is added to the DOM tree.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\" ng-init=\"checked=true\" /><br/>\n      Show when checked:\n      <span ng-if=\"checked\" class=\"animate-if\">\n        I'm removed when the checkbox is unchecked.\n      </span>\n    </file>\n    <file name=\"animations.css\">\n      .animate-if {\n        background:white;\n        border:1px solid black;\n        padding:10px;\n      }\n\n      .animate-if.ng-enter, .animate-if.ng-leave {\n        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n      }\n\n      .animate-if.ng-enter,\n      .animate-if.ng-leave.ng-leave-active {\n        opacity:0;\n      }\n\n      .animate-if.ng-leave,\n      .animate-if.ng-enter.ng-enter-active {\n        opacity:1;\n      }\n    </file>\n  </example>\n */\nvar ngIfDirective = ['$animate', function($animate) {\n  return {\n    transclude: 'element',\n    priority: 600,\n    terminal: true,\n    restrict: 'A',\n    $$tlb: true,\n    link: function ($scope, $element, $attr, ctrl, $transclude) {\n        var block, childScope, previousElements;\n        $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {\n\n          if (toBoolean(value)) {\n            if (!childScope) {\n              childScope = $scope.$new();\n              $transclude(childScope, function (clone) {\n                clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block = {\n                  clone: clone\n                };\n                $animate.enter(clone, $element.parent(), $element);\n              });\n            }\n          } else {\n            if(previousElements) {\n              previousElements.remove();\n              previousElements = null;\n            }\n            if(childScope) {\n              childScope.$destroy();\n              childScope = null;\n            }\n            if(block) {\n              previousElements = getBlockElements(block.clone);\n              $animate.leave(previousElements, function() {\n                previousElements = null;\n              });\n              block = null;\n            }\n          }\n        });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngInclude\n * @restrict ECA\n *\n * @description\n * Fetches, compiles and includes an external HTML fragment.\n *\n * By default, the template URL is restricted to the same domain and protocol as the\n * application document. This is done by calling {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols\n * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or\n * [wrap them](ng.$sce#trustAsResourceUrl) as trusted values. Refer to Angular's {@link\n * ng.$sce Strict Contextual Escaping}.\n *\n * In addition, the browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy may further restrict whether the template is successfully loaded.\n * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`\n * access on some browsers.\n *\n * @animations\n * enter - animation is used to bring new content into the browser.\n * leave - animation is used to animate existing content away.\n *\n * The enter and leave animation occur concurrently.\n *\n * @scope\n * @priority 400\n *\n * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,\n *                 make sure you wrap it in **single** quotes, e.g. `src=\"'myPartialTemplate.html'\"`.\n * @param {string=} onload Expression to evaluate when a new partial is loaded.\n *\n * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll\n *                  $anchorScroll} to scroll the viewport after the content is loaded.\n *\n *                  - If the attribute is not set, disable scrolling.\n *                  - If the attribute is set without value, enable scrolling.\n *                  - Otherwise enable scrolling only if the expression evaluates to truthy value.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n     <div ng-controller=\"Ctrl\">\n       <select ng-model=\"template\" ng-options=\"t.name for t in templates\">\n        <option value=\"\">(blank)</option>\n       </select>\n       url of the template: <tt>{{template.url}}</tt>\n       <hr/>\n       <div class=\"slide-animate-container\">\n         <div class=\"slide-animate\" ng-include=\"template.url\"></div>\n       </div>\n     </div>\n    </file>\n    <file name=\"script.js\">\n      function Ctrl($scope) {\n        $scope.templates =\n          [ { name: 'template1.html', url: 'template1.html'},\n            { name: 'template2.html', url: 'template2.html'} ];\n        $scope.template = $scope.templates[0];\n      }\n     </file>\n    <file name=\"template1.html\">\n      Content of template1.html\n    </file>\n    <file name=\"template2.html\">\n      Content of template2.html\n    </file>\n    <file name=\"animations.css\">\n      .slide-animate-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .slide-animate {\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter, .slide-animate.ng-leave {\n        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n        display:block;\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter {\n        top:-50px;\n      }\n      .slide-animate.ng-enter.ng-enter-active {\n        top:0;\n      }\n\n      .slide-animate.ng-leave {\n        top:0;\n      }\n      .slide-animate.ng-leave.ng-leave-active {\n        top:50px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var templateSelect = element(by.model('template'));\n      var includeElem = element(by.css('[ng-include]'));\n\n      it('should load template1.html', function() {\n        expect(includeElem.getText()).toMatch(/Content of template1.html/);\n      });\n\n      it('should load template2.html', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          // See https://github.com/angular/protractor/issues/480\n          return;\n        }\n        templateSelect.click();\n        templateSelect.element.all(by.css('option')).get(2).click();\n        expect(includeElem.getText()).toMatch(/Content of template2.html/);\n      });\n\n      it('should change to blank', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          return;\n        }\n        templateSelect.click();\n        templateSelect.element.all(by.css('option')).get(0).click();\n        expect(includeElem.isPresent()).toBe(false);\n      });\n    </file>\n  </example>\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentRequested\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted every time the ngInclude content is requested.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentLoaded\n * @eventType emit on the current ngInclude scope\n * @description\n * Emitted every time the ngInclude content is reloaded.\n */\nvar ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$animate', '$sce',\n                  function($http,   $templateCache,   $anchorScroll,   $animate,   $sce) {\n  return {\n    restrict: 'ECA',\n    priority: 400,\n    terminal: true,\n    transclude: 'element',\n    controller: angular.noop,\n    compile: function(element, attr) {\n      var srcExp = attr.ngInclude || attr.src,\n          onloadExp = attr.onload || '',\n          autoScrollExp = attr.autoscroll;\n\n      return function(scope, $element, $attr, ctrl, $transclude) {\n        var changeCounter = 0,\n            currentScope,\n            previousElement,\n            currentElement;\n\n        var cleanupLastIncludeContent = function() {\n          if(previousElement) {\n            previousElement.remove();\n            previousElement = null;\n          }\n          if(currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n          if(currentElement) {\n            $animate.leave(currentElement, function() {\n              previousElement = null;\n            });\n            previousElement = currentElement;\n            currentElement = null;\n          }\n        };\n\n        scope.$watch($sce.parseAsResourceUrl(srcExp), function ngIncludeWatchAction(src) {\n          var afterAnimation = function() {\n            if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {\n              $anchorScroll();\n            }\n          };\n          var thisChangeId = ++changeCounter;\n\n          if (src) {\n            $http.get(src, {cache: $templateCache}).success(function(response) {\n              if (thisChangeId !== changeCounter) return;\n              var newScope = scope.$new();\n              ctrl.template = response;\n\n              // Note: This will also link all children of ng-include that were contained in the original\n              // html. If that content contains controllers, ... they could pollute/change the scope.\n              // However, using ng-include on an element with additional content does not make sense...\n              // Note: We can't remove them in the cloneAttchFn of $transclude as that\n              // function is called before linking the content, which would apply child\n              // directives to non existing elements.\n              var clone = $transclude(newScope, function(clone) {\n                cleanupLastIncludeContent();\n                $animate.enter(clone, null, $element, afterAnimation);\n              });\n\n              currentScope = newScope;\n              currentElement = clone;\n\n              currentScope.$emit('$includeContentLoaded');\n              scope.$eval(onloadExp);\n            }).error(function() {\n              if (thisChangeId === changeCounter) cleanupLastIncludeContent();\n            });\n            scope.$emit('$includeContentRequested');\n          } else {\n            cleanupLastIncludeContent();\n            ctrl.template = null;\n          }\n        });\n      };\n    }\n  };\n}];\n\n// This directive is called during the $transclude call of the first `ngInclude` directive.\n// It will replace and compile the content of the element with the loaded template.\n// We need this directive so that the element content is already filled when\n// the link function of another directive on the same element as ngInclude\n// is called.\nvar ngIncludeFillContentDirective = ['$compile',\n  function($compile) {\n    return {\n      restrict: 'ECA',\n      priority: -400,\n      require: 'ngInclude',\n      link: function(scope, $element, $attr, ctrl) {\n        $element.html(ctrl.template);\n        $compile($element.contents())(scope);\n      }\n    };\n  }];\n\n/**\n * @ngdoc directive\n * @name ngInit\n * @restrict AC\n *\n * @description\n * The `ngInit` directive allows you to evaluate an expression in the\n * current scope.\n *\n * <div class=\"alert alert-error\">\n * The only appropriate use of `ngInit` is for aliasing special properties of\n * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you\n * should use {@link guide/controller controllers} rather than `ngInit`\n * to initialize values on a scope.\n * </div>\n * <div class=\"alert alert-warning\">\n * **Note**: If you have assignment in `ngInit` along with {@link ng.$filter `$filter`}, make\n * sure you have parenthesis for correct precedence:\n * <pre class=\"prettyprint\">\n *   <div ng-init=\"test1 = (data | orderBy:'name')\"></div>\n * </pre>\n * </div>\n *\n * @priority 450\n *\n * @element ANY\n * @param {expression} ngInit {@link guide/expression Expression} to eval.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n   <script>\n     function Ctrl($scope) {\n       $scope.list = [['a', 'b'], ['c', 'd']];\n     }\n   </script>\n   <div ng-controller=\"Ctrl\">\n     <div ng-repeat=\"innerList in list\" ng-init=\"outerIndex = $index\">\n       <div ng-repeat=\"value in innerList\" ng-init=\"innerIndex = $index\">\n          <span class=\"example-init\">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>\n       </div>\n     </div>\n   </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should alias index positions', function() {\n         var elements = element.all(by.css('.example-init'));\n         expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');\n         expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');\n         expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');\n         expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');\n       });\n     </file>\n   </example>\n */\nvar ngInitDirective = ngDirective({\n  priority: 450,\n  compile: function() {\n    return {\n      pre: function(scope, element, attrs) {\n        scope.$eval(attrs.ngInit);\n      }\n    };\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngNonBindable\n * @restrict AC\n * @priority 1000\n *\n * @description\n * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current\n * DOM element. This is useful if the element contains what appears to be Angular directives and\n * bindings but which should be ignored by Angular. This could be the case if you have a site that\n * displays snippets of code, for instance.\n *\n * @element ANY\n *\n * @example\n * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,\n * but the one wrapped in `ngNonBindable` is left alone.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <div>Normal: {{1 + 2}}</div>\n        <div ng-non-bindable>Ignored: {{1 + 2}}</div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-non-bindable', function() {\n         expect(element(by.binding('1 + 2')).getText()).toContain('3');\n         expect(element.all(by.css('div')).last().getText()).toMatch(/1 \\+ 2/);\n       });\n      </file>\n    </example>\n */\nvar ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });\n\n/**\n * @ngdoc directive\n * @name ngPluralize\n * @restrict EA\n *\n * @description\n * `ngPluralize` is a directive that displays messages according to en-US localization rules.\n * These rules are bundled with angular.js, but can be overridden\n * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive\n * by specifying the mappings between\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * and the strings to be displayed.\n *\n * # Plural categories and explicit number rules\n * There are two\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * in Angular's default en-US locale: \"one\" and \"other\".\n *\n * While a plural category may match many numbers (for example, in en-US locale, \"other\" can match\n * any number that is not 1), an explicit number rule can only match one number. For example, the\n * explicit number rule for \"3\" matches the number 3. There are examples of plural categories\n * and explicit number rules throughout the rest of this documentation.\n *\n * # Configuring ngPluralize\n * You configure ngPluralize by providing 2 attributes: `count` and `when`.\n * You can also provide an optional attribute, `offset`.\n *\n * The value of the `count` attribute can be either a string or an {@link guide/expression\n * Angular expression}; these are evaluated on the current scope for its bound value.\n *\n * The `when` attribute specifies the mappings between plural categories and the actual\n * string to be displayed. The value of the attribute should be a JSON object.\n *\n * The following example shows how to configure ngPluralize:\n *\n * ```html\n * <ng-pluralize count=\"personCount\"\n                 when=\"{'0': 'Nobody is viewing.',\n *                      'one': '1 person is viewing.',\n *                      'other': '{} people are viewing.'}\">\n * </ng-pluralize>\n *```\n *\n * In the example, `\"0: Nobody is viewing.\"` is an explicit number rule. If you did not\n * specify this rule, 0 would be matched to the \"other\" category and \"0 people are viewing\"\n * would be shown instead of \"Nobody is viewing\". You can specify an explicit number rule for\n * other numbers, for example 12, so that instead of showing \"12 people are viewing\", you can\n * show \"a dozen people are viewing\".\n *\n * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted\n * into pluralized strings. In the previous example, Angular will replace `{}` with\n * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder\n * for <span ng-non-bindable>{{numberExpression}}</span>.\n *\n * # Configuring ngPluralize with offset\n * The `offset` attribute allows further customization of pluralized text, which can result in\n * a better user experience. For example, instead of the message \"4 people are viewing this document\",\n * you might display \"John, Kate and 2 others are viewing this document\".\n * The offset attribute allows you to offset a number by any desired value.\n * Let's take a look at an example:\n *\n * ```html\n * <ng-pluralize count=\"personCount\" offset=2\n *               when=\"{'0': 'Nobody is viewing.',\n *                      '1': '{{person1}} is viewing.',\n *                      '2': '{{person1}} and {{person2}} are viewing.',\n *                      'one': '{{person1}}, {{person2}} and one other person are viewing.',\n *                      'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n * </ng-pluralize>\n * ```\n *\n * Notice that we are still using two plural categories(one, other), but we added\n * three explicit number rules 0, 1 and 2.\n * When one person, perhaps John, views the document, \"John is viewing\" will be shown.\n * When three people view the document, no explicit number rule is found, so\n * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.\n * In this case, plural category 'one' is matched and \"John, Marry and one other person are viewing\"\n * is shown.\n *\n * Note that when you specify offsets, you must provide explicit number rules for\n * numbers from 0 up to and including the offset. If you use an offset of 3, for example,\n * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for\n * plural categories \"one\" and \"other\".\n *\n * @param {string|expression} count The variable to be bound to.\n * @param {string} when The mapping between plural category to its corresponding strings.\n * @param {number=} offset Offset to deduct from the total number.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <script>\n          function Ctrl($scope) {\n            $scope.person1 = 'Igor';\n            $scope.person2 = 'Misko';\n            $scope.personCount = 1;\n          }\n        </script>\n        <div ng-controller=\"Ctrl\">\n          Person 1:<input type=\"text\" ng-model=\"person1\" value=\"Igor\" /><br/>\n          Person 2:<input type=\"text\" ng-model=\"person2\" value=\"Misko\" /><br/>\n          Number of People:<input type=\"text\" ng-model=\"personCount\" value=\"1\" /><br/>\n\n          <!--- Example with simple pluralization rules for en locale --->\n          Without Offset:\n          <ng-pluralize count=\"personCount\"\n                        when=\"{'0': 'Nobody is viewing.',\n                               'one': '1 person is viewing.',\n                               'other': '{} people are viewing.'}\">\n          </ng-pluralize><br>\n\n          <!--- Example with offset --->\n          With Offset(2):\n          <ng-pluralize count=\"personCount\" offset=2\n                        when=\"{'0': 'Nobody is viewing.',\n                               '1': '{{person1}} is viewing.',\n                               '2': '{{person1}} and {{person2}} are viewing.',\n                               'one': '{{person1}}, {{person2}} and one other person are viewing.',\n                               'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n          </ng-pluralize>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should show correct pluralized string', function() {\n          var withoutOffset = element.all(by.css('ng-pluralize')).get(0);\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var countInput = element(by.model('personCount'));\n\n          expect(withoutOffset.getText()).toEqual('1 person is viewing.');\n          expect(withOffset.getText()).toEqual('Igor is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('0');\n\n          expect(withoutOffset.getText()).toEqual('Nobody is viewing.');\n          expect(withOffset.getText()).toEqual('Nobody is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('2');\n\n          expect(withoutOffset.getText()).toEqual('2 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('3');\n\n          expect(withoutOffset.getText()).toEqual('3 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('4');\n\n          expect(withoutOffset.getText()).toEqual('4 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');\n        });\n        it('should show data-bound names', function() {\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var personCount = element(by.model('personCount'));\n          var person1 = element(by.model('person1'));\n          var person2 = element(by.model('person2'));\n          personCount.clear();\n          personCount.sendKeys('4');\n          person1.clear();\n          person1.sendKeys('Di');\n          person2.clear();\n          person2.sendKeys('Vojta');\n          expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');\n        });\n      </file>\n    </example>\n */\nvar ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) {\n  var BRACE = /{}/g;\n  return {\n    restrict: 'EA',\n    link: function(scope, element, attr) {\n      var numberExp = attr.count,\n          whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs\n          offset = attr.offset || 0,\n          whens = scope.$eval(whenExp) || {},\n          whensExpFns = {},\n          startSymbol = $interpolate.startSymbol(),\n          endSymbol = $interpolate.endSymbol(),\n          isWhen = /^when(Minus)?(.+)$/;\n\n      forEach(attr, function(expression, attributeName) {\n        if (isWhen.test(attributeName)) {\n          whens[lowercase(attributeName.replace('when', '').replace('Minus', '-'))] =\n            element.attr(attr.$attr[attributeName]);\n        }\n      });\n      forEach(whens, function(expression, key) {\n        whensExpFns[key] =\n          $interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +\n            offset + endSymbol));\n      });\n\n      scope.$watch(function ngPluralizeWatch() {\n        var value = parseFloat(scope.$eval(numberExp));\n\n        if (!isNaN(value)) {\n          //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise,\n          //check it against pluralization rules in $locale service\n          if (!(value in whens)) value = $locale.pluralCat(value - offset);\n           return whensExpFns[value](scope, element, true);\n        } else {\n          return '';\n        }\n      }, function ngPluralizeWatchAction(newVal) {\n        element.text(newVal);\n      });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngRepeat\n *\n * @description\n * The `ngRepeat` directive instantiates a template once per item from a collection. Each template\n * instance gets its own scope, where the given loop variable is set to the current collection item,\n * and `$index` is set to the item index or key.\n *\n * Special properties are exposed on the local scope of each template instance, including:\n *\n * | Variable  | Type            | Details                                                                     |\n * |-----------|-----------------|-----------------------------------------------------------------------------|\n * | `$index`  | {@type number}  | iterator offset of the repeated element (0..length-1)                       |\n * | `$first`  | {@type boolean} | true if the repeated element is first in the iterator.                      |\n * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |\n * | `$last`   | {@type boolean} | true if the repeated element is last in the iterator.                       |\n * | `$even`   | {@type boolean} | true if the iterator position `$index` is even (otherwise false).           |\n * | `$odd`    | {@type boolean} | true if the iterator position `$index` is odd (otherwise false).            |\n *\n * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.\n * This may be useful when, for instance, nesting ngRepeats.\n *\n * # Special repeat start and end points\n * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending\n * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.\n * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)\n * up to and including the ending HTML tag where **ng-repeat-end** is placed.\n *\n * The example below makes use of this feature:\n * ```html\n *   <header ng-repeat-start=\"item in items\">\n *     Header {{ item }}\n *   </header>\n *   <div class=\"body\">\n *     Body {{ item }}\n *   </div>\n *   <footer ng-repeat-end>\n *     Footer {{ item }}\n *   </footer>\n * ```\n *\n * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:\n * ```html\n *   <header>\n *     Header A\n *   </header>\n *   <div class=\"body\">\n *     Body A\n *   </div>\n *   <footer>\n *     Footer A\n *   </footer>\n *   <header>\n *     Header B\n *   </header>\n *   <div class=\"body\">\n *     Body B\n *   </div>\n *   <footer>\n *     Footer B\n *   </footer>\n * ```\n *\n * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such\n * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).\n *\n * @animations\n * **.enter** - when a new item is added to the list or when an item is revealed after a filter\n *\n * **.leave** - when an item is removed from the list or when an item is filtered out\n *\n * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered\n *\n * @element ANY\n * @scope\n * @priority 1000\n * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These\n *   formats are currently supported:\n *\n *   * `variable in expression` – where variable is the user defined loop variable and `expression`\n *     is a scope expression giving the collection to enumerate.\n *\n *     For example: `album in artist.albums`.\n *\n *   * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,\n *     and `expression` is the scope expression giving the collection to enumerate.\n *\n *     For example: `(name, age) in {'adam':10, 'amalie':12}`.\n *\n *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking function\n *     which can be used to associate the objects in the collection with the DOM elements. If no tracking function\n *     is specified the ng-repeat associates elements by identity in the collection. It is an error to have\n *     more than one tracking function to resolve to the same key. (This would mean that two distinct objects are\n *     mapped to the same DOM element, which is not possible.)  Filters should be applied to the expression,\n *     before specifying a tracking expression.\n *\n *     For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements\n *     will be associated by item identity in the array.\n *\n *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique\n *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements\n *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM\n *     element in the same way in the DOM.\n *\n *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this\n *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`\n *     property is same.\n *\n *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter\n *     to items in conjunction with a tracking expression.\n *\n * @example\n * This example initializes the scope to a list of names and\n * then uses `ngRepeat` to display every person:\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-init=\"friends = [\n        {name:'John', age:25, gender:'boy'},\n        {name:'Jessie', age:30, gender:'girl'},\n        {name:'Johanna', age:28, gender:'girl'},\n        {name:'Joy', age:15, gender:'girl'},\n        {name:'Mary', age:28, gender:'girl'},\n        {name:'Peter', age:95, gender:'boy'},\n        {name:'Sebastian', age:50, gender:'boy'},\n        {name:'Erika', age:27, gender:'girl'},\n        {name:'Patrick', age:40, gender:'boy'},\n        {name:'Samantha', age:60, gender:'girl'}\n      ]\">\n        I have {{friends.length}} friends. They are:\n        <input type=\"search\" ng-model=\"q\" placeholder=\"filter friends...\" />\n        <ul class=\"example-animate-container\">\n          <li class=\"animate-repeat\" ng-repeat=\"friend in friends | filter:q\">\n            [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.\n          </li>\n        </ul>\n      </div>\n    </file>\n    <file name=\"animations.css\">\n      .example-animate-container {\n        background:white;\n        border:1px solid black;\n        list-style:none;\n        margin:0;\n        padding:0 10px;\n      }\n\n      .animate-repeat {\n        line-height:40px;\n        list-style:none;\n        box-sizing:border-box;\n      }\n\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter,\n      .animate-repeat.ng-leave {\n        -webkit-transition:all linear 0.5s;\n        transition:all linear 0.5s;\n      }\n\n      .animate-repeat.ng-leave.ng-leave-active,\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter {\n        opacity:0;\n        max-height:0;\n      }\n\n      .animate-repeat.ng-leave,\n      .animate-repeat.ng-move.ng-move-active,\n      .animate-repeat.ng-enter.ng-enter-active {\n        opacity:1;\n        max-height:40px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var friends = element.all(by.repeater('friend in friends'));\n\n      it('should render initial data set', function() {\n        expect(friends.count()).toBe(10);\n        expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');\n        expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');\n        expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');\n        expect(element(by.binding('friends.length')).getText())\n            .toMatch(\"I have 10 friends. They are:\");\n      });\n\n       it('should update repeater when filter predicate changes', function() {\n         expect(friends.count()).toBe(10);\n\n         element(by.model('q')).sendKeys('ma');\n\n         expect(friends.count()).toBe(2);\n         expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');\n         expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');\n       });\n      </file>\n    </example>\n */\nvar ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {\n  var NG_REMOVED = '$$NG_REMOVED';\n  var ngRepeatMinErr = minErr('ngRepeat');\n  return {\n    transclude: 'element',\n    priority: 1000,\n    terminal: true,\n    $$tlb: true,\n    link: function($scope, $element, $attr, ctrl, $transclude){\n        var expression = $attr.ngRepeat;\n        var match = expression.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/),\n          trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn,\n          lhs, rhs, valueIdentifier, keyIdentifier,\n          hashFnLocals = {$id: hashKey};\n\n        if (!match) {\n          throw ngRepeatMinErr('iexp', \"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.\",\n            expression);\n        }\n\n        lhs = match[1];\n        rhs = match[2];\n        trackByExp = match[3];\n\n        if (trackByExp) {\n          trackByExpGetter = $parse(trackByExp);\n          trackByIdExpFn = function(key, value, index) {\n            // assign key, value, and $index to the locals so that they can be used in hash functions\n            if (keyIdentifier) hashFnLocals[keyIdentifier] = key;\n            hashFnLocals[valueIdentifier] = value;\n            hashFnLocals.$index = index;\n            return trackByExpGetter($scope, hashFnLocals);\n          };\n        } else {\n          trackByIdArrayFn = function(key, value) {\n            return hashKey(value);\n          };\n          trackByIdObjFn = function(key) {\n            return key;\n          };\n        }\n\n        match = lhs.match(/^(?:([\\$\\w]+)|\\(([\\$\\w]+)\\s*,\\s*([\\$\\w]+)\\))$/);\n        if (!match) {\n          throw ngRepeatMinErr('iidexp', \"'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.\",\n                                                                    lhs);\n        }\n        valueIdentifier = match[3] || match[1];\n        keyIdentifier = match[2];\n\n        // Store a list of elements from previous run. This is a hash where key is the item from the\n        // iterator, and the value is objects with following properties.\n        //   - scope: bound scope\n        //   - element: previous element.\n        //   - index: position\n        var lastBlockMap = {};\n\n        //watch props\n        $scope.$watchCollection(rhs, function ngRepeatAction(collection){\n          var index, length,\n              previousNode = $element[0],     // current position of the node\n              nextNode,\n              // Same as lastBlockMap but it has the current state. It will become the\n              // lastBlockMap on the next iteration.\n              nextBlockMap = {},\n              arrayLength,\n              childScope,\n              key, value, // key/value of iteration\n              trackById,\n              trackByIdFn,\n              collectionKeys,\n              block,       // last object information {scope, element, id}\n              nextBlockOrder = [],\n              elementsToRemove;\n\n\n          if (isArrayLike(collection)) {\n            collectionKeys = collection;\n            trackByIdFn = trackByIdExpFn || trackByIdArrayFn;\n          } else {\n            trackByIdFn = trackByIdExpFn || trackByIdObjFn;\n            // if object, extract keys, sort them and use to determine order of iteration over obj props\n            collectionKeys = [];\n            for (key in collection) {\n              if (collection.hasOwnProperty(key) && key.charAt(0) != '$') {\n                collectionKeys.push(key);\n              }\n            }\n            collectionKeys.sort();\n          }\n\n          arrayLength = collectionKeys.length;\n\n          // locate existing items\n          length = nextBlockOrder.length = collectionKeys.length;\n          for(index = 0; index < length; index++) {\n           key = (collection === collectionKeys) ? index : collectionKeys[index];\n           value = collection[key];\n           trackById = trackByIdFn(key, value, index);\n           assertNotHasOwnProperty(trackById, '`track by` id');\n           if(lastBlockMap.hasOwnProperty(trackById)) {\n             block = lastBlockMap[trackById];\n             delete lastBlockMap[trackById];\n             nextBlockMap[trackById] = block;\n             nextBlockOrder[index] = block;\n           } else if (nextBlockMap.hasOwnProperty(trackById)) {\n             // restore lastBlockMap\n             forEach(nextBlockOrder, function(block) {\n               if (block && block.scope) lastBlockMap[block.id] = block;\n             });\n             // This is a duplicate and we need to throw an error\n             throw ngRepeatMinErr('dupes', \"Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}\",\n                                                                                                                                                    expression,       trackById);\n           } else {\n             // new never before seen block\n             nextBlockOrder[index] = { id: trackById };\n             nextBlockMap[trackById] = false;\n           }\n         }\n\n          // remove existing items\n          for (key in lastBlockMap) {\n            // lastBlockMap is our own object so we don't need to use special hasOwnPropertyFn\n            if (lastBlockMap.hasOwnProperty(key)) {\n              block = lastBlockMap[key];\n              elementsToRemove = getBlockElements(block.clone);\n              $animate.leave(elementsToRemove);\n              forEach(elementsToRemove, function(element) { element[NG_REMOVED] = true; });\n              block.scope.$destroy();\n            }\n          }\n\n          // we are not using forEach for perf reasons (trying to avoid #call)\n          for (index = 0, length = collectionKeys.length; index < length; index++) {\n            key = (collection === collectionKeys) ? index : collectionKeys[index];\n            value = collection[key];\n            block = nextBlockOrder[index];\n            if (nextBlockOrder[index - 1]) previousNode = getBlockEnd(nextBlockOrder[index - 1]);\n\n            if (block.scope) {\n              // if we have already seen this object, then we need to reuse the\n              // associated scope/element\n              childScope = block.scope;\n\n              nextNode = previousNode;\n              do {\n                nextNode = nextNode.nextSibling;\n              } while(nextNode && nextNode[NG_REMOVED]);\n\n              if (getBlockStart(block) != nextNode) {\n                // existing item which got moved\n                $animate.move(getBlockElements(block.clone), null, jqLite(previousNode));\n              }\n              previousNode = getBlockEnd(block);\n            } else {\n              // new item which we don't know about\n              childScope = $scope.$new();\n            }\n\n            childScope[valueIdentifier] = value;\n            if (keyIdentifier) childScope[keyIdentifier] = key;\n            childScope.$index = index;\n            childScope.$first = (index === 0);\n            childScope.$last = (index === (arrayLength - 1));\n            childScope.$middle = !(childScope.$first || childScope.$last);\n            // jshint bitwise: false\n            childScope.$odd = !(childScope.$even = (index&1) === 0);\n            // jshint bitwise: true\n\n            if (!block.scope) {\n              $transclude(childScope, function(clone) {\n                clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' ');\n                $animate.enter(clone, null, jqLite(previousNode));\n                previousNode = clone;\n                block.scope = childScope;\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block.clone = clone;\n                nextBlockMap[block.id] = block;\n              });\n            }\n          }\n          lastBlockMap = nextBlockMap;\n        });\n    }\n  };\n\n  function getBlockStart(block) {\n    return block.clone[0];\n  }\n\n  function getBlockEnd(block) {\n    return block.clone[block.clone.length - 1];\n  }\n}];\n\n/**\n * @ngdoc directive\n * @name ngShow\n *\n * @description\n * The `ngShow` directive shows or hides the given HTML element based on the expression\n * provided to the ngShow attribute. The element is shown or hidden by removing or adding\n * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is visible) -->\n * <div ng-show=\"myValue\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is hidden) -->\n * <div ng-show=\"myValue\" class=\"ng-hide\"></div>\n * ```\n *\n * When the ngShow expression evaluates to false then the ng-hide CSS class is added to the class attribute\n * on the element causing it to become hidden. When true, the ng-hide CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Here is a list of values that ngShow will consider as a falsy value (case insensitive):<br />\n * \"f\" / \"0\" / \"false\" / \"no\" / \"n\" / \"[]\"\n * </div>\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding .ng-hide\n *\n * By default, the `.ng-hide` class will style the element with `display:none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class in CSS:\n *\n * ```css\n * .ng-hide {\n *   //this is just another form of hiding an element\n *   display:block!important;\n *   position:absolute;\n *   top:-9999px;\n *   left:-9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with ngShow\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass except that\n * you must also include the !important flag to override the display property\n * so that you can perform an animation when the element is hidden during the time of the animation.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   transition:0.5s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.2.17 (and 1.3.0-beta.11), there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * addClass: .ng-hide - happens after the ngShow expression evaluates to a truthy value and the just before contents are set to visible\n * removeClass: .ng-hide - happens after the ngShow expression evaluates to a non truthy value and just before the contents are set to hidden\n *\n * @element ANY\n * @param {expression} ngShow If the {@link guide/expression expression} is truthy\n *     then the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-show\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-show\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-show {\n        -webkit-transition:all linear 0.5s;\n        transition:all linear 0.5s;\n        line-height:20px;\n        opacity:1;\n        padding:10px;\n        border:1px solid black;\n        background:white;\n      }\n\n      .animate-show.ng-hide {\n        line-height:0;\n        opacity:0;\n        padding:0 10px;\n      }\n\n      .check-element {\n        padding:10px;\n        border:1px solid black;\n        background:white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngShowDirective = ['$animate', function($animate) {\n  return function(scope, element, attr) {\n    scope.$watch(attr.ngShow, function ngShowWatchAction(value){\n      $animate[toBoolean(value) ? 'removeClass' : 'addClass'](element, 'ng-hide');\n    });\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngHide\n *\n * @description\n * The `ngHide` directive shows or hides the given HTML element based on the expression\n * provided to the ngHide attribute. The element is shown or hidden by removing or adding\n * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is hidden) -->\n * <div ng-hide=\"myValue\" class=\"ng-hide\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is visible) -->\n * <div ng-hide=\"myValue\"></div>\n * ```\n *\n * When the ngHide expression evaluates to true then the .ng-hide CSS class is added to the class attribute\n * on the element causing it to become hidden. When false, the ng-hide CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Here is a list of values that ngHide will consider as a falsy value (case insensitive):<br />\n * \"f\" / \"0\" / \"false\" / \"no\" / \"n\" / \"[]\"\n * </div>\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding .ng-hide\n *\n * By default, the `.ng-hide` class will style the element with `display:none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class in CSS:\n *\n * ```css\n * .ng-hide {\n *   //this is just another form of hiding an element\n *   display:block!important;\n *   position:absolute;\n *   top:-9999px;\n *   left:-9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with ngHide\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`\n * CSS class is added and removed for you instead of your own CSS class.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   transition:0.5s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.2.17 (and 1.3.0-beta.11), there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * removeClass: .ng-hide - happens after the ngHide expression evaluates to a truthy value and just before the contents are set to hidden\n * addClass: .ng-hide - happens after the ngHide expression evaluates to a non truthy value and just before the contents are set to visible\n *\n * @element ANY\n * @param {expression} ngHide If the {@link guide/expression expression} is truthy then\n *     the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-hide\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-hide\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-hide {\n        -webkit-transition:all linear 0.5s;\n        transition:all linear 0.5s;\n        line-height:20px;\n        opacity:1;\n        padding:10px;\n        border:1px solid black;\n        background:white;\n      }\n\n      .animate-hide.ng-hide {\n        line-height:0;\n        opacity:0;\n        padding:0 10px;\n      }\n\n      .check-element {\n        padding:10px;\n        border:1px solid black;\n        background:white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngHideDirective = ['$animate', function($animate) {\n  return function(scope, element, attr) {\n    scope.$watch(attr.ngHide, function ngHideWatchAction(value){\n      $animate[toBoolean(value) ? 'addClass' : 'removeClass'](element, 'ng-hide');\n    });\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngStyle\n * @restrict AC\n *\n * @description\n * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.\n *\n * @element ANY\n * @param {expression} ngStyle\n *\n * {@link guide/expression Expression} which evals to an\n * object whose keys are CSS style names and values are corresponding values for those CSS\n * keys.\n *\n * Since some CSS style names are not valid keys for an object, they must be quoted.\n * See the 'background-color' style in the example below.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <input type=\"button\" value=\"set color\" ng-click=\"myStyle={color:'red'}\">\n        <input type=\"button\" value=\"set background\" ng-click=\"myStyle={'background-color':'blue'}\">\n        <input type=\"button\" value=\"clear\" ng-click=\"myStyle={}\">\n        <br/>\n        <span ng-style=\"myStyle\">Sample Text</span>\n        <pre>myStyle={{myStyle}}</pre>\n     </file>\n     <file name=\"style.css\">\n       span {\n         color: black;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var colorSpan = element(by.css('span'));\n\n       iit('should check ng-style', function() {\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n         element(by.css('input[value=\\'set color\\']')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');\n         element(by.css('input[value=clear]')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n       });\n     </file>\n   </example>\n */\nvar ngStyleDirective = ngDirective(function(scope, element, attr) {\n  scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {\n    if (oldStyles && (newStyles !== oldStyles)) {\n      forEach(oldStyles, function(val, style) { element.css(style, '');});\n    }\n    if (newStyles) element.css(newStyles);\n  }, true);\n});\n\n/**\n * @ngdoc directive\n * @name ngSwitch\n * @restrict EA\n *\n * @description\n * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.\n * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location\n * as specified in the template.\n *\n * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it\n * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element\n * matches the value obtained from the evaluated expression. In other words, you define a container element\n * (where you place the directive), place an expression on the **`on=\"...\"` attribute**\n * (or the **`ng-switch=\"...\"` attribute**), define any inner elements inside of the directive and place\n * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on\n * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default\n * attribute is displayed.\n *\n * <div class=\"alert alert-info\">\n * Be aware that the attribute values to match against cannot be expressions. They are interpreted\n * as literal string values to match against.\n * For example, **`ng-switch-when=\"someVal\"`** will match against the string `\"someVal\"` not against the\n * value of the expression `$scope.someVal`.\n * </div>\n\n * @animations\n * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container\n * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM\n *\n * @usage\n *\n * ```\n * <ANY ng-switch=\"expression\">\n *   <ANY ng-switch-when=\"matchValue1\">...</ANY>\n *   <ANY ng-switch-when=\"matchValue2\">...</ANY>\n *   <ANY ng-switch-default>...</ANY>\n * </ANY>\n * ```\n *\n *\n * @scope\n * @priority 800\n * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.\n * On child elements add:\n *\n * * `ngSwitchWhen`: the case statement to match against. If match then this\n *   case will be displayed. If the same match appears multiple times, all the\n *   elements will be displayed.\n * * `ngSwitchDefault`: the default case when no other case match. If there\n *   are multiple default cases, all of them will be displayed when no other\n *   case match.\n *\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-controller=\"Ctrl\">\n        <select ng-model=\"selection\" ng-options=\"item for item in items\">\n        </select>\n        <tt>selection={{selection}}</tt>\n        <hr/>\n        <div class=\"animate-switch-container\"\n          ng-switch on=\"selection\">\n            <div class=\"animate-switch\" ng-switch-when=\"settings\">Settings Div</div>\n            <div class=\"animate-switch\" ng-switch-when=\"home\">Home Span</div>\n            <div class=\"animate-switch\" ng-switch-default>default</div>\n        </div>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      function Ctrl($scope) {\n        $scope.items = ['settings', 'home', 'other'];\n        $scope.selection = $scope.items[0];\n      }\n    </file>\n    <file name=\"animations.css\">\n      .animate-switch-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .animate-switch {\n        padding:10px;\n      }\n\n      .animate-switch.ng-animate {\n        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n      }\n\n      .animate-switch.ng-leave.ng-leave-active,\n      .animate-switch.ng-enter {\n        top:-50px;\n      }\n      .animate-switch.ng-leave,\n      .animate-switch.ng-enter.ng-enter-active {\n        top:0;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var switchElem = element(by.css('[ng-switch]'));\n      var select = element(by.model('selection'));\n\n      it('should start in settings', function() {\n        expect(switchElem.getText()).toMatch(/Settings Div/);\n      });\n      it('should change to home', function() {\n        select.element.all(by.css('option')).get(1).click();\n        expect(switchElem.getText()).toMatch(/Home Span/);\n      });\n      it('should select default', function() {\n        select.element.all(by.css('option')).get(2).click();\n        expect(switchElem.getText()).toMatch(/default/);\n      });\n    </file>\n  </example>\n */\nvar ngSwitchDirective = ['$animate', function($animate) {\n  return {\n    restrict: 'EA',\n    require: 'ngSwitch',\n\n    // asks for $scope to fool the BC controller module\n    controller: ['$scope', function ngSwitchController() {\n     this.cases = {};\n    }],\n    link: function(scope, element, attr, ngSwitchController) {\n      var watchExpr = attr.ngSwitch || attr.on,\n          selectedTranscludes = [],\n          selectedElements = [],\n          previousElements = [],\n          selectedScopes = [];\n\n      scope.$watch(watchExpr, function ngSwitchWatchAction(value) {\n        var i, ii;\n        for (i = 0, ii = previousElements.length; i < ii; ++i) {\n          previousElements[i].remove();\n        }\n        previousElements.length = 0;\n\n        for (i = 0, ii = selectedScopes.length; i < ii; ++i) {\n          var selected = selectedElements[i];\n          selectedScopes[i].$destroy();\n          previousElements[i] = selected;\n          $animate.leave(selected, function() {\n            previousElements.splice(i, 1);\n          });\n        }\n\n        selectedElements.length = 0;\n        selectedScopes.length = 0;\n\n        if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {\n          scope.$eval(attr.change);\n          forEach(selectedTranscludes, function(selectedTransclude) {\n            var selectedScope = scope.$new();\n            selectedScopes.push(selectedScope);\n            selectedTransclude.transclude(selectedScope, function(caseElement) {\n              var anchor = selectedTransclude.element;\n\n              selectedElements.push(caseElement);\n              $animate.enter(caseElement, anchor.parent(), anchor);\n            });\n          });\n        }\n      });\n    }\n  };\n}];\n\nvar ngSwitchWhenDirective = ngDirective({\n  transclude: 'element',\n  priority: 800,\n  require: '^ngSwitch',\n  link: function(scope, element, attrs, ctrl, $transclude) {\n    ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);\n    ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });\n  }\n});\n\nvar ngSwitchDefaultDirective = ngDirective({\n  transclude: 'element',\n  priority: 800,\n  require: '^ngSwitch',\n  link: function(scope, element, attr, ctrl, $transclude) {\n    ctrl.cases['?'] = (ctrl.cases['?'] || []);\n    ctrl.cases['?'].push({ transclude: $transclude, element: element });\n   }\n});\n\n/**\n * @ngdoc directive\n * @name ngTransclude\n * @restrict AC\n *\n * @description\n * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.\n *\n * Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted.\n *\n * @element ANY\n *\n * @example\n   <example module=\"transclude\">\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.title = 'Lorem Ipsum';\n           $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n         }\n\n         angular.module('transclude', [])\n          .directive('pane', function(){\n             return {\n               restrict: 'E',\n               transclude: true,\n               scope: { title:'@' },\n               template: '<div style=\"border: 1px solid black;\">' +\n                           '<div style=\"background-color: gray\">{{title}}</div>' +\n                           '<div ng-transclude></div>' +\n                         '</div>'\n             };\n         });\n       </script>\n       <div ng-controller=\"Ctrl\">\n         <input ng-model=\"title\"><br>\n         <textarea ng-model=\"text\"></textarea> <br/>\n         <pane title=\"{{title}}\">{{text}}</pane>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n        it('should have transcluded', function() {\n          var titleElement = element(by.model('title'));\n          titleElement.clear();\n          titleElement.sendKeys('TITLE');\n          var textElement = element(by.model('text'));\n          textElement.clear();\n          textElement.sendKeys('TEXT');\n          expect(element(by.binding('title')).getText()).toEqual('TITLE');\n          expect(element(by.binding('text')).getText()).toEqual('TEXT');\n        });\n     </file>\n   </example>\n *\n */\nvar ngTranscludeDirective = ngDirective({\n  link: function($scope, $element, $attrs, controller, $transclude) {\n    if (!$transclude) {\n      throw minErr('ngTransclude')('orphan',\n       'Illegal use of ngTransclude directive in the template! ' +\n       'No parent directive that requires a transclusion found. ' +\n       'Element: {0}',\n       startingTag($element));\n    }\n\n    $transclude(function(clone) {\n      $element.empty();\n      $element.append(clone);\n    });\n  }\n});\n\n/**\n * @ngdoc directive\n * @name script\n * @restrict E\n *\n * @description\n * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the\n * template can be used by {@link ng.directive:ngInclude `ngInclude`},\n * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the\n * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be\n * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.\n *\n * @param {string} type Must be set to `'text/ng-template'`.\n * @param {string} id Cache name of the template.\n *\n * @example\n  <example>\n    <file name=\"index.html\">\n      <script type=\"text/ng-template\" id=\"/tpl.html\">\n        Content of the template.\n      </script>\n\n      <a ng-click=\"currentTpl='/tpl.html'\" id=\"tpl-link\">Load inlined template</a>\n      <div id=\"tpl-content\" ng-include src=\"currentTpl\"></div>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      it('should load template defined inside script tag', function() {\n        element(by.css('#tpl-link')).click();\n        expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);\n      });\n    </file>\n  </example>\n */\nvar scriptDirective = ['$templateCache', function($templateCache) {\n  return {\n    restrict: 'E',\n    terminal: true,\n    compile: function(element, attr) {\n      if (attr.type == 'text/ng-template') {\n        var templateUrl = attr.id,\n            // IE is not consistent, in scripts we have to read .text but in other nodes we have to read .textContent\n            text = element[0].text;\n\n        $templateCache.put(templateUrl, text);\n      }\n    }\n  };\n}];\n\nvar ngOptionsMinErr = minErr('ngOptions');\n/**\n * @ngdoc directive\n * @name select\n * @restrict E\n *\n * @description\n * HTML `SELECT` element with angular data-binding.\n *\n * # `ngOptions`\n *\n * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`\n * elements for the `<select>` element using the array or object obtained by evaluating the\n * `ngOptions` comprehension_expression.\n *\n * When an item in the `<select>` menu is selected, the array element or object property\n * represented by the selected option will be bound to the model identified by the `ngModel`\n * directive.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `ngModel` compares by reference, not value. This is important when binding to an\n * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/).\n * </div>\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `ngOptions` provides an iterator facility for the `<option>` element which should be used instead\n * of {@link ng.directive:ngRepeat ngRepeat} when you want the\n * `select` model to be bound to a non-string value. This is because an option element can only\n * be bound to string values at present.\n * </div>\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required The control is considered valid only if value is entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {comprehension_expression=} ngOptions in one of the following forms:\n *\n *   * for array data sources:\n *     * `label` **`for`** `value` **`in`** `array`\n *     * `select` **`as`** `label` **`for`** `value` **`in`** `array`\n *     * `label`  **`group by`** `group` **`for`** `value` **`in`** `array`\n *     * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n *   * for object data sources:\n *     * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`group by`** `group`\n *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *\n * Where:\n *\n *   * `array` / `object`: an expression which evaluates to an array / object to iterate over.\n *   * `value`: local variable which will refer to each item in the `array` or each property value\n *      of `object` during iteration.\n *   * `key`: local variable which will refer to a property name in `object` during iteration.\n *   * `label`: The result of this expression will be the label for `<option>` element. The\n *     `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).\n *   * `select`: The result of this expression will be bound to the model of the parent `<select>`\n *      element. If not specified, `select` expression will default to `value`.\n *   * `group`: The result of this expression will be used to group options using the `<optgroup>`\n *      DOM element.\n *   * `trackexpr`: Used when working with an array of objects. The result of this expression will be\n *      used to identify the objects in the array. The `trackexpr` will most likely refer to the\n *     `value` variable (e.g. `value.propertyName`).\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <script>\n        function MyCntrl($scope) {\n          $scope.colors = [\n            {name:'black', shade:'dark'},\n            {name:'white', shade:'light'},\n            {name:'red', shade:'dark'},\n            {name:'blue', shade:'dark'},\n            {name:'yellow', shade:'light'}\n          ];\n          $scope.myColor = $scope.colors[2]; // red\n        }\n        </script>\n        <div ng-controller=\"MyCntrl\">\n          <ul>\n            <li ng-repeat=\"color in colors\">\n              Name: <input ng-model=\"color.name\">\n              [<a href ng-click=\"colors.splice($index, 1)\">X</a>]\n            </li>\n            <li>\n              [<a href ng-click=\"colors.push({})\">add</a>]\n            </li>\n          </ul>\n          <hr/>\n          Color (null not allowed):\n          <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\"></select><br>\n\n          Color (null allowed):\n          <span  class=\"nullable\">\n            <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\">\n              <option value=\"\">-- choose color --</option>\n            </select>\n          </span><br/>\n\n          Color grouped by shade:\n          <select ng-model=\"myColor\" ng-options=\"color.name group by color.shade for color in colors\">\n          </select><br/>\n\n\n          Select <a href ng-click=\"myColor = { name:'not in list', shade: 'other' }\">bogus</a>.<br>\n          <hr/>\n          Currently selected: {{ {selected_color:myColor}  }}\n          <div style=\"border:solid 1px black; height:20px\"\n               ng-style=\"{'background-color':myColor.name}\">\n          </div>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n         it('should check ng-options', function() {\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');\n           element.all(by.select('myColor')).first().click();\n           element.all(by.css('select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');\n           element(by.css('.nullable select[ng-model=\"myColor\"]')).click();\n           element.all(by.css('.nullable select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');\n         });\n      </file>\n    </example>\n */\n\nvar ngOptionsDirective = valueFn({ terminal: true });\n// jshint maxlen: false\nvar selectDirective = ['$compile', '$parse', function($compile,   $parse) {\n                         //000011111111110000000000022222222220000000000000000000003333333333000000000000004444444444444440000000005555555555555550000000666666666666666000000000000000777777777700000000000000000008888888888\n  var NG_OPTIONS_REGEXP = /^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+group\\s+by\\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]+?))?$/,\n      nullModelCtrl = {$setViewValue: noop};\n// jshint maxlen: 100\n\n  return {\n    restrict: 'E',\n    require: ['select', '?ngModel'],\n    controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {\n      var self = this,\n          optionsMap = {},\n          ngModelCtrl = nullModelCtrl,\n          nullOption,\n          unknownOption;\n\n\n      self.databound = $attrs.ngModel;\n\n\n      self.init = function(ngModelCtrl_, nullOption_, unknownOption_) {\n        ngModelCtrl = ngModelCtrl_;\n        nullOption = nullOption_;\n        unknownOption = unknownOption_;\n      };\n\n\n      self.addOption = function(value) {\n        assertNotHasOwnProperty(value, '\"option value\"');\n        optionsMap[value] = true;\n\n        if (ngModelCtrl.$viewValue == value) {\n          $element.val(value);\n          if (unknownOption.parent()) unknownOption.remove();\n        }\n      };\n\n\n      self.removeOption = function(value) {\n        if (this.hasOption(value)) {\n          delete optionsMap[value];\n          if (ngModelCtrl.$viewValue == value) {\n            this.renderUnknownOption(value);\n          }\n        }\n      };\n\n\n      self.renderUnknownOption = function(val) {\n        var unknownVal = '? ' + hashKey(val) + ' ?';\n        unknownOption.val(unknownVal);\n        $element.prepend(unknownOption);\n        $element.val(unknownVal);\n        unknownOption.prop('selected', true); // needed for IE\n      };\n\n\n      self.hasOption = function(value) {\n        return optionsMap.hasOwnProperty(value);\n      };\n\n      $scope.$on('$destroy', function() {\n        // disable unknown option so that we don't do work when the whole select is being destroyed\n        self.renderUnknownOption = noop;\n      });\n    }],\n\n    link: function(scope, element, attr, ctrls) {\n      // if ngModel is not defined, we don't need to do anything\n      if (!ctrls[1]) return;\n\n      var selectCtrl = ctrls[0],\n          ngModelCtrl = ctrls[1],\n          multiple = attr.multiple,\n          optionsExp = attr.ngOptions,\n          nullOption = false, // if false, user will not be able to select it (used by ngOptions)\n          emptyOption,\n          // we can't just jqLite('<option>') since jqLite is not smart enough\n          // to create it in <select> and IE barfs otherwise.\n          optionTemplate = jqLite(document.createElement('option')),\n          optGroupTemplate =jqLite(document.createElement('optgroup')),\n          unknownOption = optionTemplate.clone();\n\n      // find \"null\" option\n      for(var i = 0, children = element.children(), ii = children.length; i < ii; i++) {\n        if (children[i].value === '') {\n          emptyOption = nullOption = children.eq(i);\n          break;\n        }\n      }\n\n      selectCtrl.init(ngModelCtrl, nullOption, unknownOption);\n\n      // required validator\n      if (multiple) {\n        ngModelCtrl.$isEmpty = function(value) {\n          return !value || value.length === 0;\n        };\n      }\n\n      if (optionsExp) setupAsOptions(scope, element, ngModelCtrl);\n      else if (multiple) setupAsMultiple(scope, element, ngModelCtrl);\n      else setupAsSingle(scope, element, ngModelCtrl, selectCtrl);\n\n\n      ////////////////////////////\n\n\n\n      function setupAsSingle(scope, selectElement, ngModelCtrl, selectCtrl) {\n        ngModelCtrl.$render = function() {\n          var viewValue = ngModelCtrl.$viewValue;\n\n          if (selectCtrl.hasOption(viewValue)) {\n            if (unknownOption.parent()) unknownOption.remove();\n            selectElement.val(viewValue);\n            if (viewValue === '') emptyOption.prop('selected', true); // to make IE9 happy\n          } else {\n            if (isUndefined(viewValue) && emptyOption) {\n              selectElement.val('');\n            } else {\n              selectCtrl.renderUnknownOption(viewValue);\n            }\n          }\n        };\n\n        selectElement.on('change', function() {\n          scope.$apply(function() {\n            if (unknownOption.parent()) unknownOption.remove();\n            ngModelCtrl.$setViewValue(selectElement.val());\n          });\n        });\n      }\n\n      function setupAsMultiple(scope, selectElement, ctrl) {\n        var lastView;\n        ctrl.$render = function() {\n          var items = new HashMap(ctrl.$viewValue);\n          forEach(selectElement.find('option'), function(option) {\n            option.selected = isDefined(items.get(option.value));\n          });\n        };\n\n        // we have to do it on each watch since ngModel watches reference, but\n        // we need to work of an array, so we need to see if anything was inserted/removed\n        scope.$watch(function selectMultipleWatch() {\n          if (!equals(lastView, ctrl.$viewValue)) {\n            lastView = shallowCopy(ctrl.$viewValue);\n            ctrl.$render();\n          }\n        });\n\n        selectElement.on('change', function() {\n          scope.$apply(function() {\n            var array = [];\n            forEach(selectElement.find('option'), function(option) {\n              if (option.selected) {\n                array.push(option.value);\n              }\n            });\n            ctrl.$setViewValue(array);\n          });\n        });\n      }\n\n      function setupAsOptions(scope, selectElement, ctrl) {\n        var match;\n\n        if (!(match = optionsExp.match(NG_OPTIONS_REGEXP))) {\n          throw ngOptionsMinErr('iexp',\n            \"Expected expression in form of \" +\n            \"'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'\" +\n            \" but got '{0}'. Element: {1}\",\n            optionsExp, startingTag(selectElement));\n        }\n\n        var displayFn = $parse(match[2] || match[1]),\n            valueName = match[4] || match[6],\n            keyName = match[5],\n            groupByFn = $parse(match[3] || ''),\n            valueFn = $parse(match[2] ? match[1] : valueName),\n            valuesFn = $parse(match[7]),\n            track = match[8],\n            trackFn = track ? $parse(match[8]) : null,\n            // This is an array of array of existing option groups in DOM.\n            // We try to reuse these if possible\n            // - optionGroupsCache[0] is the options with no option group\n            // - optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element\n            optionGroupsCache = [[{element: selectElement, label:''}]];\n\n        if (nullOption) {\n          // compile the element since there might be bindings in it\n          $compile(nullOption)(scope);\n\n          // remove the class, which is added automatically because we recompile the element and it\n          // becomes the compilation root\n          nullOption.removeClass('ng-scope');\n\n          // we need to remove it before calling selectElement.empty() because otherwise IE will\n          // remove the label from the element. wtf?\n          nullOption.remove();\n        }\n\n        // clear contents, we'll add what's needed based on the model\n        selectElement.empty();\n\n        selectElement.on('change', function() {\n          scope.$apply(function() {\n            var optionGroup,\n                collection = valuesFn(scope) || [],\n                locals = {},\n                key, value, optionElement, index, groupIndex, length, groupLength, trackIndex;\n\n            if (multiple) {\n              value = [];\n              for (groupIndex = 0, groupLength = optionGroupsCache.length;\n                   groupIndex < groupLength;\n                   groupIndex++) {\n                // list of options for that group. (first item has the parent)\n                optionGroup = optionGroupsCache[groupIndex];\n\n                for(index = 1, length = optionGroup.length; index < length; index++) {\n                  if ((optionElement = optionGroup[index].element)[0].selected) {\n                    key = optionElement.val();\n                    if (keyName) locals[keyName] = key;\n                    if (trackFn) {\n                      for (trackIndex = 0; trackIndex < collection.length; trackIndex++) {\n                        locals[valueName] = collection[trackIndex];\n                        if (trackFn(scope, locals) == key) break;\n                      }\n                    } else {\n                      locals[valueName] = collection[key];\n                    }\n                    value.push(valueFn(scope, locals));\n                  }\n                }\n              }\n            } else {\n              key = selectElement.val();\n              if (key == '?') {\n                value = undefined;\n              } else if (key === ''){\n                value = null;\n              } else {\n                if (trackFn) {\n                  for (trackIndex = 0; trackIndex < collection.length; trackIndex++) {\n                    locals[valueName] = collection[trackIndex];\n                    if (trackFn(scope, locals) == key) {\n                      value = valueFn(scope, locals);\n                      break;\n                    }\n                  }\n                } else {\n                  locals[valueName] = collection[key];\n                  if (keyName) locals[keyName] = key;\n                  value = valueFn(scope, locals);\n                }\n              }\n              // Update the null option's selected property here so $render cleans it up correctly\n              if (optionGroupsCache[0].length > 1) {\n                if (optionGroupsCache[0][1].id !== key) {\n                  optionGroupsCache[0][1].selected = false;\n                }\n              }\n            }\n            ctrl.$setViewValue(value);\n          });\n        });\n\n        ctrl.$render = render;\n\n        // TODO(vojta): can't we optimize this ?\n        scope.$watch(render);\n\n        function render() {\n              // Temporary location for the option groups before we render them\n          var optionGroups = {'':[]},\n              optionGroupNames = [''],\n              optionGroupName,\n              optionGroup,\n              option,\n              existingParent, existingOptions, existingOption,\n              modelValue = ctrl.$modelValue,\n              values = valuesFn(scope) || [],\n              keys = keyName ? sortedKeys(values) : values,\n              key,\n              groupLength, length,\n              groupIndex, index,\n              locals = {},\n              selected,\n              selectedSet = false, // nothing is selected yet\n              lastElement,\n              element,\n              label;\n\n          if (multiple) {\n            if (trackFn && isArray(modelValue)) {\n              selectedSet = new HashMap([]);\n              for (var trackIndex = 0; trackIndex < modelValue.length; trackIndex++) {\n                locals[valueName] = modelValue[trackIndex];\n                selectedSet.put(trackFn(scope, locals), modelValue[trackIndex]);\n              }\n            } else {\n              selectedSet = new HashMap(modelValue);\n            }\n          }\n\n          // We now build up the list of options we need (we merge later)\n          for (index = 0; length = keys.length, index < length; index++) {\n\n            key = index;\n            if (keyName) {\n              key = keys[index];\n              if ( key.charAt(0) === '$' ) continue;\n              locals[keyName] = key;\n            }\n\n            locals[valueName] = values[key];\n\n            optionGroupName = groupByFn(scope, locals) || '';\n            if (!(optionGroup = optionGroups[optionGroupName])) {\n              optionGroup = optionGroups[optionGroupName] = [];\n              optionGroupNames.push(optionGroupName);\n            }\n            if (multiple) {\n              selected = isDefined(\n                selectedSet.remove(trackFn ? trackFn(scope, locals) : valueFn(scope, locals))\n              );\n            } else {\n              if (trackFn) {\n                var modelCast = {};\n                modelCast[valueName] = modelValue;\n                selected = trackFn(scope, modelCast) === trackFn(scope, locals);\n              } else {\n                selected = modelValue === valueFn(scope, locals);\n              }\n              selectedSet = selectedSet || selected; // see if at least one item is selected\n            }\n            label = displayFn(scope, locals); // what will be seen by the user\n\n            // doing displayFn(scope, locals) || '' overwrites zero values\n            label = isDefined(label) ? label : '';\n            optionGroup.push({\n              // either the index into array or key from object\n              id: trackFn ? trackFn(scope, locals) : (keyName ? keys[index] : index),\n              label: label,\n              selected: selected                   // determine if we should be selected\n            });\n          }\n          if (!multiple) {\n            if (nullOption || modelValue === null) {\n              // insert null option if we have a placeholder, or the model is null\n              optionGroups[''].unshift({id:'', label:'', selected:!selectedSet});\n            } else if (!selectedSet) {\n              // option could not be found, we have to insert the undefined item\n              optionGroups[''].unshift({id:'?', label:'', selected:true});\n            }\n          }\n\n          // Now we need to update the list of DOM nodes to match the optionGroups we computed above\n          for (groupIndex = 0, groupLength = optionGroupNames.length;\n               groupIndex < groupLength;\n               groupIndex++) {\n            // current option group name or '' if no group\n            optionGroupName = optionGroupNames[groupIndex];\n\n            // list of options for that group. (first item has the parent)\n            optionGroup = optionGroups[optionGroupName];\n\n            if (optionGroupsCache.length <= groupIndex) {\n              // we need to grow the optionGroups\n              existingParent = {\n                element: optGroupTemplate.clone().attr('label', optionGroupName),\n                label: optionGroup.label\n              };\n              existingOptions = [existingParent];\n              optionGroupsCache.push(existingOptions);\n              selectElement.append(existingParent.element);\n            } else {\n              existingOptions = optionGroupsCache[groupIndex];\n              existingParent = existingOptions[0];  // either SELECT (no group) or OPTGROUP element\n\n              // update the OPTGROUP label if not the same.\n              if (existingParent.label != optionGroupName) {\n                existingParent.element.attr('label', existingParent.label = optionGroupName);\n              }\n            }\n\n            lastElement = null;  // start at the beginning\n            for(index = 0, length = optionGroup.length; index < length; index++) {\n              option = optionGroup[index];\n              if ((existingOption = existingOptions[index+1])) {\n                // reuse elements\n                lastElement = existingOption.element;\n                if (existingOption.label !== option.label) {\n                  lastElement.text(existingOption.label = option.label);\n                }\n                if (existingOption.id !== option.id) {\n                  lastElement.val(existingOption.id = option.id);\n                }\n                // lastElement.prop('selected') provided by jQuery has side-effects\n                if (existingOption.selected !== option.selected) {\n                  lastElement.prop('selected', (existingOption.selected = option.selected));\n                }\n              } else {\n                // grow elements\n\n                // if it's a null option\n                if (option.id === '' && nullOption) {\n                  // put back the pre-compiled element\n                  element = nullOption;\n                } else {\n                  // jQuery(v1.4.2) Bug: We should be able to chain the method calls, but\n                  // in this version of jQuery on some browser the .text() returns a string\n                  // rather then the element.\n                  (element = optionTemplate.clone())\n                      .val(option.id)\n                      .attr('selected', option.selected)\n                      .text(option.label);\n                }\n\n                existingOptions.push(existingOption = {\n                    element: element,\n                    label: option.label,\n                    id: option.id,\n                    selected: option.selected\n                });\n                if (lastElement) {\n                  lastElement.after(element);\n                } else {\n                  existingParent.element.append(element);\n                }\n                lastElement = element;\n              }\n            }\n            // remove any excessive OPTIONs in a group\n            index++; // increment since the existingOptions[0] is parent element not OPTION\n            while(existingOptions.length > index) {\n              existingOptions.pop().element.remove();\n            }\n          }\n          // remove any excessive OPTGROUPs from select\n          while(optionGroupsCache.length > groupIndex) {\n            optionGroupsCache.pop()[0].element.remove();\n          }\n        }\n      }\n    }\n  };\n}];\n\nvar optionDirective = ['$interpolate', function($interpolate) {\n  var nullSelectCtrl = {\n    addOption: noop,\n    removeOption: noop\n  };\n\n  return {\n    restrict: 'E',\n    priority: 100,\n    compile: function(element, attr) {\n      if (isUndefined(attr.value)) {\n        var interpolateFn = $interpolate(element.text(), true);\n        if (!interpolateFn) {\n          attr.$set('value', element.text());\n        }\n      }\n\n      return function (scope, element, attr) {\n        var selectCtrlName = '$selectController',\n            parent = element.parent(),\n            selectCtrl = parent.data(selectCtrlName) ||\n              parent.parent().data(selectCtrlName); // in case we are in optgroup\n\n        if (selectCtrl && selectCtrl.databound) {\n          // For some reason Opera defaults to true and if not overridden this messes up the repeater.\n          // We don't want the view to drive the initialization of the model anyway.\n          element.prop('selected', false);\n        } else {\n          selectCtrl = nullSelectCtrl;\n        }\n\n        if (interpolateFn) {\n          scope.$watch(interpolateFn, function interpolateWatchAction(newVal, oldVal) {\n            attr.$set('value', newVal);\n            if (newVal !== oldVal) selectCtrl.removeOption(oldVal);\n            selectCtrl.addOption(newVal);\n          });\n        } else {\n          selectCtrl.addOption(attr.value);\n        }\n\n        element.on('$destroy', function() {\n          selectCtrl.removeOption(attr.value);\n        });\n      };\n    }\n  };\n}];\n\nvar styleDirective = valueFn({\n  restrict: 'E',\n  terminal: true\n});\n\n  if (window.angular.bootstrap) {\n    //AngularJS is already loaded, so we can return here...\n    console.log('WARNING: Tried to load angular more than once.');\n    return;\n  }\n\n  //try to bind to jquery now so that one can write angular.element().read()\n  //but we will rebind on bootstrap again.\n  bindJQuery();\n\n  publishExternalAPI(angular);\n\n  jqLite(document).ready(function() {\n    angularInit(document, bootstrap);\n  });\n\n})(window, document);\n\n!window.angular.$$csp() && window.angular.element(document).find('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{display:none !important;}ng\\\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}.ng-hide-add-active,.ng-hide-remove{display:block!important;}</style>');\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/**\n * @license AngularJS v1.2.17\n * (c) 2010-2014 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* jshint maxlen: false */\n\n/**\n * @ngdoc module\n * @name ngAnimate\n * @description\n *\n * # ngAnimate\n *\n * The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives.\n *\n *\n * <div doc-module-components=\"ngAnimate\"></div>\n *\n * # Usage\n *\n * To see animations in action, all that is required is to define the appropriate CSS classes\n * or to register a JavaScript animation via the myModule.animation() function. The directives that support animation automatically are:\n * `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation\n * by using the `$animate` service.\n *\n * Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives:\n *\n * | Directive                                                 | Supported Animations                               |\n * |---------------------------------------------------------- |----------------------------------------------------|\n * | {@link ng.directive:ngRepeat#usage_animations ngRepeat}         | enter, leave and move                              |\n * | {@link ngRoute.directive:ngView#usage_animations ngView}        | enter and leave                                    |\n * | {@link ng.directive:ngInclude#usage_animations ngInclude}       | enter and leave                                    |\n * | {@link ng.directive:ngSwitch#usage_animations ngSwitch}         | enter and leave                                    |\n * | {@link ng.directive:ngIf#usage_animations ngIf}                 | enter and leave                                    |\n * | {@link ng.directive:ngClass#usage_animations ngClass}           | add and remove                                     |\n * | {@link ng.directive:ngShow#usage_animations ngShow & ngHide}    | add and remove (the ng-hide class value)           |\n * | {@link ng.directive:form#usage_animations form}                 | add and remove (dirty, pristine, valid, invalid & all other validations)                |\n * | {@link ng.directive:ngModel#usage_animations ngModel}           | add and remove (dirty, pristine, valid, invalid & all other validations)                |\n *\n * You can find out more information about animations upon visiting each directive page.\n *\n * Below is an example of how to apply animations to a directive that supports animation hooks:\n *\n * ```html\n * <style type=\"text/css\">\n * .slide.ng-enter, .slide.ng-leave {\n *   -webkit-transition:0.5s linear all;\n *   transition:0.5s linear all;\n * }\n *\n * .slide.ng-enter { }        /&#42; starting animations for enter &#42;/\n * .slide.ng-enter-active { } /&#42; terminal animations for enter &#42;/\n * .slide.ng-leave { }        /&#42; starting animations for leave &#42;/\n * .slide.ng-leave-active { } /&#42; terminal animations for leave &#42;/\n * </style>\n *\n * <!--\n * the animate service will automatically add .ng-enter and .ng-leave to the element\n * to trigger the CSS transition/animations\n * -->\n * <ANY class=\"slide\" ng-include=\"...\"></ANY>\n * ```\n *\n * Keep in mind that if an animation is running, any child elements cannot be animated until the parent element's\n * animation has completed.\n *\n * <h2>CSS-defined Animations</h2>\n * The animate service will automatically apply two CSS classes to the animated element and these two CSS classes\n * are designed to contain the start and end CSS styling. Both CSS transitions and keyframe animations are supported\n * and can be used to play along with this naming structure.\n *\n * The following code below demonstrates how to perform animations using **CSS transitions** with Angular:\n *\n * ```html\n * <style type=\"text/css\">\n * /&#42;\n *  The animate class is apart of the element and the ng-enter class\n *  is attached to the element once the enter animation event is triggered\n * &#42;/\n * .reveal-animation.ng-enter {\n *  -webkit-transition: 1s linear all; /&#42; Safari/Chrome &#42;/\n *  transition: 1s linear all; /&#42; All other modern browsers and IE10+ &#42;/\n *\n *  /&#42; The animation preparation code &#42;/\n *  opacity: 0;\n * }\n *\n * /&#42;\n *  Keep in mind that you want to combine both CSS\n *  classes together to avoid any CSS-specificity\n *  conflicts\n * &#42;/\n * .reveal-animation.ng-enter.ng-enter-active {\n *  /&#42; The animation code itself &#42;/\n *  opacity: 1;\n * }\n * </style>\n *\n * <div class=\"view-container\">\n *   <div ng-view class=\"reveal-animation\"></div>\n * </div>\n * ```\n *\n * The following code below demonstrates how to perform animations using **CSS animations** with Angular:\n *\n * ```html\n * <style type=\"text/css\">\n * .reveal-animation.ng-enter {\n *   -webkit-animation: enter_sequence 1s linear; /&#42; Safari/Chrome &#42;/\n *   animation: enter_sequence 1s linear; /&#42; IE10+ and Future Browsers &#42;/\n * }\n * @-webkit-keyframes enter_sequence {\n *   from { opacity:0; }\n *   to { opacity:1; }\n * }\n * @keyframes enter_sequence {\n *   from { opacity:0; }\n *   to { opacity:1; }\n * }\n * </style>\n *\n * <div class=\"view-container\">\n *   <div ng-view class=\"reveal-animation\"></div>\n * </div>\n * ```\n *\n * Both CSS3 animations and transitions can be used together and the animate service will figure out the correct duration and delay timing.\n *\n * Upon DOM mutation, the event class is added first (something like `ng-enter`), then the browser prepares itself to add\n * the active class (in this case `ng-enter-active`) which then triggers the animation. The animation module will automatically\n * detect the CSS code to determine when the animation ends. Once the animation is over then both CSS classes will be\n * removed from the DOM. If a browser does not support CSS transitions or CSS animations then the animation will start and end\n * immediately resulting in a DOM element that is at its final state. This final state is when the DOM element\n * has no CSS transition/animation classes applied to it.\n *\n * <h3>CSS Staggering Animations</h3>\n * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a\n * curtain-like effect. The ngAnimate module, as of 1.2.0, supports staggering animations and the stagger effect can be\n * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for\n * the animation. The style property expected within the stagger class can either be a **transition-delay** or an\n * **animation-delay** property (or both if your animation contains both transitions and keyframe animations).\n *\n * ```css\n * .my-animation.ng-enter {\n *   /&#42; standard transition code &#42;/\n *   -webkit-transition: 1s linear all;\n *   transition: 1s linear all;\n *   opacity:0;\n * }\n * .my-animation.ng-enter-stagger {\n *   /&#42; this will have a 100ms delay between each successive leave animation &#42;/\n *   -webkit-transition-delay: 0.1s;\n *   transition-delay: 0.1s;\n *\n *   /&#42; in case the stagger doesn't work then these two values\n *    must be set to 0 to avoid an accidental CSS inheritance &#42;/\n *   -webkit-transition-duration: 0s;\n *   transition-duration: 0s;\n * }\n * .my-animation.ng-enter.ng-enter-active {\n *   /&#42; standard transition styles &#42;/\n *   opacity:1;\n * }\n * ```\n *\n * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations\n * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this\n * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation\n * will also be reset if more than 10ms has passed after the last animation has been fired.\n *\n * The following code will issue the **ng-leave-stagger** event on the element provided:\n *\n * ```js\n * var kids = parent.children();\n *\n * $animate.leave(kids[0]); //stagger index=0\n * $animate.leave(kids[1]); //stagger index=1\n * $animate.leave(kids[2]); //stagger index=2\n * $animate.leave(kids[3]); //stagger index=3\n * $animate.leave(kids[4]); //stagger index=4\n *\n * $timeout(function() {\n *   //stagger has reset itself\n *   $animate.leave(kids[5]); //stagger index=0\n *   $animate.leave(kids[6]); //stagger index=1\n * }, 100, false);\n * ```\n *\n * Stagger animations are currently only supported within CSS-defined animations.\n *\n * <h2>JavaScript-defined Animations</h2>\n * In the event that you do not want to use CSS3 transitions or CSS3 animations or if you wish to offer animations on browsers that do not\n * yet support CSS transitions/animations, then you can make use of JavaScript animations defined inside of your AngularJS module.\n *\n * ```js\n * //!annotate=\"YourApp\" Your AngularJS Module|Replace this or ngModule with the module that you used to define your application.\n * var ngModule = angular.module('YourApp', ['ngAnimate']);\n * ngModule.animation('.my-crazy-animation', function() {\n *   return {\n *     enter: function(element, done) {\n *       //run the animation here and call done when the animation is complete\n *       return function(cancelled) {\n *         //this (optional) function will be called when the animation\n *         //completes or when the animation is cancelled (the cancelled\n *         //flag will be set to true if cancelled).\n *       };\n *     },\n *     leave: function(element, done) { },\n *     move: function(element, done) { },\n *\n *     //animation that can be triggered before the class is added\n *     beforeAddClass: function(element, className, done) { },\n *\n *     //animation that can be triggered after the class is added\n *     addClass: function(element, className, done) { },\n *\n *     //animation that can be triggered before the class is removed\n *     beforeRemoveClass: function(element, className, done) { },\n *\n *     //animation that can be triggered after the class is removed\n *     removeClass: function(element, className, done) { }\n *   };\n * });\n * ```\n *\n * JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run\n * a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits\n * the element's CSS class attribute value and then run the matching animation event function (if found).\n * In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function will\n * be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported).\n *\n * Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned.\n * As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run,\n * and the JavaScript animation is found, then the enter callback will handle that animation (in addition to the CSS keyframe animation\n * or transition code that is defined via a stylesheet).\n *\n */\n\nangular.module('ngAnimate', ['ng'])\n\n  /**\n   * @ngdoc provider\n   * @name $animateProvider\n   * @description\n   *\n   * The `$animateProvider` allows developers to register JavaScript animation event handlers directly inside of a module.\n   * When an animation is triggered, the $animate service will query the $animate service to find any animations that match\n   * the provided name value.\n   *\n   * Requires the {@link ngAnimate `ngAnimate`} module to be installed.\n   *\n   * Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.\n   *\n   */\n\n  //this private service is only used within CSS-enabled animations\n  //IE8 + IE9 do not support rAF natively, but that is fine since they\n  //also don't support transitions and keyframes which means that the code\n  //below will never be used by the two browsers.\n  .factory('$$animateReflow', ['$$rAF', '$document', function($$rAF, $document) {\n    var bod = $document[0].body;\n    return function(fn) {\n      //the returned function acts as the cancellation function\n      return $$rAF(function() {\n        //the line below will force the browser to perform a repaint\n        //so that all the animated elements within the animation frame\n        //will be properly updated and drawn on screen. This is\n        //required to perform multi-class CSS based animations with\n        //Firefox. DO NOT REMOVE THIS LINE.\n        var a = bod.offsetWidth + 1;\n        fn();\n      });\n    };\n  }])\n\n  .config(['$provide', '$animateProvider', function($provide, $animateProvider) {\n    var noop = angular.noop;\n    var forEach = angular.forEach;\n    var selectors = $animateProvider.$$selectors;\n\n    var ELEMENT_NODE = 1;\n    var NG_ANIMATE_STATE = '$$ngAnimateState';\n    var NG_ANIMATE_CLASS_NAME = 'ng-animate';\n    var rootAnimateState = {running: true};\n\n    function extractElementNode(element) {\n      for(var i = 0; i < element.length; i++) {\n        var elm = element[i];\n        if(elm.nodeType == ELEMENT_NODE) {\n          return elm;\n        }\n      }\n    }\n\n    function prepareElement(element) {\n      return element && angular.element(element);\n    }\n\n    function stripCommentsFromElement(element) {\n      return angular.element(extractElementNode(element));\n    }\n\n    function isMatchingElement(elm1, elm2) {\n      return extractElementNode(elm1) == extractElementNode(elm2);\n    }\n\n    $provide.decorator('$animate', ['$delegate', '$injector', '$sniffer', '$rootElement', '$$asyncCallback', '$rootScope', '$document',\n                            function($delegate,   $injector,   $sniffer,   $rootElement,   $$asyncCallback,    $rootScope,   $document) {\n\n      var globalAnimationCounter = 0;\n      $rootElement.data(NG_ANIMATE_STATE, rootAnimateState);\n\n      // disable animations during bootstrap, but once we bootstrapped, wait again\n      // for another digest until enabling animations. The reason why we digest twice\n      // is because all structural animations (enter, leave and move) all perform a\n      // post digest operation before animating. If we only wait for a single digest\n      // to pass then the structural animation would render its animation on page load.\n      // (which is what we're trying to avoid when the application first boots up.)\n      $rootScope.$$postDigest(function() {\n        $rootScope.$$postDigest(function() {\n          rootAnimateState.running = false;\n        });\n      });\n\n      var classNameFilter = $animateProvider.classNameFilter();\n      var isAnimatableClassName = !classNameFilter\n              ? function() { return true; }\n              : function(className) {\n                return classNameFilter.test(className);\n              };\n\n      function lookup(name) {\n        if (name) {\n          var matches = [],\n              flagMap = {},\n              classes = name.substr(1).split('.');\n\n          //the empty string value is the default animation\n          //operation which performs CSS transition and keyframe\n          //animations sniffing. This is always included for each\n          //element animation procedure if the browser supports\n          //transitions and/or keyframe animations. The default\n          //animation is added to the top of the list to prevent\n          //any previous animations from affecting the element styling\n          //prior to the element being animated.\n          if ($sniffer.transitions || $sniffer.animations) {\n            matches.push($injector.get(selectors['']));\n          }\n\n          for(var i=0; i < classes.length; i++) {\n            var klass = classes[i],\n                selectorFactoryName = selectors[klass];\n            if(selectorFactoryName && !flagMap[klass]) {\n              matches.push($injector.get(selectorFactoryName));\n              flagMap[klass] = true;\n            }\n          }\n          return matches;\n        }\n      }\n\n      function animationRunner(element, animationEvent, className) {\n        //transcluded directives may sometimes fire an animation using only comment nodes\n        //best to catch this early on to prevent any animation operations from occurring\n        var node = element[0];\n        if(!node) {\n          return;\n        }\n\n        var isSetClassOperation = animationEvent == 'setClass';\n        var isClassBased = isSetClassOperation ||\n                           animationEvent == 'addClass' ||\n                           animationEvent == 'removeClass';\n\n        var classNameAdd, classNameRemove;\n        if(angular.isArray(className)) {\n          classNameAdd = className[0];\n          classNameRemove = className[1];\n          className = classNameAdd + ' ' + classNameRemove;\n        }\n\n        var currentClassName = element.attr('class');\n        var classes = currentClassName + ' ' + className;\n        if(!isAnimatableClassName(classes)) {\n          return;\n        }\n\n        var beforeComplete = noop,\n            beforeCancel = [],\n            before = [],\n            afterComplete = noop,\n            afterCancel = [],\n            after = [];\n\n        var animationLookup = (' ' + classes).replace(/\\s+/g,'.');\n        forEach(lookup(animationLookup), function(animationFactory) {\n          var created = registerAnimation(animationFactory, animationEvent);\n          if(!created && isSetClassOperation) {\n            registerAnimation(animationFactory, 'addClass');\n            registerAnimation(animationFactory, 'removeClass');\n          }\n        });\n\n        function registerAnimation(animationFactory, event) {\n          var afterFn = animationFactory[event];\n          var beforeFn = animationFactory['before' + event.charAt(0).toUpperCase() + event.substr(1)];\n          if(afterFn || beforeFn) {\n            if(event == 'leave') {\n              beforeFn = afterFn;\n              //when set as null then animation knows to skip this phase\n              afterFn = null;\n            }\n            after.push({\n              event : event, fn : afterFn\n            });\n            before.push({\n              event : event, fn : beforeFn\n            });\n            return true;\n          }\n        }\n\n        function run(fns, cancellations, allCompleteFn) {\n          var animations = [];\n          forEach(fns, function(animation) {\n            animation.fn && animations.push(animation);\n          });\n\n          var count = 0;\n          function afterAnimationComplete(index) {\n            if(cancellations) {\n              (cancellations[index] || noop)();\n              if(++count < animations.length) return;\n              cancellations = null;\n            }\n            allCompleteFn();\n          }\n\n          //The code below adds directly to the array in order to work with\n          //both sync and async animations. Sync animations are when the done()\n          //operation is called right away. DO NOT REFACTOR!\n          forEach(animations, function(animation, index) {\n            var progress = function() {\n              afterAnimationComplete(index);\n            };\n            switch(animation.event) {\n              case 'setClass':\n                cancellations.push(animation.fn(element, classNameAdd, classNameRemove, progress));\n                break;\n              case 'addClass':\n                cancellations.push(animation.fn(element, classNameAdd || className,     progress));\n                break;\n              case 'removeClass':\n                cancellations.push(animation.fn(element, classNameRemove || className,  progress));\n                break;\n              default:\n                cancellations.push(animation.fn(element, progress));\n                break;\n            }\n          });\n\n          if(cancellations && cancellations.length === 0) {\n            allCompleteFn();\n          }\n        }\n\n        return {\n          node : node,\n          event : animationEvent,\n          className : className,\n          isClassBased : isClassBased,\n          isSetClassOperation : isSetClassOperation,\n          before : function(allCompleteFn) {\n            beforeComplete = allCompleteFn;\n            run(before, beforeCancel, function() {\n              beforeComplete = noop;\n              allCompleteFn();\n            });\n          },\n          after : function(allCompleteFn) {\n            afterComplete = allCompleteFn;\n            run(after, afterCancel, function() {\n              afterComplete = noop;\n              allCompleteFn();\n            });\n          },\n          cancel : function() {\n            if(beforeCancel) {\n              forEach(beforeCancel, function(cancelFn) {\n                (cancelFn || noop)(true);\n              });\n              beforeComplete(true);\n            }\n            if(afterCancel) {\n              forEach(afterCancel, function(cancelFn) {\n                (cancelFn || noop)(true);\n              });\n              afterComplete(true);\n            }\n          }\n        };\n      }\n\n      /**\n       * @ngdoc service\n       * @name $animate\n       * @kind function\n       *\n       * @description\n       * The `$animate` service provides animation detection support while performing DOM operations (enter, leave and move) as well as during addClass and removeClass operations.\n       * When any of these operations are run, the $animate service\n       * will examine any JavaScript-defined animations (which are defined by using the $animateProvider provider object)\n       * as well as any CSS-defined animations against the CSS classes present on the element once the DOM operation is run.\n       *\n       * The `$animate` service is used behind the scenes with pre-existing directives and animation with these directives\n       * will work out of the box without any extra configuration.\n       *\n       * Requires the {@link ngAnimate `ngAnimate`} module to be installed.\n       *\n       * Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.\n       *\n       */\n      return {\n        /**\n         * @ngdoc method\n         * @name $animate#enter\n         * @kind function\n         *\n         * @description\n         * Appends the element to the parentElement element that resides in the document and then runs the enter animation. Once\n         * the animation is started, the following CSS classes will be present on the element for the duration of the animation:\n         *\n         * Below is a breakdown of each step that occurs during enter animation:\n         *\n         * | Animation Step                                                                               | What the element class attribute looks like |\n         * |----------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.enter(...) is called                                                             | class=\"my-animation\"                        |\n         * | 2. element is inserted into the parentElement element or beside the afterElement element     | class=\"my-animation\"                        |\n         * | 3. $animate runs any JavaScript-defined animations on the element                            | class=\"my-animation ng-animate\"             |\n         * | 4. the .ng-enter class is added to the element                                               | class=\"my-animation ng-animate ng-enter\"    |\n         * | 5. $animate scans the element styles to get the CSS transition/animation duration and delay  | class=\"my-animation ng-animate ng-enter\"    |\n         * | 6. $animate waits for 10ms (this performs a reflow)                                          | class=\"my-animation ng-animate ng-enter\"    |\n         * | 7. the .ng-enter-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active ng-enter ng-enter-active\" |\n         * | 8. $animate waits for X milliseconds for the animation to complete                           | class=\"my-animation ng-animate ng-animate-active ng-enter ng-enter-active\" |\n         * | 9. The animation ends and all generated CSS classes are removed from the element             | class=\"my-animation\"                        |\n         * | 10. The doneCallback() callback is fired (if provided)                                       | class=\"my-animation\"                        |\n         *\n         * @param {DOMElement} element the element that will be the focus of the enter animation\n         * @param {DOMElement} parentElement the parent element of the element that will be the focus of the enter animation\n         * @param {DOMElement} afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        enter : function(element, parentElement, afterElement, doneCallback) {\n          element = angular.element(element);\n          parentElement = prepareElement(parentElement);\n          afterElement = prepareElement(afterElement);\n\n          this.enabled(false, element);\n          $delegate.enter(element, parentElement, afterElement);\n          $rootScope.$$postDigest(function() {\n            element = stripCommentsFromElement(element);\n            performAnimation('enter', 'ng-enter', element, parentElement, afterElement, noop, doneCallback);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#leave\n         * @kind function\n         *\n         * @description\n         * Runs the leave animation operation and, upon completion, removes the element from the DOM. Once\n         * the animation is started, the following CSS classes will be added for the duration of the animation:\n         *\n         * Below is a breakdown of each step that occurs during leave animation:\n         *\n         * | Animation Step                                                                               | What the element class attribute looks like |\n         * |----------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.leave(...) is called                                                             | class=\"my-animation\"                        |\n         * | 2. $animate runs any JavaScript-defined animations on the element                            | class=\"my-animation ng-animate\"             |\n         * | 3. the .ng-leave class is added to the element                                               | class=\"my-animation ng-animate ng-leave\"    |\n         * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay  | class=\"my-animation ng-animate ng-leave\"    |\n         * | 5. $animate waits for 10ms (this performs a reflow)                                          | class=\"my-animation ng-animate ng-leave\"    |\n         * | 6. the .ng-leave-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active ng-leave ng-leave-active\" |\n         * | 7. $animate waits for X milliseconds for the animation to complete                           | class=\"my-animation ng-animate ng-animate-active ng-leave ng-leave-active\" |\n         * | 8. The animation ends and all generated CSS classes are removed from the element             | class=\"my-animation\"                        |\n         * | 9. The element is removed from the DOM                                                       | ...                                         |\n         * | 10. The doneCallback() callback is fired (if provided)                                       | ...                                         |\n         *\n         * @param {DOMElement} element the element that will be the focus of the leave animation\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        leave : function(element, doneCallback) {\n          element = angular.element(element);\n          cancelChildAnimations(element);\n          this.enabled(false, element);\n          $rootScope.$$postDigest(function() {\n            performAnimation('leave', 'ng-leave', stripCommentsFromElement(element), null, null, function() {\n              $delegate.leave(element);\n            }, doneCallback);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#move\n         * @kind function\n         *\n         * @description\n         * Fires the move DOM operation. Just before the animation starts, the animate service will either append it into the parentElement container or\n         * add the element directly after the afterElement element if present. Then the move animation will be run. Once\n         * the animation is started, the following CSS classes will be added for the duration of the animation:\n         *\n         * Below is a breakdown of each step that occurs during move animation:\n         *\n         * | Animation Step                                                                               | What the element class attribute looks like |\n         * |----------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.move(...) is called                                                              | class=\"my-animation\"                        |\n         * | 2. element is moved into the parentElement element or beside the afterElement element        | class=\"my-animation\"                        |\n         * | 3. $animate runs any JavaScript-defined animations on the element                            | class=\"my-animation ng-animate\"             |\n         * | 4. the .ng-move class is added to the element                                                | class=\"my-animation ng-animate ng-move\"     |\n         * | 5. $animate scans the element styles to get the CSS transition/animation duration and delay  | class=\"my-animation ng-animate ng-move\"     |\n         * | 6. $animate waits for 10ms (this performs a reflow)                                          | class=\"my-animation ng-animate ng-move\"     |\n         * | 7. the .ng-move-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active ng-move ng-move-active\" |\n         * | 8. $animate waits for X milliseconds for the animation to complete                           | class=\"my-animation ng-animate ng-animate-active ng-move ng-move-active\" |\n         * | 9. The animation ends and all generated CSS classes are removed from the element             | class=\"my-animation\"                        |\n         * | 10. The doneCallback() callback is fired (if provided)                                       | class=\"my-animation\"                        |\n         *\n         * @param {DOMElement} element the element that will be the focus of the move animation\n         * @param {DOMElement} parentElement the parentElement element of the element that will be the focus of the move animation\n         * @param {DOMElement} afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        move : function(element, parentElement, afterElement, doneCallback) {\n          element = angular.element(element);\n          parentElement = prepareElement(parentElement);\n          afterElement = prepareElement(afterElement);\n\n          cancelChildAnimations(element);\n          this.enabled(false, element);\n          $delegate.move(element, parentElement, afterElement);\n          $rootScope.$$postDigest(function() {\n            element = stripCommentsFromElement(element);\n            performAnimation('move', 'ng-move', element, parentElement, afterElement, noop, doneCallback);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#addClass\n         *\n         * @description\n         * Triggers a custom animation event based off the className variable and then attaches the className value to the element as a CSS class.\n         * Unlike the other animation methods, the animate service will suffix the className value with {@type -add} in order to provide\n         * the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if no CSS transitions\n         * or keyframes are defined on the -add or base CSS class).\n         *\n         * Below is a breakdown of each step that occurs during addClass animation:\n         *\n         * | Animation Step                                                                                 | What the element class attribute looks like |\n         * |------------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.addClass(element, 'super') is called                                               | class=\"my-animation\"                        |\n         * | 2. $animate runs any JavaScript-defined animations on the element                              | class=\"my-animation ng-animate\"             |\n         * | 3. the .super-add class are added to the element                                               | class=\"my-animation ng-animate super-add\"   |\n         * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay    | class=\"my-animation ng-animate super-add\"   |\n         * | 5. $animate waits for 10ms (this performs a reflow)                                            | class=\"my-animation ng-animate super-add\"   |\n         * | 6. the .super, .super-add-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active super super-add super-add-active\"          |\n         * | 7. $animate waits for X milliseconds for the animation to complete                             | class=\"my-animation super super-add super-add-active\"  |\n         * | 8. The animation ends and all generated CSS classes are removed from the element               | class=\"my-animation super\"                  |\n         * | 9. The super class is kept on the element                                                      | class=\"my-animation super\"                  |\n         * | 10. The doneCallback() callback is fired (if provided)                                         | class=\"my-animation super\"                  |\n         *\n         * @param {DOMElement} element the element that will be animated\n         * @param {string} className the CSS class that will be added to the element and then animated\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        addClass : function(element, className, doneCallback) {\n          element = angular.element(element);\n          element = stripCommentsFromElement(element);\n          performAnimation('addClass', className, element, null, null, function() {\n            $delegate.addClass(element, className);\n          }, doneCallback);\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#removeClass\n         *\n         * @description\n         * Triggers a custom animation event based off the className variable and then removes the CSS class provided by the className value\n         * from the element. Unlike the other animation methods, the animate service will suffix the className value with {@type -remove} in\n         * order to provide the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if\n         * no CSS transitions or keyframes are defined on the -remove or base CSS classes).\n         *\n         * Below is a breakdown of each step that occurs during removeClass animation:\n         *\n         * | Animation Step                                                                                | What the element class attribute looks like     |\n         * |-----------------------------------------------------------------------------------------------|---------------------------------------------|\n         * | 1. $animate.removeClass(element, 'super') is called                                           | class=\"my-animation super\"                  |\n         * | 2. $animate runs any JavaScript-defined animations on the element                             | class=\"my-animation super ng-animate\"       |\n         * | 3. the .super-remove class are added to the element                                           | class=\"my-animation super ng-animate super-remove\"|\n         * | 4. $animate scans the element styles to get the CSS transition/animation duration and delay   | class=\"my-animation super ng-animate super-remove\"   |\n         * | 5. $animate waits for 10ms (this performs a reflow)                                           | class=\"my-animation super ng-animate super-remove\"   |\n         * | 6. the .super-remove-active and .ng-animate-active classes are added and .super is removed (this triggers the CSS transition/animation) | class=\"my-animation ng-animate ng-animate-active super-remove super-remove-active\"          |\n         * | 7. $animate waits for X milliseconds for the animation to complete                            | class=\"my-animation ng-animate ng-animate-active super-remove super-remove-active\"   |\n         * | 8. The animation ends and all generated CSS classes are removed from the element              | class=\"my-animation\"                        |\n         * | 9. The doneCallback() callback is fired (if provided)                                         | class=\"my-animation\"                        |\n         *\n         *\n         * @param {DOMElement} element the element that will be animated\n         * @param {string} className the CSS class that will be animated and then removed from the element\n         * @param {function()=} doneCallback the callback function that will be called once the animation is complete\n        */\n        removeClass : function(element, className, doneCallback) {\n          element = angular.element(element);\n          element = stripCommentsFromElement(element);\n          performAnimation('removeClass', className, element, null, null, function() {\n            $delegate.removeClass(element, className);\n          }, doneCallback);\n        },\n\n          /**\n           *\n           * @ngdoc function\n           * @name $animate#setClass\n           * @function\n           * @description Adds and/or removes the given CSS classes to and from the element.\n           * Once complete, the done() callback will be fired (if provided).\n           * @param {DOMElement} element the element which will its CSS classes changed\n           *   removed from it\n           * @param {string} add the CSS classes which will be added to the element\n           * @param {string} remove the CSS class which will be removed from the element\n           * @param {Function=} done the callback function (if provided) that will be fired after the\n           *   CSS classes have been set on the element\n           */\n        setClass : function(element, add, remove, doneCallback) {\n          element = angular.element(element);\n          element = stripCommentsFromElement(element);\n          performAnimation('setClass', [add, remove], element, null, null, function() {\n            $delegate.setClass(element, add, remove);\n          }, doneCallback);\n        },\n\n        /**\n         * @ngdoc method\n         * @name $animate#enabled\n         * @kind function\n         *\n         * @param {boolean=} value If provided then set the animation on or off.\n         * @param {DOMElement} element If provided then the element will be used to represent the enable/disable operation\n         * @return {boolean} Current animation state.\n         *\n         * @description\n         * Globally enables/disables animations.\n         *\n        */\n        enabled : function(value, element) {\n          switch(arguments.length) {\n            case 2:\n              if(value) {\n                cleanup(element);\n              } else {\n                var data = element.data(NG_ANIMATE_STATE) || {};\n                data.disabled = true;\n                element.data(NG_ANIMATE_STATE, data);\n              }\n            break;\n\n            case 1:\n              rootAnimateState.disabled = !value;\n            break;\n\n            default:\n              value = !rootAnimateState.disabled;\n            break;\n          }\n          return !!value;\n         }\n      };\n\n      /*\n        all animations call this shared animation triggering function internally.\n        The animationEvent variable refers to the JavaScript animation event that will be triggered\n        and the className value is the name of the animation that will be applied within the\n        CSS code. Element, parentElement and afterElement are provided DOM elements for the animation\n        and the onComplete callback will be fired once the animation is fully complete.\n      */\n      function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) {\n\n        var runner = animationRunner(element, animationEvent, className);\n        if(!runner) {\n          fireDOMOperation();\n          fireBeforeCallbackAsync();\n          fireAfterCallbackAsync();\n          closeAnimation();\n          return;\n        }\n\n        className = runner.className;\n        var elementEvents = angular.element._data(runner.node);\n        elementEvents = elementEvents && elementEvents.events;\n\n        if (!parentElement) {\n          parentElement = afterElement ? afterElement.parent() : element.parent();\n        }\n\n        var ngAnimateState  = element.data(NG_ANIMATE_STATE) || {};\n        var runningAnimations     = ngAnimateState.active || {};\n        var totalActiveAnimations = ngAnimateState.totalActive || 0;\n        var lastAnimation         = ngAnimateState.last;\n\n        //only allow animations if the currently running animation is not structural\n        //or if there is no animation running at all\n        var skipAnimations = runner.isClassBased ?\n          ngAnimateState.disabled || (lastAnimation && !lastAnimation.isClassBased) :\n          false;\n\n        //skip the animation if animations are disabled, a parent is already being animated,\n        //the element is not currently attached to the document body or then completely close\n        //the animation if any matching animations are not found at all.\n        //NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case an animation was found.\n        if (skipAnimations || animationsDisabled(element, parentElement)) {\n          fireDOMOperation();\n          fireBeforeCallbackAsync();\n          fireAfterCallbackAsync();\n          closeAnimation();\n          return;\n        }\n\n        var skipAnimation = false;\n        if(totalActiveAnimations > 0) {\n          var animationsToCancel = [];\n          if(!runner.isClassBased) {\n            if(animationEvent == 'leave' && runningAnimations['ng-leave']) {\n              skipAnimation = true;\n            } else {\n              //cancel all animations when a structural animation takes place\n              for(var klass in runningAnimations) {\n                animationsToCancel.push(runningAnimations[klass]);\n                cleanup(element, klass);\n              }\n              runningAnimations = {};\n              totalActiveAnimations = 0;\n            }\n          } else if(lastAnimation.event == 'setClass') {\n            animationsToCancel.push(lastAnimation);\n            cleanup(element, className);\n          }\n          else if(runningAnimations[className]) {\n            var current = runningAnimations[className];\n            if(current.event == animationEvent) {\n              skipAnimation = true;\n            } else {\n              animationsToCancel.push(current);\n              cleanup(element, className);\n            }\n          }\n\n          if(animationsToCancel.length > 0) {\n            forEach(animationsToCancel, function(operation) {\n              operation.cancel();\n            });\n          }\n        }\n\n        if(runner.isClassBased && !runner.isSetClassOperation && !skipAnimation) {\n          skipAnimation = (animationEvent == 'addClass') == element.hasClass(className); //opposite of XOR\n        }\n\n        if(skipAnimation) {\n          fireDOMOperation();\n          fireBeforeCallbackAsync();\n          fireAfterCallbackAsync();\n          fireDoneCallbackAsync();\n          return;\n        }\n\n        if(animationEvent == 'leave') {\n          //there's no need to ever remove the listener since the element\n          //will be removed (destroyed) after the leave animation ends or\n          //is cancelled midway\n          element.one('$destroy', function(e) {\n            var element = angular.element(this);\n            var state = element.data(NG_ANIMATE_STATE);\n            if(state) {\n              var activeLeaveAnimation = state.active['ng-leave'];\n              if(activeLeaveAnimation) {\n                activeLeaveAnimation.cancel();\n                cleanup(element, 'ng-leave');\n              }\n            }\n          });\n        }\n\n        //the ng-animate class does nothing, but it's here to allow for\n        //parent animations to find and cancel child animations when needed\n        element.addClass(NG_ANIMATE_CLASS_NAME);\n\n        var localAnimationCount = globalAnimationCounter++;\n        totalActiveAnimations++;\n        runningAnimations[className] = runner;\n\n        element.data(NG_ANIMATE_STATE, {\n          last : runner,\n          active : runningAnimations,\n          index : localAnimationCount,\n          totalActive : totalActiveAnimations\n        });\n\n        //first we run the before animations and when all of those are complete\n        //then we perform the DOM operation and run the next set of animations\n        fireBeforeCallbackAsync();\n        runner.before(function(cancelled) {\n          var data = element.data(NG_ANIMATE_STATE);\n          cancelled = cancelled ||\n                        !data || !data.active[className] ||\n                        (runner.isClassBased && data.active[className].event != animationEvent);\n\n          fireDOMOperation();\n          if(cancelled === true) {\n            closeAnimation();\n          } else {\n            fireAfterCallbackAsync();\n            runner.after(closeAnimation);\n          }\n        });\n\n        function fireDOMCallback(animationPhase) {\n          var eventName = '$animate:' + animationPhase;\n          if(elementEvents && elementEvents[eventName] && elementEvents[eventName].length > 0) {\n            $$asyncCallback(function() {\n              element.triggerHandler(eventName, {\n                event : animationEvent,\n                className : className\n              });\n            });\n          }\n        }\n\n        function fireBeforeCallbackAsync() {\n          fireDOMCallback('before');\n        }\n\n        function fireAfterCallbackAsync() {\n          fireDOMCallback('after');\n        }\n\n        function fireDoneCallbackAsync() {\n          fireDOMCallback('close');\n          if(doneCallback) {\n            $$asyncCallback(function() {\n              doneCallback();\n            });\n          }\n        }\n\n        //it is less complicated to use a flag than managing and canceling\n        //timeouts containing multiple callbacks.\n        function fireDOMOperation() {\n          if(!fireDOMOperation.hasBeenRun) {\n            fireDOMOperation.hasBeenRun = true;\n            domOperation();\n          }\n        }\n\n        function closeAnimation() {\n          if(!closeAnimation.hasBeenRun) {\n            closeAnimation.hasBeenRun = true;\n            var data = element.data(NG_ANIMATE_STATE);\n            if(data) {\n              /* only structural animations wait for reflow before removing an\n                 animation, but class-based animations don't. An example of this\n                 failing would be when a parent HTML tag has a ng-class attribute\n                 causing ALL directives below to skip animations during the digest */\n              if(runner && runner.isClassBased) {\n                cleanup(element, className);\n              } else {\n                $$asyncCallback(function() {\n                  var data = element.data(NG_ANIMATE_STATE) || {};\n                  if(localAnimationCount == data.index) {\n                    cleanup(element, className, animationEvent);\n                  }\n                });\n                element.data(NG_ANIMATE_STATE, data);\n              }\n            }\n            fireDoneCallbackAsync();\n          }\n        }\n      }\n\n      function cancelChildAnimations(element) {\n        var node = extractElementNode(element);\n        if (node) {\n          var nodes = angular.isFunction(node.getElementsByClassName) ?\n            node.getElementsByClassName(NG_ANIMATE_CLASS_NAME) :\n            node.querySelectorAll('.' + NG_ANIMATE_CLASS_NAME);\n          forEach(nodes, function(element) {\n            element = angular.element(element);\n            var data = element.data(NG_ANIMATE_STATE);\n            if(data && data.active) {\n              forEach(data.active, function(runner) {\n                runner.cancel();\n              });\n            }\n          });\n        }\n      }\n\n      function cleanup(element, className) {\n        if(isMatchingElement(element, $rootElement)) {\n          if(!rootAnimateState.disabled) {\n            rootAnimateState.running = false;\n            rootAnimateState.structural = false;\n          }\n        } else if(className) {\n          var data = element.data(NG_ANIMATE_STATE) || {};\n\n          var removeAnimations = className === true;\n          if(!removeAnimations && data.active && data.active[className]) {\n            data.totalActive--;\n            delete data.active[className];\n          }\n\n          if(removeAnimations || !data.totalActive) {\n            element.removeClass(NG_ANIMATE_CLASS_NAME);\n            element.removeData(NG_ANIMATE_STATE);\n          }\n        }\n      }\n\n      function animationsDisabled(element, parentElement) {\n        if (rootAnimateState.disabled) return true;\n\n        if(isMatchingElement(element, $rootElement)) {\n          return rootAnimateState.disabled || rootAnimateState.running;\n        }\n\n        do {\n          //the element did not reach the root element which means that it\n          //is not apart of the DOM. Therefore there is no reason to do\n          //any animations on it\n          if(parentElement.length === 0) break;\n\n          var isRoot = isMatchingElement(parentElement, $rootElement);\n          var state = isRoot ? rootAnimateState : parentElement.data(NG_ANIMATE_STATE);\n          var result = state && (!!state.disabled || state.running || state.totalActive > 0);\n          if(isRoot || result) {\n            return result;\n          }\n\n          if(isRoot) return true;\n        }\n        while(parentElement = parentElement.parent());\n\n        return true;\n      }\n    }]);\n\n    $animateProvider.register('', ['$window', '$sniffer', '$timeout', '$$animateReflow',\n                           function($window,   $sniffer,   $timeout,   $$animateReflow) {\n      // Detect proper transitionend/animationend event names.\n      var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;\n\n      // If unprefixed events are not supported but webkit-prefixed are, use the latter.\n      // Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.\n      // Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`\n      // but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.\n      // Register both events in case `window.onanimationend` is not supported because of that,\n      // do the same for `transitionend` as Safari is likely to exhibit similar behavior.\n      // Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit\n      // therefore there is no reason to test anymore for other vendor prefixes: http://caniuse.com/#search=transition\n      if (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {\n        CSS_PREFIX = '-webkit-';\n        TRANSITION_PROP = 'WebkitTransition';\n        TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';\n      } else {\n        TRANSITION_PROP = 'transition';\n        TRANSITIONEND_EVENT = 'transitionend';\n      }\n\n      if (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {\n        CSS_PREFIX = '-webkit-';\n        ANIMATION_PROP = 'WebkitAnimation';\n        ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';\n      } else {\n        ANIMATION_PROP = 'animation';\n        ANIMATIONEND_EVENT = 'animationend';\n      }\n\n      var DURATION_KEY = 'Duration';\n      var PROPERTY_KEY = 'Property';\n      var DELAY_KEY = 'Delay';\n      var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';\n      var NG_ANIMATE_PARENT_KEY = '$$ngAnimateKey';\n      var NG_ANIMATE_CSS_DATA_KEY = '$$ngAnimateCSS3Data';\n      var NG_ANIMATE_BLOCK_CLASS_NAME = 'ng-animate-block-transitions';\n      var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;\n      var CLOSING_TIME_BUFFER = 1.5;\n      var ONE_SECOND = 1000;\n\n      var lookupCache = {};\n      var parentCounter = 0;\n      var animationReflowQueue = [];\n      var cancelAnimationReflow;\n      function afterReflow(element, callback) {\n        if(cancelAnimationReflow) {\n          cancelAnimationReflow();\n        }\n        animationReflowQueue.push(callback);\n        cancelAnimationReflow = $$animateReflow(function() {\n          forEach(animationReflowQueue, function(fn) {\n            fn();\n          });\n\n          animationReflowQueue = [];\n          cancelAnimationReflow = null;\n          lookupCache = {};\n        });\n      }\n\n      var closingTimer = null;\n      var closingTimestamp = 0;\n      var animationElementQueue = [];\n      function animationCloseHandler(element, totalTime) {\n        var node = extractElementNode(element);\n        element = angular.element(node);\n\n        //this item will be garbage collected by the closing\n        //animation timeout\n        animationElementQueue.push(element);\n\n        //but it may not need to cancel out the existing timeout\n        //if the timestamp is less than the previous one\n        var futureTimestamp = Date.now() + totalTime;\n        if(futureTimestamp <= closingTimestamp) {\n          return;\n        }\n\n        $timeout.cancel(closingTimer);\n\n        closingTimestamp = futureTimestamp;\n        closingTimer = $timeout(function() {\n          closeAllAnimations(animationElementQueue);\n          animationElementQueue = [];\n        }, totalTime, false);\n      }\n\n      function closeAllAnimations(elements) {\n        forEach(elements, function(element) {\n          var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);\n          if(elementData) {\n            (elementData.closeAnimationFn || noop)();\n          }\n        });\n      }\n\n      function getElementAnimationDetails(element, cacheKey) {\n        var data = cacheKey ? lookupCache[cacheKey] : null;\n        if(!data) {\n          var transitionDuration = 0;\n          var transitionDelay = 0;\n          var animationDuration = 0;\n          var animationDelay = 0;\n          var transitionDelayStyle;\n          var animationDelayStyle;\n          var transitionDurationStyle;\n          var transitionPropertyStyle;\n\n          //we want all the styles defined before and after\n          forEach(element, function(element) {\n            if (element.nodeType == ELEMENT_NODE) {\n              var elementStyles = $window.getComputedStyle(element) || {};\n\n              transitionDurationStyle = elementStyles[TRANSITION_PROP + DURATION_KEY];\n\n              transitionDuration = Math.max(parseMaxTime(transitionDurationStyle), transitionDuration);\n\n              transitionPropertyStyle = elementStyles[TRANSITION_PROP + PROPERTY_KEY];\n\n              transitionDelayStyle = elementStyles[TRANSITION_PROP + DELAY_KEY];\n\n              transitionDelay  = Math.max(parseMaxTime(transitionDelayStyle), transitionDelay);\n\n              animationDelayStyle = elementStyles[ANIMATION_PROP + DELAY_KEY];\n\n              animationDelay   = Math.max(parseMaxTime(animationDelayStyle), animationDelay);\n\n              var aDuration  = parseMaxTime(elementStyles[ANIMATION_PROP + DURATION_KEY]);\n\n              if(aDuration > 0) {\n                aDuration *= parseInt(elementStyles[ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY], 10) || 1;\n              }\n\n              animationDuration = Math.max(aDuration, animationDuration);\n            }\n          });\n          data = {\n            total : 0,\n            transitionPropertyStyle: transitionPropertyStyle,\n            transitionDurationStyle: transitionDurationStyle,\n            transitionDelayStyle: transitionDelayStyle,\n            transitionDelay: transitionDelay,\n            transitionDuration: transitionDuration,\n            animationDelayStyle: animationDelayStyle,\n            animationDelay: animationDelay,\n            animationDuration: animationDuration\n          };\n          if(cacheKey) {\n            lookupCache[cacheKey] = data;\n          }\n        }\n        return data;\n      }\n\n      function parseMaxTime(str) {\n        var maxValue = 0;\n        var values = angular.isString(str) ?\n          str.split(/\\s*,\\s*/) :\n          [];\n        forEach(values, function(value) {\n          maxValue = Math.max(parseFloat(value) || 0, maxValue);\n        });\n        return maxValue;\n      }\n\n      function getCacheKey(element) {\n        var parentElement = element.parent();\n        var parentID = parentElement.data(NG_ANIMATE_PARENT_KEY);\n        if(!parentID) {\n          parentElement.data(NG_ANIMATE_PARENT_KEY, ++parentCounter);\n          parentID = parentCounter;\n        }\n        return parentID + '-' + extractElementNode(element).getAttribute('class');\n      }\n\n      function animateSetup(animationEvent, element, className, calculationDecorator) {\n        var cacheKey = getCacheKey(element);\n        var eventCacheKey = cacheKey + ' ' + className;\n        var itemIndex = lookupCache[eventCacheKey] ? ++lookupCache[eventCacheKey].total : 0;\n\n        var stagger = {};\n        if(itemIndex > 0) {\n          var staggerClassName = className + '-stagger';\n          var staggerCacheKey = cacheKey + ' ' + staggerClassName;\n          var applyClasses = !lookupCache[staggerCacheKey];\n\n          applyClasses && element.addClass(staggerClassName);\n\n          stagger = getElementAnimationDetails(element, staggerCacheKey);\n\n          applyClasses && element.removeClass(staggerClassName);\n        }\n\n        /* the animation itself may need to add/remove special CSS classes\n         * before calculating the anmation styles */\n        calculationDecorator = calculationDecorator ||\n                               function(fn) { return fn(); };\n\n        element.addClass(className);\n\n        var formerData = element.data(NG_ANIMATE_CSS_DATA_KEY) || {};\n\n        var timings = calculationDecorator(function() {\n          return getElementAnimationDetails(element, eventCacheKey);\n        });\n\n        var transitionDuration = timings.transitionDuration;\n        var animationDuration = timings.animationDuration;\n        if(transitionDuration === 0 && animationDuration === 0) {\n          element.removeClass(className);\n          return false;\n        }\n\n        element.data(NG_ANIMATE_CSS_DATA_KEY, {\n          running : formerData.running || 0,\n          itemIndex : itemIndex,\n          stagger : stagger,\n          timings : timings,\n          closeAnimationFn : noop\n        });\n\n        //temporarily disable the transition so that the enter styles\n        //don't animate twice (this is here to avoid a bug in Chrome/FF).\n        var isCurrentlyAnimating = formerData.running > 0 || animationEvent == 'setClass';\n        if(transitionDuration > 0) {\n          blockTransitions(element, className, isCurrentlyAnimating);\n        }\n\n        //staggering keyframe animations work by adjusting the `animation-delay` CSS property\n        //on the given element, however, the delay value can only calculated after the reflow\n        //since by that time $animate knows how many elements are being animated. Therefore,\n        //until the reflow occurs the element needs to be blocked (where the keyframe animation\n        //is set to `none 0s`). This blocking mechanism should only be set for when a stagger\n        //animation is detected and when the element item index is greater than 0.\n        if(animationDuration > 0 && stagger.animationDelay > 0 && stagger.animationDuration === 0) {\n          blockKeyframeAnimations(element);\n        }\n\n        return true;\n      }\n\n      function isStructuralAnimation(className) {\n        return className == 'ng-enter' || className == 'ng-move' || className == 'ng-leave';\n      }\n\n      function blockTransitions(element, className, isAnimating) {\n        if(isStructuralAnimation(className) || !isAnimating) {\n          extractElementNode(element).style[TRANSITION_PROP + PROPERTY_KEY] = 'none';\n        } else {\n          element.addClass(NG_ANIMATE_BLOCK_CLASS_NAME);\n        }\n      }\n\n      function blockKeyframeAnimations(element) {\n        extractElementNode(element).style[ANIMATION_PROP] = 'none 0s';\n      }\n\n      function unblockTransitions(element, className) {\n        var prop = TRANSITION_PROP + PROPERTY_KEY;\n        var node = extractElementNode(element);\n        if(node.style[prop] && node.style[prop].length > 0) {\n          node.style[prop] = '';\n        }\n        element.removeClass(NG_ANIMATE_BLOCK_CLASS_NAME);\n      }\n\n      function unblockKeyframeAnimations(element) {\n        var prop = ANIMATION_PROP;\n        var node = extractElementNode(element);\n        if(node.style[prop] && node.style[prop].length > 0) {\n          node.style[prop] = '';\n        }\n      }\n\n      function animateRun(animationEvent, element, className, activeAnimationComplete) {\n        var node = extractElementNode(element);\n        var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);\n        if(node.getAttribute('class').indexOf(className) == -1 || !elementData) {\n          activeAnimationComplete();\n          return;\n        }\n\n        var activeClassName = '';\n        forEach(className.split(' '), function(klass, i) {\n          activeClassName += (i > 0 ? ' ' : '') + klass + '-active';\n        });\n\n        var stagger = elementData.stagger;\n        var timings = elementData.timings;\n        var itemIndex = elementData.itemIndex;\n        var maxDuration = Math.max(timings.transitionDuration, timings.animationDuration);\n        var maxDelay = Math.max(timings.transitionDelay, timings.animationDelay);\n        var maxDelayTime = maxDelay * ONE_SECOND;\n\n        var startTime = Date.now();\n        var css3AnimationEvents = ANIMATIONEND_EVENT + ' ' + TRANSITIONEND_EVENT;\n\n        var style = '', appliedStyles = [];\n        if(timings.transitionDuration > 0) {\n          var propertyStyle = timings.transitionPropertyStyle;\n          if(propertyStyle.indexOf('all') == -1) {\n            style += CSS_PREFIX + 'transition-property: ' + propertyStyle + ';';\n            style += CSS_PREFIX + 'transition-duration: ' + timings.transitionDurationStyle + ';';\n            appliedStyles.push(CSS_PREFIX + 'transition-property');\n            appliedStyles.push(CSS_PREFIX + 'transition-duration');\n          }\n        }\n\n        if(itemIndex > 0) {\n          if(stagger.transitionDelay > 0 && stagger.transitionDuration === 0) {\n            var delayStyle = timings.transitionDelayStyle;\n            style += CSS_PREFIX + 'transition-delay: ' +\n                     prepareStaggerDelay(delayStyle, stagger.transitionDelay, itemIndex) + '; ';\n            appliedStyles.push(CSS_PREFIX + 'transition-delay');\n          }\n\n          if(stagger.animationDelay > 0 && stagger.animationDuration === 0) {\n            style += CSS_PREFIX + 'animation-delay: ' +\n                     prepareStaggerDelay(timings.animationDelayStyle, stagger.animationDelay, itemIndex) + '; ';\n            appliedStyles.push(CSS_PREFIX + 'animation-delay');\n          }\n        }\n\n        if(appliedStyles.length > 0) {\n          //the element being animated may sometimes contain comment nodes in\n          //the jqLite object, so we're safe to use a single variable to house\n          //the styles since there is always only one element being animated\n          var oldStyle = node.getAttribute('style') || '';\n          node.setAttribute('style', oldStyle + '; ' + style);\n        }\n\n        element.on(css3AnimationEvents, onAnimationProgress);\n        element.addClass(activeClassName);\n        elementData.closeAnimationFn = function() {\n          onEnd();\n          activeAnimationComplete();\n        };\n\n        var staggerTime       = itemIndex * (Math.max(stagger.animationDelay, stagger.transitionDelay) || 0);\n        var animationTime     = (maxDelay + maxDuration) * CLOSING_TIME_BUFFER;\n        var totalTime         = (staggerTime + animationTime) * ONE_SECOND;\n\n        elementData.running++;\n        animationCloseHandler(element, totalTime);\n        return onEnd;\n\n        // This will automatically be called by $animate so\n        // there is no need to attach this internally to the\n        // timeout done method.\n        function onEnd(cancelled) {\n          element.off(css3AnimationEvents, onAnimationProgress);\n          element.removeClass(activeClassName);\n          animateClose(element, className);\n          var node = extractElementNode(element);\n          for (var i in appliedStyles) {\n            node.style.removeProperty(appliedStyles[i]);\n          }\n        }\n\n        function onAnimationProgress(event) {\n          event.stopPropagation();\n          var ev = event.originalEvent || event;\n          var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();\n\n          /* Firefox (or possibly just Gecko) likes to not round values up\n           * when a ms measurement is used for the animation */\n          var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));\n\n          /* $manualTimeStamp is a mocked timeStamp value which is set\n           * within browserTrigger(). This is only here so that tests can\n           * mock animations properly. Real events fallback to event.timeStamp,\n           * or, if they don't, then a timeStamp is automatically created for them.\n           * We're checking to see if the timeStamp surpasses the expected delay,\n           * but we're using elapsedTime instead of the timeStamp on the 2nd\n           * pre-condition since animations sometimes close off early */\n          if(Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {\n            activeAnimationComplete();\n          }\n        }\n      }\n\n      function prepareStaggerDelay(delayStyle, staggerDelay, index) {\n        var style = '';\n        forEach(delayStyle.split(','), function(val, i) {\n          style += (i > 0 ? ',' : '') +\n                   (index * staggerDelay + parseInt(val, 10)) + 's';\n        });\n        return style;\n      }\n\n      function animateBefore(animationEvent, element, className, calculationDecorator) {\n        if(animateSetup(animationEvent, element, className, calculationDecorator)) {\n          return function(cancelled) {\n            cancelled && animateClose(element, className);\n          };\n        }\n      }\n\n      function animateAfter(animationEvent, element, className, afterAnimationComplete) {\n        if(element.data(NG_ANIMATE_CSS_DATA_KEY)) {\n          return animateRun(animationEvent, element, className, afterAnimationComplete);\n        } else {\n          animateClose(element, className);\n          afterAnimationComplete();\n        }\n      }\n\n      function animate(animationEvent, element, className, animationComplete) {\n        //If the animateSetup function doesn't bother returning a\n        //cancellation function then it means that there is no animation\n        //to perform at all\n        var preReflowCancellation = animateBefore(animationEvent, element, className);\n        if(!preReflowCancellation) {\n          animationComplete();\n          return;\n        }\n\n        //There are two cancellation functions: one is before the first\n        //reflow animation and the second is during the active state\n        //animation. The first function will take care of removing the\n        //data from the element which will not make the 2nd animation\n        //happen in the first place\n        var cancel = preReflowCancellation;\n        afterReflow(element, function() {\n          unblockTransitions(element, className);\n          unblockKeyframeAnimations(element);\n          //once the reflow is complete then we point cancel to\n          //the new cancellation function which will remove all of the\n          //animation properties from the active animation\n          cancel = animateAfter(animationEvent, element, className, animationComplete);\n        });\n\n        return function(cancelled) {\n          (cancel || noop)(cancelled);\n        };\n      }\n\n      function animateClose(element, className) {\n        element.removeClass(className);\n        var data = element.data(NG_ANIMATE_CSS_DATA_KEY);\n        if(data) {\n          if(data.running) {\n            data.running--;\n          }\n          if(!data.running || data.running === 0) {\n            element.removeData(NG_ANIMATE_CSS_DATA_KEY);\n          }\n        }\n      }\n\n      return {\n        enter : function(element, animationCompleted) {\n          return animate('enter', element, 'ng-enter', animationCompleted);\n        },\n\n        leave : function(element, animationCompleted) {\n          return animate('leave', element, 'ng-leave', animationCompleted);\n        },\n\n        move : function(element, animationCompleted) {\n          return animate('move', element, 'ng-move', animationCompleted);\n        },\n\n        beforeSetClass : function(element, add, remove, animationCompleted) {\n          var className = suffixClasses(remove, '-remove') + ' ' +\n                          suffixClasses(add, '-add');\n          var cancellationMethod = animateBefore('setClass', element, className, function(fn) {\n            /* when classes are removed from an element then the transition style\n             * that is applied is the transition defined on the element without the\n             * CSS class being there. This is how CSS3 functions outside of ngAnimate.\n             * http://plnkr.co/edit/j8OzgTNxHTb4n3zLyjGW?p=preview */\n            var klass = element.attr('class');\n            element.removeClass(remove);\n            element.addClass(add);\n            var timings = fn();\n            element.attr('class', klass);\n            return timings;\n          });\n\n          if(cancellationMethod) {\n            afterReflow(element, function() {\n              unblockTransitions(element, className);\n              unblockKeyframeAnimations(element);\n              animationCompleted();\n            });\n            return cancellationMethod;\n          }\n          animationCompleted();\n        },\n\n        beforeAddClass : function(element, className, animationCompleted) {\n          var cancellationMethod = animateBefore('addClass', element, suffixClasses(className, '-add'), function(fn) {\n\n            /* when a CSS class is added to an element then the transition style that\n             * is applied is the transition defined on the element when the CSS class\n             * is added at the time of the animation. This is how CSS3 functions\n             * outside of ngAnimate. */\n            element.addClass(className);\n            var timings = fn();\n            element.removeClass(className);\n            return timings;\n          });\n\n          if(cancellationMethod) {\n            afterReflow(element, function() {\n              unblockTransitions(element, className);\n              unblockKeyframeAnimations(element);\n              animationCompleted();\n            });\n            return cancellationMethod;\n          }\n          animationCompleted();\n        },\n\n        setClass : function(element, add, remove, animationCompleted) {\n          remove = suffixClasses(remove, '-remove');\n          add = suffixClasses(add, '-add');\n          var className = remove + ' ' + add;\n          return animateAfter('setClass', element, className, animationCompleted);\n        },\n\n        addClass : function(element, className, animationCompleted) {\n          return animateAfter('addClass', element, suffixClasses(className, '-add'), animationCompleted);\n        },\n\n        beforeRemoveClass : function(element, className, animationCompleted) {\n          var cancellationMethod = animateBefore('removeClass', element, suffixClasses(className, '-remove'), function(fn) {\n            /* when classes are removed from an element then the transition style\n             * that is applied is the transition defined on the element without the\n             * CSS class being there. This is how CSS3 functions outside of ngAnimate.\n             * http://plnkr.co/edit/j8OzgTNxHTb4n3zLyjGW?p=preview */\n            var klass = element.attr('class');\n            element.removeClass(className);\n            var timings = fn();\n            element.attr('class', klass);\n            return timings;\n          });\n\n          if(cancellationMethod) {\n            afterReflow(element, function() {\n              unblockTransitions(element, className);\n              unblockKeyframeAnimations(element);\n              animationCompleted();\n            });\n            return cancellationMethod;\n          }\n          animationCompleted();\n        },\n\n        removeClass : function(element, className, animationCompleted) {\n          return animateAfter('removeClass', element, suffixClasses(className, '-remove'), animationCompleted);\n        }\n      };\n\n      function suffixClasses(classes, suffix) {\n        var className = '';\n        classes = angular.isArray(classes) ? classes : classes.split(/\\s+/);\n        forEach(classes, function(klass, i) {\n          if(klass && klass.length > 0) {\n            className += (i > 0 ? ' ' : '') + klass + suffix;\n          }\n        });\n        return className;\n      }\n    }]);\n  }]);\n\n\n})(window, window.angular);\n\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/**\n * @license AngularJS v1.2.17\n * (c) 2010-2014 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\nvar $sanitizeMinErr = angular.$$minErr('$sanitize');\n\n/**\n * @ngdoc module\n * @name ngSanitize\n * @description\n *\n * # ngSanitize\n *\n * The `ngSanitize` module provides functionality to sanitize HTML.\n *\n *\n * <div doc-module-components=\"ngSanitize\"></div>\n *\n * See {@link ngSanitize.$sanitize `$sanitize`} for usage.\n */\n\n/*\n * HTML Parser By Misko Hevery (misko@hevery.com)\n * based on:  HTML Parser By John Resig (ejohn.org)\n * Original code by Erik Arvidsson, Mozilla Public License\n * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js\n *\n * // Use like so:\n * htmlParser(htmlString, {\n *     start: function(tag, attrs, unary) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * });\n *\n */\n\n\n/**\n * @ngdoc service\n * @name $sanitize\n * @kind function\n *\n * @description\n *   The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are\n *   then serialized back to properly escaped html string. This means that no unsafe input can make\n *   it into the returned string, however, since our parser is more strict than a typical browser\n *   parser, it's possible that some obscure input, which would be recognized as valid HTML by a\n *   browser, won't make it through the sanitizer.\n *   The whitelist is configured using the functions `aHrefSanitizationWhitelist` and\n *   `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.\n *\n * @param {string} html Html input.\n * @returns {string} Sanitized html.\n *\n * @example\n   <example module=\"ngSanitize\" deps=\"angular-sanitize.js\">\n   <file name=\"index.html\">\n     <script>\n       function Ctrl($scope, $sce) {\n         $scope.snippet =\n           '<p style=\"color:blue\">an html\\n' +\n           '<em onmouseover=\"this.textContent=\\'PWN3D!\\'\">click here</em>\\n' +\n           'snippet</p>';\n         $scope.deliberatelyTrustDangerousSnippet = function() {\n           return $sce.trustAsHtml($scope.snippet);\n         };\n       }\n     </script>\n     <div ng-controller=\"Ctrl\">\n        Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <td>Directive</td>\n           <td>How</td>\n           <td>Source</td>\n           <td>Rendered</td>\n         </tr>\n         <tr id=\"bind-html-with-sanitize\">\n           <td>ng-bind-html</td>\n           <td>Automatically uses $sanitize</td>\n           <td><pre>&lt;div ng-bind-html=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind-html=\"snippet\"></div></td>\n         </tr>\n         <tr id=\"bind-html-with-trust\">\n           <td>ng-bind-html</td>\n           <td>Bypass $sanitize by explicitly trusting the dangerous value</td>\n           <td>\n           <pre>&lt;div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"&gt;\n&lt;/div&gt;</pre>\n           </td>\n           <td><div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"></div></td>\n         </tr>\n         <tr id=\"bind-default\">\n           <td>ng-bind</td>\n           <td>Automatically escapes</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n       </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should sanitize the html snippet by default', function() {\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('<p>an html\\n<em>click here</em>\\nsnippet</p>');\n     });\n\n     it('should inline raw snippet if bound to a trusted value', function() {\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).\n         toBe(\"<p style=\\\"color:blue\\\">an html\\n\" +\n              \"<em onmouseover=\\\"this.textContent='PWN3D!'\\\">click here</em>\\n\" +\n              \"snippet</p>\");\n     });\n\n     it('should escape snippet without any filter', function() {\n       expect(element(by.css('#bind-default div')).getInnerHtml()).\n         toBe(\"&lt;p style=\\\"color:blue\\\"&gt;an html\\n\" +\n              \"&lt;em onmouseover=\\\"this.textContent='PWN3D!'\\\"&gt;click here&lt;/em&gt;\\n\" +\n              \"snippet&lt;/p&gt;\");\n     });\n\n     it('should update', function() {\n       element(by.model('snippet')).clear();\n       element(by.model('snippet')).sendKeys('new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('new <b>text</b>');\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(\n         'new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(\n         \"new &lt;b onclick=\\\"alert(1)\\\"&gt;text&lt;/b&gt;\");\n     });\n   </file>\n   </example>\n */\nfunction $SanitizeProvider() {\n  this.$get = ['$$sanitizeUri', function($$sanitizeUri) {\n    return function(html) {\n      var buf = [];\n      htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {\n        return !/^unsafe/.test($$sanitizeUri(uri, isImage));\n      }));\n      return buf.join('');\n    };\n  }];\n}\n\nfunction sanitizeText(chars) {\n  var buf = [];\n  var writer = htmlSanitizeWriter(buf, angular.noop);\n  writer.chars(chars);\n  return buf.join('');\n}\n\n\n// Regular Expressions for parsing tags and attributes\nvar START_TAG_REGEXP =\n       /^<\\s*([\\w:-]+)((?:\\s+[\\w:-]+(?:\\s*=\\s*(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)*)\\s*(\\/?)\\s*>/,\n  END_TAG_REGEXP = /^<\\s*\\/\\s*([\\w:-]+)[^>]*>/,\n  ATTR_REGEXP = /([\\w:-]+)(?:\\s*=\\s*(?:(?:\"((?:[^\"])*)\")|(?:'((?:[^'])*)')|([^>\\s]+)))?/g,\n  BEGIN_TAG_REGEXP = /^</,\n  BEGING_END_TAGE_REGEXP = /^<\\s*\\//,\n  COMMENT_REGEXP = /<!--(.*?)-->/g,\n  DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i,\n  CDATA_REGEXP = /<!\\[CDATA\\[(.*?)]]>/g,\n  SURROGATE_PAIR_REGEXP = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\n  // Match everything outside of normal chars and \" (quote character)\n  NON_ALPHANUMERIC_REGEXP = /([^\\#-~| |!])/g;\n\n\n// Good source of info about elements and attributes\n// http://dev.w3.org/html5/spec/Overview.html#semantics\n// http://simon.html5.org/html-elements\n\n// Safe Void Elements - HTML5\n// http://dev.w3.org/html5/spec/Overview.html#void-elements\nvar voidElements = makeMap(\"area,br,col,hr,img,wbr\");\n\n// Elements that you can, intentionally, leave open (and which close themselves)\n// http://dev.w3.org/html5/spec/Overview.html#optional-tags\nvar optionalEndTagBlockElements = makeMap(\"colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr\"),\n    optionalEndTagInlineElements = makeMap(\"rp,rt\"),\n    optionalEndTagElements = angular.extend({},\n                                            optionalEndTagInlineElements,\n                                            optionalEndTagBlockElements);\n\n// Safe Block Elements - HTML5\nvar blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap(\"address,article,\" +\n        \"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,\" +\n        \"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul\"));\n\n// Inline Elements - HTML5\nvar inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap(\"a,abbr,acronym,b,\" +\n        \"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,\" +\n        \"samp,small,span,strike,strong,sub,sup,time,tt,u,var\"));\n\n\n// Special Elements (can contain anything)\nvar specialElements = makeMap(\"script,style\");\n\nvar validElements = angular.extend({},\n                                   voidElements,\n                                   blockElements,\n                                   inlineElements,\n                                   optionalEndTagElements);\n\n//Attributes that have href and hence need to be sanitized\nvar uriAttrs = makeMap(\"background,cite,href,longdesc,src,usemap\");\nvar validAttrs = angular.extend({}, uriAttrs, makeMap(\n    'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+\n    'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+\n    'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+\n    'scope,scrolling,shape,size,span,start,summary,target,title,type,'+\n    'valign,value,vspace,width'));\n\nfunction makeMap(str) {\n  var obj = {}, items = str.split(','), i;\n  for (i = 0; i < items.length; i++) obj[items[i]] = true;\n  return obj;\n}\n\n\n/**\n * @example\n * htmlParser(htmlString, {\n *     start: function(tag, attrs, unary) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * });\n *\n * @param {string} html string\n * @param {object} handler\n */\nfunction htmlParser( html, handler ) {\n  var index, chars, match, stack = [], last = html;\n  stack.last = function() { return stack[ stack.length - 1 ]; };\n\n  while ( html ) {\n    chars = true;\n\n    // Make sure we're not in a script or style element\n    if ( !stack.last() || !specialElements[ stack.last() ] ) {\n\n      // Comment\n      if ( html.indexOf(\"<!--\") === 0 ) {\n        // comments containing -- are not allowed unless they terminate the comment\n        index = html.indexOf(\"--\", 4);\n\n        if ( index >= 0 && html.lastIndexOf(\"-->\", index) === index) {\n          if (handler.comment) handler.comment( html.substring( 4, index ) );\n          html = html.substring( index + 3 );\n          chars = false;\n        }\n      // DOCTYPE\n      } else if ( DOCTYPE_REGEXP.test(html) ) {\n        match = html.match( DOCTYPE_REGEXP );\n\n        if ( match ) {\n          html = html.replace( match[0], '');\n          chars = false;\n        }\n      // end tag\n      } else if ( BEGING_END_TAGE_REGEXP.test(html) ) {\n        match = html.match( END_TAG_REGEXP );\n\n        if ( match ) {\n          html = html.substring( match[0].length );\n          match[0].replace( END_TAG_REGEXP, parseEndTag );\n          chars = false;\n        }\n\n      // start tag\n      } else if ( BEGIN_TAG_REGEXP.test(html) ) {\n        match = html.match( START_TAG_REGEXP );\n\n        if ( match ) {\n          html = html.substring( match[0].length );\n          match[0].replace( START_TAG_REGEXP, parseStartTag );\n          chars = false;\n        }\n      }\n\n      if ( chars ) {\n        index = html.indexOf(\"<\");\n\n        var text = index < 0 ? html : html.substring( 0, index );\n        html = index < 0 ? \"\" : html.substring( index );\n\n        if (handler.chars) handler.chars( decodeEntities(text) );\n      }\n\n    } else {\n      html = html.replace(new RegExp(\"(.*)<\\\\s*\\\\/\\\\s*\" + stack.last() + \"[^>]*>\", 'i'),\n        function(all, text){\n          text = text.replace(COMMENT_REGEXP, \"$1\").replace(CDATA_REGEXP, \"$1\");\n\n          if (handler.chars) handler.chars( decodeEntities(text) );\n\n          return \"\";\n      });\n\n      parseEndTag( \"\", stack.last() );\n    }\n\n    if ( html == last ) {\n      throw $sanitizeMinErr('badparse', \"The sanitizer was unable to parse the following block \" +\n                                        \"of html: {0}\", html);\n    }\n    last = html;\n  }\n\n  // Clean up any remaining tags\n  parseEndTag();\n\n  function parseStartTag( tag, tagName, rest, unary ) {\n    tagName = angular.lowercase(tagName);\n    if ( blockElements[ tagName ] ) {\n      while ( stack.last() && inlineElements[ stack.last() ] ) {\n        parseEndTag( \"\", stack.last() );\n      }\n    }\n\n    if ( optionalEndTagElements[ tagName ] && stack.last() == tagName ) {\n      parseEndTag( \"\", tagName );\n    }\n\n    unary = voidElements[ tagName ] || !!unary;\n\n    if ( !unary )\n      stack.push( tagName );\n\n    var attrs = {};\n\n    rest.replace(ATTR_REGEXP,\n      function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {\n        var value = doubleQuotedValue\n          || singleQuotedValue\n          || unquotedValue\n          || '';\n\n        attrs[name] = decodeEntities(value);\n    });\n    if (handler.start) handler.start( tagName, attrs, unary );\n  }\n\n  function parseEndTag( tag, tagName ) {\n    var pos = 0, i;\n    tagName = angular.lowercase(tagName);\n    if ( tagName )\n      // Find the closest opened tag of the same type\n      for ( pos = stack.length - 1; pos >= 0; pos-- )\n        if ( stack[ pos ] == tagName )\n          break;\n\n    if ( pos >= 0 ) {\n      // Close all the open elements, up the stack\n      for ( i = stack.length - 1; i >= pos; i-- )\n        if (handler.end) handler.end( stack[ i ] );\n\n      // Remove the open elements from the stack\n      stack.length = pos;\n    }\n  }\n}\n\nvar hiddenPre=document.createElement(\"pre\");\nvar spaceRe = /^(\\s*)([\\s\\S]*?)(\\s*)$/;\n/**\n * decodes all entities into regular string\n * @param value\n * @returns {string} A string with decoded entities.\n */\nfunction decodeEntities(value) {\n  if (!value) { return ''; }\n\n  // Note: IE8 does not preserve spaces at the start/end of innerHTML\n  // so we must capture them and reattach them afterward\n  var parts = spaceRe.exec(value);\n  var spaceBefore = parts[1];\n  var spaceAfter = parts[3];\n  var content = parts[2];\n  if (content) {\n    hiddenPre.innerHTML=content.replace(/</g,\"&lt;\");\n    // innerText depends on styling as it doesn't display hidden elements.\n    // Therefore, it's better to use textContent not to cause unnecessary\n    // reflows. However, IE<9 don't support textContent so the innerText\n    // fallback is necessary.\n    content = 'textContent' in hiddenPre ?\n      hiddenPre.textContent : hiddenPre.innerText;\n  }\n  return spaceBefore + content + spaceAfter;\n}\n\n/**\n * Escapes all potentially dangerous characters, so that the\n * resulting string can be safely inserted into attribute or\n * element text.\n * @param value\n * @returns {string} escaped text\n */\nfunction encodeEntities(value) {\n  return value.\n    replace(/&/g, '&amp;').\n    replace(SURROGATE_PAIR_REGEXP, function (value) {\n      var hi = value.charCodeAt(0);\n      var low = value.charCodeAt(1);\n      return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';\n    }).\n    replace(NON_ALPHANUMERIC_REGEXP, function(value){\n      return '&#' + value.charCodeAt(0) + ';';\n    }).\n    replace(/</g, '&lt;').\n    replace(/>/g, '&gt;');\n}\n\n/**\n * create an HTML/XML writer which writes to buffer\n * @param {Array} buf use buf.jain('') to get out sanitized html string\n * @returns {object} in the form of {\n *     start: function(tag, attrs, unary) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * }\n */\nfunction htmlSanitizeWriter(buf, uriValidator){\n  var ignore = false;\n  var out = angular.bind(buf, buf.push);\n  return {\n    start: function(tag, attrs, unary){\n      tag = angular.lowercase(tag);\n      if (!ignore && specialElements[tag]) {\n        ignore = tag;\n      }\n      if (!ignore && validElements[tag] === true) {\n        out('<');\n        out(tag);\n        angular.forEach(attrs, function(value, key){\n          var lkey=angular.lowercase(key);\n          var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');\n          if (validAttrs[lkey] === true &&\n            (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {\n            out(' ');\n            out(key);\n            out('=\"');\n            out(encodeEntities(value));\n            out('\"');\n          }\n        });\n        out(unary ? '/>' : '>');\n      }\n    },\n    end: function(tag){\n        tag = angular.lowercase(tag);\n        if (!ignore && validElements[tag] === true) {\n          out('</');\n          out(tag);\n          out('>');\n        }\n        if (tag == ignore) {\n          ignore = false;\n        }\n      },\n    chars: function(chars){\n        if (!ignore) {\n          out(encodeEntities(chars));\n        }\n      }\n  };\n}\n\n\n// define ngSanitize module and register $sanitize service\nangular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);\n\n/* global sanitizeText: false */\n\n/**\n * @ngdoc filter\n * @name linky\n * @kind function\n *\n * @description\n * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and\n * plain email address links.\n *\n * Requires the {@link ngSanitize `ngSanitize`} module to be installed.\n *\n * @param {string} text Input text.\n * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in.\n * @returns {string} Html-linkified text.\n *\n * @usage\n   <span ng-bind-html=\"linky_expression | linky\"></span>\n *\n * @example\n   <example module=\"ngSanitize\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <script>\n         function Ctrl($scope) {\n           $scope.snippet =\n             'Pretty text with some links:\\n'+\n             'http://angularjs.org/,\\n'+\n             'mailto:us@somewhere.org,\\n'+\n             'another@somewhere.org,\\n'+\n             'and one more: ftp://127.0.0.1/.';\n           $scope.snippetWithTarget = 'http://angularjs.org/';\n         }\n       </script>\n       <div ng-controller=\"Ctrl\">\n       Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <td>Filter</td>\n           <td>Source</td>\n           <td>Rendered</td>\n         </tr>\n         <tr id=\"linky-filter\">\n           <td>linky filter</td>\n           <td>\n             <pre>&lt;div ng-bind-html=\"snippet | linky\"&gt;<br>&lt;/div&gt;</pre>\n           </td>\n           <td>\n             <div ng-bind-html=\"snippet | linky\"></div>\n           </td>\n         </tr>\n         <tr id=\"linky-target\">\n          <td>linky target</td>\n          <td>\n            <pre>&lt;div ng-bind-html=\"snippetWithTarget | linky:'_blank'\"&gt;<br>&lt;/div&gt;</pre>\n          </td>\n          <td>\n            <div ng-bind-html=\"snippetWithTarget | linky:'_blank'\"></div>\n          </td>\n         </tr>\n         <tr id=\"escaped-html\">\n           <td>no filter</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should linkify the snippet with urls', function() {\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);\n       });\n\n       it('should not linkify snippet without the linky filter', function() {\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);\n       });\n\n       it('should update', function() {\n         element(by.model('snippet')).clear();\n         element(by.model('snippet')).sendKeys('new http://link.');\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('new http://link.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())\n             .toBe('new http://link.');\n       });\n\n       it('should work with the target property', function() {\n        expect(element(by.id('linky-target')).\n            element(by.binding(\"snippetWithTarget | linky:'_blank'\")).getText()).\n            toBe('http://angularjs.org/');\n        expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');\n       });\n     </file>\n   </example>\n */\nangular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {\n  var LINKY_URL_REGEXP =\n        /((ftp|https?):\\/\\/|(mailto:)?[A-Za-z0-9._%+-]+@)\\S*[^\\s.;,(){}<>]/,\n      MAILTO_REGEXP = /^mailto:/;\n\n  return function(text, target) {\n    if (!text) return text;\n    var match;\n    var raw = text;\n    var html = [];\n    var url;\n    var i;\n    while ((match = raw.match(LINKY_URL_REGEXP))) {\n      // We can not end in these as they are sometimes found at the end of the sentence\n      url = match[0];\n      // if we did not match ftp/http/mailto then assume mailto\n      if (match[2] == match[3]) url = 'mailto:' + url;\n      i = match.index;\n      addText(raw.substr(0, i));\n      addLink(url, match[0].replace(MAILTO_REGEXP, ''));\n      raw = raw.substring(i + match[0].length);\n    }\n    addText(raw);\n    return $sanitize(html.join(''));\n\n    function addText(text) {\n      if (!text) {\n        return;\n      }\n      html.push(sanitizeText(text));\n    }\n\n    function addLink(url, text) {\n      html.push('<a ');\n      if (angular.isDefined(target)) {\n        html.push('target=\"');\n        html.push(target);\n        html.push('\" ');\n      }\n      html.push('href=\"');\n      html.push(url);\n      html.push('\">');\n      addText(text);\n      html.push('</a>');\n    }\n  };\n}]);\n\n\n})(window, window.angular);\n\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/**\n * State-based routing for AngularJS\n * @version v0.2.10\n * @link http://angular-ui.github.com/\n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n\n/* commonjs package manager support (eg componentjs) */\nif (typeof module !== \"undefined\" && typeof exports !== \"undefined\" && module.exports === exports){\n  module.exports = 'ui.router';\n}\n\n(function (window, angular, undefined) {\n/*jshint globalstrict:true*/\n/*global angular:false*/\n'use strict';\n\nvar isDefined = angular.isDefined,\n    isFunction = angular.isFunction,\n    isString = angular.isString,\n    isObject = angular.isObject,\n    isArray = angular.isArray,\n    forEach = angular.forEach,\n    extend = angular.extend,\n    copy = angular.copy;\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, { prototype: parent }))(), extra);\n}\n\nfunction merge(dst) {\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        if (!dst.hasOwnProperty(key)) dst[key] = value;\n      });\n    }\n  });\n  return dst;\n}\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nfunction ancestors(first, second) {\n  var path = [];\n\n  for (var n in first.path) {\n    if (first.path[n] !== second.path[n]) break;\n    path.push(first.path[n]);\n  }\n  return path;\n}\n\n/**\n * IE8-safe wrapper for `Object.keys()`.\n *\n * @param {Object} object A JavaScript object.\n * @return {Array} Returns the keys of the object as an array.\n */\nfunction keys(object) {\n  if (Object.keys) {\n    return Object.keys(object);\n  }\n  var result = [];\n\n  angular.forEach(object, function(val, key) {\n    result.push(key);\n  });\n  return result;\n}\n\n/**\n * IE8-safe wrapper for `Array.prototype.indexOf()`.\n *\n * @param {Array} array A JavaScript array.\n * @param {*} value A value to search the array for.\n * @return {Number} Returns the array index value of `value`, or `-1` if not present.\n */\nfunction arraySearch(array, value) {\n  if (Array.prototype.indexOf) {\n    return array.indexOf(value, Number(arguments[2]) || 0);\n  }\n  var len = array.length >>> 0, from = Number(arguments[2]) || 0;\n  from = (from < 0) ? Math.ceil(from) : Math.floor(from);\n\n  if (from < 0) from += len;\n\n  for (; from < len; from++) {\n    if (from in array && array[from] === value) return from;\n  }\n  return -1;\n}\n\n/**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} currentParams The value of the current state parameters ($stateParams).\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\nfunction inheritParams(currentParams, newParams, $current, $to) {\n  var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];\n\n  for (var i in parents) {\n    if (!parents[i].params || !parents[i].params.length) continue;\n    parentParams = parents[i].params;\n\n    for (var j in parentParams) {\n      if (arraySearch(inheritList, parentParams[j]) >= 0) continue;\n      inheritList.push(parentParams[j]);\n      inherited[parentParams[j]] = currentParams[parentParams[j]];\n    }\n  }\n  return extend({}, inherited, newParams);\n}\n\n/**\n * Normalizes a set of values to string or `null`, filtering them by a list of keys.\n *\n * @param {Array} keys The list of keys to normalize/return.\n * @param {Object} values An object hash of values to normalize.\n * @return {Object} Returns an object hash of normalized string values.\n */\nfunction normalize(keys, values) {\n  var normalized = {};\n\n  forEach(keys, function (name) {\n    var value = values[name];\n    normalized[name] = (value != null) ? String(value) : null;\n  });\n  return normalized;\n}\n\n/**\n * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.\n *\n * @param {Object} a The first object.\n * @param {Object} b The second object.\n * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,\n *                     it defaults to the list of keys in `a`.\n * @return {Boolean} Returns `true` if the keys match, otherwise `false`.\n */\nfunction equalForKeys(a, b, keys) {\n  if (!keys) {\n    keys = [];\n    for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility\n  }\n\n  for (var i=0; i<keys.length; i++) {\n    var k = keys[i];\n    if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized\n  }\n  return true;\n}\n\n/**\n * Returns the subset of an object, based on a list of keys.\n *\n * @param {Array} keys\n * @param {Object} values\n * @return {Boolean} Returns a subset of `values`.\n */\nfunction filterByKeys(keys, values) {\n  var filtered = {};\n\n  forEach(keys, function (name) {\n    filtered[name] = values[name];\n  });\n  return filtered;\n}\n/**\n * @ngdoc overview\n * @name ui.router.util\n *\n * @description\n * # ui.router.util sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n *\n */\nangular.module('ui.router.util', ['ng']);\n\n/**\n * @ngdoc overview\n * @name ui.router.router\n * \n * @requires ui.router.util\n *\n * @description\n * # ui.router.router sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n */\nangular.module('ui.router.router', ['ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router.state\n * \n * @requires ui.router.router\n * @requires ui.router.util\n *\n * @description\n * # ui.router.state sub-module\n *\n * This module is a dependency of the main ui.router module. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n * \n */\nangular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router\n *\n * @requires ui.router.state\n *\n * @description\n * # ui.router\n * \n * ## The main module for ui.router \n * There are several sub-modules included with the ui.router module, however only this module is needed\n * as a dependency within your angular app. The other modules are for organization purposes. \n *\n * The modules are:\n * * ui.router - the main \"umbrella\" module\n * * ui.router.router - \n * \n * *You'll need to include **only** this module as the dependency within your angular app.*\n * \n * <pre>\n * <!doctype html>\n * <html ng-app=\"myApp\">\n * <head>\n *   <script src=\"js/angular.js\"></script>\n *   <!-- Include the ui-router script -->\n *   <script src=\"js/angular-ui-router.min.js\"></script>\n *   <script>\n *     // ...and add 'ui.router' as a dependency\n *     var myApp = angular.module('myApp', ['ui.router']);\n *   </script>\n * </head>\n * <body>\n * </body>\n * </html>\n * </pre>\n */\nangular.module('ui.router', ['ui.router.state']);\n\nangular.module('ui.router.compat', ['ui.router']);\n\n/**\n * @ngdoc object\n * @name ui.router.util.$resolve\n *\n * @requires $q\n * @requires $injector\n *\n * @description\n * Manages resolution of (acyclic) graphs of promises.\n */\n$Resolve.$inject = ['$q', '$injector'];\nfunction $Resolve(  $q,    $injector) {\n  \n  var VISIT_IN_PROGRESS = 1,\n      VISIT_DONE = 2,\n      NOTHING = {},\n      NO_DEPENDENCIES = [],\n      NO_LOCALS = NOTHING,\n      NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });\n  \n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#study\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Studies a set of invocables that are likely to be used multiple times.\n   * <pre>\n   * $resolve.study(invocables)(locals, parent, self)\n   * </pre>\n   * is equivalent to\n   * <pre>\n   * $resolve.resolve(invocables, locals, parent, self)\n   * </pre>\n   * but the former is more efficient (in fact `resolve` just calls `study` \n   * internally).\n   *\n   * @param {object} invocables Invocable objects\n   * @return {function} a function to pass in locals, parent and self\n   */\n  this.study = function (invocables) {\n    if (!isObject(invocables)) throw new Error(\"'invocables' must be an object\");\n    \n    // Perform a topological sort of invocables to build an ordered plan\n    var plan = [], cycle = [], visited = {};\n    function visit(value, key) {\n      if (visited[key] === VISIT_DONE) return;\n      \n      cycle.push(key);\n      if (visited[key] === VISIT_IN_PROGRESS) {\n        cycle.splice(0, cycle.indexOf(key));\n        throw new Error(\"Cyclic dependency: \" + cycle.join(\" -> \"));\n      }\n      visited[key] = VISIT_IN_PROGRESS;\n      \n      if (isString(value)) {\n        plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);\n      } else {\n        var params = $injector.annotate(value);\n        forEach(params, function (param) {\n          if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);\n        });\n        plan.push(key, value, params);\n      }\n      \n      cycle.pop();\n      visited[key] = VISIT_DONE;\n    }\n    forEach(invocables, visit);\n    invocables = cycle = visited = null; // plan is all that's required\n    \n    function isResolve(value) {\n      return isObject(value) && value.then && value.$$promises;\n    }\n    \n    return function (locals, parent, self) {\n      if (isResolve(locals) && self === undefined) {\n        self = parent; parent = locals; locals = null;\n      }\n      if (!locals) locals = NO_LOCALS;\n      else if (!isObject(locals)) {\n        throw new Error(\"'locals' must be an object\");\n      }       \n      if (!parent) parent = NO_PARENT;\n      else if (!isResolve(parent)) {\n        throw new Error(\"'parent' must be a promise returned by $resolve.resolve()\");\n      }\n      \n      // To complete the overall resolution, we have to wait for the parent\n      // promise and for the promise for each invokable in our plan.\n      var resolution = $q.defer(),\n          result = resolution.promise,\n          promises = result.$$promises = {},\n          values = extend({}, locals),\n          wait = 1 + plan.length/3,\n          merged = false;\n          \n      function done() {\n        // Merge parent values we haven't got yet and publish our own $$values\n        if (!--wait) {\n          if (!merged) merge(values, parent.$$values); \n          result.$$values = values;\n          result.$$promises = true; // keep for isResolve()\n          resolution.resolve(values);\n        }\n      }\n      \n      function fail(reason) {\n        result.$$failure = reason;\n        resolution.reject(reason);\n      }\n      \n      // Short-circuit if parent has already failed\n      if (isDefined(parent.$$failure)) {\n        fail(parent.$$failure);\n        return result;\n      }\n      \n      // Merge parent values if the parent has already resolved, or merge\n      // parent promises and wait if the parent resolve is still in progress.\n      if (parent.$$values) {\n        merged = merge(values, parent.$$values);\n        done();\n      } else {\n        extend(promises, parent.$$promises);\n        parent.then(done, fail);\n      }\n      \n      // Process each invocable in the plan, but ignore any where a local of the same name exists.\n      for (var i=0, ii=plan.length; i<ii; i+=3) {\n        if (locals.hasOwnProperty(plan[i])) done();\n        else invoke(plan[i], plan[i+1], plan[i+2]);\n      }\n      \n      function invoke(key, invocable, params) {\n        // Create a deferred for this invocation. Failures will propagate to the resolution as well.\n        var invocation = $q.defer(), waitParams = 0;\n        function onfailure(reason) {\n          invocation.reject(reason);\n          fail(reason);\n        }\n        // Wait for any parameter that we have a promise for (either from parent or from this\n        // resolve; in that case study() will have made sure it's ordered before us in the plan).\n        forEach(params, function (dep) {\n          if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {\n            waitParams++;\n            promises[dep].then(function (result) {\n              values[dep] = result;\n              if (!(--waitParams)) proceed();\n            }, onfailure);\n          }\n        });\n        if (!waitParams) proceed();\n        function proceed() {\n          if (isDefined(result.$$failure)) return;\n          try {\n            invocation.resolve($injector.invoke(invocable, self, values));\n            invocation.promise.then(function (result) {\n              values[key] = result;\n              done();\n            }, onfailure);\n          } catch (e) {\n            onfailure(e);\n          }\n        }\n        // Publish promise synchronously; invocations further down in the plan may depend on it.\n        promises[key] = invocation.promise;\n      }\n      \n      return result;\n    };\n  };\n  \n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#resolve\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Resolves a set of invocables. An invocable is a function to be invoked via \n   * `$injector.invoke()`, and can have an arbitrary number of dependencies. \n   * An invocable can either return a value directly,\n   * or a `$q` promise. If a promise is returned it will be resolved and the \n   * resulting value will be used instead. Dependencies of invocables are resolved \n   * (in this order of precedence)\n   *\n   * - from the specified `locals`\n   * - from another invocable that is part of this `$resolve` call\n   * - from an invocable that is inherited from a `parent` call to `$resolve` \n   *   (or recursively\n   * - from any ancestor `$resolve` of that parent).\n   *\n   * The return value of `$resolve` is a promise for an object that contains \n   * (in this order of precedence)\n   *\n   * - any `locals` (if specified)\n   * - the resolved return values of all injectables\n   * - any values inherited from a `parent` call to `$resolve` (if specified)\n   *\n   * The promise will resolve after the `parent` promise (if any) and all promises \n   * returned by injectables have been resolved. If any invocable \n   * (or `$injector.invoke`) throws an exception, or if a promise returned by an \n   * invocable is rejected, the `$resolve` promise is immediately rejected with the \n   * same error. A rejection of a `parent` promise (if specified) will likewise be \n   * propagated immediately. Once the `$resolve` promise has been rejected, no \n   * further invocables will be called.\n   * \n   * Cyclic dependencies between invocables are not permitted and will caues `$resolve`\n   * to throw an error. As a special case, an injectable can depend on a parameter \n   * with the same name as the injectable, which will be fulfilled from the `parent` \n   * injectable of the same name. This allows inherited values to be decorated. \n   * Note that in this case any other injectable in the same `$resolve` with the same\n   * dependency would see the decorated value, not the inherited value.\n   *\n   * Note that missing dependencies -- unlike cyclic dependencies -- will cause an \n   * (asynchronous) rejection of the `$resolve` promise rather than a (synchronous) \n   * exception.\n   *\n   * Invocables are invoked eagerly as soon as all dependencies are available. \n   * This is true even for dependencies inherited from a `parent` call to `$resolve`.\n   *\n   * As a special case, an invocable can be a string, in which case it is taken to \n   * be a service name to be passed to `$injector.get()`. This is supported primarily \n   * for backwards-compatibility with the `resolve` property of `$routeProvider` \n   * routes.\n   *\n   * @param {object} invocables functions to invoke or \n   * `$injector` services to fetch.\n   * @param {object} locals  values to make available to the injectables\n   * @param {object} parent  a promise returned by another call to `$resolve`.\n   * @param {object} self  the `this` for the invoked methods\n   * @return {object} Promise for an object that contains the resolved return value\n   * of all invocables, as well as any inherited and local values.\n   */\n  this.resolve = function (invocables, locals, parent, self) {\n    return this.study(invocables)(locals, parent, self);\n  };\n}\n\nangular.module('ui.router.util').service('$resolve', $Resolve);\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$templateFactory\n *\n * @requires $http\n * @requires $templateCache\n * @requires $injector\n *\n * @description\n * Service. Manages loading of templates.\n */\n$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];\nfunction $TemplateFactory(  $http,   $templateCache,   $injector) {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromConfig\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a configuration object. \n   *\n   * @param {object} config Configuration object for which to load a template. \n   * The following properties are search in the specified order, and the first one \n   * that is defined is used to create the template:\n   *\n   * @param {string|object} config.template html string template or function to \n   * load via {@link ui.router.util.$templateFactory#fromString fromString}.\n   * @param {string|object} config.templateUrl url to load or a function returning \n   * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.\n   * @param {Function} config.templateProvider function to invoke via \n   * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.\n   * @param {object} params  Parameters to pass to the template function.\n   * @param {object} locals Locals to pass to `invoke` if the template is loaded \n   * via a `templateProvider`. Defaults to `{ params: params }`.\n   *\n   * @return {string|object}  The template html as a string, or a promise for \n   * that string,or `null` if no template is configured.\n   */\n  this.fromConfig = function (config, params, locals) {\n    return (\n      isDefined(config.template) ? this.fromString(config.template, params) :\n      isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :\n      isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :\n      null\n    );\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromString\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a string or a function returning a string.\n   *\n   * @param {string|object} template html template as a string or function that \n   * returns an html template as a string.\n   * @param {object} params Parameters to pass to the template function.\n   *\n   * @return {string|object} The template html as a string, or a promise for that \n   * string.\n   */\n  this.fromString = function (template, params) {\n    return isFunction(template) ? template(params) : template;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   * \n   * @description\n   * Loads a template from the a URL via `$http` and `$templateCache`.\n   *\n   * @param {string|Function} url url of the template to load, or a function \n   * that returns a url.\n   * @param {Object} params Parameters to pass to the url function.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromUrl = function (url, params) {\n    if (isFunction(url)) url = url(params);\n    if (url == null) return null;\n    else return $http\n        .get(url, { cache: $templateCache })\n        .then(function(response) { return response.data; });\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template by invoking an injectable provider function.\n   *\n   * @param {Function} provider Function to invoke via `$injector.invoke`\n   * @param {Object} params Parameters for the template.\n   * @param {Object} locals Locals to pass to `invoke`. Defaults to \n   * `{ params: params }`.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromProvider = function (provider, params, locals) {\n    return $injector.invoke(provider, null, locals || { params: params });\n  };\n}\n\nangular.module('ui.router.util').service('$templateFactory', $TemplateFactory);\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:UrlMatcher\n *\n * @description\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL. A URL pattern consists of a path pattern, optionally followed by '?' and a list\n * of search parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by {@link ui.router.util.type:UrlMatcher#methods_exec exec}.\n * \n * Path parameter placeholders can be specified using simple colon/catch-all syntax or curly brace\n * syntax, which optionally allows a regular expression for the parameter to be specified:\n *\n * * `':'` name - colon placeholder\n * * `'*'` name - catch-all placeholder\n * * `'{' name '}'` - curly placeholder\n * * `'{' name ':' regexp '}'` - curly placeholder with regexp. Should the regexp itself contain\n *   curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters). For colon \n * placeholders or curly placeholders without an explicit regexp, a path parameter matches any\n * number of characters other than '/'. For catch-all placeholders the path parameter matches\n * any number of characters.\n * \n * Examples:\n * \n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n *   trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n *   '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n *   parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n *   path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n *\n * @param {string} pattern  the pattern to compile into a matcher.\n *\n * @property {string} prefix  A static prefix of this pattern. The matcher guarantees that any\n *   URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns\n *   non-null) will start with this prefix.\n *\n * @property {string} source  The pattern that was passed into the contructor\n *\n * @property {string} sourcePath  The path portion of the source property\n *\n * @property {string} sourceSearch  The search portion of the source property\n *\n * @property {string} regex  The constructed regex that will be used to match against the url when \n *   it is time to determine which url will match.\n *\n * @returns {Object}  New UrlMatcher object\n */\nfunction UrlMatcher(pattern) {\n\n  // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n  //   '*' name\n  //   ':' name\n  //   '{' name '}'\n  //   '{' name ':' regexp '}'\n  // The regular expression is somewhat complicated due to the need to allow curly braces\n  // inside the regular expression. The placeholder regexp breaks down as follows:\n  //    ([:*])(\\w+)               classic placeholder ($1 / $2)\n  //    \\{(\\w+)(?:\\:( ... ))?\\}   curly brace placeholder ($3) with optional regexp ... ($4)\n  //    (?: ... | ... | ... )+    the regexp consists of any number of atoms, an atom being either\n  //    [^{}\\\\]+                  - anything other than curly braces or backslash\n  //    \\\\.                       - a backslash escape\n  //    \\{(?:[^{}\\\\]+|\\\\.)*\\}     - a matched set of curly braces containing other atoms\n  var placeholder = /([:*])(\\w+)|\\{(\\w+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      names = {}, compiled = '^', last = 0, m,\n      segments = this.segments = [],\n      params = this.params = [];\n\n  function addParameter(id) {\n    if (!/^\\w+(-+\\w+)*$/.test(id)) throw new Error(\"Invalid parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    if (names[id]) throw new Error(\"Duplicate parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    names[id] = true;\n    params.push(id);\n  }\n\n  function quoteRegExp(string) {\n    return string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n  }\n\n  this.source = pattern;\n\n  // Split into static segments separated by path parameter placeholders.\n  // The number of segments is always 1 more than the number of parameters.\n  var id, regexp, segment;\n  while ((m = placeholder.exec(pattern))) {\n    id = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null\n    regexp = m[4] || (m[1] == '*' ? '.*' : '[^/]*');\n    segment = pattern.substring(last, m.index);\n    if (segment.indexOf('?') >= 0) break; // we're into the search part\n    compiled += quoteRegExp(segment) + '(' + regexp + ')';\n    addParameter(id);\n    segments.push(segment);\n    last = placeholder.lastIndex;\n  }\n  segment = pattern.substring(last);\n\n  // Find any search parameter names and remove them from the last segment\n  var i = segment.indexOf('?');\n  if (i >= 0) {\n    var search = this.sourceSearch = segment.substring(i);\n    segment = segment.substring(0, i);\n    this.sourcePath = pattern.substring(0, last+i);\n\n    // Allow parameters to be separated by '?' as well as '&' to make concat() easier\n    forEach(search.substring(1).split(/[&?]/), addParameter);\n  } else {\n    this.sourcePath = pattern;\n    this.sourceSearch = '';\n  }\n\n  compiled += quoteRegExp(segment) + '$';\n  segments.push(segment);\n  this.regexp = new RegExp(compiled);\n  this.prefix = segments[0];\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#concat\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns a new matcher for a pattern constructed by appending the path part and adding the\n * search parameters of the specified pattern to this pattern. The current pattern is not\n * modified. This can be understood as creating a pattern for URLs that are relative to (or\n * suffixes of) the current pattern.\n *\n * @example\n * The following two matchers are equivalent:\n * ```\n * new UrlMatcher('/user/{id}?q').concat('/details?date');\n * new UrlMatcher('/user/{id}/details?q&date');\n * ```\n *\n * @param {string} pattern  The pattern to append.\n * @returns {ui.router.util.type:UrlMatcher}  A matcher for the concatenated pattern.\n */\nUrlMatcher.prototype.concat = function (pattern) {\n  // Because order of search parameters is irrelevant, we can add our own search\n  // parameters to the end of the new pattern. Parse the new pattern by itself\n  // and then join the bits together, but it's much easier to do this on a string level.\n  return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch);\n};\n\nUrlMatcher.prototype.toString = function () {\n  return this.source;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#exec\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Tests the specified path against this matcher, and returns an object containing the captured\n * parameter values, or null if the path does not match. The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `searchParams`. This means that search parameters are always treated\n * as optional.\n *\n * @example\n * ```\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { x:'1', q:'hello' });\n * // returns { id:'bob', q:'hello', r:null }\n * ```\n *\n * @param {string} path  The URL path to match, e.g. `$location.path()`.\n * @param {Object} searchParams  URL search parameters, e.g. `$location.search()`.\n * @returns {Object}  The captured parameter values.\n */\nUrlMatcher.prototype.exec = function (path, searchParams) {\n  var m = this.regexp.exec(path);\n  if (!m) return null;\n\n  var params = this.params, nTotal = params.length,\n    nPath = this.segments.length-1,\n    values = {}, i;\n\n  if (nPath !== m.length - 1) throw new Error(\"Unbalanced capture group in route '\" + this.source + \"'\");\n\n  for (i=0; i<nPath; i++) values[params[i]] = m[i+1];\n  for (/**/; i<nTotal; i++) values[params[i]] = searchParams[params[i]];\n\n  return values;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#parameters\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns the names of all path and search parameters of this pattern in an unspecified order.\n * \n * @returns {Array.<string>}  An array of parameter names. Must be treated as read-only. If the\n *    pattern has no parameters, an empty array is returned.\n */\nUrlMatcher.prototype.parameters = function () {\n  return this.params;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#format\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters. Null values for path parameters are\n * treated as empty strings.\n *\n * @example\n * ```\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * ```\n *\n * @param {Object} values  the values to substitute for the parameters in this pattern.\n * @returns {string}  the formatted URL (path and optionally search part).\n */\nUrlMatcher.prototype.format = function (values) {\n  var segments = this.segments, params = this.params;\n  if (!values) return segments.join('');\n\n  var nPath = segments.length-1, nTotal = params.length,\n    result = segments[0], i, search, value;\n\n  for (i=0; i<nPath; i++) {\n    value = values[params[i]];\n    // TODO: Maybe we should throw on null here? It's not really good style to use '' and null interchangeabley\n    if (value != null) result += encodeURIComponent(value);\n    result += segments[i+1];\n  }\n  for (/**/; i<nTotal; i++) {\n    value = values[params[i]];\n    if (value != null) {\n      result += (search ? '&' : '?') + params[i] + '=' + encodeURIComponent(value);\n      search = true;\n    }\n  }\n\n  return result;\n};\n\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$urlMatcherFactory\n *\n * @description\n * Factory for {@link ui.router.util.type:UrlMatcher} instances. The factory is also available to providers\n * under the name `$urlMatcherFactoryProvider`.\n */\nfunction $UrlMatcherFactory() {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#compile\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Creates a {@link ui.router.util.type:UrlMatcher} for the specified pattern.\n   *   \n   * @param {string} pattern  The URL pattern.\n   * @returns {ui.router.util.type:UrlMatcher}  The UrlMatcher.\n   */\n  this.compile = function (pattern) {\n    return new UrlMatcher(pattern);\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#isMatcher\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Returns true if the specified object is a UrlMatcher, or false otherwise.\n   *\n   * @param {Object} object  The object to perform the type check against.\n   * @returns {Boolean}  Returns `true` if the object has the following functions: `exec`, `format`, and `concat`.\n   */\n  this.isMatcher = function (o) {\n    return isObject(o) && isFunction(o.exec) && isFunction(o.format) && isFunction(o.concat);\n  };\n  \n  /* No need to document $get, since it returns this */\n  this.$get = function () {\n    return this;\n  };\n}\n\n// Register as a provider so it's available to other providers\nangular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory);\n\n/**\n * @ngdoc object\n * @name ui.router.router.$urlRouterProvider\n *\n * @requires ui.router.util.$urlMatcherFactoryProvider\n *\n * @description\n * `$urlRouterProvider` has the responsibility of watching `$location`. \n * When `$location` changes it runs through a list of rules one by one until a \n * match is found. `$urlRouterProvider` is used behind the scenes anytime you specify \n * a url in a state configuration. All urls are compiled into a UrlMatcher object.\n *\n * There are several methods on `$urlRouterProvider` that make it useful to use directly\n * in your module config.\n */\n$UrlRouterProvider.$inject = ['$urlMatcherFactoryProvider'];\nfunction $UrlRouterProvider(  $urlMatcherFactory) {\n  var rules = [], \n      otherwise = null;\n\n  // Returns a string that is a prefix of all strings matching the RegExp\n  function regExpPrefix(re) {\n    var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n    return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n  }\n\n  // Interpolates matched values into a String.replace()-style pattern\n  function interpolate(pattern, match) {\n    return pattern.replace(/\\$(\\$|\\d{1,2})/, function (m, what) {\n      return match[what === '$' ? 0 : Number(what)];\n    });\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#rule\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines rules that are used by `$urlRouterProvider to find matches for\n   * specific URLs.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {object} rule Handler function that takes `$injector` and `$location`\n   * services as arguments. You can use them to return a valid path as a string.\n   *\n   * @return {object} $urlRouterProvider - $urlRouterProvider instance\n   */\n  this.rule =\n    function (rule) {\n      if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n      rules.push(rule);\n      return this;\n    };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouterProvider#otherwise\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines a path that is used when an invalied route is requested.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     ...\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} rule The url path you want to redirect to or a function \n   * rule that returns the url path. The function version is passed two params: \n   * `$injector` and `$location` services.\n   *\n   * @return {object} $urlRouterProvider - $urlRouterProvider instance\n   */\n  this.otherwise =\n    function (rule) {\n      if (isString(rule)) {\n        var redirect = rule;\n        rule = function () { return redirect; };\n      }\n      else if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n      otherwise = rule;\n      return this;\n    };\n\n\n  function handleIfMatch($injector, handler, match) {\n    if (!match) return false;\n    var result = $injector.invoke(handler, handler, { $match: match });\n    return isDefined(result) ? result : true;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#when\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Registers a handler for a given url matching. if handle is a string, it is\n   * treated as a redirect, and is interpolated according to the syyntax of match\n   * (i.e. like String.replace() for RegExp, or like a UrlMatcher pattern otherwise).\n   *\n   * If the handler is a function, it is injectable. It gets invoked if `$location`\n   * matches. You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} what The incoming path that you want to redirect.\n   * @param {string|object} handler The path you want to redirect your user to.\n   */\n  this.when =\n    function (what, handler) {\n      var redirect, handlerIsString = isString(handler);\n      if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n      if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n        throw new Error(\"invalid 'handler' in when()\");\n\n      var strategies = {\n        matcher: function (what, handler) {\n          if (handlerIsString) {\n            redirect = $urlMatcherFactory.compile(handler);\n            handler = ['$match', function ($match) { return redirect.format($match); }];\n          }\n          return extend(function ($injector, $location) {\n            return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n          }, {\n            prefix: isString(what.prefix) ? what.prefix : ''\n          });\n        },\n        regex: function (what, handler) {\n          if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n          if (handlerIsString) {\n            redirect = handler;\n            handler = ['$match', function ($match) { return interpolate(redirect, $match); }];\n          }\n          return extend(function ($injector, $location) {\n            return handleIfMatch($injector, handler, what.exec($location.path()));\n          }, {\n            prefix: regExpPrefix(what)\n          });\n        }\n      };\n\n      var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };\n\n      for (var n in check) {\n        if (check[n]) {\n          return this.rule(strategies[n](what, handler));\n        }\n      }\n\n      throw new Error(\"invalid 'what' in when()\");\n    };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouter\n   *\n   * @requires $location\n   * @requires $rootScope\n   * @requires $injector\n   *\n   * @description\n   *\n   */\n  this.$get =\n    [        '$location', '$rootScope', '$injector',\n    function ($location,   $rootScope,   $injector) {\n      // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree\n      function update(evt) {\n        if (evt && evt.defaultPrevented) return;\n        function check(rule) {\n          var handled = rule($injector, $location);\n          if (handled) {\n            if (isString(handled)) $location.replace().url(handled);\n            return true;\n          }\n          return false;\n        }\n        var n=rules.length, i;\n        for (i=0; i<n; i++) {\n          if (check(rules[i])) return;\n        }\n        // always check otherwise last to allow dynamic updates to the set of rules\n        if (otherwise) check(otherwise);\n      }\n\n      $rootScope.$on('$locationChangeSuccess', update);\n\n      return {\n        /**\n         * @ngdoc function\n         * @name ui.router.router.$urlRouter#sync\n         * @methodOf ui.router.router.$urlRouter\n         *\n         * @description\n         * Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.\n         * This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event, \n         * perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed \n         * with the transition by calling `$urlRouter.sync()`.\n         *\n         * @example\n         * <pre>\n         * angular.module('app', ['ui.router']);\n         *   .run(function($rootScope, $urlRouter) {\n         *     $rootScope.$on('$locationChangeSuccess', function(evt) {\n         *       // Halt state change from even starting\n         *       evt.preventDefault();\n         *       // Perform custom logic\n         *       var meetsRequirement = ...\n         *       // Continue with the update and state transition if logic allows\n         *       if (meetsRequirement) $urlRouter.sync();\n         *     });\n         * });\n         * </pre>\n         */\n        sync: function () {\n          update();\n        }\n      };\n    }];\n}\n\nangular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$stateProvider\n *\n * @requires ui.router.router.$urlRouterProvider\n * @requires ui.router.util.$urlMatcherFactoryProvider\n * @requires $locationProvider\n *\n * @description\n * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\n$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider', '$locationProvider'];\nfunction $StateProvider(   $urlRouterProvider,   $urlMatcherFactory,           $locationProvider) {\n\n  var root, states = {}, $state, queue = {}, abstractKey = 'abstract';\n\n  // Builds state properties from definition passed to registerState()\n  var stateBuilder = {\n\n    // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.\n    // state.children = [];\n    // if (parent) parent.children.push(state);\n    parent: function(state) {\n      if (isDefined(state.parent) && state.parent) return findState(state.parent);\n      // regex matches any valid composite state name\n      // would match \"contact.list\" but not \"contacts\"\n      var compositeName = /^(.+)\\.[^.]+$/.exec(state.name);\n      return compositeName ? findState(compositeName[1]) : root;\n    },\n\n    // inherit 'data' from parent and override by own values (if any)\n    data: function(state) {\n      if (state.parent && state.parent.data) {\n        state.data = state.self.data = extend({}, state.parent.data, state.data);\n      }\n      return state.data;\n    },\n\n    // Build a URLMatcher if necessary, either via a relative or absolute URL\n    url: function(state) {\n      var url = state.url;\n\n      if (isString(url)) {\n        if (url.charAt(0) == '^') {\n          return $urlMatcherFactory.compile(url.substring(1));\n        }\n        return (state.parent.navigable || root).url.concat(url);\n      }\n\n      if ($urlMatcherFactory.isMatcher(url) || url == null) {\n        return url;\n      }\n      throw new Error(\"Invalid url '\" + url + \"' in state '\" + state + \"'\");\n    },\n\n    // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n    navigable: function(state) {\n      return state.url ? state : (state.parent ? state.parent.navigable : null);\n    },\n\n    // Derive parameters for this state and ensure they're a super-set of parent's parameters\n    params: function(state) {\n      if (!state.params) {\n        return state.url ? state.url.parameters() : state.parent.params;\n      }\n      if (!isArray(state.params)) throw new Error(\"Invalid params in state '\" + state + \"'\");\n      if (state.url) throw new Error(\"Both params and url specicified in state '\" + state + \"'\");\n      return state.params;\n    },\n\n    // If there is no explicit multi-view configuration, make one up so we don't have\n    // to handle both cases in the view directive later. Note that having an explicit\n    // 'views' property will mean the default unnamed view properties are ignored. This\n    // is also a good time to resolve view names to absolute names, so everything is a\n    // straight lookup at link time.\n    views: function(state) {\n      var views = {};\n\n      forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {\n        if (name.indexOf('@') < 0) name += '@' + state.parent.name;\n        views[name] = view;\n      });\n      return views;\n    },\n\n    ownParams: function(state) {\n      if (!state.parent) {\n        return state.params;\n      }\n      var paramNames = {}; forEach(state.params, function (p) { paramNames[p] = true; });\n\n      forEach(state.parent.params, function (p) {\n        if (!paramNames[p]) {\n          throw new Error(\"Missing required parameter '\" + p + \"' in state '\" + state.name + \"'\");\n        }\n        paramNames[p] = false;\n      });\n      var ownParams = [];\n\n      forEach(paramNames, function (own, p) {\n        if (own) ownParams.push(p);\n      });\n      return ownParams;\n    },\n\n    // Keep a full path from the root down to this state as this is needed for state activation.\n    path: function(state) {\n      return state.parent ? state.parent.path.concat(state) : []; // exclude root from path\n    },\n\n    // Speed up $state.contains() as it's used a lot\n    includes: function(state) {\n      var includes = state.parent ? extend({}, state.parent.includes) : {};\n      includes[state.name] = true;\n      return includes;\n    },\n\n    $delegates: {}\n  };\n\n  function isRelative(stateName) {\n    return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n  }\n\n  function findState(stateOrName, base) {\n    var isStr = isString(stateOrName),\n        name  = isStr ? stateOrName : stateOrName.name,\n        path  = isRelative(name);\n\n    if (path) {\n      if (!base) throw new Error(\"No reference point given for path '\"  + name + \"'\");\n      var rel = name.split(\".\"), i = 0, pathLength = rel.length, current = base;\n\n      for (; i < pathLength; i++) {\n        if (rel[i] === \"\" && i === 0) {\n          current = base;\n          continue;\n        }\n        if (rel[i] === \"^\") {\n          if (!current.parent) throw new Error(\"Path '\" + name + \"' not valid for state '\" + base.name + \"'\");\n          current = current.parent;\n          continue;\n        }\n        break;\n      }\n      rel = rel.slice(i).join(\".\");\n      name = current.name + (current.name && rel ? \".\" : \"\") + rel;\n    }\n    var state = states[name];\n\n    if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n      return state;\n    }\n    return undefined;\n  }\n\n  function queueState(parentName, state) {\n    if (!queue[parentName]) {\n      queue[parentName] = [];\n    }\n    queue[parentName].push(state);\n  }\n\n  function registerState(state) {\n    // Wrap a new object around the state so we can store our private details easily.\n    state = inherit(state, {\n      self: state,\n      resolve: state.resolve || {},\n      toString: function() { return this.name; }\n    });\n\n    var name = state.name;\n    if (!isString(name) || name.indexOf('@') >= 0) throw new Error(\"State must have a valid name\");\n    if (states.hasOwnProperty(name)) throw new Error(\"State '\" + name + \"'' is already defined\");\n\n    // Get parent name\n    var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))\n        : (isString(state.parent)) ? state.parent\n        : '';\n\n    // If parent is not registered yet, add state to queue and register later\n    if (parentName && !states[parentName]) {\n      return queueState(parentName, state.self);\n    }\n\n    for (var key in stateBuilder) {\n      if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);\n    }\n    states[name] = state;\n\n    // Register the state in the global state list and with $urlRouter if necessary.\n    if (!state[abstractKey] && state.url) {\n      $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {\n        if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {\n          $state.transitionTo(state, $match, { location: false });\n        }\n      }]);\n    }\n\n    // Register any queued children\n    if (queue[name]) {\n      for (var i = 0; i < queue[name].length; i++) {\n        registerState(queue[name][i]);\n      }\n    }\n\n    return state;\n  }\n\n  // Checks text to see if it looks like a glob.\n  function isGlob (text) {\n    return text.indexOf('*') > -1;\n  }\n\n  // Returns true if glob matches current $state name.\n  function doesStateMatchGlob (glob) {\n    var globSegments = glob.split('.'),\n        segments = $state.$current.name.split('.');\n\n    //match greedy starts\n    if (globSegments[0] === '**') {\n       segments = segments.slice(segments.indexOf(globSegments[1]));\n       segments.unshift('**');\n    }\n    //match greedy ends\n    if (globSegments[globSegments.length - 1] === '**') {\n       segments.splice(segments.indexOf(globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);\n       segments.push('**');\n    }\n\n    if (globSegments.length != segments.length) {\n      return false;\n    }\n\n    //match single stars\n    for (var i = 0, l = globSegments.length; i < l; i++) {\n      if (globSegments[i] === '*') {\n        segments[i] = '*';\n      }\n    }\n\n    return segments.join('') === globSegments.join('');\n  }\n\n\n  // Implicit root state that is always active\n  root = registerState({\n    name: '',\n    url: '^',\n    views: null,\n    'abstract': true\n  });\n  root.navigable = null;\n\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#decorator\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Allows you to extend (carefully) or override (at your own peril) the \n   * `stateBuilder` object used internally by `$stateProvider`. This can be used \n   * to add custom functionality to ui-router, for example inferring templateUrl \n   * based on the state name.\n   *\n   * When passing only a name, it returns the current (original or decorated) builder\n   * function that matches `name`.\n   *\n   * The builder functions that can be decorated are listed below. Though not all\n   * necessarily have a good use case for decoration, that is up to you to decide.\n   *\n   * In addition, users can attach custom decorators, which will generate new \n   * properties within the state's internal definition. There is currently no clear \n   * use-case for this beyond accessing internal states (i.e. $state.$current), \n   * however, expect this to become increasingly relevant as we introduce additional \n   * meta-programming features.\n   *\n   * **Warning**: Decorators should not be interdependent because the order of \n   * execution of the builder functions in non-deterministic. Builder functions \n   * should only be dependent on the state definition object and super function.\n   *\n   *\n   * Existing builder functions and current return values:\n   *\n   * - **parent** `{object}` - returns the parent state object.\n   * - **data** `{object}` - returns state data, including any inherited data that is not\n   *   overridden by own values (if any).\n   * - **url** `{object}` - returns a {link ui.router.util.type:UrlMatcher} or null.\n   * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is \n   *   navigable).\n   * - **params** `{object}` - returns an array of state params that are ensured to \n   *   be a super-set of parent's params.\n   * - **views** `{object}` - returns a views object where each key is an absolute view \n   *   name (i.e. \"viewName@stateName\") and each value is the config object \n   *   (template, controller) for the view. Even when you don't use the views object \n   *   explicitly on a state config, one is still created for you internally.\n   *   So by decorating this builder function you have access to decorating template \n   *   and controller properties.\n   * - **ownParams** `{object}` - returns an array of params that belong to the state, \n   *   not including any params defined by ancestor states.\n   * - **path** `{string}` - returns the full path from the root down to this state. \n   *   Needed for state activation.\n   * - **includes** `{object}` - returns an object that includes every state that \n   *   would pass a '$state.includes()' test.\n   *\n   * @example\n   * <pre>\n   * // Override the internal 'views' builder with a function that takes the state\n   * // definition, and a reference to the internal function being overridden:\n   * $stateProvider.decorator('views', function ($state, parent) {\n   *   var result = {},\n   *       views = parent(state);\n   *\n   *   angular.forEach(view, function (config, name) {\n   *     var autoName = (state.name + '.' + name).replace('.', '/');\n   *     config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n   *     result[name] = config;\n   *   });\n   *   return result;\n   * });\n   *\n   * $stateProvider.state('home', {\n   *   views: {\n   *     'contact.list': { controller: 'ListController' },\n   *     'contact.item': { controller: 'ItemController' }\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * $state.go('home');\n   * // Auto-populates list and item views with /partials/home/contact/list.html,\n   * // and /partials/home/contact/item.html, respectively.\n   * </pre>\n   *\n   * @param {string} name The name of the builder function to decorate. \n   * @param {object} func A function that is responsible for decorating the original \n   * builder function. The function receives two parameters:\n   *\n   *   - `{object}` - state - The state config object.\n   *   - `{object}` - super - The original builder function.\n   *\n   * @return {object} $stateProvider - $stateProvider instance\n   */\n  this.decorator = decorator;\n  function decorator(name, func) {\n    /*jshint validthis: true */\n    if (isString(name) && !isDefined(func)) {\n      return stateBuilder[name];\n    }\n    if (!isFunction(func) || !isString(name)) {\n      return this;\n    }\n    if (stateBuilder[name] && !stateBuilder.$delegates[name]) {\n      stateBuilder.$delegates[name] = stateBuilder[name];\n    }\n    stateBuilder[name] = func;\n    return this;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#state\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Registers a state configuration under a given state name. The stateConfig object\n   * has the following acceptable properties.\n   *\n   * <a id='template'></a>\n   *\n   * - **`template`** - {string|function=} - html template as a string or a function that returns\n   *   an html template as a string which should be used by the uiView directives. This property \n   *   takes precedence over templateUrl.\n   *   \n   *   If `template` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <a id='templateUrl'></a>\n   *\n   * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html \n   *   template that should be used by uiView.\n   *   \n   *   If `templateUrl` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by \n   *     applying the current state\n   *\n   * <a id='templateProvider'></a>\n   *\n   * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n   *   string.\n   *\n   * <a id='controller'></a>\n   *\n   * - **`controller`** - {string|function=} -  Controller fn that should be associated with newly \n   *   related scope or the name of a registered controller if passed as a string.\n   *\n   * <a id='controllerProvider'></a>\n   *\n   * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n   *   the actual controller or string.\n   *\n   * <a id='controllerAs'></a>\n   * \n   * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be \n   *   published to scope under the controllerAs name.\n   *\n   * <a id='resolve'></a>\n   *\n   * - **`resolve`** - {object.&lt;string, function&gt;=} - An optional map of dependencies which \n   *   should be injected into the controller. If any of these dependencies are promises, \n   *   the router will wait for them all to be resolved or one to be rejected before the \n   *   controller is instantiated. If all the promises are resolved successfully, the values \n   *   of the resolved promises are injected and $stateChangeSuccess event is fired. If any \n   *   of the promises are rejected the $stateChangeError event is fired. The map object is:\n   *   \n   *   - key - {string}: name of dependency to be injected into controller\n   *   - factory - {string|function}: If string then it is alias for service. Otherwise if function, \n   *     it is injected and return value it treated as dependency. If result is a promise, it is \n   *     resolved before its value is injected into controller.\n   *\n   * <a id='url'></a>\n   *\n   * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n   *   transitioned to, the `$stateParams` service will be populated with any \n   *   parameters that were passed.\n   *\n   * <a id='params'></a>\n   *\n   * - **`params`** - {object=} - An array of parameter names or regular expressions. Only \n   *   use this within a state if you are not using url. Otherwise you can specify your\n   *   parameters within the url. When a state is navigated or transitioned to, the \n   *   $stateParams service will be populated with any parameters that were passed.\n   *\n   * <a id='views'></a>\n   *\n   * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n   *   manually/explicitly.\n   *\n   * <a id='abstract'></a>\n   *\n   * - **`abstract`** - {boolean=} - An abstract state will never be directly activated, \n   *   but can provide inherited properties to its common children states.\n   *\n   * <a id='onEnter'></a>\n   *\n   * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n   *   to trigger an action or dispatch an event, such as opening a dialog.\n   *\n   * <a id='onExit'></a>\n   *\n   * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n   *   trigger an action or dispatch an event, such as opening a dialog.\n   *\n   * <a id='reloadOnSearch'></a>\n   *\n   * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state \n   *   just because a search/query parameter has changed (via $location.search() or $location.hash()). \n   *   Useful for when you'd like to modify $location.search() without triggering a reload.\n   *\n   * <a id='data'></a>\n   *\n   * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n   *\n   * @example\n   * <pre>\n   * // Some state name examples\n   *\n   * // stateName can be a single top-level name (must be unique).\n   * $stateProvider.state(\"home\", {});\n   *\n   * // Or it can be a nested state name. This state is a child of the \n   * // above \"home\" state.\n   * $stateProvider.state(\"home.newest\", {});\n   *\n   * // Nest states as deeply as needed.\n   * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n   *\n   * // state() returns $stateProvider, so you can chain state declarations.\n   * $stateProvider\n   *   .state(\"home\", {})\n   *   .state(\"about\", {})\n   *   .state(\"contacts\", {});\n   * </pre>\n   *\n   * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\". \n   * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n   * @param {object} definition State configuration object.\n   */\n  this.state = state;\n  function state(name, definition) {\n    /*jshint validthis: true */\n    if (isObject(name)) definition = name;\n    else definition.name = name;\n    registerState(definition);\n    return this;\n  }\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$state\n   *\n   * @requires $rootScope\n   * @requires $q\n   * @requires ui.router.state.$view\n   * @requires $injector\n   * @requires ui.router.util.$resolve\n   * @requires ui.router.state.$stateParams\n   *\n   * @property {object} params A param object, e.g. {sectionId: section.id)}, that \n   * you'd like to test against the current active state.\n   * @property {object} current A reference to the state's config object. However \n   * you passed it in. Useful for accessing custom data.\n   * @property {object} transition Currently pending transition. A promise that'll \n   * resolve or reject.\n   *\n   * @description\n   * `$state` service is responsible for representing states as well as transitioning\n   * between them. It also provides interfaces to ask for current state or even states\n   * you're coming from.\n   */\n  // $urlRouter is injected just to ensure it gets instantiated\n  this.$get = $get;\n  $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$location', '$urlRouter', '$browser'];\n  function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $location,   $urlRouter,   $browser) {\n\n    var TransitionSuperseded = $q.reject(new Error('transition superseded'));\n    var TransitionPrevented = $q.reject(new Error('transition prevented'));\n    var TransitionAborted = $q.reject(new Error('transition aborted'));\n    var TransitionFailed = $q.reject(new Error('transition failed'));\n    var currentLocation = $location.url();\n    var baseHref = $browser.baseHref();\n\n    function syncUrl() {\n      if ($location.url() !== currentLocation) {\n        $location.url(currentLocation);\n        $location.replace();\n      }\n    }\n\n    root.locals = { resolve: null, globals: { $stateParams: {} } };\n    $state = {\n      params: {},\n      current: root.self,\n      $current: root,\n      transition: null\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#reload\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method that force reloads the current state. All resolves are re-resolved, events are not re-fired, \n     * and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon).\n     *\n     * @example\n     * <pre>\n     * var app angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.reload = function(){\n     *     $state.reload();\n     *   }\n     * });\n     * </pre>\n     *\n     * `reload()` is just an alias for:\n     * <pre>\n     * $state.transitionTo($state.current, $stateParams, { \n     *   reload: true, inherit: false, notify: false \n     * });\n     * </pre>\n     */\n    $state.reload = function reload() {\n      $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: false });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#go\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Convenience method for transitioning to a new state. `$state.go` calls \n     * `$state.transitionTo` internally but automatically sets options to \n     * `{ location: true, inherit: true, relative: $state.$current, notify: true }`. \n     * This allows you to easily use an absolute or relative to path and specify \n     * only the parameters you'd like to update (while letting unspecified parameters \n     * inherit from the currently active ancestor states).\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.go('contact.detail');\n     *   };\n     * });\n     * </pre>\n     * <img src='../ngdoc_assets/StateGoExamples.png'/>\n     *\n     * @param {string} to Absolute state name or relative state path. Some examples:\n     *\n     * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n     * - `$state.go('^')` - will go to a parent state\n     * - `$state.go('^.sibling')` - will go to a sibling state\n     * - `$state.go('.child.grandchild')` - will go to grandchild state\n     *\n     * @param {object=} params A map of the parameters that will be sent to the state, \n     * will populate $stateParams. Any parameters that are not specified will be inherited from currently \n     * defined parameters. This allows, for example, going to a sibling state that shares parameters\n     * specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.\n     * transitioning to a sibling will get you the parameters for all parents, transitioning to a child\n     * will get you all current parameters, etc.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition.\n     *\n     * Possible success values:\n     *\n     * - $state.current\n     *\n     * <br/>Possible rejection values:\n     *\n     * - 'transition superseded' - when a newer transition has been started after this one\n     * - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener\n     * - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or\n     *   when a `$stateNotFound` `event.retry` promise errors.\n     * - 'transition failed' - when a state has been unsuccessfully found after 2 tries.\n     * - *resolve error* - when an error has occurred with a `resolve`\n     *\n     */\n    $state.go = function go(to, params, options) {\n      return this.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#transitionTo\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}\n     * uses `transitionTo` internally. `$state.go` is recommended in most situations.\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.transitionTo('contact.detail');\n     *   };\n     * });\n     * </pre>\n     *\n     * @param {string} to State name.\n     * @param {object=} toParams A map of the parameters that will be sent to the state,\n     * will populate $stateParams.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.transitionTo = function transitionTo(to, toParams, options) {\n      toParams = toParams || {};\n      options = extend({\n        location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false\n      }, options || {});\n\n      var from = $state.$current, fromParams = $state.params, fromPath = from.path;\n      var evt, toState = findState(to, options.relative);\n\n      if (!isDefined(toState)) {\n        // Broadcast not found event and abort the transition if prevented\n        var redirect = { to: to, toParams: toParams, options: options };\n\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateNotFound\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when a requested state **cannot be found** using the provided state name during transition.\n         * The event is broadcast allowing any handlers a single chance to deal with the error (usually by\n         * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,\n         * you can see its three properties in the example. You can use `event.preventDefault()` to abort the\n         * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.\n         * @param {State} fromState Current state object.\n         * @param {Object} fromParams Current state params.\n         *\n         * @example\n         *\n         * <pre>\n         * // somewhere, assume lazy.state has not been defined\n         * $state.go(\"lazy.state\", {a:1, b:2}, {inherit:false});\n         *\n         * // somewhere else\n         * $scope.$on('$stateNotFound',\n         * function(event, unfoundState, fromState, fromParams){\n         *     console.log(unfoundState.to); // \"lazy.state\"\n         *     console.log(unfoundState.toParams); // {a:1, b:2}\n         *     console.log(unfoundState.options); // {inherit:false} + default options\n         * })\n         * </pre>\n         */\n        evt = $rootScope.$broadcast('$stateNotFound', redirect, from.self, fromParams);\n        if (evt.defaultPrevented) {\n          syncUrl();\n          return TransitionAborted;\n        }\n\n        // Allow the handler to return a promise to defer state lookup retry\n        if (evt.retry) {\n          if (options.$retry) {\n            syncUrl();\n            return TransitionFailed;\n          }\n          var retryTransition = $state.transition = $q.when(evt.retry);\n          retryTransition.then(function() {\n            if (retryTransition !== $state.transition) return TransitionSuperseded;\n            redirect.options.$retry = true;\n            return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);\n          }, function() {\n            return TransitionAborted;\n          });\n          syncUrl();\n          return retryTransition;\n        }\n\n        // Always retry once if the $stateNotFound was not prevented\n        // (handles either redirect changed or state lazy-definition)\n        to = redirect.to;\n        toParams = redirect.toParams;\n        options = redirect.options;\n        toState = findState(to, options.relative);\n        if (!isDefined(toState)) {\n          if (options.relative) throw new Error(\"Could not resolve '\" + to + \"' from state '\" + options.relative + \"'\");\n          throw new Error(\"No such state '\" + to + \"'\");\n        }\n      }\n      if (toState[abstractKey]) throw new Error(\"Cannot transition to abstract state '\" + to + \"'\");\n      if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);\n      to = toState;\n\n      var toPath = to.path;\n\n      // Starting from the root of the path, keep all levels that haven't changed\n      var keep, state, locals = root.locals, toLocals = [];\n      for (keep = 0, state = toPath[keep];\n           state && state === fromPath[keep] && equalForKeys(toParams, fromParams, state.ownParams) && !options.reload;\n           keep++, state = toPath[keep]) {\n        locals = toLocals[keep] = state.locals;\n      }\n\n      // If we're going to the same state and all locals are kept, we've got nothing to do.\n      // But clear 'transition', as we still want to cancel any other pending transitions.\n      // TODO: We may not want to bump 'transition' if we're called from a location change that we've initiated ourselves,\n      // because we might accidentally abort a legitimate transition initiated from code?\n      if (shouldTriggerReload(to, from, locals, options) ) {\n        if ( to.self.reloadOnSearch !== false )\n          syncUrl();\n        $state.transition = null;\n        return $q.when($state.current);\n      }\n\n      // Normalize/filter parameters before we pass them to event handlers etc.\n      toParams = normalize(to.params, toParams || {});\n\n      // Broadcast start event and cancel the transition if requested\n      if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeStart\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when the state transition **begins**. You can use `event.preventDefault()`\n         * to prevent the transition from happening and then the transition promise will be\n         * rejected with a `'transition prevented'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         *\n         * @example\n         *\n         * <pre>\n         * $rootScope.$on('$stateChangeStart',\n         * function(event, toState, toParams, fromState, fromParams){\n         *     event.preventDefault();\n         *     // transitionTo() promise will be rejected with\n         *     // a 'transition prevented' error\n         * })\n         * </pre>\n         */\n        evt = $rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams);\n        if (evt.defaultPrevented) {\n          syncUrl();\n          return TransitionPrevented;\n        }\n      }\n\n      // Resolve locals for the remaining states, but don't update any global state just\n      // yet -- if anything fails to resolve the current state needs to remain untouched.\n      // We also set up an inheritance chain for the locals here. This allows the view directive\n      // to quickly look up the correct definition for each view in the current state. Even\n      // though we create the locals object itself outside resolveState(), it is initially\n      // empty and gets filled asynchronously. We need to keep track of the promise for the\n      // (fully resolved) current locals, and pass this down the chain.\n      var resolved = $q.when(locals);\n      for (var l=keep; l<toPath.length; l++, state=toPath[l]) {\n        locals = toLocals[l] = inherit(locals);\n        resolved = resolveState(state, toParams, state===to, resolved, locals);\n      }\n\n      // Once everything is resolved, we are ready to perform the actual transition\n      // and return a promise for the new state. We also keep track of what the\n      // current promise is, so that we can detect overlapping transitions and\n      // keep only the outcome of the last transition.\n      var transition = $state.transition = resolved.then(function () {\n        var l, entering, exiting;\n\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Exit 'from' states not kept\n        for (l=fromPath.length-1; l>=keep; l--) {\n          exiting = fromPath[l];\n          if (exiting.self.onExit) {\n            $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);\n          }\n          exiting.locals = null;\n        }\n\n        // Enter 'to' states not kept\n        for (l=keep; l<toPath.length; l++) {\n          entering = toPath[l];\n          entering.locals = toLocals[l];\n          if (entering.self.onEnter) {\n            $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);\n          }\n        }\n\n        // Run it again, to catch any transitions in callbacks\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Update globals in $state\n        $state.$current = to;\n        $state.current = to.self;\n        $state.params = toParams;\n        copy($state.params, $stateParams);\n        $state.transition = null;\n\n        // Update $location\n        var toNav = to.navigable;\n        if (options.location && toNav) {\n          $location.url(toNav.url.format(toNav.locals.globals.$stateParams));\n\n          if (options.location === 'replace') {\n            $location.replace();\n          }\n        }\n\n        if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeSuccess\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired once the state transition is **complete**.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         */\n          $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);\n        }\n        currentLocation = $location.url();\n\n        return $state.current;\n      }, function (error) {\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        $state.transition = null;\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeError\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when an **error occurs** during transition. It's important to note that if you\n         * have any errors in your resolve functions (javascript errors, non-existent services, etc)\n         * they will not throw traditionally. You must listen for this $stateChangeError event to\n         * catch **ALL** errors.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         * @param {Error} error The resolve error object.\n         */\n        $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);\n        syncUrl();\n\n        return $q.reject(error);\n      });\n\n      return transition;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#is\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Similar to {@link ui.router.state.$state#methods_includes $state.includes},\n     * but only checks for the full state name. If params is supplied then it will be \n     * tested for strict equality against the current active params object, so all params \n     * must match with none missing and no extras.\n     *\n     * @example\n     * <pre>\n     * $state.is('contact.details.item'); // returns true\n     * $state.is(contactDetailItemStateObject); // returns true\n     *\n     * // everything else would return false\n     * </pre>\n     *\n     * @param {string|object} stateName The state name or state object you'd like to check.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like \n     * to test against the current active state.\n     * @returns {boolean} Returns true if it is the state.\n     */\n    $state.is = function is(stateOrName, params) {\n      var state = findState(stateOrName);\n\n      if (!isDefined(state)) {\n        return undefined;\n      }\n\n      if ($state.$current !== state) {\n        return false;\n      }\n\n      return isDefined(params) && params !== null ? angular.equals($stateParams, params) : true;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#includes\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method to determine if the current active state is equal to or is the child of the \n     * state stateName. If any params are passed then they will be tested for a match as well.\n     * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * $state.includes(\"contacts\"); // returns true\n     * $state.includes(\"contacts.details\"); // returns true\n     * $state.includes(\"contacts.details.item\"); // returns true\n     * $state.includes(\"contacts.list\"); // returns false\n     * $state.includes(\"about\"); // returns false\n     * </pre>\n     *\n     * @description\n     * Basic globing patterns will also work.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item.url';\n     *\n     * $state.includes(\"*.details.*.*\"); // returns true\n     * $state.includes(\"*.details.**\"); // returns true\n     * $state.includes(\"**.item.**\"); // returns true\n     * $state.includes(\"*.details.item.url\"); // returns true\n     * $state.includes(\"*.details.*.url\"); // returns true\n     * $state.includes(\"*.details.*\"); // returns false\n     * $state.includes(\"item.**\"); // returns false\n     * </pre>\n     *\n     * @param {string} stateOrName A partial name to be searched for within the current state name.\n     * @param {object} params A param object, e.g. `{sectionId: section.id}`, \n     * that you'd like to test against the current active state.\n     * @returns {boolean} Returns true if it does include the state\n     */\n\n    $state.includes = function includes(stateOrName, params) {\n      if (isString(stateOrName) && isGlob(stateOrName)) {\n        if (doesStateMatchGlob(stateOrName)) {\n          stateOrName = $state.$current.name;\n        } else {\n          return false;\n        }\n      }\n\n      var state = findState(stateOrName);\n      if (!isDefined(state)) {\n        return undefined;\n      }\n\n      if (!isDefined($state.$current.includes[state.name])) {\n        return false;\n      }\n\n      var validParams = true;\n      angular.forEach(params, function(value, key) {\n        if (!isDefined($stateParams[key]) || $stateParams[key] !== value) {\n          validParams = false;\n        }\n      });\n      return validParams;\n    };\n\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#href\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A url generation method that returns the compiled url for the given state populated with the given params.\n     *\n     * @example\n     * <pre>\n     * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name or state object you'd like to generate a url from.\n     * @param {object=} params An object of parameter values to fill the state's required parameters.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`lossy`** - {boolean=true} -  If true, and if there is no url associated with the state provided in the\n     *    first parameter, then the constructed href url will be built from the first navigable ancestor (aka\n     *    ancestor with a valid url).\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n     * \n     * @returns {string} compiled state url\n     */\n    $state.href = function href(stateOrName, params, options) {\n      options = extend({ lossy: true, inherit: false, absolute: false, relative: $state.$current }, options || {});\n      var state = findState(stateOrName, options.relative);\n      if (!isDefined(state)) return null;\n\n      params = inheritParams($stateParams, params || {}, $state.$current, state);\n      var nav = (state && options.lossy) ? state.navigable : state;\n      var url = (nav && nav.url) ? nav.url.format(normalize(state.params, params || {})) : null;\n      if (!$locationProvider.html5Mode() && url) {\n        url = \"#\" + $locationProvider.hashPrefix() + url;\n      }\n\n      if (baseHref !== '/') {\n        if ($locationProvider.html5Mode()) {\n          url = baseHref.slice(0, -1) + url;\n        } else if (options.absolute){\n          url = baseHref.slice(1) + url;\n        }\n      }\n\n      if (options.absolute && url) {\n        url = $location.protocol() + '://' + \n              $location.host() + \n              ($location.port() == 80 || $location.port() == 443 ? '' : ':' + $location.port()) + \n              (!$locationProvider.html5Mode() && url ? '/' : '') + \n              url;\n      }\n      return url;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#get\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Returns the state configuration object for any specific state or all states.\n     *\n     * @param {string|object=} stateOrName If provided, will only get the config for\n     * the requested state. If not provided, returns an array of ALL state configs.\n     * @returns {object|array} State configuration object or array of all objects.\n     */\n    $state.get = function (stateOrName, context) {\n      if (!isDefined(stateOrName)) {\n        var list = [];\n        forEach(states, function(state) { list.push(state.self); });\n        return list;\n      }\n      var state = findState(stateOrName, context);\n      return (state && state.self) ? state.self : null;\n    };\n\n    function resolveState(state, params, paramsAreFiltered, inherited, dst) {\n      // Make a restricted $stateParams with only the parameters that apply to this state if\n      // necessary. In addition to being available to the controller and onEnter/onExit callbacks,\n      // we also need $stateParams to be available for any $injector calls we make during the\n      // dependency resolution process.\n      var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params, params);\n      var locals = { $stateParams: $stateParams };\n\n      // Resolve 'global' dependencies for the state, i.e. those not specific to a view.\n      // We're also including $stateParams in this; that way the parameters are restricted\n      // to the set that should be visible to the state, and are independent of when we update\n      // the global $state and $stateParams values.\n      dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);\n      var promises = [ dst.resolve.then(function (globals) {\n        dst.globals = globals;\n      }) ];\n      if (inherited) promises.push(inherited);\n\n      // Resolve template and dependencies for all views.\n      forEach(state.views, function (view, name) {\n        var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});\n        injectables.$template = [ function () {\n          return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: false }) || '';\n        }];\n\n        promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) {\n          // References to the controller (only instantiated at link time)\n          if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {\n            var injectLocals = angular.extend({}, injectables, locals);\n            result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);\n          } else {\n            result.$$controller = view.controller;\n          }\n          // Provide access to the state itself for internal use\n          result.$$state = state;\n          result.$$controllerAs = view.controllerAs;\n          dst[name] = result;\n        }));\n      });\n\n      // Wait for all the promises and then return the activation object\n      return $q.all(promises).then(function (values) {\n        return dst;\n      });\n    }\n\n    return $state;\n  }\n\n  function shouldTriggerReload(to, from, locals, options) {\n    if ( to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false)) ) {\n      return true;\n    }\n  }\n}\n\nangular.module('ui.router.state')\n  .value('$stateParams', {})\n  .provider('$state', $StateProvider);\n\n\n$ViewProvider.$inject = [];\nfunction $ViewProvider() {\n\n  this.$get = $get;\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$view\n   *\n   * @requires ui.router.util.$templateFactory\n   * @requires $rootScope\n   *\n   * @description\n   *\n   */\n  $get.$inject = ['$rootScope', '$templateFactory'];\n  function $get(   $rootScope,   $templateFactory) {\n    return {\n      // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })\n      /**\n       * @ngdoc function\n       * @name ui.router.state.$view#load\n       * @methodOf ui.router.state.$view\n       *\n       * @description\n       *\n       * @param {string} name name\n       * @param {object} options option object.\n       */\n      load: function load(name, options) {\n        var result, defaults = {\n          template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}\n        };\n        options = extend(defaults, options);\n\n        if (options.view) {\n          result = $templateFactory.fromConfig(options.view, options.params, options.locals);\n        }\n        if (result && options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$viewContentLoading\n         * @eventOf ui.router.state.$view\n         * @eventType broadcast on root scope\n         * @description\n         *\n         * Fired once the view **begins loading**, *before* the DOM is rendered.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} viewConfig The view config properties (template, controller, etc).\n         *\n         * @example\n         *\n         * <pre>\n         * $scope.$on('$viewContentLoading',\n         * function(event, viewConfig){\n         *     // Access to all the view config properties.\n         *     // and one special property 'targetView'\n         *     // viewConfig.targetView\n         * });\n         * </pre>\n         */\n          $rootScope.$broadcast('$viewContentLoading', options);\n        }\n        return result;\n      }\n    };\n  }\n}\n\nangular.module('ui.router.state').provider('$view', $ViewProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$uiViewScrollProvider\n *\n * @description\n * Provider that returns the {@link ui.router.state.$uiViewScroll} service function.\n */\nfunction $ViewScrollProvider() {\n\n  var useAnchorScroll = false;\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll\n   * @methodOf ui.router.state.$uiViewScrollProvider\n   *\n   * @description\n   * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for\n   * scrolling based on the url anchor.\n   */\n  this.useAnchorScroll = function () {\n    useAnchorScroll = true;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$uiViewScroll\n   *\n   * @requires $anchorScroll\n   * @requires $timeout\n   *\n   * @description\n   * When called with a jqLite element, it scrolls the element into view (after a\n   * `$timeout` so the DOM has time to refresh).\n   *\n   * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n   * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.\n   */\n  this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {\n    if (useAnchorScroll) {\n      return $anchorScroll;\n    }\n\n    return function ($element) {\n      $timeout(function () {\n        $element[0].scrollIntoView();\n      }, 0, false);\n    };\n  }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-view\n *\n * @requires ui.router.state.$state\n * @requires $compile\n * @requires $controller\n * @requires $injector\n * @requires ui.router.state.$uiViewScroll\n * @requires $document\n *\n * @restrict ECA\n *\n * @description\n * The ui-view directive tells $state where to place your templates.\n *\n * @param {string=} ui-view A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states.\n *\n * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window\n * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll\n * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you\n * scroll ui-view elements into view when they are populated during a state activation.\n *\n * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*\n *\n * @param {string=} onload Expression to evaluate whenever the view updates.\n * \n * @example\n * A view can be unnamed or named. \n * <pre>\n * <!-- Unnamed -->\n * <div ui-view></div> \n * \n * <!-- Named -->\n * <div ui-view=\"viewName\"></div>\n * </pre>\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a \n * single view and it is unnamed then you can populate it like so:\n * <pre>\n * <div ui-view></div> \n * $stateProvider.state(\"home\", {\n *   template: \"<h1>HELLO!</h1>\"\n * })\n * </pre>\n * \n * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}\n * config property, by name, in this case an empty name:\n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * But typically you'll only use the views property if you name your view or have more than one view \n * in the same template. There's not really a compelling reason to name a view if its the only one, \n * but you could if you wanted, like so:\n * <pre>\n * <div ui-view=\"main\"></div>\n * </pre> \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"main\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * Really though, you'll use views to set up multiple views:\n * <pre>\n * <div ui-view></div>\n * <div ui-view=\"chart\"></div> \n * <div ui-view=\"data\"></div> \n * </pre>\n * \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     },\n *     \"chart\": {\n *       template: \"<chart_thing/>\"\n *     },\n *     \"data\": {\n *       template: \"<data_thing/>\"\n *     }\n *   }    \n * })\n * </pre>\n *\n * Examples for `autoscroll`:\n *\n * <pre>\n * <!-- If autoscroll present with no expression,\n *      then scroll ui-view into view -->\n * <ui-view autoscroll/>\n *\n * <!-- If autoscroll present with valid expression,\n *      then scroll ui-view into view if expression evaluates to true -->\n * <ui-view autoscroll='true'/>\n * <ui-view autoscroll='false'/>\n * <ui-view autoscroll='scopeVariable'/>\n * </pre>\n */\n$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll'];\nfunction $ViewDirective(   $state,   $injector,   $uiViewScroll) {\n\n  function getService() {\n    return ($injector.has) ? function(service) {\n      return $injector.has(service) ? $injector.get(service) : null;\n    } : function(service) {\n      try {\n        return $injector.get(service);\n      } catch (e) {\n        return null;\n      }\n    };\n  }\n\n  var service = getService(),\n      $animator = service('$animator'),\n      $animate = service('$animate');\n\n  // Returns a set of DOM manipulation functions based on which Angular version\n  // it should use\n  function getRenderer(attrs, scope) {\n    var statics = function() {\n      return {\n        enter: function (element, target, cb) { target.after(element); cb(); },\n        leave: function (element, cb) { element.remove(); cb(); }\n      };\n    };\n\n    if ($animate) {\n      return {\n        enter: function(element, target, cb) { $animate.enter(element, null, target, cb); },\n        leave: function(element, cb) { $animate.leave(element, cb); }\n      };\n    }\n\n    if ($animator) {\n      var animate = $animator && $animator(scope, attrs);\n\n      return {\n        enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },\n        leave: function(element, cb) { animate.leave(element); cb(); }\n      };\n    }\n\n    return statics();\n  }\n\n  var directive = {\n    restrict: 'ECA',\n    terminal: true,\n    priority: 400,\n    transclude: 'element',\n    compile: function (tElement, tAttrs, $transclude) {\n      return function (scope, $element, attrs) {\n        var previousEl, currentEl, currentScope, latestLocals,\n            onloadExp     = attrs.onload || '',\n            autoScrollExp = attrs.autoscroll,\n            renderer      = getRenderer(attrs, scope);\n\n        scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        updateView(true);\n\n        function cleanupLastView() {\n          if (previousEl) {\n            previousEl.remove();\n            previousEl = null;\n          }\n\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n\n          if (currentEl) {\n            renderer.leave(currentEl, function() {\n              previousEl = null;\n            });\n\n            previousEl = currentEl;\n            currentEl = null;\n          }\n        }\n\n        function updateView(firstTime) {\n          var newScope        = scope.$new(),\n              name            = currentEl && currentEl.data('$uiViewName'),\n              previousLocals  = name && $state.$current && $state.$current.locals[name];\n\n          if (!firstTime && previousLocals === latestLocals) return; // nothing to do\n\n          var clone = $transclude(newScope, function(clone) {\n            renderer.enter(clone, $element, function onUiViewEnter() {\n              if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n                $uiViewScroll(clone);\n              }\n            });\n            cleanupLastView();\n          });\n\n          latestLocals = $state.$current.locals[clone.data('$uiViewName')];\n\n          currentEl = clone;\n          currentScope = newScope;\n          /**\n           * @ngdoc event\n           * @name ui.router.state.directive:ui-view#$viewContentLoaded\n           * @eventOf ui.router.state.directive:ui-view\n           * @eventType emits on ui-view directive scope\n           * @description           *\n           * Fired once the view is **loaded**, *after* the DOM is rendered.\n           *\n           * @param {Object} event Event object.\n           */\n          currentScope.$emit('$viewContentLoaded');\n          currentScope.$eval(onloadExp);\n        }\n      };\n    }\n  };\n\n  return directive;\n}\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state'];\nfunction $ViewDirectiveFill ($compile, $controller, $state) {\n  return {\n    restrict: 'ECA',\n    priority: -400,\n    compile: function (tElement) {\n      var initial = tElement.html();\n      return function (scope, $element, attrs) {\n        var name      = attrs.uiView || attrs.name || '',\n            inherited = $element.inheritedData('$uiView');\n\n        if (name.indexOf('@') < 0) {\n          name = name + '@' + (inherited ? inherited.state.name : '');\n        }\n\n        $element.data('$uiViewName', name);\n\n        var current = $state.$current,\n            locals  = current && current.locals[name];\n\n        if (! locals) {\n          return;\n        }\n\n        $element.data('$uiView', { name: name, state: locals.$$state });\n        $element.html(locals.$template ? locals.$template : initial);\n\n        var link = $compile($element.contents());\n\n        if (locals.$$controller) {\n          locals.$scope = scope;\n          var controller = $controller(locals.$$controller, locals);\n          if (locals.$$controllerAs) {\n            scope[locals.$$controllerAs] = controller;\n          }\n          $element.data('$ngControllerController', controller);\n          $element.children().data('$ngControllerController', controller);\n        }\n\n        link(scope);\n      };\n    }\n  };\n}\n\nangular.module('ui.router.state').directive('uiView', $ViewDirective);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n\nfunction parseStateRef(ref) {\n  var parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n  if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n  return { state: parsed[1], paramExpr: parsed[3] || null };\n}\n\nfunction stateContext(el) {\n  var stateData = el.parent().inheritedData('$uiView');\n\n  if (stateData && stateData.state && stateData.state.name) {\n    return stateData.state;\n  }\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref\n *\n * @requires ui.router.state.$state\n * @requires $timeout\n *\n * @restrict A\n *\n * @description\n * A directive that binds a link (`<a>` tag) to a state. If the state has an associated \n * URL, the directive will automatically generate & update the `href` attribute via \n * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking \n * the link will trigger a state transition with optional parameters. \n *\n * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be \n * handled natively by the browser.\n *\n * You can also use relative state paths within ui-sref, just like the relative \n * paths passed to `$state.go()`. You just need to be aware that the path is relative\n * to the state that the link lives in, in other words the state that loaded the \n * template containing the link.\n *\n * You can specify options to pass to {@link ui.router.state.$state#go $state.go()}\n * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,\n * and `reload`.\n *\n * @example\n * Here's an example of how you'd use ui-sref and how it would compile. If you have the \n * following template:\n * <pre>\n * <a ui-sref=\"home\">Home</a> | <a ui-sref=\"about\">About</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a ui-sref=\"contacts.detail({ id: contact.id })\">{{ contact.name }}</a>\n *     </li>\n * </ul>\n * </pre>\n * \n * Then the compiled html would be (assuming Html5Mode is off):\n * <pre>\n * <a href=\"#/home\" ui-sref=\"home\">Home</a> | <a href=\"#/about\" ui-sref=\"about\">About</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/1\" ui-sref=\"contacts.detail({ id: contact.id })\">Joe</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/2\" ui-sref=\"contacts.detail({ id: contact.id })\">Alice</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/3\" ui-sref=\"contacts.detail({ id: contact.id })\">Bob</a>\n *     </li>\n * </ul>\n *\n * <a ui-sref=\"home\" ui-sref-opts=\"{reload: true}\">Home</a>\n * </pre>\n *\n * @param {string} ui-sref 'stateName' can be any valid absolute or relative state\n * @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}\n */\n$StateRefDirective.$inject = ['$state', '$timeout'];\nfunction $StateRefDirective($state, $timeout) {\n  var allowedOptions = ['location', 'inherit', 'reload'];\n\n  return {\n    restrict: 'A',\n    require: '?^uiSrefActive',\n    link: function(scope, element, attrs, uiSrefActive) {\n      var ref = parseStateRef(attrs.uiSref);\n      var params = null, url = null, base = stateContext(element) || $state.$current;\n      var isForm = element[0].nodeName === \"FORM\";\n      var attr = isForm ? \"action\" : \"href\", nav = true;\n\n      var options = {\n        relative: base\n      };\n      var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};\n      angular.forEach(allowedOptions, function(option) {\n        if (option in optionsOverride) {\n          options[option] = optionsOverride[option];\n        }\n      });\n\n      var update = function(newVal) {\n        if (newVal) params = newVal;\n        if (!nav) return;\n\n        var newHref = $state.href(ref.state, params, options);\n\n        if (uiSrefActive) {\n          uiSrefActive.$$setStateInfo(ref.state, params);\n        }\n        if (!newHref) {\n          nav = false;\n          return false;\n        }\n        element[0][attr] = newHref;\n      };\n\n      if (ref.paramExpr) {\n        scope.$watch(ref.paramExpr, function(newVal, oldVal) {\n          if (newVal !== params) update(newVal);\n        }, true);\n        params = scope.$eval(ref.paramExpr);\n      }\n      update();\n\n      if (isForm) return;\n\n      element.bind(\"click\", function(e) {\n        var button = e.which || e.button;\n        if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {\n          // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n          $timeout(function() {\n            $state.go(ref.state, params, options);\n          });\n          e.preventDefault();\n        }\n      });\n    }\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * A directive working alongside ui-sref to add classes to an element when the \n * related ui-sref directive's state is active, and removing them when it is inactive.\n * The primary use-case is to simplify the special appearance of navigation menus \n * relying on `ui-sref`, by having the \"active\" state's menu button appear different,\n * distinguishing it from the inactive menu items.\n *\n * @example\n * Given the following template:\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item\">\n *     <a href ui-sref=\"app.user({user: 'bilbobaggins'})\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n * \n * When the app state is \"app.user\", and contains the state parameter \"user\" with value \"bilbobaggins\", \n * the resulting HTML will appear as (note the 'active' class):\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item active\">\n *     <a ui-sref=\"app.user({user: 'bilbobaggins'})\" href=\"/users/bilbobaggins\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n * \n * The class name is interpolated **once** during the directives link time (any further changes to the \n * interpolated value are ignored). \n * \n * Multiple classes may be specified in a space-separated format:\n * <pre>\n * <ul>\n *   <li ui-sref-active='class1 class2 class3'>\n *     <a ui-sref=\"app.user\">link</a>\n *   </li>\n * </ul>\n * </pre>\n */\n$StateActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];\nfunction $StateActiveDirective($state, $stateParams, $interpolate) {\n  return {\n    restrict: \"A\",\n    controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {\n      var state, params, activeClass;\n\n      // There probably isn't much point in $observing this\n      activeClass = $interpolate($attrs.uiSrefActive || '', false)($scope);\n\n      // Allow uiSref to communicate with uiSrefActive\n      this.$$setStateInfo = function(newState, newParams) {\n        state = $state.get(newState, stateContext($element));\n        params = newParams;\n        update();\n      };\n\n      $scope.$on('$stateChangeSuccess', update);\n\n      // Update route state\n      function update() {\n        if ($state.$current.self === state && matchesParams()) {\n          $element.addClass(activeClass);\n        } else {\n          $element.removeClass(activeClass);\n        }\n      }\n\n      function matchesParams() {\n        return !params || equalForKeys(params, $stateParams);\n      }\n    }]\n  };\n}\n\nangular.module('ui.router.state')\n  .directive('uiSref', $StateRefDirective)\n  .directive('uiSrefActive', $StateActiveDirective);\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:isState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_is $state.is(\"stateName\")}.\n */\n$IsStateFilter.$inject = ['$state'];\nfunction $IsStateFilter($state) {\n  return function(state) {\n    return $state.is(state);\n  };\n}\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:includedByState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.\n */\n$IncludedByStateFilter.$inject = ['$state'];\nfunction $IncludedByStateFilter($state) {\n  return function(state) {\n    return $state.includes(state);\n  };\n}\n\nangular.module('ui.router.state')\n  .filter('isState', $IsStateFilter)\n  .filter('includedByState', $IncludedByStateFilter);\n\n/*\n * @ngdoc object\n * @name ui.router.compat.$routeProvider\n *\n * @requires ui.router.state.$stateProvider\n * @requires ui.router.router.$urlRouterProvider\n *\n * @description\n * `$routeProvider` of the `ui.router.compat` module overwrites the existing\n * `routeProvider` from the core. This is done to provide compatibility between\n * the UI Router and the core router.\n *\n * It also provides a `when()` method to register routes that map to certain urls.\n * Behind the scenes it actually delegates either to \n * {@link ui.router.router.$urlRouterProvider $urlRouterProvider} or to the \n * {@link ui.router.state.$stateProvider $stateProvider} to postprocess the given \n * router definition object.\n */\n$RouteProvider.$inject = ['$stateProvider', '$urlRouterProvider'];\nfunction $RouteProvider(  $stateProvider,    $urlRouterProvider) {\n\n  var routes = [];\n\n  onEnterRoute.$inject = ['$$state'];\n  function onEnterRoute(   $$state) {\n    /*jshint validthis: true */\n    this.locals = $$state.locals.globals;\n    this.params = this.locals.$stateParams;\n  }\n\n  function onExitRoute() {\n    /*jshint validthis: true */\n    this.locals = null;\n    this.params = null;\n  }\n\n  this.when = when;\n  /*\n   * @ngdoc function\n   * @name ui.router.compat.$routeProvider#when\n   * @methodOf ui.router.compat.$routeProvider\n   *\n   * @description\n   * Registers a route with a given route definition object. The route definition\n   * object has the same interface the angular core route definition object has.\n   * \n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.compat']);\n   *\n   * app.config(function ($routeProvider) {\n   *   $routeProvider.when('home', {\n   *     controller: function () { ... },\n   *     templateUrl: 'path/to/template'\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string} url URL as string\n   * @param {object} route Route definition object\n   *\n   * @return {object} $routeProvider - $routeProvider instance\n   */\n  function when(url, route) {\n    /*jshint validthis: true */\n    if (route.redirectTo != null) {\n      // Redirect, configure directly on $urlRouterProvider\n      var redirect = route.redirectTo, handler;\n      if (isString(redirect)) {\n        handler = redirect; // leave $urlRouterProvider to handle\n      } else if (isFunction(redirect)) {\n        // Adapt to $urlRouterProvider API\n        handler = function (params, $location) {\n          return redirect(params, $location.path(), $location.search());\n        };\n      } else {\n        throw new Error(\"Invalid 'redirectTo' in when()\");\n      }\n      $urlRouterProvider.when(url, handler);\n    } else {\n      // Regular route, configure as state\n      $stateProvider.state(inherit(route, {\n        parent: null,\n        name: 'route:' + encodeURIComponent(url),\n        url: url,\n        onEnter: onEnterRoute,\n        onExit: onExitRoute\n      }));\n    }\n    routes.push(route);\n    return this;\n  }\n\n  /*\n   * @ngdoc object\n   * @name ui.router.compat.$route\n   *\n   * @requires ui.router.state.$state\n   * @requires $rootScope\n   * @requires $routeParams\n   *\n   * @property {object} routes - Array of registered routes.\n   * @property {object} params - Current route params as object.\n   * @property {string} current - Name of the current route.\n   *\n   * @description\n   * The `$route` service provides interfaces to access defined routes. It also let's\n   * you access route params through `$routeParams` service, so you have fully\n   * control over all the stuff you would actually get from angular's core `$route`\n   * service.\n   */\n  this.$get = $get;\n  $get.$inject = ['$state', '$rootScope', '$routeParams'];\n  function $get(   $state,   $rootScope,   $routeParams) {\n\n    var $route = {\n      routes: routes,\n      params: $routeParams,\n      current: undefined\n    };\n\n    function stateAsRoute(state) {\n      return (state.name !== '') ? state : undefined;\n    }\n\n    $rootScope.$on('$stateChangeStart', function (ev, to, toParams, from, fromParams) {\n      $rootScope.$broadcast('$routeChangeStart', stateAsRoute(to), stateAsRoute(from));\n    });\n\n    $rootScope.$on('$stateChangeSuccess', function (ev, to, toParams, from, fromParams) {\n      $route.current = stateAsRoute(to);\n      $rootScope.$broadcast('$routeChangeSuccess', stateAsRoute(to), stateAsRoute(from));\n      copy(toParams, $route.params);\n    });\n\n    $rootScope.$on('$stateChangeError', function (ev, to, toParams, from, fromParams, error) {\n      $rootScope.$broadcast('$routeChangeError', stateAsRoute(to), stateAsRoute(from), error);\n    });\n\n    return $route;\n  }\n}\n\nangular.module('ui.router.compat')\n  .provider('$route', $RouteProvider)\n  .directive('ngView', $ViewDirective);\n})(window, window.angular);\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/*!\n * Copyright 2014 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.0.0-beta.12\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n\n(function() {\n/*\n * deprecated.js\n * https://github.com/wearefractal/deprecated/\n * Copyright (c) 2014 Fractal <contact@wearefractal.com>\n * License MIT\n */\n//Interval object\nvar deprecated = {\n  method: function(msg, log, fn) {\n    var called = false;\n    return function deprecatedMethod(){\n      if (!called) {\n        called = true;\n        log(msg);\n      }\n      return fn.apply(this, arguments);\n    };\n  },\n\n  field: function(msg, log, parent, field, val) {\n    var called = false;\n    var getter = function(){\n      if (!called) {\n        called = true;\n        log(msg);\n      }\n      return val;\n    };\n    var setter = function(v) {\n      if (!called) {\n        called = true;\n        log(msg);\n      }\n      val = v;\n      return v;\n    };\n    Object.defineProperty(parent, field, {\n      get: getter,\n      set: setter,\n      enumerable: true\n    });\n    return;\n  }\n};\n\n\nvar IonicModule = angular.module('ionic', ['ngAnimate', 'ngSanitize', 'ui.router']),\n  extend = angular.extend,\n  forEach = angular.forEach,\n  isDefined = angular.isDefined,\n  isString = angular.isString,\n  jqLite = angular.element;\n\n\n/**\n * @ngdoc service\n * @name $ionicActionSheet\n * @module ionic\n * @description\n * The Action Sheet is a slide-up pane that lets the user choose from a set of options.\n * Dangerous options are highlighted in red and made obvious.\n *\n * There are easy ways to cancel out of the action sheet, such as tapping the backdrop or even\n * hitting escape on the keyboard for desktop testing.\n *\n * ![Action Sheet](http://ionicframework.com.s3.amazonaws.com/docs/controllers/actionSheet.gif)\n *\n * @usage\n * To trigger an Action Sheet in your code, use the $ionicActionSheet service in your angular controllers:\n *\n * ```js\n * angular.module('mySuperApp', ['ionic'])\n * .controller(function($scope, $ionicActionSheet, $timeout) {\n *\n *  // Triggered on a button click, or some other target\n *  $scope.show = function() {\n *\n *    // Show the action sheet\n *    var hideSheet = $ionicActionSheet.show({\n *      buttons: [\n *        { text: '<b>Share</b> This' },\n *        { text: 'Move' }\n *      ],\n *      destructiveText: 'Delete',\n *      titleText: 'Modify your album',\n *      cancelText: 'Cancel',\n *      cancel: function() {\n          // add cancel code..\n        },\n *      buttonClicked: function(index) {\n *        return true;\n *      }\n *    });\n *\n *    // For example's sake, hide the sheet after two seconds\n *    $timeout(function() {\n *      hideSheet();\n *    }, 2000);\n *\n *  };\n * });\n * ```\n *\n */\nIonicModule\n.factory('$ionicActionSheet', [\n  '$rootScope',\n  '$compile',\n  '$animate',\n  '$timeout',\n  '$ionicTemplateLoader',\n  '$ionicPlatform',\n  '$ionicBody',\nfunction($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicPlatform, $ionicBody) {\n\n  return {\n    show: actionSheet\n  };\n\n  /**\n   * @ngdoc method\n   * @name $ionicActionSheet#show\n   * @description\n   * Load and return a new action sheet.\n   *\n   * A new isolated scope will be created for the\n   * action sheet and the new element will be appended into the body.\n   *\n   * @param {object} options The options for this ActionSheet. Properties:\n   *\n   *  - `[Object]` `buttons` Which buttons to show.  Each button is an object with a `text` field.\n   *  - `{string}` `titleText` The title to show on the action sheet.\n   *  - `{string=}` `cancelText` the text for a 'cancel' button on the action sheet.\n   *  - `{string=}` `destructiveText` The text for a 'danger' on the action sheet.\n   *  - `{function=}` `cancel` Called if the cancel button is pressed, the backdrop is tapped or\n   *     the hardware back button is pressed.\n   *  - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked,\n   *     with the index of the button that was clicked and the button object. Return true to close\n   *     the action sheet, or false to keep it opened.\n   *  - `{function=}` `destructiveButtonClicked` Called when the destructive button is clicked.\n   *     Return true to close the action sheet, or false to keep it opened.\n   *  -  `{boolean=}` `cancelOnStateChange` Whether to cancel the actionSheet when navigating\n   *     to a new state.  Default true.\n   *\n   * @returns {function} `hideSheet` A function which, when called, hides & cancels the action sheet.\n   */\n  function actionSheet(opts) {\n    var scope = $rootScope.$new(true);\n\n    angular.extend(scope, {\n      cancel: angular.noop,\n      destructiveButtonClicked: angular.noop,\n      buttonClicked: angular.noop,\n      $deregisterBackButton: angular.noop,\n      buttons: [],\n      cancelOnStateChange: true\n    }, opts || {});\n\n\n    // Compile the template\n    var element = scope.element = $compile('<ion-action-sheet buttons=\"buttons\"></ion-action-sheet>')(scope);\n\n    // Grab the sheet element for animation\n    var sheetEl = jqLite(element[0].querySelector('.action-sheet-wrapper'));\n\n    var stateChangeListenDone = scope.cancelOnStateChange ?\n      $rootScope.$on('$stateChangeSuccess', function() { scope.cancel(); }) :\n      angular.noop;\n\n    // removes the actionSheet from the screen\n    scope.removeSheet = function(done) {\n      if (scope.removed) return;\n\n      scope.removed = true;\n      sheetEl.removeClass('action-sheet-up');\n      $ionicBody.removeClass('action-sheet-open');\n      scope.$deregisterBackButton();\n      stateChangeListenDone();\n\n      $animate.removeClass(element, 'active', function() {\n        scope.$destroy();\n        element.remove();\n        // scope.cancel.$scope is defined near the bottom\n        scope.cancel.$scope = null;\n        (done || angular.noop)();\n      });\n    };\n\n    scope.showSheet = function(done) {\n      if (scope.removed) return;\n\n      $ionicBody.append(element)\n                .addClass('action-sheet-open');\n\n      $animate.addClass(element, 'active', function() {\n        if (scope.removed) return;\n        (done || angular.noop)();\n      });\n      $timeout(function(){\n        if (scope.removed) return;\n        sheetEl.addClass('action-sheet-up');\n      }, 20, false);\n    };\n\n    // registerBackButtonAction returns a callback to deregister the action\n    scope.$deregisterBackButton = $ionicPlatform.registerBackButtonAction(\n      function() {\n        $timeout(scope.cancel);\n      },\n      PLATFORM_BACK_BUTTON_PRIORITY_ACTION_SHEET\n    );\n\n    // called when the user presses the cancel button\n    scope.cancel = function() {\n      // after the animation is out, call the cancel callback\n      scope.removeSheet(opts.cancel);\n    };\n\n    scope.buttonClicked = function(index) {\n      // Check if the button click event returned true, which means\n      // we can close the action sheet\n      if (opts.buttonClicked(index, opts.buttons[index]) === true) {\n        scope.removeSheet();\n      }\n    };\n\n    scope.destructiveButtonClicked = function() {\n      // Check if the destructive button click event returned true, which means\n      // we can close the action sheet\n      if (opts.destructiveButtonClicked() === true) {\n        scope.removeSheet();\n      }\n    };\n\n    scope.showSheet();\n\n    // Expose the scope on $ionicActionSheet's return value for the sake\n    // of testing it.\n    scope.cancel.$scope = scope;\n\n    return scope.cancel;\n  }\n}]);\n\n\njqLite.prototype.addClass = function(cssClasses) {\n  var x, y, cssClass, el, splitClasses, existingClasses;\n  if (cssClasses && cssClasses != 'ng-scope' && cssClasses != 'ng-isolate-scope') {\n    for(x=0; x<this.length; x++) {\n      el = this[x];\n      if(el.setAttribute) {\n\n        if(cssClasses.indexOf(' ') < 0 && el.classList.add) {\n          el.classList.add(cssClasses);\n        } else {\n          existingClasses = (' ' + (el.getAttribute('class') || '') + ' ')\n            .replace(/[\\n\\t]/g, \" \");\n          splitClasses = cssClasses.split(' ');\n\n          for (y=0; y<splitClasses.length; y++) {\n            cssClass = splitClasses[y].trim();\n            if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n              existingClasses += cssClass + ' ';\n            }\n          }\n          el.setAttribute('class', existingClasses.trim());\n        }\n      }\n    }\n  }\n  return this;\n};\n\njqLite.prototype.removeClass = function(cssClasses) {\n  var x, y, splitClasses, cssClass, el;\n  if (cssClasses) {\n    for(x=0; x<this.length; x++) {\n      el = this[x];\n      if(el.getAttribute) {\n        if(cssClasses.indexOf(' ') < 0 && el.classList.remove) {\n          el.classList.remove(cssClasses);\n        } else {\n          splitClasses = cssClasses.split(' ');\n\n          for (y=0; y<splitClasses.length; y++) {\n            cssClass = splitClasses[y];\n            el.setAttribute('class', (\n                (\" \" + (el.getAttribute('class') || '') + \" \")\n                .replace(/[\\n\\t]/g, \" \")\n                .replace(\" \" + cssClass.trim() + \" \", \" \")).trim()\n            );\n          }\n        }\n      }\n    }\n  }\n  return this;\n};\n\n/**\n * @ngdoc service\n * @name $ionicBackdrop\n * @module ionic\n * @description\n * Shows and hides a backdrop over the UI.  Appears behind popups, loading,\n * and other overlays.\n *\n * Often, multiple UI components require a backdrop, but only one backdrop is\n * ever needed in the DOM at a time.\n *\n * Therefore, each component that requires the backdrop to be shown calls\n * `$ionicBackdrop.retain()` when it wants the backdrop, then `$ionicBackdrop.release()`\n * when it is done with the backdrop.\n *\n * For each time `retain` is called, the backdrop will be shown until `release` is called.\n *\n * For example, if `retain` is called three times, the backdrop will be shown until `release`\n * is called three times.\n *\n * @usage\n *\n * ```js\n * function MyController($scope, $ionicBackdrop, $timeout) {\n *   //Show a backdrop for one second\n *   $scope.action = function() {\n *     $ionicBackdrop.retain();\n *     $timeout(function() {\n *       $ionicBackdrop.release();\n *     }, 1000);\n *   };\n * }\n * ```\n */\nIonicModule\n.factory('$ionicBackdrop', [\n  '$document', '$timeout',\nfunction($document, $timeout) {\n\n  var el = jqLite('<div class=\"backdrop\">');\n  var backdropHolds = 0;\n\n  $document[0].body.appendChild(el[0]);\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicBackdrop#retain\n     * @description Retains the backdrop.\n     */\n    retain: retain,\n    /**\n     * @ngdoc method\n     * @name $ionicBackdrop#release\n     * @description\n     * Releases the backdrop.\n     */\n    release: release,\n\n    getElement: getElement,\n\n    // exposed for testing\n    _element: el\n  };\n\n  function retain() {\n    if ( (++backdropHolds) === 1 ) {\n      el.addClass('visible');\n      ionic.requestAnimationFrame(function() {\n        backdropHolds && el.addClass('active');\n      });\n    }\n  }\n  function release() {\n    if ( (--backdropHolds) === 0 ) {\n      el.removeClass('active');\n      $timeout(function() {\n        !backdropHolds && el.removeClass('visible');\n      }, 400, false);\n    }\n  }\n\n  function getElement() {\n    return el;\n  }\n\n}]);\n\n/**\n * @private\n */\nIonicModule\n.factory('$ionicBind', ['$parse', '$interpolate', function($parse, $interpolate) {\n  var LOCAL_REGEXP = /^\\s*([@=&])(\\??)\\s*(\\w*)\\s*$/;\n  return function(scope, attrs, bindDefinition) {\n    forEach(bindDefinition || {}, function (definition, scopeName) {\n      //Adapted from angular.js $compile\n      var match = definition.match(LOCAL_REGEXP) || [],\n        attrName = match[3] || scopeName,\n        mode = match[1], // @, =, or &\n        parentGet,\n        unwatch;\n\n      switch(mode) {\n        case '@':\n          if (!attrs[attrName]) {\n            return;\n          }\n          attrs.$observe(attrName, function(value) {\n            scope[scopeName] = value;\n          });\n          // we trigger an interpolation to ensure\n          // the value is there for use immediately\n          if (attrs[attrName]) {\n            scope[scopeName] = $interpolate(attrs[attrName])(scope);\n          }\n          break;\n\n        case '=':\n          if (!attrs[attrName]) {\n            return;\n          }\n          unwatch = scope.$watch(attrs[attrName], function(value) {\n            scope[scopeName] = value;\n          });\n          //Destroy parent scope watcher when this scope is destroyed\n          scope.$on('$destroy', unwatch);\n          break;\n\n        case '&':\n          /* jshint -W044 */\n          if (attrs[attrName] && attrs[attrName].match(RegExp(scopeName + '\\(.*?\\)'))) {\n            throw new Error('& expression binding \"' + scopeName + '\" looks like it will recursively call \"' +\n                          attrs[attrName] + '\" and cause a stack overflow! Please choose a different scopeName.');\n          }\n          parentGet = $parse(attrs[attrName]);\n          scope[scopeName] = function(locals) {\n            return parentGet(scope, locals);\n          };\n          break;\n      }\n    });\n  };\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicBody\n * @module ionic\n * @description An angular utility service to easily and efficiently\n * add and remove CSS classes from the document's body element.\n */\nIonicModule\n.factory('$ionicBody', ['$document', function($document) {\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicBody#add\n     * @description Add a class to the document's body element.\n     * @param {string} class Each argument will be added to the body element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    addClass: function() {\n      for(var x=0; x<arguments.length; x++) {\n        $document[0].body.classList.add(arguments[x]);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#removeClass\n     * @description Remove a class from the document's body element.\n     * @param {string} class Each argument will be removed from the body element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    removeClass: function() {\n      for(var x=0; x<arguments.length; x++) {\n        $document[0].body.classList.remove(arguments[x]);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#enableClass\n     * @description Similar to the `add` method, except the first parameter accepts a boolean\n     * value determining if the class should be added or removed. Rather than writing user code,\n     * such as \"if true then add the class, else then remove the class\", this method can be\n     * given a true or false value which reduces redundant code.\n     * @param {boolean} shouldEnableClass A true/false value if the class should be added or removed.\n     * @param {string} class Each remaining argument would be added or removed depending on\n     * the first argument.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    enableClass: function(shouldEnableClass) {\n      var args = Array.prototype.slice.call(arguments).slice(1);\n      if(shouldEnableClass) {\n        this.addClass.apply(this, args);\n      } else {\n        this.removeClass.apply(this, args);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#append\n     * @description Append a child to the document's body.\n     * @param {element} element The element to be appended to the body. The passed in element\n     * can be either a jqLite element, or a DOM element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    append: function(ele) {\n      $document[0].body.appendChild( ele.length ? ele[0] : ele );\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#get\n     * @description Get the document's body element.\n     * @returns {element} Returns the document's body element.\n     */\n    get: function() {\n      return $document[0].body;\n    }\n  };\n}]);\n\nIonicModule\n.factory('$ionicClickBlock', [\n  '$document',\n  '$ionicBody',\n  '$timeout',\nfunction($document, $ionicBody, $timeout) {\n  var cb = $document[0].createElement('div');\n  cb.className = 'click-block';\n  return {\n    show: function() {\n      if(cb.parentElement) {\n        cb.classList.remove('hide');\n      } else {\n        $ionicBody.append(cb);\n      }\n      $timeout(function(){\n        cb.classList.add('hide');\n      }, 500);\n    },\n    hide: function() {\n      cb.classList.add('hide');\n    }\n  };\n}]);\n\nIonicModule\n.factory('$collectionDataSource', [\n  '$cacheFactory',\n  '$parse',\n  '$rootScope',\nfunction($cacheFactory, $parse, $rootScope) {\n  function hideWithTransform(element) {\n    element.css(ionic.CSS.TRANSFORM, 'translate3d(-2000px,-2000px,0)');\n  }\n\n  function CollectionRepeatDataSource(options) {\n    var self = this;\n    this.scope = options.scope;\n    this.transcludeFn = options.transcludeFn;\n    this.transcludeParent = options.transcludeParent;\n    this.element = options.element;\n\n    this.keyExpr = options.keyExpr;\n    this.listExpr = options.listExpr;\n    this.trackByExpr = options.trackByExpr;\n\n    this.heightGetter = options.heightGetter;\n    this.widthGetter = options.widthGetter;\n\n    this.dimensions = [];\n    this.data = [];\n\n    this.attachedItems = {};\n    this.BACKUP_ITEMS_LENGTH = 20;\n    this.backupItemsArray = [];\n  }\n  CollectionRepeatDataSource.prototype = {\n    setup: function() {\n      if (this.isSetup) return;\n      this.isSetup = true;\n      for (var i = 0; i < this.BACKUP_ITEMS_LENGTH; i++) {\n        this.detachItem(this.createItem());\n      }\n    },\n    destroy: function() {\n      this.dimensions.length = 0;\n      this.data = null;\n      this.backupItemsArray.length = 0;\n      this.attachedItems = {};\n    },\n    calculateDataDimensions: function() {\n      var locals = {};\n      this.dimensions = this.data.map(function(value, index) {\n        locals[this.keyExpr] = value;\n        locals.$index = index;\n        return {\n          width: this.widthGetter(this.scope, locals),\n          height: this.heightGetter(this.scope, locals)\n        };\n      }, this);\n      this.dimensions = this.beforeSiblings.concat(this.dimensions).concat(this.afterSiblings);\n      this.dataStartIndex = this.beforeSiblings.length;\n    },\n    createItem: function() {\n      var item = {};\n\n      item.scope = this.scope.$new();\n      this.transcludeFn(item.scope, function(clone) {\n        clone.css('position', 'absolute');\n        item.element = clone;\n      });\n      this.transcludeParent.append(item.element);\n\n      return item;\n    },\n    getItem: function(index) {\n      if ( (item = this.attachedItems[index]) ) {\n        //do nothing, the item is good\n      } else if ( (item = this.backupItemsArray.pop()) ) {\n        reconnectScope(item.scope);\n      } else {\n        item = this.createItem();\n      }\n      return item;\n    },\n    attachItemAtIndex: function(index) {\n      if (index < this.dataStartIndex) {\n        return this.beforeSiblings[index];\n      }\n      // Subtract so we start at the beginning of this.data, after\n      // this.beforeSiblings.\n      index -= this.dataStartIndex;\n\n      if (index > this.data.length - 1) {\n        return this.afterSiblings[index - this.dataStartIndex];\n      }\n\n      var item = this.getItem(index);\n      var value = this.data[index];\n\n      if (item.index !== index || item.scope[this.keyExpr] !== value) {\n        item.index = item.scope.$index = index;\n        item.scope[this.keyExpr] = value;\n        item.scope.$first = (index === 0);\n        item.scope.$last = (index === (this.getLength() - 1));\n        item.scope.$middle = !(item.scope.$first || item.scope.$last);\n        item.scope.$odd = !(item.scope.$even = (index&1) === 0);\n\n        //We changed the scope, so digest if needed\n        if (!$rootScope.$$phase) {\n          item.scope.$digest();\n        }\n      }\n      this.attachedItems[index] = item;\n\n      return item;\n    },\n    destroyItem: function(item) {\n      item.element.remove();\n      item.scope.$destroy();\n      item.scope = null;\n      item.element = null;\n    },\n    detachItem: function(item) {\n      delete this.attachedItems[item.index];\n\n      //If it's an outside item, only hide it. These items aren't part of collection\n      //repeat's list, only sit outside\n      if (item.isOutside) {\n        hideWithTransform(item.element);\n      // If we are at the limit of backup items, just get rid of the this element\n      } else if (this.backupItemsArray.length >= this.BACKUP_ITEMS_LENGTH) {\n        this.destroyItem(item);\n      // Otherwise, add it to our backup items\n      } else {\n        this.backupItemsArray.push(item);\n        hideWithTransform(item.element);\n        //Don't .$destroy(), just stop watchers and events firing\n        disconnectScope(item.scope);\n      }\n\n    },\n    getLength: function() {\n      return this.dimensions && this.dimensions.length || 0;\n    },\n    setData: function(value, beforeSiblings, afterSiblings) {\n      this.data = value || [];\n      this.beforeSiblings = beforeSiblings || [];\n      this.afterSiblings = afterSiblings || [];\n      this.calculateDataDimensions();\n\n      this.afterSiblings.forEach(function(item) {\n        item.element.css({position: 'absolute', top: '0', left: '0' });\n        hideWithTransform(item.element);\n      });\n    },\n  };\n\n  return CollectionRepeatDataSource;\n}]);\n\nfunction disconnectScope(scope) {\n  if (scope.$root === scope) {\n    return; // we can't disconnect the root node;\n  }\n  var parent = scope.$parent;\n  scope.$$disconnected = true;\n  // See Scope.$destroy\n  if (parent.$$childHead === scope) {\n    parent.$$childHead = scope.$$nextSibling;\n  }\n  if (parent.$$childTail === scope) {\n    parent.$$childTail = scope.$$prevSibling;\n  }\n  if (scope.$$prevSibling) {\n    scope.$$prevSibling.$$nextSibling = scope.$$nextSibling;\n  }\n  if (scope.$$nextSibling) {\n    scope.$$nextSibling.$$prevSibling = scope.$$prevSibling;\n  }\n  scope.$$nextSibling = scope.$$prevSibling = null;\n}\n\nfunction reconnectScope(scope) {\n  if (scope.$root === scope) {\n    return; // we can't disconnect the root node;\n  }\n  if (!scope.$$disconnected) {\n    return;\n  }\n  var parent = scope.$parent;\n  scope.$$disconnected = false;\n  // See Scope.$new for this logic...\n  scope.$$prevSibling = parent.$$childTail;\n  if (parent.$$childHead) {\n    parent.$$childTail.$$nextSibling = scope;\n    parent.$$childTail = scope;\n  } else {\n    parent.$$childHead = parent.$$childTail = scope;\n  }\n}\n\n\nIonicModule\n.factory('$collectionRepeatManager', [\n  '$rootScope',\n  '$timeout',\nfunction($rootScope, $timeout) {\n  /**\n   * Vocabulary: \"primary\" and \"secondary\" size/direction/position mean\n   * \"y\" and \"x\" for vertical scrolling, or \"x\" and \"y\" for horizontal scrolling.\n   */\n  function CollectionRepeatManager(options) {\n    var self = this;\n    this.dataSource = options.dataSource;\n    this.element = options.element;\n    this.scrollView = options.scrollView;\n\n    this.isVertical = !!this.scrollView.options.scrollingY;\n    this.renderedItems = {};\n    this.dimensions = [];\n    this.setCurrentIndex(0);\n\n    //Override scrollview's render callback\n    this.scrollView.__$callback = this.scrollView.__callback;\n    this.scrollView.__callback = angular.bind(this, this.renderScroll);\n\n    function getViewportSize() { return self.viewportSize; }\n    //Set getters and setters to match whether this scrollview is vertical or not\n    if (this.isVertical) {\n      this.scrollView.options.getContentHeight = getViewportSize;\n\n      this.scrollValue = function() {\n        return this.scrollView.__scrollTop;\n      };\n      this.scrollMaxValue = function() {\n        return this.scrollView.__maxScrollTop;\n      };\n      this.scrollSize = function() {\n        return this.scrollView.__clientHeight;\n      };\n      this.secondaryScrollSize = function() {\n        return this.scrollView.__clientWidth;\n      };\n      this.transformString = function(y, x) {\n        return 'translate3d('+x+'px,'+y+'px,0)';\n      };\n      this.primaryDimension = function(dim) {\n        return dim.height;\n      };\n      this.secondaryDimension = function(dim) {\n        return dim.width;\n      };\n    } else {\n      this.scrollView.options.getContentWidth = getViewportSize;\n\n      this.scrollValue = function() {\n        return this.scrollView.__scrollLeft;\n      };\n      this.scrollMaxValue = function() {\n        return this.scrollView.__maxScrollLeft;\n      };\n      this.scrollSize = function() {\n        return this.scrollView.__clientWidth;\n      };\n      this.secondaryScrollSize = function() {\n        return this.scrollView.__clientHeight;\n      };\n      this.transformString = function(x, y) {\n        return 'translate3d('+x+'px,'+y+'px,0)';\n      };\n      this.primaryDimension = function(dim) {\n        return dim.width;\n      };\n      this.secondaryDimension = function(dim) {\n        return dim.height;\n      };\n    }\n  }\n\n  CollectionRepeatManager.prototype = {\n    destroy: function() {\n      this.renderedItems = {};\n      this.render = angular.noop;\n      this.calculateDimensions = angular.noop;\n      this.dimensions = [];\n    },\n\n    /*\n     * Pre-calculate the position of all items in the data list.\n     * Do this using the provided width and height (primarySize and secondarySize)\n     * provided by the dataSource.\n     */\n    calculateDimensions: function() {\n      /*\n       * For the sake of explanations below, we're going to pretend we are scrolling\n       * vertically: Items are laid out with primarySize being height,\n       * secondarySize being width.\n       */\n      var primaryPos = 0;\n      var secondaryPos = 0;\n      var secondaryScrollSize = this.secondaryScrollSize();\n      var previousItem;\n\n      this.dataSource.beforeSiblings && this.dataSource.beforeSiblings.forEach(calculateSize, this);\n      var beforeSize = primaryPos + (previousItem ? previousItem.primarySize : 0);\n\n      primaryPos = secondaryPos = 0;\n      previousItem = null;\n\n      var dimensions = this.dataSource.dimensions.map(calculateSize, this);\n      var totalSize = primaryPos + (previousItem ? previousItem.primarySize : 0);\n\n      return {\n        beforeSize: beforeSize,\n        totalSize: totalSize,\n        dimensions: dimensions\n      };\n\n      function calculateSize(dim) {\n\n        //Each dimension is an object {width: Number, height: Number} provided by\n        //the dataSource\n        var rect = {\n          //Get the height out of the dimension object\n          primarySize: this.primaryDimension(dim),\n          //Max out the item's width to the width of the scrollview\n          secondarySize: Math.min(this.secondaryDimension(dim), secondaryScrollSize)\n        };\n\n        //If this isn't the first item\n        if (previousItem) {\n          //Move the item's x position over by the width of the previous item\n          secondaryPos += previousItem.secondarySize;\n          //If the y position is the same as the previous item and\n          //the x position is bigger than the scroller's width\n          if (previousItem.primaryPos === primaryPos &&\n              secondaryPos + rect.secondarySize > secondaryScrollSize) {\n            //Then go to the next row, with x position 0\n            secondaryPos = 0;\n            primaryPos += previousItem.primarySize;\n          }\n        }\n\n        rect.primaryPos = primaryPos;\n        rect.secondaryPos = secondaryPos;\n\n        previousItem = rect;\n        return rect;\n      }\n    },\n    resize: function() {\n      var result = this.calculateDimensions();\n      this.dimensions = result.dimensions;\n      this.viewportSize = result.totalSize;\n      this.beforeSize = result.beforeSize;\n      this.setCurrentIndex(0);\n      this.render(true);\n      this.dataSource.setup();\n    },\n    /*\n     * setCurrentIndex sets the index in the list that matches the scroller's position.\n     * Also save the position in the scroller for next and previous items (if they exist)\n     */\n    setCurrentIndex: function(index, height) {\n      var currentPos = (this.dimensions[index] || {}).primaryPos || 0;\n      this.currentIndex = index;\n\n      this.hasPrevIndex = index > 0;\n      if (this.hasPrevIndex) {\n        this.previousPos = Math.max(\n          currentPos - this.dimensions[index - 1].primarySize,\n          this.dimensions[index - 1].primaryPos\n        );\n      }\n      this.hasNextIndex = index + 1 < this.dataSource.getLength();\n      if (this.hasNextIndex) {\n        this.nextPos = Math.min(\n          currentPos + this.dimensions[index + 1].primarySize,\n          this.dimensions[index + 1].primaryPos\n        );\n      }\n    },\n    /**\n     * override the scroller's render callback to check if we need to\n     * re-render our collection\n     */\n    renderScroll: ionic.animationFrameThrottle(function(transformLeft, transformTop, zoom, wasResize) {\n      if (this.isVertical) {\n        this.renderIfNeeded(transformTop);\n      } else {\n        this.renderIfNeeded(transformLeft);\n      }\n      return this.scrollView.__$callback(transformLeft, transformTop, zoom, wasResize);\n    }),\n\n    renderIfNeeded: function(scrollPos) {\n      if ((this.hasNextIndex && scrollPos >= this.nextPos) ||\n          (this.hasPrevIndex && scrollPos < this.previousPos)) {\n           // Math.abs(transformPos - this.lastRenderScrollValue) > 100) {\n        this.render();\n      }\n    },\n    /*\n     * getIndexForScrollValue: Given the most recent data index and a new scrollValue,\n     * find the data index that matches that scrollValue.\n     *\n     * Strategy (if we are scrolling down): keep going forward in the dimensions list,\n     * starting at the given index, until an item with height matching the new scrollValue\n     * is found.\n     *\n     * This is a while loop. In the worst case it will have to go through the whole list\n     * (eg to scroll from top to bottom).  The most common case is to scroll\n     * down 1-3 items at a time.\n     *\n     * While this is not as efficient as it could be, optimizing it gives no noticeable\n     * benefit.  We would have to use a new memory-intensive data structure for dimensions\n     * to fully optimize it.\n     */\n    getIndexForScrollValue: function(i, scrollValue) {\n      var rect;\n      //Scrolling up\n      if (scrollValue <= this.dimensions[i].primaryPos) {\n        while ( (rect = this.dimensions[i - 1]) && rect.primaryPos > scrollValue) {\n          i--;\n        }\n      //Scrolling down\n      } else {\n        while ( (rect = this.dimensions[i + 1]) && rect.primaryPos < scrollValue) {\n          i++;\n        }\n      }\n      return i;\n    },\n    /*\n     * render: Figure out the scroll position, the index matching it, and then tell\n     * the data source to render the correct items into the DOM.\n     */\n    render: function(shouldRedrawAll) {\n      var self = this;\n      var i;\n      var isOutOfBounds = ( this.currentIndex >= this.dataSource.getLength() );\n      // We want to remove all the items and redraw everything if we're out of bounds\n      // or a flag is passed in.\n      if (isOutOfBounds || shouldRedrawAll) {\n        for (i in this.renderedItems) {\n          this.removeItem(i);\n        }\n        // Just don't render anything if we're out of bounds\n        if (isOutOfBounds) return;\n      }\n\n      var rect;\n      var scrollValue = this.scrollValue();\n      // Scroll size = how many pixels are visible in the scroller at one time\n      var scrollSize = this.scrollSize();\n      // We take the current scroll value and add it to the scrollSize to get\n      // what scrollValue the current visible scroll area ends at.\n      var scrollSizeEnd = scrollSize + scrollValue;\n      // Get the new start index for scrolling, based on the current scrollValue and\n      // the most recent known index\n      var startIndex = this.getIndexForScrollValue(this.currentIndex, scrollValue);\n\n      // If we aren't on the first item, add one row of items before so that when the user is\n      // scrolling up he sees the previous item\n      var renderStartIndex = Math.max(startIndex - 1, 0);\n      // Keep adding items to the 'extra row above' until we get to a new row.\n      // This is for the case where there are multiple items on one row above\n      // the current item; we want to keep adding items above until\n      // a new row is reached.\n      while (renderStartIndex > 0 &&\n         (rect = this.dimensions[renderStartIndex]) &&\n         rect.primaryPos === this.dimensions[startIndex - 1].primaryPos) {\n        renderStartIndex--;\n      }\n\n      // Keep rendering items, adding them until we are past the end of the visible scroll area\n      i = renderStartIndex;\n      while ((rect = this.dimensions[i]) && (rect.primaryPos - rect.primarySize < scrollSizeEnd)) {\n        doRender(i, rect);\n        i++;\n      }\n\n      // Render two extra items at the end as a buffer\n      if (self.dimensions[i]) {\n        doRender(i, self.dimensions[i]);\n        i++;\n      }\n      if (self.dimensions[i]) {\n        doRender(i, self.dimensions[i]);\n      }\n      var renderEndIndex = i;\n\n      // Remove any items that were rendered and aren't visible anymore\n      for (var renderIndex in this.renderedItems) {\n        if (renderIndex < renderStartIndex || renderIndex > renderEndIndex) {\n          this.removeItem(renderIndex);\n        }\n      }\n\n      this.setCurrentIndex(startIndex);\n\n      function doRender(dataIndex, rect) {\n        if (dataIndex < self.dataSource.dataStartIndex) {\n          // do nothing\n        } else {\n          self.renderItem(dataIndex, rect.primaryPos - self.beforeSize, rect.secondaryPos);\n        }\n      }\n    },\n    renderItem: function(dataIndex, primaryPos, secondaryPos) {\n      // Attach an item, and set its transform position to the required value\n      var item = this.dataSource.attachItemAtIndex(dataIndex);\n      void 0;\n      if (item && item.element) {\n        if (item.primaryPos !== primaryPos || item.secondaryPos !== secondaryPos) {\n          item.element.css(ionic.CSS.TRANSFORM, this.transformString(\n            primaryPos, secondaryPos\n          ));\n          item.primaryPos = primaryPos;\n          item.secondaryPos = secondaryPos;\n        }\n        // Save the item in rendered items\n        this.renderedItems[dataIndex] = item;\n      } else {\n        // If an item at this index doesn't exist anymore, be sure to delete\n        // it from rendered items\n        delete this.renderedItems[dataIndex];\n      }\n    },\n    removeItem: function(dataIndex) {\n      // Detach a given item\n      var item = this.renderedItems[dataIndex];\n      if (item) {\n        item.primaryPos = item.secondaryPos = null;\n        this.dataSource.detachItem(item);\n        delete this.renderedItems[dataIndex];\n      }\n    }\n  };\n\n  return CollectionRepeatManager;\n}]);\n\n\nfunction delegateService(methodNames) {\n  return ['$log', function($log) {\n    var delegate = this;\n\n    var instances = this._instances = [];\n    this._registerInstance = function(instance, handle) {\n      instance.$$delegateHandle = handle;\n      instances.push(instance);\n\n      return function deregister() {\n        var index = instances.indexOf(instance);\n        if (index !== -1) {\n          instances.splice(index, 1);\n        }\n      };\n    };\n\n    this.$getByHandle = function(handle) {\n      if (!handle) {\n        return delegate;\n      }\n      return new InstanceForHandle(handle);\n    };\n\n    /*\n     * Creates a new object that will have all the methodNames given,\n     * and call them on the given the controller instance matching given\n     * handle.\n     * The reason we don't just let $getByHandle return the controller instance\n     * itself is that the controller instance might not exist yet.\n     *\n     * We want people to be able to do\n     * `var instance = $ionicScrollDelegate.$getByHandle('foo')` on controller\n     * instantiation, but on controller instantiation a child directive\n     * may not have been compiled yet!\n     *\n     * So this is our way of solving this problem: we create an object\n     * that will only try to fetch the controller with given handle\n     * once the methods are actually called.\n     */\n    function InstanceForHandle(handle) {\n      this.handle = handle;\n    }\n    methodNames.forEach(function(methodName) {\n      InstanceForHandle.prototype[methodName] = function() {\n        var handle = this.handle;\n        var args = arguments;\n        var matchingInstancesFound = 0;\n        var finalResult;\n        var result;\n\n        //This logic is repeated below; we could factor some of it out to a function\n        //but don't because it lets this method be more performant (one loop versus 2)\n        instances.forEach(function(instance) {\n          if (instance.$$delegateHandle === handle) {\n            matchingInstancesFound++;\n            result = instance[methodName].apply(instance, args);\n            //Only return the value from the first call\n            if (matchingInstancesFound === 1) {\n              finalResult = result;\n            }\n          }\n        });\n\n        if (!matchingInstancesFound) {\n          return $log.warn(\n            'Delegate for handle \"'+this.handle+'\" could not find a ' +\n            'corresponding element with delegate-handle=\"'+this.handle+'\"! ' +\n            methodName + '() was not called!\\n' +\n            'Possible cause: If you are calling ' + methodName + '() immediately, and ' +\n            'your element with delegate-handle=\"' + this.handle + '\" is a child of your ' +\n            'controller, then your element may not be compiled yet. Put a $timeout ' +\n            'around your call to ' + methodName + '() and try again.'\n          );\n        }\n\n        return finalResult;\n      };\n      delegate[methodName] = function() {\n        var args = arguments;\n        var finalResult;\n        var result;\n\n        //This logic is repeated above\n        instances.forEach(function(instance, index) {\n          result = instance[methodName].apply(instance, args);\n          //Only return the value from the first call\n          if (index === 0) {\n            finalResult = result;\n          }\n        });\n\n        return finalResult;\n      };\n\n      function callMethod(instancesToUse, methodName, args) {\n        var finalResult;\n        var result;\n        instancesToUse.forEach(function(instance, index) {\n          result = instance[methodName].apply(instance, args);\n          //Make it so the first result is the one returned\n          if (index === 0) {\n            finalResult = result;\n          }\n        });\n        return finalResult;\n      }\n    });\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $ionicGesture\n * @module ionic\n * @description An angular service exposing ionic\n * {@link ionic.utility:ionic.EventController}'s gestures.\n */\nIonicModule\n.factory('$ionicGesture', [function() {\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicGesture#on\n     * @description Add an event listener for a gesture on an element. See {@link ionic.utility:ionic.EventController#onGesture}.\n     * @param {string} eventType The gesture event to listen for.\n     * @param {function(e)} callback The function to call when the gesture\n     * happens.\n     * @param {element} $element The angular element to listen for the event on.\n     * @returns {ionic.Gesture} The gesture object (use this to remove the gesture later on).\n     */\n    on: function(eventType, cb, $element, options) {\n      return window.ionic.onGesture(eventType, cb, $element[0], options);\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicGesture#off\n     * @description Remove an event listener for a gesture on an element. See {@link ionic.utility:ionic.EventController#offGesture}.\n     * @param {ionic.Gesture} gesture The gesture that should be removed.\n     * @param {string} eventType The gesture event to remove the listener for.\n     * @param {function(e)} callback The listener to remove.\n     */\n    off: function(gesture, eventType, cb) {\n      return window.ionic.offGesture(gesture, eventType, cb);\n    }\n  };\n}]);\n\n/**\n * @ngdoc provider\n * @name $ionicConfigProvider\n * @module ionic\n * @description $ionicConfigProvider can be used during the configuration phase of your app\n * to change how Ionic works.\n *\n * @usage\n * ```js\n * var myApp = angular.module('reallyCoolApp', ['ionic']);\n *\n * myApp.config(function($ionicConfigProvider) {\n *   $ionicConfigProvider.prefetchTemplates(false);\n * });\n * ```\n */\nIonicModule\n.provider('$ionicConfig', function() {\n\n  var provider = this;\n  var config = {\n    prefetchTemplates: true\n  };\n\n  /**\n   * @ngdoc method\n   * @name $ionicConfigProvider#prefetchTemplates\n   * @description Set whether Ionic should prefetch all templateUrls defined in\n   * $stateProvider.state. Default true. If set to false, the user will have to wait\n   * for a template to be fetched the first time he/she is going to a a new page.\n   * @param shouldPrefetch Whether Ionic should prefetch templateUrls defined in\n   * `$stateProvider.state()`. Default true.\n   * @returns {boolean} Whether Ionic will prefetch templateUrls defined in $stateProvider.state.\n   */\n  this.prefetchTemplates = function(newValue) {\n    if (arguments.length) {\n      config.prefetchTemplates = newValue;\n    }\n    return config.prefetchTemplates;\n  };\n\n  // private: Service definition for internal Ionic use\n  /**\n   * @ngdoc service\n   * @name $ionicConfig\n   * @module ionic\n   * @private\n   */\n  this.$get = function() {\n    return config;\n  };\n});\n\n\nvar LOADING_TPL =\n  '<div class=\"loading-container\">' +\n    '<div class=\"loading\">' +\n    '</div>' +\n  '</div>';\n\nvar LOADING_HIDE_DEPRECATED = '$ionicLoading instance.hide() has been deprecated. Use $ionicLoading.hide().';\nvar LOADING_SHOW_DEPRECATED = '$ionicLoading instance.show() has been deprecated. Use $ionicLoading.show().';\nvar LOADING_SET_DEPRECATED = '$ionicLoading instance.setContent() has been deprecated. Use $ionicLoading.show({ template: \\'my content\\' }).';\n\n/**\n * @ngdoc service\n * @name $ionicLoading\n * @module ionic\n * @description\n * An overlay that can be used to indicate activity while blocking user\n * interaction.\n *\n * @usage\n * ```js\n * angular.module('LoadingApp', ['ionic'])\n * .controller('LoadingCtrl', function($scope, $ionicLoading) {\n *   $scope.show = function() {\n *     $ionicLoading.show({\n *       template: 'Loading...'\n *     });\n *   };\n *   $scope.hide = function(){\n *     $ionicLoading.hide();\n *   };\n * });\n * ```\n */\n/**\n * @ngdoc object\n * @name $ionicLoadingConfig\n * @module ionic\n * @description\n * Set the default options to be passed to the {@link ionic.service:$ionicLoading} service.\n *\n * @usage\n * ```js\n * var app = angular.module('myApp', ['ionic'])\n * app.constant('$ionicLoadingConfig', {\n *   template: 'Default Loading Template...'\n * });\n * app.controller('AppCtrl', function($scope, $ionicLoading) {\n *   $scope.showLoading = function() {\n *     $ionicLoading.show(); //options default to values in $ionicLoadingConfig\n *   };\n * });\n * ```\n */\nIonicModule\n.constant('$ionicLoadingConfig', {\n  template: '<i class=\"ion-loading-d\"></i>'\n})\n.factory('$ionicLoading', [\n  '$ionicLoadingConfig',\n  '$ionicBody',\n  '$ionicTemplateLoader',\n  '$ionicBackdrop',\n  '$timeout',\n  '$q',\n  '$log',\n  '$compile',\n  '$ionicPlatform',\nfunction($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $compile, $ionicPlatform) {\n\n  var loaderInstance;\n  //default values\n  var deregisterBackAction = angular.noop;\n  var loadingShowDelay = $q.when();\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicLoading#show\n     * @description Shows a loading indicator. If the indicator is already shown,\n     * it will set the options given and keep the indicator shown.\n     * @param {object} opts The options for the loading indicator. Available properties:\n     *  - `{string=}` `template` The html content of the indicator.\n     *  - `{string=}` `templateUrl` The url of an html template to load as the content of the indicator.\n     *  - `{boolean=}` `noBackdrop` Whether to hide the backdrop. By default it will be shown.\n     *  - `{number=}` `delay` How many milliseconds to delay showing the indicator. By default there is no delay.\n     *  - `{number=}` `duration` How many milliseconds to wait until automatically\n     *  hiding the indicator. By default, the indicator will be shown until `.hide()` is called.\n     */\n    show: showLoader,\n    /**\n     * @ngdoc method\n     * @name $ionicLoading#hide\n     * @description Hides the loading indicator, if shown.\n     */\n    hide: hideLoader,\n    /**\n     * @private for testing\n     */\n    _getLoader: getLoader\n  };\n\n  function getLoader() {\n    if (!loaderInstance) {\n      loaderInstance = $ionicTemplateLoader.compile({\n        template: LOADING_TPL,\n        appendTo: $ionicBody.get()\n      })\n      .then(function(loader) {\n        var self = loader;\n\n        loader.show = function(options) {\n          var templatePromise = options.templateUrl ?\n            $ionicTemplateLoader.load(options.templateUrl) :\n            //options.content: deprecated\n            $q.when(options.template || options.content || '');\n\n\n          if (!this.isShown) {\n            //options.showBackdrop: deprecated\n            this.hasBackdrop = !options.noBackdrop && options.showBackdrop !== false;\n            if (this.hasBackdrop) {\n              $ionicBackdrop.retain();\n              $ionicBackdrop.getElement().addClass('backdrop-loading');\n            }\n          }\n\n          if (options.duration) {\n            $timeout.cancel(this.durationTimeout);\n            this.durationTimeout = $timeout(\n              angular.bind(this, this.hide),\n              +options.duration\n            );\n          }\n\n          templatePromise.then(function(html) {\n            if (html) {\n              var loading = self.element.children();\n              loading.html(html);\n              $compile(loading.contents())(self.scope);\n            }\n\n            //Don't show until template changes\n            if (self.isShown) {\n              self.element.addClass('visible');\n              ionic.requestAnimationFrame(function() {\n                if(self.isShown) {\n                  self.element.addClass('active');\n                  $ionicBody.addClass('loading-active');\n                }\n              });\n            }\n          });\n\n          this.isShown = true;\n        };\n        loader.hide = function() {\n          if (this.isShown) {\n            if (this.hasBackdrop) {\n              $ionicBackdrop.release();\n              $ionicBackdrop.getElement().removeClass('backdrop-loading');\n            }\n            self.element.removeClass('active');\n            $ionicBody.removeClass('loading-active');\n            setTimeout(function() {\n              !self.isShown && self.element.removeClass('visible');\n            }, 200);\n          }\n          $timeout.cancel(this.durationTimeout);\n          this.isShown = false;\n        };\n\n        return loader;\n      });\n    }\n    return loaderInstance;\n  }\n\n  function showLoader(options) {\n    options = extend($ionicLoadingConfig || {}, options || {});\n    var delay = options.delay || options.showDelay || 0;\n\n    //If loading.show() was called previously, cancel it and show with our new options\n    loadingShowDelay && $timeout.cancel(loadingShowDelay);\n    loadingShowDelay = $timeout(angular.noop, delay);\n\n    loadingShowDelay.then(getLoader).then(function(loader) {\n      deregisterBackAction();\n      //Disable hardware back button while loading\n      deregisterBackAction = $ionicPlatform.registerBackButtonAction(\n        angular.noop,\n        PLATFORM_BACK_BUTTON_PRIORITY_LOADING\n      );\n      return loader.show(options);\n    });\n\n    return {\n      hide: deprecated.method(LOADING_HIDE_DEPRECATED, $log.error, hideLoader),\n      show: deprecated.method(LOADING_SHOW_DEPRECATED, $log.error, function() {\n        showLoader(options);\n      }),\n      setContent: deprecated.method(LOADING_SET_DEPRECATED, $log.error, function(content) {\n        getLoader().then(function(loader) {\n          loader.show({ template: content });\n        });\n      })\n    };\n  }\n\n  function hideLoader() {\n    deregisterBackAction();\n    $timeout.cancel(loadingShowDelay);\n    getLoader().then(function(loader) {\n      loader.hide();\n    });\n  }\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicModal\n * @module ionic\n * @description\n *\n * Related: {@link ionic.controller:ionicModal ionicModal controller}.\n *\n * The Modal is a content pane that can go over the user's main view\n * temporarily.  Usually used for making a choice or editing an item.\n *\n * Put the content of the modal inside of an `<ion-modal-view>` element.\n *\n * Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating\n * scope, passing in itself as an event argument. Both the modal.removed and modal.hidden events are\n * called when the modal is removed.\n *\n * @usage\n * ```html\n * <script id=\"my-modal.html\" type=\"text/ng-template\">\n *   <ion-modal-view>\n *     <ion-header-bar>\n *       <h1 class=\"title\">My Modal title</h1>\n *     </ion-header-bar>\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-modal-view>\n * </script>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $ionicModal) {\n *   $ionicModal.fromTemplateUrl('my-modal.html', {\n *     scope: $scope,\n *     animation: 'slide-in-up'\n *   }).then(function(modal) {\n *     $scope.modal = modal;\n *   });\n *   $scope.openModal = function() {\n *     $scope.modal.show();\n *   };\n *   $scope.closeModal = function() {\n *     $scope.modal.hide();\n *   };\n *   //Cleanup the modal when we're done with it!\n *   $scope.$on('$destroy', function() {\n *     $scope.modal.remove();\n *   });\n *   // Execute action on hide modal\n *   $scope.$on('modal.hidden', function() {\n *     // Execute action\n *   });\n *   // Execute action on remove modal\n *   $scope.$on('modal.removed', function() {\n *     // Execute action\n *   });\n * });\n * ```\n */\nIonicModule\n.factory('$ionicModal', [\n  '$rootScope',\n  '$ionicBody',\n  '$compile',\n  '$timeout',\n  '$ionicPlatform',\n  '$ionicTemplateLoader',\n  '$q',\n  '$log',\nfunction($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTemplateLoader, $q, $log) {\n\n  /**\n   * @ngdoc controller\n   * @name ionicModal\n   * @module ionic\n   * @description\n   * Instantiated by the {@link ionic.service:$ionicModal} service.\n   *\n   * Be sure to call [remove()](#remove) when you are done with each modal\n   * to clean it up and avoid memory leaks.\n   *\n   * Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating\n   * scope, passing in itself as an event argument. Note: both modal.removed and modal.hidden are\n   * called when the modal is removed.\n   */\n  var ModalView = ionic.views.Modal.inherit({\n    /**\n     * @ngdoc method\n     * @name ionicModal#initialize\n     * @description Creates a new modal controller instance.\n     * @param {object} options An options object with the following properties:\n     *  - `{object=}` `scope` The scope to be a child of.\n     *    Default: creates a child of $rootScope.\n     *  - `{string=}` `animation` The animation to show & hide with.\n     *    Default: 'slide-in-up'\n     *  - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of\n     *    the modal when shown.  Default: false.\n     *  - `{boolean=}` `backdropClickToClose` Whether to close the modal on clicking the backdrop.\n     *    Default: true.\n     *  - `{boolean=}` `hardwareBackButtonClose` Whether the modal can be closed using the hardware\n     *    back button on Android and similar devices.  Default: true.\n     */\n    initialize: function(opts) {\n      ionic.views.Modal.prototype.initialize.call(this, opts);\n      this.animation = opts.animation || 'slide-in-up';\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#show\n     * @description Show this modal instance.\n     * @returns {promise} A promise which is resolved when the modal is finished animating in.\n     */\n    show: function(target) {\n      var self = this;\n\n      if(self.scope.$$destroyed) {\n        $log.error('Cannot call ' +  self.viewType + '.show() after remove(). Please create a new ' +  self.viewType + ' instance.');\n        return;\n      }\n\n      var modalEl = jqLite(self.modalEl);\n\n      self.el.classList.remove('hide');\n      $timeout(function(){\n        $ionicBody.addClass(self.viewType + '-open');\n      }, 400);\n\n      if(!self.el.parentElement) {\n        modalEl.addClass(self.animation);\n        $ionicBody.append(self.el);\n      }\n\n      if(target && self.positionView) {\n        self.positionView(target, modalEl);\n      }\n\n      modalEl.addClass('ng-enter active')\n             .removeClass('ng-leave ng-leave-active');\n\n      self._isShown = true;\n      self._deregisterBackButton = $ionicPlatform.registerBackButtonAction(\n        self.hardwareBackButtonClose ? angular.bind(self, self.hide) : angular.noop,\n        PLATFORM_BACK_BUTTON_PRIORITY_MODAL\n      );\n\n      self._isOpenPromise = $q.defer();\n\n      ionic.views.Modal.prototype.show.call(self);\n\n      $timeout(function(){\n        modalEl.addClass('ng-enter-active');\n        ionic.trigger('resize');\n        self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.shown', self);\n        self.el.classList.add('active');\n      }, 20);\n\n      return $timeout(function() {\n        //After animating in, allow hide on backdrop click\n        self.$el.on('click', function(e) {\n          if (self.backdropClickToClose && e.target === self.el) {\n            self.hide();\n          }\n        });\n      }, 400);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#hide\n     * @description Hide this modal instance.\n     * @returns {promise} A promise which is resolved when the modal is finished animating out.\n     */\n    hide: function() {\n      var self = this;\n      var modalEl = jqLite(self.modalEl);\n\n      self.el.classList.remove('active');\n      modalEl.addClass('ng-leave');\n\n      $timeout(function(){\n        modalEl.addClass('ng-leave-active')\n               .removeClass('ng-enter ng-enter-active active');\n      }, 20);\n\n      self.$el.off('click');\n      self._isShown = false;\n      self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.hidden', self);\n      self._deregisterBackButton && self._deregisterBackButton();\n\n      ionic.views.Modal.prototype.hide.call(self);\n\n      return $timeout(function(){\n        $ionicBody.removeClass(self.viewType + '-open');\n        self.el.classList.add('hide');\n      }, self.hideDelay || 320);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#remove\n     * @description Remove this modal instance from the DOM and clean up.\n     * @returns {promise} A promise which is resolved when the modal is finished animating out.\n     */\n    remove: function() {\n      var self = this;\n      self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.removed', self);\n\n      return self.hide().then(function() {\n        self.scope.$destroy();\n        self.$el.remove();\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#isShown\n     * @returns boolean Whether this modal is currently shown.\n     */\n    isShown: function() {\n      return !!this._isShown;\n    }\n  });\n\n  var createModal = function(templateString, options) {\n    // Create a new scope for the modal\n    var scope = options.scope && options.scope.$new() || $rootScope.$new(true);\n\n    options.viewType = options.viewType || 'modal';\n\n    extend(scope, {\n      $hasHeader: false,\n      $hasSubheader: false,\n      $hasFooter: false,\n      $hasSubfooter: false,\n      $hasTabs: false,\n      $hasTabsTop: false\n    });\n\n    // Compile the template\n    var element = $compile('<ion-' + options.viewType + '>' + templateString + '</ion-' + options.viewType + '>')(scope);\n\n    options.$el = element;\n    options.el = element[0];\n    options.modalEl = options.el.querySelector('.' + options.viewType);\n    var modal = new ModalView(options);\n\n    modal.scope = scope;\n\n    // If this wasn't a defined scope, we can assign the viewType to the isolated scope\n    // we created\n    if(!options.scope) {\n      scope[ options.viewType ] = modal;\n    }\n\n    return modal;\n  };\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicModal#fromTemplate\n     * @param {string} templateString The template string to use as the modal's\n     * content.\n     * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method.\n     * @returns {object} An instance of an {@link ionic.controller:ionicModal}\n     * controller.\n     */\n    fromTemplate: function(templateString, options) {\n      var modal = createModal(templateString, options || {});\n      return modal;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicModal#fromTemplateUrl\n     * @param {string} templateUrl The url to load the template from.\n     * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method.\n     * options object.\n     * @returns {promise} A promise that will be resolved with an instance of\n     * an {@link ionic.controller:ionicModal} controller.\n     */\n    fromTemplateUrl: function(url, options, _) {\n      var cb;\n      //Deprecated: allow a callback as second parameter. Now we return a promise.\n      if (angular.isFunction(options)) {\n        cb = options;\n        options = _;\n      }\n      return $ionicTemplateLoader.load(url).then(function(templateString) {\n        var modal = createModal(templateString, options || {});\n        cb && cb(modal);\n        return modal;\n      });\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicNavBarDelegate\n * @module ionic\n * @description\n * Delegate for controlling the {@link ionic.directive:ionNavBar} directive.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-nav-bar>\n *     <button ng-click=\"setNavTitle('banana')\">\n *       Set title to banana!\n *     </button>\n *   </ion-nav-bar>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicNavBarDelegate) {\n *   $scope.setNavTitle = function(title) {\n *     $ionicNavBarDelegate.setTitle(title);\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicNavBarDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#back\n   * @description Goes back in the view history.\n   * @param {DOMEvent=} event The event object (eg from a tap event)\n   */\n  'back',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#align\n   * @description Aligns the title with the buttons in a given direction.\n   * @param {string=} direction The direction to the align the title text towards.\n   * Available: 'left', 'right', 'center'. Default: 'center'.\n   */\n  'align',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#showBackButton\n   * @description\n   * Set/get whether the {@link ionic.directive:ionNavBackButton} is shown\n   * (if it exists).\n   * @param {boolean=} show Whether to show the back button.\n   * @returns {boolean} Whether the back button is shown.\n   */\n  'showBackButton',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#showBar\n   * @description\n   * Set/get whether the {@link ionic.directive:ionNavBar} is shown.\n   * @param {boolean} show Whether to show the bar.\n   * @returns {boolean} Whether the bar is shown.\n   */\n  'showBar',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#setTitle\n   * @description\n   * Set the title for the {@link ionic.directive:ionNavBar}.\n   * @param {string} title The new title to show.\n   */\n  'setTitle',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#changeTitle\n   * @description\n   * Change the title, transitioning the new title in and the old one out in a given direction.\n   * @param {string} title The new title to show.\n   * @param {string} direction The direction to transition the new title in.\n   * Available: 'forward', 'back'.\n   */\n  'changeTitle',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#getTitle\n   * @returns {string} The current title of the navbar.\n   */\n  'getTitle',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#getPreviousTitle\n   * @returns {string} The previous title of the navbar.\n   */\n  'getPreviousTitle'\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * navBars with delegate-handle matching the given handle.\n   *\n   * Example: `$ionicNavBarDelegate.$getByHandle('myHandle').setTitle('newTitle')`\n   */\n]));\n\nvar PLATFORM_BACK_BUTTON_PRIORITY_VIEW = 100;\nvar PLATFORM_BACK_BUTTON_PRIORITY_SIDE_MENU = 150;\nvar PLATFORM_BACK_BUTTON_PRIORITY_MODAL = 200;\nvar PLATFORM_BACK_BUTTON_PRIORITY_ACTION_SHEET = 300;\nvar PLATFORM_BACK_BUTTON_PRIORITY_POPUP = 400;\nvar PLATFORM_BACK_BUTTON_PRIORITY_LOADING = 500;\n\nfunction componentConfig(defaults) {\n  defaults.$get = function() { return defaults; };\n  return defaults;\n}\n\nIonicModule\n.constant('$ionicPlatformDefaults', {\n  'ios': {\n    '$ionicNavBarConfig': {\n      transition: 'nav-title-slide-ios',//nav-title-slide-ios7',\n      alignTitle: 'center',\n      backButtonIcon: 'ion-ios7-arrow-back'\n    },\n    '$ionicNavViewConfig': {\n      //transition: 'slide-left-right-ios'\n      transition: 'slide-ios'\n    },\n    '$ionicTabsConfig': {\n      type: '',\n      position: ''\n    }\n  },\n  'android': {\n    '$ionicNavBarConfig': {\n      transition: 'nav-title-slide-full',\n      alignTitle: 'center',\n      backButtonIcon: 'ion-ios7-arrow-back'\n    },\n    '$ionicNavViewConfig': {\n      transition: 'slide-full'\n    },\n    '$ionicTabsConfig': {\n      type: 'tabs-striped',\n      position: ''\n    }\n  }\n});\n\n\nIonicModule.config([\n  '$ionicPlatformDefaults',\n\n  '$injector',\n\nfunction($ionicPlatformDefaults, $injector) {\n  var platform = ionic.Platform.platform();\n\n  var applyConfig = function(platformDefaults) {\n    forEach(platformDefaults, function(defaults, constantName) {\n      extend($injector.get(constantName), defaults);\n    });\n  };\n\n  switch(platform) {\n    case 'ios':\n      applyConfig($ionicPlatformDefaults.ios);\n      break;\n    case 'android':\n      applyConfig($ionicPlatformDefaults.android);\n      break;\n  }\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicPlatform\n * @module ionic\n * @description\n * An angular abstraction of {@link ionic.utility:ionic.Platform}.\n *\n * Used to detect the current platform, as well as do things like override the\n * Android back button in PhoneGap/Cordova.\n */\nIonicModule\n.provider('$ionicPlatform', function() {\n  return {\n    $get: ['$q', '$rootScope', function($q, $rootScope) {\n      var self = {\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#onHardwareBackButton\n         * @description\n         * Some platforms have a hardware back button, so this is one way to\n         * bind to it.\n         * @param {function} callback the callback to trigger when this event occurs\n         */\n        onHardwareBackButton: function(cb) {\n          ionic.Platform.ready(function() {\n            document.addEventListener('backbutton', cb, false);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#offHardwareBackButton\n         * @description\n         * Remove an event listener for the backbutton.\n         * @param {function} callback The listener function that was\n         * originally bound.\n         */\n        offHardwareBackButton: function(fn) {\n          ionic.Platform.ready(function() {\n            document.removeEventListener('backbutton', fn);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#registerBackButtonAction\n         * @description\n         * Register a hardware back button action. Only one action will execute\n         * when the back button is clicked, so this method decides which of\n         * the registered back button actions has the highest priority.\n         *\n         * For example, if an actionsheet is showing, the back button should\n         * close the actionsheet, but it should not also go back a page view\n         * or close a modal which may be open.\n         *\n         * @param {function} callback Called when the back button is pressed,\n         * if this listener is the highest priority.\n         * @param {number} priority Only the highest priority will execute.\n         * @param {*=} actionId The id to assign this action. Default: a\n         * random unique id.\n         * @returns {function} A function that, when called, will deregister\n         * this backButtonAction.\n         */\n        $backButtonActions: {},\n        registerBackButtonAction: function(fn, priority, actionId) {\n\n          if(!self._hasBackButtonHandler) {\n            // add a back button listener if one hasn't been setup yet\n            self.$backButtonActions = {};\n            self.onHardwareBackButton(self.hardwareBackButtonClick);\n            self._hasBackButtonHandler = true;\n          }\n\n          var action = {\n            id: (actionId ? actionId : ionic.Utils.nextUid()),\n            priority: (priority ? priority : 0),\n            fn: fn\n          };\n          self.$backButtonActions[action.id] = action;\n\n          // return a function to de-register this back button action\n          return function() {\n            delete self.$backButtonActions[action.id];\n          };\n        },\n\n        /**\n         * @private\n         */\n        hardwareBackButtonClick: function(e){\n          // loop through all the registered back button actions\n          // and only run the last one of the highest priority\n          var priorityAction, actionId;\n          for(actionId in self.$backButtonActions) {\n            if(!priorityAction || self.$backButtonActions[actionId].priority >= priorityAction.priority) {\n              priorityAction = self.$backButtonActions[actionId];\n            }\n          }\n          if(priorityAction) {\n            priorityAction.fn(e);\n            return priorityAction;\n          }\n        },\n\n        is: function(type) {\n          return ionic.Platform.is(type);\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#ready\n         * @description\n         * Trigger a callback once the device is ready,\n         * or immediately if the device is already ready.\n         * @param {function=} callback The function to call.\n         * @returns {promise} A promise which is resolved when the device is ready.\n         */\n        ready: function(cb) {\n          var q = $q.defer();\n\n          ionic.Platform.ready(function(){\n            q.resolve();\n            cb && cb();\n          });\n\n          return q.promise;\n        }\n      };\n      return self;\n    }]\n  };\n\n});\n\n\n/**\n * @ngdoc service\n * @name $ionicPopover\n * @module ionic\n * @description\n *\n * Related: {@link ionic.controller:ionicPopover ionicPopover controller}.\n *\n * The Popover is a view that floats above an app’s content. Popovers provide an\n * easy way to present or gather information from the user and are\n * commonly used in the following situations:\n *\n * - Show more info about the current view\n * - Select a commonly used tool or configuration\n * - Present a list of actions to perform inside one of your views\n *\n * Put the content of the popover inside of an `<ion-popover-view>` element.\n *\n * @usage\n * ```html\n * <p>\n *   <button ng-click=\"openPopover($event)\">Open Popover</button>\n * </p>\n *\n * <script id=\"my-popover.html\" type=\"text/ng-template\">\n *   <ion-popover-view>\n *     <ion-header-bar>\n *       <h1 class=\"title\">My Popover Title</h1>\n *     </ion-header-bar>\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-popover-view>\n * </script>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $ionicPopover) {\n *   $ionicPopover.fromTemplateUrl('my-popover.html', {\n *     scope: $scope,\n *   }).then(function(popover) {\n *     $scope.popover = popover;\n *   });\n *   $scope.openPopover = function($event) {\n *     $scope.popover.show($event);\n *   };\n *   $scope.closePopover = function() {\n *     $scope.popover.hide();\n *   };\n *   //Cleanup the popover when we're done with it!\n *   $scope.$on('$destroy', function() {\n *     $scope.popover.remove();\n *   });\n *   // Execute action on hide popover\n *   $scope.$on('popover.hidden', function() {\n *     // Execute action\n *   });\n *   // Execute action on remove popover\n *   $scope.$on('popover.removed', function() {\n *     // Execute action\n *   });\n * });\n * ```\n */\n\n\nIonicModule\n.factory('$ionicPopover', ['$ionicModal', '$ionicPosition', '$document', '$window',\nfunction($ionicModal, $ionicPosition, $document, $window) {\n\n  var POPOVER_BODY_PADDING = 6;\n\n  var POPOVER_OPTIONS = {\n    viewType: 'popover',\n    hideDelay: 1,\n    animation: 'none',\n    positionView: positionView\n  };\n\n  function positionView(target, popoverEle) {\n    var targetEle = angular.element(target.target || target);\n    var buttonOffset = $ionicPosition.offset( targetEle );\n    var popoverWidth = popoverEle.prop('offsetWidth');\n    var popoverHeight = popoverEle.prop('offsetHeight');\n    var bodyWidth = $document[0].body.clientWidth;\n    // clientHeight doesn't work on all platforms for body\n    var bodyHeight = $window.innerHeight;\n\n    var popoverCSS = {\n      left: buttonOffset.left + buttonOffset.width / 2 - popoverWidth / 2\n    };\n    var arrowEle = jqLite(popoverEle[0].querySelector('.popover-arrow'));\n\n    if (popoverCSS.left < POPOVER_BODY_PADDING) {\n      popoverCSS.left = POPOVER_BODY_PADDING;\n    } else if(popoverCSS.left + popoverWidth + POPOVER_BODY_PADDING > bodyWidth) {\n      popoverCSS.left = bodyWidth - popoverWidth - POPOVER_BODY_PADDING;\n    }\n\n    // If the popover when popped down stretches past bottom of screen,\n    // make it pop up\n    if (buttonOffset.top + buttonOffset.height + popoverHeight > bodyHeight) {\n      popoverCSS.top = buttonOffset.top - popoverHeight;\n      popoverEle.removeClass('popover-top').addClass('popover-bottom');\n    } else {\n      popoverCSS.top = buttonOffset.top + buttonOffset.height;\n      popoverEle.removeClass('popover-bottom').addClass('popover-top');\n    }\n\n    arrowEle.css({\n      left: buttonOffset.left + buttonOffset.width / 2 -\n        arrowEle.prop('offsetWidth') / 2 - popoverCSS.left + 'px'\n    });\n\n    popoverEle.css({\n      top: popoverCSS.top + 'px',\n      left: popoverCSS.left + 'px',\n      marginLeft: '0',\n      opacity: '1'\n    });\n\n  }\n\n  /**\n   * @ngdoc controller\n   * @name ionicPopover\n   * @module ionic\n   * @description\n   * Instantiated by the {@link ionic.service:$ionicPopover} service.\n   *\n   * Be sure to call [remove()](#remove) when you are done with each popover\n   * to clean it up and avoid memory leaks.\n   *\n   * Note: a popover will broadcast 'popover.shown', 'popover.hidden', and 'popover.removed' events from its originating\n   * scope, passing in itself as an event argument. Both the popover.removed and popover.hidden events are\n   * called when the popover is removed.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#initialize\n   * @description Creates a new popover controller instance.\n   * @param {object} options An options object with the following properties:\n   *  - `{object=}` `scope` The scope to be a child of.\n   *    Default: creates a child of $rootScope.\n   *  - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of\n   *    the popover when shown.  Default: false.\n   *  - `{boolean=}` `backdropClickToClose` Whether to close the popover on clicking the backdrop.\n   *    Default: true.\n   *  - `{boolean=}` `hardwareBackButtonClose` Whether the popover can be closed using the hardware\n   *    back button on Android and similar devices.  Default: true.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#show\n   * @description Show this popover instance.\n   * @param {$event} $event The $event or target element which the popover should align\n   * itself next to.\n   * @returns {promise} A promise which is resolved when the popover is finished animating in.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#hide\n   * @description Hide this popover instance.\n   * @returns {promise} A promise which is resolved when the popover is finished animating out.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#remove\n   * @description Remove this popover instance from the DOM and clean up.\n   * @returns {promise} A promise which is resolved when the popover is finished animating out.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#isShown\n   * @returns boolean Whether this popover is currently shown.\n   */\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicPopover#fromTemplate\n     * @param {string} templateString The template string to use as the popovers's\n     * content.\n     * @param {object} options Options to be passed to the initialize method.\n     * @returns {object} An instance of an {@link ionic.controller:ionicPopover}\n     * controller ($ionicPopover is built on top of $ionicPopover).\n     */\n    fromTemplate: function(templateString, options) {\n      return $ionicModal.fromTemplate(templateString, ionic.Utils.extend(options || {}, POPOVER_OPTIONS) );\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicPopover#fromTemplateUrl\n     * @param {string} templateUrl The url to load the template from.\n     * @param {object} options Options to be passed to the initialize method.\n     * @returns {promise} A promise that will be resolved with an instance of\n     * an {@link ionic.controller:ionicPopover} controller ($ionicPopover is built on top of $ionicPopover).\n     */\n    fromTemplateUrl: function(url, options, _) {\n      return $ionicModal.fromTemplateUrl(url, options, ionic.Utils.extend(options || {}, POPOVER_OPTIONS) );\n    }\n  };\n\n}]);\n\n\nvar POPUP_TPL =\n  '<div class=\"popup-container\">' +\n    '<div class=\"popup\">' +\n      '<div class=\"popup-head\">' +\n        '<h3 class=\"popup-title\" ng-bind-html=\"title\"></h3>' +\n        '<h5 class=\"popup-sub-title\" ng-bind-html=\"subTitle\" ng-if=\"subTitle\"></h5>' +\n      '</div>' +\n      '<div class=\"popup-body\">' +\n      '</div>' +\n      '<div class=\"popup-buttons\">' +\n        '<button ng-repeat=\"button in buttons\" ng-click=\"$buttonTapped(button, $event)\" class=\"button\" ng-class=\"button.type || \\'button-default\\'\" ng-bind-html=\"button.text\"></button>' +\n      '</div>' +\n    '</div>' +\n  '</div>';\n\n/**\n * @ngdoc service\n * @name $ionicPopup\n * @module ionic\n * @restrict E\n * @codepen zkmhJ\n * @description\n *\n * The Ionic Popup service allows programmatically creating and showing popup\n * windows that require the user to respond in order to continue.\n *\n * The popup system has support for more flexible versions of the built in `alert()`, `prompt()`,\n * and `confirm()` functions that users are used to, in addition to allowing popups with completely\n * custom content and look.\n *\n * An input can be given an `autofocus` attribute so it automatically receives focus when\n * the popup first shows. However, depending on certain use-cases this can cause issues with\n * the tap/click system, which is why Ionic prefers using the `autofocus` attribute as\n * an opt-in feature and not the default.\n *\n * @usage\n * A few basic examples, see below for details about all of the options available.\n *\n * ```js\n *angular.module('mySuperApp', ['ionic'])\n *.controller('PopupCtrl',function($scope, $ionicPopup, $timeout) {\n *\n * // Triggered on a button click, or some other target\n * $scope.showPopup = function() {\n *   $scope.data = {}\n *\n *   // An elaborate, custom popup\n *   var myPopup = $ionicPopup.show({\n *     template: '<input type=\"password\" ng-model=\"data.wifi\">',\n *     title: 'Enter Wi-Fi Password',\n *     subTitle: 'Please use normal things',\n *     scope: $scope,\n *     buttons: [\n *       { text: 'Cancel' },\n *       {\n *         text: '<b>Save</b>',\n *         type: 'button-positive',\n *         onTap: function(e) {\n *           if (!$scope.data.wifi) {\n *             //don't allow the user to close unless he enters wifi password\n *             e.preventDefault();\n *           } else {\n *             return $scope.data.wifi;\n *           }\n *         }\n *       },\n *     ]\n *   });\n *   myPopup.then(function(res) {\n *     console.log('Tapped!', res);\n *   });\n *   $timeout(function() {\n *      myPopup.close(); //close the popup after 3 seconds for some reason\n *   }, 3000);\n *  };\n *  // A confirm dialog\n *  $scope.showConfirm = function() {\n *    var confirmPopup = $ionicPopup.confirm({\n *      title: 'Consume Ice Cream',\n *      template: 'Are you sure you want to eat this ice cream?'\n *    });\n *    confirmPopup.then(function(res) {\n *      if(res) {\n *        console.log('You are sure');\n *      } else {\n *        console.log('You are not sure');\n *      }\n *    });\n *  };\n *\n *  // An alert dialog\n *  $scope.showAlert = function() {\n *    var alertPopup = $ionicPopup.alert({\n *      title: 'Don\\'t eat that!',\n *      template: 'It might taste good'\n *    });\n *    alertPopup.then(function(res) {\n *      console.log('Thank you for not eating my delicious ice cream cone');\n *    });\n *  };\n *});\n *```\n */\n\nIonicModule\n.factory('$ionicPopup', [\n  '$ionicTemplateLoader',\n  '$ionicBackdrop',\n  '$q',\n  '$timeout',\n  '$rootScope',\n  '$ionicBody',\n  '$compile',\n  '$ionicPlatform',\nfunction($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicBody, $compile, $ionicPlatform) {\n  //TODO allow this to be configured\n  var config = {\n    stackPushDelay: 75\n  };\n  var popupStack = [];\n  var $ionicPopup = {\n    /**\n     * @ngdoc method\n     * @description\n     * Show a complex popup. This is the master show function for all popups.\n     *\n     * A complex popup has a `buttons` array, with each button having a `text` and `type`\n     * field, in addition to an `onTap` function.  The `onTap` function, called when\n     * the correspondingbutton on the popup is tapped, will by default close the popup\n     * and resolve the popup promise with its return value.  If you wish to prevent the\n     * default and keep the popup open on button tap, call `event.preventDefault()` on the\n     * passed in tap event.  Details below.\n     *\n     * @name $ionicPopup#show\n     * @param {object} options The options for the new popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   scope: null, // Scope (optional). A scope to link to the popup content.\n     *   buttons: [{ //Array[Object] (optional). Buttons to place in the popup footer.\n     *     text: 'Cancel',\n     *     type: 'button-default',\n     *     onTap: function(e) {\n     *       // e.preventDefault() will stop the popup from closing when tapped.\n     *       e.preventDefault();\n     *     }\n     *   }, {\n     *     text: 'OK',\n     *     type: 'button-positive',\n     *     onTap: function(e) {\n     *       // Returning a value will cause the promise to resolve with the given value.\n     *       return scope.data.response;\n     *     }\n     *   }]\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has an additional\n     * `close` function, which can be used to programmatically close the popup.\n     */\n    show: showPopup,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#alert\n     * @description Show a simple alert popup with a message and one button that the user can\n     * tap to close the popup.\n     *\n     * @param {object} options The options for showing the alert, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   okText: '', // String (default: 'OK'). The text of the OK button.\n     *   okType: '', // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    alert: showAlert,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#confirm\n     * @description\n     * Show a simple confirm popup with a Cancel and OK button.\n     *\n     * Resolves the promise with true if the user presses the OK button, and false if the\n     * user presses the Cancel button.\n     *\n     * @param {object} options The options for showing the confirm popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.\n     *   cancelType: '', // String (default: 'button-default'). The type of the Cancel button.\n     *   okText: '', // String (default: 'OK'). The text of the OK button.\n     *   okType: '', // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    confirm: showConfirm,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#prompt\n     * @description Show a simple prompt popup, which has an input, OK button, and Cancel button.\n     * Resolves the promise with the value of the input if the user presses OK, and with undefined\n     * if the user presses Cancel.\n     *\n     * ```javascript\n     *  $ionicPopup.prompt({\n     *    title: 'Password Check',\n     *    template: 'Enter your secret password',\n     *    inputType: 'password',\n     *    inputPlaceholder: 'Your password'\n     *  }).then(function(res) {\n     *    console.log('Your password is', res);\n     *  });\n     * ```\n     * @param {object} options The options for showing the prompt popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   inputType: // String (default: 'text'). The type of input to use\n     *   inputPlaceholder: // String (default: ''). A placeholder to use for the input.\n     *   cancelText: // String (default: 'Cancel'. The text of the Cancel button.\n     *   cancelType: // String (default: 'button-default'). The type of the Cancel button.\n     *   okText: // String (default: 'OK'). The text of the OK button.\n     *   okType: // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    prompt: showPrompt,\n    /**\n     * @private for testing\n     */\n    _createPopup: createPopup,\n    _popupStack: popupStack\n  };\n\n  return $ionicPopup;\n\n  function createPopup(options) {\n    options = extend({\n      scope: null,\n      title: '',\n      buttons: [],\n    }, options || {});\n\n    var popupPromise = $ionicTemplateLoader.compile({\n      template: POPUP_TPL,\n      scope: options.scope && options.scope.$new(),\n      appendTo: $ionicBody.get()\n    });\n    var contentPromise = options.templateUrl ?\n      $ionicTemplateLoader.load(options.templateUrl) :\n      $q.when(options.template || options.content || '');\n\n    return $q.all([popupPromise, contentPromise])\n    .then(function(results) {\n      var self = results[0];\n      var content = results[1];\n      var responseDeferred = $q.defer();\n\n      self.responseDeferred = responseDeferred;\n\n      //Can't ng-bind-html for popup-body because it can be insecure html\n      //(eg an input in case of prompt)\n      var body = jqLite(self.element[0].querySelector('.popup-body'));\n      if (content) {\n        body.html(content);\n        $compile(body.contents())(self.scope);\n      } else {\n        body.remove();\n      }\n\n      extend(self.scope, {\n        title: options.title,\n        buttons: options.buttons,\n        subTitle: options.subTitle,\n        $buttonTapped: function(button, event) {\n          var result = (button.onTap || angular.noop)(event);\n          event = event.originalEvent || event; //jquery events\n\n          if (!event.defaultPrevented) {\n            responseDeferred.resolve(result);\n          }\n        }\n      });\n\n      self.show = function() {\n        if (self.isShown) return;\n\n        self.isShown = true;\n        ionic.requestAnimationFrame(function() {\n          //if hidden while waiting for raf, don't show\n          if (!self.isShown) return;\n\n          self.element.removeClass('popup-hidden');\n          self.element.addClass('popup-showing active');\n          focusInput(self.element);\n        });\n      };\n      self.hide = function(callback) {\n        callback = callback || angular.noop;\n        if (!self.isShown) return callback();\n\n        self.isShown = false;\n        self.element.removeClass('active');\n        self.element.addClass('popup-hidden');\n        $timeout(callback, 250);\n      };\n      self.remove = function() {\n        if (self.removed) return;\n\n        self.hide(function() {\n          self.element.remove();\n          self.scope.$destroy();\n        });\n\n        self.removed = true;\n      };\n\n      return self;\n    });\n  }\n\n  function onHardwareBackButton(e) {\n    popupStack[0] && popupStack[0].responseDeferred.resolve();\n  }\n\n  function showPopup(options) {\n    var popupPromise = $ionicPopup._createPopup(options);\n    var previousPopup = popupStack[0];\n\n    if (previousPopup) {\n      previousPopup.hide();\n    }\n\n    var resultPromise = $timeout(angular.noop, previousPopup ? config.stackPushDelay : 0)\n    .then(function() { return popupPromise; })\n    .then(function(popup) {\n      if (!previousPopup) {\n        //Add popup-open & backdrop if this is first popup\n        $ionicBody.addClass('popup-open');\n        $ionicBackdrop.retain();\n        //only show the backdrop on the first popup\n        $ionicPopup._backButtonActionDone = $ionicPlatform.registerBackButtonAction(\n          onHardwareBackButton,\n          PLATFORM_BACK_BUTTON_PRIORITY_POPUP\n        );\n      }\n      popupStack.unshift(popup);\n      popup.show();\n\n      //DEPRECATED: notify the promise with an object with a close method\n      popup.responseDeferred.notify({\n        close: resultPromise.close\n      });\n\n      return popup.responseDeferred.promise.then(function(result) {\n        var index = popupStack.indexOf(popup);\n        if (index !== -1) {\n          popupStack.splice(index, 1);\n        }\n        popup.remove();\n\n        var previousPopup = popupStack[0];\n        if (previousPopup) {\n          previousPopup.show();\n        } else {\n          //Remove popup-open & backdrop if this is last popup\n          $ionicBody.removeClass('popup-open');\n          $ionicBackdrop.release();\n          ($ionicPopup._backButtonActionDone || angular.noop)();\n        }\n        return result;\n      });\n    });\n\n    function close(result) {\n      popupPromise.then(function(popup) {\n        if (!popup.removed) {\n          popup.responseDeferred.resolve(result);\n        }\n      });\n    }\n    resultPromise.close = close;\n\n    return resultPromise;\n  }\n\n  function focusInput(element) {\n    var focusOn = element[0].querySelector('[autofocus]');\n    if (focusOn) {\n      focusOn.focus();\n    }\n  }\n\n  function showAlert(opts) {\n    return showPopup( extend({\n      buttons: [{\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function(e) {\n          return true;\n        }\n      }]\n    }, opts || {}) );\n  }\n\n  function showConfirm(opts) {\n    return showPopup( extend({\n      buttons: [{\n        text: opts.cancelText || 'Cancel' ,\n        type: opts.cancelType || 'button-default',\n        onTap: function(e) { return false; }\n      }, {\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function(e) { return true; }\n      }]\n    }, opts || {}) );\n  }\n\n  function showPrompt(opts) {\n    var scope = $rootScope.$new(true);\n    scope.data = {};\n    var text = '';\n    if(opts.template && /<[a-z][\\s\\S]*>/i.test(opts.template) === false){\n      text = '<span>'+opts.template+'</span>';\n      delete opts.template;\n    }\n    return showPopup( extend({\n      template: text+'<input ng-model=\"data.response\" type=\"' + (opts.inputType || 'text') +\n        '\" placeholder=\"' + (opts.inputPlaceholder || '') + '\">',\n      scope: scope,\n      buttons: [{\n        text: opts.cancelText || 'Cancel',\n        type: opts.cancelType|| 'button-default',\n        onTap: function(e) {}\n      }, {\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function(e) {\n          return scope.data.response || '';\n        }\n      }]\n    }, opts || {}) );\n  }\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicPosition\n * @module ionic\n * @description\n * A set of utility methods that can be use to retrieve position of DOM elements.\n * It is meant to be used where we need to absolute-position DOM elements in\n * relation to other, existing elements (this is the case for tooltips, popovers, etc.).\n *\n * Adapted from [AngularUI Bootstrap](https://github.com/angular-ui/bootstrap/blob/master/src/position/position.js),\n * ([license](https://github.com/angular-ui/bootstrap/blob/master/LICENSE))\n */\nIonicModule\n.factory('$ionicPosition', ['$document', '$window', function ($document, $window) {\n\n  function getStyle(el, cssprop) {\n    if (el.currentStyle) { //IE\n      return el.currentStyle[cssprop];\n    } else if ($window.getComputedStyle) {\n      return $window.getComputedStyle(el)[cssprop];\n    }\n    // finally try and get inline style\n    return el.style[cssprop];\n  }\n\n  /**\n   * Checks if a given element is statically positioned\n   * @param element - raw DOM element\n   */\n  function isStaticPositioned(element) {\n    return (getStyle(element, 'position') || 'static' ) === 'static';\n  }\n\n  /**\n   * returns the closest, non-statically positioned parentOffset of a given element\n   * @param element\n   */\n  var parentOffsetEl = function (element) {\n    var docDomEl = $document[0];\n    var offsetParent = element.offsetParent || docDomEl;\n    while (offsetParent && offsetParent !== docDomEl && isStaticPositioned(offsetParent) ) {\n      offsetParent = offsetParent.offsetParent;\n    }\n    return offsetParent || docDomEl;\n  };\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicPosition#position\n     * @description Get the current coordinates of the element, relative to the offset parent.\n     * Read-only equivalent of [jQuery's position function](http://api.jquery.com/position/).\n     * @param {element} element The element to get the position of.\n     * @returns {object} Returns an object containing the properties top, left, width and height.\n     */\n    position: function (element) {\n      var elBCR = this.offset(element);\n      var offsetParentBCR = { top: 0, left: 0 };\n      var offsetParentEl = parentOffsetEl(element[0]);\n      if (offsetParentEl != $document[0]) {\n        offsetParentBCR = this.offset(angular.element(offsetParentEl));\n        offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop;\n        offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft;\n      }\n\n      var boundingClientRect = element[0].getBoundingClientRect();\n      return {\n        width: boundingClientRect.width || element.prop('offsetWidth'),\n        height: boundingClientRect.height || element.prop('offsetHeight'),\n        top: elBCR.top - offsetParentBCR.top,\n        left: elBCR.left - offsetParentBCR.left\n      };\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicPosition#offset\n     * @description Get the current coordinates of the element, relative to the document.\n     * Read-only equivalent of [jQuery's offset function](http://api.jquery.com/offset/).\n     * @param {element} element The element to get the offset of.\n     * @returns {object} Returns an object containing the properties top, left, width and height.\n     */\n    offset: function (element) {\n      var boundingClientRect = element[0].getBoundingClientRect();\n      return {\n        width: boundingClientRect.width || element.prop('offsetWidth'),\n        height: boundingClientRect.height || element.prop('offsetHeight'),\n        top: boundingClientRect.top + ($window.pageYOffset || $document[0].documentElement.scrollTop),\n        left: boundingClientRect.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft)\n      };\n    }\n\n  };\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicScrollDelegate\n * @module ionic\n * @description\n * Delegate for controlling scrollViews (created by\n * {@link ionic.directive:ionContent} and\n * {@link ionic.directive:ionScroll} directives).\n *\n * Methods called directly on the $ionicScrollDelegate service will control all scroll\n * views.  Use the {@link ionic.service:$ionicScrollDelegate#$getByHandle $getByHandle}\n * method to control specific scrollViews.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-content>\n *     <button ng-click=\"scrollTop()\">Scroll to Top!</button>\n *   </ion-content>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicScrollDelegate) {\n *   $scope.scrollTop = function() {\n *     $ionicScrollDelegate.scrollTop();\n *   };\n * }\n * ```\n *\n * Example of advanced usage, with two scroll areas using `delegate-handle`\n * for fine control.\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-content delegate-handle=\"mainScroll\">\n *     <button ng-click=\"scrollMainToTop()\">\n *       Scroll content to top!\n *     </button>\n *     <ion-scroll delegate-handle=\"small\" style=\"height: 100px;\">\n *       <button ng-click=\"scrollSmallToTop()\">\n *         Scroll small area to top!\n *       </button>\n *     </ion-scroll>\n *   </ion-content>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicScrollDelegate) {\n *   $scope.scrollMainToTop = function() {\n *     $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop();\n *   };\n *   $scope.scrollSmallToTop = function() {\n *     $ionicScrollDelegate.$getByHandle('small').scrollTop();\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicScrollDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#resize\n   * @description Tell the scrollView to recalculate the size of its container.\n   */\n  'resize',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollTop\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollTop',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollBottom\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollBottom',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollTo\n   * @param {number} left The x-value to scroll to.\n   * @param {number} top The y-value to scroll to.\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollTo',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollBy\n   * @param {number} left The x-offset to scroll by.\n   * @param {number} top The y-offset to scroll by.\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollBy',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#zoomTo\n   * @param {number} level Level to zoom to.\n   * @param {boolean=} animate Whether to animate the zoom.\n   * @param {number=} originLeft Zoom in at given left coordinate.\n   * @param {number=} originTop Zoom in at given top coordinate.\n   */\n  'zoomTo',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#zoomBy\n   * @param {number} factor The factor to zoom by.\n   * @param {boolean=} animate Whether to animate the zoom.\n   * @param {number=} originLeft Zoom in at given left coordinate.\n   * @param {number=} originTop Zoom in at given top coordinate.\n   */\n  'zoomBy',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#getScrollPosition\n   * @returns {object} The scroll position of this view, with the following properties:\n   *  - `{number}` `left` The distance the user has scrolled from the left (starts at 0).\n   *  - `{number}` `top` The distance the user has scrolled from the top (starts at 0).\n   */\n  'getScrollPosition',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#anchorScroll\n   * @description Tell the scrollView to scroll to the element with an id\n   * matching window.location.hash.\n   *\n   * If no matching element is found, it will scroll to top.\n   *\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'anchorScroll',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#getScrollView\n   * @returns {object} The scrollView associated with this delegate.\n   */\n  'getScrollView',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#rememberScrollPosition\n   * @description\n   * Will make it so, when this scrollView is destroyed (user leaves the page),\n   * the last scroll position the page was on will be saved, indexed by the\n   * given id.\n   *\n   * Note: for pages associated with a view under an ion-nav-view,\n   * rememberScrollPosition automatically saves their scroll.\n   *\n   * Related methods: scrollToRememberedPosition, forgetScrollPosition (below).\n   *\n   * In the following example, the scroll position of the ion-scroll element\n   * will persist, even when the user changes the toggle switch.\n   *\n   * ```html\n   * <ion-toggle ng-model=\"shouldShowScrollView\"></ion-toggle>\n   * <ion-scroll delegate-handle=\"myScroll\" ng-if=\"shouldShowScrollView\">\n   *   <div ng-controller=\"ScrollCtrl\">\n   *     <ion-list>\n   *       {% raw %}<ion-item ng-repeat=\"i in items\">{{i}}</ion-item>{% endraw %}\n   *     </ion-list>\n   *   </div>\n   * </ion-scroll>\n   * ```\n   * ```js\n   * function ScrollCtrl($scope, $ionicScrollDelegate) {\n   *   var delegate = $ionicScrollDelegate.$getByHandle('myScroll');\n   *\n   *   // Put any unique ID here.  The point of this is: every time the controller is recreated\n   *   // we want to load the correct remembered scroll values.\n   *   delegate.rememberScrollPosition('my-scroll-id');\n   *   delegate.scrollToRememberedPosition();\n   *   $scope.items = [];\n   *   for (var i=0; i<100; i++) {\n   *     $scope.items.push(i);\n   *   }\n   * }\n   * ```\n   *\n   * @param {string} id The id to remember the scroll position of this\n   * scrollView by.\n   */\n  'rememberScrollPosition',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#forgetScrollPosition\n   * @description\n   * Stop remembering the scroll position for this scrollView.\n   */\n  'forgetScrollPosition',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollToRememberedPosition\n   * @description\n   * If this scrollView has an id associated with its scroll position,\n   * (through calling rememberScrollPosition), and that position is remembered,\n   * load the position and scroll to it.\n   * @param {boolean=} shouldAnimate Whether to animate the scroll.\n   */\n  'scrollToRememberedPosition'\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * scrollViews with `delegate-handle` matching the given handle.\n   *\n   * Example: `$ionicScrollDelegate.$getByHandle('my-handle').scrollTop();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicSideMenuDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionSideMenus} directive.\n *\n * Methods called directly on the $ionicSideMenuDelegate service will control all side\n * menus.  Use the {@link ionic.service:$ionicSideMenuDelegate#$getByHandle $getByHandle}\n * method to control specific ionSideMenus instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-side-menus>\n *     <ion-side-menu-content>\n *       Content!\n *       <button ng-click=\"toggleLeftSideMenu()\">\n *         Toggle Left Side Menu\n *       </button>\n *     </ion-side-menu-content>\n *     <ion-side-menu side=\"left\">\n *       Left Menu!\n *     <ion-side-menu>\n *   </ion-side-menus>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicSideMenuDelegate) {\n *   $scope.toggleLeftSideMenu = function() {\n *     $ionicSideMenuDelegate.toggleLeft();\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicSideMenuDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#toggleLeft\n   * @description Toggle the left side menu (if it exists).\n   * @param {boolean=} isOpen Whether to open or close the menu.\n   * Default: Toggles the menu.\n   */\n  'toggleLeft',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#toggleRight\n   * @description Toggle the right side menu (if it exists).\n   * @param {boolean=} isOpen Whether to open or close the menu.\n   * Default: Toggles the menu.\n   */\n  'toggleRight',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#getOpenRatio\n   * @description Gets the ratio of open amount over menu width. For example, a\n   * menu of width 100 that is opened by 50 pixels is 50% opened, and would return\n   * a ratio of 0.5.\n   *\n   * @returns {float} 0 if nothing is open, between 0 and 1 if left menu is\n   * opened/opening, and between 0 and -1 if right menu is opened/opening.\n   */\n  'getOpenRatio',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpen\n   * @returns {boolean} Whether either the left or right menu is currently opened.\n   */\n  'isOpen',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpenLeft\n   * @returns {boolean} Whether the left menu is currently opened.\n   */\n  'isOpenLeft',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpenRight\n   * @returns {boolean} Whether the right menu is currently opened.\n   */\n  'isOpenRight',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#canDragContent\n   * @param {boolean=} canDrag Set whether the content can or cannot be dragged to open\n   * side menus.\n   * @returns {boolean} Whether the content can be dragged to open side menus.\n   */\n  'canDragContent',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#edgeDragThreshold\n   * @param {boolean|number=} value Set whether the content drag can only start if it is below a certain threshold distance from the edge of the screen. Accepts three different values:\n   *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.\n   *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.\n   *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.\n   * @returns {boolean} Whether the drag can start only from within the edge of screen threshold.\n   */\n  'edgeDragThreshold',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionSideMenus} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicSideMenuDelegate.$getByHandle('my-handle').toggleLeft();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicSlideBoxDelegate\n * @module ionic\n * @description\n * Delegate that controls the {@link ionic.directive:ionSlideBox} directive.\n *\n * Methods called directly on the $ionicSlideBoxDelegate service will control all slide boxes.  Use the {@link ionic.service:$ionicSlideBoxDelegate#$getByHandle $getByHandle}\n * method to control specific slide box instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-slide-box>\n *     <ion-slide>\n *       <div class=\"box blue\">\n *         <button ng-click=\"nextSlide()\">Next slide!</button>\n *       </div>\n *     </ion-slide>\n *     <ion-slide>\n *       <div class=\"box red\">\n *         Slide 2!\n *       </div>\n *     </ion-slide>\n *   </ion-slide-box>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicSlideBoxDelegate) {\n *   $scope.nextSlide = function() {\n *     $ionicSlideBoxDelegate.next();\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicSlideBoxDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#update\n   * @description\n   * Update the slidebox (for example if using Angular with ng-repeat,\n   * resize it for the elements inside).\n   */\n  'update',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#slide\n   * @param {number} to The index to slide to.\n   * @param {number=} speed The number of milliseconds for the change to take.\n   */\n  'slide',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#enableSlide\n   * @param {boolean=} shouldEnable Whether to enable sliding the slidebox.\n   * @returns {boolean} Whether sliding is enabled.\n   */\n  'enableSlide',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#previous\n   * @description Go to the previous slide. Wraps around if at the beginning.\n   */\n  'previous',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#next\n   * @description Go to the next slide. Wraps around if at the end.\n   */\n  'next',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#stop\n   * @description Stop sliding. The slideBox will not move again until\n   * explicitly told to do so.\n   */\n  'stop',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#start\n   * @description Start sliding again if the slideBox was stopped. \n   */\n  'start',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#currentIndex\n   * @returns number The index of the current slide.\n   */\n  'currentIndex',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#slidesCount\n   * @returns number The number of slides there are currently.\n   */\n  'slidesCount'\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionSlideBox} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicSlideBoxDelegate.$getByHandle('my-handle').stop();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicTabsDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionTabs} directive.\n *\n * Methods called directly on the $ionicTabsDelegate service will control all ionTabs\n * directives. Use the {@link ionic.service:$ionicTabsDelegate#$getByHandle $getByHandle}\n * method to control specific ionTabs instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-tabs>\n *\n *     <ion-tab title=\"Tab 1\">\n *       Hello tab 1!\n *       <button ng-click=\"selectTabWithIndex(1)\">Select tab 2!</button>\n *     </ion-tab>\n *     <ion-tab title=\"Tab 2\">Hello tab 2!</ion-tab>\n *\n *   </ion-tabs>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicTabsDelegate) {\n *   $scope.selectTabWithIndex = function(index) {\n *     $ionicTabsDelegate.select(index);\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicTabsDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#select\n   * @description Select the tab matching the given index.\n   *\n   * @param {number} index Index of the tab to select.\n   */\n  'select',\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#selectedIndex\n   * @returns `number` The index of the selected tab, or -1.\n   */\n  'selectedIndex'\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionTabs} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicTabsDelegate.$getByHandle('my-handle').select(0);`\n   */\n]));\n\n\n// closure to keep things neat\n(function() {\n  var templatesToCache = [];\n\n/**\n * @ngdoc service\n * @name $ionicTemplateCache\n * @module ionic\n * @description A service that preemptively caches template files to eliminate transition flicker and boost performance.\n * @usage\n * State templates are cached automatically, but you can optionally cache other templates.\n *\n * ```js\n * $ionicTemplateCache('myNgIncludeTemplate.html');\n * ```\n *\n * Optionally disable all preemptive caching with the `$ionicConfigProvider` or individual states by setting `prefetchTemplate`\n * in the `$state` definition\n *\n * ```js\n *   angular.module('myApp', ['ionic'])\n *   .config(function($stateProvider, $ionicConfigProvider) {\n *\n *     // disable preemptive template caching globally\n *     $ionicConfigProvider.prefetchTemplates(false);\n *\n *     // disable individual states\n *     $stateProvider\n *       .state('tabs', {\n *         url: \"/tab\",\n *         abstract: true,\n *         prefetchTemplate: false,\n *         templateUrl: \"tabs-templates/tabs.html\"\n *       })\n *       .state('tabs.home', {\n *         url: \"/home\",\n *         views: {\n *           'home-tab': {\n *             prefetchTemplate: false,\n *             templateUrl: \"tabs-templates/home.html\",\n *             controller: 'HomeTabCtrl'\n *           }\n *         }\n *       });\n *   });\n * ```\n */\nIonicModule\n.factory('$ionicTemplateCache', [\n'$http',\n'$templateCache',\n'$timeout',\n'$ionicConfig',\nfunction($http, $templateCache, $timeout, $ionicConfig) {\n  var toCache = templatesToCache,\n      hasRun = false;\n\n  function $ionicTemplateCache(templates){\n    if(toCache.length > 500) return false;\n    if(typeof templates === 'undefined')return run();\n    if(isString(templates))templates = [templates];\n    forEach(templates, function(template){\n      toCache.push(template);\n    });\n    // is this is being called after the initial IonicModule.run()\n    if(hasRun) run();\n  }\n\n  // run through methods - internal method\n  var run = function(){\n    if($ionicConfig.prefetchTemplates === false)return;\n    //console.log('prefetching', toCache);\n    //for testing\n    $ionicTemplateCache._runCount++;\n\n    hasRun = true;\n    // ignore if race condition already zeroed out array\n    if(toCache.length === 0)return;\n    //console.log(toCache);\n    var i = 0;\n    while ( i < 5 && (template = toCache.pop()) ) {\n      // note that inline templates are ignored by this request\n      if (isString(template)) $http.get(template, { cache: $templateCache });\n      i++;\n    }\n    // only preload 5 templates a second\n    if(toCache.length)$timeout(function(){run();}, 1000);\n  };\n\n  // exposing for testing\n  $ionicTemplateCache._runCount = 0;\n  // default method\n  return $ionicTemplateCache;\n}])\n\n// Intercepts the $stateprovider.state() command to look for templateUrls that can be cached\n.config([\n'$stateProvider',\n'$ionicConfigProvider',\nfunction($stateProvider, $ionicConfigProvider) {\n  var stateProviderState = $stateProvider.state;\n  $stateProvider.state = function(stateName, definition) {\n    // don't even bother if it's disabled. note, another config may run after this, so it's not a catch-all\n    if($ionicConfigProvider.prefetchTemplates() !== false){\n      var enabled = definition.prefetchTemplate !== false;\n      if(enabled && isString(definition.templateUrl))templatesToCache.push(definition.templateUrl);\n      if(angular.isObject(definition.views)){\n        for (var key in definition.views){\n          enabled = definition.views[key].prefetchTemplate !== false;\n          if(enabled && isString(definition.views[key].templateUrl)) templatesToCache.push(definition.views[key].templateUrl);\n        }\n      }\n    }\n    return stateProviderState.call($stateProvider, stateName, definition);\n  };\n}])\n\n// process the templateUrls collected by the $stateProvider, adding them to the cache\n.run([\n'$ionicTemplateCache',\nfunction($ionicTemplateCache) {\n  $ionicTemplateCache();\n}]);\n\n})();\n\nIonicModule\n.factory('$ionicTemplateLoader', [\n  '$compile',\n  '$controller',\n  '$http',\n  '$q',\n  '$rootScope',\n  '$templateCache',\nfunction($compile, $controller, $http, $q, $rootScope, $templateCache) {\n\n  return {\n    load: fetchTemplate,\n    compile: loadAndCompile\n  };\n\n  function fetchTemplate(url) {\n    return $http.get(url, {cache: $templateCache})\n    .then(function(response) {\n      return response.data && response.data.trim();\n    });\n  }\n\n  function loadAndCompile(options) {\n    options = extend({\n      template: '',\n      templateUrl: '',\n      scope: null,\n      controller: null,\n      locals: {},\n      appendTo: null\n    }, options || {});\n\n    var templatePromise = options.templateUrl ?\n      this.load(options.templateUrl) :\n      $q.when(options.template);\n\n    return templatePromise.then(function(template) {\n      var controller;\n      var scope = options.scope || $rootScope.$new();\n\n      //Incase template doesn't have just one root element, do this\n      var element = jqLite('<div>').html(template).contents();\n\n      if (options.controller) {\n        controller = $controller(\n          options.controller,\n          extend(options.locals, {\n            $scope: scope\n          })\n        );\n        element.children().data('$ngControllerController', controller);\n      }\n      if (options.appendTo) {\n        jqLite(options.appendTo).append(element);\n      }\n\n      $compile(element)(scope);\n\n      return {\n        element: element,\n        scope: scope\n      };\n    });\n  }\n\n}]);\n\n/**\n * @private\n * TODO document\n */\nIonicModule\n.run([\n  '$rootScope',\n  '$state',\n  '$location',\n  '$document',\n  '$animate',\n  '$ionicPlatform',\n  '$ionicViewService',\nfunction($rootScope, $state, $location, $document, $animate, $ionicPlatform, $ionicViewService) {\n\n  // init the variables that keep track of the view history\n  $rootScope.$viewHistory = {\n    histories: { root: { historyId: 'root', parentHistoryId: null, stack: [], cursor: -1 } },\n    views: {},\n    backView: null,\n    forwardView: null,\n    currentView: null,\n    disabledRegistrableTagNames: []\n  };\n\n  // set that these directives should not animate when transitioning\n  // to it. Instead, the children <tab> directives would animate\n  if ($ionicViewService.disableRegisterByTagName) {\n    $ionicViewService.disableRegisterByTagName('ion-tabs');\n    $ionicViewService.disableRegisterByTagName('ion-side-menus');\n  }\n\n  $rootScope.$on('viewState.changeHistory', function(e, data) {\n    if(!data) return;\n\n    var hist = (data.historyId ? $rootScope.$viewHistory.histories[ data.historyId ] : null );\n    if(hist && hist.cursor > -1 && hist.cursor < hist.stack.length) {\n      // the history they're going to already exists\n      // go to it's last view in its stack\n      var view = hist.stack[ hist.cursor ];\n      return view.go(data);\n    }\n\n    // this history does not have a URL, but it does have a uiSref\n    // figure out its URL from the uiSref\n    if(!data.url && data.uiSref) {\n      data.url = $state.href(data.uiSref);\n    }\n\n    if(data.url) {\n      // don't let it start with a #, messes with $location.url()\n      if(data.url.indexOf('#') === 0) {\n        data.url = data.url.replace('#', '');\n      }\n      if(data.url !== $location.url()) {\n        // we've got a good URL, ready GO!\n        $location.url(data.url);\n      }\n    }\n  });\n\n  // Set the document title when a new view is shown\n  $rootScope.$on('viewState.viewEnter', function(e, data) {\n    if(data && data.title) {\n      $document[0].title = data.title;\n    }\n  });\n\n  // Triggered when devices with a hardware back button (Android) is clicked by the user\n  // This is a Cordova/Phonegap platform specifc method\n  function onHardwareBackButton(e) {\n    if($rootScope.$viewHistory.backView) {\n      // there is a back view, go to it\n      $rootScope.$viewHistory.backView.go();\n    } else {\n      // there is no back view, so close the app instead\n      ionic.Platform.exitApp();\n    }\n    e.preventDefault();\n    return false;\n  }\n  $ionicPlatform.registerBackButtonAction(\n    onHardwareBackButton,\n    PLATFORM_BACK_BUTTON_PRIORITY_VIEW\n  );\n\n}])\n\n.factory('$ionicViewService', [\n  '$rootScope',\n  '$state',\n  '$location',\n  '$window',\n  '$injector',\n  '$animate',\n  '$ionicNavViewConfig',\n  '$ionicClickBlock',\nfunction($rootScope, $state, $location, $window, $injector, $animate, $ionicNavViewConfig, $ionicClickBlock) {\n\n  var View = function(){};\n  View.prototype.initialize = function(data) {\n    if(data) {\n      for(var name in data) this[name] = data[name];\n      return this;\n    }\n    return null;\n  };\n  View.prototype.go = function() {\n\n    if(this.stateName) {\n      return $state.go(this.stateName, this.stateParams);\n    }\n\n    if(this.url && this.url !== $location.url()) {\n\n      if($rootScope.$viewHistory.backView === this) {\n        return $window.history.go(-1);\n      } else if($rootScope.$viewHistory.forwardView === this) {\n        return $window.history.go(1);\n      }\n\n      $location.url(this.url);\n      return;\n    }\n\n    return null;\n  };\n  View.prototype.destroy = function() {\n    if(this.scope) {\n      this.scope.$destroy && this.scope.$destroy();\n      this.scope = null;\n    }\n  };\n\n  function createViewId(stateId) {\n    return ionic.Utils.nextUid();\n  }\n\n  return {\n\n    register: function(containerScope, element) {\n\n      var viewHistory = $rootScope.$viewHistory,\n          currentStateId = this.getCurrentStateId(),\n          hist = this._getHistory(containerScope),\n          currentView = viewHistory.currentView,\n          backView = viewHistory.backView,\n          forwardView = viewHistory.forwardView,\n          nextViewOptions = this.nextViewOptions(),\n          rsp = {\n            viewId: null,\n            navAction: null,\n            navDirection: null,\n            historyId: hist.historyId\n          };\n\n      if(element && !this.isTagNameRegistrable(element)) {\n        // first check to see if this element can even be registered as a view.\n        // Certain tags are only containers for views, but are not views themselves.\n        // For example, the <ion-tabs> directive contains a <ion-tab> and the <ion-tab> is the\n        // view, but the <ion-tabs> directive itself should not be registered as a view.\n        rsp.navAction = 'disabledByTagName';\n        return rsp;\n      }\n\n      if(currentView &&\n         currentView.stateId === currentStateId &&\n         currentView.historyId === hist.historyId) {\n        // do nothing if its the same stateId in the same history\n        rsp.navAction = 'noChange';\n        return rsp;\n      }\n\n      if(viewHistory.forcedNav) {\n        // we've previously set exactly what to do\n        ionic.Utils.extend(rsp, viewHistory.forcedNav);\n        $rootScope.$viewHistory.forcedNav = null;\n\n      } else if(backView && backView.stateId === currentStateId) {\n        // they went back one, set the old current view as a forward view\n        rsp.viewId = backView.viewId;\n        rsp.navAction = 'moveBack';\n        rsp.viewId = backView.viewId;\n        if(backView.historyId === currentView.historyId) {\n          // went back in the same history\n          rsp.navDirection = 'back';\n        }\n\n      } else if(forwardView && forwardView.stateId === currentStateId) {\n        // they went to the forward one, set the forward view to no longer a forward view\n        rsp.viewId = forwardView.viewId;\n        rsp.navAction = 'moveForward';\n        if(forwardView.historyId === currentView.historyId) {\n          rsp.navDirection = 'forward';\n        }\n\n        var parentHistory = this._getParentHistoryObj(containerScope);\n        if(forwardView.historyId && parentHistory.scope) {\n          // if a history has already been created by the forward view then make sure it stays the same\n          parentHistory.scope.$historyId = forwardView.historyId;\n          rsp.historyId = forwardView.historyId;\n        }\n\n      } else if(currentView && currentView.historyId !== hist.historyId &&\n                hist.cursor > -1 && hist.stack.length > 0 && hist.cursor < hist.stack.length &&\n                hist.stack[hist.cursor].stateId === currentStateId) {\n        // they just changed to a different history and the history already has views in it\n        rsp.viewId = hist.stack[hist.cursor].viewId;\n        rsp.navAction = 'moveBack';\n\n      } else {\n\n        // set a new unique viewId\n        rsp.viewId = createViewId(currentStateId);\n\n        if(currentView) {\n          // set the forward view if there is a current view (ie: if its not the first view)\n          currentView.forwardViewId = rsp.viewId;\n\n          // its only moving forward if its in the same history\n          if(hist.historyId === currentView.historyId) {\n            rsp.navDirection = 'forward';\n          }\n          rsp.navAction = 'newView';\n\n          // check if there is a new forward view\n          if(forwardView && currentView.stateId !== forwardView.stateId) {\n            // they navigated to a new view but the stack already has a forward view\n            // since its a new view remove any forwards that existed\n            var forwardsHistory = this._getHistoryById(forwardView.historyId);\n            if(forwardsHistory) {\n              // the forward has a history\n              for(var x=forwardsHistory.stack.length - 1; x >= forwardView.index; x--) {\n                // starting from the end destroy all forwards in this history from this point\n                forwardsHistory.stack[x].destroy();\n                forwardsHistory.stack.splice(x);\n              }\n            }\n          }\n\n        } else {\n          // there's no current view, so this must be the initial view\n          rsp.navAction = 'initialView';\n        }\n\n        // add the new view\n        viewHistory.views[rsp.viewId] = this.createView({\n          viewId: rsp.viewId,\n          index: hist.stack.length,\n          historyId: hist.historyId,\n          backViewId: (currentView && currentView.viewId ? currentView.viewId : null),\n          forwardViewId: null,\n          stateId: currentStateId,\n          stateName: this.getCurrentStateName(),\n          stateParams: this.getCurrentStateParams(),\n          url: $location.url(),\n        });\n\n        if (rsp.navAction == 'moveBack') {\n          //moveBack(from, to);\n          $rootScope.$emit('$viewHistory.viewBack', currentView.viewId, rsp.viewId);\n        }\n\n        // add the new view to this history's stack\n        hist.stack.push(viewHistory.views[rsp.viewId]);\n      }\n\n      if(nextViewOptions) {\n        if(nextViewOptions.disableAnimate) rsp.navDirection = null;\n        if(nextViewOptions.disableBack) viewHistory.views[rsp.viewId].backViewId = null;\n        this.nextViewOptions(null);\n      }\n\n      this.setNavViews(rsp.viewId);\n\n      hist.cursor = viewHistory.currentView.index;\n\n      return rsp;\n    },\n\n    setNavViews: function(viewId) {\n      var viewHistory = $rootScope.$viewHistory;\n\n      viewHistory.currentView = this._getViewById(viewId);\n      viewHistory.backView = this._getBackView(viewHistory.currentView);\n      viewHistory.forwardView = this._getForwardView(viewHistory.currentView);\n\n      $rootScope.$broadcast('$viewHistory.historyChange', {\n        showBack: (viewHistory.backView && viewHistory.backView.historyId === viewHistory.currentView.historyId)\n      });\n    },\n\n    registerHistory: function(scope) {\n      scope.$historyId = ionic.Utils.nextUid();\n    },\n\n    createView: function(data) {\n      var newView = new View();\n      return newView.initialize(data);\n    },\n\n    getCurrentView: function() {\n      return $rootScope.$viewHistory.currentView;\n    },\n\n    getBackView: function() {\n      return $rootScope.$viewHistory.backView;\n    },\n\n    getForwardView: function() {\n      return $rootScope.$viewHistory.forwardView;\n    },\n\n    getNavDirection: function() {\n      return $rootScope.$viewHistory.navDirection;\n    },\n\n    getCurrentStateName: function() {\n      return ($state && $state.current ? $state.current.name : null);\n    },\n\n    isCurrentStateNavView: function(navView) {\n      return ($state &&\n              $state.current &&\n              $state.current.views &&\n              $state.current.views[navView] ? true : false);\n    },\n\n    getCurrentStateParams: function() {\n      var rtn;\n      if ($state && $state.params) {\n        for(var key in $state.params) {\n          if($state.params.hasOwnProperty(key)) {\n            rtn = rtn || {};\n            rtn[key] = $state.params[key];\n          }\n        }\n      }\n      return rtn;\n    },\n\n    getCurrentStateId: function() {\n      var id;\n      if($state && $state.current && $state.current.name) {\n        id = $state.current.name;\n        if($state.params) {\n          for(var key in $state.params) {\n            if($state.params.hasOwnProperty(key) && $state.params[key]) {\n              id += \"_\" + key + \"=\" + $state.params[key];\n            }\n          }\n        }\n        return id;\n      }\n      // if something goes wrong make sure its got a unique stateId\n      return ionic.Utils.nextUid();\n    },\n\n    goToHistoryRoot: function(historyId) {\n      if(historyId) {\n        var hist = $rootScope.$viewHistory.histories[ historyId ];\n        if(hist && hist.stack.length) {\n          if($rootScope.$viewHistory.currentView && $rootScope.$viewHistory.currentView.viewId === hist.stack[0].viewId) {\n            return;\n          }\n          $rootScope.$viewHistory.forcedNav = {\n            viewId: hist.stack[0].viewId,\n            navAction: 'moveBack',\n            navDirection: 'back'\n          };\n          hist.stack[0].go();\n        }\n      }\n    },\n\n    _getViewById: function(viewId) {\n      return (viewId ? $rootScope.$viewHistory.views[ viewId ] : null );\n    },\n\n    _getBackView: function(view) {\n      return (view ? this._getViewById(view.backViewId) : null );\n    },\n\n    _getForwardView: function(view) {\n      return (view ? this._getViewById(view.forwardViewId) : null );\n    },\n\n    _getHistoryById: function(historyId) {\n      return (historyId ? $rootScope.$viewHistory.histories[ historyId ] : null );\n    },\n\n    _getHistory: function(scope) {\n      var histObj = this._getParentHistoryObj(scope);\n\n      if( !$rootScope.$viewHistory.histories[ histObj.historyId ] ) {\n        // this history object exists in parent scope, but doesn't\n        // exist in the history data yet\n        $rootScope.$viewHistory.histories[ histObj.historyId ] = {\n          historyId: histObj.historyId,\n          parentHistoryId: this._getParentHistoryObj(histObj.scope.$parent).historyId,\n          stack: [],\n          cursor: -1\n        };\n      }\n\n      return $rootScope.$viewHistory.histories[ histObj.historyId ];\n    },\n\n    _getParentHistoryObj: function(scope) {\n      var parentScope = scope;\n      while(parentScope) {\n        if(parentScope.hasOwnProperty('$historyId')) {\n          // this parent scope has a historyId\n          return { historyId: parentScope.$historyId, scope: parentScope };\n        }\n        // nothing found keep climbing up\n        parentScope = parentScope.$parent;\n      }\n      // no history for for the parent, use the root\n      return { historyId: 'root', scope: $rootScope };\n    },\n\n    nextViewOptions: function(opts) {\n      if(arguments.length) {\n        this._nextOpts = opts;\n      } else {\n        return this._nextOpts;\n      }\n    },\n\n    getRenderer: function(navViewElement, navViewAttrs, navViewScope) {\n      var service = this;\n      var registerData;\n      var doAnimation;\n\n      // climb up the DOM and see which animation classname to use, if any\n      var animationClass = getParentAnimationClass(navViewElement[0]);\n\n      function getParentAnimationClass(el) {\n        var className = '';\n        while(!className && el) {\n          className = el.getAttribute('animation');\n          el = el.parentElement;\n        }\n\n        // If they don't have an animation set explicitly, use the value in the config\n        if(!className) {\n          return $ionicNavViewConfig.transition;\n        }\n\n        return className;\n      }\n\n      function setAnimationClass() {\n        // add the animation CSS class we're gonna use to transition between views\n        if (animationClass) {\n          navViewElement[0].classList.add(animationClass);\n        }\n\n        if(registerData.navDirection === 'back') {\n          // animate like we're moving backward\n          navViewElement[0].classList.add('reverse');\n        } else {\n          // defaults to animate forward\n          // make sure the reverse class isn't already added\n          navViewElement[0].classList.remove('reverse');\n        }\n      }\n\n      return function(shouldAnimate) {\n\n        return {\n\n          enter: function(element) {\n\n            if(doAnimation && shouldAnimate) {\n              // enter with an animation\n              setAnimationClass();\n\n              element.addClass('ng-enter');\n              $ionicClickBlock.show();\n\n              $animate.enter(element, navViewElement, null, function() {\n                $ionicClickBlock.hide();\n                if (animationClass) {\n                  navViewElement[0].classList.remove(animationClass);\n                }\n              });\n              return;\n            } else if(!doAnimation) {\n              $ionicClickBlock.hide();\n            }\n\n            // no animation\n            navViewElement.append(element);\n          },\n\n          leave: function() {\n            var element = navViewElement.contents();\n\n            if(doAnimation && shouldAnimate) {\n              // leave with an animation\n              setAnimationClass();\n\n              $animate.leave(element, function() {\n                element.remove();\n              });\n              return;\n            }\n\n            // no animation\n            element.remove();\n          },\n\n          register: function(element) {\n            // register a new view\n            registerData = service.register(navViewScope, element);\n            doAnimation = (animationClass !== null && registerData.navDirection !== null);\n            return registerData;\n          }\n\n        };\n      };\n    },\n\n    disableRegisterByTagName: function(tagName) {\n      // not every element should animate betwee transitions\n      // For example, the <ion-tabs> directive should not animate when it enters,\n      // but instead the <ion-tabs> directve would just show, and its children\n      // <ion-tab> directives would do the animating, but <ion-tabs> itself is not a view\n      $rootScope.$viewHistory.disabledRegistrableTagNames.push(tagName.toUpperCase());\n    },\n\n    isTagNameRegistrable: function(element) {\n      // check if this element has a tagName (at its root, not recursively)\n      // that shouldn't be animated, like <ion-tabs> or <ion-side-menu>\n      var x, y, disabledTags = $rootScope.$viewHistory.disabledRegistrableTagNames;\n      for(x=0; x<element.length; x++) {\n        if(element[x].nodeType !== 1) continue;\n        for(y=0; y<disabledTags.length; y++) {\n          if(element[x].tagName === disabledTags[y]) {\n            return false;\n          }\n        }\n      }\n      return true;\n    },\n\n    clearHistory: function() {\n      var\n      histories = $rootScope.$viewHistory.histories,\n      currentView = $rootScope.$viewHistory.currentView;\n\n      if(histories) {\n        for(var historyId in histories) {\n\n          if(histories[historyId].stack) {\n            histories[historyId].stack = [];\n            histories[historyId].cursor = -1;\n          }\n\n          if(currentView && currentView.historyId === historyId) {\n            currentView.backViewId = null;\n            currentView.forwardViewId = null;\n            histories[historyId].stack.push(currentView);\n          } else if(histories[historyId].destroy) {\n            histories[historyId].destroy();\n          }\n\n        }\n      }\n\n      for(var viewId in $rootScope.$viewHistory.views) {\n        if(viewId !== currentView.viewId) {\n          delete $rootScope.$viewHistory.views[viewId];\n        }\n      }\n\n      if(currentView) {\n        this.setNavViews(currentView.viewId);\n      }\n    }\n\n  };\n\n}]);\n\n/**\n * @private\n */\nIonicModule.config([\n  '$provide',\nfunction($provide) {\n  function $LocationDecorator($location, $timeout) {\n\n    $location.__hash = $location.hash;\n    //Fix: when window.location.hash is set, the scrollable area\n    //found nearest to body's scrollTop is set to scroll to an element\n    //with that ID.\n    $location.hash = function(value) {\n      if (angular.isDefined(value)) {\n        $timeout(function() {\n          var scroll = document.querySelector('.scroll-content');\n          if (scroll)\n            scroll.scrollTop = 0;\n        }, 0, false);\n      }\n      return $location.__hash(value);\n    };\n\n    return $location;\n  }\n\n  $provide.decorator('$location', ['$delegate', '$timeout', $LocationDecorator]);\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicListDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionList} directive.\n *\n * Methods called directly on the $ionicListDelegate service will control all lists.\n * Use the {@link ionic.service:$ionicListDelegate#$getByHandle $getByHandle}\n * method to control specific ionList instances.\n *\n * @usage\n *\n * ````html\n * <ion-content ng-controller=\"MyCtrl\">\n *   <button class=\"button\" ng-click=\"showDeleteButtons()\"></button>\n *   <ion-list>\n *     <ion-item ng-repeat=\"i in items\">\n *       {% raw %}Hello, {{i}}!{% endraw %}\n *       <ion-delete-button class=\"ion-minus-circled\"></ion-delete-button>\n *     </ion-item>\n *   </ion-list>\n * </ion-content>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicListDelegate) {\n *   $scope.showDeleteButtons = function() {\n *     $ionicListDelegate.showDelete(true);\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicListDelegate', delegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#showReorder\n   * @param {boolean=} showReorder Set whether or not this list is showing its reorder buttons.\n   * @returns {boolean} Whether the reorder buttons are shown.\n   */\n  'showReorder',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#showDelete\n   * @param {boolean=} showDelete Set whether or not this list is showing its delete buttons.\n   * @returns {boolean} Whether the delete buttons are shown.\n   */\n  'showDelete',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#canSwipeItems\n   * @param {boolean=} canSwipeItems Set whether or not this list is able to swipe to show\n   * option buttons.\n   * @returns {boolean} Whether the list is able to swipe to show option buttons.\n   */\n  'canSwipeItems',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#closeOptionButtons\n   * @description Closes any option buttons on the list that are swiped open.\n   */\n  'closeOptionButtons',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionList} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicListDelegate.$getByHandle('my-handle').showReorder(true);`\n   */\n]))\n\n.controller('$ionicList', [\n  '$scope',\n  '$attrs',\n  '$parse',\n  '$ionicListDelegate',\nfunction($scope, $attrs, $parse, $ionicListDelegate) {\n\n  var isSwipeable = true;\n  var isReorderShown = false;\n  var isDeleteShown = false;\n\n  var deregisterInstance = $ionicListDelegate._registerInstance(this, $attrs.delegateHandle);\n  $scope.$on('$destroy', deregisterInstance);\n\n  this.showReorder = function(show) {\n    if (arguments.length) {\n      isReorderShown = !!show;\n    }\n    return isReorderShown;\n  };\n\n  this.showDelete = function(show) {\n    if (arguments.length) {\n      isDeleteShown = !!show;\n    }\n    return isDeleteShown;\n  };\n\n  this.canSwipeItems = function(can) {\n    if (arguments.length) {\n      isSwipeable = !!can;\n    }\n    return isSwipeable;\n  };\n\n  this.closeOptionButtons = function() {\n    this.listView && this.listView.clearDragEffects();\n  };\n}]);\n\nIonicModule\n.controller('$ionicNavBar', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$ionicViewService',\n  '$animate',\n  '$compile',\n  '$ionicNavBarDelegate',\nfunction($scope, $element, $attrs, $ionicViewService, $animate, $compile, $ionicNavBarDelegate) {\n  //Let the parent know about our controller too so that children of\n  //sibling content elements can know about us\n  $element.parent().data('$ionNavBarController', this);\n\n  var deregisterInstance = $ionicNavBarDelegate._registerInstance(this, $attrs.delegateHandle);\n\n  $scope.$on('$destroy', deregisterInstance);\n\n  $scope.$on('$viewHistory.historyChange', function(e, data) {\n    backIsShown = !!data.showBack;\n  });\n\n  var self = this;\n\n  this.leftButtonsElement = jqLite(\n    $element[0].querySelector('.buttons.left-buttons')\n  );\n  this.rightButtonsElement = jqLite(\n    $element[0].querySelector('.buttons.right-buttons')\n  );\n\n  this.back = function() {\n    var backView = $ionicViewService.getBackView();\n    backView && backView.go();\n    return false;\n  };\n\n  this.align = function(direction) {\n    this._headerBarView.align(direction);\n  };\n\n  this.showBackButton = function(show) {\n    if (arguments.length) {\n      $scope.backButtonShown = !!show;\n    }\n    return !!($scope.hasBackButton && $scope.backButtonShown);\n  };\n\n  this.showBar = function(show) {\n    if (arguments.length) {\n      $scope.isInvisible = !show;\n      $scope.$parent.$hasHeader = !!show;\n    }\n    return !$scope.isInvisible;\n  };\n\n  this.setTitle = function(title) {\n    if ($scope.title === title) {\n      return;\n    }\n    $scope.oldTitle = $scope.title;\n    $scope.title = title || '';\n  };\n\n  this.changeTitle = function(title, direction) {\n    if ($scope.title === title) {\n      // if we're not animating the title, but the back button becomes invisible\n      if(typeof backIsShown != 'undefined' && !backIsShown && $scope.backButtonShown){\n        jqLite($element[0].querySelector('.back-button')).addClass('ng-hide');\n      }\n      return false;\n    }\n    this.setTitle(title);\n    $scope.isReverse = direction == 'back';\n    $scope.shouldAnimate = !!direction;\n\n    if (!$scope.shouldAnimate) {\n      //We're done!\n      this._headerBarView.align();\n    } else {\n      this._animateTitles();\n    }\n    return true;\n  };\n\n  this.getTitle = function() {\n    return $scope.title || '';\n  };\n\n  this.getPreviousTitle = function() {\n    return $scope.oldTitle || '';\n  };\n\n  /**\n   * Exposed for testing\n   */\n  this._animateTitles = function() {\n    var oldTitleEl, newTitleEl, currentTitles;\n\n    //If we have any title right now\n    //(or more than one, they could be transitioning on switch),\n    //replace the first one with an oldTitle element\n    currentTitles = $element[0].querySelectorAll('.title');\n    if (currentTitles.length) {\n      oldTitleEl = $compile('<h1 class=\"title\" ng-bind-html=\"oldTitle\"></h1>')($scope);\n      jqLite(currentTitles[0]).replaceWith(oldTitleEl);\n    }\n    //Compile new title\n    newTitleEl = $compile('<h1 class=\"title invisible\" ng-bind-html=\"title\"></h1>')($scope);\n\n    //Animate in on next frame\n    ionic.requestAnimationFrame(function() {\n\n      oldTitleEl && $animate.leave(jqLite(oldTitleEl));\n\n      var insert = oldTitleEl && jqLite(oldTitleEl) || null;\n      $animate.enter(newTitleEl, $element, insert, function() {\n        self._headerBarView.align();\n      });\n\n      //Cleanup any old titles leftover (besides the one we already did replaceWith on)\n      forEach(currentTitles, function(el) {\n        if (el && el.parentNode) {\n          //Use .remove() to cleanup things like .data()\n          jqLite(el).remove();\n        }\n      });\n\n      //$apply so bindings fire\n      $scope.$digest();\n\n      //Stop flicker of new title on ios7\n      ionic.requestAnimationFrame(function() {\n        newTitleEl[0].classList.remove('invisible');\n      });\n    });\n  };\n}]);\n\n\n/**\n * @private\n */\nIonicModule\n\n.factory('$$scrollValueCache', function() {\n  return {};\n})\n\n.controller('$ionicScroll', [\n  '$scope',\n  'scrollViewOptions',\n  '$timeout',\n  '$window',\n  '$$scrollValueCache',\n  '$location',\n  '$rootScope',\n  '$document',\n  '$ionicScrollDelegate',\nfunction($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $location, $rootScope, $document, $ionicScrollDelegate) {\n\n  var self = this;\n  // for testing\n  this.__timeout = $timeout;\n\n  this._scrollViewOptions = scrollViewOptions; //for testing\n\n  var element = this.element = scrollViewOptions.el;\n  var $element = this.$element = jqLite(element);\n  var scrollView = this.scrollView = new ionic.views.Scroll(scrollViewOptions);\n\n  //Attach self to element as a controller so other directives can require this controller\n  //through `require: '$ionicScroll'\n  //Also attach to parent so that sibling elements can require this\n  ($element.parent().length ? $element.parent() : $element)\n    .data('$$ionicScrollController', this);\n\n  var deregisterInstance = $ionicScrollDelegate._registerInstance(\n    this, scrollViewOptions.delegateHandle\n  );\n\n  if (!angular.isDefined(scrollViewOptions.bouncing)) {\n    ionic.Platform.ready(function() {\n      scrollView.options.bouncing = true;\n\n      if(ionic.Platform.isAndroid()) {\n        // No bouncing by default on Android\n        scrollView.options.bouncing = false;\n        // Faster scroll decel\n        scrollView.options.deceleration = 0.95;\n      } else {\n      }\n    });\n  }\n\n  var resize = angular.bind(scrollView, scrollView.resize);\n  ionic.on('resize', resize, $window);\n\n  // set by rootScope listener if needed\n  var backListenDone = angular.noop;\n  var viewContentLoaded = angular.noop;\n\n  var scrollFunc = function(e) {\n    var detail = (e.originalEvent || e).detail || {};\n    $scope.$onScroll && $scope.$onScroll({\n      event: e,\n      scrollTop: detail.scrollTop || 0,\n      scrollLeft: detail.scrollLeft || 0\n    });\n  };\n\n  $element.on('scroll', scrollFunc );\n\n  $scope.$on('$destroy', function() {\n    deregisterInstance();\n    scrollView.__cleanup();\n    ionic.off('resize', resize, $window);\n    $window.removeEventListener('resize', resize);\n    viewContentLoaded();\n    backListenDone();\n    if (self._rememberScrollId) {\n      $$scrollValueCache[self._rememberScrollId] = scrollView.getValues();\n    }\n    scrollViewOptions = null;\n    self._scrollViewOptions = null;\n    self.element = null;\n    $element.off('scroll', scrollFunc);\n    $element = null;\n    self.$element = null;\n    self.scrollView = null;\n    scrollView = null;\n  });\n\n  viewContentLoaded = $scope.$on('$viewContentLoaded', function(e, historyData) {\n    //only the top-most scroll area under a view should remember that view's\n    //scroll position\n    if (e.defaultPrevented) { return; }\n    e.preventDefault();\n\n    var viewId = historyData && historyData.viewId || $scope.$historyId;\n    if (viewId) {\n      $timeout(function() {\n        self.rememberScrollPosition(viewId);\n        self.scrollToRememberedPosition();\n\n        backListenDone = $rootScope.$on('$viewHistory.viewBack', function(e, fromViewId, toViewId) {\n          //When going back from this view, forget its saved scroll position\n          if (viewId === fromViewId) {\n            self.forgetScrollPosition();\n          }\n        });\n      }, 0, false);\n    }\n  });\n\n  $timeout(function() {\n    scrollView.run();\n  });\n\n  this._rememberScrollId = null;\n\n  this.getScrollView = function() {\n    return this.scrollView;\n  };\n\n  this.getScrollPosition = function() {\n    return this.scrollView.getValues();\n  };\n\n  this.resize = function() {\n    return $timeout(resize).then(function() {\n      $element.triggerHandler('scroll.resize');\n    });\n  };\n\n  this.scrollTop = function(shouldAnimate) {\n    this.resize().then(function() {\n      scrollView.scrollTo(0, 0, !!shouldAnimate);\n    });\n  };\n\n  this.scrollBottom = function(shouldAnimate) {\n    this.resize().then(function() {\n      var max = scrollView.getScrollMax();\n      scrollView.scrollTo(max.left, max.top, !!shouldAnimate);\n    });\n  };\n\n  this.scrollTo = function(left, top, shouldAnimate) {\n    this.resize().then(function() {\n      scrollView.scrollTo(left, top, !!shouldAnimate);\n    });\n  };\n\n  this.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) {\n    this.resize().then(function() {\n      scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop);\n    });\n  };\n\n  this.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) {\n    this.resize().then(function() {\n      scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop);\n    });\n  };\n\n  this.scrollBy = function(left, top, shouldAnimate) {\n    this.resize().then(function() {\n      scrollView.scrollBy(left, top, !!shouldAnimate);\n    });\n  };\n\n  this.anchorScroll = function(shouldAnimate) {\n    this.resize().then(function() {\n      var hash = $location.hash();\n      var elm = hash && $document[0].getElementById(hash);\n      if (!(hash && elm)) {\n        scrollView.scrollTo(0,0, !!shouldAnimate);\n        return;\n      }\n      var curElm = elm;\n      var scrollLeft = 0, scrollTop = 0, levelsClimbed = 0;\n      do {\n        if(curElm !== null)scrollLeft += curElm.offsetLeft;\n        if(curElm !== null)scrollTop += curElm.offsetTop;\n        curElm = curElm.offsetParent;\n        levelsClimbed++;\n      } while (curElm.attributes != self.element.attributes && curElm.offsetParent);\n      scrollView.scrollTo(scrollLeft, scrollTop, !!shouldAnimate);\n    });\n  };\n\n  this.rememberScrollPosition = function(id) {\n    if (!id) {\n      throw new Error(\"Must supply an id to remember the scroll by!\");\n    }\n    this._rememberScrollId = id;\n  };\n  this.forgetScrollPosition = function() {\n    delete $$scrollValueCache[this._rememberScrollId];\n    this._rememberScrollId = null;\n  };\n  this.scrollToRememberedPosition = function(shouldAnimate) {\n    var values = $$scrollValueCache[this._rememberScrollId];\n    if (values) {\n      this.resize().then(function() {\n        scrollView.scrollTo(+values.left, +values.top, shouldAnimate);\n      });\n    }\n  };\n\n  /**\n   * @private\n   */\n  this._setRefresher = function(refresherScope, refresherElement) {\n    var refresher = this.refresher = refresherElement;\n    var refresherHeight = self.refresher.clientHeight || 0;\n    scrollView.activatePullToRefresh(refresherHeight, function() {\n      // activateCallback\n      refresher.classList.add('active');\n      refresherScope.$onPulling();\n    }, function() {\n      // deactivateCallback\n      $timeout(function(){\n        refresher.classList.remove('active');\n        refresher.classList.remove('refreshing');\n        refresher.classList.add('invisible');\n      },300);\n    }, function() {\n      // startCallback\n      refresher.classList.add('refreshing');\n      refresherScope.$onRefresh();\n    },function(){\n      // showCallback\n      refresher.classList.remove('invisible');\n    },function(){\n      // hideCallback\n      refresher.classList.add('invisible');\n    });\n  };\n}]);\n\n\nIonicModule\n.controller('$ionicSideMenus', [\n  '$scope',\n  '$attrs',\n  '$ionicSideMenuDelegate',\n  '$ionicPlatform',\n  '$ionicBody',\nfunction($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody) {\n  var self = this;\n  var rightShowing, leftShowing, isDragging;\n  var startX, lastX, offsetX, isAsideExposed;\n\n  self.$scope = $scope;\n\n  self.initialize = function(options) {\n    self.left = options.left;\n    self.right = options.right;\n    self.setContent(options.content);\n    self.dragThresholdX = options.dragThresholdX || 10;\n  };\n\n  /**\n   * Set the content view controller if not passed in the constructor options.\n   *\n   * @param {object} content\n   */\n  self.setContent = function(content) {\n    if(content) {\n      self.content = content;\n\n      self.content.onDrag = function(e) {\n        self._handleDrag(e);\n      };\n\n      self.content.endDrag = function(e) {\n        self._endDrag(e);\n      };\n    }\n  };\n\n  self.isOpenLeft = function() {\n    return self.getOpenAmount() > 0;\n  };\n\n  self.isOpenRight = function() {\n    return self.getOpenAmount() < 0;\n  };\n\n  /**\n   * Toggle the left menu to open 100%\n   */\n  self.toggleLeft = function(shouldOpen) {\n    var openAmount = self.getOpenAmount();\n    if (arguments.length === 0) {\n      shouldOpen = openAmount <= 0;\n    }\n    self.content.enableAnimation();\n    if(!shouldOpen) {\n      self.openPercentage(0);\n    } else {\n      self.openPercentage(100);\n    }\n  };\n\n  /**\n   * Toggle the right menu to open 100%\n   */\n  self.toggleRight = function(shouldOpen) {\n    var openAmount = self.getOpenAmount();\n    if (arguments.length === 0) {\n      shouldOpen = openAmount >= 0;\n    }\n    self.content.enableAnimation();\n    if(!shouldOpen) {\n      self.openPercentage(0);\n    } else {\n      self.openPercentage(-100);\n    }\n  };\n\n  /**\n   * Close all menus.\n   */\n  self.close = function() {\n    self.openPercentage(0);\n  };\n\n  /**\n   * @return {float} The amount the side menu is open, either positive or negative for left (positive), or right (negative)\n   */\n  self.getOpenAmount = function() {\n    return self.content && self.content.getTranslateX() || 0;\n  };\n\n  /**\n   * @return {float} The ratio of open amount over menu width. For example, a\n   * menu of width 100 open 50 pixels would be open 50% or a ratio of 0.5. Value is negative\n   * for right menu.\n   */\n  self.getOpenRatio = function() {\n    var amount = self.getOpenAmount();\n    if(amount >= 0) {\n      return amount / self.left.width;\n    }\n    return amount / self.right.width;\n  };\n\n  self.isOpen = function() {\n    return self.getOpenAmount() !== 0;\n  };\n\n  /**\n   * @return {float} The percentage of open amount over menu width. For example, a\n   * menu of width 100 open 50 pixels would be open 50%. Value is negative\n   * for right menu.\n   */\n  self.getOpenPercentage = function() {\n    return self.getOpenRatio() * 100;\n  };\n\n  /**\n   * Open the menu with a given percentage amount.\n   * @param {float} percentage The percentage (positive or negative for left/right) to open the menu.\n   */\n  self.openPercentage = function(percentage) {\n    var p = percentage / 100;\n\n    if(self.left && percentage >= 0) {\n      self.openAmount(self.left.width * p);\n    } else if(self.right && percentage < 0) {\n      var maxRight = self.right.width;\n      self.openAmount(self.right.width * p);\n    }\n\n    // add the CSS class \"menu-open\" if the percentage does not\n    // equal 0, otherwise remove the class from the body element\n    $ionicBody.enableClass( (percentage !== 0), 'menu-open');\n  };\n\n  /**\n   * Open the menu the given pixel amount.\n   * @param {float} amount the pixel amount to open the menu. Positive value for left menu,\n   * negative value for right menu (only one menu will be visible at a time).\n   */\n  self.openAmount = function(amount) {\n    var maxLeft = self.left && self.left.width || 0;\n    var maxRight = self.right && self.right.width || 0;\n\n    // Check if we can move to that side, depending if the left/right panel is enabled\n    if(!(self.left && self.left.isEnabled) && amount > 0) {\n      self.content.setTranslateX(0);\n      return;\n    }\n\n    if(!(self.right && self.right.isEnabled) && amount < 0) {\n      self.content.setTranslateX(0);\n      return;\n    }\n\n    if(leftShowing && amount > maxLeft) {\n      self.content.setTranslateX(maxLeft);\n      return;\n    }\n\n    if(rightShowing && amount < -maxRight) {\n      self.content.setTranslateX(-maxRight);\n      return;\n    }\n\n    self.content.setTranslateX(amount);\n\n    if(amount >= 0) {\n      leftShowing = true;\n      rightShowing = false;\n\n      if(amount > 0) {\n        // Push the z-index of the right menu down\n        self.right && self.right.pushDown && self.right.pushDown();\n        // Bring the z-index of the left menu up\n        self.left && self.left.bringUp && self.left.bringUp();\n      }\n    } else {\n      rightShowing = true;\n      leftShowing = false;\n\n      // Bring the z-index of the right menu up\n      self.right && self.right.bringUp && self.right.bringUp();\n      // Push the z-index of the left menu down\n      self.left && self.left.pushDown && self.left.pushDown();\n    }\n  };\n\n  /**\n   * Given an event object, find the final resting position of this side\n   * menu. For example, if the user \"throws\" the content to the right and\n   * releases the touch, the left menu should snap open (animated, of course).\n   *\n   * @param {Event} e the gesture event to use for snapping\n   */\n  self.snapToRest = function(e) {\n    // We want to animate at the end of this\n    self.content.enableAnimation();\n    isDragging = false;\n\n    // Check how much the panel is open after the drag, and\n    // what the drag velocity is\n    var ratio = self.getOpenRatio();\n\n    if(ratio === 0) {\n      // Just to be safe\n      self.openPercentage(0);\n      return;\n    }\n\n    var velocityThreshold = 0.3;\n    var velocityX = e.gesture.velocityX;\n    var direction = e.gesture.direction;\n\n    // Going right, less than half, too slow (snap back)\n    if(ratio > 0 && ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) {\n      self.openPercentage(0);\n    }\n\n    // Going left, more than half, too slow (snap back)\n    else if(ratio > 0.5 && direction == 'left' && velocityX < velocityThreshold) {\n      self.openPercentage(100);\n    }\n\n    // Going left, less than half, too slow (snap back)\n    else if(ratio < 0 && ratio > -0.5 && direction == 'left' && velocityX < velocityThreshold) {\n      self.openPercentage(0);\n    }\n\n    // Going right, more than half, too slow (snap back)\n    else if(ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) {\n      self.openPercentage(-100);\n    }\n\n    // Going right, more than half, or quickly (snap open)\n    else if(direction == 'right' && ratio >= 0 && (ratio >= 0.5 || velocityX > velocityThreshold)) {\n      self.openPercentage(100);\n    }\n\n    // Going left, more than half, or quickly (span open)\n    else if(direction == 'left' && ratio <= 0 && (ratio <= -0.5 || velocityX > velocityThreshold)) {\n      self.openPercentage(-100);\n    }\n\n    // Snap back for safety\n    else {\n      self.openPercentage(0);\n    }\n  };\n\n  self.isAsideExposed = function() {\n    return !!isAsideExposed;\n  };\n\n  self.exposeAside = function(shouldExposeAside) {\n    isAsideExposed = shouldExposeAside;\n\n    // set the left marget width if it should be exposed\n    // otherwise set false so there's no left margin\n    self.content.setMarginLeft( isAsideExposed ? self.left.width : 0 );\n\n    self.$scope.$emit('$ionicExposeAside', isAsideExposed);\n  };\n\n  self.activeAsideResizing = function(isResizing) {\n    $ionicBody.enableClass(isResizing, 'aside-resizing');\n  };\n\n  // End a drag with the given event\n  self._endDrag = function(e) {\n    if(isAsideExposed) return;\n\n    if(isDragging) {\n      self.snapToRest(e);\n    }\n    startX = null;\n    lastX = null;\n    offsetX = null;\n  };\n\n  // Handle a drag event\n  self._handleDrag = function(e) {\n    if(isAsideExposed) return;\n\n    // If we don't have start coords, grab and store them\n    if(!startX) {\n      startX = e.gesture.touches[0].pageX;\n      lastX = startX;\n    } else {\n      // Grab the current tap coords\n      lastX = e.gesture.touches[0].pageX;\n    }\n\n    // Calculate difference from the tap points\n    if(!isDragging && Math.abs(lastX - startX) > self.dragThresholdX) {\n      // if the difference is greater than threshold, start dragging using the current\n      // point as the starting point\n      startX = lastX;\n\n      isDragging = true;\n      // Initialize dragging\n      self.content.disableAnimation();\n      offsetX = self.getOpenAmount();\n    }\n\n    if(isDragging) {\n      self.openAmount(offsetX + (lastX - startX));\n    }\n  };\n\n  self.canDragContent = function(canDrag) {\n    if (arguments.length) {\n      $scope.dragContent = !!canDrag;\n    }\n    return $scope.dragContent;\n  };\n\n  self.edgeThreshold = 25;\n  self.edgeThresholdEnabled = false;\n  self.edgeDragThreshold = function(value) {\n    if (arguments.length) {\n      if (angular.isNumber(value) && value > 0) {\n        self.edgeThreshold = value;\n        self.edgeThresholdEnabled = true;\n      } else {\n        self.edgeThresholdEnabled = !!value;\n      }\n    }\n    return self.edgeThresholdEnabled;\n  };\n\n  self.isDraggableTarget = function(e) {\n    //Only restrict edge when sidemenu is closed and restriction is enabled\n    var shouldOnlyAllowEdgeDrag = self.edgeThresholdEnabled && !self.isOpen();\n    var startX = e.gesture.startEvent && e.gesture.startEvent.center &&\n      e.gesture.startEvent.center.pageX;\n\n    var dragIsWithinBounds = !shouldOnlyAllowEdgeDrag ||\n      startX <= self.edgeThreshold ||\n      startX >= self.content.offsetWidth - self.edgeThreshold;\n\n    return ($scope.dragContent || self.isOpen()) &&\n           dragIsWithinBounds &&\n           !e.gesture.srcEvent.defaultPrevented &&\n           !e.target.tagName.match(/input|textarea|select|object|embed/i) &&\n           !e.target.isContentEditable &&\n           !(e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll') == 'true');\n  };\n\n  $scope.sideMenuContentTranslateX = 0;\n\n  var deregisterBackButtonAction = angular.noop;\n  var closeSideMenu = angular.bind(self, self.close);\n\n  $scope.$watch(function() {\n    return self.getOpenAmount() !== 0;\n  }, function(isOpen) {\n    deregisterBackButtonAction();\n    if (isOpen) {\n      deregisterBackButtonAction = $ionicPlatform.registerBackButtonAction(\n        closeSideMenu,\n        PLATFORM_BACK_BUTTON_PRIORITY_SIDE_MENU\n      );\n    }\n  });\n\n  var deregisterInstance = $ionicSideMenuDelegate._registerInstance(\n    self, $attrs.delegateHandle\n  );\n\n  $scope.$on('$destroy', function() {\n    deregisterInstance();\n    deregisterBackButtonAction();\n  });\n\n  self.initialize({\n    left: { width: 275 },\n    right: { width: 275 }\n  });\n\n}]);\n\nIonicModule\n.controller('$ionicTab', [\n  '$scope',\n  '$ionicViewService',\n  '$attrs',\n  '$location',\n  '$state',\nfunction($scope, $ionicViewService, $attrs, $location, $state) {\n  this.$scope = $scope;\n\n  //All of these exposed for testing\n  this.hrefMatchesState = function() {\n    return $attrs.href && $location.path().indexOf(\n      $attrs.href.replace(/^#/, '').replace(/\\/$/, '')\n    ) === 0;\n  };\n  this.srefMatchesState = function() {\n    return $attrs.uiSref && $state.includes( $attrs.uiSref.split('(')[0] );\n  };\n  this.navNameMatchesState = function() {\n    return this.navViewName && $ionicViewService.isCurrentStateNavView(this.navViewName);\n  };\n\n  this.tabMatchesState = function() {\n    return this.hrefMatchesState() || this.srefMatchesState() || this.navNameMatchesState();\n  };\n}]);\n\nIonicModule\n.controller('$ionicTabs', [\n  '$scope',\n  '$ionicViewService',\n  '$element',\nfunction($scope, $ionicViewService, $element) {\n  var _selectedTab = null;\n  var self = this;\n  self.tabs = [];\n\n  self.selectedIndex = function() {\n    return self.tabs.indexOf(_selectedTab);\n  };\n  self.selectedTab = function() {\n    return _selectedTab;\n  };\n\n  self.add = function(tab) {\n    $ionicViewService.registerHistory(tab);\n    self.tabs.push(tab);\n    if(self.tabs.length === 1) {\n      self.select(tab);\n    }\n  };\n\n  self.remove = function(tab) {\n    var tabIndex = self.tabs.indexOf(tab);\n    if (tabIndex === -1) {\n      return;\n    }\n    //Use a field like '$tabSelected' so developers won't accidentally set it in controllers etc\n    if (tab.$tabSelected) {\n      self.deselect(tab);\n      //Try to select a new tab if we're removing a tab\n      if (self.tabs.length === 1) {\n        //do nothing if there are no other tabs to select\n      } else {\n        //Select previous tab if it's the last tab, else select next tab\n        var newTabIndex = tabIndex === self.tabs.length - 1 ? tabIndex - 1 : tabIndex + 1;\n        self.select(self.tabs[newTabIndex]);\n      }\n    }\n    self.tabs.splice(tabIndex, 1);\n  };\n\n  self.deselect = function(tab) {\n    if (tab.$tabSelected) {\n      _selectedTab = null;\n      tab.$tabSelected = false;\n      (tab.onDeselect || angular.noop)();\n    }\n  };\n\n  self.select = function(tab, shouldEmitEvent) {\n    var tabIndex;\n    if (angular.isNumber(tab)) {\n      tabIndex = tab;\n      tab = self.tabs[tabIndex];\n    } else {\n      tabIndex = self.tabs.indexOf(tab);\n    }\n\n    if (arguments.length === 1) {\n      shouldEmitEvent = !!(tab.navViewName || tab.uiSref);\n    }\n\n    if (_selectedTab && _selectedTab.$historyId == tab.$historyId) {\n      if (shouldEmitEvent) {\n        $ionicViewService.goToHistoryRoot(tab.$historyId);\n      }\n    } else {\n      forEach(self.tabs, function(tab) {\n        self.deselect(tab);\n      });\n\n      _selectedTab = tab;\n      //Use a funny name like $tabSelected so the developer doesn't overwrite the var in a child scope\n      tab.$tabSelected = true;\n      (tab.onSelect || angular.noop)();\n\n      if (shouldEmitEvent) {\n        var viewData = {\n          type: 'tab',\n          tabIndex: tabIndex,\n          historyId: tab.$historyId,\n          navViewName: tab.navViewName,\n          hasNavView: !!tab.navViewName,\n          title: tab.title,\n          url: tab.href,\n          uiSref: tab.uiSref\n        };\n        $scope.$emit('viewState.changeHistory', viewData);\n      }\n    }\n  };\n}]);\n\n\n/*\n * We don't document the ionActionSheet directive, we instead document\n * the $ionicActionSheet service\n */\nIonicModule\n.directive('ionActionSheet', ['$document', function($document) {\n  return {\n    restrict: 'E',\n    scope: true,\n    replace: true,\n    link: function($scope, $element){\n      var keyUp = function(e) {\n        if(e.which == 27) {\n          $scope.cancel();\n          $scope.$apply();\n        }\n      };\n\n      var backdropClick = function(e) {\n        if(e.target == $element[0]) {\n          $scope.cancel();\n          $scope.$apply();\n        }\n      };\n      $scope.$on('$destroy', function() {\n        $element.remove();\n        $document.unbind('keyup', keyUp);\n      });\n\n      $document.bind('keyup', keyUp);\n      $element.bind('click', backdropClick);\n    },\n    template: '<div class=\"action-sheet-backdrop\">' +\n                '<div class=\"action-sheet-wrapper\">' +\n                  '<div class=\"action-sheet\">' +\n                    '<div class=\"action-sheet-group\">' +\n                      '<div class=\"action-sheet-title\" ng-if=\"titleText\" ng-bind-html=\"titleText\"></div>' +\n                      '<button class=\"button\" ng-click=\"buttonClicked($index)\" ng-repeat=\"button in buttons\" ng-bind-html=\"button.text\"></button>' +\n                    '</div>' +\n                    '<div class=\"action-sheet-group\" ng-if=\"destructiveText\">' +\n                      '<button class=\"button destructive\" ng-click=\"destructiveButtonClicked()\" ng-bind-html=\"destructiveText\"></button>' +\n                    '</div>' +\n                    '<div class=\"action-sheet-group\" ng-if=\"cancelText\">' +\n                      '<button class=\"button\" ng-click=\"cancel()\" ng-bind-html=\"cancelText\"></button>' +\n                    '</div>' +\n                  '</div>' +\n                '</div>' +\n              '</div>'\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionCheckbox\n * @module ionic\n * @restrict E\n * @codepen hqcju\n * @description\n * The checkbox is no different than the HTML checkbox input, except it's styled differently.\n *\n * The checkbox behaves like any [AngularJS checkbox](http://docs.angularjs.org/api/ng/input/input[checkbox]).\n *\n * @usage\n * ```html\n * <ion-checkbox ng-model=\"isChecked\">Checkbox Label</ion-checkbox>\n * ```\n */\n\nIonicModule\n.directive('ionCheckbox', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<label class=\"item item-checkbox\">' +\n        '<div class=\"checkbox checkbox-input-hidden disable-pointer-events\">' +\n          '<input type=\"checkbox\">' +\n          '<i class=\"checkbox-icon\"></i>' +\n        '</div>' +\n        '<div class=\"item-content disable-pointer-events\" ng-transclude></div>' +\n      '</label>',\n    compile: function(element, attr) {\n      var input = element.find('input');\n      forEach({\n        'name': attr.name,\n        'ng-value': attr.ngValue,\n        'ng-model': attr.ngModel,\n        'ng-checked': attr.ngChecked,\n        'ng-disabled': attr.ngDisabled,\n        'ng-true-value': attr.ngTrueValue,\n        'ng-false-value': attr.ngFalseValue,\n        'ng-change': attr.ngChange\n      }, function(value, name) {\n        if (isDefined(value)) {\n          input.attr(name, value);\n        }\n      });\n    }\n\n  };\n});\n\n/**\n * @ngdoc directive\n * @module ionic\n * @name collectionRepeat\n * @restrict A\n * @codepen mFygh\n * @description\n * `collection-repeat` is a directive that allows you to render lists with\n * thousands of items in them, and experience little to no performance penalty.\n *\n * Demo:\n *\n * The directive renders onto the screen only the items that should be currently visible.\n * So if you have 1,000 items in your list but only ten fit on your screen,\n * collection-repeat will only render into the DOM the ten that are in the current\n * scroll position.\n *\n * Here are a few things to keep in mind while using collection-repeat:\n *\n * 1. The data supplied to collection-repeat must be an array.\n * 2. You must explicitly tell the directive what size your items will be in the DOM, using directive attributes.\n * Pixel amounts or percentages are allowed (see below).\n * 3. The elements rendered will be absolutely positioned: be sure to let your CSS work with\n * this (see below).\n * 4. Each collection-repeat list will take up all of its parent scrollView's space.\n * If you wish to have multiple lists on one page, put each list within its own\n * {@link ionic.directive:ionScroll ionScroll} container.\n * 5. You should not use the ng-show and ng-hide directives on your ion-content/ion-scroll elements that\n * have a collection-repeat inside.  ng-show and ng-hide apply the `display: none` css rule to the content's\n * style, causing the scrollView to read the width and height of the content as 0.  Resultingly,\n * collection-repeat will render elements that have just been un-hidden incorrectly.\n *\n *\n * @usage\n *\n * #### Basic Usage (single rows of items)\n *\n * Notice two things here: we use ng-style to set the height of the item to match\n * what the repeater thinks our item height is.  Additionally, we add a css rule\n * to make our item stretch to fit the full screen (since it will be absolutely\n * positioned).\n *\n * ```html\n * <ion-content ng-controller=\"ContentCtrl\">\n *   <div class=\"list\">\n *     <div class=\"item my-item\"\n *       collection-repeat=\"item in items\"\n *       collection-item-width=\"'100%'\"\n *       collection-item-height=\"getItemHeight(item, $index)\"\n *       ng-style=\"{height: getItemHeight(item, $index)}\">\n *       {% raw %}{{item}}{% endraw %}\n *     </div>\n *   </div>\n * </div>\n * ```\n * ```js\n * function ContentCtrl($scope) {\n *   $scope.items = [];\n *   for (var i = 0; i < 1000; i++) {\n *     $scope.items.push('Item ' + i);\n *   }\n *\n *   $scope.getItemHeight = function(item, index) {\n *     //Make evenly indexed items be 10px taller, for the sake of example\n *     return (index % 2) === 0 ? 50 : 60;\n *   };\n * }\n * ```\n * ```css\n * .my-item {\n *   left: 0;\n *   right: 0;\n * }\n * ```\n *\n * #### Grid Usage (three items per row)\n *\n * ```html\n * <ion-content>\n *   <div class=\"item item-avatar my-image-item\"\n *     collection-repeat=\"image in images\"\n *     collection-item-width=\"'33%'\"\n *     collection-item-height=\"'33%'\">\n *     <img ng-src=\"{{image.src}}\">\n *   </div>\n * </ion-content>\n * ```\n * Percentage of total visible list dimensions. This example shows a 3 by 3 matrix that fits on the screen (3 rows and 3 colums). Note that dimensions are used in the creation of the element and therefore a measurement of the item cannnot be used as an input dimension.\n * ```css\n * .my-image-item img {\n *   height: 33%;\n *   width: 33%;\n * }\n * ```\n *\n * @param {expression} collection-repeat The expression indicating how to enumerate a collection. These\n *   formats are currently supported:\n *\n *   * `variable in expression` – where variable is the user defined loop variable and `expression`\n *     is a scope expression giving the collection to enumerate.\n *\n *     For example: `album in artist.albums`.\n *\n *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking function\n *     which can be used to associate the objects in the collection with the DOM elements. If no tracking function\n *     is specified the collection-repeat associates elements by identity in the collection. It is an error to have\n *     more than one tracking function to resolve to the same key. (This would mean that two distinct objects are\n *     mapped to the same DOM element, which is not possible.)  Filters should be applied to the expression,\n *     before specifying a tracking expression.\n *\n *     For example: `item in items` is equivalent to `item in items track by $id(item)'. This implies that the DOM elements\n *     will be associated by item identity in the array.\n *\n *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique\n *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements\n *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM\n *     element in the same way in the DOM.\n *\n *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this\n *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`\n *     property is same.\n *\n *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter\n *     to items in conjunction with a tracking expression.\n *\n * @param {expression} collection-item-width The width of the repeated element.  Can be a number (in pixels) or a percentage.\n * @param {expression} collection-item-height The height of the repeated element.  Can be a number (in pixels), or a percentage.\n *\n */\nvar COLLECTION_REPEAT_SCROLLVIEW_XY_ERROR = \"Cannot create a collection-repeat within a scrollView that is scrollable on both x and y axis.  Choose either x direction or y direction.\";\nvar COLLECTION_REPEAT_ATTR_HEIGHT_ERROR = \"collection-repeat expected attribute collection-item-height to be a an expression that returns a number (in pixels) or percentage.\";\nvar COLLECTION_REPEAT_ATTR_WIDTH_ERROR = \"collection-repeat expected attribute collection-item-width to be a an expression that returns a number (in pixels) or percentage.\";\nvar COLLECTION_REPEAT_ATTR_REPEAT_ERROR = \"collection-repeat expected expression in form of '_item_ in _collection_[ track by _id_]' but got '%'\";\n\nIonicModule\n.directive('collectionRepeat', [\n  '$collectionRepeatManager',\n  '$collectionDataSource',\n  '$parse',\nfunction($collectionRepeatManager, $collectionDataSource, $parse) {\n  return {\n    priority: 1000,\n    transclude: 'element',\n    terminal: true,\n    $$tlb: true,\n    require: '^$ionicScroll',\n    controller: [function(){}],\n    link: function($scope, $element, $attr, scrollCtrl, $transclude) {\n      var wrap = jqLite('<div style=\"position:relative;\">');\n      $element.parent()[0].insertBefore(wrap[0], $element[0]);\n      wrap.append($element);\n\n      var scrollView = scrollCtrl.scrollView;\n      if (scrollView.options.scrollingX && scrollView.options.scrollingY) {\n        throw new Error(COLLECTION_REPEAT_SCROLLVIEW_XY_ERROR);\n      }\n\n      var isVertical = !!scrollView.options.scrollingY;\n      if (isVertical && !$attr.collectionItemHeight) {\n        throw new Error(COLLECTION_REPEAT_ATTR_HEIGHT_ERROR);\n      } else if (!isVertical && !$attr.collectionItemWidth) {\n        throw new Error(COLLECTION_REPEAT_ATTR_WIDTH_ERROR);\n      }\n\n      var heightParsed = $parse($attr.collectionItemHeight || '\"100%\"');\n      var widthParsed = $parse($attr.collectionItemWidth || '\"100%\"');\n\n      var heightGetter = function(scope, locals) {\n        var result = heightParsed(scope, locals);\n        if (isString(result) && result.indexOf('%') > -1) {\n          return Math.floor(parseInt(result, 10) / 100 * scrollView.__clientHeight);\n        }\n        return result;\n      };\n      var widthGetter = function(scope, locals) {\n        var result = widthParsed(scope, locals);\n        if (isString(result) && result.indexOf('%') > -1) {\n          return Math.floor(parseInt(result, 10) / 100 * scrollView.__clientWidth);\n        }\n        return result;\n      };\n\n      var match = $attr.collectionRepeat.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n      if (!match) {\n        throw new Error(COLLECTION_REPEAT_ATTR_REPEAT_ERROR\n                        .replace('%', $attr.collectionRepeat));\n      }\n      var keyExpr = match[1];\n      var listExpr = match[2];\n      var trackByExpr = match[3];\n\n      var dataSource = new $collectionDataSource({\n        scope: $scope,\n        transcludeFn: $transclude,\n        transcludeParent: $element.parent(),\n        keyExpr: keyExpr,\n        listExpr: listExpr,\n        trackByExpr: trackByExpr,\n        heightGetter: heightGetter,\n        widthGetter: widthGetter\n      });\n      var collectionRepeatManager = new $collectionRepeatManager({\n        dataSource: dataSource,\n        element: scrollCtrl.$element,\n        scrollView: scrollCtrl.scrollView,\n      });\n\n      $scope.$watchCollection(listExpr, function(value) {\n        if (value && !angular.isArray(value)) {\n          throw new Error(\"collection-repeat expects an array to repeat over, but instead got '\" + typeof value + \"'.\");\n        }\n        rerender(value);\n      });\n\n      // Find every sibling before and after the repeated items, and pass them\n      // to the dataSource\n      var scrollViewContent = scrollCtrl.scrollView.__content;\n      function rerender(value) {\n        var beforeSiblings = [];\n        var afterSiblings = [];\n        var before = true;\n\n        forEach(scrollViewContent.children, function(node, i) {\n          if ( ionic.DomUtil.elementIsDescendant($element[0], node, scrollViewContent) ) {\n            before = false;\n          } else {\n            if (node.hasAttribute('collection-repeat-ignore')) return;\n            var width = node.offsetWidth;\n            var height = node.offsetHeight;\n            if (width && height) {\n              var element = jqLite(node);\n              (before ? beforeSiblings : afterSiblings).push({\n                width: node.offsetWidth,\n                height: node.offsetHeight,\n                element: element,\n                scope: element.isolateScope() || element.scope(),\n                isOutside: true\n              });\n            }\n          }\n        });\n\n        scrollView.resize();\n        dataSource.setData(value, beforeSiblings, afterSiblings);\n        collectionRepeatManager.resize();\n      }\n      function rerenderOnResize() {\n        rerender($scope.$eval(listExpr));\n      }\n\n      scrollCtrl.$element.on('scroll.resize', rerenderOnResize);\n      ionic.on('resize', rerenderOnResize, window);\n\n      $scope.$on('$destroy', function() {\n        collectionRepeatManager.destroy();\n        dataSource.destroy();\n        ionic.off('resize', rerenderOnResize, window);\n      });\n    }\n  };\n}])\n.directive({\n  ngSrc: collectionRepeatSrcDirective('ngSrc', 'src'),\n  ngSrcset: collectionRepeatSrcDirective('ngSrcset', 'srcset'),\n  ngHref: collectionRepeatSrcDirective('ngHref', 'href')\n});\n\n// Fix for #1674\n// Problem: if an ngSrc or ngHref expression evaluates to a falsy value, it will\n// not erase the previous truthy value of the href.\n// In collectionRepeat, we re-use elements from before. So if the ngHref expression\n// evaluates to truthy for item 1 and then falsy for item 2, if an element changes\n// from representing item 1 to representing item 2, item 2 will still have\n// item 1's href value.\n// Solution:  erase the href or src attribute if ngHref/ngSrc are falsy.\nfunction collectionRepeatSrcDirective(ngAttrName, attrName) {\n  return [function() {\n    return {\n      priority: '99', // it needs to run after the attributes are interpolated\n      link: function(scope, element, attr) {\n        attr.$observe(ngAttrName, function(value) {\n          if (!value) {\n            element[0].removeAttribute(attrName);\n          }\n        });\n      }\n    };\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ionContent\n * @module ionic\n * @delegate ionic.service:$ionicScrollDelegate\n * @restrict E\n *\n * @description\n * The ionContent directive provides an easy to use content area that can be configured\n * to use Ionic's custom Scroll View, or the built in overflow scrolling of the browser.\n *\n * While we recommend using the custom Scroll features in Ionic in most cases, sometimes\n * (for performance reasons) only the browser's native overflow scrolling will suffice,\n * and so we've made it easy to toggle between the Ionic scroll implementation and\n * overflow scrolling.\n *\n * You can implement pull-to-refresh with the {@link ionic.directive:ionRefresher}\n * directive, and infinite scrolling with the {@link ionic.directive:ionInfiniteScroll}\n * directive.\n *\n * Be aware that this directive gets its own child scope. If you do not understand why this\n * is important, you can read [https://docs.angularjs.org/guide/scope](https://docs.angularjs.org/guide/scope).\n *\n * @param {string=} delegate-handle The handle used to identify this scrollView\n * with {@link ionic.service:$ionicScrollDelegate}.\n * @param {string=} direction Which way to scroll. 'x' or 'y' or 'xy'. Default 'y'.\n * @param {boolean=} locking Whether to lock scrolling in one direction at a time. Useful to set to false when zoomed in or scrolling in two directions. Default true.\n * @param {boolean=} padding Whether to add padding to the content.\n * of the content.  Defaults to true on iOS, false on Android.\n * @param {boolean=} scroll Whether to allow scrolling of content.  Defaults to true.\n * @param {boolean=} overflow-scroll Whether to use overflow-scrolling instead of\n * Ionic scroll.\n * @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.\n * @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.\n * @param {string=} start-y Initial vertical scroll position. Default 0.\n * of the content.  Defaults to true on iOS, false on Android.\n * @param {expression=} on-scroll Expression to evaluate when the content is scrolled.\n * @param {expression=} on-scroll-complete Expression to evaluate when a scroll action completes.\n * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges\n * of the content.  Defaults to true on iOS, false on Android.\n */\nIonicModule\n.directive('ionContent', [\n  '$timeout',\n  '$controller',\n  '$ionicBind',\nfunction($timeout, $controller, $ionicBind) {\n  return {\n    restrict: 'E',\n    require: '^?ionNavView',\n    scope: true,\n    priority: 800,\n    compile: function(element, attr) {\n      var innerElement;\n\n      element.addClass('scroll-content ionic-scroll');\n\n      if (attr.scroll != 'false') {\n        //We cannot use normal transclude here because it breaks element.data()\n        //inheritance on compile\n        innerElement = jqLite('<div class=\"scroll\"></div>');\n        innerElement.append(element.contents());\n        element.append(innerElement);\n      } else {\n        element.addClass('scroll-content-false');\n      }\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, navViewCtrl) {\n        var parentScope = $scope.$parent;\n        $scope.$watch(function() {\n          return (parentScope.$hasHeader ? ' has-header' : '')  +\n            (parentScope.$hasSubheader ? ' has-subheader' : '') +\n            (parentScope.$hasFooter ? ' has-footer' : '') +\n            (parentScope.$hasSubfooter ? ' has-subfooter' : '') +\n            (parentScope.$hasTabs ? ' has-tabs' : '') +\n            (parentScope.$hasTabsTop ? ' has-tabs-top' : '');\n        }, function(className, oldClassName) {\n          $element.removeClass(oldClassName);\n          $element.addClass(className);\n        });\n\n        //Only this ionContent should use these variables from parent scopes\n        $scope.$hasHeader = $scope.$hasSubheader =\n          $scope.$hasFooter = $scope.$hasSubfooter =\n          $scope.$hasTabs = $scope.$hasTabsTop =\n          false;\n        $ionicBind($scope, $attr, {\n          $onScroll: '&onScroll',\n          $onScrollComplete: '&onScrollComplete',\n          hasBouncing: '@',\n          padding: '@',\n          direction: '@',\n          scrollbarX: '@',\n          scrollbarY: '@',\n          startX: '@',\n          startY: '@',\n          scrollEventInterval: '@'\n        });\n        $scope.direction = $scope.direction || 'y';\n\n        if (angular.isDefined($attr.padding)) {\n          $scope.$watch($attr.padding, function(newVal) {\n              (innerElement || $element).toggleClass('padding', !!newVal);\n          });\n        }\n\n        if ($attr.scroll === \"false\") {\n          //do nothing\n        } else if(attr.overflowScroll === \"true\") {\n          $element.addClass('overflow-scroll');\n        } else {\n          var scrollViewOptions = {\n            el: $element[0],\n            delegateHandle: attr.delegateHandle,\n            locking: (attr.locking || 'true') === 'true',\n            bouncing: $scope.$eval($scope.hasBouncing),\n            startX: $scope.$eval($scope.startX) || 0,\n            startY: $scope.$eval($scope.startY) || 0,\n            scrollbarX: $scope.$eval($scope.scrollbarX) !== false,\n            scrollbarY: $scope.$eval($scope.scrollbarY) !== false,\n            scrollingX: $scope.direction.indexOf('x') >= 0,\n            scrollingY: $scope.direction.indexOf('y') >= 0,\n            scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 10,\n            scrollingComplete: function() {\n              $scope.$onScrollComplete({\n                scrollTop: this.__scrollTop,\n                scrollLeft: this.__scrollLeft\n              });\n            }\n          };\n          $controller('$ionicScroll', {\n            $scope: $scope,\n            scrollViewOptions: scrollViewOptions\n          });\n\n          $scope.$on('$destroy', function() {\n            scrollViewOptions.scrollingComplete = angular.noop;\n            delete scrollViewOptions.el;\n            innerElement = null;\n            $element = null;\n            attr.$$element = null;\n          });\n        }\n\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name exposeAsideWhen\n * @module ionic\n * @restrict A\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * It is common for a tablet application to hide a menu when in portrait mode, but to show the\n * same menu on the left side when the tablet is in landscape mode. The `exposeAsideWhen` attribute\n * directive can be used to accomplish a similar interface.\n *\n * By default, side menus are hidden underneath its side menu content, and can be opened by either\n * swiping the content left or right, or toggling a button to show the side menu. However, by adding the\n * `exposeAsideWhen` attribute directive to an {@link ionic.directive:ionSideMenu} element directive,\n * a side menu can be given instructions on \"when\" the menu should be exposed (always viewable). For\n * example, the `expose-aside-when=\"large\"` attribute will keep the side menu hidden when the viewport's\n * width is less than `768px`, but when the viewport's width is `768px` or greater, the menu will then\n * always be shown and can no longer be opened or closed like it could when it was hidden for smaller\n * viewports.\n *\n * Using `large` as the attribute's value is a shortcut value to `(min-width:768px)` since it is\n * the most common use-case. However, for added flexibility, any valid media query could be added\n * as the value, such as `(min-width:600px)` or even multiple queries such as\n * `(min-width:750px) and (max-width:1200px)`.\n\n * @usage\n * ```html\n * <ion-side-menus>\n *   <!-- Center content -->\n *   <ion-side-menu-content>\n *   </ion-side-menu-content>\n *\n *   <!-- Left menu -->\n *   <ion-side-menu expose-aside-when=\"large\">\n *   </ion-side-menu>\n * </ion-side-menus>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n */\nIonicModule\n.directive('exposeAsideWhen', ['$window', function($window) {\n  return {\n    restrict: 'A',\n    require: '^ionSideMenus',\n    link: function($scope, $element, $attr, sideMenuCtrl) {\n\n      function checkAsideExpose() {\n        var mq = $attr.exposeAsideWhen == 'large' ? '(min-width:768px)' : $attr.exposeAsideWhen;\n        sideMenuCtrl.exposeAside( $window.matchMedia(mq).matches );\n        sideMenuCtrl.activeAsideResizing(false);\n      }\n\n      function onResize() {\n        sideMenuCtrl.activeAsideResizing(true);\n        debouncedCheck();\n      }\n\n      var debouncedCheck = ionic.debounce(function() {\n        $scope.$apply(function(){\n          checkAsideExpose();\n        });\n      }, 300, false);\n\n      checkAsideExpose();\n\n      ionic.on('resize', onResize, $window);\n\n      $scope.$on('$destroy', function(){\n        ionic.off('resize', onResize, $window);\n      });\n\n    }\n  };\n}]);\n\n\nvar GESTURE_DIRECTIVES = 'onHold onTap onTouch onRelease onDrag onDragUp onDragRight onDragDown onDragLeft onSwipe onSwipeUp onSwipeRight onSwipeDown onSwipeLeft'.split(' ');\n\nGESTURE_DIRECTIVES.forEach(function(name) {\n  IonicModule.directive(name, gestureDirective(name));\n});\n\n\n/**\n * @ngdoc directive\n * @name onHold\n * @module ionic\n * @restrict A\n *\n * @description\n * Touch stays at the same location for 500ms.\n *\n * @usage\n * ```html\n * <button on-hold=\"onHold()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onTap\n * @module ionic\n * @restrict A\n *\n * @description\n * Quick touch at a location. If the duration of the touch goes\n * longer than 250ms it is no longer a tap gesture.\n *\n * @usage\n * ```html\n * <button on-tap=\"onTap()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onTouch\n * @module ionic\n * @restrict A\n *\n * @description\n * Called immediately when the user first begins a touch. This\n * gesture does not wait for a touchend/mouseup.\n *\n * @usage\n * ```html\n * <button on-touch=\"onTouch()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onRelease\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the user ends a touch.\n *\n * @usage\n * ```html\n * <button on-release=\"onRelease()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDrag\n * @module ionic\n * @restrict A\n *\n * @description\n * Move with one touch around on the page. Blocking the scrolling when\n * moving left and right is a good practice. When all the drag events are\n * blocking you disable scrolling on that area.\n *\n * @usage\n * ```html\n * <button on-drag=\"onDrag()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragUp\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged up.\n *\n * @usage\n * ```html\n * <button on-drag-up=\"onDragUp()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragRight\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged to the right.\n *\n * @usage\n * ```html\n * <button on-drag-right=\"onDragRight()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragDown\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged down.\n *\n * @usage\n * ```html\n * <button on-drag-down=\"onDragDown()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragLeft\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged to the left.\n *\n * @usage\n * ```html\n * <button on-drag-left=\"onDragLeft()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipe\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity in any direction.\n *\n * @usage\n * ```html\n * <button on-swipe=\"onSwipe()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeUp\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving up.\n *\n * @usage\n * ```html\n * <button on-swipe-up=\"onSwipeUp()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeRight\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving to the right.\n *\n * @usage\n * ```html\n * <button on-swipe-right=\"onSwipeRight()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeDown\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving down.\n *\n * @usage\n * ```html\n * <button on-swipe-down=\"onSwipeDown()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeLeft\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving to the left.\n *\n * @usage\n * ```html\n * <button on-swipe-left=\"onSwipeLeft()\" class=\"button\">Test</button>\n * ```\n */\n\n\nfunction gestureDirective(directiveName) {\n  return ['$ionicGesture', '$parse', function($ionicGesture, $parse) {\n    var eventType = directiveName.substr(2).toLowerCase();\n\n    return function(scope, element, attr) {\n      var fn = $parse( attr[directiveName] );\n\n      var listener = function(ev) {\n        scope.$apply(function() {\n          fn(scope, {\n            $event: ev\n          });\n        });\n      };\n\n      var gesture = $ionicGesture.on(eventType, listener, element);\n\n      scope.$on('$destroy', function() {\n        $ionicGesture.off(gesture, eventType, listener);\n      });\n    };\n  }];\n}\n\n\nIonicModule\n.directive('ionNavBar', tapScrollToTopDirective())\n.directive('ionHeaderBar', tapScrollToTopDirective())\n\n/**\n * @ngdoc directive\n * @name ionHeaderBar\n * @module ionic\n * @restrict E\n *\n * @description\n * Adds a fixed header bar above some content.\n *\n * Can also be a subheader (lower down) if the 'bar-subheader' class is applied.\n * See [the header CSS docs](/docs/components/#subheader).\n *\n * Note: If you use ionHeaderBar in combination with ng-if, the surrounding content\n * will not align correctly.  This will be fixed soon.\n *\n * @param {string=} align-title Where to align the title. \n * Available: 'left', 'right', or 'center'.  Defaults to 'center'.\n * @param {boolean=} no-tap-scroll By default, the header bar will scroll the\n * content to the top when tapped.  Set no-tap-scroll to true to disable this \n * behavior.\n * Available: true or false.  Defaults to false.\n *\n * @usage\n * ```html\n * <ion-header-bar align-title=\"left\" class=\"bar-positive\">\n *   <div class=\"buttons\">\n *     <button class=\"button\" ng-click=\"doSomething()\">Left Button</button>\n *   </div>\n *   <h1 class=\"title\">Title!</h1>\n *   <div class=\"buttons\">\n *     <button class=\"button\">Right Button</button>\n *   </div>\n * </ion-header-bar>\n * <ion-content>\n *   Some content!\n * </ion-content>\n * ```\n */\n.directive('ionHeaderBar', headerFooterBarDirective(true))\n\n/**\n * @ngdoc directive\n * @name ionFooterBar\n * @module ionic\n * @restrict E\n *\n * @description\n * Adds a fixed footer bar below some content.\n *\n * Can also be a subfooter (higher up) if the 'bar-subfooter' class is applied.\n * See [the footer CSS docs](/docs/components/#footer).\n *\n * Note: If you use ionFooterBar in combination with ng-if, the surrounding content\n * will not align correctly.  This will be fixed soon.\n *\n * @param {string=} align-title Where to align the title.\n * Available: 'left', 'right', or 'center'.  Defaults to 'center'.\n *\n * @usage\n * ```html\n * <ion-content>\n *   Some content!\n * </ion-content>\n * <ion-footer-bar align-title=\"left\" class=\"bar-assertive\">\n *   <div class=\"buttons\">\n *     <button class=\"button\">Left Button</button>\n *   </div>\n *   <h1 class=\"title\">Title!</h1>\n *   <div class=\"buttons\" ng-click=\"doSomething()\">\n *     <button class=\"button\">Right Button</button>\n *   </div>\n * </ion-footer-bar>\n * ```\n */\n.directive('ionFooterBar', headerFooterBarDirective(false));\n\nfunction tapScrollToTopDirective() {\n  return ['$ionicScrollDelegate', function($ionicScrollDelegate) {\n    return {\n      restrict: 'E',\n      link: function($scope, $element, $attr) {\n        if ($attr.noTapScroll == 'true') {\n          return;\n        }\n        ionic.on('tap', onTap, $element[0]);\n        $scope.$on('$destroy', function() {\n          ionic.off('tap', onTap, $element[0]);\n        });\n\n        function onTap(e) {\n          var depth = 3;\n          var current = e.target;\n          //Don't scroll to top in certain cases\n          while (depth-- && current) {\n            if (current.classList.contains('button') ||\n                current.tagName.match(/input|textarea|select/i) ||\n                current.isContentEditable) {\n              return;\n            }\n            current = current.parentNode;\n          }\n          var touch = e.gesture && e.gesture.touches[0] || e.detail.touches[0];\n          var bounds = $element[0].getBoundingClientRect();\n          if (ionic.DomUtil.rectContains(\n            touch.pageX, touch.pageY,\n            bounds.left, bounds.top - 20,\n            bounds.left + bounds.width, bounds.top + bounds.height\n          )) {\n            $ionicScrollDelegate.scrollTop(true);\n          }\n        }\n      }\n    };\n  }];\n}\n\nfunction headerFooterBarDirective(isHeader) {\n  return [function() {\n    return {\n      restrict: 'E',\n      compile: function($element, $attr) {\n        $element.addClass(isHeader ? 'bar bar-header' : 'bar bar-footer');\n        var parent = $element[0].parentNode;\n        if(parent.querySelector('.tabs-top'))$element.addClass('has-tabs-top');\n        return { pre: prelink };\n        function prelink($scope, $element, $attr) {\n          var hb = new ionic.views.HeaderBar({\n            el: $element[0],\n            alignTitle: $attr.alignTitle || 'center'\n          });\n\n          var el = $element[0];\n\n          if (isHeader) {\n            $scope.$watch(function() { return el.className; }, function(value) {\n              var isShown = value.indexOf('ng-hide') === -1;\n              var isSubheader = value.indexOf('bar-subheader') !== -1;\n              $scope.$hasHeader = isShown && !isSubheader;\n              $scope.$hasSubheader = isShown && isSubheader;\n            });\n            $scope.$on('$destroy', function() {\n              delete $scope.$hasHeader;\n              delete $scope.$hasSubheader;\n            });\n          } else {\n            $scope.$watch(function() { return el.className; }, function(value) {\n              var isShown = value.indexOf('ng-hide') === -1;\n              var isSubfooter = value.indexOf('bar-subfooter') !== -1;\n              $scope.$hasFooter = isShown && !isSubfooter;\n              $scope.$hasSubfooter = isShown && isSubfooter;\n            });\n            $scope.$on('$destroy', function() {\n              delete $scope.$hasFooter;\n              delete $scope.$hasSubfooter;\n            });\n            $scope.$watch('$hasTabs', function(val) {\n              $element.toggleClass('has-tabs', !!val);\n            });\n          }\n        }\n      }\n    };\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ionInfiniteScroll\n * @module ionic\n * @parent ionic.directive:ionContent, ionic.directive:ionScroll\n * @restrict E\n *\n * @description\n * The ionInfiniteScroll directive allows you to call a function whenever\n * the user gets to the bottom of the page or near the bottom of the page.\n *\n * The expression you pass in for `on-infinite` is called when the user scrolls\n * greater than `distance` away from the bottom of the content.  Once `on-infinite`\n * is done loading new data, it should broadcast the `scroll.infiniteScrollComplete`\n * event from your controller (see below example).\n *\n * @param {expression} on-infinite What to call when the scroller reaches the\n * bottom.\n * @param {string=} distance The distance from the bottom that the scroll must\n * reach to trigger the on-infinite expression. Default: 1%.\n * @param {string=} icon The icon to show while loading. Default: 'ion-loading-d'.\n *\n * @usage\n * ```html\n * <ion-content ng-controller=\"MyController\">\n *   <ion-list>\n *   ....\n *   ....\n *   </ion-list>\n *\n *   <ion-infinite-scroll\n *     on-infinite=\"loadMore()\"\n *     distance=\"1%\">\n *   </ion-infinite-scroll>\n * </ion-content>\n * ```\n * ```js\n * function MyController($scope, $http) {\n *   $scope.items = [];\n *   $scope.loadMore = function() {\n *     $http.get('/more-items').success(function(items) {\n *       useItems(items);\n *       $scope.$broadcast('scroll.infiniteScrollComplete');\n *     });\n *   };\n *\n *   $scope.$on('stateChangeSuccess', function() {\n *     $scope.loadMore();\n *   });\n * }\n * ```\n *\n * An easy to way to stop infinite scroll once there is no more data to load\n * is to use angular's `ng-if` directive:\n *\n * ```html\n * <ion-infinite-scroll\n *   ng-if=\"moreDataCanBeLoaded()\"\n *   icon=\"ion-loading-c\"\n *   on-infinite=\"loadMoreData()\">\n * </ion-infinite-scroll>\n * ```\n */\nIonicModule\n.directive('ionInfiniteScroll', ['$timeout', function($timeout) {\n  function calculateMaxValue(distance, maximum, isPercent) {\n    return isPercent ?\n      maximum * (1 - parseFloat(distance,10) / 100) :\n      maximum - parseFloat(distance, 10);\n  }\n  return {\n    restrict: 'E',\n    require: ['^$ionicScroll', 'ionInfiniteScroll'],\n    template: '<i class=\"icon {{icon()}} icon-refreshing\"></i>',\n    scope: true,\n    controller: ['$scope', '$attrs', function($scope, $attrs) {\n      this.isLoading = false;\n      this.scrollView = null; //given by link function\n      this.getMaxScroll = function() {\n        var distance = ($attrs.distance || '2.5%').trim();\n        var isPercent = distance.indexOf('%') !== -1;\n        var maxValues = this.scrollView.getScrollMax();\n        return {\n          left: this.scrollView.options.scrollingX ?\n            calculateMaxValue(distance, maxValues.left, isPercent) :\n            -1,\n          top: this.scrollView.options.scrollingY ?\n            calculateMaxValue(distance, maxValues.top, isPercent) :\n            -1\n        };\n      };\n    }],\n    link: function($scope, $element, $attrs, ctrls) {\n      var scrollCtrl = ctrls[0];\n      var infiniteScrollCtrl = ctrls[1];\n      var scrollView = infiniteScrollCtrl.scrollView = scrollCtrl.scrollView;\n\n      $scope.icon = function() {\n        return angular.isDefined($attrs.icon) ? $attrs.icon : 'ion-loading-d';\n      };\n\n      var onInfinite = function() {\n        $element[0].classList.add('active');\n        infiniteScrollCtrl.isLoading = true;\n        $scope.$parent && $scope.$parent.$apply($attrs.onInfinite || '');\n      };\n\n      var finishInfiniteScroll = function() {\n        $element[0].classList.remove('active');\n        $timeout(function() {\n          scrollView.resize();\n          checkBounds();\n        }, 0, false);\n        infiniteScrollCtrl.isLoading = false;\n      };\n\n      $scope.$on('scroll.infiniteScrollComplete', function() {\n        finishInfiniteScroll();\n      });\n\n      $scope.$on('$destroy', function() {\n        scrollCtrl.$element.off('scroll', checkBounds);\n      });\n\n      var checkBounds = ionic.animationFrameThrottle(checkInfiniteBounds);\n\n      //Check bounds on start, after scrollView is fully rendered\n      setTimeout(checkBounds);\n      scrollCtrl.$element.on('scroll', checkBounds);\n\n      function checkInfiniteBounds() {\n        if (infiniteScrollCtrl.isLoading) return;\n\n        var scrollValues = scrollView.getValues();\n        var maxScroll = infiniteScrollCtrl.getMaxScroll();\n\n        if ((maxScroll.left !== -1 && scrollValues.left >= maxScroll.left) ||\n            (maxScroll.top !== -1 && scrollValues.top >= maxScroll.top)) {\n          onInfinite();\n        }\n      }\n    }\n  };\n}]);\n\nvar ITEM_TPL_CONTENT_ANCHOR =\n  '<a class=\"item-content\" ng-href=\"{{$href()}}\" target=\"{{$target()}}\"></a>';\nvar ITEM_TPL_CONTENT =\n  '<div class=\"item-content\"></div>';\n/**\n* @ngdoc directive\n* @name ionItem\n* @parent ionic.directive:ionList\n* @module ionic\n* @restrict E\n* Creates a list-item that can easily be swiped,\n* deleted, reordered, edited, and more.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* Can be assigned any item class name. See the\n* [list CSS documentation](/docs/components/#list).\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-item>Hello!</ion-item>\n*   <ion-item href=\"#/detail\">\n*     Link to detail page\n*   <ion-item>\n* </ion-list>\n* ```\n*/\nIonicModule\n.directive('ionItem', [\n  '$animate',\n  '$compile',\nfunction($animate, $compile) {\n  return {\n    restrict: 'E',\n    controller: ['$scope', '$element', function($scope, $element) {\n      this.$scope = $scope;\n      this.$element = $element;\n    }],\n    scope: true,\n    compile: function($element, $attrs) {\n      var isAnchor = angular.isDefined($attrs.href) ||\n        angular.isDefined($attrs.ngHref) ||\n        angular.isDefined($attrs.uiSref);\n      var isComplexItem = isAnchor ||\n        //Lame way of testing, but we have to know at compile what to do with the element\n        /ion-(delete|option|reorder)-button/i.test($element.html());\n\n        if (isComplexItem) {\n          var innerElement = jqLite(isAnchor ? ITEM_TPL_CONTENT_ANCHOR : ITEM_TPL_CONTENT);\n          innerElement.append($element.contents());\n\n          $element.append(innerElement);\n          $element.addClass('item item-complex');\n        } else {\n          $element.addClass('item');\n        }\n\n        return function link($scope, $element, $attrs) {\n          $scope.$href = function() {\n            return $attrs.href || $attrs.ngHref;\n          };\n          $scope.$target = function() {\n            return $attrs.target || '_self';\n          };\n        };\n    }\n  };\n}]);\n\nvar ITEM_TPL_DELETE_BUTTON =\n  '<div class=\"item-left-edit item-delete enable-pointer-events\">' +\n  '</div>';\n/**\n* @ngdoc directive\n* @name ionDeleteButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates a delete button inside a list item, that is visible when the\n* {@link ionic.directive:ionList ionList parent's} `show-delete` evaluates to true or\n* `$ionicListDelegate.showDelete(true)` is called.\n*\n* Takes any ionicon as a class.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* @usage\n*\n* ```html\n* <ion-list show-delete=\"shouldShowDelete\">\n*   <ion-item>\n*     <ion-delete-button class=\"ion-minus-circled\"></ion-delete-button>\n*     Hello, list item!\n*   </ion-item>\n* </ion-list>\n* <ion-toggle ng-model=\"shouldShowDelete\">\n*   Show Delete?\n* </ion-toggle>\n* ```\n*/\nIonicModule\n.directive('ionDeleteButton', ['$animate', function($animate) {\n  return {\n    restrict: 'E',\n    require: ['^ionItem', '^?ionList'],\n    //Run before anything else, so we can move it before other directives process\n    //its location (eg ngIf relies on the location of the directive in the dom)\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      //Add the classes we need during the compile phase, so that they stay\n      //even if something else like ngIf removes the element and re-addss it\n      $attr.$set('class', ($attr['class'] || '') + ' button icon button-icon', true);\n      return function($scope, $element, $attr, ctrls) {\n        var itemCtrl = ctrls[0];\n        var listCtrl = ctrls[1];\n        var container = jqLite(ITEM_TPL_DELETE_BUTTON);\n        container.append($element);\n        itemCtrl.$element.append(container).addClass('item-left-editable');\n\n        if (listCtrl && listCtrl.showDelete()) {\n          container.addClass('visible active');\n        }\n      };\n    }\n  };\n}]);\n\n\nIonicModule\n.directive('itemFloatingLabel', function() {\n  return {\n    restrict: 'C',\n    link: function(scope, element) {\n      var el = element[0];\n      var input = el.querySelector('input, textarea');\n      var inputLabel = el.querySelector('.input-label');\n\n      if ( !input || !inputLabel ) return;\n\n      var onInput = function() {\n        if ( input.value ) {\n          inputLabel.classList.add('has-input');\n        } else {\n          inputLabel.classList.remove('has-input');\n        }\n      };\n\n      input.addEventListener('input', onInput);\n\n      var ngModelCtrl = angular.element(input).controller('ngModel');\n      if ( ngModelCtrl ) {\n        ngModelCtrl.$render = function() {\n          input.value = ngModelCtrl.$viewValue || '';\n          onInput();\n        };\n      }\n\n      scope.$on('$destroy', function() {\n        input.removeEventListener('input', onInput);\n      });\n    }\n  };\n});\n\nvar ITEM_TPL_OPTION_BUTTONS =\n  '<div class=\"item-options invisible\">' +\n  '</div>';\n/**\n* @ngdoc directive\n* @name ionOptionButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates an option button inside a list item, that is visible when the item is swiped\n* to the left by the user.  Swiped open option buttons can be hidden with\n* {@link ionic.service:$ionicListDelegate#closeOptionButtons $ionicListDelegate#closeOptionButtons}.\n*\n* Can be assigned any button class.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-item>\n*     I love kittens!\n*     <ion-option-button class=\"button-positive\">Share</ion-option-button>\n*     <ion-option-button class=\"button-assertive\">Edit</ion-option-button>\n*   </ion-item>\n* </ion-list>\n* ```\n*/\nIonicModule\n.directive('ionOptionButton', ['$compile', function($compile) {\n  function stopPropagation(e) {\n    e.stopPropagation();\n  }\n  return {\n    restrict: 'E',\n    require: '^ionItem',\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      $attr.$set('class', ($attr['class'] || '') + ' button', true);\n      return function($scope, $element, $attr, itemCtrl) {\n        if (!itemCtrl.optionsContainer) {\n          itemCtrl.optionsContainer = jqLite(ITEM_TPL_OPTION_BUTTONS);\n          itemCtrl.$element.append(itemCtrl.optionsContainer);\n        }\n        itemCtrl.optionsContainer.append($element);\n\n        //Don't bubble click up to main .item\n        $element.on('click', stopPropagation);\n      };\n    }\n  };\n}]);\n\nvar ITEM_TPL_REORDER_BUTTON =\n  '<div data-prevent-scroll=\"true\" class=\"item-right-edit item-reorder enable-pointer-events\">' +\n  '</div>';\n\n/**\n* @ngdoc directive\n* @name ionReorderButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates a reorder button inside a list item, that is visible when the\n* {@link ionic.directive:ionList ionList parent's} `show-reorder` evaluates to true or\n* `$ionicListDelegate.showReorder(true)` is called.\n*\n* Can be dragged to reorder items in the list. Takes any ionicon class.\n*\n* Note: Reordering works best when used with `ng-repeat`.  Be sure that all `ion-item` children of an `ion-list` are part of the same `ng-repeat` expression.\n*\n* When an item reorder is complete, the expression given in the `on-reorder` attribute is called. The `on-reorder` expression is given two locals that can be used: `$fromIndex` and `$toIndex`.  See below for an example.\n*\n* Look at {@link ionic.directive:ionList} for more examples.\n*\n* @usage\n*\n* ```html\n* <ion-list ng-controller=\"MyCtrl\" show-reorder=\"true\">\n*   <ion-item ng-repeat=\"item in items\">\n*     Item {{item}}\n*     <ion-reorder-button class=\"ion-navicon\"\n*                         on-reorder=\"moveItem(item, $fromIndex, $toIndex)\">\n*     </ion-reorder-button>\n*   </ion-item>\n* </ion-list>\n* ```\n* ```js\n* function MyCtrl($scope) {\n*   $scope.items = [1, 2, 3, 4];\n*   $scope.moveItem = function(item, fromIndex, toIndex) {\n*     //Move the item in the array\n*     $scope.items.splice(fromIndex, 1);\n*     $scope.items.splice(toIndex, 0, item);\n*   };\n* }\n* ```\n*\n* @param {expression=} on-reorder Expression to call when an item is reordered.\n* Parameters given: $fromIndex, $toIndex.\n*/\nIonicModule\n.directive('ionReorderButton', ['$animate', '$parse', function($animate, $parse) {\n  return {\n    restrict: 'E',\n    require: ['^ionItem', '^?ionList'],\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      $attr.$set('class', ($attr['class'] || '') + ' button icon button-icon', true);\n      $element[0].setAttribute('data-prevent-scroll', true);\n      return function($scope, $element, $attr, ctrls) {\n        var itemCtrl = ctrls[0];\n        var listCtrl = ctrls[1];\n        var onReorderFn = $parse($attr.onReorder);\n\n        $scope.$onReorder = function(oldIndex, newIndex) {\n          onReorderFn($scope, {\n            $fromIndex: oldIndex,\n            $toIndex: newIndex\n          });\n        };\n\n        // prevent clicks from bubbling up to the item\n        if(!$attr.ngClick && !$attr.onClick && !$attr.onclick){\n          $element[0].onclick = function(e){e.stopPropagation(); return false;};\n        }\n\n        var container = jqLite(ITEM_TPL_REORDER_BUTTON);\n        container.append($element);\n        itemCtrl.$element.append(container).addClass('item-right-editable');\n\n        if (listCtrl && listCtrl.showReorder()) {\n          container.addClass('visible active');\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name keyboardAttach\n * @module ionic\n * @restrict A\n *\n * @description\n * keyboard-attach is an attribute directive which will cause an element to float above\n * the keyboard when the keyboard shows. Currently only supports the\n * [ion-footer-bar]({{ page.versionHref }}/api/directive/ionFooterBar/) directive.\n *\n * ### Notes\n * - This directive requires the\n * [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard).\n * - On Android not in fullscreen mode, i.e. you have\n *   `<preference name=\"Fullscreen\" value=\"false\" />` or no preference in your `config.xml` file,\n *   this directive is unnecessary since it is the default behavior.\n * - On iOS, if there is an input in your footer, you will need to set\n *   `cordova.plugins.Keyboard.disableScroll(true)`.\n *\n * @usage\n *\n * ```html\n *  <ion-footer-bar align-title=\"left\" keyboard-attach class=\"bar-assertive\">\n *    <h1 class=\"title\">Title!</h1>\n *  </ion-footer-bar>\n * ```\n */\n\nIonicModule\n.directive('keyboardAttach', function() {\n  return function(scope, element, attrs) {\n    ionic.on('native.keyboardshow', onShow, window);\n    ionic.on('native.keyboardhide', onHide, window);\n\n    //deprecated\n    ionic.on('native.showkeyboard', onShow, window);\n    ionic.on('native.hidekeyboard', onHide, window);\n\n\n    var scrollCtrl;\n\n    function onShow(e) {\n      if (ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen) {\n        return;\n      }\n\n      //for testing\n      var keyboardHeight = e.keyboardHeight || e.detail.keyboardHeight;\n      element.css('bottom', keyboardHeight + \"px\");\n      scrollCtrl = element.controller('$ionicScroll');\n      if ( scrollCtrl ) {\n        scrollCtrl.scrollView.__container.style.bottom = keyboardHeight + keyboardAttachGetClientHeight(element[0]) + \"px\";\n      }\n    }\n\n    function onHide() {\n      if (ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen) {\n        return;\n      }\n\n      element.css('bottom', '');\n      if ( scrollCtrl ) {\n        scrollCtrl.scrollView.__container.style.bottom = '';\n      }\n    }\n\n    scope.$on('$destroy', function() {\n      ionic.off('native.keyboardshow', onShow, window);\n      ionic.off('native.keyboardhide', onHide, window);\n\n      //deprecated\n      ionic.off('native.showkeyboard', onShow, window);\n      ionic.off('native.hidekeyboard', onHide, window);\n    });\n  };\n});\n\nfunction keyboardAttachGetClientHeight(element) {\n  return element.clientHeight;\n}\n\n/**\n* @ngdoc directive\n* @name ionList\n* @module ionic\n* @delegate ionic.service:$ionicListDelegate\n* @codepen JsHjf\n* @restrict E\n* @description\n* The List is a widely used interface element in almost any mobile app, and can include\n* content ranging from basic text all the way to buttons, toggles, icons, and thumbnails.\n*\n* Both the list, which contains items, and the list items themselves can be any HTML\n* element. The containing element requires the `list` class and each list item requires\n* the `item` class.\n*\n* However, using the ionList and ionItem directives make it easy to support various\n* interaction modes such as swipe to edit, drag to reorder, and removing items.\n*\n* Related: {@link ionic.directive:ionItem}, {@link ionic.directive:ionOptionButton}\n* {@link ionic.directive:ionReorderButton}, {@link ionic.directive:ionDeleteButton}, [`list CSS documentation`](/docs/components/#list).\n*\n* @usage\n*\n* Basic Usage:\n*\n* ```html\n* <ion-list>\n*   <ion-item ng-repeat=\"item in items\">\n*     {% raw %}Hello, {{item}}!{% endraw %}\n*   </ion-item>\n* </ion-list>\n* ```\n*\n* Advanced Usage: Thumbnails, Delete buttons, Reordering, Swiping\n*\n* ```html\n* <ion-list ng-controller=\"MyCtrl\"\n*           show-delete=\"shouldShowDelete\"\n*           show-reorder=\"shouldShowReorder\"\n*           can-swipe=\"listCanSwipe\">\n*   <ion-item ng-repeat=\"item in items\"\n*             class=\"item-thumbnail-left\">\n*\n*     {% raw %}<img ng-src=\"{{item.img}}\">\n*     <h2>{{item.title}}</h2>\n*     <p>{{item.description}}</p>{% endraw %}\n*     <ion-option-button class=\"button-positive\"\n*                        ng-click=\"share(item)\">\n*       Share\n*     </ion-option-button>\n*     <ion-option-button class=\"button-info\"\n*                        ng-click=\"edit(item)\">\n*       Edit\n*     </ion-option-button>\n*     <ion-delete-button class=\"ion-minus-circled\"\n*                        ng-click=\"items.splice($index, 1)\">\n*     </ion-delete-button>\n*     <ion-reorder-button class=\"ion-navicon\"\n*                         on-reorder=\"reorderItem(item, $fromIndex, $toIndex)\">\n*     </ion-reorder-button>\n*\n*   </ion-item>\n* </ion-list>\n* ```\n*\n* @param {string=} delegate-handle The handle used to identify this list with\n* {@link ionic.service:$ionicListDelegate}.\n* @param type {string=} The type of list to use (for example, list-inset for an inset list)\n* @param show-delete {boolean=} Whether the delete buttons for the items in the list are\n* currently shown or hidden.\n* @param show-reorder {boolean=} Whether the reorder buttons for the items in the list are\n* currently shown or hidden.\n* @param can-swipe {boolean=} Whether the items in the list are allowed to be swiped to reveal\n* option buttons. Default: true.\n*/\nIonicModule\n.directive('ionList', [\n  '$animate',\n  '$timeout',\nfunction($animate, $timeout) {\n  return {\n    restrict: 'E',\n    require: ['ionList', '^?$ionicScroll'],\n    controller: '$ionicList',\n    compile: function($element, $attr) {\n      var listEl = jqLite('<div class=\"list\">')\n      .append( $element.contents() )\n      .addClass($attr.type);\n      $element.append(listEl);\n\n      return function($scope, $element, $attrs, ctrls) {\n        var listCtrl = ctrls[0];\n        var scrollCtrl = ctrls[1];\n\n        //Wait for child elements to render...\n        $timeout(init);\n\n        function init() {\n          var listView = listCtrl.listView = new ionic.views.ListView({\n            el: $element[0],\n            listEl: $element.children()[0],\n            scrollEl: scrollCtrl && scrollCtrl.element,\n            scrollView: scrollCtrl && scrollCtrl.scrollView,\n            onReorder: function(el, oldIndex, newIndex) {\n              var itemScope = jqLite(el).scope();\n              if (itemScope && itemScope.$onReorder) {\n                //Make sure onReorder is called in apply cycle,\n                //but also make sure it has no conflicts by doing\n                //$evalAsync\n                $timeout(function() {\n                  itemScope.$onReorder(oldIndex, newIndex);\n                });\n              }\n            },\n            canSwipe: function() {\n              return listCtrl.canSwipeItems();\n            }\n          });\n\n          if (isDefined($attr.canSwipe)) {\n            $scope.$watch('!!(' + $attr.canSwipe + ')', function(value) {\n              listCtrl.canSwipeItems(value);\n            });\n          }\n          if (isDefined($attr.showDelete)) {\n            $scope.$watch('!!(' + $attr.showDelete + ')', function(value) {\n              listCtrl.showDelete(value);\n            });\n          }\n          if (isDefined($attr.showReorder)) {\n            $scope.$watch('!!(' + $attr.showReorder + ')', function(value) {\n              listCtrl.showReorder(value);\n            });\n          }\n\n          $scope.$watch(function() {\n            return listCtrl.showDelete();\n          }, function(isShown, wasShown) {\n            //Only use isShown=false if it was already shown\n            if (!isShown && !wasShown) { return; }\n\n            if (isShown) listCtrl.closeOptionButtons();\n            listCtrl.canSwipeItems(!isShown);\n\n            $element.children().toggleClass('list-left-editing', isShown);\n            $element.toggleClass('disable-pointer-events', isShown);\n\n            var deleteButton = jqLite($element[0].getElementsByClassName('item-delete'));\n            setButtonShown(deleteButton, listCtrl.showDelete);\n          });\n\n          $scope.$watch(function() {\n            return listCtrl.showReorder();\n          }, function(isShown, wasShown) {\n            //Only use isShown=false if it was already shown\n            if (!isShown && !wasShown) { return; }\n\n            if (isShown) listCtrl.closeOptionButtons();\n            listCtrl.canSwipeItems(!isShown);\n\n            $element.children().toggleClass('list-right-editing', isShown);\n            $element.toggleClass('disable-pointer-events', isShown);\n\n            var reorderButton = jqLite($element[0].getElementsByClassName('item-reorder'));\n            setButtonShown(reorderButton, listCtrl.showReorder);\n          });\n\n          function setButtonShown(el, shown) {\n            shown() && el.addClass('visible') || el.removeClass('active');\n            ionic.requestAnimationFrame(function() {\n              shown() && el.addClass('active') || el.removeClass('invisible');\n            });\n          }\n        }\n\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name menuClose\n * @module ionic\n * @restrict AC\n *\n * @description\n * Closes a side menu which is currently opened.\n *\n * @usage\n * Below is an example of a link within a side menu. Tapping this link would\n * automatically close the currently opened menu.\n *\n * ```html\n * <a menu-close href=\"#/home\" class=\"item\">Home</a>\n * ```\n */\nIonicModule\n.directive('menuClose', ['$ionicViewService', function($ionicViewService) {\n  return {\n    restrict: 'AC',\n    require: '^ionSideMenus',\n    link: function($scope, $element, $attr, sideMenuCtrl) {\n      $element.bind('click', function(){\n        sideMenuCtrl.close();\n      });\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name menuToggle\n * @module ionic\n * @restrict AC\n *\n * @description\n * Toggle a side menu on the given side\n *\n * @usage\n * Below is an example of a link within a nav bar. Tapping this link would\n * automatically open the given side menu\n *\n * ```html\n * <ion-view>\n *   <ion-nav-buttons side=\"left\">\n *    <button menu-toggle=\"left\" class=\"button button-icon icon ion-navicon\"></button>\n *   </ion-nav-buttons>\n *  ...\n * </ion-view>\n * ```\n */\nIonicModule\n.directive('menuToggle', ['$ionicViewService', function($ionicViewService) {\n  return {\n    restrict: 'AC',\n    require: '^ionSideMenus',\n    link: function($scope, $element, $attr, sideMenuCtrl) {\n      var side = $attr.menuToggle || 'left';\n      $element.bind('click', function(){\n        if(side === 'left') {\n          sideMenuCtrl.toggleLeft();\n        } else if(side === 'right') {\n          sideMenuCtrl.toggleRight();\n        }\n      });\n    }\n  };\n}]);\n\n\n/*\n * We don't document the ionModal directive, we instead document\n * the $ionicModal service\n */\nIonicModule\n.directive('ionModal', [function() {\n  return {\n    restrict: 'E',\n    transclude: true,\n    replace: true,\n    controller: [function(){}],\n    template: '<div class=\"modal-backdrop\">' +\n                '<div class=\"modal-wrapper\" ng-transclude></div>' +\n                '</div>'\n  };\n}]);\n\nIonicModule\n.directive('ionModalView', function() {\n  return {\n    restrict: 'E',\n    compile: function(element, attr) {\n      element.addClass('modal');\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionNavBackButton\n * @module ionic\n * @restrict E\n * @parent ionNavBar\n * @description\n * Creates a back button inside an {@link ionic.directive:ionNavBar}.\n *\n * Will show up when the user is able to go back in the current navigation stack.\n *\n * By default, will go back when clicked.  If you wish for more advanced behavior, see the\n * examples below.\n *\n * @usage\n *\n * With default click action:\n *\n * ```html\n * <ion-nav-bar>\n *   <ion-nav-back-button class=\"button-clear\">\n *     <i class=\"ion-arrow-left-c\"></i> Back\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n *\n * With custom click action, using {@link ionic.service:$ionicNavBarDelegate}:\n *\n * ```html\n * <ion-nav-bar ng-controller=\"MyCtrl\">\n *   <ion-nav-back-button class=\"button-clear\"\n *     ng-click=\"goBack()\">\n *     <i class=\"ion-arrow-left-c\"></i> Back\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicNavBarDelegate) {\n *   $scope.goBack = function() {\n *     $ionicNavBarDelegate.back();\n *   };\n * }\n * ```\n *\n * Displaying the previous title on the back button, again using\n * {@link ionic.service:$ionicNavBarDelegate}.\n *\n * ```html\n * <ion-nav-bar ng-controller=\"MyCtrl\">\n *   <ion-nav-back-button class=\"button-icon\">\n *     <i class=\"icon ion-arrow-left-c\"></i>{% raw %}{{getPreviousTitle() || 'Back'}}{% endraw %}\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicNavBarDelegate) {\n *   $scope.getPreviousTitle = function() {\n *     return $ionicNavBarDelegate.getPreviousTitle();\n *   };\n * }\n * ```\n */\nIonicModule\n.directive('ionNavBackButton', [\n  '$animate',\n  '$rootScope',\n  '$sanitize',\n  '$ionicNavBarConfig',\n  '$ionicNgClick',\nfunction($animate, $rootScope, $sanitize, $ionicNavBarConfig, $ionicNgClick) {\n  var backIsShown = false;\n  //If the current viewstate does not allow a back button,\n  //always hide it.\n  $rootScope.$on('$viewHistory.historyChange', function(e, data) {\n    backIsShown = !!data.showBack;\n  });\n  return {\n    restrict: 'E',\n    require: '^ionNavBar',\n    compile: function(tElement, tAttrs) {\n      tElement.addClass('button back-button ng-hide');\n\n      var hasIconChild = !!(tElement.html() || '').match(/class=.*?ion-/);\n\n      return function($scope, $element, $attr, navBarCtrl) {\n\n        // Add a default back button icon based on the nav config, unless one is set\n        if (!hasIconChild && $element[0].className.indexOf('ion-') === -1) {\n          $element.addClass($ionicNavBarConfig.backButtonIcon);\n        }\n\n        //Default to ngClick going back, but don't override a custom one\n        if (!isDefined($attr.ngClick)) {\n          $ionicNgClick($scope, $element, navBarCtrl.back);\n        }\n\n        //Make sure both that a backButton is allowed in the first place,\n        //and that it is shown by the current view.\n        $scope.$watch(function() {\n          if(isDefined($attr.fromTitle)) {\n            $element[0].innerHTML = '<span class=\"back-button-title\">' + $sanitize($scope.oldTitle) + '</span>';\n          }\n          return !!(backIsShown && $scope.backButtonShown);\n        }, ionic.animationFrameThrottle(function(show) {\n          if (show) $animate.removeClass($element, 'ng-hide');\n          else $animate.addClass($element, 'ng-hide');\n        }));\n      };\n    }\n  };\n}]);\n\n\nIonicModule.constant('$ionicNavBarConfig', {\n  transition: 'nav-title-slide-ios7',\n  alignTitle: 'center',\n  backButtonIcon: 'ion-ios7-arrow-back'\n});\n\n/**\n * @ngdoc directive\n * @name ionNavBar\n * @module ionic\n * @delegate ionic.service:$ionicNavBarDelegate\n * @restrict E\n *\n * @description\n * If we have an {@link ionic.directive:ionNavView} directive, we can also create an\n * `<ion-nav-bar>`, which will create a topbar that updates as the application state changes.\n *\n * We can add a back button by putting an {@link ionic.directive:ionNavBackButton} inside.\n *\n * We can add buttons depending on the currently visible view using\n * {@link ionic.directive:ionNavButtons}.\n *\n * Add an [animation class](/docs/components#animations) to the element via the\n * `animation` attribute to enable animated changing of titles \n * (recommended: 'nav-title-slide-ios7').\n *\n * Note that the ion-nav-bar element will only work correctly if your content has an\n * ionView around it.\n *\n * @usage\n *\n * ```html\n * <body ng-app=\"starter\">\n *   <!-- The nav bar that will be updated as we navigate -->\n *   <ion-nav-bar class=\"bar-positive\" animation=\"nav-title-slide-ios7\">\n *   </ion-nav-bar>\n *\n *   <!-- where the initial view template will be rendered -->\n *   <ion-nav-view>\n *     <ion-view>\n *       <ion-content>Hello!</ion-content>\n *     </ion-view>\n *   </ion-nav-view>\n * </body>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this navBar\n * with {@link ionic.service:$ionicNavBarDelegate}.\n * @param align-title {string=} Where to align the title of the navbar.\n * Available: 'left', 'right', 'center'. Defaults to 'center'.\n * @param {boolean=} no-tap-scroll By default, the navbar will scroll the content\n * to the top when tapped.  Set no-tap-scroll to true to disable this behavior.\n *\n * </table><br/>\n *\n * ### Alternative Usage\n *\n * Alternatively, you may put ion-nav-bar inside of each individual view's ion-view element.\n * This will allow you to have the whole navbar, not just its contents, transition every view change.\n *\n * This is similar to using a header bar inside your ion-view, except it will have all the power of a navbar.\n *\n * If you do this, simply put nav buttons inside the navbar itself; do not use `<ion-nav-buttons>`.\n *\n *\n * ```html\n * <ion-view title=\"myTitle\">\n *   <ion-nav-bar class=\"bar-positive\">\n *     <ion-nav-back-button>\n *       Back\n *     </ion-nav-back-button>\n *     <div class=\"buttons right-buttons\">\n *       <button class=\"button\">\n *         Right Button\n *       </button>\n *     </div>\n *   </ion-nav-bar>\n * </ion-view>\n * ```\n */\nIonicModule\n.directive('ionNavBar', [\n  '$ionicViewService',\n  '$rootScope',\n  '$animate',\n  '$compile',\n  '$ionicNavBarConfig',\nfunction($ionicViewService, $rootScope, $animate, $compile, $ionicNavBarConfig) {\n\n  return {\n    restrict: 'E',\n    controller: '$ionicNavBar',\n    scope: true,\n    compile: function(tElement, tAttrs) {\n      //We cannot transclude here because it breaks element.data() inheritance on compile\n      tElement\n        .addClass('bar bar-header nav-bar')\n        .append(\n          '<div class=\"buttons left-buttons\"> ' +\n          '</div>' +\n          '<h1 ng-bind-html=\"title\" class=\"title\"></h1>' +\n          '<div class=\"buttons right-buttons\"> ' +\n          '</div>'\n        );\n\n      if (isDefined(tAttrs.animation)) {\n        tElement.addClass(tAttrs.animation);\n      } else {\n        tElement.addClass($ionicNavBarConfig.transition);\n      }\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, navBarCtrl) {\n        navBarCtrl._headerBarView = new ionic.views.HeaderBar({\n          el: $element[0],\n          alignTitle: $attr.alignTitle || $ionicNavBarConfig.alignTitle || 'center'\n        });\n\n        //defaults\n        $scope.backButtonShown = false;\n        $scope.shouldAnimate = true;\n        $scope.isReverse = false;\n        $scope.isInvisible = true;\n\n        $scope.$on('$destroy', function() {\n          $scope.$parent.$hasHeader = false;\n        });\n\n        $scope.$watch(function() {\n          return ($scope.isReverse ? ' reverse' : '') +\n            ($scope.isInvisible ? ' invisible' : '') +\n            (!$scope.shouldAnimate ? ' no-animation' : '');\n        }, function(className, oldClassName) {\n          $element.removeClass(oldClassName);\n          $element.addClass(className);\n        });\n\n      }\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionNavButtons\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n * Use ionNavButtons to set the buttons on your {@link ionic.directive:ionNavBar}\n * from within an {@link ionic.directive:ionView}.\n *\n * Any buttons you declare will be placed onto the navbar's corresponding side,\n * and then destroyed when the user leaves their parent view.\n *\n * @usage\n * ```html\n * <ion-nav-bar>\n * </ion-nav-bar>\n * <ion-nav-view>\n *   <ion-view>\n *     <ion-nav-buttons side=\"left\">\n *       <button class=\"button\" ng-click=\"doSomething()\">\n *         I'm a button on the left of the navbar!\n *       </button>\n *     </ion-nav-buttons>\n *     <ion-content>\n *       Some super content here!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n * @param {string} side The side to place the buttons on in the parent\n * {@link ionic.directive:ionNavBar}. Available: 'left' or 'right'.\n */\nIonicModule\n.directive('ionNavButtons', ['$compile', '$animate', function($compile, $animate) {\n  return {\n    require: '^ionNavBar',\n    restrict: 'E',\n    compile: function($element, $attrs) {\n      var content = $element.contents().remove();\n      return function($scope, $element, $attrs, navBarCtrl) {\n        var navElement = $attrs.side === 'right' ?\n          navBarCtrl.rightButtonsElement :\n          navBarCtrl.leftButtonsElement;\n\n        //Put all of our inside buttons into their own span,\n        //so we can remove them all when this element dies -\n        //even if the buttons have changed through an ng-repeat or the like,\n        //we just remove their div parent and they are gone.\n        var buttons = jqLite('<span>').append(content);\n\n        //Compile buttons inside content so they have access to everything\n        //something inside content does (eg parent ionicScroll)\n        $element.append(buttons);\n        $compile(buttons)($scope);\n\n        //Append buttons to navbar\n        ionic.requestAnimationFrame(function() {\n          //If the scope is destroyed before raf runs, be sure not to enter\n          if (!$scope.$$destroyed) {\n            $animate.enter(buttons, navElement);\n          }\n        });\n\n        //When our ion-nav-buttons container is destroyed,\n        //destroy everything in the navbar\n        $scope.$on('$destroy', function() {\n          $animate.leave(buttons);\n        });\n\n        // The original element is just a completely empty <ion-nav-buttons> element.\n        // make it invisible just to be sure it doesn't change any layout\n        $element.css('display', 'none');\n      };\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name navClear\n * @module ionic\n * @restrict AC\n *\n * @description\n * nav-clear is an attribute directive which should be used with an element that changes\n * the view on click, for example an `<a href>` or a `<button ui-sref>`.\n *\n * nav-clear will cause the given element, when clicked, to disable the next view transition.\n * This directive is useful, for example, for links within a sideMenu.\n *\n * @usage\n * Below is a link in a side menu, with the nav-clear directive added to it.\n * Tapping this link will disable any animations that would normally occur\n * between views.\n *\n * ```html\n * <a nav-clear menu-close href=\"#/home\" class=\"item\">Home</a>\n * ```\n */\nIonicModule\n.directive('navClear', [\n  '$ionicViewService',\n  '$state',\n  '$location',\n  '$window',\n  '$rootScope',\nfunction($ionicViewService, $location, $state, $window, $rootScope) {\n  $rootScope.$on('$stateChangeError', function() {\n    $ionicViewService.nextViewOptions(null);\n  });\n  return {\n    priority: 100,\n    restrict: 'AC',\n    compile: function($element) {\n      return { pre: prelink };\n      function prelink($scope, $element, $attrs) {\n        var unregisterListener;\n        function listenForStateChange() {\n          unregisterListener = $scope.$on('$stateChangeStart', function() {\n            $ionicViewService.nextViewOptions({\n              disableAnimate: true,\n              disableBack: true\n            });\n            unregisterListener();\n          });\n          $window.setTimeout(unregisterListener, 300);\n        }\n\n        $element.on('click', listenForStateChange);\n      }\n    }\n  };\n}]);\n\nIonicModule.constant('$ionicNavViewConfig', {\n  transition: 'slide-left-right-ios7'\n});\n\n/**\n * @ngdoc directive\n * @name ionNavView\n * @module ionic\n * @restrict E\n * @codepen odqCz\n *\n * @description\n * As a user navigates throughout your app, Ionic is able to keep track of their\n * navigation history. By knowing their history, transitions between views\n * correctly slide either left or right, or no transition at all. An additional\n * benefit to Ionic's navigation system is its ability to manage multiple\n * histories.\n *\n * Ionic uses the AngularUI Router module so app interfaces can be organized\n * into various \"states\". Like Angular's core $route service, URLs can be used\n * to control the views. However, the AngularUI Router provides a more powerful\n * state manager in that states are bound to named, nested, and parallel views,\n * allowing more than one template to be rendered on the same page.\n * Additionally, each state is not required to be bound to a URL, and data can\n * be pushed to each state which allows much flexibility.\n *\n * The ionNavView directive is used to render templates in your application. Each template\n * is part of a state. States are usually mapped to a url, and are defined programatically\n * using angular-ui-router (see [their docs](https://github.com/angular-ui/ui-router/wiki),\n * and remember to replace ui-view with ion-nav-view in examples).\n *\n * @usage\n * In this example, we will create a navigation view that contains our different states for the app.\n *\n * To do this, in our markup we use ionNavView top level directive. To display a header bar we use\n * the {@link ionic.directive:ionNavBar} directive that updates as we navigate through the\n * navigation stack.\n *\n * You can use any [animation class](/docs/components#animations) on the navView's `animation` attribute\n * to have its pages animate.\n *\n * Recommended for page transitions: 'slide-left-right', 'slide-left-right-ios7', 'slide-in-up'.\n *\n * ```html\n * <ion-nav-bar></ion-nav-bar>\n * <ion-nav-view animation=\"slide-left-right\">\n *   <!-- Center content -->\n * </ion-nav-view>\n * ```\n *\n * Next, we need to setup our states that will be rendered.\n *\n * ```js\n * var app = angular.module('myApp', ['ionic']);\n * app.config(function($stateProvider) {\n *   $stateProvider\n *   .state('index', {\n *     url: '/',\n *     templateUrl: 'home.html'\n *   })\n *   .state('music', {\n *     url: '/music',\n *     templateUrl: 'music.html'\n *   });\n * });\n * ```\n * Then on app start, $stateProvider will look at the url, see it matches the index state,\n * and then try to load home.html into the `<ion-nav-view>`.\n *\n * Pages are loaded by the URLs given. One simple way to create templates in Angular is to put\n * them directly into your HTML file and use the `<script type=\"text/ng-template\">` syntax.\n * So here is one way to put home.html into our app:\n *\n * ```html\n * <script id=\"home\" type=\"text/ng-template\">\n *   <!-- The title of the ion-view will be shown on the navbar -->\n *   <ion-view title=\"'Home'\">\n *     <ion-content ng-controller=\"HomeCtrl\">\n *       <!-- The content of the page -->\n *       <a href=\"#/music\">Go to music page!</a>\n *     </ion-content>\n *   </ion-view>\n * </script>\n * ```\n *\n * This is good to do because the template will be cached for very fast loading, instead of\n * having to fetch them from the network.\n *\n * Please visit [AngularUI Router's docs](https://github.com/angular-ui/ui-router/wiki) for\n * more info. Below is a great video by the AngularUI Router guys that may help to explain\n * how it all works:\n *\n * <iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/dqJRoh8MnBo\"\n * frameborder=\"0\" allowfullscreen></iframe>\n *\n * @param {string=} name A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states. For more\n * information, see ui-router's [ui-view documentation](http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.directive:ui-view).\n */\nIonicModule\n.directive('ionNavView', [\n  '$ionicViewService',\n  '$state',\n  '$compile',\n  '$controller',\n  '$animate',\nfunction( $ionicViewService,   $state,   $compile,   $controller,   $animate) {\n  // IONIC's fork of Angular UI Router, v0.2.7\n  // the navView handles registering views in the history, which animation to use, and which\n  var viewIsUpdating = false;\n\n  var directive = {\n    restrict: 'E',\n    terminal: true,\n    priority: 2000,\n    transclude: true,\n    controller: function(){},\n    compile: function (element, attr, transclude) {\n      return function(scope, element, attr, navViewCtrl) {\n        var viewScope, viewLocals,\n          name = attr[directive.name] || attr.name || '',\n          onloadExp = attr.onload || '',\n          initialView = transclude(scope);\n\n        // Put back the compiled initial view\n        element.append(initialView);\n\n        // Find the details of the parent view directive (if any) and use it\n        // to derive our own qualified view name, then hang our own details\n        // off the DOM so child directives can find it.\n        var parent = element.parent().inheritedData('$uiView');\n        if (name.indexOf('@') < 0) name  = name + '@' + ((parent && parent.state) ? parent.state.name : '');\n        var view = { name: name, state: null };\n        element.data('$uiView', view);\n\n        var eventHook = function() {\n          if (viewIsUpdating) return;\n          viewIsUpdating = true;\n\n          try { updateView(true); } catch (e) {\n            viewIsUpdating = false;\n            throw e;\n          }\n          viewIsUpdating = false;\n        };\n\n        scope.$on('$stateChangeSuccess', eventHook);\n        // scope.$on('$viewContentLoading', eventHook);\n        updateView(false);\n\n        function updateView(doAnimate) {\n          //===false because $animate.enabled() is a noop without angular-animate included\n          if ($animate.enabled() === false) {\n            doAnimate = false;\n          }\n\n          var locals = $state.$current && $state.$current.locals[name];\n          if (locals === viewLocals) return; // nothing to do\n          var renderer = $ionicViewService.getRenderer(element, attr, scope);\n\n          // Destroy previous view scope\n          if (viewScope) {\n            viewScope.$destroy();\n            viewScope = null;\n          }\n\n          if (!locals) {\n            viewLocals = null;\n            view.state = null;\n\n            // Restore the initial view\n            return element.append(initialView);\n          }\n\n          var newElement = jqLite('<div></div>').html(locals.$template).contents();\n          var viewRegisterData = renderer().register(newElement);\n\n          // Remove existing content\n          renderer(doAnimate).leave();\n\n          viewLocals = locals;\n          view.state = locals.$$state;\n\n          renderer(doAnimate).enter(newElement);\n\n          var link = $compile(newElement);\n          viewScope = scope.$new();\n\n          viewScope.$navDirection = viewRegisterData.navDirection;\n\n          if (locals.$$controller) {\n            locals.$scope = viewScope;\n            var controller = $controller(locals.$$controller, locals);\n            element.children().data('$ngControllerController', controller);\n          }\n          link(viewScope);\n\n          var viewHistoryData = $ionicViewService._getViewById(viewRegisterData.viewId) || {};\n          viewScope.$broadcast('$viewContentLoaded', viewHistoryData);\n\n          if (onloadExp) viewScope.$eval(onloadExp);\n\n          newElement = null;\n        }\n      };\n    }\n  };\n  return directive;\n}]);\n\n\nIonicModule\n\n.config(['$provide', function($provide) {\n  $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {\n    // drop the default ngClick directive\n    $delegate.shift();\n    return $delegate;\n  }]);\n}])\n\n/**\n * @private\n */\n.factory('$ionicNgClick', ['$parse', function($parse) {\n  return function(scope, element, clickExpr) {\n    var clickHandler = angular.isFunction(clickExpr) ?\n      clickExpr :\n      $parse(clickExpr);\n\n    element.on('click', function(event) {\n      scope.$apply(function() {\n        clickHandler(scope, {$event: (event)});\n      });\n    });\n\n    // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click\n    // something else nearby.\n    element.onclick = function(event) { };\n  };\n}])\n\n.directive('ngClick', ['$ionicNgClick', function($ionicNgClick) {\n  return function(scope, element, attr) {\n    $ionicNgClick(scope, element, attr.ngClick);\n  };\n}])\n\n.directive('ionStopEvent', function () {\n  return {\n    restrict: 'A',\n    link: function (scope, element, attr) {\n      element.bind(attr.ionStopEvent, eventStopPropagation);\n    }\n  };\n});\nfunction eventStopPropagation(e) {\n  e.stopPropagation();\n}\n\n\n/**\n * @ngdoc directive\n * @name ionPane\n * @module ionic\n * @restrict E\n *\n * @description A simple container that fits content, with no side effects.  Adds the 'pane' class to the element.\n */\nIonicModule\n.directive('ionPane', function() {\n  return {\n    restrict: 'E',\n    link: function(scope, element, attr) {\n      element.addClass('pane');\n    }\n  };\n});\n\n/*\n * We don't document the ionPopover directive, we instead document\n * the $ionicPopover service\n */\nIonicModule\n.directive('ionPopover', [function() {\n  return {\n    restrict: 'E',\n    transclude: true,\n    replace: true,\n    controller: [function(){}],\n    template: '<div class=\"popover-backdrop\">' +\n                '<div class=\"popover-wrapper\" ng-transclude></div>' +\n              '</div>'\n  };\n}]);\n\nIonicModule\n.directive('ionPopoverView', function() {\n  return {\n    restrict: 'E',\n    compile: function(element) {\n      element.append( angular.element('<div class=\"popover-arrow\"></div>') );\n      element.addClass('popover');\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionRadio\n * @module ionic\n * @restrict E\n * @codepen saoBG\n * @description\n * The radio directive is no different than the HTML radio input, except it's styled differently.\n *\n * Radio behaves like any [AngularJS radio](http://docs.angularjs.org/api/ng/input/input[radio]).\n *\n * @usage\n * ```html\n * <ion-radio ng-model=\"choice\" ng-value=\"'A'\">Choose A</ion-radio>\n * <ion-radio ng-model=\"choice\" ng-value=\"'B'\">Choose B</ion-radio>\n * <ion-radio ng-model=\"choice\" ng-value=\"'C'\">Choose C</ion-radio>\n * ```\n * \n * @param {string=} name The name of the radio input.\n * @param {expression=} value The value of the radio input.\n * @param {boolean=} disabled The state of the radio input.\n * @param {string=} icon The icon to use when the radio input is selected.\n * @param {expression=} ng-value Angular equivalent of the value attribute.\n * @param {expression=} ng-model The angular model for the radio input.\n * @param {boolean=} ng-disabled Angular equivalent of the disabled attribute.\n * @param {expression=} ng-change Triggers given expression when radio input's model changes\n */\nIonicModule\n.directive('ionRadio', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<label class=\"item item-radio\">' +\n        '<input type=\"radio\" name=\"radio-group\">' +\n        '<div class=\"item-content disable-pointer-events\" ng-transclude></div>' +\n        '<i class=\"radio-icon disable-pointer-events icon ion-checkmark\"></i>' +\n      '</label>',\n\n    compile: function(element, attr) {\n      if(attr.icon) element.children().eq(2).removeClass('ion-checkmark').addClass(attr.icon);\n      var input = element.find('input');\n      forEach({\n          'name': attr.name,\n          'value': attr.value,\n          'disabled': attr.disabled,\n          'ng-value': attr.ngValue,\n          'ng-model': attr.ngModel,\n          'ng-disabled': attr.ngDisabled,\n          'ng-change': attr.ngChange\n      }, function(value, name) {\n        if (isDefined(value)) {\n            input.attr(name, value);\n          }\n      });\n\n      return function(scope, element, attr) {\n        scope.getValue = function() {\n          return scope.ngValue || attr.value;\n        };\n      };\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionRefresher\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionContent, ionic.directive:ionScroll\n * @description\n * Allows you to add pull-to-refresh to a scrollView.\n *\n * Place it as the first child of your {@link ionic.directive:ionContent} or\n * {@link ionic.directive:ionScroll} element.\n *\n * When refreshing is complete, $broadcast the 'scroll.refreshComplete' event\n * from your controller.\n *\n * @usage\n *\n * ```html\n * <ion-content ng-controller=\"MyController\">\n *   <ion-refresher\n *     pulling-text=\"Pull to refresh...\"\n *     on-refresh=\"doRefresh()\">\n *   </ion-refresher>\n *   <ion-list>\n *     <ion-item ng-repeat=\"item in items\"></ion-item>\n *   </ion-list>\n * </ion-content>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $http) {\n *   $scope.items = [1,2,3];\n *   $scope.doRefresh = function() {\n *     $http.get('/new-items')\n *      .success(function(newItems) {\n *        $scope.items = newItems;\n *      })\n *      .finally(function() {\n *        // Stop the ion-refresher from spinning\n *        $scope.$broadcast('scroll.refreshComplete');\n *      });\n *   };\n * });\n * ```\n *\n * @param {expression=} on-refresh Called when the user pulls down enough and lets go\n * of the refresher.\n * @param {expression=} on-pulling Called when the user starts to pull down\n * on the refresher.\n * @param {string=} pulling-icon The icon to display while the user is pulling down.\n * Default: 'ion-arrow-down-c'.\n * @param {string=} pulling-text The text to display while the user is pulling down.\n * @param {string=} refreshing-icon The icon to display after user lets go of the\n * refresher.\n * @param {string=} refreshing-text The text to display after the user lets go of\n * the refresher.\n *\n */\nIonicModule\n.directive('ionRefresher', ['$ionicBind', function($ionicBind) {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '^$ionicScroll',\n    template:\n    '<div class=\"scroll-refresher\" collection-repeat-ignore>' +\n      '<div class=\"ionic-refresher-content\" ' +\n      'ng-class=\"{\\'ionic-refresher-with-text\\': pullingText || refreshingText}\">' +\n        '<div class=\"icon-pulling\">' +\n          '<i class=\"icon {{pullingIcon}}\"></i>' +\n        '</div>' +\n        '<div class=\"text-pulling\" ng-bind-html=\"pullingText\"></div>' +\n        '<i class=\"icon {{refreshingIcon}} icon-refreshing\"></i>' +\n        '<div class=\"text-refreshing\" ng-bind-html=\"refreshingText\"></div>' +\n      '</div>' +\n    '</div>',\n    compile: function($element, $attrs) {\n      if (angular.isUndefined($attrs.pullingIcon)) {\n        $attrs.$set('pullingIcon', 'ion-arrow-down-c');\n      }\n      if (angular.isUndefined($attrs.refreshingIcon)) {\n        $attrs.$set('refreshingIcon', 'ion-loading-d');\n      }\n      return function($scope, $element, $attrs, scrollCtrl) {\n        $ionicBind($scope, $attrs, {\n          pullingIcon: '@',\n          pullingText: '@',\n          refreshingIcon: '@',\n          refreshingText: '@',\n          $onRefresh: '&onRefresh',\n          $onPulling: '&onPulling'\n        });\n\n        scrollCtrl._setRefresher($scope, $element[0]);\n        $scope.$on('scroll.refreshComplete', function() {\n          $scope.$evalAsync(function() {\n            scrollCtrl.scrollView.finishPullToRefresh();\n          });\n        });\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionScroll\n * @module ionic\n * @delegate ionic.service:$ionicScrollDelegate\n * @codepen mwFuh\n * @restrict E\n *\n * @description\n * Creates a scrollable container for all content inside.\n *\n * @usage\n *\n * Basic usage:\n *\n * ```html\n * <ion-scroll zooming=\"true\" direction=\"xy\" style=\"width: 500px; height: 500px\">\n *   <div style=\"width: 5000px; height: 5000px; background: url('https://upload.wikimedia.org/wikipedia/commons/a/ad/Europe_geological_map-en.jpg') repeat\"></div>\n *  </ion-scroll>\n * ```\n *\n * Note that it's important to set the height of the scroll box as well as the height of the inner\n * content to enable scrolling. This makes it possible to have full control over scrollable areas.\n *\n * If you'd just like to have a center content scrolling area, use {@link ionic.directive:ionContent} instead.\n *\n * @param {string=} delegate-handle The handle used to identify this scrollView\n * with {@link ionic.service:$ionicScrollDelegate}.\n * @param {string=} direction Which way to scroll. 'x' or 'y' or 'xy'. Default 'y'.\n * @param {boolean=} locking Whether to lock scrolling in one direction at a time. Useful to set to false when zoomed in or scrolling in two directions. Default true.\n * @param {boolean=} paging Whether to scroll with paging.\n * @param {expression=} on-refresh Called on pull-to-refresh, triggered by an {@link ionic.directive:ionRefresher}.\n * @param {expression=} on-scroll Called whenever the user scrolls.\n * @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.\n * @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.\n * @param {boolean=} zooming Whether to support pinch-to-zoom\n * @param {integer=} min-zoom The smallest zoom amount allowed (default is 0.5)\n * @param {integer=} max-zoom The largest zoom amount allowed (default is 3)\n * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges\n * of the content.  Defaults to true on iOS, false on Android.\n */\nIonicModule\n.directive('ionScroll', [\n  '$timeout',\n  '$controller',\n  '$ionicBind',\nfunction($timeout, $controller, $ionicBind) {\n  return {\n    restrict: 'E',\n    scope: true,\n    controller: function() {},\n    compile: function(element, attr) {\n      element.addClass('scroll-view ionic-scroll');\n\n      //We cannot transclude here because it breaks element.data() inheritance on compile\n      var innerElement = jqLite('<div class=\"scroll\"></div>');\n      innerElement.append(element.contents());\n      element.append(innerElement);\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr) {\n        var scrollView, scrollCtrl;\n\n        $ionicBind($scope, $attr, {\n          direction: '@',\n          paging: '@',\n          $onScroll: '&onScroll',\n          scroll: '@',\n          scrollbarX: '@',\n          scrollbarY: '@',\n          zooming: '@',\n          minZoom: '@',\n          maxZoom: '@'\n        });\n        $scope.direction = $scope.direction || 'y';\n\n        if (angular.isDefined($attr.padding)) {\n          $scope.$watch($attr.padding, function(newVal) {\n            innerElement.toggleClass('padding', !!newVal);\n          });\n        }\n        if($scope.$eval($scope.paging) === true) {\n          innerElement.addClass('scroll-paging');\n        }\n\n        if(!$scope.direction) { $scope.direction = 'y'; }\n        var isPaging = $scope.$eval($scope.paging) === true;\n\n        var scrollViewOptions= {\n          el: $element[0],\n          delegateHandle: $attr.delegateHandle,\n          locking: ($attr.locking || 'true') === 'true',\n          bouncing: $scope.$eval($attr.hasBouncing),\n          paging: isPaging,\n          scrollbarX: $scope.$eval($scope.scrollbarX) !== false,\n          scrollbarY: $scope.$eval($scope.scrollbarY) !== false,\n          scrollingX: $scope.direction.indexOf('x') >= 0,\n          scrollingY: $scope.direction.indexOf('y') >= 0,\n          zooming: $scope.$eval($scope.zooming) === true,\n          maxZoom: $scope.$eval($scope.maxZoom) || 3,\n          minZoom: $scope.$eval($scope.minZoom) || 0.5\n        };\n        if (isPaging) {\n          scrollViewOptions.speedMultiplier = 0.8;\n          scrollViewOptions.bouncing = false;\n        }\n\n        scrollCtrl = $controller('$ionicScroll', {\n          $scope: $scope,\n          scrollViewOptions: scrollViewOptions\n        });\n        scrollView = $scope.$parent.scrollView = scrollCtrl.scrollView;\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionSideMenu\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * A container for a side menu, sibling to an {@link ionic.directive:ionSideMenuContent} directive.\n *\n * @usage\n * ```html\n * <ion-side-menu\n *   side=\"left\"\n *   width=\"myWidthValue + 20\"\n *   is-enabled=\"shouldLeftSideMenuBeEnabled()\">\n * </ion-side-menu>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n *\n * @param {string} side Which side the side menu is currently on.  Allowed values: 'left' or 'right'.\n * @param {boolean=} is-enabled Whether this side menu is enabled.\n * @param {number=} width How many pixels wide the side menu should be.  Defaults to 275.\n */\nIonicModule\n.directive('ionSideMenu', function() {\n  return {\n    restrict: 'E',\n    require: '^ionSideMenus',\n    scope: true,\n    compile: function(element, attr) {\n      angular.isUndefined(attr.isEnabled) && attr.$set('isEnabled', 'true');\n      angular.isUndefined(attr.width) && attr.$set('width', '275');\n\n      element.addClass('menu menu-' + attr.side);\n\n      return function($scope, $element, $attr, sideMenuCtrl) {\n        $scope.side = $attr.side || 'left';\n\n        var sideMenu = sideMenuCtrl[$scope.side] = new ionic.views.SideMenu({\n          width: 275,\n          el: $element[0],\n          isEnabled: true\n        });\n\n        $scope.$watch($attr.width, function(val) {\n          var numberVal = +val;\n          if (numberVal && numberVal == val) {\n            sideMenu.setWidth(+val);\n          }\n        });\n        $scope.$watch($attr.isEnabled, function(val) {\n          sideMenu.setIsEnabled(!!val);\n        });\n      };\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionSideMenuContent\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * A container for the main visible content, sibling to one or more\n * {@link ionic.directive:ionSideMenu} directives.\n *\n * @usage\n * ```html\n * <ion-side-menu-content\n *   edge-drag-threshold=\"true\"\n *   drag-content=\"true\">\n * </ion-side-menu-content>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n *\n * @param {boolean=} drag-content Whether the content can be dragged. Default true.\n * @param {boolean|number=} edge-drag-threshold Whether the content drag can only start if it is below a certain threshold distance from the edge of the screen.  Default false. Accepts three types of values:\n   *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.\n   *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.\n   *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.\n *\n */\nIonicModule\n.directive('ionSideMenuContent', [\n  '$timeout',\n  '$ionicGesture',\n  '$window',\nfunction($timeout, $ionicGesture, $window) {\n\n  return {\n    restrict: 'EA', //DEPRECATED 'A'\n    require: '^ionSideMenus',\n    scope: true,\n    compile: function(element, attr) {\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, sideMenuCtrl) {\n        var startCoord = null;\n        var primaryScrollAxis = null;\n\n        $element.addClass('menu-content pane');\n\n        if (isDefined(attr.dragContent)) {\n          $scope.$watch(attr.dragContent, function(value) {\n            sideMenuCtrl.canDragContent(value);\n          });\n        } else {\n          sideMenuCtrl.canDragContent(true);\n        }\n\n        if (isDefined(attr.edgeDragThreshold)) {\n          $scope.$watch(attr.edgeDragThreshold, function(value) {\n            sideMenuCtrl.edgeDragThreshold(value);\n          });\n        }\n\n        // Listen for taps on the content to close the menu\n        function onContentTap(gestureEvt) {\n          if(sideMenuCtrl.getOpenAmount() !== 0) {\n            sideMenuCtrl.close();\n            gestureEvt.gesture.srcEvent.preventDefault();\n            startCoord = null;\n            primaryScrollAxis = null;\n          } else if(!startCoord) {\n            startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n          }\n        }\n\n        function onDragX(e) {\n          if(!sideMenuCtrl.isDraggableTarget(e)) return;\n\n          if( getPrimaryScrollAxis(e) == 'x') {\n            sideMenuCtrl._handleDrag(e);\n            e.gesture.srcEvent.preventDefault();\n          }\n        }\n\n        function onDragY(e) {\n          if( getPrimaryScrollAxis(e) == 'x' ) {\n            e.gesture.srcEvent.preventDefault();\n          }\n        }\n\n        function onDragRelease(e) {\n          sideMenuCtrl._endDrag(e);\n          startCoord = null;\n          primaryScrollAxis = null;\n        }\n\n        function getPrimaryScrollAxis(gestureEvt) {\n          // gets whether the user is primarily scrolling on the X or Y\n          // If a majority of the drag has been on the Y since the start of\n          // the drag, but the X has moved a little bit, it's still a Y drag\n\n          if(primaryScrollAxis) {\n            // we already figured out which way they're scrolling\n            return primaryScrollAxis;\n          }\n\n          if(gestureEvt && gestureEvt.gesture) {\n\n            if(!startCoord) {\n              // get the starting point\n              startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n\n            } else {\n              // we already have a starting point, figure out which direction they're going\n              var endCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n\n              var xDistance = Math.abs(endCoord.x - startCoord.x);\n              var yDistance = Math.abs(endCoord.y - startCoord.y);\n\n              var scrollAxis = ( xDistance < yDistance ? 'y' : 'x' );\n\n              if( Math.max(xDistance, yDistance) > 30 ) {\n                // ok, we pretty much know which way they're going\n                // let's lock it in\n                primaryScrollAxis = scrollAxis;\n              }\n\n              return scrollAxis;\n            }\n          }\n          return 'x';\n        }\n\n        var content = {\n          element: element[0],\n          onDrag: function(e) {},\n          endDrag: function(e) {},\n          getTranslateX: function() {\n            return $scope.sideMenuContentTranslateX || 0;\n          },\n          setTranslateX: ionic.animationFrameThrottle(function(amount) {\n            var xTransform = content.offsetX + amount;\n            $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + xTransform + 'px,0,0)';\n            $timeout(function() {\n              $scope.sideMenuContentTranslateX = amount;\n            });\n          }),\n          setMarginLeft: ionic.animationFrameThrottle(function(amount) {\n            if(amount) {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amount + 'px,0,0)';\n              $element[0].style.width = ($window.innerWidth - amount) + 'px';\n              content.offsetX = amount;\n            } else {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n              $element[0].style.width = '';\n              content.offsetX = 0;\n            }\n          }),\n          enableAnimation: function() {\n            $scope.animationEnabled = true;\n            $element[0].classList.add('menu-animated');\n          },\n          disableAnimation: function() {\n            $scope.animationEnabled = false;\n            $element[0].classList.remove('menu-animated');\n          },\n          offsetX: 0\n        };\n\n        sideMenuCtrl.setContent(content);\n\n        // add gesture handlers\n        var gestureOpts = { stop_browser_behavior: false };\n        var contentTapGesture = $ionicGesture.on('tap', onContentTap, $element, gestureOpts);\n        var dragRightGesture = $ionicGesture.on('dragright', onDragX, $element, gestureOpts);\n        var dragLeftGesture = $ionicGesture.on('dragleft', onDragX, $element, gestureOpts);\n        var dragUpGesture = $ionicGesture.on('dragup', onDragY, $element, gestureOpts);\n        var dragDownGesture = $ionicGesture.on('dragdown', onDragY, $element, gestureOpts);\n        var releaseGesture = $ionicGesture.on('release', onDragRelease, $element, gestureOpts);\n\n        // Cleanup\n        $scope.$on('$destroy', function() {\n          $ionicGesture.off(dragLeftGesture, 'dragleft', onDragX);\n          $ionicGesture.off(dragRightGesture, 'dragright', onDragX);\n          $ionicGesture.off(dragUpGesture, 'dragup', onDragY);\n          $ionicGesture.off(dragDownGesture, 'dragdown', onDragY);\n          $ionicGesture.off(releaseGesture, 'release', onDragRelease);\n          $ionicGesture.off(contentTapGesture, 'tap', onContentTap);\n        });\n      }\n    }\n  };\n}]);\n\nIonicModule\n\n/**\n * @ngdoc directive\n * @name ionSideMenus\n * @module ionic\n * @delegate ionic.service:$ionicSideMenuDelegate\n * @restrict E\n *\n * @description\n * A container element for side menu(s) and the main content. Allows the left\n * and/or right side menu to be toggled by dragging the main content area side\n * to side.\n *\n * To automatically close an opened menu you can add the {@link ionic.directive:menuClose}\n * attribute directive. Including the `menu-close` attribute is usually added to\n * links and buttons within `ion-side-menu` content, so that when the element is\n * clicked then the opened side menu will automatically close.\n *\n * By default, side menus are hidden underneath its side menu content, and can be opened by\n * either swiping the content left or right, or toggling a button to show the side menu. However,\n * by adding the {@link ionic.directive:exposeAsideWhen} attribute directive to an\n * {@link ionic.directive:ionSideMenu} element directive, a side menu can be given instructions\n * on \"when\" the menu should be exposed (always viewable).\n *\n * ![Side Menu](http://ionicframework.com.s3.amazonaws.com/docs/controllers/sidemenu.gif)\n *\n * For more information on side menus, check out:\n *\n * - {@link ionic.directive:ionSideMenuContent}\n * - {@link ionic.directive:ionSideMenu}\n * - {@link ionic.directive:menuClose}\n * - {@link ionic.directive:exposeAsideWhen}\n *\n * @usage\n * To use side menus, add an `<ion-side-menus>` parent element,\n * an `<ion-side-menu-content>` for the center content,\n * and one or more `<ion-side-menu>` directives.\n *\n * ```html\n * <ion-side-menus>\n *   <!-- Center content -->\n *   <ion-side-menu-content ng-controller=\"ContentController\">\n *   </ion-side-menu-content>\n *\n *   <!-- Left menu -->\n *   <ion-side-menu side=\"left\">\n *   </ion-side-menu>\n *\n *   <!-- Right menu -->\n *   <ion-side-menu side=\"right\">\n *   </ion-side-menu>\n * </ion-side-menus>\n * ```\n * ```js\n * function ContentController($scope, $ionicSideMenuDelegate) {\n *   $scope.toggleLeft = function() {\n *     $ionicSideMenuDelegate.toggleLeft();\n *   };\n * }\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this side menu\n * with {@link ionic.service:$ionicSideMenuDelegate}.\n *\n */\n.directive('ionSideMenus', ['$ionicBody', function($ionicBody) {\n  return {\n    restrict: 'ECA',\n    controller: '$ionicSideMenus',\n    compile: function(element, attr) {\n      attr.$set('class', (attr['class'] || '') + ' view');\n\n      return { pre: prelink };\n      function prelink($scope) {\n\n        $scope.$on('$ionicExposeAside', function(evt, isAsideExposed){\n          if(!$scope.$exposeAside) $scope.$exposeAside = {};\n          $scope.$exposeAside.active = isAsideExposed;\n          $ionicBody.enableClass(isAsideExposed, 'aside-open');\n        });\n\n        $scope.$on('$destroy', function(){\n          $ionicBody.removeClass('menu-open', 'aside-open');\n        });\n\n      }\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionSlideBox\n * @module ionic\n * @delegate ionic.service:$ionicSlideBoxDelegate\n * @restrict E\n * @description\n * The Slide Box is a multi-page container where each page can be swiped or dragged between:\n *\n * ![SlideBox](http://ionicframework.com.s3.amazonaws.com/docs/controllers/slideBox.gif)\n *\n * @usage\n * ```html\n * <ion-slide-box on-slide-changed=\"slideHasChanged($index)\">\n *   <ion-slide>\n *     <div class=\"box blue\"><h1>BLUE</h1></div>\n *   </ion-slide>\n *   <ion-slide>\n *     <div class=\"box yellow\"><h1>YELLOW</h1></div>\n *   </ion-slide>\n *   <ion-slide>\n *     <div class=\"box pink\"><h1>PINK</h1></div>\n *   </ion-slide>\n * </ion-slide-box>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this slideBox\n * with {@link ionic.service:$ionicSlideBoxDelegate}.\n * @param {boolean=} does-continue Whether the slide box should loop.\n * @param {boolean=} auto-play Whether the slide box should automatically slide. Default true if does-continue is true.\n * @param {number=} slide-interval How many milliseconds to wait to change slides (if does-continue is true). Defaults to 4000.\n * @param {boolean=} show-pager Whether a pager should be shown for this slide box.\n * @param {expression=} pager-click Expression to call when a pager is clicked (if show-pager is true). Is passed the 'index' variable.\n * @param {expression=} on-slide-changed Expression called whenever the slide is changed.  Is passed an '$index' variable.\n * @param {expression=} active-slide Model to bind the current slide to.\n */\nIonicModule\n.directive('ionSlideBox', [\n  '$timeout',\n  '$compile',\n  '$ionicSlideBoxDelegate',\nfunction($timeout, $compile, $ionicSlideBoxDelegate) {\n  return {\n    restrict: 'E',\n    replace: true,\n    transclude: true,\n    scope: {\n      autoPlay: '=',\n      doesContinue: '@',\n      slideInterval: '@',\n      showPager: '@',\n      pagerClick: '&',\n      disableScroll: '@',\n      onSlideChanged: '&',\n      activeSlide: '=?'\n    },\n    controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {\n      var _this = this;\n\n      var continuous = $scope.$eval($scope.doesContinue) === true;\n      var shouldAutoPlay = isDefined($attrs.autoPlay) ? !!$scope.autoPlay : false;\n      var slideInterval = shouldAutoPlay ? $scope.$eval($scope.slideInterval) || 4000 : 0;\n\n      var slider = new ionic.views.Slider({\n        el: $element[0],\n        auto: slideInterval,\n        continuous: continuous,\n        startSlide: $scope.activeSlide,\n        slidesChanged: function() {\n          $scope.currentSlide = slider.currentIndex();\n\n          // Try to trigger a digest\n          $timeout(function() {});\n        },\n        callback: function(slideIndex) {\n          $scope.currentSlide = slideIndex;\n          $scope.onSlideChanged({ index: $scope.currentSlide, $index: $scope.currentSlide});\n          $scope.$parent.$broadcast('slideBox.slideChanged', slideIndex);\n          $scope.activeSlide = slideIndex;\n          // Try to trigger a digest\n          $timeout(function() {});\n        }\n      });\n\n      slider.enableSlide($scope.$eval($attrs.disableScroll) !== true);\n\n      $scope.$watch('activeSlide', function(nv) {\n        if(angular.isDefined(nv)){\n          slider.slide(nv);\n        }\n      });\n\n      $scope.$on('slideBox.nextSlide', function() {\n        slider.next();\n      });\n\n      $scope.$on('slideBox.prevSlide', function() {\n        slider.prev();\n      });\n\n      $scope.$on('slideBox.setSlide', function(e, index) {\n        slider.slide(index);\n      });\n\n      //Exposed for testing\n      this.__slider = slider;\n\n      var deregisterInstance = $ionicSlideBoxDelegate._registerInstance(slider, $attrs.delegateHandle);\n      $scope.$on('$destroy', deregisterInstance);\n\n      this.slidesCount = function() {\n        return slider.slidesCount();\n      };\n\n      this.onPagerClick = function(index) {\n        void 0;\n        $scope.pagerClick({index: index});\n      };\n\n      $timeout(function() {\n        slider.load();\n      });\n    }],\n    template: '<div class=\"slider\">' +\n      '<div class=\"slider-slides\" ng-transclude>' +\n      '</div>' +\n    '</div>',\n\n    link: function($scope, $element, $attr, slideBoxCtrl) {\n      // If the pager should show, append it to the slide box\n      if($scope.$eval($scope.showPager) !== false) {\n        var childScope = $scope.$new();\n        var pager = jqLite('<ion-pager></ion-pager>');\n        $element.append(pager);\n        $compile(pager)(childScope);\n      }\n    }\n  };\n}])\n.directive('ionSlide', function() {\n  return {\n    restrict: 'E',\n    require: '^ionSlideBox',\n    compile: function(element, attr) {\n      element.addClass('slider-slide');\n      return function($scope, $element, $attr) {\n      };\n    },\n  };\n})\n\n.directive('ionPager', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '^ionSlideBox',\n    template: '<div class=\"slider-pager\"><span class=\"slider-pager-page\" ng-repeat=\"slide in numSlides() track by $index\" ng-class=\"{active: $index == currentSlide}\" ng-click=\"pagerClick($index)\"><i class=\"icon ion-record\"></i></span></div>',\n    link: function($scope, $element, $attr, slideBox) {\n      var selectPage = function(index) {\n        var children = $element[0].children;\n        var length = children.length;\n        for(var i = 0; i < length; i++) {\n          if(i == index) {\n            children[i].classList.add('active');\n          } else {\n            children[i].classList.remove('active');\n          }\n        }\n      };\n\n      $scope.pagerClick = function(index) {\n        slideBox.onPagerClick(index);\n      };\n\n      $scope.numSlides = function() {\n        return new Array(slideBox.slidesCount());\n      };\n\n      $scope.$watch('currentSlide', function(v) {\n        selectPage(v);\n      });\n    }\n  };\n\n});\n\nIonicModule.constant('$ionicTabConfig', {\n  type: ''\n});\n\n/**\n * @ngdoc directive\n * @name ionTab\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionTabs\n *\n * @description\n * Contains a tab's content.  The content only exists while the given tab is selected.\n *\n * Each ionTab has its own view history.\n *\n * @usage\n * ```html\n * <ion-tab\n *   title=\"Tab!\"\n *   icon=\"my-icon\"\n *   href=\"#/tab/tab-link\"\n *   on-select=\"onTabSelected()\"\n *   on-deselect=\"onTabDeselected()\">\n * </ion-tab>\n * ```\n * For a complete, working tab bar example, see the {@link ionic.directive:ionTabs} documentation.\n *\n * @param {string} title The title of the tab.\n * @param {string=} href The link that this tab will navigate to when tapped.\n * @param {string=} icon The icon of the tab. If given, this will become the default for icon-on and icon-off.\n * @param {string=} icon-on The icon of the tab while it is selected.\n * @param {string=} icon-off The icon of the tab while it is not selected.\n * @param {expression=} badge The badge to put on this tab (usually a number).\n * @param {expression=} badge-style The style of badge to put on this tab (eg tabs-positive).\n * @param {expression=} on-select Called when this tab is selected.\n * @param {expression=} on-deselect Called when this tab is deselected.\n * @param {expression=} ng-click By default, the tab will be selected on click. If ngClick is set, it will not.  You can explicitly switch tabs using {@link ionic.service:$ionicTabsDelegate#select $ionicTabsDelegate.select()}.\n */\nIonicModule\n.directive('ionTab', [\n  '$rootScope',\n  '$animate',\n  '$ionicBind',\n  '$compile',\nfunction($rootScope, $animate, $ionicBind, $compile) {\n\n  //Returns ' key=\"value\"' if value exists\n  function attrStr(k,v) {\n    return angular.isDefined(v) ? ' ' + k + '=\"' + v + '\"' : '';\n  }\n  return {\n    restrict: 'E',\n    require: ['^ionTabs', 'ionTab'],\n    replace: true,\n    controller: '$ionicTab',\n    scope: true,\n    compile: function(element, attr) {\n\n      //We create the tabNavTemplate in the compile phase so that the\n      //attributes we pass down won't be interpolated yet - we want\n      //to pass down the 'raw' versions of the attributes\n      var tabNavTemplate = '<ion-tab-nav' +\n        attrStr('ng-click', attr.ngClick) +\n        attrStr('title', attr.title) +\n        attrStr('icon', attr.icon) +\n        attrStr('icon-on', attr.iconOn) +\n        attrStr('icon-off', attr.iconOff) +\n        attrStr('badge', attr.badge) +\n        attrStr('badge-style', attr.badgeStyle) +\n        attrStr('hidden', attr.hidden) +\n        attrStr('class', attr['class']) +\n        '></ion-tab-nav>';\n\n      //Remove the contents of the element so we can compile them later, if tab is selected\n      //We don't use regular transclusion because it breaks element inheritance\n      var tabContent = jqLite('<div class=\"pane\">')\n        .append( element.contents().remove() );\n\n      return function link($scope, $element, $attr, ctrls) {\n        var childScope;\n        var childElement;\n        var tabsCtrl = ctrls[0];\n        var tabCtrl = ctrls[1];\n\n        var navView = tabContent[0].querySelector('ion-nav-view') ||\n          tabContent[0].querySelector('data-ion-nav-view');\n        var navViewName = navView && navView.getAttribute('name');\n\n        $ionicBind($scope, $attr, {\n          animate: '=',\n          onSelect: '&',\n          onDeselect: '&',\n          title: '@',\n          uiSref: '@',\n          href: '@',\n        });\n\n        tabsCtrl.add($scope);\n        $scope.$on('$destroy', function() {\n          tabsCtrl.remove($scope);\n          tabNavElement.isolateScope().$destroy();\n          tabNavElement.remove();\n        });\n\n        //Remove title attribute so browser-tooltip does not apear\n        $element[0].removeAttribute('title');\n\n        if (navViewName) {\n          tabCtrl.navViewName = $scope.navViewName = navViewName;\n        }\n        $scope.$on('$stateChangeSuccess', selectIfMatchesState);\n        selectIfMatchesState();\n        function selectIfMatchesState() {\n          if (tabCtrl.tabMatchesState()) {\n            tabsCtrl.select($scope, false);\n          }\n        }\n\n        var tabNavElement = jqLite(tabNavTemplate);\n        tabNavElement.data('$ionTabsController', tabsCtrl);\n        tabNavElement.data('$ionTabController', tabCtrl);\n        tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope));\n\n        $scope.$watch('$tabSelected', function(value) {\n          childScope && childScope.$destroy();\n          childScope = null;\n          childElement && $animate.leave(childElement);\n          childElement = null;\n          if (value) {\n            childScope = $scope.$new();\n            childElement = tabContent.clone();\n            $animate.enter(childElement, tabsCtrl.$element);\n            $compile(childElement)(childScope);\n          }\n        });\n\n      };\n    }\n  };\n}]);\n\nIonicModule\n.directive('ionTabNav', [function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: ['^ionTabs', '^ionTab'],\n    template:\n    '<a ng-class=\"{\\'tab-item-active\\': isTabActive(), \\'has-badge\\':badge, \\'tab-hidden\\':isHidden()}\" ' +\n      ' class=\"tab-item\">' +\n      '<span class=\"badge {{badgeStyle}}\" ng-if=\"badge\">{{badge}}</span>' +\n      '<i class=\"icon {{getIconOn()}}\" ng-if=\"getIconOn() && isTabActive()\"></i>' +\n      '<i class=\"icon {{getIconOff()}}\" ng-if=\"getIconOff() && !isTabActive()\"></i>' +\n      '<span class=\"tab-title\" ng-bind-html=\"title\"></span>' +\n    '</a>',\n    scope: {\n      title: '@',\n      icon: '@',\n      iconOn: '@',\n      iconOff: '@',\n      badge: '=',\n      hidden: '@',\n      badgeStyle: '@',\n      'class': '@'\n    },\n    compile: function(element, attr, transclude) {\n      return function link($scope, $element, $attrs, ctrls) {\n        var tabsCtrl = ctrls[0],\n          tabCtrl = ctrls[1];\n\n        //Remove title attribute so browser-tooltip does not apear\n        $element[0].removeAttribute('title');\n\n        $scope.selectTab = function(e) {\n          e.preventDefault();\n          tabsCtrl.select(tabCtrl.$scope, true);\n        };\n        if (!$attrs.ngClick) {\n          $element.on('click', function(event) {\n            $scope.$apply(function() {\n              $scope.selectTab(event);\n            });\n          });\n        }\n\n        $scope.isHidden = function() {\n          if($attrs.hidden === 'true' || $attrs.hidden === true)return true;\n          return false;\n        };\n\n        $scope.getIconOn = function() {\n          return $scope.iconOn || $scope.icon;\n        };\n        $scope.getIconOff = function() {\n          return $scope.iconOff || $scope.icon;\n        };\n\n        $scope.isTabActive = function() {\n          return tabsCtrl.selectedTab() === tabCtrl.$scope;\n        };\n      };\n    }\n  };\n}]);\n\nIonicModule.constant('$ionicTabsConfig', {\n  position: '',\n  type: ''\n});\n\n/**\n * @ngdoc directive\n * @name ionTabs\n * @module ionic\n * @delegate ionic.service:$ionicTabsDelegate\n * @restrict E\n * @codepen KbrzJ\n *\n * @description\n * Powers a multi-tabbed interface with a Tab Bar and a set of \"pages\" that can be tabbed\n * through.\n *\n * Assign any [tabs class](/docs/components#tabs) or\n * [animation class](/docs/components#animation) to the element to define\n * its look and feel.\n *\n * See the {@link ionic.directive:ionTab} directive's documentation for more details on\n * individual tabs.\n *\n * Note: do not place ion-tabs inside of an ion-content element; it has been known to cause a\n * certain CSS bug.\n *\n * @usage\n * ```html\n * <ion-tabs class=\"tabs-positive tabs-icon-only\">\n *\n *   <ion-tab title=\"Home\" icon-on=\"ion-ios7-filing\" icon-off=\"ion-ios7-filing-outline\">\n *     <!-- Tab 1 content -->\n *   </ion-tab>\n *\n *   <ion-tab title=\"About\" icon-on=\"ion-ios7-clock\" icon-off=\"ion-ios7-clock-outline\">\n *     <!-- Tab 2 content -->\n *   </ion-tab>\n *\n *   <ion-tab title=\"Settings\" icon-on=\"ion-ios7-gear\" icon-off=\"ion-ios7-gear-outline\">\n *     <!-- Tab 3 content -->\n *   </ion-tab>\n *\n * </ion-tabs>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify these tabs\n * with {@link ionic.service:$ionicTabsDelegate}.\n */\n\nIonicModule\n.directive('ionTabs', [\n  '$ionicViewService', \n  '$ionicTabsDelegate', \n  '$ionicTabsConfig', \nfunction($ionicViewService, $ionicTabsDelegate, $ionicTabsConfig) {\n  return {\n    restrict: 'E',\n    scope: true,\n    controller: '$ionicTabs',\n    compile: function(element, attr) {\n      element.addClass('view');\n      //We cannot use regular transclude here because it breaks element.data()\n      //inheritance on compile\n      var innerElement = jqLite('<div class=\"tabs\"></div>');\n      innerElement.append(element.contents());\n      element.append(innerElement);\n      element.addClass($ionicTabsConfig.position);\n      element.addClass($ionicTabsConfig.type);\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, tabsCtrl) {\n        var deregisterInstance = $ionicTabsDelegate._registerInstance(\n          tabsCtrl, $attr.delegateHandle\n        );\n\n        $scope.$on('$destroy', deregisterInstance);\n\n        tabsCtrl.$scope = $scope;\n        tabsCtrl.$element = $element;\n        tabsCtrl.$tabsElement = jqLite($element[0].querySelector('.tabs'));\n\n        var el = $element[0];\n        $scope.$watch(function() { return el.className; }, function(value) {\n          var isTabsTop = value.indexOf('tabs-top') !== -1;\n          var isHidden = value.indexOf('tabs-item-hide') !== -1;\n          $scope.$hasTabs = !isTabsTop && !isHidden;\n          $scope.$hasTabsTop = isTabsTop && !isHidden;\n        });\n        $scope.$on('$destroy', function() {\n          delete $scope.$hasTabs;\n          delete $scope.$hasTabsTop;\n        });\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionToggle\n * @module ionic\n * @codepen tfAzj\n * @restrict E\n *\n * @description\n * A toggle is an animated switch which binds a given model to a boolean.\n *\n * Allows dragging of the switch's nub.\n *\n * The toggle behaves like any [AngularJS checkbox](http://docs.angularjs.org/api/ng/input/input[checkbox]) otherwise.\n *\n * @param toggle-class {string=} Sets the CSS class on the inner `label.toggle` element created by the directive.\n *\n * @usage\n * Below is an example of a toggle directive which is wired up to the `airplaneMode` model\n * and has the `toggle-calm` CSS class assigned to the inner element.\n *\n * ```html\n * <ion-toggle ng-model=\"airplaneMode\" toggle-class=\"toggle-calm\">Airplane Mode</ion-toggle>\n * ```\n */\nIonicModule\n.directive('ionToggle', [\n  '$ionicGesture',\n  '$timeout',\nfunction($ionicGesture, $timeout) {\n\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<div class=\"item item-toggle\">' +\n        '<div ng-transclude></div>' +\n        '<label class=\"toggle\">' +\n          '<input type=\"checkbox\">' +\n          '<div class=\"track\">' +\n            '<div class=\"handle\"></div>' +\n          '</div>' +\n        '</label>' +\n      '</div>',\n\n    compile: function(element, attr) {\n      var input = element.find('input');\n      forEach({\n        'name': attr.name,\n        'ng-value': attr.ngValue,\n        'ng-model': attr.ngModel,\n        'ng-checked': attr.ngChecked,\n        'ng-disabled': attr.ngDisabled,\n        'ng-true-value': attr.ngTrueValue,\n        'ng-false-value': attr.ngFalseValue,\n        'ng-change': attr.ngChange\n      }, function(value, name) {\n        if (isDefined(value)) {\n          input.attr(name, value);\n        }\n      });\n\n      if(attr.toggleClass) {\n        element[0].getElementsByTagName('label')[0].classList.add(attr.toggleClass);\n      }\n\n      return function($scope, $element, $attr) {\n         var el, checkbox, track, handle;\n\n         el = $element[0].getElementsByTagName('label')[0];\n         checkbox = el.children[0];\n         track = el.children[1];\n         handle = track.children[0];\n\n         var ngModelController = jqLite(checkbox).controller('ngModel');\n\n         $scope.toggle = new ionic.views.Toggle({\n           el: el,\n           track: track,\n           checkbox: checkbox,\n           handle: handle,\n           onChange: function() {\n             if(checkbox.checked) {\n               ngModelController.$setViewValue(true);\n             } else {\n               ngModelController.$setViewValue(false);\n             }\n             $scope.$apply();\n           }\n         });\n\n         $scope.$on('$destroy', function() {\n           $scope.toggle.destroy();\n         });\n      };\n    }\n\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionView\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n * A container for content, used to tell a parent {@link ionic.directive:ionNavBar}\n * about the current view.\n *\n * @usage\n * Below is an example where our page will load with a navbar containing \"My Page\" as the title.\n *\n * ```html\n * <ion-nav-bar></ion-nav-bar>\n * <ion-nav-view class=\"slide-left-right\">\n *   <ion-view title=\"My Page\">\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n * @param {string=} title The title to display on the parent {@link ionic.directive:ionNavBar}.\n * @param {boolean=} hide-back-button Whether to hide the back button on the parent\n * {@link ionic.directive:ionNavBar} by default.\n * @param {boolean=} hide-nav-bar Whether to hide the parent\n * {@link ionic.directive:ionNavBar} by default.\n */\nIonicModule\n.directive('ionView', ['$ionicViewService', '$rootScope', '$animate',\n           function( $ionicViewService,   $rootScope,   $animate) {\n  return {\n    restrict: 'EA',\n    priority: 1000,\n    require: ['^?ionNavBar', '^?ionModal'],\n    compile: function(tElement, tAttrs, transclude) {\n      tElement.addClass('pane');\n      tElement[0].removeAttribute('title');\n\n      return function link($scope, $element, $attr, ctrls) {\n        var navBarCtrl = ctrls[0];\n        var modalCtrl = ctrls[1];\n\n        //Don't use the ionView if we're inside a modal or there's no navbar\n        if (!navBarCtrl || modalCtrl) {\n          return;\n        }\n\n        if (angular.isDefined($attr.title)) {\n\n          var initialTitle = $attr.title;\n          navBarCtrl.changeTitle(initialTitle, $scope.$navDirection);\n\n          // watch for changes in the title, don't set initial value as changeTitle does that\n          $attr.$observe('title', function(val, oldVal) {\n            navBarCtrl.setTitle(val);\n          });\n        }\n\n        var hideBackAttr = angular.isDefined($attr.hideBackButton) ?\n          $attr.hideBackButton :\n          'false';\n        $scope.$watch(hideBackAttr, function(value) {\n          // Should we hide a back button when this tab is shown\n          navBarCtrl.showBackButton(!value);\n        });\n\n        var hideNavAttr = angular.isDefined($attr.hideNavBar) ?\n          $attr.hideNavBar :\n          'false';\n        $scope.$watch(hideNavAttr, function(value) {\n          // Should the nav bar be hidden for this view or not?\n          navBarCtrl.showBar(!value);\n        });\n\n      };\n    }\n  };\n}]);\n\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.collide=e()}}(function(){var define,module,exports;return (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);throw new Error(\"Cannot find module '\"+o+\"'\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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(_dereq_,module,exports){\n(function (process){\n// Generated by CoffeeScript 1.6.3\n(function() {\n  var getNanoSeconds, hrtime, loadTime;\n\n  if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n    module.exports = function() {\n      return performance.now();\n    };\n  } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n    module.exports = function() {\n      return (getNanoSeconds() - loadTime) / 1e6;\n    };\n    hrtime = process.hrtime;\n    getNanoSeconds = function() {\n      var hr;\n      hr = hrtime();\n      return hr[0] * 1e9 + hr[1];\n    };\n    loadTime = getNanoSeconds();\n  } else if (Date.now) {\n    module.exports = function() {\n      return Date.now() - loadTime;\n    };\n    loadTime = Date.now();\n  } else {\n    module.exports = function() {\n      return new Date().getTime() - loadTime;\n    };\n    loadTime = new Date().getTime();\n  }\n\n}).call(this);\n\n/*\n//@ sourceMappingURL=performance-now.map\n*/\n\n}).call(this,_dereq_(\"qhDIRT\"))\n},{\"qhDIRT\":13}],2:[function(_dereq_,module,exports){\nvar now = _dereq_('performance-now')\n  , global = typeof window === 'undefined' ? {} : window\n  , vendors = ['moz', 'webkit']\n  , suffix = 'AnimationFrame'\n  , raf = global['request' + suffix]\n  , caf = global['cancel' + suffix] || global['cancelRequest' + suffix]\n\nfor(var i = 0; i < vendors.length && !raf; i++) {\n  raf = global[vendors[i] + 'Request' + suffix]\n  caf = global[vendors[i] + 'Cancel' + suffix]\n      || global[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n  var last = 0\n    , id = 0\n    , queue = []\n    , frameDuration = 1000 / 60\n\n  raf = function(callback) {\n    if(queue.length === 0) {\n      var _now = now()\n        , next = Math.max(0, frameDuration - (_now - last))\n      last = next + _now\n      setTimeout(function() {\n        var cp = queue.slice(0)\n        // Clear queue here to prevent\n        // callbacks from appending listeners\n        // to the current frame's queue\n        queue.length = 0\n        for (var i = 0; i < cp.length; i++) {\n          if (!cp[i].cancelled) {\n            cp[i].callback(last)\n          }\n        }\n      }, next)\n    }\n    queue.push({\n      handle: ++id,\n      callback: callback,\n      cancelled: false\n    })\n    return id\n  }\n\n  caf = function(handle) {\n    for(var i = 0; i < queue.length; i++) {\n      if(queue[i].handle === handle) {\n        queue[i].cancelled = true\n      }\n    }\n  }\n}\n\nmodule.exports = function() {\n  // Wrap in a new function to prevent\n  // `cancel` potentially being assigned\n  // to the native rAF function\n  return raf.apply(global, arguments)\n}\nmodule.exports.cancel = function() {\n  caf.apply(global, arguments)\n}\n\n},{\"performance-now\":3}],3:[function(_dereq_,module,exports){\nmodule.exports=_dereq_(1)\n},{\"qhDIRT\":13}],4:[function(_dereq_,module,exports){\n\n// Interpolation disabled for now\n// var interpolate = require('./core/interpolate');\n// var cssFeature = require('feature/css');\n\nvar timeline = _dereq_('./core/timeline');\nvar dynamics = _dereq_('./core/dynamics');\nvar easingFunctions = _dereq_('./core/easing-functions');\n\nvar uid = _dereq_('./util/uid');\nvar EventEmitter = _dereq_('./util/simple-emitter');\n\nfunction clamp(min, n, max) { return Math.max(min, Math.min(n, max)); }\n\nmodule.exports = Animator;\n\nfunction Animator(opts) {\n  //if `new` keyword isn't provided, do it for user\n  if (!(this instanceof Animator)) {\n    return new Animator(opts);\n  }\n\n  opts = opts || {};\n\n  //Private state goes in this._\n  this._ = {\n    id: uid(),\n    percent: 0,\n    duration: 500,\n    isReverse: false\n  };\n\n  var emitter = this._.emitter = new EventEmitter();\n  this._.onDestroy = function() {\n    emitter.emit('destroy');\n  };\n  this._.onStop = function(wasCompleted) {\n    emitter.emit('stop', wasCompleted);\n    wasCompleted && emitter.emit('complete');\n  };\n  this._.onStart = function() {\n    emitter.emit('start');\n  };\n  this._.onStep = function(v) {\n    emitter.emit('step', v);\n  };\n\n  opts.duration && this.duration(opts.duration);\n  opts.percent && this.percent(opts.percent);\n  opts.easing && this.easing(opts.easing);\n  opts.reverse && this.reverse(opts.reverse);\n}\n\nAnimator.prototype = {\n\n  reverse: function(reverse) {\n    if (arguments.length) {\n      this._.isReverse = !!reverse;\n      return this;\n    }\n    return this._.isReverse;\n  },\n\n  easing: function(easing) {\n    var type = typeof easing;\n    if (arguments.length) {\n      if (type === 'function' || type === 'string' || type === 'object') {\n        this._.easing = figureOutEasing(easing);\n      }\n      return this;\n    }\n    return this._.easing;\n  },\n\n  percent: function(percent) {\n    if (arguments.length) {\n      if (typeof percent === 'number') {\n        this._.percent = clamp(0, percent, 1);\n      }\n      if (!this.isRunning()) {\n        this._.onStep(this._getValueForPercent(this._.percent));\n      }\n      return this;\n    }\n    return this._.percent;\n  },\n\n  duration: function(duration) {\n    if (arguments.length) {\n      if (typeof duration === 'number' && duration > 0) {\n        this._.duration = duration;\n      }\n      return this;\n    }\n    return this._.duration;\n  },\n\n  /**\n   * Interpolation is disabled for now.\n   */\n  // addInterpolation: function(el, startingStyles, endingStyles) {\n  //   var interpolators;\n  //   if (arguments.length) {\n  //     syncStyles(startingStyles, endingStyles, window.getComputedStyle(el));\n  //     interpolators = makePropertyInterpolators(startingStyles, endingStyles);\n\n  //     this.on('step', setStyles);\n  //     return function unbind() {\n  //       this.off('step', setStyles);\n  //     };\n  //   }\n  //   function setStyles(v) {\n  //     for (var property in interpolators) {\n  //       el.style[property] = interpolators[property](v);\n  //     }\n  //   }\n  // },\n\n  isRunning: function() { \n    return !!this._.isRunning; \n  },\n\n  promise: function() {\n    var self = this;\n    return {\n      then: function(cb) {\n        self.once('stop', cb);\n      }\n    };\n  },\n\n  on: function(eventType, listener) {\n    this._.emitter.on(eventType, listener);\n    return this;\n  },\n  once: function(eventType, listener) {\n    this._.emitter.once(eventType, listener);\n    return this;\n  },\n  off: function(eventType, listener) {\n    this._.emitter.off(eventType, listener);\n    return this;\n  },\n\n  destroy: function() {\n    this.stop();\n    this._.onDestroy();\n    this.off();\n    return this;\n  },\n\n  stop: function() {\n    if (!this._.isRunning) return;\n\n    this._.isRunning = false;\n    timeline.animationStopped(this);\n\n    this._.onStop(this._isComplete());\n    return this;\n  },\n\n  restart: function(immediate) {\n    if (this._.isRunning) return;\n\n    this._.percent = this._getStartPercent();\n\n    return this.start(!!immediate);\n  },\n\n  start: function(immediate) {\n    if (this._.isRunning) return;\n\n    if (immediate) {\n      this._.onStep(this._getValueForPercent(this._.percent));\n    } else {\n      this._.isStarting = true;\n    }\n\n    this._.isRunning = true;\n    timeline.animationStarted(this);\n\n    this._.onStart();\n    return this;\n  },\n\n  _isComplete: function() {\n    return !this._.isRunning && \n      this._.percent === this._getEndPercent();\n  },\n  _getEndPercent: function() {\n    return this._.isReverse ? 0 : 1;\n  },\n  _getStartPercent: function() {\n    return this._.isReverse ? 1 : 0;\n  },\n\n  _getValueForPercent: function(percent) {\n    if (this._.easing) {\n      return this._.easing(percent, this._.duration);\n    }\n    return percent;\n  },\n\n  _tick: function(deltaT) {\n    var state = this._;\n\n    //First tick, don't up the percent\n    if (state.isStarting) {\n      state.isStarting = false;\n    } else if (state.isReverse) {\n      state.percent = Math.max(0, state.percent - (deltaT / state.duration));\n    } else {\n      state.percent = Math.min(1, state.percent + (deltaT / state.duration));\n    }\n    \n    state.onStep(this._getValueForPercent(state.percent));\n\n    if (state.percent === this._getEndPercent()) {\n      this.stop();\n    }\n  },\n\n};\n\nfunction figureOutEasing(easing) {\n  if (typeof easing === 'object') {\n    var dynamicType = typeof easing.type === 'string' &&\n      easing.type.toLowerCase().trim();\n\n    if (!dynamics[dynamicType]) {\n      throw new Error(\n        'Invalid easing dynamics object type \"' + easing.type + '\". ' +\n        'Available dynamics types: ' + Object.keys(dynamics).join(', ') + '.'\n      );\n    }\n    return dynamics[dynamicType](easing);\n\n  } else if (typeof easing === 'string') {\n    easing = easing.toLowerCase().trim();\n    \n    if (easing.indexOf('cubic-bezier(') === 0) {\n      var parts = easing\n        .replace('cubic-bezier(', '')\n        .replace(')', '')\n        .split(',')\n        .map(function(v) {\n          return v.trim();\n        });\n      return easingFunctions['cubic-bezier'](parts[0], parts[1], parts[2], parts[3]);\n    } else {\n      var fn = easingFunctions[easing];\n      if (!fn) {\n        throw new Error(\n          'Invalid easing function \"' + easing + '\". ' +\n          'Available easing functions: ' + Object.keys(easingFunctions).join(', ') + '.'\n        );\n      }\n      return easingFunctions[easing]();\n    }\n  } else if (typeof easing === 'function') {\n    return easing;\n  }\n}\n\n// /*\n//  * Tweening helpers\n//  */\n// function syncStyles(startingStyles, endingStyles, computedStyle) {\n//   var property;\n//   for (property in startingStyles) {\n//     if (!endingStyles.hasOwnProperty(property)) {\n//       delete startingStyles[property];\n//     }\n//   }\n//   for (property in endingStyles) {\n//     if (!startingStyles.hasOwnProperty(property)) {\n//       startingStyles[property] = computedStyle[vendorizePropertyName(property)];\n//     }\n//   }\n// }\n\n// function makePropertyInterpolators(startingStyles, endingStyles) {\n//   var interpolators = {};\n//   var property;\n//   for (property in startingStyles) {\n//     interpolators[vendorizePropertyName(property)] = interpolate.propertyInterpolator(\n//       property, startingStyles[property], endingStyles[property]\n//     );\n//   }\n//   return interpolators;\n// }\n\n// var transformProperty;\n// function vendorizePropertyName(property) {\n//   if (property === 'transform') {\n//     //Set transformProperty lazily, to be sure DOM has loaded already when using it\n//     return transformProperty || \n//       (transformProperty = cssFeature('transform').property);\n//   } else {\n//     return property;\n//   }\n// }\n\n},{\"./core/dynamics\":6,\"./core/easing-functions\":7,\"./core/timeline\":8,\"./util/simple-emitter\":11,\"./util/uid\":12}],5:[function(_dereq_,module,exports){\n/*\n * Copyright (C) 2008 Apple Inc. All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// http://www.w3.org/TR/css3-transitions/#transition-easing-function\nmodule.exports =  {\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  linear: unitBezier(0.0, 0.0, 1.0, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  ease: unitBezier(0.25, 0.1, 0.25, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeIn: unitBezier(0.42, 0, 1.0, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeOut: unitBezier(0, 0, 0.58, 1.0),\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  easeInOut: unitBezier(0.42, 0, 0.58, 1.0),\n\n  /*\n   * @param p1x {number} X component of control point 1\n   * @param p1y {number} Y component of control point 1\n   * @param p2x {number} X component of control point 2\n   * @param p2y {number} Y component of control point 2\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  cubicBezier: function(p1x, p1y, p2x, p2y) {\n    return unitBezier(p1x, p1y, p2x, p2y);\n  }\n};\n\nfunction B1(t) { return t*t*t; }\nfunction B2(t) { return 3*t*t*(1-t); }\nfunction B3(t) { return 3*t*(1-t)*(1-t); }\nfunction B4(t) { return (1-t)*(1-t)*(1-t); }\n\n/*\n * JavaScript port of Webkit implementation of CSS cubic-bezier(p1x.p1y,p2x,p2y) by http://mck.me\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h\n */\n\n/*\n * Duration value to use when one is not specified (400ms is a common value).\n * @const\n * @type {number}\n */\nvar DEFAULT_DURATION = 400;//ms\n\n/*\n * The epsilon value we pass to UnitBezier::solve given that the animation is going to run over |dur| seconds.\n * The longer the animation, the more precision we need in the easing function result to avoid ugly discontinuities.\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/page/animation/AnimationBase.cpp\n */\nfunction solveEpsilon(duration) {\n  return 1.0 / (200.0 * duration);\n}\n\n/*\n * Defines a cubic-bezier curve given the middle two control points.\n * NOTE: first and last control points are implicitly (0,0) and (1,1).\n * @param p1x {number} X component of control point 1\n * @param p1y {number} Y component of control point 1\n * @param p2x {number} X component of control point 2\n * @param p2y {number} Y component of control point 2\n */\nfunction unitBezier(p1x, p1y, p2x, p2y) {\n\n  // private members --------------------------------------------\n\n  // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n\n  /*\n   * X component of Bezier coefficient C\n   * @const\n   * @type {number}\n   */\n  var cx = 3.0 * p1x;\n\n  /*\n   * X component of Bezier coefficient B\n   * @const\n   * @type {number}\n   */\n  var bx = 3.0 * (p2x - p1x) - cx;\n\n  /*\n   * X component of Bezier coefficient A\n   * @const\n   * @type {number}\n   */\n  var ax = 1.0 - cx -bx;\n\n  /*\n   * Y component of Bezier coefficient C\n   * @const\n   * @type {number}\n   */\n  var cy = 3.0 * p1y;\n\n  /*\n   * Y component of Bezier coefficient B\n   * @const\n   * @type {number}\n   */\n  var by = 3.0 * (p2y - p1y) - cy;\n\n  /*\n   * Y component of Bezier coefficient A\n   * @const\n   * @type {number}\n   */\n  var ay = 1.0 - cy - by;\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveX = function(t) {\n    // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n    return ((ax * t + bx) * t + cx) * t;\n  };\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveY = function(t) {\n    return ((ay * t + by) * t + cy) * t;\n  };\n\n  /*\n   * @param t {number} parametric easing value\n   * @return {number}\n   */\n  var sampleCurveDerivativeX = function(t) {\n    return (3.0 * ax * t + 2.0 * bx) * t + cx;\n  };\n\n  /*\n   * Given an x value, find a parametric value it came from.\n   * @param x {number} value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param epsilon {number} accuracy limit of t for the given x\n   * @return {number} the t value corresponding to x\n   */\n  var solveCurveX = function(x, epsilon) {\n    var t0;\n    var t1;\n    var t2;\n    var x2;\n    var d2;\n    var i;\n\n    // First try a few iterations of Newton's method -- normally very fast.\n    for (t2 = x, i = 0; i < 8; i++) {\n      x2 = sampleCurveX(t2) - x;\n      if (Math.abs (x2) < epsilon) {\n        return t2;\n      }\n      d2 = sampleCurveDerivativeX(t2);\n      if (Math.abs(d2) < 1e-6) {\n        break;\n      }\n      t2 = t2 - x2 / d2;\n    }\n\n    // Fall back to the bisection method for reliability.\n    t0 = 0.0;\n    t1 = 1.0;\n    t2 = x;\n\n    if (t2 < t0) {\n      return t0;\n    }\n    if (t2 > t1) {\n      return t1;\n    }\n\n    while (t0 < t1) {\n      x2 = sampleCurveX(t2);\n      if (Math.abs(x2 - x) < epsilon) {\n        return t2;\n      }\n      if (x > x2) {\n        t0 = t2;\n      } else {\n        t1 = t2;\n      }\n      t2 = (t1 - t0) * 0.5 + t0;\n    }\n\n    // Failure.\n    return t2;\n  };\n\n  /*\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param epsilon {number} the accuracy of t for the given x\n   * @return {number} the y value along the bezier curve\n   */\n  var solve = function(x, epsilon) {\n    return sampleCurveY(solveCurveX(x, epsilon));\n  };\n\n  // public interface --------------------------------------------\n\n  /*\n   * Find the y of the cubic-bezier for a given x with accuracy determined by the animation duration.\n   * @param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0\n   * @param duration {number} the duration of the animation in milliseconds\n   * @return {number} the y value along the bezier curve\n   */\n  return function(x, duration) {\n    return solve(x, solveEpsilon(+duration || DEFAULT_DURATION));\n  };\n}\n\n\n},{}],6:[function(_dereq_,module,exports){\n/**\n * A HUGE thank you to dynamics.js which inspired these dynamics simulations.\n * https://github.com/michaelvillar/dynamics.js\n *\n * Also licensed under MIT\n */\n\nvar extend = _dereq_('../util/extend');\n\nmodule.exports = {\n  spring: dynamicsSpring,\n  gravity: dynamicsGravity\n};\n\nvar springDefaults = {\n  frequency: 15,\n  friction: 200,\n  anticipationStrength: 0,\n  anticipationSize: 0\n};\nfunction dynamicsSpring(opts) {\n  opts = extend({}, springDefaults, opts || {});\n\n  return function at(t, duration) {\n    var A, At, a, angle, b, decal, frequency, friction, frictionT, s, v, y0, yS,\n    _opts = opts;\n    frequency = Math.max(1, opts.frequency);\n    friction = Math.pow(20, opts.friction / 100);\n    s = opts.anticipationSize / 100;\n    decal = Math.max(0, s);\n    frictionT = (t / (1 - s)) - (s / (1 - s));\n    if (t < s) {\n      A = function(t) {\n        var M, a, b, x0, x1;\n        M = 0.8;\n        x0 = s / (1 - s);\n        x1 = 0;\n        b = (x0 - (M * x1)) / (x0 - x1);\n        a = (M - b) / x0;\n        return (a * t * _opts.anticipationStrength / 100) + b;\n      };\n      yS = (s / (1 - s)) - (s / (1 - s));\n      y0 = (0 / (1 - s)) - (s / (1 - s));\n      b = Math.acos(1 / A(yS));\n      a = (Math.acos(1 / A(y0)) - b) / (frequency * (-s));\n    } else {\n      A = function(t) {\n        return Math.pow(friction / 10, -t) * (1 - t);\n      };\n      b = 0;\n      a = 1;\n    }\n    At = A(frictionT);\n    angle = frequency * (t - s) * a + b;\n    v = 1 - (At * Math.cos(angle));\n    //return [t, v, At, frictionT, angle];\n    return v;\n  };\n}\n\nvar gravityDefaults = {\n  bounce: 40,\n  gravity: 1000,\n  initialForce: false\n};\nfunction dynamicsGravity(opts) {\n  opts = extend({}, gravityDefaults, opts || {});\n  var curves = [];\n\n  init();\n\n  return at;\n\n  function length() {\n    var L, b, bounce, curve, gravity;\n    bounce = Math.min(opts.bounce / 100, 80);\n    gravity = opts.gravity / 100;\n    b = Math.sqrt(2 / gravity);\n    curve = {\n      a: -b,\n      b: b,\n      H: 1\n    };\n    if (opts.initialForce) {\n      curve.a = 0;\n      curve.b = curve.b * 2;\n    }\n    while (curve.H > 0.001) {\n      L = curve.b - curve.a;\n      curve = {\n        a: curve.b,\n        b: curve.b + L * bounce,\n        H: curve.H * bounce * bounce\n      };\n    }\n    return curve.b;\n  }\n\n  function init() {\n    var L, b, bounce, curve, gravity, _results;\n\n    L = length();\n    gravity = (opts.gravity / 100) * L * L;\n    bounce = Math.min(opts.bounce / 100, 80);\n    b = Math.sqrt(2 / gravity);\n    curves = [];\n    curve = {\n      a: -b,\n      b: b,\n      H: 1\n    };\n    if (opts.initialForce) {\n      curve.a = 0;\n      curve.b = curve.b * 2;\n    }\n    curves.push(curve);\n    _results = [];\n    while (curve.b < 1 && curve.H > 0.001) {\n      L = curve.b - curve.a;\n      curve = {\n        a: curve.b,\n        b: curve.b + L * bounce,\n        H: curve.H * bounce * bounce\n      };\n      _results.push(curves.push(curve));\n    }\n    return _results;\n  }\n\n  function calculateCurve(a, b, H, t){\n    var L, c, t2;\n    L = b - a;\n    t2 = (2 / L) * t - 1 - (a * 2 / L);\n    c = t2 * t2 * H - H + 1;\n    if (opts.initialForce) {\n      c = 1 - c;\n    }\n    return c;\n  }\n\n  function at(t, duration) {\n    var bounce, curve, gravity, i, v;\n    bounce = opts.bounce / 100;\n    gravity = opts.gravity;\n    i = 0;\n    curve = curves[i];\n    while (!(t >= curve.a && t <= curve.b)) {\n      i += 1;\n      curve = curves[i];\n      if (!curve) {\n        break;\n      }\n    }\n    if (!curve) {\n      v = opts.initialForce ? 0 : 1;\n    } else {\n      v = calculateCurve(curve.a, curve.b, curve.H, t);\n    }\n    //return [t, v];\n    return v;\n  }\n\n};\n\n},{\"../util/extend\":10}],7:[function(_dereq_,module,exports){\nvar dynamics = _dereq_('./dynamics');\nvar bezier = _dereq_('./bezier');\n\nmodule.exports = {\n  'linear': function() {\n    return function(t, duration) {\n      return bezier.linear(t, duration);\n    };\n  },\n  'ease': function() {\n    return function(t, duration) {\n      return bezier.ease(t, duration);\n    };\n  },\n  'ease-in': function() {\n    return function(t, duration) {\n      return bezier.easeIn(t, duration);\n    };\n  },\n  'ease-out': function() {\n    return function(t, duration) {\n      return bezier.easeOut(t, duration);\n    };\n  },\n  'ease-in-out': function() {\n    return function(t, duration) {\n      return bezier.easeInOut(t, duration);\n    };\n  },\n  'cubic-bezier': function(x1, y1, x2, y2, duration) {\n    var bz = bezier.cubicBezier(x1, y1, x2, y2);//, t, duration);\n    return function(t, duration) {\n      return bz(t, duration);\n    };\n  }\n};\n\n},{\"./bezier\":5,\"./dynamics\":6}],8:[function(_dereq_,module,exports){\n\nvar raf = _dereq_('raf');\nvar time = _dereq_('performance-now');\n\nvar self = module.exports = {\n  _running: {},\n\n  animationStarted: function(instance) {\n    self._running[instance._.id] = instance;\n\n    if (!self.isTicking) {\n      self.tick();\n    }\n  },\n\n  animationStopped: function(instance) {\n    delete self._running[instance._.id];\n    self.maybeStopTicking();\n  },\n\n  tick: function() {\n    var lastFrame = time();\n\n    self.isTicking = true;\n    self._rafId = raf(step);\n\n    function step() {\n      self._rafId = raf(step);\n\n      // Get current time\n      var now = time();\n      var deltaT = now - lastFrame;\n\n      for (var animationId in self._running) {\n        self._running[animationId]._tick(deltaT);\n      }\n\n      lastFrame = now;\n    }\n  },\n\n  maybeStopTicking: function() {\n    if (self.isTicking && !Object.keys(self._running).length) {\n      raf.cancel(self._rafId);\n      self.isTicking = false;\n    }\n  },\n\n};\n\n\n},{\"performance-now\":1,\"raf\":2}],9:[function(_dereq_,module,exports){\nmodule.exports = {\n  animator: _dereq_('./animator')\n};\n\n},{\"./animator\":4}],10:[function(_dereq_,module,exports){\n\n/*\n * There really is no tiny minimal extend() on npm to find,\n * so we just use our own.\n */\n\nmodule.exports = function extend(obj) {\n   var args = Array.prototype.slice.call(arguments, 1);\n   for(var i = 0; i < args.length; i++) {\n     var source = args[i];\n     if (source) {\n       for (var prop in source) {\n         obj[prop] = source[prop];\n       }\n     }\n   }\n   return obj;\n};\n\n},{}],11:[function(_dereq_,module,exports){\n\n// All we want is an eventEmitter that doesn't use #call or #apply,\n// by expecting 0-1 arguments. \n// We couldn't find this on npm, so we make our own.\n\nmodule.exports = SimpleEventEmitter;\n\nfunction SimpleEventEmitter() {\n}\n\nSimpleEventEmitter.prototype = {\n  listeners: [],\n  on: function(eventType, fn) {\n    if (typeof fn !== 'function') return;\n    this.listeners[eventType] || (this.listeners[eventType] = []);\n    this.listeners[eventType].push(fn);\n  },\n  once: function(eventType, fn) {\n    var self = this;\n    function onceFn() {\n      self.off(eventType, fn);\n      self.off(eventType, onceFn);\n    }\n    this.on(eventType, fn);\n    this.on(eventType, onceFn);\n  },\n  // Built-in limitation: we only expect 0-1 arguments\n  // This is to save as much perf as possible when sending\n  // events every frame.\n  emit: function(eventType, eventArg) {\n    var listeners = this.listeners[eventType] || [];\n    var i = 0;\n    var len = listeners.length;\n    if (arguments.length === 2) {\n      for (i; i < len; i++) listeners[i] && listeners[i](eventArg);\n    } else {\n      for (i; i < len; i++) listeners[i] && listeners[i]();\n    }\n  },\n  off: function(eventType, fnToRemove) {\n    if (!eventType) {\n      //Remove all listeners\n      for (var type in this.listeners) {\n        this.off(type);\n      }\n    } else  {\n      var listeners = this.listeners[eventType];\n      if (listeners) {\n        if (!fnToRemove) {\n          listeners.length = 0;\n        } else {\n          var index = listeners.indexOf(fnToRemove);\n          listeners.splice(index, 1);\n        }\n      }\n    }\n  } \n};\n\n},{}],12:[function(_dereq_,module,exports){\n\n/**\n * nextUid() from angular.js\n * License MIT\n * http://github.com/angular/angular.js\n *\n * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric\n * characters such as '012ABC'. The reason why we are not using simply a number counter is that\n * the number string gets longer over time, and it can also overflow, where as the nextId\n * will grow much slower, it is a string, and it will never overflow.\n *\n * @returns an unique alpha-numeric string\n */\nvar uid = [];\n\nmodule.exports = function nextUid() {\n  var index = uid.length;\n  var digit;\n\n  while(index) {\n    index--;\n    digit = uid[index].charCodeAt(0);\n    if (digit == 57 /*'9'*/) {\n      uid[index] = 'A';\n      return uid.join('');\n    }\n    if (digit == 90  /*'Z'*/) {\n      uid[index] = '0';\n    } else {\n      uid[index] = String.fromCharCode(digit + 1);\n      return uid.join('');\n    }\n  }\n  uid.unshift('0');\n  return uid.join('');\n};\n\n},{}],13:[function(_dereq_,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\n\nprocess.nextTick = (function () {\n    var canSetImmediate = typeof window !== 'undefined'\n    && window.setImmediate;\n    var canPost = typeof window !== 'undefined'\n    && window.postMessage && window.addEventListener\n    ;\n\n    if (canSetImmediate) {\n        return function (f) { return window.setImmediate(f) };\n    }\n\n    if (canPost) {\n        var queue = [];\n        window.addEventListener('message', function (ev) {\n            var source = ev.source;\n            if ((source === window || source === null) && ev.data === 'process-tick') {\n                ev.stopPropagation();\n                if (queue.length > 0) {\n                    var fn = queue.shift();\n                    fn();\n                }\n            }\n        }, true);\n\n        return function nextTick(fn) {\n            queue.push(fn);\n            window.postMessage('process-tick', '*');\n        };\n    }\n\n    return function nextTick(fn) {\n        setTimeout(fn, 0);\n    };\n})();\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n}\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\n\n},{}]},{},[9])\n(9)\n});\n})();"
  },
  {
    "path": "www/lib/ionic/js/ionic.js",
    "content": "/*!\n * Copyright 2014 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.0.0-beta.12\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n\n(function() {\n\n// Create global ionic obj and its namespaces\n// build processes may have already created an ionic obj\nwindow.ionic = window.ionic || {};\nwindow.ionic.views = {};\nwindow.ionic.version = '1.0.0-beta.12';\n\n(function(window, document, ionic) {\n\n  var readyCallbacks = [];\n  var isDomReady = false;\n\n  function domReady() {\n    isDomReady = true;\n    for(var x=0; x<readyCallbacks.length; x++) {\n      ionic.requestAnimationFrame(readyCallbacks[x]);\n    }\n    readyCallbacks = [];\n    document.removeEventListener('DOMContentLoaded', domReady);\n  }\n  document.addEventListener('DOMContentLoaded', domReady);\n\n  // From the man himself, Mr. Paul Irish.\n  // The requestAnimationFrame polyfill\n  // Put it on window just to preserve its context\n  // without having to use .call\n  window._rAF = (function(){\n    return  window.requestAnimationFrame       ||\n            window.webkitRequestAnimationFrame ||\n            window.mozRequestAnimationFrame    ||\n            function( callback ){\n              window.setTimeout(callback, 16);\n            };\n  })();\n\n  var cancelAnimationFrame = window.cancelAnimationFrame ||\n    window.webkitCancelAnimationFrame ||\n    window.mozCancelAnimationFrame ||\n    window.webkitCancelRequestAnimationFrame;\n\n  /**\n  * @ngdoc utility\n  * @name ionic.DomUtil\n  * @module ionic\n  */\n  ionic.DomUtil = {\n    //Call with proper context\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#requestAnimationFrame\n     * @alias ionic.requestAnimationFrame\n     * @description Calls [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame), or a polyfill if not available.\n     * @param {function} callback The function to call when the next frame\n     * happens.\n     */\n    requestAnimationFrame: function(cb) {\n      return window._rAF(cb);\n    },\n\n    cancelAnimationFrame: function(requestId) {\n      cancelAnimationFrame(requestId);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#animationFrameThrottle\n     * @alias ionic.animationFrameThrottle\n     * @description\n     * When given a callback, if that callback is called 100 times between\n     * animation frames, adding Throttle will make it only run the last of\n     * the 100 calls.\n     *\n     * @param {function} callback a function which will be throttled to\n     * requestAnimationFrame\n     * @returns {function} A function which will then call the passed in callback.\n     * The passed in callback will receive the context the returned function is\n     * called with.\n     */\n    animationFrameThrottle: function(cb) {\n      var args, isQueued, context;\n      return function() {\n        args = arguments;\n        context = this;\n        if (!isQueued) {\n          isQueued = true;\n          ionic.requestAnimationFrame(function() {\n            cb.apply(context, args);\n            isQueued = false;\n          });\n        }\n      };\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getPositionInParent\n     * @description\n     * Find an element's scroll offset within its container.\n     * @param {DOMElement} element The element to find the offset of.\n     * @returns {object} A position object with the following properties:\n     *   - `{number}` `left` The left offset of the element.\n     *   - `{number}` `top` The top offset of the element.\n     */\n    getPositionInParent: function(el) {\n      return {\n        left: el.offsetLeft,\n        top: el.offsetTop\n      };\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#ready\n     * @description\n     * Call a function when the DOM is ready, or if it is already ready\n     * call the function immediately.\n     * @param {function} callback The function to be called.\n     */\n    ready: function(cb) {\n      if(isDomReady || document.readyState === \"complete\") {\n        ionic.requestAnimationFrame(cb);\n      } else {\n        readyCallbacks.push(cb);\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getTextBounds\n     * @description\n     * Get a rect representing the bounds of the given textNode.\n     * @param {DOMElement} textNode The textNode to find the bounds of.\n     * @returns {object} An object representing the bounds of the node. Properties:\n     *   - `{number}` `left` The left position of the textNode.\n     *   - `{number}` `right` The right position of the textNode.\n     *   - `{number}` `top` The top position of the textNode.\n     *   - `{number}` `bottom` The bottom position of the textNode.\n     *   - `{number}` `width` The width of the textNode.\n     *   - `{number}` `height` The height of the textNode.\n     */\n    getTextBounds: function(textNode) {\n      if(document.createRange) {\n        var range = document.createRange();\n        range.selectNodeContents(textNode);\n        if(range.getBoundingClientRect) {\n          var rect = range.getBoundingClientRect();\n          if(rect) {\n            var sx = window.scrollX;\n            var sy = window.scrollY;\n\n            return {\n              top: rect.top + sy,\n              left: rect.left + sx,\n              right: rect.left + sx + rect.width,\n              bottom: rect.top + sy + rect.height,\n              width: rect.width,\n              height: rect.height\n            };\n          }\n        }\n      }\n      return null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getChildIndex\n     * @description\n     * Get the first index of a child node within the given element of the\n     * specified type.\n     * @param {DOMElement} element The element to find the index of.\n     * @param {string} type The nodeName to match children of element against.\n     * @returns {number} The index, or -1, of a child with nodeName matching type.\n     */\n    getChildIndex: function(element, type) {\n      if(type) {\n        var ch = element.parentNode.children;\n        var c;\n        for(var i = 0, k = 0, j = ch.length; i < j; i++) {\n          c = ch[i];\n          if(c.nodeName && c.nodeName.toLowerCase() == type) {\n            if(c == element) {\n              return k;\n            }\n            k++;\n          }\n        }\n      }\n      return Array.prototype.slice.call(element.parentNode.children).indexOf(element);\n    },\n\n    /**\n     * @private\n     */\n    swapNodes: function(src, dest) {\n      dest.parentNode.insertBefore(src, dest);\n    },\n\n    elementIsDescendant: function(el, parent, stopAt) {\n      var current = el;\n      do {\n        if (current === parent) return true;\n        current = current.parentNode;\n      } while (current && current !== stopAt);\n      return false;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getParentWithClass\n     * @param {DOMElement} element\n     * @param {string} className\n     * @returns {DOMElement} The closest parent of element matching the\n     * className, or null.\n     */\n    getParentWithClass: function(e, className, depth) {\n      depth = depth || 10;\n      while(e.parentNode && depth--) {\n        if(e.parentNode.classList && e.parentNode.classList.contains(className)) {\n          return e.parentNode;\n        }\n        e = e.parentNode;\n      }\n      return null;\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getParentOrSelfWithClass\n     * @param {DOMElement} element\n     * @param {string} className\n     * @returns {DOMElement} The closest parent or self matching the\n     * className, or null.\n     */\n    getParentOrSelfWithClass: function(e, className, depth) {\n      depth = depth || 10;\n      while(e && depth--) {\n        if(e.classList && e.classList.contains(className)) {\n          return e;\n        }\n        e = e.parentNode;\n      }\n      return null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#rectContains\n     * @param {number} x\n     * @param {number} y\n     * @param {number} x1\n     * @param {number} y1\n     * @param {number} x2\n     * @param {number} y2\n     * @returns {boolean} Whether {x,y} fits within the rectangle defined by\n     * {x1,y1,x2,y2}.\n     */\n    rectContains: function(x, y, x1, y1, x2, y2) {\n      if(x < x1 || x > x2) return false;\n      if(y < y1 || y > y2) return false;\n      return true;\n    }\n  };\n\n  //Shortcuts\n  ionic.requestAnimationFrame = ionic.DomUtil.requestAnimationFrame;\n  ionic.cancelAnimationFrame = ionic.DomUtil.cancelAnimationFrame;\n  ionic.animationFrameThrottle = ionic.DomUtil.animationFrameThrottle;\n})(window, document, ionic);\n\n/**\n * ion-events.js\n *\n * Author: Max Lynch <max@drifty.com>\n *\n * Framework events handles various mobile browser events, and\n * detects special events like tap/swipe/etc. and emits them\n * as custom events that can be used in an app.\n *\n * Portions lovingly adapted from github.com/maker/ratchet and github.com/alexgibson/tap.js - thanks guys!\n */\n\n(function(ionic) {\n\n  // Custom event polyfill\n  ionic.CustomEvent = (function() {\n    if( typeof window.CustomEvent === 'function' ) return CustomEvent;\n\n    var customEvent = function(event, params) {\n      var evt;\n      params = params || {\n        bubbles: false,\n        cancelable: false,\n        detail: undefined\n      };\n      try {\n        evt = document.createEvent(\"CustomEvent\");\n        evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n      } catch (error) {\n        // fallback for browsers that don't support createEvent('CustomEvent')\n        evt = document.createEvent(\"Event\");\n        for (var param in params) {\n          evt[param] = params[param];\n        }\n        evt.initEvent(event, params.bubbles, params.cancelable);\n      }\n      return evt;\n    };\n    customEvent.prototype = window.Event.prototype;\n    return customEvent;\n  })();\n\n\n  /**\n   * @ngdoc utility\n   * @name ionic.EventController\n   * @module ionic\n   */\n  ionic.EventController = {\n    VIRTUALIZED_EVENTS: ['tap', 'swipe', 'swiperight', 'swipeleft', 'drag', 'hold', 'release'],\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#trigger\n     * @alias ionic.trigger\n     * @param {string} eventType The event to trigger.\n     * @param {object} data The data for the event. Hint: pass in\n     * `{target: targetElement}`\n     * @param {boolean=} bubbles Whether the event should bubble up the DOM.\n     * @param {boolean=} cancelable Whether the event should be cancelable.\n     */\n    // Trigger a new event\n    trigger: function(eventType, data, bubbles, cancelable) {\n      var event = new ionic.CustomEvent(eventType, {\n        detail: data,\n        bubbles: !!bubbles,\n        cancelable: !!cancelable\n      });\n\n      // Make sure to trigger the event on the given target, or dispatch it from\n      // the window if we don't have an event target\n      data && data.target && data.target.dispatchEvent && data.target.dispatchEvent(event) || window.dispatchEvent(event);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#on\n     * @alias ionic.on\n     * @description Listen to an event on an element.\n     * @param {string} type The event to listen for.\n     * @param {function} callback The listener to be called.\n     * @param {DOMElement} element The element to listen for the event on.\n     */\n    on: function(type, callback, element) {\n      var e = element || window;\n\n      // Bind a gesture if it's a virtual event\n      for(var i = 0, j = this.VIRTUALIZED_EVENTS.length; i < j; i++) {\n        if(type == this.VIRTUALIZED_EVENTS[i]) {\n          var gesture = new ionic.Gesture(element);\n          gesture.on(type, callback);\n          return gesture;\n        }\n      }\n\n      // Otherwise bind a normal event\n      e.addEventListener(type, callback);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#off\n     * @alias ionic.off\n     * @description Remove an event listener.\n     * @param {string} type\n     * @param {function} callback\n     * @param {DOMElement} element\n     */\n    off: function(type, callback, element) {\n      element.removeEventListener(type, callback);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#onGesture\n     * @alias ionic.onGesture\n     * @description Add an event listener for a gesture on an element.\n     *\n     * Available eventTypes (from [hammer.js](http://eightmedia.github.io/hammer.js/)):\n     *\n     * `hold`, `tap`, `doubletap`, `drag`, `dragstart`, `dragend`, `dragup`, `dragdown`, <br/>\n     * `dragleft`, `dragright`, `swipe`, `swipeup`, `swipedown`, `swipeleft`, `swiperight`, <br/>\n     * `transform`, `transformstart`, `transformend`, `rotate`, `pinch`, `pinchin`, `pinchout`, </br>\n     * `touch`, `release`\n     *\n     * @param {string} eventType The gesture event to listen for.\n     * @param {function(e)} callback The function to call when the gesture\n     * happens.\n     * @param {DOMElement} element The angular element to listen for the event on.\n     */\n    onGesture: function(type, callback, element, options) {\n      var gesture = new ionic.Gesture(element, options);\n      gesture.on(type, callback);\n      return gesture;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#offGesture\n     * @alias ionic.offGesture\n     * @description Remove an event listener for a gesture on an element.\n     * @param {string} eventType The gesture event.\n     * @param {function(e)} callback The listener that was added earlier.\n     * @param {DOMElement} element The element the listener was added on.\n     */\n    offGesture: function(gesture, type, callback) {\n      gesture.off(type, callback);\n    },\n\n    handlePopState: function(event) {}\n  };\n\n\n  // Map some convenient top-level functions for event handling\n  ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); };\n  ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); };\n  ionic.trigger = ionic.EventController.trigger;//function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); };\n  ionic.onGesture = function() { return ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); };\n  ionic.offGesture = function() { return ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); };\n\n})(window.ionic);\n\n/**\n  * Simple gesture controllers with some common gestures that emit\n  * gesture events.\n  *\n  * Ported from github.com/EightMedia/hammer.js Gestures - thanks!\n  */\n(function(ionic) {\n\n  /**\n   * ionic.Gestures\n   * use this to create instances\n   * @param   {HTMLElement}   element\n   * @param   {Object}        options\n   * @returns {ionic.Gestures.Instance}\n   * @constructor\n   */\n  ionic.Gesture = function(element, options) {\n    return new ionic.Gestures.Instance(element, options || {});\n  };\n\n  ionic.Gestures = {};\n\n  // default settings\n  ionic.Gestures.defaults = {\n    // add css to the element to prevent the browser from doing\n    // its native behavior. this doesnt prevent the scrolling,\n    // but cancels the contextmenu, tap highlighting etc\n    // set to false to disable this\n    stop_browser_behavior: 'disable-user-behavior'\n  };\n\n  // detect touchevents\n  ionic.Gestures.HAS_POINTEREVENTS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled;\n  ionic.Gestures.HAS_TOUCHEVENTS = ('ontouchstart' in window);\n\n  // dont use mouseevents on mobile devices\n  ionic.Gestures.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i;\n  ionic.Gestures.NO_MOUSEEVENTS = ionic.Gestures.HAS_TOUCHEVENTS && window.navigator.userAgent.match(ionic.Gestures.MOBILE_REGEX);\n\n  // eventtypes per touchevent (start, move, end)\n  // are filled by ionic.Gestures.event.determineEventTypes on setup\n  ionic.Gestures.EVENT_TYPES = {};\n\n  // direction defines\n  ionic.Gestures.DIRECTION_DOWN = 'down';\n  ionic.Gestures.DIRECTION_LEFT = 'left';\n  ionic.Gestures.DIRECTION_UP = 'up';\n  ionic.Gestures.DIRECTION_RIGHT = 'right';\n\n  // pointer type\n  ionic.Gestures.POINTER_MOUSE = 'mouse';\n  ionic.Gestures.POINTER_TOUCH = 'touch';\n  ionic.Gestures.POINTER_PEN = 'pen';\n\n  // touch event defines\n  ionic.Gestures.EVENT_START = 'start';\n  ionic.Gestures.EVENT_MOVE = 'move';\n  ionic.Gestures.EVENT_END = 'end';\n\n  // hammer document where the base events are added at\n  ionic.Gestures.DOCUMENT = window.document;\n\n  // plugins namespace\n  ionic.Gestures.plugins = {};\n\n  // if the window events are set...\n  ionic.Gestures.READY = false;\n\n  /**\n   * setup events to detect gestures on the document\n   */\n  function setup() {\n    if(ionic.Gestures.READY) {\n      return;\n    }\n\n    // find what eventtypes we add listeners to\n    ionic.Gestures.event.determineEventTypes();\n\n    // Register all gestures inside ionic.Gestures.gestures\n    for(var name in ionic.Gestures.gestures) {\n      if(ionic.Gestures.gestures.hasOwnProperty(name)) {\n        ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);\n      }\n    }\n\n    // Add touch events on the document\n    ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_MOVE, ionic.Gestures.detection.detect);\n    ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_END, ionic.Gestures.detection.detect);\n\n    // ionic.Gestures is ready...!\n    ionic.Gestures.READY = true;\n  }\n\n  /**\n   * create new hammer instance\n   * all methods should return the instance itself, so it is chainable.\n   * @param   {HTMLElement}       element\n   * @param   {Object}            [options={}]\n   * @returns {ionic.Gestures.Instance}\n   * @name Gesture.Instance\n   * @constructor\n   */\n  ionic.Gestures.Instance = function(element, options) {\n    var self = this;\n\n    // A null element was passed into the instance, which means\n    // whatever lookup was done to find this element failed to find it\n    // so we can't listen for events on it.\n    if(element === null) {\n      void 0;\n      return;\n    }\n\n    // setup ionic.GesturesJS window events and register all gestures\n    // this also sets up the default options\n    setup();\n\n    this.element = element;\n\n    // start/stop detection option\n    this.enabled = true;\n\n    // merge options\n    this.options = ionic.Gestures.utils.extend(\n        ionic.Gestures.utils.extend({}, ionic.Gestures.defaults),\n        options || {});\n\n    // add some css to the element to prevent the browser from doing its native behavoir\n    if(this.options.stop_browser_behavior) {\n      ionic.Gestures.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);\n    }\n\n    // start detection on touchstart\n    ionic.Gestures.event.onTouch(element, ionic.Gestures.EVENT_START, function(ev) {\n      if(self.enabled) {\n        ionic.Gestures.detection.startDetect(self, ev);\n      }\n    });\n\n    // return instance\n    return this;\n  };\n\n\n  ionic.Gestures.Instance.prototype = {\n    /**\n     * bind events to the instance\n     * @param   {String}      gesture\n     * @param   {Function}    handler\n     * @returns {ionic.Gestures.Instance}\n     */\n    on: function onEvent(gesture, handler){\n      var gestures = gesture.split(' ');\n      for(var t=0; t<gestures.length; t++) {\n        this.element.addEventListener(gestures[t], handler, false);\n      }\n      return this;\n    },\n\n\n    /**\n     * unbind events to the instance\n     * @param   {String}      gesture\n     * @param   {Function}    handler\n     * @returns {ionic.Gestures.Instance}\n     */\n    off: function offEvent(gesture, handler){\n      var gestures = gesture.split(' ');\n      for(var t=0; t<gestures.length; t++) {\n        this.element.removeEventListener(gestures[t], handler, false);\n      }\n      return this;\n    },\n\n\n    /**\n     * trigger gesture event\n     * @param   {String}      gesture\n     * @param   {Object}      eventData\n     * @returns {ionic.Gestures.Instance}\n     */\n    trigger: function triggerEvent(gesture, eventData){\n      // create DOM event\n      var event = ionic.Gestures.DOCUMENT.createEvent('Event');\n      event.initEvent(gesture, true, true);\n      event.gesture = eventData;\n\n      // trigger on the target if it is in the instance element,\n      // this is for event delegation tricks\n      var element = this.element;\n      if(ionic.Gestures.utils.hasParent(eventData.target, element)) {\n        element = eventData.target;\n      }\n\n      element.dispatchEvent(event);\n      return this;\n    },\n\n\n    /**\n     * enable of disable hammer.js detection\n     * @param   {Boolean}   state\n     * @returns {ionic.Gestures.Instance}\n     */\n    enable: function enable(state) {\n      this.enabled = state;\n      return this;\n    }\n  };\n\n  /**\n   * this holds the last move event,\n   * used to fix empty touchend issue\n   * see the onTouch event for an explanation\n   * type {Object}\n   */\n  var last_move_event = null;\n\n\n  /**\n   * when the mouse is hold down, this is true\n   * type {Boolean}\n   */\n  var enable_detect = false;\n\n\n  /**\n   * when touch events have been fired, this is true\n   * type {Boolean}\n   */\n  var touch_triggered = false;\n\n\n  ionic.Gestures.event = {\n    /**\n     * simple addEventListener\n     * @param   {HTMLElement}   element\n     * @param   {String}        type\n     * @param   {Function}      handler\n     */\n    bindDom: function(element, type, handler) {\n      var types = type.split(' ');\n      for(var t=0; t<types.length; t++) {\n        element.addEventListener(types[t], handler, false);\n      }\n    },\n\n\n    /**\n     * touch events with mouse fallback\n     * @param   {HTMLElement}   element\n     * @param   {String}        eventType        like ionic.Gestures.EVENT_MOVE\n     * @param   {Function}      handler\n     */\n    onTouch: function onTouch(element, eventType, handler) {\n      var self = this;\n\n      this.bindDom(element, ionic.Gestures.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {\n        var sourceEventType = ev.type.toLowerCase();\n\n        // onmouseup, but when touchend has been fired we do nothing.\n        // this is for touchdevices which also fire a mouseup on touchend\n        if(sourceEventType.match(/mouse/) && touch_triggered) {\n          return;\n        }\n\n        // mousebutton must be down or a touch event\n        else if( sourceEventType.match(/touch/) ||   // touch events are always on screen\n          sourceEventType.match(/pointerdown/) || // pointerevents touch\n          (sourceEventType.match(/mouse/) && ev.which === 1)   // mouse is pressed\n          ){\n            enable_detect = true;\n          }\n\n        // mouse isn't pressed\n        else if(sourceEventType.match(/mouse/) && ev.which !== 1) {\n          enable_detect = false;\n        }\n\n\n        // we are in a touch event, set the touch triggered bool to true,\n        // this for the conflicts that may occur on ios and android\n        if(sourceEventType.match(/touch|pointer/)) {\n          touch_triggered = true;\n        }\n\n        // count the total touches on the screen\n        var count_touches = 0;\n\n        // when touch has been triggered in this detection session\n        // and we are now handling a mouse event, we stop that to prevent conflicts\n        if(enable_detect) {\n          // update pointerevent\n          if(ionic.Gestures.HAS_POINTEREVENTS && eventType != ionic.Gestures.EVENT_END) {\n            count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);\n          }\n          // touch\n          else if(sourceEventType.match(/touch/)) {\n            count_touches = ev.touches.length;\n          }\n          // mouse\n          else if(!touch_triggered) {\n            count_touches = sourceEventType.match(/up/) ? 0 : 1;\n          }\n\n          // if we are in a end event, but when we remove one touch and\n          // we still have enough, set eventType to move\n          if(count_touches > 0 && eventType == ionic.Gestures.EVENT_END) {\n            eventType = ionic.Gestures.EVENT_MOVE;\n          }\n          // no touches, force the end event\n          else if(!count_touches) {\n            eventType = ionic.Gestures.EVENT_END;\n          }\n\n          // store the last move event\n          if(count_touches || last_move_event === null) {\n            last_move_event = ev;\n          }\n\n          // trigger the handler\n          handler.call(ionic.Gestures.detection, self.collectEventData(element, eventType, self.getTouchList(last_move_event, eventType), ev));\n\n          // remove pointerevent from list\n          if(ionic.Gestures.HAS_POINTEREVENTS && eventType == ionic.Gestures.EVENT_END) {\n            count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);\n          }\n        }\n\n        //debug(sourceEventType +\" \"+ eventType);\n\n        // on the end we reset everything\n        if(!count_touches) {\n          last_move_event = null;\n          enable_detect = false;\n          touch_triggered = false;\n          ionic.Gestures.PointerEvent.reset();\n        }\n      });\n    },\n\n\n    /**\n     * we have different events for each device/browser\n     * determine what we need and set them in the ionic.Gestures.EVENT_TYPES constant\n     */\n    determineEventTypes: function determineEventTypes() {\n      // determine the eventtype we want to set\n      var types;\n\n      // pointerEvents magic\n      if(ionic.Gestures.HAS_POINTEREVENTS) {\n        types = ionic.Gestures.PointerEvent.getEvents();\n      }\n      // on Android, iOS, blackberry, windows mobile we dont want any mouseevents\n      else if(ionic.Gestures.NO_MOUSEEVENTS) {\n        types = [\n          'touchstart',\n          'touchmove',\n          'touchend touchcancel'];\n      }\n      // for non pointer events browsers and mixed browsers,\n      // like chrome on windows8 touch laptop\n      else {\n        types = [\n          'touchstart mousedown',\n          'touchmove mousemove',\n          'touchend touchcancel mouseup'];\n      }\n\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_START]  = types[0];\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_MOVE]   = types[1];\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_END]    = types[2];\n    },\n\n\n    /**\n     * create touchlist depending on the event\n     * @param   {Object}    ev\n     * @param   {String}    eventType   used by the fakemultitouch plugin\n     */\n    getTouchList: function getTouchList(ev/*, eventType*/) {\n      // get the fake pointerEvent touchlist\n      if(ionic.Gestures.HAS_POINTEREVENTS) {\n        return ionic.Gestures.PointerEvent.getTouchList();\n      }\n      // get the touchlist\n      else if(ev.touches) {\n        return ev.touches;\n      }\n      // make fake touchlist from mouse position\n      else {\n        ev.identifier = 1;\n        return [ev];\n      }\n    },\n\n\n    /**\n     * collect event data for ionic.Gestures js\n     * @param   {HTMLElement}   element\n     * @param   {String}        eventType        like ionic.Gestures.EVENT_MOVE\n     * @param   {Object}        eventData\n     */\n    collectEventData: function collectEventData(element, eventType, touches, ev) {\n\n      // find out pointerType\n      var pointerType = ionic.Gestures.POINTER_TOUCH;\n      if(ev.type.match(/mouse/) || ionic.Gestures.PointerEvent.matchType(ionic.Gestures.POINTER_MOUSE, ev)) {\n        pointerType = ionic.Gestures.POINTER_MOUSE;\n      }\n\n      return {\n        center      : ionic.Gestures.utils.getCenter(touches),\n                    timeStamp   : new Date().getTime(),\n                    target      : ev.target,\n                    touches     : touches,\n                    eventType   : eventType,\n                    pointerType : pointerType,\n                    srcEvent    : ev,\n\n                    /**\n                     * prevent the browser default actions\n                     * mostly used to disable scrolling of the browser\n                     */\n                    preventDefault: function() {\n                      if(this.srcEvent.preventManipulation) {\n                        this.srcEvent.preventManipulation();\n                      }\n\n                      if(this.srcEvent.preventDefault) {\n                        //this.srcEvent.preventDefault();\n                      }\n                    },\n\n                    /**\n                     * stop bubbling the event up to its parents\n                     */\n                    stopPropagation: function() {\n                      this.srcEvent.stopPropagation();\n                    },\n\n                    /**\n                     * immediately stop gesture detection\n                     * might be useful after a swipe was detected\n                     * @return {*}\n                     */\n                    stopDetect: function() {\n                      return ionic.Gestures.detection.stopDetect();\n                    }\n      };\n    }\n  };\n\n  ionic.Gestures.PointerEvent = {\n    /**\n     * holds all pointers\n     * type {Object}\n     */\n    pointers: {},\n\n    /**\n     * get a list of pointers\n     * @returns {Array}     touchlist\n     */\n    getTouchList: function() {\n      var self = this;\n      var touchlist = [];\n\n      // we can use forEach since pointerEvents only is in IE10\n      Object.keys(self.pointers).sort().forEach(function(id) {\n        touchlist.push(self.pointers[id]);\n      });\n      return touchlist;\n    },\n\n    /**\n     * update the position of a pointer\n     * @param   {String}   type             ionic.Gestures.EVENT_END\n     * @param   {Object}   pointerEvent\n     */\n    updatePointer: function(type, pointerEvent) {\n      if(type == ionic.Gestures.EVENT_END) {\n        this.pointers = {};\n      }\n      else {\n        pointerEvent.identifier = pointerEvent.pointerId;\n        this.pointers[pointerEvent.pointerId] = pointerEvent;\n      }\n\n      return Object.keys(this.pointers).length;\n    },\n\n    /**\n     * check if ev matches pointertype\n     * @param   {String}        pointerType     ionic.Gestures.POINTER_MOUSE\n     * @param   {PointerEvent}  ev\n     */\n    matchType: function(pointerType, ev) {\n      if(!ev.pointerType) {\n        return false;\n      }\n\n      var types = {};\n      types[ionic.Gestures.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == ionic.Gestures.POINTER_MOUSE);\n      types[ionic.Gestures.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == ionic.Gestures.POINTER_TOUCH);\n      types[ionic.Gestures.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == ionic.Gestures.POINTER_PEN);\n      return types[pointerType];\n    },\n\n\n    /**\n     * get events\n     */\n    getEvents: function() {\n      return [\n        'pointerdown MSPointerDown',\n      'pointermove MSPointerMove',\n      'pointerup pointercancel MSPointerUp MSPointerCancel'\n        ];\n    },\n\n    /**\n     * reset the list\n     */\n    reset: function() {\n      this.pointers = {};\n    }\n  };\n\n\n  ionic.Gestures.utils = {\n    /**\n     * extend method,\n     * also used for cloning when dest is an empty object\n     * @param   {Object}    dest\n     * @param   {Object}    src\n     * @param\t{Boolean}\tmerge\t\tdo a merge\n     * @returns {Object}    dest\n     */\n    extend: function extend(dest, src, merge) {\n      for (var key in src) {\n        if(dest[key] !== undefined && merge) {\n          continue;\n        }\n        dest[key] = src[key];\n      }\n      return dest;\n    },\n\n\n    /**\n     * find if a node is in the given parent\n     * used for event delegation tricks\n     * @param   {HTMLElement}   node\n     * @param   {HTMLElement}   parent\n     * @returns {boolean}       has_parent\n     */\n    hasParent: function(node, parent) {\n      while(node){\n        if(node == parent) {\n          return true;\n        }\n        node = node.parentNode;\n      }\n      return false;\n    },\n\n\n    /**\n     * get the center of all the touches\n     * @param   {Array}     touches\n     * @returns {Object}    center\n     */\n    getCenter: function getCenter(touches) {\n      var valuesX = [], valuesY = [];\n\n      for(var t= 0,len=touches.length; t<len; t++) {\n        valuesX.push(touches[t].pageX);\n        valuesY.push(touches[t].pageY);\n      }\n\n      return {\n        pageX: ((Math.min.apply(Math, valuesX) + Math.max.apply(Math, valuesX)) / 2),\n          pageY: ((Math.min.apply(Math, valuesY) + Math.max.apply(Math, valuesY)) / 2)\n      };\n    },\n\n\n    /**\n     * calculate the velocity between two points\n     * @param   {Number}    delta_time\n     * @param   {Number}    delta_x\n     * @param   {Number}    delta_y\n     * @returns {Object}    velocity\n     */\n    getVelocity: function getVelocity(delta_time, delta_x, delta_y) {\n      return {\n        x: Math.abs(delta_x / delta_time) || 0,\n        y: Math.abs(delta_y / delta_time) || 0\n      };\n    },\n\n\n    /**\n     * calculate the angle between two coordinates\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {Number}    angle\n     */\n    getAngle: function getAngle(touch1, touch2) {\n      var y = touch2.pageY - touch1.pageY,\n      x = touch2.pageX - touch1.pageX;\n      return Math.atan2(y, x) * 180 / Math.PI;\n    },\n\n\n    /**\n     * angle to direction define\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {String}    direction constant, like ionic.Gestures.DIRECTION_LEFT\n     */\n    getDirection: function getDirection(touch1, touch2) {\n      var x = Math.abs(touch1.pageX - touch2.pageX),\n      y = Math.abs(touch1.pageY - touch2.pageY);\n\n      if(x >= y) {\n        return touch1.pageX - touch2.pageX > 0 ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;\n      }\n      else {\n        return touch1.pageY - touch2.pageY > 0 ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;\n      }\n    },\n\n\n    /**\n     * calculate the distance between two touches\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {Number}    distance\n     */\n    getDistance: function getDistance(touch1, touch2) {\n      var x = touch2.pageX - touch1.pageX,\n      y = touch2.pageY - touch1.pageY;\n      return Math.sqrt((x*x) + (y*y));\n    },\n\n\n    /**\n     * calculate the scale factor between two touchLists (fingers)\n     * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n     * @param   {Array}     start\n     * @param   {Array}     end\n     * @returns {Number}    scale\n     */\n    getScale: function getScale(start, end) {\n      // need two fingers...\n      if(start.length >= 2 && end.length >= 2) {\n        return this.getDistance(end[0], end[1]) /\n          this.getDistance(start[0], start[1]);\n      }\n      return 1;\n    },\n\n\n    /**\n     * calculate the rotation degrees between two touchLists (fingers)\n     * @param   {Array}     start\n     * @param   {Array}     end\n     * @returns {Number}    rotation\n     */\n    getRotation: function getRotation(start, end) {\n      // need two fingers\n      if(start.length >= 2 && end.length >= 2) {\n        return this.getAngle(end[1], end[0]) -\n          this.getAngle(start[1], start[0]);\n      }\n      return 0;\n    },\n\n\n    /**\n     * boolean if the direction is vertical\n     * @param    {String}    direction\n     * @returns  {Boolean}   is_vertical\n     */\n    isVertical: function isVertical(direction) {\n      return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);\n    },\n\n\n    /**\n     * stop browser default behavior with css class\n     * @param   {HtmlElement}   element\n     * @param   {Object}        css_class\n     */\n    stopDefaultBrowserBehavior: function stopDefaultBrowserBehavior(element, css_class) {\n      // changed from making many style changes to just adding a preset classname\n      // less DOM manipulations, less code, and easier to control in the CSS side of things\n      // hammer.js doesn't come with CSS, but ionic does, which is why we prefer this method\n      if(element && element.classList) {\n        element.classList.add(css_class);\n        element.onselectstart = function() {\n          return false;\n        };\n      }\n    }\n  };\n\n\n  ionic.Gestures.detection = {\n    // contains all registred ionic.Gestures.gestures in the correct order\n    gestures: [],\n\n    // data of the current ionic.Gestures.gesture detection session\n    current: null,\n\n    // the previous ionic.Gestures.gesture session data\n    // is a full clone of the previous gesture.current object\n    previous: null,\n\n    // when this becomes true, no gestures are fired\n    stopped: false,\n\n\n    /**\n     * start ionic.Gestures.gesture detection\n     * @param   {ionic.Gestures.Instance}   inst\n     * @param   {Object}            eventData\n     */\n    startDetect: function startDetect(inst, eventData) {\n      // already busy with a ionic.Gestures.gesture detection on an element\n      if(this.current) {\n        return;\n      }\n\n      this.stopped = false;\n\n      this.current = {\n        inst        : inst, // reference to ionic.GesturesInstance we're working for\n        startEvent  : ionic.Gestures.utils.extend({}, eventData), // start eventData for distances, timing etc\n        lastEvent   : false, // last eventData\n        name        : '' // current gesture we're in/detected, can be 'tap', 'hold' etc\n      };\n\n      this.detect(eventData);\n    },\n\n\n    /**\n     * ionic.Gestures.gesture detection\n     * @param   {Object}    eventData\n     */\n    detect: function detect(eventData) {\n      if(!this.current || this.stopped) {\n        return;\n      }\n\n      // extend event data with calculations about scale, distance etc\n      eventData = this.extendEventData(eventData);\n\n      // instance options\n      var inst_options = this.current.inst.options;\n\n      // call ionic.Gestures.gesture handlers\n      for(var g=0,len=this.gestures.length; g<len; g++) {\n        var gesture = this.gestures[g];\n\n        // only when the instance options have enabled this gesture\n        if(!this.stopped && inst_options[gesture.name] !== false) {\n          // if a handler returns false, we stop with the detection\n          if(gesture.handler.call(gesture, eventData, this.current.inst) === false) {\n            this.stopDetect();\n            break;\n          }\n        }\n      }\n\n      // store as previous event event\n      if(this.current) {\n        this.current.lastEvent = eventData;\n      }\n\n      // endevent, but not the last touch, so dont stop\n      if(eventData.eventType == ionic.Gestures.EVENT_END && !eventData.touches.length-1) {\n        this.stopDetect();\n      }\n\n      return eventData;\n    },\n\n\n    /**\n     * clear the ionic.Gestures.gesture vars\n     * this is called on endDetect, but can also be used when a final ionic.Gestures.gesture has been detected\n     * to stop other ionic.Gestures.gestures from being fired\n     */\n    stopDetect: function stopDetect() {\n      // clone current data to the store as the previous gesture\n      // used for the double tap gesture, since this is an other gesture detect session\n      this.previous = ionic.Gestures.utils.extend({}, this.current);\n\n      // reset the current\n      this.current = null;\n\n      // stopped!\n      this.stopped = true;\n    },\n\n\n    /**\n     * extend eventData for ionic.Gestures.gestures\n     * @param   {Object}   ev\n     * @returns {Object}   ev\n     */\n    extendEventData: function extendEventData(ev) {\n      var startEv = this.current.startEvent;\n\n      // if the touches change, set the new touches over the startEvent touches\n      // this because touchevents don't have all the touches on touchstart, or the\n      // user must place his fingers at the EXACT same time on the screen, which is not realistic\n      // but, sometimes it happens that both fingers are touching at the EXACT same time\n      if(startEv && (ev.touches.length != startEv.touches.length || ev.touches === startEv.touches)) {\n        // extend 1 level deep to get the touchlist with the touch objects\n        startEv.touches = [];\n        for(var i=0,len=ev.touches.length; i<len; i++) {\n          startEv.touches.push(ionic.Gestures.utils.extend({}, ev.touches[i]));\n        }\n      }\n\n      var delta_time = ev.timeStamp - startEv.timeStamp,\n          delta_x = ev.center.pageX - startEv.center.pageX,\n          delta_y = ev.center.pageY - startEv.center.pageY,\n          velocity = ionic.Gestures.utils.getVelocity(delta_time, delta_x, delta_y);\n\n      ionic.Gestures.utils.extend(ev, {\n        deltaTime   : delta_time,\n\n        deltaX      : delta_x,\n        deltaY      : delta_y,\n\n        velocityX   : velocity.x,\n        velocityY   : velocity.y,\n\n        distance    : ionic.Gestures.utils.getDistance(startEv.center, ev.center),\n        angle       : ionic.Gestures.utils.getAngle(startEv.center, ev.center),\n        direction   : ionic.Gestures.utils.getDirection(startEv.center, ev.center),\n\n        scale       : ionic.Gestures.utils.getScale(startEv.touches, ev.touches),\n        rotation    : ionic.Gestures.utils.getRotation(startEv.touches, ev.touches),\n\n        startEvent  : startEv\n      });\n\n      return ev;\n    },\n\n\n    /**\n     * register new gesture\n     * @param   {Object}    gesture object, see gestures.js for documentation\n     * @returns {Array}     gestures\n     */\n    register: function register(gesture) {\n      // add an enable gesture options if there is no given\n      var options = gesture.defaults || {};\n      if(options[gesture.name] === undefined) {\n        options[gesture.name] = true;\n      }\n\n      // extend ionic.Gestures default options with the ionic.Gestures.gesture options\n      ionic.Gestures.utils.extend(ionic.Gestures.defaults, options, true);\n\n      // set its index\n      gesture.index = gesture.index || 1000;\n\n      // add ionic.Gestures.gesture to the list\n      this.gestures.push(gesture);\n\n      // sort the list by index\n      this.gestures.sort(function(a, b) {\n        if (a.index < b.index) {\n          return -1;\n        }\n        if (a.index > b.index) {\n          return 1;\n        }\n        return 0;\n      });\n\n      return this.gestures;\n    }\n  };\n\n\n  ionic.Gestures.gestures = ionic.Gestures.gestures || {};\n\n  /**\n   * Custom gestures\n   * ==============================\n   *\n   * Gesture object\n   * --------------------\n   * The object structure of a gesture:\n   *\n   * { name: 'mygesture',\n   *   index: 1337,\n   *   defaults: {\n   *     mygesture_option: true\n   *   }\n   *   handler: function(type, ev, inst) {\n   *     // trigger gesture event\n   *     inst.trigger(this.name, ev);\n   *   }\n   * }\n\n   * @param   {String}    name\n   * this should be the name of the gesture, lowercase\n   * it is also being used to disable/enable the gesture per instance config.\n   *\n   * @param   {Number}    [index=1000]\n   * the index of the gesture, where it is going to be in the stack of gestures detection\n   * like when you build an gesture that depends on the drag gesture, it is a good\n   * idea to place it after the index of the drag gesture.\n   *\n   * @param   {Object}    [defaults={}]\n   * the default settings of the gesture. these are added to the instance settings,\n   * and can be overruled per instance. you can also add the name of the gesture,\n   * but this is also added by default (and set to true).\n   *\n   * @param   {Function}  handler\n   * this handles the gesture detection of your custom gesture and receives the\n   * following arguments:\n   *\n   *      @param  {Object}    eventData\n   *      event data containing the following properties:\n   *          timeStamp   {Number}        time the event occurred\n   *          target      {HTMLElement}   target element\n   *          touches     {Array}         touches (fingers, pointers, mouse) on the screen\n   *          pointerType {String}        kind of pointer that was used. matches ionic.Gestures.POINTER_MOUSE|TOUCH\n   *          center      {Object}        center position of the touches. contains pageX and pageY\n   *          deltaTime   {Number}        the total time of the touches in the screen\n   *          deltaX      {Number}        the delta on x axis we haved moved\n   *          deltaY      {Number}        the delta on y axis we haved moved\n   *          velocityX   {Number}        the velocity on the x\n   *          velocityY   {Number}        the velocity on y\n   *          angle       {Number}        the angle we are moving\n   *          direction   {String}        the direction we are moving. matches ionic.Gestures.DIRECTION_UP|DOWN|LEFT|RIGHT\n   *          distance    {Number}        the distance we haved moved\n   *          scale       {Number}        scaling of the touches, needs 2 touches\n   *          rotation    {Number}        rotation of the touches, needs 2 touches *\n   *          eventType   {String}        matches ionic.Gestures.EVENT_START|MOVE|END\n   *          srcEvent    {Object}        the source event, like TouchStart or MouseDown *\n   *          startEvent  {Object}        contains the same properties as above,\n   *                                      but from the first touch. this is used to calculate\n   *                                      distances, deltaTime, scaling etc\n   *\n   *      @param  {ionic.Gestures.Instance}    inst\n   *      the instance we are doing the detection for. you can get the options from\n   *      the inst.options object and trigger the gesture event by calling inst.trigger\n   *\n   *\n   * Handle gestures\n   * --------------------\n   * inside the handler you can get/set ionic.Gestures.detectionic.current. This is the current\n   * detection sessionic. It has the following properties\n   *      @param  {String}    name\n   *      contains the name of the gesture we have detected. it has not a real function,\n   *      only to check in other gestures if something is detected.\n   *      like in the drag gesture we set it to 'drag' and in the swipe gesture we can\n   *      check if the current gesture is 'drag' by accessing ionic.Gestures.detectionic.current.name\n   *\n   *      readonly\n   *      @param  {ionic.Gestures.Instance}    inst\n   *      the instance we do the detection for\n   *\n   *      readonly\n   *      @param  {Object}    startEvent\n   *      contains the properties of the first gesture detection in this sessionic.\n   *      Used for calculations about timing, distance, etc.\n   *\n   *      readonly\n   *      @param  {Object}    lastEvent\n   *      contains all the properties of the last gesture detect in this sessionic.\n   *\n   * after the gesture detection session has been completed (user has released the screen)\n   * the ionic.Gestures.detectionic.current object is copied into ionic.Gestures.detectionic.previous,\n   * this is usefull for gestures like doubletap, where you need to know if the\n   * previous gesture was a tap\n   *\n   * options that have been set by the instance can be received by calling inst.options\n   *\n   * You can trigger a gesture event by calling inst.trigger(\"mygesture\", event).\n   * The first param is the name of your gesture, the second the event argument\n   *\n   *\n   * Register gestures\n   * --------------------\n   * When an gesture is added to the ionic.Gestures.gestures object, it is auto registered\n   * at the setup of the first ionic.Gestures instance. You can also call ionic.Gestures.detectionic.register\n   * manually and pass your gesture object as a param\n   *\n   */\n\n  /**\n   * Hold\n   * Touch stays at the same place for x time\n   * events  hold\n   */\n  ionic.Gestures.gestures.Hold = {\n    name: 'hold',\n    index: 10,\n    defaults: {\n      hold_timeout\t: 500,\n      hold_threshold\t: 1\n    },\n    timer: null,\n    handler: function holdGesture(ev, inst) {\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          // clear any running timers\n          clearTimeout(this.timer);\n\n          // set the gesture so we can check in the timeout if it still is\n          ionic.Gestures.detection.current.name = this.name;\n\n          // set timer and if after the timeout it still is hold,\n          // we trigger the hold event\n          this.timer = setTimeout(function() {\n            if(ionic.Gestures.detection.current.name == 'hold') {\n              ionic.tap.cancelClick();\n              inst.trigger('hold', ev);\n            }\n          }, inst.options.hold_timeout);\n          break;\n\n          // when you move or end we clear the timer\n        case ionic.Gestures.EVENT_MOVE:\n          if(ev.distance > inst.options.hold_threshold) {\n            clearTimeout(this.timer);\n          }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          clearTimeout(this.timer);\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Tap/DoubleTap\n   * Quick touch at a place or double at the same place\n   * events  tap, doubletap\n   */\n  ionic.Gestures.gestures.Tap = {\n    name: 'tap',\n    index: 100,\n    defaults: {\n      tap_max_touchtime\t: 250,\n      tap_max_distance\t: 10,\n      tap_always\t\t\t: true,\n      doubletap_distance\t: 20,\n      doubletap_interval\t: 300\n    },\n    handler: function tapGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END && ev.srcEvent.type != 'touchcancel') {\n        // previous gesture, for the double tap since these are two different gesture detections\n        var prev = ionic.Gestures.detection.previous,\n        did_doubletap = false;\n\n        // when the touchtime is higher then the max touch time\n        // or when the moving distance is too much\n        if(ev.deltaTime > inst.options.tap_max_touchtime ||\n            ev.distance > inst.options.tap_max_distance) {\n              return;\n            }\n\n        // check if double tap\n        if(prev && prev.name == 'tap' &&\n            (ev.timeStamp - prev.lastEvent.timeStamp) < inst.options.doubletap_interval &&\n            ev.distance < inst.options.doubletap_distance) {\n              inst.trigger('doubletap', ev);\n              did_doubletap = true;\n            }\n\n        // do a single tap\n        if(!did_doubletap || inst.options.tap_always) {\n          ionic.Gestures.detection.current.name = 'tap';\n          inst.trigger('tap', ev);\n        }\n      }\n    }\n  };\n\n\n  /**\n   * Swipe\n   * triggers swipe events when the end velocity is above the threshold\n   * events  swipe, swipeleft, swiperight, swipeup, swipedown\n   */\n  ionic.Gestures.gestures.Swipe = {\n    name: 'swipe',\n    index: 40,\n    defaults: {\n      // set 0 for unlimited, but this can conflict with transform\n      swipe_max_touches  : 1,\n      swipe_velocity     : 0.7\n    },\n    handler: function swipeGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END) {\n        // max touches\n        if(inst.options.swipe_max_touches > 0 &&\n            ev.touches.length > inst.options.swipe_max_touches) {\n              return;\n            }\n\n        // when the distance we moved is too small we skip this gesture\n        // or we can be already in dragging\n        if(ev.velocityX > inst.options.swipe_velocity ||\n            ev.velocityY > inst.options.swipe_velocity) {\n              // trigger swipe events\n              inst.trigger(this.name, ev);\n              inst.trigger(this.name + ev.direction, ev);\n            }\n      }\n    }\n  };\n\n\n  /**\n   * Drag\n   * Move with x fingers (default 1) around on the page. Blocking the scrolling when\n   * moving left and right is a good practice. When all the drag events are blocking\n   * you disable scrolling on that area.\n   * events  drag, drapleft, dragright, dragup, dragdown\n   */\n  ionic.Gestures.gestures.Drag = {\n    name: 'drag',\n    index: 50,\n    defaults: {\n      drag_min_distance : 10,\n      // Set correct_for_drag_min_distance to true to make the starting point of the drag\n      // be calculated from where the drag was triggered, not from where the touch started.\n      // Useful to avoid a jerk-starting drag, which can make fine-adjustments\n      // through dragging difficult, and be visually unappealing.\n      correct_for_drag_min_distance : true,\n      // set 0 for unlimited, but this can conflict with transform\n      drag_max_touches  : 1,\n      // prevent default browser behavior when dragging occurs\n      // be careful with it, it makes the element a blocking element\n      // when you are using the drag gesture, it is a good practice to set this true\n      drag_block_horizontal   : true,\n      drag_block_vertical     : true,\n      // drag_lock_to_axis keeps the drag gesture on the axis that it started on,\n      // It disallows vertical directions if the initial direction was horizontal, and vice versa.\n      drag_lock_to_axis       : false,\n      // drag lock only kicks in when distance > drag_lock_min_distance\n      // This way, locking occurs only when the distance has become large enough to reliably determine the direction\n      drag_lock_min_distance : 25\n    },\n    triggered: false,\n    handler: function dragGesture(ev, inst) {\n      // current gesture isnt drag, but dragged is true\n      // this means an other gesture is busy. now call dragend\n      if(ionic.Gestures.detection.current.name != this.name && this.triggered) {\n        inst.trigger(this.name +'end', ev);\n        this.triggered = false;\n        return;\n      }\n\n      // max touches\n      if(inst.options.drag_max_touches > 0 &&\n          ev.touches.length > inst.options.drag_max_touches) {\n            return;\n          }\n\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          this.triggered = false;\n          break;\n\n        case ionic.Gestures.EVENT_MOVE:\n          // when the distance we moved is too small we skip this gesture\n          // or we can be already in dragging\n          if(ev.distance < inst.options.drag_min_distance &&\n              ionic.Gestures.detection.current.name != this.name) {\n                return;\n              }\n\n          // we are dragging!\n          if(ionic.Gestures.detection.current.name != this.name) {\n            ionic.Gestures.detection.current.name = this.name;\n            if (inst.options.correct_for_drag_min_distance) {\n              // When a drag is triggered, set the event center to drag_min_distance pixels from the original event center.\n              // Without this correction, the dragged distance would jumpstart at drag_min_distance pixels instead of at 0.\n              // It might be useful to save the original start point somewhere\n              var factor = Math.abs(inst.options.drag_min_distance/ev.distance);\n              ionic.Gestures.detection.current.startEvent.center.pageX += ev.deltaX * factor;\n              ionic.Gestures.detection.current.startEvent.center.pageY += ev.deltaY * factor;\n\n              // recalculate event data using new start point\n              ev = ionic.Gestures.detection.extendEventData(ev);\n            }\n          }\n\n          // lock drag to axis?\n          if(ionic.Gestures.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance<=ev.distance)) {\n            ev.drag_locked_to_axis = true;\n          }\n          var last_direction = ionic.Gestures.detection.current.lastEvent.direction;\n          if(ev.drag_locked_to_axis && last_direction !== ev.direction) {\n            // keep direction on the axis that the drag gesture started on\n            if(ionic.Gestures.utils.isVertical(last_direction)) {\n              ev.direction = (ev.deltaY < 0) ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;\n            }\n            else {\n              ev.direction = (ev.deltaX < 0) ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;\n            }\n          }\n\n          // first time, trigger dragstart event\n          if(!this.triggered) {\n            inst.trigger(this.name +'start', ev);\n            this.triggered = true;\n          }\n\n          // trigger normal event\n          inst.trigger(this.name, ev);\n\n          // direction event, like dragdown\n          inst.trigger(this.name + ev.direction, ev);\n\n          // block the browser events\n          if( (inst.options.drag_block_vertical && ionic.Gestures.utils.isVertical(ev.direction)) ||\n              (inst.options.drag_block_horizontal && !ionic.Gestures.utils.isVertical(ev.direction))) {\n                ev.preventDefault();\n              }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          // trigger dragend\n          if(this.triggered) {\n            inst.trigger(this.name +'end', ev);\n          }\n\n          this.triggered = false;\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Transform\n   * User want to scale or rotate with 2 fingers\n   * events  transform, pinch, pinchin, pinchout, rotate\n   */\n  ionic.Gestures.gestures.Transform = {\n    name: 'transform',\n    index: 45,\n    defaults: {\n      // factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1\n      transform_min_scale     : 0.01,\n      // rotation in degrees\n      transform_min_rotation  : 1,\n      // prevent default browser behavior when two touches are on the screen\n      // but it makes the element a blocking element\n      // when you are using the transform gesture, it is a good practice to set this true\n      transform_always_block  : false\n    },\n    triggered: false,\n    handler: function transformGesture(ev, inst) {\n      // current gesture isnt drag, but dragged is true\n      // this means an other gesture is busy. now call dragend\n      if(ionic.Gestures.detection.current.name != this.name && this.triggered) {\n        inst.trigger(this.name +'end', ev);\n        this.triggered = false;\n        return;\n      }\n\n      // atleast multitouch\n      if(ev.touches.length < 2) {\n        return;\n      }\n\n      // prevent default when two fingers are on the screen\n      if(inst.options.transform_always_block) {\n        ev.preventDefault();\n      }\n\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          this.triggered = false;\n          break;\n\n        case ionic.Gestures.EVENT_MOVE:\n          var scale_threshold = Math.abs(1-ev.scale);\n          var rotation_threshold = Math.abs(ev.rotation);\n\n          // when the distance we moved is too small we skip this gesture\n          // or we can be already in dragging\n          if(scale_threshold < inst.options.transform_min_scale &&\n              rotation_threshold < inst.options.transform_min_rotation) {\n                return;\n              }\n\n          // we are transforming!\n          ionic.Gestures.detection.current.name = this.name;\n\n          // first time, trigger dragstart event\n          if(!this.triggered) {\n            inst.trigger(this.name +'start', ev);\n            this.triggered = true;\n          }\n\n          inst.trigger(this.name, ev); // basic transform event\n\n          // trigger rotate event\n          if(rotation_threshold > inst.options.transform_min_rotation) {\n            inst.trigger('rotate', ev);\n          }\n\n          // trigger pinch event\n          if(scale_threshold > inst.options.transform_min_scale) {\n            inst.trigger('pinch', ev);\n            inst.trigger('pinch'+ ((ev.scale < 1) ? 'in' : 'out'), ev);\n          }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          // trigger dragend\n          if(this.triggered) {\n            inst.trigger(this.name +'end', ev);\n          }\n\n          this.triggered = false;\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Touch\n   * Called as first, tells the user has touched the screen\n   * events  touch\n   */\n  ionic.Gestures.gestures.Touch = {\n    name: 'touch',\n    index: -Infinity,\n    defaults: {\n      // call preventDefault at touchstart, and makes the element blocking by\n      // disabling the scrolling of the page, but it improves gestures like\n      // transforming and dragging.\n      // be careful with using this, it can be very annoying for users to be stuck\n      // on the page\n      prevent_default: false,\n\n      // disable mouse events, so only touch (or pen!) input triggers events\n      prevent_mouseevents: false\n    },\n    handler: function touchGesture(ev, inst) {\n      if(inst.options.prevent_mouseevents && ev.pointerType == ionic.Gestures.POINTER_MOUSE) {\n        ev.stopDetect();\n        return;\n      }\n\n      if(inst.options.prevent_default) {\n        ev.preventDefault();\n      }\n\n      if(ev.eventType ==  ionic.Gestures.EVENT_START) {\n        inst.trigger(this.name, ev);\n      }\n    }\n  };\n\n\n  /**\n   * Release\n   * Called as last, tells the user has released the screen\n   * events  release\n   */\n  ionic.Gestures.gestures.Release = {\n    name: 'release',\n    index: Infinity,\n    handler: function releaseGesture(ev, inst) {\n      if(ev.eventType ==  ionic.Gestures.EVENT_END) {\n        inst.trigger(this.name, ev);\n      }\n    }\n  };\n})(window.ionic);\n\n(function(window, document, ionic) {\n\n  var IOS = 'ios';\n  var ANDROID = 'android';\n  var WINDOWS_PHONE = 'windowsphone';\n\n  /**\n   * @ngdoc utility\n   * @name ionic.Platform\n   * @module ionic\n   */\n  ionic.Platform = {\n\n    // Put navigator on platform so it can be mocked and set\n    // the browser does not allow window.navigator to be set\n    navigator: window.navigator,\n\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#isReady\n     * @returns {boolean} Whether the device is ready.\n     */\n    isReady: false,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#isFullScreen\n     * @returns {boolean} Whether the device is fullscreen.\n     */\n    isFullScreen: false,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#platforms\n     * @returns {Array(string)} An array of all platforms found.\n     */\n    platforms: null,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#grade\n     * @returns {string} What grade the current platform is.\n     */\n    grade: null,\n    ua: navigator.userAgent,\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#ready\n     * @description\n     * Trigger a callback once the device is ready, or immediately\n     * if the device is already ready. This method can be run from\n     * anywhere and does not need to be wrapped by any additonal methods.\n     * When the app is within a WebView (Cordova), it'll fire\n     * the callback once the device is ready. If the app is within\n     * a web browser, it'll fire the callback after `window.load`.\n     * Please remember that Cordova features (Camera, FileSystem, etc) still\n     * will not work in a web browser.\n     * @param {function} callback The function to call.\n     */\n    ready: function(cb) {\n      // run through tasks to complete now that the device is ready\n      if(this.isReady) {\n        cb();\n      } else {\n        // the platform isn't ready yet, add it to this array\n        // which will be called once the platform is ready\n        readyCallbacks.push(cb);\n      }\n    },\n\n    /**\n     * @private\n     */\n    detect: function() {\n      ionic.Platform._checkPlatforms();\n\n      ionic.requestAnimationFrame(function(){\n        // only add to the body class if we got platform info\n        for(var i = 0; i < ionic.Platform.platforms.length; i++) {\n          document.body.classList.add('platform-' + ionic.Platform.platforms[i]);\n        }\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#setGrade\n     * @description Set the grade of the device: 'a', 'b', or 'c'. 'a' is the best\n     * (most css features enabled), 'c' is the worst.  By default, sets the grade\n     * depending on the current device.\n     * @param {string} grade The new grade to set.\n     */\n    setGrade: function(grade) {\n      var oldGrade = this.grade;\n      this.grade = grade;\n      ionic.requestAnimationFrame(function() {\n        if (oldGrade) {\n          document.body.classList.remove('grade-' + oldGrade);\n        }\n        document.body.classList.add('grade-' + grade);\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#device\n     * @description Return the current device (given by cordova).\n     * @returns {object} The device object.\n     */\n    device: function() {\n      return window.device || {};\n    },\n\n    _checkPlatforms: function(platforms) {\n      this.platforms = [];\n      var grade = 'a';\n\n      if(this.isWebView()) {\n        this.platforms.push('webview');\n        this.platforms.push('cordova');\n      } else {\n        this.platforms.push('browser');\n      }\n      if(this.isIPad()) this.platforms.push('ipad');\n\n      var platform = this.platform();\n      if(platform) {\n        this.platforms.push(platform);\n\n        var version = this.version();\n        if(version) {\n          var v = version.toString();\n          if(v.indexOf('.') > 0) {\n            v = v.replace('.', '_');\n          } else {\n            v += '_0';\n          }\n          this.platforms.push(platform + v.split('_')[0]);\n          this.platforms.push(platform + v);\n\n          if(this.isAndroid() && version < 4.4) {\n            grade = (version < 4 ? 'c' : 'b');\n          } else if(this.isWindowsPhone()) {\n            grade = 'b';\n          }\n        }\n      }\n\n      this.setGrade(grade);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isWebView\n     * @returns {boolean} Check if we are running within a WebView (such as Cordova).\n     */\n    isWebView: function() {\n      return !(!window.cordova && !window.PhoneGap && !window.phonegap);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isIPad\n     * @returns {boolean} Whether we are running on iPad.\n     */\n    isIPad: function() {\n      if( /iPad/i.test(ionic.Platform.navigator.platform) ) {\n        return true;\n      }\n      return /iPad/i.test(this.ua);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isIOS\n     * @returns {boolean} Whether we are running on iOS.\n     */\n    isIOS: function() {\n      return this.is(IOS);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isAndroid\n     * @returns {boolean} Whether we are running on Android.\n     */\n    isAndroid: function() {\n      return this.is(ANDROID);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isWindowsPhone\n     * @returns {boolean} Whether we are running on Windows Phone.\n     */\n    isWindowsPhone: function() {\n      return this.is(WINDOWS_PHONE);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#platform\n     * @returns {string} The name of the current platform.\n     */\n    platform: function() {\n      // singleton to get the platform name\n      if(platformName === null) this.setPlatform(this.device().platform);\n      return platformName;\n    },\n\n    /**\n     * @private\n     */\n    setPlatform: function(n) {\n      if(typeof n != 'undefined' && n !== null && n.length) {\n        platformName = n.toLowerCase();\n      } else if(this.ua.indexOf('Android') > 0) {\n        platformName = ANDROID;\n      } else if(this.ua.indexOf('iPhone') > -1 || this.ua.indexOf('iPad') > -1 || this.ua.indexOf('iPod') > -1) {\n        platformName = IOS;\n      } else if(this.ua.indexOf('Windows Phone') > -1) {\n        platformName = WINDOWS_PHONE;\n      } else {\n        platformName = ionic.Platform.navigator.platform && navigator.platform.toLowerCase().split(' ')[0] || '';\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#version\n     * @returns {string} The version of the current device platform.\n     */\n    version: function() {\n      // singleton to get the platform version\n      if(platformVersion === null) this.setVersion(this.device().version);\n      return platformVersion;\n    },\n\n    /**\n     * @private\n     */\n    setVersion: function(v) {\n      if(typeof v != 'undefined' && v !== null) {\n        v = v.split('.');\n        v = parseFloat(v[0] + '.' + (v.length > 1 ? v[1] : 0));\n        if(!isNaN(v)) {\n          platformVersion = v;\n          return;\n        }\n      }\n\n      platformVersion = 0;\n\n      // fallback to user-agent checking\n      var pName = this.platform();\n      var versionMatch = {\n        'android': /Android (\\d+).(\\d+)?/,\n        'ios': /OS (\\d+)_(\\d+)?/,\n        'windowsphone': /Windows Phone (\\d+).(\\d+)?/\n      };\n      if(versionMatch[pName]) {\n        v = this.ua.match( versionMatch[pName] );\n        if(v &&  v.length > 2) {\n          platformVersion = parseFloat( v[1] + '.' + v[2] );\n        }\n      }\n    },\n\n    // Check if the platform is the one detected by cordova\n    is: function(type) {\n      type = type.toLowerCase();\n      // check if it has an array of platforms\n      if(this.platforms) {\n        for(var x = 0; x < this.platforms.length; x++) {\n          if(this.platforms[x] === type) return true;\n        }\n      }\n      // exact match\n      var pName = this.platform();\n      if(pName) {\n        return pName === type.toLowerCase();\n      }\n\n      // A quick hack for to check userAgent\n      return this.ua.toLowerCase().indexOf(type) >= 0;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#exitApp\n     * @description Exit the app.\n     */\n    exitApp: function() {\n      this.ready(function(){\n        navigator.app && navigator.app.exitApp && navigator.app.exitApp();\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#showStatusBar\n     * @description Shows or hides the device status bar (in Cordova).\n     * @param {boolean} shouldShow Whether or not to show the status bar.\n     */\n    showStatusBar: function(val) {\n      // Only useful when run within cordova\n      this._showStatusBar = val;\n      this.ready(function(){\n        // run this only when or if the platform (cordova) is ready\n        ionic.requestAnimationFrame(function(){\n          if(ionic.Platform._showStatusBar) {\n            // they do not want it to be full screen\n            window.StatusBar && window.StatusBar.show();\n            document.body.classList.remove('status-bar-hide');\n          } else {\n            // it should be full screen\n            window.StatusBar && window.StatusBar.hide();\n            document.body.classList.add('status-bar-hide');\n          }\n        });\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#fullScreen\n     * @description\n     * Sets whether the app is fullscreen or not (in Cordova).\n     * @param {boolean=} showFullScreen Whether or not to set the app to fullscreen. Defaults to true.\n     * @param {boolean=} showStatusBar Whether or not to show the device's status bar. Defaults to false.\n     */\n    fullScreen: function(showFullScreen, showStatusBar) {\n      // showFullScreen: default is true if no param provided\n      this.isFullScreen = (showFullScreen !== false);\n\n      // add/remove the fullscreen classname to the body\n      ionic.DomUtil.ready(function(){\n        // run this only when or if the DOM is ready\n        ionic.requestAnimationFrame(function(){\n          // fixing pane height before we adjust this\n          panes = document.getElementsByClassName('pane');\n          for(var i = 0;i<panes.length;i++){\n            panes[i].style.height = panes[i].offsetHeight+\"px\";\n          }\n          if(ionic.Platform.isFullScreen) {\n            document.body.classList.add('fullscreen');\n          } else {\n            document.body.classList.remove('fullscreen');\n          }\n        });\n        // showStatusBar: default is false if no param provided\n        ionic.Platform.showStatusBar( (showStatusBar === true) );\n      });\n    }\n\n  };\n\n  var platformName = null, // just the name, like iOS or Android\n  platformVersion = null, // a float of the major and minor, like 7.1\n  readyCallbacks = [];\n\n  // setup listeners to know when the device is ready to go\n  function onWindowLoad() {\n    if(ionic.Platform.isWebView()) {\n      // the window and scripts are fully loaded, and a cordova/phonegap\n      // object exists then let's listen for the deviceready\n      document.addEventListener(\"deviceready\", onPlatformReady, false);\n    } else {\n      // the window and scripts are fully loaded, but the window object doesn't have the\n      // cordova/phonegap object, so its just a browser, not a webview wrapped w/ cordova\n      onPlatformReady();\n    }\n    window.removeEventListener(\"load\", onWindowLoad, false);\n  }\n  window.addEventListener(\"load\", onWindowLoad, false);\n\n  function onPlatformReady() {\n    // the device is all set to go, init our own stuff then fire off our event\n    ionic.Platform.isReady = true;\n    ionic.Platform.detect();\n    for(var x=0; x<readyCallbacks.length; x++) {\n      // fire off all the callbacks that were added before the platform was ready\n      readyCallbacks[x]();\n    }\n    readyCallbacks = [];\n    ionic.trigger('platformready', { target: document });\n\n    ionic.requestAnimationFrame(function(){\n      document.body.classList.add('platform-ready');\n    });\n  }\n\n})(this, document, ionic);\n\n(function(document, ionic) {\n  'use strict';\n\n  // Ionic CSS polyfills\n  ionic.CSS = {};\n\n  (function() {\n\n    // transform\n    var i, keys = ['webkitTransform', 'transform', '-webkit-transform', 'webkit-transform',\n                   '-moz-transform', 'moz-transform', 'MozTransform', 'mozTransform', 'msTransform'];\n\n    for(i = 0; i < keys.length; i++) {\n      if(document.documentElement.style[keys[i]] !== undefined) {\n        ionic.CSS.TRANSFORM = keys[i];\n        break;\n      }\n    }\n\n    // transition\n    keys = ['webkitTransition', 'mozTransition', 'msTransition', 'transition'];\n    for(i = 0; i < keys.length; i++) {\n      if(document.documentElement.style[keys[i]] !== undefined) {\n        ionic.CSS.TRANSITION = keys[i];\n        break;\n      }\n    }\n\n  })();\n\n  // classList polyfill for them older Androids\n  // https://gist.github.com/devongovett/1381839\n  if (!(\"classList\" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') {\n    Object.defineProperty(HTMLElement.prototype, 'classList', {\n      get: function() {\n        var self = this;\n        function update(fn) {\n          return function() {\n            var x, classes = self.className.split(/\\s+/);\n\n            for(x=0; x<arguments.length; x++) {\n              fn(classes, classes.indexOf(arguments[x]), arguments[x]);\n            }\n\n            self.className = classes.join(\" \");\n          };\n        }\n\n        return {\n          add: update(function(classes, index, value) {\n            ~index || classes.push(value);\n          }),\n\n          remove: update(function(classes, index) {\n            ~index && classes.splice(index, 1);\n          }),\n\n          toggle: update(function(classes, index, value) {\n            ~index ? classes.splice(index, 1) : classes.push(value);\n          }),\n\n          contains: function(value) {\n            return !!~self.className.split(/\\s+/).indexOf(value);\n          },\n\n          item: function(i) {\n            return self.className.split(/\\s+/)[i] || null;\n          }\n        };\n\n      }\n    });\n  }\n\n})(document, ionic);\n\n\n/**\n * @ngdoc page\n * @name tap\n * @module ionic\n * @description\n * On touch devices such as a phone or tablet, some browsers implement a 300ms delay between\n * the time the user stops touching the display and the moment the browser executes the\n * click. This delay was initially introduced so the browser can know whether the user wants to\n * double-tap to zoom in on the webpage.  Basically, the browser waits roughly 300ms to see if\n * the user is double-tapping, or just tapping on the display once.\n *\n * Out of the box, Ionic automatically removes the 300ms delay in order to make Ionic apps\n * feel more \"native\" like. Resultingly, other solutions such as\n * [fastclick](https://github.com/ftlabs/fastclick) and Angular's\n * [ngTouch](https://docs.angularjs.org/api/ngTouch) should not be included, to avoid conflicts.\n *\n * Some browsers already remove the delay with certain settings, such as the CSS property\n * `touch-events: none` or with specific meta tag viewport values. However, each of these\n * browsers still handle clicks differently, such as when to fire off or cancel the event\n * (like scrolling when the target is a button, or holding a button down).\n * For browsers that already remove the 300ms delay, consider Ionic's tap system as a way to\n * normalize how clicks are handled across the various devices so there's an expected response\n * no matter what the device, platform or version. Additionally, Ionic will prevent\n * ghostclicks which even browsers that remove the delay still experience.\n *\n * In some cases, third-party libraries may also be working with touch events which can interfere\n * with the tap system. For example, mapping libraries like Google or Leaflet Maps often implement\n * a touch detection system which conflicts with Ionic's tap system.\n *\n * ### Disabling the tap system\n *\n * To disable the tap for an element and all of its children elements,\n * add the attribute `data-tap-disabled=\"true\"`.\n *\n * ```html\n * <div data-tap-disabled=\"true\">\n *     <div id=\"google-map\"></div>\n * </div>\n * ```\n *\n * ### Additional Notes:\n *\n * - Ionic tap  works with Ionic's JavaScript scrolling\n * - Elements can come and go from the DOM and Ionic tap doesn't keep adding and removing\n *   listeners\n * - No \"tap delay\" after the first \"tap\" (you can tap as fast as you want, they all click)\n * - Minimal events listeners, only being added to document\n * - Correct focus in/out on each input type (select, textearea, range) on each platform/device\n * - Shows and hides virtual keyboard correctly for each platform/device\n * - Works with labels surrounding inputs\n * - Does not fire off a click if the user moves the pointer too far\n * - Adds and removes an 'activated' css class\n * - Multiple [unit tests](https://github.com/driftyco/ionic/blob/master/test/unit/utils/tap.unit.js) for each scenario\n *\n */\n/*\n\n IONIC TAP\n ---------------\n - Both touch and mouse events are added to the document.body on DOM ready\n - If a touch event happens, it does not use mouse event listeners\n - On touchend, if the distance between start and end was small, trigger a click\n - In the triggered click event, add a 'isIonicTap' property\n - The triggered click receives the same x,y coordinates as as the end event\n - On document.body click listener (with useCapture=true), only allow clicks with 'isIonicTap'\n - Triggering clicks with mouse events work the same as touch, except with mousedown/mouseup\n - Tapping inputs is disabled during scrolling\n*/\n\nvar tapDoc; // the element which the listeners are on (document.body)\nvar tapActiveEle; // the element which is active (probably has focus)\nvar tapEnabledTouchEvents;\nvar tapMouseResetTimer;\nvar tapPointerMoved;\nvar tapPointerStart;\nvar tapTouchFocusedInput;\nvar tapLastTouchTarget;\nvar tapTouchMoveListener = 'touchmove';\n\n// how much the coordinates can be off between start/end, but still a click\nvar TAP_RELEASE_TOLERANCE = 6; // default tolerance\nvar TAP_RELEASE_BUTTON_TOLERANCE = 50; // button elements should have a larger tolerance\n\nvar tapEventListeners = {\n  'click': tapClickGateKeeper,\n\n  'mousedown': tapMouseDown,\n  'mouseup': tapMouseUp,\n  'mousemove': tapMouseMove,\n\n  'touchstart': tapTouchStart,\n  'touchend': tapTouchEnd,\n  'touchcancel': tapTouchCancel,\n  'touchmove': tapTouchMove,\n\n  'pointerdown': tapTouchStart,\n  'pointerup': tapTouchEnd,\n  'pointercancel': tapTouchCancel,\n  'pointermove': tapTouchMove,\n\n  'MSPointerDown': tapTouchStart,\n  'MSPointerUp': tapTouchEnd,\n  'MSPointerCancel': tapTouchCancel,\n  'MSPointerMove': tapTouchMove,\n\n  'focusin': tapFocusIn,\n  'focusout': tapFocusOut\n};\n\nionic.tap = {\n\n  register: function(ele) {\n    tapDoc = ele;\n\n    tapEventListener('click', true, true);\n    tapEventListener('mouseup');\n    tapEventListener('mousedown');\n\n    if( window.navigator.pointerEnabled ) {\n      tapEventListener('pointerdown');\n      tapEventListener('pointerup');\n      tapEventListener('pointcancel');\n      tapTouchMoveListener = 'pointermove';\n\n    } else if (window.navigator.msPointerEnabled) {\n      tapEventListener('MSPointerDown');\n      tapEventListener('MSPointerUp');\n      tapEventListener('MSPointerCancel');\n      tapTouchMoveListener = 'MSPointerMove';\n\n    } else {\n      tapEventListener('touchstart');\n      tapEventListener('touchend');\n      tapEventListener('touchcancel');\n    }\n\n    tapEventListener('focusin');\n    tapEventListener('focusout');\n\n    return function() {\n      for(var type in tapEventListeners) {\n        tapEventListener(type, false);\n      }\n      tapDoc = null;\n      tapActiveEle = null;\n      tapEnabledTouchEvents = false;\n      tapPointerMoved = false;\n      tapPointerStart = null;\n    };\n  },\n\n  ignoreScrollStart: function(e) {\n    return (e.defaultPrevented) ||  // defaultPrevented has been assigned by another component handling the event\n           (/^(file|range)$/i).test(e.target.type) ||\n           (e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll')) == 'true' || // manually set within an elements attributes\n           (!!(/^(object|embed)$/i).test(e.target.tagName)) ||  // flash/movie/object touches should not try to scroll\n           ionic.tap.isElementTapDisabled(e.target); // check if this element, or an ancestor, has `data-tap-disabled` attribute\n  },\n\n  isTextInput: function(ele) {\n    return !!ele &&\n           (ele.tagName == 'TEXTAREA' ||\n            ele.contentEditable === 'true' ||\n            (ele.tagName == 'INPUT' && !(/^(radio|checkbox|range|file|submit|reset)$/i).test(ele.type)) );\n  },\n\n  isDateInput: function(ele) {\n    return !!ele &&\n            (ele.tagName == 'INPUT' && (/^(date|time|datetime-local|month|week)$/i).test(ele.type));\n  },\n\n  isLabelWithTextInput: function(ele) {\n    var container = tapContainingElement(ele, false);\n\n    return !!container &&\n           ionic.tap.isTextInput( tapTargetElement( container ) );\n  },\n\n  containsOrIsTextInput: function(ele) {\n    return ionic.tap.isTextInput(ele) || ionic.tap.isLabelWithTextInput(ele);\n  },\n\n  cloneFocusedInput: function(container, scrollIntance) {\n    if(ionic.tap.hasCheckedClone) return;\n    ionic.tap.hasCheckedClone = true;\n\n    ionic.requestAnimationFrame(function(){\n      var focusInput = container.querySelector(':focus');\n      if( ionic.tap.isTextInput(focusInput) ) {\n        var clonedInput = focusInput.parentElement.querySelector('.cloned-text-input');\n        if(!clonedInput) {\n          clonedInput = document.createElement(focusInput.tagName);\n          clonedInput.placeholder = focusInput.placeholder;\n          clonedInput.type = focusInput.type;\n          clonedInput.value = focusInput.value;\n          clonedInput.style = focusInput.style;\n          clonedInput.className = focusInput.className;\n          clonedInput.classList.add('cloned-text-input');\n          clonedInput.readOnly = true;\n          if (focusInput.isContentEditable) {\n            clonedInput.contentEditable = focusInput.contentEditable;\n            clonedInput.innerHTML = focusInput.innerHTML;\n          }\n          focusInput.parentElement.insertBefore(clonedInput, focusInput);\n          focusInput.style.top = focusInput.offsetTop;\n          focusInput.classList.add('previous-input-focus');\n        }\n      }\n    });\n  },\n\n  hasCheckedClone: false,\n\n  removeClonedInputs: function(container, scrollIntance) {\n    ionic.tap.hasCheckedClone = false;\n\n    ionic.requestAnimationFrame(function(){\n      var clonedInputs = container.querySelectorAll('.cloned-text-input');\n      var previousInputFocus = container.querySelectorAll('.previous-input-focus');\n      var x;\n\n      for(x=0; x<clonedInputs.length; x++) {\n        clonedInputs[x].parentElement.removeChild( clonedInputs[x] );\n      }\n\n      for(x=0; x<previousInputFocus.length; x++) {\n        previousInputFocus[x].classList.remove('previous-input-focus');\n        previousInputFocus[x].style.top = '';\n        previousInputFocus[x].focus();\n      }\n    });\n  },\n\n  requiresNativeClick: function(ele) {\n    if(!ele || ele.disabled || (/^(file|range)$/i).test(ele.type) || (/^(object|video)$/i).test(ele.tagName) || ionic.tap.isLabelContainingFileInput(ele) ) {\n      return true;\n    }\n    return ionic.tap.isElementTapDisabled(ele);\n  },\n\n  isLabelContainingFileInput: function(ele) {\n    var lbl = tapContainingElement(ele);\n    if(lbl.tagName !== 'LABEL') return false;\n    var fileInput = lbl.querySelector('input[type=file]');\n    if(fileInput && fileInput.disabled === false) return true;\n    return false;\n  },\n\n  isElementTapDisabled: function(ele) {\n    if(ele && ele.nodeType === 1) {\n      var element = ele;\n      while(element) {\n        if( (element.dataset ? element.dataset.tapDisabled : element.getAttribute('data-tap-disabled')) == 'true' ) {\n          return true;\n        }\n        element = element.parentElement;\n      }\n    }\n    return false;\n  },\n\n  setTolerance: function(releaseTolerance, releaseButtonTolerance) {\n    TAP_RELEASE_TOLERANCE = releaseTolerance;\n    TAP_RELEASE_BUTTON_TOLERANCE = releaseButtonTolerance;\n  },\n\n  cancelClick: function() {\n    // used to cancel any simulated clicks which may happen on a touchend/mouseup\n    // gestures uses this method within its tap and hold events\n    tapPointerMoved = true;\n  },\n\n  pointerCoord: function(event) {\n    // This method can get coordinates for both a mouse click\n    // or a touch depending on the given event\n    var c = { x:0, y:0 };\n    if(event) {\n      var touches = event.touches && event.touches.length ? event.touches : [event];\n      var e = (event.changedTouches && event.changedTouches[0]) || touches[0];\n      if(e) {\n        c.x = e.clientX || e.pageX || 0;\n        c.y = e.clientY || e.pageY || 0;\n      }\n    }\n    return c;\n  }\n\n};\n\nfunction tapEventListener(type, enable, useCapture) {\n  if(enable !== false) {\n    tapDoc.addEventListener(type, tapEventListeners[type], useCapture);\n  } else {\n    tapDoc.removeEventListener(type, tapEventListeners[type]);\n  }\n}\n\nfunction tapClick(e) {\n  // simulate a normal click by running the element's click method then focus on it\n  var container = tapContainingElement(e.target);\n  var ele = tapTargetElement(container);\n\n  if( ionic.tap.requiresNativeClick(ele) || tapPointerMoved ) return false;\n\n  var c = ionic.tap.pointerCoord(e);\n\n  void 0;\n  triggerMouseEvent('click', ele, c.x, c.y);\n\n  // if it's an input, focus in on the target, otherwise blur\n  tapHandleFocus(ele);\n}\n\nfunction triggerMouseEvent(type, ele, x, y) {\n  // using initMouseEvent instead of MouseEvent for our Android friends\n  var clickEvent = document.createEvent(\"MouseEvents\");\n  clickEvent.initMouseEvent(type, true, true, window, 1, 0, 0, x, y, false, false, false, false, 0, null);\n  clickEvent.isIonicTap = true;\n  ele.dispatchEvent(clickEvent);\n}\n\nfunction tapClickGateKeeper(e) {\n  if(e.target.type == 'submit' && e.detail === 0) {\n    // do not prevent click if it came from an \"Enter\" or \"Go\" keypress submit\n    return;\n  }\n\n  // do not allow through any click events that were not created by ionic.tap\n  if( (ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target) ) ||\n      (!e.isIonicTap && !ionic.tap.requiresNativeClick(e.target)) ) {\n    void 0;\n    e.stopPropagation();\n\n    if( !ionic.tap.isLabelWithTextInput(e.target) ) {\n      // labels clicks from native should not preventDefault othersize keyboard will not show on input focus\n      e.preventDefault();\n    }\n    return false;\n  }\n}\n\n// MOUSE\nfunction tapMouseDown(e) {\n  if(e.isIonicTap || tapIgnoreEvent(e)) return;\n\n  if(tapEnabledTouchEvents) {\n    void 0;\n    e.stopPropagation();\n\n    if( (!ionic.tap.isTextInput(e.target) || tapLastTouchTarget !== e.target) && !(/^(select|option)$/i).test(e.target.tagName) ) {\n      // If you preventDefault on a text input then you cannot move its text caret/cursor.\n      // Allow through only the text input default. However, without preventDefault on an\n      // input the 300ms delay can change focus on inputs after the keyboard shows up.\n      // The focusin event handles the chance of focus changing after the keyboard shows.\n      e.preventDefault();\n    }\n\n    return false;\n  }\n\n  tapPointerMoved = false;\n  tapPointerStart = ionic.tap.pointerCoord(e);\n\n  tapEventListener('mousemove');\n  ionic.activator.start(e);\n}\n\nfunction tapMouseUp(e) {\n  if(tapEnabledTouchEvents) {\n    e.stopPropagation();\n    e.preventDefault();\n    return false;\n  }\n\n  if( tapIgnoreEvent(e) || (/^(select|option)$/i).test(e.target.tagName) ) return false;\n\n  if( !tapHasPointerMoved(e) ) {\n    tapClick(e);\n  }\n  tapEventListener('mousemove', false);\n  ionic.activator.end();\n  tapPointerMoved = false;\n}\n\nfunction tapMouseMove(e) {\n  if( tapHasPointerMoved(e) ) {\n    tapEventListener('mousemove', false);\n    ionic.activator.end();\n    tapPointerMoved = true;\n    return false;\n  }\n}\n\n\n// TOUCH\nfunction tapTouchStart(e) {\n  if( tapIgnoreEvent(e) ) return;\n\n  tapPointerMoved = false;\n\n  tapEnableTouchEvents();\n  tapPointerStart = ionic.tap.pointerCoord(e);\n\n  tapEventListener(tapTouchMoveListener);\n  ionic.activator.start(e);\n\n  if( ionic.Platform.isIOS() && ionic.tap.isLabelWithTextInput(e.target) ) {\n    // if the tapped element is a label, which has a child input\n    // then preventDefault so iOS doesn't ugly auto scroll to the input\n    // but do not prevent default on Android or else you cannot move the text caret\n    // and do not prevent default on Android or else no virtual keyboard shows up\n\n    var textInput = tapTargetElement( tapContainingElement(e.target) );\n    if( textInput !== tapActiveEle ) {\n      // don't preventDefault on an already focused input or else iOS's text caret isn't usable\n      e.preventDefault();\n    }\n  }\n}\n\nfunction tapTouchEnd(e) {\n  if( tapIgnoreEvent(e) ) return;\n\n  tapEnableTouchEvents();\n  if( !tapHasPointerMoved(e) ) {\n    tapClick(e);\n\n    if( (/^(select|option)$/i).test(e.target.tagName) ) {\n      e.preventDefault();\n    }\n  }\n\n  tapLastTouchTarget = e.target;\n  tapTouchCancel();\n}\n\nfunction tapTouchMove(e) {\n  if( tapHasPointerMoved(e) ) {\n    tapPointerMoved = true;\n    tapEventListener(tapTouchMoveListener, false);\n    ionic.activator.end();\n    return false;\n  }\n}\n\nfunction tapTouchCancel(e) {\n  tapEventListener(tapTouchMoveListener, false);\n  ionic.activator.end();\n  tapPointerMoved = false;\n}\n\nfunction tapEnableTouchEvents() {\n  tapEnabledTouchEvents = true;\n  clearTimeout(tapMouseResetTimer);\n  tapMouseResetTimer = setTimeout(function(){\n    tapEnabledTouchEvents = false;\n  }, 2000);\n}\n\nfunction tapIgnoreEvent(e) {\n  if(e.isTapHandled) return true;\n  e.isTapHandled = true;\n\n  if( ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target) ) {\n    e.preventDefault();\n    return true;\n  }\n}\n\nfunction tapHandleFocus(ele) {\n  tapTouchFocusedInput = null;\n\n  var triggerFocusIn = false;\n\n  if(ele.tagName == 'SELECT') {\n    // trick to force Android options to show up\n    triggerMouseEvent('mousedown', ele, 0, 0);\n    ele.focus && ele.focus();\n    triggerFocusIn = true;\n\n  } else if(tapActiveElement() === ele) {\n    // already is the active element and has focus\n    triggerFocusIn = true;\n\n  } else if( (/^(input|textarea)$/i).test(ele.tagName) || ele.isContentEditable ) {\n    triggerFocusIn = true;\n    ele.focus && ele.focus();\n    ele.value = ele.value;\n    if( tapEnabledTouchEvents ) {\n      tapTouchFocusedInput = ele;\n    }\n\n  } else {\n    tapFocusOutActive();\n  }\n\n  if(triggerFocusIn) {\n    tapActiveElement(ele);\n    ionic.trigger('ionic.focusin', {\n      target: ele\n    }, true);\n  }\n}\n\nfunction tapFocusOutActive() {\n  var ele = tapActiveElement();\n  if(ele && ((/^(input|textarea|select)$/i).test(ele.tagName) || ele.isContentEditable) ) {\n    void 0;\n    ele.blur();\n  }\n  tapActiveElement(null);\n}\n\nfunction tapFocusIn(e) {\n  // Because a text input doesn't preventDefault (so the caret still works) there's a chance\n  // that it's mousedown event 300ms later will change the focus to another element after\n  // the keyboard shows up.\n\n  if( tapEnabledTouchEvents &&\n      ionic.tap.isTextInput( tapActiveElement() ) &&\n      ionic.tap.isTextInput(tapTouchFocusedInput) &&\n      tapTouchFocusedInput !== e.target ) {\n\n    // 1) The pointer is from touch events\n    // 2) There is an active element which is a text input\n    // 3) A text input was just set to be focused on by a touch event\n    // 4) A new focus has been set, however the target isn't the one the touch event wanted\n    void 0;\n    tapTouchFocusedInput.focus();\n    tapTouchFocusedInput = null;\n  }\n  ionic.scroll.isScrolling = false;\n}\n\nfunction tapFocusOut() {\n  tapActiveElement(null);\n}\n\nfunction tapActiveElement(ele) {\n  if(arguments.length) {\n    tapActiveEle = ele;\n  }\n  return tapActiveEle || document.activeElement;\n}\n\nfunction tapHasPointerMoved(endEvent) {\n  if(!endEvent || endEvent.target.nodeType !== 1 || !tapPointerStart || ( tapPointerStart.x === 0 && tapPointerStart.y === 0 )) {\n    return false;\n  }\n  var endCoordinates = ionic.tap.pointerCoord(endEvent);\n\n  var hasClassList = !!(endEvent.target.classList && endEvent.target.classList.contains);\n  var releaseTolerance = hasClassList & endEvent.target.classList.contains('button') ?\n    TAP_RELEASE_BUTTON_TOLERANCE :\n    TAP_RELEASE_TOLERANCE;\n\n  return Math.abs(tapPointerStart.x - endCoordinates.x) > releaseTolerance ||\n         Math.abs(tapPointerStart.y - endCoordinates.y) > releaseTolerance;\n}\n\nfunction tapContainingElement(ele, allowSelf) {\n  var climbEle = ele;\n  for(var x=0; x<6; x++) {\n    if(!climbEle) break;\n    if(climbEle.tagName === 'LABEL') return climbEle;\n    climbEle = climbEle.parentElement;\n  }\n  if(allowSelf !== false) return ele;\n}\n\nfunction tapTargetElement(ele) {\n  if(ele && ele.tagName === 'LABEL') {\n    if(ele.control) return ele.control;\n\n    // older devices do not support the \"control\" property\n    if(ele.querySelector) {\n      var control = ele.querySelector('input,textarea,select');\n      if(control) return control;\n    }\n  }\n  return ele;\n}\n\nionic.DomUtil.ready(function(){\n  var ng = typeof angular !== 'undefined' ? angular : null;\n  //do nothing for e2e tests\n  if (!ng || (ng && !ng.scenario)) {\n    ionic.tap.register(document);\n  }\n});\n\n(function(document, ionic) {\n  'use strict';\n\n  var queueElements = {};   // elements that should get an active state in XX milliseconds\n  var activeElements = {};  // elements that are currently active\n  var keyId = 0;            // a counter for unique keys for the above ojects\n  var ACTIVATED_CLASS = 'activated';\n\n  ionic.activator = {\n\n    start: function(e) {\n      var self = this;\n\n      // when an element is touched/clicked, it climbs up a few\n      // parents to see if it is an .item or .button element\n      ionic.requestAnimationFrame(function(){\n        if ( ionic.tap.requiresNativeClick(e.target) ) return;\n        var ele = e.target;\n        var eleToActivate;\n\n        for(var x=0; x<6; x++) {\n          if(!ele || ele.nodeType !== 1) break;\n          if(eleToActivate && ele.classList.contains('item')) {\n            eleToActivate = ele;\n            break;\n          }\n          if( ele.tagName == 'A' || ele.tagName == 'BUTTON' || ele.hasAttribute('ng-click') ) {\n            eleToActivate = ele;\n            break;\n          }\n          if( ele.classList.contains('button') ) {\n            eleToActivate = ele;\n            break;\n          }\n          // no sense climbing past these\n          if(ele.classList.contains('pane') || ele.tagName == 'BODY' || ele.tagName == 'ION-CONTENT'){\n            break;\n          }\n          ele = ele.parentElement;\n        }\n\n        if(eleToActivate) {\n          // queue that this element should be set to active\n          queueElements[keyId] = eleToActivate;\n\n          // in XX milliseconds, set the queued elements to active\n          if(e.type === 'touchstart') {\n            self._activateTimeout = setTimeout(activateElements, 80);\n          } else {\n            ionic.requestAnimationFrame(activateElements);\n          }\n\n          keyId = (keyId > 19 ? 0 : keyId + 1);\n        }\n\n      });\n    },\n\n    end: function() {\n      // clear out any active/queued elements after XX milliseconds\n      clearTimeout(this._activateTimeout);\n      setTimeout(clear, 200);\n    }\n\n  };\n\n  function clear() {\n    // clear out any elements that are queued to be set to active\n    queueElements = {};\n\n    // in the next frame, remove the active class from all active elements\n    ionic.requestAnimationFrame(deactivateElements);\n  }\n\n  function activateElements() {\n    // activate all elements in the queue\n    for(var key in queueElements) {\n      if(queueElements[key]) {\n        queueElements[key].classList.add(ACTIVATED_CLASS);\n        activeElements[key] = queueElements[key];\n      }\n    }\n    queueElements = {};\n  }\n\n  function deactivateElements() {\n    for(var key in activeElements) {\n      if(activeElements[key]) {\n        activeElements[key].classList.remove(ACTIVATED_CLASS);\n        delete activeElements[key];\n      }\n    }\n  }\n\n})(document, ionic);\n\n(function(ionic) {\n\n  /* for nextUid() function below */\n  var uid = ['0','0','0'];\n\n  /**\n   * Various utilities used throughout Ionic\n   *\n   * Some of these are adopted from underscore.js and backbone.js, both also MIT licensed.\n   */\n  ionic.Utils = {\n\n    arrayMove: function (arr, old_index, new_index) {\n      if (new_index >= arr.length) {\n        var k = new_index - arr.length;\n        while ((k--) + 1) {\n          arr.push(undefined);\n        }\n      }\n      arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);\n      return arr;\n    },\n\n    /**\n     * Return a function that will be called with the given context\n     */\n    proxy: function(func, context) {\n      var args = Array.prototype.slice.call(arguments, 2);\n      return function() {\n        return func.apply(context, args.concat(Array.prototype.slice.call(arguments)));\n      };\n    },\n\n    /**\n     * Only call a function once in the given interval.\n     *\n     * @param func {Function} the function to call\n     * @param wait {int} how long to wait before/after to allow function calls\n     * @param immediate {boolean} whether to call immediately or after the wait interval\n     */\n     debounce: function(func, wait, immediate) {\n      var timeout, args, context, timestamp, result;\n      return function() {\n        context = this;\n        args = arguments;\n        timestamp = new Date();\n        var later = function() {\n          var last = (new Date()) - timestamp;\n          if (last < wait) {\n            timeout = setTimeout(later, wait - last);\n          } else {\n            timeout = null;\n            if (!immediate) result = func.apply(context, args);\n          }\n        };\n        var callNow = immediate && !timeout;\n        if (!timeout) {\n          timeout = setTimeout(later, wait);\n        }\n        if (callNow) result = func.apply(context, args);\n        return result;\n      };\n    },\n\n    /**\n     * Throttle the given fun, only allowing it to be\n     * called at most every `wait` ms.\n     */\n    throttle: function(func, wait, options) {\n      var context, args, result;\n      var timeout = null;\n      var previous = 0;\n      options || (options = {});\n      var later = function() {\n        previous = options.leading === false ? 0 : Date.now();\n        timeout = null;\n        result = func.apply(context, args);\n      };\n      return function() {\n        var now = Date.now();\n        if (!previous && options.leading === false) previous = now;\n        var remaining = wait - (now - previous);\n        context = this;\n        args = arguments;\n        if (remaining <= 0) {\n          clearTimeout(timeout);\n          timeout = null;\n          previous = now;\n          result = func.apply(context, args);\n        } else if (!timeout && options.trailing !== false) {\n          timeout = setTimeout(later, remaining);\n        }\n        return result;\n      };\n    },\n     // Borrowed from Backbone.js's extend\n     // Helper function to correctly set up the prototype chain, for subclasses.\n     // Similar to `goog.inherits`, but uses a hash of prototype properties and\n     // class properties to be extended.\n    inherit: function(protoProps, staticProps) {\n      var parent = this;\n      var child;\n\n      // The constructor function for the new subclass is either defined by you\n      // (the \"constructor\" property in your `extend` definition), or defaulted\n      // by us to simply call the parent's constructor.\n      if (protoProps && protoProps.hasOwnProperty('constructor')) {\n        child = protoProps.constructor;\n      } else {\n        child = function(){ return parent.apply(this, arguments); };\n      }\n\n      // Add static properties to the constructor function, if supplied.\n      ionic.extend(child, parent, staticProps);\n\n      // Set the prototype chain to inherit from `parent`, without calling\n      // `parent`'s constructor function.\n      var Surrogate = function(){ this.constructor = child; };\n      Surrogate.prototype = parent.prototype;\n      child.prototype = new Surrogate();\n\n      // Add prototype properties (instance properties) to the subclass,\n      // if supplied.\n      if (protoProps) ionic.extend(child.prototype, protoProps);\n\n      // Set a convenience property in case the parent's prototype is needed\n      // later.\n      child.__super__ = parent.prototype;\n\n      return child;\n    },\n\n    // Extend adapted from Underscore.js\n    extend: function(obj) {\n       var args = Array.prototype.slice.call(arguments, 1);\n       for(var i = 0; i < args.length; i++) {\n         var source = args[i];\n         if (source) {\n           for (var prop in source) {\n             obj[prop] = source[prop];\n           }\n         }\n       }\n       return obj;\n    },\n\n    /**\n     * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric\n     * characters such as '012ABC'. The reason why we are not using simply a number counter is that\n     * the number string gets longer over time, and it can also overflow, where as the nextId\n     * will grow much slower, it is a string, and it will never overflow.\n     *\n     * @returns an unique alpha-numeric string\n     */\n    nextUid: function() {\n      var index = uid.length;\n      var digit;\n\n      while(index) {\n        index--;\n        digit = uid[index].charCodeAt(0);\n        if (digit == 57 /*'9'*/) {\n          uid[index] = 'A';\n          return uid.join('');\n        }\n        if (digit == 90  /*'Z'*/) {\n          uid[index] = '0';\n        } else {\n          uid[index] = String.fromCharCode(digit + 1);\n          return uid.join('');\n        }\n      }\n      uid.unshift('0');\n      return uid.join('');\n    }\n  };\n\n  // Bind a few of the most useful functions to the ionic scope\n  ionic.inherit = ionic.Utils.inherit;\n  ionic.extend = ionic.Utils.extend;\n  ionic.throttle = ionic.Utils.throttle;\n  ionic.proxy = ionic.Utils.proxy;\n  ionic.debounce = ionic.Utils.debounce;\n\n})(window.ionic);\n\n/**\n * @ngdoc page\n * @name keyboard\n * @module ionic\n * @description\n * On both Android and iOS, Ionic will attempt to prevent the keyboard from\n * obscuring inputs and focusable elements when it appears by scrolling them\n * into view.  In order for this to work, any focusable elements must be within\n * a [Scroll View](http://ionicframework.com/docs/api/directive/ionScroll/)\n * or a directive such as [Content](http://ionicframework.com/docs/api/directive/ionContent/)\n * that has a Scroll View.\n *\n * It will also attempt to prevent the native overflow scrolling on focus,\n * which can cause layout issues such as pushing headers up and out of view.\n *\n * The keyboard fixes work best in conjunction with the\n * [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard),\n * although it will perform reasonably well without.  However, if you are using\n * Cordova there is no reason not to use the plugin.\n *\n * ### Hide when keyboard shows\n *\n * To hide an element when the keyboard is open, add the class `hide-on-keyboard-open`.\n *\n * ```html\n * <div class=\"hide-on-keyboard-open\">\n *   <div id=\"google-map\"></div>\n * </div>\n * ```\n * ----------\n *\n * ### Plugin Usage\n * Information on using the plugin can be found at\n * [https://github.com/driftyco/ionic-plugins-keyboard](https://github.com/driftyco/ionic-plugins-keyboard).\n *\n * ----------\n *\n * ### Android Notes\n * - If your app is running in fullscreen, i.e. you have\n *   `<preference name=\"Fullscreen\" value=\"true\" />` in your `config.xml` file\n *   you will need to set `ionic.Platform.isFullScreen = true` manually.\n *\n * - You can configure the behavior of the web view when the keyboard shows by setting\n *   [android:windowSoftInputMode](http://developer.android.com/reference/android/R.attr.html#windowSoftInputMode)\n *   to either `adjustPan`, `adjustResize` or `adjustNothing` in your app's\n *   activity in `AndroidManifest.xml`. `adjustResize` is the recommended setting\n *   for Ionic, but if for some reason you do use `adjustPan` you will need to\n *   set `ionic.Platform.isFullScreen = true`.\n *\n *   ```xml\n *   <activity android:windowSoftInputMode=\"adjustResize\">\n *\n *   ```\n *\n * ### iOS Notes\n * - If the content of your app (including the header) is being pushed up and\n *   out of view on input focus, try setting `cordova.plugins.Keyboard.disableScroll(true)`.\n *   This does **not** disable scrolling in the Ionic scroll view, rather it\n *   disables the native overflow scrolling that happens automatically as a\n *   result of focusing on inputs below the keyboard.\n *\n */\n\nvar keyboardViewportHeight = getViewportHeight();\nvar keyboardIsOpen;\nvar keyboardActiveElement;\nvar keyboardFocusOutTimer;\nvar keyboardFocusInTimer;\nvar keyboardLastShow = 0;\n\nvar KEYBOARD_OPEN_CSS = 'keyboard-open';\nvar SCROLL_CONTAINER_CSS = 'scroll';\n\nionic.keyboard = {\n  isOpen: false,\n  height: null,\n  landscape: false,\n};\n\nfunction keyboardInit() {\n  if( keyboardHasPlugin() ) {\n    window.addEventListener('native.keyboardshow', keyboardNativeShow);\n    window.addEventListener('native.keyboardhide', keyboardFocusOut);\n\n    //deprecated\n    window.addEventListener('native.showkeyboard', keyboardNativeShow);\n    window.addEventListener('native.hidekeyboard', keyboardFocusOut);\n\n  } else {\n    document.body.addEventListener('focusout', keyboardFocusOut);\n  }\n\n  document.body.addEventListener('ionic.focusin', keyboardBrowserFocusIn);\n  document.body.addEventListener('focusin', keyboardBrowserFocusIn);\n\n  document.body.addEventListener('orientationchange', keyboardOrientationChange);\n\n  if (window.navigator.msPointerEnabled) {\n    document.removeEventListener(\"MSPointerDown\", keyboardInit);\n  } else {\n    document.removeEventListener('touchstart', keyboardInit);\n  }\n}\n\nfunction keyboardNativeShow(e) {\n  clearTimeout(keyboardFocusOutTimer);\n  ionic.keyboard.height = e.keyboardHeight;\n}\n\nfunction keyboardBrowserFocusIn(e) {\n  if( !e.target || !ionic.tap.isTextInput(e.target) || ionic.tap.isDateInput(e.target) || !keyboardIsWithinScroll(e.target) ) return;\n\n  document.addEventListener('keydown', keyboardOnKeyDown, false);\n\n  document.body.scrollTop = 0;\n  document.body.querySelector('.scroll-content').scrollTop = 0;\n\n  keyboardActiveElement = e.target;\n\n  keyboardSetShow(e);\n}\n\nfunction keyboardSetShow(e) {\n  clearTimeout(keyboardFocusInTimer);\n  clearTimeout(keyboardFocusOutTimer);\n\n  keyboardFocusInTimer = setTimeout(function(){\n    if ( keyboardLastShow + 350 > Date.now() ) return;\n    keyboardLastShow = Date.now();\n    var keyboardHeight;\n    var elementBounds = keyboardActiveElement.getBoundingClientRect();\n    var count = 0;\n\n    var pollKeyboardHeight = setInterval(function(){\n\n      keyboardHeight = keyboardGetHeight();\n      if (count > 10){\n        clearInterval(pollKeyboardHeight);\n        //waited long enough, just guess\n        keyboardHeight = 275;\n      }\n      if (keyboardHeight){\n        keyboardShow(e.target, elementBounds.top, elementBounds.bottom, keyboardViewportHeight, keyboardHeight);\n        clearInterval(pollKeyboardHeight);\n      }\n      count++;\n\n    }, 100);\n  }, 32);\n}\n\nfunction keyboardShow(element, elementTop, elementBottom, viewportHeight, keyboardHeight) {\n  var details = {\n    target: element,\n    elementTop: Math.round(elementTop),\n    elementBottom: Math.round(elementBottom),\n    keyboardHeight: keyboardHeight,\n    viewportHeight: viewportHeight\n  };\n\n  details.hasPlugin = keyboardHasPlugin();\n\n  details.contentHeight = viewportHeight - keyboardHeight;\n\n  void 0;\n\n  // figure out if the element is under the keyboard\n  details.isElementUnderKeyboard = (details.elementBottom > details.contentHeight);\n\n  ionic.keyboard.isOpen = true;\n\n  // send event so the scroll view adjusts\n  keyboardActiveElement = element;\n  ionic.trigger('scrollChildIntoView', details, true);\n\n  ionic.requestAnimationFrame(function(){\n    document.body.classList.add(KEYBOARD_OPEN_CSS);\n  });\n\n  // any showing part of the document that isn't within the scroll the user\n  // could touchmove and cause some ugly changes to the app, so disable\n  // any touchmove events while the keyboard is open using e.preventDefault()\n  if (window.navigator.msPointerEnabled) {\n    document.addEventListener(\"MSPointerMove\", keyboardPreventDefault, false);\n  } else {\n    document.addEventListener('touchmove', keyboardPreventDefault, false);\n  }\n\n  return details;\n}\n\nfunction keyboardFocusOut(e) {\n  clearTimeout(keyboardFocusOutTimer);\n\n  keyboardFocusOutTimer = setTimeout(keyboardHide, 350);\n}\n\nfunction keyboardHide() {\n  void 0;\n  ionic.keyboard.isOpen = false;\n\n  ionic.trigger('resetScrollView', {\n    target: keyboardActiveElement\n  }, true);\n\n  ionic.requestAnimationFrame(function(){\n    document.body.classList.remove(KEYBOARD_OPEN_CSS);\n  });\n\n  // the keyboard is gone now, remove the touchmove that disables native scroll\n  if (window.navigator.msPointerEnabled) {\n    document.removeEventListener(\"MSPointerMove\", keyboardPreventDefault);\n  } else {\n    document.removeEventListener('touchmove', keyboardPreventDefault);\n  }\n  document.removeEventListener('keydown', keyboardOnKeyDown);\n}\n\nfunction keyboardUpdateViewportHeight() {\n  if( getViewportHeight() > keyboardViewportHeight ) {\n    keyboardViewportHeight = getViewportHeight();\n  }\n}\n\nfunction keyboardOnKeyDown(e) {\n  if( ionic.scroll.isScrolling ) {\n    keyboardPreventDefault(e);\n  }\n}\n\nfunction keyboardPreventDefault(e) {\n  if( e.target.tagName !== 'TEXTAREA' ) {\n    e.preventDefault();\n  }\n}\n\nfunction keyboardOrientationChange() {\n  var updatedViewportHeight = getViewportHeight();\n\n  //too slow, have to wait for updated height\n  if (updatedViewportHeight === keyboardViewportHeight){\n    var count = 0;\n    var pollViewportHeight = setInterval(function(){\n      //give up\n      if (count > 10){\n        clearInterval(pollViewportHeight);\n      }\n\n      updatedViewportHeight = getViewportHeight();\n\n      if (updatedViewportHeight !== keyboardViewportHeight){\n        if (updatedViewportHeight < keyboardViewportHeight){\n          ionic.keyboard.landscape = true;\n        } else {\n          ionic.keyboard.landscape = false;\n        }\n        keyboardViewportHeight = updatedViewportHeight;\n        clearInterval(pollViewportHeight);\n      }\n      count++;\n\n    }, 50);\n  } else {\n    keyboardViewportHeight = updatedViewportHeight;\n  }\n}\n\nfunction keyboardGetHeight() {\n  // check if we are already have a keyboard height from the plugin\n  if ( ionic.keyboard.height ) {\n    return ionic.keyboard.height;\n  }\n\n  if ( ionic.Platform.isAndroid() ){\n    //should be using the plugin, no way to know how big the keyboard is, so guess\n    if ( ionic.Platform.isFullScreen ){\n      return 275;\n    }\n    //otherwise, wait for the screen to resize\n    if ( getViewportHeight() < keyboardViewportHeight ){\n      return keyboardViewportHeight - getViewportHeight();\n    } else {\n      return 0;\n    }\n  }\n\n  // fallback for when its the webview without the plugin\n  // or for just the standard web browser\n  if( ionic.Platform.isIOS() ) {\n    if ( ionic.keyboard.landscape ){\n      return 206;\n    }\n\n    if (!ionic.Platform.isWebView()){\n      return 216;\n    }\n\n    return 260;\n  }\n\n  // safe guess\n  return 275;\n}\n\nfunction getViewportHeight() {\n  return window.innerHeight || screen.height;\n}\n\nfunction keyboardIsWithinScroll(ele) {\n  while(ele) {\n    if(ele.classList.contains(SCROLL_CONTAINER_CSS)) {\n      return true;\n    }\n    ele = ele.parentElement;\n  }\n  return false;\n}\n\nfunction keyboardHasPlugin() {\n  return !!(window.cordova && cordova.plugins && cordova.plugins.Keyboard);\n}\n\nionic.Platform.ready(function() {\n  keyboardUpdateViewportHeight();\n\n  // Android sometimes reports bad innerHeight on window.load\n  // try it again in a lil bit to play it safe\n  setTimeout(keyboardUpdateViewportHeight, 999);\n\n  // only initialize the adjustments for the virtual keyboard\n  // if a touchstart event happens\n  if (window.navigator.msPointerEnabled) {\n    document.addEventListener(\"MSPointerDown\", keyboardInit, false);\n  } else {\n    document.addEventListener('touchstart', keyboardInit, false);\n  }\n});\n\n\n\nvar viewportTag;\nvar viewportProperties = {};\n\nionic.viewport = {\n  orientation: function() {\n    // 0 = Portrait\n    // 90 = Landscape\n    // not using window.orientation because each device has a different implementation\n    return (window.innerWidth > window.innerHeight ? 90 : 0);\n  }\n};\n\nfunction viewportLoadTag() {\n  var x;\n\n  for(x=0; x<document.head.children.length; x++) {\n    if(document.head.children[x].name == 'viewport') {\n      viewportTag = document.head.children[x];\n      break;\n    }\n  }\n\n  if(viewportTag) {\n    var props = viewportTag.content.toLowerCase().replace(/\\s+/g, '').split(',');\n    var keyValue;\n    for(x=0; x<props.length; x++) {\n      if(props[x]) {\n        keyValue = props[x].split('=');\n        viewportProperties[ keyValue[0] ] = (keyValue.length > 1 ? keyValue[1] : '_');\n      }\n    }\n    viewportUpdate();\n  }\n}\n\nfunction viewportUpdate() {\n  // unit tests in viewport.unit.js\n\n  var initWidth = viewportProperties.width;\n  var initHeight = viewportProperties.height;\n  var p = ionic.Platform;\n  var version = p.version();\n  var DEVICE_WIDTH = 'device-width';\n  var DEVICE_HEIGHT = 'device-height';\n  var orientation = ionic.viewport.orientation();\n\n  // Most times we're removing the height and adding the width\n  // So this is the default to start with, then modify per platform/version/oreintation\n  delete viewportProperties.height;\n  viewportProperties.width = DEVICE_WIDTH;\n\n  if( p.isIPad() ) {\n    // iPad\n\n    if( version > 7 ) {\n      // iPad >= 7.1\n      // https://issues.apache.org/jira/browse/CB-4323\n      delete viewportProperties.width;\n\n    } else {\n      // iPad <= 7.0\n\n      if( p.isWebView() ) {\n        // iPad <= 7.0 WebView\n\n        if( orientation == 90 ) {\n          // iPad <= 7.0 WebView Landscape\n          viewportProperties.height = '0';\n\n        } else if(version == 7) {\n          // iPad <= 7.0 WebView Portait\n          viewportProperties.height = DEVICE_HEIGHT;\n        }\n      } else {\n        // iPad <= 6.1 Browser\n        if(version < 7) {\n          viewportProperties.height = '0';\n        }\n      }\n    }\n\n  } else if( p.isIOS() ) {\n    // iPhone\n\n    if( p.isWebView() ) {\n      // iPhone WebView\n\n      if(version > 7) {\n        // iPhone >= 7.1 WebView\n        delete viewportProperties.width;\n\n      } else if(version < 7) {\n        // iPhone <= 6.1 WebView\n        // if height was set it needs to get removed with this hack for <= 6.1\n        if( initHeight ) viewportProperties.height = '0';\n\n      } else if(version == 7) {\n        //iPhone == 7.0 WebView\n        viewportProperties.height = DEVICE_HEIGHT;\n      }\n\n    } else {\n      // iPhone Browser\n\n      if (version < 7) {\n        // iPhone <= 6.1 Browser\n        // if height was set it needs to get removed with this hack for <= 6.1\n        if( initHeight ) viewportProperties.height = '0';\n      }\n    }\n\n  }\n\n  // only update the viewport tag if there was a change\n  if(initWidth !== viewportProperties.width || initHeight !== viewportProperties.height) {\n    viewportTagUpdate();\n  }\n}\n\nfunction viewportTagUpdate() {\n  var key, props = [];\n  for(key in viewportProperties) {\n    if( viewportProperties[key] ) {\n      props.push(key + (viewportProperties[key] == '_' ? '' : '=' + viewportProperties[key]) );\n    }\n  }\n\n  viewportTag.content = props.join(', ');\n}\n\nionic.Platform.ready(function() {\n  viewportLoadTag();\n\n  window.addEventListener(\"orientationchange\", function(){\n    setTimeout(viewportUpdate, 1000);\n  }, false);\n});\n\n(function(ionic) {\n'use strict';\n  ionic.views.View = function() {\n    this.initialize.apply(this, arguments);\n  };\n\n  ionic.views.View.inherit = ionic.inherit;\n\n  ionic.extend(ionic.views.View.prototype, {\n    initialize: function() {}\n  });\n\n})(window.ionic);\n\n/*\n * Scroller\n * http://github.com/zynga/scroller\n *\n * Copyright 2011, Zynga Inc.\n * Licensed under the MIT License.\n * https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt\n *\n * Based on the work of: Unify Project (unify-project.org)\n * http://unify-project.org\n * Copyright 2011, Deutsche Telekom AG\n * License: MIT + Apache (V2)\n */\n\n/* jshint eqnull: true */\n\n/**\n * Generic animation class with support for dropped frames both optional easing and duration.\n *\n * Optional duration is useful when the lifetime is defined by another condition than time\n * e.g. speed of an animating object, etc.\n *\n * Dropped frame logic allows to keep using the same updater logic independent from the actual\n * rendering. This eases a lot of cases where it might be pretty complex to break down a state\n * based on the pure time difference.\n */\nvar zyngaCore = { effect: {} };\n(function(global) {\n  var time = Date.now || function() {\n    return +new Date();\n  };\n  var desiredFrames = 60;\n  var millisecondsPerSecond = 1000;\n  var running = {};\n  var counter = 1;\n\n  zyngaCore.effect.Animate = {\n\n    /**\n     * A requestAnimationFrame wrapper / polyfill.\n     *\n     * @param callback {Function} The callback to be invoked before the next repaint.\n     * @param root {HTMLElement} The root element for the repaint\n     */\n    requestAnimationFrame: (function() {\n\n      // Check for request animation Frame support\n      var requestFrame = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || global.oRequestAnimationFrame;\n      var isNative = !!requestFrame;\n\n      if (requestFrame && !/requestAnimationFrame\\(\\)\\s*\\{\\s*\\[native code\\]\\s*\\}/i.test(requestFrame.toString())) {\n        isNative = false;\n      }\n\n      if (isNative) {\n        return function(callback, root) {\n          requestFrame(callback, root);\n        };\n      }\n\n      var TARGET_FPS = 60;\n      var requests = {};\n      var requestCount = 0;\n      var rafHandle = 1;\n      var intervalHandle = null;\n      var lastActive = +new Date();\n\n      return function(callback, root) {\n        var callbackHandle = rafHandle++;\n\n        // Store callback\n        requests[callbackHandle] = callback;\n        requestCount++;\n\n        // Create timeout at first request\n        if (intervalHandle === null) {\n\n          intervalHandle = setInterval(function() {\n\n            var time = +new Date();\n            var currentRequests = requests;\n\n            // Reset data structure before executing callbacks\n            requests = {};\n            requestCount = 0;\n\n            for(var key in currentRequests) {\n              if (currentRequests.hasOwnProperty(key)) {\n                currentRequests[key](time);\n                lastActive = time;\n              }\n            }\n\n            // Disable the timeout when nothing happens for a certain\n            // period of time\n            if (time - lastActive > 2500) {\n              clearInterval(intervalHandle);\n              intervalHandle = null;\n            }\n\n          }, 1000 / TARGET_FPS);\n        }\n\n        return callbackHandle;\n      };\n\n    })(),\n\n\n    /**\n     * Stops the given animation.\n     *\n     * @param id {Integer} Unique animation ID\n     * @return {Boolean} Whether the animation was stopped (aka, was running before)\n     */\n    stop: function(id) {\n      var cleared = running[id] != null;\n      if (cleared) {\n        running[id] = null;\n      }\n\n      return cleared;\n    },\n\n\n    /**\n     * Whether the given animation is still running.\n     *\n     * @param id {Integer} Unique animation ID\n     * @return {Boolean} Whether the animation is still running\n     */\n    isRunning: function(id) {\n      return running[id] != null;\n    },\n\n\n    /**\n     * Start the animation.\n     *\n     * @param stepCallback {Function} Pointer to function which is executed on every step.\n     *   Signature of the method should be `function(percent, now, virtual) { return continueWithAnimation; }`\n     * @param verifyCallback {Function} Executed before every animation step.\n     *   Signature of the method should be `function() { return continueWithAnimation; }`\n     * @param completedCallback {Function}\n     *   Signature of the method should be `function(droppedFrames, finishedAnimation) {}`\n     * @param duration {Integer} Milliseconds to run the animation\n     * @param easingMethod {Function} Pointer to easing function\n     *   Signature of the method should be `function(percent) { return modifiedValue; }`\n     * @param root {Element} Render root, when available. Used for internal\n     *   usage of requestAnimationFrame.\n     * @return {Integer} Identifier of animation. Can be used to stop it any time.\n     */\n    start: function(stepCallback, verifyCallback, completedCallback, duration, easingMethod, root) {\n\n      var start = time();\n      var lastFrame = start;\n      var percent = 0;\n      var dropCounter = 0;\n      var id = counter++;\n\n      if (!root) {\n        root = document.body;\n      }\n\n      // Compacting running db automatically every few new animations\n      if (id % 20 === 0) {\n        var newRunning = {};\n        for (var usedId in running) {\n          newRunning[usedId] = true;\n        }\n        running = newRunning;\n      }\n\n      // This is the internal step method which is called every few milliseconds\n      var step = function(virtual) {\n\n        // Normalize virtual value\n        var render = virtual !== true;\n\n        // Get current time\n        var now = time();\n\n        // Verification is executed before next animation step\n        if (!running[id] || (verifyCallback && !verifyCallback(id))) {\n\n          running[id] = null;\n          completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, false);\n          return;\n\n        }\n\n        // For the current rendering to apply let's update omitted steps in memory.\n        // This is important to bring internal state variables up-to-date with progress in time.\n        if (render) {\n\n          var droppedFrames = Math.round((now - lastFrame) / (millisecondsPerSecond / desiredFrames)) - 1;\n          for (var j = 0; j < Math.min(droppedFrames, 4); j++) {\n            step(true);\n            dropCounter++;\n          }\n\n        }\n\n        // Compute percent value\n        if (duration) {\n          percent = (now - start) / duration;\n          if (percent > 1) {\n            percent = 1;\n          }\n        }\n\n        // Execute step callback, then...\n        var value = easingMethod ? easingMethod(percent) : percent;\n        if ((stepCallback(value, now, render) === false || percent === 1) && render) {\n          running[id] = null;\n          completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, percent === 1 || duration == null);\n        } else if (render) {\n          lastFrame = now;\n          zyngaCore.effect.Animate.requestAnimationFrame(step, root);\n        }\n      };\n\n      // Mark as running\n      running[id] = true;\n\n      // Init first step\n      zyngaCore.effect.Animate.requestAnimationFrame(step, root);\n\n      // Return unique animation ID\n      return id;\n    }\n  };\n})(this);\n\n/*\n * Scroller\n * http://github.com/zynga/scroller\n *\n * Copyright 2011, Zynga Inc.\n * Licensed under the MIT License.\n * https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt\n *\n * Based on the work of: Unify Project (unify-project.org)\n * http://unify-project.org\n * Copyright 2011, Deutsche Telekom AG\n * License: MIT + Apache (V2)\n */\n\nvar Scroller;\n\n(function(ionic) {\n  var NOOP = function(){};\n\n  // Easing Equations (c) 2003 Robert Penner, all rights reserved.\n  // Open source under the BSD License.\n\n  /**\n   * @param pos {Number} position between 0 (start of effect) and 1 (end of effect)\n  **/\n  var easeOutCubic = function(pos) {\n    return (Math.pow((pos - 1), 3) + 1);\n  };\n\n  /**\n   * @param pos {Number} position between 0 (start of effect) and 1 (end of effect)\n  **/\n  var easeInOutCubic = function(pos) {\n    if ((pos /= 0.5) < 1) {\n      return 0.5 * Math.pow(pos, 3);\n    }\n\n    return 0.5 * (Math.pow((pos - 2), 3) + 2);\n  };\n\n\n/**\n * ionic.views.Scroll\n * A powerful scroll view with support for bouncing, pull to refresh, and paging.\n * @param   {Object}        options options for the scroll view\n * @class A scroll view system\n * @memberof ionic.views\n */\nionic.views.Scroll = ionic.views.View.inherit({\n  initialize: function(options) {\n    var self = this;\n\n    this.__container = options.el;\n    this.__content = options.el.firstElementChild;\n\n    //Remove any scrollTop attached to these elements; they are virtual scroll now\n    //This also stops on-load-scroll-to-window.location.hash that the browser does\n    setTimeout(function() {\n      if (self.__container && self.__content) {\n        self.__container.scrollTop = 0;\n        self.__content.scrollTop = 0;\n      }\n    });\n\n    this.options = {\n\n      /** Disable scrolling on x-axis by default */\n      scrollingX: false,\n      scrollbarX: true,\n\n      /** Enable scrolling on y-axis */\n      scrollingY: true,\n      scrollbarY: true,\n\n      startX: 0,\n      startY: 0,\n\n      /** The amount to dampen mousewheel events */\n      wheelDampen: 6,\n\n      /** The minimum size the scrollbars scale to while scrolling */\n      minScrollbarSizeX: 5,\n      minScrollbarSizeY: 5,\n\n      /** Scrollbar fading after scrolling */\n      scrollbarsFade: true,\n      scrollbarFadeDelay: 300,\n      /** The initial fade delay when the pane is resized or initialized */\n      scrollbarResizeFadeDelay: 1000,\n\n      /** Enable animations for deceleration, snap back, zooming and scrolling */\n      animating: true,\n\n      /** duration for animations triggered by scrollTo/zoomTo */\n      animationDuration: 250,\n\n      /** Enable bouncing (content can be slowly moved outside and jumps back after releasing) */\n      bouncing: true,\n\n      /** Enable locking to the main axis if user moves only slightly on one of them at start */\n      locking: true,\n\n      /** Enable pagination mode (switching between full page content panes) */\n      paging: false,\n\n      /** Enable snapping of content to a configured pixel grid */\n      snapping: false,\n\n      /** Enable zooming of content via API, fingers and mouse wheel */\n      zooming: false,\n\n      /** Minimum zoom level */\n      minZoom: 0.5,\n\n      /** Maximum zoom level */\n      maxZoom: 3,\n\n      /** Multiply or decrease scrolling speed **/\n      speedMultiplier: 1,\n\n      deceleration: 0.97,\n\n      /** Callback that is fired on the later of touch end or deceleration end,\n        provided that another scrolling action has not begun. Used to know\n        when to fade out a scrollbar. */\n      scrollingComplete: NOOP,\n\n      /** This configures the amount of change applied to deceleration when reaching boundaries  **/\n      penetrationDeceleration : 0.03,\n\n      /** This configures the amount of change applied to acceleration when reaching boundaries  **/\n      penetrationAcceleration : 0.08,\n\n      // The ms interval for triggering scroll events\n      scrollEventInterval: 10,\n\n      getContentWidth: function() {\n        return Math.max(self.__content.scrollWidth, self.__content.offsetWidth);\n      },\n      getContentHeight: function() {\n        return Math.max(self.__content.scrollHeight, self.__content.offsetHeight + (self.__content.offsetTop * 2));\n      }\n    };\n\n    for (var key in options) {\n      this.options[key] = options[key];\n    }\n\n    this.hintResize = ionic.debounce(function() {\n      self.resize();\n    }, 1000, true);\n\n    this.onScroll = function() {\n\n      if(!ionic.scroll.isScrolling) {\n        setTimeout(self.setScrollStart, 50);\n      } else {\n        clearTimeout(self.scrollTimer);\n        self.scrollTimer = setTimeout(self.setScrollStop, 80);\n      }\n\n    };\n\n    this.setScrollStart = function() {\n      ionic.scroll.isScrolling = Math.abs(ionic.scroll.lastTop - self.__scrollTop) > 1;\n      clearTimeout(self.scrollTimer);\n      self.scrollTimer = setTimeout(self.setScrollStop, 80);\n    };\n\n    this.setScrollStop = function() {\n      ionic.scroll.isScrolling = false;\n      ionic.scroll.lastTop = self.__scrollTop;\n    };\n\n    this.triggerScrollEvent = ionic.throttle(function() {\n      self.onScroll();\n      ionic.trigger('scroll', {\n        scrollTop: self.__scrollTop,\n        scrollLeft: self.__scrollLeft,\n        target: self.__container\n      });\n    }, this.options.scrollEventInterval);\n\n    this.triggerScrollEndEvent = function() {\n      ionic.trigger('scrollend', {\n        scrollTop: self.__scrollTop,\n        scrollLeft: self.__scrollLeft,\n        target: self.__container\n      });\n    };\n\n    this.__scrollLeft = this.options.startX;\n    this.__scrollTop = this.options.startY;\n\n    // Get the render update function, initialize event handlers,\n    // and calculate the size of the scroll container\n    this.__callback = this.getRenderFn();\n    this.__initEventHandlers();\n    this.__createScrollbars();\n\n  },\n\n  run: function() {\n    this.resize();\n\n    // Fade them out\n    this.__fadeScrollbars('out', this.options.scrollbarResizeFadeDelay);\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: STATUS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Whether only a single finger is used in touch handling */\n  __isSingleTouch: false,\n\n  /** Whether a touch event sequence is in progress */\n  __isTracking: false,\n\n  /** Whether a deceleration animation went to completion. */\n  __didDecelerationComplete: false,\n\n  /**\n   * Whether a gesture zoom/rotate event is in progress. Activates when\n   * a gesturestart event happens. This has higher priority than dragging.\n   */\n  __isGesturing: false,\n\n  /**\n   * Whether the user has moved by such a distance that we have enabled\n   * dragging mode. Hint: It's only enabled after some pixels of movement to\n   * not interrupt with clicks etc.\n   */\n  __isDragging: false,\n\n  /**\n   * Not touching and dragging anymore, and smoothly animating the\n   * touch sequence using deceleration.\n   */\n  __isDecelerating: false,\n\n  /**\n   * Smoothly animating the currently configured change\n   */\n  __isAnimating: false,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: DIMENSIONS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Available outer left position (from document perspective) */\n  __clientLeft: 0,\n\n  /** Available outer top position (from document perspective) */\n  __clientTop: 0,\n\n  /** Available outer width */\n  __clientWidth: 0,\n\n  /** Available outer height */\n  __clientHeight: 0,\n\n  /** Outer width of content */\n  __contentWidth: 0,\n\n  /** Outer height of content */\n  __contentHeight: 0,\n\n  /** Snapping width for content */\n  __snapWidth: 100,\n\n  /** Snapping height for content */\n  __snapHeight: 100,\n\n  /** Height to assign to refresh area */\n  __refreshHeight: null,\n\n  /** Whether the refresh process is enabled when the event is released now */\n  __refreshActive: false,\n\n  /** Callback to execute on activation. This is for signalling the user about a refresh is about to happen when he release */\n  __refreshActivate: null,\n\n  /** Callback to execute on deactivation. This is for signalling the user about the refresh being cancelled */\n  __refreshDeactivate: null,\n\n  /** Callback to execute to start the actual refresh. Call {@link #refreshFinish} when done */\n  __refreshStart: null,\n\n  /** Zoom level */\n  __zoomLevel: 1,\n\n  /** Scroll position on x-axis */\n  __scrollLeft: 0,\n\n  /** Scroll position on y-axis */\n  __scrollTop: 0,\n\n  /** Maximum allowed scroll position on x-axis */\n  __maxScrollLeft: 0,\n\n  /** Maximum allowed scroll position on y-axis */\n  __maxScrollTop: 0,\n\n  /* Scheduled left position (final position when animating) */\n  __scheduledLeft: 0,\n\n  /* Scheduled top position (final position when animating) */\n  __scheduledTop: 0,\n\n  /* Scheduled zoom level (final scale when animating) */\n  __scheduledZoom: 0,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: LAST POSITIONS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Left position of finger at start */\n  __lastTouchLeft: null,\n\n  /** Top position of finger at start */\n  __lastTouchTop: null,\n\n  /** Timestamp of last move of finger. Used to limit tracking range for deceleration speed. */\n  __lastTouchMove: null,\n\n  /** List of positions, uses three indexes for each state: left, top, timestamp */\n  __positions: null,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: DECELERATION SUPPORT\n  ---------------------------------------------------------------------------\n  */\n\n  /** Minimum left scroll position during deceleration */\n  __minDecelerationScrollLeft: null,\n\n  /** Minimum top scroll position during deceleration */\n  __minDecelerationScrollTop: null,\n\n  /** Maximum left scroll position during deceleration */\n  __maxDecelerationScrollLeft: null,\n\n  /** Maximum top scroll position during deceleration */\n  __maxDecelerationScrollTop: null,\n\n  /** Current factor to modify horizontal scroll position with on every step */\n  __decelerationVelocityX: null,\n\n  /** Current factor to modify vertical scroll position with on every step */\n  __decelerationVelocityY: null,\n\n\n  /** the browser-specific property to use for transforms */\n  __transformProperty: null,\n  __perspectiveProperty: null,\n\n  /** scrollbar indicators */\n  __indicatorX: null,\n  __indicatorY: null,\n\n  /** Timeout for scrollbar fading */\n  __scrollbarFadeTimeout: null,\n\n  /** whether we've tried to wait for size already */\n  __didWaitForSize: null,\n  __sizerTimeout: null,\n\n  __initEventHandlers: function() {\n    var self = this;\n\n    // Event Handler\n    var container = this.__container;\n\n    self.scrollChildIntoView = function(e) {\n\n      //distance from bottom of scrollview to top of viewport\n      var scrollBottomOffsetToTop;\n\n      if( !self.isScrolledIntoView ) {\n        // shrink scrollview so we can actually scroll if the input is hidden\n        // if it isn't shrink so we can scroll to inputs under the keyboard\n        if (ionic.Platform.isIOS() || ionic.Platform.isFullScreen){\n          // if there are things below the scroll view account for them and\n          // subtract them from the keyboard height when resizing\n          scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n          var scrollBottomOffsetToBottom = e.detail.viewportHeight - scrollBottomOffsetToTop;\n          var keyboardOffset = Math.max(0, e.detail.keyboardHeight - scrollBottomOffsetToBottom);\n          container.style.height = (container.clientHeight - keyboardOffset) + \"px\";\n          container.style.overflow = \"visible\";\n          //update scroll view\n          self.resize();\n        }\n        self.isScrolledIntoView = true;\n      }\n\n      //If the element is positioned under the keyboard...\n      if( e.detail.isElementUnderKeyboard ) {\n        var delay;\n        // Wait on android for web view to resize\n        if ( ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen ) {\n          // android y u resize so slow\n          if ( ionic.Platform.version() < 4.4) {\n            delay = 500;\n          } else {\n            // probably overkill for chrome\n            delay = 350;\n          }\n        } else {\n          delay = 80;\n        }\n\n        //Put element in middle of visible screen\n        //Wait for android to update view height and resize() to reset scroll position\n        ionic.scroll.isScrolling = true;\n        setTimeout(function(){\n          //middle of the scrollview, where we want to scroll to\n          var scrollMidpointOffset = container.clientHeight * 0.5;\n\n          scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n          //distance from top of focused element to the bottom of the scroll view\n          var elementTopOffsetToScrollBottom = e.detail.elementTop - scrollBottomOffsetToTop;\n\n          var scrollTop = elementTopOffsetToScrollBottom  + scrollMidpointOffset;\n\n          if (scrollTop > 0){\n            ionic.tap.cloneFocusedInput(container, self);\n            self.scrollBy(0, scrollTop, true);\n            self.onScroll();\n          }\n        }, delay);\n      }\n\n      //Only the first scrollView parent of the element that broadcasted this event\n      //(the active element that needs to be shown) should receive this event\n      e.stopPropagation();\n    };\n\n    self.resetScrollView = function(e) {\n      //return scrollview to original height once keyboard has hidden\n      self.isScrolledIntoView = false;\n      container.style.height = \"\";\n      container.style.overflow = \"\";\n      self.resize();\n      ionic.scroll.isScrolling = false;\n    };\n\n    //Broadcasted when keyboard is shown on some platforms.\n    //See js/utils/keyboard.js\n    container.addEventListener('scrollChildIntoView', self.scrollChildIntoView);\n    container.addEventListener('resetScrollView', self.resetScrollView);\n\n    function getEventTouches(e) {\n      return e.touches && e.touches.length ? e.touches : [{\n        pageX: e.pageX,\n        pageY: e.pageY\n      }];\n    }\n\n    self.touchStart = function(e) {\n      self.startCoordinates = ionic.tap.pointerCoord(e);\n\n      if ( ionic.tap.ignoreScrollStart(e) ) {\n        return;\n      }\n\n      self.__isDown = true;\n\n      if( ionic.tap.containsOrIsTextInput(e.target) || e.target.tagName === 'SELECT' ) {\n        // do not start if the target is a text input\n        // if there is a touchmove on this input, then we can start the scroll\n        self.__hasStarted = false;\n        return;\n      }\n\n      self.__isSelectable = true;\n      self.__enableScrollY = true;\n      self.__hasStarted = true;\n      self.doTouchStart(getEventTouches(e), e.timeStamp);\n      e.preventDefault();\n    };\n\n    self.touchMove = function(e) {\n      if(!self.__isDown ||\n        e.defaultPrevented ||\n        (e.target.tagName === 'TEXTAREA' && e.target.parentElement.querySelector(':focus')) ) {\n        return;\n      }\n\n      if( !self.__hasStarted && ( ionic.tap.containsOrIsTextInput(e.target) || e.target.tagName === 'SELECT' ) ) {\n        // the target is a text input and scroll has started\n        // since the text input doesn't start on touchStart, do it here\n        self.__hasStarted = true;\n        self.doTouchStart(getEventTouches(e), e.timeStamp);\n        e.preventDefault();\n        return;\n      }\n\n      if(self.startCoordinates) {\n        // we have start coordinates, so get this touch move's current coordinates\n        var currentCoordinates = ionic.tap.pointerCoord(e);\n\n        if( self.__isSelectable &&\n            ionic.tap.isTextInput(e.target) &&\n            Math.abs(self.startCoordinates.x - currentCoordinates.x) > 20 ) {\n          // user slid the text input's caret on its x axis, disable any future y scrolling\n          self.__enableScrollY = false;\n          self.__isSelectable = true;\n        }\n\n        if( self.__enableScrollY && Math.abs(self.startCoordinates.y - currentCoordinates.y) > 10 ) {\n          // user scrolled the entire view on the y axis\n          // disabled being able to select text on an input\n          // hide the input which has focus, and show a cloned one that doesn't have focus\n          self.__isSelectable = false;\n          ionic.tap.cloneFocusedInput(container, self);\n        }\n      }\n\n      self.doTouchMove(getEventTouches(e), e.timeStamp, e.scale);\n      self.__isDown = true;\n    };\n\n    self.touchEnd = function(e) {\n      if(!self.__isDown) return;\n\n      self.doTouchEnd(e.timeStamp);\n      self.__isDown = false;\n      self.__hasStarted = false;\n      self.__isSelectable = true;\n      self.__enableScrollY = true;\n\n      if( !self.__isDragging && !self.__isDecelerating && !self.__isAnimating ) {\n        ionic.tap.removeClonedInputs(container, self);\n      }\n    };\n\n    if ('ontouchstart' in window) {\n      // Touch Events\n      container.addEventListener(\"touchstart\", self.touchStart, false);\n      document.addEventListener(\"touchmove\", self.touchMove, false);\n      document.addEventListener(\"touchend\", self.touchEnd, false);\n      document.addEventListener(\"touchcancel\", self.touchEnd, false);\n\n    } else if (window.navigator.pointerEnabled) {\n      // Pointer Events\n      container.addEventListener(\"pointerdown\", self.touchStart, false);\n      document.addEventListener(\"pointermove\", self.touchMove, false);\n      document.addEventListener(\"pointerup\", self.touchEnd, false);\n      document.addEventListener(\"pointercancel\", self.touchEnd, false);\n\n    } else if (window.navigator.msPointerEnabled) {\n      // IE10, WP8 (Pointer Events)\n      container.addEventListener(\"MSPointerDown\", self.touchStart, false);\n      document.addEventListener(\"MSPointerMove\", self.touchMove, false);\n      document.addEventListener(\"MSPointerUp\", self.touchEnd, false);\n      document.addEventListener(\"MSPointerCancel\", self.touchEnd, false);\n\n    } else {\n      // Mouse Events\n      var mousedown = false;\n\n      self.mouseDown = function(e) {\n        if ( ionic.tap.ignoreScrollStart(e) || e.target.tagName === 'SELECT' ) {\n          return;\n        }\n        self.doTouchStart(getEventTouches(e), e.timeStamp);\n\n        if( !ionic.tap.isTextInput(e.target) ) {\n          e.preventDefault();\n        }\n        mousedown = true;\n      };\n\n      self.mouseMove = function(e) {\n        if (!mousedown || e.defaultPrevented) {\n          return;\n        }\n\n        self.doTouchMove(getEventTouches(e), e.timeStamp);\n\n        mousedown = true;\n      };\n\n      self.mouseUp = function(e) {\n        if (!mousedown) {\n          return;\n        }\n\n        self.doTouchEnd(e.timeStamp);\n\n        mousedown = false;\n      };\n\n      self.mouseWheel = ionic.animationFrameThrottle(function(e) {\n        var scrollParent = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'ionic-scroll');\n        if (scrollParent === self.__container) {\n\n          self.hintResize();\n          self.scrollBy(\n            e.wheelDeltaX/self.options.wheelDampen,\n            -e.wheelDeltaY/self.options.wheelDampen\n          );\n\n          self.__fadeScrollbars('in');\n          clearTimeout(self.__wheelHideBarTimeout);\n          self.__wheelHideBarTimeout = setTimeout(function() {\n            self.__fadeScrollbars('out');\n          }, 100);\n        }\n      });\n\n      container.addEventListener(\"mousedown\", self.mouseDown, false);\n      document.addEventListener(\"mousemove\", self.mouseMove, false);\n      document.addEventListener(\"mouseup\", self.mouseUp, false);\n      document.addEventListener('mousewheel', self.mouseWheel, false);\n    }\n  },\n\n  __cleanup: function() {\n    var container = this.__container;\n    var self = this;\n\n    container.removeEventListener('touchstart', self.touchStart);\n    document.removeEventListener('touchmove', self.touchMove);\n    document.removeEventListener('touchend', self.touchEnd);\n    document.removeEventListener('touchcancel', self.touchCancel);\n\n    container.removeEventListener(\"pointerdown\", self.touchStart);\n    document.removeEventListener(\"pointermove\", self.touchMove);\n    document.removeEventListener(\"pointerup\", self.touchEnd);\n    document.removeEventListener(\"pointercancel\", self.touchEnd);\n\n    container.removeEventListener(\"MSPointerDown\", self.touchStart);\n    document.removeEventListener(\"MSPointerMove\", self.touchMove);\n    document.removeEventListener(\"MSPointerUp\", self.touchEnd);\n    document.removeEventListener(\"MSPointerCancel\", self.touchEnd);\n\n    container.removeEventListener(\"mousedown\", self.mouseDown);\n    document.removeEventListener(\"mousemove\", self.mouseMove);\n    document.removeEventListener(\"mouseup\", self.mouseUp);\n    document.removeEventListener('mousewheel', self.mouseWheel);\n\n    container.removeEventListener('scrollChildIntoView', self.scrollChildIntoView);\n    container.removeEventListener('resetScrollView', self.resetScrollView);\n\n    ionic.tap.removeClonedInputs(container, self);\n\n    delete this.__container;\n    delete this.__content;\n    delete this.__indicatorX;\n    delete this.__indicatorY;\n    delete this.options.el;\n\n    this.__callback = this.scrollChildIntoView = this.resetScrollView = angular.noop;\n\n    this.mouseMove = this.mouseDown = this.mouseUp = this.mouseWheel =\n      this.touchStart = this.touchMove = this.touchEnd = this.touchCancel = angular.noop;\n\n    this.resize = this.scrollTo = this.zoomTo =\n      this.__scrollingComplete = angular.noop;\n    container = null;\n  },\n\n  /** Create a scroll bar div with the given direction **/\n  __createScrollbar: function(direction) {\n    var bar = document.createElement('div'),\n      indicator = document.createElement('div');\n\n    indicator.className = 'scroll-bar-indicator';\n\n    if(direction == 'h') {\n      bar.className = 'scroll-bar scroll-bar-h';\n    } else {\n      bar.className = 'scroll-bar scroll-bar-v';\n    }\n\n    bar.appendChild(indicator);\n    return bar;\n  },\n\n  __createScrollbars: function() {\n    var indicatorX, indicatorY;\n\n    if(this.options.scrollingX) {\n      indicatorX = {\n        el: this.__createScrollbar('h'),\n        sizeRatio: 1\n      };\n      indicatorX.indicator = indicatorX.el.children[0];\n\n      if(this.options.scrollbarX) {\n        this.__container.appendChild(indicatorX.el);\n      }\n      this.__indicatorX = indicatorX;\n    }\n\n    if(this.options.scrollingY) {\n      indicatorY = {\n        el: this.__createScrollbar('v'),\n        sizeRatio: 1\n      };\n      indicatorY.indicator = indicatorY.el.children[0];\n\n      if(this.options.scrollbarY) {\n        this.__container.appendChild(indicatorY.el);\n      }\n      this.__indicatorY = indicatorY;\n    }\n  },\n\n  __resizeScrollbars: function() {\n    var self = this;\n\n    // Update horiz bar\n    if(self.__indicatorX) {\n      var width = Math.max(Math.round(self.__clientWidth * self.__clientWidth / (self.__contentWidth)), 20);\n      if(width > self.__contentWidth) {\n        width = 0;\n      }\n      self.__indicatorX.size = width;\n      self.__indicatorX.minScale = this.options.minScrollbarSizeX / width;\n      self.__indicatorX.indicator.style.width = width + 'px';\n      self.__indicatorX.maxPos = self.__clientWidth - width;\n      self.__indicatorX.sizeRatio = self.__maxScrollLeft ? self.__indicatorX.maxPos / self.__maxScrollLeft : 1;\n    }\n\n    // Update vert bar\n    if(self.__indicatorY) {\n      var height = Math.max(Math.round(self.__clientHeight * self.__clientHeight / (self.__contentHeight)), 20);\n      if(height > self.__contentHeight) {\n        height = 0;\n      }\n      self.__indicatorY.size = height;\n      self.__indicatorY.minScale = this.options.minScrollbarSizeY / height;\n      self.__indicatorY.maxPos = self.__clientHeight - height;\n      self.__indicatorY.indicator.style.height = height + 'px';\n      self.__indicatorY.sizeRatio = self.__maxScrollTop ? self.__indicatorY.maxPos / self.__maxScrollTop : 1;\n    }\n  },\n\n  /**\n   * Move and scale the scrollbars as the page scrolls.\n   */\n  __repositionScrollbars: function() {\n    var self = this, width, heightScale,\n        widthDiff, heightDiff,\n        x, y,\n        xstop = 0, ystop = 0;\n\n    if(self.__indicatorX) {\n      // Handle the X scrollbar\n\n      // Don't go all the way to the right if we have a vertical scrollbar as well\n      if(self.__indicatorY) xstop = 10;\n\n      x = Math.round(self.__indicatorX.sizeRatio * self.__scrollLeft) || 0,\n\n      // The the difference between the last content X position, and our overscrolled one\n      widthDiff = self.__scrollLeft - (self.__maxScrollLeft - xstop);\n\n      if(self.__scrollLeft < 0) {\n\n        widthScale = Math.max(self.__indicatorX.minScale,\n            (self.__indicatorX.size - Math.abs(self.__scrollLeft)) / self.__indicatorX.size);\n\n        // Stay at left\n        x = 0;\n\n        // Make sure scale is transformed from the left/center origin point\n        self.__indicatorX.indicator.style[self.__transformOriginProperty] = 'left center';\n      } else if(widthDiff > 0) {\n\n        widthScale = Math.max(self.__indicatorX.minScale,\n            (self.__indicatorX.size - widthDiff) / self.__indicatorX.size);\n\n        // Stay at the furthest x for the scrollable viewport\n        x = self.__indicatorX.maxPos - xstop;\n\n        // Make sure scale is transformed from the right/center origin point\n        self.__indicatorX.indicator.style[self.__transformOriginProperty] = 'right center';\n\n      } else {\n\n        // Normal motion\n        x = Math.min(self.__maxScrollLeft, Math.max(0, x));\n        widthScale = 1;\n\n      }\n\n      self.__indicatorX.indicator.style[self.__transformProperty] = 'translate3d(' + x + 'px, 0, 0) scaleX(' + widthScale + ')';\n    }\n\n    if(self.__indicatorY) {\n\n      y = Math.round(self.__indicatorY.sizeRatio * self.__scrollTop) || 0;\n\n      // Don't go all the way to the right if we have a vertical scrollbar as well\n      if(self.__indicatorX) ystop = 10;\n\n      heightDiff = self.__scrollTop - (self.__maxScrollTop - ystop);\n\n      if(self.__scrollTop < 0) {\n\n        heightScale = Math.max(self.__indicatorY.minScale, (self.__indicatorY.size - Math.abs(self.__scrollTop)) / self.__indicatorY.size);\n\n        // Stay at top\n        y = 0;\n\n        // Make sure scale is transformed from the center/top origin point\n        self.__indicatorY.indicator.style[self.__transformOriginProperty] = 'center top';\n\n      } else if(heightDiff > 0) {\n\n        heightScale = Math.max(self.__indicatorY.minScale, (self.__indicatorY.size - heightDiff) / self.__indicatorY.size);\n\n        // Stay at bottom of scrollable viewport\n        y = self.__indicatorY.maxPos - ystop;\n\n        // Make sure scale is transformed from the center/bottom origin point\n        self.__indicatorY.indicator.style[self.__transformOriginProperty] = 'center bottom';\n\n      } else {\n\n        // Normal motion\n        y = Math.min(self.__maxScrollTop, Math.max(0, y));\n        heightScale = 1;\n\n      }\n\n      self.__indicatorY.indicator.style[self.__transformProperty] = 'translate3d(0,' + y + 'px, 0) scaleY(' + heightScale + ')';\n    }\n  },\n\n  __fadeScrollbars: function(direction, delay) {\n    var self = this;\n\n    if(!this.options.scrollbarsFade) {\n      return;\n    }\n\n    var className = 'scroll-bar-fade-out';\n\n    if(self.options.scrollbarsFade === true) {\n      clearTimeout(self.__scrollbarFadeTimeout);\n\n      if(direction == 'in') {\n        if(self.__indicatorX) { self.__indicatorX.indicator.classList.remove(className); }\n        if(self.__indicatorY) { self.__indicatorY.indicator.classList.remove(className); }\n      } else {\n        self.__scrollbarFadeTimeout = setTimeout(function() {\n          if(self.__indicatorX) { self.__indicatorX.indicator.classList.add(className); }\n          if(self.__indicatorY) { self.__indicatorY.indicator.classList.add(className); }\n        }, delay || self.options.scrollbarFadeDelay);\n      }\n    }\n  },\n\n  __scrollingComplete: function() {\n    var self = this;\n    self.options.scrollingComplete();\n    ionic.tap.removeClonedInputs(self.__container, self);\n\n    self.__fadeScrollbars('out');\n  },\n\n  resize: function() {\n    // Update Scroller dimensions for changed content\n    // Add padding to bottom of content\n    this.setDimensions(\n      this.__container.clientWidth,\n      this.__container.clientHeight,\n      this.options.getContentWidth(),\n      this.options.getContentHeight()\n    );\n  },\n  /*\n  ---------------------------------------------------------------------------\n    PUBLIC API\n  ---------------------------------------------------------------------------\n  */\n\n  getRenderFn: function() {\n    var self = this;\n\n    var content = this.__content;\n\n    var docStyle = document.documentElement.style;\n\n    var engine;\n    if ('MozAppearance' in docStyle) {\n      engine = 'gecko';\n    } else if ('WebkitAppearance' in docStyle) {\n      engine = 'webkit';\n    } else if (typeof navigator.cpuClass === 'string') {\n      engine = 'trident';\n    }\n\n    var vendorPrefix = {\n      trident: 'ms',\n      gecko: 'Moz',\n      webkit: 'Webkit',\n      presto: 'O'\n    }[engine];\n\n    var helperElem = document.createElement(\"div\");\n    var undef;\n\n    var perspectiveProperty = vendorPrefix + \"Perspective\";\n    var transformProperty = vendorPrefix + \"Transform\";\n    var transformOriginProperty = vendorPrefix + 'TransformOrigin';\n\n    self.__perspectiveProperty = transformProperty;\n    self.__transformProperty = transformProperty;\n    self.__transformOriginProperty = transformOriginProperty;\n\n    if (helperElem.style[perspectiveProperty] !== undef) {\n\n      return function(left, top, zoom, wasResize) {\n        content.style[transformProperty] = 'translate3d(' + (-left) + 'px,' + (-top) + 'px,0) scale(' + zoom + ')';\n        self.__repositionScrollbars();\n        if(!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    } else if (helperElem.style[transformProperty] !== undef) {\n\n      return function(left, top, zoom, wasResize) {\n        content.style[transformProperty] = 'translate(' + (-left) + 'px,' + (-top) + 'px) scale(' + zoom + ')';\n        self.__repositionScrollbars();\n        if(!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    } else {\n\n      return function(left, top, zoom, wasResize) {\n        content.style.marginLeft = left ? (-left/zoom) + 'px' : '';\n        content.style.marginTop = top ? (-top/zoom) + 'px' : '';\n        content.style.zoom = zoom || '';\n        self.__repositionScrollbars();\n        if(!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    }\n  },\n\n\n  /**\n   * Configures the dimensions of the client (outer) and content (inner) elements.\n   * Requires the available space for the outer element and the outer size of the inner element.\n   * All values which are falsy (null or zero etc.) are ignored and the old value is kept.\n   *\n   * @param clientWidth {Integer} Inner width of outer element\n   * @param clientHeight {Integer} Inner height of outer element\n   * @param contentWidth {Integer} Outer width of inner element\n   * @param contentHeight {Integer} Outer height of inner element\n   */\n  setDimensions: function(clientWidth, clientHeight, contentWidth, contentHeight) {\n    var self = this;\n\n    // Only update values which are defined\n    if (clientWidth === +clientWidth) {\n      self.__clientWidth = clientWidth;\n    }\n\n    if (clientHeight === +clientHeight) {\n      self.__clientHeight = clientHeight;\n    }\n\n    if (contentWidth === +contentWidth) {\n      self.__contentWidth = contentWidth;\n    }\n\n    if (contentHeight === +contentHeight) {\n      self.__contentHeight = contentHeight;\n    }\n\n    // Refresh maximums\n    self.__computeScrollMax();\n    self.__resizeScrollbars();\n\n    // Refresh scroll position\n    self.scrollTo(self.__scrollLeft, self.__scrollTop, true, null, true);\n\n  },\n\n\n  /**\n   * Sets the client coordinates in relation to the document.\n   *\n   * @param left {Integer} Left position of outer element\n   * @param top {Integer} Top position of outer element\n   */\n  setPosition: function(left, top) {\n\n    var self = this;\n\n    self.__clientLeft = left || 0;\n    self.__clientTop = top || 0;\n\n  },\n\n\n  /**\n   * Configures the snapping (when snapping is active)\n   *\n   * @param width {Integer} Snapping width\n   * @param height {Integer} Snapping height\n   */\n  setSnapSize: function(width, height) {\n\n    var self = this;\n\n    self.__snapWidth = width;\n    self.__snapHeight = height;\n\n  },\n\n\n  /**\n   * Activates pull-to-refresh. A special zone on the top of the list to start a list refresh whenever\n   * the user event is released during visibility of this zone. This was introduced by some apps on iOS like\n   * the official Twitter client.\n   *\n   * @param height {Integer} Height of pull-to-refresh zone on top of rendered list\n   * @param activateCallback {Function} Callback to execute on activation. This is for signalling the user about a refresh is about to happen when he release.\n   * @param deactivateCallback {Function} Callback to execute on deactivation. This is for signalling the user about the refresh being cancelled.\n   * @param startCallback {Function} Callback to execute to start the real async refresh action. Call {@link #finishPullToRefresh} after finish of refresh.\n   * @param showCallback {Function} Callback to execute when the refresher should be shown. This is for showing the refresher during a negative scrollTop.\n   * @param hideCallback {Function} Callback to execute when the refresher should be hidden. This is for hiding the refresher when it's behind the nav bar.\n   */\n  activatePullToRefresh: function(height, activateCallback, deactivateCallback, startCallback, showCallback, hideCallback) {\n\n    var self = this;\n\n    self.__refreshHeight = height;\n    self.__refreshActivate = activateCallback;\n    self.__refreshDeactivate = deactivateCallback;\n    self.__refreshStart = startCallback;\n    self.__refreshShow = showCallback;\n    self.__refreshHide = hideCallback;\n  },\n\n\n  /**\n   * Starts pull-to-refresh manually.\n   */\n  triggerPullToRefresh: function() {\n    // Use publish instead of scrollTo to allow scrolling to out of boundary position\n    // We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled\n    this.__publish(this.__scrollLeft, -this.__refreshHeight, this.__zoomLevel, true);\n\n    if (this.__refreshStart) {\n      this.__refreshStart();\n    }\n  },\n\n\n  /**\n   * Signalizes that pull-to-refresh is finished.\n   */\n  finishPullToRefresh: function() {\n\n    var self = this;\n\n    self.__refreshActive = false;\n    if (self.__refreshDeactivate) {\n      self.__refreshDeactivate();\n    }\n\n    self.scrollTo(self.__scrollLeft, self.__scrollTop, true);\n\n  },\n\n\n  /**\n   * Returns the scroll position and zooming values\n   *\n   * @return {Map} `left` and `top` scroll position and `zoom` level\n   */\n  getValues: function() {\n\n    var self = this;\n\n    return {\n      left: self.__scrollLeft,\n      top: self.__scrollTop,\n      zoom: self.__zoomLevel\n    };\n\n  },\n\n\n  /**\n   * Returns the maximum scroll values\n   *\n   * @return {Map} `left` and `top` maximum scroll values\n   */\n  getScrollMax: function() {\n\n    var self = this;\n\n    return {\n      left: self.__maxScrollLeft,\n      top: self.__maxScrollTop\n    };\n\n  },\n\n\n  /**\n   * Zooms to the given level. Supports optional animation. Zooms\n   * the center when no coordinates are given.\n   *\n   * @param level {Number} Level to zoom to\n   * @param animate {Boolean} Whether to use animation\n   * @param originLeft {Number} Zoom in at given left coordinate\n   * @param originTop {Number} Zoom in at given top coordinate\n   */\n  zoomTo: function(level, animate, originLeft, originTop) {\n\n    var self = this;\n\n    if (!self.options.zooming) {\n      throw new Error(\"Zooming is not enabled!\");\n    }\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n    }\n\n    var oldLevel = self.__zoomLevel;\n\n    // Normalize input origin to center of viewport if not defined\n    if (originLeft == null) {\n      originLeft = self.__clientWidth / 2;\n    }\n\n    if (originTop == null) {\n      originTop = self.__clientHeight / 2;\n    }\n\n    // Limit level according to configuration\n    level = Math.max(Math.min(level, self.options.maxZoom), self.options.minZoom);\n\n    // Recompute maximum values while temporary tweaking maximum scroll ranges\n    self.__computeScrollMax(level);\n\n    // Recompute left and top coordinates based on new zoom level\n    var left = ((originLeft + self.__scrollLeft) * level / oldLevel) - originLeft;\n    var top = ((originTop + self.__scrollTop) * level / oldLevel) - originTop;\n\n    // Limit x-axis\n    if (left > self.__maxScrollLeft) {\n      left = self.__maxScrollLeft;\n    } else if (left < 0) {\n      left = 0;\n    }\n\n    // Limit y-axis\n    if (top > self.__maxScrollTop) {\n      top = self.__maxScrollTop;\n    } else if (top < 0) {\n      top = 0;\n    }\n\n    // Push values out\n    self.__publish(left, top, level, animate);\n\n  },\n\n\n  /**\n   * Zooms the content by the given factor.\n   *\n   * @param factor {Number} Zoom by given factor\n   * @param animate {Boolean} Whether to use animation\n   * @param originLeft {Number} Zoom in at given left coordinate\n   * @param originTop {Number} Zoom in at given top coordinate\n   */\n  zoomBy: function(factor, animate, originLeft, originTop) {\n\n    var self = this;\n\n    self.zoomTo(self.__zoomLevel * factor, animate, originLeft, originTop);\n\n  },\n\n\n  /**\n   * Scrolls to the given position. Respect limitations and snapping automatically.\n   *\n   * @param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>\n   * @param top {Number} Vertical scroll position, keeps current if value is <code>null</code>\n   * @param animate {Boolean} Whether the scrolling should happen using an animation\n   * @param zoom {Number} Zoom level to go to\n   */\n  scrollTo: function(left, top, animate, zoom, wasResize) {\n    var self = this;\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n    }\n\n    // Correct coordinates based on new zoom level\n    if (zoom != null && zoom !== self.__zoomLevel) {\n\n      if (!self.options.zooming) {\n        throw new Error(\"Zooming is not enabled!\");\n      }\n\n      left *= zoom;\n      top *= zoom;\n\n      // Recompute maximum values while temporary tweaking maximum scroll ranges\n      self.__computeScrollMax(zoom);\n\n    } else {\n\n      // Keep zoom when not defined\n      zoom = self.__zoomLevel;\n\n    }\n\n    if (!self.options.scrollingX) {\n\n      left = self.__scrollLeft;\n\n    } else {\n\n      if (self.options.paging) {\n        left = Math.round(left / self.__clientWidth) * self.__clientWidth;\n      } else if (self.options.snapping) {\n        left = Math.round(left / self.__snapWidth) * self.__snapWidth;\n      }\n\n    }\n\n    if (!self.options.scrollingY) {\n\n      top = self.__scrollTop;\n\n    } else {\n\n      if (self.options.paging) {\n        top = Math.round(top / self.__clientHeight) * self.__clientHeight;\n      } else if (self.options.snapping) {\n        top = Math.round(top / self.__snapHeight) * self.__snapHeight;\n      }\n\n    }\n\n    // Limit for allowed ranges\n    left = Math.max(Math.min(self.__maxScrollLeft, left), 0);\n    top = Math.max(Math.min(self.__maxScrollTop, top), 0);\n\n    // Don't animate when no change detected, still call publish to make sure\n    // that rendered position is really in-sync with internal data\n    if (left === self.__scrollLeft && top === self.__scrollTop) {\n      animate = false;\n    }\n\n    // Publish new values\n    self.__publish(left, top, zoom, animate, wasResize);\n\n  },\n\n\n  /**\n   * Scroll by the given offset\n   *\n   * @param left {Number} Scroll x-axis by given offset\n   * @param top {Number} Scroll y-axis by given offset\n   * @param animate {Boolean} Whether to animate the given change\n   */\n  scrollBy: function(left, top, animate) {\n\n    var self = this;\n\n    var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft;\n    var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop;\n\n    self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate);\n\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    EVENT CALLBACKS\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Mouse wheel handler for zooming support\n   */\n  doMouseZoom: function(wheelDelta, timeStamp, pageX, pageY) {\n\n    var self = this;\n    var change = wheelDelta > 0 ? 0.97 : 1.03;\n\n    return self.zoomTo(self.__zoomLevel * change, false, pageX - self.__clientLeft, pageY - self.__clientTop);\n\n  },\n\n  /**\n   * Touch start handler for scrolling support\n   */\n  doTouchStart: function(touches, timeStamp) {\n    this.hintResize();\n\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Reset interruptedAnimation flag\n    self.__interruptedAnimation = true;\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n      self.__interruptedAnimation = true;\n    }\n\n    // Stop animation\n    if (self.__isAnimating) {\n      zyngaCore.effect.Animate.stop(self.__isAnimating);\n      self.__isAnimating = false;\n      self.__interruptedAnimation = true;\n    }\n\n    // Use center point when dealing with two fingers\n    var currentTouchLeft, currentTouchTop;\n    var isSingleTouch = touches.length === 1;\n    if (isSingleTouch) {\n      currentTouchLeft = touches[0].pageX;\n      currentTouchTop = touches[0].pageY;\n    } else {\n      currentTouchLeft = Math.abs(touches[0].pageX + touches[1].pageX) / 2;\n      currentTouchTop = Math.abs(touches[0].pageY + touches[1].pageY) / 2;\n    }\n\n    // Store initial positions\n    self.__initialTouchLeft = currentTouchLeft;\n    self.__initialTouchTop = currentTouchTop;\n\n    // Store initial touchList for scale calculation\n    self.__initialTouches = touches;\n\n    // Store current zoom level\n    self.__zoomLevelStart = self.__zoomLevel;\n\n    // Store initial touch positions\n    self.__lastTouchLeft = currentTouchLeft;\n    self.__lastTouchTop = currentTouchTop;\n\n    // Store initial move time stamp\n    self.__lastTouchMove = timeStamp;\n\n    // Reset initial scale\n    self.__lastScale = 1;\n\n    // Reset locking flags\n    self.__enableScrollX = !isSingleTouch && self.options.scrollingX;\n    self.__enableScrollY = !isSingleTouch && self.options.scrollingY;\n\n    // Reset tracking flag\n    self.__isTracking = true;\n\n    // Reset deceleration complete flag\n    self.__didDecelerationComplete = false;\n\n    // Dragging starts directly with two fingers, otherwise lazy with an offset\n    self.__isDragging = !isSingleTouch;\n\n    // Some features are disabled in multi touch scenarios\n    self.__isSingleTouch = isSingleTouch;\n\n    // Clearing data structure\n    self.__positions = [];\n\n  },\n\n\n  /**\n   * Touch move handler for scrolling support\n   */\n  doTouchMove: function(touches, timeStamp, scale) {\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Ignore event when tracking is not enabled (event might be outside of element)\n    if (!self.__isTracking) {\n      return;\n    }\n\n    var currentTouchLeft, currentTouchTop;\n\n    // Compute move based around of center of fingers\n    if (touches.length === 2) {\n      currentTouchLeft = Math.abs(touches[0].pageX + touches[1].pageX) / 2;\n      currentTouchTop = Math.abs(touches[0].pageY + touches[1].pageY) / 2;\n\n      // Calculate scale when not present and only when touches are used\n      if (!scale && self.options.zooming) {\n        scale = self.__getScale(self.__initialTouches, touches);\n      }\n    } else {\n      currentTouchLeft = touches[0].pageX;\n      currentTouchTop = touches[0].pageY;\n    }\n\n    var positions = self.__positions;\n\n    // Are we already is dragging mode?\n    if (self.__isDragging) {\n\n      // Compute move distance\n      var moveX = currentTouchLeft - self.__lastTouchLeft;\n      var moveY = currentTouchTop - self.__lastTouchTop;\n\n      // Read previous scroll position and zooming\n      var scrollLeft = self.__scrollLeft;\n      var scrollTop = self.__scrollTop;\n      var level = self.__zoomLevel;\n\n      // Work with scaling\n      if (scale != null && self.options.zooming) {\n\n        var oldLevel = level;\n\n        // Recompute level based on previous scale and new scale\n        level = level / self.__lastScale * scale;\n\n        // Limit level according to configuration\n        level = Math.max(Math.min(level, self.options.maxZoom), self.options.minZoom);\n\n        // Only do further compution when change happened\n        if (oldLevel !== level) {\n\n          // Compute relative event position to container\n          var currentTouchLeftRel = currentTouchLeft - self.__clientLeft;\n          var currentTouchTopRel = currentTouchTop - self.__clientTop;\n\n          // Recompute left and top coordinates based on new zoom level\n          scrollLeft = ((currentTouchLeftRel + scrollLeft) * level / oldLevel) - currentTouchLeftRel;\n          scrollTop = ((currentTouchTopRel + scrollTop) * level / oldLevel) - currentTouchTopRel;\n\n          // Recompute max scroll values\n          self.__computeScrollMax(level);\n\n        }\n      }\n\n      if (self.__enableScrollX) {\n\n        scrollLeft -= moveX * this.options.speedMultiplier;\n        var maxScrollLeft = self.__maxScrollLeft;\n\n        if (scrollLeft > maxScrollLeft || scrollLeft < 0) {\n\n          // Slow down on the edges\n          if (self.options.bouncing) {\n\n            scrollLeft += (moveX / 2  * this.options.speedMultiplier);\n\n          } else if (scrollLeft > maxScrollLeft) {\n\n            scrollLeft = maxScrollLeft;\n\n          } else {\n\n            scrollLeft = 0;\n\n          }\n        }\n      }\n\n      // Compute new vertical scroll position\n      if (self.__enableScrollY) {\n\n        scrollTop -= moveY * this.options.speedMultiplier;\n        var maxScrollTop = self.__maxScrollTop;\n\n        if (scrollTop > maxScrollTop || scrollTop < 0) {\n\n          // Slow down on the edges\n          if (self.options.bouncing || (self.__refreshHeight && scrollTop < 0)) {\n\n            scrollTop += (moveY / 2 * this.options.speedMultiplier);\n\n            // Support pull-to-refresh (only when only y is scrollable)\n            if (!self.__enableScrollX && self.__refreshHeight != null) {\n\n              // hide the refresher when it's behind the header bar in case of header transparency\n              if(scrollTop < 0){\n                self.__refreshHidden = false;\n                self.__refreshShow();\n              }else{\n                self.__refreshHide();\n                self.__refreshHidden = true;\n              }\n\n              if (!self.__refreshActive && scrollTop <= -self.__refreshHeight) {\n\n                self.__refreshActive = true;\n                if (self.__refreshActivate) {\n                  self.__refreshActivate();\n                }\n\n              } else if (self.__refreshActive && scrollTop > -self.__refreshHeight) {\n\n                self.__refreshActive = false;\n                if (self.__refreshDeactivate) {\n                  self.__refreshDeactivate();\n                }\n\n              }\n            }\n\n          } else if (scrollTop > maxScrollTop) {\n\n            scrollTop = maxScrollTop;\n\n          } else {\n\n            scrollTop = 0;\n\n          }\n        }else if(self.__refreshHeight && !self.__refreshHidden){\n          // if a positive scroll value and the refresher is still not hidden, hide it\n          self.__refreshHide();\n          self.__refreshHidden = true;\n        }\n      }\n\n      // Keep list from growing infinitely (holding min 10, max 20 measure points)\n      if (positions.length > 60) {\n        positions.splice(0, 30);\n      }\n\n      // Track scroll movement for decleration\n      positions.push(scrollLeft, scrollTop, timeStamp);\n\n      // Sync scroll position\n      self.__publish(scrollLeft, scrollTop, level);\n\n    // Otherwise figure out whether we are switching into dragging mode now.\n    } else {\n\n      var minimumTrackingForScroll = self.options.locking ? 3 : 0;\n      var minimumTrackingForDrag = 5;\n\n      var distanceX = Math.abs(currentTouchLeft - self.__initialTouchLeft);\n      var distanceY = Math.abs(currentTouchTop - self.__initialTouchTop);\n\n      self.__enableScrollX = self.options.scrollingX && distanceX >= minimumTrackingForScroll;\n      self.__enableScrollY = self.options.scrollingY && distanceY >= minimumTrackingForScroll;\n\n      positions.push(self.__scrollLeft, self.__scrollTop, timeStamp);\n\n      self.__isDragging = (self.__enableScrollX || self.__enableScrollY) && (distanceX >= minimumTrackingForDrag || distanceY >= minimumTrackingForDrag);\n      if (self.__isDragging) {\n        self.__interruptedAnimation = false;\n        self.__fadeScrollbars('in');\n      }\n\n    }\n\n    // Update last touch positions and time stamp for next event\n    self.__lastTouchLeft = currentTouchLeft;\n    self.__lastTouchTop = currentTouchTop;\n    self.__lastTouchMove = timeStamp;\n    self.__lastScale = scale;\n\n  },\n\n\n  /**\n   * Touch end handler for scrolling support\n   */\n  doTouchEnd: function(timeStamp) {\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Ignore event when tracking is not enabled (no touchstart event on element)\n    // This is required as this listener ('touchmove') sits on the document and not on the element itself.\n    if (!self.__isTracking) {\n      return;\n    }\n\n    // Not touching anymore (when two finger hit the screen there are two touch end events)\n    self.__isTracking = false;\n\n    // Be sure to reset the dragging flag now. Here we also detect whether\n    // the finger has moved fast enough to switch into a deceleration animation.\n    if (self.__isDragging) {\n\n      // Reset dragging flag\n      self.__isDragging = false;\n\n      // Start deceleration\n      // Verify that the last move detected was in some relevant time frame\n      if (self.__isSingleTouch && self.options.animating && (timeStamp - self.__lastTouchMove) <= 100) {\n\n        // Then figure out what the scroll position was about 100ms ago\n        var positions = self.__positions;\n        var endPos = positions.length - 1;\n        var startPos = endPos;\n\n        // Move pointer to position measured 100ms ago\n        for (var i = endPos; i > 0 && positions[i] > (self.__lastTouchMove - 100); i -= 3) {\n          startPos = i;\n        }\n\n        // If start and stop position is identical in a 100ms timeframe,\n        // we cannot compute any useful deceleration.\n        if (startPos !== endPos) {\n\n          // Compute relative movement between these two points\n          var timeOffset = positions[endPos] - positions[startPos];\n          var movedLeft = self.__scrollLeft - positions[startPos - 2];\n          var movedTop = self.__scrollTop - positions[startPos - 1];\n\n          // Based on 50ms compute the movement to apply for each render step\n          self.__decelerationVelocityX = movedLeft / timeOffset * (1000 / 60);\n          self.__decelerationVelocityY = movedTop / timeOffset * (1000 / 60);\n\n          // How much velocity is required to start the deceleration\n          var minVelocityToStartDeceleration = self.options.paging || self.options.snapping ? 4 : 1;\n\n          // Verify that we have enough velocity to start deceleration\n          if (Math.abs(self.__decelerationVelocityX) > minVelocityToStartDeceleration || Math.abs(self.__decelerationVelocityY) > minVelocityToStartDeceleration) {\n\n            // Deactivate pull-to-refresh when decelerating\n            if (!self.__refreshActive) {\n              self.__startDeceleration(timeStamp);\n            }\n          }\n        } else {\n          self.__scrollingComplete();\n        }\n      } else if ((timeStamp - self.__lastTouchMove) > 100) {\n        self.__scrollingComplete();\n      }\n    }\n\n    // If this was a slower move it is per default non decelerated, but this\n    // still means that we want snap back to the bounds which is done here.\n    // This is placed outside the condition above to improve edge case stability\n    // e.g. touchend fired without enabled dragging. This should normally do not\n    // have modified the scroll positions or even showed the scrollbars though.\n    if (!self.__isDecelerating) {\n\n      if (self.__refreshActive && self.__refreshStart) {\n\n        // Use publish instead of scrollTo to allow scrolling to out of boundary position\n        // We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled\n        self.__publish(self.__scrollLeft, -self.__refreshHeight, self.__zoomLevel, true);\n\n        if (self.__refreshStart) {\n          self.__refreshStart();\n        }\n\n      } else {\n\n        if (self.__interruptedAnimation || self.__isDragging) {\n          self.__scrollingComplete();\n        }\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, true, self.__zoomLevel);\n\n        // Directly signalize deactivation (nothing todo on refresh?)\n        if (self.__refreshActive) {\n\n          self.__refreshActive = false;\n          if (self.__refreshDeactivate) {\n            self.__refreshDeactivate();\n          }\n\n        }\n      }\n    }\n\n    // Fully cleanup list\n    self.__positions.length = 0;\n\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    PRIVATE API\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Applies the scroll position to the content element\n   *\n   * @param left {Number} Left scroll position\n   * @param top {Number} Top scroll position\n   * @param animate {Boolean} Whether animation should be used to move to the new coordinates\n   */\n  __publish: function(left, top, zoom, animate, wasResize) {\n\n    var self = this;\n\n    // Remember whether we had an animation, then we try to continue based on the current \"drive\" of the animation\n    var wasAnimating = self.__isAnimating;\n    if (wasAnimating) {\n      zyngaCore.effect.Animate.stop(wasAnimating);\n      self.__isAnimating = false;\n    }\n\n    if (animate && self.options.animating) {\n\n      // Keep scheduled positions for scrollBy/zoomBy functionality\n      self.__scheduledLeft = left;\n      self.__scheduledTop = top;\n      self.__scheduledZoom = zoom;\n\n      var oldLeft = self.__scrollLeft;\n      var oldTop = self.__scrollTop;\n      var oldZoom = self.__zoomLevel;\n\n      var diffLeft = left - oldLeft;\n      var diffTop = top - oldTop;\n      var diffZoom = zoom - oldZoom;\n\n      var step = function(percent, now, render) {\n\n        if (render) {\n\n          self.__scrollLeft = oldLeft + (diffLeft * percent);\n          self.__scrollTop = oldTop + (diffTop * percent);\n          self.__zoomLevel = oldZoom + (diffZoom * percent);\n\n          // Push values out\n          if (self.__callback) {\n            self.__callback(self.__scrollLeft, self.__scrollTop, self.__zoomLevel, wasResize);\n          }\n\n        }\n      };\n\n      var verify = function(id) {\n        return self.__isAnimating === id;\n      };\n\n      var completed = function(renderedFramesPerSecond, animationId, wasFinished) {\n        if (animationId === self.__isAnimating) {\n          self.__isAnimating = false;\n        }\n        if (self.__didDecelerationComplete || wasFinished) {\n          self.__scrollingComplete();\n        }\n\n        if (self.options.zooming) {\n          self.__computeScrollMax();\n        }\n      };\n\n      // When continuing based on previous animation we choose an ease-out animation instead of ease-in-out\n      self.__isAnimating = zyngaCore.effect.Animate.start(step, verify, completed, self.options.animationDuration, wasAnimating ? easeOutCubic : easeInOutCubic);\n\n    } else {\n\n      self.__scheduledLeft = self.__scrollLeft = left;\n      self.__scheduledTop = self.__scrollTop = top;\n      self.__scheduledZoom = self.__zoomLevel = zoom;\n\n      // Push values out\n      if (self.__callback) {\n        self.__callback(left, top, zoom, wasResize);\n      }\n\n      // Fix max scroll ranges\n      if (self.options.zooming) {\n        self.__computeScrollMax();\n      }\n    }\n  },\n\n\n  /**\n   * Recomputes scroll minimum values based on client dimensions and content dimensions.\n   */\n  __computeScrollMax: function(zoomLevel) {\n\n    var self = this;\n\n    if (zoomLevel == null) {\n      zoomLevel = self.__zoomLevel;\n    }\n\n    self.__maxScrollLeft = Math.max((self.__contentWidth * zoomLevel) - self.__clientWidth, 0);\n    self.__maxScrollTop = Math.max((self.__contentHeight * zoomLevel) - self.__clientHeight, 0);\n\n    if(!self.__didWaitForSize && !self.__maxScrollLeft && !self.__maxScrollTop) {\n      self.__didWaitForSize = true;\n      self.__waitForSize();\n    }\n  },\n\n\n  /**\n   * If the scroll view isn't sized correctly on start, wait until we have at least some size\n   */\n  __waitForSize: function() {\n\n    var self = this;\n\n    clearTimeout(self.__sizerTimeout);\n\n    var sizer = function() {\n      self.resize();\n\n      if((self.options.scrollingX && !self.__maxScrollLeft) || (self.options.scrollingY && !self.__maxScrollTop)) {\n        //self.__sizerTimeout = setTimeout(sizer, 1000);\n      }\n    };\n\n    sizer();\n    self.__sizerTimeout = setTimeout(sizer, 1000);\n  },\n\n  /*\n  ---------------------------------------------------------------------------\n    ANIMATION (DECELERATION) SUPPORT\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Called when a touch sequence end and the speed of the finger was high enough\n   * to switch into deceleration mode.\n   */\n  __startDeceleration: function(timeStamp) {\n\n    var self = this;\n\n    if (self.options.paging) {\n\n      var scrollLeft = Math.max(Math.min(self.__scrollLeft, self.__maxScrollLeft), 0);\n      var scrollTop = Math.max(Math.min(self.__scrollTop, self.__maxScrollTop), 0);\n      var clientWidth = self.__clientWidth;\n      var clientHeight = self.__clientHeight;\n\n      // We limit deceleration not to the min/max values of the allowed range, but to the size of the visible client area.\n      // Each page should have exactly the size of the client area.\n      self.__minDecelerationScrollLeft = Math.floor(scrollLeft / clientWidth) * clientWidth;\n      self.__minDecelerationScrollTop = Math.floor(scrollTop / clientHeight) * clientHeight;\n      self.__maxDecelerationScrollLeft = Math.ceil(scrollLeft / clientWidth) * clientWidth;\n      self.__maxDecelerationScrollTop = Math.ceil(scrollTop / clientHeight) * clientHeight;\n\n    } else {\n\n      self.__minDecelerationScrollLeft = 0;\n      self.__minDecelerationScrollTop = 0;\n      self.__maxDecelerationScrollLeft = self.__maxScrollLeft;\n      self.__maxDecelerationScrollTop = self.__maxScrollTop;\n\n    }\n\n    // Wrap class method\n    var step = function(percent, now, render) {\n      self.__stepThroughDeceleration(render);\n    };\n\n    // How much velocity is required to keep the deceleration running\n    self.__minVelocityToKeepDecelerating = self.options.snapping ? 4 : 0.1;\n\n    // Detect whether it's still worth to continue animating steps\n    // If we are already slow enough to not being user perceivable anymore, we stop the whole process here.\n    var verify = function() {\n      var shouldContinue = Math.abs(self.__decelerationVelocityX) >= self.__minVelocityToKeepDecelerating ||\n        Math.abs(self.__decelerationVelocityY) >= self.__minVelocityToKeepDecelerating;\n      if (!shouldContinue) {\n        self.__didDecelerationComplete = true;\n\n        //Make sure the scroll values are within the boundaries after a bounce,\n        //not below 0 or above maximum\n        if (self.options.bouncing) {\n          self.scrollTo(\n            Math.min( Math.max(self.__scrollLeft, 0), self.__maxScrollLeft ),\n            Math.min( Math.max(self.__scrollTop, 0), self.__maxScrollTop ),\n            false\n          );\n        }\n      }\n      return shouldContinue;\n    };\n\n    var completed = function(renderedFramesPerSecond, animationId, wasFinished) {\n      self.__isDecelerating = false;\n      if (self.__didDecelerationComplete) {\n        self.__scrollingComplete();\n      }\n\n      // Animate to grid when snapping is active, otherwise just fix out-of-boundary positions\n      if(self.options.paging) {\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, self.options.snapping);\n      }\n    };\n\n    // Start animation and switch on flag\n    self.__isDecelerating = zyngaCore.effect.Animate.start(step, verify, completed);\n\n  },\n\n\n  /**\n   * Called on every step of the animation\n   *\n   * @param inMemory {Boolean} Whether to not render the current step, but keep it in memory only. Used internally only!\n   */\n  __stepThroughDeceleration: function(render) {\n\n    var self = this;\n\n\n    //\n    // COMPUTE NEXT SCROLL POSITION\n    //\n\n    // Add deceleration to scroll position\n    var scrollLeft = self.__scrollLeft + self.__decelerationVelocityX;// * self.options.deceleration);\n    var scrollTop = self.__scrollTop + self.__decelerationVelocityY;// * self.options.deceleration);\n\n\n    //\n    // HARD LIMIT SCROLL POSITION FOR NON BOUNCING MODE\n    //\n\n    if (!self.options.bouncing) {\n\n      var scrollLeftFixed = Math.max(Math.min(self.__maxDecelerationScrollLeft, scrollLeft), self.__minDecelerationScrollLeft);\n      if (scrollLeftFixed !== scrollLeft) {\n        scrollLeft = scrollLeftFixed;\n        self.__decelerationVelocityX = 0;\n      }\n\n      var scrollTopFixed = Math.max(Math.min(self.__maxDecelerationScrollTop, scrollTop), self.__minDecelerationScrollTop);\n      if (scrollTopFixed !== scrollTop) {\n        scrollTop = scrollTopFixed;\n        self.__decelerationVelocityY = 0;\n      }\n\n    }\n\n\n    //\n    // UPDATE SCROLL POSITION\n    //\n\n    if (render) {\n\n      self.__publish(scrollLeft, scrollTop, self.__zoomLevel);\n\n    } else {\n\n      self.__scrollLeft = scrollLeft;\n      self.__scrollTop = scrollTop;\n\n    }\n\n\n    //\n    // SLOW DOWN\n    //\n\n    // Slow down velocity on every iteration\n    if (!self.options.paging) {\n\n      // This is the factor applied to every iteration of the animation\n      // to slow down the process. This should emulate natural behavior where\n      // objects slow down when the initiator of the movement is removed\n      var frictionFactor = self.options.deceleration;\n\n      self.__decelerationVelocityX *= frictionFactor;\n      self.__decelerationVelocityY *= frictionFactor;\n\n    }\n\n\n    //\n    // BOUNCING SUPPORT\n    //\n\n    if (self.options.bouncing) {\n\n      var scrollOutsideX = 0;\n      var scrollOutsideY = 0;\n\n      // This configures the amount of change applied to deceleration/acceleration when reaching boundaries\n      var penetrationDeceleration = self.options.penetrationDeceleration;\n      var penetrationAcceleration = self.options.penetrationAcceleration;\n\n      // Check limits\n      if (scrollLeft < self.__minDecelerationScrollLeft) {\n        scrollOutsideX = self.__minDecelerationScrollLeft - scrollLeft;\n      } else if (scrollLeft > self.__maxDecelerationScrollLeft) {\n        scrollOutsideX = self.__maxDecelerationScrollLeft - scrollLeft;\n      }\n\n      if (scrollTop < self.__minDecelerationScrollTop) {\n        scrollOutsideY = self.__minDecelerationScrollTop - scrollTop;\n      } else if (scrollTop > self.__maxDecelerationScrollTop) {\n        scrollOutsideY = self.__maxDecelerationScrollTop - scrollTop;\n      }\n\n      // Slow down until slow enough, then flip back to snap position\n      if (scrollOutsideX !== 0) {\n        var isHeadingOutwardsX = scrollOutsideX * self.__decelerationVelocityX <= self.__minDecelerationScrollLeft;\n        if (isHeadingOutwardsX) {\n          self.__decelerationVelocityX += scrollOutsideX * penetrationDeceleration;\n        }\n        var isStoppedX = Math.abs(self.__decelerationVelocityX) <= self.__minVelocityToKeepDecelerating;\n        //If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds\n        if (!isHeadingOutwardsX || isStoppedX) {\n          self.__decelerationVelocityX = scrollOutsideX * penetrationAcceleration;\n        }\n      }\n\n      if (scrollOutsideY !== 0) {\n        var isHeadingOutwardsY = scrollOutsideY * self.__decelerationVelocityY <= self.__minDecelerationScrollTop;\n        if (isHeadingOutwardsY) {\n          self.__decelerationVelocityY += scrollOutsideY * penetrationDeceleration;\n        }\n        var isStoppedY = Math.abs(self.__decelerationVelocityY) <= self.__minVelocityToKeepDecelerating;\n        //If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds\n        if (!isHeadingOutwardsY || isStoppedY) {\n          self.__decelerationVelocityY = scrollOutsideY * penetrationAcceleration;\n        }\n      }\n    }\n  },\n\n\n  /**\n   * calculate the distance between two touches\n   * @param   {Touch}     touch1\n   * @param   {Touch}     touch2\n   * @returns {Number}    distance\n   */\n  __getDistance: function getDistance(touch1, touch2) {\n    var x = touch2.pageX - touch1.pageX,\n    y = touch2.pageY - touch1.pageY;\n    return Math.sqrt((x*x) + (y*y));\n  },\n\n\n  /**\n   * calculate the scale factor between two touchLists (fingers)\n   * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n   * @param   {Array}     start\n   * @param   {Array}     end\n   * @returns {Number}    scale\n   */\n  __getScale: function getScale(start, end) {\n\n    var self = this;\n\n    // need two fingers...\n    if(start.length >= 2 && end.length >= 2) {\n      return self.__getDistance(end[0], end[1]) /\n        self.__getDistance(start[0], start[1]);\n    }\n    return 1;\n  }\n});\n\nionic.scroll = {\n  isScrolling: false,\n  lastTop: 0\n};\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.HeaderBar = ionic.views.View.inherit({\n    initialize: function(opts) {\n      this.el = opts.el;\n\n      ionic.extend(this, {\n        alignTitle: 'center'\n      }, opts);\n\n      this.align();\n    },\n\n    align: function(align) {\n\n      align || (align = this.alignTitle);\n\n      // Find the titleEl element\n      var titleEl = this.el.querySelector('.title');\n      if(!titleEl) {\n        return;\n      }\n\n      var self = this;\n      //We have to rAF here so all of the elements have time to initialize\n      ionic.requestAnimationFrame(function() {\n        var i, c, childSize;\n        var childNodes = self.el.childNodes;\n        var leftWidth = 0;\n        var rightWidth = 0;\n        var isCountingRightWidth = false;\n\n        // Compute how wide the left children are\n        // Skip all titles (there may still be two titles, one leaving the dom)\n        // Once we encounter a titleEl, realize we are now counting the right-buttons, not left\n        for(i = 0; i < childNodes.length; i++) {\n          c = childNodes[i];\n          if (c.tagName && c.tagName.toLowerCase() == 'h1') {\n            isCountingRightWidth = true;\n            continue;\n          }\n\n          childSize = null;\n          if(c.nodeType == 3) {\n            var bounds = ionic.DomUtil.getTextBounds(c);\n            if(bounds) {\n              childSize = bounds.width;\n            }\n          } else if(c.nodeType == 1) {\n            childSize = c.offsetWidth;\n          }\n          if(childSize) {\n            if (isCountingRightWidth) {\n              rightWidth += childSize;\n            } else {\n              leftWidth += childSize;\n            }\n          }\n        }\n\n        var margin = Math.max(leftWidth, rightWidth) + 10;\n\n        //Reset left and right before setting again\n        titleEl.style.left = titleEl.style.right = '';\n\n        // Size and align the header titleEl based on the sizes of the left and\n        // right children, and the desired alignment mode\n        if(align == 'center') {\n          if(margin > 10) {\n            titleEl.style.left = margin + 'px';\n            titleEl.style.right = margin + 'px';\n          }\n          if(titleEl.offsetWidth < titleEl.scrollWidth) {\n            if(rightWidth > 0) {\n              titleEl.style.right = (rightWidth + 5) + 'px';\n            }\n          }\n        } else if(align == 'left') {\n          titleEl.classList.add('title-left');\n          if(leftWidth > 0) {\n            titleEl.style.left = (leftWidth + 15) + 'px';\n          }\n        } else if(align == 'right') {\n          titleEl.classList.add('title-right');\n          if(rightWidth > 0) {\n            titleEl.style.right = (rightWidth + 15) + 'px';\n          }\n        }\n      });\n    }\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  var ITEM_CLASS = 'item';\n  var ITEM_CONTENT_CLASS = 'item-content';\n  var ITEM_SLIDING_CLASS = 'item-sliding';\n  var ITEM_OPTIONS_CLASS = 'item-options';\n  var ITEM_PLACEHOLDER_CLASS = 'item-placeholder';\n  var ITEM_REORDERING_CLASS = 'item-reordering';\n  var ITEM_REORDER_BTN_CLASS = 'item-reorder';\n\n  var DragOp = function() {};\n  DragOp.prototype = {\n    start: function(e) {\n    },\n    drag: function(e) {\n    },\n    end: function(e) {\n    },\n    isSameItem: function(item) {\n      return false;\n    }\n  };\n\n  var SlideDrag = function(opts) {\n    this.dragThresholdX = opts.dragThresholdX || 10;\n    this.el = opts.el;\n    this.canSwipe = opts.canSwipe;\n  };\n\n  SlideDrag.prototype = new DragOp();\n\n  SlideDrag.prototype.start = function(e) {\n    var content, buttons, offsetX, buttonsWidth;\n\n    if (!this.canSwipe()) {\n      return;\n    }\n\n    if(e.target.classList.contains(ITEM_CONTENT_CLASS)) {\n      content = e.target;\n    } else if(e.target.classList.contains(ITEM_CLASS)) {\n      content = e.target.querySelector('.' + ITEM_CONTENT_CLASS);\n    } else {\n      content = ionic.DomUtil.getParentWithClass(e.target, ITEM_CONTENT_CLASS);\n    }\n\n    // If we don't have a content area as one of our children (or ourselves), skip\n    if(!content) {\n      return;\n    }\n\n    // Make sure we aren't animating as we slide\n    content.classList.remove(ITEM_SLIDING_CLASS);\n\n    // Grab the starting X point for the item (for example, so we can tell whether it is open or closed to start)\n    offsetX = parseFloat(content.style[ionic.CSS.TRANSFORM].replace('translate3d(', '').split(',')[0]) || 0;\n\n    // Grab the buttons\n    buttons = content.parentNode.querySelector('.' + ITEM_OPTIONS_CLASS);\n    if(!buttons) {\n      return;\n    }\n    buttons.classList.remove('invisible');\n\n    buttonsWidth = buttons.offsetWidth;\n\n    this._currentDrag = {\n      buttons: buttons,\n      buttonsWidth: buttonsWidth,\n      content: content,\n      startOffsetX: offsetX\n    };\n  };\n\n  /**\n   * Check if this is the same item that was previously dragged.\n   */\n  SlideDrag.prototype.isSameItem = function(op) {\n    if(op._lastDrag && this._currentDrag) {\n      return this._currentDrag.content == op._lastDrag.content;\n    }\n    return false;\n  };\n\n  SlideDrag.prototype.clean = function(e) {\n    var lastDrag = this._lastDrag;\n\n    if(!lastDrag) return;\n\n    lastDrag.content.style[ionic.CSS.TRANSITION] = '';\n    lastDrag.content.style[ionic.CSS.TRANSFORM] = '';\n    ionic.requestAnimationFrame(function() {\n      setTimeout(function() {\n        lastDrag.buttons && lastDrag.buttons.classList.add('invisible');\n      }, 250);\n    });\n  };\n\n  SlideDrag.prototype.drag = ionic.animationFrameThrottle(function(e) {\n    var buttonsWidth;\n\n    // We really aren't dragging\n    if(!this._currentDrag) {\n      return;\n    }\n\n    // Check if we should start dragging. Check if we've dragged past the threshold,\n    // or we are starting from the open state.\n    if(!this._isDragging &&\n        ((Math.abs(e.gesture.deltaX) > this.dragThresholdX) ||\n        (Math.abs(this._currentDrag.startOffsetX) > 0)))\n    {\n      this._isDragging = true;\n    }\n\n    if(this._isDragging) {\n      buttonsWidth = this._currentDrag.buttonsWidth;\n\n      // Grab the new X point, capping it at zero\n      var newX = Math.min(0, this._currentDrag.startOffsetX + e.gesture.deltaX);\n\n      // If the new X position is past the buttons, we need to slow down the drag (rubber band style)\n      if(newX < -buttonsWidth) {\n        // Calculate the new X position, capped at the top of the buttons\n        newX = Math.min(-buttonsWidth, -buttonsWidth + (((e.gesture.deltaX + buttonsWidth) * 0.4)));\n      }\n\n      this._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + newX + 'px, 0, 0)';\n      this._currentDrag.content.style[ionic.CSS.TRANSITION] = 'none';\n    }\n  });\n\n  SlideDrag.prototype.end = function(e, doneCallback) {\n    var _this = this;\n\n    // There is no drag, just end immediately\n    if(!this._currentDrag) {\n      doneCallback && doneCallback();\n      return;\n    }\n\n    // If we are currently dragging, we want to snap back into place\n    // The final resting point X will be the width of the exposed buttons\n    var restingPoint = -this._currentDrag.buttonsWidth;\n\n    // Check if the drag didn't clear the buttons mid-point\n    // and we aren't moving fast enough to swipe open\n    if(e.gesture.deltaX > -(this._currentDrag.buttonsWidth/2)) {\n\n      // If we are going left but too slow, or going right, go back to resting\n      if(e.gesture.direction == \"left\" && Math.abs(e.gesture.velocityX) < 0.3) {\n        restingPoint = 0;\n      } else if(e.gesture.direction == \"right\") {\n        restingPoint = 0;\n      }\n\n    }\n\n    ionic.requestAnimationFrame(function() {\n      if(restingPoint === 0) {\n        _this._currentDrag.content.style[ionic.CSS.TRANSFORM] = '';\n        var buttons = _this._currentDrag.buttons;\n        setTimeout(function() {\n          buttons && buttons.classList.add('invisible');\n        }, 250);\n      } else {\n        _this._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + restingPoint + 'px, 0, 0)';\n      }\n      _this._currentDrag.content.style[ionic.CSS.TRANSITION] = '';\n\n\n      // Kill the current drag\n      _this._lastDrag = _this._currentDrag;\n      _this._currentDrag = null;\n\n      // We are done, notify caller\n      doneCallback && doneCallback();\n    });\n  };\n\n  var ReorderDrag = function(opts) {\n    this.dragThresholdY = opts.dragThresholdY || 0;\n    this.onReorder = opts.onReorder;\n    this.listEl = opts.listEl;\n    this.el = opts.el;\n    this.scrollEl = opts.scrollEl;\n    this.scrollView = opts.scrollView;\n    // Get the True Top of the list el http://www.quirksmode.org/js/findpos.html\n    this.listElTrueTop = 0;\n    if (this.listEl.offsetParent) {\n      var obj = this.listEl;\n      do {\n        this.listElTrueTop += obj.offsetTop;\n        obj = obj.offsetParent;\n      } while (obj);\n    }\n  };\n\n  ReorderDrag.prototype = new DragOp();\n\n  ReorderDrag.prototype._moveElement = function(e) {\n    var y = e.gesture.center.pageY +\n      this.scrollView.getValues().top -\n      (this._currentDrag.elementHeight / 2) -\n      this.listElTrueTop;\n    this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(0, '+y+'px, 0)';\n  };\n\n  ReorderDrag.prototype.start = function(e) {\n    var content;\n\n    var startIndex = ionic.DomUtil.getChildIndex(this.el, this.el.nodeName.toLowerCase());\n    var elementHeight = this.el.scrollHeight;\n    var placeholder = this.el.cloneNode(true);\n\n    placeholder.classList.add(ITEM_PLACEHOLDER_CLASS);\n\n    this.el.parentNode.insertBefore(placeholder, this.el);\n    this.el.classList.add(ITEM_REORDERING_CLASS);\n\n    this._currentDrag = {\n      elementHeight: elementHeight,\n      startIndex: startIndex,\n      placeholder: placeholder,\n      scrollHeight: scroll,\n      list: placeholder.parentNode\n    };\n\n    this._moveElement(e);\n  };\n\n  ReorderDrag.prototype.drag = ionic.animationFrameThrottle(function(e) {\n    // We really aren't dragging\n    var self = this;\n    if(!this._currentDrag) {\n      return;\n    }\n\n    var scrollY = 0;\n    var pageY = e.gesture.center.pageY;\n    var offset = this.listElTrueTop;\n\n    //If we have a scrollView, check scroll boundaries for dragged element and scroll if necessary\n    if (this.scrollView) {\n\n      var container = this.scrollView.__container;\n      scrollY = this.scrollView.getValues().top;\n\n      var containerTop = container.offsetTop;\n      var pixelsPastTop = containerTop - pageY + this._currentDrag.elementHeight/2;\n      var pixelsPastBottom = pageY + this._currentDrag.elementHeight/2 - containerTop - container.offsetHeight;\n\n      if (e.gesture.deltaY < 0 && pixelsPastTop > 0 && scrollY > 0) {\n        this.scrollView.scrollBy(null, -pixelsPastTop);\n        //Trigger another drag so the scrolling keeps going\n        ionic.requestAnimationFrame(function() {\n          self.drag(e);\n        });\n      }\n      if (e.gesture.deltaY > 0 && pixelsPastBottom > 0) {\n        if (scrollY < this.scrollView.getScrollMax().top) {\n          this.scrollView.scrollBy(null, pixelsPastBottom);\n          //Trigger another drag so the scrolling keeps going\n          ionic.requestAnimationFrame(function() {\n            self.drag(e);\n          });\n        }\n      }\n    }\n\n    // Check if we should start dragging. Check if we've dragged past the threshold,\n    // or we are starting from the open state.\n    if(!this._isDragging && Math.abs(e.gesture.deltaY) > this.dragThresholdY) {\n      this._isDragging = true;\n    }\n\n    if(this._isDragging) {\n      this._moveElement(e);\n\n      this._currentDrag.currentY = scrollY + pageY - offset;\n\n      // this._reorderItems();\n    }\n  });\n\n  // When an item is dragged, we need to reorder any items for sorting purposes\n  ReorderDrag.prototype._getReorderIndex = function() {\n    var self = this;\n    var placeholder = this._currentDrag.placeholder;\n    var siblings = Array.prototype.slice.call(this._currentDrag.placeholder.parentNode.children)\n      .filter(function(el) {\n        return el.nodeName === self.el.nodeName && el !== self.el;\n      });\n\n    var dragOffsetTop = this._currentDrag.currentY;\n    var el;\n    for (var i = 0, len = siblings.length; i < len; i++) {\n      el = siblings[i];\n      if (i === len - 1) {\n        if (dragOffsetTop > el.offsetTop) {\n          return i;\n        }\n      } else if (i === 0) {\n        if (dragOffsetTop < el.offsetTop + el.offsetHeight) {\n          return i;\n        }\n      } else if (dragOffsetTop > el.offsetTop - el.offsetHeight / 2 &&\n                 dragOffsetTop < el.offsetTop + el.offsetHeight) {\n        return i;\n      }\n    }\n    return this._currentDrag.startIndex;\n  };\n\n  ReorderDrag.prototype.end = function(e, doneCallback) {\n    if(!this._currentDrag) {\n      doneCallback && doneCallback();\n      return;\n    }\n\n    var placeholder = this._currentDrag.placeholder;\n    var finalIndex = this._getReorderIndex();\n\n    // Reposition the element\n    this.el.classList.remove(ITEM_REORDERING_CLASS);\n    this.el.style[ionic.CSS.TRANSFORM] = '';\n\n    placeholder.parentNode.insertBefore(this.el, placeholder);\n    placeholder.parentNode.removeChild(placeholder);\n\n    this.onReorder && this.onReorder(this.el, this._currentDrag.startIndex, finalIndex);\n\n    this._currentDrag = null;\n    doneCallback && doneCallback();\n  };\n\n\n\n  /**\n   * The ListView handles a list of items. It will process drag animations, edit mode,\n   * and other operations that are common on mobile lists or table views.\n   */\n  ionic.views.ListView = ionic.views.View.inherit({\n    initialize: function(opts) {\n      var _this = this;\n\n      opts = ionic.extend({\n        onReorder: function(el, oldIndex, newIndex) {},\n        virtualRemoveThreshold: -200,\n        virtualAddThreshold: 200,\n        canSwipe: function() {\n          return true;\n        }\n      }, opts);\n\n      ionic.extend(this, opts);\n\n      if(!this.itemHeight && this.listEl) {\n        this.itemHeight = this.listEl.children[0] && parseInt(this.listEl.children[0].style.height, 10);\n      }\n\n      //ionic.views.ListView.__super__.initialize.call(this, opts);\n\n      this.onRefresh = opts.onRefresh || function() {};\n      this.onRefreshOpening = opts.onRefreshOpening || function() {};\n      this.onRefreshHolding = opts.onRefreshHolding || function() {};\n\n      window.ionic.onGesture('release', function(e) {\n        _this._handleEndDrag(e);\n      }, this.el);\n\n      window.ionic.onGesture('drag', function(e) {\n        _this._handleDrag(e);\n      }, this.el);\n      // Start the drag states\n      this._initDrag();\n    },\n    /**\n     * Called to tell the list to stop refreshing. This is useful\n     * if you are refreshing the list and are done with refreshing.\n     */\n    stopRefreshing: function() {\n      var refresher = this.el.querySelector('.list-refresher');\n      refresher.style.height = '0px';\n    },\n\n    /**\n     * If we scrolled and have virtual mode enabled, compute the window\n     * of active elements in order to figure out the viewport to render.\n     */\n    didScroll: function(e) {\n      if(this.isVirtual) {\n        var itemHeight = this.itemHeight;\n\n        // TODO: This would be inaccurate if we are windowed\n        var totalItems = this.listEl.children.length;\n\n        // Grab the total height of the list\n        var scrollHeight = e.target.scrollHeight;\n\n        // Get the viewport height\n        var viewportHeight = this.el.parentNode.offsetHeight;\n\n        // scrollTop is the current scroll position\n        var scrollTop = e.scrollTop;\n\n        // High water is the pixel position of the first element to include (everything before\n        // that will be removed)\n        var highWater = Math.max(0, e.scrollTop + this.virtualRemoveThreshold);\n\n        // Low water is the pixel position of the last element to include (everything after\n        // that will be removed)\n        var lowWater = Math.min(scrollHeight, Math.abs(e.scrollTop) + viewportHeight + this.virtualAddThreshold);\n\n        // Compute how many items per viewport size can show\n        var itemsPerViewport = Math.floor((lowWater - highWater) / itemHeight);\n\n        // Get the first and last elements in the list based on how many can fit\n        // between the pixel range of lowWater and highWater\n        var first = parseInt(Math.abs(highWater / itemHeight), 10);\n        var last = parseInt(Math.abs(lowWater / itemHeight), 10);\n\n        // Get the items we need to remove\n        this._virtualItemsToRemove = Array.prototype.slice.call(this.listEl.children, 0, first);\n\n        // Grab the nodes we will be showing\n        var nodes = Array.prototype.slice.call(this.listEl.children, first, first + itemsPerViewport);\n\n        this.renderViewport && this.renderViewport(highWater, lowWater, first, last);\n      }\n    },\n\n    didStopScrolling: function(e) {\n      if(this.isVirtual) {\n        for(var i = 0; i < this._virtualItemsToRemove.length; i++) {\n          var el = this._virtualItemsToRemove[i];\n          //el.parentNode.removeChild(el);\n          this.didHideItem && this.didHideItem(i);\n        }\n        // Once scrolling stops, check if we need to remove old items\n\n      }\n    },\n\n    /**\n     * Clear any active drag effects on the list.\n     */\n    clearDragEffects: function() {\n      if(this._lastDragOp) {\n        this._lastDragOp.clean && this._lastDragOp.clean();\n        this._lastDragOp = null;\n      }\n    },\n\n    _initDrag: function() {\n      //ionic.views.ListView.__super__._initDrag.call(this);\n\n      // Store the last one\n      this._lastDragOp = this._dragOp;\n\n      this._dragOp = null;\n    },\n\n    // Return the list item from the given target\n    _getItem: function(target) {\n      while(target) {\n        if(target.classList && target.classList.contains(ITEM_CLASS)) {\n          return target;\n        }\n        target = target.parentNode;\n      }\n      return null;\n    },\n\n\n    _startDrag: function(e) {\n      var _this = this;\n\n      var didStart = false;\n\n      this._isDragging = false;\n\n      var lastDragOp = this._lastDragOp;\n      var item;\n\n      // Check if this is a reorder drag\n      if(ionic.DomUtil.getParentOrSelfWithClass(e.target, ITEM_REORDER_BTN_CLASS) && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {\n        item = this._getItem(e.target);\n\n        if(item) {\n          this._dragOp = new ReorderDrag({\n            listEl: this.el,\n            el: item,\n            scrollEl: this.scrollEl,\n            scrollView: this.scrollView,\n            onReorder: function(el, start, end) {\n              _this.onReorder && _this.onReorder(el, start, end);\n            }\n          });\n          this._dragOp.start(e);\n          e.preventDefault();\n        }\n      }\n\n      // Or check if this is a swipe to the side drag\n      else if(!this._didDragUpOrDown && (e.gesture.direction == 'left' || e.gesture.direction == 'right') && Math.abs(e.gesture.deltaX) > 5) {\n\n        // Make sure this is an item with buttons\n        item = this._getItem(e.target);\n        if(item && item.querySelector('.item-options')) {\n          this._dragOp = new SlideDrag({ el: this.el, canSwipe: this.canSwipe });\n          this._dragOp.start(e);\n          e.preventDefault();\n        }\n      }\n\n      // If we had a last drag operation and this is a new one on a different item, clean that last one\n      if(lastDragOp && this._dragOp && !this._dragOp.isSameItem(lastDragOp) && e.defaultPrevented) {\n        lastDragOp.clean && lastDragOp.clean();\n      }\n    },\n\n\n    _handleEndDrag: function(e) {\n      var _this = this;\n\n      this._didDragUpOrDown = false;\n\n      if(!this._dragOp) {\n        //ionic.views.ListView.__super__._handleEndDrag.call(this, e);\n        return;\n      }\n\n      this._dragOp.end(e, function() {\n        _this._initDrag();\n      });\n    },\n\n    /**\n     * Process the drag event to move the item to the left or right.\n     */\n    _handleDrag: function(e) {\n      var _this = this, content, buttons;\n\n      if(Math.abs(e.gesture.deltaY) > 5) {\n        this._didDragUpOrDown = true;\n      }\n\n      // If we get a drag event, make sure we aren't in another drag, then check if we should\n      // start one\n      if(!this.isDragging && !this._dragOp) {\n        this._startDrag(e);\n      }\n\n      // No drag still, pass it up\n      if(!this._dragOp) {\n        //ionic.views.ListView.__super__._handleDrag.call(this, e);\n        return;\n      }\n\n      e.gesture.srcEvent.preventDefault();\n      this._dragOp.drag(e);\n    }\n\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.Modal = ionic.views.View.inherit({\n    initialize: function(opts) {\n      opts = ionic.extend({\n        focusFirstInput: false,\n        unfocusOnHide: true,\n        focusFirstDelay: 600,\n        backdropClickToClose: true,\n        hardwareBackButtonClose: true,\n      }, opts);\n\n      ionic.extend(this, opts);\n\n      this.el = opts.el;\n    },\n    show: function() {\n      var self = this;\n\n      if(self.focusFirstInput) {\n        // Let any animations run first\n        window.setTimeout(function() {\n          var input = self.el.querySelector('input, textarea');\n          input && input.focus && input.focus();\n        }, self.focusFirstDelay);\n      }\n    },\n    hide: function() {\n      // Unfocus all elements\n      if(this.unfocusOnHide) {\n        var inputs = this.el.querySelectorAll('input, textarea');\n        // Let any animations run first\n        window.setTimeout(function() {\n          for(var i = 0; i < inputs.length; i++) {\n            inputs[i].blur && inputs[i].blur();\n          }\n        });\n      }\n    }\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  /**\n   * The side menu view handles one of the side menu's in a Side Menu Controller\n   * configuration.\n   * It takes a DOM reference to that side menu element.\n   */\n  ionic.views.SideMenu = ionic.views.View.inherit({\n    initialize: function(opts) {\n      this.el = opts.el;\n      this.isEnabled = (typeof opts.isEnabled === 'undefined') ? true : opts.isEnabled;\n      this.setWidth(opts.width);\n    },\n    getFullWidth: function() {\n      return this.width;\n    },\n    setWidth: function(width) {\n      this.width = width;\n      this.el.style.width = width + 'px';\n    },\n    setIsEnabled: function(isEnabled) {\n      this.isEnabled = isEnabled;\n    },\n    bringUp: function() {\n      if(this.el.style.zIndex !== '0') {\n        this.el.style.zIndex = '0';\n      }\n    },\n    pushDown: function() {\n      if(this.el.style.zIndex !== '-1') {\n        this.el.style.zIndex = '-1';\n      }\n    }\n  });\n\n  ionic.views.SideMenuContent = ionic.views.View.inherit({\n    initialize: function(opts) {\n      ionic.extend(this, {\n        animationClass: 'menu-animated',\n        onDrag: function(e) {},\n        onEndDrag: function(e) {}\n      }, opts);\n\n      ionic.onGesture('drag', ionic.proxy(this._onDrag, this), this.el);\n      ionic.onGesture('release', ionic.proxy(this._onEndDrag, this), this.el);\n    },\n    _onDrag: function(e) {\n      this.onDrag && this.onDrag(e);\n    },\n    _onEndDrag: function(e) {\n      this.onEndDrag && this.onEndDrag(e);\n    },\n    disableAnimation: function() {\n      this.el.classList.remove(this.animationClass);\n    },\n    enableAnimation: function() {\n      this.el.classList.add(this.animationClass);\n    },\n    getTranslateX: function() {\n      return parseFloat(this.el.style[ionic.CSS.TRANSFORM].replace('translate3d(', '').split(',')[0]);\n    },\n    setTranslateX: ionic.animationFrameThrottle(function(x) {\n      this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(' + x + 'px, 0, 0)';\n    })\n  });\n\n})(ionic);\n\n/*\n * Adapted from Swipe.js 2.0\n *\n * Brad Birdsall\n * Copyright 2013, MIT License\n *\n*/\n\n(function(ionic) {\n'use strict';\n\nionic.views.Slider = ionic.views.View.inherit({\n  initialize: function (options) {\n    var slider = this;\n\n    // utilities\n    var noop = function() {}; // simple no operation function\n    var offloadFn = function(fn) { setTimeout(fn || noop, 0); }; // offload a functions execution\n\n    // check browser capabilities\n    var browser = {\n      addEventListener: !!window.addEventListener,\n      touch: ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,\n      transitions: (function(temp) {\n        var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition'];\n        for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true;\n        return false;\n      })(document.createElement('swipe'))\n    };\n\n\n    var container = options.el;\n\n    // quit if no root element\n    if (!container) return;\n    var element = container.children[0];\n    var slides, slidePos, width, length;\n    options = options || {};\n    var index = parseInt(options.startSlide, 10) || 0;\n    var speed = options.speed || 300;\n    options.continuous = options.continuous !== undefined ? options.continuous : true;\n\n    function setup() {\n\n      // cache slides\n      slides = element.children;\n      length = slides.length;\n\n      // set continuous to false if only one slide\n      if (slides.length < 2) options.continuous = false;\n\n      //special case if two slides\n      if (browser.transitions && options.continuous && slides.length < 3) {\n        element.appendChild(slides[0].cloneNode(true));\n        element.appendChild(element.children[1].cloneNode(true));\n        slides = element.children;\n      }\n\n      // create an array to store current positions of each slide\n      slidePos = new Array(slides.length);\n\n      // determine width of each slide\n      width = container.offsetWidth || container.getBoundingClientRect().width;\n\n      element.style.width = (slides.length * width) + 'px';\n\n      // stack elements\n      var pos = slides.length;\n      while(pos--) {\n\n        var slide = slides[pos];\n\n        slide.style.width = width + 'px';\n        slide.setAttribute('data-index', pos);\n\n        if (browser.transitions) {\n          slide.style.left = (pos * -width) + 'px';\n          move(pos, index > pos ? -width : (index < pos ? width : 0), 0);\n        }\n\n      }\n\n      // reposition elements before and after index\n      if (options.continuous && browser.transitions) {\n        move(circle(index-1), -width, 0);\n        move(circle(index+1), width, 0);\n      }\n\n      if (!browser.transitions) element.style.left = (index * -width) + 'px';\n\n      container.style.visibility = 'visible';\n\n      options.slidesChanged && options.slidesChanged();\n    }\n\n    function prev() {\n\n      if (options.continuous) slide(index-1);\n      else if (index) slide(index-1);\n\n    }\n\n    function next() {\n\n      if (options.continuous) slide(index+1);\n      else if (index < slides.length - 1) slide(index+1);\n\n    }\n\n    function circle(index) {\n\n      // a simple positive modulo using slides.length\n      return (slides.length + (index % slides.length)) % slides.length;\n\n    }\n\n    function slide(to, slideSpeed) {\n\n      // do nothing if already on requested slide\n      if (index == to) return;\n\n      if (browser.transitions) {\n\n        var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward\n\n        // get the actual position of the slide\n        if (options.continuous) {\n          var natural_direction = direction;\n          direction = -slidePos[circle(to)] / width;\n\n          // if going forward but to < index, use to = slides.length + to\n          // if going backward but to > index, use to = -slides.length + to\n          if (direction !== natural_direction) to =  -direction * slides.length + to;\n\n        }\n\n        var diff = Math.abs(index-to) - 1;\n\n        // move all the slides between index and to in the right direction\n        while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0);\n\n        to = circle(to);\n\n        move(index, width * direction, slideSpeed || speed);\n        move(to, 0, slideSpeed || speed);\n\n        if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place\n\n      } else {\n\n        to = circle(to);\n        animate(index * -width, to * -width, slideSpeed || speed);\n        //no fallback for a circular continuous if the browser does not accept transitions\n      }\n\n      index = to;\n      offloadFn(options.callback && options.callback(index, slides[index]));\n    }\n\n    function move(index, dist, speed) {\n\n      translate(index, dist, speed);\n      slidePos[index] = dist;\n\n    }\n\n    function translate(index, dist, speed) {\n\n      var slide = slides[index];\n      var style = slide && slide.style;\n\n      if (!style) return;\n\n      style.webkitTransitionDuration =\n      style.MozTransitionDuration =\n      style.msTransitionDuration =\n      style.OTransitionDuration =\n      style.transitionDuration = speed + 'ms';\n\n      style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)';\n      style.msTransform =\n      style.MozTransform =\n      style.OTransform = 'translateX(' + dist + 'px)';\n\n    }\n\n    function animate(from, to, speed) {\n\n      // if not an animation, just reposition\n      if (!speed) {\n\n        element.style.left = to + 'px';\n        return;\n\n      }\n\n      var start = +new Date();\n\n      var timer = setInterval(function() {\n\n        var timeElap = +new Date() - start;\n\n        if (timeElap > speed) {\n\n          element.style.left = to + 'px';\n\n          if (delay) begin();\n\n          options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);\n\n          clearInterval(timer);\n          return;\n\n        }\n\n        element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px';\n\n      }, 4);\n\n    }\n\n    // setup auto slideshow\n    var delay = options.auto || 0;\n    var interval;\n\n    function begin() {\n\n      interval = setTimeout(next, delay);\n\n    }\n\n    function stop() {\n\n      delay = options.auto || 0;\n      clearTimeout(interval);\n\n    }\n\n\n    // setup initial vars\n    var start = {};\n    var delta = {};\n    var isScrolling;\n\n    // setup event capturing\n    var events = {\n\n      handleEvent: function(event) {\n        if(event.type == 'mousedown' || event.type == 'mouseup' || event.type == 'mousemove') {\n          event.touches = [{\n            pageX: event.pageX,\n            pageY: event.pageY\n          }];\n        }\n\n        switch (event.type) {\n          case 'mousedown': this.start(event); break;\n          case 'touchstart': this.start(event); break;\n          case 'touchmove': this.touchmove(event); break;\n          case 'mousemove': this.touchmove(event); break;\n          case 'touchend': offloadFn(this.end(event)); break;\n          case 'mouseup': offloadFn(this.end(event)); break;\n          case 'webkitTransitionEnd':\n          case 'msTransitionEnd':\n          case 'oTransitionEnd':\n          case 'otransitionend':\n          case 'transitionend': offloadFn(this.transitionEnd(event)); break;\n          case 'resize': offloadFn(setup); break;\n        }\n\n        if (options.stopPropagation) event.stopPropagation();\n\n      },\n      start: function(event) {\n\n        var touches = event.touches[0];\n\n        // measure start values\n        start = {\n\n          // get initial touch coords\n          x: touches.pageX,\n          y: touches.pageY,\n\n          // store time to determine touch duration\n          time: +new Date()\n\n        };\n\n        // used for testing first move event\n        isScrolling = undefined;\n\n        // reset delta and end measurements\n        delta = {};\n\n        // attach touchmove and touchend listeners\n        if(browser.touch) {\n          element.addEventListener('touchmove', this, false);\n          element.addEventListener('touchend', this, false);\n        } else {\n          element.addEventListener('mousemove', this, false);\n          element.addEventListener('mouseup', this, false);\n          document.addEventListener('mouseup', this, false);\n        }\n      },\n      touchmove: function(event) {\n\n        // ensure swiping with one touch and not pinching\n        // ensure sliding is enabled\n        if (event.touches.length > 1 ||\n            event.scale && event.scale !== 1 ||\n            slider.slideIsDisabled) {\n          return;\n        }\n\n        if (options.disableScroll) event.preventDefault();\n\n        var touches = event.touches[0];\n\n        // measure change in x and y\n        delta = {\n          x: touches.pageX - start.x,\n          y: touches.pageY - start.y\n        };\n\n        // determine if scrolling test has run - one time test\n        if ( typeof isScrolling == 'undefined') {\n          isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) );\n        }\n\n        // if user is not trying to scroll vertically\n        if (!isScrolling) {\n\n          // prevent native scrolling\n          event.preventDefault();\n\n          // stop slideshow\n          stop();\n\n          // increase resistance if first or last slide\n          if (options.continuous) { // we don't add resistance at the end\n\n            translate(circle(index-1), delta.x + slidePos[circle(index-1)], 0);\n            translate(index, delta.x + slidePos[index], 0);\n            translate(circle(index+1), delta.x + slidePos[circle(index+1)], 0);\n\n          } else {\n\n            delta.x =\n              delta.x /\n                ( (!index && delta.x > 0 ||         // if first slide and sliding left\n                  index == slides.length - 1 &&     // or if last slide and sliding right\n                  delta.x < 0                       // and if sliding at all\n                ) ?\n                ( Math.abs(delta.x) / width + 1 )      // determine resistance level\n                : 1 );                                 // no resistance if false\n\n            // translate 1:1\n            translate(index-1, delta.x + slidePos[index-1], 0);\n            translate(index, delta.x + slidePos[index], 0);\n            translate(index+1, delta.x + slidePos[index+1], 0);\n          }\n\n        }\n\n      },\n      end: function(event) {\n\n        // measure duration\n        var duration = +new Date() - start.time;\n\n        // determine if slide attempt triggers next/prev slide\n        var isValidSlide =\n              Number(duration) < 250 &&         // if slide duration is less than 250ms\n              Math.abs(delta.x) > 20 ||         // and if slide amt is greater than 20px\n              Math.abs(delta.x) > width/2;      // or if slide amt is greater than half the width\n\n        // determine if slide attempt is past start and end\n        var isPastBounds = (!index && delta.x > 0) ||      // if first slide and slide amt is greater than 0\n              (index == slides.length - 1 && delta.x < 0); // or if last slide and slide amt is less than 0\n\n        if (options.continuous) isPastBounds = false;\n\n        // determine direction of swipe (true:right, false:left)\n        var direction = delta.x < 0;\n\n        // if not scrolling vertically\n        if (!isScrolling) {\n\n          if (isValidSlide && !isPastBounds) {\n\n            if (direction) {\n\n              if (options.continuous) { // we need to get the next in this direction in place\n\n                move(circle(index-1), -width, 0);\n                move(circle(index+2), width, 0);\n\n              } else {\n                move(index-1, -width, 0);\n              }\n\n              move(index, slidePos[index]-width, speed);\n              move(circle(index+1), slidePos[circle(index+1)]-width, speed);\n              index = circle(index+1);\n\n            } else {\n              if (options.continuous) { // we need to get the next in this direction in place\n\n                move(circle(index+1), width, 0);\n                move(circle(index-2), -width, 0);\n\n              } else {\n                move(index+1, width, 0);\n              }\n\n              move(index, slidePos[index]+width, speed);\n              move(circle(index-1), slidePos[circle(index-1)]+width, speed);\n              index = circle(index-1);\n\n            }\n\n            options.callback && options.callback(index, slides[index]);\n\n          } else {\n\n            if (options.continuous) {\n\n              move(circle(index-1), -width, speed);\n              move(index, 0, speed);\n              move(circle(index+1), width, speed);\n\n            } else {\n\n              move(index-1, -width, speed);\n              move(index, 0, speed);\n              move(index+1, width, speed);\n            }\n\n          }\n\n        }\n\n        // kill touchmove and touchend event listeners until touchstart called again\n        if(browser.touch) {\n          element.removeEventListener('touchmove', events, false);\n          element.removeEventListener('touchend', events, false);\n        } else {\n          element.removeEventListener('mousemove', events, false);\n          element.removeEventListener('mouseup', events, false);\n          document.removeEventListener('mouseup', events, false);\n        }\n\n      },\n      transitionEnd: function(event) {\n\n        if (parseInt(event.target.getAttribute('data-index'), 10) == index) {\n\n          if (delay) begin();\n\n          options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);\n\n        }\n\n      }\n\n    };\n\n    // Public API\n    this.update = function() {\n      setTimeout(setup);\n    };\n    this.setup = function() {\n      setup();\n    };\n\n    this.enableSlide = function(shouldEnable) {\n      if (arguments.length) {\n        this.slideIsDisabled = !shouldEnable;\n      }\n      return !this.slideIsDisabled;\n    },\n    this.slide = function(to, speed) {\n      // cancel slideshow\n      stop();\n\n      slide(to, speed);\n    };\n\n    this.prev = this.previous = function() {\n      // cancel slideshow\n      stop();\n\n      prev();\n    };\n\n    this.next = function() {\n      // cancel slideshow\n      stop();\n\n      next();\n    };\n\n    this.stop = function() {\n      // cancel slideshow\n      stop();\n    };\n\n    this.start = function() {\n      begin();\n    };\n\n    this.currentIndex = function() {\n      // return current index position\n      return index;\n    };\n\n    this.slidesCount = function() {\n      // return total number of slides\n      return length;\n    };\n\n    this.kill = function() {\n      // cancel slideshow\n      stop();\n\n      // reset element\n      element.style.width = '';\n      element.style.left = '';\n\n      // reset slides\n      var pos = slides.length;\n      while(pos--) {\n\n        var slide = slides[pos];\n        slide.style.width = '';\n        slide.style.left = '';\n\n        if (browser.transitions) translate(pos, 0, 0);\n\n      }\n\n      // removed event listeners\n      if (browser.addEventListener) {\n\n        // remove current event listeners\n        element.removeEventListener('touchstart', events, false);\n        element.removeEventListener('webkitTransitionEnd', events, false);\n        element.removeEventListener('msTransitionEnd', events, false);\n        element.removeEventListener('oTransitionEnd', events, false);\n        element.removeEventListener('otransitionend', events, false);\n        element.removeEventListener('transitionend', events, false);\n        window.removeEventListener('resize', events, false);\n\n      }\n      else {\n\n        window.onresize = null;\n\n      }\n    };\n\n    this.load = function() {\n      // trigger setup\n      setup();\n\n      // start auto slideshow if applicable\n      if (delay) begin();\n\n\n      // add event listeners\n      if (browser.addEventListener) {\n\n        // set touchstart event on element\n        if (browser.touch) {\n          element.addEventListener('touchstart', events, false);\n        } else {\n          element.addEventListener('mousedown', events, false);\n        }\n\n        if (browser.transitions) {\n          element.addEventListener('webkitTransitionEnd', events, false);\n          element.addEventListener('msTransitionEnd', events, false);\n          element.addEventListener('oTransitionEnd', events, false);\n          element.addEventListener('otransitionend', events, false);\n          element.addEventListener('transitionend', events, false);\n        }\n\n        // set resize event on window\n        window.addEventListener('resize', events, false);\n\n      } else {\n\n        window.onresize = function () { setup(); }; // to play nice with old IE\n\n      }\n    };\n\n  }\n});\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.Toggle = ionic.views.View.inherit({\n    initialize: function(opts) {\n      var self = this;\n\n      this.el = opts.el;\n      this.checkbox = opts.checkbox;\n      this.track = opts.track;\n      this.handle = opts.handle;\n      this.openPercent = -1;\n      this.onChange = opts.onChange || function() {};\n\n      this.triggerThreshold = opts.triggerThreshold || 20;\n\n      this.dragStartHandler = function(e) {\n        self.dragStart(e);\n      };\n      this.dragHandler = function(e) {\n        self.drag(e);\n      };\n      this.holdHandler = function(e) {\n        self.hold(e);\n      };\n      this.releaseHandler = function(e) {\n        self.release(e);\n      };\n\n      this.dragStartGesture = ionic.onGesture('dragstart', this.dragStartHandler, this.el);\n      this.dragGesture = ionic.onGesture('drag', this.dragHandler, this.el);\n      this.dragHoldGesture = ionic.onGesture('hold', this.holdHandler, this.el);\n      this.dragReleaseGesture = ionic.onGesture('release', this.releaseHandler, this.el);\n    },\n\n    destroy: function() {\n      ionic.offGesture(this.dragStartGesture, 'dragstart', this.dragStartGesture);\n      ionic.offGesture(this.dragGesture, 'drag', this.dragGesture);\n      ionic.offGesture(this.dragHoldGesture, 'hold', this.holdHandler);\n      ionic.offGesture(this.dragReleaseGesture, 'release', this.releaseHandler);\n    },\n\n    tap: function(e) {\n      if(this.el.getAttribute('disabled') !== 'disabled') {\n        this.val( !this.checkbox.checked );\n      }\n    },\n\n    dragStart: function(e) {\n      if(this.checkbox.disabled) return;\n\n      this._dragInfo = {\n        width: this.el.offsetWidth,\n        left: this.el.offsetLeft,\n        right: this.el.offsetLeft + this.el.offsetWidth,\n        triggerX: this.el.offsetWidth / 2,\n        initialState: this.checkbox.checked\n      };\n\n      // Stop any parent dragging\n      e.gesture.srcEvent.preventDefault();\n\n      // Trigger hold styles\n      this.hold(e);\n    },\n\n    drag: function(e) {\n      var self = this;\n      if(!this._dragInfo) { return; }\n\n      // Stop any parent dragging\n      e.gesture.srcEvent.preventDefault();\n\n      ionic.requestAnimationFrame(function(amount) {\n        if (!self._dragInfo) { return; }\n\n        var slidePageLeft = self.track.offsetLeft + (self.handle.offsetWidth / 2);\n        var slidePageRight = self.track.offsetLeft + self.track.offsetWidth - (self.handle.offsetWidth / 2);\n        var dx = e.gesture.deltaX;\n\n        var px = e.gesture.touches[0].pageX - self._dragInfo.left;\n        var mx = self._dragInfo.width - self.triggerThreshold;\n\n        // The initial state was on, so \"tend towards\" on\n        if(self._dragInfo.initialState) {\n          if(px < self.triggerThreshold) {\n            self.setOpenPercent(0);\n          } else if(px > self._dragInfo.triggerX) {\n            self.setOpenPercent(100);\n          }\n        } else {\n          // The initial state was off, so \"tend towards\" off\n          if(px < self._dragInfo.triggerX) {\n            self.setOpenPercent(0);\n          } else if(px > mx) {\n            self.setOpenPercent(100);\n          }\n        }\n      });\n    },\n\n    endDrag: function(e) {\n      this._dragInfo = null;\n    },\n\n    hold: function(e) {\n      this.el.classList.add('dragging');\n    },\n    release: function(e) {\n      this.el.classList.remove('dragging');\n      this.endDrag(e);\n    },\n\n\n    setOpenPercent: function(openPercent) {\n      // only make a change if the new open percent has changed\n      if(this.openPercent < 0 || (openPercent < (this.openPercent - 3) || openPercent > (this.openPercent + 3) ) ) {\n        this.openPercent = openPercent;\n\n        if(openPercent === 0) {\n          this.val(false);\n        } else if(openPercent === 100) {\n          this.val(true);\n        } else {\n          var openPixel = Math.round( (openPercent / 100) * this.track.offsetWidth - (this.handle.offsetWidth) );\n          openPixel = (openPixel < 1 ? 0 : openPixel);\n          this.handle.style[ionic.CSS.TRANSFORM] = 'translate3d(' + openPixel + 'px,0,0)';\n        }\n      }\n    },\n\n    val: function(value) {\n      if(value === true || value === false) {\n        if(this.handle.style[ionic.CSS.TRANSFORM] !== \"\") {\n          this.handle.style[ionic.CSS.TRANSFORM] = \"\";\n        }\n        this.checkbox.checked = value;\n        this.openPercent = (value ? 100 : 0);\n        this.onChange && this.onChange();\n      }\n      return this.checkbox.checked;\n    }\n\n  });\n\n})(ionic);\n\n})();"
  },
  {
    "path": "www/lib/ionic/scss/_action-sheet.scss",
    "content": "/**\n * Action Sheets\n * --------------------------------------------------\n */\n\n.action-sheet-backdrop {\n  @include transition(background-color 300ms ease-in-out);\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: $z-index-action-sheet;\n  width: 100%;\n  height: 100%;\n  background-color: rgba(0,0,0,0);\n\n  &.active {\n    background-color: rgba(0,0,0,0.5);\n  }\n}\n\n.action-sheet-wrapper {\n  @include translate3d(0, 100%, 0);\n  @include transition(all ease-in-out 300ms);\n  position: absolute;\n  bottom: 0;\n  width: 100%;\n}\n\n.action-sheet-up {\n  @include translate3d(0, 0, 0);\n}\n\n.action-sheet {\n  margin-left: 15px;\n  margin-right: 15px;\n  width: auto;\n  z-index: $z-index-action-sheet;\n  overflow: hidden;\n\n  .button {\n    display: block;\n    padding: 1px;\n    width: 100%;\n    border-radius: 0;\n\n    background-color: transparent;\n\n    color: $positive;\n    font-size: 18px;\n\n    &.destructive {\n      color: $assertive;\n    }\n  }\n}\n\n.action-sheet-title {\n  padding: 10px;\n  color: lighten($base-color, 40%);\n  text-align: center;\n  font-size: 12px;\n}\n\n.action-sheet-group {\n  margin-bottom: 5px;\n  border-radius: $sheet-border-radius;\n  background-color: #fff;\n  .button {\n    border-width: 1px 0px 0px 0px;\n    border-radius: 0;\n\n    &.active {\n      background-color: transparent;\n      color: inherit;\n    }\n  }\n  .button:first-child:last-child {\n    border-width: 0;\n  }\n}\n\n.action-sheet-open {\n  pointer-events: none;\n\n  &.modal-open .modal {\n    pointer-events: none;\n  }\n\n  .action-sheet-backdrop {\n    pointer-events: auto;\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_animations.scss",
    "content": "/**\n * Animations\n * --------------------------------------------------\n * The animations in this file are \"simple\" - not too complex\n * and pretty easy on performance. They can be overidden\n * and enhanced easily.\n */\n\n$transition-duration: 250ms;\n$slide-in-up-function: cubic-bezier(.1, .7, .1, 1);\n\n\n/**\n * Keyframes\n * --------------------------------------------------\n */\n\n// Slide In From The Bottom To The Top\n// -------------------------------\n\n@-webkit-keyframes slideInUp {\n  0%   { -webkit-transform: translate3d(0, 100%, 0); }\n  100% { -webkit-transform: translate3d(0, 0, 0); }\n}\n@-moz-keyframes slideInUp {\n  0%   { -moz-transform: translate3d(0, 100%, 0); }\n  100% { -moz-transform: translate3d(0, 0, 0); }\n}\n@keyframes slideInUp {\n  0%   { transform: translate3d(0, 100%, 0); }\n  100% { transform: translate3d(0, 0, 0); }\n}\n\n\n// Slide Out From The Top To Bottom\n// -------------------------------\n\n@-webkit-keyframes slideOutUp {\n  0%   { -webkit-transform: translate3d(0, 0, 0); }\n  100% { -webkit-transform: translate3d(0, 100%, 0); }\n}\n@-moz-keyframes slideOutUp {\n  0%   { -moz-transform: translate3d(0, 0, 0); }\n  100% { -moz-transform: translate3d(0, 100%, 0); }\n}\n@keyframes slideOutUp {\n  0%   { transform: translate3d(0, 0, 0); }\n  100% { transform: translate3d(0, 100%, 0); }\n}\n\n\n// Slide In From Left\n// -------------------------------\n\n@-webkit-keyframes slideInFromLeft {\n    from { -webkit-transform: translate3d(-100%, 0, 0); }\n    to { -webkit-transform: translate3d(0, 0, 0); }\n}\n@-moz-keyframes slideInFromLeft {\n    from { -moz-transform: translateX(-100%); }\n    to { -moz-transform: translateX(0); }\n}\n@keyframes slideInFromLeft {\n    from { transform: translateX(-100%); }\n    to { transform: translateX(0); }\n}\n\n\n// Slide In From Right\n// -------------------------------\n\n@-webkit-keyframes slideInFromRight {\n    from { -webkit-transform: translate3d(100%, 0, 0); }\n    to { -webkit-transform: translate3d(0, 0, 0); }\n}\n@-moz-keyframes slideInFromRight {\n    from { -moz-transform: translateX(100%); }\n    to { -moz-transform: translateX(0); }\n}\n@keyframes slideInFromRight {\n    from { transform: translateX(100%); }\n    to { transform: translateX(0); }\n}\n\n\n// Slide Out To Left\n// -------------------------------\n\n@-webkit-keyframes slideOutToLeft {\n  from { -webkit-transform: translate3d(0, 0, 0); }\n  to { -webkit-transform: translate3d(-100%, 0, 0); }\n}\n@-moz-keyframes slideOutToLeft {\n  from { -moz-transform: translateX(0); }\n  to { -moz-transform: translateX(-100%); }\n}\n@keyframes slideOutToLeft {\n  from { transform: translateX(0); }\n  to { transform: translateX(-100%); }\n}\n\n\n// Slide Out To Right\n// -------------------------------\n\n@-webkit-keyframes slideOutToRight {\n  from { -webkit-transform: translate3d(0, 0, 0); }\n  to { -webkit-transform: translate3d(100%, 0, 0); }\n}\n@-moz-keyframes slideOutToRight {\n  from { -moz-transform: translateX(0); }\n  to { -moz-transform: translateX(100%); }\n}\n@keyframes slideOutToRight {\n  from { transform: translateX(0); }\n  to { transform: translateX(100%); }\n}\n\n\n// Fade Out\n// -------------------------------\n\n@-webkit-keyframes fadeOut {\n  from { opacity: 1; }\n  to { opacity: 0; }\n}\n@-moz-keyframes fadeOut {\n  from { opacity: 1; }\n  to { opacity: 0; }\n}\n@keyframes fadeOut {\n  from { opacity: 1; }\n  to { opacity: 0; }\n}\n\n\n// Fade In\n// -------------------------------\n\n@-webkit-keyframes fadeIn {\n  from { opacity: 0; }\n  to { opacity: 1; }\n}\n@-moz-keyframes fadeIn {\n  from { opacity: 0; }\n  to { opacity: 1; }\n}\n@keyframes fadeIn {\n  from { opacity: 0; }\n  to { opacity: 1; }\n}\n\n\n// Fade Half In\n// -------------------------------\n\n@-webkit-keyframes fadeInHalf {\n  from { background-color: rgba(0,0,0,0); }\n  to { background-color: rgba(0,0,0,0.5); }\n}\n@-moz-keyframes fadeInHalf {\n  from { background-color: rgba(0,0,0,0); }\n  to { background-color: rgba(0,0,0,0.5); }\n}\n@keyframes fadeInHalf {\n  from { background-color: rgba(0,0,0,0); }\n  to { background-color: rgba(0,0,0,0.5); }\n}\n\n\n// Fade Half Out\n// -------------------------------\n\n@-webkit-keyframes fadeOutHalf {\n  from { background-color: rgba(0,0,0,0.5); }\n  to { background-color: rgba(0,0,0,0); }\n}\n@-moz-keyframes fadeOutHalf {\n  from { background-color: rgba(0,0,0,0.5); }\n  to { background-color: rgba(0,0,0,0); }\n}\n@keyframes fadeOutHalf {\n  from { background-color: rgba(0,0,0,0.5); }\n  to { background-color: rgba(0,0,0,0); }\n}\n\n// Scale Out\n// Scale from hero (1 in this case) to zero\n// -------------------------------\n\n@-webkit-keyframes scaleOut {\n  from { -webkit-transform: scale(1); opacity: 1; }\n  to { -webkit-transform: scale(0.8); opacity: 0; }\n}\n@-moz-keyframes scaleOut {\n  from { -moz-transform: scale(1); opacity: 1; }\n  to { -moz-transform: scale(0.8); opacity: 0; }\n}\n@keyframes scaleOut {\n  from { transform: scale(1); opacity: 1; }\n  to { transform: scale(0.8); opacity: 0; }\n}\n\n// Scale In\n// Scale from 0 to hero (1 in this case)\n// -------------------------------\n\n@-webkit-keyframes scaleIn {\n  from { -webkit-transform: scale(0); }\n  to { -webkit-transform: scale(1); }\n}\n@-moz-keyframes scaleIn {\n  from { -moz-transform: scale(0); }\n  to { -moz-transform: scale(1); }\n}\n@keyframes scaleIn {\n  from { transform: scale(0); }\n  to { transform: scale(1); }\n}\n\n// Super Scale In\n// Scale from super (1.x) to duper (1 in this case)\n// -------------------------------\n\n@-webkit-keyframes superScaleIn {\n  from { -webkit-transform: scale(1.2); opacity: 0; }\n  to { -webkit-transform: scale(1); opacity: 1 }\n}\n@-moz-keyframes superScaleIn {\n  from { -moz-transform: scale(1.2); opacity: 0; }\n  to { -moz-transform: scale(1); opacity: 1; }\n}\n@keyframes superScaleIn {\n  from { transform: scale(1.2); opacity: 0; }\n  to { transform: scale(1); opacity: 1; }\n}\n\n// Spin\n// -------------------------------\n\n@-webkit-keyframes spin {\n  100% { -webkit-transform: rotate(360deg); }\n}\n@-moz-keyframes spin {\n  100% { -moz-transform: rotate(360deg); }\n}\n@keyframes spin {\n  100% { transform: rotate(360deg); }\n}\n\n.no-animation {\n  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {\n    @include transition(none);\n  }\n}\n.noop-animation {\n  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {\n    @include transition(all cubic-bezier(0.250, 0.460, 0.450, 0.940) $transition-duration);\n    position: absolute;\n    top: 0;\n    right: 0;\n    bottom: 0;\n    left: 0;\n  }\n}\n\n\n// required for Android\n.ng-animate .pane {\n  position: absolute;\n}\n\n\n/**\n * Slide Left-Right, and Right-Left, each with the reserve\n * --------------------------------------------------\n * NEW content slides IN from the RIGHT, OLD slides OUT to the LEFT\n * Reverse: NEW content slides IN from the LEFT, OLD slides OUT to the RIGHT\n */\n\n.slide-left-right,\n.slide-right-left.reverse {\n  > .ng-enter, &.ng-enter,\n  > .ng-leave, &.ng-leave {\n    @include transition(all ease-in-out $transition-duration);\n    position: absolute;\n    top: 0;\n    right: 0;\n    bottom: 0;\n    left: 0;\n  }\n  > .ng-enter, &.ng-enter {\n    /* NEW content placed far RIGHT BEFORE it slides IN from the RIGHT */\n    @include translate3d(100%, 0, 0);\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    /* NEW content ACTIVELY sliding IN from the RIGHT */\n    @include translate3d(0, 0, 0);\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    /* OLD content ACTIVELY sliding OUT to the LEFT */\n    @include translate3d(-100%, 0, 0);\n  }\n}\n\n.slide-left-right.reverse,\n.slide-right-left {\n  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {\n    @include transition(all ease-in-out $transition-duration);\n    position: absolute;\n    top: 0;\n    right: 0;\n    bottom: 0;\n    left: 0;\n  }\n  > .ng-enter, &.ng-enter {\n    /* NEW content placed far LEFT BEFORE it slides IN from the LEFT */\n    @include translate3d(-100%, 0, 0);\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    /* NEW content ACTIVELY sliding IN from the LEFT */\n    @include translate3d(0, 0, 0);\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    /* OLD content ACTIVELY sliding OUT to the RIGHT */\n    @include translate3d(100%, 0, 0);\n  }\n}\n\n\n/**\n * iOS style slide left to right\n * --------------------------------------------------\n */\n$ios-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n$ios-transition-duration: 400ms;\n$ios-transition-box-shadow: 0px 0px 12px rgba(0,0,0,0.5);\n/*\n$ios-transition-box-shadow-start: -200px 0px 200px rgba(0,0,0,0), -5px 0px 5px rgba(0,0,0,0.01);\n$ios-transition-box-shadow-end: -200px 0px 200px rgba(0,0,0,0.15), -5px 0px 5px rgba(0,0,0,0.18);\n*/\n\n.slide-ios,\n.slide-left-right-ios7,\n.slide-right-left-ios7.reverse {\n  > .ng-enter, &.ng-enter,\n  > .ng-leave, &.ng-leave {\n    @include transition(all $ios-timing-function $ios-transition-duration);\n    position: absolute;\n    top: 0;\n    //right: -1px;\n    bottom: 0;\n    //left: -1px;\n    width: auto;\n    &:not(.bar) {\n      border-right: none;\n      border-left: none;\n    }\n    border-right: none;\n    border-left: none;\n  }\n  > .ng-enter, &.ng-enter {\n    /* NEW content placed far RIGHT BEFORE it slides IN from the RIGHT */\n    @include translate3d(100%, 0, 0);\n  }\n  > .ng-leave, &.ng-leave {\n    z-index: 1;\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    /* NEW content ACTIVELY sliding IN from the RIGHT */\n    @include translate3d(0, 0, 0);\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    /* OLD content ACTIVELY sliding OUT to the LEFT */\n    @include translate3d(-20%, 0, 0);\n  }\n}\n.slide-ios.reverse,\n.slide-left-right-ios7.reverse,\n.slide-right-left-ios7 {\n  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {\n    @include transition(all $ios-timing-function $ios-transition-duration);\n    position: absolute;\n    top: 0;\n    //right: -1px;\n    bottom: 0;\n    //left: -1px;\n    width: auto;\n    border-right: none;\n    border-left: none;\n  }\n  > .ng-enter, &.ng-enter {\n    /* NEW content placed far LEFT BEFORE it slides IN from the LEFT */\n    @include translate3d(-20%, 0, 0);\n  }\n  > .ng-leave, &.ng-leave {\n    z-index: 2;\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    /* NEW content ACTIVELY sliding IN from the LEFT */\n    @include translate3d(0, 0, 0);\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    /* OLD content ACTIVELY sliding OUT to the RIGHT */\n    @include translate3d(100%, 0, 0);\n  }\n}\n\n/**\n * iPad doesn't like box shadows\n */\n.grade-a {\n  .slide-ios,\n  .slide-left-right-ios7, .slide-right-left-ios7.reverse {\n    > .ng-enter, &.ng-enter {\n      &:not(.platform-ipad) {\n        box-shadow: none;\n      }\n    }\n    > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n      &:not(.platform-ipad) {\n        box-shadow: $ios-transition-box-shadow;\n      }\n    }\n    > .ng-leave, &.ng-leave {\n      opacity: 1;\n    }\n    > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n      opacity: 0.9;\n    }\n  }\n  .slide-ios.reverse,\n  .slide-left-right-ios7.reverse, .slide-right-left-ios7 {\n    > .ng-enter, &.ng-enter {\n      opacity: 0.9;\n    }\n    > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n      opacity: 1;\n    }\n    > .ng-leave, &.ng-leave {\n      box-shadow: 0px 0px 12px rgba(0,0,0,0.5);\n      opacity: 1;\n    }\n    > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n      box-shadow: none;\n    }\n  }\n}\n\n$full-slide-timing-function: ease-in-out;\n$full-slide-transition-duration: 400ms;\n\n.slide-full {\n  > .ng-enter, &.ng-enter,\n  > .ng-leave, &.ng-leave {\n    @include transition(all $full-slide-timing-function $full-slide-transition-duration);\n    position: absolute;\n    top: 0;\n    right: -1px;\n    bottom: 0;\n    left: -1px;\n    width: auto;\n    &:not(.bar) {\n      border-right: none;\n      border-left: none;\n    }\n    border-right: none;\n    border-left: none;\n  }\n  > .ng-enter, &.ng-enter {\n    /* NEW content placed far RIGHT BEFORE it slides IN from the RIGHT */\n    @include translate3d(100%, 0, 0);\n  }\n  > .ng-leave, &.ng-leave {\n    z-index: 1;\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    /* NEW content ACTIVELY sliding IN from the RIGHT */\n    @include translate3d(0, 0, 0);\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    /* OLD content ACTIVELY sliding OUT to the LEFT */\n    @include translate3d(-100%, 0, 0);\n  }\n}\n.slide-full.reverse {\n  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {\n    @include transition(all $full-slide-timing-function $full-slide-transition-duration);\n    position: absolute;\n    top: 0;\n    right: -1px;\n    bottom: 0;\n    left: -1px;\n    width: auto;\n    border-right: none;\n    border-left: none;\n  }\n  > .ng-enter, &.ng-enter {\n    /* NEW content placed far LEFT BEFORE it slides IN from the LEFT */\n    @include translate3d(-100%, 0, 0);\n  }\n  > .ng-leave, &.ng-leave {\n    z-index: 2;\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    /* NEW content ACTIVELY sliding IN from the LEFT */\n    @include translate3d(0, 0, 0);\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    /* OLD content ACTIVELY sliding OUT to the RIGHT */\n    @include translate3d(100%, 0, 0);\n  }\n}\n\n\n.fade-explode.reverse {\n  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {\n    @include transition(all ease-out 300ms);\n    position: absolute;\n    top: 0;\n    right: -1px;\n    bottom: 0;\n    left: -1px;\n    width: auto;\n    &:not(.bar) {\n      border-right: 1px solid #ddd;\n      border-left: 1px solid #ddd;\n    }\n  }\n  > .ng-enter, &.ng-enter {\n    /* NEW content placed far LEFT BEFORE it slides IN from the LEFT */\n    @include scale(0.95);\n    opacity: 0;\n    z-index: 1;\n  }\n  > .ng-leave, &.ng-leave {\n    @include scale(1);\n    opacity: 1;\n    z-index: 2;\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    @include scale(1);\n    opacity: 1;\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    @include scale(1.6);\n    opacity: 0;\n  }\n}\n\n/**\n * Android style \"pop in\" with fade and scale\n */\n.fade-implode {\n  > .ng-enter, &.ng-enter,\n  > .ng-leave, &.ng-leave {\n    @include transition(all ease-out 200ms);\n    position: absolute;\n    top: 0;\n    right: -1px;\n    bottom: 0;\n    left: -1px;\n    width: auto;\n    &:not(.bar) {\n      border-right: 1px solid #ddd;\n      border-left: 1px solid #ddd;\n    }\n  }\n  > .ng-enter, &.ng-enter {\n    /* NEW content placed far RIGHT BEFORE it slides IN from the RIGHT */\n    @include scale(0.8);\n    opacity: 0;\n    z-index: 2;\n  }\n  > .ng-leave, &.ng-leave {\n    z-index: 1;\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    /* NEW content */\n    @include scale(1);\n    opacity: 1;\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n  }\n}\n\n.fade-implode.reverse {\n  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {\n    @include transition(all ease-out 200ms);\n    position: absolute;\n    top: 0;\n    right: -1px;\n    bottom: 0;\n    left: -1px;\n    width: auto;\n    border-right: 1px solid #ddd;\n    border-left: 1px solid #ddd;\n  }\n  > .ng-enter, &.ng-enter {\n    @include scale(1);\n    opacity: 1;\n    z-index: 1;\n  }\n  > .ng-leave, &.ng-leave {\n    @include scale(1);\n    opacity: 1;\n    z-index: 2;\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    opacity: 1;\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    @include scale(0.8);\n    opacity: 0;\n  }\n}\n\n/**\n * Simple slide-in animation\n */\n.slide-in-left {\n  @include translate3d(0%,0,0);\n  &.ng-enter, > .ng-enter {\n    @include animation-name(slideInFromLeft);\n    @include animation-duration($transition-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n  &.ng-leave, > .ng-leave {\n    @include animation-name(slideOutToLeft);\n    @include animation-duration($transition-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n}\n\n\n.slide-in-left-add {\n  @include translate3d(100%,0,0);\n  @include animation-duration($transition-duration);\n  @include animation-timing-function(ease-in-out);\n  @include animation-fill-mode(both);\n}\n.slide-in-left-add-active {\n  @include animation-name(slideInFromLeft);\n}\n\n.slide-out-left {\n  @include translate3d(-100%,0,0);\n  &.ng-enter, > .ng-enter {\n    @include animation-name(slideOutToLeft);\n    @include animation-duration($transition-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n  &.ng-leave, > .ng-leave {\n    @include animation-name(slideOutToLeft);\n    @include animation-duration($transition-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n}\n\n.slide-out-left {\n}\n\n.slide-out-left-add {\n  @include translate3d(0,0,0);\n  @include animation-duration($transition-duration);\n  @include animation-timing-function(ease-in-out);\n  @include animation-fill-mode(both);\n}\n.slide-out-left-add-active {\n  @include animation-name(slideOutToLeft);\n}\n\n.slide-in-right {\n  @include translate3d(0%,0,0);\n  &.ng-enter, > .ng-enter {\n    @include animation-name(slideInFromRight);\n    @include animation-duration($transition-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n  &.ng-leave, > .ng-leave {\n    @include animation-name(slideOutToRight);\n    @include animation-duration($transition-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n}\n\n.slide-in-right-add {\n  @include translate3d(-100%,0,0);\n  @include animation-duration($transition-duration);\n  @include animation-timing-function(ease-in-out);\n  @include animation-fill-mode(both);\n}\n.slide-in-right-add-active {\n  @include animation-name(slideInFromRight);\n}\n\n.slide-out-right {\n  @include translate3d(100%,0,0);\n  &.ng-enter, > .ng-enter {\n    @include animation-name(slideOutToRight);\n    @include animation-duration($transition-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n  &.ng-leave, > .ng-leave {\n    @include animation-name(slideOutToRight);\n    @include animation-duration($transition-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n}\n\n.slide-out-right-add {\n  @include translate3d(0,0,0);\n  @include animation-duration($transition-duration);\n  @include animation-timing-function(ease-in-out);\n  @include animation-fill-mode(both);\n}\n.slide-out-right-add-active {\n  @include animation-name(slideOutToRight);\n}\n\n\n/**\n * Slide up from the bottom, used for modals\n * --------------------------------------------------\n */\n\n.slide-in-up {\n  @include translate3d(0, 100%, 0);\n}\n.slide-in-up.ng-enter,\n.slide-in-up > .ng-enter {\n  @include transition(all $slide-in-up-function 400ms);\n}\n.slide-in-up.ng-enter-active,\n.slide-in-up > .ng-enter-active {\n  @include translate3d(0, 0, 0);\n}\n\n.slide-in-up.ng-leave,\n.slide-in-up > .ng-leave {\n  @include transition(all ease-in-out 250ms);\n}\n\n\n.fade-in {\n  @include animation(fadeOut 0.3s);\n  &.active {\n    @include animation(fadeIn 0.3s);\n  }\n}\n\n.fade-in-not-out {\n  &.ng-enter, .ng-enter {\n    @include animation(fadeIn 0.3s);\n    position: relative;\n  }\n  &.ng-leave, .ng-leave {\n    display: none;\n  }\n}\n\n\n\n/**\n * Some component specific animations\n */\n$nav-title-slide-ios-delay: $ios-transition-duration;\n.nav-title-slide-ios,\n.nav-title-slide-ios7 {\n  &:not(.no-animation) .button.back-button {\n    @include transition(all $nav-title-slide-ios-delay);\n    @include transition-timing-function($ios-timing-function);\n\n    @include translate3d(0%, 0, 0);\n    opacity: 1;\n    &.active, &.activated {\n      opacity: 0.5;\n    }\n    &.ng-hide {\n      opacity: 0;\n      @include translate3d(30%, 0, 0);\n    }\n    &.ng-hide-add,\n    &.ng-hide-remove {\n      display: block !important;\n    }\n    &.ng-hide-add {\n      position: absolute;\n    }\n  }\n  > .ng-enter, &.ng-enter,\n  > .ng-leave, &.ng-leave {\n    @include transition(all $nav-title-slide-ios-delay);\n    @include transition-timing-function($ios-timing-function);\n    opacity: 1;\n  }\n  > .ng-enter, &.ng-enter {\n    @include translate3d(30%, 0, 0);\n    opacity: 0;\n    &.title {\n      @include translate3d(100%, 0, 0);\n    }\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    @include translate3d(0, 0, 0);\n    opacity: 1;\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    @include translate3d(-30%, 0, 0);\n    opacity: 0;\n  }\n\n  &.reverse {\n    > .ng-enter, &.ng-enter,\n    > .ng-leave, &.ng-leave {\n      @include transition(all $nav-title-slide-ios-delay);\n      @include transition-timing-function($ios-timing-function);\n      opacity: 1;\n    }\n    > .ng-enter, &.ng-enter {\n      @include translate3d(-30%, 0, 0);\n      opacity: 0;\n    }\n    > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n      @include translate3d(0, 0, 0);\n      opacity: 1;\n    }\n    > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n      @include translate3d(100%, 0, 0);\n      opacity: 0;\n    }\n  }\n}\n\n\n/**\n * Some component specific animations\n */\n$nav-title-slide-full-duration: $full-slide-transition-duration;\n.nav-title-slide-full {\n  &:not(.no-animation) .button.back-button {\n    @include transition(all $nav-title-slide-full-duration);\n    @include transition-timing-function($full-slide-timing-function);\n\n    @include translate3d(0%, 0, 0);\n    opacity: 1;\n    &.active, &.activated {\n      opacity: 0.5;\n    }\n    &.ng-hide {\n      opacity: 0;\n      @include translate3d(30%, 0, 0);\n    }\n    &.ng-hide-add,\n    &.ng-hide-remove {\n      display: block !important;\n    }\n    &.ng-hide-add {\n      position: absolute;\n    }\n  }\n  > .ng-enter, &.ng-enter,\n  > .ng-leave, &.ng-leave {\n    @include transition(all $nav-title-slide-full-duration);\n    @include transition-timing-function($full-slide-timing-function);\n    opacity: 1;\n  }\n  > .ng-enter, &.ng-enter {\n    @include translate3d(30%, 0, 0);\n    opacity: 0;\n    &.title {\n      @include translate3d(100%, 0, 0);\n    }\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    @include translate3d(0, 0, 0);\n    opacity: 1;\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    @include translate3d(-30%, 0, 0);\n    opacity: 0;\n  }\n\n  &.reverse {\n    > .ng-enter, &.ng-enter,\n    > .ng-leave, &.ng-leave {\n      @include transition(all $nav-title-slide-full-duration);\n      @include transition-timing-function($full-slide-timing-function);\n      opacity: 1;\n    }\n    > .ng-enter, &.ng-enter {\n      @include translate3d(-30%, 0, 0);\n      opacity: 0;\n    }\n    > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n      @include translate3d(0, 0, 0);\n      opacity: 1;\n    }\n    > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n      @include translate3d(100%, 0, 0);\n      opacity: 0;\n    }\n  }\n}\n\n\n$nav-title-android-delay: 200ms;\n$nav-title-android-timing-function: linear;\n\n.nav-title-android {\n  &:not(.no-animation) .button.back-button {\n    @include transition(all $nav-title-android-delay);\n    @include transition-timing-function($nav-title-android-timing-function);\n    opacity: 1;\n    &.ng-hide {\n      opacity: 0;\n    }\n    &.ng-hide-add,\n    &.ng-hide-remove {\n      display: block !important;\n    }\n    &.ng-hide-add {\n      position: absolute;\n    }\n    &.ng-hide-remove {\n    }\n  }\n  > .ng-enter, &.ng-enter,\n  > .ng-leave, &.ng-leave {\n    @include transition(all $nav-title-android-delay);\n    @include transition-timing-function($nav-title-android-timing-function);\n  }\n  > .ng-enter, &.ng-enter {\n    opacity: 0;\n  }\n  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {\n    opacity: 1;\n  }\n  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {\n    opacity: 0;\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_backdrop.scss",
    "content": "\n.backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: $z-index-backdrop;\n\n  width: 100%;\n  height: 100%;\n\n  background-color: rgba(0,0,0,0.4);\n\n  visibility: hidden;\n  opacity: 0;\n\n  &.visible {\n    visibility: visible;\n  }\n  &.active {\n    opacity: 1;\n  }\n\n  @include transition(0.1s opacity linear);\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_badge.scss",
    "content": "\n/**\n * Badges\n * --------------------------------------------------\n */\n\n.badge {\n  @include badge-style($badge-default-bg, $badge-default-text);\n  z-index: $z-index-badge;\n  display: inline-block;\n  padding: 3px 8px;\n  min-width: 10px;\n  border-radius: $badge-border-radius;\n  vertical-align: baseline;\n  text-align: center;\n  white-space: nowrap;\n  font-weight: $badge-font-weight;\n  font-size: $badge-font-size;\n  line-height: $badge-line-height;\n\n  &:empty {\n    display: none;\n  }\n}\n\n//Be sure to override specificity of rule that 'badge color matches tab color by default'\n.tabs .tab-item .badge,\n.badge {\n  &.badge-light {\n    @include badge-style($badge-light-bg, $badge-light-text);\n  }\n  &.badge-stable {\n    @include badge-style($badge-stable-bg, $badge-stable-text);\n  }\n  &.badge-positive {\n    @include badge-style($badge-positive-bg, $badge-positive-text);\n  }\n  &.badge-calm {\n    @include badge-style($badge-calm-bg, $badge-calm-text);\n  }\n  &.badge-assertive {\n    @include badge-style($badge-assertive-bg, $badge-assertive-text);\n  }\n  &.badge-balanced {\n    @include badge-style($badge-balanced-bg, $badge-balanced-text);\n  }\n  &.badge-energized {\n    @include badge-style($badge-energized-bg, $badge-energized-text);\n  }\n  &.badge-royal {\n    @include badge-style($badge-royal-bg, $badge-royal-text);\n  }\n  &.badge-dark {\n    @include badge-style($badge-dark-bg, $badge-dark-text);\n  }\n}\n\n// Quick fix for labels/badges in buttons\n.button .badge {\n  position: relative;\n  top: -1px;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_bar.scss",
    "content": "\n/**\n * Bar (Headers and Footers)\n * --------------------------------------------------\n */\n\n.bar {\n  @include display-flex();\n  @include translate3d(0,0,0);\n  @include user-select(none);\n  position: absolute;\n  right: 0;\n  left: 0;\n  z-index: $z-index-bar;\n\n  box-sizing: border-box;\n  padding: $bar-padding-portrait;\n\n  width: 100%;\n  height: $bar-height;\n  border-width: 0;\n  border-style: solid;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid $bar-default-border;\n\n  background-color: $bar-default-bg;\n\n  /* border-width: 1px will actually create 2 device pixels on retina */\n  /* this nifty trick sets an actual 1px border on hi-res displays */\n  background-size: 0;\n  @media (min--moz-device-pixel-ratio: 1.5),\n         (-webkit-min-device-pixel-ratio: 1.5),\n         (min-device-pixel-ratio: 1.5),\n         (min-resolution: 144dpi),\n         (min-resolution: 1.5dppx) {\n    border: none;\n    background-image: linear-gradient(0deg, $bar-default-border, $bar-default-border 50%, transparent 50%);\n    background-position: bottom;\n    background-size: 100% 1px;\n    background-repeat: no-repeat;\n  }\n\n  &.bar-clear {\n    border: none;\n    background: none;\n    color: #fff;\n\n    .button {\n      color: #fff;\n    }\n    .title {\n      color: #fff;\n    }\n  }\n\n  &.item-input-inset {\n    .item-input-wrapper {\n      margin-top: -1px;\n\n      input {\n        padding-left: 8px;\n        width: 94%;\n        height: 28px;\n        background: transparent;\n      }\n    }\n  }\n\n  &.bar-light {\n    @include bar-style($bar-light-bg, $bar-light-border, $bar-light-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-light-border, $bar-light-border 50%, transparent 50%);\n    }\n  }\n  &.bar-stable {\n    @include bar-style($bar-stable-bg, $bar-stable-border, $bar-stable-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-stable-border, $bar-stable-border 50%, transparent 50%);\n    }\n  }\n  &.bar-positive {\n    @include bar-style($bar-positive-bg, $bar-positive-border, $bar-positive-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-positive-border, $bar-positive-border 50%, transparent 50%);\n    }\n  }\n  &.bar-calm {\n    @include bar-style($bar-calm-bg, $bar-calm-border, $bar-calm-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-calm-border, $bar-calm-border 50%, transparent 50%);\n    }\n  }\n  &.bar-assertive {\n    @include bar-style($bar-assertive-bg, $bar-assertive-border, $bar-assertive-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-assertive-border, $bar-assertive-border 50%, transparent 50%);\n    }\n  }\n  &.bar-balanced {\n    @include bar-style($bar-balanced-bg, $bar-balanced-border, $bar-balanced-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-balanced-border, $bar-positive-border 50%, transparent 50%);\n    }\n  }\n  &.bar-energized {\n    @include bar-style($bar-energized-bg, $bar-energized-border, $bar-energized-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-energized-border, $bar-energized-border 50%, transparent 50%);\n    }\n  }\n  &.bar-royal {\n    @include bar-style($bar-royal-bg, $bar-royal-border, $bar-royal-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-royal-border, $bar-royal-border 50%, transparent 50%);\n    }\n  }\n  &.bar-dark {\n    @include bar-style($bar-dark-bg, $bar-dark-border, $bar-dark-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-dark-border, $bar-dark-border 50%, transparent 50%);\n    }\n  }\n\n  // Title inside of a bar is centered\n  .title {\n    position: absolute;\n\n    top: 0;\n    right: 0;\n    left: 0;\n    z-index: $z-index-bar-title;\n    overflow: hidden;\n\n    margin: 0 10px;\n\n    min-width: 30px;\n    height: $bar-height - 1;\n\n    text-align: center;\n\n    // Go into ellipsis if too small\n    text-overflow: ellipsis;\n    white-space: nowrap;\n\n    font-size: $bar-title-font-size;\n\n    line-height: $bar-height;\n\n    &.title-left {\n      text-align: left;\n    }\n    &.title-right {\n      text-align: right;\n    }\n  }\n\n  .title a {\n    color: inherit;\n  }\n\n  .button {\n    z-index: $z-index-bar-button;\n    padding: 0 $button-bar-button-padding;\n    min-width: initial;\n    min-height: $button-bar-button-height - 1;\n    font-weight: 400;\n    font-size: $button-bar-button-font-size;\n    line-height: $button-bar-button-height;\n\n    &.button-icon:before,\n    .icon:before,\n    &.icon:before,\n    &.icon-left:before,\n    &.icon-right:before {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-size: $button-bar-button-icon-size;\n      line-height: $button-bar-button-height;\n    }\n\n    &.button-icon {\n      font-size: $bar-title-font-size;\n      .icon:before,\n      &:before,\n      &.icon-left:before,\n      &.icon-right:before {\n        vertical-align: top;\n        font-size: $button-large-icon-size;\n        line-height: $button-bar-button-height;\n      }\n    }\n    &.button-clear {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-weight: 300;\n      font-size: $bar-title-font-size;\n\n      .icon:before,\n      &.icon:before,\n      &.icon-left:before,\n      &.icon-right:before {\n        font-size: $button-large-icon-size;\n        line-height: $button-bar-button-height;\n      }\n    }\n\n    &.back-button {\n      padding: 0;\n      opacity: 0.8;\n      .back-button-title {\n        display: inline-block;\n        vertical-align: middle;\n        margin-left: 4px;\n      }\n    }\n\n    &.back-button.active,\n    &.back-button.activated {\n      opacity: 1;\n    }\n  }\n\n  .button-bar > .button,\n  .buttons > .button {\n    min-height: $button-bar-button-height - 1;\n    line-height: $button-bar-button-height;\n  }\n\n  .button-bar + .button,\n  .button + .button-bar {\n    margin-left: 5px;\n  }\n\n  // Android 4.4 messes with the display property\n  .buttons,\n  .buttons.left-buttons,\n  .buttons.right-buttons {\n    display: inherit;\n  }\n  .buttons span {\n    display: inline-flex;\n  }\n\n  // Place the last button in a bar on the right of the bar\n  .title + .button:last-child,\n  > .button + .button:last-child,\n  > .button.pull-right,\n  .buttons.pull-right,\n  .title + .buttons {\n    position: absolute;\n    top: 5px;\n    right: 5px;\n    bottom: 5px;\n  }\n\n}\n\n// Default styles for buttons inside of styled bars\n.bar-light {\n  .button {\n    @include button-style($bar-light-bg, $bar-light-border, $bar-light-active-bg, $bar-light-active-border, $bar-light-text);\n    @include button-clear($bar-light-text, $bar-title-font-size);\n  }\n}\n.bar-stable {\n  .button {\n    @include button-style($bar-stable-bg, $bar-stable-border, $bar-stable-active-bg, $bar-stable-active-border, $bar-stable-text);\n    @include button-clear($bar-stable-text, $bar-title-font-size);\n  }\n}\n.bar-positive {\n  .button {\n    @include button-style($bar-positive-bg, $bar-positive-border, $bar-positive-active-bg, $bar-positive-active-border, $bar-positive-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-calm {\n  .button {\n    @include button-style($bar-calm-bg, $bar-calm-border, $bar-calm-active-bg, $bar-calm-active-border, $bar-calm-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-assertive {\n  .button {\n    @include button-style($bar-assertive-bg, $bar-assertive-border, $bar-assertive-active-bg, $bar-assertive-active-border, $bar-assertive-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-balanced {\n  .button {\n    @include button-style($bar-balanced-bg, $bar-balanced-border, $bar-balanced-active-bg, $bar-balanced-active-border, $bar-balanced-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-energized {\n  .button {\n    @include button-style($bar-energized-bg, $bar-energized-border, $bar-energized-active-bg, $bar-energized-active-border, $bar-energized-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-royal {\n  .button {\n    @include button-style($bar-royal-bg, $bar-royal-border, $bar-royal-active-bg, $bar-royal-active-border, $bar-royal-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-dark {\n  .button {\n    @include button-style($bar-dark-bg, $bar-dark-border, $bar-dark-active-bg, $bar-dark-active-border, $bar-dark-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n\n// Header at top\n.bar-header {\n  top: 0;\n  border-top-width: 0;\n  border-bottom-width: 1px;\n  &.has-tabs-top{\n    border-bottom-width: 0px;\n  }\n}\n\n// Footer at bottom\n.bar-footer {\n  bottom: 0;\n  border-top-width: 1px;\n  border-bottom-width: 0;\n  background-position: top;\n\n  &.item-input-inset {\n    position: absolute;\n  }\n}\n\n// Don't render padding if the bar is just for tabs\n.bar-tabs {\n  padding: 0;\n}\n\n.bar-subheader {\n  top: $bar-height;\n  display: block;\n}\n.bar-subfooter {\n  bottom: $bar-height;\n  display: block;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_button-bar.scss",
    "content": "\n/**\n * Button Bar\n * --------------------------------------------------\n */\n\n.button-bar {\n  @include display-flex();\n  @include flex(1);\n  width: 100%;\n\n  &.button-bar-inline {\n    display: block;\n    width: auto;\n\n    @include clearfix();\n\n    > .button {\n      width: auto;\n      display: inline-block;\n      float: left;\n    }\n  }\n}\n\n.button-bar > .button {\n  @include flex(1);\n  display: block;\n  \n  overflow: hidden;\n\n  padding: 0 16px;\n\n  width: 0;\n\n  border-width: 1px 0px 1px 1px;\n  border-radius: 0;\n  text-align: center;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n\n  &:before,\n  .icon:before {\n    line-height: 44px;\n  }\n\n  &:first-child {\n    border-radius: 2px 0px 0px 2px;\n  }\n  &:last-child {\n    border-right-width: 1px;\n    border-radius: 0px 2px 2px 0px;\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_button.scss",
    "content": "\n/**\n * Buttons\n * --------------------------------------------------\n */\n\n.button {\n  // set the color defaults\n  @include button-style($button-default-bg, $button-default-border, $button-default-active-bg, $button-default-active-border, $button-default-text);\n\n  position: relative;\n  display: inline-block;\n  margin: 0;\n  padding: 0 $button-padding;\n\n  min-width: ($button-padding * 3) + $button-font-size;\n  min-height: $button-height + 5px;\n\n  border-width: $button-border-width;\n  border-style: solid;\n  border-radius: $button-border-radius;\n\n  vertical-align: top;\n  text-align: center;\n\n  text-overflow: ellipsis;\n  font-size: $button-font-size;\n  line-height: $button-height - $button-border-width + 1px;\n\n  cursor: pointer;\n\n  &:after {\n    // used to create a larger button \"hit\" area\n    position: absolute;\n    top: -6px;\n    right: -6px;\n    bottom: -6px;\n    left: -6px;\n    content: ' ';\n  }\n\n  .icon {\n    vertical-align: top;\n    pointer-events: none;\n  }\n\n  .icon:before,\n  &.icon:before,\n  &.icon-left:before,\n  &.icon-right:before {\n    display: inline-block;\n    padding: 0 0 $button-border-width 0;\n    vertical-align: inherit;\n    font-size: $button-icon-size;\n    line-height: $button-height - $button-border-width;\n    pointer-events: none;\n  }\n  &.icon-left:before {\n    float: left;\n    padding-right: .2em;\n    padding-left: 0;\n  }\n  &.icon-right:before {\n    float: right;\n    padding-right: 0;\n    padding-left: .2em;\n  }\n\n  &.button-block, &.button-full {\n    margin-top: $button-block-margin;\n    margin-bottom: $button-block-margin;\n  }\n\n  &.button-light {\n    @include button-style($button-light-bg, $button-light-border, $button-light-active-bg, $button-light-active-border, $button-light-text);\n    @include button-clear($button-light-border);\n    @include button-outline($button-light-border);\n  }\n\n  &.button-stable {\n    @include button-style($button-stable-bg, $button-stable-border, $button-stable-active-bg, $button-stable-active-border, $button-stable-text);\n    @include button-clear($button-stable-border);\n    @include button-outline($button-stable-border);\n  }\n\n  &.button-positive {\n    @include button-style($button-positive-bg, $button-positive-border, $button-positive-active-bg, $button-positive-active-border, $button-positive-text);\n    @include button-clear($button-positive-bg);\n    @include button-outline($button-positive-bg);\n  }\n\n  &.button-calm {\n    @include button-style($button-calm-bg, $button-calm-border, $button-calm-active-bg, $button-calm-active-border, $button-calm-text);\n    @include button-clear($button-calm-bg);\n    @include button-outline($button-calm-bg);\n  }\n\n  &.button-assertive {\n    @include button-style($button-assertive-bg, $button-assertive-border, $button-assertive-active-bg, $button-assertive-active-border, $button-assertive-text);\n    @include button-clear($button-assertive-bg);\n    @include button-outline($button-assertive-bg);\n  }\n\n  &.button-balanced {\n    @include button-style($button-balanced-bg, $button-balanced-border, $button-balanced-active-bg, $button-balanced-active-border, $button-balanced-text);\n    @include button-clear($button-balanced-bg);\n    @include button-outline($button-balanced-bg);\n  }\n\n  &.button-energized {\n    @include button-style($button-energized-bg, $button-energized-border, $button-energized-active-bg, $button-energized-active-border, $button-energized-text);\n    @include button-clear($button-energized-bg);\n    @include button-outline($button-energized-bg);\n  }\n\n  &.button-royal {\n    @include button-style($button-royal-bg, $button-royal-border, $button-royal-active-bg, $button-royal-active-border, $button-royal-text);\n    @include button-clear($button-royal-bg);\n    @include button-outline($button-royal-bg);\n  }\n\n  &.button-dark {\n    @include button-style($button-dark-bg, $button-dark-border, $button-dark-active-bg, $button-dark-active-border, $button-dark-text);\n    @include button-clear($button-dark-bg);\n    @include button-outline($button-dark-bg);\n  }\n}\n\n.button-small {\n  padding: 2px $button-small-padding 1px;\n  min-width: $button-small-height;\n  min-height: $button-small-height + 2;\n  font-size: $button-small-font-size;\n  line-height: $button-small-height - $button-border-width - 1;\n\n  .icon:before,\n  &.icon:before,\n  &.icon-left:before,\n  &.icon-right:before {\n    font-size: $button-small-icon-size;\n    line-height: $button-small-icon-size + 3;\n    margin-top: 3px;\n  }\n}\n\n.button-large {\n  padding: 0 $button-large-padding;\n  min-width: ($button-large-padding * 3) + $button-large-font-size;\n  min-height: $button-large-height + 5;\n  font-size: $button-large-font-size;\n  line-height: $button-large-height - $button-border-width;\n\n  .icon:before,\n  &.icon:before,\n  &.icon-left:before,\n  &.icon-right:before {\n    padding-bottom: ($button-border-width * 2);\n    font-size: $button-large-icon-size;\n    line-height: $button-large-height - ($button-border-width * 2) - 1;\n  }\n}\n\n.button-icon {\n  @include transition(opacity .1s);\n  padding: 0 6px;\n  min-width: initial;\n  border-color: transparent;\n  background: none;\n\n  &.button.active,\n  &.button.activated {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    opacity: 0.3;\n  }\n\n  .icon:before,\n  &.icon:before {\n    font-size: $button-large-icon-size;\n  }\n}\n\n.button-clear {\n  @include button-clear($button-default-border);\n  @include transition(opacity .1s);\n  padding: 0 $button-clear-padding;\n  max-height: $button-height;\n  border-color: transparent;\n  background: none;\n  box-shadow: none;\n\n  &.active,\n  &.activated {\n    opacity: 0.3;\n  }\n}\n\n.button-outline {\n  @include button-outline($button-default-border);\n  @include transition(opacity .1s);\n  background: none;\n  box-shadow: none;\n}\n\n.padding > .button.button-block:first-child {\n  margin-top: 0;\n}\n\n.button-block {\n  display: block;\n  clear: both;\n\n  &:after {\n    clear: both;\n  }\n}\n\n.button-full,\n.button-full > .button {\n  display: block;\n  margin-right: 0;\n  margin-left: 0;\n  border-right-width: 0;\n  border-left-width: 0;\n  border-radius: 0;\n}\n\nbutton.button-block,\nbutton.button-full,\n.button-full > button.button,\ninput.button.button-block  {\n  width: 100%;\n}\n\na.button {\n  text-decoration: none;\n\n  .icon:before,\n  &.icon:before,\n  &.icon-left:before,\n  &.icon-right:before {\n    margin-top: 2px;\n  }\n}\n\n.button.disabled,\n.button[disabled] {\n  opacity: .4;\n  cursor: default !important;\n  pointer-events: none;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_checkbox.scss",
    "content": "\n/**\n * Checkbox\n * --------------------------------------------------\n */\n\n.checkbox {\n  // set the color defaults\n  @include checkbox-style($checkbox-off-border-default, $checkbox-on-bg-default);\n\n  position: relative;\n  display: inline-block;\n  padding: ($checkbox-height / 4) ($checkbox-width / 4);\n  cursor: pointer;\n}\n.checkbox-light  {\n  @include checkbox-style($checkbox-off-border-light, $checkbox-on-bg-light);\n}\n.checkbox-stable  {\n  @include checkbox-style($checkbox-off-border-stable, $checkbox-on-bg-stable);\n}\n.checkbox-positive  {\n  @include checkbox-style($checkbox-off-border-positive, $checkbox-on-bg-positive);\n}\n.checkbox-calm  {\n  @include checkbox-style($checkbox-off-border-calm, $checkbox-on-bg-calm);\n}\n.checkbox-assertive  {\n  @include checkbox-style($checkbox-off-border-assertive, $checkbox-on-bg-assertive);\n}\n.checkbox-balanced  {\n  @include checkbox-style($checkbox-off-border-balanced, $checkbox-on-bg-balanced);\n}\n.checkbox-energized{\n  @include checkbox-style($checkbox-off-border-energized, $checkbox-on-bg-energized);\n}\n.checkbox-royal  {\n  @include checkbox-style($checkbox-off-border-royal, $checkbox-on-bg-royal);\n}\n.checkbox-dark  {\n  @include checkbox-style($checkbox-off-border-dark, $checkbox-on-bg-dark);\n}\n\n.checkbox input:disabled:before,\n.checkbox input:disabled + .checkbox-icon:before {\n  border-color: $checkbox-off-border-light;\n}\n\n.checkbox input:disabled:checked:before,\n.checkbox input:disabled:checked + .checkbox-icon:before {\n  background: $checkbox-on-bg-light;\n}\n\n\n.checkbox.checkbox-input-hidden input {\n  display: none !important;\n}\n\n.checkbox input,\n.checkbox-icon {\n  position: relative;\n  width: $checkbox-width;\n  height: $checkbox-height;\n  display: block;\n  border: 0;\n  background: transparent;\n  cursor: pointer;\n  -webkit-appearance: none;\n\n  &:before {\n    // what the checkbox looks like when its not checked\n    display: table;\n    width: 100%;\n    height: 100%;\n    border-width: $checkbox-border-width;\n    border-style: solid;\n    border-radius: $checkbox-border-radius;\n    background: $checkbox-off-bg-color;\n    content: ' ';\n    transition: background-color 20ms ease-in-out;\n  }\n}\n\n.checkbox input:checked:before,\ninput:checked + .checkbox-icon:before {\n  border-width: $checkbox-border-width + 1;\n}\n\n// the checkmark within the box\n.checkbox input:after,\n.checkbox-icon:after {\n  @include transition(opacity .05s ease-in-out);\n  @include rotate(-45deg);\n  position: absolute;\n  top: 30%;\n  left: 26%;\n  display: table;\n  width: ($checkbox-width / 2) + 1;\n  height: ($checkbox-width / 3) + 1;\n  border: $checkbox-check-width solid $checkbox-check-color;\n  border-top: 0;\n  border-right: 0;\n  content: ' ';\n  opacity: 0;\n}\n\n.grade-c .checkbox input:after,\n.grade-c .checkbox-icon:after {\n  @include rotate(0);\n  top: 3px;\n  left: 4px;\n  border: none;\n  color: $checkbox-check-color;\n  content: '\\2713';\n  font-weight: bold;\n  font-size: 20px;\n}\n\n// what the checkmark looks like when its checked\n.checkbox input:checked:after,\ninput:checked + .checkbox-icon:after {\n  opacity: 1;\n}\n\n// make sure item content have enough padding on left to fit the checkbox\n.item-checkbox {\n  padding-left: ($item-padding * 2) + $checkbox-width;\n\n  &.active {\n    box-shadow: none;\n  }\n}\n\n// position the checkbox to the left within an item\n.item-checkbox .checkbox {\n  position: absolute;\n  top: 50%;\n  right: $item-padding / 2;\n  left: $item-padding / 2;\n  z-index: $z-index-item-checkbox;\n  margin-top: (($checkbox-height + ($checkbox-height / 2)) / 2) * -1;\n}\n\n\n.item-checkbox.item-checkbox-right {\n  padding-right: ($item-padding * 2) + $checkbox-width;\n  padding-left: $item-padding;\n}\n\n.item-checkbox-right .checkbox input,\n.item-checkbox-right .checkbox-icon {\n  float: right;\n}"
  },
  {
    "path": "www/lib/ionic/scss/_form.scss",
    "content": "/**\n * Forms\n * --------------------------------------------------\n */\n\n// Make all forms have space below them\nform {\n  margin: 0 0 $line-height-base;\n}\n\n// Groups of fields with labels on top (legends)\nlegend {\n  display: block;\n  margin-bottom: $line-height-base;\n  padding: 0;\n  width: 100%;\n  border: $input-border-width solid $input-border;\n  color: $dark;\n  font-size: $font-size-base * 1.5;\n  line-height: $line-height-base * 2;\n\n  small {\n    color: $stable;\n    font-size: $line-height-base * .75;\n  }\n}\n\n// Set font for forms\nlabel,\ninput,\nbutton,\nselect,\ntextarea {\n  @include font-shorthand($font-size-base, normal, $line-height-base); // Set size, weight, line-height here\n}\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: $font-family-base; // And only set font-family here for those that need it (note the missing label element)\n}\n\n\n// Input List\n// -------------------------------\n\n.item-input {\n  @include display-flex();\n  @include align-items(center);\n  position: relative;\n  overflow: hidden;\n  padding: 6px 0 5px 16px;\n\n  input {\n    @include border-radius(0);\n    @include flex(1, 0, 220px);\n    @include appearance(none);\n    margin: 0;\n    padding-right: 24px;\n    background-color: transparent;\n  }\n\n  .button .icon {\n    @include flex(0, 0, 24px);\n    position: static;\n    display: inline-block;\n    height: auto;\n    text-align: center;\n    font-size: 16px;\n  }\n\n  .button-bar {\n    @include border-radius(0);\n    @include flex(1, 0, 220px);\n    @include appearance(none);\n  }\n\n  .icon {\n    min-width: 14px;\n  }\n}\n\n.item-input-inset {\n  @include display-flex();\n  @include align-items(center);\n  position: relative;\n  overflow: hidden;\n  padding: ($item-padding / 3) * 2;\n}\n\n.item-input-wrapper {\n  @include display-flex();\n  @include flex(1, 0);\n  @include align-items(center);\n  @include border-radius(4px);\n  padding-right: 8px;\n  padding-left: 8px;\n  background: #eee;\n}\n\n.item-input-inset .item-input-wrapper input {\n  padding-left: 4px;\n  height: 29px;\n  background: transparent;\n  line-height: 18px;\n}\n\n.item-input-wrapper ~ .button {\n  margin-left: ($item-padding / 3) * 2;\n}\n\n.input-label {\n  @include flex(1, 0, 100px);\n  display: table;\n  padding: 7px 10px 7px 0px;\n  max-width: 200px;\n  width: 35%;\n  color: $input-label-color;\n  font-size: 16px;\n}\n\n.placeholder-icon {\n  color: #aaa;\n  &:first-child {\n    padding-right: 6px;\n  }\n  &:last-child {\n    padding-left: 6px;\n  }\n}\n\n.item-stacked-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none;\n\n  .input-label, .icon {\n    display: inline-block;\n    padding: 4px 0 0 0px;\n    vertical-align: middle;\n  }\n}\n\n.item-stacked-label input,\n.item-stacked-label textarea {\n  @include border-radius(2px);\n  padding: 4px 8px 3px 0;\n  border: none;\n  background-color: $input-bg;\n}\n.item-stacked-label input {\n  overflow: hidden;\n  height: $line-height-computed + $font-size-base + 12px;\n}\n\n.item-floating-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none;\n\n  .input-label {\n    position: relative;\n    padding: 5px 0 0 0;\n    opacity: 0;\n    top: 10px;\n    @include transition(opacity .15s ease-in, top .2s linear);\n\n    &.has-input {\n      opacity: 1;\n      top: 0;\n      @include transition(opacity .15s ease-in, top .2s linear);\n    }\n  }\n}\n\n\n// Form Controls\n// -------------------------------\n\n// Shared size and type resets\ntextarea,\ninput[type=\"text\"],\ninput[type=\"password\"],\ninput[type=\"datetime\"],\ninput[type=\"datetime-local\"],\ninput[type=\"date\"],\ninput[type=\"month\"],\ninput[type=\"time\"],\ninput[type=\"week\"],\ninput[type=\"number\"],\ninput[type=\"email\"],\ninput[type=\"url\"],\ninput[type=\"search\"],\ninput[type=\"tel\"],\ninput[type=\"color\"] {\n  display: block;\n  padding-top: 2px;\n  padding-left: 0;\n  height: $line-height-computed + $font-size-base;\n  color: $input-color;\n  vertical-align: middle;\n  font-size: $font-size-base;\n  line-height: $font-size-base + 2;\n}\n\n.platform-ios,\n.platform-android {\n  input[type=\"datetime-local\"],\n  input[type=\"date\"],\n  input[type=\"month\"],\n  input[type=\"time\"],\n  input[type=\"week\"] {\n    padding-top: 8px;\n  }\n}\n\ninput,\ntextarea {\n  width: 100%;\n}\ntextarea {\n  padding-left: 0;\n  @include placeholder($input-color-placeholder, -3px);\n}\n\n// Reset height since textareas have rows\ntextarea {\n  height: auto;\n}\n\n// Everything else\ntextarea,\ninput[type=\"text\"],\ninput[type=\"password\"],\ninput[type=\"datetime\"],\ninput[type=\"datetime-local\"],\ninput[type=\"date\"],\ninput[type=\"month\"],\ninput[type=\"time\"],\ninput[type=\"week\"],\ninput[type=\"number\"],\ninput[type=\"email\"],\ninput[type=\"url\"],\ninput[type=\"search\"],\ninput[type=\"tel\"],\ninput[type=\"color\"] {\n  border: 0;\n}\n\n// Position radios and checkboxes better\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 0;\n  line-height: normal;\n}\n\n// Reset width of input images, buttons, radios, checkboxes\ninput[type=\"file\"],\ninput[type=\"image\"],\ninput[type=\"submit\"],\ninput[type=\"reset\"],\ninput[type=\"button\"],\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  width: auto; // Override of generic input selector\n}\n\n// Set the height of file to match text inputs\ninput[type=\"file\"] {\n  line-height: $input-height-base;\n}\n\n// Text input classes to hide text caret during scroll\n.previous-input-focus,\n.cloned-text-input + input,\n.cloned-text-input + textarea {\n  position: absolute !important;\n  left: -9999px;\n  width: 200px;\n}\n\n\n// Placeholder\n// -------------------------------\ninput,\ntextarea {\n  @include placeholder();\n}\n\n\n// DISABLED STATE\n// -------------------------------\n\n// Disabled and read-only inputs\ninput[disabled],\nselect[disabled],\ntextarea[disabled],\ninput[readonly]:not(.cloned-text-input),\ntextarea[readonly]:not(.cloned-text-input),\nselect[readonly] {\n  background-color: $input-bg-disabled;\n  cursor: not-allowed;\n}\n// Explicitly reset the colors here\ninput[type=\"radio\"][disabled],\ninput[type=\"checkbox\"][disabled],\ninput[type=\"radio\"][readonly],\ninput[type=\"checkbox\"][readonly] {\n  background-color: transparent;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_grid.scss",
    "content": "/**\n * Grid\n * --------------------------------------------------\n * Using flexbox for the grid, inspired by Philip Walton:\n * http://philipwalton.github.io/solved-by-flexbox/demos/grids/\n * By default each .col within a .row will evenly take up\n * available width, and the height of each .col with take\n * up the height of the tallest .col in the same .row.\n */\n\n.row {\n  @include display-flex();\n  padding: ($grid-padding-width / 2);\n  width: 100%;\n}\n\n.row-wrap {\n  @include flex-wrap(wrap);\n}\n\n.row + .row {\n  margin-top: ($grid-padding-width / 2) * -1;\n  padding-top: 0;\n}\n\n.col {\n  @include flex(1);\n  display: block;\n  padding: ($grid-padding-width / 2);\n  width: 100%;\n}\n\n\n/* Vertically Align Columns */\n/* .row-* vertically aligns every .col in the .row */\n.row-top {\n  @include align-items(flex-start);\n}\n.row-bottom {\n  @include align-items(flex-end);\n}\n.row-center {\n  @include align-items(center);\n}\n.row-stretch {\n  @include align-items(stretch);\n}\n.row-baseline {\n  @include align-items(baseline);\n}\n\n/* .col-* vertically aligns an individual .col */\n.col-top {\n  @include align-self(flex-start);\n}\n.col-bottom {\n  @include align-self(flex-end);\n}\n.col-center {\n  @include align-self(center);\n}\n\n/* Column Offsets */\n.col-offset-10 {\n  margin-left: 10%;\n}\n.col-offset-20 {\n  margin-left: 20%;\n}\n.col-offset-25 {\n  margin-left: 25%;\n}\n.col-offset-33, .col-offset-34 {\n  margin-left: 33.3333%;\n}\n.col-offset-50 {\n  margin-left: 50%;\n}\n.col-offset-66, .col-offset-67 {\n  margin-left: 66.6666%;\n}\n.col-offset-75 {\n  margin-left: 75%;\n}\n.col-offset-80 {\n  margin-left: 80%;\n}\n.col-offset-90 {\n  margin-left: 90%;\n}\n\n\n/* Explicit Column Percent Sizes */\n/* By default each grid column will evenly distribute */\n/* across the grid. However, you can specify individual */\n/* columns to take up a certain size of the available area */\n.col-10 {\n  @include flex(0, 0, 10%);\n  max-width: 10%;\n}\n.col-20 {\n  @include flex(0, 0, 20%);\n  max-width: 20%;\n}\n.col-25 {\n  @include flex(0, 0, 25%);\n  max-width: 25%;\n}\n.col-33, .col-34 {\n  @include flex(0, 0, 33.3333%);\n  max-width: 33.3333%;\n}\n.col-50 {\n  @include flex(0, 0, 50%);\n  max-width: 50%;\n}\n.col-66, .col-67 {\n  @include flex(0, 0, 66.6666%);\n  max-width: 66.6666%;\n}\n.col-75 {\n  @include flex(0, 0, 75%);\n  max-width: 75%;\n}\n.col-80 {\n  @include flex(0, 0, 80%);\n  max-width: 80%;\n}\n.col-90 {\n  @include flex(0, 0, 90%);\n  max-width: 90%;\n}\n\n\n/* Responsive Grid Classes */\n/* Adding a class of responsive-X to a row */\n/* will trigger the flex-direction to */\n/* change to column and add some margin */\n/* to any columns in the row for clearity */\n\n@include responsive-grid-break('.responsive-sm', $grid-responsive-sm-break);\n@include responsive-grid-break('.responsive-md', $grid-responsive-md-break);\n@include responsive-grid-break('.responsive-lg', $grid-responsive-lg-break);\n"
  },
  {
    "path": "www/lib/ionic/scss/_items.scss",
    "content": "/**\n * Items\n * --------------------------------------------------\n */\n\n.item {\n  @include item-style($item-default-bg, $item-default-border, $item-default-text);\n\n  position: relative;\n  z-index: $z-index-item; // Make sure the borders and stuff don't get hidden by children\n  display: block;\n\n  margin: $item-border-width * -1;\n  padding: $item-padding;\n\n  border-width: $item-border-width;\n  border-style: solid;\n  font-size: $item-font-size;\n\n  h2 {\n    margin: 0 0 4px 0;\n    font-size: 16px;\n  }\n  h3 {\n    margin: 0 0 4px 0;\n    font-size: 14px;\n  }\n  h4 {\n    margin: 0 0 4px 0;\n    font-size: 12px;\n  }\n  h5, h6 {\n    margin: 0 0 3px 0;\n    font-size: 10px;\n  }\n  p {\n    color: #666;\n    font-size: 14px;\n  }\n\n  h1:last-child,\n  h2:last-child,\n  h3:last-child,\n  h4:last-child,\n  h5:last-child,\n  h6:last-child,\n  p:last-child {\n    margin-bottom: 0;\n  }\n\n  // Align badges within items\n  .badge {\n    @include display-flex();\n    position: absolute;\n    top: $item-padding;\n    right: ($item-padding * 2);\n  }\n  &.item-button-right .badge {\n    right: ($item-padding * 2) + 35;\n  }\n  &.item-divider .badge {\n    top: ceil($item-padding / 2);\n  }\n  .badge + .badge {\n    margin-right: 5px;\n  }\n\n  // Different themes for items\n  &.item-light {\n    @include item-style($item-light-bg, $item-light-border, $item-light-text);\n  }\n  &.item-stable {\n    @include item-style($item-stable-bg, $item-stable-border, $item-stable-text);\n  }\n  &.item-positive {\n    @include item-style($item-positive-bg, $item-positive-border, $item-positive-text);\n  }\n  &.item-calm {\n    @include item-style($item-calm-bg, $item-calm-border, $item-calm-text);\n  }\n  &.item-assertive {\n    @include item-style($item-assertive-bg, $item-assertive-border, $item-assertive-text);\n  }\n  &.item-balanced {\n    @include item-style($item-balanced-bg, $item-balanced-border, $item-balanced-text);\n  }\n  &.item-energized {\n    @include item-style($item-energized-bg, $item-energized-border, $item-energized-text);\n  }\n  &.item-royal {\n    @include item-style($item-royal-bg, $item-royal-border, $item-royal-text);\n  }\n  &.item-dark {\n    @include item-style($item-dark-bg, $item-dark-border, $item-dark-text);\n  }\n\n  &[ng-click]:hover {\n    cursor: pointer;\n  }\n\n}\n\n// Link and Button Active States\n.item.active,\n.item.activated,\n.item-complex.active .item-content,\n.item-complex.activated .item-content,\n.item .item-content.active,\n.item .item-content.activated {\n  @include item-active-style($item-default-active-bg, $item-default-active-border);\n\n  // Different active themes for <a> and <button> items\n  &.item-light {\n    @include item-active-style($item-light-active-bg, $item-light-active-border);\n  }\n  &.item-stable {\n    @include item-active-style($item-stable-active-bg, $item-stable-active-border);\n  }\n  &.item-positive {\n    @include item-active-style($item-positive-active-bg, $item-positive-active-border);\n  }\n  &.item-calm {\n    @include item-active-style($item-calm-active-bg, $item-calm-active-border);\n  }\n  &.item-assertive {\n    @include item-active-style($item-assertive-active-bg, $item-assertive-active-border);\n  }\n  &.item-balanced {\n    @include item-active-style($item-balanced-active-bg, $item-balanced-active-border);\n  }\n  &.item-energized {\n    @include item-active-style($item-energized-active-bg, $item-energized-active-border);\n  }\n  &.item-royal {\n    @include item-active-style($item-royal-active-bg, $item-royal-active-border);\n  }\n  &.item-dark {\n    @include item-active-style($item-dark-active-bg, $item-dark-active-border);\n  }\n}\n\n// Handle text overflow\n.item,\n.item h1,\n.item h2,\n.item h3,\n.item h4,\n.item h5,\n.item h6,\n.item p,\n.item-content,\n.item-content h1,\n.item-content h2,\n.item-content h3,\n.item-content h4,\n.item-content h5,\n.item-content h6,\n.item-content p {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n// Linked list items\na.item {\n  color: inherit;\n  text-decoration: none;\n\n  &:hover,\n  &:focus {\n    text-decoration: none;\n  }\n}\n\n\n/**\n * Complex Items\n * --------------------------------------------------\n * Adding .item-complex allows the .item to be slidable and\n * have options underneath the button, but also requires an\n * additional .item-content element inside .item.\n * Basically .item-complex removes any default settings which\n * .item added, so that .item-content looks them as just .item.\n */\n\n.item-complex,\na.item.item-complex,\nbutton.item.item-complex {\n  padding: 0;\n}\n.item-complex .item-content,\n.item-radio .item-content {\n  position: relative;\n  z-index: $z-index-item;\n  padding: $item-padding (ceil( ($item-padding * 3) + ($item-padding / 3) ) - 5) $item-padding $item-padding;\n  border: none;\n  background-color: white;\n}\n\na.item-content {\n  display: block;\n  color: inherit;\n  text-decoration: none;\n}\n\n.item-text-wrap .item,\n.item-text-wrap .item-content,\n.item-text-wrap,\n.item-text-wrap h1,\n.item-text-wrap h2,\n.item-text-wrap h3,\n.item-text-wrap h4,\n.item-text-wrap h5,\n.item-text-wrap h6,\n.item-text-wrap p,\n.item-complex.item-text-wrap .item-content,\n.item-body h1,\n.item-body h2,\n.item-body h3,\n.item-body h4,\n.item-body h5,\n.item-body h6,\n.item-body p {\n  overflow: visible;\n  white-space: normal;\n}\n.item-complex.item-text-wrap,\n.item-complex.item-text-wrap h1,\n.item-complex.item-text-wrap h2,\n.item-complex.item-text-wrap h3,\n.item-complex.item-text-wrap h4,\n.item-complex.item-text-wrap h5,\n.item-complex.item-text-wrap h6,\n.item-complex.item-text-wrap p {\n  overflow: visible;\n  white-space: normal;\n}\n\n// Link and Button Active States\n\n.item-complex{\n  // Stylized items\n  &.item-light > .item-content{\n    @include item-style($item-light-bg, $item-light-border, $item-light-text);\n    &.active, &:active {\n      @include item-active-style($item-light-active-bg, $item-light-active-border);\n    }\n  }\n  &.item-stable > .item-content{\n    @include item-style($item-stable-bg, $item-stable-border, $item-stable-text);\n    &.active, &:active {\n      @include item-active-style($item-stable-active-bg, $item-stable-active-border);\n    }\n  }\n  &.item-positive > .item-content{\n    @include item-style($item-positive-bg, $item-positive-border, $item-positive-text);\n    &.active, &:active {\n      @include item-active-style($item-positive-active-bg, $item-positive-active-border);\n    }\n  }\n  &.item-calm > .item-content{\n    @include item-style($item-calm-bg, $item-calm-border, $item-calm-text);\n    &.active, &:active {\n      @include item-active-style($item-calm-active-bg, $item-calm-active-border);\n    }\n  }\n  &.item-assertive > .item-content{\n    @include item-style($item-assertive-bg, $item-assertive-border, $item-assertive-text);\n    &.active, &:active {\n      @include item-active-style($item-assertive-active-bg, $item-assertive-active-border);\n    }\n  }\n  &.item-balanced > .item-content{\n    @include item-style($item-balanced-bg, $item-balanced-border, $item-balanced-text);\n    &.active, &:active {\n      @include item-active-style($item-balanced-active-bg, $item-balanced-active-border);\n    }\n  }\n  &.item-energized > .item-content{\n    @include item-style($item-energized-bg, $item-energized-border, $item-energized-text);\n    &.active, &:active {\n      @include item-active-style($item-energized-active-bg, $item-energized-active-border);\n    }\n  }\n  &.item-royal > .item-content{\n    @include item-style($item-royal-bg, $item-royal-border, $item-royal-text);\n    &.active, &:active {\n      @include item-active-style($item-royal-active-bg, $item-royal-active-border);\n    }\n  }\n  &.item-dark > .item-content{\n    @include item-style($item-dark-bg, $item-dark-border, $item-dark-text);\n    &.active, &:active {\n      @include item-active-style($item-dark-active-bg, $item-dark-active-border);\n    }\n  }\n}\n\n\n/**\n * Item Icons\n * --------------------------------------------------\n */\n\n.item-icon-left .icon,\n.item-icon-right .icon {\n  @include display-flex();\n  @include align-items(center);\n  position: absolute;\n  top: 0;\n  height: 100%;\n  font-size: $item-icon-font-size;\n\n  &:before {\n    display: block;\n    width: $item-icon-font-size;\n    text-align: center;\n  }\n}\n\n.item .fill-icon {\n  min-width: $item-icon-fill-font-size + 2;\n  min-height: $item-icon-fill-font-size + 2;\n  font-size: $item-icon-fill-font-size;\n}\n\n.item-icon-left {\n  padding-left: ceil( ($item-padding * 3) + ($item-padding / 3) );\n\n  .icon {\n    left: ceil( ($item-padding / 3) * 2);\n  }\n}\n.item-complex.item-icon-left {\n  padding-left: 0;\n\n  .item-content {\n    padding-left: ceil( ($item-padding * 3) + ($item-padding / 3) );\n  }\n}\n\n.item-icon-right {\n  padding-right: ceil( ($item-padding * 3) + ($item-padding / 3) );\n\n  .icon {\n    right: ceil( ($item-padding / 3) * 2);\n  }\n}\n.item-complex.item-icon-right {\n  padding-right: 0;\n\n  .item-content {\n    padding-right: ceil( ($item-padding * 3) + ($item-padding / 3) );\n  }\n}\n\n.item-icon-left.item-icon-right .icon:first-child {\n  right: auto;\n}\n.item-icon-left.item-icon-right .icon:last-child,\n.item-icon-left .item-delete .icon {\n  left: auto;\n}\n\n.item-icon-left .icon-accessory,\n.item-icon-right .icon-accessory {\n  color: $item-icon-accessory-color;\n  font-size: $item-icon-accessory-font-size;\n}\n.item-icon-left .icon-accessory {\n  left: floor($item-padding / 5);\n}\n.item-icon-right .icon-accessory {\n  right: floor($item-padding / 5);\n}\n\n\n/**\n * Item Button\n * --------------------------------------------------\n * An item button is a child button inside an .item (not the entire .item)\n */\n\n.item-button-left {\n  padding-left: ceil($item-padding * 4.5);\n}\n\n.item-button-left > .button,\n.item-button-left .item-content > .button {\n  @include display-flex();\n  @include align-items(center);\n  position: absolute;\n  top: ceil($item-padding / 2);\n  left: ceil( ($item-padding / 3) * 2);\n  min-width: $item-icon-font-size + ($button-border-width * 2);\n  min-height: $item-icon-font-size + ($button-border-width * 2);\n  font-size: $item-button-font-size;\n  line-height: $item-button-line-height;\n\n  .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: $item-icon-font-size - 1;\n  }\n\n  > .button {\n    margin: 0px 2px;\n    min-height: $item-icon-font-size + ($button-border-width * 2);\n    font-size: $item-button-font-size;\n    line-height: $item-button-line-height;\n  }\n}\n\n.item-button-right,\na.item.item-button-right,\nbutton.item.item-button-right {\n  padding-right: $item-padding * 5;\n}\n\n.item-button-right > .button,\n.item-button-right .item-content > .button,\n.item-button-right > .buttons,\n.item-button-right .item-content > .buttons {\n  @include display-flex();\n  @include align-items(center);\n  position: absolute;\n  top: ceil($item-padding / 2);\n  right: $item-padding;\n  min-width: $item-icon-font-size + ($button-border-width * 2);\n  min-height: $item-icon-font-size + ($button-border-width * 2);\n  font-size: $item-button-font-size;\n  line-height: $item-button-line-height;\n\n  .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: $item-icon-font-size - 1;\n  }\n\n  > .button {\n    margin: 0px 2px;\n    min-width: $item-icon-font-size + ($button-border-width * 2);\n    min-height: $item-icon-font-size + ($button-border-width * 2);\n    font-size: $item-button-font-size;\n    line-height: $item-button-line-height;\n  }\n}\n\n\n// Item Avatar\n// -------------------------------\n\n.item-avatar,\n.item-avatar .item-content,\n.item-avatar-left,\n.item-avatar-left .item-content {\n  padding-left: $item-avatar-width + ($item-padding * 2);\n  min-height: $item-avatar-width + ($item-padding * 2);\n\n  > img:first-child,\n  .item-image {\n    position: absolute;\n    top: $item-padding;\n    left: $item-padding;\n    max-width: $item-avatar-width;\n    max-height: $item-avatar-height;\n    width: 100%;\n    border-radius: $item-avatar-border-radius;\n  }\n}\n\n.item-avatar-right,\n.item-avatar-right .item-content {\n  padding-right: $item-avatar-width + ($item-padding * 2);\n  min-height: $item-avatar-width + ($item-padding * 2);\n\n  > img:first-child,\n  .item-image {\n    position: absolute;\n    top: $item-padding;\n    right: $item-padding;\n    max-width: $item-avatar-width;\n    max-height: $item-avatar-height;\n    width: 100%;\n    border-radius: $item-avatar-border-radius;\n  }\n}\n\n\n// Item Thumbnails\n// -------------------------------\n\n.item-thumbnail-left,\n.item-thumbnail-left .item-content {\n  padding-left: $item-thumbnail-width + $item-thumbnail-margin + $item-padding;\n  min-height: $item-thumbnail-height + ($item-thumbnail-margin * 2);\n\n  > img:first-child,\n  .item-image {\n    position: absolute;\n    top: $item-thumbnail-margin;\n    left: $item-thumbnail-margin;\n    max-width: $item-thumbnail-width;\n    max-height: $item-thumbnail-height;\n    width: 100%;\n  }\n}\n.item-avatar.item-complex,\n.item-avatar-left.item-complex,\n.item-thumbnail-left.item-complex {\n  padding-left: 0;\n}\n\n.item-thumbnail-right,\n.item-thumbnail-right .item-content {\n  padding-right: $item-thumbnail-width + $item-thumbnail-margin + $item-padding;\n  min-height: $item-thumbnail-height + ($item-thumbnail-margin * 2);\n\n  > img:first-child,\n  .item-image {\n    position: absolute;\n    top: $item-thumbnail-margin;\n    right: $item-thumbnail-margin;\n    max-width: $item-thumbnail-width;\n    max-height: $item-thumbnail-height;\n    width: 100%;\n  }\n}\n.item-avatar-right.item-complex,\n.item-thumbnail-right.item-complex {\n  padding-right: 0;\n}\n\n\n// Item Image\n// -------------------------------\n\n.item-image {\n  padding: 0;\n  text-align: center;\n\n  img:first-child, .list-img {\n    width: 100%;\n    vertical-align: middle;\n  }\n}\n\n\n// Item Body\n// -------------------------------\n\n.item-body {\n  overflow: auto;\n  padding: $item-padding;\n  text-overflow: inherit;\n  white-space: normal;\n\n  h1, h2, h3, h4, h5, h6, p {\n    margin-top: $item-padding;\n    margin-bottom: $item-padding;\n  }\n}\n\n\n// Item Divider\n// -------------------------------\n\n.item-divider {\n  padding-top: ceil($item-padding / 2);\n  padding-bottom: ceil($item-padding / 2);\n  min-height: 30px;\n  background-color: $item-divider-bg;\n  color: $item-divider-color;\n  font-weight: bold;\n}\n\n\n// Item Note\n// -------------------------------\n\n.item-note {\n  float: right;\n  color: #aaa;\n  font-size: 14px;\n}\n\n\n// Item Editing\n// -------------------------------\n\n.item-left-editable .item-content,\n.item-right-editable .item-content {\n  // setup standard transition settings\n  @include transition-duration( $item-edit-transition-duration );\n  @include transition-timing-function( $item-edit-transition-function );\n  -webkit-transition-property: -webkit-transform;\n     -moz-transition-property: -moz-transform;\n          transition-property: transform;\n}\n\n.list-left-editing .item-left-editable .item-content,\n.item-left-editing.item-left-editable .item-content {\n  // actively editing the left side of the item\n  @include translate3d($item-left-edit-open-width, 0, 0);\n}\n\n.list-right-editing .item-right-editable .item-content,\n.item-right-editing.item-right-editable .item-content {\n  // actively editing the left side of the item\n  @include translate3d(-$item-right-edit-open-width, 0, 0);\n}\n\n\n// Item Left Edit Button\n// -------------------------------\n\n.item-left-edit {\n  @include transition(all $item-edit-transition-function $item-edit-transition-duration / 2);\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: $z-index-item-edit;\n  width: $item-left-edit-open-width;\n  height: 100%;\n  line-height: 100%;\n\n  .button {\n    height: 100%;\n\n    &.icon {\n      @include display-flex();\n      @include align-items(center);\n      position: absolute;\n      top: 0;\n      height: 100%;\n    }\n  }\n\n  display: none;\n  opacity: 0;\n  @include translate3d( ($item-left-edit-left - $item-left-edit-open-width) / 2, 0, 0);\n  &.visible {\n    display: block;\n    &.active {\n      opacity: 1;\n      @include translate3d($item-left-edit-left, 0, 0);\n    }\n  }\n}\n.list-left-editing .item-left-edit {\n  @include transition-delay($item-edit-transition-duration / 2);\n}\n\n// Item Delete (Left side edit button)\n// -------------------------------\n\n.item-delete .button.icon {\n  color: $item-delete-icon-color;\n  font-size: $item-delete-icon-size;\n\n  &:hover {\n    opacity: .7;\n  }\n}\n\n\n// Item Right Edit Button\n// -------------------------------\n\n.item-right-edit {\n  @include transition(all $item-edit-transition-function $item-edit-transition-duration / 2);\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 0;\n  width: $item-right-edit-open-width *  1.5;\n  height: 100%;\n  background: inherit;\n  padding-left: 20px;\n\n  .button {\n    min-width: $item-right-edit-open-width;\n    height: 100%;\n\n    &.icon {\n      @include display-flex();\n      @include align-items(center);\n      position: absolute;\n      top: 0;\n      height: 100%;\n      font-size: $item-reorder-icon-size;\n    }\n  }\n\n  display: none;\n  opacity: 0;\n  @include translate3d($item-right-edit-open-width / 2, 0, 0);\n  &.visible {\n    display: block;\n    z-index: $z-index-item-reorder;\n    &.active {\n      opacity: 1;\n      @include translate3d(0, 0, 0);\n    }\n  }\n}\n.list-right-editing .item-right-edit {\n  @include transition-delay($item-edit-transition-duration / 2);\n}\n\n\n// Item Reordering (Right side edit button)\n// -------------------------------\n\n.item-reorder .button.icon {\n  color: $item-reorder-icon-color;\n  font-size: $item-reorder-icon-size;\n}\n\n.item-reordering {\n  // item is actively being reordered\n  position: absolute;\n  left: 0;\n  top: 0;\n  z-index: $z-index-item-reordering;\n  width: 100%;\n  box-shadow: 0px 0px 10px 0px #aaa;\n\n  .item-reorder {\n    z-index: 1;\n  }\n}\n\n.item-placeholder {\n  // placeholder for the item that's being reordered\n  opacity: 0.7;\n}\n\n\n/**\n * The hidden right-side buttons that can be exposed under a list item\n * with dragging.\n */\n.item-options {\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: $z-index-item-options;\n  height: 100%;\n\n  .button {\n    height: 100%;\n    border: none;\n    border-radius: 0;\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_list.scss",
    "content": "\n/**\n * Lists\n * --------------------------------------------------\n */\n\n.list {\n  position: relative;\n  padding-top: $item-border-width;\n  padding-bottom: $item-border-width;\n  padding-left: 0; // reset padding because ul and ol\n  margin-bottom: 20px;\n}\n.list:last-child {\n  margin-bottom: 0px;\n  &.card{\n    margin-bottom:40px;\n  }\n}\n\n\n/**\n * List Header\n * --------------------------------------------------\n */\n\n.list-header {\n  margin-top: $list-header-margin-top;\n  padding: $list-header-padding;\n  background-color: $list-header-bg;\n  color: $list-header-color;\n  font-weight: bold;\n}\n\n// when its a card make sure it doesn't duplicate top and bottom borders\n.card.list .list-item {\n  padding-right: 1px;\n  padding-left: 1px;\n}\n\n\n/**\n * Cards and Inset Lists\n * --------------------------------------------------\n * A card and list-inset are close to the same thing, except a card as a box shadow.\n */\n\n.card,\n.list-inset {\n  overflow: hidden;\n  margin: ($content-padding * 2) $content-padding;\n  border-radius: $card-border-radius;\n  background-color: $card-body-bg;\n}\n\n.card {\n  padding-top: $item-border-width;\n  padding-bottom: $item-border-width;\n  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);\n}\n\n.padding {\n  .card, .list-inset {\n    margin-left: 0;\n    margin-right: 0;\n  }\n}\n\n.card .item,\n.list-inset .item,\n.padding > .list .item\n{\n  &:first-child {\n    border-top-left-radius: $card-border-radius;\n    border-top-right-radius: $card-border-radius;\n\n    .item-content {\n      border-top-left-radius: $card-border-radius;\n      border-top-right-radius: $card-border-radius;\n    }\n  }\n  &:last-child {\n    border-bottom-right-radius: $card-border-radius;\n    border-bottom-left-radius: $card-border-radius;\n\n    .item-content {\n      border-bottom-right-radius: $card-border-radius;\n      border-bottom-left-radius: $card-border-radius;\n    }\n  }\n}\n\n.card .item:last-child,\n.list-inset .item:last-child {\n  margin-bottom: $item-border-width * -1;\n}\n\n.card .item,\n.list-inset .item,\n.padding > .list .item,\n.padding-horizontal > .list .item {\n  margin-right: 0;\n  margin-left: 0;\n\n  &.item-input input {\n    padding-right: 44px;\n  }\n}\n.padding-left > .list .item {\n  margin-left: 0;\n}\n.padding-right > .list .item {\n  margin-right: 0;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_loading.scss",
    "content": "\n/**\n * Loading\n * --------------------------------------------------\n */\n\n.loading-container {\n  position: absolute;\n  left: 0;\n  top: 0;\n  right: 0;\n  bottom: 0;\n\n  z-index: $z-index-loading;\n\n  @include display-flex();\n  @include justify-content(center);\n  @include align-items(center);\n\n  @include transition(0.2s opacity linear);\n  visibility: hidden;\n  opacity: 0;\n\n  &.visible {\n    visibility: visible;\n  }\n  &.active {\n    opacity: 1;\n  }\n\n  .loading {\n    padding: $loading-padding;\n\n    border-radius: $loading-border-radius;\n    background-color: $loading-bg-color;\n\n    color: $loading-text-color;\n\n    text-align: center;\n    text-overflow: ellipsis;\n    font-size: $loading-font-size;\n\n    h1, h2, h3, h4, h5, h6 {\n      color: $loading-text-color;\n    }\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_menu.scss",
    "content": "\n/**\n * Menus\n * --------------------------------------------------\n * Side panel structure\n */\n\n.menu {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  z-index: $z-index-menu;\n  overflow: hidden;\n\n  min-height: 100%;\n  max-height: 100%;\n  width: $menu-width;\n\n  background-color: $menu-bg;\n\n  .scroll-content {\n    z-index: $z-index-menu-scroll-content;\n  }\n\n  .bar-header {\n    z-index: $z-index-menu-bar-header;\n  }\n}\n\n.menu-content {\n  @include transform(none);\n  box-shadow: $menu-side-shadow;\n}\n\n.menu-open .menu-content .pane,\n.menu-open .menu-content .scroll-content {\n  pointer-events: none;\n}\n\n.grade-b .menu-content,\n.grade-c .menu-content {\n  @include box-sizing(content-box);\n  right: -1px;\n  left: -1px;\n  border-right: 1px solid #ccc;\n  border-left: 1px solid #ccc;\n  box-shadow: none;\n}\n\n.menu-left {\n  left: 0;\n}\n\n.menu-right {\n  right: 0;\n}\n\n.aside-open.aside-resizing .menu-right {\n  display: none;\n}\n\n.menu-animated {\n  @include transition-transform($menu-animation-speed ease);\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_mixins.scss",
    "content": "\n// Button Mixins\n// --------------------------------------------------\n\n@mixin button-style($bg-color, $border-color, $active-bg-color, $active-border-color, $color) {\n  border-color: $border-color;\n  background-color: $bg-color;\n  color: $color;\n\n  // Give desktop users something to play with\n  &:hover {\n    color: $color;\n    text-decoration: none;\n  }\n  &.active,\n  &.activated {\n    border-color: $active-border-color;\n    background-color: $active-bg-color;\n    box-shadow: inset 0px 1px 3px rgba(0,0,0,0.15);\n  }\n}\n\n@mixin button-clear($color, $font-size:\"\") {\n  &.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: $color;\n\n    @if $font-size != \"\" {\n      font-size: $font-size;\n    }\n  }\n  &.button-icon {\n    border-color: transparent;\n    background: none;\n  }\n}\n\n@mixin button-outline($color, $text-color:\"\") {\n  &.button-outline {\n    border-color: $color;\n    background: transparent;\n    @if $text-color == \"\" {\n      $text-color: $color;\n    }\n    color: $text-color;\n    &.active,\n    &.activated {\n      background-color: $color;\n      box-shadow: none;\n      color: #fff;\n    }\n  }\n}\n\n\n// Bar Mixins\n// --------------------------------------------------\n\n@mixin bar-style($bg-color, $border-color, $color) {\n  border-color: $border-color;\n  background-color: $bg-color;\n  background-image: linear-gradient(0deg, $border-color, $border-color 50%, transparent 50%);\n  color: $color;\n\n  .title {\n    color: $color;\n  }\n}\n\n\n// Tab Mixins\n// --------------------------------------------------\n\n@mixin tab-style($bg-color, $border-color, $color) {\n  border-color: $border-color;\n  background-color: $bg-color;\n  background-image: linear-gradient(0deg, $border-color, $border-color 50%, transparent 50%);\n  color: $color;\n}\n\n@mixin tab-badge-style($bg-color, $color) {\n  .tab-item .badge {\n    background-color: $bg-color;\n    color: $color;\n  }\n}\n\n\n// Item Mixins\n// --------------------------------------------------\n\n@mixin item-style($bg-color, $border-color, $color) {\n  border-color: $border-color;\n  background-color: $bg-color;\n  color: $color;\n}\n\n@mixin item-active-style($active-bg-color, $active-border-color) {\n  border-color: $active-border-color;\n  background-color: $active-bg-color;\n}\n\n\n// Badge Mixins\n// --------------------------------------------------\n\n@mixin badge-style($bg-color, $color) {\n  background-color: $bg-color;\n  color: $color;\n}\n\n\n// Range Mixins\n// --------------------------------------------------\n\n@mixin range-style($track-bg-color) {\n  &::-webkit-slider-thumb:before {\n    background: $track-bg-color;\n  }\n}\n\n\n// Checkbox Mixins\n// --------------------------------------------------\n\n@mixin checkbox-style($off-border-color, $on-bg-color) {\n  & input:before,\n  & .checkbox-icon:before {\n    border-color: $off-border-color;\n  }\n\n  // what the background looks like when its checked\n  & input:checked:before,\n  & input:checked + .checkbox-icon:before {\n    background: $on-bg-color;\n  }\n}\n\n\n// Toggle Mixins\n// --------------------------------------------------\n\n@mixin toggle-style($on-border-color, $on-bg-color) {\n  // the track when the toggle is \"on\"\n  & input:checked + .track {\n    border-color: $on-border-color;\n    background-color: $on-bg-color;\n  }\n}\n\n\n// Clearfix\n// --------------------------------------------------\n\n@mixin clearfix {\n  *zoom: 1;\n  &:before,\n  &:after {\n    display: table;\n    content: \"\";\n    line-height: 0;\n  }\n  &:after {\n    clear: both;\n  }\n}\n\n\n// Placeholder text\n// --------------------------------------------------\n\n@mixin placeholder($color: $input-color-placeholder, $text-indent: 0) {\n  &::-moz-placeholder { /* Firefox 19+ */\n    color: $color;\n  }\n  &:-ms-input-placeholder {\n    color: $color;\n  }\n  &::-webkit-input-placeholder {\n    color: $color;\n    // Safari placeholder margin issue\n    text-indent: $text-indent;\n  }\n}\n\n\n// Text Mixins\n// --------------------------------------------------\n\n@mixin text-size-adjust($value: none) {\n  -webkit-text-size-adjust: $value;\n     -moz-text-size-adjust: $value;\n          text-size-adjust: $value;\n}\n@mixin tap-highlight-transparent() {\n  -webkit-tap-highlight-color: rgba(0,0,0,0);\n  -webkit-tap-highlight-color: transparent; // For some Androids\n}\n@mixin touch-callout($value: none) {\n  -webkit-touch-callout: $value;\n}\n\n\n// Font Mixins\n// --------------------------------------------------\n\n@mixin font-family-serif() {\n  font-family: $serif-font-family;\n}\n@mixin font-family-sans-serif() {\n  font-family: $sans-font-family;\n}\n@mixin font-family-monospace() {\n  font-family: $mono-font-family;\n}\n@mixin font-shorthand($size: $base-font-size, $weight: normal, $line-height: $base-line-height) {\n  font-weight: $weight;\n  font-size: $size;\n  line-height: $line-height;\n}\n@mixin font-serif($size: $base-font-size, $weight: normal, $line-height: $base-line-height) {\n  @include font-family-serif();\n  @include font-shorthand($size, $weight, $line-height);\n}\n@mixin font-sans-serif($size: $base-font-size, $weight: normal, $line-height: $base-line-height) {\n  @include font-family-sans-serif();\n  @include font-shorthand($size, $weight, $line-height);\n}\n@mixin font-monospace($size: $base-font-size, $weight: normal, $line-height: $base-line-height) {\n  @include font-family-monospace();\n  @include font-shorthand($size, $weight, $line-height);\n}\n@mixin font-smoothing($font-smoothing) {\n  -webkit-font-smoothing: $font-smoothing;\n          font-smoothing: $font-smoothing;\n}\n\n\n// Appearance\n// --------------------------------------------------\n\n@mixin appearance($val) {\n  -webkit-appearance: $val;\n     -moz-appearance: $val;\n          appearance: $val;\n}\n\n\n// Border Radius Mixins\n// --------------------------------------------------\n\n@mixin border-radius($radius) {\n  -webkit-border-radius: $radius;\n     -moz-border-radius: $radius;\n          border-radius: $radius;\n}\n\n// Single Corner Border Radius\n@mixin border-top-left-radius($radius) {\n  -webkit-border-top-left-radius: $radius;\n      -moz-border-radius-topleft: $radius;\n          border-top-left-radius: $radius;\n}\n@mixin border-top-right-radius($radius) {\n  -webkit-border-top-right-radius: $radius;\n      -moz-border-radius-topright: $radius;\n          border-top-right-radius: $radius;\n}\n@mixin border-bottom-right-radius($radius) {\n  -webkit-border-bottom-right-radius: $radius;\n      -moz-border-radius-bottomright: $radius;\n          border-bottom-right-radius: $radius;\n}\n@mixin border-bottom-left-radius($radius) {\n  -webkit-border-bottom-left-radius: $radius;\n      -moz-border-radius-bottomleft: $radius;\n          border-bottom-left-radius: $radius;\n}\n\n// Single Side Border Radius\n@mixin border-top-radius($radius) {\n  @include border-top-right-radius($radius);\n  @include border-top-left-radius($radius);\n}\n@mixin border-right-radius($radius) {\n  @include border-top-right-radius($radius);\n  @include border-bottom-right-radius($radius);\n}\n@mixin border-bottom-radius($radius) {\n  @include border-bottom-right-radius($radius);\n  @include border-bottom-left-radius($radius);\n}\n@mixin border-left-radius($radius) {\n  @include border-top-left-radius($radius);\n  @include border-bottom-left-radius($radius);\n}\n\n\n// Box shadows\n// --------------------------------------------------\n\n@mixin box-shadow($shadow...) {\n  -webkit-box-shadow: $shadow;\n     -moz-box-shadow: $shadow;\n          box-shadow: $shadow;\n}\n\n\n// Transition Mixins\n// --------------------------------------------------\n\n@mixin transition($transition...) {\n  -webkit-transition: $transition;\n     -moz-transition: $transition;\n          transition: $transition;\n}\n@mixin transition-delay($transition-delay) {\n  -webkit-transition-delay: $transition-delay;\n     -moz-transition-delay: $transition-delay;\n          transition-delay: $transition-delay;\n}\n@mixin transition-duration($transition-duration) {\n  -webkit-transition-duration: $transition-duration;\n     -moz-transition-duration: $transition-duration;\n          transition-duration: $transition-duration;\n}\n@mixin transition-timing-function($transition-timing) {\n   -webkit-transition-timing-function: $transition-timing;\n      -moz-transition-timing-function: $transition-timing;\n           transition-timing-function: $transition-timing;\n }\n @mixin transition-property($property) {\n  -webkit-transition-property: $property;\n     -moz-transition-property: $property;\n          transition-property: $property;\n}\n@mixin transition-transform($properties...) {\n  // special case cuz of transform vendor prefixes\n  -webkit-transition: -webkit-transform $properties;\n     -moz-transition: -moz-transform $properties;\n          transition: transform $properties;\n}\n\n\n// Animation Mixins\n// --------------------------------------------------\n\n@mixin animation($animation) {\n -webkit-animation: $animation;\n    -moz-animation: $animation;\n         animation: $animation;\n}\n@mixin animation-duration($duration) {\n -webkit-animation-duration: $duration;\n    -moz-animation-duration: $duration;\n         animation-duration: $duration;\n}\n@mixin animation-direction($direction) {\n -webkit-animation-direction: $direction;\n    -moz-animation-direction: $direction;\n         animation-direction: $direction;\n}\n@mixin animation-timing-function($animation-timing) {\n -webkit-animation-timing-function: $animation-timing;\n    -moz-animation-timing-function: $animation-timing;\n         animation-timing-function: $animation-timing;\n}\n@mixin animation-fill-mode($fill-mode) {\n -webkit-animation-fill-mode: $fill-mode;\n    -moz-animation-fill-mode: $fill-mode;\n         animation-fill-mode: $fill-mode;\n}\n@mixin animation-name($name) {\n -webkit-animation-name: $name;\n    -moz-animation-name: $name;\n         animation-name: $name;\n}\n@mixin animation-iteration-count($count) {\n -webkit-animation-iteration-count: $count;\n    -moz-animation-iteration-count: $count;\n         animation-iteration-count: $count;\n}\n\n\n// Transformation Mixins\n// --------------------------------------------------\n\n@mixin rotate($degrees) {\n  @include transform( rotate($degrees) );\n}\n@mixin scale($ratio) {\n  @include transform( scale($ratio) );\n}\n@mixin translate($x, $y) {\n  @include transform( translate($x, $y) );\n}\n@mixin skew($x, $y) {\n  @include transform( skew($x, $y) );\n  -webkit-backface-visibility: hidden;\n}\n@mixin translate3d($x, $y, $z) {\n  @include transform( translate3d($x, $y, $z) );\n}\n@mixin translateZ($z) {\n  @include transform( translateZ($z) );\n}\n@mixin transform($val) {\n  -webkit-transform: $val;\n     -moz-transform: $val;\n          transform: $val;\n}\n\n@mixin transform-origin($left, $top) {\n  -webkit-transform-origin: $left $top;\n     -moz-transform-origin: $left $top;\n          transform-origin: $left $top;\n}\n\n\n// Backface visibility\n// --------------------------------------------------\n// Prevent browsers from flickering when using CSS 3D transforms.\n// Default value is `visible`, but can be changed to `hidden\n\n@mixin backface-visibility($visibility){\n  -webkit-backface-visibility: $visibility;\n          backface-visibility: $visibility;\n}\n\n\n// Background clipping\n// --------------------------------------------------\n\n@mixin background-clip($clip) {\n  -webkit-background-clip: $clip;\n     -moz-background-clip: $clip;\n          background-clip: $clip;\n}\n\n\n// Background sizing\n// --------------------------------------------------\n\n@mixin background-size($size) {\n  -webkit-background-size: $size;\n     -moz-background-size: $size;\n          background-size: $size;\n}\n\n\n// Box sizing\n// --------------------------------------------------\n\n@mixin box-sizing($boxmodel) {\n  -webkit-box-sizing: $boxmodel;\n     -moz-box-sizing: $boxmodel;\n          box-sizing: $boxmodel;\n}\n\n\n// User select\n// --------------------------------------------------\n\n@mixin user-select($select) {\n  -webkit-user-select: $select;\n     -moz-user-select: $select;\n      -ms-user-select: $select;\n          user-select: $select;\n}\n\n\n// Content Columns\n// --------------------------------------------------\n\n@mixin content-columns($columnCount, $columnGap: $grid-gutter-width) {\n  -webkit-column-count: $columnCount;\n     -moz-column-count: $columnCount;\n          column-count: $columnCount;\n  -webkit-column-gap: $columnGap;\n     -moz-column-gap: $columnGap;\n          column-gap: $columnGap;\n}\n\n\n// Flexbox Mixins\n// --------------------------------------------------\n// http://philipwalton.github.io/solved-by-flexbox/\n// https://github.com/philipwalton/solved-by-flexbox\n\n@mixin display-flex {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n}\n\n@mixin dislay-inline-flex {\n  display: -webkit-inline-box;\n  display: -webkit-inline-flex;\n  display: -moz-inline-flex;\n  display: -ms-inline-flexbox;\n  display: inline-flex;\n}\n\n@mixin flex-direction($value: row) {\n  @if $value == row-reverse {\n    -webkit-box-direction: reverse;\n    -webkit-box-orient: horizontal;\n  } @else if $value == column {\n    -webkit-box-direction: normal;\n    -webkit-box-orient: vertical;\n  } @else if $value == column-reverse {\n    -webkit-box-direction: reverse;\n    -webkit-box-orient: vertical;\n  } @else {\n    -webkit-box-direction: normal;\n    -webkit-box-orient: horizontal;\n  }\n  -webkit-flex-direction: $value;\n  -moz-flex-direction: $value;\n  -ms-flex-direction: $value;\n  flex-direction: $value;\n}\n\n@mixin flex-wrap($value: nowrap) {\n  // No Webkit Box fallback.\n  -webkit-flex-wrap: $value;\n  -moz-flex-wrap: $value;\n  @if $value == nowrap {\n      -ms-flex-wrap: none;\n  } @else {\n      -ms-flex-wrap: $value;\n  }\n  flex-wrap: $value;\n}\n\n@mixin flex($fg: 1, $fs: null, $fb: null) {\n  -webkit-box-flex: $fg;\n  -webkit-flex: $fg $fs $fb;\n  -moz-box-flex: $fg;\n  -moz-flex: $fg $fs $fb;\n  -ms-flex: $fg $fs $fb;\n  flex: $fg $fs $fb;\n}\n\n@mixin flex-flow($values: (row nowrap)) {\n  // No Webkit Box fallback.\n  -webkit-flex-flow: $values;\n  -moz-flex-flow: $values;\n  -ms-flex-flow: $values;\n  flex-flow: $values;\n}\n\n@mixin align-items($value: stretch) {\n  @if $value == flex-start {\n    -webkit-box-align: start;\n    -ms-flex-align: start;\n  } @else if $value == flex-end {\n    -webkit-box-align: end;\n    -ms-flex-align: end;\n  } @else {\n    -webkit-box-align: $value;\n    -ms-flex-align: $value;\n  }\n  -webkit-align-items: $value;\n  -moz-align-items: $value;\n  align-items: $value;\n}\n\n@mixin align-self($value: auto) {\n  -webkit-align-self: $value;\n  -moz-align-self: $value;\n  @if $value == flex-start {\n    -ms-flex-item-align: start;\n  } @else if $value == flex-end {\n    -ms-flex-item-align: end;\n  } @else {\n    -ms-flex-item-align: $value;\n  }\n  align-self: $value;\n}\n\n@mixin align-content($value: stretch) {\n  -webkit-align-content: $value;\n  -moz-align-content: $value;\n  @if $value == flex-start {\n    -ms-flex-line-pack: start;\n  } @else if $value == flex-end {\n    -ms-flex-line-pack: end;\n  } @else {\n    -ms-flex-line-pack: $value;\n  }\n  align-content: $value;\n}\n\n@mixin justify-content($value: stretch) {\n  @if $value == flex-start {\n    -webkit-box-pack: start;\n    -ms-flex-pack: start;\n  } @else if $value == flex-end {\n    -webkit-box-pack: end;\n    -ms-flex-pack: end;\n  } @else if $value == space-between {\n    -webkit-box-pack: justify;\n    -ms-flex-pack: justify;\n  } @else {\n    -webkit-box-pack: $value;\n    -ms-flex-pack: $value;\n  }\n  -webkit-justify-content: $value;\n  -moz-justify-content: $value;\n  justify-content: $value;\n}\n\n@mixin responsive-grid-break($selector, $max-width) {\n  @media (max-width: $max-width) {\n    #{$selector} {\n      -webkit-box-direction: normal;\n      -moz-box-direction: normal;\n      -webkit-box-orient: vertical;\n      -moz-box-orient: vertical;\n      -webkit-flex-direction: column;\n      -ms-flex-direction: column;\n      flex-direction: column;\n\n      .col, .col-10, .col-20, .col-25, .col-33, .col-34, .col-50, .col-66, .col-67, .col-75, .col-80, .col-90 {\n        @include flex(1);\n        margin-bottom: ($grid-padding-width * 3) / 2;\n        margin-left: 0;\n        max-width: 100%;\n        width: 100%;\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_modal.scss",
    "content": "\n/**\n * Modals\n * --------------------------------------------------\n * Modals are independent windows that slide in from off-screen.\n */\n\n.modal-backdrop {\n  @include transition(background-color 300ms ease-in-out);\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: $z-index-modal;\n  width: 100%;\n  height: 100%;\n  background-color: $modal-backdrop-bg-inactive;\n\n  &.active {\n    background-color: $modal-backdrop-bg-active;\n  }\n}\n\n.modal {\n  display: block;\n  position: absolute;\n  top: 0;\n  z-index: $z-index-modal;\n  overflow: hidden;\n  min-height: 100%;\n  width: 100%;\n  background-color: $modal-bg-color;\n}\n\n@media (min-width: $modal-inset-mode-break-point) {\n  // inset mode is when the modal doesn't fill the entire\n  // display but instead is centered within a large display\n  .modal {\n    top: $modal-inset-mode-top;\n    right: $modal-inset-mode-right;\n    bottom: $modal-inset-mode-bottom;\n    left: $modal-inset-mode-left;\n    overflow: visible;\n    min-height: $modal-inset-mode-min-height;\n    width: (100% - $modal-inset-mode-left - $modal-inset-mode-right);\n  }\n\n  .modal.ng-leave-active {\n    bottom: 0;\n  }\n\n  // remove ios header padding from inset header\n  .platform-ios.platform-cordova .modal-wrapper .modal{\n    .bar-header:not(.bar-subheader) {\n      height: $bar-height;\n      > * {\n        margin-top: 0;\n      }\n    }\n    .tabs-top > .tabs,\n    .tabs.tabs-top {\n      top: $bar-height;\n    }\n    .has-header,\n    .bar-subheader {\n      top: $bar-height;\n    }\n    .has-subheader {\n      top: (2 * $bar-height);\n    }\n    .has-tabs-top {\n      top: $bar-height + $tabs-height;\n    }\n    .has-header.has-subheader.has-tabs-top {\n      top: 2 * $bar-height + $tabs-height;\n    }\n  }\n}\n\n// disable clicks on all but the modal\n.modal-open {\n  pointer-events: none;\n\n  .modal,\n  .modal-backdrop {\n    pointer-events: auto;\n  }\n  // prevent clicks on modal when loading overlay is active though\n  &.loading-active {\n    .modal,\n    .modal-backdrop {\n      pointer-events: none;\n    }\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_platform.scss",
    "content": "\n/**\n * Platform\n * --------------------------------------------------\n * Platform specific tweaks\n */\n\n\n/**\n * Apply roboto font\n */\n\n.roboto {\n  font-family: \"Roboto\", $font-family-base;\n\n  input {\n    font-family: \"Roboto\", $font-family-base;\n  }\n}\n/*\n.platform-android {\n\n\n  .bar {\n    padding: 0;\n\n    line-height: 40px;\n\n    .button {\n      line-height: 40px;\n    }\n\n    .button-icon:before {\n      font-size: 24px;\n    }\n  }\n\n  .back-button {\n    &.button-icon:before {\n      line-height: 40px;\n    }\n    margin-left: -3px;\n    padding: 0px 2px !important;\n    &.ion-android-arrow-back:before {\n      font-size: 12px;\n    }\n\n    &.back-button.active,\n    &.back-button.activated {\n      background-color: rgba(0,0,0,0.1);\n    }\n  }\n\n  .item-divider {\n    background: none;\n    border-top-width: 0;\n    border-bottom-width: 2px;\n    text-transform: uppercase;\n    margin-top: 10px;\n    font-size: 14px;\n  }\n  .item {\n    border-left-width: 0;\n    border-right-width: 0;\n  }\n\n  .item-divider ~ .item:not(.item-divider) {\n    border-bottom-width: 0;\n  }\n\n  .back-button:not(.ng-hide) + .left-buttons + .title {\n    // Don't allow normal titles in this mode\n    display: none;\n  }\n\n  .bar .title {\n    text-align: left;\n    font-weight: normal;\n  }\n\n  font-family: 'Roboto';\n\n  h1, h2, h3, h4, h5 {\n    font-family: 'Roboto', $font-family-base;\n  }\n\n  .tab-item {\n    font-family: 'Roboto', $font-family-base;\n  }\n\n\n  input, button, select, textarea {\n    font-family: 'Roboto', $font-family-base;\n  }\n  */\n//}\n\n.platform-ios.platform-cordova {\n  // iOS7/8 has a status bar which sits on top of the header.\n  // Bump down everything to make room for it. However, if\n  // if its in Cordova, and set to fullscreen, then disregard the bump.\n  &:not(.fullscreen) {\n    .bar-header:not(.bar-subheader) {\n      height: $bar-height + $ios-statusbar-height;\n\n      &.item-input-inset .item-input-wrapper {\n        margin-top: 19px !important;\n      }\n\n      > * {\n        margin-top: $ios-statusbar-height;\n      }\n    }\n    .tabs-top > .tabs,\n    .tabs.tabs-top {\n      top: $bar-height + $ios-statusbar-height;\n    }\n\n    .has-header,\n    .bar-subheader {\n      top: $bar-height + $ios-statusbar-height;\n    }\n    .has-subheader {\n      top: (2 * $bar-height) + $ios-statusbar-height;\n    }\n    .has-tabs-top {\n      top: $bar-height + $tabs-height + $ios-statusbar-height;\n    }\n    .has-header.has-subheader.has-tabs-top {\n      top: 2 * $bar-height + $tabs-height + $ios-statusbar-height;\n    }\n  }\n  &.status-bar-hide {\n    // Cordova doesn't adjust the body height correctly, this makes up for it\n    margin-bottom: 20px;\n  }\n}\n\n@media (orientation:landscape) {\n  .platform-ios.platform-browser.platform-ipad {\n    position: fixed; // required for iPad 7 Safari\n  }\n}\n\n.platform-c:not(.enable-transitions) * {\n  // disable transitions on grade-c devices (Android 2)\n  -webkit-transition: none !important;\n  transition: none !important;\n}\n\n"
  },
  {
    "path": "www/lib/ionic/scss/_popover.scss",
    "content": "\n/**\n * Popovers\n * --------------------------------------------------\n * Popovers are independent views which float over content\n */\n\n.popover-backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: $z-index-popover;\n  width: 100%;\n  height: 100%;\n  background-color: $popover-backdrop-bg-inactive;\n\n  &.active {\n    background-color: $popover-backdrop-bg-active;\n  }\n}\n\n.popover {\n  position: absolute;\n  top: 25%;\n  left: 50%;\n  z-index: $z-index-popover;\n  display: block;\n  margin-left: -$popover-width / 2;\n  height: $popover-height;\n  width: $popover-width;\n  background-color: $popover-bg-color;\n  box-shadow: $popover-box-shadow;\n  opacity: 0;\n\n  .item:first-child {\n    border-top: 0;\n  }\n\n  .item:last-child {\n    border-bottom: 0;\n  }\n\n  &.popover-top {\n    margin-top: 12px;\n  }\n  &.popover-bottom {\n    margin-top: -12px;\n  }\n}\n\n\n// Set popover border-radius\n.popover,\n.popover .bar-header {\n  border-radius: $popover-border-radius;\n}\n.popover .scroll-content {\n  z-index: 1;\n  margin: 2px 0;\n}\n.popover .bar-header {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.popover .has-header {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n.popover-arrow {\n  display: none;\n}\n\n\n// iOS Popover\n.platform-ios {\n\n  .popover {\n    box-shadow: $popover-box-shadow-ios;\n  }\n\n  .popover,\n  .popover .bar-header {\n    border-radius: $popover-border-radius-ios;\n  }\n  .popover .scroll-content {\n    margin: 8px 0;\n    border-radius: $popover-border-radius-ios;\n  }\n  .popover .scroll-content.has-header {\n    margin-top: 0;\n  }\n  .popover-arrow {\n    position: absolute;\n    display: block;\n    width: 30px;\n    height: 19px;\n    overflow: hidden;\n\n    &:after {\n      position: absolute;\n      top: 12px;\n      left: 5px;\n      width: 20px;\n      height: 20px;\n      background-color: $popover-bg-color;\n      border-radius: 3px;\n      content: '';\n      @include rotate(-45deg);\n    }\n  }\n  .popover-top .popover-arrow {\n    top: -17px;\n  }\n  .popover-bottom .popover-arrow {\n    bottom: -10px;\n    &:after {\n      top: -6px;\n    }\n  }\n}\n\n\n// Android Popover\n.platform-android {\n\n  .popover {\n    background-color: $popover-bg-color-android;\n    box-shadow: $popover-box-shadow-android;\n\n    .item {\n      border-color: $popover-bg-color-android;\n      background-color: $popover-bg-color-android;\n      color: #4d4d4d;\n    }\n    &.popover-top {\n      margin-top: -32px;\n    }\n    &.popover-bottom {\n      margin-top: 32px;\n    }\n  }\n\n  .popover-backdrop,\n  .popover-backdrop.active {\n    background-color: transparent;\n  }\n}\n\n\n// disable clicks on all but the popover\n.popover-open {\n  pointer-events: none;\n\n  .popover,\n  .popover-backdrop {\n    pointer-events: auto;\n  }\n  // prevent clicks on popover when loading overlay is active though\n  &.loading-active {\n    .popover,\n    .popover-backdrop {\n      pointer-events: none;\n    }\n  }\n}\n\n\n// wider popover on larger viewports\n@media (min-width: $popover-large-break-point) {\n  .popover {\n    width: $popover-large-width;\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_popup.scss",
    "content": "\n/**\n * Popups\n * --------------------------------------------------\n */\n\n.popup-container {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  right: 0;\n  background: rgba(0,0,0,0);\n\n  @include display-flex();\n  @include justify-content(center);\n  @include align-items(center);\n\n  z-index: $z-index-popup;\n\n  // Start hidden\n  visibility: hidden;\n  &.popup-showing {\n    visibility: visible;\n  }\n\n  &.popup-hidden .popup {\n    @include animation-name(scaleOut);\n    @include animation-duration($popup-leave-animation-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n\n  &.active .popup {\n    @include animation-name(superScaleIn);\n    @include animation-duration($popup-enter-animation-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n\n  .popup {\n    width: $popup-width;\n    max-width: 100%;\n    max-height: 90%;\n\n    border-radius: $popup-border-radius;\n    background-color: $popup-background-color;\n\n    @include display-flex();\n    @include flex-direction(column);\n  }\n}\n\n.popup-head {\n  padding: 15px 0px;\n  border-bottom: 1px solid #eee;\n  text-align: center;\n}\n.popup-title {\n  margin: 0;\n  padding: 0;\n  font-size: 15px;\n}\n.popup-sub-title {\n  margin: 5px 0 0 0;\n  padding: 0;\n  font-weight: normal;\n  font-size: 11px;\n}\n.popup-body {\n  padding: 10px;\n  overflow: scroll;\n}\n\n.popup-buttons {\n  @include display-flex();\n  @include flex-direction(row);\n  padding: 10px;\n  min-height: $popup-button-min-height + 20;\n\n  .button {\n    @include flex(1);\n    min-height: $popup-button-min-height;\n    border-radius: $popup-button-border-radius;\n    line-height: $popup-button-line-height;\n\n    margin-right: 5px;\n    &:last-child {\n      margin-right: 0px;\n    }\n  }\n}\n\n.popup-open {\n  pointer-events: none;\n\n  &.modal-open .modal {\n    pointer-events: none;\n  }\n\n  .popup-backdrop, .popup {\n    pointer-events: auto;\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_progress.scss",
    "content": "\n/**\n * Progress\n * --------------------------------------------------\n */\n\nprogress {\n  display: block;\n  margin: $progress-margin;\n  width: $progress-width;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_radio.scss",
    "content": "\n/**\n * Radio Button Inputs\n * --------------------------------------------------\n */\n\n.item-radio {\n  padding: 0;\n\n  &:hover {\n    cursor: pointer;\n  }\n}\n\n.item-radio .item-content {\n  /* give some room to the right for the checkmark icon */\n  padding-right: $item-padding * 4;\n}\n\n.item-radio .radio-icon {\n  /* checkmark icon will be hidden by default */\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: $z-index-item-radio;\n  visibility: hidden;\n  padding: $item-padding - 2;\n  height: 100%;\n  font-size: 24px;\n}\n\n.item-radio input {\n  /* hide any radio button inputs elements (the ugly circles) */\n  position: absolute;\n  left: -9999px;\n\n  &:checked ~ .item-content {\n    /* style the item content when its checked */\n    background: #f7f7f7;\n  }\n\n  &:checked ~ .radio-icon {\n    /* show the checkmark icon when its checked */\n    visibility: visible;\n  }\n}\n\n// Hack for Android to correctly display the checked item\n// http://timpietrusky.com/advanced-checkbox-hack\n.platform-android.grade-b .item-radio,\n.platform-android.grade-c .item-radio {\n  -webkit-animation: androidCheckedbugfix infinite 1s;\n}\n@-webkit-keyframes androidCheckedbugfix {\n  from { padding: 0; }\n  to { padding: 0; }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_range.scss",
    "content": "\n/**\n * Range\n * --------------------------------------------------\n */\n\ninput[type=\"range\"] {\n  display: inline-block;\n  overflow: hidden;\n  margin-top: 5px;\n  margin-bottom: 5px;\n  padding-right: 2px;\n  padding-left: 1px;\n  width: auto;\n  height: $range-slider-height + 15;\n  outline: none;\n  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, $range-default-track-bg), color-stop(100%, $range-default-track-bg));\n  background: linear-gradient(to right, $range-default-track-bg 0%, $range-default-track-bg 100%);\n  background-position: center;\n  background-size: 99% $range-track-height;\n  background-repeat: no-repeat;\n  -webkit-appearance: none;\n\n  &::-webkit-slider-thumb {\n    position: relative;\n    width: $range-slider-width;\n    height: $range-slider-height;\n    border-radius: $range-slider-border-radius;\n    background-color: $toggle-handle-off-bg-color;\n    box-shadow: 0 0 2px rgba(0,0,0,.5), 1px 3px 5px rgba(0,0,0,0.25);\n    cursor: pointer;\n    -webkit-appearance: none;\n  }\n\n  &::-webkit-slider-thumb:before {\n    /* what creates the colorful line on the left side of the slider */\n    position: absolute;\n    top: ($range-slider-height / 2) - ($range-track-height / 2);\n    left: -2001px;\n    width: 2000px;\n    height: $range-track-height;\n    background: $dark;\n    content: ' ';\n  }\n\n  &::-webkit-slider-thumb:after {\n    /* create a larger (but hidden) hit area */\n    position: absolute;\n    top: -20px;\n    left: -20px;\n    padding: 30px;\n    content: ' ';\n    //background: red;\n    //opacity: .5;\n  }\n\n}\n\n.range {\n  @include display-flex();\n  @include align-items(center);\n  padding: 2px 11px;\n\n  &.range-light {\n    input { @include range-style($range-light-track-bg); }\n  }\n  &.range-stable {\n    input { @include range-style($range-stable-track-bg); }\n  }\n  &.range-positive {\n    input { @include range-style($range-positive-track-bg); }\n  }\n  &.range-calm {\n    input { @include range-style($range-calm-track-bg); }\n  }\n  &.range-balanced {\n    input { @include range-style($range-balanced-track-bg); }\n  }\n  &.range-assertive {\n    input { @include range-style($range-assertive-track-bg); }\n  }\n  &.range-energized {\n    input { @include range-style($range-energized-track-bg); }\n  }\n  &.range-royal {\n    input { @include range-style($range-royal-track-bg); }\n  }\n  &.range-dark {\n    input { @include range-style($range-dark-track-bg); }\n  }\n}\n\n.range .icon {\n  @include flex(0);\n  display: block;\n  min-width: $range-icon-size;\n  text-align: center;\n  font-size: $range-icon-size;\n}\n\n.range input {\n  @include flex(1);\n  display: block;\n  margin-right: 10px;\n  margin-left: 10px;\n}\n\n.range-label {\n  @include flex(0, 0, auto);\n  display: block;\n  white-space: nowrap;\n}\n\n.range-label:first-child {\n  padding-left: 5px;\n}\n.range input + .range-label {\n  padding-right: 5px;\n  padding-left: 0;\n}\n\n"
  },
  {
    "path": "www/lib/ionic/scss/_reset.scss",
    "content": "\n/**\n * Resets\n * --------------------------------------------------\n * Adapted from normalize.css and some reset.css. We don't care even one\n * bit about old IE, so we don't need any hacks for that in here.\n *\n * There are probably other things we could remove here, as well.\n *\n * normalize.css v2.1.2 | MIT License | git.io/normalize\n\n * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)\n * http://cssreset.com\n */\n\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, i, u, center,\ndl, dt, dd, ol, ul, li,\nfieldset, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td,\narticle, aside, canvas, details, embed, fieldset,\nfigure, figcaption, footer, header, hgroup,\nmenu, nav, output, ruby, section, summary,\ntime, mark, audio, video {\n  margin: 0;\n  padding: 0;\n  border: 0;\n  vertical-align: baseline;\n  font: inherit;\n  font-size: 100%;\n}\n\nol, ul {\n  list-style: none;\n}\nblockquote, q {\n  quotes: none;\n}\nblockquote:before, blockquote:after,\nq:before, q:after {\n  content: '';\n  content: none;\n}\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\n\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\n\n/**\n * Hide the `template` element in IE, Safari, and Firefox < 22.\n */\n\n[hidden],\ntemplate {\n  display: none;\n}\n\nscript {\n  display: none !important;\n}\n\n/* ==========================================================================\n   Base\n   ========================================================================== */\n\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n *  user zoom.\n */\n\nhtml {\n  @include user-select(none);\n  font-family: sans-serif; /* 1 */\n  -webkit-text-size-adjust: 100%;\n  -ms-text-size-adjust: 100%; /* 2 */\n  -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Remove default margin.\n */\n\nbody {\n  margin: 0;\n  line-height: 1;\n}\n\n\n/**\n * Remove default outlines.\n */\na,\nbutton,\n:focus,\na:focus,\nbutton:focus,\na:active,\na:hover {\n  outline: 0;\n}\n\n/* *\n * Remove tap highlight color\n */\n\na {\n  -webkit-user-drag: none;\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n  -webkit-tap-highlight-color: transparent;\n\n  &[href]:hover {\n    cursor: pointer;\n  }\n}\n\n/* ==========================================================================\n   Typography\n   ========================================================================== */\n\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.\n */\n\nb,\nstrong {\n  font-weight: bold;\n}\n\n/**\n * Address styling not present in Safari 5 and Chrome.\n */\n\ndfn {\n  font-style: italic;\n}\n\n/**\n * Address differences between Firefox and other browsers.\n */\n\nhr {\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  height: 0;\n}\n\n\n/**\n * Correct font family set oddly in Safari 5 and Chrome.\n */\n\ncode,\nkbd,\npre,\nsamp {\n  font-size: 1em;\n  font-family: monospace, serif;\n}\n\n/**\n * Improve readability of pre-formatted text in all browsers.\n */\n\npre {\n  white-space: pre-wrap;\n}\n\n/**\n * Set consistent quote types.\n */\n\nq {\n  quotes: \"\\201C\" \"\\201D\" \"\\2018\" \"\\2019\";\n}\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\n\nsmall {\n  font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\n\nsub,\nsup {\n  position: relative;\n  vertical-align: baseline;\n  font-size: 75%;\n  line-height: 0;\n}\n\nsup {\n  top: -0.5em;\n}\n\nsub {\n  bottom: -0.25em;\n}\n\n/**\n * Define consistent border, margin, and padding.\n */\n\nfieldset {\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n  border: 1px solid #c0c0c0;\n}\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\n\nlegend {\n  padding: 0; /* 2 */\n  border: 0; /* 1 */\n}\n\n/**\n * 1. Correct font family not being inherited in all browsers.\n * 2. Correct font size not being inherited in all browsers.\n * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n * 4. Remove any default :focus styles\n * 5. Make sure webkit font smoothing is being inherited\n * 6. Remove default gradient in Android Firefox / FirefoxOS\n */\n\nbutton,\ninput,\nselect,\ntextarea {\n  margin: 0; /* 3 */\n  font-size: 100%; /* 2 */\n  font-family: inherit; /* 1 */\n  outline-offset: 0; /* 4 */\n  outline-style: none; /* 4 */\n  outline-width: 0; /* 4 */\n  -webkit-font-smoothing: inherit; /* 5 */\n  background-image: none; /* 6 */\n}\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `importnt` in\n * the UA stylesheet.\n */\n\nbutton,\ninput {\n  line-height: normal;\n}\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.\n * Correct `select` style inheritance in Firefox 4+ and Opera.\n */\n\nbutton,\nselect {\n  text-transform: none;\n}\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n *  and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n *  `input` and others.\n */\n\nbutton,\nhtml input[type=\"button\"], /* 1 */\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  cursor: pointer; /* 3 */\n  -webkit-appearance: button; /* 2 */\n}\n\n/**\n * Re-set default cursor for disabled elements.\n */\n\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default;\n}\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n *  (include `-moz` to future-proof).\n */\n\ninput[type=\"search\"] {\n  -webkit-box-sizing: content-box; /* 2 */\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  -webkit-appearance: textfield; /* 1 */\n}\n\n/**\n * Remove inner padding and search cancel button in Safari 5 and Chrome\n * on OS X.\n */\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  padding: 0;\n  border: 0;\n}\n\n/**\n * 1. Remove default vertical scrollbar in IE 8/9.\n * 2. Improve readability and alignment in all browsers.\n */\n\ntextarea {\n  overflow: auto; /* 1 */\n  vertical-align: top; /* 2 */\n}\n\n\nimg {\n  -webkit-user-drag: none;\n}\n\n/* ==========================================================================\n   Tables\n   ========================================================================== */\n\n/**\n * Remove most spacing between table cells.\n */\n\ntable {\n  border-spacing: 0;\n  border-collapse: collapse;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_scaffolding.scss",
    "content": "\n/**\n * Scaffolding\n * --------------------------------------------------\n */\n\n*,\n*:before,\n*:after {\n  @include box-sizing(border-box);\n}\n\nhtml {\n  overflow: hidden;\n  -ms-touch-action: pan-y;\n  touch-action: pan-y;\n}\n\nbody,\n.ionic-body {\n  @include touch-callout(none);\n  @include font-smoothing(antialiased);\n  @include text-size-adjust(none);\n  @include tap-highlight-transparent();\n  @include user-select(none);\n\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n\n  margin: 0;\n  padding: 0;\n\n  color: $base-color;\n  word-wrap: break-word;\n  font-size: $font-size-base;\n  font-family: $font-family-base;\n  line-height: $line-height-computed;\n  text-rendering: optimizeLegibility;\n  -webkit-backface-visibility: hidden;\n  -webkit-user-drag: none;\n}\n\nbody.grade-b,\nbody.grade-c {\n  // disable optimizeLegibility for low end devices\n  text-rendering: auto;\n}\n\n.content {\n  // used for content areas not using the content directive\n  position: relative;\n}\n\n.scroll-content {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n\n  // Hide the top border if any\n  margin-top: -1px;\n\n  // Prevents any distortion of lines\n  padding-top:1px;\n\n  width: auto;\n  height: auto;\n}\n\n.scroll-content-false,\n.menu .scroll-content.scroll-content-false{\n  z-index: $z-index-scroll-content-false;\n}\n\n.scroll-view {\n  position: relative;\n  display: block;\n  overflow: hidden;\n\n  // Hide the top border if any\n  margin-top: -1px;\n}\n\n/**\n * Scroll is the scroll view component available for complex and custom\n * scroll view functionality.\n */\n.scroll {\n  @include user-select(none);\n  @include touch-callout(none);\n  @include text-size-adjust(none);\n  @include transform-origin(left, top);\n}\n\n// hide webkit scrollbars\n::-webkit-scrollbar {\n  display:none;\n}\n\n// Scroll bar styles\n.scroll-bar {\n  position: absolute;\n  z-index: $z-index-scroll-bar;\n}\n// hide the scroll-bar during animations\n.ng-animate .scroll-bar {\n  visibility: hidden;\n}\n.scroll-bar-h {\n  right: 2px;\n  bottom: 3px;\n  left: 2px;\n  height: 3px;\n\n  .scroll-bar-indicator {\n    height: 100%;\n  }\n}\n\n.scroll-bar-v {\n  top: 2px;\n  right: 3px;\n  bottom: 2px;\n  width: 3px;\n\n  .scroll-bar-indicator {\n    width: 100%;\n  }\n}\n.scroll-bar-indicator {\n  position: absolute;\n  border-radius: 4px;\n  background: rgba(0,0,0,0.3);\n  opacity: 1;\n\n\n  &.scroll-bar-fade-out {\n    @include transition(opacity 0.3s linear);\n    opacity: 0;\n  }\n}\n.grade-b .scroll-bar-indicator,\n.grade-c .scroll-bar-indicator {\n  // disable rgba background and border radius for low end devices\n  border-radius: 0;\n  background: #aaa;\n\n  &.scroll-bar-fade-out {\n    @include transition(none);\n  }\n}\n\n@keyframes refresh-spin {\n  0% { transform: translate3d(0,0,0) rotate(0); }\n  100% { transform: translate3d(0,0,0) rotate(-180deg); }\n}\n\n@-webkit-keyframes refresh-spin {\n  0% {-webkit-transform: translate3d(0,0,0) rotate(0); }\n  100% {-webkit-transform: translate3d(0,0,0) rotate(-180deg); }\n}\n\n@keyframes refresh-spin-back {\n  0% { transform: translate3d(0,0,0) rotate(-180deg); }\n  100% { transform: translate3d(0,0,0) rotate(0); }\n}\n\n@-webkit-keyframes refresh-spin-back {\n  0% {-webkit-transform: translate3d(0,0,0) rotate(-180deg); }\n  100% {-webkit-transform: translate3d(0,0,0) rotate(0); }\n}\n\n// Scroll refresher (for pull to refresh)\n.scroll-refresher {\n  position: absolute;\n  top: -60px;\n  right: 0;\n  left: 0;\n  overflow: hidden;\n  margin: auto;\n  height: 60px;\n\n  .ionic-refresher-content {\n    position: absolute;\n    bottom: 15px;\n    left: 0;\n    width: 100%;\n    color: $scroll-refresh-icon-color;\n    text-align: center;\n\n    font-size: 30px;\n\n    .text-refreshing,\n    .text-pulling {\n      font-size: 16px;\n      line-height: 16px;\n    }\n    &.ionic-refresher-with-text {\n      bottom: 10px;\n    }\n  }\n\n  .icon-refreshing,\n  .icon-pulling {\n    width: 100%;\n    -webkit-backface-visibility: hidden;\n    -webkit-transform-style: preserve-3d;\n    backface-visibility: hidden;\n    transform-style: preserve-3d;\n  }\n  .icon-pulling {\n    @include animation-name(refresh-spin-back);\n    @include animation-duration(200ms);\n    @include animation-timing-function(linear);\n    @include animation-fill-mode(none);\n    -webkit-transform: translate3d(0,0,0) rotate(0deg);\n    transform: translate3d(0,0,0) rotate(0deg);\n  }\n  .icon-refreshing,\n  .text-refreshing {\n    display: none;\n  }\n  .icon-refreshing {\n    @include animation-duration(1.5s);\n  }\n\n  &.active {\n    .icon-pulling {\n      @include animation-name(refresh-spin);\n      -webkit-transform: translate3d(0,0,0) rotate(-180deg);\n      transform: translate3d(0,0,0) rotate(-180deg);\n    }\n    &.refreshing {\n      .icon-pulling,\n      .text-pulling {\n        display: none;\n      }\n      .icon-refreshing,\n      .text-refreshing {\n        display: block;\n      }\n    }\n  }\n}\n\nion-infinite-scroll {\n  height: 60px;\n  width: 100%;\n  opacity: 0;\n  display: block;\n\n  @include transition(opacity 0.25s);\n  @include display-flex();\n  @include flex-direction(row);\n  @include justify-content(center);\n  @include align-items(center);\n\n  .icon {\n    color: #666666;\n    font-size: 30px;\n    color: $scroll-refresh-icon-color;\n  }\n\n  &.active {\n    opacity: 1;\n  }\n}\n\n.overflow-scroll {\n  overflow-x: hidden;\n  overflow-y: scroll;\n  -webkit-overflow-scrolling: touch;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  position: absolute;\n\n  .scroll {\n    position: static;\n    height: 100%;\n    -webkit-transform: translate3d(0, 0, 0);   // fix iOS bug where relative children of scroller disapear while scrolling.  see: http://stackoverflow.com/questions/9807620/ipad-safari-scrolling-causes-html-elements-to-disappear-and-reappear-with-a-dela\n  }\n}\n\n\n// Pad top/bottom of content so it doesn't hide behind .bar-title and .bar-tab.\n// Note: For these to work, content must come after both bars in the markup\n/* If you change these, change platform.scss as well */\n.has-header {\n  top: $bar-height;\n}\n// Force no header\n.no-header {\n  top: 0;\n}\n\n.has-subheader {\n  top: $bar-height * 2;\n}\n.has-tabs-top {\n  top: $bar-height + $tabs-height;\n}\n.has-header.has-subheader.has-tabs-top {\n  top: 2 * $bar-height + $tabs-height;\n}\n\n.has-footer {\n  bottom: $bar-height;\n}\n.has-subfooter {\n  bottom: $bar-height * 2;\n}\n\n.has-tabs,\n.bar-footer.has-tabs {\n  bottom: $tabs-height;\n}\n\n.has-footer.has-tabs {\n  bottom: $tabs-height + $bar-height;\n}\n\n// A full screen section with a solid background\n.pane {\n  @include translate3d(0,0,0);\n  z-index: $z-index-pane;\n}\n.view {\n  z-index: $z-index-view;\n}\n.pane,\n.view {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background-color: $base-background-color;\n  overflow: hidden;\n}\n\nion-nav-view {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background-color: #000;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_select.scss",
    "content": "\n/**\n * Select\n * --------------------------------------------------\n */\n\n.item-select {\n  position: relative;\n\n  select {\n    @include appearance(none);\n    position: absolute;\n    top: 0;\n    right: 0;\n    padding: ($item-padding - 2) ($item-padding * 3) ($item-padding) $item-padding;\n    max-width: 65%;\n\n    border: none;\n    background: $item-default-bg;\n    color: #333;\n\n    // hack to hide default dropdown arrow in FF\n    text-indent: .01px;\n    text-overflow: '';\n\n    white-space: nowrap;\n    font-size: $font-size-base;\n\n    cursor: pointer;\n    direction: rtl; // right align the select text\n  }\n\n  select::-ms-expand {\n    // hide default dropdown arrow in IE\n    display: none;\n  }\n\n  option {\n    direction: ltr;\n  }\n\n  &:after {\n    position: absolute;\n    top: 50%;\n    right: $item-padding;\n    margin-top: -3px;\n    width: 0;\n    height: 0;\n    border-top: 5px solid;\n    border-right: 5px solid rgba(0, 0, 0, 0);\n    border-left: 5px solid rgba(0, 0, 0, 0);\n    color: #999;\n    content: \"\";\n    pointer-events: none;\n  }\n  &.item-light {\n    select{\n      background:$item-light-bg;\n      color:$item-light-text;\n    }\n  }\n  &.item-stable {\n    select{\n      background:$item-stable-bg;\n      color:$item-stable-text;\n    }\n    &:after, .input-label{\n      color:darken($item-stable-border,30%);\n    }\n  }\n  &.item-positive {\n    select{\n      background:$item-positive-bg;\n      color:$item-positive-text;\n    }\n    &:after, .input-label{\n      color:$item-positive-text;\n    }\n  }\n  &.item-calm {\n    select{\n      background:$item-calm-bg;\n      color:$item-calm-text;\n    }\n    &:after, .input-label{\n      color:$item-calm-text;\n    }\n  }\n  &.item-assertive {\n    select{\n      background:$item-assertive-bg;\n      color:$item-assertive-text;\n    }\n    &:after, .input-label{\n      color:$item-assertive-text;\n    }\n  }\n  &.item-balanced {\n    select{\n      background:$item-balanced-bg;\n      color:$item-balanced-text;\n    }\n    &:after, .input-label{\n      color:$item-balanced-text;\n    }\n  }\n  &.item-energized  {\n    select{\n      background:$item-energized-bg;\n      color:$item-energized-text;\n    }\n    &:after, .input-label{\n      color:$item-energized-text;\n    }\n  }\n  &.item-royal {\n    select{\n      background:$item-royal-bg;\n      color:$item-royal-text;\n    }\n    &:after, .input-label{\n      color:$item-royal-text;\n    }\n  }\n  &.item-dark  {\n    select{\n      background:$item-dark-bg;\n      color:$item-dark-text;\n    }\n    &:after, .input-label{\n      color:$item-dark-text;\n    }\n  }\n}\n\nselect {\n  &[multiple],\n  &[size] {\n    height: auto;\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_slide-box.scss",
    "content": "\n/**\n * Slide Box\n * --------------------------------------------------\n */\n\n.slider {\n  position: relative;\n  visibility: hidden;\n  // Make sure items don't scroll over ever\n  overflow: hidden;\n}\n\n.slider-slides {\n  position: relative;\n  height: 100%;\n}\n\n.slider-slide {\n  position: relative;\n  display: block;\n  float: left;\n  width: 100%;\n  height: 100%;\n  vertical-align: top;\n}\n\n.slider-slide-image {\n  > img {\n    width: 100%;\n  }\n}\n\n.slider-pager {\n  position: absolute;\n  bottom: 20px;\n  z-index: $z-index-slider-pager;\n  width: 100%;\n  height: 15px;\n  text-align: center;\n\n  .slider-pager-page {\n    display: inline-block;\n    margin: 0px 3px;\n    width: 15px;\n    color: #000;\n    text-decoration: none;\n\n    opacity: 0.3;\n\n    &.active {\n      @include transition(opacity 0.4s ease-in);\n      opacity: 1;\n    }\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_split-pane.scss",
    "content": "\n/**\n * Split Pane\n * --------------------------------------------------\n */\n\n.split-pane {\n  @include display-flex();\n  @include align-items(stretch);\n  width: 100%;\n  height: 100%;\n}\n\n.split-pane-menu {\n  @include flex(0, 0, $split-pane-menu-width);\n\n  overflow-y: auto;\n  width: $split-pane-menu-width;\n  height: 100%;\n  border-right: 1px solid $split-pane-menu-border-color;\n\n  @media all and (max-width: 568px) {\n    border-right: none;\n  }\n}\n\n.split-pane-content {\n  @include flex(1, 0, auto);\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_tabs.scss",
    "content": "/**\n * Tabs\n * --------------------------------------------------\n * A navigation bar with any number of tab items supported.\n */\n\n.tabs {\n  @include display-flex();\n  @include flex-direction(horizontal);\n  @include justify-content(center);\n  @include translate3d(0,0,0);\n\n  @include tab-style($tabs-default-bg, $tabs-default-border, $tabs-default-text);\n  @include tab-badge-style($tabs-default-text, $tabs-default-bg);\n\n  position: absolute;\n  bottom: 0;\n\n  z-index: $z-index-tabs;\n\n  width: 100%;\n  height: $tabs-height;\n\n  border-style: solid;\n  border-top-width: 1px;\n\n  background-size: 0;\n  line-height: $tabs-height;\n\n  @media (min--moz-device-pixel-ratio: 1.5),\n         (-webkit-min-device-pixel-ratio: 1.5),\n         (min-device-pixel-ratio: 1.5),\n         (min-resolution: 144dpi),\n         (min-resolution: 1.5dppx) {\n    padding-top: 2px;\n    border-top: none !important;\n    border-bottom: none;\n    background-position: top;\n    background-size: 100% 1px;\n    background-repeat: no-repeat;\n  }\n\n}\n/* Allow parent element of tabs to define color, or just the tab itself */\n.tabs-light > .tabs,\n.tabs.tabs-light {\n  @include tab-style($tabs-light-bg, $tabs-light-border, $tabs-light-text);\n  @include tab-badge-style($tabs-light-text, $tabs-light-bg);\n}\n.tabs-stable > .tabs,\n.tabs.tabs-stable {\n  @include tab-style($tabs-stable-bg, $tabs-stable-border, $tabs-stable-text);\n  @include tab-badge-style($tabs-stable-text, $tabs-stable-bg);\n}\n.tabs-positive > .tabs,\n.tabs.tabs-positive {\n  @include tab-style($tabs-positive-bg, $tabs-positive-border, $tabs-positive-text);\n  @include tab-badge-style($tabs-positive-text, $tabs-positive-bg);\n}\n.tabs-calm > .tabs,\n.tabs.tabs-calm {\n  @include tab-style($tabs-calm-bg, $tabs-calm-border, $tabs-calm-text);\n  @include tab-badge-style($tabs-calm-text, $tabs-calm-bg);\n}\n.tabs-assertive > .tabs,\n.tabs.tabs-assertive {\n  @include tab-style($tabs-assertive-bg, $tabs-assertive-border, $tabs-assertive-text);\n  @include tab-badge-style($tabs-assertive-text, $tabs-assertive-bg);\n}\n.tabs-balanced > .tabs,\n.tabs.tabs-balanced {\n  @include tab-style($tabs-balanced-bg, $tabs-balanced-border, $tabs-balanced-text);\n  @include tab-badge-style($tabs-balanced-text, $tabs-balanced-bg);\n}\n.tabs-energized > .tabs,\n.tabs.tabs-energized {\n  @include tab-style($tabs-energized-bg, $tabs-energized-border, $tabs-energized-text);\n  @include tab-badge-style($tabs-energized-text, $tabs-energized-bg);\n}\n.tabs-royal > .tabs,\n.tabs.tabs-royal {\n  @include tab-style($tabs-royal-bg, $tabs-royal-border, $tabs-royal-text);\n  @include tab-badge-style($tabs-royal-text, $tabs-royal-bg);\n}\n.tabs-dark > .tabs,\n.tabs.tabs-dark {\n  @include tab-style($tabs-dark-bg, $tabs-dark-border, $tabs-dark-text);\n  @include tab-badge-style($tabs-dark-text, $tabs-dark-bg);\n}\n\n@mixin tabs-striped($style, $color, $background) {\n  &.#{$style} {\n    .tabs{\n      background-color: $background;\n    }\n    .tab-item {\n      color: rgba($color, $tabs-striped-off-opacity);\n      opacity: 1;\n      .badge{\n        opacity:$tabs-striped-off-opacity;\n      }\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        margin-top: -$tabs-striped-border-width;\n        color: $color;\n        border-style: solid;\n        border-width: $tabs-striped-border-width 0 0 0;\n        border-color: $color;\n        .badge{\n          top:$tabs-striped-border-width;\n          opacity: 1;\n        }\n      }\n    }\n  }\n  &.tabs-top{\n    .tab-item {\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        .badge {\n          top: 4%;\n        }\n      }\n    }\n  }\n}\n\n@mixin tabs-background($style, $color) {\n  &.#{$style} {\n    .tabs {\n      background-color: $color;\n    }\n  }\n}\n\n@mixin tabs-color($style, $color) {\n  &.#{$style} {\n    .tab-item {\n      color: rgba($color, $tabs-striped-off-opacity);\n      opacity: 1;\n      .badge{\n        opacity:$tabs-striped-off-opacity;\n      }\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        margin-top: -$tabs-striped-border-width;\n        color: $color;\n        border: 0 solid $color;\n        border-top-width: $tabs-striped-border-width;\n        .badge{\n          top:$tabs-striped-border-width;\n          opacity: 1;\n        }\n      }\n    }\n  }\n}\n\n.tabs-striped {\n  .tabs {\n    background-color: white;\n    background-image: none;\n    border: none;\n    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.15);\n    padding-top: $tabs-striped-border-width;\n  }\n  @include tabs-striped('tabs-light', $light, $dark);\n  @include tabs-striped('tabs-stable', $stable, $dark);\n  @include tabs-striped('tabs-positive', $positive, $light);\n  @include tabs-striped('tabs-calm', $calm, $light);\n  @include tabs-striped('tabs-assertive', $assertive, $light);\n  @include tabs-striped('tabs-balanced', $balanced, $light);\n  @include tabs-striped('tabs-energized', $energized, $light);\n  @include tabs-striped('tabs-royal', $royal, $light);\n  @include tabs-striped('tabs-dark', $dark, $light);\n\n\n  @include tabs-background('tabs-background-light', $light);\n  @include tabs-background('tabs-background-stable', $stable);\n  @include tabs-background('tabs-background-positive', $positive);\n  @include tabs-background('tabs-background-calm', $calm);\n  @include tabs-background('tabs-background-assertive', $assertive);\n  @include tabs-background('tabs-background-balanced', $balanced);\n  @include tabs-background('tabs-background-energized',$energized);\n  @include tabs-background('tabs-background-royal', $royal);\n  @include tabs-background('tabs-background-dark', $dark);\n\n  @include tabs-color('tabs-color-light', $light);\n  @include tabs-color('tabs-color-stable', $stable);\n  @include tabs-color('tabs-color-positive', $positive);\n  @include tabs-color('tabs-color-calm', $calm);\n  @include tabs-color('tabs-color-assertive', $assertive);\n  @include tabs-color('tabs-color-balanced', $balanced);\n  @include tabs-color('tabs-color-energized',$energized);\n  @include tabs-color('tabs-color-royal', $royal);\n  @include tabs-color('tabs-color-dark', $dark);\n}\n\n.tabs-top {\n  &.tabs-striped {\n    padding-bottom:0;\n    .tab-item{\n      background: transparent;\n      // animate the top bar, leave bottom for platform consistency\n      -webkit-transition: all .1s ease;\n      -moz-transition: all .1s ease;\n      -ms-transition: all .1s ease;\n      -o-transition: all .1s ease;\n      transition: all .1s ease;\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        margin-top: 0;\n        margin-bottom: -$tabs-striped-border-width;\n        border-width: 0px 0px $tabs-striped-border-width 0px !important;\n        border-style: solid;\n      }\n      .badge{\n        -webkit-transition: all .2s ease;\n        -moz-transition: all .2s ease;\n        -ms-transition: all .2s ease;\n        -o-transition: all .2s ease;\n        transition: all .2s ease;\n      }\n    }\n  }\n}\n\n/* Allow parent element to have tabs-top */\n/* If you change this, change platform.scss as well */\n.tabs-top > .tabs,\n.tabs.tabs-top {\n  top: $bar-height;\n  padding-top: 0;\n  background-position: bottom;\n  .tab-item {\n    &.tab-item-active,\n    &.active,\n    &.activated {\n      .badge {\n        top: 4%;\n      }\n    }\n  }\n}\n.tabs-top ~ .bar-header {\n  border-bottom-width: 0;\n}\n\n.tab-item {\n  @include flex(1);\n  display: block;\n  overflow: hidden;\n\n  max-width: $tab-item-max-width;\n  height: 100%;\n\n  color: inherit;\n  text-align: center;\n  text-decoration: none;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n\n  font-weight: 400;\n  font-size: $tabs-text-font-size;\n  font-family: $font-family-light-sans-serif;\n\n  opacity: 0.7;\n\n  &:hover {\n    cursor: pointer;\n  }\n  &.tab-hidden{\n    display:none;\n  }\n}\n\n.tabs-item-hide > .tabs,\n.tabs.tabs-item-hide {\n  display: none;\n}\n\n.tabs-icon-top > .tabs .tab-item,\n.tabs-icon-top.tabs .tab-item,\n.tabs-icon-bottom > .tabs .tab-item,\n.tabs-icon-bottom.tabs .tab-item {\n  font-size: $tabs-text-font-size-side-icon;\n  line-height: $tabs-text-font-size;\n}\n\n.tab-item .icon {\n  display: block;\n  margin: 0 auto;\n  height: $tabs-icon-size;\n  font-size: $tabs-icon-size;\n}\n\n.tabs-icon-left.tabs .tab-item,\n.tabs-icon-left > .tabs .tab-item,\n.tabs-icon-right.tabs .tab-item,\n.tabs-icon-right > .tabs .tab-item {\n  font-size: $tabs-text-font-size-side-icon;\n\n  .icon {\n    display: inline-block;\n    vertical-align: top;\n    margin-top: -.1em;\n\n    &:before {\n    font-size: $tabs-icon-size - 8;\n    line-height: $tabs-height;\n    }\n  }\n}\n\n.tabs-icon-left > .tabs .tab-item .icon,\n.tabs-icon-left.tabs .tab-item .icon {\n  padding-right: 3px;\n}\n\n.tabs-icon-right > .tabs .tab-item .icon,\n.tabs-icon-right.tabs .tab-item .icon {\n  padding-left: 3px;\n}\n\n.tabs-icon-only > .tabs .icon,\n.tabs-icon-only.tabs .icon {\n  line-height: inherit;\n}\n\n\n.tab-item.has-badge {\n  position: relative;\n}\n\n.tab-item .badge {\n  position: absolute;\n  top: 4%;\n  right: 33%; // fallback\n  right: calc(50% - 26px);\n  padding: $tabs-badge-padding;\n  height: auto;\n  font-size: $tabs-badge-font-size;\n  line-height: $tabs-badge-font-size + 4;\n}\n\n\n/* Navigational tab */\n\n/* Active state for tab */\n.tab-item.tab-item-active,\n.tab-item.active,\n.tab-item.activated {\n  opacity: 1;\n\n  &.tab-item-light {\n    color: $light;\n  }\n  &.tab-item-stable {\n    color: $stable;\n  }\n  &.tab-item-positive {\n    color: $positive;\n  }\n  &.tab-item-calm {\n    color: $calm;\n  }\n  &.tab-item-assertive {\n    color: $assertive;\n  }\n  &.tab-item-balanced {\n    color: $balanced;\n  }\n  &.tab-item-energized {\n    color: $energized;\n  }\n  &.tab-item-royal {\n    color: $royal;\n  }\n  &.tab-item-dark {\n    color: $dark;\n  }\n}\n\n.item.tabs {\n  @include display-flex();\n  padding: 0;\n\n  .icon:before {\n    position: relative;\n  }\n}\n\n.tab-item.disabled,\n.tab-item[disabled] {\n  opacity: .4;\n  cursor: default;\n  pointer-events: none;\n}\n\n/** Platform styles **/\n\n.tab-item.tab-item-ios {\n}\n.tab-item.tab-item-android {\n  border-top: 2px solid inherit;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_toggle.scss",
    "content": "\n/**\n * Toggle\n * --------------------------------------------------\n */\n\n.item-toggle {\n  pointer-events: none;\n}\n\n.toggle {\n  // set the color defaults\n  @include toggle-style($toggle-on-default-border, $toggle-on-default-bg);\n\n  position: relative;\n  display: inline-block;\n  pointer-events: auto;\n  margin: -$toggle-hit-area-expansion;\n  padding: $toggle-hit-area-expansion;\n\n  &.dragging {\n    .handle {\n      background-color: $toggle-handle-dragging-bg-color !important;\n    }\n  }\n\n  &.toggle-light  {\n    @include toggle-style($toggle-on-light-border, $toggle-on-light-bg);\n  }\n  &.toggle-stable  {\n    @include toggle-style($toggle-on-stable-border, $toggle-on-stable-bg);\n  }\n  &.toggle-positive  {\n    @include toggle-style($toggle-on-positive-border, $toggle-on-positive-bg);\n  }\n  &.toggle-calm  {\n    @include toggle-style($toggle-on-calm-border, $toggle-on-calm-bg);\n  }\n  &.toggle-assertive  {\n    @include toggle-style($toggle-on-assertive-border, $toggle-on-assertive-bg);\n  }\n  &.toggle-balanced  {\n    @include toggle-style($toggle-on-balanced-border, $toggle-on-balanced-bg);\n  }\n  &.toggle-energized  {\n    @include toggle-style($toggle-on-energized-border, $toggle-on-energized-bg);\n  }\n  &.toggle-royal  {\n    @include toggle-style($toggle-on-royal-border, $toggle-on-royal-bg);\n  }\n  &.toggle-dark  {\n    @include toggle-style($toggle-on-dark-border, $toggle-on-dark-bg);\n  }\n}\n\n.toggle input {\n  // hide the actual input checkbox\n  display: none;\n}\n\n/* the track appearance when the toggle is \"off\" */\n.toggle .track {\n  @include transition-timing-function(ease-in-out);\n  @include transition-duration($toggle-transition-duration);\n  @include transition-property((background-color, border));\n\n  display: inline-block;\n  box-sizing: border-box;\n  width: $toggle-width;\n  height: $toggle-height;\n  border: solid $toggle-border-width $toggle-off-border-color;\n  border-radius: $toggle-border-radius;\n  background-color: $toggle-off-bg-color;\n  content: ' ';\n  cursor: pointer;\n  pointer-events: none;\n}\n\n/* Fix to avoid background color bleeding */\n/* (occured on (at least) Android 4.2, Asus MeMO Pad HD7 ME173X) */\n.platform-android4_2 .toggle .track {\n  -webkit-background-clip: padding-box;\n}\n\n/* the handle (circle) thats inside the toggle's track area */\n/* also the handle's appearance when it is \"off\" */\n.toggle .handle {\n  @include transition($toggle-transition-duration ease-in-out);\n  position: absolute;\n  display: block;\n  width: $toggle-handle-width;\n  height: $toggle-handle-height;\n  border-radius: $toggle-handle-radius;\n  background-color: $toggle-handle-off-bg-color;\n  top: $toggle-border-width + $toggle-hit-area-expansion;\n  left: $toggle-border-width + $toggle-hit-area-expansion;\n\n  &:before {\n    // used to create a larger (but hidden) hit area to slide the handle\n    position: absolute;\n    top: -4px;\n    left: ( ($toggle-handle-width / 2) * -1) - 8;\n    padding: ($toggle-handle-height / 2) + 5 ($toggle-handle-width + 7);\n    content: \" \";\n  }\n}\n\n.toggle input:checked + .track .handle {\n  // the handle when the toggle is \"on\"\n  @include translate3d($toggle-width - $toggle-handle-width - ($toggle-border-width * 2), 0, 0);\n  background-color: $toggle-handle-on-bg-color;\n}\n\n.item-toggle.active {\n  box-shadow: none;\n}\n\n.item-toggle,\n.item-toggle.item-complex .item-content {\n  // make sure list item content have enough padding on right to fit the toggle\n  padding-right: ($item-padding * 3) + $toggle-width;\n}\n\n.item-toggle.item-complex {\n  padding-right: 0;\n}\n\n.item-toggle .toggle {\n  // position the toggle to the right within a list item\n  position: absolute;\n  top: $item-padding / 2;\n  right: $item-padding;\n  z-index: $z-index-item-toggle;\n}\n\n.toggle input:disabled + .track {\n  opacity: .6;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_type.scss",
    "content": "\n/**\n * Typography\n * --------------------------------------------------\n */\n\n\n// Body text\n// -------------------------\n\np {\n  margin: 0 0 ($line-height-computed / 2);\n}\n\n\n// Emphasis & misc\n// -------------------------\n\nsmall   { font-size: 85%; }\ncite    { font-style: normal; }\n\n\n// Alignment\n// -------------------------\n\n.text-left           { text-align: left; }\n.text-right          { text-align: right; }\n.text-center         { text-align: center; }\n\n\n// Headings\n// -------------------------\n\nh1, h2, h3, h4, h5, h6,\n.h1, .h2, .h3, .h4, .h5, .h6 {\n  color: $base-color;\n  font-weight: $headings-font-weight;\n  font-family: $headings-font-family;\n  line-height: $headings-line-height;\n\n  small {\n    font-weight: normal;\n    line-height: 1;\n  }\n}\n\nh1, .h1,\nh2, .h2,\nh3, .h3 {\n  margin-top: $line-height-computed;\n  margin-bottom: ($line-height-computed / 2);\n\n  &:first-child {\n    margin-top: 0;\n  }\n\n  + h1, + .h1,\n  + h2, + .h2,\n  + h3, + .h3 {\n    margin-top: ($line-height-computed / 2);\n  }\n}\n\nh4, .h4,\nh5, .h5,\nh6, .h6 {\n  margin-top: ($line-height-computed / 2);\n  margin-bottom: ($line-height-computed / 2);\n}\n\nh1, .h1 { font-size: floor($font-size-base * 2.60); } // ~36px\nh2, .h2 { font-size: floor($font-size-base * 2.15); } // ~30px\nh3, .h3 { font-size: ceil($font-size-base * 1.70); } // ~24px\nh4, .h4 { font-size: ceil($font-size-base * 1.25); } // ~18px\nh5, .h5 { font-size:  $font-size-base; }\nh6, .h6 { font-size: ceil($font-size-base * 0.85); } // ~12px\n\nh1 small, .h1 small { font-size: ceil($font-size-base * 1.70); } // ~24px\nh2 small, .h2 small { font-size: ceil($font-size-base * 1.25); } // ~18px\nh3 small, .h3 small,\nh4 small, .h4 small { font-size: $font-size-base; }\n\n\n// Description Lists\n// -------------------------\n\ndl {\n  margin-bottom: $line-height-computed;\n}\ndt,\ndd {\n  line-height: $line-height-base;\n}\ndt {\n  font-weight: bold;\n}\n\n\n// Blockquotes\n// -------------------------\n\nblockquote {\n  margin: 0 0 $line-height-computed;\n  padding: ($line-height-computed / 2) $line-height-computed;\n  border-left: 5px solid gray;\n  \n  p {\n    font-weight: 300;\n    font-size: ($font-size-base * 1.25);\n    line-height: 1.25;\n  }\n  \n  p:last-child {\n    margin-bottom: 0;\n  }\n\n  small {\n    display: block;\n    line-height: $line-height-base;\n    &:before {\n      content: '\\2014 \\00A0';// EM DASH, NBSP;\n    }\n  }\n}\n\n\n// Quotes\n// -------------------------\n\nq:before,\nq:after,\nblockquote:before,\nblockquote:after {\n  content: \"\";\n}\n\n\n// Addresses\n// -------------------------\n\naddress {\n  display: block;\n  margin-bottom: $line-height-computed;\n  font-style: normal;\n  line-height: $line-height-base;\n}\n\n\n// Links\n// -------------------------\n\na.subdued {\n  padding-right: 10px;\n  color: #888;\n  text-decoration: none;\n\n  &:hover {\n    text-decoration: none;\n  }\n  &:last-child {\n    padding-right: 0;\n  }\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_util.scss",
    "content": "\n/**\n * Utility Classes\n * --------------------------------------------------\n */\n\n.hide {\n  display: none;\n}\n.opacity-hide {\n  opacity: 0;\n}\n.grade-b .opacity-hide,\n.grade-c .opacity-hide {\n  opacity: 1;\n  display: none;\n}\n.show {\n  display: block;\n}\n.opacity-show {\n  opacity: 1;\n}\n.invisible {\n  visibility: hidden;\n}\n\n.keyboard-open .hide-on-keyboard-open {\n  display: none;\n}\n\n.keyboard-open .tabs.hide-on-keyboard-open + .pane .has-tabs,\n.keyboard-open .bar-footer.hide-on-keyboard-open + .pane .has-footer {\n  bottom: 0;\n}\n\n.inline {\n  display: inline-block;\n}\n\n.disable-pointer-events {\n  pointer-events: none;\n}\n\n.enable-pointer-events {\n  pointer-events: auto;\n}\n\n.disable-user-behavior {\n  // used to prevent the browser from doing its native behavior. this doesnt\n  // prevent the scrolling, but cancels the contextmenu, tap highlighting, etc\n\n  @include user-select(none);\n  @include touch-callout(none);\n  @include tap-highlight-transparent();\n\n  -webkit-user-drag: none;\n\n  -ms-touch-action: none;\n  -ms-content-zooming: none;\n}\n\n// Fill the screen to block clicks (a better pointer-events: none) for the body\n// to avoid full-page reflows and paints which can cause flickers\n.click-block {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: $z-index-click-block;\n  width: 100%;\n  height: 100%;\n  background: transparent;\n}\n\n.no-resize {\n  resize: none;\n}\n\n.block {\n  display: block;\n  clear: both;\n  &:after {\n    display: block;\n    visibility: hidden;\n    clear: both;\n    height: 0;\n    content: \".\";\n  }\n}\n\n.full-image {\n  width: 100%;\n}\n\n.clearfix {\n  *zoom: 1;\n  &:before,\n  &:after {\n    display: table;\n    content: \"\";\n    // Fixes Opera/contenteditable bug:\n    // http://nicolasgallagher.com/micro-clearfix-hack/#comment-36952\n    line-height: 0;\n  }\n  &:after {\n    clear: both;\n  }\n}\n\n/**\n * Content Padding\n * --------------------------------------------------\n */\n\n.padding {\n  padding: $content-padding;\n}\n\n.padding-top,\n.padding-vertical {\n  padding-top: $content-padding;\n}\n\n.padding-right,\n.padding-horizontal {\n  padding-right: $content-padding;\n}\n\n.padding-bottom,\n.padding-vertical {\n  padding-bottom: $content-padding;\n}\n\n.padding-left,\n.padding-horizontal {\n  padding-left: $content-padding;\n}\n\n\n/**\n * Rounded\n * --------------------------------------------------\n */\n\n.rounded {\n  border-radius: $border-radius-base;\n}\n\n\n/**\n * Utility Colors\n * --------------------------------------------------\n * Utility colors are added to help set a naming convention. You'll\n * notice we purposely do not use words like \"red\" or \"blue\", but\n * instead have colors which represent an emotion or generic theme.\n */\n\n.light, a.light {\n  color: $light;\n}\n.light-bg {\n  background-color: $light;\n}\n.light-border {\n  border-color: $button-light-border;\n}\n\n.stable, a.stable {\n  color: $stable;\n}\n.stable-bg {\n  background-color: $stable;\n}\n.stable-border {\n  border-color: $button-stable-border;\n}\n\n.positive, a.positive {\n  color: $positive;\n}\n.positive-bg {\n  background-color: $positive;\n}\n.positive-border {\n  border-color: $button-positive-border;\n}\n\n.calm, a.calm {\n  color: $calm;\n}\n.calm-bg {\n  background-color: $calm;\n}\n.calm-border {\n  border-color: $button-calm-border;\n}\n\n.assertive, a.assertive {\n  color: $assertive;\n}\n.assertive-bg {\n  background-color: $assertive;\n}\n.assertive-border {\n  border-color: $button-assertive-border;\n}\n\n.balanced, a.balanced {\n  color: $balanced;\n}\n.balanced-bg {\n  background-color: $balanced;\n}\n.balanced-border {\n  border-color: $button-balanced-border;\n}\n\n.energized, a.energized {\n  color: $energized;\n}\n.energized-bg {\n  background-color: $energized;\n}\n.energized-border {\n  border-color: $button-energized-border;\n}\n\n.royal, a.royal {\n  color: $royal;\n}\n.royal-bg {\n  background-color: $royal;\n}\n.royal-border {\n  border-color: $button-royal-border;\n}\n\n.dark, a.dark {\n  color: $dark;\n}\n.dark-bg {\n  background-color: $dark;\n}\n.dark-border {\n  border-color: $button-dark-border;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/_variables.scss",
    "content": "\n// Colors\n// -------------------------------\n\n$light:                           #fff !default;\n$stable:                          #f8f8f8 !default;\n$positive:                        #4a87ee !default;\n$calm:                            #43cee6 !default;\n$balanced:                        #66cc33 !default;\n$energized:                       #f0b840 !default;\n$assertive:                       #ef4e3a !default;\n$royal:                           #8a6de9 !default;\n$dark:                            #444 !default;\n\n\n// Base\n// -------------------------------\n\n$font-family-sans-serif:          \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif !default;\n$font-family-light-sans-serif:    \"Helvetica Neue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif !default;\n$font-family-serif:               Georgia, \"Times New Roman\", Times, serif !default;\n$font-family-monospace:           Monaco, Menlo, Consolas, \"Courier New\", monospace !default;\n\n$font-family-base:                $font-family-sans-serif !default;\n$font-size-base:                  14px !default;\n$font-size-large:                 18px !default;\n$font-size-small:                 11px !default;\n\n$line-height-base:                1.428571429 !default; // 20/14\n$line-height-computed:            floor($font-size-base * $line-height-base) !default; // ~20px\n$line-height-large:               1.33 !default;\n$line-height-small:               1.5 !default;\n\n$headings-font-family:            $font-family-base !default;\n$headings-font-weight:            500 !default;\n$headings-line-height:            1.2 !default;\n\n$base-background-color:           #fff !default;\n$base-color:                      #000 !default;\n\n$link-color:                      $positive !default;\n$link-hover-color:                darken($link-color, 15%) !default;\n\n$content-padding:                 10px !default;\n\n$padding-base-vertical:           6px !default;\n$padding-base-horizontal:         12px !default;\n\n$padding-large-vertical:          10px !default;\n$padding-large-horizontal:        16px !default;\n\n$padding-small-vertical:          5px !default;\n$padding-small-horizontal:        10px !default;\n\n$border-radius-base:              4px !default;\n$border-radius-large:             6px !default;\n$border-radius-small:             3px !default;\n\n\n// Content\n// -------------------------------\n\n$scroll-refresh-icon-color:       #666666 !default;\n\n\n// Buttons\n// -------------------------------\n\n$button-color:                    #222 !default;\n$button-block-margin:             10px !default;\n$button-clear-padding:            6px !default;\n$button-border-radius:            2px !default;\n$button-border-width:             1px !default;\n\n$button-font-size:                16px !default;\n$button-height:                   42px !default;\n$button-padding:                  12px !default;\n$button-icon-size:                24px !default;\n\n$button-large-font-size:          20px !default;\n$button-large-height:             54px !default;\n$button-large-padding:            16px !default;\n$button-large-icon-size:          32px !default;\n\n$button-small-font-size:          12px !default;\n$button-small-height:             28px !default;\n$button-small-padding:            4px !default;\n$button-small-icon-size:          16px !default;\n\n$button-bar-button-font-size:     13px !default;\n$button-bar-button-height:        32px !default;\n$button-bar-button-padding:       8px !default;\n$button-bar-button-icon-size:     20px !default;\n\n$button-light-bg:                 $light !default;\n$button-light-text:               #444 !default;\n$button-light-border:             #ddd !default;\n$button-light-active-bg:          #fafafa !default;\n$button-light-active-border:      #ccc !default;\n\n$button-stable-bg:                $stable !default;\n$button-stable-text:              #444 !default;\n$button-stable-border:            #b2b2b2 !default;\n$button-stable-active-bg:         #e5e5e5 !default;\n$button-stable-active-border:     #a2a2a2 !default;\n\n$button-positive-bg:              $positive !default;\n$button-positive-text:            #fff !default;\n$button-positive-border:          darken($positive, 15%) !default;\n$button-positive-active-bg:       darken($positive, 15%) !default;\n$button-positive-active-border:   darken($positive, 15%) !default;\n\n$button-calm-bg:                  $calm !default;\n$button-calm-text:                #fff !default;\n$button-calm-border:              darken($calm, 15%) !default;\n$button-calm-active-bg:           darken($calm, 15%) !default;\n$button-calm-active-border:       darken($calm, 15%) !default;\n\n$button-assertive-bg:             $assertive !default;\n$button-assertive-text:           #fff !default;\n$button-assertive-border:         darken($assertive, 15%) !default;\n$button-assertive-active-bg:      darken($assertive, 15%) !default;\n$button-assertive-active-border:  darken($assertive, 15%) !default;\n\n$button-balanced-bg:              $balanced !default;\n$button-balanced-text:            #fff !default;\n$button-balanced-border:          darken($balanced, 15%) !default;\n$button-balanced-active-bg:       darken($balanced, 15%) !default;\n$button-balanced-active-border:   darken($balanced, 15%) !default;\n\n$button-energized-bg:             $energized !default;\n$button-energized-text:           #fff !default;\n$button-energized-border:         darken($energized, 15%) !default;\n$button-energized-active-bg:      darken($energized, 15%) !default;\n$button-energized-active-border:  darken($energized, 15%) !default;\n\n$button-royal-bg:                 $royal !default;\n$button-royal-text:               #fff !default;\n$button-royal-border:             darken($royal, 15%) !default;\n$button-royal-active-bg:          darken($royal, 15%) !default;\n$button-royal-active-border:      darken($royal, 15%) !default;\n\n$button-dark-bg:                  $dark !default;\n$button-dark-text:                #fff !default;\n$button-dark-border:              #111 !default;\n$button-dark-active-bg:           #262626 !default;\n$button-dark-active-border:       #000 !default;\n\n$button-default-bg:               $button-stable-bg !default;\n$button-default-text:             $button-stable-text !default;\n$button-default-border:           $button-stable-border !default;\n$button-default-active-bg:        $button-stable-active-bg !default;\n$button-default-active-border:    $button-stable-active-border !default;\n\n\n// Bars\n// -------------------------------\n\n$bar-height:                      44px !default;\n$bar-title-font-size:             17px !default;\n$bar-padding-portrait:            5px !default;\n$bar-padding-landscape:           5px !default;\n$bar-transparency:                1 !default;\n\n$bar-light-bg:                    rgba($button-light-bg, $bar-transparency) !default;\n$bar-light-text:                  $button-light-text !default;\n$bar-light-border:                $button-light-border !default;\n$bar-light-active-bg:             $button-light-active-bg !default;\n$bar-light-active-border:         $button-light-active-border !default;\n\n$bar-stable-bg:                   rgba($button-stable-bg, $bar-transparency) !default;\n$bar-stable-text:                 $button-stable-text !default;\n$bar-stable-border:               $button-stable-border !default;\n$bar-stable-active-bg:            $button-stable-active-bg !default;\n$bar-stable-active-border:        $button-stable-active-border !default;\n\n$bar-positive-bg:                 rgba($button-positive-bg, $bar-transparency) !default;\n$bar-positive-text:               $button-positive-text !default;\n$bar-positive-border:             $button-positive-border !default;\n$bar-positive-active-bg:          $button-positive-active-bg !default;\n$bar-positive-active-border:      $button-positive-active-border !default;\n\n$bar-calm-bg:                     rgba($button-calm-bg, $bar-transparency) !default;\n$bar-calm-text:                   $button-calm-text !default;\n$bar-calm-border:                 $button-calm-border !default;\n$bar-calm-active-bg:              $button-calm-active-bg !default;\n$bar-calm-active-border:          $button-calm-active-border !default;\n\n$bar-assertive-bg:                rgba($button-assertive-bg, $bar-transparency) !default;\n$bar-assertive-text:              $button-assertive-text !default;\n$bar-assertive-border:            $button-assertive-border !default;\n$bar-assertive-active-bg:         $button-assertive-active-bg !default;\n$bar-assertive-active-border:     $button-assertive-active-border !default;\n\n$bar-balanced-bg:                 rgba($button-balanced-bg, $bar-transparency) !default;\n$bar-balanced-text:               $button-balanced-text !default;\n$bar-balanced-border:             $button-balanced-border !default;\n$bar-balanced-active-bg:          $button-balanced-active-bg !default;\n$bar-balanced-active-border:      $button-balanced-active-border !default;\n\n$bar-energized-bg:                rgba($button-energized-bg, $bar-transparency) !default;\n$bar-energized-text:              $button-energized-text !default;\n$bar-energized-border:            $button-energized-border !default;\n$bar-energized-active-bg:         $button-energized-active-bg !default;\n$bar-energized-active-border:     $button-energized-active-border !default;\n\n$bar-royal-bg:                    rgba($button-royal-bg, $bar-transparency) !default;\n$bar-royal-text:                  $button-royal-text !default;\n$bar-royal-border:                $button-royal-border !default;\n$bar-royal-active-bg:             $button-royal-active-bg !default;\n$bar-royal-active-border:         $button-royal-active-border !default;\n\n$bar-dark-bg:                     rgba($button-dark-bg, $bar-transparency) !default;\n$bar-dark-text:                   $button-dark-text !default;\n$bar-dark-border:                 $button-dark-border !default;\n$bar-dark-active-bg:              $button-dark-active-bg !default;\n$bar-dark-active-border:          $button-dark-active-border !default;\n\n$bar-default-bg:                  $bar-light-bg !default;\n$bar-default-text:                $bar-light-text !default;\n$bar-default-border:              $bar-light-border !default;\n$bar-default-active-bg:           $bar-light-active-bg !default;\n$bar-default-active-border:       $bar-light-active-border !default;\n\n\n// Tabs\n// -------------------------------\n\n$tabs-height:                     49px !default;\n$tabs-text-font-size:             14px !default;\n$tabs-text-font-size-side-icon:   12px !default;\n$tabs-icon-size:                  32px !default;\n$tabs-badge-padding:              1px 6px !default;\n$tabs-badge-font-size:            12px !default;\n$tabs-text-font-size:             14px !default;\n\n$tabs-light-bg:                   $button-light-bg !default;\n$tabs-light-border:               $button-light-border !default;\n$tabs-light-text:                 $button-light-text !default;\n\n$tabs-stable-bg:                  $button-stable-bg !default;\n$tabs-stable-border:              $button-stable-border !default;\n$tabs-stable-text:                $button-stable-text !default;\n\n$tabs-positive-bg:                $button-positive-bg !default;\n$tabs-positive-border:            $button-positive-border !default;\n$tabs-positive-text:              $button-positive-text !default;\n\n$tabs-calm-bg:                    $button-calm-bg !default;\n$tabs-calm-border:                $button-calm-border !default;\n$tabs-calm-text:                  $button-calm-text !default;\n\n$tabs-assertive-bg:               $button-assertive-bg !default;\n$tabs-assertive-border:           $button-assertive-border !default;\n$tabs-assertive-text:             $button-assertive-text !default;\n\n$tabs-balanced-bg:                $button-balanced-bg !default;\n$tabs-balanced-border:            $button-balanced-border !default;\n$tabs-balanced-text:              $button-balanced-text !default;\n\n$tabs-energized-bg:               $button-energized-bg !default;\n$tabs-energized-border:           $button-energized-border !default;\n$tabs-energized-text:             $button-energized-text !default;\n\n$tabs-royal-bg:                   $button-royal-bg !default;\n$tabs-royal-border:               $button-royal-border !default;\n$tabs-royal-text:                 $button-royal-text !default;\n\n$tabs-dark-bg:                    $button-dark-bg !default;\n$tabs-dark-border:                $button-dark-border !default;\n$tabs-dark-text:                  $button-dark-text !default;\n\n$tabs-default-bg:                 $tabs-stable-bg !default;\n$tabs-default-border:             $tabs-stable-border !default;\n$tabs-default-text:               $tabs-stable-text !default;\n\n$tab-item-max-width:              150px !default;\n\n$tabs-striped-off-color: #000;\n$tabs-striped-off-opacity: 0.4;\n$tabs-striped-border-width: 2px;\n\n\n// Items\n// -------------------------------\n\n$item-font-size:                  16px !default;\n$item-border-width:               1px !default;\n$item-padding:                    16px !default;\n\n$item-button-font-size:           18px !default;\n$item-button-line-height:         32px !default;\n$item-icon-font-size:             32px !default;\n$item-icon-fill-font-size:        28px !default;\n\n$item-icon-accessory-color:       #ccc !default;\n$item-icon-accessory-font-size:   16px !default;\n\n$item-avatar-width:               40px !default;\n$item-avatar-height:              40px !default;\n$item-avatar-border-radius:       4px !default;\n\n$item-thumbnail-width:            80px !default;\n$item-thumbnail-height:           80px !default;\n$item-thumbnail-margin:           10px !default;\n\n$item-divider-bg:                 #f5f5f5 !default;\n$item-divider-color:              #222 !default;\n$item-divider-padding:            5px 15px !default;\n\n$item-light-bg:                   $button-light-bg !default;\n$item-light-border:               $button-light-border !default;\n$item-light-text:                 $button-light-text !default;\n$item-light-active-bg:            $button-light-active-bg !default;\n$item-light-active-border:        $button-light-active-border !default;\n\n$item-stable-bg:                  $button-stable-bg !default;\n$item-stable-border:              $button-stable-border !default;\n$item-stable-text:                $button-stable-text !default;\n$item-stable-active-bg:           $button-stable-active-bg !default;\n$item-stable-active-border:       $button-stable-active-border !default;\n\n$item-positive-bg:                $button-positive-bg !default;\n$item-positive-border:            $button-positive-border !default;\n$item-positive-text:              $button-positive-text !default;\n$item-positive-active-bg:         $button-positive-active-bg !default;\n$item-positive-active-border:     $button-positive-active-border !default;\n\n$item-calm-bg:                    $button-calm-bg !default;\n$item-calm-border:                $button-calm-border !default;\n$item-calm-text:                  $button-calm-text !default;\n$item-calm-active-bg:             $button-calm-active-bg !default;\n$item-calm-active-border:         $button-calm-active-border !default;\n\n$item-assertive-bg:               $button-assertive-bg !default;\n$item-assertive-border:           $button-assertive-border !default;\n$item-assertive-text:             $button-assertive-text !default;\n$item-assertive-active-bg:        $button-assertive-active-bg !default;\n$item-assertive-active-border:    $button-assertive-active-border !default;\n\n$item-balanced-bg:                $button-balanced-bg !default;\n$item-balanced-border:            $button-balanced-border !default;\n$item-balanced-text:              $button-balanced-text !default;\n$item-balanced-active-bg:         $button-balanced-active-bg !default;\n$item-balanced-active-border:     $button-balanced-active-border !default;\n\n$item-energized-bg:               $button-energized-bg !default;\n$item-energized-border:           $button-energized-border !default;\n$item-energized-text:             $button-energized-text !default;\n$item-energized-active-bg:        $button-energized-active-bg !default;\n$item-energized-active-border:    $button-energized-active-border !default;\n\n$item-royal-bg:                   $button-royal-bg !default;\n$item-royal-border:               $button-royal-border !default;\n$item-royal-text:                 $button-royal-text !default;\n$item-royal-active-bg:            $button-royal-active-bg !default;\n$item-royal-active-border:        $button-royal-active-border !default;\n\n$item-dark-bg:                    $button-dark-bg !default;\n$item-dark-border:                $button-dark-border !default;\n$item-dark-text:                  $button-dark-text !default;\n$item-dark-active-bg:             $button-dark-active-bg !default;\n$item-dark-active-border:         $button-dark-active-border !default;\n\n$item-default-bg:                 $item-light-bg !default;\n$item-default-border:             $item-light-border !default;\n$item-default-text:               $item-light-text !default;\n$item-default-active-bg:          #D9D9D9 !default;\n$item-default-active-border:      $item-light-active-border !default;\n\n\n// Item Editing\n// -------------------------------\n\n$item-edit-transition-duration:   250ms !default;\n$item-edit-transition-function:   ease-in-out !default;\n\n$item-left-edit-left:             8px !default;  // item's left side edit's \"left\" property\n\n$item-right-edit-open-width:      50px !default;\n$item-left-edit-open-width:       50px !default;\n\n$item-delete-icon-size:           24px !default;\n$item-delete-icon-color:          $assertive !default;\n\n$item-reorder-icon-size:          32px !default;\n$item-reorder-icon-color:         $dark !default;\n\n\n// Lists\n// -------------------------------\n\n$list-header-bg:                  transparent !default;\n$list-header-color:               #222 !default;\n$list-header-padding:             5px 15px !default;\n$list-header-margin-top:          20px !default;\n\n\n// Cards\n// -------------------------------\n\n$card-header-bg:                  #F5F5F5 !default;\n$card-body-bg:                    #fff !default;\n$card-footer-bg:                  #F5F5F5 !default;\n\n$card-padding:                    10px !default;\n$card-border-width:               1px !default;\n\n$card-border-color:               #ccc !default;\n$card-border-radius:              2px !default;\n\n\n// Forms\n// -------------------------------\n\n$input-height-base:               ($line-height-computed + ($padding-base-vertical * 2) + 2) !default;\n$input-height-large:              (floor($font-size-large * $line-height-large) + ($padding-large-vertical * 2) + 2) !default;\n$input-height-small:              (floor($font-size-small * $line-height-small) + ($padding-small-vertical * 2) + 2) !default;\n\n$input-bg:                        $light !default;\n$input-bg-disabled:               $stable !default;\n\n$input-color:                     #111 !default;\n$input-border:                    $item-default-border !default;\n$input-border-width:              $item-border-width !default;\n$input-label-color:               $dark !default;\n$input-color-placeholder:         lighten($dark, 40%) !default;\n\n\n// Progress\n// -------------------------------\n\n$progress-width:                  100% !default;\n$progress-margin:                 15px auto !default;\n\n\n// Toggle\n// -------------------------------\n\n$toggle-width:                    54px !default;\n$toggle-height:                   32px !default;\n$toggle-border-width:             2px !default;\n$toggle-border-radius:            20px !default;\n\n$toggle-handle-width:             $toggle-height - ($toggle-border-width * 2) !default;\n$toggle-handle-height:            $toggle-handle-width !default;\n$toggle-handle-radius:            $toggle-handle-width !default;\n$toggle-handle-dragging-bg-color: darken(#fff, 5%) !default;\n\n$toggle-off-bg-color:             #E5E5E5 !default;\n$toggle-off-border-color:         #E5E5E5 !default;\n\n$toggle-on-light-bg:              $button-light-border !default;\n$toggle-on-light-border:          $toggle-on-light-bg !default;\n$toggle-on-stable-bg:             $button-stable-border !default;\n$toggle-on-stable-border:         $toggle-on-stable-bg !default;\n$toggle-on-positive-bg:           $positive !default;\n$toggle-on-positive-border:       $toggle-on-positive-bg !default;\n$toggle-on-calm-bg:               $calm !default;\n$toggle-on-calm-border:           $toggle-on-calm-bg !default;\n$toggle-on-assertive-bg:          $assertive !default;\n$toggle-on-assertive-border:      $toggle-on-assertive-bg !default;\n$toggle-on-balanced-bg:           $balanced !default;\n$toggle-on-balanced-border:       $toggle-on-balanced-bg !default;\n$toggle-on-energized-bg:          $energized !default;\n$toggle-on-energized-border:      $toggle-on-energized-bg !default;\n$toggle-on-royal-bg:              $royal !default;\n$toggle-on-royal-border:          $toggle-on-royal-bg !default;\n$toggle-on-dark-bg:               $dark !default;\n$toggle-on-dark-border:           $toggle-on-dark-bg !default;\n$toggle-on-default-bg:            $positive !default;\n$toggle-on-default-border:        $toggle-on-default-bg !default;\n\n$toggle-handle-off-bg-color:      $light !default;\n$toggle-handle-on-bg-color:       $toggle-handle-off-bg-color !default;\n\n$toggle-transition-duration:      .2s !default;\n\n$toggle-hit-area-expansion:   5px;\n\n\n// Checkbox\n// -------------------------------\n\n$checkbox-width:                  28px !default;\n$checkbox-height:                 28px !default;\n$checkbox-border-radius:          $checkbox-width !default;\n$checkbox-border-width:           1px !default;\n\n$checkbox-off-bg-color:           #fff !default;\n$checkbox-off-border-light:       $button-light-border !default;\n$checkbox-on-bg-light:            $button-light-border !default;\n$checkbox-off-border-stable:      $button-stable-border !default;\n$checkbox-on-bg-stable:           $button-stable-border !default;\n$checkbox-off-border-positive:    $positive !default;\n$checkbox-on-bg-positive:         $positive !default;\n$checkbox-off-border-calm:        $calm !default;\n$checkbox-on-bg-calm:             $calm !default;\n$checkbox-off-border-assertive:   $assertive !default;\n$checkbox-on-bg-assertive:        $assertive !default;\n$checkbox-off-border-balanced:    $balanced !default;\n$checkbox-on-bg-balanced:         $balanced !default;\n$checkbox-off-border-energized:   $energized !default;\n$checkbox-on-bg-energized:        $energized !default;\n$checkbox-off-border-royal:       $royal !default;\n$checkbox-on-bg-royal:            $royal !default;\n$checkbox-off-border-dark:        $dark !default;\n$checkbox-on-bg-dark:             $dark !default;\n$checkbox-off-border-default:     $positive !default;\n$checkbox-on-bg-default:          $positive !default;\n\n$checkbox-check-width:            3px !default;\n$checkbox-check-color:            #fff !default;\n\n\n// Range\n// -------------------------------\n\n$range-track-height:              4px !default;\n$range-slider-width:              20px !default;\n$range-slider-height:             20px !default;\n$range-slider-border-radius:      10px !default;\n$range-icon-size:                 24px !default;\n\n$range-light-track-bg:            $button-light-border !default;\n$range-stable-track-bg:           $button-stable-border !default;\n$range-positive-track-bg:         $button-positive-bg !default;\n$range-calm-track-bg:             $button-calm-bg !default;\n$range-balanced-track-bg:         $button-balanced-bg !default;\n$range-assertive-track-bg:        $button-assertive-bg !default;\n$range-energized-track-bg:        $button-energized-bg !default;\n$range-royal-track-bg:            $button-royal-bg !default;\n$range-dark-track-bg:             $button-dark-bg !default;\n$range-default-track-bg:          #ccc !default;\n\n\n// Menus\n// -------------------------------\n\n$menu-bg:                         #fff !default;\n$menu-width:                      275px !default;\n$menu-animation-speed:            200ms !default;\n\n$menu-side-shadow:                -1px 0px 2px rgba(0, 0, 0, 0.2), 1px 0px 2px rgba(0,0,0,0.2) !default;\n\n\n// Modals\n// -------------------------------\n\n$modal-bg-color:                  #fff !default;\n$modal-backdrop-bg-active:        rgba(0,0,0,0.5) !default;\n$modal-backdrop-bg-inactive:      rgba(0,0,0,0) !default;\n\n$modal-inset-mode-break-point:    680px !default;  // @media min-width\n$modal-inset-mode-top:            20% !default;\n$modal-inset-mode-right:          20% !default;\n$modal-inset-mode-bottom:         20% !default;\n$modal-inset-mode-left:           20% !default;\n$modal-inset-mode-min-height:     240px !default;\n\n\n// Popovers\n// -------------------------------\n\n$popover-bg-color:                $light !default;\n$popover-backdrop-bg-active:      rgba(0,0,0,0.1) !default;\n$popover-backdrop-bg-inactive:    rgba(0,0,0,0) !default;\n$popover-width:                   220px !default;\n$popover-height:                  280px !default;\n$popover-large-break-point:       680px !default;\n$popover-large-width:             360px !default;\n\n$popover-box-shadow:              0 1px 3px rgba(0,0,0,0.4) !default;\n$popover-border-radius:           2px !default;\n\n$popover-box-shadow-ios:          0 0 40px rgba(0,0,0,0.08) !default;\n$popover-border-radius-ios:       10px !default;\n\n$popover-bg-color-android:        #fafafa !default;\n$popover-box-shadow-android:      0 2px 6px rgba(0,0,0,0.35) !default;\n\n\n// Grids\n// -------------------------------\n\n$grid-padding-width:              10px !default;\n$grid-responsive-sm-break:        567px !default;  // smaller than landscape phone\n$grid-responsive-md-break:        767px !default;  // smaller than portrait tablet\n$grid-responsive-lg-break:        1023px !default; // smaller than landscape tablet\n\n\n// Action Sheets\n// -------------------------------\n\n$sheet-bg-color:                  rgba(255, 255, 255, 0.6) !default;\n$sheet-opacity:                   0.95 !default;\n\n$sheet-border-radius:             3px 3px 3px 3px !default;\n$sheet-border-radius-top:         3px 3px 0px 0px !default;\n$sheet-border-radius-bottom:      0px 0px 3px 3px !default;\n\n\n// Popups\n// -------------------------------\n\n$popup-width:                     250px !default;\n$popup-enter-animation:           superScaleIn !default;\n$popup-enter-animation-duration:  0.2s !default;\n$popup-leave-animation-duration:  0.1s !default;\n\n$popup-border-radius:             0px !default;\n$popup-background-color:          rgba(255,255,255,0.9) !default;\n\n$popup-button-border-radius:      2px !default;\n$popup-button-line-height:        20px !default;\n$popup-button-min-height:         45px !default;\n\n\n// Loading\n// -------------------------------\n\n$loading-text-color:              #fff !default;\n$loading-bg-color:                rgba(0,0,0,0.7) !default;\n$loading-padding:                 20px !default;\n$loading-border-radius:           5px !default;\n$loading-font-size:               15px !default;\n\n$loading-backdrop-fadein-duration:0.3s !default;\n$loading-backdrop-bg-color:       rgba(0,0,0,0.7) !default;\n\n\n// Badges\n// -------------------------------\n\n$badge-font-size:                 14px !default;\n$badge-line-height:               16px !default;\n$badge-font-weight:               bold !default;\n$badge-border-radius:             10px !default;\n\n$badge-light-bg:                  $button-light-bg !default;\n$badge-light-text:                $button-light-text !default;\n\n$badge-stable-bg:                 $button-stable-bg !default;\n$badge-stable-text:               $button-stable-text !default;\n\n$badge-positive-bg:               $button-positive-bg !default;\n$badge-positive-text:             $button-positive-text !default;\n\n$badge-calm-bg:                   $button-calm-bg !default;\n$badge-calm-text:                 $button-calm-text !default;\n\n$badge-balanced-bg:               $button-balanced-bg !default;\n$badge-balanced-text:             $button-balanced-text !default;\n\n$badge-assertive-bg:              $button-assertive-bg !default;\n$badge-assertive-text:            $button-assertive-text !default;\n\n$badge-energized-bg:              $button-energized-bg !default;\n$badge-energized-text:            $button-energized-text !default;\n\n$badge-royal-bg:                  $button-royal-bg !default;\n$badge-royal-text:                $button-royal-text !default;\n\n$badge-dark-bg:                   $button-dark-bg !default;\n$badge-dark-text:                 $button-dark-text !default;\n\n$badge-default-bg:                transparent !default;\n$badge-default-text:              #AAAAAA !default;\n\n\n// Z-Indexes\n// -------------------------------\n\n$z-index-bar-title:               0 !default;\n$z-index-item-drag:               0 !default;\n$z-index-item-edit:               0 !default;\n$z-index-menu:                    0 !default;\n$z-index-badge:                   1 !default;\n$z-index-bar-button:              1 !default;\n$z-index-item-options:            1 !default;\n$z-index-pane:                    1 !default;\n$z-index-slider-pager:            1 !default;\n$z-index-view:                    1 !default;\n$z-index-item:                    2 !default;\n$z-index-item-checkbox:           3 !default;\n$z-index-item-radio:              3 !default;\n$z-index-item-reorder:            3 !default;\n$z-index-item-toggle:             3 !default;\n$z-index-tabs:                    5 !default;\n$z-index-item-reordering:         9 !default;\n$z-index-bar:                     10 !default;\n$z-index-menu-scroll-content:     10 !default;\n$z-index-modal:                   10 !default;\n$z-index-popover:                 10 !default;\n$z-index-action-sheet:            11 !default;\n$z-index-backdrop:                11 !default;\n$z-index-menu-bar-header:         11 !default;\n$z-index-scroll-content-false:    11 !default;\n$z-index-popup:                   12 !default;\n$z-index-loading:                 13 !default;\n$z-index-scroll-bar:              9999 !default;\n$z-index-click-block:             99999 !default;\n\n\n// Platform\n// -------------------------------\n\n$ios-statusbar-height:           20px !default;\n"
  },
  {
    "path": "www/lib/ionic/scss/ionic.scss",
    "content": "@charset \"UTF-8\";\n\n@import\n  // Ionicons\n  \"ionicons/ionicons.scss\",\n\n  // Variables\n  \"mixins\",\n  \"variables\",\n\n  // Base\n  \"reset\",\n  \"scaffolding\",\n  \"type\",\n\n  // Components\n  \"action-sheet\",\n  \"backdrop\",\n  \"bar\",\n  \"tabs\",\n  \"menu\",\n  \"modal\",\n  \"popover\",\n  \"popup\",\n  \"loading\",\n  \"items\",\n  \"list\",\n  \"badge\",\n  \"slide-box\",\n\n  // Forms\n  \"form\",\n  \"checkbox\",\n  \"toggle\",\n  \"radio\",\n  \"range\",\n  \"select\",\n  \"progress\",\n\n  // Buttons\n  \"button\",\n  \"button-bar\",\n\n  // Util\n  \"animations\",\n  \"grid\",\n  \"util\",\n  \"platform\";\n"
  },
  {
    "path": "www/lib/ionic/scss/ionicons/_ionicons-animation.scss",
    "content": "// Animation Icons\n// --------------------------\n\n.#{$ionicons-prefix}spin {\n  -webkit-animation: spin 1s infinite linear;\n  -moz-animation: spin 1s infinite linear;\n  -o-animation: spin 1s infinite linear;\n  animation: spin 1s infinite linear;\n}\n\n@-moz-keyframes spin {\n  0% { -moz-transform: rotate(0deg); }\n  100% { -moz-transform: rotate(359deg); }\n}\n@-webkit-keyframes spin {\n  0% { -webkit-transform: rotate(0deg); }\n  100% { -webkit-transform: rotate(359deg); }\n}\n@-o-keyframes spin {\n  0% { -o-transform: rotate(0deg); }\n  100% { -o-transform: rotate(359deg); }\n}\n@-ms-keyframes spin {\n  0% { -ms-transform: rotate(0deg); }\n  100% { -ms-transform: rotate(359deg); }\n}\n@keyframes spin {\n  0% { transform: rotate(0deg); }\n  100% { transform: rotate(359deg); }\n}\n\n\n.#{$ionicons-prefix}loading-a,\n.#{$ionicons-prefix}loading-b,\n.#{$ionicons-prefix}loading-c,\n.#{$ionicons-prefix}loading-d,\n.#{$ionicons-prefix}looping,\n.#{$ionicons-prefix}refreshing,\n.#{$ionicons-prefix}ios7-reloading {\n  @extend .ion;\n  @extend .#{$ionicons-prefix}spin;\n}\n\n.#{$ionicons-prefix}loading-a {\n  -webkit-animation-timing-function: steps(8, start);\n  -moz-animation-timing-function: steps(8, start);\n  animation-timing-function: steps(8, start);\n}\n\n.#{$ionicons-prefix}loading-a:before { \n  @extend .#{$ionicons-prefix}load-a:before;\n}\n\n.#{$ionicons-prefix}loading-b:before { \n  @extend .#{$ionicons-prefix}load-b:before;\n}\n\n.#{$ionicons-prefix}loading-c:before { \n  @extend .#{$ionicons-prefix}load-c:before;\n}\n\n.#{$ionicons-prefix}loading-d:before { \n  @extend .#{$ionicons-prefix}load-d:before;\n}\n\n.#{$ionicons-prefix}looping:before { \n  @extend .#{$ionicons-prefix}loop:before;\n}\n\n.#{$ionicons-prefix}refreshing:before { \n  @extend .#{$ionicons-prefix}refresh:before;\n}\n\n.#{$ionicons-prefix}ios7-reloading:before { \n  @extend .#{$ionicons-prefix}ios7-reload:before;\n}\n"
  },
  {
    "path": "www/lib/ionic/scss/ionicons/_ionicons-font.scss",
    "content": "// Ionicons Font Path\n// --------------------------\n\n@font-face {\n font-family: $ionicons-font-family;\n src:url(\"#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}\");\n src:url(\"#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}#iefix\") format(\"embedded-opentype\"),\n  url(\"#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}\") format(\"truetype\"),\n  url(\"#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}\") format(\"woff\"),\n  url(\"#{$ionicons-font-path}/ionicons.svg?v=#{$ionicons-version}#Ionicons\") format(\"svg\");\n font-weight: normal;\n font-style: normal;\n}\n\n.ion {\n  display: inline-block;\n  font-family: $ionicons-font-family;\n  speak: none;\n  font-style: normal;\n  font-weight: normal;\n  font-variant: normal;\n  text-transform: none;\n  text-rendering: auto;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}"
  },
  {
    "path": "www/lib/ionic/scss/ionicons/_ionicons-icons.scss",
    "content": "// Ionicons Icons\n// --------------------------\n\n.ionicons,\n.#{$ionicons-prefix}alert:before,\n.#{$ionicons-prefix}alert-circled:before,\n.#{$ionicons-prefix}android-add:before,\n.#{$ionicons-prefix}android-add-contact:before,\n.#{$ionicons-prefix}android-alarm:before,\n.#{$ionicons-prefix}android-archive:before,\n.#{$ionicons-prefix}android-arrow-back:before,\n.#{$ionicons-prefix}android-arrow-down-left:before,\n.#{$ionicons-prefix}android-arrow-down-right:before,\n.#{$ionicons-prefix}android-arrow-forward:before,\n.#{$ionicons-prefix}android-arrow-up-left:before,\n.#{$ionicons-prefix}android-arrow-up-right:before,\n.#{$ionicons-prefix}android-battery:before,\n.#{$ionicons-prefix}android-book:before,\n.#{$ionicons-prefix}android-calendar:before,\n.#{$ionicons-prefix}android-call:before,\n.#{$ionicons-prefix}android-camera:before,\n.#{$ionicons-prefix}android-chat:before,\n.#{$ionicons-prefix}android-checkmark:before,\n.#{$ionicons-prefix}android-clock:before,\n.#{$ionicons-prefix}android-close:before,\n.#{$ionicons-prefix}android-contact:before,\n.#{$ionicons-prefix}android-contacts:before,\n.#{$ionicons-prefix}android-data:before,\n.#{$ionicons-prefix}android-developer:before,\n.#{$ionicons-prefix}android-display:before,\n.#{$ionicons-prefix}android-download:before,\n.#{$ionicons-prefix}android-drawer:before,\n.#{$ionicons-prefix}android-dropdown:before,\n.#{$ionicons-prefix}android-earth:before,\n.#{$ionicons-prefix}android-folder:before,\n.#{$ionicons-prefix}android-forums:before,\n.#{$ionicons-prefix}android-friends:before,\n.#{$ionicons-prefix}android-hand:before,\n.#{$ionicons-prefix}android-image:before,\n.#{$ionicons-prefix}android-inbox:before,\n.#{$ionicons-prefix}android-information:before,\n.#{$ionicons-prefix}android-keypad:before,\n.#{$ionicons-prefix}android-lightbulb:before,\n.#{$ionicons-prefix}android-locate:before,\n.#{$ionicons-prefix}android-location:before,\n.#{$ionicons-prefix}android-mail:before,\n.#{$ionicons-prefix}android-microphone:before,\n.#{$ionicons-prefix}android-mixer:before,\n.#{$ionicons-prefix}android-more:before,\n.#{$ionicons-prefix}android-note:before,\n.#{$ionicons-prefix}android-playstore:before,\n.#{$ionicons-prefix}android-printer:before,\n.#{$ionicons-prefix}android-promotion:before,\n.#{$ionicons-prefix}android-reminder:before,\n.#{$ionicons-prefix}android-remove:before,\n.#{$ionicons-prefix}android-search:before,\n.#{$ionicons-prefix}android-send:before,\n.#{$ionicons-prefix}android-settings:before,\n.#{$ionicons-prefix}android-share:before,\n.#{$ionicons-prefix}android-social:before,\n.#{$ionicons-prefix}android-social-user:before,\n.#{$ionicons-prefix}android-sort:before,\n.#{$ionicons-prefix}android-stair-drawer:before,\n.#{$ionicons-prefix}android-star:before,\n.#{$ionicons-prefix}android-stopwatch:before,\n.#{$ionicons-prefix}android-storage:before,\n.#{$ionicons-prefix}android-system-back:before,\n.#{$ionicons-prefix}android-system-home:before,\n.#{$ionicons-prefix}android-system-windows:before,\n.#{$ionicons-prefix}android-timer:before,\n.#{$ionicons-prefix}android-trash:before,\n.#{$ionicons-prefix}android-user-menu:before,\n.#{$ionicons-prefix}android-volume:before,\n.#{$ionicons-prefix}android-wifi:before,\n.#{$ionicons-prefix}aperture:before,\n.#{$ionicons-prefix}archive:before,\n.#{$ionicons-prefix}arrow-down-a:before,\n.#{$ionicons-prefix}arrow-down-b:before,\n.#{$ionicons-prefix}arrow-down-c:before,\n.#{$ionicons-prefix}arrow-expand:before,\n.#{$ionicons-prefix}arrow-graph-down-left:before,\n.#{$ionicons-prefix}arrow-graph-down-right:before,\n.#{$ionicons-prefix}arrow-graph-up-left:before,\n.#{$ionicons-prefix}arrow-graph-up-right:before,\n.#{$ionicons-prefix}arrow-left-a:before,\n.#{$ionicons-prefix}arrow-left-b:before,\n.#{$ionicons-prefix}arrow-left-c:before,\n.#{$ionicons-prefix}arrow-move:before,\n.#{$ionicons-prefix}arrow-resize:before,\n.#{$ionicons-prefix}arrow-return-left:before,\n.#{$ionicons-prefix}arrow-return-right:before,\n.#{$ionicons-prefix}arrow-right-a:before,\n.#{$ionicons-prefix}arrow-right-b:before,\n.#{$ionicons-prefix}arrow-right-c:before,\n.#{$ionicons-prefix}arrow-shrink:before,\n.#{$ionicons-prefix}arrow-swap:before,\n.#{$ionicons-prefix}arrow-up-a:before,\n.#{$ionicons-prefix}arrow-up-b:before,\n.#{$ionicons-prefix}arrow-up-c:before,\n.#{$ionicons-prefix}asterisk:before,\n.#{$ionicons-prefix}at:before,\n.#{$ionicons-prefix}bag:before,\n.#{$ionicons-prefix}battery-charging:before,\n.#{$ionicons-prefix}battery-empty:before,\n.#{$ionicons-prefix}battery-full:before,\n.#{$ionicons-prefix}battery-half:before,\n.#{$ionicons-prefix}battery-low:before,\n.#{$ionicons-prefix}beaker:before,\n.#{$ionicons-prefix}beer:before,\n.#{$ionicons-prefix}bluetooth:before,\n.#{$ionicons-prefix}bonfire:before,\n.#{$ionicons-prefix}bookmark:before,\n.#{$ionicons-prefix}briefcase:before,\n.#{$ionicons-prefix}bug:before,\n.#{$ionicons-prefix}calculator:before,\n.#{$ionicons-prefix}calendar:before,\n.#{$ionicons-prefix}camera:before,\n.#{$ionicons-prefix}card:before,\n.#{$ionicons-prefix}cash:before,\n.#{$ionicons-prefix}chatbox:before,\n.#{$ionicons-prefix}chatbox-working:before,\n.#{$ionicons-prefix}chatboxes:before,\n.#{$ionicons-prefix}chatbubble:before,\n.#{$ionicons-prefix}chatbubble-working:before,\n.#{$ionicons-prefix}chatbubbles:before,\n.#{$ionicons-prefix}checkmark:before,\n.#{$ionicons-prefix}checkmark-circled:before,\n.#{$ionicons-prefix}checkmark-round:before,\n.#{$ionicons-prefix}chevron-down:before,\n.#{$ionicons-prefix}chevron-left:before,\n.#{$ionicons-prefix}chevron-right:before,\n.#{$ionicons-prefix}chevron-up:before,\n.#{$ionicons-prefix}clipboard:before,\n.#{$ionicons-prefix}clock:before,\n.#{$ionicons-prefix}close:before,\n.#{$ionicons-prefix}close-circled:before,\n.#{$ionicons-prefix}close-round:before,\n.#{$ionicons-prefix}closed-captioning:before,\n.#{$ionicons-prefix}cloud:before,\n.#{$ionicons-prefix}code:before,\n.#{$ionicons-prefix}code-download:before,\n.#{$ionicons-prefix}code-working:before,\n.#{$ionicons-prefix}coffee:before,\n.#{$ionicons-prefix}compass:before,\n.#{$ionicons-prefix}compose:before,\n.#{$ionicons-prefix}connection-bars:before,\n.#{$ionicons-prefix}contrast:before,\n.#{$ionicons-prefix}cube:before,\n.#{$ionicons-prefix}disc:before,\n.#{$ionicons-prefix}document:before,\n.#{$ionicons-prefix}document-text:before,\n.#{$ionicons-prefix}drag:before,\n.#{$ionicons-prefix}earth:before,\n.#{$ionicons-prefix}edit:before,\n.#{$ionicons-prefix}egg:before,\n.#{$ionicons-prefix}eject:before,\n.#{$ionicons-prefix}email:before,\n.#{$ionicons-prefix}eye:before,\n.#{$ionicons-prefix}eye-disabled:before,\n.#{$ionicons-prefix}female:before,\n.#{$ionicons-prefix}filing:before,\n.#{$ionicons-prefix}film-marker:before,\n.#{$ionicons-prefix}fireball:before,\n.#{$ionicons-prefix}flag:before,\n.#{$ionicons-prefix}flame:before,\n.#{$ionicons-prefix}flash:before,\n.#{$ionicons-prefix}flash-off:before,\n.#{$ionicons-prefix}flask:before,\n.#{$ionicons-prefix}folder:before,\n.#{$ionicons-prefix}fork:before,\n.#{$ionicons-prefix}fork-repo:before,\n.#{$ionicons-prefix}forward:before,\n.#{$ionicons-prefix}funnel:before,\n.#{$ionicons-prefix}game-controller-a:before,\n.#{$ionicons-prefix}game-controller-b:before,\n.#{$ionicons-prefix}gear-a:before,\n.#{$ionicons-prefix}gear-b:before,\n.#{$ionicons-prefix}grid:before,\n.#{$ionicons-prefix}hammer:before,\n.#{$ionicons-prefix}happy:before,\n.#{$ionicons-prefix}headphone:before,\n.#{$ionicons-prefix}heart:before,\n.#{$ionicons-prefix}heart-broken:before,\n.#{$ionicons-prefix}help:before,\n.#{$ionicons-prefix}help-buoy:before,\n.#{$ionicons-prefix}help-circled:before,\n.#{$ionicons-prefix}home:before,\n.#{$ionicons-prefix}icecream:before,\n.#{$ionicons-prefix}icon-social-google-plus:before,\n.#{$ionicons-prefix}icon-social-google-plus-outline:before,\n.#{$ionicons-prefix}image:before,\n.#{$ionicons-prefix}images:before,\n.#{$ionicons-prefix}information:before,\n.#{$ionicons-prefix}information-circled:before,\n.#{$ionicons-prefix}ionic:before,\n.#{$ionicons-prefix}ios7-alarm:before,\n.#{$ionicons-prefix}ios7-alarm-outline:before,\n.#{$ionicons-prefix}ios7-albums:before,\n.#{$ionicons-prefix}ios7-albums-outline:before,\n.#{$ionicons-prefix}ios7-americanfootball:before,\n.#{$ionicons-prefix}ios7-americanfootball-outline:before,\n.#{$ionicons-prefix}ios7-analytics:before,\n.#{$ionicons-prefix}ios7-analytics-outline:before,\n.#{$ionicons-prefix}ios7-arrow-back:before,\n.#{$ionicons-prefix}ios7-arrow-down:before,\n.#{$ionicons-prefix}ios7-arrow-forward:before,\n.#{$ionicons-prefix}ios7-arrow-left:before,\n.#{$ionicons-prefix}ios7-arrow-right:before,\n.#{$ionicons-prefix}ios7-arrow-thin-down:before,\n.#{$ionicons-prefix}ios7-arrow-thin-left:before,\n.#{$ionicons-prefix}ios7-arrow-thin-right:before,\n.#{$ionicons-prefix}ios7-arrow-thin-up:before,\n.#{$ionicons-prefix}ios7-arrow-up:before,\n.#{$ionicons-prefix}ios7-at:before,\n.#{$ionicons-prefix}ios7-at-outline:before,\n.#{$ionicons-prefix}ios7-barcode:before,\n.#{$ionicons-prefix}ios7-barcode-outline:before,\n.#{$ionicons-prefix}ios7-baseball:before,\n.#{$ionicons-prefix}ios7-baseball-outline:before,\n.#{$ionicons-prefix}ios7-basketball:before,\n.#{$ionicons-prefix}ios7-basketball-outline:before,\n.#{$ionicons-prefix}ios7-bell:before,\n.#{$ionicons-prefix}ios7-bell-outline:before,\n.#{$ionicons-prefix}ios7-bolt:before,\n.#{$ionicons-prefix}ios7-bolt-outline:before,\n.#{$ionicons-prefix}ios7-bookmarks:before,\n.#{$ionicons-prefix}ios7-bookmarks-outline:before,\n.#{$ionicons-prefix}ios7-box:before,\n.#{$ionicons-prefix}ios7-box-outline:before,\n.#{$ionicons-prefix}ios7-briefcase:before,\n.#{$ionicons-prefix}ios7-briefcase-outline:before,\n.#{$ionicons-prefix}ios7-browsers:before,\n.#{$ionicons-prefix}ios7-browsers-outline:before,\n.#{$ionicons-prefix}ios7-calculator:before,\n.#{$ionicons-prefix}ios7-calculator-outline:before,\n.#{$ionicons-prefix}ios7-calendar:before,\n.#{$ionicons-prefix}ios7-calendar-outline:before,\n.#{$ionicons-prefix}ios7-camera:before,\n.#{$ionicons-prefix}ios7-camera-outline:before,\n.#{$ionicons-prefix}ios7-cart:before,\n.#{$ionicons-prefix}ios7-cart-outline:before,\n.#{$ionicons-prefix}ios7-chatboxes:before,\n.#{$ionicons-prefix}ios7-chatboxes-outline:before,\n.#{$ionicons-prefix}ios7-chatbubble:before,\n.#{$ionicons-prefix}ios7-chatbubble-outline:before,\n.#{$ionicons-prefix}ios7-checkmark:before,\n.#{$ionicons-prefix}ios7-checkmark-empty:before,\n.#{$ionicons-prefix}ios7-checkmark-outline:before,\n.#{$ionicons-prefix}ios7-circle-filled:before,\n.#{$ionicons-prefix}ios7-circle-outline:before,\n.#{$ionicons-prefix}ios7-clock:before,\n.#{$ionicons-prefix}ios7-clock-outline:before,\n.#{$ionicons-prefix}ios7-close:before,\n.#{$ionicons-prefix}ios7-close-empty:before,\n.#{$ionicons-prefix}ios7-close-outline:before,\n.#{$ionicons-prefix}ios7-cloud:before,\n.#{$ionicons-prefix}ios7-cloud-download:before,\n.#{$ionicons-prefix}ios7-cloud-download-outline:before,\n.#{$ionicons-prefix}ios7-cloud-outline:before,\n.#{$ionicons-prefix}ios7-cloud-upload:before,\n.#{$ionicons-prefix}ios7-cloud-upload-outline:before,\n.#{$ionicons-prefix}ios7-cloudy:before,\n.#{$ionicons-prefix}ios7-cloudy-night:before,\n.#{$ionicons-prefix}ios7-cloudy-night-outline:before,\n.#{$ionicons-prefix}ios7-cloudy-outline:before,\n.#{$ionicons-prefix}ios7-cog:before,\n.#{$ionicons-prefix}ios7-cog-outline:before,\n.#{$ionicons-prefix}ios7-compose:before,\n.#{$ionicons-prefix}ios7-compose-outline:before,\n.#{$ionicons-prefix}ios7-contact:before,\n.#{$ionicons-prefix}ios7-contact-outline:before,\n.#{$ionicons-prefix}ios7-copy:before,\n.#{$ionicons-prefix}ios7-copy-outline:before,\n.#{$ionicons-prefix}ios7-download:before,\n.#{$ionicons-prefix}ios7-download-outline:before,\n.#{$ionicons-prefix}ios7-drag:before,\n.#{$ionicons-prefix}ios7-email:before,\n.#{$ionicons-prefix}ios7-email-outline:before,\n.#{$ionicons-prefix}ios7-expand:before,\n.#{$ionicons-prefix}ios7-eye:before,\n.#{$ionicons-prefix}ios7-eye-outline:before,\n.#{$ionicons-prefix}ios7-fastforward:before,\n.#{$ionicons-prefix}ios7-fastforward-outline:before,\n.#{$ionicons-prefix}ios7-filing:before,\n.#{$ionicons-prefix}ios7-filing-outline:before,\n.#{$ionicons-prefix}ios7-film:before,\n.#{$ionicons-prefix}ios7-film-outline:before,\n.#{$ionicons-prefix}ios7-flag:before,\n.#{$ionicons-prefix}ios7-flag-outline:before,\n.#{$ionicons-prefix}ios7-folder:before,\n.#{$ionicons-prefix}ios7-folder-outline:before,\n.#{$ionicons-prefix}ios7-football:before,\n.#{$ionicons-prefix}ios7-football-outline:before,\n.#{$ionicons-prefix}ios7-gear:before,\n.#{$ionicons-prefix}ios7-gear-outline:before,\n.#{$ionicons-prefix}ios7-glasses:before,\n.#{$ionicons-prefix}ios7-glasses-outline:before,\n.#{$ionicons-prefix}ios7-heart:before,\n.#{$ionicons-prefix}ios7-heart-outline:before,\n.#{$ionicons-prefix}ios7-help:before,\n.#{$ionicons-prefix}ios7-help-empty:before,\n.#{$ionicons-prefix}ios7-help-outline:before,\n.#{$ionicons-prefix}ios7-home:before,\n.#{$ionicons-prefix}ios7-home-outline:before,\n.#{$ionicons-prefix}ios7-infinite:before,\n.#{$ionicons-prefix}ios7-infinite-outline:before,\n.#{$ionicons-prefix}ios7-information:before,\n.#{$ionicons-prefix}ios7-information-empty:before,\n.#{$ionicons-prefix}ios7-information-outline:before,\n.#{$ionicons-prefix}ios7-ionic-outline:before,\n.#{$ionicons-prefix}ios7-keypad:before,\n.#{$ionicons-prefix}ios7-keypad-outline:before,\n.#{$ionicons-prefix}ios7-lightbulb:before,\n.#{$ionicons-prefix}ios7-lightbulb-outline:before,\n.#{$ionicons-prefix}ios7-location:before,\n.#{$ionicons-prefix}ios7-location-outline:before,\n.#{$ionicons-prefix}ios7-locked:before,\n.#{$ionicons-prefix}ios7-locked-outline:before,\n.#{$ionicons-prefix}ios7-loop:before,\n.#{$ionicons-prefix}ios7-loop-strong:before,\n.#{$ionicons-prefix}ios7-medkit:before,\n.#{$ionicons-prefix}ios7-medkit-outline:before,\n.#{$ionicons-prefix}ios7-mic:before,\n.#{$ionicons-prefix}ios7-mic-off:before,\n.#{$ionicons-prefix}ios7-mic-outline:before,\n.#{$ionicons-prefix}ios7-minus:before,\n.#{$ionicons-prefix}ios7-minus-empty:before,\n.#{$ionicons-prefix}ios7-minus-outline:before,\n.#{$ionicons-prefix}ios7-monitor:before,\n.#{$ionicons-prefix}ios7-monitor-outline:before,\n.#{$ionicons-prefix}ios7-moon:before,\n.#{$ionicons-prefix}ios7-moon-outline:before,\n.#{$ionicons-prefix}ios7-more:before,\n.#{$ionicons-prefix}ios7-more-outline:before,\n.#{$ionicons-prefix}ios7-musical-note:before,\n.#{$ionicons-prefix}ios7-musical-notes:before,\n.#{$ionicons-prefix}ios7-navigate:before,\n.#{$ionicons-prefix}ios7-navigate-outline:before,\n.#{$ionicons-prefix}ios7-paper:before,\n.#{$ionicons-prefix}ios7-paper-outline:before,\n.#{$ionicons-prefix}ios7-paperplane:before,\n.#{$ionicons-prefix}ios7-paperplane-outline:before,\n.#{$ionicons-prefix}ios7-partlysunny:before,\n.#{$ionicons-prefix}ios7-partlysunny-outline:before,\n.#{$ionicons-prefix}ios7-pause:before,\n.#{$ionicons-prefix}ios7-pause-outline:before,\n.#{$ionicons-prefix}ios7-paw:before,\n.#{$ionicons-prefix}ios7-paw-outline:before,\n.#{$ionicons-prefix}ios7-people:before,\n.#{$ionicons-prefix}ios7-people-outline:before,\n.#{$ionicons-prefix}ios7-person:before,\n.#{$ionicons-prefix}ios7-person-outline:before,\n.#{$ionicons-prefix}ios7-personadd:before,\n.#{$ionicons-prefix}ios7-personadd-outline:before,\n.#{$ionicons-prefix}ios7-photos:before,\n.#{$ionicons-prefix}ios7-photos-outline:before,\n.#{$ionicons-prefix}ios7-pie:before,\n.#{$ionicons-prefix}ios7-pie-outline:before,\n.#{$ionicons-prefix}ios7-play:before,\n.#{$ionicons-prefix}ios7-play-outline:before,\n.#{$ionicons-prefix}ios7-plus:before,\n.#{$ionicons-prefix}ios7-plus-empty:before,\n.#{$ionicons-prefix}ios7-plus-outline:before,\n.#{$ionicons-prefix}ios7-pricetag:before,\n.#{$ionicons-prefix}ios7-pricetag-outline:before,\n.#{$ionicons-prefix}ios7-pricetags:before,\n.#{$ionicons-prefix}ios7-pricetags-outline:before,\n.#{$ionicons-prefix}ios7-printer:before,\n.#{$ionicons-prefix}ios7-printer-outline:before,\n.#{$ionicons-prefix}ios7-pulse:before,\n.#{$ionicons-prefix}ios7-pulse-strong:before,\n.#{$ionicons-prefix}ios7-rainy:before,\n.#{$ionicons-prefix}ios7-rainy-outline:before,\n.#{$ionicons-prefix}ios7-recording:before,\n.#{$ionicons-prefix}ios7-recording-outline:before,\n.#{$ionicons-prefix}ios7-redo:before,\n.#{$ionicons-prefix}ios7-redo-outline:before,\n.#{$ionicons-prefix}ios7-refresh:before,\n.#{$ionicons-prefix}ios7-refresh-empty:before,\n.#{$ionicons-prefix}ios7-refresh-outline:before,\n.#{$ionicons-prefix}ios7-reload:before,\n.#{$ionicons-prefix}ios7-reverse-camera:before,\n.#{$ionicons-prefix}ios7-reverse-camera-outline:before,\n.#{$ionicons-prefix}ios7-rewind:before,\n.#{$ionicons-prefix}ios7-rewind-outline:before,\n.#{$ionicons-prefix}ios7-search:before,\n.#{$ionicons-prefix}ios7-search-strong:before,\n.#{$ionicons-prefix}ios7-settings:before,\n.#{$ionicons-prefix}ios7-settings-strong:before,\n.#{$ionicons-prefix}ios7-shrink:before,\n.#{$ionicons-prefix}ios7-skipbackward:before,\n.#{$ionicons-prefix}ios7-skipbackward-outline:before,\n.#{$ionicons-prefix}ios7-skipforward:before,\n.#{$ionicons-prefix}ios7-skipforward-outline:before,\n.#{$ionicons-prefix}ios7-snowy:before,\n.#{$ionicons-prefix}ios7-speedometer:before,\n.#{$ionicons-prefix}ios7-speedometer-outline:before,\n.#{$ionicons-prefix}ios7-star:before,\n.#{$ionicons-prefix}ios7-star-half:before,\n.#{$ionicons-prefix}ios7-star-outline:before,\n.#{$ionicons-prefix}ios7-stopwatch:before,\n.#{$ionicons-prefix}ios7-stopwatch-outline:before,\n.#{$ionicons-prefix}ios7-sunny:before,\n.#{$ionicons-prefix}ios7-sunny-outline:before,\n.#{$ionicons-prefix}ios7-telephone:before,\n.#{$ionicons-prefix}ios7-telephone-outline:before,\n.#{$ionicons-prefix}ios7-tennisball:before,\n.#{$ionicons-prefix}ios7-tennisball-outline:before,\n.#{$ionicons-prefix}ios7-thunderstorm:before,\n.#{$ionicons-prefix}ios7-thunderstorm-outline:before,\n.#{$ionicons-prefix}ios7-time:before,\n.#{$ionicons-prefix}ios7-time-outline:before,\n.#{$ionicons-prefix}ios7-timer:before,\n.#{$ionicons-prefix}ios7-timer-outline:before,\n.#{$ionicons-prefix}ios7-toggle:before,\n.#{$ionicons-prefix}ios7-toggle-outline:before,\n.#{$ionicons-prefix}ios7-trash:before,\n.#{$ionicons-prefix}ios7-trash-outline:before,\n.#{$ionicons-prefix}ios7-undo:before,\n.#{$ionicons-prefix}ios7-undo-outline:before,\n.#{$ionicons-prefix}ios7-unlocked:before,\n.#{$ionicons-prefix}ios7-unlocked-outline:before,\n.#{$ionicons-prefix}ios7-upload:before,\n.#{$ionicons-prefix}ios7-upload-outline:before,\n.#{$ionicons-prefix}ios7-videocam:before,\n.#{$ionicons-prefix}ios7-videocam-outline:before,\n.#{$ionicons-prefix}ios7-volume-high:before,\n.#{$ionicons-prefix}ios7-volume-low:before,\n.#{$ionicons-prefix}ios7-wineglass:before,\n.#{$ionicons-prefix}ios7-wineglass-outline:before,\n.#{$ionicons-prefix}ios7-world:before,\n.#{$ionicons-prefix}ios7-world-outline:before,\n.#{$ionicons-prefix}ipad:before,\n.#{$ionicons-prefix}iphone:before,\n.#{$ionicons-prefix}ipod:before,\n.#{$ionicons-prefix}jet:before,\n.#{$ionicons-prefix}key:before,\n.#{$ionicons-prefix}knife:before,\n.#{$ionicons-prefix}laptop:before,\n.#{$ionicons-prefix}leaf:before,\n.#{$ionicons-prefix}levels:before,\n.#{$ionicons-prefix}lightbulb:before,\n.#{$ionicons-prefix}link:before,\n.#{$ionicons-prefix}load-a:before,\n.#{$ionicons-prefix}load-b:before,\n.#{$ionicons-prefix}load-c:before,\n.#{$ionicons-prefix}load-d:before,\n.#{$ionicons-prefix}location:before,\n.#{$ionicons-prefix}locked:before,\n.#{$ionicons-prefix}log-in:before,\n.#{$ionicons-prefix}log-out:before,\n.#{$ionicons-prefix}loop:before,\n.#{$ionicons-prefix}magnet:before,\n.#{$ionicons-prefix}male:before,\n.#{$ionicons-prefix}man:before,\n.#{$ionicons-prefix}map:before,\n.#{$ionicons-prefix}medkit:before,\n.#{$ionicons-prefix}merge:before,\n.#{$ionicons-prefix}mic-a:before,\n.#{$ionicons-prefix}mic-b:before,\n.#{$ionicons-prefix}mic-c:before,\n.#{$ionicons-prefix}minus:before,\n.#{$ionicons-prefix}minus-circled:before,\n.#{$ionicons-prefix}minus-round:before,\n.#{$ionicons-prefix}model-s:before,\n.#{$ionicons-prefix}monitor:before,\n.#{$ionicons-prefix}more:before,\n.#{$ionicons-prefix}mouse:before,\n.#{$ionicons-prefix}music-note:before,\n.#{$ionicons-prefix}navicon:before,\n.#{$ionicons-prefix}navicon-round:before,\n.#{$ionicons-prefix}navigate:before,\n.#{$ionicons-prefix}network:before,\n.#{$ionicons-prefix}no-smoking:before,\n.#{$ionicons-prefix}nuclear:before,\n.#{$ionicons-prefix}outlet:before,\n.#{$ionicons-prefix}paper-airplane:before,\n.#{$ionicons-prefix}paperclip:before,\n.#{$ionicons-prefix}pause:before,\n.#{$ionicons-prefix}person:before,\n.#{$ionicons-prefix}person-add:before,\n.#{$ionicons-prefix}person-stalker:before,\n.#{$ionicons-prefix}pie-graph:before,\n.#{$ionicons-prefix}pin:before,\n.#{$ionicons-prefix}pinpoint:before,\n.#{$ionicons-prefix}pizza:before,\n.#{$ionicons-prefix}plane:before,\n.#{$ionicons-prefix}planet:before,\n.#{$ionicons-prefix}play:before,\n.#{$ionicons-prefix}playstation:before,\n.#{$ionicons-prefix}plus:before,\n.#{$ionicons-prefix}plus-circled:before,\n.#{$ionicons-prefix}plus-round:before,\n.#{$ionicons-prefix}podium:before,\n.#{$ionicons-prefix}pound:before,\n.#{$ionicons-prefix}power:before,\n.#{$ionicons-prefix}pricetag:before,\n.#{$ionicons-prefix}pricetags:before,\n.#{$ionicons-prefix}printer:before,\n.#{$ionicons-prefix}pull-request:before,\n.#{$ionicons-prefix}qr-scanner:before,\n.#{$ionicons-prefix}quote:before,\n.#{$ionicons-prefix}radio-waves:before,\n.#{$ionicons-prefix}record:before,\n.#{$ionicons-prefix}refresh:before,\n.#{$ionicons-prefix}reply:before,\n.#{$ionicons-prefix}reply-all:before,\n.#{$ionicons-prefix}ribbon-a:before,\n.#{$ionicons-prefix}ribbon-b:before,\n.#{$ionicons-prefix}sad:before,\n.#{$ionicons-prefix}scissors:before,\n.#{$ionicons-prefix}search:before,\n.#{$ionicons-prefix}settings:before,\n.#{$ionicons-prefix}share:before,\n.#{$ionicons-prefix}shuffle:before,\n.#{$ionicons-prefix}skip-backward:before,\n.#{$ionicons-prefix}skip-forward:before,\n.#{$ionicons-prefix}social-android:before,\n.#{$ionicons-prefix}social-android-outline:before,\n.#{$ionicons-prefix}social-apple:before,\n.#{$ionicons-prefix}social-apple-outline:before,\n.#{$ionicons-prefix}social-bitcoin:before,\n.#{$ionicons-prefix}social-bitcoin-outline:before,\n.#{$ionicons-prefix}social-buffer:before,\n.#{$ionicons-prefix}social-buffer-outline:before,\n.#{$ionicons-prefix}social-designernews:before,\n.#{$ionicons-prefix}social-designernews-outline:before,\n.#{$ionicons-prefix}social-dribbble:before,\n.#{$ionicons-prefix}social-dribbble-outline:before,\n.#{$ionicons-prefix}social-dropbox:before,\n.#{$ionicons-prefix}social-dropbox-outline:before,\n.#{$ionicons-prefix}social-facebook:before,\n.#{$ionicons-prefix}social-facebook-outline:before,\n.#{$ionicons-prefix}social-foursquare:before,\n.#{$ionicons-prefix}social-foursquare-outline:before,\n.#{$ionicons-prefix}social-freebsd-devil:before,\n.#{$ionicons-prefix}social-github:before,\n.#{$ionicons-prefix}social-github-outline:before,\n.#{$ionicons-prefix}social-google:before,\n.#{$ionicons-prefix}social-google-outline:before,\n.#{$ionicons-prefix}social-googleplus:before,\n.#{$ionicons-prefix}social-googleplus-outline:before,\n.#{$ionicons-prefix}social-hackernews:before,\n.#{$ionicons-prefix}social-hackernews-outline:before,\n.#{$ionicons-prefix}social-instagram:before,\n.#{$ionicons-prefix}social-instagram-outline:before,\n.#{$ionicons-prefix}social-linkedin:before,\n.#{$ionicons-prefix}social-linkedin-outline:before,\n.#{$ionicons-prefix}social-pinterest:before,\n.#{$ionicons-prefix}social-pinterest-outline:before,\n.#{$ionicons-prefix}social-reddit:before,\n.#{$ionicons-prefix}social-reddit-outline:before,\n.#{$ionicons-prefix}social-rss:before,\n.#{$ionicons-prefix}social-rss-outline:before,\n.#{$ionicons-prefix}social-skype:before,\n.#{$ionicons-prefix}social-skype-outline:before,\n.#{$ionicons-prefix}social-tumblr:before,\n.#{$ionicons-prefix}social-tumblr-outline:before,\n.#{$ionicons-prefix}social-tux:before,\n.#{$ionicons-prefix}social-twitter:before,\n.#{$ionicons-prefix}social-twitter-outline:before,\n.#{$ionicons-prefix}social-usd:before,\n.#{$ionicons-prefix}social-usd-outline:before,\n.#{$ionicons-prefix}social-vimeo:before,\n.#{$ionicons-prefix}social-vimeo-outline:before,\n.#{$ionicons-prefix}social-windows:before,\n.#{$ionicons-prefix}social-windows-outline:before,\n.#{$ionicons-prefix}social-wordpress:before,\n.#{$ionicons-prefix}social-wordpress-outline:before,\n.#{$ionicons-prefix}social-yahoo:before,\n.#{$ionicons-prefix}social-yahoo-outline:before,\n.#{$ionicons-prefix}social-youtube:before,\n.#{$ionicons-prefix}social-youtube-outline:before,\n.#{$ionicons-prefix}speakerphone:before,\n.#{$ionicons-prefix}speedometer:before,\n.#{$ionicons-prefix}spoon:before,\n.#{$ionicons-prefix}star:before,\n.#{$ionicons-prefix}stats-bars:before,\n.#{$ionicons-prefix}steam:before,\n.#{$ionicons-prefix}stop:before,\n.#{$ionicons-prefix}thermometer:before,\n.#{$ionicons-prefix}thumbsdown:before,\n.#{$ionicons-prefix}thumbsup:before,\n.#{$ionicons-prefix}toggle:before,\n.#{$ionicons-prefix}toggle-filled:before,\n.#{$ionicons-prefix}trash-a:before,\n.#{$ionicons-prefix}trash-b:before,\n.#{$ionicons-prefix}trophy:before,\n.#{$ionicons-prefix}umbrella:before,\n.#{$ionicons-prefix}university:before,\n.#{$ionicons-prefix}unlocked:before,\n.#{$ionicons-prefix}upload:before,\n.#{$ionicons-prefix}usb:before,\n.#{$ionicons-prefix}videocamera:before,\n.#{$ionicons-prefix}volume-high:before,\n.#{$ionicons-prefix}volume-low:before,\n.#{$ionicons-prefix}volume-medium:before,\n.#{$ionicons-prefix}volume-mute:before,\n.#{$ionicons-prefix}wand:before,\n.#{$ionicons-prefix}waterdrop:before,\n.#{$ionicons-prefix}wifi:before,\n.#{$ionicons-prefix}wineglass:before,\n.#{$ionicons-prefix}woman:before,\n.#{$ionicons-prefix}wrench:before,\n.#{$ionicons-prefix}xbox:before\n{\n  @extend .ion;\n}\n.#{$ionicons-prefix}alert:before { content: $ionicon-var-alert; }\n.#{$ionicons-prefix}alert-circled:before { content: $ionicon-var-alert-circled; }\n.#{$ionicons-prefix}android-add:before { content: $ionicon-var-android-add; }\n.#{$ionicons-prefix}android-add-contact:before { content: $ionicon-var-android-add-contact; }\n.#{$ionicons-prefix}android-alarm:before { content: $ionicon-var-android-alarm; }\n.#{$ionicons-prefix}android-archive:before { content: $ionicon-var-android-archive; }\n.#{$ionicons-prefix}android-arrow-back:before { content: $ionicon-var-android-arrow-back; }\n.#{$ionicons-prefix}android-arrow-down-left:before { content: $ionicon-var-android-arrow-down-left; }\n.#{$ionicons-prefix}android-arrow-down-right:before { content: $ionicon-var-android-arrow-down-right; }\n.#{$ionicons-prefix}android-arrow-forward:before { content: $ionicon-var-android-arrow-forward; }\n.#{$ionicons-prefix}android-arrow-up-left:before { content: $ionicon-var-android-arrow-up-left; }\n.#{$ionicons-prefix}android-arrow-up-right:before { content: $ionicon-var-android-arrow-up-right; }\n.#{$ionicons-prefix}android-battery:before { content: $ionicon-var-android-battery; }\n.#{$ionicons-prefix}android-book:before { content: $ionicon-var-android-book; }\n.#{$ionicons-prefix}android-calendar:before { content: $ionicon-var-android-calendar; }\n.#{$ionicons-prefix}android-call:before { content: $ionicon-var-android-call; }\n.#{$ionicons-prefix}android-camera:before { content: $ionicon-var-android-camera; }\n.#{$ionicons-prefix}android-chat:before { content: $ionicon-var-android-chat; }\n.#{$ionicons-prefix}android-checkmark:before { content: $ionicon-var-android-checkmark; }\n.#{$ionicons-prefix}android-clock:before { content: $ionicon-var-android-clock; }\n.#{$ionicons-prefix}android-close:before { content: $ionicon-var-android-close; }\n.#{$ionicons-prefix}android-contact:before { content: $ionicon-var-android-contact; }\n.#{$ionicons-prefix}android-contacts:before { content: $ionicon-var-android-contacts; }\n.#{$ionicons-prefix}android-data:before { content: $ionicon-var-android-data; }\n.#{$ionicons-prefix}android-developer:before { content: $ionicon-var-android-developer; }\n.#{$ionicons-prefix}android-display:before { content: $ionicon-var-android-display; }\n.#{$ionicons-prefix}android-download:before { content: $ionicon-var-android-download; }\n.#{$ionicons-prefix}android-drawer:before { content: $ionicon-var-android-drawer; }\n.#{$ionicons-prefix}android-dropdown:before { content: $ionicon-var-android-dropdown; }\n.#{$ionicons-prefix}android-earth:before { content: $ionicon-var-android-earth; }\n.#{$ionicons-prefix}android-folder:before { content: $ionicon-var-android-folder; }\n.#{$ionicons-prefix}android-forums:before { content: $ionicon-var-android-forums; }\n.#{$ionicons-prefix}android-friends:before { content: $ionicon-var-android-friends; }\n.#{$ionicons-prefix}android-hand:before { content: $ionicon-var-android-hand; }\n.#{$ionicons-prefix}android-image:before { content: $ionicon-var-android-image; }\n.#{$ionicons-prefix}android-inbox:before { content: $ionicon-var-android-inbox; }\n.#{$ionicons-prefix}android-information:before { content: $ionicon-var-android-information; }\n.#{$ionicons-prefix}android-keypad:before { content: $ionicon-var-android-keypad; }\n.#{$ionicons-prefix}android-lightbulb:before { content: $ionicon-var-android-lightbulb; }\n.#{$ionicons-prefix}android-locate:before { content: $ionicon-var-android-locate; }\n.#{$ionicons-prefix}android-location:before { content: $ionicon-var-android-location; }\n.#{$ionicons-prefix}android-mail:before { content: $ionicon-var-android-mail; }\n.#{$ionicons-prefix}android-microphone:before { content: $ionicon-var-android-microphone; }\n.#{$ionicons-prefix}android-mixer:before { content: $ionicon-var-android-mixer; }\n.#{$ionicons-prefix}android-more:before { content: $ionicon-var-android-more; }\n.#{$ionicons-prefix}android-note:before { content: $ionicon-var-android-note; }\n.#{$ionicons-prefix}android-playstore:before { content: $ionicon-var-android-playstore; }\n.#{$ionicons-prefix}android-printer:before { content: $ionicon-var-android-printer; }\n.#{$ionicons-prefix}android-promotion:before { content: $ionicon-var-android-promotion; }\n.#{$ionicons-prefix}android-reminder:before { content: $ionicon-var-android-reminder; }\n.#{$ionicons-prefix}android-remove:before { content: $ionicon-var-android-remove; }\n.#{$ionicons-prefix}android-search:before { content: $ionicon-var-android-search; }\n.#{$ionicons-prefix}android-send:before { content: $ionicon-var-android-send; }\n.#{$ionicons-prefix}android-settings:before { content: $ionicon-var-android-settings; }\n.#{$ionicons-prefix}android-share:before { content: $ionicon-var-android-share; }\n.#{$ionicons-prefix}android-social:before { content: $ionicon-var-android-social; }\n.#{$ionicons-prefix}android-social-user:before { content: $ionicon-var-android-social-user; }\n.#{$ionicons-prefix}android-sort:before { content: $ionicon-var-android-sort; }\n.#{$ionicons-prefix}android-stair-drawer:before { content: $ionicon-var-android-stair-drawer; }\n.#{$ionicons-prefix}android-star:before { content: $ionicon-var-android-star; }\n.#{$ionicons-prefix}android-stopwatch:before { content: $ionicon-var-android-stopwatch; }\n.#{$ionicons-prefix}android-storage:before { content: $ionicon-var-android-storage; }\n.#{$ionicons-prefix}android-system-back:before { content: $ionicon-var-android-system-back; }\n.#{$ionicons-prefix}android-system-home:before { content: $ionicon-var-android-system-home; }\n.#{$ionicons-prefix}android-system-windows:before { content: $ionicon-var-android-system-windows; }\n.#{$ionicons-prefix}android-timer:before { content: $ionicon-var-android-timer; }\n.#{$ionicons-prefix}android-trash:before { content: $ionicon-var-android-trash; }\n.#{$ionicons-prefix}android-user-menu:before { content: $ionicon-var-android-user-menu; }\n.#{$ionicons-prefix}android-volume:before { content: $ionicon-var-android-volume; }\n.#{$ionicons-prefix}android-wifi:before { content: $ionicon-var-android-wifi; }\n.#{$ionicons-prefix}aperture:before { content: $ionicon-var-aperture; }\n.#{$ionicons-prefix}archive:before { content: $ionicon-var-archive; }\n.#{$ionicons-prefix}arrow-down-a:before { content: $ionicon-var-arrow-down-a; }\n.#{$ionicons-prefix}arrow-down-b:before { content: $ionicon-var-arrow-down-b; }\n.#{$ionicons-prefix}arrow-down-c:before { content: $ionicon-var-arrow-down-c; }\n.#{$ionicons-prefix}arrow-expand:before { content: $ionicon-var-arrow-expand; }\n.#{$ionicons-prefix}arrow-graph-down-left:before { content: $ionicon-var-arrow-graph-down-left; }\n.#{$ionicons-prefix}arrow-graph-down-right:before { content: $ionicon-var-arrow-graph-down-right; }\n.#{$ionicons-prefix}arrow-graph-up-left:before { content: $ionicon-var-arrow-graph-up-left; }\n.#{$ionicons-prefix}arrow-graph-up-right:before { content: $ionicon-var-arrow-graph-up-right; }\n.#{$ionicons-prefix}arrow-left-a:before { content: $ionicon-var-arrow-left-a; }\n.#{$ionicons-prefix}arrow-left-b:before { content: $ionicon-var-arrow-left-b; }\n.#{$ionicons-prefix}arrow-left-c:before { content: $ionicon-var-arrow-left-c; }\n.#{$ionicons-prefix}arrow-move:before { content: $ionicon-var-arrow-move; }\n.#{$ionicons-prefix}arrow-resize:before { content: $ionicon-var-arrow-resize; }\n.#{$ionicons-prefix}arrow-return-left:before { content: $ionicon-var-arrow-return-left; }\n.#{$ionicons-prefix}arrow-return-right:before { content: $ionicon-var-arrow-return-right; }\n.#{$ionicons-prefix}arrow-right-a:before { content: $ionicon-var-arrow-right-a; }\n.#{$ionicons-prefix}arrow-right-b:before { content: $ionicon-var-arrow-right-b; }\n.#{$ionicons-prefix}arrow-right-c:before { content: $ionicon-var-arrow-right-c; }\n.#{$ionicons-prefix}arrow-shrink:before { content: $ionicon-var-arrow-shrink; }\n.#{$ionicons-prefix}arrow-swap:before { content: $ionicon-var-arrow-swap; }\n.#{$ionicons-prefix}arrow-up-a:before { content: $ionicon-var-arrow-up-a; }\n.#{$ionicons-prefix}arrow-up-b:before { content: $ionicon-var-arrow-up-b; }\n.#{$ionicons-prefix}arrow-up-c:before { content: $ionicon-var-arrow-up-c; }\n.#{$ionicons-prefix}asterisk:before { content: $ionicon-var-asterisk; }\n.#{$ionicons-prefix}at:before { content: $ionicon-var-at; }\n.#{$ionicons-prefix}bag:before { content: $ionicon-var-bag; }\n.#{$ionicons-prefix}battery-charging:before { content: $ionicon-var-battery-charging; }\n.#{$ionicons-prefix}battery-empty:before { content: $ionicon-var-battery-empty; }\n.#{$ionicons-prefix}battery-full:before { content: $ionicon-var-battery-full; }\n.#{$ionicons-prefix}battery-half:before { content: $ionicon-var-battery-half; }\n.#{$ionicons-prefix}battery-low:before { content: $ionicon-var-battery-low; }\n.#{$ionicons-prefix}beaker:before { content: $ionicon-var-beaker; }\n.#{$ionicons-prefix}beer:before { content: $ionicon-var-beer; }\n.#{$ionicons-prefix}bluetooth:before { content: $ionicon-var-bluetooth; }\n.#{$ionicons-prefix}bonfire:before { content: $ionicon-var-bonfire; }\n.#{$ionicons-prefix}bookmark:before { content: $ionicon-var-bookmark; }\n.#{$ionicons-prefix}briefcase:before { content: $ionicon-var-briefcase; }\n.#{$ionicons-prefix}bug:before { content: $ionicon-var-bug; }\n.#{$ionicons-prefix}calculator:before { content: $ionicon-var-calculator; }\n.#{$ionicons-prefix}calendar:before { content: $ionicon-var-calendar; }\n.#{$ionicons-prefix}camera:before { content: $ionicon-var-camera; }\n.#{$ionicons-prefix}card:before { content: $ionicon-var-card; }\n.#{$ionicons-prefix}cash:before { content: $ionicon-var-cash; }\n.#{$ionicons-prefix}chatbox:before { content: $ionicon-var-chatbox; }\n.#{$ionicons-prefix}chatbox-working:before { content: $ionicon-var-chatbox-working; }\n.#{$ionicons-prefix}chatboxes:before { content: $ionicon-var-chatboxes; }\n.#{$ionicons-prefix}chatbubble:before { content: $ionicon-var-chatbubble; }\n.#{$ionicons-prefix}chatbubble-working:before { content: $ionicon-var-chatbubble-working; }\n.#{$ionicons-prefix}chatbubbles:before { content: $ionicon-var-chatbubbles; }\n.#{$ionicons-prefix}checkmark:before { content: $ionicon-var-checkmark; }\n.#{$ionicons-prefix}checkmark-circled:before { content: $ionicon-var-checkmark-circled; }\n.#{$ionicons-prefix}checkmark-round:before { content: $ionicon-var-checkmark-round; }\n.#{$ionicons-prefix}chevron-down:before { content: $ionicon-var-chevron-down; }\n.#{$ionicons-prefix}chevron-left:before { content: $ionicon-var-chevron-left; }\n.#{$ionicons-prefix}chevron-right:before { content: $ionicon-var-chevron-right; }\n.#{$ionicons-prefix}chevron-up:before { content: $ionicon-var-chevron-up; }\n.#{$ionicons-prefix}clipboard:before { content: $ionicon-var-clipboard; }\n.#{$ionicons-prefix}clock:before { content: $ionicon-var-clock; }\n.#{$ionicons-prefix}close:before { content: $ionicon-var-close; }\n.#{$ionicons-prefix}close-circled:before { content: $ionicon-var-close-circled; }\n.#{$ionicons-prefix}close-round:before { content: $ionicon-var-close-round; }\n.#{$ionicons-prefix}closed-captioning:before { content: $ionicon-var-closed-captioning; }\n.#{$ionicons-prefix}cloud:before { content: $ionicon-var-cloud; }\n.#{$ionicons-prefix}code:before { content: $ionicon-var-code; }\n.#{$ionicons-prefix}code-download:before { content: $ionicon-var-code-download; }\n.#{$ionicons-prefix}code-working:before { content: $ionicon-var-code-working; }\n.#{$ionicons-prefix}coffee:before { content: $ionicon-var-coffee; }\n.#{$ionicons-prefix}compass:before { content: $ionicon-var-compass; }\n.#{$ionicons-prefix}compose:before { content: $ionicon-var-compose; }\n.#{$ionicons-prefix}connection-bars:before { content: $ionicon-var-connection-bars; }\n.#{$ionicons-prefix}contrast:before { content: $ionicon-var-contrast; }\n.#{$ionicons-prefix}cube:before { content: $ionicon-var-cube; }\n.#{$ionicons-prefix}disc:before { content: $ionicon-var-disc; }\n.#{$ionicons-prefix}document:before { content: $ionicon-var-document; }\n.#{$ionicons-prefix}document-text:before { content: $ionicon-var-document-text; }\n.#{$ionicons-prefix}drag:before { content: $ionicon-var-drag; }\n.#{$ionicons-prefix}earth:before { content: $ionicon-var-earth; }\n.#{$ionicons-prefix}edit:before { content: $ionicon-var-edit; }\n.#{$ionicons-prefix}egg:before { content: $ionicon-var-egg; }\n.#{$ionicons-prefix}eject:before { content: $ionicon-var-eject; }\n.#{$ionicons-prefix}email:before { content: $ionicon-var-email; }\n.#{$ionicons-prefix}eye:before { content: $ionicon-var-eye; }\n.#{$ionicons-prefix}eye-disabled:before { content: $ionicon-var-eye-disabled; }\n.#{$ionicons-prefix}female:before { content: $ionicon-var-female; }\n.#{$ionicons-prefix}filing:before { content: $ionicon-var-filing; }\n.#{$ionicons-prefix}film-marker:before { content: $ionicon-var-film-marker; }\n.#{$ionicons-prefix}fireball:before { content: $ionicon-var-fireball; }\n.#{$ionicons-prefix}flag:before { content: $ionicon-var-flag; }\n.#{$ionicons-prefix}flame:before { content: $ionicon-var-flame; }\n.#{$ionicons-prefix}flash:before { content: $ionicon-var-flash; }\n.#{$ionicons-prefix}flash-off:before { content: $ionicon-var-flash-off; }\n.#{$ionicons-prefix}flask:before { content: $ionicon-var-flask; }\n.#{$ionicons-prefix}folder:before { content: $ionicon-var-folder; }\n.#{$ionicons-prefix}fork:before { content: $ionicon-var-fork; }\n.#{$ionicons-prefix}fork-repo:before { content: $ionicon-var-fork-repo; }\n.#{$ionicons-prefix}forward:before { content: $ionicon-var-forward; }\n.#{$ionicons-prefix}funnel:before { content: $ionicon-var-funnel; }\n.#{$ionicons-prefix}game-controller-a:before { content: $ionicon-var-game-controller-a; }\n.#{$ionicons-prefix}game-controller-b:before { content: $ionicon-var-game-controller-b; }\n.#{$ionicons-prefix}gear-a:before { content: $ionicon-var-gear-a; }\n.#{$ionicons-prefix}gear-b:before { content: $ionicon-var-gear-b; }\n.#{$ionicons-prefix}grid:before { content: $ionicon-var-grid; }\n.#{$ionicons-prefix}hammer:before { content: $ionicon-var-hammer; }\n.#{$ionicons-prefix}happy:before { content: $ionicon-var-happy; }\n.#{$ionicons-prefix}headphone:before { content: $ionicon-var-headphone; }\n.#{$ionicons-prefix}heart:before { content: $ionicon-var-heart; }\n.#{$ionicons-prefix}heart-broken:before { content: $ionicon-var-heart-broken; }\n.#{$ionicons-prefix}help:before { content: $ionicon-var-help; }\n.#{$ionicons-prefix}help-buoy:before { content: $ionicon-var-help-buoy; }\n.#{$ionicons-prefix}help-circled:before { content: $ionicon-var-help-circled; }\n.#{$ionicons-prefix}home:before { content: $ionicon-var-home; }\n.#{$ionicons-prefix}icecream:before { content: $ionicon-var-icecream; }\n.#{$ionicons-prefix}icon-social-google-plus:before { content: $ionicon-var-icon-social-google-plus; }\n.#{$ionicons-prefix}icon-social-google-plus-outline:before { content: $ionicon-var-icon-social-google-plus-outline; }\n.#{$ionicons-prefix}image:before { content: $ionicon-var-image; }\n.#{$ionicons-prefix}images:before { content: $ionicon-var-images; }\n.#{$ionicons-prefix}information:before { content: $ionicon-var-information; }\n.#{$ionicons-prefix}information-circled:before { content: $ionicon-var-information-circled; }\n.#{$ionicons-prefix}ionic:before { content: $ionicon-var-ionic; }\n.#{$ionicons-prefix}ios7-alarm:before { content: $ionicon-var-ios7-alarm; }\n.#{$ionicons-prefix}ios7-alarm-outline:before { content: $ionicon-var-ios7-alarm-outline; }\n.#{$ionicons-prefix}ios7-albums:before { content: $ionicon-var-ios7-albums; }\n.#{$ionicons-prefix}ios7-albums-outline:before { content: $ionicon-var-ios7-albums-outline; }\n.#{$ionicons-prefix}ios7-americanfootball:before { content: $ionicon-var-ios7-americanfootball; }\n.#{$ionicons-prefix}ios7-americanfootball-outline:before { content: $ionicon-var-ios7-americanfootball-outline; }\n.#{$ionicons-prefix}ios7-analytics:before { content: $ionicon-var-ios7-analytics; }\n.#{$ionicons-prefix}ios7-analytics-outline:before { content: $ionicon-var-ios7-analytics-outline; }\n.#{$ionicons-prefix}ios7-arrow-back:before { content: $ionicon-var-ios7-arrow-back; }\n.#{$ionicons-prefix}ios7-arrow-down:before { content: $ionicon-var-ios7-arrow-down; }\n.#{$ionicons-prefix}ios7-arrow-forward:before { content: $ionicon-var-ios7-arrow-forward; }\n.#{$ionicons-prefix}ios7-arrow-left:before { content: $ionicon-var-ios7-arrow-left; }\n.#{$ionicons-prefix}ios7-arrow-right:before { content: $ionicon-var-ios7-arrow-right; }\n.#{$ionicons-prefix}ios7-arrow-thin-down:before { content: $ionicon-var-ios7-arrow-thin-down; }\n.#{$ionicons-prefix}ios7-arrow-thin-left:before { content: $ionicon-var-ios7-arrow-thin-left; }\n.#{$ionicons-prefix}ios7-arrow-thin-right:before { content: $ionicon-var-ios7-arrow-thin-right; }\n.#{$ionicons-prefix}ios7-arrow-thin-up:before { content: $ionicon-var-ios7-arrow-thin-up; }\n.#{$ionicons-prefix}ios7-arrow-up:before { content: $ionicon-var-ios7-arrow-up; }\n.#{$ionicons-prefix}ios7-at:before { content: $ionicon-var-ios7-at; }\n.#{$ionicons-prefix}ios7-at-outline:before { content: $ionicon-var-ios7-at-outline; }\n.#{$ionicons-prefix}ios7-barcode:before { content: $ionicon-var-ios7-barcode; }\n.#{$ionicons-prefix}ios7-barcode-outline:before { content: $ionicon-var-ios7-barcode-outline; }\n.#{$ionicons-prefix}ios7-baseball:before { content: $ionicon-var-ios7-baseball; }\n.#{$ionicons-prefix}ios7-baseball-outline:before { content: $ionicon-var-ios7-baseball-outline; }\n.#{$ionicons-prefix}ios7-basketball:before { content: $ionicon-var-ios7-basketball; }\n.#{$ionicons-prefix}ios7-basketball-outline:before { content: $ionicon-var-ios7-basketball-outline; }\n.#{$ionicons-prefix}ios7-bell:before { content: $ionicon-var-ios7-bell; }\n.#{$ionicons-prefix}ios7-bell-outline:before { content: $ionicon-var-ios7-bell-outline; }\n.#{$ionicons-prefix}ios7-bolt:before { content: $ionicon-var-ios7-bolt; }\n.#{$ionicons-prefix}ios7-bolt-outline:before { content: $ionicon-var-ios7-bolt-outline; }\n.#{$ionicons-prefix}ios7-bookmarks:before { content: $ionicon-var-ios7-bookmarks; }\n.#{$ionicons-prefix}ios7-bookmarks-outline:before { content: $ionicon-var-ios7-bookmarks-outline; }\n.#{$ionicons-prefix}ios7-box:before { content: $ionicon-var-ios7-box; }\n.#{$ionicons-prefix}ios7-box-outline:before { content: $ionicon-var-ios7-box-outline; }\n.#{$ionicons-prefix}ios7-briefcase:before { content: $ionicon-var-ios7-briefcase; }\n.#{$ionicons-prefix}ios7-briefcase-outline:before { content: $ionicon-var-ios7-briefcase-outline; }\n.#{$ionicons-prefix}ios7-browsers:before { content: $ionicon-var-ios7-browsers; }\n.#{$ionicons-prefix}ios7-browsers-outline:before { content: $ionicon-var-ios7-browsers-outline; }\n.#{$ionicons-prefix}ios7-calculator:before { content: $ionicon-var-ios7-calculator; }\n.#{$ionicons-prefix}ios7-calculator-outline:before { content: $ionicon-var-ios7-calculator-outline; }\n.#{$ionicons-prefix}ios7-calendar:before { content: $ionicon-var-ios7-calendar; }\n.#{$ionicons-prefix}ios7-calendar-outline:before { content: $ionicon-var-ios7-calendar-outline; }\n.#{$ionicons-prefix}ios7-camera:before { content: $ionicon-var-ios7-camera; }\n.#{$ionicons-prefix}ios7-camera-outline:before { content: $ionicon-var-ios7-camera-outline; }\n.#{$ionicons-prefix}ios7-cart:before { content: $ionicon-var-ios7-cart; }\n.#{$ionicons-prefix}ios7-cart-outline:before { content: $ionicon-var-ios7-cart-outline; }\n.#{$ionicons-prefix}ios7-chatboxes:before { content: $ionicon-var-ios7-chatboxes; }\n.#{$ionicons-prefix}ios7-chatboxes-outline:before { content: $ionicon-var-ios7-chatboxes-outline; }\n.#{$ionicons-prefix}ios7-chatbubble:before { content: $ionicon-var-ios7-chatbubble; }\n.#{$ionicons-prefix}ios7-chatbubble-outline:before { content: $ionicon-var-ios7-chatbubble-outline; }\n.#{$ionicons-prefix}ios7-checkmark:before { content: $ionicon-var-ios7-checkmark; }\n.#{$ionicons-prefix}ios7-checkmark-empty:before { content: $ionicon-var-ios7-checkmark-empty; }\n.#{$ionicons-prefix}ios7-checkmark-outline:before { content: $ionicon-var-ios7-checkmark-outline; }\n.#{$ionicons-prefix}ios7-circle-filled:before { content: $ionicon-var-ios7-circle-filled; }\n.#{$ionicons-prefix}ios7-circle-outline:before { content: $ionicon-var-ios7-circle-outline; }\n.#{$ionicons-prefix}ios7-clock:before { content: $ionicon-var-ios7-clock; }\n.#{$ionicons-prefix}ios7-clock-outline:before { content: $ionicon-var-ios7-clock-outline; }\n.#{$ionicons-prefix}ios7-close:before { content: $ionicon-var-ios7-close; }\n.#{$ionicons-prefix}ios7-close-empty:before { content: $ionicon-var-ios7-close-empty; }\n.#{$ionicons-prefix}ios7-close-outline:before { content: $ionicon-var-ios7-close-outline; }\n.#{$ionicons-prefix}ios7-cloud:before { content: $ionicon-var-ios7-cloud; }\n.#{$ionicons-prefix}ios7-cloud-download:before { content: $ionicon-var-ios7-cloud-download; }\n.#{$ionicons-prefix}ios7-cloud-download-outline:before { content: $ionicon-var-ios7-cloud-download-outline; }\n.#{$ionicons-prefix}ios7-cloud-outline:before { content: $ionicon-var-ios7-cloud-outline; }\n.#{$ionicons-prefix}ios7-cloud-upload:before { content: $ionicon-var-ios7-cloud-upload; }\n.#{$ionicons-prefix}ios7-cloud-upload-outline:before { content: $ionicon-var-ios7-cloud-upload-outline; }\n.#{$ionicons-prefix}ios7-cloudy:before { content: $ionicon-var-ios7-cloudy; }\n.#{$ionicons-prefix}ios7-cloudy-night:before { content: $ionicon-var-ios7-cloudy-night; }\n.#{$ionicons-prefix}ios7-cloudy-night-outline:before { content: $ionicon-var-ios7-cloudy-night-outline; }\n.#{$ionicons-prefix}ios7-cloudy-outline:before { content: $ionicon-var-ios7-cloudy-outline; }\n.#{$ionicons-prefix}ios7-cog:before { content: $ionicon-var-ios7-cog; }\n.#{$ionicons-prefix}ios7-cog-outline:before { content: $ionicon-var-ios7-cog-outline; }\n.#{$ionicons-prefix}ios7-compose:before { content: $ionicon-var-ios7-compose; }\n.#{$ionicons-prefix}ios7-compose-outline:before { content: $ionicon-var-ios7-compose-outline; }\n.#{$ionicons-prefix}ios7-contact:before { content: $ionicon-var-ios7-contact; }\n.#{$ionicons-prefix}ios7-contact-outline:before { content: $ionicon-var-ios7-contact-outline; }\n.#{$ionicons-prefix}ios7-copy:before { content: $ionicon-var-ios7-copy; }\n.#{$ionicons-prefix}ios7-copy-outline:before { content: $ionicon-var-ios7-copy-outline; }\n.#{$ionicons-prefix}ios7-download:before { content: $ionicon-var-ios7-download; }\n.#{$ionicons-prefix}ios7-download-outline:before { content: $ionicon-var-ios7-download-outline; }\n.#{$ionicons-prefix}ios7-drag:before { content: $ionicon-var-ios7-drag; }\n.#{$ionicons-prefix}ios7-email:before { content: $ionicon-var-ios7-email; }\n.#{$ionicons-prefix}ios7-email-outline:before { content: $ionicon-var-ios7-email-outline; }\n.#{$ionicons-prefix}ios7-expand:before { content: $ionicon-var-ios7-expand; }\n.#{$ionicons-prefix}ios7-eye:before { content: $ionicon-var-ios7-eye; }\n.#{$ionicons-prefix}ios7-eye-outline:before { content: $ionicon-var-ios7-eye-outline; }\n.#{$ionicons-prefix}ios7-fastforward:before { content: $ionicon-var-ios7-fastforward; }\n.#{$ionicons-prefix}ios7-fastforward-outline:before { content: $ionicon-var-ios7-fastforward-outline; }\n.#{$ionicons-prefix}ios7-filing:before { content: $ionicon-var-ios7-filing; }\n.#{$ionicons-prefix}ios7-filing-outline:before { content: $ionicon-var-ios7-filing-outline; }\n.#{$ionicons-prefix}ios7-film:before { content: $ionicon-var-ios7-film; }\n.#{$ionicons-prefix}ios7-film-outline:before { content: $ionicon-var-ios7-film-outline; }\n.#{$ionicons-prefix}ios7-flag:before { content: $ionicon-var-ios7-flag; }\n.#{$ionicons-prefix}ios7-flag-outline:before { content: $ionicon-var-ios7-flag-outline; }\n.#{$ionicons-prefix}ios7-folder:before { content: $ionicon-var-ios7-folder; }\n.#{$ionicons-prefix}ios7-folder-outline:before { content: $ionicon-var-ios7-folder-outline; }\n.#{$ionicons-prefix}ios7-football:before { content: $ionicon-var-ios7-football; }\n.#{$ionicons-prefix}ios7-football-outline:before { content: $ionicon-var-ios7-football-outline; }\n.#{$ionicons-prefix}ios7-gear:before { content: $ionicon-var-ios7-gear; }\n.#{$ionicons-prefix}ios7-gear-outline:before { content: $ionicon-var-ios7-gear-outline; }\n.#{$ionicons-prefix}ios7-glasses:before { content: $ionicon-var-ios7-glasses; }\n.#{$ionicons-prefix}ios7-glasses-outline:before { content: $ionicon-var-ios7-glasses-outline; }\n.#{$ionicons-prefix}ios7-heart:before { content: $ionicon-var-ios7-heart; }\n.#{$ionicons-prefix}ios7-heart-outline:before { content: $ionicon-var-ios7-heart-outline; }\n.#{$ionicons-prefix}ios7-help:before { content: $ionicon-var-ios7-help; }\n.#{$ionicons-prefix}ios7-help-empty:before { content: $ionicon-var-ios7-help-empty; }\n.#{$ionicons-prefix}ios7-help-outline:before { content: $ionicon-var-ios7-help-outline; }\n.#{$ionicons-prefix}ios7-home:before { content: $ionicon-var-ios7-home; }\n.#{$ionicons-prefix}ios7-home-outline:before { content: $ionicon-var-ios7-home-outline; }\n.#{$ionicons-prefix}ios7-infinite:before { content: $ionicon-var-ios7-infinite; }\n.#{$ionicons-prefix}ios7-infinite-outline:before { content: $ionicon-var-ios7-infinite-outline; }\n.#{$ionicons-prefix}ios7-information:before { content: $ionicon-var-ios7-information; }\n.#{$ionicons-prefix}ios7-information-empty:before { content: $ionicon-var-ios7-information-empty; }\n.#{$ionicons-prefix}ios7-information-outline:before { content: $ionicon-var-ios7-information-outline; }\n.#{$ionicons-prefix}ios7-ionic-outline:before { content: $ionicon-var-ios7-ionic-outline; }\n.#{$ionicons-prefix}ios7-keypad:before { content: $ionicon-var-ios7-keypad; }\n.#{$ionicons-prefix}ios7-keypad-outline:before { content: $ionicon-var-ios7-keypad-outline; }\n.#{$ionicons-prefix}ios7-lightbulb:before { content: $ionicon-var-ios7-lightbulb; }\n.#{$ionicons-prefix}ios7-lightbulb-outline:before { content: $ionicon-var-ios7-lightbulb-outline; }\n.#{$ionicons-prefix}ios7-location:before { content: $ionicon-var-ios7-location; }\n.#{$ionicons-prefix}ios7-location-outline:before { content: $ionicon-var-ios7-location-outline; }\n.#{$ionicons-prefix}ios7-locked:before { content: $ionicon-var-ios7-locked; }\n.#{$ionicons-prefix}ios7-locked-outline:before { content: $ionicon-var-ios7-locked-outline; }\n.#{$ionicons-prefix}ios7-loop:before { content: $ionicon-var-ios7-loop; }\n.#{$ionicons-prefix}ios7-loop-strong:before { content: $ionicon-var-ios7-loop-strong; }\n.#{$ionicons-prefix}ios7-medkit:before { content: $ionicon-var-ios7-medkit; }\n.#{$ionicons-prefix}ios7-medkit-outline:before { content: $ionicon-var-ios7-medkit-outline; }\n.#{$ionicons-prefix}ios7-mic:before { content: $ionicon-var-ios7-mic; }\n.#{$ionicons-prefix}ios7-mic-off:before { content: $ionicon-var-ios7-mic-off; }\n.#{$ionicons-prefix}ios7-mic-outline:before { content: $ionicon-var-ios7-mic-outline; }\n.#{$ionicons-prefix}ios7-minus:before { content: $ionicon-var-ios7-minus; }\n.#{$ionicons-prefix}ios7-minus-empty:before { content: $ionicon-var-ios7-minus-empty; }\n.#{$ionicons-prefix}ios7-minus-outline:before { content: $ionicon-var-ios7-minus-outline; }\n.#{$ionicons-prefix}ios7-monitor:before { content: $ionicon-var-ios7-monitor; }\n.#{$ionicons-prefix}ios7-monitor-outline:before { content: $ionicon-var-ios7-monitor-outline; }\n.#{$ionicons-prefix}ios7-moon:before { content: $ionicon-var-ios7-moon; }\n.#{$ionicons-prefix}ios7-moon-outline:before { content: $ionicon-var-ios7-moon-outline; }\n.#{$ionicons-prefix}ios7-more:before { content: $ionicon-var-ios7-more; }\n.#{$ionicons-prefix}ios7-more-outline:before { content: $ionicon-var-ios7-more-outline; }\n.#{$ionicons-prefix}ios7-musical-note:before { content: $ionicon-var-ios7-musical-note; }\n.#{$ionicons-prefix}ios7-musical-notes:before { content: $ionicon-var-ios7-musical-notes; }\n.#{$ionicons-prefix}ios7-navigate:before { content: $ionicon-var-ios7-navigate; }\n.#{$ionicons-prefix}ios7-navigate-outline:before { content: $ionicon-var-ios7-navigate-outline; }\n.#{$ionicons-prefix}ios7-paper:before { content: $ionicon-var-ios7-paper; }\n.#{$ionicons-prefix}ios7-paper-outline:before { content: $ionicon-var-ios7-paper-outline; }\n.#{$ionicons-prefix}ios7-paperplane:before { content: $ionicon-var-ios7-paperplane; }\n.#{$ionicons-prefix}ios7-paperplane-outline:before { content: $ionicon-var-ios7-paperplane-outline; }\n.#{$ionicons-prefix}ios7-partlysunny:before { content: $ionicon-var-ios7-partlysunny; }\n.#{$ionicons-prefix}ios7-partlysunny-outline:before { content: $ionicon-var-ios7-partlysunny-outline; }\n.#{$ionicons-prefix}ios7-pause:before { content: $ionicon-var-ios7-pause; }\n.#{$ionicons-prefix}ios7-pause-outline:before { content: $ionicon-var-ios7-pause-outline; }\n.#{$ionicons-prefix}ios7-paw:before { content: $ionicon-var-ios7-paw; }\n.#{$ionicons-prefix}ios7-paw-outline:before { content: $ionicon-var-ios7-paw-outline; }\n.#{$ionicons-prefix}ios7-people:before { content: $ionicon-var-ios7-people; }\n.#{$ionicons-prefix}ios7-people-outline:before { content: $ionicon-var-ios7-people-outline; }\n.#{$ionicons-prefix}ios7-person:before { content: $ionicon-var-ios7-person; }\n.#{$ionicons-prefix}ios7-person-outline:before { content: $ionicon-var-ios7-person-outline; }\n.#{$ionicons-prefix}ios7-personadd:before { content: $ionicon-var-ios7-personadd; }\n.#{$ionicons-prefix}ios7-personadd-outline:before { content: $ionicon-var-ios7-personadd-outline; }\n.#{$ionicons-prefix}ios7-photos:before { content: $ionicon-var-ios7-photos; }\n.#{$ionicons-prefix}ios7-photos-outline:before { content: $ionicon-var-ios7-photos-outline; }\n.#{$ionicons-prefix}ios7-pie:before { content: $ionicon-var-ios7-pie; }\n.#{$ionicons-prefix}ios7-pie-outline:before { content: $ionicon-var-ios7-pie-outline; }\n.#{$ionicons-prefix}ios7-play:before { content: $ionicon-var-ios7-play; }\n.#{$ionicons-prefix}ios7-play-outline:before { content: $ionicon-var-ios7-play-outline; }\n.#{$ionicons-prefix}ios7-plus:before { content: $ionicon-var-ios7-plus; }\n.#{$ionicons-prefix}ios7-plus-empty:before { content: $ionicon-var-ios7-plus-empty; }\n.#{$ionicons-prefix}ios7-plus-outline:before { content: $ionicon-var-ios7-plus-outline; }\n.#{$ionicons-prefix}ios7-pricetag:before { content: $ionicon-var-ios7-pricetag; }\n.#{$ionicons-prefix}ios7-pricetag-outline:before { content: $ionicon-var-ios7-pricetag-outline; }\n.#{$ionicons-prefix}ios7-pricetags:before { content: $ionicon-var-ios7-pricetags; }\n.#{$ionicons-prefix}ios7-pricetags-outline:before { content: $ionicon-var-ios7-pricetags-outline; }\n.#{$ionicons-prefix}ios7-printer:before { content: $ionicon-var-ios7-printer; }\n.#{$ionicons-prefix}ios7-printer-outline:before { content: $ionicon-var-ios7-printer-outline; }\n.#{$ionicons-prefix}ios7-pulse:before { content: $ionicon-var-ios7-pulse; }\n.#{$ionicons-prefix}ios7-pulse-strong:before { content: $ionicon-var-ios7-pulse-strong; }\n.#{$ionicons-prefix}ios7-rainy:before { content: $ionicon-var-ios7-rainy; }\n.#{$ionicons-prefix}ios7-rainy-outline:before { content: $ionicon-var-ios7-rainy-outline; }\n.#{$ionicons-prefix}ios7-recording:before { content: $ionicon-var-ios7-recording; }\n.#{$ionicons-prefix}ios7-recording-outline:before { content: $ionicon-var-ios7-recording-outline; }\n.#{$ionicons-prefix}ios7-redo:before { content: $ionicon-var-ios7-redo; }\n.#{$ionicons-prefix}ios7-redo-outline:before { content: $ionicon-var-ios7-redo-outline; }\n.#{$ionicons-prefix}ios7-refresh:before { content: $ionicon-var-ios7-refresh; }\n.#{$ionicons-prefix}ios7-refresh-empty:before { content: $ionicon-var-ios7-refresh-empty; }\n.#{$ionicons-prefix}ios7-refresh-outline:before { content: $ionicon-var-ios7-refresh-outline; }\n.#{$ionicons-prefix}ios7-reload:before { content: $ionicon-var-ios7-reload; }\n.#{$ionicons-prefix}ios7-reverse-camera:before { content: $ionicon-var-ios7-reverse-camera; }\n.#{$ionicons-prefix}ios7-reverse-camera-outline:before { content: $ionicon-var-ios7-reverse-camera-outline; }\n.#{$ionicons-prefix}ios7-rewind:before { content: $ionicon-var-ios7-rewind; }\n.#{$ionicons-prefix}ios7-rewind-outline:before { content: $ionicon-var-ios7-rewind-outline; }\n.#{$ionicons-prefix}ios7-search:before { content: $ionicon-var-ios7-search; }\n.#{$ionicons-prefix}ios7-search-strong:before { content: $ionicon-var-ios7-search-strong; }\n.#{$ionicons-prefix}ios7-settings:before { content: $ionicon-var-ios7-settings; }\n.#{$ionicons-prefix}ios7-settings-strong:before { content: $ionicon-var-ios7-settings-strong; }\n.#{$ionicons-prefix}ios7-shrink:before { content: $ionicon-var-ios7-shrink; }\n.#{$ionicons-prefix}ios7-skipbackward:before { content: $ionicon-var-ios7-skipbackward; }\n.#{$ionicons-prefix}ios7-skipbackward-outline:before { content: $ionicon-var-ios7-skipbackward-outline; }\n.#{$ionicons-prefix}ios7-skipforward:before { content: $ionicon-var-ios7-skipforward; }\n.#{$ionicons-prefix}ios7-skipforward-outline:before { content: $ionicon-var-ios7-skipforward-outline; }\n.#{$ionicons-prefix}ios7-snowy:before { content: $ionicon-var-ios7-snowy; }\n.#{$ionicons-prefix}ios7-speedometer:before { content: $ionicon-var-ios7-speedometer; }\n.#{$ionicons-prefix}ios7-speedometer-outline:before { content: $ionicon-var-ios7-speedometer-outline; }\n.#{$ionicons-prefix}ios7-star:before { content: $ionicon-var-ios7-star; }\n.#{$ionicons-prefix}ios7-star-half:before { content: $ionicon-var-ios7-star-half; }\n.#{$ionicons-prefix}ios7-star-outline:before { content: $ionicon-var-ios7-star-outline; }\n.#{$ionicons-prefix}ios7-stopwatch:before { content: $ionicon-var-ios7-stopwatch; }\n.#{$ionicons-prefix}ios7-stopwatch-outline:before { content: $ionicon-var-ios7-stopwatch-outline; }\n.#{$ionicons-prefix}ios7-sunny:before { content: $ionicon-var-ios7-sunny; }\n.#{$ionicons-prefix}ios7-sunny-outline:before { content: $ionicon-var-ios7-sunny-outline; }\n.#{$ionicons-prefix}ios7-telephone:before { content: $ionicon-var-ios7-telephone; }\n.#{$ionicons-prefix}ios7-telephone-outline:before { content: $ionicon-var-ios7-telephone-outline; }\n.#{$ionicons-prefix}ios7-tennisball:before { content: $ionicon-var-ios7-tennisball; }\n.#{$ionicons-prefix}ios7-tennisball-outline:before { content: $ionicon-var-ios7-tennisball-outline; }\n.#{$ionicons-prefix}ios7-thunderstorm:before { content: $ionicon-var-ios7-thunderstorm; }\n.#{$ionicons-prefix}ios7-thunderstorm-outline:before { content: $ionicon-var-ios7-thunderstorm-outline; }\n.#{$ionicons-prefix}ios7-time:before { content: $ionicon-var-ios7-time; }\n.#{$ionicons-prefix}ios7-time-outline:before { content: $ionicon-var-ios7-time-outline; }\n.#{$ionicons-prefix}ios7-timer:before { content: $ionicon-var-ios7-timer; }\n.#{$ionicons-prefix}ios7-timer-outline:before { content: $ionicon-var-ios7-timer-outline; }\n.#{$ionicons-prefix}ios7-toggle:before { content: $ionicon-var-ios7-toggle; }\n.#{$ionicons-prefix}ios7-toggle-outline:before { content: $ionicon-var-ios7-toggle-outline; }\n.#{$ionicons-prefix}ios7-trash:before { content: $ionicon-var-ios7-trash; }\n.#{$ionicons-prefix}ios7-trash-outline:before { content: $ionicon-var-ios7-trash-outline; }\n.#{$ionicons-prefix}ios7-undo:before { content: $ionicon-var-ios7-undo; }\n.#{$ionicons-prefix}ios7-undo-outline:before { content: $ionicon-var-ios7-undo-outline; }\n.#{$ionicons-prefix}ios7-unlocked:before { content: $ionicon-var-ios7-unlocked; }\n.#{$ionicons-prefix}ios7-unlocked-outline:before { content: $ionicon-var-ios7-unlocked-outline; }\n.#{$ionicons-prefix}ios7-upload:before { content: $ionicon-var-ios7-upload; }\n.#{$ionicons-prefix}ios7-upload-outline:before { content: $ionicon-var-ios7-upload-outline; }\n.#{$ionicons-prefix}ios7-videocam:before { content: $ionicon-var-ios7-videocam; }\n.#{$ionicons-prefix}ios7-videocam-outline:before { content: $ionicon-var-ios7-videocam-outline; }\n.#{$ionicons-prefix}ios7-volume-high:before { content: $ionicon-var-ios7-volume-high; }\n.#{$ionicons-prefix}ios7-volume-low:before { content: $ionicon-var-ios7-volume-low; }\n.#{$ionicons-prefix}ios7-wineglass:before { content: $ionicon-var-ios7-wineglass; }\n.#{$ionicons-prefix}ios7-wineglass-outline:before { content: $ionicon-var-ios7-wineglass-outline; }\n.#{$ionicons-prefix}ios7-world:before { content: $ionicon-var-ios7-world; }\n.#{$ionicons-prefix}ios7-world-outline:before { content: $ionicon-var-ios7-world-outline; }\n.#{$ionicons-prefix}ipad:before { content: $ionicon-var-ipad; }\n.#{$ionicons-prefix}iphone:before { content: $ionicon-var-iphone; }\n.#{$ionicons-prefix}ipod:before { content: $ionicon-var-ipod; }\n.#{$ionicons-prefix}jet:before { content: $ionicon-var-jet; }\n.#{$ionicons-prefix}key:before { content: $ionicon-var-key; }\n.#{$ionicons-prefix}knife:before { content: $ionicon-var-knife; }\n.#{$ionicons-prefix}laptop:before { content: $ionicon-var-laptop; }\n.#{$ionicons-prefix}leaf:before { content: $ionicon-var-leaf; }\n.#{$ionicons-prefix}levels:before { content: $ionicon-var-levels; }\n.#{$ionicons-prefix}lightbulb:before { content: $ionicon-var-lightbulb; }\n.#{$ionicons-prefix}link:before { content: $ionicon-var-link; }\n.#{$ionicons-prefix}load-a:before { content: $ionicon-var-load-a; }\n.#{$ionicons-prefix}load-b:before { content: $ionicon-var-load-b; }\n.#{$ionicons-prefix}load-c:before { content: $ionicon-var-load-c; }\n.#{$ionicons-prefix}load-d:before { content: $ionicon-var-load-d; }\n.#{$ionicons-prefix}location:before { content: $ionicon-var-location; }\n.#{$ionicons-prefix}locked:before { content: $ionicon-var-locked; }\n.#{$ionicons-prefix}log-in:before { content: $ionicon-var-log-in; }\n.#{$ionicons-prefix}log-out:before { content: $ionicon-var-log-out; }\n.#{$ionicons-prefix}loop:before { content: $ionicon-var-loop; }\n.#{$ionicons-prefix}magnet:before { content: $ionicon-var-magnet; }\n.#{$ionicons-prefix}male:before { content: $ionicon-var-male; }\n.#{$ionicons-prefix}man:before { content: $ionicon-var-man; }\n.#{$ionicons-prefix}map:before { content: $ionicon-var-map; }\n.#{$ionicons-prefix}medkit:before { content: $ionicon-var-medkit; }\n.#{$ionicons-prefix}merge:before { content: $ionicon-var-merge; }\n.#{$ionicons-prefix}mic-a:before { content: $ionicon-var-mic-a; }\n.#{$ionicons-prefix}mic-b:before { content: $ionicon-var-mic-b; }\n.#{$ionicons-prefix}mic-c:before { content: $ionicon-var-mic-c; }\n.#{$ionicons-prefix}minus:before { content: $ionicon-var-minus; }\n.#{$ionicons-prefix}minus-circled:before { content: $ionicon-var-minus-circled; }\n.#{$ionicons-prefix}minus-round:before { content: $ionicon-var-minus-round; }\n.#{$ionicons-prefix}model-s:before { content: $ionicon-var-model-s; }\n.#{$ionicons-prefix}monitor:before { content: $ionicon-var-monitor; }\n.#{$ionicons-prefix}more:before { content: $ionicon-var-more; }\n.#{$ionicons-prefix}mouse:before { content: $ionicon-var-mouse; }\n.#{$ionicons-prefix}music-note:before { content: $ionicon-var-music-note; }\n.#{$ionicons-prefix}navicon:before { content: $ionicon-var-navicon; }\n.#{$ionicons-prefix}navicon-round:before { content: $ionicon-var-navicon-round; }\n.#{$ionicons-prefix}navigate:before { content: $ionicon-var-navigate; }\n.#{$ionicons-prefix}network:before { content: $ionicon-var-network; }\n.#{$ionicons-prefix}no-smoking:before { content: $ionicon-var-no-smoking; }\n.#{$ionicons-prefix}nuclear:before { content: $ionicon-var-nuclear; }\n.#{$ionicons-prefix}outlet:before { content: $ionicon-var-outlet; }\n.#{$ionicons-prefix}paper-airplane:before { content: $ionicon-var-paper-airplane; }\n.#{$ionicons-prefix}paperclip:before { content: $ionicon-var-paperclip; }\n.#{$ionicons-prefix}pause:before { content: $ionicon-var-pause; }\n.#{$ionicons-prefix}person:before { content: $ionicon-var-person; }\n.#{$ionicons-prefix}person-add:before { content: $ionicon-var-person-add; }\n.#{$ionicons-prefix}person-stalker:before { content: $ionicon-var-person-stalker; }\n.#{$ionicons-prefix}pie-graph:before { content: $ionicon-var-pie-graph; }\n.#{$ionicons-prefix}pin:before { content: $ionicon-var-pin; }\n.#{$ionicons-prefix}pinpoint:before { content: $ionicon-var-pinpoint; }\n.#{$ionicons-prefix}pizza:before { content: $ionicon-var-pizza; }\n.#{$ionicons-prefix}plane:before { content: $ionicon-var-plane; }\n.#{$ionicons-prefix}planet:before { content: $ionicon-var-planet; }\n.#{$ionicons-prefix}play:before { content: $ionicon-var-play; }\n.#{$ionicons-prefix}playstation:before { content: $ionicon-var-playstation; }\n.#{$ionicons-prefix}plus:before { content: $ionicon-var-plus; }\n.#{$ionicons-prefix}plus-circled:before { content: $ionicon-var-plus-circled; }\n.#{$ionicons-prefix}plus-round:before { content: $ionicon-var-plus-round; }\n.#{$ionicons-prefix}podium:before { content: $ionicon-var-podium; }\n.#{$ionicons-prefix}pound:before { content: $ionicon-var-pound; }\n.#{$ionicons-prefix}power:before { content: $ionicon-var-power; }\n.#{$ionicons-prefix}pricetag:before { content: $ionicon-var-pricetag; }\n.#{$ionicons-prefix}pricetags:before { content: $ionicon-var-pricetags; }\n.#{$ionicons-prefix}printer:before { content: $ionicon-var-printer; }\n.#{$ionicons-prefix}pull-request:before { content: $ionicon-var-pull-request; }\n.#{$ionicons-prefix}qr-scanner:before { content: $ionicon-var-qr-scanner; }\n.#{$ionicons-prefix}quote:before { content: $ionicon-var-quote; }\n.#{$ionicons-prefix}radio-waves:before { content: $ionicon-var-radio-waves; }\n.#{$ionicons-prefix}record:before { content: $ionicon-var-record; }\n.#{$ionicons-prefix}refresh:before { content: $ionicon-var-refresh; }\n.#{$ionicons-prefix}reply:before { content: $ionicon-var-reply; }\n.#{$ionicons-prefix}reply-all:before { content: $ionicon-var-reply-all; }\n.#{$ionicons-prefix}ribbon-a:before { content: $ionicon-var-ribbon-a; }\n.#{$ionicons-prefix}ribbon-b:before { content: $ionicon-var-ribbon-b; }\n.#{$ionicons-prefix}sad:before { content: $ionicon-var-sad; }\n.#{$ionicons-prefix}scissors:before { content: $ionicon-var-scissors; }\n.#{$ionicons-prefix}search:before { content: $ionicon-var-search; }\n.#{$ionicons-prefix}settings:before { content: $ionicon-var-settings; }\n.#{$ionicons-prefix}share:before { content: $ionicon-var-share; }\n.#{$ionicons-prefix}shuffle:before { content: $ionicon-var-shuffle; }\n.#{$ionicons-prefix}skip-backward:before { content: $ionicon-var-skip-backward; }\n.#{$ionicons-prefix}skip-forward:before { content: $ionicon-var-skip-forward; }\n.#{$ionicons-prefix}social-android:before { content: $ionicon-var-social-android; }\n.#{$ionicons-prefix}social-android-outline:before { content: $ionicon-var-social-android-outline; }\n.#{$ionicons-prefix}social-apple:before { content: $ionicon-var-social-apple; }\n.#{$ionicons-prefix}social-apple-outline:before { content: $ionicon-var-social-apple-outline; }\n.#{$ionicons-prefix}social-bitcoin:before { content: $ionicon-var-social-bitcoin; }\n.#{$ionicons-prefix}social-bitcoin-outline:before { content: $ionicon-var-social-bitcoin-outline; }\n.#{$ionicons-prefix}social-buffer:before { content: $ionicon-var-social-buffer; }\n.#{$ionicons-prefix}social-buffer-outline:before { content: $ionicon-var-social-buffer-outline; }\n.#{$ionicons-prefix}social-designernews:before { content: $ionicon-var-social-designernews; }\n.#{$ionicons-prefix}social-designernews-outline:before { content: $ionicon-var-social-designernews-outline; }\n.#{$ionicons-prefix}social-dribbble:before { content: $ionicon-var-social-dribbble; }\n.#{$ionicons-prefix}social-dribbble-outline:before { content: $ionicon-var-social-dribbble-outline; }\n.#{$ionicons-prefix}social-dropbox:before { content: $ionicon-var-social-dropbox; }\n.#{$ionicons-prefix}social-dropbox-outline:before { content: $ionicon-var-social-dropbox-outline; }\n.#{$ionicons-prefix}social-facebook:before { content: $ionicon-var-social-facebook; }\n.#{$ionicons-prefix}social-facebook-outline:before { content: $ionicon-var-social-facebook-outline; }\n.#{$ionicons-prefix}social-foursquare:before { content: $ionicon-var-social-foursquare; }\n.#{$ionicons-prefix}social-foursquare-outline:before { content: $ionicon-var-social-foursquare-outline; }\n.#{$ionicons-prefix}social-freebsd-devil:before { content: $ionicon-var-social-freebsd-devil; }\n.#{$ionicons-prefix}social-github:before { content: $ionicon-var-social-github; }\n.#{$ionicons-prefix}social-github-outline:before { content: $ionicon-var-social-github-outline; }\n.#{$ionicons-prefix}social-google:before { content: $ionicon-var-social-google; }\n.#{$ionicons-prefix}social-google-outline:before { content: $ionicon-var-social-google-outline; }\n.#{$ionicons-prefix}social-googleplus:before { content: $ionicon-var-social-googleplus; }\n.#{$ionicons-prefix}social-googleplus-outline:before { content: $ionicon-var-social-googleplus-outline; }\n.#{$ionicons-prefix}social-hackernews:before { content: $ionicon-var-social-hackernews; }\n.#{$ionicons-prefix}social-hackernews-outline:before { content: $ionicon-var-social-hackernews-outline; }\n.#{$ionicons-prefix}social-instagram:before { content: $ionicon-var-social-instagram; }\n.#{$ionicons-prefix}social-instagram-outline:before { content: $ionicon-var-social-instagram-outline; }\n.#{$ionicons-prefix}social-linkedin:before { content: $ionicon-var-social-linkedin; }\n.#{$ionicons-prefix}social-linkedin-outline:before { content: $ionicon-var-social-linkedin-outline; }\n.#{$ionicons-prefix}social-pinterest:before { content: $ionicon-var-social-pinterest; }\n.#{$ionicons-prefix}social-pinterest-outline:before { content: $ionicon-var-social-pinterest-outline; }\n.#{$ionicons-prefix}social-reddit:before { content: $ionicon-var-social-reddit; }\n.#{$ionicons-prefix}social-reddit-outline:before { content: $ionicon-var-social-reddit-outline; }\n.#{$ionicons-prefix}social-rss:before { content: $ionicon-var-social-rss; }\n.#{$ionicons-prefix}social-rss-outline:before { content: $ionicon-var-social-rss-outline; }\n.#{$ionicons-prefix}social-skype:before { content: $ionicon-var-social-skype; }\n.#{$ionicons-prefix}social-skype-outline:before { content: $ionicon-var-social-skype-outline; }\n.#{$ionicons-prefix}social-tumblr:before { content: $ionicon-var-social-tumblr; }\n.#{$ionicons-prefix}social-tumblr-outline:before { content: $ionicon-var-social-tumblr-outline; }\n.#{$ionicons-prefix}social-tux:before { content: $ionicon-var-social-tux; }\n.#{$ionicons-prefix}social-twitter:before { content: $ionicon-var-social-twitter; }\n.#{$ionicons-prefix}social-twitter-outline:before { content: $ionicon-var-social-twitter-outline; }\n.#{$ionicons-prefix}social-usd:before { content: $ionicon-var-social-usd; }\n.#{$ionicons-prefix}social-usd-outline:before { content: $ionicon-var-social-usd-outline; }\n.#{$ionicons-prefix}social-vimeo:before { content: $ionicon-var-social-vimeo; }\n.#{$ionicons-prefix}social-vimeo-outline:before { content: $ionicon-var-social-vimeo-outline; }\n.#{$ionicons-prefix}social-windows:before { content: $ionicon-var-social-windows; }\n.#{$ionicons-prefix}social-windows-outline:before { content: $ionicon-var-social-windows-outline; }\n.#{$ionicons-prefix}social-wordpress:before { content: $ionicon-var-social-wordpress; }\n.#{$ionicons-prefix}social-wordpress-outline:before { content: $ionicon-var-social-wordpress-outline; }\n.#{$ionicons-prefix}social-yahoo:before { content: $ionicon-var-social-yahoo; }\n.#{$ionicons-prefix}social-yahoo-outline:before { content: $ionicon-var-social-yahoo-outline; }\n.#{$ionicons-prefix}social-youtube:before { content: $ionicon-var-social-youtube; }\n.#{$ionicons-prefix}social-youtube-outline:before { content: $ionicon-var-social-youtube-outline; }\n.#{$ionicons-prefix}speakerphone:before { content: $ionicon-var-speakerphone; }\n.#{$ionicons-prefix}speedometer:before { content: $ionicon-var-speedometer; }\n.#{$ionicons-prefix}spoon:before { content: $ionicon-var-spoon; }\n.#{$ionicons-prefix}star:before { content: $ionicon-var-star; }\n.#{$ionicons-prefix}stats-bars:before { content: $ionicon-var-stats-bars; }\n.#{$ionicons-prefix}steam:before { content: $ionicon-var-steam; }\n.#{$ionicons-prefix}stop:before { content: $ionicon-var-stop; }\n.#{$ionicons-prefix}thermometer:before { content: $ionicon-var-thermometer; }\n.#{$ionicons-prefix}thumbsdown:before { content: $ionicon-var-thumbsdown; }\n.#{$ionicons-prefix}thumbsup:before { content: $ionicon-var-thumbsup; }\n.#{$ionicons-prefix}toggle:before { content: $ionicon-var-toggle; }\n.#{$ionicons-prefix}toggle-filled:before { content: $ionicon-var-toggle-filled; }\n.#{$ionicons-prefix}trash-a:before { content: $ionicon-var-trash-a; }\n.#{$ionicons-prefix}trash-b:before { content: $ionicon-var-trash-b; }\n.#{$ionicons-prefix}trophy:before { content: $ionicon-var-trophy; }\n.#{$ionicons-prefix}umbrella:before { content: $ionicon-var-umbrella; }\n.#{$ionicons-prefix}university:before { content: $ionicon-var-university; }\n.#{$ionicons-prefix}unlocked:before { content: $ionicon-var-unlocked; }\n.#{$ionicons-prefix}upload:before { content: $ionicon-var-upload; }\n.#{$ionicons-prefix}usb:before { content: $ionicon-var-usb; }\n.#{$ionicons-prefix}videocamera:before { content: $ionicon-var-videocamera; }\n.#{$ionicons-prefix}volume-high:before { content: $ionicon-var-volume-high; }\n.#{$ionicons-prefix}volume-low:before { content: $ionicon-var-volume-low; }\n.#{$ionicons-prefix}volume-medium:before { content: $ionicon-var-volume-medium; }\n.#{$ionicons-prefix}volume-mute:before { content: $ionicon-var-volume-mute; }\n.#{$ionicons-prefix}wand:before { content: $ionicon-var-wand; }\n.#{$ionicons-prefix}waterdrop:before { content: $ionicon-var-waterdrop; }\n.#{$ionicons-prefix}wifi:before { content: $ionicon-var-wifi; }\n.#{$ionicons-prefix}wineglass:before { content: $ionicon-var-wineglass; }\n.#{$ionicons-prefix}woman:before { content: $ionicon-var-woman; }\n.#{$ionicons-prefix}wrench:before { content: $ionicon-var-wrench; }\n.#{$ionicons-prefix}xbox:before { content: $ionicon-var-xbox; }"
  },
  {
    "path": "www/lib/ionic/scss/ionicons/_ionicons-variables.scss",
    "content": "// Ionicons Variables\n// --------------------------\n\n$ionicons-font-path: \"../fonts\" !default;\n$ionicons-font-family: \"Ionicons\" !default;\n$ionicons-version: \"1.5.2\" !default;\n$ionicons-prefix: ion- !default;\n\n$ionicon-var-alert: \"\\f101\";\n$ionicon-var-alert-circled: \"\\f100\";\n$ionicon-var-android-add: \"\\f2c7\";\n$ionicon-var-android-add-contact: \"\\f2c6\";\n$ionicon-var-android-alarm: \"\\f2c8\";\n$ionicon-var-android-archive: \"\\f2c9\";\n$ionicon-var-android-arrow-back: \"\\f2ca\";\n$ionicon-var-android-arrow-down-left: \"\\f2cb\";\n$ionicon-var-android-arrow-down-right: \"\\f2cc\";\n$ionicon-var-android-arrow-forward: \"\\f30f\";\n$ionicon-var-android-arrow-up-left: \"\\f2cd\";\n$ionicon-var-android-arrow-up-right: \"\\f2ce\";\n$ionicon-var-android-battery: \"\\f2cf\";\n$ionicon-var-android-book: \"\\f2d0\";\n$ionicon-var-android-calendar: \"\\f2d1\";\n$ionicon-var-android-call: \"\\f2d2\";\n$ionicon-var-android-camera: \"\\f2d3\";\n$ionicon-var-android-chat: \"\\f2d4\";\n$ionicon-var-android-checkmark: \"\\f2d5\";\n$ionicon-var-android-clock: \"\\f2d6\";\n$ionicon-var-android-close: \"\\f2d7\";\n$ionicon-var-android-contact: \"\\f2d8\";\n$ionicon-var-android-contacts: \"\\f2d9\";\n$ionicon-var-android-data: \"\\f2da\";\n$ionicon-var-android-developer: \"\\f2db\";\n$ionicon-var-android-display: \"\\f2dc\";\n$ionicon-var-android-download: \"\\f2dd\";\n$ionicon-var-android-drawer: \"\\f310\";\n$ionicon-var-android-dropdown: \"\\f2de\";\n$ionicon-var-android-earth: \"\\f2df\";\n$ionicon-var-android-folder: \"\\f2e0\";\n$ionicon-var-android-forums: \"\\f2e1\";\n$ionicon-var-android-friends: \"\\f2e2\";\n$ionicon-var-android-hand: \"\\f2e3\";\n$ionicon-var-android-image: \"\\f2e4\";\n$ionicon-var-android-inbox: \"\\f2e5\";\n$ionicon-var-android-information: \"\\f2e6\";\n$ionicon-var-android-keypad: \"\\f2e7\";\n$ionicon-var-android-lightbulb: \"\\f2e8\";\n$ionicon-var-android-locate: \"\\f2e9\";\n$ionicon-var-android-location: \"\\f2ea\";\n$ionicon-var-android-mail: \"\\f2eb\";\n$ionicon-var-android-microphone: \"\\f2ec\";\n$ionicon-var-android-mixer: \"\\f2ed\";\n$ionicon-var-android-more: \"\\f2ee\";\n$ionicon-var-android-note: \"\\f2ef\";\n$ionicon-var-android-playstore: \"\\f2f0\";\n$ionicon-var-android-printer: \"\\f2f1\";\n$ionicon-var-android-promotion: \"\\f2f2\";\n$ionicon-var-android-reminder: \"\\f2f3\";\n$ionicon-var-android-remove: \"\\f2f4\";\n$ionicon-var-android-search: \"\\f2f5\";\n$ionicon-var-android-send: \"\\f2f6\";\n$ionicon-var-android-settings: \"\\f2f7\";\n$ionicon-var-android-share: \"\\f2f8\";\n$ionicon-var-android-social: \"\\f2fa\";\n$ionicon-var-android-social-user: \"\\f2f9\";\n$ionicon-var-android-sort: \"\\f2fb\";\n$ionicon-var-android-stair-drawer: \"\\f311\";\n$ionicon-var-android-star: \"\\f2fc\";\n$ionicon-var-android-stopwatch: \"\\f2fd\";\n$ionicon-var-android-storage: \"\\f2fe\";\n$ionicon-var-android-system-back: \"\\f2ff\";\n$ionicon-var-android-system-home: \"\\f300\";\n$ionicon-var-android-system-windows: \"\\f301\";\n$ionicon-var-android-timer: \"\\f302\";\n$ionicon-var-android-trash: \"\\f303\";\n$ionicon-var-android-user-menu: \"\\f312\";\n$ionicon-var-android-volume: \"\\f304\";\n$ionicon-var-android-wifi: \"\\f305\";\n$ionicon-var-aperture: \"\\f313\";\n$ionicon-var-archive: \"\\f102\";\n$ionicon-var-arrow-down-a: \"\\f103\";\n$ionicon-var-arrow-down-b: \"\\f104\";\n$ionicon-var-arrow-down-c: \"\\f105\";\n$ionicon-var-arrow-expand: \"\\f25e\";\n$ionicon-var-arrow-graph-down-left: \"\\f25f\";\n$ionicon-var-arrow-graph-down-right: \"\\f260\";\n$ionicon-var-arrow-graph-up-left: \"\\f261\";\n$ionicon-var-arrow-graph-up-right: \"\\f262\";\n$ionicon-var-arrow-left-a: \"\\f106\";\n$ionicon-var-arrow-left-b: \"\\f107\";\n$ionicon-var-arrow-left-c: \"\\f108\";\n$ionicon-var-arrow-move: \"\\f263\";\n$ionicon-var-arrow-resize: \"\\f264\";\n$ionicon-var-arrow-return-left: \"\\f265\";\n$ionicon-var-arrow-return-right: \"\\f266\";\n$ionicon-var-arrow-right-a: \"\\f109\";\n$ionicon-var-arrow-right-b: \"\\f10a\";\n$ionicon-var-arrow-right-c: \"\\f10b\";\n$ionicon-var-arrow-shrink: \"\\f267\";\n$ionicon-var-arrow-swap: \"\\f268\";\n$ionicon-var-arrow-up-a: \"\\f10c\";\n$ionicon-var-arrow-up-b: \"\\f10d\";\n$ionicon-var-arrow-up-c: \"\\f10e\";\n$ionicon-var-asterisk: \"\\f314\";\n$ionicon-var-at: \"\\f10f\";\n$ionicon-var-bag: \"\\f110\";\n$ionicon-var-battery-charging: \"\\f111\";\n$ionicon-var-battery-empty: \"\\f112\";\n$ionicon-var-battery-full: \"\\f113\";\n$ionicon-var-battery-half: \"\\f114\";\n$ionicon-var-battery-low: \"\\f115\";\n$ionicon-var-beaker: \"\\f269\";\n$ionicon-var-beer: \"\\f26a\";\n$ionicon-var-bluetooth: \"\\f116\";\n$ionicon-var-bonfire: \"\\f315\";\n$ionicon-var-bookmark: \"\\f26b\";\n$ionicon-var-briefcase: \"\\f26c\";\n$ionicon-var-bug: \"\\f2be\";\n$ionicon-var-calculator: \"\\f26d\";\n$ionicon-var-calendar: \"\\f117\";\n$ionicon-var-camera: \"\\f118\";\n$ionicon-var-card: \"\\f119\";\n$ionicon-var-cash: \"\\f316\";\n$ionicon-var-chatbox: \"\\f11b\";\n$ionicon-var-chatbox-working: \"\\f11a\";\n$ionicon-var-chatboxes: \"\\f11c\";\n$ionicon-var-chatbubble: \"\\f11e\";\n$ionicon-var-chatbubble-working: \"\\f11d\";\n$ionicon-var-chatbubbles: \"\\f11f\";\n$ionicon-var-checkmark: \"\\f122\";\n$ionicon-var-checkmark-circled: \"\\f120\";\n$ionicon-var-checkmark-round: \"\\f121\";\n$ionicon-var-chevron-down: \"\\f123\";\n$ionicon-var-chevron-left: \"\\f124\";\n$ionicon-var-chevron-right: \"\\f125\";\n$ionicon-var-chevron-up: \"\\f126\";\n$ionicon-var-clipboard: \"\\f127\";\n$ionicon-var-clock: \"\\f26e\";\n$ionicon-var-close: \"\\f12a\";\n$ionicon-var-close-circled: \"\\f128\";\n$ionicon-var-close-round: \"\\f129\";\n$ionicon-var-closed-captioning: \"\\f317\";\n$ionicon-var-cloud: \"\\f12b\";\n$ionicon-var-code: \"\\f271\";\n$ionicon-var-code-download: \"\\f26f\";\n$ionicon-var-code-working: \"\\f270\";\n$ionicon-var-coffee: \"\\f272\";\n$ionicon-var-compass: \"\\f273\";\n$ionicon-var-compose: \"\\f12c\";\n$ionicon-var-connection-bars: \"\\f274\";\n$ionicon-var-contrast: \"\\f275\";\n$ionicon-var-cube: \"\\f318\";\n$ionicon-var-disc: \"\\f12d\";\n$ionicon-var-document: \"\\f12f\";\n$ionicon-var-document-text: \"\\f12e\";\n$ionicon-var-drag: \"\\f130\";\n$ionicon-var-earth: \"\\f276\";\n$ionicon-var-edit: \"\\f2bf\";\n$ionicon-var-egg: \"\\f277\";\n$ionicon-var-eject: \"\\f131\";\n$ionicon-var-email: \"\\f132\";\n$ionicon-var-eye: \"\\f133\";\n$ionicon-var-eye-disabled: \"\\f306\";\n$ionicon-var-female: \"\\f278\";\n$ionicon-var-filing: \"\\f134\";\n$ionicon-var-film-marker: \"\\f135\";\n$ionicon-var-fireball: \"\\f319\";\n$ionicon-var-flag: \"\\f279\";\n$ionicon-var-flame: \"\\f31a\";\n$ionicon-var-flash: \"\\f137\";\n$ionicon-var-flash-off: \"\\f136\";\n$ionicon-var-flask: \"\\f138\";\n$ionicon-var-folder: \"\\f139\";\n$ionicon-var-fork: \"\\f27a\";\n$ionicon-var-fork-repo: \"\\f2c0\";\n$ionicon-var-forward: \"\\f13a\";\n$ionicon-var-funnel: \"\\f31b\";\n$ionicon-var-game-controller-a: \"\\f13b\";\n$ionicon-var-game-controller-b: \"\\f13c\";\n$ionicon-var-gear-a: \"\\f13d\";\n$ionicon-var-gear-b: \"\\f13e\";\n$ionicon-var-grid: \"\\f13f\";\n$ionicon-var-hammer: \"\\f27b\";\n$ionicon-var-happy: \"\\f31c\";\n$ionicon-var-headphone: \"\\f140\";\n$ionicon-var-heart: \"\\f141\";\n$ionicon-var-heart-broken: \"\\f31d\";\n$ionicon-var-help: \"\\f143\";\n$ionicon-var-help-buoy: \"\\f27c\";\n$ionicon-var-help-circled: \"\\f142\";\n$ionicon-var-home: \"\\f144\";\n$ionicon-var-icecream: \"\\f27d\";\n$ionicon-var-icon-social-google-plus: \"\\f146\";\n$ionicon-var-icon-social-google-plus-outline: \"\\f145\";\n$ionicon-var-image: \"\\f147\";\n$ionicon-var-images: \"\\f148\";\n$ionicon-var-information: \"\\f14a\";\n$ionicon-var-information-circled: \"\\f149\";\n$ionicon-var-ionic: \"\\f14b\";\n$ionicon-var-ios7-alarm: \"\\f14d\";\n$ionicon-var-ios7-alarm-outline: \"\\f14c\";\n$ionicon-var-ios7-albums: \"\\f14f\";\n$ionicon-var-ios7-albums-outline: \"\\f14e\";\n$ionicon-var-ios7-americanfootball: \"\\f31f\";\n$ionicon-var-ios7-americanfootball-outline: \"\\f31e\";\n$ionicon-var-ios7-analytics: \"\\f321\";\n$ionicon-var-ios7-analytics-outline: \"\\f320\";\n$ionicon-var-ios7-arrow-back: \"\\f150\";\n$ionicon-var-ios7-arrow-down: \"\\f151\";\n$ionicon-var-ios7-arrow-forward: \"\\f152\";\n$ionicon-var-ios7-arrow-left: \"\\f153\";\n$ionicon-var-ios7-arrow-right: \"\\f154\";\n$ionicon-var-ios7-arrow-thin-down: \"\\f27e\";\n$ionicon-var-ios7-arrow-thin-left: \"\\f27f\";\n$ionicon-var-ios7-arrow-thin-right: \"\\f280\";\n$ionicon-var-ios7-arrow-thin-up: \"\\f281\";\n$ionicon-var-ios7-arrow-up: \"\\f155\";\n$ionicon-var-ios7-at: \"\\f157\";\n$ionicon-var-ios7-at-outline: \"\\f156\";\n$ionicon-var-ios7-barcode: \"\\f323\";\n$ionicon-var-ios7-barcode-outline: \"\\f322\";\n$ionicon-var-ios7-baseball: \"\\f325\";\n$ionicon-var-ios7-baseball-outline: \"\\f324\";\n$ionicon-var-ios7-basketball: \"\\f327\";\n$ionicon-var-ios7-basketball-outline: \"\\f326\";\n$ionicon-var-ios7-bell: \"\\f159\";\n$ionicon-var-ios7-bell-outline: \"\\f158\";\n$ionicon-var-ios7-bolt: \"\\f15b\";\n$ionicon-var-ios7-bolt-outline: \"\\f15a\";\n$ionicon-var-ios7-bookmarks: \"\\f15d\";\n$ionicon-var-ios7-bookmarks-outline: \"\\f15c\";\n$ionicon-var-ios7-box: \"\\f15f\";\n$ionicon-var-ios7-box-outline: \"\\f15e\";\n$ionicon-var-ios7-briefcase: \"\\f283\";\n$ionicon-var-ios7-briefcase-outline: \"\\f282\";\n$ionicon-var-ios7-browsers: \"\\f161\";\n$ionicon-var-ios7-browsers-outline: \"\\f160\";\n$ionicon-var-ios7-calculator: \"\\f285\";\n$ionicon-var-ios7-calculator-outline: \"\\f284\";\n$ionicon-var-ios7-calendar: \"\\f163\";\n$ionicon-var-ios7-calendar-outline: \"\\f162\";\n$ionicon-var-ios7-camera: \"\\f165\";\n$ionicon-var-ios7-camera-outline: \"\\f164\";\n$ionicon-var-ios7-cart: \"\\f167\";\n$ionicon-var-ios7-cart-outline: \"\\f166\";\n$ionicon-var-ios7-chatboxes: \"\\f169\";\n$ionicon-var-ios7-chatboxes-outline: \"\\f168\";\n$ionicon-var-ios7-chatbubble: \"\\f16b\";\n$ionicon-var-ios7-chatbubble-outline: \"\\f16a\";\n$ionicon-var-ios7-checkmark: \"\\f16e\";\n$ionicon-var-ios7-checkmark-empty: \"\\f16c\";\n$ionicon-var-ios7-checkmark-outline: \"\\f16d\";\n$ionicon-var-ios7-circle-filled: \"\\f16f\";\n$ionicon-var-ios7-circle-outline: \"\\f170\";\n$ionicon-var-ios7-clock: \"\\f172\";\n$ionicon-var-ios7-clock-outline: \"\\f171\";\n$ionicon-var-ios7-close: \"\\f2bc\";\n$ionicon-var-ios7-close-empty: \"\\f2bd\";\n$ionicon-var-ios7-close-outline: \"\\f2bb\";\n$ionicon-var-ios7-cloud: \"\\f178\";\n$ionicon-var-ios7-cloud-download: \"\\f174\";\n$ionicon-var-ios7-cloud-download-outline: \"\\f173\";\n$ionicon-var-ios7-cloud-outline: \"\\f175\";\n$ionicon-var-ios7-cloud-upload: \"\\f177\";\n$ionicon-var-ios7-cloud-upload-outline: \"\\f176\";\n$ionicon-var-ios7-cloudy: \"\\f17a\";\n$ionicon-var-ios7-cloudy-night: \"\\f308\";\n$ionicon-var-ios7-cloudy-night-outline: \"\\f307\";\n$ionicon-var-ios7-cloudy-outline: \"\\f179\";\n$ionicon-var-ios7-cog: \"\\f17c\";\n$ionicon-var-ios7-cog-outline: \"\\f17b\";\n$ionicon-var-ios7-compose: \"\\f17e\";\n$ionicon-var-ios7-compose-outline: \"\\f17d\";\n$ionicon-var-ios7-contact: \"\\f180\";\n$ionicon-var-ios7-contact-outline: \"\\f17f\";\n$ionicon-var-ios7-copy: \"\\f182\";\n$ionicon-var-ios7-copy-outline: \"\\f181\";\n$ionicon-var-ios7-download: \"\\f184\";\n$ionicon-var-ios7-download-outline: \"\\f183\";\n$ionicon-var-ios7-drag: \"\\f185\";\n$ionicon-var-ios7-email: \"\\f187\";\n$ionicon-var-ios7-email-outline: \"\\f186\";\n$ionicon-var-ios7-expand: \"\\f30d\";\n$ionicon-var-ios7-eye: \"\\f189\";\n$ionicon-var-ios7-eye-outline: \"\\f188\";\n$ionicon-var-ios7-fastforward: \"\\f18b\";\n$ionicon-var-ios7-fastforward-outline: \"\\f18a\";\n$ionicon-var-ios7-filing: \"\\f18d\";\n$ionicon-var-ios7-filing-outline: \"\\f18c\";\n$ionicon-var-ios7-film: \"\\f18f\";\n$ionicon-var-ios7-film-outline: \"\\f18e\";\n$ionicon-var-ios7-flag: \"\\f191\";\n$ionicon-var-ios7-flag-outline: \"\\f190\";\n$ionicon-var-ios7-folder: \"\\f193\";\n$ionicon-var-ios7-folder-outline: \"\\f192\";\n$ionicon-var-ios7-football: \"\\f329\";\n$ionicon-var-ios7-football-outline: \"\\f328\";\n$ionicon-var-ios7-gear: \"\\f195\";\n$ionicon-var-ios7-gear-outline: \"\\f194\";\n$ionicon-var-ios7-glasses: \"\\f197\";\n$ionicon-var-ios7-glasses-outline: \"\\f196\";\n$ionicon-var-ios7-heart: \"\\f199\";\n$ionicon-var-ios7-heart-outline: \"\\f198\";\n$ionicon-var-ios7-help: \"\\f19c\";\n$ionicon-var-ios7-help-empty: \"\\f19a\";\n$ionicon-var-ios7-help-outline: \"\\f19b\";\n$ionicon-var-ios7-home: \"\\f32b\";\n$ionicon-var-ios7-home-outline: \"\\f32a\";\n$ionicon-var-ios7-infinite: \"\\f19e\";\n$ionicon-var-ios7-infinite-outline: \"\\f19d\";\n$ionicon-var-ios7-information: \"\\f1a1\";\n$ionicon-var-ios7-information-empty: \"\\f19f\";\n$ionicon-var-ios7-information-outline: \"\\f1a0\";\n$ionicon-var-ios7-ionic-outline: \"\\f1a2\";\n$ionicon-var-ios7-keypad: \"\\f1a4\";\n$ionicon-var-ios7-keypad-outline: \"\\f1a3\";\n$ionicon-var-ios7-lightbulb: \"\\f287\";\n$ionicon-var-ios7-lightbulb-outline: \"\\f286\";\n$ionicon-var-ios7-location: \"\\f1a6\";\n$ionicon-var-ios7-location-outline: \"\\f1a5\";\n$ionicon-var-ios7-locked: \"\\f1a8\";\n$ionicon-var-ios7-locked-outline: \"\\f1a7\";\n$ionicon-var-ios7-loop: \"\\f32d\";\n$ionicon-var-ios7-loop-strong: \"\\f32c\";\n$ionicon-var-ios7-medkit: \"\\f289\";\n$ionicon-var-ios7-medkit-outline: \"\\f288\";\n$ionicon-var-ios7-mic: \"\\f1ab\";\n$ionicon-var-ios7-mic-off: \"\\f1a9\";\n$ionicon-var-ios7-mic-outline: \"\\f1aa\";\n$ionicon-var-ios7-minus: \"\\f1ae\";\n$ionicon-var-ios7-minus-empty: \"\\f1ac\";\n$ionicon-var-ios7-minus-outline: \"\\f1ad\";\n$ionicon-var-ios7-monitor: \"\\f1b0\";\n$ionicon-var-ios7-monitor-outline: \"\\f1af\";\n$ionicon-var-ios7-moon: \"\\f1b2\";\n$ionicon-var-ios7-moon-outline: \"\\f1b1\";\n$ionicon-var-ios7-more: \"\\f1b4\";\n$ionicon-var-ios7-more-outline: \"\\f1b3\";\n$ionicon-var-ios7-musical-note: \"\\f1b5\";\n$ionicon-var-ios7-musical-notes: \"\\f1b6\";\n$ionicon-var-ios7-navigate: \"\\f1b8\";\n$ionicon-var-ios7-navigate-outline: \"\\f1b7\";\n$ionicon-var-ios7-paper: \"\\f32f\";\n$ionicon-var-ios7-paper-outline: \"\\f32e\";\n$ionicon-var-ios7-paperplane: \"\\f1ba\";\n$ionicon-var-ios7-paperplane-outline: \"\\f1b9\";\n$ionicon-var-ios7-partlysunny: \"\\f1bc\";\n$ionicon-var-ios7-partlysunny-outline: \"\\f1bb\";\n$ionicon-var-ios7-pause: \"\\f1be\";\n$ionicon-var-ios7-pause-outline: \"\\f1bd\";\n$ionicon-var-ios7-paw: \"\\f331\";\n$ionicon-var-ios7-paw-outline: \"\\f330\";\n$ionicon-var-ios7-people: \"\\f1c0\";\n$ionicon-var-ios7-people-outline: \"\\f1bf\";\n$ionicon-var-ios7-person: \"\\f1c2\";\n$ionicon-var-ios7-person-outline: \"\\f1c1\";\n$ionicon-var-ios7-personadd: \"\\f1c4\";\n$ionicon-var-ios7-personadd-outline: \"\\f1c3\";\n$ionicon-var-ios7-photos: \"\\f1c6\";\n$ionicon-var-ios7-photos-outline: \"\\f1c5\";\n$ionicon-var-ios7-pie: \"\\f28b\";\n$ionicon-var-ios7-pie-outline: \"\\f28a\";\n$ionicon-var-ios7-play: \"\\f1c8\";\n$ionicon-var-ios7-play-outline: \"\\f1c7\";\n$ionicon-var-ios7-plus: \"\\f1cb\";\n$ionicon-var-ios7-plus-empty: \"\\f1c9\";\n$ionicon-var-ios7-plus-outline: \"\\f1ca\";\n$ionicon-var-ios7-pricetag: \"\\f28d\";\n$ionicon-var-ios7-pricetag-outline: \"\\f28c\";\n$ionicon-var-ios7-pricetags: \"\\f333\";\n$ionicon-var-ios7-pricetags-outline: \"\\f332\";\n$ionicon-var-ios7-printer: \"\\f1cd\";\n$ionicon-var-ios7-printer-outline: \"\\f1cc\";\n$ionicon-var-ios7-pulse: \"\\f335\";\n$ionicon-var-ios7-pulse-strong: \"\\f334\";\n$ionicon-var-ios7-rainy: \"\\f1cf\";\n$ionicon-var-ios7-rainy-outline: \"\\f1ce\";\n$ionicon-var-ios7-recording: \"\\f1d1\";\n$ionicon-var-ios7-recording-outline: \"\\f1d0\";\n$ionicon-var-ios7-redo: \"\\f1d3\";\n$ionicon-var-ios7-redo-outline: \"\\f1d2\";\n$ionicon-var-ios7-refresh: \"\\f1d6\";\n$ionicon-var-ios7-refresh-empty: \"\\f1d4\";\n$ionicon-var-ios7-refresh-outline: \"\\f1d5\";\n$ionicon-var-ios7-reload: \"\\f28e\";\n$ionicon-var-ios7-reverse-camera: \"\\f337\";\n$ionicon-var-ios7-reverse-camera-outline: \"\\f336\";\n$ionicon-var-ios7-rewind: \"\\f1d8\";\n$ionicon-var-ios7-rewind-outline: \"\\f1d7\";\n$ionicon-var-ios7-search: \"\\f1da\";\n$ionicon-var-ios7-search-strong: \"\\f1d9\";\n$ionicon-var-ios7-settings: \"\\f339\";\n$ionicon-var-ios7-settings-strong: \"\\f338\";\n$ionicon-var-ios7-shrink: \"\\f30e\";\n$ionicon-var-ios7-skipbackward: \"\\f1dc\";\n$ionicon-var-ios7-skipbackward-outline: \"\\f1db\";\n$ionicon-var-ios7-skipforward: \"\\f1de\";\n$ionicon-var-ios7-skipforward-outline: \"\\f1dd\";\n$ionicon-var-ios7-snowy: \"\\f309\";\n$ionicon-var-ios7-speedometer: \"\\f290\";\n$ionicon-var-ios7-speedometer-outline: \"\\f28f\";\n$ionicon-var-ios7-star: \"\\f1e0\";\n$ionicon-var-ios7-star-half: \"\\f33a\";\n$ionicon-var-ios7-star-outline: \"\\f1df\";\n$ionicon-var-ios7-stopwatch: \"\\f1e2\";\n$ionicon-var-ios7-stopwatch-outline: \"\\f1e1\";\n$ionicon-var-ios7-sunny: \"\\f1e4\";\n$ionicon-var-ios7-sunny-outline: \"\\f1e3\";\n$ionicon-var-ios7-telephone: \"\\f1e6\";\n$ionicon-var-ios7-telephone-outline: \"\\f1e5\";\n$ionicon-var-ios7-tennisball: \"\\f33c\";\n$ionicon-var-ios7-tennisball-outline: \"\\f33b\";\n$ionicon-var-ios7-thunderstorm: \"\\f1e8\";\n$ionicon-var-ios7-thunderstorm-outline: \"\\f1e7\";\n$ionicon-var-ios7-time: \"\\f292\";\n$ionicon-var-ios7-time-outline: \"\\f291\";\n$ionicon-var-ios7-timer: \"\\f1ea\";\n$ionicon-var-ios7-timer-outline: \"\\f1e9\";\n$ionicon-var-ios7-toggle: \"\\f33e\";\n$ionicon-var-ios7-toggle-outline: \"\\f33d\";\n$ionicon-var-ios7-trash: \"\\f1ec\";\n$ionicon-var-ios7-trash-outline: \"\\f1eb\";\n$ionicon-var-ios7-undo: \"\\f1ee\";\n$ionicon-var-ios7-undo-outline: \"\\f1ed\";\n$ionicon-var-ios7-unlocked: \"\\f1f0\";\n$ionicon-var-ios7-unlocked-outline: \"\\f1ef\";\n$ionicon-var-ios7-upload: \"\\f1f2\";\n$ionicon-var-ios7-upload-outline: \"\\f1f1\";\n$ionicon-var-ios7-videocam: \"\\f1f4\";\n$ionicon-var-ios7-videocam-outline: \"\\f1f3\";\n$ionicon-var-ios7-volume-high: \"\\f1f5\";\n$ionicon-var-ios7-volume-low: \"\\f1f6\";\n$ionicon-var-ios7-wineglass: \"\\f294\";\n$ionicon-var-ios7-wineglass-outline: \"\\f293\";\n$ionicon-var-ios7-world: \"\\f1f8\";\n$ionicon-var-ios7-world-outline: \"\\f1f7\";\n$ionicon-var-ipad: \"\\f1f9\";\n$ionicon-var-iphone: \"\\f1fa\";\n$ionicon-var-ipod: \"\\f1fb\";\n$ionicon-var-jet: \"\\f295\";\n$ionicon-var-key: \"\\f296\";\n$ionicon-var-knife: \"\\f297\";\n$ionicon-var-laptop: \"\\f1fc\";\n$ionicon-var-leaf: \"\\f1fd\";\n$ionicon-var-levels: \"\\f298\";\n$ionicon-var-lightbulb: \"\\f299\";\n$ionicon-var-link: \"\\f1fe\";\n$ionicon-var-load-a: \"\\f29a\";\n$ionicon-var-load-b: \"\\f29b\";\n$ionicon-var-load-c: \"\\f29c\";\n$ionicon-var-load-d: \"\\f29d\";\n$ionicon-var-location: \"\\f1ff\";\n$ionicon-var-locked: \"\\f200\";\n$ionicon-var-log-in: \"\\f29e\";\n$ionicon-var-log-out: \"\\f29f\";\n$ionicon-var-loop: \"\\f201\";\n$ionicon-var-magnet: \"\\f2a0\";\n$ionicon-var-male: \"\\f2a1\";\n$ionicon-var-man: \"\\f202\";\n$ionicon-var-map: \"\\f203\";\n$ionicon-var-medkit: \"\\f2a2\";\n$ionicon-var-merge: \"\\f33f\";\n$ionicon-var-mic-a: \"\\f204\";\n$ionicon-var-mic-b: \"\\f205\";\n$ionicon-var-mic-c: \"\\f206\";\n$ionicon-var-minus: \"\\f209\";\n$ionicon-var-minus-circled: \"\\f207\";\n$ionicon-var-minus-round: \"\\f208\";\n$ionicon-var-model-s: \"\\f2c1\";\n$ionicon-var-monitor: \"\\f20a\";\n$ionicon-var-more: \"\\f20b\";\n$ionicon-var-mouse: \"\\f340\";\n$ionicon-var-music-note: \"\\f20c\";\n$ionicon-var-navicon: \"\\f20e\";\n$ionicon-var-navicon-round: \"\\f20d\";\n$ionicon-var-navigate: \"\\f2a3\";\n$ionicon-var-network: \"\\f341\";\n$ionicon-var-no-smoking: \"\\f2c2\";\n$ionicon-var-nuclear: \"\\f2a4\";\n$ionicon-var-outlet: \"\\f342\";\n$ionicon-var-paper-airplane: \"\\f2c3\";\n$ionicon-var-paperclip: \"\\f20f\";\n$ionicon-var-pause: \"\\f210\";\n$ionicon-var-person: \"\\f213\";\n$ionicon-var-person-add: \"\\f211\";\n$ionicon-var-person-stalker: \"\\f212\";\n$ionicon-var-pie-graph: \"\\f2a5\";\n$ionicon-var-pin: \"\\f2a6\";\n$ionicon-var-pinpoint: \"\\f2a7\";\n$ionicon-var-pizza: \"\\f2a8\";\n$ionicon-var-plane: \"\\f214\";\n$ionicon-var-planet: \"\\f343\";\n$ionicon-var-play: \"\\f215\";\n$ionicon-var-playstation: \"\\f30a\";\n$ionicon-var-plus: \"\\f218\";\n$ionicon-var-plus-circled: \"\\f216\";\n$ionicon-var-plus-round: \"\\f217\";\n$ionicon-var-podium: \"\\f344\";\n$ionicon-var-pound: \"\\f219\";\n$ionicon-var-power: \"\\f2a9\";\n$ionicon-var-pricetag: \"\\f2aa\";\n$ionicon-var-pricetags: \"\\f2ab\";\n$ionicon-var-printer: \"\\f21a\";\n$ionicon-var-pull-request: \"\\f345\";\n$ionicon-var-qr-scanner: \"\\f346\";\n$ionicon-var-quote: \"\\f347\";\n$ionicon-var-radio-waves: \"\\f2ac\";\n$ionicon-var-record: \"\\f21b\";\n$ionicon-var-refresh: \"\\f21c\";\n$ionicon-var-reply: \"\\f21e\";\n$ionicon-var-reply-all: \"\\f21d\";\n$ionicon-var-ribbon-a: \"\\f348\";\n$ionicon-var-ribbon-b: \"\\f349\";\n$ionicon-var-sad: \"\\f34a\";\n$ionicon-var-scissors: \"\\f34b\";\n$ionicon-var-search: \"\\f21f\";\n$ionicon-var-settings: \"\\f2ad\";\n$ionicon-var-share: \"\\f220\";\n$ionicon-var-shuffle: \"\\f221\";\n$ionicon-var-skip-backward: \"\\f222\";\n$ionicon-var-skip-forward: \"\\f223\";\n$ionicon-var-social-android: \"\\f225\";\n$ionicon-var-social-android-outline: \"\\f224\";\n$ionicon-var-social-apple: \"\\f227\";\n$ionicon-var-social-apple-outline: \"\\f226\";\n$ionicon-var-social-bitcoin: \"\\f2af\";\n$ionicon-var-social-bitcoin-outline: \"\\f2ae\";\n$ionicon-var-social-buffer: \"\\f229\";\n$ionicon-var-social-buffer-outline: \"\\f228\";\n$ionicon-var-social-designernews: \"\\f22b\";\n$ionicon-var-social-designernews-outline: \"\\f22a\";\n$ionicon-var-social-dribbble: \"\\f22d\";\n$ionicon-var-social-dribbble-outline: \"\\f22c\";\n$ionicon-var-social-dropbox: \"\\f22f\";\n$ionicon-var-social-dropbox-outline: \"\\f22e\";\n$ionicon-var-social-facebook: \"\\f231\";\n$ionicon-var-social-facebook-outline: \"\\f230\";\n$ionicon-var-social-foursquare: \"\\f34d\";\n$ionicon-var-social-foursquare-outline: \"\\f34c\";\n$ionicon-var-social-freebsd-devil: \"\\f2c4\";\n$ionicon-var-social-github: \"\\f233\";\n$ionicon-var-social-github-outline: \"\\f232\";\n$ionicon-var-social-google: \"\\f34f\";\n$ionicon-var-social-google-outline: \"\\f34e\";\n$ionicon-var-social-googleplus: \"\\f235\";\n$ionicon-var-social-googleplus-outline: \"\\f234\";\n$ionicon-var-social-hackernews: \"\\f237\";\n$ionicon-var-social-hackernews-outline: \"\\f236\";\n$ionicon-var-social-instagram: \"\\f351\";\n$ionicon-var-social-instagram-outline: \"\\f350\";\n$ionicon-var-social-linkedin: \"\\f239\";\n$ionicon-var-social-linkedin-outline: \"\\f238\";\n$ionicon-var-social-pinterest: \"\\f2b1\";\n$ionicon-var-social-pinterest-outline: \"\\f2b0\";\n$ionicon-var-social-reddit: \"\\f23b\";\n$ionicon-var-social-reddit-outline: \"\\f23a\";\n$ionicon-var-social-rss: \"\\f23d\";\n$ionicon-var-social-rss-outline: \"\\f23c\";\n$ionicon-var-social-skype: \"\\f23f\";\n$ionicon-var-social-skype-outline: \"\\f23e\";\n$ionicon-var-social-tumblr: \"\\f241\";\n$ionicon-var-social-tumblr-outline: \"\\f240\";\n$ionicon-var-social-tux: \"\\f2c5\";\n$ionicon-var-social-twitter: \"\\f243\";\n$ionicon-var-social-twitter-outline: \"\\f242\";\n$ionicon-var-social-usd: \"\\f353\";\n$ionicon-var-social-usd-outline: \"\\f352\";\n$ionicon-var-social-vimeo: \"\\f245\";\n$ionicon-var-social-vimeo-outline: \"\\f244\";\n$ionicon-var-social-windows: \"\\f247\";\n$ionicon-var-social-windows-outline: \"\\f246\";\n$ionicon-var-social-wordpress: \"\\f249\";\n$ionicon-var-social-wordpress-outline: \"\\f248\";\n$ionicon-var-social-yahoo: \"\\f24b\";\n$ionicon-var-social-yahoo-outline: \"\\f24a\";\n$ionicon-var-social-youtube: \"\\f24d\";\n$ionicon-var-social-youtube-outline: \"\\f24c\";\n$ionicon-var-speakerphone: \"\\f2b2\";\n$ionicon-var-speedometer: \"\\f2b3\";\n$ionicon-var-spoon: \"\\f2b4\";\n$ionicon-var-star: \"\\f24e\";\n$ionicon-var-stats-bars: \"\\f2b5\";\n$ionicon-var-steam: \"\\f30b\";\n$ionicon-var-stop: \"\\f24f\";\n$ionicon-var-thermometer: \"\\f2b6\";\n$ionicon-var-thumbsdown: \"\\f250\";\n$ionicon-var-thumbsup: \"\\f251\";\n$ionicon-var-toggle: \"\\f355\";\n$ionicon-var-toggle-filled: \"\\f354\";\n$ionicon-var-trash-a: \"\\f252\";\n$ionicon-var-trash-b: \"\\f253\";\n$ionicon-var-trophy: \"\\f356\";\n$ionicon-var-umbrella: \"\\f2b7\";\n$ionicon-var-university: \"\\f357\";\n$ionicon-var-unlocked: \"\\f254\";\n$ionicon-var-upload: \"\\f255\";\n$ionicon-var-usb: \"\\f2b8\";\n$ionicon-var-videocamera: \"\\f256\";\n$ionicon-var-volume-high: \"\\f257\";\n$ionicon-var-volume-low: \"\\f258\";\n$ionicon-var-volume-medium: \"\\f259\";\n$ionicon-var-volume-mute: \"\\f25a\";\n$ionicon-var-wand: \"\\f358\";\n$ionicon-var-waterdrop: \"\\f25b\";\n$ionicon-var-wifi: \"\\f25c\";\n$ionicon-var-wineglass: \"\\f2b9\";\n$ionicon-var-woman: \"\\f25d\";\n$ionicon-var-wrench: \"\\f2ba\";\n$ionicon-var-xbox: \"\\f30c\";"
  },
  {
    "path": "www/lib/ionic/scss/ionicons/ionicons.scss",
    "content": "@import \"ionicons-variables\";\n/*!\n  Ionicons, v1.5.2\n  Created by Ben Sperry for the Ionic Framework, http://ionicons.com/\n  https://twitter.com/benjsperry  https://twitter.com/ionicframework\n  MIT License: https://github.com/driftyco/ionicons\n*/\n\n@import \"ionicons-font\";\n@import \"ionicons-animation\";\n@import \"ionicons-icons\";\n"
  },
  {
    "path": "www/lib/mockfirebase/.bower.json",
    "content": "{\n  \"name\": \"mockfirebase\",\n  \"version\": \"0.2.9\",\n  \"homepage\": \"https://github.com/katowulf/mockfirebase\",\n  \"authors\": [\n    \"Kato\"\n  ],\n  \"description\": \"An experimental Firebase stub/spy library for writing unit tests (not supported by Firebase)\",\n  \"main\": \"./dist/mockfirebase.js\",\n  \"moduleType\": [\n    \"amd\",\n    \"globals\",\n    \"node\"\n  ],\n  \"keywords\": [\n    \"firebase\",\n    \"mock\"\n  ],\n  \"license\": \"MIT\",\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"test\",\n    \"helpers\",\n    \"gulpfile.js\",\n    \"package.json\",\n    \"src\"\n  ],\n  \"_release\": \"0.2.9\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v0.2.9\",\n    \"commit\": \"4f8b874a3d83fa1ccd55681137d4f0fed1218cbe\"\n  },\n  \"_source\": \"git://github.com/katowulf/mockfirebase.git\",\n  \"_target\": \"~0.2.9\",\n  \"_originalSource\": \"mockfirebase\"\n}"
  },
  {
    "path": "www/lib/mockfirebase/CONTRIBUTING.md",
    "content": "# Issues\n\nIf you've encountered a bug or want to request new functionality, go ahead and file an issue. Please provide as much detail as possible, including a live example, reproduction steps, and debugging steps you've already taken where possible.\n\n# Contributing\n\n* Fork the repo\n* `npm install`\n* make your additions in src/\n* add test units in test/\n* `npm test`\n* submit a pull request when all tests pass\n"
  },
  {
    "path": "www/lib/mockfirebase/MAINTAINING.md",
    "content": "# Releasing\n\nCall `gulp release` to release a new patch version. For *minor* or *major* releases, use the `--type` flag:\n\n```bash\n$ gulp release --type minor\n```\n\nTo push the release commit and tag:\n\n```bash\n$ git push --follow-tags\n```\n"
  },
  {
    "path": "www/lib/mockfirebase/README.md",
    "content": "MockFirebase\n============\n\n**This is an experimental library. It is not supported by Firebase. Use with caution and submit PRs for fixes and enhancements.**\n\nA Firebase stub useful for unit testing.\n\n[![Build Status](https://travis-ci.org/katowulf/mockfirebase.svg?branch=master)](https://travis-ci.org/katowulf/mockfirebase)\n\n## Installation\n\n### Node.js\n\n```bash\n$ npm install mockfirebase\n```\n\n### Web\n```html\n<!-- include sinon unless you use jasmine -->\n<script src=\"sinon.js\"></script>\n<script src=\"mockfirebase.js\"></script>\n```\n### Browser Support\n\nWorks by default with IE 9 and up. To add support for older versions, just include polyfills for [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Compatibility),\n[Array.prototype.indexOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill), and [Array.prototype.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill).\n\nJasmine tests will run in the browser without any configuration. To add support for any other test suite (e.g. Mocha),\njust include [sinon.js](http://sinonjs.org/) in the browser script tags, Karma config, etc.\n\n## Usage\n\nMockFirebase is designed to be used synchronously or asynchronously for unit testing by allowing you complete\ncontrol over when each event is triggered, via the `flush()` command.\n\n```js\nvar fb = new MockFirebase(ANY_URLISH_STRING); // loads the default data\nvar spy = sinon.spy();\nfb.on('value', spy);\nfb.set({ foo: 'bar' });\nexpect(spy.called).to.be(false); // it is!\nfb.flush();\nexpect(spy.called).to.be(true); // it is!\n```\n\nSee [angularFire's unit tests](https://github.com/firebase/angularFire/blob/master/tests/unit/AngularFire.spec.js) for examples of the MockFirebase in action.\n\n## Specifying data\n\nYou can specify the default data to be used by setting `MockFirebase.DEFAULT_DATA` to an object. You can also\nspecify data per-instance by adding a second arg to the constructor:  `new MockFirebase(ANY_URLISH_STRING, dataToUse);`\n\n## API\n\nAll the regular Firebase methods are(?) supported. In addition, the following test-related methods exist:\n\n### flush\n\n    @param {boolean|int} [delay] in milliseconds\n    @returns {MockFirebase}\n\nInvoke all the operations that have been queued thus far. If a numeric delay is specified, this\noccurs asynchronously. Otherwise, it is a synchronous event (at the time flush is called).\n\nThis allows Firebase to be used in synchronous tests without waiting for async callbacks. It also\nprovides a rudimentary mechanism for simulating locally cached data (events are triggered\nsynchronously when you do on('value') or on('child_added'))\n\nIf you call this multiple times with different delay values, you can invoke the events out\nof order, as might happen on a network with some latency, or if multiple users update values \"simultaneously\".\n\n### autoFlush\n\n    @param {int|boolean} [delay] in milliseconds\n\nAutomatically trigger a flush event after each operation. If a numeric delay is specified, this is an\nasynchronous event. If value is set to true, it is synchronous (flush is triggered immediately). Setting\nthis to false disabled autoFlush\n\n### failNext\n\n    @param {String} methodName currently only supports `set` and `transaction`\n    @param {String|Error} error\n\nSimulate a failure by specifying that the next invocation of methodName should fail with the provided error.\n\n## getData\n\n@returns {*}\n\nReturns a copy of the current data\n\n# Proxying Firebase\n\nWhen writing unit tests, you'll probably want to patch calls to `Firebase` in your source code with `MockFirebase`. \n\n## Browser\n\nIf `Firebase` is attached to the `window`, you can just replace it using the override method:\n\n```js\nMockFirebase.override();\n```\n\nMake sure to include `MockFirebase` before overwriting Firebase and then add your tests after the patch.\n\n## Node/Browserify\nIn Node/Browserify, you need to patch `require` itself. [proxyquire](https://github.com/thlorenz/proxyquire) and [proxyquireify](https://github.com/thlorenz/proxyquireify) make this easy.\n\n```js\n// ./mySrc.js\nvar Firebase = require('firebase');\nvar ref = new Firebase('myRefUrl');\nref.on('value', function (snapshot) {\n  console.log(snapshot.val());\n});\n```\n\nIn order to test the above source code, we use proxyquire like this:\n\n```js\n// ./test.js\nvar proxyquire = require('proxyquire');\nvar mySrc = proxyquire('./mySrc', {\n  firebase: require('mockfirebase').MockFirebase.autoFlush()\n});\n// data is logged\n```\n\nNote that the key in the stubs object matches the module name (`'firebase'`) and not the capitalized variable name. \n\n# Support\n\nUse the [issues list](https://github.com/katowulf/mockfirebase/issues) for questions and troubleshooting help.\n"
  },
  {
    "path": "www/lib/mockfirebase/bower.json",
    "content": "{\n  \"name\": \"mockfirebase\",\n  \"version\": \"0.2.9\",\n  \"homepage\": \"https://github.com/katowulf/mockfirebase\",\n  \"authors\": [\n    \"Kato\"\n  ],\n  \"description\": \"An experimental Firebase stub/spy library for writing unit tests (not supported by Firebase)\",\n  \"main\": \"./dist/mockfirebase.js\",\n  \"moduleType\": [\n    \"amd\",\n    \"globals\",\n    \"node\"\n  ],\n  \"keywords\": [\n    \"firebase\",\n    \"mock\"\n  ],\n  \"license\": \"MIT\",\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"test\",\n    \"helpers\",\n    \"gulpfile.js\",\n    \"package.json\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "www/lib/mockfirebase/dist/mockfirebase.js",
    "content": "/** mockfirebase - v0.2.9\nhttps://github.com/katowulf/mockfirebase\n* Copyright (c) 2014 Kato\n* License: MIT */\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.mockfirebase=e()}}(function(){var define,module,exports;return (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);throw new Error(\"Cannot find module '\"+o+\"'\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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(_dereq_,module,exports){\n(function (Buffer){\n(function(){\r\n  var crypt = _dereq_('crypt'),\r\n      utf8 = _dereq_('charenc').utf8,\r\n      bin = _dereq_('charenc').bin,\r\n\r\n  // The core\r\n  md5 = function (message, options) {\r\n    // Convert to byte array\r\n    if (message.constructor == String)\r\n      if (options && options.encoding === 'binary')\r\n        message = bin.stringToBytes(message);\r\n      else\r\n        message = utf8.stringToBytes(message);\r\n    else if (typeof Buffer != 'undefined' &&\r\n        typeof Buffer.isBuffer == 'function' && Buffer.isBuffer(message))\r\n      message = Array.prototype.slice.call(message, 0);\r\n    else if (!Array.isArray(message))\r\n      message = message.toString();\r\n    // else, assume byte array already\r\n\r\n    var m = crypt.bytesToWords(message),\r\n        l = message.length * 8,\r\n        a =  1732584193,\r\n        b = -271733879,\r\n        c = -1732584194,\r\n        d =  271733878;\r\n\r\n    // Swap endian\r\n    for (var i = 0; i < m.length; i++) {\r\n      m[i] = ((m[i] <<  8) | (m[i] >>> 24)) & 0x00FF00FF |\r\n             ((m[i] << 24) | (m[i] >>>  8)) & 0xFF00FF00;\r\n    }\r\n\r\n    // Padding\r\n    m[l >>> 5] |= 0x80 << (l % 32);\r\n    m[(((l + 64) >>> 9) << 4) + 14] = l;\r\n\r\n    // Method shortcuts\r\n    var FF = md5._ff,\r\n        GG = md5._gg,\r\n        HH = md5._hh,\r\n        II = md5._ii;\r\n\r\n    for (var i = 0; i < m.length; i += 16) {\r\n\r\n      var aa = a,\r\n          bb = b,\r\n          cc = c,\r\n          dd = d;\r\n\r\n      a = FF(a, b, c, d, m[i+ 0],  7, -680876936);\r\n      d = FF(d, a, b, c, m[i+ 1], 12, -389564586);\r\n      c = FF(c, d, a, b, m[i+ 2], 17,  606105819);\r\n      b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);\r\n      a = FF(a, b, c, d, m[i+ 4],  7, -176418897);\r\n      d = FF(d, a, b, c, m[i+ 5], 12,  1200080426);\r\n      c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);\r\n      b = FF(b, c, d, a, m[i+ 7], 22, -45705983);\r\n      a = FF(a, b, c, d, m[i+ 8],  7,  1770035416);\r\n      d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);\r\n      c = FF(c, d, a, b, m[i+10], 17, -42063);\r\n      b = FF(b, c, d, a, m[i+11], 22, -1990404162);\r\n      a = FF(a, b, c, d, m[i+12],  7,  1804603682);\r\n      d = FF(d, a, b, c, m[i+13], 12, -40341101);\r\n      c = FF(c, d, a, b, m[i+14], 17, -1502002290);\r\n      b = FF(b, c, d, a, m[i+15], 22,  1236535329);\r\n\r\n      a = GG(a, b, c, d, m[i+ 1],  5, -165796510);\r\n      d = GG(d, a, b, c, m[i+ 6],  9, -1069501632);\r\n      c = GG(c, d, a, b, m[i+11], 14,  643717713);\r\n      b = GG(b, c, d, a, m[i+ 0], 20, -373897302);\r\n      a = GG(a, b, c, d, m[i+ 5],  5, -701558691);\r\n      d = GG(d, a, b, c, m[i+10],  9,  38016083);\r\n      c = GG(c, d, a, b, m[i+15], 14, -660478335);\r\n      b = GG(b, c, d, a, m[i+ 4], 20, -405537848);\r\n      a = GG(a, b, c, d, m[i+ 9],  5,  568446438);\r\n      d = GG(d, a, b, c, m[i+14],  9, -1019803690);\r\n      c = GG(c, d, a, b, m[i+ 3], 14, -187363961);\r\n      b = GG(b, c, d, a, m[i+ 8], 20,  1163531501);\r\n      a = GG(a, b, c, d, m[i+13],  5, -1444681467);\r\n      d = GG(d, a, b, c, m[i+ 2],  9, -51403784);\r\n      c = GG(c, d, a, b, m[i+ 7], 14,  1735328473);\r\n      b = GG(b, c, d, a, m[i+12], 20, -1926607734);\r\n\r\n      a = HH(a, b, c, d, m[i+ 5],  4, -378558);\r\n      d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);\r\n      c = HH(c, d, a, b, m[i+11], 16,  1839030562);\r\n      b = HH(b, c, d, a, m[i+14], 23, -35309556);\r\n      a = HH(a, b, c, d, m[i+ 1],  4, -1530992060);\r\n      d = HH(d, a, b, c, m[i+ 4], 11,  1272893353);\r\n      c = HH(c, d, a, b, m[i+ 7], 16, -155497632);\r\n      b = HH(b, c, d, a, m[i+10], 23, -1094730640);\r\n      a = HH(a, b, c, d, m[i+13],  4,  681279174);\r\n      d = HH(d, a, b, c, m[i+ 0], 11, -358537222);\r\n      c = HH(c, d, a, b, m[i+ 3], 16, -722521979);\r\n      b = HH(b, c, d, a, m[i+ 6], 23,  76029189);\r\n      a = HH(a, b, c, d, m[i+ 9],  4, -640364487);\r\n      d = HH(d, a, b, c, m[i+12], 11, -421815835);\r\n      c = HH(c, d, a, b, m[i+15], 16,  530742520);\r\n      b = HH(b, c, d, a, m[i+ 2], 23, -995338651);\r\n\r\n      a = II(a, b, c, d, m[i+ 0],  6, -198630844);\r\n      d = II(d, a, b, c, m[i+ 7], 10,  1126891415);\r\n      c = II(c, d, a, b, m[i+14], 15, -1416354905);\r\n      b = II(b, c, d, a, m[i+ 5], 21, -57434055);\r\n      a = II(a, b, c, d, m[i+12],  6,  1700485571);\r\n      d = II(d, a, b, c, m[i+ 3], 10, -1894986606);\r\n      c = II(c, d, a, b, m[i+10], 15, -1051523);\r\n      b = II(b, c, d, a, m[i+ 1], 21, -2054922799);\r\n      a = II(a, b, c, d, m[i+ 8],  6,  1873313359);\r\n      d = II(d, a, b, c, m[i+15], 10, -30611744);\r\n      c = II(c, d, a, b, m[i+ 6], 15, -1560198380);\r\n      b = II(b, c, d, a, m[i+13], 21,  1309151649);\r\n      a = II(a, b, c, d, m[i+ 4],  6, -145523070);\r\n      d = II(d, a, b, c, m[i+11], 10, -1120210379);\r\n      c = II(c, d, a, b, m[i+ 2], 15,  718787259);\r\n      b = II(b, c, d, a, m[i+ 9], 21, -343485551);\r\n\r\n      a = (a + aa) >>> 0;\r\n      b = (b + bb) >>> 0;\r\n      c = (c + cc) >>> 0;\r\n      d = (d + dd) >>> 0;\r\n    }\r\n\r\n    return crypt.endian([a, b, c, d]);\r\n  };\r\n\r\n  // Auxiliary functions\r\n  md5._ff  = function (a, b, c, d, x, s, t) {\r\n    var n = a + (b & c | ~b & d) + (x >>> 0) + t;\r\n    return ((n << s) | (n >>> (32 - s))) + b;\r\n  };\r\n  md5._gg  = function (a, b, c, d, x, s, t) {\r\n    var n = a + (b & d | c & ~d) + (x >>> 0) + t;\r\n    return ((n << s) | (n >>> (32 - s))) + b;\r\n  };\r\n  md5._hh  = function (a, b, c, d, x, s, t) {\r\n    var n = a + (b ^ c ^ d) + (x >>> 0) + t;\r\n    return ((n << s) | (n >>> (32 - s))) + b;\r\n  };\r\n  md5._ii  = function (a, b, c, d, x, s, t) {\r\n    var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;\r\n    return ((n << s) | (n >>> (32 - s))) + b;\r\n  };\r\n\r\n  // Package private blocksize\r\n  md5._blocksize = 16;\r\n  md5._digestsize = 16;\r\n\r\n  module.exports = function (message, options) {\r\n    if(typeof message == 'undefined')\r\n      return;\r\n\r\n    var digestbytes = crypt.wordsToBytes(md5(message, options));\r\n    return options && options.asBytes ? digestbytes :\r\n        options && options.asString ? bin.bytesToString(digestbytes) :\r\n        crypt.bytesToHex(digestbytes);\r\n  };\r\n\r\n})();\r\n\n}).call(this,_dereq_(\"buffer\").Buffer)\n},{\"buffer\":4,\"charenc\":2,\"crypt\":3}],2:[function(_dereq_,module,exports){\nvar charenc = {\n  // UTF-8 encoding\n  utf8: {\n    // Convert a string to a byte array\n    stringToBytes: function(str) {\n      return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));\n    },\n\n    // Convert a byte array to a string\n    bytesToString: function(bytes) {\n      return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));\n    }\n  },\n\n  // Binary encoding\n  bin: {\n    // Convert a string to a byte array\n    stringToBytes: function(str) {\n      for (var bytes = [], i = 0; i < str.length; i++)\n        bytes.push(str.charCodeAt(i) & 0xFF);\n      return bytes;\n    },\n\n    // Convert a byte array to a string\n    bytesToString: function(bytes) {\n      for (var str = [], i = 0; i < bytes.length; i++)\n        str.push(String.fromCharCode(bytes[i]));\n      return str.join('');\n    }\n  }\n};\n\nmodule.exports = charenc;\n\n},{}],3:[function(_dereq_,module,exports){\n(function() {\n  var base64map\n      = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n\n  crypt = {\n    // Bit-wise rotation left\n    rotl: function(n, b) {\n      return (n << b) | (n >>> (32 - b));\n    },\n\n    // Bit-wise rotation right\n    rotr: function(n, b) {\n      return (n << (32 - b)) | (n >>> b);\n    },\n\n    // Swap big-endian to little-endian and vice versa\n    endian: function(n) {\n      // If number given, swap endian\n      if (n.constructor == Number) {\n        return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;\n      }\n\n      // Else, assume array and swap all items\n      for (var i = 0; i < n.length; i++)\n        n[i] = crypt.endian(n[i]);\n      return n;\n    },\n\n    // Generate an array of any length of random bytes\n    randomBytes: function(n) {\n      for (var bytes = []; n > 0; n--)\n        bytes.push(Math.floor(Math.random() * 256));\n      return bytes;\n    },\n\n    // Convert a byte array to big-endian 32-bit words\n    bytesToWords: function(bytes) {\n      for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)\n        words[b >>> 5] |= bytes[i] << (24 - b % 32);\n      return words;\n    },\n\n    // Convert big-endian 32-bit words to a byte array\n    wordsToBytes: function(words) {\n      for (var bytes = [], b = 0; b < words.length * 32; b += 8)\n        bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);\n      return bytes;\n    },\n\n    // Convert a byte array to a hex string\n    bytesToHex: function(bytes) {\n      for (var hex = [], i = 0; i < bytes.length; i++) {\n        hex.push((bytes[i] >>> 4).toString(16));\n        hex.push((bytes[i] & 0xF).toString(16));\n      }\n      return hex.join('');\n    },\n\n    // Convert a hex string to a byte array\n    hexToBytes: function(hex) {\n      for (var bytes = [], c = 0; c < hex.length; c += 2)\n        bytes.push(parseInt(hex.substr(c, 2), 16));\n      return bytes;\n    },\n\n    // Convert a byte array to a base-64 string\n    bytesToBase64: function(bytes) {\n      for (var base64 = [], i = 0; i < bytes.length; i += 3) {\n        var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n        for (var j = 0; j < 4; j++)\n          if (i * 8 + j * 6 <= bytes.length * 8)\n            base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));\n          else\n            base64.push('=');\n      }\n      return base64.join('');\n    },\n\n    // Convert a base-64 string to a byte array\n    base64ToBytes: function(base64) {\n      // Remove non-base-64 characters\n      base64 = base64.replace(/[^A-Z0-9+\\/]/ig, '');\n\n      for (var bytes = [], i = 0, imod4 = 0; i < base64.length;\n          imod4 = ++i % 4) {\n        if (imod4 == 0) continue;\n        bytes.push(((base64map.indexOf(base64.charAt(i - 1))\n            & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))\n            | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));\n      }\n      return bytes;\n    }\n  };\n\n  module.exports = crypt;\n})();\n\n},{}],4:[function(_dereq_,module,exports){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license  MIT\n */\n\nvar base64 = _dereq_('base64-js')\nvar ieee754 = _dereq_('ieee754')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = Buffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192\n\n/**\n * If `TYPED_ARRAY_SUPPORT`:\n *   === true    Use Uint8Array implementation (fastest)\n *   === false   Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Note:\n *\n * - Implementation must support adding new properties to `Uint8Array` instances.\n *   Firefox 4-29 lacked support, fixed in Firefox 30+.\n *   See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n *  - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n *  - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n *    incorrect length in some situations.\n *\n * We detect these buggy browsers and set `TYPED_ARRAY_SUPPORT` to `false` so they will\n * get the Object implementation, which is slower but will work correctly.\n */\nvar TYPED_ARRAY_SUPPORT = (function () {\n  try {\n    var buf = new ArrayBuffer(0)\n    var arr = new Uint8Array(buf)\n    arr.foo = function () { return 42 }\n    return 42 === arr.foo() && // typed array instances can be augmented\n        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n        new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n  } catch (e) {\n    return false\n  }\n})()\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (subject, encoding, noZero) {\n  if (!(this instanceof Buffer))\n    return new Buffer(subject, encoding, noZero)\n\n  var type = typeof subject\n\n  // Find the length\n  var length\n  if (type === 'number')\n    length = subject > 0 ? subject >>> 0 : 0\n  else if (type === 'string') {\n    if (encoding === 'base64')\n      subject = base64clean(subject)\n    length = Buffer.byteLength(subject, encoding)\n  } else if (type === 'object' && subject !== null) { // assume object is array-like\n    if (subject.type === 'Buffer' && isArray(subject.data))\n      subject = subject.data\n    length = +subject.length > 0 ? Math.floor(+subject.length) : 0\n  } else\n    throw new Error('First argument needs to be a number, array or string.')\n\n  var buf\n  if (TYPED_ARRAY_SUPPORT) {\n    // Preferred: Return an augmented `Uint8Array` instance for best performance\n    buf = Buffer._augment(new Uint8Array(length))\n  } else {\n    // Fallback: Return THIS instance of Buffer (created by `new`)\n    buf = this\n    buf.length = length\n    buf._isBuffer = true\n  }\n\n  var i\n  if (TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {\n    // Speed optimization -- use set if we're copying from a typed array\n    buf._set(subject)\n  } else if (isArrayish(subject)) {\n    // Treat array-ish objects as a byte array\n    if (Buffer.isBuffer(subject)) {\n      for (i = 0; i < length; i++)\n        buf[i] = subject.readUInt8(i)\n    } else {\n      for (i = 0; i < length; i++)\n        buf[i] = ((subject[i] % 256) + 256) % 256\n    }\n  } else if (type === 'string') {\n    buf.write(subject, 0, encoding)\n  } else if (type === 'number' && !TYPED_ARRAY_SUPPORT && !noZero) {\n    for (i = 0; i < length; i++) {\n      buf[i] = 0\n    }\n  }\n\n  return buf\n}\n\n// STATIC METHODS\n// ==============\n\nBuffer.isEncoding = function (encoding) {\n  switch (String(encoding).toLowerCase()) {\n    case 'hex':\n    case 'utf8':\n    case 'utf-8':\n    case 'ascii':\n    case 'binary':\n    case 'base64':\n    case 'raw':\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      return true\n    default:\n      return false\n  }\n}\n\nBuffer.isBuffer = function (b) {\n  return !!(b != null && b._isBuffer)\n}\n\nBuffer.byteLength = function (str, encoding) {\n  var ret\n  str = str.toString()\n  switch (encoding || 'utf8') {\n    case 'hex':\n      ret = str.length / 2\n      break\n    case 'utf8':\n    case 'utf-8':\n      ret = utf8ToBytes(str).length\n      break\n    case 'ascii':\n    case 'binary':\n    case 'raw':\n      ret = str.length\n      break\n    case 'base64':\n      ret = base64ToBytes(str).length\n      break\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      ret = str.length * 2\n      break\n    default:\n      throw new Error('Unknown encoding')\n  }\n  return ret\n}\n\nBuffer.concat = function (list, totalLength) {\n  assert(isArray(list), 'Usage: Buffer.concat(list[, length])')\n\n  if (list.length === 0) {\n    return new Buffer(0)\n  } else if (list.length === 1) {\n    return list[0]\n  }\n\n  var i\n  if (totalLength === undefined) {\n    totalLength = 0\n    for (i = 0; i < list.length; i++) {\n      totalLength += list[i].length\n    }\n  }\n\n  var buf = new Buffer(totalLength)\n  var pos = 0\n  for (i = 0; i < list.length; i++) {\n    var item = list[i]\n    item.copy(buf, pos)\n    pos += item.length\n  }\n  return buf\n}\n\nBuffer.compare = function (a, b) {\n  assert(Buffer.isBuffer(a) && Buffer.isBuffer(b), 'Arguments must be Buffers')\n  var x = a.length\n  var y = b.length\n  for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}\n  if (i !== len) {\n    x = a[i]\n    y = b[i]\n  }\n  if (x < y) {\n    return -1\n  }\n  if (y < x) {\n    return 1\n  }\n  return 0\n}\n\n// BUFFER INSTANCE METHODS\n// =======================\n\nfunction hexWrite (buf, string, offset, length) {\n  offset = Number(offset) || 0\n  var remaining = buf.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n\n  // must be an even number of digits\n  var strLen = string.length\n  assert(strLen % 2 === 0, 'Invalid hex string')\n\n  if (length > strLen / 2) {\n    length = strLen / 2\n  }\n  for (var i = 0; i < length; i++) {\n    var byte = parseInt(string.substr(i * 2, 2), 16)\n    assert(!isNaN(byte), 'Invalid hex string')\n    buf[offset + i] = byte\n  }\n  return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n  var charsWritten = blitBuffer(utf8ToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n  var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n  return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n  var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nfunction utf16leWrite (buf, string, offset, length) {\n  var charsWritten = blitBuffer(utf16leToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nBuffer.prototype.write = function (string, offset, length, encoding) {\n  // Support both (string, offset, length, encoding)\n  // and the legacy (string, encoding, offset, length)\n  if (isFinite(offset)) {\n    if (!isFinite(length)) {\n      encoding = length\n      length = undefined\n    }\n  } else {  // legacy\n    var swap = encoding\n    encoding = offset\n    offset = length\n    length = swap\n  }\n\n  offset = Number(offset) || 0\n  var remaining = this.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n  encoding = String(encoding || 'utf8').toLowerCase()\n\n  var ret\n  switch (encoding) {\n    case 'hex':\n      ret = hexWrite(this, string, offset, length)\n      break\n    case 'utf8':\n    case 'utf-8':\n      ret = utf8Write(this, string, offset, length)\n      break\n    case 'ascii':\n      ret = asciiWrite(this, string, offset, length)\n      break\n    case 'binary':\n      ret = binaryWrite(this, string, offset, length)\n      break\n    case 'base64':\n      ret = base64Write(this, string, offset, length)\n      break\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      ret = utf16leWrite(this, string, offset, length)\n      break\n    default:\n      throw new Error('Unknown encoding')\n  }\n  return ret\n}\n\nBuffer.prototype.toString = function (encoding, start, end) {\n  var self = this\n\n  encoding = String(encoding || 'utf8').toLowerCase()\n  start = Number(start) || 0\n  end = (end === undefined) ? self.length : Number(end)\n\n  // Fastpath empty strings\n  if (end === start)\n    return ''\n\n  var ret\n  switch (encoding) {\n    case 'hex':\n      ret = hexSlice(self, start, end)\n      break\n    case 'utf8':\n    case 'utf-8':\n      ret = utf8Slice(self, start, end)\n      break\n    case 'ascii':\n      ret = asciiSlice(self, start, end)\n      break\n    case 'binary':\n      ret = binarySlice(self, start, end)\n      break\n    case 'base64':\n      ret = base64Slice(self, start, end)\n      break\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      ret = utf16leSlice(self, start, end)\n      break\n    default:\n      throw new Error('Unknown encoding')\n  }\n  return ret\n}\n\nBuffer.prototype.toJSON = function () {\n  return {\n    type: 'Buffer',\n    data: Array.prototype.slice.call(this._arr || this, 0)\n  }\n}\n\nBuffer.prototype.equals = function (b) {\n  assert(Buffer.isBuffer(b), 'Argument must be a Buffer')\n  return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.compare = function (b) {\n  assert(Buffer.isBuffer(b), 'Argument must be a Buffer')\n  return Buffer.compare(this, b)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function (target, target_start, start, end) {\n  var source = this\n\n  if (!start) start = 0\n  if (!end && end !== 0) end = this.length\n  if (!target_start) target_start = 0\n\n  // Copy 0 bytes; we're done\n  if (end === start) return\n  if (target.length === 0 || source.length === 0) return\n\n  // Fatal error conditions\n  assert(end >= start, 'sourceEnd < sourceStart')\n  assert(target_start >= 0 && target_start < target.length,\n      'targetStart out of bounds')\n  assert(start >= 0 && start < source.length, 'sourceStart out of bounds')\n  assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds')\n\n  // Are we oob?\n  if (end > this.length)\n    end = this.length\n  if (target.length - target_start < end - start)\n    end = target.length - target_start + start\n\n  var len = end - start\n\n  if (len < 100 || !TYPED_ARRAY_SUPPORT) {\n    for (var i = 0; i < len; i++) {\n      target[i + target_start] = this[i + start]\n    }\n  } else {\n    target._set(this.subarray(start, start + len), target_start)\n  }\n}\n\nfunction base64Slice (buf, start, end) {\n  if (start === 0 && end === buf.length) {\n    return base64.fromByteArray(buf)\n  } else {\n    return base64.fromByteArray(buf.slice(start, end))\n  }\n}\n\nfunction utf8Slice (buf, start, end) {\n  var res = ''\n  var tmp = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    if (buf[i] <= 0x7F) {\n      res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])\n      tmp = ''\n    } else {\n      tmp += '%' + buf[i].toString(16)\n    }\n  }\n\n  return res + decodeUtf8Char(tmp)\n}\n\nfunction asciiSlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i])\n  }\n  return ret\n}\n\nfunction binarySlice (buf, start, end) {\n  return asciiSlice(buf, start, end)\n}\n\nfunction hexSlice (buf, start, end) {\n  var len = buf.length\n\n  if (!start || start < 0) start = 0\n  if (!end || end < 0 || end > len) end = len\n\n  var out = ''\n  for (var i = start; i < end; i++) {\n    out += toHex(buf[i])\n  }\n  return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n  var bytes = buf.slice(start, end)\n  var res = ''\n  for (var i = 0; i < bytes.length; i += 2) {\n    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n  }\n  return res\n}\n\nBuffer.prototype.slice = function (start, end) {\n  var len = this.length\n  start = ~~start\n  end = end === undefined ? len : ~~end\n\n  if (start < 0) {\n    start += len;\n    if (start < 0)\n      start = 0\n  } else if (start > len) {\n    start = len\n  }\n\n  if (end < 0) {\n    end += len\n    if (end < 0)\n      end = 0\n  } else if (end > len) {\n    end = len\n  }\n\n  if (end < start)\n    end = start\n\n  if (TYPED_ARRAY_SUPPORT) {\n    return Buffer._augment(this.subarray(start, end))\n  } else {\n    var sliceLen = end - start\n    var newBuf = new Buffer(sliceLen, undefined, true)\n    for (var i = 0; i < sliceLen; i++) {\n      newBuf[i] = this[i + start]\n    }\n    return newBuf\n  }\n}\n\n// `get` will be removed in Node 0.13+\nBuffer.prototype.get = function (offset) {\n  console.log('.get() is deprecated. Access using array indexes instead.')\n  return this.readUInt8(offset)\n}\n\n// `set` will be removed in Node 0.13+\nBuffer.prototype.set = function (v, offset) {\n  console.log('.set() is deprecated. Access using array indexes instead.')\n  return this.writeUInt8(v, offset)\n}\n\nBuffer.prototype.readUInt8 = function (offset, noAssert) {\n  if (!noAssert) {\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset < this.length, 'Trying to read beyond buffer length')\n  }\n\n  if (offset >= this.length)\n    return\n\n  return this[offset]\n}\n\nfunction readUInt16 (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  var val\n  if (littleEndian) {\n    val = buf[offset]\n    if (offset + 1 < len)\n      val |= buf[offset + 1] << 8\n  } else {\n    val = buf[offset] << 8\n    if (offset + 1 < len)\n      val |= buf[offset + 1]\n  }\n  return val\n}\n\nBuffer.prototype.readUInt16LE = function (offset, noAssert) {\n  return readUInt16(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readUInt16BE = function (offset, noAssert) {\n  return readUInt16(this, offset, false, noAssert)\n}\n\nfunction readUInt32 (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  var val\n  if (littleEndian) {\n    if (offset + 2 < len)\n      val = buf[offset + 2] << 16\n    if (offset + 1 < len)\n      val |= buf[offset + 1] << 8\n    val |= buf[offset]\n    if (offset + 3 < len)\n      val = val + (buf[offset + 3] << 24 >>> 0)\n  } else {\n    if (offset + 1 < len)\n      val = buf[offset + 1] << 16\n    if (offset + 2 < len)\n      val |= buf[offset + 2] << 8\n    if (offset + 3 < len)\n      val |= buf[offset + 3]\n    val = val + (buf[offset] << 24 >>> 0)\n  }\n  return val\n}\n\nBuffer.prototype.readUInt32LE = function (offset, noAssert) {\n  return readUInt32(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readUInt32BE = function (offset, noAssert) {\n  return readUInt32(this, offset, false, noAssert)\n}\n\nBuffer.prototype.readInt8 = function (offset, noAssert) {\n  if (!noAssert) {\n    assert(offset !== undefined && offset !== null,\n        'missing offset')\n    assert(offset < this.length, 'Trying to read beyond buffer length')\n  }\n\n  if (offset >= this.length)\n    return\n\n  var neg = this[offset] & 0x80\n  if (neg)\n    return (0xff - this[offset] + 1) * -1\n  else\n    return this[offset]\n}\n\nfunction readInt16 (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  var val = readUInt16(buf, offset, littleEndian, true)\n  var neg = val & 0x8000\n  if (neg)\n    return (0xffff - val + 1) * -1\n  else\n    return val\n}\n\nBuffer.prototype.readInt16LE = function (offset, noAssert) {\n  return readInt16(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readInt16BE = function (offset, noAssert) {\n  return readInt16(this, offset, false, noAssert)\n}\n\nfunction readInt32 (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  var val = readUInt32(buf, offset, littleEndian, true)\n  var neg = val & 0x80000000\n  if (neg)\n    return (0xffffffff - val + 1) * -1\n  else\n    return val\n}\n\nBuffer.prototype.readInt32LE = function (offset, noAssert) {\n  return readInt32(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readInt32BE = function (offset, noAssert) {\n  return readInt32(this, offset, false, noAssert)\n}\n\nfunction readFloat (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  return ieee754.read(buf, offset, littleEndian, 23, 4)\n}\n\nBuffer.prototype.readFloatLE = function (offset, noAssert) {\n  return readFloat(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readFloatBE = function (offset, noAssert) {\n  return readFloat(this, offset, false, noAssert)\n}\n\nfunction readDouble (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset + 7 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  return ieee754.read(buf, offset, littleEndian, 52, 8)\n}\n\nBuffer.prototype.readDoubleLE = function (offset, noAssert) {\n  return readDouble(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readDoubleBE = function (offset, noAssert) {\n  return readDouble(this, offset, false, noAssert)\n}\n\nBuffer.prototype.writeUInt8 = function (value, offset, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset < this.length, 'trying to write beyond buffer length')\n    verifuint(value, 0xff)\n  }\n\n  if (offset >= this.length) return\n\n  this[offset] = value\n  return offset + 1\n}\n\nfunction writeUInt16 (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 1 < buf.length, 'trying to write beyond buffer length')\n    verifuint(value, 0xffff)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) {\n    buf[offset + i] =\n        (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n            (littleEndian ? i : 1 - i) * 8\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeUInt16LE = function (value, offset, noAssert) {\n  return writeUInt16(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeUInt16BE = function (value, offset, noAssert) {\n  return writeUInt16(this, value, offset, false, noAssert)\n}\n\nfunction writeUInt32 (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'trying to write beyond buffer length')\n    verifuint(value, 0xffffffff)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {\n    buf[offset + i] =\n        (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeUInt32LE = function (value, offset, noAssert) {\n  return writeUInt32(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeUInt32BE = function (value, offset, noAssert) {\n  return writeUInt32(this, value, offset, false, noAssert)\n}\n\nBuffer.prototype.writeInt8 = function (value, offset, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset < this.length, 'Trying to write beyond buffer length')\n    verifsint(value, 0x7f, -0x80)\n  }\n\n  if (offset >= this.length)\n    return\n\n  if (value >= 0)\n    this.writeUInt8(value, offset, noAssert)\n  else\n    this.writeUInt8(0xff + value + 1, offset, noAssert)\n  return offset + 1\n}\n\nfunction writeInt16 (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 1 < buf.length, 'Trying to write beyond buffer length')\n    verifsint(value, 0x7fff, -0x8000)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  if (value >= 0)\n    writeUInt16(buf, value, offset, littleEndian, noAssert)\n  else\n    writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert)\n  return offset + 2\n}\n\nBuffer.prototype.writeInt16LE = function (value, offset, noAssert) {\n  return writeInt16(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeInt16BE = function (value, offset, noAssert) {\n  return writeInt16(this, value, offset, false, noAssert)\n}\n\nfunction writeInt32 (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')\n    verifsint(value, 0x7fffffff, -0x80000000)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  if (value >= 0)\n    writeUInt32(buf, value, offset, littleEndian, noAssert)\n  else\n    writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert)\n  return offset + 4\n}\n\nBuffer.prototype.writeInt32LE = function (value, offset, noAssert) {\n  return writeInt32(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeInt32BE = function (value, offset, noAssert) {\n  return writeInt32(this, value, offset, false, noAssert)\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')\n    verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\n  return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function (value, offset, noAssert) {\n  return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function (value, offset, noAssert) {\n  return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 7 < buf.length,\n        'Trying to write beyond buffer length')\n    verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\n  return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function (value, offset, noAssert) {\n  return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function (value, offset, noAssert) {\n  return writeDouble(this, value, offset, false, noAssert)\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function (value, start, end) {\n  if (!value) value = 0\n  if (!start) start = 0\n  if (!end) end = this.length\n\n  assert(end >= start, 'end < start')\n\n  // Fill 0 bytes; we're done\n  if (end === start) return\n  if (this.length === 0) return\n\n  assert(start >= 0 && start < this.length, 'start out of bounds')\n  assert(end >= 0 && end <= this.length, 'end out of bounds')\n\n  var i\n  if (typeof value === 'number') {\n    for (i = start; i < end; i++) {\n      this[i] = value\n    }\n  } else {\n    var bytes = utf8ToBytes(value.toString())\n    var len = bytes.length\n    for (i = start; i < end; i++) {\n      this[i] = bytes[i % len]\n    }\n  }\n\n  return this\n}\n\nBuffer.prototype.inspect = function () {\n  var out = []\n  var len = this.length\n  for (var i = 0; i < len; i++) {\n    out[i] = toHex(this[i])\n    if (i === exports.INSPECT_MAX_BYTES) {\n      out[i + 1] = '...'\n      break\n    }\n  }\n  return '<Buffer ' + out.join(' ') + '>'\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function () {\n  if (typeof Uint8Array !== 'undefined') {\n    if (TYPED_ARRAY_SUPPORT) {\n      return (new Buffer(this)).buffer\n    } else {\n      var buf = new Uint8Array(this.length)\n      for (var i = 0, len = buf.length; i < len; i += 1) {\n        buf[i] = this[i]\n      }\n      return buf.buffer\n    }\n  } else {\n    throw new Error('Buffer.toArrayBuffer not supported in this browser')\n  }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function (arr) {\n  arr._isBuffer = true\n\n  // save reference to original Uint8Array get/set methods before overwriting\n  arr._get = arr.get\n  arr._set = arr.set\n\n  // deprecated, will be removed in node 0.13+\n  arr.get = BP.get\n  arr.set = BP.set\n\n  arr.write = BP.write\n  arr.toString = BP.toString\n  arr.toLocaleString = BP.toString\n  arr.toJSON = BP.toJSON\n  arr.equals = BP.equals\n  arr.compare = BP.compare\n  arr.copy = BP.copy\n  arr.slice = BP.slice\n  arr.readUInt8 = BP.readUInt8\n  arr.readUInt16LE = BP.readUInt16LE\n  arr.readUInt16BE = BP.readUInt16BE\n  arr.readUInt32LE = BP.readUInt32LE\n  arr.readUInt32BE = BP.readUInt32BE\n  arr.readInt8 = BP.readInt8\n  arr.readInt16LE = BP.readInt16LE\n  arr.readInt16BE = BP.readInt16BE\n  arr.readInt32LE = BP.readInt32LE\n  arr.readInt32BE = BP.readInt32BE\n  arr.readFloatLE = BP.readFloatLE\n  arr.readFloatBE = BP.readFloatBE\n  arr.readDoubleLE = BP.readDoubleLE\n  arr.readDoubleBE = BP.readDoubleBE\n  arr.writeUInt8 = BP.writeUInt8\n  arr.writeUInt16LE = BP.writeUInt16LE\n  arr.writeUInt16BE = BP.writeUInt16BE\n  arr.writeUInt32LE = BP.writeUInt32LE\n  arr.writeUInt32BE = BP.writeUInt32BE\n  arr.writeInt8 = BP.writeInt8\n  arr.writeInt16LE = BP.writeInt16LE\n  arr.writeInt16BE = BP.writeInt16BE\n  arr.writeInt32LE = BP.writeInt32LE\n  arr.writeInt32BE = BP.writeInt32BE\n  arr.writeFloatLE = BP.writeFloatLE\n  arr.writeFloatBE = BP.writeFloatBE\n  arr.writeDoubleLE = BP.writeDoubleLE\n  arr.writeDoubleBE = BP.writeDoubleBE\n  arr.fill = BP.fill\n  arr.inspect = BP.inspect\n  arr.toArrayBuffer = BP.toArrayBuffer\n\n  return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-z]/g\n\nfunction base64clean (str) {\n  // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n  str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n  while (str.length % 4 !== 0) {\n    str = str + '='\n  }\n  return str\n}\n\nfunction stringtrim (str) {\n  if (str.trim) return str.trim()\n  return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction isArray (subject) {\n  return (Array.isArray || function (subject) {\n    return Object.prototype.toString.call(subject) === '[object Array]'\n  })(subject)\n}\n\nfunction isArrayish (subject) {\n  return isArray(subject) || Buffer.isBuffer(subject) ||\n      subject && typeof subject === 'object' &&\n      typeof subject.length === 'number'\n}\n\nfunction toHex (n) {\n  if (n < 16) return '0' + n.toString(16)\n  return n.toString(16)\n}\n\nfunction utf8ToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    var b = str.charCodeAt(i)\n    if (b <= 0x7F) {\n      byteArray.push(b)\n    } else {\n      var start = i\n      if (b >= 0xD800 && b <= 0xDFFF) i++\n      var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%')\n      for (var j = 0; j < h.length; j++) {\n        byteArray.push(parseInt(h[j], 16))\n      }\n    }\n  }\n  return byteArray\n}\n\nfunction asciiToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    // Node's code seems to be doing this and not & 0x7F..\n    byteArray.push(str.charCodeAt(i) & 0xFF)\n  }\n  return byteArray\n}\n\nfunction utf16leToBytes (str) {\n  var c, hi, lo\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    c = str.charCodeAt(i)\n    hi = c >> 8\n    lo = c % 256\n    byteArray.push(lo)\n    byteArray.push(hi)\n  }\n\n  return byteArray\n}\n\nfunction base64ToBytes (str) {\n  return base64.toByteArray(str)\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n  for (var i = 0; i < length; i++) {\n    if ((i + offset >= dst.length) || (i >= src.length))\n      break\n    dst[i + offset] = src[i]\n  }\n  return i\n}\n\nfunction decodeUtf8Char (str) {\n  try {\n    return decodeURIComponent(str)\n  } catch (err) {\n    return String.fromCharCode(0xFFFD) // UTF 8 invalid char\n  }\n}\n\n/*\n * We have to make sure that the value is a valid integer. This means that it\n * is non-negative. It has no fractional component and that it does not\n * exceed the maximum allowed value.\n */\nfunction verifuint (value, max) {\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\n  assert(value >= 0, 'specified a negative value for writing an unsigned value')\n  assert(value <= max, 'value is larger than maximum value for type')\n  assert(Math.floor(value) === value, 'value has a fractional component')\n}\n\nfunction verifsint (value, max, min) {\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\n  assert(value <= max, 'value larger than maximum allowed value')\n  assert(value >= min, 'value smaller than minimum allowed value')\n  assert(Math.floor(value) === value, 'value has a fractional component')\n}\n\nfunction verifIEEE754 (value, max, min) {\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\n  assert(value <= max, 'value larger than maximum allowed value')\n  assert(value >= min, 'value smaller than minimum allowed value')\n}\n\nfunction assert (test, message) {\n  if (!test) throw new Error(message || 'Failed assertion')\n}\n\n},{\"base64-js\":5,\"ieee754\":6}],5:[function(_dereq_,module,exports){\nvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n\t'use strict';\n\n  var Arr = (typeof Uint8Array !== 'undefined')\n    ? Uint8Array\n    : Array\n\n\tvar PLUS   = '+'.charCodeAt(0)\n\tvar SLASH  = '/'.charCodeAt(0)\n\tvar NUMBER = '0'.charCodeAt(0)\n\tvar LOWER  = 'a'.charCodeAt(0)\n\tvar UPPER  = 'A'.charCodeAt(0)\n\n\tfunction decode (elt) {\n\t\tvar code = elt.charCodeAt(0)\n\t\tif (code === PLUS)\n\t\t\treturn 62 // '+'\n\t\tif (code === SLASH)\n\t\t\treturn 63 // '/'\n\t\tif (code < NUMBER)\n\t\t\treturn -1 //no match\n\t\tif (code < NUMBER + 10)\n\t\t\treturn code - NUMBER + 26 + 26\n\t\tif (code < UPPER + 26)\n\t\t\treturn code - UPPER\n\t\tif (code < LOWER + 26)\n\t\t\treturn code - LOWER + 26\n\t}\n\n\tfunction b64ToByteArray (b64) {\n\t\tvar i, j, l, tmp, placeHolders, arr\n\n\t\tif (b64.length % 4 > 0) {\n\t\t\tthrow new Error('Invalid string. Length must be a multiple of 4')\n\t\t}\n\n\t\t// the number of equal signs (place holders)\n\t\t// if there are two placeholders, than the two characters before it\n\t\t// represent one byte\n\t\t// if there is only one, then the three characters before it represent 2 bytes\n\t\t// this is just a cheap hack to not do indexOf twice\n\t\tvar len = b64.length\n\t\tplaceHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n\t\t// base64 is 4/3 + up to two characters of the original data\n\t\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n\t\t// if there are placeholders, only get up to the last complete 4 chars\n\t\tl = placeHolders > 0 ? b64.length - 4 : b64.length\n\n\t\tvar L = 0\n\n\t\tfunction push (v) {\n\t\t\tarr[L++] = v\n\t\t}\n\n\t\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n\t\t\tpush((tmp & 0xFF0000) >> 16)\n\t\t\tpush((tmp & 0xFF00) >> 8)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\tif (placeHolders === 2) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n\t\t\tpush(tmp & 0xFF)\n\t\t} else if (placeHolders === 1) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n\t\t\tpush((tmp >> 8) & 0xFF)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\treturn arr\n\t}\n\n\tfunction uint8ToBase64 (uint8) {\n\t\tvar i,\n\t\t\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n\t\t\toutput = \"\",\n\t\t\ttemp, length\n\n\t\tfunction encode (num) {\n\t\t\treturn lookup.charAt(num)\n\t\t}\n\n\t\tfunction tripletToBase64 (num) {\n\t\t\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n\t\t}\n\n\t\t// go through the array every three bytes, we'll deal with trailing stuff later\n\t\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n\t\t\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n\t\t\toutput += tripletToBase64(temp)\n\t\t}\n\n\t\t// pad the end with zeros, but make sure to not forget the extra bytes\n\t\tswitch (extraBytes) {\n\t\t\tcase 1:\n\t\t\t\ttemp = uint8[uint8.length - 1]\n\t\t\t\toutput += encode(temp >> 2)\n\t\t\t\toutput += encode((temp << 4) & 0x3F)\n\t\t\t\toutput += '=='\n\t\t\t\tbreak\n\t\t\tcase 2:\n\t\t\t\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n\t\t\t\toutput += encode(temp >> 10)\n\t\t\t\toutput += encode((temp >> 4) & 0x3F)\n\t\t\t\toutput += encode((temp << 2) & 0x3F)\n\t\t\t\toutput += '='\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn output\n\t}\n\n\texports.toByteArray = b64ToByteArray\n\texports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n\n},{}],6:[function(_dereq_,module,exports){\nexports.read = function(buffer, offset, isLE, mLen, nBytes) {\n  var e, m,\n      eLen = nBytes * 8 - mLen - 1,\n      eMax = (1 << eLen) - 1,\n      eBias = eMax >> 1,\n      nBits = -7,\n      i = isLE ? (nBytes - 1) : 0,\n      d = isLE ? -1 : 1,\n      s = buffer[offset + i];\n\n  i += d;\n\n  e = s & ((1 << (-nBits)) - 1);\n  s >>= (-nBits);\n  nBits += eLen;\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n  m = e & ((1 << (-nBits)) - 1);\n  e >>= (-nBits);\n  nBits += mLen;\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n  if (e === 0) {\n    e = 1 - eBias;\n  } else if (e === eMax) {\n    return m ? NaN : ((s ? -1 : 1) * Infinity);\n  } else {\n    m = m + Math.pow(2, mLen);\n    e = e - eBias;\n  }\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n};\n\nexports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n  var e, m, c,\n      eLen = nBytes * 8 - mLen - 1,\n      eMax = (1 << eLen) - 1,\n      eBias = eMax >> 1,\n      rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),\n      i = isLE ? 0 : (nBytes - 1),\n      d = isLE ? 1 : -1,\n      s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n  value = Math.abs(value);\n\n  if (isNaN(value) || value === Infinity) {\n    m = isNaN(value) ? 1 : 0;\n    e = eMax;\n  } else {\n    e = Math.floor(Math.log(value) / Math.LN2);\n    if (value * (c = Math.pow(2, -e)) < 1) {\n      e--;\n      c *= 2;\n    }\n    if (e + eBias >= 1) {\n      value += rt / c;\n    } else {\n      value += rt * Math.pow(2, 1 - eBias);\n    }\n    if (value * c >= 2) {\n      e++;\n      c /= 2;\n    }\n\n    if (e + eBias >= eMax) {\n      m = 0;\n      e = eMax;\n    } else if (e + eBias >= 1) {\n      m = (value * c - 1) * Math.pow(2, mLen);\n      e = e + eBias;\n    } else {\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n      e = 0;\n    }\n  }\n\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);\n\n  e = (e << mLen) | m;\n  eLen += mLen;\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);\n\n  buffer[offset + i - d] |= s * 128;\n};\n\n},{}],7:[function(_dereq_,module,exports){\n(function (global){\n/**\n * @license\n * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>\n * Build: `lodash modern -o ./dist/lodash.js`\n * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <http://lodash.com/license>\n */\n;(function() {\n\n  /** Used as a safe reference for `undefined` in pre ES5 environments */\n  var undefined;\n\n  /** Used to pool arrays and objects used internally */\n  var arrayPool = [],\n      objectPool = [];\n\n  /** Used to generate unique IDs */\n  var idCounter = 0;\n\n  /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */\n  var keyPrefix = +new Date + '';\n\n  /** Used as the size when optimizations are enabled for large arrays */\n  var largeArraySize = 75;\n\n  /** Used as the max size of the `arrayPool` and `objectPool` */\n  var maxPoolSize = 40;\n\n  /** Used to detect and test whitespace */\n  var whitespace = (\n    // whitespace\n    ' \\t\\x0B\\f\\xA0\\ufeff' +\n\n    // line terminators\n    '\\n\\r\\u2028\\u2029' +\n\n    // unicode category \"Zs\" space separators\n    '\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000'\n  );\n\n  /** Used to match empty string literals in compiled template source */\n  var reEmptyStringLeading = /\\b__p \\+= '';/g,\n      reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n      reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n  /**\n   * Used to match ES6 template delimiters\n   * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals\n   */\n  var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n  /** Used to match regexp flags from their coerced string values */\n  var reFlags = /\\w*$/;\n\n  /** Used to detected named functions */\n  var reFuncName = /^\\s*function[ \\n\\r\\t]+\\w/;\n\n  /** Used to match \"interpolate\" template delimiters */\n  var reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n  /** Used to match leading whitespace and zeros to be removed */\n  var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)');\n\n  /** Used to ensure capturing order of template delimiters */\n  var reNoMatch = /($^)/;\n\n  /** Used to detect functions containing a `this` reference */\n  var reThis = /\\bthis\\b/;\n\n  /** Used to match unescaped characters in compiled string literals */\n  var reUnescapedString = /['\\n\\r\\t\\u2028\\u2029\\\\]/g;\n\n  /** Used to assign default `context` object properties */\n  var contextProps = [\n    'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object',\n    'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN',\n    'parseInt', 'setTimeout'\n  ];\n\n  /** Used to make template sourceURLs easier to identify */\n  var templateCounter = 0;\n\n  /** `Object#toString` result shortcuts */\n  var argsClass = '[object Arguments]',\n      arrayClass = '[object Array]',\n      boolClass = '[object Boolean]',\n      dateClass = '[object Date]',\n      funcClass = '[object Function]',\n      numberClass = '[object Number]',\n      objectClass = '[object Object]',\n      regexpClass = '[object RegExp]',\n      stringClass = '[object String]';\n\n  /** Used to identify object classifications that `_.clone` supports */\n  var cloneableClasses = {};\n  cloneableClasses[funcClass] = false;\n  cloneableClasses[argsClass] = cloneableClasses[arrayClass] =\n  cloneableClasses[boolClass] = cloneableClasses[dateClass] =\n  cloneableClasses[numberClass] = cloneableClasses[objectClass] =\n  cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;\n\n  /** Used as an internal `_.debounce` options object */\n  var debounceOptions = {\n    'leading': false,\n    'maxWait': 0,\n    'trailing': false\n  };\n\n  /** Used as the property descriptor for `__bindData__` */\n  var descriptor = {\n    'configurable': false,\n    'enumerable': false,\n    'value': null,\n    'writable': false\n  };\n\n  /** Used to determine if values are of the language type Object */\n  var objectTypes = {\n    'boolean': false,\n    'function': true,\n    'object': true,\n    'number': false,\n    'string': false,\n    'undefined': false\n  };\n\n  /** Used to escape characters for inclusion in compiled string literals */\n  var stringEscapes = {\n    '\\\\': '\\\\',\n    \"'\": \"'\",\n    '\\n': 'n',\n    '\\r': 'r',\n    '\\t': 't',\n    '\\u2028': 'u2028',\n    '\\u2029': 'u2029'\n  };\n\n  /** Used as a reference to the global object */\n  var root = (objectTypes[typeof window] && window) || this;\n\n  /** Detect free variable `exports` */\n  var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;\n\n  /** Detect free variable `module` */\n  var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;\n\n  /** Detect the popular CommonJS extension `module.exports` */\n  var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;\n\n  /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */\n  var freeGlobal = objectTypes[typeof global] && global;\n  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {\n    root = freeGlobal;\n  }\n\n  /*--------------------------------------------------------------------------*/\n\n  /**\n   * The base implementation of `_.indexOf` without support for binary searches\n   * or `fromIndex` constraints.\n   *\n   * @private\n   * @param {Array} array The array to search.\n   * @param {*} value The value to search for.\n   * @param {number} [fromIndex=0] The index to search from.\n   * @returns {number} Returns the index of the matched value or `-1`.\n   */\n  function baseIndexOf(array, value, fromIndex) {\n    var index = (fromIndex || 0) - 1,\n        length = array ? array.length : 0;\n\n    while (++index < length) {\n      if (array[index] === value) {\n        return index;\n      }\n    }\n    return -1;\n  }\n\n  /**\n   * An implementation of `_.contains` for cache objects that mimics the return\n   * signature of `_.indexOf` by returning `0` if the value is found, else `-1`.\n   *\n   * @private\n   * @param {Object} cache The cache object to inspect.\n   * @param {*} value The value to search for.\n   * @returns {number} Returns `0` if `value` is found, else `-1`.\n   */\n  function cacheIndexOf(cache, value) {\n    var type = typeof value;\n    cache = cache.cache;\n\n    if (type == 'boolean' || value == null) {\n      return cache[value] ? 0 : -1;\n    }\n    if (type != 'number' && type != 'string') {\n      type = 'object';\n    }\n    var key = type == 'number' ? value : keyPrefix + value;\n    cache = (cache = cache[type]) && cache[key];\n\n    return type == 'object'\n      ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1)\n      : (cache ? 0 : -1);\n  }\n\n  /**\n   * Adds a given value to the corresponding cache object.\n   *\n   * @private\n   * @param {*} value The value to add to the cache.\n   */\n  function cachePush(value) {\n    var cache = this.cache,\n        type = typeof value;\n\n    if (type == 'boolean' || value == null) {\n      cache[value] = true;\n    } else {\n      if (type != 'number' && type != 'string') {\n        type = 'object';\n      }\n      var key = type == 'number' ? value : keyPrefix + value,\n          typeCache = cache[type] || (cache[type] = {});\n\n      if (type == 'object') {\n        (typeCache[key] || (typeCache[key] = [])).push(value);\n      } else {\n        typeCache[key] = true;\n      }\n    }\n  }\n\n  /**\n   * Used by `_.max` and `_.min` as the default callback when a given\n   * collection is a string value.\n   *\n   * @private\n   * @param {string} value The character to inspect.\n   * @returns {number} Returns the code unit of given character.\n   */\n  function charAtCallback(value) {\n    return value.charCodeAt(0);\n  }\n\n  /**\n   * Used by `sortBy` to compare transformed `collection` elements, stable sorting\n   * them in ascending order.\n   *\n   * @private\n   * @param {Object} a The object to compare to `b`.\n   * @param {Object} b The object to compare to `a`.\n   * @returns {number} Returns the sort order indicator of `1` or `-1`.\n   */\n  function compareAscending(a, b) {\n    var ac = a.criteria,\n        bc = b.criteria,\n        index = -1,\n        length = ac.length;\n\n    while (++index < length) {\n      var value = ac[index],\n          other = bc[index];\n\n      if (value !== other) {\n        if (value > other || typeof value == 'undefined') {\n          return 1;\n        }\n        if (value < other || typeof other == 'undefined') {\n          return -1;\n        }\n      }\n    }\n    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n    // that causes it, under certain circumstances, to return the same value for\n    // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247\n    //\n    // This also ensures a stable sort in V8 and other engines.\n    // See http://code.google.com/p/v8/issues/detail?id=90\n    return a.index - b.index;\n  }\n\n  /**\n   * Creates a cache object to optimize linear searches of large arrays.\n   *\n   * @private\n   * @param {Array} [array=[]] The array to search.\n   * @returns {null|Object} Returns the cache object or `null` if caching should not be used.\n   */\n  function createCache(array) {\n    var index = -1,\n        length = array.length,\n        first = array[0],\n        mid = array[(length / 2) | 0],\n        last = array[length - 1];\n\n    if (first && typeof first == 'object' &&\n        mid && typeof mid == 'object' && last && typeof last == 'object') {\n      return false;\n    }\n    var cache = getObject();\n    cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;\n\n    var result = getObject();\n    result.array = array;\n    result.cache = cache;\n    result.push = cachePush;\n\n    while (++index < length) {\n      result.push(array[index]);\n    }\n    return result;\n  }\n\n  /**\n   * Used by `template` to escape characters for inclusion in compiled\n   * string literals.\n   *\n   * @private\n   * @param {string} match The matched character to escape.\n   * @returns {string} Returns the escaped character.\n   */\n  function escapeStringChar(match) {\n    return '\\\\' + stringEscapes[match];\n  }\n\n  /**\n   * Gets an array from the array pool or creates a new one if the pool is empty.\n   *\n   * @private\n   * @returns {Array} The array from the pool.\n   */\n  function getArray() {\n    return arrayPool.pop() || [];\n  }\n\n  /**\n   * Gets an object from the object pool or creates a new one if the pool is empty.\n   *\n   * @private\n   * @returns {Object} The object from the pool.\n   */\n  function getObject() {\n    return objectPool.pop() || {\n      'array': null,\n      'cache': null,\n      'criteria': null,\n      'false': false,\n      'index': 0,\n      'null': false,\n      'number': null,\n      'object': null,\n      'push': null,\n      'string': null,\n      'true': false,\n      'undefined': false,\n      'value': null\n    };\n  }\n\n  /**\n   * Releases the given array back to the array pool.\n   *\n   * @private\n   * @param {Array} [array] The array to release.\n   */\n  function releaseArray(array) {\n    array.length = 0;\n    if (arrayPool.length < maxPoolSize) {\n      arrayPool.push(array);\n    }\n  }\n\n  /**\n   * Releases the given object back to the object pool.\n   *\n   * @private\n   * @param {Object} [object] The object to release.\n   */\n  function releaseObject(object) {\n    var cache = object.cache;\n    if (cache) {\n      releaseObject(cache);\n    }\n    object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null;\n    if (objectPool.length < maxPoolSize) {\n      objectPool.push(object);\n    }\n  }\n\n  /**\n   * Slices the `collection` from the `start` index up to, but not including,\n   * the `end` index.\n   *\n   * Note: This function is used instead of `Array#slice` to support node lists\n   * in IE < 9 and to ensure dense arrays are returned.\n   *\n   * @private\n   * @param {Array|Object|string} collection The collection to slice.\n   * @param {number} start The start index.\n   * @param {number} end The end index.\n   * @returns {Array} Returns the new array.\n   */\n  function slice(array, start, end) {\n    start || (start = 0);\n    if (typeof end == 'undefined') {\n      end = array ? array.length : 0;\n    }\n    var index = -1,\n        length = end - start || 0,\n        result = Array(length < 0 ? 0 : length);\n\n    while (++index < length) {\n      result[index] = array[start + index];\n    }\n    return result;\n  }\n\n  /*--------------------------------------------------------------------------*/\n\n  /**\n   * Create a new `lodash` function using the given context object.\n   *\n   * @static\n   * @memberOf _\n   * @category Utilities\n   * @param {Object} [context=root] The context object.\n   * @returns {Function} Returns the `lodash` function.\n   */\n  function runInContext(context) {\n    // Avoid issues with some ES3 environments that attempt to use values, named\n    // after built-in constructors like `Object`, for the creation of literals.\n    // ES5 clears this up by stating that literals must use built-in constructors.\n    // See http://es5.github.io/#x11.1.5.\n    context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;\n\n    /** Native constructor references */\n    var Array = context.Array,\n        Boolean = context.Boolean,\n        Date = context.Date,\n        Function = context.Function,\n        Math = context.Math,\n        Number = context.Number,\n        Object = context.Object,\n        RegExp = context.RegExp,\n        String = context.String,\n        TypeError = context.TypeError;\n\n    /**\n     * Used for `Array` method references.\n     *\n     * Normally `Array.prototype` would suffice, however, using an array literal\n     * avoids issues in Narwhal.\n     */\n    var arrayRef = [];\n\n    /** Used for native method references */\n    var objectProto = Object.prototype;\n\n    /** Used to restore the original `_` reference in `noConflict` */\n    var oldDash = context._;\n\n    /** Used to resolve the internal [[Class]] of values */\n    var toString = objectProto.toString;\n\n    /** Used to detect if a method is native */\n    var reNative = RegExp('^' +\n      String(toString)\n        .replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n        .replace(/toString| for [^\\]]+/g, '.*?') + '$'\n    );\n\n    /** Native method shortcuts */\n    var ceil = Math.ceil,\n        clearTimeout = context.clearTimeout,\n        floor = Math.floor,\n        fnToString = Function.prototype.toString,\n        getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,\n        hasOwnProperty = objectProto.hasOwnProperty,\n        push = arrayRef.push,\n        setTimeout = context.setTimeout,\n        splice = arrayRef.splice,\n        unshift = arrayRef.unshift;\n\n    /** Used to set meta data on functions */\n    var defineProperty = (function() {\n      // IE 8 only accepts DOM elements\n      try {\n        var o = {},\n            func = isNative(func = Object.defineProperty) && func,\n            result = func(o, o, o) && func;\n      } catch(e) { }\n      return result;\n    }());\n\n    /* Native method shortcuts for methods with the same name as other `lodash` methods */\n    var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,\n        nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,\n        nativeIsFinite = context.isFinite,\n        nativeIsNaN = context.isNaN,\n        nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,\n        nativeMax = Math.max,\n        nativeMin = Math.min,\n        nativeParseInt = context.parseInt,\n        nativeRandom = Math.random;\n\n    /** Used to lookup a built-in constructor by [[Class]] */\n    var ctorByClass = {};\n    ctorByClass[arrayClass] = Array;\n    ctorByClass[boolClass] = Boolean;\n    ctorByClass[dateClass] = Date;\n    ctorByClass[funcClass] = Function;\n    ctorByClass[objectClass] = Object;\n    ctorByClass[numberClass] = Number;\n    ctorByClass[regexpClass] = RegExp;\n    ctorByClass[stringClass] = String;\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * Creates a `lodash` object which wraps the given value to enable intuitive\n     * method chaining.\n     *\n     * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:\n     * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,\n     * and `unshift`\n     *\n     * Chaining is supported in custom builds as long as the `value` method is\n     * implicitly or explicitly included in the build.\n     *\n     * The chainable wrapper functions are:\n     * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,\n     * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`,\n     * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`,\n     * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,\n     * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,\n     * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,\n     * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`,\n     * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,\n     * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`,\n     * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`,\n     * and `zip`\n     *\n     * The non-chainable wrapper functions are:\n     * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`,\n     * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`,\n     * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,\n     * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`,\n     * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`,\n     * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`,\n     * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`,\n     * `template`, `unescape`, `uniqueId`, and `value`\n     *\n     * The wrapper functions `first` and `last` return wrapped values when `n` is\n     * provided, otherwise they return unwrapped values.\n     *\n     * Explicit chaining can be enabled by using the `_.chain` method.\n     *\n     * @name _\n     * @constructor\n     * @category Chaining\n     * @param {*} value The value to wrap in a `lodash` instance.\n     * @returns {Object} Returns a `lodash` instance.\n     * @example\n     *\n     * var wrapped = _([1, 2, 3]);\n     *\n     * // returns an unwrapped value\n     * wrapped.reduce(function(sum, num) {\n     *   return sum + num;\n     * });\n     * // => 6\n     *\n     * // returns a wrapped value\n     * var squares = wrapped.map(function(num) {\n     *   return num * num;\n     * });\n     *\n     * _.isArray(squares);\n     * // => false\n     *\n     * _.isArray(squares.value());\n     * // => true\n     */\n    function lodash(value) {\n      // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor\n      return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__'))\n       ? value\n       : new lodashWrapper(value);\n    }\n\n    /**\n     * A fast path for creating `lodash` wrapper objects.\n     *\n     * @private\n     * @param {*} value The value to wrap in a `lodash` instance.\n     * @param {boolean} chainAll A flag to enable chaining for all methods\n     * @returns {Object} Returns a `lodash` instance.\n     */\n    function lodashWrapper(value, chainAll) {\n      this.__chain__ = !!chainAll;\n      this.__wrapped__ = value;\n    }\n    // ensure `new lodashWrapper` is an instance of `lodash`\n    lodashWrapper.prototype = lodash.prototype;\n\n    /**\n     * An object used to flag environments features.\n     *\n     * @static\n     * @memberOf _\n     * @type Object\n     */\n    var support = lodash.support = {};\n\n    /**\n     * Detect if functions can be decompiled by `Function#toString`\n     * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).\n     *\n     * @memberOf _.support\n     * @type boolean\n     */\n    support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext);\n\n    /**\n     * Detect if `Function#name` is supported (all but IE).\n     *\n     * @memberOf _.support\n     * @type boolean\n     */\n    support.funcNames = typeof Function.name == 'string';\n\n    /**\n     * By default, the template delimiters used by Lo-Dash are similar to those in\n     * embedded Ruby (ERB). Change the following template settings to use alternative\n     * delimiters.\n     *\n     * @static\n     * @memberOf _\n     * @type Object\n     */\n    lodash.templateSettings = {\n\n      /**\n       * Used to detect `data` property values to be HTML-escaped.\n       *\n       * @memberOf _.templateSettings\n       * @type RegExp\n       */\n      'escape': /<%-([\\s\\S]+?)%>/g,\n\n      /**\n       * Used to detect code to be evaluated.\n       *\n       * @memberOf _.templateSettings\n       * @type RegExp\n       */\n      'evaluate': /<%([\\s\\S]+?)%>/g,\n\n      /**\n       * Used to detect `data` property values to inject.\n       *\n       * @memberOf _.templateSettings\n       * @type RegExp\n       */\n      'interpolate': reInterpolate,\n\n      /**\n       * Used to reference the data object in the template text.\n       *\n       * @memberOf _.templateSettings\n       * @type string\n       */\n      'variable': '',\n\n      /**\n       * Used to import variables into the compiled template.\n       *\n       * @memberOf _.templateSettings\n       * @type Object\n       */\n      'imports': {\n\n        /**\n         * A reference to the `lodash` function.\n         *\n         * @memberOf _.templateSettings.imports\n         * @type Function\n         */\n        '_': lodash\n      }\n    };\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * The base implementation of `_.bind` that creates the bound function and\n     * sets its meta data.\n     *\n     * @private\n     * @param {Array} bindData The bind data array.\n     * @returns {Function} Returns the new bound function.\n     */\n    function baseBind(bindData) {\n      var func = bindData[0],\n          partialArgs = bindData[2],\n          thisArg = bindData[4];\n\n      function bound() {\n        // `Function#bind` spec\n        // http://es5.github.io/#x15.3.4.5\n        if (partialArgs) {\n          // avoid `arguments` object deoptimizations by using `slice` instead\n          // of `Array.prototype.slice.call` and not assigning `arguments` to a\n          // variable as a ternary expression\n          var args = slice(partialArgs);\n          push.apply(args, arguments);\n        }\n        // mimic the constructor's `return` behavior\n        // http://es5.github.io/#x13.2.2\n        if (this instanceof bound) {\n          // ensure `new bound` is an instance of `func`\n          var thisBinding = baseCreate(func.prototype),\n              result = func.apply(thisBinding, args || arguments);\n          return isObject(result) ? result : thisBinding;\n        }\n        return func.apply(thisArg, args || arguments);\n      }\n      setBindData(bound, bindData);\n      return bound;\n    }\n\n    /**\n     * The base implementation of `_.clone` without argument juggling or support\n     * for `thisArg` binding.\n     *\n     * @private\n     * @param {*} value The value to clone.\n     * @param {boolean} [isDeep=false] Specify a deep clone.\n     * @param {Function} [callback] The function to customize cloning values.\n     * @param {Array} [stackA=[]] Tracks traversed source objects.\n     * @param {Array} [stackB=[]] Associates clones with source counterparts.\n     * @returns {*} Returns the cloned value.\n     */\n    function baseClone(value, isDeep, callback, stackA, stackB) {\n      if (callback) {\n        var result = callback(value);\n        if (typeof result != 'undefined') {\n          return result;\n        }\n      }\n      // inspect [[Class]]\n      var isObj = isObject(value);\n      if (isObj) {\n        var className = toString.call(value);\n        if (!cloneableClasses[className]) {\n          return value;\n        }\n        var ctor = ctorByClass[className];\n        switch (className) {\n          case boolClass:\n          case dateClass:\n            return new ctor(+value);\n\n          case numberClass:\n          case stringClass:\n            return new ctor(value);\n\n          case regexpClass:\n            result = ctor(value.source, reFlags.exec(value));\n            result.lastIndex = value.lastIndex;\n            return result;\n        }\n      } else {\n        return value;\n      }\n      var isArr = isArray(value);\n      if (isDeep) {\n        // check for circular references and return corresponding clone\n        var initedStack = !stackA;\n        stackA || (stackA = getArray());\n        stackB || (stackB = getArray());\n\n        var length = stackA.length;\n        while (length--) {\n          if (stackA[length] == value) {\n            return stackB[length];\n          }\n        }\n        result = isArr ? ctor(value.length) : {};\n      }\n      else {\n        result = isArr ? slice(value) : assign({}, value);\n      }\n      // add array properties assigned by `RegExp#exec`\n      if (isArr) {\n        if (hasOwnProperty.call(value, 'index')) {\n          result.index = value.index;\n        }\n        if (hasOwnProperty.call(value, 'input')) {\n          result.input = value.input;\n        }\n      }\n      // exit for shallow clone\n      if (!isDeep) {\n        return result;\n      }\n      // add the source value to the stack of traversed objects\n      // and associate it with its clone\n      stackA.push(value);\n      stackB.push(result);\n\n      // recursively populate clone (susceptible to call stack limits)\n      (isArr ? forEach : forOwn)(value, function(objValue, key) {\n        result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);\n      });\n\n      if (initedStack) {\n        releaseArray(stackA);\n        releaseArray(stackB);\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.create` without support for assigning\n     * properties to the created object.\n     *\n     * @private\n     * @param {Object} prototype The object to inherit from.\n     * @returns {Object} Returns the new object.\n     */\n    function baseCreate(prototype, properties) {\n      return isObject(prototype) ? nativeCreate(prototype) : {};\n    }\n    // fallback for browsers without `Object.create`\n    if (!nativeCreate) {\n      baseCreate = (function() {\n        function Object() {}\n        return function(prototype) {\n          if (isObject(prototype)) {\n            Object.prototype = prototype;\n            var result = new Object;\n            Object.prototype = null;\n          }\n          return result || context.Object();\n        };\n      }());\n    }\n\n    /**\n     * The base implementation of `_.createCallback` without support for creating\n     * \"_.pluck\" or \"_.where\" style callbacks.\n     *\n     * @private\n     * @param {*} [func=identity] The value to convert to a callback.\n     * @param {*} [thisArg] The `this` binding of the created callback.\n     * @param {number} [argCount] The number of arguments the callback accepts.\n     * @returns {Function} Returns a callback function.\n     */\n    function baseCreateCallback(func, thisArg, argCount) {\n      if (typeof func != 'function') {\n        return identity;\n      }\n      // exit early for no `thisArg` or already bound by `Function#bind`\n      if (typeof thisArg == 'undefined' || !('prototype' in func)) {\n        return func;\n      }\n      var bindData = func.__bindData__;\n      if (typeof bindData == 'undefined') {\n        if (support.funcNames) {\n          bindData = !func.name;\n        }\n        bindData = bindData || !support.funcDecomp;\n        if (!bindData) {\n          var source = fnToString.call(func);\n          if (!support.funcNames) {\n            bindData = !reFuncName.test(source);\n          }\n          if (!bindData) {\n            // checks if `func` references the `this` keyword and stores the result\n            bindData = reThis.test(source);\n            setBindData(func, bindData);\n          }\n        }\n      }\n      // exit early if there are no `this` references or `func` is bound\n      if (bindData === false || (bindData !== true && bindData[1] & 1)) {\n        return func;\n      }\n      switch (argCount) {\n        case 1: return function(value) {\n          return func.call(thisArg, value);\n        };\n        case 2: return function(a, b) {\n          return func.call(thisArg, a, b);\n        };\n        case 3: return function(value, index, collection) {\n          return func.call(thisArg, value, index, collection);\n        };\n        case 4: return function(accumulator, value, index, collection) {\n          return func.call(thisArg, accumulator, value, index, collection);\n        };\n      }\n      return bind(func, thisArg);\n    }\n\n    /**\n     * The base implementation of `createWrapper` that creates the wrapper and\n     * sets its meta data.\n     *\n     * @private\n     * @param {Array} bindData The bind data array.\n     * @returns {Function} Returns the new function.\n     */\n    function baseCreateWrapper(bindData) {\n      var func = bindData[0],\n          bitmask = bindData[1],\n          partialArgs = bindData[2],\n          partialRightArgs = bindData[3],\n          thisArg = bindData[4],\n          arity = bindData[5];\n\n      var isBind = bitmask & 1,\n          isBindKey = bitmask & 2,\n          isCurry = bitmask & 4,\n          isCurryBound = bitmask & 8,\n          key = func;\n\n      function bound() {\n        var thisBinding = isBind ? thisArg : this;\n        if (partialArgs) {\n          var args = slice(partialArgs);\n          push.apply(args, arguments);\n        }\n        if (partialRightArgs || isCurry) {\n          args || (args = slice(arguments));\n          if (partialRightArgs) {\n            push.apply(args, partialRightArgs);\n          }\n          if (isCurry && args.length < arity) {\n            bitmask |= 16 & ~32;\n            return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]);\n          }\n        }\n        args || (args = arguments);\n        if (isBindKey) {\n          func = thisBinding[key];\n        }\n        if (this instanceof bound) {\n          thisBinding = baseCreate(func.prototype);\n          var result = func.apply(thisBinding, args);\n          return isObject(result) ? result : thisBinding;\n        }\n        return func.apply(thisBinding, args);\n      }\n      setBindData(bound, bindData);\n      return bound;\n    }\n\n    /**\n     * The base implementation of `_.difference` that accepts a single array\n     * of values to exclude.\n     *\n     * @private\n     * @param {Array} array The array to process.\n     * @param {Array} [values] The array of values to exclude.\n     * @returns {Array} Returns a new array of filtered values.\n     */\n    function baseDifference(array, values) {\n      var index = -1,\n          indexOf = getIndexOf(),\n          length = array ? array.length : 0,\n          isLarge = length >= largeArraySize && indexOf === baseIndexOf,\n          result = [];\n\n      if (isLarge) {\n        var cache = createCache(values);\n        if (cache) {\n          indexOf = cacheIndexOf;\n          values = cache;\n        } else {\n          isLarge = false;\n        }\n      }\n      while (++index < length) {\n        var value = array[index];\n        if (indexOf(values, value) < 0) {\n          result.push(value);\n        }\n      }\n      if (isLarge) {\n        releaseObject(values);\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.flatten` without support for callback\n     * shorthands or `thisArg` binding.\n     *\n     * @private\n     * @param {Array} array The array to flatten.\n     * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.\n     * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.\n     * @param {number} [fromIndex=0] The index to start from.\n     * @returns {Array} Returns a new flattened array.\n     */\n    function baseFlatten(array, isShallow, isStrict, fromIndex) {\n      var index = (fromIndex || 0) - 1,\n          length = array ? array.length : 0,\n          result = [];\n\n      while (++index < length) {\n        var value = array[index];\n\n        if (value && typeof value == 'object' && typeof value.length == 'number'\n            && (isArray(value) || isArguments(value))) {\n          // recursively flatten arrays (susceptible to call stack limits)\n          if (!isShallow) {\n            value = baseFlatten(value, isShallow, isStrict);\n          }\n          var valIndex = -1,\n              valLength = value.length,\n              resIndex = result.length;\n\n          result.length += valLength;\n          while (++valIndex < valLength) {\n            result[resIndex++] = value[valIndex];\n          }\n        } else if (!isStrict) {\n          result.push(value);\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.isEqual`, without support for `thisArg` binding,\n     * that allows partial \"_.where\" style comparisons.\n     *\n     * @private\n     * @param {*} a The value to compare.\n     * @param {*} b The other value to compare.\n     * @param {Function} [callback] The function to customize comparing values.\n     * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons.\n     * @param {Array} [stackA=[]] Tracks traversed `a` objects.\n     * @param {Array} [stackB=[]] Tracks traversed `b` objects.\n     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n     */\n    function baseIsEqual(a, b, callback, isWhere, stackA, stackB) {\n      // used to indicate that when comparing objects, `a` has at least the properties of `b`\n      if (callback) {\n        var result = callback(a, b);\n        if (typeof result != 'undefined') {\n          return !!result;\n        }\n      }\n      // exit early for identical values\n      if (a === b) {\n        // treat `+0` vs. `-0` as not equal\n        return a !== 0 || (1 / a == 1 / b);\n      }\n      var type = typeof a,\n          otherType = typeof b;\n\n      // exit early for unlike primitive values\n      if (a === a &&\n          !(a && objectTypes[type]) &&\n          !(b && objectTypes[otherType])) {\n        return false;\n      }\n      // exit early for `null` and `undefined` avoiding ES3's Function#call behavior\n      // http://es5.github.io/#x15.3.4.4\n      if (a == null || b == null) {\n        return a === b;\n      }\n      // compare [[Class]] names\n      var className = toString.call(a),\n          otherClass = toString.call(b);\n\n      if (className == argsClass) {\n        className = objectClass;\n      }\n      if (otherClass == argsClass) {\n        otherClass = objectClass;\n      }\n      if (className != otherClass) {\n        return false;\n      }\n      switch (className) {\n        case boolClass:\n        case dateClass:\n          // coerce dates and booleans to numbers, dates to milliseconds and booleans\n          // to `1` or `0` treating invalid dates coerced to `NaN` as not equal\n          return +a == +b;\n\n        case numberClass:\n          // treat `NaN` vs. `NaN` as equal\n          return (a != +a)\n            ? b != +b\n            // but treat `+0` vs. `-0` as not equal\n            : (a == 0 ? (1 / a == 1 / b) : a == +b);\n\n        case regexpClass:\n        case stringClass:\n          // coerce regexes to strings (http://es5.github.io/#x15.10.6.4)\n          // treat string primitives and their corresponding object instances as equal\n          return a == String(b);\n      }\n      var isArr = className == arrayClass;\n      if (!isArr) {\n        // unwrap any `lodash` wrapped values\n        var aWrapped = hasOwnProperty.call(a, '__wrapped__'),\n            bWrapped = hasOwnProperty.call(b, '__wrapped__');\n\n        if (aWrapped || bWrapped) {\n          return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB);\n        }\n        // exit for functions and DOM nodes\n        if (className != objectClass) {\n          return false;\n        }\n        // in older versions of Opera, `arguments` objects have `Array` constructors\n        var ctorA = a.constructor,\n            ctorB = b.constructor;\n\n        // non `Object` object instances with different constructors are not equal\n        if (ctorA != ctorB &&\n              !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&\n              ('constructor' in a && 'constructor' in b)\n            ) {\n          return false;\n        }\n      }\n      // assume cyclic structures are equal\n      // the algorithm for detecting cyclic structures is adapted from ES 5.1\n      // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)\n      var initedStack = !stackA;\n      stackA || (stackA = getArray());\n      stackB || (stackB = getArray());\n\n      var length = stackA.length;\n      while (length--) {\n        if (stackA[length] == a) {\n          return stackB[length] == b;\n        }\n      }\n      var size = 0;\n      result = true;\n\n      // add `a` and `b` to the stack of traversed objects\n      stackA.push(a);\n      stackB.push(b);\n\n      // recursively compare objects and arrays (susceptible to call stack limits)\n      if (isArr) {\n        // compare lengths to determine if a deep comparison is necessary\n        length = a.length;\n        size = b.length;\n        result = size == length;\n\n        if (result || isWhere) {\n          // deep compare the contents, ignoring non-numeric properties\n          while (size--) {\n            var index = length,\n                value = b[size];\n\n            if (isWhere) {\n              while (index--) {\n                if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) {\n                  break;\n                }\n              }\n            } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) {\n              break;\n            }\n          }\n        }\n      }\n      else {\n        // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`\n        // which, in this case, is more costly\n        forIn(b, function(value, key, b) {\n          if (hasOwnProperty.call(b, key)) {\n            // count the number of properties.\n            size++;\n            // deep compare each property value.\n            return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB));\n          }\n        });\n\n        if (result && !isWhere) {\n          // ensure both objects have the same number of properties\n          forIn(a, function(value, key, a) {\n            if (hasOwnProperty.call(a, key)) {\n              // `size` will be `-1` if `a` has more properties than `b`\n              return (result = --size > -1);\n            }\n          });\n        }\n      }\n      stackA.pop();\n      stackB.pop();\n\n      if (initedStack) {\n        releaseArray(stackA);\n        releaseArray(stackB);\n      }\n      return result;\n    }\n\n    /**\n     * The base implementation of `_.merge` without argument juggling or support\n     * for `thisArg` binding.\n     *\n     * @private\n     * @param {Object} object The destination object.\n     * @param {Object} source The source object.\n     * @param {Function} [callback] The function to customize merging properties.\n     * @param {Array} [stackA=[]] Tracks traversed source objects.\n     * @param {Array} [stackB=[]] Associates values with source counterparts.\n     */\n    function baseMerge(object, source, callback, stackA, stackB) {\n      (isArray(source) ? forEach : forOwn)(source, function(source, key) {\n        var found,\n            isArr,\n            result = source,\n            value = object[key];\n\n        if (source && ((isArr = isArray(source)) || isPlainObject(source))) {\n          // avoid merging previously merged cyclic sources\n          var stackLength = stackA.length;\n          while (stackLength--) {\n            if ((found = stackA[stackLength] == source)) {\n              value = stackB[stackLength];\n              break;\n            }\n          }\n          if (!found) {\n            var isShallow;\n            if (callback) {\n              result = callback(value, source);\n              if ((isShallow = typeof result != 'undefined')) {\n                value = result;\n              }\n            }\n            if (!isShallow) {\n              value = isArr\n                ? (isArray(value) ? value : [])\n                : (isPlainObject(value) ? value : {});\n            }\n            // add `source` and associated `value` to the stack of traversed objects\n            stackA.push(source);\n            stackB.push(value);\n\n            // recursively merge objects and arrays (susceptible to call stack limits)\n            if (!isShallow) {\n              baseMerge(value, source, callback, stackA, stackB);\n            }\n          }\n        }\n        else {\n          if (callback) {\n            result = callback(value, source);\n            if (typeof result == 'undefined') {\n              result = source;\n            }\n          }\n          if (typeof result != 'undefined') {\n            value = result;\n          }\n        }\n        object[key] = value;\n      });\n    }\n\n    /**\n     * The base implementation of `_.random` without argument juggling or support\n     * for returning floating-point numbers.\n     *\n     * @private\n     * @param {number} min The minimum possible value.\n     * @param {number} max The maximum possible value.\n     * @returns {number} Returns a random number.\n     */\n    function baseRandom(min, max) {\n      return min + floor(nativeRandom() * (max - min + 1));\n    }\n\n    /**\n     * The base implementation of `_.uniq` without support for callback shorthands\n     * or `thisArg` binding.\n     *\n     * @private\n     * @param {Array} array The array to process.\n     * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.\n     * @param {Function} [callback] The function called per iteration.\n     * @returns {Array} Returns a duplicate-value-free array.\n     */\n    function baseUniq(array, isSorted, callback) {\n      var index = -1,\n          indexOf = getIndexOf(),\n          length = array ? array.length : 0,\n          result = [];\n\n      var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf,\n          seen = (callback || isLarge) ? getArray() : result;\n\n      if (isLarge) {\n        var cache = createCache(seen);\n        indexOf = cacheIndexOf;\n        seen = cache;\n      }\n      while (++index < length) {\n        var value = array[index],\n            computed = callback ? callback(value, index, array) : value;\n\n        if (isSorted\n              ? !index || seen[seen.length - 1] !== computed\n              : indexOf(seen, computed) < 0\n            ) {\n          if (callback || isLarge) {\n            seen.push(computed);\n          }\n          result.push(value);\n        }\n      }\n      if (isLarge) {\n        releaseArray(seen.array);\n        releaseObject(seen);\n      } else if (callback) {\n        releaseArray(seen);\n      }\n      return result;\n    }\n\n    /**\n     * Creates a function that aggregates a collection, creating an object composed\n     * of keys generated from the results of running each element of the collection\n     * through a callback. The given `setter` function sets the keys and values\n     * of the composed object.\n     *\n     * @private\n     * @param {Function} setter The setter function.\n     * @returns {Function} Returns the new aggregator function.\n     */\n    function createAggregator(setter) {\n      return function(collection, callback, thisArg) {\n        var result = {};\n        callback = lodash.createCallback(callback, thisArg, 3);\n\n        var index = -1,\n            length = collection ? collection.length : 0;\n\n        if (typeof length == 'number') {\n          while (++index < length) {\n            var value = collection[index];\n            setter(result, value, callback(value, index, collection), collection);\n          }\n        } else {\n          forOwn(collection, function(value, key, collection) {\n            setter(result, value, callback(value, key, collection), collection);\n          });\n        }\n        return result;\n      };\n    }\n\n    /**\n     * Creates a function that, when called, either curries or invokes `func`\n     * with an optional `this` binding and partially applied arguments.\n     *\n     * @private\n     * @param {Function|string} func The function or method name to reference.\n     * @param {number} bitmask The bitmask of method flags to compose.\n     *  The bitmask may be composed of the following flags:\n     *  1 - `_.bind`\n     *  2 - `_.bindKey`\n     *  4 - `_.curry`\n     *  8 - `_.curry` (bound)\n     *  16 - `_.partial`\n     *  32 - `_.partialRight`\n     * @param {Array} [partialArgs] An array of arguments to prepend to those\n     *  provided to the new function.\n     * @param {Array} [partialRightArgs] An array of arguments to append to those\n     *  provided to the new function.\n     * @param {*} [thisArg] The `this` binding of `func`.\n     * @param {number} [arity] The arity of `func`.\n     * @returns {Function} Returns the new function.\n     */\n    function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {\n      var isBind = bitmask & 1,\n          isBindKey = bitmask & 2,\n          isCurry = bitmask & 4,\n          isCurryBound = bitmask & 8,\n          isPartial = bitmask & 16,\n          isPartialRight = bitmask & 32;\n\n      if (!isBindKey && !isFunction(func)) {\n        throw new TypeError;\n      }\n      if (isPartial && !partialArgs.length) {\n        bitmask &= ~16;\n        isPartial = partialArgs = false;\n      }\n      if (isPartialRight && !partialRightArgs.length) {\n        bitmask &= ~32;\n        isPartialRight = partialRightArgs = false;\n      }\n      var bindData = func && func.__bindData__;\n      if (bindData && bindData !== true) {\n        // clone `bindData`\n        bindData = slice(bindData);\n        if (bindData[2]) {\n          bindData[2] = slice(bindData[2]);\n        }\n        if (bindData[3]) {\n          bindData[3] = slice(bindData[3]);\n        }\n        // set `thisBinding` is not previously bound\n        if (isBind && !(bindData[1] & 1)) {\n          bindData[4] = thisArg;\n        }\n        // set if previously bound but not currently (subsequent curried functions)\n        if (!isBind && bindData[1] & 1) {\n          bitmask |= 8;\n        }\n        // set curried arity if not yet set\n        if (isCurry && !(bindData[1] & 4)) {\n          bindData[5] = arity;\n        }\n        // append partial left arguments\n        if (isPartial) {\n          push.apply(bindData[2] || (bindData[2] = []), partialArgs);\n        }\n        // append partial right arguments\n        if (isPartialRight) {\n          unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs);\n        }\n        // merge flags\n        bindData[1] |= bitmask;\n        return createWrapper.apply(null, bindData);\n      }\n      // fast path for `_.bind`\n      var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper;\n      return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]);\n    }\n\n    /**\n     * Used by `escape` to convert characters to HTML entities.\n     *\n     * @private\n     * @param {string} match The matched character to escape.\n     * @returns {string} Returns the escaped character.\n     */\n    function escapeHtmlChar(match) {\n      return htmlEscapes[match];\n    }\n\n    /**\n     * Gets the appropriate \"indexOf\" function. If the `_.indexOf` method is\n     * customized, this method returns the custom method, otherwise it returns\n     * the `baseIndexOf` function.\n     *\n     * @private\n     * @returns {Function} Returns the \"indexOf\" function.\n     */\n    function getIndexOf() {\n      var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result;\n      return result;\n    }\n\n    /**\n     * Checks if `value` is a native function.\n     *\n     * @private\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is a native function, else `false`.\n     */\n    function isNative(value) {\n      return typeof value == 'function' && reNative.test(value);\n    }\n\n    /**\n     * Sets `this` binding data on a given function.\n     *\n     * @private\n     * @param {Function} func The function to set data on.\n     * @param {Array} value The data array to set.\n     */\n    var setBindData = !defineProperty ? noop : function(func, value) {\n      descriptor.value = value;\n      defineProperty(func, '__bindData__', descriptor);\n    };\n\n    /**\n     * A fallback implementation of `isPlainObject` which checks if a given value\n     * is an object created by the `Object` constructor, assuming objects created\n     * by the `Object` constructor have no inherited enumerable properties and that\n     * there are no `Object.prototype` extensions.\n     *\n     * @private\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n     */\n    function shimIsPlainObject(value) {\n      var ctor,\n          result;\n\n      // avoid non Object objects, `arguments` objects, and DOM elements\n      if (!(value && toString.call(value) == objectClass) ||\n          (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor))) {\n        return false;\n      }\n      // In most environments an object's own properties are iterated before\n      // its inherited properties. If the last iterated property is an object's\n      // own property then there are no inherited enumerable properties.\n      forIn(value, function(value, key) {\n        result = key;\n      });\n      return typeof result == 'undefined' || hasOwnProperty.call(value, result);\n    }\n\n    /**\n     * Used by `unescape` to convert HTML entities to characters.\n     *\n     * @private\n     * @param {string} match The matched character to unescape.\n     * @returns {string} Returns the unescaped character.\n     */\n    function unescapeHtmlChar(match) {\n      return htmlUnescapes[match];\n    }\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * Checks if `value` is an `arguments` object.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`.\n     * @example\n     *\n     * (function() { return _.isArguments(arguments); })(1, 2, 3);\n     * // => true\n     *\n     * _.isArguments([1, 2, 3]);\n     * // => false\n     */\n    function isArguments(value) {\n      return value && typeof value == 'object' && typeof value.length == 'number' &&\n        toString.call(value) == argsClass || false;\n    }\n\n    /**\n     * Checks if `value` is an array.\n     *\n     * @static\n     * @memberOf _\n     * @type Function\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is an array, else `false`.\n     * @example\n     *\n     * (function() { return _.isArray(arguments); })();\n     * // => false\n     *\n     * _.isArray([1, 2, 3]);\n     * // => true\n     */\n    var isArray = nativeIsArray || function(value) {\n      return value && typeof value == 'object' && typeof value.length == 'number' &&\n        toString.call(value) == arrayClass || false;\n    };\n\n    /**\n     * A fallback implementation of `Object.keys` which produces an array of the\n     * given object's own enumerable property names.\n     *\n     * @private\n     * @type Function\n     * @param {Object} object The object to inspect.\n     * @returns {Array} Returns an array of property names.\n     */\n    var shimKeys = function(object) {\n      var index, iterable = object, result = [];\n      if (!iterable) return result;\n      if (!(objectTypes[typeof object])) return result;\n        for (index in iterable) {\n          if (hasOwnProperty.call(iterable, index)) {\n            result.push(index);\n          }\n        }\n      return result\n    };\n\n    /**\n     * Creates an array composed of the own enumerable property names of an object.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to inspect.\n     * @returns {Array} Returns an array of property names.\n     * @example\n     *\n     * _.keys({ 'one': 1, 'two': 2, 'three': 3 });\n     * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)\n     */\n    var keys = !nativeKeys ? shimKeys : function(object) {\n      if (!isObject(object)) {\n        return [];\n      }\n      return nativeKeys(object);\n    };\n\n    /**\n     * Used to convert characters to HTML entities:\n     *\n     * Though the `>` character is escaped for symmetry, characters like `>` and `/`\n     * don't require escaping in HTML and have no special meaning unless they're part\n     * of a tag or an unquoted attribute value.\n     * http://mathiasbynens.be/notes/ambiguous-ampersands (under \"semi-related fun fact\")\n     */\n    var htmlEscapes = {\n      '&': '&amp;',\n      '<': '&lt;',\n      '>': '&gt;',\n      '\"': '&quot;',\n      \"'\": '&#39;'\n    };\n\n    /** Used to convert HTML entities to characters */\n    var htmlUnescapes = invert(htmlEscapes);\n\n    /** Used to match HTML entities and HTML characters */\n    var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'),\n        reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g');\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * Assigns own enumerable properties of source object(s) to the destination\n     * object. Subsequent sources will overwrite property assignments of previous\n     * sources. If a callback is provided it will be executed to produce the\n     * assigned values. The callback is bound to `thisArg` and invoked with two\n     * arguments; (objectValue, sourceValue).\n     *\n     * @static\n     * @memberOf _\n     * @type Function\n     * @alias extend\n     * @category Objects\n     * @param {Object} object The destination object.\n     * @param {...Object} [source] The source objects.\n     * @param {Function} [callback] The function to customize assigning values.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns the destination object.\n     * @example\n     *\n     * _.assign({ 'name': 'fred' }, { 'employer': 'slate' });\n     * // => { 'name': 'fred', 'employer': 'slate' }\n     *\n     * var defaults = _.partialRight(_.assign, function(a, b) {\n     *   return typeof a == 'undefined' ? b : a;\n     * });\n     *\n     * var object = { 'name': 'barney' };\n     * defaults(object, { 'name': 'fred', 'employer': 'slate' });\n     * // => { 'name': 'barney', 'employer': 'slate' }\n     */\n    var assign = function(object, source, guard) {\n      var index, iterable = object, result = iterable;\n      if (!iterable) return result;\n      var args = arguments,\n          argsIndex = 0,\n          argsLength = typeof guard == 'number' ? 2 : args.length;\n      if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n        var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n      } else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n        callback = args[--argsLength];\n      }\n      while (++argsIndex < argsLength) {\n        iterable = args[argsIndex];\n        if (iterable && objectTypes[typeof iterable]) {\n        var ownIndex = -1,\n            ownProps = objectTypes[typeof iterable] && keys(iterable),\n            length = ownProps ? ownProps.length : 0;\n\n        while (++ownIndex < length) {\n          index = ownProps[ownIndex];\n          result[index] = callback ? callback(result[index], iterable[index]) : iterable[index];\n        }\n        }\n      }\n      return result\n    };\n\n    /**\n     * Creates a clone of `value`. If `isDeep` is `true` nested objects will also\n     * be cloned, otherwise they will be assigned by reference. If a callback\n     * is provided it will be executed to produce the cloned values. If the\n     * callback returns `undefined` cloning will be handled by the method instead.\n     * The callback is bound to `thisArg` and invoked with one argument; (value).\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to clone.\n     * @param {boolean} [isDeep=false] Specify a deep clone.\n     * @param {Function} [callback] The function to customize cloning values.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the cloned value.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * var shallow = _.clone(characters);\n     * shallow[0] === characters[0];\n     * // => true\n     *\n     * var deep = _.clone(characters, true);\n     * deep[0] === characters[0];\n     * // => false\n     *\n     * _.mixin({\n     *   'clone': _.partialRight(_.clone, function(value) {\n     *     return _.isElement(value) ? value.cloneNode(false) : undefined;\n     *   })\n     * });\n     *\n     * var clone = _.clone(document.body);\n     * clone.childNodes.length;\n     * // => 0\n     */\n    function clone(value, isDeep, callback, thisArg) {\n      // allows working with \"Collections\" methods without using their `index`\n      // and `collection` arguments for `isDeep` and `callback`\n      if (typeof isDeep != 'boolean' && isDeep != null) {\n        thisArg = callback;\n        callback = isDeep;\n        isDeep = false;\n      }\n      return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));\n    }\n\n    /**\n     * Creates a deep clone of `value`. If a callback is provided it will be\n     * executed to produce the cloned values. If the callback returns `undefined`\n     * cloning will be handled by the method instead. The callback is bound to\n     * `thisArg` and invoked with one argument; (value).\n     *\n     * Note: This method is loosely based on the structured clone algorithm. Functions\n     * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and\n     * objects created by constructors other than `Object` are cloned to plain `Object` objects.\n     * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to deep clone.\n     * @param {Function} [callback] The function to customize cloning values.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the deep cloned value.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * var deep = _.cloneDeep(characters);\n     * deep[0] === characters[0];\n     * // => false\n     *\n     * var view = {\n     *   'label': 'docs',\n     *   'node': element\n     * };\n     *\n     * var clone = _.cloneDeep(view, function(value) {\n     *   return _.isElement(value) ? value.cloneNode(true) : undefined;\n     * });\n     *\n     * clone.node == view.node;\n     * // => false\n     */\n    function cloneDeep(value, callback, thisArg) {\n      return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));\n    }\n\n    /**\n     * Creates an object that inherits from the given `prototype` object. If a\n     * `properties` object is provided its own enumerable properties are assigned\n     * to the created object.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} prototype The object to inherit from.\n     * @param {Object} [properties] The properties to assign to the object.\n     * @returns {Object} Returns the new object.\n     * @example\n     *\n     * function Shape() {\n     *   this.x = 0;\n     *   this.y = 0;\n     * }\n     *\n     * function Circle() {\n     *   Shape.call(this);\n     * }\n     *\n     * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle });\n     *\n     * var circle = new Circle;\n     * circle instanceof Circle;\n     * // => true\n     *\n     * circle instanceof Shape;\n     * // => true\n     */\n    function create(prototype, properties) {\n      var result = baseCreate(prototype);\n      return properties ? assign(result, properties) : result;\n    }\n\n    /**\n     * Assigns own enumerable properties of source object(s) to the destination\n     * object for all destination properties that resolve to `undefined`. Once a\n     * property is set, additional defaults of the same property will be ignored.\n     *\n     * @static\n     * @memberOf _\n     * @type Function\n     * @category Objects\n     * @param {Object} object The destination object.\n     * @param {...Object} [source] The source objects.\n     * @param- {Object} [guard] Allows working with `_.reduce` without using its\n     *  `key` and `object` arguments as sources.\n     * @returns {Object} Returns the destination object.\n     * @example\n     *\n     * var object = { 'name': 'barney' };\n     * _.defaults(object, { 'name': 'fred', 'employer': 'slate' });\n     * // => { 'name': 'barney', 'employer': 'slate' }\n     */\n    var defaults = function(object, source, guard) {\n      var index, iterable = object, result = iterable;\n      if (!iterable) return result;\n      var args = arguments,\n          argsIndex = 0,\n          argsLength = typeof guard == 'number' ? 2 : args.length;\n      while (++argsIndex < argsLength) {\n        iterable = args[argsIndex];\n        if (iterable && objectTypes[typeof iterable]) {\n        var ownIndex = -1,\n            ownProps = objectTypes[typeof iterable] && keys(iterable),\n            length = ownProps ? ownProps.length : 0;\n\n        while (++ownIndex < length) {\n          index = ownProps[ownIndex];\n          if (typeof result[index] == 'undefined') result[index] = iterable[index];\n        }\n        }\n      }\n      return result\n    };\n\n    /**\n     * This method is like `_.findIndex` except that it returns the key of the\n     * first element that passes the callback check, instead of the element itself.\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to search.\n     * @param {Function|Object|string} [callback=identity] The function called per\n     *  iteration. If a property name or object is provided it will be used to\n     *  create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {string|undefined} Returns the key of the found element, else `undefined`.\n     * @example\n     *\n     * var characters = {\n     *   'barney': {  'age': 36, 'blocked': false },\n     *   'fred': {    'age': 40, 'blocked': true },\n     *   'pebbles': { 'age': 1,  'blocked': false }\n     * };\n     *\n     * _.findKey(characters, function(chr) {\n     *   return chr.age < 40;\n     * });\n     * // => 'barney' (property order is not guaranteed across environments)\n     *\n     * // using \"_.where\" callback shorthand\n     * _.findKey(characters, { 'age': 1 });\n     * // => 'pebbles'\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.findKey(characters, 'blocked');\n     * // => 'fred'\n     */\n    function findKey(object, callback, thisArg) {\n      var result;\n      callback = lodash.createCallback(callback, thisArg, 3);\n      forOwn(object, function(value, key, object) {\n        if (callback(value, key, object)) {\n          result = key;\n          return false;\n        }\n      });\n      return result;\n    }\n\n    /**\n     * This method is like `_.findKey` except that it iterates over elements\n     * of a `collection` in the opposite order.\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to search.\n     * @param {Function|Object|string} [callback=identity] The function called per\n     *  iteration. If a property name or object is provided it will be used to\n     *  create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {string|undefined} Returns the key of the found element, else `undefined`.\n     * @example\n     *\n     * var characters = {\n     *   'barney': {  'age': 36, 'blocked': true },\n     *   'fred': {    'age': 40, 'blocked': false },\n     *   'pebbles': { 'age': 1,  'blocked': true }\n     * };\n     *\n     * _.findLastKey(characters, function(chr) {\n     *   return chr.age < 40;\n     * });\n     * // => returns `pebbles`, assuming `_.findKey` returns `barney`\n     *\n     * // using \"_.where\" callback shorthand\n     * _.findLastKey(characters, { 'age': 40 });\n     * // => 'fred'\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.findLastKey(characters, 'blocked');\n     * // => 'pebbles'\n     */\n    function findLastKey(object, callback, thisArg) {\n      var result;\n      callback = lodash.createCallback(callback, thisArg, 3);\n      forOwnRight(object, function(value, key, object) {\n        if (callback(value, key, object)) {\n          result = key;\n          return false;\n        }\n      });\n      return result;\n    }\n\n    /**\n     * Iterates over own and inherited enumerable properties of an object,\n     * executing the callback for each property. The callback is bound to `thisArg`\n     * and invoked with three arguments; (value, key, object). Callbacks may exit\n     * iteration early by explicitly returning `false`.\n     *\n     * @static\n     * @memberOf _\n     * @type Function\n     * @category Objects\n     * @param {Object} object The object to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function Shape() {\n     *   this.x = 0;\n     *   this.y = 0;\n     * }\n     *\n     * Shape.prototype.move = function(x, y) {\n     *   this.x += x;\n     *   this.y += y;\n     * };\n     *\n     * _.forIn(new Shape, function(value, key) {\n     *   console.log(key);\n     * });\n     * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments)\n     */\n    var forIn = function(collection, callback, thisArg) {\n      var index, iterable = collection, result = iterable;\n      if (!iterable) return result;\n      if (!objectTypes[typeof iterable]) return result;\n      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);\n        for (index in iterable) {\n          if (callback(iterable[index], index, collection) === false) return result;\n        }\n      return result\n    };\n\n    /**\n     * This method is like `_.forIn` except that it iterates over elements\n     * of a `collection` in the opposite order.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * function Shape() {\n     *   this.x = 0;\n     *   this.y = 0;\n     * }\n     *\n     * Shape.prototype.move = function(x, y) {\n     *   this.x += x;\n     *   this.y += y;\n     * };\n     *\n     * _.forInRight(new Shape, function(value, key) {\n     *   console.log(key);\n     * });\n     * // => logs 'move', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'move'\n     */\n    function forInRight(object, callback, thisArg) {\n      var pairs = [];\n\n      forIn(object, function(value, key) {\n        pairs.push(key, value);\n      });\n\n      var length = pairs.length;\n      callback = baseCreateCallback(callback, thisArg, 3);\n      while (length--) {\n        if (callback(pairs[length--], pairs[length], object) === false) {\n          break;\n        }\n      }\n      return object;\n    }\n\n    /**\n     * Iterates over own enumerable properties of an object, executing the callback\n     * for each property. The callback is bound to `thisArg` and invoked with three\n     * arguments; (value, key, object). Callbacks may exit iteration early by\n     * explicitly returning `false`.\n     *\n     * @static\n     * @memberOf _\n     * @type Function\n     * @category Objects\n     * @param {Object} object The object to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {\n     *   console.log(key);\n     * });\n     * // => logs '0', '1', and 'length' (property order is not guaranteed across environments)\n     */\n    var forOwn = function(collection, callback, thisArg) {\n      var index, iterable = collection, result = iterable;\n      if (!iterable) return result;\n      if (!objectTypes[typeof iterable]) return result;\n      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);\n        var ownIndex = -1,\n            ownProps = objectTypes[typeof iterable] && keys(iterable),\n            length = ownProps ? ownProps.length : 0;\n\n        while (++ownIndex < length) {\n          index = ownProps[ownIndex];\n          if (callback(iterable[index], index, collection) === false) return result;\n        }\n      return result\n    };\n\n    /**\n     * This method is like `_.forOwn` except that it iterates over elements\n     * of a `collection` in the opposite order.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {\n     *   console.log(key);\n     * });\n     * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length'\n     */\n    function forOwnRight(object, callback, thisArg) {\n      var props = keys(object),\n          length = props.length;\n\n      callback = baseCreateCallback(callback, thisArg, 3);\n      while (length--) {\n        var key = props[length];\n        if (callback(object[key], key, object) === false) {\n          break;\n        }\n      }\n      return object;\n    }\n\n    /**\n     * Creates a sorted array of property names of all enumerable properties,\n     * own and inherited, of `object` that have function values.\n     *\n     * @static\n     * @memberOf _\n     * @alias methods\n     * @category Objects\n     * @param {Object} object The object to inspect.\n     * @returns {Array} Returns an array of property names that have function values.\n     * @example\n     *\n     * _.functions(_);\n     * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...]\n     */\n    function functions(object) {\n      var result = [];\n      forIn(object, function(value, key) {\n        if (isFunction(value)) {\n          result.push(key);\n        }\n      });\n      return result.sort();\n    }\n\n    /**\n     * Checks if the specified property name exists as a direct property of `object`,\n     * instead of an inherited property.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to inspect.\n     * @param {string} key The name of the property to check.\n     * @returns {boolean} Returns `true` if key is a direct property, else `false`.\n     * @example\n     *\n     * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');\n     * // => true\n     */\n    function has(object, key) {\n      return object ? hasOwnProperty.call(object, key) : false;\n    }\n\n    /**\n     * Creates an object composed of the inverted keys and values of the given object.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to invert.\n     * @returns {Object} Returns the created inverted object.\n     * @example\n     *\n     * _.invert({ 'first': 'fred', 'second': 'barney' });\n     * // => { 'fred': 'first', 'barney': 'second' }\n     */\n    function invert(object) {\n      var index = -1,\n          props = keys(object),\n          length = props.length,\n          result = {};\n\n      while (++index < length) {\n        var key = props[index];\n        result[object[key]] = key;\n      }\n      return result;\n    }\n\n    /**\n     * Checks if `value` is a boolean value.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`.\n     * @example\n     *\n     * _.isBoolean(null);\n     * // => false\n     */\n    function isBoolean(value) {\n      return value === true || value === false ||\n        value && typeof value == 'object' && toString.call(value) == boolClass || false;\n    }\n\n    /**\n     * Checks if `value` is a date.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is a date, else `false`.\n     * @example\n     *\n     * _.isDate(new Date);\n     * // => true\n     */\n    function isDate(value) {\n      return value && typeof value == 'object' && toString.call(value) == dateClass || false;\n    }\n\n    /**\n     * Checks if `value` is a DOM element.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`.\n     * @example\n     *\n     * _.isElement(document.body);\n     * // => true\n     */\n    function isElement(value) {\n      return value && value.nodeType === 1 || false;\n    }\n\n    /**\n     * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a\n     * length of `0` and objects with no own enumerable properties are considered\n     * \"empty\".\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Array|Object|string} value The value to inspect.\n     * @returns {boolean} Returns `true` if the `value` is empty, else `false`.\n     * @example\n     *\n     * _.isEmpty([1, 2, 3]);\n     * // => false\n     *\n     * _.isEmpty({});\n     * // => true\n     *\n     * _.isEmpty('');\n     * // => true\n     */\n    function isEmpty(value) {\n      var result = true;\n      if (!value) {\n        return result;\n      }\n      var className = toString.call(value),\n          length = value.length;\n\n      if ((className == arrayClass || className == stringClass || className == argsClass ) ||\n          (className == objectClass && typeof length == 'number' && isFunction(value.splice))) {\n        return !length;\n      }\n      forOwn(value, function() {\n        return (result = false);\n      });\n      return result;\n    }\n\n    /**\n     * Performs a deep comparison between two values to determine if they are\n     * equivalent to each other. If a callback is provided it will be executed\n     * to compare values. If the callback returns `undefined` comparisons will\n     * be handled by the method instead. The callback is bound to `thisArg` and\n     * invoked with two arguments; (a, b).\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} a The value to compare.\n     * @param {*} b The other value to compare.\n     * @param {Function} [callback] The function to customize comparing values.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n     * @example\n     *\n     * var object = { 'name': 'fred' };\n     * var copy = { 'name': 'fred' };\n     *\n     * object == copy;\n     * // => false\n     *\n     * _.isEqual(object, copy);\n     * // => true\n     *\n     * var words = ['hello', 'goodbye'];\n     * var otherWords = ['hi', 'goodbye'];\n     *\n     * _.isEqual(words, otherWords, function(a, b) {\n     *   var reGreet = /^(?:hello|hi)$/i,\n     *       aGreet = _.isString(a) && reGreet.test(a),\n     *       bGreet = _.isString(b) && reGreet.test(b);\n     *\n     *   return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;\n     * });\n     * // => true\n     */\n    function isEqual(a, b, callback, thisArg) {\n      return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2));\n    }\n\n    /**\n     * Checks if `value` is, or can be coerced to, a finite number.\n     *\n     * Note: This is not the same as native `isFinite` which will return true for\n     * booleans and empty strings. See http://es5.github.io/#x15.1.2.5.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is finite, else `false`.\n     * @example\n     *\n     * _.isFinite(-101);\n     * // => true\n     *\n     * _.isFinite('10');\n     * // => true\n     *\n     * _.isFinite(true);\n     * // => false\n     *\n     * _.isFinite('');\n     * // => false\n     *\n     * _.isFinite(Infinity);\n     * // => false\n     */\n    function isFinite(value) {\n      return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));\n    }\n\n    /**\n     * Checks if `value` is a function.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is a function, else `false`.\n     * @example\n     *\n     * _.isFunction(_);\n     * // => true\n     */\n    function isFunction(value) {\n      return typeof value == 'function';\n    }\n\n    /**\n     * Checks if `value` is the language type of Object.\n     * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is an object, else `false`.\n     * @example\n     *\n     * _.isObject({});\n     * // => true\n     *\n     * _.isObject([1, 2, 3]);\n     * // => true\n     *\n     * _.isObject(1);\n     * // => false\n     */\n    function isObject(value) {\n      // check if the value is the ECMAScript language type of Object\n      // http://es5.github.io/#x8\n      // and avoid a V8 bug\n      // http://code.google.com/p/v8/issues/detail?id=2291\n      return !!(value && objectTypes[typeof value]);\n    }\n\n    /**\n     * Checks if `value` is `NaN`.\n     *\n     * Note: This is not the same as native `isNaN` which will return `true` for\n     * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`.\n     * @example\n     *\n     * _.isNaN(NaN);\n     * // => true\n     *\n     * _.isNaN(new Number(NaN));\n     * // => true\n     *\n     * isNaN(undefined);\n     * // => true\n     *\n     * _.isNaN(undefined);\n     * // => false\n     */\n    function isNaN(value) {\n      // `NaN` as a primitive is the only value that is not equal to itself\n      // (perform the [[Class]] check first to avoid errors with some host objects in IE)\n      return isNumber(value) && value != +value;\n    }\n\n    /**\n     * Checks if `value` is `null`.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is `null`, else `false`.\n     * @example\n     *\n     * _.isNull(null);\n     * // => true\n     *\n     * _.isNull(undefined);\n     * // => false\n     */\n    function isNull(value) {\n      return value === null;\n    }\n\n    /**\n     * Checks if `value` is a number.\n     *\n     * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is a number, else `false`.\n     * @example\n     *\n     * _.isNumber(8.4 * 5);\n     * // => true\n     */\n    function isNumber(value) {\n      return typeof value == 'number' ||\n        value && typeof value == 'object' && toString.call(value) == numberClass || false;\n    }\n\n    /**\n     * Checks if `value` is an object created by the `Object` constructor.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n     * @example\n     *\n     * function Shape() {\n     *   this.x = 0;\n     *   this.y = 0;\n     * }\n     *\n     * _.isPlainObject(new Shape);\n     * // => false\n     *\n     * _.isPlainObject([1, 2, 3]);\n     * // => false\n     *\n     * _.isPlainObject({ 'x': 0, 'y': 0 });\n     * // => true\n     */\n    var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {\n      if (!(value && toString.call(value) == objectClass)) {\n        return false;\n      }\n      var valueOf = value.valueOf,\n          objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);\n\n      return objProto\n        ? (value == objProto || getPrototypeOf(value) == objProto)\n        : shimIsPlainObject(value);\n    };\n\n    /**\n     * Checks if `value` is a regular expression.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`.\n     * @example\n     *\n     * _.isRegExp(/fred/);\n     * // => true\n     */\n    function isRegExp(value) {\n      return value && typeof value == 'object' && toString.call(value) == regexpClass || false;\n    }\n\n    /**\n     * Checks if `value` is a string.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is a string, else `false`.\n     * @example\n     *\n     * _.isString('fred');\n     * // => true\n     */\n    function isString(value) {\n      return typeof value == 'string' ||\n        value && typeof value == 'object' && toString.call(value) == stringClass || false;\n    }\n\n    /**\n     * Checks if `value` is `undefined`.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {*} value The value to check.\n     * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`.\n     * @example\n     *\n     * _.isUndefined(void 0);\n     * // => true\n     */\n    function isUndefined(value) {\n      return typeof value == 'undefined';\n    }\n\n    /**\n     * Creates an object with the same keys as `object` and values generated by\n     * running each own enumerable property of `object` through the callback.\n     * The callback is bound to `thisArg` and invoked with three arguments;\n     * (value, key, object).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a new object with values of the results of each `callback` execution.\n     * @example\n     *\n     * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(num) { return num * 3; });\n     * // => { 'a': 3, 'b': 6, 'c': 9 }\n     *\n     * var characters = {\n     *   'fred': { 'name': 'fred', 'age': 40 },\n     *   'pebbles': { 'name': 'pebbles', 'age': 1 }\n     * };\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.mapValues(characters, 'age');\n     * // => { 'fred': 40, 'pebbles': 1 }\n     */\n    function mapValues(object, callback, thisArg) {\n      var result = {};\n      callback = lodash.createCallback(callback, thisArg, 3);\n\n      forOwn(object, function(value, key, object) {\n        result[key] = callback(value, key, object);\n      });\n      return result;\n    }\n\n    /**\n     * Recursively merges own enumerable properties of the source object(s), that\n     * don't resolve to `undefined` into the destination object. Subsequent sources\n     * will overwrite property assignments of previous sources. If a callback is\n     * provided it will be executed to produce the merged values of the destination\n     * and source properties. If the callback returns `undefined` merging will\n     * be handled by the method instead. The callback is bound to `thisArg` and\n     * invoked with two arguments; (objectValue, sourceValue).\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The destination object.\n     * @param {...Object} [source] The source objects.\n     * @param {Function} [callback] The function to customize merging properties.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns the destination object.\n     * @example\n     *\n     * var names = {\n     *   'characters': [\n     *     { 'name': 'barney' },\n     *     { 'name': 'fred' }\n     *   ]\n     * };\n     *\n     * var ages = {\n     *   'characters': [\n     *     { 'age': 36 },\n     *     { 'age': 40 }\n     *   ]\n     * };\n     *\n     * _.merge(names, ages);\n     * // => { 'characters': [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] }\n     *\n     * var food = {\n     *   'fruits': ['apple'],\n     *   'vegetables': ['beet']\n     * };\n     *\n     * var otherFood = {\n     *   'fruits': ['banana'],\n     *   'vegetables': ['carrot']\n     * };\n     *\n     * _.merge(food, otherFood, function(a, b) {\n     *   return _.isArray(a) ? a.concat(b) : undefined;\n     * });\n     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }\n     */\n    function merge(object) {\n      var args = arguments,\n          length = 2;\n\n      if (!isObject(object)) {\n        return object;\n      }\n      // allows working with `_.reduce` and `_.reduceRight` without using\n      // their `index` and `collection` arguments\n      if (typeof args[2] != 'number') {\n        length = args.length;\n      }\n      if (length > 3 && typeof args[length - 2] == 'function') {\n        var callback = baseCreateCallback(args[--length - 1], args[length--], 2);\n      } else if (length > 2 && typeof args[length - 1] == 'function') {\n        callback = args[--length];\n      }\n      var sources = slice(arguments, 1, length),\n          index = -1,\n          stackA = getArray(),\n          stackB = getArray();\n\n      while (++index < length) {\n        baseMerge(object, sources[index], callback, stackA, stackB);\n      }\n      releaseArray(stackA);\n      releaseArray(stackB);\n      return object;\n    }\n\n    /**\n     * Creates a shallow clone of `object` excluding the specified properties.\n     * Property names may be specified as individual arguments or as arrays of\n     * property names. If a callback is provided it will be executed for each\n     * property of `object` omitting the properties the callback returns truey\n     * for. The callback is bound to `thisArg` and invoked with three arguments;\n     * (value, key, object).\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The source object.\n     * @param {Function|...string|string[]} [callback] The properties to omit or the\n     *  function called per iteration.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns an object without the omitted properties.\n     * @example\n     *\n     * _.omit({ 'name': 'fred', 'age': 40 }, 'age');\n     * // => { 'name': 'fred' }\n     *\n     * _.omit({ 'name': 'fred', 'age': 40 }, function(value) {\n     *   return typeof value == 'number';\n     * });\n     * // => { 'name': 'fred' }\n     */\n    function omit(object, callback, thisArg) {\n      var result = {};\n      if (typeof callback != 'function') {\n        var props = [];\n        forIn(object, function(value, key) {\n          props.push(key);\n        });\n        props = baseDifference(props, baseFlatten(arguments, true, false, 1));\n\n        var index = -1,\n            length = props.length;\n\n        while (++index < length) {\n          var key = props[index];\n          result[key] = object[key];\n        }\n      } else {\n        callback = lodash.createCallback(callback, thisArg, 3);\n        forIn(object, function(value, key, object) {\n          if (!callback(value, key, object)) {\n            result[key] = value;\n          }\n        });\n      }\n      return result;\n    }\n\n    /**\n     * Creates a two dimensional array of an object's key-value pairs,\n     * i.e. `[[key1, value1], [key2, value2]]`.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to inspect.\n     * @returns {Array} Returns new array of key-value pairs.\n     * @example\n     *\n     * _.pairs({ 'barney': 36, 'fred': 40 });\n     * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments)\n     */\n    function pairs(object) {\n      var index = -1,\n          props = keys(object),\n          length = props.length,\n          result = Array(length);\n\n      while (++index < length) {\n        var key = props[index];\n        result[index] = [key, object[key]];\n      }\n      return result;\n    }\n\n    /**\n     * Creates a shallow clone of `object` composed of the specified properties.\n     * Property names may be specified as individual arguments or as arrays of\n     * property names. If a callback is provided it will be executed for each\n     * property of `object` picking the properties the callback returns truey\n     * for. The callback is bound to `thisArg` and invoked with three arguments;\n     * (value, key, object).\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The source object.\n     * @param {Function|...string|string[]} [callback] The function called per\n     *  iteration or property names to pick, specified as individual property\n     *  names or arrays of property names.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns an object composed of the picked properties.\n     * @example\n     *\n     * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name');\n     * // => { 'name': 'fred' }\n     *\n     * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) {\n     *   return key.charAt(0) != '_';\n     * });\n     * // => { 'name': 'fred' }\n     */\n    function pick(object, callback, thisArg) {\n      var result = {};\n      if (typeof callback != 'function') {\n        var index = -1,\n            props = baseFlatten(arguments, true, false, 1),\n            length = isObject(object) ? props.length : 0;\n\n        while (++index < length) {\n          var key = props[index];\n          if (key in object) {\n            result[key] = object[key];\n          }\n        }\n      } else {\n        callback = lodash.createCallback(callback, thisArg, 3);\n        forIn(object, function(value, key, object) {\n          if (callback(value, key, object)) {\n            result[key] = value;\n          }\n        });\n      }\n      return result;\n    }\n\n    /**\n     * An alternative to `_.reduce` this method transforms `object` to a new\n     * `accumulator` object which is the result of running each of its own\n     * enumerable properties through a callback, with each callback execution\n     * potentially mutating the `accumulator` object. The callback is bound to\n     * `thisArg` and invoked with four arguments; (accumulator, value, key, object).\n     * Callbacks may exit iteration early by explicitly returning `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Array|Object} object The object to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [accumulator] The custom accumulator value.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the accumulated value.\n     * @example\n     *\n     * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) {\n     *   num *= num;\n     *   if (num % 2) {\n     *     return result.push(num) < 3;\n     *   }\n     * });\n     * // => [1, 9, 25]\n     *\n     * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {\n     *   result[key] = num * 3;\n     * });\n     * // => { 'a': 3, 'b': 6, 'c': 9 }\n     */\n    function transform(object, callback, accumulator, thisArg) {\n      var isArr = isArray(object);\n      if (accumulator == null) {\n        if (isArr) {\n          accumulator = [];\n        } else {\n          var ctor = object && object.constructor,\n              proto = ctor && ctor.prototype;\n\n          accumulator = baseCreate(proto);\n        }\n      }\n      if (callback) {\n        callback = lodash.createCallback(callback, thisArg, 4);\n        (isArr ? forEach : forOwn)(object, function(value, index, object) {\n          return callback(accumulator, value, index, object);\n        });\n      }\n      return accumulator;\n    }\n\n    /**\n     * Creates an array composed of the own enumerable property values of `object`.\n     *\n     * @static\n     * @memberOf _\n     * @category Objects\n     * @param {Object} object The object to inspect.\n     * @returns {Array} Returns an array of property values.\n     * @example\n     *\n     * _.values({ 'one': 1, 'two': 2, 'three': 3 });\n     * // => [1, 2, 3] (property order is not guaranteed across environments)\n     */\n    function values(object) {\n      var index = -1,\n          props = keys(object),\n          length = props.length,\n          result = Array(length);\n\n      while (++index < length) {\n        result[index] = object[props[index]];\n      }\n      return result;\n    }\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * Creates an array of elements from the specified indexes, or keys, of the\n     * `collection`. Indexes may be specified as individual arguments or as arrays\n     * of indexes.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {...(number|number[]|string|string[])} [index] The indexes of `collection`\n     *   to retrieve, specified as individual indexes or arrays of indexes.\n     * @returns {Array} Returns a new array of elements corresponding to the\n     *  provided indexes.\n     * @example\n     *\n     * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);\n     * // => ['a', 'c', 'e']\n     *\n     * _.at(['fred', 'barney', 'pebbles'], 0, 2);\n     * // => ['fred', 'pebbles']\n     */\n    function at(collection) {\n      var args = arguments,\n          index = -1,\n          props = baseFlatten(args, true, false, 1),\n          length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length,\n          result = Array(length);\n\n      while(++index < length) {\n        result[index] = collection[props[index]];\n      }\n      return result;\n    }\n\n    /**\n     * Checks if a given value is present in a collection using strict equality\n     * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the\n     * offset from the end of the collection.\n     *\n     * @static\n     * @memberOf _\n     * @alias include\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {*} target The value to check for.\n     * @param {number} [fromIndex=0] The index to search from.\n     * @returns {boolean} Returns `true` if the `target` element is found, else `false`.\n     * @example\n     *\n     * _.contains([1, 2, 3], 1);\n     * // => true\n     *\n     * _.contains([1, 2, 3], 1, 2);\n     * // => false\n     *\n     * _.contains({ 'name': 'fred', 'age': 40 }, 'fred');\n     * // => true\n     *\n     * _.contains('pebbles', 'eb');\n     * // => true\n     */\n    function contains(collection, target, fromIndex) {\n      var index = -1,\n          indexOf = getIndexOf(),\n          length = collection ? collection.length : 0,\n          result = false;\n\n      fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;\n      if (isArray(collection)) {\n        result = indexOf(collection, target, fromIndex) > -1;\n      } else if (typeof length == 'number') {\n        result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1;\n      } else {\n        forOwn(collection, function(value) {\n          if (++index >= fromIndex) {\n            return !(result = value === target);\n          }\n        });\n      }\n      return result;\n    }\n\n    /**\n     * Creates an object composed of keys generated from the results of running\n     * each element of `collection` through the callback. The corresponding value\n     * of each key is the number of times the key was returned by the callback.\n     * The callback is bound to `thisArg` and invoked with three arguments;\n     * (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns the composed aggregate object.\n     * @example\n     *\n     * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });\n     * // => { '4': 1, '6': 2 }\n     *\n     * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);\n     * // => { '4': 1, '6': 2 }\n     *\n     * _.countBy(['one', 'two', 'three'], 'length');\n     * // => { '3': 2, '5': 1 }\n     */\n    var countBy = createAggregator(function(result, value, key) {\n      (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1);\n    });\n\n    /**\n     * Checks if the given callback returns truey value for **all** elements of\n     * a collection. The callback is bound to `thisArg` and invoked with three\n     * arguments; (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @alias all\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {boolean} Returns `true` if all elements passed the callback check,\n     *  else `false`.\n     * @example\n     *\n     * _.every([true, 1, null, 'yes']);\n     * // => false\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.every(characters, 'age');\n     * // => true\n     *\n     * // using \"_.where\" callback shorthand\n     * _.every(characters, { 'age': 36 });\n     * // => false\n     */\n    function every(collection, callback, thisArg) {\n      var result = true;\n      callback = lodash.createCallback(callback, thisArg, 3);\n\n      var index = -1,\n          length = collection ? collection.length : 0;\n\n      if (typeof length == 'number') {\n        while (++index < length) {\n          if (!(result = !!callback(collection[index], index, collection))) {\n            break;\n          }\n        }\n      } else {\n        forOwn(collection, function(value, index, collection) {\n          return (result = !!callback(value, index, collection));\n        });\n      }\n      return result;\n    }\n\n    /**\n     * Iterates over elements of a collection, returning an array of all elements\n     * the callback returns truey for. The callback is bound to `thisArg` and\n     * invoked with three arguments; (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @alias select\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a new array of elements that passed the callback check.\n     * @example\n     *\n     * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });\n     * // => [2, 4, 6]\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36, 'blocked': false },\n     *   { 'name': 'fred',   'age': 40, 'blocked': true }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.filter(characters, 'blocked');\n     * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]\n     *\n     * // using \"_.where\" callback shorthand\n     * _.filter(characters, { 'age': 36 });\n     * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]\n     */\n    function filter(collection, callback, thisArg) {\n      var result = [];\n      callback = lodash.createCallback(callback, thisArg, 3);\n\n      var index = -1,\n          length = collection ? collection.length : 0;\n\n      if (typeof length == 'number') {\n        while (++index < length) {\n          var value = collection[index];\n          if (callback(value, index, collection)) {\n            result.push(value);\n          }\n        }\n      } else {\n        forOwn(collection, function(value, index, collection) {\n          if (callback(value, index, collection)) {\n            result.push(value);\n          }\n        });\n      }\n      return result;\n    }\n\n    /**\n     * Iterates over elements of a collection, returning the first element that\n     * the callback returns truey for. The callback is bound to `thisArg` and\n     * invoked with three arguments; (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @alias detect, findWhere\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the found element, else `undefined`.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'age': 36, 'blocked': false },\n     *   { 'name': 'fred',    'age': 40, 'blocked': true },\n     *   { 'name': 'pebbles', 'age': 1,  'blocked': false }\n     * ];\n     *\n     * _.find(characters, function(chr) {\n     *   return chr.age < 40;\n     * });\n     * // => { 'name': 'barney', 'age': 36, 'blocked': false }\n     *\n     * // using \"_.where\" callback shorthand\n     * _.find(characters, { 'age': 1 });\n     * // =>  { 'name': 'pebbles', 'age': 1, 'blocked': false }\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.find(characters, 'blocked');\n     * // => { 'name': 'fred', 'age': 40, 'blocked': true }\n     */\n    function find(collection, callback, thisArg) {\n      callback = lodash.createCallback(callback, thisArg, 3);\n\n      var index = -1,\n          length = collection ? collection.length : 0;\n\n      if (typeof length == 'number') {\n        while (++index < length) {\n          var value = collection[index];\n          if (callback(value, index, collection)) {\n            return value;\n          }\n        }\n      } else {\n        var result;\n        forOwn(collection, function(value, index, collection) {\n          if (callback(value, index, collection)) {\n            result = value;\n            return false;\n          }\n        });\n        return result;\n      }\n    }\n\n    /**\n     * This method is like `_.find` except that it iterates over elements\n     * of a `collection` from right to left.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the found element, else `undefined`.\n     * @example\n     *\n     * _.findLast([1, 2, 3, 4], function(num) {\n     *   return num % 2 == 1;\n     * });\n     * // => 3\n     */\n    function findLast(collection, callback, thisArg) {\n      var result;\n      callback = lodash.createCallback(callback, thisArg, 3);\n      forEachRight(collection, function(value, index, collection) {\n        if (callback(value, index, collection)) {\n          result = value;\n          return false;\n        }\n      });\n      return result;\n    }\n\n    /**\n     * Iterates over elements of a collection, executing the callback for each\n     * element. The callback is bound to `thisArg` and invoked with three arguments;\n     * (value, index|key, collection). Callbacks may exit iteration early by\n     * explicitly returning `false`.\n     *\n     * Note: As with other \"Collections\" methods, objects with a `length` property\n     * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`\n     * may be used for object iteration.\n     *\n     * @static\n     * @memberOf _\n     * @alias each\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array|Object|string} Returns `collection`.\n     * @example\n     *\n     * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(',');\n     * // => logs each number and returns '1,2,3'\n     *\n     * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });\n     * // => logs each number and returns the object (property order is not guaranteed across environments)\n     */\n    function forEach(collection, callback, thisArg) {\n      var index = -1,\n          length = collection ? collection.length : 0;\n\n      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);\n      if (typeof length == 'number') {\n        while (++index < length) {\n          if (callback(collection[index], index, collection) === false) {\n            break;\n          }\n        }\n      } else {\n        forOwn(collection, callback);\n      }\n      return collection;\n    }\n\n    /**\n     * This method is like `_.forEach` except that it iterates over elements\n     * of a `collection` from right to left.\n     *\n     * @static\n     * @memberOf _\n     * @alias eachRight\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array|Object|string} Returns `collection`.\n     * @example\n     *\n     * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(',');\n     * // => logs each number from right to left and returns '3,2,1'\n     */\n    function forEachRight(collection, callback, thisArg) {\n      var length = collection ? collection.length : 0;\n      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);\n      if (typeof length == 'number') {\n        while (length--) {\n          if (callback(collection[length], length, collection) === false) {\n            break;\n          }\n        }\n      } else {\n        var props = keys(collection);\n        length = props.length;\n        forOwn(collection, function(value, key, collection) {\n          key = props ? props[--length] : --length;\n          return callback(collection[key], key, collection);\n        });\n      }\n      return collection;\n    }\n\n    /**\n     * Creates an object composed of keys generated from the results of running\n     * each element of a collection through the callback. The corresponding value\n     * of each key is an array of the elements responsible for generating the key.\n     * The callback is bound to `thisArg` and invoked with three arguments;\n     * (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns the composed aggregate object.\n     * @example\n     *\n     * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });\n     * // => { '4': [4.2], '6': [6.1, 6.4] }\n     *\n     * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);\n     * // => { '4': [4.2], '6': [6.1, 6.4] }\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.groupBy(['one', 'two', 'three'], 'length');\n     * // => { '3': ['one', 'two'], '5': ['three'] }\n     */\n    var groupBy = createAggregator(function(result, value, key) {\n      (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);\n    });\n\n    /**\n     * Creates an object composed of keys generated from the results of running\n     * each element of the collection through the given callback. The corresponding\n     * value of each key is the last element responsible for generating the key.\n     * The callback is bound to `thisArg` and invoked with three arguments;\n     * (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Object} Returns the composed aggregate object.\n     * @example\n     *\n     * var keys = [\n     *   { 'dir': 'left', 'code': 97 },\n     *   { 'dir': 'right', 'code': 100 }\n     * ];\n     *\n     * _.indexBy(keys, 'dir');\n     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n     *\n     * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); });\n     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n     *\n     * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String);\n     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n     */\n    var indexBy = createAggregator(function(result, value, key) {\n      result[key] = value;\n    });\n\n    /**\n     * Invokes the method named by `methodName` on each element in the `collection`\n     * returning an array of the results of each invoked method. Additional arguments\n     * will be provided to each invoked method. If `methodName` is a function it\n     * will be invoked for, and `this` bound to, each element in the `collection`.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|string} methodName The name of the method to invoke or\n     *  the function invoked per iteration.\n     * @param {...*} [arg] Arguments to invoke the method with.\n     * @returns {Array} Returns a new array of the results of each invoked method.\n     * @example\n     *\n     * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');\n     * // => [[1, 5, 7], [1, 2, 3]]\n     *\n     * _.invoke([123, 456], String.prototype.split, '');\n     * // => [['1', '2', '3'], ['4', '5', '6']]\n     */\n    function invoke(collection, methodName) {\n      var args = slice(arguments, 2),\n          index = -1,\n          isFunc = typeof methodName == 'function',\n          length = collection ? collection.length : 0,\n          result = Array(typeof length == 'number' ? length : 0);\n\n      forEach(collection, function(value) {\n        result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);\n      });\n      return result;\n    }\n\n    /**\n     * Creates an array of values by running each element in the collection\n     * through the callback. The callback is bound to `thisArg` and invoked with\n     * three arguments; (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @alias collect\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a new array of the results of each `callback` execution.\n     * @example\n     *\n     * _.map([1, 2, 3], function(num) { return num * 3; });\n     * // => [3, 6, 9]\n     *\n     * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });\n     * // => [3, 6, 9] (property order is not guaranteed across environments)\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.map(characters, 'name');\n     * // => ['barney', 'fred']\n     */\n    function map(collection, callback, thisArg) {\n      var index = -1,\n          length = collection ? collection.length : 0;\n\n      callback = lodash.createCallback(callback, thisArg, 3);\n      if (typeof length == 'number') {\n        var result = Array(length);\n        while (++index < length) {\n          result[index] = callback(collection[index], index, collection);\n        }\n      } else {\n        result = [];\n        forOwn(collection, function(value, key, collection) {\n          result[++index] = callback(value, key, collection);\n        });\n      }\n      return result;\n    }\n\n    /**\n     * Retrieves the maximum value of a collection. If the collection is empty or\n     * falsey `-Infinity` is returned. If a callback is provided it will be executed\n     * for each value in the collection to generate the criterion by which the value\n     * is ranked. The callback is bound to `thisArg` and invoked with three\n     * arguments; (value, index, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the maximum value.\n     * @example\n     *\n     * _.max([4, 2, 8, 6]);\n     * // => 8\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * _.max(characters, function(chr) { return chr.age; });\n     * // => { 'name': 'fred', 'age': 40 };\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.max(characters, 'age');\n     * // => { 'name': 'fred', 'age': 40 };\n     */\n    function max(collection, callback, thisArg) {\n      var computed = -Infinity,\n          result = computed;\n\n      // allows working with functions like `_.map` without using\n      // their `index` argument as a callback\n      if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {\n        callback = null;\n      }\n      if (callback == null && isArray(collection)) {\n        var index = -1,\n            length = collection.length;\n\n        while (++index < length) {\n          var value = collection[index];\n          if (value > result) {\n            result = value;\n          }\n        }\n      } else {\n        callback = (callback == null && isString(collection))\n          ? charAtCallback\n          : lodash.createCallback(callback, thisArg, 3);\n\n        forEach(collection, function(value, index, collection) {\n          var current = callback(value, index, collection);\n          if (current > computed) {\n            computed = current;\n            result = value;\n          }\n        });\n      }\n      return result;\n    }\n\n    /**\n     * Retrieves the minimum value of a collection. If the collection is empty or\n     * falsey `Infinity` is returned. If a callback is provided it will be executed\n     * for each value in the collection to generate the criterion by which the value\n     * is ranked. The callback is bound to `thisArg` and invoked with three\n     * arguments; (value, index, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the minimum value.\n     * @example\n     *\n     * _.min([4, 2, 8, 6]);\n     * // => 2\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * _.min(characters, function(chr) { return chr.age; });\n     * // => { 'name': 'barney', 'age': 36 };\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.min(characters, 'age');\n     * // => { 'name': 'barney', 'age': 36 };\n     */\n    function min(collection, callback, thisArg) {\n      var computed = Infinity,\n          result = computed;\n\n      // allows working with functions like `_.map` without using\n      // their `index` argument as a callback\n      if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {\n        callback = null;\n      }\n      if (callback == null && isArray(collection)) {\n        var index = -1,\n            length = collection.length;\n\n        while (++index < length) {\n          var value = collection[index];\n          if (value < result) {\n            result = value;\n          }\n        }\n      } else {\n        callback = (callback == null && isString(collection))\n          ? charAtCallback\n          : lodash.createCallback(callback, thisArg, 3);\n\n        forEach(collection, function(value, index, collection) {\n          var current = callback(value, index, collection);\n          if (current < computed) {\n            computed = current;\n            result = value;\n          }\n        });\n      }\n      return result;\n    }\n\n    /**\n     * Retrieves the value of a specified property from all elements in the collection.\n     *\n     * @static\n     * @memberOf _\n     * @type Function\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {string} property The name of the property to pluck.\n     * @returns {Array} Returns a new array of property values.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * _.pluck(characters, 'name');\n     * // => ['barney', 'fred']\n     */\n    var pluck = map;\n\n    /**\n     * Reduces a collection to a value which is the accumulated result of running\n     * each element in the collection through the callback, where each successive\n     * callback execution consumes the return value of the previous execution. If\n     * `accumulator` is not provided the first element of the collection will be\n     * used as the initial `accumulator` value. The callback is bound to `thisArg`\n     * and invoked with four arguments; (accumulator, value, index|key, collection).\n     *\n     * @static\n     * @memberOf _\n     * @alias foldl, inject\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [accumulator] Initial value of the accumulator.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the accumulated value.\n     * @example\n     *\n     * var sum = _.reduce([1, 2, 3], function(sum, num) {\n     *   return sum + num;\n     * });\n     * // => 6\n     *\n     * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {\n     *   result[key] = num * 3;\n     *   return result;\n     * }, {});\n     * // => { 'a': 3, 'b': 6, 'c': 9 }\n     */\n    function reduce(collection, callback, accumulator, thisArg) {\n      if (!collection) return accumulator;\n      var noaccum = arguments.length < 3;\n      callback = lodash.createCallback(callback, thisArg, 4);\n\n      var index = -1,\n          length = collection.length;\n\n      if (typeof length == 'number') {\n        if (noaccum) {\n          accumulator = collection[++index];\n        }\n        while (++index < length) {\n          accumulator = callback(accumulator, collection[index], index, collection);\n        }\n      } else {\n        forOwn(collection, function(value, index, collection) {\n          accumulator = noaccum\n            ? (noaccum = false, value)\n            : callback(accumulator, value, index, collection)\n        });\n      }\n      return accumulator;\n    }\n\n    /**\n     * This method is like `_.reduce` except that it iterates over elements\n     * of a `collection` from right to left.\n     *\n     * @static\n     * @memberOf _\n     * @alias foldr\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function} [callback=identity] The function called per iteration.\n     * @param {*} [accumulator] Initial value of the accumulator.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the accumulated value.\n     * @example\n     *\n     * var list = [[0, 1], [2, 3], [4, 5]];\n     * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);\n     * // => [4, 5, 2, 3, 0, 1]\n     */\n    function reduceRight(collection, callback, accumulator, thisArg) {\n      var noaccum = arguments.length < 3;\n      callback = lodash.createCallback(callback, thisArg, 4);\n      forEachRight(collection, function(value, index, collection) {\n        accumulator = noaccum\n          ? (noaccum = false, value)\n          : callback(accumulator, value, index, collection);\n      });\n      return accumulator;\n    }\n\n    /**\n     * The opposite of `_.filter` this method returns the elements of a\n     * collection that the callback does **not** return truey for.\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a new array of elements that failed the callback check.\n     * @example\n     *\n     * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });\n     * // => [1, 3, 5]\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36, 'blocked': false },\n     *   { 'name': 'fred',   'age': 40, 'blocked': true }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.reject(characters, 'blocked');\n     * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]\n     *\n     * // using \"_.where\" callback shorthand\n     * _.reject(characters, { 'age': 36 });\n     * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]\n     */\n    function reject(collection, callback, thisArg) {\n      callback = lodash.createCallback(callback, thisArg, 3);\n      return filter(collection, function(value, index, collection) {\n        return !callback(value, index, collection);\n      });\n    }\n\n    /**\n     * Retrieves a random element or `n` random elements from a collection.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to sample.\n     * @param {number} [n] The number of elements to sample.\n     * @param- {Object} [guard] Allows working with functions like `_.map`\n     *  without using their `index` arguments as `n`.\n     * @returns {Array} Returns the random sample(s) of `collection`.\n     * @example\n     *\n     * _.sample([1, 2, 3, 4]);\n     * // => 2\n     *\n     * _.sample([1, 2, 3, 4], 2);\n     * // => [3, 1]\n     */\n    function sample(collection, n, guard) {\n      if (collection && typeof collection.length != 'number') {\n        collection = values(collection);\n      }\n      if (n == null || guard) {\n        return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;\n      }\n      var result = shuffle(collection);\n      result.length = nativeMin(nativeMax(0, n), result.length);\n      return result;\n    }\n\n    /**\n     * Creates an array of shuffled values, using a version of the Fisher-Yates\n     * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to shuffle.\n     * @returns {Array} Returns a new shuffled collection.\n     * @example\n     *\n     * _.shuffle([1, 2, 3, 4, 5, 6]);\n     * // => [4, 1, 6, 3, 5, 2]\n     */\n    function shuffle(collection) {\n      var index = -1,\n          length = collection ? collection.length : 0,\n          result = Array(typeof length == 'number' ? length : 0);\n\n      forEach(collection, function(value) {\n        var rand = baseRandom(0, ++index);\n        result[index] = result[rand];\n        result[rand] = value;\n      });\n      return result;\n    }\n\n    /**\n     * Gets the size of the `collection` by returning `collection.length` for arrays\n     * and array-like objects or the number of own enumerable properties for objects.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to inspect.\n     * @returns {number} Returns `collection.length` or number of own enumerable properties.\n     * @example\n     *\n     * _.size([1, 2]);\n     * // => 2\n     *\n     * _.size({ 'one': 1, 'two': 2, 'three': 3 });\n     * // => 3\n     *\n     * _.size('pebbles');\n     * // => 7\n     */\n    function size(collection) {\n      var length = collection ? collection.length : 0;\n      return typeof length == 'number' ? length : keys(collection).length;\n    }\n\n    /**\n     * Checks if the callback returns a truey value for **any** element of a\n     * collection. The function returns as soon as it finds a passing value and\n     * does not iterate over the entire collection. The callback is bound to\n     * `thisArg` and invoked with three arguments; (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @alias any\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {boolean} Returns `true` if any element passed the callback check,\n     *  else `false`.\n     * @example\n     *\n     * _.some([null, 0, 'yes', false], Boolean);\n     * // => true\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36, 'blocked': false },\n     *   { 'name': 'fred',   'age': 40, 'blocked': true }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.some(characters, 'blocked');\n     * // => true\n     *\n     * // using \"_.where\" callback shorthand\n     * _.some(characters, { 'age': 1 });\n     * // => false\n     */\n    function some(collection, callback, thisArg) {\n      var result;\n      callback = lodash.createCallback(callback, thisArg, 3);\n\n      var index = -1,\n          length = collection ? collection.length : 0;\n\n      if (typeof length == 'number') {\n        while (++index < length) {\n          if ((result = callback(collection[index], index, collection))) {\n            break;\n          }\n        }\n      } else {\n        forOwn(collection, function(value, index, collection) {\n          return !(result = callback(value, index, collection));\n        });\n      }\n      return !!result;\n    }\n\n    /**\n     * Creates an array of elements, sorted in ascending order by the results of\n     * running each element in a collection through the callback. This method\n     * performs a stable sort, that is, it will preserve the original sort order\n     * of equal elements. The callback is bound to `thisArg` and invoked with\n     * three arguments; (value, index|key, collection).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an array of property names is provided for `callback` the collection\n     * will be sorted by each property value.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Array|Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a new array of sorted elements.\n     * @example\n     *\n     * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); });\n     * // => [3, 1, 2]\n     *\n     * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);\n     * // => [3, 1, 2]\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'age': 36 },\n     *   { 'name': 'fred',    'age': 40 },\n     *   { 'name': 'barney',  'age': 26 },\n     *   { 'name': 'fred',    'age': 30 }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.map(_.sortBy(characters, 'age'), _.values);\n     * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]]\n     *\n     * // sorting by multiple properties\n     * _.map(_.sortBy(characters, ['name', 'age']), _.values);\n     * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]]\n     */\n    function sortBy(collection, callback, thisArg) {\n      var index = -1,\n          isArr = isArray(callback),\n          length = collection ? collection.length : 0,\n          result = Array(typeof length == 'number' ? length : 0);\n\n      if (!isArr) {\n        callback = lodash.createCallback(callback, thisArg, 3);\n      }\n      forEach(collection, function(value, key, collection) {\n        var object = result[++index] = getObject();\n        if (isArr) {\n          object.criteria = map(callback, function(key) { return value[key]; });\n        } else {\n          (object.criteria = getArray())[0] = callback(value, key, collection);\n        }\n        object.index = index;\n        object.value = value;\n      });\n\n      length = result.length;\n      result.sort(compareAscending);\n      while (length--) {\n        var object = result[length];\n        result[length] = object.value;\n        if (!isArr) {\n          releaseArray(object.criteria);\n        }\n        releaseObject(object);\n      }\n      return result;\n    }\n\n    /**\n     * Converts the `collection` to an array.\n     *\n     * @static\n     * @memberOf _\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to convert.\n     * @returns {Array} Returns the new converted array.\n     * @example\n     *\n     * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);\n     * // => [2, 3, 4]\n     */\n    function toArray(collection) {\n      if (collection && typeof collection.length == 'number') {\n        return slice(collection);\n      }\n      return values(collection);\n    }\n\n    /**\n     * Performs a deep comparison of each element in a `collection` to the given\n     * `properties` object, returning an array of all elements that have equivalent\n     * property values.\n     *\n     * @static\n     * @memberOf _\n     * @type Function\n     * @category Collections\n     * @param {Array|Object|string} collection The collection to iterate over.\n     * @param {Object} props The object of property values to filter by.\n     * @returns {Array} Returns a new array of elements that have the given properties.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] },\n     *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }\n     * ];\n     *\n     * _.where(characters, { 'age': 36 });\n     * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }]\n     *\n     * _.where(characters, { 'pets': ['dino'] });\n     * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }]\n     */\n    var where = filter;\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * Creates an array with all falsey values removed. The values `false`, `null`,\n     * `0`, `\"\"`, `undefined`, and `NaN` are all falsey.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to compact.\n     * @returns {Array} Returns a new array of filtered values.\n     * @example\n     *\n     * _.compact([0, 1, false, 2, '', 3]);\n     * // => [1, 2, 3]\n     */\n    function compact(array) {\n      var index = -1,\n          length = array ? array.length : 0,\n          result = [];\n\n      while (++index < length) {\n        var value = array[index];\n        if (value) {\n          result.push(value);\n        }\n      }\n      return result;\n    }\n\n    /**\n     * Creates an array excluding all values of the provided arrays using strict\n     * equality for comparisons, i.e. `===`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to process.\n     * @param {...Array} [values] The arrays of values to exclude.\n     * @returns {Array} Returns a new array of filtered values.\n     * @example\n     *\n     * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);\n     * // => [1, 3, 4]\n     */\n    function difference(array) {\n      return baseDifference(array, baseFlatten(arguments, true, true, 1));\n    }\n\n    /**\n     * This method is like `_.find` except that it returns the index of the first\n     * element that passes the callback check, instead of the element itself.\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to search.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {number} Returns the index of the found element, else `-1`.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'age': 36, 'blocked': false },\n     *   { 'name': 'fred',    'age': 40, 'blocked': true },\n     *   { 'name': 'pebbles', 'age': 1,  'blocked': false }\n     * ];\n     *\n     * _.findIndex(characters, function(chr) {\n     *   return chr.age < 20;\n     * });\n     * // => 2\n     *\n     * // using \"_.where\" callback shorthand\n     * _.findIndex(characters, { 'age': 36 });\n     * // => 0\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.findIndex(characters, 'blocked');\n     * // => 1\n     */\n    function findIndex(array, callback, thisArg) {\n      var index = -1,\n          length = array ? array.length : 0;\n\n      callback = lodash.createCallback(callback, thisArg, 3);\n      while (++index < length) {\n        if (callback(array[index], index, array)) {\n          return index;\n        }\n      }\n      return -1;\n    }\n\n    /**\n     * This method is like `_.findIndex` except that it iterates over elements\n     * of a `collection` from right to left.\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to search.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {number} Returns the index of the found element, else `-1`.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'age': 36, 'blocked': true },\n     *   { 'name': 'fred',    'age': 40, 'blocked': false },\n     *   { 'name': 'pebbles', 'age': 1,  'blocked': true }\n     * ];\n     *\n     * _.findLastIndex(characters, function(chr) {\n     *   return chr.age > 30;\n     * });\n     * // => 1\n     *\n     * // using \"_.where\" callback shorthand\n     * _.findLastIndex(characters, { 'age': 36 });\n     * // => 0\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.findLastIndex(characters, 'blocked');\n     * // => 2\n     */\n    function findLastIndex(array, callback, thisArg) {\n      var length = array ? array.length : 0;\n      callback = lodash.createCallback(callback, thisArg, 3);\n      while (length--) {\n        if (callback(array[length], length, array)) {\n          return length;\n        }\n      }\n      return -1;\n    }\n\n    /**\n     * Gets the first element or first `n` elements of an array. If a callback\n     * is provided elements at the beginning of the array are returned as long\n     * as the callback returns truey. The callback is bound to `thisArg` and\n     * invoked with three arguments; (value, index, array).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @alias head, take\n     * @category Arrays\n     * @param {Array} array The array to query.\n     * @param {Function|Object|number|string} [callback] The function called\n     *  per element or the number of elements to return. If a property name or\n     *  object is provided it will be used to create a \"_.pluck\" or \"_.where\"\n     *  style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the first element(s) of `array`.\n     * @example\n     *\n     * _.first([1, 2, 3]);\n     * // => 1\n     *\n     * _.first([1, 2, 3], 2);\n     * // => [1, 2]\n     *\n     * _.first([1, 2, 3], function(num) {\n     *   return num < 3;\n     * });\n     * // => [1, 2]\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },\n     *   { 'name': 'fred',    'blocked': false, 'employer': 'slate' },\n     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.first(characters, 'blocked');\n     * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }]\n     *\n     * // using \"_.where\" callback shorthand\n     * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name');\n     * // => ['barney', 'fred']\n     */\n    function first(array, callback, thisArg) {\n      var n = 0,\n          length = array ? array.length : 0;\n\n      if (typeof callback != 'number' && callback != null) {\n        var index = -1;\n        callback = lodash.createCallback(callback, thisArg, 3);\n        while (++index < length && callback(array[index], index, array)) {\n          n++;\n        }\n      } else {\n        n = callback;\n        if (n == null || thisArg) {\n          return array ? array[0] : undefined;\n        }\n      }\n      return slice(array, 0, nativeMin(nativeMax(0, n), length));\n    }\n\n    /**\n     * Flattens a nested array (the nesting can be to any depth). If `isShallow`\n     * is truey, the array will only be flattened a single level. If a callback\n     * is provided each element of the array is passed through the callback before\n     * flattening. The callback is bound to `thisArg` and invoked with three\n     * arguments; (value, index, array).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to flatten.\n     * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a new flattened array.\n     * @example\n     *\n     * _.flatten([1, [2], [3, [[4]]]]);\n     * // => [1, 2, 3, 4];\n     *\n     * _.flatten([1, [2], [3, [[4]]]], true);\n     * // => [1, 2, 3, [[4]]];\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] },\n     *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.flatten(characters, 'pets');\n     * // => ['hoppy', 'baby puss', 'dino']\n     */\n    function flatten(array, isShallow, callback, thisArg) {\n      // juggle arguments\n      if (typeof isShallow != 'boolean' && isShallow != null) {\n        thisArg = callback;\n        callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow;\n        isShallow = false;\n      }\n      if (callback != null) {\n        array = map(array, callback, thisArg);\n      }\n      return baseFlatten(array, isShallow);\n    }\n\n    /**\n     * Gets the index at which the first occurrence of `value` is found using\n     * strict equality for comparisons, i.e. `===`. If the array is already sorted\n     * providing `true` for `fromIndex` will run a faster binary search.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to search.\n     * @param {*} value The value to search for.\n     * @param {boolean|number} [fromIndex=0] The index to search from or `true`\n     *  to perform a binary search on a sorted array.\n     * @returns {number} Returns the index of the matched value or `-1`.\n     * @example\n     *\n     * _.indexOf([1, 2, 3, 1, 2, 3], 2);\n     * // => 1\n     *\n     * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);\n     * // => 4\n     *\n     * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);\n     * // => 2\n     */\n    function indexOf(array, value, fromIndex) {\n      if (typeof fromIndex == 'number') {\n        var length = array ? array.length : 0;\n        fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);\n      } else if (fromIndex) {\n        var index = sortedIndex(array, value);\n        return array[index] === value ? index : -1;\n      }\n      return baseIndexOf(array, value, fromIndex);\n    }\n\n    /**\n     * Gets all but the last element or last `n` elements of an array. If a\n     * callback is provided elements at the end of the array are excluded from\n     * the result as long as the callback returns truey. The callback is bound\n     * to `thisArg` and invoked with three arguments; (value, index, array).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to query.\n     * @param {Function|Object|number|string} [callback=1] The function called\n     *  per element or the number of elements to exclude. If a property name or\n     *  object is provided it will be used to create a \"_.pluck\" or \"_.where\"\n     *  style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a slice of `array`.\n     * @example\n     *\n     * _.initial([1, 2, 3]);\n     * // => [1, 2]\n     *\n     * _.initial([1, 2, 3], 2);\n     * // => [1]\n     *\n     * _.initial([1, 2, 3], function(num) {\n     *   return num > 1;\n     * });\n     * // => [1]\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },\n     *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },\n     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.initial(characters, 'blocked');\n     * // => [{ 'name': 'barney',  'blocked': false, 'employer': 'slate' }]\n     *\n     * // using \"_.where\" callback shorthand\n     * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name');\n     * // => ['barney', 'fred']\n     */\n    function initial(array, callback, thisArg) {\n      var n = 0,\n          length = array ? array.length : 0;\n\n      if (typeof callback != 'number' && callback != null) {\n        var index = length;\n        callback = lodash.createCallback(callback, thisArg, 3);\n        while (index-- && callback(array[index], index, array)) {\n          n++;\n        }\n      } else {\n        n = (callback == null || thisArg) ? 1 : callback || n;\n      }\n      return slice(array, 0, nativeMin(nativeMax(0, length - n), length));\n    }\n\n    /**\n     * Creates an array of unique values present in all provided arrays using\n     * strict equality for comparisons, i.e. `===`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {...Array} [array] The arrays to inspect.\n     * @returns {Array} Returns an array of shared values.\n     * @example\n     *\n     * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);\n     * // => [1, 2]\n     */\n    function intersection() {\n      var args = [],\n          argsIndex = -1,\n          argsLength = arguments.length,\n          caches = getArray(),\n          indexOf = getIndexOf(),\n          trustIndexOf = indexOf === baseIndexOf,\n          seen = getArray();\n\n      while (++argsIndex < argsLength) {\n        var value = arguments[argsIndex];\n        if (isArray(value) || isArguments(value)) {\n          args.push(value);\n          caches.push(trustIndexOf && value.length >= largeArraySize &&\n            createCache(argsIndex ? args[argsIndex] : seen));\n        }\n      }\n      var array = args[0],\n          index = -1,\n          length = array ? array.length : 0,\n          result = [];\n\n      outer:\n      while (++index < length) {\n        var cache = caches[0];\n        value = array[index];\n\n        if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {\n          argsIndex = argsLength;\n          (cache || seen).push(value);\n          while (--argsIndex) {\n            cache = caches[argsIndex];\n            if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {\n              continue outer;\n            }\n          }\n          result.push(value);\n        }\n      }\n      while (argsLength--) {\n        cache = caches[argsLength];\n        if (cache) {\n          releaseObject(cache);\n        }\n      }\n      releaseArray(caches);\n      releaseArray(seen);\n      return result;\n    }\n\n    /**\n     * Gets the last element or last `n` elements of an array. If a callback is\n     * provided elements at the end of the array are returned as long as the\n     * callback returns truey. The callback is bound to `thisArg` and invoked\n     * with three arguments; (value, index, array).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to query.\n     * @param {Function|Object|number|string} [callback] The function called\n     *  per element or the number of elements to return. If a property name or\n     *  object is provided it will be used to create a \"_.pluck\" or \"_.where\"\n     *  style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {*} Returns the last element(s) of `array`.\n     * @example\n     *\n     * _.last([1, 2, 3]);\n     * // => 3\n     *\n     * _.last([1, 2, 3], 2);\n     * // => [2, 3]\n     *\n     * _.last([1, 2, 3], function(num) {\n     *   return num > 1;\n     * });\n     * // => [2, 3]\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },\n     *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },\n     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.pluck(_.last(characters, 'blocked'), 'name');\n     * // => ['fred', 'pebbles']\n     *\n     * // using \"_.where\" callback shorthand\n     * _.last(characters, { 'employer': 'na' });\n     * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]\n     */\n    function last(array, callback, thisArg) {\n      var n = 0,\n          length = array ? array.length : 0;\n\n      if (typeof callback != 'number' && callback != null) {\n        var index = length;\n        callback = lodash.createCallback(callback, thisArg, 3);\n        while (index-- && callback(array[index], index, array)) {\n          n++;\n        }\n      } else {\n        n = callback;\n        if (n == null || thisArg) {\n          return array ? array[length - 1] : undefined;\n        }\n      }\n      return slice(array, nativeMax(0, length - n));\n    }\n\n    /**\n     * Gets the index at which the last occurrence of `value` is found using strict\n     * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used\n     * as the offset from the end of the collection.\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to search.\n     * @param {*} value The value to search for.\n     * @param {number} [fromIndex=array.length-1] The index to search from.\n     * @returns {number} Returns the index of the matched value or `-1`.\n     * @example\n     *\n     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);\n     * // => 4\n     *\n     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);\n     * // => 1\n     */\n    function lastIndexOf(array, value, fromIndex) {\n      var index = array ? array.length : 0;\n      if (typeof fromIndex == 'number') {\n        index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;\n      }\n      while (index--) {\n        if (array[index] === value) {\n          return index;\n        }\n      }\n      return -1;\n    }\n\n    /**\n     * Removes all provided values from the given array using strict equality for\n     * comparisons, i.e. `===`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to modify.\n     * @param {...*} [value] The values to remove.\n     * @returns {Array} Returns `array`.\n     * @example\n     *\n     * var array = [1, 2, 3, 1, 2, 3];\n     * _.pull(array, 2, 3);\n     * console.log(array);\n     * // => [1, 1]\n     */\n    function pull(array) {\n      var args = arguments,\n          argsIndex = 0,\n          argsLength = args.length,\n          length = array ? array.length : 0;\n\n      while (++argsIndex < argsLength) {\n        var index = -1,\n            value = args[argsIndex];\n        while (++index < length) {\n          if (array[index] === value) {\n            splice.call(array, index--, 1);\n            length--;\n          }\n        }\n      }\n      return array;\n    }\n\n    /**\n     * Creates an array of numbers (positive and/or negative) progressing from\n     * `start` up to but not including `end`. If `start` is less than `stop` a\n     * zero-length range is created unless a negative `step` is specified.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {number} [start=0] The start of the range.\n     * @param {number} end The end of the range.\n     * @param {number} [step=1] The value to increment or decrement by.\n     * @returns {Array} Returns a new range array.\n     * @example\n     *\n     * _.range(4);\n     * // => [0, 1, 2, 3]\n     *\n     * _.range(1, 5);\n     * // => [1, 2, 3, 4]\n     *\n     * _.range(0, 20, 5);\n     * // => [0, 5, 10, 15]\n     *\n     * _.range(0, -4, -1);\n     * // => [0, -1, -2, -3]\n     *\n     * _.range(1, 4, 0);\n     * // => [1, 1, 1]\n     *\n     * _.range(0);\n     * // => []\n     */\n    function range(start, end, step) {\n      start = +start || 0;\n      step = typeof step == 'number' ? step : (+step || 1);\n\n      if (end == null) {\n        end = start;\n        start = 0;\n      }\n      // use `Array(length)` so engines like Chakra and V8 avoid slower modes\n      // http://youtu.be/XAqIpGU8ZZk#t=17m25s\n      var index = -1,\n          length = nativeMax(0, ceil((end - start) / (step || 1))),\n          result = Array(length);\n\n      while (++index < length) {\n        result[index] = start;\n        start += step;\n      }\n      return result;\n    }\n\n    /**\n     * Removes all elements from an array that the callback returns truey for\n     * and returns an array of removed elements. The callback is bound to `thisArg`\n     * and invoked with three arguments; (value, index, array).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to modify.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a new array of removed elements.\n     * @example\n     *\n     * var array = [1, 2, 3, 4, 5, 6];\n     * var evens = _.remove(array, function(num) { return num % 2 == 0; });\n     *\n     * console.log(array);\n     * // => [1, 3, 5]\n     *\n     * console.log(evens);\n     * // => [2, 4, 6]\n     */\n    function remove(array, callback, thisArg) {\n      var index = -1,\n          length = array ? array.length : 0,\n          result = [];\n\n      callback = lodash.createCallback(callback, thisArg, 3);\n      while (++index < length) {\n        var value = array[index];\n        if (callback(value, index, array)) {\n          result.push(value);\n          splice.call(array, index--, 1);\n          length--;\n        }\n      }\n      return result;\n    }\n\n    /**\n     * The opposite of `_.initial` this method gets all but the first element or\n     * first `n` elements of an array. If a callback function is provided elements\n     * at the beginning of the array are excluded from the result as long as the\n     * callback returns truey. The callback is bound to `thisArg` and invoked\n     * with three arguments; (value, index, array).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @alias drop, tail\n     * @category Arrays\n     * @param {Array} array The array to query.\n     * @param {Function|Object|number|string} [callback=1] The function called\n     *  per element or the number of elements to exclude. If a property name or\n     *  object is provided it will be used to create a \"_.pluck\" or \"_.where\"\n     *  style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a slice of `array`.\n     * @example\n     *\n     * _.rest([1, 2, 3]);\n     * // => [2, 3]\n     *\n     * _.rest([1, 2, 3], 2);\n     * // => [3]\n     *\n     * _.rest([1, 2, 3], function(num) {\n     *   return num < 3;\n     * });\n     * // => [3]\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },\n     *   { 'name': 'fred',    'blocked': false,  'employer': 'slate' },\n     *   { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }\n     * ];\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.pluck(_.rest(characters, 'blocked'), 'name');\n     * // => ['fred', 'pebbles']\n     *\n     * // using \"_.where\" callback shorthand\n     * _.rest(characters, { 'employer': 'slate' });\n     * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]\n     */\n    function rest(array, callback, thisArg) {\n      if (typeof callback != 'number' && callback != null) {\n        var n = 0,\n            index = -1,\n            length = array ? array.length : 0;\n\n        callback = lodash.createCallback(callback, thisArg, 3);\n        while (++index < length && callback(array[index], index, array)) {\n          n++;\n        }\n      } else {\n        n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);\n      }\n      return slice(array, n);\n    }\n\n    /**\n     * Uses a binary search to determine the smallest index at which a value\n     * should be inserted into a given sorted array in order to maintain the sort\n     * order of the array. If a callback is provided it will be executed for\n     * `value` and each element of `array` to compute their sort ranking. The\n     * callback is bound to `thisArg` and invoked with one argument; (value).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to inspect.\n     * @param {*} value The value to evaluate.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {number} Returns the index at which `value` should be inserted\n     *  into `array`.\n     * @example\n     *\n     * _.sortedIndex([20, 30, 50], 40);\n     * // => 2\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');\n     * // => 2\n     *\n     * var dict = {\n     *   'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }\n     * };\n     *\n     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {\n     *   return dict.wordToNumber[word];\n     * });\n     * // => 2\n     *\n     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {\n     *   return this.wordToNumber[word];\n     * }, dict);\n     * // => 2\n     */\n    function sortedIndex(array, value, callback, thisArg) {\n      var low = 0,\n          high = array ? array.length : low;\n\n      // explicitly reference `identity` for better inlining in Firefox\n      callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity;\n      value = callback(value);\n\n      while (low < high) {\n        var mid = (low + high) >>> 1;\n        (callback(array[mid]) < value)\n          ? low = mid + 1\n          : high = mid;\n      }\n      return low;\n    }\n\n    /**\n     * Creates an array of unique values, in order, of the provided arrays using\n     * strict equality for comparisons, i.e. `===`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {...Array} [array] The arrays to inspect.\n     * @returns {Array} Returns an array of combined values.\n     * @example\n     *\n     * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);\n     * // => [1, 2, 3, 5, 4]\n     */\n    function union() {\n      return baseUniq(baseFlatten(arguments, true, true));\n    }\n\n    /**\n     * Creates a duplicate-value-free version of an array using strict equality\n     * for comparisons, i.e. `===`. If the array is sorted, providing\n     * `true` for `isSorted` will use a faster algorithm. If a callback is provided\n     * each element of `array` is passed through the callback before uniqueness\n     * is computed. The callback is bound to `thisArg` and invoked with three\n     * arguments; (value, index, array).\n     *\n     * If a property name is provided for `callback` the created \"_.pluck\" style\n     * callback will return the property value of the given element.\n     *\n     * If an object is provided for `callback` the created \"_.where\" style callback\n     * will return `true` for elements that have the properties of the given object,\n     * else `false`.\n     *\n     * @static\n     * @memberOf _\n     * @alias unique\n     * @category Arrays\n     * @param {Array} array The array to process.\n     * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.\n     * @param {Function|Object|string} [callback=identity] The function called\n     *  per iteration. If a property name or object is provided it will be used\n     *  to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns a duplicate-value-free array.\n     * @example\n     *\n     * _.uniq([1, 2, 1, 3, 1]);\n     * // => [1, 2, 3]\n     *\n     * _.uniq([1, 1, 2, 2, 3], true);\n     * // => [1, 2, 3]\n     *\n     * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });\n     * // => ['A', 'b', 'C']\n     *\n     * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);\n     * // => [1, 2.5, 3]\n     *\n     * // using \"_.pluck\" callback shorthand\n     * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n     * // => [{ 'x': 1 }, { 'x': 2 }]\n     */\n    function uniq(array, isSorted, callback, thisArg) {\n      // juggle arguments\n      if (typeof isSorted != 'boolean' && isSorted != null) {\n        thisArg = callback;\n        callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted;\n        isSorted = false;\n      }\n      if (callback != null) {\n        callback = lodash.createCallback(callback, thisArg, 3);\n      }\n      return baseUniq(array, isSorted, callback);\n    }\n\n    /**\n     * Creates an array excluding all provided values using strict equality for\n     * comparisons, i.e. `===`.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {Array} array The array to filter.\n     * @param {...*} [value] The values to exclude.\n     * @returns {Array} Returns a new array of filtered values.\n     * @example\n     *\n     * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);\n     * // => [2, 3, 4]\n     */\n    function without(array) {\n      return baseDifference(array, slice(arguments, 1));\n    }\n\n    /**\n     * Creates an array that is the symmetric difference of the provided arrays.\n     * See http://en.wikipedia.org/wiki/Symmetric_difference.\n     *\n     * @static\n     * @memberOf _\n     * @category Arrays\n     * @param {...Array} [array] The arrays to inspect.\n     * @returns {Array} Returns an array of values.\n     * @example\n     *\n     * _.xor([1, 2, 3], [5, 2, 1, 4]);\n     * // => [3, 5, 4]\n     *\n     * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]);\n     * // => [1, 4, 5]\n     */\n    function xor() {\n      var index = -1,\n          length = arguments.length;\n\n      while (++index < length) {\n        var array = arguments[index];\n        if (isArray(array) || isArguments(array)) {\n          var result = result\n            ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result)))\n            : array;\n        }\n      }\n      return result || [];\n    }\n\n    /**\n     * Creates an array of grouped elements, the first of which contains the first\n     * elements of the given arrays, the second of which contains the second\n     * elements of the given arrays, and so on.\n     *\n     * @static\n     * @memberOf _\n     * @alias unzip\n     * @category Arrays\n     * @param {...Array} [array] Arrays to process.\n     * @returns {Array} Returns a new array of grouped elements.\n     * @example\n     *\n     * _.zip(['fred', 'barney'], [30, 40], [true, false]);\n     * // => [['fred', 30, true], ['barney', 40, false]]\n     */\n    function zip() {\n      var array = arguments.length > 1 ? arguments : arguments[0],\n          index = -1,\n          length = array ? max(pluck(array, 'length')) : 0,\n          result = Array(length < 0 ? 0 : length);\n\n      while (++index < length) {\n        result[index] = pluck(array, index);\n      }\n      return result;\n    }\n\n    /**\n     * Creates an object composed from arrays of `keys` and `values`. Provide\n     * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`\n     * or two arrays, one of `keys` and one of corresponding `values`.\n     *\n     * @static\n     * @memberOf _\n     * @alias object\n     * @category Arrays\n     * @param {Array} keys The array of keys.\n     * @param {Array} [values=[]] The array of values.\n     * @returns {Object} Returns an object composed of the given keys and\n     *  corresponding values.\n     * @example\n     *\n     * _.zipObject(['fred', 'barney'], [30, 40]);\n     * // => { 'fred': 30, 'barney': 40 }\n     */\n    function zipObject(keys, values) {\n      var index = -1,\n          length = keys ? keys.length : 0,\n          result = {};\n\n      if (!values && length && !isArray(keys[0])) {\n        values = [];\n      }\n      while (++index < length) {\n        var key = keys[index];\n        if (values) {\n          result[key] = values[index];\n        } else if (key) {\n          result[key[0]] = key[1];\n        }\n      }\n      return result;\n    }\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * Creates a function that executes `func`, with  the `this` binding and\n     * arguments of the created function, only after being called `n` times.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {number} n The number of times the function must be called before\n     *  `func` is executed.\n     * @param {Function} func The function to restrict.\n     * @returns {Function} Returns the new restricted function.\n     * @example\n     *\n     * var saves = ['profile', 'settings'];\n     *\n     * var done = _.after(saves.length, function() {\n     *   console.log('Done saving!');\n     * });\n     *\n     * _.forEach(saves, function(type) {\n     *   asyncSave({ 'type': type, 'complete': done });\n     * });\n     * // => logs 'Done saving!', after all saves have completed\n     */\n    function after(n, func) {\n      if (!isFunction(func)) {\n        throw new TypeError;\n      }\n      return function() {\n        if (--n < 1) {\n          return func.apply(this, arguments);\n        }\n      };\n    }\n\n    /**\n     * Creates a function that, when called, invokes `func` with the `this`\n     * binding of `thisArg` and prepends any additional `bind` arguments to those\n     * provided to the bound function.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to bind.\n     * @param {*} [thisArg] The `this` binding of `func`.\n     * @param {...*} [arg] Arguments to be partially applied.\n     * @returns {Function} Returns the new bound function.\n     * @example\n     *\n     * var func = function(greeting) {\n     *   return greeting + ' ' + this.name;\n     * };\n     *\n     * func = _.bind(func, { 'name': 'fred' }, 'hi');\n     * func();\n     * // => 'hi fred'\n     */\n    function bind(func, thisArg) {\n      return arguments.length > 2\n        ? createWrapper(func, 17, slice(arguments, 2), null, thisArg)\n        : createWrapper(func, 1, null, null, thisArg);\n    }\n\n    /**\n     * Binds methods of an object to the object itself, overwriting the existing\n     * method. Method names may be specified as individual arguments or as arrays\n     * of method names. If no method names are provided all the function properties\n     * of `object` will be bound.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Object} object The object to bind and assign the bound methods to.\n     * @param {...string} [methodName] The object method names to\n     *  bind, specified as individual method names or arrays of method names.\n     * @returns {Object} Returns `object`.\n     * @example\n     *\n     * var view = {\n     *   'label': 'docs',\n     *   'onClick': function() { console.log('clicked ' + this.label); }\n     * };\n     *\n     * _.bindAll(view);\n     * jQuery('#docs').on('click', view.onClick);\n     * // => logs 'clicked docs', when the button is clicked\n     */\n    function bindAll(object) {\n      var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object),\n          index = -1,\n          length = funcs.length;\n\n      while (++index < length) {\n        var key = funcs[index];\n        object[key] = createWrapper(object[key], 1, null, null, object);\n      }\n      return object;\n    }\n\n    /**\n     * Creates a function that, when called, invokes the method at `object[key]`\n     * and prepends any additional `bindKey` arguments to those provided to the bound\n     * function. This method differs from `_.bind` by allowing bound functions to\n     * reference methods that will be redefined or don't yet exist.\n     * See http://michaux.ca/articles/lazy-function-definition-pattern.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Object} object The object the method belongs to.\n     * @param {string} key The key of the method.\n     * @param {...*} [arg] Arguments to be partially applied.\n     * @returns {Function} Returns the new bound function.\n     * @example\n     *\n     * var object = {\n     *   'name': 'fred',\n     *   'greet': function(greeting) {\n     *     return greeting + ' ' + this.name;\n     *   }\n     * };\n     *\n     * var func = _.bindKey(object, 'greet', 'hi');\n     * func();\n     * // => 'hi fred'\n     *\n     * object.greet = function(greeting) {\n     *   return greeting + 'ya ' + this.name + '!';\n     * };\n     *\n     * func();\n     * // => 'hiya fred!'\n     */\n    function bindKey(object, key) {\n      return arguments.length > 2\n        ? createWrapper(key, 19, slice(arguments, 2), null, object)\n        : createWrapper(key, 3, null, null, object);\n    }\n\n    /**\n     * Creates a function that is the composition of the provided functions,\n     * where each function consumes the return value of the function that follows.\n     * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.\n     * Each function is executed with the `this` binding of the composed function.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {...Function} [func] Functions to compose.\n     * @returns {Function} Returns the new composed function.\n     * @example\n     *\n     * var realNameMap = {\n     *   'pebbles': 'penelope'\n     * };\n     *\n     * var format = function(name) {\n     *   name = realNameMap[name.toLowerCase()] || name;\n     *   return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();\n     * };\n     *\n     * var greet = function(formatted) {\n     *   return 'Hiya ' + formatted + '!';\n     * };\n     *\n     * var welcome = _.compose(greet, format);\n     * welcome('pebbles');\n     * // => 'Hiya Penelope!'\n     */\n    function compose() {\n      var funcs = arguments,\n          length = funcs.length;\n\n      while (length--) {\n        if (!isFunction(funcs[length])) {\n          throw new TypeError;\n        }\n      }\n      return function() {\n        var args = arguments,\n            length = funcs.length;\n\n        while (length--) {\n          args = [funcs[length].apply(this, args)];\n        }\n        return args[0];\n      };\n    }\n\n    /**\n     * Creates a function which accepts one or more arguments of `func` that when\n     * invoked either executes `func` returning its result, if all `func` arguments\n     * have been provided, or returns a function that accepts one or more of the\n     * remaining `func` arguments, and so on. The arity of `func` can be specified\n     * if `func.length` is not sufficient.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to curry.\n     * @param {number} [arity=func.length] The arity of `func`.\n     * @returns {Function} Returns the new curried function.\n     * @example\n     *\n     * var curried = _.curry(function(a, b, c) {\n     *   console.log(a + b + c);\n     * });\n     *\n     * curried(1)(2)(3);\n     * // => 6\n     *\n     * curried(1, 2)(3);\n     * // => 6\n     *\n     * curried(1, 2, 3);\n     * // => 6\n     */\n    function curry(func, arity) {\n      arity = typeof arity == 'number' ? arity : (+arity || func.length);\n      return createWrapper(func, 4, null, null, null, arity);\n    }\n\n    /**\n     * Creates a function that will delay the execution of `func` until after\n     * `wait` milliseconds have elapsed since the last time it was invoked.\n     * Provide an options object to indicate that `func` should be invoked on\n     * the leading and/or trailing edge of the `wait` timeout. Subsequent calls\n     * to the debounced function will return the result of the last `func` call.\n     *\n     * Note: If `leading` and `trailing` options are `true` `func` will be called\n     * on the trailing edge of the timeout only if the the debounced function is\n     * invoked more than once during the `wait` timeout.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to debounce.\n     * @param {number} wait The number of milliseconds to delay.\n     * @param {Object} [options] The options object.\n     * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout.\n     * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called.\n     * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.\n     * @returns {Function} Returns the new debounced function.\n     * @example\n     *\n     * // avoid costly calculations while the window size is in flux\n     * var lazyLayout = _.debounce(calculateLayout, 150);\n     * jQuery(window).on('resize', lazyLayout);\n     *\n     * // execute `sendMail` when the click event is fired, debouncing subsequent calls\n     * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {\n     *   'leading': true,\n     *   'trailing': false\n     * });\n     *\n     * // ensure `batchLog` is executed once after 1 second of debounced calls\n     * var source = new EventSource('/stream');\n     * source.addEventListener('message', _.debounce(batchLog, 250, {\n     *   'maxWait': 1000\n     * }, false);\n     */\n    function debounce(func, wait, options) {\n      var args,\n          maxTimeoutId,\n          result,\n          stamp,\n          thisArg,\n          timeoutId,\n          trailingCall,\n          lastCalled = 0,\n          maxWait = false,\n          trailing = true;\n\n      if (!isFunction(func)) {\n        throw new TypeError;\n      }\n      wait = nativeMax(0, wait) || 0;\n      if (options === true) {\n        var leading = true;\n        trailing = false;\n      } else if (isObject(options)) {\n        leading = options.leading;\n        maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0);\n        trailing = 'trailing' in options ? options.trailing : trailing;\n      }\n      var delayed = function() {\n        var remaining = wait - (now() - stamp);\n        if (remaining <= 0) {\n          if (maxTimeoutId) {\n            clearTimeout(maxTimeoutId);\n          }\n          var isCalled = trailingCall;\n          maxTimeoutId = timeoutId = trailingCall = undefined;\n          if (isCalled) {\n            lastCalled = now();\n            result = func.apply(thisArg, args);\n            if (!timeoutId && !maxTimeoutId) {\n              args = thisArg = null;\n            }\n          }\n        } else {\n          timeoutId = setTimeout(delayed, remaining);\n        }\n      };\n\n      var maxDelayed = function() {\n        if (timeoutId) {\n          clearTimeout(timeoutId);\n        }\n        maxTimeoutId = timeoutId = trailingCall = undefined;\n        if (trailing || (maxWait !== wait)) {\n          lastCalled = now();\n          result = func.apply(thisArg, args);\n          if (!timeoutId && !maxTimeoutId) {\n            args = thisArg = null;\n          }\n        }\n      };\n\n      return function() {\n        args = arguments;\n        stamp = now();\n        thisArg = this;\n        trailingCall = trailing && (timeoutId || !leading);\n\n        if (maxWait === false) {\n          var leadingCall = leading && !timeoutId;\n        } else {\n          if (!maxTimeoutId && !leading) {\n            lastCalled = stamp;\n          }\n          var remaining = maxWait - (stamp - lastCalled),\n              isCalled = remaining <= 0;\n\n          if (isCalled) {\n            if (maxTimeoutId) {\n              maxTimeoutId = clearTimeout(maxTimeoutId);\n            }\n            lastCalled = stamp;\n            result = func.apply(thisArg, args);\n          }\n          else if (!maxTimeoutId) {\n            maxTimeoutId = setTimeout(maxDelayed, remaining);\n          }\n        }\n        if (isCalled && timeoutId) {\n          timeoutId = clearTimeout(timeoutId);\n        }\n        else if (!timeoutId && wait !== maxWait) {\n          timeoutId = setTimeout(delayed, wait);\n        }\n        if (leadingCall) {\n          isCalled = true;\n          result = func.apply(thisArg, args);\n        }\n        if (isCalled && !timeoutId && !maxTimeoutId) {\n          args = thisArg = null;\n        }\n        return result;\n      };\n    }\n\n    /**\n     * Defers executing the `func` function until the current call stack has cleared.\n     * Additional arguments will be provided to `func` when it is invoked.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to defer.\n     * @param {...*} [arg] Arguments to invoke the function with.\n     * @returns {number} Returns the timer id.\n     * @example\n     *\n     * _.defer(function(text) { console.log(text); }, 'deferred');\n     * // logs 'deferred' after one or more milliseconds\n     */\n    function defer(func) {\n      if (!isFunction(func)) {\n        throw new TypeError;\n      }\n      var args = slice(arguments, 1);\n      return setTimeout(function() { func.apply(undefined, args); }, 1);\n    }\n\n    /**\n     * Executes the `func` function after `wait` milliseconds. Additional arguments\n     * will be provided to `func` when it is invoked.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to delay.\n     * @param {number} wait The number of milliseconds to delay execution.\n     * @param {...*} [arg] Arguments to invoke the function with.\n     * @returns {number} Returns the timer id.\n     * @example\n     *\n     * _.delay(function(text) { console.log(text); }, 1000, 'later');\n     * // => logs 'later' after one second\n     */\n    function delay(func, wait) {\n      if (!isFunction(func)) {\n        throw new TypeError;\n      }\n      var args = slice(arguments, 2);\n      return setTimeout(function() { func.apply(undefined, args); }, wait);\n    }\n\n    /**\n     * Creates a function that memoizes the result of `func`. If `resolver` is\n     * provided it will be used to determine the cache key for storing the result\n     * based on the arguments provided to the memoized function. By default, the\n     * first argument provided to the memoized function is used as the cache key.\n     * The `func` is executed with the `this` binding of the memoized function.\n     * The result cache is exposed as the `cache` property on the memoized function.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to have its output memoized.\n     * @param {Function} [resolver] A function used to resolve the cache key.\n     * @returns {Function} Returns the new memoizing function.\n     * @example\n     *\n     * var fibonacci = _.memoize(function(n) {\n     *   return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n     * });\n     *\n     * fibonacci(9)\n     * // => 34\n     *\n     * var data = {\n     *   'fred': { 'name': 'fred', 'age': 40 },\n     *   'pebbles': { 'name': 'pebbles', 'age': 1 }\n     * };\n     *\n     * // modifying the result cache\n     * var get = _.memoize(function(name) { return data[name]; }, _.identity);\n     * get('pebbles');\n     * // => { 'name': 'pebbles', 'age': 1 }\n     *\n     * get.cache.pebbles.name = 'penelope';\n     * get('pebbles');\n     * // => { 'name': 'penelope', 'age': 1 }\n     */\n    function memoize(func, resolver) {\n      if (!isFunction(func)) {\n        throw new TypeError;\n      }\n      var memoized = function() {\n        var cache = memoized.cache,\n            key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0];\n\n        return hasOwnProperty.call(cache, key)\n          ? cache[key]\n          : (cache[key] = func.apply(this, arguments));\n      }\n      memoized.cache = {};\n      return memoized;\n    }\n\n    /**\n     * Creates a function that is restricted to execute `func` once. Repeat calls to\n     * the function will return the value of the first call. The `func` is executed\n     * with the `this` binding of the created function.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to restrict.\n     * @returns {Function} Returns the new restricted function.\n     * @example\n     *\n     * var initialize = _.once(createApplication);\n     * initialize();\n     * initialize();\n     * // `initialize` executes `createApplication` once\n     */\n    function once(func) {\n      var ran,\n          result;\n\n      if (!isFunction(func)) {\n        throw new TypeError;\n      }\n      return function() {\n        if (ran) {\n          return result;\n        }\n        ran = true;\n        result = func.apply(this, arguments);\n\n        // clear the `func` variable so the function may be garbage collected\n        func = null;\n        return result;\n      };\n    }\n\n    /**\n     * Creates a function that, when called, invokes `func` with any additional\n     * `partial` arguments prepended to those provided to the new function. This\n     * method is similar to `_.bind` except it does **not** alter the `this` binding.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to partially apply arguments to.\n     * @param {...*} [arg] Arguments to be partially applied.\n     * @returns {Function} Returns the new partially applied function.\n     * @example\n     *\n     * var greet = function(greeting, name) { return greeting + ' ' + name; };\n     * var hi = _.partial(greet, 'hi');\n     * hi('fred');\n     * // => 'hi fred'\n     */\n    function partial(func) {\n      return createWrapper(func, 16, slice(arguments, 1));\n    }\n\n    /**\n     * This method is like `_.partial` except that `partial` arguments are\n     * appended to those provided to the new function.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to partially apply arguments to.\n     * @param {...*} [arg] Arguments to be partially applied.\n     * @returns {Function} Returns the new partially applied function.\n     * @example\n     *\n     * var defaultsDeep = _.partialRight(_.merge, _.defaults);\n     *\n     * var options = {\n     *   'variable': 'data',\n     *   'imports': { 'jq': $ }\n     * };\n     *\n     * defaultsDeep(options, _.templateSettings);\n     *\n     * options.variable\n     * // => 'data'\n     *\n     * options.imports\n     * // => { '_': _, 'jq': $ }\n     */\n    function partialRight(func) {\n      return createWrapper(func, 32, null, slice(arguments, 1));\n    }\n\n    /**\n     * Creates a function that, when executed, will only call the `func` function\n     * at most once per every `wait` milliseconds. Provide an options object to\n     * indicate that `func` should be invoked on the leading and/or trailing edge\n     * of the `wait` timeout. Subsequent calls to the throttled function will\n     * return the result of the last `func` call.\n     *\n     * Note: If `leading` and `trailing` options are `true` `func` will be called\n     * on the trailing edge of the timeout only if the the throttled function is\n     * invoked more than once during the `wait` timeout.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {Function} func The function to throttle.\n     * @param {number} wait The number of milliseconds to throttle executions to.\n     * @param {Object} [options] The options object.\n     * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout.\n     * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.\n     * @returns {Function} Returns the new throttled function.\n     * @example\n     *\n     * // avoid excessively updating the position while scrolling\n     * var throttled = _.throttle(updatePosition, 100);\n     * jQuery(window).on('scroll', throttled);\n     *\n     * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes\n     * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {\n     *   'trailing': false\n     * }));\n     */\n    function throttle(func, wait, options) {\n      var leading = true,\n          trailing = true;\n\n      if (!isFunction(func)) {\n        throw new TypeError;\n      }\n      if (options === false) {\n        leading = false;\n      } else if (isObject(options)) {\n        leading = 'leading' in options ? options.leading : leading;\n        trailing = 'trailing' in options ? options.trailing : trailing;\n      }\n      debounceOptions.leading = leading;\n      debounceOptions.maxWait = wait;\n      debounceOptions.trailing = trailing;\n\n      return debounce(func, wait, debounceOptions);\n    }\n\n    /**\n     * Creates a function that provides `value` to the wrapper function as its\n     * first argument. Additional arguments provided to the function are appended\n     * to those provided to the wrapper function. The wrapper is executed with\n     * the `this` binding of the created function.\n     *\n     * @static\n     * @memberOf _\n     * @category Functions\n     * @param {*} value The value to wrap.\n     * @param {Function} wrapper The wrapper function.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var p = _.wrap(_.escape, function(func, text) {\n     *   return '<p>' + func(text) + '</p>';\n     * });\n     *\n     * p('Fred, Wilma, & Pebbles');\n     * // => '<p>Fred, Wilma, &amp; Pebbles</p>'\n     */\n    function wrap(value, wrapper) {\n      return createWrapper(wrapper, 16, [value]);\n    }\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * Creates a function that returns `value`.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {*} value The value to return from the new function.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var object = { 'name': 'fred' };\n     * var getter = _.constant(object);\n     * getter() === object;\n     * // => true\n     */\n    function constant(value) {\n      return function() {\n        return value;\n      };\n    }\n\n    /**\n     * Produces a callback bound to an optional `thisArg`. If `func` is a property\n     * name the created callback will return the property value for a given element.\n     * If `func` is an object the created callback will return `true` for elements\n     * that contain the equivalent object properties, otherwise it will return `false`.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {*} [func=identity] The value to convert to a callback.\n     * @param {*} [thisArg] The `this` binding of the created callback.\n     * @param {number} [argCount] The number of arguments the callback accepts.\n     * @returns {Function} Returns a callback function.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * // wrap to create custom callback shorthands\n     * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {\n     *   var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);\n     *   return !match ? func(callback, thisArg) : function(object) {\n     *     return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];\n     *   };\n     * });\n     *\n     * _.filter(characters, 'age__gt38');\n     * // => [{ 'name': 'fred', 'age': 40 }]\n     */\n    function createCallback(func, thisArg, argCount) {\n      var type = typeof func;\n      if (func == null || type == 'function') {\n        return baseCreateCallback(func, thisArg, argCount);\n      }\n      // handle \"_.pluck\" style callback shorthands\n      if (type != 'object') {\n        return property(func);\n      }\n      var props = keys(func),\n          key = props[0],\n          a = func[key];\n\n      // handle \"_.where\" style callback shorthands\n      if (props.length == 1 && a === a && !isObject(a)) {\n        // fast path the common case of providing an object with a single\n        // property containing a primitive value\n        return function(object) {\n          var b = object[key];\n          return a === b && (a !== 0 || (1 / a == 1 / b));\n        };\n      }\n      return function(object) {\n        var length = props.length,\n            result = false;\n\n        while (length--) {\n          if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) {\n            break;\n          }\n        }\n        return result;\n      };\n    }\n\n    /**\n     * Converts the characters `&`, `<`, `>`, `\"`, and `'` in `string` to their\n     * corresponding HTML entities.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {string} string The string to escape.\n     * @returns {string} Returns the escaped string.\n     * @example\n     *\n     * _.escape('Fred, Wilma, & Pebbles');\n     * // => 'Fred, Wilma, &amp; Pebbles'\n     */\n    function escape(string) {\n      return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);\n    }\n\n    /**\n     * This method returns the first argument provided to it.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {*} value Any value.\n     * @returns {*} Returns `value`.\n     * @example\n     *\n     * var object = { 'name': 'fred' };\n     * _.identity(object) === object;\n     * // => true\n     */\n    function identity(value) {\n      return value;\n    }\n\n    /**\n     * Adds function properties of a source object to the destination object.\n     * If `object` is a function methods will be added to its prototype as well.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {Function|Object} [object=lodash] object The destination object.\n     * @param {Object} source The object of functions to add.\n     * @param {Object} [options] The options object.\n     * @param {boolean} [options.chain=true] Specify whether the functions added are chainable.\n     * @example\n     *\n     * function capitalize(string) {\n     *   return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();\n     * }\n     *\n     * _.mixin({ 'capitalize': capitalize });\n     * _.capitalize('fred');\n     * // => 'Fred'\n     *\n     * _('fred').capitalize().value();\n     * // => 'Fred'\n     *\n     * _.mixin({ 'capitalize': capitalize }, { 'chain': false });\n     * _('fred').capitalize();\n     * // => 'Fred'\n     */\n    function mixin(object, source, options) {\n      var chain = true,\n          methodNames = source && functions(source);\n\n      if (!source || (!options && !methodNames.length)) {\n        if (options == null) {\n          options = source;\n        }\n        ctor = lodashWrapper;\n        source = object;\n        object = lodash;\n        methodNames = functions(source);\n      }\n      if (options === false) {\n        chain = false;\n      } else if (isObject(options) && 'chain' in options) {\n        chain = options.chain;\n      }\n      var ctor = object,\n          isFunc = isFunction(ctor);\n\n      forEach(methodNames, function(methodName) {\n        var func = object[methodName] = source[methodName];\n        if (isFunc) {\n          ctor.prototype[methodName] = function() {\n            var chainAll = this.__chain__,\n                value = this.__wrapped__,\n                args = [value];\n\n            push.apply(args, arguments);\n            var result = func.apply(object, args);\n            if (chain || chainAll) {\n              if (value === result && isObject(result)) {\n                return this;\n              }\n              result = new ctor(result);\n              result.__chain__ = chainAll;\n            }\n            return result;\n          };\n        }\n      });\n    }\n\n    /**\n     * Reverts the '_' variable to its previous value and returns a reference to\n     * the `lodash` function.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @returns {Function} Returns the `lodash` function.\n     * @example\n     *\n     * var lodash = _.noConflict();\n     */\n    function noConflict() {\n      context._ = oldDash;\n      return this;\n    }\n\n    /**\n     * A no-operation function.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @example\n     *\n     * var object = { 'name': 'fred' };\n     * _.noop(object) === undefined;\n     * // => true\n     */\n    function noop() {\n      // no operation performed\n    }\n\n    /**\n     * Gets the number of milliseconds that have elapsed since the Unix epoch\n     * (1 January 1970 00:00:00 UTC).\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @example\n     *\n     * var stamp = _.now();\n     * _.defer(function() { console.log(_.now() - stamp); });\n     * // => logs the number of milliseconds it took for the deferred function to be called\n     */\n    var now = isNative(now = Date.now) && now || function() {\n      return new Date().getTime();\n    };\n\n    /**\n     * Converts the given value into an integer of the specified radix.\n     * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the\n     * `value` is a hexadecimal, in which case a `radix` of `16` is used.\n     *\n     * Note: This method avoids differences in native ES3 and ES5 `parseInt`\n     * implementations. See http://es5.github.io/#E.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {string} value The value to parse.\n     * @param {number} [radix] The radix used to interpret the value to parse.\n     * @returns {number} Returns the new integer value.\n     * @example\n     *\n     * _.parseInt('08');\n     * // => 8\n     */\n    var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) {\n      // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt`\n      return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0);\n    };\n\n    /**\n     * Creates a \"_.pluck\" style function, which returns the `key` value of a\n     * given object.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {string} key The name of the property to retrieve.\n     * @returns {Function} Returns the new function.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'fred',   'age': 40 },\n     *   { 'name': 'barney', 'age': 36 }\n     * ];\n     *\n     * var getName = _.property('name');\n     *\n     * _.map(characters, getName);\n     * // => ['barney', 'fred']\n     *\n     * _.sortBy(characters, getName);\n     * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred',   'age': 40 }]\n     */\n    function property(key) {\n      return function(object) {\n        return object[key];\n      };\n    }\n\n    /**\n     * Produces a random number between `min` and `max` (inclusive). If only one\n     * argument is provided a number between `0` and the given number will be\n     * returned. If `floating` is truey or either `min` or `max` are floats a\n     * floating-point number will be returned instead of an integer.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {number} [min=0] The minimum possible value.\n     * @param {number} [max=1] The maximum possible value.\n     * @param {boolean} [floating=false] Specify returning a floating-point number.\n     * @returns {number} Returns a random number.\n     * @example\n     *\n     * _.random(0, 5);\n     * // => an integer between 0 and 5\n     *\n     * _.random(5);\n     * // => also an integer between 0 and 5\n     *\n     * _.random(5, true);\n     * // => a floating-point number between 0 and 5\n     *\n     * _.random(1.2, 5.2);\n     * // => a floating-point number between 1.2 and 5.2\n     */\n    function random(min, max, floating) {\n      var noMin = min == null,\n          noMax = max == null;\n\n      if (floating == null) {\n        if (typeof min == 'boolean' && noMax) {\n          floating = min;\n          min = 1;\n        }\n        else if (!noMax && typeof max == 'boolean') {\n          floating = max;\n          noMax = true;\n        }\n      }\n      if (noMin && noMax) {\n        max = 1;\n      }\n      min = +min || 0;\n      if (noMax) {\n        max = min;\n        min = 0;\n      } else {\n        max = +max || 0;\n      }\n      if (floating || min % 1 || max % 1) {\n        var rand = nativeRandom();\n        return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max);\n      }\n      return baseRandom(min, max);\n    }\n\n    /**\n     * Resolves the value of property `key` on `object`. If `key` is a function\n     * it will be invoked with the `this` binding of `object` and its result returned,\n     * else the property value is returned. If `object` is falsey then `undefined`\n     * is returned.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {Object} object The object to inspect.\n     * @param {string} key The name of the property to resolve.\n     * @returns {*} Returns the resolved value.\n     * @example\n     *\n     * var object = {\n     *   'cheese': 'crumpets',\n     *   'stuff': function() {\n     *     return 'nonsense';\n     *   }\n     * };\n     *\n     * _.result(object, 'cheese');\n     * // => 'crumpets'\n     *\n     * _.result(object, 'stuff');\n     * // => 'nonsense'\n     */\n    function result(object, key) {\n      if (object) {\n        var value = object[key];\n        return isFunction(value) ? object[key]() : value;\n      }\n    }\n\n    /**\n     * A micro-templating method that handles arbitrary delimiters, preserves\n     * whitespace, and correctly escapes quotes within interpolated code.\n     *\n     * Note: In the development build, `_.template` utilizes sourceURLs for easier\n     * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl\n     *\n     * For more information on precompiling templates see:\n     * http://lodash.com/custom-builds\n     *\n     * For more information on Chrome extension sandboxes see:\n     * http://developer.chrome.com/stable/extensions/sandboxingEval.html\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {string} text The template text.\n     * @param {Object} data The data object used to populate the text.\n     * @param {Object} [options] The options object.\n     * @param {RegExp} [options.escape] The \"escape\" delimiter.\n     * @param {RegExp} [options.evaluate] The \"evaluate\" delimiter.\n     * @param {Object} [options.imports] An object to import into the template as local variables.\n     * @param {RegExp} [options.interpolate] The \"interpolate\" delimiter.\n     * @param {string} [sourceURL] The sourceURL of the template's compiled source.\n     * @param {string} [variable] The data object variable name.\n     * @returns {Function|string} Returns a compiled function when no `data` object\n     *  is given, else it returns the interpolated text.\n     * @example\n     *\n     * // using the \"interpolate\" delimiter to create a compiled template\n     * var compiled = _.template('hello <%= name %>');\n     * compiled({ 'name': 'fred' });\n     * // => 'hello fred'\n     *\n     * // using the \"escape\" delimiter to escape HTML in data property values\n     * _.template('<b><%- value %></b>', { 'value': '<script>' });\n     * // => '<b>&lt;script&gt;</b>'\n     *\n     * // using the \"evaluate\" delimiter to generate HTML\n     * var list = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>';\n     * _.template(list, { 'people': ['fred', 'barney'] });\n     * // => '<li>fred</li><li>barney</li>'\n     *\n     * // using the ES6 delimiter as an alternative to the default \"interpolate\" delimiter\n     * _.template('hello ${ name }', { 'name': 'pebbles' });\n     * // => 'hello pebbles'\n     *\n     * // using the internal `print` function in \"evaluate\" delimiters\n     * _.template('<% print(\"hello \" + name); %>!', { 'name': 'barney' });\n     * // => 'hello barney!'\n     *\n     * // using a custom template delimiters\n     * _.templateSettings = {\n     *   'interpolate': /{{([\\s\\S]+?)}}/g\n     * };\n     *\n     * _.template('hello {{ name }}!', { 'name': 'mustache' });\n     * // => 'hello mustache!'\n     *\n     * // using the `imports` option to import jQuery\n     * var list = '<% jq.each(people, function(name) { %><li><%- name %></li><% }); %>';\n     * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } });\n     * // => '<li>fred</li><li>barney</li>'\n     *\n     * // using the `sourceURL` option to specify a custom sourceURL for the template\n     * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });\n     * compiled(data);\n     * // => find the source of \"greeting.jst\" under the Sources tab or Resources panel of the web inspector\n     *\n     * // using the `variable` option to ensure a with-statement isn't used in the compiled template\n     * var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' });\n     * compiled.source;\n     * // => function(data) {\n     *   var __t, __p = '', __e = _.escape;\n     *   __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!';\n     *   return __p;\n     * }\n     *\n     * // using the `source` property to inline compiled templates for meaningful\n     * // line numbers in error messages and a stack trace\n     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\\\n     *   var JST = {\\\n     *     \"main\": ' + _.template(mainText).source + '\\\n     *   };\\\n     * ');\n     */\n    function template(text, data, options) {\n      // based on John Resig's `tmpl` implementation\n      // http://ejohn.org/blog/javascript-micro-templating/\n      // and Laura Doktorova's doT.js\n      // https://github.com/olado/doT\n      var settings = lodash.templateSettings;\n      text = String(text || '');\n\n      // avoid missing dependencies when `iteratorTemplate` is not defined\n      options = defaults({}, options, settings);\n\n      var imports = defaults({}, options.imports, settings.imports),\n          importsKeys = keys(imports),\n          importsValues = values(imports);\n\n      var isEvaluating,\n          index = 0,\n          interpolate = options.interpolate || reNoMatch,\n          source = \"__p += '\";\n\n      // compile the regexp to match each delimiter\n      var reDelimiters = RegExp(\n        (options.escape || reNoMatch).source + '|' +\n        interpolate.source + '|' +\n        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +\n        (options.evaluate || reNoMatch).source + '|$'\n      , 'g');\n\n      text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {\n        interpolateValue || (interpolateValue = esTemplateValue);\n\n        // escape characters that cannot be included in string literals\n        source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);\n\n        // replace delimiters with snippets\n        if (escapeValue) {\n          source += \"' +\\n__e(\" + escapeValue + \") +\\n'\";\n        }\n        if (evaluateValue) {\n          isEvaluating = true;\n          source += \"';\\n\" + evaluateValue + \";\\n__p += '\";\n        }\n        if (interpolateValue) {\n          source += \"' +\\n((__t = (\" + interpolateValue + \")) == null ? '' : __t) +\\n'\";\n        }\n        index = offset + match.length;\n\n        // the JS engine embedded in Adobe products requires returning the `match`\n        // string in order to produce the correct `offset` value\n        return match;\n      });\n\n      source += \"';\\n\";\n\n      // if `variable` is not specified, wrap a with-statement around the generated\n      // code to add the data object to the top of the scope chain\n      var variable = options.variable,\n          hasVariable = variable;\n\n      if (!hasVariable) {\n        variable = 'obj';\n        source = 'with (' + variable + ') {\\n' + source + '\\n}\\n';\n      }\n      // cleanup code by stripping empty strings\n      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)\n        .replace(reEmptyStringMiddle, '$1')\n        .replace(reEmptyStringTrailing, '$1;');\n\n      // frame code as the function body\n      source = 'function(' + variable + ') {\\n' +\n        (hasVariable ? '' : variable + ' || (' + variable + ' = {});\\n') +\n        \"var __t, __p = '', __e = _.escape\" +\n        (isEvaluating\n          ? ', __j = Array.prototype.join;\\n' +\n            \"function print() { __p += __j.call(arguments, '') }\\n\"\n          : ';\\n'\n        ) +\n        source +\n        'return __p\\n}';\n\n      // Use a sourceURL for easier debugging.\n      // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl\n      var sourceURL = '\\n/*\\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\\n*/';\n\n      try {\n        var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues);\n      } catch(e) {\n        e.source = source;\n        throw e;\n      }\n      if (data) {\n        return result(data);\n      }\n      // provide the compiled function's source by its `toString` method, in\n      // supported environments, or the `source` property as a convenience for\n      // inlining compiled templates during the build process\n      result.source = source;\n      return result;\n    }\n\n    /**\n     * Executes the callback `n` times, returning an array of the results\n     * of each callback execution. The callback is bound to `thisArg` and invoked\n     * with one argument; (index).\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {number} n The number of times to execute the callback.\n     * @param {Function} callback The function called per iteration.\n     * @param {*} [thisArg] The `this` binding of `callback`.\n     * @returns {Array} Returns an array of the results of each `callback` execution.\n     * @example\n     *\n     * var diceRolls = _.times(3, _.partial(_.random, 1, 6));\n     * // => [3, 6, 4]\n     *\n     * _.times(3, function(n) { mage.castSpell(n); });\n     * // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively\n     *\n     * _.times(3, function(n) { this.cast(n); }, mage);\n     * // => also calls `mage.castSpell(n)` three times\n     */\n    function times(n, callback, thisArg) {\n      n = (n = +n) > -1 ? n : 0;\n      var index = -1,\n          result = Array(n);\n\n      callback = baseCreateCallback(callback, thisArg, 1);\n      while (++index < n) {\n        result[index] = callback(index);\n      }\n      return result;\n    }\n\n    /**\n     * The inverse of `_.escape` this method converts the HTML entities\n     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their\n     * corresponding characters.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {string} string The string to unescape.\n     * @returns {string} Returns the unescaped string.\n     * @example\n     *\n     * _.unescape('Fred, Barney &amp; Pebbles');\n     * // => 'Fred, Barney & Pebbles'\n     */\n    function unescape(string) {\n      return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar);\n    }\n\n    /**\n     * Generates a unique ID. If `prefix` is provided the ID will be appended to it.\n     *\n     * @static\n     * @memberOf _\n     * @category Utilities\n     * @param {string} [prefix] The value to prefix the ID with.\n     * @returns {string} Returns the unique ID.\n     * @example\n     *\n     * _.uniqueId('contact_');\n     * // => 'contact_104'\n     *\n     * _.uniqueId();\n     * // => '105'\n     */\n    function uniqueId(prefix) {\n      var id = ++idCounter;\n      return String(prefix == null ? '' : prefix) + id;\n    }\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * Creates a `lodash` object that wraps the given value with explicit\n     * method chaining enabled.\n     *\n     * @static\n     * @memberOf _\n     * @category Chaining\n     * @param {*} value The value to wrap.\n     * @returns {Object} Returns the wrapper object.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney',  'age': 36 },\n     *   { 'name': 'fred',    'age': 40 },\n     *   { 'name': 'pebbles', 'age': 1 }\n     * ];\n     *\n     * var youngest = _.chain(characters)\n     *     .sortBy('age')\n     *     .map(function(chr) { return chr.name + ' is ' + chr.age; })\n     *     .first()\n     *     .value();\n     * // => 'pebbles is 1'\n     */\n    function chain(value) {\n      value = new lodashWrapper(value);\n      value.__chain__ = true;\n      return value;\n    }\n\n    /**\n     * Invokes `interceptor` with the `value` as the first argument and then\n     * returns `value`. The purpose of this method is to \"tap into\" a method\n     * chain in order to perform operations on intermediate results within\n     * the chain.\n     *\n     * @static\n     * @memberOf _\n     * @category Chaining\n     * @param {*} value The value to provide to `interceptor`.\n     * @param {Function} interceptor The function to invoke.\n     * @returns {*} Returns `value`.\n     * @example\n     *\n     * _([1, 2, 3, 4])\n     *  .tap(function(array) { array.pop(); })\n     *  .reverse()\n     *  .value();\n     * // => [3, 2, 1]\n     */\n    function tap(value, interceptor) {\n      interceptor(value);\n      return value;\n    }\n\n    /**\n     * Enables explicit method chaining on the wrapper object.\n     *\n     * @name chain\n     * @memberOf _\n     * @category Chaining\n     * @returns {*} Returns the wrapper object.\n     * @example\n     *\n     * var characters = [\n     *   { 'name': 'barney', 'age': 36 },\n     *   { 'name': 'fred',   'age': 40 }\n     * ];\n     *\n     * // without explicit chaining\n     * _(characters).first();\n     * // => { 'name': 'barney', 'age': 36 }\n     *\n     * // with explicit chaining\n     * _(characters).chain()\n     *   .first()\n     *   .pick('age')\n     *   .value();\n     * // => { 'age': 36 }\n     */\n    function wrapperChain() {\n      this.__chain__ = true;\n      return this;\n    }\n\n    /**\n     * Produces the `toString` result of the wrapped value.\n     *\n     * @name toString\n     * @memberOf _\n     * @category Chaining\n     * @returns {string} Returns the string result.\n     * @example\n     *\n     * _([1, 2, 3]).toString();\n     * // => '1,2,3'\n     */\n    function wrapperToString() {\n      return String(this.__wrapped__);\n    }\n\n    /**\n     * Extracts the wrapped value.\n     *\n     * @name valueOf\n     * @memberOf _\n     * @alias value\n     * @category Chaining\n     * @returns {*} Returns the wrapped value.\n     * @example\n     *\n     * _([1, 2, 3]).valueOf();\n     * // => [1, 2, 3]\n     */\n    function wrapperValueOf() {\n      return this.__wrapped__;\n    }\n\n    /*--------------------------------------------------------------------------*/\n\n    // add functions that return wrapped values when chaining\n    lodash.after = after;\n    lodash.assign = assign;\n    lodash.at = at;\n    lodash.bind = bind;\n    lodash.bindAll = bindAll;\n    lodash.bindKey = bindKey;\n    lodash.chain = chain;\n    lodash.compact = compact;\n    lodash.compose = compose;\n    lodash.constant = constant;\n    lodash.countBy = countBy;\n    lodash.create = create;\n    lodash.createCallback = createCallback;\n    lodash.curry = curry;\n    lodash.debounce = debounce;\n    lodash.defaults = defaults;\n    lodash.defer = defer;\n    lodash.delay = delay;\n    lodash.difference = difference;\n    lodash.filter = filter;\n    lodash.flatten = flatten;\n    lodash.forEach = forEach;\n    lodash.forEachRight = forEachRight;\n    lodash.forIn = forIn;\n    lodash.forInRight = forInRight;\n    lodash.forOwn = forOwn;\n    lodash.forOwnRight = forOwnRight;\n    lodash.functions = functions;\n    lodash.groupBy = groupBy;\n    lodash.indexBy = indexBy;\n    lodash.initial = initial;\n    lodash.intersection = intersection;\n    lodash.invert = invert;\n    lodash.invoke = invoke;\n    lodash.keys = keys;\n    lodash.map = map;\n    lodash.mapValues = mapValues;\n    lodash.max = max;\n    lodash.memoize = memoize;\n    lodash.merge = merge;\n    lodash.min = min;\n    lodash.omit = omit;\n    lodash.once = once;\n    lodash.pairs = pairs;\n    lodash.partial = partial;\n    lodash.partialRight = partialRight;\n    lodash.pick = pick;\n    lodash.pluck = pluck;\n    lodash.property = property;\n    lodash.pull = pull;\n    lodash.range = range;\n    lodash.reject = reject;\n    lodash.remove = remove;\n    lodash.rest = rest;\n    lodash.shuffle = shuffle;\n    lodash.sortBy = sortBy;\n    lodash.tap = tap;\n    lodash.throttle = throttle;\n    lodash.times = times;\n    lodash.toArray = toArray;\n    lodash.transform = transform;\n    lodash.union = union;\n    lodash.uniq = uniq;\n    lodash.values = values;\n    lodash.where = where;\n    lodash.without = without;\n    lodash.wrap = wrap;\n    lodash.xor = xor;\n    lodash.zip = zip;\n    lodash.zipObject = zipObject;\n\n    // add aliases\n    lodash.collect = map;\n    lodash.drop = rest;\n    lodash.each = forEach;\n    lodash.eachRight = forEachRight;\n    lodash.extend = assign;\n    lodash.methods = functions;\n    lodash.object = zipObject;\n    lodash.select = filter;\n    lodash.tail = rest;\n    lodash.unique = uniq;\n    lodash.unzip = zip;\n\n    // add functions to `lodash.prototype`\n    mixin(lodash);\n\n    /*--------------------------------------------------------------------------*/\n\n    // add functions that return unwrapped values when chaining\n    lodash.clone = clone;\n    lodash.cloneDeep = cloneDeep;\n    lodash.contains = contains;\n    lodash.escape = escape;\n    lodash.every = every;\n    lodash.find = find;\n    lodash.findIndex = findIndex;\n    lodash.findKey = findKey;\n    lodash.findLast = findLast;\n    lodash.findLastIndex = findLastIndex;\n    lodash.findLastKey = findLastKey;\n    lodash.has = has;\n    lodash.identity = identity;\n    lodash.indexOf = indexOf;\n    lodash.isArguments = isArguments;\n    lodash.isArray = isArray;\n    lodash.isBoolean = isBoolean;\n    lodash.isDate = isDate;\n    lodash.isElement = isElement;\n    lodash.isEmpty = isEmpty;\n    lodash.isEqual = isEqual;\n    lodash.isFinite = isFinite;\n    lodash.isFunction = isFunction;\n    lodash.isNaN = isNaN;\n    lodash.isNull = isNull;\n    lodash.isNumber = isNumber;\n    lodash.isObject = isObject;\n    lodash.isPlainObject = isPlainObject;\n    lodash.isRegExp = isRegExp;\n    lodash.isString = isString;\n    lodash.isUndefined = isUndefined;\n    lodash.lastIndexOf = lastIndexOf;\n    lodash.mixin = mixin;\n    lodash.noConflict = noConflict;\n    lodash.noop = noop;\n    lodash.now = now;\n    lodash.parseInt = parseInt;\n    lodash.random = random;\n    lodash.reduce = reduce;\n    lodash.reduceRight = reduceRight;\n    lodash.result = result;\n    lodash.runInContext = runInContext;\n    lodash.size = size;\n    lodash.some = some;\n    lodash.sortedIndex = sortedIndex;\n    lodash.template = template;\n    lodash.unescape = unescape;\n    lodash.uniqueId = uniqueId;\n\n    // add aliases\n    lodash.all = every;\n    lodash.any = some;\n    lodash.detect = find;\n    lodash.findWhere = find;\n    lodash.foldl = reduce;\n    lodash.foldr = reduceRight;\n    lodash.include = contains;\n    lodash.inject = reduce;\n\n    mixin(function() {\n      var source = {}\n      forOwn(lodash, function(func, methodName) {\n        if (!lodash.prototype[methodName]) {\n          source[methodName] = func;\n        }\n      });\n      return source;\n    }(), false);\n\n    /*--------------------------------------------------------------------------*/\n\n    // add functions capable of returning wrapped and unwrapped values when chaining\n    lodash.first = first;\n    lodash.last = last;\n    lodash.sample = sample;\n\n    // add aliases\n    lodash.take = first;\n    lodash.head = first;\n\n    forOwn(lodash, function(func, methodName) {\n      var callbackable = methodName !== 'sample';\n      if (!lodash.prototype[methodName]) {\n        lodash.prototype[methodName]= function(n, guard) {\n          var chainAll = this.__chain__,\n              result = func(this.__wrapped__, n, guard);\n\n          return !chainAll && (n == null || (guard && !(callbackable && typeof n == 'function')))\n            ? result\n            : new lodashWrapper(result, chainAll);\n        };\n      }\n    });\n\n    /*--------------------------------------------------------------------------*/\n\n    /**\n     * The semantic version number.\n     *\n     * @static\n     * @memberOf _\n     * @type string\n     */\n    lodash.VERSION = '2.4.1';\n\n    // add \"Chaining\" functions to the wrapper\n    lodash.prototype.chain = wrapperChain;\n    lodash.prototype.toString = wrapperToString;\n    lodash.prototype.value = wrapperValueOf;\n    lodash.prototype.valueOf = wrapperValueOf;\n\n    // add `Array` functions that return unwrapped values\n    forEach(['join', 'pop', 'shift'], function(methodName) {\n      var func = arrayRef[methodName];\n      lodash.prototype[methodName] = function() {\n        var chainAll = this.__chain__,\n            result = func.apply(this.__wrapped__, arguments);\n\n        return chainAll\n          ? new lodashWrapper(result, chainAll)\n          : result;\n      };\n    });\n\n    // add `Array` functions that return the existing wrapped value\n    forEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) {\n      var func = arrayRef[methodName];\n      lodash.prototype[methodName] = function() {\n        func.apply(this.__wrapped__, arguments);\n        return this;\n      };\n    });\n\n    // add `Array` functions that return new wrapped values\n    forEach(['concat', 'slice', 'splice'], function(methodName) {\n      var func = arrayRef[methodName];\n      lodash.prototype[methodName] = function() {\n        return new lodashWrapper(func.apply(this.__wrapped__, arguments), this.__chain__);\n      };\n    });\n\n    return lodash;\n  }\n\n  /*--------------------------------------------------------------------------*/\n\n  // expose Lo-Dash\n  var _ = runInContext();\n\n  // some AMD build optimizers like r.js check for condition patterns like the following:\n  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {\n    // Expose Lo-Dash to the global object even when an AMD loader is present in\n    // case Lo-Dash is loaded with a RequireJS shim config.\n    // See http://requirejs.org/docs/api.html#config-shim\n    root._ = _;\n\n    // define as an anonymous module so, through path mapping, it can be\n    // referenced as the \"underscore\" module\n    define(function() {\n      return _;\n    });\n  }\n  // check for `exports` after `define` in case a build optimizer adds an `exports` object\n  else if (freeExports && freeModule) {\n    // in Node.js or RingoJS\n    if (moduleExports) {\n      (freeModule.exports = _)._ = _;\n    }\n    // in Narwhal or Rhino -require\n    else {\n      freeExports._ = _;\n    }\n  }\n  else {\n    // in a browser or Rhino\n    root._ = _;\n  }\n}.call(this));\n\n}).call(this,typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],8:[function(_dereq_,module,exports){\n(function (global){\n'use strict';\n\nvar DEBUG = false; // enable lots of console logging (best used while isolating one test case)\n\nvar _     = _dereq_('lodash');\nvar md5   = _dereq_('MD5');\n\n/**\n * A mock that simulates Firebase operations for use in unit tests.\n *\n * ## Setup\n *\n *     // in windows\n *     <script src=\"lib/lodash.js\"></script> <!-- dependency -->\n *     <script src=\"lib/MockFirebase.js\"></script> <!-- the lib -->\n *     <script>\n *       // to override all calls to new Firebase:\n *       MockFirebase.override();\n *       // test units can be invoked now...\n *     </script>\n *\n *     // in node.js\n *     var Firebase = require('../lib/MockFirebase');\n *\n * ## Usage Examples\n *\n *     var fb = new MockFirebase('Mock://foo/bar');\n *     fb.on('value', function(snap) {\n  *        console.log(snap.val());\n  *     });\n *\n *     // do things async or synchronously, like fb.child('foo').set('bar')...\n *\n *     // trigger callbacks and event listeners\n *     fb.flush();\n *\n *     // spy on methods\n *     expect(fb.on.called).toBe(true);\n *\n * ## Trigger events automagically instead of calling flush()\n *\n *     var fb = new MockFirebase('Mock://hello/world');\n *     fb.autoFlush(1000); // triggers events after 1 second (asynchronous)\n *     fb.autoFlush(); // triggers events immediately (synchronous)\n *\n * ## Simulating Errors\n *\n *     var fb = new MockFirebase('Mock://fails/a/lot');\n *     fb.failNext('set', new Error('PERMISSION_DENIED'); // create an error to be invoked on the next set() op\n *     fb.set({foo: bar}, function(err) {\n *         // err.message === 'PERMISSION_DENIED'\n *     });\n *     fb.flush();\n *\n * ## Building with custom data\n *\n *     // change data for all mocks\n *     MockFirebase.DEFAULT_DATA = {foo: { bar: 'baz'}};\n *     var fb = new MockFirebase('Mock://foo');\n *     fb.once('value', function(snap) {\n *        snap.name(); // foo\n *        snap.val(); //  {bar: 'baz'}\n *     });\n *\n *     // customize for a single instance\n *     var fb = new MockFirebase('Mock://foo', {foo: 'bar'});\n *     fb.once('value', function(snap) {\n *        snap.name(); // foo\n *        snap.val(); //  'bar'\n *     });\n *\n * @param {string} [currentPath] use a relative path here or a url, all .child() calls will append to this\n * @param {Object} [data] specify the data in this Firebase instance (defaults to MockFirebase.DEFAULT_DATA)\n * @param {MockFirebase} [parent] for internal use\n * @param {string} [name] for internal use\n * @constructor\n */\nfunction MockFirebase(currentPath, data, parent, name) {\n  // represents the fake url\n  //todo should unwrap nested paths; Firebase\n  //todo accepts sub-paths, mock should too\n  this.currentPath = currentPath || 'Mock://';\n\n  // see failNext()\n  this.errs = {};\n\n  // used for setPriorty and moving records\n  this.priority = null;\n\n  // null for the root path\n  this.myName = parent? name : extractName(currentPath);\n\n  // see autoFlush() and flush()\n  this.flushDelay = parent? parent.flushDelay : false;\n  this.flushQueue = parent? parent.flushQueue : new FlushQueue();\n\n  // stores the listeners for various event types\n  this._events = { value: [], child_added: [], child_removed: [], child_changed: [], child_moved: [] };\n\n  // allows changes to be propagated between child/parent instances\n  this.parentRef = parent||null;\n  this.children = {};\n  if (parent) parent.children[this.name()] = this;\n\n  // stores sorted keys in data for priority ordering\n  this.sortedDataKeys = [];\n\n  // do not modify this directly, use set() and flush(true)\n  this.data = null;\n  this._dataChanged(_.cloneDeep(arguments.length > 1? data||null : MockFirebase.DEFAULT_DATA));\n\n  // stores the last auto id generated by push() for tests\n  this._lastAutoId = null;\n\n  // turn all our public methods into spies so they can be monitored for calls and return values\n  // see jasmine spies: https://github.com/pivotal/jasmine/wiki/Spies\n  // the Firebase constructor can be spied on using spyOn(window, 'Firebase') from within the test unit\n  for(var key in this) {\n    if( !key.match(/^_/) && typeof(this[key]) === 'function' ) {\n      spyFactory(this, key);\n    }\n  }\n}\n\nMockFirebase.prototype = {\n  /*****************************************************\n   * Test Unit tools (not part of Firebase API)\n   *****************************************************/\n\n  /**\n   * Invoke all the operations that have been queued thus far. If a numeric delay is specified, this\n   * occurs asynchronously. Otherwise, it is a synchronous event.\n   *\n   * This allows Firebase to be used in synchronous tests without waiting for async callbacks. It also\n   * provides a rudimentary mechanism for simulating locally cached data (events are triggered\n   * synchronously when you do on('value') or on('child_added') against locally cached data)\n   *\n   * If you call this multiple times with different delay values, you could invoke the events out\n   * of order; make sure that is your intention.\n   *\n   * This also affects all child and parent paths that were created using .child from the original\n   * MockFirebase instance; all events queued before a flush, regardless of the node level in hierarchy,\n   * are processed together. To make child and parent paths fire on a different timeline or out of order,\n   * check out splitFlushQueue() below.\n   *\n   * <code>\n   *   var fbRef = new MockFirebase();\n   *   var childRef = fbRef.child('a');\n   *   fbRef.update({a: 'foo'});\n   *   childRef.set('bar');\n   *   fbRef.flush(); // a === 'bar'\n   *\n   *   fbRef.update({a: 'foo'});\n   *   fbRef.flush(0); // async flush\n   *\n   *   childRef.set('bar');\n   *   childRef.flush(); // sync flush (could also do fbRef.flush()--same thing)\n   *   // after the async flush completes, a === 'foo'!\n   *   // the child_changed and value events also happen in reversed order\n   * </code>\n   *\n   * @param {boolean|int} [delay]\n   * @returns {MockFirebase}\n   */\n  flush: function(delay) {\n    this.flushQueue.flush(delay);\n    return this;\n  },\n\n  /**\n   * Automatically trigger a flush event after each operation. If a numeric delay is specified, this is an\n   * asynchronous event. If value is set to true, it is synchronous (flush is triggered immediately). Setting\n   * this to false disables autoFlush\n   *\n   * @param {int|boolean} [delay]\n   * @returns {MockFirebase}\n   */\n  autoFlush: function(delay){\n    if(_.isUndefined(delay)) { delay = true; }\n    if( this.flushDelay !== delay ) {\n      this.flushDelay = delay;\n      _.each(this.children, function(c) {\n        c.autoFlush(delay);\n      });\n      if( this.parentRef ) { this.parentRef.autoFlush(delay); }\n      if (delay !== false) this.flush(delay);\n    }\n    return this;\n  },\n\n  /**\n   * If we can't use fakeEvent() and we need to test events out of order, we can give a child its own flush queue\n   * so that calling flush() does not also trigger parent and siblings in the queue.\n   */\n  splitFlushQueue: function() {\n    this.flushQueue = new FlushQueue();\n  },\n\n  /**\n   * Restore the flush queue after using splitFlushQueue() so that child/sibling/parent queues are flushed in order.\n   */\n  joinFlushQueue: function() {\n    if( this.parent ) {\n      this.flushQueue = this.parent.flushQueue;\n    }\n  },\n\n  /**\n   * Simulate a failure by specifying that the next invocation of methodName should\n   * fail with the provided error.\n   *\n   * @param {String} methodName currently only supports `set`, `update`, `push` (with data) and `transaction`\n   * @param {String|Error} error\n   */\n  failNext: function(methodName, error) {\n    this.errs[methodName] = error;\n  },\n\n  /**\n   * Simulate a security error by cancelling any opened listeners on the given path\n   * and returning the error provided. If event/callback/context are provided, then\n   * only listeners exactly matching this signature (same rules as off()) will be cancelled.\n   *\n   * This also invokes off() on the events--they won't be notified of future changes.\n   *\n   * @param {String|Error} error\n   * @param {String} [event]\n   * @param {Function} [callback]\n   * @param {Object} [context]\n   */\n  forceCancel: function(error, event, callback, context) {\n    var self = this, events = self._events;\n    _.each(event? [event] : _.keys(events), function(eventType) {\n      var list = _.filter(events[eventType], function(parts) {\n        return !event || !callback || (callback === parts[0] && context === parts[1]);\n      });\n      _.each(list, function(parts) {\n        parts[2].call(parts[1], error);\n        self.off(event, callback, context);\n      });\n    });\n  },\n\n  /**\n   * Returns a copy of the current data\n   * @returns {*}\n   */\n  getData: function() {\n    return _.cloneDeep(this.data);\n  },\n\n  /**\n   * Returns keys from the data in this path\n   * @returns {Array}\n   */\n  getKeys: function() {\n    return this.sortedDataKeys.slice();\n  },\n\n  /**\n   * Returns the last automatically generated ID\n   * @returns {string|string|*}\n   */\n  getLastAutoId: function() {\n    return this._lastAutoId;\n  },\n\n  /**\n   * Generates a fake event that does not affect or derive from the actual data in this\n   * mock. Great for quick event handling tests that won't rely on longer-term consistency\n   * or for creating out-of-order networking conditions that are hard to produce\n   * using set/remove/setPriority\n   *\n   * @param {string} event\n   * @param {string} key\n   * @param data\n   * @param {string} [prevChild]\n   * @param [pri]\n   * @returns {MockFirebase}\n   */\n  fakeEvent: function(event, key, data, prevChild, pri) {\n    if (DEBUG) console.log('fakeEvent', event, this.toString(), key);\n    if( arguments.length < 5 ) { pri = null; }\n    if( arguments.length < 4 ) { prevChild = null; }\n    if( arguments.length < 3 ) { data = null; }\n    var self = this;\n    var ref = event==='value'? self : self.child(key);\n    var snap = makeSnap(ref, data, pri);\n    self._defer(function() {\n      _.each(self._events[event], function (parts) {\n        var fn = parts[0], context = parts[1];\n        if (_.contains(['child_added', 'child_moved'], event)) {\n          fn.call(context, snap, prevChild);\n        }\n        else {\n          fn.call(context, snap);\n        }\n      });\n    });\n    return this;\n  },\n\n  /*****************************************************\n   * Firebase API methods\n   *****************************************************/\n\n  toString: function() {\n    return this.currentPath;\n  },\n\n  child: function(childPath) {\n    if( !childPath ) { throw new Error('bad child path '+this.toString()); }\n    var parts = _.isArray(childPath)? childPath : childPath.split('/');\n    var childKey = parts.shift();\n    var child = this.children[childKey];\n    if( !child ) {\n      child = new MockFirebase(mergePaths(this.currentPath, childKey), this._childData(childKey), this, childKey);\n      this.children[child.name()] = child;\n    }\n    if( parts.length ) {\n      child = child.child(parts);\n    }\n    return child;\n  },\n\n  set: function(data, callback) {\n    var self = this;\n    var err = this._nextErr('set');\n    data = _.cloneDeep(data);\n    if (DEBUG) console.log('set called',this.toString(), data);\n    this._defer(function() {\n      if (DEBUG) console.log('set completed',self.toString(), data);\n      if( err === null ) {\n        self._dataChanged(data);\n      }\n      if (callback) callback(err);\n    });\n  },\n\n  update: function(changes, callback) {\n    if( !_.isObject(changes) ) {\n      throw new Error('First argument must be an object when calling $update');\n    }\n    var self = this;\n    var err = this._nextErr('update');\n    var base = this.getData();\n    var data = _.assign(_.isObject(base)? base : {}, changes);\n    if (DEBUG) console.log('update called', this.toString(), data);\n    this._defer(function() {\n      if (DEBUG) console.log('update flushed', self.toString(), data);\n      if( err === null ) {\n        self._dataChanged(data);\n      }\n      if (callback) callback(err);\n    });\n  },\n\n  setPriority: function(newPriority, callback) {\n    var self = this;\n    var err = this._nextErr('setPriority');\n    if (DEBUG) console.log('setPriority called', self.toString(), newPriority);\n    self._defer(function() {\n      if (DEBUG) console.log('setPriority flushed', self.toString(), newPriority);\n      self._priChanged(newPriority);\n      if (callback) callback(err);\n    });\n  },\n\n  setWithPriority: function(data, pri, callback) {\n    this.setPriority(pri);\n    this.set(data, callback);\n  },\n\n  name: function() {\n    return this.myName;\n  },\n\n  ref: function() {\n    return this;\n  },\n\n  parent: function() {\n    return this.parentRef;\n  },\n\n  root: function() {\n    var next = this;\n    while(next.parentRef) {\n      next = next.parentRef;\n    }\n    return next;\n  },\n\n  push: function(data, callback) {\n    var child = this.child(this._newAutoId());\n    var err = this._nextErr('push');\n    if( err ) { child.failNext('set', err); }\n    if( arguments.length && data !== null ) {\n      // currently, callback only invoked if child exists\n      child.set(data, callback);\n    }\n    return child;\n  },\n\n  once: function(event, callback, cancel, context) {\n    var self = this;\n    if( arguments.length === 3 && !_.isFunction(cancel) ) {\n      context = cancel;\n      cancel = function() {};\n    }\n    else if( arguments.length < 3 ) {\n      cancel = function() {};\n      context = null;\n    }\n    var err = this._nextErr('once');\n    if( err ) {\n      this._defer(function() {\n        cancel.call(context, err);\n      });\n    }\n    else {\n      var fn = function (snap) {\n        self.off(event, fn, context);\n        callback.call(context, snap);\n      };\n\n      this.on(event, fn, context);\n    }\n  },\n\n  remove: function(callback) {\n    var self = this;\n    var err = this._nextErr('remove');\n    if (DEBUG) console.log('remove called', this.toString());\n    this._defer(function() {\n      if (DEBUG) console.log('remove completed',self.toString());\n      if( err === null ) {\n        self._dataChanged(null);\n      }\n      if (callback) callback(err);\n    });\n    return this;\n  },\n\n  on: function(event, callback, cancel, context) {\n    if( arguments.length === 3 && !_.isFunction(cancel) ) {\n      context = cancel;\n      cancel = function() {};\n    }\n    else if( arguments.length < 3 ) {\n      cancel = function() {};\n    }\n\n    var err = this._nextErr('on');\n    if( err ) {\n      this._defer(function() {\n        cancel.call(context, err);\n      });\n    }\n    else {\n      var eventArr = [callback, context, cancel];\n      this._events[event].push(eventArr);\n      var self = this;\n      if( event === 'value' ) {\n        self._defer(function() {\n          // make sure off() wasn't called in the interim\n          if( self._events[event].indexOf(eventArr) > -1) {\n            callback.call(context, makeSnap(self, self.getData(), self.priority));\n          }\n        });\n      }\n      else if( event === 'child_added' ) {\n        self._defer(function() {\n          if( self._events[event].indexOf(eventArr) > -1) {\n            var prev = null;\n            _.each(self.sortedDataKeys, function (k) {\n              var child = self.child(k);\n              callback.call(context, makeSnap(child, child.getData(), child.priority), prev);\n              prev = k;\n            });\n          }\n        });\n      }\n    }\n  },\n\n  off: function(event, callback, context) {\n    if( !event ) {\n      for (var key in this._events)\n        if( this._events.hasOwnProperty(key) )\n          this.off(key);\n    }\n    else if( callback ) {\n      var list = this._events[event];\n      var newList = this._events[event] = [];\n      _.each(list, function(parts) {\n        if( parts[0] !== callback || parts[1] !== context ) {\n          newList.push(parts);\n        }\n      });\n    }\n    else {\n      this._events[event] = [];\n    }\n  },\n\n  transaction: function(valueFn, finishedFn, applyLocally) {\n    var self = this;\n    var valueSpy = spyFactory(valueFn, 'trxn:valueFn');\n    var finishedSpy = spyFactory(finishedFn, 'trxn:finishedFn');\n    this._defer(function() {\n      var err = self._nextErr('transaction');\n      // unlike most defer methods, self will use the value as it exists at the time\n      // the transaction is actually invoked, which is the eventual consistent value\n      // it would have in reality\n      var res = valueSpy(self.getData());\n      var newData = _.isUndefined(res) || err? self.getData() : res;\n      self._dataChanged(newData);\n      finishedSpy(err, err === null && !_.isUndefined(res), makeSnap(self, newData, self.priority));\n    });\n    return [valueSpy, finishedSpy, applyLocally];\n  },\n\n  /**\n   * If token is valid and parses, returns the contents of token as exected. If not, the error is returned.\n   * Does not change behavior in any way (since we don't really auth anywhere)\n   *\n   * @param {String} token\n   * @param {Function} [callback]\n   */\n  auth: function(token, callback) {\n    //todo invoke callback with the parsed token contents\n    if (callback) this._defer(callback);\n  },\n\n  /**\n   * Just a stub at this point.\n   * @param {int} limit\n   */\n  limit: function(limit) {\n    return new MockQuery(this).limit(limit);\n  },\n\n  startAt: function(priority, key) {\n    return new MockQuery(this).startAt(priority, key);\n  },\n\n  endAt: function(priority, key) {\n    return new MockQuery(this).endAt(priority, key);\n  },\n\n  /*****************************************************\n   * Private/internal methods\n   *****************************************************/\n\n  _childChanged: function(ref) {\n    var events = [];\n    var childKey = ref.name();\n    var data = ref.getData();\n    if (DEBUG) console.log('_childChanged', this.toString() + ' -> ' + childKey, data);\n    if( data === null ) {\n      this._removeChild(childKey, events);\n    }\n    else {\n      this._updateOrAdd(childKey, data, events);\n    }\n    this._triggerAll(events);\n  },\n\n  _dataChanged: function(unparsedData) {\n    var self = this;\n    var pri = getMeta(unparsedData, 'priority', self.priority);\n    var data = cleanData(unparsedData);\n    if( pri !== self.priority ) {\n      self._priChanged(pri);\n    }\n    if( !_.isEqual(data, self.data) ) {\n      if (DEBUG) console.log('_dataChanged', self.toString(), data);\n      var oldKeys = _.keys(self.data).sort();\n      var newKeys = _.keys(data).sort();\n      var keysToRemove = _.difference(oldKeys, newKeys);\n      var keysToChange = _.difference(newKeys, keysToRemove);\n      var events = [];\n\n      _.each(keysToRemove, function(key) {\n        self._removeChild(key, events);\n      });\n\n      if(!_.isObject(data)) {\n        events.push(false);\n        self.data = data;\n      }\n      else {\n        _.each(keysToChange, function(key) {\n          self._updateOrAdd(key, unparsedData[key], events);\n        });\n      }\n\n      // update order of my child keys\n      self._resort();\n\n      // trigger parent notifications after all children have\n      // been processed\n      self._triggerAll(events);\n    }\n  },\n\n  _priChanged: function(newPriority) {\n    if (DEBUG) console.log('_priChanged', this.toString(), newPriority);\n    this.priority = newPriority;\n    if( this.parentRef ) {\n      this.parentRef._resort(this.name());\n    }\n  },\n\n  _getPri: function(key) {\n    return _.has(this.children, key)? this.children[key].priority : null;\n  },\n\n  _resort: function(childKeyMoved) {\n    var self = this;\n    self.sortedDataKeys.sort(self.childComparator.bind(self));\n    // resort the data object to match our keys so value events return ordered content\n    var oldDat = _.assign({}, self.data);\n    _.each(oldDat, function(v,k) { delete self.data[k]; });\n    _.each(self.sortedDataKeys, function(k) {\n      self.data[k] = oldDat[k];\n    });\n    if( !_.isUndefined(childKeyMoved) && _.has(self.data, childKeyMoved) ) {\n      self._trigger('child_moved', self.data[childKeyMoved], self._getPri(childKeyMoved), childKeyMoved);\n    }\n  },\n\n  _addKey: function(newKey) {\n    if(_.indexOf(this.sortedDataKeys, newKey) === -1) {\n      this.sortedDataKeys.push(newKey);\n      this._resort();\n    }\n  },\n\n  _dropKey: function(key) {\n    var i = _.indexOf(this.sortedDataKeys, key);\n    if( i > -1 ) {\n      this.sortedDataKeys.splice(i, 1);\n    }\n  },\n\n  _defer: function() {\n    //todo should probably be taking some sort of snapshot of my data here and passing\n    //todo that into `fn` for reference\n    this.flushQueue.add(Array.prototype.slice.call(arguments, 0));\n    if( this.flushDelay !== false ) { this.flush(this.flushDelay); }\n  },\n\n  _trigger: function(event, data, pri, key) {\n    if (DEBUG) console.log('_trigger', event, this.toString(), key);\n    var self = this, ref = event==='value'? self : self.child(key);\n    var snap = makeSnap(ref, data, pri);\n    _.each(self._events[event], function(parts) {\n      var fn = parts[0], context = parts[1];\n      if(_.contains(['child_added', 'child_moved'], event)) {\n        fn.call(context, snap, self._getPrevChild(key));\n      }\n      else {\n        fn.call(context, snap);\n      }\n    });\n  },\n\n  _triggerAll: function(events) {\n    var self = this;\n    if( !events.length ) { return; }\n    _.each(events, function(event) {\n      if (event !== false) self._trigger.apply(self, event);\n    });\n    self._trigger('value', self.data, self.priority);\n    if( self.parentRef ) {\n      self.parentRef._childChanged(self);\n    }\n  },\n\n  _updateOrAdd: function(key, data, events) {\n    var exists = _.isObject(this.data) && this.data.hasOwnProperty(key);\n    if( !exists ) {\n      return this._addChild(key, data, events);\n    }\n    else {\n      return this._updateChild(key, data, events);\n    }\n  },\n\n  _addChild: function(key, data, events) {\n    if(this._hasChild(key)) {\n      throw new Error('Tried to add existing object', key);\n    }\n    if( !_.isObject(this.data) ) {\n      this.data = {};\n    }\n    this._addKey(key);\n    this.data[key] = cleanData(data);\n    var c = this.child(key);\n    c._dataChanged(data);\n    if (events) events.push(['child_added', c.getData(), c.priority, key]);\n  },\n\n  _removeChild: function(key, events) {\n    if(this._hasChild(key)) {\n      this._dropKey(key);\n      var data = this.data[key];\n      delete this.data[key];\n      if(_.isEmpty(this.data)) {\n        this.data = null;\n      }\n      if(_.has(this.children, key)) {\n        this.children[key]._dataChanged(null);\n      }\n      if (events) events.push(['child_removed', data, null, key]);\n    }\n  },\n\n  _updateChild: function(key, data, events) {\n    var cdata = cleanData(data);\n    if(_.isObject(this.data) && _.has(this.data,key) && !_.isEqual(this.data[key], cdata)) {\n      this.data[key] = cdata;\n      var c = this.child(key);\n      c._dataChanged(data);\n      if (events) events.push(['child_changed', c.getData(), c.priority, key]);\n    }\n  },\n\n  _newAutoId: function() {\n    this._lastAutoId = 'mock-'+Date.now()+'-'+Math.floor(Math.random()*10000);\n    return this._lastAutoId;\n  },\n\n  _nextErr: function(type) {\n    var err = this.errs[type];\n    delete this.errs[type];\n    return err||null;\n  },\n\n  _hasChild: function(key) {\n    return _.isObject(this.data) && _.has(this.data, key);\n  },\n\n  _childData: function(key) {\n    return this._hasChild(key)? this.data[key] : null;\n  },\n\n  _getPrevChild: function(key) {\n//      this._resort();\n    var keys = this.sortedDataKeys;\n    var i = _.indexOf(keys, key);\n    if( i === -1 ) {\n      keys = keys.slice();\n      keys.push(key);\n      keys.sort(this.childComparator.bind(this));\n      i = _.indexOf(keys, key);\n    }\n    return i === 0? null : keys[i-1];\n  },\n\n  childComparator: function(a, b) {\n    var aPri = this._getPri(a);\n    var bPri = this._getPri(b);\n    var x = priorityComparator(aPri, bPri);\n    if( x === 0 ) {\n      if( a !== b ) {\n        x = a < b? -1 : 1;\n      }\n    }\n    return x;\n  }\n};\n\n\n/*******************************************************************************\n * MOCK QUERY\n ******************************************************************************/\nfunction MockQuery(ref) {\n  this._ref = ref;\n  this._subs = [];\n  // startPri, endPri, startKey, endKey, and limit\n  this._q = {};\n}\n\nMockQuery.prototype = {\n  /*******************\n   * UTILITY FUNCTIONS\n   *******************/\n  flush: function() {\n    this.ref().flush.apply(this.ref(), arguments);\n    return this;\n  },\n\n  autoFlush: function() {\n    this.ref().autoFlush.apply(this.ref(), arguments);\n    return this;\n  },\n\n  slice: function() {\n    return new Slice(this);\n  },\n\n  getData: function() {\n    return this.slice().data;\n  },\n\n  fakeEvent: function(event, snap) {\n    _.each(this._subs, function(parts) {\n      if( parts[0] === 'event' ) {\n        parts[1].call(parts[2], snap);\n      }\n    });\n  },\n\n  /*******************\n   *   API FUNCTIONS\n   *******************/\n  on: function(event, callback, cancelCallback, context) {\n    var self = this, isFirst = true, lastSlice = this.slice(), map;\n    var fn = function(snap, prevChild) {\n      var slice = new Slice(self, event==='value'? snap : makeRefSnap(snap.ref().parent()));\n      switch(event) {\n        case 'value':\n          if( isFirst || !lastSlice.equals(slice) ) {\n            callback.call(context, slice.snap());\n          }\n          break;\n        case 'child_moved':\n          var x = slice.pos(snap.name());\n          var y = slice.insertPos(snap.name());\n          if( x > -1 && y > -1 ) {\n            callback.call(context, snap, prevChild);\n          }\n          else if( x > -1 || y > -1 ) {\n            map = lastSlice.changeMap(slice);\n          }\n          break;\n        case 'child_added':\n          if( slice.has(snap.name()) && lastSlice.has(snap.name()) ) {\n            // is a child_added for existing event so allow it\n            callback.call(context, snap, prevChild);\n          }\n          map = lastSlice.changeMap(slice);\n          break;\n        case 'child_removed':\n          map = lastSlice.changeMap(slice);\n          break;\n        case 'child_changed':\n          callback.call(context, snap);\n          break;\n        default:\n          throw new Error('Invalid event: '+event);\n      }\n\n      if( map ) {\n        var newSnap = slice.snap();\n        var oldSnap = lastSlice.snap();\n        _.each(map.added, function(addKey) {\n          self.fakeEvent('child_added', newSnap.child(addKey));\n        });\n        _.each(map.removed, function(remKey) {\n          self.fakeEvent('child_removed', oldSnap.child(remKey));\n        });\n      }\n\n      isFirst = false;\n      lastSlice = slice;\n    };\n    var cancelFn = function(err) {\n      cancelCallback.call(context, err);\n    };\n    self._subs.push([event, callback, context, fn]);\n    this.ref().on(event, fn, cancelFn);\n  },\n\n  off: function(event, callback, context) {\n    var ref = this.ref();\n    _.each(this._subs, function(parts) {\n      if( parts[0] === event && parts[1] === callback && parts[2] === context ) {\n        ref.off(event, parts[3]);\n      }\n    });\n  },\n\n  once: function(event, callback, context) {\n    var self = this;\n    // once is tricky because we want the first match within our range\n    // so we use the on() method above which already does the needed legwork\n    function fn() {\n      self.off(event, fn);\n      // the snap is already sliced in on() so we can just pass it on here\n      callback.apply(context, arguments);\n    }\n    self.on(event, fn);\n  },\n\n  limit: function(intVal) {\n    if( typeof intVal !== 'number' ) {\n      throw new Error('Query.limit: First argument must be a positive integer.');\n    }\n    var q = new MockQuery(this.ref());\n    _.extend(q._q, this._q, {limit: intVal});\n    return q;\n  },\n\n  startAt: function(priority, key) {\n    assertQuery('Query.startAt', priority, key);\n    var q = new MockQuery(this.ref());\n    _.extend(q._q, this._q, {startKey: key, startPri: priority});\n    return q;\n  },\n\n  endAt: function(priority, key) {\n    assertQuery('Query.endAt', priority, key);\n    var q = new MockQuery(this.ref());\n    _.extend(q._q, this._q, {endKey: key, endPri: priority});\n    return q;\n  },\n\n  ref: function() {\n    return this._ref;\n  }\n};\n\n\n/*******************************************************************************\n * SIMPLE LOGIN\n ******************************************************************************/\nfunction MockFirebaseSimpleLogin(ref, callback, userData) {\n  // allows test units to monitor the callback function to make sure\n  // it is invoked (even if one is not declared)\n  this.callback = function() { callback.apply(null, Array.prototype.slice.call(arguments, 0)); };\n  this.attempts = [];\n  this.failMethod = MockFirebaseSimpleLogin.DEFAULT_FAIL_WHEN;\n  this.ref = ref; // we don't use ref for anything\n  this.autoFlushTime = MockFirebaseSimpleLogin.DEFAULT_AUTO_FLUSH;\n  this.userData = _.cloneDeep(MockFirebaseSimpleLogin.DEFAULT_USER_DATA);\n  if (userData) _.assign(this.userData, userData);\n\n  // turn all our public methods into spies so they can be monitored for calls and return values\n  // see jasmine spies: https://github.com/pivotal/jasmine/wiki/Spies\n  // the constructor can be spied on using spyOn(window, 'FirebaseSimpleLogin') from within the test unit\n  for(var key in this) {\n    if( !key.match(/^_/) && typeof(this[key]) === 'function' ) {\n      spyFactory(this, key);\n    }\n  }\n}\n\nMockFirebaseSimpleLogin.prototype = {\n\n  /*****************************************************\n   * Test Unit Methods\n   *****************************************************/\n\n  /**\n   * When this method is called, any outstanding login()\n   * attempts will be immediately resolved. If this method\n   * is called with an integer value, then the login attempt\n   * will resolve asynchronously after that many milliseconds.\n   *\n   * @param {int|boolean} [milliseconds]\n   * @returns {MockFirebaseSimpleLogin}\n   */\n  flush: function(milliseconds) {\n    var self = this;\n    if(_.isNumber(milliseconds) ) {\n      setTimeout(self.flush.bind(self), milliseconds);\n    }\n    else {\n      var attempts = self.attempts;\n      self.attempts = [];\n      _.each(attempts, function(x) {\n        x[0].apply(self, x.slice(1));\n      });\n    }\n    return self;\n  },\n\n  /**\n   * Automatically queue the flush() event\n   * each time login() is called. If this method\n   * is called with `true`, then the callback\n   * is invoked synchronously.\n   *\n   * If this method is called with an integer,\n   * the callback is triggered asynchronously\n   * after that many milliseconds.\n   *\n   * If this method is called with false, then\n   * autoFlush() is disabled.\n   *\n   * @param {int|boolean} [milliseconds]\n   * @returns {MockFirebaseSimpleLogin}\n   */\n  autoFlush: function(milliseconds) {\n    this.autoFlushTime = milliseconds;\n    if( this.autoFlushTime !== false ) {\n      this.flush(this.autoFlushTime);\n    }\n    return this;\n  },\n\n  /**\n   * `testMethod` is passed the {string}provider, {object}options, {object}user\n   * for each call to login(). If it returns anything other than\n   * null, then that is passed as the error message to the\n   * callback and the login call fails.\n   *\n   * <code>\n   *   // this is a simplified example of the default implementation (MockFirebaseSimpleLogin.DEFAULT_FAIL_WHEN)\n   *   auth.failWhen(function(provider, options, user) {\n   *      if( user.email !== options.email ) {\n   *         return MockFirebaseSimpleLogin.createError('INVALID_USER');\n   *      }\n   *      else if( user.password !== options.password ) {\n   *         return MockFirebaseSimpleLogin.createError('INVALID_PASSWORD');\n   *      }\n   *      else {\n   *         return null;\n   *      }\n   *   });\n   * </code>\n   *\n   * Multiple calls to this method replace the old failWhen criteria.\n   *\n   * @param testMethod\n   * @returns {MockFirebaseSimpleLogin}\n   */\n  failWhen: function(testMethod) {\n    this.failMethod = testMethod;\n    return this;\n  },\n\n  /**\n   * Retrieves a user account from the mock user data on this object\n   *\n   * @param provider\n   * @param options\n   */\n  getUser: function(provider, options) {\n    var data = this.userData[provider];\n    if( provider === 'password' ) {\n      data = (data||{})[options.email];\n    }\n    return data||null;\n  },\n\n  /*****************************************************\n   * Public API\n   *****************************************************/\n  login: function(provider, options) {\n    var err = this.failMethod(provider, options||{}, this.getUser(provider, options));\n    this._notify(err, err===null? this.userData[provider]: null);\n  },\n\n  logout: function() {\n    this._notify(null, null);\n  },\n\n  createUser: function(email, password, callback) {\n    if (!callback) callback = _.noop;\n    this._defer(function() {\n      var user = null, err = null;\n      if( this.userData.password.hasOwnProperty(email) ) {\n        err = createError('EMAIL_TAKEN', 'The specified email address is already in use.');\n      }\n      else {\n        user = createEmailUser(email, password);\n        this.userData.password[email] = user;\n      }\n      callback(err, user);\n    });\n  },\n\n  changePassword: function(email, oldPassword, newPassword, callback) {\n    if (!callback) callback = _.noop;\n    this._defer(function() {\n      var user = this.getUser('password', {email: email});\n      var err = this.failMethod('password', {email: email, password: oldPassword}, user);\n      if( err ) {\n        callback(err, false);\n      }\n      else {\n        user.password = newPassword;\n        callback(null, true);\n      }\n    });\n  },\n\n  sendPasswordResetEmail: function(email, callback) {\n    if (!callback) callback = _.noop;\n    this._defer(function() {\n      var user = this.getUser('password', {email: email});\n      if( !user ) {\n        callback(createError('INVALID_USER'), false);\n      }\n      else {\n        callback(null, true);\n      }\n    });\n  },\n\n  removeUser: function(email, password, callback) {\n    if (!callback) callback = _.noop;\n    this._defer(function() {\n      var user = this.getUser('password', {email: email});\n      if( !user ) {\n        callback(createError('INVALID_USER'), false);\n      }\n      else if( user.password !== password ) {\n        callback(createError('INVALID_PASSWORD'), false);\n      }\n      else {\n        delete this.userData.password[email];\n        callback(null, true);\n      }\n    });\n  },\n\n  /*****************************************************\n   * Private/internal methods\n   *****************************************************/\n  _notify: function(error, user) {\n    this._defer(this.callback, error, user);\n  },\n\n  _defer: function() {\n    var args = _.toArray(arguments);\n    this.attempts.push(args);\n    if( this.autoFlushTime !== false ) {\n      this.flush(this.autoFlushTime);\n    }\n  }\n};\n\n/***\n * DATA SLICE\n * A utility to handle limits, startAts, and endAts\n */\nfunction Slice(queue, snap) {\n  var data = snap? snap.val() : queue.ref().getData();\n  this.ref = snap? snap.ref() : queue.ref();\n  this.priority = snap? snap.getPriority() : this.ref.priority;\n  this.pris = {};\n  this.data = {};\n  this.map = {};\n  this.outerMap = {};\n  this.keys = [];\n  this.props = this._makeProps(queue._q, this.ref, this.ref.getKeys().length);\n  this._build(this.ref, data);\n}\n\nSlice.prototype = {\n  prev: function(key) {\n    var pos = this.pos(key);\n    if( pos === 0 ) { return null; }\n    else {\n      if( pos < 0 ) { pos = this.keys.length; }\n      return this.keys[pos-1];\n    }\n  },\n\n  equals: function(slice) {\n    return _.isEqual(this.keys, slice.keys) && _.isEqual(this.data, slice.data);\n  },\n\n  pos: function(key) {\n    return this.has(key)? this.map[key] : -1;\n  },\n\n  insertPos: function(prevChild) {\n    var outerPos = this.outerMap[prevChild];\n    if( outerPos >= this.min && outerPos < this.max ) {\n      return outerPos+1;\n    }\n    return -1;\n  },\n\n  has: function(key) {\n    return this.map.hasOwnProperty(key);\n  },\n\n  snap: function(key) {\n    var ref = this.ref;\n    var data = this.data;\n    var pri = this.priority;\n    if( key ) {\n      data = this.get(key);\n      ref = ref.child(key);\n      pri = this.pri(key);\n    }\n    return makeSnap(ref, data, pri);\n  },\n\n  get: function(key) {\n    return this.has(key)? this.data[key] : null;\n  },\n\n  pri: function(key) {\n    return this.has(key)? this.pris[key] : null;\n  },\n\n  changeMap: function(slice) {\n    var self = this;\n    var changes = { in: [], out: [] };\n    _.each(self.data, function(v,k) {\n      if( !slice.has(k) ) {\n        changes.out.push(k);\n      }\n    });\n    _.each(slice.data, function(v,k) {\n      if( !self.has(k) ) {\n        changes.in.push(k);\n      }\n    });\n    return changes;\n  },\n\n  _inRange: function(props, key, pri, pos) {\n    if( pos === -1 ) { return false; }\n    if( !_.isUndefined(props.startPri) && priorityComparator(pri, props.startPri) < 0 ) {\n      return false;\n    }\n    if( !_.isUndefined(props.startKey) && priorityComparator(key, props.startKey) < 0 ) {\n      return false;\n    }\n    if( !_.isUndefined(props.endPri) && priorityComparator(pri, props.endPri) > 0 ) {\n      return false;\n    }\n    if( !_.isUndefined(props.endKey) && priorityComparator(key, props.endKey) > 0 ) {\n      return false;\n    }\n    if( props.max > -1 && pos > props.max ) {\n      return false;\n    }\n    return pos >= props.min;\n  },\n\n  _findPos: function(pri, key, ref, isStartBoundary) {\n    var keys = ref.getKeys(), firstMatch = -1, lastMatch = -1;\n    var len = keys.length, i, x, k;\n    if(_.isUndefined(pri) && _.isUndefined(key)) {\n      return -1;\n    }\n    for(i = 0; i < len; i++) {\n      k = keys[i];\n      x = priAndKeyComparator(pri, key, ref.child(k).priority, k);\n      if( x === 0 ) {\n        // if the key is undefined, we may have several matching comparisons\n        // so we will record both the first and last successful match\n        if (firstMatch === -1) {\n          firstMatch = i;\n        }\n        lastMatch = i;\n      }\n      else if( x < 0 ) {\n        // we found the breakpoint where our keys exceed the match params\n        if( i === 0 ) {\n          // if this is 0 then our match point is before the data starts, we\n          // will use len here because -1 already has a special meaning (no limit)\n          // and len ensures we won't get any data (no matches)\n          i = len;\n        }\n        break;\n      }\n    }\n\n    if( firstMatch !== -1 ) {\n      // we found a match, life is simple\n      return isStartBoundary? firstMatch : lastMatch;\n    }\n    else if( i < len ) {\n      // if we're looking for the start boundary then it's the first record after\n      // the breakpoint. If we're looking for the end boundary, it's the last record before it\n      return isStartBoundary? i : i -1;\n    }\n    else {\n      // we didn't find one, so use len (i.e. after the data, no results)\n      return len;\n    }\n  },\n\n  _makeProps: function(queueProps, ref, numRecords) {\n    var out = {};\n    _.each(queueProps, function(v,k) {\n      if(!_.isUndefined(v)) {\n        out[k] = v;\n      }\n    });\n    out.min = this._findPos(out.startPri, out.startKey, ref, true);\n    out.max = this._findPos(out.endPri, out.endKey, ref);\n    if( !_.isUndefined(queueProps.limit) ) {\n      if( out.min > -1 ) {\n        out.max = out.min + queueProps.limit;\n      }\n      else if( out.max > -1 ) {\n        out.min = out.max - queueProps.limit;\n      }\n      else if( queueProps.limit < numRecords ) {\n        out.max = numRecords-1;\n        out.min = Math.max(0, numRecords - queueProps.limit);\n      }\n    }\n    return out;\n  },\n\n  _build: function(ref, rawData) {\n    var i = 0, map = this.map, keys = this.keys, outer = this.outerMap;\n    var props = this.props, slicedData = this.data;\n    _.each(rawData, function(v,k) {\n      outer[k] = i < props.min? props.min - i : i - Math.max(props.min,0);\n      if( this._inRange(props, k, ref.child(k).priority, i++) ) {\n        map[k] = keys.length;\n        keys.push(k);\n        slicedData[k] = v;\n      }\n    }, this);\n  }\n};\n\n/***\n * FLUSH QUEUE\n * A utility to make sure events are flushed in the order\n * they are invoked.\n ***/\nfunction FlushQueue() {\n  this.queuedEvents = [];\n}\n\nFlushQueue.prototype.add = function(args) {\n  this.queuedEvents.push(args);\n};\n\nFlushQueue.prototype.flush = function(delay) {\n  if( !this.queuedEvents.length ) { return; }\n\n  // make a copy of event list and reset, this allows\n  // multiple calls to flush to queue various events out\n  // of order, and ensures that events that are added\n  // while flushing go into the next flush and not this one\n  var list = this.queuedEvents;\n\n  // events could get added as we invoke\n  // the list, so make a copy and reset first\n  this.queuedEvents = [];\n\n  function process() {\n    // invoke each event\n    list.forEach(function(parts) {\n      parts[0].apply(null, parts.slice(1));\n    });\n  }\n\n  if( _.isNumber(delay) ) {\n    setTimeout(process, delay);\n  }\n  else {\n    process();\n  }\n};\n\n\nfunction priAndKeyComparator(testPri, testKey, valPri, valKey) {\n  var x = 0;\n  if( !_.isUndefined(testPri) ) {\n    x = priorityComparator(testPri, valPri);\n  }\n  if( x === 0 && !_.isUndefined(testKey) && testKey !== valKey ) {\n    x = testKey < valKey? -1 : 1;\n  }\n  return x;\n}\n\nfunction priorityComparator(a,b) {\n  if (a !== b) {\n    if( a === null || b === null ) {\n      return a === null? -1 : 1;\n    }\n    if (typeof a !== typeof b) {\n      return typeof a === 'number' ? -1 : 1;\n    } else {\n      return a > b ? 1 : -1;\n    }\n  }\n  return 0;\n}\n\nvar spyFactory = (function() {\n  var spyFunction;\n  if( typeof(global.jasmine) !== 'undefined' ) {\n    spyFunction = function(obj, method) {\n      var fn, spy;\n      if( typeof(obj) === 'object' ) {\n        spy = global.spyOn(obj, method);\n        if( typeof(spy.andCallThrough) === 'function' ) {\n          // karma < 0.12.x\n          fn = spy.andCallThrough();\n        }\n        else {\n          fn = spy.and.callThrough();\n        }\n      }\n      else {\n        spy = global.jasmine.createSpy(method);\n        if( typeof(arguments[0]) === 'function' ) {\n          if( typeof(spy.andCallFake) === 'function' ) {\n            // karma < 0.12.x\n            fn = spy.andCallFake(obj);\n          }\n          else {\n            fn = spy.and.callFake(obj);\n          }\n        }\n        else {\n          fn = spy;\n        }\n      }\n      return fn;\n    };\n  }\n  else {\n    spyFunction = function(obj, method) {\n      var sinon = (typeof window !== \"undefined\" ? window.sinon : typeof global !== \"undefined\" ? global.sinon : null);\n      if ( typeof (obj) === 'object') {\n        return sinon.spy(obj, method);\n      }\n      else {\n        return sinon.spy(obj);\n      }\n    };\n  }\n  return spyFunction;\n})();\n\nvar USER_COUNT = 100;\nfunction createEmailUser(email, password) {\n  var id = USER_COUNT++;\n  return {\n    uid: 'password:'+id,\n    id: id,\n    email: email,\n    password: password,\n    provider: 'password',\n    md5_hash: md5(email),\n    firebaseAuthToken: 'FIREBASE_AUTH_TOKEN' //todo\n  };\n}\n\nfunction createDefaultUser(provider) {\n  var id = USER_COUNT++;\n\n  var out = {\n    uid: provider+':'+id,\n    id: id,\n    password: id,\n    provider: provider,\n    firebaseAuthToken: 'FIREBASE_AUTH_TOKEN' //todo\n  };\n  switch(provider) {\n    case 'password':\n      out.email = 'email@firebase.com';\n      out.md5_hash = md5(out.email);\n      break;\n    case 'twitter':\n      out.accessToken = 'ACCESS_TOKEN'; //todo\n      out.accessTokenSecret = 'ACCESS_TOKEN_SECRET'; //todo\n      out.displayName = 'DISPLAY_NAME';\n      out.thirdPartyUserData = {}; //todo\n      out.username = 'USERNAME';\n      break;\n    case 'google':\n      out.accessToken = 'ACCESS_TOKEN'; //todo\n      out.displayName = 'DISPLAY_NAME';\n      out.email = 'email@firebase.com';\n      out.thirdPartyUserData = {}; //todo\n      break;\n    case 'github':\n      out.accessToken = 'ACCESS_TOKEN'; //todo\n      out.displayName = 'DISPLAY_NAME';\n      out.thirdPartyUserData = {}; //todo\n      out.username = 'USERNAME';\n      break;\n    case 'facebook':\n      out.accessToken = 'ACCESS_TOKEN'; //todo\n      out.displayName = 'DISPLAY_NAME';\n      out.thirdPartyUserData = {}; //todo\n      break;\n    case 'anonymous':\n      break;\n    default:\n      throw new Error('Invalid auth provider', provider);\n  }\n\n  return out;\n}\n\nfunction ref(path, autoSyncDelay) {\n  var reference = new MockFirebase();\n  reference.flushDelay = _.isUndefined(autoSyncDelay)? true : autoSyncDelay;\n  if( path ) { reference = reference.child(path); }\n  return reference;\n}\n\nfunction mergePaths(base, add) {\n  return base.replace(/\\/$/, '')+'/'+add.replace(/^\\//, '');\n}\n\nfunction makeRefSnap(ref) {\n  return makeSnap(ref, ref.getData(), ref.priority);\n}\n\nfunction makeSnap(ref, data, pri) {\n  data = _.cloneDeep(data);\n  if(_.isObject(data) && _.isEmpty(data)) { data = null; }\n  return {\n    val: function() { return data; },\n    ref: function() { return ref; },\n    name: function() { return ref.name(); },\n    getPriority: function() { return pri; },\n    forEach: function(cb, scope) {\n      var self = this;\n      _.each(data, function(v, k) {\n        var res = cb.call(scope, self.child(k));\n        return res !== true;\n      });\n    },\n    child: function(key) {\n      return makeSnap(ref.child(key), _.isObject(data) && _.has(data, key)? data[key] : null, ref.child(key).priority);\n    }\n  };\n}\n\nfunction extractName(path) {\n  return ((path || '').match(/\\/([^.$\\[\\]#\\/]+)$/)||[null, null])[1];\n}\n\nfunction createError(code, message) {\n  return { code: code||'UNKNOWN_ERROR', message: 'FirebaseSimpleLogin: '+(message||code||'unspecific error') };\n}\n\nfunction getMeta(data, key, defaultVal) {\n  var val = defaultVal;\n  var metaKey = '.' + key;\n  if( _.isObject(data) && _.has(data, metaKey) ) {\n    val = data[metaKey];\n    delete data[metaKey];\n  }\n  return val;\n}\n\nfunction cleanData(data) {\n  var newData = _.clone(data);\n  if(_.isObject(newData)) {\n    if(_.has(newData, '.value')) {\n      newData = _.clone(newData['.value']);\n    }\n    if(_.has(newData, '.priority')) {\n      delete newData['.priority'];\n    }\n//      _.each(newData, function(v,k) {\n//        newData[k] = cleanData(v);\n//      });\n    if(_.isEmpty(newData)) { newData = null; }\n  }\n  return newData;\n}\n\nfunction assertKey(method, key, argNum) {\n  if (!argNum) argNum = 'first';\n  if( typeof(key) !== 'string' || key.match(/[.#$\\/\\[\\]]/) ) {\n    throw new Error(method + ' failed: '+argNum+' was an invalid key \"'+(key+'')+'. Firebase keys must be non-empty strings and can\\'t contain \".\", \"#\", \"$\", \"/\", \"[\", or \"]\"');\n  }\n}\n\nfunction assertQuery(method, pri, key) {\n  if( pri !== null && typeof(pri) !== 'string' && typeof(pri) !== 'number' ) {\n    throw new Error(method + ' failed: first argument must be a valid firebase priority (a string, number, or null).');\n  }\n  if(!_.isUndefined(key)) {\n    assertKey(method, key, 'second');\n  }\n}\n\n/*** PUBLIC METHODS AND FIXTURES ***/\n\nMockFirebaseSimpleLogin.DEFAULT_FAIL_WHEN = function(provider, options, user) {\n  var res = null;\n  if( ['password', 'anonymous', 'twitter', 'facebook', 'google', 'github'].indexOf(provider) === -1 ) {\n    console.error('MockFirebaseSimpleLogin:login() failed: unrecognized authentication provider '+provider);\n//      res = createError();\n  }\n  else if( !user ) {\n    res = createError('INVALID_USER', 'The specified user does not exist');\n  }\n  else if( provider === 'password' && user.password !== options.password ) {\n    res = createError('INVALID_PASSWORD', 'The specified password is incorrect');\n  }\n  return res;\n};\n\nMockFirebaseSimpleLogin.DEFAULT_USER_DATA = {};\n_.each(['password', 'anonymous', 'facebook', 'twitter', 'google', 'github'], function(provider) {\n  var user = createDefaultUser(provider);\n  if( provider !== 'password' ) {\n    MockFirebaseSimpleLogin.DEFAULT_USER_DATA[provider] = user;\n  }\n  else {\n    var set = MockFirebaseSimpleLogin.DEFAULT_USER_DATA[provider] = {};\n    set[user.email] = user;\n  }\n});\n\n\nMockFirebase.md5 = md5;\nMockFirebaseSimpleLogin.DEFAULT_AUTO_FLUSH = false;\n\nMockFirebase._ = _; // expose for tests\nMockFirebase.Query = MockQuery; // expose for tests\n\nMockFirebase.override = function () {\n  /* global window */\n  if (typeof window !== 'undefined') {\n    MockFirebase._origFirebase = window.Firebase;\n    MockFirebase._origFirebaseSimpleLogin = window.FirebaseSimpleLogin;\n    window.Firebase = MockFirebase;\n    window.FirebaseSimpleLogin = MockFirebaseSimpleLogin;\n  }\n  else {\n    console.warn('MockFirebase.override is only useful in a browser environment.');\n  }\n};\n\nMockFirebase.ref = ref;\nMockFirebase.DEFAULT_DATA  = {\n  'data': {\n    'a': {\n      aString: 'alpha',\n      aNumber: 1,\n      aBoolean: false\n    },\n    'b': {\n      aString: 'bravo',\n      aNumber: 2,\n      aBoolean: true\n    },\n    'c': {\n      aString: 'charlie',\n      aNumber: 3,\n      aBoolean: true\n    },\n    'd': {\n      aString: 'delta',\n      aNumber: 4,\n      aBoolean: true\n    },\n    'e': {\n      aString: 'echo',\n      aNumber: 5\n    }\n  },\n  'index': {\n    'b': true,\n    'c': 1,\n    'e': false,\n    'z': true // must not exist in `data`\n  },\n  'ordered': {\n    'null_a': {\n      aNumber: 0,\n      aLetter: 'a'\n    },\n    'null_b': {\n      aNumber: 0,\n      aLetter: 'b'\n    },\n    'null_c': {\n      aNumber: 0,\n      aLetter: 'c'\n    },\n    'num_1_a': {\n      '.priority': 1,\n      aNumber: 1\n    },\n    'num_1_b': {\n      '.priority': 1,\n      aNumber: 1\n    },\n    'num_2': {\n      '.priority': 2,\n      aNumber: 2\n    },\n    'num_3': {\n      '.priority': 3,\n      aNumber: 3\n    },\n    'char_a_1': {\n      '.priority': 'a',\n      aNumber: 1,\n      aLetter: 'a'\n    },\n    'char_a_2': {\n      '.priority': 'a',\n      aNumber: 2,\n      aLetter: 'a'\n    },\n    'char_b': {\n      '.priority': 'b',\n      aLetter: 'b'\n    },\n    'char_c': {\n      '.priority': 'c',\n      aLetter: 'c'\n    }\n  }\n};\n\nexports.MockFirebase = MockFirebase;\nexports.MockFirebaseSimpleLogin = MockFirebaseSimpleLogin;\n\n}).call(this,typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"MD5\":1,\"lodash\":7}]},{},[8])\n(8)\n});;(function (window) {\n  'use strict';\n  if (typeof window === 'object') {\n    window.MockFirebase = window.mockfirebase.MockFirebase;\n    window.MockFirebaseSimpleLogin = window.mockfirebase.MockFirebaseSimpleLogin;\n  }\n})(window);\n"
  },
  {
    "path": "www/views/about/about.html",
    "content": "<ion-view title=\"About App\">\n  <ion-content class=\"padding\">\n\n    <p>App built as an example for demonstrating many features of the Ionic Framework. Built by Jeremy Wilken, <a href=\"https://twitter.com/gnomeontherun\">@gnomeontherun</a>.</p>\n    <h3>Projects Used</h3>\n    <ul>\n      <li><a href=\"http://ionicframework.com\">Ionic Framework</a></li>\n      <li><a href=\"http://angularjs.org\">AngularJS</a></li>\n      <li><a href=\"https://angular-ui.github.io/ui-router\">AngularUI ui-router</a></li>\n      <li><a href=\"https://cordova.apache.org\">Cordova</a></li>\n    </ul>\n    <p>Want to make improvements, found a bug, or just have questions? Open an issue on the <a href=\"https://github.com/ionic-in-action/ionic-demo-resort-app\">GitHub project</a>.</p>\n    <p>Icon and Splashscreen licensed as CC 3.0 BY-SA/BYCG by Manamedia.com.</p>\n  </ion-content>\n</ion-view>\n"
  },
  {
    "path": "www/views/events/events.html",
    "content": "<ion-view title=\"Upcoming Events\">\n  <ion-content>\n    <ul class=\"list\">\n      <span ng-repeat=\"day in events\">\n      <li class=\"item item-divider\">{{day.day}}</li>\n      <li class=\"item\" ng-repeat=\"event in day.events\">\n        <h2>{{event.event}}</h2>\n        <p>{{event.time}}, {{event.location}}</p>\n      </li>\n    </ul>\n  </ion-content>\n</ion-view>\n"
  },
  {
    "path": "www/views/events/events.js",
    "content": "angular.module('App').controller('EventsCtrl', function ($scope, EventsService) {\n\n  var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\n  var day = new Date().getDay();\n  var index = 0;\n  $scope.events = EventsService.$asArray();\n\n  $scope.events.$loaded().then(function () {\n    while (day != index && index < 7) {\n      $scope.events.push($scope.events.shift());\n      index++;\n    }\n  });\n});\n"
  },
  {
    "path": "www/views/food/food.html",
    "content": "<ion-view title=\"Room Service\" class=\"room-service\">\n  <ion-nav-buttons side=\"right\">\n    <button class=\"button button-clear\" ng-click=\"openPreview()\">Preview</button>\n  </ion-nav-buttons>\n  <ion-header-bar align-title=\"left\" class=\"bar-positive\">\n    <h1 class=\"title\">Total: {{order.total | currency}}, Items {{order.items.length}}</h1>\n  </ion-header-bar>\n  <ion-content>\n    <ion-list>\n      <span ng-repeat=\"course in menu\">\n      <ion-item class=\"item-divider\">{{course.meal}}</ion-item>\n      <ion-item ng-repeat=\"item in course.items\">\n        {{item.item}} <span class=\"item-note\">{{item.price | currency}}\n        <ion-option-button class=\"button-positive\" ng-click=\"add(item)\">Order</ion-option-button>\n      </ion-item>\n      </span>\n    </ion-list>\n  </ion-content>\n</ion-view>\n"
  },
  {
    "path": "www/views/food/food.js",
    "content": "angular.module('App').controller('FoodCtrl', function ($scope, $ionicListDelegate, $ionicLoading, $ionicModal, $ionicPopup, MenuService) {\n\n  $scope.sendOrder = function () {\n    $ionicPopup.alert({\n      title: 'Order submitted',\n      template: 'Your order will be delieved to your room within 30 minutes.',\n    }).then(function (code) {\n      $scope.modal.hide();\n    });\n  }\n\n  $scope.openPreview = function() {\n    $ionicModal.fromTemplateUrl('views/food/preview.html', {\n      scope: $scope,\n      animation: 'slide-in-up'\n    }).then(function(modal) {\n      $scope.modal = modal;\n      $scope.modal.show();\n    });\n  };\n\n  $scope.cancelPreview = function () {\n    $scope.modal.hide();\n  };\n\n  $scope.$on('$destroy', function() {\n    if ($scope.modal) {\n      $scope.modal.remove();\n    }\n  });\n\n  $scope.order = {\n    items: [],\n    total: 0\n  };\n\n  $scope.add = function (item) {\n    $ionicListDelegate.closeOptionButtons();\n    $scope.order.items.push(angular.copy(item));\n    $scope.order.total += item.price;\n  };\n\n  $scope.remove = function (index) {\n    $scope.order.total -= $scope.order.items[index].price;\n    $scope.order.items.splice(index, 1);\n  };\n\n  $ionicLoading.show({\n    template: '<span class=\"icon spin ion-loading-d\"></span> Loading menu'\n  });\n\n  $scope.menu = MenuService.$asArray();\n  $scope.menu.$loaded().then(function () {\n    $ionicLoading.hide();\n  });\n\n});\n"
  },
  {
    "path": "www/views/food/preview.html",
    "content": "<ion-modal-view>\n  <ion-header-bar class=\"bar-dark\">\n    <div class=\"buttons\">\n      <button class=\"button button-clear\" ng-click=\"cancelPreview()\">Cancel</button>\n    </div>\n    <h1 class=\"title\">Preview Order</h1>\n    <div class=\"buttons\">\n      <button class=\"button button-clear\" ng-if=\"order.items.length\" ng-click=\"sendOrder()\">Submit</button>\n    </div>\n  </ion-header-bar>\n  <ion-content>\n    <ion-list>\n      <ion-item ng-if=\"!order.items.length\" class=\"item-divider\">No items</ion-item>\n      <ion-item ng-repeat=\"item in order.items\">\n        {{item.item}} <span class=\"item-note\">{{item.price | currency}}\n        <ion-option-button class=\"button-assertive\" ng-click=\"remove($index)\">Remove</ion-option-button>\n      </ion-item>\n    </ion-list>\n</ion-modal-view>\n"
  },
  {
    "path": "www/views/home/comments.html",
    "content": "<ion-modal-view>\n  <ion-header-bar class=\"bar-dark\">\n    <h1 class=\"title\">Send Us Comments</h1>\n    <div class=\"buttons\">\n      <button class=\"button button-clear\" ng-click=\"cancelComments()\">Cancel</button>\n    </div>\n  </ion-header-bar>\n  <ion-content class=\"comments\">\n    <div class=\"list card\">\n      <div class=\"item\">\n        <div class=\"item-label\">Message</div>\n      </div>\n      <div class=\"item item-input\">\n        <textarea ng-model=\"comment.message\" name=\"message\" rows=\"10\"></textarea>\n      </div>\n      <div class=\"item\">\n        <div class=\"item-label\">Rate your experience</div>\n      </div>\n      <div class=\"item range range-balanced\">\n        <input type=\"range\" ng-model=\"comment.rating\" name=\"rating\" min=\"1\" max=\"5\">\n        <i class=\"icon ion-ios7-heart\"></i>\n        <i class=\"icon\" ng-class=\"{'ion-ios7-heart': comment.rating > 1, 'ion-ios7-heart-outline': comment.rating < 2}\"></i>\n        <i class=\"icon\" ng-class=\"{'ion-ios7-heart': comment.rating > 2, 'ion-ios7-heart-outline': comment.rating < 3}\"></i>\n        <i class=\"icon\" ng-class=\"{'ion-ios7-heart': comment.rating > 3, 'ion-ios7-heart-outline': comment.rating < 4}\"></i>\n        <i class=\"icon\" ng-class=\"{'ion-ios7-heart': comment.rating > 4, 'ion-ios7-heart-outline': comment.rating < 5}\"></i>\n      </div>\n      <button class=\"button button-block button-balanced\" ng-click=\"sendComments()\">Send</button>\n    </div>\n  </ion-content>\n</ion-modal-view>\n"
  },
  {
    "path": "www/views/home/home.html",
    "content": "<ion-view title=\"Home\">\n  <ion-content>\n    <div class=\"card\">\n      <div class=\"item item-divider\">Welcome to Sunshine Resort</div>\n      <div class=\"item item-text-wrap\">\n        We hope you enjoy your stay! Here you can see the daily schedule. You can view the events list to add things to your schedule or discover local places in the menu.\n      </div>\n    </div>\n\n    <div class=\"card\">\n      <div class=\"item item-divider\">Current Weather</div>\n      <div class=\"item\" ng-if=\"!weather\"><span class=\"icon ion-loading-d\"></span></div>\n      <div class=\"item item-text-wrap\">\n        <p>Currently {{weather.main.temp}}&deg;F and {{weather.weather[0].description}}.</p>\n      </div>\n      <a class=\"item button button-positive button-block\" href=\"#/weather\">See Forecast</a>\n    </div>\n\n    <div class=\"card\">\n      <div class=\"item item-divider\">Today's Events</div>\n      <div class=\"item\" ng-if=\"!today\"><span class=\"icon ion-loading-d\"></span></div>\n      <div class=\"item\" ng-repeat=\"item in today.events\">{{item.event}}, {{item.time}}</div>\n      <a class=\"item button button-positive button-block\" href=\"#/events\">See all events</a>\n    </div>\n\n    <div class=\"card\">\n      <div class=\"item item-icon-left\" ng-click=\"openComments()\">\n        <i class=\"icon ion-chatbubble\"></i> Send us a comment\n      </div>\n    </div>\n  </ion-content>\n</ion-view>\n"
  },
  {
    "path": "www/views/home/home.js",
    "content": "angular.module('App').controller('HomeCtrl', function ($scope, $http, $timeout, $ionicModal, $ionicLoading, $ionicPopup, EventsService) {\n\n  var comment = {\n    message: '',\n    rating: 5\n  };\n  $scope.comment = angular.copy(comment);\n\n  $scope.sendComments = function () {\n    // Send comment\n    $scope.cancelComments();\n    $ionicPopup.alert({\n      title: 'Thank you!',\n      template: 'We appreciate your comments!',\n      okText: 'Close'\n    });\n  };\n\n  $scope.cancelComments = function () {\n    $scope.comment = angular.copy(comment);\n    $scope.modal.hide();\n  }\n\n  $scope.openComments = function() {\n    $ionicModal.fromTemplateUrl('views/home/comments.html', {\n      scope: $scope,\n      animation: 'slide-in-up'\n    }).then(function(modal) {\n      $scope.modal = modal;\n      $scope.modal.show();\n    });\n  };\n\n  //Cleanup the modal when we're done with it!\n  $scope.$on('$destroy', function() {\n    if ($scope.modal) {\n      $scope.modal.remove();\n    }\n  });\n\n  $http.get('http://api.openweathermap.org/data/2.5/weather?q=Key%20West,FL&units=imperial').success(function (data) {\n    $scope.weather = data;\n  });\n\n  var events = EventsService.$asArray();\n  events.$loaded().then(function () {\n    $scope.today = events[new Date().getDay()];\n  });\n\n});\n"
  },
  {
    "path": "www/views/local/beaches.html",
    "content": "<ion-view title=\"Local Beaches\">\n  <ion-content>\n    <ul class=\"list\">\n      <li class=\"item item-divider\">Public</li>\n      <li class=\"item\">\n        <h2>Green Beach</h2>\n        <p>0.4 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Marty's Pointe</h2>\n        <p>1.0 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Shipwreck Beach</h2>\n        <p>4.2 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Seal Beach</h2>\n        <p>5.7 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Glass Beach</h2>\n        <p>8.6 miles</p>\n      </li>\n      <li class=\"item item-divider\">Private</li>\n      <li class=\"item\">\n        <h2>East Pointe Beach, $5</h2>\n        <p>3.2 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Secret Beach, $10</h2>\n        <p>6.7 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Tide Pool Beach, $8</h2>\n        <p>9.3 miles</p>\n      </li>\n    </ul>\n  </ion-content>\n</ion-view>\n"
  },
  {
    "path": "www/views/local/food.html",
    "content": "<ion-view title=\"Local Resturants\">\n  <ion-content>\n    <ul class=\"list\">\n      <li class=\"item item-divider\">Casual</li>\n      <li class=\"item\">\n        <h2>Route 66 Cafe</h2>\n        <p>1.4 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Applebee's</h2>\n        <p>1.5 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Sally's Sundaes</h2>\n        <p>3.2 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Cafe 888</h2>\n        <p>3.6 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>La Fiesta</h2>\n        <p>4.3 miles</p>\n      </li>\n      <li class=\"item item-divider\">Fine Dining</li>\n      <li class=\"item\">\n        <h2>Italiano</h2>\n        <p>3.2 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>John's Steakhouse</h2>\n        <p>3.5 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Gulf Coast Seafood</h2>\n        <p>5.4 miles</p>\n      </li>\n    </ul>\n  </ion-content>\n</ion-view>\n"
  },
  {
    "path": "www/views/local/local.html",
    "content": "<ion-view title=\"Local Places\">\n  <ion-tabs class=\"tabs-icon-top\">\n    <ion-tab icon=\"ion-fork\" title=\"Resturants\" href=\"#/local/food\">\n      <ion-nav-view name=\"local-food\"></ion-nav-view>\n    </ion-tab>\n    <ion-tab icon=\"ion-ios7-sunny\" title=\"Beaches\" href=\"#/local/beaches\">\n      <ion-nav-view name=\"local-beaches\"></ion-nav-view>\n    </ion-tab>\n    <ion-tab icon=\"ion-images\" title=\"Sights\" href=\"#/local/sights\">\n      <ion-nav-view name=\"local-sights\"></ion-nav-view>\n    </ion-tab>\n  </ion-tabs>\n</ion-view>\n"
  },
  {
    "path": "www/views/local/sights.html",
    "content": "<ion-view title=\"Local Sights\">\n  <ion-content>\n    <ul class=\"list\">\n      <li class=\"item item-divider\">Natural</li>\n      <li class=\"item\">\n        <h2>Botanical Gardens</h2>\n        <p>4.4 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Hidden Falls</h2>\n        <p>7.5 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Lookout Point</h2>\n        <p>8.2 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Natural Stone Arches</h2>\n        <p>12.3 miles</p>\n      </li>\n      <li class=\"item item-divider\">Kid Friendly</li>\n      <li class=\"item\">\n        <h2>Zoo</h2>\n        <p>3.8 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Amusement Park</h2>\n        <p>7.5 miles</p>\n      </li>\n      <li class=\"item\">\n        <h2>Putt Putt</h2>\n        <p>10.4 miles</p>\n      </li>\n    </ul>\n  </ion-content>\n</ion-view>\n"
  },
  {
    "path": "www/views/reservation/reservation.html",
    "content": "<ion-view title=\"Your Reservation\">\n  <ion-content>\n    <div class=\"list card\" ng-if=\"reservation\">\n      <div class=\"item item-icon-left\">\n        <i class=\"icon ion-calendar\"></i> Check in: {{reservation.checkin | date}}\n      </div>\n      <div class=\"item item-icon-left\">\n        <i class=\"icon ion-calendar\"></i> Check out: {{reservation.checkout | date}}\n      </div>\n      <div class=\"item item-icon-left\">\n        <i class=\"icon ion-calendar\"></i> Room service: {{reservation.service | date}}\n      </div>\n      <div class=\"item item-icon-left\">\n        <i class=\"icon ion-home\"></i> Room: {{reservation.room}}\n      </div>\n      <div class=\"item item-icon-left\">\n        <i class=\"icon ion-home\"></i> Type: 2 Bed, 1 Bath\n      </div>\n      <div class=\"item item-icon-left\">\n        <i class=\"icon ion-model-s\"></i> Parking space: {{reservation.parkingSpace}}\n      </div>\n      <div class=\"item item-icon-left\">\n        <i class=\"icon ion-card\"></i> Daily rate: {{reservation.rate | currency}}\n      </div>\n    </div>\n  </ion-content>\n</ion-modal-view>\n"
  },
  {
    "path": "www/views/reservation/reservation.js",
    "content": "angular.module('App').controller('ReservationCtrl', function ($scope, $timeout, $ionicModal, $ionicLoading, $ionicPopup) {\n\n  $ionicLoading.show({\n    template: '<span class=\"icon spin ion-loading-d\"></span> Loading your reservation details'\n  });\n\n  $timeout(function () {\n    var today = new Date();\n    $scope.reservation = {\n      checkin: today,\n      checkout: new Date(today.getTime() + 1000 * 60 * 60 * 24 * 7),\n      service: new Date(today.getTime() + 1000 * 60 * 60 * 24 * 4),\n      room: 156,\n      parkingSpace: 324,\n      rate: 149\n    };\n    $ionicLoading.hide();\n  }, 2000);\n\n});\n"
  },
  {
    "path": "www/views/tour/tour.html",
    "content": "<ion-view title=\"Welcome\" class=\"tour\">\n  <ion-nav-buttons side=\"left\">\n  </ion-nav-buttons>\n  <ion-slide-box>\n    <ion-slide>\n      <img src=\"img/logo.jpg\" />\n      <h2>Welcome to<br />Sunshine Resort</h2>\n    </ion-slide>\n    <ion-slide>\n      <h3>View your reservation</h3>\n      <h3>Call the concierge</h3>\n      <h3>Order room service</h3>\n      <h3>Discover resort events</h3>\n      <h3>Find local places</h3>\n      <h3>and much more!</h3>\n    </ion-slide>\n    <ion-slide>\n      <img src=\"img/logo.jpg\" />\n      <button class=\"button button-full button-positive\" ng-click=\"login()\">Get Started</button>\n    </ion-slide>\n  </ion-slide-box>\n</ion-view>\n"
  },
  {
    "path": "www/views/tour/tour.js",
    "content": "angular.module('App').controller('TourCtrl', function ($scope, $location, $ionicPopup) {\n\n  $scope.login = function () {\n    $ionicPopup.prompt({\n      title: 'Login',\n      inputPlaceholder: 'Enter reservation code',\n      okText: 'Login'\n    }).then(function (code) {\n      // Login with code\n      localStorage.setItem('firstVisit', '1');\n      $location.url('/');\n    });\n  }\n\n});\n"
  },
  {
    "path": "www/views/weather/weather.html",
    "content": "<ion-view title=\"7 Day Forecast\">\n  <ion-content>\n    <div class=\"list card\">\n      <div class=\"item item-divider\">Sunshine Resort Forecast</div>\n      <div class=\"item item-icon-left\" ng-repeat=\"day in weather.list\">\n        <span class=\"icon\"><img ng-src=\"http://openweathermap.org/img/w/{{day.weather[0].icon}}.png\" width=\"32\" /></span> {{day.dt | date:'EEEE'}}, {{day.weather[0].description}}\n        <p>High: {{day.temp.max}}&deg;F Low: {{day.temp.min}}&deg;F</p>\n      </div>\n    </div>\n  </ion-content>\n</ion-modal-view>\n"
  },
  {
    "path": "www/views/weather/weather.js",
    "content": "angular.module('App').controller('WeatherCtrl', function ($scope, $http, $ionicLoading) {\n\n  $ionicLoading.show({\n    template: '<span class=\"icon spin ion-loading-d\"></span> Loading forecast'\n  });\n\n  // You need to get a key from Open Weather Map and put the key in API_KEY_HERE\n  $http.get('http://api.openweathermap.org/data/2.5/forecast/daily?q=Key%20West,FL&cnt=7&units=imperial&APPID=API_KEY_HERE').success(function (data) {\n    $ionicLoading.hide();\n    $scope.weather = data;\n  });\n\n});\n"
  }
]