/*! * @overview Ember - JavaScript Application Framework * @copyright Copyright 2011-2014 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE * @version 1.6.0-beta.4 */ var define, requireModule, require, requirejs, Ember; (function() { Ember = this.Ember = this.Ember || {}; if (typeof Ember === 'undefined') { Ember = {} }; if (typeof Ember.__loader === 'undefined') { var registry = {}, seen = {}; define = function(name, deps, callback) { registry[name] = { deps: deps, callback: callback }; }; requirejs = require = requireModule = function(name) { if (seen.hasOwnProperty(name)) { return seen[name]; } seen[name] = {}; if (!registry[name]) { throw new Error("Could not find module " + name); } var mod = registry[name], deps = mod.deps, callback = mod.callback, reified = [], exports; for (var i=0, l=deps.length; i true\n\n container.unregister('model:user')\n container.lookup('model:user') === undefined //=> true\n ```\n\n @method unregister\n @param {String} fullName\n */\n unregister: function(fullName) {\n validateFullName(fullName);\n\n var normalizedName = this.normalize(fullName);\n\n this.registry.remove(normalizedName);\n this.cache.remove(normalizedName);\n this.factoryCache.remove(normalizedName);\n this.resolveCache.remove(normalizedName);\n this._options.remove(normalizedName);\n },\n\n /**\n Given a fullName return the corresponding factory.\n\n By default `resolve` will retrieve the factory from\n its container's registry.\n\n ```javascript\n var container = new Container();\n container.register('api:twitter', Twitter);\n\n container.resolve('api:twitter') // => Twitter\n ```\n\n Optionally the container can be provided with a custom resolver.\n If provided, `resolve` will first provide the custom resolver\n the oppertunity to resolve the fullName, otherwise it will fallback\n to the registry.\n\n ```javascript\n var container = new Container();\n container.resolver = function(fullName) {\n // lookup via the module system of choice\n };\n\n // the twitter factory is added to the module system\n container.resolve('api:twitter') // => Twitter\n ```\n\n @method resolve\n @param {String} fullName\n @return {Function} fullName's factory\n */\n resolve: function(fullName) {\n validateFullName(fullName);\n\n var normalizedName = this.normalize(fullName);\n var cached = this.resolveCache.get(normalizedName);\n\n if (cached) { return cached; }\n\n var resolved = this.resolver(normalizedName) || this.registry.get(normalizedName);\n\n this.resolveCache.set(normalizedName, resolved);\n\n return resolved;\n },\n\n /**\n A hook that can be used to describe how the resolver will\n attempt to find the factory.\n\n For example, the default Ember `.describe` returns the full\n class name (including namespace) where Ember's resolver expects\n to find the `fullName`.\n\n @method describe\n @param {String} fullName\n @return {string} described fullName\n */\n describe: function(fullName) {\n return fullName;\n },\n\n /**\n A hook to enable custom fullName normalization behaviour\n\n @method normalize\n @param {String} fullName\n @return {string} normalized fullName\n */\n normalize: function(fullName) {\n return fullName;\n },\n\n /**\n @method makeToString\n\n @param {any} factory\n @param {string} fullName\n @return {function} toString function\n */\n makeToString: function(factory, fullName) {\n return factory.toString();\n },\n\n /**\n Given a fullName return a corresponding instance.\n\n The default behaviour is for lookup to return a singleton instance.\n The singleton is scoped to the container, allowing multiple containers\n to all have their own locally scoped singletons.\n\n ```javascript\n var container = new Container();\n container.register('api:twitter', Twitter);\n\n var twitter = container.lookup('api:twitter');\n\n twitter instanceof Twitter; // => true\n\n // by default the container will return singletons\n var twitter2 = container.lookup('api:twitter');\n twitter instanceof Twitter; // => true\n\n twitter === twitter2; //=> true\n ```\n\n If singletons are not wanted an optional flag can be provided at lookup.\n\n ```javascript\n var container = new Container();\n container.register('api:twitter', Twitter);\n\n var twitter = container.lookup('api:twitter', { singleton: false });\n var twitter2 = container.lookup('api:twitter', { singleton: false });\n\n twitter === twitter2; //=> false\n ```\n\n @method lookup\n @param {String} fullName\n @param {Object} options\n @return {any}\n */\n lookup: function(fullName, options) {\n validateFullName(fullName);\n return lookup(this, this.normalize(fullName), options);\n },\n\n /**\n Given a fullName return the corresponding factory.\n\n @method lookupFactory\n @param {String} fullName\n @return {any}\n */\n lookupFactory: function(fullName) {\n validateFullName(fullName);\n return factoryFor(this, this.normalize(fullName));\n },\n\n /**\n Given a fullName check if the container is aware of its factory\n or singleton instance.\n\n @method has\n @param {String} fullName\n @return {Boolean}\n */\n has: function(fullName) {\n validateFullName(fullName);\n return has(this, this.normalize(fullName));\n },\n\n /**\n Allow registering options for all factories of a type.\n\n ```javascript\n var container = new Container();\n\n // if all of type `connection` must not be singletons\n container.optionsForType('connection', { singleton: false });\n\n container.register('connection:twitter', TwitterConnection);\n container.register('connection:facebook', FacebookConnection);\n\n var twitter = container.lookup('connection:twitter');\n var twitter2 = container.lookup('connection:twitter');\n\n twitter === twitter2; // => false\n\n var facebook = container.lookup('connection:facebook');\n var facebook2 = container.lookup('connection:facebook');\n\n facebook === facebook2; // => false\n ```\n\n @method optionsForType\n @param {String} type\n @param {Object} options\n */\n optionsForType: function(type, options) {\n if (this.parent) { illegalChildOperation('optionsForType'); }\n\n this._typeOptions.set(type, options);\n },\n\n /**\n @method options\n @param {String} type\n @param {Object} options\n */\n options: function(type, options) {\n this.optionsForType(type, options);\n },\n\n /**\n Used only via `injection`.\n\n Provides a specialized form of injection, specifically enabling\n all objects of one type to be injected with a reference to another\n object.\n\n For example, provided each object of type `controller` needed a `router`.\n one would do the following:\n\n ```javascript\n var container = new Container();\n\n container.register('router:main', Router);\n container.register('controller:user', UserController);\n container.register('controller:post', PostController);\n\n container.typeInjection('controller', 'router', 'router:main');\n\n var user = container.lookup('controller:user');\n var post = container.lookup('controller:post');\n\n user.router instanceof Router; //=> true\n post.router instanceof Router; //=> true\n\n // both controllers share the same router\n user.router === post.router; //=> true\n ```\n\n @private\n @method typeInjection\n @param {String} type\n @param {String} property\n @param {String} fullName\n */\n typeInjection: function(type, property, fullName) {\n validateFullName(fullName);\n if (this.parent) { illegalChildOperation('typeInjection'); }\n\n var fullNameType = fullName.split(':')[0];\n if(fullNameType === type) {\n throw new Error('Cannot inject a `' + fullName + '` on other ' + type + '(s). Register the `' + fullName + '` as a different type and perform the typeInjection.');\n }\n addTypeInjection(this.typeInjections, type, property, fullName);\n },\n\n /**\n Defines injection rules.\n\n These rules are used to inject dependencies onto objects when they\n are instantiated.\n\n Two forms of injections are possible:\n\n * Injecting one fullName on another fullName\n * Injecting one fullName on a type\n\n Example:\n\n ```javascript\n var container = new Container();\n\n container.register('source:main', Source);\n container.register('model:user', User);\n container.register('model:post', Post);\n\n // injecting one fullName on another fullName\n // eg. each user model gets a post model\n container.injection('model:user', 'post', 'model:post');\n\n // injecting one fullName on another type\n container.injection('model', 'source', 'source:main');\n\n var user = container.lookup('model:user');\n var post = container.lookup('model:post');\n\n user.source instanceof Source; //=> true\n post.source instanceof Source; //=> true\n\n user.post instanceof Post; //=> true\n\n // and both models share the same source\n user.source === post.source; //=> true\n ```\n\n @method injection\n @param {String} factoryName\n @param {String} property\n @param {String} injectionName\n */\n injection: function(fullName, property, injectionName) {\n if (this.parent) { illegalChildOperation('injection'); }\n\n validateFullName(injectionName);\n var normalizedInjectionName = this.normalize(injectionName);\n\n if (fullName.indexOf(':') === -1) {\n return this.typeInjection(fullName, property, normalizedInjectionName);\n }\n\n validateFullName(fullName);\n var normalizedName = this.normalize(fullName);\n\n addInjection(this.injections, normalizedName, property, normalizedInjectionName);\n },\n\n\n /**\n Used only via `factoryInjection`.\n\n Provides a specialized form of injection, specifically enabling\n all factory of one type to be injected with a reference to another\n object.\n\n For example, provided each factory of type `model` needed a `store`.\n one would do the following:\n\n ```javascript\n var container = new Container();\n\n container.register('store:main', SomeStore);\n\n container.factoryTypeInjection('model', 'store', 'store:main');\n\n var store = container.lookup('store:main');\n var UserFactory = container.lookupFactory('model:user');\n\n UserFactory.store instanceof SomeStore; //=> true\n ```\n\n @private\n @method factoryTypeInjection\n @param {String} type\n @param {String} property\n @param {String} fullName\n */\n factoryTypeInjection: function(type, property, fullName) {\n if (this.parent) { illegalChildOperation('factoryTypeInjection'); }\n\n addTypeInjection(this.factoryTypeInjections, type, property, this.normalize(fullName));\n },\n\n /**\n Defines factory injection rules.\n\n Similar to regular injection rules, but are run against factories, via\n `Container#lookupFactory`.\n\n These rules are used to inject objects onto factories when they\n are looked up.\n\n Two forms of injections are possible:\n\n * Injecting one fullName on another fullName\n * Injecting one fullName on a type\n\n Example:\n\n ```javascript\n var container = new Container();\n\n container.register('store:main', Store);\n container.register('store:secondary', OtherStore);\n container.register('model:user', User);\n container.register('model:post', Post);\n\n // injecting one fullName on another type\n container.factoryInjection('model', 'store', 'store:main');\n\n // injecting one fullName on another fullName\n container.factoryInjection('model:post', 'secondaryStore', 'store:secondary');\n\n var UserFactory = container.lookupFactory('model:user');\n var PostFactory = container.lookupFactory('model:post');\n var store = container.lookup('store:main');\n\n UserFactory.store instanceof Store; //=> true\n UserFactory.secondaryStore instanceof OtherStore; //=> false\n\n PostFactory.store instanceof Store; //=> true\n PostFactory.secondaryStore instanceof OtherStore; //=> true\n\n // and both models share the same source instance\n UserFactory.store === PostFactory.store; //=> true\n ```\n\n @method factoryInjection\n @param {String} factoryName\n @param {String} property\n @param {String} injectionName\n */\n factoryInjection: function(fullName, property, injectionName) {\n if (this.parent) { illegalChildOperation('injection'); }\n\n var normalizedName = this.normalize(fullName);\n var normalizedInjectionName = this.normalize(injectionName);\n\n validateFullName(injectionName);\n\n if (fullName.indexOf(':') === -1) {\n return this.factoryTypeInjection(normalizedName, property, normalizedInjectionName);\n }\n\n validateFullName(fullName);\n\n addInjection(this.factoryInjections, normalizedName, property, normalizedInjectionName);\n },\n\n /**\n A depth first traversal, destroying the container, its descendant containers and all\n their managed objects.\n\n @method destroy\n */\n destroy: function() {\n for (var i=0, l=this.children.length; i 1 ? 'they' : 'it') + \" could not be found\");\n }\n }\n\n var defaultControllersComputedProperty = computed(function() {\n var controller = this;\n\n return {\n needs: get(controller, 'needs'),\n container: get(controller, 'container'),\n unknownProperty: function(controllerName) {\n var needs = this.needs,\n dependency, i, l;\n for (i=0, l=needs.length; i 0) {\n Ember.assert(' `' + inspect(this) + ' specifies `needs`, but does ' +\n \"not have a container. Please ensure this controller was \" +\n \"instantiated with a container.\",\n this.container || meta(this, false).descs.controllers !== defaultControllersComputedProperty);\n\n if (this.container) {\n verifyNeedsDependencies(this, this.container, needs);\n }\n\n // if needs then initialize controllers proxy\n get(this, 'controllers');\n }\n\n this._super.apply(this, arguments);\n },\n\n /**\n @method controllerFor\n @see {Ember.Route#controllerFor}\n @deprecated Use `needs` instead\n */\n controllerFor: function(controllerName) {\n Ember.deprecate(\"Controller#controllerFor is deprecated, please use Controller#needs instead\");\n return controllerFor(get(this, 'container'), controllerName);\n },\n\n /**\n Stores the instances of other controllers available from within\n this controller. Any controller listed by name in the `needs`\n property will be accessible by name through this property.\n\n ```javascript\n App.CommentsController = Ember.ArrayController.extend({\n needs: ['post'],\n postTitle: function(){\n var currentPost = this.get('controllers.post'); // instance of App.PostController\n return currentPost.get('title');\n }.property('controllers.post.title')\n });\n ```\n\n @see {Ember.ControllerMixin#needs}\n @property {Object} controllers\n @default null\n */\n controllers: defaultControllersComputedProperty\n });\n\n __exports__[\"default\"] = ControllerMixin;\n });\ndefine(\"ember-application\",\n [\"ember-metal/core\",\"ember-runtime/system/lazy_load\",\"ember-application/system/dag\",\"ember-application/system/resolver\",\"ember-application/system/application\",\"ember-application/ext/controller\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__) {\n \"use strict\";\n var Ember = __dependency1__[\"default\"];\n var runLoadHooks = __dependency2__.runLoadHooks;\n\n /**\n Ember Application\n\n @module ember\n @submodule ember-application\n @requires ember-views, ember-routing\n */\n\n var DAG = __dependency3__[\"default\"];var Resolver = __dependency4__.Resolver;\n var DefaultResolver = __dependency4__.DefaultResolver;\n var Application = __dependency5__[\"default\"];\n // side effect of extending ControllerMixin\n\n Ember.Application = Application;\n Ember.DAG = DAG;\n Ember.Resolver = Resolver;\n Ember.DefaultResolver = DefaultResolver;\n\n runLoadHooks('Ember.Application', Application);\n });\ndefine(\"ember-application/system/application\",\n [\"ember-metal\",\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-runtime/system/lazy_load\",\"ember-application/system/dag\",\"ember-runtime/system/namespace\",\"ember-runtime/mixins/deferred\",\"ember-application/system/resolver\",\"ember-metal/platform\",\"ember-metal/run_loop\",\"ember-metal/utils\",\"container/container\",\"ember-runtime/controllers/controller\",\"ember-metal/enumerable_utils\",\"ember-runtime/controllers/object_controller\",\"ember-runtime/controllers/array_controller\",\"ember-views/system/event_dispatcher\",\"ember-extension-support/container_debug_adapter\",\"ember-views/system/jquery\",\"ember-routing/system/route\",\"ember-routing/system/router\",\"ember-routing/location/hash_location\",\"ember-routing/location/history_location\",\"ember-routing/location/auto_location\",\"ember-routing/location/none_location\",\"ember-handlebars-compiler\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __dependency22__, __dependency23__, __dependency24__, __dependency25__, __dependency26__, __exports__) {\n \"use strict\";\n /**\n @module ember\n @submodule ember-application\n */\n\n var Ember = __dependency1__[\"default\"];\n // Ember.FEATURES, Ember.deprecate, Ember.assert, Ember.libraries, LOG_VERSION, Namespace, BOOTED\n var get = __dependency2__.get;\n var set = __dependency3__.set;\n var runLoadHooks = __dependency4__.runLoadHooks;\n var DAG = __dependency5__[\"default\"];var Namespace = __dependency6__[\"default\"];\n var DeferredMixin = __dependency7__[\"default\"];\n var DefaultResolver = __dependency8__.DefaultResolver;\n var create = __dependency9__.create;\n var run = __dependency10__[\"default\"];\n var canInvoke = __dependency11__.canInvoke;\n var Container = __dependency12__[\"default\"];\n var Controller = __dependency13__.Controller;\n var EnumerableUtils = __dependency14__[\"default\"];\n var ObjectController = __dependency15__[\"default\"];\n var ArrayController = __dependency16__[\"default\"];\n var EventDispatcher = __dependency17__[\"default\"];\n var ContainerDebugAdapter = __dependency18__[\"default\"];\n var jQuery = __dependency19__[\"default\"];\n var Route = __dependency20__[\"default\"];\n var Router = __dependency21__[\"default\"];\n var HashLocation = __dependency22__[\"default\"];\n var HistoryLocation = __dependency23__[\"default\"];\n var AutoLocation = __dependency24__[\"default\"];\n var NoneLocation = __dependency25__[\"default\"];\n\n var EmberHandlebars = __dependency26__[\"default\"];\n\n var K = Ember.K;\n\n function DeprecatedContainer(container) {\n this._container = container;\n }\n\n DeprecatedContainer.deprecate = function(method) {\n return function() {\n var container = this._container;\n\n Ember.deprecate('Using the defaultContainer is no longer supported. [defaultContainer#' + method + '] see: http://git.io/EKPpnA', false);\n return container[method].apply(container, arguments);\n };\n };\n\n DeprecatedContainer.prototype = {\n _container: null,\n lookup: DeprecatedContainer.deprecate('lookup'),\n resolve: DeprecatedContainer.deprecate('resolve'),\n register: DeprecatedContainer.deprecate('register')\n };\n\n /**\n An instance of `Ember.Application` is the starting point for every Ember\n application. It helps to instantiate, initialize and coordinate the many\n objects that make up your app.\n\n Each Ember app has one and only one `Ember.Application` object. In fact, the\n very first thing you should do in your application is create the instance:\n\n ```javascript\n window.App = Ember.Application.create();\n ```\n\n Typically, the application object is the only global variable. All other\n classes in your app should be properties on the `Ember.Application` instance,\n which highlights its first role: a global namespace.\n\n For example, if you define a view class, it might look like this:\n\n ```javascript\n App.MyView = Ember.View.extend();\n ```\n\n By default, calling `Ember.Application.create()` will automatically initialize\n your application by calling the `Ember.Application.initialize()` method. If\n you need to delay initialization, you can call your app's `deferReadiness()`\n method. When you are ready for your app to be initialized, call its\n `advanceReadiness()` method.\n\n You can define a `ready` method on the `Ember.Application` instance, which\n will be run by Ember when the application is initialized.\n\n Because `Ember.Application` inherits from `Ember.Namespace`, any classes\n you create will have useful string representations when calling `toString()`.\n See the `Ember.Namespace` documentation for more information.\n\n While you can think of your `Ember.Application` as a container that holds the\n other classes in your application, there are several other responsibilities\n going on under-the-hood that you may want to understand.\n\n ### Event Delegation\n\n Ember uses a technique called _event delegation_. This allows the framework\n to set up a global, shared event listener instead of requiring each view to\n do it manually. For example, instead of each view registering its own\n `mousedown` listener on its associated element, Ember sets up a `mousedown`\n listener on the `body`.\n\n If a `mousedown` event occurs, Ember will look at the target of the event and\n start walking up the DOM node tree, finding corresponding views and invoking\n their `mouseDown` method as it goes.\n\n `Ember.Application` has a number of default events that it listens for, as\n well as a mapping from lowercase events to camel-cased view method names. For\n example, the `keypress` event causes the `keyPress` method on the view to be\n called, the `dblclick` event causes `doubleClick` to be called, and so on.\n\n If there is a bubbling browser event that Ember does not listen for by\n default, you can specify custom events and their corresponding view method\n names by setting the application's `customEvents` property:\n\n ```javascript\n App = Ember.Application.create({\n customEvents: {\n // add support for the paste event\n paste: \"paste\"\n }\n });\n ```\n\n By default, the application sets up these event listeners on the document\n body. However, in cases where you are embedding an Ember application inside\n an existing page, you may want it to set up the listeners on an element\n inside the body.\n\n For example, if only events inside a DOM element with the ID of `ember-app`\n should be delegated, set your application's `rootElement` property:\n\n ```javascript\n window.App = Ember.Application.create({\n rootElement: '#ember-app'\n });\n ```\n\n The `rootElement` can be either a DOM element or a jQuery-compatible selector\n string. Note that *views appended to the DOM outside the root element will\n not receive events.* If you specify a custom root element, make sure you only\n append views inside it!\n\n To learn more about the advantages of event delegation and the Ember view\n layer, and a list of the event listeners that are setup by default, visit the\n [Ember View Layer guide](http://emberjs.com/guides/understanding-ember/the-view-layer/#toc_event-delegation).\n\n ### Initializers\n\n Libraries on top of Ember can add initializers, like so:\n\n ```javascript\n Ember.Application.initializer({\n name: 'api-adapter',\n\n initialize: function(container, application) {\n application.register('api-adapter:main', ApiAdapter);\n }\n });\n ```\n\n Initializers provide an opportunity to access the container, which\n organizes the different components of an Ember application. Additionally\n they provide a chance to access the instantiated application. Beyond\n being used for libraries, initializers are also a great way to organize\n dependency injection or setup in your own application.\n\n ### Routing\n\n In addition to creating your application's router, `Ember.Application` is\n also responsible for telling the router when to start routing. Transitions\n between routes can be logged with the `LOG_TRANSITIONS` flag, and more\n detailed intra-transition logging can be logged with\n the `LOG_TRANSITIONS_INTERNAL` flag:\n\n ```javascript\n window.App = Ember.Application.create({\n LOG_TRANSITIONS: true, // basic logging of successful transitions\n LOG_TRANSITIONS_INTERNAL: true // detailed logging of all routing steps\n });\n ```\n\n By default, the router will begin trying to translate the current URL into\n application state once the browser emits the `DOMContentReady` event. If you\n need to defer routing, you can call the application's `deferReadiness()`\n method. Once routing can begin, call the `advanceReadiness()` method.\n\n If there is any setup required before routing begins, you can implement a\n `ready()` method on your app that will be invoked immediately before routing\n begins.\n ```\n\n @class Application\n @namespace Ember\n @extends Ember.Namespace\n */\n\n var Application = Namespace.extend(DeferredMixin, {\n\n /**\n The root DOM element of the Application. This can be specified as an\n element or a\n [jQuery-compatible selector string](http://api.jquery.com/category/selectors/).\n\n This is the element that will be passed to the Application's,\n `eventDispatcher`, which sets up the listeners for event delegation. Every\n view in your application should be a child of the element you specify here.\n\n @property rootElement\n @type DOMElement\n @default 'body'\n */\n rootElement: 'body',\n\n /**\n The `Ember.EventDispatcher` responsible for delegating events to this\n application's views.\n\n The event dispatcher is created by the application at initialization time\n and sets up event listeners on the DOM element described by the\n application's `rootElement` property.\n\n See the documentation for `Ember.EventDispatcher` for more information.\n\n @property eventDispatcher\n @type Ember.EventDispatcher\n @default null\n */\n eventDispatcher: null,\n\n /**\n The DOM events for which the event dispatcher should listen.\n\n By default, the application's `Ember.EventDispatcher` listens\n for a set of standard DOM events, such as `mousedown` and\n `keyup`, and delegates them to your application's `Ember.View`\n instances.\n\n If you would like additional bubbling events to be delegated to your\n views, set your `Ember.Application`'s `customEvents` property\n to a hash containing the DOM event name as the key and the\n corresponding view method name as the value. For example:\n\n ```javascript\n App = Ember.Application.create({\n customEvents: {\n // add support for the paste event\n paste: \"paste\"\n }\n });\n ```\n\n @property customEvents\n @type Object\n @default null\n */\n customEvents: null,\n\n // Start off the number of deferrals at 1. This will be\n // decremented by the Application's own `initialize` method.\n _readinessDeferrals: 1,\n\n init: function() {\n if (!this.$) { this.$ = jQuery; }\n this.__container__ = this.buildContainer();\n\n this.Router = this.defaultRouter();\n\n this._super();\n\n this.scheduleInitialize();\n\n Ember.libraries.registerCoreLibrary('Handlebars', EmberHandlebars.VERSION);\n Ember.libraries.registerCoreLibrary('jQuery', jQuery().jquery);\n\n if ( Ember.LOG_VERSION ) {\n Ember.LOG_VERSION = false; // we only need to see this once per Application#init\n\n var nameLengths = EnumerableUtils.map(Ember.libraries, function(item) {\n return get(item, \"name.length\");\n });\n\n var maxNameLength = Math.max.apply(this, nameLengths);\n\n Ember.debug('-------------------------------');\n Ember.libraries.each(function(name, version) {\n var spaces = new Array(maxNameLength - name.length + 1).join(\" \");\n Ember.debug([name, spaces, ' : ', version].join(\"\"));\n });\n Ember.debug('-------------------------------');\n }\n },\n\n /**\n Build the container for the current application.\n\n Also register a default application view in case the application\n itself does not.\n\n @private\n @method buildContainer\n @return {Ember.Container} the configured container\n */\n buildContainer: function() {\n var container = this.__container__ = Application.buildContainer(this);\n\n return container;\n },\n\n /**\n If the application has not opted out of routing and has not explicitly\n defined a router, supply a default router for the application author\n to configure.\n\n This allows application developers to do:\n\n ```javascript\n var App = Ember.Application.create();\n\n App.Router.map(function() {\n this.resource('posts');\n });\n ```\n\n @private\n @method defaultRouter\n @return {Ember.Router} the default router\n */\n\n defaultRouter: function() {\n if (this.Router === false) { return; }\n var container = this.__container__;\n\n if (this.Router) {\n container.unregister('router:main');\n container.register('router:main', this.Router);\n }\n\n return container.lookupFactory('router:main');\n },\n\n /**\n Automatically initialize the application once the DOM has\n become ready.\n\n The initialization itself is scheduled on the actions queue\n which ensures that application loading finishes before\n booting.\n\n If you are asynchronously loading code, you should call\n `deferReadiness()` to defer booting, and then call\n `advanceReadiness()` once all of your code has finished\n loading.\n\n @private\n @method scheduleInitialize\n */\n scheduleInitialize: function() {\n var self = this;\n\n if (!this.$ || this.$.isReady) {\n run.schedule('actions', self, '_initialize');\n } else {\n this.$().ready(function runInitialize() {\n run(self, '_initialize');\n });\n }\n },\n\n /**\n Use this to defer readiness until some condition is true.\n\n Example:\n\n ```javascript\n App = Ember.Application.create();\n App.deferReadiness();\n\n jQuery.getJSON(\"/auth-token\", function(token) {\n App.token = token;\n App.advanceReadiness();\n });\n ```\n\n This allows you to perform asynchronous setup logic and defer\n booting your application until the setup has finished.\n\n However, if the setup requires a loading UI, it might be better\n to use the router for this purpose.\n\n @method deferReadiness\n */\n deferReadiness: function() {\n Ember.assert(\"You must call deferReadiness on an instance of Ember.Application\", this instanceof Application);\n Ember.assert(\"You cannot defer readiness since the `ready()` hook has already been called.\", this._readinessDeferrals > 0);\n this._readinessDeferrals++;\n },\n\n /**\n Call `advanceReadiness` after any asynchronous setup logic has completed.\n Each call to `deferReadiness` must be matched by a call to `advanceReadiness`\n or the application will never become ready and routing will not begin.\n\n @method advanceReadiness\n @see {Ember.Application#deferReadiness}\n */\n advanceReadiness: function() {\n Ember.assert(\"You must call advanceReadiness on an instance of Ember.Application\", this instanceof Application);\n this._readinessDeferrals--;\n\n if (this._readinessDeferrals === 0) {\n run.once(this, this.didBecomeReady);\n }\n },\n\n /**\n Registers a factory that can be used for dependency injection (with\n `App.inject`) or for service lookup. Each factory is registered with\n a full name including two parts: `type:name`.\n\n A simple example:\n\n ```javascript\n var App = Ember.Application.create();\n App.Orange = Ember.Object.extend();\n App.register('fruit:favorite', App.Orange);\n ```\n\n Ember will resolve factories from the `App` namespace automatically.\n For example `App.CarsController` will be discovered and returned if\n an application requests `controller:cars`.\n\n An example of registering a controller with a non-standard name:\n\n ```javascript\n var App = Ember.Application.create(),\n Session = Ember.Controller.extend();\n\n App.register('controller:session', Session);\n\n // The Session controller can now be treated like a normal controller,\n // despite its non-standard name.\n App.ApplicationController = Ember.Controller.extend({\n needs: ['session']\n });\n ```\n\n Registered factories are **instantiated** by having `create`\n called on them. Additionally they are **singletons**, each time\n they are looked up they return the same instance.\n\n Some examples modifying that default behavior:\n\n ```javascript\n var App = Ember.Application.create();\n\n App.Person = Ember.Object.extend();\n App.Orange = Ember.Object.extend();\n App.Email = Ember.Object.extend();\n App.session = Ember.Object.create();\n\n App.register('model:user', App.Person, {singleton: false });\n App.register('fruit:favorite', App.Orange);\n App.register('communication:main', App.Email, {singleton: false});\n App.register('session', App.session, {instantiate: false});\n ```\n\n @method register\n @param fullName {String} type:name (e.g., 'model:user')\n @param factory {Function} (e.g., App.Person)\n @param options {Object} (optional) disable instantiation or singleton usage\n **/\n register: function() {\n var container = this.__container__;\n container.register.apply(container, arguments);\n },\n\n /**\n Define a dependency injection onto a specific factory or all factories\n of a type.\n\n When Ember instantiates a controller, view, or other framework component\n it can attach a dependency to that component. This is often used to\n provide services to a set of framework components.\n\n An example of providing a session object to all controllers:\n\n ```javascript\n var App = Ember.Application.create(),\n Session = Ember.Object.extend({ isAuthenticated: false });\n\n // A factory must be registered before it can be injected\n App.register('session:main', Session);\n\n // Inject 'session:main' onto all factories of the type 'controller'\n // with the name 'session'\n App.inject('controller', 'session', 'session:main');\n\n App.IndexController = Ember.Controller.extend({\n isLoggedIn: Ember.computed.alias('session.isAuthenticated')\n });\n ```\n\n Injections can also be performed on specific factories.\n\n ```javascript\n App.inject(, , )\n App.inject('route', 'source', 'source:main')\n App.inject('route:application', 'email', 'model:email')\n ```\n\n It is important to note that injections can only be performed on\n classes that are instantiated by Ember itself. Instantiating a class\n directly (via `create` or `new`) bypasses the dependency injection\n system.\n\n Ember-Data instantiates its models in a unique manner, and consequently\n injections onto models (or all models) will not work as expected. Injections\n on models can be enabled by setting `Ember.MODEL_FACTORY_INJECTIONS`\n to `true`.\n\n @method inject\n @param factoryNameOrType {String}\n @param property {String}\n @param injectionName {String}\n **/\n inject: function() {\n var container = this.__container__;\n container.injection.apply(container, arguments);\n },\n\n /**\n Calling initialize manually is not supported.\n\n Please see Ember.Application#advanceReadiness and\n Ember.Application#deferReadiness.\n\n @private\n @deprecated\n @method initialize\n **/\n initialize: function() {\n Ember.deprecate('Calling initialize manually is not supported. Please see Ember.Application#advanceReadiness and Ember.Application#deferReadiness');\n },\n\n /**\n Initialize the application. This happens automatically.\n\n Run any initializers and run the application load hook. These hooks may\n choose to defer readiness. For example, an authentication hook might want\n to defer readiness until the auth token has been retrieved.\n\n @private\n @method _initialize\n */\n _initialize: function() {\n if (this.isDestroyed) { return; }\n\n // At this point, the App.Router must already be assigned\n if (this.Router) {\n var container = this.__container__;\n container.unregister('router:main');\n container.register('router:main', this.Router);\n }\n\n this.runInitializers();\n runLoadHooks('application', this);\n\n // At this point, any initializers or load hooks that would have wanted\n // to defer readiness have fired. In general, advancing readiness here\n // will proceed to didBecomeReady.\n this.advanceReadiness();\n\n return this;\n },\n\n /**\n Reset the application. This is typically used only in tests. It cleans up\n the application in the following order:\n\n 1. Deactivate existing routes\n 2. Destroy all objects in the container\n 3. Create a new application container\n 4. Re-route to the existing url\n\n Typical Example:\n\n ```javascript\n\n var App;\n\n run(function() {\n App = Ember.Application.create();\n });\n\n module(\"acceptance test\", {\n setup: function() {\n App.reset();\n }\n });\n\n test(\"first test\", function() {\n // App is freshly reset\n });\n\n test(\"first test\", function() {\n // App is again freshly reset\n });\n ```\n\n Advanced Example:\n\n Occasionally you may want to prevent the app from initializing during\n setup. This could enable extra configuration, or enable asserting prior\n to the app becoming ready.\n\n ```javascript\n\n var App;\n\n run(function() {\n App = Ember.Application.create();\n });\n\n module(\"acceptance test\", {\n setup: function() {\n run(function() {\n App.reset();\n App.deferReadiness();\n });\n }\n });\n\n test(\"first test\", function() {\n ok(true, 'something before app is initialized');\n\n run(function() {\n App.advanceReadiness();\n });\n ok(true, 'something after app is initialized');\n });\n ```\n\n @method reset\n **/\n reset: function() {\n this._readinessDeferrals = 1;\n\n function handleReset() {\n var router = this.__container__.lookup('router:main');\n router.reset();\n\n run(this.__container__, 'destroy');\n\n this.buildContainer();\n\n run.schedule('actions', this, function() {\n this._initialize();\n });\n }\n\n run.join(this, handleReset);\n },\n\n /**\n @private\n @method runInitializers\n */\n runInitializers: function() {\n var initializers = get(this.constructor, 'initializers'),\n container = this.__container__,\n graph = new DAG(),\n namespace = this,\n name, initializer;\n\n for (name in initializers) {\n initializer = initializers[name];\n graph.addEdges(initializer.name, initializer.initialize, initializer.before, initializer.after);\n }\n\n graph.topsort(function (vertex) {\n var initializer = vertex.value;\n Ember.assert(\"No application initializer named '\"+vertex.name+\"'\", initializer);\n initializer(container, namespace);\n });\n },\n\n /**\n @private\n @method didBecomeReady\n */\n didBecomeReady: function() {\n this.setupEventDispatcher();\n this.ready(); // user hook\n this.startRouting();\n\n if (!Ember.testing) {\n // Eagerly name all classes that are already loaded\n Ember.Namespace.processAll();\n Ember.BOOTED = true;\n }\n\n this.resolve(this);\n },\n\n /**\n Setup up the event dispatcher to receive events on the\n application's `rootElement` with any registered\n `customEvents`.\n\n @private\n @method setupEventDispatcher\n */\n setupEventDispatcher: function() {\n var customEvents = get(this, 'customEvents'),\n rootElement = get(this, 'rootElement'),\n dispatcher = this.__container__.lookup('event_dispatcher:main');\n\n set(this, 'eventDispatcher', dispatcher);\n dispatcher.setup(customEvents, rootElement);\n },\n\n /**\n If the application has a router, use it to route to the current URL, and\n trigger a new call to `route` whenever the URL changes.\n\n @private\n @method startRouting\n @property router {Ember.Router}\n */\n startRouting: function() {\n var router = this.__container__.lookup('router:main');\n if (!router) { return; }\n\n router.startRouting();\n },\n\n handleURL: function(url) {\n var router = this.__container__.lookup('router:main');\n\n router.handleURL(url);\n },\n\n /**\n Called when the Application has become ready.\n The call will be delayed until the DOM has become ready.\n\n @event ready\n */\n ready: K,\n\n /**\n @deprecated Use 'Resolver' instead\n Set this to provide an alternate class to `Ember.DefaultResolver`\n\n\n @property resolver\n */\n resolver: null,\n\n /**\n Set this to provide an alternate class to `Ember.DefaultResolver`\n\n @property resolver\n */\n Resolver: null,\n\n willDestroy: function() {\n Ember.BOOTED = false;\n // Ensure deactivation of routes before objects are destroyed\n this.__container__.lookup('router:main').reset();\n\n this.__container__.destroy();\n },\n\n initializer: function(options) {\n this.constructor.initializer(options);\n }\n });\n\n Application.reopenClass({\n initializers: {},\n initializer: function(initializer) {\n // If this is the first initializer being added to a subclass, we are going to reopen the class\n // to make sure we have a new `initializers` object, which extends from the parent class' using\n // prototypal inheritance. Without this, attempting to add initializers to the subclass would\n // pollute the parent class as well as other subclasses.\n if (this.superclass.initializers !== undefined && this.superclass.initializers === this.initializers) {\n this.reopenClass({\n initializers: create(this.initializers)\n });\n }\n\n Ember.assert(\"The initializer '\" + initializer.name + \"' has already been registered\", !this.initializers[initializer.name]);\n Ember.assert(\"An initializer cannot be registered with both a before and an after\", !(initializer.before && initializer.after));\n Ember.assert(\"An initializer cannot be registered without an initialize function\", canInvoke(initializer, 'initialize'));\n\n this.initializers[initializer.name] = initializer;\n },\n\n /**\n This creates a container with the default Ember naming conventions.\n\n It also configures the container:\n\n * registered views are created every time they are looked up (they are\n not singletons)\n * registered templates are not factories; the registered value is\n returned directly.\n * the router receives the application as its `namespace` property\n * all controllers receive the router as their `target` and `controllers`\n properties\n * all controllers receive the application as their `namespace` property\n * the application view receives the application controller as its\n `controller` property\n * the application view receives the application template as its\n `defaultTemplate` property\n\n @private\n @method buildContainer\n @static\n @param {Ember.Application} namespace the application to build the\n container for.\n @return {Ember.Container} the built container\n */\n buildContainer: function(namespace) {\n var container = new Container();\n\n Container.defaultContainer = new DeprecatedContainer(container);\n\n container.set = set;\n container.resolver = resolverFor(namespace);\n container.normalize = container.resolver.normalize;\n container.describe = container.resolver.describe;\n container.makeToString = container.resolver.makeToString;\n\n container.optionsForType('component', { singleton: false });\n container.optionsForType('view', { singleton: false });\n container.optionsForType('template', { instantiate: false });\n container.optionsForType('helper', { instantiate: false });\n\n container.register('application:main', namespace, { instantiate: false });\n\n container.register('controller:basic', Controller, { instantiate: false });\n container.register('controller:object', ObjectController, { instantiate: false });\n container.register('controller:array', ArrayController, { instantiate: false });\n container.register('route:basic', Route, { instantiate: false });\n container.register('event_dispatcher:main', EventDispatcher);\n\n container.register('router:main', Router);\n container.injection('router:main', 'namespace', 'application:main');\n\n container.register('location:auto', AutoLocation);\n container.register('location:hash', HashLocation);\n container.register('location:history', HistoryLocation);\n container.register('location:none', NoneLocation);\n\n container.injection('controller', 'target', 'router:main');\n container.injection('controller', 'namespace', 'application:main');\n\n container.injection('route', 'router', 'router:main');\n container.injection('location', 'rootURL', '-location-setting:root-url');\n\n // DEBUGGING\n container.register('resolver-for-debugging:main', container.resolver.__resolver__, { instantiate: false });\n container.injection('container-debug-adapter:main', 'resolver', 'resolver-for-debugging:main');\n container.injection('data-adapter:main', 'containerDebugAdapter', 'container-debug-adapter:main');\n // Custom resolver authors may want to register their own ContainerDebugAdapter with this key\n\n // ES6TODO: resolve this via import once ember-application package is ES6'ed\n requireModule('ember-extension-support');\n container.register('container-debug-adapter:main', ContainerDebugAdapter);\n\n return container;\n }\n });\n\n /**\n This function defines the default lookup rules for container lookups:\n\n * templates are looked up on `Ember.TEMPLATES`\n * other names are looked up on the application after classifying the name.\n For example, `controller:post` looks up `App.PostController` by default.\n * if the default lookup fails, look for registered classes on the container\n\n This allows the application to register default injections in the container\n that could be overridden by the normal naming convention.\n\n @private\n @method resolverFor\n @param {Ember.Namespace} namespace the namespace to look for classes\n @return {*} the resolved value for a given lookup\n */\n function resolverFor(namespace) {\n if (namespace.get('resolver')) {\n Ember.deprecate('Application.resolver is deprecated in favor of Application.Resolver', false);\n }\n\n var ResolverClass = namespace.get('resolver') || namespace.get('Resolver') || DefaultResolver;\n var resolver = ResolverClass.create({\n namespace: namespace\n });\n\n function resolve(fullName) {\n return resolver.resolve(fullName);\n }\n\n resolve.describe = function(fullName) {\n return resolver.lookupDescription(fullName);\n };\n\n resolve.makeToString = function(factory, fullName) {\n return resolver.makeToString(factory, fullName);\n };\n\n resolve.normalize = function(fullName) {\n if (resolver.normalize) {\n return resolver.normalize(fullName);\n } else {\n Ember.deprecate('The Resolver should now provide a \\'normalize\\' function', false);\n return fullName;\n }\n };\n\n resolve.__resolver__ = resolver;\n\n return resolve;\n }\n\n __exports__[\"default\"] = Application;\n });\ndefine(\"ember-application/system/dag\",\n [\"exports\"],\n function(__exports__) {\n \"use strict\";\n function visit(vertex, fn, visited, path) {\n var name = vertex.name,\n vertices = vertex.incoming,\n names = vertex.incomingNames,\n len = names.length,\n i;\n if (!visited) {\n visited = {};\n }\n if (!path) {\n path = [];\n }\n if (visited.hasOwnProperty(name)) {\n return;\n }\n path.push(name);\n visited[name] = true;\n for (i = 0; i < len; i++) {\n visit(vertices[names[i]], fn, visited, path);\n }\n fn(vertex, path);\n path.pop();\n }\n\n function DAG() {\n this.names = [];\n this.vertices = {};\n }\n\n DAG.prototype.add = function(name) {\n if (!name) { return; }\n if (this.vertices.hasOwnProperty(name)) {\n return this.vertices[name];\n }\n var vertex = {\n name: name, incoming: {}, incomingNames: [], hasOutgoing: false, value: null\n };\n this.vertices[name] = vertex;\n this.names.push(name);\n return vertex;\n };\n\n DAG.prototype.map = function(name, value) {\n this.add(name).value = value;\n };\n\n DAG.prototype.addEdge = function(fromName, toName) {\n if (!fromName || !toName || fromName === toName) {\n return;\n }\n var from = this.add(fromName), to = this.add(toName);\n if (to.incoming.hasOwnProperty(fromName)) {\n return;\n }\n function checkCycle(vertex, path) {\n if (vertex.name === toName) {\n throw new EmberError(\"cycle detected: \" + toName + \" <- \" + path.join(\" <- \"));\n }\n }\n visit(from, checkCycle);\n from.hasOutgoing = true;\n to.incoming[fromName] = from;\n to.incomingNames.push(fromName);\n };\n\n DAG.prototype.topsort = function(fn) {\n var visited = {},\n vertices = this.vertices,\n names = this.names,\n len = names.length,\n i, vertex;\n for (i = 0; i < len; i++) {\n vertex = vertices[names[i]];\n if (!vertex.hasOutgoing) {\n visit(vertex, fn, visited);\n }\n }\n };\n\n DAG.prototype.addEdges = function(name, value, before, after) {\n var i;\n this.map(name, value);\n if (before) {\n if (typeof before === 'string') {\n this.addEdge(name, before);\n } else {\n for (i = 0; i < before.length; i++) {\n this.addEdge(name, before[i]);\n }\n }\n }\n if (after) {\n if (typeof after === 'string') {\n this.addEdge(after, name);\n } else {\n for (i = 0; i < after.length; i++) {\n this.addEdge(after[i], name);\n }\n }\n }\n };\n\n __exports__[\"default\"] = DAG;\n });\ndefine(\"ember-application/system/resolver\",\n [\"ember-metal/core\",\"ember-metal/property_get\",\"ember-metal/logger\",\"ember-runtime/system/string\",\"ember-runtime/system/object\",\"ember-runtime/system/namespace\",\"ember-handlebars\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __exports__) {\n \"use strict\";\n /**\n @module ember\n @submodule ember-application\n */\n\n var Ember = __dependency1__[\"default\"];\n // Ember.TEMPLATES, Ember.assert\n var get = __dependency2__.get;\n var Logger = __dependency3__[\"default\"];\n var classify = __dependency4__.classify;\n var capitalize = __dependency4__.capitalize;\n var decamelize = __dependency4__.decamelize;\n var EmberObject = __dependency5__[\"default\"];\n var Namespace = __dependency6__[\"default\"];\n var EmberHandlebars = __dependency7__[\"default\"];\n\n var Resolver = EmberObject.extend({\n /**\n This will be set to the Application instance when it is\n created.\n\n @property namespace\n */\n namespace: null,\n normalize: function(fullName) {\n throw new Error(\"Invalid call to `resolver.normalize(fullName)`. Please override the 'normalize' method in subclass of `Ember.Resolver` to prevent falling through to this error.\");\n },\n resolve: function(fullName) {\n throw new Error(\"Invalid call to `resolver.resolve(parsedName)`. Please override the 'resolve' method in subclass of `Ember.Resolver` to prevent falling through to this error.\");\n },\n parseName: function(parsedName) {\n throw new Error(\"Invalid call to `resolver.resolveByType(parsedName)`. Please override the 'resolveByType' method in subclass of `Ember.Resolver` to prevent falling through to this error.\");\n },\n lookupDescription: function(fullName) {\n throw new Error(\"Invalid call to `resolver.lookupDescription(fullName)`. Please override the 'lookupDescription' method in subclass of `Ember.Resolver` to prevent falling through to this error.\");\n },\n makeToString: function(factory, fullName) {\n throw new Error(\"Invalid call to `resolver.makeToString(factory, fullName)`. Please override the 'makeToString' method in subclass of `Ember.Resolver` to prevent falling through to this error.\");\n },\n resolveOther: function(parsedName) {\n throw new Error(\"Invalid call to `resolver.resolveOther(parsedName)`. Please override the 'resolveOther' method in subclass of `Ember.Resolver` to prevent falling through to this error.\");\n },\n _logLookup: function(found, parsedName) {\n throw new Error(\"Invalid call to `resolver._logLookup(found, parsedName)`. Please override the '_logLookup' method in subclass of `Ember.Resolver` to prevent falling through to this error.\");\n }\n });\n\n\n\n /**\n The DefaultResolver defines the default lookup rules to resolve\n container lookups before consulting the container for registered\n items:\n\n * templates are looked up on `Ember.TEMPLATES`\n * other names are looked up on the application after converting\n the name. For example, `controller:post` looks up\n `App.PostController` by default.\n * there are some nuances (see examples below)\n\n ### How Resolving Works\n\n The container calls this object's `resolve` method with the\n `fullName` argument.\n\n It first parses the fullName into an object using `parseName`.\n\n Then it checks for the presence of a type-specific instance\n method of the form `resolve[Type]` and calls it if it exists.\n For example if it was resolving 'template:post', it would call\n the `resolveTemplate` method.\n\n Its last resort is to call the `resolveOther` method.\n\n The methods of this object are designed to be easy to override\n in a subclass. For example, you could enhance how a template\n is resolved like so:\n\n ```javascript\n App = Ember.Application.create({\n Resolver: Ember.DefaultResolver.extend({\n resolveTemplate: function(parsedName) {\n var resolvedTemplate = this._super(parsedName);\n if (resolvedTemplate) { return resolvedTemplate; }\n return Ember.TEMPLATES['not_found'];\n }\n })\n });\n ```\n\n Some examples of how names are resolved:\n\n ```\n 'template:post' //=> Ember.TEMPLATES['post']\n 'template:posts/byline' //=> Ember.TEMPLATES['posts/byline']\n 'template:posts.byline' //=> Ember.TEMPLATES['posts/byline']\n 'template:blogPost' //=> Ember.TEMPLATES['blogPost']\n // OR\n // Ember.TEMPLATES['blog_post']\n 'controller:post' //=> App.PostController\n 'controller:posts.index' //=> App.PostsIndexController\n 'controller:blog/post' //=> Blog.PostController\n 'controller:basic' //=> Ember.Controller\n 'route:post' //=> App.PostRoute\n 'route:posts.index' //=> App.PostsIndexRoute\n 'route:blog/post' //=> Blog.PostRoute\n 'route:basic' //=> Ember.Route\n 'view:post' //=> App.PostView\n 'view:posts.index' //=> App.PostsIndexView\n 'view:blog/post' //=> Blog.PostView\n 'view:basic' //=> Ember.View\n 'foo:post' //=> App.PostFoo\n 'model:post' //=> App.Post\n ```\n\n @class DefaultResolver\n @namespace Ember\n @extends Ember.Object\n */\n var DefaultResolver = EmberObject.extend({\n /**\n This will be set to the Application instance when it is\n created.\n\n @property namespace\n */\n namespace: null,\n\n normalize: function(fullName) {\n var split = fullName.split(':', 2),\n type = split[0],\n name = split[1];\n\n Ember.assert(\"Tried to normalize a container name without a colon (:) in it. You probably tried to lookup a name that did not contain a type, a colon, and a name. A proper lookup name would be `view:post`.\", split.length === 2);\n\n if (type !== 'template') {\n var result = name;\n\n if (result.indexOf('.') > -1) {\n result = result.replace(/\\.(.)/g, function(m) { return m.charAt(1).toUpperCase(); });\n }\n\n if (name.indexOf('_') > -1) {\n result = result.replace(/_(.)/g, function(m) { return m.charAt(1).toUpperCase(); });\n }\n\n return type + ':' + result;\n } else {\n return fullName;\n }\n },\n\n\n /**\n This method is called via the container's resolver method.\n It parses the provided `fullName` and then looks up and\n returns the appropriate template or class.\n\n @method resolve\n @param {String} fullName the lookup string\n @return {Object} the resolved factory\n */\n resolve: function(fullName) {\n var parsedName = this.parseName(fullName),\n resolveMethodName = parsedName.resolveMethodName,\n resolved;\n\n if (!(parsedName.name && parsedName.type)) {\n throw new TypeError(\"Invalid fullName: `\" + fullName + \"`, must be of the form `type:name` \");\n }\n\n if (this[resolveMethodName]) {\n resolved = this[resolveMethodName](parsedName);\n }\n\n if (!resolved) {\n resolved = this.resolveOther(parsedName);\n }\n\n if (parsedName.root.LOG_RESOLVER) {\n this._logLookup(resolved, parsedName);\n }\n\n return resolved;\n },\n /**\n Convert the string name of the form \"type:name\" to\n a Javascript object with the parsed aspects of the name\n broken out.\n\n @protected\n @param {String} fullName the lookup string\n @method parseName\n */\n parseName: function(fullName) {\n var nameParts = fullName.split(\":\"),\n type = nameParts[0], fullNameWithoutType = nameParts[1],\n name = fullNameWithoutType,\n namespace = get(this, 'namespace'),\n root = namespace;\n\n if (type !== 'template' && name.indexOf('/') !== -1) {\n var parts = name.split('/');\n name = parts[parts.length - 1];\n var namespaceName = capitalize(parts.slice(0, -1).join('.'));\n root = Namespace.byName(namespaceName);\n\n Ember.assert('You are looking for a ' + name + ' ' + type + ' in the ' + namespaceName + ' namespace, but the namespace could not be found', root);\n }\n\n return {\n fullName: fullName,\n type: type,\n fullNameWithoutType: fullNameWithoutType,\n name: name,\n root: root,\n resolveMethodName: \"resolve\" + classify(type)\n };\n },\n\n /**\n Returns a human-readable description for a fullName. Used by the\n Application namespace in assertions to describe the\n precise name of the class that Ember is looking for, rather than\n container keys.\n\n @protected\n @param {String} fullName the lookup string\n @method lookupDescription\n */\n lookupDescription: function(fullName) {\n var parsedName = this.parseName(fullName);\n\n if (parsedName.type === 'template') {\n return \"template at \" + parsedName.fullNameWithoutType.replace(/\\./g, '/');\n }\n\n var description = parsedName.root + \".\" + classify(parsedName.name);\n if (parsedName.type !== 'model') { description += classify(parsedName.type); }\n\n return description;\n },\n\n makeToString: function(factory, fullName) {\n return factory.toString();\n },\n /**\n Given a parseName object (output from `parseName`), apply\n the conventions expected by `Ember.Router`\n\n @protected\n @param {Object} parsedName a parseName object with the parsed\n fullName lookup string\n @method useRouterNaming\n */\n useRouterNaming: function(parsedName) {\n parsedName.name = parsedName.name.replace(/\\./g, '_');\n if (parsedName.name === 'basic') {\n parsedName.name = '';\n }\n },\n /**\n Look up the template in Ember.TEMPLATES\n\n @protected\n @param {Object} parsedName a parseName object with the parsed\n fullName lookup string\n @method resolveTemplate\n */\n resolveTemplate: function(parsedName) {\n var templateName = parsedName.fullNameWithoutType.replace(/\\./g, '/');\n\n if (Ember.TEMPLATES[templateName]) {\n return Ember.TEMPLATES[templateName];\n }\n\n templateName = decamelize(templateName);\n if (Ember.TEMPLATES[templateName]) {\n return Ember.TEMPLATES[templateName];\n }\n },\n /**\n Lookup the view using `resolveOther`\n\n @protected\n @param {Object} parsedName a parseName object with the parsed\n fullName lookup string\n @method resolveView\n */\n resolveView: function(parsedName) {\n this.useRouterNaming(parsedName);\n return this.resolveOther(parsedName);\n },\n /**\n Lookup the controller using `resolveOther`\n\n @protected\n @param {Object} parsedName a parseName object with the parsed\n fullName lookup string\n @method resolveController\n */\n resolveController: function(parsedName) {\n this.useRouterNaming(parsedName);\n return this.resolveOther(parsedName);\n },\n /**\n Lookup the route using `resolveOther`\n\n @protected\n @param {Object} parsedName a parseName object with the parsed\n fullName lookup string\n @method resolveRoute\n */\n resolveRoute: function(parsedName) {\n this.useRouterNaming(parsedName);\n return this.resolveOther(parsedName);\n },\n\n /**\n Lookup the model on the Application namespace\n\n @protected\n @param {Object} parsedName a parseName object with the parsed\n fullName lookup string\n @method resolveModel\n */\n resolveModel: function(parsedName) {\n var className = classify(parsedName.name),\n factory = get(parsedName.root, className);\n\n if (factory) { return factory; }\n },\n /**\n Look up the specified object (from parsedName) on the appropriate\n namespace (usually on the Application)\n\n @protected\n @param {Object} parsedName a parseName object with the parsed\n fullName lookup string\n @method resolveHelper\n */\n resolveHelper: function(parsedName) {\n return this.resolveOther(parsedName) || EmberHandlebars.helpers[parsedName.fullNameWithoutType];\n },\n /**\n Look up the specified object (from parsedName) on the appropriate\n namespace (usually on the Application)\n\n @protected\n @param {Object} parsedName a parseName object with the parsed\n fullName lookup string\n @method resolveOther\n */\n resolveOther: function(parsedName) {\n var className = classify(parsedName.name) + classify(parsedName.type),\n factory = get(parsedName.root, className);\n if (factory) { return factory; }\n },\n\n /**\n @method _logLookup\n @param {Boolean} found\n @param {Object} parsedName\n @private\n */\n _logLookup: function(found, parsedName) {\n var symbol, padding;\n\n if (found) { symbol = '[✓]'; }\n else { symbol = '[ ]'; }\n\n if (parsedName.fullName.length > 60) {\n padding = '.';\n } else {\n padding = new Array(60 - parsedName.fullName.length).join('.');\n }\n\n Logger.info(symbol, parsedName.fullName, padding, this.lookupDescription(parsedName.fullName));\n }\n });\n\n __exports__.Resolver = Resolver;\n __exports__.DefaultResolver = DefaultResolver;\n });\n})();\n//@ sourceURL=ember-application");minispade.register('ember-debug', "(function() {define(\"ember-debug\",\n [\"ember-metal/core\",\"ember-metal/error\",\"ember-metal/logger\"],\n function(__dependency1__, __dependency2__, __dependency3__) {\n \"use strict\";\n /*global __fail__*/\n\n var Ember = __dependency1__[\"default\"];\n var EmberError = __dependency2__[\"default\"];\n var Logger = __dependency3__[\"default\"];\n\n /**\n Ember Debug\n\n @module ember\n @submodule ember-debug\n */\n\n /**\n @class Ember\n */\n\n /**\n Define an assertion that will throw an exception if the condition is not\n met. Ember build tools will remove any calls to `Ember.assert()` when\n doing a production build. Example:\n\n ```javascript\n // Test for truthiness\n Ember.assert('Must pass a valid object', obj);\n // Fail unconditionally\n Ember.assert('This code path should never be run')\n ```\n\n @method assert\n @param {String} desc A description of the assertion. This will become\n the text of the Error thrown if the assertion fails.\n @param {Boolean} test Must be truthy for the assertion to pass. If\n falsy, an exception will be thrown.\n */\n Ember.assert = function(desc, test) {\n if (!test) {\n throw new EmberError(\"Assertion Failed: \" + desc);\n }\n };\n\n\n /**\n Display a warning with the provided message. Ember build tools will\n remove any calls to `Ember.warn()` when doing a production build.\n\n @method warn\n @param {String} message A warning to display.\n @param {Boolean} test An optional boolean. If falsy, the warning\n will be displayed.\n */\n Ember.warn = function(message, test) {\n if (!test) {\n Logger.warn(\"WARNING: \"+message);\n if ('trace' in Logger) Logger.trace();\n }\n };\n\n /**\n Display a debug notice. Ember build tools will remove any calls to\n `Ember.debug()` when doing a production build.\n\n ```javascript\n Ember.debug(\"I'm a debug notice!\");\n ```\n\n @method debug\n @param {String} message A debug message to display.\n */\n Ember.debug = function(message) {\n Logger.debug(\"DEBUG: \"+message);\n };\n\n /**\n Display a deprecation warning with the provided message and a stack trace\n (Chrome and Firefox only). Ember build tools will remove any calls to\n `Ember.deprecate()` when doing a production build.\n\n @method deprecate\n @param {String} message A description of the deprecation.\n @param {Boolean} test An optional boolean. If falsy, the deprecation\n will be displayed.\n */\n Ember.deprecate = function(message, test) {\n if (test) { return; }\n\n if (Ember.ENV.RAISE_ON_DEPRECATION) { throw new EmberError(message); }\n\n var error;\n\n // When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome\n try { __fail__.fail(); } catch (e) { error = e; }\n\n if (Ember.LOG_STACKTRACE_ON_DEPRECATION && error.stack) {\n var stack, stackStr = '';\n if (error['arguments']) {\n // Chrome\n stack = error.stack.replace(/^\\s+at\\s+/gm, '').\n replace(/^([^\\(]+?)([\\n$])/gm, '{anonymous}($1)$2').\n replace(/^Object.\\s*\\(([^\\)]+)\\)/gm, '{anonymous}($1)').split('\\n');\n stack.shift();\n } else {\n // Firefox\n stack = error.stack.replace(/(?:\\n@:0)?\\s+$/m, '').\n replace(/^\\(/gm, '{anonymous}(').split('\\n');\n }\n\n stackStr = \"\\n \" + stack.slice(2).join(\"\\n \");\n message = message + stackStr;\n }\n\n Logger.warn(\"DEPRECATION: \"+message);\n };\n\n\n\n /**\n Alias an old, deprecated method with its new counterpart.\n\n Display a deprecation warning with the provided message and a stack trace\n (Chrome and Firefox only) when the assigned method is called.\n\n Ember build tools will not remove calls to `Ember.deprecateFunc()`, though\n no warnings will be shown in production.\n\n ```javascript\n Ember.oldMethod = Ember.deprecateFunc('Please use the new, updated method', Ember.newMethod);\n ```\n\n @method deprecateFunc\n @param {String} message A description of the deprecation.\n @param {Function} func The new function called to replace its deprecated counterpart.\n @return {Function} a new function that wrapped the original function with a deprecation warning\n */\n Ember.deprecateFunc = function(message, func) {\n return function() {\n Ember.deprecate(message);\n return func.apply(this, arguments);\n };\n };\n\n\n /**\n Run a function meant for debugging. Ember build tools will remove any calls to\n `Ember.runInDebug()` when doing a production build.\n\n ```javascript\n Ember.runInDebug(function() {\n Ember.Handlebars.EachView.reopen({\n didInsertElement: function() {\n console.log(\"I'm happy\");\n }\n });\n });\n ```\n\n @method runInDebug\n @param {Function} func The function to be executed.\n @since 1.5.0\n */\n Ember.runInDebug = function(func) {\n func()\n };\n\n // Inform the developer about the Ember Inspector if not installed.\n if (!Ember.testing) {\n var isFirefox = typeof InstallTrigger !== 'undefined';\n var isChrome = !!window.chrome && !window.opera;\n\n if (typeof window !== 'undefined' && (isFirefox || isChrome) && window.addEventListener) {\n window.addEventListener(\"load\", function() {\n if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset.emberExtension) {\n var downloadURL;\n\n if(isChrome) {\n downloadURL = 'https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi';\n } else if(isFirefox) {\n downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/';\n }\n\n Ember.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);\n }\n }, false);\n }\n }\n });\n})();\n//@ sourceURL=ember-debug");minispade.register('ember-extension-support', "(function() {minispade.require(\"ember-application\");\ndefine(\"ember-extension-support/container_debug_adapter\",\n [\"ember-metal/core\",\"ember-metal/utils\",\"ember-runtime/system/string\",\"ember-runtime/system/namespace\",\"ember-runtime/system/object\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {\n \"use strict\";\n var Ember = __dependency1__[\"default\"];\n var typeOf = __dependency2__.typeOf;\n var dasherize = __dependency3__.dasherize;\n var classify = __dependency3__.classify;\n var Namespace = __dependency4__[\"default\"];\n var EmberObject = __dependency5__[\"default\"];\n\n /**\n @module ember\n @submodule ember-extension-support\n */\n\n /**\n The `ContainerDebugAdapter` helps the container and resolver interface\n with tools that debug Ember such as the\n [Ember Extension](https://github.com/tildeio/ember-extension)\n for Chrome and Firefox.\n\n This class can be extended by a custom resolver implementer\n to override some of the methods with library-specific code.\n\n The methods likely to be overridden are:\n\n * `canCatalogEntriesByType`\n * `catalogEntriesByType`\n\n The adapter will need to be registered\n in the application's container as `container-debug-adapter:main`\n\n Example:\n\n ```javascript\n Application.initializer({\n name: \"containerDebugAdapter\",\n\n initialize: function(container, application) {\n application.register('container-debug-adapter:main', require('app/container-debug-adapter'));\n }\n });\n ```\n\n @class ContainerDebugAdapter\n @namespace Ember\n @extends EmberObject\n @since 1.5.0\n */\n var ContainerDebugAdapter = EmberObject.extend({\n /**\n The container of the application being debugged.\n This property will be injected\n on creation.\n\n @property container\n @default null\n */\n container: null,\n\n /**\n The resolver instance of the application\n being debugged. This property will be injected\n on creation.\n\n @property resolver\n @default null\n */\n resolver: null,\n\n /**\n Returns true if it is possible to catalog a list of available\n classes in the resolver for a given type.\n\n @method canCatalogEntriesByType\n @param {string} type The type. e.g. \"model\", \"controller\", \"route\"\n @return {boolean} whether a list is available for this type.\n */\n canCatalogEntriesByType: function(type) {\n if (type === 'model' || type === 'template') return false;\n return true;\n },\n\n /**\n Returns the available classes a given type.\n\n @method catalogEntriesByType\n @param {string} type The type. e.g. \"model\", \"controller\", \"route\"\n @return {Array} An array of strings.\n */\n catalogEntriesByType: function(type) {\n var namespaces = Ember.A(Namespace.NAMESPACES), types = Ember.A(), self = this;\n var typeSuffixRegex = new RegExp(classify(type) + \"$\");\n\n namespaces.forEach(function(namespace) {\n if (namespace !== Ember) {\n for (var key in namespace) {\n if (!namespace.hasOwnProperty(key)) { continue; }\n if (typeSuffixRegex.test(key)) {\n var klass = namespace[key];\n if (typeOf(klass) === 'class') {\n types.push(dasherize(key.replace(typeSuffixRegex, '')));\n }\n }\n }\n }\n });\n return types;\n }\n });\n\n __exports__[\"default\"] = ContainerDebugAdapter;\n });\ndefine(\"ember-extension-support/data_adapter\",\n [\"ember-metal/core\",\"ember-metal/property_get\",\"ember-metal/run_loop\",\"ember-runtime/system/string\",\"ember-runtime/system/namespace\",\"ember-runtime/system/object\",\"ember-runtime/system/native_array\",\"ember-application/system/application\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __exports__) {\n \"use strict\";\n var Ember = __dependency1__[\"default\"];\n var get = __dependency2__.get;\n var run = __dependency3__[\"default\"];\n var dasherize = __dependency4__.dasherize;\n var Namespace = __dependency5__[\"default\"];\n var EmberObject = __dependency6__[\"default\"];\n var A = __dependency7__.A;\n var Application = __dependency8__[\"default\"];\n\n /**\n @module ember\n @submodule ember-extension-support\n */\n\n /**\n The `DataAdapter` helps a data persistence library\n interface with tools that debug Ember such\n as the [Ember Extension](https://github.com/tildeio/ember-extension)\n for Chrome and Firefox.\n\n This class will be extended by a persistence library\n which will override some of the methods with\n library-specific code.\n\n The methods likely to be overridden are:\n\n * `getFilters`\n * `detect`\n * `columnsForType`\n * `getRecords`\n * `getRecordColumnValues`\n * `getRecordKeywords`\n * `getRecordFilterValues`\n * `getRecordColor`\n * `observeRecord`\n\n The adapter will need to be registered\n in the application's container as `dataAdapter:main`\n\n Example:\n\n ```javascript\n Application.initializer({\n name: \"data-adapter\",\n\n initialize: function(container, application) {\n application.register('data-adapter:main', DS.DataAdapter);\n }\n });\n ```\n\n @class DataAdapter\n @namespace Ember\n @extends EmberObject\n */\n var DataAdapter = EmberObject.extend({\n init: function() {\n this._super();\n this.releaseMethods = A();\n },\n\n /**\n The container of the application being debugged.\n This property will be injected\n on creation.\n\n @property container\n @default null\n @since 1.3.0\n */\n container: null,\n\n\n /**\n The container-debug-adapter which is used\n to list all models.\n\n @property containerDebugAdapter\n @default undefined\n @since 1.5.0\n **/\n containerDebugAdapter: undefined,\n\n /**\n Number of attributes to send\n as columns. (Enough to make the record\n identifiable).\n\n @private\n @property attributeLimit\n @default 3\n @since 1.3.0\n */\n attributeLimit: 3,\n\n /**\n Stores all methods that clear observers.\n These methods will be called on destruction.\n\n @private\n @property releaseMethods\n @since 1.3.0\n */\n releaseMethods: A(),\n\n /**\n Specifies how records can be filtered.\n Records returned will need to have a `filterValues`\n property with a key for every name in the returned array.\n\n @public\n @method getFilters\n @return {Array} List of objects defining filters.\n The object should have a `name` and `desc` property.\n */\n getFilters: function() {\n return A();\n },\n\n /**\n Fetch the model types and observe them for changes.\n\n @public\n @method watchModelTypes\n\n @param {Function} typesAdded Callback to call to add types.\n Takes an array of objects containing wrapped types (returned from `wrapModelType`).\n\n @param {Function} typesUpdated Callback to call when a type has changed.\n Takes an array of objects containing wrapped types.\n\n @return {Function} Method to call to remove all observers\n */\n watchModelTypes: function(typesAdded, typesUpdated) {\n var modelTypes = this.getModelTypes(),\n self = this, typesToSend, releaseMethods = A();\n\n typesToSend = modelTypes.map(function(type) {\n var klass = type.klass;\n var wrapped = self.wrapModelType(klass, type.name);\n releaseMethods.push(self.observeModelType(klass, typesUpdated));\n return wrapped;\n });\n\n typesAdded(typesToSend);\n\n var release = function() {\n releaseMethods.forEach(function(fn) { fn(); });\n self.releaseMethods.removeObject(release);\n };\n this.releaseMethods.pushObject(release);\n return release;\n },\n\n _nameToClass: function(type) {\n if (typeof type === 'string') {\n type = this.container.lookupFactory('model:' + type);\n }\n return type;\n },\n\n /**\n Fetch the records of a given type and observe them for changes.\n\n @public\n @method watchRecords\n\n @param {Function} recordsAdded Callback to call to add records.\n Takes an array of objects containing wrapped records.\n The object should have the following properties:\n columnValues: {Object} key and value of a table cell\n object: {Object} the actual record object\n\n @param {Function} recordsUpdated Callback to call when a record has changed.\n Takes an array of objects containing wrapped records.\n\n @param {Function} recordsRemoved Callback to call when a record has removed.\n Takes the following parameters:\n index: the array index where the records were removed\n count: the number of records removed\n\n @return {Function} Method to call to remove all observers\n */\n watchRecords: function(type, recordsAdded, recordsUpdated, recordsRemoved) {\n var self = this, releaseMethods = A(), records = this.getRecords(type), release;\n\n var recordUpdated = function(updatedRecord) {\n recordsUpdated([updatedRecord]);\n };\n\n var recordsToSend = records.map(function(record) {\n releaseMethods.push(self.observeRecord(record, recordUpdated));\n return self.wrapRecord(record);\n });\n\n\n var contentDidChange = function(array, idx, removedCount, addedCount) {\n for (var i = idx; i < idx + addedCount; i++) {\n var record = array.objectAt(i);\n var wrapped = self.wrapRecord(record);\n releaseMethods.push(self.observeRecord(record, recordUpdated));\n recordsAdded([wrapped]);\n }\n\n if (removedCount) {\n recordsRemoved(idx, removedCount);\n }\n };\n\n var observer = { didChange: contentDidChange, willChange: Ember.K };\n records.addArrayObserver(self, observer);\n\n release = function() {\n releaseMethods.forEach(function(fn) { fn(); });\n records.removeArrayObserver(self, observer);\n self.releaseMethods.removeObject(release);\n };\n\n recordsAdded(recordsToSend);\n\n this.releaseMethods.pushObject(release);\n return release;\n },\n\n /**\n Clear all observers before destruction\n @private\n @method willDestroy\n */\n willDestroy: function() {\n this._super();\n this.releaseMethods.forEach(function(fn) {\n fn();\n });\n },\n\n /**\n Detect whether a class is a model.\n\n Test that against the model class\n of your persistence library\n\n @private\n @method detect\n @param {Class} klass The class to test\n @return boolean Whether the class is a model class or not\n */\n detect: function(klass) {\n return false;\n },\n\n /**\n Get the columns for a given model type.\n\n @private\n @method columnsForType\n @param {Class} type The model type\n @return {Array} An array of columns of the following format:\n name: {String} name of the column\n desc: {String} Humanized description (what would show in a table column name)\n */\n columnsForType: function(type) {\n return A();\n },\n\n /**\n Adds observers to a model type class.\n\n @private\n @method observeModelType\n @param {Class} type The model type class\n @param {Function} typesUpdated Called when a type is modified.\n @return {Function} The function to call to remove observers\n */\n\n observeModelType: function(type, typesUpdated) {\n var self = this, records = this.getRecords(type);\n\n var onChange = function() {\n typesUpdated([self.wrapModelType(type)]);\n };\n var observer = {\n didChange: function() {\n run.scheduleOnce('actions', this, onChange);\n },\n willChange: Ember.K\n };\n\n records.addArrayObserver(this, observer);\n\n var release = function() {\n records.removeArrayObserver(self, observer);\n };\n\n return release;\n },\n\n\n /**\n Wraps a given model type and observes changes to it.\n\n @private\n @method wrapModelType\n @param {Class} type A model class\n @param {String} Optional name of the class\n @return {Object} contains the wrapped type and the function to remove observers\n Format:\n type: {Object} the wrapped type\n The wrapped type has the following format:\n name: {String} name of the type\n count: {Integer} number of records available\n columns: {Columns} array of columns to describe the record\n object: {Class} the actual Model type class\n release: {Function} The function to remove observers\n */\n wrapModelType: function(type, name) {\n var release, records = this.getRecords(type),\n typeToSend, self = this;\n\n typeToSend = {\n name: name || type.toString(),\n count: get(records, 'length'),\n columns: this.columnsForType(type),\n object: type\n };\n\n\n return typeToSend;\n },\n\n\n /**\n Fetches all models defined in the application.\n\n @private\n @method getModelTypes\n @return {Array} Array of model types\n */\n getModelTypes: function() {\n var types, self = this,\n containerDebugAdapter = this.get('containerDebugAdapter');\n\n if (containerDebugAdapter.canCatalogEntriesByType('model')) {\n types = containerDebugAdapter.catalogEntriesByType('model');\n } else {\n types = this._getObjectsOnNamespaces();\n }\n // New adapters return strings instead of classes\n return types.map(function(name) {\n return {\n klass: self._nameToClass(name),\n name: name\n };\n }).filter(function(type) {\n return self.detect(type.klass);\n });\n },\n\n /**\n Loops over all namespaces and all objects\n attached to them\n\n @private\n @method _getObjectsOnNamespaces\n @return {Array} Array of model type strings\n */\n _getObjectsOnNamespaces: function() {\n var namespaces = A(Namespace.NAMESPACES), types = A();\n\n namespaces.forEach(function(namespace) {\n for (var key in namespace) {\n if (!namespace.hasOwnProperty(key)) { continue; }\n var name = dasherize(key);\n if (!(namespace instanceof Application) && namespace.toString()) {\n name = namespace + '/' + name;\n }\n types.push(name);\n }\n });\n return types;\n },\n\n /**\n Fetches all loaded records for a given type.\n\n @private\n @method getRecords\n @return {Array} An array of records.\n This array will be observed for changes,\n so it should update when new records are added/removed.\n */\n getRecords: function(type) {\n return A();\n },\n\n /**\n Wraps a record and observers changes to it.\n\n @private\n @method wrapRecord\n @param {Object} record The record instance.\n @return {Object} The wrapped record. Format:\n columnValues: {Array}\n searchKeywords: {Array}\n */\n wrapRecord: function(record) {\n var recordToSend = { object: record }, columnValues = {}, self = this;\n\n recordToSend.columnValues = this.getRecordColumnValues(record);\n recordToSend.searchKeywords = this.getRecordKeywords(record);\n recordToSend.filterValues = this.getRecordFilterValues(record);\n recordToSend.color = this.getRecordColor(record);\n\n return recordToSend;\n },\n\n /**\n Gets the values for each column.\n\n @private\n @method getRecordColumnValues\n @return {Object} Keys should match column names defined\n by the model type.\n */\n getRecordColumnValues: function(record) {\n return {};\n },\n\n /**\n Returns keywords to match when searching records.\n\n @private\n @method getRecordKeywords\n @return {Array} Relevant keywords for search.\n */\n getRecordKeywords: function(record) {\n return A();\n },\n\n /**\n Returns the values of filters defined by `getFilters`.\n\n @private\n @method getRecordFilterValues\n @param {Object} record The record instance\n @return {Object} The filter values\n */\n getRecordFilterValues: function(record) {\n return {};\n },\n\n /**\n Each record can have a color that represents its state.\n\n @private\n @method getRecordColor\n @param {Object} record The record instance\n @return {String} The record's color\n Possible options: black, red, blue, green\n */\n getRecordColor: function(record) {\n return null;\n },\n\n /**\n Observes all relevant properties and re-sends the wrapped record\n when a change occurs.\n\n @private\n @method observerRecord\n @param {Object} record The record instance\n @param {Function} recordUpdated The callback to call when a record is updated.\n @return {Function} The function to call to remove all observers.\n */\n observeRecord: function(record, recordUpdated) {\n return function(){};\n }\n\n });\n\n __exports__[\"default\"] = DataAdapter;\n });\ndefine(\"ember-extension-support/initializers\",\n [],\n function() {\n \"use strict\";\n\n });\ndefine(\"ember-extension-support\",\n [\"ember-metal/core\",\"ember-extension-support/data_adapter\",\"ember-extension-support/container_debug_adapter\"],\n function(__dependency1__, __dependency2__, __dependency3__) {\n \"use strict\";\n /**\n Ember Extension Support\n\n @module ember\n @submodule ember-extension-support\n @requires ember-application\n */\n\n var Ember = __dependency1__[\"default\"];\n var DataAdapter = __dependency2__[\"default\"];\n var ContainerDebugAdapter = __dependency3__[\"default\"];\n\n Ember.DataAdapter = DataAdapter;\n Ember.ContainerDebugAdapter = ContainerDebugAdapter;\n });\n})();\n//@ sourceURL=ember-extension-support");minispade.register('ember-handlebars-compiler', "(function() {minispade.require(\"ember-views\");\ndefine(\"ember-handlebars-compiler\",\n [\"ember-metal/core\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n /**\n @module ember\n @submodule ember-handlebars-compiler\n */\n\n var Ember = __dependency1__[\"default\"];\n\n // ES6Todo: you'll need to import debugger once debugger is es6'd.\n if (typeof Ember.assert === 'undefined') { Ember.assert = function(){}; };\n if (typeof Ember.FEATURES === 'undefined') { Ember.FEATURES = { isEnabled: function(){} }; };\n\n var objectCreate = Object.create || function(parent) {\n function F() {}\n F.prototype = parent;\n return new F();\n };\n\n // set up for circular references later\n var View, Component;\n\n // ES6Todo: when ember-debug is es6'ed import this.\n // var emberAssert = Ember.assert;\n var Handlebars = (Ember.imports && Ember.imports.Handlebars) || (this && this.Handlebars);\n if (!Handlebars && typeof require === 'function') {\n Handlebars = require('handlebars');\n }\n\n Ember.assert(\"Ember Handlebars requires Handlebars version 1.0 or 1.1. Include \" +\n \"a SCRIPT tag in the HTML HEAD linking to the Handlebars file \" +\n \"before you link to Ember.\", Handlebars);\n\n Ember.assert(\"Ember Handlebars requires Handlebars version 1.0 or 1.1, \" +\n \"COMPILER_REVISION expected: 4, got: \" + Handlebars.COMPILER_REVISION +\n \" - Please note: Builds of master may have other COMPILER_REVISION values.\",\n Handlebars.COMPILER_REVISION === 4);\n\n /**\n Prepares the Handlebars templating library for use inside Ember's view\n system.\n\n The `Ember.Handlebars` object is the standard Handlebars library, extended to\n use Ember's `get()` method instead of direct property access, which allows\n computed properties to be used inside templates.\n\n To create an `Ember.Handlebars` template, call `Ember.Handlebars.compile()`.\n This will return a function that can be used by `Ember.View` for rendering.\n\n @class Handlebars\n @namespace Ember\n */\n var EmberHandlebars = Ember.Handlebars = objectCreate(Handlebars);\n\n /**\n Register a bound helper or custom view helper.\n\n ## Simple bound helper example\n\n ```javascript\n Ember.Handlebars.helper('capitalize', function(value) {\n return value.toUpperCase();\n });\n ```\n\n The above bound helper can be used inside of templates as follows:\n\n ```handlebars\n {{capitalize name}}\n ```\n\n In this case, when the `name` property of the template's context changes,\n the rendered value of the helper will update to reflect this change.\n\n For more examples of bound helpers, see documentation for\n `Ember.Handlebars.registerBoundHelper`.\n\n ## Custom view helper example\n\n Assuming a view subclass named `App.CalendarView` were defined, a helper\n for rendering instances of this view could be registered as follows:\n\n ```javascript\n Ember.Handlebars.helper('calendar', App.CalendarView):\n ```\n\n The above bound helper can be used inside of templates as follows:\n\n ```handlebars\n {{calendar}}\n ```\n\n Which is functionally equivalent to:\n\n ```handlebars\n {{view App.CalendarView}}\n ```\n\n Options in the helper will be passed to the view in exactly the same\n manner as with the `view` helper.\n\n @method helper\n @for Ember.Handlebars\n @param {String} name\n @param {Function|Ember.View} function or view class constructor\n @param {String} dependentKeys*\n */\n EmberHandlebars.helper = function(name, value) {\n if (!View) { View = requireModule('ember-views/views/view')['View']; } // ES6TODO: stupid circular dep\n if (!Component) { Component = requireModule('ember-views/views/component')['default']; } // ES6TODO: stupid circular dep\n\n Ember.assert(\"You tried to register a component named '\" + name + \"', but component names must include a '-'\", !Component.detect(value) || name.match(/-/));\n\n if (View.detect(value)) {\n EmberHandlebars.registerHelper(name, EmberHandlebars.makeViewHelper(value));\n } else {\n EmberHandlebars.registerBoundHelper.apply(null, arguments);\n }\n };\n\n /**\n Returns a helper function that renders the provided ViewClass.\n\n Used internally by Ember.Handlebars.helper and other methods\n involving helper/component registration.\n\n @private\n @method makeViewHelper\n @for Ember.Handlebars\n @param {Function} ViewClass view class constructor\n @since 1.2.0\n */\n EmberHandlebars.makeViewHelper = function(ViewClass) {\n return function(options) {\n Ember.assert(\"You can only pass attributes (such as name=value) not bare values to a helper for a View found in '\" + ViewClass.toString() + \"'\", arguments.length < 2);\n return EmberHandlebars.helpers.view.call(this, ViewClass, options);\n };\n };\n\n /**\n @class helpers\n @namespace Ember.Handlebars\n */\n EmberHandlebars.helpers = objectCreate(Handlebars.helpers);\n\n /**\n Override the the opcode compiler and JavaScript compiler for Handlebars.\n\n @class Compiler\n @namespace Ember.Handlebars\n @private\n @constructor\n */\n EmberHandlebars.Compiler = function() {};\n\n // Handlebars.Compiler doesn't exist in runtime-only\n if (Handlebars.Compiler) {\n EmberHandlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);\n }\n\n EmberHandlebars.Compiler.prototype.compiler = EmberHandlebars.Compiler;\n\n /**\n @class JavaScriptCompiler\n @namespace Ember.Handlebars\n @private\n @constructor\n */\n EmberHandlebars.JavaScriptCompiler = function() {};\n\n // Handlebars.JavaScriptCompiler doesn't exist in runtime-only\n if (Handlebars.JavaScriptCompiler) {\n EmberHandlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);\n EmberHandlebars.JavaScriptCompiler.prototype.compiler = EmberHandlebars.JavaScriptCompiler;\n }\n\n\n EmberHandlebars.JavaScriptCompiler.prototype.namespace = \"Ember.Handlebars\";\n\n EmberHandlebars.JavaScriptCompiler.prototype.initializeBuffer = function() {\n return \"''\";\n };\n\n /**\n Override the default buffer for Ember Handlebars. By default, Handlebars\n creates an empty String at the beginning of each invocation and appends to\n it. Ember's Handlebars overrides this to append to a single shared buffer.\n\n @private\n @method appendToBuffer\n @param string {String}\n */\n EmberHandlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {\n return \"data.buffer.push(\"+string+\");\";\n };\n\n // Hacks ahead:\n // Handlebars presently has a bug where the `blockHelperMissing` hook\n // doesn't get passed the name of the missing helper name, but rather\n // gets passed the value of that missing helper evaluated on the current\n // context, which is most likely `undefined` and totally useless.\n //\n // So we alter the compiled template function to pass the name of the helper\n // instead, as expected.\n //\n // This can go away once the following is closed:\n // https://github.com/wycats/handlebars.js/issues/634\n\n var DOT_LOOKUP_REGEX = /helpers\\.(.*?)\\)/,\n BRACKET_STRING_LOOKUP_REGEX = /helpers\\['(.*?)'/,\n INVOCATION_SPLITTING_REGEX = /(.*blockHelperMissing\\.call\\(.*)(stack[0-9]+)(,.*)/;\n\n EmberHandlebars.JavaScriptCompiler.stringifyLastBlockHelperMissingInvocation = function(source) {\n var helperInvocation = source[source.length - 1],\n helperName = (DOT_LOOKUP_REGEX.exec(helperInvocation) || BRACKET_STRING_LOOKUP_REGEX.exec(helperInvocation))[1],\n matches = INVOCATION_SPLITTING_REGEX.exec(helperInvocation);\n\n source[source.length - 1] = matches[1] + \"'\" + helperName + \"'\" + matches[3];\n };\n\n var stringifyBlockHelperMissing = EmberHandlebars.JavaScriptCompiler.stringifyLastBlockHelperMissingInvocation;\n\n var originalBlockValue = EmberHandlebars.JavaScriptCompiler.prototype.blockValue;\n EmberHandlebars.JavaScriptCompiler.prototype.blockValue = function() {\n originalBlockValue.apply(this, arguments);\n stringifyBlockHelperMissing(this.source);\n };\n\n var originalAmbiguousBlockValue = EmberHandlebars.JavaScriptCompiler.prototype.ambiguousBlockValue;\n EmberHandlebars.JavaScriptCompiler.prototype.ambiguousBlockValue = function() {\n originalAmbiguousBlockValue.apply(this, arguments);\n stringifyBlockHelperMissing(this.source);\n };\n\n /**\n Rewrite simple mustaches from `{{foo}}` to `{{bind \"foo\"}}`. This means that\n all simple mustaches in Ember's Handlebars will also set up an observer to\n keep the DOM up to date when the underlying property changes.\n\n @private\n @method mustache\n @for Ember.Handlebars.Compiler\n @param mustache\n */\n EmberHandlebars.Compiler.prototype.mustache = function(mustache) {\n if (!(mustache.params.length || mustache.hash)) {\n var id = new Handlebars.AST.IdNode([{ part: '_triageMustache' }]);\n\n // Update the mustache node to include a hash value indicating whether the original node\n // was escaped. This will allow us to properly escape values when the underlying value\n // changes and we need to re-render the value.\n if (!mustache.escaped) {\n mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);\n mustache.hash.pairs.push([\"unescaped\", new Handlebars.AST.StringNode(\"true\")]);\n }\n mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);\n }\n\n return Handlebars.Compiler.prototype.mustache.call(this, mustache);\n };\n\n /**\n Used for precompilation of Ember Handlebars templates. This will not be used\n during normal app execution.\n\n @method precompile\n @for Ember.Handlebars\n @static\n @param {String} string The template to precompile\n @param {Boolean} asObject optional parameter, defaulting to true, of whether or not the\n compiled template should be returned as an Object or a String\n */\n EmberHandlebars.precompile = function(string, asObject) {\n var ast = Handlebars.parse(string);\n\n var options = {\n knownHelpers: {\n action: true,\n unbound: true,\n 'bind-attr': true,\n template: true,\n view: true,\n _triageMustache: true\n },\n data: true,\n stringParams: true\n };\n\n asObject = asObject === undefined ? true : asObject;\n\n var environment = new EmberHandlebars.Compiler().compile(ast, options);\n return new EmberHandlebars.JavaScriptCompiler().compile(environment, options, undefined, asObject);\n };\n\n // We don't support this for Handlebars runtime-only\n if (Handlebars.compile) {\n /**\n The entry point for Ember Handlebars. This replaces the default\n `Handlebars.compile` and turns on template-local data and String\n parameters.\n\n @method compile\n @for Ember.Handlebars\n @static\n @param {String} string The template to compile\n @return {Function}\n */\n EmberHandlebars.compile = function(string) {\n var ast = Handlebars.parse(string);\n var options = { data: true, stringParams: true };\n var environment = new EmberHandlebars.Compiler().compile(ast, options);\n var templateSpec = new EmberHandlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n\n var template = EmberHandlebars.template(templateSpec);\n template.isMethod = false; //Make sure we don't wrap templates with ._super\n\n return template;\n };\n }\n\n __exports__[\"default\"] = EmberHandlebars;\n });\n})();\n//@ sourceURL=ember-handlebars-compiler");minispade.register('ember-handlebars', "(function() {minispade.require(\"ember-handlebars-compiler\");\nminispade.require(\"ember-views\");\nminispade.require(\"metamorph\");\ndefine(\"ember-handlebars/component_lookup\",\n [\"ember-runtime/system/object\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var EmberObject = __dependency1__[\"default\"];\n\n var ComponentLookup = EmberObject.extend({\n lookupFactory: function(name, container) {\n\n container = container || this.container;\n\n var fullName = 'component:' + name,\n templateFullName = 'template:components/' + name,\n templateRegistered = container && container.has(templateFullName);\n\n if (templateRegistered) {\n container.injection(fullName, 'layout', templateFullName);\n }\n\n var Component = container.lookupFactory(fullName);\n\n // Only treat as a component if either the component\n // or a template has been registered.\n if (templateRegistered || Component) {\n if (!Component) {\n container.register(fullName, Ember.Component);\n Component = container.lookupFactory(fullName);\n }\n return Component;\n }\n }\n });\n\n __exports__[\"default\"] = ComponentLookup;\n });\ndefine(\"ember-handlebars/controls\",\n [\"ember-handlebars/controls/checkbox\",\"ember-handlebars/controls/text_field\",\"ember-handlebars/controls/text_area\",\"ember-metal/core\",\"ember-handlebars-compiler\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {\n \"use strict\";\n var Checkbox = __dependency1__[\"default\"];\n var TextField = __dependency2__[\"default\"];\n var TextArea = __dependency3__[\"default\"];\n\n var Ember = __dependency4__[\"default\"];\n // Ember.assert\n // var emberAssert = Ember.assert;\n\n var EmberHandlebars = __dependency5__[\"default\"];\n var helpers = EmberHandlebars.helpers;\n /**\n @module ember\n @submodule ember-handlebars-compiler\n */\n\n /**\n\n The `{{input}}` helper inserts an HTML `` tag into the template,\n with a `type` value of either `text` or `checkbox`. If no `type` is provided,\n `text` will be the default value applied. The attributes of `{{input}}`\n match those of the native HTML tag as closely as possible for these two types.\n\n ## Use as text field\n An `{{input}}` with no `type` or a `type` of `text` will render an HTML text input.\n The following HTML attributes can be set via the helper:\n\n \n \n \n \n \n \n \n \n \n \n \n
`readonly``required``autofocus`
`value``placeholder``disabled`
`size``tabindex``maxlength`
`name``min``max`
`pattern``accept``autocomplete`
`autosave``formaction``formenctype`
`formmethod``formnovalidate``formtarget`
`height``inputmode``multiple`
`step``width``form`
`selectionDirection``spellcheck` 
\n\n\n When set to a quoted string, these values will be directly applied to the HTML\n element. When left unquoted, these values will be bound to a property on the\n template's current rendering context (most typically a controller instance).\n\n ## Unbound:\n\n ```handlebars\n {{input value=\"http://www.facebook.com\"}}\n ```\n\n\n ```html\n \n ```\n\n ## Bound:\n\n ```javascript\n App.ApplicationController = Ember.Controller.extend({\n firstName: \"Stanley\",\n entryNotAllowed: true\n });\n ```\n\n\n ```handlebars\n {{input type=\"text\" value=firstName disabled=entryNotAllowed size=\"50\"}}\n ```\n\n\n ```html\n \n ```\n\n ## Extension\n\n Internally, `{{input type=\"text\"}}` creates an instance of `Ember.TextField`, passing\n arguments from the helper to `Ember.TextField`'s `create` method. You can extend the\n capablilties of text inputs in your applications by reopening this class. For example,\n if you are building a Bootstrap 3 project where `data-*` attributes are used, you\n can add one to the `TextField`'s `attributeBindings` property:\n\n\n ```javascript\n Ember.TextField.reopen({\n attributeBindings: ['data-error']\n });\n ```\n\n Keep in mind when writing `Ember.TextField` subclasses that `Ember.TextField`\n itself extends `Ember.Component`, meaning that it does NOT inherit\n the `controller` of the parent view.\n\n See more about [Ember components](api/classes/Ember.Component.html)\n\n\n ## Use as checkbox\n\n An `{{input}}` with a `type` of `checkbox` will render an HTML checkbox input.\n The following HTML attributes can be set via the helper:\n\n * `checked`\n * `disabled`\n * `tabindex`\n * `indeterminate`\n * `name`\n * `autofocus`\n * `form`\n\n\n When set to a quoted string, these values will be directly applied to the HTML\n element. When left unquoted, these values will be bound to a property on the\n template's current rendering context (most typically a controller instance).\n\n ## Unbound:\n\n ```handlebars\n {{input type=\"checkbox\" name=\"isAdmin\"}}\n ```\n\n ```html\n \n ```\n\n ## Bound:\n\n ```javascript\n App.ApplicationController = Ember.Controller.extend({\n isAdmin: true\n });\n ```\n\n\n ```handlebars\n {{input type=\"checkbox\" checked=isAdmin }}\n ```\n\n\n ```html\n \n ```\n\n ## Extension\n\n Internally, `{{input type=\"checkbox\"}}` creates an instance of `Ember.Checkbox`, passing\n arguments from the helper to `Ember.Checkbox`'s `create` method. You can extend the\n capablilties of checkbox inputs in your applications by reopening this class. For example,\n if you wanted to add a css class to all checkboxes in your application:\n\n\n ```javascript\n Ember.Checkbox.reopen({\n classNames: ['my-app-checkbox']\n });\n ```\n\n\n @method input\n @for Ember.Handlebars.helpers\n @param {Hash} options\n */\n function inputHelper(options) {\n Ember.assert('You can only pass attributes to the `input` helper, not arguments', arguments.length < 2);\n\n var hash = options.hash,\n types = options.hashTypes,\n inputType = hash.type,\n onEvent = hash.on;\n\n delete hash.type;\n delete hash.on;\n\n if (inputType === 'checkbox') {\n Ember.assert(\"{{input type='checkbox'}} does not support setting `value=someBooleanValue`; you must use `checked=someBooleanValue` instead.\", options.hashTypes.value !== 'ID');\n return helpers.view.call(this, Checkbox, options);\n } else {\n if (inputType) { hash.type = inputType; }\n hash.onEvent = onEvent || 'enter';\n return helpers.view.call(this, TextField, options);\n }\n }\n\n /**\n `{{textarea}}` inserts a new instance of `\n ```\n\n Bound:\n\n In the following example, the `writtenWords` property on `App.ApplicationController`\n will be updated live as the user types 'Lots of text that IS bound' into\n the text area of their browser's window.\n\n ```javascript\n App.ApplicationController = Ember.Controller.extend({\n writtenWords: \"Lots of text that IS bound\"\n });\n ```\n\n ```handlebars\n {{textarea value=writtenWords}}\n ```\n\n Would result in the following HTML:\n\n ```html\n \n ```\n\n If you wanted a one way binding between the text area and a div tag\n somewhere else on your screen, you could use `Ember.computed.oneWay`:\n\n ```javascript\n App.ApplicationController = Ember.Controller.extend({\n writtenWords: \"Lots of text that IS bound\",\n outputWrittenWords: Ember.computed.oneWay(\"writtenWords\")\n });\n ```\n\n ```handlebars\n {{textarea value=writtenWords}}\n\n
\n {{outputWrittenWords}}\n
\n ```\n\n Would result in the following HTML:\n\n ```html\n \n\n <-- the following div will be updated in real time as you type -->\n\n
\n Lots of text that IS bound\n
\n ```\n\n Finally, this example really shows the power and ease of Ember when two\n properties are bound to eachother via `Ember.computed.alias`. Type into\n either text area box and they'll both stay in sync. Note that\n `Ember.computed.alias` costs more in terms of performance, so only use it when\n your really binding in both directions:\n\n ```javascript\n App.ApplicationController = Ember.Controller.extend({\n writtenWords: \"Lots of text that IS bound\",\n twoWayWrittenWords: Ember.computed.alias(\"writtenWords\")\n });\n ```\n\n ```handlebars\n {{textarea value=writtenWords}}\n {{textarea value=twoWayWrittenWords}}\n ```\n\n ```html\n \n\n <-- both updated in real time -->\n\n \n ```\n\n ## Extension\n\n Internally, `{{textarea}}` creates an instance of `Ember.TextArea`, passing\n arguments from the helper to `Ember.TextArea`'s `create` method. You can\n extend the capabilities of text areas in your application by reopening this\n class. For example, if you are deploying to browsers where the `required`\n attribute is used, you can globally add support for the `required` attribute\n on all `{{textarea}}`s' in your app by reopening `Ember.TextArea` or\n `Ember.TextSupport` and adding it to the `attributeBindings` concatenated\n property:\n\n ```javascript\n Ember.TextArea.reopen({\n attributeBindings: ['required']\n });\n ```\n\n Keep in mind when writing `Ember.TextArea` subclasses that `Ember.TextArea`\n itself extends `Ember.Component`, meaning that it does NOT inherit\n the `controller` of the parent view.\n\n See more about [Ember components](api/classes/Ember.Component.html)\n\n @method textarea\n @for Ember.Handlebars.helpers\n @param {Hash} options\n */\n function textareaHelper(options) {\n Ember.assert('You can only pass attributes to the `textarea` helper, not arguments', arguments.length < 2);\n\n var hash = options.hash,\n types = options.hashTypes;\n\n return helpers.view.call(this, TextArea, options);\n }\n\n __exports__.inputHelper = inputHelper;\n __exports__.textareaHelper = textareaHelper;\n });\ndefine(\"ember-handlebars/controls/checkbox\",\n [\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-views/views/view\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __exports__) {\n \"use strict\";\n var get = __dependency1__.get;\n var set = __dependency2__.set;\n var View = __dependency3__.View;\n\n /**\n @module ember\n @submodule ember-handlebars\n */\n\n /**\n The internal class used to create text inputs when the `{{input}}`\n helper is used with `type` of `checkbox`.\n\n See [handlebars.helpers.input](/api/classes/Ember.Handlebars.helpers.html#method_input) for usage details.\n\n ## Direct manipulation of `checked`\n\n The `checked` attribute of an `Ember.Checkbox` object should always be set\n through the Ember object or by interacting with its rendered element\n representation via the mouse, keyboard, or touch. Updating the value of the\n checkbox via jQuery will result in the checked value of the object and its\n element losing synchronization.\n\n ## Layout and LayoutName properties\n\n Because HTML `input` elements are self closing `layout` and `layoutName`\n properties will not be applied. See [Ember.View](/api/classes/Ember.View.html)'s\n layout section for more information.\n\n @class Checkbox\n @namespace Ember\n @extends Ember.View\n */\n var Checkbox = View.extend({\n classNames: ['ember-checkbox'],\n\n tagName: 'input',\n\n attributeBindings: ['type', 'checked', 'indeterminate', 'disabled', 'tabindex', 'name',\n 'autofocus', 'required', 'form'],\n\n type: \"checkbox\",\n checked: false,\n disabled: false,\n indeterminate: false,\n\n init: function() {\n this._super();\n this.on(\"change\", this, this._updateElementValue);\n },\n\n didInsertElement: function() {\n this._super();\n get(this, 'element').indeterminate = !!get(this, 'indeterminate');\n },\n\n _updateElementValue: function() {\n set(this, 'checked', this.$().prop('checked'));\n }\n });\n\n __exports__[\"default\"] = Checkbox;\n });\ndefine(\"ember-handlebars/controls/select\",\n [\"ember-handlebars-compiler\",\"ember-metal/enumerable_utils\",\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-views/views/view\",\"ember-views/views/collection_view\",\"ember-metal/utils\",\"ember-metal/is_none\",\"ember-metal/computed\",\"ember-runtime/system/native_array\",\"ember-metal/mixin\",\"ember-metal/properties\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __exports__) {\n \"use strict\";\n /*jshint eqeqeq:false newcap:false */\n\n /**\n @module ember\n @submodule ember-handlebars\n */\n\n var EmberHandlebars = __dependency1__[\"default\"];\n var EnumerableUtils = __dependency2__[\"default\"];\n var get = __dependency3__.get;\n var set = __dependency4__.set;\n var View = __dependency5__.View;\n var CollectionView = __dependency6__[\"default\"];\n var isArray = __dependency7__.isArray;\n var isNone = __dependency8__[\"default\"];\n var computed = __dependency9__.computed;\n var A = __dependency10__.A;\n var observer = __dependency11__.observer;\n var defineProperty = __dependency12__.defineProperty;\n\n var indexOf = EnumerableUtils.indexOf,\n indexesOf = EnumerableUtils.indexesOf,\n forEach = EnumerableUtils.forEach,\n replace = EnumerableUtils.replace,\n precompileTemplate = EmberHandlebars.compile;\n\n var SelectOption = View.extend({\n tagName: 'option',\n attributeBindings: ['value', 'selected'],\n\n defaultTemplate: function(context, options) {\n options = { data: options.data, hash: {} };\n EmberHandlebars.helpers.bind.call(context, \"view.label\", options);\n },\n\n init: function() {\n this.labelPathDidChange();\n this.valuePathDidChange();\n\n this._super();\n },\n\n selected: computed(function() {\n var content = get(this, 'content'),\n selection = get(this, 'parentView.selection');\n if (get(this, 'parentView.multiple')) {\n return selection && indexOf(selection, content.valueOf()) > -1;\n } else {\n // Primitives get passed through bindings as objects... since\n // `new Number(4) !== 4`, we use `==` below\n return content == selection;\n }\n }).property('content', 'parentView.selection'),\n\n labelPathDidChange: observer('parentView.optionLabelPath', function() {\n var labelPath = get(this, 'parentView.optionLabelPath');\n\n if (!labelPath) { return; }\n\n defineProperty(this, 'label', computed(function() {\n return get(this, labelPath);\n }).property(labelPath));\n }),\n\n valuePathDidChange: observer('parentView.optionValuePath', function() {\n var valuePath = get(this, 'parentView.optionValuePath');\n\n if (!valuePath) { return; }\n\n defineProperty(this, 'value', computed(function() {\n return get(this, valuePath);\n }).property(valuePath));\n })\n });\n\n var SelectOptgroup = CollectionView.extend({\n tagName: 'optgroup',\n attributeBindings: ['label'],\n\n selectionBinding: 'parentView.selection',\n multipleBinding: 'parentView.multiple',\n optionLabelPathBinding: 'parentView.optionLabelPath',\n optionValuePathBinding: 'parentView.optionValuePath',\n\n itemViewClassBinding: 'parentView.optionView'\n });\n\n /**\n The `Ember.Select` view class renders a\n [select](https://developer.mozilla.org/en/HTML/Element/select) HTML element,\n allowing the user to choose from a list of options.\n\n The text and `value` property of each `\n \n \n ```\n\n The `value` attribute of the selected `{{/if}}{{#if view.optionGroupPath}}{{#each view.groupedContent}}{{view view.groupView content=content label=label}}{{/each}}{{else}}{{#each view.content}}{{view view.optionView content=this}}{{/each}}{{/if}}'),\n attributeBindings: ['multiple', 'disabled', 'tabindex', 'name', 'required', 'autofocus',\n 'form', 'size'],\n\n /**\n The `multiple` attribute of the select element. Indicates whether multiple\n options can be selected.\n\n @property multiple\n @type Boolean\n @default false\n */\n multiple: false,\n\n /**\n The `disabled` attribute of the select element. Indicates whether\n the element is disabled from interactions.\n\n @property disabled\n @type Boolean\n @default false\n */\n disabled: false,\n\n /**\n The `required` attribute of the select element. Indicates whether\n a selected option is required for form validation.\n\n @property required\n @type Boolean\n @default false\n @since 1.5.0\n */\n required: false,\n\n /**\n The list of options.\n\n If `optionLabelPath` and `optionValuePath` are not overridden, this should\n be a list of strings, which will serve simultaneously as labels and values.\n\n Otherwise, this should be a list of objects. For instance:\n\n ```javascript\n Ember.Select.create({\n content: A([\n { id: 1, firstName: 'Yehuda' },\n { id: 2, firstName: 'Tom' }\n ]),\n optionLabelPath: 'content.firstName',\n optionValuePath: 'content.id'\n });\n ```\n\n @property content\n @type Array\n @default null\n */\n content: null,\n\n /**\n When `multiple` is `false`, the element of `content` that is currently\n selected, if any.\n\n When `multiple` is `true`, an array of such elements.\n\n @property selection\n @type Object or Array\n @default null\n */\n selection: null,\n\n /**\n In single selection mode (when `multiple` is `false`), value can be used to\n get the current selection's value or set the selection by it's value.\n\n It is not currently supported in multiple selection mode.\n\n @property value\n @type String\n @default null\n */\n value: computed(function(key, value) {\n if (arguments.length === 2) { return value; }\n var valuePath = get(this, 'optionValuePath').replace(/^content\\.?/, '');\n return valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection');\n }).property('selection'),\n\n /**\n If given, a top-most dummy option will be rendered to serve as a user\n prompt.\n\n @property prompt\n @type String\n @default null\n */\n prompt: null,\n\n /**\n The path of the option labels. See [content](/api/classes/Ember.Select.html#property_content).\n\n @property optionLabelPath\n @type String\n @default 'content'\n */\n optionLabelPath: 'content',\n\n /**\n The path of the option values. See [content](/api/classes/Ember.Select.html#property_content).\n\n @property optionValuePath\n @type String\n @default 'content'\n */\n optionValuePath: 'content',\n\n /**\n The path of the option group.\n When this property is used, `content` should be sorted by `optionGroupPath`.\n\n @property optionGroupPath\n @type String\n @default null\n */\n optionGroupPath: null,\n\n /**\n The view class for optgroup.\n\n @property groupView\n @type Ember.View\n @default Ember.SelectOptgroup\n */\n groupView: SelectOptgroup,\n\n groupedContent: computed(function() {\n var groupPath = get(this, 'optionGroupPath');\n var groupedContent = A();\n var content = get(this, 'content') || [];\n\n forEach(content, function(item) {\n var label = get(item, groupPath);\n\n if (get(groupedContent, 'lastObject.label') !== label) {\n groupedContent.pushObject({\n label: label,\n content: A()\n });\n }\n\n get(groupedContent, 'lastObject.content').push(item);\n });\n\n return groupedContent;\n }).property('optionGroupPath', 'content.@each'),\n\n /**\n The view class for option.\n\n @property optionView\n @type Ember.View\n @default Ember.SelectOption\n */\n optionView: SelectOption,\n\n _change: function() {\n if (get(this, 'multiple')) {\n this._changeMultiple();\n } else {\n this._changeSingle();\n }\n },\n\n selectionDidChange: observer('selection.@each', function() {\n var selection = get(this, 'selection');\n if (get(this, 'multiple')) {\n if (!isArray(selection)) {\n set(this, 'selection', A([selection]));\n return;\n }\n this._selectionDidChangeMultiple();\n } else {\n this._selectionDidChangeSingle();\n }\n }),\n\n valueDidChange: observer('value', function() {\n var content = get(this, 'content'),\n value = get(this, 'value'),\n valuePath = get(this, 'optionValuePath').replace(/^content\\.?/, ''),\n selectedValue = (valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection')),\n selection;\n\n if (value !== selectedValue) {\n selection = content ? content.find(function(obj) {\n return value === (valuePath ? get(obj, valuePath) : obj);\n }) : null;\n\n this.set('selection', selection);\n }\n }),\n\n\n _triggerChange: function() {\n var selection = get(this, 'selection');\n var value = get(this, 'value');\n\n if (!isNone(selection)) { this.selectionDidChange(); }\n if (!isNone(value)) { this.valueDidChange(); }\n\n this._change();\n },\n\n _changeSingle: function() {\n var selectedIndex = this.$()[0].selectedIndex,\n content = get(this, 'content'),\n prompt = get(this, 'prompt');\n\n if (!content || !get(content, 'length')) { return; }\n if (prompt && selectedIndex === 0) { set(this, 'selection', null); return; }\n\n if (prompt) { selectedIndex -= 1; }\n set(this, 'selection', content.objectAt(selectedIndex));\n },\n\n\n _changeMultiple: function() {\n var options = this.$('option:selected'),\n prompt = get(this, 'prompt'),\n offset = prompt ? 1 : 0,\n content = get(this, 'content'),\n selection = get(this, 'selection');\n\n if (!content) { return; }\n if (options) {\n var selectedIndexes = options.map(function() {\n return this.index - offset;\n }).toArray();\n var newSelection = content.objectsAt(selectedIndexes);\n\n if (isArray(selection)) {\n replace(selection, 0, get(selection, 'length'), newSelection);\n } else {\n set(this, 'selection', newSelection);\n }\n }\n },\n\n _selectionDidChangeSingle: function() {\n var el = this.get('element');\n if (!el) { return; }\n\n var content = get(this, 'content'),\n selection = get(this, 'selection'),\n selectionIndex = content ? indexOf(content, selection) : -1,\n prompt = get(this, 'prompt');\n\n if (prompt) { selectionIndex += 1; }\n if (el) { el.selectedIndex = selectionIndex; }\n },\n\n _selectionDidChangeMultiple: function() {\n var content = get(this, 'content'),\n selection = get(this, 'selection'),\n selectedIndexes = content ? indexesOf(content, selection) : [-1],\n prompt = get(this, 'prompt'),\n offset = prompt ? 1 : 0,\n options = this.$('option'),\n adjusted;\n\n if (options) {\n options.each(function() {\n adjusted = this.index > -1 ? this.index - offset : -1;\n this.selected = indexOf(selectedIndexes, adjusted) > -1;\n });\n }\n },\n\n init: function() {\n this._super();\n this.on(\"didInsertElement\", this, this._triggerChange);\n this.on(\"change\", this, this._change);\n }\n });\n\n __exports__[\"default\"] = Select\n __exports__.Select = Select;\n __exports__.SelectOption = SelectOption;\n __exports__.SelectOptgroup = SelectOptgroup;\n });\ndefine(\"ember-handlebars/controls/text_area\",\n [\"ember-metal/property_get\",\"ember-views/views/component\",\"ember-handlebars/controls/text_support\",\"ember-metal/mixin\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {\n \"use strict\";\n\n /**\n @module ember\n @submodule ember-handlebars\n */\n var get = __dependency1__.get;\n var Component = __dependency2__[\"default\"];\n var TextSupport = __dependency3__[\"default\"];\n var observer = __dependency4__.observer;\n\n /**\n The internal class used to create textarea element when the `{{textarea}}`\n helper is used.\n\n See [handlebars.helpers.textarea](/api/classes/Ember.Handlebars.helpers.html#method_textarea) for usage details.\n\n ## Layout and LayoutName properties\n\n Because HTML `textarea` elements do not contain inner HTML the `layout` and\n `layoutName` properties will not be applied. See [Ember.View](/api/classes/Ember.View.html)'s\n layout section for more information.\n\n @class TextArea\n @namespace Ember\n @extends Ember.Component\n @uses Ember.TextSupport\n */\n var TextArea = Component.extend(TextSupport, {\n classNames: ['ember-text-area'],\n\n tagName: \"textarea\",\n attributeBindings: ['rows', 'cols', 'name', 'selectionEnd', 'selectionStart', 'wrap'],\n rows: null,\n cols: null,\n\n _updateElementValue: observer('value', function() {\n // We do this check so cursor position doesn't get affected in IE\n var value = get(this, 'value'),\n $el = this.$();\n if ($el && value !== $el.val()) {\n $el.val(value);\n }\n }),\n\n init: function() {\n this._super();\n this.on(\"didInsertElement\", this, this._updateElementValue);\n }\n\n });\n\n __exports__[\"default\"] = TextArea;\n });\ndefine(\"ember-handlebars/controls/text_field\",\n [\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-views/views/component\",\"ember-handlebars/controls/text_support\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {\n \"use strict\";\n /**\n @module ember\n @submodule ember-handlebars\n */\n\n var get = __dependency1__.get;\n var set = __dependency2__.set;\n var Component = __dependency3__[\"default\"];\n var TextSupport = __dependency4__[\"default\"];\n\n /**\n\n The internal class used to create text inputs when the `{{input}}`\n helper is used with `type` of `text`.\n\n See [Handlebars.helpers.input](/api/classes/Ember.Handlebars.helpers.html#method_input) for usage details.\n\n ## Layout and LayoutName properties\n\n Because HTML `input` elements are self closing `layout` and `layoutName`\n properties will not be applied. See [Ember.View](/api/classes/Ember.View.html)'s\n layout section for more information.\n\n @class TextField\n @namespace Ember\n @extends Ember.Component\n @uses Ember.TextSupport\n */\n var TextField = Component.extend(TextSupport, {\n\n classNames: ['ember-text-field'],\n tagName: \"input\",\n attributeBindings: ['type', 'value', 'size', 'pattern', 'name', 'min', 'max',\n 'accept', 'autocomplete', 'autosave', 'formaction',\n 'formenctype', 'formmethod', 'formnovalidate', 'formtarget',\n 'height', 'inputmode', 'list', 'multiple', 'pattern', 'step',\n 'width'],\n\n /**\n The `value` attribute of the input element. As the user inputs text, this\n property is updated live.\n\n @property value\n @type String\n @default \"\"\n */\n value: \"\",\n\n /**\n The `type` attribute of the input element.\n\n @property type\n @type String\n @default \"text\"\n */\n type: \"text\",\n\n /**\n The `size` of the text field in characters.\n\n @property size\n @type String\n @default null\n */\n size: null,\n\n /**\n The `pattern` attribute of input element.\n\n @property pattern\n @type String\n @default null\n */\n pattern: null,\n\n /**\n The `min` attribute of input element used with `type=\"number\"` or `type=\"range\"`.\n\n @property min\n @type String\n @default null\n @since 1.4.0\n */\n min: null,\n\n /**\n The `max` attribute of input element used with `type=\"number\"` or `type=\"range\"`.\n\n @property max\n @type String\n @default null\n @since 1.4.0\n */\n max: null\n });\n\n __exports__[\"default\"] = TextField;\n });\ndefine(\"ember-handlebars/controls/text_support\",\n [\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-metal/mixin\",\"ember-runtime/mixins/target_action_support\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {\n \"use strict\";\n /**\n @module ember\n @submodule ember-handlebars\n */\n\n var get = __dependency1__.get;\n var set = __dependency2__.set;\n var Mixin = __dependency3__.Mixin;\n var TargetActionSupport = __dependency4__[\"default\"];\n\n /**\n Shared mixin used by `Ember.TextField` and `Ember.TextArea`.\n\n @class TextSupport\n @namespace Ember\n @uses Ember.TargetActionSupport\n @extends Ember.Mixin\n @private\n */\n var TextSupport = Mixin.create(TargetActionSupport, {\n value: \"\",\n\n attributeBindings: ['placeholder', 'disabled', 'maxlength', 'tabindex', 'readonly',\n 'autofocus', 'form', 'selectionDirection', 'spellcheck', 'required',\n 'title', 'autocapitalize', 'autocorrect'],\n placeholder: null,\n disabled: false,\n maxlength: null,\n\n init: function() {\n this._super();\n this.on(\"focusOut\", this, this._elementValueDidChange);\n this.on(\"change\", this, this._elementValueDidChange);\n this.on(\"paste\", this, this._elementValueDidChange);\n this.on(\"cut\", this, this._elementValueDidChange);\n this.on(\"input\", this, this._elementValueDidChange);\n this.on(\"keyUp\", this, this.interpretKeyEvents);\n },\n\n /**\n The action to be sent when the user presses the return key.\n\n This is similar to the `{{action}}` helper, but is fired when\n the user presses the return key when editing a text field, and sends\n the value of the field as the context.\n\n @property action\n @type String\n @default null\n */\n action: null,\n\n /**\n The event that should send the action.\n\n Options are:\n\n * `enter`: the user pressed enter\n * `keyPress`: the user pressed a key\n\n @property onEvent\n @type String\n @default enter\n */\n onEvent: 'enter',\n\n /**\n Whether they `keyUp` event that triggers an `action` to be sent continues\n propagating to other views.\n\n By default, when the user presses the return key on their keyboard and\n the text field has an `action` set, the action will be sent to the view's\n controller and the key event will stop propagating.\n\n If you would like parent views to receive the `keyUp` event even after an\n action has been dispatched, set `bubbles` to true.\n\n @property bubbles\n @type Boolean\n @default false\n */\n bubbles: false,\n\n interpretKeyEvents: function(event) {\n var map = TextSupport.KEY_EVENTS;\n var method = map[event.keyCode];\n\n this._elementValueDidChange();\n if (method) { return this[method](event); }\n },\n\n _elementValueDidChange: function() {\n set(this, 'value', this.$().val());\n },\n\n /**\n The action to be sent when the user inserts a new line.\n\n Called by the `Ember.TextSupport` mixin on keyUp if keycode matches 13.\n Uses sendAction to send the `enter` action to the controller.\n\n @method insertNewline\n @param {Event} event\n */\n insertNewline: function(event) {\n sendAction('enter', this, event);\n sendAction('insert-newline', this, event);\n },\n\n /**\n Called when the user hits escape.\n\n Called by the `Ember.TextSupport` mixin on keyUp if keycode matches 27.\n Uses sendAction to send the `escape-press` action to the controller.\n\n @method cancel\n @param {Event} event\n */\n cancel: function(event) {\n sendAction('escape-press', this, event);\n },\n\n /**\n Called when the text area is focused.\n\n @method focusIn\n @param {Event} event\n */\n focusIn: function(event) {\n sendAction('focus-in', this, event);\n },\n\n /**\n Called when the text area is blurred.\n\n @method focusOut\n @param {Event} event\n */\n focusOut: function(event) {\n sendAction('focus-out', this, event);\n },\n\n /**\n The action to be sent when the user presses a key. Enabled by setting\n the `onEvent` property to `keyPress`.\n\n Uses sendAction to send the `keyPress` action to the controller.\n\n @method keyPress\n @param {Event} event\n */\n keyPress: function(event) {\n sendAction('key-press', this, event);\n }\n\n });\n\n TextSupport.KEY_EVENTS = {\n 13: 'insertNewline',\n 27: 'cancel'\n };\n\n // In principle, this shouldn't be necessary, but the legacy\n // sendAction semantics for TextField are different from\n // the component semantics so this method normalizes them.\n function sendAction(eventName, view, event) {\n var action = get(view, eventName),\n on = get(view, 'onEvent'),\n value = get(view, 'value');\n\n // back-compat support for keyPress as an event name even though\n // it's also a method name that consumes the event (and therefore\n // incompatible with sendAction semantics).\n if (on === eventName || (on === 'keyPress' && eventName === 'key-press')) {\n view.sendAction('action', value);\n }\n\n view.sendAction(eventName, value);\n\n if (action || on === eventName) {\n if(!get(view, 'bubbles')) {\n event.stopPropagation();\n }\n }\n }\n\n __exports__[\"default\"] = TextSupport;\n });\ndefine(\"ember-handlebars/ext\",\n [\"ember-metal/core\",\"ember-runtime/system/string\",\"ember-handlebars-compiler\",\"ember-metal/property_get\",\"ember-metal/binding\",\"ember-metal/error\",\"ember-metal/mixin\",\"ember-metal/is_empty\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __exports__) {\n \"use strict\";\n var Ember = __dependency1__[\"default\"];\n // Ember.FEATURES, Ember.assert, Ember.Handlebars, Ember.lookup\n // var emberAssert = Ember.assert;\n\n var fmt = __dependency2__.fmt;\n\n var EmberHandlebars = __dependency3__[\"default\"];\n var helpers = EmberHandlebars.helpers;\n\n var get = __dependency4__.get;\n var isGlobalPath = __dependency5__.isGlobalPath;\n var EmberError = __dependency6__[\"default\"];\n var IS_BINDING = __dependency7__.IS_BINDING;\n\n // late bound via requireModule because of circular dependencies.\n var resolveHelper,\n SimpleHandlebarsView;\n\n var isEmpty = __dependency8__[\"default\"];\n\n var slice = [].slice, originalTemplate = EmberHandlebars.template;\n\n /**\n If a path starts with a reserved keyword, returns the root\n that should be used.\n\n @private\n @method normalizePath\n @for Ember\n @param root {Object}\n @param path {String}\n @param data {Hash}\n */\n function normalizePath(root, path, data) {\n var keywords = (data && data.keywords) || {},\n keyword, isKeyword;\n\n // Get the first segment of the path. For example, if the\n // path is \"foo.bar.baz\", returns \"foo\".\n keyword = path.split('.', 1)[0];\n\n // Test to see if the first path is a keyword that has been\n // passed along in the view's data hash. If so, we will treat\n // that object as the new root.\n if (keywords.hasOwnProperty(keyword)) {\n // Look up the value in the template's data hash.\n root = keywords[keyword];\n isKeyword = true;\n\n // Handle cases where the entire path is the reserved\n // word. In that case, return the object itself.\n if (path === keyword) {\n path = '';\n } else {\n // Strip the keyword from the path and look up\n // the remainder from the newly found root.\n path = path.substr(keyword.length+1);\n }\n }\n\n return { root: root, path: path, isKeyword: isKeyword };\n };\n\n\n /**\n Lookup both on root and on window. If the path starts with\n a keyword, the corresponding object will be looked up in the\n template's data hash and used to resolve the path.\n\n @method get\n @for Ember.Handlebars\n @param {Object} root The object to look up the property on\n @param {String} path The path to be lookedup\n @param {Object} options The template's option hash\n */\n function handlebarsGet(root, path, options) {\n var data = options && options.data,\n normalizedPath = normalizePath(root, path, data),\n value;\n\n if (Ember.FEATURES.isEnabled(\"ember-handlebars-caps-lookup\")) {\n\n // If the path starts with a capital letter, look it up on Ember.lookup,\n // which defaults to the `window` object in browsers.\n if (isGlobalPath(path)) {\n value = get(Ember.lookup, path);\n } else {\n\n // In cases where the path begins with a keyword, change the\n // root to the value represented by that keyword, and ensure\n // the path is relative to it.\n value = get(normalizedPath.root, normalizedPath.path);\n }\n\n } else {\n root = normalizedPath.root;\n path = normalizedPath.path;\n\n value = get(root, path);\n\n if (value === undefined && root !== Ember.lookup && isGlobalPath(path)) {\n value = get(Ember.lookup, path);\n }\n }\n\n return value;\n }\n\n /**\n This method uses `Ember.Handlebars.get` to lookup a value, then ensures\n that the value is escaped properly.\n\n If `unescaped` is a truthy value then the escaping will not be performed.\n\n @method getEscaped\n @for Ember.Handlebars\n @param {Object} root The object to look up the property on\n @param {String} path The path to be lookedup\n @param {Object} options The template's option hash\n @since 1.4.0\n */\n function getEscaped(root, path, options) {\n var result = handlebarsGet(root, path, options);\n\n if (result === null || result === undefined) {\n result = \"\";\n } else if (!(result instanceof Handlebars.SafeString)) {\n result = String(result);\n }\n if (!options.hash.unescaped){\n result = Handlebars.Utils.escapeExpression(result);\n }\n\n return result;\n };\n\n function resolveParams(context, params, options) {\n var resolvedParams = [], types = options.types, param, type;\n\n for (var i=0, l=params.length; i{{user.name}}\n\n
\n
{{user.role.label}}
\n {{user.role.id}}\n\n

{{user.role.description}}

\n
\n ```\n\n `{{with}}` can be our best friend in these cases,\n instead of writing `user.role.*` over and over, we use `{{#with user.role}}`.\n Now the context within the `{{#with}} .. {{/with}}` block is `user.role` so you can do the following:\n\n ```handlebars\n
{{user.name}}
\n\n
\n {{#with user.role}}\n
{{label}}
\n {{id}}\n\n

{{description}}

\n {{/with}}\n
\n ```\n\n ### `as` operator\n\n This operator aliases the scope to a new name. It's helpful for semantic clarity and to retain\n default scope or to reference from another `{{with}}` block.\n\n ```handlebars\n // posts might not be\n {{#with user.posts as blogPosts}}\n
\n There are {{blogPosts.length}} blog posts written by {{user.name}}.\n
\n\n {{#each post in blogPosts}}\n
  • {{post.title}}
  • \n {{/each}}\n {{/with}}\n ```\n\n Without the `as` operator, it would be impossible to reference `user.name` in the example above.\n\n NOTE: The alias should not reuse a name from the bound property path.\n For example: `{{#with foo.bar as foo}}` is not supported because it attempts to alias using\n the first part of the property path, `foo`. Instead, use `{{#with foo.bar as baz}}`.\n\n ### `controller` option\n\n Adding `controller='something'` instructs the `{{with}}` helper to create and use an instance of\n the specified controller with the new context as its content.\n\n This is very similar to using an `itemController` option with the `{{each}}` helper.\n\n ```handlebars\n {{#with users.posts controller='userBlogPosts'}}\n {{!- The current context is wrapped in our controller instance }}\n {{/with}}\n ```\n\n In the above example, the template provided to the `{{with}}` block is now wrapped in the\n `userBlogPost` controller, which provides a very elegant way to decorate the context with custom\n functions/properties.\n\n @method with\n @for Ember.Handlebars.helpers\n @param {Function} context\n @param {Hash} options\n @return {String} HTML string\n */\n function withHelper(context, options) {\n if (arguments.length === 4) {\n var keywordName, path, rootPath, normalized, contextPath;\n\n Ember.assert(\"If you pass more than one argument to the with helper, it must be in the form #with foo as bar\", arguments[1] === \"as\");\n options = arguments[3];\n keywordName = arguments[2];\n path = arguments[0];\n\n Ember.assert(\"You must pass a block to the with helper\", options.fn && options.fn !== Handlebars.VM.noop);\n\n var localizedOptions = o_create(options);\n localizedOptions.data = o_create(options.data);\n localizedOptions.data.keywords = o_create(options.data.keywords || {});\n\n if (isGlobalPath(path)) {\n contextPath = path;\n } else {\n normalized = normalizePath(this, path, options.data);\n path = normalized.path;\n rootPath = normalized.root;\n\n // This is a workaround for the fact that you cannot bind separate objects\n // together. When we implement that functionality, we should use it here.\n var contextKey = jQuery.expando + guidFor(rootPath);\n localizedOptions.data.keywords[contextKey] = rootPath;\n // if the path is '' (\"this\"), just bind directly to the current context\n contextPath = path ? contextKey + '.' + path : contextKey;\n }\n\n emberBind(localizedOptions.data.keywords, keywordName, contextPath);\n\n return bind.call(this, path, localizedOptions, true, exists);\n } else {\n Ember.assert(\"You must pass exactly one argument to the with helper\", arguments.length === 2);\n Ember.assert(\"You must pass a block to the with helper\", options.fn && options.fn !== Handlebars.VM.noop);\n return helpers.bind.call(options.contexts[0], context, options);\n }\n }\n\n\n /**\n See [boundIf](/api/classes/Ember.Handlebars.helpers.html#method_boundIf)\n and [unboundIf](/api/classes/Ember.Handlebars.helpers.html#method_unboundIf)\n\n @method if\n @for Ember.Handlebars.helpers\n @param {Function} context\n @param {Hash} options\n @return {String} HTML string\n */\n function ifHelper(context, options) {\n Ember.assert(\"You must pass exactly one argument to the if helper\", arguments.length === 2);\n Ember.assert(\"You must pass a block to the if helper\", options.fn && options.fn !== Handlebars.VM.noop);\n if (options.data.isUnbound) {\n return helpers.unboundIf.call(options.contexts[0], context, options);\n } else {\n return helpers.boundIf.call(options.contexts[0], context, options);\n }\n }\n\n /**\n @method unless\n @for Ember.Handlebars.helpers\n @param {Function} context\n @param {Hash} options\n @return {String} HTML string\n */\n function unlessHelper(context, options) {\n Ember.assert(\"You must pass exactly one argument to the unless helper\", arguments.length === 2);\n Ember.assert(\"You must pass a block to the unless helper\", options.fn && options.fn !== Handlebars.VM.noop);\n\n var fn = options.fn, inverse = options.inverse;\n\n options.fn = inverse;\n options.inverse = fn;\n\n if (options.data.isUnbound) {\n return helpers.unboundIf.call(options.contexts[0], context, options);\n } else {\n return helpers.boundIf.call(options.contexts[0], context, options);\n }\n }\n\n /**\n `bind-attr` allows you to create a binding between DOM element attributes and\n Ember objects. For example:\n\n ```handlebars\n \"imageTitle\"}}\n ```\n\n The above handlebars template will fill the ``'s `src` attribute will\n the value of the property referenced with `\"imageUrl\"` and its `alt`\n attribute with the value of the property referenced with `\"imageTitle\"`.\n\n If the rendering context of this template is the following object:\n\n ```javascript\n {\n imageUrl: 'http://lolcats.info/haz-a-funny',\n imageTitle: 'A humorous image of a cat'\n }\n ```\n\n The resulting HTML output will be:\n\n ```html\n \"A\n ```\n\n `bind-attr` cannot redeclare existing DOM element attributes. The use of `src`\n in the following `bind-attr` example will be ignored and the hard coded value\n of `src=\"/failwhale.gif\"` will take precedence:\n\n ```handlebars\n \"imageTitle\"}}\n ```\n\n ### `bind-attr` and the `class` attribute\n\n `bind-attr` supports a special syntax for handling a number of cases unique\n to the `class` DOM element attribute. The `class` attribute combines\n multiple discrete values into a single attribute as a space-delimited\n list of strings. Each string can be:\n\n * a string return value of an object's property.\n * a boolean return value of an object's property\n * a hard-coded value\n\n A string return value works identically to other uses of `bind-attr`. The\n return value of the property will become the value of the attribute. For\n example, the following view and template:\n\n ```javascript\n AView = View.extend({\n someProperty: function() {\n return \"aValue\";\n }.property()\n })\n ```\n\n ```handlebars\n \n ```\n\n Result in the following rendered output:\n\n ```html\n \n ```\n\n A boolean return value will insert a specified class name if the property\n returns `true` and remove the class name if the property returns `false`.\n\n A class name is provided via the syntax\n `somePropertyName:class-name-if-true`.\n\n ```javascript\n AView = View.extend({\n someBool: true\n })\n ```\n\n ```handlebars\n \n ```\n\n Result in the following rendered output:\n\n ```html\n \n ```\n\n An additional section of the binding can be provided if you want to\n replace the existing class instead of removing it when the boolean\n value changes:\n\n ```handlebars\n \n ```\n\n A hard-coded value can be used by prepending `:` to the desired\n class name: `:class-name-to-always-apply`.\n\n ```handlebars\n \n ```\n\n Results in the following rendered output:\n\n ```html\n \n ```\n\n All three strategies - string return value, boolean return value, and\n hard-coded value – can be combined in a single declaration:\n\n ```handlebars\n \n ```\n\n @method bind-attr\n @for Ember.Handlebars.helpers\n @param {Hash} options\n @return {String} HTML string\n */\n function bindAttrHelper(options) {\n var attrs = options.hash;\n\n Ember.assert(\"You must specify at least one hash argument to bind-attr\", !!keys(attrs).length);\n\n var view = options.data.view;\n var ret = [];\n\n // we relied on the behavior of calling without\n // context to mean this === window, but when running\n // \"use strict\", it's possible for this to === undefined;\n var ctx = this || window;\n\n // Generate a unique id for this element. This will be added as a\n // data attribute to the element so it can be looked up when\n // the bound property changes.\n var dataId = ++Ember.uuid;\n\n // Handle classes differently, as we can bind multiple classes\n var classBindings = attrs['class'];\n if (classBindings != null) {\n var classResults = bindClasses(ctx, classBindings, view, dataId, options);\n\n ret.push('class=\"' + Handlebars.Utils.escapeExpression(classResults.join(' ')) + '\"');\n delete attrs['class'];\n }\n\n var attrKeys = keys(attrs);\n\n // For each attribute passed, create an observer and emit the\n // current value of the property as an attribute.\n forEach.call(attrKeys, function(attr) {\n var path = attrs[attr],\n normalized;\n\n Ember.assert(fmt(\"You must provide an expression as the value of bound attribute. You specified: %@=%@\", [attr, path]), typeof path === 'string');\n\n normalized = normalizePath(ctx, path, options.data);\n\n var value = (path === 'this') ? normalized.root : handlebarsGet(ctx, path, options),\n type = typeOf(value);\n\n Ember.assert(fmt(\"Attributes must be numbers, strings or booleans, not %@\", [value]), value === null || value === undefined || type === 'number' || type === 'string' || type === 'boolean');\n\n var observer, invoker;\n\n observer = function observer() {\n var result = handlebarsGet(ctx, path, options);\n\n Ember.assert(fmt(\"Attributes must be numbers, strings or booleans, not %@\", [result]),\n result === null || result === undefined || typeof result === 'number' ||\n typeof result === 'string' || typeof result === 'boolean');\n\n var elem = view.$(\"[data-bindattr-\" + dataId + \"='\" + dataId + \"']\");\n\n // If we aren't able to find the element, it means the element\n // to which we were bound has been removed from the view.\n // In that case, we can assume the template has been re-rendered\n // and we need to clean up the observer.\n if (!elem || elem.length === 0) {\n removeObserver(normalized.root, normalized.path, invoker);\n return;\n }\n\n View.applyAttributeBindings(elem, attr, result);\n };\n\n // Add an observer to the view for when the property changes.\n // When the observer fires, find the element using the\n // unique data id and update the attribute to the new value.\n // Note: don't add observer when path is 'this' or path\n // is whole keyword e.g. {{#each x in list}} ... {{bind-attr attr=\"x\"}}\n if (path !== 'this' && !(normalized.isKeyword && normalized.path === '' )) {\n view.registerObserver(normalized.root, normalized.path, observer);\n }\n\n // if this changes, also change the logic in ember-views/lib/views/view.js\n if ((type === 'string' || (type === 'number' && !isNaN(value)))) {\n ret.push(attr + '=\"' + Handlebars.Utils.escapeExpression(value) + '\"');\n } else if (value && type === 'boolean') {\n // The developer controls the attr name, so it should always be safe\n ret.push(attr + '=\"' + attr + '\"');\n }\n }, this);\n\n // Add the unique identifier\n // NOTE: We use all lower-case since Firefox has problems with mixed case in SVG\n ret.push('data-bindattr-' + dataId + '=\"' + dataId + '\"');\n return new SafeString(ret.join(' '));\n }\n\n /**\n See `bind-attr`\n\n @method bindAttr\n @for Ember.Handlebars.helpers\n @deprecated\n @param {Function} context\n @param {Hash} options\n @return {String} HTML string\n */\n function bindAttrHelperDeprecated() {\n Ember.warn(\"The 'bindAttr' view helper is deprecated in favor of 'bind-attr'\");\n return helpers['bind-attr'].apply(this, arguments);\n }\n\n /**\n Helper that, given a space-separated string of property paths and a context,\n returns an array of class names. Calling this method also has the side\n effect of setting up observers at those property paths, such that if they\n change, the correct class name will be reapplied to the DOM element.\n\n For example, if you pass the string \"fooBar\", it will first look up the\n \"fooBar\" value of the context. If that value is true, it will add the\n \"foo-bar\" class to the current element (i.e., the dasherized form of\n \"fooBar\"). If the value is a string, it will add that string as the class.\n Otherwise, it will not add any new class name.\n\n @private\n @method bindClasses\n @for Ember.Handlebars\n @param {Ember.Object} context The context from which to lookup properties\n @param {String} classBindings A string, space-separated, of class bindings\n to use\n @param {View} view The view in which observers should look for the\n element to update\n @param {Srting} bindAttrId Optional bindAttr id used to lookup elements\n @return {Array} An array of class names to add\n */\n function bindClasses(context, classBindings, view, bindAttrId, options) {\n var ret = [], newClass, value, elem;\n\n // Helper method to retrieve the property from the context and\n // determine which class string to return, based on whether it is\n // a Boolean or not.\n var classStringForPath = function(root, parsedPath, options) {\n var val,\n path = parsedPath.path;\n\n if (path === 'this') {\n val = root;\n } else if (path === '') {\n val = true;\n } else {\n val = handlebarsGet(root, path, options);\n }\n\n return View._classStringForValue(path, val, parsedPath.className, parsedPath.falsyClassName);\n };\n\n // For each property passed, loop through and setup\n // an observer.\n forEach.call(classBindings.split(' '), function(binding) {\n\n // Variable in which the old class value is saved. The observer function\n // closes over this variable, so it knows which string to remove when\n // the property changes.\n var oldClass;\n\n var observer, invoker;\n\n var parsedPath = View._parsePropertyPath(binding),\n path = parsedPath.path,\n pathRoot = context,\n normalized;\n\n if (path !== '' && path !== 'this') {\n normalized = normalizePath(context, path, options.data);\n\n pathRoot = normalized.root;\n path = normalized.path;\n }\n\n // Set up an observer on the context. If the property changes, toggle the\n // class name.\n observer = function() {\n // Get the current value of the property\n newClass = classStringForPath(context, parsedPath, options);\n elem = bindAttrId ? view.$(\"[data-bindattr-\" + bindAttrId + \"='\" + bindAttrId + \"']\") : view.$();\n\n // If we can't find the element anymore, a parent template has been\n // re-rendered and we've been nuked. Remove the observer.\n if (!elem || elem.length === 0) {\n removeObserver(pathRoot, path, invoker);\n } else {\n // If we had previously added a class to the element, remove it.\n if (oldClass) {\n elem.removeClass(oldClass);\n }\n\n // If necessary, add a new class. Make sure we keep track of it so\n // it can be removed in the future.\n if (newClass) {\n elem.addClass(newClass);\n oldClass = newClass;\n } else {\n oldClass = null;\n }\n }\n };\n\n if (path !== '' && path !== 'this') {\n view.registerObserver(pathRoot, path, observer);\n }\n\n // We've already setup the observer; now we just need to figure out the\n // correct behavior right now on the first pass through.\n value = classStringForPath(context, parsedPath, options);\n\n if (value) {\n ret.push(value);\n\n // Make sure we save the current value so that it can be removed if the\n // observer fires.\n oldClass = value;\n }\n });\n\n return ret;\n };\n\n __exports__.bind = bind;\n __exports__._triageMustacheHelper = _triageMustacheHelper;\n __exports__.resolveHelper = resolveHelper;\n __exports__.bindHelper = bindHelper;\n __exports__.boundIfHelper = boundIfHelper;\n __exports__.unboundIfHelper = unboundIfHelper;\n __exports__.withHelper = withHelper;\n __exports__.ifHelper = ifHelper;\n __exports__.unlessHelper = unlessHelper;\n __exports__.bindAttrHelper = bindAttrHelper;\n __exports__.bindAttrHelperDeprecated = bindAttrHelperDeprecated;\n __exports__.bindClasses = bindClasses;\n });\ndefine(\"ember-handlebars/helpers/collection\",\n [\"ember-metal/core\",\"ember-metal/utils\",\"ember-handlebars-compiler\",\"ember-runtime/system/string\",\"ember-metal/property_get\",\"ember-handlebars/ext\",\"ember-handlebars/helpers/view\",\"ember-metal/computed\",\"ember-views/views/collection_view\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __exports__) {\n \"use strict\";\n /**\n @module ember\n @submodule ember-handlebars\n */\n\n var Ember = __dependency1__[\"default\"];\n // Ember.assert, Ember.deprecate\n var inspect = __dependency2__.inspect;\n\n // var emberAssert = Ember.assert;\n // emberDeprecate = Ember.deprecate;\n\n var EmberHandlebars = __dependency3__[\"default\"];\n var helpers = EmberHandlebars.helpers;\n\n var fmt = __dependency4__.fmt;\n var get = __dependency5__.get;\n var handlebarsGet = __dependency6__.handlebarsGet;\n var ViewHelper = __dependency7__.ViewHelper;\n var computed = __dependency8__.computed;\n var CollectionView = __dependency9__[\"default\"];\n\n var alias = computed.alias;\n /**\n `{{collection}}` is a `Ember.Handlebars` helper for adding instances of\n `Ember.CollectionView` to a template. See [Ember.CollectionView](/api/classes/Ember.CollectionView.html)\n for additional information on how a `CollectionView` functions.\n\n `{{collection}}`'s primary use is as a block helper with a `contentBinding`\n option pointing towards an `Ember.Array`-compatible object. An `Ember.View`\n instance will be created for each item in its `content` property. Each view\n will have its own `content` property set to the appropriate item in the\n collection.\n\n The provided block will be applied as the template for each item's view.\n\n Given an empty `` the following template:\n\n ```handlebars\n {{#collection contentBinding=\"App.items\"}}\n Hi {{view.content.name}}\n {{/collection}}\n ```\n\n And the following application code\n\n ```javascript\n App = Ember.Application.create()\n App.items = [\n Ember.Object.create({name: 'Dave'}),\n Ember.Object.create({name: 'Mary'}),\n Ember.Object.create({name: 'Sara'})\n ]\n ```\n\n Will result in the HTML structure below\n\n ```html\n
    \n
    Hi Dave
    \n
    Hi Mary
    \n
    Hi Sara
    \n
    \n ```\n\n ### Blockless use in a collection\n\n If you provide an `itemViewClass` option that has its own `template` you can\n omit the block.\n\n The following template:\n\n ```handlebars\n {{collection contentBinding=\"App.items\" itemViewClass=\"App.AnItemView\"}}\n ```\n\n And application code\n\n ```javascript\n App = Ember.Application.create();\n App.items = [\n Ember.Object.create({name: 'Dave'}),\n Ember.Object.create({name: 'Mary'}),\n Ember.Object.create({name: 'Sara'})\n ];\n\n App.AnItemView = Ember.View.extend({\n template: Ember.Handlebars.compile(\"Greetings {{view.content.name}}\")\n });\n ```\n\n Will result in the HTML structure below\n\n ```html\n
    \n
    Greetings Dave
    \n
    Greetings Mary
    \n
    Greetings Sara
    \n
    \n ```\n\n ### Specifying a CollectionView subclass\n\n By default the `{{collection}}` helper will create an instance of\n `Ember.CollectionView`. You can supply a `Ember.CollectionView` subclass to\n the helper by passing it as the first argument:\n\n ```handlebars\n {{#collection App.MyCustomCollectionClass contentBinding=\"App.items\"}}\n Hi {{view.content.name}}\n {{/collection}}\n ```\n\n ### Forwarded `item.*`-named Options\n\n As with the `{{view}}`, helper options passed to the `{{collection}}` will be\n set on the resulting `Ember.CollectionView` as properties. Additionally,\n options prefixed with `item` will be applied to the views rendered for each\n item (note the camelcasing):\n\n ```handlebars\n {{#collection contentBinding=\"App.items\"\n itemTagName=\"p\"\n itemClassNames=\"greeting\"}}\n Howdy {{view.content.name}}\n {{/collection}}\n ```\n\n Will result in the following HTML structure:\n\n ```html\n
    \n

    Howdy Dave

    \n

    Howdy Mary

    \n

    Howdy Sara

    \n
    \n ```\n\n @method collection\n @for Ember.Handlebars.helpers\n @param {String} path\n @param {Hash} options\n @return {String} HTML string\n @deprecated Use `{{each}}` helper instead.\n */\n function collectionHelper(path, options) {\n Ember.deprecate(\"Using the {{collection}} helper without specifying a class has been deprecated as the {{each}} helper now supports the same functionality.\", path !== 'collection');\n\n // If no path is provided, treat path param as options.\n if (path && path.data && path.data.isRenderData) {\n options = path;\n path = undefined;\n Ember.assert(\"You cannot pass more than one argument to the collection helper\", arguments.length === 1);\n } else {\n Ember.assert(\"You cannot pass more than one argument to the collection helper\", arguments.length === 2);\n }\n\n var fn = options.fn;\n var data = options.data;\n var inverse = options.inverse;\n var view = options.data.view;\n\n\n var controller, container;\n // If passed a path string, convert that into an object.\n // Otherwise, just default to the standard class.\n var collectionClass;\n if (path) {\n controller = data.keywords.controller;\n container = controller && controller.container;\n collectionClass = handlebarsGet(this, path, options) || container.lookupFactory('view:' + path);\n Ember.assert(fmt(\"%@ #collection: Could not find collection class %@\", [data.view, path]), !!collectionClass);\n }\n else {\n collectionClass = CollectionView;\n }\n\n var hash = options.hash, itemHash = {}, match;\n\n // Extract item view class if provided else default to the standard class\n var collectionPrototype = collectionClass.proto(), itemViewClass;\n\n if (hash.itemView) {\n controller = data.keywords.controller;\n Ember.assert('You specified an itemView, but the current context has no ' +\n 'container to look the itemView up in. This probably means ' +\n 'that you created a view manually, instead of through the ' +\n 'container. Instead, use container.lookup(\"view:viewName\"), ' +\n 'which will properly instantiate your view.',\n controller && controller.container);\n container = controller.container;\n itemViewClass = container.lookupFactory('view:' + hash.itemView);\n Ember.assert('You specified the itemView ' + hash.itemView + \", but it was \" +\n \"not found at \" + container.describe(\"view:\" + hash.itemView) +\n \" (and it was not registered in the container)\", !!itemViewClass);\n } else if (hash.itemViewClass) {\n itemViewClass = handlebarsGet(collectionPrototype, hash.itemViewClass, options);\n } else {\n itemViewClass = collectionPrototype.itemViewClass;\n }\n\n Ember.assert(fmt(\"%@ #collection: Could not find itemViewClass %@\", [data.view, itemViewClass]), !!itemViewClass);\n\n delete hash.itemViewClass;\n delete hash.itemView;\n\n // Go through options passed to the {{collection}} helper and extract options\n // that configure item views instead of the collection itself.\n for (var prop in hash) {\n if (hash.hasOwnProperty(prop)) {\n match = prop.match(/^item(.)(.*)$/);\n\n if (match && prop !== 'itemController') {\n // Convert itemShouldFoo -> shouldFoo\n itemHash[match[1].toLowerCase() + match[2]] = hash[prop];\n // Delete from hash as this will end up getting passed to the\n // {{view}} helper method.\n delete hash[prop];\n }\n }\n }\n\n if (fn) {\n itemHash.template = fn;\n delete options.fn;\n }\n\n var emptyViewClass;\n if (inverse && inverse !== EmberHandlebars.VM.noop) {\n emptyViewClass = get(collectionPrototype, 'emptyViewClass');\n emptyViewClass = emptyViewClass.extend({\n template: inverse,\n tagName: itemHash.tagName\n });\n } else if (hash.emptyViewClass) {\n emptyViewClass = handlebarsGet(this, hash.emptyViewClass, options);\n }\n if (emptyViewClass) { hash.emptyView = emptyViewClass; }\n\n if (hash.keyword) {\n itemHash._context = this;\n } else {\n itemHash._context = alias('content');\n }\n\n var viewOptions = ViewHelper.propertiesFromHTMLOptions({ data: data, hash: itemHash }, this);\n hash.itemViewClass = itemViewClass.extend(viewOptions);\n\n return helpers.view.call(this, collectionClass, options);\n }\n\n __exports__[\"default\"] = collectionHelper;\n });\ndefine(\"ember-handlebars/helpers/debug\",\n [\"ember-metal/core\",\"ember-metal/utils\",\"ember-metal/logger\",\"ember-metal/property_get\",\"ember-handlebars/ext\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {\n \"use strict\";\n /*jshint debug:true*/\n\n /**\n @module ember\n @submodule ember-handlebars\n */\n var Ember = __dependency1__[\"default\"];\n // Ember.FEATURES,\n var inspect = __dependency2__.inspect;\n var Logger = __dependency3__[\"default\"];\n\n var get = __dependency4__.get;\n var normalizePath = __dependency5__.normalizePath;\n var handlebarsGet = __dependency5__.handlebarsGet;\n\n var a_slice = [].slice;\n\n /**\n `log` allows you to output the value of variables in the current rendering\n context. `log` also accepts primitive types such as strings or numbers.\n\n ```handlebars\n {{log \"myVariable:\" myVariable }}\n ```\n\n @method log\n @for Ember.Handlebars.helpers\n @param {String} property\n */\n function logHelper() {\n var params = a_slice.call(arguments, 0, -1),\n options = arguments[arguments.length - 1],\n logger = Logger.log,\n values = [],\n allowPrimitives = true;\n\n for (var i = 0; i < params.length; i++) {\n var type = options.types[i];\n\n if (type === 'ID' || !allowPrimitives) {\n var context = (options.contexts && options.contexts[i]) || this,\n normalized = normalizePath(context, params[i], options.data);\n\n if (normalized.path === 'this') {\n values.push(normalized.root);\n } else {\n values.push(handlebarsGet(normalized.root, normalized.path, options));\n }\n } else {\n values.push(params[i]);\n }\n }\n\n logger.apply(logger, values);\n };\n\n /**\n Execute the `debugger` statement in the current context.\n\n ```handlebars\n {{debugger}}\n ```\n\n Before invoking the `debugger` statement, there\n are a few helpful variables defined in the\n body of this helper that you can inspect while\n debugging that describe how and where this\n helper was invoked:\n\n - templateContext: this is most likely a controller\n from which this template looks up / displays properties\n - typeOfTemplateContext: a string description of\n what the templateContext is\n\n For example, if you're wondering why a value `{{foo}}`\n isn't rendering as expected within a template, you\n could place a `{{debugger}}` statement, and when\n the `debugger;` breakpoint is hit, you can inspect\n `templateContext`, determine if it's the object you\n expect, and/or evaluate expressions in the console\n to perform property lookups on the `templateContext`:\n\n ```\n > templateContext.get('foo') // -> \"\"\n ```\n\n @method debugger\n @for Ember.Handlebars.helpers\n @param {String} property\n */\n function debuggerHelper(options) {\n\n // These are helpful values you can inspect while debugging.\n var templateContext = this;\n var typeOfTemplateContext = inspect(templateContext);\n\n debugger;\n }\n\n __exports__.logHelper = logHelper;\n __exports__.debuggerHelper = debuggerHelper;\n });\ndefine(\"ember-handlebars/helpers/each\",\n [\"ember-metal/core\",\"ember-handlebars-compiler\",\"ember-runtime/system/string\",\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-handlebars/views/metamorph_view\",\"ember-views/views/collection_view\",\"ember-metal/binding\",\"ember-runtime/controllers/controller\",\"ember-runtime/controllers/array_controller\",\"ember-runtime/mixins/array\",\"ember-runtime/copy\",\"ember-metal/run_loop\",\"ember-metal/observer\",\"ember-metal/events\",\"ember-handlebars/ext\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __exports__) {\n \"use strict\";\n\n /**\n @module ember\n @submodule ember-handlebars\n */\n var Ember = __dependency1__[\"default\"];\n // Ember.assert;, Ember.K\n // var emberAssert = Ember.assert,\n var K = Ember.K;\n\n var EmberHandlebars = __dependency2__[\"default\"];\n var helpers = EmberHandlebars.helpers;\n\n var fmt = __dependency3__.fmt;\n var get = __dependency4__.get;\n var set = __dependency5__.set;\n var _Metamorph = __dependency6__._Metamorph;\n var _MetamorphView = __dependency6__._MetamorphView;\n var CollectionView = __dependency7__[\"default\"];\n var Binding = __dependency8__.Binding;\n var ControllerMixin = __dependency9__.ControllerMixin;\n var ArrayController = __dependency10__[\"default\"];\n var EmberArray = __dependency11__[\"default\"];\n var copy = __dependency12__[\"default\"];\n var run = __dependency13__[\"default\"];\n var addObserver = __dependency14__.addObserver;\n var removeObserver = __dependency14__.removeObserver;\n var addBeforeObserver = __dependency14__.addBeforeObserver;\n var removeBeforeObserver = __dependency14__.removeBeforeObserver;\n var on = __dependency15__.on;\n\n var handlebarsGet = __dependency16__.handlebarsGet;\n\n var EachView = CollectionView.extend(_Metamorph, {\n init: function() {\n var itemController = get(this, 'itemController');\n var binding;\n\n if (itemController) {\n var controller = get(this, 'controller.container').lookupFactory('controller:array').create({\n _isVirtual: true,\n parentController: get(this, 'controller'),\n itemController: itemController,\n target: get(this, 'controller'),\n _eachView: this\n });\n\n this.disableContentObservers(function() {\n set(this, 'content', controller);\n binding = new Binding('content', '_eachView.dataSource').oneWay();\n binding.connect(controller);\n });\n\n set(this, '_arrayController', controller);\n } else {\n this.disableContentObservers(function() {\n binding = new Binding('content', 'dataSource').oneWay();\n binding.connect(this);\n });\n }\n\n return this._super();\n },\n\n _assertArrayLike: function(content) {\n Ember.assert(fmt(\"The value that #each loops over must be an Array. You \" +\n \"passed %@, but it should have been an ArrayController\",\n [content.constructor]),\n !ControllerMixin.detect(content) ||\n (content && content.isGenerated) ||\n content instanceof ArrayController);\n Ember.assert(fmt(\"The value that #each loops over must be an Array. You passed %@\", [(ControllerMixin.detect(content) && content.get('model') !== undefined) ? fmt(\"'%@' (wrapped in %@)\", [content.get('model'), content]) : content]), EmberArray.detect(content));\n },\n\n disableContentObservers: function(callback) {\n removeBeforeObserver(this, 'content', null, '_contentWillChange');\n removeObserver(this, 'content', null, '_contentDidChange');\n\n callback.call(this);\n\n addBeforeObserver(this, 'content', null, '_contentWillChange');\n addObserver(this, 'content', null, '_contentDidChange');\n },\n\n itemViewClass: _MetamorphView,\n emptyViewClass: _MetamorphView,\n\n createChildView: function(view, attrs) {\n view = this._super(view, attrs);\n\n // At the moment, if a container view subclass wants\n // to insert keywords, it is responsible for cloning\n // the keywords hash. This will be fixed momentarily.\n var keyword = get(this, 'keyword');\n var content = get(view, 'content');\n\n if (keyword) {\n var data = get(view, 'templateData');\n\n data = copy(data);\n data.keywords = view.cloneKeywords();\n set(view, 'templateData', data);\n\n // In this case, we do not bind, because the `content` of\n // a #each item cannot change.\n data.keywords[keyword] = content;\n }\n\n // If {{#each}} is looping over an array of controllers,\n // point each child view at their respective controller.\n if (content && content.isController) {\n set(view, 'controller', content);\n }\n\n return view;\n },\n\n destroy: function() {\n if (!this._super()) { return; }\n\n var arrayController = get(this, '_arrayController');\n\n if (arrayController) {\n arrayController.destroy();\n }\n\n return this;\n }\n });\n\n // Defeatureify doesn't seem to like nested functions that need to be removed\n function _addMetamorphCheck() {\n EachView.reopen({\n _checkMetamorph: on('didInsertElement', function() {\n Ember.assert(\"The metamorph tags, \" +\n this.morph.start + \" and \" + this.morph.end +\n \", have different parents.\\nThe browser has fixed your template to output valid HTML (for example, check that you have properly closed all tags and have used a TBODY tag when creating a table with '{{#each}}')\",\n document.getElementById( this.morph.start ).parentNode ===\n document.getElementById( this.morph.end ).parentNode\n );\n })\n });\n }\n\n // until ember-debug is es6ed\n var runInDebug = function(f){f()};\n runInDebug( function() {\n _addMetamorphCheck();\n });\n\n var GroupedEach = EmberHandlebars.GroupedEach = function(context, path, options) {\n var self = this,\n normalized = EmberHandlebars.normalizePath(context, path, options.data);\n\n this.context = context;\n this.path = path;\n this.options = options;\n this.template = options.fn;\n this.containingView = options.data.view;\n this.normalizedRoot = normalized.root;\n this.normalizedPath = normalized.path;\n this.content = this.lookupContent();\n\n this.addContentObservers();\n this.addArrayObservers();\n\n this.containingView.on('willClearRender', function() {\n self.destroy();\n });\n };\n\n GroupedEach.prototype = {\n contentWillChange: function() {\n this.removeArrayObservers();\n },\n\n contentDidChange: function() {\n this.content = this.lookupContent();\n this.addArrayObservers();\n this.rerenderContainingView();\n },\n\n contentArrayWillChange: K,\n\n contentArrayDidChange: function() {\n this.rerenderContainingView();\n },\n\n lookupContent: function() {\n return handlebarsGet(this.normalizedRoot, this.normalizedPath, this.options);\n },\n\n addArrayObservers: function() {\n if (!this.content) { return; }\n\n this.content.addArrayObserver(this, {\n willChange: 'contentArrayWillChange',\n didChange: 'contentArrayDidChange'\n });\n },\n\n removeArrayObservers: function() {\n if (!this.content) { return; }\n\n this.content.removeArrayObserver(this, {\n willChange: 'contentArrayWillChange',\n didChange: 'contentArrayDidChange'\n });\n },\n\n addContentObservers: function() {\n addBeforeObserver(this.normalizedRoot, this.normalizedPath, this, this.contentWillChange);\n addObserver(this.normalizedRoot, this.normalizedPath, this, this.contentDidChange);\n },\n\n removeContentObservers: function() {\n removeBeforeObserver(this.normalizedRoot, this.normalizedPath, this.contentWillChange);\n removeObserver(this.normalizedRoot, this.normalizedPath, this.contentDidChange);\n },\n\n render: function() {\n if (!this.content) { return; }\n\n var content = this.content,\n contentLength = get(content, 'length'),\n data = this.options.data,\n template = this.template;\n\n data.insideEach = true;\n for (var i = 0; i < contentLength; i++) {\n template(content.objectAt(i), { data: data });\n }\n },\n\n rerenderContainingView: function() {\n var self = this;\n run.scheduleOnce('render', this, function() {\n // It's possible it's been destroyed after we enqueued a re-render call.\n if (!self.destroyed) {\n self.containingView.rerender();\n }\n });\n },\n\n destroy: function() {\n this.removeContentObservers();\n if (this.content) {\n this.removeArrayObservers();\n }\n this.destroyed = true;\n }\n };\n\n /**\n The `{{#each}}` helper loops over elements in a collection, rendering its\n block once for each item. It is an extension of the base Handlebars `{{#each}}`\n helper:\n\n ```javascript\n Developers = [{name: 'Yehuda'},{name: 'Tom'}, {name: 'Paul'}];\n ```\n\n ```handlebars\n {{#each Developers}}\n {{name}}\n {{/each}}\n ```\n\n `{{each}}` supports an alternative syntax with element naming:\n\n ```handlebars\n {{#each person in Developers}}\n {{person.name}}\n {{/each}}\n ```\n\n When looping over objects that do not have properties, `{{this}}` can be used\n to render the object:\n\n ```javascript\n DeveloperNames = ['Yehuda', 'Tom', 'Paul']\n ```\n\n ```handlebars\n {{#each DeveloperNames}}\n {{this}}\n {{/each}}\n ```\n ### {{else}} condition\n `{{#each}}` can have a matching `{{else}}`. The contents of this block will render\n if the collection is empty.\n\n ```\n {{#each person in Developers}}\n {{person.name}}\n {{else}}\n

    Sorry, nobody is available for this task.

    \n {{/each}}\n ```\n ### Specifying a View class for items\n If you provide an `itemViewClass` option that references a view class\n with its own `template` you can omit the block.\n\n The following template:\n\n ```handlebars\n {{#view App.MyView }}\n {{each view.items itemViewClass=\"App.AnItemView\"}}\n {{/view}}\n ```\n\n And application code\n\n ```javascript\n App = Ember.Application.create({\n MyView: Ember.View.extend({\n items: [\n Ember.Object.create({name: 'Dave'}),\n Ember.Object.create({name: 'Mary'}),\n Ember.Object.create({name: 'Sara'})\n ]\n })\n });\n\n App.AnItemView = Ember.View.extend({\n template: Ember.Handlebars.compile(\"Greetings {{name}}\")\n });\n ```\n\n Will result in the HTML structure below\n\n ```html\n
    \n
    Greetings Dave
    \n
    Greetings Mary
    \n
    Greetings Sara
    \n
    \n ```\n\n If an `itemViewClass` is defined on the helper, and therefore the helper is not\n being used as a block, an `emptyViewClass` can also be provided optionally.\n The `emptyViewClass` will match the behavior of the `{{else}}` condition\n described above. That is, the `emptyViewClass` will render if the collection\n is empty.\n\n ### Representing each item with a Controller.\n By default the controller lookup within an `{{#each}}` block will be\n the controller of the template where the `{{#each}}` was used. If each\n item needs to be presented by a custom controller you can provide a\n `itemController` option which references a controller by lookup name.\n Each item in the loop will be wrapped in an instance of this controller\n and the item itself will be set to the `content` property of that controller.\n\n This is useful in cases where properties of model objects need transformation\n or synthesis for display:\n\n ```javascript\n App.DeveloperController = Ember.ObjectController.extend({\n isAvailableForHire: function() {\n return !this.get('content.isEmployed') && this.get('content.isSeekingWork');\n }.property('isEmployed', 'isSeekingWork')\n })\n ```\n\n ```handlebars\n {{#each person in developers itemController=\"developer\"}}\n {{person.name}} {{#if person.isAvailableForHire}}Hire me!{{/if}}\n {{/each}}\n ```\n\n Each itemController will receive a reference to the current controller as\n a `parentController` property.\n\n ### (Experimental) Grouped Each\n\n When used in conjunction with the experimental [group helper](https://github.com/emberjs/group-helper),\n you can inform Handlebars to re-render an entire group of items instead of\n re-rendering them one at a time (in the event that they are changed en masse\n or an item is added/removed).\n\n ```handlebars\n {{#group}}\n {{#each people}}\n {{firstName}} {{lastName}}\n {{/each}}\n {{/group}}\n ```\n\n This can be faster than the normal way that Handlebars re-renders items\n in some cases.\n\n If for some reason you have a group with more than one `#each`, you can make\n one of the collections be updated in normal (non-grouped) fashion by setting\n the option `groupedRows=true` (counter-intuitive, I know).\n\n For example,\n\n ```handlebars\n {{dealershipName}}\n\n {{#group}}\n {{#each dealers}}\n {{firstName}} {{lastName}}\n {{/each}}\n\n {{#each car in cars groupedRows=true}}\n {{car.make}} {{car.model}} {{car.color}}\n {{/each}}\n {{/group}}\n ```\n Any change to `dealershipName` or the `dealers` collection will cause the\n entire group to be re-rendered. However, changes to the `cars` collection\n will be re-rendered individually (as normal).\n\n Note that `group` behavior is also disabled by specifying an `itemViewClass`.\n\n @method each\n @for Ember.Handlebars.helpers\n @param [name] {String} name for item (used with `in`)\n @param [path] {String} path\n @param [options] {Object} Handlebars key/value pairs of options\n @param [options.itemViewClass] {String} a path to a view class used for each item\n @param [options.itemController] {String} name of a controller to be created for each item\n @param [options.groupedRows] {boolean} enable normal item-by-item rendering when inside a `#group` helper\n */\n function eachHelper(path, options) {\n var ctx;\n\n if (arguments.length === 4) {\n Ember.assert(\"If you pass more than one argument to the each helper, it must be in the form #each foo in bar\", arguments[1] === \"in\");\n\n var keywordName = arguments[0];\n\n options = arguments[3];\n path = arguments[2];\n if (path === '') { path = \"this\"; }\n\n options.hash.keyword = keywordName;\n }\n\n if (arguments.length === 1) {\n options = path;\n path = 'this';\n }\n\n options.hash.dataSourceBinding = path;\n // Set up emptyView as a metamorph with no tag\n //options.hash.emptyViewClass = Ember._MetamorphView;\n\n // can't rely on this default behavior when use strict\n ctx = this || window;\n if (options.data.insideGroup && !options.hash.groupedRows && !options.hash.itemViewClass) {\n new GroupedEach(ctx, path, options).render();\n } else {\n // ES6TODO: figure out how to do this without global lookup.\n return helpers.collection.call(ctx, 'Ember.Handlebars.EachView', options);\n }\n }\n\n __exports__.EachView = EachView;\n __exports__.GroupedEach = GroupedEach;\n __exports__.eachHelper = eachHelper;\n });\ndefine(\"ember-handlebars/helpers/loc\",\n [\"ember-runtime/system/string\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var loc = __dependency1__.loc;\n\n /**\n @module ember\n @submodule ember-handlebars\n */\n\n // ES6TODO:\n // Pretty sure this can be expressed as\n // var locHelper EmberStringUtils.loc ?\n\n /**\n Calls [Ember.String.loc](/api/classes/Ember.String.html#method_loc) with the\n provided string.\n\n This is a convenient way to localize text. For example:\n\n ```html\n \n ```\n\n Take note that `\"welcome\"` is a string and not an object\n reference.\n\n See [Ember.String.loc](/api/classes/Ember.String.html#method_loc) for how to \n set up localized string references.\n\n @method loc\n @for Ember.Handlebars.helpers\n @param {String} str The string to format\n @see {Ember.String#loc}\n */\n function locHelper(str) {\n return loc(str);\n }\n\n __exports__[\"default\"] = locHelper;\n });\ndefine(\"ember-handlebars/helpers/partial\",\n [\"ember-metal/core\",\"ember-metal/is_none\",\"ember-handlebars/ext\",\"ember-handlebars/helpers/binding\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {\n \"use strict\";\n var Ember = __dependency1__[\"default\"];\n // Ember.assert\n // var emberAssert = Ember.assert;\n\n var isNone = __dependency2__.isNone;\n var handlebarsGet = __dependency3__.handlebarsGet;\n var bind = __dependency4__.bind;\n\n /**\n @module ember\n @submodule ember-handlebars\n */\n\n /**\n The `partial` helper renders another template without\n changing the template context:\n\n ```handlebars\n {{foo}}\n {{partial \"nav\"}}\n ```\n\n The above example template will render a template named\n \"_nav\", which has the same context as the parent template\n it's rendered into, so if the \"_nav\" template also referenced\n `{{foo}}`, it would print the same thing as the `{{foo}}`\n in the above example.\n\n If a \"_nav\" template isn't found, the `partial` helper will\n fall back to a template named \"nav\".\n\n ## Bound template names\n\n The parameter supplied to `partial` can also be a path\n to a property containing a template name, e.g.:\n\n ```handlebars\n {{partial someTemplateName}}\n ```\n\n The above example will look up the value of `someTemplateName`\n on the template context (e.g. a controller) and use that\n value as the name of the template to render. If the resolved\n value is falsy, nothing will be rendered. If `someTemplateName`\n changes, the partial will be re-rendered using the new template\n name.\n\n ## Setting the partial's context with `with`\n\n The `partial` helper can be used in conjunction with the `with`\n helper to set a context that will be used by the partial:\n\n ```handlebars\n {{#with currentUser}}\n {{partial \"user_info\"}}\n {{/with}}\n ```\n\n @method partial\n @for Ember.Handlebars.helpers\n @param {String} partialName the name of the template to render minus the leading underscore\n */\n\n function partialHelper(name, options) {\n\n var context = (options.contexts && options.contexts.length) ? options.contexts[0] : this;\n\n if (options.types[0] === \"ID\") {\n // Helper was passed a property path; we need to\n // create a binding that will re-render whenever\n // this property changes.\n options.fn = function(context, fnOptions) {\n var partialName = handlebarsGet(context, name, fnOptions);\n renderPartial(context, partialName, fnOptions);\n };\n\n return bind.call(context, name, options, true, exists);\n } else {\n // Render the partial right into parent template.\n renderPartial(context, name, options);\n }\n }\n\n function exists(value) {\n return !isNone(value);\n }\n\n function renderPartial(context, name, options) {\n var nameParts = name.split(\"/\"),\n lastPart = nameParts[nameParts.length - 1];\n\n nameParts[nameParts.length - 1] = \"_\" + lastPart;\n\n var view = options.data.view,\n underscoredName = nameParts.join(\"/\"),\n template = view.templateForName(underscoredName),\n deprecatedTemplate = !template && view.templateForName(name);\n\n Ember.assert(\"Unable to find partial with name '\"+name+\"'.\", template || deprecatedTemplate);\n\n template = template || deprecatedTemplate;\n\n template(context, { data: options.data });\n }\n\n __exports__[\"default\"] = partialHelper;\n });\ndefine(\"ember-handlebars/helpers/shared\",\n [\"ember-handlebars/ext\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var handlebarsGet = __dependency1__.handlebarsGet;\n\n function resolvePaths(options) {\n var ret = [],\n contexts = options.contexts,\n roots = options.roots,\n data = options.data;\n\n for (var i=0, l=contexts.length; i\n {{#with loggedInUser}}\n Last Login: {{lastLogin}}\n User Info: {{template \"user_info\"}}\n {{/with}}\n \n ```\n\n ```html\n \n ```\n\n ```handlebars\n {{#if isUser}}\n {{template \"user_info\"}}\n {{else}}\n {{template \"unlogged_user_info\"}}\n {{/if}}\n ```\n\n This helper looks for templates in the global `Ember.TEMPLATES` hash. If you\n add `\";\n return testEl.firstChild.innerHTML === '';\n })();\n\n // IE 8 (and likely earlier) likes to move whitespace preceeding\n // a script tag to appear after it. This means that we can\n // accidentally remove whitespace when updating a morph.\n var movesWhitespace = typeof document !== 'undefined' && (function() {\n var testEl = document.createElement('div');\n testEl.innerHTML = \"Test: Value\";\n return testEl.childNodes[0].nodeValue === 'Test:' &&\n testEl.childNodes[2].nodeValue === ' Value';\n })();\n\n // Use this to find children by ID instead of using jQuery\n var findChildById = function(element, id) {\n if (element.getAttribute('id') === id) { return element; }\n\n var len = element.childNodes.length, idx, node, found;\n for (idx=0; idx 0) {\n var len = matches.length, idx;\n for (idx=0; idxTest');\n canSet = el.options.length === 1;\n }\n\n innerHTMLTags[tagName] = canSet;\n\n return canSet;\n };\n\n var setInnerHTML = function(element, html) {\n var tagName = element.tagName;\n\n if (canSetInnerHTML(tagName)) {\n setInnerHTMLWithoutFix(element, html);\n } else {\n // Firefox versions < 11 do not have support for element.outerHTML.\n var outerHTML = element.outerHTML || new XMLSerializer().serializeToString(element);\n Ember.assert(\"Can't set innerHTML on \"+element.tagName+\" in this browser\", outerHTML);\n\n var startTag = outerHTML.match(new RegExp(\"<\"+tagName+\"([^>]*)>\", 'i'))[0],\n endTag = '';\n\n var wrapper = document.createElement('div');\n setInnerHTMLWithoutFix(wrapper, startTag + html + endTag);\n element = wrapper.firstChild;\n while (element.tagName !== tagName) {\n element = element.nextSibling;\n }\n }\n\n return element;\n };\n\n function isSimpleClick(event) {\n var modifier = event.shiftKey || event.metaKey || event.altKey || event.ctrlKey,\n secondaryClick = event.which > 1; // IE9 may return undefined\n\n return !modifier && !secondaryClick;\n }\n\n __exports__.setInnerHTML = setInnerHTML;\n __exports__.isSimpleClick = isSimpleClick;\n });\ndefine(\"ember-views/views/collection_view\",\n [\"ember-metal/core\",\"ember-metal/platform\",\"ember-metal/merge\",\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-runtime/system/string\",\"ember-views/views/container_view\",\"ember-views/views/view\",\"ember-metal/mixin\",\"ember-runtime/mixins/array\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __exports__) {\n \"use strict\";\n\n /**\n @module ember\n @submodule ember-views\n */\n\n var Ember = __dependency1__[\"default\"];\n // Ember.assert\n var create = __dependency2__.create;\n var merge = __dependency3__[\"default\"];\n var get = __dependency4__.get;\n var set = __dependency5__.set;\n var fmt = __dependency6__.fmt;\n var ContainerView = __dependency7__[\"default\"];\n var CoreView = __dependency8__.CoreView;\n var View = __dependency8__.View;\n var observer = __dependency9__.observer;\n var beforeObserver = __dependency9__.beforeObserver;\n var EmberArray = __dependency10__[\"default\"];\n\n /**\n `Ember.CollectionView` is an `Ember.View` descendent responsible for managing\n a collection (an array or array-like object) by maintaining a child view object\n and associated DOM representation for each item in the array and ensuring\n that child views and their associated rendered HTML are updated when items in\n the array are added, removed, or replaced.\n\n ## Setting content\n\n The managed collection of objects is referenced as the `Ember.CollectionView`\n instance's `content` property.\n\n ```javascript\n someItemsView = Ember.CollectionView.create({\n content: ['A', 'B','C']\n })\n ```\n\n The view for each item in the collection will have its `content` property set\n to the item.\n\n ## Specifying itemViewClass\n\n By default the view class for each item in the managed collection will be an\n instance of `Ember.View`. You can supply a different class by setting the\n `CollectionView`'s `itemViewClass` property.\n\n Given an empty `` and the following code:\n\n ```javascript\n someItemsView = Ember.CollectionView.create({\n classNames: ['a-collection'],\n content: ['A','B','C'],\n itemViewClass: Ember.View.extend({\n template: Ember.Handlebars.compile(\"the letter: {{view.content}}\")\n })\n });\n\n someItemsView.appendTo('body');\n ```\n\n Will result in the following HTML structure\n\n ```html\n
    \n
    the letter: A
    \n
    the letter: B
    \n
    the letter: C
    \n
    \n ```\n\n ## Automatic matching of parent/child tagNames\n\n Setting the `tagName` property of a `CollectionView` to any of\n \"ul\", \"ol\", \"table\", \"thead\", \"tbody\", \"tfoot\", \"tr\", or \"select\" will result\n in the item views receiving an appropriately matched `tagName` property.\n\n Given an empty `` and the following code:\n\n ```javascript\n anUnorderedListView = Ember.CollectionView.create({\n tagName: 'ul',\n content: ['A','B','C'],\n itemViewClass: Ember.View.extend({\n template: Ember.Handlebars.compile(\"the letter: {{view.content}}\")\n })\n });\n\n anUnorderedListView.appendTo('body');\n ```\n\n Will result in the following HTML structure\n\n ```html\n
      \n
    • the letter: A
    • \n
    • the letter: B
    • \n
    • the letter: C
    • \n
    \n ```\n\n Additional `tagName` pairs can be provided by adding to\n `Ember.CollectionView.CONTAINER_MAP `\n\n ```javascript\n Ember.CollectionView.CONTAINER_MAP['article'] = 'section'\n ```\n\n ## Programmatic creation of child views\n\n For cases where additional customization beyond the use of a single\n `itemViewClass` or `tagName` matching is required CollectionView's\n `createChildView` method can be overidden:\n\n ```javascript\n CustomCollectionView = Ember.CollectionView.extend({\n createChildView: function(viewClass, attrs) {\n if (attrs.content.kind == 'album') {\n viewClass = App.AlbumView;\n } else {\n viewClass = App.SongView;\n }\n return this._super(viewClass, attrs);\n }\n });\n ```\n\n ## Empty View\n\n You can provide an `Ember.View` subclass to the `Ember.CollectionView`\n instance as its `emptyView` property. If the `content` property of a\n `CollectionView` is set to `null` or an empty array, an instance of this view\n will be the `CollectionView`s only child.\n\n ```javascript\n aListWithNothing = Ember.CollectionView.create({\n classNames: ['nothing']\n content: null,\n emptyView: Ember.View.extend({\n template: Ember.Handlebars.compile(\"The collection is empty\")\n })\n });\n\n aListWithNothing.appendTo('body');\n ```\n\n Will result in the following HTML structure\n\n ```html\n
    \n
    \n The collection is empty\n
    \n
    \n ```\n\n ## Adding and Removing items\n\n The `childViews` property of a `CollectionView` should not be directly\n manipulated. Instead, add, remove, replace items from its `content` property.\n This will trigger appropriate changes to its rendered HTML.\n\n\n @class CollectionView\n @namespace Ember\n @extends Ember.ContainerView\n @since Ember 0.9\n */\n var CollectionView = ContainerView.extend({\n\n /**\n A list of items to be displayed by the `Ember.CollectionView`.\n\n @property content\n @type Ember.Array\n @default null\n */\n content: null,\n\n /**\n This provides metadata about what kind of empty view class this\n collection would like if it is being instantiated from another\n system (like Handlebars)\n\n @private\n @property emptyViewClass\n */\n emptyViewClass: View,\n\n /**\n An optional view to display if content is set to an empty array.\n\n @property emptyView\n @type Ember.View\n @default null\n */\n emptyView: null,\n\n /**\n @property itemViewClass\n @type Ember.View\n @default Ember.View\n */\n itemViewClass: View,\n\n /**\n Setup a CollectionView\n\n @method init\n */\n init: function() {\n var ret = this._super();\n this._contentDidChange();\n return ret;\n },\n\n /**\n Invoked when the content property is about to change. Notifies observers that the\n entire array content will change.\n\n @private\n @method _contentWillChange\n */\n _contentWillChange: beforeObserver('content', function() {\n var content = this.get('content');\n\n if (content) { content.removeArrayObserver(this); }\n var len = content ? get(content, 'length') : 0;\n this.arrayWillChange(content, 0, len);\n }),\n\n /**\n Check to make sure that the content has changed, and if so,\n update the children directly. This is always scheduled\n asynchronously, to allow the element to be created before\n bindings have synchronized and vice versa.\n\n @private\n @method _contentDidChange\n */\n _contentDidChange: observer('content', function() {\n var content = get(this, 'content');\n\n if (content) {\n this._assertArrayLike(content);\n content.addArrayObserver(this);\n }\n\n var len = content ? get(content, 'length') : 0;\n this.arrayDidChange(content, 0, null, len);\n }),\n\n /**\n Ensure that the content implements Ember.Array\n\n @private\n @method _assertArrayLike\n */\n _assertArrayLike: function(content) {\n Ember.assert(fmt(\"an Ember.CollectionView's content must implement Ember.Array. You passed %@\", [content]), EmberArray.detect(content));\n },\n\n /**\n Removes the content and content observers.\n\n @method destroy\n */\n destroy: function() {\n if (!this._super()) { return; }\n\n var content = get(this, 'content');\n if (content) { content.removeArrayObserver(this); }\n\n if (this._createdEmptyView) {\n this._createdEmptyView.destroy();\n }\n\n return this;\n },\n\n /**\n Called when a mutation to the underlying content array will occur.\n\n This method will remove any views that are no longer in the underlying\n content array.\n\n Invokes whenever the content array itself will change.\n\n @method arrayWillChange\n @param {Array} content the managed collection of objects\n @param {Number} start the index at which the changes will occurr\n @param {Number} removed number of object to be removed from content\n */\n arrayWillChange: function(content, start, removedCount) {\n // If the contents were empty before and this template collection has an\n // empty view remove it now.\n var emptyView = get(this, 'emptyView');\n if (emptyView && emptyView instanceof View) {\n emptyView.removeFromParent();\n }\n\n // Loop through child views that correspond with the removed items.\n // Note that we loop from the end of the array to the beginning because\n // we are mutating it as we go.\n var childViews = this._childViews, childView, idx, len;\n\n len = this._childViews.length;\n\n var removingAll = removedCount === len;\n\n if (removingAll) {\n this.currentState.empty(this);\n this.invokeRecursively(function(view) {\n view.removedFromDOM = true;\n }, false);\n }\n\n for (idx = start + removedCount - 1; idx >= start; idx--) {\n childView = childViews[idx];\n childView.destroy();\n }\n },\n\n /**\n Called when a mutation to the underlying content array occurs.\n\n This method will replay that mutation against the views that compose the\n `Ember.CollectionView`, ensuring that the view reflects the model.\n\n This array observer is added in `contentDidChange`.\n\n @method arrayDidChange\n @param {Array} content the managed collection of objects\n @param {Number} start the index at which the changes occurred\n @param {Number} removed number of object removed from content\n @param {Number} added number of object added to content\n */\n arrayDidChange: function(content, start, removed, added) {\n var addedViews = [], view, item, idx, len, itemViewClass,\n emptyView;\n\n len = content ? get(content, 'length') : 0;\n\n if (len) {\n itemViewClass = get(this, 'itemViewClass');\n\n if ('string' === typeof itemViewClass) {\n itemViewClass = get(itemViewClass) || itemViewClass;\n }\n\n Ember.assert(fmt(\"itemViewClass must be a subclass of Ember.View, not %@\",\n [itemViewClass]),\n 'string' === typeof itemViewClass || View.detect(itemViewClass));\n\n for (idx = start; idx < start+added; idx++) {\n item = content.objectAt(idx);\n\n view = this.createChildView(itemViewClass, {\n content: item,\n contentIndex: idx\n });\n\n addedViews.push(view);\n }\n } else {\n emptyView = get(this, 'emptyView');\n\n if (!emptyView) { return; }\n\n if ('string' === typeof emptyView) {\n emptyView = get(emptyView) || emptyView;\n }\n\n emptyView = this.createChildView(emptyView);\n addedViews.push(emptyView);\n set(this, 'emptyView', emptyView);\n\n if (CoreView.detect(emptyView)) {\n this._createdEmptyView = emptyView;\n }\n }\n\n this.replace(start, 0, addedViews);\n },\n\n /**\n Instantiates a view to be added to the childViews array during view\n initialization. You generally will not call this method directly unless\n you are overriding `createChildViews()`. Note that this method will\n automatically configure the correct settings on the new view instance to\n act as a child of the parent.\n\n The tag name for the view will be set to the tagName of the viewClass\n passed in.\n\n @method createChildView\n @param {Class} viewClass\n @param {Hash} [attrs] Attributes to add\n @return {Ember.View} new instance\n */\n createChildView: function(view, attrs) {\n view = this._super(view, attrs);\n\n var itemTagName = get(view, 'tagName');\n\n if (itemTagName === null || itemTagName === undefined) {\n itemTagName = CollectionView.CONTAINER_MAP[get(this, 'tagName')];\n set(view, 'tagName', itemTagName);\n }\n\n return view;\n }\n });\n\n /**\n A map of parent tags to their default child tags. You can add\n additional parent tags if you want collection views that use\n a particular parent tag to default to a child tag.\n\n @property CONTAINER_MAP\n @type Hash\n @static\n @final\n */\n CollectionView.CONTAINER_MAP = {\n ul: 'li',\n ol: 'li',\n table: 'tr',\n thead: 'tr',\n tbody: 'tr',\n tfoot: 'tr',\n tr: 'td',\n select: 'option'\n };\n\n __exports__[\"default\"] = CollectionView;\n });\ndefine(\"ember-views/views/component\",\n [\"ember-metal/core\",\"ember-views/mixins/component_template_deprecation\",\"ember-runtime/mixins/target_action_support\",\"ember-views/views/view\",\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-metal/is_none\",\"ember-metal/computed\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __exports__) {\n \"use strict\";\n var Ember = __dependency1__[\"default\"];\n // Ember.assert, Ember.Handlebars\n\n var ComponentTemplateDeprecation = __dependency2__[\"default\"];\n var TargetActionSupport = __dependency3__[\"default\"];\n var View = __dependency4__.View;var get = __dependency5__.get;\n var set = __dependency6__.set;\n var isNone = __dependency7__.isNone;\n\n var computed = __dependency8__.computed;\n\n var a_slice = Array.prototype.slice;\n\n /**\n @module ember\n @submodule ember-views\n */\n\n /**\n An `Ember.Component` is a view that is completely\n isolated. Property access in its templates go\n to the view object and actions are targeted at\n the view object. There is no access to the\n surrounding context or outer controller; all\n contextual information must be passed in.\n\n The easiest way to create an `Ember.Component` is via\n a template. If you name a template\n `components/my-foo`, you will be able to use\n `{{my-foo}}` in other templates, which will make\n an instance of the isolated component.\n\n ```handlebars\n {{app-profile person=currentUser}}\n ```\n\n ```handlebars\n \n

    {{person.title}}

    \n \n

    {{person.signature}}

    \n ```\n\n You can use `yield` inside a template to\n include the **contents** of any block attached to\n the component. The block will be executed in the\n context of the surrounding context or outer controller:\n\n ```handlebars\n {{#app-profile person=currentUser}}\n

    Admin mode

    \n {{! Executed in the controller's context. }}\n {{/app-profile}}\n ```\n\n ```handlebars\n \n

    {{person.title}}

    \n {{! Executed in the components context. }}\n {{yield}} {{! block contents }}\n ```\n\n If you want to customize the component, in order to\n handle events or actions, you implement a subclass\n of `Ember.Component` named after the name of the\n component. Note that `Component` needs to be appended to the name of\n your subclass like `AppProfileComponent`.\n\n For example, you could implement the action\n `hello` for the `app-profile` component:\n\n ```javascript\n App.AppProfileComponent = Ember.Component.extend({\n actions: {\n hello: function(name) {\n console.log(\"Hello\", name);\n }\n }\n });\n ```\n\n And then use it in the component's template:\n\n ```handlebars\n \n\n

    {{person.title}}

    \n {{yield}} \n\n \n ```\n\n Components must have a `-` in their name to avoid\n conflicts with built-in controls that wrap HTML\n elements. This is consistent with the same\n requirement in web components.\n\n @class Component\n @namespace Ember\n @extends Ember.View\n */\n var Component = View.extend(TargetActionSupport, ComponentTemplateDeprecation, {\n init: function() {\n this._super();\n set(this, 'context', this);\n set(this, 'controller', this);\n },\n\n defaultLayout: function(context, options){\n Ember.Handlebars.helpers['yield'].call(context, options);\n },\n\n /**\n A components template property is set by passing a block\n during its invocation. It is executed within the parent context.\n\n Example:\n\n ```handlebars\n {{#my-component}}\n // something that is run in the context\n // of the parent context\n {{/my-component}}\n ```\n\n Specifying a template directly to a component is deprecated without\n also specifying the layout property.\n\n @deprecated\n @property template\n */\n template: computed(function(key, value) {\n if (value !== undefined) { return value; }\n\n var templateName = get(this, 'templateName'),\n template = this.templateForName(templateName, 'template');\n\n Ember.assert(\"You specified the templateName \" + templateName + \" for \" + this + \", but it did not exist.\", !templateName || template);\n\n return template || get(this, 'defaultTemplate');\n }).property('templateName'),\n\n /**\n Specifying a components `templateName` is deprecated without also\n providing the `layout` or `layoutName` properties.\n\n @deprecated\n @property templateName\n */\n templateName: null,\n\n // during render, isolate keywords\n cloneKeywords: function() {\n return {\n view: this,\n controller: this\n };\n },\n\n _yield: function(context, options) {\n var view = options.data.view,\n parentView = this._parentView,\n template = get(this, 'template');\n\n if (template) {\n Ember.assert(\"A Component must have a parent view in order to yield.\", parentView);\n\n view.appendChild(View, {\n isVirtual: true,\n tagName: '',\n _contextView: parentView,\n template: template,\n context: get(parentView, 'context'),\n controller: get(parentView, 'controller'),\n templateData: { keywords: parentView.cloneKeywords() }\n });\n }\n },\n\n /**\n If the component is currently inserted into the DOM of a parent view, this\n property will point to the controller of the parent view.\n\n @property targetObject\n @type Ember.Controller\n @default null\n */\n targetObject: computed(function(key) {\n var parentView = get(this, '_parentView');\n return parentView ? get(parentView, 'controller') : null;\n }).property('_parentView'),\n\n /**\n Triggers a named action on the controller context where the component is used if\n this controller has registered for notifications of the action.\n\n For example a component for playing or pausing music may translate click events\n into action notifications of \"play\" or \"stop\" depending on some internal state\n of the component:\n\n\n ```javascript\n App.PlayButtonComponent = Ember.Component.extend({\n click: function(){\n if (this.get('isPlaying')) {\n this.sendAction('play');\n } else {\n this.sendAction('stop');\n }\n }\n });\n ```\n\n When used inside a template these component actions are configured to\n trigger actions in the outer application context:\n\n ```handlebars\n {{! application.hbs }}\n {{play-button play=\"musicStarted\" stop=\"musicStopped\"}}\n ```\n\n When the component receives a browser `click` event it translate this\n interaction into application-specific semantics (\"play\" or \"stop\") and\n triggers the specified action name on the controller for the template\n where the component is used:\n\n\n ```javascript\n App.ApplicationController = Ember.Controller.extend({\n actions: {\n musicStarted: function(){\n // called when the play button is clicked\n // and the music started playing\n },\n musicStopped: function(){\n // called when the play button is clicked\n // and the music stopped playing\n }\n }\n });\n ```\n\n If no action name is passed to `sendAction` a default name of \"action\"\n is assumed.\n\n ```javascript\n App.NextButtonComponent = Ember.Component.extend({\n click: function(){\n this.sendAction();\n }\n });\n ```\n\n ```handlebars\n {{! application.hbs }}\n {{next-button action=\"playNextSongInAlbum\"}}\n ```\n\n ```javascript\n App.ApplicationController = Ember.Controller.extend({\n actions: {\n playNextSongInAlbum: function(){\n ...\n }\n }\n });\n ```\n\n @method sendAction\n @param [action] {String} the action to trigger\n @param [context] {*} a context to send with the action\n */\n sendAction: function(action) {\n var actionName,\n contexts = a_slice.call(arguments, 1);\n\n // Send the default action\n if (action === undefined) {\n actionName = get(this, 'action');\n Ember.assert(\"The default action was triggered on the component \" + this.toString() +\n \", but the action name (\" + actionName + \") was not a string.\",\n isNone(actionName) || typeof actionName === 'string');\n } else {\n actionName = get(this, action);\n Ember.assert(\"The \" + action + \" action was triggered on the component \" +\n this.toString() + \", but the action name (\" + actionName +\n \") was not a string.\",\n isNone(actionName) || typeof actionName === 'string');\n }\n\n // If no action name for that action could be found, just abort.\n if (actionName === undefined) { return; }\n\n this.triggerAction({\n action: actionName,\n actionContext: contexts\n });\n }\n });\n\n __exports__[\"default\"] = Component;\n });\ndefine(\"ember-views/views/container_view\",\n [\"ember-metal/core\",\"ember-metal/merge\",\"ember-runtime/mixins/mutable_array\",\"ember-metal/property_get\",\"ember-metal/property_set\",\"ember-views/views/view\",\"ember-views/views/states\",\"ember-metal/error\",\"ember-metal/enumerable_utils\",\"ember-metal/computed\",\"ember-metal/run_loop\",\"ember-metal/properties\",\"ember-views/system/render_buffer\",\"ember-metal/mixin\",\"ember-runtime/system/native_array\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __exports__) {\n \"use strict\";\n var Ember = __dependency1__[\"default\"];\n // Ember.assert, Ember.K\n\n var merge = __dependency2__[\"default\"];\n var MutableArray = __dependency3__[\"default\"];\n var get = __dependency4__.get;\n var set = __dependency5__.set;\n\n var View = __dependency6__.View;\n var ViewCollection = __dependency6__.ViewCollection;\n var cloneStates = __dependency7__.cloneStates;\n var EmberViewStates = __dependency7__.states;\n\n var EmberError = __dependency8__[\"default\"];\n\n // ES6TODO: functions on EnumerableUtils should get their own export\n var EnumerableUtils = __dependency9__[\"default\"];\n var forEach = EnumerableUtils.forEach;\n\n var computed = __dependency10__.computed;\n var run = __dependency11__[\"default\"];\n var defineProperty = __dependency12__.defineProperty;\n var RenderBuffer = __dependency13__[\"default\"];\n var observer = __dependency14__.observer;\n var beforeObserver = __dependency14__.beforeObserver;\n var A = __dependency15__.A;\n\n /**\n @module ember\n @submodule ember-views\n */\n\n var states = cloneStates(EmberViewStates);\n\n /**\n A `ContainerView` is an `Ember.View` subclass that implements `Ember.MutableArray`\n allowing programmatic management of its child views.\n\n ## Setting Initial Child Views\n\n The initial array of child views can be set in one of two ways. You can\n provide a `childViews` property at creation time that contains instance of\n `Ember.View`:\n\n ```javascript\n aContainer = Ember.ContainerView.create({\n childViews: [Ember.View.create(), Ember.View.create()]\n });\n ```\n\n You can also provide a list of property names whose values are instances of\n `Ember.View`:\n\n ```javascript\n aContainer = Ember.ContainerView.create({\n childViews: ['aView', 'bView', 'cView'],\n aView: Ember.View.create(),\n bView: Ember.View.create(),\n cView: Ember.View.create()\n });\n ```\n\n The two strategies can be combined:\n\n ```javascript\n aContainer = Ember.ContainerView.create({\n childViews: ['aView', Ember.View.create()],\n aView: Ember.View.create()\n });\n ```\n\n Each child view's rendering will be inserted into the container's rendered\n HTML in the same order as its position in the `childViews` property.\n\n ## Adding and Removing Child Views\n\n The container view implements `Ember.MutableArray` allowing programmatic management of its child views.\n\n To remove a view, pass that view into a `removeObject` call on the container view.\n\n Given an empty `` the following code\n\n ```javascript\n aContainer = Ember.ContainerView.create({\n classNames: ['the-container'],\n childViews: ['aView', 'bView'],\n aView: Ember.View.create({\n template: Ember.Handlebars.compile(\"A\")\n }),\n bView: Ember.View.create({\n template: Ember.Handlebars.compile(\"B\")\n })\n });\n\n aContainer.appendTo('body');\n ```\n\n Results in the HTML\n\n ```html\n
    \n
    A
    \n
    B
    \n
    \n ```\n\n Removing a view\n\n ```javascript\n aContainer.toArray(); // [aContainer.aView, aContainer.bView]\n aContainer.removeObject(aContainer.get('bView'));\n aContainer.toArray(); // [aContainer.aView]\n ```\n\n Will result in the following HTML\n\n ```html\n
    \n
    A
    \n
    \n ```\n\n Similarly, adding a child view is accomplished by adding `Ember.View` instances to the\n container view.\n\n Given an empty `` the following code\n\n ```javascript\n aContainer = Ember.ContainerView.create({\n classNames: ['the-container'],\n childViews: ['aView', 'bView'],\n aView: Ember.View.create({\n template: Ember.Handlebars.compile(\"A\")\n }),\n bView: Ember.View.create({\n template: Ember.Handlebars.compile(\"B\")\n })\n });\n\n aContainer.appendTo('body');\n ```\n\n Results in the HTML\n\n ```html\n
    \n
    A
    \n
    B
    \n
    \n ```\n\n Adding a view\n\n ```javascript\n AnotherViewClass = Ember.View.extend({\n template: Ember.Handlebars.compile(\"Another view\")\n });\n\n aContainer.toArray(); // [aContainer.aView, aContainer.bView]\n aContainer.pushObject(AnotherViewClass.create());\n aContainer.toArray(); // [aContainer.aView, aContainer.bView, ]\n ```\n\n Will result in the following HTML\n\n ```html\n
    \n
    A
    \n
    B
    \n
    Another view
    \n
    \n ```\n\n ## Templates and Layout\n\n A `template`, `templateName`, `defaultTemplate`, `layout`, `layoutName` or\n `defaultLayout` property on a container view will not result in the template\n or layout being rendered. The HTML contents of a `Ember.ContainerView`'s DOM\n representation will only be the rendered HTML of its child views.\n\n @class ContainerView\n @namespace Ember\n @extends Ember.View\n */\n var ContainerView = View.extend(MutableArray, {\n states: states,\n\n init: function() {\n this._super();\n\n var childViews = get(this, 'childViews');\n\n // redefine view's childViews property that was obliterated\n defineProperty(this, 'childViews', View.childViewsProperty);\n\n var _childViews = this._childViews;\n\n forEach(childViews, function(viewName, idx) {\n var view;\n\n if ('string' === typeof viewName) {\n view = get(this, viewName);\n view = this.createChildView(view);\n set(this, viewName, view);\n } else {\n view = this.createChildView(viewName);\n }\n\n _childViews[idx] = view;\n }, this);\n\n var currentView = get(this, 'currentView');\n if (currentView) {\n if (!_childViews.length) { _childViews = this._childViews = this._childViews.slice(); }\n _childViews.push(this.createChildView(currentView));\n }\n },\n\n replace: function(idx, removedCount, addedViews) {\n var addedCount = addedViews ? get(addedViews, 'length') : 0;\n var self = this;\n Ember.assert(\"You can't add a child to a container that is already a child of another view\", A(addedViews).every(function(item) { return !get(item, '_parentView') || get(item, '_parentView') === self; }));\n\n this.arrayContentWillChange(idx, removedCount, addedCount);\n this.childViewsWillChange(this._childViews, idx, removedCount);\n\n if (addedCount === 0) {\n this._childViews.splice(idx, removedCount) ;\n } else {\n var args = [idx, removedCount].concat(addedViews);\n if (addedViews.length && !this._childViews.length) { this._childViews = this._childViews.slice(); }\n this._childViews.splice.apply(this._childViews, args);\n }\n\n this.arrayContentDidChange(idx, removedCount, addedCount);\n this.childViewsDidChange(this._childViews, idx, removedCount, addedCount);\n\n return this;\n },\n\n objectAt: function(idx) {\n return this._childViews[idx];\n },\n\n length: computed(function () {\n return this._childViews.length;\n }).volatile(),\n\n /**\n Instructs each child view to render to the passed render buffer.\n\n @private\n @method render\n @param {Ember.RenderBuffer} buffer the buffer to render to\n */\n render: function(buffer) {\n this.forEachChildView(function(view) {\n view.renderToBuffer(buffer);\n });\n },\n\n instrumentName: 'container',\n\n /**\n When a child view is removed, destroy its element so that\n it is removed from the DOM.\n\n The array observer that triggers this action is set up in the\n `renderToBuffer` method.\n\n @private\n @method childViewsWillChange\n @param {Ember.Array} views the child views array before mutation\n @param {Number} start the start position of the mutation\n @param {Number} removed the number of child views removed\n **/\n childViewsWillChange: function(views, start, removed) {\n this.propertyWillChange('childViews');\n\n if (removed > 0) {\n var changedViews = views.slice(start, start+removed);\n // transition to preRender before clearing parentView\n this.currentState.childViewsWillChange(this, views, start, removed);\n this.initializeViews(changedViews, null, null);\n }\n },\n\n removeChild: function(child) {\n this.removeObject(child);\n return this;\n },\n\n /**\n When a child view is added, make sure the DOM gets updated appropriately.\n\n If the view has already rendered an element, we tell the child view to\n create an element and insert it into the DOM. If the enclosing container\n view has already written to a buffer, but not yet converted that buffer\n into an element, we insert the string representation of the child into the\n appropriate place in the buffer.\n\n @private\n @method childViewsDidChange\n @param {Ember.Array} views the array of child views after the mutation has occurred\n @param {Number} start the start position of the mutation\n @param {Number} removed the number of child views removed\n @param {Number} added the number of child views added\n */\n childViewsDidChange: function(views, start, removed, added) {\n if (added > 0) {\n var changedViews = views.slice(start, start+added);\n this.initializeViews(changedViews, this, get(this, 'templateData'));\n this.currentState.childViewsDidChange(this, views, start, added);\n }\n this.propertyDidChange('childViews');\n },\n\n initializeViews: function(views, parentView, templateData) {\n forEach(views, function(view) {\n set(view, '_parentView', parentView);\n\n if (!view.container && parentView) {\n set(view, 'container', parentView.container);\n }\n\n if (!get(view, 'templateData')) {\n set(view, 'templateData', templateData);\n }\n });\n },\n\n currentView: null,\n\n _currentViewWillChange: beforeObserver('currentView', function() {\n var currentView = get(this, 'currentView');\n if (currentView) {\n currentView.destroy();\n }\n }),\n\n _currentViewDidChange: observer('currentView', function() {\n var currentView = get(this, 'currentView');\n if (currentView) {\n Ember.assert(\"You tried to set a current view that already has a parent. Make sure you don't have multiple outlets in the same view.\", !get(currentView, '_parentView'));\n this.pushObject(currentView);\n }\n }),\n\n _ensureChildrenAreInDOM: function () {\n this.currentState.ensureChildrenAreInDOM(this);\n }\n });\n\n merge(states._default, {\n childViewsWillChange: Ember.K,\n childViewsDidChange: Ember.K,\n ensureChildrenAreInDOM: Ember.K\n });\n\n merge(states.inBuffer, {\n childViewsDidChange: function(parentView, views, start, added) {\n throw new EmberError('You cannot modify child views while in the inBuffer state');\n }\n });\n\n merge(states.hasElement, {\n childViewsWillChange: function(view, views, start, removed) {\n for (var i=start; i\n ```\n\n ## HTML `class` Attribute\n\n The HTML `class` attribute of a view's tag can be set by providing a\n `classNames` property that is set to an array of strings:\n\n ```javascript\n MyView = Ember.View.extend({\n classNames: ['my-class', 'my-other-class']\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n `class` attribute values can also be set by providing a `classNameBindings`\n property set to an array of properties names for the view. The return value\n of these properties will be added as part of the value for the view's `class`\n attribute. These properties can be computed properties:\n\n ```javascript\n MyView = Ember.View.extend({\n classNameBindings: ['propertyA', 'propertyB'],\n propertyA: 'from-a',\n propertyB: function() {\n if (someLogic) { return 'from-b'; }\n }.property()\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n If the value of a class name binding returns a boolean the property name\n itself will be used as the class name if the property is true. The class name\n will not be added if the value is `false` or `undefined`.\n\n ```javascript\n MyView = Ember.View.extend({\n classNameBindings: ['hovered'],\n hovered: true\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n When using boolean class name bindings you can supply a string value other\n than the property name for use as the `class` HTML attribute by appending the\n preferred value after a \":\" character when defining the binding:\n\n ```javascript\n MyView = Ember.View.extend({\n classNameBindings: ['awesome:so-very-cool'],\n awesome: true\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n Boolean value class name bindings whose property names are in a\n camelCase-style format will be converted to a dasherized format:\n\n ```javascript\n MyView = Ember.View.extend({\n classNameBindings: ['isUrgent'],\n isUrgent: true\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n Class name bindings can also refer to object values that are found by\n traversing a path relative to the view itself:\n\n ```javascript\n MyView = Ember.View.extend({\n classNameBindings: ['messages.empty']\n messages: Ember.Object.create({\n empty: true\n })\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n If you want to add a class name for a property which evaluates to true and\n and a different class name if it evaluates to false, you can pass a binding\n like this:\n\n ```javascript\n // Applies 'enabled' class when isEnabled is true and 'disabled' when isEnabled is false\n Ember.View.extend({\n classNameBindings: ['isEnabled:enabled:disabled']\n isEnabled: true\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n When isEnabled is `false`, the resulting HTML reprensentation looks like\n this:\n\n ```html\n
    \n ```\n\n This syntax offers the convenience to add a class if a property is `false`:\n\n ```javascript\n // Applies no class when isEnabled is true and class 'disabled' when isEnabled is false\n Ember.View.extend({\n classNameBindings: ['isEnabled::disabled']\n isEnabled: true\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n When the `isEnabled` property on the view is set to `false`, it will result\n in view instances with an HTML representation of:\n\n ```html\n
    \n ```\n\n Updates to the the value of a class name binding will result in automatic\n update of the HTML `class` attribute in the view's rendered HTML\n representation. If the value becomes `false` or `undefined` the class name\n will be removed.\n\n Both `classNames` and `classNameBindings` are concatenated properties. See\n [Ember.Object](/api/classes/Ember.Object.html) documentation for more\n information about concatenated properties.\n\n ## HTML Attributes\n\n The HTML attribute section of a view's tag can be set by providing an\n `attributeBindings` property set to an array of property names on the view.\n The return value of these properties will be used as the value of the view's\n HTML associated attribute:\n\n ```javascript\n AnchorView = Ember.View.extend({\n tagName: 'a',\n attributeBindings: ['href'],\n href: 'http://google.com'\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n \n ```\n \n One property can be mapped on to another by placing a \":\" between \n the source property and the destination property:\n \n ```javascript\n AnchorView = Ember.View.extend({\n tagName: 'a',\n attributeBindings: ['url:href'],\n url: 'http://google.com'\n });\n ```\n \n Will result in view instances with an HTML representation of:\n\n ```html\n \n ```\n \n If the return value of an `attributeBindings` monitored property is a boolean\n the property will follow HTML's pattern of repeating the attribute's name as\n its value:\n\n ```javascript\n MyTextInput = Ember.View.extend({\n tagName: 'input',\n attributeBindings: ['disabled'],\n disabled: true\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n \n ```\n\n `attributeBindings` can refer to computed properties:\n\n ```javascript\n MyTextInput = Ember.View.extend({\n tagName: 'input',\n attributeBindings: ['disabled'],\n disabled: function() {\n if (someLogic) {\n return true;\n } else {\n return false;\n }\n }.property()\n });\n ```\n\n Updates to the the property of an attribute binding will result in automatic\n update of the HTML attribute in the view's rendered HTML representation.\n\n `attributeBindings` is a concatenated property. See [Ember.Object](/api/classes/Ember.Object.html)\n documentation for more information about concatenated properties.\n\n ## Templates\n\n The HTML contents of a view's rendered representation are determined by its\n template. Templates can be any function that accepts an optional context\n parameter and returns a string of HTML that will be inserted within the\n view's tag. Most typically in Ember this function will be a compiled\n `Ember.Handlebars` template.\n\n ```javascript\n AView = Ember.View.extend({\n template: Ember.Handlebars.compile('I am the template')\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    I am the template
    \n ```\n\n Within an Ember application is more common to define a Handlebars templates as\n part of a page:\n\n ```html\n \n ```\n\n And associate it by name using a view's `templateName` property:\n\n ```javascript\n AView = Ember.View.extend({\n templateName: 'some-template'\n });\n ```\n\n If you have nested resources, your Handlebars template will look like this:\n\n ```html\n \n ```\n\n And `templateName` property:\n\n ```javascript\n AView = Ember.View.extend({\n templateName: 'posts/new'\n });\n ```\n\n Using a value for `templateName` that does not have a Handlebars template\n with a matching `data-template-name` attribute will throw an error.\n\n For views classes that may have a template later defined (e.g. as the block\n portion of a `{{view}}` Handlebars helper call in another template or in\n a subclass), you can provide a `defaultTemplate` property set to compiled\n template function. If a template is not later provided for the view instance\n the `defaultTemplate` value will be used:\n\n ```javascript\n AView = Ember.View.extend({\n defaultTemplate: Ember.Handlebars.compile('I was the default'),\n template: null,\n templateName: null\n });\n ```\n\n Will result in instances with an HTML representation of:\n\n ```html\n
    I was the default
    \n ```\n\n If a `template` or `templateName` is provided it will take precedence over\n `defaultTemplate`:\n\n ```javascript\n AView = Ember.View.extend({\n defaultTemplate: Ember.Handlebars.compile('I was the default')\n });\n\n aView = AView.create({\n template: Ember.Handlebars.compile('I was the template, not default')\n });\n ```\n\n Will result in the following HTML representation when rendered:\n\n ```html\n
    I was the template, not default
    \n ```\n\n ## View Context\n\n The default context of the compiled template is the view's controller:\n\n ```javascript\n AView = Ember.View.extend({\n template: Ember.Handlebars.compile('Hello {{excitedGreeting}}')\n });\n\n aController = Ember.Object.create({\n firstName: 'Barry',\n excitedGreeting: function() {\n return this.get(\"content.firstName\") + \"!!!\"\n }.property()\n });\n\n aView = AView.create({\n controller: aController,\n });\n ```\n\n Will result in an HTML representation of:\n\n ```html\n
    Hello Barry!!!
    \n ```\n\n A context can also be explicitly supplied through the view's `context`\n property. If the view has neither `context` nor `controller` properties, the\n `parentView`'s context will be used.\n\n ## Layouts\n\n Views can have a secondary template that wraps their main template. Like\n primary templates, layouts can be any function that accepts an optional\n context parameter and returns a string of HTML that will be inserted inside\n view's tag. Views whose HTML element is self closing (e.g. ``)\n cannot have a layout and this property will be ignored.\n\n Most typically in Ember a layout will be a compiled `Ember.Handlebars`\n template.\n\n A view's layout can be set directly with the `layout` property or reference\n an existing Handlebars template by name with the `layoutName` property.\n\n A template used as a layout must contain a single use of the Handlebars\n `{{yield}}` helper. The HTML contents of a view's rendered `template` will be\n inserted at this location:\n\n ```javascript\n AViewWithLayout = Ember.View.extend({\n layout: Ember.Handlebars.compile(\"
    {{yield}}
    \")\n template: Ember.Handlebars.compile(\"I got wrapped\"),\n });\n ```\n\n Will result in view instances with an HTML representation of:\n\n ```html\n
    \n
    \n I got wrapped\n
    \n
    \n ```\n\n See [Ember.Handlebars.helpers.yield](/api/classes/Ember.Handlebars.helpers.html#method_yield)\n for more information.\n\n ## Responding to Browser Events\n\n Views can respond to user-initiated events in one of three ways: method\n implementation, through an event manager, and through `{{action}}` helper use\n in their template or layout.\n\n ### Method Implementation\n\n Views can respond to user-initiated events by implementing a method that\n matches the event name. A `jQuery.Event` object will be passed as the\n argument to this method.\n\n ```javascript\n AView = Ember.View.extend({\n click: function(event) {\n // will be called when when an instance's\n // rendered element is clicked\n }\n });\n ```\n\n ### Event Managers\n\n Views can define an object as their `eventManager` property. This object can\n then implement methods that match the desired event names. Matching events\n that occur on the view's rendered HTML or the rendered HTML of any of its DOM\n descendants will trigger this method. A `jQuery.Event` object will be passed\n as the first argument to the method and an `Ember.View` object as the\n second. The `Ember.View` will be the view whose rendered HTML was interacted\n with. This may be the view with the `eventManager` property or one of its\n descendent views.\n\n ```javascript\n AView = Ember.View.extend({\n eventManager: Ember.Object.create({\n doubleClick: function(event, view) {\n // will be called when when an instance's\n // rendered element or any rendering\n // of this views's descendent\n // elements is clicked\n }\n })\n });\n ```\n\n An event defined for an event manager takes precedence over events of the\n same name handled through methods on the view.\n\n ```javascript\n AView = Ember.View.extend({\n mouseEnter: function(event) {\n // will never trigger.\n },\n eventManager: Ember.Object.create({\n mouseEnter: function(event, view) {\n // takes precedence over AView#mouseEnter\n }\n })\n });\n ```\n\n Similarly a view's event manager will take precedence for events of any views\n rendered as a descendent. A method name that matches an event name will not\n be called if the view instance was rendered inside the HTML representation of\n a view that has an `eventManager` property defined that handles events of the\n name. Events not handled by the event manager will still trigger method calls\n on the descendent.\n\n ```javascript\n OuterView = Ember.View.extend({\n template: Ember.Handlebars.compile(\"outer {{#view InnerView}}inner{{/view}} outer\"),\n eventManager: Ember.Object.create({\n mouseEnter: function(event, view) {\n // view might be instance of either\n // OuterView or InnerView depending on\n // where on the page the user interaction occured\n }\n })\n });\n\n InnerView = Ember.View.extend({\n click: function(event) {\n // will be called if rendered inside\n // an OuterView because OuterView's\n // eventManager doesn't handle click events\n },\n mouseEnter: function(event) {\n // will never be called if rendered inside\n // an OuterView.\n }\n });\n ```\n\n ### Handlebars `{{action}}` Helper\n\n See [Handlebars.helpers.action](/api/classes/Ember.Handlebars.helpers.html#method_action).\n\n ### Event Names\n\n All of the event handling approaches described above respond to the same set\n of events. The names of the built-in events are listed below. (The hash of\n built-in events exists in `Ember.EventDispatcher`.) Additional, custom events\n can be registered by using `Ember.Application.customEvents`.\n\n Touch events:\n\n * `touchStart`\n * `touchMove`\n * `touchEnd`\n * `touchCancel`\n\n Keyboard events\n\n * `keyDown`\n * `keyUp`\n * `keyPress`\n\n Mouse events\n\n * `mouseDown`\n * `mouseUp`\n * `contextMenu`\n * `click`\n * `doubleClick`\n * `mouseMove`\n * `focusIn`\n * `focusOut`\n * `mouseEnter`\n * `mouseLeave`\n\n Form events:\n\n * `submit`\n * `change`\n * `focusIn`\n * `focusOut`\n * `input`\n\n HTML5 drag and drop events:\n\n * `dragStart`\n * `drag`\n * `dragEnter`\n * `dragLeave`\n * `dragOver`\n * `dragEnd`\n * `drop`\n\n ## Handlebars `{{view}}` Helper\n\n Other `Ember.View` instances can be included as part of a view's template by\n using the `{{view}}` Handlebars helper. See [Ember.Handlebars.helpers.view](/api/classes/Ember.Handlebars.helpers.html#method_view)\n for additional information.\n\n @class View\n @namespace Ember\n @extends Ember.CoreView\n */\n var View = CoreView.extend({\n\n concatenatedProperties: ['classNames', 'classNameBindings', 'attributeBindings'],\n\n /**\n @property isView\n @type Boolean\n @default true\n @static\n */\n isView: true,\n\n // ..........................................................\n // TEMPLATE SUPPORT\n //\n\n /**\n The name of the template to lookup if no template is provided.\n\n By default `Ember.View` will lookup a template with this name in\n `Ember.TEMPLATES` (a shared global object).\n\n @property templateName\n @type String\n @default null\n */\n templateName: null,\n\n /**\n The name of the layout to lookup if no layout is provided.\n\n By default `Ember.View` will lookup a template with this name in\n `Ember.TEMPLATES` (a shared global object).\n\n @property layoutName\n @type String\n @default null\n */\n layoutName: null,\n\n /**\n The template used to render the view. This should be a function that\n accepts an optional context parameter and returns a string of HTML that\n will be inserted into the DOM relative to its parent view.\n\n In general, you should set the `templateName` property instead of setting\n the template yourself.\n\n @property template\n @type Function\n */\n template: computed('templateName', function(key, value) {\n if (value !== undefined) { return value; }\n\n var templateName = get(this, 'templateName'),\n template = this.templateForName(templateName, 'template');\n\n Ember.assert(\"You specified the templateName \" + templateName + \" for \" + this + \", but it did not exist.\", !templateName || template);\n\n return template || get(this, 'defaultTemplate');\n }),\n\n /**\n The controller managing this view. If this property is set, it will be\n made available for use by the template.\n\n @property controller\n @type Object\n */\n controller: computed('_parentView', function(key) {\n var parentView = get(this, '_parentView');\n return parentView ? get(parentView, 'controller') : null;\n }),\n\n /**\n A view may contain a layout. A layout is a regular template but\n supersedes the `template` property during rendering. It is the\n responsibility of the layout template to retrieve the `template`\n property from the view (or alternatively, call `Handlebars.helpers.yield`,\n `{{yield}}`) to render it in the correct location.\n\n This is useful for a view that has a shared wrapper, but which delegates\n the rendering of the contents of the wrapper to the `template` property\n on a subclass.\n\n @property layout\n @type Function\n */\n layout: computed(function(key) {\n var layoutName = get(this, 'layoutName'),\n layout = this.templateForName(layoutName, 'layout');\n\n Ember.assert(\"You specified the layoutName \" + layoutName + \" for \" + this + \", but it did not exist.\", !layoutName || layout);\n\n return layout || get(this, 'defaultLayout');\n }).property('layoutName'),\n\n _yield: function(context, options) {\n var template = get(this, 'template');\n if (template) { template(context, options); }\n },\n\n templateForName: function(name, type) {\n if (!name) { return; }\n Ember.assert(\"templateNames are not allowed to contain periods: \"+name, name.indexOf('.') === -1);\n\n // the defaultContainer is deprecated\n var container = this.container || (Container && Container.defaultContainer);\n return container && container.lookup('template:' + name);\n },\n\n /**\n The object from which templates should access properties.\n\n This object will be passed to the template function each time the render\n method is called, but it is up to the individual function to decide what\n to do with it.\n\n By default, this will be the view's controller.\n\n @property context\n @type Object\n */\n context: computed(function(key, value) {\n if (arguments.length === 2) {\n set(this, '_context', value);\n return value;\n } else {\n return get(this, '_context');\n }\n }).volatile(),\n\n /**\n Private copy of the view's template context. This can be set directly\n by Handlebars without triggering the observer that causes the view\n to be re-rendered.\n\n The context of a view is looked up as follows:\n\n 1. Supplied context (usually by Handlebars)\n 2. Specified controller\n 3. `parentView`'s context (for a child of a ContainerView)\n\n The code in Handlebars that overrides the `_context` property first\n checks to see whether the view has a specified controller. This is\n something of a hack and should be revisited.\n\n @property _context\n @private\n */\n _context: computed(function(key) {\n var parentView, controller;\n\n if (controller = get(this, 'controller')) {\n return controller;\n }\n\n parentView = this._parentView;\n if (parentView) {\n return get(parentView, '_context');\n }\n\n return null;\n }),\n\n /**\n If a value that affects template rendering changes, the view should be\n re-rendered to reflect the new value.\n\n @method _contextDidChange\n @private\n */\n _contextDidChange: observer('context', function() {\n this.rerender();\n }),\n\n /**\n If `false`, the view will appear hidden in DOM.\n\n @property isVisible\n @type Boolean\n @default null\n */\n isVisible: true,\n\n /**\n Array of child views. You should never edit this array directly.\n Instead, use `appendChild` and `removeFromParent`.\n\n @property childViews\n @type Array\n @default []\n @private\n */\n childViews: childViewsProperty,\n\n _childViews: EMPTY_ARRAY,\n\n // When it's a virtual view, we need to notify the parent that their\n // childViews will change.\n _childViewsWillChange: beforeObserver('childViews', function() {\n if (this.isVirtual) {\n var parentView = get(this, 'parentView');\n if (parentView) { propertyWillChange(parentView, 'childViews'); }\n }\n }),\n\n // When it's a virtual view, we need to notify the parent that their\n // childViews did change.\n _childViewsDidChange: observer('childViews', function() {\n if (this.isVirtual) {\n var parentView = get(this, 'parentView');\n if (parentView) { propertyDidChange(parentView, 'childViews'); }\n }\n }),\n\n /**\n Return the nearest ancestor that is an instance of the provided\n class.\n\n @method nearestInstanceOf\n @param {Class} klass Subclass of Ember.View (or Ember.View itself)\n @return Ember.View\n @deprecated\n */\n nearestInstanceOf: function(klass) {\n Ember.deprecate(\"nearestInstanceOf is deprecated and will be removed from future releases. Use nearestOfType.\");\n var view = get(this, 'parentView');\n\n while (view) {\n if (view instanceof klass) { return view; }\n view = get(view, 'parentView');\n }\n },\n\n /**\n Return the nearest ancestor that is an instance of the provided\n class or mixin.\n\n @method nearestOfType\n @param {Class,Mixin} klass Subclass of Ember.View (or Ember.View itself),\n or an instance of Ember.Mixin.\n @return Ember.View\n */\n nearestOfType: function(klass) {\n var view = get(this, 'parentView'),\n isOfType = klass instanceof Mixin ?\n function(view) { return klass.detect(view); } :\n function(view) { return klass.detect(view.constructor); };\n\n while (view) {\n if (isOfType(view)) { return view; }\n view = get(view, 'parentView');\n }\n },\n\n /**\n Return the nearest ancestor that has a given property.\n\n @method nearestWithProperty\n @param {String} property A property name\n @return Ember.View\n */\n nearestWithProperty: function(property) {\n var view = get(this, 'parentView');\n\n while (view) {\n if (property in view) { return view; }\n view = get(view, 'parentView');\n }\n },\n\n /**\n Return the nearest ancestor whose parent is an instance of\n `klass`.\n\n @method nearestChildOf\n @param {Class} klass Subclass of Ember.View (or Ember.View itself)\n @return Ember.View\n */\n nearestChildOf: function(klass) {\n var view = get(this, 'parentView');\n\n while (view) {\n if (get(view, 'parentView') instanceof klass) { return view; }\n view = get(view, 'parentView');\n }\n },\n\n /**\n When the parent view changes, recursively invalidate `controller`\n\n @method _parentViewDidChange\n @private\n */\n _parentViewDidChange: observer('_parentView', function() {\n if (this.isDestroying) { return; }\n\n this.trigger('parentViewDidChange');\n\n if (get(this, 'parentView.controller') && !get(this, 'controller')) {\n this.notifyPropertyChange('controller');\n }\n }),\n\n _controllerDidChange: observer('controller', function() {\n if (this.isDestroying) { return; }\n\n this.rerender();\n\n this.forEachChildView(function(view) {\n view.propertyDidChange('controller');\n });\n }),\n\n cloneKeywords: function() {\n var templateData = get(this, 'templateData');\n\n var keywords = templateData ? copy(templateData.keywords) : {};\n set(keywords, 'view', get(this, 'concreteView'));\n set(keywords, '_view', this);\n set(keywords, 'controller', get(this, 'controller'));\n\n return keywords;\n },\n\n /**\n Called on your view when it should push strings of HTML into a\n `Ember.RenderBuffer`. Most users will want to override the `template`\n or `templateName` properties instead of this method.\n\n By default, `Ember.View` will look for a function in the `template`\n property and invoke it with the value of `context`. The value of\n `context` will be the view's controller unless you override it.\n\n @method render\n @param {Ember.RenderBuffer} buffer The render buffer\n */\n render: function(buffer) {\n // If this view has a layout, it is the responsibility of the\n // the layout to render the view's template. Otherwise, render the template\n // directly.\n var template = get(this, 'layout') || get(this, 'template');\n\n if (template) {\n var context = get(this, 'context');\n var keywords = this.cloneKeywords();\n var output;\n\n var data = {\n view: this,\n buffer: buffer,\n isRenderData: true,\n keywords: keywords,\n insideGroup: get(this, 'templateData.insideGroup')\n };\n\n // Invoke the template with the provided template context, which\n // is the view's controller by default. A hash of data is also passed that provides\n // the template with access to the view and render buffer.\n\n Ember.assert('template must be a function. Did you mean to call Ember.Handlebars.compile(\"...\") or specify templateName instead?', typeof template === 'function');\n // The template should write directly to the render buffer instead\n // of returning a string.\n output = template(context, { data: data });\n\n // If the template returned a string instead of writing to the buffer,\n // push the string onto the buffer.\n if (output !== undefined) { buffer.push(output); }\n }\n },\n\n /**\n Renders the view again. This will work regardless of whether the\n view is already in the DOM or not. If the view is in the DOM, the\n rendering process will be deferred to give bindings a chance\n to synchronize.\n\n If children were added during the rendering process using `appendChild`,\n `rerender` will remove them, because they will be added again\n if needed by the next `render`.\n\n In general, if the display of your view changes, you should modify\n the DOM element directly instead of manually calling `rerender`, which can\n be slow.\n\n @method rerender\n */\n rerender: function() {\n return this.currentState.rerender(this);\n },\n\n clearRenderedChildren: function() {\n var lengthBefore = this.lengthBeforeRender,\n lengthAfter = this.lengthAfterRender;\n\n // If there were child views created during the last call to render(),\n // remove them under the assumption that they will be re-created when\n // we re-render.\n\n // VIEW-TODO: Unit test this path.\n var childViews = this._childViews;\n for (var i=lengthAfter-1; i>=lengthBefore; i--) {\n if (childViews[i]) { childViews[i].destroy(); }\n }\n },\n\n /**\n Iterates over the view's `classNameBindings` array, inserts the value\n of the specified property into the `classNames` array, then creates an\n observer to update the view's element if the bound property ever changes\n in the future.\n\n @method _applyClassNameBindings\n @private\n */\n _applyClassNameBindings: function(classBindings) {\n var classNames = this.classNames,\n elem, newClass, dasherizedClass;\n\n // Loop through all of the configured bindings. These will be either\n // property names ('isUrgent') or property paths relative to the view\n // ('content.isUrgent')\n a_forEach(classBindings, function(binding) {\n\n Ember.assert(\"classNameBindings must not have spaces in them. Multiple class name bindings can be provided as elements of an array, e.g. ['foo', ':bar']\", binding.indexOf(' ') === -1);\n\n // Variable in which the old class value is saved. The observer function\n // closes over this variable, so it knows which string to remove when\n // the property changes.\n var oldClass;\n // Extract just the property name from bindings like 'foo:bar'\n var parsedPath = View._parsePropertyPath(binding);\n\n // Set up an observer on the context. If the property changes, toggle the\n // class name.\n var observer = function() {\n // Get the current value of the property\n newClass = this._classStringForProperty(binding);\n elem = this.$();\n\n // If we had previously added a class to the element, remove it.\n if (oldClass) {\n elem.removeClass(oldClass);\n // Also remove from classNames so that if the view gets rerendered,\n // the class doesn't get added back to the DOM.\n classNames.removeObject(oldClass);\n }\n\n // If necessary, add a new class. Make sure we keep track of it so\n // it can be removed in the future.\n if (newClass) {\n elem.addClass(newClass);\n oldClass = newClass;\n } else {\n oldClass = null;\n }\n };\n\n // Get the class name for the property at its current value\n dasherizedClass = this._classStringForProperty(binding);\n\n if (dasherizedClass) {\n // Ensure that it gets into the classNames array\n // so it is displayed when we render.\n a_addObject(classNames, dasherizedClass);\n\n // Save a reference to the class name so we can remove it\n // if the observer fires. Remember that this variable has\n // been closed over by the observer.\n oldClass = dasherizedClass;\n }\n\n this.registerObserver(this, parsedPath.path, observer);\n // Remove className so when the view is rerendered,\n // the className is added based on binding reevaluation\n this.one('willClearRender', function() {\n if (oldClass) {\n classNames.removeObject(oldClass);\n oldClass = null;\n }\n });\n\n }, this);\n },\n\n _unspecifiedAttributeBindings: null,\n\n /**\n Iterates through the view's attribute bindings, sets up observers for each,\n then applies the current value of the attributes to the passed render buffer.\n\n @method _applyAttributeBindings\n @param {Ember.RenderBuffer} buffer\n @private\n */\n _applyAttributeBindings: function(buffer, attributeBindings) {\n var attributeValue,\n unspecifiedAttributeBindings = this._unspecifiedAttributeBindings = this._unspecifiedAttributeBindings || {};\n\n a_forEach(attributeBindings, function(binding) {\n var split = binding.split(':'),\n property = split[0],\n attributeName = split[1] || property;\n\n if (property in this) {\n this._setupAttributeBindingObservation(property, attributeName);\n\n // Determine the current value and add it to the render buffer\n // if necessary.\n attributeValue = get(this, property);\n View.applyAttributeBindings(buffer, attributeName, attributeValue);\n } else {\n unspecifiedAttributeBindings[property] = attributeName;\n }\n }, this);\n\n // Lazily setup setUnknownProperty after attributeBindings are initially applied\n this.setUnknownProperty = this._setUnknownProperty;\n },\n\n _setupAttributeBindingObservation: function(property, attributeName) {\n var attributeValue, elem;\n\n // Create an observer to add/remove/change the attribute if the\n // JavaScript property changes.\n var observer = function() {\n elem = this.$();\n\n attributeValue = get(this, property);\n\n View.applyAttributeBindings(elem, attributeName, attributeValue);\n };\n\n this.registerObserver(this, property, observer);\n },\n\n /**\n We're using setUnknownProperty as a hook to setup attributeBinding observers for\n properties that aren't defined on a view at initialization time.\n\n Note: setUnknownProperty will only be called once for each property.\n\n @method setUnknownProperty\n @param key\n @param value\n @private\n */\n setUnknownProperty: null, // Gets defined after initialization by _applyAttributeBindings\n\n _setUnknownProperty: function(key, value) {\n var attributeName = this._unspecifiedAttributeBindings && this._unspecifiedAttributeBindings[key];\n if (attributeName) {\n this._setupAttributeBindingObservation(key, attributeName);\n }\n\n defineProperty(this, key);\n return set(this, key, value);\n },\n\n /**\n Given a property name, returns a dasherized version of that\n property name if the property evaluates to a non-falsy value.\n\n For example, if the view has property `isUrgent` that evaluates to true,\n passing `isUrgent` to this method will return `\"is-urgent\"`.\n\n @method _classStringForProperty\n @param property\n @private\n */\n _classStringForProperty: function(property) {\n var parsedPath = View._parsePropertyPath(property);\n var path = parsedPath.path;\n\n var val = get(this, path);\n if (val === undefined && isGlobalPath(path)) {\n val = get(Ember.lookup, path);\n }\n\n return View._classStringForValue(path, val, parsedPath.className, parsedPath.falsyClassName);\n },\n\n // ..........................................................\n // ELEMENT SUPPORT\n //\n\n /**\n Returns the current DOM element for the view.\n\n @property element\n @type DOMElement\n */\n element: computed('_parentView', function(key, value) {\n if (value !== undefined) {\n return this.currentState.setElement(this, value);\n } else {\n return this.currentState.getElement(this);\n }\n }),\n\n /**\n Returns a jQuery object for this view's element. If you pass in a selector\n string, this method will return a jQuery object, using the current element\n as its buffer.\n\n For example, calling `view.$('li')` will return a jQuery object containing\n all of the `li` elements inside the DOM element of this view.\n\n @method $\n @param {String} [selector] a jQuery-compatible selector string\n @return {jQuery} the jQuery object for the DOM node\n */\n $: function(sel) {\n return this.currentState.$(this, sel);\n },\n\n mutateChildViews: function(callback) {\n var childViews = this._childViews,\n idx = childViews.length,\n view;\n\n while(--idx >= 0) {\n view = childViews[idx];\n callback(this, view, idx);\n }\n\n return this;\n },\n\n forEachChildView: function(callback) {\n var childViews = this._childViews;\n\n if (!childViews) { return this; }\n\n var len = childViews.length,\n view, idx;\n\n for (idx = 0; idx < len; idx++) {\n view = childViews[idx];\n callback(view);\n }\n\n return this;\n },\n\n /**\n Appends the view's element to the specified parent element.\n\n If the view does not have an HTML representation yet, `createElement()`\n will be called automatically.\n\n Note that this method just schedules the view to be appended; the DOM\n element will not be appended to the given element until all bindings have\n finished synchronizing.\n\n This is not typically a function that you will need to call directly when\n building your application. You might consider using `Ember.ContainerView`\n instead. If you do need to use `appendTo`, be sure that the target element\n you are providing is associated with an `Ember.Application` and does not\n have an ancestor element that is associated with an Ember view.\n\n @method appendTo\n @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object\n @return {Ember.View} receiver\n */\n appendTo: function(target) {\n // Schedule the DOM element to be created and appended to the given\n // element after bindings have synchronized.\n this._insertElementLater(function() {\n Ember.assert(\"You tried to append to (\" + target + \") but that isn't in the DOM\", jQuery(target).length > 0);\n Ember.assert(\"You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead.\", !jQuery(target).is('.ember-view') && !jQuery(target).parents().is('.ember-view'));\n this.$().appendTo(target);\n });\n\n return this;\n },\n\n /**\n Replaces the content of the specified parent element with this view's\n element. If the view does not have an HTML representation yet,\n `createElement()` will be called automatically.\n\n Note that this method just schedules the view to be appended; the DOM\n element will not be appended to the given element until all bindings have\n finished synchronizing\n\n @method replaceIn\n @param {String|DOMElement|jQuery} target A selector, element, HTML string, or jQuery object\n @return {Ember.View} received\n */\n replaceIn: function(target) {\n Ember.assert(\"You tried to replace in (\" + target + \") but that isn't in the DOM\", jQuery(target).length > 0);\n Ember.assert(\"You cannot replace an existing Ember.View. Consider using Ember.ContainerView instead.\", !jQuery(target).is('.ember-view') && !jQuery(target).parents().is('.ember-view'));\n\n this._insertElementLater(function() {\n jQuery(target).empty();\n this.$().appendTo(target);\n });\n\n return this;\n },\n\n /**\n Schedules a DOM operation to occur during the next render phase. This\n ensures that all bindings have finished synchronizing before the view is\n rendered.\n\n To use, pass a function that performs a DOM operation.\n\n Before your function is called, this view and all child views will receive\n the `willInsertElement` event. After your function is invoked, this view\n and all of its child views will receive the `didInsertElement` event.\n\n ```javascript\n view._insertElementLater(function() {\n this.createElement();\n this.$().appendTo('body');\n });\n ```\n\n @method _insertElementLater\n @param {Function} fn the function that inserts the element into the DOM\n @private\n */\n _insertElementLater: function(fn) {\n this._scheduledInsert = run.scheduleOnce('render', this, '_insertElement', fn);\n },\n\n _insertElement: function (fn) {\n this._scheduledInsert = null;\n this.currentState.insertElement(this, fn);\n },\n\n /**\n Appends the view's element to the document body. If the view does\n not have an HTML representation yet, `createElement()` will be called\n automatically.\n\n If your application uses the `rootElement` property, you must append\n the view within that element. Rendering views outside of the `rootElement`\n is not supported.\n\n Note that this method just schedules the view to be appended; the DOM\n element will not be appended to the document body until all bindings have\n finished synchronizing.\n\n @method append\n @return {Ember.View} receiver\n */\n append: function() {\n return this.appendTo(document.body);\n },\n\n /**\n Removes the view's element from the element to which it is attached.\n\n @method remove\n @return {Ember.View} receiver\n */\n remove: function() {\n // What we should really do here is wait until the end of the run loop\n // to determine if the element has been re-appended to a different\n // element.\n // In the interim, we will just re-render if that happens. It is more\n // important than elements get garbage collected.\n if (!this.removedFromDOM) { this.destroyElement(); }\n this.invokeRecursively(function(view) {\n if (view.clearRenderedChildren) { view.clearRenderedChildren(); }\n });\n },\n\n elementId: null,\n\n /**\n Attempts to discover the element in the parent element. The default\n implementation looks for an element with an ID of `elementId` (or the\n view's guid if `elementId` is null). You can override this method to\n provide your own form of lookup. For example, if you want to discover your\n element using a CSS class name instead of an ID.\n\n @method findElementInParentElement\n @param {DOMElement} parentElement The parent's DOM element\n @return {DOMElement} The discovered element\n */\n findElementInParentElement: function(parentElem) {\n var id = \"#\" + this.elementId;\n return jQuery(id)[0] || jQuery(id, parentElem)[0];\n },\n\n /**\n Creates a DOM representation of the view and all of its\n child views by recursively calling the `render()` method.\n\n After the element has been created, `didInsertElement` will\n be called on this view and all of its child views.\n\n @method createElement\n @return {Ember.View} receiver\n */\n createElement: function() {\n if (get(this, 'element')) { return this; }\n\n var buffer = this.renderToBuffer();\n set(this, 'element', buffer.element());\n\n return this;\n },\n\n /**\n Called when a view is going to insert an element into the DOM.\n\n @event willInsertElement\n */\n willInsertElement: Ember.K,\n\n /**\n Called when the element of the view has been inserted into the DOM\n or after the view was re-rendered. Override this function to do any\n set up that requires an element in the document body.\n\n @event didInsertElement\n */\n didInsertElement: Ember.K,\n\n /**\n Called when the view is about to rerender, but before anything has\n been torn down. This is a good opportunity to tear down any manual\n observers you have installed based on the DOM state\n\n @event willClearRender\n */\n willClearRender: Ember.K,\n\n /**\n Run this callback on the current view (unless includeSelf is false) and recursively on child views.\n\n @method invokeRecursively\n @param fn {Function}\n @param includeSelf {Boolean} Includes itself if true.\n @private\n */\n invokeRecursively: function(fn, includeSelf) {\n var childViews = (includeSelf === false) ? this._childViews : [this];\n var currentViews, view, currentChildViews;\n\n while (childViews.length) {\n currentViews = childViews.slice();\n childViews = [];\n\n for (var i=0, l=currentViews.length; i` tag for views.\n\n @property tagName\n @type String\n @default null\n */\n\n // We leave this null by default so we can tell the difference between\n // the default case and a user-specified tag.\n tagName: null,\n\n /**\n The WAI-ARIA role of the control represented by this view. For example, a\n button may have a role of type 'button', or a pane may have a role of\n type 'alertdialog'. This property is used by assistive software to help\n visually challenged users navigate rich web applications.\n\n The full list of valid WAI-ARIA roles is available at:\n [http://www.w3.org/TR/wai-aria/roles#roles_categorization](http://www.w3.org/TR/wai-aria/roles#roles_categorization)\n\n @property ariaRole\n @type String\n @default null\n */\n ariaRole: null,\n\n /**\n Standard CSS class names to apply to the view's outer element. This\n property automatically inherits any class names defined by the view's\n superclasses as well.\n\n @property classNames\n @type Array\n @default ['ember-view']\n */\n classNames: ['ember-view'],\n\n /**\n A list of properties of the view to apply as class names. If the property\n is a string value, the value of that string will be applied as a class\n name.\n\n ```javascript\n // Applies the 'high' class to the view element\n Ember.View.extend({\n classNameBindings: ['priority']\n priority: 'high'\n });\n ```\n\n If the value of the property is a Boolean, the name of that property is\n added as a dasherized class name.\n\n ```javascript\n // Applies the 'is-urgent' class to the view element\n Ember.View.extend({\n classNameBindings: ['isUrgent']\n isUrgent: true\n });\n ```\n\n If you would prefer to use a custom value instead of the dasherized\n property name, you can pass a binding like this:\n\n ```javascript\n // Applies the 'urgent' class to the view element\n Ember.View.extend({\n classNameBindings: ['isUrgent:urgent']\n isUrgent: true\n });\n ```\n\n This list of properties is inherited from the view's superclasses as well.\n\n @property classNameBindings\n @type Array\n @default []\n */\n classNameBindings: EMPTY_ARRAY,\n\n /**\n A list of properties of the view to apply as attributes. If the property is\n a string value, the value of that string will be applied as the attribute.\n\n ```javascript\n // Applies the type attribute to the element\n // with the value \"button\", like
    \n Ember.View.extend({\n attributeBindings: ['type'],\n type: 'button'\n });\n ```\n\n If the value of the property is a Boolean, the name of that property is\n added as an attribute.\n\n ```javascript\n // Renders something like
    \n Ember.View.extend({\n attributeBindings: ['enabled'],\n enabled: true\n });\n ```\n\n @property attributeBindings\n */\n attributeBindings: EMPTY_ARRAY,\n\n // .......................................................\n // CORE DISPLAY METHODS\n //\n\n /**\n Setup a view, but do not finish waking it up.\n\n * configure `childViews`\n * register the view with the global views hash, which is used for event\n dispatch\n\n @method init\n @private\n */\n init: function() {\n this.elementId = this.elementId || guidFor(this);\n\n this._super();\n\n // setup child views. be sure to clone the child views array first\n this._childViews = this._childViews.slice();\n\n Ember.assert(\"Only arrays are allowed for 'classNameBindings'\", typeOf(this.classNameBindings) === 'array');\n this.classNameBindings = A(this.classNameBindings.slice());\n\n Ember.assert(\"Only arrays are allowed for 'classNames'\", typeOf(this.classNames) === 'array');\n this.classNames = A(this.classNames.slice());\n },\n\n appendChild: function(view, options) {\n return this.currentState.appendChild(this, view, options);\n },\n\n /**\n Removes the child view from the parent view.\n\n @method removeChild\n @param {Ember.View} view\n @return {Ember.View} receiver\n */\n removeChild: function(view) {\n // If we're destroying, the entire subtree will be\n // freed, and the DOM will be handled separately,\n // so no need to mess with childViews.\n if (this.isDestroying) { return; }\n\n // update parent node\n set(view, '_parentView', null);\n\n // remove view from childViews array.\n var childViews = this._childViews;\n\n a_removeObject(childViews, view);\n\n this.propertyDidChange('childViews'); // HUH?! what happened to will change?\n\n return this;\n },\n\n /**\n Removes all children from the `parentView`.\n\n @method removeAllChildren\n @return {Ember.View} receiver\n */\n removeAllChildren: function() {\n return this.mutateChildViews(function(parentView, view) {\n parentView.removeChild(view);\n });\n },\n\n destroyAllChildren: function() {\n return this.mutateChildViews(function(parentView, view) {\n view.destroy();\n });\n },\n\n /**\n Removes the view from its `parentView`, if one is found. Otherwise\n does nothing.\n\n @method removeFromParent\n @return {Ember.View} receiver\n */\n removeFromParent: function() {\n var parent = this._parentView;\n\n // Remove DOM element from parent\n this.remove();\n\n if (parent) { parent.removeChild(this); }\n return this;\n },\n\n /**\n You must call `destroy` on a view to destroy the view (and all of its\n child views). This will remove the view from any parent node, then make\n sure that the DOM element managed by the view can be released by the\n memory manager.\n\n @method destroy\n */\n destroy: function() {\n var childViews = this._childViews,\n // get parentView before calling super because it'll be destroyed\n nonVirtualParentView = get(this, 'parentView'),\n viewName = this.viewName,\n childLen, i;\n\n if (!this._super()) { return; }\n\n childLen = childViews.length;\n for (i=childLen-1; i>=0; i--) {\n childViews[i].removedFromDOM = true;\n }\n\n // remove from non-virtual parent view if viewName was specified\n if (viewName && nonVirtualParentView) {\n nonVirtualParentView.set(viewName, null);\n }\n\n childLen = childViews.length;\n for (i=childLen-1; i>=0; i--) {\n childViews[i].destroy();\n }\n\n return this;\n },\n\n /**\n Instantiates a view to be added to the childViews array during view\n initialization. You generally will not call this method directly unless\n you are overriding `createChildViews()`. Note that this method will\n automatically configure the correct settings on the new view instance to\n act as a child of the parent.\n\n @method createChildView\n @param {Class|String} viewClass\n @param {Hash} [attrs] Attributes to add\n @return {Ember.View} new instance\n */\n createChildView: function(view, attrs) {\n if (!view) {\n throw new TypeError(\"createChildViews first argument must exist\");\n }\n\n if (view.isView && view._parentView === this && view.container === this.container) {\n return view;\n }\n\n attrs = attrs || {};\n attrs._parentView = this;\n\n if (CoreView.detect(view)) {\n attrs.templateData = attrs.templateData || get(this, 'templateData');\n\n attrs.container = this.container;\n view = view.create(attrs);\n\n // don't set the property on a virtual view, as they are invisible to\n // consumers of the view API\n if (view.viewName) {\n set(get(this, 'concreteView'), view.viewName, view);\n }\n } else if ('string' === typeof view) {\n var fullName = 'view:' + view;\n var ViewKlass = this.container.lookupFactory(fullName);\n\n Ember.assert(\"Could not find view: '\" + fullName + \"'\", !!ViewKlass);\n\n attrs.templateData = get(this, 'templateData');\n view = ViewKlass.create(attrs);\n } else {\n Ember.assert('You must pass instance or subclass of View', view.isView);\n attrs.container = this.container;\n\n if (!get(view, 'templateData')) {\n attrs.templateData = get(this, 'templateData');\n }\n\n setProperties(view, attrs);\n\n }\n\n return view;\n },\n\n becameVisible: Ember.K,\n becameHidden: Ember.K,\n\n /**\n When the view's `isVisible` property changes, toggle the visibility\n element of the actual DOM element.\n\n @method _isVisibleDidChange\n @private\n */\n _isVisibleDidChange: observer('isVisible', function() {\n if (this._isVisible === get(this, 'isVisible')) { return ; }\n run.scheduleOnce('render', this, this._toggleVisibility);\n }),\n\n _toggleVisibility: function() {\n var $el = this.$();\n if (!$el) { return; }\n\n var isVisible = get(this, 'isVisible');\n\n if (this._isVisible === isVisible) { return ; }\n\n $el.toggle(isVisible);\n\n this._isVisible = isVisible;\n\n if (this._isAncestorHidden()) { return; }\n\n if (isVisible) {\n this._notifyBecameVisible();\n } else {\n this._notifyBecameHidden();\n }\n },\n\n _notifyBecameVisible: function() {\n this.trigger('becameVisible');\n\n this.forEachChildView(function(view) {\n var isVisible = get(view, 'isVisible');\n\n if (isVisible || isVisible === null) {\n view._notifyBecameVisible();\n }\n });\n },\n\n _notifyBecameHidden: function() {\n this.trigger('becameHidden');\n this.forEachChildView(function(view) {\n var isVisible = get(view, 'isVisible');\n\n if (isVisible || isVisible === null) {\n view._notifyBecameHidden();\n }\n });\n },\n\n _isAncestorHidden: function() {\n var parent = get(this, 'parentView');\n\n while (parent) {\n if (get(parent, 'isVisible') === false) { return true; }\n\n parent = get(parent, 'parentView');\n }\n\n return false;\n },\n\n clearBuffer: function() {\n this.invokeRecursively(nullViewsBuffer);\n },\n\n transitionTo: function(state, children) {\n var priorState = this.currentState,\n currentState = this.currentState = this.states[state];\n this.state = state;\n\n if (priorState && priorState.exit) { priorState.exit(this); }\n if (currentState.enter) { currentState.enter(this); }\n if (state === 'inDOM') { meta(this).cache.element = undefined; }\n\n if (children !== false) {\n this.forEachChildView(function(view) {\n view.transitionTo(state);\n });\n }\n },\n\n // .......................................................\n // EVENT HANDLING\n //\n\n /**\n Handle events from `Ember.EventDispatcher`\n\n @method handleEvent\n @param eventName {String}\n @param evt {Event}\n @private\n */\n handleEvent: function(eventName, evt) {\n return this.currentState.handleEvent(this, eventName, evt);\n },\n\n registerObserver: function(root, path, target, observer) {\n if (!observer && 'function' === typeof target) {\n observer = target;\n target = null;\n }\n\n if (!root || typeof root !== 'object') {\n return;\n }\n\n var view = this,\n stateCheckedObserver = function() {\n view.currentState.invokeObserver(this, observer);\n },\n scheduledObserver = function() {\n run.scheduleOnce('render', this, stateCheckedObserver);\n };\n\n addObserver(root, path, target, scheduledObserver);\n\n this.one('willClearRender', function() {\n removeObserver(root, path, target, scheduledObserver);\n });\n }\n\n });\n\n /*\n Describe how the specified actions should behave in the various\n states that a view can exist in. Possible states:\n\n * preRender: when a view is first instantiated, and after its\n element was destroyed, it is in the preRender state\n * inBuffer: once a view has been rendered, but before it has\n been inserted into the DOM, it is in the inBuffer state\n * hasElement: the DOM representation of the view is created,\n and is ready to be inserted\n * inDOM: once a view has been inserted into the DOM it is in\n the inDOM state. A view spends the vast majority of its\n existence in this state.\n * destroyed: once a view has been destroyed (using the destroy\n method), it is in this state. No further actions can be invoked\n on a destroyed view.\n */\n\n // in the destroyed state, everything is illegal\n\n // before rendering has begun, all legal manipulations are noops.\n\n // inside the buffer, legal manipulations are done on the buffer\n\n // once the view has been inserted into the DOM, legal manipulations\n // are done on the DOM element.\n\n function notifyMutationListeners() {\n run.once(View, 'notifyMutationListeners');\n }\n\n var DOMManager = {\n prepend: function(view, html) {\n view.$().prepend(html);\n notifyMutationListeners();\n },\n\n after: function(view, html) {\n view.$().after(html);\n notifyMutationListeners();\n },\n\n html: function(view, html) {\n view.$().html(html);\n notifyMutationListeners();\n },\n\n replace: function(view) {\n var element = get(view, 'element');\n\n set(view, 'element', null);\n\n view._insertElementLater(function() {\n jQuery(element).replaceWith(get(view, 'element'));\n notifyMutationListeners();\n });\n },\n\n remove: function(view) {\n view.$().remove();\n notifyMutationListeners();\n },\n\n empty: function(view) {\n view.$().empty();\n notifyMutationListeners();\n }\n };\n\n View.reopen({\n domManager: DOMManager\n });\n\n View.reopenClass({\n\n /**\n Parse a path and return an object which holds the parsed properties.\n\n For example a path like \"content.isEnabled:enabled:disabled\" will return the\n following object:\n\n ```javascript\n {\n path: \"content.isEnabled\",\n className: \"enabled\",\n falsyClassName: \"disabled\",\n classNames: \":enabled:disabled\"\n }\n ```\n\n @method _parsePropertyPath\n @static\n @private\n */\n _parsePropertyPath: function(path) {\n var split = path.split(':'),\n propertyPath = split[0],\n classNames = \"\",\n className,\n falsyClassName;\n\n // check if the property is defined as prop:class or prop:trueClass:falseClass\n if (split.length > 1) {\n className = split[1];\n if (split.length === 3) { falsyClassName = split[2]; }\n\n classNames = ':' + className;\n if (falsyClassName) { classNames += \":\" + falsyClassName; }\n }\n\n return {\n path: propertyPath,\n classNames: classNames,\n className: (className === '') ? undefined : className,\n falsyClassName: falsyClassName\n };\n },\n\n /**\n Get the class name for a given value, based on the path, optional\n `className` and optional `falsyClassName`.\n\n - if a `className` or `falsyClassName` has been specified:\n - if the value is truthy and `className` has been specified,\n `className` is returned\n - if the value is falsy and `falsyClassName` has been specified,\n `falsyClassName` is returned\n - otherwise `null` is returned\n - if the value is `true`, the dasherized last part of the supplied path\n is returned\n - if the value is not `false`, `undefined` or `null`, the `value`\n is returned\n - if none of the above rules apply, `null` is returned\n\n @method _classStringForValue\n @param path\n @param val\n @param className\n @param falsyClassName\n @static\n @private\n */\n _classStringForValue: function(path, val, className, falsyClassName) {\n if(isArray(val)) {\n val = get(val, 'length') !== 0; \n }\n \n // When using the colon syntax, evaluate the truthiness or falsiness\n // of the value to determine which className to return\n if (className || falsyClassName) {\n if (className && !!val) {\n return className;\n\n } else if (falsyClassName && !val) {\n return falsyClassName;\n\n } else {\n return null;\n }\n\n // If value is a Boolean and true, return the dasherized property\n // name.\n } else if (val === true) {\n // Normalize property path to be suitable for use\n // as a class name. For exaple, content.foo.barBaz\n // becomes bar-baz.\n var parts = path.split('.');\n return dasherize(parts[parts.length-1]);\n\n // If the value is not false, undefined, or null, return the current\n // value of the property.\n } else if (val !== false && val != null) {\n return val;\n\n // Nothing to display. Return null so that the old class is removed\n // but no new class is added.\n } else {\n return null;\n }\n }\n });\n\n var mutation = EmberObject.extend(Evented).create();\n\n View.addMutationListener = function(callback) {\n mutation.on('change', callback);\n };\n\n View.removeMutationListener = function(callback) {\n mutation.off('change', callback);\n };\n\n View.notifyMutationListeners = function() {\n mutation.trigger('change');\n };\n\n /**\n Global views hash\n\n @property views\n @static\n @type Hash\n */\n View.views = {};\n\n // If someone overrides the child views computed property when\n // defining their class, we want to be able to process the user's\n // supplied childViews and then restore the original computed property\n // at view initialization time. This happens in Ember.ContainerView's init\n // method.\n View.childViewsProperty = childViewsProperty;\n\n View.applyAttributeBindings = function(elem, name, value) {\n var type = typeOf(value);\n\n // if this changes, also change the logic in ember-handlebars/lib/helpers/binding.js\n if (name !== 'value' && (type === 'string' || (type === 'number' && !isNaN(value)))) {\n if (value !== elem.attr(name)) {\n elem.attr(name, value);\n }\n } else if (name === 'value' || type === 'boolean') {\n if (isNone(value) || value === false) {\n // `null`, `undefined` or `false` should remove attribute\n elem.removeAttr(name);\n elem.prop(name, '');\n } else if (value !== elem.prop(name)) {\n // value should always be properties\n elem.prop(name, value);\n }\n } else if (!value) {\n elem.removeAttr(name);\n }\n };\n\n __exports__.CoreView = CoreView;\n __exports__.View = View;\n __exports__.ViewCollection = ViewCollection;\n });\n})();\n//@ sourceURL=ember-views");minispade.register('ember', "(function() {// ensure that minispade loads the following modules first\nminispade.require('ember-metal');\nminispade.require('ember-runtime');\nminispade.require('ember-handlebars-compiler');\nminispade.require('ember-handlebars');\nminispade.require('ember-views');\nminispade.require('ember-routing');\nminispade.require('ember-application');\nminispade.require('ember-extension-support');\n\n\n// ensure that the global exports have occurred for above\n// required packages\nrequireModule('ember-metal');\nrequireModule('ember-runtime');\nrequireModule('ember-handlebars');\nrequireModule('ember-views');\nrequireModule('ember-routing');\nrequireModule('ember-application');\nrequireModule('ember-extension-support');\n\n// do this to ensure that Ember.Test is defined properly on the global\n// if it is present.\nif (Ember.__loader.registry['ember-testing']) {\n requireModule('ember-testing');\n}\n\n/**\nEmber\n\n@module ember\n*/\n\nfunction throwWithMessage(msg) {\n return function() {\n throw new Ember.Error(msg);\n };\n}\n\nfunction generateRemovedClass(className) {\n var msg = \" has been moved into a plugin: https://github.com/emberjs/ember-states\";\n\n return {\n extend: throwWithMessage(className + msg),\n create: throwWithMessage(className + msg)\n };\n}\n\nEmber.StateManager = generateRemovedClass(\"Ember.StateManager\");\n\n/**\n This was exported to ember-states plugin for v 1.0.0 release. See: https://github.com/emberjs/ember-states\n\n @class StateManager\n @namespace Ember\n*/\n\nEmber.State = generateRemovedClass(\"Ember.State\");\n\n/**\n This was exported to ember-states plugin for v 1.0.0 release. See: https://github.com/emberjs/ember-states\n\n @class State\n @namespace Ember\n*/\n\n})();\n//@ sourceURL=ember");minispade.register('loader', "(function() {var define, requireModule, require, requirejs, Ember;\n\n(function() {\n Ember = this.Ember = this.Ember || {};\n if (typeof Ember === 'undefined') { Ember = {} };\n\n if (typeof Ember.__loader === 'undefined') {\n var registry = {}, seen = {};\n\n define = function(name, deps, callback) {\n registry[name] = { deps: deps, callback: callback };\n };\n\n requirejs = require = requireModule = function(name) {\n if (seen.hasOwnProperty(name)) { return seen[name]; }\n seen[name] = {};\n\n if (!registry[name]) {\n throw new Error(\"Could not find module \" + name);\n }\n\n var mod = registry[name],\n deps = mod.deps,\n callback = mod.callback,\n reified = [],\n exports;\n\n for (var i=0, l=deps.length; i
    \";\n testEl.firstChild.innerHTML = \"\";\n return testEl.firstChild.innerHTML === '';\n })(),\n\n\n // IE 8 (and likely earlier) likes to move whitespace preceeding\n // a script tag to appear after it. This means that we can\n // accidentally remove whitespace when updating a morph.\n movesWhitespace = document && (function() {\n var testEl = document.createElement('div');\n testEl.innerHTML = \"Test: Value\";\n return testEl.childNodes[0].nodeValue === 'Test:' &&\n testEl.childNodes[2].nodeValue === ' Value';\n })();\n\n // Constructor that supports either Metamorph('foo') or new\n // Metamorph('foo');\n //\n // Takes a string of HTML as the argument.\n\n var Metamorph = function(html) {\n var self;\n\n if (this instanceof Metamorph) {\n self = this;\n } else {\n self = new K();\n }\n\n self.innerHTML = html;\n var myGuid = 'metamorph-'+(guid++);\n self.start = myGuid + '-start';\n self.end = myGuid + '-end';\n\n return self;\n };\n\n K.prototype = Metamorph.prototype;\n\n var rangeFor, htmlFunc, removeFunc, outerHTMLFunc, appendToFunc, afterFunc, prependFunc, startTagFunc, endTagFunc;\n\n outerHTMLFunc = function() {\n return this.startTag() + this.innerHTML + this.endTag();\n };\n\n startTagFunc = function() {\n /*\n * We replace chevron by its hex code in order to prevent escaping problems.\n * Check this thread for more explaination:\n * http://stackoverflow.com/questions/8231048/why-use-x3c-instead-of-when-generating-html-from-javascript\n */\n return \"hi\";\n * div.firstChild.firstChild.tagName //=> \"\"\n *\n * If our script markers are inside such a node, we need to find that\n * node and use *it* as the marker.\n */\n var realNode = function(start) {\n while (start.parentNode.tagName === \"\") {\n start = start.parentNode;\n }\n\n return start;\n };\n\n /*\n * When automatically adding a tbody, Internet Explorer inserts the\n * tbody immediately before the first . Other browsers create it\n * before the first node, no matter what.\n *\n * This means the the following code:\n *\n * div = document.createElement(\"div\");\n * div.innerHTML = \"
    hi
    \n *\n * Generates the following DOM in IE:\n *\n * + div\n * + table\n * - script id='first'\n * + tbody\n * + tr\n * + td\n * - \"hi\"\n * - script id='last'\n *\n * Which means that the two script tags, even though they were\n * inserted at the same point in the hierarchy in the original\n * HTML, now have different parents.\n *\n * This code reparents the first script tag by making it the tbody's\n * first child.\n *\n */\n var fixParentage = function(start, end) {\n if (start.parentNode !== end.parentNode) {\n end.parentNode.insertBefore(start, end.parentNode.firstChild);\n }\n };\n\n htmlFunc = function(html, outerToo) {\n // get the real starting node. see realNode for details.\n var start = realNode(document.getElementById(this.start));\n var end = document.getElementById(this.end);\n var parentNode = end.parentNode;\n var node, nextSibling, last;\n\n // make sure that the start and end nodes share the same\n // parent. If not, fix it.\n fixParentage(start, end);\n\n // remove all of the nodes after the starting placeholder and\n // before the ending placeholder.\n node = start.nextSibling;\n while (node) {\n nextSibling = node.nextSibling;\n last = node === end;\n\n // if this is the last node, and we want to remove it as well,\n // set the `end` node to the next sibling. This is because\n // for the rest of the function, we insert the new nodes\n // before the end (note that insertBefore(node, null) is\n // the same as appendChild(node)).\n //\n // if we do not want to remove it, just break.\n if (last) {\n if (outerToo) { end = node.nextSibling; } else { break; }\n }\n\n node.parentNode.removeChild(node);\n\n // if this is the last node and we didn't break before\n // (because we wanted to remove the outer nodes), break\n // now.\n if (last) { break; }\n\n node = nextSibling;\n }\n\n // get the first node for the HTML string, even in cases like\n // tables and lists where a simple innerHTML on a div would\n // swallow some of the content.\n node = firstNodeFor(start.parentNode, html);\n\n if (outerToo) {\n start.parentNode.removeChild(start);\n }\n\n // copy the nodes for the HTML between the starting and ending\n // placeholder.\n while (node) {\n nextSibling = node.nextSibling;\n parentNode.insertBefore(node, end);\n node = nextSibling;\n }\n };\n\n // remove the nodes in the DOM representing this metamorph.\n //\n // this includes the starting and ending placeholders.\n removeFunc = function() {\n var start = realNode(document.getElementById(this.start));\n var end = document.getElementById(this.end);\n\n this.html('');\n start.parentNode.removeChild(start);\n end.parentNode.removeChild(end);\n };\n\n appendToFunc = function(parentNode) {\n var node = firstNodeFor(parentNode, this.outerHTML());\n var nextSibling;\n\n while (node) {\n nextSibling = node.nextSibling;\n parentNode.appendChild(node);\n node = nextSibling;\n }\n };\n\n afterFunc = function(html) {\n // get the real starting node. see realNode for details.\n var end = document.getElementById(this.end);\n var insertBefore = end.nextSibling;\n var parentNode = end.parentNode;\n var nextSibling;\n var node;\n\n // get the first node for the HTML string, even in cases like\n // tables and lists where a simple innerHTML on a div would\n // swallow some of the content.\n node = firstNodeFor(parentNode, html);\n\n // copy the nodes for the HTML between the starting and ending\n // placeholder.\n while (node) {\n nextSibling = node.nextSibling;\n parentNode.insertBefore(node, insertBefore);\n node = nextSibling;\n }\n };\n\n prependFunc = function(html) {\n var start = document.getElementById(this.start);\n var parentNode = start.parentNode;\n var nextSibling;\n var node;\n\n node = firstNodeFor(parentNode, html);\n var insertBefore = start.nextSibling;\n\n while (node) {\n nextSibling = node.nextSibling;\n parentNode.insertBefore(node, insertBefore);\n node = nextSibling;\n }\n };\n }\n\n Metamorph.prototype.html = function(html) {\n this.checkRemoved();\n if (html === undefined) { return this.innerHTML; }\n\n htmlFunc.call(this, html);\n\n this.innerHTML = html;\n };\n\n Metamorph.prototype.replaceWith = function(html) {\n this.checkRemoved();\n htmlFunc.call(this, html, true);\n };\n\n Metamorph.prototype.remove = removeFunc;\n Metamorph.prototype.outerHTML = outerHTMLFunc;\n Metamorph.prototype.appendTo = appendToFunc;\n Metamorph.prototype.after = afterFunc;\n Metamorph.prototype.prepend = prependFunc;\n Metamorph.prototype.startTag = startTagFunc;\n Metamorph.prototype.endTag = endTagFunc;\n\n Metamorph.prototype.isRemoved = function() {\n var before = document.getElementById(this.start);\n var after = document.getElementById(this.end);\n\n return !before || !after;\n };\n\n Metamorph.prototype.checkRemoved = function() {\n if (this.isRemoved()) {\n throw new Error(\"Cannot perform operations on a Metamorph that is not in the DOM.\");\n }\n };\n\n return Metamorph;\n });\n\n})();\n//@ sourceURL=metamorph");minispade.register('rsvp', "(function() {/**\n @class RSVP\n @module RSVP\n */\ndefine(\"rsvp/all\",\n [\"./promise\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n\n /**\n This is a convenient alias for `RSVP.Promise.all`.\n\n @method all\n @for RSVP\n @param {Array} array Array of promises.\n @param {String} label An optional label. This is useful\n for tooling.\n @static\n */\n __exports__[\"default\"] = function all(array, label) {\n return Promise.all(array, label);\n };\n });\ndefine(\"rsvp/all_settled\",\n [\"./promise\",\"./utils\",\"exports\"],\n function(__dependency1__, __dependency2__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n var isArray = __dependency2__.isArray;\n var isNonThenable = __dependency2__.isNonThenable;\n\n /**\n `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing\n a fail-fast method, it waits until all the promises have returned and\n shows you all the results. This is useful if you want to handle multiple\n promises' failure states together as a set.\n\n Returns a promise that is fulfilled when all the given promises have been\n settled. The return promise is fulfilled with an array of the states of\n the promises passed into the `promises` array argument.\n\n Each state object will either indicate fulfillment or rejection, and\n provide the corresponding value or reason. The states will take one of\n the following formats:\n\n ```javascript\n { state: 'fulfilled', value: value }\n or\n { state: 'rejected', reason: reason }\n ```\n\n Example:\n\n ```javascript\n var promise1 = RSVP.Promise.resolve(1);\n var promise2 = RSVP.Promise.reject(new Error('2'));\n var promise3 = RSVP.Promise.reject(new Error('3'));\n var promises = [ promise1, promise2, promise3 ];\n\n RSVP.allSettled(promises).then(function(array){\n // array == [\n // { state: 'fulfilled', value: 1 },\n // { state: 'rejected', reason: Error },\n // { state: 'rejected', reason: Error }\n // ]\n // Note that for the second item, reason.message will be \"2\", and for the\n // third item, reason.message will be \"3\".\n }, function(error) {\n // Not run. (This block would only be called if allSettled had failed,\n // for instance if passed an incorrect argument type.)\n });\n ```\n\n @method allSettled\n @for RSVP\n @param {Array} promises\n @param {String} label - optional string that describes the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled with an array of the settled\n states of the constituent promises.\n @static\n */\n\n __exports__[\"default\"] = function allSettled(entries, label) {\n return new Promise(function(resolve, reject) {\n if (!isArray(entries)) {\n throw new TypeError('You must pass an array to allSettled.');\n }\n\n var remaining = entries.length;\n var entry;\n\n if (remaining === 0) {\n resolve([]);\n return;\n }\n\n var results = new Array(remaining);\n\n function fulfilledResolver(index) {\n return function(value) {\n resolveAll(index, fulfilled(value));\n };\n }\n\n function rejectedResolver(index) {\n return function(reason) {\n resolveAll(index, rejected(reason));\n };\n }\n\n function resolveAll(index, value) {\n results[index] = value;\n if (--remaining === 0) {\n resolve(results);\n }\n }\n\n for (var index = 0; index < entries.length; index++) {\n entry = entries[index];\n\n if (isNonThenable(entry)) {\n resolveAll(index, fulfilled(entry));\n } else {\n Promise.cast(entry).then(fulfilledResolver(index), rejectedResolver(index));\n }\n }\n }, label);\n };\n\n function fulfilled(value) {\n return { state: 'fulfilled', value: value };\n }\n\n function rejected(reason) {\n return { state: 'rejected', reason: reason };\n }\n });\ndefine(\"rsvp/config\",\n [\"./events\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var EventTarget = __dependency1__[\"default\"];\n\n var config = {\n instrument: false\n };\n\n EventTarget.mixin(config);\n\n function configure(name, value) {\n if (name === 'onerror') {\n // handle for legacy users that expect the actual\n // error to be passed to their function added via\n // `RSVP.configure('onerror', someFunctionHere);`\n config.on('error', value);\n return;\n }\n\n if (arguments.length === 2) {\n config[name] = value;\n } else {\n return config[name];\n }\n }\n\n __exports__.config = config;\n __exports__.configure = configure;\n });\ndefine(\"rsvp/defer\",\n [\"./promise\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n\n /**\n `RSVP.defer` returns an object similar to jQuery's `$.Deferred`.\n `RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s\n interface. New code should use the `RSVP.Promise` constructor instead.\n\n The object returned from `RSVP.defer` is a plain object with three properties:\n\n * promise - an `RSVP.Promise`.\n * reject - a function that causes the `promise` property on this object to\n become rejected\n * resolve - a function that causes the `promise` property on this object to\n become fulfilled.\n\n Example:\n\n ```javascript\n var deferred = RSVP.defer();\n\n deferred.resolve(\"Success!\");\n\n deferred.promise.then(function(value){\n // value here is \"Success!\"\n });\n ```\n\n @method defer\n @for RSVP\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Object}\n */\n\n __exports__[\"default\"] = function defer(label) {\n var deferred = { };\n\n deferred.promise = new Promise(function(resolve, reject) {\n deferred.resolve = resolve;\n deferred.reject = reject;\n }, label);\n\n return deferred;\n };\n });\ndefine(\"rsvp/events\",\n [\"exports\"],\n function(__exports__) {\n \"use strict\";\n var indexOf = function(callbacks, callback) {\n for (var i=0, l=callbacks.length; i 1;\n };\n\n RSVP.filter(promises, filterFn).then(function(result){\n // result is [ 2, 3 ]\n });\n ```\n\n If any of the `promises` given to `RSVP.filter` are rejected, the first promise\n that is rejected will be given as an argument to the returned promise's\n rejection handler. For example:\n\n ```javascript\n var promise1 = RSVP.resolve(1);\n var promise2 = RSVP.reject(new Error(\"2\"));\n var promise3 = RSVP.reject(new Error(\"3\"));\n var promises = [ promise1, promise2, promise3 ];\n\n var filterFn = function(item){\n return item > 1;\n };\n\n RSVP.filter(promises, filterFn).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(reason) {\n // reason.message === \"2\"\n });\n ```\n\n `RSVP.filter` will also wait for any promises returned from `filterFn`.\n For instance, you may want to fetch a list of users then return a subset\n of those users based on some asynchronous operation:\n\n ```javascript\n\n var alice = { name: 'alice' };\n var bob = { name: 'bob' };\n var users = [ alice, bob ];\n\n var promises = users.map(function(user){\n return RSVP.resolve(user);\n });\n\n var filterFn = function(user){\n // Here, Alice has permissions to create a blog post, but Bob does not.\n return getPrivilegesForUser(user).then(function(privs){\n return privs.can_create_blog_post === true;\n });\n };\n RSVP.filter(promises, filterFn).then(function(users){\n // true, because the server told us only Alice can create a blog post.\n users.length === 1;\n // false, because Alice is the only user present in `users`\n users[0] === bob;\n });\n ```\n\n @method filter\n @for RSVP\n @param {Array} promises\n @param {Function} filterFn - function to be called on each resolved value to\n filter the final results.\n @param {String} label optional string describing the promise. Useful for\n tooling.\n @return {Promise}\n */\n function filter(promises, filterFn, label) {\n return all(promises, label).then(function(values){\n if (!isArray(promises)) {\n throw new TypeError('You must pass an array to filter.');\n }\n\n if (!isFunction(filterFn)){\n throw new TypeError(\"You must pass a function to filter's second argument.\");\n }\n\n return map(promises, filterFn, label).then(function(filterResults){\n var i,\n valuesLen = values.length,\n filtered = [];\n\n for (i = 0; i < valuesLen; i++){\n if(filterResults[i]) filtered.push(values[i]);\n }\n return filtered;\n });\n });\n }\n\n __exports__[\"default\"] = filter;\n });\ndefine(\"rsvp/hash\",\n [\"./promise\",\"./utils\",\"exports\"],\n function(__dependency1__, __dependency2__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n var isNonThenable = __dependency2__.isNonThenable;\n var keysOf = __dependency2__.keysOf;\n\n /**\n `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array\n for its `promises` argument.\n\n Returns a promise that is fulfilled when all the given promises have been\n fulfilled, or rejected if any of them become rejected. The returned promise\n is fulfilled with a hash that has the same key names as the `promises` object\n argument. If any of the values in the object are not promises, they will\n simply be copied over to the fulfilled object.\n\n Example:\n\n ```javascript\n var promises = {\n myPromise: RSVP.resolve(1),\n yourPromise: RSVP.resolve(2),\n theirPromise: RSVP.resolve(3),\n notAPromise: 4\n };\n\n RSVP.hash(promises).then(function(hash){\n // hash here is an object that looks like:\n // {\n // myPromise: 1,\n // yourPromise: 2,\n // theirPromise: 3,\n // notAPromise: 4\n // }\n });\n ````\n\n If any of the `promises` given to `RSVP.hash` are rejected, the first promise\n that is rejected will be given as the reason to the rejection handler.\n\n Example:\n\n ```javascript\n var promises = {\n myPromise: RSVP.resolve(1),\n rejectedPromise: RSVP.reject(new Error(\"rejectedPromise\")),\n anotherRejectedPromise: RSVP.reject(new Error(\"anotherRejectedPromise\")),\n };\n\n RSVP.hash(promises).then(function(hash){\n // Code here never runs because there are rejected promises!\n }, function(reason) {\n // reason.message === \"rejectedPromise\"\n });\n ```\n\n An important note: `RSVP.hash` is intended for plain JavaScript objects that\n are just a set of keys and values. `RSVP.hash` will NOT preserve prototype\n chains.\n\n Example:\n\n ```javascript\n function MyConstructor(){\n this.example = RSVP.resolve(\"Example\");\n }\n\n MyConstructor.prototype = {\n protoProperty: RSVP.resolve(\"Proto Property\")\n };\n\n var myObject = new MyConstructor();\n\n RSVP.hash(myObject).then(function(hash){\n // protoProperty will not be present, instead you will just have an\n // object that looks like:\n // {\n // example: \"Example\"\n // }\n //\n // hash.hasOwnProperty('protoProperty'); // false\n // 'undefined' === typeof hash.protoProperty\n });\n ```\n\n @method hash\n @for RSVP\n @param {Object} promises\n @param {String} label optional string that describes the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all properties of `promises`\n have been fulfilled, or rejected if any of them become rejected.\n @static\n */\n __exports__[\"default\"] = function hash(object, label) {\n return new Promise(function(resolve, reject){\n var results = {};\n var keys = keysOf(object);\n var remaining = keys.length;\n var entry, property;\n\n if (remaining === 0) {\n resolve(results);\n return;\n }\n\n function fulfilledTo(property) {\n return function(value) {\n results[property] = value;\n if (--remaining === 0) {\n resolve(results);\n }\n };\n }\n\n function onRejection(reason) {\n remaining = 0;\n reject(reason);\n }\n\n for (var i = 0; i < keys.length; i++) {\n property = keys[i];\n entry = object[property];\n\n if (isNonThenable(entry)) {\n results[property] = entry;\n if (--remaining === 0) {\n resolve(results);\n }\n } else {\n Promise.cast(entry).then(fulfilledTo(property), onRejection);\n }\n }\n });\n };\n });\ndefine(\"rsvp/instrument\",\n [\"./config\",\"./utils\",\"exports\"],\n function(__dependency1__, __dependency2__, __exports__) {\n \"use strict\";\n var config = __dependency1__.config;\n var now = __dependency2__.now;\n\n __exports__[\"default\"] = function instrument(eventName, promise, child) {\n // instrumentation should not disrupt normal usage.\n try {\n config.trigger(eventName, {\n guid: promise._guidKey + promise._id,\n eventName: eventName,\n detail: promise._detail,\n childGuid: child && promise._guidKey + child._id,\n label: promise._label,\n timeStamp: now(),\n stack: new Error(promise._label).stack\n });\n } catch(error) {\n setTimeout(function(){\n throw error;\n }, 0);\n }\n };\n });\ndefine(\"rsvp/map\",\n [\"./promise\",\"./all\",\"./utils\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n var all = __dependency2__[\"default\"];\n var isArray = __dependency3__.isArray;\n var isFunction = __dependency3__.isFunction;\n\n /**\n `RSVP.map` is similar to JavaScript's native `map` method, except that it\n waits for all promises to become fulfilled before running the `mapFn` on\n each item in given to `promises`. `RSVP.map` returns a promise that will\n become fulfilled with the result of running `mapFn` on the values the promises\n become fulfilled with.\n\n For example:\n\n ```javascript\n\n var promise1 = RSVP.resolve(1);\n var promise2 = RSVP.resolve(2);\n var promise3 = RSVP.resolve(3);\n var promises = [ promise1, promise2, promise3 ];\n\n var mapFn = function(item){\n return item + 1;\n };\n\n RSVP.map(promises, mapFn).then(function(result){\n // result is [ 2, 3, 4 ]\n });\n ```\n\n If any of the `promises` given to `RSVP.map` are rejected, the first promise\n that is rejected will be given as an argument to the returned promise's\n rejection handler. For example:\n\n ```javascript\n var promise1 = RSVP.resolve(1);\n var promise2 = RSVP.reject(new Error(\"2\"));\n var promise3 = RSVP.reject(new Error(\"3\"));\n var promises = [ promise1, promise2, promise3 ];\n\n var mapFn = function(item){\n return item + 1;\n };\n\n RSVP.map(promises, mapFn).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(reason) {\n // reason.message === \"2\"\n });\n ```\n\n `RSVP.map` will also wait if a promise is returned from `mapFn`. For example,\n say you want to get all comments from a set of blog posts, but you need\n the blog posts first becuase they contain a url to those comments.\n\n ```javscript\n\n var mapFn = function(blogPost){\n // getComments does some ajax and returns an RSVP.Promise that is fulfilled\n // with some comments data\n return getComments(blogPost.comments_url);\n };\n\n // getBlogPosts does some ajax and returns an RSVP.Promise that is fulfilled\n // with some blog post data\n RSVP.map(getBlogPosts(), mapFn).then(function(comments){\n // comments is the result of asking the server for the comments\n // of all blog posts returned from getBlogPosts()\n });\n ```\n\n @method map\n @for RSVP\n @param {Array} promises\n @param {Function} mapFn function to be called on each fulfilled promise.\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled with the result of calling\n `mapFn` on each fulfilled promise or value when they become fulfilled.\n The promise will be rejected if any of the given `promises` become rejected.\n @static\n */\n __exports__[\"default\"] = function map(promises, mapFn, label) {\n return all(promises, label).then(function(results){\n if (!isArray(promises)) {\n throw new TypeError('You must pass an array to map.');\n }\n\n if (!isFunction(mapFn)){\n throw new TypeError(\"You must pass a function to map's second argument.\");\n }\n\n\n var resultLen = results.length,\n mappedResults = [],\n i;\n\n for (i = 0; i < resultLen; i++){\n mappedResults.push(mapFn(results[i]));\n }\n\n return all(mappedResults, label);\n });\n };\n });\ndefine(\"rsvp/node\",\n [\"./promise\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n\n var slice = Array.prototype.slice;\n\n function makeNodeCallbackFor(resolve, reject) {\n return function (error, value) {\n if (error) {\n reject(error);\n } else if (arguments.length > 2) {\n resolve(slice.call(arguments, 1));\n } else {\n resolve(value);\n }\n };\n }\n\n /**\n `RSVP.denodeify` takes a \"node-style\" function and returns a function that\n will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the\n browser when you'd prefer to use promises over using callbacks. For example,\n `denodeify` transforms the following:\n\n ```javascript\n var fs = require('fs');\n\n fs.readFile('myfile.txt', function(err, data){\n if (err) return handleError(err);\n handleData(data);\n });\n ```\n\n into:\n\n ```javascript\n var fs = require('fs');\n\n var readFile = RSVP.denodeify(fs.readFile);\n\n readFile('myfile.txt').then(handleData, handleError);\n ```\n\n Using `denodeify` makes it easier to compose asynchronous operations instead\n of using callbacks. For example, instead of:\n\n ```javascript\n var fs = require('fs');\n var log = require('some-async-logger');\n\n fs.readFile('myfile.txt', function(err, data){\n if (err) return handleError(err);\n fs.writeFile('myfile2.txt', data, function(err){\n if (err) throw err;\n log('success', function(err) {\n if (err) throw err;\n });\n });\n });\n ```\n\n You can chain the operations together using `then` from the returned promise:\n\n ```javascript\n var fs = require('fs');\n var denodeify = RSVP.denodeify;\n var readFile = denodeify(fs.readFile);\n var writeFile = denodeify(fs.writeFile);\n var log = denodeify(require('some-async-logger'));\n\n readFile('myfile.txt').then(function(data){\n return writeFile('myfile2.txt', data);\n }).then(function(){\n return log('SUCCESS');\n }).then(function(){\n // success handler\n }, function(reason){\n // rejection handler\n });\n ```\n\n @method denodeify\n @for RSVP\n @param {Function} nodeFunc a \"node-style\" function that takes a callback as\n its last argument. The callback expects an error to be passed as its first\n argument (if an error occurred, otherwise null), and the value from the\n operation as its second argument (\"function(err, value){ }\").\n @param {Any} binding optional argument for binding the \"this\" value when\n calling the `nodeFunc` function.\n @return {Function} a function that wraps `nodeFunc` to return an\n `RSVP.Promise`\n @static\n */\n __exports__[\"default\"] = function denodeify(nodeFunc, binding) {\n return function() {\n var nodeArgs = slice.call(arguments), resolve, reject;\n var thisArg = this || binding;\n\n return new Promise(function(resolve, reject) {\n Promise.all(nodeArgs).then(function(nodeArgs) {\n try {\n nodeArgs.push(makeNodeCallbackFor(resolve, reject));\n nodeFunc.apply(thisArg, nodeArgs);\n } catch(e) {\n reject(e);\n }\n });\n });\n };\n };\n });\ndefine(\"rsvp/promise\",\n [\"./config\",\"./events\",\"./instrument\",\"./utils\",\"./promise/cast\",\"./promise/all\",\"./promise/race\",\"./promise/resolve\",\"./promise/reject\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __exports__) {\n \"use strict\";\n var config = __dependency1__.config;\n var EventTarget = __dependency2__[\"default\"];\n var instrument = __dependency3__[\"default\"];\n var objectOrFunction = __dependency4__.objectOrFunction;\n var isFunction = __dependency4__.isFunction;\n var now = __dependency4__.now;\n var cast = __dependency5__[\"default\"];\n var all = __dependency6__[\"default\"];\n var race = __dependency7__[\"default\"];\n var Resolve = __dependency8__[\"default\"];\n var Reject = __dependency9__[\"default\"];\n\n var guidKey = 'rsvp_' + now() + '-';\n var counter = 0;\n\n function noop() {}\n\n __exports__[\"default\"] = Promise;\n\n\n /**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise’s eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable. Similarly, a\n rejection reason is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n var promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error(\"getJSON: `\" + url + \"` failed with status: [\" + this.status + \"]\");\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class RSVP.Promise\n @param {function}\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @constructor\n */\n function Promise(resolver, label) {\n if (!isFunction(resolver)) {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n }\n\n if (!(this instanceof Promise)) {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n }\n\n this._id = counter++;\n this._label = label;\n this._subscribers = [];\n\n if (config.instrument) {\n instrument('created', this);\n }\n\n if (noop !== resolver) {\n invokeResolver(resolver, this);\n }\n }\n\n function invokeResolver(resolver, promise) {\n function resolvePromise(value) {\n resolve(promise, value);\n }\n\n function rejectPromise(reason) {\n reject(promise, reason);\n }\n\n try {\n resolver(resolvePromise, rejectPromise);\n } catch(e) {\n rejectPromise(e);\n }\n }\n\n Promise.cast = cast;\n Promise.all = all;\n Promise.race = race;\n Promise.resolve = Resolve;\n Promise.reject = Reject;\n\n var PENDING = void 0;\n var SEALED = 0;\n var FULFILLED = 1;\n var REJECTED = 2;\n\n function subscribe(parent, child, onFulfillment, onRejection) {\n var subscribers = parent._subscribers;\n var length = subscribers.length;\n\n subscribers[length] = child;\n subscribers[length + FULFILLED] = onFulfillment;\n subscribers[length + REJECTED] = onRejection;\n }\n\n function publish(promise, settled) {\n var child, callback, subscribers = promise._subscribers, detail = promise._detail;\n\n if (config.instrument) {\n instrument(settled === FULFILLED ? 'fulfilled' : 'rejected', promise);\n }\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n invokeCallback(settled, child, callback, detail);\n }\n\n promise._subscribers = null;\n }\n\n Promise.prototype = {\n constructor: Promise,\n\n _id: undefined,\n _guidKey: guidKey,\n _label: undefined,\n\n _state: undefined,\n _detail: undefined,\n _subscribers: undefined,\n\n _onerror: function (reason) {\n config.trigger('error', reason);\n },\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n\n Chaining\n --------\n\n The return value of `then` is itself a promise. This second, \"downstream\"\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return \"default name\";\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `\"default name\"`\n });\n\n findUser().then(function (user) {\n throw new Error(\"Found user, but still unhappy\");\n }, function (reason) {\n throw new Error(\"`findUser` rejected and we're unhappy\");\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be \"Found user, but still unhappy\".\n // If `findUser` rejected, `reason` will be \"`findUser` rejected and we're unhappy\".\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException(\"Upstream error\");\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n\n Assimilation\n ------------\n\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n\n If the assimliated promise rejects, then the downstream promise will also reject.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n\n Simple Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var result;\n\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n\n Advanced Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var author, books;\n\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n\n function foundBooks(books) {\n\n }\n\n function failure(reason) {\n\n }\n\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise}\n */\n then: function(onFulfillment, onRejection, label) {\n var promise = this;\n this._onerror = null;\n\n var thenPromise = new this.constructor(noop, label);\n\n if (this._state) {\n var callbacks = arguments;\n config.async(function invokePromiseCallback() {\n invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail);\n });\n } else {\n subscribe(this, thenPromise, onFulfillment, onRejection);\n }\n\n if (config.instrument) {\n instrument('chained', promise, thenPromise);\n }\n\n return thenPromise;\n },\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n\n ```js\n function findAuthor(){\n throw new Error(\"couldn't find that author\");\n }\n\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n\n @method catch\n @param {Function} onRejection\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function(onRejection, label) {\n return this.then(null, onRejection, label);\n },\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n\n Synchronous example:\n\n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n\n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n\n Asynchronous example:\n\n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n\n @method finally\n @param {Function} callback\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise}\n */\n 'finally': function(callback, label) {\n var constructor = this.constructor;\n\n return this.then(function(value) {\n return constructor.cast(callback()).then(function(){\n return value;\n });\n }, function(reason) {\n return constructor.cast(callback()).then(function(){\n throw reason;\n });\n }, label);\n }\n };\n\n function invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value, error, succeeded, failed;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n succeeded = true;\n } catch(e) {\n failed = true;\n error = e;\n }\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (handleThenable(promise, value)) {\n return;\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (failed) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n resolve(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n }\n\n function handleThenable(promise, value) {\n var then = null,\n resolved;\n\n try {\n if (promise === value) {\n throw new TypeError(\"A promises callback cannot return that same promise.\");\n }\n\n if (objectOrFunction(value)) {\n then = value.then;\n\n if (isFunction(then)) {\n then.call(value, function(val) {\n if (resolved) { return true; }\n resolved = true;\n\n if (value !== val) {\n resolve(promise, val);\n } else {\n fulfill(promise, val);\n }\n }, function(val) {\n if (resolved) { return true; }\n resolved = true;\n\n reject(promise, val);\n }, 'derived from: ' + (promise._label || ' unknown promise'));\n\n return true;\n }\n }\n } catch (error) {\n if (resolved) { return true; }\n reject(promise, error);\n return true;\n }\n\n return false;\n }\n\n function resolve(promise, value) {\n if (promise === value) {\n fulfill(promise, value);\n } else if (!handleThenable(promise, value)) {\n fulfill(promise, value);\n }\n }\n\n function fulfill(promise, value) {\n if (promise._state !== PENDING) { return; }\n promise._state = SEALED;\n promise._detail = value;\n\n config.async(publishFulfillment, promise);\n }\n\n function reject(promise, reason) {\n if (promise._state !== PENDING) { return; }\n promise._state = SEALED;\n promise._detail = reason;\n\n config.async(publishRejection, promise);\n }\n\n function publishFulfillment(promise) {\n publish(promise, promise._state = FULFILLED);\n }\n\n function publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._detail);\n }\n\n publish(promise, promise._state = REJECTED);\n }\n });\ndefine(\"rsvp/promise/all\",\n [\"../utils\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var isArray = __dependency1__.isArray;\n var isNonThenable = __dependency1__.isNonThenable;\n\n /**\n `RSVP.Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n var promise1 = RSVP.resolve(1);\n var promise2 = RSVP.resolve(2);\n var promise3 = RSVP.resolve(3);\n var promises = [ promise1, promise2, promise3 ];\n\n RSVP.Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `RSVP.all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n var promise1 = RSVP.resolve(1);\n var promise2 = RSVP.reject(new Error(\"2\"));\n var promise3 = RSVP.reject(new Error(\"3\"));\n var promises = [ promise1, promise2, promise3 ];\n\n RSVP.Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @for Ember.RSVP.Promise\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n */\n __exports__[\"default\"] = function all(entries, label) {\n\n /*jshint validthis:true */\n var Constructor = this;\n\n return new Constructor(function(resolve, reject) {\n if (!isArray(entries)) {\n throw new TypeError('You must pass an array to all.');\n }\n\n var remaining = entries.length;\n var results = new Array(remaining);\n var entry, pending = true;\n\n if (remaining === 0) {\n resolve(results);\n return;\n }\n\n function fulfillmentAt(index) {\n return function(value) {\n results[index] = value;\n if (--remaining === 0) {\n resolve(results);\n }\n };\n }\n\n function onRejection(reason) {\n remaining = 0;\n reject(reason);\n }\n\n for (var index = 0; index < entries.length; index++) {\n entry = entries[index];\n if (isNonThenable(entry)) {\n results[index] = entry;\n if (--remaining === 0) {\n resolve(results);\n }\n } else {\n Constructor.cast(entry).then(fulfillmentAt(index), onRejection);\n }\n }\n }, label);\n };\n });\ndefine(\"rsvp/promise/cast\",\n [\"exports\"],\n function(__exports__) {\n \"use strict\";\n /**\n `RSVP.Promise.cast` coerces its argument to a promise, or returns the\n argument if it is already a promise which shares a constructor with the caster.\n\n Example:\n\n ```javascript\n var promise = RSVP.Promise.resolve(1);\n var casted = RSVP.Promise.cast(promise);\n\n console.log(promise === casted); // true\n ```\n\n In the case of a promise whose constructor does not match, it is assimilated.\n The resulting promise will fulfill or reject based on the outcome of the\n promise being casted.\n\n Example:\n\n ```javascript\n var thennable = $.getJSON('/api/foo');\n var casted = RSVP.Promise.cast(thennable);\n\n console.log(thennable === casted); // false\n console.log(casted instanceof RSVP.Promise) // true\n\n casted.then(function(data) {\n // data is the value getJSON fulfills with\n });\n ```\n\n In the case of a non-promise, a promise which will fulfill with that value is\n returned.\n\n Example:\n\n ```javascript\n var value = 1; // could be a number, boolean, string, undefined...\n var casted = RSVP.Promise.cast(value);\n\n console.log(value === casted); // false\n console.log(casted instanceof RSVP.Promise) // true\n\n casted.then(function(val) {\n val === value // => true\n });\n ```\n\n `RSVP.Promise.cast` is similar to `RSVP.Promise.resolve`, but `RSVP.Promise.cast` differs in the\n following ways:\n\n * `RSVP.Promise.cast` serves as a memory-efficient way of getting a promise, when you\n have something that could either be a promise or a value. RSVP.resolve\n will have the same effect but will create a new promise wrapper if the\n argument is a promise.\n * `RSVP.Promise.cast` is a way of casting incoming thenables or promise subclasses to\n promises of the exact class specified, so that the resulting object's `then` is\n ensured to have the behavior of the constructor you are calling cast on (i.e., RSVP.Promise).\n\n @method cast\n @param {Object} object to be casted\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise\n @static\n */\n\n __exports__[\"default\"] = function cast(object, label) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n return new Constructor(function(resolve) {\n resolve(object);\n }, label);\n };\n });\ndefine(\"rsvp/promise/race\",\n [\"../utils\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n /* global toString */\n\n var isArray = __dependency1__.isArray;\n var isFunction = __dependency1__.isFunction;\n var isNonThenable = __dependency1__.isNonThenable;\n\n /**\n `RSVP.Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n var promise1 = new RSVP.Promise(function(resolve, reject){\n setTimeout(function(){\n resolve(\"promise 1\");\n }, 200);\n });\n\n var promise2 = new RSVP.Promise(function(resolve, reject){\n setTimeout(function(){\n resolve(\"promise 2\");\n }, 100);\n });\n\n RSVP.Promise.race([promise1, promise2]).then(function(result){\n // result === \"promise 2\" because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `RSVP.Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n var promise1 = new RSVP.Promise(function(resolve, reject){\n setTimeout(function(){\n resolve(\"promise 1\");\n }, 200);\n });\n\n var promise2 = new RSVP.Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error(\"promise 2\"));\n }, 100);\n });\n\n RSVP.Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === \"promise2\" because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n RSVP.Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @param {Array} promises array of promises to observe\n @param {String} label optional string for describing the promise returned.\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n @static\n */\n __exports__[\"default\"] = function race(entries, label) {\n /*jshint validthis:true */\n var Constructor = this, entry;\n\n return new Constructor(function(resolve, reject) {\n if (!isArray(entries)) {\n throw new TypeError('You must pass an array to race.');\n }\n\n var pending = true;\n\n function onFulfillment(value) { if (pending) { pending = false; resolve(value); } }\n function onRejection(reason) { if (pending) { pending = false; reject(reason); } }\n\n for (var i = 0; i < entries.length; i++) {\n entry = entries[i];\n if (isNonThenable(entry)) {\n pending = false;\n resolve(entry);\n return;\n } else {\n Constructor.cast(entry).then(onFulfillment, onRejection);\n }\n }\n }, label);\n };\n });\ndefine(\"rsvp/promise/reject\",\n [\"exports\"],\n function(__exports__) {\n \"use strict\";\n /**\n `RSVP.Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n var promise = new RSVP.Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n var promise = RSVP.Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @param {Any} reason value that the returned promise will be rejected with.\n @param {String} label optional string for identifying the returned promise.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n @static\n */\n __exports__[\"default\"] = function reject(reason, label) {\n /*jshint validthis:true */\n var Constructor = this;\n\n return new Constructor(function (resolve, reject) {\n reject(reason);\n }, label);\n };\n });\ndefine(\"rsvp/promise/resolve\",\n [\"exports\"],\n function(__exports__) {\n \"use strict\";\n /**\n `RSVP.Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n var promise = new RSVP.Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n var promise = RSVP.Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @param {Any} value value that the returned promise will be resolved with\n @param {String} label optional string for identifying the returned promise.\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n @static\n */\n __exports__[\"default\"] = function resolve(value, label) {\n /*jshint validthis:true */\n var Constructor = this;\n\n return new Constructor(function(resolve, reject) {\n resolve(value);\n }, label);\n };\n });\ndefine(\"rsvp/race\",\n [\"./promise\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n\n /**\n This is a convenient alias for `RSVP.Promise.race`.\n\n @method race\n @param {Array} array Array of promises.\n @param {String} label An optional label. This is useful\n for tooling.\n @static\n */\n __exports__[\"default\"] = function race(array, label) {\n return Promise.race(array, label);\n };\n });\ndefine(\"rsvp/reject\",\n [\"./promise\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n\n /**\n This is a convenient alias for `RSVP.Promise.reject`.\n\n @method reject\n @for RSVP\n @param {Any} reason value that the returned promise will be rejected with.\n @param {String} label optional string for identifying the returned promise.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n @static\n */\n __exports__[\"default\"] = function reject(reason, label) {\n return Promise.reject(reason, label);\n };\n });\ndefine(\"rsvp/resolve\",\n [\"./promise\",\"exports\"],\n function(__dependency1__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n\n /**\n This is a convenient alias for `RSVP.Promise.resolve`.\n\n @method resolve\n @for RSVP\n @param {Any} value value that the returned promise will be resolved with\n @param {String} label optional string for identifying the returned promise.\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n @static\n */\n __exports__[\"default\"] = function resolve(value, label) {\n return Promise.resolve(value, label);\n };\n });\ndefine(\"rsvp/rethrow\",\n [\"exports\"],\n function(__exports__) {\n \"use strict\";\n /**\n `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event\n loop in order to aid debugging.\n\n Promises A+ specifies that any exceptions that occur with a promise must be\n caught by the promises implementation and bubbled to the last handler. For\n this reason, it is recommended that you always specify a second rejection\n handler function to `then`. However, `RSVP.rethrow` will throw the exception\n outside of the promise, so it bubbles up to your console if in the browser,\n or domain/cause uncaught exception in Node. `rethrow` will also throw the\n error again so the error can be handled by the promise per the spec.\n\n ```javascript\n function throws(){\n throw new Error('Whoops!');\n }\n\n var promise = new RSVP.Promise(function(resolve, reject){\n throws();\n });\n\n promise.catch(RSVP.rethrow).then(function(){\n // Code here doesn't run because the promise became rejected due to an\n // error!\n }, function (err){\n // handle the error here\n });\n ```\n\n The 'Whoops' error will be thrown on the next turn of the event loop\n and you can watch for it in your console. You can also handle it using a\n rejection handler given to `.then` or `.catch` on the returned promise.\n\n @method rethrow\n @for RSVP\n @param {Error} reason reason the promise became rejected.\n @throws Error\n @static\n */\n __exports__[\"default\"] = function rethrow(reason) {\n setTimeout(function() {\n throw reason;\n });\n throw reason;\n };\n });\ndefine(\"rsvp/utils\",\n [\"exports\"],\n function(__exports__) {\n \"use strict\";\n function objectOrFunction(x) {\n return typeof x === \"function\" || (typeof x === \"object\" && x !== null);\n }\n\n __exports__.objectOrFunction = objectOrFunction;function isFunction(x) {\n return typeof x === \"function\";\n }\n\n __exports__.isFunction = isFunction;function isNonThenable(x) {\n return !objectOrFunction(x);\n }\n\n __exports__.isNonThenable = isNonThenable;function isArray(x) {\n return Object.prototype.toString.call(x) === \"[object Array]\";\n }\n\n __exports__.isArray = isArray;// Date.now is not available in browsers < IE9\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility\n var now = Date.now || function() { return new Date().getTime(); };\n __exports__.now = now;\n var keysOf = Object.keys || function(object) {\n var result = [];\n\n for (var prop in object) {\n result.push(prop);\n }\n\n return result;\n };\n __exports__.keysOf = keysOf;\n });\ndefine(\"rsvp\",\n [\"./rsvp/promise\",\"./rsvp/events\",\"./rsvp/node\",\"./rsvp/all\",\"./rsvp/all_settled\",\"./rsvp/race\",\"./rsvp/hash\",\"./rsvp/rethrow\",\"./rsvp/defer\",\"./rsvp/config\",\"./rsvp/map\",\"./rsvp/resolve\",\"./rsvp/reject\",\"./rsvp/filter\",\"exports\"],\n function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __exports__) {\n \"use strict\";\n var Promise = __dependency1__[\"default\"];\n var EventTarget = __dependency2__[\"default\"];\n var denodeify = __dependency3__[\"default\"];\n var all = __dependency4__[\"default\"];\n var allSettled = __dependency5__[\"default\"];\n var race = __dependency6__[\"default\"];\n var hash = __dependency7__[\"default\"];\n var rethrow = __dependency8__[\"default\"];\n var defer = __dependency9__[\"default\"];\n var config = __dependency10__.config;\n var configure = __dependency10__.configure;\n var map = __dependency11__[\"default\"];\n var resolve = __dependency12__[\"default\"];\n var reject = __dependency13__[\"default\"];\n var filter = __dependency14__[\"default\"];\n\n function async(callback, arg) {\n config.async(callback, arg);\n }\n\n function on() {\n config.on.apply(config, arguments);\n }\n\n function off() {\n config.off.apply(config, arguments);\n }\n\n // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__`\n if (typeof window !== 'undefined' && typeof window.__PROMISE_INSTRUMENTATION__ === 'object') {\n var callbacks = window.__PROMISE_INSTRUMENTATION__;\n configure('instrument', true);\n for (var eventName in callbacks) {\n if (callbacks.hasOwnProperty(eventName)) {\n on(eventName, callbacks[eventName]);\n }\n }\n }\n\n __exports__.Promise = Promise;\n __exports__.EventTarget = EventTarget;\n __exports__.all = all;\n __exports__.allSettled = allSettled;\n __exports__.race = race;\n __exports__.hash = hash;\n __exports__.rethrow = rethrow;\n __exports__.defer = defer;\n __exports__.denodeify = denodeify;\n __exports__.configure = configure;\n __exports__.on = on;\n __exports__.off = off;\n __exports__.resolve = resolve;\n __exports__.reject = reject;\n __exports__.async = async;\n __exports__.map = map;\n __exports__.filter = filter;\n });\n\n})();\n//@ sourceURL=rsvp");