[
  {
    "path": ".gitignore",
    "content": "*DS_STORE\n/Gemfile.lock\n*.gem\ncoverage/\nlog/\ntmp/\n.ruby-version\nhistory.yml\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: ruby\nrvm:\n  - 2.3.0\n  - 2.2.4\n  - 2.1.8\n\nscript: \"rake test\"\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "<a name=\"issues\"></a>\n## Have an Issue?\n\nDashing is no longer being actively maintained.\n\n1. Check the [Troubleshooting Guide](https://github.com/Shopify/dashing/wiki#how-tos) in the wiki.\n2. Use the [GitHub Issue Search](https://help.github.com/articles/searching-issues/) to check if the issue has already been reported.\n3. You can ask your issue on the tracker, but your best bet is to go to [Stack Overflow](http://stackoverflow.com/questions/tagged/dashing)\n\n\n<a name=\"features\"></a>\n\nIf you feel that you have a really amazing, super neato idea that should be a part of Dashing, it may be a good candidate for an external Gem which supercharges a project. An excellent example of this is\n[dashing-contrib](https://github.com/QubitProducts/dashing-contrib). If you\ndo create a third-party extension for Dashing, please add it [here](https://github.com/Shopify/dashing/wiki/Additional-Widgets#other-third-party-tools).\n\n"
  },
  {
    "path": "Gemfile",
    "content": "source 'https://rubygems.org'\n\ngemspec"
  },
  {
    "path": "MIT-LICENSE",
    "content": "Copyright (c) 2016 Shopify\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# [Dashing](http://shopify.github.com/dashing)\n[![Build Status](https://secure.travis-ci.org/Shopify/dashing.png?branch=master)](http://travis-ci.org/Shopify/dashing)\n\nDashing is a Sinatra based framework that lets you build beautiful dashboards. It looks especially great on TVs.\n\n[Check out the homepage](http://shopify.github.com/dashing).\n\nNote: Dashing is no longer being actively maintained. Read about it [here](https://github.com/Shopify/dashing/issues/711). There is a fork of the project being maintained at at [https://github.com/dashing-io/dashing](https://github.com/dashing-io/dashing)\n\n# License\nDistributed under the [MIT license](MIT-LICENSE)\n"
  },
  {
    "path": "Rakefile",
    "content": "require 'rubygems'\nrequire 'rake'\nrequire 'bundler/gem_tasks'\n\nrequire 'rake/testtask'\nRake::TestTask.new(:test) do |test|\n  test.libs << 'lib' << 'test'\n  test.pattern = 'test/**/*_test.rb'\nend\n\ntask :default => [:test]\n"
  },
  {
    "path": "bin/dashing",
    "content": "#!/usr/bin/env ruby\nrequire \"pathname\"\nbin_file = Pathname.new(__FILE__).realpath\n$:.unshift File.expand_path(\"../../lib\", bin_file)\n\nrequire 'dashing/cli'\nrequire 'dashing/downloader'\nDashing::CLI.source_root(File.expand_path('../../templates', bin_file))\nDashing::CLI.start(ARGV)\n"
  },
  {
    "path": "dashing.gemspec",
    "content": "# -*- encoding: utf-8 -*-\n\nGem::Specification.new do |s|\n  s.name        = 'dashing'\n  s.version     = '1.3.7'\n  s.date        = '2016-04-11'\n  s.executables = %w(dashing)\n\n\n  s.summary     = \"The exceptionally handsome dashboard framework.\"\n  s.description = \"This framework lets you build & easily layout dashboards with your own custom widgets. Use it to make a status boards for your ops team, or use it to track signups, conversion rates, or whatever else metrics you'd like to see in one spot. Included with the framework are ready-made widgets for you to use or customize. All of this code was extracted out of a project at Shopify that displays dashboards on TVs around the office.\"\n  s.author      = \"Daniel Beauchamp\"\n  s.email       = 'daniel.beauchamp@shopify.com'\n  s.homepage    = 'http://shopify.github.com/dashing'\n  s.license     = \"MIT\"\n\n  s.files = Dir['README.md', 'javascripts/**/*', 'templates/**/*','templates/**/.[a-z]*', 'lib/**/*']\n\n  s.add_dependency('sass', '~> 3.2.12')\n  s.add_dependency('coffee-script', '~> 2.2.0')\n  s.add_dependency('execjs', '~> 2.0.2')\n  s.add_dependency('sinatra', '~> 1.4.4')\n  s.add_dependency('sinatra-contrib', '~> 1.4.2')\n  s.add_dependency('thin', '~> 1.6.1')\n  s.add_dependency('rufus-scheduler', '~> 2.0.24')\n  s.add_dependency('thor', '> 0.18.1')\n  s.add_dependency('sprockets', '~> 2.10.1')\n  s.add_dependency('rack', '~> 1.5.4')\n\n  s.add_development_dependency('rake', '~> 10.1.0')\n  s.add_development_dependency('haml', '~> 4.0.4')\n  s.add_development_dependency('minitest', '~> 5.2.0')\n  s.add_development_dependency('mocha', '~> 0.14.0')\n  s.add_development_dependency('fakeweb', '~> 1.3.0')\n  s.add_development_dependency('simplecov', '~> 0.8.2')\nend\n"
  },
  {
    "path": "javascripts/batman.jquery.js",
    "content": "(function() {\n\n  Batman.extend(Batman.DOM, {\n    querySelectorAll: function(node, selector) {\n      return jQuery(selector, node);\n    },\n    querySelector: function(node, selector) {\n      return jQuery(selector, node)[0];\n    },\n    setInnerHTML: function(node, html) {\n      var child, childNodes, result, _i, _j, _len, _len1;\n      childNodes = (function() {\n        var _i, _len, _ref, _results;\n        _ref = node.childNodes;\n        _results = [];\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          child = _ref[_i];\n          _results.push(child);\n        }\n        return _results;\n      })();\n      for (_i = 0, _len = childNodes.length; _i < _len; _i++) {\n        child = childNodes[_i];\n        Batman.DOM.willRemoveNode(child);\n      }\n      result = jQuery(node).html(html);\n      for (_j = 0, _len1 = childNodes.length; _j < _len1; _j++) {\n        child = childNodes[_j];\n        Batman.DOM.didRemoveNode(child);\n      }\n      return result;\n    },\n    removeNode: function(node) {\n      var _ref;\n      Batman.DOM.willRemoveNode(node);\n      if ((_ref = node.parentNode) != null) {\n        _ref.removeChild(node);\n      }\n      return Batman.DOM.didRemoveNode(node);\n    },\n    destroyNode: function(node) {\n      Batman.DOM.willDestroyNode(node);\n      Batman.DOM.willRemoveNode(node);\n      jQuery(node).remove();\n      Batman.DOM.didRemoveNode(node);\n      return Batman.DOM.didDestroyNode(node);\n    },\n    appendChild: function(parent, child) {\n      Batman.DOM.willInsertNode(child);\n      jQuery(parent).append(child);\n      return Batman.DOM.didInsertNode(child);\n    },\n    innerText: function(node) {\n      return jQuery(node).text();\n    }\n  });\n\n  Batman.Request.prototype._parseResponseHeaders = function(xhr) {\n    var headers;\n    return headers = xhr.getAllResponseHeaders().split('\\n').reduce(function(acc, header) {\n      var key, matches, value;\n      if (matches = header.match(/([^:]*):\\s*(.*)/)) {\n        key = matches[1];\n        value = matches[2];\n        acc[key] = value;\n      }\n      return acc;\n    }, {});\n  };\n\n  Batman.Request.prototype._prepareOptions = function(data) {\n    var options, _ref, _this = this;\n    options = {\n      url: this.get('url'),\n      type: this.get('method'),\n      dataType: this.get('type'),\n      data: data || this.get('data'),\n      username: this.get('username'),\n      password: this.get('password'),\n      headers: this.get('headers'),\n      beforeSend: function() {\n        return _this.fire('loading');\n      },\n      success: function(response, textStatus, xhr) {\n        _this.mixin({\n          xhr: xhr,\n          status: xhr.status,\n          response: response,\n          responseHeaders: _this._parseResponseHeaders(xhr)\n        });\n        return _this.fire('success', response);\n      },\n      error: function(xhr, status, error) {\n        _this.mixin({\n          xhr: xhr,\n          status: xhr.status,\n          response: xhr.responseText,\n          responseHeaders: _this._parseResponseHeaders(xhr)\n        });\n        xhr.request = _this;\n        return _this.fire('error', xhr);\n      },\n      complete: function() {\n        return _this.fire('loaded');\n      }\n    };\n    if ((_ref = this.get('method')) === 'PUT' || _ref === 'POST') {\n      if (!this.hasFileUploads()) {\n        options.contentType = this.get('contentType');\n        if (typeof options.data === 'object') {\n          options.processData = false;\n          options.data = Batman.URI.queryFromParams(options.data);\n        }\n      } else {\n        options.contentType = false;\n        options.processData = false;\n        options.data = this.constructor.objectToFormData(options.data);\n      }\n    }\n    return options;\n  };\n\n  Batman.Request.prototype.send = function(data) {\n    return jQuery.ajax(this._prepareOptions(data));\n  };\n\n  Batman.mixins.animation = {\n    show: function(addToParent) {\n      var jq, show, _ref, _ref1;\n      jq = $(this);\n      show = function() {\n        return jq.show(600);\n      };\n      if (addToParent) {\n        if ((_ref = addToParent.append) != null) {\n          _ref.appendChild(this);\n        }\n        if ((_ref1 = addToParent.before) != null) {\n          _ref1.parentNode.insertBefore(this, addToParent.before);\n        }\n        jq.hide();\n        setTimeout(show, 0);\n      } else {\n        show();\n      }\n      return this;\n    },\n    hide: function(removeFromParent) {\n      var _this = this;\n      $(this).hide(600, function() {\n        var _ref;\n        if (removeFromParent) {\n          if ((_ref = _this.parentNode) != null) {\n            _ref.removeChild(_this);\n          }\n        }\n        return Batman.DOM.didRemoveNode(_this);\n      });\n      return this;\n    }\n  };\n\n}).call(this);"
  },
  {
    "path": "javascripts/batman.js",
    "content": "(function() {\n  var Batman, __slice = [].slice;\n\n  Batman = function() {\n    var mixins;\n    mixins = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n    return (function(func, args, ctor) {\n      ctor.prototype = func.prototype;\n      var child = new ctor,\n        result = func.apply(child, args),\n        t = typeof result;\n      return t == \"object\" || t == \"function\" ? result || child : child;\n    })(Batman.Object, mixins, function() {});\n  };\n\n  Batman.version = '0.14.1';\n\n  Batman.config = {\n    pathPrefix: '/',\n    viewPrefix: 'views',\n    fetchRemoteViews: true,\n    usePushState: false,\n    minificationErrors: true\n  };\n\n  (Batman.container = (function() {\n    return this;\n  })()).Batman = Batman;\n\n  if (typeof define === 'function') {\n    define('batman', [], function() {\n      return Batman;\n    });\n  }\n\n  Batman.exportHelpers = function(onto) {\n    var k, _i, _len, _ref;\n    _ref = ['mixin', 'extend', 'unmixin', 'redirect', 'typeOf', 'redirect', 'setImmediate', 'clearImmediate'];\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      k = _ref[_i];\n      onto[\"$\" + k] = Batman[k];\n    }\n    return onto;\n  };\n\n  Batman.exportGlobals = function() {\n    return Batman.exportHelpers(Batman.container);\n  };\n\n}).call(this);\n\n(function() {\n  var _Batman;\n\n  Batman._Batman = _Batman = (function() {\n\n    function _Batman(object) {\n      this.object = object;\n    }\n\n    _Batman.prototype.check = function(object) {\n      if (object !== this.object) {\n        object._batman = new Batman._Batman(object);\n        return false;\n      }\n      return true;\n    };\n\n    _Batman.prototype.get = function(key) {\n      var reduction, results;\n      results = this.getAll(key);\n      switch (results.length) {\n      case 0:\n        return void 0;\n      case 1:\n        return results[0];\n      default:\n        reduction = results[0].concat != null ?\n        function(a, b) {\n          return a.concat(b);\n        } : results[0].merge != null ?\n        function(a, b) {\n          return a.merge(b);\n        } : results.every(function(x) {\n          return typeof x === 'object';\n        }) ? (results.unshift({}), function(a, b) {\n          return Batman.extend(a, b);\n        }) : void 0;\n        if (reduction) {\n          return results.reduceRight(reduction);\n        } else {\n          return results;\n        }\n      }\n    };\n\n    _Batman.prototype.getFirst = function(key) {\n      var results;\n      results = this.getAll(key);\n      return results[0];\n    };\n\n    _Batman.prototype.getAll = function(keyOrGetter) {\n      var getter, results, val;\n      if (typeof keyOrGetter === 'function') {\n        getter = keyOrGetter;\n      } else {\n        getter = function(ancestor) {\n          var _ref;\n          return (_ref = ancestor._batman) != null ? _ref[keyOrGetter] : void 0;\n        };\n      }\n      results = this.ancestors(getter);\n      if (val = getter(this.object)) {\n        results.unshift(val);\n      }\n      return results;\n    };\n\n    _Batman.prototype.ancestors = function(getter) {\n      var ancestor, results, val, _i, _len, _ref;\n      this._allAncestors || (this._allAncestors = this.allAncestors());\n      if (getter) {\n        results = [];\n        _ref = this._allAncestors;\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          ancestor = _ref[_i];\n          val = getter(ancestor);\n          if (val != null) {\n            results.push(val);\n          }\n        }\n        return results;\n      } else {\n        return this._allAncestors;\n      }\n    };\n\n    _Batman.prototype.allAncestors = function() {\n      var isClass, parent, proto, results, _ref, _ref1;\n      results = [];\n      isClass = !! this.object.prototype;\n      parent = isClass ? (_ref = this.object.__super__) != null ? _ref.constructor : void 0 : (proto = Object.getPrototypeOf(this.object)) === this.object ? this.object.constructor.__super__ : proto;\n      if (parent != null) {\n        if ((_ref1 = parent._batman) != null) {\n          _ref1.check(parent);\n        }\n        results.push(parent);\n        if (parent._batman != null) {\n          results = results.concat(parent._batman.allAncestors());\n        }\n      }\n      return results;\n    };\n\n    _Batman.prototype.set = function(key, value) {\n      return this[key] = value;\n    };\n\n    return _Batman;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var chr, _encodedChars, _encodedCharsPattern, _entityMap, _implementImmediates, _objectToString, _unsafeChars, _unsafeCharsPattern, __slice = [].slice,\n    __hasProp = {}.hasOwnProperty,\n    __indexOf = [].indexOf ||\n  function(item) {\n    for (var i = 0, l = this.length; i < l; i++) {\n      if (i in this && this[i] === item) return i;\n    }\n    return -1;\n  };\n\n  Batman.typeOf = function(object) {\n    if (typeof object === 'undefined') {\n      return \"Undefined\";\n    }\n    return _objectToString.call(object).slice(8, -1);\n  };\n\n  _objectToString = Object.prototype.toString;\n\n  Batman.extend = function() {\n    var key, object, objects, to, value, _i, _len;\n    to = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n    for (_i = 0, _len = objects.length; _i < _len; _i++) {\n      object = objects[_i];\n      for (key in object) {\n        value = object[key];\n        to[key] = value;\n      }\n    }\n    return to;\n  };\n\n  Batman.mixin = function() {\n    var hasSet, key, mixin, mixins, to, value, _i, _len;\n    to = arguments[0], mixins = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n    hasSet = typeof to.set === 'function';\n    for (_i = 0, _len = mixins.length; _i < _len; _i++) {\n      mixin = mixins[_i];\n      if (Batman.typeOf(mixin) !== 'Object') {\n        continue;\n      }\n      for (key in mixin) {\n        if (!__hasProp.call(mixin, key)) continue;\n        value = mixin[key];\n        if (key === 'initialize' || key === 'uninitialize' || key === 'prototype') {\n          continue;\n        }\n        if (hasSet) {\n          to.set(key, value);\n        } else if (to.nodeName != null) {\n          Batman.data(to, key, value);\n        } else {\n          to[key] = value;\n        }\n      }\n      if (typeof mixin.initialize === 'function') {\n        mixin.initialize.call(to);\n      }\n    }\n    return to;\n  };\n\n  Batman.unmixin = function() {\n    var from, key, mixin, mixins, _i, _len;\n    from = arguments[0], mixins = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n    for (_i = 0, _len = mixins.length; _i < _len; _i++) {\n      mixin = mixins[_i];\n      for (key in mixin) {\n        if (key === 'initialize' || key === 'uninitialize') {\n          continue;\n        }\n        delete from[key];\n      }\n      if (typeof mixin.uninitialize === 'function') {\n        mixin.uninitialize.call(from);\n      }\n    }\n    return from;\n  };\n\n  Batman._functionName = Batman.functionName = function(f) {\n    var _ref;\n    if (f.__name__) {\n      return f.__name__;\n    }\n    if (f.name) {\n      return f.name;\n    }\n    return (_ref = f.toString().match(/\\W*function\\s+([\\w\\$]+)\\(/)) != null ? _ref[1] : void 0;\n  };\n\n  Batman._isChildOf = Batman.isChildOf = function(parentNode, childNode) {\n    var node;\n    node = childNode.parentNode;\n    while (node) {\n      if (node === parentNode) {\n        return true;\n      }\n      node = node.parentNode;\n    }\n    return false;\n  };\n\n  _implementImmediates = function(container) {\n    var canUsePostMessage, count, functions, getHandle, handler, prefix, tasks;\n    canUsePostMessage = function() {\n      var async, oldMessage;\n      if (!container.postMessage) {\n        return false;\n      }\n      async = true;\n      oldMessage = container.onmessage;\n      container.onmessage = function() {\n        return async = false;\n      };\n      container.postMessage(\"\", \"*\");\n      container.onmessage = oldMessage;\n      return async;\n    };\n    tasks = new Batman.SimpleHash;\n    count = 0;\n    getHandle = function() {\n      return \"go\" + (++count);\n    };\n    if (container.setImmediate && container.clearImmediate) {\n      Batman.setImmediate = container.setImmediate;\n      return Batman.clearImmediate = container.clearImmediate;\n    } else if (canUsePostMessage()) {\n      prefix = 'com.batman.';\n      functions = new Batman.SimpleHash;\n      handler = function(e) {\n        var handle, _base;\n        if (!~e.data.search(prefix)) {\n          return;\n        }\n        handle = e.data.substring(prefix.length);\n        return typeof(_base = tasks.unset(handle)) === \"function\" ? _base() : void 0;\n      };\n      if (container.addEventListener) {\n        container.addEventListener('message', handler, false);\n      } else {\n        container.attachEvent('onmessage', handler);\n      }\n      Batman.setImmediate = function(f) {\n        var handle;\n        tasks.set(handle = getHandle(), f);\n        container.postMessage(prefix + handle, \"*\");\n        return handle;\n      };\n      return Batman.clearImmediate = function(handle) {\n        return tasks.unset(handle);\n      };\n    } else if (typeof document !== 'undefined' && __indexOf.call(document.createElement(\"script\"), \"onreadystatechange\") >= 0) {\n      Batman.setImmediate = function(f) {\n        var handle, script;\n        handle = getHandle();\n        script = document.createElement(\"script\");\n        script.onreadystatechange = function() {\n          var _base;\n          if (typeof(_base = tasks.get(handle)) === \"function\") {\n            _base();\n          }\n          script.onreadystatechange = null;\n          script.parentNode.removeChild(script);\n          return script = null;\n        };\n        document.documentElement.appendChild(script);\n        return handle;\n      };\n      return Batman.clearImmediate = function(handle) {\n        return tasks.unset(handle);\n      };\n    } else if (typeof process !== \"undefined\" && process !== null ? process.nextTick : void 0) {\n      functions = {};\n      Batman.setImmediate = function(f) {\n        var handle;\n        handle = getHandle();\n        functions[handle] = f;\n        process.nextTick(function() {\n          if (typeof functions[handle] === \"function\") {\n            functions[handle]();\n          }\n          return delete functions[handle];\n        });\n        return handle;\n      };\n      return Batman.clearImmediate = function(handle) {\n        return delete functions[handle];\n      };\n    } else {\n      Batman.setImmediate = function(f) {\n        return setTimeout(f, 0);\n      };\n      return Batman.clearImmediate = function(handle) {\n        return clearTimeout(handle);\n      };\n    }\n  };\n\n  Batman.setImmediate = function() {\n    _implementImmediates(Batman.container);\n    return Batman.setImmediate.apply(this, arguments);\n  };\n\n  Batman.clearImmediate = function() {\n    _implementImmediates(Batman.container);\n    return Batman.clearImmediate.apply(this, arguments);\n  };\n\n  Batman.forEach = function(container, iterator, ctx) {\n    var e, i, k, v, _i, _len, _results, _results1;\n    if (container.forEach) {\n      return container.forEach(iterator, ctx);\n    } else if (container.indexOf) {\n      _results = [];\n      for (i = _i = 0, _len = container.length; _i < _len; i = ++_i) {\n        e = container[i];\n        _results.push(iterator.call(ctx, e, i, container));\n      }\n      return _results;\n    } else {\n      _results1 = [];\n      for (k in container) {\n        v = container[k];\n        _results1.push(iterator.call(ctx, k, v, container));\n      }\n      return _results1;\n    }\n  };\n\n  Batman.objectHasKey = function(object, key) {\n    if (typeof object.hasKey === 'function') {\n      return object.hasKey(key);\n    } else {\n      return key in object;\n    }\n  };\n\n  Batman.contains = function(container, item) {\n    if (container.indexOf) {\n      return __indexOf.call(container, item) >= 0;\n    } else if (typeof container.has === 'function') {\n      return container.has(item);\n    } else {\n      return Batman.objectHasKey(container, item);\n    }\n  };\n\n  Batman.get = function(base, key) {\n    if (typeof base.get === 'function') {\n      return base.get(key);\n    } else {\n      return Batman.Property.forBaseAndKey(base, key).getValue();\n    }\n  };\n\n  Batman.getPath = function(base, segments) {\n    var segment, _i, _len;\n    for (_i = 0, _len = segments.length; _i < _len; _i++) {\n      segment = segments[_i];\n      if (base != null) {\n        base = Batman.get(base, segment);\n        if (base == null) {\n          return base;\n        }\n      } else {\n        return void 0;\n      }\n    }\n    return base;\n  };\n\n  _entityMap = {\n    \"&\": \"&amp;\",\n    \"<\": \"&lt;\",\n    \">\": \"&gt;\",\n    \"\\\"\": \"&#34;\",\n    \"'\": \"&#39;\"\n  };\n\n  _unsafeChars = [];\n\n  _encodedChars = [];\n\n  for (chr in _entityMap) {\n    _unsafeChars.push(chr);\n    _encodedChars.push(_entityMap[chr]);\n  }\n\n  _unsafeCharsPattern = new RegExp(\"[\" + (_unsafeChars.join('')) + \"]\", \"g\");\n\n  _encodedCharsPattern = new RegExp(\"(\" + (_encodedChars.join('|')) + \")\", \"g\");\n\n  Batman.escapeHTML = (function() {\n    return function(s) {\n      return (\"\" + s).replace(_unsafeCharsPattern, function(c) {\n        return _entityMap[c];\n      });\n    };\n  })();\n\n  Batman.unescapeHTML = (function() {\n    return function(s) {\n      var node;\n      if (s == null) {\n        return;\n      }\n      node = Batman._unescapeHTMLNode || (Batman._unescapeHTMLNode = document.createElement('DIV'));\n      node.innerHTML = s;\n      return Batman.DOM.innerText(node);\n    };\n  })();\n\n  Batman.translate = function(x, values) {\n    if (values == null) {\n      values = {};\n    }\n    return Batman.helpers.interpolate(Batman.get(Batman.translate.messages, x), values);\n  };\n\n  Batman.translate.messages = {};\n\n  Batman.t = function() {\n    return Batman.translate.apply(Batman, arguments);\n  };\n\n  Batman.redirect = function(url) {\n    var _ref;\n    return (_ref = Batman.navigator) != null ? _ref.redirect(url) : void 0;\n  };\n\n  Batman.initializeObject = function(object) {\n    if (object._batman != null) {\n      return object._batman.check(object);\n    } else {\n      return object._batman = new Batman._Batman(object);\n    }\n  };\n\n}).call(this);\n\n(function() {\n  var __slice = [].slice,\n    __indexOf = [].indexOf ||\n  function(item) {\n    for (var i = 0, l = this.length; i < l; i++) {\n      if (i in this && this[i] === item) return i;\n    }\n    return -1;\n  };\n\n  Batman.Inflector = (function() {\n\n    Inflector.prototype.plural = function(regex, replacement) {\n      return this._plural.unshift([regex, replacement]);\n    };\n\n    Inflector.prototype.singular = function(regex, replacement) {\n      return this._singular.unshift([regex, replacement]);\n    };\n\n    Inflector.prototype.human = function(regex, replacement) {\n      return this._human.unshift([regex, replacement]);\n    };\n\n    Inflector.prototype.uncountable = function() {\n      var strings;\n      strings = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      return this._uncountable = this._uncountable.concat(strings.map(function(x) {\n        return new RegExp(\"\" + x + \"$\", 'i');\n      }));\n    };\n\n    Inflector.prototype.irregular = function(singular, plural) {\n      if (singular.charAt(0) === plural.charAt(0)) {\n        this.plural(new RegExp(\"(\" + (singular.charAt(0)) + \")\" + (singular.slice(1)) + \"$\", \"i\"), \"$1\" + plural.slice(1));\n        this.plural(new RegExp(\"(\" + (singular.charAt(0)) + \")\" + (plural.slice(1)) + \"$\", \"i\"), \"$1\" + plural.slice(1));\n        return this.singular(new RegExp(\"(\" + (plural.charAt(0)) + \")\" + (plural.slice(1)) + \"$\", \"i\"), \"$1\" + singular.slice(1));\n      } else {\n        this.plural(new RegExp(\"\" + singular + \"$\", 'i'), plural);\n        this.plural(new RegExp(\"\" + plural + \"$\", 'i'), plural);\n        return this.singular(new RegExp(\"\" + plural + \"$\", 'i'), singular);\n      }\n    };\n\n    function Inflector() {\n      this._plural = [];\n      this._singular = [];\n      this._uncountable = [];\n      this._human = [];\n    }\n\n    Inflector.prototype.ordinalize = function(number) {\n      var absNumber, _ref;\n      absNumber = Math.abs(parseInt(number));\n      if (_ref = absNumber % 100, __indexOf.call([11, 12, 13], _ref) >= 0) {\n        return number + \"th\";\n      } else {\n        switch (absNumber % 10) {\n        case 1:\n          return number + \"st\";\n        case 2:\n          return number + \"nd\";\n        case 3:\n          return number + \"rd\";\n        default:\n          return number + \"th\";\n        }\n      }\n    };\n\n    Inflector.prototype.pluralize = function(word) {\n      var regex, replace_string, uncountableRegex, _i, _j, _len, _len1, _ref, _ref1, _ref2;\n      _ref = this._uncountable;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        uncountableRegex = _ref[_i];\n        if (uncountableRegex.test(word)) {\n          return word;\n        }\n      }\n      _ref1 = this._plural;\n      for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n        _ref2 = _ref1[_j], regex = _ref2[0], replace_string = _ref2[1];\n        if (regex.test(word)) {\n          return word.replace(regex, replace_string);\n        }\n      }\n      return word;\n    };\n\n    Inflector.prototype.singularize = function(word) {\n      var regex, replace_string, uncountableRegex, _i, _j, _len, _len1, _ref, _ref1, _ref2;\n      _ref = this._uncountable;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        uncountableRegex = _ref[_i];\n        if (uncountableRegex.test(word)) {\n          return word;\n        }\n      }\n      _ref1 = this._singular;\n      for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n        _ref2 = _ref1[_j], regex = _ref2[0], replace_string = _ref2[1];\n        if (regex.test(word)) {\n          return word.replace(regex, replace_string);\n        }\n      }\n      return word;\n    };\n\n    Inflector.prototype.humanize = function(word) {\n      var regex, replace_string, _i, _len, _ref, _ref1;\n      _ref = this._human;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        _ref1 = _ref[_i], regex = _ref1[0], replace_string = _ref1[1];\n        if (regex.test(word)) {\n          return word.replace(regex, replace_string);\n        }\n      }\n      return word;\n    };\n\n    return Inflector;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var Inflector, camelize_rx, capitalize_rx, humanize_rx1, humanize_rx2, humanize_rx3, underscore_rx1, underscore_rx2;\n\n  camelize_rx = /(?:^|_|\\-)(.)/g;\n\n  capitalize_rx = /(^|\\s)([a-z])/g;\n\n  underscore_rx1 = /([A-Z]+)([A-Z][a-z])/g;\n\n  underscore_rx2 = /([a-z\\d])([A-Z])/g;\n\n  humanize_rx1 = /_id$/;\n\n  humanize_rx2 = /_|-/g;\n\n  humanize_rx3 = /^\\w/g;\n\n  Batman.helpers = {\n    ordinalize: function() {\n      return Batman.helpers.inflector.ordinalize.apply(Batman.helpers.inflector, arguments);\n    },\n    singularize: function() {\n      return Batman.helpers.inflector.singularize.apply(Batman.helpers.inflector, arguments);\n    },\n    pluralize: function(count, singular, plural, includeCount) {\n      var result;\n      if (includeCount == null) {\n        includeCount = true;\n      }\n      if (arguments.length < 2) {\n        return Batman.helpers.inflector.pluralize(count);\n      } else {\n        result = +count === 1 ? singular : plural || Batman.helpers.inflector.pluralize(singular);\n        if (includeCount) {\n          result = (\"\" + (count || 0) + \" \") + result;\n        }\n        return result;\n      }\n    },\n    camelize: function(string, firstLetterLower) {\n      string = string.replace(camelize_rx, function(str, p1) {\n        return p1.toUpperCase();\n      });\n      if (firstLetterLower) {\n        return string.substr(0, 1).toLowerCase() + string.substr(1);\n      } else {\n        return string;\n      }\n    },\n    underscore: function(string) {\n      return string.replace(underscore_rx1, '$1_$2').replace(underscore_rx2, '$1_$2').replace('-', '_').toLowerCase();\n    },\n    capitalize: function(string) {\n      return string.replace(capitalize_rx, function(m, p1, p2) {\n        return p1 + p2.toUpperCase();\n      });\n    },\n    trim: function(string) {\n      if (string) {\n        return string.trim();\n      } else {\n        return \"\";\n      }\n    },\n    interpolate: function(stringOrObject, keys) {\n      var key, string, value;\n      if (typeof stringOrObject === 'object') {\n        string = stringOrObject[keys.count];\n        if (!string) {\n          string = stringOrObject['other'];\n        }\n      } else {\n        string = stringOrObject;\n      }\n      for (key in keys) {\n        value = keys[key];\n        string = string.replace(new RegExp(\"%\\\\{\" + key + \"\\\\}\", \"g\"), value);\n      }\n      return string;\n    },\n    humanize: function(string) {\n      string = Batman.helpers.underscore(string);\n      string = Batman.helpers.inflector.humanize(string);\n      return string.replace(humanize_rx1, '').replace(humanize_rx2, ' ').replace(humanize_rx3, function(match) {\n        return match.toUpperCase();\n      });\n    }\n  };\n\n  Inflector = new Batman.Inflector;\n\n  Batman.helpers.inflector = Inflector;\n\n  Inflector.plural(/$/, 's');\n\n  Inflector.plural(/s$/i, 's');\n\n  Inflector.plural(/(ax|test)is$/i, '$1es');\n\n  Inflector.plural(/(octop|vir)us$/i, '$1i');\n\n  Inflector.plural(/(octop|vir)i$/i, '$1i');\n\n  Inflector.plural(/(alias|status)$/i, '$1es');\n\n  Inflector.plural(/(bu)s$/i, '$1ses');\n\n  Inflector.plural(/(buffal|tomat)o$/i, '$1oes');\n\n  Inflector.plural(/([ti])um$/i, '$1a');\n\n  Inflector.plural(/([ti])a$/i, '$1a');\n\n  Inflector.plural(/sis$/i, 'ses');\n\n  Inflector.plural(/(?:([^f])fe|([lr])f)$/i, '$1$2ves');\n\n  Inflector.plural(/(hive)$/i, '$1s');\n\n  Inflector.plural(/([^aeiouy]|qu)y$/i, '$1ies');\n\n  Inflector.plural(/(x|ch|ss|sh)$/i, '$1es');\n\n  Inflector.plural(/(matr|vert|ind)(?:ix|ex)$/i, '$1ices');\n\n  Inflector.plural(/([m|l])ouse$/i, '$1ice');\n\n  Inflector.plural(/([m|l])ice$/i, '$1ice');\n\n  Inflector.plural(/^(ox)$/i, '$1en');\n\n  Inflector.plural(/^(oxen)$/i, '$1');\n\n  Inflector.plural(/(quiz)$/i, '$1zes');\n\n  Inflector.singular(/s$/i, '');\n\n  Inflector.singular(/(n)ews$/i, '$1ews');\n\n  Inflector.singular(/([ti])a$/i, '$1um');\n\n  Inflector.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i, '$1$2sis');\n\n  Inflector.singular(/(^analy)ses$/i, '$1sis');\n\n  Inflector.singular(/([^f])ves$/i, '$1fe');\n\n  Inflector.singular(/(hive)s$/i, '$1');\n\n  Inflector.singular(/(tive)s$/i, '$1');\n\n  Inflector.singular(/([lr])ves$/i, '$1f');\n\n  Inflector.singular(/([^aeiouy]|qu)ies$/i, '$1y');\n\n  Inflector.singular(/(s)eries$/i, '$1eries');\n\n  Inflector.singular(/(m)ovies$/i, '$1ovie');\n\n  Inflector.singular(/(x|ch|ss|sh)es$/i, '$1');\n\n  Inflector.singular(/([m|l])ice$/i, '$1ouse');\n\n  Inflector.singular(/(bus)es$/i, '$1');\n\n  Inflector.singular(/(o)es$/i, '$1');\n\n  Inflector.singular(/(shoe)s$/i, '$1');\n\n  Inflector.singular(/(cris|ax|test)es$/i, '$1is');\n\n  Inflector.singular(/(octop|vir)i$/i, '$1us');\n\n  Inflector.singular(/(alias|status)es$/i, '$1');\n\n  Inflector.singular(/^(ox)en/i, '$1');\n\n  Inflector.singular(/(vert|ind)ices$/i, '$1ex');\n\n  Inflector.singular(/(matr)ices$/i, '$1ix');\n\n  Inflector.singular(/(quiz)zes$/i, '$1');\n\n  Inflector.singular(/(database)s$/i, '$1');\n\n  Inflector.irregular('person', 'people');\n\n  Inflector.irregular('man', 'men');\n\n  Inflector.irregular('child', 'children');\n\n  Inflector.irregular('sex', 'sexes');\n\n  Inflector.irregular('move', 'moves');\n\n  Inflector.irregular('cow', 'kine');\n\n  Inflector.irregular('zombie', 'zombies');\n\n  Inflector.uncountable('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans');\n\n}).call(this);\n\n(function() {\n  var developer;\n\n  Batman.developer = {\n    suppressed: false,\n    DevelopmentError: (function() {\n      var DevelopmentError;\n      DevelopmentError = function(message) {\n        this.message = message;\n        return this.name = \"DevelopmentError\";\n      };\n      DevelopmentError.prototype = Error.prototype;\n      return DevelopmentError;\n    })(),\n    _ie_console: function(f, args) {\n      var arg, _i, _len, _results;\n      if (args.length !== 1) {\n        if (typeof console !== \"undefined\" && console !== null) {\n          console[f](\"...\" + f + \" of \" + args.length + \" items...\");\n        }\n      }\n      _results = [];\n      for (_i = 0, _len = args.length; _i < _len; _i++) {\n        arg = args[_i];\n        _results.push(typeof console !== \"undefined\" && console !== null ? console[f](arg) : void 0);\n      }\n      return _results;\n    },\n    suppress: function(f) {\n      developer.suppressed = true;\n      if (f) {\n        f();\n        return developer.suppressed = false;\n      }\n    },\n    unsuppress: function() {\n      return developer.suppressed = false;\n    },\n    log: function() {\n      if (developer.suppressed || !((typeof console !== \"undefined\" && console !== null ? console.log : void 0) != null)) {\n        return;\n      }\n      if (console.log.apply) {\n        return console.log.apply(console, arguments);\n      } else {\n        return developer._ie_console(\"log\", arguments);\n      }\n    },\n    warn: function() {\n      if (developer.suppressed || !((typeof console !== \"undefined\" && console !== null ? console.warn : void 0) != null)) {\n        return;\n      }\n      if (console.warn.apply) {\n        return console.warn.apply(console, arguments);\n      } else {\n        return developer._ie_console(\"warn\", arguments);\n      }\n    },\n    error: function(message) {\n      throw new developer.DevelopmentError(message);\n    },\n    assert: function(result, message) {\n      if (!result) {\n        return developer.error(message);\n      }\n    },\n    \"do\": function(f) {\n      if (!developer.suppressed) {\n        return f();\n      }\n    },\n    addFilters: function() {\n      return Batman.extend(Batman.Filters, {\n        log: function(value, key) {\n          if (typeof console !== \"undefined\" && console !== null) {\n            if (typeof console.log === \"function\") {\n              console.log(arguments);\n            }\n          }\n          return value;\n        },\n        logStack: function(value) {\n          if (typeof console !== \"undefined\" && console !== null) {\n            if (typeof console.log === \"function\") {\n              console.log(developer.currentFilterStack);\n            }\n          }\n          return value;\n        }\n      });\n    },\n    deprecated: function(deprecatedName, upgradeString) {\n      return Batman.developer.warn(\"\" + deprecatedName + \" has been deprecated.\", upgradeString || '');\n    }\n  };\n\n  developer = Batman.developer;\n\n  Batman.developer.assert((function() {}).bind, \"Error! Batman needs Function.bind to work! Please shim it using something like es5-shim or augmentjs!\");\n\n}).call(this);\n\n(function() {\n\n  Batman.Event = (function() {\n\n    Event.forBaseAndKey = function(base, key) {\n      if (base.isEventEmitter) {\n        return base.event(key);\n      } else {\n        return new Batman.Event(base, key);\n      }\n    };\n\n    function Event(base, key) {\n      this.base = base;\n      this.key = key;\n      this._preventCount = 0;\n    }\n\n    Event.prototype.isEvent = true;\n\n    Event.prototype.isEqual = function(other) {\n      return this.constructor === other.constructor && this.base === other.base && this.key === other.key;\n    };\n\n    Event.prototype.hashKey = function() {\n      var key;\n      this.hashKey = function() {\n        return key;\n      };\n      return key = \"<Batman.Event base: \" + (Batman.Hash.prototype.hashKeyFor(this.base)) + \", key: \\\"\" + (Batman.Hash.prototype.hashKeyFor(this.key)) + \"\\\">\";\n    };\n\n    Event.prototype.addHandler = function(handler) {\n      this.handlers || (this.handlers = []);\n      if (this.handlers.indexOf(handler) === -1) {\n        this.handlers.push(handler);\n      }\n      if (this.oneShot) {\n        this.autofireHandler(handler);\n      }\n      return this;\n    };\n\n    Event.prototype.removeHandler = function(handler) {\n      var index;\n      if (this.handlers && (index = this.handlers.indexOf(handler)) !== -1) {\n        this.handlers.splice(index, 1);\n      }\n      return this;\n    };\n\n    Event.prototype.eachHandler = function(iterator) {\n      var ancestor, key, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _results;\n      if ((_ref = this.handlers) != null) {\n        _ref.slice().forEach(iterator);\n      }\n      if ((_ref1 = this.base) != null ? _ref1.isEventEmitter : void 0) {\n        key = this.key;\n        _ref3 = (_ref2 = this.base._batman) != null ? _ref2.ancestors() : void 0;\n        _results = [];\n        for (_i = 0, _len = _ref3.length; _i < _len; _i++) {\n          ancestor = _ref3[_i];\n          if (ancestor.isEventEmitter && ((_ref4 = ancestor._batman) != null ? (_ref5 = _ref4.events) != null ? _ref5.hasOwnProperty(key) : void 0 : void 0)) {\n            _results.push((_ref6 = ancestor.event(key, false)) != null ? (_ref7 = _ref6.handlers) != null ? _ref7.slice().forEach(iterator) : void 0 : void 0);\n          } else {\n            _results.push(void 0);\n          }\n        }\n        return _results;\n      }\n    };\n\n    Event.prototype.clearHandlers = function() {\n      return this.handlers = void 0;\n    };\n\n    Event.prototype.handlerContext = function() {\n      return this.base;\n    };\n\n    Event.prototype.prevent = function() {\n      return ++this._preventCount;\n    };\n\n    Event.prototype.allow = function() {\n      if (this._preventCount) {\n        --this._preventCount;\n      }\n      return this._preventCount;\n    };\n\n    Event.prototype.isPrevented = function() {\n      return this._preventCount > 0;\n    };\n\n    Event.prototype.autofireHandler = function(handler) {\n      if (this._oneShotFired && (this._oneShotArgs != null)) {\n        return handler.apply(this.handlerContext(), this._oneShotArgs);\n      }\n    };\n\n    Event.prototype.resetOneShot = function() {\n      this._oneShotFired = false;\n      return this._oneShotArgs = null;\n    };\n\n    Event.prototype.fire = function() {\n      return this.fireWithContext(this.handlerContext(), arguments);\n    };\n\n    Event.prototype.fireWithContext = function(context, args) {\n      if (this.isPrevented() || this._oneShotFired) {\n        return false;\n      }\n      if (this.oneShot) {\n        this._oneShotFired = true;\n        this._oneShotArgs = args;\n      }\n      return this.eachHandler(function(handler) {\n        return handler.apply(context, args);\n      });\n    };\n\n    Event.prototype.allowAndFire = function() {\n      return this.allowAndFireWithContext(this.handlerContext, arguments);\n    };\n\n    Event.prototype.allowAndFireWithContext = function(context, args) {\n      this.allow();\n      return this.fireWithContext(context, args);\n    };\n\n    return Event;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PropertyEvent = (function(_super) {\n\n    __extends(PropertyEvent, _super);\n\n    function PropertyEvent() {\n      return PropertyEvent.__super__.constructor.apply(this, arguments);\n    }\n\n    PropertyEvent.prototype.eachHandler = function(iterator) {\n      return this.base.eachObserver(iterator);\n    };\n\n    PropertyEvent.prototype.handlerContext = function() {\n      return this.base.base;\n    };\n\n    return PropertyEvent;\n\n  })(Batman.Event);\n\n}).call(this);\n\n(function() {\n  var __slice = [].slice;\n\n  Batman.EventEmitter = {\n    isEventEmitter: true,\n    hasEvent: function(key) {\n      var _ref, _ref1;\n      return (_ref = this._batman) != null ? typeof _ref.get === \"function\" ? (_ref1 = _ref.get('events')) != null ? _ref1.hasOwnProperty(key) : void 0 : void 0 : void 0;\n    },\n    event: function(key, createEvent) {\n      var ancestor, eventClass, events, existingEvent, newEvent, _base, _i, _len, _ref, _ref1, _ref2, _ref3;\n      if (createEvent == null) {\n        createEvent = true;\n      }\n      Batman.initializeObject(this);\n      eventClass = this.eventClass || Batman.Event;\n      if ((_ref = this._batman.events) != null ? _ref.hasOwnProperty(key) : void 0) {\n        return existingEvent = this._batman.events[key];\n      } else {\n        _ref1 = this._batman.ancestors();\n        for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n          ancestor = _ref1[_i];\n          existingEvent = (_ref2 = ancestor._batman) != null ? (_ref3 = _ref2.events) != null ? _ref3[key] : void 0 : void 0;\n          if (existingEvent) {\n            break;\n          }\n        }\n        if (createEvent || (existingEvent != null ? existingEvent.oneShot : void 0)) {\n          events = (_base = this._batman).events || (_base.events = {});\n          newEvent = events[key] = new eventClass(this, key);\n          newEvent.oneShot = existingEvent != null ? existingEvent.oneShot : void 0;\n          return newEvent;\n        } else {\n          return existingEvent;\n        }\n      }\n    },\n    on: function() {\n      var handler, key, keys, _i, _j, _len, _results;\n      keys = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), handler = arguments[_i++];\n      _results = [];\n      for (_j = 0, _len = keys.length; _j < _len; _j++) {\n        key = keys[_j];\n        _results.push(this.event(key).addHandler(handler));\n      }\n      return _results;\n    },\n    once: function(key, handler) {\n      var event, handlerWrapper;\n      event = this.event(key);\n      handlerWrapper = function() {\n        handler.apply(this, arguments);\n        return event.removeHandler(handlerWrapper);\n      };\n      return event.addHandler(handlerWrapper);\n    },\n    registerAsMutableSource: function() {\n      return Batman.Property.registerSource(this);\n    },\n    mutation: function(wrappedFunction) {\n      return function() {\n        var result, _ref;\n        result = wrappedFunction.apply(this, arguments);\n        if ((_ref = this.event('change', false)) != null) {\n          _ref.fire(this, this);\n        }\n        return result;\n      };\n    },\n    prevent: function(key) {\n      this.event(key).prevent();\n      return this;\n    },\n    allow: function(key) {\n      this.event(key).allow();\n      return this;\n    },\n    isPrevented: function(key) {\n      var _ref;\n      return (_ref = this.event(key, false)) != null ? _ref.isPrevented() : void 0;\n    },\n    fire: function() {\n      var args, key, _ref;\n      key = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n      return (_ref = this.event(key, false)) != null ? _ref.fireWithContext(this, args) : void 0;\n    },\n    allowAndFire: function() {\n      var args, key, _ref;\n      key = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n      return (_ref = this.event(key, false)) != null ? _ref.allowAndFireWithContext(this, args) : void 0;\n    }\n  };\n\n}).call(this);\n\n(function() {\n  var __slice = [].slice;\n\n  Batman.Enumerable = {\n    isEnumerable: true,\n    map: function(f, ctx) {\n      var result;\n      if (ctx == null) {\n        ctx = Batman.container;\n      }\n      result = [];\n      this.forEach(function() {\n        return result.push(f.apply(ctx, arguments));\n      });\n      return result;\n    },\n    mapToProperty: function(key) {\n      var result;\n      result = [];\n      this.forEach(function(item) {\n        return result.push(item.get(key));\n      });\n      return result;\n    },\n    every: function(f, ctx) {\n      var result;\n      if (ctx == null) {\n        ctx = Batman.container;\n      }\n      result = true;\n      this.forEach(function() {\n        return result = result && f.apply(ctx, arguments);\n      });\n      return result;\n    },\n    some: function(f, ctx) {\n      var result;\n      if (ctx == null) {\n        ctx = Batman.container;\n      }\n      result = false;\n      this.forEach(function() {\n        return result = result || f.apply(ctx, arguments);\n      });\n      return result;\n    },\n    reduce: function(f, accumulator) {\n      var count, initialValuePassed, self;\n      count = 0;\n      self = this;\n      if (accumulator != null) {\n        initialValuePassed = true;\n      } else {\n        initialValuePassed = false;\n      }\n      this.forEach(function() {\n        if (!initialValuePassed) {\n          accumulator = arguments[0];\n          initialValuePassed = true;\n          return;\n        }\n        return accumulator = f.apply(null, [accumulator].concat(__slice.call(arguments), [count], [self]));\n      });\n      return accumulator;\n    },\n    filter: function(f) {\n      var result, wrap;\n      result = new this.constructor;\n      if (result.add) {\n        wrap = function(result, element) {\n          if (f(element)) {\n            result.add(element);\n          }\n          return result;\n        };\n      } else if (result.set) {\n        wrap = function(result, key, value) {\n          if (f(key, value)) {\n            result.set(key, value);\n          }\n          return result;\n        };\n      } else {\n        if (!result.push) {\n          result = [];\n        }\n        wrap = function(result, element) {\n          if (f(element)) {\n            result.push(element);\n          }\n          return result;\n        };\n      }\n      return this.reduce(wrap, result);\n    },\n    inGroupsOf: function(groupSize) {\n      var current, i, result;\n      result = [];\n      current = false;\n      i = 0;\n      this.forEach(function(element) {\n        if (i++ % groupSize === 0) {\n          current = [];\n          result.push(current);\n        }\n        return current.push(element);\n      });\n      return result;\n    }\n  };\n\n}).call(this);\n\n(function() {\n  var _objectToString, __slice = [].slice;\n\n  _objectToString = Object.prototype.toString;\n\n  Batman.SimpleHash = (function() {\n\n    function SimpleHash(obj) {\n      this._storage = {};\n      this.length = 0;\n      if (obj != null) {\n        this.update(obj);\n      }\n    }\n\n    Batman.extend(SimpleHash.prototype, Batman.Enumerable);\n\n    SimpleHash.prototype.hasKey = function(key) {\n      var pair, pairs, _i, _len;\n      if (this.objectKey(key)) {\n        if (!this._objectStorage) {\n          return false;\n        }\n        if (pairs = this._objectStorage[this.hashKeyFor(key)]) {\n          for (_i = 0, _len = pairs.length; _i < _len; _i++) {\n            pair = pairs[_i];\n            if (this.equality(pair[0], key)) {\n              return true;\n            }\n          }\n        }\n        return false;\n      } else {\n        key = this.prefixedKey(key);\n        return this._storage.hasOwnProperty(key);\n      }\n    };\n\n    SimpleHash.prototype.get = function(key) {\n      var pair, pairs, _i, _len;\n      if (this.objectKey(key)) {\n        if (!this._objectStorage) {\n          return void 0;\n        }\n        if (pairs = this._objectStorage[this.hashKeyFor(key)]) {\n          for (_i = 0, _len = pairs.length; _i < _len; _i++) {\n            pair = pairs[_i];\n            if (this.equality(pair[0], key)) {\n              return pair[1];\n            }\n          }\n        }\n      } else {\n        return this._storage[this.prefixedKey(key)];\n      }\n    };\n\n    SimpleHash.prototype.set = function(key, val) {\n      var pair, pairs, _base, _i, _len, _name;\n      if (this.objectKey(key)) {\n        this._objectStorage || (this._objectStorage = {});\n        pairs = (_base = this._objectStorage)[_name = this.hashKeyFor(key)] || (_base[_name] = []);\n        for (_i = 0, _len = pairs.length; _i < _len; _i++) {\n          pair = pairs[_i];\n          if (this.equality(pair[0], key)) {\n            return pair[1] = val;\n          }\n        }\n        this.length++;\n        pairs.push([key, val]);\n        return val;\n      } else {\n        key = this.prefixedKey(key);\n        if (this._storage[key] == null) {\n          this.length++;\n        }\n        return this._storage[key] = val;\n      }\n    };\n\n    SimpleHash.prototype.unset = function(key) {\n      var hashKey, index, obj, pair, pairs, val, value, _i, _len, _ref;\n      if (this.objectKey(key)) {\n        if (!this._objectStorage) {\n          return void 0;\n        }\n        hashKey = this.hashKeyFor(key);\n        if (pairs = this._objectStorage[hashKey]) {\n          for (index = _i = 0, _len = pairs.length; _i < _len; index = ++_i) {\n            _ref = pairs[index], obj = _ref[0], value = _ref[1];\n            if (this.equality(obj, key)) {\n              pair = pairs.splice(index, 1);\n              if (!pairs.length) {\n                delete this._objectStorage[hashKey];\n              }\n              this.length--;\n              return pair[0][1];\n            }\n          }\n        }\n      } else {\n        key = this.prefixedKey(key);\n        val = this._storage[key];\n        if (this._storage[key] != null) {\n          this.length--;\n          delete this._storage[key];\n        }\n        return val;\n      }\n    };\n\n    SimpleHash.prototype.getOrSet = function(key, valueFunction) {\n      var currentValue;\n      currentValue = this.get(key);\n      if (!currentValue) {\n        currentValue = valueFunction();\n        this.set(key, currentValue);\n      }\n      return currentValue;\n    };\n\n    SimpleHash.prototype.prefixedKey = function(key) {\n      return \"_\" + key;\n    };\n\n    SimpleHash.prototype.unprefixedKey = function(key) {\n      return key.slice(1);\n    };\n\n    SimpleHash.prototype.hashKeyFor = function(obj) {\n      var hashKey, typeString;\n      if (hashKey = obj != null ? typeof obj.hashKey === \"function\" ? obj.hashKey() : void 0 : void 0) {\n        return hashKey;\n      } else {\n        typeString = _objectToString.call(obj);\n        if (typeString === \"[object Array]\") {\n          return typeString;\n        } else {\n          return obj;\n        }\n      }\n    };\n\n    SimpleHash.prototype.equality = function(lhs, rhs) {\n      if (lhs === rhs) {\n        return true;\n      }\n      if (lhs !== lhs && rhs !== rhs) {\n        return true;\n      }\n      if ((lhs != null ? typeof lhs.isEqual === \"function\" ? lhs.isEqual(rhs) : void 0 : void 0) && (rhs != null ? typeof rhs.isEqual === \"function\" ? rhs.isEqual(lhs) : void 0 : void 0)) {\n        return true;\n      }\n      return false;\n    };\n\n    SimpleHash.prototype.objectKey = function(key) {\n      return typeof key !== 'string';\n    };\n\n    SimpleHash.prototype.forEach = function(iterator, ctx) {\n      var key, obj, results, value, values, _i, _len, _ref, _ref1, _ref2, _ref3;\n      results = [];\n      if (this._objectStorage) {\n        _ref = this._objectStorage;\n        for (key in _ref) {\n          values = _ref[key];\n          _ref1 = values.slice();\n          for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n            _ref2 = _ref1[_i], obj = _ref2[0], value = _ref2[1];\n            results.push(iterator.call(ctx, obj, value, this));\n          }\n        }\n      }\n      _ref3 = this._storage;\n      for (key in _ref3) {\n        value = _ref3[key];\n        results.push(iterator.call(ctx, this.unprefixedKey(key), value, this));\n      }\n      return results;\n    };\n\n    SimpleHash.prototype.keys = function() {\n      var result;\n      result = [];\n      Batman.SimpleHash.prototype.forEach.call(this, function(key) {\n        return result.push(key);\n      });\n      return result;\n    };\n\n    SimpleHash.prototype.toArray = SimpleHash.prototype.keys;\n\n    SimpleHash.prototype.clear = function() {\n      this._storage = {};\n      delete this._objectStorage;\n      return this.length = 0;\n    };\n\n    SimpleHash.prototype.isEmpty = function() {\n      return this.length === 0;\n    };\n\n    SimpleHash.prototype.merge = function() {\n      var hash, merged, others, _i, _len;\n      others = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      merged = new this.constructor;\n      others.unshift(this);\n      for (_i = 0, _len = others.length; _i < _len; _i++) {\n        hash = others[_i];\n        hash.forEach(function(obj, value) {\n          return merged.set(obj, value);\n        });\n      }\n      return merged;\n    };\n\n    SimpleHash.prototype.update = function(object) {\n      var k, v, _results;\n      _results = [];\n      for (k in object) {\n        v = object[k];\n        _results.push(this.set(k, v));\n      }\n      return _results;\n    };\n\n    SimpleHash.prototype.replace = function(object) {\n      var _this = this;\n      this.forEach(function(key, value) {\n        if (!(key in object)) {\n          return _this.unset(key);\n        }\n      });\n      return this.update(object);\n    };\n\n    SimpleHash.prototype.toObject = function() {\n      var key, obj, pair, value, _ref, _ref1;\n      obj = {};\n      _ref = this._storage;\n      for (key in _ref) {\n        value = _ref[key];\n        obj[this.unprefixedKey(key)] = value;\n      }\n      if (this._objectStorage) {\n        _ref1 = this._objectStorage;\n        for (key in _ref1) {\n          pair = _ref1[key];\n          obj[key] = pair[0][1];\n        }\n      }\n      return obj;\n    };\n\n    SimpleHash.prototype.toJSON = SimpleHash.prototype.toObject;\n\n    return SimpleHash;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.AssociationCurator = (function(_super) {\n\n    __extends(AssociationCurator, _super);\n\n    AssociationCurator.availableAssociations = ['belongsTo', 'hasOne', 'hasMany'];\n\n    function AssociationCurator(model) {\n      this.model = model;\n      AssociationCurator.__super__.constructor.call(this);\n      this._byTypeStorage = new Batman.SimpleHash;\n    }\n\n    AssociationCurator.prototype.add = function(association) {\n      var associationTypeSet;\n      this.set(association.label, association);\n      if (!(associationTypeSet = this._byTypeStorage.get(association.associationType))) {\n        associationTypeSet = new Batman.SimpleSet;\n        this._byTypeStorage.set(association.associationType, associationTypeSet);\n      }\n      return associationTypeSet.add(association);\n    };\n\n    AssociationCurator.prototype.getByType = function(type) {\n      return this._byTypeStorage.get(type);\n    };\n\n    AssociationCurator.prototype.getByLabel = function(label) {\n      return this.get(label);\n    };\n\n    AssociationCurator.prototype.reset = function() {\n      this.forEach(function(label, association) {\n        return association.reset();\n      });\n      return true;\n    };\n\n    AssociationCurator.prototype.merge = function() {\n      var others, result;\n      others = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      result = AssociationCurator.__super__.merge.apply(this, arguments);\n      result._byTypeStorage = this._byTypeStorage.merge(others.map(function(other) {\n        return other._byTypeStorage;\n      }));\n      return result;\n    };\n\n    AssociationCurator.prototype._markDirtyAttribute = function(key, oldValue) {\n      var _ref;\n      if ((_ref = this.lifecycle.get('state')) !== 'loading' && _ref !== 'creating' && _ref !== 'saving' && _ref !== 'saved') {\n        if (this.lifecycle.startTransition('set')) {\n          return this.dirtyKeys.set(key, oldValue);\n        } else {\n          throw new Batman.StateMachine.InvalidTransitionError(\"Can't set while in state \" + (this.lifecycle.get('state')));\n        }\n      }\n    };\n\n    return AssociationCurator;\n\n  })(Batman.SimpleHash);\n\n}).call(this);\n\n(function() {\n  var __slice = [].slice;\n\n  Batman.SimpleSet = (function() {\n\n    function SimpleSet() {\n      var item, itemsToAdd;\n      this._storage = [];\n      this.length = 0;\n      itemsToAdd = (function() {\n        var _i, _len, _results;\n        _results = [];\n        for (_i = 0, _len = arguments.length; _i < _len; _i++) {\n          item = arguments[_i];\n          if (item != null) {\n            _results.push(item);\n          }\n        }\n        return _results;\n      }).apply(this, arguments);\n      if (itemsToAdd.length > 0) {\n        this.add.apply(this, itemsToAdd);\n      }\n    }\n\n    Batman.extend(SimpleSet.prototype, Batman.Enumerable);\n\n    SimpleSet.prototype.has = function(item) {\n      return !!(~this._indexOfItem(item));\n    };\n\n    SimpleSet.prototype.add = function() {\n      var addedItems, item, items, _i, _len;\n      items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      addedItems = [];\n      for (_i = 0, _len = items.length; _i < _len; _i++) {\n        item = items[_i];\n        if (!(!~this._indexOfItem(item))) {\n          continue;\n        }\n        this._storage.push(item);\n        addedItems.push(item);\n      }\n      this.length = this._storage.length;\n      if (this.fire && addedItems.length !== 0) {\n        this.fire('change', this, this);\n        this.fire.apply(this, ['itemsWereAdded'].concat(__slice.call(addedItems)));\n      }\n      return addedItems;\n    };\n\n    SimpleSet.prototype.remove = function() {\n      var index, item, items, removedItems, _i, _len;\n      items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      removedItems = [];\n      for (_i = 0, _len = items.length; _i < _len; _i++) {\n        item = items[_i];\n        if (!(~ (index = this._indexOfItem(item)))) {\n          continue;\n        }\n        this._storage.splice(index, 1);\n        removedItems.push(item);\n      }\n      this.length = this._storage.length;\n      if (this.fire && removedItems.length !== 0) {\n        this.fire('change', this, this);\n        this.fire.apply(this, ['itemsWereRemoved'].concat(__slice.call(removedItems)));\n      }\n      return removedItems;\n    };\n\n    SimpleSet.prototype.find = function(f) {\n      var item, _i, _len, _ref;\n      _ref = this._storage;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        item = _ref[_i];\n        if (f(item)) {\n          return item;\n        }\n      }\n    };\n\n    SimpleSet.prototype.forEach = function(iterator, ctx) {\n      var key, _i, _len, _ref, _results;\n      _ref = this._storage;\n      _results = [];\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        key = _ref[_i];\n        _results.push(iterator.call(ctx, key, null, this));\n      }\n      return _results;\n    };\n\n    SimpleSet.prototype.isEmpty = function() {\n      return this.length === 0;\n    };\n\n    SimpleSet.prototype.clear = function() {\n      var items;\n      items = this._storage;\n      this._storage = [];\n      this.length = 0;\n      if (this.fire && items.length !== 0) {\n        this.fire('change', this, this);\n        this.fire.apply(this, ['itemsWereRemoved'].concat(__slice.call(items)));\n      }\n      return items;\n    };\n\n    SimpleSet.prototype.replace = function(other) {\n      try {\n        if (typeof this.prevent === \"function\") {\n          this.prevent('change');\n        }\n        this.clear();\n        return this.add.apply(this, other.toArray());\n      } finally {\n        if (typeof this.allowAndFire === \"function\") {\n          this.allowAndFire('change', this, this);\n        }\n      }\n    };\n\n    SimpleSet.prototype.toArray = function() {\n      return this._storage.slice();\n    };\n\n    SimpleSet.prototype.merge = function() {\n      var merged, others, set, _i, _len;\n      others = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      merged = new this.constructor;\n      others.unshift(this);\n      for (_i = 0, _len = others.length; _i < _len; _i++) {\n        set = others[_i];\n        set.forEach(function(v) {\n          return merged.add(v);\n        });\n      }\n      return merged;\n    };\n\n    SimpleSet.prototype.indexedBy = function(key) {\n      this._indexes || (this._indexes = new Batman.SimpleHash);\n      return this._indexes.get(key) || this._indexes.set(key, new Batman.SetIndex(this, key));\n    };\n\n    SimpleSet.prototype.indexedByUnique = function(key) {\n      this._uniqueIndexes || (this._uniqueIndexes = new Batman.SimpleHash);\n      return this._uniqueIndexes.get(key) || this._uniqueIndexes.set(key, new Batman.UniqueSetIndex(this, key));\n    };\n\n    SimpleSet.prototype.sortedBy = function(key, order) {\n      var sortsForKey;\n      if (order == null) {\n        order = \"asc\";\n      }\n      order = order.toLowerCase() === \"desc\" ? \"desc\" : \"asc\";\n      this._sorts || (this._sorts = new Batman.SimpleHash);\n      sortsForKey = this._sorts.get(key) || this._sorts.set(key, new Batman.Object);\n      return sortsForKey.get(order) || sortsForKey.set(order, new Batman.SetSort(this, key, order));\n    };\n\n    SimpleSet.prototype.equality = Batman.SimpleHash.prototype.equality;\n\n    SimpleSet.prototype._indexOfItem = function(givenItem) {\n      var index, item, _i, _len, _ref;\n      _ref = this._storage;\n      for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {\n        item = _ref[index];\n        if (this.equality(givenItem, item)) {\n          return index;\n        }\n      }\n      return -1;\n    };\n\n    return SimpleSet;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var SOURCE_TRACKER_STACK, SOURCE_TRACKER_STACK_VALID, __slice = [].slice;\n\n  SOURCE_TRACKER_STACK = [];\n\n  SOURCE_TRACKER_STACK_VALID = true;\n\n  Batman.Property = (function() {\n\n    Batman.mixin(Property.prototype, Batman.EventEmitter);\n\n    Property._sourceTrackerStack = SOURCE_TRACKER_STACK;\n\n    Property._sourceTrackerStackValid = SOURCE_TRACKER_STACK_VALID;\n\n    Property.defaultAccessor = {\n      get: function(key) {\n        return this[key];\n      },\n      set: function(key, val) {\n        return this[key] = val;\n      },\n      unset: function(key) {\n        var x;\n        x = this[key];\n        delete this[key];\n        return x;\n      },\n      cache: false\n    };\n\n    Property.defaultAccessorForBase = function(base) {\n      var _ref;\n      return ((_ref = base._batman) != null ? _ref.getFirst('defaultAccessor') : void 0) || Batman.Property.defaultAccessor;\n    };\n\n    Property.accessorForBaseAndKey = function(base, key) {\n      var accessor, ancestor, _bm, _i, _len, _ref, _ref1, _ref2, _ref3;\n      if ((_bm = base._batman) != null) {\n        accessor = (_ref = _bm.keyAccessors) != null ? _ref.get(key) : void 0;\n        if (!accessor) {\n          _ref1 = _bm.ancestors();\n          for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n            ancestor = _ref1[_i];\n            accessor = (_ref2 = ancestor._batman) != null ? (_ref3 = _ref2.keyAccessors) != null ? _ref3.get(key) : void 0 : void 0;\n            if (accessor) {\n              break;\n            }\n          }\n        }\n      }\n      return accessor || this.defaultAccessorForBase(base);\n    };\n\n    Property.forBaseAndKey = function(base, key) {\n      if (base.isObservable) {\n        return base.property(key);\n      } else {\n        return new Batman.Keypath(base, key);\n      }\n    };\n\n    Property.withoutTracking = function(block) {\n      return this.wrapTrackingPrevention(block)();\n    };\n\n    Property.wrapTrackingPrevention = function(block) {\n      return function() {\n        Batman.Property.pushDummySourceTracker();\n        try {\n          return block.apply(this, arguments);\n        } finally {\n          Batman.Property.popSourceTracker();\n        }\n      };\n    };\n\n    Property.registerSource = function(obj) {\n      var set;\n      if (!obj.isEventEmitter) {\n        return;\n      }\n      if (SOURCE_TRACKER_STACK_VALID) {\n        set = SOURCE_TRACKER_STACK[SOURCE_TRACKER_STACK.length - 1];\n      } else {\n        set = [];\n        SOURCE_TRACKER_STACK.push(set);\n        SOURCE_TRACKER_STACK_VALID = true;\n      }\n      if (set != null) {\n        set.push(obj);\n      }\n      return void 0;\n    };\n\n    Property.pushSourceTracker = function() {\n      if (SOURCE_TRACKER_STACK_VALID) {\n        return SOURCE_TRACKER_STACK_VALID = false;\n      } else {\n        return SOURCE_TRACKER_STACK.push([]);\n      }\n    };\n\n    Property.popSourceTracker = function() {\n      if (SOURCE_TRACKER_STACK_VALID) {\n        return SOURCE_TRACKER_STACK.pop();\n      } else {\n        SOURCE_TRACKER_STACK_VALID = true;\n        return void 0;\n      }\n    };\n\n    Property.pushDummySourceTracker = function() {\n      if (!SOURCE_TRACKER_STACK_VALID) {\n        SOURCE_TRACKER_STACK.push([]);\n        SOURCE_TRACKER_STACK_VALID = true;\n      }\n      return SOURCE_TRACKER_STACK.push(null);\n    };\n\n    function Property(base, key) {\n      this.base = base;\n      this.key = key;\n    }\n\n    Property.prototype._isolationCount = 0;\n\n    Property.prototype.cached = false;\n\n    Property.prototype.value = null;\n\n    Property.prototype.sources = null;\n\n    Property.prototype.isProperty = true;\n\n    Property.prototype.isDead = false;\n\n    Property.prototype.eventClass = Batman.PropertyEvent;\n\n    Property.prototype.isEqual = function(other) {\n      return this.constructor === other.constructor && this.base === other.base && this.key === other.key;\n    };\n\n    Property.prototype.hashKey = function() {\n      return this._hashKey || (this._hashKey = \"<Batman.Property base: \" + (Batman.Hash.prototype.hashKeyFor(this.base)) + \", key: \\\"\" + (Batman.Hash.prototype.hashKeyFor(this.key)) + \"\\\">\");\n    };\n\n    Property.prototype.event = function(key) {\n      var eventClass, _base;\n      eventClass = this.eventClass || Batman.Event;\n      this.events || (this.events = {});\n      (_base = this.events)[key] || (_base[key] = new eventClass(this, key));\n      return this.events[key];\n    };\n\n    Property.prototype.changeEvent = function() {\n      return this._changeEvent || (this._changeEvent = this.event('change'));\n    };\n\n    Property.prototype.accessor = function() {\n      return this._accessor || (this._accessor = this.constructor.accessorForBaseAndKey(this.base, this.key));\n    };\n\n    Property.prototype.eachObserver = function(iterator) {\n      var ancestor, handlers, key, object, property, _i, _j, _len, _len1, _ref, _ref1, _ref2, _results;\n      key = this.key;\n      handlers = (_ref = this.changeEvent().handlers) != null ? _ref.slice() : void 0;\n      if (handlers) {\n        for (_i = 0, _len = handlers.length; _i < _len; _i++) {\n          object = handlers[_i];\n          iterator(object);\n        }\n      }\n      if (this.base.isObservable) {\n        _ref1 = this.base._batman.ancestors();\n        _results = [];\n        for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n          ancestor = _ref1[_j];\n          if (ancestor.isObservable && ancestor.hasProperty(key)) {\n            property = ancestor.property(key);\n            handlers = (_ref2 = property.changeEvent().handlers) != null ? _ref2.slice() : void 0;\n            if (handlers) {\n              _results.push((function() {\n                var _k, _len2, _results1;\n                _results1 = [];\n                for (_k = 0, _len2 = handlers.length; _k < _len2; _k++) {\n                  object = handlers[_k];\n                  _results1.push(iterator(object));\n                }\n                return _results1;\n              })());\n            } else {\n              _results.push(void 0);\n            }\n          } else {\n            _results.push(void 0);\n          }\n        }\n        return _results;\n      }\n    };\n\n    Property.prototype.observers = function() {\n      var results;\n      results = [];\n      this.eachObserver(function(observer) {\n        return results.push(observer);\n      });\n      return results;\n    };\n\n    Property.prototype.hasObservers = function() {\n      return this.observers().length > 0;\n    };\n\n    Property.prototype.updateSourcesFromTracker = function() {\n      var handler, newSources, source, _i, _j, _len, _len1, _ref, _ref1, _results;\n      newSources = this.constructor.popSourceTracker();\n      handler = this.sourceChangeHandler();\n      if (this.sources) {\n        _ref = this.sources;\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          source = _ref[_i];\n          if (source != null) {\n            source.event('change').removeHandler(handler);\n          }\n        }\n      }\n      this.sources = newSources;\n      if (this.sources) {\n        _ref1 = this.sources;\n        _results = [];\n        for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n          source = _ref1[_j];\n          _results.push(source != null ? source.event('change').addHandler(handler) : void 0);\n        }\n        return _results;\n      }\n    };\n\n    Property.prototype.getValue = function() {\n      this.registerAsMutableSource();\n      if (!this.isCached()) {\n        this.constructor.pushSourceTracker();\n        try {\n          this.value = this.valueFromAccessor();\n          this.cached = true;\n        } finally {\n          this.updateSourcesFromTracker();\n        }\n      }\n      return this.value;\n    };\n\n    Property.prototype.isCachable = function() {\n      var cacheable;\n      if (this.isFinal()) {\n        return true;\n      }\n      cacheable = this.accessor().cache;\n      if (cacheable != null) {\n        return !!cacheable;\n      } else {\n        return true;\n      }\n    };\n\n    Property.prototype.isCached = function() {\n      return this.isCachable() && this.cached;\n    };\n\n    Property.prototype.isFinal = function() {\n      return !!this.accessor()['final'];\n    };\n\n    Property.prototype.refresh = function() {\n      var previousValue, value;\n      this.cached = false;\n      previousValue = this.value;\n      value = this.getValue();\n      if (value !== previousValue && !this.isIsolated()) {\n        this.fire(value, previousValue);\n      }\n      if (this.value !== void 0 && this.isFinal()) {\n        return this.lockValue();\n      }\n    };\n\n    Property.prototype.sourceChangeHandler = function() {\n      var _this = this;\n      this._sourceChangeHandler || (this._sourceChangeHandler = this._handleSourceChange.bind(this));\n      Batman.developer[\"do\"](function() {\n        return _this._sourceChangeHandler.property = _this;\n      });\n      return this._sourceChangeHandler;\n    };\n\n    Property.prototype._handleSourceChange = function() {\n      if (this.isIsolated()) {\n        return this._needsRefresh = true;\n      } else if (!this.isFinal() && !this.hasObservers()) {\n        return this.cached = false;\n      } else {\n        return this.refresh();\n      }\n    };\n\n    Property.prototype.valueFromAccessor = function() {\n      var _ref;\n      return (_ref = this.accessor().get) != null ? _ref.call(this.base, this.key) : void 0;\n    };\n\n    Property.prototype.setValue = function(val) {\n      var set;\n      if (!(set = this.accessor().set)) {\n        return;\n      }\n      return this._changeValue(function() {\n        return set.call(this.base, this.key, val);\n      });\n    };\n\n    Property.prototype.unsetValue = function() {\n      var unset;\n      if (!(unset = this.accessor().unset)) {\n        return;\n      }\n      return this._changeValue(function() {\n        return unset.call(this.base, this.key);\n      });\n    };\n\n    Property.prototype._changeValue = function(block) {\n      var result;\n      this.cached = false;\n      this.constructor.pushDummySourceTracker();\n      try {\n        result = block.apply(this);\n        this.refresh();\n      } finally {\n        this.constructor.popSourceTracker();\n      }\n      if (!(this.isCached() || this.hasObservers())) {\n        this.die();\n      }\n      return result;\n    };\n\n    Property.prototype.forget = function(handler) {\n      if (handler != null) {\n        return this.changeEvent().removeHandler(handler);\n      } else {\n        return this.changeEvent().clearHandlers();\n      }\n    };\n\n    Property.prototype.observeAndFire = function(handler) {\n      this.observe(handler);\n      return handler.call(this.base, this.value, this.value, this.key);\n    };\n\n    Property.prototype.observe = function(handler) {\n      this.changeEvent().addHandler(handler);\n      if (this.sources == null) {\n        this.getValue();\n      }\n      return this;\n    };\n\n    Property.prototype.observeOnce = function(originalHandler) {\n      var event, handler;\n      event = this.changeEvent();\n      handler = function() {\n        originalHandler.apply(this, arguments);\n        return event.removeHandler(handler);\n      };\n      event.addHandler(handler);\n      if (this.sources == null) {\n        this.getValue();\n      }\n      return this;\n    };\n\n    Property.prototype._removeHandlers = function() {\n      var handler, source, _i, _len, _ref;\n      handler = this.sourceChangeHandler();\n      if (this.sources) {\n        _ref = this.sources;\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          source = _ref[_i];\n          source.event('change').removeHandler(handler);\n        }\n      }\n      delete this.sources;\n      return this.changeEvent().clearHandlers();\n    };\n\n    Property.prototype.lockValue = function() {\n      this._removeHandlers();\n      this.getValue = function() {\n        return this.value;\n      };\n      return this.setValue = this.unsetValue = this.refresh = this.observe = function() {};\n    };\n\n    Property.prototype.die = function() {\n      var _ref, _ref1;\n      this._removeHandlers();\n      if ((_ref = this.base._batman) != null) {\n        if ((_ref1 = _ref.properties) != null) {\n          _ref1.unset(this.key);\n        }\n      }\n      return this.isDead = true;\n    };\n\n    Property.prototype.fire = function() {\n      var _ref;\n      return (_ref = this.changeEvent()).fire.apply(_ref, __slice.call(arguments).concat([this.key]));\n    };\n\n    Property.prototype.isolate = function() {\n      if (this._isolationCount === 0) {\n        this._preIsolationValue = this.getValue();\n      }\n      return this._isolationCount++;\n    };\n\n    Property.prototype.expose = function() {\n      if (this._isolationCount === 1) {\n        this._isolationCount--;\n        if (this._needsRefresh) {\n          this.value = this._preIsolationValue;\n          this.refresh();\n        } else if (this.value !== this._preIsolationValue) {\n          this.fire(this.value, this._preIsolationValue);\n        }\n        return this._preIsolationValue = null;\n      } else if (this._isolationCount > 0) {\n        return this._isolationCount--;\n      }\n    };\n\n    Property.prototype.isIsolated = function() {\n      return this._isolationCount > 0;\n    };\n\n    return Property;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.Keypath = (function(_super) {\n\n    __extends(Keypath, _super);\n\n    function Keypath(base, key) {\n      if (typeof key === 'string') {\n        this.segments = key.split('.');\n        this.depth = this.segments.length;\n      } else {\n        this.segments = [key];\n        this.depth = 1;\n      }\n      Keypath.__super__.constructor.apply(this, arguments);\n    }\n\n    Keypath.prototype.isCachable = function() {\n      if (this.depth === 1) {\n        return Keypath.__super__.isCachable.apply(this, arguments);\n      } else {\n        return true;\n      }\n    };\n\n    Keypath.prototype.terminalProperty = function() {\n      var base;\n      base = Batman.getPath(this.base, this.segments.slice(0, -1));\n      if (base == null) {\n        return;\n      }\n      return Batman.Keypath.forBaseAndKey(base, this.segments[this.depth - 1]);\n    };\n\n    Keypath.prototype.valueFromAccessor = function() {\n      if (this.depth === 1) {\n        return Keypath.__super__.valueFromAccessor.apply(this, arguments);\n      } else {\n        return Batman.getPath(this.base, this.segments);\n      }\n    };\n\n    Keypath.prototype.setValue = function(val) {\n      var _ref;\n      if (this.depth === 1) {\n        return Keypath.__super__.setValue.apply(this, arguments);\n      } else {\n        return (_ref = this.terminalProperty()) != null ? _ref.setValue(val) : void 0;\n      }\n    };\n\n    Keypath.prototype.unsetValue = function() {\n      var _ref;\n      if (this.depth === 1) {\n        return Keypath.__super__.unsetValue.apply(this, arguments);\n      } else {\n        return (_ref = this.terminalProperty()) != null ? _ref.unsetValue() : void 0;\n      }\n    };\n\n    return Keypath;\n\n  })(Batman.Property);\n\n}).call(this);\n\n(function() {\n  var __slice = [].slice;\n\n  Batman.Observable = {\n    isObservable: true,\n    hasProperty: function(key) {\n      var _ref, _ref1;\n      return (_ref = this._batman) != null ? (_ref1 = _ref.properties) != null ? typeof _ref1.hasKey === \"function\" ? _ref1.hasKey(key) : void 0 : void 0 : void 0;\n    },\n    property: function(key) {\n      var properties, propertyClass, _base;\n      Batman.initializeObject(this);\n      propertyClass = this.propertyClass || Batman.Keypath;\n      properties = (_base = this._batman).properties || (_base.properties = new Batman.SimpleHash);\n      return properties.get(key) || properties.set(key, new propertyClass(this, key));\n    },\n    get: function(key) {\n      return this.property(key).getValue();\n    },\n    set: function(key, val) {\n      return this.property(key).setValue(val);\n    },\n    unset: function(key) {\n      return this.property(key).unsetValue();\n    },\n    getOrSet: Batman.SimpleHash.prototype.getOrSet,\n    forget: function(key, observer) {\n      var _ref;\n      if (key) {\n        this.property(key).forget(observer);\n      } else {\n        if ((_ref = this._batman.properties) != null) {\n          _ref.forEach(function(key, property) {\n            return property.forget();\n          });\n        }\n      }\n      return this;\n    },\n    observe: function() {\n      var args, key, _ref;\n      key = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n      (_ref = this.property(key)).observe.apply(_ref, args);\n      return this;\n    },\n    observeAndFire: function() {\n      var args, key, _ref;\n      key = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n      (_ref = this.property(key)).observeAndFire.apply(_ref, args);\n      return this;\n    },\n    observeOnce: function() {\n      var args, key, _ref;\n      key = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n      (_ref = this.property(key)).observeOnce.apply(_ref, args);\n      return this;\n    }\n  };\n\n}).call(this);\n\n(function() {\n\n  Batman.DOM = {\n    textInputTypes: ['text', 'search', 'tel', 'url', 'email', 'password'],\n    scrollIntoView: function(elementID) {\n      var _ref;\n      return (_ref = document.getElementById(elementID)) != null ? typeof _ref.scrollIntoView === \"function\" ? _ref.scrollIntoView() : void 0 : void 0;\n    },\n    partial: function(container, path, context, renderer) {\n      var view;\n      renderer.prevent('rendered');\n      view = new Batman.View({\n        source: path,\n        context: context\n      });\n      return view.on('ready', function() {\n        Batman.DOM.setInnerHTML(container, '');\n        Batman.DOM.appendChild(container, view.get('node'));\n        return renderer.allowAndFire('rendered');\n      });\n    },\n    propagateBindingEvent: function(binding, node) {\n      var current, parentBinding, parentBindings, _i, _len;\n      while ((current = (current || node).parentNode)) {\n        parentBindings = Batman._data(current, 'bindings');\n        if (parentBindings != null) {\n          for (_i = 0, _len = parentBindings.length; _i < _len; _i++) {\n            parentBinding = parentBindings[_i];\n            if (typeof parentBinding.childBindingAdded === \"function\") {\n              parentBinding.childBindingAdded(binding);\n            }\n          }\n        }\n      }\n    },\n    propagateBindingEvents: function(newNode) {\n      var binding, bindings, child, _i, _j, _len, _len1, _ref;\n      _ref = newNode.childNodes;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        child = _ref[_i];\n        Batman.DOM.propagateBindingEvents(child);\n      }\n      if (bindings = Batman._data(newNode, 'bindings')) {\n        for (_j = 0, _len1 = bindings.length; _j < _len1; _j++) {\n          binding = bindings[_j];\n          Batman.DOM.propagateBindingEvent(binding, newNode);\n        }\n      }\n    },\n    trackBinding: function(binding, node) {\n      var bindings;\n      if (bindings = Batman._data(node, 'bindings')) {\n        bindings.push(binding);\n      } else {\n        Batman._data(node, 'bindings', [binding]);\n      }\n      Batman.DOM.fire('bindingAdded', binding);\n      Batman.DOM.propagateBindingEvent(binding, node);\n      return true;\n    },\n    onParseExit: function(node, callback) {\n      var set;\n      set = Batman._data(node, 'onParseExit') || Batman._data(node, 'onParseExit', new Batman.SimpleSet);\n      if (callback != null) {\n        set.add(callback);\n      }\n      return set;\n    },\n    forgetParseExit: function(node, callback) {\n      return Batman.removeData(node, 'onParseExit', true);\n    },\n    defineView: function(name, node) {\n      var contents;\n      contents = node.innerHTML;\n      Batman.View.store.set(Batman.Navigator.normalizePath(name), contents);\n      return contents;\n    },\n    setStyleProperty: function(node, property, value, importance) {\n      if (node.style.setProperty) {\n        return node.style.setProperty(property, value, importance);\n      } else {\n        return node.style.setAttribute(property, value, importance);\n      }\n    },\n    removeOrDestroyNode: function(node) {\n      var view;\n      view = Batman._data(node, 'view');\n      view || (view = Batman._data(node, 'yielder'));\n      if ((view != null) && view.get('cached')) {\n        return Batman.DOM.removeNode(node);\n      } else {\n        return Batman.DOM.destroyNode(node);\n      }\n    },\n    insertBefore: function(parentNode, newNode, referenceNode) {\n      if (referenceNode == null) {\n        referenceNode = null;\n      }\n      if (!referenceNode || parentNode.childNodes.length <= 0) {\n        return Batman.DOM.appendChild(parentNode, newNode);\n      } else {\n        Batman.DOM.willInsertNode(newNode);\n        parentNode.insertBefore(newNode, referenceNode);\n        return Batman.DOM.didInsertNode(newNode);\n      }\n    },\n    valueForNode: function(node, value, escapeValue) {\n      var isSetting;\n      if (value == null) {\n        value = '';\n      }\n      if (escapeValue == null) {\n        escapeValue = true;\n      }\n      isSetting = arguments.length > 1;\n      switch (node.nodeName.toUpperCase()) {\n      case 'INPUT':\n      case 'TEXTAREA':\n        if (isSetting) {\n          return node.value = value;\n        } else {\n          return node.value;\n        }\n        break;\n      case 'SELECT':\n        if (isSetting) {\n          return node.value = value;\n        }\n        break;\n      default:\n        if (isSetting) {\n          return Batman.DOM.setInnerHTML(node, escapeValue ? Batman.escapeHTML(value) : value);\n        } else {\n          return node.innerHTML;\n        }\n      }\n    },\n    nodeIsEditable: function(node) {\n      var _ref;\n      return (_ref = node.nodeName.toUpperCase()) === 'INPUT' || _ref === 'TEXTAREA' || _ref === 'SELECT';\n    },\n    addEventListener: function(node, eventName, callback) {\n      var listeners;\n      if (!(listeners = Batman._data(node, 'listeners'))) {\n        listeners = Batman._data(node, 'listeners', {});\n      }\n      if (!listeners[eventName]) {\n        listeners[eventName] = [];\n      }\n      listeners[eventName].push(callback);\n      if (Batman.DOM.hasAddEventListener) {\n        return node.addEventListener(eventName, callback, false);\n      } else {\n        return node.attachEvent(\"on\" + eventName, callback);\n      }\n    },\n    removeEventListener: function(node, eventName, callback) {\n      var eventListeners, index, listeners;\n      if (listeners = Batman._data(node, 'listeners')) {\n        if (eventListeners = listeners[eventName]) {\n          index = eventListeners.indexOf(callback);\n          if (index !== -1) {\n            eventListeners.splice(index, 1);\n          }\n        }\n      }\n      if (Batman.DOM.hasAddEventListener) {\n        return node.removeEventListener(eventName, callback, false);\n      } else {\n        return node.detachEvent('on' + eventName, callback);\n      }\n    },\n    hasAddEventListener: !! (typeof window !== \"undefined\" && window !== null ? window.addEventListener : void 0),\n    preventDefault: function(e) {\n      if (typeof e.preventDefault === \"function\") {\n        return e.preventDefault();\n      } else {\n        return e.returnValue = false;\n      }\n    },\n    stopPropagation: function(e) {\n      if (e.stopPropagation) {\n        return e.stopPropagation();\n      } else {\n        return e.cancelBubble = true;\n      }\n    },\n    willInsertNode: function(node) {\n      var child, view, _i, _len, _ref, _ref1;\n      view = Batman._data(node, 'view');\n      if (view != null) {\n        view.fire('beforeAppear', node);\n      }\n      if ((_ref = Batman.data(node, 'show')) != null) {\n        _ref.call(node);\n      }\n      _ref1 = node.childNodes;\n      for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n        child = _ref1[_i];\n        Batman.DOM.willInsertNode(child);\n      }\n      return true;\n    },\n    didInsertNode: function(node) {\n      var child, view, _i, _len, _ref;\n      view = Batman._data(node, 'view');\n      if (view) {\n        view.fire('appear', node);\n        view.applyYields();\n      }\n      _ref = node.childNodes;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        child = _ref[_i];\n        Batman.DOM.didInsertNode(child);\n      }\n      return true;\n    },\n    willRemoveNode: function(node) {\n      var child, view, _i, _len, _ref, _ref1;\n      view = Batman._data(node, 'view');\n      if (view) {\n        view.fire('beforeDisappear', node);\n      }\n      if ((_ref = Batman.data(node, 'hide')) != null) {\n        _ref.call(node);\n      }\n      _ref1 = node.childNodes;\n      for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n        child = _ref1[_i];\n        Batman.DOM.willRemoveNode(child);\n      }\n      return true;\n    },\n    didRemoveNode: function(node) {\n      var child, view, _i, _len, _ref;\n      view = Batman._data(node, 'view');\n      if (view) {\n        view.retractYields();\n        view.fire('disappear', node);\n      }\n      _ref = node.childNodes;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        child = _ref[_i];\n        Batman.DOM.didRemoveNode(child);\n      }\n      return true;\n    },\n    willDestroyNode: function(node) {\n      var child, view, _i, _len, _ref;\n      view = Batman._data(node, 'view');\n      if (view) {\n        view.fire('beforeDestroy', node);\n        view.get('yields').forEach(function(name, actions) {\n          var _i, _len, _results;\n          _results = [];\n          for (_i = 0, _len = actions.length; _i < _len; _i++) {\n            node = actions[_i].node;\n            _results.push(Batman.DOM.willDestroyNode(node));\n          }\n          return _results;\n        });\n      }\n      _ref = node.childNodes;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        child = _ref[_i];\n        Batman.DOM.willDestroyNode(child);\n      }\n      return true;\n    },\n    didDestroyNode: function(node) {\n      var bindings, child, eventListeners, eventName, listeners, view, _i, _len, _ref;\n      view = Batman._data(node, 'view');\n      if (view) {\n        view.die();\n      }\n      if (bindings = Batman._data(node, 'bindings')) {\n        bindings.forEach(function(binding) {\n          return binding.die();\n        });\n      }\n      if (listeners = Batman._data(node, 'listeners')) {\n        for (eventName in listeners) {\n          eventListeners = listeners[eventName];\n          eventListeners.forEach(function(listener) {\n            return Batman.DOM.removeEventListener(node, eventName, listener);\n          });\n        }\n      }\n      Batman.removeData(node);\n      Batman.removeData(node, void 0, true);\n      _ref = node.childNodes;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        child = _ref[_i];\n        Batman.DOM.didDestroyNode(child);\n      }\n      return true;\n    }\n  };\n\n  Batman.mixin(Batman.DOM, Batman.EventEmitter, Batman.Observable);\n\n  Batman.DOM.event('bindingAdded');\n\n}).call(this);\n\n(function() {\n\n  Batman.DOM.ReaderBindingDefinition = (function() {\n\n    function ReaderBindingDefinition(node, keyPath, context, renderer) {\n      this.node = node;\n      this.keyPath = keyPath;\n      this.context = context;\n      this.renderer = renderer;\n    }\n\n    return ReaderBindingDefinition;\n\n  })();\n\n  Batman.BindingDefinitionOnlyObserve = {\n    Data: 'data',\n    Node: 'node',\n    All: 'all',\n    None: 'none'\n  };\n\n  Batman.DOM.readers = {\n    target: function(definition) {\n      definition.onlyObserve = Batman.BindingDefinitionOnlyObserve.Node;\n      return Batman.DOM.readers.bind(definition);\n    },\n    source: function(definition) {\n      definition.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n      return Batman.DOM.readers.bind(definition);\n    },\n    bind: function(definition) {\n      var bindingClass, node;\n      node = definition.node;\n      switch (node.nodeName.toLowerCase()) {\n      case 'input':\n        switch (node.getAttribute('type')) {\n        case 'checkbox':\n          definition.attr = 'checked';\n          Batman.DOM.attrReaders.bind(definition);\n          return true;\n        case 'radio':\n          bindingClass = Batman.DOM.RadioBinding;\n          break;\n        case 'file':\n          bindingClass = Batman.DOM.FileBinding;\n        }\n        break;\n      case 'select':\n        bindingClass = Batman.DOM.SelectBinding;\n      }\n      bindingClass || (bindingClass = Batman.DOM.ValueBinding);\n      return new bindingClass(definition);\n    },\n    context: function(definition) {\n      return definition.context.descendWithDefinition(definition);\n    },\n    mixin: function(definition) {\n      definition.context = definition.context.descend(Batman.mixins);\n      return new Batman.DOM.MixinBinding(definition);\n    },\n    showif: function(definition) {\n      return new Batman.DOM.ShowHideBinding(definition);\n    },\n    hideif: function(definition) {\n      definition.invert = true;\n      return new Batman.DOM.ShowHideBinding(definition);\n    },\n    insertif: function(definition) {\n      return new Batman.DOM.InsertionBinding(definition);\n    },\n    removeif: function(definition) {\n      definition.invert = true;\n      return new Batman.DOM.InsertionBinding(definition);\n    },\n    route: function(definition) {\n      return new Batman.DOM.RouteBinding(definition);\n    },\n    view: function(definition) {\n      return new Batman.DOM.ViewBinding(definition);\n    },\n    partial: function(definition) {\n      return Batman.DOM.partial(definition.node, definition.keyPath, definition.context, definition.renderer);\n    },\n    defineview: function(definition) {\n      var node;\n      node = definition.node;\n      Batman.DOM.onParseExit(node, function() {\n        var _ref;\n        return (_ref = node.parentNode) != null ? _ref.removeChild(node) : void 0;\n      });\n      Batman.DOM.defineView(definition.keyPath, node);\n      return {\n        skipChildren: true\n      };\n    },\n    renderif: function(definition) {\n      return new Batman.DOM.DeferredRenderingBinding(definition);\n    },\n    \"yield\": function(definition) {\n      var keyPath, node;\n      node = definition.node, keyPath = definition.keyPath;\n      return Batman.DOM.onParseExit(node, function() {\n        return Batman.DOM.Yield.withName(keyPath).set('containerNode', node);\n      });\n    },\n    contentfor: function(definition) {\n      var keyPath, node, renderer, swapMethod, value;\n      node = definition.node, value = definition.value, swapMethod = definition.swapMethod, renderer = definition.renderer, keyPath = definition.keyPath;\n      swapMethod || (swapMethod = 'append');\n      return Batman.DOM.onParseExit(node, function() {\n        var _ref;\n        if ((_ref = node.parentNode) != null) {\n          _ref.removeChild(node);\n        }\n        return renderer.view.pushYieldAction(keyPath, swapMethod, node);\n      });\n    },\n    replace: function(definition) {\n      definition.swapMethod = 'replace';\n      return Batman.DOM.readers.contentfor(definition);\n    }\n  };\n\n}).call(this);\n\n(function() {\n  var __slice = [].slice,\n    __indexOf = [].indexOf ||\n  function(item) {\n    for (var i = 0, l = this.length; i < l; i++) {\n      if (i in this && this[i] === item) return i;\n    }\n    return -1;\n  };\n\n  Batman.DOM.events = {\n    click: function(node, callback, context, eventName) {\n      if (eventName == null) {\n        eventName = 'click';\n      }\n      Batman.DOM.addEventListener(node, eventName, function() {\n        var args, event;\n        event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n        if (event.metaKey || event.ctrlKey || event.button === 1) {\n          return;\n        }\n        Batman.DOM.preventDefault(event);\n        if (!Batman.DOM.eventIsAllowed(eventName, event)) {\n          return;\n        }\n        return callback.apply(null, [node, event].concat(__slice.call(args), [context]));\n      });\n      if (node.nodeName.toUpperCase() === 'A' && !node.href) {\n        node.href = '#';\n      }\n      return node;\n    },\n    doubleclick: function(node, callback, context) {\n      return Batman.DOM.events.click(node, callback, context, 'dblclick');\n    },\n    change: function(node, callback, context) {\n      var eventName, eventNames, oldCallback, _i, _len, _results;\n      eventNames = (function() {\n        var _ref;\n        switch (node.nodeName.toUpperCase()) {\n        case 'TEXTAREA':\n          return ['input', 'keyup', 'change'];\n        case 'INPUT':\n          if (_ref = node.type.toLowerCase(), __indexOf.call(Batman.DOM.textInputTypes, _ref) >= 0) {\n            oldCallback = callback;\n            callback = function(node, event) {\n              if (event.type === 'keyup' && Batman.DOM.events.isEnter(event)) {\n                return;\n              }\n              return oldCallback(node, event);\n            };\n            return ['input', 'keyup', 'change'];\n          } else {\n            return ['input', 'change'];\n          }\n          break;\n        default:\n          return ['change'];\n        }\n      })();\n      _results = [];\n      for (_i = 0, _len = eventNames.length; _i < _len; _i++) {\n        eventName = eventNames[_i];\n        _results.push(Batman.DOM.addEventListener(node, eventName, function() {\n          var args;\n          args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n          return callback.apply(null, [node].concat(__slice.call(args), [context]));\n        }));\n      }\n      return _results;\n    },\n    isEnter: function(ev) {\n      var _ref, _ref1;\n      return ((13 <= (_ref = ev.keyCode) && _ref <= 14)) || ((13 <= (_ref1 = ev.which) && _ref1 <= 14)) || ev.keyIdentifier === 'Enter' || ev.key === 'Enter';\n    },\n    submit: function(node, callback, context) {\n      if (Batman.DOM.nodeIsEditable(node)) {\n        Batman.DOM.addEventListener(node, 'keydown', function() {\n          var args;\n          args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n          if (Batman.DOM.events.isEnter(args[0])) {\n            return Batman.DOM._keyCapturingNode = node;\n          }\n        });\n        Batman.DOM.addEventListener(node, 'keyup', function() {\n          var args;\n          args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n          if (Batman.DOM.events.isEnter(args[0])) {\n            if (Batman.DOM._keyCapturingNode === node) {\n              Batman.DOM.preventDefault(args[0]);\n              callback.apply(null, [node].concat(__slice.call(args), [context]));\n            }\n            return Batman.DOM._keyCapturingNode = null;\n          }\n        });\n      } else {\n        Batman.DOM.addEventListener(node, 'submit', function() {\n          var args;\n          args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n          Batman.DOM.preventDefault(args[0]);\n          return callback.apply(null, [node].concat(__slice.call(args), [context]));\n        });\n      }\n      return node;\n    },\n    other: function(node, eventName, callback, context) {\n      return Batman.DOM.addEventListener(node, eventName, function() {\n        var args;\n        args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        return callback.apply(null, [node].concat(__slice.call(args), [context]));\n      });\n    }\n  };\n\n  Batman.DOM.eventIsAllowed = function(eventName, event) {\n    var delegate, _ref, _ref1;\n    if (delegate = (_ref = Batman.currentApp) != null ? (_ref1 = _ref.shouldAllowEvent) != null ? _ref1[eventName] : void 0 : void 0) {\n      if (delegate(event) === false) {\n        return false;\n      }\n    }\n    return true;\n  };\n\n}).call(this);\n\n(function() {\n\n  Batman.DOM.AttrReaderBindingDefinition = (function() {\n\n    function AttrReaderBindingDefinition(node, attr, keyPath, context, renderer) {\n      this.node = node;\n      this.attr = attr;\n      this.keyPath = keyPath;\n      this.context = context;\n      this.renderer = renderer;\n    }\n\n    return AttrReaderBindingDefinition;\n\n  })();\n\n  Batman.DOM.attrReaders = {\n    _parseAttribute: function(value) {\n      if (value === 'false') {\n        value = false;\n      }\n      if (value === 'true') {\n        value = true;\n      }\n      return value;\n    },\n    source: function(definition) {\n      definition.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n      return Batman.DOM.attrReaders.bind(definition);\n    },\n    bind: function(definition) {\n      var bindingClass;\n      bindingClass = (function() {\n        switch (definition.attr) {\n        case 'checked':\n        case 'disabled':\n        case 'selected':\n          return Batman.DOM.CheckedBinding;\n        case 'value':\n        case 'href':\n        case 'src':\n        case 'size':\n          return Batman.DOM.NodeAttributeBinding;\n        case 'class':\n          return Batman.DOM.ClassBinding;\n        case 'style':\n          return Batman.DOM.StyleBinding;\n        default:\n          return Batman.DOM.AttributeBinding;\n        }\n      })();\n      return new bindingClass(definition);\n    },\n    context: function(definition) {\n      return definition.context.descendWithDefinition(definition);\n    },\n    event: function(definition) {\n      return new Batman.DOM.EventBinding(definition);\n    },\n    addclass: function(definition) {\n      return new Batman.DOM.AddClassBinding(definition);\n    },\n    removeclass: function(definition) {\n      definition.invert = true;\n      return new Batman.DOM.AddClassBinding(definition);\n    },\n    foreach: function(definition) {\n      return new Batman.DOM.IteratorBinding(definition);\n    },\n    formfor: function(definition) {\n      new Batman.DOM.FormBinding(definition);\n      return definition.context.descendWithDefinition(definition);\n    }\n  };\n\n}).call(this);\n\n(function() {\n  var BatmanObject, ObjectFunctions, getAccessorObject, promiseWrapper, wrapSingleAccessor, __slice = [].slice,\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  getAccessorObject = function(base, accessor) {\n    var deprecated, _i, _len, _ref;\n    if (typeof accessor === 'function') {\n      accessor = {\n        get: accessor\n      };\n    }\n    _ref = ['cachable', 'cacheable'];\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      deprecated = _ref[_i];\n      if (deprecated in accessor) {\n        Batman.developer.warn(\"Property accessor option \\\"\" + deprecated + \"\\\" is deprecated. Use \\\"cache\\\" instead.\");\n        if (!('cache' in accessor)) {\n          accessor.cache = accessor[deprecated];\n        }\n      }\n    }\n    return accessor;\n  };\n\n  promiseWrapper = function(fetcher) {\n    return function(defaultAccessor) {\n      return {\n        get: function(key) {\n          var asyncDeliver, existingValue, newValue, _base, _base1, _ref, _ref1, _this = this;\n          if ((existingValue = defaultAccessor.get.apply(this, arguments)) != null) {\n            return existingValue;\n          }\n          asyncDeliver = false;\n          newValue = void 0;\n          if ((_ref = (_base = this._batman).promises) == null) {\n            _base.promises = {};\n          }\n          if ((_ref1 = (_base1 = this._batman.promises)[key]) == null) {\n            _base1[key] = (function() {\n              var deliver, returnValue;\n              deliver = function(err, result) {\n                if (asyncDeliver) {\n                  _this.set(key, result);\n                }\n                return newValue = result;\n              };\n              returnValue = fetcher.call(_this, deliver, key);\n              if (newValue == null) {\n                newValue = returnValue;\n              }\n              return true;\n            })();\n          }\n          asyncDeliver = true;\n          return newValue;\n        },\n        cache: true\n      };\n    };\n  };\n\n  wrapSingleAccessor = function(core, wrapper) {\n    var k, v;\n    wrapper = (typeof wrapper === \"function\" ? wrapper(core) : void 0) || wrapper;\n    for (k in core) {\n      v = core[k];\n      if (!(k in wrapper)) {\n        wrapper[k] = v;\n      }\n    }\n    return wrapper;\n  };\n\n  ObjectFunctions = {\n    _defineAccessor: function() {\n      var accessor, key, keys, _base, _i, _j, _len, _ref, _results;\n      keys = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), accessor = arguments[_i++];\n      if (!(accessor != null)) {\n        return Batman.Property.defaultAccessorForBase(this);\n      } else if (keys.length === 0 && ((_ref = Batman.typeOf(accessor)) !== 'Object' && _ref !== 'Function')) {\n        return Batman.Property.accessorForBaseAndKey(this, accessor);\n      } else if (typeof accessor.promise === 'function') {\n        return this._defineWrapAccessor.apply(this, __slice.call(keys).concat([promiseWrapper(accessor.promise)]));\n      }\n      Batman.initializeObject(this);\n      if (keys.length === 0) {\n        return this._batman.defaultAccessor = getAccessorObject(this, accessor);\n      } else {\n        (_base = this._batman).keyAccessors || (_base.keyAccessors = new Batman.SimpleHash);\n        _results = [];\n        for (_j = 0, _len = keys.length; _j < _len; _j++) {\n          key = keys[_j];\n          _results.push(this._batman.keyAccessors.set(key, getAccessorObject(this, accessor)));\n        }\n        return _results;\n      }\n    },\n    _defineWrapAccessor: function() {\n      var key, keys, wrapper, _i, _j, _len, _results;\n      keys = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), wrapper = arguments[_i++];\n      Batman.initializeObject(this);\n      if (keys.length === 0) {\n        return this._defineAccessor(wrapSingleAccessor(this._defineAccessor(), wrapper));\n      } else {\n        _results = [];\n        for (_j = 0, _len = keys.length; _j < _len; _j++) {\n          key = keys[_j];\n          _results.push(this._defineAccessor(key, wrapSingleAccessor(this._defineAccessor(key), wrapper)));\n        }\n        return _results;\n      }\n    },\n    _resetPromises: function() {\n      var key;\n      if (this._batman.promises == null) {\n        return;\n      }\n      for (key in this._batman.promises) {\n        this._resetPromise(key);\n      }\n    },\n    _resetPromise: function(key) {\n      this.unset(key);\n      this.property(key).cached = false;\n      delete this._batman.promises[key];\n    }\n  };\n\n  BatmanObject = (function(_super) {\n    var counter;\n\n    __extends(BatmanObject, _super);\n\n    Batman.initializeObject(BatmanObject);\n\n    Batman.initializeObject(BatmanObject.prototype);\n\n    Batman.mixin(BatmanObject.prototype, ObjectFunctions, Batman.EventEmitter, Batman.Observable);\n\n    Batman.mixin(BatmanObject, ObjectFunctions, Batman.EventEmitter, Batman.Observable);\n\n    BatmanObject.classMixin = function() {\n      return Batman.mixin.apply(Batman, [this].concat(__slice.call(arguments)));\n    };\n\n    BatmanObject.mixin = function() {\n      return this.classMixin.apply(this.prototype, arguments);\n    };\n\n    BatmanObject.prototype.mixin = BatmanObject.classMixin;\n\n    BatmanObject.classAccessor = BatmanObject._defineAccessor;\n\n    BatmanObject.accessor = function() {\n      var _ref;\n      return (_ref = this.prototype)._defineAccessor.apply(_ref, arguments);\n    };\n\n    BatmanObject.prototype.accessor = BatmanObject._defineAccessor;\n\n    BatmanObject.wrapClassAccessor = BatmanObject._defineWrapAccessor;\n\n    BatmanObject.wrapAccessor = function() {\n      var _ref;\n      return (_ref = this.prototype)._defineWrapAccessor.apply(_ref, arguments);\n    };\n\n    BatmanObject.prototype.wrapAccessor = BatmanObject._defineWrapAccessor;\n\n    BatmanObject.observeAll = function() {\n      return this.prototype.observe.apply(this.prototype, arguments);\n    };\n\n    BatmanObject.singleton = function(singletonMethodName) {\n      if (singletonMethodName == null) {\n        singletonMethodName = \"sharedInstance\";\n      }\n      return this.classAccessor(singletonMethodName, {\n        get: function() {\n          var _name;\n          return this[_name = \"_\" + singletonMethodName] || (this[_name] = new this);\n        }\n      });\n    };\n\n    BatmanObject.accessor('_batmanID', function() {\n      return this._batmanID();\n    });\n\n    function BatmanObject() {\n      var mixins;\n      mixins = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      this._batman = new Batman._Batman(this);\n      this.mixin.apply(this, mixins);\n    }\n\n    counter = 0;\n\n    BatmanObject.prototype._batmanID = function() {\n      var _base, _ref;\n      this._batman.check(this);\n      if ((_ref = (_base = this._batman).id) == null) {\n        _base.id = counter++;\n      }\n      return this._batman.id;\n    };\n\n    BatmanObject.prototype.hashKey = function() {\n      var _base;\n      if (typeof this.isEqual === 'function') {\n        return;\n      }\n      return (_base = this._batman).hashKey || (_base.hashKey = \"<Batman.Object \" + (this._batmanID()) + \">\");\n    };\n\n    BatmanObject.prototype.toJSON = function() {\n      var key, obj, value;\n      obj = {};\n      for (key in this) {\n        if (!__hasProp.call(this, key)) continue;\n        value = this[key];\n        if (key !== \"_batman\" && key !== \"hashKey\" && key !== \"_batmanID\") {\n          obj[key] = (value != null ? value.toJSON : void 0) ? value.toJSON() : value;\n        }\n      }\n      return obj;\n    };\n\n    return BatmanObject;\n\n  })(Object);\n\n  Batman.Object = BatmanObject;\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.Renderer = (function(_super) {\n    var bindingRegexp, bindingSortOrder, bindingSortPositions, k, name, pos, _i, _j, _len, _len1, _ref;\n\n    __extends(Renderer, _super);\n\n    Renderer.prototype.deferEvery = 50;\n\n    function Renderer(node, context, view) {\n      this.node = node;\n      this.context = context;\n      this.view = view;\n      this.resume = __bind(this.resume, this);\n\n      this.start = __bind(this.start, this);\n\n      Renderer.__super__.constructor.call(this);\n      if (!(this.context instanceof Batman.RenderContext)) {\n        Batman.developer.error(\"Must pass a RenderContext to a renderer for rendering\");\n      }\n      this.immediate = Batman.setImmediate(this.start);\n    }\n\n    Renderer.prototype.start = function() {\n      this.startTime = new Date;\n      this.prevent('parsed');\n      this.prevent('rendered');\n      return this.parseNode(this.node);\n    };\n\n    Renderer.prototype.resume = function() {\n      this.startTime = new Date;\n      return this.parseNode(this.resumeNode);\n    };\n\n    Renderer.prototype.finish = function() {\n      this.startTime = null;\n      this.prevent('stopped');\n      this.allowAndFire('parsed');\n      return this.allowAndFire('rendered');\n    };\n\n    Renderer.prototype.stop = function() {\n      Batman.clearImmediate(this.immediate);\n      return this.fire('stopped');\n    };\n\n    _ref = ['parsed', 'rendered', 'stopped'];\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      k = _ref[_i];\n      Renderer.prototype.event(k).oneShot = true;\n    }\n\n    bindingRegexp = /^data\\-(.*)/;\n\n    bindingSortOrder = [\"view\", \"renderif\", \"foreach\", \"formfor\", \"context\", \"bind\", \"source\", \"target\"];\n\n    bindingSortPositions = {};\n\n    for (pos = _j = 0, _len1 = bindingSortOrder.length; _j < _len1; pos = ++_j) {\n      name = bindingSortOrder[pos];\n      bindingSortPositions[name] = pos;\n    }\n\n    Renderer.prototype._sortBindings = function(a, b) {\n      var aindex, bindex;\n      aindex = bindingSortPositions[a[0]];\n      bindex = bindingSortPositions[b[0]];\n      if (aindex == null) {\n        aindex = bindingSortOrder.length;\n      }\n      if (bindex == null) {\n        bindex = bindingSortOrder.length;\n      }\n      if (aindex > bindex) {\n        return 1;\n      } else if (bindex > aindex) {\n        return -1;\n      } else if (a[0] > b[0]) {\n        return 1;\n      } else if (b[0] > a[0]) {\n        return -1;\n      } else {\n        return 0;\n      }\n    };\n\n    Renderer.prototype.parseNode = function(node) {\n      var attr, attribute, binding, bindingDefinition, bindings, names, nextNode, oldContext, reader, skipChildren, value, _k, _l, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _this = this;\n      if (this.deferEvery && (new Date - this.startTime) > this.deferEvery) {\n        this.resumeNode = node;\n        this.timeout = Batman.setImmediate(this.resume);\n        return;\n      }\n      if (node.getAttribute && node.attributes) {\n        bindings = [];\n        _ref1 = node.attributes;\n        for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {\n          attribute = _ref1[_k];\n          name = (_ref2 = attribute.nodeName.match(bindingRegexp)) != null ? _ref2[1] : void 0;\n          if (!name) {\n            continue;\n          }\n          bindings.push((names = name.split('-')).length > 1 ? [names[0], names.slice(1, names.length + 1 || 9e9).join('-'), attribute.value] : [name, void 0, attribute.value]);\n        }\n        _ref3 = bindings.sort(this._sortBindings);\n        for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {\n          _ref4 = _ref3[_l], name = _ref4[0], attr = _ref4[1], value = _ref4[2];\n          binding = attr ? (reader = Batman.DOM.attrReaders[name]) ? (bindingDefinition = new Batman.DOM.AttrReaderBindingDefinition(node, attr, value, this.context, this), reader(bindingDefinition)) : void 0 : (reader = Batman.DOM.readers[name]) ? (bindingDefinition = new Batman.DOM.ReaderBindingDefinition(node, value, this.context, this), reader(bindingDefinition)) : void 0;\n          if (binding instanceof Batman.RenderContext) {\n            oldContext = this.context;\n            this.context = binding;\n            Batman.DOM.onParseExit(node, function() {\n              return _this.context = oldContext;\n            });\n          } else if (binding != null ? binding.skipChildren : void 0) {\n            skipChildren = true;\n            break;\n          }\n        }\n      }\n      if ((nextNode = this.nextNode(node, skipChildren))) {\n        return this.parseNode(nextNode);\n      } else {\n        return this.finish();\n      }\n    };\n\n    Renderer.prototype.nextNode = function(node, skipChildren) {\n      var children, nextParent, parentSibling, sibling, _ref1, _ref2;\n      if (!skipChildren) {\n        children = node.childNodes;\n        if (children != null ? children.length : void 0) {\n          return children[0];\n        }\n      }\n      sibling = node.nextSibling;\n      if ((_ref1 = Batman.DOM.onParseExit(node)) != null) {\n        _ref1.forEach(function(callback) {\n          return callback();\n        });\n      }\n      Batman.DOM.forgetParseExit(node);\n      if (this.node === node) {\n        return;\n      }\n      if (sibling) {\n        return sibling;\n      }\n      nextParent = node;\n      while (nextParent = nextParent.parentNode) {\n        parentSibling = nextParent.nextSibling;\n        if ((_ref2 = Batman.DOM.onParseExit(nextParent)) != null) {\n          _ref2.forEach(function(callback) {\n            return callback();\n          });\n        }\n        Batman.DOM.forgetParseExit(nextParent);\n        if (this.node === nextParent) {\n          return;\n        }\n        if (parentSibling) {\n          return parentSibling;\n        }\n      }\n    };\n\n    return Renderer;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.AbstractBinding = (function(_super) {\n    var get_dot_rx, get_rx, keypath_rx, onlyAll, onlyData, onlyNode;\n\n    __extends(AbstractBinding, _super);\n\n    keypath_rx = /(^|,)\\s*(?:(true|false)|(\"[^\"]*\")|(\\{[^\\}]*\\})|(([0-9]+[a-zA-Z\\_]|[a-zA-Z])[\\w\\-\\.]*[\\?\\!]?))\\s*(?=$|,)/g;\n\n    get_dot_rx = /(?:\\]\\.)(.+?)(?=[\\[\\.]|\\s*\\||$)/;\n\n    get_rx = /(?!^\\s*)\\[(.*?)\\]/g;\n\n    AbstractBinding.accessor('filteredValue', {\n      get: function() {\n        var renderContext, result, self, unfilteredValue;\n        unfilteredValue = this.get('unfilteredValue');\n        self = this;\n        renderContext = this.get('renderContext');\n        if (this.filterFunctions.length > 0) {\n          Batman.developer.currentFilterStack = renderContext;\n          result = this.filterFunctions.reduce(function(value, fn, i) {\n            var args;\n            args = self.filterArguments[i].map(function(argument) {\n              if (argument._keypath) {\n                return self.renderContext.get(argument._keypath);\n              } else {\n                return argument;\n              }\n            });\n            args.unshift(value);\n            while (args.length < (fn.length - 1)) {\n              args.push(void 0);\n            }\n            args.push(self);\n            return fn.apply(renderContext, args);\n          }, unfilteredValue);\n          Batman.developer.currentFilterStack = null;\n          return result;\n        } else {\n          return unfilteredValue;\n        }\n      },\n      set: function(_, newValue) {\n        return this.set('unfilteredValue', newValue);\n      }\n    });\n\n    AbstractBinding.accessor('unfilteredValue', {\n      get: function() {\n        var k;\n        if (k = this.get('key')) {\n          return Batman.RenderContext.deProxy(Batman.getPath(this, ['keyContext', k]));\n        } else {\n          return this.get('value');\n        }\n      },\n      set: function(_, value) {\n        var k, keyContext, prop;\n        if (k = this.get('key')) {\n          keyContext = this.get('keyContext');\n          if (keyContext && keyContext !== Batman.container) {\n            prop = Batman.Property.forBaseAndKey(keyContext, k);\n            return prop.setValue(value);\n          }\n        } else {\n          return this.set('value', value);\n        }\n      }\n    });\n\n    AbstractBinding.accessor('keyContext', function() {\n      return this.renderContext.contextForKey(this.key);\n    });\n\n    onlyAll = Batman.BindingDefinitionOnlyObserve.All;\n\n    onlyData = Batman.BindingDefinitionOnlyObserve.Data;\n\n    onlyNode = Batman.BindingDefinitionOnlyObserve.Node;\n\n    AbstractBinding.prototype.bindImmediately = true;\n\n    AbstractBinding.prototype.shouldSet = true;\n\n    AbstractBinding.prototype.isInputBinding = false;\n\n    AbstractBinding.prototype.escapeValue = true;\n\n    AbstractBinding.prototype.onlyObserve = onlyAll;\n\n    AbstractBinding.prototype.skipParseFilter = false;\n\n    function AbstractBinding(definition) {\n      this._fireDataChange = __bind(this._fireDataChange, this);\n      this.node = definition.node, this.keyPath = definition.keyPath, this.renderContext = definition.context, this.renderer = definition.renderer;\n      if (definition.onlyObserve) {\n        this.onlyObserve = definition.onlyObserve;\n      }\n      if (definition.skipParseFilter != null) {\n        this.skipParseFilter = definition.skipParseFilter;\n      }\n      if (!this.skipParseFilter) {\n        this.parseFilter();\n      }\n      if (this.bindImmediately) {\n        this.bind();\n      }\n    }\n\n    AbstractBinding.prototype.isTwoWay = function() {\n      return (this.key != null) && this.filterFunctions.length === 0;\n    };\n\n    AbstractBinding.prototype.bind = function() {\n      var _ref, _ref1;\n      if (this.node && ((_ref = this.onlyObserve) === onlyAll || _ref === onlyNode) && Batman.DOM.nodeIsEditable(this.node)) {\n        Batman.DOM.events.change(this.node, this._fireNodeChange.bind(this));\n        if (this.onlyObserve === onlyNode) {\n          this._fireNodeChange();\n        }\n      }\n      if ((_ref1 = this.onlyObserve) === onlyAll || _ref1 === onlyData) {\n        this.observeAndFire('filteredValue', this._fireDataChange);\n      }\n      if (this.node) {\n        return Batman.DOM.trackBinding(this, this.node);\n      }\n    };\n\n    AbstractBinding.prototype._fireNodeChange = function(event) {\n      var val;\n      this.shouldSet = false;\n      val = this.value || this.get('keyContext');\n      if (typeof this.nodeChange === \"function\") {\n        this.nodeChange(this.node, val, event);\n      }\n      this.fire('nodeChange', this.node, val);\n      return this.shouldSet = true;\n    };\n\n    AbstractBinding.prototype._fireDataChange = function(value) {\n      if (this.shouldSet) {\n        if (typeof this.dataChange === \"function\") {\n          this.dataChange(value, this.node);\n        }\n        return this.fire('dataChange', value, this.node);\n      }\n    };\n\n    AbstractBinding.prototype.die = function() {\n      var _ref;\n      this.forget();\n      if ((_ref = this._batman.properties) != null) {\n        _ref.forEach(function(key, property) {\n          return property.die();\n        });\n      }\n      this.fire('die');\n      this.node = null;\n      this.keyPath = null;\n      this.renderContext = null;\n      this.renderer = null;\n      this.dead = true;\n      return true;\n    };\n\n    AbstractBinding.prototype.parseFilter = function() {\n      var args, filter, filterName, filterString, filters, key, keyPath, orig, split;\n      this.filterFunctions = [];\n      this.filterArguments = [];\n      keyPath = this.keyPath;\n      while (get_dot_rx.test(keyPath)) {\n        keyPath = keyPath.replace(get_dot_rx, \"]['$1']\");\n      }\n      filters = keyPath.replace(get_rx, \" | get $1 \").replace(/'/g, '\"').split(/(?!\")\\s+\\|\\s+(?!\")/);\n      try {\n        key = this.parseSegment(orig = filters.shift())[0];\n      } catch (e) {\n        Batman.developer.warn(e);\n        Batman.developer.error(\"Error! Couldn't parse keypath in \\\"\" + orig + \"\\\". Parsing error above.\");\n      }\n      if (key && key._keypath) {\n        this.key = key._keypath;\n      } else {\n        this.value = key;\n      }\n      if (filters.length) {\n        while (filterString = filters.shift()) {\n          split = filterString.indexOf(' ');\n          if (split === -1) {\n            split = filterString.length;\n          }\n          filterName = filterString.substr(0, split);\n          args = filterString.substr(split);\n          if (!(filter = Batman.Filters[filterName])) {\n            return Batman.developer.error(\"Unrecognized filter '\" + filterName + \"' in key \\\"\" + this.keyPath + \"\\\"!\");\n          }\n          this.filterFunctions.push(filter);\n          try {\n            this.filterArguments.push(this.parseSegment(args));\n          } catch (e) {\n            Batman.developer.error(\"Bad filter arguments \\\"\" + args + \"\\\"!\");\n          }\n        }\n        return true;\n      }\n    };\n\n    AbstractBinding.prototype.parseSegment = function(segment) {\n      segment = segment.replace(keypath_rx, function(match, start, bool, string, object, keypath, offset) {\n        var replacement;\n        if (start == null) {\n          start = '';\n        }\n        replacement = keypath ? '{\"_keypath\": \"' + keypath + '\"}' : bool || string || object;\n        return start + replacement;\n      });\n      return JSON.parse(\"[\" + segment + \"]\");\n    };\n\n    return AbstractBinding;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.ViewBinding = (function(_super) {\n\n    __extends(ViewBinding, _super);\n\n    ViewBinding.prototype.skipChildren = true;\n\n    ViewBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    function ViewBinding() {\n      ViewBinding.__super__.constructor.apply(this, arguments);\n      this.renderer.prevent('rendered');\n      this.node.removeAttribute('data-view');\n    }\n\n    ViewBinding.prototype.dataChange = function(viewClassOrInstance) {\n      var _ref, _this = this;\n      if (viewClassOrInstance == null) {\n        return;\n      }\n      if (viewClassOrInstance.isView) {\n        this.view = viewClassOrInstance;\n        this.view.set('context', this.renderContext);\n        this.view.set('node', this.node);\n      } else {\n        this.view = new viewClassOrInstance({\n          node: this.node,\n          context: this.renderContext,\n          parentView: this.renderer.view\n        });\n      }\n      this.view.on('ready', function() {\n        return _this.renderer.allowAndFire('rendered');\n      });\n      this.forget();\n      return (_ref = this._batman.properties) != null ? _ref.forEach(function(key, property) {\n        return property.die();\n      }) : void 0;\n    };\n\n    ViewBinding.prototype.die = function() {\n      this.view = null;\n      return ViewBinding.__super__.die.apply(this, arguments);\n    };\n\n    return ViewBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.ViewArgumentBinding = (function(_super) {\n\n    __extends(ViewArgumentBinding, _super);\n\n    function ViewArgumentBinding() {\n      return ViewArgumentBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    ViewArgumentBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.None;\n\n    return ViewArgumentBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.ValueBinding = (function(_super) {\n\n    __extends(ValueBinding, _super);\n\n    function ValueBinding(definition) {\n      var _ref;\n      this.isInputBinding = (_ref = definition.node.nodeName.toLowerCase()) === 'input' || _ref === 'textarea';\n      ValueBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    ValueBinding.prototype.nodeChange = function(node, context) {\n      if (this.isTwoWay()) {\n        return this.set('filteredValue', this.node.value);\n      }\n    };\n\n    ValueBinding.prototype.dataChange = function(value, node) {\n      return Batman.DOM.valueForNode(this.node, value, this.escapeValue);\n    };\n\n    return ValueBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.ShowHideBinding = (function(_super) {\n\n    __extends(ShowHideBinding, _super);\n\n    ShowHideBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    function ShowHideBinding(definition) {\n      var display;\n      display = definition.node.style.display;\n      if (!display || display === 'none') {\n        display = '';\n      }\n      this.originalDisplay = display;\n      this.invert = definition.invert;\n      ShowHideBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    ShowHideBinding.prototype.dataChange = function(value) {\n      var hide, view, _ref;\n      view = Batman._data(this.node, 'view');\n      if ( !! value === !this.invert) {\n        if (view != null) {\n          view.fire('beforeAppear', this.node);\n        }\n        if ((_ref = Batman.data(this.node, 'show')) != null) {\n          _ref.call(this.node);\n        }\n        this.node.style.display = this.originalDisplay;\n        return view != null ? view.fire('appear', this.node) : void 0;\n      } else {\n        if (view != null) {\n          view.fire('beforeDisappear', this.node);\n        }\n        if (typeof(hide = Batman.data(this.node, 'hide')) === 'function') {\n          hide.call(this.node);\n        } else {\n          Batman.DOM.setStyleProperty(this.node, 'display', 'none', 'important');\n        }\n        return view != null ? view.fire('disappear', this.node) : void 0;\n      }\n    };\n\n    return ShowHideBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.SelectBinding = (function(_super) {\n\n    __extends(SelectBinding, _super);\n\n    SelectBinding.prototype.isInputBinding = true;\n\n    SelectBinding.prototype.canSetImplicitly = true;\n\n    function SelectBinding() {\n      this.updateOptionBindings = __bind(this.updateOptionBindings, this);\n\n      this.nodeChange = __bind(this.nodeChange, this);\n\n      this.dataChange = __bind(this.dataChange, this);\n\n      this.childBindingAdded = __bind(this.childBindingAdded, this);\n      this.selectedBindings = new Batman.SimpleSet;\n      SelectBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    SelectBinding.prototype.childBindingAdded = function(binding) {\n      var dataChangeHandler, _this = this;\n      if (binding instanceof Batman.DOM.CheckedBinding) {\n        binding.on('dataChange', dataChangeHandler = function() {\n          return _this.nodeChange();\n        });\n        binding.on('die', function() {\n          binding.forget('dataChange', dataChangeHandler);\n          return _this.selectedBindings.remove(binding);\n        });\n        this.selectedBindings.add(binding);\n      } else if (binding instanceof Batman.DOM.IteratorBinding) {\n        binding.on('nodeAdded', dataChangeHandler = function() {\n          return _this._fireDataChange(_this.get('filteredValue'));\n        });\n        binding.on('nodeRemoved', dataChangeHandler);\n        binding.on('die', function() {\n          binding.forget('nodeAdded', dataChangeHandler);\n          return binding.forget('nodeRemoved', dataChangeHandler);\n        });\n      } else {\n        return;\n      }\n      return this._fireDataChange(this.get('filteredValue'));\n    };\n\n    SelectBinding.prototype.lastKeyContext = null;\n\n    SelectBinding.prototype.dataChange = function(newValue) {\n      var child, matches, valueToChild, _i, _len, _name, _ref, _this = this;\n      this.lastKeyContext || (this.lastKeyContext = this.get('keyContext'));\n      if (this.lastKeyContext !== this.get('keyContext')) {\n        this.canSetImplicitly = true;\n        this.lastKeyContext = this.get('keyContext');\n      }\n      if (newValue != null ? newValue.forEach : void 0) {\n        valueToChild = {};\n        _ref = this.node.children;\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          child = _ref[_i];\n          child.selected = false;\n          matches = valueToChild[_name = child.value] || (valueToChild[_name] = []);\n          matches.push(child);\n        }\n        newValue.forEach(function(value) {\n          var children, node, _j, _len1, _results;\n          if (children = valueToChild[value]) {\n            _results = [];\n            for (_j = 0, _len1 = children.length; _j < _len1; _j++) {\n              node = children[_j];\n              _results.push(node.selected = true);\n            }\n            return _results;\n          }\n        });\n      } else {\n        if (!(newValue != null) && this.canSetImplicitly) {\n          if (this.node.value) {\n            this.canSetImplicitly = false;\n            this.set('unfilteredValue', this.node.value);\n          }\n        } else {\n          this.canSetImplicitly = false;\n          Batman.DOM.valueForNode(this.node, newValue, this.escapeValue);\n        }\n      }\n      this.updateOptionBindings();\n    };\n\n    SelectBinding.prototype.nodeChange = function() {\n      var c, selections;\n      if (this.isTwoWay()) {\n        selections = this.node.multiple ? (function() {\n          var _i, _len, _ref, _results;\n          _ref = this.node.children;\n          _results = [];\n          for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n            c = _ref[_i];\n            if (c.selected) {\n              _results.push(c.value);\n            }\n          }\n          return _results;\n        }).call(this) : this.node.value;\n        if (typeof selections === Array && selections.length === 1) {\n          selections = selections[0];\n        }\n        this.set('unfilteredValue', selections);\n        this.updateOptionBindings();\n      }\n    };\n\n    SelectBinding.prototype.updateOptionBindings = function() {\n      return this.selectedBindings.forEach(function(binding) {\n        return binding._fireNodeChange();\n      });\n    };\n\n    return SelectBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.RouteBinding = (function(_super) {\n\n    __extends(RouteBinding, _super);\n\n    function RouteBinding() {\n      return RouteBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    RouteBinding.prototype.onAnchorTag = false;\n\n    RouteBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    RouteBinding.accessor('dispatcher', function() {\n      return this.renderContext.get('dispatcher') || Batman.App.get('current.dispatcher');\n    });\n\n    RouteBinding.prototype.bind = function() {\n      var _this = this;\n      if (this.node.nodeName.toUpperCase() === 'A') {\n        this.onAnchorTag = true;\n      }\n      RouteBinding.__super__.bind.apply(this, arguments);\n      return Batman.DOM.events.click(this.node, function(node, event) {\n        var params;\n        if (event.__batmanActionTaken) {\n          return;\n        }\n        event.__batmanActionTaken = true;\n        params = _this.pathFromValue(_this.get('filteredValue'));\n        if (params != null) {\n          return Batman.redirect(params);\n        }\n      });\n    };\n\n    RouteBinding.prototype.dataChange = function(value) {\n      var path;\n      if (value) {\n        path = this.pathFromValue(value);\n      }\n      if (this.onAnchorTag) {\n        if (path && Batman.navigator) {\n          path = Batman.navigator.linkTo(path);\n        } else {\n          path = \"#\";\n        }\n        return this.node.href = path;\n      }\n    };\n\n    RouteBinding.prototype.pathFromValue = function(value) {\n      var _ref;\n      if (value) {\n        if (value.isNamedRouteQuery) {\n          return value.get('path');\n        } else {\n          return (_ref = this.get('dispatcher')) != null ? _ref.pathFromParams(value) : void 0;\n        }\n      }\n    };\n\n    return RouteBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.RadioBinding = (function(_super) {\n\n    __extends(RadioBinding, _super);\n\n    function RadioBinding() {\n      return RadioBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    RadioBinding.accessor('parsedNodeValue', function() {\n      return Batman.DOM.attrReaders._parseAttribute(this.node.value);\n    });\n\n    RadioBinding.prototype.firstBind = true;\n\n    RadioBinding.prototype.dataChange = function(value) {\n      var boundValue;\n      boundValue = this.get('filteredValue');\n      if (boundValue != null) {\n        this.node.checked = boundValue === Batman.DOM.attrReaders._parseAttribute(this.node.value);\n      } else {\n        if (this.firstBind && this.node.checked) {\n          this.set('filteredValue', this.get('parsedNodeValue'));\n        }\n      }\n      return this.firstBind = false;\n    };\n\n    RadioBinding.prototype.nodeChange = function(node) {\n      if (this.isTwoWay()) {\n        return this.set('filteredValue', this.get('parsedNodeValue'));\n      }\n    };\n\n    return RadioBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.MixinBinding = (function(_super) {\n\n    __extends(MixinBinding, _super);\n\n    function MixinBinding() {\n      return MixinBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    MixinBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    MixinBinding.prototype.dataChange = function(value) {\n      if (value != null) {\n        return Batman.mixin(this.node, value);\n      }\n    };\n\n    return MixinBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.FileBinding = (function(_super) {\n\n    __extends(FileBinding, _super);\n\n    function FileBinding() {\n      return FileBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    FileBinding.prototype.isInputBinding = true;\n\n    FileBinding.prototype.nodeChange = function(node, subContext) {\n      if (!this.isTwoWay()) {\n        return;\n      }\n      if (node.hasAttribute('multiple')) {\n        return this.set('filteredValue', Array.prototype.slice.call(node.files));\n      } else {\n        return this.set('filteredValue', node.files[0]);\n      }\n    };\n\n    return FileBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.DeferredRenderingBinding = (function(_super) {\n\n    __extends(DeferredRenderingBinding, _super);\n\n    DeferredRenderingBinding.prototype.rendered = false;\n\n    DeferredRenderingBinding.prototype.skipChildren = true;\n\n    function DeferredRenderingBinding() {\n      DeferredRenderingBinding.__super__.constructor.apply(this, arguments);\n      this.node.removeAttribute(\"data-renderif\");\n    }\n\n    DeferredRenderingBinding.prototype.nodeChange = function() {};\n\n    DeferredRenderingBinding.prototype.dataChange = function(value) {\n      if (value && !this.rendered) {\n        return this.render();\n      }\n    };\n\n    DeferredRenderingBinding.prototype.render = function() {\n      new Batman.Renderer(this.node, this.renderContext, this.renderer.view);\n      return this.rendered = true;\n    };\n\n    return DeferredRenderingBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.AbstractAttributeBinding = (function(_super) {\n\n    __extends(AbstractAttributeBinding, _super);\n\n    function AbstractAttributeBinding(definition) {\n      this.attributeName = definition.attr;\n      AbstractAttributeBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    return AbstractAttributeBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.FormBinding = (function(_super) {\n\n    __extends(FormBinding, _super);\n\n    FormBinding.current = null;\n\n    FormBinding.prototype.errorClass = 'error';\n\n    FormBinding.prototype.defaultErrorsListSelector = 'div.errors';\n\n    FormBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.None;\n\n    FormBinding.accessor('errorsListSelector', function() {\n      return this.get('node').getAttribute('data-errors-list') || this.defaultErrorsListSelector;\n    });\n\n    function FormBinding() {\n      this.childBindingAdded = __bind(this.childBindingAdded, this);\n      FormBinding.__super__.constructor.apply(this, arguments);\n      this.contextName = this.attributeName;\n      delete this.attributeName;\n      Batman.DOM.events.submit(this.get('node'), function(node, e) {\n        return Batman.DOM.preventDefault(e);\n      });\n      this.setupErrorsList();\n    }\n\n    FormBinding.prototype.childBindingAdded = function(binding) {\n      var definition, field, index, node;\n      if (binding.isInputBinding && Batman.isChildOf(this.get('node'), binding.get('node'))) {\n        if (~ (index = binding.get('key').indexOf(this.contextName))) {\n          node = binding.get('node');\n          field = binding.get('key').slice(index + this.contextName.length + 1);\n          definition = new Batman.DOM.AttrReaderBindingDefinition(node, this.errorClass, this.get('keyPath') + (\" | get 'errors.\" + field + \".length'\"), this.renderContext, this.renderer);\n          return new Batman.DOM.AddClassBinding(definition);\n        }\n      }\n    };\n\n    FormBinding.prototype.setupErrorsList = function() {\n      if (this.errorsListNode = Batman.DOM.querySelector(this.get('node'), this.get('errorsListSelector'))) {\n        Batman.DOM.setInnerHTML(this.errorsListNode, this.errorsListHTML());\n        if (!this.errorsListNode.getAttribute('data-showif')) {\n          return this.errorsListNode.setAttribute('data-showif', \"\" + this.contextName + \".errors.length\");\n        }\n      }\n    };\n\n    FormBinding.prototype.errorsListHTML = function() {\n      return \"<ul>\\n  <li data-foreach-error=\\\"\" + this.contextName + \".errors\\\" data-bind=\\\"error.fullMessage\\\"></li>\\n</ul>\";\n    };\n\n    return FormBinding;\n\n  })(Batman.DOM.AbstractAttributeBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.EventBinding = (function(_super) {\n\n    __extends(EventBinding, _super);\n\n    EventBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.None;\n\n    function EventBinding() {\n      var attacher, callback, confirmText, _this = this;\n      EventBinding.__super__.constructor.apply(this, arguments);\n      if (confirmText = this.node.getAttribute('data-confirm')) {\n        Batman.developer.deprecated(\"data-confirm\");\n      }\n      callback = function() {\n        var _ref;\n        if (confirmText && !confirm(confirmText)) {\n          return;\n        }\n        return (_ref = _this.get('filteredValue')) != null ? _ref.apply(_this.get('callbackContext'), arguments) : void 0;\n      };\n      if (attacher = Batman.DOM.events[this.attributeName]) {\n        attacher(this.node, callback, this.renderContext);\n      } else {\n        Batman.DOM.events.other(this.node, this.attributeName, callback, this.renderContext);\n      }\n    }\n\n    EventBinding.accessor('callbackContext', function() {\n      var contextKeySegments;\n      contextKeySegments = this.key.split('.');\n      contextKeySegments.pop();\n      if (contextKeySegments.length > 0) {\n        return this.get('keyContext').get(contextKeySegments.join('.'));\n      } else {\n        return this.get('keyContext');\n      }\n    });\n\n    EventBinding.wrapAccessor('unfilteredValue', function(core) {\n      return {\n        get: function() {\n          var functionKey, k, keyContext, keys;\n          if (k = this.get('key')) {\n            keys = k.split('.');\n            if (keys.length > 1) {\n              functionKey = keys.pop();\n              keyContext = Batman.getPath(this, ['keyContext'].concat(keys));\n              keyContext = Batman.RenderContext.deProxy(keyContext);\n              if (keyContext != null) {\n                return keyContext[functionKey];\n              }\n            }\n          }\n          return core.get.apply(this, arguments);\n        }\n      };\n    });\n\n    return EventBinding;\n\n  })(Batman.DOM.AbstractAttributeBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.NodeAttributeBinding = (function(_super) {\n\n    __extends(NodeAttributeBinding, _super);\n\n    function NodeAttributeBinding() {\n      return NodeAttributeBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    NodeAttributeBinding.prototype.dataChange = function(value) {\n      if (value == null) {\n        value = \"\";\n      }\n      return this.node[this.attributeName] = value;\n    };\n\n    NodeAttributeBinding.prototype.nodeChange = function(node) {\n      if (this.isTwoWay()) {\n        return this.set('filteredValue', Batman.DOM.attrReaders._parseAttribute(node[this.attributeName]));\n      }\n    };\n\n    return NodeAttributeBinding;\n\n  })(Batman.DOM.AbstractAttributeBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.CheckedBinding = (function(_super) {\n\n    __extends(CheckedBinding, _super);\n\n    function CheckedBinding() {\n      return CheckedBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    CheckedBinding.prototype.isInputBinding = true;\n\n    CheckedBinding.prototype.dataChange = function(value) {\n      return this.node[this.attributeName] = !! value;\n    };\n\n    return CheckedBinding;\n\n  })(Batman.DOM.NodeAttributeBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.AttributeBinding = (function(_super) {\n\n    __extends(AttributeBinding, _super);\n\n    function AttributeBinding() {\n      return AttributeBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    AttributeBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    AttributeBinding.prototype.dataChange = function(value) {\n      return this.node.setAttribute(this.attributeName, value);\n    };\n\n    AttributeBinding.prototype.nodeChange = function(node) {\n      if (this.isTwoWay()) {\n        return this.set('filteredValue', Batman.DOM.attrReaders._parseAttribute(node.getAttribute(this.attributeName)));\n      }\n    };\n\n    return AttributeBinding;\n\n  })(Batman.DOM.AbstractAttributeBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.AddClassBinding = (function(_super) {\n\n    __extends(AddClassBinding, _super);\n\n    AddClassBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    function AddClassBinding(definition) {\n      var name;\n      this.invert = definition.invert;\n      this.classes = (function() {\n        var _i, _len, _ref, _results;\n        _ref = definition.attr.split('|');\n        _results = [];\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          name = _ref[_i];\n          _results.push({\n            name: name,\n            pattern: new RegExp(\"(?:^|\\\\s)\" + name + \"(?:$|\\\\s)\", 'i')\n          });\n        }\n        return _results;\n      })();\n      AddClassBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    AddClassBinding.prototype.dataChange = function(value) {\n      var currentName, includesClassName, name, pattern, _i, _len, _ref, _ref1;\n      currentName = this.node.className;\n      _ref = this.classes;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        _ref1 = _ref[_i], name = _ref1.name, pattern = _ref1.pattern;\n        includesClassName = pattern.test(currentName);\n        if ( !! value === !this.invert) {\n          if (!includesClassName) {\n            this.node.className = \"\" + currentName + \" \" + name;\n          }\n        } else {\n          if (includesClassName) {\n            this.node.className = currentName.replace(pattern, ' ');\n          }\n        }\n      }\n      return true;\n    };\n\n    return AddClassBinding;\n\n  })(Batman.DOM.AbstractAttributeBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.AbstractCollectionBinding = (function(_super) {\n\n    __extends(AbstractCollectionBinding, _super);\n\n    function AbstractCollectionBinding() {\n      return AbstractCollectionBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    AbstractCollectionBinding.prototype.bindCollection = function(newCollection) {\n      var _ref;\n      if (newCollection instanceof Batman.Hash) {\n        newCollection = newCollection.meta;\n      }\n      if (newCollection === this.collection) {\n        return true;\n      } else {\n        this.unbindCollection();\n        this.collection = newCollection;\n        if ((_ref = this.collection) != null ? _ref.isObservable : void 0) {\n          this.collection.observeAndFire('toArray', this.handleArrayChanged);\n          return true;\n        }\n      }\n      return false;\n    };\n\n    AbstractCollectionBinding.prototype.unbindCollection = function() {\n      var _ref;\n      if ((_ref = this.collection) != null ? _ref.isObservable : void 0) {\n        return this.collection.forget('toArray', this.handleArrayChanged);\n      }\n    };\n\n    AbstractCollectionBinding.prototype.handleArrayChanged = function() {};\n\n    AbstractCollectionBinding.prototype.die = function() {\n      this.unbindCollection();\n      return AbstractCollectionBinding.__super__.die.apply(this, arguments);\n    };\n\n    return AbstractCollectionBinding;\n\n  })(Batman.DOM.AbstractAttributeBinding);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.DOM.StyleBinding = (function(_super) {\n\n    __extends(StyleBinding, _super);\n\n    StyleBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    function StyleBinding() {\n      this.setStyle = __bind(this.setStyle, this);\n\n      this.handleArrayChanged = __bind(this.handleArrayChanged, this);\n      this.oldStyles = {};\n      this.styleBindings = {};\n      StyleBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    StyleBinding.prototype.dataChange = function(value) {\n      var colonSplitCSSValues, cssName, key, style, _i, _len, _ref, _ref1, _results;\n      if (!value) {\n        this.resetStyles();\n        return;\n      }\n      this.unbindCollection();\n      if (typeof value === 'string') {\n        this.resetStyles();\n        _ref = value.split(';');\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          style = _ref[_i];\n          _ref1 = style.split(\":\"), cssName = _ref1[0], colonSplitCSSValues = 2 <= _ref1.length ? __slice.call(_ref1, 1) : [];\n          this.setStyle(cssName, colonSplitCSSValues.join(\":\"));\n        }\n        return;\n      }\n      if (value instanceof Batman.Hash) {\n        return this.bindCollection(value);\n      } else {\n        if (value instanceof Batman.Object) {\n          value = value.toJSON();\n        }\n        this.resetStyles();\n        _results = [];\n        for (key in value) {\n          if (!__hasProp.call(value, key)) continue;\n          _results.push(this.bindSingleAttribute(key, \"\" + this.keyPath + \".\" + key));\n        }\n        return _results;\n      }\n    };\n\n    StyleBinding.prototype.handleArrayChanged = function(array) {\n      var _this = this;\n      return this.collection.forEach(function(key, value) {\n        return _this.bindSingleAttribute(key, \"\" + _this.keyPath + \".\" + key);\n      });\n    };\n\n    StyleBinding.prototype.bindSingleAttribute = function(attr, keyPath) {\n      var definition;\n      definition = new Batman.DOM.AttrReaderBindingDefinition(this.node, attr, keyPath, this.renderContext, this.renderer);\n      return this.styleBindings[attr] = new Batman.DOM.StyleBinding.SingleStyleBinding(definition, this);\n    };\n\n    StyleBinding.prototype.setStyle = function(key, value) {\n      key = Batman.helpers.camelize(key.trim(), true);\n      if (this.oldStyles[key] == null) {\n        this.oldStyles[key] = this.node.style[key] || \"\";\n      }\n      if (value != null ? value.trim : void 0) {\n        value = value.trim();\n      }\n      if (value == null) {\n        value = \"\";\n      }\n      return this.node.style[key] = value;\n    };\n\n    StyleBinding.prototype.resetStyles = function() {\n      var cssName, cssValue, _ref, _results;\n      _ref = this.oldStyles;\n      _results = [];\n      for (cssName in _ref) {\n        if (!__hasProp.call(_ref, cssName)) continue;\n        cssValue = _ref[cssName];\n        _results.push(this.setStyle(cssName, cssValue));\n      }\n      return _results;\n    };\n\n    StyleBinding.prototype.resetBindings = function() {\n      var attribute, binding, _ref;\n      _ref = this.styleBindings;\n      for (attribute in _ref) {\n        binding = _ref[attribute];\n        binding._fireDataChange('');\n        binding.die();\n      }\n      return this.styleBindings = {};\n    };\n\n    StyleBinding.prototype.unbindCollection = function() {\n      this.resetBindings();\n      return StyleBinding.__super__.unbindCollection.apply(this, arguments);\n    };\n\n    StyleBinding.SingleStyleBinding = (function(_super1) {\n\n      __extends(SingleStyleBinding, _super1);\n\n      SingleStyleBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n      SingleStyleBinding.prototype.isTwoWay = function() {\n        return false;\n      };\n\n      function SingleStyleBinding(definition, parent) {\n        this.parent = parent;\n        SingleStyleBinding.__super__.constructor.call(this, definition);\n      }\n\n      SingleStyleBinding.prototype.dataChange = function(value) {\n        return this.parent.setStyle(this.attributeName, value);\n      };\n\n      return SingleStyleBinding;\n\n    })(Batman.DOM.AbstractAttributeBinding);\n\n    return StyleBinding;\n\n  })(Batman.DOM.AbstractCollectionBinding);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.IteratorBinding = (function(_super) {\n\n    __extends(IteratorBinding, _super);\n\n    IteratorBinding.prototype.currentActionNumber = 0;\n\n    IteratorBinding.prototype.queuedActionNumber = 0;\n\n    IteratorBinding.prototype.bindImmediately = false;\n\n    IteratorBinding.prototype.skipChildren = true;\n\n    IteratorBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    function IteratorBinding(definition) {\n      this.handleArrayChanged = __bind(this.handleArrayChanged, this);\n\n      var previousSiblingNode, sourceNode, _this = this;\n      sourceNode = definition.node, this.iteratorName = definition.attr, this.key = definition.keyPath, this.parentRenderer = definition.renderer;\n      this.nodeMap = new Batman.SimpleHash;\n      this.rendererMap = new Batman.SimpleHash;\n      this.prototypeNode = sourceNode.cloneNode(true);\n      this.prototypeNode.removeAttribute(\"data-foreach-\" + this.iteratorName);\n      previousSiblingNode = sourceNode.nextSibling;\n      this.startNode = document.createComment(\"start \" + this.iteratorName + \"-\" + (this.get('_batmanID')));\n      this.endNode = document.createComment(\"end \" + this.iteratorName + \"-\" + (this.get('_batmanID')));\n      this.endNode[Batman.expando] = sourceNode[Batman.expando];\n      if (Batman.canDeleteExpando) {\n        delete sourceNode[Batman.expando];\n      }\n      Batman.DOM.insertBefore(sourceNode.parentNode, this.startNode, previousSiblingNode);\n      Batman.DOM.insertBefore(sourceNode.parentNode, this.endNode, previousSiblingNode);\n      this.parentRenderer.prevent('rendered');\n      Batman.DOM.onParseExit(sourceNode.parentNode, function() {\n        Batman.DOM.destroyNode(sourceNode);\n        _this.bind();\n        return _this.parentRenderer.allowAndFire('rendered');\n      });\n      definition.node = this.endNode;\n      IteratorBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    IteratorBinding.prototype.parentNode = function() {\n      return this.endNode.parentNode;\n    };\n\n    IteratorBinding.prototype.dataChange = function(collection) {\n      var items, _items;\n      if (collection != null) {\n        if (!this.bindCollection(collection)) {\n          items = (collection != null ? collection.forEach : void 0) ? (_items = [], collection.forEach(function(item) {\n            return _items.push(item);\n          }), _items) : Object.keys(collection);\n          return this.handleArrayChanged(items);\n        }\n      } else {\n        return this.handleArrayChanged([]);\n      }\n    };\n\n    IteratorBinding.prototype.handleArrayChanged = function(newItems) {\n      var existingNode, index, newItem, node, nodeAtIndex, parentNode, startIndex, unseenNodeMap, _i, _len, _this = this;\n      parentNode = this.parentNode();\n      startIndex = this._getStartNodeIndex() + 1;\n      unseenNodeMap = this.nodeMap.merge();\n      if (newItems) {\n        for (index = _i = 0, _len = newItems.length; _i < _len; index = ++_i) {\n          newItem = newItems[index];\n          nodeAtIndex = parentNode.childNodes[startIndex + index];\n          if ((nodeAtIndex != null) && this._itemForNode(nodeAtIndex) === newItem) {\n            unseenNodeMap.unset(newItem);\n            continue;\n          } else {\n            node = (existingNode = this.nodeMap.get(newItem)) ? (unseenNodeMap.unset(newItem), existingNode) : this._newNodeForItem(newItem);\n            Batman.DOM.insertBefore(this.parentNode(), node, nodeAtIndex);\n          }\n        }\n      }\n      unseenNodeMap.forEach(function(item, node) {\n        if (_this._nodesToBeRendered.has(node)) {\n          _this._nodesToBeRemoved || (_this._nodesToBeRemoved = new Batman.SimpleSet);\n          return _this._nodesToBeRemoved.add(node);\n        } else {\n          return _this._removeItem(item);\n        }\n      });\n    };\n\n    IteratorBinding.prototype._itemForNode = function(node) {\n      return Batman._data(node, \"\" + this.iteratorName + \"Item\");\n    };\n\n    IteratorBinding.prototype._newNodeForItem = function(newItem) {\n      var newNode, renderer, _this = this;\n      newNode = this.prototypeNode.cloneNode(true);\n      this._nodesToBeRendered || (this._nodesToBeRendered = new Batman.SimpleSet);\n      this._nodesToBeRendered.add(newNode);\n      Batman._data(newNode, \"\" + this.iteratorName + \"Item\", newItem);\n      this.nodeMap.set(newItem, newNode);\n      this.parentRenderer.prevent('rendered');\n      renderer = new Batman.Renderer(newNode, this.renderContext.descend(newItem, this.iteratorName), this.parentRenderer.view);\n      renderer.once('rendered', function() {\n        var _ref;\n        _this._nodesToBeRendered.remove(newNode);\n        if ((_ref = _this._nodesToBeRemoved) != null ? _ref.has(newNode) : void 0) {\n          _this._nodesToBeRemoved.remove(newNode);\n          _this._removeItem(newItem);\n        } else {\n          Batman.DOM.propagateBindingEvents(newNode);\n          _this.fire('nodeAdded', newNode, newItem);\n        }\n        return _this.parentRenderer.allowAndFire('rendered');\n      });\n      return newNode;\n    };\n\n    IteratorBinding.prototype._getStartNodeIndex = function() {\n      var index, node, _i, _len, _ref;\n      _ref = this.parentNode().childNodes;\n      for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {\n        node = _ref[index];\n        if (node === this.startNode) {\n          return index;\n        }\n      }\n      return 0;\n    };\n\n    IteratorBinding.prototype._removeItem = function(item) {\n      var node;\n      node = this.nodeMap.unset(item);\n      Batman.DOM.destroyNode(node);\n      return this.fire('nodeRemoved', node, item);\n    };\n\n    IteratorBinding.prototype.die = function() {\n      var _ref;\n      if (this._nodesToBeRendered && !this._nodesToBeRendered.isEmpty()) {\n        this._nodesToBeRemoved || (this._nodesToBeRemoved = new Batman.SimpleSet);\n        (_ref = this._nodesToBeRemoved).add.apply(_ref, this._nodesToBeRendered.toArray());\n      }\n      return IteratorBinding.__super__.die.apply(this, arguments);\n    };\n\n    return IteratorBinding;\n\n  })(Batman.DOM.AbstractCollectionBinding);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.ClassBinding = (function(_super) {\n\n    __extends(ClassBinding, _super);\n\n    function ClassBinding() {\n      this.handleArrayChanged = __bind(this.handleArrayChanged, this);\n      return ClassBinding.__super__.constructor.apply(this, arguments);\n    }\n\n    ClassBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    ClassBinding.prototype.dataChange = function(value) {\n      if (value != null) {\n        this.unbindCollection();\n        if (typeof value === 'string') {\n          return this.node.className = value;\n        } else {\n          this.bindCollection(value);\n          return this.updateFromCollection();\n        }\n      }\n    };\n\n    ClassBinding.prototype.updateFromCollection = function() {\n      var array, k, v;\n      if (this.collection) {\n        array = this.collection.map ? this.collection.map(function(x) {\n          return x;\n        }) : (function() {\n          var _ref, _results;\n          _ref = this.collection;\n          _results = [];\n          for (k in _ref) {\n            if (!__hasProp.call(_ref, k)) continue;\n            v = _ref[k];\n            _results.push(k);\n          }\n          return _results;\n        }).call(this);\n        if (array.toArray != null) {\n          array = array.toArray();\n        }\n        return this.node.className = array.join(' ');\n      }\n    };\n\n    ClassBinding.prototype.handleArrayChanged = function() {\n      return this.updateFromCollection();\n    };\n\n    return ClassBinding;\n\n  })(Batman.DOM.AbstractCollectionBinding);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.ValidationError = (function(_super) {\n\n    __extends(ValidationError, _super);\n\n    ValidationError.accessor('fullMessage', function() {\n      return Batman.t('errors.format', {\n        attribute: Batman.helpers.humanize(this.attribute),\n        message: this.message\n      });\n    });\n\n    function ValidationError(attribute, message) {\n      ValidationError.__super__.constructor.call(this, {\n        attribute: attribute,\n        message: message\n      });\n    }\n\n    return ValidationError;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.StorageAdapter = (function(_super) {\n\n    __extends(StorageAdapter, _super);\n\n    StorageAdapter.StorageError = (function(_super1) {\n\n      __extends(StorageError, _super1);\n\n      StorageError.prototype.name = \"StorageError\";\n\n      function StorageError(message) {\n        StorageError.__super__.constructor.apply(this, arguments);\n        this.message = message;\n      }\n\n      return StorageError;\n\n    })(Error);\n\n    StorageAdapter.RecordExistsError = (function(_super1) {\n\n      __extends(RecordExistsError, _super1);\n\n      RecordExistsError.prototype.name = 'RecordExistsError';\n\n      function RecordExistsError(message) {\n        RecordExistsError.__super__.constructor.call(this, message || \"Can't create this record because it already exists in the store!\");\n      }\n\n      return RecordExistsError;\n\n    })(StorageAdapter.StorageError);\n\n    StorageAdapter.NotFoundError = (function(_super1) {\n\n      __extends(NotFoundError, _super1);\n\n      NotFoundError.prototype.name = 'NotFoundError';\n\n      function NotFoundError(message) {\n        NotFoundError.__super__.constructor.call(this, message || \"Record couldn't be found in storage!\");\n      }\n\n      return NotFoundError;\n\n    })(StorageAdapter.StorageError);\n\n    StorageAdapter.NotAllowedError = (function(_super1) {\n\n      __extends(NotAllowedError, _super1);\n\n      NotAllowedError.prototype.name = \"NotAllowedError\";\n\n      function NotAllowedError(message) {\n        NotAllowedError.__super__.constructor.call(this, message || \"Storage operation denied access to the operation!\");\n      }\n\n      return NotAllowedError;\n\n    })(StorageAdapter.StorageError);\n\n    StorageAdapter.NotAcceptableError = (function(_super1) {\n\n      __extends(NotAcceptableError, _super1);\n\n      NotAcceptableError.prototype.name = \"NotAcceptableError\";\n\n      function NotAcceptableError(message) {\n        NotAcceptableError.__super__.constructor.call(this, message || \"Storage operation permitted but the request was malformed!\");\n      }\n\n      return NotAcceptableError;\n\n    })(StorageAdapter.StorageError);\n\n    StorageAdapter.UnprocessableRecordError = (function(_super1) {\n\n      __extends(UnprocessableRecordError, _super1);\n\n      UnprocessableRecordError.prototype.name = \"UnprocessableRecordError\";\n\n      function UnprocessableRecordError(message) {\n        UnprocessableRecordError.__super__.constructor.call(this, message || \"Storage adapter could not process the record!\");\n      }\n\n      return UnprocessableRecordError;\n\n    })(StorageAdapter.StorageError);\n\n    StorageAdapter.InternalStorageError = (function(_super1) {\n\n      __extends(InternalStorageError, _super1);\n\n      InternalStorageError.prototype.name = \"InternalStorageError\";\n\n      function InternalStorageError(message) {\n        InternalStorageError.__super__.constructor.call(this, message || \"An error occured during the storage operation!\");\n      }\n\n      return InternalStorageError;\n\n    })(StorageAdapter.StorageError);\n\n    StorageAdapter.NotImplementedError = (function(_super1) {\n\n      __extends(NotImplementedError, _super1);\n\n      NotImplementedError.prototype.name = \"NotImplementedError\";\n\n      function NotImplementedError(message) {\n        NotImplementedError.__super__.constructor.call(this, message || \"This operation is not implemented by the storage adpater!\");\n      }\n\n      return NotImplementedError;\n\n    })(StorageAdapter.StorageError);\n\n    function StorageAdapter(model) {\n      var constructor;\n      StorageAdapter.__super__.constructor.call(this, {\n        model: model\n      });\n      constructor = this.constructor;\n      if (constructor.ModelMixin) {\n        Batman.extend(model, constructor.ModelMixin);\n      }\n      if (constructor.RecordMixin) {\n        Batman.extend(model.prototype, constructor.RecordMixin);\n      }\n    }\n\n    StorageAdapter.prototype.isStorageAdapter = true;\n\n    StorageAdapter.prototype.storageKey = function(record) {\n      var model;\n      model = (record != null ? record.constructor : void 0) || this.model;\n      return model.get('storageKey') || Batman.helpers.pluralize(Batman.helpers.underscore(model.get('resourceName')));\n    };\n\n    StorageAdapter.prototype.getRecordFromData = function(attributes, constructor) {\n      var record;\n      if (constructor == null) {\n        constructor = this.model;\n      }\n      record = new constructor();\n      record._withoutDirtyTracking(function() {\n        return this.fromJSON(attributes);\n      });\n      return record;\n    };\n\n    StorageAdapter.skipIfError = function(f) {\n      return function(env, next) {\n        if (env.error != null) {\n          return next();\n        } else {\n          return f.call(this, env, next);\n        }\n      };\n    };\n\n    StorageAdapter.prototype.before = function() {\n      return this._addFilter.apply(this, ['before'].concat(__slice.call(arguments)));\n    };\n\n    StorageAdapter.prototype.after = function() {\n      return this._addFilter.apply(this, ['after'].concat(__slice.call(arguments)));\n    };\n\n    StorageAdapter.prototype._inheritFilters = function() {\n      var filtersByKey, filtersList, key, oldFilters, position, _results;\n      if (!this._batman.check(this) || !this._batman.filters) {\n        oldFilters = this._batman.getFirst('filters');\n        this._batman.filters = {\n          before: {},\n          after: {}\n        };\n        if (oldFilters != null) {\n          _results = [];\n          for (position in oldFilters) {\n            filtersByKey = oldFilters[position];\n            _results.push((function() {\n              var _results1;\n              _results1 = [];\n              for (key in filtersByKey) {\n                filtersList = filtersByKey[key];\n                _results1.push(this._batman.filters[position][key] = filtersList.slice(0));\n              }\n              return _results1;\n            }).call(this));\n          }\n          return _results;\n        }\n      }\n    };\n\n    StorageAdapter.prototype._addFilter = function() {\n      var filter, key, keys, position, _base, _i, _j, _len;\n      position = arguments[0], keys = 3 <= arguments.length ? __slice.call(arguments, 1, _i = arguments.length - 1) : (_i = 1, []), filter = arguments[_i++];\n      this._inheritFilters();\n      for (_j = 0, _len = keys.length; _j < _len; _j++) {\n        key = keys[_j];\n        (_base = this._batman.filters[position])[key] || (_base[key] = []);\n        this._batman.filters[position][key].push(filter);\n      }\n      return true;\n    };\n\n    StorageAdapter.prototype.runFilter = function(position, action, env, callback) {\n      var actionFilters, allFilters, filters, next, _this = this;\n      this._inheritFilters();\n      allFilters = this._batman.filters[position].all || [];\n      actionFilters = this._batman.filters[position][action] || [];\n      env.action = action;\n      filters = position === 'before' ? actionFilters.concat(allFilters) : allFilters.concat(actionFilters);\n      next = function(newEnv) {\n        var nextFilter;\n        if (newEnv != null) {\n          env = newEnv;\n        }\n        if ((nextFilter = filters.shift()) != null) {\n          return nextFilter.call(_this, env, next);\n        } else {\n          return callback.call(_this, env);\n        }\n      };\n      return next();\n    };\n\n    StorageAdapter.prototype.runBeforeFilter = function() {\n      return this.runFilter.apply(this, ['before'].concat(__slice.call(arguments)));\n    };\n\n    StorageAdapter.prototype.runAfterFilter = function(action, env, callback) {\n      return this.runFilter('after', action, env, this.exportResult(callback));\n    };\n\n    StorageAdapter.prototype.exportResult = function(callback) {\n      return function(env) {\n        return callback(env.error, env.result, env);\n      };\n    };\n\n    StorageAdapter.prototype._jsonToAttributes = function(json) {\n      return JSON.parse(json);\n    };\n\n    StorageAdapter.prototype.perform = function(key, subject, options, callback) {\n      var env, next, _this = this;\n      options || (options = {});\n      env = {\n        options: options,\n        subject: subject\n      };\n      next = function(newEnv) {\n        if (newEnv != null) {\n          env = newEnv;\n        }\n        return _this.runAfterFilter(key, env, callback);\n      };\n      this.runBeforeFilter(key, env, function(env) {\n        return this[key](env, next);\n      });\n      return void 0;\n    };\n\n    return StorageAdapter;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice,\n    __indexOf = [].indexOf ||\n  function(item) {\n    for (var i = 0, l = this.length; i < l; i++) {\n      if (i in this && this[i] === item) return i;\n    }\n    return -1;\n  };\n\n  Batman.RestStorage = (function(_super) {\n    var key, _fn, _i, _len, _ref, _this = this;\n\n    __extends(RestStorage, _super);\n\n    RestStorage.CommunicationError = (function(_super1) {\n\n      __extends(CommunicationError, _super1);\n\n      CommunicationError.prototype.name = 'CommunicationError';\n\n      function CommunicationError(message) {\n        CommunicationError.__super__.constructor.call(this, message || \"A communication error has occurred!\");\n      }\n\n      return CommunicationError;\n\n    })(RestStorage.StorageError);\n\n    RestStorage.JSONContentType = 'application/json';\n\n    RestStorage.PostBodyContentType = 'application/x-www-form-urlencoded';\n\n    RestStorage.BaseMixin = {\n      request: function(action, options, callback) {\n        if (!callback) {\n          callback = options;\n          options = {};\n        }\n        options.method || (options.method = 'GET');\n        options.action = action;\n        return this._doStorageOperation(options.method.toLowerCase(), options, callback);\n      }\n    };\n\n    RestStorage.ModelMixin = Batman.extend({}, RestStorage.BaseMixin, {\n      urlNestsUnder: function() {\n        var key, keys, parents, _i, _len;\n        keys = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        parents = {};\n        for (_i = 0, _len = keys.length; _i < _len; _i++) {\n          key = keys[_i];\n          parents[key + '_id'] = Batman.helpers.pluralize(key);\n        }\n        this.url = function(options) {\n          var childSegment, parentID, plural;\n          childSegment = Batman.helpers.pluralize(this.get('resourceName').toLowerCase());\n          for (key in parents) {\n            plural = parents[key];\n            parentID = options.data[key];\n            if (parentID) {\n              delete options.data[key];\n              return \"\" + plural + \"/\" + parentID + \"/\" + childSegment;\n            }\n          }\n          return childSegment;\n        };\n        return this.prototype.url = function() {\n          var childSegment, id, parentID, plural, url;\n          childSegment = Batman.helpers.pluralize(this.constructor.get('resourceName').toLowerCase());\n          for (key in parents) {\n            plural = parents[key];\n            parentID = this.get('dirtyKeys').get(key);\n            if (parentID === void 0) {\n              parentID = this.get(key);\n            }\n            if (parentID) {\n              url = \"\" + plural + \"/\" + parentID + \"/\" + childSegment;\n              break;\n            }\n          }\n          url || (url = childSegment);\n          if (id = this.get('id')) {\n            url += '/' + id;\n          }\n          return url;\n        };\n      }\n    });\n\n    RestStorage.RecordMixin = Batman.extend({}, RestStorage.BaseMixin);\n\n    RestStorage.prototype.defaultRequestOptions = {\n      type: 'json'\n    };\n\n    RestStorage.prototype._implicitActionNames = ['create', 'read', 'update', 'destroy', 'readAll'];\n\n    RestStorage.prototype.serializeAsForm = true;\n\n    function RestStorage() {\n      RestStorage.__super__.constructor.apply(this, arguments);\n      this.defaultRequestOptions = Batman.extend({}, this.defaultRequestOptions);\n    }\n\n    RestStorage.prototype.recordJsonNamespace = function(record) {\n      return Batman.helpers.singularize(this.storageKey(record));\n    };\n\n    RestStorage.prototype.collectionJsonNamespace = function(constructor) {\n      return Batman.helpers.pluralize(this.storageKey(constructor.prototype));\n    };\n\n    RestStorage.prototype._execWithOptions = function(object, key, options, context) {\n      if (context == null) {\n        context = object;\n      }\n      if (typeof object[key] === 'function') {\n        return object[key].call(context, options);\n      } else {\n        return object[key];\n      }\n    };\n\n    RestStorage.prototype._defaultCollectionUrl = function(model) {\n      return \"\" + (this.storageKey(model.prototype));\n    };\n\n    RestStorage.prototype._addParams = function(url, options) {\n      var _ref;\n      if (options && options.action && !(_ref = options.action, __indexOf.call(this._implicitActionNames, _ref) >= 0)) {\n        url += '/' + options.action.toLowerCase();\n      }\n      return url;\n    };\n\n    RestStorage.prototype._addUrlAffixes = function(url, subject, env) {\n      var prefix, segments;\n      segments = [url, this.urlSuffix(subject, env)];\n      if (url.charAt(0) !== '/') {\n        prefix = this.urlPrefix(subject, env);\n        if (prefix.charAt(prefix.length - 1) !== '/') {\n          segments.unshift('/');\n        }\n        segments.unshift(prefix);\n      }\n      return segments.join('');\n    };\n\n    RestStorage.prototype.urlPrefix = function(object, env) {\n      return this._execWithOptions(object, 'urlPrefix', env.options) || '';\n    };\n\n    RestStorage.prototype.urlSuffix = function(object, env) {\n      return this._execWithOptions(object, 'urlSuffix', env.options) || '';\n    };\n\n    RestStorage.prototype.urlForRecord = function(record, env) {\n      var id, url, _ref;\n      if ((_ref = env.options) != null ? _ref.recordUrl : void 0) {\n        url = this._execWithOptions(env.options, 'recordUrl', env.options, record);\n      } else if (record.url) {\n        url = this._execWithOptions(record, 'url', env.options);\n      } else {\n        url = record.constructor.url ? this._execWithOptions(record.constructor, 'url', env.options) : this._defaultCollectionUrl(record.constructor);\n        if (env.action !== 'create') {\n          if ((id = record.get('id')) != null) {\n            url = url + \"/\" + id;\n          } else {\n            throw new this.constructor.StorageError(\"Couldn't get/set record primary key on \" + env.action + \"!\");\n          }\n        }\n      }\n      return this._addUrlAffixes(this._addParams(url, env.options), record, env);\n    };\n\n    RestStorage.prototype.urlForCollection = function(model, env) {\n      var url, _ref;\n      url = ((_ref = env.options) != null ? _ref.collectionUrl : void 0) ? this._execWithOptions(env.options, 'collectionUrl', env.options, env.options.urlContext) : model.url ? this._execWithOptions(model, 'url', env.options) : this._defaultCollectionUrl(model, env.options);\n      return this._addUrlAffixes(this._addParams(url, env.options), model, env);\n    };\n\n    RestStorage.prototype.request = function(env, next) {\n      var options;\n      options = Batman.extend(env.options, {\n        autosend: false,\n        success: function(data) {\n          return env.data = data;\n        },\n        error: function(error) {\n          return env.error = error;\n        },\n        loaded: function() {\n          env.response = env.request.get('response');\n          return next();\n        }\n      });\n      env.request = new Batman.Request(options);\n      return env.request.send();\n    };\n\n    RestStorage.prototype.perform = function(key, record, options, callback) {\n      options || (options = {});\n      Batman.extend(options, this.defaultRequestOptions);\n      return RestStorage.__super__.perform.call(this, key, record, options, callback);\n    };\n\n    RestStorage.prototype.before('all', RestStorage.skipIfError(function(env, next) {\n      if (!env.options.url) {\n        try {\n          env.options.url = env.subject.prototype ? this.urlForCollection(env.subject, env) : this.urlForRecord(env.subject, env);\n        } catch (error) {\n          env.error = error;\n        }\n      }\n      return next();\n    }));\n\n    RestStorage.prototype.before('get', 'put', 'post', 'delete', RestStorage.skipIfError(function(env, next) {\n      env.options.method = env.action.toUpperCase();\n      return next();\n    }));\n\n    RestStorage.prototype.before('create', 'update', RestStorage.skipIfError(function(env, next) {\n      var data, json, namespace;\n      json = env.subject.toJSON();\n      if (namespace = this.recordJsonNamespace(env.subject)) {\n        data = {};\n        data[namespace] = json;\n      } else {\n        data = json;\n      }\n      env.options.data = data;\n      return next();\n    }));\n\n    RestStorage.prototype.before('create', 'update', 'put', 'post', RestStorage.skipIfError(function(env, next) {\n      if (this.serializeAsForm) {\n        env.options.contentType = this.constructor.PostBodyContentType;\n      } else {\n        if (env.options.data != null) {\n          env.options.data = JSON.stringify(env.options.data);\n          env.options.contentType = this.constructor.JSONContentType;\n        }\n      }\n      return next();\n    }));\n\n    RestStorage.prototype.after('all', RestStorage.skipIfError(function(env, next) {\n      var json;\n      if (!(env.data != null)) {\n        return next();\n      }\n      if (typeof env.data === 'string') {\n        if (env.data.length > 0) {\n          try {\n            json = this._jsonToAttributes(env.data);\n          } catch (error) {\n            env.error = error;\n            return next();\n          }\n        }\n      } else if (typeof env.data === 'object') {\n        json = env.data;\n      }\n      if (json != null) {\n        env.json = json;\n      }\n      return next();\n    }));\n\n    RestStorage.prototype.extractFromNamespace = function(data, namespace) {\n      if (namespace && (data[namespace] != null)) {\n        return data[namespace];\n      } else {\n        return data;\n      }\n    };\n\n    RestStorage.prototype.after('create', 'read', 'update', RestStorage.skipIfError(function(env, next) {\n      var json;\n      if (env.json != null) {\n        json = this.extractFromNamespace(env.json, this.recordJsonNamespace(env.subject));\n        env.subject._withoutDirtyTracking(function() {\n          return this.fromJSON(json);\n        });\n      }\n      env.result = env.subject;\n      return next();\n    }));\n\n    RestStorage.prototype.after('readAll', RestStorage.skipIfError(function(env, next) {\n      var jsonRecordAttributes, namespace;\n      namespace = this.collectionJsonNamespace(env.subject);\n      env.recordsAttributes = this.extractFromNamespace(env.json, namespace);\n      if (Batman.typeOf(env.recordsAttributes) !== 'Array') {\n        namespace = this.recordJsonNamespace(env.subject.prototype);\n        env.recordsAttributes = [this.extractFromNamespace(env.json, namespace)];\n      }\n      env.result = env.records = (function() {\n        var _i, _len, _ref, _results;\n        _ref = env.recordsAttributes;\n        _results = [];\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          jsonRecordAttributes = _ref[_i];\n          _results.push(this.getRecordFromData(jsonRecordAttributes, env.subject));\n        }\n        return _results;\n      }).call(this);\n      return next();\n    }));\n\n    RestStorage.prototype.after('get', 'put', 'post', 'delete', RestStorage.skipIfError(function(env, next) {\n      var json, namespace;\n      if (env.json != null) {\n        json = env.json;\n        namespace = env.subject.prototype ? this.collectionJsonNamespace(env.subject) : this.recordJsonNamespace(env.subject);\n        env.result = namespace && (env.json[namespace] != null) ? env.json[namespace] : env.json;\n      }\n      return next();\n    }));\n\n    RestStorage.HTTPMethods = {\n      create: 'POST',\n      update: 'PUT',\n      read: 'GET',\n      readAll: 'GET',\n      destroy: 'DELETE'\n    };\n\n    _ref = ['create', 'read', 'update', 'destroy', 'readAll', 'get', 'post', 'put', 'delete'];\n    _fn = function(key) {\n      return RestStorage.prototype[key] = RestStorage.skipIfError(function(env, next) {\n        var _base;\n        (_base = env.options).method || (_base.method = this.constructor.HTTPMethods[key]);\n        return this.request(env, next);\n      });\n    };\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      key = _ref[_i];\n      _fn(key);\n    }\n\n    RestStorage.prototype.after('all', function(env, next) {\n      if (env.error) {\n        env.error = this._errorFor(env.error, env);\n      }\n      return next();\n    });\n\n    RestStorage._statusCodeErrors = {\n      '0': RestStorage.CommunicationError,\n      '403': RestStorage.NotAllowedError,\n      '404': RestStorage.NotFoundError,\n      '406': RestStorage.NotAcceptableError,\n      '409': RestStorage.RecordExistsError,\n      '422': RestStorage.UnprocessableRecordError,\n      '500': RestStorage.InternalStorageError,\n      '501': RestStorage.NotImplementedError\n    };\n\n    RestStorage.prototype._errorFor = function(error, env) {\n      var errorClass, request;\n      if (error instanceof Error || !(error.request != null)) {\n        return error;\n      }\n      if (errorClass = this.constructor._statusCodeErrors[error.request.status]) {\n        request = error.request;\n        error = new errorClass;\n        error.request = request;\n        error.env = env;\n      }\n      return error;\n    };\n\n    return RestStorage;\n\n  }).call(this, Batman.StorageAdapter);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.LocalStorage = (function(_super) {\n\n    __extends(LocalStorage, _super);\n\n    function LocalStorage() {\n      if (typeof window.localStorage === 'undefined') {\n        return null;\n      }\n      LocalStorage.__super__.constructor.apply(this, arguments);\n      this.storage = localStorage;\n    }\n\n    LocalStorage.prototype.storageRegExpForRecord = function(record) {\n      return new RegExp(\"^\" + (this.storageKey(record)) + \"(\\\\d+)$\");\n    };\n\n    LocalStorage.prototype.nextIdForRecord = function(record) {\n      var nextId, re;\n      re = this.storageRegExpForRecord(record);\n      nextId = 1;\n      this._forAllStorageEntries(function(k, v) {\n        var matches;\n        if (matches = re.exec(k)) {\n          return nextId = Math.max(nextId, parseInt(matches[1], 10) + 1);\n        }\n      });\n      return nextId;\n    };\n\n    LocalStorage.prototype._forAllStorageEntries = function(iterator) {\n      var i, key, _i, _ref;\n      for (i = _i = 0, _ref = this.storage.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {\n        key = this.storage.key(i);\n        iterator.call(this, key, this.storage.getItem(key));\n      }\n      return true;\n    };\n\n    LocalStorage.prototype._storageEntriesMatching = function(constructor, options) {\n      var re, records;\n      re = this.storageRegExpForRecord(constructor.prototype);\n      records = [];\n      this._forAllStorageEntries(function(storageKey, storageString) {\n        var data, keyMatches;\n        if (keyMatches = re.exec(storageKey)) {\n          data = this._jsonToAttributes(storageString);\n          data[constructor.primaryKey] = keyMatches[1];\n          if (this._dataMatches(options, data)) {\n            return records.push(data);\n          }\n        }\n      });\n      return records;\n    };\n\n    LocalStorage.prototype._dataMatches = function(conditions, data) {\n      var k, match, v;\n      match = true;\n      for (k in conditions) {\n        v = conditions[k];\n        if (data[k] !== v) {\n          match = false;\n          break;\n        }\n      }\n      return match;\n    };\n\n    LocalStorage.prototype.before('read', 'create', 'update', 'destroy', LocalStorage.skipIfError(function(env, next) {\n      var _this = this;\n      if (env.action === 'create') {\n        env.id = env.subject.get('id') || env.subject._withoutDirtyTracking(function() {\n          return env.subject.set('id', _this.nextIdForRecord(env.subject));\n        });\n      } else {\n        env.id = env.subject.get('id');\n      }\n      if (env.id == null) {\n        env.error = new this.constructor.StorageError(\"Couldn't get/set record primary key on \" + env.action + \"!\");\n      } else {\n        env.key = this.storageKey(env.subject) + env.id;\n      }\n      return next();\n    }));\n\n    LocalStorage.prototype.before('create', 'update', LocalStorage.skipIfError(function(env, next) {\n      env.recordAttributes = JSON.stringify(env.subject);\n      return next();\n    }));\n\n    LocalStorage.prototype.after('read', LocalStorage.skipIfError(function(env, next) {\n      if (typeof env.recordAttributes === 'string') {\n        try {\n          env.recordAttributes = this._jsonToAttributes(env.recordAttributes);\n        } catch (error) {\n          env.error = error;\n          return next();\n        }\n      }\n      env.subject._withoutDirtyTracking(function() {\n        return this.fromJSON(env.recordAttributes);\n      });\n      return next();\n    }));\n\n    LocalStorage.prototype.after('read', 'create', 'update', 'destroy', LocalStorage.skipIfError(function(env, next) {\n      env.result = env.subject;\n      return next();\n    }));\n\n    LocalStorage.prototype.after('readAll', LocalStorage.skipIfError(function(env, next) {\n      var recordAttributes;\n      env.result = env.records = (function() {\n        var _i, _len, _ref, _results;\n        _ref = env.recordsAttributes;\n        _results = [];\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          recordAttributes = _ref[_i];\n          _results.push(this.getRecordFromData(recordAttributes, env.subject));\n        }\n        return _results;\n      }).call(this);\n      return next();\n    }));\n\n    LocalStorage.prototype.read = LocalStorage.skipIfError(function(env, next) {\n      env.recordAttributes = this.storage.getItem(env.key);\n      if (!env.recordAttributes) {\n        env.error = new this.constructor.NotFoundError();\n      }\n      return next();\n    });\n\n    LocalStorage.prototype.create = LocalStorage.skipIfError(function(_arg, next) {\n      var key, recordAttributes;\n      key = _arg.key, recordAttributes = _arg.recordAttributes;\n      if (this.storage.getItem(key)) {\n        arguments[0].error = new this.constructor.RecordExistsError;\n      } else {\n        this.storage.setItem(key, recordAttributes);\n      }\n      return next();\n    });\n\n    LocalStorage.prototype.update = LocalStorage.skipIfError(function(_arg, next) {\n      var key, recordAttributes;\n      key = _arg.key, recordAttributes = _arg.recordAttributes;\n      this.storage.setItem(key, recordAttributes);\n      return next();\n    });\n\n    LocalStorage.prototype.destroy = LocalStorage.skipIfError(function(_arg, next) {\n      var key;\n      key = _arg.key;\n      this.storage.removeItem(key);\n      return next();\n    });\n\n    LocalStorage.prototype.readAll = LocalStorage.skipIfError(function(env, next) {\n      try {\n        arguments[0].recordsAttributes = this._storageEntriesMatching(env.subject, env.options.data);\n      } catch (error) {\n        arguments[0].error = error;\n      }\n      return next();\n    });\n\n    return LocalStorage;\n\n  })(Batman.StorageAdapter);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.SessionStorage = (function(_super) {\n\n    __extends(SessionStorage, _super);\n\n    function SessionStorage() {\n      if (typeof window.sessionStorage === 'undefined') {\n        return null;\n      }\n      SessionStorage.__super__.constructor.apply(this, arguments);\n      this.storage = sessionStorage;\n    }\n\n    return SessionStorage;\n\n  })(Batman.LocalStorage);\n\n}).call(this);\n\n(function() {\n\n  Batman.Encoders = new Batman.Object;\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.ParamsReplacer = (function(_super) {\n\n    __extends(ParamsReplacer, _super);\n\n    function ParamsReplacer(navigator, params) {\n      this.navigator = navigator;\n      this.params = params;\n    }\n\n    ParamsReplacer.prototype.redirect = function() {\n      return this.navigator.replace(this.toObject());\n    };\n\n    ParamsReplacer.prototype.replace = function(params) {\n      this.params.replace(params);\n      return this.redirect();\n    };\n\n    ParamsReplacer.prototype.update = function(params) {\n      this.params.update(params);\n      return this.redirect();\n    };\n\n    ParamsReplacer.prototype.clear = function() {\n      this.params.clear();\n      return this.redirect();\n    };\n\n    ParamsReplacer.prototype.toObject = function() {\n      return this.params.toObject();\n    };\n\n    ParamsReplacer.accessor({\n      get: function(k) {\n        return this.params.get(k);\n      },\n      set: function(k, v) {\n        var oldValue, result;\n        oldValue = this.params.get(k);\n        result = this.params.set(k, v);\n        if (oldValue !== v) {\n          this.redirect();\n        }\n        return result;\n      },\n      unset: function(k) {\n        var hadKey, result;\n        hadKey = this.params.hasKey(k);\n        result = this.params.unset(k);\n        if (hadKey) {\n          this.redirect();\n        }\n        return result;\n      }\n    });\n\n    return ParamsReplacer;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.ParamsPusher = (function(_super) {\n\n    __extends(ParamsPusher, _super);\n\n    function ParamsPusher() {\n      return ParamsPusher.__super__.constructor.apply(this, arguments);\n    }\n\n    ParamsPusher.prototype.redirect = function() {\n      return this.navigator.push(this.toObject());\n    };\n\n    return ParamsPusher;\n\n  })(Batman.ParamsReplacer);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.NamedRouteQuery = (function(_super) {\n\n    __extends(NamedRouteQuery, _super);\n\n    NamedRouteQuery.prototype.isNamedRouteQuery = true;\n\n    function NamedRouteQuery(routeMap, args) {\n      var key;\n      if (args == null) {\n        args = [];\n      }\n      NamedRouteQuery.__super__.constructor.call(this, {\n        routeMap: routeMap,\n        args: args\n      });\n      for (key in this.get('routeMap').childrenByName) {\n        this[key] = this._queryAccess.bind(this, key);\n      }\n    }\n\n    NamedRouteQuery.accessor('route', function() {\n      var collectionRoute, memberRoute, route, _i, _len, _ref, _ref1;\n      _ref = this.get('routeMap'), memberRoute = _ref.memberRoute, collectionRoute = _ref.collectionRoute;\n      _ref1 = [memberRoute, collectionRoute];\n      for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n        route = _ref1[_i];\n        if (route != null) {\n          if (route.namedArguments.length === this.get('args').length) {\n            return route;\n          }\n        }\n      }\n      return collectionRoute || memberRoute;\n    });\n\n    NamedRouteQuery.accessor('path', function() {\n      return this.path();\n    });\n\n    NamedRouteQuery.accessor('routeMap', 'args', 'cardinality', 'hashValue', Batman.Property.defaultAccessor);\n\n    NamedRouteQuery.accessor({\n      get: function(key) {\n        if (key == null) {\n          return;\n        }\n        if (typeof key === 'string') {\n          return this.nextQueryForName(key);\n        } else {\n          return this.nextQueryWithArgument(key);\n        }\n      },\n      cache: false\n    });\n\n    NamedRouteQuery.accessor('withHash', function() {\n      var _this = this;\n      return new Batman.Accessible(function(hashValue) {\n        return _this.withHash(hashValue);\n      });\n    });\n\n    NamedRouteQuery.prototype.withHash = function(hashValue) {\n      var clone;\n      clone = this.clone();\n      clone.set('hashValue', hashValue);\n      return clone;\n    };\n\n    NamedRouteQuery.prototype.nextQueryForName = function(key) {\n      var map;\n      if (map = this.get('routeMap').childrenByName[key]) {\n        return new Batman.NamedRouteQuery(map, this.args);\n      } else {\n        return Batman.developer.error(\"Couldn't find a route for the name \" + key + \"!\");\n      }\n    };\n\n    NamedRouteQuery.prototype.nextQueryWithArgument = function(arg) {\n      var args;\n      args = this.args.slice(0);\n      args.push(arg);\n      return this.clone(args);\n    };\n\n    NamedRouteQuery.prototype.path = function() {\n      var argumentName, argumentValue, index, namedArguments, params, _i, _len;\n      params = {};\n      namedArguments = this.get('route.namedArguments');\n      for (index = _i = 0, _len = namedArguments.length; _i < _len; index = ++_i) {\n        argumentName = namedArguments[index];\n        if ((argumentValue = this.get('args')[index]) != null) {\n          params[argumentName] = this._toParam(argumentValue);\n        }\n      }\n      if (this.get('hashValue') != null) {\n        params['#'] = this.get('hashValue');\n      }\n      return this.get('route').pathFromParams(params);\n    };\n\n    NamedRouteQuery.prototype.toString = function() {\n      return this.path();\n    };\n\n    NamedRouteQuery.prototype.clone = function(args) {\n      if (args == null) {\n        args = this.args;\n      }\n      return new Batman.NamedRouteQuery(this.routeMap, args);\n    };\n\n    NamedRouteQuery.prototype._toParam = function(arg) {\n      if (arg instanceof Batman.AssociationProxy) {\n        arg = arg.get('target');\n      }\n      if ((arg != null ? arg.toParam : void 0) != null) {\n        return arg.toParam();\n      } else {\n        return arg;\n      }\n    };\n\n    NamedRouteQuery.prototype._queryAccess = function(key, arg) {\n      var query;\n      query = this.nextQueryForName(key);\n      if (arg != null) {\n        query = query.nextQueryWithArgument(arg);\n      }\n      return query;\n    };\n\n    return NamedRouteQuery;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.Dispatcher = (function(_super) {\n    var ControllerDirectory;\n\n    __extends(Dispatcher, _super);\n\n    Dispatcher.canInferRoute = function(argument) {\n      return argument instanceof Batman.Model || argument instanceof Batman.AssociationProxy || argument.prototype instanceof Batman.Model;\n    };\n\n    Dispatcher.paramsFromArgument = function(argument) {\n      var resourceNameFromModel;\n      resourceNameFromModel = function(model) {\n        return Batman.helpers.camelize(Batman.helpers.pluralize(model.get('resourceName')), true);\n      };\n      if (!this.canInferRoute(argument)) {\n        return argument;\n      }\n      if (argument instanceof Batman.Model || argument instanceof Batman.AssociationProxy) {\n        if (argument.isProxy) {\n          argument = argument.get('target');\n        }\n        if (argument != null) {\n          return {\n            controller: resourceNameFromModel(argument.constructor),\n            action: 'show',\n            id: argument.get('id')\n          };\n        } else {\n          return {};\n        }\n      } else if (argument.prototype instanceof Batman.Model) {\n        return {\n          controller: resourceNameFromModel(argument),\n          action: 'index'\n        };\n      } else {\n        return argument;\n      }\n    };\n\n    ControllerDirectory = (function(_super1) {\n\n      __extends(ControllerDirectory, _super1);\n\n      function ControllerDirectory() {\n        return ControllerDirectory.__super__.constructor.apply(this, arguments);\n      }\n\n      ControllerDirectory.accessor('__app', Batman.Property.defaultAccessor);\n\n      ControllerDirectory.accessor(function(key) {\n        return this.get(\"__app.\" + (Batman.helpers.capitalize(key)) + \"Controller.sharedController\");\n      });\n\n      return ControllerDirectory;\n\n    })(Batman.Object);\n\n    Dispatcher.accessor('controllers', function() {\n      return new ControllerDirectory({\n        __app: this.get('app')\n      });\n    });\n\n    function Dispatcher(app, routeMap) {\n      Dispatcher.__super__.constructor.call(this, {\n        app: app,\n        routeMap: routeMap\n      });\n    }\n\n    Dispatcher.prototype.routeForParams = function(params) {\n      params = this.constructor.paramsFromArgument(params);\n      return this.get('routeMap').routeForParams(params);\n    };\n\n    Dispatcher.prototype.pathFromParams = function(params) {\n      var _ref;\n      if (typeof params === 'string') {\n        return params;\n      }\n      params = this.constructor.paramsFromArgument(params);\n      return (_ref = this.routeForParams(params)) != null ? _ref.pathFromParams(params) : void 0;\n    };\n\n    Dispatcher.prototype.dispatch = function(params) {\n      var error, inferredParams, path, route, _ref, _ref1;\n      inferredParams = this.constructor.paramsFromArgument(params);\n      route = this.routeForParams(inferredParams);\n      if (route) {\n        _ref = route.pathAndParamsFromArgument(inferredParams), path = _ref[0], params = _ref[1];\n        this.set('app.currentRoute', route);\n        this.set('app.currentURL', path);\n        this.get('app.currentParams').replace(params || {});\n        route.dispatch(params);\n      } else {\n        if (Batman.typeOf(params) === 'Object' && !this.constructor.canInferRoute(params)) {\n          return this.get('app.currentParams').replace(params);\n        } else {\n          this.get('app.currentParams').clear();\n        }\n        error = {\n          type: '404',\n          isPrevented: false,\n          preventDefault: function() {\n            return this.isPrevented = true;\n          }\n        };\n        if ((_ref1 = Batman.currentApp) != null) {\n          _ref1.fire('error', error);\n        }\n        if (error.isPrevented) {\n          return params;\n        }\n        if (params !== '/404') {\n          return Batman.redirect('/404');\n        }\n      }\n      return path;\n    };\n\n    return Dispatcher;\n\n  }).call(this, Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.Route = (function(_super) {\n\n    __extends(Route, _super);\n\n    Route.regexps = {\n      namedParam: /:([\\w\\d]+)/g,\n      splatParam: /\\*([\\w\\d]+)/g,\n      queryParam: '(?:\\\\?.+)?',\n      namedOrSplat: /[:|\\*]([\\w\\d]+)/g,\n      namePrefix: '[:|\\*]',\n      escapeRegExp: /[-[\\]{}+?.,\\\\^$|#\\s]/g,\n      openOptParam: /\\(/g,\n      closeOptParam: /\\)/g\n    };\n\n    Route.prototype.optionKeys = ['member', 'collection'];\n\n    Route.prototype.testKeys = ['controller', 'action'];\n\n    Route.prototype.isRoute = true;\n\n    function Route(templatePath, baseParams) {\n      var k, matches, namedArguments, pattern, properties, regexp, regexps, _i, _len, _ref;\n      regexps = this.constructor.regexps;\n      if (templatePath.indexOf('/') !== 0) {\n        templatePath = \"/\" + templatePath;\n      }\n      pattern = templatePath.replace(regexps.escapeRegExp, '\\\\$&');\n      regexp = RegExp(\"^\" + (pattern.replace(regexps.openOptParam, '(?:').replace(regexps.closeOptParam, ')?').replace(regexps.namedParam, '([^\\/]+)').replace(regexps.splatParam, '(.*?)')) + regexps.queryParam + \"$\");\n      regexps.namedOrSplat.lastIndex = 0;\n      namedArguments = ((function() {\n        var _results;\n        _results = [];\n        while (matches = regexps.namedOrSplat.exec(pattern)) {\n          _results.push(matches[1]);\n        }\n        return _results;\n      })());\n      properties = {\n        templatePath: templatePath,\n        pattern: pattern,\n        regexp: regexp,\n        namedArguments: namedArguments,\n        baseParams: baseParams\n      };\n      _ref = this.optionKeys;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        k = _ref[_i];\n        properties[k] = baseParams[k];\n        delete baseParams[k];\n      }\n      Route.__super__.constructor.call(this, properties);\n    }\n\n    Route.prototype.paramsFromPath = function(pathAndQuery) {\n      var index, match, matches, name, namedArguments, params, uri, _i, _len;\n      uri = new Batman.URI(pathAndQuery);\n      namedArguments = this.get('namedArguments');\n      params = Batman.extend({\n        path: uri.path\n      }, this.get('baseParams'));\n      matches = this.get('regexp').exec(uri.path).slice(1);\n      for (index = _i = 0, _len = matches.length; _i < _len; index = ++_i) {\n        match = matches[index];\n        name = namedArguments[index];\n        params[name] = match;\n      }\n      return Batman.extend(params, uri.queryParams);\n    };\n\n    Route.prototype.pathFromParams = function(argumentParams) {\n      var hash, key, name, newPath, params, path, query, regexp, regexps, _i, _j, _len, _len1, _ref, _ref1;\n      params = Batman.extend({}, argumentParams);\n      path = this.get('templatePath');\n      regexps = this.constructor.regexps;\n      _ref = this.get('namedArguments');\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        name = _ref[_i];\n        regexp = RegExp(\"\" + regexps.namePrefix + name);\n        newPath = path.replace(regexp, (params[name] != null ? params[name] : ''));\n        if (newPath !== path) {\n          delete params[name];\n          path = newPath;\n        }\n      }\n      path = path.replace(regexps.openOptParam, '').replace(regexps.closeOptParam, '').replace(/([^\\/])\\/+$/, '$1');\n      _ref1 = this.testKeys;\n      for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n        key = _ref1[_j];\n        delete params[key];\n      }\n      if (params['#']) {\n        hash = params['#'];\n        delete params['#'];\n      }\n      query = Batman.URI.queryFromParams(params);\n      if (query) {\n        path += \"?\" + query;\n      }\n      if (hash) {\n        path += \"#\" + hash;\n      }\n      return path;\n    };\n\n    Route.prototype.test = function(pathOrParams) {\n      var key, path, value, _i, _len, _ref;\n      if (typeof pathOrParams === 'string') {\n        path = pathOrParams;\n      } else if (pathOrParams.path != null) {\n        path = pathOrParams.path;\n      } else {\n        path = this.pathFromParams(pathOrParams);\n        _ref = this.testKeys;\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          key = _ref[_i];\n          if ((value = this.get(key)) != null) {\n            if (pathOrParams[key] !== value) {\n              return false;\n            }\n          }\n        }\n      }\n      return this.get('regexp').test(path);\n    };\n\n    Route.prototype.pathAndParamsFromArgument = function(pathOrParams) {\n      var params, path;\n      if (typeof pathOrParams === 'string') {\n        params = this.paramsFromPath(pathOrParams);\n        path = pathOrParams;\n      } else {\n        params = pathOrParams;\n        path = this.pathFromParams(pathOrParams);\n      }\n      return [path, params];\n    };\n\n    Route.prototype.dispatch = function(params) {\n      if (!this.test(params)) {\n        return false;\n      }\n      return this.get('callback')(params);\n    };\n\n    Route.prototype.callback = function() {\n      throw new Batman.DevelopmentError(\"Override callback in a Route subclass\");\n    };\n\n    return Route;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.ControllerActionRoute = (function(_super) {\n\n    __extends(ControllerActionRoute, _super);\n\n    ControllerActionRoute.prototype.optionKeys = ['member', 'collection', 'app', 'controller', 'action'];\n\n    function ControllerActionRoute(templatePath, options) {\n      this.callback = __bind(this.callback, this);\n\n      var action, controller, _ref;\n      if (options.signature) {\n        _ref = options.signature.split('#'), controller = _ref[0], action = _ref[1];\n        action || (action = 'index');\n        options.controller = controller;\n        options.action = action;\n        delete options.signature;\n      }\n      ControllerActionRoute.__super__.constructor.call(this, templatePath, options);\n    }\n\n    ControllerActionRoute.prototype.callback = function(params) {\n      var controller;\n      controller = this.get(\"app.dispatcher.controllers.\" + (this.get('controller')));\n      return controller.dispatch(this.get('action'), params);\n    };\n\n    return ControllerActionRoute;\n\n  })(Batman.Route);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.CallbackActionRoute = (function(_super) {\n\n    __extends(CallbackActionRoute, _super);\n\n    function CallbackActionRoute() {\n      return CallbackActionRoute.__super__.constructor.apply(this, arguments);\n    }\n\n    CallbackActionRoute.prototype.optionKeys = ['member', 'collection', 'callback', 'app'];\n\n    CallbackActionRoute.prototype.controller = false;\n\n    CallbackActionRoute.prototype.action = false;\n\n    return CallbackActionRoute;\n\n  })(Batman.Route);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.Hash = (function(_super) {\n    var k, _fn, _i, _j, _len, _len1, _ref, _ref1, _this = this;\n\n    __extends(Hash, _super);\n\n    Hash.Metadata = (function(_super1) {\n\n      __extends(Metadata, _super1);\n\n      Batman.extend(Metadata.prototype, Batman.Enumerable);\n\n      function Metadata(hash) {\n        this.hash = hash;\n      }\n\n      Metadata.accessor('length', function() {\n        this.hash.registerAsMutableSource();\n        return this.hash.length;\n      });\n\n      Metadata.accessor('isEmpty', 'keys', 'toArray', function(key) {\n        this.hash.registerAsMutableSource();\n        return this.hash[key]();\n      });\n\n      Metadata.prototype.forEach = function() {\n        var _ref;\n        return (_ref = this.hash).forEach.apply(_ref, arguments);\n      };\n\n      return Metadata;\n\n    })(Batman.Object);\n\n    function Hash() {\n      this.meta = new this.constructor.Metadata(this);\n      Batman.SimpleHash.apply(this, arguments);\n      Hash.__super__.constructor.apply(this, arguments);\n    }\n\n    Batman.extend(Hash.prototype, Batman.Enumerable);\n\n    Hash.prototype.propertyClass = Batman.Property;\n\n    Hash.defaultAccessor = {\n      get: Batman.SimpleHash.prototype.get,\n      set: Hash.mutation(function(key, value) {\n        var result;\n        result = Batman.SimpleHash.prototype.set.call(this, key, value);\n        this.fire('itemsWereAdded', key);\n        return result;\n      }),\n      unset: Hash.mutation(function(key) {\n        var result;\n        result = Batman.SimpleHash.prototype.unset.call(this, key);\n        if (result != null) {\n          this.fire('itemsWereRemoved', key);\n        }\n        return result;\n      }),\n      cache: false\n    };\n\n    Hash.accessor(Hash.defaultAccessor);\n\n    Hash.prototype._preventMutationEvents = function(block) {\n      this.prevent('change');\n      this.prevent('itemsWereAdded');\n      this.prevent('itemsWereRemoved');\n      try {\n        return block.call(this);\n      } finally {\n        this.allow('change');\n        this.allow('itemsWereAdded');\n        this.allow('itemsWereRemoved');\n      }\n    };\n\n    Hash.prototype.clear = Hash.mutation(function() {\n      var keys, result;\n      keys = this.keys();\n      this._preventMutationEvents(function() {\n        var _this = this;\n        return this.forEach(function(k) {\n          return _this.unset(k);\n        });\n      });\n      result = Batman.SimpleHash.prototype.clear.call(this);\n      this.fire.apply(this, ['itemsWereRemoved'].concat(__slice.call(keys)));\n      return result;\n    });\n\n    Hash.prototype.update = Hash.mutation(function(object) {\n      var addedKeys;\n      addedKeys = [];\n      this._preventMutationEvents(function() {\n        var _this = this;\n        return Batman.forEach(object, function(k, v) {\n          if (!_this.hasKey(k)) {\n            addedKeys.push(k);\n          }\n          return _this.set(k, v);\n        });\n      });\n      if (addedKeys.length > 0) {\n        return this.fire.apply(this, ['itemsWereAdded'].concat(__slice.call(addedKeys)));\n      }\n    });\n\n    Hash.prototype.replace = Hash.mutation(function(object) {\n      var addedKeys, removedKeys;\n      addedKeys = [];\n      removedKeys = [];\n      this._preventMutationEvents(function() {\n        var _this = this;\n        this.forEach(function(k, _) {\n          if (!Batman.objectHasKey(object, k)) {\n            _this.unset(k);\n            return removedKeys.push(k);\n          }\n        });\n        return Batman.forEach(object, function(k, v) {\n          if (!_this.hasKey(k)) {\n            addedKeys.push(k);\n          }\n          return _this.set(k, v);\n        });\n      });\n      if (addedKeys.length > 0) {\n        this.fire.apply(this, ['itemsWereAdded'].concat(__slice.call(addedKeys)));\n      }\n      if (removedKeys.length > 0) {\n        return this.fire.apply(this, ['itemsWereRemoved'].concat(__slice.call(removedKeys)));\n      }\n    });\n\n    _ref = ['equality', 'hashKeyFor', 'objectKey', 'prefixedKey', 'unprefixedKey'];\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      k = _ref[_i];\n      Hash.prototype[k] = Batman.SimpleHash.prototype[k];\n    }\n\n    _ref1 = ['hasKey', 'forEach', 'isEmpty', 'keys', 'toArray', 'merge', 'toJSON', 'toObject'];\n    _fn = function(k) {\n      return Hash.prototype[k] = function() {\n        this.registerAsMutableSource();\n        return Batman.SimpleHash.prototype[k].apply(this, arguments);\n      };\n    };\n    for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n      k = _ref1[_j];\n      _fn(k);\n    }\n\n    return Hash;\n\n  }).call(this, Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.RenderCache = (function(_super) {\n\n    __extends(RenderCache, _super);\n\n    RenderCache.prototype.maximumLength = 4;\n\n    function RenderCache() {\n      RenderCache.__super__.constructor.apply(this, arguments);\n      this.keyQueue = [];\n    }\n\n    RenderCache.prototype.viewForOptions = function(options) {\n      var _this = this;\n      if (options.cache === false || options.viewClass.prototype.cache === false) {\n        return this._newViewFromOptions(options);\n      }\n      return this.getOrSet(options, function() {\n        return _this._newViewFromOptions(Batman.extend({}, options));\n      });\n    };\n\n    RenderCache.prototype._newViewFromOptions = function(options) {\n      return new options.viewClass(options);\n    };\n\n    RenderCache.wrapAccessor(function(core) {\n      return {\n        cache: false,\n        get: function(key) {\n          var result;\n          result = core.get.call(this, key);\n          if (result) {\n            this._addOrBubbleKey(key);\n          }\n          return result;\n        },\n        set: function(key, value) {\n          var result;\n          result = core.set.apply(this, arguments);\n          result.set('cached', true);\n          this._addOrBubbleKey(key);\n          this._evictExpiredKeys();\n          return result;\n        },\n        unset: function(key) {\n          var result;\n          result = core.unset.apply(this, arguments);\n          result.set('cached', false);\n          this._removeKeyFromQueue(key);\n          return result;\n        }\n      };\n    });\n\n    RenderCache.prototype.equality = function(incomingOptions, storageOptions) {\n      var key;\n      if (Object.keys(incomingOptions).length !== Object.keys(storageOptions).length) {\n        return false;\n      }\n      for (key in incomingOptions) {\n        if (!(key === 'view')) {\n          if (incomingOptions[key] !== storageOptions[key]) {\n            return false;\n          }\n        }\n      }\n      return true;\n    };\n\n    RenderCache.prototype.reset = function() {\n      var key, _i, _len, _ref, _results;\n      _ref = this.keyQueue.slice(0);\n      _results = [];\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        key = _ref[_i];\n        _results.push(this.unset(key));\n      }\n      return _results;\n    };\n\n    RenderCache.prototype._addOrBubbleKey = function(key) {\n      this._removeKeyFromQueue(key);\n      return this.keyQueue.unshift(key);\n    };\n\n    RenderCache.prototype._removeKeyFromQueue = function(key) {\n      var index, queuedKey, _i, _len, _ref;\n      _ref = this.keyQueue;\n      for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {\n        queuedKey = _ref[index];\n        if (this.equality(queuedKey, key)) {\n          this.keyQueue.splice(index, 1);\n          break;\n        }\n      }\n      return key;\n    };\n\n    RenderCache.prototype._evictExpiredKeys = function() {\n      var currentKeys, i, key, _i, _ref, _ref1;\n      if (this.length > this.maximumLength) {\n        currentKeys = this.keyQueue.slice(0);\n        for (i = _i = _ref = this.maximumLength, _ref1 = currentKeys.length; _ref <= _ref1 ? _i < _ref1 : _i > _ref1; i = _ref <= _ref1 ? ++_i : --_i) {\n          key = currentKeys[i];\n          if (!this.get(key).isInDOM()) {\n            this.unset(key);\n          }\n        }\n      }\n    };\n\n    return RenderCache;\n\n  })(Batman.Hash);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice,\n    __indexOf = [].indexOf ||\n  function(item) {\n    for (var i = 0, l = this.length; i < l; i++) {\n      if (i in this && this[i] === item) return i;\n    }\n    return -1;\n  };\n\n  Batman.Controller = (function(_super) {\n    var _optionsFromFilterArguments;\n\n    __extends(Controller, _super);\n\n    Controller.singleton('sharedController');\n\n    Controller.wrapAccessor('routingKey', function(core) {\n      return {\n        get: function() {\n          if (this.routingKey != null) {\n            return this.routingKey;\n          } else {\n            if (Batman.config.minificationErrors) {\n              Batman.developer.error(\"Please define `routingKey` on the prototype of \" + (Batman.functionName(this.constructor)) + \" in order for your controller to be minification safe.\");\n            }\n            return Batman.functionName(this.constructor).replace(/Controller$/, '');\n          }\n        }\n      };\n    });\n\n    Controller.accessor('_renderContext', function() {\n      return Batman.RenderContext.root().descend(this);\n    });\n\n    _optionsFromFilterArguments = function(options, nameOrFunction) {\n      if (!nameOrFunction) {\n        nameOrFunction = options;\n        options = {};\n      } else {\n        if (typeof options === 'string') {\n          options = {\n            only: [options]\n          };\n        } else {\n          if (options.only && Batman.typeOf(options.only) !== 'Array') {\n            options.only = [options.only];\n          }\n          if (options.except && Batman.typeOf(options.except) !== 'Array') {\n            options.except = [options.except];\n          }\n        }\n      }\n      options.block = nameOrFunction;\n      return options;\n    };\n\n    Controller.beforeFilter = function() {\n      var filters, options, _base;\n      Batman.initializeObject(this);\n      options = _optionsFromFilterArguments.apply(null, arguments);\n      filters = (_base = this._batman).beforeFilters || (_base.beforeFilters = []);\n      return filters.push(options);\n    };\n\n    Controller.afterFilter = function() {\n      var filters, options, _base;\n      Batman.initializeObject(this);\n      options = _optionsFromFilterArguments.apply(null, arguments);\n      filters = (_base = this._batman).afterFilters || (_base.afterFilters = []);\n      return filters.push(options);\n    };\n\n    Controller.afterFilter(function(params) {\n      if (this.autoScrollToHash && (params['#'] != null)) {\n        return this.scrollToHash(params['#']);\n      }\n    });\n\n    Controller.catchError = function() {\n      var currentHandlers, error, errors, handlers, options, _base, _i, _j, _len, _results;\n      errors = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), options = arguments[_i++];\n      Batman.initializeObject(this);\n      (_base = this._batman).errorHandlers || (_base.errorHandlers = new Batman.SimpleHash);\n      handlers = Batman.typeOf(options[\"with\"]) === 'Array' ? options[\"with\"] : [options[\"with\"]];\n      _results = [];\n      for (_j = 0, _len = errors.length; _j < _len; _j++) {\n        error = errors[_j];\n        currentHandlers = this._batman.errorHandlers.get(error) || [];\n        _results.push(this._batman.errorHandlers.set(error, currentHandlers.concat(handlers)));\n      }\n      return _results;\n    };\n\n    Controller.prototype.errorHandler = function(callback) {\n      var errorFrame, _ref, _this = this;\n      errorFrame = (_ref = this._actionFrames) != null ? _ref[this._actionFrames.length - 1] : void 0;\n      return function(err, result, env) {\n        if (err) {\n          if (errorFrame != null ? errorFrame.error : void 0) {\n            return;\n          }\n          if (errorFrame != null) {\n            errorFrame.error = err;\n          }\n          if (!_this.handleError(err)) {\n            throw err;\n          }\n        } else {\n          return typeof callback === \"function\" ? callback(result, env) : void 0;\n        }\n      };\n    };\n\n    Controller.prototype.handleError = function(error) {\n      var handled, _ref, _this = this;\n      handled = false;\n      if ((_ref = this.constructor._batman.getAll('errorHandlers')) != null) {\n        _ref.forEach(function(hash) {\n          return hash.forEach(function(key, value) {\n            var handler, _i, _len, _results;\n            if (error instanceof key) {\n              handled = true;\n              _results = [];\n              for (_i = 0, _len = value.length; _i < _len; _i++) {\n                handler = value[_i];\n                _results.push(handler.call(_this, error));\n              }\n              return _results;\n            }\n          });\n        });\n      }\n      return handled;\n    };\n\n    function Controller() {\n      this.redirect = __bind(this.redirect, this);\n\n      this.handleError = __bind(this.handleError, this);\n\n      this.errorHandler = __bind(this.errorHandler, this);\n      Controller.__super__.constructor.apply(this, arguments);\n      this._resetActionFrames();\n    }\n\n    Controller.prototype.renderCache = new Batman.RenderCache;\n\n    Controller.prototype.defaultRenderYield = 'main';\n\n    Controller.prototype.autoScrollToHash = true;\n\n    Controller.prototype.dispatch = function(action, params) {\n      var redirectTo;\n      if (params == null) {\n        params = {};\n      }\n      params.controller || (params.controller = this.get('routingKey'));\n      params.action || (params.action = action);\n      params.target || (params.target = this);\n      this._resetActionFrames();\n      this.set('action', action);\n      this.set('params', params);\n      Batman.DOM.Yield.cycleAll();\n      this.executeAction(action, params);\n      Batman.DOM.Yield.clearAllStale();\n      redirectTo = this._afterFilterRedirect;\n      delete this._afterFilterRedirect;\n      if (redirectTo) {\n        return Batman.redirect(redirectTo);\n      }\n    };\n\n    Controller.prototype.executeAction = function(action, params) {\n      var frame, oldRedirect, parentFrame, result, _ref, _ref1, _this = this;\n      if (params == null) {\n        params = this.get('params');\n      }\n      Batman.developer.assert(this[action], \"Error! Controller action \" + (this.get('routingKey')) + \".\" + action + \" couldn't be found!\");\n      parentFrame = this._actionFrames[this._actionFrames.length - 1];\n      frame = new Batman.ControllerActionFrame({\n        parentFrame: parentFrame,\n        action: action\n      }, function() {\n        var _ref;\n        if (!_this._afterFilterRedirect) {\n          _this._runFilters(action, params, 'afterFilters');\n        }\n        _this._resetActionFrames();\n        return (_ref = Batman.navigator) != null ? _ref.redirect = oldRedirect : void 0;\n      });\n      this._actionFrames.push(frame);\n      frame.startOperation({\n        internal: true\n      });\n      oldRedirect = (_ref = Batman.navigator) != null ? _ref.redirect : void 0;\n      if ((_ref1 = Batman.navigator) != null) {\n        _ref1.redirect = this.redirect;\n      }\n      this._runFilters(action, params, 'beforeFilters');\n      if (!this._afterFilterRedirect) {\n        result = this[action](params);\n      }\n      if (!frame.operationOccurred) {\n        this.render();\n      }\n      frame.finishOperation();\n      return result;\n    };\n\n    Controller.prototype.redirect = function(url) {\n      var frame;\n      frame = this._actionFrames[this._actionFrames.length - 1];\n      if (frame) {\n        if (frame.operationOccurred) {\n          Batman.developer.warn(\"Warning! Trying to redirect but an action has already been taken during \" + (this.get('routingKey')) + \".\" + (frame.action || this.get('action')));\n        }\n        frame.startAndFinishOperation();\n        if (this._afterFilterRedirect != null) {\n          return Batman.developer.warn(\"Warning! Multiple actions trying to redirect!\");\n        } else {\n          return this._afterFilterRedirect = url;\n        }\n      } else {\n        if (Batman.typeOf(url) === 'Object') {\n          if (!url.controller) {\n            url.controller = this;\n          }\n        }\n        return Batman.redirect(url);\n      }\n    };\n\n    Controller.prototype.render = function(options) {\n      var action, frame, view, _ref, _ref1, _this = this;\n      if (options == null) {\n        options = {};\n      }\n      if (frame = (_ref = this._actionFrames) != null ? _ref[this._actionFrames.length - 1] : void 0) {\n        frame.startOperation();\n      }\n      if (options === false) {\n        frame.finishOperation();\n        return;\n      }\n      action = (frame != null ? frame.action : void 0) || this.get('action');\n      if (options) {\n        options.into || (options.into = this.defaultRenderYield);\n      }\n      if (!options.view) {\n        options.viewClass || (options.viewClass = this._viewClassForAction(action));\n        options.context || (options.context = this.get('_renderContext'));\n        options.source || (options.source = Batman.helpers.underscore(this.get('routingKey') + '/' + action));\n        view = this.renderCache.viewForOptions(options);\n      } else {\n        view = options.view;\n        options.view = null;\n      }\n      if (view) {\n        if ((_ref1 = Batman.currentApp) != null) {\n          _ref1.prevent('ready');\n        }\n        view.once('ready', function() {\n          var _ref2;\n          Batman.DOM.Yield.withName(options.into).replace(view.get('node'));\n          if ((_ref2 = Batman.currentApp) != null) {\n            _ref2.allowAndFire('ready');\n          }\n          return frame != null ? frame.finishOperation() : void 0;\n        });\n      }\n      return view;\n    };\n\n    Controller.prototype.scrollToHash = function(hash) {\n      if (hash == null) {\n        hash = this.get('params')['#'];\n      }\n      return Batman.DOM.scrollIntoView(hash);\n    };\n\n    Controller.prototype._resetActionFrames = function() {\n      return this._actionFrames = [];\n    };\n\n    Controller.prototype._viewClassForAction = function(action) {\n      var classPrefix, _ref;\n      classPrefix = this.get('routingKey').replace('/', '_');\n      return ((_ref = Batman.currentApp) != null ? _ref[Batman.helpers.camelize(\"\" + classPrefix + \"_\" + action + \"_view\")] : void 0) || Batman.View;\n    };\n\n    Controller.prototype._runFilters = function(action, params, filters) {\n      var block, options, _i, _len, _ref;\n      if (filters = (_ref = this.constructor._batman) != null ? _ref.get(filters) : void 0) {\n        for (_i = 0, _len = filters.length; _i < _len; _i++) {\n          options = filters[_i];\n          if (options.only && __indexOf.call(options.only, action) < 0) {\n            continue;\n          }\n          if (options.except && __indexOf.call(options.except, action) >= 0) {\n            continue;\n          }\n          if (this._afterFilterRedirect) {\n            return;\n          }\n          block = options.block;\n          if (typeof block === 'function') {\n            block.call(this, params);\n          } else {\n            if (typeof this[block] === \"function\") {\n              this[block](params);\n            }\n          }\n        }\n      }\n    };\n\n    return Controller;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.Set = (function(_super) {\n    var k, _fn, _i, _j, _len, _len1, _ref, _ref1, _this = this;\n\n    __extends(Set, _super);\n\n    function Set() {\n      Batman.SimpleSet.apply(this, arguments);\n    }\n\n    Batman.extend(Set.prototype, Batman.Enumerable);\n\n    Set._applySetAccessors = function(klass) {\n      var accessor, accessors, key, _results;\n      accessors = {\n        first: function() {\n          return this.toArray()[0];\n        },\n        last: function() {\n          return this.toArray()[this.length - 1];\n        },\n        isEmpty: function() {\n          return this.isEmpty();\n        },\n        toArray: function() {\n          return this.toArray();\n        },\n        length: function() {\n          this.registerAsMutableSource();\n          return this.length;\n        },\n        indexedBy: function() {\n          var _this = this;\n          return new Batman.TerminalAccessible(function(key) {\n            return _this.indexedBy(key);\n          });\n        },\n        indexedByUnique: function() {\n          var _this = this;\n          return new Batman.TerminalAccessible(function(key) {\n            return _this.indexedByUnique(key);\n          });\n        },\n        sortedBy: function() {\n          var _this = this;\n          return new Batman.TerminalAccessible(function(key) {\n            return _this.sortedBy(key);\n          });\n        },\n        sortedByDescending: function() {\n          var _this = this;\n          return new Batman.TerminalAccessible(function(key) {\n            return _this.sortedBy(key, 'desc');\n          });\n        }\n      };\n      _results = [];\n      for (key in accessors) {\n        accessor = accessors[key];\n        _results.push(klass.accessor(key, accessor));\n      }\n      return _results;\n    };\n\n    Set._applySetAccessors(Set);\n\n    _ref = ['add', 'remove', 'clear', 'replace', 'indexedBy', 'indexedByUnique', 'sortedBy', 'equality', '_indexOfItem'];\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      k = _ref[_i];\n      Set.prototype[k] = Batman.SimpleSet.prototype[k];\n    }\n\n    _ref1 = ['find', 'merge', 'forEach', 'toArray', 'isEmpty', 'has'];\n    _fn = function(k) {\n      return Set.prototype[k] = function() {\n        this.registerAsMutableSource();\n        return Batman.SimpleSet.prototype[k].apply(this, arguments);\n      };\n    };\n    for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n      k = _ref1[_j];\n      _fn(k);\n    }\n\n    Set.prototype.toJSON = Set.prototype.toArray;\n\n    return Set;\n\n  }).call(this, Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.ErrorsSet = (function(_super) {\n\n    __extends(ErrorsSet, _super);\n\n    function ErrorsSet() {\n      return ErrorsSet.__super__.constructor.apply(this, arguments);\n    }\n\n    ErrorsSet.accessor(function(key) {\n      return this.indexedBy('attribute').get(key);\n    });\n\n    ErrorsSet.prototype.add = function(key, error) {\n      return ErrorsSet.__super__.add.call(this, new Batman.ValidationError(key, error));\n    };\n\n    return ErrorsSet;\n\n  })(Batman.Set);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.SetProxy = (function(_super) {\n    var k, _fn, _i, _len, _ref, _this = this;\n\n    __extends(SetProxy, _super);\n\n    function SetProxy(base) {\n      var _this = this;\n      this.base = base;\n      SetProxy.__super__.constructor.call(this);\n      this.length = this.base.length;\n      this.base.on('itemsWereAdded', function() {\n        var items;\n        items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        _this.set('length', _this.base.length);\n        return _this.fire.apply(_this, ['itemsWereAdded'].concat(__slice.call(items)));\n      });\n      this.base.on('itemsWereRemoved', function() {\n        var items;\n        items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        _this.set('length', _this.base.length);\n        return _this.fire.apply(_this, ['itemsWereRemoved'].concat(__slice.call(items)));\n      });\n    }\n\n    Batman.extend(SetProxy.prototype, Batman.Enumerable);\n\n    SetProxy.prototype.filter = function(f) {\n      return this.reduce(function(accumulator, element) {\n        if (f(element)) {\n          accumulator.add(element);\n        }\n        return accumulator;\n      }, new Batman.Set());\n    };\n\n    SetProxy.prototype.replace = function() {\n      var length, result;\n      length = this.property('length');\n      length.isolate();\n      result = this.base.replace.apply(this, arguments);\n      length.expose();\n      return result;\n    };\n\n    Batman.Set._applySetAccessors(SetProxy);\n\n    _ref = ['add', 'remove', 'find', 'clear', 'has', 'merge', 'toArray', 'isEmpty', 'indexedBy', 'indexedByUnique', 'sortedBy'];\n    _fn = function(k) {\n      return SetProxy.prototype[k] = function() {\n        var _ref1;\n        return (_ref1 = this.base)[k].apply(_ref1, arguments);\n      };\n    };\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      k = _ref[_i];\n      _fn(k);\n    }\n\n    SetProxy.accessor('length', {\n      get: function() {\n        this.registerAsMutableSource();\n        return this.length;\n      },\n      set: function(_, v) {\n        return this.length = v;\n      }\n    });\n\n    return SetProxy;\n\n  }).call(this, Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.BinarySetOperation = (function(_super) {\n\n    __extends(BinarySetOperation, _super);\n\n    function BinarySetOperation(left, right) {\n      this.left = left;\n      this.right = right;\n      this._setup = __bind(this._setup, this);\n\n      BinarySetOperation.__super__.constructor.call(this);\n      this._setup(this.left, this.right);\n      this._setup(this.right, this.left);\n    }\n\n    BinarySetOperation.prototype._setup = function(set, opposite) {\n      var _this = this;\n      set.on('itemsWereAdded', function() {\n        var items;\n        items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        return _this._itemsWereAddedToSource.apply(_this, [set, opposite].concat(__slice.call(items)));\n      });\n      set.on('itemsWereRemoved', function() {\n        var items;\n        items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        return _this._itemsWereRemovedFromSource.apply(_this, [set, opposite].concat(__slice.call(items)));\n      });\n      return this._itemsWereAddedToSource.apply(this, [set, opposite].concat(__slice.call(set.toArray())));\n    };\n\n    BinarySetOperation.prototype.merge = function() {\n      var merged, others, set, _i, _len;\n      others = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      merged = new Batman.Set;\n      others.unshift(this);\n      for (_i = 0, _len = others.length; _i < _len; _i++) {\n        set = others[_i];\n        set.forEach(function(v) {\n          return merged.add(v);\n        });\n      }\n      return merged;\n    };\n\n    BinarySetOperation.prototype.filter = Batman.SetProxy.prototype.filter;\n\n    return BinarySetOperation;\n\n  })(Batman.Set);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.SetUnion = (function(_super) {\n\n    __extends(SetUnion, _super);\n\n    function SetUnion() {\n      return SetUnion.__super__.constructor.apply(this, arguments);\n    }\n\n    SetUnion.prototype._itemsWereAddedToSource = function() {\n      var items, opposite, source;\n      source = arguments[0], opposite = arguments[1], items = 3 <= arguments.length ? __slice.call(arguments, 2) : [];\n      return this.add.apply(this, items);\n    };\n\n    SetUnion.prototype._itemsWereRemovedFromSource = function() {\n      var item, items, itemsToRemove, opposite, source;\n      source = arguments[0], opposite = arguments[1], items = 3 <= arguments.length ? __slice.call(arguments, 2) : [];\n      itemsToRemove = (function() {\n        var _i, _len, _results;\n        _results = [];\n        for (_i = 0, _len = items.length; _i < _len; _i++) {\n          item = items[_i];\n          if (!opposite.has(item)) {\n            _results.push(item);\n          }\n        }\n        return _results;\n      })();\n      return this.remove.apply(this, itemsToRemove);\n    };\n\n    return SetUnion;\n\n  })(Batman.BinarySetOperation);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.SetIntersection = (function(_super) {\n\n    __extends(SetIntersection, _super);\n\n    function SetIntersection() {\n      return SetIntersection.__super__.constructor.apply(this, arguments);\n    }\n\n    SetIntersection.prototype._itemsWereAddedToSource = function() {\n      var item, items, itemsToAdd, opposite, source;\n      source = arguments[0], opposite = arguments[1], items = 3 <= arguments.length ? __slice.call(arguments, 2) : [];\n      itemsToAdd = (function() {\n        var _i, _len, _results;\n        _results = [];\n        for (_i = 0, _len = items.length; _i < _len; _i++) {\n          item = items[_i];\n          if (opposite.has(item)) {\n            _results.push(item);\n          }\n        }\n        return _results;\n      })();\n      if (itemsToAdd.length > 0) {\n        return this.add.apply(this, itemsToAdd);\n      }\n    };\n\n    SetIntersection.prototype._itemsWereRemovedFromSource = function() {\n      var items, opposite, source;\n      source = arguments[0], opposite = arguments[1], items = 3 <= arguments.length ? __slice.call(arguments, 2) : [];\n      return this.remove.apply(this, items);\n    };\n\n    return SetIntersection;\n\n  })(Batman.BinarySetOperation);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.SetComplement = (function(_super) {\n\n    __extends(SetComplement, _super);\n\n    function SetComplement() {\n      return SetComplement.__super__.constructor.apply(this, arguments);\n    }\n\n    SetComplement.prototype._itemsWereAddedToSource = function() {\n      var item, items, itemsToAdd, itemsToRemove, opposite, source;\n      source = arguments[0], opposite = arguments[1], items = 3 <= arguments.length ? __slice.call(arguments, 2) : [];\n      if (source === this.left) {\n        itemsToAdd = (function() {\n          var _i, _len, _results;\n          _results = [];\n          for (_i = 0, _len = items.length; _i < _len; _i++) {\n            item = items[_i];\n            if (!opposite.has(item)) {\n              _results.push(item);\n            }\n          }\n          return _results;\n        })();\n        if (itemsToAdd.length > 0) {\n          return this.add.apply(this, itemsToAdd);\n        }\n      } else {\n        itemsToRemove = (function() {\n          var _i, _len, _results;\n          _results = [];\n          for (_i = 0, _len = items.length; _i < _len; _i++) {\n            item = items[_i];\n            if (opposite.has(item)) {\n              _results.push(item);\n            }\n          }\n          return _results;\n        })();\n        if (itemsToRemove.length > 0) {\n          return this.remove.apply(this, itemsToRemove);\n        }\n      }\n    };\n\n    SetComplement.prototype._itemsWereRemovedFromSource = function() {\n      var item, items, itemsToAdd, opposite, source;\n      source = arguments[0], opposite = arguments[1], items = 3 <= arguments.length ? __slice.call(arguments, 2) : [];\n      if (source === this.left) {\n        return this.remove.apply(this, items);\n      } else {\n        itemsToAdd = (function() {\n          var _i, _len, _results;\n          _results = [];\n          for (_i = 0, _len = items.length; _i < _len; _i++) {\n            item = items[_i];\n            if (opposite.has(item)) {\n              _results.push(item);\n            }\n          }\n          return _results;\n        })();\n        if (itemsToAdd.length > 0) {\n          return this.add.apply(this, itemsToAdd);\n        }\n      }\n    };\n\n    SetComplement.prototype._addComplement = function(items, opposite) {\n      var item, itemsToAdd;\n      itemsToAdd = (function() {\n        var _i, _len, _results;\n        _results = [];\n        for (_i = 0, _len = items.length; _i < _len; _i++) {\n          item = items[_i];\n          if (opposite.has(item)) {\n            _results.push(item);\n          }\n        }\n        return _results;\n      })();\n      if (itemsToAdd.length > 0) {\n        return this.add.apply(this, itemsToAdd);\n      }\n    };\n\n    return SetComplement;\n\n  })(Batman.BinarySetOperation);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.StateMachine = (function(_super) {\n\n    __extends(StateMachine, _super);\n\n    StateMachine.InvalidTransitionError = function(message) {\n      this.message = message != null ? message : \"\";\n    };\n\n    StateMachine.InvalidTransitionError.prototype = new Error;\n\n    StateMachine.transitions = function(table) {\n      var definePredicate, fromState, k, object, predicateKeys, toState, transitions, v, _fn, _ref, _this = this;\n      for (k in table) {\n        v = table[k];\n        if (!(v.from && v.to)) {\n          continue;\n        }\n        object = {};\n        if (v.from.forEach) {\n          v.from.forEach(function(fromKey) {\n            return object[fromKey] = v.to;\n          });\n        } else {\n          object[v.from] = v.to;\n        }\n        table[k] = object;\n      }\n      this.prototype.transitionTable = Batman.extend({}, this.prototype.transitionTable, table);\n      predicateKeys = [];\n      definePredicate = function(state) {\n        var key;\n        key = \"is\" + (Batman.helpers.capitalize(state));\n        if (_this.prototype[key] != null) {\n          return;\n        }\n        predicateKeys.push(key);\n        return _this.prototype[key] = function() {\n          return this.get('state') === state;\n        };\n      };\n      _ref = this.prototype.transitionTable;\n      _fn = function(k) {\n        return _this.prototype[k] = function() {\n          return this.startTransition(k);\n        };\n      };\n      for (k in _ref) {\n        transitions = _ref[k];\n        if (!(!this.prototype[k])) {\n          continue;\n        }\n        _fn(k);\n        for (fromState in transitions) {\n          toState = transitions[fromState];\n          definePredicate(fromState);\n          definePredicate(toState);\n        }\n      }\n      if (predicateKeys.length) {\n        this.accessor.apply(this, __slice.call(predicateKeys).concat([function(key) {\n          return this[key]();\n        }]));\n      }\n      return this;\n    };\n\n    function StateMachine(startState) {\n      this.nextEvents = [];\n      this.set('_state', startState);\n    }\n\n    StateMachine.accessor('state', function() {\n      return this.get('_state');\n    });\n\n    StateMachine.prototype.isTransitioning = false;\n\n    StateMachine.prototype.transitionTable = {};\n\n    StateMachine.prototype.onTransition = function(from, into, callback) {\n      return this.on(\"\" + from + \"->\" + into, callback);\n    };\n\n    StateMachine.prototype.onEnter = function(into, callback) {\n      return this.on(\"enter \" + into, callback);\n    };\n\n    StateMachine.prototype.onExit = function(from, callback) {\n      return this.on(\"exit \" + from, callback);\n    };\n\n    StateMachine.prototype.startTransition = Batman.Property.wrapTrackingPrevention(function(event) {\n      var nextState, previousState;\n      if (this.isTransitioning) {\n        this.nextEvents.push(event);\n        return;\n      }\n      previousState = this.get('state');\n      nextState = this.nextStateForEvent(event);\n      if (!nextState) {\n        return false;\n      }\n      this.isTransitioning = true;\n      this.fire(\"exit \" + previousState);\n      this.set('_state', nextState);\n      this.fire(\"\" + previousState + \"->\" + nextState);\n      this.fire(\"enter \" + nextState);\n      this.fire(event);\n      this.isTransitioning = false;\n      if (this.nextEvents.length > 0) {\n        this.startTransition(this.nextEvents.shift());\n      }\n      return true;\n    });\n\n    StateMachine.prototype.canStartTransition = function(event, fromState) {\n      if (fromState == null) {\n        fromState = this.get('state');\n      }\n      return !!this.nextStateForEvent(event, fromState);\n    };\n\n    StateMachine.prototype.nextStateForEvent = function(event, fromState) {\n      var _ref;\n      if (fromState == null) {\n        fromState = this.get('state');\n      }\n      return (_ref = this.transitionTable[event]) != null ? _ref[fromState] : void 0;\n    };\n\n    return StateMachine;\n\n  })(Batman.Object);\n\n  Batman.DelegatingStateMachine = (function(_super) {\n\n    __extends(DelegatingStateMachine, _super);\n\n    function DelegatingStateMachine(startState, base) {\n      this.base = base;\n      DelegatingStateMachine.__super__.constructor.call(this, startState);\n    }\n\n    DelegatingStateMachine.prototype.fire = function() {\n      var result, _ref;\n      result = DelegatingStateMachine.__super__.fire.apply(this, arguments);\n      (_ref = this.base).fire.apply(_ref, arguments);\n      return result;\n    };\n\n    return DelegatingStateMachine;\n\n  })(Batman.StateMachine);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.Model = (function(_super) {\n    var functionName, _i, _j, _len, _len1, _ref, _ref1;\n\n    __extends(Model, _super);\n\n    Model.storageKey = null;\n\n    Model.primaryKey = 'id';\n\n    Model.persist = function() {\n      var mechanism, options;\n      mechanism = arguments[0], options = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n      Batman.initializeObject(this.prototype);\n      mechanism = mechanism.isStorageAdapter ? mechanism : new mechanism(this);\n      if (options.length > 0) {\n        Batman.mixin.apply(Batman, [mechanism].concat(__slice.call(options)));\n      }\n      this.prototype._batman.storage = mechanism;\n      return mechanism;\n    };\n\n    Model.storageAdapter = function() {\n      Batman.initializeObject(this.prototype);\n      return this.prototype._batman.storage;\n    };\n\n    Model.encode = function() {\n      var encoder, encoderForKey, encoderOrLastKey, key, keys, _base, _i, _j, _len;\n      keys = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), encoderOrLastKey = arguments[_i++];\n      Batman.initializeObject(this.prototype);\n      (_base = this.prototype._batman).encoders || (_base.encoders = new Batman.SimpleHash);\n      encoder = {};\n      switch (Batman.typeOf(encoderOrLastKey)) {\n      case 'String':\n        keys.push(encoderOrLastKey);\n        break;\n      case 'Function':\n        encoder.encode = encoderOrLastKey;\n        break;\n      default:\n        encoder = encoderOrLastKey;\n      }\n      for (_j = 0, _len = keys.length; _j < _len; _j++) {\n        key = keys[_j];\n        encoderForKey = Batman.extend({\n          as: key\n        }, this.defaultEncoder, encoder);\n        this.prototype._batman.encoders.set(key, encoderForKey);\n      }\n    };\n\n    Model.defaultEncoder = {\n      encode: function(x) {\n        return x;\n      },\n      decode: function(x) {\n        return x;\n      }\n    };\n\n    Model.observeAndFire('primaryKey', function(newPrimaryKey, oldPrimaryKey) {\n      this.encode(oldPrimaryKey, {\n        encode: false,\n        decode: false\n      });\n      return this.encode(newPrimaryKey, {\n        encode: false,\n        decode: this.defaultEncoder.decode\n      });\n    });\n\n    Model.validate = function() {\n      var keys, matches, optionsOrFunction, validatorClass, validators, _base, _i, _j, _len, _ref, _results;\n      keys = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), optionsOrFunction = arguments[_i++];\n      Batman.initializeObject(this.prototype);\n      validators = (_base = this.prototype._batman).validators || (_base.validators = []);\n      if (typeof optionsOrFunction === 'function') {\n        return validators.push({\n          keys: keys,\n          callback: optionsOrFunction\n        });\n      } else {\n        _ref = Batman.Validators;\n        _results = [];\n        for (_j = 0, _len = _ref.length; _j < _len; _j++) {\n          validatorClass = _ref[_j];\n          if ((matches = validatorClass.matches(optionsOrFunction))) {\n            _results.push(validators.push({\n              keys: keys,\n              validator: new validatorClass(matches)\n            }));\n          } else {\n            _results.push(void 0);\n          }\n        }\n        return _results;\n      }\n    };\n\n    Model.classAccessor('resourceName', {\n      get: function() {\n        if (this.resourceName != null) {\n          return this.resourceName;\n        } else {\n          if (Batman.config.minificationErrors) {\n            Batman.developer.error(\"Please define \" + (Batman.functionName(this)) + \".resourceName in order for your model to be minification safe.\");\n          }\n          return Batman.helpers.underscore(Batman.functionName(this));\n        }\n      }\n    });\n\n    Model.classAccessor('all', {\n      get: function() {\n        this._batman.check(this);\n        if (this.prototype.hasStorage() && !this._batman.allLoadTriggered) {\n          this.load();\n          this._batman.allLoadTriggered = true;\n        }\n        return this.get('loaded');\n      },\n      set: function(k, v) {\n        return this.set('loaded', v);\n      }\n    });\n\n    Model.classAccessor('loaded', {\n      get: function() {\n        return this._loaded || (this._loaded = new Batman.Set);\n      },\n      set: function(k, v) {\n        return this._loaded = v;\n      }\n    });\n\n    Model.classAccessor('first', function() {\n      return this.get('all').toArray()[0];\n    });\n\n    Model.classAccessor('last', function() {\n      var x;\n      x = this.get('all').toArray();\n      return x[x.length - 1];\n    });\n\n    Model.clear = function() {\n      var result, _ref;\n      Batman.initializeObject(this);\n      result = this.get('loaded').clear();\n      if ((_ref = this._batman.get('associations')) != null) {\n        _ref.reset();\n      }\n      this._resetPromises();\n      return result;\n    };\n\n    Model.find = function(id, callback) {\n      return this.findWithOptions(id, void 0, callback);\n    };\n\n    Model.findWithOptions = function(id, options, callback) {\n      var record;\n      if (options == null) {\n        options = {};\n      }\n      Batman.developer.assert(callback, \"Must call find with a callback!\");\n      record = new this();\n      record._withoutDirtyTracking(function() {\n        return this.set('id', id);\n      });\n      record.loadWithOptions(options, callback);\n      return record;\n    };\n\n    Model.load = function(options, callback) {\n      var _ref;\n      if ((_ref = typeof options) === 'function' || _ref === 'undefined') {\n        callback = options;\n        options = {};\n      } else {\n        options = {\n          data: options\n        };\n      }\n      return this.loadWithOptions(options, callback);\n    };\n\n    Model.loadWithOptions = function(options, callback) {\n      var _this = this;\n      this.fire('loading', options);\n      return this._doStorageOperation('readAll', options, function(err, records, env) {\n        var mappedRecords;\n        if (err != null) {\n          _this.fire('error', err);\n          return typeof callback === \"function\" ? callback(err, []) : void 0;\n        } else {\n          mappedRecords = _this._mapIdentities(records);\n          _this.fire('loaded', mappedRecords, env);\n          return typeof callback === \"function\" ? callback(err, mappedRecords, env) : void 0;\n        }\n      });\n    };\n\n    Model.create = function(attrs, callback) {\n      var obj, _ref;\n      if (!callback) {\n        _ref = [{},\n        attrs], attrs = _ref[0], callback = _ref[1];\n      }\n      obj = new this(attrs);\n      obj.save(callback);\n      return obj;\n    };\n\n    Model.findOrCreate = function(attrs, callback) {\n      var foundRecord, record;\n      record = new this(attrs);\n      if (record.isNew()) {\n        record.save(callback);\n      } else {\n        foundRecord = this._mapIdentity(record);\n        callback(void 0, foundRecord);\n      }\n      return record;\n    };\n\n    Model.createFromJSON = function(json) {\n      var record;\n      record = new this;\n      record._withoutDirtyTracking(function() {\n        return this.fromJSON(json);\n      });\n      return this._mapIdentity(record);\n    };\n\n    Model._mapIdentity = function(record) {\n      return this._mapIdentities([record])[0];\n    };\n\n    Model._mapIdentities = function(records) {\n      var existing, id, index, newRecords, record, _i, _len, _ref, _ref1;\n      newRecords = [];\n      for (index = _i = 0, _len = records.length; _i < _len; index = ++_i) {\n        record = records[index];\n        if (!((id = record.get('id')) != null)) {\n          continue;\n        } else if (existing = (_ref = this.get('loaded.indexedBy.id').get(id)) != null ? _ref.toArray()[0] : void 0) {\n          existing._withoutDirtyTracking(function() {\n            var _ref1;\n            return this.updateAttributes(((_ref1 = record.get('attributes')) != null ? _ref1.toObject() : void 0) || {});\n          });\n          records[index] = existing;\n        } else {\n          newRecords.push(record);\n        }\n      }\n      if (newRecords.length) {\n        (_ref1 = this.get('loaded')).add.apply(_ref1, newRecords);\n      }\n      return records;\n    };\n\n    Model._doStorageOperation = function(operation, options, callback) {\n      var adapter;\n      Batman.developer.assert(this.prototype.hasStorage(), \"Can't \" + operation + \" model \" + (Batman.functionName(this.constructor)) + \" without any storage adapters!\");\n      adapter = this.prototype._batman.get('storage');\n      return adapter.perform(operation, this, options, callback);\n    };\n\n    _ref = ['find', 'load', 'create'];\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      functionName = _ref[_i];\n      Model[functionName] = Batman.Property.wrapTrackingPrevention(Model[functionName]);\n    }\n\n    Model.InstanceLifecycleStateMachine = (function(_super1) {\n\n      __extends(InstanceLifecycleStateMachine, _super1);\n\n      function InstanceLifecycleStateMachine() {\n        return InstanceLifecycleStateMachine.__super__.constructor.apply(this, arguments);\n      }\n\n      InstanceLifecycleStateMachine.transitions({\n        load: {\n          from: ['dirty', 'clean'],\n          to: 'loading'\n        },\n        create: {\n          from: ['dirty', 'clean'],\n          to: 'creating'\n        },\n        save: {\n          from: ['dirty', 'clean'],\n          to: 'saving'\n        },\n        destroy: {\n          from: ['dirty', 'clean'],\n          to: 'destroying'\n        },\n        failedValidation: {\n          from: ['saving', 'creating'],\n          to: 'dirty'\n        },\n        loaded: {\n          loading: 'clean'\n        },\n        created: {\n          creating: 'clean'\n        },\n        saved: {\n          saving: 'clean'\n        },\n        destroyed: {\n          destroying: 'destroyed'\n        },\n        set: {\n          from: ['dirty', 'clean'],\n          to: 'dirty'\n        },\n        error: {\n          from: ['saving', 'creating', 'loading', 'destroying'],\n          to: 'error'\n        }\n      });\n\n      return InstanceLifecycleStateMachine;\n\n    })(Batman.DelegatingStateMachine);\n\n    function Model(idOrAttributes) {\n      if (idOrAttributes == null) {\n        idOrAttributes = {};\n      }\n      Batman.developer.assert(this instanceof Batman.Object, \"constructors must be called with new\");\n      if (Batman.typeOf(idOrAttributes) === 'Object') {\n        Model.__super__.constructor.call(this, idOrAttributes);\n      } else {\n        Model.__super__.constructor.call(this);\n        this.set('id', idOrAttributes);\n      }\n    }\n\n    Model.accessor('lifecycle', function() {\n      return this.lifecycle || (this.lifecycle = new Batman.Model.InstanceLifecycleStateMachine('clean', this));\n    });\n\n    Model.accessor('attributes', function() {\n      return this.attributes || (this.attributes = new Batman.Hash);\n    });\n\n    Model.accessor('dirtyKeys', function() {\n      return this.dirtyKeys || (this.dirtyKeys = new Batman.Hash);\n    });\n\n    Model.accessor('_dirtiedKeys', function() {\n      return this._dirtiedKeys || (this._dirtiedKeys = new Batman.SimpleSet);\n    });\n\n    Model.accessor('errors', function() {\n      return this.errors || (this.errors = new Batman.ErrorsSet);\n    });\n\n    Model.accessor('isNew', function() {\n      return this.isNew();\n    });\n\n    Model.accessor('isDirty', function() {\n      return this.isDirty();\n    });\n\n    Model.accessor(Model.defaultAccessor = {\n      get: function(k) {\n        return Batman.getPath(this, ['attributes', k]);\n      },\n      set: function(k, v) {\n        if (this._willSet(k)) {\n          return this.get('attributes').set(k, v);\n        } else {\n          return this.get(k);\n        }\n      },\n      unset: function(k) {\n        return this.get('attributes').unset(k);\n      }\n    });\n\n    Model.wrapAccessor('id', function(core) {\n      return {\n        get: function() {\n          var primaryKey;\n          primaryKey = this.constructor.primaryKey;\n          if (primaryKey === 'id') {\n            return core.get.apply(this, arguments);\n          } else {\n            return this.get(primaryKey);\n          }\n        },\n        set: function(key, value) {\n          var parsedValue, primaryKey;\n          if ((typeof value === \"string\") && (value.match(/[^0-9]/) === null) && ((\"\" + (parsedValue = parseInt(value, 10))) === value)) {\n            value = parsedValue;\n          }\n          primaryKey = this.constructor.primaryKey;\n          if (primaryKey === 'id') {\n            this._willSet(key);\n            return core.set.apply(this, arguments);\n          } else {\n            return this.set(primaryKey, value);\n          }\n        }\n      };\n    });\n\n    Model.prototype.isNew = function() {\n      return typeof this.get('id') === 'undefined';\n    };\n\n    Model.prototype.isDirty = function() {\n      return this.get('lifecycle.state') === 'dirty';\n    };\n\n    Model.prototype.updateAttributes = function(attrs) {\n      this.mixin(attrs);\n      return this;\n    };\n\n    Model.prototype.toString = function() {\n      return \"\" + (this.constructor.get('resourceName')) + \": \" + (this.get('id'));\n    };\n\n    Model.prototype.toParam = function() {\n      return this.get('id');\n    };\n\n    Model.prototype.toJSON = function() {\n      var encoders, obj, _this = this;\n      obj = {};\n      encoders = this._batman.get('encoders');\n      if (!(!encoders || encoders.isEmpty())) {\n        encoders.forEach(function(key, encoder) {\n          var encodedVal, val;\n          if (encoder.encode) {\n            val = _this.get(key);\n            if (typeof val !== 'undefined') {\n              encodedVal = encoder.encode(val, key, obj, _this);\n              if (typeof encodedVal !== 'undefined') {\n                return obj[encoder.as] = encodedVal;\n              }\n            }\n          }\n        });\n      }\n      return obj;\n    };\n\n    Model.prototype.fromJSON = function(data) {\n      var encoders, key, obj, value, _this = this;\n      obj = {};\n      encoders = this._batman.get('encoders');\n      if (!encoders || encoders.isEmpty() || !encoders.some(function(key, encoder) {\n        return encoder.decode != null;\n      })) {\n        for (key in data) {\n          value = data[key];\n          obj[key] = value;\n        }\n      } else {\n        encoders.forEach(function(key, encoder) {\n          if (encoder.decode && typeof data[encoder.as] !== 'undefined') {\n            return obj[key] = encoder.decode(data[encoder.as], encoder.as, data, obj, _this);\n          }\n        });\n      }\n      if (this.constructor.primaryKey !== 'id') {\n        obj.id = data[this.constructor.primaryKey];\n      }\n      Batman.developer[\"do\"](function() {\n        if ((!encoders) || encoders.length <= 1) {\n          return Batman.developer.warn(\"Warning: Model \" + (Batman.functionName(_this.constructor)) + \" has suspiciously few decoders!\");\n        }\n      });\n      return this.mixin(obj);\n    };\n\n    Model.prototype.hasStorage = function() {\n      return this._batman.get('storage') != null;\n    };\n\n    Model.prototype.load = function(options, callback) {\n      var _ref1;\n      if (!callback) {\n        _ref1 = [{},\n        options], options = _ref1[0], callback = _ref1[1];\n      } else {\n        options = {\n          data: options\n        };\n      }\n      return this.loadWithOptions(options, callback);\n    };\n\n    Model.prototype.loadWithOptions = function(options, callback) {\n      var callbackQueue, hasOptions, _ref1, _this = this;\n      hasOptions = Object.keys(options).length !== 0;\n      if ((_ref1 = this.get('lifecycle.state')) === 'destroying' || _ref1 === 'destroyed') {\n        if (typeof callback === \"function\") {\n          callback(new Error(\"Can't load a destroyed record!\"));\n        }\n        return;\n      }\n      if (this.get('lifecycle').load()) {\n        callbackQueue = [];\n        if (callback != null) {\n          callbackQueue.push(callback);\n        }\n        if (!hasOptions) {\n          this._currentLoad = callbackQueue;\n        }\n        return this._doStorageOperation('read', options, function(err, record, env) {\n          var _j, _len1;\n          if (!err) {\n            _this.get('lifecycle').loaded();\n            record = _this.constructor._mapIdentity(record);\n          } else {\n            _this.get('lifecycle').error();\n          }\n          if (!hasOptions) {\n            _this._currentLoad = null;\n          }\n          for (_j = 0, _len1 = callbackQueue.length; _j < _len1; _j++) {\n            callback = callbackQueue[_j];\n            callback(err, record, env);\n          }\n        });\n      } else {\n        if (this.get('lifecycle.state') === 'loading' && !hasOptions) {\n          if (callback != null) {\n            return this._currentLoad.push(callback);\n          }\n        } else {\n          return typeof callback === \"function\" ? callback(new Batman.StateMachine.InvalidTransitionError(\"Can't load while in state \" + (this.get('lifecycle.state')))) : void 0;\n        }\n      }\n    };\n\n    Model.prototype.save = function(options, callback) {\n      var endState, isNew, startState, storageOperation, _ref1, _ref2, _this = this;\n      if (!callback) {\n        _ref1 = [{},\n        options], options = _ref1[0], callback = _ref1[1];\n      }\n      isNew = this.isNew();\n      _ref2 = isNew ? ['create', 'create', 'created'] : ['save', 'update', 'saved'], startState = _ref2[0], storageOperation = _ref2[1], endState = _ref2[2];\n      if (this.get('lifecycle').startTransition(startState)) {\n        return this.validate(function(error, errors) {\n          var associations;\n          if (error || errors.length) {\n            _this.get('lifecycle').failedValidation();\n            return typeof callback === \"function\" ? callback(error || errors, _this) : void 0;\n          }\n          associations = _this.constructor._batman.get('associations');\n          _this._withoutDirtyTracking(function() {\n            var _ref3, _this = this;\n            return associations != null ? (_ref3 = associations.getByType('belongsTo')) != null ? _ref3.forEach(function(association, label) {\n              return association.apply(_this);\n            }) : void 0 : void 0;\n          });\n          return _this._doStorageOperation(storageOperation, {\n            data: options\n          }, function(err, record, env) {\n            if (!err) {\n              _this.get('dirtyKeys').clear();\n              _this.get('_dirtiedKeys').clear();\n              if (associations) {\n                record._withoutDirtyTracking(function() {\n                  var _ref3, _ref4;\n                  if ((_ref3 = associations.getByType('hasOne')) != null) {\n                    _ref3.forEach(function(association, label) {\n                      return association.apply(err, record);\n                    });\n                  }\n                  return (_ref4 = associations.getByType('hasMany')) != null ? _ref4.forEach(function(association, label) {\n                    return association.apply(err, record);\n                  }) : void 0;\n                });\n              }\n              record = _this.constructor._mapIdentity(record);\n              _this.get('lifecycle').startTransition(endState);\n            } else {\n              if (err instanceof Batman.ErrorsSet) {\n                _this.get('lifecycle').failedValidation();\n              } else {\n                _this.get('lifecycle').error();\n              }\n            }\n            return typeof callback === \"function\" ? callback(err, record || _this, env) : void 0;\n          });\n        });\n      } else {\n        return typeof callback === \"function\" ? callback(new Batman.StateMachine.InvalidTransitionError(\"Can't save while in state \" + (this.get('lifecycle.state')))) : void 0;\n      }\n    };\n\n    Model.prototype.destroy = function(options, callback) {\n      var _ref1, _this = this;\n      if (!callback) {\n        _ref1 = [{},\n        options], options = _ref1[0], callback = _ref1[1];\n      }\n      if (this.get('lifecycle').destroy()) {\n        return this._doStorageOperation('destroy', {\n          data: options\n        }, function(err, record, env) {\n          if (!err) {\n            _this.constructor.get('loaded').remove(_this);\n            _this.get('lifecycle').destroyed();\n          } else {\n            _this.get('lifecycle').error();\n          }\n          return typeof callback === \"function\" ? callback(err, record, env) : void 0;\n        });\n      } else {\n        return typeof callback === \"function\" ? callback(new Batman.StateMachine.InvalidTransitionError(\"Can't destroy while in state \" + (this.get('lifecycle.state')))) : void 0;\n      }\n    };\n\n    Model.prototype.validate = function(callback) {\n      var args, count, errors, finishedValidation, key, validator, validators, _j, _k, _len1, _len2, _ref1;\n      errors = this.get('errors');\n      errors.clear();\n      validators = this._batman.get('validators') || [];\n      if (!validators || validators.length === 0) {\n        if (typeof callback === \"function\") {\n          callback(void 0, errors);\n        }\n        return true;\n      }\n      count = validators.reduce((function(acc, validator) {\n        return acc + validator.keys.length;\n      }), 0);\n      finishedValidation = function() {\n        if (--count === 0) {\n          return typeof callback === \"function\" ? callback(void 0, errors) : void 0;\n        }\n      };\n      for (_j = 0, _len1 = validators.length; _j < _len1; _j++) {\n        validator = validators[_j];\n        _ref1 = validator.keys;\n        for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {\n          key = _ref1[_k];\n          args = [errors, this, key, finishedValidation];\n          try {\n            if (validator.validator) {\n              validator.validator.validateEach.apply(validator.validator, args);\n            } else {\n              validator.callback.apply(validator, args);\n            }\n          } catch (e) {\n            if (typeof callback === \"function\") {\n              callback(e, errors);\n            }\n          }\n        }\n      }\n    };\n\n    Model.prototype.associationProxy = function(association) {\n      var proxies, _base, _name;\n      Batman.initializeObject(this);\n      proxies = (_base = this._batman).associationProxies || (_base.associationProxies = {});\n      proxies[_name = association.label] || (proxies[_name] = new association.proxyClass(association, this));\n      return proxies[association.label];\n    };\n\n    Model.prototype._willSet = function(key) {\n      if (this._pauseDirtyTracking) {\n        return true;\n      }\n      if (this.get('lifecycle').startTransition('set')) {\n        if (!this.get('_dirtiedKeys').has(key)) {\n          this.set(\"dirtyKeys.\" + key, this.get(key));\n          this.get('_dirtiedKeys').add(key);\n        }\n        return true;\n      } else {\n        return false;\n      }\n    };\n\n    Model.prototype._doStorageOperation = function(operation, options, callback) {\n      var adapter, _this = this;\n      Batman.developer.assert(this.hasStorage(), \"Can't \" + operation + \" model \" + (Batman.functionName(this.constructor)) + \" without any storage adapters!\");\n      adapter = this._batman.get('storage');\n      return adapter.perform(operation, this, options, function() {\n        return callback.apply(null, arguments);\n      });\n    };\n\n    Model.prototype._withoutDirtyTracking = function(block) {\n      var result;\n      this._pauseDirtyTracking = true;\n      result = block.call(this);\n      this._pauseDirtyTracking = false;\n      return result;\n    };\n\n    _ref1 = ['load', 'save', 'validate', 'destroy'];\n    for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n      functionName = _ref1[_j];\n      Model.prototype[functionName] = Batman.Property.wrapTrackingPrevention(Model.prototype[functionName]);\n    }\n\n    return Model;\n\n  }).call(this, Batman.Object);\n\n}).call(this);\n\n(function() {\n  var k, _fn, _i, _len, _ref, _this = this;\n\n  _ref = Batman.AssociationCurator.availableAssociations;\n  _fn = function(k) {\n    return Batman.Model[k] = function(label, scope) {\n      var collection, _base;\n      Batman.initializeObject(this);\n      collection = (_base = this._batman).associations || (_base.associations = new Batman.AssociationCurator(this));\n      return collection.add(new Batman[\"\" + (Batman.helpers.capitalize(k)) + \"Association\"](this, label, scope));\n    };\n  };\n  for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n    k = _ref[_i];\n    _fn(k);\n  }\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.Proxy = (function(_super) {\n\n    __extends(Proxy, _super);\n\n    Proxy.prototype.isProxy = true;\n\n    function Proxy(target) {\n      Proxy.__super__.constructor.call(this);\n      if (target != null) {\n        this.set('target', target);\n      }\n    }\n\n    Proxy.accessor('target', Batman.Property.defaultAccessor);\n\n    Proxy.accessor({\n      get: function(key) {\n        var _ref;\n        return (_ref = this.get('target')) != null ? _ref.get(key) : void 0;\n      },\n      set: function(key, value) {\n        var _ref;\n        return (_ref = this.get('target')) != null ? _ref.set(key, value) : void 0;\n      },\n      unset: function(key) {\n        var _ref;\n        return (_ref = this.get('target')) != null ? _ref.unset(key) : void 0;\n      }\n    });\n\n    return Proxy;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.AssociationProxy = (function(_super) {\n\n    __extends(AssociationProxy, _super);\n\n    AssociationProxy.prototype.loaded = false;\n\n    function AssociationProxy(association, model) {\n      this.association = association;\n      this.model = model;\n      AssociationProxy.__super__.constructor.call(this);\n    }\n\n    AssociationProxy.prototype.toJSON = function() {\n      var target;\n      target = this.get('target');\n      if (target != null) {\n        return this.get('target').toJSON();\n      }\n    };\n\n    AssociationProxy.prototype.load = function(callback) {\n      var _this = this;\n      this.fetch(function(err, proxiedRecord) {\n        if (!err) {\n          _this._setTarget(proxiedRecord);\n        }\n        return typeof callback === \"function\" ? callback(err, proxiedRecord) : void 0;\n      });\n      return this.get('target');\n    };\n\n    AssociationProxy.prototype.loadFromLocal = function() {\n      var target;\n      if (!this._canLoad()) {\n        return;\n      }\n      if (target = this.fetchFromLocal()) {\n        this._setTarget(target);\n      }\n      return target;\n    };\n\n    AssociationProxy.prototype.fetch = function(callback) {\n      var record;\n      if (!this._canLoad()) {\n        return callback(void 0, void 0);\n      }\n      record = this.fetchFromLocal();\n      if (record) {\n        return callback(void 0, record);\n      } else {\n        return this.fetchFromRemote(callback);\n      }\n    };\n\n    AssociationProxy.accessor('loaded', Batman.Property.defaultAccessor);\n\n    AssociationProxy.accessor('target', {\n      get: function() {\n        return this.fetchFromLocal();\n      },\n      set: function(_, v) {\n        return v;\n      }\n    });\n\n    AssociationProxy.prototype._canLoad = function() {\n      return (this.get('foreignValue') || this.get('primaryValue')) != null;\n    };\n\n    AssociationProxy.prototype._setTarget = function(target) {\n      this.set('target', target);\n      this.set('loaded', true);\n      return this.fire('loaded', target);\n    };\n\n    return AssociationProxy;\n\n  })(Batman.Proxy);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.HasOneProxy = (function(_super) {\n\n    __extends(HasOneProxy, _super);\n\n    function HasOneProxy() {\n      return HasOneProxy.__super__.constructor.apply(this, arguments);\n    }\n\n    HasOneProxy.accessor('primaryValue', function() {\n      return this.model.get(this.association.primaryKey);\n    });\n\n    HasOneProxy.prototype.fetchFromLocal = function() {\n      return this.association.setIndex().get(this.get('primaryValue'));\n    };\n\n    HasOneProxy.prototype.fetchFromRemote = function(callback) {\n      var loadOptions, _this = this;\n      loadOptions = {\n        data: {}\n      };\n      loadOptions.data[this.association.foreignKey] = this.get('primaryValue');\n      if (this.association.options.url) {\n        loadOptions.collectionUrl = this.association.options.url;\n        loadOptions.urlContext = this.model;\n      }\n      return this.association.getRelatedModel().loadWithOptions(loadOptions, function(error, loadedRecords) {\n        if (error) {\n          throw error;\n        }\n        if (!loadedRecords || loadedRecords.length <= 0) {\n          return callback(new Error(\"Couldn't find related record!\"), void 0);\n        } else {\n          return callback(void 0, loadedRecords[0]);\n        }\n      });\n    };\n\n    return HasOneProxy;\n\n  })(Batman.AssociationProxy);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.BelongsToProxy = (function(_super) {\n\n    __extends(BelongsToProxy, _super);\n\n    function BelongsToProxy() {\n      return BelongsToProxy.__super__.constructor.apply(this, arguments);\n    }\n\n    BelongsToProxy.accessor('foreignValue', function() {\n      return this.model.get(this.association.foreignKey);\n    });\n\n    BelongsToProxy.prototype.fetchFromLocal = function() {\n      return this.association.setIndex().get(this.get('foreignValue'));\n    };\n\n    BelongsToProxy.prototype.fetchFromRemote = function(callback) {\n      var loadOptions, _this = this;\n      loadOptions = {};\n      if (this.association.options.url) {\n        loadOptions.recordUrl = this.association.options.url;\n      }\n      return this.association.getRelatedModel().findWithOptions(this.get('foreignValue'), loadOptions, function(error, loadedRecord) {\n        if (error) {\n          throw error;\n        }\n        return callback(void 0, loadedRecord);\n      });\n    };\n\n    return BelongsToProxy;\n\n  })(Batman.AssociationProxy);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PolymorphicBelongsToProxy = (function(_super) {\n\n    __extends(PolymorphicBelongsToProxy, _super);\n\n    function PolymorphicBelongsToProxy() {\n      return PolymorphicBelongsToProxy.__super__.constructor.apply(this, arguments);\n    }\n\n    PolymorphicBelongsToProxy.accessor('foreignTypeValue', function() {\n      return this.model.get(this.association.foreignTypeKey);\n    });\n\n    PolymorphicBelongsToProxy.prototype.fetchFromLocal = function() {\n      return this.association.setIndexForType(this.get('foreignTypeValue')).get(this.get('foreignValue'));\n    };\n\n    PolymorphicBelongsToProxy.prototype.fetchFromRemote = function(callback) {\n      var loadOptions, _this = this;\n      loadOptions = {};\n      if (this.association.options.url) {\n        loadOptions.recordUrl = this.association.options.url;\n      }\n      return this.association.getRelatedModelForType(this.get('foreignTypeValue')).findWithOptions(this.get('foreignValue'), loadOptions, function(error, loadedRecord) {\n        if (error) {\n          throw error;\n        }\n        return callback(void 0, loadedRecord);\n      });\n    };\n\n    return PolymorphicBelongsToProxy;\n\n  })(Batman.BelongsToProxy);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.Accessible = (function(_super) {\n\n    __extends(Accessible, _super);\n\n    function Accessible() {\n      this.accessor.apply(this, arguments);\n    }\n\n    return Accessible;\n\n  })(Batman.Object);\n\n  Batman.TerminalAccessible = (function(_super) {\n\n    __extends(TerminalAccessible, _super);\n\n    function TerminalAccessible() {\n      return TerminalAccessible.__super__.constructor.apply(this, arguments);\n    }\n\n    TerminalAccessible.prototype.propertyClass = Batman.Property;\n\n    return TerminalAccessible;\n\n  })(Batman.Accessible);\n\n}).call(this);\n\n(function() {\n\n  Batman.mixins = new Batman.Object;\n\n}).call(this);\n\n(function() {\n\n  Batman.URI = (function() {\n    /*\n      # URI parsing\n    */\n\n    var attributes, childKeyMatchers, decodeQueryComponent, encodeComponent, encodeQueryComponent, keyVal, nameParser, normalizeParams, plus, queryFromParams, r20, strictParser;\n\n    strictParser = /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/;\n\n    attributes = [\"source\", \"protocol\", \"authority\", \"userInfo\", \"user\", \"password\", \"hostname\", \"port\", \"relative\", \"path\", \"directory\", \"file\", \"query\", \"hash\"];\n\n    function URI(str) {\n      var i, matches;\n      matches = strictParser.exec(str);\n      i = 14;\n      while (i--) {\n        this[attributes[i]] = matches[i] || '';\n      }\n      this.queryParams = this.constructor.paramsFromQuery(this.query);\n      delete this.authority;\n      delete this.userInfo;\n      delete this.relative;\n      delete this.directory;\n      delete this.file;\n      delete this.query;\n    }\n\n    URI.prototype.queryString = function() {\n      return this.constructor.queryFromParams(this.queryParams);\n    };\n\n    URI.prototype.toString = function() {\n      return [this.protocol ? \"\" + this.protocol + \":\" : void 0, this.authority() ? \"//\" : void 0, this.authority(), this.relative()].join(\"\");\n    };\n\n    URI.prototype.userInfo = function() {\n      return [this.user, this.password ? \":\" + this.password : void 0].join(\"\");\n    };\n\n    URI.prototype.authority = function() {\n      return [this.userInfo(), this.user || this.password ? \"@\" : void 0, this.hostname, this.port ? \":\" + this.port : void 0].join(\"\");\n    };\n\n    URI.prototype.relative = function() {\n      var query;\n      query = this.queryString();\n      return [this.path, query ? \"?\" + query : void 0, this.hash ? \"#\" + this.hash : void 0].join(\"\");\n    };\n\n    URI.prototype.directory = function() {\n      var splitPath;\n      splitPath = this.path.split('/');\n      if (splitPath.length > 1) {\n        return splitPath.slice(0, splitPath.length - 1).join('/') + \"/\";\n      } else {\n        return \"\";\n      }\n    };\n\n    URI.prototype.file = function() {\n      var splitPath;\n      splitPath = this.path.split(\"/\");\n      return splitPath[splitPath.length - 1];\n    };\n\n    /*\n      # query parsing\n    */\n\n\n    URI.paramsFromQuery = function(query) {\n      var matches, params, segment, _i, _len, _ref;\n      params = {};\n      _ref = query.split('&');\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        segment = _ref[_i];\n        if (matches = segment.match(keyVal)) {\n          normalizeParams(params, decodeQueryComponent(matches[1]), decodeQueryComponent(matches[2]));\n        } else {\n          normalizeParams(params, decodeQueryComponent(segment), null);\n        }\n      }\n      return params;\n    };\n\n    URI.decodeQueryComponent = decodeQueryComponent = function(str) {\n      return decodeURIComponent(str.replace(plus, '%20'));\n    };\n\n    nameParser = /^[\\[\\]]*([^\\[\\]]+)\\]*(.*)/;\n\n    childKeyMatchers = [/^\\[\\]\\[([^\\[\\]]+)\\]$/, /^\\[\\](.+)$/];\n\n    plus = /\\+/g;\n\n    r20 = /%20/g;\n\n    keyVal = /^([^=]*)=(.*)/;\n\n    normalizeParams = function(params, name, v) {\n      var after, childKey, k, last, matches, _ref, _ref1, _ref2;\n      if (matches = name.match(nameParser)) {\n        k = matches[1];\n        after = matches[2];\n      } else {\n        return;\n      }\n      if (after === '') {\n        params[k] = v;\n      } else if (after === '[]') {\n        if ((_ref = params[k]) == null) {\n          params[k] = [];\n        }\n        if (Batman.typeOf(params[k]) !== 'Array') {\n          throw new Error(\"expected Array (got \" + (Batman.typeOf(params[k])) + \") for param \\\"\" + k + \"\\\"\");\n        }\n        params[k].push(v);\n      } else if (matches = after.match(childKeyMatchers[0]) || after.match(childKeyMatchers[1])) {\n        childKey = matches[1];\n        if ((_ref1 = params[k]) == null) {\n          params[k] = [];\n        }\n        if (Batman.typeOf(params[k]) !== 'Array') {\n          throw new Error(\"expected Array (got \" + (Batman.typeOf(params[k])) + \") for param \\\"\" + k + \"\\\"\");\n        }\n        last = params[k][params[k].length - 1];\n        if (Batman.typeOf(last) === 'Object' && !(childKey in last)) {\n          normalizeParams(last, childKey, v);\n        } else {\n          params[k].push(normalizeParams({}, childKey, v));\n        }\n      } else {\n        if ((_ref2 = params[k]) == null) {\n          params[k] = {};\n        }\n        if (Batman.typeOf(params[k]) !== 'Object') {\n          throw new Error(\"expected Object (got \" + (Batman.typeOf(params[k])) + \") for param \\\"\" + k + \"\\\"\");\n        }\n        params[k] = normalizeParams(params[k], after, v);\n      }\n      return params;\n    };\n\n    /*\n      # query building\n    */\n\n\n    URI.queryFromParams = queryFromParams = function(value, prefix) {\n      var arrayResults, k, v, valueType;\n      if (value == null) {\n        return prefix;\n      }\n      valueType = Batman.typeOf(value);\n      if (!((prefix != null) || valueType === 'Object')) {\n        throw new Error(\"value must be an Object\");\n      }\n      switch (valueType) {\n      case 'Array':\n        return ((function() {\n          var _i, _len;\n          arrayResults = [];\n          if (value.length === 0) {\n            arrayResults.push(queryFromParams(null, \"\" + prefix + \"[]\"));\n          } else {\n            for (_i = 0, _len = value.length; _i < _len; _i++) {\n              v = value[_i];\n              arrayResults.push(queryFromParams(v, \"\" + prefix + \"[]\"));\n            }\n          }\n          return arrayResults;\n        })()).join(\"&\");\n      case 'Object':\n        return ((function() {\n          var _results;\n          _results = [];\n          for (k in value) {\n            v = value[k];\n            _results.push(queryFromParams(v, prefix ? \"\" + prefix + \"[\" + (encodeQueryComponent(k)) + \"]\" : encodeQueryComponent(k)));\n          }\n          return _results;\n        })()).join(\"&\");\n      default:\n        if (prefix != null) {\n          return \"\" + prefix + \"=\" + (encodeQueryComponent(value));\n        } else {\n          return encodeQueryComponent(value);\n        }\n      }\n    };\n\n    URI.encodeComponent = encodeComponent = function(str) {\n      if (str != null) {\n        return encodeURIComponent(str);\n      } else {\n        return '';\n      }\n    };\n\n    URI.encodeQueryComponent = encodeQueryComponent = function(str) {\n      return encodeComponent(str).replace(r20, '+');\n    };\n\n    return URI;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.Request = (function(_super) {\n    var dataHasFileUploads;\n\n    __extends(Request, _super);\n\n    Request.objectToFormData = function(data) {\n      var formData, key, pairForList, val, _i, _len, _ref, _ref1;\n      pairForList = function(key, object, first) {\n        var k, list, v;\n        if (first == null) {\n          first = false;\n        }\n        if (object instanceof Batman.container.File) {\n          return [[key, object]];\n        }\n        return list = (function() {\n          switch (Batman.typeOf(object)) {\n          case 'Object':\n            list = (function() {\n              var _results;\n              _results = [];\n              for (k in object) {\n                v = object[k];\n                _results.push(pairForList((first ? k : \"\" + key + \"[\" + k + \"]\"), v));\n              }\n              return _results;\n            })();\n            return list.reduce(function(acc, list) {\n              return acc.concat(list);\n            }, []);\n          case 'Array':\n            return object.reduce(function(acc, element) {\n              return acc.concat(pairForList(\"\" + key + \"[]\", element));\n            }, []);\n          default:\n            return [[key, object != null ? object : \"\"]];\n          }\n        })();\n      };\n      formData = new Batman.container.FormData();\n      _ref = pairForList(\"\", data, true);\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        _ref1 = _ref[_i], key = _ref1[0], val = _ref1[1];\n        formData.append(key, val);\n      }\n      return formData;\n    };\n\n    Request.dataHasFileUploads = dataHasFileUploads = function(data) {\n      var k, type, v, _i, _len;\n      if ((typeof File !== \"undefined\" && File !== null) && data instanceof File) {\n        return true;\n      }\n      type = Batman.typeOf(data);\n      switch (type) {\n      case 'Object':\n        for (k in data) {\n          v = data[k];\n          if (dataHasFileUploads(v)) {\n            return true;\n          }\n        }\n        break;\n      case 'Array':\n        for (_i = 0, _len = data.length; _i < _len; _i++) {\n          v = data[_i];\n          if (dataHasFileUploads(v)) {\n            return true;\n          }\n        }\n      }\n      return false;\n    };\n\n    Request.wrapAccessor('method', function(core) {\n      return {\n        set: function(k, val) {\n          return core.set.call(this, k, val != null ? typeof val.toUpperCase === \"function\" ? val.toUpperCase() : void 0 : void 0);\n        }\n      };\n    });\n\n    Request.prototype.method = 'GET';\n\n    Request.prototype.hasFileUploads = function() {\n      return dataHasFileUploads(this.data);\n    };\n\n    Request.prototype.contentType = 'application/x-www-form-urlencoded';\n\n    Request.prototype.autosend = true;\n\n    function Request(options) {\n      var handler, handlers, k, _ref;\n      handlers = {};\n      for (k in options) {\n        handler = options[k];\n        if (!(k === 'success' || k === 'error' || k === 'loading' || k === 'loaded')) {\n          continue;\n        }\n        handlers[k] = handler;\n        delete options[k];\n      }\n      Request.__super__.constructor.call(this, options);\n      for (k in handlers) {\n        handler = handlers[k];\n        this.on(k, handler);\n      }\n      if (((_ref = this.get('url')) != null ? _ref.length : void 0) > 0) {\n        if (this.autosend) {\n          this.send();\n        }\n      } else {\n        this.observe('url', function(url) {\n          if (url != null) {\n            return this.send();\n          }\n        });\n      }\n    }\n\n    Request.prototype.send = function() {\n      return Batman.developer.error(\"Please source a dependency file for a request implementation\");\n    };\n\n    return Request;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.SetObserver = (function(_super) {\n\n    __extends(SetObserver, _super);\n\n    function SetObserver(base) {\n      var _this = this;\n      this.base = base;\n      this._itemObservers = new Batman.SimpleHash;\n      this._setObservers = new Batman.SimpleHash;\n      this._setObservers.set(\"itemsWereAdded\", function() {\n        return _this.fire.apply(_this, ['itemsWereAdded'].concat(__slice.call(arguments)));\n      });\n      this._setObservers.set(\"itemsWereRemoved\", function() {\n        return _this.fire.apply(_this, ['itemsWereRemoved'].concat(__slice.call(arguments)));\n      });\n      this.on('itemsWereAdded', this.startObservingItems.bind(this));\n      this.on('itemsWereRemoved', this.stopObservingItems.bind(this));\n    }\n\n    SetObserver.prototype.observedItemKeys = [];\n\n    SetObserver.prototype.observerForItemAndKey = function(item, key) {};\n\n    SetObserver.prototype._getOrSetObserverForItemAndKey = function(item, key) {\n      var _this = this;\n      return this._itemObservers.getOrSet(item, function() {\n        var observersByKey;\n        observersByKey = new Batman.SimpleHash;\n        return observersByKey.getOrSet(key, function() {\n          return _this.observerForItemAndKey(item, key);\n        });\n      });\n    };\n\n    SetObserver.prototype.startObserving = function() {\n      this._manageItemObservers(\"observe\");\n      return this._manageSetObservers(\"addHandler\");\n    };\n\n    SetObserver.prototype.stopObserving = function() {\n      this._manageItemObservers(\"forget\");\n      return this._manageSetObservers(\"removeHandler\");\n    };\n\n    SetObserver.prototype.startObservingItems = function() {\n      var item, items, _i, _len, _results;\n      items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      _results = [];\n      for (_i = 0, _len = items.length; _i < _len; _i++) {\n        item = items[_i];\n        _results.push(this._manageObserversForItem(item, \"observe\"));\n      }\n      return _results;\n    };\n\n    SetObserver.prototype.stopObservingItems = function() {\n      var item, items, _i, _len, _results;\n      items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      _results = [];\n      for (_i = 0, _len = items.length; _i < _len; _i++) {\n        item = items[_i];\n        _results.push(this._manageObserversForItem(item, \"forget\"));\n      }\n      return _results;\n    };\n\n    SetObserver.prototype._manageObserversForItem = function(item, method) {\n      var key, _i, _len, _ref;\n      if (!item.isObservable) {\n        return;\n      }\n      _ref = this.observedItemKeys;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        key = _ref[_i];\n        item[method](key, this._getOrSetObserverForItemAndKey(item, key));\n      }\n      if (method === \"forget\") {\n        return this._itemObservers.unset(item);\n      }\n    };\n\n    SetObserver.prototype._manageItemObservers = function(method) {\n      var _this = this;\n      return this.base.forEach(function(item) {\n        return _this._manageObserversForItem(item, method);\n      });\n    };\n\n    SetObserver.prototype._manageSetObservers = function(method) {\n      var _this = this;\n      if (!this.base.isObservable) {\n        return;\n      }\n      return this._setObservers.forEach(function(key, observer) {\n        return _this.base.event(key)[method](observer);\n      });\n    };\n\n    return SetObserver;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.SetSort = (function(_super) {\n\n    __extends(SetSort, _super);\n\n    function SetSort(base, key, order) {\n      var boundReIndex, _this = this;\n      this.key = key;\n      if (order == null) {\n        order = \"asc\";\n      }\n      SetSort.__super__.constructor.call(this, base);\n      this.descending = order.toLowerCase() === \"desc\";\n      if (this.base.isObservable) {\n        this._setObserver = new Batman.SetObserver(this.base);\n        this._setObserver.observedItemKeys = [this.key];\n        boundReIndex = function() {\n          return _this._reIndex();\n        };\n        this._setObserver.observerForItemAndKey = function() {\n          return boundReIndex;\n        };\n        this._setObserver.on('itemsWereAdded', boundReIndex);\n        this._setObserver.on('itemsWereRemoved', boundReIndex);\n        this.startObserving();\n      }\n      this._reIndex();\n    }\n\n    SetSort.prototype.startObserving = function() {\n      var _ref;\n      return (_ref = this._setObserver) != null ? _ref.startObserving() : void 0;\n    };\n\n    SetSort.prototype.stopObserving = function() {\n      var _ref;\n      return (_ref = this._setObserver) != null ? _ref.stopObserving() : void 0;\n    };\n\n    SetSort.prototype.toArray = function() {\n      return this.get('_storage');\n    };\n\n    SetSort.prototype.forEach = function(iterator, ctx) {\n      var e, i, _i, _len, _ref, _results;\n      _ref = this.get('_storage');\n      _results = [];\n      for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {\n        e = _ref[i];\n        _results.push(iterator.call(ctx, e, i, this));\n      }\n      return _results;\n    };\n\n    SetSort.prototype.find = function(block) {\n      var item, _i, _len, _ref;\n      this.base.registerAsMutableSource();\n      _ref = this.get('_storage');\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        item = _ref[_i];\n        if (block(item)) {\n          return item;\n        }\n      }\n    };\n\n    SetSort.prototype.merge = function(other) {\n      this.base.registerAsMutableSource();\n      return (function(func, args, ctor) {\n        ctor.prototype = func.prototype;\n        var child = new ctor,\n          result = func.apply(child, args),\n          t = typeof result;\n        return t == \"object\" || t == \"function\" ? result || child : child;\n      })(Batman.Set, this._storage, function() {}).merge(other).sortedBy(this.key, this.order);\n    };\n\n    SetSort.prototype.compare = function(a, b) {\n      if (a === b) {\n        return 0;\n      }\n      if (a === void 0) {\n        return 1;\n      }\n      if (b === void 0) {\n        return -1;\n      }\n      if (a === null) {\n        return 1;\n      }\n      if (b === null) {\n        return -1;\n      }\n      if (a === false) {\n        return 1;\n      }\n      if (b === false) {\n        return -1;\n      }\n      if (a === true) {\n        return 1;\n      }\n      if (b === true) {\n        return -1;\n      }\n      if (a !== a) {\n        if (b !== b) {\n          return 0;\n        } else {\n          return 1;\n        }\n      }\n      if (b !== b) {\n        return -1;\n      }\n      if (a > b) {\n        return 1;\n      }\n      if (a < b) {\n        return -1;\n      }\n      return 0;\n    };\n\n    SetSort.prototype._reIndex = function() {\n      var newOrder, _ref, _this = this;\n      newOrder = this.base.toArray().sort(function(a, b) {\n        var multiple, valueA, valueB;\n        valueA = Batman.get(a, _this.key);\n        if (typeof valueA === 'function') {\n          valueA = valueA.call(a);\n        }\n        if (valueA != null) {\n          valueA = valueA.valueOf();\n        }\n        valueB = Batman.get(b, _this.key);\n        if (typeof valueB === 'function') {\n          valueB = valueB.call(b);\n        }\n        if (valueB != null) {\n          valueB = valueB.valueOf();\n        }\n        multiple = _this.descending ? -1 : 1;\n        return _this.compare.call(_this, valueA, valueB) * multiple;\n      });\n      if ((_ref = this._setObserver) != null) {\n        _ref.startObservingItems.apply(_ref, newOrder);\n      }\n      return this.set('_storage', newOrder);\n    };\n\n    return SetSort;\n\n  })(Batman.SetProxy);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.AssociationSet = (function(_super) {\n\n    __extends(AssociationSet, _super);\n\n    function AssociationSet(foreignKeyValue, association) {\n      var base;\n      this.foreignKeyValue = foreignKeyValue;\n      this.association = association;\n      base = new Batman.Set;\n      AssociationSet.__super__.constructor.call(this, base, '_batmanID');\n    }\n\n    AssociationSet.prototype.loaded = false;\n\n    AssociationSet.prototype.load = function(callback) {\n      var _this = this;\n      if (this.foreignKeyValue == null) {\n        return callback(void 0, this);\n      }\n      return this.association.getRelatedModel().loadWithOptions(this._getLoadOptions(), function(err, records) {\n        if (!err) {\n          _this.markAsLoaded();\n        }\n        return callback(err, _this);\n      });\n    };\n\n    AssociationSet.prototype._getLoadOptions = function() {\n      var loadOptions;\n      loadOptions = {\n        data: {}\n      };\n      loadOptions.data[this.association.foreignKey] = this.foreignKeyValue;\n      if (this.association.options.url) {\n        loadOptions.collectionUrl = this.association.options.url;\n        loadOptions.urlContext = this.association.parentSetIndex().get(this.foreignKeyValue);\n      }\n      return loadOptions;\n    };\n\n    AssociationSet.accessor('loaded', Batman.Property.defaultAccessor);\n\n    AssociationSet.prototype.markAsLoaded = function() {\n      this.set('loaded', true);\n      return this.fire('loaded');\n    };\n\n    return AssociationSet;\n\n  })(Batman.SetSort);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PolymorphicAssociationSet = (function(_super) {\n\n    __extends(PolymorphicAssociationSet, _super);\n\n    function PolymorphicAssociationSet(foreignKeyValue, foreignTypeKeyValue, association) {\n      this.foreignKeyValue = foreignKeyValue;\n      this.foreignTypeKeyValue = foreignTypeKeyValue;\n      this.association = association;\n      PolymorphicAssociationSet.__super__.constructor.call(this, this.foreignKeyValue, this.association);\n    }\n\n    PolymorphicAssociationSet.prototype._getLoadOptions = function() {\n      var loadOptions;\n      loadOptions = {\n        data: {}\n      };\n      loadOptions.data[this.association.foreignKey] = this.foreignKeyValue;\n      loadOptions.data[this.association.foreignTypeKey] = this.foreignTypeKeyValue;\n      if (this.association.options.url) {\n        loadOptions.collectionUrl = this.association.options.url;\n        loadOptions.urlContext = this.association.parentSetIndex().get(this.foreignKeyValue);\n      }\n      return loadOptions;\n    };\n\n    return PolymorphicAssociationSet;\n\n  })(Batman.AssociationSet);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.SetIndex = (function(_super) {\n\n    __extends(SetIndex, _super);\n\n    SetIndex.accessor('toArray', function() {\n      return this.toArray();\n    });\n\n    Batman.extend(SetIndex.prototype, Batman.Enumerable);\n\n    SetIndex.prototype.propertyClass = Batman.Property;\n\n    function SetIndex(base, key) {\n      var _this = this;\n      this.base = base;\n      this.key = key;\n      SetIndex.__super__.constructor.call(this);\n      this._storage = new Batman.Hash;\n      if (this.base.isEventEmitter) {\n        this._setObserver = new Batman.SetObserver(this.base);\n        this._setObserver.observedItemKeys = [this.key];\n        this._setObserver.observerForItemAndKey = this.observerForItemAndKey.bind(this);\n        this._setObserver.on('itemsWereAdded', function() {\n          var item, items, _i, _len, _results;\n          items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n          _results = [];\n          for (_i = 0, _len = items.length; _i < _len; _i++) {\n            item = items[_i];\n            _results.push(_this._addItem(item));\n          }\n          return _results;\n        });\n        this._setObserver.on('itemsWereRemoved', function() {\n          var item, items, _i, _len, _results;\n          items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n          _results = [];\n          for (_i = 0, _len = items.length; _i < _len; _i++) {\n            item = items[_i];\n            _results.push(_this._removeItem(item));\n          }\n          return _results;\n        });\n      }\n      this.base.forEach(this._addItem.bind(this));\n      this.startObserving();\n    }\n\n    SetIndex.accessor(function(key) {\n      return this._resultSetForKey(key);\n    });\n\n    SetIndex.prototype.startObserving = function() {\n      var _ref;\n      return (_ref = this._setObserver) != null ? _ref.startObserving() : void 0;\n    };\n\n    SetIndex.prototype.stopObserving = function() {\n      var _ref;\n      return (_ref = this._setObserver) != null ? _ref.stopObserving() : void 0;\n    };\n\n    SetIndex.prototype.observerForItemAndKey = function(item, key) {\n      var _this = this;\n      return function(newValue, oldValue) {\n        _this._removeItemFromKey(item, oldValue);\n        return _this._addItemToKey(item, newValue);\n      };\n    };\n\n    SetIndex.prototype.forEach = function(iterator, ctx) {\n      var _this = this;\n      return this._storage.forEach(function(key, set) {\n        if (set.get('length') > 0) {\n          return iterator.call(ctx, key, set, _this);\n        }\n      });\n    };\n\n    SetIndex.prototype.toArray = function() {\n      var results;\n      results = [];\n      this._storage.forEach(function(key, set) {\n        if (set.get('length') > 0) {\n          return results.push(key);\n        }\n      });\n      return results;\n    };\n\n    SetIndex.prototype._addItem = function(item) {\n      return this._addItemToKey(item, this._keyForItem(item));\n    };\n\n    SetIndex.prototype._addItemToKey = function(item, key) {\n      return this._resultSetForKey(key).add(item);\n    };\n\n    SetIndex.prototype._removeItem = function(item) {\n      return this._removeItemFromKey(item, this._keyForItem(item));\n    };\n\n    SetIndex.prototype._removeItemFromKey = function(item, key) {\n      return this._resultSetForKey(key).remove(item);\n    };\n\n    SetIndex.prototype._resultSetForKey = function(key) {\n      return this._storage.getOrSet(key, function() {\n        return new Batman.Set;\n      });\n    };\n\n    SetIndex.prototype._keyForItem = function(item) {\n      return Batman.Keypath.forBaseAndKey(item, this.key).getValue();\n    };\n\n    return SetIndex;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PolymorphicAssociationSetIndex = (function(_super) {\n\n    __extends(PolymorphicAssociationSetIndex, _super);\n\n    function PolymorphicAssociationSetIndex(association, type, key) {\n      this.association = association;\n      this.type = type;\n      PolymorphicAssociationSetIndex.__super__.constructor.call(this, this.association.getRelatedModel().get('loaded'), key);\n    }\n\n    PolymorphicAssociationSetIndex.prototype._resultSetForKey = function(key) {\n      return this.association.setForKey(key);\n    };\n\n    PolymorphicAssociationSetIndex.prototype._addItem = function(item) {\n      if (this.association.modelType() !== item.get(this.association.foreignTypeKey)) {\n        return;\n      }\n      return PolymorphicAssociationSetIndex.__super__._addItem.apply(this, arguments);\n    };\n\n    PolymorphicAssociationSetIndex.prototype._removeItem = function(item) {\n      if (this.association.modelType() !== item.get(this.association.foreignTypeKey)) {\n        return;\n      }\n      return PolymorphicAssociationSetIndex.__super__._removeItem.apply(this, arguments);\n    };\n\n    return PolymorphicAssociationSetIndex;\n\n  })(Batman.SetIndex);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.AssociationSetIndex = (function(_super) {\n\n    __extends(AssociationSetIndex, _super);\n\n    function AssociationSetIndex(association, key) {\n      this.association = association;\n      AssociationSetIndex.__super__.constructor.call(this, this.association.getRelatedModel().get('loaded'), key);\n    }\n\n    AssociationSetIndex.prototype._resultSetForKey = function(key) {\n      return this.association.setForKey(key);\n    };\n\n    AssociationSetIndex.prototype.forEach = function(iterator, ctx) {\n      var _this = this;\n      return this.association.proxies.forEach(function(record, set) {\n        var key;\n        key = _this.association.indexValueForRecord(record);\n        if (set.get('length') > 0) {\n          return iterator.call(ctx, key, set, _this);\n        }\n      });\n    };\n\n    AssociationSetIndex.prototype.toArray = function() {\n      var results;\n      results = [];\n      this.forEach(function(key) {\n        return results.push(key);\n      });\n      return results;\n    };\n\n    return AssociationSetIndex;\n\n  })(Batman.SetIndex);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.UniqueSetIndex = (function(_super) {\n\n    __extends(UniqueSetIndex, _super);\n\n    function UniqueSetIndex() {\n      this._uniqueIndex = new Batman.Hash;\n      UniqueSetIndex.__super__.constructor.apply(this, arguments);\n    }\n\n    UniqueSetIndex.accessor(function(key) {\n      return this._uniqueIndex.get(key);\n    });\n\n    UniqueSetIndex.prototype._addItemToKey = function(item, key) {\n      this._resultSetForKey(key).add(item);\n      if (!this._uniqueIndex.hasKey(key)) {\n        return this._uniqueIndex.set(key, item);\n      }\n    };\n\n    UniqueSetIndex.prototype._removeItemFromKey = function(item, key) {\n      var resultSet;\n      resultSet = this._resultSetForKey(key);\n      UniqueSetIndex.__super__._removeItemFromKey.apply(this, arguments);\n      if (resultSet.isEmpty()) {\n        return this._uniqueIndex.unset(key);\n      } else {\n        return this._uniqueIndex.set(key, resultSet.toArray()[0]);\n      }\n    };\n\n    return UniqueSetIndex;\n\n  })(Batman.SetIndex);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.UniqueAssociationSetIndex = (function(_super) {\n\n    __extends(UniqueAssociationSetIndex, _super);\n\n    function UniqueAssociationSetIndex(association, key) {\n      this.association = association;\n      UniqueAssociationSetIndex.__super__.constructor.call(this, this.association.getRelatedModel().get('loaded'), key);\n    }\n\n    return UniqueAssociationSetIndex;\n\n  })(Batman.UniqueSetIndex);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PolymorphicUniqueAssociationSetIndex = (function(_super) {\n\n    __extends(PolymorphicUniqueAssociationSetIndex, _super);\n\n    function PolymorphicUniqueAssociationSetIndex(association, type, key) {\n      this.association = association;\n      this.type = type;\n      PolymorphicUniqueAssociationSetIndex.__super__.constructor.call(this, this.association.getRelatedModelForType(type).get('loaded'), key);\n    }\n\n    return PolymorphicUniqueAssociationSetIndex;\n\n  })(Batman.UniqueSetIndex);\n\n}).call(this);\n\n(function() {\n  var __bind = function(fn, me) {\n      return function() {\n        return fn.apply(me, arguments);\n      };\n    },\n    __slice = [].slice;\n\n  Batman.Navigator = (function() {\n\n    Navigator.defaultClass = function() {\n      if (Batman.config.usePushState && Batman.PushStateNavigator.isSupported()) {\n        return Batman.PushStateNavigator;\n      } else {\n        return Batman.HashbangNavigator;\n      }\n    };\n\n    Navigator.forApp = function(app) {\n      return new(this.defaultClass())(app);\n    };\n\n    function Navigator(app) {\n      this.app = app;\n      this.handleCurrentLocation = __bind(this.handleCurrentLocation, this);\n\n    }\n\n    Navigator.prototype.start = function() {\n      var _this = this;\n      if (typeof window === 'undefined') {\n        return;\n      }\n      if (this.started) {\n        return;\n      }\n      this.started = true;\n      this.startWatching();\n      Batman.currentApp.prevent('ready');\n      return Batman.setImmediate(function() {\n        if (_this.started && Batman.currentApp) {\n          _this.handleCurrentLocation();\n          return Batman.currentApp.allowAndFire('ready');\n        }\n      });\n    };\n\n    Navigator.prototype.stop = function() {\n      this.stopWatching();\n      return this.started = false;\n    };\n\n    Navigator.prototype.handleLocation = function(location) {\n      var path;\n      path = this.pathFromLocation(location);\n      if (path === this.cachedPath) {\n        return;\n      }\n      return this.dispatch(path);\n    };\n\n    Navigator.prototype.handleCurrentLocation = function() {\n      return this.handleLocation(window.location);\n    };\n\n    Navigator.prototype.dispatch = function(params) {\n      this.cachedPath = this.app.get('dispatcher').dispatch(params);\n      if (this._lastRedirect) {\n        this.cachedPath = this._lastRedirect;\n      }\n      return this.cachedPath;\n    };\n\n    Navigator.prototype.push = function(params) {\n      var path, pathFromParams, _base;\n      pathFromParams = typeof(_base = this.app.get('dispatcher')).pathFromParams === \"function\" ? _base.pathFromParams(params) : void 0;\n      if (pathFromParams) {\n        this._lastRedirect = pathFromParams;\n      }\n      path = this.dispatch(params);\n      if (!this._lastRedirect || this._lastRedirect === path) {\n        this.pushState(null, '', path);\n      }\n      return path;\n    };\n\n    Navigator.prototype.replace = function(params) {\n      var path, pathFromParams, _base;\n      pathFromParams = typeof(_base = this.app.get('dispatcher')).pathFromParams === \"function\" ? _base.pathFromParams(params) : void 0;\n      if (pathFromParams) {\n        this._lastRedirect = pathFromParams;\n      }\n      path = this.dispatch(params);\n      if (!this._lastRedirect || this._lastRedirect === path) {\n        this.replaceState(null, '', path);\n      }\n      return path;\n    };\n\n    Navigator.prototype.redirect = Navigator.prototype.push;\n\n    Navigator.prototype.normalizePath = function() {\n      var i, seg, segments;\n      segments = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      segments = (function() {\n        var _i, _len, _results;\n        _results = [];\n        for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) {\n          seg = segments[i];\n          _results.push((\"\" + seg).replace(/^(?!\\/)/, '/').replace(/\\/+$/, ''));\n        }\n        return _results;\n      })();\n      return segments.join('') || '/';\n    };\n\n    Navigator.normalizePath = Navigator.prototype.normalizePath;\n\n    return Navigator;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PushStateNavigator = (function(_super) {\n\n    __extends(PushStateNavigator, _super);\n\n    function PushStateNavigator() {\n      return PushStateNavigator.__super__.constructor.apply(this, arguments);\n    }\n\n    PushStateNavigator.isSupported = function() {\n      var _ref;\n      return (typeof window !== \"undefined\" && window !== null ? (_ref = window.history) != null ? _ref.pushState : void 0 : void 0) != null;\n    };\n\n    PushStateNavigator.prototype.startWatching = function() {\n      return Batman.DOM.addEventListener(window, 'popstate', this.handleCurrentLocation);\n    };\n\n    PushStateNavigator.prototype.stopWatching = function() {\n      return Batman.DOM.removeEventListener(window, 'popstate', this.handleCurrentLocation);\n    };\n\n    PushStateNavigator.prototype.pushState = function(stateObject, title, path) {\n      if (path !== this.pathFromLocation(window.location)) {\n        return window.history.pushState(stateObject, title, this.linkTo(path));\n      }\n    };\n\n    PushStateNavigator.prototype.replaceState = function(stateObject, title, path) {\n      if (path !== this.pathFromLocation(window.location)) {\n        return window.history.replaceState(stateObject, title, this.linkTo(path));\n      }\n    };\n\n    PushStateNavigator.prototype.linkTo = function(url) {\n      return this.normalizePath(Batman.config.pathPrefix, url);\n    };\n\n    PushStateNavigator.prototype.pathFromLocation = function(location) {\n      var fullPath, prefixPattern;\n      fullPath = \"\" + (location.pathname || '') + (location.search || '');\n      prefixPattern = new RegExp(\"^\" + (this.normalizePath(Batman.config.pathPrefix)));\n      return this.normalizePath(fullPath.replace(prefixPattern, ''));\n    };\n\n    PushStateNavigator.prototype.handleLocation = function(location) {\n      var hashbangPath, path;\n      path = this.pathFromLocation(location);\n      if (path === '/' && (hashbangPath = Batman.HashbangNavigator.prototype.pathFromLocation(location)) !== '/') {\n        return this.replace(hashbangPath);\n      } else {\n        return PushStateNavigator.__super__.handleLocation.apply(this, arguments);\n      }\n    };\n\n    return PushStateNavigator;\n\n  })(Batman.Navigator);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.HashbangNavigator = (function(_super) {\n\n    __extends(HashbangNavigator, _super);\n\n    function HashbangNavigator() {\n      return HashbangNavigator.__super__.constructor.apply(this, arguments);\n    }\n\n    HashbangNavigator.prototype.HASH_PREFIX = '#!';\n\n    if ((typeof window !== \"undefined\" && window !== null) && 'onhashchange' in window) {\n      HashbangNavigator.prototype.startWatching = function() {\n        return Batman.DOM.addEventListener(window, 'hashchange', this.handleCurrentLocation);\n      };\n      HashbangNavigator.prototype.stopWatching = function() {\n        return Batman.DOM.removeEventListener(window, 'hashchange', this.handleCurrentLocation);\n      };\n    } else {\n      HashbangNavigator.prototype.startWatching = function() {\n        return this.interval = setInterval(this.handleCurrentLocation, 100);\n      };\n      HashbangNavigator.prototype.stopWatching = function() {\n        return this.interval = clearInterval(this.interval);\n      };\n    }\n\n    HashbangNavigator.prototype.pushState = function(stateObject, title, path) {\n      return window.location.hash = this.linkTo(path);\n    };\n\n    HashbangNavigator.prototype.replaceState = function(stateObject, title, path) {\n      var loc;\n      loc = window.location;\n      return loc.replace(\"\" + loc.pathname + loc.search + (this.linkTo(path)));\n    };\n\n    HashbangNavigator.prototype.linkTo = function(url) {\n      return this.HASH_PREFIX + url;\n    };\n\n    HashbangNavigator.prototype.pathFromLocation = function(location) {\n      var hash;\n      hash = location.hash;\n      if ((hash != null ? hash.substr(0, 2) : void 0) === this.HASH_PREFIX) {\n        return this.normalizePath(hash.substr(2));\n      } else {\n        return '/';\n      }\n    };\n\n    HashbangNavigator.prototype.handleLocation = function(location) {\n      var realPath;\n      if (!Batman.config.usePushState) {\n        return HashbangNavigator.__super__.handleLocation.apply(this, arguments);\n      }\n      realPath = Batman.PushStateNavigator.prototype.pathFromLocation(location);\n      if (realPath === '/') {\n        return HashbangNavigator.__super__.handleLocation.apply(this, arguments);\n      } else {\n        return location.replace(this.normalizePath(\"\" + Batman.config.pathPrefix + (this.linkTo(realPath))));\n      }\n    };\n\n    return HashbangNavigator;\n\n  })(Batman.Navigator);\n\n}).call(this);\n\n(function() {\n\n  Batman.RouteMap = (function() {\n\n    RouteMap.prototype.memberRoute = null;\n\n    RouteMap.prototype.collectionRoute = null;\n\n    function RouteMap() {\n      this.childrenByOrder = [];\n      this.childrenByName = {};\n    }\n\n    RouteMap.prototype.routeForParams = function(params) {\n      var route, _i, _len, _ref;\n      _ref = this.childrenByOrder;\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        route = _ref[_i];\n        if (route.test(params)) {\n          return route;\n        }\n      }\n      return void 0;\n    };\n\n    RouteMap.prototype.addRoute = function(name, route) {\n      var base, names, _this = this;\n      this.childrenByOrder.push(route);\n      if (name.length > 0 && (names = name.split('.')).length > 0) {\n        base = names.shift();\n        if (!this.childrenByName[base]) {\n          this.childrenByName[base] = new Batman.RouteMap;\n        }\n        this.childrenByName[base].addRoute(names.join('.'), route);\n      } else {\n        if (route.get('member')) {\n          Batman.developer[\"do\"](function() {\n            if (_this.memberRoute) {\n              return Batman.developer.error(\"Member route with name \" + name + \" already exists!\");\n            }\n          });\n          this.memberRoute = route;\n        } else {\n          Batman.developer[\"do\"](function() {\n            if (_this.collectionRoute) {\n              return Batman.developer.error(\"Collection route with name \" + name + \" already exists!\");\n            }\n          });\n          this.collectionRoute = route;\n        }\n      }\n      return true;\n    };\n\n    return RouteMap;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var __slice = [].slice;\n\n  Batman.RouteMapBuilder = (function() {\n\n    RouteMapBuilder.BUILDER_FUNCTIONS = ['resources', 'member', 'collection', 'route', 'root'];\n\n    RouteMapBuilder.ROUTES = {\n      index: {\n        cardinality: 'collection',\n        path: function(resource) {\n          return resource;\n        },\n        name: function(resource) {\n          return resource;\n        }\n      },\n      \"new\": {\n        cardinality: 'collection',\n        path: function(resource) {\n          return \"\" + resource + \"/new\";\n        },\n        name: function(resource) {\n          return \"\" + resource + \".new\";\n        }\n      },\n      show: {\n        cardinality: 'member',\n        path: function(resource) {\n          return \"\" + resource + \"/:id\";\n        },\n        name: function(resource) {\n          return resource;\n        }\n      },\n      edit: {\n        cardinality: 'member',\n        path: function(resource) {\n          return \"\" + resource + \"/:id/edit\";\n        },\n        name: function(resource) {\n          return \"\" + resource + \".edit\";\n        }\n      },\n      collection: {\n        cardinality: 'collection',\n        path: function(resource, name) {\n          return \"\" + resource + \"/\" + name;\n        },\n        name: function(resource, name) {\n          return \"\" + resource + \".\" + name;\n        }\n      },\n      member: {\n        cardinality: 'member',\n        path: function(resource, name) {\n          return \"\" + resource + \"/:id/\" + name;\n        },\n        name: function(resource, name) {\n          return \"\" + resource + \".\" + name;\n        }\n      }\n    };\n\n    function RouteMapBuilder(app, routeMap, parent, baseOptions) {\n      this.app = app;\n      this.routeMap = routeMap;\n      this.parent = parent;\n      this.baseOptions = baseOptions != null ? baseOptions : {};\n      if (this.parent) {\n        this.rootPath = this.parent._nestingPath();\n        this.rootName = this.parent._nestingName();\n      } else {\n        this.rootPath = '';\n        this.rootName = '';\n      }\n    }\n\n    RouteMapBuilder.prototype.resources = function() {\n      var action, actions, arg, args, as, callback, childBuilder, controller, included, k, options, path, resourceName, resourceNames, resourceRoot, routeOptions, routeTemplate, v, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;\n      args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      resourceNames = (function() {\n        var _i, _len, _results;\n        _results = [];\n        for (_i = 0, _len = args.length; _i < _len; _i++) {\n          arg = args[_i];\n          if (typeof arg === 'string') {\n            _results.push(arg);\n          }\n        }\n        return _results;\n      })();\n      if (typeof args[args.length - 1] === 'function') {\n        callback = args.pop();\n      }\n      if (typeof args[args.length - 1] === 'object') {\n        options = args.pop();\n      } else {\n        options = {};\n      }\n      actions = {\n        index: true,\n        \"new\": true,\n        show: true,\n        edit: true\n      };\n      if (options.except) {\n        _ref = options.except;\n        for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n          k = _ref[_i];\n          actions[k] = false;\n        }\n        delete options.except;\n      } else if (options.only) {\n        for (k in actions) {\n          v = actions[k];\n          actions[k] = false;\n        }\n        _ref1 = options.only;\n        for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n          k = _ref1[_j];\n          actions[k] = true;\n        }\n        delete options.only;\n      }\n      for (_k = 0, _len2 = resourceNames.length; _k < _len2; _k++) {\n        resourceName = resourceNames[_k];\n        resourceRoot = Batman.helpers.pluralize(resourceName);\n        controller = Batman.helpers.camelize(resourceRoot, true);\n        childBuilder = this._childBuilder({\n          controller: controller\n        });\n        if (callback != null) {\n          callback.call(childBuilder);\n        }\n        for (action in actions) {\n          included = actions[action];\n          if (!(included)) {\n            continue;\n          }\n          routeTemplate = this.constructor.ROUTES[action];\n          as = routeTemplate.name(resourceRoot);\n          path = routeTemplate.path(resourceRoot);\n          routeOptions = Batman.extend({\n            controller: controller,\n            action: action,\n            path: path,\n            as: as\n          }, options);\n          childBuilder[routeTemplate.cardinality](action, routeOptions);\n        }\n      }\n      return true;\n    };\n\n    RouteMapBuilder.prototype.member = function() {\n      return this._addRoutesWithCardinality.apply(this, ['member'].concat(__slice.call(arguments)));\n    };\n\n    RouteMapBuilder.prototype.collection = function() {\n      return this._addRoutesWithCardinality.apply(this, ['collection'].concat(__slice.call(arguments)));\n    };\n\n    RouteMapBuilder.prototype.root = function(signature, options) {\n      return this.route('/', signature, options);\n    };\n\n    RouteMapBuilder.prototype.route = function(path, signature, options, callback) {\n      if (!callback) {\n        if (typeof options === 'function') {\n          callback = options;\n          options = void 0;\n        } else if (typeof signature === 'function') {\n          callback = signature;\n          signature = void 0;\n        }\n      }\n      if (!options) {\n        if (typeof signature === 'string') {\n          options = {\n            signature: signature\n          };\n        } else {\n          options = signature;\n        }\n        options || (options = {});\n      } else {\n        if (signature) {\n          options.signature = signature;\n        }\n      }\n      if (callback) {\n        options.callback = callback;\n      }\n      options.as || (options.as = this._nameFromPath(path));\n      options.path = path;\n      return this._addRoute(options);\n    };\n\n    RouteMapBuilder.prototype._addRoutesWithCardinality = function() {\n      var cardinality, name, names, options, resourceRoot, routeOptions, routeTemplate, _i, _j, _len;\n      cardinality = arguments[0], names = 3 <= arguments.length ? __slice.call(arguments, 1, _i = arguments.length - 1) : (_i = 1, []), options = arguments[_i++];\n      if (typeof options === 'string') {\n        names.push(options);\n        options = {};\n      }\n      options = Batman.extend({}, this.baseOptions, options);\n      options[cardinality] = true;\n      routeTemplate = this.constructor.ROUTES[cardinality];\n      resourceRoot = Batman.helpers.underscore(options.controller);\n      for (_j = 0, _len = names.length; _j < _len; _j++) {\n        name = names[_j];\n        routeOptions = Batman.extend({\n          action: name\n        }, options);\n        if (routeOptions.path == null) {\n          routeOptions.path = routeTemplate.path(resourceRoot, name);\n        }\n        if (routeOptions.as == null) {\n          routeOptions.as = routeTemplate.name(resourceRoot, name);\n        }\n        this._addRoute(routeOptions);\n      }\n      return true;\n    };\n\n    RouteMapBuilder.prototype._addRoute = function(options) {\n      var klass, name, path, route;\n      if (options == null) {\n        options = {};\n      }\n      path = this.rootPath + options.path;\n      name = this.rootName + Batman.helpers.camelize(options.as, true);\n      delete options.as;\n      delete options.path;\n      klass = options.callback ? Batman.CallbackActionRoute : Batman.ControllerActionRoute;\n      options.app = this.app;\n      route = new klass(path, options);\n      return this.routeMap.addRoute(name, route);\n    };\n\n    RouteMapBuilder.prototype._nameFromPath = function(path) {\n      path = path.replace(Batman.Route.regexps.namedOrSplat, '').replace(/\\/+/g, '.').replace(/(^\\.)|(\\.$)/g, '');\n      return path;\n    };\n\n    RouteMapBuilder.prototype._nestingPath = function() {\n      var nestingParam, nestingSegment;\n      if (!this.parent) {\n        return \"\";\n      } else {\n        nestingParam = \":\" + Batman.helpers.singularize(this.baseOptions.controller) + \"Id\";\n        nestingSegment = Batman.helpers.underscore(this.baseOptions.controller);\n        return \"\" + (this.parent._nestingPath()) + nestingSegment + \"/\" + nestingParam + \"/\";\n      }\n    };\n\n    RouteMapBuilder.prototype._nestingName = function() {\n      if (!this.parent) {\n        return \"\";\n      } else {\n        return this.parent._nestingName() + this.baseOptions.controller + \".\";\n      }\n    };\n\n    RouteMapBuilder.prototype._childBuilder = function(baseOptions) {\n      if (baseOptions == null) {\n        baseOptions = {};\n      }\n      return new Batman.RouteMapBuilder(this.app, this.routeMap, this, baseOptions);\n    };\n\n    return RouteMapBuilder;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.App = (function(_super) {\n    var name, _fn, _i, _len, _ref, _this = this;\n\n    __extends(App, _super);\n\n    function App() {\n      return App.__super__.constructor.apply(this, arguments);\n    }\n\n    App.classAccessor('currentParams', {\n      get: function() {\n        return new Batman.Hash;\n      },\n      'final': true\n    });\n\n    App.classAccessor('paramsManager', {\n      get: function() {\n        var nav, params;\n        if (!(nav = this.get('navigator'))) {\n          return;\n        }\n        params = this.get('currentParams');\n        return params.replacer = new Batman.ParamsReplacer(nav, params);\n      },\n      'final': true\n    });\n\n    App.classAccessor('paramsPusher', {\n      get: function() {\n        var nav, params;\n        if (!(nav = this.get('navigator'))) {\n          return;\n        }\n        params = this.get('currentParams');\n        return params.pusher = new Batman.ParamsPusher(nav, params);\n      },\n      'final': true\n    });\n\n    App.classAccessor('routes', function() {\n      return new Batman.NamedRouteQuery(this.get('routeMap'));\n    });\n\n    App.classAccessor('routeMap', function() {\n      return new Batman.RouteMap;\n    });\n\n    App.classAccessor('routeMapBuilder', function() {\n      return new Batman.RouteMapBuilder(this, this.get('routeMap'));\n    });\n\n    App.classAccessor('dispatcher', function() {\n      return new Batman.Dispatcher(this, this.get('routeMap'));\n    });\n\n    App.classAccessor('controllers', function() {\n      return this.get('dispatcher.controllers');\n    });\n\n    App.classAccessor('_renderContext', function() {\n      return Batman.RenderContext.base.descend(this);\n    });\n\n    App.requirePath = '';\n\n    Batman.developer[\"do\"](function() {\n      var requireDeprecated;\n      requireDeprecated = \"Please use whatever means you'd like to load your code before calling App.run.\";\n      App.require = function() {\n        var base, name, names, path, _i, _len, _this = this;\n        path = arguments[0], names = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n        Batman.developer.deprecated(\"App.require\", requireDeprecated);\n        base = this.requirePath + path;\n        for (_i = 0, _len = names.length; _i < _len; _i++) {\n          name = names[_i];\n          this.prevent('run');\n          path = base + '/' + name + '.coffee';\n          new Batman.Request({\n            url: path,\n            type: 'html',\n            success: function(response) {\n              CoffeeScript[\"eval\"](response);\n              _this.allow('run');\n              if (!_this.isPrevented('run')) {\n                _this.fire('loaded');\n              }\n              if (_this.wantsToRun) {\n                return _this.run();\n              }\n            }\n          });\n        }\n        return this;\n      };\n      App.controller = function() {\n        var names;\n        names = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        Batman.developer.deprecated(\"App.controller\", requireDeprecated);\n        names = names.map(function(n) {\n          return n + '_controller';\n        });\n        return this.require.apply(this, ['controllers'].concat(__slice.call(names)));\n      };\n      App.model = function() {\n        Batman.developer.deprecated(\"App.model\", requireDeprecated);\n        return this.require.apply(this, ['models'].concat(__slice.call(arguments)));\n      };\n      return App.view = function() {\n        Batman.developer.deprecated(\"App.view\", requireDeprecated);\n        return this.require.apply(this, ['views'].concat(__slice.call(arguments)));\n      };\n    });\n\n    App.layout = void 0;\n\n    App.shouldAllowEvent = {};\n\n    _ref = Batman.RouteMapBuilder.BUILDER_FUNCTIONS;\n    _fn = function(name) {\n      return App[name] = function() {\n        var _ref1;\n        return (_ref1 = this.get('routeMapBuilder'))[name].apply(_ref1, arguments);\n      };\n    };\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      name = _ref[_i];\n      _fn(name);\n    }\n\n    App.event('ready').oneShot = true;\n\n    App.event('run').oneShot = true;\n\n    App.run = function() {\n      var layout, layoutClass, _this = this;\n      if (Batman.currentApp) {\n        if (Batman.currentApp === this) {\n          return;\n        }\n        Batman.currentApp.stop();\n      }\n      if (this.hasRun) {\n        return false;\n      }\n      if (this.isPrevented('run')) {\n        this.wantsToRun = true;\n        return false;\n      } else {\n        delete this.wantsToRun;\n      }\n      Batman.currentApp = this;\n      Batman.App.set('current', this);\n      if (this.get('dispatcher') == null) {\n        this.set('dispatcher', new Batman.Dispatcher(this, this.get('routeMap')));\n        this.set('controllers', this.get('dispatcher.controllers'));\n      }\n      if (this.get('navigator') == null) {\n        this.set('navigator', Batman.Navigator.forApp(this));\n        this.on('run', function() {\n          Batman.navigator = _this.get('navigator');\n          if (Object.keys(_this.get('dispatcher').routeMap).length > 0) {\n            return Batman.navigator.start();\n          }\n        });\n      }\n      this.observe('layout', function(layout) {\n        return layout != null ? layout.on('ready', function() {\n          return _this.fire('ready');\n        }) : void 0;\n      });\n      layout = this.get('layout');\n      if (layout) {\n        if (typeof layout === 'string') {\n          layoutClass = this[Batman.helpers.camelize(layout) + 'View'];\n        }\n      } else {\n        if (layout !== null) {\n          layoutClass = Batman.View;\n        }\n      }\n      if (layoutClass) {\n        layout = this.set('layout', new layoutClass({\n          context: this,\n          node: document\n        }));\n      }\n      this.hasRun = true;\n      this.fire('run');\n      return this;\n    };\n\n    App.event('ready').oneShot = true;\n\n    App.event('stop').oneShot = true;\n\n    App.stop = function() {\n      var _ref1;\n      if ((_ref1 = this.navigator) != null) {\n        _ref1.stop();\n      }\n      Batman.navigator = null;\n      this.hasRun = false;\n      this.fire('stop');\n      return this;\n    };\n\n    return App;\n\n  }).call(this, Batman.Object);\n\n}).call(this);\n\n(function() {\n\n  Batman.Association = (function() {\n\n    Association.prototype.associationType = '';\n\n    Association.prototype.isPolymorphic = false;\n\n    Association.prototype.defaultOptions = {\n      saveInline: true,\n      autoload: true,\n      nestUrl: false\n    };\n\n    function Association(model, label, options) {\n      var defaultOptions, encoder, getAccessor, self;\n      this.model = model;\n      this.label = label;\n      if (options == null) {\n        options = {};\n      }\n      defaultOptions = {\n        namespace: Batman.currentApp,\n        name: Batman.helpers.camelize(Batman.helpers.singularize(this.label))\n      };\n      this.options = Batman.extend(defaultOptions, this.defaultOptions, options);\n      if (this.options.nestUrl) {\n        if (!(this.model.urlNestsUnder != null)) {\n          Batman.developer.error(\"You must persist the the model \" + this.model.constructor.name + \" to use the url helpers on an association\");\n        }\n        this.model.urlNestsUnder(Batman.helpers.underscore(this.getRelatedModel().get('resourceName')));\n      }\n      if (this.options.extend != null) {\n        Batman.extend(this, this.options.extend);\n      }\n      encoder = {\n        encode: this.options.saveInline ? this.encoder() : false,\n        decode: this.decoder()\n      };\n      this.model.encode(this.label, encoder);\n      self = this;\n      getAccessor = function() {\n        return self.getAccessor.call(this, self, this.model, this.label);\n      };\n      this.model.accessor(this.label, {\n        get: getAccessor,\n        set: model.defaultAccessor.set,\n        unset: model.defaultAccessor.unset\n      });\n    }\n\n    Association.prototype.getRelatedModel = function() {\n      var className, relatedModel, scope;\n      scope = this.options.namespace || Batman.currentApp;\n      className = this.options.name;\n      relatedModel = scope != null ? scope[className] : void 0;\n      Batman.developer[\"do\"](function() {\n        if ((Batman.currentApp != null) && !relatedModel) {\n          return Batman.developer.warn(\"Related model \" + className + \" hasn't loaded yet.\");\n        }\n      });\n      return relatedModel;\n    };\n\n    Association.prototype.getFromAttributes = function(record) {\n      return record.get(\"attributes.\" + this.label);\n    };\n\n    Association.prototype.setIntoAttributes = function(record, value) {\n      return record.get('attributes').set(this.label, value);\n    };\n\n    Association.prototype.inverse = function() {\n      var inverse, relatedAssocs, _this = this;\n      if (relatedAssocs = this.getRelatedModel()._batman.get('associations')) {\n        if (this.options.inverseOf) {\n          return relatedAssocs.getByLabel(this.options.inverseOf);\n        }\n        inverse = null;\n        relatedAssocs.forEach(function(label, assoc) {\n          if (assoc.getRelatedModel() === _this.model) {\n            return inverse = assoc;\n          }\n        });\n        return inverse;\n      }\n    };\n\n    Association.prototype.reset = function() {\n      delete this.index;\n      return true;\n    };\n\n    return Association;\n\n  })();\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PluralAssociation = (function(_super) {\n\n    __extends(PluralAssociation, _super);\n\n    PluralAssociation.prototype.proxyClass = Batman.AssociationSet;\n\n    PluralAssociation.prototype.isSingular = false;\n\n    function PluralAssociation() {\n      PluralAssociation.__super__.constructor.apply(this, arguments);\n      this._resetSetHashes();\n    }\n\n    PluralAssociation.prototype.setForRecord = function(record) {\n      var childModelSetIndex, indexValue, _this = this;\n      indexValue = this.indexValueForRecord(record);\n      childModelSetIndex = this.setIndex();\n      Batman.Property.withoutTracking(function() {\n        return _this._setsByRecord.getOrSet(record, function() {\n          var existingValueSet, newSet;\n          if (indexValue != null) {\n            existingValueSet = _this._setsByValue.get(indexValue);\n            if (existingValueSet != null) {\n              return existingValueSet;\n            }\n          }\n          newSet = _this.proxyClassInstanceForKey(indexValue);\n          if (indexValue != null) {\n            _this._setsByValue.set(indexValue, newSet);\n          }\n          return newSet;\n        });\n      });\n      if (indexValue != null) {\n        return childModelSetIndex.get(indexValue);\n      } else {\n        return this._setsByRecord.get(record);\n      }\n    };\n\n    PluralAssociation.prototype.setForKey = Batman.Property.wrapTrackingPrevention(function(indexValue) {\n      var foundSet, _this = this;\n      foundSet = void 0;\n      this._setsByRecord.forEach(function(record, set) {\n        if (foundSet != null) {\n          return;\n        }\n        if (_this.indexValueForRecord(record) === indexValue) {\n          return foundSet = set;\n        }\n      });\n      if (foundSet != null) {\n        foundSet.foreignKeyValue = indexValue;\n        return foundSet;\n      }\n      return this._setsByValue.getOrSet(indexValue, function() {\n        return _this.proxyClassInstanceForKey(indexValue);\n      });\n    });\n\n    PluralAssociation.prototype.proxyClassInstanceForKey = function(indexValue) {\n      return new this.proxyClass(indexValue, this);\n    };\n\n    PluralAssociation.prototype.getAccessor = function(self, model, label) {\n      var relatedRecords, setInAttributes, _this = this;\n      if (!self.getRelatedModel()) {\n        return;\n      }\n      if (setInAttributes = self.getFromAttributes(this)) {\n        return setInAttributes;\n      } else {\n        relatedRecords = self.setForRecord(this);\n        self.setIntoAttributes(this, relatedRecords);\n        Batman.Property.withoutTracking(function() {\n          if (self.options.autoload && !_this.isNew() && !relatedRecords.loaded) {\n            return relatedRecords.load(function(error, records) {\n              if (error) {\n                throw error;\n              }\n            });\n          }\n        });\n        return relatedRecords;\n      }\n    };\n\n    PluralAssociation.prototype.parentSetIndex = function() {\n      this.parentIndex || (this.parentIndex = this.model.get('loaded').indexedByUnique(this.primaryKey));\n      return this.parentIndex;\n    };\n\n    PluralAssociation.prototype.setIndex = function() {\n      this.index || (this.index = new Batman.AssociationSetIndex(this, this[this.indexRelatedModelOn]));\n      return this.index;\n    };\n\n    PluralAssociation.prototype.indexValueForRecord = function(record) {\n      return record.get(this.primaryKey);\n    };\n\n    PluralAssociation.prototype.reset = function() {\n      PluralAssociation.__super__.reset.apply(this, arguments);\n      return this._resetSetHashes();\n    };\n\n    PluralAssociation.prototype._resetSetHashes = function() {\n      this._setsByRecord = new Batman.SimpleHash;\n      return this._setsByValue = new Batman.SimpleHash;\n    };\n\n    return PluralAssociation;\n\n  })(Batman.Association);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.HasManyAssociation = (function(_super) {\n\n    __extends(HasManyAssociation, _super);\n\n    HasManyAssociation.prototype.associationType = 'hasMany';\n\n    HasManyAssociation.prototype.indexRelatedModelOn = 'foreignKey';\n\n    function HasManyAssociation(model, label, options) {\n      if (options != null ? options.as : void 0) {\n        return (function(func, args, ctor) {\n          ctor.prototype = func.prototype;\n          var child = new ctor,\n            result = func.apply(child, args),\n            t = typeof result;\n          return t == \"object\" || t == \"function\" ? result || child : child;\n        })(Batman.PolymorphicHasManyAssociation, arguments, function() {});\n      }\n      HasManyAssociation.__super__.constructor.apply(this, arguments);\n      this.primaryKey = this.options.primaryKey || \"id\";\n      this.foreignKey = this.options.foreignKey || (\"\" + (Batman.helpers.underscore(model.get('resourceName'))) + \"_id\");\n    }\n\n    HasManyAssociation.prototype.apply = function(baseSaveError, base) {\n      var relations, set, _this = this;\n      if (!baseSaveError) {\n        if (relations = this.getFromAttributes(base)) {\n          relations.forEach(function(model) {\n            return model.set(_this.foreignKey, base.get(_this.primaryKey));\n          });\n        }\n        base.set(this.label, set = this.setForRecord(base));\n        if (base.lifecycle.get('state') === 'creating') {\n          return set.markAsLoaded();\n        }\n      }\n    };\n\n    HasManyAssociation.prototype.encoder = function() {\n      var association;\n      association = this;\n      return function(relationSet, _, __, record) {\n        var jsonArray;\n        if (relationSet != null) {\n          jsonArray = [];\n          relationSet.forEach(function(relation) {\n            var relationJSON;\n            relationJSON = relation.toJSON();\n            if (!association.inverse() || association.inverse().options.encodeForeignKey) {\n              relationJSON[association.foreignKey] = record.get(association.primaryKey);\n            }\n            return jsonArray.push(relationJSON);\n          });\n        }\n        return jsonArray;\n      };\n    };\n\n    HasManyAssociation.prototype.decoder = function() {\n      var association;\n      association = this;\n      return function(data, key, _, __, parentRecord) {\n        var existingRecord, existingRelations, jsonObject, newRelations, record, relatedModel, savedRecord, _i, _len;\n        if (relatedModel = association.getRelatedModel()) {\n          existingRelations = association.getFromAttributes(parentRecord) || association.setForRecord(parentRecord);\n          newRelations = existingRelations.filter(function(relation) {\n            return relation.isNew();\n          }).toArray();\n          for (_i = 0, _len = data.length; _i < _len; _i++) {\n            jsonObject = data[_i];\n            record = new relatedModel();\n            record._withoutDirtyTracking(function() {\n              return this.fromJSON(jsonObject);\n            });\n            existingRecord = relatedModel.get('loaded').indexedByUnique('id').get(record.get('id'));\n            if (existingRecord != null) {\n              existingRecord._withoutDirtyTracking(function() {\n                return this.fromJSON(jsonObject);\n              });\n              record = existingRecord;\n            } else {\n              if (newRelations.length > 0) {\n                savedRecord = newRelations.shift();\n                savedRecord._withoutDirtyTracking(function() {\n                  return this.fromJSON(jsonObject);\n                });\n                record = savedRecord;\n              }\n            }\n            record = relatedModel._mapIdentity(record);\n            existingRelations.add(record);\n            if (association.options.inverseOf) {\n              record.set(association.options.inverseOf, parentRecord);\n            }\n          }\n          existingRelations.markAsLoaded();\n        } else {\n          Batman.developer.error(\"Can't decode model \" + association.options.name + \" because it hasn't been loaded yet!\");\n        }\n        return existingRelations;\n      };\n    };\n\n    return HasManyAssociation;\n\n  })(Batman.PluralAssociation);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PolymorphicHasManyAssociation = (function(_super) {\n\n    __extends(PolymorphicHasManyAssociation, _super);\n\n    PolymorphicHasManyAssociation.prototype.proxyClass = Batman.PolymorphicAssociationSet;\n\n    PolymorphicHasManyAssociation.prototype.isPolymorphic = true;\n\n    function PolymorphicHasManyAssociation(model, label, options) {\n      options.inverseOf = this.foreignLabel = options.as;\n      delete options.as;\n      options.foreignKey || (options.foreignKey = \"\" + this.foreignLabel + \"_id\");\n      PolymorphicHasManyAssociation.__super__.constructor.call(this, model, label, options);\n      this.foreignTypeKey = options.foreignTypeKey || (\"\" + this.foreignLabel + \"_type\");\n      this.model.encode(this.foreignTypeKey);\n    }\n\n    PolymorphicHasManyAssociation.prototype.apply = function(baseSaveError, base) {\n      var relations, _this = this;\n      if (!baseSaveError) {\n        if (relations = this.getFromAttributes(base)) {\n          PolymorphicHasManyAssociation.__super__.apply.apply(this, arguments);\n          relations.forEach(function(model) {\n            return model.set(_this.foreignTypeKey, _this.modelType());\n          });\n        }\n      }\n      return true;\n    };\n\n    PolymorphicHasManyAssociation.prototype.proxyClassInstanceForKey = function(indexValue) {\n      return new this.proxyClass(indexValue, this.modelType(), this);\n    };\n\n    PolymorphicHasManyAssociation.prototype.getRelatedModelForType = function(type) {\n      var relatedModel, scope;\n      scope = this.options.namespace || Batman.currentApp;\n      if (type) {\n        relatedModel = scope != null ? scope[type] : void 0;\n        relatedModel || (relatedModel = scope != null ? scope[Batman.helpers.camelize(type)] : void 0);\n      } else {\n        relatedModel = this.getRelatedModel();\n      }\n      Batman.developer[\"do\"](function() {\n        if ((Batman.currentApp != null) && !relatedModel) {\n          return Batman.developer.warn(\"Related model \" + type + \" for polymorphic association not found.\");\n        }\n      });\n      return relatedModel;\n    };\n\n    PolymorphicHasManyAssociation.prototype.modelType = function() {\n      return this.model.get('resourceName');\n    };\n\n    PolymorphicHasManyAssociation.prototype.setIndex = function() {\n      this.typeIndex || (this.typeIndex = new Batman.PolymorphicAssociationSetIndex(this, this.modelType(), this[this.indexRelatedModelOn]));\n      return this.typeIndex;\n    };\n\n    PolymorphicHasManyAssociation.prototype.encoder = function() {\n      var association;\n      association = this;\n      return function(relationSet, _, __, record) {\n        var jsonArray;\n        if (relationSet != null) {\n          jsonArray = [];\n          relationSet.forEach(function(relation) {\n            var relationJSON;\n            relationJSON = relation.toJSON();\n            relationJSON[association.foreignKey] = record.get(association.primaryKey);\n            relationJSON[association.foreignTypeKey] = association.modelType();\n            return jsonArray.push(relationJSON);\n          });\n        }\n        return jsonArray;\n      };\n    };\n\n    PolymorphicHasManyAssociation.prototype.decoder = function() {\n      var association;\n      association = this;\n      return function(data, key, _, __, parentRecord) {\n        var existingRecord, existingRelations, jsonObject, newRelations, record, relatedModel, savedRecord, subType, type, _i, _len;\n        if (relatedModel = association.getRelatedModel()) {\n          existingRelations = association.getFromAttributes(parentRecord) || association.setForRecord(parentRecord);\n          newRelations = existingRelations.filter(function(relation) {\n            return relation.isNew();\n          }).toArray();\n          for (_i = 0, _len = data.length; _i < _len; _i++) {\n            jsonObject = data[_i];\n            type = jsonObject[association.options.foreignTypeKey];\n            subType = association.getRelatedModelForType(type);\n            record = new subType();\n            record._withoutDirtyTracking(function() {\n              return this.fromJSON(jsonObject);\n            });\n            existingRecord = relatedModel.get('loaded').indexedByUnique('id').get(record.get('id'));\n            if (existingRecord != null) {\n              existingRecord._withoutDirtyTracking(function() {\n                return this.fromJSON(jsonObject);\n              });\n              record = existingRecord;\n            } else {\n              if (newRelations.length > 0) {\n                savedRecord = newRelations.shift();\n                savedRecord._withoutDirtyTracking(function() {\n                  return this.fromJSON(jsonObject);\n                });\n                record = savedRecord;\n              }\n            }\n            record = relatedModel._mapIdentity(record);\n            existingRelations.add(record);\n            if (association.options.inverseOf) {\n              record.set(association.options.inverseOf, parentRecord);\n            }\n          }\n          existingRelations.markAsLoaded();\n        } else {\n          Batman.developer.error(\"Can't decode model \" + association.options.name + \" because it hasn't been loaded yet!\");\n        }\n        return existingRelations;\n      };\n    };\n\n    return PolymorphicHasManyAssociation;\n\n  })(Batman.HasManyAssociation);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.SingularAssociation = (function(_super) {\n\n    __extends(SingularAssociation, _super);\n\n    function SingularAssociation() {\n      return SingularAssociation.__super__.constructor.apply(this, arguments);\n    }\n\n    SingularAssociation.prototype.isSingular = true;\n\n    SingularAssociation.prototype.getAccessor = function(self, model, label) {\n      var parent, proxy, record, recordInAttributes, _ref;\n      if (recordInAttributes = self.getFromAttributes(this)) {\n        return recordInAttributes;\n      }\n      if (self.getRelatedModel()) {\n        proxy = this.associationProxy(self);\n        record = false;\n        parent = this;\n        if ((_ref = proxy._loadSetter) == null) {\n          proxy._loadSetter = proxy.once('loaded', function(child) {\n            return parent._withoutDirtyTracking(function() {\n              return this.set(self.label, child);\n            });\n          });\n        }\n        if (!Batman.Property.withoutTracking(function() {\n          return proxy.get('loaded');\n        })) {\n          if (self.options.autoload) {\n            Batman.Property.withoutTracking(function() {\n              return proxy.load();\n            });\n          } else {\n            record = proxy.loadFromLocal();\n          }\n        }\n        return record || proxy;\n      }\n    };\n\n    SingularAssociation.prototype.setIndex = function() {\n      this.index || (this.index = new Batman.UniqueAssociationSetIndex(this, this[this.indexRelatedModelOn]));\n      return this.index;\n    };\n\n    return SingularAssociation;\n\n  })(Batman.Association);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.HasOneAssociation = (function(_super) {\n\n    __extends(HasOneAssociation, _super);\n\n    HasOneAssociation.prototype.associationType = 'hasOne';\n\n    HasOneAssociation.prototype.proxyClass = Batman.HasOneProxy;\n\n    HasOneAssociation.prototype.indexRelatedModelOn = 'foreignKey';\n\n    function HasOneAssociation() {\n      HasOneAssociation.__super__.constructor.apply(this, arguments);\n      this.primaryKey = this.options.primaryKey || \"id\";\n      this.foreignKey = this.options.foreignKey || (\"\" + (Batman.helpers.underscore(this.model.get('resourceName'))) + \"_id\");\n    }\n\n    HasOneAssociation.prototype.apply = function(baseSaveError, base) {\n      var relation;\n      if (relation = this.getFromAttributes(base)) {\n        return relation.set(this.foreignKey, base.get(this.primaryKey));\n      }\n    };\n\n    HasOneAssociation.prototype.encoder = function() {\n      var association;\n      association = this;\n      return function(val, key, object, record) {\n        var json;\n        if (!association.options.saveInline) {\n          return;\n        }\n        if (json = val.toJSON()) {\n          json[association.foreignKey] = record.get(association.primaryKey);\n        }\n        return json;\n      };\n    };\n\n    HasOneAssociation.prototype.decoder = function() {\n      var association;\n      association = this;\n      return function(data, _, __, ___, parentRecord) {\n        var record, relatedModel;\n        if (!data) {\n          return;\n        }\n        relatedModel = association.getRelatedModel();\n        record = relatedModel.createFromJSON(data);\n        if (association.options.inverseOf) {\n          record.set(association.options.inverseOf, parentRecord);\n        }\n        return record;\n      };\n    };\n\n    return HasOneAssociation;\n\n  })(Batman.SingularAssociation);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.BelongsToAssociation = (function(_super) {\n\n    __extends(BelongsToAssociation, _super);\n\n    BelongsToAssociation.prototype.associationType = 'belongsTo';\n\n    BelongsToAssociation.prototype.proxyClass = Batman.BelongsToProxy;\n\n    BelongsToAssociation.prototype.indexRelatedModelOn = 'primaryKey';\n\n    BelongsToAssociation.prototype.defaultOptions = {\n      saveInline: false,\n      autoload: true,\n      encodeForeignKey: true\n    };\n\n    function BelongsToAssociation(model, label, options) {\n      if (options != null ? options.polymorphic : void 0) {\n        delete options.polymorphic;\n        return (function(func, args, ctor) {\n          ctor.prototype = func.prototype;\n          var child = new ctor,\n            result = func.apply(child, args),\n            t = typeof result;\n          return t == \"object\" || t == \"function\" ? result || child : child;\n        })(Batman.PolymorphicBelongsToAssociation, arguments, function() {});\n      }\n      BelongsToAssociation.__super__.constructor.apply(this, arguments);\n      this.foreignKey = this.options.foreignKey || (\"\" + this.label + \"_id\");\n      this.primaryKey = this.options.primaryKey || \"id\";\n      if (this.options.encodeForeignKey) {\n        this.model.encode(this.foreignKey);\n      }\n    }\n\n    BelongsToAssociation.prototype.encoder = function() {\n      return function(val) {\n        return val.toJSON();\n      };\n    };\n\n    BelongsToAssociation.prototype.decoder = function() {\n      var association;\n      association = this;\n      return function(data, _, __, ___, childRecord) {\n        var inverse, record, relatedModel;\n        relatedModel = association.getRelatedModel();\n        record = relatedModel.createFromJSON(data);\n        if (association.options.inverseOf) {\n          if (inverse = association.inverse()) {\n            if (inverse instanceof Batman.HasManyAssociation) {\n              childRecord.set(association.foreignKey, record.get(association.primaryKey));\n            } else {\n              record.set(inverse.label, childRecord);\n            }\n          }\n        }\n        childRecord.set(association.label, record);\n        return record;\n      };\n    };\n\n    BelongsToAssociation.prototype.apply = function(base) {\n      var foreignValue, model;\n      if (model = base.get(this.label)) {\n        foreignValue = model.get(this.primaryKey);\n        if (foreignValue !== void 0) {\n          return base.set(this.foreignKey, foreignValue);\n        }\n      }\n    };\n\n    return BelongsToAssociation;\n\n  })(Batman.SingularAssociation);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PolymorphicBelongsToAssociation = (function(_super) {\n\n    __extends(PolymorphicBelongsToAssociation, _super);\n\n    PolymorphicBelongsToAssociation.prototype.isPolymorphic = true;\n\n    PolymorphicBelongsToAssociation.prototype.proxyClass = Batman.PolymorphicBelongsToProxy;\n\n    PolymorphicBelongsToAssociation.prototype.defaultOptions = Batman.mixin({}, Batman.BelongsToAssociation.prototype.defaultOptions, {\n      encodeForeignTypeKey: true\n    });\n\n    function PolymorphicBelongsToAssociation() {\n      PolymorphicBelongsToAssociation.__super__.constructor.apply(this, arguments);\n      this.foreignTypeKey = this.options.foreignTypeKey || (\"\" + this.label + \"_type\");\n      if (this.options.encodeForeignTypeKey) {\n        this.model.encode(this.foreignTypeKey);\n      }\n      this.typeIndicies = {};\n    }\n\n    PolymorphicBelongsToAssociation.prototype.getRelatedModel = false;\n\n    PolymorphicBelongsToAssociation.prototype.setIndex = false;\n\n    PolymorphicBelongsToAssociation.prototype.inverse = false;\n\n    PolymorphicBelongsToAssociation.prototype.apply = function(base) {\n      var foreignTypeValue, instanceOrProxy;\n      PolymorphicBelongsToAssociation.__super__.apply.apply(this, arguments);\n      if (instanceOrProxy = base.get(this.label)) {\n        foreignTypeValue = instanceOrProxy instanceof Batman.PolymorphicBelongsToProxy ? instanceOrProxy.get('foreignTypeValue') : instanceOrProxy.constructor.get('resourceName');\n        return base.set(this.foreignTypeKey, foreignTypeValue);\n      }\n    };\n\n    PolymorphicBelongsToAssociation.prototype.getAccessor = function(self, model, label) {\n      var proxy, recordInAttributes;\n      if (recordInAttributes = self.getFromAttributes(this)) {\n        return recordInAttributes;\n      }\n      if (self.getRelatedModelForType(this.get(self.foreignTypeKey))) {\n        proxy = this.associationProxy(self);\n        Batman.Property.withoutTracking(function() {\n          if (!proxy.get('loaded') && self.options.autoload) {\n            return proxy.load();\n          }\n        });\n        return proxy;\n      }\n    };\n\n    PolymorphicBelongsToAssociation.prototype.url = function(recordOptions) {\n      var ending, helper, id, inverse, root, type, _ref, _ref1;\n      type = (_ref = recordOptions.data) != null ? _ref[this.foreignTypeKey] : void 0;\n      if (type && (inverse = this.inverseForType(type))) {\n        root = Batman.helpers.pluralize(type).toLowerCase();\n        id = (_ref1 = recordOptions.data) != null ? _ref1[this.foreignKey] : void 0;\n        helper = inverse.isSingular ? \"singularize\" : \"pluralize\";\n        ending = Batman.helpers[helper](inverse.label);\n        return \"/\" + root + \"/\" + id + \"/\" + ending;\n      }\n    };\n\n    PolymorphicBelongsToAssociation.prototype.getRelatedModelForType = function(type) {\n      var relatedModel, scope;\n      scope = this.options.namespace || Batman.currentApp;\n      if (type) {\n        relatedModel = scope != null ? scope[type] : void 0;\n        relatedModel || (relatedModel = scope != null ? scope[Batman.helpers.camelize(type)] : void 0);\n      }\n      Batman.developer[\"do\"](function() {\n        if ((Batman.currentApp != null) && !relatedModel) {\n          return Batman.developer.warn(\"Related model \" + type + \" for polymorphic association not found.\");\n        }\n      });\n      return relatedModel;\n    };\n\n    PolymorphicBelongsToAssociation.prototype.setIndexForType = function(type) {\n      var _base;\n      (_base = this.typeIndicies)[type] || (_base[type] = new Batman.PolymorphicUniqueAssociationSetIndex(this, type, this.primaryKey));\n      return this.typeIndicies[type];\n    };\n\n    PolymorphicBelongsToAssociation.prototype.inverseForType = function(type) {\n      var inverse, relatedAssocs, _ref, _this = this;\n      if (relatedAssocs = (_ref = this.getRelatedModelForType(type)) != null ? _ref._batman.get('associations') : void 0) {\n        if (this.options.inverseOf) {\n          return relatedAssocs.getByLabel(this.options.inverseOf);\n        }\n        inverse = null;\n        relatedAssocs.forEach(function(label, assoc) {\n          if (assoc.getRelatedModel() === _this.model) {\n            return inverse = assoc;\n          }\n        });\n        return inverse;\n      }\n    };\n\n    PolymorphicBelongsToAssociation.prototype.decoder = function() {\n      var association;\n      association = this;\n      return function(data, key, response, ___, childRecord) {\n        var foreignTypeValue, inverse, record, relatedModel;\n        foreignTypeValue = response[association.foreignTypeKey] || childRecord.get(association.foreignTypeKey);\n        relatedModel = association.getRelatedModelForType(foreignTypeValue);\n        record = relatedModel.createFromJSON(data);\n        if (association.options.inverseOf) {\n          if (inverse = association.inverseForType(foreignTypeValue)) {\n            if (inverse instanceof Batman.PolymorphicHasManyAssociation) {\n              childRecord.set(association.foreignKey, record.get(association.primaryKey));\n              childRecord.set(association.foreignTypeKey, foreignTypeValue);\n            } else {\n              record.set(inverse.label, childRecord);\n            }\n          }\n        }\n        childRecord.set(association.label, record);\n        return record;\n      };\n    };\n\n    return PolymorphicBelongsToAssociation;\n\n  })(Batman.BelongsToAssociation);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.Validator = (function(_super) {\n\n    __extends(Validator, _super);\n\n    Validator.triggers = function() {\n      var triggers;\n      triggers = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      if (this._triggers != null) {\n        return this._triggers.concat(triggers);\n      } else {\n        return this._triggers = triggers;\n      }\n    };\n\n    Validator.options = function() {\n      var options;\n      options = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      if (this._options != null) {\n        return this._options.concat(options);\n      } else {\n        return this._options = options;\n      }\n    };\n\n    Validator.matches = function(options) {\n      var key, results, shouldReturn, value, _ref, _ref1;\n      results = {};\n      shouldReturn = false;\n      for (key in options) {\n        value = options[key];\n        if (~ ((_ref = this._options) != null ? _ref.indexOf(key) : void 0)) {\n          results[key] = value;\n        }\n        if (~ ((_ref1 = this._triggers) != null ? _ref1.indexOf(key) : void 0)) {\n          results[key] = value;\n          shouldReturn = true;\n        }\n      }\n      if (shouldReturn) {\n        return results;\n      }\n    };\n\n    function Validator() {\n      var mixins, options;\n      options = arguments[0], mixins = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n      this.options = options;\n      Validator.__super__.constructor.apply(this, mixins);\n    }\n\n    Validator.prototype.validate = function(record) {\n      return Batman.developer.error(\"You must override validate in Batman.Validator subclasses.\");\n    };\n\n    Validator.prototype.format = function(key, messageKey, interpolations) {\n      return Batman.t(\"errors.messages.\" + messageKey, interpolations);\n    };\n\n    Validator.prototype.handleBlank = function(value) {\n      if (this.options.allowBlank && !Batman.PresenceValidator.prototype.isPresent(value)) {\n        return true;\n      }\n    };\n\n    return Validator;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n\n  Batman.Validators = [];\n\n  Batman.extend(Batman.translate.messages, {\n    errors: {\n      format: \"%{attribute} %{message}\",\n      messages: {\n        too_short: \"must be at least %{count} characters\",\n        too_long: \"must be less than %{count} characters\",\n        wrong_length: \"must be %{count} characters\",\n        blank: \"can't be blank\",\n        not_numeric: \"must be a number\",\n        greater_than: \"must be greater than %{count}\",\n        greater_than_or_equal_to: \"must be greater than or equal to %{count}\",\n        equal_to: \"must be equal to %{count}\",\n        less_than: \"must be less than %{count}\",\n        less_than_or_equal_to: \"must be less than or equal to %{count}\",\n        not_matching: \"is not valid\",\n        invalid_association: \"is not valid\"\n      }\n    }\n  });\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.RegExpValidator = (function(_super) {\n\n    __extends(RegExpValidator, _super);\n\n    RegExpValidator.triggers('regexp', 'pattern');\n\n    RegExpValidator.options('allowBlank');\n\n    function RegExpValidator(options) {\n      var _ref;\n      this.regexp = (_ref = options.regexp) != null ? _ref : options.pattern;\n      RegExpValidator.__super__.constructor.apply(this, arguments);\n    }\n\n    RegExpValidator.prototype.validateEach = function(errors, record, key, callback) {\n      var value;\n      value = record.get(key);\n      if (this.handleBlank(value)) {\n        return callback();\n      }\n      if (!(value != null) || value === '' || !this.regexp.test(value)) {\n        errors.add(key, this.format(key, 'not_matching'));\n      }\n      return callback();\n    };\n\n    return RegExpValidator;\n\n  })(Batman.Validator);\n\n  Batman.Validators.push(Batman.RegExpValidator);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.PresenceValidator = (function(_super) {\n\n    __extends(PresenceValidator, _super);\n\n    function PresenceValidator() {\n      return PresenceValidator.__super__.constructor.apply(this, arguments);\n    }\n\n    PresenceValidator.triggers('presence');\n\n    PresenceValidator.prototype.validateEach = function(errors, record, key, callback) {\n      var value;\n      value = record.get(key);\n      if (!this.isPresent(value)) {\n        errors.add(key, this.format(key, 'blank'));\n      }\n      return callback();\n    };\n\n    PresenceValidator.prototype.isPresent = function(value) {\n      return (value != null) && value !== '';\n    };\n\n    return PresenceValidator;\n\n  })(Batman.Validator);\n\n  Batman.Validators.push(Batman.PresenceValidator);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.NumericValidator = (function(_super) {\n\n    __extends(NumericValidator, _super);\n\n    function NumericValidator() {\n      return NumericValidator.__super__.constructor.apply(this, arguments);\n    }\n\n    NumericValidator.triggers('numeric', 'greaterThan', 'greaterThanOrEqualTo', 'equalTo', 'lessThan', 'lessThanOrEqualTo');\n\n    NumericValidator.options('allowBlank');\n\n    NumericValidator.prototype.validateEach = function(errors, record, key, callback) {\n      var options, value;\n      options = this.options;\n      value = record.get(key);\n      if (this.handleBlank(value)) {\n        return callback();\n      }\n      if (!(value != null) || !(this.isNumeric(value) || this.canCoerceToNumeric(value))) {\n        errors.add(key, this.format(key, 'not_numeric'));\n      } else {\n        if (options.greaterThan && value <= options.greaterThan) {\n          errors.add(key, this.format(key, 'greater_than', {\n            count: options.greaterThan\n          }));\n        }\n        if (options.greaterThanOrEqualTo && value < options.greaterThanOrEqualTo) {\n          errors.add(key, this.format(key, 'greater_than_or_equal_to', {\n            count: options.greaterThanOrEqualTo\n          }));\n        }\n        if (options.equalTo && value !== options.equalTo) {\n          errors.add(key, this.format(key, 'equal_to', {\n            count: options.equalTo\n          }));\n        }\n        if (options.lessThan && value >= options.lessThan) {\n          errors.add(key, this.format(key, 'less_than', {\n            count: options.lessThan\n          }));\n        }\n        if (options.lessThanOrEqualTo && value > options.lessThanOrEqualTo) {\n          errors.add(key, this.format(key, 'less_than_or_equal_to', {\n            count: options.lessThanOrEqualTo\n          }));\n        }\n      }\n      return callback();\n    };\n\n    NumericValidator.prototype.isNumeric = function(value) {\n      return !isNaN(parseFloat(value)) && isFinite(value);\n    };\n\n    NumericValidator.prototype.canCoerceToNumeric = function(value) {\n      return (value - 0) == value && value.length > 0;\n    };\n\n    return NumericValidator;\n\n  })(Batman.Validator);\n\n  Batman.Validators.push(Batman.NumericValidator);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.LengthValidator = (function(_super) {\n\n    __extends(LengthValidator, _super);\n\n    LengthValidator.triggers('minLength', 'maxLength', 'length', 'lengthWithin', 'lengthIn');\n\n    LengthValidator.options('allowBlank');\n\n    function LengthValidator(options) {\n      var range;\n      if (range = options.lengthIn || options.lengthWithin) {\n        options.minLength = range[0];\n        options.maxLength = range[1] || -1;\n        delete options.lengthWithin;\n        delete options.lengthIn;\n      }\n      LengthValidator.__super__.constructor.apply(this, arguments);\n    }\n\n    LengthValidator.prototype.validateEach = function(errors, record, key, callback) {\n      var options, value;\n      options = this.options;\n      value = record.get(key);\n      if (value !== '' && this.handleBlank(value)) {\n        return callback();\n      }\n      if (value == null) {\n        value = [];\n      }\n      if (options.minLength && value.length < options.minLength) {\n        errors.add(key, this.format(key, 'too_short', {\n          count: options.minLength\n        }));\n      }\n      if (options.maxLength && value.length > options.maxLength) {\n        errors.add(key, this.format(key, 'too_long', {\n          count: options.maxLength\n        }));\n      }\n      if (options.length && value.length !== options.length) {\n        errors.add(key, this.format(key, 'wrong_length', {\n          count: options.length\n        }));\n      }\n      return callback();\n    };\n\n    return LengthValidator;\n\n  })(Batman.Validator);\n\n  Batman.Validators.push(Batman.LengthValidator);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.AssociatedValidator = (function(_super) {\n\n    __extends(AssociatedValidator, _super);\n\n    function AssociatedValidator() {\n      return AssociatedValidator.__super__.constructor.apply(this, arguments);\n    }\n\n    AssociatedValidator.triggers('associated');\n\n    AssociatedValidator.prototype.validateEach = function(errors, record, key, callback) {\n      var childFinished, count, value, _this = this;\n      value = record.get(key);\n      if (value != null) {\n        if (value instanceof Batman.AssociationProxy) {\n          value = typeof value.get === \"function\" ? value.get('target') : void 0;\n        }\n        count = 1;\n        childFinished = function(err, childErrors) {\n          if (childErrors.length > 0) {\n            errors.add(key, _this.format(key, 'invalid_association'));\n          }\n          if (--count === 0) {\n            return callback();\n          }\n        };\n        if ((value != null ? value.forEach : void 0) != null) {\n          value.forEach(function(record) {\n            count += 1;\n            return record.validate(childFinished);\n          });\n        } else if ((value != null ? value.validate : void 0) != null) {\n          count += 1;\n          value.validate(childFinished);\n        }\n        return childFinished(null, []);\n      } else {\n        return callback();\n      }\n    };\n\n    return AssociatedValidator;\n\n  })(Batman.Validator);\n\n  Batman.Validators.push(Batman.AssociatedValidator);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.ControllerActionFrame = (function(_super) {\n\n    __extends(ControllerActionFrame, _super);\n\n    ControllerActionFrame.prototype.operationOccurred = false;\n\n    ControllerActionFrame.prototype.remainingOperations = 0;\n\n    ControllerActionFrame.prototype.event('complete').oneShot = true;\n\n    function ControllerActionFrame(options, onComplete) {\n      ControllerActionFrame.__super__.constructor.call(this, options);\n      this.once('complete', onComplete);\n    }\n\n    ControllerActionFrame.prototype.startOperation = function(options) {\n      if (options == null) {\n        options = {};\n      }\n      if (!options.internal) {\n        this.operationOccurred = true;\n      }\n      this._changeOperationsCounter(1);\n      return true;\n    };\n\n    ControllerActionFrame.prototype.finishOperation = function() {\n      this._changeOperationsCounter(-1);\n      return true;\n    };\n\n    ControllerActionFrame.prototype.startAndFinishOperation = function(options) {\n      this.startOperation(options);\n      this.finishOperation(options);\n      return true;\n    };\n\n    ControllerActionFrame.prototype._changeOperationsCounter = function(delta) {\n      var _ref;\n      this.remainingOperations += delta;\n      if (this.remainingOperations === 0) {\n        this.fire('complete');\n      }\n      if ((_ref = this.parentFrame) != null) {\n        _ref._changeOperationsCounter(delta);\n      }\n    };\n\n    return ControllerActionFrame;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.DOM.InsertionBinding = (function(_super) {\n\n    __extends(InsertionBinding, _super);\n\n    InsertionBinding.prototype.isTwoWay = false;\n\n    InsertionBinding.prototype.bindImmediately = false;\n\n    InsertionBinding.prototype.onlyObserve = Batman.BindingDefinitionOnlyObserve.Data;\n\n    function InsertionBinding(definition) {\n      var _this = this;\n      this.invert = definition.invert;\n      this.placeholderNode = document.createComment(\"detached node \" + (this.get('_batmanID')));\n      InsertionBinding.__super__.constructor.apply(this, arguments);\n      Batman.DOM.onParseExit(this.node, function() {\n        _this.bind();\n        if (_this.placeholderNode != null) {\n          return Batman.DOM.trackBinding(_this, _this.placeholderNode);\n        }\n      });\n    }\n\n    InsertionBinding.prototype.dataChange = function(value) {\n      var parentNode;\n      parentNode = this.placeholderNode.parentNode || this.node.parentNode;\n      if ( !! value === !this.invert) {\n        if (!(this.node.parentNode != null)) {\n          Batman.DOM.insertBefore(parentNode, this.node, this.placeholderNode);\n          return parentNode.removeChild(this.placeholderNode);\n        }\n      } else {\n        if (this.node.parentNode != null) {\n          parentNode.insertBefore(this.placeholderNode, this.node);\n          return Batman.DOM.removeNode(this.node);\n        }\n      }\n    };\n\n    InsertionBinding.prototype.die = function() {\n      var filteredValue, node, placeholderNode;\n      if (this.dead) {\n        return;\n      }\n      node = this.node, placeholderNode = this.placeholderNode;\n      filteredValue = this.get('filteredValue');\n      InsertionBinding.__super__.die.apply(this, arguments);\n      if ( !! filteredValue === !this.invert) {\n        return Batman.DOM.destroyNode(placeholderNode);\n      } else {\n        return Batman.DOM.destroyNode(node);\n      }\n    };\n\n    return InsertionBinding;\n\n  })(Batman.DOM.AbstractBinding);\n\n}).call(this);\n\n(function() {\n  var isEmptyDataObject;\n\n  isEmptyDataObject = function(obj) {\n    var name;\n    for (name in obj) {\n      return false;\n    }\n    return true;\n  };\n\n  Batman.extend(Batman, {\n    cache: {},\n    uuid: 0,\n    expando: \"batman\" + Math.random().toString().replace(/\\D/g, ''),\n    canDeleteExpando: (function() {\n      var div;\n      try {\n        div = document.createElement('div');\n        return delete div.test;\n      } catch (e) {\n        return Batman.canDeleteExpando = false;\n      }\n    })(),\n    noData: {\n      \"embed\": true,\n      \"object\": \"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\",\n      \"applet\": true\n    },\n    hasData: function(elem) {\n      elem = (elem.nodeType ? Batman.cache[elem[Batman.expando]] : elem[Batman.expando]);\n      return !!elem && !isEmptyDataObject(elem);\n    },\n    data: function(elem, name, data, pvt) {\n      var cache, getByName, id, internalKey, ret, thisCache;\n      if (!Batman.acceptData(elem)) {\n        return;\n      }\n      internalKey = Batman.expando;\n      getByName = typeof name === \"string\";\n      cache = Batman.cache;\n      id = elem[Batman.expando];\n      if ((!id || (pvt && id && (cache[id] && !cache[id][internalKey]))) && getByName && data === void 0) {\n        return;\n      }\n      if (!id) {\n        if (elem.nodeType !== 3) {\n          elem[Batman.expando] = id = ++Batman.uuid;\n        } else {\n          id = Batman.expando;\n        }\n      }\n      if (!cache[id]) {\n        cache[id] = {};\n      }\n      if (typeof name === \"object\" || typeof name === \"function\") {\n        if (pvt) {\n          cache[id][internalKey] = Batman.extend(cache[id][internalKey], name);\n        } else {\n          cache[id] = Batman.extend(cache[id], name);\n        }\n      }\n      thisCache = cache[id];\n      if (pvt) {\n        thisCache[internalKey] || (thisCache[internalKey] = {});\n        thisCache = thisCache[internalKey];\n      }\n      if (data !== void 0) {\n        thisCache[name] = data;\n      }\n      if (getByName) {\n        ret = thisCache[name];\n      } else {\n        ret = thisCache;\n      }\n      return ret;\n    },\n    removeData: function(elem, name, pvt) {\n      var cache, id, internalCache, internalKey, isNode, thisCache;\n      if (!Batman.acceptData(elem)) {\n        return;\n      }\n      internalKey = Batman.expando;\n      isNode = elem.nodeType;\n      cache = Batman.cache;\n      id = elem[Batman.expando];\n      if (!cache[id]) {\n        return;\n      }\n      if (name) {\n        thisCache = pvt ? cache[id][internalKey] : cache[id];\n        if (thisCache) {\n          delete thisCache[name];\n          if (!isEmptyDataObject(thisCache)) {\n            return;\n          }\n        }\n      }\n      if (pvt) {\n        delete cache[id][internalKey];\n        if (!isEmptyDataObject(cache[id])) {\n          return;\n        }\n      }\n      internalCache = cache[id][internalKey];\n      if (Batman.canDeleteExpando || !cache.setInterval) {\n        delete cache[id];\n      } else {\n        cache[id] = null;\n      }\n      if (internalCache) {\n        cache[id] = {};\n        return cache[id][internalKey] = internalCache;\n      } else {\n        if (Batman.canDeleteExpando) {\n          return delete elem[Batman.expando];\n        } else if (elem.removeAttribute) {\n          return elem.removeAttribute(Batman.expando);\n        } else {\n          return elem[Batman.expando] = null;\n        }\n      }\n    },\n    _data: function(elem, name, data) {\n      return Batman.data(elem, name, data, true);\n    },\n    acceptData: function(elem) {\n      var match;\n      if (elem.nodeName) {\n        match = Batman.noData[elem.nodeName.toLowerCase()];\n        if (match) {\n          return !(match === true || elem.getAttribute(\"classid\") !== match);\n        }\n      }\n      return true;\n    }\n  });\n\n}).call(this);\n\n(function() {\n  var buntUndefined, defaultAndOr, __slice = [].slice;\n\n  buntUndefined = function(f) {\n    return function(value) {\n      if (value == null) {\n        return void 0;\n      } else {\n        return f.apply(this, arguments);\n      }\n    };\n  };\n\n  defaultAndOr = function(lhs, rhs) {\n    return lhs || rhs;\n  };\n\n  Batman.Filters = {\n    raw: buntUndefined(function(value, binding) {\n      binding.escapeValue = false;\n      return value;\n    }),\n    get: buntUndefined(function(value, key) {\n      if (value.get != null) {\n        return value.get(key);\n      } else {\n        return value[key];\n      }\n    }),\n    equals: buntUndefined(function(lhs, rhs, binding) {\n      return lhs === rhs;\n    }),\n    and: function(lhs, rhs) {\n      return lhs && rhs;\n    },\n    or: function(lhs, rhs, binding) {\n      return lhs || rhs;\n    },\n    not: function(value, binding) {\n      return !value;\n    },\n    trim: buntUndefined(function(value, binding) {\n      return value.trim();\n    }),\n    matches: buntUndefined(function(value, searchFor) {\n      return value.indexOf(searchFor) !== -1;\n    }),\n    truncate: buntUndefined(function(value, length, end, binding) {\n      if (end == null) {\n        end = \"...\";\n      }\n      if (!binding) {\n        binding = end;\n        end = \"...\";\n      }\n      if (value.length > length) {\n        value = value.substr(0, length - end.length) + end;\n      }\n      return value;\n    }),\n    \"default\": function(value, defaultValue, binding) {\n      if ((value != null) && value !== '') {\n        return value;\n      } else {\n        return defaultValue;\n      }\n    },\n    prepend: function(value, string, binding) {\n      return (string != null ? string : '') + (value != null ? value : '');\n    },\n    append: function(value, string, binding) {\n      return (value != null ? value : '') + (string != null ? string : '');\n    },\n    replace: buntUndefined(function(value, searchFor, replaceWith, flags, binding) {\n      if (!binding) {\n        binding = flags;\n        flags = void 0;\n      }\n      if (flags === void 0) {\n        return value.replace(searchFor, replaceWith);\n      } else {\n        return value.replace(searchFor, replaceWith, flags);\n      }\n    }),\n    downcase: buntUndefined(function(value) {\n      return value.toLowerCase();\n    }),\n    upcase: buntUndefined(function(value) {\n      return value.toUpperCase();\n    }),\n    pluralize: buntUndefined(function(string, count, includeCount, binding) {\n      if (!binding) {\n        binding = includeCount;\n        includeCount = true;\n        if (!binding) {\n          binding = count;\n          count = void 0;\n        }\n      }\n      if (count != null) {\n        return Batman.helpers.pluralize(count, string, void 0, includeCount);\n      } else {\n        return Batman.helpers.pluralize(string);\n      }\n    }),\n    humanize: buntUndefined(function(string, binding) {\n      return Batman.helpers.humanize(string);\n    }),\n    join: buntUndefined(function(value, withWhat, binding) {\n      if (withWhat == null) {\n        withWhat = '';\n      }\n      if (!binding) {\n        binding = withWhat;\n        withWhat = '';\n      }\n      return value.join(withWhat);\n    }),\n    sort: buntUndefined(function(value) {\n      return value.sort();\n    }),\n    map: buntUndefined(function(value, key) {\n      return value.map(function(x) {\n        return Batman.get(x, key);\n      });\n    }),\n    has: function(set, item) {\n      if (set == null) {\n        return false;\n      }\n      return Batman.contains(set, item);\n    },\n    first: buntUndefined(function(value) {\n      return value[0];\n    }),\n    meta: buntUndefined(function(value, keypath) {\n      Batman.developer.assert(value.meta, \"Error, value doesn't have a meta to filter on!\");\n      return value.meta.get(keypath);\n    }),\n    interpolate: function(string, interpolationKeypaths, binding) {\n      var k, v, values;\n      if (!binding) {\n        binding = interpolationKeypaths;\n        interpolationKeypaths = void 0;\n      }\n      if (!string) {\n        return;\n      }\n      values = {};\n      for (k in interpolationKeypaths) {\n        v = interpolationKeypaths[k];\n        values[k] = this.get(v);\n        if (!(values[k] != null)) {\n          Batman.developer.warn(\"Warning! Undefined interpolation key \" + k + \" for interpolation\", string);\n          values[k] = '';\n        }\n      }\n      return Batman.helpers.interpolate(string, values);\n    },\n    withArguments: function() {\n      var binding, block, curryArgs, _i;\n      block = arguments[0], curryArgs = 3 <= arguments.length ? __slice.call(arguments, 1, _i = arguments.length - 1) : (_i = 1, []), binding = arguments[_i++];\n      if (!block) {\n        return;\n      }\n      return function() {\n        var regularArgs;\n        regularArgs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        return block.call.apply(block, [this].concat(__slice.call(curryArgs), __slice.call(regularArgs)));\n      };\n    },\n    routeToAction: buntUndefined(function(model, action) {\n      var params;\n      params = Batman.Dispatcher.paramsFromArgument(model);\n      params.action = action;\n      return params;\n    }),\n    escape: buntUndefined(Batman.escapeHTML)\n  };\n\n  (function() {\n    var k, _i, _len, _ref, _results;\n    _ref = ['capitalize', 'singularize', 'underscore', 'camelize'];\n    _results = [];\n    for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n      k = _ref[_i];\n      _results.push(Batman.Filters[k] = buntUndefined(Batman.helpers[k]));\n    }\n    return _results;\n  })();\n\n  Batman.developer.addFilters();\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.RenderContext = (function() {\n    var ContextProxy;\n\n    RenderContext.deProxy = function(object) {\n      if ((object != null) && object.isContextProxy) {\n        return object.get('proxiedObject');\n      } else {\n        return object;\n      }\n    };\n\n    RenderContext.root = function() {\n      var root;\n      if (Batman.currentApp != null) {\n        root = Batman.currentApp.get('_renderContext');\n      }\n      return root != null ? root : root = this.base;\n    };\n\n    RenderContext.prototype.windowWrapper = {\n      window: Batman.container\n    };\n\n    function RenderContext(object, parent) {\n      this.object = object;\n      this.parent = parent;\n    }\n\n    RenderContext.prototype.findKey = function(key) {\n      var base, currentNode, val;\n      base = key.split('.')[0].split('|')[0].trim();\n      currentNode = this;\n      while (currentNode) {\n        val = Batman.get(currentNode.object, base);\n        if (typeof val !== 'undefined') {\n          val = Batman.get(currentNode.object, key);\n          return [val, currentNode.object].map(this.constructor.deProxy);\n        }\n        currentNode = currentNode.parent;\n      }\n      return [Batman.get(this.windowWrapper, key), this.windowWrapper];\n    };\n\n    RenderContext.prototype.get = function(key) {\n      return this.findKey(key)[0];\n    };\n\n    RenderContext.prototype.contextForKey = function(key) {\n      return this.findKey(key)[1];\n    };\n\n    RenderContext.prototype.descend = function(object, scopedKey) {\n      var oldObject;\n      if (scopedKey) {\n        oldObject = object;\n        object = new Batman.Object();\n        object[scopedKey] = oldObject;\n      }\n      return new this.constructor(object, this);\n    };\n\n    RenderContext.prototype.descendWithDefinition = function(definition) {\n      var proxy;\n      proxy = new ContextProxy(definition);\n      return this.descend(proxy, definition.attr);\n    };\n\n    RenderContext.prototype.chain = function() {\n      var parent, x;\n      x = [];\n      parent = this;\n      while (parent) {\n        x.push(parent.object);\n        parent = parent.parent;\n      }\n      return x;\n    };\n\n    RenderContext.ContextProxy = ContextProxy = (function(_super) {\n\n      __extends(ContextProxy, _super);\n\n      ContextProxy.prototype.isContextProxy = true;\n\n      ContextProxy.accessor('proxiedObject', function() {\n        return this.binding.get('filteredValue');\n      });\n\n      ContextProxy.accessor({\n        get: function(key) {\n          return this.get(\"proxiedObject.\" + key);\n        },\n        set: function(key, value) {\n          return this.set(\"proxiedObject.\" + key, value);\n        },\n        unset: function(key) {\n          return this.unset(\"proxiedObject.\" + key);\n        }\n      });\n\n      function ContextProxy(definition) {\n        this.binding = new Batman.DOM.AbstractBinding(definition);\n      }\n\n      return ContextProxy;\n\n    })(Batman.Object);\n\n    return RenderContext;\n\n  }).call(this);\n\n  Batman.RenderContext.base = new Batman.RenderContext(Batman.RenderContext.prototype.windowWrapper);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    };\n\n  Batman.ViewStore = (function(_super) {\n\n    __extends(ViewStore, _super);\n\n    function ViewStore() {\n      ViewStore.__super__.constructor.apply(this, arguments);\n      this._viewContents = {};\n      this._requestedPaths = new Batman.SimpleSet;\n    }\n\n    ViewStore.prototype.propertyClass = Batman.Property;\n\n    ViewStore.prototype.fetchView = function(path) {\n      var _this = this;\n      return new Batman.Request({\n        url: Batman.Navigator.normalizePath(Batman.config.viewPrefix, \"\" + path + \".html\"),\n        type: 'html',\n        success: function(response) {\n          return _this.set(path, response);\n        },\n        error: function(response) {\n          throw new Error(\"Could not load view from \" + path);\n        }\n      });\n    };\n\n    ViewStore.accessor({\n      'final': true,\n      get: function(path) {\n        var contents;\n        if (path.charAt(0) !== '/') {\n          return this.get(\"/\" + path);\n        }\n        if (this._viewContents[path]) {\n          return this._viewContents[path];\n        }\n        if (this._requestedPaths.has(path)) {\n          return;\n        }\n        if (contents = this._sourceFromDOM(path)) {\n          return contents;\n        }\n        if (Batman.config.fetchRemoteViews) {\n          this.fetchView(path);\n        } else {\n          throw new Error(\"Couldn't find view source for \\'\" + path + \"\\'!\");\n        }\n      },\n      set: function(path, content) {\n        if (path.charAt(0) !== '/') {\n          return this.set(\"/\" + path, content);\n        }\n        this._requestedPaths.add(path);\n        return this._viewContents[path] = content;\n      }\n    });\n\n    ViewStore.prototype.prefetch = function(path) {\n      this.get(path);\n      return true;\n    };\n\n    ViewStore.prototype._sourceFromDOM = function(path) {\n      var node, relativePath;\n      relativePath = path.slice(1);\n      if (node = Batman.DOM.querySelector(document, \"[data-defineview*='\" + relativePath + \"']\")) {\n        Batman.setImmediate(function() {\n          var _ref;\n          return (_ref = node.parentNode) != null ? _ref.removeChild(node) : void 0;\n        });\n        return Batman.DOM.defineView(path, node);\n      }\n    };\n\n    return ViewStore;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n  var __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.View = (function(_super) {\n\n    __extends(View, _super);\n\n    View.YieldStorage = (function(_super1) {\n\n      __extends(YieldStorage, _super1);\n\n      function YieldStorage() {\n        return YieldStorage.__super__.constructor.apply(this, arguments);\n      }\n\n      YieldStorage.wrapAccessor(function(core) {\n        return {\n          get: function(key) {\n            var val;\n            val = core.get.call(this, key);\n            if (!(val != null)) {\n              val = this.set(key, []);\n            }\n            return val;\n          }\n        };\n      });\n\n      return YieldStorage;\n\n    })(Batman.Hash);\n\n    View.store = new Batman.ViewStore();\n\n    View.option = function() {\n      var keys;\n      keys = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n      return this.accessor.apply(this, __slice.call(keys).concat([{\n        get: function(key) {\n          var _ref;\n          return (_ref = this.get(\"argumentBindings.\" + key)) != null ? _ref.get('filteredValue') : void 0;\n        },\n        set: function(key, value) {\n          var _ref;\n          return (_ref = this.get(\"argumentBindings.\" + key)) != null ? _ref.set('filteredValue', value) : void 0;\n        },\n        unset: function(key) {\n          var _ref;\n          return (_ref = this.get(\"argumentBindings.\" + key)) != null ? _ref.unset('filteredValue') : void 0;\n        }\n      }]));\n    };\n\n    View.prototype.isView = true;\n\n    View.prototype.cache = true;\n\n    View.prototype._rendered = false;\n\n    View.prototype.node = null;\n\n    View.prototype.event('ready').oneShot = true;\n\n    View.accessor('argumentBindings', function() {\n      var _this = this;\n      return new Batman.TerminalAccessible(function(key) {\n        var bindingKey, context, definition, keyPath, node, _ref;\n        if (!((node = _this.get('node')) && (context = _this.get('context')))) {\n          return;\n        }\n        keyPath = node.getAttribute((\"data-view-\" + key).toLowerCase());\n        if (keyPath == null) {\n          return;\n        }\n        bindingKey = \"_argumentBinding\" + key;\n        if ((_ref = _this[bindingKey]) != null) {\n          _ref.die();\n        }\n        definition = new Batman.DOM.ReaderBindingDefinition(node, keyPath, context);\n        return _this[bindingKey] = new Batman.DOM.ViewArgumentBinding(definition);\n      });\n    });\n\n    View.accessor('html', {\n      get: function() {\n        var source;\n        if (this.html && this.html.length > 0) {\n          return this.html;\n        }\n        if (!(source = this.get('source'))) {\n          return;\n        }\n        source = Batman.Navigator.normalizePath(source);\n        return this.html = this.constructor.store.get(source);\n      },\n      set: function(_, html) {\n        return this.html = html;\n      }\n    });\n\n    View.accessor('node', {\n      get: function() {\n        var html;\n        if (this.node == null) {\n          html = this.get('html');\n          if (!(html && html.length > 0)) {\n            return;\n          }\n          this.node = document.createElement('div');\n          this._setNodeOwner(this.node);\n          Batman.DOM.setInnerHTML(this.node, html);\n        }\n        return this.node;\n      },\n      set: function(_, node) {\n        var updateHTML, _this = this;\n        this.node = node;\n        this._setNodeOwner(node);\n        updateHTML = function(html) {\n          if (html != null) {\n            Batman.DOM.setInnerHTML(_this.node, html);\n            return _this.forget('html', updateHTML);\n          }\n        };\n        this.observeAndFire('html', updateHTML);\n        return node;\n      }\n    });\n\n    View.accessor('yields', function() {\n      return new this.constructor.YieldStorage;\n    });\n\n    View.accessor('fetched?', function() {\n      return this.get('source') != null;\n    });\n\n    View.accessor('readyToRender', function() {\n      var _ref;\n      return this.get('node') && (this.get('fetched?') ? ((_ref = this.get('html')) != null ? _ref.length : void 0) > 0 : true);\n    });\n\n    function View(options) {\n      var context, _this = this;\n      if (options == null) {\n        options = {};\n      }\n      context = options.context;\n      if (context) {\n        if (!(context instanceof Batman.RenderContext)) {\n          context = Batman.RenderContext.root().descend(context);\n        }\n      } else {\n        context = Batman.RenderContext.root();\n      }\n      options.context = context.descend(this);\n      View.__super__.constructor.call(this, options);\n      Batman.Property.withoutTracking(function() {\n        return _this.observeAndFire('readyToRender', function(ready) {\n          if (ready) {\n            return _this.render();\n          }\n        });\n      });\n    }\n\n    View.prototype.render = function() {\n      var node, _this = this;\n      if (this._rendered) {\n        return;\n      }\n      this._rendered = true;\n      this._renderer = new Batman.Renderer(node = this.get('node'), this.get('context'), this);\n      return this._renderer.once('rendered', function() {\n        return _this.fire('ready', node);\n      });\n    };\n\n    View.prototype.isInDOM = function() {\n      var node;\n      if ((node = this.get('node'))) {\n        return (node.parentNode != null) || this.get('yields').some(function(name, nodes) {\n          var _i, _len;\n          for (_i = 0, _len = nodes.length; _i < _len; _i++) {\n            node = nodes[_i].node;\n            if (node.parentNode != null) {\n              return true;\n            }\n          }\n          return false;\n        });\n      } else {\n        return false;\n      }\n    };\n\n    View.prototype.die = function() {\n      var _ref;\n      this.fire('destroy', this.node);\n      this.forget();\n      if ((_ref = this._batman.properties) != null) {\n        _ref.forEach(function(key, property) {\n          return property.die();\n        });\n      }\n      return this.get('yields').forEach(function(name, actions) {\n        var node, _i, _len, _results;\n        _results = [];\n        for (_i = 0, _len = actions.length; _i < _len; _i++) {\n          node = actions[_i].node;\n          _results.push(Batman.DOM.didDestroyNode(node));\n        }\n        return _results;\n      });\n    };\n\n    View.prototype.applyYields = function() {\n      return this.get('yields').forEach(function(name, nodes) {\n        var action, node, yieldObject, _i, _len, _ref, _results;\n        yieldObject = Batman.DOM.Yield.withName(name);\n        _results = [];\n        for (_i = 0, _len = nodes.length; _i < _len; _i++) {\n          _ref = nodes[_i], node = _ref.node, action = _ref.action;\n          _results.push(yieldObject[action](node));\n        }\n        return _results;\n      });\n    };\n\n    View.prototype.retractYields = function() {\n      return this.get('yields').forEach(function(name, nodes) {\n        var node, _i, _len, _ref, _results;\n        _results = [];\n        for (_i = 0, _len = nodes.length; _i < _len; _i++) {\n          node = nodes[_i].node;\n          _results.push((_ref = node.parentNode) != null ? _ref.removeChild(node) : void 0);\n        }\n        return _results;\n      });\n    };\n\n    View.prototype.pushYieldAction = function(key, action, node) {\n      this._setNodeYielder(node);\n      return this.get(\"yields\").get(key).push({\n        node: node,\n        action: action\n      });\n    };\n\n    View.prototype._setNodeOwner = function(node) {\n      return Batman._data(node, 'view', this);\n    };\n\n    View.prototype._setNodeYielder = function(node) {\n      return Batman._data(node, 'yielder', this);\n    };\n\n    View.prototype.on('ready', function() {\n      return typeof this.ready === \"function\" ? this.ready.apply(this, arguments) : void 0;\n    });\n\n    View.prototype.on('appear', function() {\n      return typeof this.viewDidAppear === \"function\" ? this.viewDidAppear.apply(this, arguments) : void 0;\n    });\n\n    View.prototype.on('disappear', function() {\n      return typeof this.viewDidDisappear === \"function\" ? this.viewDidDisappear.apply(this, arguments) : void 0;\n    });\n\n    View.prototype.on('beforeAppear', function() {\n      return typeof this.viewWillAppear === \"function\" ? this.viewWillAppear.apply(this, arguments) : void 0;\n    });\n\n    View.prototype.on('beforeDisappear', function() {\n      return typeof this.viewWillDisappear === \"function\" ? this.viewWillDisappear.apply(this, arguments) : void 0;\n    });\n\n    return View;\n\n  }).call(this, Batman.Object);\n\n}).call(this);\n\n(function() {\n  var Yield, __hasProp = {}.hasOwnProperty,\n    __extends = function(child, parent) {\n      for (var key in parent) {\n        if (__hasProp.call(parent, key)) child[key] = parent[key];\n      }\n      function ctor() {\n        this.constructor = child;\n      }\n      ctor.prototype = parent.prototype;\n      child.prototype = new ctor();\n      child.__super__ = parent.prototype;\n      return child;\n    },\n    __slice = [].slice;\n\n  Batman.DOM.Yield = Yield = (function(_super) {\n\n    __extends(Yield, _super);\n\n    Yield.yields = {};\n\n    Yield.queued = function(fn) {\n      return function() {\n        var args, handler, _this = this;\n        args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];\n        if (this.containerNode != null) {\n          return fn.apply(this, args);\n        } else {\n          return handler = this.observe('containerNode', function() {\n            var result;\n            result = fn.apply(_this, args);\n            _this.forget('containerNode', handler);\n            return result;\n          });\n        }\n      };\n    };\n\n    Yield.reset = function() {\n      return this.yields = {};\n    };\n\n    Yield.withName = function(name) {\n      var _base;\n      (_base = this.yields)[name] || (_base[name] = new this({\n        name: name\n      }));\n      return this.yields[name];\n    };\n\n    Yield.forEach = function(f) {\n      var name, yieldObject, _ref;\n      _ref = this.yields;\n      for (name in _ref) {\n        yieldObject = _ref[name];\n        f(yieldObject);\n      }\n    };\n\n    Yield.clearAll = function() {\n      return this.forEach(function(yieldObject) {\n        return yieldObject.clear();\n      });\n    };\n\n    Yield.cycleAll = function() {\n      return this.forEach(function(yieldObject) {\n        return yieldObject.cycle();\n      });\n    };\n\n    Yield.clearAllStale = function() {\n      return this.forEach(function(yieldObject) {\n        return yieldObject.clearStale();\n      });\n    };\n\n    function Yield() {\n      this.cycle();\n    }\n\n    Yield.prototype.cycle = function() {\n      return this.currentVersionNodes = [];\n    };\n\n    Yield.prototype.clear = Yield.queued(function() {\n      var child, _i, _len, _ref, _results;\n      this.cycle();\n      _ref = (function() {\n        var _j, _len, _ref, _results1;\n        _ref = this.containerNode.childNodes;\n        _results1 = [];\n        for (_j = 0, _len = _ref.length; _j < _len; _j++) {\n          child = _ref[_j];\n          _results1.push(child);\n        }\n        return _results1;\n      }).call(this);\n      _results = [];\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        child = _ref[_i];\n        _results.push(Batman.DOM.removeOrDestroyNode(child));\n      }\n      return _results;\n    });\n\n    Yield.prototype.clearStale = Yield.queued(function() {\n      var child, _i, _len, _ref, _results;\n      _ref = (function() {\n        var _j, _len, _ref, _results1;\n        _ref = this.containerNode.childNodes;\n        _results1 = [];\n        for (_j = 0, _len = _ref.length; _j < _len; _j++) {\n          child = _ref[_j];\n          _results1.push(child);\n        }\n        return _results1;\n      }).call(this);\n      _results = [];\n      for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n        child = _ref[_i];\n        if (!~this.currentVersionNodes.indexOf(child)) {\n          _results.push(Batman.DOM.removeOrDestroyNode(child));\n        }\n      }\n      return _results;\n    });\n\n    Yield.prototype.append = Yield.queued(function(node) {\n      this.currentVersionNodes.push(node);\n      return Batman.DOM.appendChild(this.containerNode, node, true);\n    });\n\n    Yield.prototype.replace = Yield.queued(function(node) {\n      this.clear();\n      return this.append(node);\n    });\n\n    return Yield;\n\n  })(Batman.Object);\n\n}).call(this);\n\n(function() {\n\n\n\n}).call(this);"
  },
  {
    "path": "javascripts/dashing.coffee",
    "content": "#= require jquery\n#= require es5-shim\n#= require batman\n#= require batman.jquery\n\n\nBatman.Filters.prettyNumber = (num) ->\n  num.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\") unless isNaN(num)\n\nBatman.Filters.dashize = (str) ->\n  dashes_rx1 = /([A-Z]+)([A-Z][a-z])/g;\n  dashes_rx2 = /([a-z\\d])([A-Z])/g;\n\n  return str.replace(dashes_rx1, '$1_$2').replace(dashes_rx2, '$1_$2').replace(/_/g, '-').toLowerCase()\n\nBatman.Filters.shortenedNumber = (num) ->\n  return num if isNaN(num)\n  if num >= 1000000000\n    (num / 1000000000).toFixed(1) + 'B'\n  else if num >= 1000000\n    (num / 1000000).toFixed(1) + 'M'\n  else if num >= 1000\n    (num / 1000).toFixed(1) + 'K'\n  else\n    num\n\nclass window.Dashing extends Batman.App\n  @on 'reload', (data) ->\n    window.location.reload(true)\n\n  @root ->\nDashing.params = Batman.URI.paramsFromQuery(window.location.search.slice(1));\n\nclass Dashing.Widget extends Batman.View\n  constructor:  ->\n    # Set the view path\n    @constructor::source = Batman.Filters.underscore(@constructor.name)\n    super\n\n    @mixin($(@node).data())\n    Dashing.widgets[@id] ||= []\n    Dashing.widgets[@id].push(@)\n\n    type = Batman.Filters.dashize(@view)\n    $(@node).addClass(\"widget widget-#{type} #{@id}\")\n\n  @accessor 'updatedAtMessage', ->\n    if updatedAt = @get('updatedAt')\n      timestamp = new Date(updatedAt * 1000)\n      hours = timestamp.getHours()\n      minutes = (\"0\" + timestamp.getMinutes()).slice(-2)\n      \"Last updated at #{hours}:#{minutes}\"\n\n  @::on 'ready', ->\n    Dashing.Widget.fire 'ready'\n\n    # In case the events from the server came before the widget was rendered\n    lastData = Dashing.lastEvents[@id]\n    if lastData\n      @mixin(lastData)\n      @onData(lastData)\n\n  receiveData: (data) =>\n    @mixin(data)\n    @onData(data)\n\n  onData: (data) =>\n    # Widgets override this to handle incoming data\n\nDashing.AnimatedValue =\n  get: Batman.Property.defaultAccessor.get\n  set: (k, to) ->\n    if !to? || isNaN(to)\n      @[k] = to\n    else\n      timer = \"interval_#{k}\"\n      num = if (!isNaN(@[k]) && @[k]?) then @[k] else 0\n      unless @[timer] || num == to\n        to = parseFloat(to)\n        num = parseFloat(num)\n        up = to > num\n        num_interval = Math.abs(num - to) / 90\n        @[timer] =\n          setInterval =>\n            num = if up then Math.ceil(num+num_interval) else Math.floor(num-num_interval)\n            if (up && num > to) || (!up && num < to)\n              num = to\n              clearInterval(@[timer])\n              @[timer] = null\n              delete @[timer]\n            @[k] = num\n            @set k, to\n          , 10\n      @[k] = num\n\nDashing.widgets = widgets = {}\nDashing.lastEvents = lastEvents = {}\nDashing.debugMode = false\n\nsource = new EventSource('events')\nsource.addEventListener 'open', (e) ->\n  console.log(\"Connection opened\", e)\n\nsource.addEventListener 'error', (e)->\n  console.log(\"Connection error\", e)\n  if (e.currentTarget.readyState == EventSource.CLOSED)\n    console.log(\"Connection closed\")\n    setTimeout (->\n      window.location.reload()\n    ), 5*60*1000\n\nsource.addEventListener 'message', (e) ->\n  data = JSON.parse(e.data)\n  if lastEvents[data.id]?.updatedAt != data.updatedAt\n    if Dashing.debugMode\n      console.log(\"Received data for #{data.id}\", data)\n    lastEvents[data.id] = data\n    if widgets[data.id]?.length > 0\n      for widget in widgets[data.id]\n        widget.receiveData(data)\n\nsource.addEventListener 'dashboards', (e) ->\n  data = JSON.parse(e.data)\n  if Dashing.debugMode\n    console.log(\"Received data for dashboards\", data)\n  if data.dashboard is '*' or window.location.pathname is \"/#{data.dashboard}\"\n    Dashing.fire data.event, data\n\n$(document).ready ->\n  Dashing.run()\n"
  },
  {
    "path": "javascripts/es5-shim.js",
    "content": "// vim: ts=4 sts=4 sw=4 expandtab\n// -- kriskowal Kris Kowal Copyright (C) 2009-2011 MIT License\n// -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)\n// -- dantman Daniel Friesen Copyright (C) 2010 XXX TODO License or CLA\n// -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License\n// -- Gozala Irakli Gozalishvili Copyright (C) 2010 MIT License\n// -- kitcambridge Kit Cambridge Copyright (C) 2011 MIT License\n// -- kossnocorp Sasha Koss XXX TODO License or CLA\n// -- bryanforbes Bryan Forbes XXX TODO License or CLA\n// -- killdream Quildreen Motta Copyright (C) 2011 MIT Licence\n// -- michaelficarra Michael Ficarra Copyright (C) 2011 3-clause BSD License\n// -- sharkbrainguy Gerard Paapu Copyright (C) 2011 MIT License\n// -- bbqsrc Brendan Molloy XXX TODO License or CLA\n// -- iwyg XXX TODO License or CLA\n// -- DomenicDenicola Domenic Denicola XXX TODO License or CLA\n// -- xavierm02 Montillet Xavier XXX TODO License or CLA\n// -- Raynos Raynos XXX TODO License or CLA\n// -- samsonjs Sami Samhuri XXX TODO License or CLA\n// -- rwldrn Rick Waldron Copyright (C) 2011 MIT License\n// -- lexer Alexey Zakharov XXX TODO License or CLA\n\n/*!\n    Copyright (c) 2009, 280 North Inc. http://280north.com/\n    MIT License. http://github.com/280north/narwhal/blob/master/README.md\n*/\n\n// Module systems magic dance\n(function (definition) {\n    // RequireJS\n    if (typeof define == \"function\") {\n        define(definition);\n    // CommonJS and <script>\n    } else {\n        definition();\n    }\n})(function () {\n\n/**\n * Brings an environment as close to ECMAScript 5 compliance\n * as is possible with the facilities of erstwhile engines.\n *\n * ES5 Draft\n * http://www.ecma-international.org/publications/files/drafts/tc39-2009-050.pdf\n *\n * NOTE: this is a draft, and as such, the URL is subject to change.  If the\n * link is broken, check in the parent directory for the latest TC39 PDF.\n * http://www.ecma-international.org/publications/files/drafts/\n *\n * Previous ES5 Draft\n * http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf\n * This is a broken link to the previous draft of ES5 on which most of the\n * numbered specification references and quotes herein were taken.  Updating\n * these references and quotes to reflect the new document would be a welcome\n * volunteer project.\n *\n * @module\n */\n\n/*whatsupdoc*/\n\n//\n// Function\n// ========\n//\n\n// ES-5 15.3.4.5\n// http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf\n\nif (!Function.prototype.bind) {\n    Function.prototype.bind = function bind(that) { // .length is 1\n        // 1. Let Target be the this value.\n        var target = this;\n        // 2. If IsCallable(Target) is false, throw a TypeError exception.\n        if (typeof target != \"function\")\n            throw new TypeError(); // TODO message\n        // 3. Let A be a new (possibly empty) internal list of all of the\n        //   argument values provided after thisArg (arg1, arg2 etc), in order.\n        // XXX slicedArgs will stand in for \"A\" if used\n        var args = slice.call(arguments, 1); // for normal call\n        // 4. Let F be a new native ECMAScript object.\n        // 9. Set the [[Prototype]] internal property of F to the standard\n        //   built-in Function prototype object as specified in 15.3.3.1.\n        // 10. Set the [[Call]] internal property of F as described in\n        //   15.3.4.5.1.\n        // 11. Set the [[Construct]] internal property of F as described in\n        //   15.3.4.5.2.\n        // 12. Set the [[HasInstance]] internal property of F as described in\n        //   15.3.4.5.3.\n        // 13. The [[Scope]] internal property of F is unused and need not\n        //   exist.\n        var bound = function () {\n\n            if (this instanceof bound) {\n                // 15.3.4.5.2 [[Construct]]\n                // When the [[Construct]] internal method of a function object,\n                // F that was created using the bind function is called with a\n                // list of arguments ExtraArgs the following steps are taken:\n                // 1. Let target be the value of F's [[TargetFunction]]\n                //   internal property.\n                // 2. If target has no [[Construct]] internal method, a\n                //   TypeError exception is thrown.\n                // 3. Let boundArgs be the value of F's [[BoundArgs]] internal\n                //   property.\n                // 4. Let args be a new list containing the same values as the\n                //   list boundArgs in the same order followed by the same\n                //   values as the list ExtraArgs in the same order.\n\n                var F = function(){};\n                F.prototype = target.prototype;\n                var self = new F;\n\n                var result = target.apply(\n                    self,\n                    args.concat(slice.call(arguments))\n                );\n                if (result !== null && Object(result) === result)\n                    return result;\n                return self;\n\n            } else {\n                // 15.3.4.5.1 [[Call]]\n                // When the [[Call]] internal method of a function object, F,\n                // which was created using the bind function is called with a\n                // this value and a list of arguments ExtraArgs the following\n                // steps are taken:\n                // 1. Let boundArgs be the value of F's [[BoundArgs]] internal\n                //   property.\n                // 2. Let boundThis be the value of F's [[BoundThis]] internal\n                //   property.\n                // 3. Let target be the value of F's [[TargetFunction]] internal\n                //   property.\n                // 4. Let args be a new list containing the same values as the list\n                //   boundArgs in the same order followed by the same values as\n                //   the list ExtraArgs in the same order. 5.  Return the\n                //   result of calling the [[Call]] internal method of target\n                //   providing boundThis as the this value and providing args\n                //   as the arguments.\n\n                // equiv: target.call(this, ...boundArgs, ...args)\n                return target.apply(\n                    that,\n                    args.concat(slice.call(arguments))\n                );\n\n            }\n\n        };\n        // XXX bound.length is never writable, so don't even try\n        //\n        // 16. The length own property of F is given attributes as specified in\n        //   15.3.5.1.\n        // TODO\n        // 17. Set the [[Extensible]] internal property of F to true.\n        // TODO\n        // 18. Call the [[DefineOwnProperty]] internal method of F with\n        //   arguments \"caller\", PropertyDescriptor {[[Value]]: null,\n        //   [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:\n        //   false}, and false.\n        // TODO\n        // 19. Call the [[DefineOwnProperty]] internal method of F with\n        //   arguments \"arguments\", PropertyDescriptor {[[Value]]: null,\n        //   [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:\n        //   false}, and false.\n        // TODO\n        // NOTE Function objects created using Function.prototype.bind do not\n        // have a prototype property.\n        // XXX can't delete it in pure-js.\n        return bound;\n    };\n}\n\n// Shortcut to an often accessed properties, in order to avoid multiple\n// dereference that costs universally.\n// _Please note: Shortcuts are defined after `Function.prototype.bind` as we\n// us it in defining shortcuts.\nvar call = Function.prototype.call;\nvar prototypeOfArray = Array.prototype;\nvar prototypeOfObject = Object.prototype;\nvar slice = prototypeOfArray.slice;\nvar toString = call.bind(prototypeOfObject.toString);\nvar owns = call.bind(prototypeOfObject.hasOwnProperty);\n\n// If JS engine supports accessors creating shortcuts.\nvar defineGetter;\nvar defineSetter;\nvar lookupGetter;\nvar lookupSetter;\nvar supportsAccessors;\nif ((supportsAccessors = owns(prototypeOfObject, \"__defineGetter__\"))) {\n    defineGetter = call.bind(prototypeOfObject.__defineGetter__);\n    defineSetter = call.bind(prototypeOfObject.__defineSetter__);\n    lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);\n    lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);\n}\n\n//\n// Array\n// =====\n//\n\n// ES5 15.4.3.2\nif (!Array.isArray) {\n    Array.isArray = function isArray(obj) {\n        return toString(obj) == \"[object Array]\";\n    };\n}\n\n// The IsCallable() check in the Array functions\n// has been replaced with a strict check on the\n// internal class of the object to trap cases where\n// the provided function was actually a regular\n// expression literal, which in V8 and\n// JavaScriptCore is a typeof \"function\".  Only in\n// V8 are regular expression literals permitted as\n// reduce parameters, so it is desirable in the\n// general case for the shim to match the more\n// strict and common behavior of rejecting regular\n// expressions.\n\n// ES5 15.4.4.18\n// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach\nif (!Array.prototype.forEach) {\n    Array.prototype.forEach = function forEach(fun /*, thisp*/) {\n        var self = toObject(this),\n            thisp = arguments[1],\n            i = 0,\n            length = self.length >>> 0;\n\n        // If no callback function or if callback is not a callable function\n        if (toString(fun) != \"[object Function]\") {\n            throw new TypeError(); // TODO message\n        }\n\n        while (i < length) {\n            if (i in self) {\n                // Invoke the callback function with call, passing arguments:\n                // context, property value, property key, thisArg object context\n                fun.call(thisp, self[i], i, self);\n            }\n            i++;\n        }\n    };\n}\n\n// ES5 15.4.4.19\n// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map\nif (!Array.prototype.map) {\n    Array.prototype.map = function map(fun /*, thisp*/) {\n        var self = toObject(this),\n            length = self.length >>> 0,\n            result = Array(length),\n            thisp = arguments[1];\n\n        // If no callback function or if callback is not a callable function\n        if (toString(fun) != \"[object Function]\") {\n            throw new TypeError(); // TODO message\n        }\n\n        for (var i = 0; i < length; i++) {\n            if (i in self)\n                result[i] = fun.call(thisp, self[i], i, self);\n        }\n        return result;\n    };\n}\n\n// ES5 15.4.4.20\nif (!Array.prototype.filter) {\n    Array.prototype.filter = function filter(fun /*, thisp */) {\n        var self = toObject(this),\n            length = self.length >>> 0,\n            result = [],\n            thisp = arguments[1];\n\n        // If no callback function or if callback is not a callable function\n        if (toString(fun) != \"[object Function]\") {\n            throw new TypeError(); // TODO message\n        }\n\n        for (var i = 0; i < length; i++) {\n            if (i in self && fun.call(thisp, self[i], i, self))\n                result.push(self[i]);\n        }\n        return result;\n    };\n}\n\n// ES5 15.4.4.16\nif (!Array.prototype.every) {\n    Array.prototype.every = function every(fun /*, thisp */) {\n        var self = toObject(this),\n            length = self.length >>> 0,\n            thisp = arguments[1];\n\n        // If no callback function or if callback is not a callable function\n        if (toString(fun) != \"[object Function]\") {\n            throw new TypeError(); // TODO message\n        }\n\n        for (var i = 0; i < length; i++) {\n            if (i in self && !fun.call(thisp, self[i], i, self))\n                return false;\n        }\n        return true;\n    };\n}\n\n// ES5 15.4.4.17\n// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some\nif (!Array.prototype.some) {\n    Array.prototype.some = function some(fun /*, thisp */) {\n        var self = toObject(this),\n            length = self.length >>> 0,\n            thisp = arguments[1];\n\n        // If no callback function or if callback is not a callable function\n        if (toString(fun) != \"[object Function]\") {\n            throw new TypeError(); // TODO message\n        }\n\n        for (var i = 0; i < length; i++) {\n            if (i in self && fun.call(thisp, self[i], i, self))\n                return true;\n        }\n        return false;\n    };\n}\n\n// ES5 15.4.4.21\n// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce\nif (!Array.prototype.reduce) {\n    Array.prototype.reduce = function reduce(fun /*, initial*/) {\n        var self = toObject(this),\n            length = self.length >>> 0;\n\n        // If no callback function or if callback is not a callable function\n        if (toString(fun) != \"[object Function]\") {\n            throw new TypeError(); // TODO message\n        }\n\n        // no value to return if no initial value and an empty array\n        if (!length && arguments.length == 1)\n            throw new TypeError(); // TODO message\n\n        var i = 0;\n        var result;\n        if (arguments.length >= 2) {\n            result = arguments[1];\n        } else {\n            do {\n                if (i in self) {\n                    result = self[i++];\n                    break;\n                }\n\n                // if array contains no values, no initial value to return\n                if (++i >= length)\n                    throw new TypeError(); // TODO message\n            } while (true);\n        }\n\n        for (; i < length; i++) {\n            if (i in self)\n                result = fun.call(void 0, result, self[i], i, self);\n        }\n\n        return result;\n    };\n}\n\n// ES5 15.4.4.22\n// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight\nif (!Array.prototype.reduceRight) {\n    Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {\n        var self = toObject(this),\n            length = self.length >>> 0;\n\n        // If no callback function or if callback is not a callable function\n        if (toString(fun) != \"[object Function]\") {\n            throw new TypeError(); // TODO message\n        }\n\n        // no value to return if no initial value, empty array\n        if (!length && arguments.length == 1)\n            throw new TypeError(); // TODO message\n\n        var result, i = length - 1;\n        if (arguments.length >= 2) {\n            result = arguments[1];\n        } else {\n            do {\n                if (i in self) {\n                    result = self[i--];\n                    break;\n                }\n\n                // if array contains no values, no initial value to return\n                if (--i < 0)\n                    throw new TypeError(); // TODO message\n            } while (true);\n        }\n\n        do {\n            if (i in this)\n                result = fun.call(void 0, result, self[i], i, self);\n        } while (i--);\n\n        return result;\n    };\n}\n\n// ES5 15.4.4.14\n// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf\nif (!Array.prototype.indexOf) {\n    Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {\n        var self = toObject(this),\n            length = self.length >>> 0;\n\n        if (!length)\n            return -1;\n\n        var i = 0;\n        if (arguments.length > 1)\n            i = toInteger(arguments[1]);\n\n        // handle negative indices\n        i = i >= 0 ? i : length - Math.abs(i);\n        for (; i < length; i++) {\n            if (i in self && self[i] === sought) {\n                return i;\n            }\n        }\n        return -1;\n    };\n}\n\n// ES5 15.4.4.15\nif (!Array.prototype.lastIndexOf) {\n    Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {\n        var self = toObject(this),\n            length = self.length >>> 0;\n\n        if (!length)\n            return -1;\n        var i = length - 1;\n        if (arguments.length > 1)\n            i = toInteger(arguments[1]);\n        // handle negative indices\n        i = i >= 0 ? i : length - Math.abs(i);\n        for (; i >= 0; i--) {\n            if (i in self && sought === self[i])\n                return i;\n        }\n        return -1;\n    };\n}\n\n//\n// Object\n// ======\n//\n\n// ES5 15.2.3.2\nif (!Object.getPrototypeOf) {\n    // https://github.com/kriskowal/es5-shim/issues#issue/2\n    // http://ejohn.org/blog/objectgetprototypeof/\n    // recommended by fschaefer on github\n    Object.getPrototypeOf = function getPrototypeOf(object) {\n        return object.__proto__ || (\n            object.constructor ?\n            object.constructor.prototype :\n            prototypeOfObject\n        );\n    };\n}\n\n// ES5 15.2.3.3\nif (!Object.getOwnPropertyDescriptor) {\n    var ERR_NON_OBJECT = \"Object.getOwnPropertyDescriptor called on a \" +\n                         \"non-object: \";\n    Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {\n        if ((typeof object != \"object\" && typeof object != \"function\") || object === null)\n            throw new TypeError(ERR_NON_OBJECT + object);\n        // If object does not owns property return undefined immediately.\n        if (!owns(object, property))\n            return;\n\n        var descriptor, getter, setter;\n\n        // If object has a property then it's for sure both `enumerable` and\n        // `configurable`.\n        descriptor =  { enumerable: true, configurable: true };\n\n        // If JS engine supports accessor properties then property may be a\n        // getter or setter.\n        if (supportsAccessors) {\n            // Unfortunately `__lookupGetter__` will return a getter even\n            // if object has own non getter property along with a same named\n            // inherited getter. To avoid misbehavior we temporary remove\n            // `__proto__` so that `__lookupGetter__` will return getter only\n            // if it's owned by an object.\n            var prototype = object.__proto__;\n            object.__proto__ = prototypeOfObject;\n\n            var getter = lookupGetter(object, property);\n            var setter = lookupSetter(object, property);\n\n            // Once we have getter and setter we can put values back.\n            object.__proto__ = prototype;\n\n            if (getter || setter) {\n                if (getter) descriptor.get = getter;\n                if (setter) descriptor.set = setter;\n\n                // If it was accessor property we're done and return here\n                // in order to avoid adding `value` to the descriptor.\n                return descriptor;\n            }\n        }\n\n        // If we got this far we know that object has an own property that is\n        // not an accessor so we set it as a value and return descriptor.\n        descriptor.value = object[property];\n        return descriptor;\n    };\n}\n\n// ES5 15.2.3.4\nif (!Object.getOwnPropertyNames) {\n    Object.getOwnPropertyNames = function getOwnPropertyNames(object) {\n        return Object.keys(object);\n    };\n}\n\n// ES5 15.2.3.5\nif (!Object.create) {\n    Object.create = function create(prototype, properties) {\n        var object;\n        if (prototype === null) {\n            object = { \"__proto__\": null };\n        } else {\n            if (typeof prototype != \"object\")\n                throw new TypeError(\"typeof prototype[\"+(typeof prototype)+\"] != 'object'\");\n            var Type = function () {};\n            Type.prototype = prototype;\n            object = new Type();\n            // IE has no built-in implementation of `Object.getPrototypeOf`\n            // neither `__proto__`, but this manually setting `__proto__` will\n            // guarantee that `Object.getPrototypeOf` will work as expected with\n            // objects created using `Object.create`\n            object.__proto__ = prototype;\n        }\n        if (properties !== void 0)\n            Object.defineProperties(object, properties);\n        return object;\n    };\n}\n\n// ES5 15.2.3.6\n\n// Patch for WebKit and IE8 standard mode\n// Designed by hax <hax.github.com>\n// related issue: https://github.com/kriskowal/es5-shim/issues#issue/5\n// IE8 Reference:\n//     http://msdn.microsoft.com/en-us/library/dd282900.aspx\n//     http://msdn.microsoft.com/en-us/library/dd229916.aspx\n// WebKit Bugs:\n//     https://bugs.webkit.org/show_bug.cgi?id=36423\n\nfunction doesDefinePropertyWork(object) {\n    try {\n        Object.defineProperty(object, \"sentinel\", {});\n        return \"sentinel\" in object;\n    } catch (exception) {\n        // returns falsy\n    }\n}\n\n// check whether defineProperty works if it's given. Otherwise,\n// shim partially.\nif (Object.defineProperty) {\n    var definePropertyWorksOnObject = doesDefinePropertyWork({});\n    var definePropertyWorksOnDom = typeof document == \"undefined\" ||\n        doesDefinePropertyWork(document.createElement(\"div\"));\n    if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {\n        var definePropertyFallback = Object.defineProperty;\n    }\n}\n\nif (!Object.defineProperty || definePropertyFallback) {\n    var ERR_NON_OBJECT_DESCRIPTOR = \"Property description must be an object: \";\n    var ERR_NON_OBJECT_TARGET = \"Object.defineProperty called on non-object: \"\n    var ERR_ACCESSORS_NOT_SUPPORTED = \"getters & setters can not be defined \" +\n                                      \"on this javascript engine\";\n\n    Object.defineProperty = function defineProperty(object, property, descriptor) {\n        if ((typeof object != \"object\" && typeof object != \"function\") || object === null)\n            throw new TypeError(ERR_NON_OBJECT_TARGET + object);\n        if ((typeof descriptor != \"object\" && typeof descriptor != \"function\") || descriptor === null)\n            throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);\n\n        // make a valiant attempt to use the real defineProperty\n        // for I8's DOM elements.\n        if (definePropertyFallback) {\n            try {\n                return definePropertyFallback.call(Object, object, property, descriptor);\n            } catch (exception) {\n                // try the shim if the real one doesn't work\n            }\n        }\n\n        // If it's a data property.\n        if (owns(descriptor, \"value\")) {\n            // fail silently if \"writable\", \"enumerable\", or \"configurable\"\n            // are requested but not supported\n            /*\n            // alternate approach:\n            if ( // can't implement these features; allow false but not true\n                !(owns(descriptor, \"writable\") ? descriptor.writable : true) ||\n                !(owns(descriptor, \"enumerable\") ? descriptor.enumerable : true) ||\n                !(owns(descriptor, \"configurable\") ? descriptor.configurable : true)\n            )\n                throw new RangeError(\n                    \"This implementation of Object.defineProperty does not \" +\n                    \"support configurable, enumerable, or writable.\"\n                );\n            */\n\n            if (supportsAccessors && (lookupGetter(object, property) ||\n                                      lookupSetter(object, property)))\n            {\n                // As accessors are supported only on engines implementing\n                // `__proto__` we can safely override `__proto__` while defining\n                // a property to make sure that we don't hit an inherited\n                // accessor.\n                var prototype = object.__proto__;\n                object.__proto__ = prototypeOfObject;\n                // Deleting a property anyway since getter / setter may be\n                // defined on object itself.\n                delete object[property];\n                object[property] = descriptor.value;\n                // Setting original `__proto__` back now.\n                object.__proto__ = prototype;\n            } else {\n                object[property] = descriptor.value;\n            }\n        } else {\n            if (!supportsAccessors)\n                throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);\n            // If we got that far then getters and setters can be defined !!\n            if (owns(descriptor, \"get\"))\n                defineGetter(object, property, descriptor.get);\n            if (owns(descriptor, \"set\"))\n                defineSetter(object, property, descriptor.set);\n        }\n\n        return object;\n    };\n}\n\n// ES5 15.2.3.7\nif (!Object.defineProperties) {\n    Object.defineProperties = function defineProperties(object, properties) {\n        for (var property in properties) {\n            if (owns(properties, property))\n                Object.defineProperty(object, property, properties[property]);\n        }\n        return object;\n    };\n}\n\n// ES5 15.2.3.8\nif (!Object.seal) {\n    Object.seal = function seal(object) {\n        // this is misleading and breaks feature-detection, but\n        // allows \"securable\" code to \"gracefully\" degrade to working\n        // but insecure code.\n        return object;\n    };\n}\n\n// ES5 15.2.3.9\nif (!Object.freeze) {\n    Object.freeze = function freeze(object) {\n        // this is misleading and breaks feature-detection, but\n        // allows \"securable\" code to \"gracefully\" degrade to working\n        // but insecure code.\n        return object;\n    };\n}\n\n// detect a Rhino bug and patch it\ntry {\n    Object.freeze(function () {});\n} catch (exception) {\n    Object.freeze = (function freeze(freezeObject) {\n        return function freeze(object) {\n            if (typeof object == \"function\") {\n                return object;\n            } else {\n                return freezeObject(object);\n            }\n        };\n    })(Object.freeze);\n}\n\n// ES5 15.2.3.10\nif (!Object.preventExtensions) {\n    Object.preventExtensions = function preventExtensions(object) {\n        // this is misleading and breaks feature-detection, but\n        // allows \"securable\" code to \"gracefully\" degrade to working\n        // but insecure code.\n        return object;\n    };\n}\n\n// ES5 15.2.3.11\nif (!Object.isSealed) {\n    Object.isSealed = function isSealed(object) {\n        return false;\n    };\n}\n\n// ES5 15.2.3.12\nif (!Object.isFrozen) {\n    Object.isFrozen = function isFrozen(object) {\n        return false;\n    };\n}\n\n// ES5 15.2.3.13\nif (!Object.isExtensible) {\n    Object.isExtensible = function isExtensible(object) {\n        // 1. If Type(O) is not Object throw a TypeError exception.\n        if (Object(object) === object) {\n            throw new TypeError(); // TODO message\n        }\n        // 2. Return the Boolean value of the [[Extensible]] internal property of O.\n        var name = '';\n        while (owns(object, name)) {\n            name += '?';\n        }\n        object[name] = true;\n        var returnValue = owns(object, name);\n        delete object[name];\n        return returnValue;\n    };\n}\n\n// ES5 15.2.3.14\n// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation\nif (!Object.keys) {\n\n    var hasDontEnumBug = true,\n        dontEnums = [\n            \"toString\",\n            \"toLocaleString\",\n            \"valueOf\",\n            \"hasOwnProperty\",\n            \"isPrototypeOf\",\n            \"propertyIsEnumerable\",\n            \"constructor\"\n        ],\n        dontEnumsLength = dontEnums.length;\n\n    for (var key in {\"toString\": null})\n        hasDontEnumBug = false;\n\n    Object.keys = function keys(object) {\n\n        if ((typeof object != \"object\" && typeof object != \"function\") || object === null)\n            throw new TypeError(\"Object.keys called on a non-object\");\n\n        var keys = [];\n        for (var name in object) {\n            if (owns(object, name)) {\n                keys.push(name);\n            }\n        }\n\n        if (hasDontEnumBug) {\n            for (var i = 0, ii = dontEnumsLength; i < ii; i++) {\n                var dontEnum = dontEnums[i];\n                if (owns(object, dontEnum)) {\n                    keys.push(dontEnum);\n                }\n            }\n        }\n\n        return keys;\n    };\n\n}\n\n//\n// Date\n// ====\n//\n\n// ES5 15.9.5.43\n// Format a Date object as a string according to a simplified subset of the ISO 8601\n// standard as defined in 15.9.1.15.\nif (!Date.prototype.toISOString) {\n    Date.prototype.toISOString = function toISOString() {\n        var result, length, value;\n        if (!isFinite(this))\n            throw new RangeError;\n\n        // the date time string format is specified in 15.9.1.15.\n        result = [this.getUTCFullYear(), this.getUTCMonth() + 1, this.getUTCDate(),\n            this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];\n\n        length = result.length;\n        while (length--) {\n            value = result[length];\n            // pad months, days, hours, minutes, and seconds to have two digits.\n            if (value < 10)\n                result[length] = \"0\" + value;\n        }\n        // pad milliseconds to have three digits.\n        return result.slice(0, 3).join(\"-\") + \"T\" + result.slice(3).join(\":\") + \".\" +\n            (\"000\" + this.getUTCMilliseconds()).slice(-3) + \"Z\";\n    }\n}\n\n// ES5 15.9.4.4\nif (!Date.now) {\n    Date.now = function now() {\n        return new Date().getTime();\n    };\n}\n\n// ES5 15.9.5.44\nif (!Date.prototype.toJSON) {\n    Date.prototype.toJSON = function toJSON(key) {\n        // This function provides a String representation of a Date object for\n        // use by JSON.stringify (15.12.3). When the toJSON method is called\n        // with argument key, the following steps are taken:\n\n        // 1.  Let O be the result of calling ToObject, giving it the this\n        // value as its argument.\n        // 2. Let tv be ToPrimitive(O, hint Number).\n        // 3. If tv is a Number and is not finite, return null.\n        // XXX\n        // 4. Let toISO be the result of calling the [[Get]] internal method of\n        // O with argument \"toISOString\".\n        // 5. If IsCallable(toISO) is false, throw a TypeError exception.\n        if (typeof this.toISOString != \"function\")\n            throw new TypeError(); // TODO message\n        // 6. Return the result of calling the [[Call]] internal method of\n        // toISO with O as the this value and an empty argument list.\n        return this.toISOString();\n\n        // NOTE 1 The argument is ignored.\n\n        // NOTE 2 The toJSON function is intentionally generic; it does not\n        // require that its this value be a Date object. Therefore, it can be\n        // transferred to other kinds of objects for use as a method. However,\n        // it does require that any such object have a toISOString method. An\n        // object is free to use the argument key to filter its\n        // stringification.\n    };\n}\n\n// 15.9.4.2 Date.parse (string)\n// 15.9.1.15 Date Time String Format\n// Date.parse\n// based on work shared by Daniel Friesen (dantman)\n// http://gist.github.com/303249\nif (isNaN(Date.parse(\"2011-06-15T21:40:05+06:00\"))) {\n    // XXX global assignment won't work in embeddings that use\n    // an alternate object for the context.\n    Date = (function(NativeDate) {\n\n        // Date.length === 7\n        var Date = function Date(Y, M, D, h, m, s, ms) {\n            var length = arguments.length;\n            if (this instanceof NativeDate) {\n                var date = length == 1 && String(Y) === Y ? // isString(Y)\n                    // We explicitly pass it through parse:\n                    new NativeDate(Date.parse(Y)) :\n                    // We have to manually make calls depending on argument\n                    // length here\n                    length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :\n                    length >= 6 ? new NativeDate(Y, M, D, h, m, s) :\n                    length >= 5 ? new NativeDate(Y, M, D, h, m) :\n                    length >= 4 ? new NativeDate(Y, M, D, h) :\n                    length >= 3 ? new NativeDate(Y, M, D) :\n                    length >= 2 ? new NativeDate(Y, M) :\n                    length >= 1 ? new NativeDate(Y) :\n                                  new NativeDate();\n                // Prevent mixups with unfixed Date object\n                date.constructor = Date;\n                return date;\n            }\n            return NativeDate.apply(this, arguments);\n        };\n\n        // 15.9.1.15 Date Time String Format. This pattern does not implement\n        // extended years (15.9.1.15.1), as `Date.UTC` cannot parse them.\n        var isoDateExpression = new RegExp(\"^\" +\n            \"(\\\\d{4})\" + // four-digit year capture\n            \"(?:-(\\\\d{2})\" + // optional month capture\n            \"(?:-(\\\\d{2})\" + // optional day capture\n            \"(?:\" + // capture hours:minutes:seconds.milliseconds\n                \"T(\\\\d{2})\" + // hours capture\n                \":(\\\\d{2})\" + // minutes capture\n                \"(?:\" + // optional :seconds.milliseconds\n                    \":(\\\\d{2})\" + // seconds capture\n                    \"(?:\\\\.(\\\\d{3}))?\" + // milliseconds capture\n                \")?\" +\n            \"(?:\" + // capture UTC offset component\n                \"Z|\" + // UTC capture\n                \"(?:\" + // offset specifier +/-hours:minutes\n                    \"([-+])\" + // sign capture\n                    \"(\\\\d{2})\" + // hours offset capture\n                    \":(\\\\d{2})\" + // minutes offset capture\n                \")\" +\n            \")?)?)?)?\" +\n        \"$\");\n\n        // Copy any custom methods a 3rd party library may have added\n        for (var key in NativeDate)\n            Date[key] = NativeDate[key];\n\n        // Copy \"native\" methods explicitly; they may be non-enumerable\n        Date.now = NativeDate.now;\n        Date.UTC = NativeDate.UTC;\n        Date.prototype = NativeDate.prototype;\n        Date.prototype.constructor = Date;\n\n        // Upgrade Date.parse to handle simplified ISO 8601 strings\n        Date.parse = function parse(string) {\n            var match = isoDateExpression.exec(string);\n            if (match) {\n                match.shift(); // kill match[0], the full match\n                // parse months, days, hours, minutes, seconds, and milliseconds\n                for (var i = 1; i < 7; i++) {\n                    // provide default values if necessary\n                    match[i] = +(match[i] || (i < 3 ? 1 : 0));\n                    // match[1] is the month. Months are 0-11 in JavaScript\n                    // `Date` objects, but 1-12 in ISO notation, so we\n                    // decrement.\n                    if (i == 1)\n                        match[i]--;\n                }\n\n                // parse the UTC offset component\n                var minuteOffset = +match.pop(), hourOffset = +match.pop(), sign = match.pop();\n\n                // compute the explicit time zone offset if specified\n                var offset = 0;\n                if (sign) {\n                    // detect invalid offsets and return early\n                    if (hourOffset > 23 || minuteOffset > 59)\n                        return NaN;\n\n                    // express the provided time zone offset in minutes. The offset is\n                    // negative for time zones west of UTC; positive otherwise.\n                    offset = (hourOffset * 60 + minuteOffset) * 6e4 * (sign == \"+\" ? -1 : 1);\n                }\n\n                // compute a new UTC date value, accounting for the optional offset\n                return NativeDate.UTC.apply(this, match) + offset;\n            }\n            return NativeDate.parse.apply(this, arguments);\n        };\n\n        return Date;\n    })(Date);\n}\n\n//\n// String\n// ======\n//\n\n// ES5 15.5.4.20\nvar ws = \"\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\" +\n    \"\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\" +\n    \"\\u2029\\uFEFF\";\nif (!String.prototype.trim || ws.trim()) {\n    // http://blog.stevenlevithan.com/archives/faster-trim-javascript\n    // http://perfectionkills.com/whitespace-deviations/\n    ws = \"[\" + ws + \"]\";\n    var trimBeginRegexp = new RegExp(\"^\" + ws + ws + \"*\"),\n        trimEndRegexp = new RegExp(ws + ws + \"*$\");\n    String.prototype.trim = function trim() {\n        return String(this).replace(trimBeginRegexp, \"\").replace(trimEndRegexp, \"\");\n    };\n}\n\n//\n// Util\n// ======\n//\n\n// http://jsperf.com/to-integer\nvar toInteger = function (n) {\n    n = +n;\n    if (n !== n) // isNaN\n        n = -1;\n    else if (n !== 0 && n !== (1/0) && n !== -(1/0))\n        n = (n > 0 || -1) * Math.floor(Math.abs(n));\n    return n;\n};\n\nvar prepareString = \"a\"[0] != \"a\",\n    // ES5 9.9\n    toObject = function (o) {\n        if (o == null) { // this matches both null and undefined\n            throw new TypeError(); // TODO message\n        }\n        // If the implementation doesn't support by-index access of\n        // string characters (ex. IE < 7), split the string\n        if (prepareString && typeof o == \"string\" && o) {\n            return o.split(\"\");\n        }\n        return Object(o);\n    };\n});"
  },
  {
    "path": "javascripts/jquery.js",
    "content": "/*! jQuery v1.7.2 jquery.com | jquery.org/license */\n(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f(\"<\"+a+\">\").appendTo(b),e=d.css(\"display\");d.remove();if(e===\"none\"||e===\"\"){ck||(ck=c.createElement(\"iframe\"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?\"<!doctype html>\":\"\")+\"<html><body>\"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,\"display\"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject(\"Microsoft.XMLHTTP\")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==\"string\"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k===\"*\")k=l;else if(l!==\"*\"&&l!==k){m=l+\" \"+k,n=e[m]||e[\"* \"+k];if(!n){p=b;for(o in e){j=o.split(\" \");if(j[0]===l||j[0]===\"*\"){p=e[j[1]+\" \"+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error(\"No conversion from \"+m.replace(\" \",\" to \")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]===\"*\")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader(\"content-type\"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+\" \"+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+\"[\"+(typeof e==\"object\"?b:\"\")+\"]\",e,c,d)});else if(!c&&f.type(b)===\"object\")for(var e in b)b_(a+\"[\"+e+\"]\",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==\"string\"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g[\"*\"]&&(l=bZ(a,c,d,e,\"*\",g));return l}function bY(a){return function(b,c){typeof b!=\"string\"&&(c=b,b=\"*\");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\\+/.test(h),j&&(h=h.substr(1)||\"*\"),i=a[h]=a[h]||[],i[j?\"unshift\":\"push\"](c)}}}function bB(a,b,c){var d=b===\"width\"?a.offsetWidth:a.offsetHeight,e=b===\"width\"?1:0,g=4;if(d>0){if(c!==\"border\")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,\"padding\"+bx[e]))||0),c===\"margin\"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,\"border\"+bx[e]+\"Width\"))||0;return d+\"px\"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,\"padding\"+bx[e]))||0,c!==\"padding\"&&(d+=parseFloat(f.css(a,\"border\"+bx[e]+\"Width\"))||0),c===\"margin\"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+\"px\"}function bo(a){var b=c.createElement(\"div\");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||\"\").toLowerCase();b===\"input\"?bm(a):b!==\"script\"&&typeof a.getElementsByTagName!=\"undefined\"&&f.grep(a.getElementsByTagName(\"input\"),bm)}function bm(a){if(a.type===\"checkbox\"||a.type===\"radio\")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!=\"undefined\"?a.getElementsByTagName(\"*\"):typeof a.querySelectorAll!=\"undefined\"?a.querySelectorAll(\"*\"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c===\"object\"?b.outerHTML=a.outerHTML:c!==\"input\"||a.type!==\"checkbox\"&&a.type!==\"radio\"?c===\"option\"?b.selected=a.defaultSelected:c===\"input\"||c===\"textarea\"?b.defaultValue=a.defaultValue:c===\"script\"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute(\"_submit_attached\"),b.removeAttribute(\"_change_attached\"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,\"table\")?a.getElementsByTagName(\"tbody\")[0]||a.appendChild(a.ownerDocument.createElement(\"tbody\")):a}function U(a){var b=V.split(\"|\"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b==\"string\"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+\"defer\",e=b+\"queue\",g=b+\"mark\",h=f._data(a,d);h&&(c===\"queue\"||!f._data(a,e))&&(c===\"mark\"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b===\"data\"&&f.isEmptyObject(a[b]))continue;if(b!==\"toJSON\")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e=\"data-\"+c.replace(k,\"-$1\").toLowerCase();d=a.getAttribute(e);if(typeof d==\"string\"){try{d=d===\"true\"?!0:d===\"false\"?!1:d===\"null\"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll(\"left\")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\\w\\W]+>)[^>]*$|#([\\w\\-]*)$)/,j=/\\S/,k=/^\\s+/,l=/\\s+$/,m=/^<(\\w+)\\s*\\/?>(?:<\\/\\1>)?$/,n=/^[\\],:{}\\s]*$/,o=/\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,q=/(?:^|:|,)(?:\\s*\\[)+/g,r=/(webkit)[ \\/]([\\w.]+)/,s=/(opera)(?:.*version)?[ \\/]([\\w.]+)/,t=/(msie) ([\\w.]+)/,u=/(mozilla)(?:.*? rv:([\\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+\"\").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a===\"body\"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a==\"string\"){a.charAt(0)!==\"<\"||a.charAt(a.length-1)!==\">\"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:\"\",jquery:\"1.7.2\",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b===\"find\"?d.selector=this.selector+(this.selector?\" \":\"\")+c:b&&(d.selector=this.selector+\".\"+b+\"(\"+c+\")\");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),\"slice\",F.call(arguments).join(\",\"))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==\"boolean\"&&(l=i,i=arguments[1]||{},j=2),typeof i!=\"object\"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger(\"ready\").off(\"ready\")}},bindReady:function(){if(!A){A=e.Callbacks(\"once memory\");if(c.readyState===\"complete\")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener(\"DOMContentLoaded\",B,!1),a.addEventListener(\"load\",e.ready,!1);else if(c.attachEvent){c.attachEvent(\"onreadystatechange\",B),a.attachEvent(\"onload\",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)===\"function\"},isArray:Array.isArray||function(a){return e.type(a)===\"array\"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||\"object\"},isPlainObject:function(a){if(!a||e.type(a)!==\"object\"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,\"constructor\")&&!D.call(a.constructor.prototype,\"isPrototypeOf\"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!=\"string\"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,\"@\").replace(p,\"]\").replace(q,\"\")))return(new Function(\"return \"+b))();e.error(\"Invalid JSON: \"+b)},parseXML:function(c){if(typeof c!=\"string\"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,\"text/xml\")):(d=new ActiveXObject(\"Microsoft.XMLDOM\"),d.async=\"false\",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName(\"parsererror\").length)&&e.error(\"Invalid XML: \"+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,\"ms-\").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?\"\":G.call(a)}:function(a){return a==null?\"\":(a+\"\").replace(k,\"\").replace(l,\"\")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d===\"string\"||d===\"function\"||d===\"regexp\"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==\"number\")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j==\"number\"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c==\"string\"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d==\"object\"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf(\"compatible\")<0&&u.exec(a)||[];return{browser:b[1]||\"\",version:b[2]||\"0\"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each(\"Boolean Number String Function Array Date RegExp Object\".split(\" \"),function(a,b){I[\"[object \"+b+\"]\"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(\" \")&&(k=/^[\\s\\xA0]+/,l=/[\\s\\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener(\"DOMContentLoaded\",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState===\"complete\"&&(c.detachEvent(\"onreadystatechange\",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h===\"array\"?n(g):h===\"function\"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks(\"once memory\"),c=f.Callbacks(\"once memory\"),d=f.Callbacks(\"memory\"),e=\"pending\",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,\"resolve\"],fail:[b,\"reject\"],progress:[c,\"notify\"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+\"With\"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+\"With\"]=g[j].fireWith;i.done(function(){e=\"resolved\"},c.disable,d.lock).fail(function(){e=\"rejected\"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement(\"div\"),q=c.documentElement;p.setAttribute(\"className\",\"t\"),p.innerHTML=\"   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>\",d=p.getElementsByTagName(\"*\"),e=p.getElementsByTagName(\"a\")[0];if(!d||!d.length||!e)return{};g=c.createElement(\"select\"),h=g.appendChild(c.createElement(\"option\")),i=p.getElementsByTagName(\"input\")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName(\"tbody\").length,htmlSerialize:!!p.getElementsByTagName(\"link\").length,style:/top/.test(e.getAttribute(\"style\")),hrefNormalized:e.getAttribute(\"href\")===\"/a\",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value===\"on\",optSelected:h.selected,getSetAttribute:p.className!==\"t\",enctype:!!c.createElement(\"form\").enctype,html5Clone:c.createElement(\"nav\").cloneNode(!0).outerHTML!==\"<:nav></:nav>\",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode===\"CSS1Compat\",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent(\"onclick\",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent(\"onclick\")),i=c.createElement(\"input\"),i.value=\"t\",i.setAttribute(\"type\",\"radio\"),b.radioValue=i.value===\"t\",i.setAttribute(\"checked\",\"checked\"),i.setAttribute(\"name\",\"t\"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m=\"on\"+n,o=m in p,o||(p.setAttribute(m,\"return;\"),o=typeof p[m]==\"function\"),b[n+\"Bubbles\"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName(\"body\")[0];!u||(m=1,t=\"padding:0;margin:0;border:\",r=\"position:absolute;top:0;left:0;width:1px;height:1px;\",s=t+\"0;visibility:hidden;\",n=\"style='\"+r+t+\"5px solid #000;\",q=\"<div \"+n+\"display:block;'><div style='\"+t+\"0;display:block;overflow:hidden;'></div></div>\"+\"<table \"+n+\"' cellpadding='0' cellspacing='0'>\"+\"<tr><td></td></tr></table>\",d=c.createElement(\"div\"),d.style.cssText=s+\"width:0;height:0;position:static;top:0;margin-top:\"+m+\"px\",u.insertBefore(d,u.firstChild),p=c.createElement(\"div\"),d.appendChild(p),p.innerHTML=\"<table><tr><td style='\"+t+\"0;display:none'></td><td>t</td></tr></table>\",k=p.getElementsByTagName(\"td\"),o=k[0].offsetHeight===0,k[0].style.display=\"\",k[1].style.display=\"none\",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML=\"\",l=c.createElement(\"div\"),l.style.width=\"0\",l.style.marginRight=\"0\",p.style.width=\"2px\",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!=\"undefined\"&&(p.innerHTML=\"\",p.style.width=p.style.padding=\"1px\",p.style.border=0,p.style.overflow=\"hidden\",p.style.display=\"inline\",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display=\"block\",p.style.overflow=\"visible\",p.innerHTML=\"<div style='width:5px;'></div>\",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position=\"fixed\",g.style.top=\"20px\",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top=\"\",e.style.overflow=\"hidden\",e.style.position=\"relative\",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop=\"1%\",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!==\"1%\"),typeof d.style.zoom!=\"undefined\"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\\{.*\\}|\\[.*\\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:\"jQuery\"+(f.fn.jquery+Math.random()).replace(/\\D/g,\"\"),noData:{embed:!0,object:\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c==\"string\",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c===\"events\";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c==\"object\"||typeof c==\"function\")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(\" \")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute(\"classid\")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,\"parsedAttrs\")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf(\"data-\")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,\"parsedAttrs\",!0)}}return m}if(typeof a==\"object\")return this.each(function(){f.data(this,a)});d=a.split(\".\",2),d[1]=d[1]?\".\"+d[1]:\"\",e=d[1]+\"!\";return f.access(this,function(c){if(c===b){m=this.triggerHandler(\"getData\"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler(\"setData\"+e,d),f.data(this,a,c),b.triggerHandler(\"changeData\"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||\"fx\")+\"mark\",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||\"fx\";var d=c+\"mark\",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,\"mark\"))}},queue:function(a,b,c){var d;if(a){b=(b||\"fx\")+\"queue\",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||\"fx\";var c=f.queue(a,b),d=c.shift(),e={};d===\"inprogress\"&&(d=c.shift()),d&&(b===\"fx\"&&c.unshift(\"inprogress\"),f._data(a,b+\".run\",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+\"queue \"+b+\".run\",!0),n(a,b,\"queue\"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!=\"string\"&&(c=a,a=\"fx\",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a===\"fx\"&&b[0]!==\"inprogress\"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||\"fx\";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||\"fx\",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!=\"string\"&&(c=a,a=b),a=a||\"fx\";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+\"defer\",j=a+\"queue\",k=a+\"mark\",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks(\"once memory\"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\\n\\t\\r]/g,p=/\\s+/,q=/\\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a==\"string\"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=\" \"+e.className+\" \";for(h=0,i=b.length;h<i;h++)~g.indexOf(\" \"+b[h]+\" \")||(g+=b[h]+\" \");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a==\"string\"||a===b){c=(a||\"\").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(\" \"+g.className+\" \").replace(o,\" \");for(i=0,j=c.length;i<j;i++)h=h.replace(\" \"+c[i]+\" \",\" \");g.className=f.trim(h)}else g.className=\"\"}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b==\"boolean\";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c===\"string\"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?\"addClass\":\"removeClass\"](e)}else if(c===\"undefined\"||c===\"boolean\")this.className&&f._data(this,\"__className__\",this.className),this.className=this.className||a===!1?\"\":f._data(this,\"__className__\")||\"\"})},hasClass:function(a){var b=\" \"+a+\" \",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(\" \"+this[c].className+\" \").replace(o,\" \").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h=\"\":typeof h==\"number\"?h+=\"\":f.isArray(h)&&(h=f.map(h,function(a){return a==null?\"\":a+\"\"})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!(\"set\"in c)||c.set(this,h,\"value\")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&\"get\"in c&&(d=c.get(g,\"value\"))!==b)return d;d=g.value;return typeof d==\"string\"?d.replace(q,\"\"):d==null?\"\":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type===\"select-one\";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute(\"disabled\")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,\"optgroup\"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find(\"option\").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute==\"undefined\")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&\"set\"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,\"\"+d);return d}if(h&&\"get\"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,\"\"),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error(\"type property can't be changed\");else if(!f.support.radioValue&&b===\"radio\"&&f.nodeName(a,\"input\")){var c=a.value;a.setAttribute(\"type\",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,\"button\"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,\"button\"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:\"tabIndex\",readonly:\"readOnly\",\"for\":\"htmlFor\",\"class\":\"className\",maxlength:\"maxLength\",cellspacing:\"cellSpacing\",cellpadding:\"cellPadding\",rowspan:\"rowSpan\",colspan:\"colSpan\",usemap:\"useMap\",frameborder:\"frameBorder\",contenteditable:\"contentEditable\"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&\"set\"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&\"get\"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode(\"tabindex\");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!=\"boolean\"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!==\"\":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+\"\"}},f.attrHooks.tabindex.set=w.set,f.each([\"width\",\"height\"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===\"\"){a.setAttribute(b,\"auto\");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===\"\"&&(b=\"false\"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each([\"href\",\"src\",\"width\",\"height\"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=\"\"+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype=\"encoding\"),f.support.checkOn||f.each([\"radio\",\"checkbox\"],function(){f.valHooks[this]={get:function(a){return a.getAttribute(\"value\")===null?\"on\":a.value}}}),f.each([\"radio\",\"checkbox\"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\\.]*)?(?:\\.(.+))?$/,B=/(?:^|\\s)hover(\\.\\S+)?\\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\\w*)(?:#([\\w\\-]+))?(?:\\.([\\w\\-]+))?$/,G=function(\na){var b=F.exec(a);b&&(b[1]=(b[1]||\"\").toLowerCase(),b[3]=b[3]&&new RegExp(\"(?:^|\\\\s)\"+b[3]+\"(?:\\\\s|$)\"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c[\"class\"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,\"mouseenter$1 mouseleave$1\")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!=\"undefined\"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(\" \");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||\"\").split(\".\").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(\".\")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent(\"on\"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||\"\")).split(\" \");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp(\"(^|\\\\.)\"+l.split(\".\").sort().join(\"\\\\.(?:.*\\\\.)?\")+\"(\\\\.|$)\"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d===\"**\"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,[\"events\",\"handle\"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf(\"!\")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(\".\")>=0&&(i=h.split(\".\"),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c==\"object\"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join(\".\"),c.namespace_re=c.namespace?new RegExp(\"(^|\\\\.)\"+i.join(\"\\\\.(?:.*\\\\.)?\")+\"(\\\\.|$)\"):null,o=h.indexOf(\":\")<0?\"on\"+h:\"\";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,\"events\")||{})[c.type]&&f._data(m,\"handle\"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!==\"click\"||!f.nodeName(e,\"a\"))&&f.acceptData(e)&&o&&e[h]&&(h!==\"focus\"&&h!==\"blur\"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,\"events\")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!==\"click\")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:\"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which\".split(\" \"),fixHooks:{},keyHooks:{props:\"char charCode key keyCode\".split(\" \"),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:\"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement\".split(\" \"),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:\"focusin\"},blur:{delegateType:\"focusout\"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent(\"on\"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:\"mouseover\",mouseleave:\"mouseout\"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,\"form\"))return!1;f.event.add(this,\"click._submit keypress._submit\",function(a){var c=a.target,d=f.nodeName(c,\"input\")||f.nodeName(c,\"button\")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,\"submit._submit\",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate(\"submit\",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,\"form\"))return!1;f.event.remove(this,\"._submit\")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type===\"checkbox\"||this.type===\"radio\")f.event.add(this,\"propertychange._change\",function(a){a.originalEvent.propertyName===\"checked\"&&(this._just_changed=!0)}),f.event.add(this,\"click._change\",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate(\"change\",this,a,!0))});return!1}f.event.add(this,\"beforeactivate._change\",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,\"change._change\",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate(\"change\",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!==\"radio\"&&b.type!==\"checkbox\")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,\"._change\");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:\"focusin\",blur:\"focusout\"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a==\"object\"){typeof c!=\"string\"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c==\"string\"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+\".\"+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a==\"object\"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c==\"function\")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||\"**\",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,\"**\"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,\"lastToggle\"+a.guid)||0)%d;f._data(this,\"lastToggle\"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each(\"blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu\".split(\" \"),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!=\"string\"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\\((?:\\([^()]+\\)|[^()]+)+\\)|\\[(?:\\[[^\\[\\]]*\\]|['\"][^'\"]*['\"]|[^\\[\\]'\"]+)+\\]|\\\\.|[^ >+~,(\\[\\\\]+)+|[>+~])(\\s*,\\s*)?((?:.|\\r|\\n)*)/g,d=\"sizcache\"+(Math.random()+\"\").replace(\".\",\"\"),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\\\/g,k=/\\r\\n/g,l=/\\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=\"string\")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(\"\"),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]===\"~\"||w[0]===\"+\")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q=\"\",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)===\"[object Array]\")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!==\"\\\\\"){g[1]=(g[1]||\"\").replace(j,\"\"),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],\"\");break}}}}d||(d=typeof b.getElementsByTagName!=\"undefined\"?b.getElementsByTagName(\"*\"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)===\"\\\\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],\"\");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error(\"Syntax error, unrecognized expression: \"+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e=\"\";if(d){if(d===1||d===9||d===11){if(typeof a.textContent==\"string\")return a.textContent;if(typeof a.innerText==\"string\")return a.innerText.replace(k,\"\");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:[\"ID\",\"NAME\",\"TAG\"],match:{ID:/#((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)/,CLASS:/\\.((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)/,NAME:/\\[name=['\"]*((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)['\"]*\\]/,ATTR:/\\[\\s*((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)\\s*(?:(\\S?=)\\s*(?:(['\"])(.*?)\\3|(#?(?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)*)|)|)\\s*\\]/,TAG:/^((?:[\\w\\u00c0-\\uFFFF\\*\\-]|\\\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\\(\\s*(even|odd|(?:[+\\-]?\\d+|(?:[+\\-]?\\d*)?n\\s*(?:[+\\-]\\s*\\d+)?))\\s*\\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\))?(?=[^\\-]|$)/,PSEUDO:/:((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)(?:\\((['\"]?)((?:\\([^\\)]+\\)|[^\\(\\)]*)+)\\2\\))?/},leftMatch:{},attrMap:{\"class\":\"className\",\"for\":\"htmlFor\"},attrHandle:{href:function(a){return a.getAttribute(\"href\")},type:function(a){return a.getAttribute(\"type\")}},relative:{\"+\":function(a,b){var c=typeof b==\"string\",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},\">\":function(a,b){var c,d=typeof b==\"string\",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},\"\":function(a,b,c){var d,f=e++,g=x;typeof b==\"string\"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g(\"parentNode\",b,f,a,d,c)},\"~\":function(a,b,c){var d,f=e++,g=x;typeof b==\"string\"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g(\"previousSibling\",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=\"undefined\"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=\"undefined\"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute(\"name\")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=\"undefined\")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=\" \"+a[1].replace(j,\"\")+\" \";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(\" \"+h.className+\" \").replace(/[\\t\\n\\r]/g,\" \").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,\"\")},TAG:function(a,b){return a[1].replace(j,\"\").toLowerCase()},CHILD:function(a){if(a[1]===\"nth\"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\\+|\\s*/g,\"\");var b=/(-?)(\\d*)(?:n([+\\-]?\\d*))?/.exec(a[2]===\"even\"&&\"2n\"||a[2]===\"odd\"&&\"2n+1\"||!/\\D/.test(a[2])&&\"0n+\"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,\"\");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||\"\").replace(j,\"\"),a[2]===\"~=\"&&(a[4]=\" \"+a[4]+\" \");return a},PSEUDO:function(b,c,d,e,f){if(b[1]===\"not\")if((a.exec(b[3])||\"\").length>1||/^\\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!==\"hidden\"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute(\"type\"),c=a.type;return a.nodeName.toLowerCase()===\"input\"&&\"text\"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()===\"input\"&&\"radio\"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()===\"input\"&&\"checkbox\"===a.type},file:function(a){return a.nodeName.toLowerCase()===\"input\"&&\"file\"===a.type},password:function(a){return a.nodeName.toLowerCase()===\"input\"&&\"password\"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b===\"input\"||b===\"button\")&&\"submit\"===a.type},image:function(a){return a.nodeName.toLowerCase()===\"input\"&&\"image\"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b===\"input\"||b===\"button\")&&\"reset\"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b===\"input\"&&\"button\"===a.type||b===\"button\"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e===\"contains\")return(a.textContent||a.innerText||n([a])||\"\").indexOf(b[3])>=0;if(e===\"not\"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case\"only\":case\"first\":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k===\"first\")return!0;l=a;case\"last\":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case\"nth\":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute(\"id\")===b},TAG:function(a,b){return b===\"*\"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(\" \"+(a.className||a.getAttribute(\"class\"))+\" \").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+\"\",f=b[2],g=b[4];return d==null?f===\"!=\":!f&&m.attr?d!=null:f===\"=\"?e===g:f===\"*=\"?e.indexOf(g)>=0:f===\"~=\"?(\" \"+e+\" \").indexOf(g)>=0:g?f===\"!=\"?e!==g:f===\"^=\"?e.indexOf(g)===0:f===\"$=\"?e.substr(e.length-g.length)===g:f===\"|=\"?e===g||e.substr(0,g.length+1)===g+\"-\":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return\"\\\\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\\[]*\\])(?![^\\(]*\\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\\r|\\n)*?)/.source+o.match[r].source.replace(/\\\\(\\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)===\"[object Array]\")Array.prototype.push.apply(d,a);else if(typeof a.length==\"number\")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement(\"div\"),d=\"script\"+(new Date).getTime(),e=c.documentElement;a.innerHTML=\"<a name='\"+d+\"'/>\",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!=\"undefined\"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=\"undefined\"&&e.getAttributeNode(\"id\").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=\"undefined\"&&a.getAttributeNode(\"id\");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement(\"div\");a.appendChild(c.createComment(\"\")),a.getElementsByTagName(\"*\").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]===\"*\"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML=\"<a href='#'></a>\",a.firstChild&&typeof a.firstChild.getAttribute!=\"undefined\"&&a.firstChild.getAttribute(\"href\")!==\"#\"&&(o.attrHandle.href=function(a){return a.getAttribute(\"href\",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement(\"div\"),d=\"__sizzle__\";b.innerHTML=\"<p class='TEST'></p>\";if(!b.querySelectorAll||b.querySelectorAll(\".TEST\").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\\w+$)|^\\.([\\w\\-]+$)|^#([\\w\\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b===\"body\"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!==\"object\"){var k=e,l=e.getAttribute(\"id\"),n=l||d,p=e.parentNode,q=/^\\s*[+~]/.test(b);l?n=n.replace(/'/g,\"\\\\$&\"):e.setAttribute(\"id\",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll(\"[id='\"+n+\"'] \"+b),f)}catch(r){}finally{l||k.removeAttribute(\"id\")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement(\"div\"),\"div\"),e=!1;try{b.call(c.documentElement,\"[test!='']:sizzle\")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\\=\\s*([^'\"\\]]*)\\s*\\]/g,\"='$1']\");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement(\"div\");a.innerHTML=\"<div class='test e'></div><div class='test'></div>\";if(!!a.getElementsByClassName&&a.getElementsByClassName(\"e\").length!==0){a.lastChild.className=\"e\";if(a.getElementsByClassName(\"e\").length===1)return;o.order.splice(1,0,\"CLASS\"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=\"undefined\"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!==\"HTML\":!1};var y=function(a,b,c){var d,e=[],f=\"\",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,\"\");a=o.relative[a]?a+\"*\":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[\":\"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\\[\\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!=\"string\")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack(\"\",\"find\",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),\"not\",a)},filter:function(a){return this.pushStack(T(this,a,!0),\"filter\",a)},is:function(a){return!!a&&(typeof a==\"string\"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!=\"string\"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,\"closest\",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a==\"string\")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==\"string\"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,\"parentNode\")},parentsUntil:function(a,b,c){return f.dir(a,\"parentNode\",c)},next:function(a){return f.nth(a,2,\"nextSibling\")},prev:function(a){return f.nth(a,2,\"previousSibling\")},nextAll:function(a){return f.dir(a,\"nextSibling\")},prevAll:function(a){return f.dir(a,\"previousSibling\")},nextUntil:function(a,b,c){return f.dir(a,\"nextSibling\",c)},prevUntil:function(a,b,c){return f.dir(a,\"previousSibling\",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,\"iframe\")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d==\"string\"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(\",\"))}}),f.extend({filter:function(a,b,c){c&&(a=\":not(\"+a+\")\");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V=\"abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video\",W=/ jQuery\\d+=\"(?:\\d+|null)\"/g,X=/^\\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/ig,Z=/<([\\w:]+)/,$=/<tbody/i,_=/<|&#?\\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp(\"<(?:\"+V+\")[\\\\s/>]\",\"i\"),bd=/checked\\s*(?:[^=]|=\\s*.checked.)/i,be=/\\/(java|ecma)script/i,bf=/^\\s*<!(?:\\[CDATA\\[|\\-\\-)/,bg={option:[1,\"<select multiple='multiple'>\",\"</select>\"],legend:[1,\"<fieldset>\",\"</fieldset>\"],thead:[1,\"<table>\",\"</table>\"],tr:[2,\"<table><tbody>\",\"</tbody></table>\"],td:[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"],col:[2,\"<table><tbody></tbody><colgroup>\",\"</colgroup></table>\"],area:[1,\"<map>\",\"</map>\"],_default:[0,\"\",\"\"]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,\"div<div>\",\"</div>\"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,\"body\")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f\n.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,\"before\",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,\"after\",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName(\"*\")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName(\"*\"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,\"\"):null;if(typeof a==\"string\"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||[\"\",\"\"])[1].toLowerCase()]){a=a.replace(Y,\"<$1></$2>\");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName(\"*\")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!=\"string\"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),\"replaceWith\",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j==\"string\"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,\"tr\");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:\"GET\",global:!1,url:b.src,async:!1,dataType:\"script\"}):f.globalEval((b.text||b.textContent||b.innerHTML||\"\").replace(bf,\"/*$0*/\")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j==\"string\"&&j.length<512&&i===c&&j.charAt(0)===\"<\"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:\"append\",prependTo:\"prepend\",insertBefore:\"before\",insertAfter:\"after\",replaceAll:\"replaceWith\"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test(\"<\"+a.nodeName+\">\")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement==\"undefined\"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l==\"number\"&&(l+=\"\");if(!l)continue;if(typeof l==\"string\")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,\"<$1></$2>\");var m=(Z.exec(l)||[\"\",\"\"])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement(\"div\"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m===\"table\"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===\"<table>\"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],\"tbody\")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)==\"number\")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,\"script\")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName(\"script\"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\\([^)]*\\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\\-+]?(?:\\d*\\.)?\\d+$/i,bt=/^-?(?:\\d*\\.)?\\d+(?!px)[^\\d\\s]+$/i,bu=/^([\\-+])=([\\-+.\\de]+)/,bv=/^margin/,bw={position:\"absolute\",visibility:\"hidden\",display:\"block\"},bx=[\"Top\",\"Right\",\"Bottom\",\"Left\"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,\"opacity\");return c===\"\"?\"1\":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{\"float\":f.support.cssFloat?\"cssFloat\":\"styleFloat\"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&\"get\"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h===\"string\"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h=\"number\");if(d==null||h===\"number\"&&isNaN(d))return;h===\"number\"&&!f.cssNumber[i]&&(d+=\"px\");if(!k||!(\"set\"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c===\"cssFloat\"&&(c=\"float\");if(g&&\"get\"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,\"-$1\").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===\"\"&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b===\"fontSize\"?\"1em\":f,f=g.pixelLeft+\"px\",g.left=c,d&&(a.runtimeStyle.left=d));return f===\"\"?\"auto\":f}),by=bz||bA,f.each([\"height\",\"width\"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+\"px\":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||\"\")?parseFloat(RegExp.$1)/100+\"\":b?\"1\":\"\"},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?\"alpha(opacity=\"+b*100+\")\":\"\",g=d&&d.filter||c.filter||\"\";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,\"\"))===\"\"){c.removeAttribute(\"filter\");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+\" \"+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:\"inline-block\"},function(){return b?by(a,\"margin-right\"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,\"display\"))===\"none\"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:\"\",padding:\"\",border:\"Width\"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c==\"string\"?c.split(\" \"):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\\[\\]$/,bE=/\\r?\\n/g,bF=/#.*$/,bG=/^(.*?):[ \\t]*([^\\r\\n]*)\\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\\-storage|.+\\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\\/\\//,bL=/\\?/,bM=/<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\\w\\+\\.\\-]+:)(?:\\/\\/([^\\/?#:]*)(?::(\\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=[\"*/\"]+[\"*\"];try{bU=e.href}catch(bX){bU=c.createElement(\"a\"),bU.href=\"\",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!=\"string\"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(\" \");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h=\"GET\";c&&(f.isFunction(c)?(d=c,c=b):typeof c==\"object\"&&(c=f.param(c,f.ajaxSettings.traditional),h=\"POST\"));var i=this;f.ajax({url:a,type:h,dataType:\"html\",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f(\"<div>\").append(c.replace(bM,\"\")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,\"\\r\\n\")}}):{name:b.name,value:c.replace(bE,\"\\r\\n\")}}).get()}}),f.each(\"ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend\".split(\" \"),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each([\"get\",\"post\"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,\"script\")},getJSON:function(a,b,c){return f.get(a,b,c,\"json\")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:\"GET\",contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",processData:!0,async:!0,accepts:{xml:\"application/xml, text/xml\",html:\"text/html\",text:\"text/plain\",json:\"application/json, text/javascript\",\"*\":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:\"responseXML\",text:\"responseText\"},converters:{\"* text\":a.String,\"text html\":!0,\"text json\":f.parseJSON,\"text xml\":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||\"\",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader(\"Last-Modified\"))f.lastModified[k]=y;if(z=v.getResponseHeader(\"Etag\"))f.etag[k]=z}if(a===304)w=\"notmodified\",o=!0;else try{r=cb(d,x),w=\"success\",o=!0}catch(A){w=\"parsererror\",u=A}}else{u=w;if(!w||a)w=\"error\",a<0&&(a=0)}v.status=a,v.statusText=\"\"+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger(\"ajax\"+(o?\"Success\":\"Error\"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger(\"ajaxComplete\",[v,d]),--f.active||f.event.trigger(\"ajaxStop\"))}}typeof a==\"object\"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks(\"once memory\"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||\"abort\",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+\"\").replace(bF,\"\").replace(bK,bV[1]+\"//\"),d.dataTypes=f.trim(d.dataType||\"*\").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]===\"http:\"?80:443))==(bV[3]||(bV[1]===\"http:\"?80:443)))),d.data&&d.processData&&typeof d.data!=\"string\"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger(\"ajaxStart\");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?\"&\":\"?\")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,\"$1_=\"+x);d.url=y+(y===d.url?(bL.test(d.url)?\"&\":\"?\")+\"_=\"+x:\"\")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader(\"Content-Type\",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader(\"If-Modified-Since\",f.lastModified[k]),f.etag[k]&&v.setRequestHeader(\"If-None-Match\",f.etag[k])),v.setRequestHeader(\"Accept\",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!==\"*\"?\", \"+bW+\"; q=0.01\":\"\"):d.accepts[\"*\"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,\"No Transport\");else{v.readyState=1,t&&g.trigger(\"ajaxSend\",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort(\"timeout\")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+\"=\"+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join(\"&\").replace(bC,\"+\")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\\=)\\?(&|$)|\\?\\?/i;f.ajaxSetup({jsonp:\"callback\",jsonpCallback:function(){return f.expando+\"_\"+cc++}}),f.ajaxPrefilter(\"json jsonp\",function(b,c,d){var e=typeof b.data==\"string\"&&/^application\\/x\\-www\\-form\\-urlencoded/.test(b.contentType);if(b.dataTypes[0]===\"jsonp\"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l=\"$1\"+h+\"$2\";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\\?/.test(j)?\"&\":\"?\")+b.jsonp+\"=\"+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters[\"script json\"]=function(){g||f.error(h+\" was not called\");return g[0]},b.dataTypes[0]=\"json\";return\"script\"}}),f.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/javascript|ecmascript/},converters:{\"text script\":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter(\"script\",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type=\"GET\",a.global=!1)}),f.ajaxTransport(\"script\",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName(\"head\")[0]||c.documentElement;return{send:function(f,g){d=c.createElement(\"script\"),d.async=\"async\",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,\"success\")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&\"withCredentials\"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e[\"X-Requested-With\"]&&(e[\"X-Requested-With\"]=\"XMLHttpRequest\");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=\"\"}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\\-]=)?([\\d+.\\-]+)([a-z%]*)$/i,co,cp=[[\"height\",\"marginTop\",\"marginBottom\",\"paddingTop\",\"paddingBottom\"],[\"width\",\"marginLeft\",\"marginRight\",\"paddingLeft\",\"paddingRight\"],[\"opacity\"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct(\"show\",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,\"olddisplay\")&&e===\"none\"&&(e=d.style.display=\"\"),(e===\"\"&&f.css(d,\"display\")===\"none\"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,\"olddisplay\",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===\"\"||e===\"none\")d.style.display=f._data(d,\"olddisplay\")||\"\"}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct(\"hide\",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,\"display\"),e!==\"none\"&&!f._data(d,\"olddisplay\")&&f._data(d,\"olddisplay\",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display=\"none\");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a==\"boolean\";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(\":hidden\");f(this)[b?\"show\":\"hide\"]()}):this.animate(ct(\"toggle\",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(\":hidden\").css(\"opacity\",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(\":hidden\"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&\"expand\"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||\"swing\";if(h===\"hide\"&&d||h===\"show\"&&!d)return b.complete.call(this);c&&(g===\"height\"||g===\"width\")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,\"display\")===\"inline\"&&f.css(this,\"float\")===\"none\"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)===\"inline\"?this.style.display=\"inline-block\":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow=\"hidden\");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,\"toggle\"+i)||(h===\"toggle\"?d?\"show\":\"hide\":0),q?(f._data(this,\"toggle\"+i,q===\"show\"?\"hide\":\"show\"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?\"\":\"px\"),p!==\"px\"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]===\"-=\"?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,\"\"));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!=\"string\"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||\"fx\",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(\".run\")===b.length-4&&h(this,g,b);else g[b=a+\".run\"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct(\"show\",1),slideUp:ct(\"hide\",1),slideToggle:ct(\"toggle\",1),fadeIn:{opacity:\"show\"},fadeOut:{opacity:\"hide\"},fadeToggle:{opacity:\"toggle\"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a==\"object\"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration==\"number\"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue=\"fx\";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b===\"auto\"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?\"\":\"px\"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,\"fxshow\"+e.prop)===b&&(e.options.hide?f._data(e.elem,\"fxshow\"+e.prop,e.start):e.options.show&&f._data(e.elem,\"fxshow\"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,\"fxshow\"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop===\"width\"||this.prop===\"height\"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,\"fxshow\"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each([\"\",\"X\",\"Y\"],function(a,b){h.style[\"overflow\"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,\"fxshow\"+b,!0),f.removeData(h,\"toggle\"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,\"opacity\",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf(\"margin\")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;\"getBoundingClientRect\"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position===\"fixed\")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!==\"visible\"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position===\"relative\"||j.position===\"static\")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position===\"fixed\"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,\"marginTop\"))||0,c+=parseFloat(f.css(a,\"marginLeft\"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,\"position\");d===\"static\"&&(a.style.position=\"relative\");var e=f(a),g=e.offset(),h=f.css(a,\"top\"),i=f.css(a,\"left\"),j=(d===\"absolute\"||d===\"fixed\")&&f.inArray(\"auto\",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),\"using\"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,\"marginTop\"))||0,c.left-=parseFloat(f.css(a,\"marginLeft\"))||0,d.top+=parseFloat(f.css(b[0],\"borderTopWidth\"))||0,d.left+=parseFloat(f.css(b[0],\"borderLeftWidth\"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,\"position\")===\"static\")a=a.offsetParent;return a})}}),f.each({scrollLeft:\"pageXOffset\",scrollTop:\"pageYOffset\"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:\"height\",Width:\"width\"},function(a,c){var d=\"client\"+a,e=\"scroll\"+a,g=\"offset\"+a;f.fn[\"inner\"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,\"padding\")):this[c]():null},f.fn[\"outer\"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?\"margin\":\"border\")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define==\"function\"&&define.amd&&define.amd.jQuery&&define(\"jquery\",[],function(){return f})})(window);"
  },
  {
    "path": "lib/dashing/app.rb",
    "content": "require 'sinatra'\nrequire 'sprockets'\nrequire 'sinatra/content_for'\nrequire 'rufus/scheduler'\nrequire 'coffee-script'\nrequire 'sass'\nrequire 'json'\nrequire 'yaml'\nrequire 'thin'\n\nSCHEDULER = Rufus::Scheduler.new\n\ndef development?\n  ENV['RACK_ENV'] == 'development'\nend\n\ndef production?\n  ENV['RACK_ENV'] == 'production'\nend\n\nhelpers Sinatra::ContentFor\nhelpers do\n  def protected!\n    # override with auth logic\n  end\n\n  def authenticated?(token)\n    return true unless settings.auth_token\n    token && Rack::Utils.secure_compare(settings.auth_token, token)\n  end\nend\n\nset :root, Dir.pwd\nset :sprockets,     Sprockets::Environment.new(settings.root)\nset :assets_prefix, '/assets'\nset :digest_assets, false\nset server: 'thin', connections: [], history_file: 'history.yml'\nset :public_folder, File.join(settings.root, 'public')\nset :views, File.join(settings.root, 'dashboards')\nset :default_dashboard, nil\nset :auth_token, nil\n\nif File.exists?(settings.history_file)\n  set history: YAML.load_file(settings.history_file)\nelse\n  set history: {}\nend\n\n%w(javascripts stylesheets fonts images).each do |path|\n  settings.sprockets.append_path(\"assets/#{path}\")\nend\n\n['widgets', File.expand_path('../../../javascripts', __FILE__)]. each do |path|\n  settings.sprockets.append_path(path)\nend\n\nnot_found do\n  send_file File.join(settings.public_folder, '404.html'), status: 404\nend\n\nat_exit do\n  File.write(settings.history_file, settings.history.to_yaml)\nend\n\nget '/' do\n  protected!\n  dashboard = settings.default_dashboard || first_dashboard\n  raise Exception.new('There are no dashboards available') if not dashboard\n\n  redirect \"/\" + dashboard\nend\n\nget '/events', provides: 'text/event-stream' do\n  protected!\n  response.headers['X-Accel-Buffering'] = 'no' # Disable buffering for nginx\n  stream :keep_open do |out|\n    settings.connections << out\n    out << latest_events\n    out.callback { settings.connections.delete(out) }\n  end\nend\n\nget '/:dashboard' do\n  protected!\n  tilt_html_engines.each do |suffix, _|\n    file = File.join(settings.views, \"#{params[:dashboard]}.#{suffix}\")\n    return render(suffix.to_sym, params[:dashboard].to_sym) if File.exist? file\n  end\n\n  halt 404\nend\n\npost '/dashboards/:id' do\n  request.body.rewind\n  body = JSON.parse(request.body.read)\n  body['dashboard'] ||= params['id']\n  if authenticated?(body.delete(\"auth_token\"))\n    send_event(params['id'], body, 'dashboards')\n    204 # response without entity body\n  else\n    status 401\n    \"Invalid API key\\n\"\n  end\nend\n\npost '/widgets/:id' do\n  request.body.rewind\n  body = JSON.parse(request.body.read)\n  if authenticated?(body.delete(\"auth_token\"))\n    send_event(params['id'], body)\n    204 # response without entity body\n  else\n    status 401\n    \"Invalid API key\\n\"\n  end\nend\n\nget '/views/:widget?.html' do\n  protected!\n  tilt_html_engines.each do |suffix, engines|\n    file = File.join(settings.root, \"widgets\", params[:widget], \"#{params[:widget]}.#{suffix}\")\n    return engines.first.new(file).render if File.exist? file\n  end\nend\n\nThin::Server.class_eval do\n  def stop_with_connection_closing\n    Sinatra::Application.settings.connections.dup.each(&:close)\n    stop_without_connection_closing\n  end\n\n  alias_method :stop_without_connection_closing, :stop\n  alias_method :stop, :stop_with_connection_closing\nend\n\ndef send_event(id, body, target=nil)\n  body[:id] = id\n  body[:updatedAt] ||= Time.now.to_i\n  event = format_event(body.to_json, target)\n  Sinatra::Application.settings.history[id] = event unless target == 'dashboards'\n  Sinatra::Application.settings.connections.each { |out| out << event }\nend\n\ndef format_event(body, name=nil)\n  str = \"\"\n  str << \"event: #{name}\\n\" if name\n  str << \"data: #{body}\\n\\n\"\nend\n\ndef latest_events\n  settings.history.inject(\"\") do |str, (id, body)|\n    str << body\n  end\nend\n\ndef first_dashboard\n  files = Dir[File.join(settings.views, '*')].collect { |f| File.basename(f, '.*') }\n  files -= ['layout']\n  files.sort.first\nend\n\ndef tilt_html_engines\n  Tilt.mappings.select do |_, engines|\n    default_mime_type = engines.first.default_mime_type\n    default_mime_type.nil? || default_mime_type == 'text/html'\n  end\nend\n\ndef require_glob(relative_glob)\n  Dir[File.join(settings.root, relative_glob)].each do |file|\n    require file\n  end\nend\n\nsettings_file = File.join(settings.root, 'config/settings.rb')\nrequire settings_file if File.exists?(settings_file)\n\n{}.to_json # Forces your json codec to initialize (in the event that it is lazily loaded). Does this before job threads start.\njob_path = ENV[\"JOB_PATH\"] || 'jobs'\nrequire_glob(File.join('lib', '**', '*.rb'))\nrequire_glob(File.join(job_path, '**', '*.rb'))\n"
  },
  {
    "path": "lib/dashing/cli.rb",
    "content": "require 'thor'\nrequire 'open-uri'\n\nmodule Dashing\n  class CLI < Thor\n    include Thor::Actions\n\n    attr_reader :name\n\n    class << self\n      attr_accessor :auth_token\n\n      def hyphenate(str)\n        return str.downcase if str =~ /^[A-Z-]+$/\n        str.gsub('_', '-').gsub(/\\B[A-Z]/, '-\\&').squeeze('-').downcase\n      end\n    end\n\n    no_tasks do\n      %w(widget dashboard job).each do |type|\n        define_method \"generate_#{type}\" do |name|\n          @name = Thor::Util.snake_case(name)\n          directory(type.to_sym, \"#{type}s\")\n        end\n      end\n    end\n\n    desc \"new PROJECT_NAME\", \"Sets up ALL THE THINGS needed for your dashboard project.\"\n    def new(name)\n      @name = Thor::Util.snake_case(name)\n      directory(:project, @name)\n    end\n\n    desc \"generate (widget/dashboard/job) NAME\", \"Creates a new widget, dashboard, or job.\"\n    def generate(type, name)\n      public_send(\"generate_#{type}\".to_sym, name)\n    rescue NoMethodError => e\n      puts \"Invalid generator. Either use widget, dashboard, or job\"\n    end\n\n    desc \"install GIST_ID [--skip]\", \"Installs a new widget from a gist (skip overwrite).\"\n    def install(gist_id, *args)\n      gist = Downloader.get_gist(gist_id)\n      public_url = \"https://gist.github.com/#{gist_id}\"\n\n      install_widget_from_gist(gist, args.include?('--skip'))\n\n      print set_color(\"Don't forget to edit the \", :yellow)\n      print set_color(\"Gemfile \", :yellow, :bold)\n      print set_color(\"and run \", :yellow)\n      print set_color(\"bundle install \", :yellow, :bold)\n      say set_color(\"if needed. More information for this widget can be found at #{public_url}\", :yellow)\n    rescue OpenURI::HTTPError => http_error\n      say set_color(\"Could not find gist at #{public_url}\"), :red\n    end\n\n    desc \"start\", \"Starts the server in style!\"\n    method_option :job_path, :desc => \"Specify the directory where jobs are stored\"\n    def start(*args)\n      port_option = args.include?('-p') ? '' : ' -p 3030'\n      args = args.join(' ')\n      command = \"bundle exec thin -R config.ru start#{port_option} #{args}\"\n      command.prepend \"export JOB_PATH=#{options[:job_path]}; \" if options[:job_path]\n      run_command(command)\n    end\n\n    desc \"stop\", \"Stops the thin server\"\n    def stop\n      command = \"bundle exec thin stop\"\n      run_command(command)\n    end\n\n    desc \"job JOB_NAME AUTH_TOKEN(optional)\", \"Runs the specified job. Make sure to supply your auth token if you have one set.\"\n    def job(name, auth_token = \"\")\n      Dir[File.join(Dir.pwd, 'lib/**/*.rb')].each {|file| require_file(file) }\n      self.class.auth_token = auth_token\n      f = File.join(Dir.pwd, \"jobs\", \"#{name}.rb\")\n      require_file(f)\n    end\n\n    # map some commands\n    map 'g' => :generate\n    map 'i' => :install\n    map 's' => :start\n\n    private\n\n    def run_command(command)\n      system(command)\n    end\n\n    def install_widget_from_gist(gist, skip_overwrite)\n      gist['files'].each do |file, details|\n        if file =~ /\\.(html|coffee|scss)\\z/\n          widget_name = File.basename(file, '.*')\n          new_path = File.join(Dir.pwd, 'widgets', widget_name, file)\n          create_file(new_path, details['content'], :skip => skip_overwrite)\n        elsif file.end_with?('.rb')\n          new_path = File.join(Dir.pwd, 'jobs', file)\n          create_file(new_path, details['content'], :skip => skip_overwrite)\n        end\n      end\n    end\n\n    def require_file(file)\n      require file\n    end\n  end\nend\n"
  },
  {
    "path": "lib/dashing/downloader.rb",
    "content": "require 'net/http'\nrequire 'open-uri'\nrequire 'json'\n\nmodule Dashing\n  module Downloader\n    extend self\n\n    def get_gist(gist_id)\n      get_json(\"https://api.github.com/gists/#{gist_id}\")\n    end\n\n    def get_json(url)\n      response = open(url).read\n      JSON.parse(response)\n    end\n  end\nend\n"
  },
  {
    "path": "lib/dashing.rb",
    "content": "require 'dashing/cli'\nrequire 'dashing/downloader'\nrequire 'dashing/app'\n\nmodule Dashing\nend"
  },
  {
    "path": "shipit.rubygems.yml",
    "content": "# using the default shipit config\n"
  },
  {
    "path": "templates/dashboard/%name%.erb.tt",
    "content": "<div class=\"gridster\">\n  <ul>\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"1\">\n      <div data-id=\"my_widget\" data-view=\"Text\"></div>\n    </li>\n  </ul>\n</div>"
  },
  {
    "path": "templates/job/%name%.rb",
    "content": "# :first_in sets how long it takes before the job is first run. In this case, it is run immediately\nSCHEDULER.every '1m', :first_in => 0 do |job|\n  send_event('widget_id', { })\nend"
  },
  {
    "path": "templates/project/.gitignore",
    "content": "*DS_STORE\nhistory.yml\n"
  },
  {
    "path": "templates/project/Gemfile",
    "content": "source 'https://rubygems.org'\n\ngem 'dashing'\n\n## Remove this if you don't need a twitter widget.\ngem 'twitter', '>= 5.9.0'"
  },
  {
    "path": "templates/project/README.md",
    "content": "Check out http://shopify.github.com/dashing for more information."
  },
  {
    "path": "templates/project/assets/javascripts/application.coffee",
    "content": "# dashing.js is located in the dashing framework\n# It includes jquery & batman for you.\n#= require dashing.js\n\n#= require_directory .\n#= require_tree ../../widgets\n\nconsole.log(\"Yeah! The dashboard has started!\")\n\nDashing.on 'ready', ->\n  Dashing.widget_margins ||= [5, 5]\n  Dashing.widget_base_dimensions ||= [300, 360]\n  Dashing.numColumns ||= 4\n\n  contentWidth = (Dashing.widget_base_dimensions[0] + Dashing.widget_margins[0] * 2) * Dashing.numColumns\n\n  Batman.setImmediate ->\n    $('.gridster').width(contentWidth)\n    $('.gridster ul:first').gridster\n      widget_margins: Dashing.widget_margins\n      widget_base_dimensions: Dashing.widget_base_dimensions\n      avoid_overlapped_widgets: !Dashing.customGridsterLayout\n      draggable:\n        stop: Dashing.showGridsterInstructions\n        start: -> Dashing.currentWidgetPositions = Dashing.getWidgetPositions()\n"
  },
  {
    "path": "templates/project/assets/javascripts/d3-3.2.8.js",
    "content": "d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function i(){}function u(){}function a(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function o(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=Ca.length;r>e;++e){var i=Ca[e]+t;if(i in n)return i}}function c(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}function l(n){return Array.prototype.slice.call(n)}function s(){}function f(){}function h(n){function t(){for(var t,r=e,i=-1,u=r.length;++i<u;)(t=r[i].on)&&t.apply(this,arguments);return n}var e=[],r=new i;return t.on=function(t,i){var u,a=r.get(t);return arguments.length<2?a&&a.on:(a&&(a.on=null,e=e.slice(0,u=e.indexOf(a)).concat(e.slice(u+1)),r.remove(t)),i&&e.push(r.set(t,{on:i})),n)},t}function g(){ya.event.preventDefault()}function p(){for(var n,t=ya.event;n=t.sourceEvent;)t=n;return t}function m(n){for(var t=new f,e=0,r=arguments.length;++e<r;)t[arguments[e]]=h(t);return t.of=function(e,r){return function(i){try{var u=i.sourceEvent=ya.event;i.target=n,ya.event=i,t[i.type].apply(e,r)}finally{ya.event=u}}},t}function d(n){return La(n,Ya),n}function v(n){return\"function\"==typeof n?n:function(){return Ha(n,this)}}function y(n){return\"function\"==typeof n?n:function(){return Fa(n,this)}}function M(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function i(){this.setAttribute(n,t)}function u(){this.setAttributeNS(n.space,n.local,t)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=ya.ns.qualify(n),null==t?n.local?r:e:\"function\"==typeof t?n.local?o:a:n.local?u:i}function x(n){return n.trim().replace(/\\s+/g,\" \")}function b(n){return new RegExp(\"(?:^|\\\\s+)\"+ya.requote(n)+\"(?:\\\\s+|$)\",\"g\")}function _(n,t){function e(){for(var e=-1;++e<i;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<i;)n[e](this,r)}n=n.trim().split(/\\s+/).map(w);var i=n.length;return\"function\"==typeof t?r:e}function w(n){var t=b(n);return function(e,r){if(i=e.classList)return r?i.add(n):i.remove(n);var i=e.getAttribute(\"class\")||\"\";r?(t.lastIndex=0,t.test(i)||e.setAttribute(\"class\",x(i+\" \"+n))):e.setAttribute(\"class\",x(i.replace(t,\" \")))}}function S(n,t,e){function r(){this.style.removeProperty(n)}function i(){this.style.setProperty(n,t,e)}function u(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:\"function\"==typeof t?u:i}function E(n,t){function e(){delete this[n]}function r(){this[n]=t}function i(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:\"function\"==typeof t?i:r}function k(n){return\"function\"==typeof n?n:(n=ya.ns.qualify(n)).local?function(){return Ma.createElementNS(n.space,n.local)}:function(){return Ma.createElementNS(this.namespaceURI,n)}}function A(n){return{__data__:n}}function N(n){return function(){return Oa(this,n)}}function q(n){return arguments.length||(n=ya.ascending),function(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}}function T(n,t){for(var e=0,r=n.length;r>e;e++)for(var i,u=n[e],a=0,o=u.length;o>a;a++)(i=u[a])&&t(i,a,e);return n}function C(n){return La(n,Ua),n}function z(n){var t,e;return function(r,i,u){var a,o=n[u].update,c=o.length;for(u!=e&&(e=u,t=0),i>=t&&(t=i+1);!(a=o[t])&&++t<c;);return a}}function D(n,t,e){function r(){var t=this[a];t&&(this.removeEventListener(n,t,t.$),delete this[a])}function i(){var i=c(t,za(arguments));r.call(this),this.addEventListener(n,this[a]=i,i.$=e),i._=t}function u(){var t,e=new RegExp(\"^__on([^.]+)\"+ya.requote(n)+\"$\");for(var r in this)if(t=r.match(e)){var i=this[r];this.removeEventListener(t[1],i,i.$),delete this[r]}}var a=\"__on\"+n,o=n.indexOf(\".\"),c=j;o>0&&(n=n.substring(0,o));var l=Va.get(n);return l&&(n=l,c=L),o?t?i:r:t?s:u}function j(n,t){return function(e){var r=ya.event;ya.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ya.event=r}}}function L(n,t){var e=j(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function H(){var n=\".dragsuppress-\"+ ++Za,t=\"touchmove\"+n,e=\"selectstart\"+n,r=\"dragstart\"+n,i=\"click\"+n,u=ya.select(ba).on(t,g).on(e,g).on(r,g),a=xa.style,o=a[Xa];return a[Xa]=\"none\",function(t){function e(){u.on(i,null)}u.on(n,null),a[Xa]=o,t&&(u.on(i,function(){g(),e()},!0),setTimeout(e,0))}}function F(n,t){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>Ba&&(ba.scrollX||ba.scrollY)){e=ya.select(\"body\").append(\"svg\").style({position:\"absolute\",top:0,left:0,margin:0,padding:0,border:\"none\"},\"important\");var i=e[0][0].getScreenCTM();Ba=!(i.f||i.e),e.remove()}return Ba?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var u=n.getBoundingClientRect();return[t.clientX-u.left-n.clientLeft,t.clientY-u.top-n.clientTop]}function P(){}function O(n,t,e){return new Y(n,t,e)}function Y(n,t,e){this.h=n,this.s=t,this.l=e}function R(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?u+(a-u)*n/60:180>n?a:240>n?u+(a-u)*(240-n)/60:u}function i(n){return Math.round(255*r(n))}var u,a;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,a=.5>=e?e*(1+t):e+t-e*t,u=2*e-a,at(i(n+120),i(n),i(n-120))}function U(n){return n>0?1:0>n?-1:0}function I(n){return n>1?0:-1>n?Ka:Math.acos(n)}function V(n){return n>1?Ka/2:-1>n?-Ka/2:Math.asin(n)}function X(n){return(Math.exp(n)-Math.exp(-n))/2}function Z(n){return(Math.exp(n)+Math.exp(-n))/2}function B(n){return(n=Math.sin(n/2))*n}function $(n,t,e){return new W(n,t,e)}function W(n,t,e){this.h=n,this.c=t,this.l=e}function J(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),G(e,Math.cos(n*=to)*t,Math.sin(n)*t)}function G(n,t,e){return new K(n,t,e)}function K(n,t,e){this.l=n,this.a=t,this.b=e}function Q(n,t,e){var r=(n+16)/116,i=r+t/500,u=r-e/200;return i=tt(i)*uo,r=tt(r)*ao,u=tt(u)*oo,at(rt(3.2404542*i-1.5371385*r-.4985314*u),rt(-.969266*i+1.8760108*r+.041556*u),rt(.0556434*i-.2040259*r+1.0572252*u))}function nt(n,t,e){return n>0?$(Math.atan2(e,t)*eo,Math.sqrt(t*t+e*e),n):$(0/0,0/0,n)}function tt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function et(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function rt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function it(n){return at(n>>16,255&n>>8,255&n)}function ut(n){return it(n)+\"\"}function at(n,t,e){return new ot(n,t,e)}function ot(n,t,e){this.r=n,this.g=t,this.b=e}function ct(n){return 16>n?\"0\"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function lt(n,t,e){var r,i,u,a=0,o=0,c=0;if(r=/([a-z]+)\\((.*)\\)/i.exec(n))switch(i=r[2].split(\",\"),r[1]){case\"hsl\":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case\"rgb\":return t(gt(i[0]),gt(i[1]),gt(i[2]))}return(u=so.get(n))?t(u.r,u.g,u.b):(null!=n&&\"#\"===n.charAt(0)&&(4===n.length?(a=n.charAt(1),a+=a,o=n.charAt(2),o+=o,c=n.charAt(3),c+=c):7===n.length&&(a=n.substring(1,3),o=n.substring(3,5),c=n.substring(5,7)),a=parseInt(a,16),o=parseInt(o,16),c=parseInt(c,16)),t(a,o,c))}function st(n,t,e){var r,i,u=Math.min(n/=255,t/=255,e/=255),a=Math.max(n,t,e),o=a-u,c=(a+u)/2;return o?(i=.5>c?o/(a+u):o/(2-a-u),r=n==a?(t-e)/o+(e>t?6:0):t==a?(e-n)/o+2:(n-t)/o+4,r*=60):(r=0/0,i=c>0&&1>c?0:r),O(r,i,c)}function ft(n,t,e){n=ht(n),t=ht(t),e=ht(e);var r=et((.4124564*n+.3575761*t+.1804375*e)/uo),i=et((.2126729*n+.7151522*t+.072175*e)/ao),u=et((.0193339*n+.119192*t+.9503041*e)/oo);return G(116*i-16,500*(r-i),200*(i-u))}function ht(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function gt(n){var t=parseFloat(n);return\"%\"===n.charAt(n.length-1)?Math.round(2.55*t):t}function pt(n){return\"function\"==typeof n?n:function(){return n}}function mt(n){return n}function dt(n){return function(t,e,r){return 2===arguments.length&&\"function\"==typeof e&&(r=e,e=null),vt(t,e,n,r)}}function vt(n,t,e,r){function i(){var n,t=c.status;if(!t&&c.responseText||t>=200&&300>t||304===t){try{n=e.call(u,c)}catch(r){return a.error.call(u,r),void 0}a.load.call(u,n)}else a.error.call(u,c)}var u={},a=ya.dispatch(\"progress\",\"load\",\"error\"),o={},c=new XMLHttpRequest,l=null;return!ba.XDomainRequest||\"withCredentials\"in c||!/^(http(s)?:)?\\/\\//.test(n)||(c=new XDomainRequest),\"onload\"in c?c.onload=c.onerror=i:c.onreadystatechange=function(){c.readyState>3&&i()},c.onprogress=function(n){var t=ya.event;ya.event=n;try{a.progress.call(u,c)}finally{ya.event=t}},u.header=function(n,t){return n=(n+\"\").toLowerCase(),arguments.length<2?o[n]:(null==t?delete o[n]:o[n]=t+\"\",u)},u.mimeType=function(n){return arguments.length?(t=null==n?null:n+\"\",u):t},u.responseType=function(n){return arguments.length?(l=n,u):l},u.response=function(n){return e=n,u},[\"get\",\"post\"].forEach(function(n){u[n]=function(){return u.send.apply(u,[n].concat(za(arguments)))}}),u.send=function(e,r,i){if(2===arguments.length&&\"function\"==typeof r&&(i=r,r=null),c.open(e,n,!0),null==t||\"accept\"in o||(o.accept=t+\",*/*\"),c.setRequestHeader)for(var a in o)c.setRequestHeader(a,o[a]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=i&&u.on(\"error\",i).on(\"load\",function(n){i(null,n)}),c.send(null==r?null:r),u},u.abort=function(){return c.abort(),u},ya.rebind(u,a,\"on\"),null==r?u:u.get(yt(r))}function yt(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function Mt(){var n=bt(),t=_t()-n;t>24?(isFinite(t)&&(clearTimeout(po),po=setTimeout(Mt,t)),go=0):(go=1,vo(Mt))}function xt(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now()),mo.callback=n,mo.time=e+t}function bt(){var n=Date.now();for(mo=fo;mo;)n>=mo.time&&(mo.flush=mo.callback(n-mo.time)),mo=mo.next;return n}function _t(){for(var n,t=fo,e=1/0;t;)t.flush?t=n?n.next=t.next:fo=t.next:(t.time<e&&(e=t.time),t=(n=t).next);return ho=n,e}function wt(n,t){var e=Math.pow(10,3*Math.abs(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function St(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Et(n){return n+\"\"}function kt(){}function At(n,t,e){var r=e.s=n+t,i=r-n,u=r-i;e.t=n-u+(t-i)}function Nt(n,t){n&&qo.hasOwnProperty(n.type)&&qo[n.type](n,t)}function qt(n,t,e){var r,i=-1,u=n.length-e;for(t.lineStart();++i<u;)r=n[i],t.point(r[0],r[1]);t.lineEnd()}function Tt(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)qt(n[e],t,1);t.polygonEnd()}function Ct(){function n(n,t){n*=to,t=t*to/2+Ka/4;var e=n-r,a=Math.cos(t),o=Math.sin(t),c=u*o,l=i*a+c*Math.cos(e),s=c*Math.sin(e);Co.add(Math.atan2(s,l)),r=n,i=a,u=o}var t,e,r,i,u;zo.point=function(a,o){zo.point=n,r=(t=a)*to,i=Math.cos(o=(e=o)*to/2+Ka/4),u=Math.sin(o)},zo.lineEnd=function(){n(t,e)}}function zt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function Dt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function jt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Lt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function Ht(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function Ft(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function Pt(n){return[Math.atan2(n[1],n[0]),V(n[2])]}function Ot(n,t){return Math.abs(n[0]-t[0])<Qa&&Math.abs(n[1]-t[1])<Qa}function Yt(n,t){n*=to;var e=Math.cos(t*=to);Rt(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function Rt(n,t,e){++Do,Lo+=(n-Lo)/Do,Ho+=(t-Ho)/Do,Fo+=(e-Fo)/Do}function Ut(){function n(n,i){n*=to;var u=Math.cos(i*=to),a=u*Math.cos(n),o=u*Math.sin(n),c=Math.sin(i),l=Math.atan2(Math.sqrt((l=e*c-r*o)*l+(l=r*a-t*c)*l+(l=t*o-e*a)*l),t*a+e*o+r*c);jo+=l,Po+=l*(t+(t=a)),Oo+=l*(e+(e=o)),Yo+=l*(r+(r=c)),Rt(t,e,r)}var t,e,r;Vo.point=function(i,u){i*=to;var a=Math.cos(u*=to);t=a*Math.cos(i),e=a*Math.sin(i),r=Math.sin(u),Vo.point=n,Rt(t,e,r)}}function It(){Vo.point=Yt}function Vt(){function n(n,t){n*=to;var e=Math.cos(t*=to),a=e*Math.cos(n),o=e*Math.sin(n),c=Math.sin(t),l=i*c-u*o,s=u*a-r*c,f=r*o-i*a,h=Math.sqrt(l*l+s*s+f*f),g=r*a+i*o+u*c,p=h&&-I(g)/h,m=Math.atan2(h,g);Ro+=p*l,Uo+=p*s,Io+=p*f,jo+=m,Po+=m*(r+(r=a)),Oo+=m*(i+(i=o)),Yo+=m*(u+(u=c)),Rt(r,i,u)}var t,e,r,i,u;Vo.point=function(a,o){t=a,e=o,Vo.point=n,a*=to;var c=Math.cos(o*=to);r=c*Math.cos(a),i=c*Math.sin(a),u=Math.sin(o),Rt(r,i,u)},Vo.lineEnd=function(){n(t,e),Vo.lineEnd=It,Vo.point=Yt}}function Xt(){return!0}function Zt(n,t,e,r,i){var u=[],a=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(Ot(e,r)){i.lineStart();for(var o=0;t>o;++o)i.point((e=n[o])[0],e[1]);return i.lineEnd(),void 0}var c={point:e,points:n,other:null,visited:!1,entry:!0,subject:!0},l={point:e,points:[e],other:c,visited:!1,entry:!1,subject:!1};c.other=l,u.push(c),a.push(l),c={point:r,points:[r],other:null,visited:!1,entry:!1,subject:!0},l={point:r,points:[r],other:c,visited:!1,entry:!0,subject:!1},c.other=l,u.push(c),a.push(l)}}),a.sort(t),Bt(u),Bt(a),u.length){if(e)for(var o=1,c=!e(a[0].point),l=a.length;l>o;++o)a[o].entry=c=!c;for(var s,f,h,g=u[0];;){for(s=g;s.visited;)if((s=s.next)===g)return;f=s.points,i.lineStart();do{if(s.visited=s.other.visited=!0,s.entry){if(s.subject)for(var o=0;o<f.length;o++)i.point((h=f[o])[0],h[1]);else r(s.point,s.next.point,1,i);s=s.next}else{if(s.subject){f=s.prev.points;for(var o=f.length;--o>=0;)i.point((h=f[o])[0],h[1])}else r(s.point,s.prev.point,-1,i);s=s.prev}s=s.other,f=s.points}while(!s.visited);i.lineEnd()}}}function Bt(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r<t;)i.next=e=n[r],e.prev=i,i=e;i.next=e=n[0],e.prev=i}}function $t(n,t,e,r){return function(i){function u(t,e){n(t,e)&&i.point(t,e)}function a(n,t){m.point(n,t)}function o(){d.point=a,m.lineStart()}function c(){d.point=u,m.lineEnd()}function l(n,t){y.point(n,t),p.push([n,t])}function s(){y.lineStart(),p=[]}function f(){l(p[0][0],p[0][1]),y.lineEnd();var n,t=y.clean(),e=v.buffer(),r=e.length;if(p.pop(),g.push(p),p=null,r){if(1&t){n=e[0];var u,r=n.length-1,a=-1;for(i.lineStart();++a<r;)i.point((u=n[a])[0],u[1]);return i.lineEnd(),void 0}r>1&&2&t&&e.push(e.pop().concat(e.shift())),h.push(e.filter(Wt))}}var h,g,p,m=t(i),d={point:u,lineStart:o,lineEnd:c,polygonStart:function(){d.point=l,d.lineStart=s,d.lineEnd=f,h=[],g=[],i.polygonStart()},polygonEnd:function(){d.point=u,d.lineStart=o,d.lineEnd=c,h=ya.merge(h),h.length?Zt(h,Gt,null,e,i):r(g)&&(i.lineStart(),e(null,null,1,i),i.lineEnd()),i.polygonEnd(),h=g=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},v=Jt(),y=t(v);return d}}function Wt(n){return n.length>1}function Jt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:s,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Gt(n,t){return((n=n.point)[0]<0?n[1]-Ka/2-Qa:Ka/2-n[1])-((t=t.point)[0]<0?t[1]-Ka/2-Qa:Ka/2-t[1])}function Kt(n,t){var e=n[0],r=n[1],i=[Math.sin(e),-Math.cos(e),0],u=0,a=!1,o=!1,c=0;Co.reset();for(var l=0,s=t.length;s>l;++l){var f=t[l],h=f.length;if(h){for(var g=f[0],p=g[0],m=g[1]/2+Ka/4,d=Math.sin(m),v=Math.cos(m),y=1;;){y===h&&(y=0),n=f[y];var M=n[0],x=n[1]/2+Ka/4,b=Math.sin(x),_=Math.cos(x),w=M-p,S=Math.abs(w)>Ka,E=d*b;if(Co.add(Math.atan2(E*Math.sin(w),v*_+E*Math.cos(w))),Math.abs(x)<Qa&&(o=!0),u+=S?w+(w>=0?2:-2)*Ka:w,S^p>=e^M>=e){var k=jt(zt(g),zt(n));Ft(k);var A=jt(i,k);Ft(A);var N=(S^w>=0?-1:1)*V(A[2]);r>N&&(c+=S^w>=0?1:-1)}if(!y++)break;p=M,d=b,v=_,g=n}Math.abs(u)>Qa&&(a=!0)}}return(!o&&!a&&0>Co||-Qa>u)^1&c}function Qt(n){var t,e=0/0,r=0/0,i=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(u,a){var o=u>0?Ka:-Ka,c=Math.abs(u-e);Math.abs(c-Ka)<Qa?(n.point(e,r=(r+a)/2>0?Ka/2:-Ka/2),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(o,r),n.point(u,r),t=0):i!==o&&c>=Ka&&(Math.abs(e-i)<Qa&&(e-=i*Qa),Math.abs(u-o)<Qa&&(u-=o*Qa),r=ne(e,r,u,a),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(o,r),t=0),n.point(e=u,r=a),i=o},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function ne(n,t,e,r){var i,u,a=Math.sin(n-e);return Math.abs(a)>Qa?Math.atan((Math.sin(t)*(u=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*u*a)):(t+r)/2}function te(n,t,e,r){var i;if(null==n)i=e*Ka/2,r.point(-Ka,i),r.point(0,i),r.point(Ka,i),r.point(Ka,0),r.point(Ka,-i),r.point(0,-i),r.point(-Ka,-i),r.point(-Ka,0),r.point(-Ka,i);else if(Math.abs(n[0]-t[0])>Qa){var u=(n[0]<t[0]?1:-1)*Ka;i=e*u/2,r.point(-u,i),r.point(0,i),r.point(u,i)}else r.point(t[0],t[1])}function ee(n){return Kt(Zo,n)}function re(n){function t(n,t){return Math.cos(n)*Math.cos(t)>a}function e(n){var e,u,a,c,s;return{lineStart:function(){c=a=!1,s=1},point:function(f,h){var g,p=[f,h],m=t(f,h),d=o?m?0:i(f,h):m?i(f+(0>f?Ka:-Ka),h):0;if(!e&&(c=a=m)&&n.lineStart(),m!==a&&(g=r(e,p),(Ot(e,g)||Ot(p,g))&&(p[0]+=Qa,p[1]+=Qa,m=t(p[0],p[1]))),m!==a)s=0,m?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(l&&e&&o^m){var v;d&u||!(v=r(p,e,!0))||(s=0,o?(n.lineStart(),n.point(v[0][0],v[0][1]),n.point(v[1][0],v[1][1]),n.lineEnd()):(n.point(v[1][0],v[1][1]),n.lineEnd(),n.lineStart(),n.point(v[0][0],v[0][1])))}!m||e&&Ot(e,p)||n.point(p[0],p[1]),e=p,a=m,u=d},lineEnd:function(){a&&n.lineEnd(),e=null},clean:function(){return s|(c&&a)<<1}}}function r(n,t,e){var r=zt(n),i=zt(t),u=[1,0,0],o=jt(r,i),c=Dt(o,o),l=o[0],s=c-l*l;if(!s)return!e&&n;var f=a*c/s,h=-a*l/s,g=jt(u,o),p=Ht(u,f),m=Ht(o,h);Lt(p,m);var d=g,v=Dt(p,d),y=Dt(d,d),M=v*v-y*(Dt(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=Ht(d,(-v-x)/y);if(Lt(b,p),b=Pt(b),!e)return b;var _,w=n[0],S=t[0],E=n[1],k=t[1];w>S&&(_=w,w=S,S=_);var A=S-w,N=Math.abs(A-Ka)<Qa,q=N||Qa>A;if(!N&&E>k&&(_=E,E=k,k=_),q?N?E+k>0^b[1]<(Math.abs(b[0]-w)<Qa?E:k):E<=b[1]&&b[1]<=k:A>Ka^(w<=b[0]&&b[0]<=S)){var T=Ht(d,(-v+x)/y);return Lt(T,p),[b,Pt(T)]}}}function i(t,e){var r=o?n:Ka-n,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>e?i|=4:e>r&&(i|=8),i}function u(n){return Kt(c,n)}var a=Math.cos(n),o=a>0,c=[n,0],l=Math.abs(a)>Qa,s=Ne(n,6*to);return $t(t,e,s,u)}function ie(n,t,e,r){function i(r,i){return Math.abs(r[0]-n)<Qa?i>0?0:3:Math.abs(r[0]-e)<Qa?i>0?2:1:Math.abs(r[1]-t)<Qa?i>0?1:0:i>0?3:2}function u(n,t){return a(n.point,t.point)}function a(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}function o(i,u){var a=u[0]-i[0],o=u[1]-i[1],c=[0,1];return Math.abs(a)<Qa&&Math.abs(o)<Qa?n<=i[0]&&i[0]<=e&&t<=i[1]&&i[1]<=r:ue(n-i[0],a,c)&&ue(i[0]-e,-a,c)&&ue(t-i[1],o,c)&&ue(i[1]-r,-o,c)?(c[1]<1&&(u[0]=i[0]+c[1]*a,u[1]=i[1]+c[1]*o),c[0]>0&&(i[0]+=c[0]*a,i[1]+=c[0]*o),!0):!1}return function(c){function l(u){var a=i(u,-1),o=s([0===a||3===a?n:e,a>1?r:t]);return o}function s(n){for(var t=0,e=M.length,r=n[1],i=0;e>i;++i)for(var u,a=1,o=M[i],c=o.length,l=o[0];c>a;++a)u=o[a],l[1]<=r?u[1]>r&&f(l,u,n)>0&&++t:u[1]<=r&&f(l,u,n)<0&&--t,l=u;return 0!==t}function f(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(e[0]-n[0])*(t[1]-n[1])}function h(u,o,c,l){var s=0,f=0;if(null==u||(s=i(u,c))!==(f=i(o,c))||a(u,o)<0^c>0){do l.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+c+4)%4)!==f)}else l.point(o[0],o[1])}function g(i,u){return i>=n&&e>=i&&u>=t&&r>=u}function p(n,t){g(n,t)&&c.point(n,t)}function m(){T.point=v,M&&M.push(x=[]),A=!0,k=!1,S=E=0/0}function d(){y&&(v(b,_),w&&k&&q.rejoin(),y.push(q.buffer())),T.point=p,k&&c.lineEnd()}function v(n,t){n=Math.max(-Bo,Math.min(Bo,n)),t=Math.max(-Bo,Math.min(Bo,t));var e=g(n,t);if(M&&x.push([n,t]),A)b=n,_=t,w=e,A=!1,e&&(c.lineStart(),c.point(n,t));else if(e&&k)c.point(n,t);else{var r=[S,E],i=[n,t];o(r,i)?(k||(c.lineStart(),c.point(r[0],r[1])),c.point(i[0],i[1]),e||c.lineEnd()):e&&(c.lineStart(),c.point(n,t))}S=n,E=t,k=e}var y,M,x,b,_,w,S,E,k,A,N=c,q=Jt(),T={point:p,lineStart:m,lineEnd:d,polygonStart:function(){c=q,y=[],M=[]},polygonEnd:function(){c=N,(y=ya.merge(y)).length?(c.polygonStart(),Zt(y,u,l,h,c),c.polygonEnd()):s([n,t])&&(c.polygonStart(),c.lineStart(),h(null,null,1,c),c.lineEnd(),c.polygonEnd()),y=M=x=null}};return T}}function ue(n,t,e){if(Math.abs(t)<Qa)return 0>=n;var r=n/t;if(t>0){if(r>e[1])return!1;r>e[0]&&(e[0]=r)}else{if(r<e[0])return!1;r<e[1]&&(e[1]=r)}return!0}function ae(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function oe(n){var t=0,e=Ka/3,r=be(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Ka/180,e=n[1]*Ka/180):[180*(t/Ka),180*(e/Ka)]},i}function ce(n,t){function e(n,t){var e=Math.sqrt(u-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),a-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,u=1+r*(2*i-r),a=Math.sqrt(u)/i;return e.invert=function(n,t){var e=a-t;return[Math.atan2(n,e)/i,V((u-(n*n+e*e)*i*i)/(2*i))]},e}function le(){function n(n,t){Wo+=i*n-r*t,r=n,i=t}var t,e,r,i;nc.point=function(u,a){nc.point=n,t=r=u,e=i=a},nc.lineEnd=function(){n(t,e)}}function se(n,t){Jo>n&&(Jo=n),n>Ko&&(Ko=n),Go>t&&(Go=t),t>Qo&&(Qo=t)}function fe(){function n(n,t){a.push(\"M\",n,\",\",t,u)}function t(n,t){a.push(\"M\",n,\",\",t),o.point=e}function e(n,t){a.push(\"L\",n,\",\",t)}function r(){o.point=n}function i(){a.push(\"Z\")}var u=he(4.5),a=[],o={point:n,lineStart:function(){o.point=t},lineEnd:r,polygonStart:function(){o.lineEnd=i},polygonEnd:function(){o.lineEnd=r,o.point=n},pointRadius:function(n){return u=he(n),o},result:function(){if(a.length){var n=a.join(\"\");return a=[],n}}};return o}function he(n){return\"m0,\"+n+\"a\"+n+\",\"+n+\" 0 1,1 0,\"+-2*n+\"a\"+n+\",\"+n+\" 0 1,1 0,\"+2*n+\"z\"}function ge(n,t){Lo+=n,Ho+=t,++Fo}function pe(){function n(n,r){var i=n-t,u=r-e,a=Math.sqrt(i*i+u*u);Po+=a*(t+n)/2,Oo+=a*(e+r)/2,Yo+=a,ge(t=n,e=r)}var t,e;ec.point=function(r,i){ec.point=n,ge(t=r,e=i)}}function me(){ec.point=ge}function de(){function n(n,t){var e=n-r,u=t-i,a=Math.sqrt(e*e+u*u);Po+=a*(r+n)/2,Oo+=a*(i+t)/2,Yo+=a,a=i*n-r*t,Ro+=a*(r+n),Uo+=a*(i+t),Io+=3*a,ge(r=n,i=t)}var t,e,r,i;ec.point=function(u,a){ec.point=n,ge(t=r=u,e=i=a)},ec.lineEnd=function(){n(t,e)}}function ve(n){function t(t,e){n.moveTo(t,e),n.arc(t,e,a,0,2*Ka)}function e(t,e){n.moveTo(t,e),o.point=r}function r(t,e){n.lineTo(t,e)}function i(){o.point=t}function u(){n.closePath()}var a=4.5,o={point:t,lineStart:function(){o.point=e},lineEnd:i,polygonStart:function(){o.lineEnd=u},polygonEnd:function(){o.lineEnd=i,o.point=t},pointRadius:function(n){return a=n,o},result:s};return o}function ye(n){function t(t){function r(e,r){e=n(e,r),t.point(e[0],e[1])}function i(){M=0/0,S.point=a,t.lineStart()}function a(r,i){var a=zt([r,i]),o=n(r,i);e(M,x,y,b,_,w,M=o[0],x=o[1],y=r,b=a[0],_=a[1],w=a[2],u,t),t.point(M,x)}function o(){S.point=r,t.lineEnd()}function c(){i(),S.point=l,S.lineEnd=s}function l(n,t){a(f=n,h=t),g=M,p=x,m=b,d=_,v=w,S.point=a}function s(){e(M,x,y,b,_,w,g,p,f,m,d,v,u,t),S.lineEnd=o,o()}var f,h,g,p,m,d,v,y,M,x,b,_,w,S={point:r,lineStart:i,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c},polygonEnd:function(){t.polygonEnd(),S.lineStart=i}};return S}function e(t,u,a,o,c,l,s,f,h,g,p,m,d,v){var y=s-t,M=f-u,x=y*y+M*M;if(x>4*r&&d--){var b=o+g,_=c+p,w=l+m,S=Math.sqrt(b*b+_*_+w*w),E=Math.asin(w/=S),k=Math.abs(Math.abs(w)-1)<Qa?(a+h)/2:Math.atan2(_,b),A=n(k,E),N=A[0],q=A[1],T=N-t,C=q-u,z=M*T-y*C;(z*z/x>r||Math.abs((y*T+M*C)/x-.5)>.3||i>o*g+c*p+l*m)&&(e(t,u,a,o,c,l,N,q,k,b/=S,_/=S,w,d,v),v.point(N,q),e(N,q,k,b,_,w,s,f,h,g,p,m,d,v))}}var r=.5,i=Math.cos(30*to),u=16;return t.precision=function(n){return arguments.length?(u=(r=n*n)>0&&16,t):Math.sqrt(r)},t}function Me(n){var t=ye(function(t,e){return n([t*eo,e*eo])});return function(n){return n=t(n),{point:function(t,e){n.point(t*to,e*to)},sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}}function xe(n){return be(function(){return n})()}function be(n){function t(n){return n=o(n[0]*to,n[1]*to),[n[0]*h+c,l-n[1]*h]}function e(n){return n=o.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*eo,n[1]*eo]}function r(){o=ae(a=Se(v,y,M),u);var n=u(m,d);return c=g-n[0]*h,l=p+n[1]*h,i()}function i(){return s&&(s.valid=!1,s=null),t}var u,a,o,c,l,s,f=ye(function(n,t){return n=u(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,m=0,d=0,v=0,y=0,M=0,x=Xo,b=mt,_=null,w=null;return t.stream=function(n){return s&&(s.valid=!1),s=_e(a,x(f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(x=null==n?(_=n,Xo):re((_=+n)*to),i()):_},t.clipExtent=function(n){return arguments.length?(w=n,b=null==n?mt:ie(n[0][0],n[0][1],n[1][0],n[1][1]),i()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(m=n[0]%360*to,d=n[1]%360*to,r()):[m*eo,d*eo]},t.rotate=function(n){return arguments.length?(v=n[0]%360*to,y=n[1]%360*to,M=n.length>2?n[2]%360*to:0,r()):[v*eo,y*eo,M*eo]},ya.rebind(t,f,\"precision\"),function(){return u=n.apply(this,arguments),t.invert=u.invert&&e,r()}}function _e(n,t){return{point:function(e,r){r=n(e*to,r*to),e=r[0],t.point(e>Ka?e-2*Ka:-Ka>e?e+2*Ka:e,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function we(n,t){return[n,t]}function Se(n,t,e){return n?t||e?ae(ke(n),Ae(t,e)):ke(n):t||e?Ae(t,e):we}function Ee(n){return function(t,e){return t+=n,[t>Ka?t-2*Ka:-Ka>t?t+2*Ka:t,e]}}function ke(n){var t=Ee(n);return t.invert=Ee(-n),t}function Ae(n,t){function e(n,t){var e=Math.cos(t),o=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+o*i;return[Math.atan2(c*u-s*a,o*r-l*i),V(s*u+c*a)]}var r=Math.cos(n),i=Math.sin(n),u=Math.cos(t),a=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),o=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*u-c*a;return[Math.atan2(c*u+l*a,o*r+s*i),V(s*r-o*i)]},e}function Ne(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,u,a,o){null!=i?(i=qe(e,i),u=qe(e,u),(a>0?u>i:i>u)&&(i+=2*a*Ka)):(i=n+2*a*Ka,u=n);for(var c,l=a*t,s=i;a>0?s>u:u>s;s-=l)o.point((c=Pt([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],c[1])}}function qe(n,t){var e=zt(t);e[0]-=n,Ft(e);var r=I(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Qa)%(2*Math.PI)}function Te(n,t,e){var r=ya.range(n,t-Qa,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function Ce(n,t,e){var r=ya.range(n,t-Qa,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function ze(n){return n.source}function De(n){return n.target}function je(n,t,e,r){var i=Math.cos(t),u=Math.sin(t),a=Math.cos(r),o=Math.sin(r),c=i*Math.cos(n),l=i*Math.sin(n),s=a*Math.cos(e),f=a*Math.sin(e),h=2*Math.asin(Math.sqrt(B(r-t)+i*a*B(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*s,i=e*l+t*f,a=e*u+t*o;return[Math.atan2(i,r)*eo,Math.atan2(a,Math.sqrt(r*r+i*i))*eo]}:function(){return[n*eo,t*eo]};return p.distance=h,p}function Le(){function n(n,i){var u=Math.sin(i*=to),a=Math.cos(i),o=Math.abs((n*=to)-t),c=Math.cos(o);rc+=Math.atan2(Math.sqrt((o=a*Math.sin(o))*o+(o=r*u-e*a*c)*o),e*u+r*a*c),t=n,e=u,r=a}var t,e,r;ic.point=function(i,u){t=i*to,e=Math.sin(u*=to),r=Math.cos(u),ic.point=n},ic.lineEnd=function(){ic.point=ic.lineEnd=s}}function He(n,t){function e(t,e){var r=Math.cos(t),i=Math.cos(e),u=n(r*i);return[u*i*Math.sin(t),u*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),i=t(r),u=Math.sin(i),a=Math.cos(i);return[Math.atan2(n*u,r*a),Math.asin(r&&e*u/r)]},e}function Fe(n,t){function e(n,t){var e=Math.abs(Math.abs(t)-Ka/2)<Qa?0:a/Math.pow(i(t),u);return[e*Math.sin(u*n),a-e*Math.cos(u*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Ka/4+n/2)},u=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),a=r*Math.pow(i(n),u)/u;return u?(e.invert=function(n,t){var e=a-t,r=U(u)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/u,2*Math.atan(Math.pow(a/r,1/u))-Ka/2]},e):Oe}function Pe(n,t){function e(n,t){var e=u-t;return[e*Math.sin(i*n),u-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),u=r/i+n;return Math.abs(i)<Qa?we:(e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,u-U(i)*Math.sqrt(n*n+e*e)]},e)}function Oe(n,t){return[n,Math.log(Math.tan(Ka/4+t/2))]}function Ye(n){var t,e=xe(n),r=e.scale,i=e.translate,u=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=i.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var a=u.apply(e,arguments);if(a===e){if(t=null==n){var o=Ka*r(),c=i();u([[c[0]-o,c[1]-o],[c[0]+o,c[1]+o]])}}else t&&(a=null);return a},e.clipExtent(null)}function Re(n,t){var e=Math.cos(t)*Math.sin(n);return[Math.log((1+e)/(1-e))/2,Math.atan2(Math.tan(t),Math.cos(n))]}function Ue(n){function t(t){function a(){l.push(\"M\",u(n(s),o))}for(var c,l=[],s=[],f=-1,h=t.length,g=pt(e),p=pt(r);++f<h;)i.call(this,c=t[f],f)?s.push([+g.call(this,c,f),+p.call(this,c,f)]):s.length&&(a(),s=[]);return s.length&&a(),l.length?l.join(\"\"):null}var e=Ie,r=Ve,i=Xt,u=Xe,a=u.key,o=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(i=n,t):i},t.interpolate=function(n){return arguments.length?(a=\"function\"==typeof n?u=n:(u=sc.get(n)||Xe).key,t):a},t.tension=function(n){return arguments.length?(o=n,t):o},t}function Ie(n){return n[0]}function Ve(n){return n[1]}function Xe(n){return n.join(\"L\")}function Ze(n){return Xe(n)+\"Z\"}function Be(n){for(var t=0,e=n.length,r=n[0],i=[r[0],\",\",r[1]];++t<e;)i.push(\"H\",(r[0]+(r=n[t])[0])/2,\"V\",r[1]);return e>1&&i.push(\"H\",r[0]),i.join(\"\")}function $e(n){for(var t=0,e=n.length,r=n[0],i=[r[0],\",\",r[1]];++t<e;)i.push(\"V\",(r=n[t])[1],\"H\",r[0]);return i.join(\"\")}function We(n){for(var t=0,e=n.length,r=n[0],i=[r[0],\",\",r[1]];++t<e;)i.push(\"H\",(r=n[t])[0],\"V\",r[1]);return i.join(\"\")}function Je(n,t){return n.length<4?Xe(n):n[1]+Qe(n.slice(1,n.length-1),nr(n,t))}function Ge(n,t){return n.length<3?Xe(n):n[0]+Qe((n.push(n[0]),n),nr([n[n.length-2]].concat(n,[n[1]]),t))}function Ke(n,t){return n.length<3?Xe(n):n[0]+Qe(n,nr(n,t))}function Qe(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return Xe(n);var e=n.length!=t.length,r=\"\",i=n[0],u=n[1],a=t[0],o=a,c=1;if(e&&(r+=\"Q\"+(u[0]-2*a[0]/3)+\",\"+(u[1]-2*a[1]/3)+\",\"+u[0]+\",\"+u[1],i=n[1],c=2),t.length>1){o=t[1],u=n[c],c++,r+=\"C\"+(i[0]+a[0])+\",\"+(i[1]+a[1])+\",\"+(u[0]-o[0])+\",\"+(u[1]-o[1])+\",\"+u[0]+\",\"+u[1];for(var l=2;l<t.length;l++,c++)u=n[c],o=t[l],r+=\"S\"+(u[0]-o[0])+\",\"+(u[1]-o[1])+\",\"+u[0]+\",\"+u[1]}if(e){var s=n[c];r+=\"Q\"+(u[0]+2*o[0]/3)+\",\"+(u[1]+2*o[1]/3)+\",\"+s[0]+\",\"+s[1]}return r}function nr(n,t){for(var e,r=[],i=(1-t)/2,u=n[0],a=n[1],o=1,c=n.length;++o<c;)e=u,u=a,a=n[o],r.push([i*(a[0]-e[0]),i*(a[1]-e[1])]);return r}function tr(n){if(n.length<3)return Xe(n);var t=1,e=n.length,r=n[0],i=r[0],u=r[1],a=[i,i,i,(r=n[1])[0]],o=[u,u,u,r[1]],c=[i,\",\",u,\"L\",ur(gc,a),\",\",ur(gc,o)];for(n.push(n[e-1]);++t<=e;)r=n[t],a.shift(),a.push(r[0]),o.shift(),o.push(r[1]),ar(c,a,o);return n.pop(),c.push(\"L\",r),c.join(\"\")}function er(n){if(n.length<4)return Xe(n);for(var t,e=[],r=-1,i=n.length,u=[0],a=[0];++r<3;)t=n[r],u.push(t[0]),a.push(t[1]);for(e.push(ur(gc,u)+\",\"+ur(gc,a)),--r;++r<i;)t=n[r],u.shift(),u.push(t[0]),a.shift(),a.push(t[1]),ar(e,u,a);return e.join(\"\")}function rr(n){for(var t,e,r=-1,i=n.length,u=i+4,a=[],o=[];++r<4;)e=n[r%i],a.push(e[0]),o.push(e[1]);for(t=[ur(gc,a),\",\",ur(gc,o)],--r;++r<u;)e=n[r%i],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),ar(t,a,o);return t.join(\"\")}function ir(n,t){var e=n.length-1;if(e)for(var r,i,u=n[0][0],a=n[0][1],o=n[e][0]-u,c=n[e][1]-a,l=-1;++l<=e;)r=n[l],i=l/e,r[0]=t*r[0]+(1-t)*(u+i*o),r[1]=t*r[1]+(1-t)*(a+i*c);return tr(n)}function ur(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]\n}function ar(n,t,e){n.push(\"C\",ur(fc,t),\",\",ur(fc,e),\",\",ur(hc,t),\",\",ur(hc,e),\",\",ur(gc,t),\",\",ur(gc,e))}function or(n,t){return(t[1]-n[1])/(t[0]-n[0])}function cr(n){for(var t=0,e=n.length-1,r=[],i=n[0],u=n[1],a=r[0]=or(i,u);++t<e;)r[t]=(a+(a=or(i=u,u=n[t+1])))/2;return r[t]=a,r}function lr(n){for(var t,e,r,i,u=[],a=cr(n),o=-1,c=n.length-1;++o<c;)t=or(n[o],n[o+1]),Math.abs(t)<1e-6?a[o]=a[o+1]=0:(e=a[o]/t,r=a[o+1]/t,i=e*e+r*r,i>9&&(i=3*t/Math.sqrt(i),a[o]=i*e,a[o+1]=i*r));for(o=-1;++o<=c;)i=(n[Math.min(c,o+1)][0]-n[Math.max(0,o-1)][0])/(6*(1+a[o]*a[o])),u.push([i||0,a[o]*i||0]);return u}function sr(n){return n.length<3?Xe(n):n[0]+Qe(n,lr(n))}function fr(n,t,e,r){var i,u,a,o,c,l,s;return i=r[n],u=i[0],a=i[1],i=r[t],o=i[0],c=i[1],i=r[e],l=i[0],s=i[1],(s-a)*(o-u)-(c-a)*(l-u)>0}function hr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function gr(n,t,e,r){var i=n[0],u=e[0],a=t[0]-i,o=r[0]-u,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(o*(c-l)-f*(i-u))/(f*a-o*s);return[i+h*a,c+h*s]}function pr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function mr(n,t){var e={list:n.map(function(n,t){return{index:t,x:n[0],y:n[1]}}).sort(function(n,t){return n.y<t.y?-1:n.y>t.y?1:n.x<t.x?-1:n.x>t.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,\"l\"),r.rightEnd=r.createHalfEdge(null,\"l\"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(n,t){return{edge:n,side:t,vertex:null,l:null,r:null}},insert:function(n,t){t.l=n,t.r=n.r,n.r.l=t,n.r=t},leftBound:function(n){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,n));return t=t.l},del:function(n){n.l.r=n.r,n.r.l=n.l,n.edge=null},right:function(n){return n.r},left:function(n){return n.l},leftRegion:function(n){return null==n.edge?e.bottomSite:n.edge.region[n.side]},rightRegion:function(n){return null==n.edge?e.bottomSite:n.edge.region[mc[n.side]]}},i={bisect:function(n,t){var e={region:{l:n,r:t},ep:{l:null,r:null}},r=t.x-n.x,i=t.y-n.y,u=r>0?r:-r,a=i>0?i:-i;return e.c=n.x*r+n.y*i+.5*(r*r+i*i),u>a?(e.a=1,e.b=i/r,e.c/=r):(e.b=1,e.a=r/i,e.c/=i),e},intersect:function(n,t){var e=n.edge,r=t.edge;if(!e||!r||e.region.r==r.region.r)return null;var i=e.a*r.b-e.b*r.a;if(Math.abs(i)<1e-10)return null;var u,a,o=(e.c*r.b-r.c*e.b)/i,c=(r.c*e.a-e.c*r.a)/i,l=e.region.r,s=r.region.r;l.y<s.y||l.y==s.y&&l.x<s.x?(u=n,a=e):(u=t,a=r);var f=o>=a.region.r.x;return f&&\"l\"===u.side||!f&&\"r\"===u.side?null:{x:o,y:c}},rightOf:function(n,t){var e=n.edge,r=e.region.r,i=t.x>r.x;if(i&&\"l\"===n.side)return 1;if(!i&&\"r\"===n.side)return 0;if(1===e.a){var u=t.y-r.y,a=t.x-r.x,o=0,c=0;if(!i&&e.b<0||i&&e.b>=0?c=o=u>=e.b*a:(c=t.x+t.y*e.b>e.c,e.b<0&&(c=!c),c||(o=1)),!o){var l=r.x-e.region.l.x;c=e.b*(a*a-u*u)<l*u*(1+2*a/l+e.b*e.b),e.b<0&&(c=!c)}}else{var s=e.c-e.a*t.x,f=t.y-s,h=t.x-r.x,g=s-r.y;c=f*f>h*h+g*g}return\"l\"===n.side?c:!c},endPoint:function(n,e,r){n.ep[e]=r,n.ep[mc[e]]&&t(n)},distance:function(n,t){var e=n.x-t.x,r=n.y-t.y;return Math.sqrt(e*e+r*r)}},u={list:[],insert:function(n,t,e){n.vertex=t,n.ystar=t.y+e;for(var r=0,i=u.list,a=i.length;a>r;r++){var o=i[r];if(!(n.ystar>o.ystar||n.ystar==o.ystar&&t.x>o.vertex.x))break}i.splice(r,0,n)},del:function(n){for(var t=0,e=u.list,r=e.length;r>t&&e[t]!=n;++t);e.splice(t,1)},empty:function(){return 0===u.list.length},nextEvent:function(n){for(var t=0,e=u.list,r=e.length;r>t;++t)if(e[t]==n)return e[t+1];return null},min:function(){var n=u.list[0];return{x:n.vertex.x,y:n.ystar}},extractMin:function(){return u.list.shift()}};r.init(),e.bottomSite=e.list.shift();for(var a,o,c,l,s,f,h,g,p,m,d,v,y,M=e.list.shift();;)if(u.empty()||(a=u.min()),M&&(u.empty()||M.y<a.y||M.y==a.y&&M.x<a.x))o=r.leftBound(M),c=r.right(o),h=r.rightRegion(o),v=i.bisect(h,M),f=r.createHalfEdge(v,\"l\"),r.insert(o,f),m=i.intersect(o,f),m&&(u.del(o),u.insert(o,m,i.distance(m,M))),o=f,f=r.createHalfEdge(v,\"r\"),r.insert(o,f),m=i.intersect(f,c),m&&u.insert(f,m,i.distance(m,M)),M=e.list.shift();else{if(u.empty())break;o=u.extractMin(),l=r.left(o),c=r.right(o),s=r.right(c),h=r.leftRegion(o),g=r.rightRegion(c),d=o.vertex,i.endPoint(o.edge,o.side,d),i.endPoint(c.edge,c.side,d),r.del(o),u.del(c),r.del(c),y=\"l\",h.y>g.y&&(p=h,h=g,g=p,y=\"r\"),v=i.bisect(h,g),f=r.createHalfEdge(v,y),r.insert(l,f),i.endPoint(v,mc[y],d),m=i.intersect(l,f),m&&(u.del(l),u.insert(l,m,i.distance(m,h))),m=i.intersect(f,s),m&&u.insert(f,m,i.distance(m,h))}for(o=r.right(r.leftEnd);o!=r.rightEnd;o=r.right(o))t(o.edge)}function dr(n){return n.x}function vr(n){return n.y}function yr(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function Mr(n,t,e,r,i,u){if(!n(t,e,r,i,u)){var a=.5*(e+i),o=.5*(r+u),c=t.nodes;c[0]&&Mr(n,c[0],e,r,a,o),c[1]&&Mr(n,c[1],a,r,i,o),c[2]&&Mr(n,c[2],e,o,a,u),c[3]&&Mr(n,c[3],a,o,i,u)}}function xr(n,t){n=ya.rgb(n),t=ya.rgb(t);var e=n.r,r=n.g,i=n.b,u=t.r-e,a=t.g-r,o=t.b-i;return function(n){return\"#\"+ct(Math.round(e+u*n))+ct(Math.round(r+a*n))+ct(Math.round(i+o*n))}}function br(n,t){var e,r={},i={};for(e in n)e in t?r[e]=Sr(n[e],t[e]):i[e]=n[e];for(e in t)e in n||(i[e]=t[e]);return function(n){for(e in r)i[e]=r[e](n);return i}}function _r(n,t){return t-=n=+n,function(e){return n+t*e}}function wr(n,t){var e,r,i,u,a,o=0,c=0,l=[],s=[];for(n+=\"\",t+=\"\",dc.lastIndex=0,r=0;e=dc.exec(t);++r)e.index&&l.push(t.substring(o,c=e.index)),s.push({i:l.length,x:e[0]}),l.push(null),o=dc.lastIndex;for(o<t.length&&l.push(t.substring(o)),r=0,u=s.length;(e=dc.exec(n))&&u>r;++r)if(a=s[r],a.x==e[0]){if(a.i)if(null==l[a.i+1])for(l[a.i-1]+=a.x,l.splice(a.i,1),i=r+1;u>i;++i)s[i].i--;else for(l[a.i-1]+=a.x+l[a.i+1],l.splice(a.i,2),i=r+1;u>i;++i)s[i].i-=2;else if(null==l[a.i+1])l[a.i]=a.x;else for(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1),i=r+1;u>i;++i)s[i].i--;s.splice(r,1),u--,r--}else a.x=_r(parseFloat(e[0]),parseFloat(a.x));for(;u>r;)a=s.pop(),null==l[a.i+1]?l[a.i]=a.x:(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1)),u--;return 1===l.length?null==l[0]?(a=s[0].x,function(n){return a(n)+\"\"}):function(){return t}:function(n){for(r=0;u>r;++r)l[(a=s[r]).i]=a.x(n);return l.join(\"\")}}function Sr(n,t){for(var e,r=ya.interpolators.length;--r>=0&&!(e=ya.interpolators[r](n,t)););return e}function Er(n,t){var e,r=[],i=[],u=n.length,a=t.length,o=Math.min(n.length,t.length);for(e=0;o>e;++e)r.push(Sr(n[e],t[e]));for(;u>e;++e)i[e]=n[e];for(;a>e;++e)i[e]=t[e];return function(n){for(e=0;o>e;++e)i[e]=r[e](n);return i}}function kr(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function Ar(n){return function(t){return 1-n(1-t)}}function Nr(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function qr(n){return n*n}function Tr(n){return n*n*n}function Cr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function zr(n){return function(t){return Math.pow(t,n)}}function Dr(n){return 1-Math.cos(n*Ka/2)}function jr(n){return Math.pow(2,10*(n-1))}function Lr(n){return 1-Math.sqrt(1-n*n)}function Hr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/(2*Ka)*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,10*-r)*Math.sin(2*(r-e)*Ka/t)}}function Fr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Pr(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Or(n,t){n=ya.hcl(n),t=ya.hcl(t);var e=n.h,r=n.c,i=n.l,u=t.h-e,a=t.c-r,o=t.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?t.c:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return J(e+u*n,r+a*n,i+o*n)+\"\"}}function Yr(n,t){n=ya.hsl(n),t=ya.hsl(t);var e=n.h,r=n.s,i=n.l,u=t.h-e,a=t.s-r,o=t.l-i;return isNaN(a)&&(a=0,r=isNaN(r)?t.s:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return R(e+u*n,r+a*n,i+o*n)+\"\"}}function Rr(n,t){n=ya.lab(n),t=ya.lab(t);var e=n.l,r=n.a,i=n.b,u=t.l-e,a=t.a-r,o=t.b-i;return function(n){return Q(e+u*n,r+a*n,i+o*n)+\"\"}}function Ur(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Ir(n){var t=[n.a,n.b],e=[n.c,n.d],r=Xr(t),i=Vr(t,e),u=Xr(Zr(e,t,-i))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*eo,this.translate=[n.e,n.f],this.scale=[r,u],this.skew=u?Math.atan2(i,u)*eo:0}function Vr(n,t){return n[0]*t[0]+n[1]*t[1]}function Xr(n){var t=Math.sqrt(Vr(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Zr(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Br(n,t){var e,r=[],i=[],u=ya.transform(n),a=ya.transform(t),o=u.translate,c=a.translate,l=u.rotate,s=a.rotate,f=u.skew,h=a.skew,g=u.scale,p=a.scale;return o[0]!=c[0]||o[1]!=c[1]?(r.push(\"translate(\",null,\",\",null,\")\"),i.push({i:1,x:_r(o[0],c[0])},{i:3,x:_r(o[1],c[1])})):c[0]||c[1]?r.push(\"translate(\"+c+\")\"):r.push(\"\"),l!=s?(l-s>180?s+=360:s-l>180&&(l+=360),i.push({i:r.push(r.pop()+\"rotate(\",null,\")\")-2,x:_r(l,s)})):s&&r.push(r.pop()+\"rotate(\"+s+\")\"),f!=h?i.push({i:r.push(r.pop()+\"skewX(\",null,\")\")-2,x:_r(f,h)}):h&&r.push(r.pop()+\"skewX(\"+h+\")\"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+\"scale(\",null,\",\",null,\")\"),i.push({i:e-4,x:_r(g[0],p[0])},{i:e-2,x:_r(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+\"scale(\"+p+\")\"),e=i.length,function(n){for(var t,u=-1;++u<e;)r[(t=i[u]).i]=t.x(n);return r.join(\"\")}}function $r(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return(e-n)*t}}function Wr(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return Math.max(0,Math.min(1,(e-n)*t))}}function Jr(n){for(var t=n.source,e=n.target,r=Kr(t,e),i=[t];t!==r;)t=t.parent,i.push(t);for(var u=i.length;e!==r;)i.splice(u,0,e),e=e.parent;return i}function Gr(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Kr(n,t){if(n===t)return n;for(var e=Gr(n),r=Gr(t),i=e.pop(),u=r.pop(),a=null;i===u;)a=i,i=e.pop(),u=r.pop();return a}function Qr(n){n.fixed|=2}function ni(n){n.fixed&=-7}function ti(n){n.fixed|=4,n.px=n.x,n.py=n.y}function ei(n){n.fixed&=-5}function ri(n,t,e){var r=0,i=0;if(n.charge=0,!n.leaf)for(var u,a=n.nodes,o=a.length,c=-1;++c<o;)u=a[c],null!=u&&(ri(u,t,e),n.charge+=u.charge,r+=u.charge*u.cx,i+=u.charge*u.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var l=t*e[n.point.index];n.charge+=n.pointCharge=l,r+=l*n.point.x,i+=l*n.point.y}n.cx=r/n.charge,n.cy=i/n.charge}function ii(n,t){return ya.rebind(n,t,\"sort\",\"children\",\"value\"),n.nodes=n,n.links=ci,n}function ui(n){return n.children}function ai(n){return n.value}function oi(n,t){return t.value-n.value}function ci(n){return ya.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function li(n){return n.x}function si(n){return n.y}function fi(n,t,e){n.y0=t,n.y=e}function hi(n){return ya.range(n.length)}function gi(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function pi(n){for(var t,e=1,r=0,i=n[0][1],u=n.length;u>e;++e)(t=n[e][1])>i&&(r=e,i=t);return r}function mi(n){return n.reduce(di,0)}function di(n,t){return n+t[1]}function vi(n,t){return yi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function yi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,u=[];++e<=t;)u[e]=i*e+r;return u}function Mi(n){return[ya.min(n),ya.max(n)]}function xi(n,t){return n.parent==t.parent?1:2}function bi(n){var t=n.children;return t&&t.length?t[0]:n._tree.thread}function _i(n){var t,e=n.children;return e&&(t=e.length)?e[t-1]:n._tree.thread}function wi(n,t){var e=n.children;if(e&&(i=e.length))for(var r,i,u=-1;++u<i;)t(r=wi(e[u],t),n)>0&&(n=r);return n}function Si(n,t){return n.x-t.x}function Ei(n,t){return t.x-n.x}function ki(n,t){return n.depth-t.depth}function Ai(n,t){function e(n,r){var i=n.children;if(i&&(a=i.length))for(var u,a,o=null,c=-1;++c<a;)u=i[c],e(u,o),o=u;t(n,r)}e(n,null)}function Ni(n){for(var t,e=0,r=0,i=n.children,u=i.length;--u>=0;)t=i[u]._tree,t.prelim+=e,t.mod+=e,e+=t.shift+(r+=t.change)}function qi(n,t,e){n=n._tree,t=t._tree;var r=e/(t.number-n.number);n.change+=r,t.change-=r,t.shift+=e,t.prelim+=e,t.mod+=e}function Ti(n,t,e){return n._tree.ancestor.parent==t.parent?n._tree.ancestor:e}function Ci(n,t){return n.value-t.value}function zi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Di(n,t){n._pack_next=t,t._pack_prev=n}function ji(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Li(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,i,u,a,o,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(Hi),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(i=e[1],i.x=i.r,i.y=0,t(i),l>2))for(u=e[2],Oi(r,i,u),t(u),zi(r,u),r._pack_prev=u,zi(u,i),i=r._pack_next,a=3;l>a;a++){Oi(r,i,u=e[a]);var p=0,m=1,d=1;for(o=i._pack_next;o!==i;o=o._pack_next,m++)if(ji(o,u)){p=1;break}if(1==p)for(c=r._pack_prev;c!==o._pack_prev&&!ji(c,u);c=c._pack_prev,d++);p?(d>m||m==d&&i.r<r.r?Di(r,i=o):Di(r=c,i),a--):(zi(r,u),i=u,t(u))}var v=(s+f)/2,y=(h+g)/2,M=0;for(a=0;l>a;a++)u=e[a],u.x-=v,u.y-=y,M=Math.max(M,u.r+Math.sqrt(u.x*u.x+u.y*u.y));n.r=M,e.forEach(Fi)}}function Hi(n){n._pack_next=n._pack_prev=n}function Fi(n){delete n._pack_next,delete n._pack_prev}function Pi(n,t,e,r){var i=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,i)for(var u=-1,a=i.length;++u<a;)Pi(i[u],t,e,r)}function Oi(n,t,e){var r=n.r+e.r,i=t.x-n.x,u=t.y-n.y;if(r&&(i||u)){var a=t.r+e.r,o=i*i+u*u;a*=a,r*=r;var c=.5+(r-a)/(2*o),l=Math.sqrt(Math.max(0,2*a*(r+o)-(r-=o)*r-a*a))/(2*o);e.x=n.x+c*i+l*u,e.y=n.y+c*u-l*i}else e.x=n.x+r,e.y=n.y}function Yi(n){return 1+ya.max(n,function(n){return n.y})}function Ri(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Ui(n){var t=n.children;return t&&t.length?Ui(t[0]):n}function Ii(n){var t,e=n.children;return e&&(t=e.length)?Ii(e[t-1]):n}function Vi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Xi(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],u=n.dy-t[0]-t[2];return 0>i&&(e+=i/2,i=0),0>u&&(r+=u/2,u=0),{x:e,y:r,dx:i,dy:u}}function Zi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Bi(n){return n.rangeExtent?n.rangeExtent():Zi(n.range())}function $i(n,t,e,r){var i=e(n[0],n[1]),u=r(t[0],t[1]);return function(n){return u(i(n))}}function Wi(n,t){var e,r=0,i=n.length-1,u=n[r],a=n[i];return u>a&&(e=r,r=i,i=e,e=u,u=a,a=e),n[r]=t.floor(u),n[i]=t.ceil(a),n}function Ji(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:kc}function Gi(n,t,e,r){var i=[],u=[],a=0,o=Math.min(n.length,t.length)-1;for(n[o]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++a<=o;)i.push(e(n[a-1],n[a])),u.push(r(t[a-1],t[a]));return function(t){var e=ya.bisect(n,t,1,o)-1;return u[e](i[e](t))}}function Ki(n,t,e,r){function i(){var i=Math.min(n.length,t.length)>2?Gi:$i,c=r?Wr:$r;return a=i(n,t,c,e),o=i(t,n,c,Sr),u}function u(n){return a(n)}var a,o;return u.invert=function(n){return o(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},u.range=function(n){return arguments.length?(t=n,i()):t},u.rangeRound=function(n){return u.range(n).interpolate(Ur)},u.clamp=function(n){return arguments.length?(r=n,i()):r},u.interpolate=function(n){return arguments.length?(e=n,i()):e},u.ticks=function(t){return ru(n,t)},u.tickFormat=function(t,e){return iu(n,t,e)},u.nice=function(t){return nu(n,t),i()},u.copy=function(){return Ki(n,t,e,r)},i()}function Qi(n,t){return ya.rebind(n,t,\"range\",\"rangeRound\",\"interpolate\",\"clamp\")}function nu(n,t){return Wi(n,Ji(t?eu(n,t)[2]:tu(n)))}function tu(n){var t=Zi(n),e=t[1]-t[0];return Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1)}function eu(n,t){var e=Zi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),u=t/r*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function ru(n,t){return ya.range.apply(ya,eu(n,t))}function iu(n,t,e){var r=-Math.floor(Math.log(eu(n,t)[2])/Math.LN10+.01);return ya.format(e?e.replace(wo,function(n,t,e,i,u,a,o,c,l,s){return[t,e,i,u,a,o,c,l||\".\"+(r-2*(\"%\"===s)),s].join(\"\")}):\",.\"+r+\"f\")}function uu(n,t,e,r){function i(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function u(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function a(t){return n(i(t))}return a.invert=function(t){return u(n.invert(t))},a.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),a):r},a.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),a):t},a.nice=function(){var t=Wi(r.map(i),e?Math:Nc);return n.domain(t),r=t.map(u),a},a.ticks=function(){var n=Zi(r),a=[],o=n[0],c=n[1],l=Math.floor(i(o)),s=Math.ceil(i(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;s>l;l++)for(var h=1;f>h;h++)a.push(u(l)*h);a.push(u(l))}else for(a.push(u(l));l++<s;)for(var h=f-1;h>0;h--)a.push(u(l)*h);for(l=0;a[l]<o;l++);for(s=a.length;a[s-1]>c;s--);a=a.slice(l,s)}return a},a.tickFormat=function(n,t){if(!arguments.length)return Ac;arguments.length<2?t=Ac:\"function\"!=typeof t&&(t=ya.format(t));var r,o=Math.max(.1,n/a.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/u(c(i(n)+r))<=o?t(n):\"\"}},a.copy=function(){return uu(n.copy(),t,e,r)},Qi(a,n)}function au(n,t,e){function r(t){return n(i(t))}var i=ou(t),u=ou(1/t);return r.invert=function(t){return u(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(i)),r):e},r.ticks=function(n){return ru(e,n)},r.tickFormat=function(n,t){return iu(e,n,t)},r.nice=function(n){return r.domain(nu(e,n))},r.exponent=function(a){return arguments.length?(i=ou(t=a),u=ou(1/t),n.domain(e.map(i)),r):t},r.copy=function(){return au(n.copy(),t,e)},Qi(r,n)}function ou(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function cu(n,t){function e(t){return a[((u.get(t)||u.set(t,n.push(t)))-1)%a.length]}function r(t,e){return ya.range(n.length).map(function(n){return t+e*n})}var u,a,o;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new i;for(var a,o=-1,c=r.length;++o<c;)u.has(a=r[o])||u.set(a,n.push(a));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(a=n,o=0,t={t:\"range\",a:arguments},e):a},e.rangePoints=function(i,u){arguments.length<2&&(u=0);var c=i[0],l=i[1],s=(l-c)/(Math.max(1,n.length-1)+u);return a=r(n.length<2?(c+l)/2:c+s*u/2,s),o=0,t={t:\"rangePoints\",a:arguments},e},e.rangeBands=function(i,u,c){arguments.length<2&&(u=0),arguments.length<3&&(c=u);var l=i[1]<i[0],s=i[l-0],f=i[1-l],h=(f-s)/(n.length-u+2*c);return a=r(s+h*c,h),l&&a.reverse(),o=h*(1-u),t={t:\"rangeBands\",a:arguments},e},e.rangeRoundBands=function(i,u,c){arguments.length<2&&(u=0),arguments.length<3&&(c=u);var l=i[1]<i[0],s=i[l-0],f=i[1-l],h=Math.floor((f-s)/(n.length-u+2*c)),g=f-s-(n.length-u)*h;return a=r(s+Math.round(g/2),h),l&&a.reverse(),o=Math.round(h*(1-u)),t={t:\"rangeRoundBands\",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return Zi(t.a[0])},e.copy=function(){return cu(n,t)},e.domain(n)}function lu(n,t){function e(){var e=0,u=t.length;for(i=[];++e<u;)i[e-1]=ya.quantile(n,e/u);return r}function r(n){return isNaN(n=+n)?void 0:t[ya.bisect(i,n)]}var i;return r.domain=function(t){return arguments.length?(n=t.filter(function(n){return!isNaN(n)}).sort(ya.ascending),e()):n},r.range=function(n){return arguments.length?(t=n,e()):t},r.quantiles=function(){return i},r.invertExtent=function(e){return e=t.indexOf(e),0>e?[0/0,0/0]:[e>0?i[e-1]:n[0],e<i.length?i[e]:n[n.length-1]]},r.copy=function(){return lu(n,t)},e()}function su(n,t,e){function r(t){return e[Math.max(0,Math.min(a,Math.floor(u*(t-n))))]}function i(){return u=e.length/(t-n),a=e.length-1,r}var u,a;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],i()):[n,t]},r.range=function(n){return arguments.length?(e=n,i()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/u+n,[t,t+1/u]},r.copy=function(){return su(n,t,e)},i()}function fu(n,t){function e(e){return e>=e?t[ya.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return fu(n,t)},e}function hu(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return ru(n,t)},t.tickFormat=function(t,e){return iu(n,t,e)},t.copy=function(){return hu(n)},t}function gu(n){return n.innerRadius}function pu(n){return n.outerRadius}function mu(n){return n.startAngle}function du(n){return n.endAngle}function vu(n){for(var t,e,r,i=-1,u=n.length;++i<u;)t=n[i],e=t[0],r=t[1]+Dc,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function yu(n){function t(t){function c(){m.push(\"M\",o(n(v),f),s,l(n(d.reverse()),f),\"Z\")}for(var h,g,p,m=[],d=[],v=[],y=-1,M=t.length,x=pt(e),b=pt(i),_=e===r?function(){return g}:pt(r),w=i===u?function(){return p}:pt(u);++y<M;)a.call(this,h=t[y],y)?(d.push([g=+x.call(this,h,y),p=+b.call(this,h,y)]),v.push([+_.call(this,h,y),+w.call(this,h,y)])):d.length&&(c(),d=[],v=[]);return d.length&&c(),m.length?m.join(\"\"):null}var e=Ie,r=Ie,i=0,u=Ve,a=Xt,o=Xe,c=o.key,l=o,s=\"L\",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(i=u=n,t):u},t.y0=function(n){return arguments.length?(i=n,t):i},t.y1=function(n){return arguments.length?(u=n,t):u},t.defined=function(n){return arguments.length?(a=n,t):a},t.interpolate=function(n){return arguments.length?(c=\"function\"==typeof n?o=n:(o=sc.get(n)||Xe).key,l=o.reverse||o,s=o.closed?\"M\":\"L\",t):c},t.tension=function(n){return arguments.length?(f=n,t):f},t}function Mu(n){return n.radius}function xu(n){return[n.x,n.y]}function bu(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]+Dc;return[e*Math.cos(r),e*Math.sin(r)]}}function _u(){return 64}function wu(){return\"circle\"}function Su(n){var t=Math.sqrt(n/Ka);return\"M0,\"+t+\"A\"+t+\",\"+t+\" 0 1,1 0,\"+-t+\"A\"+t+\",\"+t+\" 0 1,1 0,\"+t+\"Z\"}function Eu(n,t){return La(n,Yc),n.id=t,n}function ku(n,t,e,r){var i=n.id;return T(n,\"function\"==typeof e?function(n,u,a){n.__transition__[i].tween.set(t,r(e.call(n,n.__data__,u,a)))}:(e=r(e),function(n){n.__transition__[i].tween.set(t,e)}))}function Au(n){return null==n&&(n=\"\"),function(){this.textContent=n}}function Nu(n,t,e,r){var u=n.__transition__||(n.__transition__={active:0,count:0}),a=u[e];if(!a){var o=r.time;a=u[e]={tween:new i,time:o,ease:r.ease,delay:r.delay,duration:r.duration},++u.count,ya.timer(function(r){function i(r){return u.active>e?l():(u.active=e,a.event&&a.event.start.call(n,s,t),a.tween.forEach(function(e,r){(r=r.call(n,s,t))&&p.push(r)}),c(r)?1:(xt(c,0,o),void 0))}function c(r){if(u.active!==e)return l();for(var i=(r-h)/g,o=f(i),c=p.length;c>0;)p[--c].call(n,o);return i>=1?(l(),a.event&&a.event.end.call(n,s,t),1):void 0}function l(){return--u.count?delete u[e]:delete n.__transition__,1}var s=n.__data__,f=a.ease,h=a.delay,g=a.duration,p=[];return r>=h?i(r):(xt(i,h,o),void 0)},0,o)}}function qu(n,t){n.attr(\"transform\",function(n){return\"translate(\"+t(n)+\",0)\"})}function Tu(n,t){n.attr(\"transform\",function(n){return\"translate(0,\"+t(n)+\")\"})}function Cu(n,t,e){if(r=[],e&&t.length>1){for(var r,i,u,a=Zi(n.domain()),o=-1,c=t.length,l=(t[1]-t[0])/++e;++o<c;)for(i=e;--i>0;)(u=+t[o]-i*l)>=a[0]&&r.push(u);for(--o,i=0;++i<e&&(u=+t[o]+i*l)<a[1];)r.push(u)}return r}function zu(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Du(n,t,e){function r(t){var e=n(t),r=u(e,1);return r-t>t-e?e:r}function i(e){return t(e=n(new Zc(e-1)),1),e}function u(n,e){return t(n=new Zc(+n),e),n}function a(n,r,u){var a=i(n),o=[];if(u>1)for(;r>a;)e(a)%u||o.push(new Date(+a)),t(a,1);else for(;r>a;)o.push(new Date(+a)),t(a,1);return o}function o(n,t,e){try{Zc=zu;var r=new zu;return r._=n,a(r,t,e)}finally{Zc=Date}}n.floor=n,n.round=r,n.ceil=i,n.offset=u,n.range=a;var c=n.utc=ju(n);return c.floor=c,c.round=ju(r),c.ceil=ju(i),c.offset=ju(u),c.range=o,n}function ju(n){return function(t,e){try{Zc=zu;var r=new zu;return r._=t,n(r,e)._}finally{Zc=Date}}}function Lu(n,t,e,r){for(var i,u,a=0,o=t.length,c=e.length;o>a;){if(r>=c)return-1;if(i=t.charCodeAt(a++),37===i){if(u=gl[t.charAt(a++)],!u||(r=u(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function Hu(n){return new RegExp(\"^(?:\"+n.map(ya.requote).join(\"|\")+\")\",\"i\")}function Fu(n){for(var t=new i,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Pu(n,t,e){var r=0>n?\"-\":\"\",i=(r?-n:n)+\"\",u=i.length;return r+(e>u?new Array(e-u+1).join(t)+i:i)}function Ou(n,t,e){il.lastIndex=0;var r=il.exec(t.substring(e));return r?(n.w=ul.get(r[0].toLowerCase()),e+r[0].length):-1}function Yu(n,t,e){el.lastIndex=0;var r=el.exec(t.substring(e));return r?(n.w=rl.get(r[0].toLowerCase()),e+r[0].length):-1}function Ru(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Uu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e));return r?(n.U=+r[0],e+r[0].length):-1}function Iu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e));return r?(n.W=+r[0],e+r[0].length):-1}function Vu(n,t,e){cl.lastIndex=0;var r=cl.exec(t.substring(e));return r?(n.m=ll.get(r[0].toLowerCase()),e+r[0].length):-1}function Xu(n,t,e){al.lastIndex=0;var r=al.exec(t.substring(e));return r?(n.m=ol.get(r[0].toLowerCase()),e+r[0].length):-1}function Zu(n,t,e){return Lu(n,hl.c.toString(),t,e)}function Bu(n,t,e){return Lu(n,hl.x.toString(),t,e)}function $u(n,t,e){return Lu(n,hl.X.toString(),t,e)}function Wu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Ju(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.y=Gu(+r[0]),e+r[0].length):-1}function Gu(n){return n+(n>68?1900:2e3)}function Ku(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Qu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function na(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ta(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ea(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ra(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ia(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function ua(n,t,e){var r=ml.get(t.substring(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}function aa(n){var t=n.getTimezoneOffset(),e=t>0?\"-\":\"+\",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return e+Pu(r,\"0\",2)+Pu(i,\"0\",2)}function oa(n,t,e){sl.lastIndex=0;var r=sl.exec(t.substring(e,e+1));return r?e+r[0].length:-1}function ca(n){return n.toISOString()}function la(n,t,e){function r(t){return n(t)}return r.invert=function(t){return sa(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(sa)},r.nice=function(n){return r.domain(Wi(r.domain(),n))},r.ticks=function(e,i){var u=Zi(r.domain());if(\"function\"!=typeof e){var a=u[1]-u[0],o=a/e,c=ya.bisect(vl,o);if(c==vl.length)return t.year(u,e);if(!c)return n.ticks(e).map(sa);o/vl[c-1]<vl[c]/o&&--c,e=t[c],i=e[1],e=e[0].range}return e(u[0],new Date(+u[1]+1),i)},r.tickFormat=function(){return e},r.copy=function(){return la(n.copy(),t,e)},Qi(r,n)}function sa(n){return new Date(n)}function fa(n){return function(t){for(var e=n.length-1,r=n[e];!r[1](t);)r=n[--e];return r[0](t)}}function ha(n){var t=new Date(n,0,1);return t.setFullYear(n),t}function ga(n){var t=n.getFullYear(),e=ha(t),r=ha(t+1);return t+(n-e)/(r-e)}function pa(n){var t=new Date(Date.UTC(n,0,1));return t.setUTCFullYear(n),t}function ma(n){var t=n.getUTCFullYear(),e=pa(t),r=pa(t+1);return t+(n-e)/(r-e)}function da(n){return JSON.parse(n.responseText)}function va(n){var t=Ma.createRange();return t.selectNode(Ma.body),t.createContextualFragment(n.responseText)}var ya={version:\"3.2.8\"};Date.now||(Date.now=function(){return+new Date});var Ma=document,xa=Ma.documentElement,ba=window;try{Ma.createElement(\"div\").style.setProperty(\"opacity\",0,\"\")}catch(_a){var wa=ba.Element.prototype,Sa=wa.setAttribute,Ea=wa.setAttributeNS,ka=ba.CSSStyleDeclaration.prototype,Aa=ka.setProperty;wa.setAttribute=function(n,t){Sa.call(this,n,t+\"\")},wa.setAttributeNS=function(n,t,e){Ea.call(this,n,t,e+\"\")},ka.setProperty=function(n,t,e){Aa.call(this,n,t+\"\",e)}}ya.ascending=function(n,t){return t>n?-1:n>t?1:n>=t?0:0/0},ya.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},ya.min=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i<u&&!(null!=(e=n[i])&&e>=e);)e=void 0;for(;++i<u;)null!=(r=n[i])&&e>r&&(e=r)}else{for(;++i<u&&!(null!=(e=t.call(n,n[i],i))&&e>=e);)e=void 0;for(;++i<u;)null!=(r=t.call(n,n[i],i))&&e>r&&(e=r)}return e},ya.max=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i<u&&!(null!=(e=n[i])&&e>=e);)e=void 0;for(;++i<u;)null!=(r=n[i])&&r>e&&(e=r)}else{for(;++i<u&&!(null!=(e=t.call(n,n[i],i))&&e>=e);)e=void 0;for(;++i<u;)null!=(r=t.call(n,n[i],i))&&r>e&&(e=r)}return e},ya.extent=function(n,t){var e,r,i,u=-1,a=n.length;if(1===arguments.length){for(;++u<a&&!(null!=(e=i=n[u])&&e>=e);)e=i=void 0;for(;++u<a;)null!=(r=n[u])&&(e>r&&(e=r),r>i&&(i=r))}else{for(;++u<a&&!(null!=(e=i=t.call(n,n[u],u))&&e>=e);)e=void 0;for(;++u<a;)null!=(r=t.call(n,n[u],u))&&(e>r&&(e=r),r>i&&(i=r))}return[e,i]},ya.sum=function(n,t){var e,r=0,i=n.length,u=-1;if(1===arguments.length)for(;++u<i;)isNaN(e=+n[u])||(r+=e);else for(;++u<i;)isNaN(e=+t.call(n,n[u],u))||(r+=e);return r},ya.mean=function(t,e){var r,i=t.length,u=0,a=-1,o=0;if(1===arguments.length)for(;++a<i;)n(r=t[a])&&(u+=(r-u)/++o);else for(;++a<i;)n(r=e.call(t,t[a],a))&&(u+=(r-u)/++o);return o?u:void 0},ya.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),i=+n[r-1],u=e-r;return u?i+u*(n[r]-i):i},ya.median=function(t,e){return arguments.length>1&&(t=t.map(e)),t=t.filter(n),t.length?ya.quantile(t.sort(ya.ascending),.5):void 0},ya.bisector=function(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n.call(t,t[u],u)<e?r=u+1:i=u}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;e<n.call(t,t[u],u)?i=u:r=u+1}return r}}};var Na=ya.bisector(function(n){return n});ya.bisectLeft=Na.left,ya.bisect=ya.bisectRight=Na.right,ya.shuffle=function(n){for(var t,e,r=n.length;r;)e=0|Math.random()*r--,t=n[r],n[r]=n[e],n[e]=t;return n},ya.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ya.zip=function(){if(!(i=arguments.length))return[];for(var n=-1,e=ya.min(arguments,t),r=new Array(e);++n<e;)for(var i,u=-1,a=r[n]=new Array(i);++u<i;)a[u]=arguments[u][n];return r},ya.transpose=function(n){return ya.zip.apply(ya,n)},ya.keys=function(n){var t=[];for(var e in n)t.push(e);return t},ya.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},ya.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},ya.merge=function(n){return Array.prototype.concat.apply([],n)},ya.range=function(n,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/r)throw new Error(\"infinite range\");var i,u=[],a=e(Math.abs(r)),o=-1;if(n*=a,t*=a,r*=a,0>r)for(;(i=n+r*++o)>t;)u.push(i/a);else for(;(i=n+r*++o)<t;)u.push(i/a);return u},ya.map=function(n){var t=new i;if(n instanceof i)n.forEach(function(n,e){t.set(n,e)});else for(var e in n)t.set(e,n[e]);return t},r(i,{has:function(n){return qa+n in this},get:function(n){return this[qa+n]},set:function(n,t){return this[qa+n]=t},remove:function(n){return n=qa+n,n in this&&delete this[n]},keys:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},values:function(){var n=[];return this.forEach(function(t,e){n.push(e)}),n},entries:function(){var n=[];\nreturn this.forEach(function(t,e){n.push({key:t,value:e})}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===Ta&&n.call(this,t.substring(1),this[t])}});var qa=\"\\0\",Ta=qa.charCodeAt(0);ya.nest=function(){function n(t,o,c){if(c>=a.length)return r?r.call(u,o):e?o.sort(e):o;for(var l,s,f,h,g=-1,p=o.length,m=a[c++],d=new i;++g<p;)(h=d.get(l=m(s=o[g])))?h.push(s):d.set(l,[s]);return t?(s=t(),f=function(e,r){s.set(e,n(t,r,c))}):(s={},f=function(e,r){s[e]=n(t,r,c)}),d.forEach(f),s}function t(n,e){if(e>=a.length)return n;var r=[],i=o[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,u={},a=[],o=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(ya.map,e,0),0)},u.key=function(n){return a.push(n),u},u.sortKeys=function(n){return o[a.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},ya.set=function(n){var t=new u;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},r(u,{has:function(n){return qa+n in this},add:function(n){return this[qa+n]=!0,n},remove:function(n){return n=qa+n,n in this&&delete this[n]},values:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===Ta&&n.call(this,t.substring(1))}}),ya.behavior={},ya.rebind=function(n,t){for(var e,r=1,i=arguments.length;++r<i;)n[e=arguments[r]]=a(n,t,t[e]);return n};var Ca=[\"webkit\",\"ms\",\"moz\",\"Moz\",\"o\",\"O\"],za=l;try{za(xa.childNodes)[0].nodeType}catch(Da){za=c}ya.dispatch=function(){for(var n=new f,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=h(n);return n},f.prototype.on=function(n,t){var e=n.indexOf(\".\"),r=\"\";if(e>=0&&(r=n.substring(e+1),n=n.substring(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ya.event=null,ya.requote=function(n){return n.replace(ja,\"\\\\$&\")};var ja=/[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g,La={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Ha=function(n,t){return t.querySelector(n)},Fa=function(n,t){return t.querySelectorAll(n)},Pa=xa[o(xa,\"matchesSelector\")],Oa=function(n,t){return Pa.call(n,t)};\"function\"==typeof Sizzle&&(Ha=function(n,t){return Sizzle(n,t)[0]||null},Fa=function(n,t){return Sizzle.uniqueSort(Sizzle(n,t))},Oa=Sizzle.matchesSelector),ya.selection=function(){return Ia};var Ya=ya.selection.prototype=[];Ya.select=function(n){var t,e,r,i,u=[];n=v(n);for(var a=-1,o=this.length;++a<o;){u.push(t=[]),t.parentNode=(r=this[a]).parentNode;for(var c=-1,l=r.length;++c<l;)(i=r[c])?(t.push(e=n.call(i,i.__data__,c,a)),e&&\"__data__\"in i&&(e.__data__=i.__data__)):t.push(null)}return d(u)},Ya.selectAll=function(n){var t,e,r=[];n=y(n);for(var i=-1,u=this.length;++i<u;)for(var a=this[i],o=-1,c=a.length;++o<c;)(e=a[o])&&(r.push(t=za(n.call(e,e.__data__,o,i))),t.parentNode=e);return d(r)};var Ra={svg:\"http://www.w3.org/2000/svg\",xhtml:\"http://www.w3.org/1999/xhtml\",xlink:\"http://www.w3.org/1999/xlink\",xml:\"http://www.w3.org/XML/1998/namespace\",xmlns:\"http://www.w3.org/2000/xmlns/\"};ya.ns={prefix:Ra,qualify:function(n){var t=n.indexOf(\":\"),e=n;return t>=0&&(e=n.substring(0,t),n=n.substring(t+1)),Ra.hasOwnProperty(e)?{space:Ra[e],local:n}:n}},Ya.attr=function(n,t){if(arguments.length<2){if(\"string\"==typeof n){var e=this.node();return n=ya.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(M(t,n[t]));return this}return this.each(M(n,t))},Ya.classed=function(n,t){if(arguments.length<2){if(\"string\"==typeof n){var e=this.node(),r=(n=n.trim().split(/^|\\s+/g)).length,i=-1;if(t=e.classList){for(;++i<r;)if(!t.contains(n[i]))return!1}else for(t=e.getAttribute(\"class\");++i<r;)if(!b(n[i]).test(t))return!1;return!0}for(t in n)this.each(_(t,n[t]));return this}return this.each(_(n,t))},Ya.style=function(n,t,e){var r=arguments.length;if(3>r){if(\"string\"!=typeof n){2>r&&(t=\"\");for(e in n)this.each(S(e,n[e],t));return this}if(2>r)return ba.getComputedStyle(this.node(),null).getPropertyValue(n);e=\"\"}return this.each(S(n,t,e))},Ya.property=function(n,t){if(arguments.length<2){if(\"string\"==typeof n)return this.node()[n];for(t in n)this.each(E(t,n[t]));return this}return this.each(E(n,t))},Ya.text=function(n){return arguments.length?this.each(\"function\"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?\"\":t}:null==n?function(){this.textContent=\"\"}:function(){this.textContent=n}):this.node().textContent},Ya.html=function(n){return arguments.length?this.each(\"function\"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?\"\":t}:null==n?function(){this.innerHTML=\"\"}:function(){this.innerHTML=n}):this.node().innerHTML},Ya.append=function(n){return n=k(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},Ya.insert=function(n,t){return n=k(n),t=v(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments))})},Ya.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},Ya.data=function(n,t){function e(n,e){var r,u,a,o=n.length,f=e.length,h=Math.min(o,f),g=new Array(f),p=new Array(f),m=new Array(o);if(t){var d,v=new i,y=new i,M=[];for(r=-1;++r<o;)d=t.call(u=n[r],u.__data__,r),v.has(d)?m[r]=u:v.set(d,u),M.push(d);for(r=-1;++r<f;)d=t.call(e,a=e[r],r),(u=v.get(d))?(g[r]=u,u.__data__=a):y.has(d)||(p[r]=A(a)),y.set(d,a),v.remove(d);for(r=-1;++r<o;)v.has(M[r])&&(m[r]=n[r])}else{for(r=-1;++r<h;)u=n[r],a=e[r],u?(u.__data__=a,g[r]=u):p[r]=A(a);for(;f>r;++r)p[r]=A(e[r]);for(;o>r;++r)m[r]=n[r]}p.update=g,p.parentNode=g.parentNode=m.parentNode=n.parentNode,c.push(p),l.push(g),s.push(m)}var r,u,a=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++a<o;)(u=r[a])&&(n[a]=u.__data__);return n}var c=C([]),l=d([]),s=d([]);if(\"function\"==typeof n)for(;++a<o;)e(r=this[a],n.call(r,r.parentNode.__data__,a));else for(;++a<o;)e(r=this[a],n);return l.enter=function(){return c},l.exit=function(){return s},l},Ya.datum=function(n){return arguments.length?this.property(\"__data__\",n):this.property(\"__data__\")},Ya.filter=function(n){var t,e,r,i=[];\"function\"!=typeof n&&(n=N(n));for(var u=0,a=this.length;a>u;u++){i.push(t=[]),t.parentNode=(e=this[u]).parentNode;for(var o=0,c=e.length;c>o;o++)(r=e[o])&&n.call(r,r.__data__,o)&&t.push(r)}return d(i)},Ya.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],i=r.length-1,u=r[i];--i>=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},Ya.sort=function(n){n=q.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},Ya.each=function(n){return T(this,function(t,e,r){n.call(t,t.__data__,e,r)})},Ya.call=function(n){var t=za(arguments);return n.apply(t[0]=this,t),this},Ya.empty=function(){return!this.node()},Ya.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},Ya.size=function(){var n=0;return this.each(function(){++n}),n};var Ua=[];ya.selection.enter=C,ya.selection.enter.prototype=Ua,Ua.append=Ya.append,Ua.empty=Ya.empty,Ua.node=Ya.node,Ua.call=Ya.call,Ua.size=Ya.size,Ua.select=function(n){for(var t,e,r,i,u,a=[],o=-1,c=this.length;++o<c;){r=(i=this[o]).update,a.push(t=[]),t.parentNode=i.parentNode;for(var l=-1,s=i.length;++l<s;)(u=i[l])?(t.push(r[l]=e=n.call(i.parentNode,u.__data__,l,o)),e.__data__=u.__data__):t.push(null)}return d(a)},Ua.insert=function(n,t){return arguments.length<2&&(t=z(this)),Ya.insert.call(this,n,t)},Ya.transition=function(){for(var n,t,e=Hc||++Rc,r=[],i=Fc||{time:Date.now(),ease:Cr,delay:0,duration:250},u=-1,a=this.length;++u<a;){r.push(n=[]);for(var o=this[u],c=-1,l=o.length;++c<l;)(t=o[c])&&Nu(t,c,e,i),n.push(t)}return Eu(r,e)},ya.select=function(n){var t=[\"string\"==typeof n?Ha(n,Ma):n];return t.parentNode=xa,d([t])},ya.selectAll=function(n){var t=za(\"string\"==typeof n?Fa(n,Ma):n);return t.parentNode=xa,d([t])};var Ia=ya.select(xa);Ya.on=function(n,t,e){var r=arguments.length;if(3>r){if(\"string\"!=typeof n){2>r&&(t=!1);for(e in n)this.each(D(e,n[e],t));return this}if(2>r)return(r=this.node()[\"__on\"+n])&&r._;e=!1}return this.each(D(n,t,e))};var Va=ya.map({mouseenter:\"mouseover\",mouseleave:\"mouseout\"});Va.forEach(function(n){\"on\"+n in Ma&&Va.remove(n)});var Xa=o(xa.style,\"userSelect\"),Za=0;ya.mouse=function(n){return F(n,p())};var Ba=/WebKit/.test(ba.navigator.userAgent)?-1:0;ya.touches=function(n,t){return arguments.length<2&&(t=p().touches),t?za(t).map(function(t){var e=F(n,t);return e.identifier=t.identifier,e}):[]},ya.behavior.drag=function(){function n(){this.on(\"mousedown.drag\",a).on(\"touchstart.drag\",o)}function t(){return ya.event.changedTouches[0].identifier}function e(n,t){return ya.touches(n).filter(function(n){return n.identifier===t})[0]}function r(n,t,e,r){return function(){function a(){if(!s)return o();var n=t(s,g),e=n[0]-m[0],r=n[1]-m[1];d|=e|r,m=n,f({type:\"drag\",x:n[0]+c[0],y:n[1]+c[1],dx:e,dy:r})}function o(){v.on(e+\".\"+p,null).on(r+\".\"+p,null),y(d&&ya.event.target===h),f({type:\"dragend\"})}var c,l=this,s=l.parentNode,f=i.of(l,arguments),h=ya.event.target,g=n(),p=null==g?\"drag\":\"drag-\"+g,m=t(s,g),d=0,v=ya.select(ba).on(e+\".\"+p,a).on(r+\".\"+p,o),y=H();u?(c=u.apply(l,arguments),c=[c.x-m[0],c.y-m[1]]):c=[0,0],f({type:\"dragstart\"})}}var i=m(n,\"drag\",\"dragstart\",\"dragend\"),u=null,a=r(s,ya.mouse,\"mousemove\",\"mouseup\"),o=r(t,e,\"touchmove\",\"touchend\");return n.origin=function(t){return arguments.length?(u=t,n):u},ya.rebind(n,i,\"on\")},ya.behavior.zoom=function(){function n(){this.on(w,o).on(Ja+\".zoom\",l).on(S,s).on(\"dblclick.zoom\",f).on(k,c)}function t(n){return[(n[0]-x[0])/b,(n[1]-x[1])/b]}function e(n){return[n[0]*b+x[0],n[1]*b+x[1]]}function r(n){b=Math.max(_[0],Math.min(_[1],n))}function i(n,t){t=e(t),x[0]+=n[0]-t[0],x[1]+=n[1]-t[1]}function u(){v&&v.domain(d.range().map(function(n){return(n-x[0])/b}).map(d.invert)),M&&M.domain(y.range().map(function(n){return(n-x[1])/b}).map(y.invert))}function a(n){u(),n({type:\"zoom\",scale:b,translate:x})}function o(){function n(){c=1,i(ya.mouse(r),f),a(u)}function e(){l.on(S,ba===r?s:null).on(E,null),h(c&&ya.event.target===o)}var r=this,u=q.of(r,arguments),o=ya.event.target,c=0,l=ya.select(ba).on(S,n).on(E,e),f=t(ya.mouse(r)),h=H()}function c(){function n(){var n=ya.touches(h);return f=b,s={},n.forEach(function(n){s[n.identifier]=t(n)}),n}function e(){var t=Date.now(),e=n();if(1===e.length){if(500>t-p){var u=e[0],o=s[u.identifier];r(2*b),i(u,o),g(),a(m)}p=t}else if(e.length>1){var u=e[0],c=e[1],l=u[0]-c[0],f=u[1]-c[1];d=l*l+f*f}}function u(){var n=ya.touches(h),t=n[0],e=s[t.identifier];if(u=n[1]){var u,o=s[u.identifier],c=ya.event.scale;if(null==c){var l=(l=u[0]-t[0])*l+(l=u[1]-t[1])*l;c=d&&Math.sqrt(l/d)}t=[(t[0]+u[0])/2,(t[1]+u[1])/2],e=[(e[0]+o[0])/2,(e[1]+o[1])/2],r(c*f)}p=null,i(t,e),a(m)}function l(){ya.event.touches.length?n():(v.on(A,null).on(N,null),y.on(w,o).on(k,c),M())}var s,f,h=this,m=q.of(h,arguments),d=0,v=ya.select(ba).on(A,u).on(N,l),y=ya.select(h).on(w,null).on(k,e),M=H();e()}function l(){g(),h||(h=t(ya.mouse(this))),r(Math.pow(2,.002*$a())*b),i(ya.mouse(this),h),a(q.of(this,arguments))}function s(){h=null}function f(){var n=ya.mouse(this),e=t(n),u=Math.log(b)/Math.LN2;r(Math.pow(2,ya.event.shiftKey?Math.ceil(u)-1:Math.floor(u)+1)),i(n,e),a(q.of(this,arguments))}var h,p,d,v,y,M,x=[0,0],b=1,_=Wa,w=\"mousedown.zoom\",S=\"mousemove.zoom\",E=\"mouseup.zoom\",k=\"touchstart.zoom\",A=\"touchmove.zoom\",N=\"touchend.zoom\",q=m(n,\"zoom\");return n.translate=function(t){return arguments.length?(x=t.map(Number),u(),n):x},n.scale=function(t){return arguments.length?(b=+t,u(),n):b},n.scaleExtent=function(t){return arguments.length?(_=null==t?Wa:t.map(Number),n):_},n.x=function(t){return arguments.length?(v=t,d=t.copy(),x=[0,0],b=1,n):v},n.y=function(t){return arguments.length?(M=t,y=t.copy(),x=[0,0],b=1,n):M},ya.rebind(n,q,\"on\")};var $a,Wa=[0,1/0],Ja=\"onwheel\"in Ma?($a=function(){return-ya.event.deltaY*(ya.event.deltaMode?120:1)},\"wheel\"):\"onmousewheel\"in Ma?($a=function(){return ya.event.wheelDelta},\"mousewheel\"):($a=function(){return-ya.event.detail},\"MozMousePixelScroll\");P.prototype.toString=function(){return this.rgb()+\"\"},ya.hsl=function(n,t,e){return 1===arguments.length?n instanceof Y?O(n.h,n.s,n.l):lt(\"\"+n,st,O):O(+n,+t,+e)};var Ga=Y.prototype=new P;Ga.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),O(this.h,this.s,this.l/n)},Ga.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),O(this.h,this.s,n*this.l)},Ga.rgb=function(){return R(this.h,this.s,this.l)};var Ka=Math.PI,Qa=1e-6,no=Qa*Qa,to=Ka/180,eo=180/Ka;ya.hcl=function(n,t,e){return 1===arguments.length?n instanceof W?$(n.h,n.c,n.l):n instanceof K?nt(n.l,n.a,n.b):nt((n=ft((n=ya.rgb(n)).r,n.g,n.b)).l,n.a,n.b):$(+n,+t,+e)};var ro=W.prototype=new P;ro.brighter=function(n){return $(this.h,this.c,Math.min(100,this.l+io*(arguments.length?n:1)))},ro.darker=function(n){return $(this.h,this.c,Math.max(0,this.l-io*(arguments.length?n:1)))},ro.rgb=function(){return J(this.h,this.c,this.l).rgb()},ya.lab=function(n,t,e){return 1===arguments.length?n instanceof K?G(n.l,n.a,n.b):n instanceof W?J(n.l,n.c,n.h):ft((n=ya.rgb(n)).r,n.g,n.b):G(+n,+t,+e)};var io=18,uo=.95047,ao=1,oo=1.08883,co=K.prototype=new P;co.brighter=function(n){return G(Math.min(100,this.l+io*(arguments.length?n:1)),this.a,this.b)},co.darker=function(n){return G(Math.max(0,this.l-io*(arguments.length?n:1)),this.a,this.b)},co.rgb=function(){return Q(this.l,this.a,this.b)},ya.rgb=function(n,t,e){return 1===arguments.length?n instanceof ot?at(n.r,n.g,n.b):lt(\"\"+n,at,R):at(~~n,~~t,~~e)};var lo=ot.prototype=new P;lo.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,i=30;return t||e||r?(t&&i>t&&(t=i),e&&i>e&&(e=i),r&&i>r&&(r=i),at(Math.min(255,~~(t/n)),Math.min(255,~~(e/n)),Math.min(255,~~(r/n)))):at(i,i,i)},lo.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),at(~~(n*this.r),~~(n*this.g),~~(n*this.b))},lo.hsl=function(){return st(this.r,this.g,this.b)},lo.toString=function(){return\"#\"+ct(this.r)+ct(this.g)+ct(this.b)};var so=ya.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});so.forEach(function(n,t){so.set(n,it(t))}),ya.functor=pt,ya.xhr=dt(mt),ya.dsv=function(n,t){function e(n,e,u){arguments.length<3&&(u=e,e=null);var a=ya.xhr(n,t,u);return a.row=function(n){return arguments.length?a.response(null==(e=n)?r:i(n)):e},a.row(e)}function r(n){return e.parse(n.responseText)}function i(n){return function(t){return e.parse(t.responseText,n)}}function a(t){return t.map(o).join(n)}function o(n){return c.test(n)?'\"'+n.replace(/\\\"/g,'\"\"')+'\"':n}var c=new RegExp('[\"'+n+\"\\n]\"),l=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var i=new Function(\"d\",\"return {\"+n.map(function(n,t){return JSON.stringify(n)+\": d[\"+t+\"]\"}).join(\",\")+\"}\");r=t?function(n,e){return t(i(n),e)}:i})},e.parseRows=function(n,t){function e(){if(s>=c)return a;if(i)return i=!1,u;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++<c;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}s=e+2;var r=n.charCodeAt(e+1);return 13===r?(i=!0,10===n.charCodeAt(e+2)&&++s):10===r&&(i=!0),n.substring(t+1,e).replace(/\"\"/g,'\"')}for(;c>s;){var r=n.charCodeAt(s++),o=1;if(10===r)i=!0;else if(13===r)i=!0,10===n.charCodeAt(s)&&(++s,++o);else if(r!==l)continue;return n.substring(t,s-o)}return n.substring(t)}for(var r,i,u={},a={},o=[],c=n.length,s=0,f=0;(r=e())!==a;){for(var h=[];r!==u&&r!==a;)h.push(r),r=e();(!t||(h=t(h,f++)))&&o.push(h)}return o},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new u,i=[];return t.forEach(function(n){for(var t in n)r.has(t)||i.push(r.add(t))}),[i.map(o).join(n)].concat(t.map(function(t){return i.map(function(n){return o(t[n])}).join(n)})).join(\"\\n\")},e.formatRows=function(n){return n.map(a).join(\"\\n\")},e},ya.csv=ya.dsv(\",\",\"text/csv\"),ya.tsv=ya.dsv(\"\t\",\"text/tab-separated-values\");var fo,ho,go,po,mo,vo=ba[o(ba,\"requestAnimationFrame\")]||function(n){setTimeout(n,17)};ya.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var i=e+t,u={callback:n,time:i,next:null};ho?ho.next=u:fo=u,ho=u,go||(po=clearTimeout(po),go=1,vo(Mt))},ya.timer.flush=function(){bt(),_t()};var yo=\".\",Mo=\",\",xo=[3,3],bo=\"$\",_o=[\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"].map(wt);ya.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=ya.round(n,St(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((0>=e?e+1:e-1)/3)))),_o[8+e/3]},ya.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)},ya.format=function(n){var t=wo.exec(n),e=t[1]||\" \",r=t[2]||\">\",i=t[3]||\"\",u=t[4]||\"\",a=t[5],o=+t[6],c=t[7],l=t[8],s=t[9],f=1,h=\"\",g=!1;switch(l&&(l=+l.substring(1)),(a||\"0\"===e&&\"=\"===r)&&(a=e=\"0\",r=\"=\",c&&(o-=Math.floor((o-1)/4))),s){case\"n\":c=!0,s=\"g\";break;case\"%\":f=100,h=\"%\",s=\"f\";break;case\"p\":f=100,h=\"%\",s=\"r\";break;case\"b\":case\"o\":case\"x\":case\"X\":\"#\"===u&&(u=\"0\"+s.toLowerCase());case\"c\":case\"d\":g=!0,l=0;break;case\"s\":f=-1,s=\"r\"}\"#\"===u?u=\"\":\"$\"===u&&(u=bo),\"r\"!=s||l||(s=\"g\"),null!=l&&(\"g\"==s?l=Math.max(1,Math.min(21,l)):(\"e\"==s||\"f\"==s)&&(l=Math.max(0,Math.min(20,l)))),s=So.get(s)||Et;var p=a&&c;return function(n){if(g&&n%1)return\"\";var t=0>n||0===n&&0>1/n?(n=-n,\"-\"):i;if(0>f){var m=ya.formatPrefix(n,l);n=m.scale(n),h=m.symbol}else n*=f;n=s(n,l);var d=n.lastIndexOf(\".\"),v=0>d?n:n.substring(0,d),y=0>d?\"\":yo+n.substring(d+1);!a&&c&&(v=Eo(v));var M=u.length+v.length+y.length+(p?0:t.length),x=o>M?new Array(M=o-M+1).join(e):\"\";return p&&(v=Eo(x+v)),t+=u,n=v+y,(\"<\"===r?t+n+x:\">\"===r?x+t+n:\"^\"===r?x.substring(0,M>>=1)+t+n+x.substring(M):t+(p?n:x+n))+h}};var wo=/(?:([^{])?([<>=^]))?([+\\- ])?([$#])?(0)?(\\d+)?(,)?(\\.-?\\d+)?([a-z%])?/i,So=ya.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ya.round(n,St(n,t))).toFixed(Math.max(0,Math.min(20,St(n*(1+1e-15),t))))}}),Eo=mt;if(xo){var ko=xo.length;Eo=function(n){for(var t=n.length,e=[],r=0,i=xo[0];t>0&&i>0;)e.push(n.substring(t-=i,t+i)),i=xo[r=(r+1)%ko];return e.reverse().join(Mo)}}ya.geo={},kt.prototype={s:0,t:0,add:function(n){At(n,this.t,Ao),At(Ao.s,this.s,this),this.s?this.t+=Ao.t:this.s=Ao.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Ao=new kt;ya.geo.stream=function(n,t){n&&No.hasOwnProperty(n.type)?No[n.type](n,t):Nt(n,t)};var No={Feature:function(n,t){Nt(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++r<i;)Nt(e[r].geometry,t)}},qo={Sphere:function(n,t){t.sphere()},Point:function(n,t){var e=n.coordinates;t.point(e[0],e[1])},MultiPoint:function(n,t){for(var e,r=n.coordinates,i=-1,u=r.length;++i<u;)e=r[i],t.point(e[0],e[1])},LineString:function(n,t){qt(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)qt(e[r],t,0)},Polygon:function(n,t){Tt(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)Tt(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,i=e.length;++r<i;)Nt(e[r],t)}};ya.geo.area=function(n){return To=0,ya.geo.stream(n,zo),To};var To,Co=new kt,zo={sphere:function(){To+=4*Ka},point:s,lineStart:s,lineEnd:s,polygonStart:function(){Co.reset(),zo.lineStart=Ct},polygonEnd:function(){var n=2*Co;To+=0>n?4*Ka+n:n,zo.lineStart=zo.lineEnd=zo.point=s}};ya.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=zt([t*to,e*to]);if(v){var i=jt(v,r),u=[i[1],-i[0],0],a=jt(u,i);Ft(a),a=Pt(a);var c=t-p,l=c>0?1:-1,m=a[0]*eo*l,d=Math.abs(c)>180;if(d^(m>l*p&&l*t>m)){var y=a[1]*eo;y>g&&(g=y)}else if(m=(m+360)%360-180,d^(m>l*p&&l*t>m)){var y=-a[1]*eo;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?o(s,t)>o(s,h)&&(h=t):o(t,h)>o(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?o(s,t)>o(s,h)&&(h=t):o(t,h)>o(s,h)&&(s=t)}else n(t,e);v=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,v=null}function i(n,e){if(v){var r=n-p;y+=Math.abs(r)>180?r+(r>0?360:-360):r}else m=n,d=e;zo.point(n,e),t(n,e)}function u(){zo.lineStart()}function a(){i(m,d),zo.lineEnd(),Math.abs(y)>Qa&&(s=-(h=180)),x[0]=s,x[1]=h,v=null}function o(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var s,f,h,g,p,m,d,v,y,M,x,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=i,b.lineStart=u,b.lineEnd=a,y=0,zo.polygonStart()},polygonEnd:function(){zo.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>Co?(s=-(h=180),f=-(g=90)):y>Qa?g=90:-Qa>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],ya.geo.stream(n,b);var t=M.length;if(t){M.sort(c);for(var e,r=1,i=M[0],u=[i];t>r;++r)e=M[r],l(e[0],i)||l(e[1],i)?(o(i[0],e[1])>o(i[0],i[1])&&(i[1]=e[1]),o(e[0],i[1])>o(i[0],i[1])&&(i[0]=e[0])):u.push(i=e);for(var a,e,p=-1/0,t=u.length-1,r=0,i=u[t];t>=r;i=e,++r)e=u[r],(a=o(i[1],e[0]))>p&&(p=a,s=e[0],h=i[1])}return M=x=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),ya.geo.centroid=function(n){Do=jo=Lo=Ho=Fo=Po=Oo=Yo=Ro=Uo=Io=0,ya.geo.stream(n,Vo);var t=Ro,e=Uo,r=Io,i=t*t+e*e+r*r;return no>i&&(t=Po,e=Oo,r=Yo,Qa>jo&&(t=Lo,e=Ho,r=Fo),i=t*t+e*e+r*r,no>i)?[0/0,0/0]:[Math.atan2(e,t)*eo,V(r/Math.sqrt(i))*eo]};var Do,jo,Lo,Ho,Fo,Po,Oo,Yo,Ro,Uo,Io,Vo={sphere:s,point:Yt,lineStart:Ut,lineEnd:It,polygonStart:function(){Vo.lineStart=Vt},polygonEnd:function(){Vo.lineStart=Ut}},Xo=$t(Xt,Qt,te,ee),Zo=[-Ka,0],Bo=1e9;(ya.geo.conicEqualArea=function(){return oe(ce)}).raw=ce,ya.geo.albers=function(){return ya.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ya.geo.albersUsa=function(){function n(n){var u=n[0],a=n[1];return t=null,e(u,a),t||(r(u,a),t)||i(u,a),t}var t,e,r,i,u=ya.geo.albers(),a=ya.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o=ya.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=u.scale(),e=u.translate(),r=(n[0]-e[0])/t,i=(n[1]-e[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?a:i>=.166&&.234>i&&r>=-.214&&-.115>r?o:u).invert(n)},n.stream=function(n){var t=u.stream(n),e=a.stream(n),r=o.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(u.precision(t),a.precision(t),o.precision(t),n):u.precision()},n.scale=function(t){return arguments.length?(u.scale(t),a.scale(.35*t),o.scale(t),n.translate(u.translate())):u.scale()},n.translate=function(t){if(!arguments.length)return u.translate();var l=u.scale(),s=+t[0],f=+t[1];return e=u.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=a.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Qa,f+.12*l+Qa],[s-.214*l-Qa,f+.234*l-Qa]]).stream(c).point,i=o.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Qa,f+.166*l+Qa],[s-.115*l-Qa,f+.234*l-Qa]]).stream(c).point,n},n.scale(1070)};var $o,Wo,Jo,Go,Ko,Qo,nc={point:s,lineStart:s,lineEnd:s,polygonStart:function(){Wo=0,nc.lineStart=le},polygonEnd:function(){nc.lineStart=nc.lineEnd=nc.point=s,$o+=Math.abs(Wo/2)}},tc={point:se,lineStart:s,lineEnd:s,polygonStart:s,polygonEnd:s},ec={point:ge,lineStart:pe,lineEnd:me,polygonStart:function(){ec.lineStart=de},polygonEnd:function(){ec.point=ge,ec.lineStart=pe,ec.lineEnd=me}};ya.geo.path=function(){function n(n){return n&&(\"function\"==typeof o&&u.pointRadius(+o.apply(this,arguments)),a&&a.valid||(a=i(u)),ya.geo.stream(n,a)),u.result()}function t(){return a=null,n}var e,r,i,u,a,o=4.5;return n.area=function(n){return $o=0,ya.geo.stream(n,i(nc)),$o},n.centroid=function(n){return Lo=Ho=Fo=Po=Oo=Yo=Ro=Uo=Io=0,ya.geo.stream(n,i(ec)),Io?[Ro/Io,Uo/Io]:Yo?[Po/Yo,Oo/Yo]:Fo?[Lo/Fo,Ho/Fo]:[0/0,0/0]},n.bounds=function(n){return Ko=Qo=-(Jo=Go=1/0),ya.geo.stream(n,i(tc)),[[Jo,Go],[Ko,Qo]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||Me(n):mt,t()):e},n.context=function(n){return arguments.length?(u=null==(r=n)?new fe:new ve(n),\"function\"!=typeof o&&u.pointRadius(o),t()):r},n.pointRadius=function(t){return arguments.length?(o=\"function\"==typeof t?t:(u.pointRadius(+t),+t),n):o},n.projection(ya.geo.albersUsa()).context(null)},ya.geo.projection=xe,ya.geo.projectionMutator=be,(ya.geo.equirectangular=function(){return xe(we)}).raw=we.invert=we,ya.geo.rotation=function(n){function t(t){return t=n(t[0]*to,t[1]*to),t[0]*=eo,t[1]*=eo,t}return n=Se(n[0]%360*to,n[1]*to,n.length>2?n[2]*to:0),t.invert=function(t){return t=n.invert(t[0]*to,t[1]*to),t[0]*=eo,t[1]*=eo,t},t},ya.geo.circle=function(){function n(){var n=\"function\"==typeof r?r.apply(this,arguments):r,t=Se(-n[0]*to,-n[1]*to,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=eo,n[1]*=eo}}),{type:\"Polygon\",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=Ne((t=+r)*to,i*to),n):t},n.precision=function(r){return arguments.length?(e=Ne(t*to,(i=+r)*to),n):i},n.angle(90)},ya.geo.distance=function(n,t){var e,r=(t[0]-n[0])*to,i=n[1]*to,u=t[1]*to,a=Math.sin(r),o=Math.cos(r),c=Math.sin(i),l=Math.cos(i),s=Math.sin(u),f=Math.cos(u);return Math.atan2(Math.sqrt((e=f*a)*e+(e=l*s-c*f*o)*e),c*s+l*f*o)},ya.geo.graticule=function(){function n(){return{type:\"MultiLineString\",coordinates:t()}}function t(){return ya.range(Math.ceil(u/d)*d,i,d).map(h).concat(ya.range(Math.ceil(l/v)*v,c,v).map(g)).concat(ya.range(Math.ceil(r/p)*p,e,p).filter(function(n){return Math.abs(n%d)>Qa}).map(s)).concat(ya.range(Math.ceil(o/m)*m,a,m).filter(function(n){return Math.abs(n%v)>Qa}).map(f))}var e,r,i,u,a,o,c,l,s,f,h,g,p=10,m=p,d=90,v=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:\"LineString\",coordinates:n}})},n.outline=function(){return{type:\"Polygon\",coordinates:[h(u).concat(g(c).slice(1),h(i).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(u=+t[0][0],i=+t[1][0],l=+t[0][1],c=+t[1][1],u>i&&(t=u,u=i,i=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[u,l],[i,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),o>a&&(t=o,o=a,a=t),n.precision(y)):[[r,o],[e,a]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],v=+t[1],n):[d,v]},n.minorStep=function(t){return arguments.length?(p=+t[0],m=+t[1],n):[p,m]},n.precision=function(t){return arguments.length?(y=+t,s=Te(o,a,90),f=Ce(r,e,y),h=Te(l,c,90),g=Ce(u,i,y),n):y},n.majorExtent([[-180,-90+Qa],[180,90-Qa]]).minorExtent([[-180,-80-Qa],[180,80+Qa]])},ya.geo.greatArc=function(){function n(){return{type:\"LineString\",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=ze,i=De;return n.distance=function(){return ya.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t=\"function\"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e=\"function\"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},ya.geo.interpolate=function(n,t){return je(n[0]*to,n[1]*to,t[0]*to,t[1]*to)},ya.geo.length=function(n){return rc=0,ya.geo.stream(n,ic),rc};var rc,ic={sphere:s,point:s,lineStart:Le,lineEnd:s,polygonStart:s,polygonEnd:s},uc=He(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ya.geo.azimuthalEqualArea=function(){return xe(uc)}).raw=uc;var ac=He(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},mt);(ya.geo.azimuthalEquidistant=function(){return xe(ac)}).raw=ac,(ya.geo.conicConformal=function(){return oe(Fe)}).raw=Fe,(ya.geo.conicEquidistant=function(){return oe(Pe)}).raw=Pe;var oc=He(function(n){return 1/n},Math.atan);(ya.geo.gnomonic=function(){return xe(oc)}).raw=oc,Oe.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Ka/2]},(ya.geo.mercator=function(){return Ye(Oe)}).raw=Oe;var cc=He(function(){return 1},Math.asin);(ya.geo.orthographic=function(){return xe(cc)}).raw=cc;var lc=He(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ya.geo.stereographic=function(){return xe(lc)}).raw=lc,Re.invert=function(n,t){return[Math.atan2(X(n),Math.cos(t)),V(Math.sin(t)/Z(n))]},(ya.geo.transverseMercator=function(){return Ye(Re)}).raw=Re,ya.geom={},ya.svg={},ya.svg.line=function(){return Ue(mt)};var sc=ya.map({linear:Xe,\"linear-closed\":Ze,step:Be,\"step-before\":$e,\"step-after\":We,basis:tr,\"basis-open\":er,\"basis-closed\":rr,bundle:ir,cardinal:Ke,\"cardinal-open\":Je,\"cardinal-closed\":Ge,monotone:sr});\nsc.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var fc=[0,2/3,1/3,0],hc=[0,1/3,2/3,0],gc=[0,1/6,2/3,1/6];ya.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i,u,a,o,c,l,s,f,h,g,p,m=pt(e),d=pt(r),v=n.length,y=v-1,M=[],x=[],b=0;if(m===Ie&&r===Ve)t=n;else for(u=0,t=[];v>u;++u)t.push([+m.call(this,i=n[u],u),+d.call(this,i,u)]);for(u=1;v>u;++u)(t[u][1]<t[b][1]||t[u][1]==t[b][1]&&t[u][0]<t[b][0])&&(b=u);for(u=0;v>u;++u)u!==b&&(c=t[u][1]-t[b][1],o=t[u][0]-t[b][0],M.push({angle:Math.atan2(c,o),index:u}));for(M.sort(function(n,t){return n.angle-t.angle}),g=M[0].angle,h=M[0].index,f=0,u=1;y>u;++u){if(a=M[u].index,g==M[u].angle){if(o=t[h][0]-t[b][0],c=t[h][1]-t[b][1],l=t[a][0]-t[b][0],s=t[a][1]-t[b][1],o*o+c*c>=l*l+s*s){M[u].index=-1;continue}M[f].index=-1}g=M[u].angle,f=u,h=a}for(x.push(b),u=0,a=0;2>u;++a)M[a].index>-1&&(x.push(M[a].index),u++);for(p=x.length;y>a;++a)if(!(M[a].index<0)){for(;!fr(x[p-2],x[p-1],M[a].index,t);)--p;x[p++]=M[a].index}var _=[];for(u=p-1;u>=0;--u)_.push(n[x[u]]);return _}var e=Ie,r=Ve;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},ya.geom.polygon=function(n){return La(n,pc),n};var pc=ya.geom.polygon.prototype=[];pc.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],i=0;++t<e;)n=r,r=this[t],i+=n[1]*r[0]-n[0]*r[1];return.5*i},pc.centroid=function(n){var t,e,r=-1,i=this.length,u=0,a=0,o=this[i-1];for(arguments.length||(n=-1/(6*this.area()));++r<i;)t=o,o=this[r],e=t[0]*o[1]-o[0]*t[1],u+=(t[0]+o[0])*e,a+=(t[1]+o[1])*e;return[u*n,a*n]},pc.clip=function(n){for(var t,e,r,i,u,a,o=pr(n),c=-1,l=this.length-pr(this),s=this[l-1];++c<l;){for(t=n.slice(),n.length=0,i=this[c],u=t[(r=t.length-o)-1],e=-1;++e<r;)a=t[e],hr(a,s,i)?(hr(u,s,i)||n.push(gr(u,a,s,i)),n.push(a)):hr(u,s,i)&&n.push(gr(u,a,s,i)),u=a;o&&n.push(n[0]),s=i}return n},ya.geom.delaunay=function(n){var t=n.map(function(){return[]}),e=[];return mr(n,function(e){t[e.region.l.index].push(n[e.region.r.index])}),t.forEach(function(t,r){var i=n[r],u=i[0],a=i[1];t.forEach(function(n){n.angle=Math.atan2(n[0]-u,n[1]-a)}),t.sort(function(n,t){return n.angle-t.angle});for(var o=0,c=t.length-1;c>o;o++)e.push([i,t[o],t[o+1]])}),e},ya.geom.voronoi=function(n){function t(n){var t,u,a,o=n.map(function(){return[]}),c=pt(e),l=pt(r),s=n.length,f=1e6;if(c===Ie&&l===Ve)t=n;else for(t=new Array(s),a=0;s>a;++a)t[a]=[+c.call(this,u=n[a],a),+l.call(this,u,a)];if(mr(t,function(n){var t,e,r,i,u,a;1===n.a&&n.b>=0?(t=n.ep.r,e=n.ep.l):(t=n.ep.l,e=n.ep.r),1===n.a?(u=t?t.y:-f,r=n.c-n.b*u,a=e?e.y:f,i=n.c-n.b*a):(r=t?t.x:-f,u=n.c-n.a*r,i=e?e.x:f,a=n.c-n.a*i);var c=[r,u],l=[i,a];o[n.region.l.index].push(c,l),o[n.region.r.index].push(c,l)}),o=o.map(function(n,e){var r=t[e][0],i=t[e][1],u=n.map(function(n){return Math.atan2(n[0]-r,n[1]-i)}),a=ya.range(n.length).sort(function(n,t){return u[n]-u[t]});return a.filter(function(n,t){return!t||u[n]-u[a[t-1]]>Qa}).map(function(t){return n[t]})}),o.forEach(function(n,e){var r=n.length;if(!r)return n.push([-f,-f],[-f,f],[f,f],[f,-f]);if(!(r>2)){var i=t[e],u=n[0],a=n[1],o=i[0],c=i[1],l=u[0],s=u[1],h=a[0],g=a[1],p=Math.abs(h-l),m=g-s;if(Math.abs(m)<Qa){var d=s>c?-f:f;n.push([-f,d],[f,d])}else if(Qa>p){var v=l>o?-f:f;n.push([v,-f],[v,f])}else{var d=(l-o)*(g-s)>(h-l)*(s-c)?f:-f,y=Math.abs(m)-p;Math.abs(y)<Qa?n.push([0>m?d:-d,d]):(y>0&&(d*=-1),n.push([-f,d],[f,d]))}}}),i)for(a=0;s>a;++a)i.clip(o[a]);for(a=0;s>a;++a)o[a].point=n[a];return o}var e=Ie,r=Ve,i=null;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.clipExtent=function(n){if(!arguments.length)return i&&[i[0],i[2]];if(null==n)i=null;else{var e=+n[0][0],r=+n[0][1],u=+n[1][0],a=+n[1][1];i=ya.geom.polygon([[e,r],[e,a],[u,a],[u,r]])}return t},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):i&&i[2]},t.links=function(n){var t,i,u,a=n.map(function(){return[]}),o=[],c=pt(e),l=pt(r),s=n.length;if(c===Ie&&l===Ve)t=n;else for(t=new Array(s),u=0;s>u;++u)t[u]=[+c.call(this,i=n[u],u),+l.call(this,i,u)];return mr(t,function(t){var e=t.region.l.index,r=t.region.r.index;a[e][r]||(a[e][r]=a[r][e]=!0,o.push({source:n[e],target:n[r]}))}),o},t.triangles=function(n){if(e===Ie&&r===Ve)return ya.geom.delaunay(n);for(var t,i=new Array(c),u=pt(e),a=pt(r),o=-1,c=n.length;++o<c;)(i[o]=[+u.call(this,t=n[o],o),+a.call(this,t,o)]).data=t;return ya.geom.delaunay(i).map(function(n){return n.map(function(n){return n.data})})},t)};var mc={l:\"r\",r:\"l\"};ya.geom.quadtree=function(n,t,e,r,i){function u(n){function u(n,t,e,r,i,u,a,o){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,s=n.y;if(null!=c)if(Math.abs(c-e)+Math.abs(s-r)<.01)l(n,t,e,r,i,u,a,o);else{var f=n.point;n.x=n.y=n.point=null,l(n,f,c,s,i,u,a,o),l(n,t,e,r,i,u,a,o)}else n.x=e,n.y=r,n.point=t}else l(n,t,e,r,i,u,a,o)}function l(n,t,e,r,i,a,o,c){var l=.5*(i+o),s=.5*(a+c),f=e>=l,h=r>=s,g=(h<<1)+f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=yr()),f?i=l:o=l,h?a=s:c=s,u(n,t,e,r,i,a,o,c)}var s,f,h,g,p,m,d,v,y,M=pt(o),x=pt(c);if(null!=t)m=t,d=e,v=r,y=i;else if(v=y=-(m=d=1/0),f=[],h=[],p=n.length,a)for(g=0;p>g;++g)s=n[g],s.x<m&&(m=s.x),s.y<d&&(d=s.y),s.x>v&&(v=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);m>b&&(m=b),d>_&&(d=_),b>v&&(v=b),_>y&&(y=_),f.push(b),h.push(_)}var w=v-m,S=y-d;w>S?y=d+w:v=m+S;var E=yr();if(E.add=function(n){u(E,n,+M(n,++g),+x(n,g),m,d,v,y)},E.visit=function(n){Mr(n,E,m,d,v,y)},g=-1,null==t){for(;++g<p;)u(E,n[g],f[g],h[g],m,d,v,y);--g}else n.forEach(E.add);return f=h=n=s=null,E}var a,o=Ie,c=Ve;return(a=arguments.length)?(o=dr,c=vr,3===a&&(i=e,r=t,e=t=0),u(n)):(u.x=function(n){return arguments.length?(o=n,u):o},u.y=function(n){return arguments.length?(c=n,u):c},u.extent=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],i=+n[1][1]),u):null==t?null:[[t,e],[r,i]]},u.size=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=e=0,r=+n[0],i=+n[1]),u):null==t?null:[r-t,i-e]},u)},ya.interpolateRgb=xr,ya.interpolateObject=br,ya.interpolateNumber=_r,ya.interpolateString=wr;var dc=/[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g;ya.interpolate=Sr,ya.interpolators=[function(n,t){var e=typeof t;return(\"string\"===e?so.has(t)||/^(#|rgb\\(|hsl\\()/.test(t)?xr:wr:t instanceof P?xr:\"object\"===e?Array.isArray(t)?Er:br:_r)(n,t)}],ya.interpolateArray=Er;var vc=function(){return mt},yc=ya.map({linear:vc,poly:zr,quad:function(){return qr},cubic:function(){return Tr},sin:function(){return Dr},exp:function(){return jr},circle:function(){return Lr},elastic:Hr,back:Fr,bounce:function(){return Pr}}),Mc=ya.map({\"in\":mt,out:Ar,\"in-out\":Nr,\"out-in\":function(n){return Nr(Ar(n))}});ya.ease=function(n){var t=n.indexOf(\"-\"),e=t>=0?n.substring(0,t):n,r=t>=0?n.substring(t+1):\"in\";return e=yc.get(e)||vc,r=Mc.get(r)||mt,kr(r(e.apply(null,Array.prototype.slice.call(arguments,1))))},ya.interpolateHcl=Or,ya.interpolateHsl=Yr,ya.interpolateLab=Rr,ya.interpolateRound=Ur,ya.transform=function(n){var t=Ma.createElementNS(ya.ns.prefix.svg,\"g\");return(ya.transform=function(n){if(null!=n){t.setAttribute(\"transform\",n);var e=t.transform.baseVal.consolidate()}return new Ir(e?e.matrix:xc)})(n)},Ir.prototype.toString=function(){return\"translate(\"+this.translate+\")rotate(\"+this.rotate+\")skewX(\"+this.skew+\")scale(\"+this.scale+\")\"};var xc={a:1,b:0,c:0,d:1,e:0,f:0};ya.interpolateTransform=Br,ya.layout={},ya.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Jr(n[e]));return t}},ya.layout.chord=function(){function n(){var n,l,f,h,g,p={},m=[],d=ya.range(u),v=[];for(e=[],r=[],n=0,h=-1;++h<u;){for(l=0,g=-1;++g<u;)l+=i[h][g];m.push(l),v.push(ya.range(u)),n+=l}for(a&&d.sort(function(n,t){return a(m[n],m[t])}),o&&v.forEach(function(n,t){n.sort(function(n,e){return o(i[t][n],i[t][e])})}),n=(2*Ka-s*u)/n,l=0,h=-1;++h<u;){for(f=l,g=-1;++g<u;){var y=d[h],M=v[y][g],x=i[y][M],b=l,_=l+=x*n;p[y+\"-\"+M]={index:y,subindex:M,startAngle:b,endAngle:_,value:x}}r[y]={index:y,startAngle:f,endAngle:l,value:(l-f)/n},l+=s}for(h=-1;++h<u;)for(g=h-1;++g<u;){var w=p[h+\"-\"+g],S=p[g+\"-\"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,i,u,a,o,c,l={},s=0;return l.matrix=function(n){return arguments.length?(u=(i=n)&&i.length,e=r=null,l):i},l.padding=function(n){return arguments.length?(s=n,e=r=null,l):s},l.sortGroups=function(n){return arguments.length?(a=n,e=r=null,l):a},l.sortSubgroups=function(n){return arguments.length?(o=n,e=null,l):o},l.sortChords=function(n){return arguments.length?(c=n,e&&t(),l):c},l.chords=function(){return e||n(),e},l.groups=function(){return r||n(),r},l},ya.layout.force=function(){function n(n){return function(t,e,r,i){if(t.point!==n){var u=t.cx-n.x,a=t.cy-n.y,o=1/Math.sqrt(u*u+a*a);if(m>(i-e)*o){var c=t.charge*o*o;return n.px-=u*c,n.py-=a*c,!0}if(t.point&&isFinite(o)){var c=t.pointCharge*o*o;n.px-=u*c,n.py-=a*c}}return!t.charge}}function t(n){n.px=ya.event.x,n.py=ya.event.y,o.resume()}var e,r,i,u,a,o={},c=ya.dispatch(\"start\",\"tick\",\"end\"),l=[1,1],s=.9,f=bc,h=_c,g=-30,p=.1,m=.8,d=[],v=[];return o.tick=function(){if((r*=.99)<.005)return c.end({type:\"end\",alpha:r=0}),!0;var t,e,o,f,h,m,y,M,x,b=d.length,_=v.length;for(e=0;_>e;++e)o=v[e],f=o.source,h=o.target,M=h.x-f.x,x=h.y-f.y,(m=M*M+x*x)&&(m=r*u[e]*((m=Math.sqrt(m))-i[e])/m,M*=m,x*=m,h.x-=M*(y=f.weight/(h.weight+f.weight)),h.y-=x*y,f.x+=M*(y=1-y),f.y+=x*y);if((y=r*p)&&(M=l[0]/2,x=l[1]/2,e=-1,y))for(;++e<b;)o=d[e],o.x+=(M-o.x)*y,o.y+=(x-o.y)*y;if(g)for(ri(t=ya.geom.quadtree(d),r,a),e=-1;++e<b;)(o=d[e]).fixed||t.visit(n(o));for(e=-1;++e<b;)o=d[e],o.fixed?(o.x=o.px,o.y=o.py):(o.x-=(o.px-(o.px=o.x))*s,o.y-=(o.py-(o.py=o.y))*s);c.tick({type:\"tick\",alpha:r})},o.nodes=function(n){return arguments.length?(d=n,o):d},o.links=function(n){return arguments.length?(v=n,o):v},o.size=function(n){return arguments.length?(l=n,o):l},o.linkDistance=function(n){return arguments.length?(f=\"function\"==typeof n?n:+n,o):f},o.distance=o.linkDistance,o.linkStrength=function(n){return arguments.length?(h=\"function\"==typeof n?n:+n,o):h},o.friction=function(n){return arguments.length?(s=+n,o):s},o.charge=function(n){return arguments.length?(g=\"function\"==typeof n?n:+n,o):g},o.gravity=function(n){return arguments.length?(p=+n,o):p},o.theta=function(n){return arguments.length?(m=+n,o):m},o.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:\"start\",alpha:r=n}),ya.timer(o.tick)),o):r},o.start=function(){function n(n,r){for(var i,u=t(e),a=-1,o=u.length;++a<o;)if(!isNaN(i=u[a][n]))return i;return Math.random()*r}function t(){if(!c){for(c=[],r=0;p>r;++r)c[r]=[];for(r=0;m>r;++r){var n=v[r];c[n.source.index].push(n.target),c[n.target.index].push(n.source)}}return c[e]}var e,r,c,s,p=d.length,m=v.length,y=l[0],M=l[1];for(e=0;p>e;++e)(s=d[e]).index=e,s.weight=0;for(e=0;m>e;++e)s=v[e],\"number\"==typeof s.source&&(s.source=d[s.source]),\"number\"==typeof s.target&&(s.target=d[s.target]),++s.source.weight,++s.target.weight;for(e=0;p>e;++e)s=d[e],isNaN(s.x)&&(s.x=n(\"x\",y)),isNaN(s.y)&&(s.y=n(\"y\",M)),isNaN(s.px)&&(s.px=s.x),isNaN(s.py)&&(s.py=s.y);if(i=[],\"function\"==typeof f)for(e=0;m>e;++e)i[e]=+f.call(this,v[e],e);else for(e=0;m>e;++e)i[e]=f;if(u=[],\"function\"==typeof h)for(e=0;m>e;++e)u[e]=+h.call(this,v[e],e);else for(e=0;m>e;++e)u[e]=h;if(a=[],\"function\"==typeof g)for(e=0;p>e;++e)a[e]=+g.call(this,d[e],e);else for(e=0;p>e;++e)a[e]=g;return o.resume()},o.resume=function(){return o.alpha(.1)},o.stop=function(){return o.alpha(0)},o.drag=function(){return e||(e=ya.behavior.drag().origin(mt).on(\"dragstart.force\",Qr).on(\"drag.force\",t).on(\"dragend.force\",ni)),arguments.length?(this.on(\"mouseover.force\",ti).on(\"mouseout.force\",ei).call(e),void 0):e},ya.rebind(o,c,\"on\")};var bc=20,_c=1;ya.layout.hierarchy=function(){function n(t,a,o){var c=i.call(e,t,a);if(t.depth=a,o.push(t),c&&(l=c.length)){for(var l,s,f=-1,h=t.children=[],g=0,p=a+1;++f<l;)s=n(c[f],p,o),s.parent=t,h.push(s),g+=s.value;r&&h.sort(r),u&&(t.value=g)}else u&&(t.value=+u.call(e,t,a)||0);return t}function t(n,r){var i=n.children,a=0;if(i&&(o=i.length))for(var o,c=-1,l=r+1;++c<o;)a+=t(i[c],l);else u&&(a=+u.call(e,n,r)||0);return u&&(n.value=a),a}function e(t){var e=[];return n(t,0,e),e}var r=oi,i=ui,u=ai;return e.sort=function(n){return arguments.length?(r=n,e):r},e.children=function(n){return arguments.length?(i=n,e):i},e.value=function(n){return arguments.length?(u=n,e):u},e.revalue=function(n){return t(n,0),n},e},ya.layout.partition=function(){function n(t,e,r,i){var u=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,u&&(a=u.length)){var a,o,c,l=-1;for(r=t.value?r/t.value:0;++l<a;)n(o=u[l],e,c=o.value*r,i),e+=c}}function t(n){var e=n.children,r=0;if(e&&(i=e.length))for(var i,u=-1;++u<i;)r=Math.max(r,t(e[u]));return 1+r}function e(e,u){var a=r.call(this,e,u);return n(a[0],0,i[0],i[1]/t(a[0])),a}var r=ya.layout.hierarchy(),i=[1,1];return e.size=function(n){return arguments.length?(i=n,e):i},ii(e,r)},ya.layout.pie=function(){function n(u){var a=u.map(function(e,r){return+t.call(n,e,r)}),o=+(\"function\"==typeof r?r.apply(this,arguments):r),c=((\"function\"==typeof i?i.apply(this,arguments):i)-o)/ya.sum(a),l=ya.range(u.length);null!=e&&l.sort(e===wc?function(n,t){return a[t]-a[n]}:function(n,t){return e(u[n],u[t])});var s=[];return l.forEach(function(n){var t;s[n]={data:u[n],value:t=a[n],startAngle:o,endAngle:o+=t*c}}),s}var t=Number,e=wc,r=0,i=2*Ka;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(i=t,n):i},n};var wc={};ya.layout.stack=function(){function n(o,c){var l=o.map(function(e,r){return t.call(n,e,r)}),s=l.map(function(t){return t.map(function(t,e){return[u.call(n,t,e),a.call(n,t,e)]})}),f=e.call(n,s,c);l=ya.permute(l,f),s=ya.permute(s,f);var h,g,p,m=r.call(n,s,c),d=l.length,v=l[0].length;for(g=0;v>g;++g)for(i.call(n,l[0][g],p=m[g],s[0][g][1]),h=1;d>h;++h)i.call(n,l[h][g],p+=s[h-1][g][1],s[h][g][1]);return o}var t=mt,e=hi,r=gi,i=fi,u=li,a=si;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e=\"function\"==typeof t?t:Sc.get(t)||hi,n):e},n.offset=function(t){return arguments.length?(r=\"function\"==typeof t?t:Ec.get(t)||gi,n):r},n.x=function(t){return arguments.length?(u=t,n):u},n.y=function(t){return arguments.length?(a=t,n):a},n.out=function(t){return arguments.length?(i=t,n):i},n};var Sc=ya.map({\"inside-out\":function(n){var t,e,r=n.length,i=n.map(pi),u=n.map(mi),a=ya.range(r).sort(function(n,t){return i[n]-i[t]}),o=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=a[t],c>o?(o+=u[e],l.push(e)):(c+=u[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return ya.range(n.length).reverse()},\"default\":hi}),Ec=ya.map({silhouette:function(n){var t,e,r,i=n.length,u=n[0].length,a=[],o=0,c=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];r>o&&(o=r),a.push(r)}for(e=0;u>e;++e)c[e]=(o-a[e])/2;return c},wiggle:function(n){var t,e,r,i,u,a,o,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,i=0;s>t;++t)i+=n[t][e][1];for(t=0,u=0,o=f[e][0]-f[e-1][0];s>t;++t){for(r=0,a=(n[t][e][1]-n[t][e-1][1])/(2*o);t>r;++r)a+=(n[r][e][1]-n[r][e-1][1])/o;u+=a*n[t][e][1]}g[e]=c-=i?u/i*o:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,i=n.length,u=n[0].length,a=1/i,o=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];if(r)for(t=0;i>t;t++)n[t][e][1]/=r;else for(t=0;i>t;t++)n[t][e][1]=a}for(e=0;u>e;++e)o[e]=0;return o},zero:gi});ya.layout.histogram=function(){function n(n,u){for(var a,o,c=[],l=n.map(e,this),s=r.call(this,l,u),f=i.call(this,s,l,u),u=-1,h=l.length,g=f.length-1,p=t?1:1/h;++u<g;)a=c[u]=[],a.dx=f[u+1]-(a.x=f[u]),a.y=0;if(g>0)for(u=-1;++u<h;)o=l[u],o>=s[0]&&o<=s[1]&&(a=c[ya.bisect(f,o,1,g)-1],a.y+=p,a.push(n[u]));return c}var t=!0,e=Number,r=Mi,i=vi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=pt(t),n):r},n.bins=function(t){return arguments.length?(i=\"number\"==typeof t?function(n){return yi(n,t)}:pt(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ya.layout.tree=function(){function n(n,u){function a(n,t){var r=n.children,i=n._tree;if(r&&(u=r.length)){for(var u,o,l,s=r[0],f=s,h=-1;++h<u;)l=r[h],a(l,o),f=c(l,o,f),o=l;Ni(n);var g=.5*(s._tree.prelim+l._tree.prelim);t?(i.prelim=t._tree.prelim+e(n,t),i.mod=i.prelim-g):i.prelim=g}else t&&(i.prelim=t._tree.prelim+e(n,t))}function o(n,t){n.x=n._tree.prelim+t;var e=n.children;if(e&&(r=e.length)){var r,i=-1;for(t+=n._tree.mod;++i<r;)o(e[i],t)}}function c(n,t,r){if(t){for(var i,u=n,a=n,o=t,c=n.parent.children[0],l=u._tree.mod,s=a._tree.mod,f=o._tree.mod,h=c._tree.mod;o=_i(o),u=bi(u),o&&u;)c=bi(c),a=_i(a),a._tree.ancestor=n,i=o._tree.prelim+f-u._tree.prelim-l+e(o,u),i>0&&(qi(Ti(o,n,r),n,i),l+=i,s+=i),f+=o._tree.mod,l+=u._tree.mod,h+=c._tree.mod,s+=a._tree.mod;o&&!_i(a)&&(a._tree.thread=o,a._tree.mod+=f-s),u&&!bi(c)&&(c._tree.thread=u,c._tree.mod+=l-h,r=n)}return r}var l=t.call(this,n,u),s=l[0];Ai(s,function(n,t){n._tree={ancestor:n,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),a(s),o(s,-s._tree.prelim);var f=wi(s,Ei),h=wi(s,Si),g=wi(s,ki),p=f.x-e(f,h)/2,m=h.x+e(h,f)/2,d=g.depth||1;return Ai(s,i?function(n){n.x*=r[0],n.y=n.depth*r[1],delete n._tree}:function(n){n.x=(n.x-p)/(m-p)*r[0],n.y=n.depth/d*r[1],delete n._tree}),l}var t=ya.layout.hierarchy().sort(null).value(null),e=xi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ii(n,t)},ya.layout.pack=function(){function n(n,u){var a=e.call(this,n,u),o=a[0],c=i[0],l=i[1],s=null==t?Math.sqrt:\"function\"==typeof t?t:function(){return t};if(o.x=o.y=0,Ai(o,function(n){n.r=+s(n.value)}),Ai(o,Li),r){var f=r*(t?1:Math.max(2*o.r/c,2*o.r/l))/2;Ai(o,function(n){n.r+=f}),Ai(o,Li),Ai(o,function(n){n.r-=f})}return Pi(o,c/2,l/2,t?1:1/Math.max(2*o.r/c,2*o.r/l)),a}var t,e=ya.layout.hierarchy().sort(Ci),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||\"function\"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ii(n,e)},ya.layout.cluster=function(){function n(n,u){var a,o=t.call(this,n,u),c=o[0],l=0;Ai(c,function(n){var t=n.children;t&&t.length?(n.x=Ri(t),n.y=Yi(t)):(n.x=a?l+=e(n,a):0,n.y=0,a=n)});var s=Ui(c),f=Ii(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return Ai(c,i?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),o}var t=ya.layout.hierarchy().sort(null).value(null),e=xi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ii(n,t)},ya.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,u=n.length;++i<u;)r=(e=n[i]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var u=e.children;if(u&&u.length){var a,o,c,l=f(e),s=[],h=u.slice(),p=1/0,m=\"slice\"===g?l.dx:\"dice\"===g?l.dy:\"slice-dice\"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(a=h[c-1]),s.area+=a.area,\"squarify\"!==g||(o=r(s,m))<=p?(h.pop(),p=o):(s.area-=s.pop().area,i(s,m,l,!1),m=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(i(s,m,l,!0),s.length=s.area=0),u.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var u,a=f(t),o=r.slice(),c=[];for(n(o,a.dx*a.dy/t.value),c.area=0;u=o.pop();)c.push(u),c.area+=u.area,null!=u.z&&(i(c,u.z?a.dx:a.dy,a,!o.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,u=1/0,a=-1,o=n.length;++a<o;)(e=n[a].area)&&(u>e&&(u=e),e>i&&(i=e));return r*=r,t*=t,r?Math.max(t*i*p/r,r/(t*u*p)):1/0}function i(n,t,e,r){var i,u=-1,a=n.length,o=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++u<a;)i=n[u],i.x=o,i.y=l,i.dy=s,o+=i.dx=Math.min(e.x+e.dx-o,s?c(i.area/s):0);i.z=!0,i.dx+=e.x+e.dx-o,e.y+=s,e.dy-=s}else{for((r||s>e.dx)&&(s=e.dx);++u<a;)i=n[u],i.x=o,i.y=l,i.dx=s,l+=i.dy=Math.min(e.y+e.dy-l,s?c(i.area/s):0);i.z=!1,i.dy+=e.y+e.dy-l,e.x+=s,e.dx-=s}}function u(r){var i=a||o(r),u=i[0];return u.x=0,u.y=0,u.dx=l[0],u.dy=l[1],a&&o.revalue(u),n([u],u.dx*u.dy/u.value),(a?e:t)(u),h&&(a=i),i}var a,o=ya.layout.hierarchy(),c=Math.round,l=[1,1],s=null,f=Vi,h=!1,g=\"squarify\",p=.5*(1+Math.sqrt(5));return u.size=function(n){return arguments.length?(l=n,u):l},u.padding=function(n){function t(t){var e=n.call(u,t,t.depth);return null==e?Vi(t):Xi(t,\"number\"==typeof e?[e,e,e,e]:e)}function e(t){return Xi(t,n)}if(!arguments.length)return s;var r;return f=null==(s=n)?Vi:\"function\"==(r=typeof n)?t:\"number\"===r?(n=[n,n,n,n],e):e,u},u.round=function(n){return arguments.length?(c=n?Math.round:Number,u):c!=Number},u.sticky=function(n){return arguments.length?(h=n,a=null,u):h},u.ratio=function(n){return arguments.length?(p=n,u):p},u.mode=function(n){return arguments.length?(g=n+\"\",u):g},ii(u,o)},ya.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=ya.random.normal.apply(ya,arguments);return function(){return Math.exp(n())}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t/n}}},ya.scale={};var kc={floor:mt,ceil:mt};ya.scale.linear=function(){return Ki([0,1],[0,1],Sr,!1)},ya.scale.log=function(){return uu(ya.scale.linear().domain([0,1]),10,!0,[1,10])};var Ac=ya.format(\".0e\"),Nc={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ya.scale.pow=function(){return au(ya.scale.linear(),1,[0,1])},ya.scale.sqrt=function(){return ya.scale.pow().exponent(.5)},ya.scale.ordinal=function(){return cu([],{t:\"range\",a:[[]]})},ya.scale.category10=function(){return ya.scale.ordinal().range(qc)},ya.scale.category20=function(){return ya.scale.ordinal().range(Tc)},ya.scale.category20b=function(){return ya.scale.ordinal().range(Cc)},ya.scale.category20c=function(){return ya.scale.ordinal().range(zc)};var qc=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ut),Tc=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ut),Cc=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ut),zc=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ut);ya.scale.quantile=function(){return lu([],[])},ya.scale.quantize=function(){return su(0,1,[0,1])},ya.scale.threshold=function(){return fu([.5],[0,1])},ya.scale.identity=function(){return hu([0,1])},ya.svg.arc=function(){function n(){var n=t.apply(this,arguments),u=e.apply(this,arguments),a=r.apply(this,arguments)+Dc,o=i.apply(this,arguments)+Dc,c=(a>o&&(c=a,a=o,o=c),o-a),l=Ka>c?\"0\":\"1\",s=Math.cos(a),f=Math.sin(a),h=Math.cos(o),g=Math.sin(o);return c>=jc?n?\"M0,\"+u+\"A\"+u+\",\"+u+\" 0 1,1 0,\"+-u+\"A\"+u+\",\"+u+\" 0 1,1 0,\"+u+\"M0,\"+n+\"A\"+n+\",\"+n+\" 0 1,0 0,\"+-n+\"A\"+n+\",\"+n+\" 0 1,0 0,\"+n+\"Z\":\"M0,\"+u+\"A\"+u+\",\"+u+\" 0 1,1 0,\"+-u+\"A\"+u+\",\"+u+\" 0 1,1 0,\"+u+\"Z\":n?\"M\"+u*s+\",\"+u*f+\"A\"+u+\",\"+u+\" 0 \"+l+\",1 \"+u*h+\",\"+u*g+\"L\"+n*h+\",\"+n*g+\"A\"+n+\",\"+n+\" 0 \"+l+\",0 \"+n*s+\",\"+n*f+\"Z\":\"M\"+u*s+\",\"+u*f+\"A\"+u+\",\"+u+\" 0 \"+l+\",1 \"+u*h+\",\"+u*g+\"L0,0\"+\"Z\"}var t=gu,e=pu,r=mu,i=du;return n.innerRadius=function(e){return arguments.length?(t=pt(e),n):t},n.outerRadius=function(t){return arguments.length?(e=pt(t),n):e},n.startAngle=function(t){return arguments.length?(r=pt(t),n):r},n.endAngle=function(t){return arguments.length?(i=pt(t),n):i},n.centroid=function(){var n=(t.apply(this,arguments)+e.apply(this,arguments))/2,u=(r.apply(this,arguments)+i.apply(this,arguments))/2+Dc;return[Math.cos(u)*n,Math.sin(u)*n]},n};var Dc=-Ka/2,jc=2*Ka-1e-6;ya.svg.line.radial=function(){var n=Ue(vu);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},$e.reverse=We,We.reverse=$e,ya.svg.area=function(){return yu(mt)},ya.svg.area.radial=function(){var n=yu(vu);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ya.svg.chord=function(){function n(n,o){var c=t(this,u,n,o),l=t(this,a,n,o);return\"M\"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?i(c.r,c.p1,c.r,c.p0):i(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+i(l.r,l.p1,c.r,c.p0))+\"Z\"}function t(n,t,e,r){var i=t.call(n,e,r),u=o.call(n,i,r),a=c.call(n,i,r)+Dc,s=l.call(n,i,r)+Dc;return{r:u,a0:a,a1:s,p0:[u*Math.cos(a),u*Math.sin(a)],p1:[u*Math.cos(s),u*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return\"A\"+n+\",\"+n+\" 0 \"+ +(e>Ka)+\",1 \"+t}function i(n,t,e,r){return\"Q 0,0 \"+r}var u=ze,a=De,o=Mu,c=mu,l=du;return n.radius=function(t){return arguments.length?(o=pt(t),n):o},n.source=function(t){return arguments.length?(u=pt(t),n):u},n.target=function(t){return arguments.length?(a=pt(t),n):a},n.startAngle=function(t){return arguments.length?(c=pt(t),n):c},n.endAngle=function(t){return arguments.length?(l=pt(t),n):l},n},ya.svg.diagonal=function(){function n(n,i){var u=t.call(this,n,i),a=e.call(this,n,i),o=(u.y+a.y)/2,c=[u,{x:u.x,y:o},{x:a.x,y:o},a];return c=c.map(r),\"M\"+c[0]+\"C\"+c[1]+\" \"+c[2]+\" \"+c[3]}var t=ze,e=De,r=xu;return n.source=function(e){return arguments.length?(t=pt(e),n):t},n.target=function(t){return arguments.length?(e=pt(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ya.svg.diagonal.radial=function(){var n=ya.svg.diagonal(),t=xu,e=n.projection;return n.projection=function(n){return arguments.length?e(bu(t=n)):t},n},ya.svg.symbol=function(){function n(n,r){return(Lc.get(t.call(this,n,r))||Su)(e.call(this,n,r))}var t=wu,e=_u;return n.type=function(e){return arguments.length?(t=pt(e),n):t},n.size=function(t){return arguments.length?(e=pt(t),n):e},n};var Lc=ya.map({circle:Su,cross:function(n){var t=Math.sqrt(n/5)/2;return\"M\"+-3*t+\",\"+-t+\"H\"+-t+\"V\"+-3*t+\"H\"+t+\"V\"+-t+\"H\"+3*t+\"V\"+t+\"H\"+t+\"V\"+3*t+\"H\"+-t+\"V\"+t+\"H\"+-3*t+\"Z\"},diamond:function(n){var t=Math.sqrt(n/(2*Oc)),e=t*Oc;return\"M0,\"+-t+\"L\"+e+\",0\"+\" 0,\"+t+\" \"+-e+\",0\"+\"Z\"},square:function(n){var t=Math.sqrt(n)/2;return\"M\"+-t+\",\"+-t+\"L\"+t+\",\"+-t+\" \"+t+\",\"+t+\" \"+-t+\",\"+t+\"Z\"},\"triangle-down\":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return\"M0,\"+e+\"L\"+t+\",\"+-e+\" \"+-t+\",\"+-e+\"Z\"},\"triangle-up\":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return\"M0,\"+-e+\"L\"+t+\",\"+e+\" \"+-t+\",\"+e+\"Z\"}});ya.svg.symbolTypes=Lc.keys();var Hc,Fc,Pc=Math.sqrt(3),Oc=Math.tan(30*to),Yc=[],Rc=0;Yc.call=Ya.call,Yc.empty=Ya.empty,Yc.node=Ya.node,Yc.size=Ya.size,ya.transition=function(n){return arguments.length?Hc?n.transition():n:Ia.transition()},ya.transition.prototype=Yc,Yc.select=function(n){var t,e,r,i=this.id,u=[];n=v(n);for(var a=-1,o=this.length;++a<o;){u.push(t=[]);for(var c=this[a],l=-1,s=c.length;++l<s;)(r=c[l])&&(e=n.call(r,r.__data__,l,a))?(\"__data__\"in r&&(e.__data__=r.__data__),Nu(e,l,i,r.__transition__[i]),t.push(e)):t.push(null)}return Eu(u,i)},Yc.selectAll=function(n){var t,e,r,i,u,a=this.id,o=[];n=y(n);for(var c=-1,l=this.length;++c<l;)for(var s=this[c],f=-1,h=s.length;++f<h;)if(r=s[f]){u=r.__transition__[a],e=n.call(r,r.__data__,f,c),o.push(t=[]);for(var g=-1,p=e.length;++g<p;)(i=e[g])&&Nu(i,g,a,u),t.push(i)}return Eu(o,a)},Yc.filter=function(n){var t,e,r,i=[];\"function\"!=typeof n&&(n=N(n));for(var u=0,a=this.length;a>u;u++){i.push(t=[]);for(var e=this[u],o=0,c=e.length;c>o;o++)(r=e[o])&&n.call(r,r.__data__,o)&&t.push(r)}return Eu(i,this.id)},Yc.tween=function(n,t){var e=this.id;return arguments.length<2?this.node().__transition__[e].tween.get(n):T(this,null==t?function(t){t.__transition__[e].tween.remove(n)}:function(r){r.__transition__[e].tween.set(n,t)})},Yc.attr=function(n,t){function e(){this.removeAttribute(o)}function r(){this.removeAttributeNS(o.space,o.local)}function i(n){return null==n?e:(n+=\"\",function(){var t,e=this.getAttribute(o);return e!==n&&(t=a(e,n),function(n){this.setAttribute(o,t(n))})})}function u(n){return null==n?r:(n+=\"\",function(){var t,e=this.getAttributeNS(o.space,o.local);return e!==n&&(t=a(e,n),function(n){this.setAttributeNS(o.space,o.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var a=\"transform\"==n?Br:Sr,o=ya.ns.qualify(n);return ku(this,\"attr.\"+n,t,o.local?u:i)},Yc.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(i));return r&&function(n){this.setAttribute(i,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(i.space,i.local));return r&&function(n){this.setAttributeNS(i.space,i.local,r(n))}}var i=ya.ns.qualify(n);return this.tween(\"attr.\"+n,i.local?r:e)},Yc.style=function(n,t,e){function r(){this.style.removeProperty(n)}function i(t){return null==t?r:(t+=\"\",function(){var r,i=ba.getComputedStyle(this,null).getPropertyValue(n);return i!==t&&(r=Sr(i,t),function(t){this.style.setProperty(n,r(t),e)})})}var u=arguments.length;if(3>u){if(\"string\"!=typeof n){2>u&&(t=\"\");for(e in n)this.style(e,n[e],t);return this}e=\"\"}return ku(this,\"style.\"+n,t,i)},Yc.styleTween=function(n,t,e){function r(r,i){var u=t.call(this,r,i,ba.getComputedStyle(this,null).getPropertyValue(n));return u&&function(t){this.style.setProperty(n,u(t),e)}}return arguments.length<3&&(e=\"\"),this.tween(\"style.\"+n,r)},Yc.text=function(n){return ku(this,\"text\",n,Au)},Yc.remove=function(){return this.each(\"end.transition\",function(){var n;!this.__transition__&&(n=this.parentNode)&&n.removeChild(this)})},Yc.ease=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:(\"function\"!=typeof n&&(n=ya.ease.apply(ya,arguments)),T(this,function(e){e.__transition__[t].ease=n}))},Yc.delay=function(n){var t=this.id;return T(this,\"function\"==typeof n?function(e,r,i){e.__transition__[t].delay=0|n.call(e,e.__data__,r,i)}:(n|=0,function(e){e.__transition__[t].delay=n}))},Yc.duration=function(n){var t=this.id;return T(this,\"function\"==typeof n?function(e,r,i){e.__transition__[t].duration=Math.max(1,0|n.call(e,e.__data__,r,i))}:(n=Math.max(1,0|n),function(e){e.__transition__[t].duration=n}))},Yc.each=function(n,t){var e=this.id;if(arguments.length<2){var r=Fc,i=Hc;Hc=e,T(this,function(t,r,i){Fc=t.__transition__[e],n.call(t,t.__data__,r,i)}),Fc=r,Hc=i}else T(this,function(r){var i=r.__transition__[e];(i.event||(i.event=ya.dispatch(\"start\",\"end\"))).on(n,t)});return this},Yc.transition=function(){for(var n,t,e,r,i=this.id,u=++Rc,a=[],o=0,c=this.length;c>o;o++){a.push(n=[]);for(var t=this[o],l=0,s=t.length;s>l;l++)(e=t[l])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,Nu(e,l,u,r)),n.push(e)}return Eu(a,u)},ya.svg.axis=function(){function n(n){n.each(function(){var n,f=ya.select(this),h=null==l?e.ticks?e.ticks.apply(e,c):e.domain():l,g=null==t?e.tickFormat?e.tickFormat.apply(e,c):String:t,p=Cu(e,h,s),m=f.selectAll(\".tick.minor\").data(p,String),d=m.enter().insert(\"line\",\".tick\").attr(\"class\",\"tick minor\").style(\"opacity\",1e-6),v=ya.transition(m.exit()).style(\"opacity\",1e-6).remove(),y=ya.transition(m).style(\"opacity\",1),M=f.selectAll(\".tick.major\").data(h,String),x=M.enter().insert(\"g\",\".domain\").attr(\"class\",\"tick major\").style(\"opacity\",1e-6),b=ya.transition(M.exit()).style(\"opacity\",1e-6).remove(),_=ya.transition(M).style(\"opacity\",1),w=Bi(e),S=f.selectAll(\".domain\").data([0]),E=(S.enter().append(\"path\").attr(\"class\",\"domain\"),ya.transition(S)),k=e.copy(),A=this.__chart__||k;\nthis.__chart__=k,x.append(\"line\"),x.append(\"text\");var N=x.select(\"line\"),q=_.select(\"line\"),T=M.select(\"text\").text(g),C=x.select(\"text\"),z=_.select(\"text\");switch(r){case\"bottom\":n=qu,d.attr(\"y2\",u),y.attr(\"x2\",0).attr(\"y2\",u),N.attr(\"y2\",i),C.attr(\"y\",Math.max(i,0)+o),q.attr(\"x2\",0).attr(\"y2\",i),z.attr(\"x\",0).attr(\"y\",Math.max(i,0)+o),T.attr(\"dy\",\".71em\").style(\"text-anchor\",\"middle\"),E.attr(\"d\",\"M\"+w[0]+\",\"+a+\"V0H\"+w[1]+\"V\"+a);break;case\"top\":n=qu,d.attr(\"y2\",-u),y.attr(\"x2\",0).attr(\"y2\",-u),N.attr(\"y2\",-i),C.attr(\"y\",-(Math.max(i,0)+o)),q.attr(\"x2\",0).attr(\"y2\",-i),z.attr(\"x\",0).attr(\"y\",-(Math.max(i,0)+o)),T.attr(\"dy\",\"0em\").style(\"text-anchor\",\"middle\"),E.attr(\"d\",\"M\"+w[0]+\",\"+-a+\"V0H\"+w[1]+\"V\"+-a);break;case\"left\":n=Tu,d.attr(\"x2\",-u),y.attr(\"x2\",-u).attr(\"y2\",0),N.attr(\"x2\",-i),C.attr(\"x\",-(Math.max(i,0)+o)),q.attr(\"x2\",-i).attr(\"y2\",0),z.attr(\"x\",-(Math.max(i,0)+o)).attr(\"y\",0),T.attr(\"dy\",\".32em\").style(\"text-anchor\",\"end\"),E.attr(\"d\",\"M\"+-a+\",\"+w[0]+\"H0V\"+w[1]+\"H\"+-a);break;case\"right\":n=Tu,d.attr(\"x2\",u),y.attr(\"x2\",u).attr(\"y2\",0),N.attr(\"x2\",i),C.attr(\"x\",Math.max(i,0)+o),q.attr(\"x2\",i).attr(\"y2\",0),z.attr(\"x\",Math.max(i,0)+o).attr(\"y\",0),T.attr(\"dy\",\".32em\").style(\"text-anchor\",\"start\"),E.attr(\"d\",\"M\"+a+\",\"+w[0]+\"H0V\"+w[1]+\"H\"+a)}if(e.rangeBand){var D=k.rangeBand()/2,j=function(n){return k(n)+D};x.call(n,j),_.call(n,j)}else x.call(n,A),_.call(n,k),b.call(n,k),d.call(n,A),y.call(n,k),v.call(n,k)})}var t,e=ya.scale.linear(),r=Uc,i=6,u=6,a=6,o=3,c=[10],l=null,s=0;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Ic?t+\"\":Uc,n):r},n.ticks=function(){return arguments.length?(c=arguments,n):c},n.tickValues=function(t){return arguments.length?(l=t,n):l},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t,e){if(!arguments.length)return i;var r=arguments.length-1;return i=+t,u=r>1?+e:i,a=r>0?+arguments[r]:i,n},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(t){return arguments.length?(s=+t,n):s},n};var Uc=\"bottom\",Ic={top:1,right:1,bottom:1,left:1};ya.svg.brush=function(){function n(u){u.each(function(){var u,a=ya.select(this),s=a.selectAll(\".background\").data([0]),f=a.selectAll(\".extent\").data([0]),h=a.selectAll(\".resize\").data(l,String);a.style(\"pointer-events\",\"all\").on(\"mousedown.brush\",i).on(\"touchstart.brush\",i),s.enter().append(\"rect\").attr(\"class\",\"background\").style(\"visibility\",\"hidden\").style(\"cursor\",\"crosshair\"),f.enter().append(\"rect\").attr(\"class\",\"extent\").style(\"cursor\",\"move\"),h.enter().append(\"g\").attr(\"class\",function(n){return\"resize \"+n}).style(\"cursor\",function(n){return Vc[n]}).append(\"rect\").attr(\"x\",function(n){return/[ew]$/.test(n)?-3:null}).attr(\"y\",function(n){return/^[ns]/.test(n)?-3:null}).attr(\"width\",6).attr(\"height\",6).style(\"visibility\",\"hidden\"),h.style(\"display\",n.empty()?\"none\":null),h.exit().remove(),o&&(u=Bi(o),s.attr(\"x\",u[0]).attr(\"width\",u[1]-u[0]),e(a)),c&&(u=Bi(c),s.attr(\"y\",u[0]).attr(\"height\",u[1]-u[0]),r(a)),t(a)})}function t(n){n.selectAll(\".resize\").attr(\"transform\",function(n){return\"translate(\"+s[+/e$/.test(n)][0]+\",\"+s[+/^s/.test(n)][1]+\")\"})}function e(n){n.select(\".extent\").attr(\"x\",s[0][0]),n.selectAll(\".extent,.n>rect,.s>rect\").attr(\"width\",s[1][0]-s[0][0])}function r(n){n.select(\".extent\").attr(\"y\",s[0][1]),n.selectAll(\".extent,.e>rect,.w>rect\").attr(\"height\",s[1][1]-s[0][1])}function i(){function i(){var n=ya.event.changedTouches;return n?ya.touches(M,n)[0]:ya.mouse(M)}function l(){32==ya.event.keyCode&&(k||(v=null,N[0]-=s[1][0],N[1]-=s[1][1],k=2),g())}function h(){32==ya.event.keyCode&&2==k&&(N[0]+=s[1][0],N[1]+=s[1][1],k=0,g())}function p(){var n=i(),u=!1;y&&(n[0]+=y[0],n[1]+=y[1]),k||(ya.event.altKey?(v||(v=[(s[0][0]+s[1][0])/2,(s[0][1]+s[1][1])/2]),N[0]=s[+(n[0]<v[0])][0],N[1]=s[+(n[1]<v[1])][1]):v=null),S&&m(n,o,0)&&(e(_),u=!0),E&&m(n,c,1)&&(r(_),u=!0),u&&(t(_),b({type:\"brush\",mode:k?\"move\":\"resize\"}))}function m(n,t,e){var r,i,a=Bi(t),o=a[0],c=a[1],l=N[e],h=s[1][e]-s[0][e];return k&&(o-=l,c-=h+l),r=f[e]?Math.max(o,Math.min(c,n[e])):n[e],k?i=(r+=l)+h:(v&&(l=Math.max(o,Math.min(c,2*v[e]-r))),r>l?(i=r,r=l):i=l),s[0][e]!==r||s[1][e]!==i?(u=null,s[0][e]=r,s[1][e]=i,!0):void 0}function d(){p(),_.style(\"pointer-events\",\"all\").selectAll(\".resize\").style(\"display\",n.empty()?\"none\":null),ya.select(\"body\").style(\"cursor\",null),q.on(\"mousemove.brush\",null).on(\"mouseup.brush\",null).on(\"touchmove.brush\",null).on(\"touchend.brush\",null).on(\"keydown.brush\",null).on(\"keyup.brush\",null),A(),b({type:\"brushend\"})}var v,y,M=this,x=ya.select(ya.event.target),b=a.of(M,arguments),_=ya.select(M),w=x.datum(),S=!/^(n|s)$/.test(w)&&o,E=!/^(e|w)$/.test(w)&&c,k=x.classed(\"extent\"),A=H(),N=i(),q=ya.select(ba).on(\"keydown.brush\",l).on(\"keyup.brush\",h);if(ya.event.changedTouches?q.on(\"touchmove.brush\",p).on(\"touchend.brush\",d):q.on(\"mousemove.brush\",p).on(\"mouseup.brush\",d),k)N[0]=s[0][0]-N[0],N[1]=s[0][1]-N[1];else if(w){var T=+/w$/.test(w),C=+/^n/.test(w);y=[s[1-T][0]-N[0],s[1-C][1]-N[1]],N[0]=s[T][0],N[1]=s[C][1]}else ya.event.altKey&&(v=N.slice());_.style(\"pointer-events\",\"none\").selectAll(\".resize\").style(\"display\",null),ya.select(\"body\").style(\"cursor\",x.style(\"cursor\")),b({type:\"brushstart\"}),p()}var u,a=m(n,\"brushstart\",\"brush\",\"brushend\"),o=null,c=null,l=Xc[0],s=[[0,0],[0,0]],f=[!0,!0];return n.x=function(t){return arguments.length?(o=t,l=Xc[!o<<1|!c],n):o},n.y=function(t){return arguments.length?(c=t,l=Xc[!o<<1|!c],n):c},n.clamp=function(t){return arguments.length?(o&&c?f=[!!t[0],!!t[1]]:(o||c)&&(f[+!o]=!!t),n):o&&c?f:o||c?f[+!o]:null},n.extent=function(t){var e,r,i,a,l;return arguments.length?(u=[[0,0],[0,0]],o&&(e=t[0],r=t[1],c&&(e=e[0],r=r[0]),u[0][0]=e,u[1][0]=r,o.invert&&(e=o(e),r=o(r)),e>r&&(l=e,e=r,r=l),s[0][0]=0|e,s[1][0]=0|r),c&&(i=t[0],a=t[1],o&&(i=i[1],a=a[1]),u[0][1]=i,u[1][1]=a,c.invert&&(i=c(i),a=c(a)),i>a&&(l=i,i=a,a=l),s[0][1]=0|i,s[1][1]=0|a),n):(t=u||s,o&&(e=t[0][0],r=t[1][0],u||(e=s[0][0],r=s[1][0],o.invert&&(e=o.invert(e),r=o.invert(r)),e>r&&(l=e,e=r,r=l))),c&&(i=t[0][1],a=t[1][1],u||(i=s[0][1],a=s[1][1],c.invert&&(i=c.invert(i),a=c.invert(a)),i>a&&(l=i,i=a,a=l))),o&&c?[[e,i],[r,a]]:o?[e,r]:c&&[i,a])},n.clear=function(){return u=null,s[0][0]=s[0][1]=s[1][0]=s[1][1]=0,n},n.empty=function(){return o&&s[0][0]===s[1][0]||c&&s[0][1]===s[1][1]},ya.rebind(n,a,\"on\")};var Vc={n:\"ns-resize\",e:\"ew-resize\",s:\"ns-resize\",w:\"ew-resize\",nw:\"nwse-resize\",ne:\"nesw-resize\",se:\"nwse-resize\",sw:\"nesw-resize\"},Xc=[[\"n\",\"e\",\"s\",\"w\",\"nw\",\"ne\",\"se\",\"sw\"],[\"e\",\"w\"],[\"n\",\"s\"],[]];ya.time={};var Zc=Date,Bc=[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"];zu.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){$c.setUTCDate.apply(this._,arguments)},setDay:function(){$c.setUTCDay.apply(this._,arguments)},setFullYear:function(){$c.setUTCFullYear.apply(this._,arguments)},setHours:function(){$c.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){$c.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){$c.setUTCMinutes.apply(this._,arguments)},setMonth:function(){$c.setUTCMonth.apply(this._,arguments)},setSeconds:function(){$c.setUTCSeconds.apply(this._,arguments)},setTime:function(){$c.setTime.apply(this._,arguments)}};var $c=Date.prototype,Wc=\"%a %b %e %X %Y\",Jc=\"%m/%d/%Y\",Gc=\"%H:%M:%S\",Kc=[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],Qc=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],nl=[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],tl=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];ya.time.year=Du(function(n){return n=ya.time.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ya.time.years=ya.time.year.range,ya.time.years.utc=ya.time.year.utc.range,ya.time.day=Du(function(n){var t=new Zc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ya.time.days=ya.time.day.range,ya.time.days.utc=ya.time.day.utc.range,ya.time.dayOfYear=function(n){var t=ya.time.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},Bc.forEach(function(n,t){n=n.toLowerCase(),t=7-t;var e=ya.time[n]=Du(function(n){return(n=ya.time.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ya.time.year(n).getDay();return Math.floor((ya.time.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ya.time[n+\"s\"]=e.range,ya.time[n+\"s\"].utc=e.utc.range,ya.time[n+\"OfYear\"]=function(n){var e=ya.time.year(n).getDay();return Math.floor((ya.time.dayOfYear(n)+(e+t)%7)/7)}}),ya.time.week=ya.time.sunday,ya.time.weeks=ya.time.sunday.range,ya.time.weeks.utc=ya.time.sunday.utc.range,ya.time.weekOfYear=ya.time.sundayOfYear,ya.time.format=function(n){function t(t){for(var r,i,u,a=[],o=-1,c=0;++o<e;)37===n.charCodeAt(o)&&(a.push(n.substring(c,o)),null!=(i=fl[r=n.charAt(++o)])&&(r=n.charAt(++o)),(u=hl[r])&&(r=u(t,null==i?\"e\"===r?\" \":\"0\":i)),a.push(r),c=o+1);return a.push(n.substring(c,o)),a.join(\"\")}var e=n.length;return t.parse=function(t){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=Lu(e,n,t,0);if(r!=t.length)return null;\"p\"in e&&(e.H=e.H%12+12*e.p);var i=new Zc;return\"j\"in e?i.setFullYear(e.y,0,e.j):\"w\"in e&&(\"W\"in e||\"U\"in e)?(i.setFullYear(e.y,0,1),i.setFullYear(e.y,0,\"W\"in e?(e.w+6)%7+7*e.W-(i.getDay()+5)%7:e.w+7*e.U-(i.getDay()+6)%7)):i.setFullYear(e.y,e.m,e.d),i.setHours(e.H,e.M,e.S,e.L),i},t.toString=function(){return n},t};var el=Hu(Kc),rl=Fu(Kc),il=Hu(Qc),ul=Fu(Qc),al=Hu(nl),ol=Fu(nl),cl=Hu(tl),ll=Fu(tl),sl=/^%/,fl={\"-\":\"\",_:\" \",0:\"0\"},hl={a:function(n){return Qc[n.getDay()]},A:function(n){return Kc[n.getDay()]},b:function(n){return tl[n.getMonth()]},B:function(n){return nl[n.getMonth()]},c:ya.time.format(Wc),d:function(n,t){return Pu(n.getDate(),t,2)},e:function(n,t){return Pu(n.getDate(),t,2)},H:function(n,t){return Pu(n.getHours(),t,2)},I:function(n,t){return Pu(n.getHours()%12||12,t,2)},j:function(n,t){return Pu(1+ya.time.dayOfYear(n),t,3)},L:function(n,t){return Pu(n.getMilliseconds(),t,3)},m:function(n,t){return Pu(n.getMonth()+1,t,2)},M:function(n,t){return Pu(n.getMinutes(),t,2)},p:function(n){return n.getHours()>=12?\"PM\":\"AM\"},S:function(n,t){return Pu(n.getSeconds(),t,2)},U:function(n,t){return Pu(ya.time.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Pu(ya.time.mondayOfYear(n),t,2)},x:ya.time.format(Jc),X:ya.time.format(Gc),y:function(n,t){return Pu(n.getFullYear()%100,t,2)},Y:function(n,t){return Pu(n.getFullYear()%1e4,t,4)},Z:aa,\"%\":function(){return\"%\"}},gl={a:Ou,A:Yu,b:Vu,B:Xu,c:Zu,d:Qu,e:Qu,H:ta,I:ta,j:na,L:ia,m:Ku,M:ea,p:ua,S:ra,U:Uu,w:Ru,W:Iu,x:Bu,X:$u,y:Ju,Y:Wu,\"%\":oa},pl=/^\\s*\\d+/,ml=ya.map({am:0,pm:1});ya.time.format.utc=function(n){function t(n){try{Zc=zu;var t=new Zc;return t._=n,e(t)}finally{Zc=Date}}var e=ya.time.format(n);return t.parse=function(n){try{Zc=zu;var t=e.parse(n);return t&&t._}finally{Zc=Date}},t.toString=e.toString,t};var dl=ya.time.format.utc(\"%Y-%m-%dT%H:%M:%S.%LZ\");ya.time.format.iso=Date.prototype.toISOString&&+new Date(\"2000-01-01T00:00:00.000Z\")?ca:dl,ca.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},ca.toString=dl.toString,ya.time.second=Du(function(n){return new Zc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),ya.time.seconds=ya.time.second.range,ya.time.seconds.utc=ya.time.second.utc.range,ya.time.minute=Du(function(n){return new Zc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),ya.time.minutes=ya.time.minute.range,ya.time.minutes.utc=ya.time.minute.utc.range,ya.time.hour=Du(function(n){var t=n.getTimezoneOffset()/60;return new Zc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),ya.time.hours=ya.time.hour.range,ya.time.hours.utc=ya.time.hour.utc.range,ya.time.month=Du(function(n){return n=ya.time.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),ya.time.months=ya.time.month.range,ya.time.months.utc=ya.time.month.utc.range;var vl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],yl=[[ya.time.second,1],[ya.time.second,5],[ya.time.second,15],[ya.time.second,30],[ya.time.minute,1],[ya.time.minute,5],[ya.time.minute,15],[ya.time.minute,30],[ya.time.hour,1],[ya.time.hour,3],[ya.time.hour,6],[ya.time.hour,12],[ya.time.day,1],[ya.time.day,2],[ya.time.week,1],[ya.time.month,1],[ya.time.month,3],[ya.time.year,1]],Ml=[[ya.time.format(\"%Y\"),Xt],[ya.time.format(\"%B\"),function(n){return n.getMonth()}],[ya.time.format(\"%b %d\"),function(n){return 1!=n.getDate()}],[ya.time.format(\"%a %d\"),function(n){return n.getDay()&&1!=n.getDate()}],[ya.time.format(\"%I %p\"),function(n){return n.getHours()}],[ya.time.format(\"%I:%M\"),function(n){return n.getMinutes()}],[ya.time.format(\":%S\"),function(n){return n.getSeconds()}],[ya.time.format(\".%L\"),function(n){return n.getMilliseconds()}]],xl=ya.scale.linear(),bl=fa(Ml);yl.year=function(n,t){return xl.domain(n.map(ga)).ticks(t).map(ha)},ya.time.scale=function(){return la(ya.scale.linear(),yl,bl)};var _l=yl.map(function(n){return[n[0].utc,n[1]]}),wl=[[ya.time.format.utc(\"%Y\"),Xt],[ya.time.format.utc(\"%B\"),function(n){return n.getUTCMonth()}],[ya.time.format.utc(\"%b %d\"),function(n){return 1!=n.getUTCDate()}],[ya.time.format.utc(\"%a %d\"),function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],[ya.time.format.utc(\"%I %p\"),function(n){return n.getUTCHours()}],[ya.time.format.utc(\"%I:%M\"),function(n){return n.getUTCMinutes()}],[ya.time.format.utc(\":%S\"),function(n){return n.getUTCSeconds()}],[ya.time.format.utc(\".%L\"),function(n){return n.getUTCMilliseconds()}]],Sl=fa(wl);return _l.year=function(n,t){return xl.domain(n.map(ma)).ticks(t).map(pa)},ya.time.scale.utc=function(){return la(ya.scale.linear(),_l,Sl)},ya.text=dt(function(n){return n.responseText}),ya.json=function(n,t){return vt(n,\"application/json\",da,t)},ya.html=function(n,t){return vt(n,\"text/html\",va,t)},ya.xml=dt(function(n){return n.responseXML}),ya}();"
  },
  {
    "path": "templates/project/assets/javascripts/dashing.gridster.coffee",
    "content": "#= require_directory ./gridster\n\n# This file enables gridster integration (http://gridster.net/)\n# Delete it if you'd rather handle the layout yourself.\n# You'll miss out on a lot if you do, but we won't hold it against you.\n\nDashing.gridsterLayout = (positions) ->\n  Dashing.customGridsterLayout = true\n  positions = positions.replace(/^\"|\"$/g, '')\n  positions = $.parseJSON(positions)\n  widgets = $(\"[data-row^=]\")\n  for widget, index in widgets\n    $(widget).attr('data-row', positions[index].row)\n    $(widget).attr('data-col', positions[index].col)\n\nDashing.getWidgetPositions = ->\n  $(\".gridster ul:first\").gridster().data('gridster').serialize()\n\nDashing.showGridsterInstructions = ->\n  newWidgetPositions = Dashing.getWidgetPositions()\n\n  unless JSON.stringify(newWidgetPositions) == JSON.stringify(Dashing.currentWidgetPositions)\n    Dashing.currentWidgetPositions = newWidgetPositions\n    $('#save-gridster').slideDown()\n    $('#gridster-code').text(\"\n      <script type='text/javascript'>\\n\n      $(function() {\\n\n      \\ \\ Dashing.gridsterLayout('#{JSON.stringify(Dashing.currentWidgetPositions)}')\\n\n      });\\n</script>\")\n\n$ ->\n  $('#save-gridster').leanModal()\n\n  $('#save-gridster').click ->\n    $('#save-gridster').slideUp()\n"
  },
  {
    "path": "templates/project/assets/javascripts/jquery.knob.js",
    "content": "/*!jQuery Knob*/\n/**\n * Downward compatible, touchable dial\n *\n * Version: 1.2.0 (15/07/2012)\n * Requires: jQuery v1.7+\n *\n * Copyright (c) 2012 Anthony Terrien\n * Under MIT and GPL licenses:\n *  http://www.opensource.org/licenses/mit-license.php\n *  http://www.gnu.org/licenses/gpl.html\n *\n * Thanks to vor, eskimoblood, spiffistan, FabrizioC\n */\n$(function () {\n\n    /**\n     * Kontrol library\n     */\n    \"use strict\";\n\n    /**\n     * Definition of globals and core\n     */\n    var k = {}, // kontrol\n        max = Math.max,\n        min = Math.min;\n\n    k.c = {};\n    k.c.d = $(document);\n    k.c.t = function (e) {\n        return e.originalEvent.touches.length - 1;\n    };\n\n    /**\n     * Kontrol Object\n     *\n     * Definition of an abstract UI control\n     *\n     * Each concrete component must call this one.\n     * <code>\n     * k.o.call(this);\n     * </code>\n     */\n    k.o = function () {\n        var s = this;\n\n        this.o = null; // array of options\n        this.$ = null; // jQuery wrapped element\n        this.i = null; // mixed HTMLInputElement or array of HTMLInputElement\n        this.g = null; // 2D graphics context for 'pre-rendering'\n        this.v = null; // value ; mixed array or integer\n        this.cv = null; // change value ; not commited value\n        this.x = 0; // canvas x position\n        this.y = 0; // canvas y position\n        this.$c = null; // jQuery canvas element\n        this.c = null; // rendered canvas context\n        this.t = 0; // touches index\n        this.isInit = false;\n        this.fgColor = null; // main color\n        this.pColor = null; // previous color\n        this.dH = null; // draw hook\n        this.cH = null; // change hook\n        this.eH = null; // cancel hook\n        this.rH = null; // release hook\n\n        this.run = function () {\n            var cf = function (e, conf) {\n                var k;\n                for (k in conf) {\n                    s.o[k] = conf[k];\n                }\n                s.init();\n                s._configure()\n                 ._draw();\n            };\n\n            if(this.$.data('kontroled')) return;\n            this.$.data('kontroled', true);\n\n            this.extend();\n            this.o = $.extend(\n                {\n                    // Config\n                    min : this.$.data('min') || 0,\n                    max : this.$.data('max') || 100,\n                    stopper : true,\n                    readOnly : this.$.data('readonly'),\n\n                    // UI\n                    cursor : (this.$.data('cursor') === true && 30)\n                                || this.$.data('cursor')\n                                || 0,\n                    thickness : this.$.data('thickness') || 0.35,\n                    width : this.$.data('width') || 200,\n                    height : this.$.data('height') || 200,\n                    displayInput : this.$.data('displayinput') == null || this.$.data('displayinput'),\n                    displayPrevious : this.$.data('displayprevious'),\n                    fgColor : this.$.data('fgcolor') || '#87CEEB',\n                    inline : false,\n\n                    // Hooks\n                    draw : null, // function () {}\n                    change : null, // function (value) {}\n                    cancel : null, // function () {}\n                    release : null // function (value) {}\n                }, this.o\n            );\n\n            // routing value\n            if(this.$.is('fieldset')) {\n\n                // fieldset = array of integer\n                this.v = {};\n                this.i = this.$.find('input')\n                this.i.each(function(k) {\n                    var $this = $(this);\n                    s.i[k] = $this;\n                    s.v[k] = $this.val();\n\n                    $this.bind(\n                        'change'\n                        , function () {\n                            var val = {};\n                            val[k] = $this.val();\n                            s.val(val);\n                        }\n                    );\n                });\n                this.$.find('legend').remove();\n\n            } else {\n                // input = integer\n                this.i = this.$;\n                this.v = this.$.val();\n                (this.v == '') && (this.v = this.o.min);\n\n                this.$.bind(\n                    'change'\n                    , function () {\n                        s.val(s.$.val());\n                    }\n                );\n            }\n\n            (!this.o.displayInput) && this.$.hide();\n\n            this.$c = $('<canvas width=\"' +\n                            this.o.width + 'px\" height=\"' +\n                            this.o.height + 'px\"></canvas>');\n            this.c = this.$c[0].getContext(\"2d\");\n\n            this.$\n                .wrap($('<div style=\"' + (this.o.inline ? 'display:inline;' : '') +\n                        'width:' + this.o.width + 'px;height:' +\n                        this.o.height + 'px;\"></div>'))\n                .before(this.$c);\n\n            if (this.v instanceof Object) {\n                this.cv = {};\n                this.copy(this.v, this.cv);\n            } else {\n                this.cv = this.v;\n            }\n\n            this.$\n                .bind(\"configure\", cf)\n                .parent()\n                .bind(\"configure\", cf);\n\n            this._listen()\n                ._configure()\n                ._xy()\n                .init();\n\n            this.isInit = true;\n\n            this._draw();\n\n            return this;\n        };\n\n        this._draw = function () {\n\n            // canvas pre-rendering\n            var d = true,\n                c = document.createElement('canvas');\n\n            c.width = s.o.width;\n            c.height = s.o.height;\n            s.g = c.getContext('2d');\n\n            s.clear();\n\n            s.dH\n            && (d = s.dH());\n\n            (d !== false) && s.draw();\n\n            s.c.drawImage(c, 0, 0);\n            c = null;\n        };\n\n        this._touch = function (e) {\n\n            var touchMove = function (e) {\n\n                var v = s.xy2val(\n                            e.originalEvent.touches[s.t].pageX,\n                            e.originalEvent.touches[s.t].pageY\n                            );\n\n                if (v == s.cv) return;\n\n                if (\n                    s.cH\n                    && (s.cH(v) === false)\n                ) return;\n\n\n                s.change(v);\n                s._draw();\n            };\n\n            // get touches index\n            this.t = k.c.t(e);\n\n            // First touch\n            touchMove(e);\n\n            // Touch events listeners\n            k.c.d\n                .bind(\"touchmove.k\", touchMove)\n                .bind(\n                    \"touchend.k\"\n                    , function () {\n                        k.c.d.unbind('touchmove.k touchend.k');\n\n                        if (\n                            s.rH\n                            && (s.rH(s.cv) === false)\n                        ) return;\n\n                        s.val(s.cv);\n                    }\n                );\n\n            return this;\n        };\n\n        this._mouse = function (e) {\n\n            var mouseMove = function (e) {\n                var v = s.xy2val(e.pageX, e.pageY);\n                if (v == s.cv) return;\n\n                if (\n                    s.cH\n                    && (s.cH(v) === false)\n                ) return;\n\n                s.change(v);\n                s._draw();\n            };\n\n            // First click\n            mouseMove(e);\n\n            // Mouse events listeners\n            k.c.d\n                .bind(\"mousemove.k\", mouseMove)\n                .bind(\n                    // Escape key cancel current change\n                    \"keyup.k\"\n                    , function (e) {\n                        if (e.keyCode === 27) {\n                            k.c.d.unbind(\"mouseup.k mousemove.k keyup.k\");\n\n                            if (\n                                s.eH\n                                && (s.eH() === false)\n                            ) return;\n\n                            s.cancel();\n                        }\n                    }\n                )\n                .bind(\n                    \"mouseup.k\"\n                    , function (e) {\n                        k.c.d.unbind('mousemove.k mouseup.k keyup.k');\n\n                        if (\n                            s.rH\n                            && (s.rH(s.cv) === false)\n                        ) return;\n\n                        s.val(s.cv);\n                    }\n                );\n\n            return this;\n        };\n\n        this._xy = function () {\n            var o = this.$c.offset();\n            this.x = o.left;\n            this.y = o.top;\n            return this;\n        };\n\n        this._listen = function () {\n\n            if (!this.o.readOnly) {\n                this.$c\n                    .bind(\n                        \"mousedown\"\n                        , function (e) {\n                            e.preventDefault();\n                            s._xy()._mouse(e);\n                         }\n                    )\n                    .bind(\n                        \"touchstart\"\n                        , function (e) {\n                            e.preventDefault();\n                            s._xy()._touch(e);\n                         }\n                    );\n                this.listen();\n            } else {\n                this.$.attr('readonly', 'readonly');\n            }\n\n            return this;\n        };\n\n        this._configure = function () {\n\n            // Hooks\n            if (this.o.draw) this.dH = this.o.draw;\n            if (this.o.change) this.cH = this.o.change;\n            if (this.o.cancel) this.eH = this.o.cancel;\n            if (this.o.release) this.rH = this.o.release;\n\n            if (this.o.displayPrevious) {\n                this.pColor = this.h2rgba(this.o.fgColor, \"0.4\");\n                this.fgColor = this.h2rgba(this.o.fgColor, \"0.6\");\n            } else {\n                this.fgColor = this.o.fgColor;\n            }\n\n            return this;\n        };\n\n        this._clear = function () {\n            this.$c[0].width = this.$c[0].width;\n        };\n\n        // Abstract methods\n        this.listen = function () {}; // on start, one time\n        this.extend = function () {}; // each time configure triggered\n        this.init = function () {}; // each time configure triggered\n        this.change = function (v) {}; // on change\n        this.val = function (v) {}; // on release\n        this.xy2val = function (x, y) {}; //\n        this.draw = function () {}; // on change / on release\n        this.clear = function () { this._clear(); };\n\n        // Utils\n        this.h2rgba = function (h, a) {\n            var rgb;\n            h = h.substring(1,7)\n            rgb = [parseInt(h.substring(0,2),16)\n                   ,parseInt(h.substring(2,4),16)\n                   ,parseInt(h.substring(4,6),16)];\n            return \"rgba(\" + rgb[0] + \",\" + rgb[1] + \",\" + rgb[2] + \",\" + a + \")\";\n        };\n\n        this.copy = function (f, t) {\n            for (var i in f) { t[i] = f[i]; }\n        };\n    };\n\n\n    /**\n     * k.Dial\n     */\n    k.Dial = function () {\n        k.o.call(this);\n\n        this.startAngle = null;\n        this.xy = null;\n        this.radius = null;\n        this.lineWidth = null;\n        this.cursorExt = null;\n        this.w2 = null;\n        this.PI2 = 2*Math.PI;\n\n        this.extend = function () {\n            this.o = $.extend(\n                {\n                    bgColor : this.$.data('bgcolor') || '#EEEEEE',\n                    angleOffset : this.$.data('angleoffset') || 0,\n                    angleArc : this.$.data('anglearc') || 360,\n                    inline : true\n                }, this.o\n            );\n        };\n\n        this.val = function (v) {\n            if (null != v) {\n                this.cv = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;\n                this.v = this.cv;\n                this.$.val(this.v);\n                this._draw();\n            } else {\n                return this.v;\n            }\n        };\n\n        this.xy2val = function (x, y) {\n            var a, ret;\n\n            a = Math.atan2(\n                        x - (this.x + this.w2)\n                        , - (y - this.y - this.w2)\n                    ) - this.angleOffset;\n\n            if(this.angleArc != this.PI2 && (a < 0) && (a > -0.5)) {\n                // if isset angleArc option, set to min if .5 under min\n                a = 0;\n            } else if (a < 0) {\n                a += this.PI2;\n            }\n\n            ret = ~~ (0.5 + (a * (this.o.max - this.o.min) / this.angleArc))\n                    + this.o.min;\n\n            this.o.stopper\n            && (ret = max(min(ret, this.o.max), this.o.min));\n\n            return ret;\n        };\n\n        this.listen = function () {\n            // bind MouseWheel\n            var s = this,\n                mw = function (e) {\n                            e.preventDefault();\n\n                            var ori = e.originalEvent\n                                ,deltaX = ori.detail || ori.wheelDeltaX\n                                ,deltaY = ori.detail || ori.wheelDeltaY\n                                ,v = parseInt(s.$.val()) + (deltaX>0 || deltaY>0 ? 1 : deltaX<0 || deltaY<0 ? -1 : 0);\n\n                            if (\n                                s.cH\n                                && (s.cH(v) === false)\n                            ) return;\n\n                            s.val(v);\n                        }\n                , kval, to, m = 1, kv = {37:-1, 38:1, 39:1, 40:-1};\n\n            this.$\n                .bind(\n                    \"keydown\"\n                    ,function (e) {\n                        var kc = e.keyCode;\n                        kval = parseInt(String.fromCharCode(kc));\n\n                        if (isNaN(kval)) {\n\n                            (kc !== 13)         // enter\n                            && (kc !== 8)       // bs\n                            && (kc !== 9)       // tab\n                            && (kc !== 189)     // -\n                            && e.preventDefault();\n\n                            // arrows\n                            if ($.inArray(kc,[37,38,39,40]) > -1) {\n                                e.preventDefault();\n\n                                var v = parseInt(s.$.val()) + kv[kc] * m;\n\n                                s.o.stopper\n                                && (v = max(min(v, s.o.max), s.o.min));\n\n                                s.change(v);\n                                s._draw();\n\n                                // long time keydown speed-up\n                                to = window.setTimeout(\n                                    function () { m*=2; }\n                                    ,30\n                                );\n                            }\n                        }\n                    }\n                )\n                .bind(\n                    \"keyup\"\n                    ,function (e) {\n                        if (isNaN(kval)) {\n                            if (to) {\n                                window.clearTimeout(to);\n                                to = null;\n                                m = 1;\n                                s.val(s.$.val());\n                            }\n                        } else {\n                            // kval postcond\n                            (s.$.val() > s.o.max && s.$.val(s.o.max))\n                            || (s.$.val() < s.o.min && s.$.val(s.o.min));\n                        }\n\n                    }\n                );\n\n            this.$c.bind(\"mousewheel DOMMouseScroll\", mw);\n            this.$.bind(\"mousewheel DOMMouseScroll\", mw)\n        };\n\n        this.init = function () {\n\n            if (\n                this.v < this.o.min\n                || this.v > this.o.max\n            ) this.v = this.o.min;\n\n            this.$.val(this.v);\n            this.w2 = this.o.width / 2;\n            this.cursorExt = this.o.cursor / 100;\n            this.xy = this.w2;\n            this.lineWidth = this.xy * this.o.thickness;\n            this.radius = this.xy - this.lineWidth / 2;\n\n            this.o.angleOffset\n            && (this.o.angleOffset = isNaN(this.o.angleOffset) ? 0 : this.o.angleOffset);\n\n            this.o.angleArc\n            && (this.o.angleArc = isNaN(this.o.angleArc) ? this.PI2 : this.o.angleArc);\n\n            // deg to rad\n            this.angleOffset = this.o.angleOffset * Math.PI / 180;\n            this.angleArc = this.o.angleArc * Math.PI / 180;\n\n            // compute start and end angles\n            this.startAngle = 1.5 * Math.PI + this.angleOffset;\n            this.endAngle = 1.5 * Math.PI + this.angleOffset + this.angleArc;\n\n            var s = max(\n                            String(Math.abs(this.o.max)).length\n                            , String(Math.abs(this.o.min)).length\n                            , 2\n                            ) + 2;\n\n            this.o.displayInput\n                && this.i.css({\n                        'width' : ((this.o.width / 2 + 4) >> 0) + 'px'\n                        ,'height' : ((this.o.width / 3) >> 0) + 'px'\n                        ,'position' : 'absolute'\n                        ,'vertical-align' : 'middle'\n                        ,'margin-top' : ((this.o.width / 3) >> 0) + 'px'\n                        ,'margin-left' : '-' + ((this.o.width * 3 / 4 + 2) >> 0) + 'px'\n                        ,'border' : 0\n                        ,'background' : 'none'\n                        ,'font' : 'bold ' + ((this.o.width / s) >> 0) + 'px Arial'\n                        ,'text-align' : 'center'\n                        ,'color' : this.o.fgColor\n                        ,'padding' : '0px'\n                        ,'-webkit-appearance': 'none'\n                        })\n                || this.i.css({\n                        'width' : '0px'\n                        ,'visibility' : 'hidden'\n                        });\n        };\n\n        this.change = function (v) {\n            this.cv = v;\n            this.$.val(v);\n        };\n\n        this.angle = function (v) {\n            return (v - this.o.min) * this.angleArc / (this.o.max - this.o.min);\n        };\n\n        this.draw = function () {\n\n            var c = this.g,                 // context\n                a = this.angle(this.cv)    // Angle\n                , sat = this.startAngle     // Start angle\n                , eat = sat + a             // End angle\n                , sa, ea                    // Previous angles\n                , r = 1;\n\n            c.lineWidth = this.lineWidth;\n\n            this.o.cursor\n                && (sat = eat - this.cursorExt)\n                && (eat = eat + this.cursorExt);\n\n            c.beginPath();\n                c.strokeStyle = this.o.bgColor;\n                c.arc(this.xy, this.xy, this.radius, this.endAngle, this.startAngle, true);\n            c.stroke();\n\n            if (this.o.displayPrevious) {\n                ea = this.startAngle + this.angle(this.v);\n                sa = this.startAngle;\n                this.o.cursor\n                    && (sa = ea - this.cursorExt)\n                    && (ea = ea + this.cursorExt);\n\n                c.beginPath();\n                    c.strokeStyle = this.pColor;\n                    c.arc(this.xy, this.xy, this.radius, sa, ea, false);\n                c.stroke();\n                r = (this.cv == this.v);\n            }\n\n            c.beginPath();\n                c.strokeStyle = r ? this.o.fgColor : this.fgColor ;\n                c.arc(this.xy, this.xy, this.radius, sat, eat, false);\n            c.stroke();\n        };\n\n        this.cancel = function () {\n            this.val(this.v);\n        };\n    };\n\n    $.fn.dial = $.fn.knob = function (o) {\n        return this.each(\n            function () {\n                var d = new k.Dial();\n                d.o = o;\n                d.$ = $(this);\n                d.run();\n            }\n        ).parent();\n    };\n\n});"
  },
  {
    "path": "templates/project/assets/stylesheets/application.scss",
    "content": "/*\n  //=require_directory .\n  //=require_tree ../../widgets\n*/\n// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color: #222;\n$text-color: #fff;\n\n$background-warning-color-1: #e82711;\n$background-warning-color-2: #9b2d23;\n$text-warning-color: #fff;\n\n$background-danger-color-1: #eeae32;\n$background-danger-color-2: #ff9618;\n$text-danger-color: #fff;\n\n@-webkit-keyframes status-warning-background {\n  0%   { background-color: $background-warning-color-1; }\n  50%  { background-color: $background-warning-color-2; }\n  100% { background-color: $background-warning-color-1; }\n}\n@-webkit-keyframes status-danger-background {\n  0%   { background-color: $background-danger-color-1; }\n  50%  { background-color: $background-danger-color-2; }\n  100% { background-color: $background-danger-color-1; }\n}\n@mixin animation($animation-name, $duration, $function, $animation-iteration-count:\"\"){\n  -webkit-animation:  $animation-name $duration $function #{$animation-iteration-count};\n  -moz-animation:     $animation-name $duration $function #{$animation-iteration-count};\n  -ms-animation:      $animation-name $duration $function #{$animation-iteration-count};\n}\n\n// ----------------------------------------------------------------------------\n// Base styles\n// ----------------------------------------------------------------------------\nhtml {\n  font-size: 100%;\n  -webkit-text-size-adjust: 100%;\n  -ms-text-size-adjust: 100%;\n}\n\nbody {\n  margin: 0;\n  background-color: $background-color;\n  font-size: 20px;\n  color: $text-color;\n  font-family: 'Open Sans', \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n}\n\nb, strong {\n  font-weight: bold;\n}\n\na {\n  text-decoration: none;\n  color: inherit;\n}\n\nimg {\n  border: 0;\n  -ms-interpolation-mode: bicubic;\n  vertical-align: middle;\n}\n\nimg, object {\n  max-width: 100%;\n}\n\niframe {\n  max-width: 100%;\n}\n\ntable {\n  border-collapse: collapse;\n  border-spacing: 0;\n  width: 100%;\n}\n\ntd {\n  vertical-align: middle;\n}\n\nul, ol {\n  padding: 0;\n  margin: 0;\n}\n\nh1, h2, h3, h4, h5, p {\n  padding: 0;\n  margin: 0;\n}\nh1 {\n  margin-bottom: 12px;\n  text-align: center;\n  font-size: 30px;\n  font-weight: 400;\n}\nh2 {\n  text-transform: uppercase;\n  font-size: 76px;\n  font-weight: 700;\n  color: $text-color;\n}\nh3 {\n  font-size: 25px;\n  font-weight: 600;\n  color: $text-color;\n}\n\n// ----------------------------------------------------------------------------\n// Base widget styles\n// ----------------------------------------------------------------------------\n.gridster {\n  margin: 0px auto;\n}\n\n.icon-background {\n  pointer-events: none;\n  width: 100%!important;\n  height: 100%;\n  position: absolute;\n  left: 0;\n  top: 0;\n  opacity: 0.1;\n  font-size: 275px;\n  text-align: center;\n  margin-top: 82px;\n}\n\n.list-nostyle {\n  list-style: none;\n}\n\n.gridster ul {\n  list-style: none;\n}\n\n.gs_w {\n  width: 100%;\n  display: table;\n  cursor: pointer;\n}\n\n.widget {\n  text-align: center;\n  width: inherit;\n  height: inherit;\n  display: table-cell;\n  vertical-align: middle;\n}\n\n.widget.status-warning {\n  background-color: $background-warning-color-1;\n  @include animation(status-warning-background, 2s, ease, infinite);\n\n  .icon-warning-sign {\n    display: inline-block;\n  }\n\n  .title, .more-info {\n    color: $text-warning-color;\n  }\n}\n\n.widget.status-danger {\n  color: $text-danger-color;\n  background-color: $background-danger-color-1;\n  @include animation(status-danger-background, 2s, ease, infinite);\n\n  .icon-warning-sign {\n    display: inline-block;\n  }\n\n  .title, .more-info {\n    color: $text-danger-color;\n  }\n}\n\n.more-info {\n  font-size: 15px;\n  position: absolute;\n  bottom: 32px;\n  left: 0;\n  right: 0;\n}\n\n.updated-at {\n  font-size: 15px;\n  position: absolute;\n  bottom: 12px;\n  left: 0;\n  right: 0;\n}\n\n#save-gridster {\n  display: none;\n  position: fixed;\n  top: 0;\n  margin: 0px auto;\n  left: 50%;\n  z-index: 1000;\n  background: black;\n  width: 190px;\n  text-align: center;\n  border: 1px solid white;\n  border-top: 0px;\n  margin-left: -95px;\n  padding: 15px;\n}\n\n#save-gridster:hover {\n  padding-top: 25px;\n}\n\n#saving-instructions {\n  display: none;\n  padding: 10px;\n  width: 500px;\n  height: 122px;\n  z-index: 1000;\n  background: white;\n  top: 100px;\n  color: black;\n  font-size: 15px;\n  padding-bottom: 4px;\n\n  textarea {\n    white-space: nowrap;\n    width: 494px;\n    height: 80px;\n  }\n}\n\n#lean_overlay {\n    position: fixed;\n    z-index:100;\n    top: 0px;\n    left: 0px;\n    height:100%;\n    width:100%;\n    background: #000;\n    display: none;\n}\n\n#container {\n  padding-top: 5px;\n}\n\n\n// ----------------------------------------------------------------------------\n// Clearfix\n// ----------------------------------------------------------------------------\n.clearfix:before, .clearfix:after { content: \"\\0020\"; display: block; height: 0; overflow: hidden; }\n.clearfix:after { clear: both; }\n.clearfix { zoom: 1; }\n\n"
  },
  {
    "path": "templates/project/assets/stylesheets/font-awesome.css",
    "content": "/*!\n *  Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome\n *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)\n */\n/* FONT PATH\n * -------------------------- */\n@font-face {\n  font-family: 'FontAwesome';\n  src: url('../assets/fontawesome-webfont.eot?v=4.5.0');\n  src: url('../assets/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../assets/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../assets/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../assets/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../assets/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg');\n  font-weight: normal;\n  font-style: normal;\n}\n.fa {\n  display: inline-block;\n  font: normal normal normal 14px/1 FontAwesome;\n  font-size: inherit;\n  text-rendering: auto;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n/* makes the font 33% larger relative to the icon container */\n.fa-lg {\n  font-size: 1.33333333em;\n  line-height: 0.75em;\n  vertical-align: -15%;\n}\n.fa-2x {\n  font-size: 2em;\n}\n.fa-3x {\n  font-size: 3em;\n}\n.fa-4x {\n  font-size: 4em;\n}\n.fa-5x {\n  font-size: 5em;\n}\n.fa-fw {\n  width: 1.28571429em;\n  text-align: center;\n}\n.fa-ul {\n  padding-left: 0;\n  margin-left: 2.14285714em;\n  list-style-type: none;\n}\n.fa-ul > li {\n  position: relative;\n}\n.fa-li {\n  position: absolute;\n  left: -2.14285714em;\n  width: 2.14285714em;\n  top: 0.14285714em;\n  text-align: center;\n}\n.fa-li.fa-lg {\n  left: -1.85714286em;\n}\n.fa-border {\n  padding: .2em .25em .15em;\n  border: solid 0.08em #eeeeee;\n  border-radius: .1em;\n}\n.fa-pull-left {\n  float: left;\n}\n.fa-pull-right {\n  float: right;\n}\n.fa.fa-pull-left {\n  margin-right: .3em;\n}\n.fa.fa-pull-right {\n  margin-left: .3em;\n}\n/* Deprecated as of 4.4.0 */\n.pull-right {\n  float: right;\n}\n.pull-left {\n  float: left;\n}\n.fa.pull-left {\n  margin-right: .3em;\n}\n.fa.pull-right {\n  margin-left: .3em;\n}\n.fa-spin {\n  -webkit-animation: fa-spin 2s infinite linear;\n  animation: fa-spin 2s infinite linear;\n}\n.fa-pulse {\n  -webkit-animation: fa-spin 1s infinite steps(8);\n  animation: fa-spin 1s infinite steps(8);\n}\n@-webkit-keyframes fa-spin {\n  0% {\n    -webkit-transform: rotate(0deg);\n    transform: rotate(0deg);\n  }\n  100% {\n    -webkit-transform: rotate(359deg);\n    transform: rotate(359deg);\n  }\n}\n@keyframes fa-spin {\n  0% {\n    -webkit-transform: rotate(0deg);\n    transform: rotate(0deg);\n  }\n  100% {\n    -webkit-transform: rotate(359deg);\n    transform: rotate(359deg);\n  }\n}\n.fa-rotate-90 {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);\n  -webkit-transform: rotate(90deg);\n  -ms-transform: rotate(90deg);\n  transform: rotate(90deg);\n}\n.fa-rotate-180 {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);\n  -webkit-transform: rotate(180deg);\n  -ms-transform: rotate(180deg);\n  transform: rotate(180deg);\n}\n.fa-rotate-270 {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);\n  -webkit-transform: rotate(270deg);\n  -ms-transform: rotate(270deg);\n  transform: rotate(270deg);\n}\n.fa-flip-horizontal {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);\n  -webkit-transform: scale(-1, 1);\n  -ms-transform: scale(-1, 1);\n  transform: scale(-1, 1);\n}\n.fa-flip-vertical {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);\n  -webkit-transform: scale(1, -1);\n  -ms-transform: scale(1, -1);\n  transform: scale(1, -1);\n}\n:root .fa-rotate-90,\n:root .fa-rotate-180,\n:root .fa-rotate-270,\n:root .fa-flip-horizontal,\n:root .fa-flip-vertical {\n  filter: none;\n}\n.fa-stack {\n  position: relative;\n  display: inline-block;\n  width: 2em;\n  height: 2em;\n  line-height: 2em;\n  vertical-align: middle;\n}\n.fa-stack-1x,\n.fa-stack-2x {\n  position: absolute;\n  left: 0;\n  width: 100%;\n  text-align: center;\n}\n.fa-stack-1x {\n  line-height: inherit;\n}\n.fa-stack-2x {\n  font-size: 2em;\n}\n.fa-inverse {\n  color: #ffffff;\n}\n/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen\n   readers do not read off random characters that represent icons */\n.fa-glass:before {\n  content: \"\\f000\";\n}\n.fa-music:before {\n  content: \"\\f001\";\n}\n.fa-search:before {\n  content: \"\\f002\";\n}\n.fa-envelope-o:before {\n  content: \"\\f003\";\n}\n.fa-heart:before {\n  content: \"\\f004\";\n}\n.fa-star:before {\n  content: \"\\f005\";\n}\n.fa-star-o:before {\n  content: \"\\f006\";\n}\n.fa-user:before {\n  content: \"\\f007\";\n}\n.fa-film:before {\n  content: \"\\f008\";\n}\n.fa-th-large:before {\n  content: \"\\f009\";\n}\n.fa-th:before {\n  content: \"\\f00a\";\n}\n.fa-th-list:before {\n  content: \"\\f00b\";\n}\n.fa-check:before {\n  content: \"\\f00c\";\n}\n.fa-remove:before,\n.fa-close:before,\n.fa-times:before {\n  content: \"\\f00d\";\n}\n.fa-search-plus:before {\n  content: \"\\f00e\";\n}\n.fa-search-minus:before {\n  content: \"\\f010\";\n}\n.fa-power-off:before {\n  content: \"\\f011\";\n}\n.fa-signal:before {\n  content: \"\\f012\";\n}\n.fa-gear:before,\n.fa-cog:before {\n  content: \"\\f013\";\n}\n.fa-trash-o:before {\n  content: \"\\f014\";\n}\n.fa-home:before {\n  content: \"\\f015\";\n}\n.fa-file-o:before {\n  content: \"\\f016\";\n}\n.fa-clock-o:before {\n  content: \"\\f017\";\n}\n.fa-road:before {\n  content: \"\\f018\";\n}\n.fa-download:before {\n  content: \"\\f019\";\n}\n.fa-arrow-circle-o-down:before {\n  content: \"\\f01a\";\n}\n.fa-arrow-circle-o-up:before {\n  content: \"\\f01b\";\n}\n.fa-inbox:before {\n  content: \"\\f01c\";\n}\n.fa-play-circle-o:before {\n  content: \"\\f01d\";\n}\n.fa-rotate-right:before,\n.fa-repeat:before {\n  content: \"\\f01e\";\n}\n.fa-refresh:before {\n  content: \"\\f021\";\n}\n.fa-list-alt:before {\n  content: \"\\f022\";\n}\n.fa-lock:before {\n  content: \"\\f023\";\n}\n.fa-flag:before {\n  content: \"\\f024\";\n}\n.fa-headphones:before {\n  content: \"\\f025\";\n}\n.fa-volume-off:before {\n  content: \"\\f026\";\n}\n.fa-volume-down:before {\n  content: \"\\f027\";\n}\n.fa-volume-up:before {\n  content: \"\\f028\";\n}\n.fa-qrcode:before {\n  content: \"\\f029\";\n}\n.fa-barcode:before {\n  content: \"\\f02a\";\n}\n.fa-tag:before {\n  content: \"\\f02b\";\n}\n.fa-tags:before {\n  content: \"\\f02c\";\n}\n.fa-book:before {\n  content: \"\\f02d\";\n}\n.fa-bookmark:before {\n  content: \"\\f02e\";\n}\n.fa-print:before {\n  content: \"\\f02f\";\n}\n.fa-camera:before {\n  content: \"\\f030\";\n}\n.fa-font:before {\n  content: \"\\f031\";\n}\n.fa-bold:before {\n  content: \"\\f032\";\n}\n.fa-italic:before {\n  content: \"\\f033\";\n}\n.fa-text-height:before {\n  content: \"\\f034\";\n}\n.fa-text-width:before {\n  content: \"\\f035\";\n}\n.fa-align-left:before {\n  content: \"\\f036\";\n}\n.fa-align-center:before {\n  content: \"\\f037\";\n}\n.fa-align-right:before {\n  content: \"\\f038\";\n}\n.fa-align-justify:before {\n  content: \"\\f039\";\n}\n.fa-list:before {\n  content: \"\\f03a\";\n}\n.fa-dedent:before,\n.fa-outdent:before {\n  content: \"\\f03b\";\n}\n.fa-indent:before {\n  content: \"\\f03c\";\n}\n.fa-video-camera:before {\n  content: \"\\f03d\";\n}\n.fa-photo:before,\n.fa-image:before,\n.fa-picture-o:before {\n  content: \"\\f03e\";\n}\n.fa-pencil:before {\n  content: \"\\f040\";\n}\n.fa-map-marker:before {\n  content: \"\\f041\";\n}\n.fa-adjust:before {\n  content: \"\\f042\";\n}\n.fa-tint:before {\n  content: \"\\f043\";\n}\n.fa-edit:before,\n.fa-pencil-square-o:before {\n  content: \"\\f044\";\n}\n.fa-share-square-o:before {\n  content: \"\\f045\";\n}\n.fa-check-square-o:before {\n  content: \"\\f046\";\n}\n.fa-arrows:before {\n  content: \"\\f047\";\n}\n.fa-step-backward:before {\n  content: \"\\f048\";\n}\n.fa-fast-backward:before {\n  content: \"\\f049\";\n}\n.fa-backward:before {\n  content: \"\\f04a\";\n}\n.fa-play:before {\n  content: \"\\f04b\";\n}\n.fa-pause:before {\n  content: \"\\f04c\";\n}\n.fa-stop:before {\n  content: \"\\f04d\";\n}\n.fa-forward:before {\n  content: \"\\f04e\";\n}\n.fa-fast-forward:before {\n  content: \"\\f050\";\n}\n.fa-step-forward:before {\n  content: \"\\f051\";\n}\n.fa-eject:before {\n  content: \"\\f052\";\n}\n.fa-chevron-left:before {\n  content: \"\\f053\";\n}\n.fa-chevron-right:before {\n  content: \"\\f054\";\n}\n.fa-plus-circle:before {\n  content: \"\\f055\";\n}\n.fa-minus-circle:before {\n  content: \"\\f056\";\n}\n.fa-times-circle:before {\n  content: \"\\f057\";\n}\n.fa-check-circle:before {\n  content: \"\\f058\";\n}\n.fa-question-circle:before {\n  content: \"\\f059\";\n}\n.fa-info-circle:before {\n  content: \"\\f05a\";\n}\n.fa-crosshairs:before {\n  content: \"\\f05b\";\n}\n.fa-times-circle-o:before {\n  content: \"\\f05c\";\n}\n.fa-check-circle-o:before {\n  content: \"\\f05d\";\n}\n.fa-ban:before {\n  content: \"\\f05e\";\n}\n.fa-arrow-left:before {\n  content: \"\\f060\";\n}\n.fa-arrow-right:before {\n  content: \"\\f061\";\n}\n.fa-arrow-up:before {\n  content: \"\\f062\";\n}\n.fa-arrow-down:before {\n  content: \"\\f063\";\n}\n.fa-mail-forward:before,\n.fa-share:before {\n  content: \"\\f064\";\n}\n.fa-expand:before {\n  content: \"\\f065\";\n}\n.fa-compress:before {\n  content: \"\\f066\";\n}\n.fa-plus:before {\n  content: \"\\f067\";\n}\n.fa-minus:before {\n  content: \"\\f068\";\n}\n.fa-asterisk:before {\n  content: \"\\f069\";\n}\n.fa-exclamation-circle:before {\n  content: \"\\f06a\";\n}\n.fa-gift:before {\n  content: \"\\f06b\";\n}\n.fa-leaf:before {\n  content: \"\\f06c\";\n}\n.fa-fire:before {\n  content: \"\\f06d\";\n}\n.fa-eye:before {\n  content: \"\\f06e\";\n}\n.fa-eye-slash:before {\n  content: \"\\f070\";\n}\n.fa-warning:before,\n.fa-exclamation-triangle:before {\n  content: \"\\f071\";\n}\n.fa-plane:before {\n  content: \"\\f072\";\n}\n.fa-calendar:before {\n  content: \"\\f073\";\n}\n.fa-random:before {\n  content: \"\\f074\";\n}\n.fa-comment:before {\n  content: \"\\f075\";\n}\n.fa-magnet:before {\n  content: \"\\f076\";\n}\n.fa-chevron-up:before {\n  content: \"\\f077\";\n}\n.fa-chevron-down:before {\n  content: \"\\f078\";\n}\n.fa-retweet:before {\n  content: \"\\f079\";\n}\n.fa-shopping-cart:before {\n  content: \"\\f07a\";\n}\n.fa-folder:before {\n  content: \"\\f07b\";\n}\n.fa-folder-open:before {\n  content: \"\\f07c\";\n}\n.fa-arrows-v:before {\n  content: \"\\f07d\";\n}\n.fa-arrows-h:before {\n  content: \"\\f07e\";\n}\n.fa-bar-chart-o:before,\n.fa-bar-chart:before {\n  content: \"\\f080\";\n}\n.fa-twitter-square:before {\n  content: \"\\f081\";\n}\n.fa-facebook-square:before {\n  content: \"\\f082\";\n}\n.fa-camera-retro:before {\n  content: \"\\f083\";\n}\n.fa-key:before {\n  content: \"\\f084\";\n}\n.fa-gears:before,\n.fa-cogs:before {\n  content: \"\\f085\";\n}\n.fa-comments:before {\n  content: \"\\f086\";\n}\n.fa-thumbs-o-up:before {\n  content: \"\\f087\";\n}\n.fa-thumbs-o-down:before {\n  content: \"\\f088\";\n}\n.fa-star-half:before {\n  content: \"\\f089\";\n}\n.fa-heart-o:before {\n  content: \"\\f08a\";\n}\n.fa-sign-out:before {\n  content: \"\\f08b\";\n}\n.fa-linkedin-square:before {\n  content: \"\\f08c\";\n}\n.fa-thumb-tack:before {\n  content: \"\\f08d\";\n}\n.fa-external-link:before {\n  content: \"\\f08e\";\n}\n.fa-sign-in:before {\n  content: \"\\f090\";\n}\n.fa-trophy:before {\n  content: \"\\f091\";\n}\n.fa-github-square:before {\n  content: \"\\f092\";\n}\n.fa-upload:before {\n  content: \"\\f093\";\n}\n.fa-lemon-o:before {\n  content: \"\\f094\";\n}\n.fa-phone:before {\n  content: \"\\f095\";\n}\n.fa-square-o:before {\n  content: \"\\f096\";\n}\n.fa-bookmark-o:before {\n  content: \"\\f097\";\n}\n.fa-phone-square:before {\n  content: \"\\f098\";\n}\n.fa-twitter:before {\n  content: \"\\f099\";\n}\n.fa-facebook-f:before,\n.fa-facebook:before {\n  content: \"\\f09a\";\n}\n.fa-github:before {\n  content: \"\\f09b\";\n}\n.fa-unlock:before {\n  content: \"\\f09c\";\n}\n.fa-credit-card:before {\n  content: \"\\f09d\";\n}\n.fa-feed:before,\n.fa-rss:before {\n  content: \"\\f09e\";\n}\n.fa-hdd-o:before {\n  content: \"\\f0a0\";\n}\n.fa-bullhorn:before {\n  content: \"\\f0a1\";\n}\n.fa-bell:before {\n  content: \"\\f0f3\";\n}\n.fa-certificate:before {\n  content: \"\\f0a3\";\n}\n.fa-hand-o-right:before {\n  content: \"\\f0a4\";\n}\n.fa-hand-o-left:before {\n  content: \"\\f0a5\";\n}\n.fa-hand-o-up:before {\n  content: \"\\f0a6\";\n}\n.fa-hand-o-down:before {\n  content: \"\\f0a7\";\n}\n.fa-arrow-circle-left:before {\n  content: \"\\f0a8\";\n}\n.fa-arrow-circle-right:before {\n  content: \"\\f0a9\";\n}\n.fa-arrow-circle-up:before {\n  content: \"\\f0aa\";\n}\n.fa-arrow-circle-down:before {\n  content: \"\\f0ab\";\n}\n.fa-globe:before {\n  content: \"\\f0ac\";\n}\n.fa-wrench:before {\n  content: \"\\f0ad\";\n}\n.fa-tasks:before {\n  content: \"\\f0ae\";\n}\n.fa-filter:before {\n  content: \"\\f0b0\";\n}\n.fa-briefcase:before {\n  content: \"\\f0b1\";\n}\n.fa-arrows-alt:before {\n  content: \"\\f0b2\";\n}\n.fa-group:before,\n.fa-users:before {\n  content: \"\\f0c0\";\n}\n.fa-chain:before,\n.fa-link:before {\n  content: \"\\f0c1\";\n}\n.fa-cloud:before {\n  content: \"\\f0c2\";\n}\n.fa-flask:before {\n  content: \"\\f0c3\";\n}\n.fa-cut:before,\n.fa-scissors:before {\n  content: \"\\f0c4\";\n}\n.fa-copy:before,\n.fa-files-o:before {\n  content: \"\\f0c5\";\n}\n.fa-paperclip:before {\n  content: \"\\f0c6\";\n}\n.fa-save:before,\n.fa-floppy-o:before {\n  content: \"\\f0c7\";\n}\n.fa-square:before {\n  content: \"\\f0c8\";\n}\n.fa-navicon:before,\n.fa-reorder:before,\n.fa-bars:before {\n  content: \"\\f0c9\";\n}\n.fa-list-ul:before {\n  content: \"\\f0ca\";\n}\n.fa-list-ol:before {\n  content: \"\\f0cb\";\n}\n.fa-strikethrough:before {\n  content: \"\\f0cc\";\n}\n.fa-underline:before {\n  content: \"\\f0cd\";\n}\n.fa-table:before {\n  content: \"\\f0ce\";\n}\n.fa-magic:before {\n  content: \"\\f0d0\";\n}\n.fa-truck:before {\n  content: \"\\f0d1\";\n}\n.fa-pinterest:before {\n  content: \"\\f0d2\";\n}\n.fa-pinterest-square:before {\n  content: \"\\f0d3\";\n}\n.fa-google-plus-square:before {\n  content: \"\\f0d4\";\n}\n.fa-google-plus:before {\n  content: \"\\f0d5\";\n}\n.fa-money:before {\n  content: \"\\f0d6\";\n}\n.fa-caret-down:before {\n  content: \"\\f0d7\";\n}\n.fa-caret-up:before {\n  content: \"\\f0d8\";\n}\n.fa-caret-left:before {\n  content: \"\\f0d9\";\n}\n.fa-caret-right:before {\n  content: \"\\f0da\";\n}\n.fa-columns:before {\n  content: \"\\f0db\";\n}\n.fa-unsorted:before,\n.fa-sort:before {\n  content: \"\\f0dc\";\n}\n.fa-sort-down:before,\n.fa-sort-desc:before {\n  content: \"\\f0dd\";\n}\n.fa-sort-up:before,\n.fa-sort-asc:before {\n  content: \"\\f0de\";\n}\n.fa-envelope:before {\n  content: \"\\f0e0\";\n}\n.fa-linkedin:before {\n  content: \"\\f0e1\";\n}\n.fa-rotate-left:before,\n.fa-undo:before {\n  content: \"\\f0e2\";\n}\n.fa-legal:before,\n.fa-gavel:before {\n  content: \"\\f0e3\";\n}\n.fa-dashboard:before,\n.fa-tachometer:before {\n  content: \"\\f0e4\";\n}\n.fa-comment-o:before {\n  content: \"\\f0e5\";\n}\n.fa-comments-o:before {\n  content: \"\\f0e6\";\n}\n.fa-flash:before,\n.fa-bolt:before {\n  content: \"\\f0e7\";\n}\n.fa-sitemap:before {\n  content: \"\\f0e8\";\n}\n.fa-umbrella:before {\n  content: \"\\f0e9\";\n}\n.fa-paste:before,\n.fa-clipboard:before {\n  content: \"\\f0ea\";\n}\n.fa-lightbulb-o:before {\n  content: \"\\f0eb\";\n}\n.fa-exchange:before {\n  content: \"\\f0ec\";\n}\n.fa-cloud-download:before {\n  content: \"\\f0ed\";\n}\n.fa-cloud-upload:before {\n  content: \"\\f0ee\";\n}\n.fa-user-md:before {\n  content: \"\\f0f0\";\n}\n.fa-stethoscope:before {\n  content: \"\\f0f1\";\n}\n.fa-suitcase:before {\n  content: \"\\f0f2\";\n}\n.fa-bell-o:before {\n  content: \"\\f0a2\";\n}\n.fa-coffee:before {\n  content: \"\\f0f4\";\n}\n.fa-cutlery:before {\n  content: \"\\f0f5\";\n}\n.fa-file-text-o:before {\n  content: \"\\f0f6\";\n}\n.fa-building-o:before {\n  content: \"\\f0f7\";\n}\n.fa-hospital-o:before {\n  content: \"\\f0f8\";\n}\n.fa-ambulance:before {\n  content: \"\\f0f9\";\n}\n.fa-medkit:before {\n  content: \"\\f0fa\";\n}\n.fa-fighter-jet:before {\n  content: \"\\f0fb\";\n}\n.fa-beer:before {\n  content: \"\\f0fc\";\n}\n.fa-h-square:before {\n  content: \"\\f0fd\";\n}\n.fa-plus-square:before {\n  content: \"\\f0fe\";\n}\n.fa-angle-double-left:before {\n  content: \"\\f100\";\n}\n.fa-angle-double-right:before {\n  content: \"\\f101\";\n}\n.fa-angle-double-up:before {\n  content: \"\\f102\";\n}\n.fa-angle-double-down:before {\n  content: \"\\f103\";\n}\n.fa-angle-left:before {\n  content: \"\\f104\";\n}\n.fa-angle-right:before {\n  content: \"\\f105\";\n}\n.fa-angle-up:before {\n  content: \"\\f106\";\n}\n.fa-angle-down:before {\n  content: \"\\f107\";\n}\n.fa-desktop:before {\n  content: \"\\f108\";\n}\n.fa-laptop:before {\n  content: \"\\f109\";\n}\n.fa-tablet:before {\n  content: \"\\f10a\";\n}\n.fa-mobile-phone:before,\n.fa-mobile:before {\n  content: \"\\f10b\";\n}\n.fa-circle-o:before {\n  content: \"\\f10c\";\n}\n.fa-quote-left:before {\n  content: \"\\f10d\";\n}\n.fa-quote-right:before {\n  content: \"\\f10e\";\n}\n.fa-spinner:before {\n  content: \"\\f110\";\n}\n.fa-circle:before {\n  content: \"\\f111\";\n}\n.fa-mail-reply:before,\n.fa-reply:before {\n  content: \"\\f112\";\n}\n.fa-github-alt:before {\n  content: \"\\f113\";\n}\n.fa-folder-o:before {\n  content: \"\\f114\";\n}\n.fa-folder-open-o:before {\n  content: \"\\f115\";\n}\n.fa-smile-o:before {\n  content: \"\\f118\";\n}\n.fa-frown-o:before {\n  content: \"\\f119\";\n}\n.fa-meh-o:before {\n  content: \"\\f11a\";\n}\n.fa-gamepad:before {\n  content: \"\\f11b\";\n}\n.fa-keyboard-o:before {\n  content: \"\\f11c\";\n}\n.fa-flag-o:before {\n  content: \"\\f11d\";\n}\n.fa-flag-checkered:before {\n  content: \"\\f11e\";\n}\n.fa-terminal:before {\n  content: \"\\f120\";\n}\n.fa-code:before {\n  content: \"\\f121\";\n}\n.fa-mail-reply-all:before,\n.fa-reply-all:before {\n  content: \"\\f122\";\n}\n.fa-star-half-empty:before,\n.fa-star-half-full:before,\n.fa-star-half-o:before {\n  content: \"\\f123\";\n}\n.fa-location-arrow:before {\n  content: \"\\f124\";\n}\n.fa-crop:before {\n  content: \"\\f125\";\n}\n.fa-code-fork:before {\n  content: \"\\f126\";\n}\n.fa-unlink:before,\n.fa-chain-broken:before {\n  content: \"\\f127\";\n}\n.fa-question:before {\n  content: \"\\f128\";\n}\n.fa-info:before {\n  content: \"\\f129\";\n}\n.fa-exclamation:before {\n  content: \"\\f12a\";\n}\n.fa-superscript:before {\n  content: \"\\f12b\";\n}\n.fa-subscript:before {\n  content: \"\\f12c\";\n}\n.fa-eraser:before {\n  content: \"\\f12d\";\n}\n.fa-puzzle-piece:before {\n  content: \"\\f12e\";\n}\n.fa-microphone:before {\n  content: \"\\f130\";\n}\n.fa-microphone-slash:before {\n  content: \"\\f131\";\n}\n.fa-shield:before {\n  content: \"\\f132\";\n}\n.fa-calendar-o:before {\n  content: \"\\f133\";\n}\n.fa-fire-extinguisher:before {\n  content: \"\\f134\";\n}\n.fa-rocket:before {\n  content: \"\\f135\";\n}\n.fa-maxcdn:before {\n  content: \"\\f136\";\n}\n.fa-chevron-circle-left:before {\n  content: \"\\f137\";\n}\n.fa-chevron-circle-right:before {\n  content: \"\\f138\";\n}\n.fa-chevron-circle-up:before {\n  content: \"\\f139\";\n}\n.fa-chevron-circle-down:before {\n  content: \"\\f13a\";\n}\n.fa-html5:before {\n  content: \"\\f13b\";\n}\n.fa-css3:before {\n  content: \"\\f13c\";\n}\n.fa-anchor:before {\n  content: \"\\f13d\";\n}\n.fa-unlock-alt:before {\n  content: \"\\f13e\";\n}\n.fa-bullseye:before {\n  content: \"\\f140\";\n}\n.fa-ellipsis-h:before {\n  content: \"\\f141\";\n}\n.fa-ellipsis-v:before {\n  content: \"\\f142\";\n}\n.fa-rss-square:before {\n  content: \"\\f143\";\n}\n.fa-play-circle:before {\n  content: \"\\f144\";\n}\n.fa-ticket:before {\n  content: \"\\f145\";\n}\n.fa-minus-square:before {\n  content: \"\\f146\";\n}\n.fa-minus-square-o:before {\n  content: \"\\f147\";\n}\n.fa-level-up:before {\n  content: \"\\f148\";\n}\n.fa-level-down:before {\n  content: \"\\f149\";\n}\n.fa-check-square:before {\n  content: \"\\f14a\";\n}\n.fa-pencil-square:before {\n  content: \"\\f14b\";\n}\n.fa-external-link-square:before {\n  content: \"\\f14c\";\n}\n.fa-share-square:before {\n  content: \"\\f14d\";\n}\n.fa-compass:before {\n  content: \"\\f14e\";\n}\n.fa-toggle-down:before,\n.fa-caret-square-o-down:before {\n  content: \"\\f150\";\n}\n.fa-toggle-up:before,\n.fa-caret-square-o-up:before {\n  content: \"\\f151\";\n}\n.fa-toggle-right:before,\n.fa-caret-square-o-right:before {\n  content: \"\\f152\";\n}\n.fa-euro:before,\n.fa-eur:before {\n  content: \"\\f153\";\n}\n.fa-gbp:before {\n  content: \"\\f154\";\n}\n.fa-dollar:before,\n.fa-usd:before {\n  content: \"\\f155\";\n}\n.fa-rupee:before,\n.fa-inr:before {\n  content: \"\\f156\";\n}\n.fa-cny:before,\n.fa-rmb:before,\n.fa-yen:before,\n.fa-jpy:before {\n  content: \"\\f157\";\n}\n.fa-ruble:before,\n.fa-rouble:before,\n.fa-rub:before {\n  content: \"\\f158\";\n}\n.fa-won:before,\n.fa-krw:before {\n  content: \"\\f159\";\n}\n.fa-bitcoin:before,\n.fa-btc:before {\n  content: \"\\f15a\";\n}\n.fa-file:before {\n  content: \"\\f15b\";\n}\n.fa-file-text:before {\n  content: \"\\f15c\";\n}\n.fa-sort-alpha-asc:before {\n  content: \"\\f15d\";\n}\n.fa-sort-alpha-desc:before {\n  content: \"\\f15e\";\n}\n.fa-sort-amount-asc:before {\n  content: \"\\f160\";\n}\n.fa-sort-amount-desc:before {\n  content: \"\\f161\";\n}\n.fa-sort-numeric-asc:before {\n  content: \"\\f162\";\n}\n.fa-sort-numeric-desc:before {\n  content: \"\\f163\";\n}\n.fa-thumbs-up:before {\n  content: \"\\f164\";\n}\n.fa-thumbs-down:before {\n  content: \"\\f165\";\n}\n.fa-youtube-square:before {\n  content: \"\\f166\";\n}\n.fa-youtube:before {\n  content: \"\\f167\";\n}\n.fa-xing:before {\n  content: \"\\f168\";\n}\n.fa-xing-square:before {\n  content: \"\\f169\";\n}\n.fa-youtube-play:before {\n  content: \"\\f16a\";\n}\n.fa-dropbox:before {\n  content: \"\\f16b\";\n}\n.fa-stack-overflow:before {\n  content: \"\\f16c\";\n}\n.fa-instagram:before {\n  content: \"\\f16d\";\n}\n.fa-flickr:before {\n  content: \"\\f16e\";\n}\n.fa-adn:before {\n  content: \"\\f170\";\n}\n.fa-bitbucket:before {\n  content: \"\\f171\";\n}\n.fa-bitbucket-square:before {\n  content: \"\\f172\";\n}\n.fa-tumblr:before {\n  content: \"\\f173\";\n}\n.fa-tumblr-square:before {\n  content: \"\\f174\";\n}\n.fa-long-arrow-down:before {\n  content: \"\\f175\";\n}\n.fa-long-arrow-up:before {\n  content: \"\\f176\";\n}\n.fa-long-arrow-left:before {\n  content: \"\\f177\";\n}\n.fa-long-arrow-right:before {\n  content: \"\\f178\";\n}\n.fa-apple:before {\n  content: \"\\f179\";\n}\n.fa-windows:before {\n  content: \"\\f17a\";\n}\n.fa-android:before {\n  content: \"\\f17b\";\n}\n.fa-linux:before {\n  content: \"\\f17c\";\n}\n.fa-dribbble:before {\n  content: \"\\f17d\";\n}\n.fa-skype:before {\n  content: \"\\f17e\";\n}\n.fa-foursquare:before {\n  content: \"\\f180\";\n}\n.fa-trello:before {\n  content: \"\\f181\";\n}\n.fa-female:before {\n  content: \"\\f182\";\n}\n.fa-male:before {\n  content: \"\\f183\";\n}\n.fa-gittip:before,\n.fa-gratipay:before {\n  content: \"\\f184\";\n}\n.fa-sun-o:before {\n  content: \"\\f185\";\n}\n.fa-moon-o:before {\n  content: \"\\f186\";\n}\n.fa-archive:before {\n  content: \"\\f187\";\n}\n.fa-bug:before {\n  content: \"\\f188\";\n}\n.fa-vk:before {\n  content: \"\\f189\";\n}\n.fa-weibo:before {\n  content: \"\\f18a\";\n}\n.fa-renren:before {\n  content: \"\\f18b\";\n}\n.fa-pagelines:before {\n  content: \"\\f18c\";\n}\n.fa-stack-exchange:before {\n  content: \"\\f18d\";\n}\n.fa-arrow-circle-o-right:before {\n  content: \"\\f18e\";\n}\n.fa-arrow-circle-o-left:before {\n  content: \"\\f190\";\n}\n.fa-toggle-left:before,\n.fa-caret-square-o-left:before {\n  content: \"\\f191\";\n}\n.fa-dot-circle-o:before {\n  content: \"\\f192\";\n}\n.fa-wheelchair:before {\n  content: \"\\f193\";\n}\n.fa-vimeo-square:before {\n  content: \"\\f194\";\n}\n.fa-turkish-lira:before,\n.fa-try:before {\n  content: \"\\f195\";\n}\n.fa-plus-square-o:before {\n  content: \"\\f196\";\n}\n.fa-space-shuttle:before {\n  content: \"\\f197\";\n}\n.fa-slack:before {\n  content: \"\\f198\";\n}\n.fa-envelope-square:before {\n  content: \"\\f199\";\n}\n.fa-wordpress:before {\n  content: \"\\f19a\";\n}\n.fa-openid:before {\n  content: \"\\f19b\";\n}\n.fa-institution:before,\n.fa-bank:before,\n.fa-university:before {\n  content: \"\\f19c\";\n}\n.fa-mortar-board:before,\n.fa-graduation-cap:before {\n  content: \"\\f19d\";\n}\n.fa-yahoo:before {\n  content: \"\\f19e\";\n}\n.fa-google:before {\n  content: \"\\f1a0\";\n}\n.fa-reddit:before {\n  content: \"\\f1a1\";\n}\n.fa-reddit-square:before {\n  content: \"\\f1a2\";\n}\n.fa-stumbleupon-circle:before {\n  content: \"\\f1a3\";\n}\n.fa-stumbleupon:before {\n  content: \"\\f1a4\";\n}\n.fa-delicious:before {\n  content: \"\\f1a5\";\n}\n.fa-digg:before {\n  content: \"\\f1a6\";\n}\n.fa-pied-piper:before {\n  content: \"\\f1a7\";\n}\n.fa-pied-piper-alt:before {\n  content: \"\\f1a8\";\n}\n.fa-drupal:before {\n  content: \"\\f1a9\";\n}\n.fa-joomla:before {\n  content: \"\\f1aa\";\n}\n.fa-language:before {\n  content: \"\\f1ab\";\n}\n.fa-fax:before {\n  content: \"\\f1ac\";\n}\n.fa-building:before {\n  content: \"\\f1ad\";\n}\n.fa-child:before {\n  content: \"\\f1ae\";\n}\n.fa-paw:before {\n  content: \"\\f1b0\";\n}\n.fa-spoon:before {\n  content: \"\\f1b1\";\n}\n.fa-cube:before {\n  content: \"\\f1b2\";\n}\n.fa-cubes:before {\n  content: \"\\f1b3\";\n}\n.fa-behance:before {\n  content: \"\\f1b4\";\n}\n.fa-behance-square:before {\n  content: \"\\f1b5\";\n}\n.fa-steam:before {\n  content: \"\\f1b6\";\n}\n.fa-steam-square:before {\n  content: \"\\f1b7\";\n}\n.fa-recycle:before {\n  content: \"\\f1b8\";\n}\n.fa-automobile:before,\n.fa-car:before {\n  content: \"\\f1b9\";\n}\n.fa-cab:before,\n.fa-taxi:before {\n  content: \"\\f1ba\";\n}\n.fa-tree:before {\n  content: \"\\f1bb\";\n}\n.fa-spotify:before {\n  content: \"\\f1bc\";\n}\n.fa-deviantart:before {\n  content: \"\\f1bd\";\n}\n.fa-soundcloud:before {\n  content: \"\\f1be\";\n}\n.fa-database:before {\n  content: \"\\f1c0\";\n}\n.fa-file-pdf-o:before {\n  content: \"\\f1c1\";\n}\n.fa-file-word-o:before {\n  content: \"\\f1c2\";\n}\n.fa-file-excel-o:before {\n  content: \"\\f1c3\";\n}\n.fa-file-powerpoint-o:before {\n  content: \"\\f1c4\";\n}\n.fa-file-photo-o:before,\n.fa-file-picture-o:before,\n.fa-file-image-o:before {\n  content: \"\\f1c5\";\n}\n.fa-file-zip-o:before,\n.fa-file-archive-o:before {\n  content: \"\\f1c6\";\n}\n.fa-file-sound-o:before,\n.fa-file-audio-o:before {\n  content: \"\\f1c7\";\n}\n.fa-file-movie-o:before,\n.fa-file-video-o:before {\n  content: \"\\f1c8\";\n}\n.fa-file-code-o:before {\n  content: \"\\f1c9\";\n}\n.fa-vine:before {\n  content: \"\\f1ca\";\n}\n.fa-codepen:before {\n  content: \"\\f1cb\";\n}\n.fa-jsfiddle:before {\n  content: \"\\f1cc\";\n}\n.fa-life-bouy:before,\n.fa-life-buoy:before,\n.fa-life-saver:before,\n.fa-support:before,\n.fa-life-ring:before {\n  content: \"\\f1cd\";\n}\n.fa-circle-o-notch:before {\n  content: \"\\f1ce\";\n}\n.fa-ra:before,\n.fa-rebel:before {\n  content: \"\\f1d0\";\n}\n.fa-ge:before,\n.fa-empire:before {\n  content: \"\\f1d1\";\n}\n.fa-git-square:before {\n  content: \"\\f1d2\";\n}\n.fa-git:before {\n  content: \"\\f1d3\";\n}\n.fa-y-combinator-square:before,\n.fa-yc-square:before,\n.fa-hacker-news:before {\n  content: \"\\f1d4\";\n}\n.fa-tencent-weibo:before {\n  content: \"\\f1d5\";\n}\n.fa-qq:before {\n  content: \"\\f1d6\";\n}\n.fa-wechat:before,\n.fa-weixin:before {\n  content: \"\\f1d7\";\n}\n.fa-send:before,\n.fa-paper-plane:before {\n  content: \"\\f1d8\";\n}\n.fa-send-o:before,\n.fa-paper-plane-o:before {\n  content: \"\\f1d9\";\n}\n.fa-history:before {\n  content: \"\\f1da\";\n}\n.fa-circle-thin:before {\n  content: \"\\f1db\";\n}\n.fa-header:before {\n  content: \"\\f1dc\";\n}\n.fa-paragraph:before {\n  content: \"\\f1dd\";\n}\n.fa-sliders:before {\n  content: \"\\f1de\";\n}\n.fa-share-alt:before {\n  content: \"\\f1e0\";\n}\n.fa-share-alt-square:before {\n  content: \"\\f1e1\";\n}\n.fa-bomb:before {\n  content: \"\\f1e2\";\n}\n.fa-soccer-ball-o:before,\n.fa-futbol-o:before {\n  content: \"\\f1e3\";\n}\n.fa-tty:before {\n  content: \"\\f1e4\";\n}\n.fa-binoculars:before {\n  content: \"\\f1e5\";\n}\n.fa-plug:before {\n  content: \"\\f1e6\";\n}\n.fa-slideshare:before {\n  content: \"\\f1e7\";\n}\n.fa-twitch:before {\n  content: \"\\f1e8\";\n}\n.fa-yelp:before {\n  content: \"\\f1e9\";\n}\n.fa-newspaper-o:before {\n  content: \"\\f1ea\";\n}\n.fa-wifi:before {\n  content: \"\\f1eb\";\n}\n.fa-calculator:before {\n  content: \"\\f1ec\";\n}\n.fa-paypal:before {\n  content: \"\\f1ed\";\n}\n.fa-google-wallet:before {\n  content: \"\\f1ee\";\n}\n.fa-cc-visa:before {\n  content: \"\\f1f0\";\n}\n.fa-cc-mastercard:before {\n  content: \"\\f1f1\";\n}\n.fa-cc-discover:before {\n  content: \"\\f1f2\";\n}\n.fa-cc-amex:before {\n  content: \"\\f1f3\";\n}\n.fa-cc-paypal:before {\n  content: \"\\f1f4\";\n}\n.fa-cc-stripe:before {\n  content: \"\\f1f5\";\n}\n.fa-bell-slash:before {\n  content: \"\\f1f6\";\n}\n.fa-bell-slash-o:before {\n  content: \"\\f1f7\";\n}\n.fa-trash:before {\n  content: \"\\f1f8\";\n}\n.fa-copyright:before {\n  content: \"\\f1f9\";\n}\n.fa-at:before {\n  content: \"\\f1fa\";\n}\n.fa-eyedropper:before {\n  content: \"\\f1fb\";\n}\n.fa-paint-brush:before {\n  content: \"\\f1fc\";\n}\n.fa-birthday-cake:before {\n  content: \"\\f1fd\";\n}\n.fa-area-chart:before {\n  content: \"\\f1fe\";\n}\n.fa-pie-chart:before {\n  content: \"\\f200\";\n}\n.fa-line-chart:before {\n  content: \"\\f201\";\n}\n.fa-lastfm:before {\n  content: \"\\f202\";\n}\n.fa-lastfm-square:before {\n  content: \"\\f203\";\n}\n.fa-toggle-off:before {\n  content: \"\\f204\";\n}\n.fa-toggle-on:before {\n  content: \"\\f205\";\n}\n.fa-bicycle:before {\n  content: \"\\f206\";\n}\n.fa-bus:before {\n  content: \"\\f207\";\n}\n.fa-ioxhost:before {\n  content: \"\\f208\";\n}\n.fa-angellist:before {\n  content: \"\\f209\";\n}\n.fa-cc:before {\n  content: \"\\f20a\";\n}\n.fa-shekel:before,\n.fa-sheqel:before,\n.fa-ils:before {\n  content: \"\\f20b\";\n}\n.fa-meanpath:before {\n  content: \"\\f20c\";\n}\n.fa-buysellads:before {\n  content: \"\\f20d\";\n}\n.fa-connectdevelop:before {\n  content: \"\\f20e\";\n}\n.fa-dashcube:before {\n  content: \"\\f210\";\n}\n.fa-forumbee:before {\n  content: \"\\f211\";\n}\n.fa-leanpub:before {\n  content: \"\\f212\";\n}\n.fa-sellsy:before {\n  content: \"\\f213\";\n}\n.fa-shirtsinbulk:before {\n  content: \"\\f214\";\n}\n.fa-simplybuilt:before {\n  content: \"\\f215\";\n}\n.fa-skyatlas:before {\n  content: \"\\f216\";\n}\n.fa-cart-plus:before {\n  content: \"\\f217\";\n}\n.fa-cart-arrow-down:before {\n  content: \"\\f218\";\n}\n.fa-diamond:before {\n  content: \"\\f219\";\n}\n.fa-ship:before {\n  content: \"\\f21a\";\n}\n.fa-user-secret:before {\n  content: \"\\f21b\";\n}\n.fa-motorcycle:before {\n  content: \"\\f21c\";\n}\n.fa-street-view:before {\n  content: \"\\f21d\";\n}\n.fa-heartbeat:before {\n  content: \"\\f21e\";\n}\n.fa-venus:before {\n  content: \"\\f221\";\n}\n.fa-mars:before {\n  content: \"\\f222\";\n}\n.fa-mercury:before {\n  content: \"\\f223\";\n}\n.fa-intersex:before,\n.fa-transgender:before {\n  content: \"\\f224\";\n}\n.fa-transgender-alt:before {\n  content: \"\\f225\";\n}\n.fa-venus-double:before {\n  content: \"\\f226\";\n}\n.fa-mars-double:before {\n  content: \"\\f227\";\n}\n.fa-venus-mars:before {\n  content: \"\\f228\";\n}\n.fa-mars-stroke:before {\n  content: \"\\f229\";\n}\n.fa-mars-stroke-v:before {\n  content: \"\\f22a\";\n}\n.fa-mars-stroke-h:before {\n  content: \"\\f22b\";\n}\n.fa-neuter:before {\n  content: \"\\f22c\";\n}\n.fa-genderless:before {\n  content: \"\\f22d\";\n}\n.fa-facebook-official:before {\n  content: \"\\f230\";\n}\n.fa-pinterest-p:before {\n  content: \"\\f231\";\n}\n.fa-whatsapp:before {\n  content: \"\\f232\";\n}\n.fa-server:before {\n  content: \"\\f233\";\n}\n.fa-user-plus:before {\n  content: \"\\f234\";\n}\n.fa-user-times:before {\n  content: \"\\f235\";\n}\n.fa-hotel:before,\n.fa-bed:before {\n  content: \"\\f236\";\n}\n.fa-viacoin:before {\n  content: \"\\f237\";\n}\n.fa-train:before {\n  content: \"\\f238\";\n}\n.fa-subway:before {\n  content: \"\\f239\";\n}\n.fa-medium:before {\n  content: \"\\f23a\";\n}\n.fa-yc:before,\n.fa-y-combinator:before {\n  content: \"\\f23b\";\n}\n.fa-optin-monster:before {\n  content: \"\\f23c\";\n}\n.fa-opencart:before {\n  content: \"\\f23d\";\n}\n.fa-expeditedssl:before {\n  content: \"\\f23e\";\n}\n.fa-battery-4:before,\n.fa-battery-full:before {\n  content: \"\\f240\";\n}\n.fa-battery-3:before,\n.fa-battery-three-quarters:before {\n  content: \"\\f241\";\n}\n.fa-battery-2:before,\n.fa-battery-half:before {\n  content: \"\\f242\";\n}\n.fa-battery-1:before,\n.fa-battery-quarter:before {\n  content: \"\\f243\";\n}\n.fa-battery-0:before,\n.fa-battery-empty:before {\n  content: \"\\f244\";\n}\n.fa-mouse-pointer:before {\n  content: \"\\f245\";\n}\n.fa-i-cursor:before {\n  content: \"\\f246\";\n}\n.fa-object-group:before {\n  content: \"\\f247\";\n}\n.fa-object-ungroup:before {\n  content: \"\\f248\";\n}\n.fa-sticky-note:before {\n  content: \"\\f249\";\n}\n.fa-sticky-note-o:before {\n  content: \"\\f24a\";\n}\n.fa-cc-jcb:before {\n  content: \"\\f24b\";\n}\n.fa-cc-diners-club:before {\n  content: \"\\f24c\";\n}\n.fa-clone:before {\n  content: \"\\f24d\";\n}\n.fa-balance-scale:before {\n  content: \"\\f24e\";\n}\n.fa-hourglass-o:before {\n  content: \"\\f250\";\n}\n.fa-hourglass-1:before,\n.fa-hourglass-start:before {\n  content: \"\\f251\";\n}\n.fa-hourglass-2:before,\n.fa-hourglass-half:before {\n  content: \"\\f252\";\n}\n.fa-hourglass-3:before,\n.fa-hourglass-end:before {\n  content: \"\\f253\";\n}\n.fa-hourglass:before {\n  content: \"\\f254\";\n}\n.fa-hand-grab-o:before,\n.fa-hand-rock-o:before {\n  content: \"\\f255\";\n}\n.fa-hand-stop-o:before,\n.fa-hand-paper-o:before {\n  content: \"\\f256\";\n}\n.fa-hand-scissors-o:before {\n  content: \"\\f257\";\n}\n.fa-hand-lizard-o:before {\n  content: \"\\f258\";\n}\n.fa-hand-spock-o:before {\n  content: \"\\f259\";\n}\n.fa-hand-pointer-o:before {\n  content: \"\\f25a\";\n}\n.fa-hand-peace-o:before {\n  content: \"\\f25b\";\n}\n.fa-trademark:before {\n  content: \"\\f25c\";\n}\n.fa-registered:before {\n  content: \"\\f25d\";\n}\n.fa-creative-commons:before {\n  content: \"\\f25e\";\n}\n.fa-gg:before {\n  content: \"\\f260\";\n}\n.fa-gg-circle:before {\n  content: \"\\f261\";\n}\n.fa-tripadvisor:before {\n  content: \"\\f262\";\n}\n.fa-odnoklassniki:before {\n  content: \"\\f263\";\n}\n.fa-odnoklassniki-square:before {\n  content: \"\\f264\";\n}\n.fa-get-pocket:before {\n  content: \"\\f265\";\n}\n.fa-wikipedia-w:before {\n  content: \"\\f266\";\n}\n.fa-safari:before {\n  content: \"\\f267\";\n}\n.fa-chrome:before {\n  content: \"\\f268\";\n}\n.fa-firefox:before {\n  content: \"\\f269\";\n}\n.fa-opera:before {\n  content: \"\\f26a\";\n}\n.fa-internet-explorer:before {\n  content: \"\\f26b\";\n}\n.fa-tv:before,\n.fa-television:before {\n  content: \"\\f26c\";\n}\n.fa-contao:before {\n  content: \"\\f26d\";\n}\n.fa-500px:before {\n  content: \"\\f26e\";\n}\n.fa-amazon:before {\n  content: \"\\f270\";\n}\n.fa-calendar-plus-o:before {\n  content: \"\\f271\";\n}\n.fa-calendar-minus-o:before {\n  content: \"\\f272\";\n}\n.fa-calendar-times-o:before {\n  content: \"\\f273\";\n}\n.fa-calendar-check-o:before {\n  content: \"\\f274\";\n}\n.fa-industry:before {\n  content: \"\\f275\";\n}\n.fa-map-pin:before {\n  content: \"\\f276\";\n}\n.fa-map-signs:before {\n  content: \"\\f277\";\n}\n.fa-map-o:before {\n  content: \"\\f278\";\n}\n.fa-map:before {\n  content: \"\\f279\";\n}\n.fa-commenting:before {\n  content: \"\\f27a\";\n}\n.fa-commenting-o:before {\n  content: \"\\f27b\";\n}\n.fa-houzz:before {\n  content: \"\\f27c\";\n}\n.fa-vimeo:before {\n  content: \"\\f27d\";\n}\n.fa-black-tie:before {\n  content: \"\\f27e\";\n}\n.fa-fonticons:before {\n  content: \"\\f280\";\n}\n.fa-reddit-alien:before {\n  content: \"\\f281\";\n}\n.fa-edge:before {\n  content: \"\\f282\";\n}\n.fa-credit-card-alt:before {\n  content: \"\\f283\";\n}\n.fa-codiepie:before {\n  content: \"\\f284\";\n}\n.fa-modx:before {\n  content: \"\\f285\";\n}\n.fa-fort-awesome:before {\n  content: \"\\f286\";\n}\n.fa-usb:before {\n  content: \"\\f287\";\n}\n.fa-product-hunt:before {\n  content: \"\\f288\";\n}\n.fa-mixcloud:before {\n  content: \"\\f289\";\n}\n.fa-scribd:before {\n  content: \"\\f28a\";\n}\n.fa-pause-circle:before {\n  content: \"\\f28b\";\n}\n.fa-pause-circle-o:before {\n  content: \"\\f28c\";\n}\n.fa-stop-circle:before {\n  content: \"\\f28d\";\n}\n.fa-stop-circle-o:before {\n  content: \"\\f28e\";\n}\n.fa-shopping-bag:before {\n  content: \"\\f290\";\n}\n.fa-shopping-basket:before {\n  content: \"\\f291\";\n}\n.fa-hashtag:before {\n  content: \"\\f292\";\n}\n.fa-bluetooth:before {\n  content: \"\\f293\";\n}\n.fa-bluetooth-b:before {\n  content: \"\\f294\";\n}\n.fa-percent:before {\n  content: \"\\f295\";\n}\n"
  },
  {
    "path": "templates/project/config.ru",
    "content": "require 'dashing'\n\nconfigure do\n  set :auth_token, 'YOUR_AUTH_TOKEN'\n\n  helpers do\n    def protected!\n      # Put any authentication code you want in here.\n      # This method is run before accessing any resource.\n    end\n  end\nend\n\nmap Sinatra::Application.assets_prefix do\n  run Sinatra::Application.sprockets\nend\n\nrun Sinatra::Application\n"
  },
  {
    "path": "templates/project/dashboards/layout.erb",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\"/>\n  <meta name=\"description\" content=\"\">\n  <meta name=\"viewport\" content=\"width=device-width\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n\n  <title><%= yield_content(:title) %></title>\n\n  <!-- The javascript and css are managed by sprockets. The files can be found in the /assets folder-->\n  <script type=\"text/javascript\" src=\"/assets/application.js\"></script>\n  <link rel=\"stylesheet\" href=\"/assets/application.css\">\n\n  <link href='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>\n  <link rel=\"icon\" href=\"/assets/favicon.ico\">\n\n</head>\n  <body>\n    <div id=\"container\">\n      <%= yield %>\n    </div>\n  \n    <% if development? %>\n      <div id=\"saving-instructions\">\n        <p>Paste the following at the top of <i><%= params[:dashboard] %>.erb</i></p>\n        <textarea id=\"gridster-code\"></textarea>\n      </div>\n      <a href=\"#saving-instructions\" id=\"save-gridster\">Save this layout</a>\n    <% end %>\n  </body>\n</html>"
  },
  {
    "path": "templates/project/dashboards/sample.erb",
    "content": "<% content_for :title do %>My super sweet dashboard<% end %>\n<div class=\"gridster\">\n  <ul>\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"2\" data-sizey=\"1\">\n      <div data-id=\"welcome\" data-view=\"Text\" data-title=\"Hello\" data-text=\"This is your shiny new dashboard.\" data-moreinfo=\"Protip: You can drag the widgets around!\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"1\">\n      <div data-id=\"synergy\" data-view=\"Meter\" data-title=\"Synergy\" data-height=\"200\" data-width=\"200\" data-min=\"0\" data-max=\"100\" data-suffix=\"%\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"2\">\n      <div data-id=\"buzzwords\" data-view=\"List\" data-unordered=\"true\" data-title=\"Buzzwords\" data-moreinfo=\"# of times said around the office\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"1\">\n      <div data-id=\"valuation\" data-view=\"Number\" data-title=\"Current Valuation\" data-moreinfo=\"In billions\" data-prefix=\"$\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"2\" data-sizey=\"1\">\n      <div data-id=\"convergence\" data-view=\"Graph\" data-title=\"Convergence\" style=\"background-color:#ff9618\"></div>\n    </li>\n  </ul>\n  <center><div style=\"font-size: 12px\">Try this: curl -d '{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"text\": \"Hey, Look what I can do!\" }' \\http://<%=request.host%>:<%=request.port%>/widgets/welcome</div></center>\n</div>\n"
  },
  {
    "path": "templates/project/dashboards/sampletv.erb",
    "content": "<script type='text/javascript'>\n$(function() {\n  // These settings override the defaults set in application.coffee. You can do this on a per dashboard basis.\n  Dashing.gridsterLayout('[{\"col\":2,\"row\":1},{\"col\":1,\"row\":1},{\"col\":3,\"row\":1},{\"col\":2,\"row\":2},{\"col\":3,\"row\":2},{\"col\":1,\"row\":2},{\"col\":5,\"row\":1},{\"col\":4,\"row\":2},{\"col\":2,\"row\":3}]')\n  Dashing.widget_base_dimensions = [370, 340]\n  Dashing.numColumns = 5\n});\n</script>\n\n\n<% content_for :title do %>1080p dashboard<% end %>\n\n<div class=\"gridster\">\n  <ul>\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"1\">\n      <div data-view=\"Clock\"></div>\n      <i class=\"fa fa-clock-o icon-background\"></i>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"1\">\n      <div data-view=\"Image\" data-image=\"/logo.png\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"2\" data-sizey=\"1\">\n      <div data-id=\"welcome\" data-view=\"Text\" data-title=\"Hello\" data-text=\"This is your shiny new 1080p dashboard.\" data-moreinfo=\"Protip: You can drag the widgets around!\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"1\">\n      <div data-id=\"synergy\" data-view=\"Meter\" data-title=\"Synergy\" data-min=\"0\" data-max=\"100\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"1\">\n      <div data-id=\"synergy\" data-view=\"Meter\" data-moreinfo=\"In sync with my neighbour!\" data-title=\"Synergy\" data-min=\"0\" data-max=\"100\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"2\">\n      <div data-id=\"buzzwords\" data-view=\"List\" data-unordered=\"true\" data-title=\"Buzzwords\" data-moreinfo=\"# of times said around the office\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"1\" data-sizey=\"1\">\n      <div data-id=\"karma\" data-view=\"Number\" data-title=\"Karma\" style=\"background-color:#96bf48;\"></div>\n      <i class=\"fa fa-heart icon-background\"></i>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"2\" data-sizey=\"2\">\n      <div data-id=\"convergence\" data-view=\"Graph\" data-title=\"Convergence\" style=\"background-color:#47bbb3;\"></div>\n    </li>\n\n    <li data-row=\"1\" data-col=\"1\" data-sizex=\"2\" data-sizey=\"1\">\n      <div data-id=\"twitter_mentions\" data-view=\"Comments\" style=\"background-color:#ff9618;\" data-moreinfo=\"Tweets tagged with #todayilearned\"></div>\n      <i class=\"fa fa-twitter icon-background\"></i>\n    </li>\n\n  </ul>\n  <center><div style=\"font-size: 12px\">Try this: curl -d '{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"text\": \"Hey, Look what I can do!\" }' \\http://<%=request.host%>:<%=request.port%>/widgets/welcome</div></center>\n</div>\n"
  },
  {
    "path": "templates/project/jobs/buzzwords.rb",
    "content": "buzzwords = ['Paradigm shift', 'Leverage', 'Pivoting', 'Turn-key', 'Streamlininess', 'Exit strategy', 'Synergy', 'Enterprise', 'Web 2.0'] \nbuzzword_counts = Hash.new({ value: 0 })\n\nSCHEDULER.every '2s' do\n  random_buzzword = buzzwords.sample\n  buzzword_counts[random_buzzword] = { label: random_buzzword, value: (buzzword_counts[random_buzzword][:value] + 1) % 30 }\n  \n  send_event('buzzwords', { items: buzzword_counts.values })\nend"
  },
  {
    "path": "templates/project/jobs/convergence.rb",
    "content": "# Populate the graph with some random points\npoints = []\n(1..10).each do |i|\n  points << { x: i, y: rand(50) }\nend\nlast_x = points.last[:x]\n\nSCHEDULER.every '2s' do\n  points.shift\n  last_x += 1\n  points << { x: last_x, y: rand(50) }\n\n  send_event('convergence', points: points)\nend"
  },
  {
    "path": "templates/project/jobs/sample.rb",
    "content": "current_valuation = 0\ncurrent_karma = 0\n\nSCHEDULER.every '2s' do\n  last_valuation = current_valuation\n  last_karma     = current_karma\n  current_valuation = rand(100)\n  current_karma     = rand(200000)\n\n  send_event('valuation', { current: current_valuation, last: last_valuation })\n  send_event('karma', { current: current_karma, last: last_karma })\n  send_event('synergy',   { value: rand(100) })\nend"
  },
  {
    "path": "templates/project/jobs/twitter.rb",
    "content": "require 'twitter'\n\n\n#### Get your twitter keys & secrets:\n#### https://dev.twitter.com/docs/auth/tokens-devtwittercom\ntwitter = Twitter::REST::Client.new do |config|\n  config.consumer_key = 'YOUR_CONSUMER_KEY'\n  config.consumer_secret = 'YOUR_CONSUMER_SECRET'\n  config.access_token = 'YOUR_OAUTH_TOKEN'\n  config.access_token_secret = 'YOUR_OAUTH_SECRET'\nend\n\nsearch_term = URI::encode('#todayilearned')\n\nSCHEDULER.every '10m', :first_in => 0 do |job|\n  begin\n    tweets = twitter.search(\"#{search_term}\")\n\n    if tweets\n      tweets = tweets.map do |tweet|\n        { name: tweet.user.name, body: tweet.text, avatar: tweet.user.profile_image_url_https }\n      end\n      send_event('twitter_mentions', comments: tweets)\n    end\n  rescue Twitter::Error\n    puts \"\\e[33mFor the twitter widget to work, you need to put in your twitter API keys in the jobs/twitter.rb file.\\e[0m\"\n  end\nend"
  },
  {
    "path": "templates/project/lib/.empty_directory",
    "content": ".empty_directory"
  },
  {
    "path": "templates/project/public/404.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>This Dashboard doesn't exist.</title>\n  <style>\n    body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }\n    div.dialog {\n      width: 25em;\n      padding: 0 4em;\n      margin: 4em auto 0 auto;\n      border: 1px solid #ccc;\n      border-right-color: #999;\n      border-bottom-color: #999;\n    }\n    h1 { font-size: 100%; color: #f00; line-height: 1.5em; }\n  </style>\n</head>\n\n<body>\n  <!-- This file lives in public/404.html -->\n  <div class=\"dialog\">\n    <h1>Drats! That Dashboard doesn't exist.</h1>\n    <p>You may have mistyped the address or the page may have moved.</p>\n  </div>\n</body>\n</html>"
  },
  {
    "path": "templates/project/widgets/clock/clock.coffee",
    "content": "class Dashing.Clock extends Dashing.Widget\n\n  ready: ->\n    setInterval(@startTime, 500)\n\n  startTime: =>\n    today = new Date()\n\n    h = today.getHours()\n    m = today.getMinutes()\n    s = today.getSeconds()\n    m = @formatTime(m)\n    s = @formatTime(s)\n    @set('time', h + \":\" + m + \":\" + s)\n    @set('date', today.toDateString())\n\n  formatTime: (i) ->\n    if i < 10 then \"0\" + i else i"
  },
  {
    "path": "templates/project/widgets/clock/clock.html",
    "content": "<h1 data-bind=\"date\"></h1>\n<h2 data-bind=\"time\"></h2>"
  },
  {
    "path": "templates/project/widgets/clock/clock.scss",
    "content": "// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color:  #dc5945;\n\n// ----------------------------------------------------------------------------\n// Widget-clock styles\n// ----------------------------------------------------------------------------\n.widget-clock {\n\n  background-color: $background-color;\n\n}\n"
  },
  {
    "path": "templates/project/widgets/comments/comments.coffee",
    "content": "class Dashing.Comments extends Dashing.Widget\n\n  @accessor 'quote', ->\n    \"“#{@get('current_comment')?.body}”\"\n\n  ready: ->\n    @currentIndex = 0\n    @commentElem = $(@node).find('.comment-container')\n    @nextComment()\n    @startCarousel()\n\n  onData: (data) ->\n    @currentIndex = 0\n\n  startCarousel: ->\n    setInterval(@nextComment, 8000)\n\n  nextComment: =>\n    comments = @get('comments')\n    if comments\n      @commentElem.fadeOut =>\n        @currentIndex = (@currentIndex + 1) % comments.length\n        @set 'current_comment', comments[@currentIndex]\n        @commentElem.fadeIn()\n"
  },
  {
    "path": "templates/project/widgets/comments/comments.html",
    "content": "<h1 class=\"title\" data-bind=\"title\"></h1>\n<div class=\"comment-container\">\n  <h3><img data-bind-src='current_comment.avatar'/><span data-bind='current_comment.name' class=\"name\"></span></h3>\n  <p class=\"comment\" data-bind='quote'></p>\n</div>\n\n<p class=\"more-info\" data-bind=\"moreinfo\"></p>\n"
  },
  {
    "path": "templates/project/widgets/comments/comments.scss",
    "content": "// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color:  #eb9c3c;\n\n$title-color:       rgba(255, 255, 255, 0.7);\n$moreinfo-color:    rgba(255, 255, 255, 0.7);\n\n// ----------------------------------------------------------------------------\n// Widget-comment styles\n// ----------------------------------------------------------------------------\n.widget-comments {\n\n  background-color: $background-color;\n\n  .title {\n    color: $title-color;\n    margin-bottom: 15px;\n  }\n\n  .name {\n    padding-left: 5px;\n  }\n\n  .comment-container {\n    display: none;\n  }\n\n  .more-info {\n    color: $moreinfo-color;\n  }\n\n}\n"
  },
  {
    "path": "templates/project/widgets/graph/graph.coffee",
    "content": "class Dashing.Graph extends Dashing.Widget\n\n  @accessor 'current', ->\n    return @get('displayedValue') if @get('displayedValue')\n    points = @get('points')\n    if points\n      points[points.length - 1].y\n\n  ready: ->\n    container = $(@node).parent()\n    # Gross hacks. Let's fix this.\n    width = (Dashing.widget_base_dimensions[0] * container.data(\"sizex\")) + Dashing.widget_margins[0] * 2 * (container.data(\"sizex\") - 1)\n    height = (Dashing.widget_base_dimensions[1] * container.data(\"sizey\"))\n    @graph = new Rickshaw.Graph(\n      element: @node\n      width: width\n      height: height\n      renderer: @get(\"graphtype\")\n      series: [\n        {\n        color: \"#fff\",\n        data: [{x:0, y:0}]\n        }\n      ]\n      padding: {top: 0.02, left: 0.02, right: 0.02, bottom: 0.02}\n    )\n\n    @graph.series[0].data = @get('points') if @get('points')\n\n    x_axis = new Rickshaw.Graph.Axis.Time(graph: @graph)\n    y_axis = new Rickshaw.Graph.Axis.Y(graph: @graph, tickFormat: Rickshaw.Fixtures.Number.formatKMBT)\n    @graph.render()\n\n  onData: (data) ->\n    if @graph\n      @graph.series[0].data = data.points\n      @graph.render()\n"
  },
  {
    "path": "templates/project/widgets/graph/graph.html",
    "content": "<h1 class=\"title\" data-bind=\"title\"></h1>\n\n<h2 class=\"value\" data-bind=\"current | prettyNumber | prepend prefix | append suffix\"></h2>\n\n<p class=\"more-info\" data-bind=\"moreinfo\"></p>\n"
  },
  {
    "path": "templates/project/widgets/graph/graph.scss",
    "content": "// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color:  #dc5945;\n\n$title-color:       rgba(255, 255, 255, 0.7);\n$moreinfo-color:    rgba(255, 255, 255, 0.3);\n$tick-color:        rgba(0, 0, 0, 0.4);\n\n\n// ----------------------------------------------------------------------------\n// Widget-graph styles\n// ----------------------------------------------------------------------------\n.widget-graph {\n\n  background-color: $background-color;\n  position: relative;\n\n\n  svg {\n    position: absolute;\n    opacity: 0.4;\n    fill-opacity: 0.4;\n    left: 0px;\n    top: 0px;\n  }\n\n  .title, .value {\n    position: relative;\n    z-index: 99;\n  }\n\n  .title {\n    color: $title-color;\n  }\n\n  .more-info {\n    color: $moreinfo-color;\n    font-weight: 600;\n    font-size: 20px;\n    margin-top: 0;\n  }\n\n  .x_tick {\n    position: absolute;\n    bottom: 0;\n    .title {\n      font-size: 20px;\n      color: $tick-color;\n      opacity: 0.5;\n      padding-bottom: 3px;\n    }\n  }\n\n  .y_ticks {\n    font-size: 20px;\n    fill: $tick-color;\n    fill-opacity: 1;\n  }\n\n  .domain {\n    display: none;\n  }\n\n}\n"
  },
  {
    "path": "templates/project/widgets/iframe/iframe.coffee",
    "content": "class Dashing.Iframe extends Dashing.Widget\n\n  ready: ->\n    # This is fired when the widget is done being rendered\n\n  onData: (data) ->\n    # Handle incoming data\n    # You can access the html node of this widget with `@node`\n    # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in.\n"
  },
  {
    "path": "templates/project/widgets/iframe/iframe.html",
    "content": "<iframe data-bind-src=\"url\" frameborder=0></iframe>\n"
  },
  {
    "path": "templates/project/widgets/iframe/iframe.scss",
    "content": ".widget-iframe {\n  padding: 3px 0px 0px 0px !important;\n\n  iframe {\n    width: 100%;\n    height: 100%;\n  }\n}\n"
  },
  {
    "path": "templates/project/widgets/image/image.coffee",
    "content": "class Dashing.Image extends Dashing.Widget\n\n  ready: ->\n    # This is fired when the widget is done being rendered\n\n  onData: (data) ->\n    # Handle incoming data\n    # You can access the html node of this widget with `@node`\n    # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in.\n"
  },
  {
    "path": "templates/project/widgets/image/image.html",
    "content": "<img data-bind-src=\"image | prepend '/assets'\" data-bind-width=\"width\"/>\n"
  },
  {
    "path": "templates/project/widgets/image/image.scss",
    "content": "// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color:  #4b4b4b;\n\n// ----------------------------------------------------------------------------\n// Widget-image styles\n// ----------------------------------------------------------------------------\n.widget-image {\n\n  background-color: $background-color;\n\n}\n"
  },
  {
    "path": "templates/project/widgets/list/list.coffee",
    "content": "class Dashing.List extends Dashing.Widget\n  ready: ->\n    if @get('unordered')\n      $(@node).find('ol').remove()\n    else\n      $(@node).find('ul').remove()\n"
  },
  {
    "path": "templates/project/widgets/list/list.html",
    "content": "<h1 class=\"title\" data-bind=\"title\"></h1>\n\n<ol>\n  <li data-foreach-item=\"items\">\n    <span class=\"label\" data-bind=\"item.label\"></span>\n    <span class=\"value\" data-bind=\"item.value\"></span>\n  </li>\n</ol>\n\n<ul class=\"list-nostyle\">\n  <li data-foreach-item=\"items\">\n    <span class=\"label\" data-bind=\"item.label\"></span>\n    <span class=\"value\" data-bind=\"item.value\"></span>\n  </li>\n</ul>\n\n<p class=\"more-info\" data-bind=\"moreinfo\"></p>\n<p class=\"updated-at\" data-bind=\"updatedAtMessage\"></p>\n"
  },
  {
    "path": "templates/project/widgets/list/list.scss",
    "content": "// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color:  #12b0c5;\n$value-color:       #fff;\n\n$title-color:       rgba(255, 255, 255, 0.7);\n$label-color:       rgba(255, 255, 255, 0.7);\n$moreinfo-color:    rgba(255, 255, 255, 0.7);\n\n// ----------------------------------------------------------------------------\n// Widget-list styles\n// ----------------------------------------------------------------------------\n.widget-list {\n\n  background-color: $background-color;\n  vertical-align: top;\n\n  .title {\n    color: $title-color;\n  }\n\n  ol, ul {\n    margin: 0 15px;\n    text-align: left;\n    color: $label-color;\n  }\n\n  ol {\n    list-style-position: inside;\n  }\n\n  li {\n    margin-bottom: 5px;\n  }\n\n  .list-nostyle {\n    list-style: none;\n  }\n\n  .label {\n    color: $label-color;\n  }\n\n  .value {\n    float: right;\n    margin-left: 12px;\n    font-weight: 600;\n    color: $value-color;\n  }\n\n  .updated-at {\n    color: rgba(0, 0, 0, 0.3);\n  }\n\n  .more-info {\n    color: $moreinfo-color;\n  }\n\n}\n"
  },
  {
    "path": "templates/project/widgets/meter/meter.coffee",
    "content": "class Dashing.Meter extends Dashing.Widget\n\n  @accessor 'value', Dashing.AnimatedValue\n\n  constructor: ->\n    super\n    @observe 'value', (value) ->\n      $(@node).find(\".meter\").val(value).trigger('change')\n\n  ready: ->\n    meter = $(@node).find(\".meter\")\n    meter.attr(\"data-bgcolor\", meter.css(\"background-color\"))\n    meter.attr(\"data-fgcolor\", meter.css(\"color\"))\n    meter.knob()\n"
  },
  {
    "path": "templates/project/widgets/meter/meter.html",
    "content": "<h1 class=\"title\" data-bind=\"title\"></h1>\n\n<input class=\"meter\" data-angleOffset=-125 data-angleArc=250 data-bind-data-height=\"height | default 200\" data-bind-data-width=\"width | default 200\" data-readOnly=true data-bind-value=\"value | shortenedNumber | prepend prefix | append suffix\" data-bind-data-min=\"min\" data-bind-data-max=\"max\">\n\n<p class=\"more-info\" data-bind=\"moreinfo\"></p>\n\n<p class=\"updated-at\" data-bind=\"updatedAtMessage\"></p>\n"
  },
  {
    "path": "templates/project/widgets/meter/meter.scss",
    "content": "// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color:  #9c4274;\n\n$title-color:       rgba(255, 255, 255, 0.7);\n$moreinfo-color:    rgba(255, 255, 255, 0.3);\n\n$meter-background:  darken($background-color, 15%);\n\n// ----------------------------------------------------------------------------\n// Widget-meter styles\n// ----------------------------------------------------------------------------\n.widget-meter {\n\n  background-color: $background-color;\n\n  input.meter {\n    background-color: $meter-background;\n    color: #fff;\n  }\n\n  .title {\n    color: $title-color;\n  }\n\n  .more-info {\n    color: $moreinfo-color;\n  }\n\n  .updated-at {\n    color: rgba(0, 0, 0, 0.3);\n  }\n\n}\n"
  },
  {
    "path": "templates/project/widgets/number/number.coffee",
    "content": "class Dashing.Number extends Dashing.Widget\n  @accessor 'current', Dashing.AnimatedValue\n\n  @accessor 'difference', ->\n    if @get('last')\n      last = parseInt(@get('last'))\n      current = parseInt(@get('current'))\n      if last != 0\n        diff = Math.abs(Math.round((current - last) / last * 100))\n        \"#{diff}%\"\n    else\n      \"\"\n\n  @accessor 'arrow', ->\n    if @get('last')\n      if parseInt(@get('current')) > parseInt(@get('last')) then 'fa fa-arrow-up' else 'fa fa-arrow-down'\n\n  onData: (data) ->\n    if data.status\n      # clear existing \"status-*\" classes\n      $(@get('node')).attr 'class', (i,c) ->\n        c.replace /\\bstatus-\\S+/g, ''\n      # add new class\n      $(@get('node')).addClass \"status-#{data.status}\"\n"
  },
  {
    "path": "templates/project/widgets/number/number.html",
    "content": "<h1 class=\"title\" data-bind=\"title\"></h1>\n\n<h2 class=\"value\" data-bind=\"current | shortenedNumber | prepend prefix | append suffix\"></h2>\n\n<p class=\"change-rate\">\n  <i data-bind-class=\"arrow\"></i><span data-bind=\"difference\"></span>\n</p>\n\n<p class=\"more-info\" data-bind=\"moreinfo\"></p>\n\n<p class=\"updated-at\" data-bind=\"updatedAtMessage\"></p>\n"
  },
  {
    "path": "templates/project/widgets/number/number.scss",
    "content": "// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color:  #47bbb3;\n$value-color:       #fff;\n\n$title-color:       rgba(255, 255, 255, 0.7);\n$moreinfo-color:    rgba(255, 255, 255, 0.7);\n\n// ----------------------------------------------------------------------------\n// Widget-number styles\n// ----------------------------------------------------------------------------\n.widget-number {\n\n  background-color: $background-color;\n\n  .title {\n    color: $title-color;\n  }\n\n  .value {\n    color: $value-color;\n  }\n\n  .change-rate {\n    font-weight: 500;\n    font-size: 30px;\n    color: $value-color;\n  }\n\n  .more-info {\n    color: $moreinfo-color;\n  }\n\n  .updated-at {\n    color: rgba(0, 0, 0, 0.3);\n  }\n\n}\n"
  },
  {
    "path": "templates/project/widgets/text/text.coffee",
    "content": "class Dashing.Text extends Dashing.Widget\n"
  },
  {
    "path": "templates/project/widgets/text/text.html",
    "content": "<h1 class=\"title\" data-bind=\"title\"></h1>\n\n<h3 data-bind=\"text\"></h3>\n\n<p class=\"more-info\" data-bind=\"moreinfo\"></p>\n\n<p class=\"updated-at\" data-bind=\"updatedAtMessage\"></p>\n"
  },
  {
    "path": "templates/project/widgets/text/text.scss",
    "content": "// ----------------------------------------------------------------------------\n// Sass declarations\n// ----------------------------------------------------------------------------\n$background-color:  #ec663c;\n\n$title-color:       rgba(255, 255, 255, 0.7);\n$moreinfo-color:    rgba(255, 255, 255, 0.7);\n\n// ----------------------------------------------------------------------------\n// Widget-text styles\n// ----------------------------------------------------------------------------\n.widget-text {\n\n  background-color: $background-color;\n\n  .title {\n    color: $title-color;\n  }\n\n  .more-info {\n    color: $moreinfo-color;\n  }\n\n  .updated-at {\n    color: rgba(255, 255, 255, 0.7);\n  }\n\n\n  &.large h3 {\n    font-size: 65px;\n  }\n}\n"
  },
  {
    "path": "templates/widget/%name%/%name%.coffee.tt",
    "content": "class Dashing.<%= Thor::Util.camel_case(name) %> extends Dashing.Widget\n\n  ready: ->\n    # This is fired when the widget is done being rendered\n\n  onData: (data) ->\n    # Handle incoming data\n    # You can access the html node of this widget with `@node`\n    # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in."
  },
  {
    "path": "templates/widget/%name%/%name%.html",
    "content": "<div data-bind=\"value\"></div>"
  },
  {
    "path": "templates/widget/%name%/%name%.scss.tt",
    "content": ".widget-<%= Dashing::CLI.hyphenate(name) %> {\n\n}"
  },
  {
    "path": "test/app_test.rb",
    "content": "require 'test_helper'\nrequire 'haml'\n\nclass AppTest < Dashing::Test\n  def setup\n    @connection = []\n    app.settings.connections = [@connection]\n    app.settings.auth_token = nil\n    app.settings.default_dashboard = nil\n    app.settings.history_file = File.join(Dir.tmpdir, 'history.yml')\n  end\n\n  def test_redirect_to_first_dashboard\n    with_generated_project do\n      get '/'\n      assert_equal 302, last_response.status\n      assert_equal 'http://example.org/sample', last_response.location\n    end\n  end\n\n  def test_redirect_to_first_dashboard_without_erb\n    with_generated_project do |dir|\n      FileUtils.touch(File.join(dir, \"dashboards/htmltest.html\"))\n      get '/'\n      assert_equal 302, last_response.status\n      assert_equal 'http://example.org/htmltest', last_response.location\n    end\n  end\n\n  def test_redirect_to_default_dashboard\n    with_generated_project do\n      app.settings.default_dashboard = 'test1'\n      get '/'\n      assert_equal 302, last_response.status\n      assert_equal 'http://example.org/test1', last_response.location\n    end\n  end\n\n  def test_errors_out_when_no_dashboards_available\n    with_generated_project do\n      app.settings.views = File.join(app.settings.root, 'lib')\n\n      get '/'\n      assert_equal 500, last_response.status\n    end\n  end\n\n  def test_post_widgets_without_auth_token\n    post '/widgets/some_widget', JSON.generate({value: 6})\n    assert_equal 204, last_response.status\n\n    assert_equal 1, @connection.length\n    data = parse_data @connection[0]\n    assert_equal 6, data['value']\n    assert_equal 'some_widget', data['id']\n    assert data['updatedAt']\n  end\n\n  def test_post_widgets_with_invalid_auth_token\n    app.settings.auth_token = 'sekrit'\n    post '/widgets/some_widget', JSON.generate({value: 9})\n    assert_equal 401, last_response.status\n  end\n\n  def test_post_widgets_with_valid_auth_token\n    app.settings.auth_token = 'sekrit'\n    post '/widgets/some_widget', JSON.generate({value: 9, auth_token: 'sekrit'})\n    assert_equal 204, last_response.status\n  end\n\n  def test_get_events\n    post '/widgets/some_widget', JSON.generate({value: 8})\n    assert_equal 204, last_response.status\n\n    get '/events'\n    assert_equal 200, last_response.status\n    assert_equal 8, parse_data(@connection[0])['value']\n  end\n\n  def test_dashboard_events\n    post '/dashboards/my_super_sweet_dashboard', JSON.generate({event: 'reload'})\n    assert_equal 204, last_response.status\n\n    get '/events'\n    assert_equal 200, last_response.status\n    assert_equal 'dashboards', parse_event(@connection[0])\n    assert_equal 'reload', parse_data(@connection[0])['event']\n  end\n\n  def test_get_dashboard\n    with_generated_project do\n      get '/sampletv'\n      assert_equal 200, last_response.status\n      assert_includes last_response.body, 'class=\"gridster\"'\n      assert_includes last_response.body, \"DOCTYPE\"\n    end\n  end\n\n  def test_page_title_set_correctly\n    with_generated_project do\n      get '/sampletv'\n      assert_includes last_response.body, '<title>1080p dashboard</title>'\n    end\n  end\n\n  def test_get_haml_dashboard\n    with_generated_project do |dir|\n      File.write(File.join(dir, 'dashboards/hamltest.haml'), '.gridster')\n      get '/hamltest'\n      assert_equal 200, last_response.status\n      assert_includes last_response.body, \"class='gridster'\"\n    end\n  end\n\n  def test_get_haml_widget\n    with_generated_project do |dir|\n      File.write(File.join(dir, 'widgets/clock/clock.haml'), '%h1 haml')\n      File.unlink(File.join(dir, 'widgets/clock/clock.html'))\n      get '/views/clock.html'\n      assert_equal 200, last_response.status\n      assert_includes last_response.body, '<h1>haml</h1>'\n    end\n  end\n\n  def test_get_nonexistent_dashboard\n    with_generated_project do\n      get '/nodashboard'\n      assert_equal 404, last_response.status\n    end\n  end\n\n  def test_get_widget\n    with_generated_project do\n      get '/views/meter.html'\n      assert_equal 200, last_response.status\n      assert_includes last_response.body, 'class=\"meter\"'\n    end\n  end\n\n  def with_generated_project\n    source_path = File.expand_path('../../templates', __FILE__)\n\n    temp do |dir|\n      cli = Dashing::CLI.new\n      cli.stubs(:source_paths).returns([source_path])\n      silent { cli.new 'new_project' }\n\n      app.settings.public_folder = File.join(dir, 'new_project/public')\n      app.settings.views = File.join(dir, 'new_project/dashboards')\n      app.settings.root = File.join(dir, 'new_project')\n      yield app.settings.root\n    end\n  end\n\n  def app\n    Sinatra::Application\n  end\n\n  def parse_data(string)\n    JSON.parse string[/data: (.+)/, 1]\n  end\n\n  def parse_event(string)\n    string[/event: (.+)/, 1]\n  end\nend\n"
  },
  {
    "path": "test/cli_test.rb",
    "content": "require 'test_helper'\n\nclass CLITest < Dashing::Test\n  def setup\n    @cli = Dashing::CLI.new\n  end\n\n  def test_new_task_creates_project_directory\n    app_name = 'custom_dashboard'\n    @cli.stubs(:directory).with(:project, app_name).once\n    @cli.new(app_name)\n  end\n\n  def test_generate_task_delegates_to_type\n    types = %w(widget dashboard job)\n\n    types.each do |type|\n      @cli.stubs(:public_send).with(\"generate_#{type}\".to_sym, 'name').once\n      @cli.generate(type, 'name')\n    end\n  end\n\n  def test_generate_task_warns_when_generator_is_not_defined\n    output, _ = capture_io do\n      @cli.generate('wtf', 'name')\n    end\n\n    assert_includes output, 'Invalid generator'\n  end\n\n  def test_generate_widget_creates_a_new_widget\n    @cli.stubs(:directory).with(:widget, 'widgets').once\n    @cli.generate_widget('WidgetName')\n    assert_equal 'widget_name', @cli.name\n  end\n\n  def test_generate_dashboard_creates_a_new_dashboard\n    @cli.stubs(:directory).with(:dashboard, 'dashboards').once\n    @cli.generate_dashboard('DashBoardName')\n    assert_equal 'dash_board_name', @cli.name\n  end\n\n  def test_generate_job_creates_a_new_job\n    @cli.stubs(:directory).with(:job, 'jobs').once\n    @cli.generate_job('MyCustomJob')\n    assert_equal 'my_custom_job', @cli.name\n  end\n\n  def test_install_task_requests_gist_from_downloader\n    return_value = { 'files' => [] }\n    Dashing::Downloader.stubs(:get_gist).with(123).returns(return_value).once\n\n    capture_io { @cli.install(123) }\n  end\n\n  def test_install_task_calls_create_file_for_each_valid_file_in_gist\n    json_response = <<-JSON\n      {\n        \"files\": {\n          \"ruby_job.rb\": { \"content\": \"some job content\" },\n          \"num.html\": { \"content\": \"some html content\" },\n          \"num.scss\": { \"content\": \"some sass content\" },\n          \"num.coffee\": { \"content\": \"some coffee content\" }\n        }\n      }\n    JSON\n\n    Dir.stubs(:pwd).returns('')\n\n    Dashing::Downloader.stubs(:get_gist).returns(JSON.parse(json_response))\n    @cli.stubs(:create_file).with('/jobs/ruby_job.rb', 'some job content', {:skip => false}).once\n    @cli.stubs(:create_file).with('/widgets/num/num.html', 'some html content', {:skip => false}).once\n    @cli.stubs(:create_file).with('/widgets/num/num.scss', 'some sass content', {:skip => false}).once\n    @cli.stubs(:create_file).with('/widgets/num/num.coffee', 'some coffee content', {:skip => false}).once\n\n    capture_io { @cli.install(123) }\n  end\n\n  def test_install_task_ignores_invalid_files\n    json_response = <<-JSON\n      {\n        \"files\": {\n          \"ruby_job.js\": { \"content\": \"some job content\" },\n          \"num.css\": { \"content\": \"some sass content\" }\n        }\n      }\n    JSON\n\n    Dashing::Downloader.stubs(:get_gist).returns(JSON.parse(json_response))\n    @cli.stubs(:create_file).never\n\n    capture_io { @cli.install(123) }\n  end\n\n  def test_install_task_warns_when_gist_not_found\n    error = OpenURI::HTTPError.new('error', mock())\n    Dashing::Downloader.stubs(:get_gist).raises(error)\n\n    output, _ = capture_io { @cli.install(123) }\n\n    assert_includes output, 'Could not find gist at '\n  end\n\n  def test_start_task_starts_thin_with_default_port\n    command = 'bundle exec thin -R config.ru start -p 3030 '\n    @cli.stubs(:run_command).with(command).once\n    @cli.start\n  end\n\n  def test_start_task_starts_thin_with_specified_port\n    command = 'bundle exec thin -R config.ru start -p 2020'\n    @cli.stubs(:run_command).with(command).once\n    @cli.start('-p', '2020')\n  end\n\n  def test_start_task_supports_job_path_option\n    commands = [\n      'export JOB_PATH=other_spot; ',\n      'bundle exec thin -R config.ru start -p 3030 '\n    ]\n\n    @cli.stubs(:options).returns(job_path: 'other_spot')\n    @cli.stubs(:run_command).with(commands.join('')).once\n    @cli.start\n  end\n\n  def test_stop_task_stops_thin_server\n    @cli.stubs(:run_command).with('bundle exec thin stop')\n    @cli.stop\n  end\n\n  def test_job_task_requires_job_file\n    Dir.stubs(:pwd).returns('')\n    @cli.stubs(:require_file).with('/jobs/special_job.rb').once\n\n    @cli.job('special_job')\n  end\n\n  def test_job_task_requires_every_ruby_file_in_lib\n    Dir.stubs(:pwd).returns('')\n    Dir.stubs(:[]).returns(['lib/dashing/cli.rb', 'lib/dashing.rb'])\n    @cli.stubs(:require_file).times(3)\n\n    @cli.job('special_job')\n  end\n\n  def test_job_sets_auth_token\n    @cli.class.stubs(:auth_token=).with('my_token').once\n    @cli.stubs(:require_file)\n\n    @cli.job('my_job', 'my_token')\n  end\n\n  def test_hyphenate_lowers_and_hyphenates_inputs\n    assertion_map = {\n      'Power' => 'power',\n      'POWER' => 'power',\n      'PowerRangers' => 'power-rangers',\n      'Power_ranger' => 'power-ranger',\n      'SuperPowerRangers' => 'super-power-rangers'\n    }\n\n    assertion_map.each do |input, expected|\n      assert_equal expected, Dashing::CLI.hyphenate(input)\n    end\n  end\n\nend\n"
  },
  {
    "path": "test/downloader_test.rb",
    "content": "require 'test_helper'\n\nclass DownloaderTest < Minitest::Test\n\n  def test_get_json_requests_and_parses_content\n    endpoint = 'http://somehost.com/file.json'\n    response = '{ \"name\": \"value\" }'\n    FakeWeb.register_uri(:get, endpoint, body: response)\n    JSON.stubs(:parse).with(response).once\n\n    Dashing::Downloader.get_json(endpoint)\n  end\n\n  def test_get_json_raises_on_bad_request\n    FakeWeb.register_uri(:get, 'http://dead-host.com/', status: '404')\n\n    assert_raises(OpenURI::HTTPError) do\n      Dashing::Downloader.get_json('http://dead-host.com/')\n    end\n  end\n\n  def test_load_gist_attempts_to_get_the_gist\n    Dashing::Downloader.stubs(:get_json).once\n    Dashing::Downloader.get_gist(123)\n  end\nend\n"
  },
  {
    "path": "test/test_helper.rb",
    "content": "require 'simplecov'\nSimpleCov.start do\n  add_filter \"/vendor/\"\n  add_filter \"/test/\"\nend\n\nrequire 'rack/test'\nrequire 'stringio'\nrequire 'tmpdir'\nrequire 'fakeweb'\nrequire 'minitest/autorun'\nrequire 'minitest/pride'\nrequire 'mocha/setup'\n\nrequire_relative '../lib/dashing'\n\nFakeWeb.allow_net_connect = false\n\nENV['RACK_ENV'] = 'test'\nWORKING_DIRECTORY = Dir.pwd.freeze\nARGV.clear\n\ndef load_quietly(file)\n  Minitest::Test.new(nil).capture_io do\n    load file\n  end\nend\n\ndef temp\n  path = File.expand_path \"#{Dir.tmpdir}/#{Time.now.to_i}#{rand(1000)}/\"\n  FileUtils.mkdir_p path\n  Dir.chdir path\n  yield path\nensure\n  Dir.chdir WORKING_DIRECTORY\n  FileUtils.rm_rf(path) if File.exists?(path)\nend\n\nmodule Dashing\n  class Test < Minitest::Test\n    include Rack::Test::Methods\n\n    alias_method :silent, :capture_io\n\n    def teardown\n      FileUtils.rm_f('history.yml')\n    end\n  end\nend\n"
  }
]